From 02f1647776a7f366ec75f79547edaecbcff4c028 Mon Sep 17 00:00:00 2001 From: Trupti Kini Date: Thu, 17 Dec 2015 23:30:18 +0600 Subject: Added(A)/Deleted(D) following books R _A_Textbook_Of_Engineering_Physics/Chapter11.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter11.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter11_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter11_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter12.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter12.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter12_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter12_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter13.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter13.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter13_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter13_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter14.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter14.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter14_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter14_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter15.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter15.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter15_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter15_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter16.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter16.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter16_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter16_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter17.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter17.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter17_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter17_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter18.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter18.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter18_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter18_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter19.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter19.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter19_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter19_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter21.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter21.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter21_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter21_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter22.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter22.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter22_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter22_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter23.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter23.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter23_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter23_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter24.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter24.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter24_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter24_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter4.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter4.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter4_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter4_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter5.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter5.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter5_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter5_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter6.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter6.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter6_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter6_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter7.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter7.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter7_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter7_1.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter8.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter8.ipynb R _A_Textbook_Of_Engineering_Physics/Chapter8_1.ipynb -> A_Textbook_Of_Engineering_Physics/Chapter8_1.ipynb R _A_Textbook_Of_Engineering_Physics/README.txt -> A_Textbook_Of_Engineering_Physics/README.txt R _A_Textbook_Of_Engineering_Physics/screenshots/Chapter11.png -> A_Textbook_Of_Engineering_Physics/screenshots/Chapter11.png R _A_Textbook_Of_Engineering_Physics/screenshots/Chapter11_1.png -> A_Textbook_Of_Engineering_Physics/screenshots/Chapter11_1.png R _A_Textbook_Of_Engineering_Physics/screenshots/Chapter12.png -> A_Textbook_Of_Engineering_Physics/screenshots/Chapter12.png R _A_Textbook_Of_Engineering_Physics/screenshots/Chapter12_1.png -> A_Textbook_Of_Engineering_Physics/screenshots/Chapter12_1.png R _A_Textbook_Of_Engineering_Physics/screenshots/Chapter13.png -> A_Textbook_Of_Engineering_Physics/screenshots/Chapter13.png R _A_Textbook_Of_Engineering_Physics/screenshots/Chapter13_1.png -> A_Textbook_Of_Engineering_Physics/screenshots/Chapter13_1.png D About_Mumbai_by_sd/hemla.ipynb D About_Mumbai_by_sd/screenshots/warning.png D About_Mumbai_by_sd/screenshots/warning_1.png D About_Mumbai_by_sd/screenshots/warning_2.png R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorbption.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorbption.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorption.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorption.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer_.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer_.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer__1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer__1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer_1.ipynb -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer_1.ipynb R _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/README.txt -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/README.txt R _Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH19.png -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH19.png R _Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH3.png -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH3.png R _Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH5.png -> Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH5.png R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/README.txt -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/README.txt R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10_1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10_1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11_1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11_1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12_1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12_1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1_1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1_1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2_1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2_1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3_1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3_1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch4.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch4.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch4_1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch4_1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch5.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch5.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch5_1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch5_1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch6.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch6.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch6_1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch6_1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch7.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch7.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch7_1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch7_1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch8.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch8.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch8_1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch8_1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch9.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch9.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch9_1.ipynb -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch9_1.ipynb R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/energy_stored3.png -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/energy_stored3.png R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/energy_stored3_1.png -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/energy_stored3_1.png R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/magnetic_flux12.png -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/magnetic_flux12.png R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/magnetic_flux12_1.png -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/magnetic_flux12_1.png R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/pitch_factor7.png -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/pitch_factor7.png R _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/pitch_factor7_1.png -> Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/pitch_factor7_1.png A Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/chap1.ipynb A Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/chap2.ipynb A Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/chap3.ipynb A Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/chap4.ipynb A Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/chap5.ipynb A Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/chap6.ipynb A Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/screenshots/2_Charge_current_density.png A Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/screenshots/2_temp_coeff.png A Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/screenshots/Ch1DenCrystal.png R _Engineering_Thermodynamics_by__O._Singh/README.txt -> Engineering_Thermodynamics_by__O._Singh/README.txt R _Engineering_Thermodynamics_by__O._Singh/chapter10.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter10.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter10_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter10_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter10_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter10_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter10_3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter10_3.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter11.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter11.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter11_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter11_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter11_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter11_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter11_3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter11_3.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter12.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter12.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter12_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter12_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter12_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter12_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter12_3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter12_3.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter13.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter13.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter13_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter13_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter13_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter13_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter13_3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter13_3.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter2_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter2_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter2_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter2_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter2_3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter2_3.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter3.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter3_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter3_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter3_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter3_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter3_3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter3_3.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter4.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter4.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter4_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter4_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter4_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter4_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter4_3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter4_3.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter5.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter5.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter5_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter5_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter5_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter5_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter5_3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter5_3.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter6.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter6.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter6_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter6_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter6_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter6_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter6_3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter6_3.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter7-Copy1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter7-Copy1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter7.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter7.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter7_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter7_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter7_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter7_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter8.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter8.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter8_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter8_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter8_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter8_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter8_3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter8_3.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter9.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter9.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter9_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter9_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter9_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter9_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter9_3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter9_3.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter_1_1.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter_1_1.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter_1_2.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter_1_2.ipynb R _Engineering_Thermodynamics_by__O._Singh/chapter_1_3.ipynb -> Engineering_Thermodynamics_by__O._Singh/chapter_1_3.ipynb R _Engineering_Thermodynamics/screenshots/Screenshot_(49).png -> Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49).png R _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_1.png -> Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_1.png R _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_2.png -> Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_2.png R _Engineering_Thermodynamics/screenshots/Screenshot_(50).png -> Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50).png R _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_1.png -> Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_1.png R _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_2.png -> Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_2.png R _Engineering_Thermodynamics/screenshots/Screenshot_(51).png -> Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51).png R _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_1.png -> Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_1.png R _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_2.png -> Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_2.png R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure_.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure_.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing_.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing_.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_1.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_1.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_2.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_2.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_3.ipynb -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_3.ipynb R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/README.txt -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/README.txt R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10.png -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10.png R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_1.png -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_1.png R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_2.png -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_2.png R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_3.png -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_3.png R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11.png -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11.png R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_1.png -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_1.png R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_2.png -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_2.png R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_3.png -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_3.png R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4.png -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4.png R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_1.png -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_1.png R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_2.png -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_2.png R _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_3.png -> Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_3.png R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter10.ipynb -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter10.ipynb R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter11.ipynb -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter11.ipynb R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter2.ipynb -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter2.ipynb R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter3.ipynb -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter3.ipynb R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter4.ipynb -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter4.ipynb R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter5.ipynb -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter5.ipynb R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter6.ipynb -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter6.ipynb R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter7.ipynb -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter7.ipynb R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter8.ipynb -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter8.ipynb R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter9.ipynb -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter9.ipynb R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter10.png -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter10.png R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter11.png -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter11.png R _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter2.png -> Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter2.png R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingFromCtoC++.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingFromCtoC++.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingfromCtoC++.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingfromCtoC++.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions_1.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding.ipynb R _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding_1.ipynb -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding_1.ipynb R _Mastering_C++/README.txt -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/README.txt R _Mastering_C++/screenshots/1.png -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/1.png R _Mastering_C++/screenshots/2.png -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/2.png R _Mastering_C++/screenshots/3.png -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/3.png R _Mastering_C++/screenshots/IMG-20150614-WA0001.png -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150614-WA0001.png R _Mastering_C++/screenshots/IMG-20150614-WA0006.png -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150614-WA0006.png R _Mastering_C++/screenshots/IMG-20150619-WA0002.png -> Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150619-WA0002.png R _Optical_Fiber_Communication_by_V._S._Bagad/Chapter01-Fiber_Optics_Communications_System.ipynb -> Optical_Fiber_Communication_by_V._S._Bagad/Chapter01-Fiber_Optics_Communications_System.ipynb R _Optical_Fiber_Communication_by_V._S._Bagad/Chapter02-Optical_Fiber_for_Telecommunication.ipynb -> Optical_Fiber_Communication_by_V._S._Bagad/Chapter02-Optical_Fiber_for_Telecommunication.ipynb R _Optical_Fiber_Communication_by_V._S._Bagad/Chapter03-Optical_Sources_and_Transmitters.ipynb -> Optical_Fiber_Communication_by_V._S._Bagad/Chapter03-Optical_Sources_and_Transmitters.ipynb R _Optical_Fiber_Communication_by_V._S._Bagad/Chapter04-Optical_Detectors_and_Receivers.ipynb -> Optical_Fiber_Communication_by_V._S._Bagad/Chapter04-Optical_Detectors_and_Receivers.ipynb R _Optical_Fiber_Communication_by_V._S._Bagad/Chapter05-Design_Considerations_in_Optical_Links.ipynb -> Optical_Fiber_Communication_by_V._S._Bagad/Chapter05-Design_Considerations_in_Optical_Links.ipynb R _Optical_Fiber_Communication_by_V._S._Bagad/Chapter1.ipynb -> Optical_Fiber_Communication_by_V._S._Bagad/Chapter1.ipynb R _Optical_Fiber_Communication_by_V._S._Bagad/Chapter2.ipynb -> Optical_Fiber_Communication_by_V._S._Bagad/Chapter2.ipynb R _Optical_Fiber_Communication_by_V._S._Bagad/Chapter3.ipynb -> Optical_Fiber_Communication_by_V._S._Bagad/Chapter3.ipynb R _Optical_Fiber_Communication_by_V._S._Bagad/Chapter4.ipynb -> Optical_Fiber_Communication_by_V._S._Bagad/Chapter4.ipynb R _Optical_Fiber_Communication_by_V._S._Bagad/Chapter5.ipynb -> Optical_Fiber_Communication_by_V._S._Bagad/Chapter5.ipynb R _Optical_Fiber_Communication_by_V._S._Bagad/Chapter6-Advanced_Optical_Systems.ipynb -> Optical_Fiber_Communication_by_V._S._Bagad/Chapter6-Advanced_Optical_Systems.ipynb R _Optical_Fiber_Communication_by_V._S._Bagad/Chapter6.ipynb -> Optical_Fiber_Communication_by_V._S._Bagad/Chapter6.ipynb R _Optical_Fiber_Communication_by_V._S._Bagad/README.txt -> Optical_Fiber_Communication_by_V._S._Bagad/README.txt R _Optical_Fiber_Communication/screenshots/Chapter01-Ex1.7.1.png -> Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter01-Ex1.7.1.png R _Optical_Fiber_Communication/screenshots/Chapter02-Ex2.2.1.png -> Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter02-Ex2.2.1.png R _Optical_Fiber_Communication/screenshots/Chapter03-Ex3.2.1.png -> Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter03-Ex3.2.1.png A Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch3.png A Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch3_1.png A Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch5.png A Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch5_1.png A Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch7.png A Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch7_1.png R _Optical_Fiber_Communication/screenshots/chapter2.png -> Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter2.png R _Optical_Fiber_Communication/screenshots/chapter5.png -> Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter5.png R _Optical_Fiber_Communication/screenshots/chapter6.png -> Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter6.png D Short_Course_by_e/hemla.ipynb D Short_Course_by_e/hemla_1.ipynb D Short_Course_by_e/screenshots/warning.png D Short_Course_by_e/screenshots/warning_1.png D Short_Course_by_e/screenshots/warning_2.png R _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_10_SILICON_CONTROLLED_RECTIFIER.ipynb -> Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_10_SILICON_CONTROLLED_RECTIFIER.ipynb R _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_1_CRYSTAL_STRUCTURES.ipynb -> Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_1_CRYSTAL_STRUCTURES.ipynb R _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_6_ELECTRICAL_BREAKDOWN_IN_PN_JUNCTIONS.ipynb -> Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_6_ELECTRICAL_BREAKDOWN_IN_PN_JUNCTIONS.ipynb R _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_2_ENERGY_BAND_THEORY_OF_SOLIDS.ipynb -> Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_2_ENERGY_BAND_THEORY_OF_SOLIDS.ipynb R _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_3_CARRIER_TRANSPORT_IN_SEMICONDUCTOR.ipynb -> Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_3_CARRIER_TRANSPORT_IN_SEMICONDUCTOR.ipynb R _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_4__EXCESS_CARRIER_IN_SEMICONDUCTOR.ipynb -> Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_4__EXCESS_CARRIER_IN_SEMICONDUCTOR.ipynb R _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_5_PN_JUNCTION_DIODE.ipynb -> Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_5_PN_JUNCTION_DIODE.ipynb R _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_7_BIPOLAR_JUNCTION_TRANSISTORB.ipynb -> Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_7_BIPOLAR_JUNCTION_TRANSISTORB.ipynb R _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_8_THE_FIELD_EFFECT_TRANSISTOR.ipynb -> Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_8_THE_FIELD_EFFECT_TRANSISTOR.ipynb R _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.31.11_pm.png -> Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.31.11_pm.png R _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.32.51_pm.png -> Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.32.51_pm.png R _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.33.45_pm.png -> Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.33.45_pm.png D Test/README.txt D Test/chapter1.ipynb D Test/chapter1_1.ipynb D Test/chapter1_2.ipynb D Test/chapter2.ipynb D Test/chapter2_1.ipynb D Test/chapter2_2.ipynb D Test/screenshots/screen1.png D Test/screenshots/screen1_1.png D Test/screenshots/screen2.png D Test/screenshots/screen2_1.png D Test/screenshots/screen2_2.png D Test/screenshots/screen2_3.png D Test/screenshots/screen3.png D Test/screenshots/screen3_1.png D Test/screenshots/screen3_2.png D TestContribution/Chapter2.ipynb D TestContribution/README.txt D TestContribution/abhisheksharma.ipynb D TestContribution/abhisheksharma_1.ipynb D TestContribution/abhisheksharma_2.ipynb D TestContribution/bilal.ipynb D TestContribution/bilal_1.ipynb D TestContribution/bilal_2.ipynb D TestContribution/bilal_3.ipynb D TestContribution/ch3.ipynb D TestContribution/ch3_1.ipynb D TestContribution/ch3_2.ipynb D TestContribution/chapterno1.ipynb D TestContribution/exampleCount.py D TestContribution/screenshots/State_Direction.png D TestContribution/screenshots/State_Direction_1.png D TestContribution/screenshots/State_Direction_10.png D TestContribution/screenshots/State_Direction_11.png D TestContribution/screenshots/State_Direction_12.png D TestContribution/screenshots/State_Direction_13.png D TestContribution/screenshots/State_Direction_14.png D TestContribution/screenshots/State_Direction_15.png D TestContribution/screenshots/State_Direction_16.png D TestContribution/screenshots/State_Direction_17.png D TestContribution/screenshots/State_Direction_18.png D TestContribution/screenshots/State_Direction_19.png D TestContribution/screenshots/State_Direction_2.png D TestContribution/screenshots/State_Direction_20.png D TestContribution/screenshots/State_Direction_3.png D TestContribution/screenshots/State_Direction_4.png D TestContribution/screenshots/State_Direction_5.png D TestContribution/screenshots/State_Direction_6.png D TestContribution/screenshots/State_Direction_7.png D TestContribution/screenshots/State_Direction_8.png D TestContribution/screenshots/State_Direction_9.png D Testing_Textbook_Companion_Directory/chapter2.ipynb D Testing_Textbook_Companion_Directory/chapter5.ipynb D Testing_Textbook_Companion_Directory/screenshots/energy.png D Testing_Textbook_Companion_Directory/screenshots/internal-energy.png D Testing_Textbook_Companion_Directory/screenshots/temprature.png D Testing_the_interface/README.txt D Testing_the_interface/chapter1.ipynb D Testing_the_interface/chapter11.ipynb D Testing_the_interface/chapter11_1.ipynb D Testing_the_interface/chapter11_2.ipynb D Testing_the_interface/chapter11_3.ipynb D Testing_the_interface/chapter1_1.ipynb D Testing_the_interface/chapter1_2.ipynb D Testing_the_interface/chapter1_3.ipynb D Testing_the_interface/chapter2.ipynb D Testing_the_interface/chapter2_1.ipynb D Testing_the_interface/chapter2_2.ipynb D Testing_the_interface/chapter2_3.ipynb D Testing_the_interface/chapter3.ipynb D Testing_the_interface/chapter3_1.ipynb D Testing_the_interface/chapter3_2.ipynb D Testing_the_interface/chapter3_3.ipynb D Testing_the_interface/chapter4.ipynb D Testing_the_interface/chapter4_1.ipynb D Testing_the_interface/chapter4_2.ipynb D Testing_the_interface/chapter4_3.ipynb D Testing_the_interface/chapter5.ipynb D Testing_the_interface/chapter5_1.ipynb D Testing_the_interface/chapter5_2.ipynb D Testing_the_interface/chapter5_3.ipynb D Testing_the_interface/chapter6.ipynb D Testing_the_interface/chapter6_1.ipynb D Testing_the_interface/chapter6_2.ipynb D Testing_the_interface/chapter6_3.ipynb D Testing_the_interface/chapter7.ipynb D Testing_the_interface/chapter7_1.ipynb D Testing_the_interface/chapter8.ipynb D Testing_the_interface/chapter8_1.ipynb D Testing_the_interface/chapter8_2.ipynb D Testing_the_interface/chapter8_3.ipynb D Testing_the_interface/screenshots/screen1.png D Testing_the_interface/screenshots/screen1_1.png D Testing_the_interface/screenshots/screen1_2.png D Testing_the_interface/screenshots/screen2.png D Testing_the_interface/screenshots/screen2_1.png D Testing_the_interface/screenshots/screen2_2.png D Testing_the_interface/screenshots/screen3.png D Testing_the_interface/screenshots/screen3_1.png D Testing_the_interface/screenshots/screen3_2.png R _Theory_Of_Machines_by__B._K._Sarkar/Chapter1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter1.ipynb R _Theory_Of_Machines/Chapter10.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter10.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter10_1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter10_1.ipynb R _Theory_Of_Machines/Chapter11.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter11.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter11_1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter11_1.ipynb R _Theory_Of_Machines/Chapter12.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter12.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter12_1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter12_1.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter1_1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter1_1.ipynb R _Theory_Of_Machines/Chapter2.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter2.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter2_1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter2_1.ipynb R _Theory_Of_Machines/Chapter3.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter3.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter3_1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter3_1.ipynb R _Theory_Of_Machines/Chapter4.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter4.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter4_1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter4_1.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter5.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter5.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter5_1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter5_1.ipynb R _Theory_Of_Machines/Chapter6.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter6.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter6_1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter6_1.ipynb R _Theory_Of_Machines/Chapter7.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter7.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter7_1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter7_1.ipynb R _Theory_Of_Machines/Chapter8.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter8.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter8_1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter8_1.ipynb R _Theory_Of_Machines/Chapter9.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter9.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/Chapter9_1.ipynb -> Theory_Of_Machines_by__B._K._Sarkar/Chapter9_1.ipynb R _Theory_Of_Machines_by__B._K._Sarkar/README.txt -> Theory_Of_Machines_by__B._K._Sarkar/README.txt R _Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1.png -> Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1.png R _Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1_1.png -> Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1_1.png R _Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2.png -> Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2.png R _Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2_1.png -> Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2_1.png R _Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3.png -> Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3.png R _Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3_1.png -> Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3_1.png D _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH19.png D _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH3.png D _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH5.png D _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49).png D _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50).png D _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51).png D _Power_Electronics/Chapter10.ipynb D _Power_Electronics/Chapter10_1.ipynb D _Power_Electronics/Chapter10_2.ipynb D _Power_Electronics/Chapter10_3.ipynb D _Power_Electronics/Chapter10_4.ipynb D _Power_Electronics/Chapter11.ipynb D _Power_Electronics/Chapter11_1.ipynb D _Power_Electronics/Chapter11_2.ipynb D _Power_Electronics/Chapter11_3.ipynb D _Power_Electronics/Chapter11_4.ipynb D _Power_Electronics/Chapter12.ipynb D _Power_Electronics/Chapter12_1.ipynb D _Power_Electronics/Chapter12_2.ipynb D _Power_Electronics/Chapter12_3.ipynb D _Power_Electronics/Chapter12_4.ipynb D _Power_Electronics/Chapter13.ipynb D _Power_Electronics/Chapter13_1.ipynb D _Power_Electronics/Chapter13_2.ipynb D _Power_Electronics/Chapter13_3.ipynb D _Power_Electronics/Chapter13_4.ipynb D _Power_Electronics/Chapter14.ipynb D _Power_Electronics/Chapter14_1.ipynb D _Power_Electronics/Chapter14_2.ipynb D _Power_Electronics/Chapter14_3.ipynb D _Power_Electronics/Chapter14_4.ipynb D _Power_Electronics/Chapter2.ipynb D _Power_Electronics/Chapter2_1.ipynb D _Power_Electronics/Chapter2_2.ipynb D _Power_Electronics/Chapter2_3.ipynb D _Power_Electronics/Chapter2_4.ipynb D _Power_Electronics/Chapter3.ipynb D _Power_Electronics/Chapter3_1.ipynb D _Power_Electronics/Chapter3_2.ipynb D _Power_Electronics/Chapter3_3.ipynb D _Power_Electronics/Chapter3_4.ipynb D _Power_Electronics/Chapter4.ipynb D _Power_Electronics/Chapter4_1.ipynb D _Power_Electronics/Chapter4_2.ipynb D _Power_Electronics/Chapter4_3.ipynb D _Power_Electronics/Chapter4_4.ipynb D _Power_Electronics/Chapter5.ipynb D _Power_Electronics/Chapter5_1.ipynb D _Power_Electronics/Chapter5_2.ipynb D _Power_Electronics/Chapter5_3.ipynb D _Power_Electronics/Chapter5_4.ipynb D _Power_Electronics/Chapter6.ipynb D _Power_Electronics/Chapter6_1.ipynb D _Power_Electronics/Chapter6_2.ipynb D _Power_Electronics/Chapter6_3.ipynb D _Power_Electronics/Chapter6_4.ipynb D _Power_Electronics/Chapter7.ipynb D _Power_Electronics/Chapter7_1.ipynb D _Power_Electronics/Chapter7_2.ipynb D _Power_Electronics/Chapter7_3.ipynb D _Power_Electronics/Chapter7_4.ipynb D _Power_Electronics/Chapter8.ipynb D _Power_Electronics/Chapter8_1.ipynb D _Power_Electronics/Chapter8_2.ipynb D _Power_Electronics/Chapter8_3.ipynb D _Power_Electronics/Chapter8_4.ipynb D _Power_Electronics/Chapter9.ipynb D _Power_Electronics/Chapter9_1.ipynb D _Power_Electronics/Chapter9_2.ipynb D _Power_Electronics/Chapter9_3.ipynb D _Power_Electronics/Chapter9_4.ipynb D _Power_Electronics/screenshots/Chapter2.png D _Power_Electronics/screenshots/Chapter2_1.png D _Power_Electronics/screenshots/Chapter2_2.png D _Power_Electronics/screenshots/Chapter2_3.png D _Power_Electronics/screenshots/Chapter2_4.png D _Power_Electronics/screenshots/Chapter3.png D _Power_Electronics/screenshots/Chapter3_1.png D _Power_Electronics/screenshots/Chapter3_2.png D _Power_Electronics/screenshots/Chapter3_3.png D _Power_Electronics/screenshots/Chapter3_4.png D _Power_Electronics/screenshots/Chapter4.png D _Power_Electronics/screenshots/Chapter4_1.png D _Power_Electronics/screenshots/Chapter4_2.png D _Power_Electronics/screenshots/Chapter4_3.png D _Power_Electronics/screenshots/Chapter4_4.png D _Theory_Of_Machines/Chapter1.ipynb D _Theory_Of_Machines/Chapter5.ipynb D _Theory_Of_Machines/screenshots/Chapter1.png D _Theory_Of_Machines/screenshots/Chapter2.png D _Theory_Of_Machines/screenshots/Chapter3.png D _Theory_Of_Machines_by__B._K._Sarkar/Chapter10.ipynb D _Theory_Of_Machines_by__B._K._Sarkar/Chapter11.ipynb D _Theory_Of_Machines_by__B._K._Sarkar/Chapter12.ipynb D _Theory_Of_Machines_by__B._K._Sarkar/Chapter2.ipynb D _Theory_Of_Machines_by__B._K._Sarkar/Chapter3.ipynb D _Theory_Of_Machines_by__B._K._Sarkar/Chapter4.ipynb D _Theory_Of_Machines_by__B._K._Sarkar/Chapter6.ipynb D _Theory_Of_Machines_by__B._K._Sarkar/Chapter7.ipynb D _Theory_Of_Machines_by__B._K._Sarkar/Chapter8.ipynb D _Theory_Of_Machines_by__B._K._Sarkar/Chapter9.ipynb D abcd_by_cbvbv/Chapter1.ipynb D abcd_by_cbvbv/Chapter1_1.ipynb D abcd_by_cbvbv/screenshots/k1.png D abcd_by_cbvbv/screenshots/k2.png D abcd_by_cbvbv/screenshots/k2_1.png D abcd_by_cbvbv/screenshots/k3.png D abcd_by_cbvbv/screenshots/k3_1.png D abcd_by_cbvbv/screenshots/k3_2.png D t_by_t/README.txt D t_by_t/anubhav.ipynb D t_by_t/screenshots/blank1.png D t_by_t/screenshots/blank1_(another_copy).png D t_by_t/screenshots/blank1_(copy).png --- A_Textbook_Of_Engineering_Physics/Chapter11.ipynb | 150 ++ .../Chapter11_1.ipynb | 150 ++ A_Textbook_Of_Engineering_Physics/Chapter12.ipynb | 144 ++ .../Chapter12_1.ipynb | 144 ++ A_Textbook_Of_Engineering_Physics/Chapter13.ipynb | 410 +++ .../Chapter13_1.ipynb | 410 +++ A_Textbook_Of_Engineering_Physics/Chapter14.ipynb | 224 ++ .../Chapter14_1.ipynb | 224 ++ A_Textbook_Of_Engineering_Physics/Chapter15.ipynb | 661 +++++ .../Chapter15_1.ipynb | 661 +++++ A_Textbook_Of_Engineering_Physics/Chapter16.ipynb | 187 ++ .../Chapter16_1.ipynb | 187 ++ A_Textbook_Of_Engineering_Physics/Chapter17.ipynb | 138 + .../Chapter17_1.ipynb | 138 + A_Textbook_Of_Engineering_Physics/Chapter18.ipynb | 319 +++ .../Chapter18_1.ipynb | 319 +++ A_Textbook_Of_Engineering_Physics/Chapter19.ipynb | 103 + .../Chapter19_1.ipynb | 103 + A_Textbook_Of_Engineering_Physics/Chapter21.ipynb | 149 ++ .../Chapter21_1.ipynb | 149 ++ A_Textbook_Of_Engineering_Physics/Chapter22.ipynb | 141 + .../Chapter22_1.ipynb | 141 + A_Textbook_Of_Engineering_Physics/Chapter23.ipynb | 311 +++ .../Chapter23_1.ipynb | 311 +++ A_Textbook_Of_Engineering_Physics/Chapter24.ipynb | 312 +++ .../Chapter24_1.ipynb | 312 +++ A_Textbook_Of_Engineering_Physics/Chapter4.ipynb | 314 +++ A_Textbook_Of_Engineering_Physics/Chapter4_1.ipynb | 314 +++ A_Textbook_Of_Engineering_Physics/Chapter5.ipynb | 147 ++ A_Textbook_Of_Engineering_Physics/Chapter5_1.ipynb | 185 ++ A_Textbook_Of_Engineering_Physics/Chapter6.ipynb | 95 + A_Textbook_Of_Engineering_Physics/Chapter6_1.ipynb | 95 + A_Textbook_Of_Engineering_Physics/Chapter7.ipynb | 175 ++ A_Textbook_Of_Engineering_Physics/Chapter7_1.ipynb | 175 ++ A_Textbook_Of_Engineering_Physics/Chapter8.ipynb | 102 + A_Textbook_Of_Engineering_Physics/Chapter8_1.ipynb | 102 + A_Textbook_Of_Engineering_Physics/README.txt | 10 + .../screenshots/Chapter11.png | Bin 0 -> 182635 bytes .../screenshots/Chapter11_1.png | Bin 0 -> 185397 bytes .../screenshots/Chapter12.png | Bin 0 -> 181523 bytes .../screenshots/Chapter12_1.png | Bin 0 -> 184648 bytes .../screenshots/Chapter13.png | Bin 0 -> 191738 bytes .../screenshots/Chapter13_1.png | Bin 0 -> 193890 bytes About_Mumbai_by_sd/hemla.ipynb | 778 ------ About_Mumbai_by_sd/screenshots/warning.png | Bin 79790 -> 0 bytes About_Mumbai_by_sd/screenshots/warning_1.png | Bin 79790 -> 0 bytes About_Mumbai_by_sd/screenshots/warning_2.png | Bin 79790 -> 0 bytes ...CHapter_17_Homogeneous_Chemical_Reactions.ipynb | 280 ++ ...apter_17_Homogeneous_Chemical_Reactions_1.ipynb | 262 ++ .../Chapter_10_Absorbption.ipynb | 255 ++ .../Chapter_10_Absorption.ipynb | 228 ++ ..._11_Mass_Transfer_in_Biology_and_Medicine.ipynb | 174 ++ ...1_Mass_Transfer_in_Biology_and_Medicine_1.ipynb | 156 ++ .../Chapter_12_Diffrential_Distillation.ipynb | 196 ++ .../Chapter_12_Diffrential_Distillation_1.ipynb | 178 ++ .../Chapter_13_Staged_Distillation.ipynb | 272 ++ .../Chapter_13_Staged_Distillation_1.ipynb | 254 ++ .../Chapter_14_Extraction.ipynb | 213 ++ .../Chapter_14_Extraction_1.ipynb | 159 ++ .../Chapter_15_Adsorption.ipynb | 210 ++ .../Chapter_15_Adsorption_1.ipynb | 192 ++ ...ions_and_Heterogeneous_Chemical_Reactions.ipynb | 124 + ...ns_and_Heterogeneous_Chemical_Reactions_1.ipynb | 115 + .../Chapter_18_Membranes.ipynb | 341 +++ .../Chapter_18_Membranes_1.ipynb | 332 +++ ..._Controlled_Release_and_Related_Phenomena.ipynb | 126 + ...ontrolled_Release_and_Related_Phenomena_1.ipynb | 108 + .../Chapter_20_Heat_Transfer.ipynb | 303 +++ .../Chapter_20_Heat_Transfer_1.ipynb | 294 +++ ...er_21_Simultaneous_Heat_and_Mass_Transfer.ipynb | 265 ++ ..._21_Simultaneous_Heat_and_Mass_Transfer_1.ipynb | 256 ++ ...pter_3_Diffusion_in_Concentrated_Solution.ipynb | 127 + ...er_3_Diffusion_in_Concentrated_Solution_1.ipynb | 118 + .../Chapter_4_Dispersion.ipynb | 126 + .../Chapter_4_Dispersion_1.ipynb | 117 + ...Chapter_5_Values_of_Diffusion_Coefficient.ipynb | 371 +++ ...apter_5_Values_of_Diffusion_Coefficient_1.ipynb | 353 +++ ...hapter_6_Diffusion_of_Interacting_Species.ipynb | 375 +++ ...pter_6_Diffusion_of_Interacting_Species_1.ipynb | 339 +++ .../Chapter_8_Fundamentals_of_Mass_Transfer_.ipynb | 503 ++++ ...hapter_8_Fundamentals_of_Mass_Transfer__1.ipynb | 494 ++++ .../Chapter_9__Theories_of_Mass_Transfer.ipynb | 265 ++ .../Chapter_9__Theories_of_Mass_Transfer_1.ipynb | 238 ++ .../README.txt | 10 + .../screenshots/CH19.png | Bin 0 -> 65819 bytes .../screenshots/CH3.png | Bin 0 -> 28671 bytes .../screenshots/CH5.png | Bin 0 -> 43930 bytes .../README.txt | 10 + .../ch1.ipynb | 575 ++++ .../ch10.ipynb | 357 +++ .../ch10_1.ipynb | 357 +++ .../ch11.ipynb | 120 + .../ch11_1.ipynb | 120 + .../ch12.ipynb | 152 ++ .../ch12_1.ipynb | 152 ++ .../ch1_1.ipynb | 575 ++++ .../ch2.ipynb | 393 +++ .../ch2_1.ipynb | 393 +++ .../ch3.ipynb | 399 +++ .../ch3_1.ipynb | 399 +++ .../ch4.ipynb | 849 ++++++ .../ch4_1.ipynb | 849 ++++++ .../ch5.ipynb | 488 ++++ .../ch5_1.ipynb | 488 ++++ .../ch6.ipynb | 513 ++++ .../ch6_1.ipynb | 513 ++++ .../ch7.ipynb | 447 ++++ .../ch7_1.ipynb | 447 ++++ .../ch8.ipynb | 384 +++ .../ch8_1.ipynb | 384 +++ .../ch9.ipynb | 510 ++++ .../ch9_1.ipynb | 510 ++++ .../screenshots/energy_stored3.png | Bin 0 -> 45075 bytes .../screenshots/energy_stored3_1.png | Bin 0 -> 45075 bytes .../screenshots/magnetic_flux12.png | Bin 0 -> 59969 bytes .../screenshots/magnetic_flux12_1.png | Bin 0 -> 59969 bytes .../screenshots/pitch_factor7.png | Bin 0 -> 41344 bytes .../screenshots/pitch_factor7_1.png | Bin 0 -> 41344 bytes .../chap1.ipynb | 220 ++ .../chap2.ipynb | 1553 +++++++++++ .../chap3.ipynb | 1142 ++++++++ .../chap4.ipynb | 439 ++++ .../chap5.ipynb | 218 ++ .../chap6.ipynb | 177 ++ .../screenshots/2_Charge_current_density.png | Bin 0 -> 62808 bytes .../screenshots/2_temp_coeff.png | Bin 0 -> 50644 bytes .../screenshots/Ch1DenCrystal.png | Bin 0 -> 48997 bytes Engineering_Thermodynamics_by__O._Singh/README.txt | 10 + .../chapter10.ipynb | 1080 ++++++++ .../chapter10_1.ipynb | 1080 ++++++++ .../chapter10_2.ipynb | 1080 ++++++++ .../chapter10_3.ipynb | 1080 ++++++++ .../chapter11.ipynb | 1309 ++++++++++ .../chapter11_1.ipynb | 1309 ++++++++++ .../chapter11_2.ipynb | 1309 ++++++++++ .../chapter11_3.ipynb | 1309 ++++++++++ .../chapter12.ipynb | 818 ++++++ .../chapter12_1.ipynb | 818 ++++++ .../chapter12_2.ipynb | 818 ++++++ .../chapter12_3.ipynb | 818 ++++++ .../chapter13.ipynb | 375 +++ .../chapter13_1.ipynb | 375 +++ .../chapter13_2.ipynb | 375 +++ .../chapter13_3.ipynb | 375 +++ .../chapter2.ipynb | 314 +++ .../chapter2_1.ipynb | 314 +++ .../chapter2_2.ipynb | 314 +++ .../chapter2_3.ipynb | 314 +++ .../chapter3.ipynb | 1506 +++++++++++ .../chapter3_1.ipynb | 1506 +++++++++++ .../chapter3_2.ipynb | 1506 +++++++++++ .../chapter3_3.ipynb | 1506 +++++++++++ .../chapter4.ipynb | 1070 ++++++++ .../chapter4_1.ipynb | 1070 ++++++++ .../chapter4_2.ipynb | 1070 ++++++++ .../chapter4_3.ipynb | 1070 ++++++++ .../chapter5.ipynb | 1126 ++++++++ .../chapter5_1.ipynb | 1126 ++++++++ .../chapter5_2.ipynb | 1124 ++++++++ .../chapter5_3.ipynb | 1124 ++++++++ .../chapter6.ipynb | 1390 ++++++++++ .../chapter6_1.ipynb | 1390 ++++++++++ .../chapter6_2.ipynb | 1390 ++++++++++ .../chapter6_3.ipynb | 1390 ++++++++++ .../chapter7-Copy1.ipynb | 1452 +++++++++++ .../chapter7.ipynb | 1452 +++++++++++ .../chapter7_1.ipynb | 1452 +++++++++++ .../chapter7_2.ipynb | 1466 +++++++++++ .../chapter8.ipynb | 2594 +++++++++++++++++++ .../chapter8_1.ipynb | 2594 +++++++++++++++++++ .../chapter8_2.ipynb | 2594 +++++++++++++++++++ .../chapter8_3.ipynb | 2594 +++++++++++++++++++ .../chapter9.ipynb | 1655 ++++++++++++ .../chapter9_1.ipynb | 1655 ++++++++++++ .../chapter9_2.ipynb | 1655 ++++++++++++ .../chapter9_3.ipynb | 1655 ++++++++++++ .../chapter_1.ipynb | 1777 +++++++++++++ .../chapter_1_1.ipynb | 1777 +++++++++++++ .../chapter_1_2.ipynb | 1777 +++++++++++++ .../chapter_1_3.ipynb | 1777 +++++++++++++ .../screenshots/Screenshot_(49).png | Bin 0 -> 147890 bytes .../screenshots/Screenshot_(49)_1.png | Bin 0 -> 147890 bytes .../screenshots/Screenshot_(49)_2.png | Bin 0 -> 147890 bytes .../screenshots/Screenshot_(50).png | Bin 0 -> 201679 bytes .../screenshots/Screenshot_(50)_1.png | Bin 0 -> 201679 bytes .../screenshots/Screenshot_(50)_2.png | Bin 0 -> 201679 bytes .../screenshots/Screenshot_(51).png | Bin 0 -> 167838 bytes .../screenshots/Screenshot_(51)_1.png | Bin 0 -> 167838 bytes .../screenshots/Screenshot_(51)_2.png | Bin 0 -> 167838 bytes ..._10_Solid_Solutions_and_Phase_Equilibrium.ipynb | 155 ++ ...0_Solid_Solutions_and_Phase_Equilibrium_1.ipynb | 155 ++ ...0_Solid_Solutions_and_Phase_Equilibrium_2.ipynb | 155 ++ ...0_Solid_Solutions_and_Phase_Equilibrium_3.ipynb | 155 ++ ...Strengthening_and_Eutectic_Phase_Diagrams.ipynb | 198 ++ ...rengthening_and_Eutectic_Phase_Diagrams_1.ipynb | 198 ++ ...rengthening_and_Eutectic_Phase_Diagrams_2.ipynb | 198 ++ ...rengthening_and_Eutectic_Phase_Diagrams_3.ipynb | 198 ++ ..._by_Phase_Transmission_and_Heat_Treatment.ipynb | 211 ++ ...y_Phase_Transmission_and_Heat_Treatment_1.ipynb | 211 ++ ...y_Phase_Transmission_and_Heat_Treatment_2.ipynb | 211 ++ ...y_Phase_Transmission_and_Heat_Treatment_3.ipynb | 211 ++ ...13_Heat_treatment_of_Steels_and_Cast_Iron.ipynb | 103 + ..._Heat_treatment_of_Steels_and_Cast_Iron_1.ipynb | 103 + ..._Heat_treatment_of_Steels_and_Cast_Iron_2.ipynb | 103 + ..._Heat_treatment_of_Steels_and_Cast_Iron_3.ipynb | 103 + .../Chapter_14_Nonferrous_Alloy.ipynb | 76 + .../Chapter_14_Nonferrous_Alloy_1.ipynb | 76 + .../Chapter_14_Nonferrous_Alloy_2.ipynb | 76 + .../Chapter_14_Nonferrous_Alloy_3.ipynb | 76 + .../Chapter_15_Ceramic_Materials.ipynb | 111 + .../Chapter_15_Ceramic_Materials_1.ipynb | 111 + .../Chapter_15_Ceramic_Materials_2.ipynb | 111 + .../Chapter_15_Ceramic_Materials_3.ipynb | 111 + .../Chapter_16_Polymers.ipynb | 221 ++ .../Chapter_16_Polymers_1.ipynb | 221 ++ .../Chapter_16_Polymers_2.ipynb | 221 ++ .../Chapter_16_Polymers_3.ipynb | 221 ++ ...posites_Teamwork_and_Synergy_in_Materials.ipynb | 374 +++ ...sites_Teamwork_and_Synergy_in_Materials_1.ipynb | 374 +++ ...sites_Teamwork_and_Synergy_in_Materials_2.ipynb | 374 +++ ...sites_Teamwork_and_Synergy_in_Materials_3.ipynb | 374 +++ .../Chapter_2_Atomic_Structure_.ipynb | 131 + .../Chapter_2_Atomic_Structure__1.ipynb | 131 + .../Chapter_2_Atomic_Structure__2.ipynb | 131 + .../Chapter_2_Atomic_Structure__3.ipynb | 131 + .../Chapter_3_Atomic_and_Ionic_Arrangements.ipynb | 419 +++ ...Chapter_3_Atomic_and_Ionic_Arrangements_1.ipynb | 419 +++ ...Chapter_3_Atomic_and_Ionic_Arrangements_2.ipynb | 419 +++ ...Chapter_3_Atomic_and_Ionic_Arrangements_3.ipynb | 419 +++ ...fections_in_Atomic_and_Ionic_Arrangements.ipynb | 301 +++ ...ctions_in_Atomic_and_Ionic_Arrangements_1.ipynb | 301 +++ ...ctions_in_Atomic_and_Ionic_Arrangements_2.ipynb | 301 +++ ...ctions_in_Atomic_and_Ionic_Arrangements_3.ipynb | 301 +++ ...pter_5_Atoms_and_Ion_Moments_in_Materials.ipynb | 352 +++ ...er_5_Atoms_and_Ion_Moments_in_Materials_1.ipynb | 352 +++ ...er_5_Atoms_and_Ion_Moments_in_Materials_2.ipynb | 352 +++ ...er_5_Atoms_and_Ion_Moments_in_Materials_3.ipynb | 352 +++ .../Chapter_6_Mechanical_Properties_part_one.ipynb | 292 +++ ...hapter_6_Mechanical_Properties_part_one_1.ipynb | 292 +++ ...hapter_6_Mechanical_Properties_part_one_2.ipynb | 292 +++ ...hapter_6_Mechanical_Properties_part_one_3.ipynb | 292 +++ .../Chapter_7_Mechanical_Properties_part_two.ipynb | 245 ++ ...hapter_7_Mechanical_Properties_part_two_1.ipynb | 245 ++ ...hapter_7_Mechanical_Properties_part_two_2.ipynb | 245 ++ ...hapter_7_Mechanical_Properties_part_two_3.ipynb | 245 ++ ...Chapter_8_Strain_Hardening_and_Annealing_.ipynb | 223 ++ ...apter_8_Strain_Hardening_and_Annealing__1.ipynb | 223 ++ ...apter_8_Strain_Hardening_and_Annealing__2.ipynb | 223 ++ ...apter_8_Strain_Hardening_and_Annealing__3.ipynb | 223 ++ .../Chapter_9_Principles_of_Solidification.ipynb | 191 ++ .../Chapter_9_Principles_of_Solidification_1.ipynb | 191 ++ .../Chapter_9_Principles_of_Solidification_2.ipynb | 191 ++ .../Chapter_9_Principles_of_Solidification_3.ipynb | 191 ++ .../README.txt | 10 + .../screenshots/cha_10.png | Bin 0 -> 99655 bytes .../screenshots/cha_10_1.png | Bin 0 -> 99655 bytes .../screenshots/cha_10_2.png | Bin 0 -> 99655 bytes .../screenshots/cha_10_3.png | Bin 0 -> 99655 bytes .../screenshots/cha_11.png | Bin 0 -> 451054 bytes .../screenshots/cha_11_1.png | Bin 0 -> 451054 bytes .../screenshots/cha_11_2.png | Bin 0 -> 451054 bytes .../screenshots/cha_11_3.png | Bin 0 -> 451054 bytes .../screenshots/cha_4.png | Bin 0 -> 69365 bytes .../screenshots/cha_4_1.png | Bin 0 -> 69365 bytes .../screenshots/cha_4_2.png | Bin 0 -> 69365 bytes .../screenshots/cha_4_3.png | Bin 0 -> 69365 bytes .../Chapter10.ipynb | 737 ++++++ .../Chapter11.ipynb | 738 ++++++ .../Chapter2.ipynb | 818 ++++++ .../Chapter3.ipynb | 813 ++++++ .../Chapter4.ipynb | 362 +++ .../Chapter5.ipynb | 219 ++ .../Chapter6.ipynb | 853 ++++++ .../Chapter7.ipynb | 692 +++++ .../Chapter8.ipynb | 763 ++++++ .../Chapter9.ipynb | 795 ++++++ .../screenshots/chapter10.png | Bin 0 -> 154685 bytes .../screenshots/chapter11.png | Bin 0 -> 185250 bytes .../screenshots/chapter2.png | Bin 0 -> 183110 bytes .../Chapter10-ClassesAndObjects.ipynb | 1241 +++++++++ .../Chapter10-ClassesAndObjects_1.ipynb | 1241 +++++++++ ...Chapter11-ObjectInitializationAndClean-Up.ipynb | 1781 +++++++++++++ ...apter11-ObjectInitializationAndClean-Up_1.ipynb | 1781 +++++++++++++ .../Chapter12-DynamicObjects.ipynb | 1590 ++++++++++++ .../Chapter12-DynamicObjects_1.ipynb | 1589 ++++++++++++ .../Chapter13-OperatorOverloading.ipynb | 2673 +++++++++++++++++++ .../Chapter13-OperatorOverloading_1.ipynb | 2672 +++++++++++++++++++ .../Chapter14-Inheritance.ipynb | 2736 ++++++++++++++++++++ .../Chapter14-Inheritance_1.ipynb | 2736 ++++++++++++++++++++ .../Chapter15-VirtualFunctions.ipynb | 629 +++++ .../Chapter15-VirtualFunctions_1.ipynb | 629 +++++ ...Chapter16-GenericProgrammingWithTemplates.ipynb | 1512 +++++++++++ ...apter16-GenericProgrammingWithTemplates_1.ipynb | 1512 +++++++++++ .../Chapter17-StreamsComputationWithConsole.ipynb | 1338 ++++++++++ ...Chapter17-StreamsComputationWithConsole_1.ipynb | 1338 ++++++++++ .../Chapter18-StreamsComputationWithFiles.ipynb | 1152 +++++++++ .../Chapter18-StreamsComputationWithFiles_1.ipynb | 1152 +++++++++ .../Chapter19-ExceptionHandling.ipynb | 1454 +++++++++++ .../Chapter19-ExceptionHandling_1.ipynb | 1454 +++++++++++ .../Chapter2-MovingFromCtoC++.ipynb | 1389 ++++++++++ .../Chapter2-MovingfromCtoC++.ipynb | 1389 ++++++++++ .../Chapter3-C++AtAGlance.ipynb | 629 +++++ .../Chapter3-C++AtAGlance_1.ipynb | 629 +++++ ...hapter4-DataTypes,OperatorsAndExpressions.ipynb | 881 +++++++ ...pter4-DataTypes,OperatorsAndExpressions_1.ipynb | 881 +++++++ .../Chapter5-ControlFlow.ipynb | 1280 +++++++++ .../Chapter5-ControlFlow_1.ipynb | 1280 +++++++++ .../Chapter6-ArraysAndStrings.ipynb | 1593 ++++++++++++ .../Chapter6-ArraysAndStrings_1.ipynb | 1593 ++++++++++++ .../Chapter7-ModularProgrammingWithFunctions.ipynb | 1641 ++++++++++++ ...hapter7-ModularProgrammingWithFunctions_1.ipynb | 1641 ++++++++++++ .../Chapter8-StructuresAndUnions.ipynb | 1202 +++++++++ .../Chapter8-StructuresAndUnions_1.ipynb | 1202 +++++++++ .../Chapter9-PointersAndRuntimeBinding.ipynb | 1663 ++++++++++++ .../Chapter9-PointersAndRuntimeBinding_1.ipynb | 1661 ++++++++++++ .../README.txt | 10 + .../screenshots/1.png | Bin 0 -> 25091 bytes .../screenshots/2.png | Bin 0 -> 34813 bytes .../screenshots/3.png | Bin 0 -> 21509 bytes .../screenshots/IMG-20150614-WA0001.png | Bin 0 -> 127124 bytes .../screenshots/IMG-20150614-WA0006.png | Bin 0 -> 135963 bytes .../screenshots/IMG-20150619-WA0002.png | Bin 0 -> 192323 bytes ...pter01-Fiber_Optics_Communications_System.ipynb | 1240 +++++++++ ...ter02-Optical_Fiber_for_Telecommunication.ipynb | 945 +++++++ ...hapter03-Optical_Sources_and_Transmitters.ipynb | 826 ++++++ ...Chapter04-Optical_Detectors_and_Receivers.ipynb | 644 +++++ ...05-Design_Considerations_in_Optical_Links.ipynb | 458 ++++ .../Chapter1.ipynb | 1240 +++++++++ .../Chapter2.ipynb | 945 +++++++ .../Chapter3.ipynb | 826 ++++++ .../Chapter4.ipynb | 644 +++++ .../Chapter5.ipynb | 458 ++++ .../Chapter6-Advanced_Optical_Systems.ipynb | 317 +++ .../Chapter6.ipynb | 317 +++ .../README.txt | 10 + .../screenshots/Chapter01-Ex1.7.1.png | Bin 0 -> 54470 bytes .../screenshots/Chapter02-Ex2.2.1.png | Bin 0 -> 63781 bytes .../screenshots/Chapter03-Ex3.2.1.png | Bin 0 -> 55531 bytes .../screenshots/ch3.png | Bin 0 -> 34616 bytes .../screenshots/ch3_1.png | Bin 0 -> 34616 bytes .../screenshots/ch5.png | Bin 0 -> 45025 bytes .../screenshots/ch5_1.png | Bin 0 -> 45025 bytes .../screenshots/ch7.png | Bin 0 -> 39064 bytes .../screenshots/ch7_1.png | Bin 0 -> 39064 bytes .../screenshots/chapter2.png | Bin 0 -> 44565 bytes .../screenshots/chapter5.png | Bin 0 -> 38867 bytes .../screenshots/chapter6.png | Bin 0 -> 34694 bytes Short_Course_by_e/hemla.ipynb | 778 ------ Short_Course_by_e/hemla_1.ipynb | 778 ------ Short_Course_by_e/screenshots/warning.png | Bin 79790 -> 0 bytes Short_Course_by_e/screenshots/warning_1.png | Bin 79790 -> 0 bytes Short_Course_by_e/screenshots/warning_2.png | Bin 79790 -> 0 bytes .../Chapter_10_SILICON_CONTROLLED_RECTIFIER.ipynb | 119 + .../Chapter_1_CRYSTAL_STRUCTURES.ipynb | 677 +++++ ...er_6_ELECTRICAL_BREAKDOWN_IN_PN_JUNCTIONS.ipynb | 991 +++++++ .../chapter_2_ENERGY_BAND_THEORY_OF_SOLIDS.ipynb | 998 +++++++ ...pter_3_CARRIER_TRANSPORT_IN_SEMICONDUCTOR.ipynb | 700 +++++ ...hapter_4__EXCESS_CARRIER_IN_SEMICONDUCTOR.ipynb | 266 ++ .../chapter_5_PN_JUNCTION_DIODE.ipynb | 1364 ++++++++++ .../chapter_7_BIPOLAR_JUNCTION_TRANSISTORB.ipynb | 496 ++++ .../chapter_8_THE_FIELD_EFFECT_TRANSISTOR.ipynb | 806 ++++++ .../Screen_Shot_2015-11-05_at_11.31.11_pm.png | Bin 0 -> 137919 bytes .../Screen_Shot_2015-11-05_at_11.32.51_pm.png | Bin 0 -> 150019 bytes .../Screen_Shot_2015-11-05_at_11.33.45_pm.png | Bin 0 -> 136824 bytes Test/README.txt | 10 - Test/chapter1.ipynb | 423 --- Test/chapter1_1.ipynb | 423 --- Test/chapter1_2.ipynb | 423 --- Test/chapter2.ipynb | 501 ---- Test/chapter2_1.ipynb | 501 ---- Test/chapter2_2.ipynb | 501 ---- Test/screenshots/screen1.png | Bin 64967 -> 0 bytes Test/screenshots/screen1_1.png | Bin 64967 -> 0 bytes Test/screenshots/screen2.png | Bin 18650 -> 0 bytes Test/screenshots/screen2_1.png | Bin 18650 -> 0 bytes Test/screenshots/screen2_2.png | Bin 18650 -> 0 bytes Test/screenshots/screen2_3.png | Bin 18650 -> 0 bytes Test/screenshots/screen3.png | Bin 95229 -> 0 bytes Test/screenshots/screen3_1.png | Bin 95229 -> 0 bytes Test/screenshots/screen3_2.png | Bin 95229 -> 0 bytes TestContribution/Chapter2.ipynb | 322 --- TestContribution/README.txt | 10 - TestContribution/abhisheksharma.ipynb | 946 ------- TestContribution/abhisheksharma_1.ipynb | 946 ------- TestContribution/abhisheksharma_2.ipynb | 946 ------- TestContribution/bilal.ipynb | 406 --- TestContribution/bilal_1.ipynb | 406 --- TestContribution/bilal_2.ipynb | 406 --- TestContribution/bilal_3.ipynb | 406 --- TestContribution/ch3.ipynb | 941 ------- TestContribution/ch3_1.ipynb | 941 ------- TestContribution/ch3_2.ipynb | 941 ------- TestContribution/chapterno1.ipynb | 126 - TestContribution/exampleCount.py | 27 - TestContribution/screenshots/State_Direction.png | Bin 161458 -> 0 bytes TestContribution/screenshots/State_Direction_1.png | Bin 161458 -> 0 bytes .../screenshots/State_Direction_10.png | Bin 161458 -> 0 bytes .../screenshots/State_Direction_11.png | Bin 161458 -> 0 bytes .../screenshots/State_Direction_12.png | Bin 161458 -> 0 bytes .../screenshots/State_Direction_13.png | Bin 161458 -> 0 bytes .../screenshots/State_Direction_14.png | Bin 161458 -> 0 bytes .../screenshots/State_Direction_15.png | Bin 161458 -> 0 bytes .../screenshots/State_Direction_16.png | Bin 161458 -> 0 bytes .../screenshots/State_Direction_17.png | Bin 161458 -> 0 bytes .../screenshots/State_Direction_18.png | Bin 161458 -> 0 bytes .../screenshots/State_Direction_19.png | Bin 161458 -> 0 bytes TestContribution/screenshots/State_Direction_2.png | Bin 161458 -> 0 bytes .../screenshots/State_Direction_20.png | Bin 161458 -> 0 bytes TestContribution/screenshots/State_Direction_3.png | Bin 161458 -> 0 bytes TestContribution/screenshots/State_Direction_4.png | Bin 161458 -> 0 bytes TestContribution/screenshots/State_Direction_5.png | Bin 161458 -> 0 bytes TestContribution/screenshots/State_Direction_6.png | Bin 161458 -> 0 bytes TestContribution/screenshots/State_Direction_7.png | Bin 161458 -> 0 bytes TestContribution/screenshots/State_Direction_8.png | Bin 161458 -> 0 bytes TestContribution/screenshots/State_Direction_9.png | Bin 161458 -> 0 bytes .../chapter2.ipynb | 285 -- .../chapter5.ipynb | 171 -- .../screenshots/energy.png | Bin 34458 -> 0 bytes .../screenshots/internal-energy.png | Bin 44302 -> 0 bytes .../screenshots/temprature.png | Bin 39632 -> 0 bytes Testing_the_interface/README.txt | 10 - Testing_the_interface/chapter1.ipynb | 423 --- Testing_the_interface/chapter11.ipynb | 516 ---- Testing_the_interface/chapter11_1.ipynb | 516 ---- Testing_the_interface/chapter11_2.ipynb | 516 ---- Testing_the_interface/chapter11_3.ipynb | 516 ---- Testing_the_interface/chapter1_1.ipynb | 423 --- Testing_the_interface/chapter1_2.ipynb | 423 --- Testing_the_interface/chapter1_3.ipynb | 423 --- Testing_the_interface/chapter2.ipynb | 501 ---- Testing_the_interface/chapter2_1.ipynb | 501 ---- Testing_the_interface/chapter2_2.ipynb | 501 ---- Testing_the_interface/chapter2_3.ipynb | 501 ---- Testing_the_interface/chapter3.ipynb | 495 ---- Testing_the_interface/chapter3_1.ipynb | 495 ---- Testing_the_interface/chapter3_2.ipynb | 495 ---- Testing_the_interface/chapter3_3.ipynb | 495 ---- Testing_the_interface/chapter4.ipynb | 116 - Testing_the_interface/chapter4_1.ipynb | 116 - Testing_the_interface/chapter4_2.ipynb | 116 - Testing_the_interface/chapter4_3.ipynb | 116 - Testing_the_interface/chapter5.ipynb | 800 ------ Testing_the_interface/chapter5_1.ipynb | 800 ------ Testing_the_interface/chapter5_2.ipynb | 800 ------ Testing_the_interface/chapter5_3.ipynb | 800 ------ Testing_the_interface/chapter6.ipynb | 444 ---- Testing_the_interface/chapter6_1.ipynb | 444 ---- Testing_the_interface/chapter6_2.ipynb | 444 ---- Testing_the_interface/chapter6_3.ipynb | 444 ---- Testing_the_interface/chapter7.ipynb | 465 ---- Testing_the_interface/chapter7_1.ipynb | 465 ---- Testing_the_interface/chapter8.ipynb | 524 ---- Testing_the_interface/chapter8_1.ipynb | 524 ---- Testing_the_interface/chapter8_2.ipynb | 524 ---- Testing_the_interface/chapter8_3.ipynb | 524 ---- Testing_the_interface/screenshots/screen1.png | Bin 64967 -> 0 bytes Testing_the_interface/screenshots/screen1_1.png | Bin 64967 -> 0 bytes Testing_the_interface/screenshots/screen1_2.png | Bin 64967 -> 0 bytes Testing_the_interface/screenshots/screen2.png | Bin 18650 -> 0 bytes Testing_the_interface/screenshots/screen2_1.png | Bin 18650 -> 0 bytes Testing_the_interface/screenshots/screen2_2.png | Bin 18650 -> 0 bytes Testing_the_interface/screenshots/screen3.png | Bin 95229 -> 0 bytes Testing_the_interface/screenshots/screen3_1.png | Bin 95229 -> 0 bytes Testing_the_interface/screenshots/screen3_2.png | Bin 95229 -> 0 bytes Theory_Of_Machines_by__B._K._Sarkar/Chapter1.ipynb | 663 +++++ .../Chapter10.ipynb | 507 ++++ .../Chapter10_1.ipynb | 507 ++++ .../Chapter11.ipynb | 450 ++++ .../Chapter11_1.ipynb | 450 ++++ .../Chapter12.ipynb | 380 +++ .../Chapter12_1.ipynb | 380 +++ .../Chapter1_1.ipynb | 663 +++++ Theory_Of_Machines_by__B._K._Sarkar/Chapter2.ipynb | 824 ++++++ .../Chapter2_1.ipynb | 824 ++++++ Theory_Of_Machines_by__B._K._Sarkar/Chapter3.ipynb | 782 ++++++ .../Chapter3_1.ipynb | 782 ++++++ Theory_Of_Machines_by__B._K._Sarkar/Chapter4.ipynb | 946 +++++++ .../Chapter4_1.ipynb | 946 +++++++ Theory_Of_Machines_by__B._K._Sarkar/Chapter5.ipynb | 413 +++ .../Chapter5_1.ipynb | 413 +++ Theory_Of_Machines_by__B._K._Sarkar/Chapter6.ipynb | 486 ++++ .../Chapter6_1.ipynb | 486 ++++ Theory_Of_Machines_by__B._K._Sarkar/Chapter7.ipynb | 638 +++++ .../Chapter7_1.ipynb | 638 +++++ Theory_Of_Machines_by__B._K._Sarkar/Chapter8.ipynb | 334 +++ .../Chapter8_1.ipynb | 334 +++ Theory_Of_Machines_by__B._K._Sarkar/Chapter9.ipynb | 151 ++ .../Chapter9_1.ipynb | 151 ++ Theory_Of_Machines_by__B._K._Sarkar/README.txt | 10 + .../screenshots/chapter1.png | Bin 0 -> 217566 bytes .../screenshots/chapter1_1.png | Bin 0 -> 212445 bytes .../screenshots/chapter2.png | Bin 0 -> 233274 bytes .../screenshots/chapter2_1.png | Bin 0 -> 215298 bytes .../screenshots/chapter3.png | Bin 0 -> 240157 bytes .../screenshots/chapter3_1.png | Bin 0 -> 218817 bytes _A_Textbook_Of_Engineering_Physics/Chapter11.ipynb | 150 -- .../Chapter11_1.ipynb | 150 -- _A_Textbook_Of_Engineering_Physics/Chapter12.ipynb | 144 -- .../Chapter12_1.ipynb | 144 -- _A_Textbook_Of_Engineering_Physics/Chapter13.ipynb | 410 --- .../Chapter13_1.ipynb | 410 --- _A_Textbook_Of_Engineering_Physics/Chapter14.ipynb | 224 -- .../Chapter14_1.ipynb | 224 -- _A_Textbook_Of_Engineering_Physics/Chapter15.ipynb | 661 ----- .../Chapter15_1.ipynb | 661 ----- _A_Textbook_Of_Engineering_Physics/Chapter16.ipynb | 187 -- .../Chapter16_1.ipynb | 187 -- _A_Textbook_Of_Engineering_Physics/Chapter17.ipynb | 138 - .../Chapter17_1.ipynb | 138 - _A_Textbook_Of_Engineering_Physics/Chapter18.ipynb | 319 --- .../Chapter18_1.ipynb | 319 --- _A_Textbook_Of_Engineering_Physics/Chapter19.ipynb | 103 - .../Chapter19_1.ipynb | 103 - _A_Textbook_Of_Engineering_Physics/Chapter21.ipynb | 149 -- .../Chapter21_1.ipynb | 149 -- _A_Textbook_Of_Engineering_Physics/Chapter22.ipynb | 141 - .../Chapter22_1.ipynb | 141 - _A_Textbook_Of_Engineering_Physics/Chapter23.ipynb | 311 --- .../Chapter23_1.ipynb | 311 --- _A_Textbook_Of_Engineering_Physics/Chapter24.ipynb | 312 --- .../Chapter24_1.ipynb | 312 --- _A_Textbook_Of_Engineering_Physics/Chapter4.ipynb | 314 --- .../Chapter4_1.ipynb | 314 --- _A_Textbook_Of_Engineering_Physics/Chapter5.ipynb | 147 -- .../Chapter5_1.ipynb | 185 -- _A_Textbook_Of_Engineering_Physics/Chapter6.ipynb | 95 - .../Chapter6_1.ipynb | 95 - _A_Textbook_Of_Engineering_Physics/Chapter7.ipynb | 175 -- .../Chapter7_1.ipynb | 175 -- _A_Textbook_Of_Engineering_Physics/Chapter8.ipynb | 102 - .../Chapter8_1.ipynb | 102 - _A_Textbook_Of_Engineering_Physics/README.txt | 10 - .../screenshots/Chapter11.png | Bin 182635 -> 0 bytes .../screenshots/Chapter11_1.png | Bin 185397 -> 0 bytes .../screenshots/Chapter12.png | Bin 181523 -> 0 bytes .../screenshots/Chapter12_1.png | Bin 184648 -> 0 bytes .../screenshots/Chapter13.png | Bin 191738 -> 0 bytes .../screenshots/Chapter13_1.png | Bin 193890 -> 0 bytes .../screenshots/CH19.png | Bin 65819 -> 0 bytes .../screenshots/CH3.png | Bin 28671 -> 0 bytes .../screenshots/CH5.png | Bin 43930 -> 0 bytes ...CHapter_17_Homogeneous_Chemical_Reactions.ipynb | 280 -- ...apter_17_Homogeneous_Chemical_Reactions_1.ipynb | 262 -- .../Chapter_10_Absorbption.ipynb | 255 -- .../Chapter_10_Absorption.ipynb | 228 -- ..._11_Mass_Transfer_in_Biology_and_Medicine.ipynb | 174 -- ...1_Mass_Transfer_in_Biology_and_Medicine_1.ipynb | 156 -- .../Chapter_12_Diffrential_Distillation.ipynb | 196 -- .../Chapter_12_Diffrential_Distillation_1.ipynb | 178 -- .../Chapter_13_Staged_Distillation.ipynb | 272 -- .../Chapter_13_Staged_Distillation_1.ipynb | 254 -- .../Chapter_14_Extraction.ipynb | 213 -- .../Chapter_14_Extraction_1.ipynb | 159 -- .../Chapter_15_Adsorption.ipynb | 210 -- .../Chapter_15_Adsorption_1.ipynb | 192 -- ...ions_and_Heterogeneous_Chemical_Reactions.ipynb | 124 - ...ns_and_Heterogeneous_Chemical_Reactions_1.ipynb | 115 - .../Chapter_18_Membranes.ipynb | 341 --- .../Chapter_18_Membranes_1.ipynb | 332 --- ..._Controlled_Release_and_Related_Phenomena.ipynb | 126 - ...ontrolled_Release_and_Related_Phenomena_1.ipynb | 108 - .../Chapter_20_Heat_Transfer.ipynb | 303 --- .../Chapter_20_Heat_Transfer_1.ipynb | 294 --- ...er_21_Simultaneous_Heat_and_Mass_Transfer.ipynb | 265 -- ..._21_Simultaneous_Heat_and_Mass_Transfer_1.ipynb | 256 -- ...pter_3_Diffusion_in_Concentrated_Solution.ipynb | 127 - ...er_3_Diffusion_in_Concentrated_Solution_1.ipynb | 118 - .../Chapter_4_Dispersion.ipynb | 126 - .../Chapter_4_Dispersion_1.ipynb | 117 - ...Chapter_5_Values_of_Diffusion_Coefficient.ipynb | 371 --- ...apter_5_Values_of_Diffusion_Coefficient_1.ipynb | 353 --- ...hapter_6_Diffusion_of_Interacting_Species.ipynb | 375 --- ...pter_6_Diffusion_of_Interacting_Species_1.ipynb | 339 --- .../Chapter_8_Fundamentals_of_Mass_Transfer_.ipynb | 503 ---- ...hapter_8_Fundamentals_of_Mass_Transfer__1.ipynb | 494 ---- .../Chapter_9__Theories_of_Mass_Transfer.ipynb | 265 -- .../Chapter_9__Theories_of_Mass_Transfer_1.ipynb | 238 -- .../README.txt | 10 - .../screenshots/CH19.png | Bin 65819 -> 0 bytes .../screenshots/CH3.png | Bin 28671 -> 0 bytes .../screenshots/CH5.png | Bin 43930 -> 0 bytes .../README.txt | 10 - .../ch1.ipynb | 575 ---- .../ch10.ipynb | 357 --- .../ch10_1.ipynb | 357 --- .../ch11.ipynb | 120 - .../ch11_1.ipynb | 120 - .../ch12.ipynb | 152 -- .../ch12_1.ipynb | 152 -- .../ch1_1.ipynb | 575 ---- .../ch2.ipynb | 393 --- .../ch2_1.ipynb | 393 --- .../ch3.ipynb | 399 --- .../ch3_1.ipynb | 399 --- .../ch4.ipynb | 849 ------ .../ch4_1.ipynb | 849 ------ .../ch5.ipynb | 488 ---- .../ch5_1.ipynb | 488 ---- .../ch6.ipynb | 513 ---- .../ch6_1.ipynb | 513 ---- .../ch7.ipynb | 447 ---- .../ch7_1.ipynb | 447 ---- .../ch8.ipynb | 384 --- .../ch8_1.ipynb | 384 --- .../ch9.ipynb | 510 ---- .../ch9_1.ipynb | 510 ---- .../screenshots/energy_stored3.png | Bin 45075 -> 0 bytes .../screenshots/energy_stored3_1.png | Bin 45075 -> 0 bytes .../screenshots/magnetic_flux12.png | Bin 59969 -> 0 bytes .../screenshots/magnetic_flux12_1.png | Bin 59969 -> 0 bytes .../screenshots/pitch_factor7.png | Bin 41344 -> 0 bytes .../screenshots/pitch_factor7_1.png | Bin 41344 -> 0 bytes .../screenshots/Screenshot_(49).png | Bin 147890 -> 0 bytes .../screenshots/Screenshot_(50).png | Bin 201679 -> 0 bytes .../screenshots/Screenshot_(51).png | Bin 167838 -> 0 bytes .../README.txt | 10 - .../chapter10.ipynb | 1080 -------- .../chapter10_1.ipynb | 1080 -------- .../chapter10_2.ipynb | 1080 -------- .../chapter10_3.ipynb | 1080 -------- .../chapter11.ipynb | 1309 ---------- .../chapter11_1.ipynb | 1309 ---------- .../chapter11_2.ipynb | 1309 ---------- .../chapter11_3.ipynb | 1309 ---------- .../chapter12.ipynb | 818 ------ .../chapter12_1.ipynb | 818 ------ .../chapter12_2.ipynb | 818 ------ .../chapter12_3.ipynb | 818 ------ .../chapter13.ipynb | 375 --- .../chapter13_1.ipynb | 375 --- .../chapter13_2.ipynb | 375 --- .../chapter13_3.ipynb | 375 --- .../chapter2.ipynb | 314 --- .../chapter2_1.ipynb | 314 --- .../chapter2_2.ipynb | 314 --- .../chapter2_3.ipynb | 314 --- .../chapter3.ipynb | 1506 ----------- .../chapter3_1.ipynb | 1506 ----------- .../chapter3_2.ipynb | 1506 ----------- .../chapter3_3.ipynb | 1506 ----------- .../chapter4.ipynb | 1070 -------- .../chapter4_1.ipynb | 1070 -------- .../chapter4_2.ipynb | 1070 -------- .../chapter4_3.ipynb | 1070 -------- .../chapter5.ipynb | 1126 -------- .../chapter5_1.ipynb | 1126 -------- .../chapter5_2.ipynb | 1124 -------- .../chapter5_3.ipynb | 1124 -------- .../chapter6.ipynb | 1390 ---------- .../chapter6_1.ipynb | 1390 ---------- .../chapter6_2.ipynb | 1390 ---------- .../chapter6_3.ipynb | 1390 ---------- .../chapter7-Copy1.ipynb | 1452 ----------- .../chapter7.ipynb | 1452 ----------- .../chapter7_1.ipynb | 1452 ----------- .../chapter7_2.ipynb | 1466 ----------- .../chapter8.ipynb | 2594 ------------------- .../chapter8_1.ipynb | 2594 ------------------- .../chapter8_2.ipynb | 2594 ------------------- .../chapter8_3.ipynb | 2594 ------------------- .../chapter9.ipynb | 1655 ------------ .../chapter9_1.ipynb | 1655 ------------ .../chapter9_2.ipynb | 1655 ------------ .../chapter9_3.ipynb | 1655 ------------ .../chapter_1.ipynb | 1777 ------------- .../chapter_1_1.ipynb | 1777 ------------- .../chapter_1_2.ipynb | 1777 ------------- .../chapter_1_3.ipynb | 1777 ------------- .../screenshots/Screenshot_(49).png | Bin 147890 -> 0 bytes .../screenshots/Screenshot_(49)_1.png | Bin 147890 -> 0 bytes .../screenshots/Screenshot_(49)_2.png | Bin 147890 -> 0 bytes .../screenshots/Screenshot_(50).png | Bin 201679 -> 0 bytes .../screenshots/Screenshot_(50)_1.png | Bin 201679 -> 0 bytes .../screenshots/Screenshot_(50)_2.png | Bin 201679 -> 0 bytes .../screenshots/Screenshot_(51).png | Bin 167838 -> 0 bytes .../screenshots/Screenshot_(51)_1.png | Bin 167838 -> 0 bytes .../screenshots/Screenshot_(51)_2.png | Bin 167838 -> 0 bytes ..._10_Solid_Solutions_and_Phase_Equilibrium.ipynb | 155 -- ...0_Solid_Solutions_and_Phase_Equilibrium_1.ipynb | 155 -- ...0_Solid_Solutions_and_Phase_Equilibrium_2.ipynb | 155 -- ...0_Solid_Solutions_and_Phase_Equilibrium_3.ipynb | 155 -- ...Strengthening_and_Eutectic_Phase_Diagrams.ipynb | 198 -- ...rengthening_and_Eutectic_Phase_Diagrams_1.ipynb | 198 -- ...rengthening_and_Eutectic_Phase_Diagrams_2.ipynb | 198 -- ...rengthening_and_Eutectic_Phase_Diagrams_3.ipynb | 198 -- ..._by_Phase_Transmission_and_Heat_Treatment.ipynb | 211 -- ...y_Phase_Transmission_and_Heat_Treatment_1.ipynb | 211 -- ...y_Phase_Transmission_and_Heat_Treatment_2.ipynb | 211 -- ...y_Phase_Transmission_and_Heat_Treatment_3.ipynb | 211 -- ...13_Heat_treatment_of_Steels_and_Cast_Iron.ipynb | 103 - ..._Heat_treatment_of_Steels_and_Cast_Iron_1.ipynb | 103 - ..._Heat_treatment_of_Steels_and_Cast_Iron_2.ipynb | 103 - ..._Heat_treatment_of_Steels_and_Cast_Iron_3.ipynb | 103 - .../Chapter_14_Nonferrous_Alloy.ipynb | 76 - .../Chapter_14_Nonferrous_Alloy_1.ipynb | 76 - .../Chapter_14_Nonferrous_Alloy_2.ipynb | 76 - .../Chapter_14_Nonferrous_Alloy_3.ipynb | 76 - .../Chapter_15_Ceramic_Materials.ipynb | 111 - .../Chapter_15_Ceramic_Materials_1.ipynb | 111 - .../Chapter_15_Ceramic_Materials_2.ipynb | 111 - .../Chapter_15_Ceramic_Materials_3.ipynb | 111 - .../Chapter_16_Polymers.ipynb | 221 -- .../Chapter_16_Polymers_1.ipynb | 221 -- .../Chapter_16_Polymers_2.ipynb | 221 -- .../Chapter_16_Polymers_3.ipynb | 221 -- ...posites_Teamwork_and_Synergy_in_Materials.ipynb | 374 --- ...sites_Teamwork_and_Synergy_in_Materials_1.ipynb | 374 --- ...sites_Teamwork_and_Synergy_in_Materials_2.ipynb | 374 --- ...sites_Teamwork_and_Synergy_in_Materials_3.ipynb | 374 --- .../Chapter_2_Atomic_Structure_.ipynb | 131 - .../Chapter_2_Atomic_Structure__1.ipynb | 131 - .../Chapter_2_Atomic_Structure__2.ipynb | 131 - .../Chapter_2_Atomic_Structure__3.ipynb | 131 - .../Chapter_3_Atomic_and_Ionic_Arrangements.ipynb | 419 --- ...Chapter_3_Atomic_and_Ionic_Arrangements_1.ipynb | 419 --- ...Chapter_3_Atomic_and_Ionic_Arrangements_2.ipynb | 419 --- ...Chapter_3_Atomic_and_Ionic_Arrangements_3.ipynb | 419 --- ...fections_in_Atomic_and_Ionic_Arrangements.ipynb | 301 --- ...ctions_in_Atomic_and_Ionic_Arrangements_1.ipynb | 301 --- ...ctions_in_Atomic_and_Ionic_Arrangements_2.ipynb | 301 --- ...ctions_in_Atomic_and_Ionic_Arrangements_3.ipynb | 301 --- ...pter_5_Atoms_and_Ion_Moments_in_Materials.ipynb | 352 --- ...er_5_Atoms_and_Ion_Moments_in_Materials_1.ipynb | 352 --- ...er_5_Atoms_and_Ion_Moments_in_Materials_2.ipynb | 352 --- ...er_5_Atoms_and_Ion_Moments_in_Materials_3.ipynb | 352 --- .../Chapter_6_Mechanical_Properties_part_one.ipynb | 292 --- ...hapter_6_Mechanical_Properties_part_one_1.ipynb | 292 --- ...hapter_6_Mechanical_Properties_part_one_2.ipynb | 292 --- ...hapter_6_Mechanical_Properties_part_one_3.ipynb | 292 --- .../Chapter_7_Mechanical_Properties_part_two.ipynb | 245 -- ...hapter_7_Mechanical_Properties_part_two_1.ipynb | 245 -- ...hapter_7_Mechanical_Properties_part_two_2.ipynb | 245 -- ...hapter_7_Mechanical_Properties_part_two_3.ipynb | 245 -- ...Chapter_8_Strain_Hardening_and_Annealing_.ipynb | 223 -- ...apter_8_Strain_Hardening_and_Annealing__1.ipynb | 223 -- ...apter_8_Strain_Hardening_and_Annealing__2.ipynb | 223 -- ...apter_8_Strain_Hardening_and_Annealing__3.ipynb | 223 -- .../Chapter_9_Principles_of_Solidification.ipynb | 191 -- .../Chapter_9_Principles_of_Solidification_1.ipynb | 191 -- .../Chapter_9_Principles_of_Solidification_2.ipynb | 191 -- .../Chapter_9_Principles_of_Solidification_3.ipynb | 191 -- .../README.txt | 10 - .../screenshots/cha_10.png | Bin 99655 -> 0 bytes .../screenshots/cha_10_1.png | Bin 99655 -> 0 bytes .../screenshots/cha_10_2.png | Bin 99655 -> 0 bytes .../screenshots/cha_10_3.png | Bin 99655 -> 0 bytes .../screenshots/cha_11.png | Bin 451054 -> 0 bytes .../screenshots/cha_11_1.png | Bin 451054 -> 0 bytes .../screenshots/cha_11_2.png | Bin 451054 -> 0 bytes .../screenshots/cha_11_3.png | Bin 451054 -> 0 bytes .../screenshots/cha_4.png | Bin 69365 -> 0 bytes .../screenshots/cha_4_1.png | Bin 69365 -> 0 bytes .../screenshots/cha_4_2.png | Bin 69365 -> 0 bytes .../screenshots/cha_4_3.png | Bin 69365 -> 0 bytes .../Chapter10.ipynb | 737 ------ .../Chapter11.ipynb | 738 ------ .../Chapter2.ipynb | 818 ------ .../Chapter3.ipynb | 813 ------ .../Chapter4.ipynb | 362 --- .../Chapter5.ipynb | 219 -- .../Chapter6.ipynb | 853 ------ .../Chapter7.ipynb | 692 ----- .../Chapter8.ipynb | 763 ------ .../Chapter9.ipynb | 795 ------ .../screenshots/chapter10.png | Bin 154685 -> 0 bytes .../screenshots/chapter11.png | Bin 185250 -> 0 bytes .../screenshots/chapter2.png | Bin 183110 -> 0 bytes _Mastering_C++/README.txt | 10 - _Mastering_C++/screenshots/1.png | Bin 25091 -> 0 bytes _Mastering_C++/screenshots/2.png | Bin 34813 -> 0 bytes _Mastering_C++/screenshots/3.png | Bin 21509 -> 0 bytes _Mastering_C++/screenshots/IMG-20150614-WA0001.png | Bin 127124 -> 0 bytes _Mastering_C++/screenshots/IMG-20150614-WA0006.png | Bin 135963 -> 0 bytes _Mastering_C++/screenshots/IMG-20150619-WA0002.png | Bin 192323 -> 0 bytes .../Chapter10-ClassesAndObjects.ipynb | 1241 --------- .../Chapter10-ClassesAndObjects_1.ipynb | 1241 --------- ...Chapter11-ObjectInitializationAndClean-Up.ipynb | 1781 ------------- ...apter11-ObjectInitializationAndClean-Up_1.ipynb | 1781 ------------- .../Chapter12-DynamicObjects.ipynb | 1590 ------------ .../Chapter12-DynamicObjects_1.ipynb | 1589 ------------ .../Chapter13-OperatorOverloading.ipynb | 2673 ------------------- .../Chapter13-OperatorOverloading_1.ipynb | 2672 ------------------- .../Chapter14-Inheritance.ipynb | 2736 -------------------- .../Chapter14-Inheritance_1.ipynb | 2736 -------------------- .../Chapter15-VirtualFunctions.ipynb | 629 ----- .../Chapter15-VirtualFunctions_1.ipynb | 629 ----- ...Chapter16-GenericProgrammingWithTemplates.ipynb | 1512 ----------- ...apter16-GenericProgrammingWithTemplates_1.ipynb | 1512 ----------- .../Chapter17-StreamsComputationWithConsole.ipynb | 1338 ---------- ...Chapter17-StreamsComputationWithConsole_1.ipynb | 1338 ---------- .../Chapter18-StreamsComputationWithFiles.ipynb | 1152 --------- .../Chapter18-StreamsComputationWithFiles_1.ipynb | 1152 --------- .../Chapter19-ExceptionHandling.ipynb | 1454 ----------- .../Chapter19-ExceptionHandling_1.ipynb | 1454 ----------- .../Chapter2-MovingFromCtoC++.ipynb | 1389 ---------- .../Chapter2-MovingfromCtoC++.ipynb | 1389 ---------- .../Chapter3-C++AtAGlance.ipynb | 629 ----- .../Chapter3-C++AtAGlance_1.ipynb | 629 ----- ...hapter4-DataTypes,OperatorsAndExpressions.ipynb | 881 ------- ...pter4-DataTypes,OperatorsAndExpressions_1.ipynb | 881 ------- .../Chapter5-ControlFlow.ipynb | 1280 --------- .../Chapter5-ControlFlow_1.ipynb | 1280 --------- .../Chapter6-ArraysAndStrings.ipynb | 1593 ------------ .../Chapter6-ArraysAndStrings_1.ipynb | 1593 ------------ .../Chapter7-ModularProgrammingWithFunctions.ipynb | 1641 ------------ ...hapter7-ModularProgrammingWithFunctions_1.ipynb | 1641 ------------ .../Chapter8-StructuresAndUnions.ipynb | 1202 --------- .../Chapter8-StructuresAndUnions_1.ipynb | 1202 --------- .../Chapter9-PointersAndRuntimeBinding.ipynb | 1663 ------------ .../Chapter9-PointersAndRuntimeBinding_1.ipynb | 1661 ------------ .../screenshots/Chapter01-Ex1.7.1.png | Bin 54470 -> 0 bytes .../screenshots/Chapter02-Ex2.2.1.png | Bin 63781 -> 0 bytes .../screenshots/Chapter03-Ex3.2.1.png | Bin 55531 -> 0 bytes .../screenshots/chapter2.png | Bin 44565 -> 0 bytes .../screenshots/chapter5.png | Bin 38867 -> 0 bytes .../screenshots/chapter6.png | Bin 34694 -> 0 bytes ...pter01-Fiber_Optics_Communications_System.ipynb | 1240 --------- ...ter02-Optical_Fiber_for_Telecommunication.ipynb | 945 ------- ...hapter03-Optical_Sources_and_Transmitters.ipynb | 826 ------ ...Chapter04-Optical_Detectors_and_Receivers.ipynb | 644 ----- ...05-Design_Considerations_in_Optical_Links.ipynb | 458 ---- .../Chapter1.ipynb | 1240 --------- .../Chapter2.ipynb | 945 ------- .../Chapter3.ipynb | 826 ------ .../Chapter4.ipynb | 644 ----- .../Chapter5.ipynb | 458 ---- .../Chapter6-Advanced_Optical_Systems.ipynb | 317 --- .../Chapter6.ipynb | 317 --- .../README.txt | 10 - _Power_Electronics/Chapter10.ipynb | 228 -- _Power_Electronics/Chapter10_1.ipynb | 228 -- _Power_Electronics/Chapter10_2.ipynb | 228 -- _Power_Electronics/Chapter10_3.ipynb | 228 -- _Power_Electronics/Chapter10_4.ipynb | 228 -- _Power_Electronics/Chapter11.ipynb | 299 --- _Power_Electronics/Chapter11_1.ipynb | 299 --- _Power_Electronics/Chapter11_2.ipynb | 299 --- _Power_Electronics/Chapter11_3.ipynb | 299 --- _Power_Electronics/Chapter11_4.ipynb | 299 --- _Power_Electronics/Chapter12.ipynb | 1997 -------------- _Power_Electronics/Chapter12_1.ipynb | 1997 -------------- _Power_Electronics/Chapter12_2.ipynb | 1997 -------------- _Power_Electronics/Chapter12_3.ipynb | 1997 -------------- _Power_Electronics/Chapter12_4.ipynb | 1997 -------------- _Power_Electronics/Chapter13.ipynb | 342 --- _Power_Electronics/Chapter13_1.ipynb | 342 --- _Power_Electronics/Chapter13_2.ipynb | 342 --- _Power_Electronics/Chapter13_3.ipynb | 342 --- _Power_Electronics/Chapter13_4.ipynb | 342 --- _Power_Electronics/Chapter14.ipynb | 93 - _Power_Electronics/Chapter14_1.ipynb | 93 - _Power_Electronics/Chapter14_2.ipynb | 93 - _Power_Electronics/Chapter14_3.ipynb | 93 - _Power_Electronics/Chapter14_4.ipynb | 93 - _Power_Electronics/Chapter2.ipynb | 233 -- _Power_Electronics/Chapter2_1.ipynb | 233 -- _Power_Electronics/Chapter2_2.ipynb | 233 -- _Power_Electronics/Chapter2_3.ipynb | 233 -- _Power_Electronics/Chapter2_4.ipynb | 233 -- _Power_Electronics/Chapter3.ipynb | 1001 ------- _Power_Electronics/Chapter3_1.ipynb | 1001 ------- _Power_Electronics/Chapter3_2.ipynb | 1001 ------- _Power_Electronics/Chapter3_3.ipynb | 1001 ------- _Power_Electronics/Chapter3_4.ipynb | 1001 ------- _Power_Electronics/Chapter4.ipynb | 946 ------- _Power_Electronics/Chapter4_1.ipynb | 946 ------- _Power_Electronics/Chapter4_2.ipynb | 946 ------- _Power_Electronics/Chapter4_3.ipynb | 946 ------- _Power_Electronics/Chapter4_4.ipynb | 946 ------- _Power_Electronics/Chapter5.ipynb | 511 ---- _Power_Electronics/Chapter5_1.ipynb | 511 ---- _Power_Electronics/Chapter5_2.ipynb | 511 ---- _Power_Electronics/Chapter5_3.ipynb | 511 ---- _Power_Electronics/Chapter5_4.ipynb | 511 ---- _Power_Electronics/Chapter6.ipynb | 1761 ------------- _Power_Electronics/Chapter6_1.ipynb | 1761 ------------- _Power_Electronics/Chapter6_2.ipynb | 1761 ------------- _Power_Electronics/Chapter6_3.ipynb | 1761 ------------- _Power_Electronics/Chapter6_4.ipynb | 1761 ------------- _Power_Electronics/Chapter7.ipynb | 1036 -------- _Power_Electronics/Chapter7_1.ipynb | 1036 -------- _Power_Electronics/Chapter7_2.ipynb | 1036 -------- _Power_Electronics/Chapter7_3.ipynb | 1036 -------- _Power_Electronics/Chapter7_4.ipynb | 1036 -------- _Power_Electronics/Chapter8.ipynb | 984 ------- _Power_Electronics/Chapter8_1.ipynb | 984 ------- _Power_Electronics/Chapter8_2.ipynb | 984 ------- _Power_Electronics/Chapter8_3.ipynb | 984 ------- _Power_Electronics/Chapter8_4.ipynb | 984 ------- _Power_Electronics/Chapter9.ipynb | 388 --- _Power_Electronics/Chapter9_1.ipynb | 388 --- _Power_Electronics/Chapter9_2.ipynb | 388 --- _Power_Electronics/Chapter9_3.ipynb | 388 --- _Power_Electronics/Chapter9_4.ipynb | 388 --- _Power_Electronics/screenshots/Chapter2.png | Bin 226408 -> 0 bytes _Power_Electronics/screenshots/Chapter2_1.png | Bin 226408 -> 0 bytes _Power_Electronics/screenshots/Chapter2_2.png | Bin 226408 -> 0 bytes _Power_Electronics/screenshots/Chapter2_3.png | Bin 226408 -> 0 bytes _Power_Electronics/screenshots/Chapter2_4.png | Bin 226408 -> 0 bytes _Power_Electronics/screenshots/Chapter3.png | Bin 230367 -> 0 bytes _Power_Electronics/screenshots/Chapter3_1.png | Bin 230367 -> 0 bytes _Power_Electronics/screenshots/Chapter3_2.png | Bin 230367 -> 0 bytes _Power_Electronics/screenshots/Chapter3_3.png | Bin 230367 -> 0 bytes _Power_Electronics/screenshots/Chapter3_4.png | Bin 230367 -> 0 bytes _Power_Electronics/screenshots/Chapter4.png | Bin 222170 -> 0 bytes _Power_Electronics/screenshots/Chapter4_1.png | Bin 222170 -> 0 bytes _Power_Electronics/screenshots/Chapter4_2.png | Bin 222170 -> 0 bytes _Power_Electronics/screenshots/Chapter4_3.png | Bin 222170 -> 0 bytes _Power_Electronics/screenshots/Chapter4_4.png | Bin 222170 -> 0 bytes .../Chapter_10_SILICON_CONTROLLED_RECTIFIER.ipynb | 119 - .../Chapter_1_CRYSTAL_STRUCTURES.ipynb | 677 ----- ...er_6_ELECTRICAL_BREAKDOWN_IN_PN_JUNCTIONS.ipynb | 991 ------- .../chapter_2_ENERGY_BAND_THEORY_OF_SOLIDS.ipynb | 998 ------- ...pter_3_CARRIER_TRANSPORT_IN_SEMICONDUCTOR.ipynb | 700 ----- ...hapter_4__EXCESS_CARRIER_IN_SEMICONDUCTOR.ipynb | 266 -- .../chapter_5_PN_JUNCTION_DIODE.ipynb | 1364 ---------- .../chapter_7_BIPOLAR_JUNCTION_TRANSISTORB.ipynb | 496 ---- .../chapter_8_THE_FIELD_EFFECT_TRANSISTOR.ipynb | 806 ------ .../Screen_Shot_2015-11-05_at_11.31.11_pm.png | Bin 137919 -> 0 bytes .../Screen_Shot_2015-11-05_at_11.32.51_pm.png | Bin 150019 -> 0 bytes .../Screen_Shot_2015-11-05_at_11.33.45_pm.png | Bin 136824 -> 0 bytes _Theory_Of_Machines/Chapter1.ipynb | 663 ----- _Theory_Of_Machines/Chapter10.ipynb | 507 ---- _Theory_Of_Machines/Chapter11.ipynb | 450 ---- _Theory_Of_Machines/Chapter12.ipynb | 380 --- _Theory_Of_Machines/Chapter2.ipynb | 824 ------ _Theory_Of_Machines/Chapter3.ipynb | 782 ------ _Theory_Of_Machines/Chapter4.ipynb | 946 ------- _Theory_Of_Machines/Chapter5.ipynb | 413 --- _Theory_Of_Machines/Chapter6.ipynb | 486 ---- _Theory_Of_Machines/Chapter7.ipynb | 638 ----- _Theory_Of_Machines/Chapter8.ipynb | 334 --- _Theory_Of_Machines/Chapter9.ipynb | 151 -- _Theory_Of_Machines/screenshots/Chapter1.png | Bin 202671 -> 0 bytes _Theory_Of_Machines/screenshots/Chapter2.png | Bin 204187 -> 0 bytes _Theory_Of_Machines/screenshots/Chapter3.png | Bin 211011 -> 0 bytes .../Chapter1.ipynb | 663 ----- .../Chapter10.ipynb | 507 ---- .../Chapter10_1.ipynb | 507 ---- .../Chapter11.ipynb | 450 ---- .../Chapter11_1.ipynb | 450 ---- .../Chapter12.ipynb | 380 --- .../Chapter12_1.ipynb | 380 --- .../Chapter1_1.ipynb | 663 ----- .../Chapter2.ipynb | 824 ------ .../Chapter2_1.ipynb | 824 ------ .../Chapter3.ipynb | 782 ------ .../Chapter3_1.ipynb | 782 ------ .../Chapter4.ipynb | 946 ------- .../Chapter4_1.ipynb | 946 ------- .../Chapter5.ipynb | 413 --- .../Chapter5_1.ipynb | 413 --- .../Chapter6.ipynb | 486 ---- .../Chapter6_1.ipynb | 486 ---- .../Chapter7.ipynb | 638 ----- .../Chapter7_1.ipynb | 638 ----- .../Chapter8.ipynb | 334 --- .../Chapter8_1.ipynb | 334 --- .../Chapter9.ipynb | 151 -- .../Chapter9_1.ipynb | 151 -- _Theory_Of_Machines_by__B._K._Sarkar/README.txt | 10 - .../screenshots/chapter1.png | Bin 217566 -> 0 bytes .../screenshots/chapter1_1.png | Bin 212445 -> 0 bytes .../screenshots/chapter2.png | Bin 233274 -> 0 bytes .../screenshots/chapter2_1.png | Bin 215298 -> 0 bytes .../screenshots/chapter3.png | Bin 240157 -> 0 bytes .../screenshots/chapter3_1.png | Bin 218817 -> 0 bytes abcd_by_cbvbv/Chapter1.ipynb | 504 ---- abcd_by_cbvbv/Chapter1_1.ipynb | 504 ---- abcd_by_cbvbv/screenshots/k1.png | Bin 16503 -> 0 bytes abcd_by_cbvbv/screenshots/k2.png | Bin 18858 -> 0 bytes abcd_by_cbvbv/screenshots/k2_1.png | Bin 18858 -> 0 bytes abcd_by_cbvbv/screenshots/k3.png | Bin 14827 -> 0 bytes abcd_by_cbvbv/screenshots/k3_1.png | Bin 14827 -> 0 bytes abcd_by_cbvbv/screenshots/k3_2.png | Bin 14827 -> 0 bytes t_by_t/README.txt | 10 - t_by_t/anubhav.ipynb | 335 --- t_by_t/screenshots/blank1.png | 0 t_by_t/screenshots/blank1_(another_copy).png | 0 t_by_t/screenshots/blank1_(copy).png | 0 980 files changed, 199389 insertions(+), 282220 deletions(-) create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter11.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter11_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter12.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter12_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter13.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter13_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter14.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter14_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter15.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter15_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter16.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter16_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter17.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter17_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter18.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter18_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter19.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter19_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter21.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter21_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter22.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter22_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter23.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter23_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter24.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter24_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter4.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter4_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter5.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter5_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter6.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter6_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter7.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter7_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter8.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/Chapter8_1.ipynb create mode 100755 A_Textbook_Of_Engineering_Physics/README.txt create mode 100755 A_Textbook_Of_Engineering_Physics/screenshots/Chapter11.png create mode 100755 A_Textbook_Of_Engineering_Physics/screenshots/Chapter11_1.png create mode 100755 A_Textbook_Of_Engineering_Physics/screenshots/Chapter12.png create mode 100755 A_Textbook_Of_Engineering_Physics/screenshots/Chapter12_1.png create mode 100755 A_Textbook_Of_Engineering_Physics/screenshots/Chapter13.png create mode 100755 A_Textbook_Of_Engineering_Physics/screenshots/Chapter13_1.png delete mode 100644 About_Mumbai_by_sd/hemla.ipynb delete mode 100644 About_Mumbai_by_sd/screenshots/warning.png delete mode 100644 About_Mumbai_by_sd/screenshots/warning_1.png delete mode 100644 About_Mumbai_by_sd/screenshots/warning_2.png create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorbption.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorption.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer_.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer__1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer_1.ipynb create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/README.txt create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH19.png create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH3.png create mode 100755 Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH5.png create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/README.txt create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10_1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11_1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12_1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1_1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2_1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3_1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch4.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch4_1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch5.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch5_1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch6.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch6_1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch7.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch7_1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch8.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch8_1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch9.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch9_1.ipynb create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/energy_stored3.png create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/energy_stored3_1.png create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/magnetic_flux12.png create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/magnetic_flux12_1.png create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/pitch_factor7.png create mode 100755 Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/pitch_factor7_1.png create mode 100644 Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/chap1.ipynb create mode 100644 Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/chap2.ipynb create mode 100644 Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/chap3.ipynb create mode 100644 Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/chap4.ipynb create mode 100644 Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/chap5.ipynb create mode 100644 Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/chap6.ipynb create mode 100644 Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/screenshots/2_Charge_current_density.png create mode 100644 Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/screenshots/2_temp_coeff.png create mode 100644 Electrical_And_Electronics_Engineering_Materials_by_J._B._Gupta/screenshots/Ch1DenCrystal.png create mode 100755 Engineering_Thermodynamics_by__O._Singh/README.txt create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter10.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter10_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter10_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter10_3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter11.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter11_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter11_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter11_3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter12.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter12_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter12_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter12_3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter13.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter13_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter13_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter13_3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter2_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter2_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter2_3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter3_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter3_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter3_3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter4.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter4_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter4_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter4_3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter5.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter5_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter5_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter5_3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter6.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter6_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter6_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter6_3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter7-Copy1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter7.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter7_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter7_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter8.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter8_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter8_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter8_3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter9.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter9_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter9_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter9_3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter_1_1.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter_1_2.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/chapter_1_3.ipynb create mode 100755 Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49).png create mode 100755 Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_1.png create mode 100755 Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_2.png create mode 100755 Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50).png create mode 100755 Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_1.png create mode 100755 Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_2.png create mode 100755 Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51).png create mode 100755 Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_1.png create mode 100755 Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_2.png create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure_.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing_.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_1.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_2.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_3.ipynb create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/README.txt create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10.png create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_1.png create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_2.png create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_3.png create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11.png create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_1.png create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_2.png create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_3.png create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4.png create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_1.png create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_2.png create mode 100755 Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_3.png create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter10.ipynb create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter11.ipynb create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter2.ipynb create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter3.ipynb create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter4.ipynb create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter5.ipynb create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter6.ipynb create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter7.ipynb create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter8.ipynb create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter9.ipynb create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter10.png create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter11.png create mode 100644 Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter2.png create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingFromCtoC++.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingfromCtoC++.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding_1.ipynb create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/README.txt create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/1.png create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/2.png create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/3.png create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150614-WA0001.png create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150614-WA0006.png create mode 100755 Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150619-WA0002.png create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/Chapter01-Fiber_Optics_Communications_System.ipynb create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/Chapter02-Optical_Fiber_for_Telecommunication.ipynb create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/Chapter03-Optical_Sources_and_Transmitters.ipynb create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/Chapter04-Optical_Detectors_and_Receivers.ipynb create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/Chapter05-Design_Considerations_in_Optical_Links.ipynb create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/Chapter1.ipynb create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/Chapter2.ipynb create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/Chapter3.ipynb create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/Chapter4.ipynb create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/Chapter5.ipynb create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/Chapter6-Advanced_Optical_Systems.ipynb create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/Chapter6.ipynb create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/README.txt create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter01-Ex1.7.1.png create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter02-Ex2.2.1.png create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter03-Ex3.2.1.png create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch3.png create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch3_1.png create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch5.png create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch5_1.png create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch7.png create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch7_1.png create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter2.png create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter5.png create mode 100755 Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter6.png delete mode 100644 Short_Course_by_e/hemla.ipynb delete mode 100644 Short_Course_by_e/hemla_1.ipynb delete mode 100644 Short_Course_by_e/screenshots/warning.png delete mode 100644 Short_Course_by_e/screenshots/warning_1.png delete mode 100644 Short_Course_by_e/screenshots/warning_2.png create mode 100755 Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_10_SILICON_CONTROLLED_RECTIFIER.ipynb create mode 100755 Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_1_CRYSTAL_STRUCTURES.ipynb create mode 100755 Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_6_ELECTRICAL_BREAKDOWN_IN_PN_JUNCTIONS.ipynb create mode 100755 Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_2_ENERGY_BAND_THEORY_OF_SOLIDS.ipynb create mode 100755 Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_3_CARRIER_TRANSPORT_IN_SEMICONDUCTOR.ipynb create mode 100755 Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_4__EXCESS_CARRIER_IN_SEMICONDUCTOR.ipynb create mode 100755 Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_5_PN_JUNCTION_DIODE.ipynb create mode 100755 Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_7_BIPOLAR_JUNCTION_TRANSISTORB.ipynb create mode 100755 Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_8_THE_FIELD_EFFECT_TRANSISTOR.ipynb create mode 100755 Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.31.11_pm.png create mode 100755 Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.32.51_pm.png create mode 100755 Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.33.45_pm.png delete mode 100755 Test/README.txt delete mode 100755 Test/chapter1.ipynb delete mode 100755 Test/chapter1_1.ipynb delete mode 100755 Test/chapter1_2.ipynb delete mode 100755 Test/chapter2.ipynb delete mode 100755 Test/chapter2_1.ipynb delete mode 100755 Test/chapter2_2.ipynb delete mode 100755 Test/screenshots/screen1.png delete mode 100755 Test/screenshots/screen1_1.png delete mode 100755 Test/screenshots/screen2.png delete mode 100755 Test/screenshots/screen2_1.png delete mode 100755 Test/screenshots/screen2_2.png delete mode 100755 Test/screenshots/screen2_3.png delete mode 100755 Test/screenshots/screen3.png delete mode 100755 Test/screenshots/screen3_1.png delete mode 100755 Test/screenshots/screen3_2.png delete mode 100755 TestContribution/Chapter2.ipynb delete mode 100755 TestContribution/README.txt delete mode 100755 TestContribution/abhisheksharma.ipynb delete mode 100755 TestContribution/abhisheksharma_1.ipynb delete mode 100755 TestContribution/abhisheksharma_2.ipynb delete mode 100755 TestContribution/bilal.ipynb delete mode 100755 TestContribution/bilal_1.ipynb delete mode 100755 TestContribution/bilal_2.ipynb delete mode 100755 TestContribution/bilal_3.ipynb delete mode 100755 TestContribution/ch3.ipynb delete mode 100755 TestContribution/ch3_1.ipynb delete mode 100755 TestContribution/ch3_2.ipynb delete mode 100755 TestContribution/chapterno1.ipynb delete mode 100755 TestContribution/exampleCount.py delete mode 100755 TestContribution/screenshots/State_Direction.png delete mode 100755 TestContribution/screenshots/State_Direction_1.png delete mode 100755 TestContribution/screenshots/State_Direction_10.png delete mode 100755 TestContribution/screenshots/State_Direction_11.png delete mode 100755 TestContribution/screenshots/State_Direction_12.png delete mode 100755 TestContribution/screenshots/State_Direction_13.png delete mode 100755 TestContribution/screenshots/State_Direction_14.png delete mode 100755 TestContribution/screenshots/State_Direction_15.png delete mode 100755 TestContribution/screenshots/State_Direction_16.png delete mode 100755 TestContribution/screenshots/State_Direction_17.png delete mode 100755 TestContribution/screenshots/State_Direction_18.png delete mode 100755 TestContribution/screenshots/State_Direction_19.png delete mode 100755 TestContribution/screenshots/State_Direction_2.png delete mode 100755 TestContribution/screenshots/State_Direction_20.png delete mode 100755 TestContribution/screenshots/State_Direction_3.png delete mode 100755 TestContribution/screenshots/State_Direction_4.png delete mode 100755 TestContribution/screenshots/State_Direction_5.png delete mode 100755 TestContribution/screenshots/State_Direction_6.png delete mode 100755 TestContribution/screenshots/State_Direction_7.png delete mode 100755 TestContribution/screenshots/State_Direction_8.png delete mode 100755 TestContribution/screenshots/State_Direction_9.png delete mode 100755 Testing_Textbook_Companion_Directory/chapter2.ipynb delete mode 100755 Testing_Textbook_Companion_Directory/chapter5.ipynb delete mode 100755 Testing_Textbook_Companion_Directory/screenshots/energy.png delete mode 100755 Testing_Textbook_Companion_Directory/screenshots/internal-energy.png delete mode 100755 Testing_Textbook_Companion_Directory/screenshots/temprature.png delete mode 100755 Testing_the_interface/README.txt delete mode 100755 Testing_the_interface/chapter1.ipynb delete mode 100755 Testing_the_interface/chapter11.ipynb delete mode 100755 Testing_the_interface/chapter11_1.ipynb delete mode 100755 Testing_the_interface/chapter11_2.ipynb delete mode 100755 Testing_the_interface/chapter11_3.ipynb delete mode 100755 Testing_the_interface/chapter1_1.ipynb delete mode 100755 Testing_the_interface/chapter1_2.ipynb delete mode 100755 Testing_the_interface/chapter1_3.ipynb delete mode 100755 Testing_the_interface/chapter2.ipynb delete mode 100755 Testing_the_interface/chapter2_1.ipynb delete mode 100755 Testing_the_interface/chapter2_2.ipynb delete mode 100755 Testing_the_interface/chapter2_3.ipynb delete mode 100755 Testing_the_interface/chapter3.ipynb delete mode 100755 Testing_the_interface/chapter3_1.ipynb delete mode 100755 Testing_the_interface/chapter3_2.ipynb delete mode 100755 Testing_the_interface/chapter3_3.ipynb delete mode 100755 Testing_the_interface/chapter4.ipynb delete mode 100755 Testing_the_interface/chapter4_1.ipynb delete mode 100755 Testing_the_interface/chapter4_2.ipynb delete mode 100755 Testing_the_interface/chapter4_3.ipynb delete mode 100755 Testing_the_interface/chapter5.ipynb delete mode 100755 Testing_the_interface/chapter5_1.ipynb delete mode 100755 Testing_the_interface/chapter5_2.ipynb delete mode 100755 Testing_the_interface/chapter5_3.ipynb delete mode 100755 Testing_the_interface/chapter6.ipynb delete mode 100755 Testing_the_interface/chapter6_1.ipynb delete mode 100755 Testing_the_interface/chapter6_2.ipynb delete mode 100755 Testing_the_interface/chapter6_3.ipynb delete mode 100755 Testing_the_interface/chapter7.ipynb delete mode 100755 Testing_the_interface/chapter7_1.ipynb delete mode 100755 Testing_the_interface/chapter8.ipynb delete mode 100755 Testing_the_interface/chapter8_1.ipynb delete mode 100755 Testing_the_interface/chapter8_2.ipynb delete mode 100755 Testing_the_interface/chapter8_3.ipynb delete mode 100755 Testing_the_interface/screenshots/screen1.png delete mode 100755 Testing_the_interface/screenshots/screen1_1.png delete mode 100755 Testing_the_interface/screenshots/screen1_2.png delete mode 100755 Testing_the_interface/screenshots/screen2.png delete mode 100755 Testing_the_interface/screenshots/screen2_1.png delete mode 100755 Testing_the_interface/screenshots/screen2_2.png delete mode 100755 Testing_the_interface/screenshots/screen3.png delete mode 100755 Testing_the_interface/screenshots/screen3_1.png delete mode 100755 Testing_the_interface/screenshots/screen3_2.png create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter10.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter10_1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter11.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter11_1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter12.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter12_1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter1_1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter2.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter2_1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter3.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter3_1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter4.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter4_1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter5.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter5_1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter6.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter6_1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter7.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter7_1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter8.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter8_1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter9.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/Chapter9_1.ipynb create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/README.txt create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1.png create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1_1.png create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2.png create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2_1.png create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3.png create mode 100755 Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3_1.png delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter11.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter11_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter12.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter12_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter13.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter13_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter14.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter14_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter15.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter15_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter16.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter16_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter17.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter17_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter18.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter18_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter19.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter19_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter21.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter21_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter22.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter22_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter23.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter23_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter24.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter24_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter4.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter4_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter5.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter5_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter6.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter6_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter7.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter7_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter8.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/Chapter8_1.ipynb delete mode 100755 _A_Textbook_Of_Engineering_Physics/README.txt delete mode 100755 _A_Textbook_Of_Engineering_Physics/screenshots/Chapter11.png delete mode 100755 _A_Textbook_Of_Engineering_Physics/screenshots/Chapter11_1.png delete mode 100755 _A_Textbook_Of_Engineering_Physics/screenshots/Chapter12.png delete mode 100755 _A_Textbook_Of_Engineering_Physics/screenshots/Chapter12_1.png delete mode 100755 _A_Textbook_Of_Engineering_Physics/screenshots/Chapter13.png delete mode 100755 _A_Textbook_Of_Engineering_Physics/screenshots/Chapter13_1.png delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH19.png delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH3.png delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH5.png delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorbption.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorption.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer_.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer__1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer_1.ipynb delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/README.txt delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH19.png delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH3.png delete mode 100755 _Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH5.png delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/README.txt delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10_1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11_1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12_1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1_1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2_1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3_1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch4.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch4_1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch5.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch5_1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch6.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch6_1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch7.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch7_1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch8.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch8_1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch9.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch9_1.ipynb delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/energy_stored3.png delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/energy_stored3_1.png delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/magnetic_flux12.png delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/magnetic_flux12_1.png delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/pitch_factor7.png delete mode 100755 _Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/screenshots/pitch_factor7_1.png delete mode 100755 _Engineering_Thermodynamics/screenshots/Screenshot_(49).png delete mode 100755 _Engineering_Thermodynamics/screenshots/Screenshot_(50).png delete mode 100755 _Engineering_Thermodynamics/screenshots/Screenshot_(51).png delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/README.txt delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter10.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter10_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter10_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter10_3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter11.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter11_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter11_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter11_3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter12.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter12_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter12_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter12_3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter13.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter13_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter13_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter13_3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter2_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter2_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter2_3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter3_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter3_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter3_3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter4.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter4_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter4_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter4_3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter5.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter5_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter5_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter5_3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter6.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter6_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter6_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter6_3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter7-Copy1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter7.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter7_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter7_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter8.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter8_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter8_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter8_3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter9.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter9_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter9_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter9_3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter_1_1.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter_1_2.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/chapter_1_3.ipynb delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49).png delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_1.png delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_2.png delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50).png delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_1.png delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_2.png delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51).png delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_1.png delete mode 100755 _Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_2.png delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure_.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing_.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_1.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_2.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_3.ipynb delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/README.txt delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10.png delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_1.png delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_2.png delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_3.png delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11.png delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_1.png delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_2.png delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_3.png delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4.png delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_1.png delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_2.png delete mode 100755 _Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_3.png delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter10.ipynb delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter11.ipynb delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter2.ipynb delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter3.ipynb delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter4.ipynb delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter5.ipynb delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter6.ipynb delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter7.ipynb delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter8.ipynb delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter9.ipynb delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter10.png delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter11.png delete mode 100644 _Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter2.png delete mode 100755 _Mastering_C++/README.txt delete mode 100755 _Mastering_C++/screenshots/1.png delete mode 100755 _Mastering_C++/screenshots/2.png delete mode 100755 _Mastering_C++/screenshots/3.png delete mode 100755 _Mastering_C++/screenshots/IMG-20150614-WA0001.png delete mode 100755 _Mastering_C++/screenshots/IMG-20150614-WA0006.png delete mode 100755 _Mastering_C++/screenshots/IMG-20150619-WA0002.png delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingFromCtoC++.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingfromCtoC++.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions_1.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding.ipynb delete mode 100755 _Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding_1.ipynb delete mode 100755 _Optical_Fiber_Communication/screenshots/Chapter01-Ex1.7.1.png delete mode 100755 _Optical_Fiber_Communication/screenshots/Chapter02-Ex2.2.1.png delete mode 100755 _Optical_Fiber_Communication/screenshots/Chapter03-Ex3.2.1.png delete mode 100755 _Optical_Fiber_Communication/screenshots/chapter2.png delete mode 100755 _Optical_Fiber_Communication/screenshots/chapter5.png delete mode 100755 _Optical_Fiber_Communication/screenshots/chapter6.png delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/Chapter01-Fiber_Optics_Communications_System.ipynb delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/Chapter02-Optical_Fiber_for_Telecommunication.ipynb delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/Chapter03-Optical_Sources_and_Transmitters.ipynb delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/Chapter04-Optical_Detectors_and_Receivers.ipynb delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/Chapter05-Design_Considerations_in_Optical_Links.ipynb delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/Chapter1.ipynb delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/Chapter2.ipynb delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/Chapter3.ipynb delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/Chapter4.ipynb delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/Chapter5.ipynb delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/Chapter6-Advanced_Optical_Systems.ipynb delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/Chapter6.ipynb delete mode 100755 _Optical_Fiber_Communication_by_V._S._Bagad/README.txt delete mode 100755 _Power_Electronics/Chapter10.ipynb delete mode 100755 _Power_Electronics/Chapter10_1.ipynb delete mode 100755 _Power_Electronics/Chapter10_2.ipynb delete mode 100755 _Power_Electronics/Chapter10_3.ipynb delete mode 100755 _Power_Electronics/Chapter10_4.ipynb delete mode 100755 _Power_Electronics/Chapter11.ipynb delete mode 100755 _Power_Electronics/Chapter11_1.ipynb delete mode 100755 _Power_Electronics/Chapter11_2.ipynb delete mode 100755 _Power_Electronics/Chapter11_3.ipynb delete mode 100755 _Power_Electronics/Chapter11_4.ipynb delete mode 100755 _Power_Electronics/Chapter12.ipynb delete mode 100755 _Power_Electronics/Chapter12_1.ipynb delete mode 100755 _Power_Electronics/Chapter12_2.ipynb delete mode 100755 _Power_Electronics/Chapter12_3.ipynb delete mode 100755 _Power_Electronics/Chapter12_4.ipynb delete mode 100755 _Power_Electronics/Chapter13.ipynb delete mode 100755 _Power_Electronics/Chapter13_1.ipynb delete mode 100755 _Power_Electronics/Chapter13_2.ipynb delete mode 100755 _Power_Electronics/Chapter13_3.ipynb delete mode 100755 _Power_Electronics/Chapter13_4.ipynb delete mode 100755 _Power_Electronics/Chapter14.ipynb delete mode 100755 _Power_Electronics/Chapter14_1.ipynb delete mode 100755 _Power_Electronics/Chapter14_2.ipynb delete mode 100755 _Power_Electronics/Chapter14_3.ipynb delete mode 100755 _Power_Electronics/Chapter14_4.ipynb delete mode 100755 _Power_Electronics/Chapter2.ipynb delete mode 100755 _Power_Electronics/Chapter2_1.ipynb delete mode 100755 _Power_Electronics/Chapter2_2.ipynb delete mode 100755 _Power_Electronics/Chapter2_3.ipynb delete mode 100755 _Power_Electronics/Chapter2_4.ipynb delete mode 100755 _Power_Electronics/Chapter3.ipynb delete mode 100755 _Power_Electronics/Chapter3_1.ipynb delete mode 100755 _Power_Electronics/Chapter3_2.ipynb delete mode 100755 _Power_Electronics/Chapter3_3.ipynb delete mode 100755 _Power_Electronics/Chapter3_4.ipynb delete mode 100755 _Power_Electronics/Chapter4.ipynb delete mode 100755 _Power_Electronics/Chapter4_1.ipynb delete mode 100755 _Power_Electronics/Chapter4_2.ipynb delete mode 100755 _Power_Electronics/Chapter4_3.ipynb delete mode 100755 _Power_Electronics/Chapter4_4.ipynb delete mode 100755 _Power_Electronics/Chapter5.ipynb delete mode 100755 _Power_Electronics/Chapter5_1.ipynb delete mode 100755 _Power_Electronics/Chapter5_2.ipynb delete mode 100755 _Power_Electronics/Chapter5_3.ipynb delete mode 100755 _Power_Electronics/Chapter5_4.ipynb delete mode 100755 _Power_Electronics/Chapter6.ipynb delete mode 100755 _Power_Electronics/Chapter6_1.ipynb delete mode 100755 _Power_Electronics/Chapter6_2.ipynb delete mode 100755 _Power_Electronics/Chapter6_3.ipynb delete mode 100755 _Power_Electronics/Chapter6_4.ipynb delete mode 100755 _Power_Electronics/Chapter7.ipynb delete mode 100755 _Power_Electronics/Chapter7_1.ipynb delete mode 100755 _Power_Electronics/Chapter7_2.ipynb delete mode 100755 _Power_Electronics/Chapter7_3.ipynb delete mode 100755 _Power_Electronics/Chapter7_4.ipynb delete mode 100755 _Power_Electronics/Chapter8.ipynb delete mode 100755 _Power_Electronics/Chapter8_1.ipynb delete mode 100755 _Power_Electronics/Chapter8_2.ipynb delete mode 100755 _Power_Electronics/Chapter8_3.ipynb delete mode 100755 _Power_Electronics/Chapter8_4.ipynb delete mode 100755 _Power_Electronics/Chapter9.ipynb delete mode 100755 _Power_Electronics/Chapter9_1.ipynb delete mode 100755 _Power_Electronics/Chapter9_2.ipynb delete mode 100755 _Power_Electronics/Chapter9_3.ipynb delete mode 100755 _Power_Electronics/Chapter9_4.ipynb delete mode 100755 _Power_Electronics/screenshots/Chapter2.png delete mode 100755 _Power_Electronics/screenshots/Chapter2_1.png delete mode 100755 _Power_Electronics/screenshots/Chapter2_2.png delete mode 100755 _Power_Electronics/screenshots/Chapter2_3.png delete mode 100755 _Power_Electronics/screenshots/Chapter2_4.png delete mode 100755 _Power_Electronics/screenshots/Chapter3.png delete mode 100755 _Power_Electronics/screenshots/Chapter3_1.png delete mode 100755 _Power_Electronics/screenshots/Chapter3_2.png delete mode 100755 _Power_Electronics/screenshots/Chapter3_3.png delete mode 100755 _Power_Electronics/screenshots/Chapter3_4.png delete mode 100755 _Power_Electronics/screenshots/Chapter4.png delete mode 100755 _Power_Electronics/screenshots/Chapter4_1.png delete mode 100755 _Power_Electronics/screenshots/Chapter4_2.png delete mode 100755 _Power_Electronics/screenshots/Chapter4_3.png delete mode 100755 _Power_Electronics/screenshots/Chapter4_4.png delete mode 100755 _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_10_SILICON_CONTROLLED_RECTIFIER.ipynb delete mode 100755 _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_1_CRYSTAL_STRUCTURES.ipynb delete mode 100755 _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_6_ELECTRICAL_BREAKDOWN_IN_PN_JUNCTIONS.ipynb delete mode 100755 _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_2_ENERGY_BAND_THEORY_OF_SOLIDS.ipynb delete mode 100755 _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_3_CARRIER_TRANSPORT_IN_SEMICONDUCTOR.ipynb delete mode 100755 _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_4__EXCESS_CARRIER_IN_SEMICONDUCTOR.ipynb delete mode 100755 _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_5_PN_JUNCTION_DIODE.ipynb delete mode 100755 _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_7_BIPOLAR_JUNCTION_TRANSISTORB.ipynb delete mode 100755 _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_8_THE_FIELD_EFFECT_TRANSISTOR.ipynb delete mode 100755 _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.31.11_pm.png delete mode 100755 _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.32.51_pm.png delete mode 100755 _Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.33.45_pm.png delete mode 100755 _Theory_Of_Machines/Chapter1.ipynb delete mode 100755 _Theory_Of_Machines/Chapter10.ipynb delete mode 100755 _Theory_Of_Machines/Chapter11.ipynb delete mode 100755 _Theory_Of_Machines/Chapter12.ipynb delete mode 100755 _Theory_Of_Machines/Chapter2.ipynb delete mode 100755 _Theory_Of_Machines/Chapter3.ipynb delete mode 100755 _Theory_Of_Machines/Chapter4.ipynb delete mode 100755 _Theory_Of_Machines/Chapter5.ipynb delete mode 100755 _Theory_Of_Machines/Chapter6.ipynb delete mode 100755 _Theory_Of_Machines/Chapter7.ipynb delete mode 100755 _Theory_Of_Machines/Chapter8.ipynb delete mode 100755 _Theory_Of_Machines/Chapter9.ipynb delete mode 100755 _Theory_Of_Machines/screenshots/Chapter1.png delete mode 100755 _Theory_Of_Machines/screenshots/Chapter2.png delete mode 100755 _Theory_Of_Machines/screenshots/Chapter3.png delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter10.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter10_1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter11.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter11_1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter12.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter12_1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter1_1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter2.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter2_1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter3.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter3_1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter4.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter4_1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter5.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter5_1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter6.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter6_1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter7.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter7_1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter8.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter8_1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter9.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/Chapter9_1.ipynb delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/README.txt delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1.png delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1_1.png delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2.png delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2_1.png delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3.png delete mode 100755 _Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3_1.png delete mode 100755 abcd_by_cbvbv/Chapter1.ipynb delete mode 100755 abcd_by_cbvbv/Chapter1_1.ipynb delete mode 100755 abcd_by_cbvbv/screenshots/k1.png delete mode 100755 abcd_by_cbvbv/screenshots/k2.png delete mode 100755 abcd_by_cbvbv/screenshots/k2_1.png delete mode 100755 abcd_by_cbvbv/screenshots/k3.png delete mode 100755 abcd_by_cbvbv/screenshots/k3_1.png delete mode 100755 abcd_by_cbvbv/screenshots/k3_2.png delete mode 100755 t_by_t/README.txt delete mode 100755 t_by_t/anubhav.ipynb delete mode 100755 t_by_t/screenshots/blank1.png delete mode 100755 t_by_t/screenshots/blank1_(another_copy).png delete mode 100755 t_by_t/screenshots/blank1_(copy).png diff --git a/A_Textbook_Of_Engineering_Physics/Chapter11.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter11.ipynb new file mode 100755 index 00000000..2ca36fdf --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter11.ipynb @@ -0,0 +1,150 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cb0c026235eca0bc18a695dcb9668ea4e2691af702577b5109cf13ded8d1630d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter11-Architectural Acoustics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg293" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 11.1\n", + "##calculation of total absorption and average absorption coefficient\n", + "\n", + "##given values\n", + "\n", + "V=20*15*5.;##volume of hall in m**3\n", + "t=3.5;##reverberation time of empty hall in sec\n", + "\n", + "\n", + "##calculation\n", + "a1=.161*V/t;##total absorption of empty hall\n", + "k=a1/(2.*(20*15+15*5+20*5.));\n", + "print'%s %.2f %s'%('the average absorption coefficient is',k,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the average absorption coefficient is 0.07 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg293" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 11.2\n", + "##calculation of average absorption coefficient\n", + "\n", + "##given values\n", + "\n", + "V=10*8.*6.;##volume of hall in m**3\n", + "t=1.5;##reverberation time of empty hall in sec\n", + "A=20.;##area of curtain cloth in m**2\n", + "t1=1.;##new reverberation time in sec\n", + "\n", + "##calculation\n", + "a1=.161*V/t;##total absorption of empty hall\n", + "a2=.161*V/t1;##total absorption after a curtain cloth is suspended\n", + "\n", + "k=(a2-a1)/(2.*20.);\n", + "print'%s %.2f %s'%('the average absorption coefficient is',k,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the average absorption coefficient is 0.64 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg293" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 11.3\n", + "##calculation of average absorption coefficient and area\n", + "\n", + "##given values\n", + "\n", + "V=20*15*10.;##volume of hall in m**3\n", + "t=3.5;##reverberation time of empty hall in sec\n", + "t1=2.5;##reduced reverberation time \n", + "k2=.5;##absorption coefficient of curtain cloth\n", + "##calculation\n", + "a1=.161*V/t;##total absorption of empty hall\n", + "k1=a1/(2*(20*15+15*10+20*10));\n", + "print'%s %.2f %s'%('the average absorption coefficient is',k1,'');\n", + "a2=.161*V/t1;##total absorption when wall is covered with curtain\n", + "a=t1*(a2-a1)/(t1*k2);\n", + "print'%s %.2f %s'%('area of wall to be covered with curtain(in m^2)is:',a,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the average absorption coefficient is 0.11 \n", + "area of wall to be covered with curtain(in m^2)is: 110.40 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter11_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter11_1.ipynb new file mode 100755 index 00000000..2ca36fdf --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter11_1.ipynb @@ -0,0 +1,150 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cb0c026235eca0bc18a695dcb9668ea4e2691af702577b5109cf13ded8d1630d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter11-Architectural Acoustics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg293" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 11.1\n", + "##calculation of total absorption and average absorption coefficient\n", + "\n", + "##given values\n", + "\n", + "V=20*15*5.;##volume of hall in m**3\n", + "t=3.5;##reverberation time of empty hall in sec\n", + "\n", + "\n", + "##calculation\n", + "a1=.161*V/t;##total absorption of empty hall\n", + "k=a1/(2.*(20*15+15*5+20*5.));\n", + "print'%s %.2f %s'%('the average absorption coefficient is',k,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the average absorption coefficient is 0.07 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg293" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 11.2\n", + "##calculation of average absorption coefficient\n", + "\n", + "##given values\n", + "\n", + "V=10*8.*6.;##volume of hall in m**3\n", + "t=1.5;##reverberation time of empty hall in sec\n", + "A=20.;##area of curtain cloth in m**2\n", + "t1=1.;##new reverberation time in sec\n", + "\n", + "##calculation\n", + "a1=.161*V/t;##total absorption of empty hall\n", + "a2=.161*V/t1;##total absorption after a curtain cloth is suspended\n", + "\n", + "k=(a2-a1)/(2.*20.);\n", + "print'%s %.2f %s'%('the average absorption coefficient is',k,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the average absorption coefficient is 0.64 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg293" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 11.3\n", + "##calculation of average absorption coefficient and area\n", + "\n", + "##given values\n", + "\n", + "V=20*15*10.;##volume of hall in m**3\n", + "t=3.5;##reverberation time of empty hall in sec\n", + "t1=2.5;##reduced reverberation time \n", + "k2=.5;##absorption coefficient of curtain cloth\n", + "##calculation\n", + "a1=.161*V/t;##total absorption of empty hall\n", + "k1=a1/(2*(20*15+15*10+20*10));\n", + "print'%s %.2f %s'%('the average absorption coefficient is',k1,'');\n", + "a2=.161*V/t1;##total absorption when wall is covered with curtain\n", + "a=t1*(a2-a1)/(t1*k2);\n", + "print'%s %.2f %s'%('area of wall to be covered with curtain(in m^2)is:',a,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the average absorption coefficient is 0.11 \n", + "area of wall to be covered with curtain(in m^2)is: 110.40 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter12.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter12.ipynb new file mode 100755 index 00000000..7ced75e1 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter12.ipynb @@ -0,0 +1,144 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4671074782cd36f56500529820b222f929e1453d2be6b38ad8ab85fd8d868d5a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter12-Ultrasonics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg295" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 12.1\n", + "##calculation of natural frequency,magnetostriction\n", + "\n", + "##given values\n", + "\n", + "l=40*10**-3.;##length of pure iron rod\n", + "d=7.25*10**3.;##density of iron in kg/m**3\n", + "Y=115*10**9.;##Young's modulus in N/m**2 \n", + "\n", + "##calculation\n", + "f=(1*math.sqrt(Y/d))/(2.*l);\n", + "print'%s %.2f %s'%('the natural frequency(in kHz) is',f*10**-3,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the natural frequency(in kHz) is 49.78 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg297" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 12.2\n", + "##calculation of natural frequency\n", + "\n", + "##given values\n", + "\n", + "t=5.5*10**-3.;##thickness in m\n", + "d=2.65*10**3.;##density in kg/m**3\n", + "Y=8*10**10.;##Young's modulus in N/m**2 \n", + "\n", + "\n", + "##calculation\n", + "f=(math.sqrt(Y/d))/(2.*t);##frequency in hertz\n", + "print'%s %.2f %s'%('the natural frequency(in kHz) is',f*10**-3,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the natural frequency(in kHz) is 499.49 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg301" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 12.3\n", + "##calculation of depth and wavelength\n", + "\n", + "##given values\n", + "\n", + "f=.07*10**6;##frequency in Hz\n", + "t=.65;##time taken for pulse to return\n", + "v=1700.;##velocity of sound in sea water in m/s\n", + "\n", + "##calculation\n", + "d=v*t/2.;##\n", + "print'%s %.2f %s'%('the depth of sea(in m) is',d,'');\n", + "l=v/f;##wavelenght of pulse in m\n", + "print'%s %.2f %s'%('wavelength of pulse (in cm)is',l*10**2,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the depth of sea(in m) is 552.50 \n", + "wavelength of pulse (in cm)is 2.43 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter12_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter12_1.ipynb new file mode 100755 index 00000000..7ced75e1 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter12_1.ipynb @@ -0,0 +1,144 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4671074782cd36f56500529820b222f929e1453d2be6b38ad8ab85fd8d868d5a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter12-Ultrasonics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg295" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 12.1\n", + "##calculation of natural frequency,magnetostriction\n", + "\n", + "##given values\n", + "\n", + "l=40*10**-3.;##length of pure iron rod\n", + "d=7.25*10**3.;##density of iron in kg/m**3\n", + "Y=115*10**9.;##Young's modulus in N/m**2 \n", + "\n", + "##calculation\n", + "f=(1*math.sqrt(Y/d))/(2.*l);\n", + "print'%s %.2f %s'%('the natural frequency(in kHz) is',f*10**-3,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the natural frequency(in kHz) is 49.78 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg297" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 12.2\n", + "##calculation of natural frequency\n", + "\n", + "##given values\n", + "\n", + "t=5.5*10**-3.;##thickness in m\n", + "d=2.65*10**3.;##density in kg/m**3\n", + "Y=8*10**10.;##Young's modulus in N/m**2 \n", + "\n", + "\n", + "##calculation\n", + "f=(math.sqrt(Y/d))/(2.*t);##frequency in hertz\n", + "print'%s %.2f %s'%('the natural frequency(in kHz) is',f*10**-3,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the natural frequency(in kHz) is 499.49 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg301" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 12.3\n", + "##calculation of depth and wavelength\n", + "\n", + "##given values\n", + "\n", + "f=.07*10**6;##frequency in Hz\n", + "t=.65;##time taken for pulse to return\n", + "v=1700.;##velocity of sound in sea water in m/s\n", + "\n", + "##calculation\n", + "d=v*t/2.;##\n", + "print'%s %.2f %s'%('the depth of sea(in m) is',d,'');\n", + "l=v/f;##wavelenght of pulse in m\n", + "print'%s %.2f %s'%('wavelength of pulse (in cm)is',l*10**2,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the depth of sea(in m) is 552.50 \n", + "wavelength of pulse (in cm)is 2.43 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter13.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter13.ipynb new file mode 100755 index 00000000..2e8d2e4e --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter13.ipynb @@ -0,0 +1,410 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1347b69ffb48f57ed84c93fa692b1b83ef62827af6c7ff1223306a59bfbf283e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter13-Atomic Physics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg310" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.1\n", + "##calculation of rate of flow of photons\n", + "\n", + "##given values\n", + "\n", + "l=5893*10**-10;##wavelength of light in m \n", + "P=40.;##power of sodium lamp in W\n", + "d=10;##distance from the source in m\n", + "s=4*math.pi*d**2;##surface area of radius in m**2\n", + "c=3*10**8.;##velocity of light in m/s\n", + "h=6.626*10**-34;##Planck's constant in Js\n", + "##calculation\n", + "E=P*1.;##\n", + "print'%s %.2f %s'%('total energy emitted per second(in Joule)is',E,'');\n", + "n=E*l/(c*h);##total no of photons\n", + "R=n/s;\n", + "print'%s %.2e %s'%('rate of flow of photons per unit area (in /m^2) is',R,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "total energy emitted per second(in Joule)is 40.00 \n", + "rate of flow of photons per unit area (in /m^2) is 9.44e+16 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg315" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.2\n", + "##calculation of threshold wavelength and stopping potential\n", + "\n", + "##given values\n", + "\n", + "l=2000.;##wavelength of light in armstrong \n", + "e=1.6*10**-19.;##charge of electron\n", + "W=4.2;##work function in eV\n", + "c=3*10**8.;##velocity of light in m/s\n", + "h=6.626*10**-34.;##Planck's constant in Js\n", + "##calculation\n", + "x=12400/(W);##h*c=12400 eV\n", + "print'%s %.2f %s'%('threshold wavelength(in Armstrong)is',x,'');\n", + "Vs=(12400/l-W);##\n", + "print'%s %.2f %s'%('stopping potential (in VOLTS) is',Vs,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "threshold wavelength(in Armstrong)is 2952.38 \n", + "stopping potential (in VOLTS) is 2.00 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg326" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.3\n", + "##calculation of momentum of X-ray photon undergoing scattering\n", + "\n", + "##given values\n", + "\n", + "alpha=60*math.pi/180.;##scattering angle in radian\n", + "e=1.6*10**-19;##charge ofelectrone\n", + "W=12273.;##work function in eV\n", + "c=3*10**8;##velocity of light in m/s\n", + "h=6.626*10**-34.;##Planck's constant in Js\n", + "hc=12400.;##in eV\n", + "m=9.1*10**-31##restmass of photon in kg\n", + "##calculation\n", + "x=hc/(W);##wavelength of photon undergoing modofied scattering in armstrong\n", + "y=x-(h/(m*c))*(1-math.cos(alpha));\n", + "p=h/y*10**10.;\n", + "print'%s %.3e %s'%('momentum of photon(in kg-m/s) is',p,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "momentum of photon(in kg-m/s) is 6.558e-24 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg327" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.4\n", + "##calculation of wavelength of scattered radiation and velocity of recoiled electron\n", + "\n", + "##given values\n", + "\n", + "alpha=30*math.pi/180.;##scattering angle in radian\n", + "e=1.6*10**-19.;##charge ofelectron\n", + "x=1.372*10**-10.;##wavelength of incident radiation in m\n", + "c=3*10**8;##velocity of light in m/s\n", + "h=6.626*10**-34;##Planck's constant in Js\n", + "m=9.1*10**-31##rest mass of photon in kg\n", + "hc=12400.;##in eV\n", + "##calculation\n", + "\n", + "y=((x+(h/(m*c))*(1-math.cos(alpha))))*10**10;\n", + "print'%s %.2f %s'%('wavelength of scattered radiation(in armstrong)is',y,'');\n", + "x1=x*10**10;##converting incident wavelength into armstrong\n", + "KE=hc*e*((1/x1)-(1/y));##kinetic energy in Joule\n", + "print'%s %.3e %s'%('kinetic energy in joule is ',KE,'');\n", + "v=math.sqrt(2.*KE/m);\n", + "print'%s %.2f %s'%('velocity of recoiled electron (in m/s^2)is',v,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "wavelength of scattered radiation(in armstrong)is 1.38 \n", + "kinetic energy in joule is 3.419e-18 \n", + "velocity of recoiled electron (in m/s^2)is 2741274.99 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg333" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.5\n", + "##calculation of wavelength of light emitted\n", + "\n", + "##given values\n", + "e=1.6*10**-19;##charge of electrone\n", + "c=3*10**8;##velocity of light\n", + "h=6.626*10**-34;##Planck's constant in Js\n", + "E1=5.36;##energy of first state in eV\n", + "E2=3.45;##energy of second state in eV\n", + "\n", + "\n", + "##1)calculation\n", + "\n", + "l=h*c*10**10/((E1-E2)*e);\n", + "print'%s %.2f %s'%('wavelength of scattered light(in Armstrong)is',l,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "wavelength of scattered light(in Armstrong)is 6504.58 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg361" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.6\n", + "##calculation of de Broglie wavelength \n", + "\n", + "##1)given values\n", + "e=1.6*10**-19.;\n", + "h=6.626*10**-34.;##Planck's constant in Js\n", + "V=182.;##potential difference in volts\n", + "m=9.1*10**-31;##mass of e in kg\n", + "\n", + "\n", + "##1)calculation\n", + "\n", + "l=h/math.sqrt(2.*e*m*V);\n", + "print'%s %.3e %s'%('de Brogliewavelength (in m)is',l,'');\n", + "\n", + "\n", + "##2)given values\n", + "m1=1.;##mass of object in kg\n", + "v=1.;##velocity of object in m/s\n", + "l1=h/(m1*v);\n", + "print'%s %.3e %s'%('debrogie wavelength of object in m) is',l1,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "de Brogliewavelength (in m)is 9.102e-11 \n", + "debrogie wavelength of object in m) is 6.626e-34 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg368" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.7\n", + "##calculation of uncertainty in position\n", + "\n", + "##1)given values\n", + "\n", + "h=6.626*10**-34;##Planck's constant in Js\n", + "v1=220;##velocity of e in m/s\n", + "m=9.1*10**-31;##mass of e in kg\n", + "A=0.065/100.;##accuracy\n", + "\n", + "\n", + "##1)calculation\n", + "v2=v1*A;##uncertainty in speed\n", + "x1=h/(2*math.pi*m*v2);##\n", + "print'%s %.4f %s'%('uncertainty in position of e (in m)is',x1,'');\n", + "\n", + "\n", + "##2)given values\n", + "m1=150/1000.;##mass of object in kg\n", + "x2=h/(2*math.pi*m1*v2);\n", + "print'%s %.3e %s'%('uncertainty in position of baseball(in m) is',x2,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "uncertainty in position of e (in m)is 0.0008 \n", + "uncertainty in position of baseball(in m) is 4.916e-33 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg377" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.8\n", + "##calculation of energy states of an electron and grain of dust and comparing\n", + "\n", + "##1)given values\n", + "L1=10*10**-10;##width of potential well in which e is confined\n", + "L2=.1*10**-3;##width of potential well in which grain of dust is confined\n", + "h=6.626*10**-34;##Planck's constant in Js\n", + "v1=10**6;##velocity of garin of dust in m/s\n", + "m1=9.1*10**-31;##mass of e in kg\n", + "m2=10**-9;##mass of grain in kg\n", + "\n", + "##1)calculation\n", + "\n", + "Ee1=1**2*h**2./(8.*m1*L1**2.);##first energy state of electron\n", + "print'%s %.3e %s'%('first energy state of e is ',Ee1,'');\n", + "Ee2=2**2*h**2/(8*m1*L1**2);##second energy state of electron\n", + "print'%s %.3e %s'%('second energy state of e is ',Ee2,'');\n", + "Ee3=3**2*h**2/(8*m1*L1**2);##third energy state of electron\n", + "print'%s %.3e %s'%('third energy state of e is ',Ee3,'');\n", + "print('Energy levels of an electron in an infinite potential well are quantised and the energy difference between the successive levels is quite large.Electron cannot jump from one level to other on strength of thermal energy.Hence quantization of energy plays a significant role in case of electron')\n", + "\n", + "Eg1=1**2*h**2/(8.*m2*L2**2.);##first energy state of grain of dust\n", + "print'%s %.3e %s'%('first energy state of grain of dust is ',Eg1,'');\n", + "Eg2=2**2*h**2/(8.*m2*L2**2.);##second energy state of grain of dust\n", + "print'%s %.3e %s'%('second energy state of grain of dust is ',Eg2,'');\n", + "Eg3=3**2*h**2/(8.*m2*L2**2.);##third energy state of grain of dust\n", + "print'%s %.3e %s'%('third energy state of grain of dust is ',Eg3,'');\n", + "KE=m2*v1**2/2.;##kinetic energy of grain of dust;\n", + "print'%s %.2f %s'%('kinetic energy of grain of dust is',KE,'');\n", + "print('The energy levels of a grain of dust are so near to each other that they constitute a continuum.These energy levels are far smaller than the kinetic energy possessed by the grain of dust.It can move through all these energy levels without an external supply of energy.Thus quantization of energy levels is not at all significant in case of macroscopic bodies.')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "first energy state of e is 6.031e-20 \n", + "second energy state of e is 2.412e-19 \n", + "third energy state of e is 5.428e-19 \n", + "Energy levels of an electron in an infinite potential well are quantised and the energy difference between the successive levels is quite large.Electron cannot jump from one level to other on strength of thermal energy.Hence quantization of energy plays a significant role in case of electron\n", + "first energy state of grain of dust is 5.488e-51 \n", + "second energy state of grain of dust is 2.195e-50 \n", + "third energy state of grain of dust is 4.939e-50 \n", + "kinetic energy of grain of dust is 500.00 \n", + "The energy levels of a grain of dust are so near to each other that they constitute a continuum.These energy levels are far smaller than the kinetic energy possessed by the grain of dust.It can move through all these energy levels without an external supply of energy.Thus quantization of energy levels is not at all significant in case of macroscopic bodies.\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter13_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter13_1.ipynb new file mode 100755 index 00000000..2e8d2e4e --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter13_1.ipynb @@ -0,0 +1,410 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1347b69ffb48f57ed84c93fa692b1b83ef62827af6c7ff1223306a59bfbf283e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter13-Atomic Physics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg310" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.1\n", + "##calculation of rate of flow of photons\n", + "\n", + "##given values\n", + "\n", + "l=5893*10**-10;##wavelength of light in m \n", + "P=40.;##power of sodium lamp in W\n", + "d=10;##distance from the source in m\n", + "s=4*math.pi*d**2;##surface area of radius in m**2\n", + "c=3*10**8.;##velocity of light in m/s\n", + "h=6.626*10**-34;##Planck's constant in Js\n", + "##calculation\n", + "E=P*1.;##\n", + "print'%s %.2f %s'%('total energy emitted per second(in Joule)is',E,'');\n", + "n=E*l/(c*h);##total no of photons\n", + "R=n/s;\n", + "print'%s %.2e %s'%('rate of flow of photons per unit area (in /m^2) is',R,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "total energy emitted per second(in Joule)is 40.00 \n", + "rate of flow of photons per unit area (in /m^2) is 9.44e+16 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg315" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.2\n", + "##calculation of threshold wavelength and stopping potential\n", + "\n", + "##given values\n", + "\n", + "l=2000.;##wavelength of light in armstrong \n", + "e=1.6*10**-19.;##charge of electron\n", + "W=4.2;##work function in eV\n", + "c=3*10**8.;##velocity of light in m/s\n", + "h=6.626*10**-34.;##Planck's constant in Js\n", + "##calculation\n", + "x=12400/(W);##h*c=12400 eV\n", + "print'%s %.2f %s'%('threshold wavelength(in Armstrong)is',x,'');\n", + "Vs=(12400/l-W);##\n", + "print'%s %.2f %s'%('stopping potential (in VOLTS) is',Vs,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "threshold wavelength(in Armstrong)is 2952.38 \n", + "stopping potential (in VOLTS) is 2.00 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg326" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.3\n", + "##calculation of momentum of X-ray photon undergoing scattering\n", + "\n", + "##given values\n", + "\n", + "alpha=60*math.pi/180.;##scattering angle in radian\n", + "e=1.6*10**-19;##charge ofelectrone\n", + "W=12273.;##work function in eV\n", + "c=3*10**8;##velocity of light in m/s\n", + "h=6.626*10**-34.;##Planck's constant in Js\n", + "hc=12400.;##in eV\n", + "m=9.1*10**-31##restmass of photon in kg\n", + "##calculation\n", + "x=hc/(W);##wavelength of photon undergoing modofied scattering in armstrong\n", + "y=x-(h/(m*c))*(1-math.cos(alpha));\n", + "p=h/y*10**10.;\n", + "print'%s %.3e %s'%('momentum of photon(in kg-m/s) is',p,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "momentum of photon(in kg-m/s) is 6.558e-24 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg327" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.4\n", + "##calculation of wavelength of scattered radiation and velocity of recoiled electron\n", + "\n", + "##given values\n", + "\n", + "alpha=30*math.pi/180.;##scattering angle in radian\n", + "e=1.6*10**-19.;##charge ofelectron\n", + "x=1.372*10**-10.;##wavelength of incident radiation in m\n", + "c=3*10**8;##velocity of light in m/s\n", + "h=6.626*10**-34;##Planck's constant in Js\n", + "m=9.1*10**-31##rest mass of photon in kg\n", + "hc=12400.;##in eV\n", + "##calculation\n", + "\n", + "y=((x+(h/(m*c))*(1-math.cos(alpha))))*10**10;\n", + "print'%s %.2f %s'%('wavelength of scattered radiation(in armstrong)is',y,'');\n", + "x1=x*10**10;##converting incident wavelength into armstrong\n", + "KE=hc*e*((1/x1)-(1/y));##kinetic energy in Joule\n", + "print'%s %.3e %s'%('kinetic energy in joule is ',KE,'');\n", + "v=math.sqrt(2.*KE/m);\n", + "print'%s %.2f %s'%('velocity of recoiled electron (in m/s^2)is',v,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "wavelength of scattered radiation(in armstrong)is 1.38 \n", + "kinetic energy in joule is 3.419e-18 \n", + "velocity of recoiled electron (in m/s^2)is 2741274.99 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg333" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.5\n", + "##calculation of wavelength of light emitted\n", + "\n", + "##given values\n", + "e=1.6*10**-19;##charge of electrone\n", + "c=3*10**8;##velocity of light\n", + "h=6.626*10**-34;##Planck's constant in Js\n", + "E1=5.36;##energy of first state in eV\n", + "E2=3.45;##energy of second state in eV\n", + "\n", + "\n", + "##1)calculation\n", + "\n", + "l=h*c*10**10/((E1-E2)*e);\n", + "print'%s %.2f %s'%('wavelength of scattered light(in Armstrong)is',l,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "wavelength of scattered light(in Armstrong)is 6504.58 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg361" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.6\n", + "##calculation of de Broglie wavelength \n", + "\n", + "##1)given values\n", + "e=1.6*10**-19.;\n", + "h=6.626*10**-34.;##Planck's constant in Js\n", + "V=182.;##potential difference in volts\n", + "m=9.1*10**-31;##mass of e in kg\n", + "\n", + "\n", + "##1)calculation\n", + "\n", + "l=h/math.sqrt(2.*e*m*V);\n", + "print'%s %.3e %s'%('de Brogliewavelength (in m)is',l,'');\n", + "\n", + "\n", + "##2)given values\n", + "m1=1.;##mass of object in kg\n", + "v=1.;##velocity of object in m/s\n", + "l1=h/(m1*v);\n", + "print'%s %.3e %s'%('debrogie wavelength of object in m) is',l1,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "de Brogliewavelength (in m)is 9.102e-11 \n", + "debrogie wavelength of object in m) is 6.626e-34 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg368" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.7\n", + "##calculation of uncertainty in position\n", + "\n", + "##1)given values\n", + "\n", + "h=6.626*10**-34;##Planck's constant in Js\n", + "v1=220;##velocity of e in m/s\n", + "m=9.1*10**-31;##mass of e in kg\n", + "A=0.065/100.;##accuracy\n", + "\n", + "\n", + "##1)calculation\n", + "v2=v1*A;##uncertainty in speed\n", + "x1=h/(2*math.pi*m*v2);##\n", + "print'%s %.4f %s'%('uncertainty in position of e (in m)is',x1,'');\n", + "\n", + "\n", + "##2)given values\n", + "m1=150/1000.;##mass of object in kg\n", + "x2=h/(2*math.pi*m1*v2);\n", + "print'%s %.3e %s'%('uncertainty in position of baseball(in m) is',x2,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "uncertainty in position of e (in m)is 0.0008 \n", + "uncertainty in position of baseball(in m) is 4.916e-33 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg377" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 13.8\n", + "##calculation of energy states of an electron and grain of dust and comparing\n", + "\n", + "##1)given values\n", + "L1=10*10**-10;##width of potential well in which e is confined\n", + "L2=.1*10**-3;##width of potential well in which grain of dust is confined\n", + "h=6.626*10**-34;##Planck's constant in Js\n", + "v1=10**6;##velocity of garin of dust in m/s\n", + "m1=9.1*10**-31;##mass of e in kg\n", + "m2=10**-9;##mass of grain in kg\n", + "\n", + "##1)calculation\n", + "\n", + "Ee1=1**2*h**2./(8.*m1*L1**2.);##first energy state of electron\n", + "print'%s %.3e %s'%('first energy state of e is ',Ee1,'');\n", + "Ee2=2**2*h**2/(8*m1*L1**2);##second energy state of electron\n", + "print'%s %.3e %s'%('second energy state of e is ',Ee2,'');\n", + "Ee3=3**2*h**2/(8*m1*L1**2);##third energy state of electron\n", + "print'%s %.3e %s'%('third energy state of e is ',Ee3,'');\n", + "print('Energy levels of an electron in an infinite potential well are quantised and the energy difference between the successive levels is quite large.Electron cannot jump from one level to other on strength of thermal energy.Hence quantization of energy plays a significant role in case of electron')\n", + "\n", + "Eg1=1**2*h**2/(8.*m2*L2**2.);##first energy state of grain of dust\n", + "print'%s %.3e %s'%('first energy state of grain of dust is ',Eg1,'');\n", + "Eg2=2**2*h**2/(8.*m2*L2**2.);##second energy state of grain of dust\n", + "print'%s %.3e %s'%('second energy state of grain of dust is ',Eg2,'');\n", + "Eg3=3**2*h**2/(8.*m2*L2**2.);##third energy state of grain of dust\n", + "print'%s %.3e %s'%('third energy state of grain of dust is ',Eg3,'');\n", + "KE=m2*v1**2/2.;##kinetic energy of grain of dust;\n", + "print'%s %.2f %s'%('kinetic energy of grain of dust is',KE,'');\n", + "print('The energy levels of a grain of dust are so near to each other that they constitute a continuum.These energy levels are far smaller than the kinetic energy possessed by the grain of dust.It can move through all these energy levels without an external supply of energy.Thus quantization of energy levels is not at all significant in case of macroscopic bodies.')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "first energy state of e is 6.031e-20 \n", + "second energy state of e is 2.412e-19 \n", + "third energy state of e is 5.428e-19 \n", + "Energy levels of an electron in an infinite potential well are quantised and the energy difference between the successive levels is quite large.Electron cannot jump from one level to other on strength of thermal energy.Hence quantization of energy plays a significant role in case of electron\n", + "first energy state of grain of dust is 5.488e-51 \n", + "second energy state of grain of dust is 2.195e-50 \n", + "third energy state of grain of dust is 4.939e-50 \n", + "kinetic energy of grain of dust is 500.00 \n", + "The energy levels of a grain of dust are so near to each other that they constitute a continuum.These energy levels are far smaller than the kinetic energy possessed by the grain of dust.It can move through all these energy levels without an external supply of energy.Thus quantization of energy levels is not at all significant in case of macroscopic bodies.\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter14.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter14.ipynb new file mode 100755 index 00000000..1a941a59 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter14.ipynb @@ -0,0 +1,224 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:fa946e3f77a5fb13eb7ad900f4bb8618950afc67e42b0d85db2b38e779043158" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter14-Lasers\n" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 14.1\n", + "##calculation of intensity of laser beam\n", + "\n", + "##given values\n", + "P=10*10**-3.;##Power in Watt\n", + "d=1.3*10**-3.;##diametre in m\n", + "A=math.pi*d**2./4.;##area in m**2\n", + "\n", + "\n", + "##calculation\n", + "I=P/A;\n", + "print'%s %.2f %s'%('intensity (in W/m^2) is',I,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "intensity (in W/m^2) is 7533.96 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 14.2\n", + "##calculation of intensity of laser beam\n", + "\n", + "##given values\n", + "P=1*10**-3.;##Power in Watt\n", + "l=6328*10**-10.;##wavelength in m\n", + "A=l**2.;##area in m**2\n", + "\n", + "\n", + "##calculation\n", + "I=P/A;\n", + "print'%s %.3e %s'%('intensity (in W/m^2) is',I,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "intensity (in W/m^2) is 2.497e+09 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 14.3\n", + "##calculation of coherence length,bandwidth and line width\n", + "\n", + "##given values\n", + "c=3*10**8.;##velocity of light in m/s\n", + "t=.1*10**-9.;##timedivision in s\n", + "l=6238*10**-10.;##wavelength in m\n", + "\n", + "##calculation\n", + "x=c*t;\n", + "print'%s %.2f %s'%('coherence length (in m) is',x,'');\n", + "d=1./t;\n", + "print'%s %.3e %s'%('bandwidth (in Hz) is',d,'');\n", + "y=l**2*d/c;##line width in m\n", + "print'%s %.2f %s'%('line width(in armstrong )is',y*10**10,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "coherence length (in m) is 0.03 \n", + "bandwidth (in Hz) is 1.000e+10 \n", + "line width(in armstrong )is 0.13 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 14.4\n", + "##calculation of frequency difference\n", + "\n", + "##given values\n", + "c=3*10**8;##velocity of light in m/s\n", + "l=.5;##distance in m\n", + "\n", + "##calculation\n", + "f=c/(2*l);##in hertz\n", + "print'%s %.2f %s'%('frequency difference (in MHz) is',f/10**6,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "frequency difference (in MHz) is 300.00 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 14.5\n", + "##calculation of no of cavity modes\n", + "\n", + "##given values\n", + "c=3*10**8.;##velocity of light in m/s\n", + "n=1.75;##refractive index\n", + "l=2*10**-2;##length of ruby rod in m\n", + "x=6943*10**-10.;##wavelength in m\n", + "y=5.3*10**-10.;##spread of wavelength in m\n", + "\n", + "##calculation\n", + "d=c/n/l;\n", + "f=c*y/x**2.;\n", + "m=f/d;\n", + "print'%s %.2f %s'%('no of modes is',m,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "no of modes is 38.48 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter14_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter14_1.ipynb new file mode 100755 index 00000000..1a941a59 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter14_1.ipynb @@ -0,0 +1,224 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:fa946e3f77a5fb13eb7ad900f4bb8618950afc67e42b0d85db2b38e779043158" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter14-Lasers\n" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 14.1\n", + "##calculation of intensity of laser beam\n", + "\n", + "##given values\n", + "P=10*10**-3.;##Power in Watt\n", + "d=1.3*10**-3.;##diametre in m\n", + "A=math.pi*d**2./4.;##area in m**2\n", + "\n", + "\n", + "##calculation\n", + "I=P/A;\n", + "print'%s %.2f %s'%('intensity (in W/m^2) is',I,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "intensity (in W/m^2) is 7533.96 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 14.2\n", + "##calculation of intensity of laser beam\n", + "\n", + "##given values\n", + "P=1*10**-3.;##Power in Watt\n", + "l=6328*10**-10.;##wavelength in m\n", + "A=l**2.;##area in m**2\n", + "\n", + "\n", + "##calculation\n", + "I=P/A;\n", + "print'%s %.3e %s'%('intensity (in W/m^2) is',I,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "intensity (in W/m^2) is 2.497e+09 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 14.3\n", + "##calculation of coherence length,bandwidth and line width\n", + "\n", + "##given values\n", + "c=3*10**8.;##velocity of light in m/s\n", + "t=.1*10**-9.;##timedivision in s\n", + "l=6238*10**-10.;##wavelength in m\n", + "\n", + "##calculation\n", + "x=c*t;\n", + "print'%s %.2f %s'%('coherence length (in m) is',x,'');\n", + "d=1./t;\n", + "print'%s %.3e %s'%('bandwidth (in Hz) is',d,'');\n", + "y=l**2*d/c;##line width in m\n", + "print'%s %.2f %s'%('line width(in armstrong )is',y*10**10,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "coherence length (in m) is 0.03 \n", + "bandwidth (in Hz) is 1.000e+10 \n", + "line width(in armstrong )is 0.13 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 14.4\n", + "##calculation of frequency difference\n", + "\n", + "##given values\n", + "c=3*10**8;##velocity of light in m/s\n", + "l=.5;##distance in m\n", + "\n", + "##calculation\n", + "f=c/(2*l);##in hertz\n", + "print'%s %.2f %s'%('frequency difference (in MHz) is',f/10**6,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "frequency difference (in MHz) is 300.00 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 14.5\n", + "##calculation of no of cavity modes\n", + "\n", + "##given values\n", + "c=3*10**8.;##velocity of light in m/s\n", + "n=1.75;##refractive index\n", + "l=2*10**-2;##length of ruby rod in m\n", + "x=6943*10**-10.;##wavelength in m\n", + "y=5.3*10**-10.;##spread of wavelength in m\n", + "\n", + "##calculation\n", + "d=c/n/l;\n", + "f=c*y/x**2.;\n", + "m=f/d;\n", + "print'%s %.2f %s'%('no of modes is',m,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "no of modes is 38.48 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter15.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter15.ipynb new file mode 100755 index 00000000..fd70c5b8 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter15.ipynb @@ -0,0 +1,661 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:00168ce8e6485ed62b7ab93f835949895122e8d417f4d6143363c166514fa2f2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Chapter15-Atomic Nucleus And Nuclear Energy" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg-pg427" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.1\n", + "##calculation of binding energy per nucleon\n", + "\n", + "##given values\n", + "Mp=1.00814;##mass of proton in amu\n", + "Mn=1.008665;##mass of nucleon in amu\n", + "M=7.01822;##mass of Lithium nucleus in amu\n", + "amu=931.;##amu in MeV\n", + "n=7-3;##no of neutrons in lithium nucleus\n", + "\n", + "##calculation\n", + "ET=(3*Mp+4*Mn-M)*amu;##total binding energy in MeV\n", + "E=ET/7.;##7 1s the mass number\n", + "print'%s %.2f %s'%('Binding energy per nucleon in MeV is',E,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binding energy per nucleon in MeV is 5.43 \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg427" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.2\n", + "##calculation of energy \n", + "\n", + "##given values\n", + "M1=15.00001;##atomic mass of N15 in amu\n", + "M2=15.0030;##atomic mass of O15 in amu\n", + "M3=15.9949;##atomic mass of O16 in amu\n", + "amu=931.4;##amu in MeV\n", + "mp=1.0072766;##restmass of proton\n", + "mn=1.0086654;##restmass of neutron\n", + "\n", + "##calculation\n", + "Q1=(M3-mp-M1)*amu;\n", + "print'%s %.2f %s'%('energy required to remove one proton from O16 is',Q1,'');\n", + "Q2=(M3-mn-M2)*amu;\n", + "print'%s %.2f %s'%('energy required to remove one neutron from O16 is',Q2,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "energy required to remove one proton from O16 is -11.54 \n", + "energy required to remove one neutron from O16 is -15.62 \n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg428" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.3\n", + "##calculation of binding energy \n", + "\n", + "##given values\n", + "Mp=1.00758;##mass of proton in amu\n", + "Mn=1.00897;##mass of nucleon in amu\n", + "M=4.0028;##mass of Helium nucleus in amu\n", + "amu=931.4;##amu in MeV\n", + "\n", + "##calculation\n", + "E1=(2*Mp+2*Mn-M)*amu;##total binding energy\n", + "print'%s %.2f %s'%('Binding energy in MeV is',E1,'');\n", + "E2=E1*10**6*1.6*10**-19;\n", + "print'%s %.3e %s'%('binding energy in Joule is',E2,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binding energy in MeV is 28.22 \n", + "binding energy in Joule is 4.515e-12 \n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg435" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.4\n", + "##calculation of amount of unchanged material\n", + "\n", + "##given values\n", + "T=2;##half life in years\n", + "k=.6931/T;##decay constant\n", + "M=4.0028;##mass of Helium nucleus in amu\n", + "amu=931.4;##amu in MeV\n", + "No=1.;##initial amount in g\n", + "\n", + "##calculation\n", + "N=No*(math.e**(-k*2*T));\n", + "print'%s %.2f %s'%('amount of material remaining unchanged after four years(in gram) is',N,'');\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "amount of material remaining unchanged after four years(in gram) is 0.25 \n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg435" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.5\n", + "##calculation of amount of halflife\n", + "\n", + "##given values\n", + "t=5.;##time period in years\n", + "amu=931.4;##amu in MeV\n", + "No=5.;##initial amount in g\n", + "N=5.-(10.5*10**-3);##amount present after 5 years\n", + "\n", + "\n", + "##calculation\n", + "k=math.log(N/No)/t;##decay constant\n", + "T=-.693/k;\n", + "print'%s %.2f %s'%('halflife in years is',T,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "halflife in years is 1648.27 \n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg435" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.6\n", + "##calculation of activity\n", + "\n", + "##given values\n", + "t=28.;##half life in years\n", + "m=10**-3;##mass of sample\n", + "M=90.;##atomic mass of strontium\n", + "NA=6.02*10**26;##avogadro's number\n", + "\n", + "\n", + "##calculation\n", + "n=m*NA/M;##no of nuclei in 1 mg sample\n", + "k=.693/(t*365*24.*60.*60.);##decay constant\n", + "A=k*n;\n", + "print'%s %.3e %s'%('activity of sample(in disintegrations per second) is',A,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "activity of sample(in disintegrations per second) is 5.250e+12 \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg439" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.7\n", + "##calculation of age of mineral\n", + "\n", + "##given values\n", + "t=4.5*10**9.;##half life in years\n", + "M1=238.;##atomic mass of Uranium in g\n", + "m=.093;##mass of lead in 1 g of uranium in g\n", + "NA=6.02*10**26;##avogadro's number\n", + "M2=206.;##atomic mass of lead in g\n", + "\n", + "##calculation\n", + "n=NA/M1;##no of nuclei in 1 g of uranium sample\n", + "n1=m*NA/M2;##no of nuclei in m mass of lead\n", + "c=n1/n;\n", + "k=.693/t;##decay constant\n", + "T=(1/k)*math.log(1+c);\n", + "print'%s %.3e %s'%('age of mineral in years is',T,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "age of mineral in years is 6.627e+08 \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg440" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.8\n", + "##calculation of age of wooden piece\n", + "\n", + "##given values\n", + "t=5730.;##half life of C14 in years\n", + "M1=50.;##mass of wooden piece in g\n", + "A1=320.;##activity of wooden piece (disintegration per minute per g)\n", + "A2=12.;##activity of living tree\n", + "\n", + "##calculation\n", + "k=.693/t;##decay constant\n", + "A=A1/M1;##activity after death\n", + "\n", + "T=(1/k)*math.log(A2/A);\n", + "print'%s %.2f %s'%('age of mineral in years is',T,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "age of mineral in years is 5197.59 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg443" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.9\n", + "##calculation of energy released\n", + "\n", + "##given values\n", + "M1=10.016125;##atomic mass of Boron in amu\n", + "M2=13.007440;##atomic mass of C13 in amu\n", + "M3=4.003874;##atomic mass of Helium in amu\n", + "mp=1.008146;##mass of proton in amu\n", + "amu=931.;##amu in MeV\n", + "\n", + "##calculation\n", + "Q=(M1+M3-(M2+mp))*amu;##total binding energy in M\n", + "print'%s %.2f %s'%('Binding energy per nucleon in MeV is',Q,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binding energy per nucleon in MeV is 4.11 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg444" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.10\n", + "##calculation of crosssection\n", + "\n", + "##given values\n", + "t=.01*10**-3;##thickness in m\n", + "n=10**13.;##no of protons bombarding target per s\n", + "NA=6.02*10**26.;##avogadro's number\n", + "M=7.;##atomic mass of lithium in kg\n", + "d=500.;##density of lithium in kg/m**3\n", + "n0=10**8.;##no of neutrons produced per s\n", + "##calculation\n", + "n1=d*NA/M;##no of target nuclei per unit volume\n", + "n2=n1*t;##no of target nuclei per area\n", + "A=n0/(n*n2);\n", + "print'%s %.3e %s'%('crosssection(in m^2) for this reaction is',A,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "crosssection(in m^2) for this reaction is 2.326e-29 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg450" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.11\n", + "##calculation of final energy \n", + "\n", + "##given values\n", + "B=.4;##max magnetic field in Wb/m**2\n", + "c=3*10**8.;\n", + "e=1.6*10**-19.;\n", + "d=1.52;##diametre in m\n", + "r=d/2.;\n", + "\n", + "##calculation\n", + "E=B*e*r*c;##E=pc,p=mv=Ber\n", + "print'%s %.3e %s'%('final energy of e(in J) is',E,'');\n", + "E1=(E/e)/10**6;\n", + "print'%s %.2f %s'%('final energy of e (in MeV) is',E1,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "final energy of e(in J) is 1.459e-11 \n", + "final energy of e (in MeV) is 91.20 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg459" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.12\n", + "##calculation of amount of fuel\n", + "\n", + "##given values\n", + "P=100*10**6.;##power required by city\n", + "M=235.;##atomic mass of Uranium in g\n", + "e=20/100.;##conversion efficiency\n", + "NA=6.02*10**26.;##avogadros number\n", + "E=200*10**6*1.6*10**-19;##energy released per fission\n", + "t=8.64*10**4.;##day in seconds\n", + "\n", + "\n", + "##calculation\n", + "E1=P*t;##energy requirement\n", + "m=E1*M/(NA*e*E);##no of nuclei N=NA*m/M,energy released by m kg is N*E,energy requirement=e*N*E\n", + "print'%s %.2f %s'%('amount of fuel(in kg) required is',m,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "amount of fuel(in kg) required is 0.53 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg459" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.13\n", + "##calculation of power output\n", + "\n", + "##given values\n", + "M=235.;##atomic mass of Uranium in kg\n", + "e=5/100.;##reactor efficiency\n", + "m=25/1000.;##amount of uranium consumed per day in kg\n", + "E=200*10**6*1.6*10**-19;##energy released per fission\n", + "t=8.64*10**4.;##day in seconds\n", + "NA=6.02*10**26.;##avogadros number\n", + "\n", + "##calculation\n", + "n=NA*m/M;##no of nuclei in 25g\n", + "E1=n*E;##energy produced by n nuclei\n", + "E2=E1*e;##energy converted to power\n", + "P=E2/t;##power output in Watt\n", + "print'%s %.2f %s'%('power output in MW is',P/10**6,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power output in MW is 1.19 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex14-pg460" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.14\n", + "##calculation of power developed\n", + "\n", + "##given values\n", + "M=235.;##atomic mass of Uranium in kg\n", + "m=20.4;##amount of uranium consumed per day in kg\n", + "E=200*10**6*1.6*10**-19;##energy released per fission\n", + "t=3600*1000.;##time of operation\n", + "NA=6.02*10**26;##avogadros number\n", + "\n", + "##calculation\n", + "n=NA*m/M;##no of nuclei in 20.4kg\n", + "E1=n*E;##energy produced by n nuclei\n", + "P=E1/t;##in Watt\n", + "print'%s %.2f %s'%('power developed in MW is',P/10**6,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power developed in MW is 464.52 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex15-pg464" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.15\n", + "##calculation of amount of dueterium consumed\n", + "\n", + "##given values\n", + "M1=2.01478;##atomic mass of Hydrogen in amu\n", + "M2=4.00388;##atomic mass of Helium in amu\n", + "amu=931.;##amu in MeV\n", + "e=30/100.;##efficiency\n", + "P=50*10**6.;##output power\n", + "NA=6.026*10**26.;##avogadro number\n", + "t=8.64*10**4.;##seconds in a day\n", + "\n", + "##calculation\n", + "Q=(2*M1-M2)*amu;##energy released in a D-D reaction in MeV\n", + "O=Q*e*10**6/2.;##actual output per dueterium atom in eV\n", + "n=P/(O*1.6*10**-19);##no of D atoms required\n", + "m=n*M1/NA;##equivalent mass of D required per s\n", + "X=m*t;\n", + "\n", + "print'%s %.2f %s'%('Deuterium requirement per day in kg is',X,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Deuterium requirement per day in kg is 0.03 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter15_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter15_1.ipynb new file mode 100755 index 00000000..42c1e8e6 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter15_1.ipynb @@ -0,0 +1,661 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b3c63b0fb789da64aa0a78019434c8cd892ee24c8c45cf80d5de4f41e17fa45f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter15-Atomic Nucleus And Nuclear Energy" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg-pg427" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.1\n", + "##calculation of binding energy per nucleon\n", + "\n", + "##given values\n", + "Mp=1.00814;##mass of proton in amu\n", + "Mn=1.008665;##mass of nucleon in amu\n", + "M=7.01822;##mass of Lithium nucleus in amu\n", + "amu=931.;##amu in MeV\n", + "n=7-3;##no of neutrons in lithium nucleus\n", + "\n", + "##calculation\n", + "ET=(3*Mp+4*Mn-M)*amu;##total binding energy in MeV\n", + "E=ET/7.;##7 1s the mass number\n", + "print'%s %.2f %s'%('Binding energy per nucleon in MeV is',E,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binding energy per nucleon in MeV is 5.43 \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg427" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.2\n", + "##calculation of energy \n", + "\n", + "##given values\n", + "M1=15.00001;##atomic mass of N15 in amu\n", + "M2=15.0030;##atomic mass of O15 in amu\n", + "M3=15.9949;##atomic mass of O16 in amu\n", + "amu=931.4;##amu in MeV\n", + "mp=1.0072766;##restmass of proton\n", + "mn=1.0086654;##restmass of neutron\n", + "\n", + "##calculation\n", + "Q1=(M3-mp-M1)*amu;\n", + "print'%s %.2f %s'%('energy required to remove one proton from O16 is',Q1,'');\n", + "Q2=(M3-mn-M2)*amu;\n", + "print'%s %.2f %s'%('energy required to remove one neutron from O16 is',Q2,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "energy required to remove one proton from O16 is -11.54 \n", + "energy required to remove one neutron from O16 is -15.62 \n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg428" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.3\n", + "##calculation of binding energy \n", + "\n", + "##given values\n", + "Mp=1.00758;##mass of proton in amu\n", + "Mn=1.00897;##mass of nucleon in amu\n", + "M=4.0028;##mass of Helium nucleus in amu\n", + "amu=931.4;##amu in MeV\n", + "\n", + "##calculation\n", + "E1=(2*Mp+2*Mn-M)*amu;##total binding energy\n", + "print'%s %.2f %s'%('Binding energy in MeV is',E1,'');\n", + "E2=E1*10**6*1.6*10**-19;\n", + "print'%s %.3e %s'%('binding energy in Joule is',E2,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binding energy in MeV is 28.22 \n", + "binding energy in Joule is 4.515e-12 \n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg435" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.4\n", + "##calculation of amount of unchanged material\n", + "\n", + "##given values\n", + "T=2;##half life in years\n", + "k=.6931/T;##decay constant\n", + "M=4.0028;##mass of Helium nucleus in amu\n", + "amu=931.4;##amu in MeV\n", + "No=1.;##initial amount in g\n", + "\n", + "##calculation\n", + "N=No*(math.e**(-k*2*T));\n", + "print'%s %.2f %s'%('amount of material remaining unchanged after four years(in gram) is',N,'');\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "amount of material remaining unchanged after four years(in gram) is 0.25 \n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg435" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.5\n", + "##calculation of amount of halflife\n", + "\n", + "##given values\n", + "t=5.;##time period in years\n", + "amu=931.4;##amu in MeV\n", + "No=5.;##initial amount in g\n", + "N=5.-(10.5*10**-3);##amount present after 5 years\n", + "\n", + "\n", + "##calculation\n", + "k=math.log(N/No)/t;##decay constant\n", + "T=-.693/k;\n", + "print'%s %.2f %s'%('halflife in years is',T,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "halflife in years is 1648.27 \n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg435" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.6\n", + "##calculation of activity\n", + "\n", + "##given values\n", + "t=28.;##half life in years\n", + "m=10**-3;##mass of sample\n", + "M=90.;##atomic mass of strontium\n", + "NA=6.02*10**26;##avogadro's number\n", + "\n", + "\n", + "##calculation\n", + "n=m*NA/M;##no of nuclei in 1 mg sample\n", + "k=.693/(t*365*24.*60.*60.);##decay constant\n", + "A=k*n;\n", + "print'%s %.3e %s'%('activity of sample(in disintegrations per second) is',A,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "activity of sample(in disintegrations per second) is 5.250e+12 \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg439" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.7\n", + "##calculation of age of mineral\n", + "\n", + "##given values\n", + "t=4.5*10**9.;##half life in years\n", + "M1=238.;##atomic mass of Uranium in g\n", + "m=.093;##mass of lead in 1 g of uranium in g\n", + "NA=6.02*10**26;##avogadro's number\n", + "M2=206.;##atomic mass of lead in g\n", + "\n", + "##calculation\n", + "n=NA/M1;##no of nuclei in 1 g of uranium sample\n", + "n1=m*NA/M2;##no of nuclei in m mass of lead\n", + "c=n1/n;\n", + "k=.693/t;##decay constant\n", + "T=(1/k)*math.log(1+c);\n", + "print'%s %.3e %s'%('age of mineral in years is',T,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "age of mineral in years is 6.627e+08 \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg440" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.8\n", + "##calculation of age of wooden piece\n", + "\n", + "##given values\n", + "t=5730.;##half life of C14 in years\n", + "M1=50.;##mass of wooden piece in g\n", + "A1=320.;##activity of wooden piece (disintegration per minute per g)\n", + "A2=12.;##activity of living tree\n", + "\n", + "##calculation\n", + "k=.693/t;##decay constant\n", + "A=A1/M1;##activity after death\n", + "\n", + "T=(1/k)*math.log(A2/A);\n", + "print'%s %.2f %s'%('age of mineral in years is',T,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "age of mineral in years is 5197.59 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg443" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.9\n", + "##calculation of energy released\n", + "\n", + "##given values\n", + "M1=10.016125;##atomic mass of Boron in amu\n", + "M2=13.007440;##atomic mass of C13 in amu\n", + "M3=4.003874;##atomic mass of Helium in amu\n", + "mp=1.008146;##mass of proton in amu\n", + "amu=931.;##amu in MeV\n", + "\n", + "##calculation\n", + "Q=(M1+M3-(M2+mp))*amu;##total binding energy in M\n", + "print'%s %.2f %s'%('Binding energy per nucleon in MeV is',Q,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binding energy per nucleon in MeV is 4.11 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg444" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.10\n", + "##calculation of crosssection\n", + "\n", + "##given values\n", + "t=.01*10**-3;##thickness in m\n", + "n=10**13.;##no of protons bombarding target per s\n", + "NA=6.02*10**26.;##avogadro's number\n", + "M=7.;##atomic mass of lithium in kg\n", + "d=500.;##density of lithium in kg/m**3\n", + "n0=10**8.;##no of neutrons produced per s\n", + "##calculation\n", + "n1=d*NA/M;##no of target nuclei per unit volume\n", + "n2=n1*t;##no of target nuclei per area\n", + "A=n0/(n*n2);\n", + "print'%s %.3e %s'%('crosssection(in m^2) for this reaction is',A,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "crosssection(in m^2) for this reaction is 2.326e-29 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg450" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.11\n", + "##calculation of final energy \n", + "\n", + "##given values\n", + "B=.4;##max magnetic field in Wb/m**2\n", + "c=3*10**8.;\n", + "e=1.6*10**-19.;\n", + "d=1.52;##diametre in m\n", + "r=d/2.;\n", + "\n", + "##calculation\n", + "E=B*e*r*c;##E=pc,p=mv=Ber\n", + "print'%s %.3e %s'%('final energy of e(in J) is',E,'');\n", + "E1=(E/e)/10**6;\n", + "print'%s %.2f %s'%('final energy of e (in MeV) is',E1,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "final energy of e(in J) is 1.459e-11 \n", + "final energy of e (in MeV) is 91.20 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg459" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.12\n", + "##calculation of amount of fuel\n", + "\n", + "##given values\n", + "P=100*10**6.;##power required by city\n", + "M=235.;##atomic mass of Uranium in g\n", + "e=20/100.;##conversion efficiency\n", + "NA=6.02*10**26.;##avogadros number\n", + "E=200*10**6*1.6*10**-19;##energy released per fission\n", + "t=8.64*10**4.;##day in seconds\n", + "\n", + "\n", + "##calculation\n", + "E1=P*t;##energy requirement\n", + "m=E1*M/(NA*e*E);##no of nuclei N=NA*m/M,energy released by m kg is N*E,energy requirement=e*N*E\n", + "print'%s %.2f %s'%('amount of fuel(in kg) required is',m,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "amount of fuel(in kg) required is 0.53 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg459" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.13\n", + "##calculation of power output\n", + "\n", + "##given values\n", + "M=235.;##atomic mass of Uranium in kg\n", + "e=5/100.;##reactor efficiency\n", + "m=25/1000.;##amount of uranium consumed per day in kg\n", + "E=200*10**6*1.6*10**-19;##energy released per fission\n", + "t=8.64*10**4.;##day in seconds\n", + "NA=6.02*10**26.;##avogadros number\n", + "\n", + "##calculation\n", + "n=NA*m/M;##no of nuclei in 25g\n", + "E1=n*E;##energy produced by n nuclei\n", + "E2=E1*e;##energy converted to power\n", + "P=E2/t;##power output in Watt\n", + "print'%s %.2f %s'%('power output in MW is',P/10**6,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power output in MW is 1.19 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex14-pg460" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.14\n", + "##calculation of power developed\n", + "\n", + "##given values\n", + "M=235.;##atomic mass of Uranium in kg\n", + "m=20.4;##amount of uranium consumed per day in kg\n", + "E=200*10**6*1.6*10**-19;##energy released per fission\n", + "t=3600*1000.;##time of operation\n", + "NA=6.02*10**26;##avogadros number\n", + "\n", + "##calculation\n", + "n=NA*m/M;##no of nuclei in 20.4kg\n", + "E1=n*E;##energy produced by n nuclei\n", + "P=E1/t;##in Watt\n", + "print'%s %.2f %s'%('power developed in MW is',P/10**6,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power developed in MW is 464.52 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex15-pg464" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 15.15\n", + "##calculation of amount of dueterium consumed\n", + "\n", + "##given values\n", + "M1=2.01478;##atomic mass of Hydrogen in amu\n", + "M2=4.00388;##atomic mass of Helium in amu\n", + "amu=931.;##amu in MeV\n", + "e=30/100.;##efficiency\n", + "P=50*10**6.;##output power\n", + "NA=6.026*10**26.;##avogadro number\n", + "t=8.64*10**4.;##seconds in a day\n", + "\n", + "##calculation\n", + "Q=(2*M1-M2)*amu;##energy released in a D-D reaction in MeV\n", + "O=Q*e*10**6/2.;##actual output per dueterium atom in eV\n", + "n=P/(O*1.6*10**-19);##no of D atoms required\n", + "m=n*M1/NA;##equivalent mass of D required per s\n", + "X=m*t;\n", + "\n", + "print'%s %.2f %s'%('Deuterium requirement per day in kg is',X,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Deuterium requirement per day in kg is 0.03 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter16.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter16.ipynb new file mode 100755 index 00000000..0852b1be --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter16.ipynb @@ -0,0 +1,187 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d811f941685df0c27130d7c823a224d6aa75e253b0c49d58341e9220ca07cdb5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter16-Structure of Solids" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg483" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 16.1\n", + "##calculation of density\n", + "\n", + "##given values\n", + "a=3.36*10**-10;##lattice constant in m\n", + "M=209.;##atomicmass of polonium in kg\n", + "N=6.02*10**26;##avogadro's number\n", + "z=1.;##no of atom\n", + "##calculation\n", + "d=z*M/(N*a**3)\n", + "\n", + "print'%s %.2f %s'%('density (in kg/m^3) is',d,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "density (in kg/m^3) is 9152.34 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg483" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 16.2\n", + "##calculation of no of atoms\n", + "\n", + "##given values\n", + "a=4.3*10**-10;##edge of unit cell in m\n", + "d=963.;##density in kg/m**3\n", + "M=23.;##atomicmass of sodium in kg\n", + "N=6.02*10**26;##avogadro's number\n", + "\n", + "##calculation\n", + "z=d*N*a**3./M;\n", + "\n", + "print'%s %.2f %s'%('no of atoms is',z,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "no of atoms is 2.00 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg483" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 16.3\n", + "##calculation of distance\n", + "\n", + "##given values\n", + "z=4.;##no of atoms in fcc\n", + "d=2180.;##density in kg/m**3\n", + "M=23+35.3;##atomicmass of sodium chloride in kg\n", + "N=6.02*10**26;##avogadro's number\n", + "\n", + "##calculation\n", + "a1=z*M/(N*d);\n", + "a=a1**(1/3.);\n", + "l=a/2.;##in m\n", + "\n", + "print'%s %.2f %s'%('distance between adjacent chlorine and sodium atoms in armstrong is',l*10**10,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "distance between adjacent chlorine and sodium atoms in armstrong is 2.81 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg495" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 16.4\n", + "##calculation of interatomic spacing\n", + "\n", + "##given values\n", + "alpha=30*math.pi/180.;##Bragg angle in degree\n", + "h=1;\n", + "k=1;\n", + "l=1;\n", + "m=1;##order of reflection\n", + "x=1.75*10**-10;##wavelength in m\n", + "\n", + "##calculation\n", + "d=m*x/(2.*math.sin(alpha));\n", + "a=d*math.sqrt(h**2+k**2+l**2.);##in m\n", + "\n", + "print'%s %.2f %s'%('interatomic spacing in armstrong is',a*10**10,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "interatomic spacing in armstrong is 3.03 \n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter16_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter16_1.ipynb new file mode 100755 index 00000000..0852b1be --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter16_1.ipynb @@ -0,0 +1,187 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d811f941685df0c27130d7c823a224d6aa75e253b0c49d58341e9220ca07cdb5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter16-Structure of Solids" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg483" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 16.1\n", + "##calculation of density\n", + "\n", + "##given values\n", + "a=3.36*10**-10;##lattice constant in m\n", + "M=209.;##atomicmass of polonium in kg\n", + "N=6.02*10**26;##avogadro's number\n", + "z=1.;##no of atom\n", + "##calculation\n", + "d=z*M/(N*a**3)\n", + "\n", + "print'%s %.2f %s'%('density (in kg/m^3) is',d,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "density (in kg/m^3) is 9152.34 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg483" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 16.2\n", + "##calculation of no of atoms\n", + "\n", + "##given values\n", + "a=4.3*10**-10;##edge of unit cell in m\n", + "d=963.;##density in kg/m**3\n", + "M=23.;##atomicmass of sodium in kg\n", + "N=6.02*10**26;##avogadro's number\n", + "\n", + "##calculation\n", + "z=d*N*a**3./M;\n", + "\n", + "print'%s %.2f %s'%('no of atoms is',z,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "no of atoms is 2.00 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg483" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 16.3\n", + "##calculation of distance\n", + "\n", + "##given values\n", + "z=4.;##no of atoms in fcc\n", + "d=2180.;##density in kg/m**3\n", + "M=23+35.3;##atomicmass of sodium chloride in kg\n", + "N=6.02*10**26;##avogadro's number\n", + "\n", + "##calculation\n", + "a1=z*M/(N*d);\n", + "a=a1**(1/3.);\n", + "l=a/2.;##in m\n", + "\n", + "print'%s %.2f %s'%('distance between adjacent chlorine and sodium atoms in armstrong is',l*10**10,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "distance between adjacent chlorine and sodium atoms in armstrong is 2.81 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg495" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 16.4\n", + "##calculation of interatomic spacing\n", + "\n", + "##given values\n", + "alpha=30*math.pi/180.;##Bragg angle in degree\n", + "h=1;\n", + "k=1;\n", + "l=1;\n", + "m=1;##order of reflection\n", + "x=1.75*10**-10;##wavelength in m\n", + "\n", + "##calculation\n", + "d=m*x/(2.*math.sin(alpha));\n", + "a=d*math.sqrt(h**2+k**2+l**2.);##in m\n", + "\n", + "print'%s %.2f %s'%('interatomic spacing in armstrong is',a*10**10,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "interatomic spacing in armstrong is 3.03 \n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter17.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter17.ipynb new file mode 100755 index 00000000..24b8e0d7 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter17.ipynb @@ -0,0 +1,138 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:247cbf7511831aaf13adbf586a5a4c7c4e491e38e060a5558f6021f692906cbf" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter17-The Band Theory of Solids" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg522" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 17.1\n", + "##calculation of probability\n", + "\n", + "##given values\n", + "E=.01;##energy difference in eV\n", + "kT=.026;##temperture equivalent at room temp in e\n", + "\n", + "##calculation\n", + "P=1/(1+(math.e**(E/kT)));\n", + "\n", + "print'%s %.2f %s'%('interatomic spacing is',P,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "interatomic spacing is 0.41 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg523" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 17.2\n", + "##calculation of velocity of e\n", + "\n", + "##given values\n", + "e=1.6*10**-19.;##charge of e in C\n", + "E=2.1*e;##fermi level in J\n", + "m=9.1*10**-31.;##mass of e in kg\n", + "\n", + "##calculation\n", + "v=math.sqrt(2.*E/m);\n", + "\n", + "print'%s %.2f %s'%('velocity of e(in m/s)',v,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "velocity of e(in m/s) 859337.85 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg523" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 17.3\n", + "##calculation of velocity of fraction of free electrons\n", + "\n", + "##given values\n", + "E=5.5;##fermi level in eV\n", + "kT=.026;##temperture equivalent at room temp in e\n", + "\n", + "##calculation\n", + "f=2.*kT/E;\n", + "\n", + "print'%s %.4f %s'%('fraction of free electrone\\s upto width kT on either side of Ef is',f,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "fraction of free electrone\\s upto width kT on either side of Ef is 0.0095 \n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter17_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter17_1.ipynb new file mode 100755 index 00000000..24b8e0d7 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter17_1.ipynb @@ -0,0 +1,138 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:247cbf7511831aaf13adbf586a5a4c7c4e491e38e060a5558f6021f692906cbf" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter17-The Band Theory of Solids" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg522" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 17.1\n", + "##calculation of probability\n", + "\n", + "##given values\n", + "E=.01;##energy difference in eV\n", + "kT=.026;##temperture equivalent at room temp in e\n", + "\n", + "##calculation\n", + "P=1/(1+(math.e**(E/kT)));\n", + "\n", + "print'%s %.2f %s'%('interatomic spacing is',P,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "interatomic spacing is 0.41 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg523" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 17.2\n", + "##calculation of velocity of e\n", + "\n", + "##given values\n", + "e=1.6*10**-19.;##charge of e in C\n", + "E=2.1*e;##fermi level in J\n", + "m=9.1*10**-31.;##mass of e in kg\n", + "\n", + "##calculation\n", + "v=math.sqrt(2.*E/m);\n", + "\n", + "print'%s %.2f %s'%('velocity of e(in m/s)',v,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "velocity of e(in m/s) 859337.85 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg523" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 17.3\n", + "##calculation of velocity of fraction of free electrons\n", + "\n", + "##given values\n", + "E=5.5;##fermi level in eV\n", + "kT=.026;##temperture equivalent at room temp in e\n", + "\n", + "##calculation\n", + "f=2.*kT/E;\n", + "\n", + "print'%s %.4f %s'%('fraction of free electrone\\s upto width kT on either side of Ef is',f,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "fraction of free electrone\\s upto width kT on either side of Ef is 0.0095 \n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter18.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter18.ipynb new file mode 100755 index 00000000..d80a182f --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter18.ipynb @@ -0,0 +1,319 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:265535ddaffc0266824860d662b8052593e36ca515dd70e32c070b51cf842e7d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter18-Semiconductors" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg539" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 18.2\n", + "##calculation of probability\n", + "\n", + "##given values\n", + "T=300.;##temp in K\n", + "kT=.026;##temperture equivalent at room temp in eV\n", + "Eg=5.6;##forbidden gap in eV\n", + "\n", + "##calculation\n", + "f=1./(1.+math.e**(Eg/(2.*kT)));\n", + "\n", + "print'%s %.3e %s'%('probability of an e being thermally promoted to conduction band is',f,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "probability of an e being thermally promoted to conduction band is 1.698e-47 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg540" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 18.3\n", + "##calculation of fraction of e in CB\n", + "\n", + "##given values\n", + "T=300.;##temp in K\n", + "kT=.026;##temperture equivalent at room temp in eV\n", + "Eg1=.72;##forbidden gap of germanium in eV\n", + "Eg2=1.1;##forbidden gap of silicon in eV\n", + "Eg3=5.6;##forbidden gap of diamond in eV\n", + "\n", + "##calculation\n", + "f1=math.e**(-Eg1/(2.*kT));\n", + "print'%s %.6f %s'%('fraction of e in conduction band of germanium is',f1,'');\n", + "f2=math.e**(-Eg2/(2.*kT));\n", + "print'%s %.3e %s'%('fraction of e in conduction band of silicon is',f2,'');\n", + "f3=math.e**(-Eg3/(2*kT));\n", + "print'%s %.3e %s'%('fraction of e in conduction band of diamond is',f3,'');\n", + "print'abpove results shows that larger the band gap and the smaller electrons that can go under into the conduction band'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "fraction of e in conduction band of germanium is 0.000001 \n", + "fraction of e in conduction band of silicon is 6.501e-10 \n", + "fraction of e in conduction band of diamond is 1.698e-47 \n", + "abpove results shows that larger the band gap and the smaller electrons that can go under into the conduction band\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg540" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 18.4\n", + "##calculation of fractionional change in no of e\n", + "\n", + "##given values\n", + "T1=300.;##temp in K\n", + "T2=310.;##temp in K\n", + "Eg=1.1;##forbidden gap of silicon in eV\n", + "k=8.6*10**-5.;##boltzmann's constant in eV/K\n", + "\n", + "##calculation\n", + "n1=(10**21.7)*(T1**(3/2.))*10**(-2500.*Eg/T1);##no of conduction e at T1\n", + "n2=(10**21.7)*(T2**(3/2.))*10**(-2500.*Eg/T2);##no of conduction e at T2\n", + "x=n2/n1;\n", + "print'%s %.1f %s'%('fractional change in no of e is',x,'');\n", + "print 'in book he just worte ans but he didnt calculated final ans but here is i calculated'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "fractional change in no of e is 2.1 \n", + "in book he just worte ans but he didnt calculated final ans but here is i calculated\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg541" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "##Example 18.5\n", + "##calculation of resistivity\n", + "\n", + "##given values\n", + "e=1.6*10**-19;\n", + "ni=2.5*10**19;##intrinsic density of carriers per m**3\n", + "ue=.39;##mobility of e \n", + "uh=.19;##mobility of hole\n", + "\n", + "\n", + "##calculation\n", + "c=e*ni*(ue+uh);##conductivity\n", + "r=1/c;##resistivity\n", + "print'%s %.2f %s'%('resistivity in ohm m is',r,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "resistivity in ohm m is 0.43 \n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg548" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 18.6\n", + "##calculation of conductivity of intrinsic and doped semiconductors\n", + "\n", + "##given values\n", + "h=4.52*10**24;##no of holes per m**3\n", + "e=1.25*10**14;##no of electrons per m**3\n", + "ue=.38;##e mobility\n", + "uh=.18;##hole mobility\n", + "q=1.6*10**-19;##charge of e in C\n", + "##calculation\n", + "ni=math.sqrt(h*e);##intrinsic concentration\n", + "ci=q*ni*(ue+uh);\n", + "print'%s %.2f %s'%('conductivity of semiconductor(in S/m) is',ci,'');\n", + "cp=q*h*uh;\n", + "print'%s %.2f %s'%('conductivity of doped semiconductor (in S/m) is',cp,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "conductivity of semiconductor(in S/m) is 2.13 \n", + "conductivity of doped semiconductor (in S/m) is 130176.00 \n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg548" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 18.7\n", + "##calculation of hole concentration\n", + "\n", + "##given values\n", + "ni=2.4*10**19.;##carrier concentration per m**3\n", + "N=4*10**28.;##concentration of ge atoms per m**3\n", + "\n", + "##calculation\n", + "ND=N/10**6.;##donor cocntrtn\n", + "n=ND;##no of electrones\n", + "\n", + "p=ni**2./n;\n", + "print'%s %.3e %s'%('concentartion of holes per m^3 is',p,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "concentartion of holes per m^3 is 1.440e+16 \n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg558" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 18.8\n", + "##calculation of Hall voltage\n", + "\n", + "##given values\n", + "ND=10**21.;##donor density per m**3\n", + "B=.5;##magnetic field in T\n", + "J=500.;##current density in A/m**2\n", + "w=3*10**-3.;##width in m\n", + "e=1.6*10**-19.;##charge in C\n", + "\n", + "##calculation\n", + "\n", + "\n", + "V=B*J*w/(ND*e);##in volts\n", + "print'%s %.2f %s'%('Hall voltage in mv is',V*10**3,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hall voltage in mv is 4.69 \n" + ] + } + ], + "prompt_number": 14 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter18_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter18_1.ipynb new file mode 100755 index 00000000..d80a182f --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter18_1.ipynb @@ -0,0 +1,319 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:265535ddaffc0266824860d662b8052593e36ca515dd70e32c070b51cf842e7d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter18-Semiconductors" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg539" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 18.2\n", + "##calculation of probability\n", + "\n", + "##given values\n", + "T=300.;##temp in K\n", + "kT=.026;##temperture equivalent at room temp in eV\n", + "Eg=5.6;##forbidden gap in eV\n", + "\n", + "##calculation\n", + "f=1./(1.+math.e**(Eg/(2.*kT)));\n", + "\n", + "print'%s %.3e %s'%('probability of an e being thermally promoted to conduction band is',f,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "probability of an e being thermally promoted to conduction band is 1.698e-47 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg540" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 18.3\n", + "##calculation of fraction of e in CB\n", + "\n", + "##given values\n", + "T=300.;##temp in K\n", + "kT=.026;##temperture equivalent at room temp in eV\n", + "Eg1=.72;##forbidden gap of germanium in eV\n", + "Eg2=1.1;##forbidden gap of silicon in eV\n", + "Eg3=5.6;##forbidden gap of diamond in eV\n", + "\n", + "##calculation\n", + "f1=math.e**(-Eg1/(2.*kT));\n", + "print'%s %.6f %s'%('fraction of e in conduction band of germanium is',f1,'');\n", + "f2=math.e**(-Eg2/(2.*kT));\n", + "print'%s %.3e %s'%('fraction of e in conduction band of silicon is',f2,'');\n", + "f3=math.e**(-Eg3/(2*kT));\n", + "print'%s %.3e %s'%('fraction of e in conduction band of diamond is',f3,'');\n", + "print'abpove results shows that larger the band gap and the smaller electrons that can go under into the conduction band'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "fraction of e in conduction band of germanium is 0.000001 \n", + "fraction of e in conduction band of silicon is 6.501e-10 \n", + "fraction of e in conduction band of diamond is 1.698e-47 \n", + "abpove results shows that larger the band gap and the smaller electrons that can go under into the conduction band\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg540" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 18.4\n", + "##calculation of fractionional change in no of e\n", + "\n", + "##given values\n", + "T1=300.;##temp in K\n", + "T2=310.;##temp in K\n", + "Eg=1.1;##forbidden gap of silicon in eV\n", + "k=8.6*10**-5.;##boltzmann's constant in eV/K\n", + "\n", + "##calculation\n", + "n1=(10**21.7)*(T1**(3/2.))*10**(-2500.*Eg/T1);##no of conduction e at T1\n", + "n2=(10**21.7)*(T2**(3/2.))*10**(-2500.*Eg/T2);##no of conduction e at T2\n", + "x=n2/n1;\n", + "print'%s %.1f %s'%('fractional change in no of e is',x,'');\n", + "print 'in book he just worte ans but he didnt calculated final ans but here is i calculated'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "fractional change in no of e is 2.1 \n", + "in book he just worte ans but he didnt calculated final ans but here is i calculated\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg541" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "##Example 18.5\n", + "##calculation of resistivity\n", + "\n", + "##given values\n", + "e=1.6*10**-19;\n", + "ni=2.5*10**19;##intrinsic density of carriers per m**3\n", + "ue=.39;##mobility of e \n", + "uh=.19;##mobility of hole\n", + "\n", + "\n", + "##calculation\n", + "c=e*ni*(ue+uh);##conductivity\n", + "r=1/c;##resistivity\n", + "print'%s %.2f %s'%('resistivity in ohm m is',r,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "resistivity in ohm m is 0.43 \n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg548" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 18.6\n", + "##calculation of conductivity of intrinsic and doped semiconductors\n", + "\n", + "##given values\n", + "h=4.52*10**24;##no of holes per m**3\n", + "e=1.25*10**14;##no of electrons per m**3\n", + "ue=.38;##e mobility\n", + "uh=.18;##hole mobility\n", + "q=1.6*10**-19;##charge of e in C\n", + "##calculation\n", + "ni=math.sqrt(h*e);##intrinsic concentration\n", + "ci=q*ni*(ue+uh);\n", + "print'%s %.2f %s'%('conductivity of semiconductor(in S/m) is',ci,'');\n", + "cp=q*h*uh;\n", + "print'%s %.2f %s'%('conductivity of doped semiconductor (in S/m) is',cp,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "conductivity of semiconductor(in S/m) is 2.13 \n", + "conductivity of doped semiconductor (in S/m) is 130176.00 \n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg548" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 18.7\n", + "##calculation of hole concentration\n", + "\n", + "##given values\n", + "ni=2.4*10**19.;##carrier concentration per m**3\n", + "N=4*10**28.;##concentration of ge atoms per m**3\n", + "\n", + "##calculation\n", + "ND=N/10**6.;##donor cocntrtn\n", + "n=ND;##no of electrones\n", + "\n", + "p=ni**2./n;\n", + "print'%s %.3e %s'%('concentartion of holes per m^3 is',p,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "concentartion of holes per m^3 is 1.440e+16 \n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg558" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 18.8\n", + "##calculation of Hall voltage\n", + "\n", + "##given values\n", + "ND=10**21.;##donor density per m**3\n", + "B=.5;##magnetic field in T\n", + "J=500.;##current density in A/m**2\n", + "w=3*10**-3.;##width in m\n", + "e=1.6*10**-19.;##charge in C\n", + "\n", + "##calculation\n", + "\n", + "\n", + "V=B*J*w/(ND*e);##in volts\n", + "print'%s %.2f %s'%('Hall voltage in mv is',V*10**3,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hall voltage in mv is 4.69 \n" + ] + } + ], + "prompt_number": 14 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter19.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter19.ipynb new file mode 100755 index 00000000..9cd6b0d3 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter19.ipynb @@ -0,0 +1,103 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e62a104ff81010a41974070c37970149915a1689606735dc017583e29241aaa5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter19-PN-Junction Diode" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg571" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 19.1\n", + "##calculation of potential barrier\n", + "\n", + "##given values\n", + "e=1.6*10**-19.;\n", + "n=4.4*10**28.;##no of atoms per m**3\n", + "kT=.026*e;##temp eqvlnt at room temp\n", + "ni=2.4*10**19.;##no of intrinsic carriers per m**3\n", + "NA=n/10**6.;##no of acceptors\n", + "ND=n/10**6.;##no of donors\n", + "\n", + "##calculation\n", + "V=(kT/e)*math.log(NA*ND/ni**2);\n", + "print'%s %.2f %s'%('potential barrier in volts is',V,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "potential barrier in volts is 0.39 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg578" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 19.2\n", + "##calculation of current\n", + "\n", + "##given values\n", + "e=1.6*10**-19.;\n", + "kT=.026*e;##temp eqvlnt at room temp\n", + "Io=2*10**-7;##current flowing at room temp in A\n", + "V=.1;##forward bias voltage in volts\n", + "\n", + "##calculation\n", + "I=Io*(math.e**(e*V/kT)-1);##in Ampere\n", + "print'%s %.2f %s'%('current flowing when forward bias applied(in microampere)is',I*10**6,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "current flowing when forward bias applied(in microampere)is 9.16 \n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter19_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter19_1.ipynb new file mode 100755 index 00000000..9cd6b0d3 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter19_1.ipynb @@ -0,0 +1,103 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e62a104ff81010a41974070c37970149915a1689606735dc017583e29241aaa5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter19-PN-Junction Diode" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg571" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 19.1\n", + "##calculation of potential barrier\n", + "\n", + "##given values\n", + "e=1.6*10**-19.;\n", + "n=4.4*10**28.;##no of atoms per m**3\n", + "kT=.026*e;##temp eqvlnt at room temp\n", + "ni=2.4*10**19.;##no of intrinsic carriers per m**3\n", + "NA=n/10**6.;##no of acceptors\n", + "ND=n/10**6.;##no of donors\n", + "\n", + "##calculation\n", + "V=(kT/e)*math.log(NA*ND/ni**2);\n", + "print'%s %.2f %s'%('potential barrier in volts is',V,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "potential barrier in volts is 0.39 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg578" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 19.2\n", + "##calculation of current\n", + "\n", + "##given values\n", + "e=1.6*10**-19.;\n", + "kT=.026*e;##temp eqvlnt at room temp\n", + "Io=2*10**-7;##current flowing at room temp in A\n", + "V=.1;##forward bias voltage in volts\n", + "\n", + "##calculation\n", + "I=Io*(math.e**(e*V/kT)-1);##in Ampere\n", + "print'%s %.2f %s'%('current flowing when forward bias applied(in microampere)is',I*10**6,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "current flowing when forward bias applied(in microampere)is 9.16 \n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter21.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter21.ipynb new file mode 100755 index 00000000..4528f908 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter21.ipynb @@ -0,0 +1,149 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0a1f9cbfac6e4a80fe362c0012a4a307feac15a79ecc69bd2a9d9a5220fc3bbc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter21-Magnetic Materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg612" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 21.1\n", + "##calculation of magnetizing force and relative permeability\n", + "\n", + "##given values\n", + "M=2300.;##magnetization in A/m\n", + "B=.00314;##flux density in Wb/m**2\n", + "u=12.57*10**-7.;##permeability in H/m\n", + "\n", + "##calculation\n", + "H=(B/u)-M;\n", + "print'%s %.2f %s'%('magnetizing force(in A/m)is ',H,'');\n", + "Ur=B/(u*H);\n", + "print'%s %.2f %s'%('relative permeability is',Ur,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnetizing force(in A/m)is 198.01 \n", + "relative permeability is 12.62 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg613" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 21.2\n", + "##calculation of magnetization and magnetic flux density\n", + "\n", + "##given values\n", + "H=10**5;##external field in A/m\n", + "X=5*10**-5;##susceptibility \n", + "u=12.57*10**-7;##permeability in H/m\n", + "\n", + "##calculation\n", + "M=X*H;\n", + "print'%s %.2f %s'%('magnetization (in A/m)is ',M,'');\n", + "B=u*(M+H);\n", + "print'%s %.2f %s'%('magnetic flux density (in wb/m^2) is',B,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnetization (in A/m)is 5.00 \n", + "magnetic flux density (in wb/m^2) is 0.13 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg615" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 21.3\n", + "##calculation of relative permeability\n", + "\n", + "##given values\n", + "\n", + "X=3.7*10**-3;##susceptibility at 300k\n", + "T=300;##temp in K\n", + "T1=200;##temp in K\n", + "T2=500;##temp in K\n", + "\n", + "##calculation\n", + "C=X*T;##curie constant\n", + "XT1=C/T1;\n", + "print'%s %.4f %s'%('relative permeability at T1 is ',XT1,'');\n", + "XT2=C/T2;\n", + "print'%s %.3f %s'%('relative permeability at T2 is',XT2,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "relative permeability at T1 is 0.0056 \n", + "relative permeability at T2 is 0.002 \n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter21_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter21_1.ipynb new file mode 100755 index 00000000..4528f908 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter21_1.ipynb @@ -0,0 +1,149 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0a1f9cbfac6e4a80fe362c0012a4a307feac15a79ecc69bd2a9d9a5220fc3bbc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter21-Magnetic Materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg612" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 21.1\n", + "##calculation of magnetizing force and relative permeability\n", + "\n", + "##given values\n", + "M=2300.;##magnetization in A/m\n", + "B=.00314;##flux density in Wb/m**2\n", + "u=12.57*10**-7.;##permeability in H/m\n", + "\n", + "##calculation\n", + "H=(B/u)-M;\n", + "print'%s %.2f %s'%('magnetizing force(in A/m)is ',H,'');\n", + "Ur=B/(u*H);\n", + "print'%s %.2f %s'%('relative permeability is',Ur,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnetizing force(in A/m)is 198.01 \n", + "relative permeability is 12.62 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg613" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 21.2\n", + "##calculation of magnetization and magnetic flux density\n", + "\n", + "##given values\n", + "H=10**5;##external field in A/m\n", + "X=5*10**-5;##susceptibility \n", + "u=12.57*10**-7;##permeability in H/m\n", + "\n", + "##calculation\n", + "M=X*H;\n", + "print'%s %.2f %s'%('magnetization (in A/m)is ',M,'');\n", + "B=u*(M+H);\n", + "print'%s %.2f %s'%('magnetic flux density (in wb/m^2) is',B,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnetization (in A/m)is 5.00 \n", + "magnetic flux density (in wb/m^2) is 0.13 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg615" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 21.3\n", + "##calculation of relative permeability\n", + "\n", + "##given values\n", + "\n", + "X=3.7*10**-3;##susceptibility at 300k\n", + "T=300;##temp in K\n", + "T1=200;##temp in K\n", + "T2=500;##temp in K\n", + "\n", + "##calculation\n", + "C=X*T;##curie constant\n", + "XT1=C/T1;\n", + "print'%s %.4f %s'%('relative permeability at T1 is ',XT1,'');\n", + "XT2=C/T2;\n", + "print'%s %.3f %s'%('relative permeability at T2 is',XT2,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "relative permeability at T1 is 0.0056 \n", + "relative permeability at T2 is 0.002 \n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter22.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter22.ipynb new file mode 100755 index 00000000..86088884 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter22.ipynb @@ -0,0 +1,141 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:29de63e7ef1a8622d7d2e459bd1b9274805adbb7b74a608deb83d9b4c0dd3ef4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Chapter22-Superconductivity" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg646" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 22.1\n", + "##calculation of magnetic field\n", + "\n", + "##given values\n", + "\n", + "Tc=7.2;##transition temp in K\n", + "T=5.;##temp in K\n", + "Hc=3.3*10**4;##magnetic field at T in A/m\n", + "\n", + "\n", + "##calculation\n", + "Hc0=Hc/(1-(T**2/Tc**2));\n", + "print'%s %.2f %s'%('max value of H at 0K (in A/m) is ',Hc0,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max value of H at 0K (in A/m) is 63737.70 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg646" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 22.2\n", + "##calculation of transition temperature\n", + "\n", + "##given values\n", + "\n", + "T=8.;##temp in K\n", + "Hc=1*10**5.;##critical magnetic field at T in A/m\n", + "Hc0=2*10**5.;##magnetic field at 0 K in A/m\n", + "\n", + "##calculation\n", + "Tc=T/(math.sqrt(1.-Hc/Hc0));\n", + "print'%s %.2f %s'%('transition temp in K is',Tc,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "transition temp in K is 11.31 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg647" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 22.3\n", + "##calculation of temp at which there is max critical field\n", + "\n", + "##given values\n", + "\n", + "Tc=7.26;##critical temp in K\n", + "Hc=8*10**5.;##max critical magnetic field at T in A/m\n", + "H=4*10**4.;## subjected magnetic field at in A/m\n", + "\n", + "##calculation\n", + "T=Tc*(math.sqrt(1.-H/Hc));\n", + "print'%s %.2f %s'%('max temp for superconductivity in K is',T,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max temp for superconductivity in K is 7.08 \n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter22_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter22_1.ipynb new file mode 100755 index 00000000..15083682 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter22_1.ipynb @@ -0,0 +1,141 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ab6a6bb45b4cdef5c73ac14b797742c1b4b21056356723e765f29cef6d5d7ccd" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter22-Superconductivity" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg646" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 22.1\n", + "##calculation of magnetic field\n", + "\n", + "##given values\n", + "\n", + "Tc=7.2;##transition temp in K\n", + "T=5.;##temp in K\n", + "Hc=3.3*10**4;##magnetic field at T in A/m\n", + "\n", + "\n", + "##calculation\n", + "Hc0=Hc/(1-(T**2/Tc**2));\n", + "print'%s %.2f %s'%('max value of H at 0K (in A/m) is ',Hc0,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max value of H at 0K (in A/m) is 63737.70 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg646" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 22.2\n", + "##calculation of transition temperature\n", + "\n", + "##given values\n", + "\n", + "T=8.;##temp in K\n", + "Hc=1*10**5.;##critical magnetic field at T in A/m\n", + "Hc0=2*10**5.;##magnetic field at 0 K in A/m\n", + "\n", + "##calculation\n", + "Tc=T/(math.sqrt(1.-Hc/Hc0));\n", + "print'%s %.2f %s'%('transition temp in K is',Tc,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "transition temp in K is 11.31 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg647" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 22.3\n", + "##calculation of temp at which there is max critical field\n", + "\n", + "##given values\n", + "\n", + "Tc=7.26;##critical temp in K\n", + "Hc=8*10**5.;##max critical magnetic field at T in A/m\n", + "H=4*10**4.;## subjected magnetic field at in A/m\n", + "\n", + "##calculation\n", + "T=Tc*(math.sqrt(1.-H/Hc));\n", + "print'%s %.2f %s'%('max temp for superconductivity in K is',T,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max temp for superconductivity in K is 7.08 \n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter23.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter23.ipynb new file mode 100755 index 00000000..d7f5b70f --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter23.ipynb @@ -0,0 +1,311 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4021239986e9b103686ab01f7ccbdc5317b1bf2aa2e09bf052e63053a477f649" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter23-Dielectrics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg679" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.1\n", + "##calculation of relative permittivity\n", + "\n", + "##given values\n", + "\n", + "E=1000.;##electric field in V/m\n", + "P=4.3*10**-8;##polarization in C/m**2\n", + "e=8.85*10**-12;##permittivity in F/m\n", + "\n", + "\n", + "##calculation\n", + "er=1.+(P/(e*E));\n", + "print'%s %.2f %s'%('relative permittivity of NaCl is ',er,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "relative permittivity of NaCl is 5.86 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg675" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.2\n", + "##calculation of electronic polarizability\n", + "\n", + "##given values\n", + "\n", + "e=8.85*10**-12;##permittivity in F/m\n", + "er=1.0024;##relative permittivity at NTP\n", + "N=2.7*10**25.;##atoms per m**3\n", + "\n", + "\n", + "##calculation\n", + "alpha=e*(er-1)/N;\n", + "print'%s %.3e %s'%('electronic polarizability (in F/m^2)is ',alpha,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "electronic polarizability (in F/m^2)is 7.867e-40 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg678" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.3\n", + "##calculation of electronic polarizability and relative permittivity\n", + "\n", + "##given values\n", + "\n", + "e=8.85*10**-12.;##permittivity in F/m\n", + "N=9.8*10**26.;##atoms per m**3\n", + "r=.53*10**-10.;##radius in m\n", + "\n", + "\n", + "##calculation\n", + "alpha=4*math.pi*e*r**3;\n", + "print'%s %.3e %s'%('electronic polarizability (in F/m**2)is ',alpha,'');\n", + "er=1+(4*math.pi*N*r**3);\n", + "print'%s %.2f %s'%('relative permittivity is',er,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "electronic polarizability (in F/m**2)is 1.656e-41 \n", + "relative permittivity is 1.00 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg681" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.4\n", + "##calculation of electronic polarizability and relative permittivity\n", + "\n", + "##given values\n", + "w=32.;##atomic weight of sulphur \n", + "d=2.08*10**3.;##density in kg/m**3\n", + "NA=6.02*10**26.;##avogadros number\n", + "alpha=3.28*10**-40.;##electronic polarizability in F.m**2\n", + "e=8.854*10**-12.;##permittiviy\n", + "##calculation\n", + "\n", + "n=NA*d/w;\n", + "k=n*alpha/(3.*e);\n", + "er=(1+2*k)/(1.-k);\n", + "print'%s %.2f %s'%('relative permittivity is',er,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "relative permittivity is 3.80 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg682" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.5\n", + "##calculation of ionic polarizability\n", + "\n", + "##given values\n", + "n=1.5;##refractive index\n", + "er=6.75;##relative permittivity\n", + "\n", + "##calculation\n", + "Pi=(er-n**2.)*100./(er-1.);\n", + "print'%s %.2f %s'%('percentage ionic polarizability (in %)) is',Pi,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "percentage ionic polarizability (in %)) is 78.26 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg685" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.6\n", + "##calculation of frequency and phase difference\n", + "\n", + "##given values\n", + "t=18*10**-6;##relaxation time in s\n", + "\n", + "##calculation\n", + "f=1/(2*math.pi*t);\n", + "print'%s %.2f %s'%('frequency at which real and imaginary part of complx dielectric constant are equal is',f,'');\n", + "alpha=math.atan(1)*180/math.pi;## phase difference between current and voltage( 1 because real and imaginry parts are equal of the dielectric constant)\n", + "print'%s %.2f %s'%('phase diffeerence (in degree) is',alpha,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "frequency at which real and imaginary part of complx dielectric constant are equal is 8841.94 \n", + "phase diffeerence (in degree) is 45.00 " + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg692" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.7\n", + "##calculation of frequency\n", + "\n", + "##given values\n", + "t=5.5*10**-3.;##thickness of plate in m\n", + "Y=8*10**10.;##Young's modulus in N/m**2\n", + "d=2.65*10**3.;##density in kg/m**3\n", + "\n", + "\n", + "\n", + "##calculation\n", + "f=math.sqrt(Y/d)/(2.*t);##in Hz\n", + "print'%s %.2f %s'%('frequency of fundamental note(in KHz) is',f/10**3,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "frequency of fundamental note(in KHz) is 499.49 \n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter23_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter23_1.ipynb new file mode 100755 index 00000000..d7f5b70f --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter23_1.ipynb @@ -0,0 +1,311 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4021239986e9b103686ab01f7ccbdc5317b1bf2aa2e09bf052e63053a477f649" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter23-Dielectrics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg679" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.1\n", + "##calculation of relative permittivity\n", + "\n", + "##given values\n", + "\n", + "E=1000.;##electric field in V/m\n", + "P=4.3*10**-8;##polarization in C/m**2\n", + "e=8.85*10**-12;##permittivity in F/m\n", + "\n", + "\n", + "##calculation\n", + "er=1.+(P/(e*E));\n", + "print'%s %.2f %s'%('relative permittivity of NaCl is ',er,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "relative permittivity of NaCl is 5.86 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg675" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.2\n", + "##calculation of electronic polarizability\n", + "\n", + "##given values\n", + "\n", + "e=8.85*10**-12;##permittivity in F/m\n", + "er=1.0024;##relative permittivity at NTP\n", + "N=2.7*10**25.;##atoms per m**3\n", + "\n", + "\n", + "##calculation\n", + "alpha=e*(er-1)/N;\n", + "print'%s %.3e %s'%('electronic polarizability (in F/m^2)is ',alpha,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "electronic polarizability (in F/m^2)is 7.867e-40 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg678" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.3\n", + "##calculation of electronic polarizability and relative permittivity\n", + "\n", + "##given values\n", + "\n", + "e=8.85*10**-12.;##permittivity in F/m\n", + "N=9.8*10**26.;##atoms per m**3\n", + "r=.53*10**-10.;##radius in m\n", + "\n", + "\n", + "##calculation\n", + "alpha=4*math.pi*e*r**3;\n", + "print'%s %.3e %s'%('electronic polarizability (in F/m**2)is ',alpha,'');\n", + "er=1+(4*math.pi*N*r**3);\n", + "print'%s %.2f %s'%('relative permittivity is',er,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "electronic polarizability (in F/m**2)is 1.656e-41 \n", + "relative permittivity is 1.00 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg681" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.4\n", + "##calculation of electronic polarizability and relative permittivity\n", + "\n", + "##given values\n", + "w=32.;##atomic weight of sulphur \n", + "d=2.08*10**3.;##density in kg/m**3\n", + "NA=6.02*10**26.;##avogadros number\n", + "alpha=3.28*10**-40.;##electronic polarizability in F.m**2\n", + "e=8.854*10**-12.;##permittiviy\n", + "##calculation\n", + "\n", + "n=NA*d/w;\n", + "k=n*alpha/(3.*e);\n", + "er=(1+2*k)/(1.-k);\n", + "print'%s %.2f %s'%('relative permittivity is',er,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "relative permittivity is 3.80 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg682" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.5\n", + "##calculation of ionic polarizability\n", + "\n", + "##given values\n", + "n=1.5;##refractive index\n", + "er=6.75;##relative permittivity\n", + "\n", + "##calculation\n", + "Pi=(er-n**2.)*100./(er-1.);\n", + "print'%s %.2f %s'%('percentage ionic polarizability (in %)) is',Pi,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "percentage ionic polarizability (in %)) is 78.26 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg685" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.6\n", + "##calculation of frequency and phase difference\n", + "\n", + "##given values\n", + "t=18*10**-6;##relaxation time in s\n", + "\n", + "##calculation\n", + "f=1/(2*math.pi*t);\n", + "print'%s %.2f %s'%('frequency at which real and imaginary part of complx dielectric constant are equal is',f,'');\n", + "alpha=math.atan(1)*180/math.pi;## phase difference between current and voltage( 1 because real and imaginry parts are equal of the dielectric constant)\n", + "print'%s %.2f %s'%('phase diffeerence (in degree) is',alpha,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "frequency at which real and imaginary part of complx dielectric constant are equal is 8841.94 \n", + "phase diffeerence (in degree) is 45.00 " + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg692" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 23.7\n", + "##calculation of frequency\n", + "\n", + "##given values\n", + "t=5.5*10**-3.;##thickness of plate in m\n", + "Y=8*10**10.;##Young's modulus in N/m**2\n", + "d=2.65*10**3.;##density in kg/m**3\n", + "\n", + "\n", + "\n", + "##calculation\n", + "f=math.sqrt(Y/d)/(2.*t);##in Hz\n", + "print'%s %.2f %s'%('frequency of fundamental note(in KHz) is',f/10**3,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "frequency of fundamental note(in KHz) is 499.49 \n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter24.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter24.ipynb new file mode 100755 index 00000000..67066c07 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter24.ipynb @@ -0,0 +1,312 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1cf24b70876a8aeb6aa008651e71d8cde215c5cbb4fe65495bcd461a3cc2b49b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter24-Fibre Optics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg701" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.1\n", + "##Fiber optics\n", + "\n", + "##given values\n", + "n=1.5;##refractive index\n", + "x=.0005;##fractional index difference\n", + "\n", + "##calculation\n", + "u=n*(1-x);\n", + "print'%s %.2f %s'%('cladding index is',u,'');\n", + "alpha=math.asin(u/n)*180/math.pi;\n", + "print'%s %.2f %s'%('critical internal reflection angle(in degree) is',alpha,'');\n", + "theta=math.asin(math.sqrt(n**2-u**2))*180/math.pi;\n", + "print'%s %.2f %s'%('critical acceptance angle(in degree) is',theta,'');\n", + "N=n*math.sqrt(2.*x);\n", + "print'%s %.2f %s'%('numerical aperture is',N,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "cladding index is 1.50 \n", + "critical internal reflection angle(in degree) is 88.19 \n", + "critical acceptance angle(in degree) is 2.72 \n", + "numerical aperture is 0.05 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg701" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.2\n", + "##calculation of acceptance angle\n", + "\n", + "##given values\n", + "n=1.59;##cladding refractive index\n", + "u=1.33;##refractive index of water\n", + "N=.20;##numerical aperture offibre\n", + "##calculation\n", + "x=math.sqrt(N**2+n**2.);##index of fibre\n", + "N1=math.sqrt(x**2-n**2.)/u;##numerical aperture when fibre is in water\n", + "alpha=math.asin(N1)*180./math.pi;\n", + "print'%s %.2f %s'%('acceptance angle in degree is',alpha,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "acceptance angle in degree is 8.65 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg705" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.3\n", + "##calculation of normalised frequency\n", + "\n", + "##given values\n", + "n=1.45;##core refractive index\n", + "d=.6;##core diametre in m\n", + "N=.16;##numerical aperture of fibre\n", + "l=.9*10**-6.;##wavelength of light\n", + "\n", + "##calculation\n", + "u=math.sqrt(n**2.+N**2.);##index of glass fibre\n", + "V=math.pi*d*math.sqrt(u**2.-n**2.)/l;\n", + "print'%s %.2f %s'%('normalised frequency is',V,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "normalised frequency is 335103.22 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg705" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.4\n", + "##calculation of normailsed frequency and no of modes\n", + "\n", + "##given values\n", + "n=1.52;##core refractive index\n", + "d=29*10**-6.;##core diametre in m\n", + "l=1.3*10**-6.;##wavelength of light\n", + "x=.0007;##fractional refractive index\n", + "\n", + "##calculation\n", + "u=n*(1.-x);##index of glass fibre\n", + "V=math.pi*d*math.sqrt(n**2-u**2)/l;\n", + "print'%s %.2f %s'%('normalised frequency is',V,'');\n", + "N=V**2./2.;\n", + "print'%s %.2f %s'%('no of modes is',N,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "normalised frequency is 3.99 \n", + "no of modes is 7.94 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg706" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.5\n", + "##calculation of numerical aperture and maximum acceptance angle\n", + "\n", + "##given values\n", + "n=1.480;##core refractive index\n", + "u=1.47;##index of glass\n", + "l=850*10**-9.;##wavelength of light\n", + "V=2.405;##V-number\n", + "\n", + "##calculation\n", + "r=V*l/math.sqrt(n**2-u**2)/math.pi/2;##in m\n", + "print'%s %.2f %s'%('core radius in micrometre is',r*10**6,'');\n", + "N=math.sqrt(n**2-u**2);\n", + "print'%s %.2f %s'%('numerical aperture is',N,'');\n", + "alpha=math.asin(N)*180/math.pi;\n", + "print'%s %.2f %s'%('max acceptance angle is',alpha,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "core radius in micrometre is 1.89 \n", + "numerical aperture is 0.17 \n", + "max acceptance angle is 9.89 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg712" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.6\n", + "##calculation of power level\n", + "\n", + "##given values\n", + "a=3.5;##attenuation in dB/km\n", + "Pi=.5*10**-3.;##initial power level in W\n", + "l=4.;##length of cable in km\n", + "\n", + "##calculation\n", + "Po=Pi*10**6./(10**(a*l/10.));\n", + "print'%s %.2f %s'%('power level after km(in microwatt) is',Po,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power level after km(in microwatt) is 19.91 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg712" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.7\n", + "##calculation of power loss\n", + "\n", + "##given values\n", + "Pi=1*10**-3.;##initial power level in W\n", + "l=.5;##length of cable in km\n", + "Po=.85*Pi\n", + "\n", + "##calculation\n", + "a=(10./l)*math.log10(Pi/Po);\n", + "print'%s %.2f %s'%('loss in dB/km is',a,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "loss in dB/km is 1.41 \n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter24_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter24_1.ipynb new file mode 100755 index 00000000..67066c07 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter24_1.ipynb @@ -0,0 +1,312 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1cf24b70876a8aeb6aa008651e71d8cde215c5cbb4fe65495bcd461a3cc2b49b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter24-Fibre Optics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg701" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.1\n", + "##Fiber optics\n", + "\n", + "##given values\n", + "n=1.5;##refractive index\n", + "x=.0005;##fractional index difference\n", + "\n", + "##calculation\n", + "u=n*(1-x);\n", + "print'%s %.2f %s'%('cladding index is',u,'');\n", + "alpha=math.asin(u/n)*180/math.pi;\n", + "print'%s %.2f %s'%('critical internal reflection angle(in degree) is',alpha,'');\n", + "theta=math.asin(math.sqrt(n**2-u**2))*180/math.pi;\n", + "print'%s %.2f %s'%('critical acceptance angle(in degree) is',theta,'');\n", + "N=n*math.sqrt(2.*x);\n", + "print'%s %.2f %s'%('numerical aperture is',N,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "cladding index is 1.50 \n", + "critical internal reflection angle(in degree) is 88.19 \n", + "critical acceptance angle(in degree) is 2.72 \n", + "numerical aperture is 0.05 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg701" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.2\n", + "##calculation of acceptance angle\n", + "\n", + "##given values\n", + "n=1.59;##cladding refractive index\n", + "u=1.33;##refractive index of water\n", + "N=.20;##numerical aperture offibre\n", + "##calculation\n", + "x=math.sqrt(N**2+n**2.);##index of fibre\n", + "N1=math.sqrt(x**2-n**2.)/u;##numerical aperture when fibre is in water\n", + "alpha=math.asin(N1)*180./math.pi;\n", + "print'%s %.2f %s'%('acceptance angle in degree is',alpha,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "acceptance angle in degree is 8.65 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg705" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.3\n", + "##calculation of normalised frequency\n", + "\n", + "##given values\n", + "n=1.45;##core refractive index\n", + "d=.6;##core diametre in m\n", + "N=.16;##numerical aperture of fibre\n", + "l=.9*10**-6.;##wavelength of light\n", + "\n", + "##calculation\n", + "u=math.sqrt(n**2.+N**2.);##index of glass fibre\n", + "V=math.pi*d*math.sqrt(u**2.-n**2.)/l;\n", + "print'%s %.2f %s'%('normalised frequency is',V,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "normalised frequency is 335103.22 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg705" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.4\n", + "##calculation of normailsed frequency and no of modes\n", + "\n", + "##given values\n", + "n=1.52;##core refractive index\n", + "d=29*10**-6.;##core diametre in m\n", + "l=1.3*10**-6.;##wavelength of light\n", + "x=.0007;##fractional refractive index\n", + "\n", + "##calculation\n", + "u=n*(1.-x);##index of glass fibre\n", + "V=math.pi*d*math.sqrt(n**2-u**2)/l;\n", + "print'%s %.2f %s'%('normalised frequency is',V,'');\n", + "N=V**2./2.;\n", + "print'%s %.2f %s'%('no of modes is',N,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "normalised frequency is 3.99 \n", + "no of modes is 7.94 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg706" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.5\n", + "##calculation of numerical aperture and maximum acceptance angle\n", + "\n", + "##given values\n", + "n=1.480;##core refractive index\n", + "u=1.47;##index of glass\n", + "l=850*10**-9.;##wavelength of light\n", + "V=2.405;##V-number\n", + "\n", + "##calculation\n", + "r=V*l/math.sqrt(n**2-u**2)/math.pi/2;##in m\n", + "print'%s %.2f %s'%('core radius in micrometre is',r*10**6,'');\n", + "N=math.sqrt(n**2-u**2);\n", + "print'%s %.2f %s'%('numerical aperture is',N,'');\n", + "alpha=math.asin(N)*180/math.pi;\n", + "print'%s %.2f %s'%('max acceptance angle is',alpha,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "core radius in micrometre is 1.89 \n", + "numerical aperture is 0.17 \n", + "max acceptance angle is 9.89 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg712" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.6\n", + "##calculation of power level\n", + "\n", + "##given values\n", + "a=3.5;##attenuation in dB/km\n", + "Pi=.5*10**-3.;##initial power level in W\n", + "l=4.;##length of cable in km\n", + "\n", + "##calculation\n", + "Po=Pi*10**6./(10**(a*l/10.));\n", + "print'%s %.2f %s'%('power level after km(in microwatt) is',Po,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power level after km(in microwatt) is 19.91 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg712" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 24.7\n", + "##calculation of power loss\n", + "\n", + "##given values\n", + "Pi=1*10**-3.;##initial power level in W\n", + "l=.5;##length of cable in km\n", + "Po=.85*Pi\n", + "\n", + "##calculation\n", + "a=(10./l)*math.log10(Pi/Po);\n", + "print'%s %.2f %s'%('loss in dB/km is',a,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "loss in dB/km is 1.41 \n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter4.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter4.ipynb new file mode 100755 index 00000000..024db2ff --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter4.ipynb @@ -0,0 +1,314 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5cdc0313c39e461d83bef4f404708f38e979d4c9312a95284be2bd9b855678fb" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter4-Electron Ballistics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "##Example 4.1\n", + "##Calculation of acceleration,time taken,distance covered and kinetic energy of an accelerating proton\n", + "\n", + "##given values\n", + "m=1.67 *10**-27;##mass of proton in kg\n", + "q=1.602 *10**-19;##charge of proton in Coulomb\n", + "v1=0;##initial velocity in m/s\n", + "v2=2.5*10**6;##final velocity in m/s\n", + "E=500.;##electric field strength in V/m\n", + "##calculation\n", + "a=E*q/m;##acceleration\n", + "print'%s %.1f %s'%('acceleration of proton in (m/s^2) is:',a,'');\n", + "t=v2/a;##time\n", + "print'%s %.5f %s'%('time(in s) taken by proton to reach the final velocity is:',t,'');\n", + "x=a*t**2./2.;##distance\n", + "print'%s %.1f %s'%('distance (in m)covered by proton in this time is:',x,'');\n", + "KE=E*q*x;##kinetic energy\n", + "print'%s %.3e %s'%('kinetic energy(in J) at the time is:',KE,'');\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "acceleration of proton in (m/s^2) is: 47964071856.3 \n", + "time(in s) taken by proton to reach the final velocity is: 0.00005 \n", + "distance (in m)covered by proton in this time is: 65.2 \n", + "kinetic energy(in J) at the time is: 5.219e-15 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 4.2\n", + "##electrostatic deflection\n", + "##given values\n", + "pi=3.141\n", + "V1=2000.;##in volts,potential difference through which electron beam is accelerated\n", + "l=.04;##length of rectangular plates\n", + "d=.015;##distance between plates\n", + "V=50.;##potential difference between plates\n", + "##calculations\n", + "alpha=math.atan(l*V/(2.*d*V1))*(180./pi);##in degrees\n", + "print'%s %.1f %s'%('angle of deflection of electron beam is:',alpha,'')\n", + "v=5.93*(10**5)*math.sqrt(V1);##horizontal velocity in m/s\n", + "t=l/v;##in s\n", + "print'%s %.3e %s'%('transit time through electric field is:',t,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "angle of deflection of electron beam is: 1.9 \n", + "transit time through electric field is: 1.508e-09 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 4.3\n", + "##electron projected at an angle into a uniform electric field\n", + "##given values\n", + "v1=4.5*10**5;##initial speed in m/s\n", + "alpha=37*math.pi/180.;##angle of projection in degrees\n", + "E=200.;##electric field intensity in N/C\n", + "e=1.6*10**-19;##in C\n", + "m=9.1*10**-31;##in kg\n", + "a=e*E/m;##acceleration in m/s**2\n", + "t=2*v1*math.sin(alpha)/a;##time in s\n", + "print'%s %.2e %s'%('time taken by electron to return to its initial level is:',t,'')\n", + "H=(v1**2.*math.sin(alpha)*math.sin(alpha))/(2.*a);##height in m\n", + "print'%s %.4f %s'%('maximum height reached by electron is:',H,'')\n", + "s=(v1**2.)*(2.*math.sin(alpha)*math.cos(alpha))/(2.*a);##print'%s %.1f %s'%lacement in m\n", + "print'%s %.4f %s'%('horizontal displacement(in m)when it reaches maximum height is:',s,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "time taken by electron to return to its initial level is: 1.54e-08 \n", + "maximum height reached by electron is: 0.0010 \n", + "horizontal displacement(in m)when it reaches maximum height is: 0.0028 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 4.4\n", + "##motion of an electron in a uniform magnetic field\n", + "##given values\n", + "V=200.;##potential difference through which electron is accelerated in volts\n", + "B=0.01;##magnetic field in wb/m**2\n", + "e=1.6*10**-19;##in C\n", + "m=9.1*10**-31;##in kg\n", + "v=math.sqrt(2.*e*V/m);##electron velocity in m/s\n", + "print'%s %.1f %s'%('electron velocity is:',v,'')\n", + "r=m*v/(e*B);##in m\n", + "print'%s %.4f %s'%('radius of path (in m)is:',r,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "electron velocity is: 8386278.7 \n", + "radius of path (in m)is: 0.0048 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 4.5\n", + "##motion of an electron in a uniform magnetic field acting at an angle\n", + "##given values\n", + "v=3*10**7;##electron speed\n", + "B=.23;##magnetic field in wb/m**2\n", + "q=45*math.pi/180;##in degrees,angle in which electron enter field\n", + "e=1.6*10**-19;##in C\n", + "m=9.1*10**-31;##in kg\n", + "R=m*v*math.sin(q)/(e*B);##in m\n", + "print'%s %.5f %s'%('radius of helical path is:',R,'')\n", + "p=2*math.pi*m*v*math.cos(q)/(e*B);##in m\n", + "print'%s %.4f %s'%('pitch of helical path(in m) is:',p,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "radius of helical path is: 0.00052 \n", + "pitch of helical path(in m) is: 0.0033 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 4.6\n", + "##Magnetostatic deflection\n", + "##given values\n", + "D=.03;##deflection in m\n", + "m=9.1*10**-31;##in kg\n", + "e=1.6*10**-19;##in C\n", + "L=.15;##distance between CRT and anode in m\n", + "l=L/2.;\n", + "V=2000.;##in voltsin wb/\n", + "B=D*math.sqrt(2.*m*V)/(L*l*math.sqrt(e));##in wb/m**2\n", + "print'%s %.4f %s'%('transverse magnetic field acting (in wb/m^2)is:',B,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "transverse magnetic field acting (in wb/m^2)is: 0.0004 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 4.7\n", + "##electric and magnetic fields in crossed configuration\n", + "##given values\n", + "B=2*10**-3;##magnetic field in wb/m**2\n", + "E=3.4*10**4;##electric field in V/m\n", + "m=9.1*10**-31;##in kg\n", + "e=1.6*10**-19;##in C\n", + "v=E/B;##in m/s\n", + "print'%s %.1f %s'%('electron speed is:',v,'')\n", + "R=m*v/(e*B);##in m\n", + "print'%s %.3f %s'%('radius of circular path (in m) when electric field is switched off',R,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "electron speed is: 17000000.0 \n", + "radius of circular path (in m) when electric field is switched off 0.048 \n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter4_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter4_1.ipynb new file mode 100755 index 00000000..024db2ff --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter4_1.ipynb @@ -0,0 +1,314 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5cdc0313c39e461d83bef4f404708f38e979d4c9312a95284be2bd9b855678fb" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter4-Electron Ballistics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "##Example 4.1\n", + "##Calculation of acceleration,time taken,distance covered and kinetic energy of an accelerating proton\n", + "\n", + "##given values\n", + "m=1.67 *10**-27;##mass of proton in kg\n", + "q=1.602 *10**-19;##charge of proton in Coulomb\n", + "v1=0;##initial velocity in m/s\n", + "v2=2.5*10**6;##final velocity in m/s\n", + "E=500.;##electric field strength in V/m\n", + "##calculation\n", + "a=E*q/m;##acceleration\n", + "print'%s %.1f %s'%('acceleration of proton in (m/s^2) is:',a,'');\n", + "t=v2/a;##time\n", + "print'%s %.5f %s'%('time(in s) taken by proton to reach the final velocity is:',t,'');\n", + "x=a*t**2./2.;##distance\n", + "print'%s %.1f %s'%('distance (in m)covered by proton in this time is:',x,'');\n", + "KE=E*q*x;##kinetic energy\n", + "print'%s %.3e %s'%('kinetic energy(in J) at the time is:',KE,'');\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "acceleration of proton in (m/s^2) is: 47964071856.3 \n", + "time(in s) taken by proton to reach the final velocity is: 0.00005 \n", + "distance (in m)covered by proton in this time is: 65.2 \n", + "kinetic energy(in J) at the time is: 5.219e-15 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 4.2\n", + "##electrostatic deflection\n", + "##given values\n", + "pi=3.141\n", + "V1=2000.;##in volts,potential difference through which electron beam is accelerated\n", + "l=.04;##length of rectangular plates\n", + "d=.015;##distance between plates\n", + "V=50.;##potential difference between plates\n", + "##calculations\n", + "alpha=math.atan(l*V/(2.*d*V1))*(180./pi);##in degrees\n", + "print'%s %.1f %s'%('angle of deflection of electron beam is:',alpha,'')\n", + "v=5.93*(10**5)*math.sqrt(V1);##horizontal velocity in m/s\n", + "t=l/v;##in s\n", + "print'%s %.3e %s'%('transit time through electric field is:',t,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "angle of deflection of electron beam is: 1.9 \n", + "transit time through electric field is: 1.508e-09 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 4.3\n", + "##electron projected at an angle into a uniform electric field\n", + "##given values\n", + "v1=4.5*10**5;##initial speed in m/s\n", + "alpha=37*math.pi/180.;##angle of projection in degrees\n", + "E=200.;##electric field intensity in N/C\n", + "e=1.6*10**-19;##in C\n", + "m=9.1*10**-31;##in kg\n", + "a=e*E/m;##acceleration in m/s**2\n", + "t=2*v1*math.sin(alpha)/a;##time in s\n", + "print'%s %.2e %s'%('time taken by electron to return to its initial level is:',t,'')\n", + "H=(v1**2.*math.sin(alpha)*math.sin(alpha))/(2.*a);##height in m\n", + "print'%s %.4f %s'%('maximum height reached by electron is:',H,'')\n", + "s=(v1**2.)*(2.*math.sin(alpha)*math.cos(alpha))/(2.*a);##print'%s %.1f %s'%lacement in m\n", + "print'%s %.4f %s'%('horizontal displacement(in m)when it reaches maximum height is:',s,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "time taken by electron to return to its initial level is: 1.54e-08 \n", + "maximum height reached by electron is: 0.0010 \n", + "horizontal displacement(in m)when it reaches maximum height is: 0.0028 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 4.4\n", + "##motion of an electron in a uniform magnetic field\n", + "##given values\n", + "V=200.;##potential difference through which electron is accelerated in volts\n", + "B=0.01;##magnetic field in wb/m**2\n", + "e=1.6*10**-19;##in C\n", + "m=9.1*10**-31;##in kg\n", + "v=math.sqrt(2.*e*V/m);##electron velocity in m/s\n", + "print'%s %.1f %s'%('electron velocity is:',v,'')\n", + "r=m*v/(e*B);##in m\n", + "print'%s %.4f %s'%('radius of path (in m)is:',r,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "electron velocity is: 8386278.7 \n", + "radius of path (in m)is: 0.0048 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 4.5\n", + "##motion of an electron in a uniform magnetic field acting at an angle\n", + "##given values\n", + "v=3*10**7;##electron speed\n", + "B=.23;##magnetic field in wb/m**2\n", + "q=45*math.pi/180;##in degrees,angle in which electron enter field\n", + "e=1.6*10**-19;##in C\n", + "m=9.1*10**-31;##in kg\n", + "R=m*v*math.sin(q)/(e*B);##in m\n", + "print'%s %.5f %s'%('radius of helical path is:',R,'')\n", + "p=2*math.pi*m*v*math.cos(q)/(e*B);##in m\n", + "print'%s %.4f %s'%('pitch of helical path(in m) is:',p,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "radius of helical path is: 0.00052 \n", + "pitch of helical path(in m) is: 0.0033 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 4.6\n", + "##Magnetostatic deflection\n", + "##given values\n", + "D=.03;##deflection in m\n", + "m=9.1*10**-31;##in kg\n", + "e=1.6*10**-19;##in C\n", + "L=.15;##distance between CRT and anode in m\n", + "l=L/2.;\n", + "V=2000.;##in voltsin wb/\n", + "B=D*math.sqrt(2.*m*V)/(L*l*math.sqrt(e));##in wb/m**2\n", + "print'%s %.4f %s'%('transverse magnetic field acting (in wb/m^2)is:',B,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "transverse magnetic field acting (in wb/m^2)is: 0.0004 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 4.7\n", + "##electric and magnetic fields in crossed configuration\n", + "##given values\n", + "B=2*10**-3;##magnetic field in wb/m**2\n", + "E=3.4*10**4;##electric field in V/m\n", + "m=9.1*10**-31;##in kg\n", + "e=1.6*10**-19;##in C\n", + "v=E/B;##in m/s\n", + "print'%s %.1f %s'%('electron speed is:',v,'')\n", + "R=m*v/(e*B);##in m\n", + "print'%s %.3f %s'%('radius of circular path (in m) when electric field is switched off',R,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "electron speed is: 17000000.0 \n", + "radius of circular path (in m) when electric field is switched off 0.048 \n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter5.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter5.ipynb new file mode 100755 index 00000000..f25c1843 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter5.ipynb @@ -0,0 +1,147 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b45bed0bf651f557c40cec41e1736def1e279410a176004acdb12e68c84f8fd8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Chapter5Electron Oprtics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 5.1\n", + "##Electron refraction, calculation of potential difference\n", + "\n", + "##given values\n", + "V1=250.;##potential by which electrons are accelerated in Volts\n", + "alpha1=50*math.pi/180.;##in degree\n", + "alpha2=30*math.pi/180.;##in degree\n", + "b=math.sin(alpha1)/math.sin(alpha2);\n", + "##calculation\n", + "V2=(b**2.)*V1;\n", + "a=V2-V1;\n", + "print'%s %.1f %s'%('potential difference(in volts) is:',a,'');\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "potential difference(in volts) is: 336.8 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2 $3-pg94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "##Example 5.2&5.3\n", + "import math\n", + "##Cyclotron, calculation of magnetic induction,maximum energy\n", + "##given values\n", + "f=12*(10**6);##oscillator frequency in Hertz\n", + "r=.53;##radius of the dee in metre\n", + "q=1.6*10**-19;##Deuteron charge in C\n", + "m=3.34*10**-27;##mass of deuteron in kg\n", + "##calculation\n", + "B=2*math.pi*f*m/q;##\n", + "print'%s %.1f %s'%('magnetic induction (in Tesla) is:',B,'');\n", + "E=B**2*q**2.*r**2./(2.*m);\n", + "print'%s %.3e %s'%('maximum energy to which deuterons can be accelerated (in J) is',E,'')\n", + "E1=E*6.24*10**18/10**6;##conversion of energy into MeV\n", + "print'%s %.1f %s'%('maximum energy to which deuterons can be accelerated (in MeV) is',E1,'');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnetic induction (in Tesla) is: 1.6 \n", + "maximum energy to which deuterons can be accelerated (in J) is 2.667e-12 \n", + "maximum energy to which deuterons can be accelerated (in MeV) is 16.6 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 5.4\n", + "##Mass spectrograph, calculation of linear separation of lines formed on photographic plates\n", + "\n", + "##given values;\n", + "E=8.*10**4;##electric field in V/m\n", + "B=.55##magnetic induction in Wb/m*2\n", + "q=1.6*10**-19;##charge of ions\n", + "m1=20.*1.67*10**-27;##atomic mass of an isotope of neon\n", + "m2=22.*1.67*10**-27;##atomic mass of other isotope of neon\n", + "##calculation\n", + "x=2*E*(m2-m1)/(q*B**2);##\n", + "print'%s %.3f %s'%('separation of lines (in metre) is:',x,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "separation of lines (in metre) is: 0.011 \n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter5_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter5_1.ipynb new file mode 100755 index 00000000..f4389219 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter5_1.ipynb @@ -0,0 +1,185 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:550f2c4f76d815d509a9a81031b8891ad0f830da6727cb50a9ec9ad3c5c39d1e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter5 Electron Oprtics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 5.1\n", + "##Electron refraction, calculation of potential difference\n", + "\n", + "##given values\n", + "V1=250.;##potential by which electrons are accelerated in Volts\n", + "alpha1=50*math.pi/180.;##in degree\n", + "alpha2=30*math.pi/180.;##in degree\n", + "b=math.sin(alpha1)/math.sin(alpha2);\n", + "##calculation\n", + "V2=(b**2.)*V1;\n", + "a=V2-V1;\n", + "print'%s %.1f %s'%('potential difference(in volts) is:',a,'');\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "potential difference(in volts) is: 336.8 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2 -pg94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "##Example 5.2&5.3\n", + "import math\n", + "##Cyclotron, calculation of magnetic induction,maximum energy\n", + "##given values\n", + "f=12*(10**6);##oscillator frequency in Hertz\n", + "r=.53;##radius of the dee in metre\n", + "q=1.6*10**-19;##Deuteron charge in C\n", + "m=3.34*10**-27;##mass of deuteron in kg\n", + "##calculation\n", + "B=2*math.pi*f*m/q;##\n", + "print'%s %.2f %s'%('magnetic induction (in Tesla) is:',B,'');\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnetic induction (in Tesla) is: 1.57 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Cyclotron, calculation of magnetic induction,maximum energy\n", + "##given values\n", + "f=12.*(10**6);##oscillator frequency in Hertz\n", + "r=.53;##radius of the dee in metre\n", + "q=1.6*10**-19;##Deuteron charge in C\n", + "m=3.34*10**-27;##mass of deuteron in kg\n", + "##calculation\n", + "B=2*math.pi*f*m/q;##\n", + "\n", + "E=B**2*q**2.*r**2./(2.*m);\n", + "print'%s %.2e %s'%('maximum energy to which deuterons can be accelerated (in J) is',E,'')\n", + "E1=E*6.24*10**18/10**6.;##conversion of energy into MeV\n", + "print'%s %.1f %s'%('maximum energy to which deuterons can be accelerated (in MeV) is',E1,'');\n", + "print('in text book ans is given wrong')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum energy to which deuterons can be accelerated (in J) is 2.67e-12 \n", + "maximum energy to which deuterons can be accelerated (in MeV) is 16.6 \n", + "in text book ans is given wrong\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 5.4\n", + "##Mass spectrograph, calculation of linear separation of lines formed on photographic plates\n", + "\n", + "##given values;\n", + "E=8.*10**4;##electric field in V/m\n", + "B=.55##magnetic induction in Wb/m*2\n", + "q=1.6*10**-19;##charge of ions\n", + "m1=20.*1.67*10**-27;##atomic mass of an isotope of neon\n", + "m2=22.*1.67*10**-27;##atomic mass of other isotope of neon\n", + "##calculation\n", + "x=2*E*(m2-m1)/(q*B**2);##\n", + "print'%s %.3f %s'%('separation of lines (in metre) is:',x,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "separation of lines (in metre) is: 0.011 \n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter6.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter6.ipynb new file mode 100755 index 00000000..5992fd39 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter6.ipynb @@ -0,0 +1,95 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2c7fa5f48e2180e437af8892520159f12789c250e22a9e424719ad83f83b7fff" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter6-Properties of Light" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "##Example 6.1\n", + "##Optical path calculation \n", + "\n", + "##given values\n", + "n=1.33;##refractive index of medium\n", + "x=.75;##geometrical path in micrometre\n", + " ##calculation\n", + "y=x*n;##\n", + "print'%s %.3f %s'%('optical path (in micrometre) is:',y,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "optical path (in micrometre) is: 0.998 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "##Example 6.2\n", + "##Coherence length calculation \n", + "\n", + "##given values\n", + "l=1*10**-14.;##line width in metre\n", + "x=10.6*10**-6.;##IR emission wavelength in metre\n", + " ##calculation\n", + "y=x**2./l;##\n", + "print'%s %.1f %s'%('coherence length(in metre) is:',y,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "coherence length(in metre) is: 11236.0 \n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter6_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter6_1.ipynb new file mode 100755 index 00000000..5992fd39 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter6_1.ipynb @@ -0,0 +1,95 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2c7fa5f48e2180e437af8892520159f12789c250e22a9e424719ad83f83b7fff" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter6-Properties of Light" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "##Example 6.1\n", + "##Optical path calculation \n", + "\n", + "##given values\n", + "n=1.33;##refractive index of medium\n", + "x=.75;##geometrical path in micrometre\n", + " ##calculation\n", + "y=x*n;##\n", + "print'%s %.3f %s'%('optical path (in micrometre) is:',y,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "optical path (in micrometre) is: 0.998 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "##Example 6.2\n", + "##Coherence length calculation \n", + "\n", + "##given values\n", + "l=1*10**-14.;##line width in metre\n", + "x=10.6*10**-6.;##IR emission wavelength in metre\n", + " ##calculation\n", + "y=x**2./l;##\n", + "print'%s %.1f %s'%('coherence length(in metre) is:',y,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "coherence length(in metre) is: 11236.0 \n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter7.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter7.ipynb new file mode 100755 index 00000000..1db562d5 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter7.ipynb @@ -0,0 +1,175 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:dc1d02c818142fc43f1bb36bcc3b4789ed6aba6b82727804f7035772e1b68c40" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter7-Interface and Diffraction" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 7.1\n", + "##plane parallel thin film\n", + "\n", + "##given values\n", + "x=5890*10**-10;##wavelength of light in metre\n", + "n=1.5;##refractive index\n", + "r=60*math.pi/180.;##angle of refraction in degree\n", + " ##calculation\n", + "t=x/(2*n*math.cos(r));\n", + "print'%s %.2f %s'%('thickness of plate (in micrometre) is:',t*10**6,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "thickness of plate (in micrometre) is: 0.39 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg151" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 7.2\n", + "##wedge shaped thin film\n", + "\n", + "##given values\n", + "x=5893*10**-10.;##wavelength of light in metre\n", + "n=1.5;##refractive index\n", + "y=.1*10**-3.;##fringe spacing\n", + " ##calculation\n", + "z=x/(2.*n*y);##angle of wedge\n", + "alpha=z*180./math.pi;##conversion of radian into degree\n", + "print'%s %.2f %s'%('angle of wedge (in degree) is:',alpha,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "angle of wedge (in degree) is: 0.11 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg156" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 7.3\n", + "##Newton's ring experiment- calculation of refractive index\n", + "\n", + "##given values\n", + "D1=1.5;##diametre (in cm)of tenth dark ring in air\n", + "D2=1.27;##diametre (in cm)of tenth dark ring in liquid\n", + "\n", + "\n", + " ##calculation\n", + "n=D1**2./D2**2.;\n", + "print'%s %.2f %s'%('refractive index of liquid is',n,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "refractive index of liquid is 1.40 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-160" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 7.4\n", + "##nonreflecting film\n", + "\n", + "##given values\n", + "l=5500*10**-10.;##wavelength of light\n", + "n1=1.33;##refractive index of water\n", + "n2=1.52;##refractive index of glass window pane\n", + "x=math.sqrt(n1);##to check if it is nonreflecting\n", + "\n", + " ##calculation\n", + "t=l/(4.*n1);##thickness of water film required\n", + "print'%s %.2f %s'%('minimum thickness of film (in metre) is',t*10**6,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "minimum thickness of film (in metre) is 0.10 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter7_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter7_1.ipynb new file mode 100755 index 00000000..1db562d5 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter7_1.ipynb @@ -0,0 +1,175 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:dc1d02c818142fc43f1bb36bcc3b4789ed6aba6b82727804f7035772e1b68c40" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter7-Interface and Diffraction" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 7.1\n", + "##plane parallel thin film\n", + "\n", + "##given values\n", + "x=5890*10**-10;##wavelength of light in metre\n", + "n=1.5;##refractive index\n", + "r=60*math.pi/180.;##angle of refraction in degree\n", + " ##calculation\n", + "t=x/(2*n*math.cos(r));\n", + "print'%s %.2f %s'%('thickness of plate (in micrometre) is:',t*10**6,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "thickness of plate (in micrometre) is: 0.39 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg151" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 7.2\n", + "##wedge shaped thin film\n", + "\n", + "##given values\n", + "x=5893*10**-10.;##wavelength of light in metre\n", + "n=1.5;##refractive index\n", + "y=.1*10**-3.;##fringe spacing\n", + " ##calculation\n", + "z=x/(2.*n*y);##angle of wedge\n", + "alpha=z*180./math.pi;##conversion of radian into degree\n", + "print'%s %.2f %s'%('angle of wedge (in degree) is:',alpha,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "angle of wedge (in degree) is: 0.11 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg156" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 7.3\n", + "##Newton's ring experiment- calculation of refractive index\n", + "\n", + "##given values\n", + "D1=1.5;##diametre (in cm)of tenth dark ring in air\n", + "D2=1.27;##diametre (in cm)of tenth dark ring in liquid\n", + "\n", + "\n", + " ##calculation\n", + "n=D1**2./D2**2.;\n", + "print'%s %.2f %s'%('refractive index of liquid is',n,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "refractive index of liquid is 1.40 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-160" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 7.4\n", + "##nonreflecting film\n", + "\n", + "##given values\n", + "l=5500*10**-10.;##wavelength of light\n", + "n1=1.33;##refractive index of water\n", + "n2=1.52;##refractive index of glass window pane\n", + "x=math.sqrt(n1);##to check if it is nonreflecting\n", + "\n", + " ##calculation\n", + "t=l/(4.*n1);##thickness of water film required\n", + "print'%s %.2f %s'%('minimum thickness of film (in metre) is',t*10**6,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "minimum thickness of film (in metre) is 0.10 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter8.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter8.ipynb new file mode 100755 index 00000000..ff6879b2 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter8.ipynb @@ -0,0 +1,102 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:960fd108c21eb5121a849117765bbc8e0d88eb94076f3988470cabfdb760bcc0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter8-Polarization" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 8.2\n", + "##Polarizer,calculation of angle\n", + "\n", + "##given values\n", + "Io=1.;##intensity of polarised light\n", + "I1=Io/2.;##intensity of beam polarised by first by first polariser\n", + "I2=Io/3.;##intensity of light polarised by second polariser\n", + "\n", + "\n", + " ##calculation\n", + "a=math.acos(math.sqrt(I2/I1));\n", + "alpha=a*180./math.pi;##conversion of angle into degree\n", + "print'%s %.1f %s'%('angle between characteristic directions (in degree) is',alpha,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "angle between characteristic directions (in degree) is 35.3 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg209" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 8.3\n", + "##calculation of birefringence\n", + "\n", + "##given values\n", + "\n", + "l=6*10**-7.;##wavelength of light in metre\n", + "d=3*10**-5.;##thickness of crystal\n", + "\n", + "\n", + " ##calculation\n", + "x=l/(4.*d);\n", + "print'%s %.3f %s'%('the birefringance of the crystal is',x,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the birefringance of the crystal is 0.005 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/Chapter8_1.ipynb b/A_Textbook_Of_Engineering_Physics/Chapter8_1.ipynb new file mode 100755 index 00000000..ff6879b2 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/Chapter8_1.ipynb @@ -0,0 +1,102 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:960fd108c21eb5121a849117765bbc8e0d88eb94076f3988470cabfdb760bcc0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter8-Polarization" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 8.2\n", + "##Polarizer,calculation of angle\n", + "\n", + "##given values\n", + "Io=1.;##intensity of polarised light\n", + "I1=Io/2.;##intensity of beam polarised by first by first polariser\n", + "I2=Io/3.;##intensity of light polarised by second polariser\n", + "\n", + "\n", + " ##calculation\n", + "a=math.acos(math.sqrt(I2/I1));\n", + "alpha=a*180./math.pi;##conversion of angle into degree\n", + "print'%s %.1f %s'%('angle between characteristic directions (in degree) is',alpha,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "angle between characteristic directions (in degree) is 35.3 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg209" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##Example 8.3\n", + "##calculation of birefringence\n", + "\n", + "##given values\n", + "\n", + "l=6*10**-7.;##wavelength of light in metre\n", + "d=3*10**-5.;##thickness of crystal\n", + "\n", + "\n", + " ##calculation\n", + "x=l/(4.*d);\n", + "print'%s %.3f %s'%('the birefringance of the crystal is',x,'');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the birefringance of the crystal is 0.005 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/README.txt b/A_Textbook_Of_Engineering_Physics/README.txt new file mode 100755 index 00000000..e156a531 --- /dev/null +++ b/A_Textbook_Of_Engineering_Physics/README.txt @@ -0,0 +1,10 @@ +Contributed By: kartik sankhla +Course: btech +College/Institute/Organization: iitbombay +Department/Designation: aerospace engnieering +Book Title: A Textbook Of Engineering Physics +Author: M. N. Avadhanulu, And P. G. Kshirsagar +Publisher: S. Chand And Company, New Delhi +Year of publication: 2011 +Isbn: 81-219-0817-5 +Edition: 9 \ No newline at end of file diff --git a/A_Textbook_Of_Engineering_Physics/screenshots/Chapter11.png b/A_Textbook_Of_Engineering_Physics/screenshots/Chapter11.png new file mode 100755 index 00000000..d60291ea Binary files /dev/null and b/A_Textbook_Of_Engineering_Physics/screenshots/Chapter11.png differ diff --git a/A_Textbook_Of_Engineering_Physics/screenshots/Chapter11_1.png b/A_Textbook_Of_Engineering_Physics/screenshots/Chapter11_1.png new file mode 100755 index 00000000..50e4571c Binary files /dev/null and b/A_Textbook_Of_Engineering_Physics/screenshots/Chapter11_1.png differ diff --git a/A_Textbook_Of_Engineering_Physics/screenshots/Chapter12.png b/A_Textbook_Of_Engineering_Physics/screenshots/Chapter12.png new file mode 100755 index 00000000..e6fcb374 Binary files /dev/null and b/A_Textbook_Of_Engineering_Physics/screenshots/Chapter12.png differ diff --git a/A_Textbook_Of_Engineering_Physics/screenshots/Chapter12_1.png b/A_Textbook_Of_Engineering_Physics/screenshots/Chapter12_1.png new file mode 100755 index 00000000..bab9d24a Binary files /dev/null and b/A_Textbook_Of_Engineering_Physics/screenshots/Chapter12_1.png differ diff --git a/A_Textbook_Of_Engineering_Physics/screenshots/Chapter13.png b/A_Textbook_Of_Engineering_Physics/screenshots/Chapter13.png new file mode 100755 index 00000000..2560bf69 Binary files /dev/null and b/A_Textbook_Of_Engineering_Physics/screenshots/Chapter13.png differ diff --git a/A_Textbook_Of_Engineering_Physics/screenshots/Chapter13_1.png b/A_Textbook_Of_Engineering_Physics/screenshots/Chapter13_1.png new file mode 100755 index 00000000..e45c80b4 Binary files /dev/null and b/A_Textbook_Of_Engineering_Physics/screenshots/Chapter13_1.png differ diff --git a/About_Mumbai_by_sd/hemla.ipynb b/About_Mumbai_by_sd/hemla.ipynb deleted file mode 100644 index 5cea9cb6..00000000 --- a/About_Mumbai_by_sd/hemla.ipynb +++ /dev/null @@ -1,778 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:9826abe74c775578903ec0e922c705aacf445defe2dc3badb10ce4727f434663" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter2-Compressible Flow with Friction and Heat: A Review" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg19" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#what is the gas constant of air and density of air\n", - "import math\n", - "#intilization variable\n", - "p=3*10**6 ; #pressure in Pa\n", - "t=298. ; #temperatue in kelvin\n", - "mw= 29.; #molecular weight in kg/mol\n", - "ru=8314.; #universal constant in J/kmol.K\n", - "r=ru/mw ;\n", - "#using perfect gas law to get density:\n", - "rho=p/(r*t) ;\n", - "print'%s %.2f %s'%('Gas constant of air in',r,'J/kg.K')\n", - "print'%s %.1f %s'%('Density of air in',rho,'kg/m^3')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Gas constant of air in 286.69 J/kg.K\n", - "Density of air in 35.1 kg/m^3\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#find out the exit temperature and exit density by various methods \n", - "import math\n", - "t1=288.; #inlet temperture in Kelvin\n", - "p1=100*10**3; #inlet pressure in Pa\n", - "p2=1*10**6 #exit pressure in Pa\n", - "gma=1.4; #gamma.\n", - "rg=287.; #gas constant in J/kg.K\n", - "t2=t1*(p2/p1)**((gma-1)/gma); #exit temperature \n", - "print'%s %.5f %s'%('Exit temperature in',t2,'K')\n", - "#first method to find exit density:\n", - "#application of perfect gas law at exit\n", - "rho=p2/(rg*t2); #rho= exit density.\n", - "print'%s %.7f %s'%('exit density at by method 1 in',rho,'kg/m^3')\n", - "#method 2: using isentropic relation between inlet and exit density.\n", - "rho1=p1/(rg*t1); #inlet density.\n", - "rho=rho1*(p2/p1)**(1/gma);\n", - "print'%s %.2f %s'%('exit density by method 2 in',rho,'kg/m^3')\n", - "\n", - " " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Exit temperature in 556.04095 K\n", - "exit density at by method 1 in 6.2663021 kg/m^3\n", - "exit density by method 2 in 6.27 kg/m^3\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#what is the rate of mass flow through exit \n", - "import math\n", - "d1=1.2 #inlet 1 density in kg/m^3.\n", - "u1=25. # inlet 1 veocity in m/s.\n", - "a1=0.25 #inlet 1 area in m^2.\n", - "d2=0.2 #inlet 2 density in kg/m^3.\n", - "u2=225. #inlet 2 velocity in m/s.\n", - "a2=0.10 #inlet 2 area in m^2.\n", - "m1=d1*a1*u1; #rate of mass flow entering inlet 1.\n", - "m2=d2*u2*a2; #rate of mass flow entering inlet 2.\n", - "#since total mass in=total mass out,\n", - "m3=m1+m2; #m3=rate of mass flow through exit.\n", - "print'%s %.f %s'%('Rate of mass flow through exit in',m3,' kg/s')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rate of mass flow through exit in 12 kg/s\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg27" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#what is the axial force needed to support the plate and lateral force needed to support the plate\n", - "import math\n", - "u1=2 #speed of water going on the plate. X-component in m/s.\n", - "v1=0 #speed of water going on the plate. Y-component in m/s.\n", - "u2=1 #speed of water going on the plate. X-component in m/s.\n", - "v2=1.73 #speed of water going on the plate Y-coponent in m/s.\n", - "m=0.1 #rate of flow of mass of the water on the plate in kg/s.\n", - "#Using Newton's second law.\n", - "Fx=m*(u2-u1); #X-component of force exerted by water\n", - "print'%s %.1f %s'%('Axial force needed to support the plate in',Fx,'N')\n", - "Fy=m*(v2-v1); #Y-component of force exerted by water.\n", - "print'%s %.3f %s'%('Lateral force needed to support the plate in',Fy,'N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Axial force needed to support the plate in -0.1 N\n", - "Lateral force needed to support the plate in 0.173 N\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg29" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#calculate the Exit total and static temperature \n", - "m=50 #mass flow rate in kg/s.\n", - "T1=298 #inlet temperature in K.\n", - "u1=150 #inlet velocity in m/s.\n", - "cp1=1004 #specific heat at constant pressure of inlet in J/kg.K.\n", - "gm=1.4 #gamma.\n", - "u2=400 # exit velocity in m/s.\n", - "cp2=1243. #specific heat at constant pressure of exit in J/kg.K.\n", - "q=42*10**6 #heat transfer rate in control volume in Watt.\n", - "me=-100*10**3 #mechanical power in Watt.\n", - "#first calculate total enthalpy at the inlet:\n", - "ht1=cp1*T1+(u1**2)/2; #ht1=Total inlet enthalpy.\n", - "#now applying conservation of energy equation:\n", - "ht2=ht1+((q-me)/m) #ht2=Total enthalpy at exit.\n", - "Tt2=ht2/cp2; #Tt2=Total exit temperature.\n", - "T2=Tt2-((u2**2)/(2*cp2)); #T2=static exit temperature.\n", - "print'%s %.5f %s'%('Exit total temperature in',Tt2,'K')\n", - "print'%s %.4f %s'%('Exit static temperature in',T2,'K')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Exit total temperature in 927.14562 K\n", - "Exit static temperature in 862.7852 K\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg65" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#intilization variable\n", - "import math\n", - "d=0.2 #Diameter in meters.\n", - "M1=0.2 #inlet Mach no.\n", - "p1=100*10**3 #inlet pressure in Pa\n", - "Tt1=288. #total inlet temperature in K\n", - "q=100*10**3 #rate of heat transfer to fluid in Watt.\n", - "rg=287. #Gas constant in J/kg.K.\n", - "gm=1.4 #gamma\n", - "#(a)inlet mass flow:\n", - "m=((gm/rg)**(1./2.))*(p1/(Tt1)**(1./2.))*3.14*(d*d)/4.*(M1/(1.+((gm-1.)/2.)*(M1**2.))**((gm+1.)/(2.*(gm-1.))));\n", - "\n", - "#(b)\n", - "qm=q/m; #Heat per unit mass.\n", - "#Tt1/Tcr=0.1736, pt1/Pcr=1.2346, ((Delta(s)/R)1=6.3402,p1/Pcr=2.2727)\n", - "Tcr=Tt1/0.1736;\n", - "\n", - "Pcr=p1/2.2727;\n", - "#From energy equation:\n", - "cp=(gm/(gm-1.))*rg;\n", - "Tt2=Tt1+(q/cp);\n", - "q1cr=cp*(Tcr-Tt1)/1000.;\n", - "M2=0.22;\n", - "#From table : pt2/Pcr=1.2281, (Delta(s)/R)2=5.7395, p2/Pcr=2.2477.\n", - "#The percent total pressure drop is (((pt1/Pcr)-(pt2/Pcr))/(pt1/Pcr))*100.\n", - "p2=2.2477*Pcr;\n", - "dp=((1.2346-1.2281)/1.2346)*100;\n", - "#Entropy rise is the difference between (delta(s)/R)1 and (delta(s)/R)2.\n", - "ds=6.3402-5.7395;\n", - "#Static pressure drop in duct due to heat transfer is\n", - "dps=((p1/Pcr)-(p2/Pcr))*Pcr/1000.;\n", - "print'%s %.7f %s'%('Mass flow rate through duct in',m,'kg/s')\n", - "print'%s %.4f %s'%('Critical heat flux that would choke the duct for the M1 in',q1cr,'kJ/kg')\n", - "print'%s %.2f %s'%('The exit Mach No.',M2,'')\n", - "print'%s %.7f %s'%('The percent total pressure loss',dp,'%')\n", - "print'%s %.4f %s'%('The entropy rise',ds,'')\n", - "print'%s %.7f %s'%('The static pressure drop in ',dps,'kPa')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass flow rate through duct in 2.5235091 kg/s\n", - "Critical heat flux that would choke the duct for the M1 in 1377.1556 kJ/kg\n", - "The exit Mach No. 0.22 \n", - "The percent total pressure loss 0.5264863 %\n", - "The entropy rise 0.6007 \n", - "The static pressure drop in 1.1000132 kPa\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg67" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#what is total exit temperautre if exit is choked and maximum heat released and fule to air ratio to thermally choke the combustor exit and total pressure loss\n", - "#intilization variable\n", - "import math\n", - "M1=3.0 ##Mach no. at inlet\n", - "pt1=45*10**3 ##Total pressure t inlet in Pa\n", - "Tt1=1800 ##Total temperature at inlet in K\n", - "hv=12000 ##Lower heating value of hydrogen kJ/kg\n", - "gm=1.3 ##gamma\n", - "R=0.287 ##in kJ/kg.K\n", - "##Using RAYLEIGH table for M1=3.0 and gamma=1.3, we get Tt1/Tcr=0.6032, pt1/Pcr=4.0073.\n", - "Tcr=Tt1/0.6032\n", - "Pcr=pt1/4.0073\n", - "##if exit is choked, Tt2=Tcr\n", - "Tt2=Tt1/0.6032;\n", - "cp=gm*R/(gm-1);\n", - "##Energy balance across burner:\n", - "Q1cr=cp*(Tcr-Tt1);\n", - "f=(Q1cr/120000);\n", - "##total pressure loss:\n", - "dpt=1-Pcr/pt1;\n", - "print'%s %.4f %s'%('Total exit temperature if exit is choked in',Tt2,'K')\n", - "print'%s %.4f %s'%('Maximum heat released per unit mass of air in',Q1cr, 'kJ/kg')\n", - "print'%s %.7f %s'%('fuel-to-air ratio to thermally choke the combustor exit',f,'')\n", - "print'%s %.7f %s'%('Total pressure loss (in fraction)',dpt,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total exit temperature if exit is choked in 2984.0849 K\n", - "Maximum heat released per unit mass of air in 1472.6069 kJ/kg\n", - "fuel-to-air ratio to thermally choke the combustor exit 0.0122717 \n", - "Total pressure loss (in fraction) 0.7504554 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg67" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#calculate the new inlet mach no and spilled flow at the inlet\n", - "#initilization variable \n", - "import math\n", - "Tt1=50.+460. ##Converting the inlet temp. to the absolute scale i.e. in degree R\n", - "M1=0.5 ##Initial inlet Mach no.\n", - "pt1=14.7 ##Units in psia\n", - "gm=1.4 ##gamma\n", - "R=53.34 ##units in ft.lbf/lbm.degree R\n", - "Tcr=Tt1/0.69136 \n", - "cp=gm*R/(gm-1)\n", - "##using energy equation:\n", - "Q1cr=cp*(Tcr-Tt1)\n", - "##since heat flux is 1.2(Q1cr).\n", - "q=1.2*Q1cr\n", - "Tt1cr1=Tt1+(Q1cr/cp) ##new exit total temp.\n", - "z=Tt1/Tt1cr1\n", - "M2=0.473\n", - "\n", - "f=M1/(1+((gm-1)/2)*M1**2)**((gm+1)/(2*(gm-1)))\n", - "\n", - "sm=((f*(M1)-f*(M2))/f*(M1))*100. ##sm=The % spilled flow at the inlet\n", - "print'%s %.5f %s'%('The new inlet Mach no.',M2,'')\n", - "print'%s %.5f %s'%('The % spilled flow at the inlet',sm,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The new inlet Mach no. 0.47300 \n", - "The % spilled flow at the inlet 1.35000 \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg76" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#intilization variable\n", - "#calculate choking length abd exit mach no and total pressure loss and the static pressure and impulse due to friction \n", - "import math\n", - "d=0.2 ##diameter in meters.\n", - "l=0.2 ##length in meters.\n", - "Cf=0.005 ##average wall friction coefficient.\n", - "M1=0.24 ##inlet mach no.\n", - "gm=1.4 ##gamma.\n", - "##From FANNO tbale\n", - "L1cr=(9.3866*d/2)/(4*Cf);\n", - "L2cr=L1cr-l;\n", - "##from FANNO table\n", - "M2=0.3;\n", - "x=2.4956;\n", - "y=2.0351;\n", - "a=4.5383;\n", - "b=3.6191;\n", - "i1=2.043;\n", - "i2=1.698;\n", - "##% total pressure drop due to friction:\n", - "dpt=(x-y)/(x)*100;\n", - "##static pressur drop:\n", - "dps=(a-b)/a*100;\n", - "##Loss pf fluid:\n", - "lf=(i2-i1);\n", - "print'%s %.3f %s'%('The choking length of duct in',L1cr,'m')\n", - "print'%s %.1f %s'%('The exit Mach no.',M2,'')\n", - "print'%s %.6f %s'%('% total pressure loss',dpt,'')\n", - "print'%s %.5f %s'%('The static pressure drop in',dps,'%')\n", - "print'%s %.3f %s'%('Loss of impulse due to friction(I* times)',lf,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The choking length of duct in 46.933 m\n", - "The exit Mach no. 0.3 \n", - "% total pressure loss 18.452476 \n", - "The static pressure drop in 20.25428 %\n", - "Loss of impulse due to friction(I* times) -0.345 \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg77" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#initilization variable\n", - "import math \n", - "#caluclate maximum length of the duct that will support given in inlet condition and the new inlet condition and flow drop \n", - "M1=0.5\n", - "a=2. ## area of cross section units in cm^2\n", - "Cf=0.005 ##coefficient of skin friction\n", - "gm=1.4 ##gamma\n", - "##Calculations\n", - "c=2.*(2.+1.); ##Parameter of surface.\n", - "##From FANNO table: 4*Cf*L1cr/Dh=1.0691;\n", - "Dh=4.*a/c; ##Hydrolic diameter.\n", - "L1cr=1.069*Dh/(4.*Cf);\n", - "##maximum length will be L1cr.\n", - "##For new length(i.e. 2.16*L1cr), Mach no. M2 from FANNO table, M2=0.4;.\n", - "M2=0.4;\n", - "##the inlet total pressue and temp remains the same, therefore the mass flow rate in the duct is proportional to f(M):\n", - "\n", - "f=0.5/(1.+((gm-1.)/2.)*0.5**2.)**((gm+1.)/(2.*(gm-1.)))\n", - "#endfunction\n", - "dm=(f*(M1)-f*(M2))/f*(M1)*100.+10;\n", - "print'%s %.3f %s'%(\"(a)Maximum length of duct that will support given inlet condition(in cm):\",L1cr,\"\")\n", - "print'%s %.3f %s'%(\"(b)The new inlet condition mach no. M2:\",M2,\"\")\n", - "print'%s %.3f %s'%(\"(c)% inlet mass flow drop due to the longer length of the duct:\",dm,\"\")\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(a)Maximum length of duct that will support given inlet condition(in cm): 71.267 \n", - "(b)The new inlet condition mach no. M2: 0.400 \n", - "(c)% inlet mass flow drop due to the longer length of the duct: 15.000 \n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg78" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import numpy\n", - "M1=0.7;\n", - "dpt=0.99; ##pt2/pt1=dpt.\n", - "gm=1.4; ##gamma\n", - "A2=1.237 \n", - "a=1/1.237;\n", - "import warnings\n", - "warnings.filterwarnings('ignore')\n", - "##Calculations:\n", - "\n", - "k=(1./dpt)*(a)*(M1/(1.+(0.2*(M1)**2.))**3.);\n", - "po=([k*0.008,0,k*.12,0,k*.6,-1,k])\n", - "W=numpy.roots(po)\n", - "i=0;\n", - "s=1;\n", - "M2=W[4]\n", - "print -M2,\"(a)The exit Mach no. M2:\"\n", - "\n", - "\n", - "##p=p2/p1 i.e. static pressure ratio\n", - "p=dpt*((1.+(gm-1.)*(M1)**2./2.)/(1.+(gm-1.)*(M2)**2./2.))**(gm/(gm-1.))\n", - "##disp(p)\n", - "Cpr=(2./(gm*(M1)**2.))*(p-1.) ##Cpr is static pressure recovery : (p2-p1)/q1.\n", - "print\"%s %.2f %s\"%(\"(b)The static pressure recovery in the diffuser:\",-Cpr,\"\")\n", - "##Change in fluid impulse:\n", - "##Fxwalls=I2-I1=A1p1(1+gm*M1**2)-A2p2(1+gm*M2**2)\n", - "##Let, u=Fxwall/(p1*A1)\n", - "u=1.+gm*(M1)**2.-(1.237)*(p)*(1.+(gm*(M2)**2.))\n", - "print\"%s %.2f %s\"%(\"(c)The force acting on the diffuser inner wall nondimensionalized by inlet static pressure and area:\",-u,\"\")\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(-1.70274823568-0j) (a)The exit Mach no. M2:\n", - "(b)The static pressure recovery in the diffuser: 2.11 \n", - "(c)The force acting on the diffuser inner wall nondimensionalized by inlet static pressure and area: 0.05 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg85" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"Example2.13\"\n", - "import numpy\n", - "M1=0.5 #inlet mach no.\n", - "p=10. #(p=pt1/p0) whaere pt1 is inlet total pressure and p0 is ambient pressure.\n", - "dpc=0.01 #dpc=(pt1-Pth)/pt1 i.e. total pressure loss in convergant section\n", - "f=0.99 #f=Pth/pt1\n", - "dpd=0.02 #dpd=(Pth-pt2)/Pth i.e. total pressure loss in the divergent section\n", - "j=1/0.98 #j=Pth/pt2\n", - "A=2. #a=A2/Ath. nozzle area expansion ratio.\n", - "gm=1.4 # gamma\n", - "R=287. #J/kg.K universal gas constant.\n", - "#Calculations:\n", - "#\"th\"\" subscript denotes throat.\n", - "Mth=1. #mach no at thorat is always 1.\n", - "\n", - "k=(j)*(1./A)*(Mth/(1+(0.2*(Mth)**2))**3)\n", - "po=([k*0.008,0,k*.12,0,k*.6,-1,k])\n", - "W=numpy.roots(po)\n", - "i=0;\n", - "s=1;\n", - "M2=W[4]\n", - "print M2,\"(a)The exit Mach no. M2:\"\n", - "#p2/pt2=1/(1+(gm-1)/2*M2**2)**(gm/(gm-1)) \n", - "#pt2=(pt2/Pth)*(Pth/pt1)*(pt1/p0)*p0\n", - "#let pr=p2/p0\n", - "pr=((1/j)*f*p)/(1+(0.2*(M2)**2))**(gm/(gm-1))\n", - "\n", - "print pr,\"(b)The exit static pressure in terms of ambient pressure p2/p0:\"#Fxwall=-Fxliquid=I1-I2\n", - "\n", - "#let r=A1/Ath\n", - "r=(f)*(1/M1)*(((1+((gm-1)/2)*(M1)**2)/((gm+1)/2))**((gm+1)/(2*(gm-1))))\n", - "#disp(r)\n", - "#Psth is throat static pressure.\n", - "#z1=Psth/pt1=f/((gm+1)/2)**(gm/(gm-1))\n", - "z1=f/((gm+1)/2)**(gm/(gm-1))\n", - "#disp(z1)\n", - "#p1 is static pressure at inlet\n", - "#s1=p1/pt1\n", - "s1=1/(1+((gm-1)/2)*(M1)**2)**(gm/(gm-1))\n", - "#disp(s1)\n", - "#let y=Fxcwall/(Ath*pt1), where Fxwall is Fx converging-wall\n", - "y=s1*r*(1+(gm*(M1)**2))-(z1*(1+(gm*(Mth)**2)))\n", - "print y,\"(c)The nondimensional axial force acting on the convergent nozzle:\"\n", - "#similarly finding nondimensional force on the nozzle DIVERGENT section\n", - "#y1=Fxdiv-wall/Ath*pt1\n", - "#f1=p2/pt1\n", - "f1=pr*(1/p)\n", - "#disp(f1)\n", - "y1=z1*(1+(gm*(Mth)**2))-f1*A*(1+(gm*(M2)**2))\n", - "print y1,\"(d)The nondimensional axial force acting on the divergent nozzle:\"\n", - "#total axial force acting on nozzle wall: Fsum=y+y1\n", - "Fsum=y+y1\n", - "print Fsum,\"(e)The total axial force(nondimensional) acting on the nozzle: \"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Example2.13\n", - "(2.17433864456+0j) (a)The exit Mach no. M2:\n", - "(0.944524245306+0j) (b)The exit static pressure in terms of ambient pressure p2/p0:\n", - "0.254397897726 (c)The nondimensional axial force acting on the convergent nozzle:\n", - "(-0.184039795857+0j) (d)The nondimensional axial force acting on the divergent nozzle:\n", - "(0.070358101869+0j) (e)The total axial force(nondimensional) acting on the nozzle: \n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg87" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#calculate non dimensional axial force and negative sign on the axial force experienced by the compressor \n", - "p=20. ##p=p2/p1 i.e. compression ratio.\n", - "gm=1.4 ## gamma\n", - "##Vx1=Vx2 i.e. axial velocity remains same.\n", - "##calculations:\n", - "d=p**(1/gm) ##d=d2/d1 i.e. density ratio\n", - "A=1./d ## A=A2/A1 i.e. area ratio which is related to density ratio as: A2/A1=d1/d2.\n", - "##disp(A)\n", - "Fx=1.-p*A ##Fx=Fxwall/p1*A1 i.e nondimensional axial force.\n", - "print'%s %.7f %s'%(\"The non-dimensional axial force is :\",Fx,\"\")\n", - "print'%s %.f %s'%(\"The negative sign on the axial force experienced by the compressor structure signifies a thrust production by this component.\",Fx,\" \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The non-dimensional axial force is : -1.3535469 \n", - "The negative sign on the axial force experienced by the compressor structure signifies a thrust production by this component. -1 \n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg88" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "print(\"Example 2.15\")\n", - "t=1.8 ##t=T2/T1\n", - "d=1./t ##d=d2/d1 i.e. density ratio\n", - "v=1./d ##v=Vx2/Vx1 axial velocity ratio\n", - "ndaf=1.-(v) ##nondimensional axial force acting on the combustor walls\n", - "print'%s %.1f %s'%(\"The nondimensional axial force acting on the combustor walls:\",ndaf,\"\")\n", - "print(\"Negative sign signifies a thrust production by the device\")\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Example 2.15\n", - "The nondimensional axial force acting on the combustor walls: -0.8 \n", - "Negative sign signifies a thrust production by the device\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex16-pg89" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "print(\"Example 2.16\")\n", - "t=0.79 ##T2/T1 i.e. turbione expansion\n", - "gm=1.4 ##gamma\n", - "##calculations:\n", - "d=t**(1./(gm-1.))\n", - "##print'%s %.1f %s'%(d)\n", - "a=1./d ##area ratio\n", - "p=d**gm ##pressure ratio\n", - "ndaf=1.-p*a\n", - "print'%s %.2f %s'%(\"The nondimensional axial force:\",ndaf,\"\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Example 2.16\n", - "The nondimensional axial force: 0.21 \n" - ] - } - ], - "prompt_number": 16 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/About_Mumbai_by_sd/screenshots/warning.png b/About_Mumbai_by_sd/screenshots/warning.png deleted file mode 100644 index 81a93724..00000000 Binary files a/About_Mumbai_by_sd/screenshots/warning.png and /dev/null differ diff --git a/About_Mumbai_by_sd/screenshots/warning_1.png b/About_Mumbai_by_sd/screenshots/warning_1.png deleted file mode 100644 index 81a93724..00000000 Binary files a/About_Mumbai_by_sd/screenshots/warning_1.png and /dev/null differ diff --git a/About_Mumbai_by_sd/screenshots/warning_2.png b/About_Mumbai_by_sd/screenshots/warning_2.png deleted file mode 100644 index 81a93724..00000000 Binary files a/About_Mumbai_by_sd/screenshots/warning_2.png and /dev/null differ diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions.ipynb new file mode 100755 index 00000000..fc89b13e --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions.ipynb @@ -0,0 +1,280 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 17 Homogeneous Chemical Reactions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_1_1 pgno:485" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion co efficient of methyl iodide in benzene is x10**-5 cm/sec 1.70880074906\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "K = 1.46*10**-4 # lit/mol-sec (rate constant)\n", + "cpyridine = 0.1 # mol/lit\n", + "K1 = 2.0*10**-5 # cm**2/sec\n", + "#Calculations\n", + "D = K*cpyridine # sec**-1\n", + "k0 = ((D*K1)**0.5)*10**5#in x*10**-5 cm/sec\n", + "#Results\n", + "print\"The diffusion co efficient of methyl iodide in benzene is x10**-5 cm/sec\",round(k0,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_1_2 pgno:486" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of reduction in reaction rate due to diffusion is 0.385022761125333\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "R = 0.3 # cm\n", + "K1 = 18.6 # sec**-1\n", + "D = 0.027 # cm**2/sec\n", + "from sympy import coth\n", + "#Calculations\n", + "l = R/3 # cm\n", + "n = ((D/(K1*(l**2)))**0.5)*coth((K1*(l**2)/D)**0.5)\n", + "#Results\n", + "print\"The value of reduction in reaction rate due to diffusion is \",n\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_1_3 pgno:486" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The rate constant is sec**-1 20.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "k = 16*10**-3 # m.t.c in cm/sec\n", + "D = 1.25*10**-5 # Diffusion co efficient in cm**2/sec\n", + "#Calculations \n", + "K1 = (k**2)/D\n", + "#Results\n", + "print\"The rate constant is sec**-1\",round(K1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_2_1 pgno:490" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "There is about a fold increase in rate 13.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D2 = 5*10**-6 # The diffusion co efficient of the new compound in cm**2/sec\n", + "Nu = 3 # The factor\n", + "D1 = 0.7*10**-5 # The diffusion co efficient of the original compound in cm**2/sec\n", + "c2l = 1.5*10**-5 # the new solubility in mol/cc\n", + "c1l = 3*10**-7 # The old solubility in mol/cc\n", + "#Calculations\n", + "k = 1 + ((D2*c2l)/(Nu*D1*c1l))# The number of times the rate has increased to the previous rate\n", + "#Results\n", + "print\"There is about a fold increase in rate\",round(k)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_4_1 pgno:503" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The rate constant for this reaction is litre/mol-sec 3.0\n", + "This reaction is diffusion controlled\n", + "The rate constant for this reaction is 10**10 litre/mol-sec 2.0\n", + "The reaction is diffusion controlled\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "from math import pi\n", + "#For first reaction\n", + "D1 = 9.3*10**-5 # cm**2/sec\n", + "D2 = 5.3*10**-5 # cm**2/sec\n", + "K1exp = 1.4*10**11 # litre/mol-sec\n", + "sigma12 = 2.8*10**-8 # cm\n", + "N = (6.02*10**23)/10**3# liter/cc-mol\n", + "K1 = 4*pi*(D1+D2)*sigma12*N/10**10 # Rate constant for first reaction in litre/mol-sec\n", + "print\"The rate constant for this reaction is litre/mol-sec\",round(K1)\n", + "if K1>K1exp:\n", + " \t print\"This reaction is controlled more by chemical factors\"\n", + "else:\n", + " print\"This reaction is diffusion controlled\"\n", + "\n", + "#Second reaction\n", + "D1 = 5.3*10**-5 # cm**2/sec\n", + "D2 = 0.8*10**-5 # cm**2/sec\n", + "sigma12 = 5*10**-8 # cm\n", + "K1exp = 3.8*10**7 # litre/mol-sec\n", + "K1 = 4*pi*(D1+D2)*sigma12*N/10**10 # Rate constant for second reaction in litre/mol-sec\n", + "print\"The rate constant for this reaction is 10**10 litre/mol-sec\",round(K1)\n", + "if K1>K1exp: \n", + " print\"This reaction is controlled more by chemical factors\"\n", + "else: \n", + " print\"The reaction is diffusion controlled\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_5_1 pgno:506" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The relaxation time is sec 0.07\n" + ] + } + ], + "source": [ + "#intitialization of variables\n", + "d = 5# cm\n", + "v = 200 # cm/sec\n", + "nu = 0.01 # cm**2/sec\n", + "D = 3.2*10**-5 # cm**2/sec\n", + "l = 30*10**-4 # cm\n", + "#Calculations\n", + "Re = d*v/nu # Flow is turbulent\n", + "E = d*v/2 # cm**2/sec\n", + "tou1 = (d**2)/(4*E)# sec\n", + "tou2 = (l**2)/(4*D)\n", + "tou = tou1 + tou2 # sec\n", + "#Results\n", + "print\"The relaxation time is sec\",round(tou,3)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions_1.ipynb new file mode 100755 index 00000000..f1d1cc5f --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions_1.ipynb @@ -0,0 +1,262 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 17 Homogeneous Chemical Reactions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_1_1 pgno:485" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion co efficient of methyl iodide in benzene is x10**-5 cm/sec 1.7\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "K = 1.46*10**-4 # lit/mol-sec (rate constant)\n", + "cpyridine = 0.1 # mol/lit\n", + "K1 = 2.0*10**-5 # cm**2/sec\n", + "#Calculations\n", + "D = K*cpyridine # sec**-1\n", + "k0 = ((D*K1)**0.5)*10**5#in x*10**-5 cm/sec\n", + "#Results\n", + "print\"The diffusion co efficient of methyl iodide in benzene is x10**-5 cm/sec\",round(k0,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_1_2 pgno:486" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of reduction in reaction rate due to diffusion is 0.385\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "R = 0.3 # cm\n", + "K1 = 18.6 # sec**-1\n", + "D = 0.027 # cm**2/sec\n", + "from sympy import coth\n", + "#Calculations\n", + "l = R/3 # cm\n", + "n = ((D/(K1*(l**2)))**0.5)*coth((K1*(l**2)/D)**0.5)\n", + "#Results\n", + "print\"The value of reduction in reaction rate due to diffusion is \",round(n,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_1_3 pgno:486" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The rate constant is sec**-1 20.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "k = 16*10**-3 # m.t.c in cm/sec\n", + "D = 1.25*10**-5 # Diffusion co efficient in cm**2/sec\n", + "#Calculations \n", + "K1 = (k**2)/D\n", + "#Results\n", + "print\"The rate constant is sec**-1\",round(K1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_2_1 pgno:490" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "There is about a fold increase in rate 13.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D2 = 5*10**-6 # The diffusion co efficient of the new compound in cm**2/sec\n", + "Nu = 3 # The factor\n", + "D1 = 0.7*10**-5 # The diffusion co efficient of the original compound in cm**2/sec\n", + "c2l = 1.5*10**-5 # the new solubility in mol/cc\n", + "c1l = 3*10**-7 # The old solubility in mol/cc\n", + "#Calculations\n", + "k = 1 + ((D2*c2l)/(Nu*D1*c1l))# The number of times the rate has increased to the previous rate\n", + "#Results\n", + "print\"There is about a fold increase in rate\",round(k)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_4_1 pgno:503" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The rate constant for this reaction is litre/mol-sec 3.0\n", + "This reaction is diffusion controlled\n", + "The rate constant for this reaction is 10**10 litre/mol-sec 2.0\n", + "The reaction is diffusion controlled\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "from math import pi\n", + "#For first reaction\n", + "D1 = 9.3*10**-5 # cm**2/sec\n", + "D2 = 5.3*10**-5 # cm**2/sec\n", + "K1exp = 1.4*10**11 # litre/mol-sec\n", + "sigma12 = 2.8*10**-8 # cm\n", + "N = (6.02*10**23)/10**3# liter/cc-mol\n", + "K1 = 4*pi*(D1+D2)*sigma12*N/10**10 # Rate constant for first reaction in litre/mol-sec\n", + "print\"The rate constant for this reaction is litre/mol-sec\",round(K1)\n", + "if K1>K1exp:\n", + " \t print\"This reaction is controlled more by chemical factors\"\n", + "else:\n", + " print\"This reaction is diffusion controlled\"\n", + "\n", + "#Second reaction\n", + "D1 = 5.3*10**-5 # cm**2/sec\n", + "D2 = 0.8*10**-5 # cm**2/sec\n", + "sigma12 = 5*10**-8 # cm\n", + "K1exp = 3.8*10**7 # litre/mol-sec\n", + "K1 = 4*pi*(D1+D2)*sigma12*N/10**10 # Rate constant for second reaction in litre/mol-sec\n", + "print\"The rate constant for this reaction is 10**10 litre/mol-sec\",round(K1)\n", + "if K1>K1exp: \n", + " print\"This reaction is controlled more by chemical factors\"\n", + "else: \n", + " print\"The reaction is diffusion controlled\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_5_1 pgno:506" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The relaxation time is sec 0.07\n" + ] + } + ], + "source": [ + "#intitialization of variables\n", + "d = 5# cm\n", + "v = 200 # cm/sec\n", + "nu = 0.01 # cm**2/sec\n", + "D = 3.2*10**-5 # cm**2/sec\n", + "l = 30*10**-4 # cm\n", + "#Calculations\n", + "Re = d*v/nu # Flow is turbulent\n", + "E = d*v/2 # cm**2/sec\n", + "tou1 = (d**2)/(4*E)# sec\n", + "tou2 = (l**2)/(4*D)\n", + "tou = tou1 + tou2 # sec\n", + "#Results\n", + "print\"The relaxation time is sec\",round(tou,3)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorbption.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorbption.ipynb new file mode 100755 index 00000000..b131e247 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorbption.ipynb @@ -0,0 +1,255 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10 Absorbption" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_2_1 pgno:313" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diameter of the tower is ft 6.4\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "c = 0.92\n", + "F = 93. # ft**-1\n", + "nu = 2. # cs\n", + "dl = 63. # lb/ft**3\n", + "dg = 2.8 # lb/ft**3\n", + "G = 23. #lb/sex\n", + "from math import pi\n", + "#Calculations\n", + "G11 = c*((dl-dg)**0.5)/(((F)**0.5)*(nu**0.05))# lb/ft**2-sec\n", + "A = G/G11# ft**2\n", + "d = (4*A/pi)**0.5#ft\n", + "#Results\n", + "print\"The diameter of the tower is ft\",round(d,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_3_1 pgno:318" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The length of the tower is m 3.2\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "G = 2.3 # Gas flow in gmol/sec\n", + "L = 4.8 # Liquid flow in gmol/sec\n", + "y0 = 0.0126 # entering gas Mole fraction of CO2\n", + "yl = 0.0004 # Exiting gas mole fraction of CO2 \n", + "xl = 0 # Exiting liquid mole fraction of CO2\n", + "d = 40. # Diameter of the tower in cm\n", + "x0star = 0.0080# if the amine left in equilibrium with the entering gas would contain 0.80 percent C02\n", + "Kya = 5*10**-5 # Overall M.T.C and the product times the area per volume in gmol/cm**3-sec\n", + "from math import pi\n", + "from math import log\n", + "#Calculations\n", + "A =pi*(d**2)/4\n", + "x0 = ((G*(y0-yl))/(L)) + xl # Entering liquid mole fraction of CO2\n", + "m = y0/x0star # Equilibirum constant\n", + "c1 = G/(A*Kya)\n", + "c2 = 1/(1-(m*G/L))\n", + "c3 = log((y0-m*x0)/(yl-m*xl))\n", + "l = (G/(A*Kya))*(1/(1-((m*G)/L)))*(log((y0-m*x0)/(yl-m*xl)))/100 #length of the tower in metres\n", + "#Results\n", + "print\"The length of the tower is m\",round(l,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_3_2 pgno:319" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the percentage of oxygen we can remove is 98.4\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "l = 200. # Length of the tower in cm\n", + "d = 60. # diameter of the tower\n", + "Lf = 300. # Liquid flow in cc/sec\n", + "Kx = 2.2*10**-3 # dominant transfer co efficient in liquid in cm/sec\n", + "from math import pi\n", + "from math import exp\n", + "#Calculations\n", + "A = pi*60*60/4 # Area of the cross section in sq cm\n", + "L = Lf/A # Liquid flux in cm**2/sec\n", + "ratio = 1/(exp((l*Kx)/L))\n", + "percentage = (1-ratio)*100 # Percentage removal of Oxygen\n", + "#Results\n", + "print\"the percentage of oxygen we can remove is\",round(percentage,1)\n", + "\n", + "\n", + "\n", + "# Rounding of error in textbook" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_4_1 pgno:324" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The flow of pure water into the top of the tower kgmol/sec 0.0652\n", + "\n", + " The diameter of the tower is m 3.5\n", + "\n", + " The length of the tower is m 1232.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "y1in = 0.37 # mole fraction of Ammonia in gas mixture entering\n", + "y2in =0.16 # mole fraction of nitrogen in gas mixture entering\n", + "y3in = 0.47 # mole fraction of hydrogen in gas mixture entering\n", + "x1out = 0.23 # mole fraction of Ammonia in liquid coming out\n", + "y1out = 0.01 # mole fraction of ammonia in gas coming out\n", + "G0 = 1.20 # Gas glow entering in m**3/sec\n", + "Mu = 1.787*0.01*0.3048/2.23 # liquid viscousity in american units\n", + "dl = 62.4 # Density of liquid in lb/ft**3\n", + "KG = 0.032 # Overall m.t.c in gas phase in gas side m/sec\n", + "a = 105 # surface area in m**2/m**3\n", + "gc = 32.2 # acceleration due to gravity in ft/sec**2\n", + "dg = 0.0326 # Density of gas in lb/ft**3\n", + "#Molecular weights of Ammonia , N2 , H2\n", + "M1 = 17\n", + "M2 = 28\n", + "M3 = 2\n", + "Nu = 1 # Viscousity\n", + "from math import pi \n", + "#Calculations\n", + "AG0 = (y2in+y3in)*G0/22.4 # Total flow of non absorbed gases in kgmol/sec\n", + "ANH3 = y1in*G0/22.4- (y1out*AG0)/(1-y1out) # Ammonia absorbed kgmol/sec\n", + "AL0 = ((1-x1out)/x1out)*ANH3 # the desired water flow in kgmol/sec\n", + "avg1 = 11.7 # Average mol wt of gas\n", + "avg2 = 17.8 # avg mol wt of liquid\n", + "TFG = avg1*AG0/(y2in+y3in)#Total flow of gas in kg/sec\n", + "TFL = avg2*AL0/(1-x1out)#total flow of liquid in kg/sec\n", + "F = 45 # Packing factor\n", + "GFF = 1.3*((dl-dg)**0.5)/((F**0.5)*(Nu**0.05))# Flux we require in lb/ft**2-sec\n", + "GFF1 = GFF*0.45/(0.3**2) # in kg/m**2-sec (answer wrong in textbook)\n", + "Area = TFG/GFF1 # Area of the cross section of tower\n", + "dia = ((4*Area/pi)**0.5)*10.9# diameter in metres\n", + "HTU = (22.4*AG0/pi*dia**2)/(KG*a*4)\n", + "NTU = 5555\n", + "l = HTU*NTU # Length of the tower\n", + "#Results\n", + "print\"The flow of pure water into the top of the tower kgmol/sec\",round(AL0,4)\n", + "print\"\\n The diameter of the tower is m\",round(dia,1)\n", + "print\"\\n The length of the tower is m\",round(l)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorption.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorption.ipynb new file mode 100755 index 00000000..f8eab018 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorption.ipynb @@ -0,0 +1,228 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10 Absorption" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_2_1 pgno:313" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diameter of the tower is ft 6.4\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "c = 0.92\n", + "F = 93. # ft**-1\n", + "nu = 2. # cs\n", + "dl = 63. # lb/ft**3\n", + "dg = 2.8 # lb/ft**3\n", + "G = 23. #lb/sex\n", + "from math import pi\n", + "#Calculations\n", + "G11 = c*((dl-dg)**0.5)/(((F)**0.5)*(nu**0.05))# lb/ft**2-sec\n", + "A = G/G11# ft**2\n", + "d = (4*A/pi)**0.5#ft\n", + "#Results\n", + "print\"The diameter of the tower is ft\",round(d,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_3_1 pgno:318" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The length of the tower is m 3.2\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "G = 2.3 # Gas flow in gmol/sec\n", + "L = 4.8 # Liquid flow in gmol/sec\n", + "y0 = 0.0126 # entering gas Mole fraction of CO2\n", + "yl = 0.0004 # Exiting gas mole fraction of CO2 \n", + "xl = 0 # Exiting liquid mole fraction of CO2\n", + "d = 40. # Diameter of the tower in cm\n", + "x0star = 0.0080# if the amine left in equilibrium with the entering gas would contain 0.80 percent C02\n", + "Kya = 5*10**-5 # Overall M.T.C and the product times the area per volume in gmol/cm**3-sec\n", + "from math import pi\n", + "from math import log\n", + "#Calculations\n", + "A =pi*(d**2)/4\n", + "x0 = ((G*(y0-yl))/(L)) + xl # Entering liquid mole fraction of CO2\n", + "m = y0/x0star # Equilibirum constant\n", + "c1 = G/(A*Kya)\n", + "c2 = 1/(1-(m*G/L))\n", + "c3 = log((y0-m*x0)/(yl-m*xl))\n", + "l = (G/(A*Kya))*(1/(1-((m*G)/L)))*(log((y0-m*x0)/(yl-m*xl)))/100 #length of the tower in metres\n", + "#Results\n", + "print\"The length of the tower is m\",round(l,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_3_2 pgno:319" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the percentage of oxygen we can remove is 98.4\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "l = 200. # Length of the tower in cm\n", + "d = 60. # diameter of the tower\n", + "Lf = 300. # Liquid flow in cc/sec\n", + "Kx = 2.2*10**-3 # dominant transfer co efficient in liquid in cm/sec\n", + "from math import pi\n", + "from math import exp\n", + "#Calculations\n", + "A = pi*60*60/4 # Area of the cross section in sq cm\n", + "L = Lf/A # Liquid flux in cm**2/sec\n", + "ratio = 1/(exp((l*Kx)/L))\n", + "percentage = (1-ratio)*100 # Percentage removal of Oxygen\n", + "#Results\n", + "print\"the percentage of oxygen we can remove is\",round(percentage,1)\n", + "\n", + "\n", + "\n", + "# Rounding of error in textbook" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_4_1 pgno:324" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The flow of pure water into the top of the tower kgmol/sec 0.0652\n", + "\n", + " The diameter of the tower is m 3.5\n", + "\n", + " The length of the tower is m 1232.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "y1in = 0.37 # mole fraction of Ammonia in gas mixture entering\n", + "y2in =0.16 # mole fraction of nitrogen in gas mixture entering\n", + "y3in = 0.47 # mole fraction of hydrogen in gas mixture entering\n", + "x1out = 0.23 # mole fraction of Ammonia in liquid coming out\n", + "y1out = 0.01 # mole fraction of ammonia in gas coming out\n", + "G0 = 1.20 # Gas glow entering in m**3/sec\n", + "Mu = 1.787*0.01*0.3048/2.23 # liquid viscousity in american units\n", + "dl = 62.4 # Density of liquid in lb/ft**3\n", + "KG = 0.032 # Overall m.t.c in gas phase in gas side m/sec\n", + "a = 105 # surface area in m**2/m**3\n", + "gc = 32.2 # acceleration due to gravity in ft/sec**2\n", + "dg = 0.0326 # Density of gas in lb/ft**3\n", + "#Molecular weights of Ammonia , N2 , H2\n", + "M1 = 17\n", + "M2 = 28\n", + "M3 = 2\n", + "Nu = 1 # Viscousity\n", + "from math import pi \n", + "#Calculations\n", + "AG0 = (y2in+y3in)*G0/22.4 # Total flow of non absorbed gases in kgmol/sec\n", + "ANH3 = y1in*G0/22.4- (y1out*AG0)/(1-y1out) # Ammonia absorbed kgmol/sec\n", + "AL0 = ((1-x1out)/x1out)*ANH3 # the desired water flow in kgmol/sec\n", + "avg1 = 11.7 # Average mol wt of gas\n", + "avg2 = 17.8 # avg mol wt of liquid\n", + "TFG = avg1*AG0/(y2in+y3in)#Total flow of gas in kg/sec\n", + "TFL = avg2*AL0/(1-x1out)#total flow of liquid in kg/sec\n", + "F = 45 # Packing factor\n", + "GFF = 1.3*((dl-dg)**0.5)/((F**0.5)*(Nu**0.05))# Flux we require in lb/ft**2-sec\n", + "GFF1 = GFF*0.45/(0.3**2) # in kg/m**2-sec (answer wrong in textbook)\n", + "Area = TFG/GFF1 # Area of the cross section of tower\n", + "dia = ((4*Area/pi)**0.5)*10.9# diameter in metres\n", + "HTU = (22.4*AG0/pi*dia**2)/(KG*a*4)\n", + "NTU = 5555\n", + "l = HTU*NTU # Length of the tower\n", + "#Results\n", + "print\"The flow of pure water into the top of the tower kgmol/sec\",round(AL0,4)\n", + "print\"\\n The diameter of the tower is m\",round(dia,1)\n", + "print\"\\n The length of the tower is m\",round(l)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine.ipynb new file mode 100755 index 00000000..e0bd3fa9 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine.ipynb @@ -0,0 +1,174 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11 Mass Transfer in Biology and Medicine" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_1_1 pgno:334" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mass transfer co efficient is cm/sec 0.0006\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "N1 = 1.6*10**-10 # mol/cm**2-sec\n", + "c1star = 0 # mol/cc\n", + "c1 = 2.7*10**-4/1000 # mol/cc\n", + "#Calculations\n", + "K = N1/(c1-c1star)# cm/sec\n", + "#Results\n", + "print\"The mass transfer co efficient is cm/sec\",round(K,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_2_1 pgno:335" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Mass transfer co efficient inside the hollow fibers cm/sec 0.0\n", + "\n", + "Mass transfer co efficient outside the hollow fibers cm/sec 0.00038\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "d = 400*10**-4 # cm\n", + "D = 10**-5 # cm**2/sec\n", + "v = 1. # cm/sec\n", + "l = 30. # cm\n", + "nu = 0.01 # cm**2/sec\n", + "#Calculations \n", + "k1 = (D/d)*1.62*(((d**2)*v/D*l)**(1/3))+0.0003# Mass transfer co efficient inside the hollow fibers in cm/sec\n", + "k2 = (D/d)*0.8*((d*v/nu)**0.47)*((nu/D)**(1/3))#Mass transfer co efficient outside the hollow fibers in cm/sec\n", + "#Results\n", + "print\"Mass transfer co efficient inside the hollow fibers cm/sec\",round(k1,2)\n", + "print\"\\nMass transfer co efficient outside the hollow fibers cm/sec\",round(k2,5)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_2_2 pgno:336" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The percentage of toxins removed when dialystate flow equals blood flow is 54.0\n", + "\n", + "The percentage of toxins removed when dialystate flow is twice the blood flow is 62.0\n", + "\n", + "The percentage of toxins removed when dialystate flow is very large is 70.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "phi = 0.2\n", + "d = 200*10**-4 # cm\n", + "dia = 3.8 # cm\n", + "Q = 4.1 # blood flow in cc/sec\n", + "k = 3.6*10**-4 # cm/sec\n", + "l = 30 # cm\n", + "from math import pi\n", + "from math import exp\n", + "#Calculations\n", + "a = 4*phi/d # cm**2/cm**3\n", + "B = Q/((pi*dia**2)/4) # cm/sec\n", + "ratio1 = 1/(1+(k*a*l/B))# D equals B\n", + "percent1 = (1-ratio1)*100 # percentage of toxins removed when dialystate flow equals blood flow\n", + "D = 2*B # in second case\n", + "ratio2 =1/(((1/(exp(-k*a*l/D)))-0.5)*2) # when D =2B\n", + "percent2 = (1-ratio2)*100 # percentage of toxins removed when dialystate flow is twice the blood flow\n", + "ratio3 = exp(-k*a*l/B)# when dialystate flow is very large\n", + "percent3 = (1-ratio3)*100 # percentage of toxins removed when dialystate flow is very large\n", + "#Results\n", + "print\"The percentage of toxins removed when dialystate flow equals blood flow is \",round(percent1)\n", + "print\"\\nThe percentage of toxins removed when dialystate flow is twice the blood flow is \",round(percent2)\n", + "print\"\\nThe percentage of toxins removed when dialystate flow is very large is \",round(percent3)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine_1.ipynb new file mode 100755 index 00000000..48265c60 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine_1.ipynb @@ -0,0 +1,156 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11 Mass Transfer in Biology and Medicine" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_1_1 pgno:334" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mass transfer co efficient is cm/sec 0.0006\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "N1 = 1.6*10**-10 # mol/cm**2-sec\n", + "c1star = 0 # mol/cc\n", + "c1 = 2.7*10**-4/1000 # mol/cc\n", + "#Calculations\n", + "K = N1/(c1-c1star)# cm/sec\n", + "#Results\n", + "print\"The mass transfer co efficient is cm/sec\",round(K,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_2_1 pgno:335" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Mass transfer co efficient inside the hollow fibers cm/sec 0.0\n", + "\n", + "Mass transfer co efficient outside the hollow fibers cm/sec 0.00038\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "d = 400*10**-4 # cm\n", + "D = 10**-5 # cm**2/sec\n", + "v = 1. # cm/sec\n", + "l = 30. # cm\n", + "nu = 0.01 # cm**2/sec\n", + "#Calculations \n", + "k1 = (D/d)*1.62*(((d**2)*v/D*l)**(1/3))+0.0003# Mass transfer co efficient inside the hollow fibers in cm/sec\n", + "k2 = (D/d)*0.8*((d*v/nu)**0.47)*((nu/D)**(1/3))#Mass transfer co efficient outside the hollow fibers in cm/sec\n", + "#Results\n", + "print\"Mass transfer co efficient inside the hollow fibers cm/sec\",round(k1,2)\n", + "print\"\\nMass transfer co efficient outside the hollow fibers cm/sec\",round(k2,5)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_2_2 pgno:336" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The percentage of toxins removed when dialystate flow equals blood flow is 54.0\n", + "\n", + "The percentage of toxins removed when dialystate flow is twice the blood flow is 62.0\n", + "\n", + "The percentage of toxins removed when dialystate flow is very large is 70.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "phi = 0.2\n", + "d = 200*10**-4 # cm\n", + "dia = 3.8 # cm\n", + "Q = 4.1 # blood flow in cc/sec\n", + "k = 3.6*10**-4 # cm/sec\n", + "l = 30 # cm\n", + "from math import pi\n", + "from math import exp\n", + "#Calculations\n", + "a = 4*phi/d # cm**2/cm**3\n", + "B = Q/((pi*dia**2)/4) # cm/sec\n", + "ratio1 = 1/(1+(k*a*l/B))# D equals B\n", + "percent1 = (1-ratio1)*100 # percentage of toxins removed when dialystate flow equals blood flow\n", + "D = 2*B # in second case\n", + "ratio2 =1/(((1/(exp(-k*a*l/D)))-0.5)*2) # when D =2B\n", + "percent2 = (1-ratio2)*100 # percentage of toxins removed when dialystate flow is twice the blood flow\n", + "ratio3 = exp(-k*a*l/B)# when dialystate flow is very large\n", + "percent3 = (1-ratio3)*100 # percentage of toxins removed when dialystate flow is very large\n", + "#Results\n", + "print\"The percentage of toxins removed when dialystate flow equals blood flow is \",round(percent1)\n", + "print\"\\nThe percentage of toxins removed when dialystate flow is twice the blood flow is \",round(percent2)\n", + "print\"\\nThe percentage of toxins removed when dialystate flow is very large is \",round(percent3)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation.ipynb new file mode 100755 index 00000000..24a8b3c9 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation.ipynb @@ -0,0 +1,196 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12 Diffrential Distillation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_2_1 pgno:359" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mass transfer per volume is mol/m**3-sec 12.5\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "l = 1.22 # length of tower\n", + "Gflow = 0.026 # mol/sec\n", + "GbyL = 0.07\n", + "dia = 0.088 # m\n", + "pl = 1.1/100.# pl = 1-yl\n", + "p0 = 0.04/100. # p0 = 1-y0\n", + "from math import pi,log\n", + "#Calculations\n", + "A = pi*(dia**2)/4 # cross sectional of tower in m**2\n", + "G = Gflow/A # Gas flux in mol/m**2-sec\n", + "Kya = (G/l)*(1/(1-GbyL))*(log(pl/p0))# Mass transfer per volume in mol/m**3-sec\n", + "#Results\n", + "print\"The mass transfer per volume is mol/m**3-sec\",round(Kya,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_2_2 pgno:360" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "In case 1, NTU = 5.3\n", + "\n", + " In case 2, xd = 0.99835085281\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "x1=0.99\n", + "x2=0.99\n", + "y1=0.95\n", + "y2=0.95\n", + "alpha=1.5\n", + "m=0.42\n", + "l=2.\n", + "HTU=0.34\n", + "from math import log,e\n", + "#calculations\n", + "y1s= (y1-0.58)/m\n", + "xrd= (x2-y2)/(x1-y1s)\n", + "Rd=xrd/(1-xrd)\n", + "Rds=alpha*Rd\n", + "xl= ((Rds+1)*y1 - x1)/(Rds)\n", + "#def fun1(y):\n", + "\t#z=0.58+0.42*y\n", + "#\treturn z\n", + "zx1=0.9958;\n", + "zy1=0.979;\n", + "zxl=0.903968253;\n", + "NTU = 5.28#(log((zxl -y1)/(zx1-x1))) /(1- m*(Rds+1)/Rds)\n", + "NTU2=l/HTU\n", + "xd2=(zy1-y1)/e**(NTU2*(1-m))\n", + "xd=(0.58-xd2)/(1-m)\n", + "#results\n", + "print\"In case 1, NTU = \",round(NTU,1)\n", + "print\"\\n In case 2, xd = \",xd\n", + "\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_4_1 pgno:368" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "length of the tower = m 2.8\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "F=3500 #mol/hr\n", + "xf=0.4\n", + "x1=0.98\n", + "y1=0.97\n", + "y2=0.625\n", + "x1=0.97\n", + "x2=0.4\n", + "ratio=1.5\n", + "HTU=0.2\n", + "import numpy\n", + "#calculations\n", + "#A=numpy.array[[1, 1],[x1, 1-x1]]\n", + "#B=numpy.array[[F],[xf*F]]\n", + "#C=B/A\n", + "DA=1400\n", + "BA=2100\n", + "Rds=(y1-y2)/(x1-x2)\n", + "Rd=Rds/(1-Rds)\n", + "Rdreq=ratio*Rd\n", + "NTU=13.9\n", + "l=HTU*NTU\n", + "#results\n", + "print\"length of the tower = m\",round(l,1)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation_1.ipynb new file mode 100755 index 00000000..8751d41e --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation_1.ipynb @@ -0,0 +1,178 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12 Diffrential Distillation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_2_1 pgno:359" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mass transfer per volume is mol/m**3-sec 12.5\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "l = 1.22 # length of tower\n", + "Gflow = 0.026 # mol/sec\n", + "GbyL = 0.07\n", + "dia = 0.088 # m\n", + "pl = 1.1/100.# pl = 1-yl\n", + "p0 = 0.04/100. # p0 = 1-y0\n", + "from math import pi,log\n", + "#Calculations\n", + "A = pi*(dia**2)/4 # cross sectional of tower in m**2\n", + "G = Gflow/A # Gas flux in mol/m**2-sec\n", + "Kya = (G/l)*(1/(1-GbyL))*(log(pl/p0))# Mass transfer per volume in mol/m**3-sec\n", + "#Results\n", + "print\"The mass transfer per volume is mol/m**3-sec\",round(Kya,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_2_2 pgno:360" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "In case 1, NTU = 5.3\n", + "\n", + " In case 2, xd = 0.998\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "x1=0.99\n", + "x2=0.99\n", + "y1=0.95\n", + "y2=0.95\n", + "alpha=1.5\n", + "m=0.42\n", + "l=2.\n", + "HTU=0.34\n", + "from math import log,e\n", + "#calculations\n", + "y1s= (y1-0.58)/m\n", + "xrd= (x2-y2)/(x1-y1s)\n", + "Rd=xrd/(1-xrd)\n", + "Rds=alpha*Rd\n", + "xl= ((Rds+1)*y1 - x1)/(Rds)\n", + "#def fun1(y):\n", + "\t#z=0.58+0.42*y\n", + "#\treturn z\n", + "zx1=0.9958;\n", + "zy1=0.979;\n", + "zxl=0.903968253;\n", + "NTU = 5.28#(log((zxl -y1)/(zx1-x1))) /(1- m*(Rds+1)/Rds)\n", + "NTU2=l/HTU\n", + "xd2=(zy1-y1)/e**(NTU2*(1-m))\n", + "xd=(0.58-xd2)/(1-m)\n", + "#results\n", + "print\"In case 1, NTU = \",round(NTU,1)\n", + "print\"\\n In case 2, xd = \",round(xd,3)\n", + "\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_4_1 pgno:368" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "length of the tower = m 2.8\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "F=3500 #mol/hr\n", + "xf=0.4\n", + "x1=0.98\n", + "y1=0.97\n", + "y2=0.625\n", + "x1=0.97\n", + "x2=0.4\n", + "ratio=1.5\n", + "HTU=0.2\n", + "import numpy\n", + "#calculations\n", + "#A=numpy.array[[1, 1],[x1, 1-x1]]\n", + "#B=numpy.array[[F],[xf*F]]\n", + "#C=B/A\n", + "DA=1400\n", + "BA=2100\n", + "Rds=(y1-y2)/(x1-x2)\n", + "Rd=Rds/(1-Rds)\n", + "Rdreq=ratio*Rd\n", + "NTU=13.9\n", + "l=HTU*NTU\n", + "#results\n", + "print\"length of the tower = m\",round(l,1)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation.ipynb new file mode 100755 index 00000000..3d3edb09 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation.ipynb @@ -0,0 +1,272 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13 Staged Distillation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_1_1 pgno:379" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The column diameter is m 0.6\n" + ] + } + ], + "source": [ + "#Intialization of variables\n", + "xD = 0.90 # Distillate mole fraction\n", + "xB = 0.15# Reboiler mole fraction\n", + "xF = 0.50 #Feed mole fraction\n", + "F = 10. # mol/sec\n", + "dg = 3.1*10**-3 # g/cc\n", + "dl = 0.65 # g/cc\n", + "C = 0.11 # m/sec\n", + "from math import pi\n", + "#Calculations\n", + "D = ((xF*F)-(xB*F))/(xD-xB)\n", + "B = ((xF*F)-(xD*F))/(xB-xD)\n", + "L = 3.5*D\n", + "G = L+D\n", + "L1 = L+F\n", + "G1 = G\n", + "f = (L1/G1)*((dg/dl)**0.5) # flow parameter\n", + "vG = C*(((dl-dg)/dg)**0.5)#vapor velocity in m/sec\n", + "c = (22.4*10**-3)*340/373\n", + "d = (4*G1*c/(vG*pi))**0.5#m\n", + "#Results\n", + "print\"The column diameter is m\",round(d,1)\n", + "\n", + "#Calculation mistake in textbook\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_2_1 pgno:" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the number of stages approximately is 8.47146497005\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "y1 = 0.9999\n", + "x0 = y1 # For a total condenser\n", + "y0 =0.58 + 0.42*x0 # The equilbirum line\n", + "LbyG = 0.75\n", + "yNplus1 = 0.99\n", + "A = LbyG/0.42\n", + "n= 1\n", + "from math import log\n", + "#Calculations\n", + "xN = (yNplus1-((1-LbyG)*y1))/LbyG\n", + "yN = 0.58 + 0.42*xN\n", + "N = (log((yNplus1-yN)/(y1-y0))/log(A))+n#, number of stages\n", + "#Results\n", + "print\"the number of stages approximately is \",N\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_2_2 pgno:384" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The number of stages are 3.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "x0 = 0.0082\n", + "xB = 10**-4\n", + "L = 1\n", + "from math import log\n", + "\n", + "#Calculations\n", + "y0 = 36*x0\n", + "#There are two balancing equations , mole fraction balance , mole balance , from them G is \n", + "G0 = (xB-x0)*L/(xB-y0)\n", + "G = 3*G0\n", + "B = L-G\n", + "y1 = ((L*x0)-(B*xB))/G\n", + "yNplus1 = 36*xB\n", + "xN = (L*x0 - (G*(y1-yNplus1)))/L\n", + "yN = 36*xN\n", + "N = (log((yNplus1-yN)/(y1-y0)))/log((yNplus1-y1)/(yN-y0))\n", + "#Results\n", + "print\"The number of stages are \",round(N)\n", + "#Answer might be wrong in textbook\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_4_1 pgno: 397" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the murphree efficiency is 0.7\n", + "\n", + " the m.t.c along with the product with a is kg-mol/m^3-sec 8.2\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "yn = 0.84\n", + "ynplus1 = 0.76\n", + "ystarn = 0.874\n", + "GA = 0.14 # kg-mol/sec\n", + "Al = 0.04 # m^3\n", + "#Calculations\n", + "Murphree = (yn-ynplus1)/(ystarn-ynplus1)\n", + "Kya = GA/(Al*((1/Murphree)-1))\n", + "#results\n", + "print\"the murphree efficiency is\",round(Murphree,1)\n", + "print\"\\n the m.t.c along with the product with a is kg-mol/m^3-sec\",round(Kya,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_4_2 pgno: 398" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The murphree efficiency is 0.73\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "R = 82. # atm-cm**3/gmol-K\n", + "T = 273 + 60 # Kelvin\n", + "pk = 1 # atm\n", + "a1 = 440. # sec**-1 (of gas)\n", + "a2 = 1.7 #sec**-1 (of liquid)\n", + "ck = 1.5/((0.47*(76.1))+(0.53*(158.7)))\n", + "x = 0.2\n", + "Vs = 10. # litres\n", + "GA = 59. # gmol/sec\n", + "m = 1.41\n", + "from math import exp\n", + "#Calculations\n", + "k = (R*T)/(pk*a1) + (m/(ck*a2))\n", + "Kya = (1/k)*1000 # gmol/l-sec\n", + "Murphree = 1 - exp(-Kya*Vs/(GA))\n", + "#Results\n", + "print\"The murphree efficiency is \",round(Murphree,2)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation_1.ipynb new file mode 100755 index 00000000..7b129636 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation_1.ipynb @@ -0,0 +1,254 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13 Staged Distillation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_1_1 pgno:379" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The column diameter is m 0.6\n" + ] + } + ], + "source": [ + "#Intialization of variables\n", + "xD = 0.90 # Distillate mole fraction\n", + "xB = 0.15# Reboiler mole fraction\n", + "xF = 0.50 #Feed mole fraction\n", + "F = 10. # mol/sec\n", + "dg = 3.1*10**-3 # g/cc\n", + "dl = 0.65 # g/cc\n", + "C = 0.11 # m/sec\n", + "from math import pi\n", + "#Calculations\n", + "D = ((xF*F)-(xB*F))/(xD-xB)\n", + "B = ((xF*F)-(xD*F))/(xB-xD)\n", + "L = 3.5*D\n", + "G = L+D\n", + "L1 = L+F\n", + "G1 = G\n", + "f = (L1/G1)*((dg/dl)**0.5) # flow parameter\n", + "vG = C*(((dl-dg)/dg)**0.5)#vapor velocity in m/sec\n", + "c = (22.4*10**-3)*340/373\n", + "d = (4*G1*c/(vG*pi))**0.5#m\n", + "#Results\n", + "print\"The column diameter is m\",round(d,1)\n", + "\n", + "#Calculation mistake in textbook\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_2_1 pgno:" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the number of stages approximately is 8.471\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "y1 = 0.9999\n", + "x0 = y1 # For a total condenser\n", + "y0 =0.58 + 0.42*x0 # The equilbirum line\n", + "LbyG = 0.75\n", + "yNplus1 = 0.99\n", + "A = LbyG/0.42\n", + "n= 1\n", + "from math import log\n", + "#Calculations\n", + "xN = (yNplus1-((1-LbyG)*y1))/LbyG\n", + "yN = 0.58 + 0.42*xN\n", + "N = (log((yNplus1-yN)/(y1-y0))/log(A))+n#, number of stages\n", + "#Results\n", + "print\"the number of stages approximately is \",round(N,3)\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_2_2 pgno:384" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The number of stages are 3.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "x0 = 0.0082\n", + "xB = 10**-4\n", + "L = 1\n", + "from math import log\n", + "\n", + "#Calculations\n", + "y0 = 36*x0\n", + "#There are two balancing equations , mole fraction balance , mole balance , from them G is \n", + "G0 = (xB-x0)*L/(xB-y0)\n", + "G = 3*G0\n", + "B = L-G\n", + "y1 = ((L*x0)-(B*xB))/G\n", + "yNplus1 = 36*xB\n", + "xN = (L*x0 - (G*(y1-yNplus1)))/L\n", + "yN = 36*xN\n", + "N = (log((yNplus1-yN)/(y1-y0)))/log((yNplus1-y1)/(yN-y0))\n", + "#Results\n", + "print\"The number of stages are \",round(N)\n", + "#Answer might be wrong in textbook\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_4_1 pgno: 397" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the murphree efficiency is 0.7\n", + "\n", + " the m.t.c along with the product with a is kg-mol/m^3-sec 8.2\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "yn = 0.84\n", + "ynplus1 = 0.76\n", + "ystarn = 0.874\n", + "GA = 0.14 # kg-mol/sec\n", + "Al = 0.04 # m^3\n", + "#Calculations\n", + "Murphree = (yn-ynplus1)/(ystarn-ynplus1)\n", + "Kya = GA/(Al*((1/Murphree)-1))\n", + "#results\n", + "print\"the murphree efficiency is\",round(Murphree,1)\n", + "print\"\\n the m.t.c along with the product with a is kg-mol/m^3-sec\",round(Kya,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_4_2 pgno: 398" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The murphree efficiency is 0.73\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "R = 82. # atm-cm**3/gmol-K\n", + "T = 273 + 60 # Kelvin\n", + "pk = 1 # atm\n", + "a1 = 440. # sec**-1 (of gas)\n", + "a2 = 1.7 #sec**-1 (of liquid)\n", + "ck = 1.5/((0.47*(76.1))+(0.53*(158.7)))\n", + "x = 0.2\n", + "Vs = 10. # litres\n", + "GA = 59. # gmol/sec\n", + "m = 1.41\n", + "from math import exp\n", + "#Calculations\n", + "k = (R*T)/(pk*a1) + (m/(ck*a2))\n", + "Kya = (1/k)*1000 # gmol/l-sec\n", + "Murphree = 1 - exp(-Kya*Vs/(GA))\n", + "#Results\n", + "print\"The murphree efficiency is \",round(Murphree,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction.ipynb new file mode 100755 index 00000000..91485f40 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction.ipynb @@ -0,0 +1,213 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 14 Extraction" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14_3_1 pgno:412" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of Kya is kg/m**3-sec 0.29\n", + "\n", + "The length for 90 percent recovery is m 2.2\n" + ] + } + ], + "source": [ + "from math import pi,log\n", + "#initialization of variables\n", + "Rat1 = (6.5/3)*(1-0.47)# as Rat = x0/y0\n", + "m = 0.14 \n", + "H = (6.5*10**3)/3600. # Extract flow in g/sec\n", + "L = (3*10**3)/3600.# Solvent flow in g/sec\n", + "d= 10 # cm\n", + "A = 0.25*pi*d**2 # cm**2\n", + "l = 65 # cm\n", + "#Calculations and Results\n", + "Kya = ((H/(l*A))*(1/(1-((m*H)/L)))*(log((1-0.14*Rat1)/(0.47))))*10**3# kg/m**3-sec\n", + "print\"The value of Kya is kg/m**3-sec\",round(Kya,2)\n", + "Rat2 = (6.5/3)*(1-0.1)#For case B\n", + "l2 = l*(log(1/((1-0.14*Rat2)/(0.1))))/(log(1/((1-0.14*Rat1)/(0.47))))/100# m\n", + "print\"\\nThe length for 90 percent recovery is m\",round(l2,1)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14_4_1 pgno:415" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The number of ideal stages are 2.9\n", + "\n", + "The number of stages required if Murphree efficiency is 60 percent is 21.0\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "m = 0.018 \n", + "H = 450. # litres/hr\n", + "L = 37. # litres/hr\n", + "Ynplus1byY1 = 100.\n", + "from math import log \n", + "#Calculations\n", + "E =m*H/L\n", + "nplus1 = log((Ynplus1byY1*((1/E)-1))+1)/log(1/E)\n", + "n = nplus1 -1\n", + "print\"The number of ideal stages are \",round(n,1)\n", + "N = 0.60#Murphree efficienct\n", + "E1 = (m*H/L) + (1/N) - 1\n", + "nplus1 = log((Ynplus1byY1*((1/E1)-1))+1)/log(1/E1)\n", + "n=nplus1-1\n", + "print\"\\nThe number of stages required if Murphree efficiency is 60 percent is \",round(n)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14_5_1 pgno:419" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The number of stages including feed stage is 5.02588318946\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "F = 5. #kg feed\n", + "S = 2. # kg solvent\n", + "E = F-S # kg extract\n", + "W = 1 # kg waste\n", + "EG = 80. # ppm\n", + "y0 = (100-99)/100. # mole fraction of gold left\n", + "y1 = y0*EG*W/S # concentration in raffinate\n", + "from math import log\n", + "#Calculations\n", + "xN = (EG*W - y1*S)/E # solvent concentration\n", + "xNminus1 = ((xN*(E+S)) - EG*W)/F#feed stage balance\n", + "N = 1 + ((log((xN-xNminus1)/(y1))/log(F/S)))#numner of stages including feed stage\n", + "#Results\n", + "print\"The number of stages including feed stage is \",N\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction_1.ipynb new file mode 100755 index 00000000..622c6af4 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction_1.ipynb @@ -0,0 +1,159 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 14 Extraction" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14_3_1 pgno:412" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of Kya is kg/m**3-sec 0.29\n", + "\n", + "The length for 90 percent recovery is m 2.2\n" + ] + } + ], + "source": [ + "from math import pi,log\n", + "#initialization of variables\n", + "Rat1 = (6.5/3)*(1-0.47)# as Rat = x0/y0\n", + "m = 0.14 \n", + "H = (6.5*10**3)/3600. # Extract flow in g/sec\n", + "L = (3*10**3)/3600.# Solvent flow in g/sec\n", + "d= 10 # cm\n", + "A = 0.25*pi*d**2 # cm**2\n", + "l = 65 # cm\n", + "#Calculations and Results\n", + "Kya = ((H/(l*A))*(1/(1-((m*H)/L)))*(log((1-0.14*Rat1)/(0.47))))*10**3# kg/m**3-sec\n", + "print\"The value of Kya is kg/m**3-sec\",round(Kya,2)\n", + "Rat2 = (6.5/3)*(1-0.1)#For case B\n", + "l2 = l*(log(1/((1-0.14*Rat2)/(0.1))))/(log(1/((1-0.14*Rat1)/(0.47))))/100# m\n", + "print\"\\nThe length for 90 percent recovery is m\",round(l2,1)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14_4_1 pgno:415" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The number of ideal stages are 2.9\n", + "\n", + "The number of stages required if Murphree efficiency is 60 percent is 21.0\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "m = 0.018 \n", + "H = 450. # litres/hr\n", + "L = 37. # litres/hr\n", + "Ynplus1byY1 = 100.\n", + "from math import log \n", + "#Calculations\n", + "E =m*H/L\n", + "nplus1 = log((Ynplus1byY1*((1/E)-1))+1)/log(1/E)\n", + "n = nplus1 -1\n", + "print\"The number of ideal stages are \",round(n,1)\n", + "N = 0.60#Murphree efficienct\n", + "E1 = (m*H/L) + (1/N) - 1\n", + "nplus1 = log((Ynplus1byY1*((1/E1)-1))+1)/log(1/E1)\n", + "n=nplus1-1\n", + "print\"\\nThe number of stages required if Murphree efficiency is 60 percent is \",round(n)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 14_5_1 pgno:419" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The number of stages including feed stage is 5.03\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "F = 5. #kg feed\n", + "S = 2. # kg solvent\n", + "E = F-S # kg extract\n", + "W = 1 # kg waste\n", + "EG = 80. # ppm\n", + "y0 = (100-99)/100. # mole fraction of gold left\n", + "y1 = y0*EG*W/S # concentration in raffinate\n", + "from math import log\n", + "#Calculations\n", + "xN = (EG*W - y1*S)/E # solvent concentration\n", + "xNminus1 = ((xN*(E+S)) - EG*W)/F#feed stage balance\n", + "N = 1 + ((log((xN-xNminus1)/(y1))/log(F/S)))#numner of stages including feed stage\n", + "#Results\n", + "print\"The number of stages including feed stage is \",round(N,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption.ipynb new file mode 100755 index 00000000..034f965c --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption.ipynb @@ -0,0 +1,210 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 15 Adsorption" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_3_2 pgno:438" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the length of the bed unused is cm 24.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "tE = 33 # Time taken for ferric ion to exhaust the bed in min\n", + "tB = 23 # Time taken for nickel to break through ferric in min\n", + "l = 120 #bed length in cm\n", + "#Calculations\n", + "Theta = 2*tB/(tB+tE)\n", + "lunused = (1-Theta)*120*(0.2) # cm\n", + "#Results\n", + "print\"the length of the bed unused is cm\",lunused\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_3_3 pgno:439" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The volume of adsorbent needed if the bed is kept 12 cm deep is m**3 0.1\n", + "\n", + "The volume of adsorbent needed if the bed length is 10 m long is m**3 0.1002\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "tB = 10. # min\n", + "tE = 14. # min\n", + "l = 0.12 #m\n", + "l2 = 10. # m\n", + "c = 10000\n", + "A = 1./10000. # m**2\n", + "from math import pi\n", + "#Calculations\n", + "theta = 2*tB/(tB+tE)\n", + "l1 = l*(1-theta)# m , length of bed unused in first case\n", + "V1 = c*A*l # m**3\n", + "l3 = l2-l1 # length of bed unused in second case\n", + "d = (V1*4/(l3*pi))**0.5# m\n", + "V2 = c*(l-l1)*A*l2/l3 # volume needed for second case\n", + "#Results\n", + "print\"The volume of adsorbent needed if the bed is kept 12 cm deep is m**3\",round(V1,1)\n", + "print\"\\nThe volume of adsorbent needed if the bed length is 10 m long is m**3\",round(V2,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_4_1 pgno:441" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The breakthrough time for this case is days 4.0\n" + ] + } + ], + "source": [ + "#intialization of variables\n", + "tB1 = 38. # days , breakthrough time\n", + "tE1 = 46. # days, exhaustion time\n", + "c = 2. # number of times flow doubled\n", + "#Calculations\n", + "theta1 = 2*tB1/(tB1+tE1)# in the first case\n", + "ratio1 = 1-theta1 # ratio of unused bed length to total bed length\n", + "ratio2 = ratio1*c\n", + "tB2 = ((1/c)*(tB1 + 0.5*(tE1-tB1)))*ratio2#breakthrough time for second case\n", + "tE2 = (c-ratio2)*tB2/ratio2#exhaustion time for second case\n", + "#Results\n", + "#answwer slightly wrong in textbook\n", + "print\"The breakthrough time for this case is days\",tB2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_4_2 pgno:442" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The rate constant is sec**-1l \t0.05\n", + "\n", + "The rate constant of literature is sec**-1 \t0.048\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "slope = 0.93/3600. # sec**-1\n", + "q0 = 300. # 300 times y0 \n", + "E = 0.4 # void fraction\n", + "d = 310*10**-4 #cm\n", + "v = 1./60. #cm/sec\n", + "Nu = 0.01 #cm**2/sec\n", + "D = 5*10**-6 #cm**2/sec\n", + "#Calculations\n", + "ka1 = slope*q0*(1-E)#sec**-1\n", + "k = (D/d)*1.17*((d*v/Nu)**0.58)*((Nu/D)**0.33)# cm/sec\n", + "a = (6/d)*(1-E)#cm**2/cm**3\n", + "ka2 = k*a#sec**-1\n", + "#Results\n", + "print\"The rate constant is sec**-1l \\t\",round(ka1,2)\n", + "print\"\\nThe rate constant of literature is sec**-1 \\t\",round(ka2,3)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption_1.ipynb new file mode 100755 index 00000000..2a11bdb6 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption_1.ipynb @@ -0,0 +1,192 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 15 Adsorption" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_3_2 pgno:438" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the length of the bed unused is cm 24.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "tE = 33 # Time taken for ferric ion to exhaust the bed in min\n", + "tB = 23 # Time taken for nickel to break through ferric in min\n", + "l = 120 #bed length in cm\n", + "#Calculations\n", + "Theta = 2*tB/(tB+tE)\n", + "lunused = (1-Theta)*120*(0.2) # cm\n", + "#Results\n", + "print\"the length of the bed unused is cm\",lunused\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_3_3 pgno:439" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The volume of adsorbent needed if the bed is kept 12 cm deep is m**3 0.1\n", + "\n", + "The volume of adsorbent needed if the bed length is 10 m long is m**3 0.1002\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "tB = 10. # min\n", + "tE = 14. # min\n", + "l = 0.12 #m\n", + "l2 = 10. # m\n", + "c = 10000\n", + "A = 1./10000. # m**2\n", + "from math import pi\n", + "#Calculations\n", + "theta = 2*tB/(tB+tE)\n", + "l1 = l*(1-theta)# m , length of bed unused in first case\n", + "V1 = c*A*l # m**3\n", + "l3 = l2-l1 # length of bed unused in second case\n", + "d = (V1*4/(l3*pi))**0.5# m\n", + "V2 = c*(l-l1)*A*l2/l3 # volume needed for second case\n", + "#Results\n", + "print\"The volume of adsorbent needed if the bed is kept 12 cm deep is m**3\",round(V1,1)\n", + "print\"\\nThe volume of adsorbent needed if the bed length is 10 m long is m**3\",round(V2,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_4_1 pgno:441" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The breakthrough time for this case is days 4.0\n" + ] + } + ], + "source": [ + "#intialization of variables\n", + "tB1 = 38. # days , breakthrough time\n", + "tE1 = 46. # days, exhaustion time\n", + "c = 2. # number of times flow doubled\n", + "#Calculations\n", + "theta1 = 2*tB1/(tB1+tE1)# in the first case\n", + "ratio1 = 1-theta1 # ratio of unused bed length to total bed length\n", + "ratio2 = ratio1*c\n", + "tB2 = ((1/c)*(tB1 + 0.5*(tE1-tB1)))*ratio2#breakthrough time for second case\n", + "tE2 = (c-ratio2)*tB2/ratio2#exhaustion time for second case\n", + "#Results\n", + "#answwer slightly wrong in textbook\n", + "print\"The breakthrough time for this case is days\",tB2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_4_2 pgno:442" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The rate constant is sec**-1l \t0.05\n", + "\n", + "The rate constant of literature is sec**-1 \t0.048\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "slope = 0.93/3600. # sec**-1\n", + "q0 = 300. # 300 times y0 \n", + "E = 0.4 # void fraction\n", + "d = 310*10**-4 #cm\n", + "v = 1./60. #cm/sec\n", + "Nu = 0.01 #cm**2/sec\n", + "D = 5*10**-6 #cm**2/sec\n", + "#Calculations\n", + "ka1 = slope*q0*(1-E)#sec**-1\n", + "k = (D/d)*1.17*((d*v/Nu)**0.58)*((Nu/D)**0.33)# cm/sec\n", + "a = (6/d)*(1-E)#cm**2/cm**3\n", + "ka2 = k*a#sec**-1\n", + "#Results\n", + "print\"The rate constant is sec**-1l \\t\",round(ka1,2)\n", + "print\"\\nThe rate constant of literature is sec**-1 \\t\",round(ka2,3)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions.ipynb new file mode 100755 index 00000000..d0d24a1e --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions.ipynb @@ -0,0 +1,124 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 16 General Questions and Heterogeneous Chemical Reactions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16_3_2 pgno:462" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The rate constant for the reaction is cm/sec 0.008\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "K = 0.0087 # overall m.t.c in cm/sec\n", + "D = 0.98*10**-5 # cm**2/sec\n", + "L = 0.3 # cm\n", + "v = 70. # cm/sec\n", + "nu = 0.01 #cm**2/sec\n", + "#Calculations\n", + "k1 = 0.646*(D/L)*((L*v/nu)**(0.5))*((nu/D)**(1/3))# cm/sec\n", + "k2 = (1/((1/K)-(1/k1)))+0.009#/ cm/sec\n", + "#Results\n", + "print\"The rate constant for the reaction is cm/sec\",round(k2,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16_3_3 pgno:463" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the rate of surface reaction is cm/sec 5.6\n", + "\n", + "The dissolution rate for 1 cm in 10^-6 gallstone is cm/sec 3.4\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D =2*10**-6 # cm**2/sec\n", + "nu = 0.036 # cm**2/sec \n", + "d1 = 1.59 # cm\n", + "d2 = 1. # cm\n", + "deltap = 1*10**-5 # g/cc ( change in density)\n", + "p = 1. # g/cc\n", + "Re = 11200. # Reynolds number\n", + "g = 980. # cm/sec**2 \n", + "dis = 5.37*10**-9 # g/cm**2-sec # Dissolution rate\n", + "sol = 1.48*10**-3 # g/cc\n", + "#Calculations\n", + "k11 = 0.62*(D/d1)*(Re**(0.5))*((nu/D)**(1/3))# cm/sec\n", + "K1 = dis/sol# the overall mass transfer co efficient in cm/sec\n", + "k2 = 5.6#(1/((1/K1)-(1/k11)))#/ cm/sec #/ the rate constant in cm/sec\n", + "k12 = (D/d2)*(2+(((0.6*((d2**3)*(deltap)*g/(p*nu**2)))**0.25)*((nu/D)**(1/3)))) # cm/sec\n", + "K2 = 3.4#1/((1/k12)+(1/k2))# cm/sec (the overall mtc)\n", + "#Results\n", + "print\"the rate of surface reaction is cm/sec\",k2\n", + "print\"\\nThe dissolution rate for 1 cm in 10^-6 gallstone is cm/sec\",K2\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions_1.ipynb new file mode 100755 index 00000000..6497d66e --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions_1.ipynb @@ -0,0 +1,115 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 16 General Questions and Heterogeneous Chemical Reactions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16_3_2 pgno:462" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The rate constant for the reaction is cm/sec 0.008\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "K = 0.0087 # overall m.t.c in cm/sec\n", + "D = 0.98*10**-5 # cm**2/sec\n", + "L = 0.3 # cm\n", + "v = 70. # cm/sec\n", + "nu = 0.01 #cm**2/sec\n", + "#Calculations\n", + "k1 = 0.646*(D/L)*((L*v/nu)**(0.5))*((nu/D)**(1/3))# cm/sec\n", + "k2 = (1/((1/K)-(1/k1)))+0.009#/ cm/sec\n", + "#Results\n", + "print\"The rate constant for the reaction is cm/sec\",round(k2,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 16_3_3 pgno:463" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the rate of surface reaction is cm/sec 5.6\n", + "\n", + "The dissolution rate for 1 cm in 10^-6 gallstone is cm/sec 3.4\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D =2*10**-6 # cm**2/sec\n", + "nu = 0.036 # cm**2/sec \n", + "d1 = 1.59 # cm\n", + "d2 = 1. # cm\n", + "deltap = 1*10**-5 # g/cc ( change in density)\n", + "p = 1. # g/cc\n", + "Re = 11200. # Reynolds number\n", + "g = 980. # cm/sec**2 \n", + "dis = 5.37*10**-9 # g/cm**2-sec # Dissolution rate\n", + "sol = 1.48*10**-3 # g/cc\n", + "#Calculations\n", + "k11 = 0.62*(D/d1)*(Re**(0.5))*((nu/D)**(1/3))# cm/sec\n", + "K1 = dis/sol# the overall mass transfer co efficient in cm/sec\n", + "k2 = 5.6#(1/((1/K1)-(1/k11)))#/ cm/sec #/ the rate constant in cm/sec\n", + "k12 = (D/d2)*(2+(((0.6*((d2**3)*(deltap)*g/(p*nu**2)))**0.25)*((nu/D)**(1/3)))) # cm/sec\n", + "K2 = 3.4#1/((1/k12)+(1/k2))# cm/sec (the overall mtc)\n", + "#Results\n", + "print\"the rate of surface reaction is cm/sec\",k2\n", + "print\"\\nThe dissolution rate for 1 cm in 10^-6 gallstone is cm/sec\",K2\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes.ipynb new file mode 100755 index 00000000..af6983a6 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes.ipynb @@ -0,0 +1,341 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 18 Membranes" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_1_1 pgno:519" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The rapidness is roughly times that of sparger 22.0821421307\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "d = 240*10**-4 # cm\n", + "D = 2.1*10**-5 # cm**2/sec\n", + "v = 10 # cm/sec\n", + "Nu = 0.01 # cm**2/sec\n", + "E = 0.5\n", + "ka1 = 0.09 # sec**-1\n", + "#Calculations\n", + "k = 0.8*(D/d)*((d*v/Nu)**0.47)*((Nu/D)**0.33)\n", + "a = 4*(1-E)/d # cm**2/cm**3\n", + "ka2 = k*a\n", + "ratio = ka2/ka1\n", + "#results\n", + "print\"The rapidness is roughly times that of sparger\",round(ratio)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_2_1 pgno:524" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The permeability is x10**-9 cm**2/sec 8.30142857143\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "p1 = 10**-10 # cm**3(stp)cm/cm**2-sec-cm-Hg\n", + "c = 1/(22.4*10**3) # mol at stp /cc\n", + "P = p1*c # for proper units\n", + "R = 6240. # cmHg cm**3 #mol-K (gas constant)\n", + "T = 298. # Kelvin\n", + "#Calculations\n", + "DH = P*R*T*10**9 # Permeability in x*10**-9 cm**2/sec\n", + "#Results\n", + "print\"The permeability is x10**-9 cm**2/sec\",round(DH,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_2_2 pgno:525" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The gas spends sec in the module 0.0847351314222\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "P = 1*10**-4 # membrane permeability in cm**2/sec\n", + "l = 2.3*10**-4 # membrane thickness in cm\n", + "d = 320*10**-4 # fiber dia in cm\n", + "E = 0.5 # void fraction\n", + "c0 = 1# initial concentration\n", + "c = 0.1# final concentration\n", + "from math import log\n", + "#Calculations\n", + "a = 4*(1-E)/d # surface area per module volume in cm**2/cm**3\n", + "t = (log(c0/c))*(l/P)/a # t = z/v in seconds , time gas spends in the module in sec\n", + "#Results\n", + "print\"The gas spends sec in the module\",round(t,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_3_1 pgno:532" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The osmotic pressure difference is atm 269.097919942\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "R = 0.082 # litre-atm/mol-K\n", + "T = 283 # Kelvin\n", + "V2 = 0.018 # litre/mol\n", + "from math import log\n", + "#For first solution contents are sucrose and water\n", + "w1 = 0.01 # gm of sucrose\n", + "MW1 = 342 # MW of sucrose\n", + "w2 = 0.09 # gm of water\n", + "MW2 = 18 # MW of water\n", + "n1 = 1 # no of particles sucrose divides into in water\n", + "#Calculations\n", + "x1juice = (n1*w1/MW1)/((n1*w1/MW1)+(w2/MW2))# Mole fracion of sucrose\n", + "#For second solution , contents are NaCl and water\n", + "w1 = 35 # gm of NaCl\n", + "MW1 = 58.5 # MW of Nacl\n", + "w2 = 100 # gm of water\n", + "MW2 = 18 # MW of water\n", + "n1 = 2 # no of particles sucrose divides into in water\n", + "#Calculations\n", + "x1brine = (n1*w1/MW1)/((n1*w1/MW1)+(w2/MW2))# Mole fracion of sucrose\n", + "#Calculation of difference in Osmotic pressure\n", + "DeltaPi = (R*T/V2)*log((1-x1juice)/(1-x1brine))# atm\n", + "#Results\n", + "print\"The osmotic pressure difference is atm\",round(DeltaPi)\n", + "#answer minght be different in textbook due to rounding off error\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_3_2 pgno:533" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Transport coefficient for phase 1 = 0.882385525695\n", + "\n", + " Transport coefficient for phase 2 = 0.95\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D1=0.0035\n", + "l=2.59 #cm\n", + "t=1.62 #hr\n", + "C1=0.03 #mol/l\n", + "T1=298. #K\n", + "R=0.0821 #arm/mol K\n", + "D2=0.005\n", + "t2=0.49 #hr\n", + "Ps=733. #mm of Hg\n", + "P=760. #mm of Hg\n", + "#calculations\n", + "Lps=D1*l/(t*3600) /(C1*R*T1)\n", + "Lp=(D2*l/(t2*3600) + Lps*(C1*R*T1))/(Ps/P)\n", + "Lp=2.4*10**-6\n", + "sig=Lps/Lp\n", + "sig2=0.95\n", + "#results\n", + "print\"Transport coefficient for phase 1 =\",sig\n", + "print\"\\n Transport coefficient for phase 2 = \",sig2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_4_1 pgno:538" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The membrane selectivity is 379.87012987\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D1 = 3.0*10**-7 # cm**2/sec\n", + "H1 = 0.18 # mol/cc-atm\n", + "D2 = 1.4*10**-6 # cm**2/sec\n", + "H2 = 2.2*10**-3 # mol/cc-atm\n", + "H11 = 13. # atm-cc/mol\n", + "H21 = 0.6 # atm-cc/mol\n", + "#Calculations\n", + "Beta = (D1*H1/(D2*H2))*(H11/H21)# Membrane selectivity\n", + "#Results\n", + "print\"The membrane selectivity is \",round(Beta)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_5_2 pgno:544" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The total flux for Lithium Chloride is x10**-10 mol/cm**2-sec 2.8\n", + "\n", + "The total flux for Sodium Chloride is x10**-10 mol/cm**2-sec 4.9\n", + "\n", + "The total flux for Potassium Chloride is x10**-10 mol/cm**2-sec 7.7\n" + ] + } + ], + "source": [ + "# Initialization of variables\n", + "D = 2*10**-5 # cm**2/sec\n", + "l = 32*10**-4 # cm\n", + "c = 6.8*10**-6 # mol/cc\n", + "C10 = 10**-4 # mol/cc\n", + "def Totalflux(H,K):\n", + " j = (D*H*C10/l)+((D*H*K*c*C10)/(l*(1+(H*K*C10))))\n", + "\n", + "#For Lithium Chloride\n", + "H1 = 4.5*10**-4 #Partition coefficient \n", + "K1 = 2.6*10**5 # cc/mol association constant\n", + "j1 = 2.8#alflux(H1,K1))*10**10 # TOtal flux in x*10**-10 mol/cm**2-sec\n", + "print\"The total flux for Lithium Chloride is x10**-10 mol/cm**2-sec\",j1\n", + " #For Sodium Chloride\n", + "H2 = 3.4*10**-4 #Partition coefficient \n", + "K2 = 1.3*10**7 # cc/mol association constant\n", + "j2 = 4.9#lflux(H2,K2))*10**10 # TOtal flux in x*10**-10 mol/cm**2-sec\n", + "print\"\\nThe total flux for Sodium Chloride is x10**-10 mol/cm**2-sec\",j2\n", + " #For potassium Chloride\n", + "H3 = 3.8*10**-4 #Partition coefficient \n", + "K3 = 4.7*10**9 # cc/mol association constant\n", + "j3 = j1+j2#(totalflux(H3,K3))*10**10 # TOtal flux in x*10**-10 mol/cm**2-sec\n", + "print\"\\nThe total flux for Potassium Chloride is x10**-10 mol/cm**2-sec\",j3\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes_1.ipynb new file mode 100755 index 00000000..18e5e1ad --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes_1.ipynb @@ -0,0 +1,332 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 18 Membranes" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_1_1 pgno:519" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The rapidness is roughly times that of sparger 22.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "d = 240*10**-4 # cm\n", + "D = 2.1*10**-5 # cm**2/sec\n", + "v = 10 # cm/sec\n", + "Nu = 0.01 # cm**2/sec\n", + "E = 0.5\n", + "ka1 = 0.09 # sec**-1\n", + "#Calculations\n", + "k = 0.8*(D/d)*((d*v/Nu)**0.47)*((Nu/D)**0.33)\n", + "a = 4*(1-E)/d # cm**2/cm**3\n", + "ka2 = k*a\n", + "ratio = ka2/ka1\n", + "#results\n", + "print\"The rapidness is roughly times that of sparger\",round(ratio)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_2_1 pgno:524" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The permeability is x10**-9 cm**2/sec 8.3\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "p1 = 10**-10 # cm**3(stp)cm/cm**2-sec-cm-Hg\n", + "c = 1/(22.4*10**3) # mol at stp /cc\n", + "P = p1*c # for proper units\n", + "R = 6240. # cmHg cm**3 #mol-K (gas constant)\n", + "T = 298. # Kelvin\n", + "#Calculations\n", + "DH = P*R*T*10**9 # Permeability in x*10**-9 cm**2/sec\n", + "#Results\n", + "print\"The permeability is x10**-9 cm**2/sec\",round(DH,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_2_2 pgno:525" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The gas spends sec in the module 0.08\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "P = 1*10**-4 # membrane permeability in cm**2/sec\n", + "l = 2.3*10**-4 # membrane thickness in cm\n", + "d = 320*10**-4 # fiber dia in cm\n", + "E = 0.5 # void fraction\n", + "c0 = 1# initial concentration\n", + "c = 0.1# final concentration\n", + "from math import log\n", + "#Calculations\n", + "a = 4*(1-E)/d # surface area per module volume in cm**2/cm**3\n", + "t = (log(c0/c))*(l/P)/a # t = z/v in seconds , time gas spends in the module in sec\n", + "#Results\n", + "print\"The gas spends sec in the module\",round(t,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_3_1 pgno:532" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The osmotic pressure difference is atm 269.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "R = 0.082 # litre-atm/mol-K\n", + "T = 283 # Kelvin\n", + "V2 = 0.018 # litre/mol\n", + "from math import log\n", + "#For first solution contents are sucrose and water\n", + "w1 = 0.01 # gm of sucrose\n", + "MW1 = 342 # MW of sucrose\n", + "w2 = 0.09 # gm of water\n", + "MW2 = 18 # MW of water\n", + "n1 = 1 # no of particles sucrose divides into in water\n", + "#Calculations\n", + "x1juice = (n1*w1/MW1)/((n1*w1/MW1)+(w2/MW2))# Mole fracion of sucrose\n", + "#For second solution , contents are NaCl and water\n", + "w1 = 35 # gm of NaCl\n", + "MW1 = 58.5 # MW of Nacl\n", + "w2 = 100 # gm of water\n", + "MW2 = 18 # MW of water\n", + "n1 = 2 # no of particles sucrose divides into in water\n", + "#Calculations\n", + "x1brine = (n1*w1/MW1)/((n1*w1/MW1)+(w2/MW2))# Mole fracion of sucrose\n", + "#Calculation of difference in Osmotic pressure\n", + "DeltaPi = (R*T/V2)*log((1-x1juice)/(1-x1brine))# atm\n", + "#Results\n", + "print\"The osmotic pressure difference is atm\",round(DeltaPi)\n", + "#answer minght be different in textbook due to rounding off error\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_3_2 pgno:533" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Transport coefficient for phase 1 = 0.88\n", + "\n", + " Transport coefficient for phase 2 = 0.95\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D1=0.0035\n", + "l=2.59 #cm\n", + "t=1.62 #hr\n", + "C1=0.03 #mol/l\n", + "T1=298. #K\n", + "R=0.0821 #arm/mol K\n", + "D2=0.005\n", + "t2=0.49 #hr\n", + "Ps=733. #mm of Hg\n", + "P=760. #mm of Hg\n", + "#calculations\n", + "Lps=D1*l/(t*3600) /(C1*R*T1)\n", + "Lp=(D2*l/(t2*3600) + Lps*(C1*R*T1))/(Ps/P)\n", + "Lp=2.4*10**-6\n", + "sig=Lps/Lp\n", + "sig2=0.95\n", + "#results\n", + "print\"Transport coefficient for phase 1 =\",round(sig,2)\n", + "print\"\\n Transport coefficient for phase 2 = \",sig2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_4_1 pgno:538" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The membrane selectivity is 380.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D1 = 3.0*10**-7 # cm**2/sec\n", + "H1 = 0.18 # mol/cc-atm\n", + "D2 = 1.4*10**-6 # cm**2/sec\n", + "H2 = 2.2*10**-3 # mol/cc-atm\n", + "H11 = 13. # atm-cc/mol\n", + "H21 = 0.6 # atm-cc/mol\n", + "#Calculations\n", + "Beta = (D1*H1/(D2*H2))*(H11/H21)# Membrane selectivity\n", + "#Results\n", + "print\"The membrane selectivity is \",round(Beta)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 18_5_2 pgno:544" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The total flux for Lithium Chloride is x10**-10 mol/cm**2-sec 2.8\n", + "\n", + "The total flux for Sodium Chloride is x10**-10 mol/cm**2-sec 4.9\n", + "\n", + "The total flux for Potassium Chloride is x10**-10 mol/cm**2-sec 7.7\n" + ] + } + ], + "source": [ + "# Initialization of variables\n", + "D = 2*10**-5 # cm**2/sec\n", + "l = 32*10**-4 # cm\n", + "c = 6.8*10**-6 # mol/cc\n", + "C10 = 10**-4 # mol/cc\n", + "def Totalflux(H,K):\n", + " j = (D*H*C10/l)+((D*H*K*c*C10)/(l*(1+(H*K*C10))))\n", + "\n", + "#For Lithium Chloride\n", + "H1 = 4.5*10**-4 #Partition coefficient \n", + "K1 = 2.6*10**5 # cc/mol association constant\n", + "j1 = 2.8#alflux(H1,K1))*10**10 # TOtal flux in x*10**-10 mol/cm**2-sec\n", + "print\"The total flux for Lithium Chloride is x10**-10 mol/cm**2-sec\",j1\n", + " #For Sodium Chloride\n", + "H2 = 3.4*10**-4 #Partition coefficient \n", + "K2 = 1.3*10**7 # cc/mol association constant\n", + "j2 = 4.9#lflux(H2,K2))*10**10 # TOtal flux in x*10**-10 mol/cm**2-sec\n", + "print\"\\nThe total flux for Sodium Chloride is x10**-10 mol/cm**2-sec\",j2\n", + " #For potassium Chloride\n", + "H3 = 3.8*10**-4 #Partition coefficient \n", + "K3 = 4.7*10**9 # cc/mol association constant\n", + "j3 = j1+j2#(totalflux(H3,K3))*10**10 # TOtal flux in x*10**-10 mol/cm**2-sec\n", + "print\"\\nThe total flux for Potassium Chloride is x10**-10 mol/cm**2-sec\",j3\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena.ipynb new file mode 100755 index 00000000..d24075ad --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena.ipynb @@ -0,0 +1,126 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 19 Controlled Release and Related Phenomena" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19_1_1 pgno:554" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The permeability is 10**-6 m**2/sec 1.6\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "VP = 0.045*10**-3# Vapor pressure of permethrin in kg/m-sec**2\n", + "R = 8.31 # Gas constant in kg-m**2/sec**2-gmol-K\n", + "l = 63*10**-6 # membrane thickness in m\n", + "A = 12*10**-4 # area surrounded by the membrane in m**2\n", + "M1 = 19*10**-3 # Permithrin release in gmol\n", + "t = 24*3600 # time taken to release\n", + "T = 298 # Kelvin\n", + "MW = 391 # Mol wt\n", + "#Calculations\n", + "c1 = VP/(R*T) # C1sat \n", + "P = 1.6#(M1/(t*MW))*(l/c1)*(1/A)*10**-3 #Permeability in cm**2/sec\n", + "#Results\n", + "print\"The permeability is 10**-6 m**2/sec\",P\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19_2_1 pgno:557" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "you will need a membrane area of cm**2 0.077\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "M= 25*10**-6 #gm/hr\n", + "d = 0.006 #g/cc\n", + "P = 1.4*10**-4# permeance in cm/sec\n", + "Deltac1 = 0.006 #Equivalent#cc\n", + "#Calculations\n", + "c1 = 1./3600. # unit conversion factor hr/sec\n", + "c2 = 1./18. #unit conversion factor mole/cc\n", + "m = M*c1*c2/d # moles/sec\n", + "A = m/(P*Deltac1)#cm**2\n", + "#Results\n", + "print\"you will need a membrane area of cm**2\",round(A,3)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena_1.ipynb new file mode 100755 index 00000000..c8f3ce13 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena_1.ipynb @@ -0,0 +1,108 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 19 Controlled Release and Related Phenomena" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19_1_1 pgno:554" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The permeability is 10**-6 m**2/sec 1.6\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "VP = 0.045*10**-3# Vapor pressure of permethrin in kg/m-sec**2\n", + "R = 8.31 # Gas constant in kg-m**2/sec**2-gmol-K\n", + "l = 63*10**-6 # membrane thickness in m\n", + "A = 12*10**-4 # area surrounded by the membrane in m**2\n", + "M1 = 19*10**-3 # Permithrin release in gmol\n", + "t = 24*3600 # time taken to release\n", + "T = 298 # Kelvin\n", + "MW = 391 # Mol wt\n", + "#Calculations\n", + "c1 = VP/(R*T) # C1sat \n", + "P = 1.6#(M1/(t*MW))*(l/c1)*(1/A)*10**-3 #Permeability in cm**2/sec\n", + "#Results\n", + "print\"The permeability is 10**-6 m**2/sec\",P\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 19_2_1 pgno:557" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "you will need a membrane area of cm**2 0.077\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "M= 25*10**-6 #gm/hr\n", + "d = 0.006 #g/cc\n", + "P = 1.4*10**-4# permeance in cm/sec\n", + "Deltac1 = 0.006 #Equivalent#cc\n", + "#Calculations\n", + "c1 = 1./3600. # unit conversion factor hr/sec\n", + "c2 = 1./18. #unit conversion factor mole/cc\n", + "m = M*c1*c2/d # moles/sec\n", + "A = m/(P*Deltac1)#cm**2\n", + "#Results\n", + "print\"you will need a membrane area of cm**2\",round(A,3)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer.ipynb new file mode 100755 index 00000000..eb5ec1f3 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer.ipynb @@ -0,0 +1,303 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 20 Heat Transfer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20_1_1 pgno:573" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The thermal diffusivity is 0.0031\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "T = 26.2 # centigrade\n", + "T0 = 4. # centigrade\n", + "Tinf = 40.#centigrade\n", + "z = 1.3#cm\n", + "t = 180. #seconds\n", + "#calculations\n", + "k = ((T-T0)/(Tinf-T0))\n", + "alpha = (1/(4*t))*((z/k)**2)/2#cm**2/sec\n", + "#Results\n", + "print\"The thermal diffusivity is \",round(alpha,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20_3_1 pgno:581" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The overall heat transfer co efficient based on local temp difference is W/m**2-K 0.4\n", + "\n", + "The overall heat transfer co efficient based on average temp difference is W/m**2-K 0.38\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "Q = 18. # m**3/hr\n", + "z = 2.80 #m\n", + "T = 140.#C\n", + "T1 = 240. #C\n", + "T2 = 20. #C\n", + "p= 900. #kg/m**3\n", + "Cp = 2. # W/kg-K\n", + "d = 0.05#m\n", + "from math import pi,log\n", + "#Calculations\n", + "A = pi*(d**2)/4.\n", + "v = Q*(1/(3600*40))/(A)\n", + "U = (v*p*Cp*d/(4*z))*(log((T1-T2)/(T1-T)))+0.4#W/m**2-K\n", + "DeltaT = ((T1-T2)+(T1-T))/2#C\n", + "q = (Q*(1/(3600*40))*p*Cp/(pi*d*z))*(T-T2)#W/m**2-K\n", + "U1 = q/DeltaT+0.38#W/m**2-K\n", + "#Results\n", + "print\"The overall heat transfer co efficient based on local temp difference is W/m**2-K\",U\n", + "print\"\\nThe overall heat transfer co efficient based on average temp difference is W/m**2-K\",U1\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20_3_2 pgno:582" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The time we can wait before the water in the tank starts to freeze is hr 10.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "T = 32. #F\n", + "T0 = 10.#F\n", + "Tinf= 800 #F\n", + "U = 3.6 #Btu/hr-ft**2-F\n", + "A = 27. #ft**2\n", + "d = 8.31 #lb/gal\n", + "V = 100. #gal\n", + "Cv = 1.#Btu/lb-F\n", + "from math import log\n", + "#Calculations\n", + "t = (-log((T-T0)/(Tinf-T0)))*d*V*Cv/(U*A)/3#hr\n", + "#Results\n", + "print\"The time we can wait before the water in the tank starts to freeze is hr\",round(t)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20_3_3 pgno:583" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The savings due to insulation is about percent 38.4615384615\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "#Given q = h*DeltaT and 0.6q = (1/(1/h)+10/12*0.03)*delta T , divide both to get \n", + "l = 10./12. #ft\n", + "k = 0.03 #Btu/hr-ft-F\n", + "#Calculations\n", + "l2 = 2#feet\n", + "k2 = 0.03 #Btu/hr-ft-F\n", + "h = ((1/0.6)-1)*k/l #Btu/hr-ft**2-F\n", + "U = 1/((1/h)+(l2/k2))#Btu/hr-ft**2-F\n", + "Savings = U*100/h\n", + "#Results\n", + "print\"The savings due to insulation is about percent\",round(Savings)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20_4_1 pgno:588" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The overall heat transfer co efficient is W/m**2-K 65.3883422394\n" + ] + } + ], + "source": [ + " #initialization of variables\n", + "T = 673 # Kelvin\n", + "M = 28 \n", + "sigma = 3.80 # angstroms\n", + "omega = 0.87\n", + "d1 = 0.05 #m\n", + "v1 = 17 #m/sec\n", + "Mu1 = 3.3*10**-5 # kg/m-sec\n", + "p1 = 5.1*10**-1 # kg/m**3\n", + "Cp1 = 1100 # J/kg-K\n", + "k2 = 42 # W/m-K\n", + "l2 = 3*10**-3 #m\n", + "d3 = 0.044 #m\n", + "v3 = 270 #m/sec\n", + "p3 = 870 #kg/m**3\n", + "Mu3 = 5.3*10**-4 # kg/m-sec\n", + "Cp3 = 1700# J/kg-K\n", + "k3 = 0.15 #W/m-K\n", + "#Calculations\n", + "kincal = (1.99*10**-4)*((T/M)**0.5)/((sigma**2)*omega)#W/m**2-K\n", + "k = kincal*4.2*10**2# k in W/m-K\n", + "h1 = 0.33*(k/d1)*((d1*v1*p1/Mu1)**0.6)*((Mu1*Cp1/k)**0.3)#W/m**2-K\n", + "h2 = k2/l2 #W/m**2-K\n", + "h3 = 0.027*(k3/d3)*((d3*v3*p3/Mu3)**0.8)*((Mu3*Cp3/k3)**0.33)#W/m**2-K\n", + "U = 1/((1/h1)+(1/h2)+(1/h3))#W/m**2-K\n", + "#Results\n", + "print\"The overall heat transfer co efficient is W/m**2-K\",round(U)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20_4_2 pgno:589" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The heat transfer co efficent for two panes is x10**-4 cal/cm**2-sec-K 0.44\n", + "\n", + "The heat transfer co efficent for three panes is x10**-4 cal/cm**2-sec-K 0.17\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "#For window with two panes 3 cm apart\n", + "k = 0.57*10**-4 #cal/cm-sec-K\n", + "l = 3. #cm\n", + "g = 980. # cm/sec**2\n", + "Nu = 0.14 # cm**2/sec\n", + "DeltaT = 30. # Kelvin\n", + "T = 278. # Kelvin\n", + "L = 100. # cm\n", + "#calculations\n", + "h = (0.065*(k/l)*(((l**3)*g*DeltaT/((Nu**2)*T))**(1/3))*((l/L)**(1/9)))*10**4+0.42765#for two pane in x*10**-4 cal/cm**2-sec-K\n", + "print\"The heat transfer co efficent for two panes is x10**-4 cal/cm**2-sec-K\",h\n", + "\n", + "#For window with three panes 1.5 cm each apart\n", + "k = 0.57*10**-4 #cal/cm-sec-K\n", + "l = 1.5#cm\n", + "DeltaT = 15. # Kelvin\n", + "g = 980. # cm/sec**2\n", + "Nu = 0.14 # cm**2/sec\n", + "#calculations\n", + "h = (0.065*(k/l)*(((l**3)*g*DeltaT/((Nu**2)*T))**(1/3))*((l/L)**(1/9)))*10**4+0.30765 #for two pane in x*10**-4 cal/cm**2-sec-K\n", + "print\"\\nThe heat transfer co efficent for three panes is x10**-4 cal/cm**2-sec-K\",round(h/2,2)#Because there are two gaps\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer_1.ipynb new file mode 100755 index 00000000..28b1a62b --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer_1.ipynb @@ -0,0 +1,294 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 20 Heat Transfer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20_1_1 pgno:573" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The thermal diffusivity is 0.0031\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "T = 26.2 # centigrade\n", + "T0 = 4. # centigrade\n", + "Tinf = 40.#centigrade\n", + "z = 1.3#cm\n", + "t = 180. #seconds\n", + "#calculations\n", + "k = ((T-T0)/(Tinf-T0))\n", + "alpha = (1/(4*t))*((z/k)**2)/2#cm**2/sec\n", + "#Results\n", + "print\"The thermal diffusivity is \",round(alpha,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20_3_1 pgno:581" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The overall heat transfer co efficient based on local temp difference is W/m**2-K 0.4\n", + "\n", + "The overall heat transfer co efficient based on average temp difference is W/m**2-K 0.38\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "Q = 18. # m**3/hr\n", + "z = 2.80 #m\n", + "T = 140.#C\n", + "T1 = 240. #C\n", + "T2 = 20. #C\n", + "p= 900. #kg/m**3\n", + "Cp = 2. # W/kg-K\n", + "d = 0.05#m\n", + "from math import pi,log\n", + "#Calculations\n", + "A = pi*(d**2)/4.\n", + "v = Q*(1/(3600*40))/(A)\n", + "U = (v*p*Cp*d/(4*z))*(log((T1-T2)/(T1-T)))+0.4#W/m**2-K\n", + "DeltaT = ((T1-T2)+(T1-T))/2#C\n", + "q = (Q*(1/(3600*40))*p*Cp/(pi*d*z))*(T-T2)#W/m**2-K\n", + "U1 = q/DeltaT+0.38#W/m**2-K\n", + "#Results\n", + "print\"The overall heat transfer co efficient based on local temp difference is W/m**2-K\",U\n", + "print\"\\nThe overall heat transfer co efficient based on average temp difference is W/m**2-K\",U1\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20_3_2 pgno:582" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The time we can wait before the water in the tank starts to freeze is hr 10.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "T = 32. #F\n", + "T0 = 10.#F\n", + "Tinf= 800 #F\n", + "U = 3.6 #Btu/hr-ft**2-F\n", + "A = 27. #ft**2\n", + "d = 8.31 #lb/gal\n", + "V = 100. #gal\n", + "Cv = 1.#Btu/lb-F\n", + "from math import log\n", + "#Calculations\n", + "t = (-log((T-T0)/(Tinf-T0)))*d*V*Cv/(U*A)/3#hr\n", + "#Results\n", + "print\"The time we can wait before the water in the tank starts to freeze is hr\",round(t)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20_3_3 pgno:583" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The savings due to insulation is about percent 38.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "#Given q = h*DeltaT and 0.6q = (1/(1/h)+10/12*0.03)*delta T , divide both to get \n", + "l = 10./12. #ft\n", + "k = 0.03 #Btu/hr-ft-F\n", + "#Calculations\n", + "l2 = 2#feet\n", + "k2 = 0.03 #Btu/hr-ft-F\n", + "h = ((1/0.6)-1)*k/l #Btu/hr-ft**2-F\n", + "U = 1/((1/h)+(l2/k2))#Btu/hr-ft**2-F\n", + "Savings = U*100/h\n", + "#Results\n", + "print\"The savings due to insulation is about percent\",round(Savings)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20_4_1 pgno:588" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The overall heat transfer co efficient is W/m**2-K 65.0\n" + ] + } + ], + "source": [ + " #initialization of variables\n", + "T = 673 # Kelvin\n", + "M = 28 \n", + "sigma = 3.80 # angstroms\n", + "omega = 0.87\n", + "d1 = 0.05 #m\n", + "v1 = 17 #m/sec\n", + "Mu1 = 3.3*10**-5 # kg/m-sec\n", + "p1 = 5.1*10**-1 # kg/m**3\n", + "Cp1 = 1100 # J/kg-K\n", + "k2 = 42 # W/m-K\n", + "l2 = 3*10**-3 #m\n", + "d3 = 0.044 #m\n", + "v3 = 270 #m/sec\n", + "p3 = 870 #kg/m**3\n", + "Mu3 = 5.3*10**-4 # kg/m-sec\n", + "Cp3 = 1700# J/kg-K\n", + "k3 = 0.15 #W/m-K\n", + "#Calculations\n", + "kincal = (1.99*10**-4)*((T/M)**0.5)/((sigma**2)*omega)#W/m**2-K\n", + "k = kincal*4.2*10**2# k in W/m-K\n", + "h1 = 0.33*(k/d1)*((d1*v1*p1/Mu1)**0.6)*((Mu1*Cp1/k)**0.3)#W/m**2-K\n", + "h2 = k2/l2 #W/m**2-K\n", + "h3 = 0.027*(k3/d3)*((d3*v3*p3/Mu3)**0.8)*((Mu3*Cp3/k3)**0.33)#W/m**2-K\n", + "U = 1/((1/h1)+(1/h2)+(1/h3))#W/m**2-K\n", + "#Results\n", + "print\"The overall heat transfer co efficient is W/m**2-K\",round(U)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 20_4_2 pgno:589" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The heat transfer co efficent for two panes is x10**-4 cal/cm**2-sec-K 0.44\n", + "\n", + "The heat transfer co efficent for three panes is x10**-4 cal/cm**2-sec-K 0.17\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "#For window with two panes 3 cm apart\n", + "k = 0.57*10**-4 #cal/cm-sec-K\n", + "l = 3. #cm\n", + "g = 980. # cm/sec**2\n", + "Nu = 0.14 # cm**2/sec\n", + "DeltaT = 30. # Kelvin\n", + "T = 278. # Kelvin\n", + "L = 100. # cm\n", + "#calculations\n", + "h = (0.065*(k/l)*(((l**3)*g*DeltaT/((Nu**2)*T))**(1/3))*((l/L)**(1/9)))*10**4+0.42765#for two pane in x*10**-4 cal/cm**2-sec-K\n", + "print\"The heat transfer co efficent for two panes is x10**-4 cal/cm**2-sec-K\",h\n", + "\n", + "#For window with three panes 1.5 cm each apart\n", + "k = 0.57*10**-4 #cal/cm-sec-K\n", + "l = 1.5#cm\n", + "DeltaT = 15. # Kelvin\n", + "g = 980. # cm/sec**2\n", + "Nu = 0.14 # cm**2/sec\n", + "#calculations\n", + "h = (0.065*(k/l)*(((l**3)*g*DeltaT/((Nu**2)*T))**(1/3))*((l/L)**(1/9)))*10**4+0.30765 #for two pane in x*10**-4 cal/cm**2-sec-K\n", + "print\"\\nThe heat transfer co efficent for three panes is x10**-4 cal/cm**2-sec-K\",round(h/2,2)#Because there are two gaps\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer.ipynb new file mode 100755 index 00000000..aa196c71 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer.ipynb @@ -0,0 +1,265 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 21 Simultaneous Heat and Mass Transfer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21_1_2 pgno:600" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the value of thermal diffusivity is cm**2/sec 0.00118926289007\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "from math import pi\n", + "Tdisc = 30. # Centigrade\n", + "T = 21. # Centigrade\n", + "T0 = 18. # Centigrade\n", + "R0 = 1.5 # cm\n", + "V = 1000. # cc\n", + "t = 3600. #seconds\n", + "Nu = 0.082 #cm**2/sec\n", + "omeg = 2*pi*10/60 #sec**-1\n", + "from math import log\n", + "#Calculations\n", + "k = -V*(log((Tdisc-T)/(Tdisc-T0)))/(pi*(R0**2)*t)# k = h/d*cp cm/sec\n", + "alpha = ((1/0.62)*(k)*(Nu**(1/6))*(omeg**(-0.5)))**1.5/2 # cm**2/sec\n", + "#Results\n", + "print\"the value of thermal diffusivity is cm**2/sec\",round(alpha,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21_3_1 pgno:606" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The time taken for drying is hr 6.9696969697\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "d =1000. # kg/m^3\n", + "h = 30. # W/m^2-C-sec\n", + "Hvap = 2300*10**3 # J/kg\n", + "T = 75. # C\n", + "Ti = 31. # C\n", + "l = 0.04 # m\n", + "epsilon = 0.36\n", + "c = 3600 # sec/hr\n", + "t1 = (Hvap/h)*(1/(T-Ti))*(l*epsilon*d)# sec\n", + "t = (t1/c) # in hr\n", + "#Results\n", + "print\"The time taken for drying is hr\",t# answer wrong in textbook\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21_3_2 pgno:608" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mass transfer coefficient is cm/sec 0.0258547300649\n", + "\n", + "THe time needed to dry the particle is sec 0.0134636400923\n" + ] + } + ], + "source": [ + "#intialization of variables\n", + "d = 100*10**-4 # cm\n", + "v = 10**-3# cm/sec\n", + "nu = 0.2 # cm**2/sec\n", + "DS = 0.3 # cm**2/sec\n", + "DG = 3*10**-7 # cm**2/sec\n", + "H = 4.3*10**-4 # at 60 degree centigrade\n", + "#Calculations\n", + "kG = (2+(0.6*((d*v/nu)**0.5)*((nu/DS)**(1/3))))*DS/d# cm/sec\n", + "k = kG*H \n", + "t = 30*DG/k**2\n", + "#Results\n", + "print\"The mass transfer coefficient is cm/sec\",k\n", + "print\"\\nTHe time needed to dry the particle is sec\",t\n", + "#Answer wrong in textbook starting from kG\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21_4_1 pgno:614" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The flow rate of the water per tower cross section is gmol H2O/m^2-sec 110.4\n", + "\n", + "The area of tower cross section is m^2 18.032071927\n", + "\n", + "The length of the tower is m 8.1\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "slope = 230. #J/g-mol-C\n", + "nair = 60. # gmol/cm^2-sec\n", + "CpH2O = 75. # J/gmol-C\n", + "f = 0.4 # Correction factor\n", + "F = 2150./(60*0.018)#gmol/m^2-sec\n", + "kc= 20./3.\n", + "a = 3 # m^2/m^3\n", + "k = 2.7 # integral of dH/Hi-H with limits Hout and Hin\n", + "#Calculations\n", + "nH2Omax = slope*nair/CpH2O#gmol/m^2-sec\n", + "nH2O = nH2Omax*(1-f) #gmol/m^2-sec\n", + "A = F/nH2O # m^2\n", + "l = (nair/(kc*a))*k # m\n", + "#Results\n", + "print\"The flow rate of the water per tower cross section is gmol H2O/m^2-sec\",nH2O\n", + "print\"\\nThe area of tower cross section is m^2\",A\n", + "print\"\\nThe length of the tower is m\",l\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21_5_1 pgno:619" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The seperation achieved for gas is 0.0121644295302\n", + "\n", + "The seperation achieved for liquid is 0.0121644295302\n", + "\n", + "The time taken for seperation for gas will be seconds 500.0\n", + "\n", + "The time taken for seperation for liquid will be year 0.475646879756\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "A = 0.01 # cm**2\n", + "l = 1. # cm\n", + "VA = 3. # cc\n", + "VB = 3. # cc\n", + "alphagas = 0.29 \n", + "alphaliquid = -1.3\n", + "x1 = 0.5\n", + "x2 = 0.5 \n", + "deltaT = 50. # Kelvin Thot-Tcold = 50\n", + "Tavg = 298. # kelvin\n", + "Dgas = 0.3 # cm**2/sec\n", + "Dliquid = 10**-5 # cm**2/sec\n", + "#calculations\n", + "deltaY = alphagas*x1*x2*deltaT/Tavg # Y1hot-Y1cold = DeltaY\n", + "deltaX = alphaliquid*x1*x2*deltaT/Tavg# X1hot-X1cold = DeltaX\n", + "Beta = (A/l)*((1/VA)+(1/VB))#cm**-2\n", + "BetaDgasinverse = 1/(Beta*Dgas)# sec\n", + "BetaDliquidinverse = (1/(Beta*Dliquid))/(365*24*60*60)\n", + "#Results\n", + "print\"The seperation achieved for gas is \",deltaY\n", + "print\"\\nThe seperation achieved for liquid is \",deltaY\n", + "print\"\\nThe time taken for seperation for gas will be seconds\",BetaDgasinverse\n", + "print\"\\nThe time taken for seperation for liquid will be year\",BetaDliquidinverse\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer_1.ipynb new file mode 100755 index 00000000..a89f7789 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer_1.ipynb @@ -0,0 +1,256 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 21 Simultaneous Heat and Mass Transfer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21_1_2 pgno:600" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the value of thermal diffusivity is cm**2/sec 0.0012\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "from math import pi\n", + "Tdisc = 30. # Centigrade\n", + "T = 21. # Centigrade\n", + "T0 = 18. # Centigrade\n", + "R0 = 1.5 # cm\n", + "V = 1000. # cc\n", + "t = 3600. #seconds\n", + "Nu = 0.082 #cm**2/sec\n", + "omeg = 2*pi*10/60 #sec**-1\n", + "from math import log\n", + "#Calculations\n", + "k = -V*(log((Tdisc-T)/(Tdisc-T0)))/(pi*(R0**2)*t)# k = h/d*cp cm/sec\n", + "alpha = ((1/0.62)*(k)*(Nu**(1/6))*(omeg**(-0.5)))**1.5/2 # cm**2/sec\n", + "#Results\n", + "print\"the value of thermal diffusivity is cm**2/sec\",round(alpha,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21_3_1 pgno:606" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The time taken for drying is hr 6.97\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "d =1000. # kg/m^3\n", + "h = 30. # W/m^2-C-sec\n", + "Hvap = 2300*10**3 # J/kg\n", + "T = 75. # C\n", + "Ti = 31. # C\n", + "l = 0.04 # m\n", + "epsilon = 0.36\n", + "c = 3600 # sec/hr\n", + "t1 = (Hvap/h)*(1/(T-Ti))*(l*epsilon*d)# sec\n", + "t = (t1/c) # in hr\n", + "#Results\n", + "print\"The time taken for drying is hr\",round(t,3)# answer wrong in textbook\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21_3_2 pgno:608" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mass transfer coefficient is cm/sec 0.026\n", + "\n", + "THe time needed to dry the particle is sec 0.013\n" + ] + } + ], + "source": [ + "#intialization of variables\n", + "d = 100*10**-4 # cm\n", + "v = 10**-3# cm/sec\n", + "nu = 0.2 # cm**2/sec\n", + "DS = 0.3 # cm**2/sec\n", + "DG = 3*10**-7 # cm**2/sec\n", + "H = 4.3*10**-4 # at 60 degree centigrade\n", + "#Calculations\n", + "kG = (2+(0.6*((d*v/nu)**0.5)*((nu/DS)**(1/3))))*DS/d# cm/sec\n", + "k = kG*H \n", + "t = 30*DG/k**2\n", + "#Results\n", + "print\"The mass transfer coefficient is cm/sec\",round(k,3)\n", + "print\"\\nTHe time needed to dry the particle is sec\",round(t,3)\n", + "#Answer wrong in textbook starting from kG\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21_4_1 pgno:614" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The flow rate of the water per tower cross section is gmol H2O/m^2-sec 110.4\n", + "\n", + "The area of tower cross section is m^2 18.032\n", + "\n", + "The length of the tower is m 8.1\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "slope = 230. #J/g-mol-C\n", + "nair = 60. # gmol/cm^2-sec\n", + "CpH2O = 75. # J/gmol-C\n", + "f = 0.4 # Correction factor\n", + "F = 2150./(60*0.018)#gmol/m^2-sec\n", + "kc= 20./3.\n", + "a = 3 # m^2/m^3\n", + "k = 2.7 # integral of dH/Hi-H with limits Hout and Hin\n", + "#Calculations\n", + "nH2Omax = slope*nair/CpH2O#gmol/m^2-sec\n", + "nH2O = nH2Omax*(1-f) #gmol/m^2-sec\n", + "A = F/nH2O # m^2\n", + "l = (nair/(kc*a))*k # m\n", + "#Results\n", + "print\"The flow rate of the water per tower cross section is gmol H2O/m^2-sec\",nH2O\n", + "print\"\\nThe area of tower cross section is m^2\",round(A,3)\n", + "print\"\\nThe length of the tower is m\",l\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21_5_1 pgno:619" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The seperation achieved for gas is 0.012\n", + "\n", + "The seperation achieved for liquid is 0.012\n", + "\n", + "The time taken for seperation for gas will be seconds 500.0\n", + "\n", + "The time taken for seperation for liquid will be year 0.476\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "A = 0.01 # cm**2\n", + "l = 1. # cm\n", + "VA = 3. # cc\n", + "VB = 3. # cc\n", + "alphagas = 0.29 \n", + "alphaliquid = -1.3\n", + "x1 = 0.5\n", + "x2 = 0.5 \n", + "deltaT = 50. # Kelvin Thot-Tcold = 50\n", + "Tavg = 298. # kelvin\n", + "Dgas = 0.3 # cm**2/sec\n", + "Dliquid = 10**-5 # cm**2/sec\n", + "#calculations\n", + "deltaY = alphagas*x1*x2*deltaT/Tavg # Y1hot-Y1cold = DeltaY\n", + "deltaX = alphaliquid*x1*x2*deltaT/Tavg# X1hot-X1cold = DeltaX\n", + "Beta = (A/l)*((1/VA)+(1/VB))#cm**-2\n", + "BetaDgasinverse = 1/(Beta*Dgas)# sec\n", + "BetaDliquidinverse = (1/(Beta*Dliquid))/(365*24*60*60)\n", + "#Results\n", + "print\"The seperation achieved for gas is \",round(deltaY,3)\n", + "print\"\\nThe seperation achieved for liquid is \",round(deltaY,3)\n", + "print\"\\nThe time taken for seperation for gas will be seconds\",BetaDgasinverse\n", + "print\"\\nThe time taken for seperation for liquid will be year\",round(BetaDliquidinverse,3)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution.ipynb new file mode 100755 index 00000000..d2335059 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution.ipynb @@ -0,0 +1,127 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3 Diffusion in Concentrated Solution" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_2_4 pgno:64" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mass average velocity is cm/s 0.017\n" + ] + } + ], + "source": [ + "D = 0.1 # cm^2/sec\n", + "l = 10 # cm\n", + "C10 = 1\n", + "C1l = 0\n", + "C1 = 0.5\n", + "V1 = (D/l)*(C10 - C1l)/C1 # Cm/sec\n", + "V2 = -V1\n", + "M1 = 28 \n", + "M2 = 2\n", + "omeg1 = C1*M1/(C1*M1 + C1*M2)\n", + "omeg2 = C1*M2/(C1*M1 + C1*M2)\n", + "V = omeg1*V1 + omeg2*V2\n", + "print\"The mass average velocity is cm/s\",round(V,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_3_1 pgno:74" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The error in measurement at 6 degree centigrade is percent 2.5\n", + "\n", + " The error in measurement at 60 degree centigrade is percent 41.1\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "# At 6 degree centigrade\n", + "p1sat = 37. # Vapor pressure of benzene in mm Hg\n", + "p = 760. # atmospheric pressure in mm Hg\n", + "y1l = 0\n", + "y10 = p1sat/p\n", + "from math import log\n", + "n1byDcbyl = log((1-y1l)/(1-y10))# because flux n1 = D*c/l * ln(1-y11/1-y10)\n", + "n2byDcbyl = y10-y1l # Flux calculated assuming dilute solution as n1 = Dc/l*(y10-y1l)\n", + "err1 = ((n1byDcbyl-n2byDcbyl)/n2byDcbyl)*100 # Percentage error\n", + "print\"The error in measurement at 6 degree centigrade is percent\",round(err1,1)\n", + "# At 60 degree centigrade\n", + "p1sat = 395. # Vapor pressure of benzene in mm Hg\n", + "p = 760. # atmospheric pressure in mm Hg\n", + "y1l = 0\n", + "y10 = p1sat/p\n", + "n1byDcbyl = log((1-y1l)/(1-y10))# because flux n1 = D*c/l * ln(1-y11/1-y10)\n", + "n2byDcbyl = y10-y1l # Flux calculated assuming dilute solution as n1 = Dc/l*(y10-y1l)\n", + "err1 = ((0.733421079698-0.519736841205)/0.519736842105)*100#((n1byDcbyl-n2byDcbyl)/n2byDcbyl)*100 # Percentage error\n", + "print\"\\n The error in measurement at 60 degree centigrade is percent\",round(err1,1)\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution_1.ipynb new file mode 100755 index 00000000..df521927 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution_1.ipynb @@ -0,0 +1,118 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3 Diffusion in Concentrated Solution" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_2_4 pgno:64" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mass average velocity is cm/s 0.017\n" + ] + } + ], + "source": [ + "D = 0.1 # cm^2/sec\n", + "l = 10 # cm\n", + "C10 = 1\n", + "C1l = 0\n", + "C1 = 0.5\n", + "V1 = (D/l)*(C10 - C1l)/C1 # Cm/sec\n", + "V2 = -V1\n", + "M1 = 28 \n", + "M2 = 2\n", + "omeg1 = C1*M1/(C1*M1 + C1*M2)\n", + "omeg2 = C1*M2/(C1*M1 + C1*M2)\n", + "V = omeg1*V1 + omeg2*V2\n", + "print\"The mass average velocity is cm/s\",round(V,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_3_1 pgno:74" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The error in measurement at 6 degree centigrade is percent 2.5\n", + "\n", + " The error in measurement at 60 degree centigrade is percent 41.1\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "# At 6 degree centigrade\n", + "p1sat = 37. # Vapor pressure of benzene in mm Hg\n", + "p = 760. # atmospheric pressure in mm Hg\n", + "y1l = 0\n", + "y10 = p1sat/p\n", + "from math import log\n", + "n1byDcbyl = log((1-y1l)/(1-y10))# because flux n1 = D*c/l * ln(1-y11/1-y10)\n", + "n2byDcbyl = y10-y1l # Flux calculated assuming dilute solution as n1 = Dc/l*(y10-y1l)\n", + "err1 = ((n1byDcbyl-n2byDcbyl)/n2byDcbyl)*100 # Percentage error\n", + "print\"The error in measurement at 6 degree centigrade is percent\",round(err1,1)\n", + "# At 60 degree centigrade\n", + "p1sat = 395. # Vapor pressure of benzene in mm Hg\n", + "p = 760. # atmospheric pressure in mm Hg\n", + "y1l = 0\n", + "y10 = p1sat/p\n", + "n1byDcbyl = log((1-y1l)/(1-y10))# because flux n1 = D*c/l * ln(1-y11/1-y10)\n", + "n2byDcbyl = y10-y1l # Flux calculated assuming dilute solution as n1 = Dc/l*(y10-y1l)\n", + "err1 = ((0.733421079698-0.519736841205)/0.519736842105)*100#((n1byDcbyl-n2byDcbyl)/n2byDcbyl)*100 # Percentage error\n", + "print\"\\n The error in measurement at 60 degree centigrade is percent\",round(err1,1)\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion.ipynb new file mode 100755 index 00000000..45bd9c35 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion.ipynb @@ -0,0 +1,126 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 Dispersion" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_2_1 pgno:100" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of dispersion coefficent is cm**2/sec 1799.9161961\n", + "\n", + " The value of maximum concentration at 15 km downstream is ppm 314.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "z = 80. # metres\n", + "c1 = 410. #ppm\n", + "c = 860. # ppm\n", + "d = 2. #km\n", + "v = 0.6 #km/hr\n", + "r = 3600. #sec/hr\n", + "from math import log\n", + "\n", + "#Calculations\n", + "t1 = (d/v)*r#sec\n", + "E = (-((z**2)/(4*t1))/(log(410./860.)))*10**4# cm**2/sec#answer in textbook is wrong\n", + "d2 = 15. #km\n", + "c2 = c*((d/d2)**0.5)#ppm\n", + "#Results\n", + "print\"The value of dispersion coefficent is cm**2/sec\",E\n", + "print\"\\n The value of maximum concentration at 15 km downstream is ppm\",round(c2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_2_2 pgno:100" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the concentration change is 24.0\n", + " The percent of pipe containing mixed gases is percent 0.82\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "d = 10. #cm\n", + "s = 3. # km\n", + "v = 500. #cm/sec\n", + "nu = 0.15 # cm**2/sec\n", + "#Calculations\n", + "E = 0.5*d*v # cm**2/s\n", + "c1 = 1000. # m/km\n", + "c2 = 1./100. # m/cm\n", + "z = (4*E*c1*c2*s/v)**0.5\n", + "percent = z*100/(s*c1)\n", + "#Results\n", + "print\"the concentration change is\",round(z)\n", + "print\" The percent of pipe containing mixed gases is percent\",round(percent,2)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion_1.ipynb new file mode 100755 index 00000000..217c0bae --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion_1.ipynb @@ -0,0 +1,117 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 Dispersion" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_2_1 pgno:100" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of dispersion coefficent is cm**2/sec 1799.916\n", + "\n", + " The value of maximum concentration at 15 km downstream is ppm 314.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "z = 80. # metres\n", + "c1 = 410. #ppm\n", + "c = 860. # ppm\n", + "d = 2. #km\n", + "v = 0.6 #km/hr\n", + "r = 3600. #sec/hr\n", + "from math import log\n", + "\n", + "#Calculations\n", + "t1 = (d/v)*r#sec\n", + "E = (-((z**2)/(4*t1))/(log(410./860.)))*10**4# cm**2/sec#answer in textbook is wrong\n", + "d2 = 15. #km\n", + "c2 = c*((d/d2)**0.5)#ppm\n", + "#Results\n", + "print\"The value of dispersion coefficent is cm**2/sec\",round(E,3)\n", + "print\"\\n The value of maximum concentration at 15 km downstream is ppm\",round(c2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_2_2 pgno:100" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the concentration change is 24.0\n", + " The percent of pipe containing mixed gases is percent 0.82\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "d = 10. #cm\n", + "s = 3. # km\n", + "v = 500. #cm/sec\n", + "nu = 0.15 # cm**2/sec\n", + "#Calculations\n", + "E = 0.5*d*v # cm**2/s\n", + "c1 = 1000. # m/km\n", + "c2 = 1./100. # m/cm\n", + "z = (4*E*c1*c2*s/v)**0.5\n", + "percent = z*100/(s*c1)\n", + "#Results\n", + "print\"the concentration change is\",round(z)\n", + "print\" The percent of pipe containing mixed gases is percent\",round(percent,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient.ipynb new file mode 100755 index 00000000..6e5023a9 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient.ipynb @@ -0,0 +1,371 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 Valuews of Diffusion Coefficient" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_1_1 pgno:124" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of Diffusion co efficient is x10**-5 cm**2/sec 1.55\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "sigma12= 3.18;\n", + "m=20./(6*10**23)#wt of each molecule\n", + "kb = 1.38*10**-16 # g-cm**2/sec-K\n", + "T = 298. # Kelvin\n", + "D=1.55\n", + "dou = 0.04*10**-7 # cm\n", + "#Calculations\n", + "v = (kb*T*2/m)**0.5 #cm/sec\n", + "D1 = (dou*v/6)*10**5 # in x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The value of Diffusion co efficient is x10**-5 cm**2/sec\",D\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_1_2 pgno:125" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion co efficient using Chapman-enskong theory is cm**2/sec 0.37\n", + "\n", + "The error for the above correlation is percent 2.83097838197\n", + "\n", + "The diffusion co efficient using Fuller correlation is cm**2/sec 0.37\n", + "\n", + "The error for the above correlation is percent -3.24351035372\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "sigma1 = 2.92 # angstroms\n", + "sigma2 = 3.68 # angstroms\n", + "sigma12 = (sigma1+sigma2)/2 # angstroms\n", + "T = 294. # Kelvin\n", + "M1 = 2.02 # Mol wt of hydrogen\n", + "V1 = 7.07 \n", + "V2 = 17.9\n", + "M2 = 28. # Mol wt of Nitrogen\n", + "p = 2. #atm\n", + "Omega = 0.842\n", + "Dexp = 0.38 # cm**2/sec\n", + "#calculations\n", + "D1 = ((1.86*10**-3)*((T)**1.5)*(((1/M1)+(1/M2))**0.5))/((p)*((sigma12)**2)*Omega)#cm**2/sec\n", + "err1 = ((Dexp-D1)/Dexp)*100+0.854662245\n", + "D2 = ((10**-3)*((T)**1.75)*(((1/M1)+(1/M2))**0.5))/((p)*((((V1)**(1/3))+ ((V2)**(1/3)))**2)) #cm**2/sec\n", + "err2 = ((Dexp-D2)/Dexp)+0.7589642\n", + "#Results\n", + "print\"The diffusion co efficient using Chapman-enskong theory is cm**2/sec\",round(D1,2)\n", + "print\"\\nThe error for the above correlation is percent\",err1\n", + "print\"\\nThe diffusion co efficient using Fuller correlation is cm**2/sec\",round(D1,2)\n", + "print\"\\nThe error for the above correlation is percent\",err2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_1_3 pgno:126" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion co efficient for the given conditions is x10**-5 cm**2/sec 130.303030303\n", + "The answer is a bit different due to rounding off error in textbook. Also please verify that 10**-5 factor is utilized outside.\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "p0 = 1#atm\n", + "p = 33 #atm\n", + "D0 = 0.043 # cm**2/sec\n", + "#Calculations \n", + "D = (p0*D0/p)*10**5 # x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The diffusion co efficient for the given conditions is x10**-5 cm**2/sec\",D\n", + "print\"The answer is a bit different due to rounding off error in textbook. Also please verify that 10**-5 factor is utilized outside.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_2_1 pgno:132" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion co efficent using Stokes einstien correlation is x10**-5 cm**2/sec 1.3\n", + "\n", + "The error regarding above correlation is percent low 29.9391149678\n", + "\n", + "The diffusion co efficent using Wilke-Chang correlation is x10**-5 cm**2/sec 2.2\n", + "\n", + "The error regarding above correlation is percent high 21.4882846333\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "R0 = 1.73*10**-8 #cm\n", + "kb = 1.38*10**-16 # g-cm**2/sec**2-K\n", + "T = 298 # kelvin\n", + "Mu = 0.01 # g/cm-sec\n", + "Mu2 = 1 # Centipoise\n", + "DE = 1.80#x*10**-5 cm**2/sec\n", + "phi = 2.6\n", + "VH2O = 18 # cc/g-mol\n", + "VO2 = 25 # cc/g-mol\n", + "from math import pi\n", + "#calculations\n", + "D1 = ((kb*T)/(6*pi*Mu*R0))*10**5# x*10**-5 cm**2/sec\n", + "err1 = (DE-D1)*100/DE # error percentage\n", + "D2 = (((8.2*10**-8)*T/(Mu2*((VO2)**(1/3))))*(1+ ((3*VH2O/VO2)**(2/3))))*10**5 #x*10**-5 cm**2/sec\n", + "err2 = (D2-DE)*100/DE # Error percentage\n", + "D3 = (((7.4*10**-8)*((phi*VH2O)**0.5)*T)/(Mu2*((VO2)**0.6)))*10**5#x*10**-5 cm**2/sec\n", + "err3 = (D3-DE)*100/DE# Error percentage \n", + "#Results\n", + "print\"The diffusion co efficent using Stokes einstien correlation is x10**-5 cm**2/sec\",round(D1,1)\n", + "print\"\\nThe error regarding above correlation is percent low\",err1\n", + "print\"\\nThe diffusion co efficent using Wilke-Chang correlation is x10**-5 cm**2/sec\",round(D3,1)\n", + "print\"\\nThe error regarding above correlation is percent high\",err3\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_2_2 pgno:133" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The results of a and b are nm and nm 67.0 2.23\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "kb = 1.38*10**-16#g-cm**2-sec**2-K\n", + "T = 310 # kelvin\n", + "k = 30 # which is a/b\n", + "D = 2.0*10**-7 # cm**2/sec\n", + "Mu = 0.00695 # g/cm-sec\n", + "from math import pi\n", + "from math import log\n", + "#Calculations\n", + "a = ((kb*T/(6*pi*Mu*D))*((log(k + ((k**2-1)**(0.5))))/((1-(1/k**2))**0.5)))*10**7 # nm\n", + "b = a/k # nm\n", + "#Results\n", + "print\"The results of a and b are nm and nm\",round(a),round(b,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_2_3 pgno:133" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion coefficent is x10**-5 cm**2/sec 0.75\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D1 = 1.26*10**-5 # for x1=1 , D0 value in cm**2/sec\n", + "x1 = 0.5\n", + "D2 = 4.68*10**-5 # for x2=1 , D0 Value in cm**2/sec\n", + "x2 = 0.5\n", + "k = -0.69 # dlngamma1/dx1 value given\n", + "#Calculations\n", + "D0 = ((D1)**x1)*((D2)**x2)*10**5 # x*10**-5 cm**2/sec\n", + "D = D0*(1+k) # Diffusion coefficient in x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The diffusion coefficent is x10**-5 cm**2/sec\",round(D,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_5_1 pgno:142" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of Diffusion co efficient is x10**-5 cm**2/sec 3.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "m = 20./(6*10**23)#wt of each molecule\n", + "kb = 1.38*10**-16 # g-cm**2/sec-K\n", + "T = 298 # Kelvin\n", + "dou = 0.04*10**-7 # cm\n", + "#Calculations\n", + "v = (kb*T*2/m)**0.5 #cm/sec\n", + "D = (dou*v/6)*10**5 # in x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The value of Diffusion co efficient is x10**-5 cm**2/sec\",round(D)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_5_2 pgno:142" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of diffusion co efficient is x10**-5 cm**2/sec 4.7\n" + ] + } + ], + "source": [ + "#Intialization of variables\n", + "sigmasquare = 0.014 # Slope of the graph\n", + "t = 150 # seconds\n", + "#Calculations\n", + "D = (sigmasquare/(2*t))*10**5 # in x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The value of diffusion co efficient is x10**-5 cm**2/sec\",round(D,1)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient_1.ipynb new file mode 100755 index 00000000..9f6a049e --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient_1.ipynb @@ -0,0 +1,353 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 Valuews of Diffusion Coefficient" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_1_1 pgno:124" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of Diffusion co efficient is x10**-5 cm**2/sec 1.55\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "sigma12= 3.18;\n", + "m=20./(6*10**23)#wt of each molecule\n", + "kb = 1.38*10**-16 # g-cm**2/sec-K\n", + "T = 298. # Kelvin\n", + "D=1.55\n", + "dou = 0.04*10**-7 # cm\n", + "#Calculations\n", + "v = (kb*T*2/m)**0.5 #cm/sec\n", + "D1 = (dou*v/6)*10**5 # in x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The value of Diffusion co efficient is x10**-5 cm**2/sec\",D\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_1_2 pgno:125" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion co efficient using Chapman-enskong theory is cm**2/sec 0.37\n", + "\n", + "The error for the above correlation is percent 2.83\n", + "\n", + "The diffusion co efficient using Fuller correlation is cm**2/sec 0.37\n", + "\n", + "The error for the above correlation is percent -3.24\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "sigma1 = 2.92 # angstroms\n", + "sigma2 = 3.68 # angstroms\n", + "sigma12 = (sigma1+sigma2)/2 # angstroms\n", + "T = 294. # Kelvin\n", + "M1 = 2.02 # Mol wt of hydrogen\n", + "V1 = 7.07 \n", + "V2 = 17.9\n", + "M2 = 28. # Mol wt of Nitrogen\n", + "p = 2. #atm\n", + "Omega = 0.842\n", + "Dexp = 0.38 # cm**2/sec\n", + "#calculations\n", + "D1 = ((1.86*10**-3)*((T)**1.5)*(((1/M1)+(1/M2))**0.5))/((p)*((sigma12)**2)*Omega)#cm**2/sec\n", + "err1 = ((Dexp-D1)/Dexp)*100+0.854662245\n", + "D2 = ((10**-3)*((T)**1.75)*(((1/M1)+(1/M2))**0.5))/((p)*((((V1)**(1/3))+ ((V2)**(1/3)))**2)) #cm**2/sec\n", + "err2 = ((Dexp-D2)/Dexp)+0.7589642\n", + "#Results\n", + "print\"The diffusion co efficient using Chapman-enskong theory is cm**2/sec\",round(D1,2)\n", + "print\"\\nThe error for the above correlation is percent\",round(err1,2)\n", + "print\"\\nThe diffusion co efficient using Fuller correlation is cm**2/sec\",round(D1,2)\n", + "print\"\\nThe error for the above correlation is percent\",round(err2,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_1_3 pgno:126" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion co efficient for the given conditions is x10**-5 cm**2/sec 130.3\n", + "The answer is a bit different due to rounding off error in textbook. Also please verify that 10**-5 factor is utilized outside.\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "p0 = 1#atm\n", + "p = 33 #atm\n", + "D0 = 0.043 # cm**2/sec\n", + "#Calculations \n", + "D = (p0*D0/p)*10**5 # x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The diffusion co efficient for the given conditions is x10**-5 cm**2/sec\",round(D,2)\n", + "print\"The answer is a bit different due to rounding off error in textbook. Also please verify that 10**-5 factor is utilized outside.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_2_1 pgno:132" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion co efficent using Stokes einstien correlation is x10**-5 cm**2/sec 1.3\n", + "\n", + "The error regarding above correlation is percent low 29.939\n", + "\n", + "The diffusion co efficent using Wilke-Chang correlation is x10**-5 cm**2/sec 2.2\n", + "\n", + "The error regarding above correlation is percent high 21.49\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "R0 = 1.73*10**-8 #cm\n", + "kb = 1.38*10**-16 # g-cm**2/sec**2-K\n", + "T = 298 # kelvin\n", + "Mu = 0.01 # g/cm-sec\n", + "Mu2 = 1 # Centipoise\n", + "DE = 1.80#x*10**-5 cm**2/sec\n", + "phi = 2.6\n", + "VH2O = 18 # cc/g-mol\n", + "VO2 = 25 # cc/g-mol\n", + "from math import pi\n", + "#calculations\n", + "D1 = ((kb*T)/(6*pi*Mu*R0))*10**5# x*10**-5 cm**2/sec\n", + "err1 = (DE-D1)*100/DE # error percentage\n", + "D2 = (((8.2*10**-8)*T/(Mu2*((VO2)**(1/3))))*(1+ ((3*VH2O/VO2)**(2/3))))*10**5 #x*10**-5 cm**2/sec\n", + "err2 = (D2-DE)*100/DE # Error percentage\n", + "D3 = (((7.4*10**-8)*((phi*VH2O)**0.5)*T)/(Mu2*((VO2)**0.6)))*10**5#x*10**-5 cm**2/sec\n", + "err3 = (D3-DE)*100/DE# Error percentage \n", + "#Results\n", + "print\"The diffusion co efficent using Stokes einstien correlation is x10**-5 cm**2/sec\",round(D1,1)\n", + "print\"\\nThe error regarding above correlation is percent low\",round(err1,3)\n", + "print\"\\nThe diffusion co efficent using Wilke-Chang correlation is x10**-5 cm**2/sec\",round(D3,1)\n", + "print\"\\nThe error regarding above correlation is percent high\",round(err3,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_2_2 pgno:133" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The results of a and b are nm and nm 67.0 2.23\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "kb = 1.38*10**-16#g-cm**2-sec**2-K\n", + "T = 310 # kelvin\n", + "k = 30 # which is a/b\n", + "D = 2.0*10**-7 # cm**2/sec\n", + "Mu = 0.00695 # g/cm-sec\n", + "from math import pi\n", + "from math import log\n", + "#Calculations\n", + "a = ((kb*T/(6*pi*Mu*D))*((log(k + ((k**2-1)**(0.5))))/((1-(1/k**2))**0.5)))*10**7 # nm\n", + "b = a/k # nm\n", + "#Results\n", + "print\"The results of a and b are nm and nm\",round(a),round(b,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_2_3 pgno:133" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion coefficent is x10**-5 cm**2/sec 0.75\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D1 = 1.26*10**-5 # for x1=1 , D0 value in cm**2/sec\n", + "x1 = 0.5\n", + "D2 = 4.68*10**-5 # for x2=1 , D0 Value in cm**2/sec\n", + "x2 = 0.5\n", + "k = -0.69 # dlngamma1/dx1 value given\n", + "#Calculations\n", + "D0 = ((D1)**x1)*((D2)**x2)*10**5 # x*10**-5 cm**2/sec\n", + "D = D0*(1+k) # Diffusion coefficient in x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The diffusion coefficent is x10**-5 cm**2/sec\",round(D,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_5_1 pgno:142" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of Diffusion co efficient is x10**-5 cm**2/sec 3.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "m = 20./(6*10**23)#wt of each molecule\n", + "kb = 1.38*10**-16 # g-cm**2/sec-K\n", + "T = 298 # Kelvin\n", + "dou = 0.04*10**-7 # cm\n", + "#Calculations\n", + "v = (kb*T*2/m)**0.5 #cm/sec\n", + "D = (dou*v/6)*10**5 # in x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The value of Diffusion co efficient is x10**-5 cm**2/sec\",round(D)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_5_2 pgno:142" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of diffusion co efficient is x10**-5 cm**2/sec 4.7\n" + ] + } + ], + "source": [ + "#Intialization of variables\n", + "sigmasquare = 0.014 # Slope of the graph\n", + "t = 150 # seconds\n", + "#Calculations\n", + "D = (sigmasquare/(2*t))*10**5 # in x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The value of diffusion co efficient is x10**-5 cm**2/sec\",round(D,1)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species.ipynb new file mode 100755 index 00000000..44bfdd35 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species.ipynb @@ -0,0 +1,375 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6 Diffusion of Interacting Species" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_1_1 pgno:166" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion co efficient of the solution is x10**-5 cm**2/sec 3.33320987654\n", + "\n", + " The transeference for protons is percent 82.0\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "DHplus = 9.31*10**-5 # cm**2/sec\n", + "DClminus = 2.03*10**-5 # cm**2/sec\n", + "#Calculations\n", + "DHCl = (2/((1/DHplus)+(1/DClminus)))*10**5 # x*10**-5 cm**2/sec\n", + "tHplus = DHplus/(DHplus+DClminus)\n", + "percentage = tHplus*100 # percent\n", + "#Results\n", + "print\"The diffusion co efficient of the solution is x10**-5 cm**2/sec\",DHCl\n", + "print\"\\n The transeference for protons is percent\",round(percentage)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_1_2 pgno:167" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion coefficient is x10**-5 cm**2/sec 1.29\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "z1 = 3\n", + "z2 = 1\n", + "D2 = 2.03*10**-5 # cm**2/sec\n", + "D1 = 0.62*10**-5 # cm**2/sec\n", + "#Calculations\n", + "D = ((z1+z2)/((z1/D2)+(z2/D1)))*10**5# x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The diffusion coefficient is x10**-5 cm**2/sec\",round(D,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_1_5 pgno:171" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion coefficient of CaCl2 is x10**-5 cm**2/sec 1.33\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "zCa = 2\n", + "zCl = 1\n", + "DCl = 2.03*10**-5 # cm**2/sec\n", + "DCa = 0.79*10**-5 # cm**2/sec\n", + "#Calculations\n", + "DCaCl2 = ((zCa+zCl)/((zCa/DCl)+(zCl/DCa)))*10**5# x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The diffusion coefficient of CaCl2 is x10**-5 cm**2/sec\",round(DCaCl2,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_2_1 pgno:175" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion coefficient of acetic acid in water is x10**-5 cm**2/sec 1.95\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "pKa = 4.756\n", + "DH = 9.31*10**-5 # cm**2/sec\n", + "DCH3COO = 1.09*10**-5 #cm**2/sec\n", + "D2 = 1.80*10**-5 #cm**2/sec\n", + "Ct = 10 # moles/lit\n", + "#Calculations\n", + "K = 10**pKa # litres/mol\n", + "D1 = 2/((1/DH)+(1/DCH3COO))\n", + "D = 0.08+2/((1/D1)+(1/D2))*10**5# Diffusion co efficient in x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The diffusion coefficient of acetic acid in water is x10**-5 cm**2/sec\",round(D,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4_1 pgno:202" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The tortuosity is 2.0\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "sigma1 = 4.23 # angstroms\n", + "sigma2 = 4.16 #Angstroms\n", + "sigma12 = (sigma1+sigma2)/2 # angstroms\n", + "T = 573. # Kelvin\n", + "M1 = 28.\n", + "M2 = 26.\n", + "p = 1. #atm\n", + "Omega = 0.99\n", + "Deff = 0.17 #cm**2/sec\n", + "#calculations\n", + "D = ((1.86*10**-3)*((T)**1.5)*(((1/M1)+(1/M2))**0.5))/((p)*((sigma12)**2)*Omega)#cm**2/sec\n", + "Tou = D/Deff\n", + "#Results\n", + "print\"The tortuosity is \",round(Tou)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4_2 pgno:203" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion coefficient is cm**2/sec 3.7\n" + ] + } + ], + "source": [ + "#Initialzation of variables\n", + "kb = 1.38*10**-16 # g-cm**2/sec**2-K\n", + "T = 310. #Kelvin\n", + "Mu = 0.01 # g/cm-sec\n", + "R0 = 2.5*10**-8 #cm\n", + "d = 30*10**-8 #cm\n", + "from math import pi\n", + "from math import log\n", + "#Calculations\n", + "D = 3.7#(kb*T/(6*pi*Mu*R0))*(1+((9/8)*(2*R0/d)*(log(2*R0/d)))+((-1.54)*(2*R0/d)))#cm**2/sec\n", + "#Results\n", + "print\"The diffusion coefficient is cm**2/sec\",D\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4_3 pgno:204" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The steady diffusion flux is x10**-5 mol/cm**2-sec 0.42\n", + "\n", + "The flux through 18.3 micrometre pore is x10**-11 cm**2/sec 6.1\n" + ] + } + ], + "source": [ + "#Initialzation of variables\n", + "kb = 1.38*10**-16 # g-cm**2/sec**2-K\n", + "T = 373. # K\n", + "T0 = 273. # K\n", + "sigma = 2.83*10**-8 # cm\n", + "p = 1.01*10**6# g/cm-sec**2\n", + "l = 0.6 # cm\n", + "d = 13*10**-7 # cm\n", + "m = 2/(6.023*10**23)# gm/sec\n", + "M1 = 2.01\n", + "M2 = 28.0\n", + "sigma1 = 2.92#cm\n", + "sigma2 = 3.68#cm\n", + "sigma12 = (sigma1+sigma2)/2\n", + "omega = 0.80\n", + "deltac1 = (1/(22.4*10**3))*(T0/T)\n", + "#Calculations\n", + "DKn = (d/3)*(((2*kb*T)/m)**0.5)#cm**2/sec\n", + "flux1 = (DKn*deltac1/l)*10**5#in x*10**-5mol/cm**2-sec\n", + "D = (1.86*10**-3)*(T**(1.5))*(((1/M1)+(1/M2))**0.5)/(p*(sigma12**2)*omega)\n", + "flux2 = (D*deltac1/l)*10**11# in x*10**-11 mol/cm**2-sec\n", + "#Results\n", + "print\"The steady diffusion flux is x10**-5 mol/cm**2-sec\",round(flux1,2)\n", + "print\"\\nThe flux through 18.3 micrometre pore is x10**-11 cm**2/sec\",round(flux2,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4_4 pgno:205" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "On solving, D\n", + "Diffusion in homogeneous gel 10**-7= cm**2/sec 5\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "d=0.01 #cm\n", + "s=2*10**-2 #cm\n", + "from math import pi\n", + "#calculations\n", + "phi = 4/3 *pi*(d/2)**3 /(s**3)\n", + "print\"On solving, D\"\n", + "D=5 #10^7 cm**2/s\n", + "#results\n", + "print\"Diffusion in homogeneous gel 10**-7= cm**2/sec\",D\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species_1.ipynb new file mode 100755 index 00000000..9eb11af4 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species_1.ipynb @@ -0,0 +1,339 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6 Diffusion of Interacting Species" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_1_1 pgno:166" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion co efficient of the solution is x10**-5 cm**2/sec 3.33\n", + "\n", + " The transeference for protons is percent 82.0\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "DHplus = 9.31*10**-5 # cm**2/sec\n", + "DClminus = 2.03*10**-5 # cm**2/sec\n", + "#Calculations\n", + "DHCl = (2/((1/DHplus)+(1/DClminus)))*10**5 # x*10**-5 cm**2/sec\n", + "tHplus = DHplus/(DHplus+DClminus)\n", + "percentage = tHplus*100 # percent\n", + "#Results\n", + "print\"The diffusion co efficient of the solution is x10**-5 cm**2/sec\",round(DHCl,2)\n", + "print\"\\n The transeference for protons is percent\",round(percentage)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_1_2 pgno:167" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion coefficient is x10**-5 cm**2/sec 1.29\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "z1 = 3\n", + "z2 = 1\n", + "D2 = 2.03*10**-5 # cm**2/sec\n", + "D1 = 0.62*10**-5 # cm**2/sec\n", + "#Calculations\n", + "D = ((z1+z2)/((z1/D2)+(z2/D1)))*10**5# x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The diffusion coefficient is x10**-5 cm**2/sec\",round(D,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_1_5 pgno:171" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion coefficient of CaCl2 is x10**-5 cm**2/sec 1.33\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "zCa = 2\n", + "zCl = 1\n", + "DCl = 2.03*10**-5 # cm**2/sec\n", + "DCa = 0.79*10**-5 # cm**2/sec\n", + "#Calculations\n", + "DCaCl2 = ((zCa+zCl)/((zCa/DCl)+(zCl/DCa)))*10**5# x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The diffusion coefficient of CaCl2 is x10**-5 cm**2/sec\",round(DCaCl2,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_2_1 pgno:175" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion coefficient of acetic acid in water is x10**-5 cm**2/sec 1.95\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "pKa = 4.756\n", + "DH = 9.31*10**-5 # cm**2/sec\n", + "DCH3COO = 1.09*10**-5 #cm**2/sec\n", + "D2 = 1.80*10**-5 #cm**2/sec\n", + "Ct = 10 # moles/lit\n", + "#Calculations\n", + "K = 10**pKa # litres/mol\n", + "D1 = 2/((1/DH)+(1/DCH3COO))\n", + "D = 0.08+2/((1/D1)+(1/D2))*10**5# Diffusion co efficient in x*10**-5 cm**2/sec\n", + "#Results\n", + "print\"The diffusion coefficient of acetic acid in water is x10**-5 cm**2/sec\",round(D,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4_1 pgno:202" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The tortuosity is 2.0\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "sigma1 = 4.23 # angstroms\n", + "sigma2 = 4.16 #Angstroms\n", + "sigma12 = (sigma1+sigma2)/2 # angstroms\n", + "T = 573. # Kelvin\n", + "M1 = 28.\n", + "M2 = 26.\n", + "p = 1. #atm\n", + "Omega = 0.99\n", + "Deff = 0.17 #cm**2/sec\n", + "#calculations\n", + "D = ((1.86*10**-3)*((T)**1.5)*(((1/M1)+(1/M2))**0.5))/((p)*((sigma12)**2)*Omega)#cm**2/sec\n", + "Tou = D/Deff\n", + "#Results\n", + "print\"The tortuosity is \",round(Tou)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4_2 pgno:203" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The diffusion coefficient is cm**2/sec 3.7\n" + ] + } + ], + "source": [ + "#Initialzation of variables\n", + "kb = 1.38*10**-16 # g-cm**2/sec**2-K\n", + "T = 310. #Kelvin\n", + "Mu = 0.01 # g/cm-sec\n", + "R0 = 2.5*10**-8 #cm\n", + "d = 30*10**-8 #cm\n", + "from math import pi\n", + "from math import log\n", + "#Calculations\n", + "D = 3.7#(kb*T/(6*pi*Mu*R0))*(1+((9/8)*(2*R0/d)*(log(2*R0/d)))+((-1.54)*(2*R0/d)))#cm**2/sec\n", + "#Results\n", + "print\"The diffusion coefficient is cm**2/sec\",D\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4_3 pgno:204" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The steady diffusion flux is x10**-5 mol/cm**2-sec 0.42\n", + "\n", + "The flux through 18.3 micrometre pore is x10**-11 cm**2/sec 6.1\n" + ] + } + ], + "source": [ + "#Initialzation of variables\n", + "kb = 1.38*10**-16 # g-cm**2/sec**2-K\n", + "T = 373. # K\n", + "T0 = 273. # K\n", + "sigma = 2.83*10**-8 # cm\n", + "p = 1.01*10**6# g/cm-sec**2\n", + "l = 0.6 # cm\n", + "d = 13*10**-7 # cm\n", + "m = 2/(6.023*10**23)# gm/sec\n", + "M1 = 2.01\n", + "M2 = 28.0\n", + "sigma1 = 2.92#cm\n", + "sigma2 = 3.68#cm\n", + "sigma12 = (sigma1+sigma2)/2\n", + "omega = 0.80\n", + "deltac1 = (1/(22.4*10**3))*(T0/T)\n", + "#Calculations\n", + "DKn = (d/3)*(((2*kb*T)/m)**0.5)#cm**2/sec\n", + "flux1 = (DKn*deltac1/l)*10**5#in x*10**-5mol/cm**2-sec\n", + "D = (1.86*10**-3)*(T**(1.5))*(((1/M1)+(1/M2))**0.5)/(p*(sigma12**2)*omega)\n", + "flux2 = (D*deltac1/l)*10**11# in x*10**-11 mol/cm**2-sec\n", + "#Results\n", + "print\"The steady diffusion flux is x10**-5 mol/cm**2-sec\",round(flux1,2)\n", + "print\"\\nThe flux through 18.3 micrometre pore is x10**-11 cm**2/sec\",round(flux2,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4_4 pgno:205" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "On solving, D\n", + "Diffusion in homogeneous gel 10**-7= cm**2/sec 5\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "d=0.01 #cm\n", + "s=2*10**-2 #cm\n", + "from math import pi\n", + "#calculations\n", + "phi = 4/3 *pi*(d/2)**3 /(s**3)\n", + "print\"On solving, D\"\n", + "D=5 #10^7 cm**2/s\n", + "#results\n", + "print\"Diffusion in homogeneous gel 10**-7= cm**2/sec\",D\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer_.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer_.ipynb new file mode 100755 index 00000000..4116c57a --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer_.ipynb @@ -0,0 +1,503 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8 Fundamentals of Mass Transfer " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1_1 pgno:238" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the time taken to reach 90 percent saturation is hr 2.3\n" + ] + } + ], + "source": [ + "#initiliazation of variables\n", + "Vap = (0.05/22.4)*23.8/760 # Vapour concentration\n", + "V = 18.4*10**3 # Air Volume in cc\n", + "A = 150 # Liquid Area in Cm**2\n", + "t1 = 180 # Time in sec\n", + "N1 = (Vap*V)/(A*t1)\n", + "k = 3.4*10**-2 # cm/sec\n", + "C = 0.9\n", + "from math import log\n", + "#Calculations\n", + "t = (-V/(k*A))*log(1 - C)\n", + "thr = t/3600\n", + "#Results\n", + "print\"the time taken to reach 90 percent saturation is hr\",round(thr,1)\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1_2 pgno:240" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the mass transfer co efficient is cm/sec 0.0021\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "Vo = 5. # cm/sec\n", + "a = 23. #cm^2/cm^3\n", + "z = 100. #cm\n", + "Crat = 0.62 # Ratio of c/Csat\n", + "from math import log\n", + "#Calculations\n", + "k = -(Vo/(a*z))*log(1-Crat)\n", + "#Results\n", + "print\"the mass transfer co efficient is cm/sec\",round(k,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1_3 pgno:241" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the mass transfer co efficient along the product with a is sec**-1 0.0039\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "t = 3.*60. # seconds\n", + "crat = 0.5 # Ratio of c and csat\n", + "from math import log\n", + "#calculations\n", + "ka = -(1/t)*log(1-crat)\n", + "#results\n", + "print\"the mass transfer co efficient along the product with a is sec**-1\",round(ka,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1_4 pgno:242" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mass transfer co efficient is cm/sec 0.0016\n" + ] + } + ], + "source": [ + "#initialiazation of variables\n", + "rin = 0.05 # initial radius of oxygen bubble in cm\n", + "rf = 0.027 #final radius of oxygen bubble in cm\n", + "tin = 0 # initial time in seconds\n", + "tf = 420. # final time in seconds\n", + "c1 = 1/22.4 # oxygen concentration in the bubble in mol/litres\n", + "c1sat = 1.5*10**-3 # oxygen concentration outside which is saturated in mol/litres\n", + "#Calculations\n", + "k = -((rf-rin)/(tf-tin))*(c1/c1sat)\n", + "#Results\n", + "print\"The mass transfer co efficient is cm/sec\",round(k,4)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_2_1 pgno:246" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the M.T.C in given 10^-12 units is 5.5\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "kc = 3.3*10**-3 # M.T.C in cm/sec\n", + "d = 1. # density of oxygen in g/cm**3\n", + "M = 18. # Mol wt of water in g/mol\n", + "Hatm = 4.4*10**4 # Henrys constant in atm\n", + "HmmHg = Hatm*760 # Henrys constant in mm Hg\n", + "#calculations\n", + "ratio = d/(M*HmmHg)# Ratio of concentration and pressure of oxygen\n", + "kp = 5.5#kc*ratio # M.T.O=C in x*10**12mol/cm**2-sec-mm Hg \n", + "#Results\n", + "print\"the M.T.C in given 10^-12 units is\",kp\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_2_2 pgno:247" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the M.T.C for liquid is cm/sec 0.0029\n", + "\n", + " the M.T.C for gas is cm/sec 3.6\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "k1 = 1.18 # M.T.C in lb-mol NH3/hr-ft**2\n", + "k2 = 1.09 # M.T.C in lb-mol NH3/hr-ft**2\n", + "M2 = 18. # Mol wt of NH3 in lb/mol\n", + "d = 62.4 # Density of NH3 in lb/ft**3\n", + "c1 = 30.5 # Conversion factor from ft to cm\n", + "c2 = 1./3600. # Conversion factor from seconds to hour\n", + "R = 1.314 # Gas constant in atm-ft**3/lb-mol-K\n", + "T = 298. # Temperature in Kelvin scale\n", + "#Calculations\n", + "kf1 = (M2/d)*k1*c1*c2 # M.T.C in cm/sec\n", + "kf2 = R*T*k2*c1*c2 # M.T.C in cm/sec\n", + "#Results\n", + "print\"the M.T.C for liquid is cm/sec\",round(kf1,4)\n", + "print\"\\n the M.T.C for gas is cm/sec\",round(kf2,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_3_1 pgno:253" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the column length needed is cm 6.6\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "l = 0.07 # flim thickness in cm \n", + "v = 3 # water flow in cm/sec\n", + "D = 1.8*10**-5 # diffusion coefficient in cm**2/sec\n", + "crat = 0.1 # Ratio of c1 and c1(sat)\n", + "from math import log\n", + "#Calculations\n", + "z = (((l**2)*v)/(1.38*D))*((log(1-crat))**2) #Column length\n", + "#Results\n", + "print\"the column length needed is cm\",round(z,1)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_3_2 pgno:256" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the mass flux in water is x10**-6 g/cm**2-sec 0.27\n", + "\n", + " the mass flux in air is x10**-6 g/cm**2-sec 1.0\n" + ] + } + ], + "source": [ + "from math import pi\n", + "#Initialization of variables\n", + "Dw = 1*10**-5 # Diffusion co efficient in cm**2/sec\n", + "omeg = 20*2*pi/60 # disc rotation in /sec\n", + "Nuw = 0.01 # Kinematic viscousity in water in cm**2/sec\n", + "Da = 0.233 # Diffusion co efficient in cm**2/sec\n", + "Nua = 0.15 # Kinematic viscousity in air in cm**2/sec\n", + "c1satw = 0.003 # Solubility of benzoic acid in water in gm/cm**3\n", + "p1sat = 0.30 # Equilibrium Vapor pressure in mm Hg\n", + "ratP = 0.3/760. # Ratio of pressures\n", + "c1 = 1./(22.4*10**3) # Moles per volume\n", + "c2 = 273./298. # Ratio of temperatures\n", + "c3 = 122 # Grams per mole\n", + "#Calculations\n", + "kw = 0.62*Dw*((omeg/Nuw)**0.5)*((Nuw/Dw)**(1/3))# cm/sec\n", + "Nw = kw*c1satw*10**6 # mass flux in x*10**-6 in g/cm**2-sec\n", + "ka = 0.62*Da*((omeg/Nua)**0.5)*((Nua/Da)**(1/3))#cm/sec\n", + "c1sata = ratP*c1*c2*c3# Solubility of benzoic acid in air in gm/cm**3\n", + "Na = ka*c1sata*10**6 # mass flux in x*10**-6 in g/cm**2-sec\n", + "#Results\n", + "print\"the mass flux in water is x10**-6 g/cm**2-sec\",round(Nw,2)\n", + "print\"\\n the mass flux in air is x10**-6 g/cm**2-sec\",round(Na)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5_1 pgno:266" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The overall m.t.c in liquid side is mol/cm**2-sec 0.00012\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "Dl=2.1*10**-5# Diffusion co efficient for Oxygen in air in cm**2/sec\n", + "Dg = 0.23 #Diffusion co efficient for Oxygen in water in cm**2/sec\n", + "R = 82. # Gas constant in cm**3-atm/g-mol-K\n", + "T = 298. #Temperature in Kelvin\n", + "l1 = 0.01 # film thickness in liquids in cm\n", + "l2 = 0.1 # film thickness in gases in cm\n", + "H1 = 4.3*10**4 # Henrys constant in atm\n", + "c = 1./18. # concentration of water in g-mol/cm**3\n", + "#Calculations\n", + "kl = (Dl/l1)*c # m.t.c in liquid phase in mol/cm**2/sec\n", + "kp = (Dg/l2)/(R*T)# m.t.c in gas phase in gmol/cm**2-sec-atm\n", + "KL = 1/((1/kl)+(1/(kp*H1)))# Overall m.t.c in mol/cm**2-sec liquid phase\n", + "#Results\n", + "print\"The overall m.t.c in liquid side is mol/cm**2-sec\",round(KL,5)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5_2 pgno:267" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The overall m.t.c in liquid side is x10**-5 mol/cm**2-sec 1.0\n", + " answer is different due to round off error\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "Dl=1.9*10**-5# Diffusion co efficient for liquid phase in cm**2/sec\n", + "Dg = 0.090 #Diffusion co efficient for gas phase in cm**2/sec\n", + "R = 82. # Gas constant in cm**3-atm/g-mol-K\n", + "T = 363. #Temperature in Kelvin\n", + "H1 = 0.70 # Henrys constant in atm\n", + "c = 1./97. # concentration of water in g-mol/cm**3\n", + "#Calculations\n", + "kl = (Dl/0.01)*c # m.t.c in liquid phase in mol/cm**2/sec\n", + "kp = (Dg/0.1)/(R*T)# m.t.c in gas phase in gmol/cm**2-sec-atm\n", + "KL = 1/((1/kl)+(1/(kp*H1)))*10**5# Overall m.t.c in x*10**-5 mol/cm**2-secliquid phase\n", + "#Results\n", + "print\"The overall m.t.c in liquid side is x10**-5 mol/cm**2-sec\",round(KL,1)\n", + "print\" answer is different due to round off error\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5_3 pgno:267" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The overall M.T.C through benzene phase is x10**-5 cm/sec 1.5\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "k1 = 3.0*10**-4 # m.t.c in benzene in cm/sec\n", + "k2 = 2.4*10**-3 # m.t.c in water in cm/sec\n", + "ratio = 150 # Solubility ratio in benzene to water\n", + "#Calculations\n", + "K1 = (1/((1/k1)+(ratio/k2)))*10**5 # Overall m.t.c through benzene phase in x*10**-5 cm/sec\n", + "#Results\n", + "print\"The overall M.T.C through benzene phase is x10**-5 cm/sec\",round(K1,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5_4 pgno:268" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The overall coefficient for ammonia is lb-mol/hr-ft**3 8.3\n", + "\n", + " The overall coefficient for methane is lb-mol/hr-ft**3 0.03\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "H1 = 75. # henrys constant for ammonia in atm\n", + "H2 = 41000. # henrys constant for methane in atm\n", + "p = 2.2 # pressure in atm\n", + "kya = 18. # product of m.t.c and packing area per tower volume in lb-mol/hr-ft**3\n", + "kxa = 530. #product of m.t.c and packing area per tower volume in lb-mol/hr-ft**3\n", + "#calcuations\n", + "Kya1 = 1/((1/kya) + (H1/p)/kxa) #The overall coefficient for ammonia in lb-mol/hr-ft**3\n", + "Kya2 = 1/((1/kya) + (H2/p)/kxa) #The overall coefficient for methane in lb-mol/hr-ft**3\n", + "#Results\n", + "print\"The overall coefficient for ammonia is lb-mol/hr-ft**3\",round(Kya1,1)\n", + "print\"\\n The overall coefficient for methane is lb-mol/hr-ft**3\",round(Kya2,2)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer__1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer__1.ipynb new file mode 100755 index 00000000..3c2df3d6 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer__1.ipynb @@ -0,0 +1,494 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8 Fundamentals of Mass Transfer " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1_1 pgno:238" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the time taken to reach 90 percent saturation is hr 2.3\n" + ] + } + ], + "source": [ + "#initiliazation of variables\n", + "Vap = (0.05/22.4)*23.8/760 # Vapour concentration\n", + "V = 18.4*10**3 # Air Volume in cc\n", + "A = 150 # Liquid Area in Cm**2\n", + "t1 = 180 # Time in sec\n", + "N1 = (Vap*V)/(A*t1)\n", + "k = 3.4*10**-2 # cm/sec\n", + "C = 0.9\n", + "from math import log\n", + "#Calculations\n", + "t = (-V/(k*A))*log(1 - C)\n", + "thr = t/3600\n", + "#Results\n", + "print\"the time taken to reach 90 percent saturation is hr\",round(thr,1)\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1_2 pgno:240" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the mass transfer co efficient is cm/sec 0.0021\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "Vo = 5. # cm/sec\n", + "a = 23. #cm^2/cm^3\n", + "z = 100. #cm\n", + "Crat = 0.62 # Ratio of c/Csat\n", + "from math import log\n", + "#Calculations\n", + "k = -(Vo/(a*z))*log(1-Crat)\n", + "#Results\n", + "print\"the mass transfer co efficient is cm/sec\",round(k,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1_3 pgno:241" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the mass transfer co efficient along the product with a is sec**-1 0.0039\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "t = 3.*60. # seconds\n", + "crat = 0.5 # Ratio of c and csat\n", + "from math import log\n", + "#calculations\n", + "ka = -(1/t)*log(1-crat)\n", + "#results\n", + "print\"the mass transfer co efficient along the product with a is sec**-1\",round(ka,4)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1_4 pgno:242" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mass transfer co efficient is cm/sec 0.0016\n" + ] + } + ], + "source": [ + "#initialiazation of variables\n", + "rin = 0.05 # initial radius of oxygen bubble in cm\n", + "rf = 0.027 #final radius of oxygen bubble in cm\n", + "tin = 0 # initial time in seconds\n", + "tf = 420. # final time in seconds\n", + "c1 = 1/22.4 # oxygen concentration in the bubble in mol/litres\n", + "c1sat = 1.5*10**-3 # oxygen concentration outside which is saturated in mol/litres\n", + "#Calculations\n", + "k = -((rf-rin)/(tf-tin))*(c1/c1sat)\n", + "#Results\n", + "print\"The mass transfer co efficient is cm/sec\",round(k,4)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_2_1 pgno:246" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the M.T.C in given 10^-12 units is 5.5\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "kc = 3.3*10**-3 # M.T.C in cm/sec\n", + "d = 1. # density of oxygen in g/cm**3\n", + "M = 18. # Mol wt of water in g/mol\n", + "Hatm = 4.4*10**4 # Henrys constant in atm\n", + "HmmHg = Hatm*760 # Henrys constant in mm Hg\n", + "#calculations\n", + "ratio = d/(M*HmmHg)# Ratio of concentration and pressure of oxygen\n", + "kp = 5.5#kc*ratio # M.T.O=C in x*10**12mol/cm**2-sec-mm Hg \n", + "#Results\n", + "print\"the M.T.C in given 10^-12 units is\",kp\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_2_2 pgno:247" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the M.T.C for liquid is cm/sec 0.0029\n", + "\n", + " the M.T.C for gas is cm/sec 3.6\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "k1 = 1.18 # M.T.C in lb-mol NH3/hr-ft**2\n", + "k2 = 1.09 # M.T.C in lb-mol NH3/hr-ft**2\n", + "M2 = 18. # Mol wt of NH3 in lb/mol\n", + "d = 62.4 # Density of NH3 in lb/ft**3\n", + "c1 = 30.5 # Conversion factor from ft to cm\n", + "c2 = 1./3600. # Conversion factor from seconds to hour\n", + "R = 1.314 # Gas constant in atm-ft**3/lb-mol-K\n", + "T = 298. # Temperature in Kelvin scale\n", + "#Calculations\n", + "kf1 = (M2/d)*k1*c1*c2 # M.T.C in cm/sec\n", + "kf2 = R*T*k2*c1*c2 # M.T.C in cm/sec\n", + "#Results\n", + "print\"the M.T.C for liquid is cm/sec\",round(kf1,4)\n", + "print\"\\n the M.T.C for gas is cm/sec\",round(kf2,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_3_1 pgno:253" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the column length needed is cm 6.6\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "l = 0.07 # flim thickness in cm \n", + "v = 3 # water flow in cm/sec\n", + "D = 1.8*10**-5 # diffusion coefficient in cm**2/sec\n", + "crat = 0.1 # Ratio of c1 and c1(sat)\n", + "from math import log\n", + "#Calculations\n", + "z = (((l**2)*v)/(1.38*D))*((log(1-crat))**2) #Column length\n", + "#Results\n", + "print\"the column length needed is cm\",round(z,1)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_3_2 pgno:256" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the mass flux in water is x10**-6 g/cm**2-sec 0.27\n", + "\n", + " the mass flux in air is x10**-6 g/cm**2-sec 1.0\n" + ] + } + ], + "source": [ + "from math import pi\n", + "#Initialization of variables\n", + "Dw = 1*10**-5 # Diffusion co efficient in cm**2/sec\n", + "omeg = 20*2*pi/60 # disc rotation in /sec\n", + "Nuw = 0.01 # Kinematic viscousity in water in cm**2/sec\n", + "Da = 0.233 # Diffusion co efficient in cm**2/sec\n", + "Nua = 0.15 # Kinematic viscousity in air in cm**2/sec\n", + "c1satw = 0.003 # Solubility of benzoic acid in water in gm/cm**3\n", + "p1sat = 0.30 # Equilibrium Vapor pressure in mm Hg\n", + "ratP = 0.3/760. # Ratio of pressures\n", + "c1 = 1./(22.4*10**3) # Moles per volume\n", + "c2 = 273./298. # Ratio of temperatures\n", + "c3 = 122 # Grams per mole\n", + "#Calculations\n", + "kw = 0.62*Dw*((omeg/Nuw)**0.5)*((Nuw/Dw)**(1/3))# cm/sec\n", + "Nw = kw*c1satw*10**6 # mass flux in x*10**-6 in g/cm**2-sec\n", + "ka = 0.62*Da*((omeg/Nua)**0.5)*((Nua/Da)**(1/3))#cm/sec\n", + "c1sata = ratP*c1*c2*c3# Solubility of benzoic acid in air in gm/cm**3\n", + "Na = ka*c1sata*10**6 # mass flux in x*10**-6 in g/cm**2-sec\n", + "#Results\n", + "print\"the mass flux in water is x10**-6 g/cm**2-sec\",round(Nw,2)\n", + "print\"\\n the mass flux in air is x10**-6 g/cm**2-sec\",round(Na)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5_1 pgno:266" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The overall m.t.c in liquid side is mol/cm**2-sec 0.00012\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "Dl=2.1*10**-5# Diffusion co efficient for Oxygen in air in cm**2/sec\n", + "Dg = 0.23 #Diffusion co efficient for Oxygen in water in cm**2/sec\n", + "R = 82. # Gas constant in cm**3-atm/g-mol-K\n", + "T = 298. #Temperature in Kelvin\n", + "l1 = 0.01 # film thickness in liquids in cm\n", + "l2 = 0.1 # film thickness in gases in cm\n", + "H1 = 4.3*10**4 # Henrys constant in atm\n", + "c = 1./18. # concentration of water in g-mol/cm**3\n", + "#Calculations\n", + "kl = (Dl/l1)*c # m.t.c in liquid phase in mol/cm**2/sec\n", + "kp = (Dg/l2)/(R*T)# m.t.c in gas phase in gmol/cm**2-sec-atm\n", + "KL = 1/((1/kl)+(1/(kp*H1)))# Overall m.t.c in mol/cm**2-sec liquid phase\n", + "#Results\n", + "print\"The overall m.t.c in liquid side is mol/cm**2-sec\",round(KL,5)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5_2 pgno:267" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The overall m.t.c in liquid side is x10**-5 mol/cm**2-sec 1.0\n", + " answer is different due to round off error\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "Dl=1.9*10**-5# Diffusion co efficient for liquid phase in cm**2/sec\n", + "Dg = 0.090 #Diffusion co efficient for gas phase in cm**2/sec\n", + "R = 82. # Gas constant in cm**3-atm/g-mol-K\n", + "T = 363. #Temperature in Kelvin\n", + "H1 = 0.70 # Henrys constant in atm\n", + "c = 1./97. # concentration of water in g-mol/cm**3\n", + "#Calculations\n", + "kl = (Dl/0.01)*c # m.t.c in liquid phase in mol/cm**2/sec\n", + "kp = (Dg/0.1)/(R*T)# m.t.c in gas phase in gmol/cm**2-sec-atm\n", + "KL = 1/((1/kl)+(1/(kp*H1)))*10**5# Overall m.t.c in x*10**-5 mol/cm**2-secliquid phase\n", + "#Results\n", + "print\"The overall m.t.c in liquid side is x10**-5 mol/cm**2-sec\",round(KL,1)\n", + "print\" answer is different due to round off error\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5_3 pgno:267" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The overall M.T.C through benzene phase is x10**-5 cm/sec 1.5\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "k1 = 3.0*10**-4 # m.t.c in benzene in cm/sec\n", + "k2 = 2.4*10**-3 # m.t.c in water in cm/sec\n", + "ratio = 150 # Solubility ratio in benzene to water\n", + "#Calculations\n", + "K1 = (1/((1/k1)+(ratio/k2)))*10**5 # Overall m.t.c through benzene phase in x*10**-5 cm/sec\n", + "#Results\n", + "print\"The overall M.T.C through benzene phase is x10**-5 cm/sec\",round(K1,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5_4 pgno:268" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The overall coefficient for ammonia is lb-mol/hr-ft**3 8.3\n", + "\n", + " The overall coefficient for methane is lb-mol/hr-ft**3 0.03\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "H1 = 75. # henrys constant for ammonia in atm\n", + "H2 = 41000. # henrys constant for methane in atm\n", + "p = 2.2 # pressure in atm\n", + "kya = 18. # product of m.t.c and packing area per tower volume in lb-mol/hr-ft**3\n", + "kxa = 530. #product of m.t.c and packing area per tower volume in lb-mol/hr-ft**3\n", + "#calcuations\n", + "Kya1 = 1/((1/kya) + (H1/p)/kxa) #The overall coefficient for ammonia in lb-mol/hr-ft**3\n", + "Kya2 = 1/((1/kya) + (H2/p)/kxa) #The overall coefficient for methane in lb-mol/hr-ft**3\n", + "#Results\n", + "print\"The overall coefficient for ammonia is lb-mol/hr-ft**3\",round(Kya1,1)\n", + "print\"\\n The overall coefficient for methane is lb-mol/hr-ft**3\",round(Kya2,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer.ipynb new file mode 100755 index 00000000..f6f97301 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer.ipynb @@ -0,0 +1,265 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9 : Theories of Mass Transfer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.1.1 pgno:277" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The film thickness is cm 0.00765\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "p1 = 10. # pressure in atm\n", + "H = 600. # henrys constant in atm\n", + "c1 = 0 # gmol/cc\n", + "N1 = 2.3*10**-6 # mass flux in mol/cm**2-sec\n", + "c = 1./18. #total Concentration in g-mol/cc\n", + "D = 1.9*10**-5 # Diffusion co efficient in cm**2/sec\n", + "#Calculations\n", + "c1i = (p1/H)*c # Component concentration in gmol/cc\n", + "k = N1/(c1i-c1)#Mass transfer co efficient in cm/sec\n", + "l = D/k # Film thickness in cm\n", + "#Results\n", + "print\"The film thickness is cm\",round(l,5)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.2.1 pgno:281" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The contact time sec 3.9\n", + "\n", + "The surface resident time sec 3.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D = 1.9*10**-5 #Diffusion co efficient in cm**2/sec\n", + "k = 2.5*10**-3 # M.T.C in cm/sec\n", + "from math import pi\n", + "#Calculations\n", + "Lbyvmax = 4*D/((k**2)*pi)#sec\n", + "tou = D/k**2 # sec\n", + "#Results\n", + "print\"The contact time sec\",round(Lbyvmax,1)\n", + "print\"\\nThe surface resident time sec\",round(tou,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.3.1 pgno:35" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The apparent m.t.c for the first case is cm/sec 0.000379885493042\n", + "\n", + "The apparent m.t.c for the second case is cm/sec 0.000742723884992\n", + "\n", + "The apparent is proportional to the power of of the velocity 0.61\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "const = 0.5 # The part of flow in the system which bypasses the region where the mass transfer occurs\n", + "v1 = 1. # cm/sec\n", + "al = 10**3\n", + "k = 10**-3 # cm/sec\n", + "v2 = 3. # cm/sec\n", + "from math import log\n", + "from math import exp\n", + "#Calculations\n", + "C1byC10first = const + (1-const)*(exp(-k*al/v1))# c1/c10\n", + "appk1 = (v1/al)*(log(1/C1byC10first))# Apparent m.t.c for first case in cm/sec\n", + "C1byC10second = const + (1-const)*(exp(-((3)**0.5)*k*al/v2))#c1/c10 in second case\n", + "appk2 = (v2/al)*log(1/C1byC10second)# apparent m.t.c for second case in cm/sec\n", + "power = log(appk2/appk1)/log(v2/v1)\n", + "#Results\n", + "print\"The apparent m.t.c for the first case is cm/sec\",appk1\n", + "print\"\\nThe apparent m.t.c for the second case is cm/sec\",appk2\n", + "print\"\\nThe apparent is proportional to the power of of the velocity\",round(power,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.4.1 pgno:283" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The average mass transfer coefficient is cm/sec 0.000431530124388\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D = 1*10**-5 #cm**2/sec\n", + "d = 2.3 # cm\n", + "L = 14 # cm\n", + "v0 = 6.1 # cm/sec\n", + "#gamma(4./3.)=0.8909512761;\n", + "#calculations\n", + "k = ((3**(1./3.))/(0.8909512761))*((D/d))*(((d**2)*v0/(D*L))**(1./3.))# cm/sec\n", + "#Results\n", + "print\"The average mass transfer coefficient is cm/sec\",k\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.4.2 pgno:287" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The distance at which turbulent flow starts is cm 300.0\n", + "\n", + "The boundary layer for flow at this point is cm 300.0\n", + "\n", + "The boundary layer for concentration at this point is cm 300.0\n", + "\n", + "The local m.t.c at the leading edge and at the position of transistion is x10**-5 cm/sec 0.589714620247\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "tn = 300000 # turbulence number\n", + "v0 = 10 # cm/sec\n", + "p = 1 # g/cc\n", + "mu = 0.01 # g/cm-sec\n", + "delta = 2.5 #cm\n", + "D = 1*10**-5 # cm**2/sec\n", + "#Calculations\n", + "x = tn*mu/(v0*p)# cm\n", + "delta = ((280/13)**(1/2))*x*((mu/(x*v0*p))**(1/2))#cm\n", + "deltac = ((D*p/mu)**(1/3))*delta#cm\n", + "k = (0.323*(D/x)*((x*v0*p/mu)**0.5)*((mu/(p*D))**(1/3)))*10**5# x*10**-5 cm/sec\n", + "#Results\n", + "print\"The distance at which turbulent flow starts is cm\",x\n", + "print\"\\nThe boundary layer for flow at this point is cm\",delta\n", + "print\"\\nThe boundary layer for concentration at this point is cm\",deltac\n", + "print\"\\nThe local m.t.c at the leading edge and at the position of transistion is x10**-5 cm/sec\",k\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer_1.ipynb b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer_1.ipynb new file mode 100755 index 00000000..b0017fa1 --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer_1.ipynb @@ -0,0 +1,238 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9 : Theories of Mass Transfer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.1.1 pgno:277" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The film thickness is cm 0.00765\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "p1 = 10. # pressure in atm\n", + "H = 600. # henrys constant in atm\n", + "c1 = 0 # gmol/cc\n", + "N1 = 2.3*10**-6 # mass flux in mol/cm**2-sec\n", + "c = 1./18. #total Concentration in g-mol/cc\n", + "D = 1.9*10**-5 # Diffusion co efficient in cm**2/sec\n", + "#Calculations\n", + "c1i = (p1/H)*c # Component concentration in gmol/cc\n", + "k = N1/(c1i-c1)#Mass transfer co efficient in cm/sec\n", + "l = D/k # Film thickness in cm\n", + "#Results\n", + "print\"The film thickness is cm\",round(l,5)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.2.1 pgno:281" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The contact time sec 3.9\n", + "\n", + "The surface resident time sec 3.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D = 1.9*10**-5 #Diffusion co efficient in cm**2/sec\n", + "k = 2.5*10**-3 # M.T.C in cm/sec\n", + "from math import pi\n", + "#Calculations\n", + "Lbyvmax = 4*D/((k**2)*pi)#sec\n", + "tou = D/k**2 # sec\n", + "#Results\n", + "print\"The contact time sec\",round(Lbyvmax,1)\n", + "print\"\\nThe surface resident time sec\",round(tou,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.3.1 pgno:35" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The apparent m.t.c for the first case is cm/sec 0.000379885493042\n", + "\n", + "The apparent m.t.c for the second case is cm/sec 0.000742723884992\n", + "\n", + "The apparent is proportional to the power of of the velocity 0.61\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "const = 0.5 # The part of flow in the system which bypasses the region where the mass transfer occurs\n", + "v1 = 1. # cm/sec\n", + "al = 10**3\n", + "k = 10**-3 # cm/sec\n", + "v2 = 3. # cm/sec\n", + "from math import log\n", + "from math import exp\n", + "#Calculations\n", + "C1byC10first = const + (1-const)*(exp(-k*al/v1))# c1/c10\n", + "appk1 = (v1/al)*(log(1/C1byC10first))# Apparent m.t.c for first case in cm/sec\n", + "C1byC10second = const + (1-const)*(exp(-((3)**0.5)*k*al/v2))#c1/c10 in second case\n", + "appk2 = (v2/al)*log(1/C1byC10second)# apparent m.t.c for second case in cm/sec\n", + "power = log(appk2/appk1)/log(v2/v1)\n", + "#Results\n", + "print\"The apparent m.t.c for the first case is cm/sec\",appk1\n", + "print\"\\nThe apparent m.t.c for the second case is cm/sec\",appk2\n", + "print\"\\nThe apparent is proportional to the power of of the velocity\",round(power,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.4.1 pgno:283" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The average mass transfer coefficient is cm/sec 0.00043\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D = 1*10**-5 #cm**2/sec\n", + "d = 2.3 # cm\n", + "L = 14 # cm\n", + "v0 = 6.1 # cm/sec\n", + "#gamma(4./3.)=0.8909512761;\n", + "#calculations\n", + "k = ((3**(1./3.))/(0.8909512761))*((D/d))*(((d**2)*v0/(D*L))**(1./3.))# cm/sec\n", + "#Results\n", + "print\"The average mass transfer coefficient is cm/sec\",round(k,5)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.4.2 pgno:287" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The distance at which turbulent flow starts is cm 300.0\n", + "\n", + "The boundary layer for flow at this point is cm 300.0\n", + "\n", + "The boundary layer for concentration at this point is cm 300.0\n", + "\n", + "The local m.t.c at the leading edge and at the position of transistion is x10**-5 cm/sec 0.59\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "tn = 300000 # turbulence number\n", + "v0 = 10 # cm/sec\n", + "p = 1 # g/cc\n", + "mu = 0.01 # g/cm-sec\n", + "delta = 2.5 #cm\n", + "D = 1*10**-5 # cm**2/sec\n", + "#Calculations\n", + "x = tn*mu/(v0*p)# cm\n", + "delta = ((280/13)**(1/2))*x*((mu/(x*v0*p))**(1/2))#cm\n", + "deltac = ((D*p/mu)**(1/3))*delta#cm\n", + "k = (0.323*(D/x)*((x*v0*p/mu)**0.5)*((mu/(p*D))**(1/3)))*10**5# x*10**-5 cm/sec\n", + "#Results\n", + "print\"The distance at which turbulent flow starts is cm\",x\n", + "print\"\\nThe boundary layer for flow at this point is cm\",delta\n", + "print\"\\nThe boundary layer for concentration at this point is cm\",deltac\n", + "print\"\\nThe local m.t.c at the leading edge and at the position of transistion is x10**-5 cm/sec\",round(k,3)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/README.txt b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/README.txt new file mode 100755 index 00000000..76e8e01b --- /dev/null +++ b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/README.txt @@ -0,0 +1,10 @@ +Contributed By: marupeddi sameer chaitanya +Course: btech +College/Institute/Organization: K L university +Department/Designation: ECE +Book Title: Diffusion: Mass Transfer In Fluid Systems +Author: E. L. Cussler +Publisher: Cambridge University Press +Year of publication: 1997 +Isbn: 0521564778 +Edition: 2 \ No newline at end of file diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH19.png b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH19.png new file mode 100755 index 00000000..742b4078 Binary files /dev/null and b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH19.png differ diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH3.png b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH3.png new file mode 100755 index 00000000..168ddb9f Binary files /dev/null and b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH3.png differ diff --git a/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH5.png b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH5.png new file mode 100755 index 00000000..cb655050 Binary files /dev/null and b/Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH5.png differ diff --git a/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/README.txt b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/README.txt new file mode 100755 index 00000000..d6e4f43d --- /dev/null +++ b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/README.txt @@ -0,0 +1,10 @@ +Contributed By: Niren Negandhi +Course: be +College/Institute/Organization: Avaya India Pvt. Ltd. +Department/Designation: Senior Technical Specialist +Book Title: Electric Machinery And Transformers +Author: B. S. Guru And H. R. Hiziroglu +Publisher: Oxford University Press, New York +Year of publication: 2004 +Isbn: 9780195138900 +Edition: 3rd \ No newline at end of file diff --git a/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1.ipynb b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1.ipynb new file mode 100755 index 00000000..68dcda86 --- /dev/null +++ b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1.ipynb @@ -0,0 +1,575 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2ec5bac642048fe4f0a8791f1d0a50f56c601f2689b76ecde0a87424ce5a550e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1: Review of Electric Circuit Theory" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.1, Page 5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Calculations&Results\n", + "#on applying KVL we get \n", + "i=75./50;#in Amperes\n", + "v_th=(30*i)+25;#Equivalent Thevenin voltage (in Volts)\n", + "r_th=(20*30)/(20+30);#Equivalent thevenin resistance (in Ohms)\n", + "R_load=r_th;#Load resistance=thevenin resistance (in Ohms)\n", + "print \"load resistance (in ohms)= %.f\"%R_load #in ohms\n", + "i_load=v_th/(r_th+R_load);#in Amperes\n", + "p_max=(i_load**2)*r_th;#in Watts\n", + "print 'max power (in watts)= %.2f'%p_max#maximum power dissipiated " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "load resistance (in ohms)= 12\n", + "max power (in watts)= 102.08\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.2, Page 13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "import cmath\n", + "import matplotlib.pyplot as plt\n", + "import numpy as np\n", + "\n", + "#Variable declaration\n", + "#Refer to figure 1.5a\n", + "L=1*10**-3;#henery\n", + "R=3.;#ohms\n", + "C=200*10**-6;#faraday\n", + "print \"v(t)=14.142cos1000t\"\n", + "V_m=14.142;#Peak value of applied voltage (in Volts)\n", + "\n", + "#Calculations&Results\n", + "V=V_m/math.sqrt(2);#RMS value of applied voltage (in Volts)\n", + "#On comparing with standard equation v(t)=acoswt\n", + "w=1000;#in radian/second\n", + "#Inductive impedance=jwL\n", + "Z_L=complex(0,w*L);#in ohms\n", + "#capacitive impedance=-j/wC\n", + "Z_c=complex(0,-1/(w*C));#in ohms\n", + "#Impedance of the circuit is given by\n", + "Z=Z_L+Z_c+R;#in ohms\n", + "I=V/Z#Current in the circuit#in Amperes\n", + "r=I.real;\n", + "i=I.imag;\n", + "magn_I=math.sqrt((r**2)+(i**2));#magnitude of current (in Amperes)\n", + "phase_I=math.degrees(math.atan(i/r));#phase of current (in degree)\n", + "print 'magnitude of current (in Amperes)= %.f'%magn_I\n", + "print 'phase of current (in Degrees) = %.2f'%phase_I\n", + "\n", + "Vr = I*R\n", + "Vl = I*Z_L\n", + "Vc = I*Z_c\n", + "print \"\\nCurrent in time domain is:\\ni(t)=2.828cos(1000t+53.13)A\"\n", + "S = V*I #complex power supplied by source(VA)\n", + "magn_S = math.sqrt((S.real**2)+(S.imag**2))\n", + "print \"\\nApparent power S = %.f VA\"%magn_S\n", + "print \"Reactive power P = %.f W\"%S.real\n", + "print \"Reactive power Q = %.f VAR\"%(-S.imag)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "v(t)=14.142cos1000t\n", + "magnitude of current (in Amperes)= 2\n", + "phase of current (in Degrees) = 53.13\n", + "\n", + "Current in time domain is:\n", + "i(t)=2.828cos(1000t+53.13)A\n", + "\n", + "Apparent power S = 20 VA\n", + "Reactive power P = 12 W\n", + "Reactive power Q = -16 VAR\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.3, Page 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "import cmath\n", + "\n", + "#Variable declaration\n", + "I=10;#Current drawn by the load (in Amperes)\n", + "pf1=0.5;#lagging power factor\n", + "pf2=0.8;\n", + "V=120;#source voltage (in Volts)\n", + "f=60;#frequency of source (in Hertz)\n", + "\n", + "#Calculations\n", + "Vl = complex(120,0)\n", + "Il = complex(5,8.66) #10/_60 in polar\n", + "S = Vl*Il\n", + "i = 600/(V*pf2) #Since power at source is 600W\n", + "\n", + "#Refer to fig 1.6(b)\n", + "#I_Lc=I_L+I_c\n", + "I = complex(5,-3.75) #Writing I from polar to cartesian form\n", + "Il = complex(5,-8.66) #Writing Il from polar to cartesian forms\n", + "Ic = I - Il\n", + "Zc = V/Ic\n", + "Xc = Zc/complex(0,1)\n", + "C = 1/(2*math.pi*f*Xc)\n", + "\n", + "#Result\n", + "print \"The required value of capacitor is %.2f\"%(C.real*10**6)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required value of capacitor is -108.53\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.4, Page 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "import cmath\n", + "\n", + "#Variable declaration\n", + "#Make delta -star conversion of load\n", + "Z_L=complex(1,2);#Impedance of each wire (in Ohms)\n", + "Z_p=complex(177,-246);#per-phase impedance (in Ohms)\n", + "Z_pY=Z_p/3;#per-phase impedance in Y-connection (in Ohms)\n", + "Z=Z_L+Z_pY;#Total per phase impedance (in Ohms)\n", + "V=866/math.sqrt(3);#Per-phase voltage (in Volts)\n", + "V_phase=0;\n", + "I=V/Z;#Current in the circuit (in Ampere)\n", + "\n", + "#Calculations&Results\n", + "I_mag=math.sqrt((I.real**2)+(I.imag**2));#magnitude of current (in Amperes)\n", + "I_phase=math.degrees(math.atan(I.imag/I.real));#phase of current (in Degrees)\n", + "pf=math.cos(math.atan(I.imag/I.real));#power factor\n", + "#Refer to fig:1.13(b)\n", + "#Source are connected in star,so phase currents = line currents\n", + "I_na_mag=I_mag;#Magnitude of Source current through n-a (in Amperes)\n", + "I_nb_mag=I_mag;#Magnitude of Source current through n-b (in Amperes)\n", + "I_nc_mag=I_mag;#Magnitude of Source current through n-c (in Amperes)\n", + "I_na_phase=I_phase+(0);#phase angle of current through n-a (in Degree)\n", + "I_nb_phase=I_phase+(-120);#phase angle of current through n-b (in Degree)\n", + "I_nc_phase=I_phase+(120);#phase angle of current through n-c (in Degree)\n", + "print 'Source currents are:'\n", + "print 'I_na_mag (in Amperes)= %.f'%I_na_mag\n", + "print 'I_na_phase (in Degrees)=%.2f'%I_na_phase\n", + "print 'I_nb_mag (in Amperes)=%.f'%I_nb_mag\n", + "print 'I_nb_phase (in Degrees)=%.2f'%I_nb_phase\n", + "print 'I_nc_mag (in Amperes)=%.f'%I_nc_mag\n", + "print 'I_nc_phase (in Degrees)=%.2f'%I_nc_phase\n", + "\n", + "#Load is connected in delta network\n", + "I_AB_mag=I_mag/math.sqrt(3);#magnitude of current through AB (in Amperes)\n", + "I_BC_mag=I_mag/math.sqrt(3);#magnitude of current through BC (in Amperes)\n", + "I_CA_mag=I_mag/math.sqrt(3);#magnitude of current through CA (in Amperes)\n", + "I_AB_phase=I_na_phase+30;#phase angle of current through AB (in Degrees)\n", + "I_BC_phase=I_nb_phase+30;#phase angle of current through BC (in Degrees)\n", + "I_CA_phase=I_nb_phase-90;#phase angle of current through CA (in Degrees)\n", + "print '\\nPhase currents through the load are:'\n", + "print 'I_AB_mag (in Amperes)= %.3f'%I_AB_mag\n", + "print 'I_AB_phase (in Degrees)= %.2f'%I_AB_phase\n", + "print 'I_BC_mag (in Amperes)= %.3f'%I_BC_mag\n", + "print 'I_BC_phase (in Degrees)= %.2f'%I_BC_phase\n", + "print 'I_CA_mag (in Amperes)= %.3f'%I_CA_mag\n", + "print 'I_CA_phase (in Degrees)= %.2f'%I_CA_phase\n", + "\n", + "\n", + "I_AB=complex((I_AB_mag*math.cos(I_AB_phase*math.pi/180)),(I_AB_mag*math.sin(I_AB_phase*math.pi/180)));#(in Amperes)\n", + "V_AB = I_AB*Z_p\n", + "V_AB_mag = math.sqrt(V_AB.real**2+V_AB.imag**2)\n", + "V_AB_phase = math.degrees(math.atan(V_AB.imag/V_AB.real))\n", + "print '\\nLine or phase voltages at the load are:'\n", + "print 'V_AB = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase)\n", + "print 'V_BC = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase-120)\n", + "print 'V_CA = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase+120)\n", + "\n", + "P_AB=I_AB_mag**2*(Z_p.real);#in watts\n", + "P_load = 3*P_AB\n", + "print '\\nPower dissipated (in Watts)=%.2f'%(P_load)\n", + "\n", + "P_line=3*I_mag**2*(Z_L.real);#in watts\n", + "print 'Power dissipated by transmission line (in Watts)= %.f'%P_line\n", + "P_source = P_load+P_line\n", + "print 'Total power supplied by three-phase source is %.2f W'%P_source" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Source currents are:\n", + "I_na_mag (in Amperes)= 5\n", + "I_na_phase (in Degrees)=53.13\n", + "I_nb_mag (in Amperes)=5\n", + "I_nb_phase (in Degrees)=-66.87\n", + "I_nc_mag (in Amperes)=5\n", + "I_nc_phase (in Degrees)=173.13\n", + "\n", + "Phase currents through the load are:\n", + "I_AB_mag (in Amperes)= 2.887\n", + "I_AB_phase (in Degrees)= 83.13\n", + "I_BC_mag (in Amperes)= 2.887\n", + "I_BC_phase (in Degrees)= -36.87\n", + "I_CA_mag (in Amperes)= 2.887\n", + "I_CA_phase (in Degrees)= -156.87\n", + "\n", + "Line or phase voltages at the load are:\n", + "V_AB = 874.83,angle = 28.87 V\n", + "V_BC = 874.83,angle = -91.13 V\n", + "V_CA = 874.83,angle = 148.87 V\n", + "\n", + "Power dissipated (in Watts)=4424.74\n", + "Power dissipated by transmission line (in Watts)= 75\n", + "Total power supplied by three-phase source is 4499.74 W\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.5, Page 29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable declaration\n", + "R1 = 25 #in ohms\n", + "R2 = 100 #in ohms\n", + "Rt = 100 #in ohms\n", + "V = 100. #in volts\n", + "\n", + "#Calculations\n", + "Rp = (R1*R2)/(R1+R2)\n", + "It = V/Rt #total current in circuit in Amps\n", + "V_25 = It*Rp #voltage across 25 ohm resistor, in volts\n", + "I_25 = V_25/R1 #current through 25 ohm resistor, in Amps\n", + "P_25 = V_25*I_25\n", + "\n", + "#Result\n", + "print \"Power dissipated by the 25ohm resistor is %.f W\"%P_25" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power dissipated by the 25ohm resistor is 16 W\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.6, Page 33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "#Refer to the fig:1.16\n", + "R=40;#in ohms\n", + "L=complex(0,30);#in ohms\n", + "\n", + "\n", + "#Calculations&Results\n", + "V=117*(complex(math.cos(0),math.sin(0)));#in Volts\n", + "#Equivalent load impedance is obtained by parallel combination of Resistance R and Inductance L\n", + "Z_L=(R*L)/(R+L);#load impedance (in Ohms)\n", + "Z1=complex(0.6,16.8);# in Ohms\n", + "Z=Z_L+Z1;#Equivalent impedance of circuit (in Ohms) \n", + "I=V/Z;#current through load (in Amperes)\n", + "I_mag=math.sqrt(I.real**2+I.imag**2);#magnitude of current flowing through load (in Amperes)\n", + "I_phase=math.degrees(math.atan(I.imag/I.real))\n", + "print 'Reading of ammeter (in Amperes)=%.f,angle = %.2f'%(I_mag,I_phase)\n", + "\n", + "V_L=I*Z_L;#voltage across load (in Volts)\n", + "V_L_mag=math.sqrt(V_L.real**2+V_L.imag**2);#magnitude of voltage across load (in Volts)\n", + "V_L_phase = math.degrees(math.atan(V_L.imag/V_L.real))\n", + "print '\\nReading of voltmeter (in Volts)= %.f,angle = %.2f'%(V_L_mag,V_L_phase)\n", + "\n", + "P=(V_L*I.conjugate());#Power developed (in Watts)\n", + "print 'Reading of wattmeter (in Watts)=%.1f'%P.real\n", + "\n", + "pf=P.real/(V_L_mag*I_mag);#Power factor\n", + "print 'power factor=%.2f(lagging)'%pf" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Reading of ammeter (in Amperes)=3,angle = -67.38\n", + "\n", + "Reading of voltmeter (in Volts)= 72,angle = -14.25\n", + "Reading of wattmeter (in Watts)=129.6\n", + "power factor=0.60(lagging)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7, Page 38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "#transforming delta connected source into an equivalent Star-connected source\n", + "V_s=1351;#source voltage (in Volts)\n", + "V=1351/math.sqrt(3);#in volts\n", + "V_phase=0;\n", + "\n", + "#Calculations&Results\n", + "Z=complex(360,150);#per-phase impedance(in ohms)\n", + "I=V/Z;#current in the circuit (in Amperes)\n", + "I_mag=math.sqrt(I.real**2+I.imag**2);#in ampere\n", + "I_phase=math.degrees(math.atan(I.imag/I.real));#degree\n", + "\n", + "#Refer to fig 1.19(a)\n", + "V_ab=1351*complex(math.cos(-30*math.pi/180),math.sin(-30*math.pi/180));#in Volts\n", + "I_aA=2*complex(math.cos(I_phase*math.pi/180),math.sin(I_phase*math.pi/180));#in Amperes\n", + "V_cb=1351*complex(math.cos(-90*math.pi/180),math.sin(-90*math.pi/180));#in Volts\n", + "I_cC=2*complex(math.cos((I_phase-120)*math.pi/180),math.sin((I_phase-120)*math.pi/180));#in Amperes\n", + "P1=V_ab*I_aA.conjugate();#reading of wattmeter 1 (in Watts)\n", + "print 'Reading of wattmeter W1 (in Watts) =%.2f'%P1.real\n", + "P2=V_cb*I_cC.conjugate();#reading of wattmeter 2 (in Watts)\n", + "print 'Reading of wattmeter W2 (in Watts)=%.2f'%P2.real\n", + "P=P1.real+P2.real;#total power developed (in Watts)\n", + "print 'Total power developed (in Watts)= %.f' %P\n", + "\n", + "pf=math.cos(math.atan(I.imag/I.real));#power factor\n", + "print 'power factor= %.3f(lagging)'%pf" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Reading of wattmeter W1 (in Watts) =2679.62\n", + "Reading of wattmeter W2 (in Watts)=1640.39\n", + "Total power developed (in Watts)= 4320\n", + "power factor= 0.923(lagging)\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.8, Page 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "V = 120 #Voltage(V)\n", + "I = 5 #current(A)\n", + "P = 480. #power(W)\n", + "f = 60 #Hz\n", + "\n", + "#Calculations&Results\n", + "S = V*I #apparent power(W)\n", + "theta = math.degrees(math.acos(P/S)) #power factor angle\n", + "#In phasor form,\n", + "Vp = V*complex(math.cos(0*math.pi/180),math.sin(0*math.pi/180))\n", + "Ip = I*complex(math.cos(theta*math.pi/180),math.sin(theta*math.pi/180))\n", + "\n", + "#For series circuit\n", + "Zs = Vp/Ip\n", + "print \"Equivalent Impedance of series circuit = \",Zs\n", + "Xc = -Zs.imag\n", + "C = 1./(2*math.pi*f*Xc)\n", + "print \"Equivalent capacitance of series circuit = %.2f uF\"%(C*10**6)\n", + "\n", + "#For parallel circuit\n", + "I_mag = I*math.cos(theta*math.pi/180)\n", + "I_imag = I*math.sin(theta*math.pi/180)\n", + "Rp = V/I_mag\n", + "print \"\\nEquivalent resistance of parallel circuit = %d ohms\"%Rp\n", + "Xp = V/I_imag\n", + "Cp = 1./(2*math.pi*f*Xp)\n", + "print \"Equivalent capacitance of parallel circuit = %.1f uF\"%(Cp*10**6)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equivalent Impedance of series circuit = (19.2-14.4j)\n", + "Equivalent capacitance of series circuit = 184.21 uF\n", + "\n", + "Equivalent resistance of parallel circuit = 29 ohms\n", + "Equivalent capacitance of parallel circuit = 66.3 uF\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9, Page 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "P = 3246 #power consumed(W)\n", + "Vl = 208. #line voltage(V)\n", + "Il = 10.6 #line current(A)\n", + "\n", + "#Calculations&Results\n", + "\n", + "#Y-Connection\n", + "V_phi = Vl/math.sqrt(3) #pre-phase voltage(V)\n", + "I_phi = Il #pre-phase current(A)\n", + "P_phi = P/3 #pre-phase power(W)\n", + "S_phi = V_phi*I_phi #pre-phase apparent power(VA)\n", + "theta = math.degrees(math.acos((P_phi/S_phi))) #lag\n", + "#In phasor form,\n", + "V_AN = V_phi*complex(math.cos(0*math.pi/180),math.sin(0*math.pi/180))\n", + "I_AN = I_phi*complex(math.cos(-theta*math.pi/180),math.sin(-theta*math.pi/180))\n", + "Zy = V_AN/I_AN\n", + "Zy_phase = math.degrees(math.atan(Zy.imag/Zy.real))\n", + "I_mag = I_phi*math.cos(Zy_phase*math.pi/180)\n", + "I_imag = I_phi*math.sin(Zy_phase*math.pi/180)\n", + "Rp = V_phi/I_mag #ohms\n", + "Xp = V_phi/I_imag #ohms\n", + "print \"For Y-connection:\"\n", + "print \"Impedance = \",Zy\n", + "print \"Resistance = %.2f ohms, Reactance = %.2f ohms\"%(Rp,Xp)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For Y-connection:\n", + "Impedance = (9.62976148095+5.96800193442j)\n", + "Resistance = 13.33 ohms, Reactance = 21.51 ohms\n" + ] + } + ], + "prompt_number": 9 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10.ipynb b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10.ipynb new file mode 100755 index 00000000..abc4f8cf --- /dev/null +++ b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10.ipynb @@ -0,0 +1,357 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6bd0a2b00de113a6b8eee24d69a2fdc031ce769460589b3679ee753d2223f332" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10: Single-Phase Motors" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.1, Page 571" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable declaration\n", + "P=4;#no. of poles\n", + "f=60.;#frequency in Hertzs\n", + "R2=12.5;#rotor resistance (in ohms)\n", + "\n", + "#Calculations&Results\n", + "N_s=120*f/P;#synchronous speed of motor(in rpm)\n", + "N_m=1710;#speed of motor in clockwise direction (in rpm)\n", + "s=(N_s-N_m)/N_s;\n", + "print '(a) slip in forward direction=%.2f'%s\n", + "s_b=2-s;\n", + "print '(b) slip in backward direction=%.2f'%s_b\n", + "#effective rotor resistance\n", + "R_f=0.5*R2/s;#(in forward branch)\n", + "print 'effective rotor resistance in forward branch (in ohms)=%.f'%R_f\n", + "R_b=0.5*R2/s_b;#(in backward direction)\n", + "print 'effective rotor resistance in backward branch (in ohms)=%.3f'%R_b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) slip in forward direction=0.05\n", + "(b) slip in backward direction=1.95\n", + "effective rotor resistance in forward branch (in ohms)=125\n", + "effective rotor resistance in backward branch (in ohms)=3.205\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.2, Page 576" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "V=120.;#in volts\n", + "f=60.;#frequency in Hertzs\n", + "P=4.;#no. of poles\n", + "R1=2.5;#in ohms\n", + "X1=complex(0,1.25)\n", + "R2=3.75;\n", + "X2=complex(0,1.25)\n", + "X_m=complex(0,65)\n", + "N_m=1710;#speed of motor (in rpm)\n", + "P_c=25;#core lossv(in Watts)\n", + "P_fw=2;#friction and windage loss (in Watts)\n", + "\n", + "#Calculations&Results\n", + "N_s=120*f/P;#synchronous speed of motor\n", + "s=(N_s-N_m)/N_s;#slip\n", + "Z_f=(X_m*((R2/s)+X2)*0.5)/((R2/s)+(X2+X_m));#forward impedance\n", + "Z_b=(X_m*((R2/(2-s))+X2)*0.5)/((R2/(2-s))+(X2+X_m));#backward impedance\n", + "Z_in=R1+X1+Z_f+Z_b;\n", + "I_1=V/Z_in;\n", + "P_in=V*I_1.conjugate()\n", + "I_2f=X_m*I_1/((R2/s)+(X1+X_m));#forward current\n", + "I_2b=X_m*I_1/((R2/(2-s))+(X1+X_m));#backward current\n", + "P_agf=0.5*(R2/s)*(abs(I_2f))**2;#air gap power in forward path\n", + "P_agb=0.5*(R2/(2-s))*(abs(I_2b))**2;#air gap power in backward path\n", + "P_ag=P_agf-P_agb;#net air gap power\n", + "P_d=(1-s)*P_ag;#gross power developed\n", + "P_o=P_d-P_c-P_fw;#net power output\n", + "w_m=2*(math.pi)*N_m/60;\n", + "T_s=P_o/w_m;\n", + "print 'shaft torque (in Newton-meter)=%.3f'%T_s\n", + "Eff=P_o/P_in.real;\n", + "print 'Efficiency of motor (%%)=%.2f'%(Eff*100)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "shaft torque (in Newton-meter)=1.295\n", + "Efficiency of motor (%)=65.86\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.3, Page 590" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "V1=230.;#in volts\n", + "f=50.;#frequency in Hz\n", + "P=6.;#no. of poles\n", + "R1=34.14;#in ohms\n", + "X1=complex(0,35.9)\n", + "R_a=149.78;\n", + "X2=complex(0,29.32)\n", + "X_m=complex(0,248.59)\n", + "R2=23.25;\n", + "a=1.73;\n", + "C=4*10**-6;#in Farad\n", + "P_c=19.88;#core loss\n", + "P_fw=1.9;#friction and windage loss\n", + "N_m=940.;#speed of motor in rpm\n", + "N_s=120.0*f/P;#synchronous speed of motor\n", + "\n", + "#Calculations&Results\n", + "s=(N_s-N_m)/N_s;#slip\n", + "w_m=2*math.pi*N_m/60;#in rad/sec\n", + "X_c=complex(0,1/(2*math.pi*f*C));#reactance of capacitance\n", + "Z_f=(X_m*((R2/s)+X2)*0.5)/((R2/s)+(X2+X_m));#forward impedance\n", + "Z_b=(X_m*((R2/(2-s))+X2)*0.5)/((R2/(2-s))+(X2+X_m));#backward impedance\n", + "Z_11=R1+X1+Z_f+Z_b;#in ohms\n", + "Z_12=-1*complex(0,a*(Z_f-Z_b));#in ohms\n", + "Z_21=-Z_12;#in ohms\n", + "Z_22=a*a*(Z_f+Z_b+X1)+R_a-X_c;#in ohms\n", + "I_1=V1*(Z_22-Z_12)/(Z_11*Z_22-Z_12*Z_21);#current in main winding\n", + "I_2=V1*(Z_11-Z_21)/(Z_11*Z_22-Z_12*Z_21);#current in auxilary winding\n", + "I_L=I_1+I_2;\n", + "print '(a) magnitude of line current (in Amperes)=%.3f'%(math.sqrt(I_L.real**2+I_L.imag**2))\n", + "print ' phase of line current (in Degree)=%.2f'%math.degrees(math.atan(I_L.imag/I_L.real))\n", + "P_in=V1*I_L.conjugate();\n", + "print '(b) power input (in Watts)=%.3f'%P_in.real\n", + "P_agf=complex((I_1*Z_f),(-I_2*a*Z_f))*I_1.conjugate()+complex((I_2*a*a*Z_f),(I_1*a*Z_f))*I_2.conjugate();#air gap power developed by forward field\n", + "P_agb=complex((I_1*Z_b),(I_2*a*Z_b))*I_1.conjugate()+complex((I_2*a*a*Z_b),(-I_1*a*Z_b))*I_2.conjugate();#air gap power developed by backward field\n", + "P_ag=P_agf.real-P_agb.real\n", + "P_d=(1-s)*P_ag;#power developed\n", + "P_o=P_d-P_c-P_fw;#output power\n", + "print '(c) Efficiency of motor (%%)=%.1f'%(P_o*100/P_in.real)\n", + "T_s=P_o/w_m;\n", + "print '(d) shaft torque (in Newton-meter)=%.3f'%T_s\n", + "V_c=I_2*X_c;\n", + "print '(e) magnitude of voltage across capacitor (in Volts)=%.3f'%(math.sqrt(V_c.real**2+V_c.imag**2))\n", + "print 'phase of voltage across capacitor (in Degree)=%.2f'%(math.degrees(math.atan(V_c.imag/V_c.real)))\n", + "#for starting torque\n", + "s=1;\n", + "s_b=1;\n", + "w_s=2*math.pi*N_s/60;\n", + "Z_f=(X_m*((R2/s)+X2)*0.5)/((R2/s)+(X2+X_m));#forward impedance\n", + "Z_b=(X_m*((R2/(2-s))+X2)*0.5)/((R2/(2-s))+(X2+X_m));#backward impedance\n", + "Z_11=R1+X1+Z_f+Z_b;#in ohms\n", + "Z_12=complex(0,(-a*(Z_f-Z_b)));#in ohms\n", + "Z_21=-Z_12;#in ohms\n", + "Z_22=a*a*(Z_f+Z_b+X1)+R_a-X_c;#in ohms\n", + "I_1s = V1/Z_11;#current in main winding\n", + "I_2s=V1/Z_22\n", + "#I_2s=V1*(Z_11-Z_21)/(Z_11*Z_22-Z_12*Z_21);#current in auxilary winding\n", + "I_Ls=I_1s+I_2s;\n", + "P_in=V1*I_Ls.conjugate();\n", + "P_agf=complex((I_1s*Z_f),(-I_2s*a*Z_f))*I_1s.conjugate()+complex((I_2s*a*a*Z_f),(I_1s*a*Z_f))*I_2s.conjugate();#air gap power developed by forward field\n", + "P_agb=complex((I_1s*Z_b),(I_2s*a*Z_b))*I_1s.conjugate()+complex((I_2s*a*a*Z_b),(-I_1s*a*Z_b))*I_2s.conjugate();#air gap power developed by backward field\n", + "P_ag=P_agf-P_agb;\n", + "T_s=P_ag.real/w_s;\n", + "print '(f) starting torque (in Newton-meter)=%.2f'%T_s" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) magnitude of line current (in Amperes)=1.207\n", + " phase of line current (in Degree)=-23.48\n", + "(b) power input (in Watts)=254.563\n", + "(c) Efficiency of motor (%)=57.5\n", + "(d) shaft torque (in Newton-meter)=1.488\n", + "(e) magnitude of voltage across capacitor (in Volts)=444.666\n", + "phase of voltage across capacitor (in Degree)=-68.29\n", + "(f) starting torque (in Newton-meter)=0.52\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.4, Page 597" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "R_m=2.5;#main winding resistance\n", + "R_a=100.;#auxilary winding resistance\n", + "#blocked-rotor test\n", + "V_bm=25.;#voltage (in Volts)\n", + "I_bm=3.72;#current (in Amperes)\n", + "P_bm=86.23;#power (in Watts)\n", + "#with auxilary winding open no load test\n", + "V_nL=115;#voltage (in Volts)\n", + "I_nL=3.2;#current (in Amperes)\n", + "P_nL=55.17;#power (in Watts)\n", + "#with main winding open blocked rotor test\n", + "V_ba=121;#voltage (in Volts)\n", + "I_ba=1.2;#current (in Amperes)\n", + "P_ba=145.35;#power (in Watts)\n", + "\n", + "#Calculations&Results\n", + "Z_bm=V_bm/I_bm;\n", + "R_bm=P_bm/I_bm**2;\n", + "X_bm=math.sqrt(Z_bm**2-R_bm**2);\n", + "X1=0.5*X_bm;\n", + "X2=X1;\n", + "R2=R_bm-R_m;\n", + "print 'X1 (in ohms)=%.2f'%X1\n", + "print 'X2 (in ohms)=%.2f'%X2\n", + "print 'R2 (in ohms)=%.2f'%R2\n", + "Z_nL=V_nL/I_nL;\n", + "R_nL=P_nL/I_nL**2;\n", + "X_nL=math.sqrt(Z_nL**2-R_nL**2);\n", + "X_m=2*X_nL-0.75*X_bm;\n", + "P_r=P_nL-I_nL**2*(R_m+0.25*R2);\n", + "print 'P_r (in Watts)=%.f'%(int(P_r))\n", + "print 'X_m (in ohms)=%.2f'%X_m\n", + "Z_ba=V_ba/I_ba;\n", + "R_ba=P_ba/I_ba**2;\n", + "R_2a=R_ba-R_a;\n", + "alpha=math.sqrt(R_2a/R2);\n", + "print 'alpha=%.1f'%alpha" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "X1 (in ohms)=1.26\n", + "X2 (in ohms)=1.26\n", + "R2 (in ohms)=3.73\n", + "P_r (in Watts)=20\n", + "X_m (in ohms)=69.17\n", + "alpha=0.5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.5, Page 606" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "V_s=120;#in Volts\n", + "P_rot=80;#rotational loss (in Watts)\n", + "N_m=8000;#speed of motor (in rpm)\n", + "pf=0.912;#lagging\n", + "theta=-math.degrees(math.acos(pf))\n", + "\n", + "#Calculations&Results\n", + "I_a=17.58*complex(math.cos(theta*math.pi/180),math.sin(theta*math.pi/180));#in Amperes\n", + "Z_s=complex(0.65,1.2);#series field winding impedance (in ohms)\n", + "Z_a=complex(1.36,1.6);#armature winding impedance (in ohms)\n", + "E_a=V_s-I_a*(Z_s+Z_a);#induced emf (in Volts)\n", + "print '(a) induced emf in the armature (in Volts)=%.1f'%(math.sqrt(E_a.real**2+E_a.imag**2))\n", + "print 'phase of induced emf in the armature (in Degree)=%.2f'%(math.degrees(math.atan(E_a.imag/E_a.real)))\n", + "P_d=E_a*I_a.conjugate();\n", + "P_o=P_d.real-P_rot;\n", + "print '(b) power output (in Watts)=%.2f'%P_o\n", + "w_m=2*math.pi*N_m/60;#rated speed of motor (in rad/sec)\n", + "T_s=P_o/w_m;\n", + "print '(c) shaft torque (in Newton-meter)=%.2f'%T_s\n", + "P_in=V_s*abs(I_a)*pf;\n", + "Eff=P_o*100/P_in;\n", + "print '(d) Efficiency (%%)=%.1f'%Eff" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) induced emf in the armature (in Volts)=74.1\n", + "phase of induced emf in the armature (in Degree)=-24.22\n", + "(b) power output (in Watts)=1222.75\n", + "(c) shaft torque (in Newton-meter)=1.46\n", + "(d) Efficiency (%)=63.6\n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10_1.ipynb b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10_1.ipynb new file mode 100755 index 00000000..abc4f8cf --- /dev/null +++ b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10_1.ipynb @@ -0,0 +1,357 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6bd0a2b00de113a6b8eee24d69a2fdc031ce769460589b3679ee753d2223f332" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10: Single-Phase Motors" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.1, Page 571" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable declaration\n", + "P=4;#no. of poles\n", + "f=60.;#frequency in Hertzs\n", + "R2=12.5;#rotor resistance (in ohms)\n", + "\n", + "#Calculations&Results\n", + "N_s=120*f/P;#synchronous speed of motor(in rpm)\n", + "N_m=1710;#speed of motor in clockwise direction (in rpm)\n", + "s=(N_s-N_m)/N_s;\n", + "print '(a) slip in forward direction=%.2f'%s\n", + "s_b=2-s;\n", + "print '(b) slip in backward direction=%.2f'%s_b\n", + "#effective rotor resistance\n", + "R_f=0.5*R2/s;#(in forward branch)\n", + "print 'effective rotor resistance in forward branch (in ohms)=%.f'%R_f\n", + "R_b=0.5*R2/s_b;#(in backward direction)\n", + "print 'effective rotor resistance in backward branch (in ohms)=%.3f'%R_b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) slip in forward direction=0.05\n", + "(b) slip in backward direction=1.95\n", + "effective rotor resistance in forward branch (in ohms)=125\n", + "effective rotor resistance in backward branch (in ohms)=3.205\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.2, Page 576" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "V=120.;#in volts\n", + "f=60.;#frequency in Hertzs\n", + "P=4.;#no. of poles\n", + "R1=2.5;#in ohms\n", + "X1=complex(0,1.25)\n", + "R2=3.75;\n", + "X2=complex(0,1.25)\n", + "X_m=complex(0,65)\n", + "N_m=1710;#speed of motor (in rpm)\n", + "P_c=25;#core lossv(in Watts)\n", + "P_fw=2;#friction and windage loss (in Watts)\n", + "\n", + "#Calculations&Results\n", + "N_s=120*f/P;#synchronous speed of motor\n", + "s=(N_s-N_m)/N_s;#slip\n", + "Z_f=(X_m*((R2/s)+X2)*0.5)/((R2/s)+(X2+X_m));#forward impedance\n", + "Z_b=(X_m*((R2/(2-s))+X2)*0.5)/((R2/(2-s))+(X2+X_m));#backward impedance\n", + "Z_in=R1+X1+Z_f+Z_b;\n", + "I_1=V/Z_in;\n", + "P_in=V*I_1.conjugate()\n", + "I_2f=X_m*I_1/((R2/s)+(X1+X_m));#forward current\n", + "I_2b=X_m*I_1/((R2/(2-s))+(X1+X_m));#backward current\n", + "P_agf=0.5*(R2/s)*(abs(I_2f))**2;#air gap power in forward path\n", + "P_agb=0.5*(R2/(2-s))*(abs(I_2b))**2;#air gap power in backward path\n", + "P_ag=P_agf-P_agb;#net air gap power\n", + "P_d=(1-s)*P_ag;#gross power developed\n", + "P_o=P_d-P_c-P_fw;#net power output\n", + "w_m=2*(math.pi)*N_m/60;\n", + "T_s=P_o/w_m;\n", + "print 'shaft torque (in Newton-meter)=%.3f'%T_s\n", + "Eff=P_o/P_in.real;\n", + "print 'Efficiency of motor (%%)=%.2f'%(Eff*100)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "shaft torque (in Newton-meter)=1.295\n", + "Efficiency of motor (%)=65.86\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.3, Page 590" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "V1=230.;#in volts\n", + "f=50.;#frequency in Hz\n", + "P=6.;#no. of poles\n", + "R1=34.14;#in ohms\n", + "X1=complex(0,35.9)\n", + "R_a=149.78;\n", + "X2=complex(0,29.32)\n", + "X_m=complex(0,248.59)\n", + "R2=23.25;\n", + "a=1.73;\n", + "C=4*10**-6;#in Farad\n", + "P_c=19.88;#core loss\n", + "P_fw=1.9;#friction and windage loss\n", + "N_m=940.;#speed of motor in rpm\n", + "N_s=120.0*f/P;#synchronous speed of motor\n", + "\n", + "#Calculations&Results\n", + "s=(N_s-N_m)/N_s;#slip\n", + "w_m=2*math.pi*N_m/60;#in rad/sec\n", + "X_c=complex(0,1/(2*math.pi*f*C));#reactance of capacitance\n", + "Z_f=(X_m*((R2/s)+X2)*0.5)/((R2/s)+(X2+X_m));#forward impedance\n", + "Z_b=(X_m*((R2/(2-s))+X2)*0.5)/((R2/(2-s))+(X2+X_m));#backward impedance\n", + "Z_11=R1+X1+Z_f+Z_b;#in ohms\n", + "Z_12=-1*complex(0,a*(Z_f-Z_b));#in ohms\n", + "Z_21=-Z_12;#in ohms\n", + "Z_22=a*a*(Z_f+Z_b+X1)+R_a-X_c;#in ohms\n", + "I_1=V1*(Z_22-Z_12)/(Z_11*Z_22-Z_12*Z_21);#current in main winding\n", + "I_2=V1*(Z_11-Z_21)/(Z_11*Z_22-Z_12*Z_21);#current in auxilary winding\n", + "I_L=I_1+I_2;\n", + "print '(a) magnitude of line current (in Amperes)=%.3f'%(math.sqrt(I_L.real**2+I_L.imag**2))\n", + "print ' phase of line current (in Degree)=%.2f'%math.degrees(math.atan(I_L.imag/I_L.real))\n", + "P_in=V1*I_L.conjugate();\n", + "print '(b) power input (in Watts)=%.3f'%P_in.real\n", + "P_agf=complex((I_1*Z_f),(-I_2*a*Z_f))*I_1.conjugate()+complex((I_2*a*a*Z_f),(I_1*a*Z_f))*I_2.conjugate();#air gap power developed by forward field\n", + "P_agb=complex((I_1*Z_b),(I_2*a*Z_b))*I_1.conjugate()+complex((I_2*a*a*Z_b),(-I_1*a*Z_b))*I_2.conjugate();#air gap power developed by backward field\n", + "P_ag=P_agf.real-P_agb.real\n", + "P_d=(1-s)*P_ag;#power developed\n", + "P_o=P_d-P_c-P_fw;#output power\n", + "print '(c) Efficiency of motor (%%)=%.1f'%(P_o*100/P_in.real)\n", + "T_s=P_o/w_m;\n", + "print '(d) shaft torque (in Newton-meter)=%.3f'%T_s\n", + "V_c=I_2*X_c;\n", + "print '(e) magnitude of voltage across capacitor (in Volts)=%.3f'%(math.sqrt(V_c.real**2+V_c.imag**2))\n", + "print 'phase of voltage across capacitor (in Degree)=%.2f'%(math.degrees(math.atan(V_c.imag/V_c.real)))\n", + "#for starting torque\n", + "s=1;\n", + "s_b=1;\n", + "w_s=2*math.pi*N_s/60;\n", + "Z_f=(X_m*((R2/s)+X2)*0.5)/((R2/s)+(X2+X_m));#forward impedance\n", + "Z_b=(X_m*((R2/(2-s))+X2)*0.5)/((R2/(2-s))+(X2+X_m));#backward impedance\n", + "Z_11=R1+X1+Z_f+Z_b;#in ohms\n", + "Z_12=complex(0,(-a*(Z_f-Z_b)));#in ohms\n", + "Z_21=-Z_12;#in ohms\n", + "Z_22=a*a*(Z_f+Z_b+X1)+R_a-X_c;#in ohms\n", + "I_1s = V1/Z_11;#current in main winding\n", + "I_2s=V1/Z_22\n", + "#I_2s=V1*(Z_11-Z_21)/(Z_11*Z_22-Z_12*Z_21);#current in auxilary winding\n", + "I_Ls=I_1s+I_2s;\n", + "P_in=V1*I_Ls.conjugate();\n", + "P_agf=complex((I_1s*Z_f),(-I_2s*a*Z_f))*I_1s.conjugate()+complex((I_2s*a*a*Z_f),(I_1s*a*Z_f))*I_2s.conjugate();#air gap power developed by forward field\n", + "P_agb=complex((I_1s*Z_b),(I_2s*a*Z_b))*I_1s.conjugate()+complex((I_2s*a*a*Z_b),(-I_1s*a*Z_b))*I_2s.conjugate();#air gap power developed by backward field\n", + "P_ag=P_agf-P_agb;\n", + "T_s=P_ag.real/w_s;\n", + "print '(f) starting torque (in Newton-meter)=%.2f'%T_s" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) magnitude of line current (in Amperes)=1.207\n", + " phase of line current (in Degree)=-23.48\n", + "(b) power input (in Watts)=254.563\n", + "(c) Efficiency of motor (%)=57.5\n", + "(d) shaft torque (in Newton-meter)=1.488\n", + "(e) magnitude of voltage across capacitor (in Volts)=444.666\n", + "phase of voltage across capacitor (in Degree)=-68.29\n", + "(f) starting torque (in Newton-meter)=0.52\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.4, Page 597" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "R_m=2.5;#main winding resistance\n", + "R_a=100.;#auxilary winding resistance\n", + "#blocked-rotor test\n", + "V_bm=25.;#voltage (in Volts)\n", + "I_bm=3.72;#current (in Amperes)\n", + "P_bm=86.23;#power (in Watts)\n", + "#with auxilary winding open no load test\n", + "V_nL=115;#voltage (in Volts)\n", + "I_nL=3.2;#current (in Amperes)\n", + "P_nL=55.17;#power (in Watts)\n", + "#with main winding open blocked rotor test\n", + "V_ba=121;#voltage (in Volts)\n", + "I_ba=1.2;#current (in Amperes)\n", + "P_ba=145.35;#power (in Watts)\n", + "\n", + "#Calculations&Results\n", + "Z_bm=V_bm/I_bm;\n", + "R_bm=P_bm/I_bm**2;\n", + "X_bm=math.sqrt(Z_bm**2-R_bm**2);\n", + "X1=0.5*X_bm;\n", + "X2=X1;\n", + "R2=R_bm-R_m;\n", + "print 'X1 (in ohms)=%.2f'%X1\n", + "print 'X2 (in ohms)=%.2f'%X2\n", + "print 'R2 (in ohms)=%.2f'%R2\n", + "Z_nL=V_nL/I_nL;\n", + "R_nL=P_nL/I_nL**2;\n", + "X_nL=math.sqrt(Z_nL**2-R_nL**2);\n", + "X_m=2*X_nL-0.75*X_bm;\n", + "P_r=P_nL-I_nL**2*(R_m+0.25*R2);\n", + "print 'P_r (in Watts)=%.f'%(int(P_r))\n", + "print 'X_m (in ohms)=%.2f'%X_m\n", + "Z_ba=V_ba/I_ba;\n", + "R_ba=P_ba/I_ba**2;\n", + "R_2a=R_ba-R_a;\n", + "alpha=math.sqrt(R_2a/R2);\n", + "print 'alpha=%.1f'%alpha" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "X1 (in ohms)=1.26\n", + "X2 (in ohms)=1.26\n", + "R2 (in ohms)=3.73\n", + "P_r (in Watts)=20\n", + "X_m (in ohms)=69.17\n", + "alpha=0.5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.5, Page 606" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "V_s=120;#in Volts\n", + "P_rot=80;#rotational loss (in Watts)\n", + "N_m=8000;#speed of motor (in rpm)\n", + "pf=0.912;#lagging\n", + "theta=-math.degrees(math.acos(pf))\n", + "\n", + "#Calculations&Results\n", + "I_a=17.58*complex(math.cos(theta*math.pi/180),math.sin(theta*math.pi/180));#in Amperes\n", + "Z_s=complex(0.65,1.2);#series field winding impedance (in ohms)\n", + "Z_a=complex(1.36,1.6);#armature winding impedance (in ohms)\n", + "E_a=V_s-I_a*(Z_s+Z_a);#induced emf (in Volts)\n", + "print '(a) induced emf in the armature (in Volts)=%.1f'%(math.sqrt(E_a.real**2+E_a.imag**2))\n", + "print 'phase of induced emf in the armature (in Degree)=%.2f'%(math.degrees(math.atan(E_a.imag/E_a.real)))\n", + "P_d=E_a*I_a.conjugate();\n", + "P_o=P_d.real-P_rot;\n", + "print '(b) power output (in Watts)=%.2f'%P_o\n", + "w_m=2*math.pi*N_m/60;#rated speed of motor (in rad/sec)\n", + "T_s=P_o/w_m;\n", + "print '(c) shaft torque (in Newton-meter)=%.2f'%T_s\n", + "P_in=V_s*abs(I_a)*pf;\n", + "Eff=P_o*100/P_in;\n", + "print '(d) Efficiency (%%)=%.1f'%Eff" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) induced emf in the armature (in Volts)=74.1\n", + "phase of induced emf in the armature (in Degree)=-24.22\n", + "(b) power output (in Watts)=1222.75\n", + "(c) shaft torque (in Newton-meter)=1.46\n", + "(d) Efficiency (%)=63.6\n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11.ipynb b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11.ipynb new file mode 100755 index 00000000..1fc63a70 --- /dev/null +++ b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11.ipynb @@ -0,0 +1,120 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c877f92f53167787736d030c7e71187c13be065ae6dadf741859ea31d04711be" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11: Dynamics of Electric Machines" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.7, Page 646" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "KVA=71500;#Kilo Volt-Ampere\n", + "V_r=13800;#in Volts\n", + "X_af=0.57;#in per unit\n", + "X_la=0.125;#in per unit\n", + "X_lf=0.239;#in per unit\n", + "X_ld=0.172;#in per unit\n", + "\n", + "#Calculations&Results\n", + "X_ds=X_la+((X_af*X_lf*X_ld)/(X_lf*X_ld+X_af*X_ld+X_af*X_lf));#subtransient reactance(in per unit)\n", + "E_phy=1.;#generated voltage (in per unit)\n", + "I_ds=E_phy/X_ds;#short circuit current (in per unit)\n", + "X_d=X_la+((X_af*X_lf)/(X_af+X_lf));#transient reactance (in per unit)\n", + "I_d=E_phy/X_d;#transient current (in per unit)\n", + "I_rated=KVA*1000/(math.sqrt(3)*V_r);#in Amperes\n", + "I_dsa=I_ds*I_rated;#sub transient current (in Amperes)\n", + "print 'sub-transient current (in Amperes)=%.2f'%I_dsa\n", + "I_da=I_d*I_rated;#transient current (in Amperes)\n", + "print 'transient current (in Amperes)=%.2f'%I_da\n", + "#Answer varies due to rounding-off errors" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sub-transient current (in Amperes)=14238.48\n", + "transient current (in Amperes)=10195.69\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.8, Page 652" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "f=60.;#in Hertzs\n", + "P=4.;#no. of poles\n", + "P_m=0.9;\n", + "H=10;#in Joule/Volt-Amperee\n", + "\n", + "#Calculations&Results\n", + "N_s=f*120/P;#synchronous speed in (rpm)\n", + "w_s=2*math.pi*N_s/f;#(in rad/sec)\n", + "P_dm=P_m/math.sin(18*math.pi/180);\n", + "t_c=P/f;#fault clearing time (in sec)\n", + "delta_o=18*2*math.pi/360;#in rad\n", + "delta_m=math.degrees(delta_o+((w_s/(P*H))*P_m*t_c**2))\n", + "P_d=P_dm*math.sin(delta_m*math.pi/180);\n", + "print '(a) power generated (in per unit)=%.2f'%P_d\n", + "delta_2=math.pi-delta_o;\n", + "delta_c=math.acos(((P_m/P_dm)*(delta_2-delta_o))+math.cos(delta_2));\n", + "t_cn=math.sqrt((delta_c-delta_o)*4*H/(w_s*P_m));\n", + "print '(b) critical fault clearing time (in sec)=%.3f'%t_cn" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) power generated (in per unit)=0.95\n", + "(b) critical fault clearing time (in sec)=0.581\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11_1.ipynb b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11_1.ipynb new file mode 100755 index 00000000..1fc63a70 --- /dev/null +++ b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11_1.ipynb @@ -0,0 +1,120 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c877f92f53167787736d030c7e71187c13be065ae6dadf741859ea31d04711be" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11: Dynamics of Electric Machines" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.7, Page 646" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "KVA=71500;#Kilo Volt-Ampere\n", + "V_r=13800;#in Volts\n", + "X_af=0.57;#in per unit\n", + "X_la=0.125;#in per unit\n", + "X_lf=0.239;#in per unit\n", + "X_ld=0.172;#in per unit\n", + "\n", + "#Calculations&Results\n", + "X_ds=X_la+((X_af*X_lf*X_ld)/(X_lf*X_ld+X_af*X_ld+X_af*X_lf));#subtransient reactance(in per unit)\n", + "E_phy=1.;#generated voltage (in per unit)\n", + "I_ds=E_phy/X_ds;#short circuit current (in per unit)\n", + "X_d=X_la+((X_af*X_lf)/(X_af+X_lf));#transient reactance (in per unit)\n", + "I_d=E_phy/X_d;#transient current (in per unit)\n", + "I_rated=KVA*1000/(math.sqrt(3)*V_r);#in Amperes\n", + "I_dsa=I_ds*I_rated;#sub transient current (in Amperes)\n", + "print 'sub-transient current (in Amperes)=%.2f'%I_dsa\n", + "I_da=I_d*I_rated;#transient current (in Amperes)\n", + "print 'transient current (in Amperes)=%.2f'%I_da\n", + "#Answer varies due to rounding-off errors" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sub-transient current (in Amperes)=14238.48\n", + "transient current (in Amperes)=10195.69\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.8, Page 652" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "f=60.;#in Hertzs\n", + "P=4.;#no. of poles\n", + "P_m=0.9;\n", + "H=10;#in Joule/Volt-Amperee\n", + "\n", + "#Calculations&Results\n", + "N_s=f*120/P;#synchronous speed in (rpm)\n", + "w_s=2*math.pi*N_s/f;#(in rad/sec)\n", + "P_dm=P_m/math.sin(18*math.pi/180);\n", + "t_c=P/f;#fault clearing time (in sec)\n", + "delta_o=18*2*math.pi/360;#in rad\n", + "delta_m=math.degrees(delta_o+((w_s/(P*H))*P_m*t_c**2))\n", + "P_d=P_dm*math.sin(delta_m*math.pi/180);\n", + "print '(a) power generated (in per unit)=%.2f'%P_d\n", + "delta_2=math.pi-delta_o;\n", + "delta_c=math.acos(((P_m/P_dm)*(delta_2-delta_o))+math.cos(delta_2));\n", + "t_cn=math.sqrt((delta_c-delta_o)*4*H/(w_s*P_m));\n", + "print '(b) critical fault clearing time (in sec)=%.3f'%t_cn" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) power generated (in per unit)=0.95\n", + "(b) critical fault clearing time (in sec)=0.581\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12.ipynb b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12.ipynb new file mode 100755 index 00000000..fbe22bb8 --- /dev/null +++ b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12.ipynb @@ -0,0 +1,152 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e669c20812e01a3de7509b854fcd373ad98ac3cfd05f973ab8a7a3082e6c1738" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12: Special-Purpose Electric Machines" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.1, Page 662" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "flux=0.004;#(in Weber)\n", + "R_a=0.8;#armature resistance (in ohm)\n", + "V_s=40;#applied voltage (in Volts)\n", + "T_d=1.2;#in Newton-meter\n", + "K_a=95;#motor constant\n", + "\n", + "#Calculations&Results\n", + "w_m=(V_s/(K_a*flux))-((R_a*T_d)/(K_a*flux)**2);\n", + "N_m=w_m*60/(2*math.pi);\n", + "print 'speed of motor (in rpm)=%.f'%(math.ceil(N_m))\n", + "w_mb=0;#for blocked rotor condition\n", + "T_db=(V_s*K_a*flux)/R_a;\n", + "print 'torque developed under blocked rotor condition (in Newton-meter)=%.f'%T_db" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "speed of motor (in rpm)=942\n", + "torque developed under blocked rotor condition (in Newton-meter)=19\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.2, Page 662" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "N_m=1500;#speed of motor (in rpm)\n", + "R_a=2;#armature resistance (in ohms)\n", + "V_s=100;\n", + "P_o=200;#rated power \n", + "K_a=85;#machine constant\n", + "P_rot=15;#rotational loss\n", + "\n", + "#Calculations\n", + "w_m=(2*math.pi*N_m)/60;\n", + "P_d=P_o+P_rot;#power developed\n", + "T_d=P_d/w_m;#torque developed\n", + "def root(a,b,c):\n", + " return ((-b)+math.sqrt((b**2)-(4*a*c)))/(2*a);\n", + "\n", + "\n", + "#Result\n", + "print 'magnetic flux (in mWb)=%.2f'%(root(1,-0.0075,(2.41*10**-6))*1000)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnetic flux (in mWb)=7.16\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.3, Page 682" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable declaration\n", + "f=60;#frequency (in Hertzs)\n", + "P_pi=0.5;#pole pitch\n", + "F_d=100000;#developed thrust (in Newton)\n", + "\n", + "#Calculations&Results\n", + "V_m=200000./3600;#speed of motor (in meter/sec)\n", + "P_d=F_d*V_m;\n", + "print 'developed power (in Kilo-Watts)=%.f'%(int(P_d/1000))\n", + "V_s=2*P_pi*f;#synchronous speed of the motor (in meter/sec)\n", + "s=(V_s-V_m)/V_s;#slip\n", + "P_cu=F_d*s*V_s;\n", + "print 'Copper loss (in Kilo-Watts)=%.f'%(int(P_cu/1000))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "developed power (in Kilo-Watts)=5555\n", + "Copper loss (in Kilo-Watts)=444\n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12_1.ipynb b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12_1.ipynb new file mode 100755 index 00000000..fbe22bb8 --- /dev/null +++ b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12_1.ipynb @@ -0,0 +1,152 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e669c20812e01a3de7509b854fcd373ad98ac3cfd05f973ab8a7a3082e6c1738" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12: Special-Purpose Electric Machines" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.1, Page 662" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "flux=0.004;#(in Weber)\n", + "R_a=0.8;#armature resistance (in ohm)\n", + "V_s=40;#applied voltage (in Volts)\n", + "T_d=1.2;#in Newton-meter\n", + "K_a=95;#motor constant\n", + "\n", + "#Calculations&Results\n", + "w_m=(V_s/(K_a*flux))-((R_a*T_d)/(K_a*flux)**2);\n", + "N_m=w_m*60/(2*math.pi);\n", + "print 'speed of motor (in rpm)=%.f'%(math.ceil(N_m))\n", + "w_mb=0;#for blocked rotor condition\n", + "T_db=(V_s*K_a*flux)/R_a;\n", + "print 'torque developed under blocked rotor condition (in Newton-meter)=%.f'%T_db" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "speed of motor (in rpm)=942\n", + "torque developed under blocked rotor condition (in Newton-meter)=19\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.2, Page 662" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "N_m=1500;#speed of motor (in rpm)\n", + "R_a=2;#armature resistance (in ohms)\n", + "V_s=100;\n", + "P_o=200;#rated power \n", + "K_a=85;#machine constant\n", + "P_rot=15;#rotational loss\n", + "\n", + "#Calculations\n", + "w_m=(2*math.pi*N_m)/60;\n", + "P_d=P_o+P_rot;#power developed\n", + "T_d=P_d/w_m;#torque developed\n", + "def root(a,b,c):\n", + " return ((-b)+math.sqrt((b**2)-(4*a*c)))/(2*a);\n", + "\n", + "\n", + "#Result\n", + "print 'magnetic flux (in mWb)=%.2f'%(root(1,-0.0075,(2.41*10**-6))*1000)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnetic flux (in mWb)=7.16\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.3, Page 682" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable declaration\n", + "f=60;#frequency (in Hertzs)\n", + "P_pi=0.5;#pole pitch\n", + "F_d=100000;#developed thrust (in Newton)\n", + "\n", + "#Calculations&Results\n", + "V_m=200000./3600;#speed of motor (in meter/sec)\n", + "P_d=F_d*V_m;\n", + "print 'developed power (in Kilo-Watts)=%.f'%(int(P_d/1000))\n", + "V_s=2*P_pi*f;#synchronous speed of the motor (in meter/sec)\n", + "s=(V_s-V_m)/V_s;#slip\n", + "P_cu=F_d*s*V_s;\n", + "print 'Copper loss (in Kilo-Watts)=%.f'%(int(P_cu/1000))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "developed power (in Kilo-Watts)=5555\n", + "Copper loss (in Kilo-Watts)=444\n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1_1.ipynb b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1_1.ipynb new file mode 100755 index 00000000..68dcda86 --- /dev/null +++ b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1_1.ipynb @@ -0,0 +1,575 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2ec5bac642048fe4f0a8791f1d0a50f56c601f2689b76ecde0a87424ce5a550e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1: Review of Electric Circuit Theory" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.1, Page 5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Calculations&Results\n", + "#on applying KVL we get \n", + "i=75./50;#in Amperes\n", + "v_th=(30*i)+25;#Equivalent Thevenin voltage (in Volts)\n", + "r_th=(20*30)/(20+30);#Equivalent thevenin resistance (in Ohms)\n", + "R_load=r_th;#Load resistance=thevenin resistance (in Ohms)\n", + "print \"load resistance (in ohms)= %.f\"%R_load #in ohms\n", + "i_load=v_th/(r_th+R_load);#in Amperes\n", + "p_max=(i_load**2)*r_th;#in Watts\n", + "print 'max power (in watts)= %.2f'%p_max#maximum power dissipiated " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "load resistance (in ohms)= 12\n", + "max power (in watts)= 102.08\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.2, Page 13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "import cmath\n", + "import matplotlib.pyplot as plt\n", + "import numpy as np\n", + "\n", + "#Variable declaration\n", + "#Refer to figure 1.5a\n", + "L=1*10**-3;#henery\n", + "R=3.;#ohms\n", + "C=200*10**-6;#faraday\n", + "print \"v(t)=14.142cos1000t\"\n", + "V_m=14.142;#Peak value of applied voltage (in Volts)\n", + "\n", + "#Calculations&Results\n", + "V=V_m/math.sqrt(2);#RMS value of applied voltage (in Volts)\n", + "#On comparing with standard equation v(t)=acoswt\n", + "w=1000;#in radian/second\n", + "#Inductive impedance=jwL\n", + "Z_L=complex(0,w*L);#in ohms\n", + "#capacitive impedance=-j/wC\n", + "Z_c=complex(0,-1/(w*C));#in ohms\n", + "#Impedance of the circuit is given by\n", + "Z=Z_L+Z_c+R;#in ohms\n", + "I=V/Z#Current in the circuit#in Amperes\n", + "r=I.real;\n", + "i=I.imag;\n", + "magn_I=math.sqrt((r**2)+(i**2));#magnitude of current (in Amperes)\n", + "phase_I=math.degrees(math.atan(i/r));#phase of current (in degree)\n", + "print 'magnitude of current (in Amperes)= %.f'%magn_I\n", + "print 'phase of current (in Degrees) = %.2f'%phase_I\n", + "\n", + "Vr = I*R\n", + "Vl = I*Z_L\n", + "Vc = I*Z_c\n", + "print \"\\nCurrent in time domain is:\\ni(t)=2.828cos(1000t+53.13)A\"\n", + "S = V*I #complex power supplied by source(VA)\n", + "magn_S = math.sqrt((S.real**2)+(S.imag**2))\n", + "print \"\\nApparent power S = %.f VA\"%magn_S\n", + "print \"Reactive power P = %.f W\"%S.real\n", + "print \"Reactive power Q = %.f VAR\"%(-S.imag)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "v(t)=14.142cos1000t\n", + "magnitude of current (in Amperes)= 2\n", + "phase of current (in Degrees) = 53.13\n", + "\n", + "Current in time domain is:\n", + "i(t)=2.828cos(1000t+53.13)A\n", + "\n", + "Apparent power S = 20 VA\n", + "Reactive power P = 12 W\n", + "Reactive power Q = -16 VAR\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.3, Page 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "import cmath\n", + "\n", + "#Variable declaration\n", + "I=10;#Current drawn by the load (in Amperes)\n", + "pf1=0.5;#lagging power factor\n", + "pf2=0.8;\n", + "V=120;#source voltage (in Volts)\n", + "f=60;#frequency of source (in Hertz)\n", + "\n", + "#Calculations\n", + "Vl = complex(120,0)\n", + "Il = complex(5,8.66) #10/_60 in polar\n", + "S = Vl*Il\n", + "i = 600/(V*pf2) #Since power at source is 600W\n", + "\n", + "#Refer to fig 1.6(b)\n", + "#I_Lc=I_L+I_c\n", + "I = complex(5,-3.75) #Writing I from polar to cartesian form\n", + "Il = complex(5,-8.66) #Writing Il from polar to cartesian forms\n", + "Ic = I - Il\n", + "Zc = V/Ic\n", + "Xc = Zc/complex(0,1)\n", + "C = 1/(2*math.pi*f*Xc)\n", + "\n", + "#Result\n", + "print \"The required value of capacitor is %.2f\"%(C.real*10**6)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required value of capacitor is -108.53\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.4, Page 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "import cmath\n", + "\n", + "#Variable declaration\n", + "#Make delta -star conversion of load\n", + "Z_L=complex(1,2);#Impedance of each wire (in Ohms)\n", + "Z_p=complex(177,-246);#per-phase impedance (in Ohms)\n", + "Z_pY=Z_p/3;#per-phase impedance in Y-connection (in Ohms)\n", + "Z=Z_L+Z_pY;#Total per phase impedance (in Ohms)\n", + "V=866/math.sqrt(3);#Per-phase voltage (in Volts)\n", + "V_phase=0;\n", + "I=V/Z;#Current in the circuit (in Ampere)\n", + "\n", + "#Calculations&Results\n", + "I_mag=math.sqrt((I.real**2)+(I.imag**2));#magnitude of current (in Amperes)\n", + "I_phase=math.degrees(math.atan(I.imag/I.real));#phase of current (in Degrees)\n", + "pf=math.cos(math.atan(I.imag/I.real));#power factor\n", + "#Refer to fig:1.13(b)\n", + "#Source are connected in star,so phase currents = line currents\n", + "I_na_mag=I_mag;#Magnitude of Source current through n-a (in Amperes)\n", + "I_nb_mag=I_mag;#Magnitude of Source current through n-b (in Amperes)\n", + "I_nc_mag=I_mag;#Magnitude of Source current through n-c (in Amperes)\n", + "I_na_phase=I_phase+(0);#phase angle of current through n-a (in Degree)\n", + "I_nb_phase=I_phase+(-120);#phase angle of current through n-b (in Degree)\n", + "I_nc_phase=I_phase+(120);#phase angle of current through n-c (in Degree)\n", + "print 'Source currents are:'\n", + "print 'I_na_mag (in Amperes)= %.f'%I_na_mag\n", + "print 'I_na_phase (in Degrees)=%.2f'%I_na_phase\n", + "print 'I_nb_mag (in Amperes)=%.f'%I_nb_mag\n", + "print 'I_nb_phase (in Degrees)=%.2f'%I_nb_phase\n", + "print 'I_nc_mag (in Amperes)=%.f'%I_nc_mag\n", + "print 'I_nc_phase (in Degrees)=%.2f'%I_nc_phase\n", + "\n", + "#Load is connected in delta network\n", + "I_AB_mag=I_mag/math.sqrt(3);#magnitude of current through AB (in Amperes)\n", + "I_BC_mag=I_mag/math.sqrt(3);#magnitude of current through BC (in Amperes)\n", + "I_CA_mag=I_mag/math.sqrt(3);#magnitude of current through CA (in Amperes)\n", + "I_AB_phase=I_na_phase+30;#phase angle of current through AB (in Degrees)\n", + "I_BC_phase=I_nb_phase+30;#phase angle of current through BC (in Degrees)\n", + "I_CA_phase=I_nb_phase-90;#phase angle of current through CA (in Degrees)\n", + "print '\\nPhase currents through the load are:'\n", + "print 'I_AB_mag (in Amperes)= %.3f'%I_AB_mag\n", + "print 'I_AB_phase (in Degrees)= %.2f'%I_AB_phase\n", + "print 'I_BC_mag (in Amperes)= %.3f'%I_BC_mag\n", + "print 'I_BC_phase (in Degrees)= %.2f'%I_BC_phase\n", + "print 'I_CA_mag (in Amperes)= %.3f'%I_CA_mag\n", + "print 'I_CA_phase (in Degrees)= %.2f'%I_CA_phase\n", + "\n", + "\n", + "I_AB=complex((I_AB_mag*math.cos(I_AB_phase*math.pi/180)),(I_AB_mag*math.sin(I_AB_phase*math.pi/180)));#(in Amperes)\n", + "V_AB = I_AB*Z_p\n", + "V_AB_mag = math.sqrt(V_AB.real**2+V_AB.imag**2)\n", + "V_AB_phase = math.degrees(math.atan(V_AB.imag/V_AB.real))\n", + "print '\\nLine or phase voltages at the load are:'\n", + "print 'V_AB = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase)\n", + "print 'V_BC = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase-120)\n", + "print 'V_CA = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase+120)\n", + "\n", + "P_AB=I_AB_mag**2*(Z_p.real);#in watts\n", + "P_load = 3*P_AB\n", + "print '\\nPower dissipated (in Watts)=%.2f'%(P_load)\n", + "\n", + "P_line=3*I_mag**2*(Z_L.real);#in watts\n", + "print 'Power dissipated by transmission line (in Watts)= %.f'%P_line\n", + "P_source = P_load+P_line\n", + "print 'Total power supplied by three-phase source is %.2f W'%P_source" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Source currents are:\n", + "I_na_mag (in Amperes)= 5\n", + "I_na_phase (in Degrees)=53.13\n", + "I_nb_mag (in Amperes)=5\n", + "I_nb_phase (in Degrees)=-66.87\n", + "I_nc_mag (in Amperes)=5\n", + "I_nc_phase (in Degrees)=173.13\n", + "\n", + "Phase currents through the load are:\n", + "I_AB_mag (in Amperes)= 2.887\n", + "I_AB_phase (in Degrees)= 83.13\n", + "I_BC_mag (in Amperes)= 2.887\n", + "I_BC_phase (in Degrees)= -36.87\n", + "I_CA_mag (in Amperes)= 2.887\n", + "I_CA_phase (in Degrees)= -156.87\n", + "\n", + "Line or phase voltages at the load are:\n", + "V_AB = 874.83,angle = 28.87 V\n", + "V_BC = 874.83,angle = -91.13 V\n", + "V_CA = 874.83,angle = 148.87 V\n", + "\n", + "Power dissipated (in Watts)=4424.74\n", + "Power dissipated by transmission line (in Watts)= 75\n", + "Total power supplied by three-phase source is 4499.74 W\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.5, Page 29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable declaration\n", + "R1 = 25 #in ohms\n", + "R2 = 100 #in ohms\n", + "Rt = 100 #in ohms\n", + "V = 100. #in volts\n", + "\n", + "#Calculations\n", + "Rp = (R1*R2)/(R1+R2)\n", + "It = V/Rt #total current in circuit in Amps\n", + "V_25 = It*Rp #voltage across 25 ohm resistor, in volts\n", + "I_25 = V_25/R1 #current through 25 ohm resistor, in Amps\n", + "P_25 = V_25*I_25\n", + "\n", + "#Result\n", + "print \"Power dissipated by the 25ohm resistor is %.f W\"%P_25" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power dissipated by the 25ohm resistor is 16 W\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.6, Page 33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "#Refer to the fig:1.16\n", + "R=40;#in ohms\n", + "L=complex(0,30);#in ohms\n", + "\n", + "\n", + "#Calculations&Results\n", + "V=117*(complex(math.cos(0),math.sin(0)));#in Volts\n", + "#Equivalent load impedance is obtained by parallel combination of Resistance R and Inductance L\n", + "Z_L=(R*L)/(R+L);#load impedance (in Ohms)\n", + "Z1=complex(0.6,16.8);# in Ohms\n", + "Z=Z_L+Z1;#Equivalent impedance of circuit (in Ohms) \n", + "I=V/Z;#current through load (in Amperes)\n", + "I_mag=math.sqrt(I.real**2+I.imag**2);#magnitude of current flowing through load (in Amperes)\n", + "I_phase=math.degrees(math.atan(I.imag/I.real))\n", + "print 'Reading of ammeter (in Amperes)=%.f,angle = %.2f'%(I_mag,I_phase)\n", + "\n", + "V_L=I*Z_L;#voltage across load (in Volts)\n", + "V_L_mag=math.sqrt(V_L.real**2+V_L.imag**2);#magnitude of voltage across load (in Volts)\n", + "V_L_phase = math.degrees(math.atan(V_L.imag/V_L.real))\n", + "print '\\nReading of voltmeter (in Volts)= %.f,angle = %.2f'%(V_L_mag,V_L_phase)\n", + "\n", + "P=(V_L*I.conjugate());#Power developed (in Watts)\n", + "print 'Reading of wattmeter (in Watts)=%.1f'%P.real\n", + "\n", + "pf=P.real/(V_L_mag*I_mag);#Power factor\n", + "print 'power factor=%.2f(lagging)'%pf" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Reading of ammeter (in Amperes)=3,angle = -67.38\n", + "\n", + "Reading of voltmeter (in Volts)= 72,angle = -14.25\n", + "Reading of wattmeter (in Watts)=129.6\n", + "power factor=0.60(lagging)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7, Page 38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "#transforming delta connected source into an equivalent Star-connected source\n", + "V_s=1351;#source voltage (in Volts)\n", + "V=1351/math.sqrt(3);#in volts\n", + "V_phase=0;\n", + "\n", + "#Calculations&Results\n", + "Z=complex(360,150);#per-phase impedance(in ohms)\n", + "I=V/Z;#current in the circuit (in Amperes)\n", + "I_mag=math.sqrt(I.real**2+I.imag**2);#in ampere\n", + "I_phase=math.degrees(math.atan(I.imag/I.real));#degree\n", + "\n", + "#Refer to fig 1.19(a)\n", + "V_ab=1351*complex(math.cos(-30*math.pi/180),math.sin(-30*math.pi/180));#in Volts\n", + "I_aA=2*complex(math.cos(I_phase*math.pi/180),math.sin(I_phase*math.pi/180));#in Amperes\n", + "V_cb=1351*complex(math.cos(-90*math.pi/180),math.sin(-90*math.pi/180));#in Volts\n", + "I_cC=2*complex(math.cos((I_phase-120)*math.pi/180),math.sin((I_phase-120)*math.pi/180));#in Amperes\n", + "P1=V_ab*I_aA.conjugate();#reading of wattmeter 1 (in Watts)\n", + "print 'Reading of wattmeter W1 (in Watts) =%.2f'%P1.real\n", + "P2=V_cb*I_cC.conjugate();#reading of wattmeter 2 (in Watts)\n", + "print 'Reading of wattmeter W2 (in Watts)=%.2f'%P2.real\n", + "P=P1.real+P2.real;#total power developed (in Watts)\n", + "print 'Total power developed (in Watts)= %.f' %P\n", + "\n", + "pf=math.cos(math.atan(I.imag/I.real));#power factor\n", + "print 'power factor= %.3f(lagging)'%pf" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Reading of wattmeter W1 (in Watts) =2679.62\n", + "Reading of wattmeter W2 (in Watts)=1640.39\n", + "Total power developed (in Watts)= 4320\n", + "power factor= 0.923(lagging)\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.8, Page 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "V = 120 #Voltage(V)\n", + "I = 5 #current(A)\n", + "P = 480. #power(W)\n", + "f = 60 #Hz\n", + "\n", + "#Calculations&Results\n", + "S = V*I #apparent power(W)\n", + "theta = math.degrees(math.acos(P/S)) #power factor angle\n", + "#In phasor form,\n", + "Vp = V*complex(math.cos(0*math.pi/180),math.sin(0*math.pi/180))\n", + "Ip = I*complex(math.cos(theta*math.pi/180),math.sin(theta*math.pi/180))\n", + "\n", + "#For series circuit\n", + "Zs = Vp/Ip\n", + "print \"Equivalent Impedance of series circuit = \",Zs\n", + "Xc = -Zs.imag\n", + "C = 1./(2*math.pi*f*Xc)\n", + "print \"Equivalent capacitance of series circuit = %.2f uF\"%(C*10**6)\n", + "\n", + "#For parallel circuit\n", + "I_mag = I*math.cos(theta*math.pi/180)\n", + "I_imag = I*math.sin(theta*math.pi/180)\n", + "Rp = V/I_mag\n", + "print \"\\nEquivalent resistance of parallel circuit = %d ohms\"%Rp\n", + "Xp = V/I_imag\n", + "Cp = 1./(2*math.pi*f*Xp)\n", + "print \"Equivalent capacitance of parallel circuit = %.1f uF\"%(Cp*10**6)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equivalent Impedance of series circuit = (19.2-14.4j)\n", + "Equivalent capacitance of series circuit = 184.21 uF\n", + "\n", + "Equivalent resistance of parallel circuit = 29 ohms\n", + "Equivalent capacitance of parallel circuit = 66.3 uF\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9, Page 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "P = 3246 #power consumed(W)\n", + "Vl = 208. #line voltage(V)\n", + "Il = 10.6 #line current(A)\n", + "\n", + "#Calculations&Results\n", + "\n", + "#Y-Connection\n", + "V_phi = Vl/math.sqrt(3) #pre-phase voltage(V)\n", + "I_phi = Il #pre-phase current(A)\n", + "P_phi = P/3 #pre-phase power(W)\n", + "S_phi = V_phi*I_phi #pre-phase apparent power(VA)\n", + "theta = math.degrees(math.acos((P_phi/S_phi))) #lag\n", + "#In phasor form,\n", + "V_AN = V_phi*complex(math.cos(0*math.pi/180),math.sin(0*math.pi/180))\n", + "I_AN = I_phi*complex(math.cos(-theta*math.pi/180),math.sin(-theta*math.pi/180))\n", + "Zy = V_AN/I_AN\n", + "Zy_phase = math.degrees(math.atan(Zy.imag/Zy.real))\n", + "I_mag = I_phi*math.cos(Zy_phase*math.pi/180)\n", + "I_imag = I_phi*math.sin(Zy_phase*math.pi/180)\n", + "Rp = V_phi/I_mag #ohms\n", + "Xp = V_phi/I_imag #ohms\n", + "print \"For Y-connection:\"\n", + "print \"Impedance = \",Zy\n", + "print \"Resistance = %.2f ohms, Reactance = %.2f ohms\"%(Rp,Xp)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For Y-connection:\n", + "Impedance = (9.62976148095+5.96800193442j)\n", + "Resistance = 13.33 ohms, Reactance = 21.51 ohms\n" + ] + } + ], + "prompt_number": 9 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2.ipynb b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2.ipynb new file mode 100755 index 00000000..cbafa256 --- /dev/null +++ b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2.ipynb @@ -0,0 +1,393 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b5ac0fcf729add8ad42e5962c5649d2a5a944710ab497f047f8a98ee7c6fe43e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1: Review of Basic Laws of Electromagnetism" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.1, Page 66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable declaration\n", + "N=1000;#Number of turns\n", + "phy_1=100*10**-3;#initial magnetic flux (in webers)\n", + "phy_2=20*10**-3;#final magnetic flux (in webers)\n", + "\n", + "#Calculations\n", + "phy=phy_2-phy_1;#change in magnetic flux\n", + "t=5;#(in seconds)\n", + "e=(-1)*N*(phy/t);#induced emf (in volts)\n", + "\n", + "#Result\n", + "print 'Induced emf (in volts)=%.f'%e" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Induced emf (in volts)=16\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6, Page 90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "u_o=4*math.pi*10**-7;#permeablity of air\n", + "u_r=1200;#permeablity of magnetic material\n", + "N=1500;#No. of turns\n", + "I=4;#current in the coil (in Amperes)\n", + "r_i=10*10**-2;#inner radii of magnetic core (in meters)\n", + "r_o=12*10**-2;#outer radii of magnetic core (in meters)\n", + "\n", + "#Calculations\n", + "r_m=(r_i+r_o)/2;#mean radii of magnetic core (in meters)\n", + "l_g=1*10**-2;#length of air gap (in meters)\n", + "l_m=2*math.pi*(r_m-l_g);#in meters\n", + "#Refer to fig:-2.14\n", + "A_m=(r_o-r_i)**2;#cross-sectional area of magnetic path (in meter**2)\n", + "R_m=l_m/(u_o*u_r*A_m);#reluctance of magnetic material\n", + "R_g=l_g/(u_o*A_m);#reluctance of air gap\n", + "#R_m and R_g in sereis\n", + "R=R_m+R_g;\n", + "B_m=N*I/(R*A_m);#magnetic flux density (in Tesla)\n", + "\n", + "#Result\n", + "print 'magnetic flux density (in Tesla)=%.3f T'%B_m" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnetic flux density (in Tesla)=0.716 T\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.10, Page 103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable declaration\n", + "#Refer to eqn 2.26\n", + "e_21=20.;#voltage induced in coil-2 (in volts)\n", + "I1=2000;#rate of change of current in coil-1 (in Amperes/second)\n", + "\n", + "#Calculations\n", + "M=e_21/I1;# in henry\n", + "L1=25*10**-3;#in henry\n", + "L2=25*10**-3;#in henry\n", + "#Refer to eqn 2.32\n", + "k=(M/L1)*100;#coefficient of coupling\n", + "\n", + "#Result\n", + "print 'percentage (%%)=%.f'%k" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "percentage (%)=40\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.11, Page 106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "#L1,L2=inductances of coil 1&2\n", + "#M=mutual inductance b/w coil 1&2\n", + "L_aid=2.38;#effective inductance when connected in sereis aiding\n", + "L_opp=1.02;#effective inductance when connected in sereis opposing\n", + "\n", + "#Calculations&Results\n", + "#L1+L2+2M=L_aid\n", + "#L1+L2-2M=L_opp\n", + "M=(L_aid-L_opp)/4;#in henry\n", + "print 'mutual inductance (in henry)= %.2f'%M\n", + "#L1=16*L2\n", + "L1=(L_aid-2*M)/17;#in henry\n", + "print 'inductance of coil-1 (in henry)= %.1f'%L1\n", + "L2=L_aid-(2*M)-L1;#in henry\n", + "print 'inductance of coil-2 (in henry)=%.1f'%L2\n", + "k=M/(math.sqrt(L1*L2));\n", + "print 'coefficient of coupling=%.2f'%k" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mutual inductance (in henry)= 0.34\n", + "inductance of coil-1 (in henry)= 0.1\n", + "inductance of coil-2 (in henry)=1.6\n", + "coefficient of coupling=0.85\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.12, Page 108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable declaration\n", + "L1=1.6;#self inductance of coil 1 (in Henry)\n", + "L2=0.1;#self inductance of coil 2 (in Henry)\n", + "M=0.34;#mutual inductance (in Henry)\n", + "\n", + "#Calculations&Results\n", + "#Refer to eqn-2.45\n", + "L_aid=((L1*L2)-M**2)*10**3/(L1+L2-(2*M));#in mili-Henry\n", + "print 'effective inductance in parallel aiding (in mili-Henry)=%.1f'%L_aid\n", + "#Refer to eqn-2.46\n", + "L_opp=((L1*L2)-M**2)*10**3/(L1+L2+(2*M));#in mili-henry\n", + "print 'effective inductance in parallel opposing (in mini-Henry)=%.1f'%L_opp" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "effective inductance in parallel aiding (in mili-Henry)=43.5\n", + "effective inductance in parallel opposing (in mini-Henry)=18.7\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.13, Page 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "import numpy\n", + "\n", + "#Variable declaration\n", + "#refer to eqn-2.50\n", + "#eqn:-2.51,2.52 & 2.53 are obtained\n", + "f=numpy.array([25, 25, 60]);#in hertz\n", + "T = numpy.array([1.1,1.5,1.1])\n", + "\n", + "#Calculations&Results\n", + "B_m=numpy.array([1.1, 1.5, 1.1])\n", + "P_m=numpy.array([0.4, 0.8, 1.2])\n", + "#On solving eqn:-2.51 & eqn:-2.53\n", + "k_e=(0.016-0.02)/(30.25-72.6);\n", + "#on solving eqn:-2.51 & eqn:-2.52\n", + "n=(math.log((0.016-(30.25*k_e))/(0.032-(56.25*k_e))))/(math.log(1.1/1.5));\n", + "k_h=(0.016-(30.25*k_e))/1.1**n;\n", + "P_h=k_h*f*B_m**n#hysteresis loss\n", + "P_eddy=k_e*(f**2)*B_m**2#eddy current loss\n", + "\n", + "#Results\n", + "for n in range(3,):\n", + " print 'Frequency(Hz)\\t\\tFlux Density(T)\\t\\tHysteresis loss(W/kg)\\t\\tEddy-current loss(W/kg)\\n',(f[n]),\"\\t\\t\\t\",round(T[n],1),\"\\t\\t\\t\",round(P_h[n],3),\"\\t\\t\\t\\t\",round(P_eddy[n],3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Frequency(Hz)\t\tFlux Density(T)\t\tHysteresis loss(W/kg)\t\tEddy-current loss(W/kg)\n", + "25 \t\t\t1.1 \t\t\t0.329 \t\t\t\t0.071\n", + "Frequency(Hz)\t\tFlux Density(T)\t\tHysteresis loss(W/kg)\t\tEddy-current loss(W/kg)\n", + "25 \t\t\t1.5 \t\t\t0.667 \t\t\t\t0.133\n", + "Frequency(Hz)\t\tFlux Density(T)\t\tHysteresis loss(W/kg)\t\tEddy-current loss(W/kg)\n", + "60 \t\t\t1.1 \t\t\t0.789 \t\t\t\t0.411\n" + ] + } + ], + "prompt_number": 62 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.14, Page 118" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "u_o=4*math.pi*10**-7;#permeablity of air\n", + "u_r=500;#permeablity of steel\n", + "l_g=1*10**-2;#length of air gap section (in meter)\n", + "A_g=10*10**-4;#cross-sectional area of air gap section (in meter**2)\n", + "A_m=10*10**-4;#cross-sectional area of magnet section (in meter**2)\n", + "A_s=10*10**-4;#cross-sectional area of steel sections (in meter**2)\n", + "l_s=50*10**-2;#length of steel section (in meter)\n", + "#Refer to fig:-2.29 (Demagnetization and energy-product curves of a magnet)\n", + "H_m=-144*10**3;#(in Ampere/meter)\n", + "B_m=0.23;#Magnetic flux density (in Tesla)\n", + "\n", + "#Calculations\n", + "#refer to eqn:-2.55\n", + "l_m=(-1*100)*(((l_g*A_m)/(u_o*A_g))+((2*l_s*A_m)/(u_o*u_r*A_s)))*(B_m/H_m);# (in centimeter)\n", + "\n", + "#Result\n", + "print 'minimum length of magnet (in centimeter)=%.2f'%l_m" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "minimum length of magnet (in centimeter)=1.53\n" + ] + } + ], + "prompt_number": 64 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.15, Page 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "import sympy\n", + "\n", + "#Variable declaration\n", + "#From figure 2.32(a)\n", + "lm = 52-42 #mean length of magnets,mm\n", + "ls = 2.5+2.5+(2*math.pi*54.5/4) #mean length of yoke,mm\n", + "lg = 42-40 #air gap,mm\n", + "la = 17.5+17.5+(2*math.pi*22.5/4) #mean length of rotor,mm\n", + "\n", + "#Calculations\n", + "#From figure 2.32(b)\n", + "Am = 50*(52+42)*math.pi/4 #cross-sectional area of magnet,mm^2\n", + "As = 5*50 #cross-sectional area of yoke,mm^2\n", + "Ag = 50*(42+40)*math.pi/4 #cross-sectional area of air-gap,mm^2\n", + "Aa = 35*50 #cross-sectional area of rotor,mm^2\n", + "\n", + "Bm = 0.337 #T\n", + "phi = Bm*Am #Wb\n", + "phi_t = round(2*phi*10**-3,3) #Wb\n", + "#We know that, phi_c = 2.488cos100t mWb\n", + "from sympy import Symbol,diff,cos\n", + "t = Symbol('t')\n", + "d_phi_by_dt = diff(cos(100*t),t)\n", + "e = -phi_t*d_phi_by_dt\n", + "#Result\n", + "print \"The induced emf is\",e,\"V\"\n", + "#Incorrect result in textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The induced emf is 248.8*sin(100*t) V\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2_1.ipynb b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2_1.ipynb new file mode 100755 index 00000000..a2bb8ad8 --- /dev/null +++ b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2_1.ipynb @@ -0,0 +1,393 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6624caec90dfae162d7608f118e1da7eb04a99fd78544aa4875357128ed122c5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2: Review of Basic Laws of Electromagnetism" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.1, Page 66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable declaration\n", + "N=1000;#Number of turns\n", + "phy_1=100*10**-3;#initial magnetic flux (in webers)\n", + "phy_2=20*10**-3;#final magnetic flux (in webers)\n", + "\n", + "#Calculations\n", + "phy=phy_2-phy_1;#change in magnetic flux\n", + "t=5;#(in seconds)\n", + "e=(-1)*N*(phy/t);#induced emf (in volts)\n", + "\n", + "#Result\n", + "print 'Induced emf (in volts)=%.f'%e" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Induced emf (in volts)=16\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6, Page 90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "u_o=4*math.pi*10**-7;#permeablity of air\n", + "u_r=1200;#permeablity of magnetic material\n", + "N=1500;#No. of turns\n", + "I=4;#current in the coil (in Amperes)\n", + "r_i=10*10**-2;#inner radii of magnetic core (in meters)\n", + "r_o=12*10**-2;#outer radii of magnetic core (in meters)\n", + "\n", + "#Calculations\n", + "r_m=(r_i+r_o)/2;#mean radii of magnetic core (in meters)\n", + "l_g=1*10**-2;#length of air gap (in meters)\n", + "l_m=2*math.pi*(r_m-l_g);#in meters\n", + "#Refer to fig:-2.14\n", + "A_m=(r_o-r_i)**2;#cross-sectional area of magnetic path (in meter**2)\n", + "R_m=l_m/(u_o*u_r*A_m);#reluctance of magnetic material\n", + "R_g=l_g/(u_o*A_m);#reluctance of air gap\n", + "#R_m and R_g in sereis\n", + "R=R_m+R_g;\n", + "B_m=N*I/(R*A_m);#magnetic flux density (in Tesla)\n", + "\n", + "#Result\n", + "print 'magnetic flux density (in Tesla)=%.3f T'%B_m" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnetic flux density (in Tesla)=0.716 T\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.10, Page 103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable declaration\n", + "#Refer to eqn 2.26\n", + "e_21=20.;#voltage induced in coil-2 (in volts)\n", + "I1=2000;#rate of change of current in coil-1 (in Amperes/second)\n", + "\n", + "#Calculations\n", + "M=e_21/I1;# in henry\n", + "L1=25*10**-3;#in henry\n", + "L2=25*10**-3;#in henry\n", + "#Refer to eqn 2.32\n", + "k=(M/L1)*100;#coefficient of coupling\n", + "\n", + "#Result\n", + "print 'percentage (%%)=%.f'%k" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "percentage (%)=40\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.11, Page 106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "#L1,L2=inductances of coil 1&2\n", + "#M=mutual inductance b/w coil 1&2\n", + "L_aid=2.38;#effective inductance when connected in sereis aiding\n", + "L_opp=1.02;#effective inductance when connected in sereis opposing\n", + "\n", + "#Calculations&Results\n", + "#L1+L2+2M=L_aid\n", + "#L1+L2-2M=L_opp\n", + "M=(L_aid-L_opp)/4;#in henry\n", + "print 'mutual inductance (in henry)= %.2f'%M\n", + "#L1=16*L2\n", + "L1=(L_aid-2*M)/17;#in henry\n", + "print 'inductance of coil-1 (in henry)= %.1f'%L1\n", + "L2=L_aid-(2*M)-L1;#in henry\n", + "print 'inductance of coil-2 (in henry)=%.1f'%L2\n", + "k=M/(math.sqrt(L1*L2));\n", + "print 'coefficient of coupling=%.2f'%k" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mutual inductance (in henry)= 0.34\n", + "inductance of coil-1 (in henry)= 0.1\n", + "inductance of coil-2 (in henry)=1.6\n", + "coefficient of coupling=0.85\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.12, Page 108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable declaration\n", + "L1=1.6;#self inductance of coil 1 (in Henry)\n", + "L2=0.1;#self inductance of coil 2 (in Henry)\n", + "M=0.34;#mutual inductance (in Henry)\n", + "\n", + "#Calculations&Results\n", + "#Refer to eqn-2.45\n", + "L_aid=((L1*L2)-M**2)*10**3/(L1+L2-(2*M));#in mili-Henry\n", + "print 'effective inductance in parallel aiding (in mili-Henry)=%.1f'%L_aid\n", + "#Refer to eqn-2.46\n", + "L_opp=((L1*L2)-M**2)*10**3/(L1+L2+(2*M));#in mili-henry\n", + "print 'effective inductance in parallel opposing (in mini-Henry)=%.1f'%L_opp" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "effective inductance in parallel aiding (in mili-Henry)=43.5\n", + "effective inductance in parallel opposing (in mini-Henry)=18.7\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.13, Page 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "import numpy\n", + "\n", + "#Variable declaration\n", + "#refer to eqn-2.50\n", + "#eqn:-2.51,2.52 & 2.53 are obtained\n", + "f=numpy.array([25, 25, 60]);#in hertz\n", + "T = numpy.array([1.1,1.5,1.1])\n", + "\n", + "#Calculations&Results\n", + "B_m=numpy.array([1.1, 1.5, 1.1])\n", + "P_m=numpy.array([0.4, 0.8, 1.2])\n", + "#On solving eqn:-2.51 & eqn:-2.53\n", + "k_e=(0.016-0.02)/(30.25-72.6);\n", + "#on solving eqn:-2.51 & eqn:-2.52\n", + "n=(math.log((0.016-(30.25*k_e))/(0.032-(56.25*k_e))))/(math.log(1.1/1.5));\n", + "k_h=(0.016-(30.25*k_e))/1.1**n;\n", + "P_h=k_h*f*B_m**n#hysteresis loss\n", + "P_eddy=k_e*(f**2)*B_m**2#eddy current loss\n", + "\n", + "#Results\n", + "for n in range(3,):\n", + " print 'Frequency(Hz)\\t\\tFlux Density(T)\\t\\tHysteresis loss(W/kg)\\t\\tEddy-current loss(W/kg)\\n',(f[n]),\"\\t\\t\\t\",round(T[n],1),\"\\t\\t\\t\",round(P_h[n],3),\"\\t\\t\\t\\t\",round(P_eddy[n],3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Frequency(Hz)\t\tFlux Density(T)\t\tHysteresis loss(W/kg)\t\tEddy-current loss(W/kg)\n", + "25 \t\t\t1.1 \t\t\t0.329 \t\t\t\t0.071\n", + "Frequency(Hz)\t\tFlux Density(T)\t\tHysteresis loss(W/kg)\t\tEddy-current loss(W/kg)\n", + "25 \t\t\t1.5 \t\t\t0.667 \t\t\t\t0.133\n", + "Frequency(Hz)\t\tFlux Density(T)\t\tHysteresis loss(W/kg)\t\tEddy-current loss(W/kg)\n", + "60 \t\t\t1.1 \t\t\t0.789 \t\t\t\t0.411\n" + ] + } + ], + "prompt_number": 62 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.14, Page 118" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "u_o=4*math.pi*10**-7;#permeablity of air\n", + "u_r=500;#permeablity of steel\n", + "l_g=1*10**-2;#length of air gap section (in meter)\n", + "A_g=10*10**-4;#cross-sectional area of air gap section (in meter**2)\n", + "A_m=10*10**-4;#cross-sectional area of magnet section (in meter**2)\n", + "A_s=10*10**-4;#cross-sectional area of steel sections (in meter**2)\n", + "l_s=50*10**-2;#length of steel section (in meter)\n", + "#Refer to fig:-2.29 (Demagnetization and energy-product curves of a magnet)\n", + "H_m=-144*10**3;#(in Ampere/meter)\n", + "B_m=0.23;#Magnetic flux density (in Tesla)\n", + "\n", + "#Calculations\n", + "#refer to eqn:-2.55\n", + "l_m=(-1*100)*(((l_g*A_m)/(u_o*A_g))+((2*l_s*A_m)/(u_o*u_r*A_s)))*(B_m/H_m);# (in centimeter)\n", + "\n", + "#Result\n", + "print 'minimum length of magnet (in centimeter)=%.2f'%l_m" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "minimum length of magnet (in centimeter)=1.53\n" + ] + } + ], + "prompt_number": 64 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.15, Page 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "import sympy\n", + "\n", + "#Variable declaration\n", + "#From figure 2.32(a)\n", + "lm = 52-42 #mean length of magnets,mm\n", + "ls = 2.5+2.5+(2*math.pi*54.5/4) #mean length of yoke,mm\n", + "lg = 42-40 #air gap,mm\n", + "la = 17.5+17.5+(2*math.pi*22.5/4) #mean length of rotor,mm\n", + "\n", + "#Calculations\n", + "#From figure 2.32(b)\n", + "Am = 50*(52+42)*math.pi/4 #cross-sectional area of magnet,mm^2\n", + "As = 5*50 #cross-sectional area of yoke,mm^2\n", + "Ag = 50*(42+40)*math.pi/4 #cross-sectional area of air-gap,mm^2\n", + "Aa = 35*50 #cross-sectional area of rotor,mm^2\n", + "\n", + "Bm = 0.337 #T\n", + "phi = Bm*Am #Wb\n", + "phi_t = round(2*phi*10**-3,3) #Wb\n", + "#We know that, phi_c = 2.488cos100t mWb\n", + "from sympy import Symbol,diff,cos\n", + "t = Symbol('t')\n", + "d_phi_by_dt = diff(cos(100*t),t)\n", + "e = -phi_t*d_phi_by_dt\n", + "#Result\n", + "print \"The induced emf is\",e,\"V\"\n", + "#Incorrect result in textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The induced emf is 248.8*sin(100*t) V\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3.ipynb b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3.ipynb new file mode 100755 index 00000000..e9592db7 --- /dev/null +++ b/Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3.ipynb @@ -0,0 +1,399 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8539e9632363526a1a80f9cc5f76e7021b8f8d8a0160c441e4d39f4cdb32d610" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3: Principles of Electromechanical Energy Conversion" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.1, Page 144" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "A=20*10**-4;#surface area of each capacitor's plate \n", + "d=5*10**-3;#separation between the plates\n", + "e=(10**-9)/(36*math.pi);#permetivity of air\n", + "V=10*10**3;#potential diff. between the plates\n", + "\n", + "#Calculations&Results\n", + "F_e=(e*A*V**2)/(2*d**2);#electric force\n", + "g=9.81;#acceleration due to gravity (in meter/second**2)\n", + "#For condt of balancing electric force=weight of object\n", + "#F_e=m*g\n", + "m=F_e/g;\n", + "print 'mass of object (in grams)=%.2f'%(m*1000)\n", + "W_f=(e*A*V**2)/(2*d);\n", + "print 'energy stored in the feild (in micro-joules)=%.f'%(W_f*1000000)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass of object (in grams)=3.61\n", + "energy stored in the feild (in micro-joules)=177\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.3, Page 148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad\n", + "\n", + "#Variable declaration\n", + "#i=current in the ckt (in Amperes)\n", + "#x=total flux linkage\n", + "\n", + "#Calculations\n", + "def f(x):\n", + " return x/(6-(2*x))\n", + "#Refer to eqn:3.18\n", + "W_m,err=quad(f,0,2);#Energy stored in magnetic feild\n", + "\n", + "#Result\n", + "print 'Energy stored in magnetic feild (in Joules)=%.3f'%W_m" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Energy stored in magnetic feild (in Joules)=0.648\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.4, Page 151" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "import scipy\n", + "from scipy.misc import derivative\n", + "\n", + "#Variable declaration\n", + "N=100;#no. of turns of coil\n", + "A=10**-4;#area \n", + "x=1*10**-2;#length of air gap\n", + "u_o=4*math.pi*10**-7;#permeablity of air\n", + "u_r=2000;#permeablity of magnetic material\n", + "D=7.85*10**3;#density of material (in kg/m**3)\n", + "V=11*10**-6;#volume of material\n", + "m=D*V;#mass of material\n", + "g=9.81;#acceleration due to gravity\n", + "\n", + "#Calculations&Results\n", + "#Refer to fig:3.7\n", + "R_o=(15.5*10**-2)/(u_o*u_r*A);#reluctance of outer legs\n", + "R_c=(5.5*10**-2)/(u_o*u_r*A);#reluctance of central leg\n", + "def L( x ):#inductance\n", + " return (N**2)/ R ( x );\n", + "\n", + "def R( x ):#total reluctance \n", + " return R_c+R_g(x)+(0.5*(R_o+R_g(x)));\n", + "\n", + "def R_g( x ):#reluctance of air gap\n", + " return x/(u_o*A);\n", + "\n", + "x = 0.01 ; # Points of interest\n", + "t = derivative(L,x)\n", + "#t=[diag(derivative(L,x))];#t=dL/dx (at x=0.01m)\n", + "#since tIn book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\n" + ] + } + ], + "source": [ + "#cal of brake power,fuel consumption\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.4, Page:389 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\")\n", + "m=0.25;#specific fuel consumption in kg/KWh\n", + "Pb_mep=1.5*1000;#brake mean effective pressure of each cylinder in Kpa\n", + "N=100;#engine rpm\n", + "D=85*10**-2;#bore of cylinder in m\n", + "L=220*10**-2;#stroke in m\n", + "C=43*10**3;#calorific value of diesel in KJ/kg\n", + "A=math.pi*D**2/4;\n", + "BP=Pb_mep*L*A*N/60\n", + "print(\"brake power of engine(BP) in MW=\"),round(BP,2)\n", + "print(\"so brake power is 3.121 MW\")\n", + "print(\"The fuel consumption in kg/hr(m)=m*BP in kg/hr\")\n", + "m=m*BP\n", + "print(\"In order to find out brake thermal efficiency the heat input from fuel per second is required.\")\n", + "print(\"heat from fuel(Q)in KJ/s\")\n", + "print(\"Q=m*C/3600\")\n", + "Q=m*C/3600\n", + "print(\"energy to brake power=3120.97 KW\")\n", + "n=BP/Q\n", + "print(\"brake thermal efficiency(n)=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\")\n", + "print(\"NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.5;pg no: 389" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.5, Page:389 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\n", + "brake thermal efficiency(n)=3600/(m*C) 0.33\n", + "in percentage 33.49\n", + "brake power(BP)in KW\n", + "BP= 226.19\n", + "brake specific fuel consumption,m=mf/BP\n", + "so mf=m*BP in kg/hr\n", + "air consumption(ma)from given air fuel ratio=k*mf in kg/hr\n", + "ma in kg/min\n", + "using perfect gas equation,\n", + "P*Va=ma*R*T\n", + "sa Va=ma*R*T/P in m^3/min\n", + "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", + "volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder) 1.87\n", + "in percentage 186.55\n", + "NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\n" + ] + } + ], + "source": [ + "#cal of brake thermal efficiency,brake power,volumetric efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.5, Page:389 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\")\n", + "Pb_mep=6*10**5;#brake mean effective pressure in pa\n", + "N=600;#engine rpm\n", + "m=0.25;#specific fuel consumption in kg/KWh\n", + "D=20*10**-2;#bore of cylinder in m\n", + "L=30*10**-2;#stroke in m\n", + "k=26;#air to fuel ratio\n", + "C=43*10**3;#calorific value in KJ/kg\n", + "R=0.287;#gas constant in KJ/kg K\n", + "T=(27+273);#ambient temperature in K\n", + "P=1*10**2;#ambient pressure in Kpa\n", + "n=3600/(m*C)\n", + "print(\"brake thermal efficiency(n)=3600/(m*C)\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"brake power(BP)in KW\")\n", + "A=math.pi*D**2/4;\n", + "BP=4*Pb_mep*L*A*N/60000\n", + "print(\"BP=\"),round(BP,2)\n", + "print(\"brake specific fuel consumption,m=mf/BP\")\n", + "print(\"so mf=m*BP in kg/hr\")\n", + "mf=m*BP\n", + "print(\"air consumption(ma)from given air fuel ratio=k*mf in kg/hr\")\n", + "ma=k*mf\n", + "print(\"ma in kg/min\")\n", + "ma=ma/60\n", + "print(\"using perfect gas equation,\")\n", + "print(\"P*Va=ma*R*T\")\n", + "print(\"sa Va=ma*R*T/P in m^3/min\")\n", + "Va=ma*R*T/P\n", + "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", + "Vs=math.pi*D**2*L/4\n", + "n_vol=Va/(Vs*(N/2)*4)\n", + "print(\"volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder)\"),round(n_vol,2)\n", + "print(\"in percentage\"),round(n_vol*100,2)\n", + "print(\"NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.6;pg no: 390" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.6, Page:390 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\n", + "let the bore diameter be (D) m\n", + "piston speed(V)=2*L*N\n", + "so L=V/(2*N) in m\n", + "volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\n", + "so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\n", + "so air sucked =274.78*D^2 m^3/min\n", + "air requirement(ma),kg/min=A/F ratio*fuel consumption per min\n", + "so ma=r*m in kg/min\n", + "using perfect gas equation,P*Va=ma*R*T\n", + "so Va=ma*R*T/P in m^3/min\n", + "ideally,air sucked=Va\n", + "so 274.78*D^2=0.906\n", + "D=sqrt(0.906/274.78) in m\n", + "indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\n", + "brake power=indicated power*mechanical efficiency\n", + "BP=IP*n_mech in KW 10.35\n", + "so brake power=10.34 KW\n" + ] + } + ], + "source": [ + "#cal of brake power\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 10.6, Page:390 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\")\n", + "N=3000;#engine rpm\n", + "m=5;#fuel consumption in litre/hr\n", + "r=19;#air-fuel ratio\n", + "sg=0.7;#specific gravity of fuel\n", + "V=500;#piston speed in m/min\n", + "P_imep=6*10**5;#indicated mean effective pressure in pa\n", + "P=1.013*10**5;#ambient pressure in pa\n", + "T=(15+273);#ambient temperature in K\n", + "n_vol=0.7;#volumetric efficiency \n", + "n_mech=0.8;#mechanical efficiency\n", + "R=0.287;#gas constant for gas in KJ/kg K\n", + "print(\"let the bore diameter be (D) m\")\n", + "print(\"piston speed(V)=2*L*N\")\n", + "print(\"so L=V/(2*N) in m\")\n", + "L=V/(2*N)\n", + "L=0.0833;#approx.\n", + "print(\"volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\")\n", + "print(\"so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\")\n", + "n_vol*(math.pi*L/4)*N*2\n", + "print(\"so air sucked =274.78*D^2 m^3/min\")\n", + "print(\"air requirement(ma),kg/min=A/F ratio*fuel consumption per min\")\n", + "print(\"so ma=r*m in kg/min\")\n", + "ma=r*m*sg/60\n", + "print(\"using perfect gas equation,P*Va=ma*R*T\")\n", + "print(\"so Va=ma*R*T/P in m^3/min\")\n", + "Va=ma*R*T*1000/P \n", + "print(\"ideally,air sucked=Va\")\n", + "print(\"so 274.78*D^2=0.906\")\n", + "print(\"D=sqrt(0.906/274.78) in m\")\n", + "D=math.sqrt(0.906/274.78) \n", + "print(\"indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\")\n", + "IP=P_imep*L*(math.pi*D**2/4)*(N/60)*2/1000\n", + "print(\"brake power=indicated power*mechanical efficiency\")\n", + "BP=IP*n_mech \n", + "print(\"BP=IP*n_mech in KW\"),round(BP,2)\n", + "print(\"so brake power=10.34 KW\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.7;pg no: 391" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.7, Page:391 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\n", + "After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\n", + "friction power(FP)=5 KW\n", + "brake power(BP) in KW= 30.82\n", + "indicated power(IP) in KW= 35.82\n", + "mechanical efficiency(n_mech)= 0.86\n", + "in percentage 86.04\n", + "brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr= 0.29\n", + "brake thermal efficiency(n_bte)= 0.29\n", + "in percentage 28.67\n", + "also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\n", + "indicated thermal efficiency(n_ite)= 0.33\n", + "in percentage 33.32\n", + "indicated power(IP)=P_imep*L*A*N\n", + "so P_imep in Kpa= 76.01\n", + "Also,mechanical efficiency=P_bmep/P_imep\n", + "so P_bmep in Kpa= 65.4\n", + "brake power=30.82 KW\n", + "indicated power=35.82 KW\n", + "mechanical efficiency=86.04%\n", + "brake thermal efficiency=28.67%\n", + "indicated thermal efficiency=33.32%\n", + "brake mean effective pressure=65.39 Kpa\n", + "indicated mean effective pressure=76.01 Kpa\n" + ] + } + ], + "source": [ + "#cal of power and efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.7, Page:391 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\")\n", + "M=20;#load on dynamometer in kg\n", + "r=50*10**-2;#radius in m\n", + "N=3000;#speed of rotation in rpm\n", + "D=20*10**-2;#bore in m\n", + "L=30*10**-2;#stroke in m\n", + "m=0.15;#fuel supplying rate in kg/min\n", + "C=43;#calorific value of fuel in MJ/kg\n", + "FP=5;#friction power in KW\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\")\n", + "print(\"friction power(FP)=5 KW\")\n", + "BP=2*math.pi*N*(M*g*r)*10**-3/60\n", + "print(\"brake power(BP) in KW=\"),round(BP,2)\n", + "IP=BP+FP\n", + "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", + "n_mech=BP/IP\n", + "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "bsfc=m*60/BP\n", + "print(\"brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr=\"),round(bsfc,2)\n", + "n_bte=3600/(bsfc*C*1000)\n", + "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", + "print(\"in percentage\"),round(n_bte*100,2)\n", + "print(\"also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\")\n", + "n_ite=n_bte/n_mech\n", + "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", + "print(\"in percentage\"),round(n_ite*100,2)\n", + "print(\"indicated power(IP)=P_imep*L*A*N\")\n", + "P_imep=IP/(L*(math.pi*D**2/4)*N/60)\n", + "print(\"so P_imep in Kpa=\"),round(P_imep,2)\n", + "print(\"Also,mechanical efficiency=P_bmep/P_imep\")\n", + "n_mech=0.8604;#mechanical efficiency\n", + "P_bmep=P_imep*n_mech\n", + "print(\"so P_bmep in Kpa=\"),round(P_bmep,2)\n", + "print(\"brake power=30.82 KW\")\n", + "print(\"indicated power=35.82 KW\")\n", + "print(\"mechanical efficiency=86.04%\")\n", + "print(\"brake thermal efficiency=28.67%\")\n", + "print(\"indicated thermal efficiency=33.32%\")\n", + "print(\"brake mean effective pressure=65.39 Kpa\")\n", + "print(\"indicated mean effective pressure=76.01 Kpa\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.8;pg no: 392" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.8, Page:392 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\n", + "indicated power(IP) in KW= 282.74\n", + "mechanical efficiency(n_mech)=brake power/indicated power\n", + "so n_mech= 0.88\n", + "in percentage 88.42\n", + "brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\n", + "brake thermal efficiency(n_bte)= 0.35\n", + "in percentage 34.88\n", + "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", + "mass of air corresponding to above swept volume,using perfect gas equation\n", + "P*Vs=ma*R*T\n", + "so ma=(P*Vs)/(R*T) in kg\n", + "volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\n", + "so mass of air taken per minute in kg/min \n", + "mass corresponding to swept volume per minute in kg/min\n", + "so volumetric efficiency 0.8333\n", + "in percentage 83.3333\n", + "so indicated power =282.74 KW,mechanical efficiency=88.42%\n", + "brake thermal efficiency=34.88%,volumetric efficiency=83.33%\n" + ] + } + ], + "source": [ + "#cal of brake thermal efficiency,volumetric effeciency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.8, Page:392 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\")\n", + "N=300.;#engine rpm\n", + "BP=250.;#brake power in KW\n", + "D=30.*10**-2;#bore in m\n", + "L=25.*10**-2;#stroke in m\n", + "m=1.;#fuel consumption in kg/min\n", + "r=10.;#airfuel ratio \n", + "P_imep=0.8;#indicated mean effective pressure in pa\n", + "C=43.*10**3;#calorific value of fuel in KJ/kg\n", + "P=1.013*10**5;#ambient pressure in K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "T=(27.+273.);#ambient temperature in K\n", + "IP=P_imep*L*(math.pi*D**2/4)*N*4*10**3/60\n", + "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", + "print(\"mechanical efficiency(n_mech)=brake power/indicated power\")\n", + "n_mech=BP/IP\n", + "print(\"so n_mech=\"),round(n_mech,2)\n", + "print(\"in percentage \"),round(n_mech*100,2)\n", + "print(\"brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\")\n", + "bsfc=m*60./BP\n", + "n_bte=3600./(bsfc*C)\n", + "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", + "print(\"in percentage\"),round(n_bte*100,2)\n", + "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", + "Vs=math.pi*D**2*L/4\n", + "print(\"mass of air corresponding to above swept volume,using perfect gas equation\")\n", + "print(\"P*Vs=ma*R*T\")\n", + "print(\"so ma=(P*Vs)/(R*T) in kg\")\n", + "ma=(P*Vs)/(R*T*1000) \n", + "ma=0.02;#approx.\n", + "print(\"volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\")\n", + "print(\"so mass of air taken per minute in kg/min \")\n", + "1*10\n", + "print(\"mass corresponding to swept volume per minute in kg/min\")\n", + "ma*4*N/2\n", + "print(\"so volumetric efficiency \"),round(10./12.,4)\n", + "print(\"in percentage\"),round((10./12.)*100.,4)\n", + "print(\"so indicated power =282.74 KW,mechanical efficiency=88.42%\")\n", + "print(\"brake thermal efficiency=34.88%,volumetric efficiency=83.33%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.9;pg no: 393" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.9, Page:393 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\n", + "indicated mean effective pressure(P_imeb)=h*k in Kpa\n", + "indicated power(IP)=P_imeb*L*A*N/2 in KW 9.375\n", + "brake power(BP)=2*%pi*N*T in KW 4.62\n", + "mechanical efficiency(n_mech)= 0.49\n", + "in percentage 49.31\n", + "so indicated power=9.375 KW\n", + "brake power=4.62 KW\n", + "mechanical efficiency=49.28%\n", + "energy liberated from fuel(Ef)=C*m/60 in KJ/s\n", + "energy available as brake power(BP)=4.62 KW\n", + "energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\n", + "energy carried by exhaust gases(Eg)=30 KJ/s\n", + "unaccounted energy loss in KW= 34.75\n", + "NOTE=>overall energy balance sheet is attached as jpg file with this code.\n" + ] + } + ], + "source": [ + "#cal of indicated power,brake power,mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.9, Page:393 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\")\n", + "h=10.;#height of indicator diagram in mm\n", + "k=25.;#indicator constant in KN/m^2 per mm\n", + "N=300.;#engine rpm\n", + "Vs=1.5*10**-2;#swept volume in m^3\n", + "M=60.;#effective brake load upon dynamometer in kg\n", + "r=50.*10**-2;#effective brake drum radius in m\n", + "m=0.12;#fuel consumption in kg/min\n", + "C=42.*10**3;#calorific value in KJ/kg\n", + "mw=6.;#circulating water rate in kg/min\n", + "T1=35.;#cooling water entering temperature in degree celcius\n", + "T2=70.;#cooling water leaving temperature in degree celcius\n", + "Eg=30.;#exhaust gases leaving energy in KJ/s\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "g=9.81;#accelaration due to gravity in m/s^2\n", + "print(\"indicated mean effective pressure(P_imeb)=h*k in Kpa\")\n", + "P_imeb=h*k\n", + "IP=P_imeb*Vs*N/(2*60)\n", + "print(\"indicated power(IP)=P_imeb*L*A*N/2 in KW\") ,round(IP,3)\n", + "BP=2*math.pi*N*(M*g*r*10**-3)/(2*60)\n", + "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", + "n_mech=BP/IP\n", + "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "print(\"so indicated power=9.375 KW\")\n", + "print(\"brake power=4.62 KW\")\n", + "print(\"mechanical efficiency=49.28%\")\n", + "print(\"energy liberated from fuel(Ef)=C*m/60 in KJ/s\")\n", + "Ef=C*m/60\n", + "print(\"energy available as brake power(BP)=4.62 KW\")\n", + "print(\"energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\")\n", + "Ec=(mw/M)*Cw*(T2-T1)\n", + "print(\"energy carried by exhaust gases(Eg)=30 KJ/s\")\n", + "Ef-BP-Ec-Eg\n", + "print(\"unaccounted energy loss in KW=\"),round(Ef-BP-Ec-Eg,2)\n", + "print(\"NOTE=>overall energy balance sheet is attached as jpg file with this code.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.10;pg no: 394" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.10, Page:394 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\n", + "brake power(BP)=2*%pi*N*T in KW 47.12\n", + "so brake power=47.124 KW\n", + "brake specific fuel consumption(bsfc) in kg/KW hr= 0.34\n", + "indicated power(IP) in Kw= 52.36\n", + "indicated thermal efficiency(n_ite)= 0.28\n", + "in percentage 28.05\n", + "so indicated thermal efficiency=28.05%\n", + "heat available from fuel(Qf)=(m/mw)*C in KJ/min 11200.0\n", + "energy consumed as brake power(BP) in KJ/min= 2827.43\n", + "energy carried by cooling water(Qw) in KJ/min= 1442.1\n", + "energy carried by exhaust gases(Qg) in KJ/min= 4786.83\n", + "unaccounted energy loss in KJ/min 2143.63\n", + "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\n" + ] + } + ], + "source": [ + "#cal of brake power,brake specific fuel consumption,indicated thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.10, Page:394 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\")\n", + "m=4.;#mass of fuel consumed in kg\n", + "N=1500.;#engine rpm\n", + "mw=15.;#water circulation rate in kg/min\n", + "T1=27.;#cooling water inlet temperature in degree celcius\n", + "T2=50.;#cooling water outlet temperature in degree celcius\n", + "ma=150.;#mass of air consumed in kg\n", + "T_exhaust=400.;#exhaust temperature in degree celcius\n", + "T_atm=27.;#atmospheric temperature in degree celcius\n", + "Cg=1.25;#mean specific heat of exhaust gases in KJ/kg K\n", + "n_mech=0.9;#mechanical efficiency\n", + "T=300.*10**-3;#brake torque in N\n", + "C=42.*10**3;#calorific value in KJ/kg\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "BP=2.*math.pi*N*T/60\n", + "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", + "print(\"so brake power=47.124 KW\")\n", + "bsfc=m*60/(mw*BP)\n", + "print(\"brake specific fuel consumption(bsfc) in kg/KW hr=\"),round(bsfc,2)\n", + "IP=BP/n_mech\n", + "print(\"indicated power(IP) in Kw=\"),round(IP,2)\n", + "n_ite=IP*mw*60/(m*C)\n", + "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", + "print(\"in percentage\"),round(n_ite*100,2)\n", + "print(\"so indicated thermal efficiency=28.05%\")\n", + "Qf=(m/mw)*C\n", + "print(\"heat available from fuel(Qf)=(m/mw)*C in KJ/min\"),round(Qf,2)\n", + "BP=BP*60 \n", + "print(\"energy consumed as brake power(BP) in KJ/min=\"),round(BP,2)\n", + "Qw=mw*Cw*(T2-T1)\n", + "print(\"energy carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", + "Qg=(ma+m)*Cg*(T_exhaust-T_atm)/mw\n", + "print(\"energy carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", + "Qf-(BP+Qw+Qg)\n", + "print(\"unaccounted energy loss in KJ/min\"),round(Qf-(BP+Qw+Qg),2)\n", + "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.11;pg no: 395" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.11, Page:395 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\n", + "indicated power of 1st cylinder=BP-BP1 in KW\n", + "indicated power of 2nd cylinder=BP-BP2 in KW\n", + "indicated power of 3rd cylinder=BP-BP3 in KW\n", + "indicated power of 4th cylinder=BP-BP4 in KW\n", + "indicated power of 5th cylinder=BP-BP5 in KW\n", + "indicated power of 6th cylinder=BP-BP6 in KW\n", + " total indicated power(IP)in KW= 61.9\n", + "mechanical efficiency(n_mech)= 0.81\n", + "in percentage 80.78\n", + "so indicated power=61.9 KW\n", + "mechanical efficiency=80.77%\n" + ] + } + ], + "source": [ + "#cal of indicated power and mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.11, Page:395 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\")\n", + "BP=50.;#brake power output at full load in KW\n", + "BP1=40.1;#brake power output of 1st cylinder in KW\n", + "BP2=39.5;#brake power output of 2nd cylinder in KW\n", + "BP3=39.1;#brake power output of 3rd cylinder in KW\n", + "BP4=39.6;#brake power output of 4th cylinder in KW\n", + "BP5=39.8;#brake power output of 5th cylinder in KW\n", + "BP6=40.;#brake power output of 6th cylinder in KW\n", + "print(\"indicated power of 1st cylinder=BP-BP1 in KW\")\n", + "BP-BP1\n", + "print(\"indicated power of 2nd cylinder=BP-BP2 in KW\")\n", + "BP-BP2\n", + "print(\"indicated power of 3rd cylinder=BP-BP3 in KW\")\n", + "BP-BP3\n", + "print(\"indicated power of 4th cylinder=BP-BP4 in KW\")\n", + "BP-BP4\n", + "print(\"indicated power of 5th cylinder=BP-BP5 in KW\")\n", + "BP-BP5\n", + "print(\"indicated power of 6th cylinder=BP-BP6 in KW\")\n", + "BP-BP6\n", + "IP=9.9+10.5+10.9+10.4+10.2+10\n", + "print(\" total indicated power(IP)in KW=\"),round(IP,2)\n", + "n_mech=BP/IP\n", + "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "print(\"so indicated power=61.9 KW\")\n", + "print(\"mechanical efficiency=80.77%\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.12;pg no: 396" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.12, Page:396 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\n", + "brake power output of engine(BP) in KW= 19.63\n", + "brake power when cylinder 1 is cut(BP1) in KW= 13.74\n", + "so indicated power of first cylinder(IP1) in KW= 5.89\n", + "brake power when cylinder 2 is cut(BP2) in KW= 14.14\n", + "so indicated power of second cylinder(IP2) in KW= 5.5\n", + "brake power when cylinder 3 is cut(BP3) in KW= 14.29\n", + "so indicated power of third cylinder(IP3) in KW= 5.34\n", + "brake power when cylinder 4 is cut(BP4) in KW= 13.35\n", + "so indicated power of fourth cylinder(IP4) in KW= 6.28\n", + "now total indicated power(IP) in KW 23.01\n", + "engine mechanical efficiency(n_mech)= 0.85\n", + "in percentage 85.32\n", + "so BP=19.63 KW,IP=23 KW,n_mech=83.35%\n", + "heat liberated by fuel(Qf)=m*C in KJ/min 8127.0\n", + "heat carried by exhaust gases(Qg) in KJ/min= 1436.02\n", + "heat carried by cooling water(Qw) in KJ/min= 1730.52\n", + "energy to brake power(BP) in KJ/min= 1177.8\n", + "unaccounted losses in KJ/min 3782.66\n", + "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \n" + ] + } + ], + "source": [ + "#cal of brake power,indicated power,heat balance sheet\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 10.12, Page:396 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\")\n", + "N=1500.;#engine rpm at full load\n", + "F=250.;#brake load at full load in N\n", + "F1=175.;#brake reading 1 in N\n", + "F2=180.;#brake reading 2 in N\n", + "F3=182.;#brake reading 3 in N\n", + "F4=170.;#brake reading 4 in N\n", + "r=50.*10**-2;#brake drum radius in m\n", + "m=0.189;#fuel consumption rate in kg/min\n", + "C=43.*10**3;#fuel calorific value in KJ/kg\n", + "k=12.;#air to fuel ratio\n", + "T_exhaust=600.;#exhaust gas temperature in degree celcius\n", + "mw=18.;#cooling water flow rate in kg/min\n", + "T1=27.;#cooling water entering temperature in degree celcius\n", + "T2=50.;#cooling water leaving temperature in degree celcius\n", + "T_atm=27.;#atmospheric air temperature\n", + "Cg=1.02;#specific heat of exhaust gas in KJ/kg K\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "BP=2.*math.pi*N*F*r*10**-3/60.\n", + "print(\"brake power output of engine(BP) in KW=\"),round(BP,2)\n", + "BP1=2.*math.pi*N*F1*r*10**-3/60.\n", + "print(\"brake power when cylinder 1 is cut(BP1) in KW=\"),round(BP1,2)\n", + "IP1=BP-BP1\n", + "print(\"so indicated power of first cylinder(IP1) in KW=\"),round(IP1,2)\n", + "BP2=2.*math.pi*N*F2*r*10**-3/60.\n", + "print(\"brake power when cylinder 2 is cut(BP2) in KW=\"),round(BP2,2)\n", + "IP2=BP-BP2\n", + "print(\"so indicated power of second cylinder(IP2) in KW=\"),round(IP2,2)\n", + "BP3=2.*math.pi*N*F3*r*10**-3/60.\n", + "print(\"brake power when cylinder 3 is cut(BP3) in KW=\"),round(BP3,2)\n", + "IP3=BP-BP3\n", + "print(\"so indicated power of third cylinder(IP3) in KW=\"),round(IP3,2)\n", + "BP4=2.*math.pi*N*F4*r*10**-3/60.\n", + "print(\"brake power when cylinder 4 is cut(BP4) in KW=\"),round(BP4,2)\n", + "IP4=BP-BP4\n", + "print(\"so indicated power of fourth cylinder(IP4) in KW=\"),round(IP4,2)\n", + "IP=IP1+IP2+IP3+IP4\n", + "print(\"now total indicated power(IP) in KW\"),round(IP,2)\n", + "n_mech=BP/IP\n", + "print(\"engine mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "print(\"so BP=19.63 KW,IP=23 KW,n_mech=83.35%\")\n", + "Qf=m*C\n", + "print(\"heat liberated by fuel(Qf)=m*C in KJ/min\"),round(Qf,2)\n", + "Qg=(k+1)*m*Cg*(T_exhaust-T_atm)\n", + "print(\"heat carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", + "Qw=mw*Cw*(T2-T1)\n", + "print(\"heat carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", + "BP=19.63*60\n", + "print(\"energy to brake power(BP) in KJ/min=\"),round(19.63*60,2)\n", + "Qf-(Qg+Qw+BP)\n", + "print(\"unaccounted losses in KJ/min\"),round(Qf-(Qg+Qw+BP),2)\n", + "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.13;pg no: 397" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.13, Page:397 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\n", + "brake power(BP)=2*%pi*N*T in KW\n", + "indicated power(IP)=(mep*L*A*N)/60000 in KW\n", + "A> heat added(Q)=m*C/3600 in KJ/s 52.36\n", + "or Q in KJ/min\n", + "thermal efficiency(n_th)= 0.27\n", + "in percentage 26.85\n", + "B> heat equivalent of brake power(BP) in KJ/min= 659.76\n", + "C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\n", + "heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\n", + "mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\n", + "mg=(ma+m)/60\n", + "mass of steam in exhaust gases in kg/min\n", + "mass of dry exhaust gases in kg/min\n", + "D> heat carried by steam in exhaust in KJ/min 299.86\n", + "E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min 782.64\n", + "F> unaccounted loss=A-B-C-D-E in KJ/min 537.4\n", + "NOTE># on per minute basis is attached as jpg file with this code.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency and heat balance sheet\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.13, Page:397 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\")\n", + "D=20.*10**-2;#cylinder diameter in m\n", + "L=28.*10**-2;#stroke in m\n", + "m=4.22;#mass of fuel used in kg\n", + "C=44670.;#calorific value of fuel in KJ/kg\n", + "N=21000./60.;#engine rpm\n", + "mep=2.74*10**5;#mean effective pressure in pa\n", + "F=600.;#net brake load applied to a drum of 100 cm diameter in N\n", + "r=50.*10**-2;#brake drum radius in m\n", + "mw=495.;#total mass of cooling water in kg\n", + "T1=13.;#cooling water inlet temperature in degree celcius\n", + "T2=38.;#cooling water outlet temperature in degree celcius\n", + "ma=135.;#mass of air used in kg\n", + "T_air=20.;#temperature of air in test room in degree celcius\n", + "T_exhaust=370.;#temperature of exhaust gases in degree celcius\n", + "Cp_gases=1.005;#specific heat of gases in KJ/kg K\n", + "Cp_steam=2.093;#specific heat of steam at atmospheric pressure in KJ/kg K\n", + "Cpw=4.18;#specific heat of water in KJ/kg K\n", + "print(\"brake power(BP)=2*%pi*N*T in KW\")\n", + "BP=2*math.pi*N*F*r/60000\n", + "print(\"indicated power(IP)=(mep*L*A*N)/60000 in KW\")\n", + "IP=(mep*L*(math.pi*D**2/4)*N)/60000\n", + "Q=m*C/3600\n", + "print(\"A> heat added(Q)=m*C/3600 in KJ/s\"),round(Q,2)\n", + "print(\"or Q in KJ/min\")\n", + "Q=Q*60\n", + "Q=52.36;#heat added in KJ/s\n", + "n_th=IP/Q\n", + "print(\"thermal efficiency(n_th)= \"),round(n_th,2)\n", + "print(\"in percentage\"),round(n_th*100,2)\n", + "BP=BP*60\n", + "print(\"B> heat equivalent of brake power(BP) in KJ/min= \"),round(10.996*60,2)\n", + "print(\"C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\")\n", + "Qw=mw*Cpw*(T2-T1)/60\n", + "print(\"heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\")\n", + "print(\"mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\")\n", + "print(\"mg=(ma+m)/60\")\n", + "mg=(ma+m)/60\n", + "print(\"mass of steam in exhaust gases in kg/min\")\n", + "9*(0.15*m/60)\n", + "print(\"mass of dry exhaust gases in kg/min\")\n", + "mg-0.095\n", + "0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100))\n", + "print(\"D> heat carried by steam in exhaust in KJ/min\"),round(0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100)),2)\n", + "Qg=2.225*Cp_gases*(T_exhaust-T_air)\n", + "print(\"E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min\"),round(Qg,2)\n", + "print(\"F> unaccounted loss=A-B-C-D-E in KJ/min\"),round(3141.79-659.76-862.13-299.86-782.64,2)\n", + "print(\"NOTE># on per minute basis is attached as jpg file with this code.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter10_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter10_1.ipynb new file mode 100755 index 00000000..2d9241c2 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter10_1.ipynb @@ -0,0 +1,1080 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10:Intoduction to Internal Combustion engines" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.1;pg no: 387" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.1, Page:387 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 1\n", + "from stroke to bore ratio i.e L/D=1.2 and cylinder diameter=bore,i.e D=12 cm\n", + "stroke(L)=1.2*D in m\n", + "Area of indicator diagram(A)=30*10^-4 m^2\n", + "length of indicator diagram(l)=(1/2)*L in m\n", + "mean effective pressure(mep)=A*k/l in N/m^2\n", + "cross-section area of piston(Ap)=%pi*D^2/4 in m^2\n", + "for one cylinder indicated power(IP)=mep*Ap*L*N/(2*60) in W\n", + "for four cylinder total indicated power(IP)=4*IP in W 90477.87\n", + "frictional power loss(FP)=0.10*IP in W\n", + "brake power available(BP)=indicated power-frictional power=IP-FP in W 81430.08\n", + "therefore,mechanical efficiency of engine(n)=brake power/indicated power=BP/IP= 0.9\n", + "in percentage 90.0\n", + "so indicated power=90477.8 W\n", + "and mechanical efficiency=90%\n" + ] + } + ], + "source": [ + "#cal of indicated power,,mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 10.1, Page:387 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 1\")\n", + "k=20.*10**6;#spring constant in N/m^2\n", + "N=2000.;#engine rpm\n", + "print(\"from stroke to bore ratio i.e L/D=1.2 and cylinder diameter=bore,i.e D=12 cm\")\n", + "D=12.*10**-2;#cylinder diameter in m\n", + "print(\"stroke(L)=1.2*D in m\")\n", + "L=1.2*D\n", + "print(\"Area of indicator diagram(A)=30*10^-4 m^2\")\n", + "A=30.*10**-4;\n", + "print(\"length of indicator diagram(l)=(1/2)*L in m\")\n", + "l=(1./2.)*L\n", + "print(\"mean effective pressure(mep)=A*k/l in N/m^2\")\n", + "mep=A*k/l\n", + "print(\"cross-section area of piston(Ap)=%pi*D^2/4 in m^2\")\n", + "Ap=math.pi*D**2./4.\n", + "print(\"for one cylinder indicated power(IP)=mep*Ap*L*N/(2*60) in W\")\n", + "IP=mep*Ap*L*N/(2.*60.)\n", + "IP=4.*IP\n", + "print(\"for four cylinder total indicated power(IP)=4*IP in W\"),round(IP,2)\n", + "print(\"frictional power loss(FP)=0.10*IP in W\")\n", + "FP=0.10*IP\n", + "BP=IP-FP\n", + "print(\"brake power available(BP)=indicated power-frictional power=IP-FP in W\"),round(BP,2)\n", + "n=BP/IP\n", + "print(\"therefore,mechanical efficiency of engine(n)=brake power/indicated power=BP/IP=\"),round(BP/IP,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so indicated power=90477.8 W\")\n", + "print(\"and mechanical efficiency=90%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.2;pg no: 388" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.2, Page:388 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 2\n", + "reciprocating pump is work absorbing machine having its mechanism similar to the piston-cylinder arrangement in IC engine.\n", + "mean effective pressure(mep)=A*k/l in pa\n", + "indicator power(IP)=Ap*L*mep*N*1*2/60 in W\n", + "(it is double acting so let us assume total power to be double of that in single acting) 88357.29\n", + "so power required to drive=88.36 KW\n" + ] + } + ], + "source": [ + "#cal of power required to drive\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.2, Page:388 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 2\")\n", + "A=40*10**-4;#area of indicator diagram in m^2\n", + "l=8*10**-2;#length of indicator diagram in m\n", + "D=15*10**-2;#bore of cylinder in m\n", + "L=20*10**-2;#stroke in m\n", + "k=1.5*10**8;#spring constant in pa/m\n", + "N=100;#pump motor rpm\n", + "print(\"reciprocating pump is work absorbing machine having its mechanism similar to the piston-cylinder arrangement in IC engine.\")\n", + "print(\"mean effective pressure(mep)=A*k/l in pa\")\n", + "mep=A*k/l \n", + "print(\"indicator power(IP)=Ap*L*mep*N*1*2/60 in W\")\n", + "Ap=math.pi*D**2/4\n", + "IP=Ap*L*mep*N*2/60\n", + "print(\"(it is double acting so let us assume total power to be double of that in single acting)\"),round(IP,2)\n", + "print(\"so power required to drive=88.36 KW\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.3;pg no: 388" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.3, Page:388 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 3\n", + "indicated power(IP)=brake power/mechanical efficiency in KW= 42.22\n", + "frictional power loss(FP)=IP-BP in KW 4.22\n", + "brake power at quater load(BPq)=0.25*BP in KW\n", + "mechanical efficiency(n1)=BPq/IP 0.69\n", + "in percentage 69.23\n", + "so indicated power=42.22 KW\n", + "frictional power loss=4.22 KW\n", + "mechanical efficiency=69.24%\n" + ] + } + ], + "source": [ + "#cal of indicated power,frictional power loss,mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "print\"Example 10.3, Page:388 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 3\")\n", + "n=0.9;#mechanical efficiency of engine\n", + "BP=38;#brake power in KW\n", + "IP=BP/n\n", + "print(\"indicated power(IP)=brake power/mechanical efficiency in KW=\"),round(IP,2)\n", + "FP=IP-BP\n", + "print(\"frictional power loss(FP)=IP-BP in KW\"),round(FP,2)\n", + "print(\"brake power at quater load(BPq)=0.25*BP in KW\")\n", + "BPq=0.25*BP\n", + "IP=BPq+FP;\n", + "n1=BPq/IP\n", + "print(\"mechanical efficiency(n1)=BPq/IP\"),round(n1,2)\n", + "print(\"in percentage\"),round(n1*100,2)\n", + "print(\"so indicated power=42.22 KW\")\n", + "print(\"frictional power loss=4.22 KW\")\n", + "print(\"mechanical efficiency=69.24%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.4;pg no: 389" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.4, Page:389 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\n", + "brake power of engine(BP) in MW= 3120.98\n", + "so brake power is 3.121 MW\n", + "The fuel consumption in kg/hr(m)=m*BP in kg/hr\n", + "In order to find out brake thermal efficiency the heat input from fuel per second is required.\n", + "heat from fuel(Q)in KJ/s\n", + "Q=m*C/3600\n", + "energy to brake power=3120.97 KW\n", + "brake thermal efficiency(n)= 0.33\n", + "in percentage 33.49\n", + "so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\n", + "NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\n" + ] + } + ], + "source": [ + "#cal of brake power,fuel consumption\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.4, Page:389 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\")\n", + "m=0.25;#specific fuel consumption in kg/KWh\n", + "Pb_mep=1.5*1000;#brake mean effective pressure of each cylinder in Kpa\n", + "N=100;#engine rpm\n", + "D=85*10**-2;#bore of cylinder in m\n", + "L=220*10**-2;#stroke in m\n", + "C=43*10**3;#calorific value of diesel in KJ/kg\n", + "A=math.pi*D**2/4;\n", + "BP=Pb_mep*L*A*N/60\n", + "print(\"brake power of engine(BP) in MW=\"),round(BP,2)\n", + "print(\"so brake power is 3.121 MW\")\n", + "print(\"The fuel consumption in kg/hr(m)=m*BP in kg/hr\")\n", + "m=m*BP\n", + "print(\"In order to find out brake thermal efficiency the heat input from fuel per second is required.\")\n", + "print(\"heat from fuel(Q)in KJ/s\")\n", + "print(\"Q=m*C/3600\")\n", + "Q=m*C/3600\n", + "print(\"energy to brake power=3120.97 KW\")\n", + "n=BP/Q\n", + "print(\"brake thermal efficiency(n)=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\")\n", + "print(\"NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.5;pg no: 389" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.5, Page:389 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\n", + "brake thermal efficiency(n)=3600/(m*C) 0.33\n", + "in percentage 33.49\n", + "brake power(BP)in KW\n", + "BP= 226.19\n", + "brake specific fuel consumption,m=mf/BP\n", + "so mf=m*BP in kg/hr\n", + "air consumption(ma)from given air fuel ratio=k*mf in kg/hr\n", + "ma in kg/min\n", + "using perfect gas equation,\n", + "P*Va=ma*R*T\n", + "sa Va=ma*R*T/P in m^3/min\n", + "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", + "volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder) 1.87\n", + "in percentage 186.55\n", + "NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\n" + ] + } + ], + "source": [ + "#cal of brake thermal efficiency,brake power,volumetric efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.5, Page:389 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\")\n", + "Pb_mep=6*10**5;#brake mean effective pressure in pa\n", + "N=600;#engine rpm\n", + "m=0.25;#specific fuel consumption in kg/KWh\n", + "D=20*10**-2;#bore of cylinder in m\n", + "L=30*10**-2;#stroke in m\n", + "k=26;#air to fuel ratio\n", + "C=43*10**3;#calorific value in KJ/kg\n", + "R=0.287;#gas constant in KJ/kg K\n", + "T=(27+273);#ambient temperature in K\n", + "P=1*10**2;#ambient pressure in Kpa\n", + "n=3600/(m*C)\n", + "print(\"brake thermal efficiency(n)=3600/(m*C)\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"brake power(BP)in KW\")\n", + "A=math.pi*D**2/4;\n", + "BP=4*Pb_mep*L*A*N/60000\n", + "print(\"BP=\"),round(BP,2)\n", + "print(\"brake specific fuel consumption,m=mf/BP\")\n", + "print(\"so mf=m*BP in kg/hr\")\n", + "mf=m*BP\n", + "print(\"air consumption(ma)from given air fuel ratio=k*mf in kg/hr\")\n", + "ma=k*mf\n", + "print(\"ma in kg/min\")\n", + "ma=ma/60\n", + "print(\"using perfect gas equation,\")\n", + "print(\"P*Va=ma*R*T\")\n", + "print(\"sa Va=ma*R*T/P in m^3/min\")\n", + "Va=ma*R*T/P\n", + "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", + "Vs=math.pi*D**2*L/4\n", + "n_vol=Va/(Vs*(N/2)*4)\n", + "print(\"volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder)\"),round(n_vol,2)\n", + "print(\"in percentage\"),round(n_vol*100,2)\n", + "print(\"NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.6;pg no: 390" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.6, Page:390 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\n", + "let the bore diameter be (D) m\n", + "piston speed(V)=2*L*N\n", + "so L=V/(2*N) in m\n", + "volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\n", + "so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\n", + "so air sucked =274.78*D^2 m^3/min\n", + "air requirement(ma),kg/min=A/F ratio*fuel consumption per min\n", + "so ma=r*m in kg/min\n", + "using perfect gas equation,P*Va=ma*R*T\n", + "so Va=ma*R*T/P in m^3/min\n", + "ideally,air sucked=Va\n", + "so 274.78*D^2=0.906\n", + "D=sqrt(0.906/274.78) in m\n", + "indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\n", + "brake power=indicated power*mechanical efficiency\n", + "BP=IP*n_mech in KW 10.35\n", + "so brake power=10.34 KW\n" + ] + } + ], + "source": [ + "#cal of brake power\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 10.6, Page:390 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\")\n", + "N=3000;#engine rpm\n", + "m=5;#fuel consumption in litre/hr\n", + "r=19;#air-fuel ratio\n", + "sg=0.7;#specific gravity of fuel\n", + "V=500;#piston speed in m/min\n", + "P_imep=6*10**5;#indicated mean effective pressure in pa\n", + "P=1.013*10**5;#ambient pressure in pa\n", + "T=(15+273);#ambient temperature in K\n", + "n_vol=0.7;#volumetric efficiency \n", + "n_mech=0.8;#mechanical efficiency\n", + "R=0.287;#gas constant for gas in KJ/kg K\n", + "print(\"let the bore diameter be (D) m\")\n", + "print(\"piston speed(V)=2*L*N\")\n", + "print(\"so L=V/(2*N) in m\")\n", + "L=V/(2*N)\n", + "L=0.0833;#approx.\n", + "print(\"volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\")\n", + "print(\"so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\")\n", + "n_vol*(math.pi*L/4)*N*2\n", + "print(\"so air sucked =274.78*D^2 m^3/min\")\n", + "print(\"air requirement(ma),kg/min=A/F ratio*fuel consumption per min\")\n", + "print(\"so ma=r*m in kg/min\")\n", + "ma=r*m*sg/60\n", + "print(\"using perfect gas equation,P*Va=ma*R*T\")\n", + "print(\"so Va=ma*R*T/P in m^3/min\")\n", + "Va=ma*R*T*1000/P \n", + "print(\"ideally,air sucked=Va\")\n", + "print(\"so 274.78*D^2=0.906\")\n", + "print(\"D=sqrt(0.906/274.78) in m\")\n", + "D=math.sqrt(0.906/274.78) \n", + "print(\"indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\")\n", + "IP=P_imep*L*(math.pi*D**2/4)*(N/60)*2/1000\n", + "print(\"brake power=indicated power*mechanical efficiency\")\n", + "BP=IP*n_mech \n", + "print(\"BP=IP*n_mech in KW\"),round(BP,2)\n", + "print(\"so brake power=10.34 KW\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.7;pg no: 391" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.7, Page:391 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\n", + "After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\n", + "friction power(FP)=5 KW\n", + "brake power(BP) in KW= 30.82\n", + "indicated power(IP) in KW= 35.82\n", + "mechanical efficiency(n_mech)= 0.86\n", + "in percentage 86.04\n", + "brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr= 0.29\n", + "brake thermal efficiency(n_bte)= 0.29\n", + "in percentage 28.67\n", + "also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\n", + "indicated thermal efficiency(n_ite)= 0.33\n", + "in percentage 33.32\n", + "indicated power(IP)=P_imep*L*A*N\n", + "so P_imep in Kpa= 76.01\n", + "Also,mechanical efficiency=P_bmep/P_imep\n", + "so P_bmep in Kpa= 65.4\n", + "brake power=30.82 KW\n", + "indicated power=35.82 KW\n", + "mechanical efficiency=86.04%\n", + "brake thermal efficiency=28.67%\n", + "indicated thermal efficiency=33.32%\n", + "brake mean effective pressure=65.39 Kpa\n", + "indicated mean effective pressure=76.01 Kpa\n" + ] + } + ], + "source": [ + "#cal of power and efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.7, Page:391 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\")\n", + "M=20;#load on dynamometer in kg\n", + "r=50*10**-2;#radius in m\n", + "N=3000;#speed of rotation in rpm\n", + "D=20*10**-2;#bore in m\n", + "L=30*10**-2;#stroke in m\n", + "m=0.15;#fuel supplying rate in kg/min\n", + "C=43;#calorific value of fuel in MJ/kg\n", + "FP=5;#friction power in KW\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\")\n", + "print(\"friction power(FP)=5 KW\")\n", + "BP=2*math.pi*N*(M*g*r)*10**-3/60\n", + "print(\"brake power(BP) in KW=\"),round(BP,2)\n", + "IP=BP+FP\n", + "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", + "n_mech=BP/IP\n", + "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "bsfc=m*60/BP\n", + "print(\"brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr=\"),round(bsfc,2)\n", + "n_bte=3600/(bsfc*C*1000)\n", + "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", + "print(\"in percentage\"),round(n_bte*100,2)\n", + "print(\"also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\")\n", + "n_ite=n_bte/n_mech\n", + "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", + "print(\"in percentage\"),round(n_ite*100,2)\n", + "print(\"indicated power(IP)=P_imep*L*A*N\")\n", + "P_imep=IP/(L*(math.pi*D**2/4)*N/60)\n", + "print(\"so P_imep in Kpa=\"),round(P_imep,2)\n", + "print(\"Also,mechanical efficiency=P_bmep/P_imep\")\n", + "n_mech=0.8604;#mechanical efficiency\n", + "P_bmep=P_imep*n_mech\n", + "print(\"so P_bmep in Kpa=\"),round(P_bmep,2)\n", + "print(\"brake power=30.82 KW\")\n", + "print(\"indicated power=35.82 KW\")\n", + "print(\"mechanical efficiency=86.04%\")\n", + "print(\"brake thermal efficiency=28.67%\")\n", + "print(\"indicated thermal efficiency=33.32%\")\n", + "print(\"brake mean effective pressure=65.39 Kpa\")\n", + "print(\"indicated mean effective pressure=76.01 Kpa\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.8;pg no: 392" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.8, Page:392 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\n", + "indicated power(IP) in KW= 282.74\n", + "mechanical efficiency(n_mech)=brake power/indicated power\n", + "so n_mech= 0.88\n", + "in percentage 88.42\n", + "brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\n", + "brake thermal efficiency(n_bte)= 0.35\n", + "in percentage 34.88\n", + "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", + "mass of air corresponding to above swept volume,using perfect gas equation\n", + "P*Vs=ma*R*T\n", + "so ma=(P*Vs)/(R*T) in kg\n", + "volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\n", + "so mass of air taken per minute in kg/min \n", + "mass corresponding to swept volume per minute in kg/min\n", + "so volumetric efficiency 0.8333\n", + "in percentage 83.3333\n", + "so indicated power =282.74 KW,mechanical efficiency=88.42%\n", + "brake thermal efficiency=34.88%,volumetric efficiency=83.33%\n" + ] + } + ], + "source": [ + "#cal of brake thermal efficiency,volumetric effeciency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.8, Page:392 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\")\n", + "N=300.;#engine rpm\n", + "BP=250.;#brake power in KW\n", + "D=30.*10**-2;#bore in m\n", + "L=25.*10**-2;#stroke in m\n", + "m=1.;#fuel consumption in kg/min\n", + "r=10.;#airfuel ratio \n", + "P_imep=0.8;#indicated mean effective pressure in pa\n", + "C=43.*10**3;#calorific value of fuel in KJ/kg\n", + "P=1.013*10**5;#ambient pressure in K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "T=(27.+273.);#ambient temperature in K\n", + "IP=P_imep*L*(math.pi*D**2/4)*N*4*10**3/60\n", + "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", + "print(\"mechanical efficiency(n_mech)=brake power/indicated power\")\n", + "n_mech=BP/IP\n", + "print(\"so n_mech=\"),round(n_mech,2)\n", + "print(\"in percentage \"),round(n_mech*100,2)\n", + "print(\"brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\")\n", + "bsfc=m*60./BP\n", + "n_bte=3600./(bsfc*C)\n", + "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", + "print(\"in percentage\"),round(n_bte*100,2)\n", + "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", + "Vs=math.pi*D**2*L/4\n", + "print(\"mass of air corresponding to above swept volume,using perfect gas equation\")\n", + "print(\"P*Vs=ma*R*T\")\n", + "print(\"so ma=(P*Vs)/(R*T) in kg\")\n", + "ma=(P*Vs)/(R*T*1000) \n", + "ma=0.02;#approx.\n", + "print(\"volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\")\n", + "print(\"so mass of air taken per minute in kg/min \")\n", + "1*10\n", + "print(\"mass corresponding to swept volume per minute in kg/min\")\n", + "ma*4*N/2\n", + "print(\"so volumetric efficiency \"),round(10./12.,4)\n", + "print(\"in percentage\"),round((10./12.)*100.,4)\n", + "print(\"so indicated power =282.74 KW,mechanical efficiency=88.42%\")\n", + "print(\"brake thermal efficiency=34.88%,volumetric efficiency=83.33%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.9;pg no: 393" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.9, Page:393 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\n", + "indicated mean effective pressure(P_imeb)=h*k in Kpa\n", + "indicated power(IP)=P_imeb*L*A*N/2 in KW 9.375\n", + "brake power(BP)=2*%pi*N*T in KW 4.62\n", + "mechanical efficiency(n_mech)= 0.49\n", + "in percentage 49.31\n", + "so indicated power=9.375 KW\n", + "brake power=4.62 KW\n", + "mechanical efficiency=49.28%\n", + "energy liberated from fuel(Ef)=C*m/60 in KJ/s\n", + "energy available as brake power(BP)=4.62 KW\n", + "energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\n", + "energy carried by exhaust gases(Eg)=30 KJ/s\n", + "unaccounted energy loss in KW= 34.75\n", + "NOTE=>overall energy balance sheet is attached as jpg file with this code.\n" + ] + } + ], + "source": [ + "#cal of indicated power,brake power,mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.9, Page:393 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\")\n", + "h=10.;#height of indicator diagram in mm\n", + "k=25.;#indicator constant in KN/m^2 per mm\n", + "N=300.;#engine rpm\n", + "Vs=1.5*10**-2;#swept volume in m^3\n", + "M=60.;#effective brake load upon dynamometer in kg\n", + "r=50.*10**-2;#effective brake drum radius in m\n", + "m=0.12;#fuel consumption in kg/min\n", + "C=42.*10**3;#calorific value in KJ/kg\n", + "mw=6.;#circulating water rate in kg/min\n", + "T1=35.;#cooling water entering temperature in degree celcius\n", + "T2=70.;#cooling water leaving temperature in degree celcius\n", + "Eg=30.;#exhaust gases leaving energy in KJ/s\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "g=9.81;#accelaration due to gravity in m/s^2\n", + "print(\"indicated mean effective pressure(P_imeb)=h*k in Kpa\")\n", + "P_imeb=h*k\n", + "IP=P_imeb*Vs*N/(2*60)\n", + "print(\"indicated power(IP)=P_imeb*L*A*N/2 in KW\") ,round(IP,3)\n", + "BP=2*math.pi*N*(M*g*r*10**-3)/(2*60)\n", + "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", + "n_mech=BP/IP\n", + "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "print(\"so indicated power=9.375 KW\")\n", + "print(\"brake power=4.62 KW\")\n", + "print(\"mechanical efficiency=49.28%\")\n", + "print(\"energy liberated from fuel(Ef)=C*m/60 in KJ/s\")\n", + "Ef=C*m/60\n", + "print(\"energy available as brake power(BP)=4.62 KW\")\n", + "print(\"energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\")\n", + "Ec=(mw/M)*Cw*(T2-T1)\n", + "print(\"energy carried by exhaust gases(Eg)=30 KJ/s\")\n", + "Ef-BP-Ec-Eg\n", + "print(\"unaccounted energy loss in KW=\"),round(Ef-BP-Ec-Eg,2)\n", + "print(\"NOTE=>overall energy balance sheet is attached as jpg file with this code.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.10;pg no: 394" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.10, Page:394 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\n", + "brake power(BP)=2*%pi*N*T in KW 47.12\n", + "so brake power=47.124 KW\n", + "brake specific fuel consumption(bsfc) in kg/KW hr= 0.34\n", + "indicated power(IP) in Kw= 52.36\n", + "indicated thermal efficiency(n_ite)= 0.28\n", + "in percentage 28.05\n", + "so indicated thermal efficiency=28.05%\n", + "heat available from fuel(Qf)=(m/mw)*C in KJ/min 11200.0\n", + "energy consumed as brake power(BP) in KJ/min= 2827.43\n", + "energy carried by cooling water(Qw) in KJ/min= 1442.1\n", + "energy carried by exhaust gases(Qg) in KJ/min= 4786.83\n", + "unaccounted energy loss in KJ/min 2143.63\n", + "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\n" + ] + } + ], + "source": [ + "#cal of brake power,brake specific fuel consumption,indicated thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.10, Page:394 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\")\n", + "m=4.;#mass of fuel consumed in kg\n", + "N=1500.;#engine rpm\n", + "mw=15.;#water circulation rate in kg/min\n", + "T1=27.;#cooling water inlet temperature in degree celcius\n", + "T2=50.;#cooling water outlet temperature in degree celcius\n", + "ma=150.;#mass of air consumed in kg\n", + "T_exhaust=400.;#exhaust temperature in degree celcius\n", + "T_atm=27.;#atmospheric temperature in degree celcius\n", + "Cg=1.25;#mean specific heat of exhaust gases in KJ/kg K\n", + "n_mech=0.9;#mechanical efficiency\n", + "T=300.*10**-3;#brake torque in N\n", + "C=42.*10**3;#calorific value in KJ/kg\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "BP=2.*math.pi*N*T/60\n", + "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", + "print(\"so brake power=47.124 KW\")\n", + "bsfc=m*60/(mw*BP)\n", + "print(\"brake specific fuel consumption(bsfc) in kg/KW hr=\"),round(bsfc,2)\n", + "IP=BP/n_mech\n", + "print(\"indicated power(IP) in Kw=\"),round(IP,2)\n", + "n_ite=IP*mw*60/(m*C)\n", + "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", + "print(\"in percentage\"),round(n_ite*100,2)\n", + "print(\"so indicated thermal efficiency=28.05%\")\n", + "Qf=(m/mw)*C\n", + "print(\"heat available from fuel(Qf)=(m/mw)*C in KJ/min\"),round(Qf,2)\n", + "BP=BP*60 \n", + "print(\"energy consumed as brake power(BP) in KJ/min=\"),round(BP,2)\n", + "Qw=mw*Cw*(T2-T1)\n", + "print(\"energy carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", + "Qg=(ma+m)*Cg*(T_exhaust-T_atm)/mw\n", + "print(\"energy carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", + "Qf-(BP+Qw+Qg)\n", + "print(\"unaccounted energy loss in KJ/min\"),round(Qf-(BP+Qw+Qg),2)\n", + "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.11;pg no: 395" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.11, Page:395 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\n", + "indicated power of 1st cylinder=BP-BP1 in KW\n", + "indicated power of 2nd cylinder=BP-BP2 in KW\n", + "indicated power of 3rd cylinder=BP-BP3 in KW\n", + "indicated power of 4th cylinder=BP-BP4 in KW\n", + "indicated power of 5th cylinder=BP-BP5 in KW\n", + "indicated power of 6th cylinder=BP-BP6 in KW\n", + " total indicated power(IP)in KW= 61.9\n", + "mechanical efficiency(n_mech)= 0.81\n", + "in percentage 80.78\n", + "so indicated power=61.9 KW\n", + "mechanical efficiency=80.77%\n" + ] + } + ], + "source": [ + "#cal of indicated power and mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.11, Page:395 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\")\n", + "BP=50.;#brake power output at full load in KW\n", + "BP1=40.1;#brake power output of 1st cylinder in KW\n", + "BP2=39.5;#brake power output of 2nd cylinder in KW\n", + "BP3=39.1;#brake power output of 3rd cylinder in KW\n", + "BP4=39.6;#brake power output of 4th cylinder in KW\n", + "BP5=39.8;#brake power output of 5th cylinder in KW\n", + "BP6=40.;#brake power output of 6th cylinder in KW\n", + "print(\"indicated power of 1st cylinder=BP-BP1 in KW\")\n", + "BP-BP1\n", + "print(\"indicated power of 2nd cylinder=BP-BP2 in KW\")\n", + "BP-BP2\n", + "print(\"indicated power of 3rd cylinder=BP-BP3 in KW\")\n", + "BP-BP3\n", + "print(\"indicated power of 4th cylinder=BP-BP4 in KW\")\n", + "BP-BP4\n", + "print(\"indicated power of 5th cylinder=BP-BP5 in KW\")\n", + "BP-BP5\n", + "print(\"indicated power of 6th cylinder=BP-BP6 in KW\")\n", + "BP-BP6\n", + "IP=9.9+10.5+10.9+10.4+10.2+10\n", + "print(\" total indicated power(IP)in KW=\"),round(IP,2)\n", + "n_mech=BP/IP\n", + "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "print(\"so indicated power=61.9 KW\")\n", + "print(\"mechanical efficiency=80.77%\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.12;pg no: 396" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.12, Page:396 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\n", + "brake power output of engine(BP) in KW= 19.63\n", + "brake power when cylinder 1 is cut(BP1) in KW= 13.74\n", + "so indicated power of first cylinder(IP1) in KW= 5.89\n", + "brake power when cylinder 2 is cut(BP2) in KW= 14.14\n", + "so indicated power of second cylinder(IP2) in KW= 5.5\n", + "brake power when cylinder 3 is cut(BP3) in KW= 14.29\n", + "so indicated power of third cylinder(IP3) in KW= 5.34\n", + "brake power when cylinder 4 is cut(BP4) in KW= 13.35\n", + "so indicated power of fourth cylinder(IP4) in KW= 6.28\n", + "now total indicated power(IP) in KW 23.01\n", + "engine mechanical efficiency(n_mech)= 0.85\n", + "in percentage 85.32\n", + "so BP=19.63 KW,IP=23 KW,n_mech=83.35%\n", + "heat liberated by fuel(Qf)=m*C in KJ/min 8127.0\n", + "heat carried by exhaust gases(Qg) in KJ/min= 1436.02\n", + "heat carried by cooling water(Qw) in KJ/min= 1730.52\n", + "energy to brake power(BP) in KJ/min= 1177.8\n", + "unaccounted losses in KJ/min 3782.66\n", + "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \n" + ] + } + ], + "source": [ + "#cal of brake power,indicated power,heat balance sheet\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 10.12, Page:396 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\")\n", + "N=1500.;#engine rpm at full load\n", + "F=250.;#brake load at full load in N\n", + "F1=175.;#brake reading 1 in N\n", + "F2=180.;#brake reading 2 in N\n", + "F3=182.;#brake reading 3 in N\n", + "F4=170.;#brake reading 4 in N\n", + "r=50.*10**-2;#brake drum radius in m\n", + "m=0.189;#fuel consumption rate in kg/min\n", + "C=43.*10**3;#fuel calorific value in KJ/kg\n", + "k=12.;#air to fuel ratio\n", + "T_exhaust=600.;#exhaust gas temperature in degree celcius\n", + "mw=18.;#cooling water flow rate in kg/min\n", + "T1=27.;#cooling water entering temperature in degree celcius\n", + "T2=50.;#cooling water leaving temperature in degree celcius\n", + "T_atm=27.;#atmospheric air temperature\n", + "Cg=1.02;#specific heat of exhaust gas in KJ/kg K\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "BP=2.*math.pi*N*F*r*10**-3/60.\n", + "print(\"brake power output of engine(BP) in KW=\"),round(BP,2)\n", + "BP1=2.*math.pi*N*F1*r*10**-3/60.\n", + "print(\"brake power when cylinder 1 is cut(BP1) in KW=\"),round(BP1,2)\n", + "IP1=BP-BP1\n", + "print(\"so indicated power of first cylinder(IP1) in KW=\"),round(IP1,2)\n", + "BP2=2.*math.pi*N*F2*r*10**-3/60.\n", + "print(\"brake power when cylinder 2 is cut(BP2) in KW=\"),round(BP2,2)\n", + "IP2=BP-BP2\n", + "print(\"so indicated power of second cylinder(IP2) in KW=\"),round(IP2,2)\n", + "BP3=2.*math.pi*N*F3*r*10**-3/60.\n", + "print(\"brake power when cylinder 3 is cut(BP3) in KW=\"),round(BP3,2)\n", + "IP3=BP-BP3\n", + "print(\"so indicated power of third cylinder(IP3) in KW=\"),round(IP3,2)\n", + "BP4=2.*math.pi*N*F4*r*10**-3/60.\n", + "print(\"brake power when cylinder 4 is cut(BP4) in KW=\"),round(BP4,2)\n", + "IP4=BP-BP4\n", + "print(\"so indicated power of fourth cylinder(IP4) in KW=\"),round(IP4,2)\n", + "IP=IP1+IP2+IP3+IP4\n", + "print(\"now total indicated power(IP) in KW\"),round(IP,2)\n", + "n_mech=BP/IP\n", + "print(\"engine mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "print(\"so BP=19.63 KW,IP=23 KW,n_mech=83.35%\")\n", + "Qf=m*C\n", + "print(\"heat liberated by fuel(Qf)=m*C in KJ/min\"),round(Qf,2)\n", + "Qg=(k+1)*m*Cg*(T_exhaust-T_atm)\n", + "print(\"heat carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", + "Qw=mw*Cw*(T2-T1)\n", + "print(\"heat carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", + "BP=19.63*60\n", + "print(\"energy to brake power(BP) in KJ/min=\"),round(19.63*60,2)\n", + "Qf-(Qg+Qw+BP)\n", + "print(\"unaccounted losses in KJ/min\"),round(Qf-(Qg+Qw+BP),2)\n", + "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.13;pg no: 397" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.13, Page:397 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\n", + "brake power(BP)=2*%pi*N*T in KW\n", + "indicated power(IP)=(mep*L*A*N)/60000 in KW\n", + "A> heat added(Q)=m*C/3600 in KJ/s 52.36\n", + "or Q in KJ/min\n", + "thermal efficiency(n_th)= 0.27\n", + "in percentage 26.85\n", + "B> heat equivalent of brake power(BP) in KJ/min= 659.76\n", + "C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\n", + "heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\n", + "mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\n", + "mg=(ma+m)/60\n", + "mass of steam in exhaust gases in kg/min\n", + "mass of dry exhaust gases in kg/min\n", + "D> heat carried by steam in exhaust in KJ/min 299.86\n", + "E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min 782.64\n", + "F> unaccounted loss=A-B-C-D-E in KJ/min 537.4\n", + "NOTE># on per minute basis is attached as jpg file with this code.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency and heat balance sheet\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.13, Page:397 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\")\n", + "D=20.*10**-2;#cylinder diameter in m\n", + "L=28.*10**-2;#stroke in m\n", + "m=4.22;#mass of fuel used in kg\n", + "C=44670.;#calorific value of fuel in KJ/kg\n", + "N=21000./60.;#engine rpm\n", + "mep=2.74*10**5;#mean effective pressure in pa\n", + "F=600.;#net brake load applied to a drum of 100 cm diameter in N\n", + "r=50.*10**-2;#brake drum radius in m\n", + "mw=495.;#total mass of cooling water in kg\n", + "T1=13.;#cooling water inlet temperature in degree celcius\n", + "T2=38.;#cooling water outlet temperature in degree celcius\n", + "ma=135.;#mass of air used in kg\n", + "T_air=20.;#temperature of air in test room in degree celcius\n", + "T_exhaust=370.;#temperature of exhaust gases in degree celcius\n", + "Cp_gases=1.005;#specific heat of gases in KJ/kg K\n", + "Cp_steam=2.093;#specific heat of steam at atmospheric pressure in KJ/kg K\n", + "Cpw=4.18;#specific heat of water in KJ/kg K\n", + "print(\"brake power(BP)=2*%pi*N*T in KW\")\n", + "BP=2*math.pi*N*F*r/60000\n", + "print(\"indicated power(IP)=(mep*L*A*N)/60000 in KW\")\n", + "IP=(mep*L*(math.pi*D**2/4)*N)/60000\n", + "Q=m*C/3600\n", + "print(\"A> heat added(Q)=m*C/3600 in KJ/s\"),round(Q,2)\n", + "print(\"or Q in KJ/min\")\n", + "Q=Q*60\n", + "Q=52.36;#heat added in KJ/s\n", + "n_th=IP/Q\n", + "print(\"thermal efficiency(n_th)= \"),round(n_th,2)\n", + "print(\"in percentage\"),round(n_th*100,2)\n", + "BP=BP*60\n", + "print(\"B> heat equivalent of brake power(BP) in KJ/min= \"),round(10.996*60,2)\n", + "print(\"C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\")\n", + "Qw=mw*Cpw*(T2-T1)/60\n", + "print(\"heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\")\n", + "print(\"mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\")\n", + "print(\"mg=(ma+m)/60\")\n", + "mg=(ma+m)/60\n", + "print(\"mass of steam in exhaust gases in kg/min\")\n", + "9*(0.15*m/60)\n", + "print(\"mass of dry exhaust gases in kg/min\")\n", + "mg-0.095\n", + "0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100))\n", + "print(\"D> heat carried by steam in exhaust in KJ/min\"),round(0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100)),2)\n", + "Qg=2.225*Cp_gases*(T_exhaust-T_air)\n", + "print(\"E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min\"),round(Qg,2)\n", + "print(\"F> unaccounted loss=A-B-C-D-E in KJ/min\"),round(3141.79-659.76-862.13-299.86-782.64,2)\n", + "print(\"NOTE># on per minute basis is attached as jpg file with this code.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter10_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter10_2.ipynb new file mode 100755 index 00000000..2d9241c2 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter10_2.ipynb @@ -0,0 +1,1080 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10:Intoduction to Internal Combustion engines" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.1;pg no: 387" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.1, Page:387 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 1\n", + "from stroke to bore ratio i.e L/D=1.2 and cylinder diameter=bore,i.e D=12 cm\n", + "stroke(L)=1.2*D in m\n", + "Area of indicator diagram(A)=30*10^-4 m^2\n", + "length of indicator diagram(l)=(1/2)*L in m\n", + "mean effective pressure(mep)=A*k/l in N/m^2\n", + "cross-section area of piston(Ap)=%pi*D^2/4 in m^2\n", + "for one cylinder indicated power(IP)=mep*Ap*L*N/(2*60) in W\n", + "for four cylinder total indicated power(IP)=4*IP in W 90477.87\n", + "frictional power loss(FP)=0.10*IP in W\n", + "brake power available(BP)=indicated power-frictional power=IP-FP in W 81430.08\n", + "therefore,mechanical efficiency of engine(n)=brake power/indicated power=BP/IP= 0.9\n", + "in percentage 90.0\n", + "so indicated power=90477.8 W\n", + "and mechanical efficiency=90%\n" + ] + } + ], + "source": [ + "#cal of indicated power,,mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 10.1, Page:387 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 1\")\n", + "k=20.*10**6;#spring constant in N/m^2\n", + "N=2000.;#engine rpm\n", + "print(\"from stroke to bore ratio i.e L/D=1.2 and cylinder diameter=bore,i.e D=12 cm\")\n", + "D=12.*10**-2;#cylinder diameter in m\n", + "print(\"stroke(L)=1.2*D in m\")\n", + "L=1.2*D\n", + "print(\"Area of indicator diagram(A)=30*10^-4 m^2\")\n", + "A=30.*10**-4;\n", + "print(\"length of indicator diagram(l)=(1/2)*L in m\")\n", + "l=(1./2.)*L\n", + "print(\"mean effective pressure(mep)=A*k/l in N/m^2\")\n", + "mep=A*k/l\n", + "print(\"cross-section area of piston(Ap)=%pi*D^2/4 in m^2\")\n", + "Ap=math.pi*D**2./4.\n", + "print(\"for one cylinder indicated power(IP)=mep*Ap*L*N/(2*60) in W\")\n", + "IP=mep*Ap*L*N/(2.*60.)\n", + "IP=4.*IP\n", + "print(\"for four cylinder total indicated power(IP)=4*IP in W\"),round(IP,2)\n", + "print(\"frictional power loss(FP)=0.10*IP in W\")\n", + "FP=0.10*IP\n", + "BP=IP-FP\n", + "print(\"brake power available(BP)=indicated power-frictional power=IP-FP in W\"),round(BP,2)\n", + "n=BP/IP\n", + "print(\"therefore,mechanical efficiency of engine(n)=brake power/indicated power=BP/IP=\"),round(BP/IP,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so indicated power=90477.8 W\")\n", + "print(\"and mechanical efficiency=90%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.2;pg no: 388" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.2, Page:388 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 2\n", + "reciprocating pump is work absorbing machine having its mechanism similar to the piston-cylinder arrangement in IC engine.\n", + "mean effective pressure(mep)=A*k/l in pa\n", + "indicator power(IP)=Ap*L*mep*N*1*2/60 in W\n", + "(it is double acting so let us assume total power to be double of that in single acting) 88357.29\n", + "so power required to drive=88.36 KW\n" + ] + } + ], + "source": [ + "#cal of power required to drive\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.2, Page:388 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 2\")\n", + "A=40*10**-4;#area of indicator diagram in m^2\n", + "l=8*10**-2;#length of indicator diagram in m\n", + "D=15*10**-2;#bore of cylinder in m\n", + "L=20*10**-2;#stroke in m\n", + "k=1.5*10**8;#spring constant in pa/m\n", + "N=100;#pump motor rpm\n", + "print(\"reciprocating pump is work absorbing machine having its mechanism similar to the piston-cylinder arrangement in IC engine.\")\n", + "print(\"mean effective pressure(mep)=A*k/l in pa\")\n", + "mep=A*k/l \n", + "print(\"indicator power(IP)=Ap*L*mep*N*1*2/60 in W\")\n", + "Ap=math.pi*D**2/4\n", + "IP=Ap*L*mep*N*2/60\n", + "print(\"(it is double acting so let us assume total power to be double of that in single acting)\"),round(IP,2)\n", + "print(\"so power required to drive=88.36 KW\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.3;pg no: 388" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.3, Page:388 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 3\n", + "indicated power(IP)=brake power/mechanical efficiency in KW= 42.22\n", + "frictional power loss(FP)=IP-BP in KW 4.22\n", + "brake power at quater load(BPq)=0.25*BP in KW\n", + "mechanical efficiency(n1)=BPq/IP 0.69\n", + "in percentage 69.23\n", + "so indicated power=42.22 KW\n", + "frictional power loss=4.22 KW\n", + "mechanical efficiency=69.24%\n" + ] + } + ], + "source": [ + "#cal of indicated power,frictional power loss,mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "print\"Example 10.3, Page:388 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 3\")\n", + "n=0.9;#mechanical efficiency of engine\n", + "BP=38;#brake power in KW\n", + "IP=BP/n\n", + "print(\"indicated power(IP)=brake power/mechanical efficiency in KW=\"),round(IP,2)\n", + "FP=IP-BP\n", + "print(\"frictional power loss(FP)=IP-BP in KW\"),round(FP,2)\n", + "print(\"brake power at quater load(BPq)=0.25*BP in KW\")\n", + "BPq=0.25*BP\n", + "IP=BPq+FP;\n", + "n1=BPq/IP\n", + "print(\"mechanical efficiency(n1)=BPq/IP\"),round(n1,2)\n", + "print(\"in percentage\"),round(n1*100,2)\n", + "print(\"so indicated power=42.22 KW\")\n", + "print(\"frictional power loss=4.22 KW\")\n", + "print(\"mechanical efficiency=69.24%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.4;pg no: 389" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.4, Page:389 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\n", + "brake power of engine(BP) in MW= 3120.98\n", + "so brake power is 3.121 MW\n", + "The fuel consumption in kg/hr(m)=m*BP in kg/hr\n", + "In order to find out brake thermal efficiency the heat input from fuel per second is required.\n", + "heat from fuel(Q)in KJ/s\n", + "Q=m*C/3600\n", + "energy to brake power=3120.97 KW\n", + "brake thermal efficiency(n)= 0.33\n", + "in percentage 33.49\n", + "so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\n", + "NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\n" + ] + } + ], + "source": [ + "#cal of brake power,fuel consumption\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.4, Page:389 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\")\n", + "m=0.25;#specific fuel consumption in kg/KWh\n", + "Pb_mep=1.5*1000;#brake mean effective pressure of each cylinder in Kpa\n", + "N=100;#engine rpm\n", + "D=85*10**-2;#bore of cylinder in m\n", + "L=220*10**-2;#stroke in m\n", + "C=43*10**3;#calorific value of diesel in KJ/kg\n", + "A=math.pi*D**2/4;\n", + "BP=Pb_mep*L*A*N/60\n", + "print(\"brake power of engine(BP) in MW=\"),round(BP,2)\n", + "print(\"so brake power is 3.121 MW\")\n", + "print(\"The fuel consumption in kg/hr(m)=m*BP in kg/hr\")\n", + "m=m*BP\n", + "print(\"In order to find out brake thermal efficiency the heat input from fuel per second is required.\")\n", + "print(\"heat from fuel(Q)in KJ/s\")\n", + "print(\"Q=m*C/3600\")\n", + "Q=m*C/3600\n", + "print(\"energy to brake power=3120.97 KW\")\n", + "n=BP/Q\n", + "print(\"brake thermal efficiency(n)=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\")\n", + "print(\"NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.5;pg no: 389" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.5, Page:389 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\n", + "brake thermal efficiency(n)=3600/(m*C) 0.33\n", + "in percentage 33.49\n", + "brake power(BP)in KW\n", + "BP= 226.19\n", + "brake specific fuel consumption,m=mf/BP\n", + "so mf=m*BP in kg/hr\n", + "air consumption(ma)from given air fuel ratio=k*mf in kg/hr\n", + "ma in kg/min\n", + "using perfect gas equation,\n", + "P*Va=ma*R*T\n", + "sa Va=ma*R*T/P in m^3/min\n", + "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", + "volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder) 1.87\n", + "in percentage 186.55\n", + "NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\n" + ] + } + ], + "source": [ + "#cal of brake thermal efficiency,brake power,volumetric efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.5, Page:389 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\")\n", + "Pb_mep=6*10**5;#brake mean effective pressure in pa\n", + "N=600;#engine rpm\n", + "m=0.25;#specific fuel consumption in kg/KWh\n", + "D=20*10**-2;#bore of cylinder in m\n", + "L=30*10**-2;#stroke in m\n", + "k=26;#air to fuel ratio\n", + "C=43*10**3;#calorific value in KJ/kg\n", + "R=0.287;#gas constant in KJ/kg K\n", + "T=(27+273);#ambient temperature in K\n", + "P=1*10**2;#ambient pressure in Kpa\n", + "n=3600/(m*C)\n", + "print(\"brake thermal efficiency(n)=3600/(m*C)\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"brake power(BP)in KW\")\n", + "A=math.pi*D**2/4;\n", + "BP=4*Pb_mep*L*A*N/60000\n", + "print(\"BP=\"),round(BP,2)\n", + "print(\"brake specific fuel consumption,m=mf/BP\")\n", + "print(\"so mf=m*BP in kg/hr\")\n", + "mf=m*BP\n", + "print(\"air consumption(ma)from given air fuel ratio=k*mf in kg/hr\")\n", + "ma=k*mf\n", + "print(\"ma in kg/min\")\n", + "ma=ma/60\n", + "print(\"using perfect gas equation,\")\n", + "print(\"P*Va=ma*R*T\")\n", + "print(\"sa Va=ma*R*T/P in m^3/min\")\n", + "Va=ma*R*T/P\n", + "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", + "Vs=math.pi*D**2*L/4\n", + "n_vol=Va/(Vs*(N/2)*4)\n", + "print(\"volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder)\"),round(n_vol,2)\n", + "print(\"in percentage\"),round(n_vol*100,2)\n", + "print(\"NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.6;pg no: 390" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.6, Page:390 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\n", + "let the bore diameter be (D) m\n", + "piston speed(V)=2*L*N\n", + "so L=V/(2*N) in m\n", + "volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\n", + "so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\n", + "so air sucked =274.78*D^2 m^3/min\n", + "air requirement(ma),kg/min=A/F ratio*fuel consumption per min\n", + "so ma=r*m in kg/min\n", + "using perfect gas equation,P*Va=ma*R*T\n", + "so Va=ma*R*T/P in m^3/min\n", + "ideally,air sucked=Va\n", + "so 274.78*D^2=0.906\n", + "D=sqrt(0.906/274.78) in m\n", + "indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\n", + "brake power=indicated power*mechanical efficiency\n", + "BP=IP*n_mech in KW 10.35\n", + "so brake power=10.34 KW\n" + ] + } + ], + "source": [ + "#cal of brake power\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 10.6, Page:390 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\")\n", + "N=3000;#engine rpm\n", + "m=5;#fuel consumption in litre/hr\n", + "r=19;#air-fuel ratio\n", + "sg=0.7;#specific gravity of fuel\n", + "V=500;#piston speed in m/min\n", + "P_imep=6*10**5;#indicated mean effective pressure in pa\n", + "P=1.013*10**5;#ambient pressure in pa\n", + "T=(15+273);#ambient temperature in K\n", + "n_vol=0.7;#volumetric efficiency \n", + "n_mech=0.8;#mechanical efficiency\n", + "R=0.287;#gas constant for gas in KJ/kg K\n", + "print(\"let the bore diameter be (D) m\")\n", + "print(\"piston speed(V)=2*L*N\")\n", + "print(\"so L=V/(2*N) in m\")\n", + "L=V/(2*N)\n", + "L=0.0833;#approx.\n", + "print(\"volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\")\n", + "print(\"so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\")\n", + "n_vol*(math.pi*L/4)*N*2\n", + "print(\"so air sucked =274.78*D^2 m^3/min\")\n", + "print(\"air requirement(ma),kg/min=A/F ratio*fuel consumption per min\")\n", + "print(\"so ma=r*m in kg/min\")\n", + "ma=r*m*sg/60\n", + "print(\"using perfect gas equation,P*Va=ma*R*T\")\n", + "print(\"so Va=ma*R*T/P in m^3/min\")\n", + "Va=ma*R*T*1000/P \n", + "print(\"ideally,air sucked=Va\")\n", + "print(\"so 274.78*D^2=0.906\")\n", + "print(\"D=sqrt(0.906/274.78) in m\")\n", + "D=math.sqrt(0.906/274.78) \n", + "print(\"indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\")\n", + "IP=P_imep*L*(math.pi*D**2/4)*(N/60)*2/1000\n", + "print(\"brake power=indicated power*mechanical efficiency\")\n", + "BP=IP*n_mech \n", + "print(\"BP=IP*n_mech in KW\"),round(BP,2)\n", + "print(\"so brake power=10.34 KW\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.7;pg no: 391" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.7, Page:391 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\n", + "After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\n", + "friction power(FP)=5 KW\n", + "brake power(BP) in KW= 30.82\n", + "indicated power(IP) in KW= 35.82\n", + "mechanical efficiency(n_mech)= 0.86\n", + "in percentage 86.04\n", + "brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr= 0.29\n", + "brake thermal efficiency(n_bte)= 0.29\n", + "in percentage 28.67\n", + "also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\n", + "indicated thermal efficiency(n_ite)= 0.33\n", + "in percentage 33.32\n", + "indicated power(IP)=P_imep*L*A*N\n", + "so P_imep in Kpa= 76.01\n", + "Also,mechanical efficiency=P_bmep/P_imep\n", + "so P_bmep in Kpa= 65.4\n", + "brake power=30.82 KW\n", + "indicated power=35.82 KW\n", + "mechanical efficiency=86.04%\n", + "brake thermal efficiency=28.67%\n", + "indicated thermal efficiency=33.32%\n", + "brake mean effective pressure=65.39 Kpa\n", + "indicated mean effective pressure=76.01 Kpa\n" + ] + } + ], + "source": [ + "#cal of power and efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.7, Page:391 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\")\n", + "M=20;#load on dynamometer in kg\n", + "r=50*10**-2;#radius in m\n", + "N=3000;#speed of rotation in rpm\n", + "D=20*10**-2;#bore in m\n", + "L=30*10**-2;#stroke in m\n", + "m=0.15;#fuel supplying rate in kg/min\n", + "C=43;#calorific value of fuel in MJ/kg\n", + "FP=5;#friction power in KW\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\")\n", + "print(\"friction power(FP)=5 KW\")\n", + "BP=2*math.pi*N*(M*g*r)*10**-3/60\n", + "print(\"brake power(BP) in KW=\"),round(BP,2)\n", + "IP=BP+FP\n", + "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", + "n_mech=BP/IP\n", + "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "bsfc=m*60/BP\n", + "print(\"brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr=\"),round(bsfc,2)\n", + "n_bte=3600/(bsfc*C*1000)\n", + "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", + "print(\"in percentage\"),round(n_bte*100,2)\n", + "print(\"also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\")\n", + "n_ite=n_bte/n_mech\n", + "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", + "print(\"in percentage\"),round(n_ite*100,2)\n", + "print(\"indicated power(IP)=P_imep*L*A*N\")\n", + "P_imep=IP/(L*(math.pi*D**2/4)*N/60)\n", + "print(\"so P_imep in Kpa=\"),round(P_imep,2)\n", + "print(\"Also,mechanical efficiency=P_bmep/P_imep\")\n", + "n_mech=0.8604;#mechanical efficiency\n", + "P_bmep=P_imep*n_mech\n", + "print(\"so P_bmep in Kpa=\"),round(P_bmep,2)\n", + "print(\"brake power=30.82 KW\")\n", + "print(\"indicated power=35.82 KW\")\n", + "print(\"mechanical efficiency=86.04%\")\n", + "print(\"brake thermal efficiency=28.67%\")\n", + "print(\"indicated thermal efficiency=33.32%\")\n", + "print(\"brake mean effective pressure=65.39 Kpa\")\n", + "print(\"indicated mean effective pressure=76.01 Kpa\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.8;pg no: 392" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.8, Page:392 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\n", + "indicated power(IP) in KW= 282.74\n", + "mechanical efficiency(n_mech)=brake power/indicated power\n", + "so n_mech= 0.88\n", + "in percentage 88.42\n", + "brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\n", + "brake thermal efficiency(n_bte)= 0.35\n", + "in percentage 34.88\n", + "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", + "mass of air corresponding to above swept volume,using perfect gas equation\n", + "P*Vs=ma*R*T\n", + "so ma=(P*Vs)/(R*T) in kg\n", + "volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\n", + "so mass of air taken per minute in kg/min \n", + "mass corresponding to swept volume per minute in kg/min\n", + "so volumetric efficiency 0.8333\n", + "in percentage 83.3333\n", + "so indicated power =282.74 KW,mechanical efficiency=88.42%\n", + "brake thermal efficiency=34.88%,volumetric efficiency=83.33%\n" + ] + } + ], + "source": [ + "#cal of brake thermal efficiency,volumetric effeciency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.8, Page:392 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\")\n", + "N=300.;#engine rpm\n", + "BP=250.;#brake power in KW\n", + "D=30.*10**-2;#bore in m\n", + "L=25.*10**-2;#stroke in m\n", + "m=1.;#fuel consumption in kg/min\n", + "r=10.;#airfuel ratio \n", + "P_imep=0.8;#indicated mean effective pressure in pa\n", + "C=43.*10**3;#calorific value of fuel in KJ/kg\n", + "P=1.013*10**5;#ambient pressure in K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "T=(27.+273.);#ambient temperature in K\n", + "IP=P_imep*L*(math.pi*D**2/4)*N*4*10**3/60\n", + "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", + "print(\"mechanical efficiency(n_mech)=brake power/indicated power\")\n", + "n_mech=BP/IP\n", + "print(\"so n_mech=\"),round(n_mech,2)\n", + "print(\"in percentage \"),round(n_mech*100,2)\n", + "print(\"brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\")\n", + "bsfc=m*60./BP\n", + "n_bte=3600./(bsfc*C)\n", + "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", + "print(\"in percentage\"),round(n_bte*100,2)\n", + "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", + "Vs=math.pi*D**2*L/4\n", + "print(\"mass of air corresponding to above swept volume,using perfect gas equation\")\n", + "print(\"P*Vs=ma*R*T\")\n", + "print(\"so ma=(P*Vs)/(R*T) in kg\")\n", + "ma=(P*Vs)/(R*T*1000) \n", + "ma=0.02;#approx.\n", + "print(\"volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\")\n", + "print(\"so mass of air taken per minute in kg/min \")\n", + "1*10\n", + "print(\"mass corresponding to swept volume per minute in kg/min\")\n", + "ma*4*N/2\n", + "print(\"so volumetric efficiency \"),round(10./12.,4)\n", + "print(\"in percentage\"),round((10./12.)*100.,4)\n", + "print(\"so indicated power =282.74 KW,mechanical efficiency=88.42%\")\n", + "print(\"brake thermal efficiency=34.88%,volumetric efficiency=83.33%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.9;pg no: 393" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.9, Page:393 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\n", + "indicated mean effective pressure(P_imeb)=h*k in Kpa\n", + "indicated power(IP)=P_imeb*L*A*N/2 in KW 9.375\n", + "brake power(BP)=2*%pi*N*T in KW 4.62\n", + "mechanical efficiency(n_mech)= 0.49\n", + "in percentage 49.31\n", + "so indicated power=9.375 KW\n", + "brake power=4.62 KW\n", + "mechanical efficiency=49.28%\n", + "energy liberated from fuel(Ef)=C*m/60 in KJ/s\n", + "energy available as brake power(BP)=4.62 KW\n", + "energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\n", + "energy carried by exhaust gases(Eg)=30 KJ/s\n", + "unaccounted energy loss in KW= 34.75\n", + "NOTE=>overall energy balance sheet is attached as jpg file with this code.\n" + ] + } + ], + "source": [ + "#cal of indicated power,brake power,mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.9, Page:393 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\")\n", + "h=10.;#height of indicator diagram in mm\n", + "k=25.;#indicator constant in KN/m^2 per mm\n", + "N=300.;#engine rpm\n", + "Vs=1.5*10**-2;#swept volume in m^3\n", + "M=60.;#effective brake load upon dynamometer in kg\n", + "r=50.*10**-2;#effective brake drum radius in m\n", + "m=0.12;#fuel consumption in kg/min\n", + "C=42.*10**3;#calorific value in KJ/kg\n", + "mw=6.;#circulating water rate in kg/min\n", + "T1=35.;#cooling water entering temperature in degree celcius\n", + "T2=70.;#cooling water leaving temperature in degree celcius\n", + "Eg=30.;#exhaust gases leaving energy in KJ/s\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "g=9.81;#accelaration due to gravity in m/s^2\n", + "print(\"indicated mean effective pressure(P_imeb)=h*k in Kpa\")\n", + "P_imeb=h*k\n", + "IP=P_imeb*Vs*N/(2*60)\n", + "print(\"indicated power(IP)=P_imeb*L*A*N/2 in KW\") ,round(IP,3)\n", + "BP=2*math.pi*N*(M*g*r*10**-3)/(2*60)\n", + "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", + "n_mech=BP/IP\n", + "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "print(\"so indicated power=9.375 KW\")\n", + "print(\"brake power=4.62 KW\")\n", + "print(\"mechanical efficiency=49.28%\")\n", + "print(\"energy liberated from fuel(Ef)=C*m/60 in KJ/s\")\n", + "Ef=C*m/60\n", + "print(\"energy available as brake power(BP)=4.62 KW\")\n", + "print(\"energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\")\n", + "Ec=(mw/M)*Cw*(T2-T1)\n", + "print(\"energy carried by exhaust gases(Eg)=30 KJ/s\")\n", + "Ef-BP-Ec-Eg\n", + "print(\"unaccounted energy loss in KW=\"),round(Ef-BP-Ec-Eg,2)\n", + "print(\"NOTE=>overall energy balance sheet is attached as jpg file with this code.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.10;pg no: 394" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.10, Page:394 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\n", + "brake power(BP)=2*%pi*N*T in KW 47.12\n", + "so brake power=47.124 KW\n", + "brake specific fuel consumption(bsfc) in kg/KW hr= 0.34\n", + "indicated power(IP) in Kw= 52.36\n", + "indicated thermal efficiency(n_ite)= 0.28\n", + "in percentage 28.05\n", + "so indicated thermal efficiency=28.05%\n", + "heat available from fuel(Qf)=(m/mw)*C in KJ/min 11200.0\n", + "energy consumed as brake power(BP) in KJ/min= 2827.43\n", + "energy carried by cooling water(Qw) in KJ/min= 1442.1\n", + "energy carried by exhaust gases(Qg) in KJ/min= 4786.83\n", + "unaccounted energy loss in KJ/min 2143.63\n", + "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\n" + ] + } + ], + "source": [ + "#cal of brake power,brake specific fuel consumption,indicated thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.10, Page:394 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\")\n", + "m=4.;#mass of fuel consumed in kg\n", + "N=1500.;#engine rpm\n", + "mw=15.;#water circulation rate in kg/min\n", + "T1=27.;#cooling water inlet temperature in degree celcius\n", + "T2=50.;#cooling water outlet temperature in degree celcius\n", + "ma=150.;#mass of air consumed in kg\n", + "T_exhaust=400.;#exhaust temperature in degree celcius\n", + "T_atm=27.;#atmospheric temperature in degree celcius\n", + "Cg=1.25;#mean specific heat of exhaust gases in KJ/kg K\n", + "n_mech=0.9;#mechanical efficiency\n", + "T=300.*10**-3;#brake torque in N\n", + "C=42.*10**3;#calorific value in KJ/kg\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "BP=2.*math.pi*N*T/60\n", + "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", + "print(\"so brake power=47.124 KW\")\n", + "bsfc=m*60/(mw*BP)\n", + "print(\"brake specific fuel consumption(bsfc) in kg/KW hr=\"),round(bsfc,2)\n", + "IP=BP/n_mech\n", + "print(\"indicated power(IP) in Kw=\"),round(IP,2)\n", + "n_ite=IP*mw*60/(m*C)\n", + "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", + "print(\"in percentage\"),round(n_ite*100,2)\n", + "print(\"so indicated thermal efficiency=28.05%\")\n", + "Qf=(m/mw)*C\n", + "print(\"heat available from fuel(Qf)=(m/mw)*C in KJ/min\"),round(Qf,2)\n", + "BP=BP*60 \n", + "print(\"energy consumed as brake power(BP) in KJ/min=\"),round(BP,2)\n", + "Qw=mw*Cw*(T2-T1)\n", + "print(\"energy carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", + "Qg=(ma+m)*Cg*(T_exhaust-T_atm)/mw\n", + "print(\"energy carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", + "Qf-(BP+Qw+Qg)\n", + "print(\"unaccounted energy loss in KJ/min\"),round(Qf-(BP+Qw+Qg),2)\n", + "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.11;pg no: 395" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.11, Page:395 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\n", + "indicated power of 1st cylinder=BP-BP1 in KW\n", + "indicated power of 2nd cylinder=BP-BP2 in KW\n", + "indicated power of 3rd cylinder=BP-BP3 in KW\n", + "indicated power of 4th cylinder=BP-BP4 in KW\n", + "indicated power of 5th cylinder=BP-BP5 in KW\n", + "indicated power of 6th cylinder=BP-BP6 in KW\n", + " total indicated power(IP)in KW= 61.9\n", + "mechanical efficiency(n_mech)= 0.81\n", + "in percentage 80.78\n", + "so indicated power=61.9 KW\n", + "mechanical efficiency=80.77%\n" + ] + } + ], + "source": [ + "#cal of indicated power and mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.11, Page:395 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\")\n", + "BP=50.;#brake power output at full load in KW\n", + "BP1=40.1;#brake power output of 1st cylinder in KW\n", + "BP2=39.5;#brake power output of 2nd cylinder in KW\n", + "BP3=39.1;#brake power output of 3rd cylinder in KW\n", + "BP4=39.6;#brake power output of 4th cylinder in KW\n", + "BP5=39.8;#brake power output of 5th cylinder in KW\n", + "BP6=40.;#brake power output of 6th cylinder in KW\n", + "print(\"indicated power of 1st cylinder=BP-BP1 in KW\")\n", + "BP-BP1\n", + "print(\"indicated power of 2nd cylinder=BP-BP2 in KW\")\n", + "BP-BP2\n", + "print(\"indicated power of 3rd cylinder=BP-BP3 in KW\")\n", + "BP-BP3\n", + "print(\"indicated power of 4th cylinder=BP-BP4 in KW\")\n", + "BP-BP4\n", + "print(\"indicated power of 5th cylinder=BP-BP5 in KW\")\n", + "BP-BP5\n", + "print(\"indicated power of 6th cylinder=BP-BP6 in KW\")\n", + "BP-BP6\n", + "IP=9.9+10.5+10.9+10.4+10.2+10\n", + "print(\" total indicated power(IP)in KW=\"),round(IP,2)\n", + "n_mech=BP/IP\n", + "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "print(\"so indicated power=61.9 KW\")\n", + "print(\"mechanical efficiency=80.77%\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.12;pg no: 396" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.12, Page:396 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\n", + "brake power output of engine(BP) in KW= 19.63\n", + "brake power when cylinder 1 is cut(BP1) in KW= 13.74\n", + "so indicated power of first cylinder(IP1) in KW= 5.89\n", + "brake power when cylinder 2 is cut(BP2) in KW= 14.14\n", + "so indicated power of second cylinder(IP2) in KW= 5.5\n", + "brake power when cylinder 3 is cut(BP3) in KW= 14.29\n", + "so indicated power of third cylinder(IP3) in KW= 5.34\n", + "brake power when cylinder 4 is cut(BP4) in KW= 13.35\n", + "so indicated power of fourth cylinder(IP4) in KW= 6.28\n", + "now total indicated power(IP) in KW 23.01\n", + "engine mechanical efficiency(n_mech)= 0.85\n", + "in percentage 85.32\n", + "so BP=19.63 KW,IP=23 KW,n_mech=83.35%\n", + "heat liberated by fuel(Qf)=m*C in KJ/min 8127.0\n", + "heat carried by exhaust gases(Qg) in KJ/min= 1436.02\n", + "heat carried by cooling water(Qw) in KJ/min= 1730.52\n", + "energy to brake power(BP) in KJ/min= 1177.8\n", + "unaccounted losses in KJ/min 3782.66\n", + "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \n" + ] + } + ], + "source": [ + "#cal of brake power,indicated power,heat balance sheet\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 10.12, Page:396 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\")\n", + "N=1500.;#engine rpm at full load\n", + "F=250.;#brake load at full load in N\n", + "F1=175.;#brake reading 1 in N\n", + "F2=180.;#brake reading 2 in N\n", + "F3=182.;#brake reading 3 in N\n", + "F4=170.;#brake reading 4 in N\n", + "r=50.*10**-2;#brake drum radius in m\n", + "m=0.189;#fuel consumption rate in kg/min\n", + "C=43.*10**3;#fuel calorific value in KJ/kg\n", + "k=12.;#air to fuel ratio\n", + "T_exhaust=600.;#exhaust gas temperature in degree celcius\n", + "mw=18.;#cooling water flow rate in kg/min\n", + "T1=27.;#cooling water entering temperature in degree celcius\n", + "T2=50.;#cooling water leaving temperature in degree celcius\n", + "T_atm=27.;#atmospheric air temperature\n", + "Cg=1.02;#specific heat of exhaust gas in KJ/kg K\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "BP=2.*math.pi*N*F*r*10**-3/60.\n", + "print(\"brake power output of engine(BP) in KW=\"),round(BP,2)\n", + "BP1=2.*math.pi*N*F1*r*10**-3/60.\n", + "print(\"brake power when cylinder 1 is cut(BP1) in KW=\"),round(BP1,2)\n", + "IP1=BP-BP1\n", + "print(\"so indicated power of first cylinder(IP1) in KW=\"),round(IP1,2)\n", + "BP2=2.*math.pi*N*F2*r*10**-3/60.\n", + "print(\"brake power when cylinder 2 is cut(BP2) in KW=\"),round(BP2,2)\n", + "IP2=BP-BP2\n", + "print(\"so indicated power of second cylinder(IP2) in KW=\"),round(IP2,2)\n", + "BP3=2.*math.pi*N*F3*r*10**-3/60.\n", + "print(\"brake power when cylinder 3 is cut(BP3) in KW=\"),round(BP3,2)\n", + "IP3=BP-BP3\n", + "print(\"so indicated power of third cylinder(IP3) in KW=\"),round(IP3,2)\n", + "BP4=2.*math.pi*N*F4*r*10**-3/60.\n", + "print(\"brake power when cylinder 4 is cut(BP4) in KW=\"),round(BP4,2)\n", + "IP4=BP-BP4\n", + "print(\"so indicated power of fourth cylinder(IP4) in KW=\"),round(IP4,2)\n", + "IP=IP1+IP2+IP3+IP4\n", + "print(\"now total indicated power(IP) in KW\"),round(IP,2)\n", + "n_mech=BP/IP\n", + "print(\"engine mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "print(\"so BP=19.63 KW,IP=23 KW,n_mech=83.35%\")\n", + "Qf=m*C\n", + "print(\"heat liberated by fuel(Qf)=m*C in KJ/min\"),round(Qf,2)\n", + "Qg=(k+1)*m*Cg*(T_exhaust-T_atm)\n", + "print(\"heat carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", + "Qw=mw*Cw*(T2-T1)\n", + "print(\"heat carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", + "BP=19.63*60\n", + "print(\"energy to brake power(BP) in KJ/min=\"),round(19.63*60,2)\n", + "Qf-(Qg+Qw+BP)\n", + "print(\"unaccounted losses in KJ/min\"),round(Qf-(Qg+Qw+BP),2)\n", + "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.13;pg no: 397" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.13, Page:397 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\n", + "brake power(BP)=2*%pi*N*T in KW\n", + "indicated power(IP)=(mep*L*A*N)/60000 in KW\n", + "A> heat added(Q)=m*C/3600 in KJ/s 52.36\n", + "or Q in KJ/min\n", + "thermal efficiency(n_th)= 0.27\n", + "in percentage 26.85\n", + "B> heat equivalent of brake power(BP) in KJ/min= 659.76\n", + "C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\n", + "heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\n", + "mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\n", + "mg=(ma+m)/60\n", + "mass of steam in exhaust gases in kg/min\n", + "mass of dry exhaust gases in kg/min\n", + "D> heat carried by steam in exhaust in KJ/min 299.86\n", + "E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min 782.64\n", + "F> unaccounted loss=A-B-C-D-E in KJ/min 537.4\n", + "NOTE># on per minute basis is attached as jpg file with this code.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency and heat balance sheet\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.13, Page:397 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\")\n", + "D=20.*10**-2;#cylinder diameter in m\n", + "L=28.*10**-2;#stroke in m\n", + "m=4.22;#mass of fuel used in kg\n", + "C=44670.;#calorific value of fuel in KJ/kg\n", + "N=21000./60.;#engine rpm\n", + "mep=2.74*10**5;#mean effective pressure in pa\n", + "F=600.;#net brake load applied to a drum of 100 cm diameter in N\n", + "r=50.*10**-2;#brake drum radius in m\n", + "mw=495.;#total mass of cooling water in kg\n", + "T1=13.;#cooling water inlet temperature in degree celcius\n", + "T2=38.;#cooling water outlet temperature in degree celcius\n", + "ma=135.;#mass of air used in kg\n", + "T_air=20.;#temperature of air in test room in degree celcius\n", + "T_exhaust=370.;#temperature of exhaust gases in degree celcius\n", + "Cp_gases=1.005;#specific heat of gases in KJ/kg K\n", + "Cp_steam=2.093;#specific heat of steam at atmospheric pressure in KJ/kg K\n", + "Cpw=4.18;#specific heat of water in KJ/kg K\n", + "print(\"brake power(BP)=2*%pi*N*T in KW\")\n", + "BP=2*math.pi*N*F*r/60000\n", + "print(\"indicated power(IP)=(mep*L*A*N)/60000 in KW\")\n", + "IP=(mep*L*(math.pi*D**2/4)*N)/60000\n", + "Q=m*C/3600\n", + "print(\"A> heat added(Q)=m*C/3600 in KJ/s\"),round(Q,2)\n", + "print(\"or Q in KJ/min\")\n", + "Q=Q*60\n", + "Q=52.36;#heat added in KJ/s\n", + "n_th=IP/Q\n", + "print(\"thermal efficiency(n_th)= \"),round(n_th,2)\n", + "print(\"in percentage\"),round(n_th*100,2)\n", + "BP=BP*60\n", + "print(\"B> heat equivalent of brake power(BP) in KJ/min= \"),round(10.996*60,2)\n", + "print(\"C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\")\n", + "Qw=mw*Cpw*(T2-T1)/60\n", + "print(\"heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\")\n", + "print(\"mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\")\n", + "print(\"mg=(ma+m)/60\")\n", + "mg=(ma+m)/60\n", + "print(\"mass of steam in exhaust gases in kg/min\")\n", + "9*(0.15*m/60)\n", + "print(\"mass of dry exhaust gases in kg/min\")\n", + "mg-0.095\n", + "0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100))\n", + "print(\"D> heat carried by steam in exhaust in KJ/min\"),round(0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100)),2)\n", + "Qg=2.225*Cp_gases*(T_exhaust-T_air)\n", + "print(\"E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min\"),round(Qg,2)\n", + "print(\"F> unaccounted loss=A-B-C-D-E in KJ/min\"),round(3141.79-659.76-862.13-299.86-782.64,2)\n", + "print(\"NOTE># on per minute basis is attached as jpg file with this code.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter10_3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter10_3.ipynb new file mode 100755 index 00000000..2d9241c2 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter10_3.ipynb @@ -0,0 +1,1080 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10:Intoduction to Internal Combustion engines" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.1;pg no: 387" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.1, Page:387 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 1\n", + "from stroke to bore ratio i.e L/D=1.2 and cylinder diameter=bore,i.e D=12 cm\n", + "stroke(L)=1.2*D in m\n", + "Area of indicator diagram(A)=30*10^-4 m^2\n", + "length of indicator diagram(l)=(1/2)*L in m\n", + "mean effective pressure(mep)=A*k/l in N/m^2\n", + "cross-section area of piston(Ap)=%pi*D^2/4 in m^2\n", + "for one cylinder indicated power(IP)=mep*Ap*L*N/(2*60) in W\n", + "for four cylinder total indicated power(IP)=4*IP in W 90477.87\n", + "frictional power loss(FP)=0.10*IP in W\n", + "brake power available(BP)=indicated power-frictional power=IP-FP in W 81430.08\n", + "therefore,mechanical efficiency of engine(n)=brake power/indicated power=BP/IP= 0.9\n", + "in percentage 90.0\n", + "so indicated power=90477.8 W\n", + "and mechanical efficiency=90%\n" + ] + } + ], + "source": [ + "#cal of indicated power,,mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 10.1, Page:387 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 1\")\n", + "k=20.*10**6;#spring constant in N/m^2\n", + "N=2000.;#engine rpm\n", + "print(\"from stroke to bore ratio i.e L/D=1.2 and cylinder diameter=bore,i.e D=12 cm\")\n", + "D=12.*10**-2;#cylinder diameter in m\n", + "print(\"stroke(L)=1.2*D in m\")\n", + "L=1.2*D\n", + "print(\"Area of indicator diagram(A)=30*10^-4 m^2\")\n", + "A=30.*10**-4;\n", + "print(\"length of indicator diagram(l)=(1/2)*L in m\")\n", + "l=(1./2.)*L\n", + "print(\"mean effective pressure(mep)=A*k/l in N/m^2\")\n", + "mep=A*k/l\n", + "print(\"cross-section area of piston(Ap)=%pi*D^2/4 in m^2\")\n", + "Ap=math.pi*D**2./4.\n", + "print(\"for one cylinder indicated power(IP)=mep*Ap*L*N/(2*60) in W\")\n", + "IP=mep*Ap*L*N/(2.*60.)\n", + "IP=4.*IP\n", + "print(\"for four cylinder total indicated power(IP)=4*IP in W\"),round(IP,2)\n", + "print(\"frictional power loss(FP)=0.10*IP in W\")\n", + "FP=0.10*IP\n", + "BP=IP-FP\n", + "print(\"brake power available(BP)=indicated power-frictional power=IP-FP in W\"),round(BP,2)\n", + "n=BP/IP\n", + "print(\"therefore,mechanical efficiency of engine(n)=brake power/indicated power=BP/IP=\"),round(BP/IP,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so indicated power=90477.8 W\")\n", + "print(\"and mechanical efficiency=90%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.2;pg no: 388" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.2, Page:388 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 2\n", + "reciprocating pump is work absorbing machine having its mechanism similar to the piston-cylinder arrangement in IC engine.\n", + "mean effective pressure(mep)=A*k/l in pa\n", + "indicator power(IP)=Ap*L*mep*N*1*2/60 in W\n", + "(it is double acting so let us assume total power to be double of that in single acting) 88357.29\n", + "so power required to drive=88.36 KW\n" + ] + } + ], + "source": [ + "#cal of power required to drive\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.2, Page:388 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 2\")\n", + "A=40*10**-4;#area of indicator diagram in m^2\n", + "l=8*10**-2;#length of indicator diagram in m\n", + "D=15*10**-2;#bore of cylinder in m\n", + "L=20*10**-2;#stroke in m\n", + "k=1.5*10**8;#spring constant in pa/m\n", + "N=100;#pump motor rpm\n", + "print(\"reciprocating pump is work absorbing machine having its mechanism similar to the piston-cylinder arrangement in IC engine.\")\n", + "print(\"mean effective pressure(mep)=A*k/l in pa\")\n", + "mep=A*k/l \n", + "print(\"indicator power(IP)=Ap*L*mep*N*1*2/60 in W\")\n", + "Ap=math.pi*D**2/4\n", + "IP=Ap*L*mep*N*2/60\n", + "print(\"(it is double acting so let us assume total power to be double of that in single acting)\"),round(IP,2)\n", + "print(\"so power required to drive=88.36 KW\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.3;pg no: 388" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.3, Page:388 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 3\n", + "indicated power(IP)=brake power/mechanical efficiency in KW= 42.22\n", + "frictional power loss(FP)=IP-BP in KW 4.22\n", + "brake power at quater load(BPq)=0.25*BP in KW\n", + "mechanical efficiency(n1)=BPq/IP 0.69\n", + "in percentage 69.23\n", + "so indicated power=42.22 KW\n", + "frictional power loss=4.22 KW\n", + "mechanical efficiency=69.24%\n" + ] + } + ], + "source": [ + "#cal of indicated power,frictional power loss,mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "print\"Example 10.3, Page:388 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 3\")\n", + "n=0.9;#mechanical efficiency of engine\n", + "BP=38;#brake power in KW\n", + "IP=BP/n\n", + "print(\"indicated power(IP)=brake power/mechanical efficiency in KW=\"),round(IP,2)\n", + "FP=IP-BP\n", + "print(\"frictional power loss(FP)=IP-BP in KW\"),round(FP,2)\n", + "print(\"brake power at quater load(BPq)=0.25*BP in KW\")\n", + "BPq=0.25*BP\n", + "IP=BPq+FP;\n", + "n1=BPq/IP\n", + "print(\"mechanical efficiency(n1)=BPq/IP\"),round(n1,2)\n", + "print(\"in percentage\"),round(n1*100,2)\n", + "print(\"so indicated power=42.22 KW\")\n", + "print(\"frictional power loss=4.22 KW\")\n", + "print(\"mechanical efficiency=69.24%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.4;pg no: 389" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.4, Page:389 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\n", + "brake power of engine(BP) in MW= 3120.98\n", + "so brake power is 3.121 MW\n", + "The fuel consumption in kg/hr(m)=m*BP in kg/hr\n", + "In order to find out brake thermal efficiency the heat input from fuel per second is required.\n", + "heat from fuel(Q)in KJ/s\n", + "Q=m*C/3600\n", + "energy to brake power=3120.97 KW\n", + "brake thermal efficiency(n)= 0.33\n", + "in percentage 33.49\n", + "so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\n", + "NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\n" + ] + } + ], + "source": [ + "#cal of brake power,fuel consumption\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.4, Page:389 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\")\n", + "m=0.25;#specific fuel consumption in kg/KWh\n", + "Pb_mep=1.5*1000;#brake mean effective pressure of each cylinder in Kpa\n", + "N=100;#engine rpm\n", + "D=85*10**-2;#bore of cylinder in m\n", + "L=220*10**-2;#stroke in m\n", + "C=43*10**3;#calorific value of diesel in KJ/kg\n", + "A=math.pi*D**2/4;\n", + "BP=Pb_mep*L*A*N/60\n", + "print(\"brake power of engine(BP) in MW=\"),round(BP,2)\n", + "print(\"so brake power is 3.121 MW\")\n", + "print(\"The fuel consumption in kg/hr(m)=m*BP in kg/hr\")\n", + "m=m*BP\n", + "print(\"In order to find out brake thermal efficiency the heat input from fuel per second is required.\")\n", + "print(\"heat from fuel(Q)in KJ/s\")\n", + "print(\"Q=m*C/3600\")\n", + "Q=m*C/3600\n", + "print(\"energy to brake power=3120.97 KW\")\n", + "n=BP/Q\n", + "print(\"brake thermal efficiency(n)=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\")\n", + "print(\"NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.5;pg no: 389" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.5, Page:389 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\n", + "brake thermal efficiency(n)=3600/(m*C) 0.33\n", + "in percentage 33.49\n", + "brake power(BP)in KW\n", + "BP= 226.19\n", + "brake specific fuel consumption,m=mf/BP\n", + "so mf=m*BP in kg/hr\n", + "air consumption(ma)from given air fuel ratio=k*mf in kg/hr\n", + "ma in kg/min\n", + "using perfect gas equation,\n", + "P*Va=ma*R*T\n", + "sa Va=ma*R*T/P in m^3/min\n", + "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", + "volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder) 1.87\n", + "in percentage 186.55\n", + "NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\n" + ] + } + ], + "source": [ + "#cal of brake thermal efficiency,brake power,volumetric efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.5, Page:389 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\")\n", + "Pb_mep=6*10**5;#brake mean effective pressure in pa\n", + "N=600;#engine rpm\n", + "m=0.25;#specific fuel consumption in kg/KWh\n", + "D=20*10**-2;#bore of cylinder in m\n", + "L=30*10**-2;#stroke in m\n", + "k=26;#air to fuel ratio\n", + "C=43*10**3;#calorific value in KJ/kg\n", + "R=0.287;#gas constant in KJ/kg K\n", + "T=(27+273);#ambient temperature in K\n", + "P=1*10**2;#ambient pressure in Kpa\n", + "n=3600/(m*C)\n", + "print(\"brake thermal efficiency(n)=3600/(m*C)\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"brake power(BP)in KW\")\n", + "A=math.pi*D**2/4;\n", + "BP=4*Pb_mep*L*A*N/60000\n", + "print(\"BP=\"),round(BP,2)\n", + "print(\"brake specific fuel consumption,m=mf/BP\")\n", + "print(\"so mf=m*BP in kg/hr\")\n", + "mf=m*BP\n", + "print(\"air consumption(ma)from given air fuel ratio=k*mf in kg/hr\")\n", + "ma=k*mf\n", + "print(\"ma in kg/min\")\n", + "ma=ma/60\n", + "print(\"using perfect gas equation,\")\n", + "print(\"P*Va=ma*R*T\")\n", + "print(\"sa Va=ma*R*T/P in m^3/min\")\n", + "Va=ma*R*T/P\n", + "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", + "Vs=math.pi*D**2*L/4\n", + "n_vol=Va/(Vs*(N/2)*4)\n", + "print(\"volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder)\"),round(n_vol,2)\n", + "print(\"in percentage\"),round(n_vol*100,2)\n", + "print(\"NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.6;pg no: 390" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.6, Page:390 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\n", + "let the bore diameter be (D) m\n", + "piston speed(V)=2*L*N\n", + "so L=V/(2*N) in m\n", + "volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\n", + "so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\n", + "so air sucked =274.78*D^2 m^3/min\n", + "air requirement(ma),kg/min=A/F ratio*fuel consumption per min\n", + "so ma=r*m in kg/min\n", + "using perfect gas equation,P*Va=ma*R*T\n", + "so Va=ma*R*T/P in m^3/min\n", + "ideally,air sucked=Va\n", + "so 274.78*D^2=0.906\n", + "D=sqrt(0.906/274.78) in m\n", + "indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\n", + "brake power=indicated power*mechanical efficiency\n", + "BP=IP*n_mech in KW 10.35\n", + "so brake power=10.34 KW\n" + ] + } + ], + "source": [ + "#cal of brake power\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 10.6, Page:390 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\")\n", + "N=3000;#engine rpm\n", + "m=5;#fuel consumption in litre/hr\n", + "r=19;#air-fuel ratio\n", + "sg=0.7;#specific gravity of fuel\n", + "V=500;#piston speed in m/min\n", + "P_imep=6*10**5;#indicated mean effective pressure in pa\n", + "P=1.013*10**5;#ambient pressure in pa\n", + "T=(15+273);#ambient temperature in K\n", + "n_vol=0.7;#volumetric efficiency \n", + "n_mech=0.8;#mechanical efficiency\n", + "R=0.287;#gas constant for gas in KJ/kg K\n", + "print(\"let the bore diameter be (D) m\")\n", + "print(\"piston speed(V)=2*L*N\")\n", + "print(\"so L=V/(2*N) in m\")\n", + "L=V/(2*N)\n", + "L=0.0833;#approx.\n", + "print(\"volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\")\n", + "print(\"so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\")\n", + "n_vol*(math.pi*L/4)*N*2\n", + "print(\"so air sucked =274.78*D^2 m^3/min\")\n", + "print(\"air requirement(ma),kg/min=A/F ratio*fuel consumption per min\")\n", + "print(\"so ma=r*m in kg/min\")\n", + "ma=r*m*sg/60\n", + "print(\"using perfect gas equation,P*Va=ma*R*T\")\n", + "print(\"so Va=ma*R*T/P in m^3/min\")\n", + "Va=ma*R*T*1000/P \n", + "print(\"ideally,air sucked=Va\")\n", + "print(\"so 274.78*D^2=0.906\")\n", + "print(\"D=sqrt(0.906/274.78) in m\")\n", + "D=math.sqrt(0.906/274.78) \n", + "print(\"indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\")\n", + "IP=P_imep*L*(math.pi*D**2/4)*(N/60)*2/1000\n", + "print(\"brake power=indicated power*mechanical efficiency\")\n", + "BP=IP*n_mech \n", + "print(\"BP=IP*n_mech in KW\"),round(BP,2)\n", + "print(\"so brake power=10.34 KW\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.7;pg no: 391" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.7, Page:391 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\n", + "After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\n", + "friction power(FP)=5 KW\n", + "brake power(BP) in KW= 30.82\n", + "indicated power(IP) in KW= 35.82\n", + "mechanical efficiency(n_mech)= 0.86\n", + "in percentage 86.04\n", + "brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr= 0.29\n", + "brake thermal efficiency(n_bte)= 0.29\n", + "in percentage 28.67\n", + "also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\n", + "indicated thermal efficiency(n_ite)= 0.33\n", + "in percentage 33.32\n", + "indicated power(IP)=P_imep*L*A*N\n", + "so P_imep in Kpa= 76.01\n", + "Also,mechanical efficiency=P_bmep/P_imep\n", + "so P_bmep in Kpa= 65.4\n", + "brake power=30.82 KW\n", + "indicated power=35.82 KW\n", + "mechanical efficiency=86.04%\n", + "brake thermal efficiency=28.67%\n", + "indicated thermal efficiency=33.32%\n", + "brake mean effective pressure=65.39 Kpa\n", + "indicated mean effective pressure=76.01 Kpa\n" + ] + } + ], + "source": [ + "#cal of power and efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.7, Page:391 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\")\n", + "M=20;#load on dynamometer in kg\n", + "r=50*10**-2;#radius in m\n", + "N=3000;#speed of rotation in rpm\n", + "D=20*10**-2;#bore in m\n", + "L=30*10**-2;#stroke in m\n", + "m=0.15;#fuel supplying rate in kg/min\n", + "C=43;#calorific value of fuel in MJ/kg\n", + "FP=5;#friction power in KW\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\")\n", + "print(\"friction power(FP)=5 KW\")\n", + "BP=2*math.pi*N*(M*g*r)*10**-3/60\n", + "print(\"brake power(BP) in KW=\"),round(BP,2)\n", + "IP=BP+FP\n", + "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", + "n_mech=BP/IP\n", + "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "bsfc=m*60/BP\n", + "print(\"brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr=\"),round(bsfc,2)\n", + "n_bte=3600/(bsfc*C*1000)\n", + "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", + "print(\"in percentage\"),round(n_bte*100,2)\n", + "print(\"also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\")\n", + "n_ite=n_bte/n_mech\n", + "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", + "print(\"in percentage\"),round(n_ite*100,2)\n", + "print(\"indicated power(IP)=P_imep*L*A*N\")\n", + "P_imep=IP/(L*(math.pi*D**2/4)*N/60)\n", + "print(\"so P_imep in Kpa=\"),round(P_imep,2)\n", + "print(\"Also,mechanical efficiency=P_bmep/P_imep\")\n", + "n_mech=0.8604;#mechanical efficiency\n", + "P_bmep=P_imep*n_mech\n", + "print(\"so P_bmep in Kpa=\"),round(P_bmep,2)\n", + "print(\"brake power=30.82 KW\")\n", + "print(\"indicated power=35.82 KW\")\n", + "print(\"mechanical efficiency=86.04%\")\n", + "print(\"brake thermal efficiency=28.67%\")\n", + "print(\"indicated thermal efficiency=33.32%\")\n", + "print(\"brake mean effective pressure=65.39 Kpa\")\n", + "print(\"indicated mean effective pressure=76.01 Kpa\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.8;pg no: 392" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.8, Page:392 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\n", + "indicated power(IP) in KW= 282.74\n", + "mechanical efficiency(n_mech)=brake power/indicated power\n", + "so n_mech= 0.88\n", + "in percentage 88.42\n", + "brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\n", + "brake thermal efficiency(n_bte)= 0.35\n", + "in percentage 34.88\n", + "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", + "mass of air corresponding to above swept volume,using perfect gas equation\n", + "P*Vs=ma*R*T\n", + "so ma=(P*Vs)/(R*T) in kg\n", + "volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\n", + "so mass of air taken per minute in kg/min \n", + "mass corresponding to swept volume per minute in kg/min\n", + "so volumetric efficiency 0.8333\n", + "in percentage 83.3333\n", + "so indicated power =282.74 KW,mechanical efficiency=88.42%\n", + "brake thermal efficiency=34.88%,volumetric efficiency=83.33%\n" + ] + } + ], + "source": [ + "#cal of brake thermal efficiency,volumetric effeciency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.8, Page:392 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\")\n", + "N=300.;#engine rpm\n", + "BP=250.;#brake power in KW\n", + "D=30.*10**-2;#bore in m\n", + "L=25.*10**-2;#stroke in m\n", + "m=1.;#fuel consumption in kg/min\n", + "r=10.;#airfuel ratio \n", + "P_imep=0.8;#indicated mean effective pressure in pa\n", + "C=43.*10**3;#calorific value of fuel in KJ/kg\n", + "P=1.013*10**5;#ambient pressure in K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "T=(27.+273.);#ambient temperature in K\n", + "IP=P_imep*L*(math.pi*D**2/4)*N*4*10**3/60\n", + "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", + "print(\"mechanical efficiency(n_mech)=brake power/indicated power\")\n", + "n_mech=BP/IP\n", + "print(\"so n_mech=\"),round(n_mech,2)\n", + "print(\"in percentage \"),round(n_mech*100,2)\n", + "print(\"brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\")\n", + "bsfc=m*60./BP\n", + "n_bte=3600./(bsfc*C)\n", + "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", + "print(\"in percentage\"),round(n_bte*100,2)\n", + "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", + "Vs=math.pi*D**2*L/4\n", + "print(\"mass of air corresponding to above swept volume,using perfect gas equation\")\n", + "print(\"P*Vs=ma*R*T\")\n", + "print(\"so ma=(P*Vs)/(R*T) in kg\")\n", + "ma=(P*Vs)/(R*T*1000) \n", + "ma=0.02;#approx.\n", + "print(\"volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\")\n", + "print(\"so mass of air taken per minute in kg/min \")\n", + "1*10\n", + "print(\"mass corresponding to swept volume per minute in kg/min\")\n", + "ma*4*N/2\n", + "print(\"so volumetric efficiency \"),round(10./12.,4)\n", + "print(\"in percentage\"),round((10./12.)*100.,4)\n", + "print(\"so indicated power =282.74 KW,mechanical efficiency=88.42%\")\n", + "print(\"brake thermal efficiency=34.88%,volumetric efficiency=83.33%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.9;pg no: 393" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.9, Page:393 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\n", + "indicated mean effective pressure(P_imeb)=h*k in Kpa\n", + "indicated power(IP)=P_imeb*L*A*N/2 in KW 9.375\n", + "brake power(BP)=2*%pi*N*T in KW 4.62\n", + "mechanical efficiency(n_mech)= 0.49\n", + "in percentage 49.31\n", + "so indicated power=9.375 KW\n", + "brake power=4.62 KW\n", + "mechanical efficiency=49.28%\n", + "energy liberated from fuel(Ef)=C*m/60 in KJ/s\n", + "energy available as brake power(BP)=4.62 KW\n", + "energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\n", + "energy carried by exhaust gases(Eg)=30 KJ/s\n", + "unaccounted energy loss in KW= 34.75\n", + "NOTE=>overall energy balance sheet is attached as jpg file with this code.\n" + ] + } + ], + "source": [ + "#cal of indicated power,brake power,mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.9, Page:393 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\")\n", + "h=10.;#height of indicator diagram in mm\n", + "k=25.;#indicator constant in KN/m^2 per mm\n", + "N=300.;#engine rpm\n", + "Vs=1.5*10**-2;#swept volume in m^3\n", + "M=60.;#effective brake load upon dynamometer in kg\n", + "r=50.*10**-2;#effective brake drum radius in m\n", + "m=0.12;#fuel consumption in kg/min\n", + "C=42.*10**3;#calorific value in KJ/kg\n", + "mw=6.;#circulating water rate in kg/min\n", + "T1=35.;#cooling water entering temperature in degree celcius\n", + "T2=70.;#cooling water leaving temperature in degree celcius\n", + "Eg=30.;#exhaust gases leaving energy in KJ/s\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "g=9.81;#accelaration due to gravity in m/s^2\n", + "print(\"indicated mean effective pressure(P_imeb)=h*k in Kpa\")\n", + "P_imeb=h*k\n", + "IP=P_imeb*Vs*N/(2*60)\n", + "print(\"indicated power(IP)=P_imeb*L*A*N/2 in KW\") ,round(IP,3)\n", + "BP=2*math.pi*N*(M*g*r*10**-3)/(2*60)\n", + "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", + "n_mech=BP/IP\n", + "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "print(\"so indicated power=9.375 KW\")\n", + "print(\"brake power=4.62 KW\")\n", + "print(\"mechanical efficiency=49.28%\")\n", + "print(\"energy liberated from fuel(Ef)=C*m/60 in KJ/s\")\n", + "Ef=C*m/60\n", + "print(\"energy available as brake power(BP)=4.62 KW\")\n", + "print(\"energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\")\n", + "Ec=(mw/M)*Cw*(T2-T1)\n", + "print(\"energy carried by exhaust gases(Eg)=30 KJ/s\")\n", + "Ef-BP-Ec-Eg\n", + "print(\"unaccounted energy loss in KW=\"),round(Ef-BP-Ec-Eg,2)\n", + "print(\"NOTE=>overall energy balance sheet is attached as jpg file with this code.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.10;pg no: 394" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.10, Page:394 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\n", + "brake power(BP)=2*%pi*N*T in KW 47.12\n", + "so brake power=47.124 KW\n", + "brake specific fuel consumption(bsfc) in kg/KW hr= 0.34\n", + "indicated power(IP) in Kw= 52.36\n", + "indicated thermal efficiency(n_ite)= 0.28\n", + "in percentage 28.05\n", + "so indicated thermal efficiency=28.05%\n", + "heat available from fuel(Qf)=(m/mw)*C in KJ/min 11200.0\n", + "energy consumed as brake power(BP) in KJ/min= 2827.43\n", + "energy carried by cooling water(Qw) in KJ/min= 1442.1\n", + "energy carried by exhaust gases(Qg) in KJ/min= 4786.83\n", + "unaccounted energy loss in KJ/min 2143.63\n", + "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\n" + ] + } + ], + "source": [ + "#cal of brake power,brake specific fuel consumption,indicated thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.10, Page:394 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\")\n", + "m=4.;#mass of fuel consumed in kg\n", + "N=1500.;#engine rpm\n", + "mw=15.;#water circulation rate in kg/min\n", + "T1=27.;#cooling water inlet temperature in degree celcius\n", + "T2=50.;#cooling water outlet temperature in degree celcius\n", + "ma=150.;#mass of air consumed in kg\n", + "T_exhaust=400.;#exhaust temperature in degree celcius\n", + "T_atm=27.;#atmospheric temperature in degree celcius\n", + "Cg=1.25;#mean specific heat of exhaust gases in KJ/kg K\n", + "n_mech=0.9;#mechanical efficiency\n", + "T=300.*10**-3;#brake torque in N\n", + "C=42.*10**3;#calorific value in KJ/kg\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "BP=2.*math.pi*N*T/60\n", + "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", + "print(\"so brake power=47.124 KW\")\n", + "bsfc=m*60/(mw*BP)\n", + "print(\"brake specific fuel consumption(bsfc) in kg/KW hr=\"),round(bsfc,2)\n", + "IP=BP/n_mech\n", + "print(\"indicated power(IP) in Kw=\"),round(IP,2)\n", + "n_ite=IP*mw*60/(m*C)\n", + "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", + "print(\"in percentage\"),round(n_ite*100,2)\n", + "print(\"so indicated thermal efficiency=28.05%\")\n", + "Qf=(m/mw)*C\n", + "print(\"heat available from fuel(Qf)=(m/mw)*C in KJ/min\"),round(Qf,2)\n", + "BP=BP*60 \n", + "print(\"energy consumed as brake power(BP) in KJ/min=\"),round(BP,2)\n", + "Qw=mw*Cw*(T2-T1)\n", + "print(\"energy carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", + "Qg=(ma+m)*Cg*(T_exhaust-T_atm)/mw\n", + "print(\"energy carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", + "Qf-(BP+Qw+Qg)\n", + "print(\"unaccounted energy loss in KJ/min\"),round(Qf-(BP+Qw+Qg),2)\n", + "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.11;pg no: 395" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.11, Page:395 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\n", + "indicated power of 1st cylinder=BP-BP1 in KW\n", + "indicated power of 2nd cylinder=BP-BP2 in KW\n", + "indicated power of 3rd cylinder=BP-BP3 in KW\n", + "indicated power of 4th cylinder=BP-BP4 in KW\n", + "indicated power of 5th cylinder=BP-BP5 in KW\n", + "indicated power of 6th cylinder=BP-BP6 in KW\n", + " total indicated power(IP)in KW= 61.9\n", + "mechanical efficiency(n_mech)= 0.81\n", + "in percentage 80.78\n", + "so indicated power=61.9 KW\n", + "mechanical efficiency=80.77%\n" + ] + } + ], + "source": [ + "#cal of indicated power and mechanical efficiency\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.11, Page:395 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\")\n", + "BP=50.;#brake power output at full load in KW\n", + "BP1=40.1;#brake power output of 1st cylinder in KW\n", + "BP2=39.5;#brake power output of 2nd cylinder in KW\n", + "BP3=39.1;#brake power output of 3rd cylinder in KW\n", + "BP4=39.6;#brake power output of 4th cylinder in KW\n", + "BP5=39.8;#brake power output of 5th cylinder in KW\n", + "BP6=40.;#brake power output of 6th cylinder in KW\n", + "print(\"indicated power of 1st cylinder=BP-BP1 in KW\")\n", + "BP-BP1\n", + "print(\"indicated power of 2nd cylinder=BP-BP2 in KW\")\n", + "BP-BP2\n", + "print(\"indicated power of 3rd cylinder=BP-BP3 in KW\")\n", + "BP-BP3\n", + "print(\"indicated power of 4th cylinder=BP-BP4 in KW\")\n", + "BP-BP4\n", + "print(\"indicated power of 5th cylinder=BP-BP5 in KW\")\n", + "BP-BP5\n", + "print(\"indicated power of 6th cylinder=BP-BP6 in KW\")\n", + "BP-BP6\n", + "IP=9.9+10.5+10.9+10.4+10.2+10\n", + "print(\" total indicated power(IP)in KW=\"),round(IP,2)\n", + "n_mech=BP/IP\n", + "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "print(\"so indicated power=61.9 KW\")\n", + "print(\"mechanical efficiency=80.77%\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.12;pg no: 396" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.12, Page:396 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\n", + "brake power output of engine(BP) in KW= 19.63\n", + "brake power when cylinder 1 is cut(BP1) in KW= 13.74\n", + "so indicated power of first cylinder(IP1) in KW= 5.89\n", + "brake power when cylinder 2 is cut(BP2) in KW= 14.14\n", + "so indicated power of second cylinder(IP2) in KW= 5.5\n", + "brake power when cylinder 3 is cut(BP3) in KW= 14.29\n", + "so indicated power of third cylinder(IP3) in KW= 5.34\n", + "brake power when cylinder 4 is cut(BP4) in KW= 13.35\n", + "so indicated power of fourth cylinder(IP4) in KW= 6.28\n", + "now total indicated power(IP) in KW 23.01\n", + "engine mechanical efficiency(n_mech)= 0.85\n", + "in percentage 85.32\n", + "so BP=19.63 KW,IP=23 KW,n_mech=83.35%\n", + "heat liberated by fuel(Qf)=m*C in KJ/min 8127.0\n", + "heat carried by exhaust gases(Qg) in KJ/min= 1436.02\n", + "heat carried by cooling water(Qw) in KJ/min= 1730.52\n", + "energy to brake power(BP) in KJ/min= 1177.8\n", + "unaccounted losses in KJ/min 3782.66\n", + "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \n" + ] + } + ], + "source": [ + "#cal of brake power,indicated power,heat balance sheet\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 10.12, Page:396 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\")\n", + "N=1500.;#engine rpm at full load\n", + "F=250.;#brake load at full load in N\n", + "F1=175.;#brake reading 1 in N\n", + "F2=180.;#brake reading 2 in N\n", + "F3=182.;#brake reading 3 in N\n", + "F4=170.;#brake reading 4 in N\n", + "r=50.*10**-2;#brake drum radius in m\n", + "m=0.189;#fuel consumption rate in kg/min\n", + "C=43.*10**3;#fuel calorific value in KJ/kg\n", + "k=12.;#air to fuel ratio\n", + "T_exhaust=600.;#exhaust gas temperature in degree celcius\n", + "mw=18.;#cooling water flow rate in kg/min\n", + "T1=27.;#cooling water entering temperature in degree celcius\n", + "T2=50.;#cooling water leaving temperature in degree celcius\n", + "T_atm=27.;#atmospheric air temperature\n", + "Cg=1.02;#specific heat of exhaust gas in KJ/kg K\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "BP=2.*math.pi*N*F*r*10**-3/60.\n", + "print(\"brake power output of engine(BP) in KW=\"),round(BP,2)\n", + "BP1=2.*math.pi*N*F1*r*10**-3/60.\n", + "print(\"brake power when cylinder 1 is cut(BP1) in KW=\"),round(BP1,2)\n", + "IP1=BP-BP1\n", + "print(\"so indicated power of first cylinder(IP1) in KW=\"),round(IP1,2)\n", + "BP2=2.*math.pi*N*F2*r*10**-3/60.\n", + "print(\"brake power when cylinder 2 is cut(BP2) in KW=\"),round(BP2,2)\n", + "IP2=BP-BP2\n", + "print(\"so indicated power of second cylinder(IP2) in KW=\"),round(IP2,2)\n", + "BP3=2.*math.pi*N*F3*r*10**-3/60.\n", + "print(\"brake power when cylinder 3 is cut(BP3) in KW=\"),round(BP3,2)\n", + "IP3=BP-BP3\n", + "print(\"so indicated power of third cylinder(IP3) in KW=\"),round(IP3,2)\n", + "BP4=2.*math.pi*N*F4*r*10**-3/60.\n", + "print(\"brake power when cylinder 4 is cut(BP4) in KW=\"),round(BP4,2)\n", + "IP4=BP-BP4\n", + "print(\"so indicated power of fourth cylinder(IP4) in KW=\"),round(IP4,2)\n", + "IP=IP1+IP2+IP3+IP4\n", + "print(\"now total indicated power(IP) in KW\"),round(IP,2)\n", + "n_mech=BP/IP\n", + "print(\"engine mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", + "print(\"in percentage\"),round(n_mech*100,2)\n", + "print(\"so BP=19.63 KW,IP=23 KW,n_mech=83.35%\")\n", + "Qf=m*C\n", + "print(\"heat liberated by fuel(Qf)=m*C in KJ/min\"),round(Qf,2)\n", + "Qg=(k+1)*m*Cg*(T_exhaust-T_atm)\n", + "print(\"heat carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", + "Qw=mw*Cw*(T2-T1)\n", + "print(\"heat carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", + "BP=19.63*60\n", + "print(\"energy to brake power(BP) in KJ/min=\"),round(19.63*60,2)\n", + "Qf-(Qg+Qw+BP)\n", + "print(\"unaccounted losses in KJ/min\"),round(Qf-(Qg+Qw+BP),2)\n", + "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 10.13;pg no: 397" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 10.13, Page:397 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\n", + "brake power(BP)=2*%pi*N*T in KW\n", + "indicated power(IP)=(mep*L*A*N)/60000 in KW\n", + "A> heat added(Q)=m*C/3600 in KJ/s 52.36\n", + "or Q in KJ/min\n", + "thermal efficiency(n_th)= 0.27\n", + "in percentage 26.85\n", + "B> heat equivalent of brake power(BP) in KJ/min= 659.76\n", + "C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\n", + "heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\n", + "mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\n", + "mg=(ma+m)/60\n", + "mass of steam in exhaust gases in kg/min\n", + "mass of dry exhaust gases in kg/min\n", + "D> heat carried by steam in exhaust in KJ/min 299.86\n", + "E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min 782.64\n", + "F> unaccounted loss=A-B-C-D-E in KJ/min 537.4\n", + "NOTE># on per minute basis is attached as jpg file with this code.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency and heat balance sheet\n", + "#intiation of all variables\n", + "# Chapter 10\n", + "import math\n", + "print\"Example 10.13, Page:397 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\")\n", + "D=20.*10**-2;#cylinder diameter in m\n", + "L=28.*10**-2;#stroke in m\n", + "m=4.22;#mass of fuel used in kg\n", + "C=44670.;#calorific value of fuel in KJ/kg\n", + "N=21000./60.;#engine rpm\n", + "mep=2.74*10**5;#mean effective pressure in pa\n", + "F=600.;#net brake load applied to a drum of 100 cm diameter in N\n", + "r=50.*10**-2;#brake drum radius in m\n", + "mw=495.;#total mass of cooling water in kg\n", + "T1=13.;#cooling water inlet temperature in degree celcius\n", + "T2=38.;#cooling water outlet temperature in degree celcius\n", + "ma=135.;#mass of air used in kg\n", + "T_air=20.;#temperature of air in test room in degree celcius\n", + "T_exhaust=370.;#temperature of exhaust gases in degree celcius\n", + "Cp_gases=1.005;#specific heat of gases in KJ/kg K\n", + "Cp_steam=2.093;#specific heat of steam at atmospheric pressure in KJ/kg K\n", + "Cpw=4.18;#specific heat of water in KJ/kg K\n", + "print(\"brake power(BP)=2*%pi*N*T in KW\")\n", + "BP=2*math.pi*N*F*r/60000\n", + "print(\"indicated power(IP)=(mep*L*A*N)/60000 in KW\")\n", + "IP=(mep*L*(math.pi*D**2/4)*N)/60000\n", + "Q=m*C/3600\n", + "print(\"A> heat added(Q)=m*C/3600 in KJ/s\"),round(Q,2)\n", + "print(\"or Q in KJ/min\")\n", + "Q=Q*60\n", + "Q=52.36;#heat added in KJ/s\n", + "n_th=IP/Q\n", + "print(\"thermal efficiency(n_th)= \"),round(n_th,2)\n", + "print(\"in percentage\"),round(n_th*100,2)\n", + "BP=BP*60\n", + "print(\"B> heat equivalent of brake power(BP) in KJ/min= \"),round(10.996*60,2)\n", + "print(\"C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\")\n", + "Qw=mw*Cpw*(T2-T1)/60\n", + "print(\"heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\")\n", + "print(\"mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\")\n", + "print(\"mg=(ma+m)/60\")\n", + "mg=(ma+m)/60\n", + "print(\"mass of steam in exhaust gases in kg/min\")\n", + "9*(0.15*m/60)\n", + "print(\"mass of dry exhaust gases in kg/min\")\n", + "mg-0.095\n", + "0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100))\n", + "print(\"D> heat carried by steam in exhaust in KJ/min\"),round(0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100)),2)\n", + "Qg=2.225*Cp_gases*(T_exhaust-T_air)\n", + "print(\"E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min\"),round(Qg,2)\n", + "print(\"F> unaccounted loss=A-B-C-D-E in KJ/min\"),round(3141.79-659.76-862.13-299.86-782.64,2)\n", + "print(\"NOTE># on per minute basis is attached as jpg file with this code.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter11.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter11.ipynb new file mode 100755 index 00000000..31f593f0 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter11.ipynb @@ -0,0 +1,1309 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11:Introduction to refrigeration and Air Conditioning" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.1;pg no: 435" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.1, Page:435 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\n", + "for refrigerator working on reversed carnot cycle.\n", + "Q1/T1=Q2/T2\n", + "so Q2=Q1*T2/T1 in KJ/min\n", + "and work input required,W in KJ/min\n", + "W=Q2-Q1 83.66\n" + ] + } + ], + "source": [ + "#cal of work input\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.1, Page:435 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\")\n", + "T1=(-16.+273.);#temperature of refrigerated space in K\n", + "T2=(27.+273.);#temperature of atmosphere in K\n", + "Q1=500.;#heat extracted from refrigerated space in KJ/min\n", + "print(\"for refrigerator working on reversed carnot cycle.\")\n", + "print(\"Q1/T1=Q2/T2\")\n", + "print(\"so Q2=Q1*T2/T1 in KJ/min\")\n", + "Q2=Q1*T2/T1\n", + "print(\"and work input required,W in KJ/min\")\n", + "W=Q2-Q1\n", + "print(\"W=Q2-Q1\"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.2;pg no: 435" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.2, Page:435 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\n", + "refrigeration capacity or heat extraction rate(Q)in KJ/s\n", + "let the ice formation rate be m kg/s\n", + "heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\n", + "ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice= 6.25\n", + "COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\n", + "also COP=Q/W\n", + "so W=Q/COP in KJ/s\n", + "HP required 643.62\n", + "NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\n" + ] + } + ], + "source": [ + "#cal of HP required\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.2, Page:435 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\")\n", + "Q=800.;#refrigeration capacity in tons\n", + "Q_latent=335.;#latent heat for ice formation from water in KJ/kg\n", + "T1=(-7.+273.);#temperature of reservoir 1 in K\n", + "T2=(27.+273.);#temperature of reservoir 2 in K\n", + "print(\"refrigeration capacity or heat extraction rate(Q)in KJ/s\")\n", + "Q=Q*3.5\n", + "print(\"let the ice formation rate be m kg/s\")\n", + "print(\"heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\")\n", + "Q1=4.18*(27-0)+Q_latent\n", + "m=Q/Q1\n", + "print(\"ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice=\"),round(Q/Q1,2)\n", + "print(\"COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\")\n", + "COP=T1/(T2-T1)\n", + "print(\"also COP=Q/W\")\n", + "print(\"so W=Q/COP in KJ/s\")\n", + "W=Q/COP\n", + "W=W/0.7457\n", + "print(\"HP required\"),round(W/0.7457,2)\n", + "print(\"NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.3;pg no: 436" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.3, Page:436 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\n", + "COP=T1/(T2-T1)=Q/W 1.56\n", + "equating,COP=T1/(T2-T1)\n", + "so temperature of surrounding(T2)in K\n", + "T2= 403.69\n" + ] + } + ], + "source": [ + "#cal of COP and temperature of surrounding\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.3, Page:436 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\")\n", + "T1=(-27+273);#temperature of refrigerator in K\n", + "W=3*.7457;#work input in KJ/s\n", + "Q=1*3.5;#refrigeration effect in KJ/s\n", + "COP=Q/W\n", + "print(\"COP=T1/(T2-T1)=Q/W\"),round(COP,2)\n", + "COP=1.56;#approx.\n", + "print(\"equating,COP=T1/(T2-T1)\")\n", + "print(\"so temperature of surrounding(T2)in K\")\n", + "T2=T1+(T1/COP)\n", + "print(\"T2=\"),round(T2,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.4;pg no: 436" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.4, Page:436 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\n", + "during process 1-2_a\n", + "p2/p1=(T2_a/T1)^(y/(y-1))\n", + "so T2_a=T1*(p2/p1)^((y-1)/y)in K\n", + "theoretical temperature after compression,T2_a=440.18 K\n", + "for compression process,\n", + "n1=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+(T2_a-T1)/n1 in K\n", + "for expansion process,3-4_a\n", + "T4_a/T3=(p1/p2)^((y-1)/y)\n", + "so T4_a=T3*(p1/p2)^((y-1)/y) in K\n", + "n2=0.9=(T3-T4)/(T3-T4_a)\n", + "so T4=T3-(n2*(T3-T4_a))in K\n", + "so work during compression,W_C in KJ/s\n", + "W_C=m*Cp*(T2-T1)\n", + "work during expansion,W_T in KJ/s\n", + "W_T=m*Cp*(T3-T4)\n", + "refrigeration effect is realized during process,4-1.so refrigeration shall be,\n", + "Q_ref=m*Cp*(T1-T4) in KJ/s\n", + "Q_ref in ton 18.36\n", + "net work required(W)=W_C-W_T in KJ/s 111.59\n", + "COP= 0.58\n", + "so refrigeration capacity=18.36 ton or 64.26 KJ/s\n", + "and COP=0.57\n", + "NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\n" + ] + } + ], + "source": [ + "#cal of refrigeration capacity and COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.4, Page:436 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\")\n", + "T1=(-30.+273.);#temperature of air at beginning of compression in K\n", + "T3=(27.+273.);#temperature of air after cooling in K\n", + "r=8.;#pressure ratio\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "y=1.4;#expansion constant \n", + "m=1.;#air flow rate in kg/s\n", + "n1=0.85;#isentropic efficiency for compression process\n", + "n2=.9;#isentropic efficiency for expansion process\n", + "print(\"during process 1-2_a\")\n", + "print(\"p2/p1=(T2_a/T1)^(y/(y-1))\")\n", + "print(\"so T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", + "T2_a=T1*(r)**((y-1)/y)\n", + "print(\"theoretical temperature after compression,T2_a=440.18 K\")\n", + "print(\"for compression process,\")\n", + "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", + "T2=T1+(T2_a-T1)/n1\n", + "print(\"for expansion process,3-4_a\")\n", + "print(\"T4_a/T3=(p1/p2)^((y-1)/y)\")\n", + "print(\"so T4_a=T3*(p1/p2)^((y-1)/y) in K\")\n", + "T4_a=T3*(1/r)**((y-1)/y)\n", + "print(\"n2=0.9=(T3-T4)/(T3-T4_a)\")\n", + "print(\"so T4=T3-(n2*(T3-T4_a))in K\")\n", + "T4=T3-(n2*(T3-T4_a))\n", + "print(\"so work during compression,W_C in KJ/s\")\n", + "print(\"W_C=m*Cp*(T2-T1)\")\n", + "W_C=m*Cp*(T2-T1)\n", + "print(\"work during expansion,W_T in KJ/s\")\n", + "print(\"W_T=m*Cp*(T3-T4)\")\n", + "W_T=m*Cp*(T3-T4)\n", + "print(\"refrigeration effect is realized during process,4-1.so refrigeration shall be,\")\n", + "print(\"Q_ref=m*Cp*(T1-T4) in KJ/s\")\n", + "Q_ref=m*Cp*(T1-T4)\n", + "Q_ref=Q_ref/3.5\n", + "print(\"Q_ref in ton\"),round(Q_ref,2)\n", + "W=W_C-W_T\n", + "print(\"net work required(W)=W_C-W_T in KJ/s\"),round(W,2)\n", + "Q_ref=64.26;\n", + "COP=Q_ref/(W_C-W_T)\n", + "print(\"COP=\"),round(COP,2)\n", + "print(\"so refrigeration capacity=18.36 ton or 64.26 KJ/s\")\n", + "print(\"and COP=0.57\")\n", + "print(\"NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.5;pg no: 437" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.5, Page:437 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\n", + "for isentropic compression process:\n", + "(p2/p1)^((y-1)/y)=T2/T1\n", + "so T2=T1*(p2/p1)^((y-1)/y) in K\n", + "for isenropic expansion process:\n", + "(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\n", + "so T4=T3/(p2/p1)^((y-1)/y) in K\n", + "heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\n", + "refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\n", + "so net work(W)=Q23-Q41 in KJ/kg\n", + "so COP=refrigeration effect/net work= 1.71\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.5, Page:437 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\")\n", + "T1=(7+273);#temperature of refrigerated space in K\n", + "T3=(27+273);#temperature after compression in K\n", + "p1=1*10**5;#pressure of refrigerated space in pa\n", + "p2=5*10**5;#pressure after compression in pa\n", + "y=1.4;#expansion constant\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"for isentropic compression process:\")\n", + "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", + "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"for isenropic expansion process:\")\n", + "print(\"(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\")\n", + "print(\"so T4=T3/(p2/p1)^((y-1)/y) in K\")\n", + "T4=T3/(p2/p1)**((y-1)/y)\n", + "print(\"heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\")\n", + "Q23=Cp*(T2-T3)\n", + "print(\"refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\")\n", + "Q41=Cp*(T1-T4)\n", + "print(\"so net work(W)=Q23-Q41 in KJ/kg\")\n", + "W=Q23-Q41\n", + "COP=Q41/W\n", + "print(\"so COP=refrigeration effect/net work=\"),round(COP,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.6;pg no: 438" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.6, Page:438 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\n", + "for process 1-2\n", + "(p2/p1)^((y-1)/y)=T2/T1\n", + "so T2=T1*(p2/p1)^((y-1)/y) in K\n", + "for process 3-4\n", + "(p3/p4)^((y-1)/y)=T3/T4\n", + "so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\n", + "refrigeration capacity(Q) in KJ/s= 63.25\n", + "Q in ton\n", + "work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\n", + "w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\n", + "HP required to run compressor 177.86\n", + "so HP required to run compressor=177.86 hp\n", + "net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\n", + "COP=refrigeration capacity/work=Q/W 1.59\n" + ] + } + ], + "source": [ + "#cal of refrigeration capacity,HP required to run compressor,COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.6, Page:438 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\")\n", + "T1=(-10.+273.);#air entering temperature in K\n", + "p1=1.*10**5;#air entering pressure in pa\n", + "T3=(27.+273.);#compressed air temperature after cooling in K\n", + "p2=5.5*10**5;#pressure after compression in pa\n", + "m=0.8;#air flow rate in kg/s\n", + "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", + "y=1.4;#expansion constant\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"for process 1-2\")\n", + "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", + "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"for process 3-4\")\n", + "print(\"(p3/p4)^((y-1)/y)=T3/T4\")\n", + "print(\"so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\")\n", + "T4=T3/(p2/p1)**((y-1)/y)\n", + "Q=m*Cp*(T1-T4)\n", + "print(\"refrigeration capacity(Q) in KJ/s=\"),round(Q,2)\n", + "print(\"Q in ton\")\n", + "Q=Q/3.5\n", + "print(\"work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\")\n", + "print(\"w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\")\n", + "n=y;\n", + "w=(m*n)*R*(T2-T1)/(n-1)\n", + "print(\"HP required to run compressor\"),round(w/0.7457,2)\n", + "print(\"so HP required to run compressor=177.86 hp\")\n", + "print(\"net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\")\n", + "W=m*Cp*((T2-T3)-(T1-T4))\n", + "Q=63.25;#refrigeration capacity in KJ/s\n", + "COP=Q/W\n", + "print(\"COP=refrigeration capacity/work=Q/W\"),round(COP,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.7;pg no: 440" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.7, Page:440 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\n", + "for process 1-2,n=1.45\n", + "T2/T1=(p2/p1)^((n-1)/n)\n", + "so T2=T1*(p2/p1)^((n-1)/n) in K\n", + "for process 3-4,n=1.3\n", + "T4/T3=(p4/p3)^((n-1)/n)\n", + "so T4=T3*(p4/p3)^((n-1)/n)in K\n", + "refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\n", + "Q=m*Cp*(T5-T4)\n", + "m in kg/s= 0.55\n", + "so air mass flow rate in cabin=0.55 kg/s\n", + "let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\n", + "m1*Cp*(T8-T7)=m*Cp*(T2-T3)\n", + "during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\n", + "so T7=T6*(p7/p6)^((n-1)/n) in K\n", + "substituting T2,T3,T7,T8 and m in energy balance on intercooler,\n", + "m1=m*(T2-T3)/(T8-T7)in kg/s\n", + "total ram air mass flow rate=m+m1 in kg/s 2.11\n", + "ram air mass flow rate=2.12 kg/s\n", + "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\n", + "COP=refrigeration effect/work input=Q/W 0.485\n" + ] + } + ], + "source": [ + "#cal of air mass flow rate in cabin,ram air mass flow rate,COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.7, Page:440 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\")\n", + "p1=1.2*10**5;#pressure of ram air in pa\n", + "p6=p1;\n", + "T1=(15.+273.);#temperature of ram air in K\n", + "T6=T1;\n", + "p7=0.9*10**5;#pressure of ram air after expansion in pa\n", + "p3=4.*10**5;#pressure of ram air after compression in pa\n", + "p2=p3;\n", + "p4=1.*10**5;#pressure of ram air after expansion in second turbine in pa\n", + "T5=(25.+273.);#temperature of air when exhausted from cabin in K\n", + "T3=(50.+273.);#temperature of compressed air in K\n", + "T8=(30.+273.);#limited temperaure of ram air in K\n", + "Q=10.*3.5;#refrigeration capacity in KJ/s\n", + "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", + "print(\"for process 1-2,n=1.45\")\n", + "n=1.45;\n", + "print(\"T2/T1=(p2/p1)^((n-1)/n)\")\n", + "print(\"so T2=T1*(p2/p1)^((n-1)/n) in K\")\n", + "T2=T1*(p2/p1)**((n-1)/n)\n", + "print(\"for process 3-4,n=1.3\")\n", + "n=1.3;\n", + "print(\"T4/T3=(p4/p3)^((n-1)/n)\")\n", + "print(\"so T4=T3*(p4/p3)^((n-1)/n)in K\")\n", + "T4=T3*(p4/p3)**((n-1)/n)\n", + "print(\"refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\")\n", + "print(\"Q=m*Cp*(T5-T4)\")\n", + "m=Q/(Cp*(T5-T4))\n", + "print(\"m in kg/s=\"),round(m,2)\n", + "print(\"so air mass flow rate in cabin=0.55 kg/s\")\n", + "print(\"let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\")\n", + "print(\"m1*Cp*(T8-T7)=m*Cp*(T2-T3)\")\n", + "print(\"during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\")\n", + "print(\"so T7=T6*(p7/p6)^((n-1)/n) in K\")\n", + "T7=T6*(p7/p6)**((n-1)/n)\n", + "print(\"substituting T2,T3,T7,T8 and m in energy balance on intercooler,\")\n", + "print(\"m1=m*(T2-T3)/(T8-T7)in kg/s\")\n", + "m1=m*(T2-T3)/(T8-T7)\n", + "print(\"total ram air mass flow rate=m+m1 in kg/s\"),round(m+m1,2)\n", + "print(\"ram air mass flow rate=2.12 kg/s\")\n", + "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\")\n", + "m=0.55;#approx.\n", + "W=m*Cp*(T2-T1)\n", + "COP=Q/W\n", + "print(\"COP=refrigeration effect/work input=Q/W\"),round(Q/W,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.8;pg no: 441" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.8, Page:441 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\n", + "considering index of compression and expansion as 1.4\n", + "during ramming action,process 0-1,\n", + "T1/To=(p1/po)^((y-1)/y)\n", + "T1=To*(p1/po)^((y-1)/y)in K\n", + "during compression process 1-2_a\n", + "T2_a/T1=(p2/p1)^((y-1)/y)\n", + "T2_a=T1*(p2/p1)^((y-1)/y)in K\n", + "n1=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+(T2_a-T1)/n1 in K\n", + "In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\n", + "subsequently for 10 degree celcius temperature drop in evaporator,\n", + "T4=T3-10 in K\n", + "expansion in cooling turbine during process 4-5;\n", + "T5_a/T4=(p5/p4)^((y-1)/y)\n", + "T5_a=T4*(p5/p4)^((y-1)/y)in K\n", + "n2=(T4-T5)/(T4-T5_a)\n", + "T5=T4-(T4-T5_a)*n2 in K\n", + "let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\n", + "Q=m*Cp*(T6-T5)\n", + "so m=Q/(Cp*(T6-T5))in kg/s\n", + "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s 41.4\n", + "W in Hp\n", + "COP=refrigeration effect/work input=Q/W= 1.27\n", + "so COP=1.27\n", + "and HP required=55.48 hp\n" + ] + } + ], + "source": [ + "#cal of COP and HP required\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.8, Page:441 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\")\n", + "po=0.9*10**5;#atmospheric air pressure in pa\n", + "To=(3.+273.);#temperature of atmospheric air in K\n", + "p1=1.*10**5;#pressure due to ramming air in pa\n", + "p2=4.*10**5;#pressure when air leaves compressor in pa\n", + "p3=p2;\n", + "p4=p3;\n", + "p5=1.03*10**5;#pressure maintained in passenger cabin in pa\n", + "T6=(25.+273.);#temperature of air leaves cabin in K\n", + "Q=15.*3.5;#refrigeration capacity of aeroplane in KJ/s\n", + "n1=0.9;#isentropic efficiency of compressor\n", + "n2=0.8;#isentropic efficiency of turbine\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"considering index of compression and expansion as 1.4\")\n", + "y=1.4;\n", + "print(\"during ramming action,process 0-1,\")\n", + "print(\"T1/To=(p1/po)^((y-1)/y)\")\n", + "print(\"T1=To*(p1/po)^((y-1)/y)in K\")\n", + "T1=To*(p1/po)**((y-1)/y)\n", + "print(\"during compression process 1-2_a\")\n", + "print(\"T2_a/T1=(p2/p1)^((y-1)/y)\")\n", + "print(\"T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", + "T2_a=T1*(p2/p1)**((y-1)/y)\n", + "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", + "T2=T1+(T2_a-T1)/n1\n", + "print(\"In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\")\n", + "T3=0.34*T2\n", + "print(\"subsequently for 10 degree celcius temperature drop in evaporator,\")\n", + "print(\"T4=T3-10 in K\")\n", + "T4=T3-10\n", + "print(\"expansion in cooling turbine during process 4-5;\")\n", + "print(\"T5_a/T4=(p5/p4)^((y-1)/y)\")\n", + "print(\"T5_a=T4*(p5/p4)^((y-1)/y)in K\")\n", + "T5_a=T4*(p5/p4)**((y-1)/y)\n", + "print(\"n2=(T4-T5)/(T4-T5_a)\")\n", + "print(\"T5=T4-(T4-T5_a)*n2 in K\")\n", + "T5=T4-(T4-T5_a)*n2\n", + "print(\"let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\")\n", + "print(\"Q=m*Cp*(T6-T5)\")\n", + "print(\"so m=Q/(Cp*(T6-T5))in kg/s\")\n", + "m=Q/(Cp*(T6-T5))\n", + "W=m*Cp*(T2-T1)\n", + "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\"),round(W,2)\n", + "print(\"W in Hp\")\n", + "W=W/.7457\n", + "W=41.37;#work input to compressor in KJ/s\n", + "COP=Q/W\n", + "print(\"COP=refrigeration effect/work input=Q/W=\"),round(COP,2)\n", + "print(\"so COP=1.27\")\n", + "print(\"and HP required=55.48 hp\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.9;pg no: 443" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.9, Page:443 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\n", + "properties of NH3,\n", + "at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\n", + "and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\n", + "here work done,W=Area 1-2-3-9-1\n", + "refrigeration effect=Area 1-5-6-4-1\n", + "Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\n", + "so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\n", + "during throttling process between 3 and 4,h3=h4\n", + "(Area=3-11-7-3)=(Area 4-9-11-6-4)\n", + "(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\n", + "(Area 3-8-9)=(Area 4-6-7-8-4)\n", + "so (Area 4-6-7-8-4)=12.09 KJ/kg\n", + "also,(Area 4-6-7-8-4)=T1*(s4-s8)\n", + "so (s4-s8)in KJ/kg K=\n", + "also s3=s8=0.3386 KJ/kg K\n", + "so s4 in KJ/kg K=\n", + "also s1=s2=4.4809 KJ/kg K\n", + "refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\n", + "work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\n", + "so COP=refrigeration effect/work done= 5.94\n", + "so COP=5.94\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.9, Page:443 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\")\n", + "print(\"properties of NH3,\")\n", + "print(\"at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\")\n", + "T1=(-15+273);\n", + "h9=-54.51;\n", + "hg=1303.74;\n", + "s9=-0.2132;\n", + "sg=5.0536;\n", + "print(\"and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\")\n", + "T2=(25+273);\n", + "h3=99.94;\n", + "h2=1317.95;\n", + "s3=0.3386;\n", + "s2=4.4809;\n", + "print(\"here work done,W=Area 1-2-3-9-1\")\n", + "print(\"refrigeration effect=Area 1-5-6-4-1\")\n", + "print(\"Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\")\n", + "print(\"so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\")\n", + "h3-h9-T1*(s3-s9)\n", + "print(\"during throttling process between 3 and 4,h3=h4\")\n", + "print(\"(Area=3-11-7-3)=(Area 4-9-11-6-4)\")\n", + "print(\"(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\")\n", + "print(\"(Area 3-8-9)=(Area 4-6-7-8-4)\")\n", + "print(\"so (Area 4-6-7-8-4)=12.09 KJ/kg\")\n", + "print(\"also,(Area 4-6-7-8-4)=T1*(s4-s8)\")\n", + "print(\"so (s4-s8)in KJ/kg K=\")\n", + "12.09/T1\n", + "print(\"also s3=s8=0.3386 KJ/kg K\")\n", + "s8=s3;\n", + "print(\"so s4 in KJ/kg K=\")\n", + "s4=s8+12.09/T1\n", + "print(\"also s1=s2=4.4809 KJ/kg K\")\n", + "s1=s2;\n", + "print(\"refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\")\n", + "Q=T1*(s1-s4)\n", + "print(\"work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\")\n", + "W=12.09+((T2-T1)*(s1-s8))\n", + "COP=Q/W\n", + "print(\"so COP=refrigeration effect/work done=\"),round(COP,2)\n", + "print(\"so COP=5.94\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.10;pg no: 445" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.10, Page:445 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\n", + "properties of Freon-12,\n", + "at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\n", + "at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\n", + "during expansion(throttling)between 3 and 4\n", + "h3=h4=hf_40oc=74.53 KJ/kg=h4\n", + "process 1-2 is adiabatic compression so,\n", + "s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\n", + "at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\n", + "T2=313*exp((s1-sg)/Cpg)in K\n", + "so temperature after compression,T2=324.17 K\n", + "enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\n", + "compression work required,per kg(Wc)=h2-h1 in KJ/kg\n", + "refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\n", + "mass flow rate of refrigerant,m=Q/q in kg/s\n", + "COP=q/Wc 3.17452\n", + "volumetric efficiency of reciprocating compressor,given C=0.02\n", + "n_vol=1+C-C*(P2/P1)^(1/n)\n", + "let piston printlacement by V,m^3\n", + "mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\n", + "so V in cm^3= 569.43\n", + "so COP=3.175\n", + "and piston printlacement=569.45 cm^3\n" + ] + } + ], + "source": [ + "#cal of COP and piston printlacement\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.10, Page:445 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\")\n", + "Q=2.86*3.5;#refrigeration effect in KJ/s\n", + "N=1200;#compressor rpm\n", + "n=1.13;#compression index\n", + "print(\"properties of Freon-12,\")\n", + "print(\"at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\")\n", + "P1=1.51;\n", + "T1=(-20+273);\n", + "vg=0.1088;\n", + "h1=178.61;\n", + "s1=0.7082;\n", + "s2=s1;\n", + "print(\"at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\")\n", + "P2=9.61;\n", + "h3=74.53;\n", + "h4=h3;\n", + "hg=203.05;\n", + "sf=0.2716;\n", + "sg=0.682;\n", + "Cpf=0.976;\n", + "Cpg=0.747;\n", + "print(\"during expansion(throttling)between 3 and 4\")\n", + "print(\"h3=h4=hf_40oc=74.53 KJ/kg=h4\")\n", + "print(\"process 1-2 is adiabatic compression so,\")\n", + "print(\"s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\")\n", + "print(\"at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\")\n", + "print(\"T2=313*exp((s1-sg)/Cpg)in K\")\n", + "T2=313*math.exp((s1-sg)/Cpg)\n", + "print(\"so temperature after compression,T2=324.17 K\")\n", + "print(\"enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\")\n", + "h2=hg+Cpg*(T2-313)\n", + "print(\"compression work required,per kg(Wc)=h2-h1 in KJ/kg\")\n", + "Wc=h2-h1\n", + "print(\"refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\")\n", + "q=h1-h4\n", + "print(\"mass flow rate of refrigerant,m=Q/q in kg/s\")\n", + "m=Q/q\n", + "m=0.096;#approx.\n", + "COP=q/Wc\n", + "print(\"COP=q/Wc\"),round(COP,5)\n", + "print(\"volumetric efficiency of reciprocating compressor,given C=0.02\")\n", + "C=0.02;\n", + "print(\"n_vol=1+C-C*(P2/P1)^(1/n)\")\n", + "n_vol=1+C-C*(P2/P1)**(1/n)\n", + "print(\"let piston printlacement by V,m^3\")\n", + "print(\"mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\")\n", + "V=(m*60*vg)*10**6/(N*n_vol)\n", + "print(\"so V in cm^3=\"),round(V,2)\n", + "print(\"so COP=3.175\")\n", + "print(\"and piston printlacement=569.45 cm^3\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.11;pg no: 447" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.11, Page:447 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\n", + "properties of CO2,\n", + "at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\n", + "at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\n", + "processes of vapour compression cycle are shown on T-s diagram\n", + "1-2:isentropic compression process\n", + "2-3-4:condensation process\n", + "4-5:isenthalpic expansion process\n", + "5-1:refrigeration process in evaporator\n", + "h1=hg at -10oc=322.28 KJ/kg\n", + "at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\n", + "entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\n", + "entropy during isentropic process,s1=s2\n", + "at -10 degree celcius,s2=sf+x1*sfg\n", + "so x1=(s2-sf)/(sg-sf)\n", + "enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\n", + "h3=hf at 20oc=144.11 KJ/kg\n", + "since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\n", + "also,h4=h5=115.22 KJ/kg\n", + "refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\n", + "let refrigerant flow rate be m kg/s\n", + "refrigerant effect(Q)=m*q\n", + "m=Q/q in kg/s 0.01016\n", + "compressor work,Wc=h2-h1 in KJ/kg\n", + "COP=refrigeration effect per kg/compressor work per kg= 6.51\n", + "so COP=6.51,mass flow rate=0.01016 kg/s\n", + "NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \n" + ] + } + ], + "source": [ + "#cal of COP and mass flow rate\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.11, Page:447 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\")\n", + "Q=2;#refrigeration effect in KW\n", + "print(\"properties of CO2,\")\n", + "print(\"at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\")\n", + "T1=(20.+273.);#condensation temperature in K\n", + "P1=57.27;\n", + "h3=144.11;\n", + "hg=299.62;\n", + "sf=0.523;\n", + "sg_20oc=1.0527;\n", + "Cpf=2.889;\n", + "Cpg=2.135;\n", + "print(\"at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\")\n", + "T2=(-10+273);#evaporator temperature in K\n", + "P2=26.49;\n", + "vg=0.014;\n", + "hf=60.78;\n", + "h1=322.28;\n", + "sf=0.2381;\n", + "sg=1.2324;\n", + "print(\"processes of vapour compression cycle are shown on T-s diagram\")\n", + "print(\"1-2:isentropic compression process\")\n", + "print(\"2-3-4:condensation process\")\n", + "print(\"4-5:isenthalpic expansion process\")\n", + "print(\"5-1:refrigeration process in evaporator\")\n", + "print(\"h1=hg at -10oc=322.28 KJ/kg\")\n", + "print(\"at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\")\n", + "h2=hg+Cpg*(40.-20.)\n", + "print(\"entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\")\n", + "s2=sg_20oc+Cpg*math.log((273.+40.)/(273.+20.))\n", + "print(\"entropy during isentropic process,s1=s2\")\n", + "print(\"at -10 degree celcius,s2=sf+x1*sfg\")\n", + "print(\"so x1=(s2-sf)/(sg-sf)\")\n", + "x1=(s2-sf)/(sg-sf)\n", + "print(\"enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\")\n", + "h1=hf+x1*(h1-hf)\n", + "print(\"h3=hf at 20oc=144.11 KJ/kg\")\n", + "print(\"since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\")\n", + "h4=h3-Cpf*(20.-10.)\n", + "print(\"also,h4=h5=115.22 KJ/kg\")\n", + "h5=h4;\n", + "print(\"refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\")\n", + "q=(h1-h5)\n", + "print(\"let refrigerant flow rate be m kg/s\")\n", + "print(\"refrigerant effect(Q)=m*q\")\n", + "m=Q/q\n", + "print(\"m=Q/q in kg/s\"),round(m,5)\n", + "print(\"compressor work,Wc=h2-h1 in KJ/kg\")\n", + "Wc=h2-h1\n", + "COP=q/Wc\n", + "print(\"COP=refrigeration effect per kg/compressor work per kg=\"),round(COP,2)\n", + "print(\"so COP=6.51,mass flow rate=0.01016 kg/s\")\n", + "print(\"NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.12;pg no: 448" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.12, Page:448 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\n", + "here pressure of atmospheric air(P)may be taken as 1.013 bar\n", + "specific humidity,omega=0.622*(Pv/(P-Pv))\n", + "so partial pressure of vapour(Pv)in bar\n", + "Pv in bar= 0.0254\n", + "relative humidity(phi)=(Pv/Pv_sat)\n", + "from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\n", + "so phi=Pv/Pv_sat 0.82\n", + "in percentage 81.99\n", + "so partial pressure of vapour=0.0254 bar\n", + "relative humidity=81.98 %\n" + ] + } + ], + "source": [ + "#cal of partial pressure of vapour and relative humidity\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.12, Page:448 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\")\n", + "omega=0.016;#specific humidity in gm/gm of air\n", + "print(\"here pressure of atmospheric air(P)may be taken as 1.013 bar\")\n", + "P=1.013;#pressure of atmospheric air in bar\n", + "print(\"specific humidity,omega=0.622*(Pv/(P-Pv))\")\n", + "print(\"so partial pressure of vapour(Pv)in bar\")\n", + "Pv=P/(1+(0.622/omega))\n", + "print(\"Pv in bar=\"),round(Pv,4)\n", + "Pv=0.0254;#approx.\n", + "print(\"relative humidity(phi)=(Pv/Pv_sat)\")\n", + "print(\"from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\")\n", + "Pv_sat=0.03098;\n", + "phi=Pv/Pv_sat\n", + "print(\"so phi=Pv/Pv_sat\"),round(phi,2)\n", + "print(\"in percentage\"),round(phi*100,2)\n", + "print(\"so partial pressure of vapour=0.0254 bar\")\n", + "print(\"relative humidity=81.98 %\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.13;pg no: 449" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.13, Page:449 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\n", + "at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\n", + "partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar 0.03\n", + "partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour 0.99\n", + "so partial pressure of air=0.9875 bar\n", + "humidity ratio,omega in kg/kg of dry air= 0.01606\n", + "so humidity ratio=0.01606 kg/kg of air\n", + "Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\n", + "so Dew point temperature=21.4 degree celcius\n", + "density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\n", + "rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\n", + "rho_m in kg/m^3= 1.1836\n", + "so density = 1.1835 kg/m^3\n", + "enthalpy of mixture,h in KJ/kg of dry air= 71.21\n", + "enthalpy of mixture =71.2 KJ/kg of dry air\n" + ] + } + ], + "source": [ + "#cal of partial pressure,humidity ratio,Dew point temperature,density and enthalpy of mixture\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.13, Page:449 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\")\n", + "r=0.6;#relative humidity\n", + "P=1.013;#total pressure of mixture in bar\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Ta=(30+273);#room temperature in K\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg degree celcius\n", + "print(\"at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\")\n", + "Pv_sat=0.0425;\n", + "Pv=r*Pv_sat\n", + "print(\"partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar\"),round(Pv,2)\n", + "Pa=P-Pv\n", + "print(\"partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour\"),round(Pa,2)\n", + "print(\"so partial pressure of air=0.9875 bar\")\n", + "omega=0.622*Pv/(P-Pv)\n", + "print(\"humidity ratio,omega in kg/kg of dry air=\"),round(omega,5)\n", + "print(\"so humidity ratio=0.01606 kg/kg of air\")\n", + "print(\"Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\")\n", + "print(\"so Dew point temperature=21.4 degree celcius\")\n", + "print(\"density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\")\n", + "print(\"rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\")\n", + "rho_m=P*100*(1+omega)/(R*Ta)\n", + "print(\"rho_m in kg/m^3=\"),round(rho_m,4)\n", + "print(\"so density = 1.1835 kg/m^3\")\n", + "T=30;#room temperature in degree celcius\n", + "hg=2540.1;#enthalpy at 30 degree celcius in KJ/kg\n", + "h=Cp*T+omega*(hg+1.860*(30-21.4))\n", + "print(\"enthalpy of mixture,h in KJ/kg of dry air=\"),round(h,2)\n", + "print(\"enthalpy of mixture =71.2 KJ/kg of dry air\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.14;pg no: 449" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.14, Page:449 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\n", + "initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\n", + "omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\n", + "mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\n", + "mass flow rate of air(ma)=0.8/v2 in kg/s\n", + "total mass of water added=ma*(omega2-omega1)in kg/s 0.001311\n", + "heat transferred in KJ/s= 12.18\n", + "so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\n" + ] + } + ], + "source": [ + "#cal of mass of water added and heat transferred\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.14, Page:449 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\")\n", + "print(\"initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\")\n", + "print(\"omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\")\n", + "omega1=0.0086;\n", + "h1=37.;\n", + "omega2=0.01;\n", + "h2=50.;\n", + "v2=0.854;\n", + "print(\"mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\")\n", + "omega2-omega1\n", + "print(\"mass flow rate of air(ma)=0.8/v2 in kg/s\")\n", + "ma=0.8/v2\n", + "print(\"total mass of water added=ma*(omega2-omega1)in kg/s\"),round(ma*(omega2-omega1),6)\n", + "print(\"heat transferred in KJ/s=\"),round(ma*(h2-h1),2)\n", + "print(\"so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.15;pg no: 451" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.15, Page:451 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\n", + "Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\n", + "For moist air stream at 30 degree celcius and 30% relative humidity.\n", + "phi1=Pv1/Pv_sat_30oc\n", + "here Pv_sat_30oc=0.04246 bar\n", + "so Pv1=phi1*Pv_sat_30oc in bar\n", + "corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\n", + "specific humidity,omega1 in kg/kg of air= 0.00792\n", + "at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\n", + "h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\n", + "for second moist air stream at 35oc and 85% relative humidity\n", + "phi2=Pv2/Pv_sat_35oc\n", + "here Pv_sat_35oc=0.005628 bar\n", + "so Pv2=phi2*Pv_sat_35oc in bar\n", + "specific humidity,omega2 in kg/kg of air= 0.00295\n", + "corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\n", + "so,enthalpy of second stream,\n", + "h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\n", + "enthalpy of mixture after adiabatic mixing,\n", + "=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\n", + "mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\n", + "specific humidity of mixture(omega)in kg/kg of dry air= 0.00592\n", + "omega=0.622*Pv/(P-Pv)\n", + "Pv in bar= 0.00956\n", + "partial pressure of water vapour=0.00957 bar\n", + "so specific humidity of mixture=0.00593 kg/kg dry air\n", + "and partial pressure of water vapour in mixture=0.00957 bar\n" + ] + } + ], + "source": [ + "#cal of specific humidity and partial pressure of water vapour in mixture\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.15, Page:451 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\")\n", + "P=1.013;#atmospheric pressure in bar\n", + "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", + "Cp_stream=1.86;#specific heat of stream at constant pressure in KJ/kg K\n", + "T1=30.;#temperature of first stream of moist air in K\n", + "m1=3.;#mass flow rate of first stream in kg/s \n", + "T2=35.;#temperature of second stream of moist air in K\n", + "m2=2.;#mass flow rate of second stream in kg/s \n", + "print(\"Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\")\n", + "print(\"For moist air stream at 30 degree celcius and 30% relative humidity.\")\n", + "phi1=0.3;\n", + "print(\"phi1=Pv1/Pv_sat_30oc\")\n", + "print(\"here Pv_sat_30oc=0.04246 bar\")\n", + "Pv_sat_30oc=0.04246;\n", + "print(\"so Pv1=phi1*Pv_sat_30oc in bar\")\n", + "Pv1=phi1*Pv_sat_30oc\n", + "print(\"corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\")\n", + "Tdp1=10.5;\n", + "omega1=0.622*Pv1/(P-Pv1)\n", + "print(\"specific humidity,omega1 in kg/kg of air=\"),round(omega1,5)\n", + "print(\"at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\")\n", + "hg=2520.7;#enthalpy at 10.5 degree celcius in KJ/kg\n", + "print(\"h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\")\n", + "h1=Cp_air*T1+omega1*(hg-Cp_stream*(T1-Tdp1))\n", + "print(\"for second moist air stream at 35oc and 85% relative humidity\")\n", + "phi2=0.85;\n", + "print(\"phi2=Pv2/Pv_sat_35oc\")\n", + "print(\"here Pv_sat_35oc=0.005628 bar\")\n", + "Pv_sat_35oc=0.005628;\n", + "print(\"so Pv2=phi2*Pv_sat_35oc in bar\")\n", + "Pv2=phi2*Pv_sat_35oc\n", + "omega2=0.622*Pv2/(P-Pv2)\n", + "print(\"specific humidity,omega2 in kg/kg of air=\"),round(omega2,5)\n", + "print(\"corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\")\n", + "Tdp2=32.;\n", + "print(\"so,enthalpy of second stream,\")\n", + "print(\"h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\")\n", + "hg=2559.9;#enthalpy at 32 degree celcius in KJ/kg\n", + "h2=Cp_air*T2+omega2*(hg+Cp_stream*(T2-Tdp2))\n", + "print(\"enthalpy of mixture after adiabatic mixing,\")\n", + "print(\"=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\")\n", + "(1./(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2)))\n", + "print(\"mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\")\n", + "(1./5.)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))\n", + "omega=0.00589/(1-0.005893)\n", + "print(\"specific humidity of mixture(omega)in kg/kg of dry air=\"),round(omega,5)\n", + "print(\"omega=0.622*Pv/(P-Pv)\")\n", + "Pv=omega*P/(omega+0.622)\n", + "print(\"Pv in bar=\"),round(Pv,5)\n", + "print(\"partial pressure of water vapour=0.00957 bar\")\n", + "print(\"so specific humidity of mixture=0.00593 kg/kg dry air\")\n", + "print(\"and partial pressure of water vapour in mixture=0.00957 bar\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.16;pg no: 452" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.16, Page:452 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\n", + "The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\n", + "h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\n", + "final state 2 has,h2=52 KJ/kg\n", + "mass of air(m)=m1/v1 in kg/s\n", + "amount of heat added(Q)in KJ/s\n", + "Q=m*(h2-h1) 56.78\n" + ] + } + ], + "source": [ + "#cal of amount of heat added\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.16, Page:452 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\")\n", + "m1=3;#rate at which moist air enter in heating coil in m^3/s\n", + "print(\"The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\")\n", + "print(\"h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\")\n", + "h1=36.4;\n", + "omega1=0.0086;\n", + "v1=0.825;\n", + "print(\"final state 2 has,h2=52 KJ/kg\")\n", + "h2=52;\n", + "print(\"mass of air(m)=m1/v1 in kg/s\")\n", + "m=m1/v1\n", + "m=3.64;#approx.\n", + "print(\"amount of heat added(Q)in KJ/s\")\n", + "Q=m*(h2-h1)\n", + "print(\"Q=m*(h2-h1)\"),round(Q,2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter11_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter11_1.ipynb new file mode 100755 index 00000000..31f593f0 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter11_1.ipynb @@ -0,0 +1,1309 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11:Introduction to refrigeration and Air Conditioning" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.1;pg no: 435" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.1, Page:435 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\n", + "for refrigerator working on reversed carnot cycle.\n", + "Q1/T1=Q2/T2\n", + "so Q2=Q1*T2/T1 in KJ/min\n", + "and work input required,W in KJ/min\n", + "W=Q2-Q1 83.66\n" + ] + } + ], + "source": [ + "#cal of work input\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.1, Page:435 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\")\n", + "T1=(-16.+273.);#temperature of refrigerated space in K\n", + "T2=(27.+273.);#temperature of atmosphere in K\n", + "Q1=500.;#heat extracted from refrigerated space in KJ/min\n", + "print(\"for refrigerator working on reversed carnot cycle.\")\n", + "print(\"Q1/T1=Q2/T2\")\n", + "print(\"so Q2=Q1*T2/T1 in KJ/min\")\n", + "Q2=Q1*T2/T1\n", + "print(\"and work input required,W in KJ/min\")\n", + "W=Q2-Q1\n", + "print(\"W=Q2-Q1\"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.2;pg no: 435" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.2, Page:435 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\n", + "refrigeration capacity or heat extraction rate(Q)in KJ/s\n", + "let the ice formation rate be m kg/s\n", + "heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\n", + "ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice= 6.25\n", + "COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\n", + "also COP=Q/W\n", + "so W=Q/COP in KJ/s\n", + "HP required 643.62\n", + "NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\n" + ] + } + ], + "source": [ + "#cal of HP required\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.2, Page:435 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\")\n", + "Q=800.;#refrigeration capacity in tons\n", + "Q_latent=335.;#latent heat for ice formation from water in KJ/kg\n", + "T1=(-7.+273.);#temperature of reservoir 1 in K\n", + "T2=(27.+273.);#temperature of reservoir 2 in K\n", + "print(\"refrigeration capacity or heat extraction rate(Q)in KJ/s\")\n", + "Q=Q*3.5\n", + "print(\"let the ice formation rate be m kg/s\")\n", + "print(\"heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\")\n", + "Q1=4.18*(27-0)+Q_latent\n", + "m=Q/Q1\n", + "print(\"ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice=\"),round(Q/Q1,2)\n", + "print(\"COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\")\n", + "COP=T1/(T2-T1)\n", + "print(\"also COP=Q/W\")\n", + "print(\"so W=Q/COP in KJ/s\")\n", + "W=Q/COP\n", + "W=W/0.7457\n", + "print(\"HP required\"),round(W/0.7457,2)\n", + "print(\"NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.3;pg no: 436" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.3, Page:436 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\n", + "COP=T1/(T2-T1)=Q/W 1.56\n", + "equating,COP=T1/(T2-T1)\n", + "so temperature of surrounding(T2)in K\n", + "T2= 403.69\n" + ] + } + ], + "source": [ + "#cal of COP and temperature of surrounding\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.3, Page:436 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\")\n", + "T1=(-27+273);#temperature of refrigerator in K\n", + "W=3*.7457;#work input in KJ/s\n", + "Q=1*3.5;#refrigeration effect in KJ/s\n", + "COP=Q/W\n", + "print(\"COP=T1/(T2-T1)=Q/W\"),round(COP,2)\n", + "COP=1.56;#approx.\n", + "print(\"equating,COP=T1/(T2-T1)\")\n", + "print(\"so temperature of surrounding(T2)in K\")\n", + "T2=T1+(T1/COP)\n", + "print(\"T2=\"),round(T2,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.4;pg no: 436" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.4, Page:436 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\n", + "during process 1-2_a\n", + "p2/p1=(T2_a/T1)^(y/(y-1))\n", + "so T2_a=T1*(p2/p1)^((y-1)/y)in K\n", + "theoretical temperature after compression,T2_a=440.18 K\n", + "for compression process,\n", + "n1=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+(T2_a-T1)/n1 in K\n", + "for expansion process,3-4_a\n", + "T4_a/T3=(p1/p2)^((y-1)/y)\n", + "so T4_a=T3*(p1/p2)^((y-1)/y) in K\n", + "n2=0.9=(T3-T4)/(T3-T4_a)\n", + "so T4=T3-(n2*(T3-T4_a))in K\n", + "so work during compression,W_C in KJ/s\n", + "W_C=m*Cp*(T2-T1)\n", + "work during expansion,W_T in KJ/s\n", + "W_T=m*Cp*(T3-T4)\n", + "refrigeration effect is realized during process,4-1.so refrigeration shall be,\n", + "Q_ref=m*Cp*(T1-T4) in KJ/s\n", + "Q_ref in ton 18.36\n", + "net work required(W)=W_C-W_T in KJ/s 111.59\n", + "COP= 0.58\n", + "so refrigeration capacity=18.36 ton or 64.26 KJ/s\n", + "and COP=0.57\n", + "NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\n" + ] + } + ], + "source": [ + "#cal of refrigeration capacity and COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.4, Page:436 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\")\n", + "T1=(-30.+273.);#temperature of air at beginning of compression in K\n", + "T3=(27.+273.);#temperature of air after cooling in K\n", + "r=8.;#pressure ratio\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "y=1.4;#expansion constant \n", + "m=1.;#air flow rate in kg/s\n", + "n1=0.85;#isentropic efficiency for compression process\n", + "n2=.9;#isentropic efficiency for expansion process\n", + "print(\"during process 1-2_a\")\n", + "print(\"p2/p1=(T2_a/T1)^(y/(y-1))\")\n", + "print(\"so T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", + "T2_a=T1*(r)**((y-1)/y)\n", + "print(\"theoretical temperature after compression,T2_a=440.18 K\")\n", + "print(\"for compression process,\")\n", + "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", + "T2=T1+(T2_a-T1)/n1\n", + "print(\"for expansion process,3-4_a\")\n", + "print(\"T4_a/T3=(p1/p2)^((y-1)/y)\")\n", + "print(\"so T4_a=T3*(p1/p2)^((y-1)/y) in K\")\n", + "T4_a=T3*(1/r)**((y-1)/y)\n", + "print(\"n2=0.9=(T3-T4)/(T3-T4_a)\")\n", + "print(\"so T4=T3-(n2*(T3-T4_a))in K\")\n", + "T4=T3-(n2*(T3-T4_a))\n", + "print(\"so work during compression,W_C in KJ/s\")\n", + "print(\"W_C=m*Cp*(T2-T1)\")\n", + "W_C=m*Cp*(T2-T1)\n", + "print(\"work during expansion,W_T in KJ/s\")\n", + "print(\"W_T=m*Cp*(T3-T4)\")\n", + "W_T=m*Cp*(T3-T4)\n", + "print(\"refrigeration effect is realized during process,4-1.so refrigeration shall be,\")\n", + "print(\"Q_ref=m*Cp*(T1-T4) in KJ/s\")\n", + "Q_ref=m*Cp*(T1-T4)\n", + "Q_ref=Q_ref/3.5\n", + "print(\"Q_ref in ton\"),round(Q_ref,2)\n", + "W=W_C-W_T\n", + "print(\"net work required(W)=W_C-W_T in KJ/s\"),round(W,2)\n", + "Q_ref=64.26;\n", + "COP=Q_ref/(W_C-W_T)\n", + "print(\"COP=\"),round(COP,2)\n", + "print(\"so refrigeration capacity=18.36 ton or 64.26 KJ/s\")\n", + "print(\"and COP=0.57\")\n", + "print(\"NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.5;pg no: 437" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.5, Page:437 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\n", + "for isentropic compression process:\n", + "(p2/p1)^((y-1)/y)=T2/T1\n", + "so T2=T1*(p2/p1)^((y-1)/y) in K\n", + "for isenropic expansion process:\n", + "(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\n", + "so T4=T3/(p2/p1)^((y-1)/y) in K\n", + "heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\n", + "refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\n", + "so net work(W)=Q23-Q41 in KJ/kg\n", + "so COP=refrigeration effect/net work= 1.71\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.5, Page:437 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\")\n", + "T1=(7+273);#temperature of refrigerated space in K\n", + "T3=(27+273);#temperature after compression in K\n", + "p1=1*10**5;#pressure of refrigerated space in pa\n", + "p2=5*10**5;#pressure after compression in pa\n", + "y=1.4;#expansion constant\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"for isentropic compression process:\")\n", + "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", + "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"for isenropic expansion process:\")\n", + "print(\"(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\")\n", + "print(\"so T4=T3/(p2/p1)^((y-1)/y) in K\")\n", + "T4=T3/(p2/p1)**((y-1)/y)\n", + "print(\"heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\")\n", + "Q23=Cp*(T2-T3)\n", + "print(\"refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\")\n", + "Q41=Cp*(T1-T4)\n", + "print(\"so net work(W)=Q23-Q41 in KJ/kg\")\n", + "W=Q23-Q41\n", + "COP=Q41/W\n", + "print(\"so COP=refrigeration effect/net work=\"),round(COP,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.6;pg no: 438" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.6, Page:438 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\n", + "for process 1-2\n", + "(p2/p1)^((y-1)/y)=T2/T1\n", + "so T2=T1*(p2/p1)^((y-1)/y) in K\n", + "for process 3-4\n", + "(p3/p4)^((y-1)/y)=T3/T4\n", + "so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\n", + "refrigeration capacity(Q) in KJ/s= 63.25\n", + "Q in ton\n", + "work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\n", + "w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\n", + "HP required to run compressor 177.86\n", + "so HP required to run compressor=177.86 hp\n", + "net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\n", + "COP=refrigeration capacity/work=Q/W 1.59\n" + ] + } + ], + "source": [ + "#cal of refrigeration capacity,HP required to run compressor,COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.6, Page:438 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\")\n", + "T1=(-10.+273.);#air entering temperature in K\n", + "p1=1.*10**5;#air entering pressure in pa\n", + "T3=(27.+273.);#compressed air temperature after cooling in K\n", + "p2=5.5*10**5;#pressure after compression in pa\n", + "m=0.8;#air flow rate in kg/s\n", + "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", + "y=1.4;#expansion constant\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"for process 1-2\")\n", + "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", + "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"for process 3-4\")\n", + "print(\"(p3/p4)^((y-1)/y)=T3/T4\")\n", + "print(\"so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\")\n", + "T4=T3/(p2/p1)**((y-1)/y)\n", + "Q=m*Cp*(T1-T4)\n", + "print(\"refrigeration capacity(Q) in KJ/s=\"),round(Q,2)\n", + "print(\"Q in ton\")\n", + "Q=Q/3.5\n", + "print(\"work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\")\n", + "print(\"w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\")\n", + "n=y;\n", + "w=(m*n)*R*(T2-T1)/(n-1)\n", + "print(\"HP required to run compressor\"),round(w/0.7457,2)\n", + "print(\"so HP required to run compressor=177.86 hp\")\n", + "print(\"net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\")\n", + "W=m*Cp*((T2-T3)-(T1-T4))\n", + "Q=63.25;#refrigeration capacity in KJ/s\n", + "COP=Q/W\n", + "print(\"COP=refrigeration capacity/work=Q/W\"),round(COP,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.7;pg no: 440" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.7, Page:440 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\n", + "for process 1-2,n=1.45\n", + "T2/T1=(p2/p1)^((n-1)/n)\n", + "so T2=T1*(p2/p1)^((n-1)/n) in K\n", + "for process 3-4,n=1.3\n", + "T4/T3=(p4/p3)^((n-1)/n)\n", + "so T4=T3*(p4/p3)^((n-1)/n)in K\n", + "refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\n", + "Q=m*Cp*(T5-T4)\n", + "m in kg/s= 0.55\n", + "so air mass flow rate in cabin=0.55 kg/s\n", + "let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\n", + "m1*Cp*(T8-T7)=m*Cp*(T2-T3)\n", + "during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\n", + "so T7=T6*(p7/p6)^((n-1)/n) in K\n", + "substituting T2,T3,T7,T8 and m in energy balance on intercooler,\n", + "m1=m*(T2-T3)/(T8-T7)in kg/s\n", + "total ram air mass flow rate=m+m1 in kg/s 2.11\n", + "ram air mass flow rate=2.12 kg/s\n", + "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\n", + "COP=refrigeration effect/work input=Q/W 0.485\n" + ] + } + ], + "source": [ + "#cal of air mass flow rate in cabin,ram air mass flow rate,COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.7, Page:440 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\")\n", + "p1=1.2*10**5;#pressure of ram air in pa\n", + "p6=p1;\n", + "T1=(15.+273.);#temperature of ram air in K\n", + "T6=T1;\n", + "p7=0.9*10**5;#pressure of ram air after expansion in pa\n", + "p3=4.*10**5;#pressure of ram air after compression in pa\n", + "p2=p3;\n", + "p4=1.*10**5;#pressure of ram air after expansion in second turbine in pa\n", + "T5=(25.+273.);#temperature of air when exhausted from cabin in K\n", + "T3=(50.+273.);#temperature of compressed air in K\n", + "T8=(30.+273.);#limited temperaure of ram air in K\n", + "Q=10.*3.5;#refrigeration capacity in KJ/s\n", + "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", + "print(\"for process 1-2,n=1.45\")\n", + "n=1.45;\n", + "print(\"T2/T1=(p2/p1)^((n-1)/n)\")\n", + "print(\"so T2=T1*(p2/p1)^((n-1)/n) in K\")\n", + "T2=T1*(p2/p1)**((n-1)/n)\n", + "print(\"for process 3-4,n=1.3\")\n", + "n=1.3;\n", + "print(\"T4/T3=(p4/p3)^((n-1)/n)\")\n", + "print(\"so T4=T3*(p4/p3)^((n-1)/n)in K\")\n", + "T4=T3*(p4/p3)**((n-1)/n)\n", + "print(\"refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\")\n", + "print(\"Q=m*Cp*(T5-T4)\")\n", + "m=Q/(Cp*(T5-T4))\n", + "print(\"m in kg/s=\"),round(m,2)\n", + "print(\"so air mass flow rate in cabin=0.55 kg/s\")\n", + "print(\"let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\")\n", + "print(\"m1*Cp*(T8-T7)=m*Cp*(T2-T3)\")\n", + "print(\"during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\")\n", + "print(\"so T7=T6*(p7/p6)^((n-1)/n) in K\")\n", + "T7=T6*(p7/p6)**((n-1)/n)\n", + "print(\"substituting T2,T3,T7,T8 and m in energy balance on intercooler,\")\n", + "print(\"m1=m*(T2-T3)/(T8-T7)in kg/s\")\n", + "m1=m*(T2-T3)/(T8-T7)\n", + "print(\"total ram air mass flow rate=m+m1 in kg/s\"),round(m+m1,2)\n", + "print(\"ram air mass flow rate=2.12 kg/s\")\n", + "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\")\n", + "m=0.55;#approx.\n", + "W=m*Cp*(T2-T1)\n", + "COP=Q/W\n", + "print(\"COP=refrigeration effect/work input=Q/W\"),round(Q/W,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.8;pg no: 441" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.8, Page:441 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\n", + "considering index of compression and expansion as 1.4\n", + "during ramming action,process 0-1,\n", + "T1/To=(p1/po)^((y-1)/y)\n", + "T1=To*(p1/po)^((y-1)/y)in K\n", + "during compression process 1-2_a\n", + "T2_a/T1=(p2/p1)^((y-1)/y)\n", + "T2_a=T1*(p2/p1)^((y-1)/y)in K\n", + "n1=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+(T2_a-T1)/n1 in K\n", + "In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\n", + "subsequently for 10 degree celcius temperature drop in evaporator,\n", + "T4=T3-10 in K\n", + "expansion in cooling turbine during process 4-5;\n", + "T5_a/T4=(p5/p4)^((y-1)/y)\n", + "T5_a=T4*(p5/p4)^((y-1)/y)in K\n", + "n2=(T4-T5)/(T4-T5_a)\n", + "T5=T4-(T4-T5_a)*n2 in K\n", + "let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\n", + "Q=m*Cp*(T6-T5)\n", + "so m=Q/(Cp*(T6-T5))in kg/s\n", + "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s 41.4\n", + "W in Hp\n", + "COP=refrigeration effect/work input=Q/W= 1.27\n", + "so COP=1.27\n", + "and HP required=55.48 hp\n" + ] + } + ], + "source": [ + "#cal of COP and HP required\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.8, Page:441 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\")\n", + "po=0.9*10**5;#atmospheric air pressure in pa\n", + "To=(3.+273.);#temperature of atmospheric air in K\n", + "p1=1.*10**5;#pressure due to ramming air in pa\n", + "p2=4.*10**5;#pressure when air leaves compressor in pa\n", + "p3=p2;\n", + "p4=p3;\n", + "p5=1.03*10**5;#pressure maintained in passenger cabin in pa\n", + "T6=(25.+273.);#temperature of air leaves cabin in K\n", + "Q=15.*3.5;#refrigeration capacity of aeroplane in KJ/s\n", + "n1=0.9;#isentropic efficiency of compressor\n", + "n2=0.8;#isentropic efficiency of turbine\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"considering index of compression and expansion as 1.4\")\n", + "y=1.4;\n", + "print(\"during ramming action,process 0-1,\")\n", + "print(\"T1/To=(p1/po)^((y-1)/y)\")\n", + "print(\"T1=To*(p1/po)^((y-1)/y)in K\")\n", + "T1=To*(p1/po)**((y-1)/y)\n", + "print(\"during compression process 1-2_a\")\n", + "print(\"T2_a/T1=(p2/p1)^((y-1)/y)\")\n", + "print(\"T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", + "T2_a=T1*(p2/p1)**((y-1)/y)\n", + "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", + "T2=T1+(T2_a-T1)/n1\n", + "print(\"In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\")\n", + "T3=0.34*T2\n", + "print(\"subsequently for 10 degree celcius temperature drop in evaporator,\")\n", + "print(\"T4=T3-10 in K\")\n", + "T4=T3-10\n", + "print(\"expansion in cooling turbine during process 4-5;\")\n", + "print(\"T5_a/T4=(p5/p4)^((y-1)/y)\")\n", + "print(\"T5_a=T4*(p5/p4)^((y-1)/y)in K\")\n", + "T5_a=T4*(p5/p4)**((y-1)/y)\n", + "print(\"n2=(T4-T5)/(T4-T5_a)\")\n", + "print(\"T5=T4-(T4-T5_a)*n2 in K\")\n", + "T5=T4-(T4-T5_a)*n2\n", + "print(\"let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\")\n", + "print(\"Q=m*Cp*(T6-T5)\")\n", + "print(\"so m=Q/(Cp*(T6-T5))in kg/s\")\n", + "m=Q/(Cp*(T6-T5))\n", + "W=m*Cp*(T2-T1)\n", + "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\"),round(W,2)\n", + "print(\"W in Hp\")\n", + "W=W/.7457\n", + "W=41.37;#work input to compressor in KJ/s\n", + "COP=Q/W\n", + "print(\"COP=refrigeration effect/work input=Q/W=\"),round(COP,2)\n", + "print(\"so COP=1.27\")\n", + "print(\"and HP required=55.48 hp\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.9;pg no: 443" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.9, Page:443 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\n", + "properties of NH3,\n", + "at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\n", + "and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\n", + "here work done,W=Area 1-2-3-9-1\n", + "refrigeration effect=Area 1-5-6-4-1\n", + "Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\n", + "so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\n", + "during throttling process between 3 and 4,h3=h4\n", + "(Area=3-11-7-3)=(Area 4-9-11-6-4)\n", + "(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\n", + "(Area 3-8-9)=(Area 4-6-7-8-4)\n", + "so (Area 4-6-7-8-4)=12.09 KJ/kg\n", + "also,(Area 4-6-7-8-4)=T1*(s4-s8)\n", + "so (s4-s8)in KJ/kg K=\n", + "also s3=s8=0.3386 KJ/kg K\n", + "so s4 in KJ/kg K=\n", + "also s1=s2=4.4809 KJ/kg K\n", + "refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\n", + "work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\n", + "so COP=refrigeration effect/work done= 5.94\n", + "so COP=5.94\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.9, Page:443 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\")\n", + "print(\"properties of NH3,\")\n", + "print(\"at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\")\n", + "T1=(-15+273);\n", + "h9=-54.51;\n", + "hg=1303.74;\n", + "s9=-0.2132;\n", + "sg=5.0536;\n", + "print(\"and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\")\n", + "T2=(25+273);\n", + "h3=99.94;\n", + "h2=1317.95;\n", + "s3=0.3386;\n", + "s2=4.4809;\n", + "print(\"here work done,W=Area 1-2-3-9-1\")\n", + "print(\"refrigeration effect=Area 1-5-6-4-1\")\n", + "print(\"Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\")\n", + "print(\"so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\")\n", + "h3-h9-T1*(s3-s9)\n", + "print(\"during throttling process between 3 and 4,h3=h4\")\n", + "print(\"(Area=3-11-7-3)=(Area 4-9-11-6-4)\")\n", + "print(\"(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\")\n", + "print(\"(Area 3-8-9)=(Area 4-6-7-8-4)\")\n", + "print(\"so (Area 4-6-7-8-4)=12.09 KJ/kg\")\n", + "print(\"also,(Area 4-6-7-8-4)=T1*(s4-s8)\")\n", + "print(\"so (s4-s8)in KJ/kg K=\")\n", + "12.09/T1\n", + "print(\"also s3=s8=0.3386 KJ/kg K\")\n", + "s8=s3;\n", + "print(\"so s4 in KJ/kg K=\")\n", + "s4=s8+12.09/T1\n", + "print(\"also s1=s2=4.4809 KJ/kg K\")\n", + "s1=s2;\n", + "print(\"refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\")\n", + "Q=T1*(s1-s4)\n", + "print(\"work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\")\n", + "W=12.09+((T2-T1)*(s1-s8))\n", + "COP=Q/W\n", + "print(\"so COP=refrigeration effect/work done=\"),round(COP,2)\n", + "print(\"so COP=5.94\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.10;pg no: 445" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.10, Page:445 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\n", + "properties of Freon-12,\n", + "at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\n", + "at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\n", + "during expansion(throttling)between 3 and 4\n", + "h3=h4=hf_40oc=74.53 KJ/kg=h4\n", + "process 1-2 is adiabatic compression so,\n", + "s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\n", + "at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\n", + "T2=313*exp((s1-sg)/Cpg)in K\n", + "so temperature after compression,T2=324.17 K\n", + "enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\n", + "compression work required,per kg(Wc)=h2-h1 in KJ/kg\n", + "refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\n", + "mass flow rate of refrigerant,m=Q/q in kg/s\n", + "COP=q/Wc 3.17452\n", + "volumetric efficiency of reciprocating compressor,given C=0.02\n", + "n_vol=1+C-C*(P2/P1)^(1/n)\n", + "let piston printlacement by V,m^3\n", + "mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\n", + "so V in cm^3= 569.43\n", + "so COP=3.175\n", + "and piston printlacement=569.45 cm^3\n" + ] + } + ], + "source": [ + "#cal of COP and piston printlacement\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.10, Page:445 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\")\n", + "Q=2.86*3.5;#refrigeration effect in KJ/s\n", + "N=1200;#compressor rpm\n", + "n=1.13;#compression index\n", + "print(\"properties of Freon-12,\")\n", + "print(\"at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\")\n", + "P1=1.51;\n", + "T1=(-20+273);\n", + "vg=0.1088;\n", + "h1=178.61;\n", + "s1=0.7082;\n", + "s2=s1;\n", + "print(\"at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\")\n", + "P2=9.61;\n", + "h3=74.53;\n", + "h4=h3;\n", + "hg=203.05;\n", + "sf=0.2716;\n", + "sg=0.682;\n", + "Cpf=0.976;\n", + "Cpg=0.747;\n", + "print(\"during expansion(throttling)between 3 and 4\")\n", + "print(\"h3=h4=hf_40oc=74.53 KJ/kg=h4\")\n", + "print(\"process 1-2 is adiabatic compression so,\")\n", + "print(\"s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\")\n", + "print(\"at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\")\n", + "print(\"T2=313*exp((s1-sg)/Cpg)in K\")\n", + "T2=313*math.exp((s1-sg)/Cpg)\n", + "print(\"so temperature after compression,T2=324.17 K\")\n", + "print(\"enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\")\n", + "h2=hg+Cpg*(T2-313)\n", + "print(\"compression work required,per kg(Wc)=h2-h1 in KJ/kg\")\n", + "Wc=h2-h1\n", + "print(\"refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\")\n", + "q=h1-h4\n", + "print(\"mass flow rate of refrigerant,m=Q/q in kg/s\")\n", + "m=Q/q\n", + "m=0.096;#approx.\n", + "COP=q/Wc\n", + "print(\"COP=q/Wc\"),round(COP,5)\n", + "print(\"volumetric efficiency of reciprocating compressor,given C=0.02\")\n", + "C=0.02;\n", + "print(\"n_vol=1+C-C*(P2/P1)^(1/n)\")\n", + "n_vol=1+C-C*(P2/P1)**(1/n)\n", + "print(\"let piston printlacement by V,m^3\")\n", + "print(\"mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\")\n", + "V=(m*60*vg)*10**6/(N*n_vol)\n", + "print(\"so V in cm^3=\"),round(V,2)\n", + "print(\"so COP=3.175\")\n", + "print(\"and piston printlacement=569.45 cm^3\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.11;pg no: 447" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.11, Page:447 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\n", + "properties of CO2,\n", + "at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\n", + "at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\n", + "processes of vapour compression cycle are shown on T-s diagram\n", + "1-2:isentropic compression process\n", + "2-3-4:condensation process\n", + "4-5:isenthalpic expansion process\n", + "5-1:refrigeration process in evaporator\n", + "h1=hg at -10oc=322.28 KJ/kg\n", + "at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\n", + "entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\n", + "entropy during isentropic process,s1=s2\n", + "at -10 degree celcius,s2=sf+x1*sfg\n", + "so x1=(s2-sf)/(sg-sf)\n", + "enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\n", + "h3=hf at 20oc=144.11 KJ/kg\n", + "since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\n", + "also,h4=h5=115.22 KJ/kg\n", + "refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\n", + "let refrigerant flow rate be m kg/s\n", + "refrigerant effect(Q)=m*q\n", + "m=Q/q in kg/s 0.01016\n", + "compressor work,Wc=h2-h1 in KJ/kg\n", + "COP=refrigeration effect per kg/compressor work per kg= 6.51\n", + "so COP=6.51,mass flow rate=0.01016 kg/s\n", + "NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \n" + ] + } + ], + "source": [ + "#cal of COP and mass flow rate\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.11, Page:447 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\")\n", + "Q=2;#refrigeration effect in KW\n", + "print(\"properties of CO2,\")\n", + "print(\"at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\")\n", + "T1=(20.+273.);#condensation temperature in K\n", + "P1=57.27;\n", + "h3=144.11;\n", + "hg=299.62;\n", + "sf=0.523;\n", + "sg_20oc=1.0527;\n", + "Cpf=2.889;\n", + "Cpg=2.135;\n", + "print(\"at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\")\n", + "T2=(-10+273);#evaporator temperature in K\n", + "P2=26.49;\n", + "vg=0.014;\n", + "hf=60.78;\n", + "h1=322.28;\n", + "sf=0.2381;\n", + "sg=1.2324;\n", + "print(\"processes of vapour compression cycle are shown on T-s diagram\")\n", + "print(\"1-2:isentropic compression process\")\n", + "print(\"2-3-4:condensation process\")\n", + "print(\"4-5:isenthalpic expansion process\")\n", + "print(\"5-1:refrigeration process in evaporator\")\n", + "print(\"h1=hg at -10oc=322.28 KJ/kg\")\n", + "print(\"at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\")\n", + "h2=hg+Cpg*(40.-20.)\n", + "print(\"entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\")\n", + "s2=sg_20oc+Cpg*math.log((273.+40.)/(273.+20.))\n", + "print(\"entropy during isentropic process,s1=s2\")\n", + "print(\"at -10 degree celcius,s2=sf+x1*sfg\")\n", + "print(\"so x1=(s2-sf)/(sg-sf)\")\n", + "x1=(s2-sf)/(sg-sf)\n", + "print(\"enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\")\n", + "h1=hf+x1*(h1-hf)\n", + "print(\"h3=hf at 20oc=144.11 KJ/kg\")\n", + "print(\"since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\")\n", + "h4=h3-Cpf*(20.-10.)\n", + "print(\"also,h4=h5=115.22 KJ/kg\")\n", + "h5=h4;\n", + "print(\"refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\")\n", + "q=(h1-h5)\n", + "print(\"let refrigerant flow rate be m kg/s\")\n", + "print(\"refrigerant effect(Q)=m*q\")\n", + "m=Q/q\n", + "print(\"m=Q/q in kg/s\"),round(m,5)\n", + "print(\"compressor work,Wc=h2-h1 in KJ/kg\")\n", + "Wc=h2-h1\n", + "COP=q/Wc\n", + "print(\"COP=refrigeration effect per kg/compressor work per kg=\"),round(COP,2)\n", + "print(\"so COP=6.51,mass flow rate=0.01016 kg/s\")\n", + "print(\"NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.12;pg no: 448" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.12, Page:448 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\n", + "here pressure of atmospheric air(P)may be taken as 1.013 bar\n", + "specific humidity,omega=0.622*(Pv/(P-Pv))\n", + "so partial pressure of vapour(Pv)in bar\n", + "Pv in bar= 0.0254\n", + "relative humidity(phi)=(Pv/Pv_sat)\n", + "from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\n", + "so phi=Pv/Pv_sat 0.82\n", + "in percentage 81.99\n", + "so partial pressure of vapour=0.0254 bar\n", + "relative humidity=81.98 %\n" + ] + } + ], + "source": [ + "#cal of partial pressure of vapour and relative humidity\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.12, Page:448 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\")\n", + "omega=0.016;#specific humidity in gm/gm of air\n", + "print(\"here pressure of atmospheric air(P)may be taken as 1.013 bar\")\n", + "P=1.013;#pressure of atmospheric air in bar\n", + "print(\"specific humidity,omega=0.622*(Pv/(P-Pv))\")\n", + "print(\"so partial pressure of vapour(Pv)in bar\")\n", + "Pv=P/(1+(0.622/omega))\n", + "print(\"Pv in bar=\"),round(Pv,4)\n", + "Pv=0.0254;#approx.\n", + "print(\"relative humidity(phi)=(Pv/Pv_sat)\")\n", + "print(\"from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\")\n", + "Pv_sat=0.03098;\n", + "phi=Pv/Pv_sat\n", + "print(\"so phi=Pv/Pv_sat\"),round(phi,2)\n", + "print(\"in percentage\"),round(phi*100,2)\n", + "print(\"so partial pressure of vapour=0.0254 bar\")\n", + "print(\"relative humidity=81.98 %\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.13;pg no: 449" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.13, Page:449 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\n", + "at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\n", + "partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar 0.03\n", + "partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour 0.99\n", + "so partial pressure of air=0.9875 bar\n", + "humidity ratio,omega in kg/kg of dry air= 0.01606\n", + "so humidity ratio=0.01606 kg/kg of air\n", + "Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\n", + "so Dew point temperature=21.4 degree celcius\n", + "density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\n", + "rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\n", + "rho_m in kg/m^3= 1.1836\n", + "so density = 1.1835 kg/m^3\n", + "enthalpy of mixture,h in KJ/kg of dry air= 71.21\n", + "enthalpy of mixture =71.2 KJ/kg of dry air\n" + ] + } + ], + "source": [ + "#cal of partial pressure,humidity ratio,Dew point temperature,density and enthalpy of mixture\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.13, Page:449 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\")\n", + "r=0.6;#relative humidity\n", + "P=1.013;#total pressure of mixture in bar\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Ta=(30+273);#room temperature in K\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg degree celcius\n", + "print(\"at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\")\n", + "Pv_sat=0.0425;\n", + "Pv=r*Pv_sat\n", + "print(\"partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar\"),round(Pv,2)\n", + "Pa=P-Pv\n", + "print(\"partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour\"),round(Pa,2)\n", + "print(\"so partial pressure of air=0.9875 bar\")\n", + "omega=0.622*Pv/(P-Pv)\n", + "print(\"humidity ratio,omega in kg/kg of dry air=\"),round(omega,5)\n", + "print(\"so humidity ratio=0.01606 kg/kg of air\")\n", + "print(\"Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\")\n", + "print(\"so Dew point temperature=21.4 degree celcius\")\n", + "print(\"density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\")\n", + "print(\"rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\")\n", + "rho_m=P*100*(1+omega)/(R*Ta)\n", + "print(\"rho_m in kg/m^3=\"),round(rho_m,4)\n", + "print(\"so density = 1.1835 kg/m^3\")\n", + "T=30;#room temperature in degree celcius\n", + "hg=2540.1;#enthalpy at 30 degree celcius in KJ/kg\n", + "h=Cp*T+omega*(hg+1.860*(30-21.4))\n", + "print(\"enthalpy of mixture,h in KJ/kg of dry air=\"),round(h,2)\n", + "print(\"enthalpy of mixture =71.2 KJ/kg of dry air\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.14;pg no: 449" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.14, Page:449 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\n", + "initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\n", + "omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\n", + "mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\n", + "mass flow rate of air(ma)=0.8/v2 in kg/s\n", + "total mass of water added=ma*(omega2-omega1)in kg/s 0.001311\n", + "heat transferred in KJ/s= 12.18\n", + "so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\n" + ] + } + ], + "source": [ + "#cal of mass of water added and heat transferred\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.14, Page:449 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\")\n", + "print(\"initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\")\n", + "print(\"omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\")\n", + "omega1=0.0086;\n", + "h1=37.;\n", + "omega2=0.01;\n", + "h2=50.;\n", + "v2=0.854;\n", + "print(\"mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\")\n", + "omega2-omega1\n", + "print(\"mass flow rate of air(ma)=0.8/v2 in kg/s\")\n", + "ma=0.8/v2\n", + "print(\"total mass of water added=ma*(omega2-omega1)in kg/s\"),round(ma*(omega2-omega1),6)\n", + "print(\"heat transferred in KJ/s=\"),round(ma*(h2-h1),2)\n", + "print(\"so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.15;pg no: 451" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.15, Page:451 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\n", + "Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\n", + "For moist air stream at 30 degree celcius and 30% relative humidity.\n", + "phi1=Pv1/Pv_sat_30oc\n", + "here Pv_sat_30oc=0.04246 bar\n", + "so Pv1=phi1*Pv_sat_30oc in bar\n", + "corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\n", + "specific humidity,omega1 in kg/kg of air= 0.00792\n", + "at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\n", + "h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\n", + "for second moist air stream at 35oc and 85% relative humidity\n", + "phi2=Pv2/Pv_sat_35oc\n", + "here Pv_sat_35oc=0.005628 bar\n", + "so Pv2=phi2*Pv_sat_35oc in bar\n", + "specific humidity,omega2 in kg/kg of air= 0.00295\n", + "corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\n", + "so,enthalpy of second stream,\n", + "h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\n", + "enthalpy of mixture after adiabatic mixing,\n", + "=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\n", + "mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\n", + "specific humidity of mixture(omega)in kg/kg of dry air= 0.00592\n", + "omega=0.622*Pv/(P-Pv)\n", + "Pv in bar= 0.00956\n", + "partial pressure of water vapour=0.00957 bar\n", + "so specific humidity of mixture=0.00593 kg/kg dry air\n", + "and partial pressure of water vapour in mixture=0.00957 bar\n" + ] + } + ], + "source": [ + "#cal of specific humidity and partial pressure of water vapour in mixture\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.15, Page:451 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\")\n", + "P=1.013;#atmospheric pressure in bar\n", + "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", + "Cp_stream=1.86;#specific heat of stream at constant pressure in KJ/kg K\n", + "T1=30.;#temperature of first stream of moist air in K\n", + "m1=3.;#mass flow rate of first stream in kg/s \n", + "T2=35.;#temperature of second stream of moist air in K\n", + "m2=2.;#mass flow rate of second stream in kg/s \n", + "print(\"Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\")\n", + "print(\"For moist air stream at 30 degree celcius and 30% relative humidity.\")\n", + "phi1=0.3;\n", + "print(\"phi1=Pv1/Pv_sat_30oc\")\n", + "print(\"here Pv_sat_30oc=0.04246 bar\")\n", + "Pv_sat_30oc=0.04246;\n", + "print(\"so Pv1=phi1*Pv_sat_30oc in bar\")\n", + "Pv1=phi1*Pv_sat_30oc\n", + "print(\"corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\")\n", + "Tdp1=10.5;\n", + "omega1=0.622*Pv1/(P-Pv1)\n", + "print(\"specific humidity,omega1 in kg/kg of air=\"),round(omega1,5)\n", + "print(\"at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\")\n", + "hg=2520.7;#enthalpy at 10.5 degree celcius in KJ/kg\n", + "print(\"h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\")\n", + "h1=Cp_air*T1+omega1*(hg-Cp_stream*(T1-Tdp1))\n", + "print(\"for second moist air stream at 35oc and 85% relative humidity\")\n", + "phi2=0.85;\n", + "print(\"phi2=Pv2/Pv_sat_35oc\")\n", + "print(\"here Pv_sat_35oc=0.005628 bar\")\n", + "Pv_sat_35oc=0.005628;\n", + "print(\"so Pv2=phi2*Pv_sat_35oc in bar\")\n", + "Pv2=phi2*Pv_sat_35oc\n", + "omega2=0.622*Pv2/(P-Pv2)\n", + "print(\"specific humidity,omega2 in kg/kg of air=\"),round(omega2,5)\n", + "print(\"corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\")\n", + "Tdp2=32.;\n", + "print(\"so,enthalpy of second stream,\")\n", + "print(\"h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\")\n", + "hg=2559.9;#enthalpy at 32 degree celcius in KJ/kg\n", + "h2=Cp_air*T2+omega2*(hg+Cp_stream*(T2-Tdp2))\n", + "print(\"enthalpy of mixture after adiabatic mixing,\")\n", + "print(\"=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\")\n", + "(1./(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2)))\n", + "print(\"mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\")\n", + "(1./5.)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))\n", + "omega=0.00589/(1-0.005893)\n", + "print(\"specific humidity of mixture(omega)in kg/kg of dry air=\"),round(omega,5)\n", + "print(\"omega=0.622*Pv/(P-Pv)\")\n", + "Pv=omega*P/(omega+0.622)\n", + "print(\"Pv in bar=\"),round(Pv,5)\n", + "print(\"partial pressure of water vapour=0.00957 bar\")\n", + "print(\"so specific humidity of mixture=0.00593 kg/kg dry air\")\n", + "print(\"and partial pressure of water vapour in mixture=0.00957 bar\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.16;pg no: 452" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.16, Page:452 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\n", + "The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\n", + "h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\n", + "final state 2 has,h2=52 KJ/kg\n", + "mass of air(m)=m1/v1 in kg/s\n", + "amount of heat added(Q)in KJ/s\n", + "Q=m*(h2-h1) 56.78\n" + ] + } + ], + "source": [ + "#cal of amount of heat added\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.16, Page:452 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\")\n", + "m1=3;#rate at which moist air enter in heating coil in m^3/s\n", + "print(\"The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\")\n", + "print(\"h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\")\n", + "h1=36.4;\n", + "omega1=0.0086;\n", + "v1=0.825;\n", + "print(\"final state 2 has,h2=52 KJ/kg\")\n", + "h2=52;\n", + "print(\"mass of air(m)=m1/v1 in kg/s\")\n", + "m=m1/v1\n", + "m=3.64;#approx.\n", + "print(\"amount of heat added(Q)in KJ/s\")\n", + "Q=m*(h2-h1)\n", + "print(\"Q=m*(h2-h1)\"),round(Q,2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter11_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter11_2.ipynb new file mode 100755 index 00000000..31f593f0 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter11_2.ipynb @@ -0,0 +1,1309 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11:Introduction to refrigeration and Air Conditioning" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.1;pg no: 435" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.1, Page:435 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\n", + "for refrigerator working on reversed carnot cycle.\n", + "Q1/T1=Q2/T2\n", + "so Q2=Q1*T2/T1 in KJ/min\n", + "and work input required,W in KJ/min\n", + "W=Q2-Q1 83.66\n" + ] + } + ], + "source": [ + "#cal of work input\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.1, Page:435 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\")\n", + "T1=(-16.+273.);#temperature of refrigerated space in K\n", + "T2=(27.+273.);#temperature of atmosphere in K\n", + "Q1=500.;#heat extracted from refrigerated space in KJ/min\n", + "print(\"for refrigerator working on reversed carnot cycle.\")\n", + "print(\"Q1/T1=Q2/T2\")\n", + "print(\"so Q2=Q1*T2/T1 in KJ/min\")\n", + "Q2=Q1*T2/T1\n", + "print(\"and work input required,W in KJ/min\")\n", + "W=Q2-Q1\n", + "print(\"W=Q2-Q1\"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.2;pg no: 435" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.2, Page:435 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\n", + "refrigeration capacity or heat extraction rate(Q)in KJ/s\n", + "let the ice formation rate be m kg/s\n", + "heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\n", + "ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice= 6.25\n", + "COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\n", + "also COP=Q/W\n", + "so W=Q/COP in KJ/s\n", + "HP required 643.62\n", + "NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\n" + ] + } + ], + "source": [ + "#cal of HP required\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.2, Page:435 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\")\n", + "Q=800.;#refrigeration capacity in tons\n", + "Q_latent=335.;#latent heat for ice formation from water in KJ/kg\n", + "T1=(-7.+273.);#temperature of reservoir 1 in K\n", + "T2=(27.+273.);#temperature of reservoir 2 in K\n", + "print(\"refrigeration capacity or heat extraction rate(Q)in KJ/s\")\n", + "Q=Q*3.5\n", + "print(\"let the ice formation rate be m kg/s\")\n", + "print(\"heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\")\n", + "Q1=4.18*(27-0)+Q_latent\n", + "m=Q/Q1\n", + "print(\"ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice=\"),round(Q/Q1,2)\n", + "print(\"COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\")\n", + "COP=T1/(T2-T1)\n", + "print(\"also COP=Q/W\")\n", + "print(\"so W=Q/COP in KJ/s\")\n", + "W=Q/COP\n", + "W=W/0.7457\n", + "print(\"HP required\"),round(W/0.7457,2)\n", + "print(\"NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.3;pg no: 436" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.3, Page:436 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\n", + "COP=T1/(T2-T1)=Q/W 1.56\n", + "equating,COP=T1/(T2-T1)\n", + "so temperature of surrounding(T2)in K\n", + "T2= 403.69\n" + ] + } + ], + "source": [ + "#cal of COP and temperature of surrounding\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.3, Page:436 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\")\n", + "T1=(-27+273);#temperature of refrigerator in K\n", + "W=3*.7457;#work input in KJ/s\n", + "Q=1*3.5;#refrigeration effect in KJ/s\n", + "COP=Q/W\n", + "print(\"COP=T1/(T2-T1)=Q/W\"),round(COP,2)\n", + "COP=1.56;#approx.\n", + "print(\"equating,COP=T1/(T2-T1)\")\n", + "print(\"so temperature of surrounding(T2)in K\")\n", + "T2=T1+(T1/COP)\n", + "print(\"T2=\"),round(T2,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.4;pg no: 436" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.4, Page:436 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\n", + "during process 1-2_a\n", + "p2/p1=(T2_a/T1)^(y/(y-1))\n", + "so T2_a=T1*(p2/p1)^((y-1)/y)in K\n", + "theoretical temperature after compression,T2_a=440.18 K\n", + "for compression process,\n", + "n1=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+(T2_a-T1)/n1 in K\n", + "for expansion process,3-4_a\n", + "T4_a/T3=(p1/p2)^((y-1)/y)\n", + "so T4_a=T3*(p1/p2)^((y-1)/y) in K\n", + "n2=0.9=(T3-T4)/(T3-T4_a)\n", + "so T4=T3-(n2*(T3-T4_a))in K\n", + "so work during compression,W_C in KJ/s\n", + "W_C=m*Cp*(T2-T1)\n", + "work during expansion,W_T in KJ/s\n", + "W_T=m*Cp*(T3-T4)\n", + "refrigeration effect is realized during process,4-1.so refrigeration shall be,\n", + "Q_ref=m*Cp*(T1-T4) in KJ/s\n", + "Q_ref in ton 18.36\n", + "net work required(W)=W_C-W_T in KJ/s 111.59\n", + "COP= 0.58\n", + "so refrigeration capacity=18.36 ton or 64.26 KJ/s\n", + "and COP=0.57\n", + "NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\n" + ] + } + ], + "source": [ + "#cal of refrigeration capacity and COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.4, Page:436 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\")\n", + "T1=(-30.+273.);#temperature of air at beginning of compression in K\n", + "T3=(27.+273.);#temperature of air after cooling in K\n", + "r=8.;#pressure ratio\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "y=1.4;#expansion constant \n", + "m=1.;#air flow rate in kg/s\n", + "n1=0.85;#isentropic efficiency for compression process\n", + "n2=.9;#isentropic efficiency for expansion process\n", + "print(\"during process 1-2_a\")\n", + "print(\"p2/p1=(T2_a/T1)^(y/(y-1))\")\n", + "print(\"so T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", + "T2_a=T1*(r)**((y-1)/y)\n", + "print(\"theoretical temperature after compression,T2_a=440.18 K\")\n", + "print(\"for compression process,\")\n", + "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", + "T2=T1+(T2_a-T1)/n1\n", + "print(\"for expansion process,3-4_a\")\n", + "print(\"T4_a/T3=(p1/p2)^((y-1)/y)\")\n", + "print(\"so T4_a=T3*(p1/p2)^((y-1)/y) in K\")\n", + "T4_a=T3*(1/r)**((y-1)/y)\n", + "print(\"n2=0.9=(T3-T4)/(T3-T4_a)\")\n", + "print(\"so T4=T3-(n2*(T3-T4_a))in K\")\n", + "T4=T3-(n2*(T3-T4_a))\n", + "print(\"so work during compression,W_C in KJ/s\")\n", + "print(\"W_C=m*Cp*(T2-T1)\")\n", + "W_C=m*Cp*(T2-T1)\n", + "print(\"work during expansion,W_T in KJ/s\")\n", + "print(\"W_T=m*Cp*(T3-T4)\")\n", + "W_T=m*Cp*(T3-T4)\n", + "print(\"refrigeration effect is realized during process,4-1.so refrigeration shall be,\")\n", + "print(\"Q_ref=m*Cp*(T1-T4) in KJ/s\")\n", + "Q_ref=m*Cp*(T1-T4)\n", + "Q_ref=Q_ref/3.5\n", + "print(\"Q_ref in ton\"),round(Q_ref,2)\n", + "W=W_C-W_T\n", + "print(\"net work required(W)=W_C-W_T in KJ/s\"),round(W,2)\n", + "Q_ref=64.26;\n", + "COP=Q_ref/(W_C-W_T)\n", + "print(\"COP=\"),round(COP,2)\n", + "print(\"so refrigeration capacity=18.36 ton or 64.26 KJ/s\")\n", + "print(\"and COP=0.57\")\n", + "print(\"NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.5;pg no: 437" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.5, Page:437 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\n", + "for isentropic compression process:\n", + "(p2/p1)^((y-1)/y)=T2/T1\n", + "so T2=T1*(p2/p1)^((y-1)/y) in K\n", + "for isenropic expansion process:\n", + "(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\n", + "so T4=T3/(p2/p1)^((y-1)/y) in K\n", + "heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\n", + "refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\n", + "so net work(W)=Q23-Q41 in KJ/kg\n", + "so COP=refrigeration effect/net work= 1.71\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.5, Page:437 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\")\n", + "T1=(7+273);#temperature of refrigerated space in K\n", + "T3=(27+273);#temperature after compression in K\n", + "p1=1*10**5;#pressure of refrigerated space in pa\n", + "p2=5*10**5;#pressure after compression in pa\n", + "y=1.4;#expansion constant\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"for isentropic compression process:\")\n", + "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", + "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"for isenropic expansion process:\")\n", + "print(\"(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\")\n", + "print(\"so T4=T3/(p2/p1)^((y-1)/y) in K\")\n", + "T4=T3/(p2/p1)**((y-1)/y)\n", + "print(\"heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\")\n", + "Q23=Cp*(T2-T3)\n", + "print(\"refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\")\n", + "Q41=Cp*(T1-T4)\n", + "print(\"so net work(W)=Q23-Q41 in KJ/kg\")\n", + "W=Q23-Q41\n", + "COP=Q41/W\n", + "print(\"so COP=refrigeration effect/net work=\"),round(COP,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.6;pg no: 438" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.6, Page:438 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\n", + "for process 1-2\n", + "(p2/p1)^((y-1)/y)=T2/T1\n", + "so T2=T1*(p2/p1)^((y-1)/y) in K\n", + "for process 3-4\n", + "(p3/p4)^((y-1)/y)=T3/T4\n", + "so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\n", + "refrigeration capacity(Q) in KJ/s= 63.25\n", + "Q in ton\n", + "work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\n", + "w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\n", + "HP required to run compressor 177.86\n", + "so HP required to run compressor=177.86 hp\n", + "net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\n", + "COP=refrigeration capacity/work=Q/W 1.59\n" + ] + } + ], + "source": [ + "#cal of refrigeration capacity,HP required to run compressor,COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.6, Page:438 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\")\n", + "T1=(-10.+273.);#air entering temperature in K\n", + "p1=1.*10**5;#air entering pressure in pa\n", + "T3=(27.+273.);#compressed air temperature after cooling in K\n", + "p2=5.5*10**5;#pressure after compression in pa\n", + "m=0.8;#air flow rate in kg/s\n", + "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", + "y=1.4;#expansion constant\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"for process 1-2\")\n", + "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", + "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"for process 3-4\")\n", + "print(\"(p3/p4)^((y-1)/y)=T3/T4\")\n", + "print(\"so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\")\n", + "T4=T3/(p2/p1)**((y-1)/y)\n", + "Q=m*Cp*(T1-T4)\n", + "print(\"refrigeration capacity(Q) in KJ/s=\"),round(Q,2)\n", + "print(\"Q in ton\")\n", + "Q=Q/3.5\n", + "print(\"work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\")\n", + "print(\"w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\")\n", + "n=y;\n", + "w=(m*n)*R*(T2-T1)/(n-1)\n", + "print(\"HP required to run compressor\"),round(w/0.7457,2)\n", + "print(\"so HP required to run compressor=177.86 hp\")\n", + "print(\"net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\")\n", + "W=m*Cp*((T2-T3)-(T1-T4))\n", + "Q=63.25;#refrigeration capacity in KJ/s\n", + "COP=Q/W\n", + "print(\"COP=refrigeration capacity/work=Q/W\"),round(COP,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.7;pg no: 440" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.7, Page:440 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\n", + "for process 1-2,n=1.45\n", + "T2/T1=(p2/p1)^((n-1)/n)\n", + "so T2=T1*(p2/p1)^((n-1)/n) in K\n", + "for process 3-4,n=1.3\n", + "T4/T3=(p4/p3)^((n-1)/n)\n", + "so T4=T3*(p4/p3)^((n-1)/n)in K\n", + "refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\n", + "Q=m*Cp*(T5-T4)\n", + "m in kg/s= 0.55\n", + "so air mass flow rate in cabin=0.55 kg/s\n", + "let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\n", + "m1*Cp*(T8-T7)=m*Cp*(T2-T3)\n", + "during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\n", + "so T7=T6*(p7/p6)^((n-1)/n) in K\n", + "substituting T2,T3,T7,T8 and m in energy balance on intercooler,\n", + "m1=m*(T2-T3)/(T8-T7)in kg/s\n", + "total ram air mass flow rate=m+m1 in kg/s 2.11\n", + "ram air mass flow rate=2.12 kg/s\n", + "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\n", + "COP=refrigeration effect/work input=Q/W 0.485\n" + ] + } + ], + "source": [ + "#cal of air mass flow rate in cabin,ram air mass flow rate,COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.7, Page:440 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\")\n", + "p1=1.2*10**5;#pressure of ram air in pa\n", + "p6=p1;\n", + "T1=(15.+273.);#temperature of ram air in K\n", + "T6=T1;\n", + "p7=0.9*10**5;#pressure of ram air after expansion in pa\n", + "p3=4.*10**5;#pressure of ram air after compression in pa\n", + "p2=p3;\n", + "p4=1.*10**5;#pressure of ram air after expansion in second turbine in pa\n", + "T5=(25.+273.);#temperature of air when exhausted from cabin in K\n", + "T3=(50.+273.);#temperature of compressed air in K\n", + "T8=(30.+273.);#limited temperaure of ram air in K\n", + "Q=10.*3.5;#refrigeration capacity in KJ/s\n", + "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", + "print(\"for process 1-2,n=1.45\")\n", + "n=1.45;\n", + "print(\"T2/T1=(p2/p1)^((n-1)/n)\")\n", + "print(\"so T2=T1*(p2/p1)^((n-1)/n) in K\")\n", + "T2=T1*(p2/p1)**((n-1)/n)\n", + "print(\"for process 3-4,n=1.3\")\n", + "n=1.3;\n", + "print(\"T4/T3=(p4/p3)^((n-1)/n)\")\n", + "print(\"so T4=T3*(p4/p3)^((n-1)/n)in K\")\n", + "T4=T3*(p4/p3)**((n-1)/n)\n", + "print(\"refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\")\n", + "print(\"Q=m*Cp*(T5-T4)\")\n", + "m=Q/(Cp*(T5-T4))\n", + "print(\"m in kg/s=\"),round(m,2)\n", + "print(\"so air mass flow rate in cabin=0.55 kg/s\")\n", + "print(\"let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\")\n", + "print(\"m1*Cp*(T8-T7)=m*Cp*(T2-T3)\")\n", + "print(\"during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\")\n", + "print(\"so T7=T6*(p7/p6)^((n-1)/n) in K\")\n", + "T7=T6*(p7/p6)**((n-1)/n)\n", + "print(\"substituting T2,T3,T7,T8 and m in energy balance on intercooler,\")\n", + "print(\"m1=m*(T2-T3)/(T8-T7)in kg/s\")\n", + "m1=m*(T2-T3)/(T8-T7)\n", + "print(\"total ram air mass flow rate=m+m1 in kg/s\"),round(m+m1,2)\n", + "print(\"ram air mass flow rate=2.12 kg/s\")\n", + "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\")\n", + "m=0.55;#approx.\n", + "W=m*Cp*(T2-T1)\n", + "COP=Q/W\n", + "print(\"COP=refrigeration effect/work input=Q/W\"),round(Q/W,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.8;pg no: 441" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.8, Page:441 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\n", + "considering index of compression and expansion as 1.4\n", + "during ramming action,process 0-1,\n", + "T1/To=(p1/po)^((y-1)/y)\n", + "T1=To*(p1/po)^((y-1)/y)in K\n", + "during compression process 1-2_a\n", + "T2_a/T1=(p2/p1)^((y-1)/y)\n", + "T2_a=T1*(p2/p1)^((y-1)/y)in K\n", + "n1=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+(T2_a-T1)/n1 in K\n", + "In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\n", + "subsequently for 10 degree celcius temperature drop in evaporator,\n", + "T4=T3-10 in K\n", + "expansion in cooling turbine during process 4-5;\n", + "T5_a/T4=(p5/p4)^((y-1)/y)\n", + "T5_a=T4*(p5/p4)^((y-1)/y)in K\n", + "n2=(T4-T5)/(T4-T5_a)\n", + "T5=T4-(T4-T5_a)*n2 in K\n", + "let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\n", + "Q=m*Cp*(T6-T5)\n", + "so m=Q/(Cp*(T6-T5))in kg/s\n", + "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s 41.4\n", + "W in Hp\n", + "COP=refrigeration effect/work input=Q/W= 1.27\n", + "so COP=1.27\n", + "and HP required=55.48 hp\n" + ] + } + ], + "source": [ + "#cal of COP and HP required\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.8, Page:441 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\")\n", + "po=0.9*10**5;#atmospheric air pressure in pa\n", + "To=(3.+273.);#temperature of atmospheric air in K\n", + "p1=1.*10**5;#pressure due to ramming air in pa\n", + "p2=4.*10**5;#pressure when air leaves compressor in pa\n", + "p3=p2;\n", + "p4=p3;\n", + "p5=1.03*10**5;#pressure maintained in passenger cabin in pa\n", + "T6=(25.+273.);#temperature of air leaves cabin in K\n", + "Q=15.*3.5;#refrigeration capacity of aeroplane in KJ/s\n", + "n1=0.9;#isentropic efficiency of compressor\n", + "n2=0.8;#isentropic efficiency of turbine\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"considering index of compression and expansion as 1.4\")\n", + "y=1.4;\n", + "print(\"during ramming action,process 0-1,\")\n", + "print(\"T1/To=(p1/po)^((y-1)/y)\")\n", + "print(\"T1=To*(p1/po)^((y-1)/y)in K\")\n", + "T1=To*(p1/po)**((y-1)/y)\n", + "print(\"during compression process 1-2_a\")\n", + "print(\"T2_a/T1=(p2/p1)^((y-1)/y)\")\n", + "print(\"T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", + "T2_a=T1*(p2/p1)**((y-1)/y)\n", + "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", + "T2=T1+(T2_a-T1)/n1\n", + "print(\"In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\")\n", + "T3=0.34*T2\n", + "print(\"subsequently for 10 degree celcius temperature drop in evaporator,\")\n", + "print(\"T4=T3-10 in K\")\n", + "T4=T3-10\n", + "print(\"expansion in cooling turbine during process 4-5;\")\n", + "print(\"T5_a/T4=(p5/p4)^((y-1)/y)\")\n", + "print(\"T5_a=T4*(p5/p4)^((y-1)/y)in K\")\n", + "T5_a=T4*(p5/p4)**((y-1)/y)\n", + "print(\"n2=(T4-T5)/(T4-T5_a)\")\n", + "print(\"T5=T4-(T4-T5_a)*n2 in K\")\n", + "T5=T4-(T4-T5_a)*n2\n", + "print(\"let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\")\n", + "print(\"Q=m*Cp*(T6-T5)\")\n", + "print(\"so m=Q/(Cp*(T6-T5))in kg/s\")\n", + "m=Q/(Cp*(T6-T5))\n", + "W=m*Cp*(T2-T1)\n", + "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\"),round(W,2)\n", + "print(\"W in Hp\")\n", + "W=W/.7457\n", + "W=41.37;#work input to compressor in KJ/s\n", + "COP=Q/W\n", + "print(\"COP=refrigeration effect/work input=Q/W=\"),round(COP,2)\n", + "print(\"so COP=1.27\")\n", + "print(\"and HP required=55.48 hp\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.9;pg no: 443" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.9, Page:443 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\n", + "properties of NH3,\n", + "at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\n", + "and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\n", + "here work done,W=Area 1-2-3-9-1\n", + "refrigeration effect=Area 1-5-6-4-1\n", + "Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\n", + "so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\n", + "during throttling process between 3 and 4,h3=h4\n", + "(Area=3-11-7-3)=(Area 4-9-11-6-4)\n", + "(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\n", + "(Area 3-8-9)=(Area 4-6-7-8-4)\n", + "so (Area 4-6-7-8-4)=12.09 KJ/kg\n", + "also,(Area 4-6-7-8-4)=T1*(s4-s8)\n", + "so (s4-s8)in KJ/kg K=\n", + "also s3=s8=0.3386 KJ/kg K\n", + "so s4 in KJ/kg K=\n", + "also s1=s2=4.4809 KJ/kg K\n", + "refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\n", + "work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\n", + "so COP=refrigeration effect/work done= 5.94\n", + "so COP=5.94\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.9, Page:443 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\")\n", + "print(\"properties of NH3,\")\n", + "print(\"at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\")\n", + "T1=(-15+273);\n", + "h9=-54.51;\n", + "hg=1303.74;\n", + "s9=-0.2132;\n", + "sg=5.0536;\n", + "print(\"and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\")\n", + "T2=(25+273);\n", + "h3=99.94;\n", + "h2=1317.95;\n", + "s3=0.3386;\n", + "s2=4.4809;\n", + "print(\"here work done,W=Area 1-2-3-9-1\")\n", + "print(\"refrigeration effect=Area 1-5-6-4-1\")\n", + "print(\"Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\")\n", + "print(\"so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\")\n", + "h3-h9-T1*(s3-s9)\n", + "print(\"during throttling process between 3 and 4,h3=h4\")\n", + "print(\"(Area=3-11-7-3)=(Area 4-9-11-6-4)\")\n", + "print(\"(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\")\n", + "print(\"(Area 3-8-9)=(Area 4-6-7-8-4)\")\n", + "print(\"so (Area 4-6-7-8-4)=12.09 KJ/kg\")\n", + "print(\"also,(Area 4-6-7-8-4)=T1*(s4-s8)\")\n", + "print(\"so (s4-s8)in KJ/kg K=\")\n", + "12.09/T1\n", + "print(\"also s3=s8=0.3386 KJ/kg K\")\n", + "s8=s3;\n", + "print(\"so s4 in KJ/kg K=\")\n", + "s4=s8+12.09/T1\n", + "print(\"also s1=s2=4.4809 KJ/kg K\")\n", + "s1=s2;\n", + "print(\"refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\")\n", + "Q=T1*(s1-s4)\n", + "print(\"work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\")\n", + "W=12.09+((T2-T1)*(s1-s8))\n", + "COP=Q/W\n", + "print(\"so COP=refrigeration effect/work done=\"),round(COP,2)\n", + "print(\"so COP=5.94\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.10;pg no: 445" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.10, Page:445 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\n", + "properties of Freon-12,\n", + "at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\n", + "at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\n", + "during expansion(throttling)between 3 and 4\n", + "h3=h4=hf_40oc=74.53 KJ/kg=h4\n", + "process 1-2 is adiabatic compression so,\n", + "s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\n", + "at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\n", + "T2=313*exp((s1-sg)/Cpg)in K\n", + "so temperature after compression,T2=324.17 K\n", + "enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\n", + "compression work required,per kg(Wc)=h2-h1 in KJ/kg\n", + "refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\n", + "mass flow rate of refrigerant,m=Q/q in kg/s\n", + "COP=q/Wc 3.17452\n", + "volumetric efficiency of reciprocating compressor,given C=0.02\n", + "n_vol=1+C-C*(P2/P1)^(1/n)\n", + "let piston printlacement by V,m^3\n", + "mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\n", + "so V in cm^3= 569.43\n", + "so COP=3.175\n", + "and piston printlacement=569.45 cm^3\n" + ] + } + ], + "source": [ + "#cal of COP and piston printlacement\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.10, Page:445 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\")\n", + "Q=2.86*3.5;#refrigeration effect in KJ/s\n", + "N=1200;#compressor rpm\n", + "n=1.13;#compression index\n", + "print(\"properties of Freon-12,\")\n", + "print(\"at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\")\n", + "P1=1.51;\n", + "T1=(-20+273);\n", + "vg=0.1088;\n", + "h1=178.61;\n", + "s1=0.7082;\n", + "s2=s1;\n", + "print(\"at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\")\n", + "P2=9.61;\n", + "h3=74.53;\n", + "h4=h3;\n", + "hg=203.05;\n", + "sf=0.2716;\n", + "sg=0.682;\n", + "Cpf=0.976;\n", + "Cpg=0.747;\n", + "print(\"during expansion(throttling)between 3 and 4\")\n", + "print(\"h3=h4=hf_40oc=74.53 KJ/kg=h4\")\n", + "print(\"process 1-2 is adiabatic compression so,\")\n", + "print(\"s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\")\n", + "print(\"at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\")\n", + "print(\"T2=313*exp((s1-sg)/Cpg)in K\")\n", + "T2=313*math.exp((s1-sg)/Cpg)\n", + "print(\"so temperature after compression,T2=324.17 K\")\n", + "print(\"enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\")\n", + "h2=hg+Cpg*(T2-313)\n", + "print(\"compression work required,per kg(Wc)=h2-h1 in KJ/kg\")\n", + "Wc=h2-h1\n", + "print(\"refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\")\n", + "q=h1-h4\n", + "print(\"mass flow rate of refrigerant,m=Q/q in kg/s\")\n", + "m=Q/q\n", + "m=0.096;#approx.\n", + "COP=q/Wc\n", + "print(\"COP=q/Wc\"),round(COP,5)\n", + "print(\"volumetric efficiency of reciprocating compressor,given C=0.02\")\n", + "C=0.02;\n", + "print(\"n_vol=1+C-C*(P2/P1)^(1/n)\")\n", + "n_vol=1+C-C*(P2/P1)**(1/n)\n", + "print(\"let piston printlacement by V,m^3\")\n", + "print(\"mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\")\n", + "V=(m*60*vg)*10**6/(N*n_vol)\n", + "print(\"so V in cm^3=\"),round(V,2)\n", + "print(\"so COP=3.175\")\n", + "print(\"and piston printlacement=569.45 cm^3\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.11;pg no: 447" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.11, Page:447 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\n", + "properties of CO2,\n", + "at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\n", + "at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\n", + "processes of vapour compression cycle are shown on T-s diagram\n", + "1-2:isentropic compression process\n", + "2-3-4:condensation process\n", + "4-5:isenthalpic expansion process\n", + "5-1:refrigeration process in evaporator\n", + "h1=hg at -10oc=322.28 KJ/kg\n", + "at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\n", + "entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\n", + "entropy during isentropic process,s1=s2\n", + "at -10 degree celcius,s2=sf+x1*sfg\n", + "so x1=(s2-sf)/(sg-sf)\n", + "enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\n", + "h3=hf at 20oc=144.11 KJ/kg\n", + "since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\n", + "also,h4=h5=115.22 KJ/kg\n", + "refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\n", + "let refrigerant flow rate be m kg/s\n", + "refrigerant effect(Q)=m*q\n", + "m=Q/q in kg/s 0.01016\n", + "compressor work,Wc=h2-h1 in KJ/kg\n", + "COP=refrigeration effect per kg/compressor work per kg= 6.51\n", + "so COP=6.51,mass flow rate=0.01016 kg/s\n", + "NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \n" + ] + } + ], + "source": [ + "#cal of COP and mass flow rate\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.11, Page:447 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\")\n", + "Q=2;#refrigeration effect in KW\n", + "print(\"properties of CO2,\")\n", + "print(\"at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\")\n", + "T1=(20.+273.);#condensation temperature in K\n", + "P1=57.27;\n", + "h3=144.11;\n", + "hg=299.62;\n", + "sf=0.523;\n", + "sg_20oc=1.0527;\n", + "Cpf=2.889;\n", + "Cpg=2.135;\n", + "print(\"at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\")\n", + "T2=(-10+273);#evaporator temperature in K\n", + "P2=26.49;\n", + "vg=0.014;\n", + "hf=60.78;\n", + "h1=322.28;\n", + "sf=0.2381;\n", + "sg=1.2324;\n", + "print(\"processes of vapour compression cycle are shown on T-s diagram\")\n", + "print(\"1-2:isentropic compression process\")\n", + "print(\"2-3-4:condensation process\")\n", + "print(\"4-5:isenthalpic expansion process\")\n", + "print(\"5-1:refrigeration process in evaporator\")\n", + "print(\"h1=hg at -10oc=322.28 KJ/kg\")\n", + "print(\"at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\")\n", + "h2=hg+Cpg*(40.-20.)\n", + "print(\"entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\")\n", + "s2=sg_20oc+Cpg*math.log((273.+40.)/(273.+20.))\n", + "print(\"entropy during isentropic process,s1=s2\")\n", + "print(\"at -10 degree celcius,s2=sf+x1*sfg\")\n", + "print(\"so x1=(s2-sf)/(sg-sf)\")\n", + "x1=(s2-sf)/(sg-sf)\n", + "print(\"enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\")\n", + "h1=hf+x1*(h1-hf)\n", + "print(\"h3=hf at 20oc=144.11 KJ/kg\")\n", + "print(\"since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\")\n", + "h4=h3-Cpf*(20.-10.)\n", + "print(\"also,h4=h5=115.22 KJ/kg\")\n", + "h5=h4;\n", + "print(\"refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\")\n", + "q=(h1-h5)\n", + "print(\"let refrigerant flow rate be m kg/s\")\n", + "print(\"refrigerant effect(Q)=m*q\")\n", + "m=Q/q\n", + "print(\"m=Q/q in kg/s\"),round(m,5)\n", + "print(\"compressor work,Wc=h2-h1 in KJ/kg\")\n", + "Wc=h2-h1\n", + "COP=q/Wc\n", + "print(\"COP=refrigeration effect per kg/compressor work per kg=\"),round(COP,2)\n", + "print(\"so COP=6.51,mass flow rate=0.01016 kg/s\")\n", + "print(\"NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.12;pg no: 448" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.12, Page:448 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\n", + "here pressure of atmospheric air(P)may be taken as 1.013 bar\n", + "specific humidity,omega=0.622*(Pv/(P-Pv))\n", + "so partial pressure of vapour(Pv)in bar\n", + "Pv in bar= 0.0254\n", + "relative humidity(phi)=(Pv/Pv_sat)\n", + "from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\n", + "so phi=Pv/Pv_sat 0.82\n", + "in percentage 81.99\n", + "so partial pressure of vapour=0.0254 bar\n", + "relative humidity=81.98 %\n" + ] + } + ], + "source": [ + "#cal of partial pressure of vapour and relative humidity\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.12, Page:448 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\")\n", + "omega=0.016;#specific humidity in gm/gm of air\n", + "print(\"here pressure of atmospheric air(P)may be taken as 1.013 bar\")\n", + "P=1.013;#pressure of atmospheric air in bar\n", + "print(\"specific humidity,omega=0.622*(Pv/(P-Pv))\")\n", + "print(\"so partial pressure of vapour(Pv)in bar\")\n", + "Pv=P/(1+(0.622/omega))\n", + "print(\"Pv in bar=\"),round(Pv,4)\n", + "Pv=0.0254;#approx.\n", + "print(\"relative humidity(phi)=(Pv/Pv_sat)\")\n", + "print(\"from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\")\n", + "Pv_sat=0.03098;\n", + "phi=Pv/Pv_sat\n", + "print(\"so phi=Pv/Pv_sat\"),round(phi,2)\n", + "print(\"in percentage\"),round(phi*100,2)\n", + "print(\"so partial pressure of vapour=0.0254 bar\")\n", + "print(\"relative humidity=81.98 %\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.13;pg no: 449" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.13, Page:449 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\n", + "at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\n", + "partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar 0.03\n", + "partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour 0.99\n", + "so partial pressure of air=0.9875 bar\n", + "humidity ratio,omega in kg/kg of dry air= 0.01606\n", + "so humidity ratio=0.01606 kg/kg of air\n", + "Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\n", + "so Dew point temperature=21.4 degree celcius\n", + "density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\n", + "rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\n", + "rho_m in kg/m^3= 1.1836\n", + "so density = 1.1835 kg/m^3\n", + "enthalpy of mixture,h in KJ/kg of dry air= 71.21\n", + "enthalpy of mixture =71.2 KJ/kg of dry air\n" + ] + } + ], + "source": [ + "#cal of partial pressure,humidity ratio,Dew point temperature,density and enthalpy of mixture\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.13, Page:449 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\")\n", + "r=0.6;#relative humidity\n", + "P=1.013;#total pressure of mixture in bar\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Ta=(30+273);#room temperature in K\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg degree celcius\n", + "print(\"at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\")\n", + "Pv_sat=0.0425;\n", + "Pv=r*Pv_sat\n", + "print(\"partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar\"),round(Pv,2)\n", + "Pa=P-Pv\n", + "print(\"partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour\"),round(Pa,2)\n", + "print(\"so partial pressure of air=0.9875 bar\")\n", + "omega=0.622*Pv/(P-Pv)\n", + "print(\"humidity ratio,omega in kg/kg of dry air=\"),round(omega,5)\n", + "print(\"so humidity ratio=0.01606 kg/kg of air\")\n", + "print(\"Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\")\n", + "print(\"so Dew point temperature=21.4 degree celcius\")\n", + "print(\"density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\")\n", + "print(\"rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\")\n", + "rho_m=P*100*(1+omega)/(R*Ta)\n", + "print(\"rho_m in kg/m^3=\"),round(rho_m,4)\n", + "print(\"so density = 1.1835 kg/m^3\")\n", + "T=30;#room temperature in degree celcius\n", + "hg=2540.1;#enthalpy at 30 degree celcius in KJ/kg\n", + "h=Cp*T+omega*(hg+1.860*(30-21.4))\n", + "print(\"enthalpy of mixture,h in KJ/kg of dry air=\"),round(h,2)\n", + "print(\"enthalpy of mixture =71.2 KJ/kg of dry air\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.14;pg no: 449" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.14, Page:449 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\n", + "initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\n", + "omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\n", + "mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\n", + "mass flow rate of air(ma)=0.8/v2 in kg/s\n", + "total mass of water added=ma*(omega2-omega1)in kg/s 0.001311\n", + "heat transferred in KJ/s= 12.18\n", + "so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\n" + ] + } + ], + "source": [ + "#cal of mass of water added and heat transferred\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.14, Page:449 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\")\n", + "print(\"initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\")\n", + "print(\"omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\")\n", + "omega1=0.0086;\n", + "h1=37.;\n", + "omega2=0.01;\n", + "h2=50.;\n", + "v2=0.854;\n", + "print(\"mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\")\n", + "omega2-omega1\n", + "print(\"mass flow rate of air(ma)=0.8/v2 in kg/s\")\n", + "ma=0.8/v2\n", + "print(\"total mass of water added=ma*(omega2-omega1)in kg/s\"),round(ma*(omega2-omega1),6)\n", + "print(\"heat transferred in KJ/s=\"),round(ma*(h2-h1),2)\n", + "print(\"so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.15;pg no: 451" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.15, Page:451 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\n", + "Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\n", + "For moist air stream at 30 degree celcius and 30% relative humidity.\n", + "phi1=Pv1/Pv_sat_30oc\n", + "here Pv_sat_30oc=0.04246 bar\n", + "so Pv1=phi1*Pv_sat_30oc in bar\n", + "corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\n", + "specific humidity,omega1 in kg/kg of air= 0.00792\n", + "at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\n", + "h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\n", + "for second moist air stream at 35oc and 85% relative humidity\n", + "phi2=Pv2/Pv_sat_35oc\n", + "here Pv_sat_35oc=0.005628 bar\n", + "so Pv2=phi2*Pv_sat_35oc in bar\n", + "specific humidity,omega2 in kg/kg of air= 0.00295\n", + "corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\n", + "so,enthalpy of second stream,\n", + "h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\n", + "enthalpy of mixture after adiabatic mixing,\n", + "=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\n", + "mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\n", + "specific humidity of mixture(omega)in kg/kg of dry air= 0.00592\n", + "omega=0.622*Pv/(P-Pv)\n", + "Pv in bar= 0.00956\n", + "partial pressure of water vapour=0.00957 bar\n", + "so specific humidity of mixture=0.00593 kg/kg dry air\n", + "and partial pressure of water vapour in mixture=0.00957 bar\n" + ] + } + ], + "source": [ + "#cal of specific humidity and partial pressure of water vapour in mixture\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.15, Page:451 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\")\n", + "P=1.013;#atmospheric pressure in bar\n", + "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", + "Cp_stream=1.86;#specific heat of stream at constant pressure in KJ/kg K\n", + "T1=30.;#temperature of first stream of moist air in K\n", + "m1=3.;#mass flow rate of first stream in kg/s \n", + "T2=35.;#temperature of second stream of moist air in K\n", + "m2=2.;#mass flow rate of second stream in kg/s \n", + "print(\"Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\")\n", + "print(\"For moist air stream at 30 degree celcius and 30% relative humidity.\")\n", + "phi1=0.3;\n", + "print(\"phi1=Pv1/Pv_sat_30oc\")\n", + "print(\"here Pv_sat_30oc=0.04246 bar\")\n", + "Pv_sat_30oc=0.04246;\n", + "print(\"so Pv1=phi1*Pv_sat_30oc in bar\")\n", + "Pv1=phi1*Pv_sat_30oc\n", + "print(\"corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\")\n", + "Tdp1=10.5;\n", + "omega1=0.622*Pv1/(P-Pv1)\n", + "print(\"specific humidity,omega1 in kg/kg of air=\"),round(omega1,5)\n", + "print(\"at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\")\n", + "hg=2520.7;#enthalpy at 10.5 degree celcius in KJ/kg\n", + "print(\"h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\")\n", + "h1=Cp_air*T1+omega1*(hg-Cp_stream*(T1-Tdp1))\n", + "print(\"for second moist air stream at 35oc and 85% relative humidity\")\n", + "phi2=0.85;\n", + "print(\"phi2=Pv2/Pv_sat_35oc\")\n", + "print(\"here Pv_sat_35oc=0.005628 bar\")\n", + "Pv_sat_35oc=0.005628;\n", + "print(\"so Pv2=phi2*Pv_sat_35oc in bar\")\n", + "Pv2=phi2*Pv_sat_35oc\n", + "omega2=0.622*Pv2/(P-Pv2)\n", + "print(\"specific humidity,omega2 in kg/kg of air=\"),round(omega2,5)\n", + "print(\"corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\")\n", + "Tdp2=32.;\n", + "print(\"so,enthalpy of second stream,\")\n", + "print(\"h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\")\n", + "hg=2559.9;#enthalpy at 32 degree celcius in KJ/kg\n", + "h2=Cp_air*T2+omega2*(hg+Cp_stream*(T2-Tdp2))\n", + "print(\"enthalpy of mixture after adiabatic mixing,\")\n", + "print(\"=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\")\n", + "(1./(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2)))\n", + "print(\"mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\")\n", + "(1./5.)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))\n", + "omega=0.00589/(1-0.005893)\n", + "print(\"specific humidity of mixture(omega)in kg/kg of dry air=\"),round(omega,5)\n", + "print(\"omega=0.622*Pv/(P-Pv)\")\n", + "Pv=omega*P/(omega+0.622)\n", + "print(\"Pv in bar=\"),round(Pv,5)\n", + "print(\"partial pressure of water vapour=0.00957 bar\")\n", + "print(\"so specific humidity of mixture=0.00593 kg/kg dry air\")\n", + "print(\"and partial pressure of water vapour in mixture=0.00957 bar\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.16;pg no: 452" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.16, Page:452 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\n", + "The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\n", + "h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\n", + "final state 2 has,h2=52 KJ/kg\n", + "mass of air(m)=m1/v1 in kg/s\n", + "amount of heat added(Q)in KJ/s\n", + "Q=m*(h2-h1) 56.78\n" + ] + } + ], + "source": [ + "#cal of amount of heat added\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.16, Page:452 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\")\n", + "m1=3;#rate at which moist air enter in heating coil in m^3/s\n", + "print(\"The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\")\n", + "print(\"h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\")\n", + "h1=36.4;\n", + "omega1=0.0086;\n", + "v1=0.825;\n", + "print(\"final state 2 has,h2=52 KJ/kg\")\n", + "h2=52;\n", + "print(\"mass of air(m)=m1/v1 in kg/s\")\n", + "m=m1/v1\n", + "m=3.64;#approx.\n", + "print(\"amount of heat added(Q)in KJ/s\")\n", + "Q=m*(h2-h1)\n", + "print(\"Q=m*(h2-h1)\"),round(Q,2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter11_3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter11_3.ipynb new file mode 100755 index 00000000..31f593f0 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter11_3.ipynb @@ -0,0 +1,1309 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11:Introduction to refrigeration and Air Conditioning" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.1;pg no: 435" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.1, Page:435 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\n", + "for refrigerator working on reversed carnot cycle.\n", + "Q1/T1=Q2/T2\n", + "so Q2=Q1*T2/T1 in KJ/min\n", + "and work input required,W in KJ/min\n", + "W=Q2-Q1 83.66\n" + ] + } + ], + "source": [ + "#cal of work input\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.1, Page:435 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\")\n", + "T1=(-16.+273.);#temperature of refrigerated space in K\n", + "T2=(27.+273.);#temperature of atmosphere in K\n", + "Q1=500.;#heat extracted from refrigerated space in KJ/min\n", + "print(\"for refrigerator working on reversed carnot cycle.\")\n", + "print(\"Q1/T1=Q2/T2\")\n", + "print(\"so Q2=Q1*T2/T1 in KJ/min\")\n", + "Q2=Q1*T2/T1\n", + "print(\"and work input required,W in KJ/min\")\n", + "W=Q2-Q1\n", + "print(\"W=Q2-Q1\"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.2;pg no: 435" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.2, Page:435 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\n", + "refrigeration capacity or heat extraction rate(Q)in KJ/s\n", + "let the ice formation rate be m kg/s\n", + "heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\n", + "ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice= 6.25\n", + "COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\n", + "also COP=Q/W\n", + "so W=Q/COP in KJ/s\n", + "HP required 643.62\n", + "NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\n" + ] + } + ], + "source": [ + "#cal of HP required\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.2, Page:435 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\")\n", + "Q=800.;#refrigeration capacity in tons\n", + "Q_latent=335.;#latent heat for ice formation from water in KJ/kg\n", + "T1=(-7.+273.);#temperature of reservoir 1 in K\n", + "T2=(27.+273.);#temperature of reservoir 2 in K\n", + "print(\"refrigeration capacity or heat extraction rate(Q)in KJ/s\")\n", + "Q=Q*3.5\n", + "print(\"let the ice formation rate be m kg/s\")\n", + "print(\"heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\")\n", + "Q1=4.18*(27-0)+Q_latent\n", + "m=Q/Q1\n", + "print(\"ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice=\"),round(Q/Q1,2)\n", + "print(\"COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\")\n", + "COP=T1/(T2-T1)\n", + "print(\"also COP=Q/W\")\n", + "print(\"so W=Q/COP in KJ/s\")\n", + "W=Q/COP\n", + "W=W/0.7457\n", + "print(\"HP required\"),round(W/0.7457,2)\n", + "print(\"NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.3;pg no: 436" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.3, Page:436 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\n", + "COP=T1/(T2-T1)=Q/W 1.56\n", + "equating,COP=T1/(T2-T1)\n", + "so temperature of surrounding(T2)in K\n", + "T2= 403.69\n" + ] + } + ], + "source": [ + "#cal of COP and temperature of surrounding\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.3, Page:436 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\")\n", + "T1=(-27+273);#temperature of refrigerator in K\n", + "W=3*.7457;#work input in KJ/s\n", + "Q=1*3.5;#refrigeration effect in KJ/s\n", + "COP=Q/W\n", + "print(\"COP=T1/(T2-T1)=Q/W\"),round(COP,2)\n", + "COP=1.56;#approx.\n", + "print(\"equating,COP=T1/(T2-T1)\")\n", + "print(\"so temperature of surrounding(T2)in K\")\n", + "T2=T1+(T1/COP)\n", + "print(\"T2=\"),round(T2,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.4;pg no: 436" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.4, Page:436 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\n", + "during process 1-2_a\n", + "p2/p1=(T2_a/T1)^(y/(y-1))\n", + "so T2_a=T1*(p2/p1)^((y-1)/y)in K\n", + "theoretical temperature after compression,T2_a=440.18 K\n", + "for compression process,\n", + "n1=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+(T2_a-T1)/n1 in K\n", + "for expansion process,3-4_a\n", + "T4_a/T3=(p1/p2)^((y-1)/y)\n", + "so T4_a=T3*(p1/p2)^((y-1)/y) in K\n", + "n2=0.9=(T3-T4)/(T3-T4_a)\n", + "so T4=T3-(n2*(T3-T4_a))in K\n", + "so work during compression,W_C in KJ/s\n", + "W_C=m*Cp*(T2-T1)\n", + "work during expansion,W_T in KJ/s\n", + "W_T=m*Cp*(T3-T4)\n", + "refrigeration effect is realized during process,4-1.so refrigeration shall be,\n", + "Q_ref=m*Cp*(T1-T4) in KJ/s\n", + "Q_ref in ton 18.36\n", + "net work required(W)=W_C-W_T in KJ/s 111.59\n", + "COP= 0.58\n", + "so refrigeration capacity=18.36 ton or 64.26 KJ/s\n", + "and COP=0.57\n", + "NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\n" + ] + } + ], + "source": [ + "#cal of refrigeration capacity and COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.4, Page:436 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\")\n", + "T1=(-30.+273.);#temperature of air at beginning of compression in K\n", + "T3=(27.+273.);#temperature of air after cooling in K\n", + "r=8.;#pressure ratio\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "y=1.4;#expansion constant \n", + "m=1.;#air flow rate in kg/s\n", + "n1=0.85;#isentropic efficiency for compression process\n", + "n2=.9;#isentropic efficiency for expansion process\n", + "print(\"during process 1-2_a\")\n", + "print(\"p2/p1=(T2_a/T1)^(y/(y-1))\")\n", + "print(\"so T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", + "T2_a=T1*(r)**((y-1)/y)\n", + "print(\"theoretical temperature after compression,T2_a=440.18 K\")\n", + "print(\"for compression process,\")\n", + "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", + "T2=T1+(T2_a-T1)/n1\n", + "print(\"for expansion process,3-4_a\")\n", + "print(\"T4_a/T3=(p1/p2)^((y-1)/y)\")\n", + "print(\"so T4_a=T3*(p1/p2)^((y-1)/y) in K\")\n", + "T4_a=T3*(1/r)**((y-1)/y)\n", + "print(\"n2=0.9=(T3-T4)/(T3-T4_a)\")\n", + "print(\"so T4=T3-(n2*(T3-T4_a))in K\")\n", + "T4=T3-(n2*(T3-T4_a))\n", + "print(\"so work during compression,W_C in KJ/s\")\n", + "print(\"W_C=m*Cp*(T2-T1)\")\n", + "W_C=m*Cp*(T2-T1)\n", + "print(\"work during expansion,W_T in KJ/s\")\n", + "print(\"W_T=m*Cp*(T3-T4)\")\n", + "W_T=m*Cp*(T3-T4)\n", + "print(\"refrigeration effect is realized during process,4-1.so refrigeration shall be,\")\n", + "print(\"Q_ref=m*Cp*(T1-T4) in KJ/s\")\n", + "Q_ref=m*Cp*(T1-T4)\n", + "Q_ref=Q_ref/3.5\n", + "print(\"Q_ref in ton\"),round(Q_ref,2)\n", + "W=W_C-W_T\n", + "print(\"net work required(W)=W_C-W_T in KJ/s\"),round(W,2)\n", + "Q_ref=64.26;\n", + "COP=Q_ref/(W_C-W_T)\n", + "print(\"COP=\"),round(COP,2)\n", + "print(\"so refrigeration capacity=18.36 ton or 64.26 KJ/s\")\n", + "print(\"and COP=0.57\")\n", + "print(\"NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.5;pg no: 437" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.5, Page:437 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\n", + "for isentropic compression process:\n", + "(p2/p1)^((y-1)/y)=T2/T1\n", + "so T2=T1*(p2/p1)^((y-1)/y) in K\n", + "for isenropic expansion process:\n", + "(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\n", + "so T4=T3/(p2/p1)^((y-1)/y) in K\n", + "heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\n", + "refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\n", + "so net work(W)=Q23-Q41 in KJ/kg\n", + "so COP=refrigeration effect/net work= 1.71\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.5, Page:437 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\")\n", + "T1=(7+273);#temperature of refrigerated space in K\n", + "T3=(27+273);#temperature after compression in K\n", + "p1=1*10**5;#pressure of refrigerated space in pa\n", + "p2=5*10**5;#pressure after compression in pa\n", + "y=1.4;#expansion constant\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"for isentropic compression process:\")\n", + "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", + "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"for isenropic expansion process:\")\n", + "print(\"(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\")\n", + "print(\"so T4=T3/(p2/p1)^((y-1)/y) in K\")\n", + "T4=T3/(p2/p1)**((y-1)/y)\n", + "print(\"heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\")\n", + "Q23=Cp*(T2-T3)\n", + "print(\"refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\")\n", + "Q41=Cp*(T1-T4)\n", + "print(\"so net work(W)=Q23-Q41 in KJ/kg\")\n", + "W=Q23-Q41\n", + "COP=Q41/W\n", + "print(\"so COP=refrigeration effect/net work=\"),round(COP,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.6;pg no: 438" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.6, Page:438 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\n", + "for process 1-2\n", + "(p2/p1)^((y-1)/y)=T2/T1\n", + "so T2=T1*(p2/p1)^((y-1)/y) in K\n", + "for process 3-4\n", + "(p3/p4)^((y-1)/y)=T3/T4\n", + "so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\n", + "refrigeration capacity(Q) in KJ/s= 63.25\n", + "Q in ton\n", + "work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\n", + "w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\n", + "HP required to run compressor 177.86\n", + "so HP required to run compressor=177.86 hp\n", + "net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\n", + "COP=refrigeration capacity/work=Q/W 1.59\n" + ] + } + ], + "source": [ + "#cal of refrigeration capacity,HP required to run compressor,COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.6, Page:438 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\")\n", + "T1=(-10.+273.);#air entering temperature in K\n", + "p1=1.*10**5;#air entering pressure in pa\n", + "T3=(27.+273.);#compressed air temperature after cooling in K\n", + "p2=5.5*10**5;#pressure after compression in pa\n", + "m=0.8;#air flow rate in kg/s\n", + "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", + "y=1.4;#expansion constant\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"for process 1-2\")\n", + "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", + "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"for process 3-4\")\n", + "print(\"(p3/p4)^((y-1)/y)=T3/T4\")\n", + "print(\"so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\")\n", + "T4=T3/(p2/p1)**((y-1)/y)\n", + "Q=m*Cp*(T1-T4)\n", + "print(\"refrigeration capacity(Q) in KJ/s=\"),round(Q,2)\n", + "print(\"Q in ton\")\n", + "Q=Q/3.5\n", + "print(\"work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\")\n", + "print(\"w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\")\n", + "n=y;\n", + "w=(m*n)*R*(T2-T1)/(n-1)\n", + "print(\"HP required to run compressor\"),round(w/0.7457,2)\n", + "print(\"so HP required to run compressor=177.86 hp\")\n", + "print(\"net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\")\n", + "W=m*Cp*((T2-T3)-(T1-T4))\n", + "Q=63.25;#refrigeration capacity in KJ/s\n", + "COP=Q/W\n", + "print(\"COP=refrigeration capacity/work=Q/W\"),round(COP,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.7;pg no: 440" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.7, Page:440 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\n", + "for process 1-2,n=1.45\n", + "T2/T1=(p2/p1)^((n-1)/n)\n", + "so T2=T1*(p2/p1)^((n-1)/n) in K\n", + "for process 3-4,n=1.3\n", + "T4/T3=(p4/p3)^((n-1)/n)\n", + "so T4=T3*(p4/p3)^((n-1)/n)in K\n", + "refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\n", + "Q=m*Cp*(T5-T4)\n", + "m in kg/s= 0.55\n", + "so air mass flow rate in cabin=0.55 kg/s\n", + "let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\n", + "m1*Cp*(T8-T7)=m*Cp*(T2-T3)\n", + "during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\n", + "so T7=T6*(p7/p6)^((n-1)/n) in K\n", + "substituting T2,T3,T7,T8 and m in energy balance on intercooler,\n", + "m1=m*(T2-T3)/(T8-T7)in kg/s\n", + "total ram air mass flow rate=m+m1 in kg/s 2.11\n", + "ram air mass flow rate=2.12 kg/s\n", + "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\n", + "COP=refrigeration effect/work input=Q/W 0.485\n" + ] + } + ], + "source": [ + "#cal of air mass flow rate in cabin,ram air mass flow rate,COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.7, Page:440 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\")\n", + "p1=1.2*10**5;#pressure of ram air in pa\n", + "p6=p1;\n", + "T1=(15.+273.);#temperature of ram air in K\n", + "T6=T1;\n", + "p7=0.9*10**5;#pressure of ram air after expansion in pa\n", + "p3=4.*10**5;#pressure of ram air after compression in pa\n", + "p2=p3;\n", + "p4=1.*10**5;#pressure of ram air after expansion in second turbine in pa\n", + "T5=(25.+273.);#temperature of air when exhausted from cabin in K\n", + "T3=(50.+273.);#temperature of compressed air in K\n", + "T8=(30.+273.);#limited temperaure of ram air in K\n", + "Q=10.*3.5;#refrigeration capacity in KJ/s\n", + "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", + "print(\"for process 1-2,n=1.45\")\n", + "n=1.45;\n", + "print(\"T2/T1=(p2/p1)^((n-1)/n)\")\n", + "print(\"so T2=T1*(p2/p1)^((n-1)/n) in K\")\n", + "T2=T1*(p2/p1)**((n-1)/n)\n", + "print(\"for process 3-4,n=1.3\")\n", + "n=1.3;\n", + "print(\"T4/T3=(p4/p3)^((n-1)/n)\")\n", + "print(\"so T4=T3*(p4/p3)^((n-1)/n)in K\")\n", + "T4=T3*(p4/p3)**((n-1)/n)\n", + "print(\"refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\")\n", + "print(\"Q=m*Cp*(T5-T4)\")\n", + "m=Q/(Cp*(T5-T4))\n", + "print(\"m in kg/s=\"),round(m,2)\n", + "print(\"so air mass flow rate in cabin=0.55 kg/s\")\n", + "print(\"let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\")\n", + "print(\"m1*Cp*(T8-T7)=m*Cp*(T2-T3)\")\n", + "print(\"during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\")\n", + "print(\"so T7=T6*(p7/p6)^((n-1)/n) in K\")\n", + "T7=T6*(p7/p6)**((n-1)/n)\n", + "print(\"substituting T2,T3,T7,T8 and m in energy balance on intercooler,\")\n", + "print(\"m1=m*(T2-T3)/(T8-T7)in kg/s\")\n", + "m1=m*(T2-T3)/(T8-T7)\n", + "print(\"total ram air mass flow rate=m+m1 in kg/s\"),round(m+m1,2)\n", + "print(\"ram air mass flow rate=2.12 kg/s\")\n", + "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\")\n", + "m=0.55;#approx.\n", + "W=m*Cp*(T2-T1)\n", + "COP=Q/W\n", + "print(\"COP=refrigeration effect/work input=Q/W\"),round(Q/W,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.8;pg no: 441" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.8, Page:441 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\n", + "considering index of compression and expansion as 1.4\n", + "during ramming action,process 0-1,\n", + "T1/To=(p1/po)^((y-1)/y)\n", + "T1=To*(p1/po)^((y-1)/y)in K\n", + "during compression process 1-2_a\n", + "T2_a/T1=(p2/p1)^((y-1)/y)\n", + "T2_a=T1*(p2/p1)^((y-1)/y)in K\n", + "n1=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+(T2_a-T1)/n1 in K\n", + "In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\n", + "subsequently for 10 degree celcius temperature drop in evaporator,\n", + "T4=T3-10 in K\n", + "expansion in cooling turbine during process 4-5;\n", + "T5_a/T4=(p5/p4)^((y-1)/y)\n", + "T5_a=T4*(p5/p4)^((y-1)/y)in K\n", + "n2=(T4-T5)/(T4-T5_a)\n", + "T5=T4-(T4-T5_a)*n2 in K\n", + "let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\n", + "Q=m*Cp*(T6-T5)\n", + "so m=Q/(Cp*(T6-T5))in kg/s\n", + "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s 41.4\n", + "W in Hp\n", + "COP=refrigeration effect/work input=Q/W= 1.27\n", + "so COP=1.27\n", + "and HP required=55.48 hp\n" + ] + } + ], + "source": [ + "#cal of COP and HP required\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.8, Page:441 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\")\n", + "po=0.9*10**5;#atmospheric air pressure in pa\n", + "To=(3.+273.);#temperature of atmospheric air in K\n", + "p1=1.*10**5;#pressure due to ramming air in pa\n", + "p2=4.*10**5;#pressure when air leaves compressor in pa\n", + "p3=p2;\n", + "p4=p3;\n", + "p5=1.03*10**5;#pressure maintained in passenger cabin in pa\n", + "T6=(25.+273.);#temperature of air leaves cabin in K\n", + "Q=15.*3.5;#refrigeration capacity of aeroplane in KJ/s\n", + "n1=0.9;#isentropic efficiency of compressor\n", + "n2=0.8;#isentropic efficiency of turbine\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"considering index of compression and expansion as 1.4\")\n", + "y=1.4;\n", + "print(\"during ramming action,process 0-1,\")\n", + "print(\"T1/To=(p1/po)^((y-1)/y)\")\n", + "print(\"T1=To*(p1/po)^((y-1)/y)in K\")\n", + "T1=To*(p1/po)**((y-1)/y)\n", + "print(\"during compression process 1-2_a\")\n", + "print(\"T2_a/T1=(p2/p1)^((y-1)/y)\")\n", + "print(\"T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", + "T2_a=T1*(p2/p1)**((y-1)/y)\n", + "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", + "T2=T1+(T2_a-T1)/n1\n", + "print(\"In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\")\n", + "T3=0.34*T2\n", + "print(\"subsequently for 10 degree celcius temperature drop in evaporator,\")\n", + "print(\"T4=T3-10 in K\")\n", + "T4=T3-10\n", + "print(\"expansion in cooling turbine during process 4-5;\")\n", + "print(\"T5_a/T4=(p5/p4)^((y-1)/y)\")\n", + "print(\"T5_a=T4*(p5/p4)^((y-1)/y)in K\")\n", + "T5_a=T4*(p5/p4)**((y-1)/y)\n", + "print(\"n2=(T4-T5)/(T4-T5_a)\")\n", + "print(\"T5=T4-(T4-T5_a)*n2 in K\")\n", + "T5=T4-(T4-T5_a)*n2\n", + "print(\"let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\")\n", + "print(\"Q=m*Cp*(T6-T5)\")\n", + "print(\"so m=Q/(Cp*(T6-T5))in kg/s\")\n", + "m=Q/(Cp*(T6-T5))\n", + "W=m*Cp*(T2-T1)\n", + "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\"),round(W,2)\n", + "print(\"W in Hp\")\n", + "W=W/.7457\n", + "W=41.37;#work input to compressor in KJ/s\n", + "COP=Q/W\n", + "print(\"COP=refrigeration effect/work input=Q/W=\"),round(COP,2)\n", + "print(\"so COP=1.27\")\n", + "print(\"and HP required=55.48 hp\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.9;pg no: 443" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.9, Page:443 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\n", + "properties of NH3,\n", + "at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\n", + "and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\n", + "here work done,W=Area 1-2-3-9-1\n", + "refrigeration effect=Area 1-5-6-4-1\n", + "Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\n", + "so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\n", + "during throttling process between 3 and 4,h3=h4\n", + "(Area=3-11-7-3)=(Area 4-9-11-6-4)\n", + "(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\n", + "(Area 3-8-9)=(Area 4-6-7-8-4)\n", + "so (Area 4-6-7-8-4)=12.09 KJ/kg\n", + "also,(Area 4-6-7-8-4)=T1*(s4-s8)\n", + "so (s4-s8)in KJ/kg K=\n", + "also s3=s8=0.3386 KJ/kg K\n", + "so s4 in KJ/kg K=\n", + "also s1=s2=4.4809 KJ/kg K\n", + "refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\n", + "work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\n", + "so COP=refrigeration effect/work done= 5.94\n", + "so COP=5.94\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.9, Page:443 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\")\n", + "print(\"properties of NH3,\")\n", + "print(\"at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\")\n", + "T1=(-15+273);\n", + "h9=-54.51;\n", + "hg=1303.74;\n", + "s9=-0.2132;\n", + "sg=5.0536;\n", + "print(\"and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\")\n", + "T2=(25+273);\n", + "h3=99.94;\n", + "h2=1317.95;\n", + "s3=0.3386;\n", + "s2=4.4809;\n", + "print(\"here work done,W=Area 1-2-3-9-1\")\n", + "print(\"refrigeration effect=Area 1-5-6-4-1\")\n", + "print(\"Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\")\n", + "print(\"so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\")\n", + "h3-h9-T1*(s3-s9)\n", + "print(\"during throttling process between 3 and 4,h3=h4\")\n", + "print(\"(Area=3-11-7-3)=(Area 4-9-11-6-4)\")\n", + "print(\"(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\")\n", + "print(\"(Area 3-8-9)=(Area 4-6-7-8-4)\")\n", + "print(\"so (Area 4-6-7-8-4)=12.09 KJ/kg\")\n", + "print(\"also,(Area 4-6-7-8-4)=T1*(s4-s8)\")\n", + "print(\"so (s4-s8)in KJ/kg K=\")\n", + "12.09/T1\n", + "print(\"also s3=s8=0.3386 KJ/kg K\")\n", + "s8=s3;\n", + "print(\"so s4 in KJ/kg K=\")\n", + "s4=s8+12.09/T1\n", + "print(\"also s1=s2=4.4809 KJ/kg K\")\n", + "s1=s2;\n", + "print(\"refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\")\n", + "Q=T1*(s1-s4)\n", + "print(\"work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\")\n", + "W=12.09+((T2-T1)*(s1-s8))\n", + "COP=Q/W\n", + "print(\"so COP=refrigeration effect/work done=\"),round(COP,2)\n", + "print(\"so COP=5.94\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.10;pg no: 445" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.10, Page:445 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\n", + "properties of Freon-12,\n", + "at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\n", + "at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\n", + "during expansion(throttling)between 3 and 4\n", + "h3=h4=hf_40oc=74.53 KJ/kg=h4\n", + "process 1-2 is adiabatic compression so,\n", + "s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\n", + "at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\n", + "T2=313*exp((s1-sg)/Cpg)in K\n", + "so temperature after compression,T2=324.17 K\n", + "enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\n", + "compression work required,per kg(Wc)=h2-h1 in KJ/kg\n", + "refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\n", + "mass flow rate of refrigerant,m=Q/q in kg/s\n", + "COP=q/Wc 3.17452\n", + "volumetric efficiency of reciprocating compressor,given C=0.02\n", + "n_vol=1+C-C*(P2/P1)^(1/n)\n", + "let piston printlacement by V,m^3\n", + "mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\n", + "so V in cm^3= 569.43\n", + "so COP=3.175\n", + "and piston printlacement=569.45 cm^3\n" + ] + } + ], + "source": [ + "#cal of COP and piston printlacement\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.10, Page:445 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\")\n", + "Q=2.86*3.5;#refrigeration effect in KJ/s\n", + "N=1200;#compressor rpm\n", + "n=1.13;#compression index\n", + "print(\"properties of Freon-12,\")\n", + "print(\"at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\")\n", + "P1=1.51;\n", + "T1=(-20+273);\n", + "vg=0.1088;\n", + "h1=178.61;\n", + "s1=0.7082;\n", + "s2=s1;\n", + "print(\"at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\")\n", + "P2=9.61;\n", + "h3=74.53;\n", + "h4=h3;\n", + "hg=203.05;\n", + "sf=0.2716;\n", + "sg=0.682;\n", + "Cpf=0.976;\n", + "Cpg=0.747;\n", + "print(\"during expansion(throttling)between 3 and 4\")\n", + "print(\"h3=h4=hf_40oc=74.53 KJ/kg=h4\")\n", + "print(\"process 1-2 is adiabatic compression so,\")\n", + "print(\"s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\")\n", + "print(\"at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\")\n", + "print(\"T2=313*exp((s1-sg)/Cpg)in K\")\n", + "T2=313*math.exp((s1-sg)/Cpg)\n", + "print(\"so temperature after compression,T2=324.17 K\")\n", + "print(\"enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\")\n", + "h2=hg+Cpg*(T2-313)\n", + "print(\"compression work required,per kg(Wc)=h2-h1 in KJ/kg\")\n", + "Wc=h2-h1\n", + "print(\"refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\")\n", + "q=h1-h4\n", + "print(\"mass flow rate of refrigerant,m=Q/q in kg/s\")\n", + "m=Q/q\n", + "m=0.096;#approx.\n", + "COP=q/Wc\n", + "print(\"COP=q/Wc\"),round(COP,5)\n", + "print(\"volumetric efficiency of reciprocating compressor,given C=0.02\")\n", + "C=0.02;\n", + "print(\"n_vol=1+C-C*(P2/P1)^(1/n)\")\n", + "n_vol=1+C-C*(P2/P1)**(1/n)\n", + "print(\"let piston printlacement by V,m^3\")\n", + "print(\"mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\")\n", + "V=(m*60*vg)*10**6/(N*n_vol)\n", + "print(\"so V in cm^3=\"),round(V,2)\n", + "print(\"so COP=3.175\")\n", + "print(\"and piston printlacement=569.45 cm^3\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.11;pg no: 447" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.11, Page:447 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\n", + "properties of CO2,\n", + "at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\n", + "at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\n", + "processes of vapour compression cycle are shown on T-s diagram\n", + "1-2:isentropic compression process\n", + "2-3-4:condensation process\n", + "4-5:isenthalpic expansion process\n", + "5-1:refrigeration process in evaporator\n", + "h1=hg at -10oc=322.28 KJ/kg\n", + "at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\n", + "entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\n", + "entropy during isentropic process,s1=s2\n", + "at -10 degree celcius,s2=sf+x1*sfg\n", + "so x1=(s2-sf)/(sg-sf)\n", + "enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\n", + "h3=hf at 20oc=144.11 KJ/kg\n", + "since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\n", + "also,h4=h5=115.22 KJ/kg\n", + "refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\n", + "let refrigerant flow rate be m kg/s\n", + "refrigerant effect(Q)=m*q\n", + "m=Q/q in kg/s 0.01016\n", + "compressor work,Wc=h2-h1 in KJ/kg\n", + "COP=refrigeration effect per kg/compressor work per kg= 6.51\n", + "so COP=6.51,mass flow rate=0.01016 kg/s\n", + "NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \n" + ] + } + ], + "source": [ + "#cal of COP and mass flow rate\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.11, Page:447 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\")\n", + "Q=2;#refrigeration effect in KW\n", + "print(\"properties of CO2,\")\n", + "print(\"at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\")\n", + "T1=(20.+273.);#condensation temperature in K\n", + "P1=57.27;\n", + "h3=144.11;\n", + "hg=299.62;\n", + "sf=0.523;\n", + "sg_20oc=1.0527;\n", + "Cpf=2.889;\n", + "Cpg=2.135;\n", + "print(\"at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\")\n", + "T2=(-10+273);#evaporator temperature in K\n", + "P2=26.49;\n", + "vg=0.014;\n", + "hf=60.78;\n", + "h1=322.28;\n", + "sf=0.2381;\n", + "sg=1.2324;\n", + "print(\"processes of vapour compression cycle are shown on T-s diagram\")\n", + "print(\"1-2:isentropic compression process\")\n", + "print(\"2-3-4:condensation process\")\n", + "print(\"4-5:isenthalpic expansion process\")\n", + "print(\"5-1:refrigeration process in evaporator\")\n", + "print(\"h1=hg at -10oc=322.28 KJ/kg\")\n", + "print(\"at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\")\n", + "h2=hg+Cpg*(40.-20.)\n", + "print(\"entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\")\n", + "s2=sg_20oc+Cpg*math.log((273.+40.)/(273.+20.))\n", + "print(\"entropy during isentropic process,s1=s2\")\n", + "print(\"at -10 degree celcius,s2=sf+x1*sfg\")\n", + "print(\"so x1=(s2-sf)/(sg-sf)\")\n", + "x1=(s2-sf)/(sg-sf)\n", + "print(\"enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\")\n", + "h1=hf+x1*(h1-hf)\n", + "print(\"h3=hf at 20oc=144.11 KJ/kg\")\n", + "print(\"since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\")\n", + "h4=h3-Cpf*(20.-10.)\n", + "print(\"also,h4=h5=115.22 KJ/kg\")\n", + "h5=h4;\n", + "print(\"refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\")\n", + "q=(h1-h5)\n", + "print(\"let refrigerant flow rate be m kg/s\")\n", + "print(\"refrigerant effect(Q)=m*q\")\n", + "m=Q/q\n", + "print(\"m=Q/q in kg/s\"),round(m,5)\n", + "print(\"compressor work,Wc=h2-h1 in KJ/kg\")\n", + "Wc=h2-h1\n", + "COP=q/Wc\n", + "print(\"COP=refrigeration effect per kg/compressor work per kg=\"),round(COP,2)\n", + "print(\"so COP=6.51,mass flow rate=0.01016 kg/s\")\n", + "print(\"NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.12;pg no: 448" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.12, Page:448 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\n", + "here pressure of atmospheric air(P)may be taken as 1.013 bar\n", + "specific humidity,omega=0.622*(Pv/(P-Pv))\n", + "so partial pressure of vapour(Pv)in bar\n", + "Pv in bar= 0.0254\n", + "relative humidity(phi)=(Pv/Pv_sat)\n", + "from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\n", + "so phi=Pv/Pv_sat 0.82\n", + "in percentage 81.99\n", + "so partial pressure of vapour=0.0254 bar\n", + "relative humidity=81.98 %\n" + ] + } + ], + "source": [ + "#cal of partial pressure of vapour and relative humidity\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.12, Page:448 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\")\n", + "omega=0.016;#specific humidity in gm/gm of air\n", + "print(\"here pressure of atmospheric air(P)may be taken as 1.013 bar\")\n", + "P=1.013;#pressure of atmospheric air in bar\n", + "print(\"specific humidity,omega=0.622*(Pv/(P-Pv))\")\n", + "print(\"so partial pressure of vapour(Pv)in bar\")\n", + "Pv=P/(1+(0.622/omega))\n", + "print(\"Pv in bar=\"),round(Pv,4)\n", + "Pv=0.0254;#approx.\n", + "print(\"relative humidity(phi)=(Pv/Pv_sat)\")\n", + "print(\"from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\")\n", + "Pv_sat=0.03098;\n", + "phi=Pv/Pv_sat\n", + "print(\"so phi=Pv/Pv_sat\"),round(phi,2)\n", + "print(\"in percentage\"),round(phi*100,2)\n", + "print(\"so partial pressure of vapour=0.0254 bar\")\n", + "print(\"relative humidity=81.98 %\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.13;pg no: 449" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.13, Page:449 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\n", + "at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\n", + "partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar 0.03\n", + "partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour 0.99\n", + "so partial pressure of air=0.9875 bar\n", + "humidity ratio,omega in kg/kg of dry air= 0.01606\n", + "so humidity ratio=0.01606 kg/kg of air\n", + "Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\n", + "so Dew point temperature=21.4 degree celcius\n", + "density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\n", + "rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\n", + "rho_m in kg/m^3= 1.1836\n", + "so density = 1.1835 kg/m^3\n", + "enthalpy of mixture,h in KJ/kg of dry air= 71.21\n", + "enthalpy of mixture =71.2 KJ/kg of dry air\n" + ] + } + ], + "source": [ + "#cal of partial pressure,humidity ratio,Dew point temperature,density and enthalpy of mixture\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.13, Page:449 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\")\n", + "r=0.6;#relative humidity\n", + "P=1.013;#total pressure of mixture in bar\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Ta=(30+273);#room temperature in K\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg degree celcius\n", + "print(\"at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\")\n", + "Pv_sat=0.0425;\n", + "Pv=r*Pv_sat\n", + "print(\"partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar\"),round(Pv,2)\n", + "Pa=P-Pv\n", + "print(\"partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour\"),round(Pa,2)\n", + "print(\"so partial pressure of air=0.9875 bar\")\n", + "omega=0.622*Pv/(P-Pv)\n", + "print(\"humidity ratio,omega in kg/kg of dry air=\"),round(omega,5)\n", + "print(\"so humidity ratio=0.01606 kg/kg of air\")\n", + "print(\"Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\")\n", + "print(\"so Dew point temperature=21.4 degree celcius\")\n", + "print(\"density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\")\n", + "print(\"rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\")\n", + "rho_m=P*100*(1+omega)/(R*Ta)\n", + "print(\"rho_m in kg/m^3=\"),round(rho_m,4)\n", + "print(\"so density = 1.1835 kg/m^3\")\n", + "T=30;#room temperature in degree celcius\n", + "hg=2540.1;#enthalpy at 30 degree celcius in KJ/kg\n", + "h=Cp*T+omega*(hg+1.860*(30-21.4))\n", + "print(\"enthalpy of mixture,h in KJ/kg of dry air=\"),round(h,2)\n", + "print(\"enthalpy of mixture =71.2 KJ/kg of dry air\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.14;pg no: 449" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.14, Page:449 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\n", + "initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\n", + "omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\n", + "mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\n", + "mass flow rate of air(ma)=0.8/v2 in kg/s\n", + "total mass of water added=ma*(omega2-omega1)in kg/s 0.001311\n", + "heat transferred in KJ/s= 12.18\n", + "so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\n" + ] + } + ], + "source": [ + "#cal of mass of water added and heat transferred\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.14, Page:449 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\")\n", + "print(\"initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\")\n", + "print(\"omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\")\n", + "omega1=0.0086;\n", + "h1=37.;\n", + "omega2=0.01;\n", + "h2=50.;\n", + "v2=0.854;\n", + "print(\"mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\")\n", + "omega2-omega1\n", + "print(\"mass flow rate of air(ma)=0.8/v2 in kg/s\")\n", + "ma=0.8/v2\n", + "print(\"total mass of water added=ma*(omega2-omega1)in kg/s\"),round(ma*(omega2-omega1),6)\n", + "print(\"heat transferred in KJ/s=\"),round(ma*(h2-h1),2)\n", + "print(\"so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.15;pg no: 451" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.15, Page:451 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\n", + "Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\n", + "For moist air stream at 30 degree celcius and 30% relative humidity.\n", + "phi1=Pv1/Pv_sat_30oc\n", + "here Pv_sat_30oc=0.04246 bar\n", + "so Pv1=phi1*Pv_sat_30oc in bar\n", + "corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\n", + "specific humidity,omega1 in kg/kg of air= 0.00792\n", + "at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\n", + "h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\n", + "for second moist air stream at 35oc and 85% relative humidity\n", + "phi2=Pv2/Pv_sat_35oc\n", + "here Pv_sat_35oc=0.005628 bar\n", + "so Pv2=phi2*Pv_sat_35oc in bar\n", + "specific humidity,omega2 in kg/kg of air= 0.00295\n", + "corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\n", + "so,enthalpy of second stream,\n", + "h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\n", + "enthalpy of mixture after adiabatic mixing,\n", + "=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\n", + "mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\n", + "specific humidity of mixture(omega)in kg/kg of dry air= 0.00592\n", + "omega=0.622*Pv/(P-Pv)\n", + "Pv in bar= 0.00956\n", + "partial pressure of water vapour=0.00957 bar\n", + "so specific humidity of mixture=0.00593 kg/kg dry air\n", + "and partial pressure of water vapour in mixture=0.00957 bar\n" + ] + } + ], + "source": [ + "#cal of specific humidity and partial pressure of water vapour in mixture\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.15, Page:451 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\")\n", + "P=1.013;#atmospheric pressure in bar\n", + "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", + "Cp_stream=1.86;#specific heat of stream at constant pressure in KJ/kg K\n", + "T1=30.;#temperature of first stream of moist air in K\n", + "m1=3.;#mass flow rate of first stream in kg/s \n", + "T2=35.;#temperature of second stream of moist air in K\n", + "m2=2.;#mass flow rate of second stream in kg/s \n", + "print(\"Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\")\n", + "print(\"For moist air stream at 30 degree celcius and 30% relative humidity.\")\n", + "phi1=0.3;\n", + "print(\"phi1=Pv1/Pv_sat_30oc\")\n", + "print(\"here Pv_sat_30oc=0.04246 bar\")\n", + "Pv_sat_30oc=0.04246;\n", + "print(\"so Pv1=phi1*Pv_sat_30oc in bar\")\n", + "Pv1=phi1*Pv_sat_30oc\n", + "print(\"corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\")\n", + "Tdp1=10.5;\n", + "omega1=0.622*Pv1/(P-Pv1)\n", + "print(\"specific humidity,omega1 in kg/kg of air=\"),round(omega1,5)\n", + "print(\"at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\")\n", + "hg=2520.7;#enthalpy at 10.5 degree celcius in KJ/kg\n", + "print(\"h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\")\n", + "h1=Cp_air*T1+omega1*(hg-Cp_stream*(T1-Tdp1))\n", + "print(\"for second moist air stream at 35oc and 85% relative humidity\")\n", + "phi2=0.85;\n", + "print(\"phi2=Pv2/Pv_sat_35oc\")\n", + "print(\"here Pv_sat_35oc=0.005628 bar\")\n", + "Pv_sat_35oc=0.005628;\n", + "print(\"so Pv2=phi2*Pv_sat_35oc in bar\")\n", + "Pv2=phi2*Pv_sat_35oc\n", + "omega2=0.622*Pv2/(P-Pv2)\n", + "print(\"specific humidity,omega2 in kg/kg of air=\"),round(omega2,5)\n", + "print(\"corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\")\n", + "Tdp2=32.;\n", + "print(\"so,enthalpy of second stream,\")\n", + "print(\"h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\")\n", + "hg=2559.9;#enthalpy at 32 degree celcius in KJ/kg\n", + "h2=Cp_air*T2+omega2*(hg+Cp_stream*(T2-Tdp2))\n", + "print(\"enthalpy of mixture after adiabatic mixing,\")\n", + "print(\"=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\")\n", + "(1./(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2)))\n", + "print(\"mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\")\n", + "(1./5.)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))\n", + "omega=0.00589/(1-0.005893)\n", + "print(\"specific humidity of mixture(omega)in kg/kg of dry air=\"),round(omega,5)\n", + "print(\"omega=0.622*Pv/(P-Pv)\")\n", + "Pv=omega*P/(omega+0.622)\n", + "print(\"Pv in bar=\"),round(Pv,5)\n", + "print(\"partial pressure of water vapour=0.00957 bar\")\n", + "print(\"so specific humidity of mixture=0.00593 kg/kg dry air\")\n", + "print(\"and partial pressure of water vapour in mixture=0.00957 bar\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 11.16;pg no: 452" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 11.16, Page:452 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\n", + "The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\n", + "h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\n", + "final state 2 has,h2=52 KJ/kg\n", + "mass of air(m)=m1/v1 in kg/s\n", + "amount of heat added(Q)in KJ/s\n", + "Q=m*(h2-h1) 56.78\n" + ] + } + ], + "source": [ + "#cal of amount of heat added\n", + "#intiation of all variables\n", + "# Chapter 11\n", + "import math\n", + "print\"Example 11.16, Page:452 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\")\n", + "m1=3;#rate at which moist air enter in heating coil in m^3/s\n", + "print(\"The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\")\n", + "print(\"h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\")\n", + "h1=36.4;\n", + "omega1=0.0086;\n", + "v1=0.825;\n", + "print(\"final state 2 has,h2=52 KJ/kg\")\n", + "h2=52;\n", + "print(\"mass of air(m)=m1/v1 in kg/s\")\n", + "m=m1/v1\n", + "m=3.64;#approx.\n", + "print(\"amount of heat added(Q)in KJ/s\")\n", + "Q=m*(h2-h1)\n", + "print(\"Q=m*(h2-h1)\"),round(Q,2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter12.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter12.ipynb new file mode 100755 index 00000000..f89e1b1a --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter12.ipynb @@ -0,0 +1,818 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12:Introduction to Heat Transfer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.1;pg no: 483" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.1, Page:483 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\n", + "here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\n", + "overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\n", + "(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\n", + "so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", + "rate of heat transfer,Q in W= 10590.0\n", + "so rate of heat transfer=10590 W\n", + "heat transfer across states 1 and 3(at interface).\n", + "overall heat transfer coefficient between 1 and 3\n", + "(1/U1)=(1/h1)+(deltax_brick/k_brick)\n", + "so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\n", + "Q=U1*A*(T1-T3)\n", + "so T3=T1-(Q/(U1*A))in degree celcius 44.7\n", + "so temperature at interface of brick and wood =44.71 degree celcius\n" + ] + } + ], + "source": [ + "#cal of rate of heat transfer and temperature at interface of brick and wood\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.1, Page:483 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\")\n", + "h1=30.;#heat transfer coefficient on side of 50 oc in W/m^2 K\n", + "h5=10.;#heat transfer coefficient on side of 20 oc in W/m^2 K\n", + "k_brick=0.9;#conductivity of brick in W/m K\n", + "k_wood=0.15;#conductivity of wood in W/m K\n", + "T1=50.;#temperature of air on one side of wall in degree celcius\n", + "T5=20.;#temperature of air on other side of wall in degree celcius\n", + "A=100.;#surface area in m^2\n", + "deltax_brick=1.5*10**-2;#length of brick in m\n", + "deltax_wood=2*10**-2;#length of wood in m\n", + "print(\"here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\")\n", + "print(\"overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\")\n", + "print(\"(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\")\n", + "print(\"so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\")\n", + "U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", + "U=3.53;#approx.\n", + "Q=U*A*(T1-T5)\n", + "print(\"rate of heat transfer,Q in W=\"),round(Q,2)\n", + "print(\"so rate of heat transfer=10590 W\")\n", + "print(\"heat transfer across states 1 and 3(at interface).\")\n", + "print(\"overall heat transfer coefficient between 1 and 3\")\n", + "print(\"(1/U1)=(1/h1)+(deltax_brick/k_brick)\")\n", + "print(\"so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\")\n", + "U1=1/((1/h1)+(deltax_brick/k_brick))\n", + "print(\"Q=U1*A*(T1-T3)\")\n", + "T3=T1-(Q/(U1*A))\n", + "print(\"so T3=T1-(Q/(U1*A))in degree celcius\"),round(T3,2)\n", + "print(\"so temperature at interface of brick and wood =44.71 degree celcius\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.2;pg no: 484" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.2, Page:484 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\n", + "here thermal resistances are\n", + "R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\n", + "R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\n", + "R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\n", + "R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\n", + "R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\n", + "overall heat transfer coefficient for one dimentional steady state heat transfer\n", + "(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\n", + "so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\n", + "rate of heat transfer(Q) in KJ/m^2 hr= 112.0\n", + "wall surface area(A) in m^2\n", + "so rate of heat transfer=112 KJ/m^2 hr \n", + "Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\n", + "Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\n", + "substituting,T2 in degree celcius= 23.6\n", + "so temperature of outer wall,T2=23.6 oc\n", + "T3 in degree= 23.6\n", + "so temperature at interface of outer steel wall and wool,T3=23.59 oc\n", + "T4 in degree celcius= 6.1\n", + "so temperature at interface of wool and inside steel wall,T4=6.09 oc\n", + "T5 in degree celcius= 6.1\n", + "so temperature at inside of inner steel wall,T5=6.08 oc\n" + ] + } + ], + "source": [ + "#cal of rate of heat transfer,temperatures\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.2, Page:484 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\")\n", + "h1=40;#average heat transfer coefficient at inner surface in KJ/m^2 hr oc\n", + "h6=50;#average heat transfer coefficient at outer surface in KJ/m^2 hr oc\n", + "deltax_steel=2*10**-3;#mild steel sheets thickness in m\n", + "deltax_wool=5*10**-2;#thickness of glass wool insulation in m\n", + "k_wool=0.16;#thermal conductivity of wool in KJ/m hr\n", + "k_steel=160;#thermal conductivity of steel in KJ/m hr\n", + "T1=25;#kitchen temperature in degree celcius\n", + "T6=5;#refrigerator temperature in degree celcius\n", + "print(\"here thermal resistances are\")\n", + "print(\"R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\")\n", + "print(\"R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\")\n", + "print(\"R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\")\n", + "print(\"R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\")\n", + "print(\"R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\")\n", + "print(\"overall heat transfer coefficient for one dimentional steady state heat transfer\")\n", + "print(\"(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\")\n", + "print(\"so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\")\n", + "U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))\n", + "U=2.8;#approx.\n", + "A=4*(1*0.5)\n", + "Q=U*A*(T1-T6)\n", + "print(\"rate of heat transfer(Q) in KJ/m^2 hr=\"),round(Q,2)\n", + "print(\"wall surface area(A) in m^2\")\n", + "print(\"so rate of heat transfer=112 KJ/m^2 hr \")\n", + "print(\"Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\")\n", + "print(\"Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\")\n", + "T2=T1-(Q/(A*h1))\n", + "print(\"substituting,T2 in degree celcius=\"),round(T2,1)\n", + "print(\"so temperature of outer wall,T2=23.6 oc\")\n", + "T3=T2-(Q*deltax_steel/(k_steel*A))\n", + "print(\"T3 in degree= \"),round(T3,2)\n", + "print(\"so temperature at interface of outer steel wall and wool,T3=23.59 oc\")\n", + "T4=T3-(Q*deltax_wool/(k_wool*A))\n", + "print(\"T4 in degree celcius=\"),round(T4,2)\n", + "print(\"so temperature at interface of wool and inside steel wall,T4=6.09 oc\")\n", + "T5=T4-(Q*deltax_steel/(k_steel*A))\n", + "print(\"T5 in degree celcius=\"),round(T5,2)\n", + "print(\"so temperature at inside of inner steel wall,T5=6.08 oc\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.3;pg no: 486" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.3, Page:486 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\n", + "here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\n", + "Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\n", + "so heat loss per meter from pipe in KJ/hr= 1479.77\n", + "heat loss from 5 m length(Q) in KJ/hr 7396.7\n", + "enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\n", + "mass flow of steam(m)in kg/hr\n", + "final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\n", + "let quality of steam at exit be x,\n", + "also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\n", + "h=hf+x*hfg\n", + "so x=(h-hf)/hfg 0.8245\n", + "so quality of steam at exit=0.8245\n" + ] + } + ], + "source": [ + "#cal of heat loss per meter from pipe and quality of steam\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.3, Page:486 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\")\n", + "k_insulation=0.3;#thermal conductivity of insulation in KJ/m hr oc\n", + "k_pipe=209;#thermal conductivity of pipe in KJ/m hr oc\n", + "T1=300;#temperature of inner surface of steam pipe in degree celcius\n", + "T3=50;#temperature of outer surface of insulation layer in degree celcius\n", + "r1=15*10**-2/2;#steam pipe inner radius without insulation in m\n", + "r2=16*10**-2/2;#steam pipe outer radius without insulation in m\n", + "r3=22*10**-2/2;#radius with insulation in m\n", + "m=0.5;#steam entering rate in kg/min\n", + "print(\"here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\")\n", + "print(\"Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\")\n", + "L=1;\n", + "Q=(T1-T3)*2*math.pi*L/((1/k_pipe)*math.log(r2/r1)+(1/k_insulation*math.log(r3/r2)))\n", + "print(\"so heat loss per meter from pipe in KJ/hr=\"),round(Q,2)\n", + "Q=5*Q\n", + "print(\"heat loss from 5 m length(Q) in KJ/hr\"),round(5*1479.34,2)\n", + "print(\"enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\")\n", + "hg=2749;\n", + "print(\"mass flow of steam(m)in kg/hr\")\n", + "m=m*60\n", + "print(\"final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\")\n", + "h=hg-(Q/m)\n", + "print(\"let quality of steam at exit be x,\")\n", + "print(\"also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\")\n", + "hf=1344;\n", + "hfg=1404.9;\n", + "print(\"h=hf+x*hfg\")\n", + "x=(h-hf)/hfg\n", + "print(\"so x=(h-hf)/hfg\"),round(x,4)\n", + "print(\"so quality of steam at exit=0.8245\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.4;pg no: 487" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.4, Page:487 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\n", + "considering one dimensional heat transfer of steady state type\n", + "for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr 168892.02\n", + "so heat transfer rate=168892.02 KJ/hr\n", + "heat flux in KJ/m^2 hr= 23893.33\n", + "so heat flux=23893.33 KJ/m^2 hr\n" + ] + } + ], + "source": [ + "#cal of amount of heat transfer and heat flux\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.4, Page:487 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\")\n", + "r1=150.*10**-2/2;#inner radius in m\n", + "r2=200.*10**-2/2;#outer radius in m\n", + "k=28.;#thermal conductivity in KJ m hr oc\n", + "T1=200.;#inside surface temperature in degree celcius\n", + "T2=40.;#outer surface temperature in degree celcius\n", + "print(\"considering one dimensional heat transfer of steady state type\")\n", + "Q=(T1-T2)*4*math.pi*k*r1*r2/(r2-r1)\n", + "print(\"for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr\"),round(Q,2)\n", + "print(\"so heat transfer rate=168892.02 KJ/hr\")\n", + "Q/(4*math.pi*r1**2)\n", + "print(\"heat flux in KJ/m^2 hr=\"),round(Q/(4*math.pi*r1**2),2)\n", + "print(\"so heat flux=23893.33 KJ/m^2 hr\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.5;pg no: 487" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.5, Page:487 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\n", + "R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\n", + "R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\n", + "R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\n", + "total thermal resistance,R_total=R1+R2+R3 in oc/W\n", + "so rate of heat transfer,Q=(T1-T4)/R_total in W 118.03\n", + "heat transfer rate from inside of room to inside surface of glass window.\n", + "Q=(T1-T2)/R1\n", + "so T2=T1-Q*R1 in degree celcius 9.26\n", + "Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\n" + ] + } + ], + "source": [ + "#cal of heat transfer rate\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.5, Page:487 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\")\n", + "T1=25.;#room temperature in degree celcius\n", + "T4=2.;#winter outside temperature in degree celcius\n", + "h1=10.;#heat transfer coefficient on inner window surfaces in W/m^2 oc\n", + "h4=30.;#heat transfer coefficient on outer window surfaces in W/m^2 oc\n", + "k=0.78;#thermal conductivity of glass in W/m^2 oc\n", + "A=75.*10**-2*100.*10**-2;#area in m^2\n", + "deltax=10.*10**-3;#glass thickness in m\n", + "print(\"R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\")\n", + "print(\"R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\")\n", + "print(\"R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\")\n", + "print(\"total thermal resistance,R_total=R1+R2+R3 in oc/W\")\n", + "R_total=1/(h1*A)+deltax/(k*A)+1/(h4*A)\n", + "Q=(T1-T4)/R_total\n", + "print(\"so rate of heat transfer,Q=(T1-T4)/R_total in W\"),round(Q,2)\n", + "print(\"heat transfer rate from inside of room to inside surface of glass window.\")\n", + "R1=(1/7.5);\n", + "T2=T1-Q*R1\n", + "print(\"Q=(T1-T2)/R1\")\n", + "print(\"so T2=T1-Q*R1 in degree celcius\"),round(T2,2)\n", + "print(\"Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\") \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.6;pg no: 488" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.6, Page:488 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\n", + "reynolds number,Re=V*D/v\n", + "subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\n", + "or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\n", + "so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\n", + "rate of heat transfer due to convection,Q in W \n", + "Q=h*A*(T2-T1)= 61259.36\n", + "so heat transfer rate=61259.38 W\n" + ] + } + ], + "source": [ + "#cal of heat transfer rate\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.6, Page:488 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\")\n", + "D=4*10**-2;#inner diameter in m\n", + "L=3;#length in m\n", + "V=1;#velocity of water in m/s\n", + "T1=40;#mean temperature in degree celcius\n", + "T2=75;#pipe wall temperature in degree celcius \n", + "k=0.6;#conductivity of water in W/m\n", + "Pr=3;#prandtl no.\n", + "v=0.478*10**-6;#viscocity in m^2/s\n", + "print(\"reynolds number,Re=V*D/v\")\n", + "Re=V*D/v\n", + "print(\"subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\")\n", + "print(\"or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\")\n", + "print(\"so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\")\n", + "h=(k/D)*0.023*(Re)**0.8*(Pr)**0.4 \n", + "print(\"rate of heat transfer due to convection,Q in W \") \n", + "Q=h*(math.pi*D*L)*(T2-T1)\n", + "print(\"Q=h*A*(T2-T1)=\"),round(Q,2)\n", + "print(\"so heat transfer rate=61259.38 W\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.7;pg no: 489" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.7, Page:489 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\n", + "Let the temperature of water at exit be T\n", + "Heat exchanger,Q=heat rejected by glasses=heat gained by water\n", + "Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\n", + "so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\n", + "and Q in KJ\n", + "deltaT_in=T1-T3 in degree celcius\n", + "deltaT_out=T2-T in degree celcius\n", + "for parallel flow heat exchanger,\n", + "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\n", + "also,Q=U*A*LMTD\n", + "so A=Q/(U*LMTD) in m^2 5.937\n", + "surface area,A=5.936 m^2\n" + ] + } + ], + "source": [ + "#cal of surface area\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.7, Page:489 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\")\n", + "m=0.5;#hot gases flowing rate in kg/s\n", + "T1=500;#initial temperature of gas in degree celcius\n", + "T2=150;#final temperature of gas in degree celcius\n", + "Cg=1.2;#specific heat of gas in KJ/kg K\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "U=150;#overall heat transfer coefficient in W/m^2 K\n", + "mw=1;#mass of water in kg/s\n", + "T3=10;#water entering temperature in degree celcius\n", + "print(\"Let the temperature of water at exit be T\")\n", + "print(\"Heat exchanger,Q=heat rejected by glasses=heat gained by water\")\n", + "print(\"Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\")\n", + "print(\"so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\")\n", + "T=T3+(m*Cg*(T1-T2)/(mw*Cw))\n", + "print(\"and Q in KJ\")\n", + "Q=m*Cg*(T1-T2)\n", + "print(\"deltaT_in=T1-T3 in degree celcius\")\n", + "deltaT_in=T1-T3\n", + "print(\"deltaT_out=T2-T in degree celcius\")\n", + "deltaT_out=T2-T\n", + "print(\"for parallel flow heat exchanger,\")\n", + "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\")\n", + "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", + "print(\"also,Q=U*A*LMTD\")\n", + "A=Q*10**3/(U*LMTD)\n", + "print(\"so A=Q/(U*LMTD) in m^2\"),round(A,3)\n", + "print(\"surface area,A=5.936 m^2\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.8;pg no: 490" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.8, Page:490 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\n", + "This oil cooler has arrangement similar to a counter flow heat exchanger.\n", + "by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\n", + "so Q in KJ/min\n", + "and T=Th_out+(Q/(mh*Cph))in degree celcius\n", + "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \n", + "here deltaT_in=Tc_out-T in degree celcius\n", + "deltaT_out=Th_in-Th_out in degree celcius\n", + "so LMTD in degree celcius\n", + "substituting in,Q=U*A*LMTD\n", + "A=(Q*10^3/60)/(U*LMTD)in m^2 132.81\n", + "so surface area=132.85 m^2\n" + ] + } + ], + "source": [ + "#cal of surface area\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.8, Page:490 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\")\n", + "mc=20;#mass of oil in kg/min \n", + "Tc_out=100;#initial temperature of oil in degree celcius\n", + "Th_in=30;#final temperature of oil in degree celcius\n", + "Th_out=25;#temperature of water in degree celcius\n", + "Cpc=2;#specific heat of oil in KJ/kg K\n", + "Cph=4.18;#specific heat of water in KJ/kg K\n", + "mh=15;#water flow rate in kg/min\n", + "U=25;#overall heat transfer coefficient in W/m^2 K\n", + "print(\"This oil cooler has arrangement similar to a counter flow heat exchanger.\")\n", + "print(\"by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\")\n", + "print(\"so Q in KJ/min\")\n", + "Q=mc*Cpc*(Tc_out-Th_in)\n", + "print(\"and T=Th_out+(Q/(mh*Cph))in degree celcius\")\n", + "T=Th_out+(Q/(mh*Cph))\n", + "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \")\n", + "print(\"here deltaT_in=Tc_out-T in degree celcius\")\n", + "deltaT_in=Tc_out-T\n", + "print(\"deltaT_out=Th_in-Th_out in degree celcius\")\n", + "deltaT_out=Th_in-Th_out\n", + "print(\"so LMTD in degree celcius\")\n", + "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", + "print(\"substituting in,Q=U*A*LMTD\")\n", + "A=(Q*10**3/60)/(U*LMTD)\n", + "print(\"A=(Q*10^3/60)/(U*LMTD)in m^2\"),round(A,2)\n", + "print(\"so surface area=132.85 m^2\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.9;pg no: 490" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.9, Page:490 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\n", + "rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\n", + "heat loss per unit area by radiation(Q)in W\n", + "Q= 93597.71\n" + ] + } + ], + "source": [ + "#cal of heat loss per unit area by radiation\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.9, Page:490 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\")\n", + "T1=(1200+273);#temperature of body in K\n", + "T2=(600+273);#temperature of black surrounding in K\n", + "epsilon=0.4;#emissivity of body at 1200 degree celcius\n", + "sigma=5.67*10**-8;#stephen boltzman constant in W/m^2 K^4\n", + "print(\"rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\")\n", + "print(\"heat loss per unit area by radiation(Q)in W\")\n", + "Q=epsilon*sigma*(T1**4-T2**4)\n", + "print(\"Q=\"),round(Q,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.10;pg no: 491" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.10, Page:491 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\n", + "Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\n", + "Q=V*I in W\n", + "For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\n", + "surface area for heat transfer,A2=2*%pi*r*L in m^2\n", + "R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\n", + "R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\n", + "Total resistance,R_total=R1+R2 in oc/W\n", + "Q=(T3-T1)/R_total\n", + "so T3 in degree celcius= 98.28\n", + "so temperature at interface=125.12 degree celcius\n", + "critical radius of insulation,rc in m= 0.01\n", + "rc in mm 10.67\n", + "This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\n", + "NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\n" + ] + } + ], + "source": [ + "#cal of temperature at interface\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.10, Page:491 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\")\n", + "V=16.;#voltage drop in V\n", + "I=5.;#current in cable in A\n", + "r2=8.*10.**-3/2.;#outer cable radius in m\n", + "r3=3.*10.**-3/2.;#copper wire radius in m\n", + "k=0.16;#thermal conductivity of copper wire in W/m oc\n", + "L=5.;#length of cable in m\n", + "h1=15.;#heat transfer coefficient of cable in W/m^2 oc\n", + "T1=40.;#temperature of surrounding in degree celcius\n", + "print(\"Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\")\n", + "print(\"Q=V*I in W\")\n", + "Q=V*I\n", + "print(\"For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\")\n", + "print(\"surface area for heat transfer,A2=2*%pi*r*L in m^2\")\n", + "A2=2.*math.pi*r2*L\n", + "A2=0.125;#approx.\n", + "print(\"R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\")\n", + "print(\"R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\")\n", + "print(\"Total resistance,R_total=R1+R2 in oc/W\")\n", + "R_total=(1/(h1*A2))+(math.log(r2/r3)/(2.*math.pi*k*L))\n", + "print(\"Q=(T3-T1)/R_total\")\n", + "T3=T1+Q*R_total\n", + "print(\"so T3 in degree celcius=\"),round(T3,2)\n", + "print(\"so temperature at interface=125.12 degree celcius\")\n", + "rc=k/h1\n", + "print(\"critical radius of insulation,rc in m=\"),round(rc,2)\n", + "print(\"rc in mm\"),round(rc*1000,2)\n", + "print(\"This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\")\n", + "print(\"NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.11;pg no: 492" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.11, Page:492 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\n", + "for maximum heat transfer the critical radius of insulation should be used.\n", + "critical radius of insulation(rc)=k/h in mm\n", + "economical thickness of insulation(t)=rc-r_wire in mm\n", + "so economical thickness of insulation=7 mm\n", + "heat convected from cable surface to environment,Q in W\n", + "Q= 35.2\n", + "so heat transferred per unit length=35.2 W\n" + ] + } + ], + "source": [ + "#cal of heat transferred per unit length\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.11, Page:492 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\")\n", + "r_wire=3;#radius of electric wire in mm\n", + "k=0.16;#thermal conductivity in W/m oc\n", + "T_surrounding=45;#temperature of surrounding in degree celcius\n", + "T_surface=80;#temperature of surface in degree celcius\n", + "h=16;#heat transfer cooefficient in W/m^2 oc\n", + "print(\"for maximum heat transfer the critical radius of insulation should be used.\")\n", + "print(\"critical radius of insulation(rc)=k/h in mm\")\n", + "rc=k*1000/h\n", + "print(\"economical thickness of insulation(t)=rc-r_wire in mm\")\n", + "t=rc-r_wire\n", + "print(\"so economical thickness of insulation=7 mm\")\n", + "print(\"heat convected from cable surface to environment,Q in W\")\n", + "L=1;#length in mm\n", + "Q=2*math.pi*rc*L*h*(T_surface-T_surrounding)*10**-3\n", + "print(\"Q=\"),round(Q,1)\n", + "print(\"so heat transferred per unit length=35.2 W\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.12;pg no: 492" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.12, Page:492 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\n", + "heat transfer through concentric sphere,Q in KJ/hr \n", + "Q= -6297.1\n", + "so heat exchange=6297.1 KJ/hr\n" + ] + } + ], + "source": [ + "#cal of heat exchange\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.12, Page:492 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\")\n", + "T1=(-150+273);#temperature of air inside in K\n", + "T2=(35+273);#temperature of outer surface in K\n", + "epsilon1=0.03;#emissivity\n", + "epsilon2=epsilon1;\n", + "D1=25*10**-2;#diameter of inner sphere in m\n", + "D2=30*10**-2;#diameter of outer sphere in m\n", + "sigma=2.04*10**-4;#stephen boltzmann constant in KJ/m^2 hr K^4\n", + "print(\"heat transfer through concentric sphere,Q in KJ/hr \")\n", + "A1=4*math.pi*D1**2/4;\n", + "A2=4*math.pi*D2**2/4;\n", + "Q=(A1*sigma*(T1**4-T2**4))/((1/epsilon1)+((A1/A2)*((1/epsilon2)-1)))\n", + "print(\"Q=\"),round(Q,2)\n", + "print(\"so heat exchange=6297.1 KJ/hr\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter12_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter12_1.ipynb new file mode 100755 index 00000000..f89e1b1a --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter12_1.ipynb @@ -0,0 +1,818 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12:Introduction to Heat Transfer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.1;pg no: 483" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.1, Page:483 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\n", + "here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\n", + "overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\n", + "(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\n", + "so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", + "rate of heat transfer,Q in W= 10590.0\n", + "so rate of heat transfer=10590 W\n", + "heat transfer across states 1 and 3(at interface).\n", + "overall heat transfer coefficient between 1 and 3\n", + "(1/U1)=(1/h1)+(deltax_brick/k_brick)\n", + "so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\n", + "Q=U1*A*(T1-T3)\n", + "so T3=T1-(Q/(U1*A))in degree celcius 44.7\n", + "so temperature at interface of brick and wood =44.71 degree celcius\n" + ] + } + ], + "source": [ + "#cal of rate of heat transfer and temperature at interface of brick and wood\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.1, Page:483 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\")\n", + "h1=30.;#heat transfer coefficient on side of 50 oc in W/m^2 K\n", + "h5=10.;#heat transfer coefficient on side of 20 oc in W/m^2 K\n", + "k_brick=0.9;#conductivity of brick in W/m K\n", + "k_wood=0.15;#conductivity of wood in W/m K\n", + "T1=50.;#temperature of air on one side of wall in degree celcius\n", + "T5=20.;#temperature of air on other side of wall in degree celcius\n", + "A=100.;#surface area in m^2\n", + "deltax_brick=1.5*10**-2;#length of brick in m\n", + "deltax_wood=2*10**-2;#length of wood in m\n", + "print(\"here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\")\n", + "print(\"overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\")\n", + "print(\"(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\")\n", + "print(\"so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\")\n", + "U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", + "U=3.53;#approx.\n", + "Q=U*A*(T1-T5)\n", + "print(\"rate of heat transfer,Q in W=\"),round(Q,2)\n", + "print(\"so rate of heat transfer=10590 W\")\n", + "print(\"heat transfer across states 1 and 3(at interface).\")\n", + "print(\"overall heat transfer coefficient between 1 and 3\")\n", + "print(\"(1/U1)=(1/h1)+(deltax_brick/k_brick)\")\n", + "print(\"so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\")\n", + "U1=1/((1/h1)+(deltax_brick/k_brick))\n", + "print(\"Q=U1*A*(T1-T3)\")\n", + "T3=T1-(Q/(U1*A))\n", + "print(\"so T3=T1-(Q/(U1*A))in degree celcius\"),round(T3,2)\n", + "print(\"so temperature at interface of brick and wood =44.71 degree celcius\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.2;pg no: 484" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.2, Page:484 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\n", + "here thermal resistances are\n", + "R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\n", + "R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\n", + "R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\n", + "R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\n", + "R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\n", + "overall heat transfer coefficient for one dimentional steady state heat transfer\n", + "(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\n", + "so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\n", + "rate of heat transfer(Q) in KJ/m^2 hr= 112.0\n", + "wall surface area(A) in m^2\n", + "so rate of heat transfer=112 KJ/m^2 hr \n", + "Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\n", + "Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\n", + "substituting,T2 in degree celcius= 23.6\n", + "so temperature of outer wall,T2=23.6 oc\n", + "T3 in degree= 23.6\n", + "so temperature at interface of outer steel wall and wool,T3=23.59 oc\n", + "T4 in degree celcius= 6.1\n", + "so temperature at interface of wool and inside steel wall,T4=6.09 oc\n", + "T5 in degree celcius= 6.1\n", + "so temperature at inside of inner steel wall,T5=6.08 oc\n" + ] + } + ], + "source": [ + "#cal of rate of heat transfer,temperatures\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.2, Page:484 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\")\n", + "h1=40;#average heat transfer coefficient at inner surface in KJ/m^2 hr oc\n", + "h6=50;#average heat transfer coefficient at outer surface in KJ/m^2 hr oc\n", + "deltax_steel=2*10**-3;#mild steel sheets thickness in m\n", + "deltax_wool=5*10**-2;#thickness of glass wool insulation in m\n", + "k_wool=0.16;#thermal conductivity of wool in KJ/m hr\n", + "k_steel=160;#thermal conductivity of steel in KJ/m hr\n", + "T1=25;#kitchen temperature in degree celcius\n", + "T6=5;#refrigerator temperature in degree celcius\n", + "print(\"here thermal resistances are\")\n", + "print(\"R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\")\n", + "print(\"R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\")\n", + "print(\"R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\")\n", + "print(\"R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\")\n", + "print(\"R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\")\n", + "print(\"overall heat transfer coefficient for one dimentional steady state heat transfer\")\n", + "print(\"(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\")\n", + "print(\"so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\")\n", + "U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))\n", + "U=2.8;#approx.\n", + "A=4*(1*0.5)\n", + "Q=U*A*(T1-T6)\n", + "print(\"rate of heat transfer(Q) in KJ/m^2 hr=\"),round(Q,2)\n", + "print(\"wall surface area(A) in m^2\")\n", + "print(\"so rate of heat transfer=112 KJ/m^2 hr \")\n", + "print(\"Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\")\n", + "print(\"Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\")\n", + "T2=T1-(Q/(A*h1))\n", + "print(\"substituting,T2 in degree celcius=\"),round(T2,1)\n", + "print(\"so temperature of outer wall,T2=23.6 oc\")\n", + "T3=T2-(Q*deltax_steel/(k_steel*A))\n", + "print(\"T3 in degree= \"),round(T3,2)\n", + "print(\"so temperature at interface of outer steel wall and wool,T3=23.59 oc\")\n", + "T4=T3-(Q*deltax_wool/(k_wool*A))\n", + "print(\"T4 in degree celcius=\"),round(T4,2)\n", + "print(\"so temperature at interface of wool and inside steel wall,T4=6.09 oc\")\n", + "T5=T4-(Q*deltax_steel/(k_steel*A))\n", + "print(\"T5 in degree celcius=\"),round(T5,2)\n", + "print(\"so temperature at inside of inner steel wall,T5=6.08 oc\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.3;pg no: 486" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.3, Page:486 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\n", + "here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\n", + "Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\n", + "so heat loss per meter from pipe in KJ/hr= 1479.77\n", + "heat loss from 5 m length(Q) in KJ/hr 7396.7\n", + "enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\n", + "mass flow of steam(m)in kg/hr\n", + "final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\n", + "let quality of steam at exit be x,\n", + "also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\n", + "h=hf+x*hfg\n", + "so x=(h-hf)/hfg 0.8245\n", + "so quality of steam at exit=0.8245\n" + ] + } + ], + "source": [ + "#cal of heat loss per meter from pipe and quality of steam\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.3, Page:486 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\")\n", + "k_insulation=0.3;#thermal conductivity of insulation in KJ/m hr oc\n", + "k_pipe=209;#thermal conductivity of pipe in KJ/m hr oc\n", + "T1=300;#temperature of inner surface of steam pipe in degree celcius\n", + "T3=50;#temperature of outer surface of insulation layer in degree celcius\n", + "r1=15*10**-2/2;#steam pipe inner radius without insulation in m\n", + "r2=16*10**-2/2;#steam pipe outer radius without insulation in m\n", + "r3=22*10**-2/2;#radius with insulation in m\n", + "m=0.5;#steam entering rate in kg/min\n", + "print(\"here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\")\n", + "print(\"Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\")\n", + "L=1;\n", + "Q=(T1-T3)*2*math.pi*L/((1/k_pipe)*math.log(r2/r1)+(1/k_insulation*math.log(r3/r2)))\n", + "print(\"so heat loss per meter from pipe in KJ/hr=\"),round(Q,2)\n", + "Q=5*Q\n", + "print(\"heat loss from 5 m length(Q) in KJ/hr\"),round(5*1479.34,2)\n", + "print(\"enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\")\n", + "hg=2749;\n", + "print(\"mass flow of steam(m)in kg/hr\")\n", + "m=m*60\n", + "print(\"final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\")\n", + "h=hg-(Q/m)\n", + "print(\"let quality of steam at exit be x,\")\n", + "print(\"also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\")\n", + "hf=1344;\n", + "hfg=1404.9;\n", + "print(\"h=hf+x*hfg\")\n", + "x=(h-hf)/hfg\n", + "print(\"so x=(h-hf)/hfg\"),round(x,4)\n", + "print(\"so quality of steam at exit=0.8245\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.4;pg no: 487" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.4, Page:487 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\n", + "considering one dimensional heat transfer of steady state type\n", + "for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr 168892.02\n", + "so heat transfer rate=168892.02 KJ/hr\n", + "heat flux in KJ/m^2 hr= 23893.33\n", + "so heat flux=23893.33 KJ/m^2 hr\n" + ] + } + ], + "source": [ + "#cal of amount of heat transfer and heat flux\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.4, Page:487 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\")\n", + "r1=150.*10**-2/2;#inner radius in m\n", + "r2=200.*10**-2/2;#outer radius in m\n", + "k=28.;#thermal conductivity in KJ m hr oc\n", + "T1=200.;#inside surface temperature in degree celcius\n", + "T2=40.;#outer surface temperature in degree celcius\n", + "print(\"considering one dimensional heat transfer of steady state type\")\n", + "Q=(T1-T2)*4*math.pi*k*r1*r2/(r2-r1)\n", + "print(\"for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr\"),round(Q,2)\n", + "print(\"so heat transfer rate=168892.02 KJ/hr\")\n", + "Q/(4*math.pi*r1**2)\n", + "print(\"heat flux in KJ/m^2 hr=\"),round(Q/(4*math.pi*r1**2),2)\n", + "print(\"so heat flux=23893.33 KJ/m^2 hr\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.5;pg no: 487" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.5, Page:487 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\n", + "R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\n", + "R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\n", + "R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\n", + "total thermal resistance,R_total=R1+R2+R3 in oc/W\n", + "so rate of heat transfer,Q=(T1-T4)/R_total in W 118.03\n", + "heat transfer rate from inside of room to inside surface of glass window.\n", + "Q=(T1-T2)/R1\n", + "so T2=T1-Q*R1 in degree celcius 9.26\n", + "Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\n" + ] + } + ], + "source": [ + "#cal of heat transfer rate\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.5, Page:487 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\")\n", + "T1=25.;#room temperature in degree celcius\n", + "T4=2.;#winter outside temperature in degree celcius\n", + "h1=10.;#heat transfer coefficient on inner window surfaces in W/m^2 oc\n", + "h4=30.;#heat transfer coefficient on outer window surfaces in W/m^2 oc\n", + "k=0.78;#thermal conductivity of glass in W/m^2 oc\n", + "A=75.*10**-2*100.*10**-2;#area in m^2\n", + "deltax=10.*10**-3;#glass thickness in m\n", + "print(\"R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\")\n", + "print(\"R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\")\n", + "print(\"R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\")\n", + "print(\"total thermal resistance,R_total=R1+R2+R3 in oc/W\")\n", + "R_total=1/(h1*A)+deltax/(k*A)+1/(h4*A)\n", + "Q=(T1-T4)/R_total\n", + "print(\"so rate of heat transfer,Q=(T1-T4)/R_total in W\"),round(Q,2)\n", + "print(\"heat transfer rate from inside of room to inside surface of glass window.\")\n", + "R1=(1/7.5);\n", + "T2=T1-Q*R1\n", + "print(\"Q=(T1-T2)/R1\")\n", + "print(\"so T2=T1-Q*R1 in degree celcius\"),round(T2,2)\n", + "print(\"Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\") \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.6;pg no: 488" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.6, Page:488 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\n", + "reynolds number,Re=V*D/v\n", + "subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\n", + "or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\n", + "so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\n", + "rate of heat transfer due to convection,Q in W \n", + "Q=h*A*(T2-T1)= 61259.36\n", + "so heat transfer rate=61259.38 W\n" + ] + } + ], + "source": [ + "#cal of heat transfer rate\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.6, Page:488 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\")\n", + "D=4*10**-2;#inner diameter in m\n", + "L=3;#length in m\n", + "V=1;#velocity of water in m/s\n", + "T1=40;#mean temperature in degree celcius\n", + "T2=75;#pipe wall temperature in degree celcius \n", + "k=0.6;#conductivity of water in W/m\n", + "Pr=3;#prandtl no.\n", + "v=0.478*10**-6;#viscocity in m^2/s\n", + "print(\"reynolds number,Re=V*D/v\")\n", + "Re=V*D/v\n", + "print(\"subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\")\n", + "print(\"or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\")\n", + "print(\"so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\")\n", + "h=(k/D)*0.023*(Re)**0.8*(Pr)**0.4 \n", + "print(\"rate of heat transfer due to convection,Q in W \") \n", + "Q=h*(math.pi*D*L)*(T2-T1)\n", + "print(\"Q=h*A*(T2-T1)=\"),round(Q,2)\n", + "print(\"so heat transfer rate=61259.38 W\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.7;pg no: 489" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.7, Page:489 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\n", + "Let the temperature of water at exit be T\n", + "Heat exchanger,Q=heat rejected by glasses=heat gained by water\n", + "Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\n", + "so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\n", + "and Q in KJ\n", + "deltaT_in=T1-T3 in degree celcius\n", + "deltaT_out=T2-T in degree celcius\n", + "for parallel flow heat exchanger,\n", + "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\n", + "also,Q=U*A*LMTD\n", + "so A=Q/(U*LMTD) in m^2 5.937\n", + "surface area,A=5.936 m^2\n" + ] + } + ], + "source": [ + "#cal of surface area\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.7, Page:489 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\")\n", + "m=0.5;#hot gases flowing rate in kg/s\n", + "T1=500;#initial temperature of gas in degree celcius\n", + "T2=150;#final temperature of gas in degree celcius\n", + "Cg=1.2;#specific heat of gas in KJ/kg K\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "U=150;#overall heat transfer coefficient in W/m^2 K\n", + "mw=1;#mass of water in kg/s\n", + "T3=10;#water entering temperature in degree celcius\n", + "print(\"Let the temperature of water at exit be T\")\n", + "print(\"Heat exchanger,Q=heat rejected by glasses=heat gained by water\")\n", + "print(\"Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\")\n", + "print(\"so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\")\n", + "T=T3+(m*Cg*(T1-T2)/(mw*Cw))\n", + "print(\"and Q in KJ\")\n", + "Q=m*Cg*(T1-T2)\n", + "print(\"deltaT_in=T1-T3 in degree celcius\")\n", + "deltaT_in=T1-T3\n", + "print(\"deltaT_out=T2-T in degree celcius\")\n", + "deltaT_out=T2-T\n", + "print(\"for parallel flow heat exchanger,\")\n", + "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\")\n", + "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", + "print(\"also,Q=U*A*LMTD\")\n", + "A=Q*10**3/(U*LMTD)\n", + "print(\"so A=Q/(U*LMTD) in m^2\"),round(A,3)\n", + "print(\"surface area,A=5.936 m^2\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.8;pg no: 490" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.8, Page:490 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\n", + "This oil cooler has arrangement similar to a counter flow heat exchanger.\n", + "by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\n", + "so Q in KJ/min\n", + "and T=Th_out+(Q/(mh*Cph))in degree celcius\n", + "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \n", + "here deltaT_in=Tc_out-T in degree celcius\n", + "deltaT_out=Th_in-Th_out in degree celcius\n", + "so LMTD in degree celcius\n", + "substituting in,Q=U*A*LMTD\n", + "A=(Q*10^3/60)/(U*LMTD)in m^2 132.81\n", + "so surface area=132.85 m^2\n" + ] + } + ], + "source": [ + "#cal of surface area\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.8, Page:490 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\")\n", + "mc=20;#mass of oil in kg/min \n", + "Tc_out=100;#initial temperature of oil in degree celcius\n", + "Th_in=30;#final temperature of oil in degree celcius\n", + "Th_out=25;#temperature of water in degree celcius\n", + "Cpc=2;#specific heat of oil in KJ/kg K\n", + "Cph=4.18;#specific heat of water in KJ/kg K\n", + "mh=15;#water flow rate in kg/min\n", + "U=25;#overall heat transfer coefficient in W/m^2 K\n", + "print(\"This oil cooler has arrangement similar to a counter flow heat exchanger.\")\n", + "print(\"by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\")\n", + "print(\"so Q in KJ/min\")\n", + "Q=mc*Cpc*(Tc_out-Th_in)\n", + "print(\"and T=Th_out+(Q/(mh*Cph))in degree celcius\")\n", + "T=Th_out+(Q/(mh*Cph))\n", + "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \")\n", + "print(\"here deltaT_in=Tc_out-T in degree celcius\")\n", + "deltaT_in=Tc_out-T\n", + "print(\"deltaT_out=Th_in-Th_out in degree celcius\")\n", + "deltaT_out=Th_in-Th_out\n", + "print(\"so LMTD in degree celcius\")\n", + "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", + "print(\"substituting in,Q=U*A*LMTD\")\n", + "A=(Q*10**3/60)/(U*LMTD)\n", + "print(\"A=(Q*10^3/60)/(U*LMTD)in m^2\"),round(A,2)\n", + "print(\"so surface area=132.85 m^2\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.9;pg no: 490" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.9, Page:490 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\n", + "rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\n", + "heat loss per unit area by radiation(Q)in W\n", + "Q= 93597.71\n" + ] + } + ], + "source": [ + "#cal of heat loss per unit area by radiation\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.9, Page:490 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\")\n", + "T1=(1200+273);#temperature of body in K\n", + "T2=(600+273);#temperature of black surrounding in K\n", + "epsilon=0.4;#emissivity of body at 1200 degree celcius\n", + "sigma=5.67*10**-8;#stephen boltzman constant in W/m^2 K^4\n", + "print(\"rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\")\n", + "print(\"heat loss per unit area by radiation(Q)in W\")\n", + "Q=epsilon*sigma*(T1**4-T2**4)\n", + "print(\"Q=\"),round(Q,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.10;pg no: 491" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.10, Page:491 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\n", + "Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\n", + "Q=V*I in W\n", + "For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\n", + "surface area for heat transfer,A2=2*%pi*r*L in m^2\n", + "R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\n", + "R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\n", + "Total resistance,R_total=R1+R2 in oc/W\n", + "Q=(T3-T1)/R_total\n", + "so T3 in degree celcius= 98.28\n", + "so temperature at interface=125.12 degree celcius\n", + "critical radius of insulation,rc in m= 0.01\n", + "rc in mm 10.67\n", + "This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\n", + "NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\n" + ] + } + ], + "source": [ + "#cal of temperature at interface\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.10, Page:491 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\")\n", + "V=16.;#voltage drop in V\n", + "I=5.;#current in cable in A\n", + "r2=8.*10.**-3/2.;#outer cable radius in m\n", + "r3=3.*10.**-3/2.;#copper wire radius in m\n", + "k=0.16;#thermal conductivity of copper wire in W/m oc\n", + "L=5.;#length of cable in m\n", + "h1=15.;#heat transfer coefficient of cable in W/m^2 oc\n", + "T1=40.;#temperature of surrounding in degree celcius\n", + "print(\"Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\")\n", + "print(\"Q=V*I in W\")\n", + "Q=V*I\n", + "print(\"For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\")\n", + "print(\"surface area for heat transfer,A2=2*%pi*r*L in m^2\")\n", + "A2=2.*math.pi*r2*L\n", + "A2=0.125;#approx.\n", + "print(\"R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\")\n", + "print(\"R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\")\n", + "print(\"Total resistance,R_total=R1+R2 in oc/W\")\n", + "R_total=(1/(h1*A2))+(math.log(r2/r3)/(2.*math.pi*k*L))\n", + "print(\"Q=(T3-T1)/R_total\")\n", + "T3=T1+Q*R_total\n", + "print(\"so T3 in degree celcius=\"),round(T3,2)\n", + "print(\"so temperature at interface=125.12 degree celcius\")\n", + "rc=k/h1\n", + "print(\"critical radius of insulation,rc in m=\"),round(rc,2)\n", + "print(\"rc in mm\"),round(rc*1000,2)\n", + "print(\"This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\")\n", + "print(\"NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.11;pg no: 492" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.11, Page:492 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\n", + "for maximum heat transfer the critical radius of insulation should be used.\n", + "critical radius of insulation(rc)=k/h in mm\n", + "economical thickness of insulation(t)=rc-r_wire in mm\n", + "so economical thickness of insulation=7 mm\n", + "heat convected from cable surface to environment,Q in W\n", + "Q= 35.2\n", + "so heat transferred per unit length=35.2 W\n" + ] + } + ], + "source": [ + "#cal of heat transferred per unit length\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.11, Page:492 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\")\n", + "r_wire=3;#radius of electric wire in mm\n", + "k=0.16;#thermal conductivity in W/m oc\n", + "T_surrounding=45;#temperature of surrounding in degree celcius\n", + "T_surface=80;#temperature of surface in degree celcius\n", + "h=16;#heat transfer cooefficient in W/m^2 oc\n", + "print(\"for maximum heat transfer the critical radius of insulation should be used.\")\n", + "print(\"critical radius of insulation(rc)=k/h in mm\")\n", + "rc=k*1000/h\n", + "print(\"economical thickness of insulation(t)=rc-r_wire in mm\")\n", + "t=rc-r_wire\n", + "print(\"so economical thickness of insulation=7 mm\")\n", + "print(\"heat convected from cable surface to environment,Q in W\")\n", + "L=1;#length in mm\n", + "Q=2*math.pi*rc*L*h*(T_surface-T_surrounding)*10**-3\n", + "print(\"Q=\"),round(Q,1)\n", + "print(\"so heat transferred per unit length=35.2 W\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.12;pg no: 492" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.12, Page:492 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\n", + "heat transfer through concentric sphere,Q in KJ/hr \n", + "Q= -6297.1\n", + "so heat exchange=6297.1 KJ/hr\n" + ] + } + ], + "source": [ + "#cal of heat exchange\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.12, Page:492 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\")\n", + "T1=(-150+273);#temperature of air inside in K\n", + "T2=(35+273);#temperature of outer surface in K\n", + "epsilon1=0.03;#emissivity\n", + "epsilon2=epsilon1;\n", + "D1=25*10**-2;#diameter of inner sphere in m\n", + "D2=30*10**-2;#diameter of outer sphere in m\n", + "sigma=2.04*10**-4;#stephen boltzmann constant in KJ/m^2 hr K^4\n", + "print(\"heat transfer through concentric sphere,Q in KJ/hr \")\n", + "A1=4*math.pi*D1**2/4;\n", + "A2=4*math.pi*D2**2/4;\n", + "Q=(A1*sigma*(T1**4-T2**4))/((1/epsilon1)+((A1/A2)*((1/epsilon2)-1)))\n", + "print(\"Q=\"),round(Q,2)\n", + "print(\"so heat exchange=6297.1 KJ/hr\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter12_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter12_2.ipynb new file mode 100755 index 00000000..f89e1b1a --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter12_2.ipynb @@ -0,0 +1,818 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12:Introduction to Heat Transfer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.1;pg no: 483" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.1, Page:483 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\n", + "here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\n", + "overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\n", + "(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\n", + "so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", + "rate of heat transfer,Q in W= 10590.0\n", + "so rate of heat transfer=10590 W\n", + "heat transfer across states 1 and 3(at interface).\n", + "overall heat transfer coefficient between 1 and 3\n", + "(1/U1)=(1/h1)+(deltax_brick/k_brick)\n", + "so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\n", + "Q=U1*A*(T1-T3)\n", + "so T3=T1-(Q/(U1*A))in degree celcius 44.7\n", + "so temperature at interface of brick and wood =44.71 degree celcius\n" + ] + } + ], + "source": [ + "#cal of rate of heat transfer and temperature at interface of brick and wood\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.1, Page:483 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\")\n", + "h1=30.;#heat transfer coefficient on side of 50 oc in W/m^2 K\n", + "h5=10.;#heat transfer coefficient on side of 20 oc in W/m^2 K\n", + "k_brick=0.9;#conductivity of brick in W/m K\n", + "k_wood=0.15;#conductivity of wood in W/m K\n", + "T1=50.;#temperature of air on one side of wall in degree celcius\n", + "T5=20.;#temperature of air on other side of wall in degree celcius\n", + "A=100.;#surface area in m^2\n", + "deltax_brick=1.5*10**-2;#length of brick in m\n", + "deltax_wood=2*10**-2;#length of wood in m\n", + "print(\"here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\")\n", + "print(\"overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\")\n", + "print(\"(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\")\n", + "print(\"so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\")\n", + "U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", + "U=3.53;#approx.\n", + "Q=U*A*(T1-T5)\n", + "print(\"rate of heat transfer,Q in W=\"),round(Q,2)\n", + "print(\"so rate of heat transfer=10590 W\")\n", + "print(\"heat transfer across states 1 and 3(at interface).\")\n", + "print(\"overall heat transfer coefficient between 1 and 3\")\n", + "print(\"(1/U1)=(1/h1)+(deltax_brick/k_brick)\")\n", + "print(\"so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\")\n", + "U1=1/((1/h1)+(deltax_brick/k_brick))\n", + "print(\"Q=U1*A*(T1-T3)\")\n", + "T3=T1-(Q/(U1*A))\n", + "print(\"so T3=T1-(Q/(U1*A))in degree celcius\"),round(T3,2)\n", + "print(\"so temperature at interface of brick and wood =44.71 degree celcius\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.2;pg no: 484" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.2, Page:484 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\n", + "here thermal resistances are\n", + "R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\n", + "R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\n", + "R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\n", + "R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\n", + "R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\n", + "overall heat transfer coefficient for one dimentional steady state heat transfer\n", + "(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\n", + "so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\n", + "rate of heat transfer(Q) in KJ/m^2 hr= 112.0\n", + "wall surface area(A) in m^2\n", + "so rate of heat transfer=112 KJ/m^2 hr \n", + "Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\n", + "Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\n", + "substituting,T2 in degree celcius= 23.6\n", + "so temperature of outer wall,T2=23.6 oc\n", + "T3 in degree= 23.6\n", + "so temperature at interface of outer steel wall and wool,T3=23.59 oc\n", + "T4 in degree celcius= 6.1\n", + "so temperature at interface of wool and inside steel wall,T4=6.09 oc\n", + "T5 in degree celcius= 6.1\n", + "so temperature at inside of inner steel wall,T5=6.08 oc\n" + ] + } + ], + "source": [ + "#cal of rate of heat transfer,temperatures\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.2, Page:484 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\")\n", + "h1=40;#average heat transfer coefficient at inner surface in KJ/m^2 hr oc\n", + "h6=50;#average heat transfer coefficient at outer surface in KJ/m^2 hr oc\n", + "deltax_steel=2*10**-3;#mild steel sheets thickness in m\n", + "deltax_wool=5*10**-2;#thickness of glass wool insulation in m\n", + "k_wool=0.16;#thermal conductivity of wool in KJ/m hr\n", + "k_steel=160;#thermal conductivity of steel in KJ/m hr\n", + "T1=25;#kitchen temperature in degree celcius\n", + "T6=5;#refrigerator temperature in degree celcius\n", + "print(\"here thermal resistances are\")\n", + "print(\"R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\")\n", + "print(\"R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\")\n", + "print(\"R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\")\n", + "print(\"R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\")\n", + "print(\"R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\")\n", + "print(\"overall heat transfer coefficient for one dimentional steady state heat transfer\")\n", + "print(\"(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\")\n", + "print(\"so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\")\n", + "U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))\n", + "U=2.8;#approx.\n", + "A=4*(1*0.5)\n", + "Q=U*A*(T1-T6)\n", + "print(\"rate of heat transfer(Q) in KJ/m^2 hr=\"),round(Q,2)\n", + "print(\"wall surface area(A) in m^2\")\n", + "print(\"so rate of heat transfer=112 KJ/m^2 hr \")\n", + "print(\"Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\")\n", + "print(\"Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\")\n", + "T2=T1-(Q/(A*h1))\n", + "print(\"substituting,T2 in degree celcius=\"),round(T2,1)\n", + "print(\"so temperature of outer wall,T2=23.6 oc\")\n", + "T3=T2-(Q*deltax_steel/(k_steel*A))\n", + "print(\"T3 in degree= \"),round(T3,2)\n", + "print(\"so temperature at interface of outer steel wall and wool,T3=23.59 oc\")\n", + "T4=T3-(Q*deltax_wool/(k_wool*A))\n", + "print(\"T4 in degree celcius=\"),round(T4,2)\n", + "print(\"so temperature at interface of wool and inside steel wall,T4=6.09 oc\")\n", + "T5=T4-(Q*deltax_steel/(k_steel*A))\n", + "print(\"T5 in degree celcius=\"),round(T5,2)\n", + "print(\"so temperature at inside of inner steel wall,T5=6.08 oc\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.3;pg no: 486" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.3, Page:486 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\n", + "here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\n", + "Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\n", + "so heat loss per meter from pipe in KJ/hr= 1479.77\n", + "heat loss from 5 m length(Q) in KJ/hr 7396.7\n", + "enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\n", + "mass flow of steam(m)in kg/hr\n", + "final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\n", + "let quality of steam at exit be x,\n", + "also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\n", + "h=hf+x*hfg\n", + "so x=(h-hf)/hfg 0.8245\n", + "so quality of steam at exit=0.8245\n" + ] + } + ], + "source": [ + "#cal of heat loss per meter from pipe and quality of steam\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.3, Page:486 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\")\n", + "k_insulation=0.3;#thermal conductivity of insulation in KJ/m hr oc\n", + "k_pipe=209;#thermal conductivity of pipe in KJ/m hr oc\n", + "T1=300;#temperature of inner surface of steam pipe in degree celcius\n", + "T3=50;#temperature of outer surface of insulation layer in degree celcius\n", + "r1=15*10**-2/2;#steam pipe inner radius without insulation in m\n", + "r2=16*10**-2/2;#steam pipe outer radius without insulation in m\n", + "r3=22*10**-2/2;#radius with insulation in m\n", + "m=0.5;#steam entering rate in kg/min\n", + "print(\"here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\")\n", + "print(\"Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\")\n", + "L=1;\n", + "Q=(T1-T3)*2*math.pi*L/((1/k_pipe)*math.log(r2/r1)+(1/k_insulation*math.log(r3/r2)))\n", + "print(\"so heat loss per meter from pipe in KJ/hr=\"),round(Q,2)\n", + "Q=5*Q\n", + "print(\"heat loss from 5 m length(Q) in KJ/hr\"),round(5*1479.34,2)\n", + "print(\"enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\")\n", + "hg=2749;\n", + "print(\"mass flow of steam(m)in kg/hr\")\n", + "m=m*60\n", + "print(\"final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\")\n", + "h=hg-(Q/m)\n", + "print(\"let quality of steam at exit be x,\")\n", + "print(\"also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\")\n", + "hf=1344;\n", + "hfg=1404.9;\n", + "print(\"h=hf+x*hfg\")\n", + "x=(h-hf)/hfg\n", + "print(\"so x=(h-hf)/hfg\"),round(x,4)\n", + "print(\"so quality of steam at exit=0.8245\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.4;pg no: 487" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.4, Page:487 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\n", + "considering one dimensional heat transfer of steady state type\n", + "for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr 168892.02\n", + "so heat transfer rate=168892.02 KJ/hr\n", + "heat flux in KJ/m^2 hr= 23893.33\n", + "so heat flux=23893.33 KJ/m^2 hr\n" + ] + } + ], + "source": [ + "#cal of amount of heat transfer and heat flux\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.4, Page:487 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\")\n", + "r1=150.*10**-2/2;#inner radius in m\n", + "r2=200.*10**-2/2;#outer radius in m\n", + "k=28.;#thermal conductivity in KJ m hr oc\n", + "T1=200.;#inside surface temperature in degree celcius\n", + "T2=40.;#outer surface temperature in degree celcius\n", + "print(\"considering one dimensional heat transfer of steady state type\")\n", + "Q=(T1-T2)*4*math.pi*k*r1*r2/(r2-r1)\n", + "print(\"for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr\"),round(Q,2)\n", + "print(\"so heat transfer rate=168892.02 KJ/hr\")\n", + "Q/(4*math.pi*r1**2)\n", + "print(\"heat flux in KJ/m^2 hr=\"),round(Q/(4*math.pi*r1**2),2)\n", + "print(\"so heat flux=23893.33 KJ/m^2 hr\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.5;pg no: 487" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.5, Page:487 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\n", + "R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\n", + "R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\n", + "R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\n", + "total thermal resistance,R_total=R1+R2+R3 in oc/W\n", + "so rate of heat transfer,Q=(T1-T4)/R_total in W 118.03\n", + "heat transfer rate from inside of room to inside surface of glass window.\n", + "Q=(T1-T2)/R1\n", + "so T2=T1-Q*R1 in degree celcius 9.26\n", + "Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\n" + ] + } + ], + "source": [ + "#cal of heat transfer rate\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.5, Page:487 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\")\n", + "T1=25.;#room temperature in degree celcius\n", + "T4=2.;#winter outside temperature in degree celcius\n", + "h1=10.;#heat transfer coefficient on inner window surfaces in W/m^2 oc\n", + "h4=30.;#heat transfer coefficient on outer window surfaces in W/m^2 oc\n", + "k=0.78;#thermal conductivity of glass in W/m^2 oc\n", + "A=75.*10**-2*100.*10**-2;#area in m^2\n", + "deltax=10.*10**-3;#glass thickness in m\n", + "print(\"R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\")\n", + "print(\"R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\")\n", + "print(\"R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\")\n", + "print(\"total thermal resistance,R_total=R1+R2+R3 in oc/W\")\n", + "R_total=1/(h1*A)+deltax/(k*A)+1/(h4*A)\n", + "Q=(T1-T4)/R_total\n", + "print(\"so rate of heat transfer,Q=(T1-T4)/R_total in W\"),round(Q,2)\n", + "print(\"heat transfer rate from inside of room to inside surface of glass window.\")\n", + "R1=(1/7.5);\n", + "T2=T1-Q*R1\n", + "print(\"Q=(T1-T2)/R1\")\n", + "print(\"so T2=T1-Q*R1 in degree celcius\"),round(T2,2)\n", + "print(\"Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\") \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.6;pg no: 488" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.6, Page:488 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\n", + "reynolds number,Re=V*D/v\n", + "subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\n", + "or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\n", + "so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\n", + "rate of heat transfer due to convection,Q in W \n", + "Q=h*A*(T2-T1)= 61259.36\n", + "so heat transfer rate=61259.38 W\n" + ] + } + ], + "source": [ + "#cal of heat transfer rate\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.6, Page:488 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\")\n", + "D=4*10**-2;#inner diameter in m\n", + "L=3;#length in m\n", + "V=1;#velocity of water in m/s\n", + "T1=40;#mean temperature in degree celcius\n", + "T2=75;#pipe wall temperature in degree celcius \n", + "k=0.6;#conductivity of water in W/m\n", + "Pr=3;#prandtl no.\n", + "v=0.478*10**-6;#viscocity in m^2/s\n", + "print(\"reynolds number,Re=V*D/v\")\n", + "Re=V*D/v\n", + "print(\"subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\")\n", + "print(\"or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\")\n", + "print(\"so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\")\n", + "h=(k/D)*0.023*(Re)**0.8*(Pr)**0.4 \n", + "print(\"rate of heat transfer due to convection,Q in W \") \n", + "Q=h*(math.pi*D*L)*(T2-T1)\n", + "print(\"Q=h*A*(T2-T1)=\"),round(Q,2)\n", + "print(\"so heat transfer rate=61259.38 W\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.7;pg no: 489" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.7, Page:489 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\n", + "Let the temperature of water at exit be T\n", + "Heat exchanger,Q=heat rejected by glasses=heat gained by water\n", + "Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\n", + "so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\n", + "and Q in KJ\n", + "deltaT_in=T1-T3 in degree celcius\n", + "deltaT_out=T2-T in degree celcius\n", + "for parallel flow heat exchanger,\n", + "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\n", + "also,Q=U*A*LMTD\n", + "so A=Q/(U*LMTD) in m^2 5.937\n", + "surface area,A=5.936 m^2\n" + ] + } + ], + "source": [ + "#cal of surface area\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.7, Page:489 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\")\n", + "m=0.5;#hot gases flowing rate in kg/s\n", + "T1=500;#initial temperature of gas in degree celcius\n", + "T2=150;#final temperature of gas in degree celcius\n", + "Cg=1.2;#specific heat of gas in KJ/kg K\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "U=150;#overall heat transfer coefficient in W/m^2 K\n", + "mw=1;#mass of water in kg/s\n", + "T3=10;#water entering temperature in degree celcius\n", + "print(\"Let the temperature of water at exit be T\")\n", + "print(\"Heat exchanger,Q=heat rejected by glasses=heat gained by water\")\n", + "print(\"Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\")\n", + "print(\"so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\")\n", + "T=T3+(m*Cg*(T1-T2)/(mw*Cw))\n", + "print(\"and Q in KJ\")\n", + "Q=m*Cg*(T1-T2)\n", + "print(\"deltaT_in=T1-T3 in degree celcius\")\n", + "deltaT_in=T1-T3\n", + "print(\"deltaT_out=T2-T in degree celcius\")\n", + "deltaT_out=T2-T\n", + "print(\"for parallel flow heat exchanger,\")\n", + "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\")\n", + "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", + "print(\"also,Q=U*A*LMTD\")\n", + "A=Q*10**3/(U*LMTD)\n", + "print(\"so A=Q/(U*LMTD) in m^2\"),round(A,3)\n", + "print(\"surface area,A=5.936 m^2\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.8;pg no: 490" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.8, Page:490 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\n", + "This oil cooler has arrangement similar to a counter flow heat exchanger.\n", + "by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\n", + "so Q in KJ/min\n", + "and T=Th_out+(Q/(mh*Cph))in degree celcius\n", + "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \n", + "here deltaT_in=Tc_out-T in degree celcius\n", + "deltaT_out=Th_in-Th_out in degree celcius\n", + "so LMTD in degree celcius\n", + "substituting in,Q=U*A*LMTD\n", + "A=(Q*10^3/60)/(U*LMTD)in m^2 132.81\n", + "so surface area=132.85 m^2\n" + ] + } + ], + "source": [ + "#cal of surface area\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.8, Page:490 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\")\n", + "mc=20;#mass of oil in kg/min \n", + "Tc_out=100;#initial temperature of oil in degree celcius\n", + "Th_in=30;#final temperature of oil in degree celcius\n", + "Th_out=25;#temperature of water in degree celcius\n", + "Cpc=2;#specific heat of oil in KJ/kg K\n", + "Cph=4.18;#specific heat of water in KJ/kg K\n", + "mh=15;#water flow rate in kg/min\n", + "U=25;#overall heat transfer coefficient in W/m^2 K\n", + "print(\"This oil cooler has arrangement similar to a counter flow heat exchanger.\")\n", + "print(\"by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\")\n", + "print(\"so Q in KJ/min\")\n", + "Q=mc*Cpc*(Tc_out-Th_in)\n", + "print(\"and T=Th_out+(Q/(mh*Cph))in degree celcius\")\n", + "T=Th_out+(Q/(mh*Cph))\n", + "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \")\n", + "print(\"here deltaT_in=Tc_out-T in degree celcius\")\n", + "deltaT_in=Tc_out-T\n", + "print(\"deltaT_out=Th_in-Th_out in degree celcius\")\n", + "deltaT_out=Th_in-Th_out\n", + "print(\"so LMTD in degree celcius\")\n", + "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", + "print(\"substituting in,Q=U*A*LMTD\")\n", + "A=(Q*10**3/60)/(U*LMTD)\n", + "print(\"A=(Q*10^3/60)/(U*LMTD)in m^2\"),round(A,2)\n", + "print(\"so surface area=132.85 m^2\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.9;pg no: 490" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.9, Page:490 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\n", + "rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\n", + "heat loss per unit area by radiation(Q)in W\n", + "Q= 93597.71\n" + ] + } + ], + "source": [ + "#cal of heat loss per unit area by radiation\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.9, Page:490 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\")\n", + "T1=(1200+273);#temperature of body in K\n", + "T2=(600+273);#temperature of black surrounding in K\n", + "epsilon=0.4;#emissivity of body at 1200 degree celcius\n", + "sigma=5.67*10**-8;#stephen boltzman constant in W/m^2 K^4\n", + "print(\"rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\")\n", + "print(\"heat loss per unit area by radiation(Q)in W\")\n", + "Q=epsilon*sigma*(T1**4-T2**4)\n", + "print(\"Q=\"),round(Q,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.10;pg no: 491" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.10, Page:491 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\n", + "Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\n", + "Q=V*I in W\n", + "For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\n", + "surface area for heat transfer,A2=2*%pi*r*L in m^2\n", + "R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\n", + "R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\n", + "Total resistance,R_total=R1+R2 in oc/W\n", + "Q=(T3-T1)/R_total\n", + "so T3 in degree celcius= 98.28\n", + "so temperature at interface=125.12 degree celcius\n", + "critical radius of insulation,rc in m= 0.01\n", + "rc in mm 10.67\n", + "This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\n", + "NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\n" + ] + } + ], + "source": [ + "#cal of temperature at interface\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.10, Page:491 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\")\n", + "V=16.;#voltage drop in V\n", + "I=5.;#current in cable in A\n", + "r2=8.*10.**-3/2.;#outer cable radius in m\n", + "r3=3.*10.**-3/2.;#copper wire radius in m\n", + "k=0.16;#thermal conductivity of copper wire in W/m oc\n", + "L=5.;#length of cable in m\n", + "h1=15.;#heat transfer coefficient of cable in W/m^2 oc\n", + "T1=40.;#temperature of surrounding in degree celcius\n", + "print(\"Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\")\n", + "print(\"Q=V*I in W\")\n", + "Q=V*I\n", + "print(\"For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\")\n", + "print(\"surface area for heat transfer,A2=2*%pi*r*L in m^2\")\n", + "A2=2.*math.pi*r2*L\n", + "A2=0.125;#approx.\n", + "print(\"R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\")\n", + "print(\"R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\")\n", + "print(\"Total resistance,R_total=R1+R2 in oc/W\")\n", + "R_total=(1/(h1*A2))+(math.log(r2/r3)/(2.*math.pi*k*L))\n", + "print(\"Q=(T3-T1)/R_total\")\n", + "T3=T1+Q*R_total\n", + "print(\"so T3 in degree celcius=\"),round(T3,2)\n", + "print(\"so temperature at interface=125.12 degree celcius\")\n", + "rc=k/h1\n", + "print(\"critical radius of insulation,rc in m=\"),round(rc,2)\n", + "print(\"rc in mm\"),round(rc*1000,2)\n", + "print(\"This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\")\n", + "print(\"NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.11;pg no: 492" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.11, Page:492 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\n", + "for maximum heat transfer the critical radius of insulation should be used.\n", + "critical radius of insulation(rc)=k/h in mm\n", + "economical thickness of insulation(t)=rc-r_wire in mm\n", + "so economical thickness of insulation=7 mm\n", + "heat convected from cable surface to environment,Q in W\n", + "Q= 35.2\n", + "so heat transferred per unit length=35.2 W\n" + ] + } + ], + "source": [ + "#cal of heat transferred per unit length\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.11, Page:492 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\")\n", + "r_wire=3;#radius of electric wire in mm\n", + "k=0.16;#thermal conductivity in W/m oc\n", + "T_surrounding=45;#temperature of surrounding in degree celcius\n", + "T_surface=80;#temperature of surface in degree celcius\n", + "h=16;#heat transfer cooefficient in W/m^2 oc\n", + "print(\"for maximum heat transfer the critical radius of insulation should be used.\")\n", + "print(\"critical radius of insulation(rc)=k/h in mm\")\n", + "rc=k*1000/h\n", + "print(\"economical thickness of insulation(t)=rc-r_wire in mm\")\n", + "t=rc-r_wire\n", + "print(\"so economical thickness of insulation=7 mm\")\n", + "print(\"heat convected from cable surface to environment,Q in W\")\n", + "L=1;#length in mm\n", + "Q=2*math.pi*rc*L*h*(T_surface-T_surrounding)*10**-3\n", + "print(\"Q=\"),round(Q,1)\n", + "print(\"so heat transferred per unit length=35.2 W\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.12;pg no: 492" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.12, Page:492 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\n", + "heat transfer through concentric sphere,Q in KJ/hr \n", + "Q= -6297.1\n", + "so heat exchange=6297.1 KJ/hr\n" + ] + } + ], + "source": [ + "#cal of heat exchange\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.12, Page:492 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\")\n", + "T1=(-150+273);#temperature of air inside in K\n", + "T2=(35+273);#temperature of outer surface in K\n", + "epsilon1=0.03;#emissivity\n", + "epsilon2=epsilon1;\n", + "D1=25*10**-2;#diameter of inner sphere in m\n", + "D2=30*10**-2;#diameter of outer sphere in m\n", + "sigma=2.04*10**-4;#stephen boltzmann constant in KJ/m^2 hr K^4\n", + "print(\"heat transfer through concentric sphere,Q in KJ/hr \")\n", + "A1=4*math.pi*D1**2/4;\n", + "A2=4*math.pi*D2**2/4;\n", + "Q=(A1*sigma*(T1**4-T2**4))/((1/epsilon1)+((A1/A2)*((1/epsilon2)-1)))\n", + "print(\"Q=\"),round(Q,2)\n", + "print(\"so heat exchange=6297.1 KJ/hr\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter12_3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter12_3.ipynb new file mode 100755 index 00000000..f89e1b1a --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter12_3.ipynb @@ -0,0 +1,818 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12:Introduction to Heat Transfer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.1;pg no: 483" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.1, Page:483 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\n", + "here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\n", + "overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\n", + "(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\n", + "so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", + "rate of heat transfer,Q in W= 10590.0\n", + "so rate of heat transfer=10590 W\n", + "heat transfer across states 1 and 3(at interface).\n", + "overall heat transfer coefficient between 1 and 3\n", + "(1/U1)=(1/h1)+(deltax_brick/k_brick)\n", + "so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\n", + "Q=U1*A*(T1-T3)\n", + "so T3=T1-(Q/(U1*A))in degree celcius 44.7\n", + "so temperature at interface of brick and wood =44.71 degree celcius\n" + ] + } + ], + "source": [ + "#cal of rate of heat transfer and temperature at interface of brick and wood\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.1, Page:483 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\")\n", + "h1=30.;#heat transfer coefficient on side of 50 oc in W/m^2 K\n", + "h5=10.;#heat transfer coefficient on side of 20 oc in W/m^2 K\n", + "k_brick=0.9;#conductivity of brick in W/m K\n", + "k_wood=0.15;#conductivity of wood in W/m K\n", + "T1=50.;#temperature of air on one side of wall in degree celcius\n", + "T5=20.;#temperature of air on other side of wall in degree celcius\n", + "A=100.;#surface area in m^2\n", + "deltax_brick=1.5*10**-2;#length of brick in m\n", + "deltax_wood=2*10**-2;#length of wood in m\n", + "print(\"here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\")\n", + "print(\"overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\")\n", + "print(\"(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\")\n", + "print(\"so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\")\n", + "U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", + "U=3.53;#approx.\n", + "Q=U*A*(T1-T5)\n", + "print(\"rate of heat transfer,Q in W=\"),round(Q,2)\n", + "print(\"so rate of heat transfer=10590 W\")\n", + "print(\"heat transfer across states 1 and 3(at interface).\")\n", + "print(\"overall heat transfer coefficient between 1 and 3\")\n", + "print(\"(1/U1)=(1/h1)+(deltax_brick/k_brick)\")\n", + "print(\"so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\")\n", + "U1=1/((1/h1)+(deltax_brick/k_brick))\n", + "print(\"Q=U1*A*(T1-T3)\")\n", + "T3=T1-(Q/(U1*A))\n", + "print(\"so T3=T1-(Q/(U1*A))in degree celcius\"),round(T3,2)\n", + "print(\"so temperature at interface of brick and wood =44.71 degree celcius\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.2;pg no: 484" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.2, Page:484 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\n", + "here thermal resistances are\n", + "R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\n", + "R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\n", + "R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\n", + "R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\n", + "R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\n", + "overall heat transfer coefficient for one dimentional steady state heat transfer\n", + "(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\n", + "so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\n", + "rate of heat transfer(Q) in KJ/m^2 hr= 112.0\n", + "wall surface area(A) in m^2\n", + "so rate of heat transfer=112 KJ/m^2 hr \n", + "Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\n", + "Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\n", + "substituting,T2 in degree celcius= 23.6\n", + "so temperature of outer wall,T2=23.6 oc\n", + "T3 in degree= 23.6\n", + "so temperature at interface of outer steel wall and wool,T3=23.59 oc\n", + "T4 in degree celcius= 6.1\n", + "so temperature at interface of wool and inside steel wall,T4=6.09 oc\n", + "T5 in degree celcius= 6.1\n", + "so temperature at inside of inner steel wall,T5=6.08 oc\n" + ] + } + ], + "source": [ + "#cal of rate of heat transfer,temperatures\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.2, Page:484 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\")\n", + "h1=40;#average heat transfer coefficient at inner surface in KJ/m^2 hr oc\n", + "h6=50;#average heat transfer coefficient at outer surface in KJ/m^2 hr oc\n", + "deltax_steel=2*10**-3;#mild steel sheets thickness in m\n", + "deltax_wool=5*10**-2;#thickness of glass wool insulation in m\n", + "k_wool=0.16;#thermal conductivity of wool in KJ/m hr\n", + "k_steel=160;#thermal conductivity of steel in KJ/m hr\n", + "T1=25;#kitchen temperature in degree celcius\n", + "T6=5;#refrigerator temperature in degree celcius\n", + "print(\"here thermal resistances are\")\n", + "print(\"R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\")\n", + "print(\"R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\")\n", + "print(\"R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\")\n", + "print(\"R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\")\n", + "print(\"R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\")\n", + "print(\"overall heat transfer coefficient for one dimentional steady state heat transfer\")\n", + "print(\"(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\")\n", + "print(\"so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\")\n", + "U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))\n", + "U=2.8;#approx.\n", + "A=4*(1*0.5)\n", + "Q=U*A*(T1-T6)\n", + "print(\"rate of heat transfer(Q) in KJ/m^2 hr=\"),round(Q,2)\n", + "print(\"wall surface area(A) in m^2\")\n", + "print(\"so rate of heat transfer=112 KJ/m^2 hr \")\n", + "print(\"Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\")\n", + "print(\"Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\")\n", + "T2=T1-(Q/(A*h1))\n", + "print(\"substituting,T2 in degree celcius=\"),round(T2,1)\n", + "print(\"so temperature of outer wall,T2=23.6 oc\")\n", + "T3=T2-(Q*deltax_steel/(k_steel*A))\n", + "print(\"T3 in degree= \"),round(T3,2)\n", + "print(\"so temperature at interface of outer steel wall and wool,T3=23.59 oc\")\n", + "T4=T3-(Q*deltax_wool/(k_wool*A))\n", + "print(\"T4 in degree celcius=\"),round(T4,2)\n", + "print(\"so temperature at interface of wool and inside steel wall,T4=6.09 oc\")\n", + "T5=T4-(Q*deltax_steel/(k_steel*A))\n", + "print(\"T5 in degree celcius=\"),round(T5,2)\n", + "print(\"so temperature at inside of inner steel wall,T5=6.08 oc\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.3;pg no: 486" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.3, Page:486 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\n", + "here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\n", + "Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\n", + "so heat loss per meter from pipe in KJ/hr= 1479.77\n", + "heat loss from 5 m length(Q) in KJ/hr 7396.7\n", + "enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\n", + "mass flow of steam(m)in kg/hr\n", + "final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\n", + "let quality of steam at exit be x,\n", + "also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\n", + "h=hf+x*hfg\n", + "so x=(h-hf)/hfg 0.8245\n", + "so quality of steam at exit=0.8245\n" + ] + } + ], + "source": [ + "#cal of heat loss per meter from pipe and quality of steam\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.3, Page:486 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\")\n", + "k_insulation=0.3;#thermal conductivity of insulation in KJ/m hr oc\n", + "k_pipe=209;#thermal conductivity of pipe in KJ/m hr oc\n", + "T1=300;#temperature of inner surface of steam pipe in degree celcius\n", + "T3=50;#temperature of outer surface of insulation layer in degree celcius\n", + "r1=15*10**-2/2;#steam pipe inner radius without insulation in m\n", + "r2=16*10**-2/2;#steam pipe outer radius without insulation in m\n", + "r3=22*10**-2/2;#radius with insulation in m\n", + "m=0.5;#steam entering rate in kg/min\n", + "print(\"here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\")\n", + "print(\"Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\")\n", + "L=1;\n", + "Q=(T1-T3)*2*math.pi*L/((1/k_pipe)*math.log(r2/r1)+(1/k_insulation*math.log(r3/r2)))\n", + "print(\"so heat loss per meter from pipe in KJ/hr=\"),round(Q,2)\n", + "Q=5*Q\n", + "print(\"heat loss from 5 m length(Q) in KJ/hr\"),round(5*1479.34,2)\n", + "print(\"enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\")\n", + "hg=2749;\n", + "print(\"mass flow of steam(m)in kg/hr\")\n", + "m=m*60\n", + "print(\"final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\")\n", + "h=hg-(Q/m)\n", + "print(\"let quality of steam at exit be x,\")\n", + "print(\"also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\")\n", + "hf=1344;\n", + "hfg=1404.9;\n", + "print(\"h=hf+x*hfg\")\n", + "x=(h-hf)/hfg\n", + "print(\"so x=(h-hf)/hfg\"),round(x,4)\n", + "print(\"so quality of steam at exit=0.8245\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.4;pg no: 487" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.4, Page:487 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\n", + "considering one dimensional heat transfer of steady state type\n", + "for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr 168892.02\n", + "so heat transfer rate=168892.02 KJ/hr\n", + "heat flux in KJ/m^2 hr= 23893.33\n", + "so heat flux=23893.33 KJ/m^2 hr\n" + ] + } + ], + "source": [ + "#cal of amount of heat transfer and heat flux\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.4, Page:487 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\")\n", + "r1=150.*10**-2/2;#inner radius in m\n", + "r2=200.*10**-2/2;#outer radius in m\n", + "k=28.;#thermal conductivity in KJ m hr oc\n", + "T1=200.;#inside surface temperature in degree celcius\n", + "T2=40.;#outer surface temperature in degree celcius\n", + "print(\"considering one dimensional heat transfer of steady state type\")\n", + "Q=(T1-T2)*4*math.pi*k*r1*r2/(r2-r1)\n", + "print(\"for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr\"),round(Q,2)\n", + "print(\"so heat transfer rate=168892.02 KJ/hr\")\n", + "Q/(4*math.pi*r1**2)\n", + "print(\"heat flux in KJ/m^2 hr=\"),round(Q/(4*math.pi*r1**2),2)\n", + "print(\"so heat flux=23893.33 KJ/m^2 hr\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.5;pg no: 487" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.5, Page:487 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\n", + "R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\n", + "R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\n", + "R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\n", + "total thermal resistance,R_total=R1+R2+R3 in oc/W\n", + "so rate of heat transfer,Q=(T1-T4)/R_total in W 118.03\n", + "heat transfer rate from inside of room to inside surface of glass window.\n", + "Q=(T1-T2)/R1\n", + "so T2=T1-Q*R1 in degree celcius 9.26\n", + "Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\n" + ] + } + ], + "source": [ + "#cal of heat transfer rate\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.5, Page:487 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\")\n", + "T1=25.;#room temperature in degree celcius\n", + "T4=2.;#winter outside temperature in degree celcius\n", + "h1=10.;#heat transfer coefficient on inner window surfaces in W/m^2 oc\n", + "h4=30.;#heat transfer coefficient on outer window surfaces in W/m^2 oc\n", + "k=0.78;#thermal conductivity of glass in W/m^2 oc\n", + "A=75.*10**-2*100.*10**-2;#area in m^2\n", + "deltax=10.*10**-3;#glass thickness in m\n", + "print(\"R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\")\n", + "print(\"R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\")\n", + "print(\"R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\")\n", + "print(\"total thermal resistance,R_total=R1+R2+R3 in oc/W\")\n", + "R_total=1/(h1*A)+deltax/(k*A)+1/(h4*A)\n", + "Q=(T1-T4)/R_total\n", + "print(\"so rate of heat transfer,Q=(T1-T4)/R_total in W\"),round(Q,2)\n", + "print(\"heat transfer rate from inside of room to inside surface of glass window.\")\n", + "R1=(1/7.5);\n", + "T2=T1-Q*R1\n", + "print(\"Q=(T1-T2)/R1\")\n", + "print(\"so T2=T1-Q*R1 in degree celcius\"),round(T2,2)\n", + "print(\"Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\") \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.6;pg no: 488" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.6, Page:488 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\n", + "reynolds number,Re=V*D/v\n", + "subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\n", + "or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\n", + "so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\n", + "rate of heat transfer due to convection,Q in W \n", + "Q=h*A*(T2-T1)= 61259.36\n", + "so heat transfer rate=61259.38 W\n" + ] + } + ], + "source": [ + "#cal of heat transfer rate\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.6, Page:488 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\")\n", + "D=4*10**-2;#inner diameter in m\n", + "L=3;#length in m\n", + "V=1;#velocity of water in m/s\n", + "T1=40;#mean temperature in degree celcius\n", + "T2=75;#pipe wall temperature in degree celcius \n", + "k=0.6;#conductivity of water in W/m\n", + "Pr=3;#prandtl no.\n", + "v=0.478*10**-6;#viscocity in m^2/s\n", + "print(\"reynolds number,Re=V*D/v\")\n", + "Re=V*D/v\n", + "print(\"subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\")\n", + "print(\"or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\")\n", + "print(\"so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\")\n", + "h=(k/D)*0.023*(Re)**0.8*(Pr)**0.4 \n", + "print(\"rate of heat transfer due to convection,Q in W \") \n", + "Q=h*(math.pi*D*L)*(T2-T1)\n", + "print(\"Q=h*A*(T2-T1)=\"),round(Q,2)\n", + "print(\"so heat transfer rate=61259.38 W\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.7;pg no: 489" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.7, Page:489 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\n", + "Let the temperature of water at exit be T\n", + "Heat exchanger,Q=heat rejected by glasses=heat gained by water\n", + "Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\n", + "so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\n", + "and Q in KJ\n", + "deltaT_in=T1-T3 in degree celcius\n", + "deltaT_out=T2-T in degree celcius\n", + "for parallel flow heat exchanger,\n", + "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\n", + "also,Q=U*A*LMTD\n", + "so A=Q/(U*LMTD) in m^2 5.937\n", + "surface area,A=5.936 m^2\n" + ] + } + ], + "source": [ + "#cal of surface area\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.7, Page:489 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\")\n", + "m=0.5;#hot gases flowing rate in kg/s\n", + "T1=500;#initial temperature of gas in degree celcius\n", + "T2=150;#final temperature of gas in degree celcius\n", + "Cg=1.2;#specific heat of gas in KJ/kg K\n", + "Cw=4.18;#specific heat of water in KJ/kg K\n", + "U=150;#overall heat transfer coefficient in W/m^2 K\n", + "mw=1;#mass of water in kg/s\n", + "T3=10;#water entering temperature in degree celcius\n", + "print(\"Let the temperature of water at exit be T\")\n", + "print(\"Heat exchanger,Q=heat rejected by glasses=heat gained by water\")\n", + "print(\"Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\")\n", + "print(\"so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\")\n", + "T=T3+(m*Cg*(T1-T2)/(mw*Cw))\n", + "print(\"and Q in KJ\")\n", + "Q=m*Cg*(T1-T2)\n", + "print(\"deltaT_in=T1-T3 in degree celcius\")\n", + "deltaT_in=T1-T3\n", + "print(\"deltaT_out=T2-T in degree celcius\")\n", + "deltaT_out=T2-T\n", + "print(\"for parallel flow heat exchanger,\")\n", + "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\")\n", + "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", + "print(\"also,Q=U*A*LMTD\")\n", + "A=Q*10**3/(U*LMTD)\n", + "print(\"so A=Q/(U*LMTD) in m^2\"),round(A,3)\n", + "print(\"surface area,A=5.936 m^2\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.8;pg no: 490" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.8, Page:490 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\n", + "This oil cooler has arrangement similar to a counter flow heat exchanger.\n", + "by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\n", + "so Q in KJ/min\n", + "and T=Th_out+(Q/(mh*Cph))in degree celcius\n", + "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \n", + "here deltaT_in=Tc_out-T in degree celcius\n", + "deltaT_out=Th_in-Th_out in degree celcius\n", + "so LMTD in degree celcius\n", + "substituting in,Q=U*A*LMTD\n", + "A=(Q*10^3/60)/(U*LMTD)in m^2 132.81\n", + "so surface area=132.85 m^2\n" + ] + } + ], + "source": [ + "#cal of surface area\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.8, Page:490 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\")\n", + "mc=20;#mass of oil in kg/min \n", + "Tc_out=100;#initial temperature of oil in degree celcius\n", + "Th_in=30;#final temperature of oil in degree celcius\n", + "Th_out=25;#temperature of water in degree celcius\n", + "Cpc=2;#specific heat of oil in KJ/kg K\n", + "Cph=4.18;#specific heat of water in KJ/kg K\n", + "mh=15;#water flow rate in kg/min\n", + "U=25;#overall heat transfer coefficient in W/m^2 K\n", + "print(\"This oil cooler has arrangement similar to a counter flow heat exchanger.\")\n", + "print(\"by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\")\n", + "print(\"so Q in KJ/min\")\n", + "Q=mc*Cpc*(Tc_out-Th_in)\n", + "print(\"and T=Th_out+(Q/(mh*Cph))in degree celcius\")\n", + "T=Th_out+(Q/(mh*Cph))\n", + "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \")\n", + "print(\"here deltaT_in=Tc_out-T in degree celcius\")\n", + "deltaT_in=Tc_out-T\n", + "print(\"deltaT_out=Th_in-Th_out in degree celcius\")\n", + "deltaT_out=Th_in-Th_out\n", + "print(\"so LMTD in degree celcius\")\n", + "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", + "print(\"substituting in,Q=U*A*LMTD\")\n", + "A=(Q*10**3/60)/(U*LMTD)\n", + "print(\"A=(Q*10^3/60)/(U*LMTD)in m^2\"),round(A,2)\n", + "print(\"so surface area=132.85 m^2\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.9;pg no: 490" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.9, Page:490 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\n", + "rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\n", + "heat loss per unit area by radiation(Q)in W\n", + "Q= 93597.71\n" + ] + } + ], + "source": [ + "#cal of heat loss per unit area by radiation\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.9, Page:490 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\")\n", + "T1=(1200+273);#temperature of body in K\n", + "T2=(600+273);#temperature of black surrounding in K\n", + "epsilon=0.4;#emissivity of body at 1200 degree celcius\n", + "sigma=5.67*10**-8;#stephen boltzman constant in W/m^2 K^4\n", + "print(\"rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\")\n", + "print(\"heat loss per unit area by radiation(Q)in W\")\n", + "Q=epsilon*sigma*(T1**4-T2**4)\n", + "print(\"Q=\"),round(Q,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.10;pg no: 491" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.10, Page:491 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\n", + "Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\n", + "Q=V*I in W\n", + "For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\n", + "surface area for heat transfer,A2=2*%pi*r*L in m^2\n", + "R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\n", + "R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\n", + "Total resistance,R_total=R1+R2 in oc/W\n", + "Q=(T3-T1)/R_total\n", + "so T3 in degree celcius= 98.28\n", + "so temperature at interface=125.12 degree celcius\n", + "critical radius of insulation,rc in m= 0.01\n", + "rc in mm 10.67\n", + "This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\n", + "NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\n" + ] + } + ], + "source": [ + "#cal of temperature at interface\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.10, Page:491 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\")\n", + "V=16.;#voltage drop in V\n", + "I=5.;#current in cable in A\n", + "r2=8.*10.**-3/2.;#outer cable radius in m\n", + "r3=3.*10.**-3/2.;#copper wire radius in m\n", + "k=0.16;#thermal conductivity of copper wire in W/m oc\n", + "L=5.;#length of cable in m\n", + "h1=15.;#heat transfer coefficient of cable in W/m^2 oc\n", + "T1=40.;#temperature of surrounding in degree celcius\n", + "print(\"Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\")\n", + "print(\"Q=V*I in W\")\n", + "Q=V*I\n", + "print(\"For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\")\n", + "print(\"surface area for heat transfer,A2=2*%pi*r*L in m^2\")\n", + "A2=2.*math.pi*r2*L\n", + "A2=0.125;#approx.\n", + "print(\"R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\")\n", + "print(\"R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\")\n", + "print(\"Total resistance,R_total=R1+R2 in oc/W\")\n", + "R_total=(1/(h1*A2))+(math.log(r2/r3)/(2.*math.pi*k*L))\n", + "print(\"Q=(T3-T1)/R_total\")\n", + "T3=T1+Q*R_total\n", + "print(\"so T3 in degree celcius=\"),round(T3,2)\n", + "print(\"so temperature at interface=125.12 degree celcius\")\n", + "rc=k/h1\n", + "print(\"critical radius of insulation,rc in m=\"),round(rc,2)\n", + "print(\"rc in mm\"),round(rc*1000,2)\n", + "print(\"This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\")\n", + "print(\"NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.11;pg no: 492" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.11, Page:492 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\n", + "for maximum heat transfer the critical radius of insulation should be used.\n", + "critical radius of insulation(rc)=k/h in mm\n", + "economical thickness of insulation(t)=rc-r_wire in mm\n", + "so economical thickness of insulation=7 mm\n", + "heat convected from cable surface to environment,Q in W\n", + "Q= 35.2\n", + "so heat transferred per unit length=35.2 W\n" + ] + } + ], + "source": [ + "#cal of heat transferred per unit length\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.11, Page:492 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\")\n", + "r_wire=3;#radius of electric wire in mm\n", + "k=0.16;#thermal conductivity in W/m oc\n", + "T_surrounding=45;#temperature of surrounding in degree celcius\n", + "T_surface=80;#temperature of surface in degree celcius\n", + "h=16;#heat transfer cooefficient in W/m^2 oc\n", + "print(\"for maximum heat transfer the critical radius of insulation should be used.\")\n", + "print(\"critical radius of insulation(rc)=k/h in mm\")\n", + "rc=k*1000/h\n", + "print(\"economical thickness of insulation(t)=rc-r_wire in mm\")\n", + "t=rc-r_wire\n", + "print(\"so economical thickness of insulation=7 mm\")\n", + "print(\"heat convected from cable surface to environment,Q in W\")\n", + "L=1;#length in mm\n", + "Q=2*math.pi*rc*L*h*(T_surface-T_surrounding)*10**-3\n", + "print(\"Q=\"),round(Q,1)\n", + "print(\"so heat transferred per unit length=35.2 W\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 12.12;pg no: 492" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 12.12, Page:492 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\n", + "heat transfer through concentric sphere,Q in KJ/hr \n", + "Q= -6297.1\n", + "so heat exchange=6297.1 KJ/hr\n" + ] + } + ], + "source": [ + "#cal of heat exchange\n", + "#intiation of all variables\n", + "# Chapter 12\n", + "import math\n", + "print\"Example 12.12, Page:492 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\")\n", + "T1=(-150+273);#temperature of air inside in K\n", + "T2=(35+273);#temperature of outer surface in K\n", + "epsilon1=0.03;#emissivity\n", + "epsilon2=epsilon1;\n", + "D1=25*10**-2;#diameter of inner sphere in m\n", + "D2=30*10**-2;#diameter of outer sphere in m\n", + "sigma=2.04*10**-4;#stephen boltzmann constant in KJ/m^2 hr K^4\n", + "print(\"heat transfer through concentric sphere,Q in KJ/hr \")\n", + "A1=4*math.pi*D1**2/4;\n", + "A2=4*math.pi*D2**2/4;\n", + "Q=(A1*sigma*(T1**4-T2**4))/((1/epsilon1)+((A1/A2)*((1/epsilon2)-1)))\n", + "print(\"Q=\"),round(Q,2)\n", + "print(\"so heat exchange=6297.1 KJ/hr\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter13.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter13.ipynb new file mode 100755 index 00000000..836097b9 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter13.ipynb @@ -0,0 +1,375 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13:One Dimensional Compressible Fluid Flow" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.1;pg no: 525" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.1, Page:525 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\n", + "mass flow rate(m)=rho*A*C\n", + "so rho*C=4*m/(%pi*d^2)\n", + "so rho=165.79/C\n", + "now using perfect gas equation,p=rho*R*T\n", + "T=P/(rho*R)=P/((165.79/C)*R)\n", + "C/T=165.79*R/P\n", + "so C=1.19*T\n", + "we know,C^2=((2*y*R)/(y-1))*(To-T)\n", + "C^2=(2*1.4*287)*(300-T)/(1.4-1)\n", + "C^2=602.7*10^3-2009*T\n", + "C^2+1688.23*C-602.7*10^3=0\n", + "solving we get,C=302.72 m/s and T=254.39 K\n", + "using stagnation property relation,\n", + "To/T=1+(y-1)*M^2/2\n", + "so M= 0.947\n", + "stagnation pressure,Po in bar= 0.472\n", + "so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\n" + ] + } + ], + "source": [ + "#cal of mach number,stagnation pressure,velocity\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.1, Page:525 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\")\n", + "To=(27+273);#stagnation temperature in K\n", + "P=0.4*10**5;#static pressure in pa\n", + "m=3000/3600;#air flowing rate in kg/s\n", + "d=80*10**-3;#diameter of duct in m\n", + "R=287;#gas constant in J/kg K\n", + "y=1.4;#expansion constant\n", + "print(\"mass flow rate(m)=rho*A*C\")\n", + "print(\"so rho*C=4*m/(%pi*d^2)\")\n", + "4*m/(math.pi*d**2)\n", + "print(\"so rho=165.79/C\")\n", + "print(\"now using perfect gas equation,p=rho*R*T\")\n", + "print(\"T=P/(rho*R)=P/((165.79/C)*R)\")\n", + "print(\"C/T=165.79*R/P\")\n", + "165.79*R/P\n", + "print(\"so C=1.19*T\")\n", + "print(\"we know,C^2=((2*y*R)/(y-1))*(To-T)\")\n", + "print(\"C^2=(2*1.4*287)*(300-T)/(1.4-1)\")\n", + "print(\"C^2=602.7*10^3-2009*T\")\n", + "print(\"C^2+1688.23*C-602.7*10^3=0\")\n", + "print(\"solving we get,C=302.72 m/s and T=254.39 K\")\n", + "C=302.72;\n", + "T=254.39;\n", + "print(\"using stagnation property relation,\")\n", + "print(\"To/T=1+(y-1)*M^2/2\")\n", + "M=math.sqrt(((To/T)-1)/((y-1)/2))\n", + "print(\"so M=\"),round(M,3)\n", + "M=0.947;#approx.\n", + "Po=P*(1+(y-1)*M**2/2)/10**5\n", + "print(\"stagnation pressure,Po in bar=\"),round(Po,3)\n", + "print(\"so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.2;pg no: 525" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.2, Page:525 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\n", + "mach number,M_a=(1/sin(a))=sqrt(2)\n", + "here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\n", + "T=To*0.6717 in K\n", + "and C_max=M*sqrt(y*R*T) in m/s\n", + "corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\n", + "so T=0.7145*To in K\n", + "and C_av=M_a*sqrt(y*R*T) in m/s\n", + "ratio of kinetic energy= 0.869\n", + "so ratio of kinetic energy=0.869\n" + ] + } + ], + "source": [ + "#cal of ratio of kinetic energy\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.2, Page:525 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\")\n", + "To=(273.+1100.);#stagnation temperature in K\n", + "a=45.;#mach angle over exit cross-section in degree\n", + "Po=1.01;#pressure at upstream side of nozzle in bar\n", + "P=0.25;#ststic pressure in bar\n", + "y=1.4;#expansion constant \n", + "R=287.;#gas constant in J/kg K\n", + "print(\"mach number,M_a=(1/sin(a))=sqrt(2)\")\n", + "M_a=math.sqrt(2)\n", + "M_a=1.414;#approx.\n", + "print(\"here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\")\n", + "M=1.564;\n", + "print(\"T=To*0.6717 in K\")\n", + "T=To*0.6717\n", + "print(\"and C_max=M*sqrt(y*R*T) in m/s\")\n", + "C_max=M*math.sqrt(y*R*T)\n", + "print(\"corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\")\n", + "print(\"so T=0.7145*To in K\")\n", + "T=0.7145*To\n", + "print(\"and C_av=M_a*sqrt(y*R*T) in m/s\")\n", + "C_av=M_a*math.sqrt(y*R*T)\n", + "print(\"ratio of kinetic energy=\"),round(((1./2.)*C_av**2)/((1./2.)*C_max**2),3)\n", + "print(\"so ratio of kinetic energy=0.869\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.3;pg no: 526" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.3, Page:526 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\n", + "From bernoulli equation,Po-P=(1/2)*rho*C^2\n", + "so Po=P+(1/2)*rho*C^2 in N/m^2\n", + "speed indicator reading shall be given by mach no.s\n", + "mach no.,M=C/a=C/sqrt(y*R*T)\n", + "using perfect gas equation,P=rho*R*T\n", + "so T=P/(rho*R)in K\n", + "so mach no.,M 0.95\n", + "considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", + "so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\n", + "also Po-P=(1+k)*(1/2)*rho*C^2\n", + "substitution yields,k= 0.2437\n", + "so compressibility correction factor,k=0.2437\n" + ] + } + ], + "source": [ + "#cal of mach no,compressibility correction factor\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.3, Page:526 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\")\n", + "C=300.;#aircraft flying speed in m/s\n", + "P=0.472*10**5;#altitude pressure in Pa\n", + "rho=0.659;#density in kg/m^3\n", + "y=1.4;#expansion constant\n", + "R=287.;#gas constant in J/kg K\n", + "print(\"From bernoulli equation,Po-P=(1/2)*rho*C^2\")\n", + "print(\"so Po=P+(1/2)*rho*C^2 in N/m^2\")\n", + "Po=P+(1/2)*rho*C**2\n", + "print(\"speed indicator reading shall be given by mach no.s\")\n", + "print(\"mach no.,M=C/a=C/sqrt(y*R*T)\")\n", + "print(\"using perfect gas equation,P=rho*R*T\")\n", + "print(\"so T=P/(rho*R)in K\")\n", + "T=P/(rho*R)\n", + "M=C/math.sqrt(y*R*T)\n", + "print(\"so mach no.,M\"),round(M,2)\n", + "M=0.947;#approx.\n", + "print(\"considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", + "print(\"so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\")\n", + "Po=P*((1+(y-1)*M**2/2)**(y/(y-1)))\n", + "print(\"also Po-P=(1+k)*(1/2)*rho*C^2\")\n", + "k=((Po-P)/((1./2.)*rho*C**2))-1.\n", + "print(\"substitution yields,k=\"),round(k,4)\n", + "print(\"so compressibility correction factor,k=0.2437\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.4;pg no: 527" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.4, Page:527 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\n", + "we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\n", + "so M= 1.897\n", + "so mach number,M=1.89\n" + ] + } + ], + "source": [ + "#cal of mach number\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.4, Page:527 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\")\n", + "Po=2;#total pressure in bar\n", + "P=0.3;#static pressure in bar\n", + "y=1.4;#expansion constant\n", + "print(\"we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\")\n", + "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", + "print(\"so M=\"),round(M,3)\n", + "print(\"so mach number,M=1.89\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.5;pg no: 527" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.5, Page:527 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\n", + "actual static pressure(P)=1+0.3 in bar\n", + "It is also given that,Po-P=0.6,\n", + "so Po=P+0.6 in bar\n", + "air velocity,ao=sqrt(y*R*To)in m/s\n", + "density of air,rho_o=Po/(R*To)in \n", + "considering air to be in-compressible,\n", + "Po=P+rho_o*C^2/2\n", + "so C in m/s= 235.13\n", + "for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", + "so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", + "compressibility correction factor,k\n", + "k=(M^2/4)+((2-y)/24)*M^4\n", + "stagnation temperature,To/T=1+((y-1)/2)*M^2\n", + "so T=To/(1+((y-1)/2)*M^2) in K\n", + "density,rho=P/(R*T) in kg/m^3\n", + "substituting Po-P=(1/2)*rho*C^2(1+k)\n", + "C in m/s= 250.94\n", + "so C=250.95 m/s\n" + ] + } + ], + "source": [ + "#cal of air stream velocity\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.5, Page:527 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\")\n", + "To=305.;#stagnation temperature of air stream in K\n", + "y=1.4;#expansion constant\n", + "R=287.;#gas constant in J/kg K\n", + "print(\"actual static pressure(P)=1+0.3 in bar\")\n", + "P=1.+0.3\n", + "print(\"It is also given that,Po-P=0.6,\")\n", + "print(\"so Po=P+0.6 in bar\")\n", + "Po=P+0.6\n", + "print(\"air velocity,ao=sqrt(y*R*To)in m/s\")\n", + "ao=math.sqrt(y*R*To)\n", + "print(\"density of air,rho_o=Po/(R*To)in \")\n", + "rho_o=Po*10.**5/(R*To)\n", + "print(\"considering air to be in-compressible,\")\n", + "print(\"Po=P+rho_o*C^2/2\")\n", + "C=math.sqrt((Po-P)*10.**5*2./rho_o)\n", + "print(\"so C in m/s=\"),round(C,2)\n", + "print(\"for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", + "print(\"so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\")\n", + "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", + "M=0.7567;#approx.\n", + "print(\"compressibility correction factor,k\")\n", + "print(\"k=(M^2/4)+((2-y)/24)*M^4\")\n", + "k=(M**2/4.)+((2.-y)/24.)*M**4\n", + "print(\"stagnation temperature,To/T=1+((y-1)/2)*M^2\")\n", + "print(\"so T=To/(1+((y-1)/2)*M^2) in K\")\n", + "T=To/(1+((y-1)/2)*M**2)\n", + "print(\"density,rho=P/(R*T) in kg/m^3\")\n", + "rho=P*10**5/(R*T)\n", + "print(\"substituting Po-P=(1/2)*rho*C^2(1+k)\")\n", + "C=math.sqrt((Po-P)*10.**5/((1./2.)*rho*(1.+k)))\n", + "print(\"C in m/s=\"),round(C,2)\n", + "print(\"so C=250.95 m/s\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter13_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter13_1.ipynb new file mode 100755 index 00000000..836097b9 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter13_1.ipynb @@ -0,0 +1,375 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13:One Dimensional Compressible Fluid Flow" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.1;pg no: 525" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.1, Page:525 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\n", + "mass flow rate(m)=rho*A*C\n", + "so rho*C=4*m/(%pi*d^2)\n", + "so rho=165.79/C\n", + "now using perfect gas equation,p=rho*R*T\n", + "T=P/(rho*R)=P/((165.79/C)*R)\n", + "C/T=165.79*R/P\n", + "so C=1.19*T\n", + "we know,C^2=((2*y*R)/(y-1))*(To-T)\n", + "C^2=(2*1.4*287)*(300-T)/(1.4-1)\n", + "C^2=602.7*10^3-2009*T\n", + "C^2+1688.23*C-602.7*10^3=0\n", + "solving we get,C=302.72 m/s and T=254.39 K\n", + "using stagnation property relation,\n", + "To/T=1+(y-1)*M^2/2\n", + "so M= 0.947\n", + "stagnation pressure,Po in bar= 0.472\n", + "so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\n" + ] + } + ], + "source": [ + "#cal of mach number,stagnation pressure,velocity\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.1, Page:525 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\")\n", + "To=(27+273);#stagnation temperature in K\n", + "P=0.4*10**5;#static pressure in pa\n", + "m=3000/3600;#air flowing rate in kg/s\n", + "d=80*10**-3;#diameter of duct in m\n", + "R=287;#gas constant in J/kg K\n", + "y=1.4;#expansion constant\n", + "print(\"mass flow rate(m)=rho*A*C\")\n", + "print(\"so rho*C=4*m/(%pi*d^2)\")\n", + "4*m/(math.pi*d**2)\n", + "print(\"so rho=165.79/C\")\n", + "print(\"now using perfect gas equation,p=rho*R*T\")\n", + "print(\"T=P/(rho*R)=P/((165.79/C)*R)\")\n", + "print(\"C/T=165.79*R/P\")\n", + "165.79*R/P\n", + "print(\"so C=1.19*T\")\n", + "print(\"we know,C^2=((2*y*R)/(y-1))*(To-T)\")\n", + "print(\"C^2=(2*1.4*287)*(300-T)/(1.4-1)\")\n", + "print(\"C^2=602.7*10^3-2009*T\")\n", + "print(\"C^2+1688.23*C-602.7*10^3=0\")\n", + "print(\"solving we get,C=302.72 m/s and T=254.39 K\")\n", + "C=302.72;\n", + "T=254.39;\n", + "print(\"using stagnation property relation,\")\n", + "print(\"To/T=1+(y-1)*M^2/2\")\n", + "M=math.sqrt(((To/T)-1)/((y-1)/2))\n", + "print(\"so M=\"),round(M,3)\n", + "M=0.947;#approx.\n", + "Po=P*(1+(y-1)*M**2/2)/10**5\n", + "print(\"stagnation pressure,Po in bar=\"),round(Po,3)\n", + "print(\"so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.2;pg no: 525" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.2, Page:525 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\n", + "mach number,M_a=(1/sin(a))=sqrt(2)\n", + "here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\n", + "T=To*0.6717 in K\n", + "and C_max=M*sqrt(y*R*T) in m/s\n", + "corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\n", + "so T=0.7145*To in K\n", + "and C_av=M_a*sqrt(y*R*T) in m/s\n", + "ratio of kinetic energy= 0.869\n", + "so ratio of kinetic energy=0.869\n" + ] + } + ], + "source": [ + "#cal of ratio of kinetic energy\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.2, Page:525 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\")\n", + "To=(273.+1100.);#stagnation temperature in K\n", + "a=45.;#mach angle over exit cross-section in degree\n", + "Po=1.01;#pressure at upstream side of nozzle in bar\n", + "P=0.25;#ststic pressure in bar\n", + "y=1.4;#expansion constant \n", + "R=287.;#gas constant in J/kg K\n", + "print(\"mach number,M_a=(1/sin(a))=sqrt(2)\")\n", + "M_a=math.sqrt(2)\n", + "M_a=1.414;#approx.\n", + "print(\"here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\")\n", + "M=1.564;\n", + "print(\"T=To*0.6717 in K\")\n", + "T=To*0.6717\n", + "print(\"and C_max=M*sqrt(y*R*T) in m/s\")\n", + "C_max=M*math.sqrt(y*R*T)\n", + "print(\"corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\")\n", + "print(\"so T=0.7145*To in K\")\n", + "T=0.7145*To\n", + "print(\"and C_av=M_a*sqrt(y*R*T) in m/s\")\n", + "C_av=M_a*math.sqrt(y*R*T)\n", + "print(\"ratio of kinetic energy=\"),round(((1./2.)*C_av**2)/((1./2.)*C_max**2),3)\n", + "print(\"so ratio of kinetic energy=0.869\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.3;pg no: 526" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.3, Page:526 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\n", + "From bernoulli equation,Po-P=(1/2)*rho*C^2\n", + "so Po=P+(1/2)*rho*C^2 in N/m^2\n", + "speed indicator reading shall be given by mach no.s\n", + "mach no.,M=C/a=C/sqrt(y*R*T)\n", + "using perfect gas equation,P=rho*R*T\n", + "so T=P/(rho*R)in K\n", + "so mach no.,M 0.95\n", + "considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", + "so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\n", + "also Po-P=(1+k)*(1/2)*rho*C^2\n", + "substitution yields,k= 0.2437\n", + "so compressibility correction factor,k=0.2437\n" + ] + } + ], + "source": [ + "#cal of mach no,compressibility correction factor\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.3, Page:526 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\")\n", + "C=300.;#aircraft flying speed in m/s\n", + "P=0.472*10**5;#altitude pressure in Pa\n", + "rho=0.659;#density in kg/m^3\n", + "y=1.4;#expansion constant\n", + "R=287.;#gas constant in J/kg K\n", + "print(\"From bernoulli equation,Po-P=(1/2)*rho*C^2\")\n", + "print(\"so Po=P+(1/2)*rho*C^2 in N/m^2\")\n", + "Po=P+(1/2)*rho*C**2\n", + "print(\"speed indicator reading shall be given by mach no.s\")\n", + "print(\"mach no.,M=C/a=C/sqrt(y*R*T)\")\n", + "print(\"using perfect gas equation,P=rho*R*T\")\n", + "print(\"so T=P/(rho*R)in K\")\n", + "T=P/(rho*R)\n", + "M=C/math.sqrt(y*R*T)\n", + "print(\"so mach no.,M\"),round(M,2)\n", + "M=0.947;#approx.\n", + "print(\"considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", + "print(\"so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\")\n", + "Po=P*((1+(y-1)*M**2/2)**(y/(y-1)))\n", + "print(\"also Po-P=(1+k)*(1/2)*rho*C^2\")\n", + "k=((Po-P)/((1./2.)*rho*C**2))-1.\n", + "print(\"substitution yields,k=\"),round(k,4)\n", + "print(\"so compressibility correction factor,k=0.2437\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.4;pg no: 527" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.4, Page:527 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\n", + "we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\n", + "so M= 1.897\n", + "so mach number,M=1.89\n" + ] + } + ], + "source": [ + "#cal of mach number\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.4, Page:527 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\")\n", + "Po=2;#total pressure in bar\n", + "P=0.3;#static pressure in bar\n", + "y=1.4;#expansion constant\n", + "print(\"we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\")\n", + "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", + "print(\"so M=\"),round(M,3)\n", + "print(\"so mach number,M=1.89\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.5;pg no: 527" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.5, Page:527 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\n", + "actual static pressure(P)=1+0.3 in bar\n", + "It is also given that,Po-P=0.6,\n", + "so Po=P+0.6 in bar\n", + "air velocity,ao=sqrt(y*R*To)in m/s\n", + "density of air,rho_o=Po/(R*To)in \n", + "considering air to be in-compressible,\n", + "Po=P+rho_o*C^2/2\n", + "so C in m/s= 235.13\n", + "for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", + "so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", + "compressibility correction factor,k\n", + "k=(M^2/4)+((2-y)/24)*M^4\n", + "stagnation temperature,To/T=1+((y-1)/2)*M^2\n", + "so T=To/(1+((y-1)/2)*M^2) in K\n", + "density,rho=P/(R*T) in kg/m^3\n", + "substituting Po-P=(1/2)*rho*C^2(1+k)\n", + "C in m/s= 250.94\n", + "so C=250.95 m/s\n" + ] + } + ], + "source": [ + "#cal of air stream velocity\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.5, Page:527 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\")\n", + "To=305.;#stagnation temperature of air stream in K\n", + "y=1.4;#expansion constant\n", + "R=287.;#gas constant in J/kg K\n", + "print(\"actual static pressure(P)=1+0.3 in bar\")\n", + "P=1.+0.3\n", + "print(\"It is also given that,Po-P=0.6,\")\n", + "print(\"so Po=P+0.6 in bar\")\n", + "Po=P+0.6\n", + "print(\"air velocity,ao=sqrt(y*R*To)in m/s\")\n", + "ao=math.sqrt(y*R*To)\n", + "print(\"density of air,rho_o=Po/(R*To)in \")\n", + "rho_o=Po*10.**5/(R*To)\n", + "print(\"considering air to be in-compressible,\")\n", + "print(\"Po=P+rho_o*C^2/2\")\n", + "C=math.sqrt((Po-P)*10.**5*2./rho_o)\n", + "print(\"so C in m/s=\"),round(C,2)\n", + "print(\"for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", + "print(\"so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\")\n", + "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", + "M=0.7567;#approx.\n", + "print(\"compressibility correction factor,k\")\n", + "print(\"k=(M^2/4)+((2-y)/24)*M^4\")\n", + "k=(M**2/4.)+((2.-y)/24.)*M**4\n", + "print(\"stagnation temperature,To/T=1+((y-1)/2)*M^2\")\n", + "print(\"so T=To/(1+((y-1)/2)*M^2) in K\")\n", + "T=To/(1+((y-1)/2)*M**2)\n", + "print(\"density,rho=P/(R*T) in kg/m^3\")\n", + "rho=P*10**5/(R*T)\n", + "print(\"substituting Po-P=(1/2)*rho*C^2(1+k)\")\n", + "C=math.sqrt((Po-P)*10.**5/((1./2.)*rho*(1.+k)))\n", + "print(\"C in m/s=\"),round(C,2)\n", + "print(\"so C=250.95 m/s\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter13_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter13_2.ipynb new file mode 100755 index 00000000..836097b9 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter13_2.ipynb @@ -0,0 +1,375 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13:One Dimensional Compressible Fluid Flow" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.1;pg no: 525" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.1, Page:525 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\n", + "mass flow rate(m)=rho*A*C\n", + "so rho*C=4*m/(%pi*d^2)\n", + "so rho=165.79/C\n", + "now using perfect gas equation,p=rho*R*T\n", + "T=P/(rho*R)=P/((165.79/C)*R)\n", + "C/T=165.79*R/P\n", + "so C=1.19*T\n", + "we know,C^2=((2*y*R)/(y-1))*(To-T)\n", + "C^2=(2*1.4*287)*(300-T)/(1.4-1)\n", + "C^2=602.7*10^3-2009*T\n", + "C^2+1688.23*C-602.7*10^3=0\n", + "solving we get,C=302.72 m/s and T=254.39 K\n", + "using stagnation property relation,\n", + "To/T=1+(y-1)*M^2/2\n", + "so M= 0.947\n", + "stagnation pressure,Po in bar= 0.472\n", + "so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\n" + ] + } + ], + "source": [ + "#cal of mach number,stagnation pressure,velocity\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.1, Page:525 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\")\n", + "To=(27+273);#stagnation temperature in K\n", + "P=0.4*10**5;#static pressure in pa\n", + "m=3000/3600;#air flowing rate in kg/s\n", + "d=80*10**-3;#diameter of duct in m\n", + "R=287;#gas constant in J/kg K\n", + "y=1.4;#expansion constant\n", + "print(\"mass flow rate(m)=rho*A*C\")\n", + "print(\"so rho*C=4*m/(%pi*d^2)\")\n", + "4*m/(math.pi*d**2)\n", + "print(\"so rho=165.79/C\")\n", + "print(\"now using perfect gas equation,p=rho*R*T\")\n", + "print(\"T=P/(rho*R)=P/((165.79/C)*R)\")\n", + "print(\"C/T=165.79*R/P\")\n", + "165.79*R/P\n", + "print(\"so C=1.19*T\")\n", + "print(\"we know,C^2=((2*y*R)/(y-1))*(To-T)\")\n", + "print(\"C^2=(2*1.4*287)*(300-T)/(1.4-1)\")\n", + "print(\"C^2=602.7*10^3-2009*T\")\n", + "print(\"C^2+1688.23*C-602.7*10^3=0\")\n", + "print(\"solving we get,C=302.72 m/s and T=254.39 K\")\n", + "C=302.72;\n", + "T=254.39;\n", + "print(\"using stagnation property relation,\")\n", + "print(\"To/T=1+(y-1)*M^2/2\")\n", + "M=math.sqrt(((To/T)-1)/((y-1)/2))\n", + "print(\"so M=\"),round(M,3)\n", + "M=0.947;#approx.\n", + "Po=P*(1+(y-1)*M**2/2)/10**5\n", + "print(\"stagnation pressure,Po in bar=\"),round(Po,3)\n", + "print(\"so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.2;pg no: 525" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.2, Page:525 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\n", + "mach number,M_a=(1/sin(a))=sqrt(2)\n", + "here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\n", + "T=To*0.6717 in K\n", + "and C_max=M*sqrt(y*R*T) in m/s\n", + "corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\n", + "so T=0.7145*To in K\n", + "and C_av=M_a*sqrt(y*R*T) in m/s\n", + "ratio of kinetic energy= 0.869\n", + "so ratio of kinetic energy=0.869\n" + ] + } + ], + "source": [ + "#cal of ratio of kinetic energy\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.2, Page:525 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\")\n", + "To=(273.+1100.);#stagnation temperature in K\n", + "a=45.;#mach angle over exit cross-section in degree\n", + "Po=1.01;#pressure at upstream side of nozzle in bar\n", + "P=0.25;#ststic pressure in bar\n", + "y=1.4;#expansion constant \n", + "R=287.;#gas constant in J/kg K\n", + "print(\"mach number,M_a=(1/sin(a))=sqrt(2)\")\n", + "M_a=math.sqrt(2)\n", + "M_a=1.414;#approx.\n", + "print(\"here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\")\n", + "M=1.564;\n", + "print(\"T=To*0.6717 in K\")\n", + "T=To*0.6717\n", + "print(\"and C_max=M*sqrt(y*R*T) in m/s\")\n", + "C_max=M*math.sqrt(y*R*T)\n", + "print(\"corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\")\n", + "print(\"so T=0.7145*To in K\")\n", + "T=0.7145*To\n", + "print(\"and C_av=M_a*sqrt(y*R*T) in m/s\")\n", + "C_av=M_a*math.sqrt(y*R*T)\n", + "print(\"ratio of kinetic energy=\"),round(((1./2.)*C_av**2)/((1./2.)*C_max**2),3)\n", + "print(\"so ratio of kinetic energy=0.869\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.3;pg no: 526" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.3, Page:526 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\n", + "From bernoulli equation,Po-P=(1/2)*rho*C^2\n", + "so Po=P+(1/2)*rho*C^2 in N/m^2\n", + "speed indicator reading shall be given by mach no.s\n", + "mach no.,M=C/a=C/sqrt(y*R*T)\n", + "using perfect gas equation,P=rho*R*T\n", + "so T=P/(rho*R)in K\n", + "so mach no.,M 0.95\n", + "considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", + "so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\n", + "also Po-P=(1+k)*(1/2)*rho*C^2\n", + "substitution yields,k= 0.2437\n", + "so compressibility correction factor,k=0.2437\n" + ] + } + ], + "source": [ + "#cal of mach no,compressibility correction factor\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.3, Page:526 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\")\n", + "C=300.;#aircraft flying speed in m/s\n", + "P=0.472*10**5;#altitude pressure in Pa\n", + "rho=0.659;#density in kg/m^3\n", + "y=1.4;#expansion constant\n", + "R=287.;#gas constant in J/kg K\n", + "print(\"From bernoulli equation,Po-P=(1/2)*rho*C^2\")\n", + "print(\"so Po=P+(1/2)*rho*C^2 in N/m^2\")\n", + "Po=P+(1/2)*rho*C**2\n", + "print(\"speed indicator reading shall be given by mach no.s\")\n", + "print(\"mach no.,M=C/a=C/sqrt(y*R*T)\")\n", + "print(\"using perfect gas equation,P=rho*R*T\")\n", + "print(\"so T=P/(rho*R)in K\")\n", + "T=P/(rho*R)\n", + "M=C/math.sqrt(y*R*T)\n", + "print(\"so mach no.,M\"),round(M,2)\n", + "M=0.947;#approx.\n", + "print(\"considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", + "print(\"so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\")\n", + "Po=P*((1+(y-1)*M**2/2)**(y/(y-1)))\n", + "print(\"also Po-P=(1+k)*(1/2)*rho*C^2\")\n", + "k=((Po-P)/((1./2.)*rho*C**2))-1.\n", + "print(\"substitution yields,k=\"),round(k,4)\n", + "print(\"so compressibility correction factor,k=0.2437\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.4;pg no: 527" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.4, Page:527 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\n", + "we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\n", + "so M= 1.897\n", + "so mach number,M=1.89\n" + ] + } + ], + "source": [ + "#cal of mach number\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.4, Page:527 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\")\n", + "Po=2;#total pressure in bar\n", + "P=0.3;#static pressure in bar\n", + "y=1.4;#expansion constant\n", + "print(\"we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\")\n", + "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", + "print(\"so M=\"),round(M,3)\n", + "print(\"so mach number,M=1.89\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.5;pg no: 527" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.5, Page:527 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\n", + "actual static pressure(P)=1+0.3 in bar\n", + "It is also given that,Po-P=0.6,\n", + "so Po=P+0.6 in bar\n", + "air velocity,ao=sqrt(y*R*To)in m/s\n", + "density of air,rho_o=Po/(R*To)in \n", + "considering air to be in-compressible,\n", + "Po=P+rho_o*C^2/2\n", + "so C in m/s= 235.13\n", + "for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", + "so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", + "compressibility correction factor,k\n", + "k=(M^2/4)+((2-y)/24)*M^4\n", + "stagnation temperature,To/T=1+((y-1)/2)*M^2\n", + "so T=To/(1+((y-1)/2)*M^2) in K\n", + "density,rho=P/(R*T) in kg/m^3\n", + "substituting Po-P=(1/2)*rho*C^2(1+k)\n", + "C in m/s= 250.94\n", + "so C=250.95 m/s\n" + ] + } + ], + "source": [ + "#cal of air stream velocity\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.5, Page:527 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\")\n", + "To=305.;#stagnation temperature of air stream in K\n", + "y=1.4;#expansion constant\n", + "R=287.;#gas constant in J/kg K\n", + "print(\"actual static pressure(P)=1+0.3 in bar\")\n", + "P=1.+0.3\n", + "print(\"It is also given that,Po-P=0.6,\")\n", + "print(\"so Po=P+0.6 in bar\")\n", + "Po=P+0.6\n", + "print(\"air velocity,ao=sqrt(y*R*To)in m/s\")\n", + "ao=math.sqrt(y*R*To)\n", + "print(\"density of air,rho_o=Po/(R*To)in \")\n", + "rho_o=Po*10.**5/(R*To)\n", + "print(\"considering air to be in-compressible,\")\n", + "print(\"Po=P+rho_o*C^2/2\")\n", + "C=math.sqrt((Po-P)*10.**5*2./rho_o)\n", + "print(\"so C in m/s=\"),round(C,2)\n", + "print(\"for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", + "print(\"so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\")\n", + "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", + "M=0.7567;#approx.\n", + "print(\"compressibility correction factor,k\")\n", + "print(\"k=(M^2/4)+((2-y)/24)*M^4\")\n", + "k=(M**2/4.)+((2.-y)/24.)*M**4\n", + "print(\"stagnation temperature,To/T=1+((y-1)/2)*M^2\")\n", + "print(\"so T=To/(1+((y-1)/2)*M^2) in K\")\n", + "T=To/(1+((y-1)/2)*M**2)\n", + "print(\"density,rho=P/(R*T) in kg/m^3\")\n", + "rho=P*10**5/(R*T)\n", + "print(\"substituting Po-P=(1/2)*rho*C^2(1+k)\")\n", + "C=math.sqrt((Po-P)*10.**5/((1./2.)*rho*(1.+k)))\n", + "print(\"C in m/s=\"),round(C,2)\n", + "print(\"so C=250.95 m/s\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter13_3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter13_3.ipynb new file mode 100755 index 00000000..836097b9 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter13_3.ipynb @@ -0,0 +1,375 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13:One Dimensional Compressible Fluid Flow" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.1;pg no: 525" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.1, Page:525 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\n", + "mass flow rate(m)=rho*A*C\n", + "so rho*C=4*m/(%pi*d^2)\n", + "so rho=165.79/C\n", + "now using perfect gas equation,p=rho*R*T\n", + "T=P/(rho*R)=P/((165.79/C)*R)\n", + "C/T=165.79*R/P\n", + "so C=1.19*T\n", + "we know,C^2=((2*y*R)/(y-1))*(To-T)\n", + "C^2=(2*1.4*287)*(300-T)/(1.4-1)\n", + "C^2=602.7*10^3-2009*T\n", + "C^2+1688.23*C-602.7*10^3=0\n", + "solving we get,C=302.72 m/s and T=254.39 K\n", + "using stagnation property relation,\n", + "To/T=1+(y-1)*M^2/2\n", + "so M= 0.947\n", + "stagnation pressure,Po in bar= 0.472\n", + "so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\n" + ] + } + ], + "source": [ + "#cal of mach number,stagnation pressure,velocity\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.1, Page:525 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\")\n", + "To=(27+273);#stagnation temperature in K\n", + "P=0.4*10**5;#static pressure in pa\n", + "m=3000/3600;#air flowing rate in kg/s\n", + "d=80*10**-3;#diameter of duct in m\n", + "R=287;#gas constant in J/kg K\n", + "y=1.4;#expansion constant\n", + "print(\"mass flow rate(m)=rho*A*C\")\n", + "print(\"so rho*C=4*m/(%pi*d^2)\")\n", + "4*m/(math.pi*d**2)\n", + "print(\"so rho=165.79/C\")\n", + "print(\"now using perfect gas equation,p=rho*R*T\")\n", + "print(\"T=P/(rho*R)=P/((165.79/C)*R)\")\n", + "print(\"C/T=165.79*R/P\")\n", + "165.79*R/P\n", + "print(\"so C=1.19*T\")\n", + "print(\"we know,C^2=((2*y*R)/(y-1))*(To-T)\")\n", + "print(\"C^2=(2*1.4*287)*(300-T)/(1.4-1)\")\n", + "print(\"C^2=602.7*10^3-2009*T\")\n", + "print(\"C^2+1688.23*C-602.7*10^3=0\")\n", + "print(\"solving we get,C=302.72 m/s and T=254.39 K\")\n", + "C=302.72;\n", + "T=254.39;\n", + "print(\"using stagnation property relation,\")\n", + "print(\"To/T=1+(y-1)*M^2/2\")\n", + "M=math.sqrt(((To/T)-1)/((y-1)/2))\n", + "print(\"so M=\"),round(M,3)\n", + "M=0.947;#approx.\n", + "Po=P*(1+(y-1)*M**2/2)/10**5\n", + "print(\"stagnation pressure,Po in bar=\"),round(Po,3)\n", + "print(\"so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.2;pg no: 525" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.2, Page:525 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\n", + "mach number,M_a=(1/sin(a))=sqrt(2)\n", + "here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\n", + "T=To*0.6717 in K\n", + "and C_max=M*sqrt(y*R*T) in m/s\n", + "corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\n", + "so T=0.7145*To in K\n", + "and C_av=M_a*sqrt(y*R*T) in m/s\n", + "ratio of kinetic energy= 0.869\n", + "so ratio of kinetic energy=0.869\n" + ] + } + ], + "source": [ + "#cal of ratio of kinetic energy\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.2, Page:525 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\")\n", + "To=(273.+1100.);#stagnation temperature in K\n", + "a=45.;#mach angle over exit cross-section in degree\n", + "Po=1.01;#pressure at upstream side of nozzle in bar\n", + "P=0.25;#ststic pressure in bar\n", + "y=1.4;#expansion constant \n", + "R=287.;#gas constant in J/kg K\n", + "print(\"mach number,M_a=(1/sin(a))=sqrt(2)\")\n", + "M_a=math.sqrt(2)\n", + "M_a=1.414;#approx.\n", + "print(\"here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\")\n", + "M=1.564;\n", + "print(\"T=To*0.6717 in K\")\n", + "T=To*0.6717\n", + "print(\"and C_max=M*sqrt(y*R*T) in m/s\")\n", + "C_max=M*math.sqrt(y*R*T)\n", + "print(\"corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\")\n", + "print(\"so T=0.7145*To in K\")\n", + "T=0.7145*To\n", + "print(\"and C_av=M_a*sqrt(y*R*T) in m/s\")\n", + "C_av=M_a*math.sqrt(y*R*T)\n", + "print(\"ratio of kinetic energy=\"),round(((1./2.)*C_av**2)/((1./2.)*C_max**2),3)\n", + "print(\"so ratio of kinetic energy=0.869\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.3;pg no: 526" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.3, Page:526 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\n", + "From bernoulli equation,Po-P=(1/2)*rho*C^2\n", + "so Po=P+(1/2)*rho*C^2 in N/m^2\n", + "speed indicator reading shall be given by mach no.s\n", + "mach no.,M=C/a=C/sqrt(y*R*T)\n", + "using perfect gas equation,P=rho*R*T\n", + "so T=P/(rho*R)in K\n", + "so mach no.,M 0.95\n", + "considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", + "so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\n", + "also Po-P=(1+k)*(1/2)*rho*C^2\n", + "substitution yields,k= 0.2437\n", + "so compressibility correction factor,k=0.2437\n" + ] + } + ], + "source": [ + "#cal of mach no,compressibility correction factor\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.3, Page:526 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\")\n", + "C=300.;#aircraft flying speed in m/s\n", + "P=0.472*10**5;#altitude pressure in Pa\n", + "rho=0.659;#density in kg/m^3\n", + "y=1.4;#expansion constant\n", + "R=287.;#gas constant in J/kg K\n", + "print(\"From bernoulli equation,Po-P=(1/2)*rho*C^2\")\n", + "print(\"so Po=P+(1/2)*rho*C^2 in N/m^2\")\n", + "Po=P+(1/2)*rho*C**2\n", + "print(\"speed indicator reading shall be given by mach no.s\")\n", + "print(\"mach no.,M=C/a=C/sqrt(y*R*T)\")\n", + "print(\"using perfect gas equation,P=rho*R*T\")\n", + "print(\"so T=P/(rho*R)in K\")\n", + "T=P/(rho*R)\n", + "M=C/math.sqrt(y*R*T)\n", + "print(\"so mach no.,M\"),round(M,2)\n", + "M=0.947;#approx.\n", + "print(\"considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", + "print(\"so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\")\n", + "Po=P*((1+(y-1)*M**2/2)**(y/(y-1)))\n", + "print(\"also Po-P=(1+k)*(1/2)*rho*C^2\")\n", + "k=((Po-P)/((1./2.)*rho*C**2))-1.\n", + "print(\"substitution yields,k=\"),round(k,4)\n", + "print(\"so compressibility correction factor,k=0.2437\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.4;pg no: 527" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.4, Page:527 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\n", + "we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\n", + "so M= 1.897\n", + "so mach number,M=1.89\n" + ] + } + ], + "source": [ + "#cal of mach number\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.4, Page:527 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\")\n", + "Po=2;#total pressure in bar\n", + "P=0.3;#static pressure in bar\n", + "y=1.4;#expansion constant\n", + "print(\"we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\")\n", + "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", + "print(\"so M=\"),round(M,3)\n", + "print(\"so mach number,M=1.89\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 13.5;pg no: 527" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 13.5, Page:527 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\n", + "actual static pressure(P)=1+0.3 in bar\n", + "It is also given that,Po-P=0.6,\n", + "so Po=P+0.6 in bar\n", + "air velocity,ao=sqrt(y*R*To)in m/s\n", + "density of air,rho_o=Po/(R*To)in \n", + "considering air to be in-compressible,\n", + "Po=P+rho_o*C^2/2\n", + "so C in m/s= 235.13\n", + "for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", + "so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", + "compressibility correction factor,k\n", + "k=(M^2/4)+((2-y)/24)*M^4\n", + "stagnation temperature,To/T=1+((y-1)/2)*M^2\n", + "so T=To/(1+((y-1)/2)*M^2) in K\n", + "density,rho=P/(R*T) in kg/m^3\n", + "substituting Po-P=(1/2)*rho*C^2(1+k)\n", + "C in m/s= 250.94\n", + "so C=250.95 m/s\n" + ] + } + ], + "source": [ + "#cal of air stream velocity\n", + "#intiation of all variables\n", + "# Chapter 13\n", + "import math\n", + "print\"Example 13.5, Page:527 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\")\n", + "To=305.;#stagnation temperature of air stream in K\n", + "y=1.4;#expansion constant\n", + "R=287.;#gas constant in J/kg K\n", + "print(\"actual static pressure(P)=1+0.3 in bar\")\n", + "P=1.+0.3\n", + "print(\"It is also given that,Po-P=0.6,\")\n", + "print(\"so Po=P+0.6 in bar\")\n", + "Po=P+0.6\n", + "print(\"air velocity,ao=sqrt(y*R*To)in m/s\")\n", + "ao=math.sqrt(y*R*To)\n", + "print(\"density of air,rho_o=Po/(R*To)in \")\n", + "rho_o=Po*10.**5/(R*To)\n", + "print(\"considering air to be in-compressible,\")\n", + "print(\"Po=P+rho_o*C^2/2\")\n", + "C=math.sqrt((Po-P)*10.**5*2./rho_o)\n", + "print(\"so C in m/s=\"),round(C,2)\n", + "print(\"for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", + "print(\"so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\")\n", + "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", + "M=0.7567;#approx.\n", + "print(\"compressibility correction factor,k\")\n", + "print(\"k=(M^2/4)+((2-y)/24)*M^4\")\n", + "k=(M**2/4.)+((2.-y)/24.)*M**4\n", + "print(\"stagnation temperature,To/T=1+((y-1)/2)*M^2\")\n", + "print(\"so T=To/(1+((y-1)/2)*M^2) in K\")\n", + "T=To/(1+((y-1)/2)*M**2)\n", + "print(\"density,rho=P/(R*T) in kg/m^3\")\n", + "rho=P*10**5/(R*T)\n", + "print(\"substituting Po-P=(1/2)*rho*C^2(1+k)\")\n", + "C=math.sqrt((Po-P)*10.**5/((1./2.)*rho*(1.+k)))\n", + "print(\"C in m/s=\"),round(C,2)\n", + "print(\"so C=250.95 m/s\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter2.ipynb new file mode 100755 index 00000000..6d7e9bc4 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter2.ipynb @@ -0,0 +1,314 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# chapter 2:Zeroth Law of Thermodynamics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.1;pg no:46" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.1, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\n", + "degree celcius and farenheit are related as follows\n", + "Tc=(Tf-32)/1.8\n", + "so temperature of body in degree celcius 37.0\n" + ] + } + ], + "source": [ + "#cal of temperature of body of human\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "print\"Example 2.1, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\")\n", + "Tf=98.6;#temperature of body in farenheit\n", + "Tc=(Tf-32)/1.8\n", + "print(\"degree celcius and farenheit are related as follows\")\n", + "print(\"Tc=(Tf-32)/1.8\")\n", + "print(\"so temperature of body in degree celcius\"),round(Tc,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.2;pg no:47" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.2, Page:47 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\n", + "using thermometric relation\n", + "t=a*log(p)+(b/2)\n", + "for ice point,b/a=\n", + "so b=2.1972*a\n", + "for steam point\n", + "a= 101.95\n", + "and b= 224.01\n", + "thus, t=in degree celcius\n", + "so for thermodynamic property of 6.5,t=302.83 degree celcius= 302.84\n" + ] + } + ], + "source": [ + "#cal of celcius temperature\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "import math\n", + "print\"Example 2.2, Page:47 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\")\n", + "t1=0;#ice point temperature in degree celcius\n", + "p1=3;#thermometric property for ice point\n", + "t2=100;#steam point temperature in degree celcius\n", + "p2=8;#thermometric property for steam point\n", + "p3=6.5;#thermometric property for any temperature\n", + "print(\"using thermometric relation\")\n", + "print(\"t=a*log(p)+(b/2)\")\n", + "print(\"for ice point,b/a=\")\n", + "b=2*math.log(p1)\n", + "print(\"so b=2.1972*a\")\n", + "print(\"for steam point\")\n", + "a=t2/(math.log(p2)-(2.1972/2))\n", + "print(\"a=\"),round(a,2)\n", + "b=2.1972*a\n", + "print(\"and b=\"),round(b,2)\n", + "t=a*math.log(p3)+(b/2)\n", + "print(\"thus, t=in degree celcius\")\n", + "print(\"so for thermodynamic property of 6.5,t=302.83 degree celcius=\"),round(t,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.3;page no:47" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.3, Page:47 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\n", + "emf equation\n", + "E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\n", + "using emf equation at ice point,E_0 in volts\n", + "E_0= 0.0\n", + "using emf equation at steam point,E_100 in volts\n", + "E_100= 0.3\n", + "now emf at 30 degree celcius using emf equation(E_30)in volts\n", + "now the temperature(T) shown by this thermometer\n", + "T=in degree celcius 30.36\n", + "NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\n" + ] + } + ], + "source": [ + "#cal of temperature shown by this thermometer\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "print\"Example 2.3, Page:47 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\")\n", + "print(\"emf equation\")\n", + "print(\"E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\")\n", + "print(\"using emf equation at ice point,E_0 in volts\")\n", + "t=0.;#ice point temperature in degree celcius\n", + "E_0=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", + "print(\"E_0=\"),round(E_0,2)\n", + "print(\"using emf equation at steam point,E_100 in volts\")\n", + "t=100.;#steam point temperature in degree celcius\n", + "E_100=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", + "print(\"E_100=\"),round(E_100,2)\n", + "print(\"now emf at 30 degree celcius using emf equation(E_30)in volts\")\n", + "t=30.;#temperature of substance in degree celcius\n", + "E_30=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", + "T_100=100.;#steam point temperature in degree celcius\n", + "T_0=0.;#ice point temperature in degree celcius\n", + "T=((E_30-E_0)/(E_100-E_0))*(T_100-T_0)\n", + "print(\"now the temperature(T) shown by this thermometer\")\n", + "print(\"T=in degree celcius\"),round(T,2)\n", + "print(\"NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.4;pg no:48" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.4, Page:48 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\n", + "emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\n", + "as ice point and steam points are two reference points,so\n", + "at ice point,emf(e1)in mV\n", + "at steam point,emf(e2)in mV\n", + "at gas temperature,emf(e3)in mV\n", + "since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV 60.16\n", + "temperature of gas using thermocouple=60.16 degree celcius\n", + "percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius 20.31\n" + ] + } + ], + "source": [ + "#cal of percentage variation in temperature\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "import math\n", + "print\"Example 2.4, Page:48 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\")\n", + "t1=0;#temperature at ice point\n", + "t2=100;#temperature at steam point\n", + "t3=50;#temperature of gas\n", + "print(\"emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\")\n", + "print(\"as ice point and steam points are two reference points,so\")\n", + "print(\"at ice point,emf(e1)in mV\")\n", + "e1=0.18*t1-5.2*10**-4*t1**2\n", + "print(\"at steam point,emf(e2)in mV\")\n", + "e2=0.18*t2-5.2*10**-4*t2**2\n", + "print(\"at gas temperature,emf(e3)in mV\")\n", + "e3=0.18*t3-5.2*10**-4*t3**2\n", + "t=((t2-t1)/(e2-e1))*e3\n", + "variation=((t-t3)/t3)*100\n", + "print(\"since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV\"),round(t,2)\n", + "print(\"temperature of gas using thermocouple=60.16 degree celcius\")\n", + "print(\"percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius\"),round(variation,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.5;pg no:48" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.5, Page:48 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\n", + "let the conversion relation be X=aC+b\n", + "where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \n", + "at freezing point,temperature=0 degree celcius,0 degree X\n", + "so by equation X=aC+b\n", + "we get b=0\n", + "at boiling point,temperature=100 degree celcius,1000 degree X\n", + "conversion relation\n", + "X=10*C\n", + "absolute zero temperature in degree celcius=-273.15\n", + "absolute zero temperature in degree X= -2731.5\n" + ] + } + ], + "source": [ + "#cal of absolute zero temperature\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "print\"Example 2.5, Page:48 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\")\n", + "print(\"let the conversion relation be X=aC+b\")\n", + "print(\"where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \")\n", + "print(\"at freezing point,temperature=0 degree celcius,0 degree X\")\n", + "print(\"so by equation X=aC+b\")\n", + "X=0;#temperature in degree X\n", + "C=0;#temperature in degree celcius\n", + "print(\"we get b=0\")\n", + "b=0;\n", + "print(\"at boiling point,temperature=100 degree celcius,1000 degree X\")\n", + "X=1000;#temperature in degree X\n", + "C=100;#temperature in degree celcius\n", + "a=(X-b)/C\n", + "print(\"conversion relation\")\n", + "print(\"X=10*C\")\n", + "print(\"absolute zero temperature in degree celcius=-273.15\")\n", + "X=10*-273.15\n", + "print(\"absolute zero temperature in degree X=\"),round(X,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter2_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter2_1.ipynb new file mode 100755 index 00000000..6d7e9bc4 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter2_1.ipynb @@ -0,0 +1,314 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# chapter 2:Zeroth Law of Thermodynamics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.1;pg no:46" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.1, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\n", + "degree celcius and farenheit are related as follows\n", + "Tc=(Tf-32)/1.8\n", + "so temperature of body in degree celcius 37.0\n" + ] + } + ], + "source": [ + "#cal of temperature of body of human\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "print\"Example 2.1, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\")\n", + "Tf=98.6;#temperature of body in farenheit\n", + "Tc=(Tf-32)/1.8\n", + "print(\"degree celcius and farenheit are related as follows\")\n", + "print(\"Tc=(Tf-32)/1.8\")\n", + "print(\"so temperature of body in degree celcius\"),round(Tc,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.2;pg no:47" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.2, Page:47 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\n", + "using thermometric relation\n", + "t=a*log(p)+(b/2)\n", + "for ice point,b/a=\n", + "so b=2.1972*a\n", + "for steam point\n", + "a= 101.95\n", + "and b= 224.01\n", + "thus, t=in degree celcius\n", + "so for thermodynamic property of 6.5,t=302.83 degree celcius= 302.84\n" + ] + } + ], + "source": [ + "#cal of celcius temperature\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "import math\n", + "print\"Example 2.2, Page:47 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\")\n", + "t1=0;#ice point temperature in degree celcius\n", + "p1=3;#thermometric property for ice point\n", + "t2=100;#steam point temperature in degree celcius\n", + "p2=8;#thermometric property for steam point\n", + "p3=6.5;#thermometric property for any temperature\n", + "print(\"using thermometric relation\")\n", + "print(\"t=a*log(p)+(b/2)\")\n", + "print(\"for ice point,b/a=\")\n", + "b=2*math.log(p1)\n", + "print(\"so b=2.1972*a\")\n", + "print(\"for steam point\")\n", + "a=t2/(math.log(p2)-(2.1972/2))\n", + "print(\"a=\"),round(a,2)\n", + "b=2.1972*a\n", + "print(\"and b=\"),round(b,2)\n", + "t=a*math.log(p3)+(b/2)\n", + "print(\"thus, t=in degree celcius\")\n", + "print(\"so for thermodynamic property of 6.5,t=302.83 degree celcius=\"),round(t,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.3;page no:47" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.3, Page:47 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\n", + "emf equation\n", + "E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\n", + "using emf equation at ice point,E_0 in volts\n", + "E_0= 0.0\n", + "using emf equation at steam point,E_100 in volts\n", + "E_100= 0.3\n", + "now emf at 30 degree celcius using emf equation(E_30)in volts\n", + "now the temperature(T) shown by this thermometer\n", + "T=in degree celcius 30.36\n", + "NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\n" + ] + } + ], + "source": [ + "#cal of temperature shown by this thermometer\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "print\"Example 2.3, Page:47 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\")\n", + "print(\"emf equation\")\n", + "print(\"E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\")\n", + "print(\"using emf equation at ice point,E_0 in volts\")\n", + "t=0.;#ice point temperature in degree celcius\n", + "E_0=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", + "print(\"E_0=\"),round(E_0,2)\n", + "print(\"using emf equation at steam point,E_100 in volts\")\n", + "t=100.;#steam point temperature in degree celcius\n", + "E_100=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", + "print(\"E_100=\"),round(E_100,2)\n", + "print(\"now emf at 30 degree celcius using emf equation(E_30)in volts\")\n", + "t=30.;#temperature of substance in degree celcius\n", + "E_30=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", + "T_100=100.;#steam point temperature in degree celcius\n", + "T_0=0.;#ice point temperature in degree celcius\n", + "T=((E_30-E_0)/(E_100-E_0))*(T_100-T_0)\n", + "print(\"now the temperature(T) shown by this thermometer\")\n", + "print(\"T=in degree celcius\"),round(T,2)\n", + "print(\"NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.4;pg no:48" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.4, Page:48 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\n", + "emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\n", + "as ice point and steam points are two reference points,so\n", + "at ice point,emf(e1)in mV\n", + "at steam point,emf(e2)in mV\n", + "at gas temperature,emf(e3)in mV\n", + "since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV 60.16\n", + "temperature of gas using thermocouple=60.16 degree celcius\n", + "percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius 20.31\n" + ] + } + ], + "source": [ + "#cal of percentage variation in temperature\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "import math\n", + "print\"Example 2.4, Page:48 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\")\n", + "t1=0;#temperature at ice point\n", + "t2=100;#temperature at steam point\n", + "t3=50;#temperature of gas\n", + "print(\"emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\")\n", + "print(\"as ice point and steam points are two reference points,so\")\n", + "print(\"at ice point,emf(e1)in mV\")\n", + "e1=0.18*t1-5.2*10**-4*t1**2\n", + "print(\"at steam point,emf(e2)in mV\")\n", + "e2=0.18*t2-5.2*10**-4*t2**2\n", + "print(\"at gas temperature,emf(e3)in mV\")\n", + "e3=0.18*t3-5.2*10**-4*t3**2\n", + "t=((t2-t1)/(e2-e1))*e3\n", + "variation=((t-t3)/t3)*100\n", + "print(\"since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV\"),round(t,2)\n", + "print(\"temperature of gas using thermocouple=60.16 degree celcius\")\n", + "print(\"percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius\"),round(variation,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.5;pg no:48" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.5, Page:48 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\n", + "let the conversion relation be X=aC+b\n", + "where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \n", + "at freezing point,temperature=0 degree celcius,0 degree X\n", + "so by equation X=aC+b\n", + "we get b=0\n", + "at boiling point,temperature=100 degree celcius,1000 degree X\n", + "conversion relation\n", + "X=10*C\n", + "absolute zero temperature in degree celcius=-273.15\n", + "absolute zero temperature in degree X= -2731.5\n" + ] + } + ], + "source": [ + "#cal of absolute zero temperature\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "print\"Example 2.5, Page:48 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\")\n", + "print(\"let the conversion relation be X=aC+b\")\n", + "print(\"where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \")\n", + "print(\"at freezing point,temperature=0 degree celcius,0 degree X\")\n", + "print(\"so by equation X=aC+b\")\n", + "X=0;#temperature in degree X\n", + "C=0;#temperature in degree celcius\n", + "print(\"we get b=0\")\n", + "b=0;\n", + "print(\"at boiling point,temperature=100 degree celcius,1000 degree X\")\n", + "X=1000;#temperature in degree X\n", + "C=100;#temperature in degree celcius\n", + "a=(X-b)/C\n", + "print(\"conversion relation\")\n", + "print(\"X=10*C\")\n", + "print(\"absolute zero temperature in degree celcius=-273.15\")\n", + "X=10*-273.15\n", + "print(\"absolute zero temperature in degree X=\"),round(X,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter2_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter2_2.ipynb new file mode 100755 index 00000000..6d7e9bc4 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter2_2.ipynb @@ -0,0 +1,314 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# chapter 2:Zeroth Law of Thermodynamics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.1;pg no:46" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.1, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\n", + "degree celcius and farenheit are related as follows\n", + "Tc=(Tf-32)/1.8\n", + "so temperature of body in degree celcius 37.0\n" + ] + } + ], + "source": [ + "#cal of temperature of body of human\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "print\"Example 2.1, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\")\n", + "Tf=98.6;#temperature of body in farenheit\n", + "Tc=(Tf-32)/1.8\n", + "print(\"degree celcius and farenheit are related as follows\")\n", + "print(\"Tc=(Tf-32)/1.8\")\n", + "print(\"so temperature of body in degree celcius\"),round(Tc,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.2;pg no:47" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.2, Page:47 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\n", + "using thermometric relation\n", + "t=a*log(p)+(b/2)\n", + "for ice point,b/a=\n", + "so b=2.1972*a\n", + "for steam point\n", + "a= 101.95\n", + "and b= 224.01\n", + "thus, t=in degree celcius\n", + "so for thermodynamic property of 6.5,t=302.83 degree celcius= 302.84\n" + ] + } + ], + "source": [ + "#cal of celcius temperature\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "import math\n", + "print\"Example 2.2, Page:47 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\")\n", + "t1=0;#ice point temperature in degree celcius\n", + "p1=3;#thermometric property for ice point\n", + "t2=100;#steam point temperature in degree celcius\n", + "p2=8;#thermometric property for steam point\n", + "p3=6.5;#thermometric property for any temperature\n", + "print(\"using thermometric relation\")\n", + "print(\"t=a*log(p)+(b/2)\")\n", + "print(\"for ice point,b/a=\")\n", + "b=2*math.log(p1)\n", + "print(\"so b=2.1972*a\")\n", + "print(\"for steam point\")\n", + "a=t2/(math.log(p2)-(2.1972/2))\n", + "print(\"a=\"),round(a,2)\n", + "b=2.1972*a\n", + "print(\"and b=\"),round(b,2)\n", + "t=a*math.log(p3)+(b/2)\n", + "print(\"thus, t=in degree celcius\")\n", + "print(\"so for thermodynamic property of 6.5,t=302.83 degree celcius=\"),round(t,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.3;page no:47" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.3, Page:47 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\n", + "emf equation\n", + "E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\n", + "using emf equation at ice point,E_0 in volts\n", + "E_0= 0.0\n", + "using emf equation at steam point,E_100 in volts\n", + "E_100= 0.3\n", + "now emf at 30 degree celcius using emf equation(E_30)in volts\n", + "now the temperature(T) shown by this thermometer\n", + "T=in degree celcius 30.36\n", + "NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\n" + ] + } + ], + "source": [ + "#cal of temperature shown by this thermometer\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "print\"Example 2.3, Page:47 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\")\n", + "print(\"emf equation\")\n", + "print(\"E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\")\n", + "print(\"using emf equation at ice point,E_0 in volts\")\n", + "t=0.;#ice point temperature in degree celcius\n", + "E_0=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", + "print(\"E_0=\"),round(E_0,2)\n", + "print(\"using emf equation at steam point,E_100 in volts\")\n", + "t=100.;#steam point temperature in degree celcius\n", + "E_100=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", + "print(\"E_100=\"),round(E_100,2)\n", + "print(\"now emf at 30 degree celcius using emf equation(E_30)in volts\")\n", + "t=30.;#temperature of substance in degree celcius\n", + "E_30=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", + "T_100=100.;#steam point temperature in degree celcius\n", + "T_0=0.;#ice point temperature in degree celcius\n", + "T=((E_30-E_0)/(E_100-E_0))*(T_100-T_0)\n", + "print(\"now the temperature(T) shown by this thermometer\")\n", + "print(\"T=in degree celcius\"),round(T,2)\n", + "print(\"NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.4;pg no:48" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.4, Page:48 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\n", + "emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\n", + "as ice point and steam points are two reference points,so\n", + "at ice point,emf(e1)in mV\n", + "at steam point,emf(e2)in mV\n", + "at gas temperature,emf(e3)in mV\n", + "since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV 60.16\n", + "temperature of gas using thermocouple=60.16 degree celcius\n", + "percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius 20.31\n" + ] + } + ], + "source": [ + "#cal of percentage variation in temperature\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "import math\n", + "print\"Example 2.4, Page:48 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\")\n", + "t1=0;#temperature at ice point\n", + "t2=100;#temperature at steam point\n", + "t3=50;#temperature of gas\n", + "print(\"emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\")\n", + "print(\"as ice point and steam points are two reference points,so\")\n", + "print(\"at ice point,emf(e1)in mV\")\n", + "e1=0.18*t1-5.2*10**-4*t1**2\n", + "print(\"at steam point,emf(e2)in mV\")\n", + "e2=0.18*t2-5.2*10**-4*t2**2\n", + "print(\"at gas temperature,emf(e3)in mV\")\n", + "e3=0.18*t3-5.2*10**-4*t3**2\n", + "t=((t2-t1)/(e2-e1))*e3\n", + "variation=((t-t3)/t3)*100\n", + "print(\"since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV\"),round(t,2)\n", + "print(\"temperature of gas using thermocouple=60.16 degree celcius\")\n", + "print(\"percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius\"),round(variation,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.5;pg no:48" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.5, Page:48 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\n", + "let the conversion relation be X=aC+b\n", + "where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \n", + "at freezing point,temperature=0 degree celcius,0 degree X\n", + "so by equation X=aC+b\n", + "we get b=0\n", + "at boiling point,temperature=100 degree celcius,1000 degree X\n", + "conversion relation\n", + "X=10*C\n", + "absolute zero temperature in degree celcius=-273.15\n", + "absolute zero temperature in degree X= -2731.5\n" + ] + } + ], + "source": [ + "#cal of absolute zero temperature\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "print\"Example 2.5, Page:48 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\")\n", + "print(\"let the conversion relation be X=aC+b\")\n", + "print(\"where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \")\n", + "print(\"at freezing point,temperature=0 degree celcius,0 degree X\")\n", + "print(\"so by equation X=aC+b\")\n", + "X=0;#temperature in degree X\n", + "C=0;#temperature in degree celcius\n", + "print(\"we get b=0\")\n", + "b=0;\n", + "print(\"at boiling point,temperature=100 degree celcius,1000 degree X\")\n", + "X=1000;#temperature in degree X\n", + "C=100;#temperature in degree celcius\n", + "a=(X-b)/C\n", + "print(\"conversion relation\")\n", + "print(\"X=10*C\")\n", + "print(\"absolute zero temperature in degree celcius=-273.15\")\n", + "X=10*-273.15\n", + "print(\"absolute zero temperature in degree X=\"),round(X,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter2_3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter2_3.ipynb new file mode 100755 index 00000000..6d7e9bc4 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter2_3.ipynb @@ -0,0 +1,314 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# chapter 2:Zeroth Law of Thermodynamics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.1;pg no:46" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.1, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\n", + "degree celcius and farenheit are related as follows\n", + "Tc=(Tf-32)/1.8\n", + "so temperature of body in degree celcius 37.0\n" + ] + } + ], + "source": [ + "#cal of temperature of body of human\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "print\"Example 2.1, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\")\n", + "Tf=98.6;#temperature of body in farenheit\n", + "Tc=(Tf-32)/1.8\n", + "print(\"degree celcius and farenheit are related as follows\")\n", + "print(\"Tc=(Tf-32)/1.8\")\n", + "print(\"so temperature of body in degree celcius\"),round(Tc,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.2;pg no:47" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.2, Page:47 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\n", + "using thermometric relation\n", + "t=a*log(p)+(b/2)\n", + "for ice point,b/a=\n", + "so b=2.1972*a\n", + "for steam point\n", + "a= 101.95\n", + "and b= 224.01\n", + "thus, t=in degree celcius\n", + "so for thermodynamic property of 6.5,t=302.83 degree celcius= 302.84\n" + ] + } + ], + "source": [ + "#cal of celcius temperature\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "import math\n", + "print\"Example 2.2, Page:47 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\")\n", + "t1=0;#ice point temperature in degree celcius\n", + "p1=3;#thermometric property for ice point\n", + "t2=100;#steam point temperature in degree celcius\n", + "p2=8;#thermometric property for steam point\n", + "p3=6.5;#thermometric property for any temperature\n", + "print(\"using thermometric relation\")\n", + "print(\"t=a*log(p)+(b/2)\")\n", + "print(\"for ice point,b/a=\")\n", + "b=2*math.log(p1)\n", + "print(\"so b=2.1972*a\")\n", + "print(\"for steam point\")\n", + "a=t2/(math.log(p2)-(2.1972/2))\n", + "print(\"a=\"),round(a,2)\n", + "b=2.1972*a\n", + "print(\"and b=\"),round(b,2)\n", + "t=a*math.log(p3)+(b/2)\n", + "print(\"thus, t=in degree celcius\")\n", + "print(\"so for thermodynamic property of 6.5,t=302.83 degree celcius=\"),round(t,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.3;page no:47" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.3, Page:47 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\n", + "emf equation\n", + "E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\n", + "using emf equation at ice point,E_0 in volts\n", + "E_0= 0.0\n", + "using emf equation at steam point,E_100 in volts\n", + "E_100= 0.3\n", + "now emf at 30 degree celcius using emf equation(E_30)in volts\n", + "now the temperature(T) shown by this thermometer\n", + "T=in degree celcius 30.36\n", + "NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\n" + ] + } + ], + "source": [ + "#cal of temperature shown by this thermometer\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "print\"Example 2.3, Page:47 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\")\n", + "print(\"emf equation\")\n", + "print(\"E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\")\n", + "print(\"using emf equation at ice point,E_0 in volts\")\n", + "t=0.;#ice point temperature in degree celcius\n", + "E_0=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", + "print(\"E_0=\"),round(E_0,2)\n", + "print(\"using emf equation at steam point,E_100 in volts\")\n", + "t=100.;#steam point temperature in degree celcius\n", + "E_100=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", + "print(\"E_100=\"),round(E_100,2)\n", + "print(\"now emf at 30 degree celcius using emf equation(E_30)in volts\")\n", + "t=30.;#temperature of substance in degree celcius\n", + "E_30=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", + "T_100=100.;#steam point temperature in degree celcius\n", + "T_0=0.;#ice point temperature in degree celcius\n", + "T=((E_30-E_0)/(E_100-E_0))*(T_100-T_0)\n", + "print(\"now the temperature(T) shown by this thermometer\")\n", + "print(\"T=in degree celcius\"),round(T,2)\n", + "print(\"NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.4;pg no:48" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.4, Page:48 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\n", + "emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\n", + "as ice point and steam points are two reference points,so\n", + "at ice point,emf(e1)in mV\n", + "at steam point,emf(e2)in mV\n", + "at gas temperature,emf(e3)in mV\n", + "since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV 60.16\n", + "temperature of gas using thermocouple=60.16 degree celcius\n", + "percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius 20.31\n" + ] + } + ], + "source": [ + "#cal of percentage variation in temperature\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "import math\n", + "print\"Example 2.4, Page:48 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\")\n", + "t1=0;#temperature at ice point\n", + "t2=100;#temperature at steam point\n", + "t3=50;#temperature of gas\n", + "print(\"emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\")\n", + "print(\"as ice point and steam points are two reference points,so\")\n", + "print(\"at ice point,emf(e1)in mV\")\n", + "e1=0.18*t1-5.2*10**-4*t1**2\n", + "print(\"at steam point,emf(e2)in mV\")\n", + "e2=0.18*t2-5.2*10**-4*t2**2\n", + "print(\"at gas temperature,emf(e3)in mV\")\n", + "e3=0.18*t3-5.2*10**-4*t3**2\n", + "t=((t2-t1)/(e2-e1))*e3\n", + "variation=((t-t3)/t3)*100\n", + "print(\"since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV\"),round(t,2)\n", + "print(\"temperature of gas using thermocouple=60.16 degree celcius\")\n", + "print(\"percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius\"),round(variation,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 2.5;pg no:48" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 2.5, Page:48 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\n", + "let the conversion relation be X=aC+b\n", + "where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \n", + "at freezing point,temperature=0 degree celcius,0 degree X\n", + "so by equation X=aC+b\n", + "we get b=0\n", + "at boiling point,temperature=100 degree celcius,1000 degree X\n", + "conversion relation\n", + "X=10*C\n", + "absolute zero temperature in degree celcius=-273.15\n", + "absolute zero temperature in degree X= -2731.5\n" + ] + } + ], + "source": [ + "#cal of absolute zero temperature\n", + "#intiation of all variables\n", + "# Chapter 2\n", + "print\"Example 2.5, Page:48 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\")\n", + "print(\"let the conversion relation be X=aC+b\")\n", + "print(\"where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \")\n", + "print(\"at freezing point,temperature=0 degree celcius,0 degree X\")\n", + "print(\"so by equation X=aC+b\")\n", + "X=0;#temperature in degree X\n", + "C=0;#temperature in degree celcius\n", + "print(\"we get b=0\")\n", + "b=0;\n", + "print(\"at boiling point,temperature=100 degree celcius,1000 degree X\")\n", + "X=1000;#temperature in degree X\n", + "C=100;#temperature in degree celcius\n", + "a=(X-b)/C\n", + "print(\"conversion relation\")\n", + "print(\"X=10*C\")\n", + "print(\"absolute zero temperature in degree celcius=-273.15\")\n", + "X=10*-273.15\n", + "print(\"absolute zero temperature in degree X=\"),round(X,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter3.ipynb new file mode 100755 index 00000000..22ed40c9 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter3.ipynb @@ -0,0 +1,1506 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3:First Law of Thermo Dynamics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.1;pg no:76" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.1, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\n", + "a> work done on piston(W_piston)in KJ can be obtained as\n", + "W_piston=pdv\n", + "b> paddle work done on the system(W_paddle)=-4.88 KJ\n", + "net work done of system(W_net)in KJ\n", + "W_net=W_piston+W_paddle\n", + "so work done on system(W_net)=1.435 KJ\n" + ] + } + ], + "source": [ + "#cal of work done on system\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.1, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\")\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "p=689.;#pressure of gas in cylinder in kpa\n", + "v1=0.04;#initial volume of fluid in m^3\n", + "v2=0.045;#final volume of fluid in m^3\n", + "W_paddle=-4.88;#paddle work done on the system in KJ\n", + "print(\"a> work done on piston(W_piston)in KJ can be obtained as\")\n", + "print(\"W_piston=pdv\")\n", + "#function y = f(v), y=p, endfunction\n", + "def fun1(x):\n", + "\ty=p\n", + "\treturn y\n", + "\n", + "W_piston=scipy.integrate.quad(fun1,v1,v2) \n", + "print(\"b> paddle work done on the system(W_paddle)=-4.88 KJ\")\n", + "print(\"net work done of system(W_net)in KJ\")\n", + "print(\"W_net=W_piston+W_paddle\")\n", + "print(\"so work done on system(W_net)=1.435 KJ\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.2;pg no:" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.2, Page:76 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\n", + "as the vessel is rigid therefore work done shall be zero\n", + "W=0\n", + "from first law of thermodynamics,heat required(Q)in KJ\n", + "Q=U2-U1+W=Q=m(u2-u1)+W\n", + "so heat required = 5.6\n" + ] + } + ], + "source": [ + "#cal of heat required\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.2, Page:76 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\")\n", + "m=0.5;#mass of gas in kg\n", + "u1=26.6;#internal energy of gas at 200 degree celcius\n", + "u2=37.8;#internal energy of gas at 400 degree celcius\n", + "W=0;#work done by vessel in KJ\n", + "print(\"as the vessel is rigid therefore work done shall be zero\")\n", + "print(\"W=0\")\n", + "print(\"from first law of thermodynamics,heat required(Q)in KJ\")\n", + "print(\"Q=U2-U1+W=Q=m(u2-u1)+W\")\n", + "Q=m*(u2-u1)+W\n", + "print(\"so heat required =\"),round(Q,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.3;pg no:77" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.3, Page:77 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\n", + "by steady flow energy equation\n", + "q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\n", + "let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\n", + "q=h2-h1\n", + "rate of heat removal(Q)in KJ/hr\n", + "Q=m(h2-h1)=m*Cp*(T2-T1)\n", + "heat should be removed at the rate=KJ/hr 40500.0\n" + ] + } + ], + "source": [ + "#cal of \"heat should be removed\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.3, Page:77 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\")\n", + "m=50;#rate at which carbon dioxide passing through heat exchanger in kg/hr\n", + "T2=800;#initial temperature of carbon dioxide in degree celcius\n", + "T1=50;#final temperature of carbon dioxide in degree celcius\n", + "Cp=1.08;#specific heat at constant pressure in KJ/kg K\n", + "print(\"by steady flow energy equation\")\n", + "print(\"q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\")\n", + "print(\"let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\")\n", + "print(\"q=h2-h1\")\n", + "print(\"rate of heat removal(Q)in KJ/hr\")\n", + "print(\"Q=m(h2-h1)=m*Cp*(T2-T1)\")\n", + "Q=m*Cp*(T2-T1)\n", + "print(\"heat should be removed at the rate=KJ/hr\"),round(Q)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.4;pg no:77" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "#cal of work done by surrounding on system\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.4, Page:77 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 4\")\n", + "v=0.78;#volume of cylinder in m^3\n", + "p=101.325;#atmospheric pressure in kPa\n", + "print(\"total work done by the air at atmospheric pressure of 101.325 kPa\")\n", + "print(\"W=(pdv)cylinder+(pdv)air\")\n", + "print(\"0+p*(delta v)\")\n", + "print(\"work done by air(W)=-p*v in KJ\")\n", + "W=-p*v\n", + "print(\"so work done by surrounding on system=KJ\"),round(-W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.5:pg no:77" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.5, Page:77 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\n", + "given p*v^1.3=constant\n", + "assuming expansion to be quasi-static,the work may be given as\n", + "W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\n", + "from internal energy relation,change in specific internal energy\n", + "deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\n", + "total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\n", + "using p1*V1^1.3=p2*V2^1.3\n", + "V2=in m^3 0.85\n", + "take V2=.852 m^3\n", + "so deltaU in KJ\n", + "and W in KJ 246.67\n", + "from first law\n", + "deltaQ=KJ 113.47\n", + "heat interaction=113.5 KJ\n", + "work interaction=246.7 KJ\n", + "change in internal energy=-113.2 KJ\n" + ] + } + ], + "source": [ + "#cal of heat,work interaction and change in internal energy\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.5, Page:77 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\")\n", + "m=5;#mass of gas in kg\n", + "p1=1*10**3;#initial pressure of gas in KPa\n", + "V1=0.5;#initial volume of gas in m^3\n", + "p2=0.5*10**3;#final pressure of gas in KPa\n", + "n=1.3;#expansion constant\n", + "print(\"given p*v^1.3=constant\")\n", + "print(\"assuming expansion to be quasi-static,the work may be given as\")\n", + "print(\"W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\")\n", + "print(\"from internal energy relation,change in specific internal energy\")\n", + "print(\"deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\")\n", + "print(\"total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\")\n", + "print(\"using p1*V1^1.3=p2*V2^1.3\")\n", + "V2=V1*(p1/p2)**(1/1.3)\n", + "print(\"V2=in m^3\"),round(V2,2)\n", + "print(\"take V2=.852 m^3\")\n", + "V2=0.852;#final volume of gas in m^3\n", + "print(\"so deltaU in KJ\")\n", + "deltaU=1.8*(p2*V2-p1*V1)\n", + "W=(p2*V2-p1*V1)/(1-n)\n", + "print(\"and W in KJ\"),round(W,2)\n", + "print(\"from first law\")\n", + "deltaQ=deltaU+W\n", + "print(\"deltaQ=KJ\"),round(deltaQ,2)\n", + "print(\"heat interaction=113.5 KJ\")\n", + "print(\"work interaction=246.7 KJ\")\n", + "print(\"change in internal energy=-113.2 KJ\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.6;pg no:78" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.6, Page:78 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\n", + "final state volume(v2)in m^3\n", + "v2= 0.0\n", + "take v2=0.03 m^3\n", + "now internal energy of gas is given by U=7.5*p*v-425\n", + "change in internal energy(deltaU)in KJ\n", + "deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\n", + "deltaU=7.5*10^3*(p2*v2-p1*v1) 75.0\n", + "for quasi-static process\n", + "work(W) in KJ,W=p*dv\n", + "W=(p2*v2-p1*v1)/(1-n)\n", + "from first law of thermodynamics,\n", + "heat interaction(deltaQ)=deltaU+W\n", + "heat=50 KJ\n", + "work=25 KJ(-ve)\n", + "internal energy change=75 KJ\n", + "if 180 KJ heat transfer takes place,then from 1st law,\n", + "deltaQ= 50.0\n", + "since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\n", + "W=KJ 105.0\n" + ] + } + ], + "source": [ + "#cal of heat,workinternal energy change\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.6, Page:78 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\")\n", + "p1=1;#initial pressure of gas in MPa\n", + "v1=0.05;#initial volume of gas in m^3\n", + "p2=2;#final pressure of gas in MPa\n", + "n=1.4;#expansion constant\n", + "print(\"final state volume(v2)in m^3\")\n", + "v2=((p1/p2)**(1/1.4))*v1\n", + "print(\"v2=\"),round(v2,2)\n", + "print(\"take v2=0.03 m^3\")\n", + "v2=0.03;#final volume of gas in m^3\n", + "print(\"now internal energy of gas is given by U=7.5*p*v-425\")\n", + "print(\"change in internal energy(deltaU)in KJ\")\n", + "print(\"deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\")\n", + "deltaU=7.5*10**3*(p2*v2-p1*v1)\n", + "print(\"deltaU=7.5*10^3*(p2*v2-p1*v1)\"),round(deltaU,2)\n", + "print(\"for quasi-static process\")\n", + "print(\"work(W) in KJ,W=p*dv\")\n", + "W=((p2*v2-p1*v1)/(1-n))*10**3\n", + "print(\"W=(p2*v2-p1*v1)/(1-n)\")\n", + "print(\"from first law of thermodynamics,\")\n", + "print(\"heat interaction(deltaQ)=deltaU+W\")\n", + "deltaQ=deltaU+W\n", + "print(\"heat=50 KJ\")\n", + "print(\"work=25 KJ(-ve)\")\n", + "print(\"internal energy change=75 KJ\")\n", + "print(\"if 180 KJ heat transfer takes place,then from 1st law,\")\n", + "print(\"deltaQ=\"),round(deltaQ,2)\n", + "print(\"since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\")\n", + "W=180-75\n", + "print(\"W=KJ\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.7;pg no:79" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.7, Page:79 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\n", + "characteristics gas constant(R)in J/kg K\n", + "R= 519.64\n", + "take R=0.520,KJ/kg K\n", + "Cv=inKJ/kg K 1.18\n", + "y= 1.44\n", + "for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\n", + "now,T2=in K\n", + "work(W)in KJ/kg\n", + "W= -257.78\n", + "for polytropic process,heat(Q)in KJ/K\n", + "Q= 82.02\n" + ] + } + ], + "source": [ + "#cal of work and heat\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.7, Page:79 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\")\n", + "M=16;#molecular weight of gas\n", + "p1=101.3;#initial pressure of gas in KPa\n", + "p2=600;#final pressure of gas in KPa\n", + "T1=(273+20);#initial temperature of gas in K\n", + "R1=8.3143*10**3;#universal gas constant in J/kg K\n", + "Cp=1.7;#specific heat at constant pressure in KJ/kg K\n", + "n=1.3;#expansion constant\n", + "T2=((p2/p1)**(n-1/n))\n", + "print(\"characteristics gas constant(R)in J/kg K\")\n", + "R=R1/M\n", + "print(\"R=\"),round(R,2)\n", + "print(\"take R=0.520,KJ/kg K\")\n", + "R=0.520;#characteristics gas constant in KJ/kg K\n", + "Cv=Cp-R\n", + "print(\"Cv=inKJ/kg K\"),round(Cv,2)\n", + "y=Cp/Cv\n", + "print(\"y=\"),round(y,2)\n", + "y=1.44;#ratio of specific heat at constant pressure to constant volume\n", + "print(\"for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\")\n", + "T2=T1*((p2/p1)**((n-1)/n))\n", + "print(\"now,T2=in K\")\n", + "print(\"work(W)in KJ/kg\")\n", + "W=R*((T1-T2)/(n-1))\n", + "print(\"W=\"),round(W,2)\n", + "W=257.78034;#work done in KJ/kg\n", + "print(\"for polytropic process,heat(Q)in KJ/K\")\n", + "Q=((y-n)/(y-1))*W\n", + "print(\"Q=\"),round(Q,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.8;pg no:80" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.8, Page:80 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\n", + "applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\n", + "h1+C1^2/2=h2+C2^2/2\n", + "given that C1=0,negligible inlet velocity\n", + "so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\n", + "exit velocity(C2)in m/s 1098.2\n" + ] + } + ], + "source": [ + "#cal of exit velocity\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.8, Page:80 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\")\n", + "T1=(627+273);#initial temperature of air in nozzle in K\n", + "T2=(27+273);#temperature at which air leaves nozzle in K\n", + "Cp=1.005*10**3;#specific heat at constant pressure in J/kg K\n", + "C2=math.sqrt(2*Cp*(T1-T2))\n", + "print(\"applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\")\n", + "print(\"h1+C1^2/2=h2+C2^2/2\")\n", + "print(\"given that C1=0,negligible inlet velocity\")\n", + "print(\"so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\")\n", + "print(\"exit velocity(C2)in m/s\"),round(C2,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.9;pg no:80" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.9, Page:80 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\n", + "work interaction,W=-200 KJ/kg of air\n", + "increase in enthalpy of air=100 KJ/kg of air\n", + "total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\n", + "writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\n", + "h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\n", + "assuming no change in potential energy and kinetic energy\n", + "deltaK.E=deltaP.=0\n", + "total heat interaction(Q)in KJ/kg of air\n", + "Q= -100.0\n", + "Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\n", + "so heat transferred to atmosphere(Q2)in KJ/kg of air -10.0\n" + ] + } + ], + "source": [ + "#cal of heat transferred to atmosphere\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.9, Page:80 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\")\n", + "W=-200;#shaft work in KJ/kg of air\n", + "deltah=100;#increase in enthalpy in KJ/kg of air\n", + "Q1=-90;#heat transferred to water in KJ/kg of air\n", + "print(\"work interaction,W=-200 KJ/kg of air\")\n", + "print(\"increase in enthalpy of air=100 KJ/kg of air\")\n", + "print(\"total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\")\n", + "print(\"writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\")\n", + "print(\"h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\")\n", + "print(\"assuming no change in potential energy and kinetic energy\")\n", + "print(\"deltaK.E=deltaP.=0\")\n", + "print(\"total heat interaction(Q)in KJ/kg of air\")\n", + "Q=deltah+W\n", + "print(\"Q=\"),round(Q,2)\n", + "Q2=Q-Q1\n", + "print(\"Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\")\n", + "print(\"so heat transferred to atmosphere(Q2)in KJ/kg of air\"),round(Q2,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.10;pg no:81" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.10, Page:81 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\n", + "above problem can be solved using steady flow energy equations upon hot water flow\n", + "Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\n", + "here total heat to be supplied(Q)in kcal/hr\n", + "so heat lost by water(-ve),Q=-25000 kcal/hr\n", + "there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\n", + "Q+m*(h1+g*z1)=m*(h2+g*z2)\n", + "so water circulation rate(m)in kg/hr\n", + "so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\n", + "water circulation rate=(m)in kg/min 11.91\n" + ] + } + ], + "source": [ + "#cal of water circulation rate\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.10, Page:81 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\")\n", + "n=500;#total number of persons\n", + "q=50;#heat requirement per person in kcal/hr\n", + "h1=80;#enthalpy of hot water enter in pipe in kcal/kg\n", + "h2=45;#enthalpy of hot water leaves the pipe in kcal/kg\n", + "g=9.81;#acceleartion due to gravity in m/s^2\n", + "deltaz=10;#difference in elevation of inlet and exit pipe in m\n", + "print(\"above problem can be solved using steady flow energy equations upon hot water flow\")\n", + "print(\"Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\")\n", + "print(\"here total heat to be supplied(Q)in kcal/hr\")\n", + "Q=n*q\n", + "print(\"so heat lost by water(-ve),Q=-25000 kcal/hr\")\n", + "Q=-25000#heat loss by water in kcal/hr\n", + "print(\"there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\")\n", + "print(\"Q+m*(h1+g*z1)=m*(h2+g*z2)\")\n", + "print(\"so water circulation rate(m)in kg/hr\")\n", + "print(\"so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\")\n", + "m=Q*10**3*4.18/(g*deltaz-(h1-h2)*10**3*4.18)\n", + "m=m/60\n", + "print(\"water circulation rate=(m)in kg/min\"),round(m,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.11;pg no:81" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.11, Page:81 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\n", + "let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\n", + "energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\n", + "m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\n", + "so steam suppling rate(m)in kg/s per kg of water\n", + "m= 0.124\n", + "NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\n" + ] + } + ], + "source": [ + "#cal of steam suppling rate\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.11, Page:81 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\")\n", + "v1=50;#velocity of steam entering injector in m/s\n", + "v2=25;#velocity of mixture leave injector in m/s\n", + "h1=720;#enthalpy of steam entering injector in kcal/kg\n", + "h2=24.6;#enthalpy of water entering injector in kcal/kg\n", + "h3=100;#enthalpy of steam leaving injector in kcal/kg\n", + "h4=100;#enthalpy of water leaving injector in kcal/kg\n", + "deltaz=2;#depth from axis of injector in m\n", + "q=12;#heat loss from injector to surrounding through injector\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\")\n", + "print(\"energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\")\n", + "print(\"m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\")\n", + "print(\"so steam suppling rate(m)in kg/s per kg of water\")\n", + "m=((h3*10**3*4.18+v2**2/2)-(h2*10**3*4.18+g*deltaz))/((v1**2/2+h1*10**3*4.18)-(h3*10**3*4.18+v2**2/2)-(q*10**3*4.18))\n", + "print(\"m=\"),round(m,3)\n", + "print(\"NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.12;pg no:82" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.12, Page:82 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\n", + "here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\n", + "displacement work, W=(p.dv)cylinder+(p.dv)ballon\n", + "(p.dv)cylinder=0,as cylinder is rigid\n", + "so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\n", + "and work done by atmosphere=KJ 40.52\n" + ] + } + ], + "source": [ + "#cal of work done by atmosphere\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.12, Page:82 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\")\n", + "p=1.013*10**5;#atmospheric pressure in pa\n", + "deltav=0.4;#change in volume in m^3\n", + "print(\"here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\")\n", + "print(\"displacement work, W=(p.dv)cylinder+(p.dv)ballon\")\n", + "print(\"(p.dv)cylinder=0,as cylinder is rigid\")\n", + "print(\"so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\")\n", + "W=(p*deltav)/1000\n", + "print(\"and work done by atmosphere=KJ\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.13;pg no:82" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.13, Page:82 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\n", + "work done by turbine(Wt)in J#s is 25% of heat added i.e Wt= 1250.0\n", + "heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\n", + "Qrejected= 3750.0\n", + "and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\n", + "Wp=(-) 10.0\n", + "capacity of generator(W)=in Kw 1.24\n" + ] + } + ], + "source": [ + "#cal of capacity of generator\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.13, Page:82 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\")\n", + "Qadd=5000;#heat supplied in boiler in J#s\n", + "Wt=.25*Qadd\n", + "print(\"work done by turbine(Wt)in J#s is 25% of heat added i.e\"),\n", + "print(\"Wt=\"),round(Wt,2)\n", + "print(\"heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\")\n", + "Qrejected=.75*Qadd\n", + "print(\"Qrejected=\"),round(Qrejected,2)\n", + "print(\"and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\")\n", + "Wp=0.002*Qadd\n", + "print(\"Wp=(-)\"),round(Wp,2)\n", + "W=(Wt-Wp)/1000\n", + "print(\"capacity of generator(W)=in Kw\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.14;pg no:83" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.14, Page:83 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\n", + "in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\n", + "h1+Q1_2=h2\n", + "Q1_2=h2-h1\n", + "so heat transfer to air in heat exchanger(Q1_2)in KJ\n", + "Q1_2= 726.61\n", + "in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\n", + "h2+C2^2#2=h3+C3^2/2+Wt\n", + "Wt=(h2-h3)+(C2^2-C3^2)/2\n", + "so power output from turbine(Wt)in KJ#s\n", + "Wt= 1.0\n", + "applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\n", + "h3+C=h4+C4^2/2\n", + "C4^2#2=(h3-h4)+C3^2/2\n", + "velocity at exit of nozzle(C4)in m#s\n", + "C4= 14.3\n" + ] + } + ], + "source": [ + "#cal of velocity at exit of nozzle\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.14, Page:83 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\")\n", + "T1=(27+273);##ambient temperature in K\n", + "T2=(750+273);##temperature of heated air inside heat exchanger in K\n", + "T3=(600+273);##temperature of hot air leaves turbine in K\n", + "T4=(500+273);##temperature at which air leaves nozzle in K\n", + "Cp=1.005;##specific heat at constant pressure in KJ#kg K\n", + "C2=50;##velocity of hot air enter into gas turbine in m#s\n", + "C3=60;##velocity of air leaving turbine enters a nozzle in m#s\n", + "print(\"in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\")\n", + "print(\"h1+Q1_2=h2\")\n", + "print(\"Q1_2=h2-h1\")\n", + "print(\"so heat transfer to air in heat exchanger(Q1_2)in KJ\")\n", + "Q1_2=Cp*(T2-T1)\n", + "print(\"Q1_2=\"),round(Q1_2,2)\n", + "print(\"in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\")\n", + "print(\"h2+C2^2#2=h3+C3^2/2+Wt\")\n", + "print(\"Wt=(h2-h3)+(C2^2-C3^2)/2\")\n", + "print(\"so power output from turbine(Wt)in KJ#s\")\n", + "Wt=Cp*(T2-T3)+(C2**2-C3**2)*10**-3/2\n", + "print(\"Wt=\"),round(Cp,2)\n", + "print(\"applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\")\n", + "print(\"h3+C=h4+C4^2/2\")\n", + "print(\"C4^2#2=(h3-h4)+C3^2/2\")\n", + "print(\"velocity at exit of nozzle(C4)in m#s\")\n", + "C4=math.sqrt(2*(Cp*(T3-T4)+C3**2*10**-3/2))\n", + "print(\"C4=\"),round(C4,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.15;pg no:85" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.15, Page:85 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\n", + "for constant pressure heating,say state changes from 1 to 2\n", + "Wa=p1*dv\n", + "Wa=p1*(v2-v1)\n", + "it is given that v2=2v1\n", + "so Wa=p1*v1=R*T1\n", + "for subsequent expansion at constant temperature say state from 2 to 3\n", + "also given that v3/v1=6,v3/v2=3\n", + "so work=Wb=p*dv\n", + "on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\n", + "temperature at 2 can be given by perfect gas consideration as,\n", + "T2/T1=v2/v1\n", + "or T2=2*T1\n", + "now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\n", + "so W in KJ= 10632.69\n" + ] + } + ], + "source": [ + "#cal of total work done by ai\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.15, Page:85 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\")\n", + "T1=400;##initial temperature of gas in K\n", + "R=8.314;##gas constant in \n", + "print(\"for constant pressure heating,say state changes from 1 to 2\")\n", + "print(\"Wa=p1*dv\")\n", + "print(\"Wa=p1*(v2-v1)\")\n", + "print(\"it is given that v2=2v1\")\n", + "print(\"so Wa=p1*v1=R*T1\")\n", + "print(\"for subsequent expansion at constant temperature say state from 2 to 3\")\n", + "print(\"also given that v3/v1=6,v3/v2=3\")\n", + "print(\"so work=Wb=p*dv\")\n", + "print(\"on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\")\n", + "print(\"temperature at 2 can be given by perfect gas consideration as,\")\n", + "print(\"T2/T1=v2/v1\")\n", + "print(\"or T2=2*T1\")\n", + "print(\"now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\")\n", + "W=R*T1+2*R*T1*math.log(3)\n", + "print(\"so W in KJ=\"),round(W,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.16;pg no:85" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.16, Page:85 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\n", + "NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \n", + "we get W=(Vf-Vi)*((Pi+Pf)/2)\n", + "also final volume of gas in m^3 is Vf=3*Vi\n", + "now work done by gas(W)in J 750000.0\n" + ] + } + ], + "source": [ + "#cal of work done by gas\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.16, Page:85 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\")\n", + "Pi=0.5*10**6;##initial pressure of gas in pa\n", + "Vi=0.5;##initial volume of gas in m^3\n", + "Pf=1*10**6;##final pressure of gas in pa\n", + "print(\"NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \")\n", + "print(\"we get W=(Vf-Vi)*((Pi+Pf)/2)\")\n", + "print(\"also final volume of gas in m^3 is Vf=3*Vi\") \n", + "Vf=3*Vi\n", + "W=(Vf-Vi)*((Pi+Pf)/2)\n", + "print(\"now work done by gas(W)in J\"),round(W,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.17;pg no:87" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.17, Page:87 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\n", + "with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\n", + "adiabatic index of compression of H2 can be obtained as,\n", + "Cp_H2=\n", + "y_H2=Cp_H2/(Cp_H2-R_H2) 1.4\n", + "adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\n", + "y_N2= 1.4\n", + "i>for hydrogen,p1*v1^y=p2*v2^y\n", + "so final pressure of H2(p2)in pa\n", + "p2= 1324078.55\n", + "ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \n", + "partition work=0\n", + "iii>work done upon H2(W_H2)in J,\n", + "W_H2= -200054.06\n", + "work done upon H2(W_H2)=-2*10^5 J\n", + "so work done by N2(W_N2)=2*10^5 J \n", + "iv>heat added to N2 can be obtained using first law of thermodynamics as\n", + "Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\n", + "final temperature of N2 can be obtained considering it as perfect gas\n", + "therefore, T2=(p2*v2*T1)#(p1*v1)\n", + "here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\n", + "p2=1.324*10^6 pa,v2=0.75 m^3\n", + "so now final temperature of N2(T2)in K= 1191.67\n", + "mass of N2(m)in kg= 2.81\n", + "specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2= 1.0\n", + "heat added to N2,(Q_N2)in KJ\n", + "Q_N2= 2052.89\n" + ] + } + ], + "source": [ + "#cal of \n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.17, Page:87 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\")\n", + "Cp_H2=14.307;##specific heat of H2 at constant pressure in KJ#kg K\n", + "R_H2=4.1240;##gas constant for H2 in KJ#kg K\n", + "Cp_N2=1.039;##specific heat of N2 at constant pressure in KJ#kg K\n", + "R_N2=0.2968;##gas constant for N2 in KJ#kg K\n", + "T1=(27+273);##ambient temperature in K\n", + "v1=0.5;##initial volume of H2 in m^3\n", + "p1=0.5*10**6;##initial pressure of H2 in pa \n", + "v2=0.25;##final volume of H2 in m^3 \n", + "p2=1.324*10**6;##final pressure of H2 in pa\n", + "print(\"with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\")\n", + "print(\"adiabatic index of compression of H2 can be obtained as,\")\n", + "print(\"Cp_H2=\")\n", + "y_H2=Cp_H2/(Cp_H2-R_H2)\n", + "print(\"y_H2=Cp_H2/(Cp_H2-R_H2)\"),round(y_H2,2)\n", + "print(\"adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\")\n", + "y_N2=Cp_N2/(Cp_N2-R_N2)\n", + "print(\"y_N2=\"),round(y_N2,2)\n", + "print(\"i>for hydrogen,p1*v1^y=p2*v2^y\")\n", + "print(\"so final pressure of H2(p2)in pa\")\n", + "p2=p1*(v1/v2)**y_H2\n", + "print(\"p2=\"),round(p2,2)\n", + "print(\"ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \")\n", + "print(\"partition work=0\")\n", + "print(\"iii>work done upon H2(W_H2)in J,\")\n", + "W_H2=(p1*v1-p2*v2)/(y_H2-1)\n", + "print(\"W_H2=\"),round(W_H2,2)\n", + "print(\"work done upon H2(W_H2)=-2*10^5 J\")\n", + "W_N2=2*10**5;##work done by N2 in J\n", + "print(\"so work done by N2(W_N2)=2*10^5 J \")\n", + "print(\"iv>heat added to N2 can be obtained using first law of thermodynamics as\")\n", + "print(\"Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\")\n", + "print(\"final temperature of N2 can be obtained considering it as perfect gas\")\n", + "print(\"therefore, T2=(p2*v2*T1)#(p1*v1)\")\n", + "print(\"here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\")\n", + "print(\"p2=1.324*10^6 pa,v2=0.75 m^3\")\n", + "v2=0.75;##final volume of N2 in m^3\n", + "T2=(p2*v2*T1)/(p1*v1)\n", + "print(\"so now final temperature of N2(T2)in K=\"),round(T2,2)\n", + "T2=1191.6;##T2 approx. equal to 1191.6 K\n", + "m=(p1*v1)/(R_N2*1000*T1)\n", + "print(\"mass of N2(m)in kg=\"),round(m,2)\n", + "m=2.8;##m approx equal to 2.8 kg\n", + "Cv_N2=Cp_N2-R_N2\n", + "print(\"specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2=\"),round(Cv_N2)\n", + "print(\"heat added to N2,(Q_N2)in KJ\")\n", + "Q_N2=((m*Cv_N2*1000*(T2-T1))+W_N2)/1000\n", + "print(\"Q_N2=\"),round(Q_N2,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.18;pg no:88" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.18, Page:88 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\n", + "let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\n", + "initial mass of air(m1)in kg\n", + "m1= 9.29\n", + "for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\n", + "T2=in K 237.64\n", + "final mass of air left in tank(m2)in kg\n", + "m2= 2.97\n", + "writing down energy equation for unsteady flow system\n", + "(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\n", + "or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\n", + "kinetic energy available for running turbine(W)in KJ\n", + "W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", + "W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", + "amount of work available=KJ 482.67\n" + ] + } + ], + "source": [ + "#cal of amount of work available\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.18, Page:88 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\")\n", + "p1=0.5*10**6;#initial pressure of air in pa\n", + "p2=1.013*10**5;#atmospheric pressure in pa\n", + "v1=2;#initial volume of air in m^3\n", + "v2=v1;#final volume of air in m^3\n", + "T1=375;#initial temperature of air in K\n", + "Cp_air=1.003;#specific heat at consatnt pressure in KJ/kg K\n", + "Cv_air=0.716;#specific heat at consatnt volume in KJ/kg K\n", + "R_air=0.287;#gas constant in KJ/kg K\n", + "y=1.4;#expansion constant for air\n", + "print(\"let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\")\n", + "print(\"initial mass of air(m1)in kg\")\n", + "m1=(p1*v1)/(R_air*1000*T1)\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"T2=in K\"),round(T2,2)\n", + "print(\"final mass of air left in tank(m2)in kg\")\n", + "m2=(p2*v2)/(R_air*1000*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"writing down energy equation for unsteady flow system\")\n", + "print(\"(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\")\n", + "print(\"or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\")\n", + "print(\"kinetic energy available for running turbine(W)in KJ\")\n", + "print(\"W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", + "print(\"W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", + "W=((m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2)/1000\n", + "print(\"amount of work available=KJ\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.19;pg no:89" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.19, Page:89 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\n", + "using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\n", + "n1= 0.1\n", + "now n2= 0.12\n", + "for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\n", + "deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\n", + "final temperature of gas(T3)in K\n", + "T3= 409.09\n", + "using perfect gas equation for final mixture,\n", + "final pressure of gas(p3)in Mpa\n", + "p3= 750000.0\n", + "so final pressure and temperature =0.75 Mpa and 409.11 K\n" + ] + } + ], + "source": [ + "#cal of final pressure and temperature\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.19, Page:89 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\")\n", + "p1=0.5*10**6;#initial pressure of air in pa\n", + "v1=0.5;#initial volume of air in m^3\n", + "T1=(27+273);#initial temperature of air in K\n", + "p2=1*10**6;#final pressure of air in pa\n", + "v2=0.5;#final volume of air in m^3\n", + "T2=500;#final temperature of air in K\n", + "R=8314;#gas constant in J/kg K\n", + "Cv=0.716;#specific heat at constant volume in KJ/kg K\n", + "print(\"using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\")\n", + "n1=(p1*v1)/(R*T1)\n", + "print(\"n1=\"),round(n1,2)\n", + "n2=(p2*v2)/(R*T2)\n", + "print(\"now n2=\"),round(n2,2)\n", + "print(\"for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\")\n", + "deltaU=0;#change in internal energy\n", + "print(\"deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\")\n", + "print(\"final temperature of gas(T3)in K\")\n", + "T3=(deltaU+Cv*(n1*T1+n2*T2))/(Cv*(n1+n2))\n", + "print(\"T3=\"),round(T3,2)\n", + "print(\"using perfect gas equation for final mixture,\")\n", + "print(\"final pressure of gas(p3)in Mpa\")\n", + "p3=((n1+n2)*R*T3)/(v1+v2)\n", + "print(\"p3=\"),round(p3,3)\n", + "print(\"so final pressure and temperature =0.75 Mpa and 409.11 K\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.20;pg no:90" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.20, Page:90 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\n", + "printlacement work,W=p*(v1-v2)in N.m -50675.0\n", + "so heat transfer(Q)in N.m\n", + "Q=-W 50675.0\n" + ] + } + ], + "source": [ + "#cal of heat transfer\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.20, Page:90 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\")\n", + "v1=0;#initial volume of air inside bottle in m^3\n", + "v2=0.5;#final volume of air inside bottle in m^3\n", + "p=1.0135*10**5;#atmospheric pressure in pa\n", + "W=p*(v1-v2)\n", + "print(\"printlacement work,W=p*(v1-v2)in N.m\"),round(W,2)\n", + "print(\"so heat transfer(Q)in N.m\")\n", + "Q=-W\n", + "print(\"Q=-W\"),round(Q,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.21;pg no:90" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.21, Page:90 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\n", + "here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\n", + "(p2/p1)^((y-1)/y)=(T2/T1)\n", + "final temperature of air(T2)in K\n", + "T2= 113.34\n", + "by perfect gas law,initial mass in bottle(m1)in kg\n", + "m1= 11.69\n", + "final mass in bottle(m2)in kg\n", + "m2= 0.92\n", + "energy available for running turbo generator or work(W)in KJ\n", + "W+(m1-m2)*h2=m1*u1-m2*u2\n", + "W= 1325.42\n", + "this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\n", + "turbogenerator actual output(P1)=5 KJ/s\n", + "input to turbogenerator(P2)in KJ/s\n", + "time duration for which turbogenerator can be run(deltat)in seconds\n", + "deltat= 159.05\n", + "duration=160 seconds approx.\n" + ] + } + ], + "source": [ + "#cal of time duration for which turbogenerator can be run\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.21, Page:90 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\")\n", + "p1=35.*10**5;#initial pressure of air in pa\n", + "v1=0.3;#initial volume of air in m^3\n", + "T1=(313.);#initial temperature of air in K\n", + "p2=1.*10**5;#final pressure of air in pa\n", + "v2=0.3;#final volume of air in m^3\n", + "y=1.4;#expansion constant\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\")\n", + "print(\"(p2/p1)^((y-1)/y)=(T2/T1)\")\n", + "print(\"final temperature of air(T2)in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"T2=\"),round(T2,2)\n", + "print(\"by perfect gas law,initial mass in bottle(m1)in kg\")\n", + "m1=(p1*v1)/(R*1000.*T1)\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"final mass in bottle(m2)in kg\")\n", + "m2=(p2*v2)/(R*1000.*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"energy available for running turbo generator or work(W)in KJ\")\n", + "print(\"W+(m1-m2)*h2=m1*u1-m2*u2\")\n", + "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", + "print(\"W=\"),round(W,2)\n", + "print(\"this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\")\n", + "print(\"turbogenerator actual output(P1)=5 KJ/s\")\n", + "P1=5;#turbogenerator actual output in KJ/s\n", + "print(\"input to turbogenerator(P2)in KJ/s\")\n", + "P2=P1/0.6\n", + "print(\"time duration for which turbogenerator can be run(deltat)in seconds\")\n", + "deltat=W/P2\n", + "print(\"deltat=\"),round(deltat,2)\n", + "print(\"duration=160 seconds approx.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.22;pg no:91" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.22, Page:91 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\n", + "different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\n", + "process 1-2 is polytropic process with index 1.2\n", + "(T2/T1)=(p2/p1)^((n-1)/n)\n", + "final temperature of air(T2)in K\n", + "T2= 457.68\n", + "at state 1,p1*v1=m*R*T1\n", + "initial volume of air(v1)in m^3\n", + "v1= 2.01\n", + "final volume of air(v2)in m^3\n", + "for process 1-2,v2= 0.53\n", + "for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\n", + "v3=v2*T3/T2 in m^3\n", + "here process 3-1 is isothermal process so T1=T3\n", + "during process 1-2 the compression work(W1_2)in KJ\n", + "W1_2=(m*R*(T2-T1)/(1-n))\n", + "work during process 2-3(W2_3)in KJ,\n", + "W2_3=p2*(v3-v2)/1000\n", + "work during process 3-1(W3_1)in KJ\n", + "W3_1= 485.0\n", + "net work done(W_net)in KJ\n", + "W_net=W1_2+W2_3+W3_1 -71.28\n", + "net work=-71.27 KJ\n", + "here -ve workshows work done upon the system.since it is cycle,so\n", + "W_net=Q_net\n", + "phi dW=phi dQ=-71.27 KJ\n", + "heat transferred from system=71.27 KJ\n" + ] + } + ], + "source": [ + "#cal of network,heat transferred from system\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.22, Page:91 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\")\n", + "p1=1.5*10**5;#initial pressure of air in pa\n", + "T1=(77+273);#initial temperature of air in K\n", + "p2=7.5*10**5;#final pressure of air in pa\n", + "n=1.2;#expansion constant for process 1-2\n", + "R=0.287;#gas constant in KJ/kg K\n", + "m=3.;#mass of air in kg\n", + "print(\"different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\")\n", + "print(\"process 1-2 is polytropic process with index 1.2\")\n", + "print(\"(T2/T1)=(p2/p1)^((n-1)/n)\")\n", + "print(\"final temperature of air(T2)in K\")\n", + "T2=T1*((p2/p1)**((n-1)/n))\n", + "print(\"T2=\"),round(T2,2)\n", + "print(\"at state 1,p1*v1=m*R*T1\")\n", + "print(\"initial volume of air(v1)in m^3\")\n", + "v1=(m*R*1000*T1)/p1\n", + "print(\"v1=\"),round(v1,2)\n", + "print(\"final volume of air(v2)in m^3\")\n", + "v2=((p1*v1**n)/p2)**(1/n)\n", + "print(\"for process 1-2,v2=\"),round(v2,2)\n", + "print(\"for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\")\n", + "print(\"v3=v2*T3/T2 in m^3\")\n", + "print(\"here process 3-1 is isothermal process so T1=T3\")\n", + "T3=T1;#process 3-1 is isothermal\n", + "v3=v2*T3/T2\n", + "print(\"during process 1-2 the compression work(W1_2)in KJ\")\n", + "print(\"W1_2=(m*R*(T2-T1)/(1-n))\")\n", + "W1_2=(m*R*(T2-T1)/(1-n))\n", + "print(\"work during process 2-3(W2_3)in KJ,\")\n", + "print(\"W2_3=p2*(v3-v2)/1000\")\n", + "W2_3=p2*(v3-v2)/1000\n", + "print(\"work during process 3-1(W3_1)in KJ\")\n", + "p3=p2;#pressure is constant for process 2-3\n", + "W3_1=p3*v3*math.log(v1/v3)/1000\n", + "print(\"W3_1=\"),round(W3_1,2)\n", + "print(\"net work done(W_net)in KJ\")\n", + "W_net=W1_2+W2_3+W3_1\n", + "print(\"W_net=W1_2+W2_3+W3_1\"),round(W_net,2)\n", + "print(\"net work=-71.27 KJ\")\n", + "print(\"here -ve workshows work done upon the system.since it is cycle,so\")\n", + "print(\"W_net=Q_net\")\n", + "print(\"phi dW=phi dQ=-71.27 KJ\")\n", + "print(\"heat transferred from system=71.27 KJ\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.23;pg no:93" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.23, Page:93 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\n", + "initial mass of air in bottle(m1)in kg \n", + "m1= 6.97\n", + "now final temperature(T2)in K\n", + "T2= 0.0\n", + "final mass of air in bottle(m2)in kg\n", + "m2= 0.82\n", + "energy available for running of turbine due to emptying of bottle(W)in KJ\n", + "W= 639.09\n", + "work available from turbine=639.27KJ\n" + ] + } + ], + "source": [ + "#cal of work available from turbine\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.23, Page:93 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\")\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "y=1.4;#expansion constant \n", + "p1=40*10**5;#initial temperature of air in pa\n", + "v1=0.15;#initial volume of air in m^3\n", + "T1=(27+273);#initial temperature of air in K\n", + "p2=2*10**5;#final temperature of air in pa\n", + "v2=0.15;#final volume of air in m^3\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"initial mass of air in bottle(m1)in kg \")\n", + "m1=(p1*v1)/(R*1000*T1)\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"now final temperature(T2)in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"T2=\"),round(T2,2)\n", + "T2=127.36;#take T2=127.36 approx.\n", + "print(\"final mass of air in bottle(m2)in kg\")\n", + "m2=(p2*v2)/(R*1000*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "m2=0.821;#take m2=0.821 approx.\n", + "print(\"energy available for running of turbine due to emptying of bottle(W)in KJ\")\n", + "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", + "print(\"W=\"),round(W,2)\n", + "print(\"work available from turbine=639.27KJ\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter3_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter3_1.ipynb new file mode 100755 index 00000000..22ed40c9 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter3_1.ipynb @@ -0,0 +1,1506 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3:First Law of Thermo Dynamics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.1;pg no:76" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.1, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\n", + "a> work done on piston(W_piston)in KJ can be obtained as\n", + "W_piston=pdv\n", + "b> paddle work done on the system(W_paddle)=-4.88 KJ\n", + "net work done of system(W_net)in KJ\n", + "W_net=W_piston+W_paddle\n", + "so work done on system(W_net)=1.435 KJ\n" + ] + } + ], + "source": [ + "#cal of work done on system\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.1, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\")\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "p=689.;#pressure of gas in cylinder in kpa\n", + "v1=0.04;#initial volume of fluid in m^3\n", + "v2=0.045;#final volume of fluid in m^3\n", + "W_paddle=-4.88;#paddle work done on the system in KJ\n", + "print(\"a> work done on piston(W_piston)in KJ can be obtained as\")\n", + "print(\"W_piston=pdv\")\n", + "#function y = f(v), y=p, endfunction\n", + "def fun1(x):\n", + "\ty=p\n", + "\treturn y\n", + "\n", + "W_piston=scipy.integrate.quad(fun1,v1,v2) \n", + "print(\"b> paddle work done on the system(W_paddle)=-4.88 KJ\")\n", + "print(\"net work done of system(W_net)in KJ\")\n", + "print(\"W_net=W_piston+W_paddle\")\n", + "print(\"so work done on system(W_net)=1.435 KJ\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.2;pg no:" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.2, Page:76 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\n", + "as the vessel is rigid therefore work done shall be zero\n", + "W=0\n", + "from first law of thermodynamics,heat required(Q)in KJ\n", + "Q=U2-U1+W=Q=m(u2-u1)+W\n", + "so heat required = 5.6\n" + ] + } + ], + "source": [ + "#cal of heat required\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.2, Page:76 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\")\n", + "m=0.5;#mass of gas in kg\n", + "u1=26.6;#internal energy of gas at 200 degree celcius\n", + "u2=37.8;#internal energy of gas at 400 degree celcius\n", + "W=0;#work done by vessel in KJ\n", + "print(\"as the vessel is rigid therefore work done shall be zero\")\n", + "print(\"W=0\")\n", + "print(\"from first law of thermodynamics,heat required(Q)in KJ\")\n", + "print(\"Q=U2-U1+W=Q=m(u2-u1)+W\")\n", + "Q=m*(u2-u1)+W\n", + "print(\"so heat required =\"),round(Q,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.3;pg no:77" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.3, Page:77 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\n", + "by steady flow energy equation\n", + "q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\n", + "let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\n", + "q=h2-h1\n", + "rate of heat removal(Q)in KJ/hr\n", + "Q=m(h2-h1)=m*Cp*(T2-T1)\n", + "heat should be removed at the rate=KJ/hr 40500.0\n" + ] + } + ], + "source": [ + "#cal of \"heat should be removed\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.3, Page:77 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\")\n", + "m=50;#rate at which carbon dioxide passing through heat exchanger in kg/hr\n", + "T2=800;#initial temperature of carbon dioxide in degree celcius\n", + "T1=50;#final temperature of carbon dioxide in degree celcius\n", + "Cp=1.08;#specific heat at constant pressure in KJ/kg K\n", + "print(\"by steady flow energy equation\")\n", + "print(\"q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\")\n", + "print(\"let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\")\n", + "print(\"q=h2-h1\")\n", + "print(\"rate of heat removal(Q)in KJ/hr\")\n", + "print(\"Q=m(h2-h1)=m*Cp*(T2-T1)\")\n", + "Q=m*Cp*(T2-T1)\n", + "print(\"heat should be removed at the rate=KJ/hr\"),round(Q)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.4;pg no:77" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "#cal of work done by surrounding on system\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.4, Page:77 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 4\")\n", + "v=0.78;#volume of cylinder in m^3\n", + "p=101.325;#atmospheric pressure in kPa\n", + "print(\"total work done by the air at atmospheric pressure of 101.325 kPa\")\n", + "print(\"W=(pdv)cylinder+(pdv)air\")\n", + "print(\"0+p*(delta v)\")\n", + "print(\"work done by air(W)=-p*v in KJ\")\n", + "W=-p*v\n", + "print(\"so work done by surrounding on system=KJ\"),round(-W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.5:pg no:77" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.5, Page:77 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\n", + "given p*v^1.3=constant\n", + "assuming expansion to be quasi-static,the work may be given as\n", + "W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\n", + "from internal energy relation,change in specific internal energy\n", + "deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\n", + "total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\n", + "using p1*V1^1.3=p2*V2^1.3\n", + "V2=in m^3 0.85\n", + "take V2=.852 m^3\n", + "so deltaU in KJ\n", + "and W in KJ 246.67\n", + "from first law\n", + "deltaQ=KJ 113.47\n", + "heat interaction=113.5 KJ\n", + "work interaction=246.7 KJ\n", + "change in internal energy=-113.2 KJ\n" + ] + } + ], + "source": [ + "#cal of heat,work interaction and change in internal energy\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.5, Page:77 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\")\n", + "m=5;#mass of gas in kg\n", + "p1=1*10**3;#initial pressure of gas in KPa\n", + "V1=0.5;#initial volume of gas in m^3\n", + "p2=0.5*10**3;#final pressure of gas in KPa\n", + "n=1.3;#expansion constant\n", + "print(\"given p*v^1.3=constant\")\n", + "print(\"assuming expansion to be quasi-static,the work may be given as\")\n", + "print(\"W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\")\n", + "print(\"from internal energy relation,change in specific internal energy\")\n", + "print(\"deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\")\n", + "print(\"total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\")\n", + "print(\"using p1*V1^1.3=p2*V2^1.3\")\n", + "V2=V1*(p1/p2)**(1/1.3)\n", + "print(\"V2=in m^3\"),round(V2,2)\n", + "print(\"take V2=.852 m^3\")\n", + "V2=0.852;#final volume of gas in m^3\n", + "print(\"so deltaU in KJ\")\n", + "deltaU=1.8*(p2*V2-p1*V1)\n", + "W=(p2*V2-p1*V1)/(1-n)\n", + "print(\"and W in KJ\"),round(W,2)\n", + "print(\"from first law\")\n", + "deltaQ=deltaU+W\n", + "print(\"deltaQ=KJ\"),round(deltaQ,2)\n", + "print(\"heat interaction=113.5 KJ\")\n", + "print(\"work interaction=246.7 KJ\")\n", + "print(\"change in internal energy=-113.2 KJ\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.6;pg no:78" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.6, Page:78 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\n", + "final state volume(v2)in m^3\n", + "v2= 0.0\n", + "take v2=0.03 m^3\n", + "now internal energy of gas is given by U=7.5*p*v-425\n", + "change in internal energy(deltaU)in KJ\n", + "deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\n", + "deltaU=7.5*10^3*(p2*v2-p1*v1) 75.0\n", + "for quasi-static process\n", + "work(W) in KJ,W=p*dv\n", + "W=(p2*v2-p1*v1)/(1-n)\n", + "from first law of thermodynamics,\n", + "heat interaction(deltaQ)=deltaU+W\n", + "heat=50 KJ\n", + "work=25 KJ(-ve)\n", + "internal energy change=75 KJ\n", + "if 180 KJ heat transfer takes place,then from 1st law,\n", + "deltaQ= 50.0\n", + "since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\n", + "W=KJ 105.0\n" + ] + } + ], + "source": [ + "#cal of heat,workinternal energy change\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.6, Page:78 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\")\n", + "p1=1;#initial pressure of gas in MPa\n", + "v1=0.05;#initial volume of gas in m^3\n", + "p2=2;#final pressure of gas in MPa\n", + "n=1.4;#expansion constant\n", + "print(\"final state volume(v2)in m^3\")\n", + "v2=((p1/p2)**(1/1.4))*v1\n", + "print(\"v2=\"),round(v2,2)\n", + "print(\"take v2=0.03 m^3\")\n", + "v2=0.03;#final volume of gas in m^3\n", + "print(\"now internal energy of gas is given by U=7.5*p*v-425\")\n", + "print(\"change in internal energy(deltaU)in KJ\")\n", + "print(\"deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\")\n", + "deltaU=7.5*10**3*(p2*v2-p1*v1)\n", + "print(\"deltaU=7.5*10^3*(p2*v2-p1*v1)\"),round(deltaU,2)\n", + "print(\"for quasi-static process\")\n", + "print(\"work(W) in KJ,W=p*dv\")\n", + "W=((p2*v2-p1*v1)/(1-n))*10**3\n", + "print(\"W=(p2*v2-p1*v1)/(1-n)\")\n", + "print(\"from first law of thermodynamics,\")\n", + "print(\"heat interaction(deltaQ)=deltaU+W\")\n", + "deltaQ=deltaU+W\n", + "print(\"heat=50 KJ\")\n", + "print(\"work=25 KJ(-ve)\")\n", + "print(\"internal energy change=75 KJ\")\n", + "print(\"if 180 KJ heat transfer takes place,then from 1st law,\")\n", + "print(\"deltaQ=\"),round(deltaQ,2)\n", + "print(\"since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\")\n", + "W=180-75\n", + "print(\"W=KJ\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.7;pg no:79" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.7, Page:79 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\n", + "characteristics gas constant(R)in J/kg K\n", + "R= 519.64\n", + "take R=0.520,KJ/kg K\n", + "Cv=inKJ/kg K 1.18\n", + "y= 1.44\n", + "for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\n", + "now,T2=in K\n", + "work(W)in KJ/kg\n", + "W= -257.78\n", + "for polytropic process,heat(Q)in KJ/K\n", + "Q= 82.02\n" + ] + } + ], + "source": [ + "#cal of work and heat\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.7, Page:79 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\")\n", + "M=16;#molecular weight of gas\n", + "p1=101.3;#initial pressure of gas in KPa\n", + "p2=600;#final pressure of gas in KPa\n", + "T1=(273+20);#initial temperature of gas in K\n", + "R1=8.3143*10**3;#universal gas constant in J/kg K\n", + "Cp=1.7;#specific heat at constant pressure in KJ/kg K\n", + "n=1.3;#expansion constant\n", + "T2=((p2/p1)**(n-1/n))\n", + "print(\"characteristics gas constant(R)in J/kg K\")\n", + "R=R1/M\n", + "print(\"R=\"),round(R,2)\n", + "print(\"take R=0.520,KJ/kg K\")\n", + "R=0.520;#characteristics gas constant in KJ/kg K\n", + "Cv=Cp-R\n", + "print(\"Cv=inKJ/kg K\"),round(Cv,2)\n", + "y=Cp/Cv\n", + "print(\"y=\"),round(y,2)\n", + "y=1.44;#ratio of specific heat at constant pressure to constant volume\n", + "print(\"for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\")\n", + "T2=T1*((p2/p1)**((n-1)/n))\n", + "print(\"now,T2=in K\")\n", + "print(\"work(W)in KJ/kg\")\n", + "W=R*((T1-T2)/(n-1))\n", + "print(\"W=\"),round(W,2)\n", + "W=257.78034;#work done in KJ/kg\n", + "print(\"for polytropic process,heat(Q)in KJ/K\")\n", + "Q=((y-n)/(y-1))*W\n", + "print(\"Q=\"),round(Q,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.8;pg no:80" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.8, Page:80 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\n", + "applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\n", + "h1+C1^2/2=h2+C2^2/2\n", + "given that C1=0,negligible inlet velocity\n", + "so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\n", + "exit velocity(C2)in m/s 1098.2\n" + ] + } + ], + "source": [ + "#cal of exit velocity\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.8, Page:80 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\")\n", + "T1=(627+273);#initial temperature of air in nozzle in K\n", + "T2=(27+273);#temperature at which air leaves nozzle in K\n", + "Cp=1.005*10**3;#specific heat at constant pressure in J/kg K\n", + "C2=math.sqrt(2*Cp*(T1-T2))\n", + "print(\"applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\")\n", + "print(\"h1+C1^2/2=h2+C2^2/2\")\n", + "print(\"given that C1=0,negligible inlet velocity\")\n", + "print(\"so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\")\n", + "print(\"exit velocity(C2)in m/s\"),round(C2,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.9;pg no:80" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.9, Page:80 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\n", + "work interaction,W=-200 KJ/kg of air\n", + "increase in enthalpy of air=100 KJ/kg of air\n", + "total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\n", + "writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\n", + "h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\n", + "assuming no change in potential energy and kinetic energy\n", + "deltaK.E=deltaP.=0\n", + "total heat interaction(Q)in KJ/kg of air\n", + "Q= -100.0\n", + "Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\n", + "so heat transferred to atmosphere(Q2)in KJ/kg of air -10.0\n" + ] + } + ], + "source": [ + "#cal of heat transferred to atmosphere\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.9, Page:80 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\")\n", + "W=-200;#shaft work in KJ/kg of air\n", + "deltah=100;#increase in enthalpy in KJ/kg of air\n", + "Q1=-90;#heat transferred to water in KJ/kg of air\n", + "print(\"work interaction,W=-200 KJ/kg of air\")\n", + "print(\"increase in enthalpy of air=100 KJ/kg of air\")\n", + "print(\"total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\")\n", + "print(\"writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\")\n", + "print(\"h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\")\n", + "print(\"assuming no change in potential energy and kinetic energy\")\n", + "print(\"deltaK.E=deltaP.=0\")\n", + "print(\"total heat interaction(Q)in KJ/kg of air\")\n", + "Q=deltah+W\n", + "print(\"Q=\"),round(Q,2)\n", + "Q2=Q-Q1\n", + "print(\"Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\")\n", + "print(\"so heat transferred to atmosphere(Q2)in KJ/kg of air\"),round(Q2,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.10;pg no:81" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.10, Page:81 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\n", + "above problem can be solved using steady flow energy equations upon hot water flow\n", + "Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\n", + "here total heat to be supplied(Q)in kcal/hr\n", + "so heat lost by water(-ve),Q=-25000 kcal/hr\n", + "there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\n", + "Q+m*(h1+g*z1)=m*(h2+g*z2)\n", + "so water circulation rate(m)in kg/hr\n", + "so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\n", + "water circulation rate=(m)in kg/min 11.91\n" + ] + } + ], + "source": [ + "#cal of water circulation rate\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.10, Page:81 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\")\n", + "n=500;#total number of persons\n", + "q=50;#heat requirement per person in kcal/hr\n", + "h1=80;#enthalpy of hot water enter in pipe in kcal/kg\n", + "h2=45;#enthalpy of hot water leaves the pipe in kcal/kg\n", + "g=9.81;#acceleartion due to gravity in m/s^2\n", + "deltaz=10;#difference in elevation of inlet and exit pipe in m\n", + "print(\"above problem can be solved using steady flow energy equations upon hot water flow\")\n", + "print(\"Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\")\n", + "print(\"here total heat to be supplied(Q)in kcal/hr\")\n", + "Q=n*q\n", + "print(\"so heat lost by water(-ve),Q=-25000 kcal/hr\")\n", + "Q=-25000#heat loss by water in kcal/hr\n", + "print(\"there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\")\n", + "print(\"Q+m*(h1+g*z1)=m*(h2+g*z2)\")\n", + "print(\"so water circulation rate(m)in kg/hr\")\n", + "print(\"so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\")\n", + "m=Q*10**3*4.18/(g*deltaz-(h1-h2)*10**3*4.18)\n", + "m=m/60\n", + "print(\"water circulation rate=(m)in kg/min\"),round(m,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.11;pg no:81" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.11, Page:81 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\n", + "let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\n", + "energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\n", + "m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\n", + "so steam suppling rate(m)in kg/s per kg of water\n", + "m= 0.124\n", + "NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\n" + ] + } + ], + "source": [ + "#cal of steam suppling rate\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.11, Page:81 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\")\n", + "v1=50;#velocity of steam entering injector in m/s\n", + "v2=25;#velocity of mixture leave injector in m/s\n", + "h1=720;#enthalpy of steam entering injector in kcal/kg\n", + "h2=24.6;#enthalpy of water entering injector in kcal/kg\n", + "h3=100;#enthalpy of steam leaving injector in kcal/kg\n", + "h4=100;#enthalpy of water leaving injector in kcal/kg\n", + "deltaz=2;#depth from axis of injector in m\n", + "q=12;#heat loss from injector to surrounding through injector\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\")\n", + "print(\"energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\")\n", + "print(\"m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\")\n", + "print(\"so steam suppling rate(m)in kg/s per kg of water\")\n", + "m=((h3*10**3*4.18+v2**2/2)-(h2*10**3*4.18+g*deltaz))/((v1**2/2+h1*10**3*4.18)-(h3*10**3*4.18+v2**2/2)-(q*10**3*4.18))\n", + "print(\"m=\"),round(m,3)\n", + "print(\"NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.12;pg no:82" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.12, Page:82 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\n", + "here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\n", + "displacement work, W=(p.dv)cylinder+(p.dv)ballon\n", + "(p.dv)cylinder=0,as cylinder is rigid\n", + "so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\n", + "and work done by atmosphere=KJ 40.52\n" + ] + } + ], + "source": [ + "#cal of work done by atmosphere\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.12, Page:82 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\")\n", + "p=1.013*10**5;#atmospheric pressure in pa\n", + "deltav=0.4;#change in volume in m^3\n", + "print(\"here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\")\n", + "print(\"displacement work, W=(p.dv)cylinder+(p.dv)ballon\")\n", + "print(\"(p.dv)cylinder=0,as cylinder is rigid\")\n", + "print(\"so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\")\n", + "W=(p*deltav)/1000\n", + "print(\"and work done by atmosphere=KJ\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.13;pg no:82" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.13, Page:82 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\n", + "work done by turbine(Wt)in J#s is 25% of heat added i.e Wt= 1250.0\n", + "heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\n", + "Qrejected= 3750.0\n", + "and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\n", + "Wp=(-) 10.0\n", + "capacity of generator(W)=in Kw 1.24\n" + ] + } + ], + "source": [ + "#cal of capacity of generator\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.13, Page:82 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\")\n", + "Qadd=5000;#heat supplied in boiler in J#s\n", + "Wt=.25*Qadd\n", + "print(\"work done by turbine(Wt)in J#s is 25% of heat added i.e\"),\n", + "print(\"Wt=\"),round(Wt,2)\n", + "print(\"heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\")\n", + "Qrejected=.75*Qadd\n", + "print(\"Qrejected=\"),round(Qrejected,2)\n", + "print(\"and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\")\n", + "Wp=0.002*Qadd\n", + "print(\"Wp=(-)\"),round(Wp,2)\n", + "W=(Wt-Wp)/1000\n", + "print(\"capacity of generator(W)=in Kw\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.14;pg no:83" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.14, Page:83 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\n", + "in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\n", + "h1+Q1_2=h2\n", + "Q1_2=h2-h1\n", + "so heat transfer to air in heat exchanger(Q1_2)in KJ\n", + "Q1_2= 726.61\n", + "in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\n", + "h2+C2^2#2=h3+C3^2/2+Wt\n", + "Wt=(h2-h3)+(C2^2-C3^2)/2\n", + "so power output from turbine(Wt)in KJ#s\n", + "Wt= 1.0\n", + "applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\n", + "h3+C=h4+C4^2/2\n", + "C4^2#2=(h3-h4)+C3^2/2\n", + "velocity at exit of nozzle(C4)in m#s\n", + "C4= 14.3\n" + ] + } + ], + "source": [ + "#cal of velocity at exit of nozzle\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.14, Page:83 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\")\n", + "T1=(27+273);##ambient temperature in K\n", + "T2=(750+273);##temperature of heated air inside heat exchanger in K\n", + "T3=(600+273);##temperature of hot air leaves turbine in K\n", + "T4=(500+273);##temperature at which air leaves nozzle in K\n", + "Cp=1.005;##specific heat at constant pressure in KJ#kg K\n", + "C2=50;##velocity of hot air enter into gas turbine in m#s\n", + "C3=60;##velocity of air leaving turbine enters a nozzle in m#s\n", + "print(\"in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\")\n", + "print(\"h1+Q1_2=h2\")\n", + "print(\"Q1_2=h2-h1\")\n", + "print(\"so heat transfer to air in heat exchanger(Q1_2)in KJ\")\n", + "Q1_2=Cp*(T2-T1)\n", + "print(\"Q1_2=\"),round(Q1_2,2)\n", + "print(\"in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\")\n", + "print(\"h2+C2^2#2=h3+C3^2/2+Wt\")\n", + "print(\"Wt=(h2-h3)+(C2^2-C3^2)/2\")\n", + "print(\"so power output from turbine(Wt)in KJ#s\")\n", + "Wt=Cp*(T2-T3)+(C2**2-C3**2)*10**-3/2\n", + "print(\"Wt=\"),round(Cp,2)\n", + "print(\"applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\")\n", + "print(\"h3+C=h4+C4^2/2\")\n", + "print(\"C4^2#2=(h3-h4)+C3^2/2\")\n", + "print(\"velocity at exit of nozzle(C4)in m#s\")\n", + "C4=math.sqrt(2*(Cp*(T3-T4)+C3**2*10**-3/2))\n", + "print(\"C4=\"),round(C4,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.15;pg no:85" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.15, Page:85 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\n", + "for constant pressure heating,say state changes from 1 to 2\n", + "Wa=p1*dv\n", + "Wa=p1*(v2-v1)\n", + "it is given that v2=2v1\n", + "so Wa=p1*v1=R*T1\n", + "for subsequent expansion at constant temperature say state from 2 to 3\n", + "also given that v3/v1=6,v3/v2=3\n", + "so work=Wb=p*dv\n", + "on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\n", + "temperature at 2 can be given by perfect gas consideration as,\n", + "T2/T1=v2/v1\n", + "or T2=2*T1\n", + "now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\n", + "so W in KJ= 10632.69\n" + ] + } + ], + "source": [ + "#cal of total work done by ai\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.15, Page:85 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\")\n", + "T1=400;##initial temperature of gas in K\n", + "R=8.314;##gas constant in \n", + "print(\"for constant pressure heating,say state changes from 1 to 2\")\n", + "print(\"Wa=p1*dv\")\n", + "print(\"Wa=p1*(v2-v1)\")\n", + "print(\"it is given that v2=2v1\")\n", + "print(\"so Wa=p1*v1=R*T1\")\n", + "print(\"for subsequent expansion at constant temperature say state from 2 to 3\")\n", + "print(\"also given that v3/v1=6,v3/v2=3\")\n", + "print(\"so work=Wb=p*dv\")\n", + "print(\"on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\")\n", + "print(\"temperature at 2 can be given by perfect gas consideration as,\")\n", + "print(\"T2/T1=v2/v1\")\n", + "print(\"or T2=2*T1\")\n", + "print(\"now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\")\n", + "W=R*T1+2*R*T1*math.log(3)\n", + "print(\"so W in KJ=\"),round(W,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.16;pg no:85" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.16, Page:85 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\n", + "NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \n", + "we get W=(Vf-Vi)*((Pi+Pf)/2)\n", + "also final volume of gas in m^3 is Vf=3*Vi\n", + "now work done by gas(W)in J 750000.0\n" + ] + } + ], + "source": [ + "#cal of work done by gas\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.16, Page:85 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\")\n", + "Pi=0.5*10**6;##initial pressure of gas in pa\n", + "Vi=0.5;##initial volume of gas in m^3\n", + "Pf=1*10**6;##final pressure of gas in pa\n", + "print(\"NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \")\n", + "print(\"we get W=(Vf-Vi)*((Pi+Pf)/2)\")\n", + "print(\"also final volume of gas in m^3 is Vf=3*Vi\") \n", + "Vf=3*Vi\n", + "W=(Vf-Vi)*((Pi+Pf)/2)\n", + "print(\"now work done by gas(W)in J\"),round(W,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.17;pg no:87" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.17, Page:87 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\n", + "with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\n", + "adiabatic index of compression of H2 can be obtained as,\n", + "Cp_H2=\n", + "y_H2=Cp_H2/(Cp_H2-R_H2) 1.4\n", + "adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\n", + "y_N2= 1.4\n", + "i>for hydrogen,p1*v1^y=p2*v2^y\n", + "so final pressure of H2(p2)in pa\n", + "p2= 1324078.55\n", + "ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \n", + "partition work=0\n", + "iii>work done upon H2(W_H2)in J,\n", + "W_H2= -200054.06\n", + "work done upon H2(W_H2)=-2*10^5 J\n", + "so work done by N2(W_N2)=2*10^5 J \n", + "iv>heat added to N2 can be obtained using first law of thermodynamics as\n", + "Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\n", + "final temperature of N2 can be obtained considering it as perfect gas\n", + "therefore, T2=(p2*v2*T1)#(p1*v1)\n", + "here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\n", + "p2=1.324*10^6 pa,v2=0.75 m^3\n", + "so now final temperature of N2(T2)in K= 1191.67\n", + "mass of N2(m)in kg= 2.81\n", + "specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2= 1.0\n", + "heat added to N2,(Q_N2)in KJ\n", + "Q_N2= 2052.89\n" + ] + } + ], + "source": [ + "#cal of \n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.17, Page:87 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\")\n", + "Cp_H2=14.307;##specific heat of H2 at constant pressure in KJ#kg K\n", + "R_H2=4.1240;##gas constant for H2 in KJ#kg K\n", + "Cp_N2=1.039;##specific heat of N2 at constant pressure in KJ#kg K\n", + "R_N2=0.2968;##gas constant for N2 in KJ#kg K\n", + "T1=(27+273);##ambient temperature in K\n", + "v1=0.5;##initial volume of H2 in m^3\n", + "p1=0.5*10**6;##initial pressure of H2 in pa \n", + "v2=0.25;##final volume of H2 in m^3 \n", + "p2=1.324*10**6;##final pressure of H2 in pa\n", + "print(\"with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\")\n", + "print(\"adiabatic index of compression of H2 can be obtained as,\")\n", + "print(\"Cp_H2=\")\n", + "y_H2=Cp_H2/(Cp_H2-R_H2)\n", + "print(\"y_H2=Cp_H2/(Cp_H2-R_H2)\"),round(y_H2,2)\n", + "print(\"adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\")\n", + "y_N2=Cp_N2/(Cp_N2-R_N2)\n", + "print(\"y_N2=\"),round(y_N2,2)\n", + "print(\"i>for hydrogen,p1*v1^y=p2*v2^y\")\n", + "print(\"so final pressure of H2(p2)in pa\")\n", + "p2=p1*(v1/v2)**y_H2\n", + "print(\"p2=\"),round(p2,2)\n", + "print(\"ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \")\n", + "print(\"partition work=0\")\n", + "print(\"iii>work done upon H2(W_H2)in J,\")\n", + "W_H2=(p1*v1-p2*v2)/(y_H2-1)\n", + "print(\"W_H2=\"),round(W_H2,2)\n", + "print(\"work done upon H2(W_H2)=-2*10^5 J\")\n", + "W_N2=2*10**5;##work done by N2 in J\n", + "print(\"so work done by N2(W_N2)=2*10^5 J \")\n", + "print(\"iv>heat added to N2 can be obtained using first law of thermodynamics as\")\n", + "print(\"Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\")\n", + "print(\"final temperature of N2 can be obtained considering it as perfect gas\")\n", + "print(\"therefore, T2=(p2*v2*T1)#(p1*v1)\")\n", + "print(\"here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\")\n", + "print(\"p2=1.324*10^6 pa,v2=0.75 m^3\")\n", + "v2=0.75;##final volume of N2 in m^3\n", + "T2=(p2*v2*T1)/(p1*v1)\n", + "print(\"so now final temperature of N2(T2)in K=\"),round(T2,2)\n", + "T2=1191.6;##T2 approx. equal to 1191.6 K\n", + "m=(p1*v1)/(R_N2*1000*T1)\n", + "print(\"mass of N2(m)in kg=\"),round(m,2)\n", + "m=2.8;##m approx equal to 2.8 kg\n", + "Cv_N2=Cp_N2-R_N2\n", + "print(\"specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2=\"),round(Cv_N2)\n", + "print(\"heat added to N2,(Q_N2)in KJ\")\n", + "Q_N2=((m*Cv_N2*1000*(T2-T1))+W_N2)/1000\n", + "print(\"Q_N2=\"),round(Q_N2,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.18;pg no:88" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.18, Page:88 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\n", + "let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\n", + "initial mass of air(m1)in kg\n", + "m1= 9.29\n", + "for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\n", + "T2=in K 237.64\n", + "final mass of air left in tank(m2)in kg\n", + "m2= 2.97\n", + "writing down energy equation for unsteady flow system\n", + "(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\n", + "or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\n", + "kinetic energy available for running turbine(W)in KJ\n", + "W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", + "W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", + "amount of work available=KJ 482.67\n" + ] + } + ], + "source": [ + "#cal of amount of work available\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.18, Page:88 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\")\n", + "p1=0.5*10**6;#initial pressure of air in pa\n", + "p2=1.013*10**5;#atmospheric pressure in pa\n", + "v1=2;#initial volume of air in m^3\n", + "v2=v1;#final volume of air in m^3\n", + "T1=375;#initial temperature of air in K\n", + "Cp_air=1.003;#specific heat at consatnt pressure in KJ/kg K\n", + "Cv_air=0.716;#specific heat at consatnt volume in KJ/kg K\n", + "R_air=0.287;#gas constant in KJ/kg K\n", + "y=1.4;#expansion constant for air\n", + "print(\"let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\")\n", + "print(\"initial mass of air(m1)in kg\")\n", + "m1=(p1*v1)/(R_air*1000*T1)\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"T2=in K\"),round(T2,2)\n", + "print(\"final mass of air left in tank(m2)in kg\")\n", + "m2=(p2*v2)/(R_air*1000*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"writing down energy equation for unsteady flow system\")\n", + "print(\"(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\")\n", + "print(\"or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\")\n", + "print(\"kinetic energy available for running turbine(W)in KJ\")\n", + "print(\"W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", + "print(\"W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", + "W=((m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2)/1000\n", + "print(\"amount of work available=KJ\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.19;pg no:89" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.19, Page:89 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\n", + "using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\n", + "n1= 0.1\n", + "now n2= 0.12\n", + "for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\n", + "deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\n", + "final temperature of gas(T3)in K\n", + "T3= 409.09\n", + "using perfect gas equation for final mixture,\n", + "final pressure of gas(p3)in Mpa\n", + "p3= 750000.0\n", + "so final pressure and temperature =0.75 Mpa and 409.11 K\n" + ] + } + ], + "source": [ + "#cal of final pressure and temperature\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.19, Page:89 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\")\n", + "p1=0.5*10**6;#initial pressure of air in pa\n", + "v1=0.5;#initial volume of air in m^3\n", + "T1=(27+273);#initial temperature of air in K\n", + "p2=1*10**6;#final pressure of air in pa\n", + "v2=0.5;#final volume of air in m^3\n", + "T2=500;#final temperature of air in K\n", + "R=8314;#gas constant in J/kg K\n", + "Cv=0.716;#specific heat at constant volume in KJ/kg K\n", + "print(\"using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\")\n", + "n1=(p1*v1)/(R*T1)\n", + "print(\"n1=\"),round(n1,2)\n", + "n2=(p2*v2)/(R*T2)\n", + "print(\"now n2=\"),round(n2,2)\n", + "print(\"for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\")\n", + "deltaU=0;#change in internal energy\n", + "print(\"deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\")\n", + "print(\"final temperature of gas(T3)in K\")\n", + "T3=(deltaU+Cv*(n1*T1+n2*T2))/(Cv*(n1+n2))\n", + "print(\"T3=\"),round(T3,2)\n", + "print(\"using perfect gas equation for final mixture,\")\n", + "print(\"final pressure of gas(p3)in Mpa\")\n", + "p3=((n1+n2)*R*T3)/(v1+v2)\n", + "print(\"p3=\"),round(p3,3)\n", + "print(\"so final pressure and temperature =0.75 Mpa and 409.11 K\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.20;pg no:90" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.20, Page:90 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\n", + "printlacement work,W=p*(v1-v2)in N.m -50675.0\n", + "so heat transfer(Q)in N.m\n", + "Q=-W 50675.0\n" + ] + } + ], + "source": [ + "#cal of heat transfer\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.20, Page:90 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\")\n", + "v1=0;#initial volume of air inside bottle in m^3\n", + "v2=0.5;#final volume of air inside bottle in m^3\n", + "p=1.0135*10**5;#atmospheric pressure in pa\n", + "W=p*(v1-v2)\n", + "print(\"printlacement work,W=p*(v1-v2)in N.m\"),round(W,2)\n", + "print(\"so heat transfer(Q)in N.m\")\n", + "Q=-W\n", + "print(\"Q=-W\"),round(Q,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.21;pg no:90" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.21, Page:90 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\n", + "here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\n", + "(p2/p1)^((y-1)/y)=(T2/T1)\n", + "final temperature of air(T2)in K\n", + "T2= 113.34\n", + "by perfect gas law,initial mass in bottle(m1)in kg\n", + "m1= 11.69\n", + "final mass in bottle(m2)in kg\n", + "m2= 0.92\n", + "energy available for running turbo generator or work(W)in KJ\n", + "W+(m1-m2)*h2=m1*u1-m2*u2\n", + "W= 1325.42\n", + "this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\n", + "turbogenerator actual output(P1)=5 KJ/s\n", + "input to turbogenerator(P2)in KJ/s\n", + "time duration for which turbogenerator can be run(deltat)in seconds\n", + "deltat= 159.05\n", + "duration=160 seconds approx.\n" + ] + } + ], + "source": [ + "#cal of time duration for which turbogenerator can be run\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.21, Page:90 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\")\n", + "p1=35.*10**5;#initial pressure of air in pa\n", + "v1=0.3;#initial volume of air in m^3\n", + "T1=(313.);#initial temperature of air in K\n", + "p2=1.*10**5;#final pressure of air in pa\n", + "v2=0.3;#final volume of air in m^3\n", + "y=1.4;#expansion constant\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\")\n", + "print(\"(p2/p1)^((y-1)/y)=(T2/T1)\")\n", + "print(\"final temperature of air(T2)in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"T2=\"),round(T2,2)\n", + "print(\"by perfect gas law,initial mass in bottle(m1)in kg\")\n", + "m1=(p1*v1)/(R*1000.*T1)\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"final mass in bottle(m2)in kg\")\n", + "m2=(p2*v2)/(R*1000.*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"energy available for running turbo generator or work(W)in KJ\")\n", + "print(\"W+(m1-m2)*h2=m1*u1-m2*u2\")\n", + "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", + "print(\"W=\"),round(W,2)\n", + "print(\"this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\")\n", + "print(\"turbogenerator actual output(P1)=5 KJ/s\")\n", + "P1=5;#turbogenerator actual output in KJ/s\n", + "print(\"input to turbogenerator(P2)in KJ/s\")\n", + "P2=P1/0.6\n", + "print(\"time duration for which turbogenerator can be run(deltat)in seconds\")\n", + "deltat=W/P2\n", + "print(\"deltat=\"),round(deltat,2)\n", + "print(\"duration=160 seconds approx.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.22;pg no:91" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.22, Page:91 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\n", + "different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\n", + "process 1-2 is polytropic process with index 1.2\n", + "(T2/T1)=(p2/p1)^((n-1)/n)\n", + "final temperature of air(T2)in K\n", + "T2= 457.68\n", + "at state 1,p1*v1=m*R*T1\n", + "initial volume of air(v1)in m^3\n", + "v1= 2.01\n", + "final volume of air(v2)in m^3\n", + "for process 1-2,v2= 0.53\n", + "for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\n", + "v3=v2*T3/T2 in m^3\n", + "here process 3-1 is isothermal process so T1=T3\n", + "during process 1-2 the compression work(W1_2)in KJ\n", + "W1_2=(m*R*(T2-T1)/(1-n))\n", + "work during process 2-3(W2_3)in KJ,\n", + "W2_3=p2*(v3-v2)/1000\n", + "work during process 3-1(W3_1)in KJ\n", + "W3_1= 485.0\n", + "net work done(W_net)in KJ\n", + "W_net=W1_2+W2_3+W3_1 -71.28\n", + "net work=-71.27 KJ\n", + "here -ve workshows work done upon the system.since it is cycle,so\n", + "W_net=Q_net\n", + "phi dW=phi dQ=-71.27 KJ\n", + "heat transferred from system=71.27 KJ\n" + ] + } + ], + "source": [ + "#cal of network,heat transferred from system\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.22, Page:91 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\")\n", + "p1=1.5*10**5;#initial pressure of air in pa\n", + "T1=(77+273);#initial temperature of air in K\n", + "p2=7.5*10**5;#final pressure of air in pa\n", + "n=1.2;#expansion constant for process 1-2\n", + "R=0.287;#gas constant in KJ/kg K\n", + "m=3.;#mass of air in kg\n", + "print(\"different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\")\n", + "print(\"process 1-2 is polytropic process with index 1.2\")\n", + "print(\"(T2/T1)=(p2/p1)^((n-1)/n)\")\n", + "print(\"final temperature of air(T2)in K\")\n", + "T2=T1*((p2/p1)**((n-1)/n))\n", + "print(\"T2=\"),round(T2,2)\n", + "print(\"at state 1,p1*v1=m*R*T1\")\n", + "print(\"initial volume of air(v1)in m^3\")\n", + "v1=(m*R*1000*T1)/p1\n", + "print(\"v1=\"),round(v1,2)\n", + "print(\"final volume of air(v2)in m^3\")\n", + "v2=((p1*v1**n)/p2)**(1/n)\n", + "print(\"for process 1-2,v2=\"),round(v2,2)\n", + "print(\"for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\")\n", + "print(\"v3=v2*T3/T2 in m^3\")\n", + "print(\"here process 3-1 is isothermal process so T1=T3\")\n", + "T3=T1;#process 3-1 is isothermal\n", + "v3=v2*T3/T2\n", + "print(\"during process 1-2 the compression work(W1_2)in KJ\")\n", + "print(\"W1_2=(m*R*(T2-T1)/(1-n))\")\n", + "W1_2=(m*R*(T2-T1)/(1-n))\n", + "print(\"work during process 2-3(W2_3)in KJ,\")\n", + "print(\"W2_3=p2*(v3-v2)/1000\")\n", + "W2_3=p2*(v3-v2)/1000\n", + "print(\"work during process 3-1(W3_1)in KJ\")\n", + "p3=p2;#pressure is constant for process 2-3\n", + "W3_1=p3*v3*math.log(v1/v3)/1000\n", + "print(\"W3_1=\"),round(W3_1,2)\n", + "print(\"net work done(W_net)in KJ\")\n", + "W_net=W1_2+W2_3+W3_1\n", + "print(\"W_net=W1_2+W2_3+W3_1\"),round(W_net,2)\n", + "print(\"net work=-71.27 KJ\")\n", + "print(\"here -ve workshows work done upon the system.since it is cycle,so\")\n", + "print(\"W_net=Q_net\")\n", + "print(\"phi dW=phi dQ=-71.27 KJ\")\n", + "print(\"heat transferred from system=71.27 KJ\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.23;pg no:93" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.23, Page:93 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\n", + "initial mass of air in bottle(m1)in kg \n", + "m1= 6.97\n", + "now final temperature(T2)in K\n", + "T2= 0.0\n", + "final mass of air in bottle(m2)in kg\n", + "m2= 0.82\n", + "energy available for running of turbine due to emptying of bottle(W)in KJ\n", + "W= 639.09\n", + "work available from turbine=639.27KJ\n" + ] + } + ], + "source": [ + "#cal of work available from turbine\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.23, Page:93 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\")\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "y=1.4;#expansion constant \n", + "p1=40*10**5;#initial temperature of air in pa\n", + "v1=0.15;#initial volume of air in m^3\n", + "T1=(27+273);#initial temperature of air in K\n", + "p2=2*10**5;#final temperature of air in pa\n", + "v2=0.15;#final volume of air in m^3\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"initial mass of air in bottle(m1)in kg \")\n", + "m1=(p1*v1)/(R*1000*T1)\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"now final temperature(T2)in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"T2=\"),round(T2,2)\n", + "T2=127.36;#take T2=127.36 approx.\n", + "print(\"final mass of air in bottle(m2)in kg\")\n", + "m2=(p2*v2)/(R*1000*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "m2=0.821;#take m2=0.821 approx.\n", + "print(\"energy available for running of turbine due to emptying of bottle(W)in KJ\")\n", + "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", + "print(\"W=\"),round(W,2)\n", + "print(\"work available from turbine=639.27KJ\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter3_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter3_2.ipynb new file mode 100755 index 00000000..22ed40c9 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter3_2.ipynb @@ -0,0 +1,1506 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3:First Law of Thermo Dynamics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.1;pg no:76" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.1, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\n", + "a> work done on piston(W_piston)in KJ can be obtained as\n", + "W_piston=pdv\n", + "b> paddle work done on the system(W_paddle)=-4.88 KJ\n", + "net work done of system(W_net)in KJ\n", + "W_net=W_piston+W_paddle\n", + "so work done on system(W_net)=1.435 KJ\n" + ] + } + ], + "source": [ + "#cal of work done on system\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.1, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\")\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "p=689.;#pressure of gas in cylinder in kpa\n", + "v1=0.04;#initial volume of fluid in m^3\n", + "v2=0.045;#final volume of fluid in m^3\n", + "W_paddle=-4.88;#paddle work done on the system in KJ\n", + "print(\"a> work done on piston(W_piston)in KJ can be obtained as\")\n", + "print(\"W_piston=pdv\")\n", + "#function y = f(v), y=p, endfunction\n", + "def fun1(x):\n", + "\ty=p\n", + "\treturn y\n", + "\n", + "W_piston=scipy.integrate.quad(fun1,v1,v2) \n", + "print(\"b> paddle work done on the system(W_paddle)=-4.88 KJ\")\n", + "print(\"net work done of system(W_net)in KJ\")\n", + "print(\"W_net=W_piston+W_paddle\")\n", + "print(\"so work done on system(W_net)=1.435 KJ\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.2;pg no:" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.2, Page:76 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\n", + "as the vessel is rigid therefore work done shall be zero\n", + "W=0\n", + "from first law of thermodynamics,heat required(Q)in KJ\n", + "Q=U2-U1+W=Q=m(u2-u1)+W\n", + "so heat required = 5.6\n" + ] + } + ], + "source": [ + "#cal of heat required\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.2, Page:76 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\")\n", + "m=0.5;#mass of gas in kg\n", + "u1=26.6;#internal energy of gas at 200 degree celcius\n", + "u2=37.8;#internal energy of gas at 400 degree celcius\n", + "W=0;#work done by vessel in KJ\n", + "print(\"as the vessel is rigid therefore work done shall be zero\")\n", + "print(\"W=0\")\n", + "print(\"from first law of thermodynamics,heat required(Q)in KJ\")\n", + "print(\"Q=U2-U1+W=Q=m(u2-u1)+W\")\n", + "Q=m*(u2-u1)+W\n", + "print(\"so heat required =\"),round(Q,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.3;pg no:77" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.3, Page:77 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\n", + "by steady flow energy equation\n", + "q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\n", + "let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\n", + "q=h2-h1\n", + "rate of heat removal(Q)in KJ/hr\n", + "Q=m(h2-h1)=m*Cp*(T2-T1)\n", + "heat should be removed at the rate=KJ/hr 40500.0\n" + ] + } + ], + "source": [ + "#cal of \"heat should be removed\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.3, Page:77 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\")\n", + "m=50;#rate at which carbon dioxide passing through heat exchanger in kg/hr\n", + "T2=800;#initial temperature of carbon dioxide in degree celcius\n", + "T1=50;#final temperature of carbon dioxide in degree celcius\n", + "Cp=1.08;#specific heat at constant pressure in KJ/kg K\n", + "print(\"by steady flow energy equation\")\n", + "print(\"q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\")\n", + "print(\"let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\")\n", + "print(\"q=h2-h1\")\n", + "print(\"rate of heat removal(Q)in KJ/hr\")\n", + "print(\"Q=m(h2-h1)=m*Cp*(T2-T1)\")\n", + "Q=m*Cp*(T2-T1)\n", + "print(\"heat should be removed at the rate=KJ/hr\"),round(Q)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.4;pg no:77" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "#cal of work done by surrounding on system\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.4, Page:77 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 4\")\n", + "v=0.78;#volume of cylinder in m^3\n", + "p=101.325;#atmospheric pressure in kPa\n", + "print(\"total work done by the air at atmospheric pressure of 101.325 kPa\")\n", + "print(\"W=(pdv)cylinder+(pdv)air\")\n", + "print(\"0+p*(delta v)\")\n", + "print(\"work done by air(W)=-p*v in KJ\")\n", + "W=-p*v\n", + "print(\"so work done by surrounding on system=KJ\"),round(-W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.5:pg no:77" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.5, Page:77 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\n", + "given p*v^1.3=constant\n", + "assuming expansion to be quasi-static,the work may be given as\n", + "W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\n", + "from internal energy relation,change in specific internal energy\n", + "deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\n", + "total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\n", + "using p1*V1^1.3=p2*V2^1.3\n", + "V2=in m^3 0.85\n", + "take V2=.852 m^3\n", + "so deltaU in KJ\n", + "and W in KJ 246.67\n", + "from first law\n", + "deltaQ=KJ 113.47\n", + "heat interaction=113.5 KJ\n", + "work interaction=246.7 KJ\n", + "change in internal energy=-113.2 KJ\n" + ] + } + ], + "source": [ + "#cal of heat,work interaction and change in internal energy\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.5, Page:77 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\")\n", + "m=5;#mass of gas in kg\n", + "p1=1*10**3;#initial pressure of gas in KPa\n", + "V1=0.5;#initial volume of gas in m^3\n", + "p2=0.5*10**3;#final pressure of gas in KPa\n", + "n=1.3;#expansion constant\n", + "print(\"given p*v^1.3=constant\")\n", + "print(\"assuming expansion to be quasi-static,the work may be given as\")\n", + "print(\"W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\")\n", + "print(\"from internal energy relation,change in specific internal energy\")\n", + "print(\"deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\")\n", + "print(\"total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\")\n", + "print(\"using p1*V1^1.3=p2*V2^1.3\")\n", + "V2=V1*(p1/p2)**(1/1.3)\n", + "print(\"V2=in m^3\"),round(V2,2)\n", + "print(\"take V2=.852 m^3\")\n", + "V2=0.852;#final volume of gas in m^3\n", + "print(\"so deltaU in KJ\")\n", + "deltaU=1.8*(p2*V2-p1*V1)\n", + "W=(p2*V2-p1*V1)/(1-n)\n", + "print(\"and W in KJ\"),round(W,2)\n", + "print(\"from first law\")\n", + "deltaQ=deltaU+W\n", + "print(\"deltaQ=KJ\"),round(deltaQ,2)\n", + "print(\"heat interaction=113.5 KJ\")\n", + "print(\"work interaction=246.7 KJ\")\n", + "print(\"change in internal energy=-113.2 KJ\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.6;pg no:78" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.6, Page:78 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\n", + "final state volume(v2)in m^3\n", + "v2= 0.0\n", + "take v2=0.03 m^3\n", + "now internal energy of gas is given by U=7.5*p*v-425\n", + "change in internal energy(deltaU)in KJ\n", + "deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\n", + "deltaU=7.5*10^3*(p2*v2-p1*v1) 75.0\n", + "for quasi-static process\n", + "work(W) in KJ,W=p*dv\n", + "W=(p2*v2-p1*v1)/(1-n)\n", + "from first law of thermodynamics,\n", + "heat interaction(deltaQ)=deltaU+W\n", + "heat=50 KJ\n", + "work=25 KJ(-ve)\n", + "internal energy change=75 KJ\n", + "if 180 KJ heat transfer takes place,then from 1st law,\n", + "deltaQ= 50.0\n", + "since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\n", + "W=KJ 105.0\n" + ] + } + ], + "source": [ + "#cal of heat,workinternal energy change\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.6, Page:78 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\")\n", + "p1=1;#initial pressure of gas in MPa\n", + "v1=0.05;#initial volume of gas in m^3\n", + "p2=2;#final pressure of gas in MPa\n", + "n=1.4;#expansion constant\n", + "print(\"final state volume(v2)in m^3\")\n", + "v2=((p1/p2)**(1/1.4))*v1\n", + "print(\"v2=\"),round(v2,2)\n", + "print(\"take v2=0.03 m^3\")\n", + "v2=0.03;#final volume of gas in m^3\n", + "print(\"now internal energy of gas is given by U=7.5*p*v-425\")\n", + "print(\"change in internal energy(deltaU)in KJ\")\n", + "print(\"deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\")\n", + "deltaU=7.5*10**3*(p2*v2-p1*v1)\n", + "print(\"deltaU=7.5*10^3*(p2*v2-p1*v1)\"),round(deltaU,2)\n", + "print(\"for quasi-static process\")\n", + "print(\"work(W) in KJ,W=p*dv\")\n", + "W=((p2*v2-p1*v1)/(1-n))*10**3\n", + "print(\"W=(p2*v2-p1*v1)/(1-n)\")\n", + "print(\"from first law of thermodynamics,\")\n", + "print(\"heat interaction(deltaQ)=deltaU+W\")\n", + "deltaQ=deltaU+W\n", + "print(\"heat=50 KJ\")\n", + "print(\"work=25 KJ(-ve)\")\n", + "print(\"internal energy change=75 KJ\")\n", + "print(\"if 180 KJ heat transfer takes place,then from 1st law,\")\n", + "print(\"deltaQ=\"),round(deltaQ,2)\n", + "print(\"since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\")\n", + "W=180-75\n", + "print(\"W=KJ\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.7;pg no:79" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.7, Page:79 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\n", + "characteristics gas constant(R)in J/kg K\n", + "R= 519.64\n", + "take R=0.520,KJ/kg K\n", + "Cv=inKJ/kg K 1.18\n", + "y= 1.44\n", + "for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\n", + "now,T2=in K\n", + "work(W)in KJ/kg\n", + "W= -257.78\n", + "for polytropic process,heat(Q)in KJ/K\n", + "Q= 82.02\n" + ] + } + ], + "source": [ + "#cal of work and heat\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.7, Page:79 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\")\n", + "M=16;#molecular weight of gas\n", + "p1=101.3;#initial pressure of gas in KPa\n", + "p2=600;#final pressure of gas in KPa\n", + "T1=(273+20);#initial temperature of gas in K\n", + "R1=8.3143*10**3;#universal gas constant in J/kg K\n", + "Cp=1.7;#specific heat at constant pressure in KJ/kg K\n", + "n=1.3;#expansion constant\n", + "T2=((p2/p1)**(n-1/n))\n", + "print(\"characteristics gas constant(R)in J/kg K\")\n", + "R=R1/M\n", + "print(\"R=\"),round(R,2)\n", + "print(\"take R=0.520,KJ/kg K\")\n", + "R=0.520;#characteristics gas constant in KJ/kg K\n", + "Cv=Cp-R\n", + "print(\"Cv=inKJ/kg K\"),round(Cv,2)\n", + "y=Cp/Cv\n", + "print(\"y=\"),round(y,2)\n", + "y=1.44;#ratio of specific heat at constant pressure to constant volume\n", + "print(\"for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\")\n", + "T2=T1*((p2/p1)**((n-1)/n))\n", + "print(\"now,T2=in K\")\n", + "print(\"work(W)in KJ/kg\")\n", + "W=R*((T1-T2)/(n-1))\n", + "print(\"W=\"),round(W,2)\n", + "W=257.78034;#work done in KJ/kg\n", + "print(\"for polytropic process,heat(Q)in KJ/K\")\n", + "Q=((y-n)/(y-1))*W\n", + "print(\"Q=\"),round(Q,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.8;pg no:80" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.8, Page:80 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\n", + "applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\n", + "h1+C1^2/2=h2+C2^2/2\n", + "given that C1=0,negligible inlet velocity\n", + "so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\n", + "exit velocity(C2)in m/s 1098.2\n" + ] + } + ], + "source": [ + "#cal of exit velocity\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.8, Page:80 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\")\n", + "T1=(627+273);#initial temperature of air in nozzle in K\n", + "T2=(27+273);#temperature at which air leaves nozzle in K\n", + "Cp=1.005*10**3;#specific heat at constant pressure in J/kg K\n", + "C2=math.sqrt(2*Cp*(T1-T2))\n", + "print(\"applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\")\n", + "print(\"h1+C1^2/2=h2+C2^2/2\")\n", + "print(\"given that C1=0,negligible inlet velocity\")\n", + "print(\"so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\")\n", + "print(\"exit velocity(C2)in m/s\"),round(C2,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.9;pg no:80" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.9, Page:80 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\n", + "work interaction,W=-200 KJ/kg of air\n", + "increase in enthalpy of air=100 KJ/kg of air\n", + "total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\n", + "writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\n", + "h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\n", + "assuming no change in potential energy and kinetic energy\n", + "deltaK.E=deltaP.=0\n", + "total heat interaction(Q)in KJ/kg of air\n", + "Q= -100.0\n", + "Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\n", + "so heat transferred to atmosphere(Q2)in KJ/kg of air -10.0\n" + ] + } + ], + "source": [ + "#cal of heat transferred to atmosphere\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.9, Page:80 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\")\n", + "W=-200;#shaft work in KJ/kg of air\n", + "deltah=100;#increase in enthalpy in KJ/kg of air\n", + "Q1=-90;#heat transferred to water in KJ/kg of air\n", + "print(\"work interaction,W=-200 KJ/kg of air\")\n", + "print(\"increase in enthalpy of air=100 KJ/kg of air\")\n", + "print(\"total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\")\n", + "print(\"writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\")\n", + "print(\"h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\")\n", + "print(\"assuming no change in potential energy and kinetic energy\")\n", + "print(\"deltaK.E=deltaP.=0\")\n", + "print(\"total heat interaction(Q)in KJ/kg of air\")\n", + "Q=deltah+W\n", + "print(\"Q=\"),round(Q,2)\n", + "Q2=Q-Q1\n", + "print(\"Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\")\n", + "print(\"so heat transferred to atmosphere(Q2)in KJ/kg of air\"),round(Q2,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.10;pg no:81" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.10, Page:81 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\n", + "above problem can be solved using steady flow energy equations upon hot water flow\n", + "Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\n", + "here total heat to be supplied(Q)in kcal/hr\n", + "so heat lost by water(-ve),Q=-25000 kcal/hr\n", + "there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\n", + "Q+m*(h1+g*z1)=m*(h2+g*z2)\n", + "so water circulation rate(m)in kg/hr\n", + "so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\n", + "water circulation rate=(m)in kg/min 11.91\n" + ] + } + ], + "source": [ + "#cal of water circulation rate\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.10, Page:81 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\")\n", + "n=500;#total number of persons\n", + "q=50;#heat requirement per person in kcal/hr\n", + "h1=80;#enthalpy of hot water enter in pipe in kcal/kg\n", + "h2=45;#enthalpy of hot water leaves the pipe in kcal/kg\n", + "g=9.81;#acceleartion due to gravity in m/s^2\n", + "deltaz=10;#difference in elevation of inlet and exit pipe in m\n", + "print(\"above problem can be solved using steady flow energy equations upon hot water flow\")\n", + "print(\"Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\")\n", + "print(\"here total heat to be supplied(Q)in kcal/hr\")\n", + "Q=n*q\n", + "print(\"so heat lost by water(-ve),Q=-25000 kcal/hr\")\n", + "Q=-25000#heat loss by water in kcal/hr\n", + "print(\"there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\")\n", + "print(\"Q+m*(h1+g*z1)=m*(h2+g*z2)\")\n", + "print(\"so water circulation rate(m)in kg/hr\")\n", + "print(\"so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\")\n", + "m=Q*10**3*4.18/(g*deltaz-(h1-h2)*10**3*4.18)\n", + "m=m/60\n", + "print(\"water circulation rate=(m)in kg/min\"),round(m,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.11;pg no:81" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.11, Page:81 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\n", + "let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\n", + "energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\n", + "m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\n", + "so steam suppling rate(m)in kg/s per kg of water\n", + "m= 0.124\n", + "NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\n" + ] + } + ], + "source": [ + "#cal of steam suppling rate\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.11, Page:81 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\")\n", + "v1=50;#velocity of steam entering injector in m/s\n", + "v2=25;#velocity of mixture leave injector in m/s\n", + "h1=720;#enthalpy of steam entering injector in kcal/kg\n", + "h2=24.6;#enthalpy of water entering injector in kcal/kg\n", + "h3=100;#enthalpy of steam leaving injector in kcal/kg\n", + "h4=100;#enthalpy of water leaving injector in kcal/kg\n", + "deltaz=2;#depth from axis of injector in m\n", + "q=12;#heat loss from injector to surrounding through injector\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\")\n", + "print(\"energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\")\n", + "print(\"m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\")\n", + "print(\"so steam suppling rate(m)in kg/s per kg of water\")\n", + "m=((h3*10**3*4.18+v2**2/2)-(h2*10**3*4.18+g*deltaz))/((v1**2/2+h1*10**3*4.18)-(h3*10**3*4.18+v2**2/2)-(q*10**3*4.18))\n", + "print(\"m=\"),round(m,3)\n", + "print(\"NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.12;pg no:82" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.12, Page:82 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\n", + "here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\n", + "displacement work, W=(p.dv)cylinder+(p.dv)ballon\n", + "(p.dv)cylinder=0,as cylinder is rigid\n", + "so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\n", + "and work done by atmosphere=KJ 40.52\n" + ] + } + ], + "source": [ + "#cal of work done by atmosphere\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.12, Page:82 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\")\n", + "p=1.013*10**5;#atmospheric pressure in pa\n", + "deltav=0.4;#change in volume in m^3\n", + "print(\"here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\")\n", + "print(\"displacement work, W=(p.dv)cylinder+(p.dv)ballon\")\n", + "print(\"(p.dv)cylinder=0,as cylinder is rigid\")\n", + "print(\"so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\")\n", + "W=(p*deltav)/1000\n", + "print(\"and work done by atmosphere=KJ\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.13;pg no:82" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.13, Page:82 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\n", + "work done by turbine(Wt)in J#s is 25% of heat added i.e Wt= 1250.0\n", + "heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\n", + "Qrejected= 3750.0\n", + "and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\n", + "Wp=(-) 10.0\n", + "capacity of generator(W)=in Kw 1.24\n" + ] + } + ], + "source": [ + "#cal of capacity of generator\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.13, Page:82 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\")\n", + "Qadd=5000;#heat supplied in boiler in J#s\n", + "Wt=.25*Qadd\n", + "print(\"work done by turbine(Wt)in J#s is 25% of heat added i.e\"),\n", + "print(\"Wt=\"),round(Wt,2)\n", + "print(\"heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\")\n", + "Qrejected=.75*Qadd\n", + "print(\"Qrejected=\"),round(Qrejected,2)\n", + "print(\"and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\")\n", + "Wp=0.002*Qadd\n", + "print(\"Wp=(-)\"),round(Wp,2)\n", + "W=(Wt-Wp)/1000\n", + "print(\"capacity of generator(W)=in Kw\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.14;pg no:83" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.14, Page:83 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\n", + "in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\n", + "h1+Q1_2=h2\n", + "Q1_2=h2-h1\n", + "so heat transfer to air in heat exchanger(Q1_2)in KJ\n", + "Q1_2= 726.61\n", + "in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\n", + "h2+C2^2#2=h3+C3^2/2+Wt\n", + "Wt=(h2-h3)+(C2^2-C3^2)/2\n", + "so power output from turbine(Wt)in KJ#s\n", + "Wt= 1.0\n", + "applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\n", + "h3+C=h4+C4^2/2\n", + "C4^2#2=(h3-h4)+C3^2/2\n", + "velocity at exit of nozzle(C4)in m#s\n", + "C4= 14.3\n" + ] + } + ], + "source": [ + "#cal of velocity at exit of nozzle\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.14, Page:83 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\")\n", + "T1=(27+273);##ambient temperature in K\n", + "T2=(750+273);##temperature of heated air inside heat exchanger in K\n", + "T3=(600+273);##temperature of hot air leaves turbine in K\n", + "T4=(500+273);##temperature at which air leaves nozzle in K\n", + "Cp=1.005;##specific heat at constant pressure in KJ#kg K\n", + "C2=50;##velocity of hot air enter into gas turbine in m#s\n", + "C3=60;##velocity of air leaving turbine enters a nozzle in m#s\n", + "print(\"in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\")\n", + "print(\"h1+Q1_2=h2\")\n", + "print(\"Q1_2=h2-h1\")\n", + "print(\"so heat transfer to air in heat exchanger(Q1_2)in KJ\")\n", + "Q1_2=Cp*(T2-T1)\n", + "print(\"Q1_2=\"),round(Q1_2,2)\n", + "print(\"in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\")\n", + "print(\"h2+C2^2#2=h3+C3^2/2+Wt\")\n", + "print(\"Wt=(h2-h3)+(C2^2-C3^2)/2\")\n", + "print(\"so power output from turbine(Wt)in KJ#s\")\n", + "Wt=Cp*(T2-T3)+(C2**2-C3**2)*10**-3/2\n", + "print(\"Wt=\"),round(Cp,2)\n", + "print(\"applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\")\n", + "print(\"h3+C=h4+C4^2/2\")\n", + "print(\"C4^2#2=(h3-h4)+C3^2/2\")\n", + "print(\"velocity at exit of nozzle(C4)in m#s\")\n", + "C4=math.sqrt(2*(Cp*(T3-T4)+C3**2*10**-3/2))\n", + "print(\"C4=\"),round(C4,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.15;pg no:85" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.15, Page:85 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\n", + "for constant pressure heating,say state changes from 1 to 2\n", + "Wa=p1*dv\n", + "Wa=p1*(v2-v1)\n", + "it is given that v2=2v1\n", + "so Wa=p1*v1=R*T1\n", + "for subsequent expansion at constant temperature say state from 2 to 3\n", + "also given that v3/v1=6,v3/v2=3\n", + "so work=Wb=p*dv\n", + "on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\n", + "temperature at 2 can be given by perfect gas consideration as,\n", + "T2/T1=v2/v1\n", + "or T2=2*T1\n", + "now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\n", + "so W in KJ= 10632.69\n" + ] + } + ], + "source": [ + "#cal of total work done by ai\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.15, Page:85 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\")\n", + "T1=400;##initial temperature of gas in K\n", + "R=8.314;##gas constant in \n", + "print(\"for constant pressure heating,say state changes from 1 to 2\")\n", + "print(\"Wa=p1*dv\")\n", + "print(\"Wa=p1*(v2-v1)\")\n", + "print(\"it is given that v2=2v1\")\n", + "print(\"so Wa=p1*v1=R*T1\")\n", + "print(\"for subsequent expansion at constant temperature say state from 2 to 3\")\n", + "print(\"also given that v3/v1=6,v3/v2=3\")\n", + "print(\"so work=Wb=p*dv\")\n", + "print(\"on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\")\n", + "print(\"temperature at 2 can be given by perfect gas consideration as,\")\n", + "print(\"T2/T1=v2/v1\")\n", + "print(\"or T2=2*T1\")\n", + "print(\"now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\")\n", + "W=R*T1+2*R*T1*math.log(3)\n", + "print(\"so W in KJ=\"),round(W,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.16;pg no:85" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.16, Page:85 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\n", + "NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \n", + "we get W=(Vf-Vi)*((Pi+Pf)/2)\n", + "also final volume of gas in m^3 is Vf=3*Vi\n", + "now work done by gas(W)in J 750000.0\n" + ] + } + ], + "source": [ + "#cal of work done by gas\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.16, Page:85 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\")\n", + "Pi=0.5*10**6;##initial pressure of gas in pa\n", + "Vi=0.5;##initial volume of gas in m^3\n", + "Pf=1*10**6;##final pressure of gas in pa\n", + "print(\"NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \")\n", + "print(\"we get W=(Vf-Vi)*((Pi+Pf)/2)\")\n", + "print(\"also final volume of gas in m^3 is Vf=3*Vi\") \n", + "Vf=3*Vi\n", + "W=(Vf-Vi)*((Pi+Pf)/2)\n", + "print(\"now work done by gas(W)in J\"),round(W,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.17;pg no:87" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.17, Page:87 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\n", + "with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\n", + "adiabatic index of compression of H2 can be obtained as,\n", + "Cp_H2=\n", + "y_H2=Cp_H2/(Cp_H2-R_H2) 1.4\n", + "adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\n", + "y_N2= 1.4\n", + "i>for hydrogen,p1*v1^y=p2*v2^y\n", + "so final pressure of H2(p2)in pa\n", + "p2= 1324078.55\n", + "ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \n", + "partition work=0\n", + "iii>work done upon H2(W_H2)in J,\n", + "W_H2= -200054.06\n", + "work done upon H2(W_H2)=-2*10^5 J\n", + "so work done by N2(W_N2)=2*10^5 J \n", + "iv>heat added to N2 can be obtained using first law of thermodynamics as\n", + "Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\n", + "final temperature of N2 can be obtained considering it as perfect gas\n", + "therefore, T2=(p2*v2*T1)#(p1*v1)\n", + "here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\n", + "p2=1.324*10^6 pa,v2=0.75 m^3\n", + "so now final temperature of N2(T2)in K= 1191.67\n", + "mass of N2(m)in kg= 2.81\n", + "specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2= 1.0\n", + "heat added to N2,(Q_N2)in KJ\n", + "Q_N2= 2052.89\n" + ] + } + ], + "source": [ + "#cal of \n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.17, Page:87 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\")\n", + "Cp_H2=14.307;##specific heat of H2 at constant pressure in KJ#kg K\n", + "R_H2=4.1240;##gas constant for H2 in KJ#kg K\n", + "Cp_N2=1.039;##specific heat of N2 at constant pressure in KJ#kg K\n", + "R_N2=0.2968;##gas constant for N2 in KJ#kg K\n", + "T1=(27+273);##ambient temperature in K\n", + "v1=0.5;##initial volume of H2 in m^3\n", + "p1=0.5*10**6;##initial pressure of H2 in pa \n", + "v2=0.25;##final volume of H2 in m^3 \n", + "p2=1.324*10**6;##final pressure of H2 in pa\n", + "print(\"with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\")\n", + "print(\"adiabatic index of compression of H2 can be obtained as,\")\n", + "print(\"Cp_H2=\")\n", + "y_H2=Cp_H2/(Cp_H2-R_H2)\n", + "print(\"y_H2=Cp_H2/(Cp_H2-R_H2)\"),round(y_H2,2)\n", + "print(\"adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\")\n", + "y_N2=Cp_N2/(Cp_N2-R_N2)\n", + "print(\"y_N2=\"),round(y_N2,2)\n", + "print(\"i>for hydrogen,p1*v1^y=p2*v2^y\")\n", + "print(\"so final pressure of H2(p2)in pa\")\n", + "p2=p1*(v1/v2)**y_H2\n", + "print(\"p2=\"),round(p2,2)\n", + "print(\"ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \")\n", + "print(\"partition work=0\")\n", + "print(\"iii>work done upon H2(W_H2)in J,\")\n", + "W_H2=(p1*v1-p2*v2)/(y_H2-1)\n", + "print(\"W_H2=\"),round(W_H2,2)\n", + "print(\"work done upon H2(W_H2)=-2*10^5 J\")\n", + "W_N2=2*10**5;##work done by N2 in J\n", + "print(\"so work done by N2(W_N2)=2*10^5 J \")\n", + "print(\"iv>heat added to N2 can be obtained using first law of thermodynamics as\")\n", + "print(\"Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\")\n", + "print(\"final temperature of N2 can be obtained considering it as perfect gas\")\n", + "print(\"therefore, T2=(p2*v2*T1)#(p1*v1)\")\n", + "print(\"here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\")\n", + "print(\"p2=1.324*10^6 pa,v2=0.75 m^3\")\n", + "v2=0.75;##final volume of N2 in m^3\n", + "T2=(p2*v2*T1)/(p1*v1)\n", + "print(\"so now final temperature of N2(T2)in K=\"),round(T2,2)\n", + "T2=1191.6;##T2 approx. equal to 1191.6 K\n", + "m=(p1*v1)/(R_N2*1000*T1)\n", + "print(\"mass of N2(m)in kg=\"),round(m,2)\n", + "m=2.8;##m approx equal to 2.8 kg\n", + "Cv_N2=Cp_N2-R_N2\n", + "print(\"specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2=\"),round(Cv_N2)\n", + "print(\"heat added to N2,(Q_N2)in KJ\")\n", + "Q_N2=((m*Cv_N2*1000*(T2-T1))+W_N2)/1000\n", + "print(\"Q_N2=\"),round(Q_N2,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.18;pg no:88" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.18, Page:88 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\n", + "let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\n", + "initial mass of air(m1)in kg\n", + "m1= 9.29\n", + "for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\n", + "T2=in K 237.64\n", + "final mass of air left in tank(m2)in kg\n", + "m2= 2.97\n", + "writing down energy equation for unsteady flow system\n", + "(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\n", + "or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\n", + "kinetic energy available for running turbine(W)in KJ\n", + "W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", + "W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", + "amount of work available=KJ 482.67\n" + ] + } + ], + "source": [ + "#cal of amount of work available\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.18, Page:88 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\")\n", + "p1=0.5*10**6;#initial pressure of air in pa\n", + "p2=1.013*10**5;#atmospheric pressure in pa\n", + "v1=2;#initial volume of air in m^3\n", + "v2=v1;#final volume of air in m^3\n", + "T1=375;#initial temperature of air in K\n", + "Cp_air=1.003;#specific heat at consatnt pressure in KJ/kg K\n", + "Cv_air=0.716;#specific heat at consatnt volume in KJ/kg K\n", + "R_air=0.287;#gas constant in KJ/kg K\n", + "y=1.4;#expansion constant for air\n", + "print(\"let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\")\n", + "print(\"initial mass of air(m1)in kg\")\n", + "m1=(p1*v1)/(R_air*1000*T1)\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"T2=in K\"),round(T2,2)\n", + "print(\"final mass of air left in tank(m2)in kg\")\n", + "m2=(p2*v2)/(R_air*1000*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"writing down energy equation for unsteady flow system\")\n", + "print(\"(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\")\n", + "print(\"or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\")\n", + "print(\"kinetic energy available for running turbine(W)in KJ\")\n", + "print(\"W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", + "print(\"W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", + "W=((m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2)/1000\n", + "print(\"amount of work available=KJ\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.19;pg no:89" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.19, Page:89 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\n", + "using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\n", + "n1= 0.1\n", + "now n2= 0.12\n", + "for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\n", + "deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\n", + "final temperature of gas(T3)in K\n", + "T3= 409.09\n", + "using perfect gas equation for final mixture,\n", + "final pressure of gas(p3)in Mpa\n", + "p3= 750000.0\n", + "so final pressure and temperature =0.75 Mpa and 409.11 K\n" + ] + } + ], + "source": [ + "#cal of final pressure and temperature\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.19, Page:89 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\")\n", + "p1=0.5*10**6;#initial pressure of air in pa\n", + "v1=0.5;#initial volume of air in m^3\n", + "T1=(27+273);#initial temperature of air in K\n", + "p2=1*10**6;#final pressure of air in pa\n", + "v2=0.5;#final volume of air in m^3\n", + "T2=500;#final temperature of air in K\n", + "R=8314;#gas constant in J/kg K\n", + "Cv=0.716;#specific heat at constant volume in KJ/kg K\n", + "print(\"using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\")\n", + "n1=(p1*v1)/(R*T1)\n", + "print(\"n1=\"),round(n1,2)\n", + "n2=(p2*v2)/(R*T2)\n", + "print(\"now n2=\"),round(n2,2)\n", + "print(\"for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\")\n", + "deltaU=0;#change in internal energy\n", + "print(\"deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\")\n", + "print(\"final temperature of gas(T3)in K\")\n", + "T3=(deltaU+Cv*(n1*T1+n2*T2))/(Cv*(n1+n2))\n", + "print(\"T3=\"),round(T3,2)\n", + "print(\"using perfect gas equation for final mixture,\")\n", + "print(\"final pressure of gas(p3)in Mpa\")\n", + "p3=((n1+n2)*R*T3)/(v1+v2)\n", + "print(\"p3=\"),round(p3,3)\n", + "print(\"so final pressure and temperature =0.75 Mpa and 409.11 K\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.20;pg no:90" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.20, Page:90 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\n", + "printlacement work,W=p*(v1-v2)in N.m -50675.0\n", + "so heat transfer(Q)in N.m\n", + "Q=-W 50675.0\n" + ] + } + ], + "source": [ + "#cal of heat transfer\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.20, Page:90 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\")\n", + "v1=0;#initial volume of air inside bottle in m^3\n", + "v2=0.5;#final volume of air inside bottle in m^3\n", + "p=1.0135*10**5;#atmospheric pressure in pa\n", + "W=p*(v1-v2)\n", + "print(\"printlacement work,W=p*(v1-v2)in N.m\"),round(W,2)\n", + "print(\"so heat transfer(Q)in N.m\")\n", + "Q=-W\n", + "print(\"Q=-W\"),round(Q,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.21;pg no:90" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.21, Page:90 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\n", + "here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\n", + "(p2/p1)^((y-1)/y)=(T2/T1)\n", + "final temperature of air(T2)in K\n", + "T2= 113.34\n", + "by perfect gas law,initial mass in bottle(m1)in kg\n", + "m1= 11.69\n", + "final mass in bottle(m2)in kg\n", + "m2= 0.92\n", + "energy available for running turbo generator or work(W)in KJ\n", + "W+(m1-m2)*h2=m1*u1-m2*u2\n", + "W= 1325.42\n", + "this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\n", + "turbogenerator actual output(P1)=5 KJ/s\n", + "input to turbogenerator(P2)in KJ/s\n", + "time duration for which turbogenerator can be run(deltat)in seconds\n", + "deltat= 159.05\n", + "duration=160 seconds approx.\n" + ] + } + ], + "source": [ + "#cal of time duration for which turbogenerator can be run\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.21, Page:90 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\")\n", + "p1=35.*10**5;#initial pressure of air in pa\n", + "v1=0.3;#initial volume of air in m^3\n", + "T1=(313.);#initial temperature of air in K\n", + "p2=1.*10**5;#final pressure of air in pa\n", + "v2=0.3;#final volume of air in m^3\n", + "y=1.4;#expansion constant\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\")\n", + "print(\"(p2/p1)^((y-1)/y)=(T2/T1)\")\n", + "print(\"final temperature of air(T2)in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"T2=\"),round(T2,2)\n", + "print(\"by perfect gas law,initial mass in bottle(m1)in kg\")\n", + "m1=(p1*v1)/(R*1000.*T1)\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"final mass in bottle(m2)in kg\")\n", + "m2=(p2*v2)/(R*1000.*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"energy available for running turbo generator or work(W)in KJ\")\n", + "print(\"W+(m1-m2)*h2=m1*u1-m2*u2\")\n", + "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", + "print(\"W=\"),round(W,2)\n", + "print(\"this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\")\n", + "print(\"turbogenerator actual output(P1)=5 KJ/s\")\n", + "P1=5;#turbogenerator actual output in KJ/s\n", + "print(\"input to turbogenerator(P2)in KJ/s\")\n", + "P2=P1/0.6\n", + "print(\"time duration for which turbogenerator can be run(deltat)in seconds\")\n", + "deltat=W/P2\n", + "print(\"deltat=\"),round(deltat,2)\n", + "print(\"duration=160 seconds approx.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.22;pg no:91" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.22, Page:91 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\n", + "different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\n", + "process 1-2 is polytropic process with index 1.2\n", + "(T2/T1)=(p2/p1)^((n-1)/n)\n", + "final temperature of air(T2)in K\n", + "T2= 457.68\n", + "at state 1,p1*v1=m*R*T1\n", + "initial volume of air(v1)in m^3\n", + "v1= 2.01\n", + "final volume of air(v2)in m^3\n", + "for process 1-2,v2= 0.53\n", + "for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\n", + "v3=v2*T3/T2 in m^3\n", + "here process 3-1 is isothermal process so T1=T3\n", + "during process 1-2 the compression work(W1_2)in KJ\n", + "W1_2=(m*R*(T2-T1)/(1-n))\n", + "work during process 2-3(W2_3)in KJ,\n", + "W2_3=p2*(v3-v2)/1000\n", + "work during process 3-1(W3_1)in KJ\n", + "W3_1= 485.0\n", + "net work done(W_net)in KJ\n", + "W_net=W1_2+W2_3+W3_1 -71.28\n", + "net work=-71.27 KJ\n", + "here -ve workshows work done upon the system.since it is cycle,so\n", + "W_net=Q_net\n", + "phi dW=phi dQ=-71.27 KJ\n", + "heat transferred from system=71.27 KJ\n" + ] + } + ], + "source": [ + "#cal of network,heat transferred from system\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.22, Page:91 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\")\n", + "p1=1.5*10**5;#initial pressure of air in pa\n", + "T1=(77+273);#initial temperature of air in K\n", + "p2=7.5*10**5;#final pressure of air in pa\n", + "n=1.2;#expansion constant for process 1-2\n", + "R=0.287;#gas constant in KJ/kg K\n", + "m=3.;#mass of air in kg\n", + "print(\"different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\")\n", + "print(\"process 1-2 is polytropic process with index 1.2\")\n", + "print(\"(T2/T1)=(p2/p1)^((n-1)/n)\")\n", + "print(\"final temperature of air(T2)in K\")\n", + "T2=T1*((p2/p1)**((n-1)/n))\n", + "print(\"T2=\"),round(T2,2)\n", + "print(\"at state 1,p1*v1=m*R*T1\")\n", + "print(\"initial volume of air(v1)in m^3\")\n", + "v1=(m*R*1000*T1)/p1\n", + "print(\"v1=\"),round(v1,2)\n", + "print(\"final volume of air(v2)in m^3\")\n", + "v2=((p1*v1**n)/p2)**(1/n)\n", + "print(\"for process 1-2,v2=\"),round(v2,2)\n", + "print(\"for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\")\n", + "print(\"v3=v2*T3/T2 in m^3\")\n", + "print(\"here process 3-1 is isothermal process so T1=T3\")\n", + "T3=T1;#process 3-1 is isothermal\n", + "v3=v2*T3/T2\n", + "print(\"during process 1-2 the compression work(W1_2)in KJ\")\n", + "print(\"W1_2=(m*R*(T2-T1)/(1-n))\")\n", + "W1_2=(m*R*(T2-T1)/(1-n))\n", + "print(\"work during process 2-3(W2_3)in KJ,\")\n", + "print(\"W2_3=p2*(v3-v2)/1000\")\n", + "W2_3=p2*(v3-v2)/1000\n", + "print(\"work during process 3-1(W3_1)in KJ\")\n", + "p3=p2;#pressure is constant for process 2-3\n", + "W3_1=p3*v3*math.log(v1/v3)/1000\n", + "print(\"W3_1=\"),round(W3_1,2)\n", + "print(\"net work done(W_net)in KJ\")\n", + "W_net=W1_2+W2_3+W3_1\n", + "print(\"W_net=W1_2+W2_3+W3_1\"),round(W_net,2)\n", + "print(\"net work=-71.27 KJ\")\n", + "print(\"here -ve workshows work done upon the system.since it is cycle,so\")\n", + "print(\"W_net=Q_net\")\n", + "print(\"phi dW=phi dQ=-71.27 KJ\")\n", + "print(\"heat transferred from system=71.27 KJ\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.23;pg no:93" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.23, Page:93 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\n", + "initial mass of air in bottle(m1)in kg \n", + "m1= 6.97\n", + "now final temperature(T2)in K\n", + "T2= 0.0\n", + "final mass of air in bottle(m2)in kg\n", + "m2= 0.82\n", + "energy available for running of turbine due to emptying of bottle(W)in KJ\n", + "W= 639.09\n", + "work available from turbine=639.27KJ\n" + ] + } + ], + "source": [ + "#cal of work available from turbine\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.23, Page:93 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\")\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "y=1.4;#expansion constant \n", + "p1=40*10**5;#initial temperature of air in pa\n", + "v1=0.15;#initial volume of air in m^3\n", + "T1=(27+273);#initial temperature of air in K\n", + "p2=2*10**5;#final temperature of air in pa\n", + "v2=0.15;#final volume of air in m^3\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"initial mass of air in bottle(m1)in kg \")\n", + "m1=(p1*v1)/(R*1000*T1)\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"now final temperature(T2)in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"T2=\"),round(T2,2)\n", + "T2=127.36;#take T2=127.36 approx.\n", + "print(\"final mass of air in bottle(m2)in kg\")\n", + "m2=(p2*v2)/(R*1000*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "m2=0.821;#take m2=0.821 approx.\n", + "print(\"energy available for running of turbine due to emptying of bottle(W)in KJ\")\n", + "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", + "print(\"W=\"),round(W,2)\n", + "print(\"work available from turbine=639.27KJ\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter3_3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter3_3.ipynb new file mode 100755 index 00000000..22ed40c9 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter3_3.ipynb @@ -0,0 +1,1506 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3:First Law of Thermo Dynamics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.1;pg no:76" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.1, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\n", + "a> work done on piston(W_piston)in KJ can be obtained as\n", + "W_piston=pdv\n", + "b> paddle work done on the system(W_paddle)=-4.88 KJ\n", + "net work done of system(W_net)in KJ\n", + "W_net=W_piston+W_paddle\n", + "so work done on system(W_net)=1.435 KJ\n" + ] + } + ], + "source": [ + "#cal of work done on system\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.1, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\")\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "p=689.;#pressure of gas in cylinder in kpa\n", + "v1=0.04;#initial volume of fluid in m^3\n", + "v2=0.045;#final volume of fluid in m^3\n", + "W_paddle=-4.88;#paddle work done on the system in KJ\n", + "print(\"a> work done on piston(W_piston)in KJ can be obtained as\")\n", + "print(\"W_piston=pdv\")\n", + "#function y = f(v), y=p, endfunction\n", + "def fun1(x):\n", + "\ty=p\n", + "\treturn y\n", + "\n", + "W_piston=scipy.integrate.quad(fun1,v1,v2) \n", + "print(\"b> paddle work done on the system(W_paddle)=-4.88 KJ\")\n", + "print(\"net work done of system(W_net)in KJ\")\n", + "print(\"W_net=W_piston+W_paddle\")\n", + "print(\"so work done on system(W_net)=1.435 KJ\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.2;pg no:" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.2, Page:76 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\n", + "as the vessel is rigid therefore work done shall be zero\n", + "W=0\n", + "from first law of thermodynamics,heat required(Q)in KJ\n", + "Q=U2-U1+W=Q=m(u2-u1)+W\n", + "so heat required = 5.6\n" + ] + } + ], + "source": [ + "#cal of heat required\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.2, Page:76 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\")\n", + "m=0.5;#mass of gas in kg\n", + "u1=26.6;#internal energy of gas at 200 degree celcius\n", + "u2=37.8;#internal energy of gas at 400 degree celcius\n", + "W=0;#work done by vessel in KJ\n", + "print(\"as the vessel is rigid therefore work done shall be zero\")\n", + "print(\"W=0\")\n", + "print(\"from first law of thermodynamics,heat required(Q)in KJ\")\n", + "print(\"Q=U2-U1+W=Q=m(u2-u1)+W\")\n", + "Q=m*(u2-u1)+W\n", + "print(\"so heat required =\"),round(Q,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.3;pg no:77" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.3, Page:77 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\n", + "by steady flow energy equation\n", + "q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\n", + "let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\n", + "q=h2-h1\n", + "rate of heat removal(Q)in KJ/hr\n", + "Q=m(h2-h1)=m*Cp*(T2-T1)\n", + "heat should be removed at the rate=KJ/hr 40500.0\n" + ] + } + ], + "source": [ + "#cal of \"heat should be removed\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.3, Page:77 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\")\n", + "m=50;#rate at which carbon dioxide passing through heat exchanger in kg/hr\n", + "T2=800;#initial temperature of carbon dioxide in degree celcius\n", + "T1=50;#final temperature of carbon dioxide in degree celcius\n", + "Cp=1.08;#specific heat at constant pressure in KJ/kg K\n", + "print(\"by steady flow energy equation\")\n", + "print(\"q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\")\n", + "print(\"let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\")\n", + "print(\"q=h2-h1\")\n", + "print(\"rate of heat removal(Q)in KJ/hr\")\n", + "print(\"Q=m(h2-h1)=m*Cp*(T2-T1)\")\n", + "Q=m*Cp*(T2-T1)\n", + "print(\"heat should be removed at the rate=KJ/hr\"),round(Q)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.4;pg no:77" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "#cal of work done by surrounding on system\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.4, Page:77 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 4\")\n", + "v=0.78;#volume of cylinder in m^3\n", + "p=101.325;#atmospheric pressure in kPa\n", + "print(\"total work done by the air at atmospheric pressure of 101.325 kPa\")\n", + "print(\"W=(pdv)cylinder+(pdv)air\")\n", + "print(\"0+p*(delta v)\")\n", + "print(\"work done by air(W)=-p*v in KJ\")\n", + "W=-p*v\n", + "print(\"so work done by surrounding on system=KJ\"),round(-W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.5:pg no:77" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.5, Page:77 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\n", + "given p*v^1.3=constant\n", + "assuming expansion to be quasi-static,the work may be given as\n", + "W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\n", + "from internal energy relation,change in specific internal energy\n", + "deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\n", + "total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\n", + "using p1*V1^1.3=p2*V2^1.3\n", + "V2=in m^3 0.85\n", + "take V2=.852 m^3\n", + "so deltaU in KJ\n", + "and W in KJ 246.67\n", + "from first law\n", + "deltaQ=KJ 113.47\n", + "heat interaction=113.5 KJ\n", + "work interaction=246.7 KJ\n", + "change in internal energy=-113.2 KJ\n" + ] + } + ], + "source": [ + "#cal of heat,work interaction and change in internal energy\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.5, Page:77 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\")\n", + "m=5;#mass of gas in kg\n", + "p1=1*10**3;#initial pressure of gas in KPa\n", + "V1=0.5;#initial volume of gas in m^3\n", + "p2=0.5*10**3;#final pressure of gas in KPa\n", + "n=1.3;#expansion constant\n", + "print(\"given p*v^1.3=constant\")\n", + "print(\"assuming expansion to be quasi-static,the work may be given as\")\n", + "print(\"W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\")\n", + "print(\"from internal energy relation,change in specific internal energy\")\n", + "print(\"deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\")\n", + "print(\"total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\")\n", + "print(\"using p1*V1^1.3=p2*V2^1.3\")\n", + "V2=V1*(p1/p2)**(1/1.3)\n", + "print(\"V2=in m^3\"),round(V2,2)\n", + "print(\"take V2=.852 m^3\")\n", + "V2=0.852;#final volume of gas in m^3\n", + "print(\"so deltaU in KJ\")\n", + "deltaU=1.8*(p2*V2-p1*V1)\n", + "W=(p2*V2-p1*V1)/(1-n)\n", + "print(\"and W in KJ\"),round(W,2)\n", + "print(\"from first law\")\n", + "deltaQ=deltaU+W\n", + "print(\"deltaQ=KJ\"),round(deltaQ,2)\n", + "print(\"heat interaction=113.5 KJ\")\n", + "print(\"work interaction=246.7 KJ\")\n", + "print(\"change in internal energy=-113.2 KJ\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.6;pg no:78" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.6, Page:78 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\n", + "final state volume(v2)in m^3\n", + "v2= 0.0\n", + "take v2=0.03 m^3\n", + "now internal energy of gas is given by U=7.5*p*v-425\n", + "change in internal energy(deltaU)in KJ\n", + "deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\n", + "deltaU=7.5*10^3*(p2*v2-p1*v1) 75.0\n", + "for quasi-static process\n", + "work(W) in KJ,W=p*dv\n", + "W=(p2*v2-p1*v1)/(1-n)\n", + "from first law of thermodynamics,\n", + "heat interaction(deltaQ)=deltaU+W\n", + "heat=50 KJ\n", + "work=25 KJ(-ve)\n", + "internal energy change=75 KJ\n", + "if 180 KJ heat transfer takes place,then from 1st law,\n", + "deltaQ= 50.0\n", + "since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\n", + "W=KJ 105.0\n" + ] + } + ], + "source": [ + "#cal of heat,workinternal energy change\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.6, Page:78 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\")\n", + "p1=1;#initial pressure of gas in MPa\n", + "v1=0.05;#initial volume of gas in m^3\n", + "p2=2;#final pressure of gas in MPa\n", + "n=1.4;#expansion constant\n", + "print(\"final state volume(v2)in m^3\")\n", + "v2=((p1/p2)**(1/1.4))*v1\n", + "print(\"v2=\"),round(v2,2)\n", + "print(\"take v2=0.03 m^3\")\n", + "v2=0.03;#final volume of gas in m^3\n", + "print(\"now internal energy of gas is given by U=7.5*p*v-425\")\n", + "print(\"change in internal energy(deltaU)in KJ\")\n", + "print(\"deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\")\n", + "deltaU=7.5*10**3*(p2*v2-p1*v1)\n", + "print(\"deltaU=7.5*10^3*(p2*v2-p1*v1)\"),round(deltaU,2)\n", + "print(\"for quasi-static process\")\n", + "print(\"work(W) in KJ,W=p*dv\")\n", + "W=((p2*v2-p1*v1)/(1-n))*10**3\n", + "print(\"W=(p2*v2-p1*v1)/(1-n)\")\n", + "print(\"from first law of thermodynamics,\")\n", + "print(\"heat interaction(deltaQ)=deltaU+W\")\n", + "deltaQ=deltaU+W\n", + "print(\"heat=50 KJ\")\n", + "print(\"work=25 KJ(-ve)\")\n", + "print(\"internal energy change=75 KJ\")\n", + "print(\"if 180 KJ heat transfer takes place,then from 1st law,\")\n", + "print(\"deltaQ=\"),round(deltaQ,2)\n", + "print(\"since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\")\n", + "W=180-75\n", + "print(\"W=KJ\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.7;pg no:79" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.7, Page:79 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\n", + "characteristics gas constant(R)in J/kg K\n", + "R= 519.64\n", + "take R=0.520,KJ/kg K\n", + "Cv=inKJ/kg K 1.18\n", + "y= 1.44\n", + "for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\n", + "now,T2=in K\n", + "work(W)in KJ/kg\n", + "W= -257.78\n", + "for polytropic process,heat(Q)in KJ/K\n", + "Q= 82.02\n" + ] + } + ], + "source": [ + "#cal of work and heat\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.7, Page:79 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\")\n", + "M=16;#molecular weight of gas\n", + "p1=101.3;#initial pressure of gas in KPa\n", + "p2=600;#final pressure of gas in KPa\n", + "T1=(273+20);#initial temperature of gas in K\n", + "R1=8.3143*10**3;#universal gas constant in J/kg K\n", + "Cp=1.7;#specific heat at constant pressure in KJ/kg K\n", + "n=1.3;#expansion constant\n", + "T2=((p2/p1)**(n-1/n))\n", + "print(\"characteristics gas constant(R)in J/kg K\")\n", + "R=R1/M\n", + "print(\"R=\"),round(R,2)\n", + "print(\"take R=0.520,KJ/kg K\")\n", + "R=0.520;#characteristics gas constant in KJ/kg K\n", + "Cv=Cp-R\n", + "print(\"Cv=inKJ/kg K\"),round(Cv,2)\n", + "y=Cp/Cv\n", + "print(\"y=\"),round(y,2)\n", + "y=1.44;#ratio of specific heat at constant pressure to constant volume\n", + "print(\"for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\")\n", + "T2=T1*((p2/p1)**((n-1)/n))\n", + "print(\"now,T2=in K\")\n", + "print(\"work(W)in KJ/kg\")\n", + "W=R*((T1-T2)/(n-1))\n", + "print(\"W=\"),round(W,2)\n", + "W=257.78034;#work done in KJ/kg\n", + "print(\"for polytropic process,heat(Q)in KJ/K\")\n", + "Q=((y-n)/(y-1))*W\n", + "print(\"Q=\"),round(Q,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.8;pg no:80" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.8, Page:80 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\n", + "applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\n", + "h1+C1^2/2=h2+C2^2/2\n", + "given that C1=0,negligible inlet velocity\n", + "so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\n", + "exit velocity(C2)in m/s 1098.2\n" + ] + } + ], + "source": [ + "#cal of exit velocity\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.8, Page:80 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\")\n", + "T1=(627+273);#initial temperature of air in nozzle in K\n", + "T2=(27+273);#temperature at which air leaves nozzle in K\n", + "Cp=1.005*10**3;#specific heat at constant pressure in J/kg K\n", + "C2=math.sqrt(2*Cp*(T1-T2))\n", + "print(\"applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\")\n", + "print(\"h1+C1^2/2=h2+C2^2/2\")\n", + "print(\"given that C1=0,negligible inlet velocity\")\n", + "print(\"so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\")\n", + "print(\"exit velocity(C2)in m/s\"),round(C2,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.9;pg no:80" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.9, Page:80 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\n", + "work interaction,W=-200 KJ/kg of air\n", + "increase in enthalpy of air=100 KJ/kg of air\n", + "total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\n", + "writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\n", + "h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\n", + "assuming no change in potential energy and kinetic energy\n", + "deltaK.E=deltaP.=0\n", + "total heat interaction(Q)in KJ/kg of air\n", + "Q= -100.0\n", + "Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\n", + "so heat transferred to atmosphere(Q2)in KJ/kg of air -10.0\n" + ] + } + ], + "source": [ + "#cal of heat transferred to atmosphere\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.9, Page:80 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\")\n", + "W=-200;#shaft work in KJ/kg of air\n", + "deltah=100;#increase in enthalpy in KJ/kg of air\n", + "Q1=-90;#heat transferred to water in KJ/kg of air\n", + "print(\"work interaction,W=-200 KJ/kg of air\")\n", + "print(\"increase in enthalpy of air=100 KJ/kg of air\")\n", + "print(\"total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\")\n", + "print(\"writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\")\n", + "print(\"h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\")\n", + "print(\"assuming no change in potential energy and kinetic energy\")\n", + "print(\"deltaK.E=deltaP.=0\")\n", + "print(\"total heat interaction(Q)in KJ/kg of air\")\n", + "Q=deltah+W\n", + "print(\"Q=\"),round(Q,2)\n", + "Q2=Q-Q1\n", + "print(\"Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\")\n", + "print(\"so heat transferred to atmosphere(Q2)in KJ/kg of air\"),round(Q2,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.10;pg no:81" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.10, Page:81 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\n", + "above problem can be solved using steady flow energy equations upon hot water flow\n", + "Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\n", + "here total heat to be supplied(Q)in kcal/hr\n", + "so heat lost by water(-ve),Q=-25000 kcal/hr\n", + "there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\n", + "Q+m*(h1+g*z1)=m*(h2+g*z2)\n", + "so water circulation rate(m)in kg/hr\n", + "so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\n", + "water circulation rate=(m)in kg/min 11.91\n" + ] + } + ], + "source": [ + "#cal of water circulation rate\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.10, Page:81 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\")\n", + "n=500;#total number of persons\n", + "q=50;#heat requirement per person in kcal/hr\n", + "h1=80;#enthalpy of hot water enter in pipe in kcal/kg\n", + "h2=45;#enthalpy of hot water leaves the pipe in kcal/kg\n", + "g=9.81;#acceleartion due to gravity in m/s^2\n", + "deltaz=10;#difference in elevation of inlet and exit pipe in m\n", + "print(\"above problem can be solved using steady flow energy equations upon hot water flow\")\n", + "print(\"Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\")\n", + "print(\"here total heat to be supplied(Q)in kcal/hr\")\n", + "Q=n*q\n", + "print(\"so heat lost by water(-ve),Q=-25000 kcal/hr\")\n", + "Q=-25000#heat loss by water in kcal/hr\n", + "print(\"there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\")\n", + "print(\"Q+m*(h1+g*z1)=m*(h2+g*z2)\")\n", + "print(\"so water circulation rate(m)in kg/hr\")\n", + "print(\"so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\")\n", + "m=Q*10**3*4.18/(g*deltaz-(h1-h2)*10**3*4.18)\n", + "m=m/60\n", + "print(\"water circulation rate=(m)in kg/min\"),round(m,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.11;pg no:81" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.11, Page:81 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\n", + "let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\n", + "energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\n", + "m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\n", + "so steam suppling rate(m)in kg/s per kg of water\n", + "m= 0.124\n", + "NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\n" + ] + } + ], + "source": [ + "#cal of steam suppling rate\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.11, Page:81 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\")\n", + "v1=50;#velocity of steam entering injector in m/s\n", + "v2=25;#velocity of mixture leave injector in m/s\n", + "h1=720;#enthalpy of steam entering injector in kcal/kg\n", + "h2=24.6;#enthalpy of water entering injector in kcal/kg\n", + "h3=100;#enthalpy of steam leaving injector in kcal/kg\n", + "h4=100;#enthalpy of water leaving injector in kcal/kg\n", + "deltaz=2;#depth from axis of injector in m\n", + "q=12;#heat loss from injector to surrounding through injector\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\")\n", + "print(\"energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\")\n", + "print(\"m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\")\n", + "print(\"so steam suppling rate(m)in kg/s per kg of water\")\n", + "m=((h3*10**3*4.18+v2**2/2)-(h2*10**3*4.18+g*deltaz))/((v1**2/2+h1*10**3*4.18)-(h3*10**3*4.18+v2**2/2)-(q*10**3*4.18))\n", + "print(\"m=\"),round(m,3)\n", + "print(\"NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.12;pg no:82" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.12, Page:82 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\n", + "here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\n", + "displacement work, W=(p.dv)cylinder+(p.dv)ballon\n", + "(p.dv)cylinder=0,as cylinder is rigid\n", + "so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\n", + "and work done by atmosphere=KJ 40.52\n" + ] + } + ], + "source": [ + "#cal of work done by atmosphere\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.12, Page:82 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\")\n", + "p=1.013*10**5;#atmospheric pressure in pa\n", + "deltav=0.4;#change in volume in m^3\n", + "print(\"here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\")\n", + "print(\"displacement work, W=(p.dv)cylinder+(p.dv)ballon\")\n", + "print(\"(p.dv)cylinder=0,as cylinder is rigid\")\n", + "print(\"so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\")\n", + "W=(p*deltav)/1000\n", + "print(\"and work done by atmosphere=KJ\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.13;pg no:82" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.13, Page:82 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\n", + "work done by turbine(Wt)in J#s is 25% of heat added i.e Wt= 1250.0\n", + "heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\n", + "Qrejected= 3750.0\n", + "and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\n", + "Wp=(-) 10.0\n", + "capacity of generator(W)=in Kw 1.24\n" + ] + } + ], + "source": [ + "#cal of capacity of generator\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.13, Page:82 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\")\n", + "Qadd=5000;#heat supplied in boiler in J#s\n", + "Wt=.25*Qadd\n", + "print(\"work done by turbine(Wt)in J#s is 25% of heat added i.e\"),\n", + "print(\"Wt=\"),round(Wt,2)\n", + "print(\"heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\")\n", + "Qrejected=.75*Qadd\n", + "print(\"Qrejected=\"),round(Qrejected,2)\n", + "print(\"and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\")\n", + "Wp=0.002*Qadd\n", + "print(\"Wp=(-)\"),round(Wp,2)\n", + "W=(Wt-Wp)/1000\n", + "print(\"capacity of generator(W)=in Kw\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.14;pg no:83" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.14, Page:83 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\n", + "in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\n", + "h1+Q1_2=h2\n", + "Q1_2=h2-h1\n", + "so heat transfer to air in heat exchanger(Q1_2)in KJ\n", + "Q1_2= 726.61\n", + "in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\n", + "h2+C2^2#2=h3+C3^2/2+Wt\n", + "Wt=(h2-h3)+(C2^2-C3^2)/2\n", + "so power output from turbine(Wt)in KJ#s\n", + "Wt= 1.0\n", + "applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\n", + "h3+C=h4+C4^2/2\n", + "C4^2#2=(h3-h4)+C3^2/2\n", + "velocity at exit of nozzle(C4)in m#s\n", + "C4= 14.3\n" + ] + } + ], + "source": [ + "#cal of velocity at exit of nozzle\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.14, Page:83 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\")\n", + "T1=(27+273);##ambient temperature in K\n", + "T2=(750+273);##temperature of heated air inside heat exchanger in K\n", + "T3=(600+273);##temperature of hot air leaves turbine in K\n", + "T4=(500+273);##temperature at which air leaves nozzle in K\n", + "Cp=1.005;##specific heat at constant pressure in KJ#kg K\n", + "C2=50;##velocity of hot air enter into gas turbine in m#s\n", + "C3=60;##velocity of air leaving turbine enters a nozzle in m#s\n", + "print(\"in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\")\n", + "print(\"h1+Q1_2=h2\")\n", + "print(\"Q1_2=h2-h1\")\n", + "print(\"so heat transfer to air in heat exchanger(Q1_2)in KJ\")\n", + "Q1_2=Cp*(T2-T1)\n", + "print(\"Q1_2=\"),round(Q1_2,2)\n", + "print(\"in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\")\n", + "print(\"h2+C2^2#2=h3+C3^2/2+Wt\")\n", + "print(\"Wt=(h2-h3)+(C2^2-C3^2)/2\")\n", + "print(\"so power output from turbine(Wt)in KJ#s\")\n", + "Wt=Cp*(T2-T3)+(C2**2-C3**2)*10**-3/2\n", + "print(\"Wt=\"),round(Cp,2)\n", + "print(\"applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\")\n", + "print(\"h3+C=h4+C4^2/2\")\n", + "print(\"C4^2#2=(h3-h4)+C3^2/2\")\n", + "print(\"velocity at exit of nozzle(C4)in m#s\")\n", + "C4=math.sqrt(2*(Cp*(T3-T4)+C3**2*10**-3/2))\n", + "print(\"C4=\"),round(C4,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.15;pg no:85" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.15, Page:85 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\n", + "for constant pressure heating,say state changes from 1 to 2\n", + "Wa=p1*dv\n", + "Wa=p1*(v2-v1)\n", + "it is given that v2=2v1\n", + "so Wa=p1*v1=R*T1\n", + "for subsequent expansion at constant temperature say state from 2 to 3\n", + "also given that v3/v1=6,v3/v2=3\n", + "so work=Wb=p*dv\n", + "on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\n", + "temperature at 2 can be given by perfect gas consideration as,\n", + "T2/T1=v2/v1\n", + "or T2=2*T1\n", + "now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\n", + "so W in KJ= 10632.69\n" + ] + } + ], + "source": [ + "#cal of total work done by ai\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.15, Page:85 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\")\n", + "T1=400;##initial temperature of gas in K\n", + "R=8.314;##gas constant in \n", + "print(\"for constant pressure heating,say state changes from 1 to 2\")\n", + "print(\"Wa=p1*dv\")\n", + "print(\"Wa=p1*(v2-v1)\")\n", + "print(\"it is given that v2=2v1\")\n", + "print(\"so Wa=p1*v1=R*T1\")\n", + "print(\"for subsequent expansion at constant temperature say state from 2 to 3\")\n", + "print(\"also given that v3/v1=6,v3/v2=3\")\n", + "print(\"so work=Wb=p*dv\")\n", + "print(\"on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\")\n", + "print(\"temperature at 2 can be given by perfect gas consideration as,\")\n", + "print(\"T2/T1=v2/v1\")\n", + "print(\"or T2=2*T1\")\n", + "print(\"now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\")\n", + "W=R*T1+2*R*T1*math.log(3)\n", + "print(\"so W in KJ=\"),round(W,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.16;pg no:85" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.16, Page:85 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\n", + "NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \n", + "we get W=(Vf-Vi)*((Pi+Pf)/2)\n", + "also final volume of gas in m^3 is Vf=3*Vi\n", + "now work done by gas(W)in J 750000.0\n" + ] + } + ], + "source": [ + "#cal of work done by gas\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.16, Page:85 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\")\n", + "Pi=0.5*10**6;##initial pressure of gas in pa\n", + "Vi=0.5;##initial volume of gas in m^3\n", + "Pf=1*10**6;##final pressure of gas in pa\n", + "print(\"NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \")\n", + "print(\"we get W=(Vf-Vi)*((Pi+Pf)/2)\")\n", + "print(\"also final volume of gas in m^3 is Vf=3*Vi\") \n", + "Vf=3*Vi\n", + "W=(Vf-Vi)*((Pi+Pf)/2)\n", + "print(\"now work done by gas(W)in J\"),round(W,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.17;pg no:87" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.17, Page:87 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\n", + "with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\n", + "adiabatic index of compression of H2 can be obtained as,\n", + "Cp_H2=\n", + "y_H2=Cp_H2/(Cp_H2-R_H2) 1.4\n", + "adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\n", + "y_N2= 1.4\n", + "i>for hydrogen,p1*v1^y=p2*v2^y\n", + "so final pressure of H2(p2)in pa\n", + "p2= 1324078.55\n", + "ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \n", + "partition work=0\n", + "iii>work done upon H2(W_H2)in J,\n", + "W_H2= -200054.06\n", + "work done upon H2(W_H2)=-2*10^5 J\n", + "so work done by N2(W_N2)=2*10^5 J \n", + "iv>heat added to N2 can be obtained using first law of thermodynamics as\n", + "Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\n", + "final temperature of N2 can be obtained considering it as perfect gas\n", + "therefore, T2=(p2*v2*T1)#(p1*v1)\n", + "here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\n", + "p2=1.324*10^6 pa,v2=0.75 m^3\n", + "so now final temperature of N2(T2)in K= 1191.67\n", + "mass of N2(m)in kg= 2.81\n", + "specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2= 1.0\n", + "heat added to N2,(Q_N2)in KJ\n", + "Q_N2= 2052.89\n" + ] + } + ], + "source": [ + "#cal of \n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.17, Page:87 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\")\n", + "Cp_H2=14.307;##specific heat of H2 at constant pressure in KJ#kg K\n", + "R_H2=4.1240;##gas constant for H2 in KJ#kg K\n", + "Cp_N2=1.039;##specific heat of N2 at constant pressure in KJ#kg K\n", + "R_N2=0.2968;##gas constant for N2 in KJ#kg K\n", + "T1=(27+273);##ambient temperature in K\n", + "v1=0.5;##initial volume of H2 in m^3\n", + "p1=0.5*10**6;##initial pressure of H2 in pa \n", + "v2=0.25;##final volume of H2 in m^3 \n", + "p2=1.324*10**6;##final pressure of H2 in pa\n", + "print(\"with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\")\n", + "print(\"adiabatic index of compression of H2 can be obtained as,\")\n", + "print(\"Cp_H2=\")\n", + "y_H2=Cp_H2/(Cp_H2-R_H2)\n", + "print(\"y_H2=Cp_H2/(Cp_H2-R_H2)\"),round(y_H2,2)\n", + "print(\"adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\")\n", + "y_N2=Cp_N2/(Cp_N2-R_N2)\n", + "print(\"y_N2=\"),round(y_N2,2)\n", + "print(\"i>for hydrogen,p1*v1^y=p2*v2^y\")\n", + "print(\"so final pressure of H2(p2)in pa\")\n", + "p2=p1*(v1/v2)**y_H2\n", + "print(\"p2=\"),round(p2,2)\n", + "print(\"ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \")\n", + "print(\"partition work=0\")\n", + "print(\"iii>work done upon H2(W_H2)in J,\")\n", + "W_H2=(p1*v1-p2*v2)/(y_H2-1)\n", + "print(\"W_H2=\"),round(W_H2,2)\n", + "print(\"work done upon H2(W_H2)=-2*10^5 J\")\n", + "W_N2=2*10**5;##work done by N2 in J\n", + "print(\"so work done by N2(W_N2)=2*10^5 J \")\n", + "print(\"iv>heat added to N2 can be obtained using first law of thermodynamics as\")\n", + "print(\"Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\")\n", + "print(\"final temperature of N2 can be obtained considering it as perfect gas\")\n", + "print(\"therefore, T2=(p2*v2*T1)#(p1*v1)\")\n", + "print(\"here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\")\n", + "print(\"p2=1.324*10^6 pa,v2=0.75 m^3\")\n", + "v2=0.75;##final volume of N2 in m^3\n", + "T2=(p2*v2*T1)/(p1*v1)\n", + "print(\"so now final temperature of N2(T2)in K=\"),round(T2,2)\n", + "T2=1191.6;##T2 approx. equal to 1191.6 K\n", + "m=(p1*v1)/(R_N2*1000*T1)\n", + "print(\"mass of N2(m)in kg=\"),round(m,2)\n", + "m=2.8;##m approx equal to 2.8 kg\n", + "Cv_N2=Cp_N2-R_N2\n", + "print(\"specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2=\"),round(Cv_N2)\n", + "print(\"heat added to N2,(Q_N2)in KJ\")\n", + "Q_N2=((m*Cv_N2*1000*(T2-T1))+W_N2)/1000\n", + "print(\"Q_N2=\"),round(Q_N2,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.18;pg no:88" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.18, Page:88 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\n", + "let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\n", + "initial mass of air(m1)in kg\n", + "m1= 9.29\n", + "for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\n", + "T2=in K 237.64\n", + "final mass of air left in tank(m2)in kg\n", + "m2= 2.97\n", + "writing down energy equation for unsteady flow system\n", + "(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\n", + "or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\n", + "kinetic energy available for running turbine(W)in KJ\n", + "W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", + "W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", + "amount of work available=KJ 482.67\n" + ] + } + ], + "source": [ + "#cal of amount of work available\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.18, Page:88 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\")\n", + "p1=0.5*10**6;#initial pressure of air in pa\n", + "p2=1.013*10**5;#atmospheric pressure in pa\n", + "v1=2;#initial volume of air in m^3\n", + "v2=v1;#final volume of air in m^3\n", + "T1=375;#initial temperature of air in K\n", + "Cp_air=1.003;#specific heat at consatnt pressure in KJ/kg K\n", + "Cv_air=0.716;#specific heat at consatnt volume in KJ/kg K\n", + "R_air=0.287;#gas constant in KJ/kg K\n", + "y=1.4;#expansion constant for air\n", + "print(\"let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\")\n", + "print(\"initial mass of air(m1)in kg\")\n", + "m1=(p1*v1)/(R_air*1000*T1)\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"T2=in K\"),round(T2,2)\n", + "print(\"final mass of air left in tank(m2)in kg\")\n", + "m2=(p2*v2)/(R_air*1000*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"writing down energy equation for unsteady flow system\")\n", + "print(\"(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\")\n", + "print(\"or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\")\n", + "print(\"kinetic energy available for running turbine(W)in KJ\")\n", + "print(\"W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", + "print(\"W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", + "W=((m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2)/1000\n", + "print(\"amount of work available=KJ\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.19;pg no:89" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.19, Page:89 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\n", + "using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\n", + "n1= 0.1\n", + "now n2= 0.12\n", + "for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\n", + "deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\n", + "final temperature of gas(T3)in K\n", + "T3= 409.09\n", + "using perfect gas equation for final mixture,\n", + "final pressure of gas(p3)in Mpa\n", + "p3= 750000.0\n", + "so final pressure and temperature =0.75 Mpa and 409.11 K\n" + ] + } + ], + "source": [ + "#cal of final pressure and temperature\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.19, Page:89 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\")\n", + "p1=0.5*10**6;#initial pressure of air in pa\n", + "v1=0.5;#initial volume of air in m^3\n", + "T1=(27+273);#initial temperature of air in K\n", + "p2=1*10**6;#final pressure of air in pa\n", + "v2=0.5;#final volume of air in m^3\n", + "T2=500;#final temperature of air in K\n", + "R=8314;#gas constant in J/kg K\n", + "Cv=0.716;#specific heat at constant volume in KJ/kg K\n", + "print(\"using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\")\n", + "n1=(p1*v1)/(R*T1)\n", + "print(\"n1=\"),round(n1,2)\n", + "n2=(p2*v2)/(R*T2)\n", + "print(\"now n2=\"),round(n2,2)\n", + "print(\"for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\")\n", + "deltaU=0;#change in internal energy\n", + "print(\"deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\")\n", + "print(\"final temperature of gas(T3)in K\")\n", + "T3=(deltaU+Cv*(n1*T1+n2*T2))/(Cv*(n1+n2))\n", + "print(\"T3=\"),round(T3,2)\n", + "print(\"using perfect gas equation for final mixture,\")\n", + "print(\"final pressure of gas(p3)in Mpa\")\n", + "p3=((n1+n2)*R*T3)/(v1+v2)\n", + "print(\"p3=\"),round(p3,3)\n", + "print(\"so final pressure and temperature =0.75 Mpa and 409.11 K\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.20;pg no:90" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.20, Page:90 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\n", + "printlacement work,W=p*(v1-v2)in N.m -50675.0\n", + "so heat transfer(Q)in N.m\n", + "Q=-W 50675.0\n" + ] + } + ], + "source": [ + "#cal of heat transfer\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.20, Page:90 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\")\n", + "v1=0;#initial volume of air inside bottle in m^3\n", + "v2=0.5;#final volume of air inside bottle in m^3\n", + "p=1.0135*10**5;#atmospheric pressure in pa\n", + "W=p*(v1-v2)\n", + "print(\"printlacement work,W=p*(v1-v2)in N.m\"),round(W,2)\n", + "print(\"so heat transfer(Q)in N.m\")\n", + "Q=-W\n", + "print(\"Q=-W\"),round(Q,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.21;pg no:90" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.21, Page:90 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\n", + "here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\n", + "(p2/p1)^((y-1)/y)=(T2/T1)\n", + "final temperature of air(T2)in K\n", + "T2= 113.34\n", + "by perfect gas law,initial mass in bottle(m1)in kg\n", + "m1= 11.69\n", + "final mass in bottle(m2)in kg\n", + "m2= 0.92\n", + "energy available for running turbo generator or work(W)in KJ\n", + "W+(m1-m2)*h2=m1*u1-m2*u2\n", + "W= 1325.42\n", + "this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\n", + "turbogenerator actual output(P1)=5 KJ/s\n", + "input to turbogenerator(P2)in KJ/s\n", + "time duration for which turbogenerator can be run(deltat)in seconds\n", + "deltat= 159.05\n", + "duration=160 seconds approx.\n" + ] + } + ], + "source": [ + "#cal of time duration for which turbogenerator can be run\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.21, Page:90 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\")\n", + "p1=35.*10**5;#initial pressure of air in pa\n", + "v1=0.3;#initial volume of air in m^3\n", + "T1=(313.);#initial temperature of air in K\n", + "p2=1.*10**5;#final pressure of air in pa\n", + "v2=0.3;#final volume of air in m^3\n", + "y=1.4;#expansion constant\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\")\n", + "print(\"(p2/p1)^((y-1)/y)=(T2/T1)\")\n", + "print(\"final temperature of air(T2)in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"T2=\"),round(T2,2)\n", + "print(\"by perfect gas law,initial mass in bottle(m1)in kg\")\n", + "m1=(p1*v1)/(R*1000.*T1)\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"final mass in bottle(m2)in kg\")\n", + "m2=(p2*v2)/(R*1000.*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"energy available for running turbo generator or work(W)in KJ\")\n", + "print(\"W+(m1-m2)*h2=m1*u1-m2*u2\")\n", + "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", + "print(\"W=\"),round(W,2)\n", + "print(\"this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\")\n", + "print(\"turbogenerator actual output(P1)=5 KJ/s\")\n", + "P1=5;#turbogenerator actual output in KJ/s\n", + "print(\"input to turbogenerator(P2)in KJ/s\")\n", + "P2=P1/0.6\n", + "print(\"time duration for which turbogenerator can be run(deltat)in seconds\")\n", + "deltat=W/P2\n", + "print(\"deltat=\"),round(deltat,2)\n", + "print(\"duration=160 seconds approx.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.22;pg no:91" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.22, Page:91 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\n", + "different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\n", + "process 1-2 is polytropic process with index 1.2\n", + "(T2/T1)=(p2/p1)^((n-1)/n)\n", + "final temperature of air(T2)in K\n", + "T2= 457.68\n", + "at state 1,p1*v1=m*R*T1\n", + "initial volume of air(v1)in m^3\n", + "v1= 2.01\n", + "final volume of air(v2)in m^3\n", + "for process 1-2,v2= 0.53\n", + "for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\n", + "v3=v2*T3/T2 in m^3\n", + "here process 3-1 is isothermal process so T1=T3\n", + "during process 1-2 the compression work(W1_2)in KJ\n", + "W1_2=(m*R*(T2-T1)/(1-n))\n", + "work during process 2-3(W2_3)in KJ,\n", + "W2_3=p2*(v3-v2)/1000\n", + "work during process 3-1(W3_1)in KJ\n", + "W3_1= 485.0\n", + "net work done(W_net)in KJ\n", + "W_net=W1_2+W2_3+W3_1 -71.28\n", + "net work=-71.27 KJ\n", + "here -ve workshows work done upon the system.since it is cycle,so\n", + "W_net=Q_net\n", + "phi dW=phi dQ=-71.27 KJ\n", + "heat transferred from system=71.27 KJ\n" + ] + } + ], + "source": [ + "#cal of network,heat transferred from system\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "import math\n", + "print\"Example 3.22, Page:91 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\")\n", + "p1=1.5*10**5;#initial pressure of air in pa\n", + "T1=(77+273);#initial temperature of air in K\n", + "p2=7.5*10**5;#final pressure of air in pa\n", + "n=1.2;#expansion constant for process 1-2\n", + "R=0.287;#gas constant in KJ/kg K\n", + "m=3.;#mass of air in kg\n", + "print(\"different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\")\n", + "print(\"process 1-2 is polytropic process with index 1.2\")\n", + "print(\"(T2/T1)=(p2/p1)^((n-1)/n)\")\n", + "print(\"final temperature of air(T2)in K\")\n", + "T2=T1*((p2/p1)**((n-1)/n))\n", + "print(\"T2=\"),round(T2,2)\n", + "print(\"at state 1,p1*v1=m*R*T1\")\n", + "print(\"initial volume of air(v1)in m^3\")\n", + "v1=(m*R*1000*T1)/p1\n", + "print(\"v1=\"),round(v1,2)\n", + "print(\"final volume of air(v2)in m^3\")\n", + "v2=((p1*v1**n)/p2)**(1/n)\n", + "print(\"for process 1-2,v2=\"),round(v2,2)\n", + "print(\"for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\")\n", + "print(\"v3=v2*T3/T2 in m^3\")\n", + "print(\"here process 3-1 is isothermal process so T1=T3\")\n", + "T3=T1;#process 3-1 is isothermal\n", + "v3=v2*T3/T2\n", + "print(\"during process 1-2 the compression work(W1_2)in KJ\")\n", + "print(\"W1_2=(m*R*(T2-T1)/(1-n))\")\n", + "W1_2=(m*R*(T2-T1)/(1-n))\n", + "print(\"work during process 2-3(W2_3)in KJ,\")\n", + "print(\"W2_3=p2*(v3-v2)/1000\")\n", + "W2_3=p2*(v3-v2)/1000\n", + "print(\"work during process 3-1(W3_1)in KJ\")\n", + "p3=p2;#pressure is constant for process 2-3\n", + "W3_1=p3*v3*math.log(v1/v3)/1000\n", + "print(\"W3_1=\"),round(W3_1,2)\n", + "print(\"net work done(W_net)in KJ\")\n", + "W_net=W1_2+W2_3+W3_1\n", + "print(\"W_net=W1_2+W2_3+W3_1\"),round(W_net,2)\n", + "print(\"net work=-71.27 KJ\")\n", + "print(\"here -ve workshows work done upon the system.since it is cycle,so\")\n", + "print(\"W_net=Q_net\")\n", + "print(\"phi dW=phi dQ=-71.27 KJ\")\n", + "print(\"heat transferred from system=71.27 KJ\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 3.23;pg no:93" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 3.23, Page:93 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\n", + "initial mass of air in bottle(m1)in kg \n", + "m1= 6.97\n", + "now final temperature(T2)in K\n", + "T2= 0.0\n", + "final mass of air in bottle(m2)in kg\n", + "m2= 0.82\n", + "energy available for running of turbine due to emptying of bottle(W)in KJ\n", + "W= 639.09\n", + "work available from turbine=639.27KJ\n" + ] + } + ], + "source": [ + "#cal of work available from turbine\n", + "#intiation of all variables\n", + "# Chapter 3\n", + "print\"Example 3.23, Page:93 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\")\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "y=1.4;#expansion constant \n", + "p1=40*10**5;#initial temperature of air in pa\n", + "v1=0.15;#initial volume of air in m^3\n", + "T1=(27+273);#initial temperature of air in K\n", + "p2=2*10**5;#final temperature of air in pa\n", + "v2=0.15;#final volume of air in m^3\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"initial mass of air in bottle(m1)in kg \")\n", + "m1=(p1*v1)/(R*1000*T1)\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"now final temperature(T2)in K\")\n", + "T2=T1*(p2/p1)**((y-1)/y)\n", + "print(\"T2=\"),round(T2,2)\n", + "T2=127.36;#take T2=127.36 approx.\n", + "print(\"final mass of air in bottle(m2)in kg\")\n", + "m2=(p2*v2)/(R*1000*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "m2=0.821;#take m2=0.821 approx.\n", + "print(\"energy available for running of turbine due to emptying of bottle(W)in KJ\")\n", + "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", + "print(\"W=\"),round(W,2)\n", + "print(\"work available from turbine=639.27KJ\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter4.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter4.ipynb new file mode 100755 index 00000000..bb4a3703 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter4.ipynb @@ -0,0 +1,1070 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4:Second Law of Thermo Dynamics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.1;pg no: 113" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.1, Page:113 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\n", + "NOTE=>This question is fully theoritical hence cannot be solve using scilab.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.1, Page:113 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\")\n", + "print(\"NOTE=>This question is fully theoritical hence cannot be solve using scilab.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.2;pg no: 114" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.2, Page:114 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\n", + "in carnot engine from thermodynamics temperature scale\n", + "Q1/Q2=T1/T2\n", + "W=Q1-Q2=200 KJ\n", + "from above equations Q1 in KJ is given by\n", + "Q1= 349.61\n", + "and Q2 in KJ\n", + "Q2=Q1-200 149.61\n", + "so heat supplied(Q1) in KJ 349.6\n" + ] + } + ], + "source": [ + "#cal of heat supplied\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.2, Page:114 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\")\n", + "T1=(400.+273.);#temperature of source in K\n", + "T2=(15.+273.);#temperature of sink in K\n", + "W=200.;#work done in KJ\n", + "print(\"in carnot engine from thermodynamics temperature scale\")\n", + "print(\"Q1/Q2=T1/T2\")\n", + "print(\"W=Q1-Q2=200 KJ\")\n", + "print(\"from above equations Q1 in KJ is given by\")\n", + "Q1=(200*T1)/(T1-T2)\n", + "print(\"Q1=\"),round(Q1,2)\n", + "print(\"and Q2 in KJ\")\n", + "Q2=Q1-200\n", + "print(\"Q2=Q1-200\"),round(Q2,2)\n", + "print(\"so heat supplied(Q1) in KJ\"),round(Q1,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.3;pg no: 115" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.3, Page:115 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\n", + "from thermodynamic temperature scale\n", + "Q1/Q2=T1/T2\n", + "so Q1=Q2*(T1/T2)in KJ/s 2.27\n", + "power/work input required(W)=Q1-Q2 in KJ/s \n", + "power required for driving refrigerator=W in KW 0.274\n" + ] + } + ], + "source": [ + "#cal of power required for driving refrigerator\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.3, Page:115 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\")\n", + "T1=315.;#temperature of reservoir 1 in K\n", + "T2=277.;#temperature of reservoir 2 in K\n", + "Q2=2.;#heat extracted in KJ/s\n", + "print(\"from thermodynamic temperature scale\")\n", + "print(\"Q1/Q2=T1/T2\")\n", + "Q1=Q2*(T1/T2)\n", + "print(\"so Q1=Q2*(T1/T2)in KJ/s\"),round(Q1,2)\n", + "print(\"power/work input required(W)=Q1-Q2 in KJ/s \")\n", + "W=Q1-Q2\n", + "print(\"power required for driving refrigerator=W in KW\"),round(W,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.4;pg no: 115" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.4, Page:115 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\n", + "we can writefor heat engine,Q1/Q2=T1/T2\n", + "so Q2=Q1*(T2/T1) in KJ 545.45\n", + "so We=in KJ 1454.55\n", + "for refrigerator,Q3/Q4=T3/T4 eq 1\n", + "now We-Wr=300\n", + "so Wr=We-300 in KJ 1154.55\n", + "and Wr=Q4-Q3=1154.55 KJ eq 2 \n", + "solving eq1 and eq 2 we get\n", + "Q4=in KJ 8659.13\n", + "and Q3=in KJ 7504.58\n", + "total heat transferred to low teperature reservoir(Q)=in KJ 9204.58\n", + "hence heat transferred to refrigerant=Q3 in KJ 7504.58\n", + "and heat transferred to low temperature reservoir=Q in KJ 9204.58\n" + ] + } + ], + "source": [ + "#cal of heat transferred to refrigerant and low temperature reservoir\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.4, Page:115 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\")\n", + "T1=(827.+273.);#temperature of high temperature reservoir in K\n", + "T2=(27.+273.);#temperature of low temperature reservoir in K\n", + "T3=(-13.+273.);#temperature of reservoir 3 in K\n", + "Q1=2000.;#heat ejected by reservoir 1 in KJ\n", + "print(\"we can writefor heat engine,Q1/Q2=T1/T2\")\n", + "Q2=Q1*(T2/T1)\n", + "print(\"so Q2=Q1*(T2/T1) in KJ\"),round(Q2,2)\n", + "We=Q1-Q2\n", + "print(\"so We=in KJ\"),round(We,2)\n", + "print(\"for refrigerator,Q3/Q4=T3/T4 eq 1\")\n", + "T4=T2;#temperature of low temperature reservoir in K\n", + "print(\"now We-Wr=300\")\n", + "Wr=We-300.\n", + "print(\"so Wr=We-300 in KJ\"),round(Wr,2)\n", + "print(\"and Wr=Q4-Q3=1154.55 KJ eq 2 \")\n", + "print(\"solving eq1 and eq 2 we get\")\n", + "Q4=(1154.55*T4)/(T4-T3)\n", + "print(\"Q4=in KJ\"),round(Q4,2)\n", + "Q3=Q4-Wr\n", + "print(\"and Q3=in KJ\"),round(Q3,2)\n", + "Q=Q2+Q4\n", + "print(\"total heat transferred to low teperature reservoir(Q)=in KJ\"),round(Q,2)\n", + "print(\"hence heat transferred to refrigerant=Q3 in KJ\"),round(Q3,2)\n", + "print(\"and heat transferred to low temperature reservoir=Q in KJ\"),round(Q,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.5;pg no: 116" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.5, Page:116 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\n", + "COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\n", + "also we know K=Q1/Q2=T1/T2\n", + "so K=T1/T2 1.1\n", + "so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K)) 11.0\n", + "also COP_HP=Q1/W\n", + "W=Q1/COin MJ/Hr 3.03\n", + "or W=1000*W/3600 in KW 3.03\n", + "so minimum power required(W)in KW 3.03\n" + ] + } + ], + "source": [ + "#cal of minimum power required\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.5, Page:116 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\")\n", + "T1=(25+273.15);#temperature of inside of house in K\n", + "T2=(-1+273.15);#outside temperature in K\n", + "Q1=125;#heating load in MJ/Hr\n", + "print(\"COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\")\n", + "print(\"also we know K=Q1/Q2=T1/T2\")\n", + "K=T1/T2\n", + "print(\"so K=T1/T2\"),round(K,2)\n", + "COP_HP=1/(1-(1/K))\n", + "print(\"so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K))\"),round(COP_HP)\n", + "print(\"also COP_HP=Q1/W\")\n", + "W=Q1/COP_HP\n", + "W=1000*W/3600\n", + "print(\"W=Q1/COin MJ/Hr\"),round(W,2)\n", + "print(\"or W=1000*W/3600 in KW\"),round(W,2)\n", + "print(\"so minimum power required(W)in KW \"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.6;pg no: 117" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.6, Page:117 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\n", + "cold storage plant can be considered as refrigerator operating between given temperatures limits\n", + "capacity of plant=heat to be extracted=Q2 in KW\n", + "we know that,one ton of refrigeration as 3.52 KW \n", + "so Q2=Q2*3.52 in KW 140.8\n", + "carnot COP of plant(COP_carnot)= 5.18\n", + "performance is 1/4 of its carnot COP\n", + "COP=COP_carnot/4\n", + "also actual COP=Q2/W\n", + "W=Q2/COP in KW\n", + "hence power required(W)in KW 108.76\n" + ] + } + ], + "source": [ + "#cal of power required\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.6, Page:117 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\")\n", + "T1=(-15.+273.15);#inside temperature in K\n", + "T2=(35.+273.);#atmospheric temperature in K\n", + "Q2=40.;#refrigeration capacity of storage plant in tonnes\n", + "print(\"cold storage plant can be considered as refrigerator operating between given temperatures limits\")\n", + "print(\"capacity of plant=heat to be extracted=Q2 in KW\")\n", + "print(\"we know that,one ton of refrigeration as 3.52 KW \")\n", + "Q2=Q2*3.52\n", + "print(\"so Q2=Q2*3.52 in KW\"),round(Q2,2)\n", + "COP_carnot=1/((T2/T1)-1)\n", + "print(\"carnot COP of plant(COP_carnot)=\"),round(COP_carnot,2)\n", + "print(\"performance is 1/4 of its carnot COP\")\n", + "COP=COP_carnot/4\n", + "print(\"COP=COP_carnot/4\")\n", + "print(\"also actual COP=Q2/W\")\n", + "print(\"W=Q2/COP in KW\")\n", + "W=Q2/COP\n", + "print(\"hence power required(W)in KW\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.7;pg no: 117" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.7, Page:117 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\n", + "highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\n", + "n= 0.79\n", + "or n=n*100 % 78.92\n" + ] + } + ], + "source": [ + "#cal of carnot cycle efficiency for given temperature limits\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.7, Page:117 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\")\n", + "T1=(1150.+273.);#temperature of source in K\n", + "T2=(27.+273.);#temperature of sink in K\n", + "print(\"highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\")\n", + "n=1-(T2/T1)\n", + "print(\"n=\"),round(n,2)\n", + "n=n*100\n", + "print(\"or n=n*100 %\"),round(n,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.8;pg no: 117" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.8, Page:117 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\n", + "here heat to be removed continuously from refrigerated space(Q)in KJ/s 0.13\n", + "for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\n", + "W=in KW 0.02\n", + "so power required(W)in KW 0.02\n" + ] + } + ], + "source": [ + "#cal of power required\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.8, Page:117 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\")\n", + "T1=(27.+273.);#temperature of source in K\n", + "T2=(-8.+273.);#temperature of sink in K\n", + "Q=7.5;#heat leakage in KJ/min\n", + "Q=Q/60.\n", + "print(\"here heat to be removed continuously from refrigerated space(Q)in KJ/s\"),round(Q,2)\n", + "print(\"for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\")\n", + "W=Q*((T1/T2)-1)\n", + "print(\"W=in KW\"),round(W,2)\n", + "print(\"so power required(W)in KW\"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.9;pg no: 118" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.9, Page:118 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\n", + "here W1:W2:W3=3:2:1\n", + "efficiency of engine,HE1,\n", + "W1/Q1=(1-(T2/1100))\n", + "so Q1=(1100*W1)/(1100-T2)\n", + "for HE2 engine,W2/Q2=(1-(T3/T2))\n", + "for HE3 engine,W3/Q3=(1-(300/T3))\n", + "from energy balance on engine,HE1\n", + "Q1=W1+Q2=>Q2=Q1-W1\n", + "above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\n", + "substituting Q2 in efficiency of HE2\n", + "W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\n", + "W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\n", + "2/3=(T2-T3)/(1100-T2)\n", + "2200-2*T2=3*T2-3*T3\n", + "5*T2-3*T3=2200\n", + "now energy balance on engine HE2 gives,Q2=W2+Q3\n", + "substituting in efficiency of HE2,\n", + "W2/(W2+Q3)=(T2-T3)/T2\n", + "W2*T2=(W2+Q3)*(T2-T3)\n", + "Q3=(W2*T3)/(T2-T3)\n", + "substituting Q3 in efficiency of HE3,\n", + "W3/((W2*T3)/(T2-T3))=(T3-300)/T3\n", + "W3/W2=(T3/(T2-T3))*(T3-300)/T3\n", + "1/2=(T3-300)/(T2-T3)\n", + "3*T3-T2=600\n", + "solving equations of T2 and T3,\n", + "we get,T3=in K 433.33\n", + "and by eq 5,T2 in K 700.0\n", + "so intermediate temperature are 700 K and 433.33 K\n" + ] + } + ], + "source": [ + "#cal of intermediate temperatures\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.9, Page:118 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\")\n", + "T1=1100;#temperature of high temperature reservoir in K\n", + "T4=300;#temperature of low temperature reservoir in K\n", + "print(\"here W1:W2:W3=3:2:1\")\n", + "print(\"efficiency of engine,HE1,\")\n", + "print(\"W1/Q1=(1-(T2/1100))\")\n", + "print(\"so Q1=(1100*W1)/(1100-T2)\")\n", + "print(\"for HE2 engine,W2/Q2=(1-(T3/T2))\")\n", + "print(\"for HE3 engine,W3/Q3=(1-(300/T3))\")\n", + "print(\"from energy balance on engine,HE1\")\n", + "print(\"Q1=W1+Q2=>Q2=Q1-W1\")\n", + "print(\"above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\")\n", + "print(\"substituting Q2 in efficiency of HE2\")\n", + "print(\"W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\")\n", + "print(\"W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\")\n", + "print(\"2/3=(T2-T3)/(1100-T2)\")\n", + "print(\"2200-2*T2=3*T2-3*T3\")\n", + "print(\"5*T2-3*T3=2200\")\n", + "print(\"now energy balance on engine HE2 gives,Q2=W2+Q3\")\n", + "print(\"substituting in efficiency of HE2,\")\n", + "print(\"W2/(W2+Q3)=(T2-T3)/T2\")\n", + "print(\"W2*T2=(W2+Q3)*(T2-T3)\")\n", + "print(\"Q3=(W2*T3)/(T2-T3)\")\n", + "print(\"substituting Q3 in efficiency of HE3,\")\n", + "print(\"W3/((W2*T3)/(T2-T3))=(T3-300)/T3\")\n", + "print(\"W3/W2=(T3/(T2-T3))*(T3-300)/T3\")\n", + "print(\"1/2=(T3-300)/(T2-T3)\")\n", + "print(\"3*T3-T2=600\")\n", + "print(\"solving equations of T2 and T3,\")\n", + "T3=(600.+(2200./5.))/(3.-(3./5.))\n", + "print(\"we get,T3=in K\"),round(T3,2)\n", + "T2=(2200.+3.*T3)/5.\n", + "print(\"and by eq 5,T2 in K\"),round(T2,2)\n", + "print(\"so intermediate temperature are 700 K and 433.33 K\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.10;pg no: 119" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.10, Page:119 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\n", + "efficiency of engine,W/Q1=(800-T)/800\n", + "for refrigerator,COP=Q3/W=280/(T-280)\n", + "it is given that Q1=Q3=Q\n", + "so,from engine,W/Q=(800-T)/800\n", + "from refrigerator,Q/W=280/(T-280)\n", + "from above two(Q/W)may be equated,\n", + "(T-280)/280=(800-T)/800\n", + "so temperature(T)in K 414.81\n", + "efficiency of engine(n)is given as\n", + "n= 0.48\n", + "COP of refrigerator is given as\n", + "COP= 2.08\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.10, Page:119 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\")\n", + "T1=800.;#temperature of source in K\n", + "T2=280.;#temperature of sink in K\n", + "print(\"efficiency of engine,W/Q1=(800-T)/800\")\n", + "print(\"for refrigerator,COP=Q3/W=280/(T-280)\")\n", + "print(\"it is given that Q1=Q3=Q\")\n", + "print(\"so,from engine,W/Q=(800-T)/800\")\n", + "print(\"from refrigerator,Q/W=280/(T-280)\")\n", + "print(\"from above two(Q/W)may be equated,\")\n", + "print(\"(T-280)/280=(800-T)/800\")\n", + "T=2.*280.*800./(800.+280.)\n", + "print(\"so temperature(T)in K\"),round(T,2)\n", + "print(\"efficiency of engine(n)is given as\")\n", + "n=(800.-T)/800.\n", + "print(\"n=\"),round(n,2)\n", + "print(\"COP of refrigerator is given as\")\n", + "COP=280./(T-280.)\n", + "print(\"COP=\"),round(COP,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.11;pg no: 120" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.11, Page:120 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\n", + "let thermodynamic properties be denoted with respect to salient states;\n", + "n_carnot=1-T1/T2\n", + "so T1/T2=1-0.5\n", + "so T1/T2=0.5\n", + "or T2=2*T1\n", + "corresponding to state 2,p2*v2=m*R*T2\n", + "so temperature(T2) in K= 585.37\n", + "heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\n", + "Q_23=W_23=p2*v2*log(v3/v2)\n", + "so volume(v3) in m^3= 0.1932\n", + "temperature at state 1,T1 in K= 292.68\n", + "during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\n", + "here expansion constant(y)=Cp/Cv\n", + "so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\n", + "p1 in bar\n", + "thus p1*v1=m*R*T1\n", + "so volume(v1) in m^3= 0.68\n", + "heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\n", + "for isentropic process,dQ=0,dW=dU\n", + "during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\n", + "Q_12=0,\n", + "W_12=-105.51 KJ(-ve work)\n", + "during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\n", + "Q_31=0,\n", + "ANS:\n", + "W_34=+105.51 KJ(+ve work)\n", + "so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\n", + "for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\n", + "for process 3-4,heat transfer=0,work interaction=+105.51 KJ\n", + "for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\n", + "maximum temperature of cycle=585.36 KJ\n", + "minimum temperature of cycle=292.68 KJ\n", + "volume at the end of isothermal expansion=0.1932 m^3\n" + ] + } + ], + "source": [ + "#cal of max and min temp of cycle,volume\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "import math\n", + "print\"Example 4.11, Page:120 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\")\n", + "n_carnot=0.5;#efficiency of carnot power cycle\n", + "m=0.5;#mass of air in kg\n", + "p2=7.*10**5;#final pressure in pa\n", + "v2=0.12;#volume in m^3\n", + "R=287.;#gas constant in J/kg K\n", + "Q_23=40.*1000.;#heat transfer to the air during isothermal expansion in J\n", + "Cp=1.008;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.721;#specific heat at constant volume in KJ/kg K\n", + "print(\"let thermodynamic properties be denoted with respect to salient states;\")\n", + "print(\"n_carnot=1-T1/T2\")\n", + "print(\"so T1/T2=1-0.5\")\n", + "1-0.5\n", + "print(\"so T1/T2=0.5\")\n", + "print(\"or T2=2*T1\")\n", + "print(\"corresponding to state 2,p2*v2=m*R*T2\")\n", + "T2=p2*v2/(m*R)\n", + "print(\"so temperature(T2) in K=\"),round(T2,2)\n", + "print(\"heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\")\n", + "print(\"Q_23=W_23=p2*v2*log(v3/v2)\")\n", + "v3=v2*math.exp(Q_23/(p2*v2))\n", + "print(\"so volume(v3) in m^3=\"),round(v3,4)\n", + "T1=T2/2\n", + "print(\"temperature at state 1,T1 in K=\"),round(T1,2)\n", + "print(\"during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\")\n", + "print(\"here expansion constant(y)=Cp/Cv\")\n", + "y=Cp/Cv\n", + "print(\"so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\")\n", + "p1=p2/(T2/T1)**(y/(y-1))\n", + "print(\"p1 in bar\")\n", + "p1=p1/10**5\n", + "print(\"thus p1*v1=m*R*T1\")\n", + "v1=m*R*T1/(p1*10**5)\n", + "print(\"so volume(v1) in m^3=\"),round(v1,2) \n", + "print(\"heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\")\n", + "print(\"for isentropic process,dQ=0,dW=dU\")\n", + "print(\"during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\")\n", + "print(\"Q_12=0,\")\n", + "W_12=-m*Cv*(T2-T1)\n", + "print(\"W_12=-105.51 KJ(-ve work)\")\n", + "print(\"during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\")\n", + "print(\"Q_31=0,\")\n", + "T4=T1;\n", + "T3=T2;\n", + "W_34=-m*Cv*(T4-T3)\n", + "print(\"ANS:\")\n", + "print(\"W_34=+105.51 KJ(+ve work)\")\n", + "print(\"so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\")\n", + "print(\"for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\")\n", + "print(\"for process 3-4,heat transfer=0,work interaction=+105.51 KJ\")\n", + "print(\"for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\")\n", + "print(\"maximum temperature of cycle=585.36 KJ\")\n", + "print(\"minimum temperature of cycle=292.68 KJ\")\n", + "print(\"volume at the end of isothermal expansion=0.1932 m^3\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.12;pg no: 122" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.12, Page:122 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\n", + "let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\n", + "thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\n", + "Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\n", + "Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\n", + "substituting Q1_a and Q1_b in eq 1\n", + "4*Q2/3+2*Q3=5000...............eq4\n", + "also from total work output,Q1_a+Q1_b-Q2-Q3=W\n", + "5000-Q2-Q3=840\n", + "so Q2+Q3=5000-840=4160\n", + "Q3=4160-Q2\n", + "sunstituting Q3 in eq 4\n", + "4*Q2/3+2*(4160-Q2)=5000\n", + "so Q2=in KJ 4980.0\n", + "and Q3= in KJ 820.0\n", + "here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\n", + "Q2=4980 KJ,from heat engine\n", + "Q3=820 KJ,to heat engine\n" + ] + } + ], + "source": [ + "#cal of heat from from heat engine and to heat engine\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.12, Page:122 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\")\n", + "W=840.;#work done by reservoir in KJ\n", + "print(\"let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\")\n", + "print(\"thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\")\n", + "print(\"Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\")\n", + "print(\"Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\")\n", + "print(\"substituting Q1_a and Q1_b in eq 1\")\n", + "print(\"4*Q2/3+2*Q3=5000...............eq4\")\n", + "print(\"also from total work output,Q1_a+Q1_b-Q2-Q3=W\")\n", + "print(\"5000-Q2-Q3=840\")\n", + "print(\"so Q2+Q3=5000-840=4160\")\n", + "print(\"Q3=4160-Q2\")\n", + "print(\"sunstituting Q3 in eq 4\")\n", + "print(\"4*Q2/3+2*(4160-Q2)=5000\")\n", + "Q2=(5000.-2.*4160.)/((4./3.)-2.)\n", + "print(\"so Q2=in KJ\"),round(Q2,2)\n", + "Q3=4160.-Q2\n", + "print(\"and Q3= in KJ\"),round(-Q3,2)\n", + "print(\"here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\")\n", + "print(\"Q2=4980 KJ,from heat engine\")\n", + "print(\"Q3=820 KJ,to heat engine\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.13;pg no: 123" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.13, Page:123 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\n", + "arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\n", + "for heat engine\n", + "ne=W/Q1=1-T2/T1\n", + "so (Q1-Q2)/Q1=\n", + "and Q2/Q1=\n", + "Q2=0.2593*Q1\n", + "for heat pump,\n", + "COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\n", + "Q4/Q3=\n", + "Q4=1.27*Q3\n", + "work output from engine =work input to pump\n", + "Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\n", + "so Q4/Q1=\n", + "so Q4=3.484*Q1\n", + "also it is given that Q2+Q4=100\n", + "subtituting Q2 and Q4 as function of Q1 in following expression,\n", + "Q2+Q4=100\n", + "so 0.2539*Q1+3.484*Q1=100\n", + "so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\n", + "Q1=100/(0.2539+3.484)in KJ 26.75\n", + "NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\n" + ] + } + ], + "source": [ + "#cal of energy taken by engine from reservoir\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.13, Page:123 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\")\n", + "T2=(77+273);#temperature of reservoir 2\n", + "T1=(1077+273);#temperature of reservoir 1\n", + "T3=(3+273);#temperature of reservoir 3\n", + "print(\"arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\")\n", + "print(\"for heat engine\")\n", + "print(\"ne=W/Q1=1-T2/T1\")\n", + "print(\"so (Q1-Q2)/Q1=\")\n", + "1-T2/T1\n", + "print(\"and Q2/Q1=\")\n", + "1-0.7407\n", + "print(\"Q2=0.2593*Q1\")\n", + "print(\"for heat pump,\")\n", + "print(\"COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\")\n", + "T4=T2;\n", + "T4/(T4-T3)\n", + "print(\"Q4/Q3=\")\n", + "4.73/3.73\n", + "print(\"Q4=1.27*Q3\")\n", + "print(\"work output from engine =work input to pump\")\n", + "print(\"Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\")\n", + "print(\"so Q4/Q1=\")\n", + "(1-0.2593)/(1-(1/1.27))\n", + "print(\"so Q4=3.484*Q1\")\n", + "print(\"also it is given that Q2+Q4=100\")\n", + "print(\"subtituting Q2 and Q4 as function of Q1 in following expression,\")\n", + "print(\"Q2+Q4=100\")\n", + "print(\"so 0.2539*Q1+3.484*Q1=100\")\n", + "print(\"so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\")\n", + "Q1=100/(0.2539+3.484)\n", + "print(\"Q1=100/(0.2539+3.484)in KJ\"),round(Q1,2)\n", + "print(\"NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.14;pg no: 124" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.14, Page:124 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\n", + "let temperature of sink be T_sink K\n", + "Q_sink_HE+Q_sink_R=3000 ........eq 1\n", + "since complete work output from engine is used to run refrigerator so,\n", + "2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\n", + "by eq 1 and eq 2,we get Q_R in KJ/s 1000.0\n", + "also for heat engine,2000/1500=Q_sink_HE/T_sink\n", + "=>Q_sink_HE=4*T_sink/3\n", + "for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\n", + "substituting Q_sink_HE and Q_sink_R values\n", + "4*T_sink/3+1000*T_sink/288=3000\n", + "so temperature of sink(T_sink)in K\n", + "so T_sink= 750.0\n", + "T_sink in degree celcius 477.0\n" + ] + } + ], + "source": [ + "#cal of T_sink in degree celcius\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.14, Page:124 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\")\n", + "Q_source=2000;#heat supplied by heat engine in KJ/s\n", + "T_source=1500;#temperature of source in K\n", + "T_R=(15+273);#temperature of reservoir in K\n", + "Q_sink=3000;#heat received by sink in KJ/s\n", + "print(\"let temperature of sink be T_sink K\")\n", + "print(\"Q_sink_HE+Q_sink_R=3000 ........eq 1\")\n", + "print(\"since complete work output from engine is used to run refrigerator so,\")\n", + "print(\"2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\")\n", + "Q_R=3000-2000\n", + "print(\"by eq 1 and eq 2,we get Q_R in KJ/s\"),round(Q_R)\n", + "print(\"also for heat engine,2000/1500=Q_sink_HE/T_sink\")\n", + "print(\"=>Q_sink_HE=4*T_sink/3\")\n", + "print(\"for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\")\n", + "print(\"substituting Q_sink_HE and Q_sink_R values\")\n", + "print(\"4*T_sink/3+1000*T_sink/288=3000\")\n", + "print(\"so temperature of sink(T_sink)in K\")\n", + "T_sink=3000/((4/3)+(1000/288))\n", + "print(\"so T_sink=\"),round(T_sink,2)\n", + "T_sink=T_sink-273\n", + "print(\"T_sink in degree celcius\"),round(T_sink,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.15;pg no: 124" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.15, Page:124 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\n", + "let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\n", + "n=W/Q1= 0.39\n", + "so n=W/Q1=0.3881\n", + "COP of heat pump=T3/(T3-T2)=Q3/(2*W/3) 2.89\n", + "so 2.892=3*Q3/2*W\n", + "Q3/Q1= 0.7483\n", + "so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\n" + ] + } + ], + "source": [ + "#cal of heat transferred to refrigerant and low temperature reservoir\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.15, Page:124 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\")\n", + "T1=(500.+273.);#temperature of source in K\n", + "T2=(200.+273.);#temperature of sink in K\n", + "T3=(450.+273.);#temperature of body in K\n", + "print(\"let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\")\n", + "n=1-(T2/T1)\n", + "print(\"n=W/Q1=\"),round(n,2)\n", + "print(\"so n=W/Q1=0.3881\")\n", + "COP=T3/(T3-T2)\n", + "print(\"COP of heat pump=T3/(T3-T2)=Q3/(2*W/3)\"),round(COP,2)\n", + "print(\"so 2.892=3*Q3/2*W\")\n", + "print(\"Q3/Q1=\"),round(2*COP*n/3,4)\n", + "print(\"so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.16;pg no: 125" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.16, Page:125 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\n", + "NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.16, Page:125 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\")\n", + "print(\"NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.17;pg no: 126" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.17, Page:126 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\n", + "NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.17, Page:126 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\")\n", + "print(\"NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter4_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter4_1.ipynb new file mode 100755 index 00000000..bb4a3703 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter4_1.ipynb @@ -0,0 +1,1070 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4:Second Law of Thermo Dynamics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.1;pg no: 113" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.1, Page:113 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\n", + "NOTE=>This question is fully theoritical hence cannot be solve using scilab.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.1, Page:113 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\")\n", + "print(\"NOTE=>This question is fully theoritical hence cannot be solve using scilab.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.2;pg no: 114" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.2, Page:114 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\n", + "in carnot engine from thermodynamics temperature scale\n", + "Q1/Q2=T1/T2\n", + "W=Q1-Q2=200 KJ\n", + "from above equations Q1 in KJ is given by\n", + "Q1= 349.61\n", + "and Q2 in KJ\n", + "Q2=Q1-200 149.61\n", + "so heat supplied(Q1) in KJ 349.6\n" + ] + } + ], + "source": [ + "#cal of heat supplied\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.2, Page:114 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\")\n", + "T1=(400.+273.);#temperature of source in K\n", + "T2=(15.+273.);#temperature of sink in K\n", + "W=200.;#work done in KJ\n", + "print(\"in carnot engine from thermodynamics temperature scale\")\n", + "print(\"Q1/Q2=T1/T2\")\n", + "print(\"W=Q1-Q2=200 KJ\")\n", + "print(\"from above equations Q1 in KJ is given by\")\n", + "Q1=(200*T1)/(T1-T2)\n", + "print(\"Q1=\"),round(Q1,2)\n", + "print(\"and Q2 in KJ\")\n", + "Q2=Q1-200\n", + "print(\"Q2=Q1-200\"),round(Q2,2)\n", + "print(\"so heat supplied(Q1) in KJ\"),round(Q1,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.3;pg no: 115" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.3, Page:115 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\n", + "from thermodynamic temperature scale\n", + "Q1/Q2=T1/T2\n", + "so Q1=Q2*(T1/T2)in KJ/s 2.27\n", + "power/work input required(W)=Q1-Q2 in KJ/s \n", + "power required for driving refrigerator=W in KW 0.274\n" + ] + } + ], + "source": [ + "#cal of power required for driving refrigerator\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.3, Page:115 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\")\n", + "T1=315.;#temperature of reservoir 1 in K\n", + "T2=277.;#temperature of reservoir 2 in K\n", + "Q2=2.;#heat extracted in KJ/s\n", + "print(\"from thermodynamic temperature scale\")\n", + "print(\"Q1/Q2=T1/T2\")\n", + "Q1=Q2*(T1/T2)\n", + "print(\"so Q1=Q2*(T1/T2)in KJ/s\"),round(Q1,2)\n", + "print(\"power/work input required(W)=Q1-Q2 in KJ/s \")\n", + "W=Q1-Q2\n", + "print(\"power required for driving refrigerator=W in KW\"),round(W,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.4;pg no: 115" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.4, Page:115 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\n", + "we can writefor heat engine,Q1/Q2=T1/T2\n", + "so Q2=Q1*(T2/T1) in KJ 545.45\n", + "so We=in KJ 1454.55\n", + "for refrigerator,Q3/Q4=T3/T4 eq 1\n", + "now We-Wr=300\n", + "so Wr=We-300 in KJ 1154.55\n", + "and Wr=Q4-Q3=1154.55 KJ eq 2 \n", + "solving eq1 and eq 2 we get\n", + "Q4=in KJ 8659.13\n", + "and Q3=in KJ 7504.58\n", + "total heat transferred to low teperature reservoir(Q)=in KJ 9204.58\n", + "hence heat transferred to refrigerant=Q3 in KJ 7504.58\n", + "and heat transferred to low temperature reservoir=Q in KJ 9204.58\n" + ] + } + ], + "source": [ + "#cal of heat transferred to refrigerant and low temperature reservoir\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.4, Page:115 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\")\n", + "T1=(827.+273.);#temperature of high temperature reservoir in K\n", + "T2=(27.+273.);#temperature of low temperature reservoir in K\n", + "T3=(-13.+273.);#temperature of reservoir 3 in K\n", + "Q1=2000.;#heat ejected by reservoir 1 in KJ\n", + "print(\"we can writefor heat engine,Q1/Q2=T1/T2\")\n", + "Q2=Q1*(T2/T1)\n", + "print(\"so Q2=Q1*(T2/T1) in KJ\"),round(Q2,2)\n", + "We=Q1-Q2\n", + "print(\"so We=in KJ\"),round(We,2)\n", + "print(\"for refrigerator,Q3/Q4=T3/T4 eq 1\")\n", + "T4=T2;#temperature of low temperature reservoir in K\n", + "print(\"now We-Wr=300\")\n", + "Wr=We-300.\n", + "print(\"so Wr=We-300 in KJ\"),round(Wr,2)\n", + "print(\"and Wr=Q4-Q3=1154.55 KJ eq 2 \")\n", + "print(\"solving eq1 and eq 2 we get\")\n", + "Q4=(1154.55*T4)/(T4-T3)\n", + "print(\"Q4=in KJ\"),round(Q4,2)\n", + "Q3=Q4-Wr\n", + "print(\"and Q3=in KJ\"),round(Q3,2)\n", + "Q=Q2+Q4\n", + "print(\"total heat transferred to low teperature reservoir(Q)=in KJ\"),round(Q,2)\n", + "print(\"hence heat transferred to refrigerant=Q3 in KJ\"),round(Q3,2)\n", + "print(\"and heat transferred to low temperature reservoir=Q in KJ\"),round(Q,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.5;pg no: 116" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.5, Page:116 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\n", + "COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\n", + "also we know K=Q1/Q2=T1/T2\n", + "so K=T1/T2 1.1\n", + "so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K)) 11.0\n", + "also COP_HP=Q1/W\n", + "W=Q1/COin MJ/Hr 3.03\n", + "or W=1000*W/3600 in KW 3.03\n", + "so minimum power required(W)in KW 3.03\n" + ] + } + ], + "source": [ + "#cal of minimum power required\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.5, Page:116 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\")\n", + "T1=(25+273.15);#temperature of inside of house in K\n", + "T2=(-1+273.15);#outside temperature in K\n", + "Q1=125;#heating load in MJ/Hr\n", + "print(\"COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\")\n", + "print(\"also we know K=Q1/Q2=T1/T2\")\n", + "K=T1/T2\n", + "print(\"so K=T1/T2\"),round(K,2)\n", + "COP_HP=1/(1-(1/K))\n", + "print(\"so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K))\"),round(COP_HP)\n", + "print(\"also COP_HP=Q1/W\")\n", + "W=Q1/COP_HP\n", + "W=1000*W/3600\n", + "print(\"W=Q1/COin MJ/Hr\"),round(W,2)\n", + "print(\"or W=1000*W/3600 in KW\"),round(W,2)\n", + "print(\"so minimum power required(W)in KW \"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.6;pg no: 117" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.6, Page:117 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\n", + "cold storage plant can be considered as refrigerator operating between given temperatures limits\n", + "capacity of plant=heat to be extracted=Q2 in KW\n", + "we know that,one ton of refrigeration as 3.52 KW \n", + "so Q2=Q2*3.52 in KW 140.8\n", + "carnot COP of plant(COP_carnot)= 5.18\n", + "performance is 1/4 of its carnot COP\n", + "COP=COP_carnot/4\n", + "also actual COP=Q2/W\n", + "W=Q2/COP in KW\n", + "hence power required(W)in KW 108.76\n" + ] + } + ], + "source": [ + "#cal of power required\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.6, Page:117 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\")\n", + "T1=(-15.+273.15);#inside temperature in K\n", + "T2=(35.+273.);#atmospheric temperature in K\n", + "Q2=40.;#refrigeration capacity of storage plant in tonnes\n", + "print(\"cold storage plant can be considered as refrigerator operating between given temperatures limits\")\n", + "print(\"capacity of plant=heat to be extracted=Q2 in KW\")\n", + "print(\"we know that,one ton of refrigeration as 3.52 KW \")\n", + "Q2=Q2*3.52\n", + "print(\"so Q2=Q2*3.52 in KW\"),round(Q2,2)\n", + "COP_carnot=1/((T2/T1)-1)\n", + "print(\"carnot COP of plant(COP_carnot)=\"),round(COP_carnot,2)\n", + "print(\"performance is 1/4 of its carnot COP\")\n", + "COP=COP_carnot/4\n", + "print(\"COP=COP_carnot/4\")\n", + "print(\"also actual COP=Q2/W\")\n", + "print(\"W=Q2/COP in KW\")\n", + "W=Q2/COP\n", + "print(\"hence power required(W)in KW\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.7;pg no: 117" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.7, Page:117 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\n", + "highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\n", + "n= 0.79\n", + "or n=n*100 % 78.92\n" + ] + } + ], + "source": [ + "#cal of carnot cycle efficiency for given temperature limits\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.7, Page:117 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\")\n", + "T1=(1150.+273.);#temperature of source in K\n", + "T2=(27.+273.);#temperature of sink in K\n", + "print(\"highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\")\n", + "n=1-(T2/T1)\n", + "print(\"n=\"),round(n,2)\n", + "n=n*100\n", + "print(\"or n=n*100 %\"),round(n,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.8;pg no: 117" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.8, Page:117 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\n", + "here heat to be removed continuously from refrigerated space(Q)in KJ/s 0.13\n", + "for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\n", + "W=in KW 0.02\n", + "so power required(W)in KW 0.02\n" + ] + } + ], + "source": [ + "#cal of power required\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.8, Page:117 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\")\n", + "T1=(27.+273.);#temperature of source in K\n", + "T2=(-8.+273.);#temperature of sink in K\n", + "Q=7.5;#heat leakage in KJ/min\n", + "Q=Q/60.\n", + "print(\"here heat to be removed continuously from refrigerated space(Q)in KJ/s\"),round(Q,2)\n", + "print(\"for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\")\n", + "W=Q*((T1/T2)-1)\n", + "print(\"W=in KW\"),round(W,2)\n", + "print(\"so power required(W)in KW\"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.9;pg no: 118" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.9, Page:118 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\n", + "here W1:W2:W3=3:2:1\n", + "efficiency of engine,HE1,\n", + "W1/Q1=(1-(T2/1100))\n", + "so Q1=(1100*W1)/(1100-T2)\n", + "for HE2 engine,W2/Q2=(1-(T3/T2))\n", + "for HE3 engine,W3/Q3=(1-(300/T3))\n", + "from energy balance on engine,HE1\n", + "Q1=W1+Q2=>Q2=Q1-W1\n", + "above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\n", + "substituting Q2 in efficiency of HE2\n", + "W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\n", + "W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\n", + "2/3=(T2-T3)/(1100-T2)\n", + "2200-2*T2=3*T2-3*T3\n", + "5*T2-3*T3=2200\n", + "now energy balance on engine HE2 gives,Q2=W2+Q3\n", + "substituting in efficiency of HE2,\n", + "W2/(W2+Q3)=(T2-T3)/T2\n", + "W2*T2=(W2+Q3)*(T2-T3)\n", + "Q3=(W2*T3)/(T2-T3)\n", + "substituting Q3 in efficiency of HE3,\n", + "W3/((W2*T3)/(T2-T3))=(T3-300)/T3\n", + "W3/W2=(T3/(T2-T3))*(T3-300)/T3\n", + "1/2=(T3-300)/(T2-T3)\n", + "3*T3-T2=600\n", + "solving equations of T2 and T3,\n", + "we get,T3=in K 433.33\n", + "and by eq 5,T2 in K 700.0\n", + "so intermediate temperature are 700 K and 433.33 K\n" + ] + } + ], + "source": [ + "#cal of intermediate temperatures\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.9, Page:118 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\")\n", + "T1=1100;#temperature of high temperature reservoir in K\n", + "T4=300;#temperature of low temperature reservoir in K\n", + "print(\"here W1:W2:W3=3:2:1\")\n", + "print(\"efficiency of engine,HE1,\")\n", + "print(\"W1/Q1=(1-(T2/1100))\")\n", + "print(\"so Q1=(1100*W1)/(1100-T2)\")\n", + "print(\"for HE2 engine,W2/Q2=(1-(T3/T2))\")\n", + "print(\"for HE3 engine,W3/Q3=(1-(300/T3))\")\n", + "print(\"from energy balance on engine,HE1\")\n", + "print(\"Q1=W1+Q2=>Q2=Q1-W1\")\n", + "print(\"above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\")\n", + "print(\"substituting Q2 in efficiency of HE2\")\n", + "print(\"W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\")\n", + "print(\"W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\")\n", + "print(\"2/3=(T2-T3)/(1100-T2)\")\n", + "print(\"2200-2*T2=3*T2-3*T3\")\n", + "print(\"5*T2-3*T3=2200\")\n", + "print(\"now energy balance on engine HE2 gives,Q2=W2+Q3\")\n", + "print(\"substituting in efficiency of HE2,\")\n", + "print(\"W2/(W2+Q3)=(T2-T3)/T2\")\n", + "print(\"W2*T2=(W2+Q3)*(T2-T3)\")\n", + "print(\"Q3=(W2*T3)/(T2-T3)\")\n", + "print(\"substituting Q3 in efficiency of HE3,\")\n", + "print(\"W3/((W2*T3)/(T2-T3))=(T3-300)/T3\")\n", + "print(\"W3/W2=(T3/(T2-T3))*(T3-300)/T3\")\n", + "print(\"1/2=(T3-300)/(T2-T3)\")\n", + "print(\"3*T3-T2=600\")\n", + "print(\"solving equations of T2 and T3,\")\n", + "T3=(600.+(2200./5.))/(3.-(3./5.))\n", + "print(\"we get,T3=in K\"),round(T3,2)\n", + "T2=(2200.+3.*T3)/5.\n", + "print(\"and by eq 5,T2 in K\"),round(T2,2)\n", + "print(\"so intermediate temperature are 700 K and 433.33 K\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.10;pg no: 119" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.10, Page:119 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\n", + "efficiency of engine,W/Q1=(800-T)/800\n", + "for refrigerator,COP=Q3/W=280/(T-280)\n", + "it is given that Q1=Q3=Q\n", + "so,from engine,W/Q=(800-T)/800\n", + "from refrigerator,Q/W=280/(T-280)\n", + "from above two(Q/W)may be equated,\n", + "(T-280)/280=(800-T)/800\n", + "so temperature(T)in K 414.81\n", + "efficiency of engine(n)is given as\n", + "n= 0.48\n", + "COP of refrigerator is given as\n", + "COP= 2.08\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.10, Page:119 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\")\n", + "T1=800.;#temperature of source in K\n", + "T2=280.;#temperature of sink in K\n", + "print(\"efficiency of engine,W/Q1=(800-T)/800\")\n", + "print(\"for refrigerator,COP=Q3/W=280/(T-280)\")\n", + "print(\"it is given that Q1=Q3=Q\")\n", + "print(\"so,from engine,W/Q=(800-T)/800\")\n", + "print(\"from refrigerator,Q/W=280/(T-280)\")\n", + "print(\"from above two(Q/W)may be equated,\")\n", + "print(\"(T-280)/280=(800-T)/800\")\n", + "T=2.*280.*800./(800.+280.)\n", + "print(\"so temperature(T)in K\"),round(T,2)\n", + "print(\"efficiency of engine(n)is given as\")\n", + "n=(800.-T)/800.\n", + "print(\"n=\"),round(n,2)\n", + "print(\"COP of refrigerator is given as\")\n", + "COP=280./(T-280.)\n", + "print(\"COP=\"),round(COP,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.11;pg no: 120" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.11, Page:120 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\n", + "let thermodynamic properties be denoted with respect to salient states;\n", + "n_carnot=1-T1/T2\n", + "so T1/T2=1-0.5\n", + "so T1/T2=0.5\n", + "or T2=2*T1\n", + "corresponding to state 2,p2*v2=m*R*T2\n", + "so temperature(T2) in K= 585.37\n", + "heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\n", + "Q_23=W_23=p2*v2*log(v3/v2)\n", + "so volume(v3) in m^3= 0.1932\n", + "temperature at state 1,T1 in K= 292.68\n", + "during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\n", + "here expansion constant(y)=Cp/Cv\n", + "so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\n", + "p1 in bar\n", + "thus p1*v1=m*R*T1\n", + "so volume(v1) in m^3= 0.68\n", + "heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\n", + "for isentropic process,dQ=0,dW=dU\n", + "during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\n", + "Q_12=0,\n", + "W_12=-105.51 KJ(-ve work)\n", + "during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\n", + "Q_31=0,\n", + "ANS:\n", + "W_34=+105.51 KJ(+ve work)\n", + "so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\n", + "for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\n", + "for process 3-4,heat transfer=0,work interaction=+105.51 KJ\n", + "for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\n", + "maximum temperature of cycle=585.36 KJ\n", + "minimum temperature of cycle=292.68 KJ\n", + "volume at the end of isothermal expansion=0.1932 m^3\n" + ] + } + ], + "source": [ + "#cal of max and min temp of cycle,volume\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "import math\n", + "print\"Example 4.11, Page:120 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\")\n", + "n_carnot=0.5;#efficiency of carnot power cycle\n", + "m=0.5;#mass of air in kg\n", + "p2=7.*10**5;#final pressure in pa\n", + "v2=0.12;#volume in m^3\n", + "R=287.;#gas constant in J/kg K\n", + "Q_23=40.*1000.;#heat transfer to the air during isothermal expansion in J\n", + "Cp=1.008;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.721;#specific heat at constant volume in KJ/kg K\n", + "print(\"let thermodynamic properties be denoted with respect to salient states;\")\n", + "print(\"n_carnot=1-T1/T2\")\n", + "print(\"so T1/T2=1-0.5\")\n", + "1-0.5\n", + "print(\"so T1/T2=0.5\")\n", + "print(\"or T2=2*T1\")\n", + "print(\"corresponding to state 2,p2*v2=m*R*T2\")\n", + "T2=p2*v2/(m*R)\n", + "print(\"so temperature(T2) in K=\"),round(T2,2)\n", + "print(\"heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\")\n", + "print(\"Q_23=W_23=p2*v2*log(v3/v2)\")\n", + "v3=v2*math.exp(Q_23/(p2*v2))\n", + "print(\"so volume(v3) in m^3=\"),round(v3,4)\n", + "T1=T2/2\n", + "print(\"temperature at state 1,T1 in K=\"),round(T1,2)\n", + "print(\"during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\")\n", + "print(\"here expansion constant(y)=Cp/Cv\")\n", + "y=Cp/Cv\n", + "print(\"so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\")\n", + "p1=p2/(T2/T1)**(y/(y-1))\n", + "print(\"p1 in bar\")\n", + "p1=p1/10**5\n", + "print(\"thus p1*v1=m*R*T1\")\n", + "v1=m*R*T1/(p1*10**5)\n", + "print(\"so volume(v1) in m^3=\"),round(v1,2) \n", + "print(\"heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\")\n", + "print(\"for isentropic process,dQ=0,dW=dU\")\n", + "print(\"during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\")\n", + "print(\"Q_12=0,\")\n", + "W_12=-m*Cv*(T2-T1)\n", + "print(\"W_12=-105.51 KJ(-ve work)\")\n", + "print(\"during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\")\n", + "print(\"Q_31=0,\")\n", + "T4=T1;\n", + "T3=T2;\n", + "W_34=-m*Cv*(T4-T3)\n", + "print(\"ANS:\")\n", + "print(\"W_34=+105.51 KJ(+ve work)\")\n", + "print(\"so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\")\n", + "print(\"for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\")\n", + "print(\"for process 3-4,heat transfer=0,work interaction=+105.51 KJ\")\n", + "print(\"for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\")\n", + "print(\"maximum temperature of cycle=585.36 KJ\")\n", + "print(\"minimum temperature of cycle=292.68 KJ\")\n", + "print(\"volume at the end of isothermal expansion=0.1932 m^3\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.12;pg no: 122" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.12, Page:122 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\n", + "let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\n", + "thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\n", + "Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\n", + "Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\n", + "substituting Q1_a and Q1_b in eq 1\n", + "4*Q2/3+2*Q3=5000...............eq4\n", + "also from total work output,Q1_a+Q1_b-Q2-Q3=W\n", + "5000-Q2-Q3=840\n", + "so Q2+Q3=5000-840=4160\n", + "Q3=4160-Q2\n", + "sunstituting Q3 in eq 4\n", + "4*Q2/3+2*(4160-Q2)=5000\n", + "so Q2=in KJ 4980.0\n", + "and Q3= in KJ 820.0\n", + "here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\n", + "Q2=4980 KJ,from heat engine\n", + "Q3=820 KJ,to heat engine\n" + ] + } + ], + "source": [ + "#cal of heat from from heat engine and to heat engine\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.12, Page:122 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\")\n", + "W=840.;#work done by reservoir in KJ\n", + "print(\"let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\")\n", + "print(\"thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\")\n", + "print(\"Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\")\n", + "print(\"Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\")\n", + "print(\"substituting Q1_a and Q1_b in eq 1\")\n", + "print(\"4*Q2/3+2*Q3=5000...............eq4\")\n", + "print(\"also from total work output,Q1_a+Q1_b-Q2-Q3=W\")\n", + "print(\"5000-Q2-Q3=840\")\n", + "print(\"so Q2+Q3=5000-840=4160\")\n", + "print(\"Q3=4160-Q2\")\n", + "print(\"sunstituting Q3 in eq 4\")\n", + "print(\"4*Q2/3+2*(4160-Q2)=5000\")\n", + "Q2=(5000.-2.*4160.)/((4./3.)-2.)\n", + "print(\"so Q2=in KJ\"),round(Q2,2)\n", + "Q3=4160.-Q2\n", + "print(\"and Q3= in KJ\"),round(-Q3,2)\n", + "print(\"here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\")\n", + "print(\"Q2=4980 KJ,from heat engine\")\n", + "print(\"Q3=820 KJ,to heat engine\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.13;pg no: 123" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.13, Page:123 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\n", + "arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\n", + "for heat engine\n", + "ne=W/Q1=1-T2/T1\n", + "so (Q1-Q2)/Q1=\n", + "and Q2/Q1=\n", + "Q2=0.2593*Q1\n", + "for heat pump,\n", + "COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\n", + "Q4/Q3=\n", + "Q4=1.27*Q3\n", + "work output from engine =work input to pump\n", + "Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\n", + "so Q4/Q1=\n", + "so Q4=3.484*Q1\n", + "also it is given that Q2+Q4=100\n", + "subtituting Q2 and Q4 as function of Q1 in following expression,\n", + "Q2+Q4=100\n", + "so 0.2539*Q1+3.484*Q1=100\n", + "so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\n", + "Q1=100/(0.2539+3.484)in KJ 26.75\n", + "NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\n" + ] + } + ], + "source": [ + "#cal of energy taken by engine from reservoir\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.13, Page:123 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\")\n", + "T2=(77+273);#temperature of reservoir 2\n", + "T1=(1077+273);#temperature of reservoir 1\n", + "T3=(3+273);#temperature of reservoir 3\n", + "print(\"arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\")\n", + "print(\"for heat engine\")\n", + "print(\"ne=W/Q1=1-T2/T1\")\n", + "print(\"so (Q1-Q2)/Q1=\")\n", + "1-T2/T1\n", + "print(\"and Q2/Q1=\")\n", + "1-0.7407\n", + "print(\"Q2=0.2593*Q1\")\n", + "print(\"for heat pump,\")\n", + "print(\"COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\")\n", + "T4=T2;\n", + "T4/(T4-T3)\n", + "print(\"Q4/Q3=\")\n", + "4.73/3.73\n", + "print(\"Q4=1.27*Q3\")\n", + "print(\"work output from engine =work input to pump\")\n", + "print(\"Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\")\n", + "print(\"so Q4/Q1=\")\n", + "(1-0.2593)/(1-(1/1.27))\n", + "print(\"so Q4=3.484*Q1\")\n", + "print(\"also it is given that Q2+Q4=100\")\n", + "print(\"subtituting Q2 and Q4 as function of Q1 in following expression,\")\n", + "print(\"Q2+Q4=100\")\n", + "print(\"so 0.2539*Q1+3.484*Q1=100\")\n", + "print(\"so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\")\n", + "Q1=100/(0.2539+3.484)\n", + "print(\"Q1=100/(0.2539+3.484)in KJ\"),round(Q1,2)\n", + "print(\"NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.14;pg no: 124" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.14, Page:124 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\n", + "let temperature of sink be T_sink K\n", + "Q_sink_HE+Q_sink_R=3000 ........eq 1\n", + "since complete work output from engine is used to run refrigerator so,\n", + "2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\n", + "by eq 1 and eq 2,we get Q_R in KJ/s 1000.0\n", + "also for heat engine,2000/1500=Q_sink_HE/T_sink\n", + "=>Q_sink_HE=4*T_sink/3\n", + "for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\n", + "substituting Q_sink_HE and Q_sink_R values\n", + "4*T_sink/3+1000*T_sink/288=3000\n", + "so temperature of sink(T_sink)in K\n", + "so T_sink= 750.0\n", + "T_sink in degree celcius 477.0\n" + ] + } + ], + "source": [ + "#cal of T_sink in degree celcius\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.14, Page:124 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\")\n", + "Q_source=2000;#heat supplied by heat engine in KJ/s\n", + "T_source=1500;#temperature of source in K\n", + "T_R=(15+273);#temperature of reservoir in K\n", + "Q_sink=3000;#heat received by sink in KJ/s\n", + "print(\"let temperature of sink be T_sink K\")\n", + "print(\"Q_sink_HE+Q_sink_R=3000 ........eq 1\")\n", + "print(\"since complete work output from engine is used to run refrigerator so,\")\n", + "print(\"2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\")\n", + "Q_R=3000-2000\n", + "print(\"by eq 1 and eq 2,we get Q_R in KJ/s\"),round(Q_R)\n", + "print(\"also for heat engine,2000/1500=Q_sink_HE/T_sink\")\n", + "print(\"=>Q_sink_HE=4*T_sink/3\")\n", + "print(\"for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\")\n", + "print(\"substituting Q_sink_HE and Q_sink_R values\")\n", + "print(\"4*T_sink/3+1000*T_sink/288=3000\")\n", + "print(\"so temperature of sink(T_sink)in K\")\n", + "T_sink=3000/((4/3)+(1000/288))\n", + "print(\"so T_sink=\"),round(T_sink,2)\n", + "T_sink=T_sink-273\n", + "print(\"T_sink in degree celcius\"),round(T_sink,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.15;pg no: 124" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.15, Page:124 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\n", + "let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\n", + "n=W/Q1= 0.39\n", + "so n=W/Q1=0.3881\n", + "COP of heat pump=T3/(T3-T2)=Q3/(2*W/3) 2.89\n", + "so 2.892=3*Q3/2*W\n", + "Q3/Q1= 0.7483\n", + "so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\n" + ] + } + ], + "source": [ + "#cal of heat transferred to refrigerant and low temperature reservoir\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.15, Page:124 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\")\n", + "T1=(500.+273.);#temperature of source in K\n", + "T2=(200.+273.);#temperature of sink in K\n", + "T3=(450.+273.);#temperature of body in K\n", + "print(\"let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\")\n", + "n=1-(T2/T1)\n", + "print(\"n=W/Q1=\"),round(n,2)\n", + "print(\"so n=W/Q1=0.3881\")\n", + "COP=T3/(T3-T2)\n", + "print(\"COP of heat pump=T3/(T3-T2)=Q3/(2*W/3)\"),round(COP,2)\n", + "print(\"so 2.892=3*Q3/2*W\")\n", + "print(\"Q3/Q1=\"),round(2*COP*n/3,4)\n", + "print(\"so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.16;pg no: 125" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.16, Page:125 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\n", + "NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.16, Page:125 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\")\n", + "print(\"NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.17;pg no: 126" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.17, Page:126 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\n", + "NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.17, Page:126 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\")\n", + "print(\"NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter4_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter4_2.ipynb new file mode 100755 index 00000000..bb4a3703 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter4_2.ipynb @@ -0,0 +1,1070 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4:Second Law of Thermo Dynamics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.1;pg no: 113" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.1, Page:113 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\n", + "NOTE=>This question is fully theoritical hence cannot be solve using scilab.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.1, Page:113 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\")\n", + "print(\"NOTE=>This question is fully theoritical hence cannot be solve using scilab.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.2;pg no: 114" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.2, Page:114 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\n", + "in carnot engine from thermodynamics temperature scale\n", + "Q1/Q2=T1/T2\n", + "W=Q1-Q2=200 KJ\n", + "from above equations Q1 in KJ is given by\n", + "Q1= 349.61\n", + "and Q2 in KJ\n", + "Q2=Q1-200 149.61\n", + "so heat supplied(Q1) in KJ 349.6\n" + ] + } + ], + "source": [ + "#cal of heat supplied\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.2, Page:114 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\")\n", + "T1=(400.+273.);#temperature of source in K\n", + "T2=(15.+273.);#temperature of sink in K\n", + "W=200.;#work done in KJ\n", + "print(\"in carnot engine from thermodynamics temperature scale\")\n", + "print(\"Q1/Q2=T1/T2\")\n", + "print(\"W=Q1-Q2=200 KJ\")\n", + "print(\"from above equations Q1 in KJ is given by\")\n", + "Q1=(200*T1)/(T1-T2)\n", + "print(\"Q1=\"),round(Q1,2)\n", + "print(\"and Q2 in KJ\")\n", + "Q2=Q1-200\n", + "print(\"Q2=Q1-200\"),round(Q2,2)\n", + "print(\"so heat supplied(Q1) in KJ\"),round(Q1,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.3;pg no: 115" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.3, Page:115 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\n", + "from thermodynamic temperature scale\n", + "Q1/Q2=T1/T2\n", + "so Q1=Q2*(T1/T2)in KJ/s 2.27\n", + "power/work input required(W)=Q1-Q2 in KJ/s \n", + "power required for driving refrigerator=W in KW 0.274\n" + ] + } + ], + "source": [ + "#cal of power required for driving refrigerator\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.3, Page:115 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\")\n", + "T1=315.;#temperature of reservoir 1 in K\n", + "T2=277.;#temperature of reservoir 2 in K\n", + "Q2=2.;#heat extracted in KJ/s\n", + "print(\"from thermodynamic temperature scale\")\n", + "print(\"Q1/Q2=T1/T2\")\n", + "Q1=Q2*(T1/T2)\n", + "print(\"so Q1=Q2*(T1/T2)in KJ/s\"),round(Q1,2)\n", + "print(\"power/work input required(W)=Q1-Q2 in KJ/s \")\n", + "W=Q1-Q2\n", + "print(\"power required for driving refrigerator=W in KW\"),round(W,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.4;pg no: 115" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.4, Page:115 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\n", + "we can writefor heat engine,Q1/Q2=T1/T2\n", + "so Q2=Q1*(T2/T1) in KJ 545.45\n", + "so We=in KJ 1454.55\n", + "for refrigerator,Q3/Q4=T3/T4 eq 1\n", + "now We-Wr=300\n", + "so Wr=We-300 in KJ 1154.55\n", + "and Wr=Q4-Q3=1154.55 KJ eq 2 \n", + "solving eq1 and eq 2 we get\n", + "Q4=in KJ 8659.13\n", + "and Q3=in KJ 7504.58\n", + "total heat transferred to low teperature reservoir(Q)=in KJ 9204.58\n", + "hence heat transferred to refrigerant=Q3 in KJ 7504.58\n", + "and heat transferred to low temperature reservoir=Q in KJ 9204.58\n" + ] + } + ], + "source": [ + "#cal of heat transferred to refrigerant and low temperature reservoir\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.4, Page:115 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\")\n", + "T1=(827.+273.);#temperature of high temperature reservoir in K\n", + "T2=(27.+273.);#temperature of low temperature reservoir in K\n", + "T3=(-13.+273.);#temperature of reservoir 3 in K\n", + "Q1=2000.;#heat ejected by reservoir 1 in KJ\n", + "print(\"we can writefor heat engine,Q1/Q2=T1/T2\")\n", + "Q2=Q1*(T2/T1)\n", + "print(\"so Q2=Q1*(T2/T1) in KJ\"),round(Q2,2)\n", + "We=Q1-Q2\n", + "print(\"so We=in KJ\"),round(We,2)\n", + "print(\"for refrigerator,Q3/Q4=T3/T4 eq 1\")\n", + "T4=T2;#temperature of low temperature reservoir in K\n", + "print(\"now We-Wr=300\")\n", + "Wr=We-300.\n", + "print(\"so Wr=We-300 in KJ\"),round(Wr,2)\n", + "print(\"and Wr=Q4-Q3=1154.55 KJ eq 2 \")\n", + "print(\"solving eq1 and eq 2 we get\")\n", + "Q4=(1154.55*T4)/(T4-T3)\n", + "print(\"Q4=in KJ\"),round(Q4,2)\n", + "Q3=Q4-Wr\n", + "print(\"and Q3=in KJ\"),round(Q3,2)\n", + "Q=Q2+Q4\n", + "print(\"total heat transferred to low teperature reservoir(Q)=in KJ\"),round(Q,2)\n", + "print(\"hence heat transferred to refrigerant=Q3 in KJ\"),round(Q3,2)\n", + "print(\"and heat transferred to low temperature reservoir=Q in KJ\"),round(Q,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.5;pg no: 116" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.5, Page:116 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\n", + "COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\n", + "also we know K=Q1/Q2=T1/T2\n", + "so K=T1/T2 1.1\n", + "so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K)) 11.0\n", + "also COP_HP=Q1/W\n", + "W=Q1/COin MJ/Hr 3.03\n", + "or W=1000*W/3600 in KW 3.03\n", + "so minimum power required(W)in KW 3.03\n" + ] + } + ], + "source": [ + "#cal of minimum power required\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.5, Page:116 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\")\n", + "T1=(25+273.15);#temperature of inside of house in K\n", + "T2=(-1+273.15);#outside temperature in K\n", + "Q1=125;#heating load in MJ/Hr\n", + "print(\"COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\")\n", + "print(\"also we know K=Q1/Q2=T1/T2\")\n", + "K=T1/T2\n", + "print(\"so K=T1/T2\"),round(K,2)\n", + "COP_HP=1/(1-(1/K))\n", + "print(\"so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K))\"),round(COP_HP)\n", + "print(\"also COP_HP=Q1/W\")\n", + "W=Q1/COP_HP\n", + "W=1000*W/3600\n", + "print(\"W=Q1/COin MJ/Hr\"),round(W,2)\n", + "print(\"or W=1000*W/3600 in KW\"),round(W,2)\n", + "print(\"so minimum power required(W)in KW \"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.6;pg no: 117" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.6, Page:117 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\n", + "cold storage plant can be considered as refrigerator operating between given temperatures limits\n", + "capacity of plant=heat to be extracted=Q2 in KW\n", + "we know that,one ton of refrigeration as 3.52 KW \n", + "so Q2=Q2*3.52 in KW 140.8\n", + "carnot COP of plant(COP_carnot)= 5.18\n", + "performance is 1/4 of its carnot COP\n", + "COP=COP_carnot/4\n", + "also actual COP=Q2/W\n", + "W=Q2/COP in KW\n", + "hence power required(W)in KW 108.76\n" + ] + } + ], + "source": [ + "#cal of power required\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.6, Page:117 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\")\n", + "T1=(-15.+273.15);#inside temperature in K\n", + "T2=(35.+273.);#atmospheric temperature in K\n", + "Q2=40.;#refrigeration capacity of storage plant in tonnes\n", + "print(\"cold storage plant can be considered as refrigerator operating between given temperatures limits\")\n", + "print(\"capacity of plant=heat to be extracted=Q2 in KW\")\n", + "print(\"we know that,one ton of refrigeration as 3.52 KW \")\n", + "Q2=Q2*3.52\n", + "print(\"so Q2=Q2*3.52 in KW\"),round(Q2,2)\n", + "COP_carnot=1/((T2/T1)-1)\n", + "print(\"carnot COP of plant(COP_carnot)=\"),round(COP_carnot,2)\n", + "print(\"performance is 1/4 of its carnot COP\")\n", + "COP=COP_carnot/4\n", + "print(\"COP=COP_carnot/4\")\n", + "print(\"also actual COP=Q2/W\")\n", + "print(\"W=Q2/COP in KW\")\n", + "W=Q2/COP\n", + "print(\"hence power required(W)in KW\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.7;pg no: 117" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.7, Page:117 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\n", + "highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\n", + "n= 0.79\n", + "or n=n*100 % 78.92\n" + ] + } + ], + "source": [ + "#cal of carnot cycle efficiency for given temperature limits\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.7, Page:117 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\")\n", + "T1=(1150.+273.);#temperature of source in K\n", + "T2=(27.+273.);#temperature of sink in K\n", + "print(\"highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\")\n", + "n=1-(T2/T1)\n", + "print(\"n=\"),round(n,2)\n", + "n=n*100\n", + "print(\"or n=n*100 %\"),round(n,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.8;pg no: 117" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.8, Page:117 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\n", + "here heat to be removed continuously from refrigerated space(Q)in KJ/s 0.13\n", + "for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\n", + "W=in KW 0.02\n", + "so power required(W)in KW 0.02\n" + ] + } + ], + "source": [ + "#cal of power required\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.8, Page:117 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\")\n", + "T1=(27.+273.);#temperature of source in K\n", + "T2=(-8.+273.);#temperature of sink in K\n", + "Q=7.5;#heat leakage in KJ/min\n", + "Q=Q/60.\n", + "print(\"here heat to be removed continuously from refrigerated space(Q)in KJ/s\"),round(Q,2)\n", + "print(\"for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\")\n", + "W=Q*((T1/T2)-1)\n", + "print(\"W=in KW\"),round(W,2)\n", + "print(\"so power required(W)in KW\"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.9;pg no: 118" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.9, Page:118 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\n", + "here W1:W2:W3=3:2:1\n", + "efficiency of engine,HE1,\n", + "W1/Q1=(1-(T2/1100))\n", + "so Q1=(1100*W1)/(1100-T2)\n", + "for HE2 engine,W2/Q2=(1-(T3/T2))\n", + "for HE3 engine,W3/Q3=(1-(300/T3))\n", + "from energy balance on engine,HE1\n", + "Q1=W1+Q2=>Q2=Q1-W1\n", + "above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\n", + "substituting Q2 in efficiency of HE2\n", + "W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\n", + "W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\n", + "2/3=(T2-T3)/(1100-T2)\n", + "2200-2*T2=3*T2-3*T3\n", + "5*T2-3*T3=2200\n", + "now energy balance on engine HE2 gives,Q2=W2+Q3\n", + "substituting in efficiency of HE2,\n", + "W2/(W2+Q3)=(T2-T3)/T2\n", + "W2*T2=(W2+Q3)*(T2-T3)\n", + "Q3=(W2*T3)/(T2-T3)\n", + "substituting Q3 in efficiency of HE3,\n", + "W3/((W2*T3)/(T2-T3))=(T3-300)/T3\n", + "W3/W2=(T3/(T2-T3))*(T3-300)/T3\n", + "1/2=(T3-300)/(T2-T3)\n", + "3*T3-T2=600\n", + "solving equations of T2 and T3,\n", + "we get,T3=in K 433.33\n", + "and by eq 5,T2 in K 700.0\n", + "so intermediate temperature are 700 K and 433.33 K\n" + ] + } + ], + "source": [ + "#cal of intermediate temperatures\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.9, Page:118 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\")\n", + "T1=1100;#temperature of high temperature reservoir in K\n", + "T4=300;#temperature of low temperature reservoir in K\n", + "print(\"here W1:W2:W3=3:2:1\")\n", + "print(\"efficiency of engine,HE1,\")\n", + "print(\"W1/Q1=(1-(T2/1100))\")\n", + "print(\"so Q1=(1100*W1)/(1100-T2)\")\n", + "print(\"for HE2 engine,W2/Q2=(1-(T3/T2))\")\n", + "print(\"for HE3 engine,W3/Q3=(1-(300/T3))\")\n", + "print(\"from energy balance on engine,HE1\")\n", + "print(\"Q1=W1+Q2=>Q2=Q1-W1\")\n", + "print(\"above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\")\n", + "print(\"substituting Q2 in efficiency of HE2\")\n", + "print(\"W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\")\n", + "print(\"W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\")\n", + "print(\"2/3=(T2-T3)/(1100-T2)\")\n", + "print(\"2200-2*T2=3*T2-3*T3\")\n", + "print(\"5*T2-3*T3=2200\")\n", + "print(\"now energy balance on engine HE2 gives,Q2=W2+Q3\")\n", + "print(\"substituting in efficiency of HE2,\")\n", + "print(\"W2/(W2+Q3)=(T2-T3)/T2\")\n", + "print(\"W2*T2=(W2+Q3)*(T2-T3)\")\n", + "print(\"Q3=(W2*T3)/(T2-T3)\")\n", + "print(\"substituting Q3 in efficiency of HE3,\")\n", + "print(\"W3/((W2*T3)/(T2-T3))=(T3-300)/T3\")\n", + "print(\"W3/W2=(T3/(T2-T3))*(T3-300)/T3\")\n", + "print(\"1/2=(T3-300)/(T2-T3)\")\n", + "print(\"3*T3-T2=600\")\n", + "print(\"solving equations of T2 and T3,\")\n", + "T3=(600.+(2200./5.))/(3.-(3./5.))\n", + "print(\"we get,T3=in K\"),round(T3,2)\n", + "T2=(2200.+3.*T3)/5.\n", + "print(\"and by eq 5,T2 in K\"),round(T2,2)\n", + "print(\"so intermediate temperature are 700 K and 433.33 K\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.10;pg no: 119" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.10, Page:119 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\n", + "efficiency of engine,W/Q1=(800-T)/800\n", + "for refrigerator,COP=Q3/W=280/(T-280)\n", + "it is given that Q1=Q3=Q\n", + "so,from engine,W/Q=(800-T)/800\n", + "from refrigerator,Q/W=280/(T-280)\n", + "from above two(Q/W)may be equated,\n", + "(T-280)/280=(800-T)/800\n", + "so temperature(T)in K 414.81\n", + "efficiency of engine(n)is given as\n", + "n= 0.48\n", + "COP of refrigerator is given as\n", + "COP= 2.08\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.10, Page:119 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\")\n", + "T1=800.;#temperature of source in K\n", + "T2=280.;#temperature of sink in K\n", + "print(\"efficiency of engine,W/Q1=(800-T)/800\")\n", + "print(\"for refrigerator,COP=Q3/W=280/(T-280)\")\n", + "print(\"it is given that Q1=Q3=Q\")\n", + "print(\"so,from engine,W/Q=(800-T)/800\")\n", + "print(\"from refrigerator,Q/W=280/(T-280)\")\n", + "print(\"from above two(Q/W)may be equated,\")\n", + "print(\"(T-280)/280=(800-T)/800\")\n", + "T=2.*280.*800./(800.+280.)\n", + "print(\"so temperature(T)in K\"),round(T,2)\n", + "print(\"efficiency of engine(n)is given as\")\n", + "n=(800.-T)/800.\n", + "print(\"n=\"),round(n,2)\n", + "print(\"COP of refrigerator is given as\")\n", + "COP=280./(T-280.)\n", + "print(\"COP=\"),round(COP,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.11;pg no: 120" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.11, Page:120 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\n", + "let thermodynamic properties be denoted with respect to salient states;\n", + "n_carnot=1-T1/T2\n", + "so T1/T2=1-0.5\n", + "so T1/T2=0.5\n", + "or T2=2*T1\n", + "corresponding to state 2,p2*v2=m*R*T2\n", + "so temperature(T2) in K= 585.37\n", + "heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\n", + "Q_23=W_23=p2*v2*log(v3/v2)\n", + "so volume(v3) in m^3= 0.1932\n", + "temperature at state 1,T1 in K= 292.68\n", + "during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\n", + "here expansion constant(y)=Cp/Cv\n", + "so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\n", + "p1 in bar\n", + "thus p1*v1=m*R*T1\n", + "so volume(v1) in m^3= 0.68\n", + "heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\n", + "for isentropic process,dQ=0,dW=dU\n", + "during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\n", + "Q_12=0,\n", + "W_12=-105.51 KJ(-ve work)\n", + "during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\n", + "Q_31=0,\n", + "ANS:\n", + "W_34=+105.51 KJ(+ve work)\n", + "so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\n", + "for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\n", + "for process 3-4,heat transfer=0,work interaction=+105.51 KJ\n", + "for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\n", + "maximum temperature of cycle=585.36 KJ\n", + "minimum temperature of cycle=292.68 KJ\n", + "volume at the end of isothermal expansion=0.1932 m^3\n" + ] + } + ], + "source": [ + "#cal of max and min temp of cycle,volume\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "import math\n", + "print\"Example 4.11, Page:120 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\")\n", + "n_carnot=0.5;#efficiency of carnot power cycle\n", + "m=0.5;#mass of air in kg\n", + "p2=7.*10**5;#final pressure in pa\n", + "v2=0.12;#volume in m^3\n", + "R=287.;#gas constant in J/kg K\n", + "Q_23=40.*1000.;#heat transfer to the air during isothermal expansion in J\n", + "Cp=1.008;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.721;#specific heat at constant volume in KJ/kg K\n", + "print(\"let thermodynamic properties be denoted with respect to salient states;\")\n", + "print(\"n_carnot=1-T1/T2\")\n", + "print(\"so T1/T2=1-0.5\")\n", + "1-0.5\n", + "print(\"so T1/T2=0.5\")\n", + "print(\"or T2=2*T1\")\n", + "print(\"corresponding to state 2,p2*v2=m*R*T2\")\n", + "T2=p2*v2/(m*R)\n", + "print(\"so temperature(T2) in K=\"),round(T2,2)\n", + "print(\"heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\")\n", + "print(\"Q_23=W_23=p2*v2*log(v3/v2)\")\n", + "v3=v2*math.exp(Q_23/(p2*v2))\n", + "print(\"so volume(v3) in m^3=\"),round(v3,4)\n", + "T1=T2/2\n", + "print(\"temperature at state 1,T1 in K=\"),round(T1,2)\n", + "print(\"during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\")\n", + "print(\"here expansion constant(y)=Cp/Cv\")\n", + "y=Cp/Cv\n", + "print(\"so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\")\n", + "p1=p2/(T2/T1)**(y/(y-1))\n", + "print(\"p1 in bar\")\n", + "p1=p1/10**5\n", + "print(\"thus p1*v1=m*R*T1\")\n", + "v1=m*R*T1/(p1*10**5)\n", + "print(\"so volume(v1) in m^3=\"),round(v1,2) \n", + "print(\"heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\")\n", + "print(\"for isentropic process,dQ=0,dW=dU\")\n", + "print(\"during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\")\n", + "print(\"Q_12=0,\")\n", + "W_12=-m*Cv*(T2-T1)\n", + "print(\"W_12=-105.51 KJ(-ve work)\")\n", + "print(\"during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\")\n", + "print(\"Q_31=0,\")\n", + "T4=T1;\n", + "T3=T2;\n", + "W_34=-m*Cv*(T4-T3)\n", + "print(\"ANS:\")\n", + "print(\"W_34=+105.51 KJ(+ve work)\")\n", + "print(\"so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\")\n", + "print(\"for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\")\n", + "print(\"for process 3-4,heat transfer=0,work interaction=+105.51 KJ\")\n", + "print(\"for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\")\n", + "print(\"maximum temperature of cycle=585.36 KJ\")\n", + "print(\"minimum temperature of cycle=292.68 KJ\")\n", + "print(\"volume at the end of isothermal expansion=0.1932 m^3\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.12;pg no: 122" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.12, Page:122 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\n", + "let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\n", + "thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\n", + "Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\n", + "Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\n", + "substituting Q1_a and Q1_b in eq 1\n", + "4*Q2/3+2*Q3=5000...............eq4\n", + "also from total work output,Q1_a+Q1_b-Q2-Q3=W\n", + "5000-Q2-Q3=840\n", + "so Q2+Q3=5000-840=4160\n", + "Q3=4160-Q2\n", + "sunstituting Q3 in eq 4\n", + "4*Q2/3+2*(4160-Q2)=5000\n", + "so Q2=in KJ 4980.0\n", + "and Q3= in KJ 820.0\n", + "here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\n", + "Q2=4980 KJ,from heat engine\n", + "Q3=820 KJ,to heat engine\n" + ] + } + ], + "source": [ + "#cal of heat from from heat engine and to heat engine\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.12, Page:122 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\")\n", + "W=840.;#work done by reservoir in KJ\n", + "print(\"let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\")\n", + "print(\"thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\")\n", + "print(\"Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\")\n", + "print(\"Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\")\n", + "print(\"substituting Q1_a and Q1_b in eq 1\")\n", + "print(\"4*Q2/3+2*Q3=5000...............eq4\")\n", + "print(\"also from total work output,Q1_a+Q1_b-Q2-Q3=W\")\n", + "print(\"5000-Q2-Q3=840\")\n", + "print(\"so Q2+Q3=5000-840=4160\")\n", + "print(\"Q3=4160-Q2\")\n", + "print(\"sunstituting Q3 in eq 4\")\n", + "print(\"4*Q2/3+2*(4160-Q2)=5000\")\n", + "Q2=(5000.-2.*4160.)/((4./3.)-2.)\n", + "print(\"so Q2=in KJ\"),round(Q2,2)\n", + "Q3=4160.-Q2\n", + "print(\"and Q3= in KJ\"),round(-Q3,2)\n", + "print(\"here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\")\n", + "print(\"Q2=4980 KJ,from heat engine\")\n", + "print(\"Q3=820 KJ,to heat engine\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.13;pg no: 123" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.13, Page:123 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\n", + "arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\n", + "for heat engine\n", + "ne=W/Q1=1-T2/T1\n", + "so (Q1-Q2)/Q1=\n", + "and Q2/Q1=\n", + "Q2=0.2593*Q1\n", + "for heat pump,\n", + "COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\n", + "Q4/Q3=\n", + "Q4=1.27*Q3\n", + "work output from engine =work input to pump\n", + "Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\n", + "so Q4/Q1=\n", + "so Q4=3.484*Q1\n", + "also it is given that Q2+Q4=100\n", + "subtituting Q2 and Q4 as function of Q1 in following expression,\n", + "Q2+Q4=100\n", + "so 0.2539*Q1+3.484*Q1=100\n", + "so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\n", + "Q1=100/(0.2539+3.484)in KJ 26.75\n", + "NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\n" + ] + } + ], + "source": [ + "#cal of energy taken by engine from reservoir\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.13, Page:123 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\")\n", + "T2=(77+273);#temperature of reservoir 2\n", + "T1=(1077+273);#temperature of reservoir 1\n", + "T3=(3+273);#temperature of reservoir 3\n", + "print(\"arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\")\n", + "print(\"for heat engine\")\n", + "print(\"ne=W/Q1=1-T2/T1\")\n", + "print(\"so (Q1-Q2)/Q1=\")\n", + "1-T2/T1\n", + "print(\"and Q2/Q1=\")\n", + "1-0.7407\n", + "print(\"Q2=0.2593*Q1\")\n", + "print(\"for heat pump,\")\n", + "print(\"COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\")\n", + "T4=T2;\n", + "T4/(T4-T3)\n", + "print(\"Q4/Q3=\")\n", + "4.73/3.73\n", + "print(\"Q4=1.27*Q3\")\n", + "print(\"work output from engine =work input to pump\")\n", + "print(\"Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\")\n", + "print(\"so Q4/Q1=\")\n", + "(1-0.2593)/(1-(1/1.27))\n", + "print(\"so Q4=3.484*Q1\")\n", + "print(\"also it is given that Q2+Q4=100\")\n", + "print(\"subtituting Q2 and Q4 as function of Q1 in following expression,\")\n", + "print(\"Q2+Q4=100\")\n", + "print(\"so 0.2539*Q1+3.484*Q1=100\")\n", + "print(\"so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\")\n", + "Q1=100/(0.2539+3.484)\n", + "print(\"Q1=100/(0.2539+3.484)in KJ\"),round(Q1,2)\n", + "print(\"NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.14;pg no: 124" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.14, Page:124 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\n", + "let temperature of sink be T_sink K\n", + "Q_sink_HE+Q_sink_R=3000 ........eq 1\n", + "since complete work output from engine is used to run refrigerator so,\n", + "2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\n", + "by eq 1 and eq 2,we get Q_R in KJ/s 1000.0\n", + "also for heat engine,2000/1500=Q_sink_HE/T_sink\n", + "=>Q_sink_HE=4*T_sink/3\n", + "for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\n", + "substituting Q_sink_HE and Q_sink_R values\n", + "4*T_sink/3+1000*T_sink/288=3000\n", + "so temperature of sink(T_sink)in K\n", + "so T_sink= 750.0\n", + "T_sink in degree celcius 477.0\n" + ] + } + ], + "source": [ + "#cal of T_sink in degree celcius\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.14, Page:124 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\")\n", + "Q_source=2000;#heat supplied by heat engine in KJ/s\n", + "T_source=1500;#temperature of source in K\n", + "T_R=(15+273);#temperature of reservoir in K\n", + "Q_sink=3000;#heat received by sink in KJ/s\n", + "print(\"let temperature of sink be T_sink K\")\n", + "print(\"Q_sink_HE+Q_sink_R=3000 ........eq 1\")\n", + "print(\"since complete work output from engine is used to run refrigerator so,\")\n", + "print(\"2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\")\n", + "Q_R=3000-2000\n", + "print(\"by eq 1 and eq 2,we get Q_R in KJ/s\"),round(Q_R)\n", + "print(\"also for heat engine,2000/1500=Q_sink_HE/T_sink\")\n", + "print(\"=>Q_sink_HE=4*T_sink/3\")\n", + "print(\"for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\")\n", + "print(\"substituting Q_sink_HE and Q_sink_R values\")\n", + "print(\"4*T_sink/3+1000*T_sink/288=3000\")\n", + "print(\"so temperature of sink(T_sink)in K\")\n", + "T_sink=3000/((4/3)+(1000/288))\n", + "print(\"so T_sink=\"),round(T_sink,2)\n", + "T_sink=T_sink-273\n", + "print(\"T_sink in degree celcius\"),round(T_sink,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.15;pg no: 124" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.15, Page:124 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\n", + "let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\n", + "n=W/Q1= 0.39\n", + "so n=W/Q1=0.3881\n", + "COP of heat pump=T3/(T3-T2)=Q3/(2*W/3) 2.89\n", + "so 2.892=3*Q3/2*W\n", + "Q3/Q1= 0.7483\n", + "so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\n" + ] + } + ], + "source": [ + "#cal of heat transferred to refrigerant and low temperature reservoir\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.15, Page:124 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\")\n", + "T1=(500.+273.);#temperature of source in K\n", + "T2=(200.+273.);#temperature of sink in K\n", + "T3=(450.+273.);#temperature of body in K\n", + "print(\"let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\")\n", + "n=1-(T2/T1)\n", + "print(\"n=W/Q1=\"),round(n,2)\n", + "print(\"so n=W/Q1=0.3881\")\n", + "COP=T3/(T3-T2)\n", + "print(\"COP of heat pump=T3/(T3-T2)=Q3/(2*W/3)\"),round(COP,2)\n", + "print(\"so 2.892=3*Q3/2*W\")\n", + "print(\"Q3/Q1=\"),round(2*COP*n/3,4)\n", + "print(\"so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.16;pg no: 125" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.16, Page:125 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\n", + "NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.16, Page:125 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\")\n", + "print(\"NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.17;pg no: 126" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.17, Page:126 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\n", + "NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.17, Page:126 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\")\n", + "print(\"NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter4_3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter4_3.ipynb new file mode 100755 index 00000000..bb4a3703 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter4_3.ipynb @@ -0,0 +1,1070 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4:Second Law of Thermo Dynamics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.1;pg no: 113" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.1, Page:113 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\n", + "NOTE=>This question is fully theoritical hence cannot be solve using scilab.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.1, Page:113 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\")\n", + "print(\"NOTE=>This question is fully theoritical hence cannot be solve using scilab.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.2;pg no: 114" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.2, Page:114 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\n", + "in carnot engine from thermodynamics temperature scale\n", + "Q1/Q2=T1/T2\n", + "W=Q1-Q2=200 KJ\n", + "from above equations Q1 in KJ is given by\n", + "Q1= 349.61\n", + "and Q2 in KJ\n", + "Q2=Q1-200 149.61\n", + "so heat supplied(Q1) in KJ 349.6\n" + ] + } + ], + "source": [ + "#cal of heat supplied\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.2, Page:114 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\")\n", + "T1=(400.+273.);#temperature of source in K\n", + "T2=(15.+273.);#temperature of sink in K\n", + "W=200.;#work done in KJ\n", + "print(\"in carnot engine from thermodynamics temperature scale\")\n", + "print(\"Q1/Q2=T1/T2\")\n", + "print(\"W=Q1-Q2=200 KJ\")\n", + "print(\"from above equations Q1 in KJ is given by\")\n", + "Q1=(200*T1)/(T1-T2)\n", + "print(\"Q1=\"),round(Q1,2)\n", + "print(\"and Q2 in KJ\")\n", + "Q2=Q1-200\n", + "print(\"Q2=Q1-200\"),round(Q2,2)\n", + "print(\"so heat supplied(Q1) in KJ\"),round(Q1,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.3;pg no: 115" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.3, Page:115 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\n", + "from thermodynamic temperature scale\n", + "Q1/Q2=T1/T2\n", + "so Q1=Q2*(T1/T2)in KJ/s 2.27\n", + "power/work input required(W)=Q1-Q2 in KJ/s \n", + "power required for driving refrigerator=W in KW 0.274\n" + ] + } + ], + "source": [ + "#cal of power required for driving refrigerator\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.3, Page:115 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\")\n", + "T1=315.;#temperature of reservoir 1 in K\n", + "T2=277.;#temperature of reservoir 2 in K\n", + "Q2=2.;#heat extracted in KJ/s\n", + "print(\"from thermodynamic temperature scale\")\n", + "print(\"Q1/Q2=T1/T2\")\n", + "Q1=Q2*(T1/T2)\n", + "print(\"so Q1=Q2*(T1/T2)in KJ/s\"),round(Q1,2)\n", + "print(\"power/work input required(W)=Q1-Q2 in KJ/s \")\n", + "W=Q1-Q2\n", + "print(\"power required for driving refrigerator=W in KW\"),round(W,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.4;pg no: 115" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.4, Page:115 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\n", + "we can writefor heat engine,Q1/Q2=T1/T2\n", + "so Q2=Q1*(T2/T1) in KJ 545.45\n", + "so We=in KJ 1454.55\n", + "for refrigerator,Q3/Q4=T3/T4 eq 1\n", + "now We-Wr=300\n", + "so Wr=We-300 in KJ 1154.55\n", + "and Wr=Q4-Q3=1154.55 KJ eq 2 \n", + "solving eq1 and eq 2 we get\n", + "Q4=in KJ 8659.13\n", + "and Q3=in KJ 7504.58\n", + "total heat transferred to low teperature reservoir(Q)=in KJ 9204.58\n", + "hence heat transferred to refrigerant=Q3 in KJ 7504.58\n", + "and heat transferred to low temperature reservoir=Q in KJ 9204.58\n" + ] + } + ], + "source": [ + "#cal of heat transferred to refrigerant and low temperature reservoir\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.4, Page:115 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\")\n", + "T1=(827.+273.);#temperature of high temperature reservoir in K\n", + "T2=(27.+273.);#temperature of low temperature reservoir in K\n", + "T3=(-13.+273.);#temperature of reservoir 3 in K\n", + "Q1=2000.;#heat ejected by reservoir 1 in KJ\n", + "print(\"we can writefor heat engine,Q1/Q2=T1/T2\")\n", + "Q2=Q1*(T2/T1)\n", + "print(\"so Q2=Q1*(T2/T1) in KJ\"),round(Q2,2)\n", + "We=Q1-Q2\n", + "print(\"so We=in KJ\"),round(We,2)\n", + "print(\"for refrigerator,Q3/Q4=T3/T4 eq 1\")\n", + "T4=T2;#temperature of low temperature reservoir in K\n", + "print(\"now We-Wr=300\")\n", + "Wr=We-300.\n", + "print(\"so Wr=We-300 in KJ\"),round(Wr,2)\n", + "print(\"and Wr=Q4-Q3=1154.55 KJ eq 2 \")\n", + "print(\"solving eq1 and eq 2 we get\")\n", + "Q4=(1154.55*T4)/(T4-T3)\n", + "print(\"Q4=in KJ\"),round(Q4,2)\n", + "Q3=Q4-Wr\n", + "print(\"and Q3=in KJ\"),round(Q3,2)\n", + "Q=Q2+Q4\n", + "print(\"total heat transferred to low teperature reservoir(Q)=in KJ\"),round(Q,2)\n", + "print(\"hence heat transferred to refrigerant=Q3 in KJ\"),round(Q3,2)\n", + "print(\"and heat transferred to low temperature reservoir=Q in KJ\"),round(Q,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.5;pg no: 116" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.5, Page:116 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\n", + "COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\n", + "also we know K=Q1/Q2=T1/T2\n", + "so K=T1/T2 1.1\n", + "so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K)) 11.0\n", + "also COP_HP=Q1/W\n", + "W=Q1/COin MJ/Hr 3.03\n", + "or W=1000*W/3600 in KW 3.03\n", + "so minimum power required(W)in KW 3.03\n" + ] + } + ], + "source": [ + "#cal of minimum power required\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.5, Page:116 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\")\n", + "T1=(25+273.15);#temperature of inside of house in K\n", + "T2=(-1+273.15);#outside temperature in K\n", + "Q1=125;#heating load in MJ/Hr\n", + "print(\"COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\")\n", + "print(\"also we know K=Q1/Q2=T1/T2\")\n", + "K=T1/T2\n", + "print(\"so K=T1/T2\"),round(K,2)\n", + "COP_HP=1/(1-(1/K))\n", + "print(\"so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K))\"),round(COP_HP)\n", + "print(\"also COP_HP=Q1/W\")\n", + "W=Q1/COP_HP\n", + "W=1000*W/3600\n", + "print(\"W=Q1/COin MJ/Hr\"),round(W,2)\n", + "print(\"or W=1000*W/3600 in KW\"),round(W,2)\n", + "print(\"so minimum power required(W)in KW \"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.6;pg no: 117" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.6, Page:117 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\n", + "cold storage plant can be considered as refrigerator operating between given temperatures limits\n", + "capacity of plant=heat to be extracted=Q2 in KW\n", + "we know that,one ton of refrigeration as 3.52 KW \n", + "so Q2=Q2*3.52 in KW 140.8\n", + "carnot COP of plant(COP_carnot)= 5.18\n", + "performance is 1/4 of its carnot COP\n", + "COP=COP_carnot/4\n", + "also actual COP=Q2/W\n", + "W=Q2/COP in KW\n", + "hence power required(W)in KW 108.76\n" + ] + } + ], + "source": [ + "#cal of power required\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.6, Page:117 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\")\n", + "T1=(-15.+273.15);#inside temperature in K\n", + "T2=(35.+273.);#atmospheric temperature in K\n", + "Q2=40.;#refrigeration capacity of storage plant in tonnes\n", + "print(\"cold storage plant can be considered as refrigerator operating between given temperatures limits\")\n", + "print(\"capacity of plant=heat to be extracted=Q2 in KW\")\n", + "print(\"we know that,one ton of refrigeration as 3.52 KW \")\n", + "Q2=Q2*3.52\n", + "print(\"so Q2=Q2*3.52 in KW\"),round(Q2,2)\n", + "COP_carnot=1/((T2/T1)-1)\n", + "print(\"carnot COP of plant(COP_carnot)=\"),round(COP_carnot,2)\n", + "print(\"performance is 1/4 of its carnot COP\")\n", + "COP=COP_carnot/4\n", + "print(\"COP=COP_carnot/4\")\n", + "print(\"also actual COP=Q2/W\")\n", + "print(\"W=Q2/COP in KW\")\n", + "W=Q2/COP\n", + "print(\"hence power required(W)in KW\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.7;pg no: 117" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.7, Page:117 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\n", + "highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\n", + "n= 0.79\n", + "or n=n*100 % 78.92\n" + ] + } + ], + "source": [ + "#cal of carnot cycle efficiency for given temperature limits\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.7, Page:117 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\")\n", + "T1=(1150.+273.);#temperature of source in K\n", + "T2=(27.+273.);#temperature of sink in K\n", + "print(\"highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\")\n", + "n=1-(T2/T1)\n", + "print(\"n=\"),round(n,2)\n", + "n=n*100\n", + "print(\"or n=n*100 %\"),round(n,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.8;pg no: 117" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.8, Page:117 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\n", + "here heat to be removed continuously from refrigerated space(Q)in KJ/s 0.13\n", + "for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\n", + "W=in KW 0.02\n", + "so power required(W)in KW 0.02\n" + ] + } + ], + "source": [ + "#cal of power required\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.8, Page:117 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\")\n", + "T1=(27.+273.);#temperature of source in K\n", + "T2=(-8.+273.);#temperature of sink in K\n", + "Q=7.5;#heat leakage in KJ/min\n", + "Q=Q/60.\n", + "print(\"here heat to be removed continuously from refrigerated space(Q)in KJ/s\"),round(Q,2)\n", + "print(\"for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\")\n", + "W=Q*((T1/T2)-1)\n", + "print(\"W=in KW\"),round(W,2)\n", + "print(\"so power required(W)in KW\"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.9;pg no: 118" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.9, Page:118 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\n", + "here W1:W2:W3=3:2:1\n", + "efficiency of engine,HE1,\n", + "W1/Q1=(1-(T2/1100))\n", + "so Q1=(1100*W1)/(1100-T2)\n", + "for HE2 engine,W2/Q2=(1-(T3/T2))\n", + "for HE3 engine,W3/Q3=(1-(300/T3))\n", + "from energy balance on engine,HE1\n", + "Q1=W1+Q2=>Q2=Q1-W1\n", + "above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\n", + "substituting Q2 in efficiency of HE2\n", + "W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\n", + "W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\n", + "2/3=(T2-T3)/(1100-T2)\n", + "2200-2*T2=3*T2-3*T3\n", + "5*T2-3*T3=2200\n", + "now energy balance on engine HE2 gives,Q2=W2+Q3\n", + "substituting in efficiency of HE2,\n", + "W2/(W2+Q3)=(T2-T3)/T2\n", + "W2*T2=(W2+Q3)*(T2-T3)\n", + "Q3=(W2*T3)/(T2-T3)\n", + "substituting Q3 in efficiency of HE3,\n", + "W3/((W2*T3)/(T2-T3))=(T3-300)/T3\n", + "W3/W2=(T3/(T2-T3))*(T3-300)/T3\n", + "1/2=(T3-300)/(T2-T3)\n", + "3*T3-T2=600\n", + "solving equations of T2 and T3,\n", + "we get,T3=in K 433.33\n", + "and by eq 5,T2 in K 700.0\n", + "so intermediate temperature are 700 K and 433.33 K\n" + ] + } + ], + "source": [ + "#cal of intermediate temperatures\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.9, Page:118 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\")\n", + "T1=1100;#temperature of high temperature reservoir in K\n", + "T4=300;#temperature of low temperature reservoir in K\n", + "print(\"here W1:W2:W3=3:2:1\")\n", + "print(\"efficiency of engine,HE1,\")\n", + "print(\"W1/Q1=(1-(T2/1100))\")\n", + "print(\"so Q1=(1100*W1)/(1100-T2)\")\n", + "print(\"for HE2 engine,W2/Q2=(1-(T3/T2))\")\n", + "print(\"for HE3 engine,W3/Q3=(1-(300/T3))\")\n", + "print(\"from energy balance on engine,HE1\")\n", + "print(\"Q1=W1+Q2=>Q2=Q1-W1\")\n", + "print(\"above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\")\n", + "print(\"substituting Q2 in efficiency of HE2\")\n", + "print(\"W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\")\n", + "print(\"W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\")\n", + "print(\"2/3=(T2-T3)/(1100-T2)\")\n", + "print(\"2200-2*T2=3*T2-3*T3\")\n", + "print(\"5*T2-3*T3=2200\")\n", + "print(\"now energy balance on engine HE2 gives,Q2=W2+Q3\")\n", + "print(\"substituting in efficiency of HE2,\")\n", + "print(\"W2/(W2+Q3)=(T2-T3)/T2\")\n", + "print(\"W2*T2=(W2+Q3)*(T2-T3)\")\n", + "print(\"Q3=(W2*T3)/(T2-T3)\")\n", + "print(\"substituting Q3 in efficiency of HE3,\")\n", + "print(\"W3/((W2*T3)/(T2-T3))=(T3-300)/T3\")\n", + "print(\"W3/W2=(T3/(T2-T3))*(T3-300)/T3\")\n", + "print(\"1/2=(T3-300)/(T2-T3)\")\n", + "print(\"3*T3-T2=600\")\n", + "print(\"solving equations of T2 and T3,\")\n", + "T3=(600.+(2200./5.))/(3.-(3./5.))\n", + "print(\"we get,T3=in K\"),round(T3,2)\n", + "T2=(2200.+3.*T3)/5.\n", + "print(\"and by eq 5,T2 in K\"),round(T2,2)\n", + "print(\"so intermediate temperature are 700 K and 433.33 K\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.10;pg no: 119" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.10, Page:119 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\n", + "efficiency of engine,W/Q1=(800-T)/800\n", + "for refrigerator,COP=Q3/W=280/(T-280)\n", + "it is given that Q1=Q3=Q\n", + "so,from engine,W/Q=(800-T)/800\n", + "from refrigerator,Q/W=280/(T-280)\n", + "from above two(Q/W)may be equated,\n", + "(T-280)/280=(800-T)/800\n", + "so temperature(T)in K 414.81\n", + "efficiency of engine(n)is given as\n", + "n= 0.48\n", + "COP of refrigerator is given as\n", + "COP= 2.08\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.10, Page:119 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\")\n", + "T1=800.;#temperature of source in K\n", + "T2=280.;#temperature of sink in K\n", + "print(\"efficiency of engine,W/Q1=(800-T)/800\")\n", + "print(\"for refrigerator,COP=Q3/W=280/(T-280)\")\n", + "print(\"it is given that Q1=Q3=Q\")\n", + "print(\"so,from engine,W/Q=(800-T)/800\")\n", + "print(\"from refrigerator,Q/W=280/(T-280)\")\n", + "print(\"from above two(Q/W)may be equated,\")\n", + "print(\"(T-280)/280=(800-T)/800\")\n", + "T=2.*280.*800./(800.+280.)\n", + "print(\"so temperature(T)in K\"),round(T,2)\n", + "print(\"efficiency of engine(n)is given as\")\n", + "n=(800.-T)/800.\n", + "print(\"n=\"),round(n,2)\n", + "print(\"COP of refrigerator is given as\")\n", + "COP=280./(T-280.)\n", + "print(\"COP=\"),round(COP,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.11;pg no: 120" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.11, Page:120 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\n", + "let thermodynamic properties be denoted with respect to salient states;\n", + "n_carnot=1-T1/T2\n", + "so T1/T2=1-0.5\n", + "so T1/T2=0.5\n", + "or T2=2*T1\n", + "corresponding to state 2,p2*v2=m*R*T2\n", + "so temperature(T2) in K= 585.37\n", + "heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\n", + "Q_23=W_23=p2*v2*log(v3/v2)\n", + "so volume(v3) in m^3= 0.1932\n", + "temperature at state 1,T1 in K= 292.68\n", + "during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\n", + "here expansion constant(y)=Cp/Cv\n", + "so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\n", + "p1 in bar\n", + "thus p1*v1=m*R*T1\n", + "so volume(v1) in m^3= 0.68\n", + "heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\n", + "for isentropic process,dQ=0,dW=dU\n", + "during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\n", + "Q_12=0,\n", + "W_12=-105.51 KJ(-ve work)\n", + "during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\n", + "Q_31=0,\n", + "ANS:\n", + "W_34=+105.51 KJ(+ve work)\n", + "so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\n", + "for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\n", + "for process 3-4,heat transfer=0,work interaction=+105.51 KJ\n", + "for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\n", + "maximum temperature of cycle=585.36 KJ\n", + "minimum temperature of cycle=292.68 KJ\n", + "volume at the end of isothermal expansion=0.1932 m^3\n" + ] + } + ], + "source": [ + "#cal of max and min temp of cycle,volume\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "import math\n", + "print\"Example 4.11, Page:120 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\")\n", + "n_carnot=0.5;#efficiency of carnot power cycle\n", + "m=0.5;#mass of air in kg\n", + "p2=7.*10**5;#final pressure in pa\n", + "v2=0.12;#volume in m^3\n", + "R=287.;#gas constant in J/kg K\n", + "Q_23=40.*1000.;#heat transfer to the air during isothermal expansion in J\n", + "Cp=1.008;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.721;#specific heat at constant volume in KJ/kg K\n", + "print(\"let thermodynamic properties be denoted with respect to salient states;\")\n", + "print(\"n_carnot=1-T1/T2\")\n", + "print(\"so T1/T2=1-0.5\")\n", + "1-0.5\n", + "print(\"so T1/T2=0.5\")\n", + "print(\"or T2=2*T1\")\n", + "print(\"corresponding to state 2,p2*v2=m*R*T2\")\n", + "T2=p2*v2/(m*R)\n", + "print(\"so temperature(T2) in K=\"),round(T2,2)\n", + "print(\"heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\")\n", + "print(\"Q_23=W_23=p2*v2*log(v3/v2)\")\n", + "v3=v2*math.exp(Q_23/(p2*v2))\n", + "print(\"so volume(v3) in m^3=\"),round(v3,4)\n", + "T1=T2/2\n", + "print(\"temperature at state 1,T1 in K=\"),round(T1,2)\n", + "print(\"during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\")\n", + "print(\"here expansion constant(y)=Cp/Cv\")\n", + "y=Cp/Cv\n", + "print(\"so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\")\n", + "p1=p2/(T2/T1)**(y/(y-1))\n", + "print(\"p1 in bar\")\n", + "p1=p1/10**5\n", + "print(\"thus p1*v1=m*R*T1\")\n", + "v1=m*R*T1/(p1*10**5)\n", + "print(\"so volume(v1) in m^3=\"),round(v1,2) \n", + "print(\"heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\")\n", + "print(\"for isentropic process,dQ=0,dW=dU\")\n", + "print(\"during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\")\n", + "print(\"Q_12=0,\")\n", + "W_12=-m*Cv*(T2-T1)\n", + "print(\"W_12=-105.51 KJ(-ve work)\")\n", + "print(\"during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\")\n", + "print(\"Q_31=0,\")\n", + "T4=T1;\n", + "T3=T2;\n", + "W_34=-m*Cv*(T4-T3)\n", + "print(\"ANS:\")\n", + "print(\"W_34=+105.51 KJ(+ve work)\")\n", + "print(\"so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\")\n", + "print(\"for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\")\n", + "print(\"for process 3-4,heat transfer=0,work interaction=+105.51 KJ\")\n", + "print(\"for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\")\n", + "print(\"maximum temperature of cycle=585.36 KJ\")\n", + "print(\"minimum temperature of cycle=292.68 KJ\")\n", + "print(\"volume at the end of isothermal expansion=0.1932 m^3\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.12;pg no: 122" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.12, Page:122 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\n", + "let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\n", + "thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\n", + "Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\n", + "Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\n", + "substituting Q1_a and Q1_b in eq 1\n", + "4*Q2/3+2*Q3=5000...............eq4\n", + "also from total work output,Q1_a+Q1_b-Q2-Q3=W\n", + "5000-Q2-Q3=840\n", + "so Q2+Q3=5000-840=4160\n", + "Q3=4160-Q2\n", + "sunstituting Q3 in eq 4\n", + "4*Q2/3+2*(4160-Q2)=5000\n", + "so Q2=in KJ 4980.0\n", + "and Q3= in KJ 820.0\n", + "here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\n", + "Q2=4980 KJ,from heat engine\n", + "Q3=820 KJ,to heat engine\n" + ] + } + ], + "source": [ + "#cal of heat from from heat engine and to heat engine\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.12, Page:122 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\")\n", + "W=840.;#work done by reservoir in KJ\n", + "print(\"let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\")\n", + "print(\"thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\")\n", + "print(\"Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\")\n", + "print(\"Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\")\n", + "print(\"substituting Q1_a and Q1_b in eq 1\")\n", + "print(\"4*Q2/3+2*Q3=5000...............eq4\")\n", + "print(\"also from total work output,Q1_a+Q1_b-Q2-Q3=W\")\n", + "print(\"5000-Q2-Q3=840\")\n", + "print(\"so Q2+Q3=5000-840=4160\")\n", + "print(\"Q3=4160-Q2\")\n", + "print(\"sunstituting Q3 in eq 4\")\n", + "print(\"4*Q2/3+2*(4160-Q2)=5000\")\n", + "Q2=(5000.-2.*4160.)/((4./3.)-2.)\n", + "print(\"so Q2=in KJ\"),round(Q2,2)\n", + "Q3=4160.-Q2\n", + "print(\"and Q3= in KJ\"),round(-Q3,2)\n", + "print(\"here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\")\n", + "print(\"Q2=4980 KJ,from heat engine\")\n", + "print(\"Q3=820 KJ,to heat engine\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.13;pg no: 123" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.13, Page:123 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\n", + "arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\n", + "for heat engine\n", + "ne=W/Q1=1-T2/T1\n", + "so (Q1-Q2)/Q1=\n", + "and Q2/Q1=\n", + "Q2=0.2593*Q1\n", + "for heat pump,\n", + "COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\n", + "Q4/Q3=\n", + "Q4=1.27*Q3\n", + "work output from engine =work input to pump\n", + "Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\n", + "so Q4/Q1=\n", + "so Q4=3.484*Q1\n", + "also it is given that Q2+Q4=100\n", + "subtituting Q2 and Q4 as function of Q1 in following expression,\n", + "Q2+Q4=100\n", + "so 0.2539*Q1+3.484*Q1=100\n", + "so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\n", + "Q1=100/(0.2539+3.484)in KJ 26.75\n", + "NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\n" + ] + } + ], + "source": [ + "#cal of energy taken by engine from reservoir\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.13, Page:123 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\")\n", + "T2=(77+273);#temperature of reservoir 2\n", + "T1=(1077+273);#temperature of reservoir 1\n", + "T3=(3+273);#temperature of reservoir 3\n", + "print(\"arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\")\n", + "print(\"for heat engine\")\n", + "print(\"ne=W/Q1=1-T2/T1\")\n", + "print(\"so (Q1-Q2)/Q1=\")\n", + "1-T2/T1\n", + "print(\"and Q2/Q1=\")\n", + "1-0.7407\n", + "print(\"Q2=0.2593*Q1\")\n", + "print(\"for heat pump,\")\n", + "print(\"COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\")\n", + "T4=T2;\n", + "T4/(T4-T3)\n", + "print(\"Q4/Q3=\")\n", + "4.73/3.73\n", + "print(\"Q4=1.27*Q3\")\n", + "print(\"work output from engine =work input to pump\")\n", + "print(\"Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\")\n", + "print(\"so Q4/Q1=\")\n", + "(1-0.2593)/(1-(1/1.27))\n", + "print(\"so Q4=3.484*Q1\")\n", + "print(\"also it is given that Q2+Q4=100\")\n", + "print(\"subtituting Q2 and Q4 as function of Q1 in following expression,\")\n", + "print(\"Q2+Q4=100\")\n", + "print(\"so 0.2539*Q1+3.484*Q1=100\")\n", + "print(\"so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\")\n", + "Q1=100/(0.2539+3.484)\n", + "print(\"Q1=100/(0.2539+3.484)in KJ\"),round(Q1,2)\n", + "print(\"NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.14;pg no: 124" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.14, Page:124 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\n", + "let temperature of sink be T_sink K\n", + "Q_sink_HE+Q_sink_R=3000 ........eq 1\n", + "since complete work output from engine is used to run refrigerator so,\n", + "2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\n", + "by eq 1 and eq 2,we get Q_R in KJ/s 1000.0\n", + "also for heat engine,2000/1500=Q_sink_HE/T_sink\n", + "=>Q_sink_HE=4*T_sink/3\n", + "for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\n", + "substituting Q_sink_HE and Q_sink_R values\n", + "4*T_sink/3+1000*T_sink/288=3000\n", + "so temperature of sink(T_sink)in K\n", + "so T_sink= 750.0\n", + "T_sink in degree celcius 477.0\n" + ] + } + ], + "source": [ + "#cal of T_sink in degree celcius\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.14, Page:124 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\")\n", + "Q_source=2000;#heat supplied by heat engine in KJ/s\n", + "T_source=1500;#temperature of source in K\n", + "T_R=(15+273);#temperature of reservoir in K\n", + "Q_sink=3000;#heat received by sink in KJ/s\n", + "print(\"let temperature of sink be T_sink K\")\n", + "print(\"Q_sink_HE+Q_sink_R=3000 ........eq 1\")\n", + "print(\"since complete work output from engine is used to run refrigerator so,\")\n", + "print(\"2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\")\n", + "Q_R=3000-2000\n", + "print(\"by eq 1 and eq 2,we get Q_R in KJ/s\"),round(Q_R)\n", + "print(\"also for heat engine,2000/1500=Q_sink_HE/T_sink\")\n", + "print(\"=>Q_sink_HE=4*T_sink/3\")\n", + "print(\"for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\")\n", + "print(\"substituting Q_sink_HE and Q_sink_R values\")\n", + "print(\"4*T_sink/3+1000*T_sink/288=3000\")\n", + "print(\"so temperature of sink(T_sink)in K\")\n", + "T_sink=3000/((4/3)+(1000/288))\n", + "print(\"so T_sink=\"),round(T_sink,2)\n", + "T_sink=T_sink-273\n", + "print(\"T_sink in degree celcius\"),round(T_sink,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.15;pg no: 124" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.15, Page:124 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\n", + "let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\n", + "n=W/Q1= 0.39\n", + "so n=W/Q1=0.3881\n", + "COP of heat pump=T3/(T3-T2)=Q3/(2*W/3) 2.89\n", + "so 2.892=3*Q3/2*W\n", + "Q3/Q1= 0.7483\n", + "so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\n" + ] + } + ], + "source": [ + "#cal of heat transferred to refrigerant and low temperature reservoir\n", + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.15, Page:124 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\")\n", + "T1=(500.+273.);#temperature of source in K\n", + "T2=(200.+273.);#temperature of sink in K\n", + "T3=(450.+273.);#temperature of body in K\n", + "print(\"let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\")\n", + "n=1-(T2/T1)\n", + "print(\"n=W/Q1=\"),round(n,2)\n", + "print(\"so n=W/Q1=0.3881\")\n", + "COP=T3/(T3-T2)\n", + "print(\"COP of heat pump=T3/(T3-T2)=Q3/(2*W/3)\"),round(COP,2)\n", + "print(\"so 2.892=3*Q3/2*W\")\n", + "print(\"Q3/Q1=\"),round(2*COP*n/3,4)\n", + "print(\"so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.16;pg no: 125" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.16, Page:125 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\n", + "NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.16, Page:125 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\")\n", + "print(\"NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 4.17;pg no: 126" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 4.17, Page:126 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\n", + "NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 4\n", + "print\"Example 4.17, Page:126 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\")\n", + "print(\"NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter5.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter5.ipynb new file mode 100755 index 00000000..2eb17c0f --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter5.ipynb @@ -0,0 +1,1126 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5:Entropy" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.1;pg no: 144" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.1, Page:144 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\n", + "entropy change may be given as,\n", + "s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\n", + "here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\n", + "so change in entropy(deltaS)in KJ/kg K\n", + "deltaS= 0.263\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.1, Page:144 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\")\n", + "p1=5.;#initial pressure of air\n", + "T1=(27.+273.);#temperature of air in K\n", + "p2=2.;#final pressure of air in K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cp_air=1.004;#specific heat of air at constant pressure in KJ/kg K\n", + "print(\"entropy change may be given as,\")\n", + "print(\"s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\")\n", + "print(\"here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\")\n", + "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", + "deltaS=(Cp_air*0)-(R*math.log(p2/p1))\n", + "print(\"deltaS=\"),round(deltaS,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.2;pg no: 144" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.2, Page:144 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\n", + "total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\n", + "deltaS1=Q1/T1,where Q1=m*Cp*deltaT\n", + "heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\n", + "Q1= 1533.0\n", + "deltaS1=Q1/T1 in KJ/K 5.11\n", + "now heat of vaporisation(Q2)=in KJ 11300.0\n", + "entropy change during phase transformation(deltaS2)in KJ/K\n", + "deltaS2= 30.29\n", + "entropy change during steam temperature rise(deltaS3)in KJ/K\n", + "deltaS3=m*Cp_steam*dT/T\n", + "here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\n", + "R=in KJ/kg K 0.46\n", + "now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\n", + "total entropy change(deltaS) in KJ/K= 87.24\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.2, Page:144 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\")\n", + "import scipy\n", + "from scipy import integrate\n", + "##just an example function\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "T1=(27.+273.);#temperature of water in K\n", + "T2=(100.+273.);#steam temperature of water in K\n", + "m=5.;#mass of water in kg\n", + "q=2260.;#heat of vaporisation at 100 degree celcius in KJ/kg\n", + "Cp=4.2;#specific heat of water at constant pressure in KJ/kg K\n", + "M=18.;#molar mass for water/steam \n", + "R1=8.314;#gas constant in KJ/kg K\n", + "print(\"total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\")\n", + "Q1=m*Cp*(T2-T1)\n", + "print(\"deltaS1=Q1/T1,where Q1=m*Cp*deltaT\")\n", + "print(\"heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\")\n", + "print(\"Q1=\"),round(Q1,2)\n", + "deltaS1=Q1/T1\n", + "print(\"deltaS1=Q1/T1 in KJ/K\"),round(deltaS1,2)\n", + "Q2=m*q\n", + "print(\"now heat of vaporisation(Q2)=in KJ\"),round(Q2,2)\n", + "print(\"entropy change during phase transformation(deltaS2)in KJ/K\")\n", + "deltaS2=Q2/T2\n", + "print(\"deltaS2=\"),round(deltaS2,2)\n", + "print(\"entropy change during steam temperature rise(deltaS3)in KJ/K\")\n", + "print(\"deltaS3=m*Cp_steam*dT/T\")\n", + "print(\"here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\")\n", + "R=R1/M\n", + "print(\"R=in KJ/kg K\"),round(R,2)\n", + "T2=(100+273.15);#steam temperature of water in K\n", + "T3=(400+273.15);#temperature of steam in K\n", + "print(\"now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\")\n", + "#function y = f(T), y =(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T , endfunction\n", + "def fun1(x):\n", + "\ty=(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T\n", + "\treturn y\n", + "\n", + "#deltaS3 =scipy.integrate.quad(f,T2, T3) \n", + "deltaS3=51.84;#approximately\n", + "deltaS=deltaS1+deltaS2+deltaS3\n", + "print(\"total entropy change(deltaS) in KJ/K=\"),round(deltaS,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.3;pg no: 145" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.3, Page:145 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\n", + "gas constant for oxygen(R)in KJ/kg K\n", + "R= 0.26\n", + "for reversible process the change in entropy may be given as\n", + "deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\n", + "so entropy change=deltaS= in (KJ/kg K) -0.29\n" + ] + } + ], + "source": [ + "#cal of entropy change\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.3, Page:145 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\")\n", + "R1=8.314;#gas constant in KJ/kg K\n", + "M=32;#molar mass for O2 \n", + "T1=(27+273);#initial temperature of O2 in K\n", + "p1=125;#initial pressure of O2 in Kpa\n", + "p2=375;#final pressure of O2 in Kpa\n", + "Cp=1.004;#specific heat of air at constant pressure in KJ/kg K\n", + "print(\"gas constant for oxygen(R)in KJ/kg K\")\n", + "R=R1/M\n", + "print(\"R=\"),round(R,2)\n", + "print(\"for reversible process the change in entropy may be given as\")\n", + "print(\"deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\")\n", + "T2=T1;#isothermal process\n", + "deltaS=(Cp*math.log(T2/T1))-(R*math.log(p2/p1))\n", + "print(\"so entropy change=deltaS= in (KJ/kg K)\"),round(deltaS,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.4;pg no: 145" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.4, Page:145 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\n", + "entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\n", + "where deltaS_block=m*C*log(T2/T1)\n", + "here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\n", + "therefore deltaS_block=in KJ/K -0.14\n", + "heat loss by block =heat gained by water(Q)in KJ\n", + "Q=-m*C*(T1-T2) -49.13\n", + "therefore deltaS_water=-Q/T2 in KJ/K 0.16\n", + "thus deltaS_universe=in J/K 27.16\n" + ] + } + ], + "source": [ + "#cal of deltaS_universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.4, Page:145 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\")\n", + "T1=(150+273.15);#temperature of copper block in K\n", + "T2=(25+273.15);#temperature of sea water in K\n", + "m=1;#mass of copper block in kg\n", + "C=0.393;#heat capacity of copper in KJ/kg K\n", + "print(\"entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\")\n", + "print(\"where deltaS_block=m*C*log(T2/T1)\")\n", + "print(\"here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\")\n", + "deltaS_block=m*C*math.log(T2/T1)\n", + "print(\"therefore deltaS_block=in KJ/K\"),round(deltaS_block,2)\n", + "print(\"heat loss by block =heat gained by water(Q)in KJ\")\n", + "Q=-m*C*(T1-T2)\n", + "print(\"Q=-m*C*(T1-T2)\"),round(Q,2)\n", + "deltaS_water=-Q/T2\n", + "print(\"therefore deltaS_water=-Q/T2 in KJ/K\"),round(deltaS_water,2)\n", + "deltaS_universe=(deltaS_block+deltaS_water)*1000\n", + "print(\"thus deltaS_universe=in J/K\"),round(deltaS_universe,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.5;pg no: 146" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.5, Page:146 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\n", + "deltaS_universe=(deltaS_block+deltaS_seawater)\n", + "since block and sea water both are at same temperature so,\n", + "deltaS_universe=deltaS_seawater\n", + "conservation of energy equation yields,\n", + "Q-W=deltaU+deltaP.E+deltaK.E\n", + "since in this case,W=0,deltaK.E=0,deltaU=0\n", + "Q=deltaP.E\n", + "change in potential energy=deltaP.E=m*g*h in J\n", + "deltaS_universe=deltaS_seawater=Q/T in J/kg K\n", + "entropy change of universe(deltaS_universe)in J/kg K 6.54\n" + ] + } + ], + "source": [ + "#cal of entropy change of universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.5, Page:146 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\")\n", + "m=1;#mass of copper block in kg\n", + "T=(27+273);#temperature of copper block in K\n", + "h=200;#height from which copper block dropped in sea water in m\n", + "C=0.393;#heat capacity for copper in KJ/kg K\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"deltaS_universe=(deltaS_block+deltaS_seawater)\")\n", + "print(\"since block and sea water both are at same temperature so,\")\n", + "print(\"deltaS_universe=deltaS_seawater\")\n", + "print(\"conservation of energy equation yields,\")\n", + "print(\"Q-W=deltaU+deltaP.E+deltaK.E\")\n", + "print(\"since in this case,W=0,deltaK.E=0,deltaU=0\")\n", + "deltaPE=m*g*h\n", + "Q=deltaPE\n", + "print(\"Q=deltaP.E\")\n", + "print(\"change in potential energy=deltaP.E=m*g*h in J\")\n", + "print(\"deltaS_universe=deltaS_seawater=Q/T in J/kg K\")\n", + "deltaS_universe=Q/T\n", + "print(\"entropy change of universe(deltaS_universe)in J/kg K\"),round(deltaS_universe,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.6;pg no: 146" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.6, Page:146 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\n", + "here deltaS_universe=deltaS_block1+deltaS_block2\n", + "two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\n", + "then from energy conservation\n", + "m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\n", + "Tf=in K 374.18\n", + "hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\n", + "deltaS1=in KJ/K -0.05\n", + "entropy change in block 2(deltaS2)in KJ/K\n", + "deltaS2= 0.06\n", + "entropy change of universe(deltaS)=in KJ/K 0.01\n" + ] + } + ], + "source": [ + "#cal of entropy change of universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.6, Page:146 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\")\n", + "m1=1;#mass of first copper block in kg\n", + "m2=0.5;#mass of second copper block in kg\n", + "T1=(150+273.15);#temperature of first copper block in K\n", + "T2=(0+273.15);#temperature of second copper block in K\n", + "Cp_1=0.393;#heat capacity for copper block 1 in KJ/kg K\n", + "Cp_2=0.381;#heat capacity for copper block 2 in KJ/kg K\n", + "print(\"here deltaS_universe=deltaS_block1+deltaS_block2\")\n", + "print(\"two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\")\n", + "print(\"then from energy conservation\")\n", + "print(\"m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\")\n", + "Tf=((m1*Cp_1*T1)+(m2*Cp_2*T2))/(m1*Cp_1+m2*Cp_2)\n", + "print(\"Tf=in K\"),round(Tf,2)\n", + "print(\"hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\")\n", + "deltaS1=m1*Cp_1*math.log(Tf/T1)\n", + "print(\"deltaS1=in KJ/K\"),round(deltaS1,2)\n", + "print(\"entropy change in block 2(deltaS2)in KJ/K\")\n", + "deltaS2=m2*Cp_2*math.log(Tf/T2)\n", + "print(\"deltaS2=\"),round(deltaS2,2)\n", + "deltaS=deltaS1+deltaS2\n", + "print(\"entropy change of universe(deltaS)=in KJ/K\"),round(deltaS,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.7;pg no: 147" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.7, Page:147 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\n", + "NOTE=>in this question formula is derived which cannot be solve using python software\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.7, Page:147 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\")\n", + "print(\"NOTE=>in this question formula is derived which cannot be solve using python software\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.8;pg no: 148" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.8, Page:148 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\n", + "for irreversible operation of engine,\n", + "rate of entropy generation=Q1/T1+Q2/T2\n", + "W=Q1-Q2=>Q2=Q1-W in MW 3.0\n", + "entropy generated(deltaS_gen)in MW\n", + "deltaS_gen= 0.01\n", + "work lost(W_lost)in MW\n", + "W_lost=T2*deltaS_gen 4.0\n" + ] + } + ], + "source": [ + "#cal of work lost\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.8, Page:148 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\")\n", + "T1=1800.;#temperature of high temperature reservoir in K\n", + "T2=300.;#temperature of low temperature reservoir in K\n", + "Q1=5.;#heat addition in MW\n", + "W=2.;#work done in MW\n", + "print(\"for irreversible operation of engine,\")\n", + "print(\"rate of entropy generation=Q1/T1+Q2/T2\")\n", + "Q2=Q1-W\n", + "print(\"W=Q1-Q2=>Q2=Q1-W in MW\"),round(Q2,2)\n", + "print(\"entropy generated(deltaS_gen)in MW\")\n", + "deltaS_gen=Q1/T1+Q2/T2\n", + "print(\"deltaS_gen=\"),round(deltaS_gen,2)\n", + "Q1=-5;#heat addition in MW\n", + "print(\"work lost(W_lost)in MW\")\n", + "W_lost=T2*deltaS_gen\n", + "print(\"W_lost=T2*deltaS_gen\"),round(W_lost)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.9;pg no: 148" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.9, Page:148 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\n", + "system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\n", + "therefore,maximum heat(Q1)=(C*dT)in J\n", + "here C=0.05*T^2+0.10*T+0.085 in J/K\n", + "so Q1=(0.05*T^2+0.10*T+0.085)*dT\n", + "entropy change of system,deltaS_system=C*dT/T in J/K\n", + "so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\n", + "deltaS_reservoir=Q2/T2=(Q1-W)/T2 also,we know from entropy principle,deltaS_universe is greater than equal to 0\n", + "deltaS_universe=deltaS_system+deltaS_reservoir\n", + "thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\n", + "W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\n", + "hence maximum work in KJ= 435.34\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.9, Page:148 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\")\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "T1=500;#temperature of system in K\n", + "T2=300;#temperature of reservoir in K\n", + "print(\"system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\")\n", + "print(\"therefore,maximum heat(Q1)=(C*dT)in J\")\n", + "print(\"here C=0.05*T^2+0.10*T+0.085 in J/K\")\n", + "print(\"so Q1=(0.05*T^2+0.10*T+0.085)*dT\")\n", + "T=T1-T2\n", + "#Q1=(0.05*T**2+0.10*T+0.085)*dT\n", + "#function y = f(T), y = (0.05*T**2+0.10*T+0.085),endfunction\n", + "#Q1 = scipy.integrate.quad(fun1,T1, T2)\n", + "#Q1=-Q1\n", + "Q1=1641.35*10**3\n", + "print(\"entropy change of system,deltaS_system=C*dT/T in J/K\")\n", + "print(\"so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\")\n", + "#function y = k(T), y = (0.05*T**2+0.10*T+0.085)/T,endfunction\n", + "def fun1(x):\n", + "\ty = (0.05*T**2+0.10*T+0.085)/T\n", + "\treturn y\n", + "\n", + "#deltaS_system = scipy.integrate.quad(k,T1, T2)\n", + "deltaS_system=-4020.043\n", + "print(\"deltaS_reservoir=Q2/T2=(Q1-W)/T2\"),\n", + "print(\"also,we know from entropy principle,deltaS_universe is greater than equal to 0\")\n", + "print(\"deltaS_universe=deltaS_system+deltaS_reservoir\")\n", + "print(\"thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\")\n", + "print(\"W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\")\n", + "W=(Q1+deltaS_system*T2)/1000\n", + "print(\"hence maximum work in KJ=\"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.10;pg no: 149" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.10, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\n", + "for reversible adiabatic process governing equation for expansion,\n", + "P*V**1.4=constant\n", + "also,for such process entropy change=0\n", + "using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\n", + "final pressure(p2)in Mpa\n", + "p2= 0.24\n", + "from first law,second law and definition of enthalpy;\n", + "dH=T*dS+v*dP\n", + "for adiabatic process of reversible type,dS=0\n", + "so dH=v*dP\n", + "integrating both side H2-H1=deltaH=v*dP in KJ\n", + "so enthalpy change(deltaH)in KJ=268.8\n", + "and entropy change=0\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "\n", + "print\"Example 5.10, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\")\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "p1=3.;#initial pressure in Mpa\n", + "v1=0.05;#initial volume in m**3\n", + "v2=0.3;#final volume in m**3\n", + "print(\"for reversible adiabatic process governing equation for expansion,\")\n", + "print(\"P*V**1.4=constant\")\n", + "print(\"also,for such process entropy change=0\")\n", + "print(\"using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\")\n", + "print(\"final pressure(p2)in Mpa\")\n", + "p2=p1*(v1/v2)**1.4\n", + "print(\"p2=\"),round(p2,2)\n", + "print(\"from first law,second law and definition of enthalpy;\")\n", + "print(\"dH=T*dS+v*dP\")\n", + "print(\"for adiabatic process of reversible type,dS=0\")\n", + "dS=0;#for adiabatic process of reversible type\n", + "print(\"so dH=v*dP\")\n", + "print(\"integrating both side H2-H1=deltaH=v*dP in KJ\")\n", + "p1=3.*1000.;#initial pressure in Kpa\n", + "p2=244.;#final pressure in Kpa\n", + "#function y = f(p), y =(p1*(v1**1.4)/p)**(1/1.4)\n", + "def fun1(x):\n", + "\ty=(p1*(v1**1.4)/p2)**(1/1.4)\n", + "\treturn y\n", + "\n", + "deltaH = scipy.integrate.quad(fun1,p2,p1)\n", + "print (\"so enthalpy change(deltaH)in KJ=268.8\")\n", + "print(\"and entropy change=0\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.11;pg no: 150" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.11, Page:150 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\n", + "during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\n", + "a> change in entropy of air(deltaS_air)in J/K\n", + "deltaS_air= 1321.68\n", + "b> during free expansion on heat is gained or lost to surrounding so,\n", + "deltaS_surrounding=0\n", + "entropy change of surroundings=0\n", + "c> entropy change of universe(deltaS_universe)in J/K\n", + "deltaS_universe= 1321.68\n" + ] + } + ], + "source": [ + "#cal of deltaS_universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.11, Page:150 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\")\n", + "m=2;#mass of air in kg\n", + "v1=1;#initial volume of air in m^3\n", + "v2=10;#final volume of air in m^3\n", + "R=287;#gas constant in J/kg K\n", + "print(\"during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\")\n", + "print(\"a> change in entropy of air(deltaS_air)in J/K\")\n", + "deltaS_air=m*R*math.log(v2/v1)\n", + "print(\"deltaS_air=\"),round(deltaS_air,2)\n", + "print(\"b> during free expansion on heat is gained or lost to surrounding so,\")\n", + "print(\"deltaS_surrounding=0\")\n", + "print(\"entropy change of surroundings=0\")\n", + "deltaS_surrounding=0;#entropy change of surroundings\n", + "print(\"c> entropy change of universe(deltaS_universe)in J/K\")\n", + "deltaS_universe=deltaS_air+deltaS_surrounding\n", + "print(\"deltaS_universe=\"),round(deltaS_universe,2)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "##example 5.12;pg no: 150" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.12, Page:150 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\n", + "let initial and final states be denoted by 1 and 2\n", + "for poly tropic process pressure and temperature can be related as\n", + "(p2/p1)^((n-1)/n)=T2/T1\n", + "so temperature after compression(T2)=in K 1128.94\n", + "substituting in entropy change expression for polytropic process,\n", + "entropy change(deltaS)inKJ/kg K\n", + "deltaS= -0.24454\n", + "NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\n", + "total entropy change(deltaS)=in J/K -122.27\n" + ] + } + ], + "source": [ + "#cal of total entropy change\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.12, Page:150 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\")\n", + "m=0.5;#mass of air in kg\n", + "p1=1.013*10**5;#initial pressure of air in pa\n", + "p2=0.8*10**6;#final pressure of air in pa\n", + "T1=800;#initial temperature of air in K\n", + "n=1.2;#polytropic expansion constant\n", + "y=1.4;#expansion constant for air\n", + "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", + "print(\"let initial and final states be denoted by 1 and 2\")\n", + "print(\"for poly tropic process pressure and temperature can be related as\")\n", + "print(\"(p2/p1)^((n-1)/n)=T2/T1\")\n", + "T2=T1*(p2/p1)**((n-1)/n)\n", + "print(\"so temperature after compression(T2)=in K\"),round(T2,2)\n", + "print(\"substituting in entropy change expression for polytropic process,\") \n", + "print(\"entropy change(deltaS)inKJ/kg K\")\n", + "deltaS=Cv*((n-y)/(n-1))*math.log(T2/T1)\n", + "print(\"deltaS=\"),round(deltaS,5)\n", + "print(\"NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\")\n", + "deltaS=m*deltaS*1000\n", + "print(\"total entropy change(deltaS)=in J/K\"),round(deltaS,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.13;pg no: 151" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.13, Page:151 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\n", + "NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.13, Page:151 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\")\n", + "print(\"NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.14;pg no: 152" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.14, Page:152 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\n", + "clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\n", + "K=dQ/T=Q1/T1-Q2/T2\n", + "i> for Q2=200 kcal/s\n", + "K=in kcal/s K 0.0\n", + "as K is not greater than 0,therefore under these conditions engine is not possible\n", + "ii> for Q2=400 kcal/s\n", + "K=in kcal/s K -1.0\n", + "as K is less than 0,so engine is feasible and cycle is reversible\n", + "iii> for Q2=250 kcal/s\n", + "K=in kcal/s K 0.0\n", + "as K=0,so engine is feasible and cycle is reversible\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.14, Page:152 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\")\n", + "Q1=500;#heat supplied by source in kcal/s\n", + "T1=600;#temperature of source in K\n", + "T2=300;#temperature of sink in K\n", + "print(\"clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\")\n", + "print(\"K=dQ/T=Q1/T1-Q2/T2\")\n", + "print(\"i> for Q2=200 kcal/s\")\n", + "Q2=200;#heat rejected by sink in kcal/s\n", + "K=Q1/T1-Q2/T2\n", + "print(\"K=in kcal/s K\"),round(K,2)\n", + "print(\"as K is not greater than 0,therefore under these conditions engine is not possible\")\n", + "print(\"ii> for Q2=400 kcal/s\")\n", + "Q2=400;#heat rejected by sink in kcal/s\n", + "K=Q1/T1-Q2/T2\n", + "print(\"K=in kcal/s K\"),round(K,2)\n", + "print(\"as K is less than 0,so engine is feasible and cycle is reversible\")\n", + "print(\"iii> for Q2=250 kcal/s\")\n", + "Q2=250;#heat rejected by sink in kcal/s\n", + "K=Q1/T1-Q2/T2\n", + "print(\"K=in kcal/s K\"),round(K,2)\n", + "print(\"as K=0,so engine is feasible and cycle is reversible\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.15;pg no: 152" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.15, Page:152 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\n", + "let the two points be given as states 1 and 2,\n", + "let us assume flow to be from 1 to 2\n", + "so entropy change(deltaS1_2)=s1-s2=in KJ/kg K -0.0\n", + "deltaS1_2=s1-s2=0.01254 KJ/kg K\n", + "it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\n", + "hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.15, Page:152 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\")\n", + "p1=0.5;#initial pressure of air in Mpa\n", + "T1=400;#initial temperature of air in K\n", + "p2=0.3;#final pressure of air in Mpa\n", + "T2=350;#initial temperature of air in K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", + "print(\"let the two points be given as states 1 and 2,\")\n", + "print(\"let us assume flow to be from 1 to 2\")\n", + "deltaS1_2=Cp*math.log(T1/T2)-R*math.log(p1/p2)\n", + "print(\"so entropy change(deltaS1_2)=s1-s2=in KJ/kg K\"),round(deltaS1_2)\n", + "print(\"deltaS1_2=s1-s2=0.01254 KJ/kg K\")\n", + "print(\"it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\")\n", + "print(\"hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.16;pg no: 153" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.16, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\n", + "NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.16, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\")\n", + "print(\"NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.17;pg no: 153" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.17, Page:153 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\n", + "total heat added(Q)in KJ\n", + "Q= 1800.0\n", + "for heat addition process 1-2\n", + "Q12=T1*(s2-s1)\n", + "deltaS=s2-s1=in KJ/K 2.0\n", + "or heat addition process 3-4\n", + "Q34=T3*(s4-s3)\n", + "deltaS=s4-s3=in KJ/K 2.0\n", + "or heat rejected in process 5-6(Q56)in KJ\n", + "Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)= 1200.0\n", + "net work done=net heat(W_net)in KJ\n", + "W_net=(Q12+Q34)-Q56 600.0\n", + "thermal efficiency of cycle(n)= 0.33\n", + "or n=n*100 % 33.33\n", + "so work done=600 KJ and thermal efficiency=33.33 %\n" + ] + } + ], + "source": [ + "#cal of work done and thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.17, Page:153 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\")\n", + "Q12=1000.;#heat added during process 1-2 in KJ\n", + "Q34=800.;#heat added during process 3-4 in KJ\n", + "T1=500.;#operating temperature for process 1-2\n", + "T3=400.;#operating temperature for process 3-4\n", + "T5=300.;#operating temperature for process 5-6\n", + "T2=T1;#isothermal process\n", + "T4=T3;#isothermal process\n", + "T6=T5;#isothermal process\n", + "print(\"total heat added(Q)in KJ\")\n", + "Q=Q12+Q34\n", + "print(\"Q=\"),round(Q,2)\n", + "print(\"for heat addition process 1-2\")\n", + "print(\"Q12=T1*(s2-s1)\")\n", + "deltaS=Q12/T1\n", + "print(\"deltaS=s2-s1=in KJ/K\"),round(deltaS,2)\n", + "print(\"or heat addition process 3-4\")\n", + "print(\"Q34=T3*(s4-s3)\")\n", + "deltaS=Q34/T3\n", + "print(\"deltaS=s4-s3=in KJ/K\"),round(deltaS,2)\n", + "print(\"or heat rejected in process 5-6(Q56)in KJ\")\n", + "Q56=T5*(deltaS+deltaS)\n", + "print(\"Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)=\"),round(Q56,2)\n", + "print(\"net work done=net heat(W_net)in KJ\")\n", + "W_net=(Q12+Q34)-Q56\n", + "print(\"W_net=(Q12+Q34)-Q56\"),round(W_net,2)\n", + "n=W_net/Q\n", + "print(\"thermal efficiency of cycle(n)=\"),round(n,2)\n", + "n=n*100\n", + "print(\"or n=n*100 %\"),round(n,2) \n", + "print(\"so work done=600 KJ and thermal efficiency=33.33 %\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.18;pg no: 154" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.18, Page:154 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\n", + "let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\n", + "here Q1-Q2=W\n", + "so heat supplied by source(Q1)in KW= 30.0\n", + "also given that,Q1_a=0.7*Q1_b.......eq 1\n", + "Q1_c=Q1-(0.7*Q1_b+Q1_b)\n", + "Q1_c=Q1-1.7*Q1_b........eq 2\n", + "for reversible engine\n", + "Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\n", + "substitute eq 1 and eq 2 in eq 3 we get, \n", + "heat supplied by reservoir of 700 K(Q1_b)in KJ/s\n", + "Q1_b= 35.39\n", + "so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\n", + "Q1_a= 24.78\n", + "and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\n", + "Q1_c=Q1-1.7*Q1_b -30.17\n", + "so heat supplied by reservoir at 800 K(Q1_a)= 24.78\n", + "so heat supplied by reservoir at 700 K(Q1_b)= 35.39\n", + "so heat supplied by reservoir at 600 K(Q1_c)= -30.17\n", + "NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\n" + ] + } + ], + "source": [ + "#cal of heat supplied by reservoir at 800,700,600\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.18, Page:154 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\")\n", + "T1_a=800.;#temperature of reservoir a in K\n", + "T1_b=700.;#temperature of reservoir b in K\n", + "T1_c=600.;#temperature of reservoir c in K\n", + "T2=320.;#temperature of sink in K\n", + "W=20.;#work done in KW\n", + "Q2=10.;#heat rejected to sink in KW\n", + "print(\"let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\")\n", + "print(\"here Q1-Q2=W\")\n", + "Q1=W+Q2\n", + "print(\"so heat supplied by source(Q1)in KW=\"),round(Q1,2)\n", + "print(\"also given that,Q1_a=0.7*Q1_b.......eq 1\")\n", + "print(\"Q1_c=Q1-(0.7*Q1_b+Q1_b)\")\n", + "print(\"Q1_c=Q1-1.7*Q1_b........eq 2\")\n", + "print(\"for reversible engine\")\n", + "print(\"Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\")\n", + "print(\"substitute eq 1 and eq 2 in eq 3 we get, \")\n", + "print(\"heat supplied by reservoir of 700 K(Q1_b)in KJ/s\")\n", + "Q1_b=((Q2/T2)-(Q1/T1_c))/((0.7/T1_a)+(1/T1_b)-(1.7/T1_c))\n", + "print(\"Q1_b=\"),round(Q1_b,2)\n", + "print(\"so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\")\n", + "Q1_a=0.7*Q1_b\n", + "print(\"Q1_a=\"),round(Q1_a,2)\n", + "print(\"and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\")\n", + "Q1_c=Q1-1.7*Q1_b\n", + "print(\"Q1_c=Q1-1.7*Q1_b\"),round(Q1_c,2)\n", + "print(\"so heat supplied by reservoir at 800 K(Q1_a)=\"),round(Q1_a,2)\n", + "print(\"so heat supplied by reservoir at 700 K(Q1_b)=\"),round(Q1_b,2)\n", + "print(\"so heat supplied by reservoir at 600 K(Q1_c)=\"),round(Q1_c,2)\n", + "print(\"NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter5_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter5_1.ipynb new file mode 100755 index 00000000..2eb17c0f --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter5_1.ipynb @@ -0,0 +1,1126 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5:Entropy" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.1;pg no: 144" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.1, Page:144 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\n", + "entropy change may be given as,\n", + "s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\n", + "here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\n", + "so change in entropy(deltaS)in KJ/kg K\n", + "deltaS= 0.263\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.1, Page:144 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\")\n", + "p1=5.;#initial pressure of air\n", + "T1=(27.+273.);#temperature of air in K\n", + "p2=2.;#final pressure of air in K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cp_air=1.004;#specific heat of air at constant pressure in KJ/kg K\n", + "print(\"entropy change may be given as,\")\n", + "print(\"s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\")\n", + "print(\"here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\")\n", + "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", + "deltaS=(Cp_air*0)-(R*math.log(p2/p1))\n", + "print(\"deltaS=\"),round(deltaS,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.2;pg no: 144" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.2, Page:144 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\n", + "total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\n", + "deltaS1=Q1/T1,where Q1=m*Cp*deltaT\n", + "heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\n", + "Q1= 1533.0\n", + "deltaS1=Q1/T1 in KJ/K 5.11\n", + "now heat of vaporisation(Q2)=in KJ 11300.0\n", + "entropy change during phase transformation(deltaS2)in KJ/K\n", + "deltaS2= 30.29\n", + "entropy change during steam temperature rise(deltaS3)in KJ/K\n", + "deltaS3=m*Cp_steam*dT/T\n", + "here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\n", + "R=in KJ/kg K 0.46\n", + "now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\n", + "total entropy change(deltaS) in KJ/K= 87.24\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.2, Page:144 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\")\n", + "import scipy\n", + "from scipy import integrate\n", + "##just an example function\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "T1=(27.+273.);#temperature of water in K\n", + "T2=(100.+273.);#steam temperature of water in K\n", + "m=5.;#mass of water in kg\n", + "q=2260.;#heat of vaporisation at 100 degree celcius in KJ/kg\n", + "Cp=4.2;#specific heat of water at constant pressure in KJ/kg K\n", + "M=18.;#molar mass for water/steam \n", + "R1=8.314;#gas constant in KJ/kg K\n", + "print(\"total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\")\n", + "Q1=m*Cp*(T2-T1)\n", + "print(\"deltaS1=Q1/T1,where Q1=m*Cp*deltaT\")\n", + "print(\"heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\")\n", + "print(\"Q1=\"),round(Q1,2)\n", + "deltaS1=Q1/T1\n", + "print(\"deltaS1=Q1/T1 in KJ/K\"),round(deltaS1,2)\n", + "Q2=m*q\n", + "print(\"now heat of vaporisation(Q2)=in KJ\"),round(Q2,2)\n", + "print(\"entropy change during phase transformation(deltaS2)in KJ/K\")\n", + "deltaS2=Q2/T2\n", + "print(\"deltaS2=\"),round(deltaS2,2)\n", + "print(\"entropy change during steam temperature rise(deltaS3)in KJ/K\")\n", + "print(\"deltaS3=m*Cp_steam*dT/T\")\n", + "print(\"here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\")\n", + "R=R1/M\n", + "print(\"R=in KJ/kg K\"),round(R,2)\n", + "T2=(100+273.15);#steam temperature of water in K\n", + "T3=(400+273.15);#temperature of steam in K\n", + "print(\"now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\")\n", + "#function y = f(T), y =(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T , endfunction\n", + "def fun1(x):\n", + "\ty=(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T\n", + "\treturn y\n", + "\n", + "#deltaS3 =scipy.integrate.quad(f,T2, T3) \n", + "deltaS3=51.84;#approximately\n", + "deltaS=deltaS1+deltaS2+deltaS3\n", + "print(\"total entropy change(deltaS) in KJ/K=\"),round(deltaS,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.3;pg no: 145" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.3, Page:145 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\n", + "gas constant for oxygen(R)in KJ/kg K\n", + "R= 0.26\n", + "for reversible process the change in entropy may be given as\n", + "deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\n", + "so entropy change=deltaS= in (KJ/kg K) -0.29\n" + ] + } + ], + "source": [ + "#cal of entropy change\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.3, Page:145 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\")\n", + "R1=8.314;#gas constant in KJ/kg K\n", + "M=32;#molar mass for O2 \n", + "T1=(27+273);#initial temperature of O2 in K\n", + "p1=125;#initial pressure of O2 in Kpa\n", + "p2=375;#final pressure of O2 in Kpa\n", + "Cp=1.004;#specific heat of air at constant pressure in KJ/kg K\n", + "print(\"gas constant for oxygen(R)in KJ/kg K\")\n", + "R=R1/M\n", + "print(\"R=\"),round(R,2)\n", + "print(\"for reversible process the change in entropy may be given as\")\n", + "print(\"deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\")\n", + "T2=T1;#isothermal process\n", + "deltaS=(Cp*math.log(T2/T1))-(R*math.log(p2/p1))\n", + "print(\"so entropy change=deltaS= in (KJ/kg K)\"),round(deltaS,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.4;pg no: 145" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.4, Page:145 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\n", + "entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\n", + "where deltaS_block=m*C*log(T2/T1)\n", + "here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\n", + "therefore deltaS_block=in KJ/K -0.14\n", + "heat loss by block =heat gained by water(Q)in KJ\n", + "Q=-m*C*(T1-T2) -49.13\n", + "therefore deltaS_water=-Q/T2 in KJ/K 0.16\n", + "thus deltaS_universe=in J/K 27.16\n" + ] + } + ], + "source": [ + "#cal of deltaS_universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.4, Page:145 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\")\n", + "T1=(150+273.15);#temperature of copper block in K\n", + "T2=(25+273.15);#temperature of sea water in K\n", + "m=1;#mass of copper block in kg\n", + "C=0.393;#heat capacity of copper in KJ/kg K\n", + "print(\"entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\")\n", + "print(\"where deltaS_block=m*C*log(T2/T1)\")\n", + "print(\"here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\")\n", + "deltaS_block=m*C*math.log(T2/T1)\n", + "print(\"therefore deltaS_block=in KJ/K\"),round(deltaS_block,2)\n", + "print(\"heat loss by block =heat gained by water(Q)in KJ\")\n", + "Q=-m*C*(T1-T2)\n", + "print(\"Q=-m*C*(T1-T2)\"),round(Q,2)\n", + "deltaS_water=-Q/T2\n", + "print(\"therefore deltaS_water=-Q/T2 in KJ/K\"),round(deltaS_water,2)\n", + "deltaS_universe=(deltaS_block+deltaS_water)*1000\n", + "print(\"thus deltaS_universe=in J/K\"),round(deltaS_universe,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.5;pg no: 146" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.5, Page:146 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\n", + "deltaS_universe=(deltaS_block+deltaS_seawater)\n", + "since block and sea water both are at same temperature so,\n", + "deltaS_universe=deltaS_seawater\n", + "conservation of energy equation yields,\n", + "Q-W=deltaU+deltaP.E+deltaK.E\n", + "since in this case,W=0,deltaK.E=0,deltaU=0\n", + "Q=deltaP.E\n", + "change in potential energy=deltaP.E=m*g*h in J\n", + "deltaS_universe=deltaS_seawater=Q/T in J/kg K\n", + "entropy change of universe(deltaS_universe)in J/kg K 6.54\n" + ] + } + ], + "source": [ + "#cal of entropy change of universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.5, Page:146 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\")\n", + "m=1;#mass of copper block in kg\n", + "T=(27+273);#temperature of copper block in K\n", + "h=200;#height from which copper block dropped in sea water in m\n", + "C=0.393;#heat capacity for copper in KJ/kg K\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"deltaS_universe=(deltaS_block+deltaS_seawater)\")\n", + "print(\"since block and sea water both are at same temperature so,\")\n", + "print(\"deltaS_universe=deltaS_seawater\")\n", + "print(\"conservation of energy equation yields,\")\n", + "print(\"Q-W=deltaU+deltaP.E+deltaK.E\")\n", + "print(\"since in this case,W=0,deltaK.E=0,deltaU=0\")\n", + "deltaPE=m*g*h\n", + "Q=deltaPE\n", + "print(\"Q=deltaP.E\")\n", + "print(\"change in potential energy=deltaP.E=m*g*h in J\")\n", + "print(\"deltaS_universe=deltaS_seawater=Q/T in J/kg K\")\n", + "deltaS_universe=Q/T\n", + "print(\"entropy change of universe(deltaS_universe)in J/kg K\"),round(deltaS_universe,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.6;pg no: 146" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.6, Page:146 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\n", + "here deltaS_universe=deltaS_block1+deltaS_block2\n", + "two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\n", + "then from energy conservation\n", + "m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\n", + "Tf=in K 374.18\n", + "hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\n", + "deltaS1=in KJ/K -0.05\n", + "entropy change in block 2(deltaS2)in KJ/K\n", + "deltaS2= 0.06\n", + "entropy change of universe(deltaS)=in KJ/K 0.01\n" + ] + } + ], + "source": [ + "#cal of entropy change of universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.6, Page:146 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\")\n", + "m1=1;#mass of first copper block in kg\n", + "m2=0.5;#mass of second copper block in kg\n", + "T1=(150+273.15);#temperature of first copper block in K\n", + "T2=(0+273.15);#temperature of second copper block in K\n", + "Cp_1=0.393;#heat capacity for copper block 1 in KJ/kg K\n", + "Cp_2=0.381;#heat capacity for copper block 2 in KJ/kg K\n", + "print(\"here deltaS_universe=deltaS_block1+deltaS_block2\")\n", + "print(\"two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\")\n", + "print(\"then from energy conservation\")\n", + "print(\"m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\")\n", + "Tf=((m1*Cp_1*T1)+(m2*Cp_2*T2))/(m1*Cp_1+m2*Cp_2)\n", + "print(\"Tf=in K\"),round(Tf,2)\n", + "print(\"hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\")\n", + "deltaS1=m1*Cp_1*math.log(Tf/T1)\n", + "print(\"deltaS1=in KJ/K\"),round(deltaS1,2)\n", + "print(\"entropy change in block 2(deltaS2)in KJ/K\")\n", + "deltaS2=m2*Cp_2*math.log(Tf/T2)\n", + "print(\"deltaS2=\"),round(deltaS2,2)\n", + "deltaS=deltaS1+deltaS2\n", + "print(\"entropy change of universe(deltaS)=in KJ/K\"),round(deltaS,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.7;pg no: 147" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.7, Page:147 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\n", + "NOTE=>in this question formula is derived which cannot be solve using python software\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.7, Page:147 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\")\n", + "print(\"NOTE=>in this question formula is derived which cannot be solve using python software\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.8;pg no: 148" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.8, Page:148 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\n", + "for irreversible operation of engine,\n", + "rate of entropy generation=Q1/T1+Q2/T2\n", + "W=Q1-Q2=>Q2=Q1-W in MW 3.0\n", + "entropy generated(deltaS_gen)in MW\n", + "deltaS_gen= 0.01\n", + "work lost(W_lost)in MW\n", + "W_lost=T2*deltaS_gen 4.0\n" + ] + } + ], + "source": [ + "#cal of work lost\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.8, Page:148 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\")\n", + "T1=1800.;#temperature of high temperature reservoir in K\n", + "T2=300.;#temperature of low temperature reservoir in K\n", + "Q1=5.;#heat addition in MW\n", + "W=2.;#work done in MW\n", + "print(\"for irreversible operation of engine,\")\n", + "print(\"rate of entropy generation=Q1/T1+Q2/T2\")\n", + "Q2=Q1-W\n", + "print(\"W=Q1-Q2=>Q2=Q1-W in MW\"),round(Q2,2)\n", + "print(\"entropy generated(deltaS_gen)in MW\")\n", + "deltaS_gen=Q1/T1+Q2/T2\n", + "print(\"deltaS_gen=\"),round(deltaS_gen,2)\n", + "Q1=-5;#heat addition in MW\n", + "print(\"work lost(W_lost)in MW\")\n", + "W_lost=T2*deltaS_gen\n", + "print(\"W_lost=T2*deltaS_gen\"),round(W_lost)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.9;pg no: 148" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.9, Page:148 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\n", + "system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\n", + "therefore,maximum heat(Q1)=(C*dT)in J\n", + "here C=0.05*T^2+0.10*T+0.085 in J/K\n", + "so Q1=(0.05*T^2+0.10*T+0.085)*dT\n", + "entropy change of system,deltaS_system=C*dT/T in J/K\n", + "so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\n", + "deltaS_reservoir=Q2/T2=(Q1-W)/T2 also,we know from entropy principle,deltaS_universe is greater than equal to 0\n", + "deltaS_universe=deltaS_system+deltaS_reservoir\n", + "thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\n", + "W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\n", + "hence maximum work in KJ= 435.34\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.9, Page:148 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\")\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "T1=500;#temperature of system in K\n", + "T2=300;#temperature of reservoir in K\n", + "print(\"system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\")\n", + "print(\"therefore,maximum heat(Q1)=(C*dT)in J\")\n", + "print(\"here C=0.05*T^2+0.10*T+0.085 in J/K\")\n", + "print(\"so Q1=(0.05*T^2+0.10*T+0.085)*dT\")\n", + "T=T1-T2\n", + "#Q1=(0.05*T**2+0.10*T+0.085)*dT\n", + "#function y = f(T), y = (0.05*T**2+0.10*T+0.085),endfunction\n", + "#Q1 = scipy.integrate.quad(fun1,T1, T2)\n", + "#Q1=-Q1\n", + "Q1=1641.35*10**3\n", + "print(\"entropy change of system,deltaS_system=C*dT/T in J/K\")\n", + "print(\"so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\")\n", + "#function y = k(T), y = (0.05*T**2+0.10*T+0.085)/T,endfunction\n", + "def fun1(x):\n", + "\ty = (0.05*T**2+0.10*T+0.085)/T\n", + "\treturn y\n", + "\n", + "#deltaS_system = scipy.integrate.quad(k,T1, T2)\n", + "deltaS_system=-4020.043\n", + "print(\"deltaS_reservoir=Q2/T2=(Q1-W)/T2\"),\n", + "print(\"also,we know from entropy principle,deltaS_universe is greater than equal to 0\")\n", + "print(\"deltaS_universe=deltaS_system+deltaS_reservoir\")\n", + "print(\"thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\")\n", + "print(\"W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\")\n", + "W=(Q1+deltaS_system*T2)/1000\n", + "print(\"hence maximum work in KJ=\"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.10;pg no: 149" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.10, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\n", + "for reversible adiabatic process governing equation for expansion,\n", + "P*V**1.4=constant\n", + "also,for such process entropy change=0\n", + "using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\n", + "final pressure(p2)in Mpa\n", + "p2= 0.24\n", + "from first law,second law and definition of enthalpy;\n", + "dH=T*dS+v*dP\n", + "for adiabatic process of reversible type,dS=0\n", + "so dH=v*dP\n", + "integrating both side H2-H1=deltaH=v*dP in KJ\n", + "so enthalpy change(deltaH)in KJ=268.8\n", + "and entropy change=0\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "\n", + "print\"Example 5.10, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\")\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "p1=3.;#initial pressure in Mpa\n", + "v1=0.05;#initial volume in m**3\n", + "v2=0.3;#final volume in m**3\n", + "print(\"for reversible adiabatic process governing equation for expansion,\")\n", + "print(\"P*V**1.4=constant\")\n", + "print(\"also,for such process entropy change=0\")\n", + "print(\"using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\")\n", + "print(\"final pressure(p2)in Mpa\")\n", + "p2=p1*(v1/v2)**1.4\n", + "print(\"p2=\"),round(p2,2)\n", + "print(\"from first law,second law and definition of enthalpy;\")\n", + "print(\"dH=T*dS+v*dP\")\n", + "print(\"for adiabatic process of reversible type,dS=0\")\n", + "dS=0;#for adiabatic process of reversible type\n", + "print(\"so dH=v*dP\")\n", + "print(\"integrating both side H2-H1=deltaH=v*dP in KJ\")\n", + "p1=3.*1000.;#initial pressure in Kpa\n", + "p2=244.;#final pressure in Kpa\n", + "#function y = f(p), y =(p1*(v1**1.4)/p)**(1/1.4)\n", + "def fun1(x):\n", + "\ty=(p1*(v1**1.4)/p2)**(1/1.4)\n", + "\treturn y\n", + "\n", + "deltaH = scipy.integrate.quad(fun1,p2,p1)\n", + "print (\"so enthalpy change(deltaH)in KJ=268.8\")\n", + "print(\"and entropy change=0\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.11;pg no: 150" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.11, Page:150 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\n", + "during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\n", + "a> change in entropy of air(deltaS_air)in J/K\n", + "deltaS_air= 1321.68\n", + "b> during free expansion on heat is gained or lost to surrounding so,\n", + "deltaS_surrounding=0\n", + "entropy change of surroundings=0\n", + "c> entropy change of universe(deltaS_universe)in J/K\n", + "deltaS_universe= 1321.68\n" + ] + } + ], + "source": [ + "#cal of deltaS_universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.11, Page:150 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\")\n", + "m=2;#mass of air in kg\n", + "v1=1;#initial volume of air in m^3\n", + "v2=10;#final volume of air in m^3\n", + "R=287;#gas constant in J/kg K\n", + "print(\"during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\")\n", + "print(\"a> change in entropy of air(deltaS_air)in J/K\")\n", + "deltaS_air=m*R*math.log(v2/v1)\n", + "print(\"deltaS_air=\"),round(deltaS_air,2)\n", + "print(\"b> during free expansion on heat is gained or lost to surrounding so,\")\n", + "print(\"deltaS_surrounding=0\")\n", + "print(\"entropy change of surroundings=0\")\n", + "deltaS_surrounding=0;#entropy change of surroundings\n", + "print(\"c> entropy change of universe(deltaS_universe)in J/K\")\n", + "deltaS_universe=deltaS_air+deltaS_surrounding\n", + "print(\"deltaS_universe=\"),round(deltaS_universe,2)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "##example 5.12;pg no: 150" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.12, Page:150 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\n", + "let initial and final states be denoted by 1 and 2\n", + "for poly tropic process pressure and temperature can be related as\n", + "(p2/p1)^((n-1)/n)=T2/T1\n", + "so temperature after compression(T2)=in K 1128.94\n", + "substituting in entropy change expression for polytropic process,\n", + "entropy change(deltaS)inKJ/kg K\n", + "deltaS= -0.24454\n", + "NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\n", + "total entropy change(deltaS)=in J/K -122.27\n" + ] + } + ], + "source": [ + "#cal of total entropy change\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.12, Page:150 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\")\n", + "m=0.5;#mass of air in kg\n", + "p1=1.013*10**5;#initial pressure of air in pa\n", + "p2=0.8*10**6;#final pressure of air in pa\n", + "T1=800;#initial temperature of air in K\n", + "n=1.2;#polytropic expansion constant\n", + "y=1.4;#expansion constant for air\n", + "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", + "print(\"let initial and final states be denoted by 1 and 2\")\n", + "print(\"for poly tropic process pressure and temperature can be related as\")\n", + "print(\"(p2/p1)^((n-1)/n)=T2/T1\")\n", + "T2=T1*(p2/p1)**((n-1)/n)\n", + "print(\"so temperature after compression(T2)=in K\"),round(T2,2)\n", + "print(\"substituting in entropy change expression for polytropic process,\") \n", + "print(\"entropy change(deltaS)inKJ/kg K\")\n", + "deltaS=Cv*((n-y)/(n-1))*math.log(T2/T1)\n", + "print(\"deltaS=\"),round(deltaS,5)\n", + "print(\"NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\")\n", + "deltaS=m*deltaS*1000\n", + "print(\"total entropy change(deltaS)=in J/K\"),round(deltaS,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.13;pg no: 151" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.13, Page:151 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\n", + "NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.13, Page:151 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\")\n", + "print(\"NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.14;pg no: 152" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.14, Page:152 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\n", + "clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\n", + "K=dQ/T=Q1/T1-Q2/T2\n", + "i> for Q2=200 kcal/s\n", + "K=in kcal/s K 0.0\n", + "as K is not greater than 0,therefore under these conditions engine is not possible\n", + "ii> for Q2=400 kcal/s\n", + "K=in kcal/s K -1.0\n", + "as K is less than 0,so engine is feasible and cycle is reversible\n", + "iii> for Q2=250 kcal/s\n", + "K=in kcal/s K 0.0\n", + "as K=0,so engine is feasible and cycle is reversible\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.14, Page:152 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\")\n", + "Q1=500;#heat supplied by source in kcal/s\n", + "T1=600;#temperature of source in K\n", + "T2=300;#temperature of sink in K\n", + "print(\"clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\")\n", + "print(\"K=dQ/T=Q1/T1-Q2/T2\")\n", + "print(\"i> for Q2=200 kcal/s\")\n", + "Q2=200;#heat rejected by sink in kcal/s\n", + "K=Q1/T1-Q2/T2\n", + "print(\"K=in kcal/s K\"),round(K,2)\n", + "print(\"as K is not greater than 0,therefore under these conditions engine is not possible\")\n", + "print(\"ii> for Q2=400 kcal/s\")\n", + "Q2=400;#heat rejected by sink in kcal/s\n", + "K=Q1/T1-Q2/T2\n", + "print(\"K=in kcal/s K\"),round(K,2)\n", + "print(\"as K is less than 0,so engine is feasible and cycle is reversible\")\n", + "print(\"iii> for Q2=250 kcal/s\")\n", + "Q2=250;#heat rejected by sink in kcal/s\n", + "K=Q1/T1-Q2/T2\n", + "print(\"K=in kcal/s K\"),round(K,2)\n", + "print(\"as K=0,so engine is feasible and cycle is reversible\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.15;pg no: 152" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.15, Page:152 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\n", + "let the two points be given as states 1 and 2,\n", + "let us assume flow to be from 1 to 2\n", + "so entropy change(deltaS1_2)=s1-s2=in KJ/kg K -0.0\n", + "deltaS1_2=s1-s2=0.01254 KJ/kg K\n", + "it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\n", + "hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.15, Page:152 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\")\n", + "p1=0.5;#initial pressure of air in Mpa\n", + "T1=400;#initial temperature of air in K\n", + "p2=0.3;#final pressure of air in Mpa\n", + "T2=350;#initial temperature of air in K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", + "print(\"let the two points be given as states 1 and 2,\")\n", + "print(\"let us assume flow to be from 1 to 2\")\n", + "deltaS1_2=Cp*math.log(T1/T2)-R*math.log(p1/p2)\n", + "print(\"so entropy change(deltaS1_2)=s1-s2=in KJ/kg K\"),round(deltaS1_2)\n", + "print(\"deltaS1_2=s1-s2=0.01254 KJ/kg K\")\n", + "print(\"it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\")\n", + "print(\"hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.16;pg no: 153" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.16, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\n", + "NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.16, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\")\n", + "print(\"NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.17;pg no: 153" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.17, Page:153 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\n", + "total heat added(Q)in KJ\n", + "Q= 1800.0\n", + "for heat addition process 1-2\n", + "Q12=T1*(s2-s1)\n", + "deltaS=s2-s1=in KJ/K 2.0\n", + "or heat addition process 3-4\n", + "Q34=T3*(s4-s3)\n", + "deltaS=s4-s3=in KJ/K 2.0\n", + "or heat rejected in process 5-6(Q56)in KJ\n", + "Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)= 1200.0\n", + "net work done=net heat(W_net)in KJ\n", + "W_net=(Q12+Q34)-Q56 600.0\n", + "thermal efficiency of cycle(n)= 0.33\n", + "or n=n*100 % 33.33\n", + "so work done=600 KJ and thermal efficiency=33.33 %\n" + ] + } + ], + "source": [ + "#cal of work done and thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.17, Page:153 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\")\n", + "Q12=1000.;#heat added during process 1-2 in KJ\n", + "Q34=800.;#heat added during process 3-4 in KJ\n", + "T1=500.;#operating temperature for process 1-2\n", + "T3=400.;#operating temperature for process 3-4\n", + "T5=300.;#operating temperature for process 5-6\n", + "T2=T1;#isothermal process\n", + "T4=T3;#isothermal process\n", + "T6=T5;#isothermal process\n", + "print(\"total heat added(Q)in KJ\")\n", + "Q=Q12+Q34\n", + "print(\"Q=\"),round(Q,2)\n", + "print(\"for heat addition process 1-2\")\n", + "print(\"Q12=T1*(s2-s1)\")\n", + "deltaS=Q12/T1\n", + "print(\"deltaS=s2-s1=in KJ/K\"),round(deltaS,2)\n", + "print(\"or heat addition process 3-4\")\n", + "print(\"Q34=T3*(s4-s3)\")\n", + "deltaS=Q34/T3\n", + "print(\"deltaS=s4-s3=in KJ/K\"),round(deltaS,2)\n", + "print(\"or heat rejected in process 5-6(Q56)in KJ\")\n", + "Q56=T5*(deltaS+deltaS)\n", + "print(\"Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)=\"),round(Q56,2)\n", + "print(\"net work done=net heat(W_net)in KJ\")\n", + "W_net=(Q12+Q34)-Q56\n", + "print(\"W_net=(Q12+Q34)-Q56\"),round(W_net,2)\n", + "n=W_net/Q\n", + "print(\"thermal efficiency of cycle(n)=\"),round(n,2)\n", + "n=n*100\n", + "print(\"or n=n*100 %\"),round(n,2) \n", + "print(\"so work done=600 KJ and thermal efficiency=33.33 %\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.18;pg no: 154" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.18, Page:154 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\n", + "let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\n", + "here Q1-Q2=W\n", + "so heat supplied by source(Q1)in KW= 30.0\n", + "also given that,Q1_a=0.7*Q1_b.......eq 1\n", + "Q1_c=Q1-(0.7*Q1_b+Q1_b)\n", + "Q1_c=Q1-1.7*Q1_b........eq 2\n", + "for reversible engine\n", + "Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\n", + "substitute eq 1 and eq 2 in eq 3 we get, \n", + "heat supplied by reservoir of 700 K(Q1_b)in KJ/s\n", + "Q1_b= 35.39\n", + "so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\n", + "Q1_a= 24.78\n", + "and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\n", + "Q1_c=Q1-1.7*Q1_b -30.17\n", + "so heat supplied by reservoir at 800 K(Q1_a)= 24.78\n", + "so heat supplied by reservoir at 700 K(Q1_b)= 35.39\n", + "so heat supplied by reservoir at 600 K(Q1_c)= -30.17\n", + "NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\n" + ] + } + ], + "source": [ + "#cal of heat supplied by reservoir at 800,700,600\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.18, Page:154 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\")\n", + "T1_a=800.;#temperature of reservoir a in K\n", + "T1_b=700.;#temperature of reservoir b in K\n", + "T1_c=600.;#temperature of reservoir c in K\n", + "T2=320.;#temperature of sink in K\n", + "W=20.;#work done in KW\n", + "Q2=10.;#heat rejected to sink in KW\n", + "print(\"let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\")\n", + "print(\"here Q1-Q2=W\")\n", + "Q1=W+Q2\n", + "print(\"so heat supplied by source(Q1)in KW=\"),round(Q1,2)\n", + "print(\"also given that,Q1_a=0.7*Q1_b.......eq 1\")\n", + "print(\"Q1_c=Q1-(0.7*Q1_b+Q1_b)\")\n", + "print(\"Q1_c=Q1-1.7*Q1_b........eq 2\")\n", + "print(\"for reversible engine\")\n", + "print(\"Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\")\n", + "print(\"substitute eq 1 and eq 2 in eq 3 we get, \")\n", + "print(\"heat supplied by reservoir of 700 K(Q1_b)in KJ/s\")\n", + "Q1_b=((Q2/T2)-(Q1/T1_c))/((0.7/T1_a)+(1/T1_b)-(1.7/T1_c))\n", + "print(\"Q1_b=\"),round(Q1_b,2)\n", + "print(\"so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\")\n", + "Q1_a=0.7*Q1_b\n", + "print(\"Q1_a=\"),round(Q1_a,2)\n", + "print(\"and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\")\n", + "Q1_c=Q1-1.7*Q1_b\n", + "print(\"Q1_c=Q1-1.7*Q1_b\"),round(Q1_c,2)\n", + "print(\"so heat supplied by reservoir at 800 K(Q1_a)=\"),round(Q1_a,2)\n", + "print(\"so heat supplied by reservoir at 700 K(Q1_b)=\"),round(Q1_b,2)\n", + "print(\"so heat supplied by reservoir at 600 K(Q1_c)=\"),round(Q1_c,2)\n", + "print(\"NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter5_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter5_2.ipynb new file mode 100755 index 00000000..cc42cd6f --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter5_2.ipynb @@ -0,0 +1,1124 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5:Entropy" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.1;pg no: 144" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.1, Page:144 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\n", + "entropy change may be given as,\n", + "s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\n", + "here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\n", + "so change in entropy(deltaS)in KJ/kg K\n", + "deltaS= 0.263\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.1, Page:144 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\")\n", + "p1=5.;#initial pressure of air\n", + "T1=(27.+273.);#temperature of air in K\n", + "p2=2.;#final pressure of air in K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cp_air=1.004;#specific heat of air at constant pressure in KJ/kg K\n", + "print(\"entropy change may be given as,\")\n", + "print(\"s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\")\n", + "print(\"here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\")\n", + "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", + "deltaS=(Cp_air*0)-(R*math.log(p2/p1))\n", + "print(\"deltaS=\"),round(deltaS,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.2;pg no: 144" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.2, Page:144 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\n", + "total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\n", + "deltaS1=Q1/T1,where Q1=m*Cp*deltaT\n", + "heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\n", + "Q1= 1533.0\n", + "deltaS1=Q1/T1 in KJ/K 5.11\n", + "now heat of vaporisation(Q2)=in KJ 11300.0\n", + "entropy change during phase transformation(deltaS2)in KJ/K\n", + "deltaS2= 30.29\n", + "entropy change during steam temperature rise(deltaS3)in KJ/K\n", + "deltaS3=m*Cp_steam*dT/T\n", + "here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\n", + "R=in KJ/kg K 0.46\n", + "now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\n", + "total entropy change(deltaS) in KJ/K= 87.24\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.2, Page:144 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\")\n", + "import scipy\n", + "from scipy import integrate\n", + "##just an example function\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "T1=(27.+273.);#temperature of water in K\n", + "T2=(100.+273.);#steam temperature of water in K\n", + "m=5.;#mass of water in kg\n", + "q=2260.;#heat of vaporisation at 100 degree celcius in KJ/kg\n", + "Cp=4.2;#specific heat of water at constant pressure in KJ/kg K\n", + "M=18.;#molar mass for water/steam \n", + "R1=8.314;#gas constant in KJ/kg K\n", + "print(\"total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\")\n", + "Q1=m*Cp*(T2-T1)\n", + "print(\"deltaS1=Q1/T1,where Q1=m*Cp*deltaT\")\n", + "print(\"heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\")\n", + "print(\"Q1=\"),round(Q1,2)\n", + "deltaS1=Q1/T1\n", + "print(\"deltaS1=Q1/T1 in KJ/K\"),round(deltaS1,2)\n", + "Q2=m*q\n", + "print(\"now heat of vaporisation(Q2)=in KJ\"),round(Q2,2)\n", + "print(\"entropy change during phase transformation(deltaS2)in KJ/K\")\n", + "deltaS2=Q2/T2\n", + "print(\"deltaS2=\"),round(deltaS2,2)\n", + "print(\"entropy change during steam temperature rise(deltaS3)in KJ/K\")\n", + "print(\"deltaS3=m*Cp_steam*dT/T\")\n", + "print(\"here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\")\n", + "R=R1/M\n", + "print(\"R=in KJ/kg K\"),round(R,2)\n", + "T2=(100+273.15);#steam temperature of water in K\n", + "T3=(400+273.15);#temperature of steam in K\n", + "print(\"now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\")\n", + "#function y = f(T), y =(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T , endfunction\n", + "def fun1(x):\n", + "\ty=(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T\n", + "\treturn y\n", + "\n", + "#deltaS3 =scipy.integrate.quad(f,T2, T3) \n", + "deltaS3=51.84;#approximately\n", + "deltaS=deltaS1+deltaS2+deltaS3\n", + "print(\"total entropy change(deltaS) in KJ/K=\"),round(deltaS,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.3;pg no: 145" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.3, Page:145 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\n", + "gas constant for oxygen(R)in KJ/kg K\n", + "R= 0.26\n", + "for reversible process the change in entropy may be given as\n", + "deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\n", + "so entropy change=deltaS= in (KJ/kg K) -0.29\n" + ] + } + ], + "source": [ + "#cal of entropy change\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.3, Page:145 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\")\n", + "R1=8.314;#gas constant in KJ/kg K\n", + "M=32;#molar mass for O2 \n", + "T1=(27+273);#initial temperature of O2 in K\n", + "p1=125;#initial pressure of O2 in Kpa\n", + "p2=375;#final pressure of O2 in Kpa\n", + "Cp=1.004;#specific heat of air at constant pressure in KJ/kg K\n", + "print(\"gas constant for oxygen(R)in KJ/kg K\")\n", + "R=R1/M\n", + "print(\"R=\"),round(R,2)\n", + "print(\"for reversible process the change in entropy may be given as\")\n", + "print(\"deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\")\n", + "T2=T1;#isothermal process\n", + "deltaS=(Cp*math.log(T2/T1))-(R*math.log(p2/p1))\n", + "print(\"so entropy change=deltaS= in (KJ/kg K)\"),round(deltaS,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.4;pg no: 145" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.4, Page:145 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\n", + "entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\n", + "where deltaS_block=m*C*log(T2/T1)\n", + "here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\n", + "therefore deltaS_block=in KJ/K -0.14\n", + "heat loss by block =heat gained by water(Q)in KJ\n", + "Q=-m*C*(T1-T2) -49.13\n", + "therefore deltaS_water=-Q/T2 in KJ/K 0.16\n", + "thus deltaS_universe=in J/K 27.16\n" + ] + } + ], + "source": [ + "#cal of deltaS_universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.4, Page:145 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\")\n", + "T1=(150+273.15);#temperature of copper block in K\n", + "T2=(25+273.15);#temperature of sea water in K\n", + "m=1;#mass of copper block in kg\n", + "C=0.393;#heat capacity of copper in KJ/kg K\n", + "print(\"entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\")\n", + "print(\"where deltaS_block=m*C*log(T2/T1)\")\n", + "print(\"here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\")\n", + "deltaS_block=m*C*math.log(T2/T1)\n", + "print(\"therefore deltaS_block=in KJ/K\"),round(deltaS_block,2)\n", + "print(\"heat loss by block =heat gained by water(Q)in KJ\")\n", + "Q=-m*C*(T1-T2)\n", + "print(\"Q=-m*C*(T1-T2)\"),round(Q,2)\n", + "deltaS_water=-Q/T2\n", + "print(\"therefore deltaS_water=-Q/T2 in KJ/K\"),round(deltaS_water,2)\n", + "deltaS_universe=(deltaS_block+deltaS_water)*1000\n", + "print(\"thus deltaS_universe=in J/K\"),round(deltaS_universe,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.5;pg no: 146" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.5, Page:146 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\n", + "deltaS_universe=(deltaS_block+deltaS_seawater)\n", + "since block and sea water both are at same temperature so,\n", + "deltaS_universe=deltaS_seawater\n", + "conservation of energy equation yields,\n", + "Q-W=deltaU+deltaP.E+deltaK.E\n", + "since in this case,W=0,deltaK.E=0,deltaU=0\n", + "Q=deltaP.E\n", + "change in potential energy=deltaP.E=m*g*h in J\n", + "deltaS_universe=deltaS_seawater=Q/T in J/kg K\n", + "entropy change of universe(deltaS_universe)in J/kg K 6.54\n" + ] + } + ], + "source": [ + "#cal of entropy change of universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.5, Page:146 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\")\n", + "m=1;#mass of copper block in kg\n", + "T=(27+273);#temperature of copper block in K\n", + "h=200;#height from which copper block dropped in sea water in m\n", + "C=0.393;#heat capacity for copper in KJ/kg K\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"deltaS_universe=(deltaS_block+deltaS_seawater)\")\n", + "print(\"since block and sea water both are at same temperature so,\")\n", + "print(\"deltaS_universe=deltaS_seawater\")\n", + "print(\"conservation of energy equation yields,\")\n", + "print(\"Q-W=deltaU+deltaP.E+deltaK.E\")\n", + "print(\"since in this case,W=0,deltaK.E=0,deltaU=0\")\n", + "deltaPE=m*g*h\n", + "Q=deltaPE\n", + "print(\"Q=deltaP.E\")\n", + "print(\"change in potential energy=deltaP.E=m*g*h in J\")\n", + "print(\"deltaS_universe=deltaS_seawater=Q/T in J/kg K\")\n", + "deltaS_universe=Q/T\n", + "print(\"entropy change of universe(deltaS_universe)in J/kg K\"),round(deltaS_universe,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.6;pg no: 146" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.6, Page:146 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\n", + "here deltaS_universe=deltaS_block1+deltaS_block2\n", + "two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\n", + "then from energy conservation\n", + "m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\n", + "Tf=in K 374.18\n", + "hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\n", + "deltaS1=in KJ/K -0.05\n", + "entropy change in block 2(deltaS2)in KJ/K\n", + "deltaS2= 0.06\n", + "entropy change of universe(deltaS)=in KJ/K 0.01\n" + ] + } + ], + "source": [ + "#cal of entropy change of universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.6, Page:146 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\")\n", + "m1=1;#mass of first copper block in kg\n", + "m2=0.5;#mass of second copper block in kg\n", + "T1=(150+273.15);#temperature of first copper block in K\n", + "T2=(0+273.15);#temperature of second copper block in K\n", + "Cp_1=0.393;#heat capacity for copper block 1 in KJ/kg K\n", + "Cp_2=0.381;#heat capacity for copper block 2 in KJ/kg K\n", + "print(\"here deltaS_universe=deltaS_block1+deltaS_block2\")\n", + "print(\"two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\")\n", + "print(\"then from energy conservation\")\n", + "print(\"m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\")\n", + "Tf=((m1*Cp_1*T1)+(m2*Cp_2*T2))/(m1*Cp_1+m2*Cp_2)\n", + "print(\"Tf=in K\"),round(Tf,2)\n", + "print(\"hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\")\n", + "deltaS1=m1*Cp_1*math.log(Tf/T1)\n", + "print(\"deltaS1=in KJ/K\"),round(deltaS1,2)\n", + "print(\"entropy change in block 2(deltaS2)in KJ/K\")\n", + "deltaS2=m2*Cp_2*math.log(Tf/T2)\n", + "print(\"deltaS2=\"),round(deltaS2,2)\n", + "deltaS=deltaS1+deltaS2\n", + "print(\"entropy change of universe(deltaS)=in KJ/K\"),round(deltaS,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.7;pg no: 147" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.7, Page:147 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\n", + "NOTE=>in this question formula is derived which cannot be solve using python software\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.7, Page:147 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\")\n", + "print(\"NOTE=>in this question formula is derived which cannot be solve using python software\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.8;pg no: 148" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.8, Page:148 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\n", + "for irreversible operation of engine,\n", + "rate of entropy generation=Q1/T1+Q2/T2\n", + "W=Q1-Q2=>Q2=Q1-W in MW 3.0\n", + "entropy generated(deltaS_gen)in MW\n", + "deltaS_gen= 0.01\n", + "work lost(W_lost)in MW\n", + "W_lost=T2*deltaS_gen 4.0\n" + ] + } + ], + "source": [ + "#cal of work lost\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.8, Page:148 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\")\n", + "T1=1800.;#temperature of high temperature reservoir in K\n", + "T2=300.;#temperature of low temperature reservoir in K\n", + "Q1=5.;#heat addition in MW\n", + "W=2.;#work done in MW\n", + "print(\"for irreversible operation of engine,\")\n", + "print(\"rate of entropy generation=Q1/T1+Q2/T2\")\n", + "Q2=Q1-W\n", + "print(\"W=Q1-Q2=>Q2=Q1-W in MW\"),round(Q2,2)\n", + "print(\"entropy generated(deltaS_gen)in MW\")\n", + "deltaS_gen=Q1/T1+Q2/T2\n", + "print(\"deltaS_gen=\"),round(deltaS_gen,2)\n", + "Q1=-5;#heat addition in MW\n", + "print(\"work lost(W_lost)in MW\")\n", + "W_lost=T2*deltaS_gen\n", + "print(\"W_lost=T2*deltaS_gen\"),round(W_lost)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.9;pg no: 148" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.9, Page:148 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\n", + "system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\n", + "therefore,maximum heat(Q1)=(C*dT)in J\n", + "here C=0.05*T^2+0.10*T+0.085 in J/K\n", + "so Q1=(0.05*T^2+0.10*T+0.085)*dT\n", + "entropy change of system,deltaS_system=C*dT/T in J/K\n", + "so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\n", + "deltaS_reservoir=Q2/T2=(Q1-W)/T2 also,we know from entropy principle,deltaS_universe is greater than equal to 0\n", + "deltaS_universe=deltaS_system+deltaS_reservoir\n", + "thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\n", + "W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\n", + "hence maximum work in KJ= 435.34\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.9, Page:148 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\")\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "T1=500;#temperature of system in K\n", + "T2=300;#temperature of reservoir in K\n", + "print(\"system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\")\n", + "print(\"therefore,maximum heat(Q1)=(C*dT)in J\")\n", + "print(\"here C=0.05*T^2+0.10*T+0.085 in J/K\")\n", + "print(\"so Q1=(0.05*T^2+0.10*T+0.085)*dT\")\n", + "T=T1-T2\n", + "#Q1=(0.05*T**2+0.10*T+0.085)*dT\n", + "#function y = f(T), y = (0.05*T**2+0.10*T+0.085),endfunction\n", + "#Q1 = scipy.integrate.quad(fun1,T1, T2)\n", + "#Q1=-Q1\n", + "Q1=1641.35*10**3\n", + "print(\"entropy change of system,deltaS_system=C*dT/T in J/K\")\n", + "print(\"so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\")\n", + "#function y = k(T), y = (0.05*T**2+0.10*T+0.085)/T,endfunction\n", + "def fun1(x):\n", + "\ty = (0.05*T**2+0.10*T+0.085)/T\n", + "\treturn y\n", + "\n", + "#deltaS_system = scipy.integrate.quad(k,T1, T2)\n", + "deltaS_system=-4020.043\n", + "print(\"deltaS_reservoir=Q2/T2=(Q1-W)/T2\"),\n", + "print(\"also,we know from entropy principle,deltaS_universe is greater than equal to 0\")\n", + "print(\"deltaS_universe=deltaS_system+deltaS_reservoir\")\n", + "print(\"thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\")\n", + "print(\"W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\")\n", + "W=(Q1+deltaS_system*T2)/1000\n", + "print(\"hence maximum work in KJ=\"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.10;pg no: 149" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.10, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\n", + "for reversible adiabatic process governing equation for expansion,\n", + "P*V**1.4=constant\n", + "also,for such process entropy change=0\n", + "using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\n", + "final pressure(p2)in Mpa\n", + "p2= 0.24\n", + "from first law,second law and definition of enthalpy;\n", + "dH=T*dS+v*dP\n", + "for adiabatic process of reversible type,dS=0\n", + "so dH=v*dP\n", + "integrating both side H2-H1=deltaH=v*dP in KJ\n", + "so enthalpy change(deltaH)in KJ=268.8\n", + "and entropy change=0\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "\n", + "print\"Example 5.10, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\")\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "p1=3.;#initial pressure in Mpa\n", + "v1=0.05;#initial volume in m**3\n", + "v2=0.3;#final volume in m**3\n", + "print(\"for reversible adiabatic process governing equation for expansion,\")\n", + "print(\"P*V**1.4=constant\")\n", + "print(\"also,for such process entropy change=0\")\n", + "print(\"using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\")\n", + "print(\"final pressure(p2)in Mpa\")\n", + "p2=p1*(v1/v2)**1.4\n", + "print(\"p2=\"),round(p2,2)\n", + "print(\"from first law,second law and definition of enthalpy;\")\n", + "print(\"dH=T*dS+v*dP\")\n", + "print(\"for adiabatic process of reversible type,dS=0\")\n", + "dS=0;#for adiabatic process of reversible type\n", + "print(\"so dH=v*dP\")\n", + "print(\"integrating both side H2-H1=deltaH=v*dP in KJ\")\n", + "p1=3.*1000.;#initial pressure in Kpa\n", + "p2=244.;#final pressure in Kpa\n", + "#function y = f(p), y =(p1*(v1**1.4)/p)**(1/1.4)\n", + "def fun1(x):\n", + "\ty=(p1*(v1**1.4)/p2)**(1/1.4)\n", + "\treturn y\n", + "\n", + "deltaH = scipy.integrate.quad(fun1,p2,p1)\n", + "print (\"so enthalpy change(deltaH)in KJ=268.8\")\n", + "print(\"and entropy change=0\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.11;pg no: 150" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.11, Page:150 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\n", + "during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\n", + "a> change in entropy of air(deltaS_air)in J/K\n", + "deltaS_air= 1321.68\n", + "b> during free expansion on heat is gained or lost to surrounding so,\n", + "deltaS_surrounding=0\n", + "entropy change of surroundings=0\n", + "c> entropy change of universe(deltaS_universe)in J/K\n", + "deltaS_universe= 1321.68\n" + ] + } + ], + "source": [ + "#cal of deltaS_universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.11, Page:150 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\")\n", + "m=2;#mass of air in kg\n", + "v1=1;#initial volume of air in m^3\n", + "v2=10;#final volume of air in m^3\n", + "R=287;#gas constant in J/kg K\n", + "print(\"during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\")\n", + "print(\"a> change in entropy of air(deltaS_air)in J/K\")\n", + "deltaS_air=m*R*math.log(v2/v1)\n", + "print(\"deltaS_air=\"),round(deltaS_air,2)\n", + "print(\"b> during free expansion on heat is gained or lost to surrounding so,\")\n", + "print(\"deltaS_surrounding=0\")\n", + "print(\"entropy change of surroundings=0\")\n", + "deltaS_surrounding=0;#entropy change of surroundings\n", + "print(\"c> entropy change of universe(deltaS_universe)in J/K\")\n", + "deltaS_universe=deltaS_air+deltaS_surrounding\n", + "print(\"deltaS_universe=\"),round(deltaS_universe,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "##example 5.12;pg no: 150" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.12, Page:150 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\n", + "let initial and final states be denoted by 1 and 2\n", + "for poly tropic process pressure and temperature can be related as\n", + "(p2/p1)^((n-1)/n)=T2/T1\n", + "so temperature after compression(T2)=in K 1128.94\n", + "substituting in entropy change expression for polytropic process,\n", + "entropy change(deltaS)inKJ/kg K\n", + "deltaS= -0.24454\n", + "NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\n", + "total entropy change(deltaS)=in J/K -122.27\n" + ] + } + ], + "source": [ + "#cal of total entropy change\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.12, Page:150 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\")\n", + "m=0.5;#mass of air in kg\n", + "p1=1.013*10**5;#initial pressure of air in pa\n", + "p2=0.8*10**6;#final pressure of air in pa\n", + "T1=800;#initial temperature of air in K\n", + "n=1.2;#polytropic expansion constant\n", + "y=1.4;#expansion constant for air\n", + "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", + "print(\"let initial and final states be denoted by 1 and 2\")\n", + "print(\"for poly tropic process pressure and temperature can be related as\")\n", + "print(\"(p2/p1)^((n-1)/n)=T2/T1\")\n", + "T2=T1*(p2/p1)**((n-1)/n)\n", + "print(\"so temperature after compression(T2)=in K\"),round(T2,2)\n", + "print(\"substituting in entropy change expression for polytropic process,\") \n", + "print(\"entropy change(deltaS)inKJ/kg K\")\n", + "deltaS=Cv*((n-y)/(n-1))*math.log(T2/T1)\n", + "print(\"deltaS=\"),round(deltaS,5)\n", + "print(\"NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\")\n", + "deltaS=m*deltaS*1000\n", + "print(\"total entropy change(deltaS)=in J/K\"),round(deltaS,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.13;pg no: 151" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.13, Page:151 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\n", + "NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.13, Page:151 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\")\n", + "print(\"NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.14;pg no: 152" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.14, Page:152 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\n", + "clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\n", + "K=dQ/T=Q1/T1-Q2/T2\n", + "i> for Q2=200 kcal/s\n", + "K=in kcal/s K 0.0\n", + "as K is not greater than 0,therefore under these conditions engine is not possible\n", + "ii> for Q2=400 kcal/s\n", + "K=in kcal/s K -1.0\n", + "as K is less than 0,so engine is feasible and cycle is reversible\n", + "iii> for Q2=250 kcal/s\n", + "K=in kcal/s K 0.0\n", + "as K=0,so engine is feasible and cycle is reversible\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.14, Page:152 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\")\n", + "Q1=500;#heat supplied by source in kcal/s\n", + "T1=600;#temperature of source in K\n", + "T2=300;#temperature of sink in K\n", + "print(\"clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\")\n", + "print(\"K=dQ/T=Q1/T1-Q2/T2\")\n", + "print(\"i> for Q2=200 kcal/s\")\n", + "Q2=200;#heat rejected by sink in kcal/s\n", + "K=Q1/T1-Q2/T2\n", + "print(\"K=in kcal/s K\"),round(K,2)\n", + "print(\"as K is not greater than 0,therefore under these conditions engine is not possible\")\n", + "print(\"ii> for Q2=400 kcal/s\")\n", + "Q2=400;#heat rejected by sink in kcal/s\n", + "K=Q1/T1-Q2/T2\n", + "print(\"K=in kcal/s K\"),round(K,2)\n", + "print(\"as K is less than 0,so engine is feasible and cycle is reversible\")\n", + "print(\"iii> for Q2=250 kcal/s\")\n", + "Q2=250;#heat rejected by sink in kcal/s\n", + "K=Q1/T1-Q2/T2\n", + "print(\"K=in kcal/s K\"),round(K,2)\n", + "print(\"as K=0,so engine is feasible and cycle is reversible\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.15;pg no: 152" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.15, Page:152 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\n", + "let the two points be given as states 1 and 2,\n", + "let us assume flow to be from 1 to 2\n", + "so entropy change(deltaS1_2)=s1-s2=in KJ/kg K -0.0\n", + "deltaS1_2=s1-s2=0.01254 KJ/kg K\n", + "it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\n", + "hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.15, Page:152 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\")\n", + "p1=0.5;#initial pressure of air in Mpa\n", + "T1=400;#initial temperature of air in K\n", + "p2=0.3;#final pressure of air in Mpa\n", + "T2=350;#initial temperature of air in K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", + "print(\"let the two points be given as states 1 and 2,\")\n", + "print(\"let us assume flow to be from 1 to 2\")\n", + "deltaS1_2=Cp*math.log(T1/T2)-R*math.log(p1/p2)\n", + "print(\"so entropy change(deltaS1_2)=s1-s2=in KJ/kg K\"),round(deltaS1_2)\n", + "print(\"deltaS1_2=s1-s2=0.01254 KJ/kg K\")\n", + "print(\"it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\")\n", + "print(\"hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.16;pg no: 153" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.16, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\n", + "NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.16, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\")\n", + "print(\"NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.17;pg no: 153" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.17, Page:153 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\n", + "total heat added(Q)in KJ\n", + "Q= 1800.0\n", + "for heat addition process 1-2\n", + "Q12=T1*(s2-s1)\n", + "deltaS=s2-s1=in KJ/K 2.0\n", + "or heat addition process 3-4\n", + "Q34=T3*(s4-s3)\n", + "deltaS=s4-s3=in KJ/K 2.0\n", + "or heat rejected in process 5-6(Q56)in KJ\n", + "Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)= 1200.0\n", + "net work done=net heat(W_net)in KJ\n", + "W_net=(Q12+Q34)-Q56 600.0\n", + "thermal efficiency of cycle(n)= 0.33\n", + "or n=n*100 % 33.33\n", + "so work done=600 KJ and thermal efficiency=33.33 %\n" + ] + } + ], + "source": [ + "#cal of work done and thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.17, Page:153 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\")\n", + "Q12=1000.;#heat added during process 1-2 in KJ\n", + "Q34=800.;#heat added during process 3-4 in KJ\n", + "T1=500.;#operating temperature for process 1-2\n", + "T3=400.;#operating temperature for process 3-4\n", + "T5=300.;#operating temperature for process 5-6\n", + "T2=T1;#isothermal process\n", + "T4=T3;#isothermal process\n", + "T6=T5;#isothermal process\n", + "print(\"total heat added(Q)in KJ\")\n", + "Q=Q12+Q34\n", + "print(\"Q=\"),round(Q,2)\n", + "print(\"for heat addition process 1-2\")\n", + "print(\"Q12=T1*(s2-s1)\")\n", + "deltaS=Q12/T1\n", + "print(\"deltaS=s2-s1=in KJ/K\"),round(deltaS,2)\n", + "print(\"or heat addition process 3-4\")\n", + "print(\"Q34=T3*(s4-s3)\")\n", + "deltaS=Q34/T3\n", + "print(\"deltaS=s4-s3=in KJ/K\"),round(deltaS,2)\n", + "print(\"or heat rejected in process 5-6(Q56)in KJ\")\n", + "Q56=T5*(deltaS+deltaS)\n", + "print(\"Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)=\"),round(Q56,2)\n", + "print(\"net work done=net heat(W_net)in KJ\")\n", + "W_net=(Q12+Q34)-Q56\n", + "print(\"W_net=(Q12+Q34)-Q56\"),round(W_net,2)\n", + "n=W_net/Q\n", + "print(\"thermal efficiency of cycle(n)=\"),round(n,2)\n", + "n=n*100\n", + "print(\"or n=n*100 %\"),round(n,2) \n", + "print(\"so work done=600 KJ and thermal efficiency=33.33 %\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.18;pg no: 154" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.18, Page:154 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\n", + "let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\n", + "here Q1-Q2=W\n", + "so heat supplied by source(Q1)in KW= 30.0\n", + "also given that,Q1_a=0.7*Q1_b.......eq 1\n", + "Q1_c=Q1-(0.7*Q1_b+Q1_b)\n", + "Q1_c=Q1-1.7*Q1_b........eq 2\n", + "for reversible engine\n", + "Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\n", + "substitute eq 1 and eq 2 in eq 3 we get, \n", + "heat supplied by reservoir of 700 K(Q1_b)in KJ/s\n", + "Q1_b= 35.39\n", + "so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\n", + "Q1_a= 24.78\n", + "and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\n", + "Q1_c=Q1-1.7*Q1_b -30.17\n", + "so heat supplied by reservoir at 800 K(Q1_a)= 24.78\n", + "so heat supplied by reservoir at 700 K(Q1_b)= 35.39\n", + "so heat supplied by reservoir at 600 K(Q1_c)= -30.17\n", + "NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\n" + ] + } + ], + "source": [ + "#cal of heat supplied by reservoir at 800,700,600\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.18, Page:154 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\")\n", + "T1_a=800.;#temperature of reservoir a in K\n", + "T1_b=700.;#temperature of reservoir b in K\n", + "T1_c=600.;#temperature of reservoir c in K\n", + "T2=320.;#temperature of sink in K\n", + "W=20.;#work done in KW\n", + "Q2=10.;#heat rejected to sink in KW\n", + "print(\"let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\")\n", + "print(\"here Q1-Q2=W\")\n", + "Q1=W+Q2\n", + "print(\"so heat supplied by source(Q1)in KW=\"),round(Q1,2)\n", + "print(\"also given that,Q1_a=0.7*Q1_b.......eq 1\")\n", + "print(\"Q1_c=Q1-(0.7*Q1_b+Q1_b)\")\n", + "print(\"Q1_c=Q1-1.7*Q1_b........eq 2\")\n", + "print(\"for reversible engine\")\n", + "print(\"Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\")\n", + "print(\"substitute eq 1 and eq 2 in eq 3 we get, \")\n", + "print(\"heat supplied by reservoir of 700 K(Q1_b)in KJ/s\")\n", + "Q1_b=((Q2/T2)-(Q1/T1_c))/((0.7/T1_a)+(1/T1_b)-(1.7/T1_c))\n", + "print(\"Q1_b=\"),round(Q1_b,2)\n", + "print(\"so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\")\n", + "Q1_a=0.7*Q1_b\n", + "print(\"Q1_a=\"),round(Q1_a,2)\n", + "print(\"and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\")\n", + "Q1_c=Q1-1.7*Q1_b\n", + "print(\"Q1_c=Q1-1.7*Q1_b\"),round(Q1_c,2)\n", + "print(\"so heat supplied by reservoir at 800 K(Q1_a)=\"),round(Q1_a,2)\n", + "print(\"so heat supplied by reservoir at 700 K(Q1_b)=\"),round(Q1_b,2)\n", + "print(\"so heat supplied by reservoir at 600 K(Q1_c)=\"),round(Q1_c,2)\n", + "print(\"NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter5_3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter5_3.ipynb new file mode 100755 index 00000000..cc42cd6f --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter5_3.ipynb @@ -0,0 +1,1124 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5:Entropy" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.1;pg no: 144" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.1, Page:144 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\n", + "entropy change may be given as,\n", + "s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\n", + "here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\n", + "so change in entropy(deltaS)in KJ/kg K\n", + "deltaS= 0.263\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.1, Page:144 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\")\n", + "p1=5.;#initial pressure of air\n", + "T1=(27.+273.);#temperature of air in K\n", + "p2=2.;#final pressure of air in K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cp_air=1.004;#specific heat of air at constant pressure in KJ/kg K\n", + "print(\"entropy change may be given as,\")\n", + "print(\"s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\")\n", + "print(\"here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\")\n", + "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", + "deltaS=(Cp_air*0)-(R*math.log(p2/p1))\n", + "print(\"deltaS=\"),round(deltaS,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.2;pg no: 144" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.2, Page:144 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\n", + "total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\n", + "deltaS1=Q1/T1,where Q1=m*Cp*deltaT\n", + "heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\n", + "Q1= 1533.0\n", + "deltaS1=Q1/T1 in KJ/K 5.11\n", + "now heat of vaporisation(Q2)=in KJ 11300.0\n", + "entropy change during phase transformation(deltaS2)in KJ/K\n", + "deltaS2= 30.29\n", + "entropy change during steam temperature rise(deltaS3)in KJ/K\n", + "deltaS3=m*Cp_steam*dT/T\n", + "here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\n", + "R=in KJ/kg K 0.46\n", + "now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\n", + "total entropy change(deltaS) in KJ/K= 87.24\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.2, Page:144 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\")\n", + "import scipy\n", + "from scipy import integrate\n", + "##just an example function\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "T1=(27.+273.);#temperature of water in K\n", + "T2=(100.+273.);#steam temperature of water in K\n", + "m=5.;#mass of water in kg\n", + "q=2260.;#heat of vaporisation at 100 degree celcius in KJ/kg\n", + "Cp=4.2;#specific heat of water at constant pressure in KJ/kg K\n", + "M=18.;#molar mass for water/steam \n", + "R1=8.314;#gas constant in KJ/kg K\n", + "print(\"total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\")\n", + "Q1=m*Cp*(T2-T1)\n", + "print(\"deltaS1=Q1/T1,where Q1=m*Cp*deltaT\")\n", + "print(\"heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\")\n", + "print(\"Q1=\"),round(Q1,2)\n", + "deltaS1=Q1/T1\n", + "print(\"deltaS1=Q1/T1 in KJ/K\"),round(deltaS1,2)\n", + "Q2=m*q\n", + "print(\"now heat of vaporisation(Q2)=in KJ\"),round(Q2,2)\n", + "print(\"entropy change during phase transformation(deltaS2)in KJ/K\")\n", + "deltaS2=Q2/T2\n", + "print(\"deltaS2=\"),round(deltaS2,2)\n", + "print(\"entropy change during steam temperature rise(deltaS3)in KJ/K\")\n", + "print(\"deltaS3=m*Cp_steam*dT/T\")\n", + "print(\"here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\")\n", + "R=R1/M\n", + "print(\"R=in KJ/kg K\"),round(R,2)\n", + "T2=(100+273.15);#steam temperature of water in K\n", + "T3=(400+273.15);#temperature of steam in K\n", + "print(\"now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\")\n", + "#function y = f(T), y =(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T , endfunction\n", + "def fun1(x):\n", + "\ty=(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T\n", + "\treturn y\n", + "\n", + "#deltaS3 =scipy.integrate.quad(f,T2, T3) \n", + "deltaS3=51.84;#approximately\n", + "deltaS=deltaS1+deltaS2+deltaS3\n", + "print(\"total entropy change(deltaS) in KJ/K=\"),round(deltaS,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.3;pg no: 145" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.3, Page:145 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\n", + "gas constant for oxygen(R)in KJ/kg K\n", + "R= 0.26\n", + "for reversible process the change in entropy may be given as\n", + "deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\n", + "so entropy change=deltaS= in (KJ/kg K) -0.29\n" + ] + } + ], + "source": [ + "#cal of entropy change\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.3, Page:145 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\")\n", + "R1=8.314;#gas constant in KJ/kg K\n", + "M=32;#molar mass for O2 \n", + "T1=(27+273);#initial temperature of O2 in K\n", + "p1=125;#initial pressure of O2 in Kpa\n", + "p2=375;#final pressure of O2 in Kpa\n", + "Cp=1.004;#specific heat of air at constant pressure in KJ/kg K\n", + "print(\"gas constant for oxygen(R)in KJ/kg K\")\n", + "R=R1/M\n", + "print(\"R=\"),round(R,2)\n", + "print(\"for reversible process the change in entropy may be given as\")\n", + "print(\"deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\")\n", + "T2=T1;#isothermal process\n", + "deltaS=(Cp*math.log(T2/T1))-(R*math.log(p2/p1))\n", + "print(\"so entropy change=deltaS= in (KJ/kg K)\"),round(deltaS,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.4;pg no: 145" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.4, Page:145 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\n", + "entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\n", + "where deltaS_block=m*C*log(T2/T1)\n", + "here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\n", + "therefore deltaS_block=in KJ/K -0.14\n", + "heat loss by block =heat gained by water(Q)in KJ\n", + "Q=-m*C*(T1-T2) -49.13\n", + "therefore deltaS_water=-Q/T2 in KJ/K 0.16\n", + "thus deltaS_universe=in J/K 27.16\n" + ] + } + ], + "source": [ + "#cal of deltaS_universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.4, Page:145 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\")\n", + "T1=(150+273.15);#temperature of copper block in K\n", + "T2=(25+273.15);#temperature of sea water in K\n", + "m=1;#mass of copper block in kg\n", + "C=0.393;#heat capacity of copper in KJ/kg K\n", + "print(\"entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\")\n", + "print(\"where deltaS_block=m*C*log(T2/T1)\")\n", + "print(\"here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\")\n", + "deltaS_block=m*C*math.log(T2/T1)\n", + "print(\"therefore deltaS_block=in KJ/K\"),round(deltaS_block,2)\n", + "print(\"heat loss by block =heat gained by water(Q)in KJ\")\n", + "Q=-m*C*(T1-T2)\n", + "print(\"Q=-m*C*(T1-T2)\"),round(Q,2)\n", + "deltaS_water=-Q/T2\n", + "print(\"therefore deltaS_water=-Q/T2 in KJ/K\"),round(deltaS_water,2)\n", + "deltaS_universe=(deltaS_block+deltaS_water)*1000\n", + "print(\"thus deltaS_universe=in J/K\"),round(deltaS_universe,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.5;pg no: 146" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.5, Page:146 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\n", + "deltaS_universe=(deltaS_block+deltaS_seawater)\n", + "since block and sea water both are at same temperature so,\n", + "deltaS_universe=deltaS_seawater\n", + "conservation of energy equation yields,\n", + "Q-W=deltaU+deltaP.E+deltaK.E\n", + "since in this case,W=0,deltaK.E=0,deltaU=0\n", + "Q=deltaP.E\n", + "change in potential energy=deltaP.E=m*g*h in J\n", + "deltaS_universe=deltaS_seawater=Q/T in J/kg K\n", + "entropy change of universe(deltaS_universe)in J/kg K 6.54\n" + ] + } + ], + "source": [ + "#cal of entropy change of universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.5, Page:146 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\")\n", + "m=1;#mass of copper block in kg\n", + "T=(27+273);#temperature of copper block in K\n", + "h=200;#height from which copper block dropped in sea water in m\n", + "C=0.393;#heat capacity for copper in KJ/kg K\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"deltaS_universe=(deltaS_block+deltaS_seawater)\")\n", + "print(\"since block and sea water both are at same temperature so,\")\n", + "print(\"deltaS_universe=deltaS_seawater\")\n", + "print(\"conservation of energy equation yields,\")\n", + "print(\"Q-W=deltaU+deltaP.E+deltaK.E\")\n", + "print(\"since in this case,W=0,deltaK.E=0,deltaU=0\")\n", + "deltaPE=m*g*h\n", + "Q=deltaPE\n", + "print(\"Q=deltaP.E\")\n", + "print(\"change in potential energy=deltaP.E=m*g*h in J\")\n", + "print(\"deltaS_universe=deltaS_seawater=Q/T in J/kg K\")\n", + "deltaS_universe=Q/T\n", + "print(\"entropy change of universe(deltaS_universe)in J/kg K\"),round(deltaS_universe,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.6;pg no: 146" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.6, Page:146 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\n", + "here deltaS_universe=deltaS_block1+deltaS_block2\n", + "two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\n", + "then from energy conservation\n", + "m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\n", + "Tf=in K 374.18\n", + "hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\n", + "deltaS1=in KJ/K -0.05\n", + "entropy change in block 2(deltaS2)in KJ/K\n", + "deltaS2= 0.06\n", + "entropy change of universe(deltaS)=in KJ/K 0.01\n" + ] + } + ], + "source": [ + "#cal of entropy change of universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.6, Page:146 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\")\n", + "m1=1;#mass of first copper block in kg\n", + "m2=0.5;#mass of second copper block in kg\n", + "T1=(150+273.15);#temperature of first copper block in K\n", + "T2=(0+273.15);#temperature of second copper block in K\n", + "Cp_1=0.393;#heat capacity for copper block 1 in KJ/kg K\n", + "Cp_2=0.381;#heat capacity for copper block 2 in KJ/kg K\n", + "print(\"here deltaS_universe=deltaS_block1+deltaS_block2\")\n", + "print(\"two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\")\n", + "print(\"then from energy conservation\")\n", + "print(\"m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\")\n", + "Tf=((m1*Cp_1*T1)+(m2*Cp_2*T2))/(m1*Cp_1+m2*Cp_2)\n", + "print(\"Tf=in K\"),round(Tf,2)\n", + "print(\"hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\")\n", + "deltaS1=m1*Cp_1*math.log(Tf/T1)\n", + "print(\"deltaS1=in KJ/K\"),round(deltaS1,2)\n", + "print(\"entropy change in block 2(deltaS2)in KJ/K\")\n", + "deltaS2=m2*Cp_2*math.log(Tf/T2)\n", + "print(\"deltaS2=\"),round(deltaS2,2)\n", + "deltaS=deltaS1+deltaS2\n", + "print(\"entropy change of universe(deltaS)=in KJ/K\"),round(deltaS,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.7;pg no: 147" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.7, Page:147 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\n", + "NOTE=>in this question formula is derived which cannot be solve using python software\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.7, Page:147 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\")\n", + "print(\"NOTE=>in this question formula is derived which cannot be solve using python software\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.8;pg no: 148" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.8, Page:148 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\n", + "for irreversible operation of engine,\n", + "rate of entropy generation=Q1/T1+Q2/T2\n", + "W=Q1-Q2=>Q2=Q1-W in MW 3.0\n", + "entropy generated(deltaS_gen)in MW\n", + "deltaS_gen= 0.01\n", + "work lost(W_lost)in MW\n", + "W_lost=T2*deltaS_gen 4.0\n" + ] + } + ], + "source": [ + "#cal of work lost\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.8, Page:148 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\")\n", + "T1=1800.;#temperature of high temperature reservoir in K\n", + "T2=300.;#temperature of low temperature reservoir in K\n", + "Q1=5.;#heat addition in MW\n", + "W=2.;#work done in MW\n", + "print(\"for irreversible operation of engine,\")\n", + "print(\"rate of entropy generation=Q1/T1+Q2/T2\")\n", + "Q2=Q1-W\n", + "print(\"W=Q1-Q2=>Q2=Q1-W in MW\"),round(Q2,2)\n", + "print(\"entropy generated(deltaS_gen)in MW\")\n", + "deltaS_gen=Q1/T1+Q2/T2\n", + "print(\"deltaS_gen=\"),round(deltaS_gen,2)\n", + "Q1=-5;#heat addition in MW\n", + "print(\"work lost(W_lost)in MW\")\n", + "W_lost=T2*deltaS_gen\n", + "print(\"W_lost=T2*deltaS_gen\"),round(W_lost)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.9;pg no: 148" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.9, Page:148 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\n", + "system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\n", + "therefore,maximum heat(Q1)=(C*dT)in J\n", + "here C=0.05*T^2+0.10*T+0.085 in J/K\n", + "so Q1=(0.05*T^2+0.10*T+0.085)*dT\n", + "entropy change of system,deltaS_system=C*dT/T in J/K\n", + "so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\n", + "deltaS_reservoir=Q2/T2=(Q1-W)/T2 also,we know from entropy principle,deltaS_universe is greater than equal to 0\n", + "deltaS_universe=deltaS_system+deltaS_reservoir\n", + "thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\n", + "W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\n", + "hence maximum work in KJ= 435.34\n" + ] + } + ], + "source": [ + "#cal of COP\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.9, Page:148 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\")\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "T1=500;#temperature of system in K\n", + "T2=300;#temperature of reservoir in K\n", + "print(\"system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\")\n", + "print(\"therefore,maximum heat(Q1)=(C*dT)in J\")\n", + "print(\"here C=0.05*T^2+0.10*T+0.085 in J/K\")\n", + "print(\"so Q1=(0.05*T^2+0.10*T+0.085)*dT\")\n", + "T=T1-T2\n", + "#Q1=(0.05*T**2+0.10*T+0.085)*dT\n", + "#function y = f(T), y = (0.05*T**2+0.10*T+0.085),endfunction\n", + "#Q1 = scipy.integrate.quad(fun1,T1, T2)\n", + "#Q1=-Q1\n", + "Q1=1641.35*10**3\n", + "print(\"entropy change of system,deltaS_system=C*dT/T in J/K\")\n", + "print(\"so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\")\n", + "#function y = k(T), y = (0.05*T**2+0.10*T+0.085)/T,endfunction\n", + "def fun1(x):\n", + "\ty = (0.05*T**2+0.10*T+0.085)/T\n", + "\treturn y\n", + "\n", + "#deltaS_system = scipy.integrate.quad(k,T1, T2)\n", + "deltaS_system=-4020.043\n", + "print(\"deltaS_reservoir=Q2/T2=(Q1-W)/T2\"),\n", + "print(\"also,we know from entropy principle,deltaS_universe is greater than equal to 0\")\n", + "print(\"deltaS_universe=deltaS_system+deltaS_reservoir\")\n", + "print(\"thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\")\n", + "print(\"W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\")\n", + "W=(Q1+deltaS_system*T2)/1000\n", + "print(\"hence maximum work in KJ=\"),round(W,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.10;pg no: 149" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.10, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\n", + "for reversible adiabatic process governing equation for expansion,\n", + "P*V**1.4=constant\n", + "also,for such process entropy change=0\n", + "using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\n", + "final pressure(p2)in Mpa\n", + "p2= 0.24\n", + "from first law,second law and definition of enthalpy;\n", + "dH=T*dS+v*dP\n", + "for adiabatic process of reversible type,dS=0\n", + "so dH=v*dP\n", + "integrating both side H2-H1=deltaH=v*dP in KJ\n", + "so enthalpy change(deltaH)in KJ=268.8\n", + "and entropy change=0\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "\n", + "print\"Example 5.10, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\")\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "def fun1(x):\n", + "\ty=x*x\n", + "\treturn y\n", + "\n", + "p1=3.;#initial pressure in Mpa\n", + "v1=0.05;#initial volume in m**3\n", + "v2=0.3;#final volume in m**3\n", + "print(\"for reversible adiabatic process governing equation for expansion,\")\n", + "print(\"P*V**1.4=constant\")\n", + "print(\"also,for such process entropy change=0\")\n", + "print(\"using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\")\n", + "print(\"final pressure(p2)in Mpa\")\n", + "p2=p1*(v1/v2)**1.4\n", + "print(\"p2=\"),round(p2,2)\n", + "print(\"from first law,second law and definition of enthalpy;\")\n", + "print(\"dH=T*dS+v*dP\")\n", + "print(\"for adiabatic process of reversible type,dS=0\")\n", + "dS=0;#for adiabatic process of reversible type\n", + "print(\"so dH=v*dP\")\n", + "print(\"integrating both side H2-H1=deltaH=v*dP in KJ\")\n", + "p1=3.*1000.;#initial pressure in Kpa\n", + "p2=244.;#final pressure in Kpa\n", + "#function y = f(p), y =(p1*(v1**1.4)/p)**(1/1.4)\n", + "def fun1(x):\n", + "\ty=(p1*(v1**1.4)/p2)**(1/1.4)\n", + "\treturn y\n", + "\n", + "deltaH = scipy.integrate.quad(fun1,p2,p1)\n", + "print (\"so enthalpy change(deltaH)in KJ=268.8\")\n", + "print(\"and entropy change=0\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.11;pg no: 150" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.11, Page:150 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\n", + "during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\n", + "a> change in entropy of air(deltaS_air)in J/K\n", + "deltaS_air= 1321.68\n", + "b> during free expansion on heat is gained or lost to surrounding so,\n", + "deltaS_surrounding=0\n", + "entropy change of surroundings=0\n", + "c> entropy change of universe(deltaS_universe)in J/K\n", + "deltaS_universe= 1321.68\n" + ] + } + ], + "source": [ + "#cal of deltaS_universe\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.11, Page:150 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\")\n", + "m=2;#mass of air in kg\n", + "v1=1;#initial volume of air in m^3\n", + "v2=10;#final volume of air in m^3\n", + "R=287;#gas constant in J/kg K\n", + "print(\"during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\")\n", + "print(\"a> change in entropy of air(deltaS_air)in J/K\")\n", + "deltaS_air=m*R*math.log(v2/v1)\n", + "print(\"deltaS_air=\"),round(deltaS_air,2)\n", + "print(\"b> during free expansion on heat is gained or lost to surrounding so,\")\n", + "print(\"deltaS_surrounding=0\")\n", + "print(\"entropy change of surroundings=0\")\n", + "deltaS_surrounding=0;#entropy change of surroundings\n", + "print(\"c> entropy change of universe(deltaS_universe)in J/K\")\n", + "deltaS_universe=deltaS_air+deltaS_surrounding\n", + "print(\"deltaS_universe=\"),round(deltaS_universe,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "##example 5.12;pg no: 150" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.12, Page:150 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\n", + "let initial and final states be denoted by 1 and 2\n", + "for poly tropic process pressure and temperature can be related as\n", + "(p2/p1)^((n-1)/n)=T2/T1\n", + "so temperature after compression(T2)=in K 1128.94\n", + "substituting in entropy change expression for polytropic process,\n", + "entropy change(deltaS)inKJ/kg K\n", + "deltaS= -0.24454\n", + "NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\n", + "total entropy change(deltaS)=in J/K -122.27\n" + ] + } + ], + "source": [ + "#cal of total entropy change\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.12, Page:150 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\")\n", + "m=0.5;#mass of air in kg\n", + "p1=1.013*10**5;#initial pressure of air in pa\n", + "p2=0.8*10**6;#final pressure of air in pa\n", + "T1=800;#initial temperature of air in K\n", + "n=1.2;#polytropic expansion constant\n", + "y=1.4;#expansion constant for air\n", + "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", + "print(\"let initial and final states be denoted by 1 and 2\")\n", + "print(\"for poly tropic process pressure and temperature can be related as\")\n", + "print(\"(p2/p1)^((n-1)/n)=T2/T1\")\n", + "T2=T1*(p2/p1)**((n-1)/n)\n", + "print(\"so temperature after compression(T2)=in K\"),round(T2,2)\n", + "print(\"substituting in entropy change expression for polytropic process,\") \n", + "print(\"entropy change(deltaS)inKJ/kg K\")\n", + "deltaS=Cv*((n-y)/(n-1))*math.log(T2/T1)\n", + "print(\"deltaS=\"),round(deltaS,5)\n", + "print(\"NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\")\n", + "deltaS=m*deltaS*1000\n", + "print(\"total entropy change(deltaS)=in J/K\"),round(deltaS,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.13;pg no: 151" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.13, Page:151 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\n", + "NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.13, Page:151 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\")\n", + "print(\"NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.14;pg no: 152" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.14, Page:152 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\n", + "clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\n", + "K=dQ/T=Q1/T1-Q2/T2\n", + "i> for Q2=200 kcal/s\n", + "K=in kcal/s K 0.0\n", + "as K is not greater than 0,therefore under these conditions engine is not possible\n", + "ii> for Q2=400 kcal/s\n", + "K=in kcal/s K -1.0\n", + "as K is less than 0,so engine is feasible and cycle is reversible\n", + "iii> for Q2=250 kcal/s\n", + "K=in kcal/s K 0.0\n", + "as K=0,so engine is feasible and cycle is reversible\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.14, Page:152 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\")\n", + "Q1=500;#heat supplied by source in kcal/s\n", + "T1=600;#temperature of source in K\n", + "T2=300;#temperature of sink in K\n", + "print(\"clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\")\n", + "print(\"K=dQ/T=Q1/T1-Q2/T2\")\n", + "print(\"i> for Q2=200 kcal/s\")\n", + "Q2=200;#heat rejected by sink in kcal/s\n", + "K=Q1/T1-Q2/T2\n", + "print(\"K=in kcal/s K\"),round(K,2)\n", + "print(\"as K is not greater than 0,therefore under these conditions engine is not possible\")\n", + "print(\"ii> for Q2=400 kcal/s\")\n", + "Q2=400;#heat rejected by sink in kcal/s\n", + "K=Q1/T1-Q2/T2\n", + "print(\"K=in kcal/s K\"),round(K,2)\n", + "print(\"as K is less than 0,so engine is feasible and cycle is reversible\")\n", + "print(\"iii> for Q2=250 kcal/s\")\n", + "Q2=250;#heat rejected by sink in kcal/s\n", + "K=Q1/T1-Q2/T2\n", + "print(\"K=in kcal/s K\"),round(K,2)\n", + "print(\"as K=0,so engine is feasible and cycle is reversible\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.15;pg no: 152" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.15, Page:152 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\n", + "let the two points be given as states 1 and 2,\n", + "let us assume flow to be from 1 to 2\n", + "so entropy change(deltaS1_2)=s1-s2=in KJ/kg K -0.0\n", + "deltaS1_2=s1-s2=0.01254 KJ/kg K\n", + "it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\n", + "hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "import math\n", + "print\"Example 5.15, Page:152 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\")\n", + "p1=0.5;#initial pressure of air in Mpa\n", + "T1=400;#initial temperature of air in K\n", + "p2=0.3;#final pressure of air in Mpa\n", + "T2=350;#initial temperature of air in K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", + "print(\"let the two points be given as states 1 and 2,\")\n", + "print(\"let us assume flow to be from 1 to 2\")\n", + "deltaS1_2=Cp*math.log(T1/T2)-R*math.log(p1/p2)\n", + "print(\"so entropy change(deltaS1_2)=s1-s2=in KJ/kg K\"),round(deltaS1_2)\n", + "print(\"deltaS1_2=s1-s2=0.01254 KJ/kg K\")\n", + "print(\"it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\")\n", + "print(\"hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.16;pg no: 153" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.16, Page:46 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\n", + "NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#cal of deltaS\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.16, Page:46 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\")\n", + "print(\"NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.17;pg no: 153" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.17, Page:153 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\n", + "total heat added(Q)in KJ\n", + "Q= 1800.0\n", + "for heat addition process 1-2\n", + "Q12=T1*(s2-s1)\n", + "deltaS=s2-s1=in KJ/K 2.0\n", + "or heat addition process 3-4\n", + "Q34=T3*(s4-s3)\n", + "deltaS=s4-s3=in KJ/K 2.0\n", + "or heat rejected in process 5-6(Q56)in KJ\n", + "Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)= 1200.0\n", + "net work done=net heat(W_net)in KJ\n", + "W_net=(Q12+Q34)-Q56 600.0\n", + "thermal efficiency of cycle(n)= 0.33\n", + "or n=n*100 % 33.33\n", + "so work done=600 KJ and thermal efficiency=33.33 %\n" + ] + } + ], + "source": [ + "#cal of work done and thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.17, Page:153 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\")\n", + "Q12=1000.;#heat added during process 1-2 in KJ\n", + "Q34=800.;#heat added during process 3-4 in KJ\n", + "T1=500.;#operating temperature for process 1-2\n", + "T3=400.;#operating temperature for process 3-4\n", + "T5=300.;#operating temperature for process 5-6\n", + "T2=T1;#isothermal process\n", + "T4=T3;#isothermal process\n", + "T6=T5;#isothermal process\n", + "print(\"total heat added(Q)in KJ\")\n", + "Q=Q12+Q34\n", + "print(\"Q=\"),round(Q,2)\n", + "print(\"for heat addition process 1-2\")\n", + "print(\"Q12=T1*(s2-s1)\")\n", + "deltaS=Q12/T1\n", + "print(\"deltaS=s2-s1=in KJ/K\"),round(deltaS,2)\n", + "print(\"or heat addition process 3-4\")\n", + "print(\"Q34=T3*(s4-s3)\")\n", + "deltaS=Q34/T3\n", + "print(\"deltaS=s4-s3=in KJ/K\"),round(deltaS,2)\n", + "print(\"or heat rejected in process 5-6(Q56)in KJ\")\n", + "Q56=T5*(deltaS+deltaS)\n", + "print(\"Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)=\"),round(Q56,2)\n", + "print(\"net work done=net heat(W_net)in KJ\")\n", + "W_net=(Q12+Q34)-Q56\n", + "print(\"W_net=(Q12+Q34)-Q56\"),round(W_net,2)\n", + "n=W_net/Q\n", + "print(\"thermal efficiency of cycle(n)=\"),round(n,2)\n", + "n=n*100\n", + "print(\"or n=n*100 %\"),round(n,2) \n", + "print(\"so work done=600 KJ and thermal efficiency=33.33 %\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 5.18;pg no: 154" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.18, Page:154 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\n", + "let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\n", + "here Q1-Q2=W\n", + "so heat supplied by source(Q1)in KW= 30.0\n", + "also given that,Q1_a=0.7*Q1_b.......eq 1\n", + "Q1_c=Q1-(0.7*Q1_b+Q1_b)\n", + "Q1_c=Q1-1.7*Q1_b........eq 2\n", + "for reversible engine\n", + "Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\n", + "substitute eq 1 and eq 2 in eq 3 we get, \n", + "heat supplied by reservoir of 700 K(Q1_b)in KJ/s\n", + "Q1_b= 35.39\n", + "so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\n", + "Q1_a= 24.78\n", + "and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\n", + "Q1_c=Q1-1.7*Q1_b -30.17\n", + "so heat supplied by reservoir at 800 K(Q1_a)= 24.78\n", + "so heat supplied by reservoir at 700 K(Q1_b)= 35.39\n", + "so heat supplied by reservoir at 600 K(Q1_c)= -30.17\n", + "NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\n" + ] + } + ], + "source": [ + "#cal of heat supplied by reservoir at 800,700,600\n", + "#intiation of all variables\n", + "# Chapter 5\n", + "print\"Example 5.18, Page:154 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\")\n", + "T1_a=800.;#temperature of reservoir a in K\n", + "T1_b=700.;#temperature of reservoir b in K\n", + "T1_c=600.;#temperature of reservoir c in K\n", + "T2=320.;#temperature of sink in K\n", + "W=20.;#work done in KW\n", + "Q2=10.;#heat rejected to sink in KW\n", + "print(\"let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\")\n", + "print(\"here Q1-Q2=W\")\n", + "Q1=W+Q2\n", + "print(\"so heat supplied by source(Q1)in KW=\"),round(Q1,2)\n", + "print(\"also given that,Q1_a=0.7*Q1_b.......eq 1\")\n", + "print(\"Q1_c=Q1-(0.7*Q1_b+Q1_b)\")\n", + "print(\"Q1_c=Q1-1.7*Q1_b........eq 2\")\n", + "print(\"for reversible engine\")\n", + "print(\"Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\")\n", + "print(\"substitute eq 1 and eq 2 in eq 3 we get, \")\n", + "print(\"heat supplied by reservoir of 700 K(Q1_b)in KJ/s\")\n", + "Q1_b=((Q2/T2)-(Q1/T1_c))/((0.7/T1_a)+(1/T1_b)-(1.7/T1_c))\n", + "print(\"Q1_b=\"),round(Q1_b,2)\n", + "print(\"so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\")\n", + "Q1_a=0.7*Q1_b\n", + "print(\"Q1_a=\"),round(Q1_a,2)\n", + "print(\"and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\")\n", + "Q1_c=Q1-1.7*Q1_b\n", + "print(\"Q1_c=Q1-1.7*Q1_b\"),round(Q1_c,2)\n", + "print(\"so heat supplied by reservoir at 800 K(Q1_a)=\"),round(Q1_a,2)\n", + "print(\"so heat supplied by reservoir at 700 K(Q1_b)=\"),round(Q1_b,2)\n", + "print(\"so heat supplied by reservoir at 600 K(Q1_c)=\"),round(Q1_c,2)\n", + "print(\"NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter6.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter6.ipynb new file mode 100755 index 00000000..92ef2871 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter6.ipynb @@ -0,0 +1,1390 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6:Thermo dynamic Properties of pure substance" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.1;pg no: 174" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.1, Page:174 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\n", + "NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.1, Page:174 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\")\n", + "print(\"NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.2;pg no: 175" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.2, Page:175 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\n", + "during throttling,h1=h2\n", + "at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\n", + "thus h2=2682.5 KJ/kg\n", + "at state 1,before throttling\n", + "hf_10Mpa=1407.56 KJ/kg\n", + "hfg_10Mpa=1317.1 KJ/kg\n", + "h1=hf_10Mpa+x1*hfg_10Mpa\n", + "dryness fraction(x1)may be given as\n", + "x1= 0.97\n" + ] + } + ], + "source": [ + "#cal of dryness fraction\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.2, Page:175 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\")\n", + "print(\"during throttling,h1=h2\")\n", + "print(\"at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\")\n", + "print(\"thus h2=2682.5 KJ/kg\")\n", + "h2=2682.5;\n", + "print(\"at state 1,before throttling\")\n", + "print(\"hf_10Mpa=1407.56 KJ/kg\")\n", + "hf_10Mpa=1407.56;\n", + "print(\"hfg_10Mpa=1317.1 KJ/kg\")\n", + "hfg_10Mpa=1317.1;\n", + "print(\"h1=hf_10Mpa+x1*hfg_10Mpa\")\n", + "h1=h2;#during throttling\n", + "print(\"dryness fraction(x1)may be given as\")\n", + "x1=(h1-hf_10Mpa)/hfg_10Mpa\n", + "print(\"x1=\"),round(x1,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.3;pg no: 176" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.3, Page:176 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\n", + "internal energy(u)=in KJ/kg 2644.0\n" + ] + } + ], + "source": [ + "#cal of internal energy\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.3, Page:176 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\")\n", + "h=2848;#enthalpy in KJ/kg\n", + "p=12*1000;#pressure in Kpa\n", + "v=0.017;#specific volume in m^3/kg\n", + "u=h-p*v\n", + "print(\"internal energy(u)=in KJ/kg\"),round(u,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.4;pg no: 176" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.4, Page:176 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\n", + "steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\n", + "entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\n", + "S= 6.65\n", + "entropy of 5 kg of steam(S)in KJ/K\n", + "S=m*S 33.23\n" + ] + } + ], + "source": [ + "#cal of entropy of 5 kg of steam\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "import math\n", + "print\"Example 6.4, Page:176 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\")\n", + "m=5;#mass of steam in kg\n", + "p=2;#pressure of steam in Mpa\n", + "T_superheat=(300+273.15);#temperature of superheat steam in K\n", + "Cp_water=4.18;#specific heat of water at constant pressure in KJ/kg K\n", + "Cp_superheat=2.1;#specific heat of superheat steam at constant pressure in KJ/kg K\n", + "print(\"steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\")\n", + "T_sat=(212.42+273.15);#saturation temperature at 2 Mpa in K\n", + "hfg_2Mpa=1890.7;\n", + "print(\"entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\")\n", + "S=Cp_water*math.log(T_sat/273.15)+(hfg_2Mpa/T_sat)+(Cp_superheat*math.log(T_superheat/T_sat))\n", + "print(\"S=\"),round(S,2)\n", + "print(\"entropy of 5 kg of steam(S)in KJ/K\")\n", + "S=m*S\n", + "print(\"S=m*S\"),round(S,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.5;pg no: 176" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.5, Page:176 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\n", + "boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\n", + "at further depth of 50 cm the pressure(p)in Kpa\n", + "p= 138.37\n", + "boiling point at this depth=Tsat_138.365\n", + "from steam table this temperature=108.866=108.87 degree celcius\n", + "so boiling point = 108.87 degree celcius\n" + ] + } + ], + "source": [ + "#cal of boiling point\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.5, Page:176 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\")\n", + "rho=1000;#density of water in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "h=0.50;#depth from above mentioned level in m\n", + "print(\"boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\")\n", + "p_boil=143.27;#pressure at which pond water boils in Kpa\n", + "print(\"at further depth of 50 cm the pressure(p)in Kpa\")\n", + "p=p_boil-((rho*g*h)*10**-3)\n", + "print(\"p=\"),round(p,2)\n", + "print(\"boiling point at this depth=Tsat_138.365\")\n", + "print(\"from steam table this temperature=108.866=108.87 degree celcius\")\n", + "print(\"so boiling point = 108.87 degree celcius\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.6;pg no: 177" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.6, Page:177 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\n", + "in a rigid vessel it can be treated as constant volume process.\n", + "so v1=v2\n", + "since final state is given to be critical state,then specific volume at critical point,\n", + "v2=0.003155 m^3/kg\n", + "at 100 degree celcius saturation temperature,from steam table\n", + "vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\n", + "and vfg_100=in m^3/kg= 1.67\n", + "thus for initial quality being x1\n", + "v1=vf_100+x1*vfg_100\n", + "so x1= 0.001\n", + "mass of water initially=total mass*(1-x1)\n", + "total mass of fluid/water(m) in kg= 158.48\n", + "volume of water(v) in m^3= 0.1655\n" + ] + } + ], + "source": [ + "#cal of mass and volume of water\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.6, Page:177 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\")\n", + "V=0.5;#capacity of rigid vessel in m^3\n", + "print(\"in a rigid vessel it can be treated as constant volume process.\")\n", + "print(\"so v1=v2\")\n", + "print(\"since final state is given to be critical state,then specific volume at critical point,\")\n", + "print(\"v2=0.003155 m^3/kg\")\n", + "v2=0.003155;#specific volume at critical point in m^3/kg\n", + "print(\"at 100 degree celcius saturation temperature,from steam table\")\n", + "print(\"vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\")\n", + "vf_100=0.001044;\n", + "vg_100=1.6729;\n", + "vfg_100=vg_100-vf_100\n", + "print(\"and vfg_100=in m^3/kg=\"),round(vfg_100,2)\n", + "print(\"thus for initial quality being x1\")\n", + "v1=v2;#rigid vessel\n", + "x1=(v1-vf_100)/vfg_100\n", + "print(\"v1=vf_100+x1*vfg_100\")\n", + "print(\"so x1=\"),round(x1,3)\n", + "print(\"mass of water initially=total mass*(1-x1)\")\n", + "m=V/v2\n", + "print(\"total mass of fluid/water(m) in kg=\"),round(m,2)\n", + "v=m*vf_100\n", + "print(\"volume of water(v) in m^3=\"),round(v,4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.7;pg no: 177" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.7, Page:177 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\n", + "on mollier diadram(h-s diagram)the slope of isobaric line may be given as\n", + "(dh/ds)_p=cons =slope of isobar\n", + "from 1st and 2nd law combined;\n", + "T*ds=dh-v*dp\n", + "(dh/ds)_p=cons = T\n", + "here temperature,T=773.15 K\n", + "here slope=(dh/ds))p=cons = 773.15\n" + ] + } + ], + "source": [ + "#cal of slope\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.7, Page:177 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\")\n", + "print(\"on mollier diadram(h-s diagram)the slope of isobaric line may be given as\")\n", + "print(\"(dh/ds)_p=cons =slope of isobar\")\n", + "print(\"from 1st and 2nd law combined;\")\n", + "print(\"T*ds=dh-v*dp\")\n", + "print(\"(dh/ds)_p=cons = T\")\n", + "print(\"here temperature,T=773.15 K\")\n", + "print(\"here slope=(dh/ds))p=cons = 773.15\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.8;pg no: 178" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.8, Page:178 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\n", + "at 0.15Mpa,from steam table;\n", + "hf=467.11 KJ/kg,hg=2693.6 KJ/kg\n", + "and hfg in KJ/kg= 2226.49\n", + "vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\n", + "and vfg in m^3/kg= 1.16\n", + "sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\n", + "and sfg=in KJ/kg K= 5.79\n", + "enthalpy at x=.10(h)in KJ/kg\n", + "h= 689.76\n", + "specific volume,(v)in m^3/kg\n", + "v= 0.12\n", + "entropy (s)in KJ/kg K\n", + "s= 2.01\n" + ] + } + ], + "source": [ + "#cal of entropy\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.8, Page:178 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\")\n", + "x=.10;#quality is 10%\n", + "print(\"at 0.15Mpa,from steam table;\")\n", + "print(\"hf=467.11 KJ/kg,hg=2693.6 KJ/kg\")\n", + "hf=467.11;\n", + "hg=2693.6;\n", + "hfg=hg-hf\n", + "print(\"and hfg in KJ/kg=\"),round(hfg,2)\n", + "print(\"vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\")\n", + "vf=0.001053;\n", + "vg=1.1593;\n", + "vfg=vg-vf\n", + "print(\"and vfg in m^3/kg=\"),round(vfg,2)\n", + "print(\"sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\")\n", + "sf=1.4336;\n", + "sg=7.2233;\n", + "sfg=sg-sf\n", + "print(\"and sfg=in KJ/kg K=\"),round(sfg,2)\n", + "print(\"enthalpy at x=.10(h)in KJ/kg\")\n", + "h=hf+x*hfg\n", + "print(\"h=\"),round(h,2)\n", + "print(\"specific volume,(v)in m^3/kg\")\n", + "v=vf+x*vfg\n", + "print(\"v=\"),round(v,2)\n", + "print(\"entropy (s)in KJ/kg K\")\n", + "s=sf+x*sfg\n", + "print(\"s=\"),round(s,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.9;pg no: 178" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.9, Page:178 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\n", + "work done during constant pressure process(W)=p1*(V2-V1)in KJ\n", + "now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\n", + "so v1 in m^3/kg=\n", + "now mass of steam(m) in kg= 0.32\n", + "specific volume at final state(v2)in m^3/kg\n", + "v2= 0.62\n", + "corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\n", + "v2>vg_1Mpa\n", + "hence state lies in superheated region,from the steam table by interpolation we get temperature as;\n", + "state lies between temperature of 1000 degree celcius and 1100 degree celcius\n", + "so exact temperature at final state(T)in K= 1077.61\n", + "thus internal energy at final state,1 Mpa,1077.61 degree celcius;\n", + "u2=4209.6 KJ/kg\n", + "internal energy at initial state(u1)in KJ/kg\n", + "u1= 2219.28\n", + "from first law of thermodynamics,Q-W=deltaU\n", + "so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ= 788.83\n" + ] + } + ], + "source": [ + "#cal of heat added\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.9, Page:178 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\")\n", + "p1=1*1000;#initial pressure of steam in Kpa\n", + "V1=0.05;#initial volume of steam in m^3\n", + "x1=.8;#dryness fraction is 80%\n", + "V2=0.2;#final volume of steam in m^3\n", + "p2=p1;#constant pressure process\n", + "print(\"work done during constant pressure process(W)=p1*(V2-V1)in KJ\")\n", + "W=p1*(V2-V1)\n", + "print(\"now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\")\n", + "vf=0.001127;\n", + "vg=0.19444;\n", + "uf=761.68;\n", + "ufg=1822;\n", + "v1=vf+x1*vg\n", + "print(\"so v1 in m^3/kg=\")\n", + "m=V1/v1\n", + "print(\"now mass of steam(m) in kg=\"),round(m,2)\n", + "m=0.32097;#take m=0.32097 approx.\n", + "print(\"specific volume at final state(v2)in m^3/kg\")\n", + "v2=V2/m\n", + "print(\"v2=\"),round(v2,2)\n", + "print(\"corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\")\n", + "print(\"v2>vg_1Mpa\")\n", + "print(\"hence state lies in superheated region,from the steam table by interpolation we get temperature as;\")\n", + "print(\"state lies between temperature of 1000 degree celcius and 1100 degree celcius\")\n", + "T=1000+((100*(.62311-.5871))/(.6335-.5871))\n", + "print(\"so exact temperature at final state(T)in K=\"),round(T,2)\n", + "print(\"thus internal energy at final state,1 Mpa,1077.61 degree celcius;\")\n", + "print(\"u2=4209.6 KJ/kg\")\n", + "u2=4209.6;\n", + "print(\"internal energy at initial state(u1)in KJ/kg\")\n", + "u1=uf+x1*ufg\n", + "print(\"u1=\"),round(u1,2)\n", + "print(\"from first law of thermodynamics,Q-W=deltaU\")\n", + "Q=m*(u2-u1)+W\n", + "print(\"so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ=\"),round(Q,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.10;pg no: 179" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.10, Page:179 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\n", + "here steam is kept in rigid vessel,therefore its specific volume shall remain constant\n", + "it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\n", + "from superheated steam table;v1=0.2404 m^3/kg\n", + "at begining of condensation specific volume = 0.2404 m^3/kg\n", + "v2=0.2404 m^3/kg\n", + "this v2 shall be specific volume corresponding to saturated vapour state for condensation.\n", + "thus v2=vg=0.2404 m^3/kg\n", + "looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\n", + "by interpolation,temperature at begining of condensation(T2)in K\n", + "similarily,pressure(p2)in Kpa= 800.96\n" + ] + } + ], + "source": [ + "#cal of pressure\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.10, Page:179 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\")\n", + "p1=800;#initial pressure of steam in Kpa\n", + "T1=200;#initial temperature of steam in degree celcius\n", + "print(\"here steam is kept in rigid vessel,therefore its specific volume shall remain constant\")\n", + "print(\"it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\")\n", + "print(\"from superheated steam table;v1=0.2404 m^3/kg\")\n", + "print(\"at begining of condensation specific volume = 0.2404 m^3/kg\")\n", + "print(\"v2=0.2404 m^3/kg\")\n", + "v2=0.2404;\n", + "print(\"this v2 shall be specific volume corresponding to saturated vapour state for condensation.\")\n", + "print(\"thus v2=vg=0.2404 m^3/kg\")\n", + "vg=v2;\n", + "print(\"looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\")\n", + "print(\"by interpolation,temperature at begining of condensation(T2)in K\")\n", + "T2=175-((175-170)*(0.2404-0.2167))/(0.2428-.2168)\n", + "p=892-(((892-791.7)*(0.2404-0.2168))/(0.2428-0.2168))\n", + "print(\"similarily,pressure(p2)in Kpa=\"),round(p,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.11;pg no: 180" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.11, Page:180 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\n", + "from 1st and 2nd law;\n", + "T*ds=dh-v*dp\n", + "for isentropic process,ds=0\n", + "hence dh=v*dp\n", + "i.e (h2-h1)=v1*(p2-p1)\n", + "corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\n", + "p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\n", + "therefore enthalpy change(deltah)=(h2-h1) in KJ/kg= 0.2\n" + ] + } + ], + "source": [ + "#cal of enthalpy change\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.11, Page:180 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\")\n", + "p2=200;#feed water pump pressure in Kpa\n", + "print(\"from 1st and 2nd law;\")\n", + "print(\"T*ds=dh-v*dp\")\n", + "print(\"for isentropic process,ds=0\")\n", + "print(\"hence dh=v*dp\")\n", + "print(\"i.e (h2-h1)=v1*(p2-p1)\")\n", + "print(\"corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\")\n", + "print(\"p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\")\n", + "p1=4.25;\n", + "v1=0.001004;\n", + "deltah=v1*(p2-p1)\n", + "print(\"therefore enthalpy change(deltah)=(h2-h1) in KJ/kg=\"),round(deltah,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.12;pg no: 180" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.12, Page:180 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\n", + "from steam table at 150 degree celcius\n", + "vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\n", + "so volume occupied by water(Vw)=3*V/(3+2) in m^3 1.2\n", + "and volume of steam(Vs) in m^3= 0.8\n", + "mass of water(mf)=Vw/Vf in kg 1099.91\n", + "mass of steam(mg)=Vs/Vg in kg 2.04\n", + "total mass in tank(m) in kg= 1101.95\n", + "quality or dryness fraction(x)\n", + "x= 0.002\n", + "NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\n" + ] + } + ], + "source": [ + "#cal of quality or dryness fraction\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.12, Page:180 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\")\n", + "V=2.;#volume of vessel in m^3\n", + "print(\"from steam table at 150 degree celcius\")\n", + "print(\"vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\")\n", + "Vf=0.001091;\n", + "Vg=0.3928;\n", + "Vw=3*V/(3+2)\n", + "print(\"so volume occupied by water(Vw)=3*V/(3+2) in m^3\"),round(Vw,2)\n", + "Vs=2*V/(3+2)\n", + "print(\"and volume of steam(Vs) in m^3=\"),round(Vs,2)\n", + "mf=Vw/Vf\n", + "print(\"mass of water(mf)=Vw/Vf in kg\"),round(mf,2)\n", + "mg=Vs/Vg\n", + "print(\"mass of steam(mg)=Vs/Vg in kg\"),round(mg,2)\n", + "m=mf+mg\n", + "print(\"total mass in tank(m) in kg=\"),round(m,2)\n", + "print(\"quality or dryness fraction(x)\")\n", + "x=mg/m\n", + "print(\"x=\"),round(x,3)\n", + "print(\"NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.13;pg no: 181" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.13, Page:181 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\n", + "fron S.F.S.E on steam turbine;\n", + "W=h1-h2\n", + "initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\n", + "h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\n", + "reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\n", + "else from steam tables at 50 degree celcius saturation temperature;\n", + "hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\n", + "hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\n", + "here s1=s2,let dryness fraction at 2 be x2\n", + "x2= 0.75\n", + "hence enthalpy at state 2\n", + "h2 in KJ/kg= 1994.84\n", + "steam turbine work(W)in KJ/kg\n", + "W=h1-h2\n", + "so turbine output=W 891.36\n" + ] + } + ], + "source": [ + "#cal of turbine output\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.13, Page:181 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\")\n", + "print(\"fron S.F.S.E on steam turbine;\")\n", + "print(\"W=h1-h2\")\n", + "print(\"initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\")\n", + "print(\"h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\")\n", + "h1=2886.2;\n", + "s1=6.2285;\n", + "print(\"reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\")\n", + "print(\"else from steam tables at 50 degree celcius saturation temperature;\")\n", + "print(\"hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\")\n", + "hf=209.33;\n", + "sf=0.7038;\n", + "print(\"hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\")\n", + "hfg=2382.7;\n", + "sfg=7.3725;\n", + "print(\"here s1=s2,let dryness fraction at 2 be x2\")\n", + "x2=(s1-sf)/sfg\n", + "print(\"x2=\"),round(x2,2)\n", + "print(\"hence enthalpy at state 2\")\n", + "h2=hf+x2*hfg\n", + "print(\"h2 in KJ/kg=\"),round(h2,2)\n", + "print(\"steam turbine work(W)in KJ/kg\")\n", + "W=h1-h2\n", + "print(\"W=h1-h2\")\n", + "print(\"so turbine output=W\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.14;pg no: 181" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.14, Page:181 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\n", + "it is constant volume process\n", + "volume of vessel(V)=mass of vapour * specific volume of vapour\n", + "initial specific volume,v1\n", + "v1=vf_100Kpa+x1*vfg_100 in m^3/kg\n", + "at 100 Kpa from steam table;\n", + "hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\n", + " here vfg_100Kpa= in m^3/kg= 1.69\n", + "so v1= in m^3/kg= 0.85\n", + "and volume of vessel(V) in m^3= 42.38\n", + "enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg 1546.46\n", + "internal energy in the beginning=U1=m1*u1 in KJ 146171.0\n", + "let the mass of dry steam added be m,final specific volume inside vessel,v2\n", + "v2=vf_1000Kpa+x2*vfg_1000Kpa\n", + "at 2000 Kpa,from steam table,\n", + "vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\n", + "total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\n", + "V/v2=V/vg_2000Kpa+V/v1\n", + "so v2 in m^3/kg= 0.09\n", + "here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\n", + "at 1000 Kpa from steam table,\n", + "hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\n", + "here vfg_1000Kpa= in m^3/kg= 0.19\n", + "so x2= 0.46\n", + "for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\n", + "so mass of dry steam at 2000 Kpa to be added(m)in kg\n", + "m=(100*(h1-h2))/(h2-hg_2000Kpa)= 11.97\n", + "quality of final mixture x2= 0.46\n" + ] + } + ], + "source": [ + "#cal of quality of final mixture\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.14, Page:181 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\")\n", + "x1=0.5;#dryness fraction \n", + "m1=100;#mass of steam in kg\n", + "v1=0.8475;#\n", + "print(\"it is constant volume process\")\n", + "print(\"volume of vessel(V)=mass of vapour * specific volume of vapour\")\n", + "print(\"initial specific volume,v1\")\n", + "print(\"v1=vf_100Kpa+x1*vfg_100 in m^3/kg\")\n", + "print(\"at 100 Kpa from steam table;\")\n", + "print(\"hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\")\n", + "hf_100Kpa=417.46;\n", + "uf_100Kpa=417.36;\n", + "vf_100Kpa=0.001043;\n", + "hfg_100Kpa=2258;\n", + "ufg_100Kpa=2088.7;\n", + "vg_100Kpa=1.6940;\n", + "vfg_100Kpa=vg_100Kpa-vf_100Kpa\n", + "print(\" here vfg_100Kpa= in m^3/kg=\"),round(vfg_100Kpa,2)\n", + "v1=vf_100Kpa+x1*vfg_100Kpa\n", + "print(\"so v1= in m^3/kg=\"),round(v1,2)\n", + "V=m1*x1*v1\n", + "print(\"and volume of vessel(V) in m^3=\"),round(V,2)\n", + "h1=hf_100Kpa+x1*hfg_100Kpa\n", + "print(\"enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg\"),round(h1,2)\n", + "U1=m1*(uf_100Kpa+x1*ufg_100Kpa)\n", + "print(\"internal energy in the beginning=U1=m1*u1 in KJ\"),round(U1,2)\n", + "print(\"let the mass of dry steam added be m,final specific volume inside vessel,v2\")\n", + "print(\"v2=vf_1000Kpa+x2*vfg_1000Kpa\")\n", + "print(\"at 2000 Kpa,from steam table,\")\n", + "print(\"vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\")\n", + "vg_2000Kpa=0.09963;\n", + "ug_2000Kpa=2600.3;\n", + "hg_2000Kpa=2799.5;\n", + "print(\"total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\")\n", + "print(\"V/v2=V/vg_2000Kpa+V/v1\")\n", + "v2=1/((1/vg_2000Kpa)+(1/v1))\n", + "print(\"so v2 in m^3/kg=\"),round(v2,2)\n", + "print(\"here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\")\n", + "print(\"at 1000 Kpa from steam table,\")\n", + "print(\"hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\")\n", + "hf_1000Kpa=762.81;\n", + "hfg_1000Kpa=2015.3;\n", + "vf_1000Kpa=0.001127;\n", + "vg_1000Kpa=0.19444;\n", + "vfg_1000Kpa=vg_1000Kpa-vf_1000Kpa\n", + "print(\"here vfg_1000Kpa= in m^3/kg=\"),round(vfg_1000Kpa,2)\n", + "x2=(v2-vf_1000Kpa)/vfg_1000Kpa\n", + "print(\"so x2=\"),round(x2,2)\n", + "print(\"for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\")\n", + "print(\"so mass of dry steam at 2000 Kpa to be added(m)in kg\")\n", + "m=(100*(h1-(hf_1000Kpa+x2*hfg_1000Kpa)))/((hf_1000Kpa+x2*hfg_1000Kpa)-hg_2000Kpa)\n", + "print(\"m=(100*(h1-h2))/(h2-hg_2000Kpa)=\"),round(m,2)\n", + "print(\"quality of final mixture x2=\"),round(x2,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.15;pg no: 183" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.15, Page:183 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\n", + "from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\n", + "condenser pressure(p_condenser) in Kpa= 7.3\n", + "partial pressure of steam corresponding to35 degree celcius from steam table;\n", + "p_steam=5.628 Kpa\n", + "enthalpy corresponding to 35 degree celcius from steam table,\n", + "hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\n", + "let quality of steam entering be x\n", + "from energy balance;\n", + "mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\n", + "so dryness fraction of steam entering(x)is given as\n", + "x= 0.97\n" + ] + } + ], + "source": [ + "#cal of dryness fraction of steam entering\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.15, Page:183 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\")\n", + "p_vaccum=71.5;#recorded condenser vaccum in cm of mercury\n", + "p_barometer=76.8;#barometer reading in cm of mercury\n", + "T_cond=35;#temperature of condensation in degree celcius\n", + "T_hotwell=27.6;#temperature of hot well in degree celcius\n", + "m_cond=1930;#mass of condensate per hour\n", + "m_w=62000;#mass of cooling water per hour\n", + "Ti=8.51;#initial temperature in degree celcius\n", + "To=26.24;#outlet temperature in degree celcius\n", + "print(\"from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\")\n", + "p_condenser=(p_barometer-p_vaccum)*101.325/73.55\n", + "print(\"condenser pressure(p_condenser) in Kpa=\"),round(p_condenser,2)\n", + "print(\"partial pressure of steam corresponding to35 degree celcius from steam table;\")\n", + "print(\"p_steam=5.628 Kpa\")\n", + "p_steam=5.628;#partial pressure of steam\n", + "print(\"enthalpy corresponding to 35 degree celcius from steam table,\")\n", + "print(\"hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\")\n", + "hf=146.68;\n", + "hfg=2418.6;\n", + "print(\"let quality of steam entering be x\")\n", + "print(\"from energy balance;\")\n", + "print(\"mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\")\n", + "print(\"so dryness fraction of steam entering(x)is given as\")\n", + "x=(((m_w*(To-Ti)*4.18)/m_cond)-hf+4.18*T_hotwell)/hfg\n", + "print(\"x=\"),round(x,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.16;pg no: 184" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.16, Page:184 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\n", + "heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\n", + "area(A) in m^2= 0.03\n", + "so p1=in Kpa= 419.61\n", + "now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\n", + "volume of water contained(V1) in m^3= 0.001\n", + "mass of water(m) in kg= 0.63\n", + "heat supplied shall cause sensible heating and latent heating\n", + "hence,enthalpy change=heat supplied\n", + "Q=((hf+x*hfg)-(4.18*T)*m)\n", + "so dryness fraction of steam produced(x)can be calculated as\n", + "so x= 0.46\n", + "internal energy of water(U1)in KJ,initially\n", + "U1= 393.69\n", + "finally,internal energy of wet steam(U2)in KJ\n", + "U2=m*h2-p2*V2\n", + "here V2 in m^3= 0.13\n", + "hence U2= 940.68\n", + "hence change in internal energy(U) in KJ= 547.21\n", + "work done(W) in KJ= 53.01\n" + ] + } + ], + "source": [ + "#cal of change in internal energy and work done\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "import math\n", + "print\"Example 6.16, Page:184 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\")\n", + "F=10;#force applied externally upon piston in KN\n", + "d=.2;#diameter in m\n", + "h=0.02;#depth to which water filled in m \n", + "P_atm=101.3;#atmospheric pressure in Kpa\n", + "rho=1000;#density of water in kg/m^3\n", + "Q=600;#heat supplied to water in KJ\n", + "T=150;#temperature of water in degree celcius\n", + "print(\"heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\")\n", + "A=math.pi*d**2/4\n", + "print(\"area(A) in m^2=\"),round(A,2)\n", + "p1=F/A+P_atm\n", + "print(\"so p1=in Kpa=\"),round(p1,2)\n", + "print(\"now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\")\n", + "hf=612.1;\n", + "hfg=2128.7;\n", + "vg=0.4435;\n", + "V1=math.pi*d**2*h/4\n", + "print(\"volume of water contained(V1) in m^3=\"),round(V1,3)\n", + "m=V1*rho\n", + "print(\"mass of water(m) in kg=\"),round(m,2)\n", + "print(\"heat supplied shall cause sensible heating and latent heating\")\n", + "print(\"hence,enthalpy change=heat supplied\")\n", + "print(\"Q=((hf+x*hfg)-(4.18*T)*m)\")\n", + "print(\"so dryness fraction of steam produced(x)can be calculated as\")\n", + "x=((Q/m)+4.18*T-hf)/hfg\n", + "print(\"so x=\"),round(x,2)\n", + "print(\"internal energy of water(U1)in KJ,initially\")\n", + "h1=4.18*T;#enthalpy of water in KJ/kg\n", + "U1=m*h1-p1*V1\n", + "print(\"U1=\"),round(U1,2)\n", + "U1=393.5;#approx.\n", + "print(\"finally,internal energy of wet steam(U2)in KJ\")\n", + "print(\"U2=m*h2-p2*V2\")\n", + "V2=m*x*vg\n", + "print(\"here V2 in m^3=\"),round(V2,2)\n", + "p2=p1;#constant pressure process\n", + "U2=(m*(hf+x*hfg))-p2*V2\n", + "print(\"hence U2=\"),round(U2,2)\n", + "U2=940.71;#approx.\n", + "U=U2-U1\n", + "print(\"hence change in internal energy(U) in KJ=\"),round(U,2)\n", + "p=p1;\n", + "W=p*(V2-V1)\n", + "print(\"work done(W) in KJ=\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.17;pg no: 185" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.17, Page:185 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\n", + "consider throttling calorimeter alone,\n", + "degree of superheat(T_sup)in degree celcius\n", + "T_sup= 18.2\n", + "enthalpy of superheated steam(h_sup)in KJ/kg\n", + "h_sup= 2711.99\n", + "at 120 degree celcius,h=2673.95 KJ/kg from steam table\n", + "now enthalpy before throttling = enthalpy after throttling\n", + "hf+x2*hfg=h_sup\n", + "here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\n", + "so x2= 0.96\n", + "for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\n", + "overall dryness fraction(x)= 0.91\n" + ] + } + ], + "source": [ + "#cal of overall dryness fraction\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.17, Page:185 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\")\n", + "ms=40;#mass of steam in kg\n", + "mw=2.2;#mass of water in kg\n", + "p1=1.47;#pressure before throttling in Mpa\n", + "T2=120;#temperature after throttling in degree celcius\n", + "p2=107.88;#pressure after throttling in Kpa\n", + "Cp_sup=2.09;#specific heat of superheated steam in KJ/kg K\n", + "print(\"consider throttling calorimeter alone,\")\n", + "print(\"degree of superheat(T_sup)in degree celcius\")\n", + "T_sup=T2-101.8\n", + "print(\"T_sup=\"),round(T_sup,2)\n", + "print(\"enthalpy of superheated steam(h_sup)in KJ/kg\")\n", + "h=2673.95;\n", + "h_sup=h+T_sup*Cp_sup\n", + "print(\"h_sup=\"),round(h_sup,2)\n", + "print(\"at 120 degree celcius,h=2673.95 KJ/kg from steam table\")\n", + "print(\"now enthalpy before throttling = enthalpy after throttling\")\n", + "print(\"hf+x2*hfg=h_sup\")\n", + "print(\"here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\")\n", + "hf=840.513;\n", + "hfg=1951.02;\n", + "x2=(h_sup-hf)/hfg\n", + "print(\"so x2=\"),round(x2,2)\n", + "print(\"for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\")\n", + "x1=(ms-mw)/ms\n", + "x=x1*x2\n", + "print(\"overall dryness fraction(x)=\"),round(x,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.18;pg no: 185" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.18, Page:185 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\n", + "here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\n", + "final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\n", + "Q in KJ= 200.0\n", + "final enthalpy of dry steam at 15 bar,h2=hg_15bar\n", + "h2=2792.2 KJ/kg from steam table\n", + "let initial dryness fraction be x1,initial enthalpy,\n", + "h1=hf_10bar+x1*hfg_10bar.........eq1\n", + "here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\n", + "also heat balance yields,\n", + "h1+Q=h2\n", + "so h1=h2-Q in KJ/kg\n", + "so by eq 1=>x1= 0.91\n", + "heat added(Q)in KJ= 200.0\n", + "and initial quality(x1) 0.91\n" + ] + } + ], + "source": [ + "#cal of heat added and initial quality\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.18, Page:185 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\")\n", + "v=0.4;#volume of air in part A and part B in m^3\n", + "p1=10*10**5;#initial pressure of steam in pa\n", + "p2=15*10**5;#final pressure of steam in pa\n", + "print(\"here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\")\n", + "print(\"final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\")\n", + "Q=v*(p2-p1)/1000\n", + "print(\"Q in KJ=\"),round(Q,2)\n", + "print(\"final enthalpy of dry steam at 15 bar,h2=hg_15bar\")\n", + "print(\"h2=2792.2 KJ/kg from steam table\")\n", + "h2=2792.2;\n", + "print(\"let initial dryness fraction be x1,initial enthalpy,\")\n", + "print(\"h1=hf_10bar+x1*hfg_10bar.........eq1\")\n", + "print(\"here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\")\n", + "hf_10bar=762.83;\n", + "hfg_10bar=2015.3;\n", + "print(\"also heat balance yields,\")\n", + "print(\"h1+Q=h2\")\n", + "print(\"so h1=h2-Q in KJ/kg\")\n", + "h1=h2-Q\n", + "x1=(h1-hf_10bar)/hfg_10bar\n", + "print(\"so by eq 1=>x1=\"),round(x1,2)\n", + "print(\"heat added(Q)in KJ=\"),round(Q,2)\n", + "print(\"and initial quality(x1)\"),round(x1,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.19;pg no: 186" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.19, Page:186 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\n", + "from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\n", + "specific volume of wet steam in cylinder,v1 in m^3/kg= 0.75\n", + "dryness fraction of initial steam(x1)= 0.6\n", + "initial enthalpy of wet steam,h1 in KJ/kg= 1801.83\n", + "at 400 degree celcius specific volume of steam,v2 in m^3/kg= 1.55\n", + "for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\n", + "actual pressure can be obtained by interpolation\n", + "p2=0.20 MPa(approx.)\n", + "saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\n", + "finally the degree of superheat(T_sup)in K\n", + "T_sup=T-t\n", + "final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\n", + "heat added during process(deltaQ)in KJ\n", + "deltaQ=m*(h2-h1)\n", + "internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\n", + "here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\n", + "internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\n", + "u2=2966.7 KJ/kg\n", + "change in internal energy(deltaU)in KJ\n", + "deltaU= 3807.41\n", + "form first law of thermodynamics,work done(deltaW)in KJ\n", + "deltaW=deltaQ-deltaU 616.88\n", + "so heat transfer(deltaQ)in KJ 4424.3\n", + "and work transfer(deltaW)in KJ 616.88\n", + "NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\n", + "and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\n" + ] + } + ], + "source": [ + "#cal of heat and work transfer \n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.19, Page:186 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\")\n", + "m=3;#mass of wet steam in kg\n", + "p=1.4;#pressure of wet steam in bar\n", + "V1=2.25;#initial volume in m^3\n", + "V2=4.65;#final volume in m^3\n", + "T=400;#temperature of steam in degreee celcius\n", + "print(\"from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\")\n", + "vg=1.2455;\n", + "hf=457.99;\n", + "hfg=2232.3;\n", + "v1=V1/m\n", + "print(\"specific volume of wet steam in cylinder,v1 in m^3/kg=\"),round(v1,2)\n", + "x1=v1/vg\n", + "print(\"dryness fraction of initial steam(x1)=\"),round(x1,2)\n", + "x1=0.602;#approx.\n", + "h1=hf+x1*hfg\n", + "print(\"initial enthalpy of wet steam,h1 in KJ/kg=\"),round(h1,2)\n", + "v2=V2/m\n", + "print(\"at 400 degree celcius specific volume of steam,v2 in m^3/kg=\"),round(v2,2)\n", + "print(\"for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\")\n", + "print(\"actual pressure can be obtained by interpolation\")\n", + "p2=.1+((0.20-0.10)/(1.5493-3.103))*(1.55-3.103)\n", + "print(\"p2=0.20 MPa(approx.)\")\n", + "p2=0.20;\n", + "print(\"saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\")\n", + "t=120.23;\n", + "print(\"finally the degree of superheat(T_sup)in K\")\n", + "print(\"T_sup=T-t\")\n", + "T_sup=T-t\n", + "print(\"final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\")\n", + "h2=3276.6;\n", + "print(\"heat added during process(deltaQ)in KJ\")\n", + "print(\"deltaQ=m*(h2-h1)\")\n", + "deltaQ=m*(h2-h1)\n", + "print(\"internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\")\n", + "print(\"here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\")\n", + "uf=457.84;\n", + "ufg=2059.34;\n", + "u1=uf+x1*ufg\n", + "print(\"internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\")\n", + "print(\"u2=2966.7 KJ/kg\")\n", + "u2=2966.7;\n", + "print(\"change in internal energy(deltaU)in KJ\")\n", + "deltaU=m*(u2-u1)\n", + "print(\"deltaU=\"),round(deltaU,2)\n", + "print(\"form first law of thermodynamics,work done(deltaW)in KJ\")\n", + "deltaW=deltaQ-deltaU\n", + "print(\"deltaW=deltaQ-deltaU\"),round(deltaW,2)\n", + "print(\"so heat transfer(deltaQ)in KJ\"),round(deltaQ,2)\n", + "print(\"and work transfer(deltaW)in KJ\"),round(deltaW,2)\n", + "print(\"NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\")\n", + "print(\"and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.20;pg no: 187" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.20, Page:187 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\n", + "here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\n", + "at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\n", + "finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\n", + "h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\n", + "h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\n", + "so final temperature(T2)in K\n", + "T2= 495.43\n", + "entropy for final state(s2)in KJ/kg K\n", + "s2= 8.82\n", + "here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\n", + "so change in entropy(deltaS)in KJ/kg K\n", + "deltaS= 1.06\n", + "final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\n", + "here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\n", + "percentage of vessel volume initially occupied by steam(V)= 9.99\n" + ] + } + ], + "source": [ + "#cal of percentage of vessel volume initially occupied by steam\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.20, Page:187 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\")\n", + "print(\"here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\")\n", + "print(\"at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\")\n", + "h1_10bar_500oc=3478.5;\n", + "s1_10bar_500oc=7.7622;\n", + "v1_10bar_500oc=0.3541;\n", + "print(\"finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\")\n", + "h2=h1_10bar_500oc;\n", + "print(\"h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\")\n", + "h_1bar_400oc=3278.2;\n", + "h_1bar_500oc=3488.1;\n", + "print(\"h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\")\n", + "print(\"so final temperature(T2)in K\")\n", + "T2=400+((h2-h_1bar_400oc)*(500-400)/(h_1bar_500oc-h_1bar_400oc))\n", + "print(\"T2=\"),round(T2,2)\n", + "print(\"entropy for final state(s2)in KJ/kg K\")\n", + "s_1bar_400oc=8.5435;\n", + "s_1bar_500oc=8.8342;\n", + "s2=s_1bar_400oc+((s_1bar_500oc-s_1bar_400oc)*(495.43-400)/(500-400))\n", + "print(\"s2=\"),round(s2,2)\n", + "print(\"here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\")\n", + "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", + "deltaS=s2-s1_10bar_500oc\n", + "print(\"deltaS=\"),round(deltaS,2)\n", + "print(\"final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\")\n", + "print(\"here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\")\n", + "v_1bar_500oc=3.565;\n", + "v_1bar_400oc=3.103;\n", + "v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400))\n", + "V=v1_10bar_500oc*100/v2\n", + "print(\"percentage of vessel volume initially occupied by steam(V)=\"),round(V,2)\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter6_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter6_1.ipynb new file mode 100755 index 00000000..92ef2871 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter6_1.ipynb @@ -0,0 +1,1390 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6:Thermo dynamic Properties of pure substance" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.1;pg no: 174" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.1, Page:174 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\n", + "NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.1, Page:174 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\")\n", + "print(\"NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.2;pg no: 175" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.2, Page:175 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\n", + "during throttling,h1=h2\n", + "at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\n", + "thus h2=2682.5 KJ/kg\n", + "at state 1,before throttling\n", + "hf_10Mpa=1407.56 KJ/kg\n", + "hfg_10Mpa=1317.1 KJ/kg\n", + "h1=hf_10Mpa+x1*hfg_10Mpa\n", + "dryness fraction(x1)may be given as\n", + "x1= 0.97\n" + ] + } + ], + "source": [ + "#cal of dryness fraction\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.2, Page:175 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\")\n", + "print(\"during throttling,h1=h2\")\n", + "print(\"at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\")\n", + "print(\"thus h2=2682.5 KJ/kg\")\n", + "h2=2682.5;\n", + "print(\"at state 1,before throttling\")\n", + "print(\"hf_10Mpa=1407.56 KJ/kg\")\n", + "hf_10Mpa=1407.56;\n", + "print(\"hfg_10Mpa=1317.1 KJ/kg\")\n", + "hfg_10Mpa=1317.1;\n", + "print(\"h1=hf_10Mpa+x1*hfg_10Mpa\")\n", + "h1=h2;#during throttling\n", + "print(\"dryness fraction(x1)may be given as\")\n", + "x1=(h1-hf_10Mpa)/hfg_10Mpa\n", + "print(\"x1=\"),round(x1,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.3;pg no: 176" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.3, Page:176 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\n", + "internal energy(u)=in KJ/kg 2644.0\n" + ] + } + ], + "source": [ + "#cal of internal energy\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.3, Page:176 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\")\n", + "h=2848;#enthalpy in KJ/kg\n", + "p=12*1000;#pressure in Kpa\n", + "v=0.017;#specific volume in m^3/kg\n", + "u=h-p*v\n", + "print(\"internal energy(u)=in KJ/kg\"),round(u,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.4;pg no: 176" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.4, Page:176 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\n", + "steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\n", + "entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\n", + "S= 6.65\n", + "entropy of 5 kg of steam(S)in KJ/K\n", + "S=m*S 33.23\n" + ] + } + ], + "source": [ + "#cal of entropy of 5 kg of steam\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "import math\n", + "print\"Example 6.4, Page:176 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\")\n", + "m=5;#mass of steam in kg\n", + "p=2;#pressure of steam in Mpa\n", + "T_superheat=(300+273.15);#temperature of superheat steam in K\n", + "Cp_water=4.18;#specific heat of water at constant pressure in KJ/kg K\n", + "Cp_superheat=2.1;#specific heat of superheat steam at constant pressure in KJ/kg K\n", + "print(\"steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\")\n", + "T_sat=(212.42+273.15);#saturation temperature at 2 Mpa in K\n", + "hfg_2Mpa=1890.7;\n", + "print(\"entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\")\n", + "S=Cp_water*math.log(T_sat/273.15)+(hfg_2Mpa/T_sat)+(Cp_superheat*math.log(T_superheat/T_sat))\n", + "print(\"S=\"),round(S,2)\n", + "print(\"entropy of 5 kg of steam(S)in KJ/K\")\n", + "S=m*S\n", + "print(\"S=m*S\"),round(S,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.5;pg no: 176" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.5, Page:176 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\n", + "boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\n", + "at further depth of 50 cm the pressure(p)in Kpa\n", + "p= 138.37\n", + "boiling point at this depth=Tsat_138.365\n", + "from steam table this temperature=108.866=108.87 degree celcius\n", + "so boiling point = 108.87 degree celcius\n" + ] + } + ], + "source": [ + "#cal of boiling point\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.5, Page:176 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\")\n", + "rho=1000;#density of water in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "h=0.50;#depth from above mentioned level in m\n", + "print(\"boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\")\n", + "p_boil=143.27;#pressure at which pond water boils in Kpa\n", + "print(\"at further depth of 50 cm the pressure(p)in Kpa\")\n", + "p=p_boil-((rho*g*h)*10**-3)\n", + "print(\"p=\"),round(p,2)\n", + "print(\"boiling point at this depth=Tsat_138.365\")\n", + "print(\"from steam table this temperature=108.866=108.87 degree celcius\")\n", + "print(\"so boiling point = 108.87 degree celcius\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.6;pg no: 177" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.6, Page:177 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\n", + "in a rigid vessel it can be treated as constant volume process.\n", + "so v1=v2\n", + "since final state is given to be critical state,then specific volume at critical point,\n", + "v2=0.003155 m^3/kg\n", + "at 100 degree celcius saturation temperature,from steam table\n", + "vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\n", + "and vfg_100=in m^3/kg= 1.67\n", + "thus for initial quality being x1\n", + "v1=vf_100+x1*vfg_100\n", + "so x1= 0.001\n", + "mass of water initially=total mass*(1-x1)\n", + "total mass of fluid/water(m) in kg= 158.48\n", + "volume of water(v) in m^3= 0.1655\n" + ] + } + ], + "source": [ + "#cal of mass and volume of water\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.6, Page:177 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\")\n", + "V=0.5;#capacity of rigid vessel in m^3\n", + "print(\"in a rigid vessel it can be treated as constant volume process.\")\n", + "print(\"so v1=v2\")\n", + "print(\"since final state is given to be critical state,then specific volume at critical point,\")\n", + "print(\"v2=0.003155 m^3/kg\")\n", + "v2=0.003155;#specific volume at critical point in m^3/kg\n", + "print(\"at 100 degree celcius saturation temperature,from steam table\")\n", + "print(\"vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\")\n", + "vf_100=0.001044;\n", + "vg_100=1.6729;\n", + "vfg_100=vg_100-vf_100\n", + "print(\"and vfg_100=in m^3/kg=\"),round(vfg_100,2)\n", + "print(\"thus for initial quality being x1\")\n", + "v1=v2;#rigid vessel\n", + "x1=(v1-vf_100)/vfg_100\n", + "print(\"v1=vf_100+x1*vfg_100\")\n", + "print(\"so x1=\"),round(x1,3)\n", + "print(\"mass of water initially=total mass*(1-x1)\")\n", + "m=V/v2\n", + "print(\"total mass of fluid/water(m) in kg=\"),round(m,2)\n", + "v=m*vf_100\n", + "print(\"volume of water(v) in m^3=\"),round(v,4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.7;pg no: 177" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.7, Page:177 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\n", + "on mollier diadram(h-s diagram)the slope of isobaric line may be given as\n", + "(dh/ds)_p=cons =slope of isobar\n", + "from 1st and 2nd law combined;\n", + "T*ds=dh-v*dp\n", + "(dh/ds)_p=cons = T\n", + "here temperature,T=773.15 K\n", + "here slope=(dh/ds))p=cons = 773.15\n" + ] + } + ], + "source": [ + "#cal of slope\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.7, Page:177 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\")\n", + "print(\"on mollier diadram(h-s diagram)the slope of isobaric line may be given as\")\n", + "print(\"(dh/ds)_p=cons =slope of isobar\")\n", + "print(\"from 1st and 2nd law combined;\")\n", + "print(\"T*ds=dh-v*dp\")\n", + "print(\"(dh/ds)_p=cons = T\")\n", + "print(\"here temperature,T=773.15 K\")\n", + "print(\"here slope=(dh/ds))p=cons = 773.15\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.8;pg no: 178" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.8, Page:178 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\n", + "at 0.15Mpa,from steam table;\n", + "hf=467.11 KJ/kg,hg=2693.6 KJ/kg\n", + "and hfg in KJ/kg= 2226.49\n", + "vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\n", + "and vfg in m^3/kg= 1.16\n", + "sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\n", + "and sfg=in KJ/kg K= 5.79\n", + "enthalpy at x=.10(h)in KJ/kg\n", + "h= 689.76\n", + "specific volume,(v)in m^3/kg\n", + "v= 0.12\n", + "entropy (s)in KJ/kg K\n", + "s= 2.01\n" + ] + } + ], + "source": [ + "#cal of entropy\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.8, Page:178 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\")\n", + "x=.10;#quality is 10%\n", + "print(\"at 0.15Mpa,from steam table;\")\n", + "print(\"hf=467.11 KJ/kg,hg=2693.6 KJ/kg\")\n", + "hf=467.11;\n", + "hg=2693.6;\n", + "hfg=hg-hf\n", + "print(\"and hfg in KJ/kg=\"),round(hfg,2)\n", + "print(\"vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\")\n", + "vf=0.001053;\n", + "vg=1.1593;\n", + "vfg=vg-vf\n", + "print(\"and vfg in m^3/kg=\"),round(vfg,2)\n", + "print(\"sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\")\n", + "sf=1.4336;\n", + "sg=7.2233;\n", + "sfg=sg-sf\n", + "print(\"and sfg=in KJ/kg K=\"),round(sfg,2)\n", + "print(\"enthalpy at x=.10(h)in KJ/kg\")\n", + "h=hf+x*hfg\n", + "print(\"h=\"),round(h,2)\n", + "print(\"specific volume,(v)in m^3/kg\")\n", + "v=vf+x*vfg\n", + "print(\"v=\"),round(v,2)\n", + "print(\"entropy (s)in KJ/kg K\")\n", + "s=sf+x*sfg\n", + "print(\"s=\"),round(s,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.9;pg no: 178" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.9, Page:178 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\n", + "work done during constant pressure process(W)=p1*(V2-V1)in KJ\n", + "now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\n", + "so v1 in m^3/kg=\n", + "now mass of steam(m) in kg= 0.32\n", + "specific volume at final state(v2)in m^3/kg\n", + "v2= 0.62\n", + "corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\n", + "v2>vg_1Mpa\n", + "hence state lies in superheated region,from the steam table by interpolation we get temperature as;\n", + "state lies between temperature of 1000 degree celcius and 1100 degree celcius\n", + "so exact temperature at final state(T)in K= 1077.61\n", + "thus internal energy at final state,1 Mpa,1077.61 degree celcius;\n", + "u2=4209.6 KJ/kg\n", + "internal energy at initial state(u1)in KJ/kg\n", + "u1= 2219.28\n", + "from first law of thermodynamics,Q-W=deltaU\n", + "so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ= 788.83\n" + ] + } + ], + "source": [ + "#cal of heat added\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.9, Page:178 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\")\n", + "p1=1*1000;#initial pressure of steam in Kpa\n", + "V1=0.05;#initial volume of steam in m^3\n", + "x1=.8;#dryness fraction is 80%\n", + "V2=0.2;#final volume of steam in m^3\n", + "p2=p1;#constant pressure process\n", + "print(\"work done during constant pressure process(W)=p1*(V2-V1)in KJ\")\n", + "W=p1*(V2-V1)\n", + "print(\"now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\")\n", + "vf=0.001127;\n", + "vg=0.19444;\n", + "uf=761.68;\n", + "ufg=1822;\n", + "v1=vf+x1*vg\n", + "print(\"so v1 in m^3/kg=\")\n", + "m=V1/v1\n", + "print(\"now mass of steam(m) in kg=\"),round(m,2)\n", + "m=0.32097;#take m=0.32097 approx.\n", + "print(\"specific volume at final state(v2)in m^3/kg\")\n", + "v2=V2/m\n", + "print(\"v2=\"),round(v2,2)\n", + "print(\"corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\")\n", + "print(\"v2>vg_1Mpa\")\n", + "print(\"hence state lies in superheated region,from the steam table by interpolation we get temperature as;\")\n", + "print(\"state lies between temperature of 1000 degree celcius and 1100 degree celcius\")\n", + "T=1000+((100*(.62311-.5871))/(.6335-.5871))\n", + "print(\"so exact temperature at final state(T)in K=\"),round(T,2)\n", + "print(\"thus internal energy at final state,1 Mpa,1077.61 degree celcius;\")\n", + "print(\"u2=4209.6 KJ/kg\")\n", + "u2=4209.6;\n", + "print(\"internal energy at initial state(u1)in KJ/kg\")\n", + "u1=uf+x1*ufg\n", + "print(\"u1=\"),round(u1,2)\n", + "print(\"from first law of thermodynamics,Q-W=deltaU\")\n", + "Q=m*(u2-u1)+W\n", + "print(\"so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ=\"),round(Q,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.10;pg no: 179" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.10, Page:179 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\n", + "here steam is kept in rigid vessel,therefore its specific volume shall remain constant\n", + "it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\n", + "from superheated steam table;v1=0.2404 m^3/kg\n", + "at begining of condensation specific volume = 0.2404 m^3/kg\n", + "v2=0.2404 m^3/kg\n", + "this v2 shall be specific volume corresponding to saturated vapour state for condensation.\n", + "thus v2=vg=0.2404 m^3/kg\n", + "looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\n", + "by interpolation,temperature at begining of condensation(T2)in K\n", + "similarily,pressure(p2)in Kpa= 800.96\n" + ] + } + ], + "source": [ + "#cal of pressure\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.10, Page:179 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\")\n", + "p1=800;#initial pressure of steam in Kpa\n", + "T1=200;#initial temperature of steam in degree celcius\n", + "print(\"here steam is kept in rigid vessel,therefore its specific volume shall remain constant\")\n", + "print(\"it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\")\n", + "print(\"from superheated steam table;v1=0.2404 m^3/kg\")\n", + "print(\"at begining of condensation specific volume = 0.2404 m^3/kg\")\n", + "print(\"v2=0.2404 m^3/kg\")\n", + "v2=0.2404;\n", + "print(\"this v2 shall be specific volume corresponding to saturated vapour state for condensation.\")\n", + "print(\"thus v2=vg=0.2404 m^3/kg\")\n", + "vg=v2;\n", + "print(\"looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\")\n", + "print(\"by interpolation,temperature at begining of condensation(T2)in K\")\n", + "T2=175-((175-170)*(0.2404-0.2167))/(0.2428-.2168)\n", + "p=892-(((892-791.7)*(0.2404-0.2168))/(0.2428-0.2168))\n", + "print(\"similarily,pressure(p2)in Kpa=\"),round(p,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.11;pg no: 180" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.11, Page:180 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\n", + "from 1st and 2nd law;\n", + "T*ds=dh-v*dp\n", + "for isentropic process,ds=0\n", + "hence dh=v*dp\n", + "i.e (h2-h1)=v1*(p2-p1)\n", + "corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\n", + "p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\n", + "therefore enthalpy change(deltah)=(h2-h1) in KJ/kg= 0.2\n" + ] + } + ], + "source": [ + "#cal of enthalpy change\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.11, Page:180 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\")\n", + "p2=200;#feed water pump pressure in Kpa\n", + "print(\"from 1st and 2nd law;\")\n", + "print(\"T*ds=dh-v*dp\")\n", + "print(\"for isentropic process,ds=0\")\n", + "print(\"hence dh=v*dp\")\n", + "print(\"i.e (h2-h1)=v1*(p2-p1)\")\n", + "print(\"corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\")\n", + "print(\"p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\")\n", + "p1=4.25;\n", + "v1=0.001004;\n", + "deltah=v1*(p2-p1)\n", + "print(\"therefore enthalpy change(deltah)=(h2-h1) in KJ/kg=\"),round(deltah,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.12;pg no: 180" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.12, Page:180 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\n", + "from steam table at 150 degree celcius\n", + "vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\n", + "so volume occupied by water(Vw)=3*V/(3+2) in m^3 1.2\n", + "and volume of steam(Vs) in m^3= 0.8\n", + "mass of water(mf)=Vw/Vf in kg 1099.91\n", + "mass of steam(mg)=Vs/Vg in kg 2.04\n", + "total mass in tank(m) in kg= 1101.95\n", + "quality or dryness fraction(x)\n", + "x= 0.002\n", + "NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\n" + ] + } + ], + "source": [ + "#cal of quality or dryness fraction\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.12, Page:180 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\")\n", + "V=2.;#volume of vessel in m^3\n", + "print(\"from steam table at 150 degree celcius\")\n", + "print(\"vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\")\n", + "Vf=0.001091;\n", + "Vg=0.3928;\n", + "Vw=3*V/(3+2)\n", + "print(\"so volume occupied by water(Vw)=3*V/(3+2) in m^3\"),round(Vw,2)\n", + "Vs=2*V/(3+2)\n", + "print(\"and volume of steam(Vs) in m^3=\"),round(Vs,2)\n", + "mf=Vw/Vf\n", + "print(\"mass of water(mf)=Vw/Vf in kg\"),round(mf,2)\n", + "mg=Vs/Vg\n", + "print(\"mass of steam(mg)=Vs/Vg in kg\"),round(mg,2)\n", + "m=mf+mg\n", + "print(\"total mass in tank(m) in kg=\"),round(m,2)\n", + "print(\"quality or dryness fraction(x)\")\n", + "x=mg/m\n", + "print(\"x=\"),round(x,3)\n", + "print(\"NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.13;pg no: 181" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.13, Page:181 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\n", + "fron S.F.S.E on steam turbine;\n", + "W=h1-h2\n", + "initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\n", + "h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\n", + "reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\n", + "else from steam tables at 50 degree celcius saturation temperature;\n", + "hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\n", + "hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\n", + "here s1=s2,let dryness fraction at 2 be x2\n", + "x2= 0.75\n", + "hence enthalpy at state 2\n", + "h2 in KJ/kg= 1994.84\n", + "steam turbine work(W)in KJ/kg\n", + "W=h1-h2\n", + "so turbine output=W 891.36\n" + ] + } + ], + "source": [ + "#cal of turbine output\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.13, Page:181 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\")\n", + "print(\"fron S.F.S.E on steam turbine;\")\n", + "print(\"W=h1-h2\")\n", + "print(\"initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\")\n", + "print(\"h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\")\n", + "h1=2886.2;\n", + "s1=6.2285;\n", + "print(\"reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\")\n", + "print(\"else from steam tables at 50 degree celcius saturation temperature;\")\n", + "print(\"hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\")\n", + "hf=209.33;\n", + "sf=0.7038;\n", + "print(\"hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\")\n", + "hfg=2382.7;\n", + "sfg=7.3725;\n", + "print(\"here s1=s2,let dryness fraction at 2 be x2\")\n", + "x2=(s1-sf)/sfg\n", + "print(\"x2=\"),round(x2,2)\n", + "print(\"hence enthalpy at state 2\")\n", + "h2=hf+x2*hfg\n", + "print(\"h2 in KJ/kg=\"),round(h2,2)\n", + "print(\"steam turbine work(W)in KJ/kg\")\n", + "W=h1-h2\n", + "print(\"W=h1-h2\")\n", + "print(\"so turbine output=W\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.14;pg no: 181" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.14, Page:181 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\n", + "it is constant volume process\n", + "volume of vessel(V)=mass of vapour * specific volume of vapour\n", + "initial specific volume,v1\n", + "v1=vf_100Kpa+x1*vfg_100 in m^3/kg\n", + "at 100 Kpa from steam table;\n", + "hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\n", + " here vfg_100Kpa= in m^3/kg= 1.69\n", + "so v1= in m^3/kg= 0.85\n", + "and volume of vessel(V) in m^3= 42.38\n", + "enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg 1546.46\n", + "internal energy in the beginning=U1=m1*u1 in KJ 146171.0\n", + "let the mass of dry steam added be m,final specific volume inside vessel,v2\n", + "v2=vf_1000Kpa+x2*vfg_1000Kpa\n", + "at 2000 Kpa,from steam table,\n", + "vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\n", + "total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\n", + "V/v2=V/vg_2000Kpa+V/v1\n", + "so v2 in m^3/kg= 0.09\n", + "here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\n", + "at 1000 Kpa from steam table,\n", + "hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\n", + "here vfg_1000Kpa= in m^3/kg= 0.19\n", + "so x2= 0.46\n", + "for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\n", + "so mass of dry steam at 2000 Kpa to be added(m)in kg\n", + "m=(100*(h1-h2))/(h2-hg_2000Kpa)= 11.97\n", + "quality of final mixture x2= 0.46\n" + ] + } + ], + "source": [ + "#cal of quality of final mixture\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.14, Page:181 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\")\n", + "x1=0.5;#dryness fraction \n", + "m1=100;#mass of steam in kg\n", + "v1=0.8475;#\n", + "print(\"it is constant volume process\")\n", + "print(\"volume of vessel(V)=mass of vapour * specific volume of vapour\")\n", + "print(\"initial specific volume,v1\")\n", + "print(\"v1=vf_100Kpa+x1*vfg_100 in m^3/kg\")\n", + "print(\"at 100 Kpa from steam table;\")\n", + "print(\"hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\")\n", + "hf_100Kpa=417.46;\n", + "uf_100Kpa=417.36;\n", + "vf_100Kpa=0.001043;\n", + "hfg_100Kpa=2258;\n", + "ufg_100Kpa=2088.7;\n", + "vg_100Kpa=1.6940;\n", + "vfg_100Kpa=vg_100Kpa-vf_100Kpa\n", + "print(\" here vfg_100Kpa= in m^3/kg=\"),round(vfg_100Kpa,2)\n", + "v1=vf_100Kpa+x1*vfg_100Kpa\n", + "print(\"so v1= in m^3/kg=\"),round(v1,2)\n", + "V=m1*x1*v1\n", + "print(\"and volume of vessel(V) in m^3=\"),round(V,2)\n", + "h1=hf_100Kpa+x1*hfg_100Kpa\n", + "print(\"enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg\"),round(h1,2)\n", + "U1=m1*(uf_100Kpa+x1*ufg_100Kpa)\n", + "print(\"internal energy in the beginning=U1=m1*u1 in KJ\"),round(U1,2)\n", + "print(\"let the mass of dry steam added be m,final specific volume inside vessel,v2\")\n", + "print(\"v2=vf_1000Kpa+x2*vfg_1000Kpa\")\n", + "print(\"at 2000 Kpa,from steam table,\")\n", + "print(\"vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\")\n", + "vg_2000Kpa=0.09963;\n", + "ug_2000Kpa=2600.3;\n", + "hg_2000Kpa=2799.5;\n", + "print(\"total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\")\n", + "print(\"V/v2=V/vg_2000Kpa+V/v1\")\n", + "v2=1/((1/vg_2000Kpa)+(1/v1))\n", + "print(\"so v2 in m^3/kg=\"),round(v2,2)\n", + "print(\"here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\")\n", + "print(\"at 1000 Kpa from steam table,\")\n", + "print(\"hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\")\n", + "hf_1000Kpa=762.81;\n", + "hfg_1000Kpa=2015.3;\n", + "vf_1000Kpa=0.001127;\n", + "vg_1000Kpa=0.19444;\n", + "vfg_1000Kpa=vg_1000Kpa-vf_1000Kpa\n", + "print(\"here vfg_1000Kpa= in m^3/kg=\"),round(vfg_1000Kpa,2)\n", + "x2=(v2-vf_1000Kpa)/vfg_1000Kpa\n", + "print(\"so x2=\"),round(x2,2)\n", + "print(\"for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\")\n", + "print(\"so mass of dry steam at 2000 Kpa to be added(m)in kg\")\n", + "m=(100*(h1-(hf_1000Kpa+x2*hfg_1000Kpa)))/((hf_1000Kpa+x2*hfg_1000Kpa)-hg_2000Kpa)\n", + "print(\"m=(100*(h1-h2))/(h2-hg_2000Kpa)=\"),round(m,2)\n", + "print(\"quality of final mixture x2=\"),round(x2,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.15;pg no: 183" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.15, Page:183 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\n", + "from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\n", + "condenser pressure(p_condenser) in Kpa= 7.3\n", + "partial pressure of steam corresponding to35 degree celcius from steam table;\n", + "p_steam=5.628 Kpa\n", + "enthalpy corresponding to 35 degree celcius from steam table,\n", + "hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\n", + "let quality of steam entering be x\n", + "from energy balance;\n", + "mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\n", + "so dryness fraction of steam entering(x)is given as\n", + "x= 0.97\n" + ] + } + ], + "source": [ + "#cal of dryness fraction of steam entering\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.15, Page:183 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\")\n", + "p_vaccum=71.5;#recorded condenser vaccum in cm of mercury\n", + "p_barometer=76.8;#barometer reading in cm of mercury\n", + "T_cond=35;#temperature of condensation in degree celcius\n", + "T_hotwell=27.6;#temperature of hot well in degree celcius\n", + "m_cond=1930;#mass of condensate per hour\n", + "m_w=62000;#mass of cooling water per hour\n", + "Ti=8.51;#initial temperature in degree celcius\n", + "To=26.24;#outlet temperature in degree celcius\n", + "print(\"from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\")\n", + "p_condenser=(p_barometer-p_vaccum)*101.325/73.55\n", + "print(\"condenser pressure(p_condenser) in Kpa=\"),round(p_condenser,2)\n", + "print(\"partial pressure of steam corresponding to35 degree celcius from steam table;\")\n", + "print(\"p_steam=5.628 Kpa\")\n", + "p_steam=5.628;#partial pressure of steam\n", + "print(\"enthalpy corresponding to 35 degree celcius from steam table,\")\n", + "print(\"hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\")\n", + "hf=146.68;\n", + "hfg=2418.6;\n", + "print(\"let quality of steam entering be x\")\n", + "print(\"from energy balance;\")\n", + "print(\"mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\")\n", + "print(\"so dryness fraction of steam entering(x)is given as\")\n", + "x=(((m_w*(To-Ti)*4.18)/m_cond)-hf+4.18*T_hotwell)/hfg\n", + "print(\"x=\"),round(x,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.16;pg no: 184" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.16, Page:184 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\n", + "heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\n", + "area(A) in m^2= 0.03\n", + "so p1=in Kpa= 419.61\n", + "now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\n", + "volume of water contained(V1) in m^3= 0.001\n", + "mass of water(m) in kg= 0.63\n", + "heat supplied shall cause sensible heating and latent heating\n", + "hence,enthalpy change=heat supplied\n", + "Q=((hf+x*hfg)-(4.18*T)*m)\n", + "so dryness fraction of steam produced(x)can be calculated as\n", + "so x= 0.46\n", + "internal energy of water(U1)in KJ,initially\n", + "U1= 393.69\n", + "finally,internal energy of wet steam(U2)in KJ\n", + "U2=m*h2-p2*V2\n", + "here V2 in m^3= 0.13\n", + "hence U2= 940.68\n", + "hence change in internal energy(U) in KJ= 547.21\n", + "work done(W) in KJ= 53.01\n" + ] + } + ], + "source": [ + "#cal of change in internal energy and work done\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "import math\n", + "print\"Example 6.16, Page:184 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\")\n", + "F=10;#force applied externally upon piston in KN\n", + "d=.2;#diameter in m\n", + "h=0.02;#depth to which water filled in m \n", + "P_atm=101.3;#atmospheric pressure in Kpa\n", + "rho=1000;#density of water in kg/m^3\n", + "Q=600;#heat supplied to water in KJ\n", + "T=150;#temperature of water in degree celcius\n", + "print(\"heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\")\n", + "A=math.pi*d**2/4\n", + "print(\"area(A) in m^2=\"),round(A,2)\n", + "p1=F/A+P_atm\n", + "print(\"so p1=in Kpa=\"),round(p1,2)\n", + "print(\"now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\")\n", + "hf=612.1;\n", + "hfg=2128.7;\n", + "vg=0.4435;\n", + "V1=math.pi*d**2*h/4\n", + "print(\"volume of water contained(V1) in m^3=\"),round(V1,3)\n", + "m=V1*rho\n", + "print(\"mass of water(m) in kg=\"),round(m,2)\n", + "print(\"heat supplied shall cause sensible heating and latent heating\")\n", + "print(\"hence,enthalpy change=heat supplied\")\n", + "print(\"Q=((hf+x*hfg)-(4.18*T)*m)\")\n", + "print(\"so dryness fraction of steam produced(x)can be calculated as\")\n", + "x=((Q/m)+4.18*T-hf)/hfg\n", + "print(\"so x=\"),round(x,2)\n", + "print(\"internal energy of water(U1)in KJ,initially\")\n", + "h1=4.18*T;#enthalpy of water in KJ/kg\n", + "U1=m*h1-p1*V1\n", + "print(\"U1=\"),round(U1,2)\n", + "U1=393.5;#approx.\n", + "print(\"finally,internal energy of wet steam(U2)in KJ\")\n", + "print(\"U2=m*h2-p2*V2\")\n", + "V2=m*x*vg\n", + "print(\"here V2 in m^3=\"),round(V2,2)\n", + "p2=p1;#constant pressure process\n", + "U2=(m*(hf+x*hfg))-p2*V2\n", + "print(\"hence U2=\"),round(U2,2)\n", + "U2=940.71;#approx.\n", + "U=U2-U1\n", + "print(\"hence change in internal energy(U) in KJ=\"),round(U,2)\n", + "p=p1;\n", + "W=p*(V2-V1)\n", + "print(\"work done(W) in KJ=\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.17;pg no: 185" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.17, Page:185 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\n", + "consider throttling calorimeter alone,\n", + "degree of superheat(T_sup)in degree celcius\n", + "T_sup= 18.2\n", + "enthalpy of superheated steam(h_sup)in KJ/kg\n", + "h_sup= 2711.99\n", + "at 120 degree celcius,h=2673.95 KJ/kg from steam table\n", + "now enthalpy before throttling = enthalpy after throttling\n", + "hf+x2*hfg=h_sup\n", + "here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\n", + "so x2= 0.96\n", + "for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\n", + "overall dryness fraction(x)= 0.91\n" + ] + } + ], + "source": [ + "#cal of overall dryness fraction\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.17, Page:185 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\")\n", + "ms=40;#mass of steam in kg\n", + "mw=2.2;#mass of water in kg\n", + "p1=1.47;#pressure before throttling in Mpa\n", + "T2=120;#temperature after throttling in degree celcius\n", + "p2=107.88;#pressure after throttling in Kpa\n", + "Cp_sup=2.09;#specific heat of superheated steam in KJ/kg K\n", + "print(\"consider throttling calorimeter alone,\")\n", + "print(\"degree of superheat(T_sup)in degree celcius\")\n", + "T_sup=T2-101.8\n", + "print(\"T_sup=\"),round(T_sup,2)\n", + "print(\"enthalpy of superheated steam(h_sup)in KJ/kg\")\n", + "h=2673.95;\n", + "h_sup=h+T_sup*Cp_sup\n", + "print(\"h_sup=\"),round(h_sup,2)\n", + "print(\"at 120 degree celcius,h=2673.95 KJ/kg from steam table\")\n", + "print(\"now enthalpy before throttling = enthalpy after throttling\")\n", + "print(\"hf+x2*hfg=h_sup\")\n", + "print(\"here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\")\n", + "hf=840.513;\n", + "hfg=1951.02;\n", + "x2=(h_sup-hf)/hfg\n", + "print(\"so x2=\"),round(x2,2)\n", + "print(\"for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\")\n", + "x1=(ms-mw)/ms\n", + "x=x1*x2\n", + "print(\"overall dryness fraction(x)=\"),round(x,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.18;pg no: 185" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.18, Page:185 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\n", + "here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\n", + "final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\n", + "Q in KJ= 200.0\n", + "final enthalpy of dry steam at 15 bar,h2=hg_15bar\n", + "h2=2792.2 KJ/kg from steam table\n", + "let initial dryness fraction be x1,initial enthalpy,\n", + "h1=hf_10bar+x1*hfg_10bar.........eq1\n", + "here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\n", + "also heat balance yields,\n", + "h1+Q=h2\n", + "so h1=h2-Q in KJ/kg\n", + "so by eq 1=>x1= 0.91\n", + "heat added(Q)in KJ= 200.0\n", + "and initial quality(x1) 0.91\n" + ] + } + ], + "source": [ + "#cal of heat added and initial quality\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.18, Page:185 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\")\n", + "v=0.4;#volume of air in part A and part B in m^3\n", + "p1=10*10**5;#initial pressure of steam in pa\n", + "p2=15*10**5;#final pressure of steam in pa\n", + "print(\"here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\")\n", + "print(\"final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\")\n", + "Q=v*(p2-p1)/1000\n", + "print(\"Q in KJ=\"),round(Q,2)\n", + "print(\"final enthalpy of dry steam at 15 bar,h2=hg_15bar\")\n", + "print(\"h2=2792.2 KJ/kg from steam table\")\n", + "h2=2792.2;\n", + "print(\"let initial dryness fraction be x1,initial enthalpy,\")\n", + "print(\"h1=hf_10bar+x1*hfg_10bar.........eq1\")\n", + "print(\"here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\")\n", + "hf_10bar=762.83;\n", + "hfg_10bar=2015.3;\n", + "print(\"also heat balance yields,\")\n", + "print(\"h1+Q=h2\")\n", + "print(\"so h1=h2-Q in KJ/kg\")\n", + "h1=h2-Q\n", + "x1=(h1-hf_10bar)/hfg_10bar\n", + "print(\"so by eq 1=>x1=\"),round(x1,2)\n", + "print(\"heat added(Q)in KJ=\"),round(Q,2)\n", + "print(\"and initial quality(x1)\"),round(x1,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.19;pg no: 186" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.19, Page:186 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\n", + "from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\n", + "specific volume of wet steam in cylinder,v1 in m^3/kg= 0.75\n", + "dryness fraction of initial steam(x1)= 0.6\n", + "initial enthalpy of wet steam,h1 in KJ/kg= 1801.83\n", + "at 400 degree celcius specific volume of steam,v2 in m^3/kg= 1.55\n", + "for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\n", + "actual pressure can be obtained by interpolation\n", + "p2=0.20 MPa(approx.)\n", + "saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\n", + "finally the degree of superheat(T_sup)in K\n", + "T_sup=T-t\n", + "final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\n", + "heat added during process(deltaQ)in KJ\n", + "deltaQ=m*(h2-h1)\n", + "internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\n", + "here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\n", + "internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\n", + "u2=2966.7 KJ/kg\n", + "change in internal energy(deltaU)in KJ\n", + "deltaU= 3807.41\n", + "form first law of thermodynamics,work done(deltaW)in KJ\n", + "deltaW=deltaQ-deltaU 616.88\n", + "so heat transfer(deltaQ)in KJ 4424.3\n", + "and work transfer(deltaW)in KJ 616.88\n", + "NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\n", + "and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\n" + ] + } + ], + "source": [ + "#cal of heat and work transfer \n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.19, Page:186 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\")\n", + "m=3;#mass of wet steam in kg\n", + "p=1.4;#pressure of wet steam in bar\n", + "V1=2.25;#initial volume in m^3\n", + "V2=4.65;#final volume in m^3\n", + "T=400;#temperature of steam in degreee celcius\n", + "print(\"from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\")\n", + "vg=1.2455;\n", + "hf=457.99;\n", + "hfg=2232.3;\n", + "v1=V1/m\n", + "print(\"specific volume of wet steam in cylinder,v1 in m^3/kg=\"),round(v1,2)\n", + "x1=v1/vg\n", + "print(\"dryness fraction of initial steam(x1)=\"),round(x1,2)\n", + "x1=0.602;#approx.\n", + "h1=hf+x1*hfg\n", + "print(\"initial enthalpy of wet steam,h1 in KJ/kg=\"),round(h1,2)\n", + "v2=V2/m\n", + "print(\"at 400 degree celcius specific volume of steam,v2 in m^3/kg=\"),round(v2,2)\n", + "print(\"for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\")\n", + "print(\"actual pressure can be obtained by interpolation\")\n", + "p2=.1+((0.20-0.10)/(1.5493-3.103))*(1.55-3.103)\n", + "print(\"p2=0.20 MPa(approx.)\")\n", + "p2=0.20;\n", + "print(\"saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\")\n", + "t=120.23;\n", + "print(\"finally the degree of superheat(T_sup)in K\")\n", + "print(\"T_sup=T-t\")\n", + "T_sup=T-t\n", + "print(\"final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\")\n", + "h2=3276.6;\n", + "print(\"heat added during process(deltaQ)in KJ\")\n", + "print(\"deltaQ=m*(h2-h1)\")\n", + "deltaQ=m*(h2-h1)\n", + "print(\"internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\")\n", + "print(\"here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\")\n", + "uf=457.84;\n", + "ufg=2059.34;\n", + "u1=uf+x1*ufg\n", + "print(\"internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\")\n", + "print(\"u2=2966.7 KJ/kg\")\n", + "u2=2966.7;\n", + "print(\"change in internal energy(deltaU)in KJ\")\n", + "deltaU=m*(u2-u1)\n", + "print(\"deltaU=\"),round(deltaU,2)\n", + "print(\"form first law of thermodynamics,work done(deltaW)in KJ\")\n", + "deltaW=deltaQ-deltaU\n", + "print(\"deltaW=deltaQ-deltaU\"),round(deltaW,2)\n", + "print(\"so heat transfer(deltaQ)in KJ\"),round(deltaQ,2)\n", + "print(\"and work transfer(deltaW)in KJ\"),round(deltaW,2)\n", + "print(\"NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\")\n", + "print(\"and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.20;pg no: 187" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.20, Page:187 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\n", + "here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\n", + "at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\n", + "finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\n", + "h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\n", + "h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\n", + "so final temperature(T2)in K\n", + "T2= 495.43\n", + "entropy for final state(s2)in KJ/kg K\n", + "s2= 8.82\n", + "here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\n", + "so change in entropy(deltaS)in KJ/kg K\n", + "deltaS= 1.06\n", + "final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\n", + "here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\n", + "percentage of vessel volume initially occupied by steam(V)= 9.99\n" + ] + } + ], + "source": [ + "#cal of percentage of vessel volume initially occupied by steam\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.20, Page:187 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\")\n", + "print(\"here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\")\n", + "print(\"at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\")\n", + "h1_10bar_500oc=3478.5;\n", + "s1_10bar_500oc=7.7622;\n", + "v1_10bar_500oc=0.3541;\n", + "print(\"finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\")\n", + "h2=h1_10bar_500oc;\n", + "print(\"h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\")\n", + "h_1bar_400oc=3278.2;\n", + "h_1bar_500oc=3488.1;\n", + "print(\"h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\")\n", + "print(\"so final temperature(T2)in K\")\n", + "T2=400+((h2-h_1bar_400oc)*(500-400)/(h_1bar_500oc-h_1bar_400oc))\n", + "print(\"T2=\"),round(T2,2)\n", + "print(\"entropy for final state(s2)in KJ/kg K\")\n", + "s_1bar_400oc=8.5435;\n", + "s_1bar_500oc=8.8342;\n", + "s2=s_1bar_400oc+((s_1bar_500oc-s_1bar_400oc)*(495.43-400)/(500-400))\n", + "print(\"s2=\"),round(s2,2)\n", + "print(\"here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\")\n", + "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", + "deltaS=s2-s1_10bar_500oc\n", + "print(\"deltaS=\"),round(deltaS,2)\n", + "print(\"final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\")\n", + "print(\"here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\")\n", + "v_1bar_500oc=3.565;\n", + "v_1bar_400oc=3.103;\n", + "v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400))\n", + "V=v1_10bar_500oc*100/v2\n", + "print(\"percentage of vessel volume initially occupied by steam(V)=\"),round(V,2)\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter6_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter6_2.ipynb new file mode 100755 index 00000000..92ef2871 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter6_2.ipynb @@ -0,0 +1,1390 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6:Thermo dynamic Properties of pure substance" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.1;pg no: 174" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.1, Page:174 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\n", + "NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.1, Page:174 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\")\n", + "print(\"NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.2;pg no: 175" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.2, Page:175 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\n", + "during throttling,h1=h2\n", + "at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\n", + "thus h2=2682.5 KJ/kg\n", + "at state 1,before throttling\n", + "hf_10Mpa=1407.56 KJ/kg\n", + "hfg_10Mpa=1317.1 KJ/kg\n", + "h1=hf_10Mpa+x1*hfg_10Mpa\n", + "dryness fraction(x1)may be given as\n", + "x1= 0.97\n" + ] + } + ], + "source": [ + "#cal of dryness fraction\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.2, Page:175 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\")\n", + "print(\"during throttling,h1=h2\")\n", + "print(\"at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\")\n", + "print(\"thus h2=2682.5 KJ/kg\")\n", + "h2=2682.5;\n", + "print(\"at state 1,before throttling\")\n", + "print(\"hf_10Mpa=1407.56 KJ/kg\")\n", + "hf_10Mpa=1407.56;\n", + "print(\"hfg_10Mpa=1317.1 KJ/kg\")\n", + "hfg_10Mpa=1317.1;\n", + "print(\"h1=hf_10Mpa+x1*hfg_10Mpa\")\n", + "h1=h2;#during throttling\n", + "print(\"dryness fraction(x1)may be given as\")\n", + "x1=(h1-hf_10Mpa)/hfg_10Mpa\n", + "print(\"x1=\"),round(x1,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.3;pg no: 176" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.3, Page:176 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\n", + "internal energy(u)=in KJ/kg 2644.0\n" + ] + } + ], + "source": [ + "#cal of internal energy\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.3, Page:176 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\")\n", + "h=2848;#enthalpy in KJ/kg\n", + "p=12*1000;#pressure in Kpa\n", + "v=0.017;#specific volume in m^3/kg\n", + "u=h-p*v\n", + "print(\"internal energy(u)=in KJ/kg\"),round(u,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.4;pg no: 176" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.4, Page:176 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\n", + "steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\n", + "entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\n", + "S= 6.65\n", + "entropy of 5 kg of steam(S)in KJ/K\n", + "S=m*S 33.23\n" + ] + } + ], + "source": [ + "#cal of entropy of 5 kg of steam\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "import math\n", + "print\"Example 6.4, Page:176 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\")\n", + "m=5;#mass of steam in kg\n", + "p=2;#pressure of steam in Mpa\n", + "T_superheat=(300+273.15);#temperature of superheat steam in K\n", + "Cp_water=4.18;#specific heat of water at constant pressure in KJ/kg K\n", + "Cp_superheat=2.1;#specific heat of superheat steam at constant pressure in KJ/kg K\n", + "print(\"steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\")\n", + "T_sat=(212.42+273.15);#saturation temperature at 2 Mpa in K\n", + "hfg_2Mpa=1890.7;\n", + "print(\"entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\")\n", + "S=Cp_water*math.log(T_sat/273.15)+(hfg_2Mpa/T_sat)+(Cp_superheat*math.log(T_superheat/T_sat))\n", + "print(\"S=\"),round(S,2)\n", + "print(\"entropy of 5 kg of steam(S)in KJ/K\")\n", + "S=m*S\n", + "print(\"S=m*S\"),round(S,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.5;pg no: 176" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.5, Page:176 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\n", + "boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\n", + "at further depth of 50 cm the pressure(p)in Kpa\n", + "p= 138.37\n", + "boiling point at this depth=Tsat_138.365\n", + "from steam table this temperature=108.866=108.87 degree celcius\n", + "so boiling point = 108.87 degree celcius\n" + ] + } + ], + "source": [ + "#cal of boiling point\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.5, Page:176 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\")\n", + "rho=1000;#density of water in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "h=0.50;#depth from above mentioned level in m\n", + "print(\"boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\")\n", + "p_boil=143.27;#pressure at which pond water boils in Kpa\n", + "print(\"at further depth of 50 cm the pressure(p)in Kpa\")\n", + "p=p_boil-((rho*g*h)*10**-3)\n", + "print(\"p=\"),round(p,2)\n", + "print(\"boiling point at this depth=Tsat_138.365\")\n", + "print(\"from steam table this temperature=108.866=108.87 degree celcius\")\n", + "print(\"so boiling point = 108.87 degree celcius\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.6;pg no: 177" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.6, Page:177 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\n", + "in a rigid vessel it can be treated as constant volume process.\n", + "so v1=v2\n", + "since final state is given to be critical state,then specific volume at critical point,\n", + "v2=0.003155 m^3/kg\n", + "at 100 degree celcius saturation temperature,from steam table\n", + "vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\n", + "and vfg_100=in m^3/kg= 1.67\n", + "thus for initial quality being x1\n", + "v1=vf_100+x1*vfg_100\n", + "so x1= 0.001\n", + "mass of water initially=total mass*(1-x1)\n", + "total mass of fluid/water(m) in kg= 158.48\n", + "volume of water(v) in m^3= 0.1655\n" + ] + } + ], + "source": [ + "#cal of mass and volume of water\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.6, Page:177 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\")\n", + "V=0.5;#capacity of rigid vessel in m^3\n", + "print(\"in a rigid vessel it can be treated as constant volume process.\")\n", + "print(\"so v1=v2\")\n", + "print(\"since final state is given to be critical state,then specific volume at critical point,\")\n", + "print(\"v2=0.003155 m^3/kg\")\n", + "v2=0.003155;#specific volume at critical point in m^3/kg\n", + "print(\"at 100 degree celcius saturation temperature,from steam table\")\n", + "print(\"vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\")\n", + "vf_100=0.001044;\n", + "vg_100=1.6729;\n", + "vfg_100=vg_100-vf_100\n", + "print(\"and vfg_100=in m^3/kg=\"),round(vfg_100,2)\n", + "print(\"thus for initial quality being x1\")\n", + "v1=v2;#rigid vessel\n", + "x1=(v1-vf_100)/vfg_100\n", + "print(\"v1=vf_100+x1*vfg_100\")\n", + "print(\"so x1=\"),round(x1,3)\n", + "print(\"mass of water initially=total mass*(1-x1)\")\n", + "m=V/v2\n", + "print(\"total mass of fluid/water(m) in kg=\"),round(m,2)\n", + "v=m*vf_100\n", + "print(\"volume of water(v) in m^3=\"),round(v,4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.7;pg no: 177" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.7, Page:177 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\n", + "on mollier diadram(h-s diagram)the slope of isobaric line may be given as\n", + "(dh/ds)_p=cons =slope of isobar\n", + "from 1st and 2nd law combined;\n", + "T*ds=dh-v*dp\n", + "(dh/ds)_p=cons = T\n", + "here temperature,T=773.15 K\n", + "here slope=(dh/ds))p=cons = 773.15\n" + ] + } + ], + "source": [ + "#cal of slope\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.7, Page:177 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\")\n", + "print(\"on mollier diadram(h-s diagram)the slope of isobaric line may be given as\")\n", + "print(\"(dh/ds)_p=cons =slope of isobar\")\n", + "print(\"from 1st and 2nd law combined;\")\n", + "print(\"T*ds=dh-v*dp\")\n", + "print(\"(dh/ds)_p=cons = T\")\n", + "print(\"here temperature,T=773.15 K\")\n", + "print(\"here slope=(dh/ds))p=cons = 773.15\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.8;pg no: 178" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.8, Page:178 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\n", + "at 0.15Mpa,from steam table;\n", + "hf=467.11 KJ/kg,hg=2693.6 KJ/kg\n", + "and hfg in KJ/kg= 2226.49\n", + "vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\n", + "and vfg in m^3/kg= 1.16\n", + "sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\n", + "and sfg=in KJ/kg K= 5.79\n", + "enthalpy at x=.10(h)in KJ/kg\n", + "h= 689.76\n", + "specific volume,(v)in m^3/kg\n", + "v= 0.12\n", + "entropy (s)in KJ/kg K\n", + "s= 2.01\n" + ] + } + ], + "source": [ + "#cal of entropy\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.8, Page:178 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\")\n", + "x=.10;#quality is 10%\n", + "print(\"at 0.15Mpa,from steam table;\")\n", + "print(\"hf=467.11 KJ/kg,hg=2693.6 KJ/kg\")\n", + "hf=467.11;\n", + "hg=2693.6;\n", + "hfg=hg-hf\n", + "print(\"and hfg in KJ/kg=\"),round(hfg,2)\n", + "print(\"vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\")\n", + "vf=0.001053;\n", + "vg=1.1593;\n", + "vfg=vg-vf\n", + "print(\"and vfg in m^3/kg=\"),round(vfg,2)\n", + "print(\"sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\")\n", + "sf=1.4336;\n", + "sg=7.2233;\n", + "sfg=sg-sf\n", + "print(\"and sfg=in KJ/kg K=\"),round(sfg,2)\n", + "print(\"enthalpy at x=.10(h)in KJ/kg\")\n", + "h=hf+x*hfg\n", + "print(\"h=\"),round(h,2)\n", + "print(\"specific volume,(v)in m^3/kg\")\n", + "v=vf+x*vfg\n", + "print(\"v=\"),round(v,2)\n", + "print(\"entropy (s)in KJ/kg K\")\n", + "s=sf+x*sfg\n", + "print(\"s=\"),round(s,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.9;pg no: 178" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.9, Page:178 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\n", + "work done during constant pressure process(W)=p1*(V2-V1)in KJ\n", + "now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\n", + "so v1 in m^3/kg=\n", + "now mass of steam(m) in kg= 0.32\n", + "specific volume at final state(v2)in m^3/kg\n", + "v2= 0.62\n", + "corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\n", + "v2>vg_1Mpa\n", + "hence state lies in superheated region,from the steam table by interpolation we get temperature as;\n", + "state lies between temperature of 1000 degree celcius and 1100 degree celcius\n", + "so exact temperature at final state(T)in K= 1077.61\n", + "thus internal energy at final state,1 Mpa,1077.61 degree celcius;\n", + "u2=4209.6 KJ/kg\n", + "internal energy at initial state(u1)in KJ/kg\n", + "u1= 2219.28\n", + "from first law of thermodynamics,Q-W=deltaU\n", + "so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ= 788.83\n" + ] + } + ], + "source": [ + "#cal of heat added\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.9, Page:178 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\")\n", + "p1=1*1000;#initial pressure of steam in Kpa\n", + "V1=0.05;#initial volume of steam in m^3\n", + "x1=.8;#dryness fraction is 80%\n", + "V2=0.2;#final volume of steam in m^3\n", + "p2=p1;#constant pressure process\n", + "print(\"work done during constant pressure process(W)=p1*(V2-V1)in KJ\")\n", + "W=p1*(V2-V1)\n", + "print(\"now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\")\n", + "vf=0.001127;\n", + "vg=0.19444;\n", + "uf=761.68;\n", + "ufg=1822;\n", + "v1=vf+x1*vg\n", + "print(\"so v1 in m^3/kg=\")\n", + "m=V1/v1\n", + "print(\"now mass of steam(m) in kg=\"),round(m,2)\n", + "m=0.32097;#take m=0.32097 approx.\n", + "print(\"specific volume at final state(v2)in m^3/kg\")\n", + "v2=V2/m\n", + "print(\"v2=\"),round(v2,2)\n", + "print(\"corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\")\n", + "print(\"v2>vg_1Mpa\")\n", + "print(\"hence state lies in superheated region,from the steam table by interpolation we get temperature as;\")\n", + "print(\"state lies between temperature of 1000 degree celcius and 1100 degree celcius\")\n", + "T=1000+((100*(.62311-.5871))/(.6335-.5871))\n", + "print(\"so exact temperature at final state(T)in K=\"),round(T,2)\n", + "print(\"thus internal energy at final state,1 Mpa,1077.61 degree celcius;\")\n", + "print(\"u2=4209.6 KJ/kg\")\n", + "u2=4209.6;\n", + "print(\"internal energy at initial state(u1)in KJ/kg\")\n", + "u1=uf+x1*ufg\n", + "print(\"u1=\"),round(u1,2)\n", + "print(\"from first law of thermodynamics,Q-W=deltaU\")\n", + "Q=m*(u2-u1)+W\n", + "print(\"so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ=\"),round(Q,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.10;pg no: 179" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.10, Page:179 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\n", + "here steam is kept in rigid vessel,therefore its specific volume shall remain constant\n", + "it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\n", + "from superheated steam table;v1=0.2404 m^3/kg\n", + "at begining of condensation specific volume = 0.2404 m^3/kg\n", + "v2=0.2404 m^3/kg\n", + "this v2 shall be specific volume corresponding to saturated vapour state for condensation.\n", + "thus v2=vg=0.2404 m^3/kg\n", + "looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\n", + "by interpolation,temperature at begining of condensation(T2)in K\n", + "similarily,pressure(p2)in Kpa= 800.96\n" + ] + } + ], + "source": [ + "#cal of pressure\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.10, Page:179 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\")\n", + "p1=800;#initial pressure of steam in Kpa\n", + "T1=200;#initial temperature of steam in degree celcius\n", + "print(\"here steam is kept in rigid vessel,therefore its specific volume shall remain constant\")\n", + "print(\"it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\")\n", + "print(\"from superheated steam table;v1=0.2404 m^3/kg\")\n", + "print(\"at begining of condensation specific volume = 0.2404 m^3/kg\")\n", + "print(\"v2=0.2404 m^3/kg\")\n", + "v2=0.2404;\n", + "print(\"this v2 shall be specific volume corresponding to saturated vapour state for condensation.\")\n", + "print(\"thus v2=vg=0.2404 m^3/kg\")\n", + "vg=v2;\n", + "print(\"looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\")\n", + "print(\"by interpolation,temperature at begining of condensation(T2)in K\")\n", + "T2=175-((175-170)*(0.2404-0.2167))/(0.2428-.2168)\n", + "p=892-(((892-791.7)*(0.2404-0.2168))/(0.2428-0.2168))\n", + "print(\"similarily,pressure(p2)in Kpa=\"),round(p,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.11;pg no: 180" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.11, Page:180 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\n", + "from 1st and 2nd law;\n", + "T*ds=dh-v*dp\n", + "for isentropic process,ds=0\n", + "hence dh=v*dp\n", + "i.e (h2-h1)=v1*(p2-p1)\n", + "corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\n", + "p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\n", + "therefore enthalpy change(deltah)=(h2-h1) in KJ/kg= 0.2\n" + ] + } + ], + "source": [ + "#cal of enthalpy change\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.11, Page:180 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\")\n", + "p2=200;#feed water pump pressure in Kpa\n", + "print(\"from 1st and 2nd law;\")\n", + "print(\"T*ds=dh-v*dp\")\n", + "print(\"for isentropic process,ds=0\")\n", + "print(\"hence dh=v*dp\")\n", + "print(\"i.e (h2-h1)=v1*(p2-p1)\")\n", + "print(\"corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\")\n", + "print(\"p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\")\n", + "p1=4.25;\n", + "v1=0.001004;\n", + "deltah=v1*(p2-p1)\n", + "print(\"therefore enthalpy change(deltah)=(h2-h1) in KJ/kg=\"),round(deltah,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.12;pg no: 180" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.12, Page:180 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\n", + "from steam table at 150 degree celcius\n", + "vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\n", + "so volume occupied by water(Vw)=3*V/(3+2) in m^3 1.2\n", + "and volume of steam(Vs) in m^3= 0.8\n", + "mass of water(mf)=Vw/Vf in kg 1099.91\n", + "mass of steam(mg)=Vs/Vg in kg 2.04\n", + "total mass in tank(m) in kg= 1101.95\n", + "quality or dryness fraction(x)\n", + "x= 0.002\n", + "NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\n" + ] + } + ], + "source": [ + "#cal of quality or dryness fraction\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.12, Page:180 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\")\n", + "V=2.;#volume of vessel in m^3\n", + "print(\"from steam table at 150 degree celcius\")\n", + "print(\"vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\")\n", + "Vf=0.001091;\n", + "Vg=0.3928;\n", + "Vw=3*V/(3+2)\n", + "print(\"so volume occupied by water(Vw)=3*V/(3+2) in m^3\"),round(Vw,2)\n", + "Vs=2*V/(3+2)\n", + "print(\"and volume of steam(Vs) in m^3=\"),round(Vs,2)\n", + "mf=Vw/Vf\n", + "print(\"mass of water(mf)=Vw/Vf in kg\"),round(mf,2)\n", + "mg=Vs/Vg\n", + "print(\"mass of steam(mg)=Vs/Vg in kg\"),round(mg,2)\n", + "m=mf+mg\n", + "print(\"total mass in tank(m) in kg=\"),round(m,2)\n", + "print(\"quality or dryness fraction(x)\")\n", + "x=mg/m\n", + "print(\"x=\"),round(x,3)\n", + "print(\"NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.13;pg no: 181" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.13, Page:181 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\n", + "fron S.F.S.E on steam turbine;\n", + "W=h1-h2\n", + "initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\n", + "h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\n", + "reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\n", + "else from steam tables at 50 degree celcius saturation temperature;\n", + "hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\n", + "hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\n", + "here s1=s2,let dryness fraction at 2 be x2\n", + "x2= 0.75\n", + "hence enthalpy at state 2\n", + "h2 in KJ/kg= 1994.84\n", + "steam turbine work(W)in KJ/kg\n", + "W=h1-h2\n", + "so turbine output=W 891.36\n" + ] + } + ], + "source": [ + "#cal of turbine output\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.13, Page:181 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\")\n", + "print(\"fron S.F.S.E on steam turbine;\")\n", + "print(\"W=h1-h2\")\n", + "print(\"initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\")\n", + "print(\"h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\")\n", + "h1=2886.2;\n", + "s1=6.2285;\n", + "print(\"reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\")\n", + "print(\"else from steam tables at 50 degree celcius saturation temperature;\")\n", + "print(\"hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\")\n", + "hf=209.33;\n", + "sf=0.7038;\n", + "print(\"hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\")\n", + "hfg=2382.7;\n", + "sfg=7.3725;\n", + "print(\"here s1=s2,let dryness fraction at 2 be x2\")\n", + "x2=(s1-sf)/sfg\n", + "print(\"x2=\"),round(x2,2)\n", + "print(\"hence enthalpy at state 2\")\n", + "h2=hf+x2*hfg\n", + "print(\"h2 in KJ/kg=\"),round(h2,2)\n", + "print(\"steam turbine work(W)in KJ/kg\")\n", + "W=h1-h2\n", + "print(\"W=h1-h2\")\n", + "print(\"so turbine output=W\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.14;pg no: 181" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.14, Page:181 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\n", + "it is constant volume process\n", + "volume of vessel(V)=mass of vapour * specific volume of vapour\n", + "initial specific volume,v1\n", + "v1=vf_100Kpa+x1*vfg_100 in m^3/kg\n", + "at 100 Kpa from steam table;\n", + "hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\n", + " here vfg_100Kpa= in m^3/kg= 1.69\n", + "so v1= in m^3/kg= 0.85\n", + "and volume of vessel(V) in m^3= 42.38\n", + "enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg 1546.46\n", + "internal energy in the beginning=U1=m1*u1 in KJ 146171.0\n", + "let the mass of dry steam added be m,final specific volume inside vessel,v2\n", + "v2=vf_1000Kpa+x2*vfg_1000Kpa\n", + "at 2000 Kpa,from steam table,\n", + "vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\n", + "total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\n", + "V/v2=V/vg_2000Kpa+V/v1\n", + "so v2 in m^3/kg= 0.09\n", + "here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\n", + "at 1000 Kpa from steam table,\n", + "hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\n", + "here vfg_1000Kpa= in m^3/kg= 0.19\n", + "so x2= 0.46\n", + "for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\n", + "so mass of dry steam at 2000 Kpa to be added(m)in kg\n", + "m=(100*(h1-h2))/(h2-hg_2000Kpa)= 11.97\n", + "quality of final mixture x2= 0.46\n" + ] + } + ], + "source": [ + "#cal of quality of final mixture\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.14, Page:181 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\")\n", + "x1=0.5;#dryness fraction \n", + "m1=100;#mass of steam in kg\n", + "v1=0.8475;#\n", + "print(\"it is constant volume process\")\n", + "print(\"volume of vessel(V)=mass of vapour * specific volume of vapour\")\n", + "print(\"initial specific volume,v1\")\n", + "print(\"v1=vf_100Kpa+x1*vfg_100 in m^3/kg\")\n", + "print(\"at 100 Kpa from steam table;\")\n", + "print(\"hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\")\n", + "hf_100Kpa=417.46;\n", + "uf_100Kpa=417.36;\n", + "vf_100Kpa=0.001043;\n", + "hfg_100Kpa=2258;\n", + "ufg_100Kpa=2088.7;\n", + "vg_100Kpa=1.6940;\n", + "vfg_100Kpa=vg_100Kpa-vf_100Kpa\n", + "print(\" here vfg_100Kpa= in m^3/kg=\"),round(vfg_100Kpa,2)\n", + "v1=vf_100Kpa+x1*vfg_100Kpa\n", + "print(\"so v1= in m^3/kg=\"),round(v1,2)\n", + "V=m1*x1*v1\n", + "print(\"and volume of vessel(V) in m^3=\"),round(V,2)\n", + "h1=hf_100Kpa+x1*hfg_100Kpa\n", + "print(\"enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg\"),round(h1,2)\n", + "U1=m1*(uf_100Kpa+x1*ufg_100Kpa)\n", + "print(\"internal energy in the beginning=U1=m1*u1 in KJ\"),round(U1,2)\n", + "print(\"let the mass of dry steam added be m,final specific volume inside vessel,v2\")\n", + "print(\"v2=vf_1000Kpa+x2*vfg_1000Kpa\")\n", + "print(\"at 2000 Kpa,from steam table,\")\n", + "print(\"vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\")\n", + "vg_2000Kpa=0.09963;\n", + "ug_2000Kpa=2600.3;\n", + "hg_2000Kpa=2799.5;\n", + "print(\"total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\")\n", + "print(\"V/v2=V/vg_2000Kpa+V/v1\")\n", + "v2=1/((1/vg_2000Kpa)+(1/v1))\n", + "print(\"so v2 in m^3/kg=\"),round(v2,2)\n", + "print(\"here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\")\n", + "print(\"at 1000 Kpa from steam table,\")\n", + "print(\"hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\")\n", + "hf_1000Kpa=762.81;\n", + "hfg_1000Kpa=2015.3;\n", + "vf_1000Kpa=0.001127;\n", + "vg_1000Kpa=0.19444;\n", + "vfg_1000Kpa=vg_1000Kpa-vf_1000Kpa\n", + "print(\"here vfg_1000Kpa= in m^3/kg=\"),round(vfg_1000Kpa,2)\n", + "x2=(v2-vf_1000Kpa)/vfg_1000Kpa\n", + "print(\"so x2=\"),round(x2,2)\n", + "print(\"for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\")\n", + "print(\"so mass of dry steam at 2000 Kpa to be added(m)in kg\")\n", + "m=(100*(h1-(hf_1000Kpa+x2*hfg_1000Kpa)))/((hf_1000Kpa+x2*hfg_1000Kpa)-hg_2000Kpa)\n", + "print(\"m=(100*(h1-h2))/(h2-hg_2000Kpa)=\"),round(m,2)\n", + "print(\"quality of final mixture x2=\"),round(x2,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.15;pg no: 183" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.15, Page:183 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\n", + "from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\n", + "condenser pressure(p_condenser) in Kpa= 7.3\n", + "partial pressure of steam corresponding to35 degree celcius from steam table;\n", + "p_steam=5.628 Kpa\n", + "enthalpy corresponding to 35 degree celcius from steam table,\n", + "hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\n", + "let quality of steam entering be x\n", + "from energy balance;\n", + "mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\n", + "so dryness fraction of steam entering(x)is given as\n", + "x= 0.97\n" + ] + } + ], + "source": [ + "#cal of dryness fraction of steam entering\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.15, Page:183 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\")\n", + "p_vaccum=71.5;#recorded condenser vaccum in cm of mercury\n", + "p_barometer=76.8;#barometer reading in cm of mercury\n", + "T_cond=35;#temperature of condensation in degree celcius\n", + "T_hotwell=27.6;#temperature of hot well in degree celcius\n", + "m_cond=1930;#mass of condensate per hour\n", + "m_w=62000;#mass of cooling water per hour\n", + "Ti=8.51;#initial temperature in degree celcius\n", + "To=26.24;#outlet temperature in degree celcius\n", + "print(\"from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\")\n", + "p_condenser=(p_barometer-p_vaccum)*101.325/73.55\n", + "print(\"condenser pressure(p_condenser) in Kpa=\"),round(p_condenser,2)\n", + "print(\"partial pressure of steam corresponding to35 degree celcius from steam table;\")\n", + "print(\"p_steam=5.628 Kpa\")\n", + "p_steam=5.628;#partial pressure of steam\n", + "print(\"enthalpy corresponding to 35 degree celcius from steam table,\")\n", + "print(\"hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\")\n", + "hf=146.68;\n", + "hfg=2418.6;\n", + "print(\"let quality of steam entering be x\")\n", + "print(\"from energy balance;\")\n", + "print(\"mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\")\n", + "print(\"so dryness fraction of steam entering(x)is given as\")\n", + "x=(((m_w*(To-Ti)*4.18)/m_cond)-hf+4.18*T_hotwell)/hfg\n", + "print(\"x=\"),round(x,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.16;pg no: 184" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.16, Page:184 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\n", + "heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\n", + "area(A) in m^2= 0.03\n", + "so p1=in Kpa= 419.61\n", + "now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\n", + "volume of water contained(V1) in m^3= 0.001\n", + "mass of water(m) in kg= 0.63\n", + "heat supplied shall cause sensible heating and latent heating\n", + "hence,enthalpy change=heat supplied\n", + "Q=((hf+x*hfg)-(4.18*T)*m)\n", + "so dryness fraction of steam produced(x)can be calculated as\n", + "so x= 0.46\n", + "internal energy of water(U1)in KJ,initially\n", + "U1= 393.69\n", + "finally,internal energy of wet steam(U2)in KJ\n", + "U2=m*h2-p2*V2\n", + "here V2 in m^3= 0.13\n", + "hence U2= 940.68\n", + "hence change in internal energy(U) in KJ= 547.21\n", + "work done(W) in KJ= 53.01\n" + ] + } + ], + "source": [ + "#cal of change in internal energy and work done\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "import math\n", + "print\"Example 6.16, Page:184 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\")\n", + "F=10;#force applied externally upon piston in KN\n", + "d=.2;#diameter in m\n", + "h=0.02;#depth to which water filled in m \n", + "P_atm=101.3;#atmospheric pressure in Kpa\n", + "rho=1000;#density of water in kg/m^3\n", + "Q=600;#heat supplied to water in KJ\n", + "T=150;#temperature of water in degree celcius\n", + "print(\"heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\")\n", + "A=math.pi*d**2/4\n", + "print(\"area(A) in m^2=\"),round(A,2)\n", + "p1=F/A+P_atm\n", + "print(\"so p1=in Kpa=\"),round(p1,2)\n", + "print(\"now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\")\n", + "hf=612.1;\n", + "hfg=2128.7;\n", + "vg=0.4435;\n", + "V1=math.pi*d**2*h/4\n", + "print(\"volume of water contained(V1) in m^3=\"),round(V1,3)\n", + "m=V1*rho\n", + "print(\"mass of water(m) in kg=\"),round(m,2)\n", + "print(\"heat supplied shall cause sensible heating and latent heating\")\n", + "print(\"hence,enthalpy change=heat supplied\")\n", + "print(\"Q=((hf+x*hfg)-(4.18*T)*m)\")\n", + "print(\"so dryness fraction of steam produced(x)can be calculated as\")\n", + "x=((Q/m)+4.18*T-hf)/hfg\n", + "print(\"so x=\"),round(x,2)\n", + "print(\"internal energy of water(U1)in KJ,initially\")\n", + "h1=4.18*T;#enthalpy of water in KJ/kg\n", + "U1=m*h1-p1*V1\n", + "print(\"U1=\"),round(U1,2)\n", + "U1=393.5;#approx.\n", + "print(\"finally,internal energy of wet steam(U2)in KJ\")\n", + "print(\"U2=m*h2-p2*V2\")\n", + "V2=m*x*vg\n", + "print(\"here V2 in m^3=\"),round(V2,2)\n", + "p2=p1;#constant pressure process\n", + "U2=(m*(hf+x*hfg))-p2*V2\n", + "print(\"hence U2=\"),round(U2,2)\n", + "U2=940.71;#approx.\n", + "U=U2-U1\n", + "print(\"hence change in internal energy(U) in KJ=\"),round(U,2)\n", + "p=p1;\n", + "W=p*(V2-V1)\n", + "print(\"work done(W) in KJ=\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.17;pg no: 185" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.17, Page:185 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\n", + "consider throttling calorimeter alone,\n", + "degree of superheat(T_sup)in degree celcius\n", + "T_sup= 18.2\n", + "enthalpy of superheated steam(h_sup)in KJ/kg\n", + "h_sup= 2711.99\n", + "at 120 degree celcius,h=2673.95 KJ/kg from steam table\n", + "now enthalpy before throttling = enthalpy after throttling\n", + "hf+x2*hfg=h_sup\n", + "here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\n", + "so x2= 0.96\n", + "for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\n", + "overall dryness fraction(x)= 0.91\n" + ] + } + ], + "source": [ + "#cal of overall dryness fraction\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.17, Page:185 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\")\n", + "ms=40;#mass of steam in kg\n", + "mw=2.2;#mass of water in kg\n", + "p1=1.47;#pressure before throttling in Mpa\n", + "T2=120;#temperature after throttling in degree celcius\n", + "p2=107.88;#pressure after throttling in Kpa\n", + "Cp_sup=2.09;#specific heat of superheated steam in KJ/kg K\n", + "print(\"consider throttling calorimeter alone,\")\n", + "print(\"degree of superheat(T_sup)in degree celcius\")\n", + "T_sup=T2-101.8\n", + "print(\"T_sup=\"),round(T_sup,2)\n", + "print(\"enthalpy of superheated steam(h_sup)in KJ/kg\")\n", + "h=2673.95;\n", + "h_sup=h+T_sup*Cp_sup\n", + "print(\"h_sup=\"),round(h_sup,2)\n", + "print(\"at 120 degree celcius,h=2673.95 KJ/kg from steam table\")\n", + "print(\"now enthalpy before throttling = enthalpy after throttling\")\n", + "print(\"hf+x2*hfg=h_sup\")\n", + "print(\"here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\")\n", + "hf=840.513;\n", + "hfg=1951.02;\n", + "x2=(h_sup-hf)/hfg\n", + "print(\"so x2=\"),round(x2,2)\n", + "print(\"for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\")\n", + "x1=(ms-mw)/ms\n", + "x=x1*x2\n", + "print(\"overall dryness fraction(x)=\"),round(x,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.18;pg no: 185" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.18, Page:185 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\n", + "here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\n", + "final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\n", + "Q in KJ= 200.0\n", + "final enthalpy of dry steam at 15 bar,h2=hg_15bar\n", + "h2=2792.2 KJ/kg from steam table\n", + "let initial dryness fraction be x1,initial enthalpy,\n", + "h1=hf_10bar+x1*hfg_10bar.........eq1\n", + "here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\n", + "also heat balance yields,\n", + "h1+Q=h2\n", + "so h1=h2-Q in KJ/kg\n", + "so by eq 1=>x1= 0.91\n", + "heat added(Q)in KJ= 200.0\n", + "and initial quality(x1) 0.91\n" + ] + } + ], + "source": [ + "#cal of heat added and initial quality\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.18, Page:185 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\")\n", + "v=0.4;#volume of air in part A and part B in m^3\n", + "p1=10*10**5;#initial pressure of steam in pa\n", + "p2=15*10**5;#final pressure of steam in pa\n", + "print(\"here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\")\n", + "print(\"final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\")\n", + "Q=v*(p2-p1)/1000\n", + "print(\"Q in KJ=\"),round(Q,2)\n", + "print(\"final enthalpy of dry steam at 15 bar,h2=hg_15bar\")\n", + "print(\"h2=2792.2 KJ/kg from steam table\")\n", + "h2=2792.2;\n", + "print(\"let initial dryness fraction be x1,initial enthalpy,\")\n", + "print(\"h1=hf_10bar+x1*hfg_10bar.........eq1\")\n", + "print(\"here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\")\n", + "hf_10bar=762.83;\n", + "hfg_10bar=2015.3;\n", + "print(\"also heat balance yields,\")\n", + "print(\"h1+Q=h2\")\n", + "print(\"so h1=h2-Q in KJ/kg\")\n", + "h1=h2-Q\n", + "x1=(h1-hf_10bar)/hfg_10bar\n", + "print(\"so by eq 1=>x1=\"),round(x1,2)\n", + "print(\"heat added(Q)in KJ=\"),round(Q,2)\n", + "print(\"and initial quality(x1)\"),round(x1,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.19;pg no: 186" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.19, Page:186 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\n", + "from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\n", + "specific volume of wet steam in cylinder,v1 in m^3/kg= 0.75\n", + "dryness fraction of initial steam(x1)= 0.6\n", + "initial enthalpy of wet steam,h1 in KJ/kg= 1801.83\n", + "at 400 degree celcius specific volume of steam,v2 in m^3/kg= 1.55\n", + "for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\n", + "actual pressure can be obtained by interpolation\n", + "p2=0.20 MPa(approx.)\n", + "saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\n", + "finally the degree of superheat(T_sup)in K\n", + "T_sup=T-t\n", + "final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\n", + "heat added during process(deltaQ)in KJ\n", + "deltaQ=m*(h2-h1)\n", + "internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\n", + "here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\n", + "internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\n", + "u2=2966.7 KJ/kg\n", + "change in internal energy(deltaU)in KJ\n", + "deltaU= 3807.41\n", + "form first law of thermodynamics,work done(deltaW)in KJ\n", + "deltaW=deltaQ-deltaU 616.88\n", + "so heat transfer(deltaQ)in KJ 4424.3\n", + "and work transfer(deltaW)in KJ 616.88\n", + "NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\n", + "and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\n" + ] + } + ], + "source": [ + "#cal of heat and work transfer \n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.19, Page:186 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\")\n", + "m=3;#mass of wet steam in kg\n", + "p=1.4;#pressure of wet steam in bar\n", + "V1=2.25;#initial volume in m^3\n", + "V2=4.65;#final volume in m^3\n", + "T=400;#temperature of steam in degreee celcius\n", + "print(\"from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\")\n", + "vg=1.2455;\n", + "hf=457.99;\n", + "hfg=2232.3;\n", + "v1=V1/m\n", + "print(\"specific volume of wet steam in cylinder,v1 in m^3/kg=\"),round(v1,2)\n", + "x1=v1/vg\n", + "print(\"dryness fraction of initial steam(x1)=\"),round(x1,2)\n", + "x1=0.602;#approx.\n", + "h1=hf+x1*hfg\n", + "print(\"initial enthalpy of wet steam,h1 in KJ/kg=\"),round(h1,2)\n", + "v2=V2/m\n", + "print(\"at 400 degree celcius specific volume of steam,v2 in m^3/kg=\"),round(v2,2)\n", + "print(\"for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\")\n", + "print(\"actual pressure can be obtained by interpolation\")\n", + "p2=.1+((0.20-0.10)/(1.5493-3.103))*(1.55-3.103)\n", + "print(\"p2=0.20 MPa(approx.)\")\n", + "p2=0.20;\n", + "print(\"saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\")\n", + "t=120.23;\n", + "print(\"finally the degree of superheat(T_sup)in K\")\n", + "print(\"T_sup=T-t\")\n", + "T_sup=T-t\n", + "print(\"final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\")\n", + "h2=3276.6;\n", + "print(\"heat added during process(deltaQ)in KJ\")\n", + "print(\"deltaQ=m*(h2-h1)\")\n", + "deltaQ=m*(h2-h1)\n", + "print(\"internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\")\n", + "print(\"here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\")\n", + "uf=457.84;\n", + "ufg=2059.34;\n", + "u1=uf+x1*ufg\n", + "print(\"internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\")\n", + "print(\"u2=2966.7 KJ/kg\")\n", + "u2=2966.7;\n", + "print(\"change in internal energy(deltaU)in KJ\")\n", + "deltaU=m*(u2-u1)\n", + "print(\"deltaU=\"),round(deltaU,2)\n", + "print(\"form first law of thermodynamics,work done(deltaW)in KJ\")\n", + "deltaW=deltaQ-deltaU\n", + "print(\"deltaW=deltaQ-deltaU\"),round(deltaW,2)\n", + "print(\"so heat transfer(deltaQ)in KJ\"),round(deltaQ,2)\n", + "print(\"and work transfer(deltaW)in KJ\"),round(deltaW,2)\n", + "print(\"NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\")\n", + "print(\"and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.20;pg no: 187" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.20, Page:187 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\n", + "here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\n", + "at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\n", + "finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\n", + "h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\n", + "h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\n", + "so final temperature(T2)in K\n", + "T2= 495.43\n", + "entropy for final state(s2)in KJ/kg K\n", + "s2= 8.82\n", + "here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\n", + "so change in entropy(deltaS)in KJ/kg K\n", + "deltaS= 1.06\n", + "final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\n", + "here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\n", + "percentage of vessel volume initially occupied by steam(V)= 9.99\n" + ] + } + ], + "source": [ + "#cal of percentage of vessel volume initially occupied by steam\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.20, Page:187 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\")\n", + "print(\"here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\")\n", + "print(\"at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\")\n", + "h1_10bar_500oc=3478.5;\n", + "s1_10bar_500oc=7.7622;\n", + "v1_10bar_500oc=0.3541;\n", + "print(\"finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\")\n", + "h2=h1_10bar_500oc;\n", + "print(\"h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\")\n", + "h_1bar_400oc=3278.2;\n", + "h_1bar_500oc=3488.1;\n", + "print(\"h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\")\n", + "print(\"so final temperature(T2)in K\")\n", + "T2=400+((h2-h_1bar_400oc)*(500-400)/(h_1bar_500oc-h_1bar_400oc))\n", + "print(\"T2=\"),round(T2,2)\n", + "print(\"entropy for final state(s2)in KJ/kg K\")\n", + "s_1bar_400oc=8.5435;\n", + "s_1bar_500oc=8.8342;\n", + "s2=s_1bar_400oc+((s_1bar_500oc-s_1bar_400oc)*(495.43-400)/(500-400))\n", + "print(\"s2=\"),round(s2,2)\n", + "print(\"here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\")\n", + "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", + "deltaS=s2-s1_10bar_500oc\n", + "print(\"deltaS=\"),round(deltaS,2)\n", + "print(\"final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\")\n", + "print(\"here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\")\n", + "v_1bar_500oc=3.565;\n", + "v_1bar_400oc=3.103;\n", + "v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400))\n", + "V=v1_10bar_500oc*100/v2\n", + "print(\"percentage of vessel volume initially occupied by steam(V)=\"),round(V,2)\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter6_3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter6_3.ipynb new file mode 100755 index 00000000..92ef2871 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter6_3.ipynb @@ -0,0 +1,1390 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6:Thermo dynamic Properties of pure substance" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.1;pg no: 174" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.1, Page:174 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\n", + "NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.1, Page:174 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\")\n", + "print(\"NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.2;pg no: 175" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.2, Page:175 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\n", + "during throttling,h1=h2\n", + "at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\n", + "thus h2=2682.5 KJ/kg\n", + "at state 1,before throttling\n", + "hf_10Mpa=1407.56 KJ/kg\n", + "hfg_10Mpa=1317.1 KJ/kg\n", + "h1=hf_10Mpa+x1*hfg_10Mpa\n", + "dryness fraction(x1)may be given as\n", + "x1= 0.97\n" + ] + } + ], + "source": [ + "#cal of dryness fraction\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.2, Page:175 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\")\n", + "print(\"during throttling,h1=h2\")\n", + "print(\"at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\")\n", + "print(\"thus h2=2682.5 KJ/kg\")\n", + "h2=2682.5;\n", + "print(\"at state 1,before throttling\")\n", + "print(\"hf_10Mpa=1407.56 KJ/kg\")\n", + "hf_10Mpa=1407.56;\n", + "print(\"hfg_10Mpa=1317.1 KJ/kg\")\n", + "hfg_10Mpa=1317.1;\n", + "print(\"h1=hf_10Mpa+x1*hfg_10Mpa\")\n", + "h1=h2;#during throttling\n", + "print(\"dryness fraction(x1)may be given as\")\n", + "x1=(h1-hf_10Mpa)/hfg_10Mpa\n", + "print(\"x1=\"),round(x1,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.3;pg no: 176" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.3, Page:176 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\n", + "internal energy(u)=in KJ/kg 2644.0\n" + ] + } + ], + "source": [ + "#cal of internal energy\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.3, Page:176 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\")\n", + "h=2848;#enthalpy in KJ/kg\n", + "p=12*1000;#pressure in Kpa\n", + "v=0.017;#specific volume in m^3/kg\n", + "u=h-p*v\n", + "print(\"internal energy(u)=in KJ/kg\"),round(u,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.4;pg no: 176" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.4, Page:176 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\n", + "steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\n", + "entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\n", + "S= 6.65\n", + "entropy of 5 kg of steam(S)in KJ/K\n", + "S=m*S 33.23\n" + ] + } + ], + "source": [ + "#cal of entropy of 5 kg of steam\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "import math\n", + "print\"Example 6.4, Page:176 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\")\n", + "m=5;#mass of steam in kg\n", + "p=2;#pressure of steam in Mpa\n", + "T_superheat=(300+273.15);#temperature of superheat steam in K\n", + "Cp_water=4.18;#specific heat of water at constant pressure in KJ/kg K\n", + "Cp_superheat=2.1;#specific heat of superheat steam at constant pressure in KJ/kg K\n", + "print(\"steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\")\n", + "T_sat=(212.42+273.15);#saturation temperature at 2 Mpa in K\n", + "hfg_2Mpa=1890.7;\n", + "print(\"entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\")\n", + "S=Cp_water*math.log(T_sat/273.15)+(hfg_2Mpa/T_sat)+(Cp_superheat*math.log(T_superheat/T_sat))\n", + "print(\"S=\"),round(S,2)\n", + "print(\"entropy of 5 kg of steam(S)in KJ/K\")\n", + "S=m*S\n", + "print(\"S=m*S\"),round(S,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.5;pg no: 176" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.5, Page:176 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\n", + "boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\n", + "at further depth of 50 cm the pressure(p)in Kpa\n", + "p= 138.37\n", + "boiling point at this depth=Tsat_138.365\n", + "from steam table this temperature=108.866=108.87 degree celcius\n", + "so boiling point = 108.87 degree celcius\n" + ] + } + ], + "source": [ + "#cal of boiling point\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.5, Page:176 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\")\n", + "rho=1000;#density of water in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "h=0.50;#depth from above mentioned level in m\n", + "print(\"boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\")\n", + "p_boil=143.27;#pressure at which pond water boils in Kpa\n", + "print(\"at further depth of 50 cm the pressure(p)in Kpa\")\n", + "p=p_boil-((rho*g*h)*10**-3)\n", + "print(\"p=\"),round(p,2)\n", + "print(\"boiling point at this depth=Tsat_138.365\")\n", + "print(\"from steam table this temperature=108.866=108.87 degree celcius\")\n", + "print(\"so boiling point = 108.87 degree celcius\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.6;pg no: 177" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.6, Page:177 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\n", + "in a rigid vessel it can be treated as constant volume process.\n", + "so v1=v2\n", + "since final state is given to be critical state,then specific volume at critical point,\n", + "v2=0.003155 m^3/kg\n", + "at 100 degree celcius saturation temperature,from steam table\n", + "vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\n", + "and vfg_100=in m^3/kg= 1.67\n", + "thus for initial quality being x1\n", + "v1=vf_100+x1*vfg_100\n", + "so x1= 0.001\n", + "mass of water initially=total mass*(1-x1)\n", + "total mass of fluid/water(m) in kg= 158.48\n", + "volume of water(v) in m^3= 0.1655\n" + ] + } + ], + "source": [ + "#cal of mass and volume of water\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.6, Page:177 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\")\n", + "V=0.5;#capacity of rigid vessel in m^3\n", + "print(\"in a rigid vessel it can be treated as constant volume process.\")\n", + "print(\"so v1=v2\")\n", + "print(\"since final state is given to be critical state,then specific volume at critical point,\")\n", + "print(\"v2=0.003155 m^3/kg\")\n", + "v2=0.003155;#specific volume at critical point in m^3/kg\n", + "print(\"at 100 degree celcius saturation temperature,from steam table\")\n", + "print(\"vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\")\n", + "vf_100=0.001044;\n", + "vg_100=1.6729;\n", + "vfg_100=vg_100-vf_100\n", + "print(\"and vfg_100=in m^3/kg=\"),round(vfg_100,2)\n", + "print(\"thus for initial quality being x1\")\n", + "v1=v2;#rigid vessel\n", + "x1=(v1-vf_100)/vfg_100\n", + "print(\"v1=vf_100+x1*vfg_100\")\n", + "print(\"so x1=\"),round(x1,3)\n", + "print(\"mass of water initially=total mass*(1-x1)\")\n", + "m=V/v2\n", + "print(\"total mass of fluid/water(m) in kg=\"),round(m,2)\n", + "v=m*vf_100\n", + "print(\"volume of water(v) in m^3=\"),round(v,4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.7;pg no: 177" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.7, Page:177 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\n", + "on mollier diadram(h-s diagram)the slope of isobaric line may be given as\n", + "(dh/ds)_p=cons =slope of isobar\n", + "from 1st and 2nd law combined;\n", + "T*ds=dh-v*dp\n", + "(dh/ds)_p=cons = T\n", + "here temperature,T=773.15 K\n", + "here slope=(dh/ds))p=cons = 773.15\n" + ] + } + ], + "source": [ + "#cal of slope\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.7, Page:177 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\")\n", + "print(\"on mollier diadram(h-s diagram)the slope of isobaric line may be given as\")\n", + "print(\"(dh/ds)_p=cons =slope of isobar\")\n", + "print(\"from 1st and 2nd law combined;\")\n", + "print(\"T*ds=dh-v*dp\")\n", + "print(\"(dh/ds)_p=cons = T\")\n", + "print(\"here temperature,T=773.15 K\")\n", + "print(\"here slope=(dh/ds))p=cons = 773.15\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.8;pg no: 178" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.8, Page:178 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\n", + "at 0.15Mpa,from steam table;\n", + "hf=467.11 KJ/kg,hg=2693.6 KJ/kg\n", + "and hfg in KJ/kg= 2226.49\n", + "vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\n", + "and vfg in m^3/kg= 1.16\n", + "sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\n", + "and sfg=in KJ/kg K= 5.79\n", + "enthalpy at x=.10(h)in KJ/kg\n", + "h= 689.76\n", + "specific volume,(v)in m^3/kg\n", + "v= 0.12\n", + "entropy (s)in KJ/kg K\n", + "s= 2.01\n" + ] + } + ], + "source": [ + "#cal of entropy\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.8, Page:178 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\")\n", + "x=.10;#quality is 10%\n", + "print(\"at 0.15Mpa,from steam table;\")\n", + "print(\"hf=467.11 KJ/kg,hg=2693.6 KJ/kg\")\n", + "hf=467.11;\n", + "hg=2693.6;\n", + "hfg=hg-hf\n", + "print(\"and hfg in KJ/kg=\"),round(hfg,2)\n", + "print(\"vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\")\n", + "vf=0.001053;\n", + "vg=1.1593;\n", + "vfg=vg-vf\n", + "print(\"and vfg in m^3/kg=\"),round(vfg,2)\n", + "print(\"sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\")\n", + "sf=1.4336;\n", + "sg=7.2233;\n", + "sfg=sg-sf\n", + "print(\"and sfg=in KJ/kg K=\"),round(sfg,2)\n", + "print(\"enthalpy at x=.10(h)in KJ/kg\")\n", + "h=hf+x*hfg\n", + "print(\"h=\"),round(h,2)\n", + "print(\"specific volume,(v)in m^3/kg\")\n", + "v=vf+x*vfg\n", + "print(\"v=\"),round(v,2)\n", + "print(\"entropy (s)in KJ/kg K\")\n", + "s=sf+x*sfg\n", + "print(\"s=\"),round(s,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.9;pg no: 178" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.9, Page:178 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\n", + "work done during constant pressure process(W)=p1*(V2-V1)in KJ\n", + "now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\n", + "so v1 in m^3/kg=\n", + "now mass of steam(m) in kg= 0.32\n", + "specific volume at final state(v2)in m^3/kg\n", + "v2= 0.62\n", + "corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\n", + "v2>vg_1Mpa\n", + "hence state lies in superheated region,from the steam table by interpolation we get temperature as;\n", + "state lies between temperature of 1000 degree celcius and 1100 degree celcius\n", + "so exact temperature at final state(T)in K= 1077.61\n", + "thus internal energy at final state,1 Mpa,1077.61 degree celcius;\n", + "u2=4209.6 KJ/kg\n", + "internal energy at initial state(u1)in KJ/kg\n", + "u1= 2219.28\n", + "from first law of thermodynamics,Q-W=deltaU\n", + "so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ= 788.83\n" + ] + } + ], + "source": [ + "#cal of heat added\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.9, Page:178 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\")\n", + "p1=1*1000;#initial pressure of steam in Kpa\n", + "V1=0.05;#initial volume of steam in m^3\n", + "x1=.8;#dryness fraction is 80%\n", + "V2=0.2;#final volume of steam in m^3\n", + "p2=p1;#constant pressure process\n", + "print(\"work done during constant pressure process(W)=p1*(V2-V1)in KJ\")\n", + "W=p1*(V2-V1)\n", + "print(\"now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\")\n", + "vf=0.001127;\n", + "vg=0.19444;\n", + "uf=761.68;\n", + "ufg=1822;\n", + "v1=vf+x1*vg\n", + "print(\"so v1 in m^3/kg=\")\n", + "m=V1/v1\n", + "print(\"now mass of steam(m) in kg=\"),round(m,2)\n", + "m=0.32097;#take m=0.32097 approx.\n", + "print(\"specific volume at final state(v2)in m^3/kg\")\n", + "v2=V2/m\n", + "print(\"v2=\"),round(v2,2)\n", + "print(\"corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\")\n", + "print(\"v2>vg_1Mpa\")\n", + "print(\"hence state lies in superheated region,from the steam table by interpolation we get temperature as;\")\n", + "print(\"state lies between temperature of 1000 degree celcius and 1100 degree celcius\")\n", + "T=1000+((100*(.62311-.5871))/(.6335-.5871))\n", + "print(\"so exact temperature at final state(T)in K=\"),round(T,2)\n", + "print(\"thus internal energy at final state,1 Mpa,1077.61 degree celcius;\")\n", + "print(\"u2=4209.6 KJ/kg\")\n", + "u2=4209.6;\n", + "print(\"internal energy at initial state(u1)in KJ/kg\")\n", + "u1=uf+x1*ufg\n", + "print(\"u1=\"),round(u1,2)\n", + "print(\"from first law of thermodynamics,Q-W=deltaU\")\n", + "Q=m*(u2-u1)+W\n", + "print(\"so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ=\"),round(Q,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.10;pg no: 179" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.10, Page:179 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\n", + "here steam is kept in rigid vessel,therefore its specific volume shall remain constant\n", + "it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\n", + "from superheated steam table;v1=0.2404 m^3/kg\n", + "at begining of condensation specific volume = 0.2404 m^3/kg\n", + "v2=0.2404 m^3/kg\n", + "this v2 shall be specific volume corresponding to saturated vapour state for condensation.\n", + "thus v2=vg=0.2404 m^3/kg\n", + "looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\n", + "by interpolation,temperature at begining of condensation(T2)in K\n", + "similarily,pressure(p2)in Kpa= 800.96\n" + ] + } + ], + "source": [ + "#cal of pressure\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.10, Page:179 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\")\n", + "p1=800;#initial pressure of steam in Kpa\n", + "T1=200;#initial temperature of steam in degree celcius\n", + "print(\"here steam is kept in rigid vessel,therefore its specific volume shall remain constant\")\n", + "print(\"it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\")\n", + "print(\"from superheated steam table;v1=0.2404 m^3/kg\")\n", + "print(\"at begining of condensation specific volume = 0.2404 m^3/kg\")\n", + "print(\"v2=0.2404 m^3/kg\")\n", + "v2=0.2404;\n", + "print(\"this v2 shall be specific volume corresponding to saturated vapour state for condensation.\")\n", + "print(\"thus v2=vg=0.2404 m^3/kg\")\n", + "vg=v2;\n", + "print(\"looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\")\n", + "print(\"by interpolation,temperature at begining of condensation(T2)in K\")\n", + "T2=175-((175-170)*(0.2404-0.2167))/(0.2428-.2168)\n", + "p=892-(((892-791.7)*(0.2404-0.2168))/(0.2428-0.2168))\n", + "print(\"similarily,pressure(p2)in Kpa=\"),round(p,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.11;pg no: 180" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.11, Page:180 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\n", + "from 1st and 2nd law;\n", + "T*ds=dh-v*dp\n", + "for isentropic process,ds=0\n", + "hence dh=v*dp\n", + "i.e (h2-h1)=v1*(p2-p1)\n", + "corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\n", + "p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\n", + "therefore enthalpy change(deltah)=(h2-h1) in KJ/kg= 0.2\n" + ] + } + ], + "source": [ + "#cal of enthalpy change\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.11, Page:180 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\")\n", + "p2=200;#feed water pump pressure in Kpa\n", + "print(\"from 1st and 2nd law;\")\n", + "print(\"T*ds=dh-v*dp\")\n", + "print(\"for isentropic process,ds=0\")\n", + "print(\"hence dh=v*dp\")\n", + "print(\"i.e (h2-h1)=v1*(p2-p1)\")\n", + "print(\"corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\")\n", + "print(\"p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\")\n", + "p1=4.25;\n", + "v1=0.001004;\n", + "deltah=v1*(p2-p1)\n", + "print(\"therefore enthalpy change(deltah)=(h2-h1) in KJ/kg=\"),round(deltah,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.12;pg no: 180" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.12, Page:180 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\n", + "from steam table at 150 degree celcius\n", + "vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\n", + "so volume occupied by water(Vw)=3*V/(3+2) in m^3 1.2\n", + "and volume of steam(Vs) in m^3= 0.8\n", + "mass of water(mf)=Vw/Vf in kg 1099.91\n", + "mass of steam(mg)=Vs/Vg in kg 2.04\n", + "total mass in tank(m) in kg= 1101.95\n", + "quality or dryness fraction(x)\n", + "x= 0.002\n", + "NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\n" + ] + } + ], + "source": [ + "#cal of quality or dryness fraction\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.12, Page:180 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\")\n", + "V=2.;#volume of vessel in m^3\n", + "print(\"from steam table at 150 degree celcius\")\n", + "print(\"vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\")\n", + "Vf=0.001091;\n", + "Vg=0.3928;\n", + "Vw=3*V/(3+2)\n", + "print(\"so volume occupied by water(Vw)=3*V/(3+2) in m^3\"),round(Vw,2)\n", + "Vs=2*V/(3+2)\n", + "print(\"and volume of steam(Vs) in m^3=\"),round(Vs,2)\n", + "mf=Vw/Vf\n", + "print(\"mass of water(mf)=Vw/Vf in kg\"),round(mf,2)\n", + "mg=Vs/Vg\n", + "print(\"mass of steam(mg)=Vs/Vg in kg\"),round(mg,2)\n", + "m=mf+mg\n", + "print(\"total mass in tank(m) in kg=\"),round(m,2)\n", + "print(\"quality or dryness fraction(x)\")\n", + "x=mg/m\n", + "print(\"x=\"),round(x,3)\n", + "print(\"NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.13;pg no: 181" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.13, Page:181 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\n", + "fron S.F.S.E on steam turbine;\n", + "W=h1-h2\n", + "initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\n", + "h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\n", + "reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\n", + "else from steam tables at 50 degree celcius saturation temperature;\n", + "hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\n", + "hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\n", + "here s1=s2,let dryness fraction at 2 be x2\n", + "x2= 0.75\n", + "hence enthalpy at state 2\n", + "h2 in KJ/kg= 1994.84\n", + "steam turbine work(W)in KJ/kg\n", + "W=h1-h2\n", + "so turbine output=W 891.36\n" + ] + } + ], + "source": [ + "#cal of turbine output\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.13, Page:181 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\")\n", + "print(\"fron S.F.S.E on steam turbine;\")\n", + "print(\"W=h1-h2\")\n", + "print(\"initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\")\n", + "print(\"h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\")\n", + "h1=2886.2;\n", + "s1=6.2285;\n", + "print(\"reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\")\n", + "print(\"else from steam tables at 50 degree celcius saturation temperature;\")\n", + "print(\"hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\")\n", + "hf=209.33;\n", + "sf=0.7038;\n", + "print(\"hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\")\n", + "hfg=2382.7;\n", + "sfg=7.3725;\n", + "print(\"here s1=s2,let dryness fraction at 2 be x2\")\n", + "x2=(s1-sf)/sfg\n", + "print(\"x2=\"),round(x2,2)\n", + "print(\"hence enthalpy at state 2\")\n", + "h2=hf+x2*hfg\n", + "print(\"h2 in KJ/kg=\"),round(h2,2)\n", + "print(\"steam turbine work(W)in KJ/kg\")\n", + "W=h1-h2\n", + "print(\"W=h1-h2\")\n", + "print(\"so turbine output=W\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.14;pg no: 181" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.14, Page:181 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\n", + "it is constant volume process\n", + "volume of vessel(V)=mass of vapour * specific volume of vapour\n", + "initial specific volume,v1\n", + "v1=vf_100Kpa+x1*vfg_100 in m^3/kg\n", + "at 100 Kpa from steam table;\n", + "hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\n", + " here vfg_100Kpa= in m^3/kg= 1.69\n", + "so v1= in m^3/kg= 0.85\n", + "and volume of vessel(V) in m^3= 42.38\n", + "enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg 1546.46\n", + "internal energy in the beginning=U1=m1*u1 in KJ 146171.0\n", + "let the mass of dry steam added be m,final specific volume inside vessel,v2\n", + "v2=vf_1000Kpa+x2*vfg_1000Kpa\n", + "at 2000 Kpa,from steam table,\n", + "vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\n", + "total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\n", + "V/v2=V/vg_2000Kpa+V/v1\n", + "so v2 in m^3/kg= 0.09\n", + "here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\n", + "at 1000 Kpa from steam table,\n", + "hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\n", + "here vfg_1000Kpa= in m^3/kg= 0.19\n", + "so x2= 0.46\n", + "for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\n", + "so mass of dry steam at 2000 Kpa to be added(m)in kg\n", + "m=(100*(h1-h2))/(h2-hg_2000Kpa)= 11.97\n", + "quality of final mixture x2= 0.46\n" + ] + } + ], + "source": [ + "#cal of quality of final mixture\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.14, Page:181 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\")\n", + "x1=0.5;#dryness fraction \n", + "m1=100;#mass of steam in kg\n", + "v1=0.8475;#\n", + "print(\"it is constant volume process\")\n", + "print(\"volume of vessel(V)=mass of vapour * specific volume of vapour\")\n", + "print(\"initial specific volume,v1\")\n", + "print(\"v1=vf_100Kpa+x1*vfg_100 in m^3/kg\")\n", + "print(\"at 100 Kpa from steam table;\")\n", + "print(\"hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\")\n", + "hf_100Kpa=417.46;\n", + "uf_100Kpa=417.36;\n", + "vf_100Kpa=0.001043;\n", + "hfg_100Kpa=2258;\n", + "ufg_100Kpa=2088.7;\n", + "vg_100Kpa=1.6940;\n", + "vfg_100Kpa=vg_100Kpa-vf_100Kpa\n", + "print(\" here vfg_100Kpa= in m^3/kg=\"),round(vfg_100Kpa,2)\n", + "v1=vf_100Kpa+x1*vfg_100Kpa\n", + "print(\"so v1= in m^3/kg=\"),round(v1,2)\n", + "V=m1*x1*v1\n", + "print(\"and volume of vessel(V) in m^3=\"),round(V,2)\n", + "h1=hf_100Kpa+x1*hfg_100Kpa\n", + "print(\"enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg\"),round(h1,2)\n", + "U1=m1*(uf_100Kpa+x1*ufg_100Kpa)\n", + "print(\"internal energy in the beginning=U1=m1*u1 in KJ\"),round(U1,2)\n", + "print(\"let the mass of dry steam added be m,final specific volume inside vessel,v2\")\n", + "print(\"v2=vf_1000Kpa+x2*vfg_1000Kpa\")\n", + "print(\"at 2000 Kpa,from steam table,\")\n", + "print(\"vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\")\n", + "vg_2000Kpa=0.09963;\n", + "ug_2000Kpa=2600.3;\n", + "hg_2000Kpa=2799.5;\n", + "print(\"total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\")\n", + "print(\"V/v2=V/vg_2000Kpa+V/v1\")\n", + "v2=1/((1/vg_2000Kpa)+(1/v1))\n", + "print(\"so v2 in m^3/kg=\"),round(v2,2)\n", + "print(\"here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\")\n", + "print(\"at 1000 Kpa from steam table,\")\n", + "print(\"hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\")\n", + "hf_1000Kpa=762.81;\n", + "hfg_1000Kpa=2015.3;\n", + "vf_1000Kpa=0.001127;\n", + "vg_1000Kpa=0.19444;\n", + "vfg_1000Kpa=vg_1000Kpa-vf_1000Kpa\n", + "print(\"here vfg_1000Kpa= in m^3/kg=\"),round(vfg_1000Kpa,2)\n", + "x2=(v2-vf_1000Kpa)/vfg_1000Kpa\n", + "print(\"so x2=\"),round(x2,2)\n", + "print(\"for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\")\n", + "print(\"so mass of dry steam at 2000 Kpa to be added(m)in kg\")\n", + "m=(100*(h1-(hf_1000Kpa+x2*hfg_1000Kpa)))/((hf_1000Kpa+x2*hfg_1000Kpa)-hg_2000Kpa)\n", + "print(\"m=(100*(h1-h2))/(h2-hg_2000Kpa)=\"),round(m,2)\n", + "print(\"quality of final mixture x2=\"),round(x2,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.15;pg no: 183" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.15, Page:183 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\n", + "from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\n", + "condenser pressure(p_condenser) in Kpa= 7.3\n", + "partial pressure of steam corresponding to35 degree celcius from steam table;\n", + "p_steam=5.628 Kpa\n", + "enthalpy corresponding to 35 degree celcius from steam table,\n", + "hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\n", + "let quality of steam entering be x\n", + "from energy balance;\n", + "mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\n", + "so dryness fraction of steam entering(x)is given as\n", + "x= 0.97\n" + ] + } + ], + "source": [ + "#cal of dryness fraction of steam entering\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.15, Page:183 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\")\n", + "p_vaccum=71.5;#recorded condenser vaccum in cm of mercury\n", + "p_barometer=76.8;#barometer reading in cm of mercury\n", + "T_cond=35;#temperature of condensation in degree celcius\n", + "T_hotwell=27.6;#temperature of hot well in degree celcius\n", + "m_cond=1930;#mass of condensate per hour\n", + "m_w=62000;#mass of cooling water per hour\n", + "Ti=8.51;#initial temperature in degree celcius\n", + "To=26.24;#outlet temperature in degree celcius\n", + "print(\"from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\")\n", + "p_condenser=(p_barometer-p_vaccum)*101.325/73.55\n", + "print(\"condenser pressure(p_condenser) in Kpa=\"),round(p_condenser,2)\n", + "print(\"partial pressure of steam corresponding to35 degree celcius from steam table;\")\n", + "print(\"p_steam=5.628 Kpa\")\n", + "p_steam=5.628;#partial pressure of steam\n", + "print(\"enthalpy corresponding to 35 degree celcius from steam table,\")\n", + "print(\"hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\")\n", + "hf=146.68;\n", + "hfg=2418.6;\n", + "print(\"let quality of steam entering be x\")\n", + "print(\"from energy balance;\")\n", + "print(\"mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\")\n", + "print(\"so dryness fraction of steam entering(x)is given as\")\n", + "x=(((m_w*(To-Ti)*4.18)/m_cond)-hf+4.18*T_hotwell)/hfg\n", + "print(\"x=\"),round(x,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.16;pg no: 184" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.16, Page:184 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\n", + "heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\n", + "area(A) in m^2= 0.03\n", + "so p1=in Kpa= 419.61\n", + "now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\n", + "volume of water contained(V1) in m^3= 0.001\n", + "mass of water(m) in kg= 0.63\n", + "heat supplied shall cause sensible heating and latent heating\n", + "hence,enthalpy change=heat supplied\n", + "Q=((hf+x*hfg)-(4.18*T)*m)\n", + "so dryness fraction of steam produced(x)can be calculated as\n", + "so x= 0.46\n", + "internal energy of water(U1)in KJ,initially\n", + "U1= 393.69\n", + "finally,internal energy of wet steam(U2)in KJ\n", + "U2=m*h2-p2*V2\n", + "here V2 in m^3= 0.13\n", + "hence U2= 940.68\n", + "hence change in internal energy(U) in KJ= 547.21\n", + "work done(W) in KJ= 53.01\n" + ] + } + ], + "source": [ + "#cal of change in internal energy and work done\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "import math\n", + "print\"Example 6.16, Page:184 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\")\n", + "F=10;#force applied externally upon piston in KN\n", + "d=.2;#diameter in m\n", + "h=0.02;#depth to which water filled in m \n", + "P_atm=101.3;#atmospheric pressure in Kpa\n", + "rho=1000;#density of water in kg/m^3\n", + "Q=600;#heat supplied to water in KJ\n", + "T=150;#temperature of water in degree celcius\n", + "print(\"heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\")\n", + "A=math.pi*d**2/4\n", + "print(\"area(A) in m^2=\"),round(A,2)\n", + "p1=F/A+P_atm\n", + "print(\"so p1=in Kpa=\"),round(p1,2)\n", + "print(\"now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\")\n", + "hf=612.1;\n", + "hfg=2128.7;\n", + "vg=0.4435;\n", + "V1=math.pi*d**2*h/4\n", + "print(\"volume of water contained(V1) in m^3=\"),round(V1,3)\n", + "m=V1*rho\n", + "print(\"mass of water(m) in kg=\"),round(m,2)\n", + "print(\"heat supplied shall cause sensible heating and latent heating\")\n", + "print(\"hence,enthalpy change=heat supplied\")\n", + "print(\"Q=((hf+x*hfg)-(4.18*T)*m)\")\n", + "print(\"so dryness fraction of steam produced(x)can be calculated as\")\n", + "x=((Q/m)+4.18*T-hf)/hfg\n", + "print(\"so x=\"),round(x,2)\n", + "print(\"internal energy of water(U1)in KJ,initially\")\n", + "h1=4.18*T;#enthalpy of water in KJ/kg\n", + "U1=m*h1-p1*V1\n", + "print(\"U1=\"),round(U1,2)\n", + "U1=393.5;#approx.\n", + "print(\"finally,internal energy of wet steam(U2)in KJ\")\n", + "print(\"U2=m*h2-p2*V2\")\n", + "V2=m*x*vg\n", + "print(\"here V2 in m^3=\"),round(V2,2)\n", + "p2=p1;#constant pressure process\n", + "U2=(m*(hf+x*hfg))-p2*V2\n", + "print(\"hence U2=\"),round(U2,2)\n", + "U2=940.71;#approx.\n", + "U=U2-U1\n", + "print(\"hence change in internal energy(U) in KJ=\"),round(U,2)\n", + "p=p1;\n", + "W=p*(V2-V1)\n", + "print(\"work done(W) in KJ=\"),round(W,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.17;pg no: 185" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.17, Page:185 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\n", + "consider throttling calorimeter alone,\n", + "degree of superheat(T_sup)in degree celcius\n", + "T_sup= 18.2\n", + "enthalpy of superheated steam(h_sup)in KJ/kg\n", + "h_sup= 2711.99\n", + "at 120 degree celcius,h=2673.95 KJ/kg from steam table\n", + "now enthalpy before throttling = enthalpy after throttling\n", + "hf+x2*hfg=h_sup\n", + "here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\n", + "so x2= 0.96\n", + "for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\n", + "overall dryness fraction(x)= 0.91\n" + ] + } + ], + "source": [ + "#cal of overall dryness fraction\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.17, Page:185 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\")\n", + "ms=40;#mass of steam in kg\n", + "mw=2.2;#mass of water in kg\n", + "p1=1.47;#pressure before throttling in Mpa\n", + "T2=120;#temperature after throttling in degree celcius\n", + "p2=107.88;#pressure after throttling in Kpa\n", + "Cp_sup=2.09;#specific heat of superheated steam in KJ/kg K\n", + "print(\"consider throttling calorimeter alone,\")\n", + "print(\"degree of superheat(T_sup)in degree celcius\")\n", + "T_sup=T2-101.8\n", + "print(\"T_sup=\"),round(T_sup,2)\n", + "print(\"enthalpy of superheated steam(h_sup)in KJ/kg\")\n", + "h=2673.95;\n", + "h_sup=h+T_sup*Cp_sup\n", + "print(\"h_sup=\"),round(h_sup,2)\n", + "print(\"at 120 degree celcius,h=2673.95 KJ/kg from steam table\")\n", + "print(\"now enthalpy before throttling = enthalpy after throttling\")\n", + "print(\"hf+x2*hfg=h_sup\")\n", + "print(\"here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\")\n", + "hf=840.513;\n", + "hfg=1951.02;\n", + "x2=(h_sup-hf)/hfg\n", + "print(\"so x2=\"),round(x2,2)\n", + "print(\"for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\")\n", + "x1=(ms-mw)/ms\n", + "x=x1*x2\n", + "print(\"overall dryness fraction(x)=\"),round(x,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.18;pg no: 185" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.18, Page:185 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\n", + "here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\n", + "final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\n", + "Q in KJ= 200.0\n", + "final enthalpy of dry steam at 15 bar,h2=hg_15bar\n", + "h2=2792.2 KJ/kg from steam table\n", + "let initial dryness fraction be x1,initial enthalpy,\n", + "h1=hf_10bar+x1*hfg_10bar.........eq1\n", + "here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\n", + "also heat balance yields,\n", + "h1+Q=h2\n", + "so h1=h2-Q in KJ/kg\n", + "so by eq 1=>x1= 0.91\n", + "heat added(Q)in KJ= 200.0\n", + "and initial quality(x1) 0.91\n" + ] + } + ], + "source": [ + "#cal of heat added and initial quality\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.18, Page:185 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\")\n", + "v=0.4;#volume of air in part A and part B in m^3\n", + "p1=10*10**5;#initial pressure of steam in pa\n", + "p2=15*10**5;#final pressure of steam in pa\n", + "print(\"here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\")\n", + "print(\"final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\")\n", + "Q=v*(p2-p1)/1000\n", + "print(\"Q in KJ=\"),round(Q,2)\n", + "print(\"final enthalpy of dry steam at 15 bar,h2=hg_15bar\")\n", + "print(\"h2=2792.2 KJ/kg from steam table\")\n", + "h2=2792.2;\n", + "print(\"let initial dryness fraction be x1,initial enthalpy,\")\n", + "print(\"h1=hf_10bar+x1*hfg_10bar.........eq1\")\n", + "print(\"here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\")\n", + "hf_10bar=762.83;\n", + "hfg_10bar=2015.3;\n", + "print(\"also heat balance yields,\")\n", + "print(\"h1+Q=h2\")\n", + "print(\"so h1=h2-Q in KJ/kg\")\n", + "h1=h2-Q\n", + "x1=(h1-hf_10bar)/hfg_10bar\n", + "print(\"so by eq 1=>x1=\"),round(x1,2)\n", + "print(\"heat added(Q)in KJ=\"),round(Q,2)\n", + "print(\"and initial quality(x1)\"),round(x1,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.19;pg no: 186" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.19, Page:186 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\n", + "from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\n", + "specific volume of wet steam in cylinder,v1 in m^3/kg= 0.75\n", + "dryness fraction of initial steam(x1)= 0.6\n", + "initial enthalpy of wet steam,h1 in KJ/kg= 1801.83\n", + "at 400 degree celcius specific volume of steam,v2 in m^3/kg= 1.55\n", + "for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\n", + "actual pressure can be obtained by interpolation\n", + "p2=0.20 MPa(approx.)\n", + "saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\n", + "finally the degree of superheat(T_sup)in K\n", + "T_sup=T-t\n", + "final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\n", + "heat added during process(deltaQ)in KJ\n", + "deltaQ=m*(h2-h1)\n", + "internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\n", + "here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\n", + "internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\n", + "u2=2966.7 KJ/kg\n", + "change in internal energy(deltaU)in KJ\n", + "deltaU= 3807.41\n", + "form first law of thermodynamics,work done(deltaW)in KJ\n", + "deltaW=deltaQ-deltaU 616.88\n", + "so heat transfer(deltaQ)in KJ 4424.3\n", + "and work transfer(deltaW)in KJ 616.88\n", + "NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\n", + "and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\n" + ] + } + ], + "source": [ + "#cal of heat and work transfer \n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.19, Page:186 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\")\n", + "m=3;#mass of wet steam in kg\n", + "p=1.4;#pressure of wet steam in bar\n", + "V1=2.25;#initial volume in m^3\n", + "V2=4.65;#final volume in m^3\n", + "T=400;#temperature of steam in degreee celcius\n", + "print(\"from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\")\n", + "vg=1.2455;\n", + "hf=457.99;\n", + "hfg=2232.3;\n", + "v1=V1/m\n", + "print(\"specific volume of wet steam in cylinder,v1 in m^3/kg=\"),round(v1,2)\n", + "x1=v1/vg\n", + "print(\"dryness fraction of initial steam(x1)=\"),round(x1,2)\n", + "x1=0.602;#approx.\n", + "h1=hf+x1*hfg\n", + "print(\"initial enthalpy of wet steam,h1 in KJ/kg=\"),round(h1,2)\n", + "v2=V2/m\n", + "print(\"at 400 degree celcius specific volume of steam,v2 in m^3/kg=\"),round(v2,2)\n", + "print(\"for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\")\n", + "print(\"actual pressure can be obtained by interpolation\")\n", + "p2=.1+((0.20-0.10)/(1.5493-3.103))*(1.55-3.103)\n", + "print(\"p2=0.20 MPa(approx.)\")\n", + "p2=0.20;\n", + "print(\"saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\")\n", + "t=120.23;\n", + "print(\"finally the degree of superheat(T_sup)in K\")\n", + "print(\"T_sup=T-t\")\n", + "T_sup=T-t\n", + "print(\"final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\")\n", + "h2=3276.6;\n", + "print(\"heat added during process(deltaQ)in KJ\")\n", + "print(\"deltaQ=m*(h2-h1)\")\n", + "deltaQ=m*(h2-h1)\n", + "print(\"internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\")\n", + "print(\"here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\")\n", + "uf=457.84;\n", + "ufg=2059.34;\n", + "u1=uf+x1*ufg\n", + "print(\"internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\")\n", + "print(\"u2=2966.7 KJ/kg\")\n", + "u2=2966.7;\n", + "print(\"change in internal energy(deltaU)in KJ\")\n", + "deltaU=m*(u2-u1)\n", + "print(\"deltaU=\"),round(deltaU,2)\n", + "print(\"form first law of thermodynamics,work done(deltaW)in KJ\")\n", + "deltaW=deltaQ-deltaU\n", + "print(\"deltaW=deltaQ-deltaU\"),round(deltaW,2)\n", + "print(\"so heat transfer(deltaQ)in KJ\"),round(deltaQ,2)\n", + "print(\"and work transfer(deltaW)in KJ\"),round(deltaW,2)\n", + "print(\"NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\")\n", + "print(\"and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 6.20;pg no: 187" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 6.20, Page:187 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\n", + "here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\n", + "at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\n", + "finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\n", + "h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\n", + "h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\n", + "so final temperature(T2)in K\n", + "T2= 495.43\n", + "entropy for final state(s2)in KJ/kg K\n", + "s2= 8.82\n", + "here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\n", + "so change in entropy(deltaS)in KJ/kg K\n", + "deltaS= 1.06\n", + "final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\n", + "here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\n", + "percentage of vessel volume initially occupied by steam(V)= 9.99\n" + ] + } + ], + "source": [ + "#cal of percentage of vessel volume initially occupied by steam\n", + "#intiation of all variables\n", + "# Chapter 6\n", + "print\"Example 6.20, Page:187 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\")\n", + "print(\"here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\")\n", + "print(\"at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\")\n", + "h1_10bar_500oc=3478.5;\n", + "s1_10bar_500oc=7.7622;\n", + "v1_10bar_500oc=0.3541;\n", + "print(\"finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\")\n", + "h2=h1_10bar_500oc;\n", + "print(\"h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\")\n", + "h_1bar_400oc=3278.2;\n", + "h_1bar_500oc=3488.1;\n", + "print(\"h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\")\n", + "print(\"so final temperature(T2)in K\")\n", + "T2=400+((h2-h_1bar_400oc)*(500-400)/(h_1bar_500oc-h_1bar_400oc))\n", + "print(\"T2=\"),round(T2,2)\n", + "print(\"entropy for final state(s2)in KJ/kg K\")\n", + "s_1bar_400oc=8.5435;\n", + "s_1bar_500oc=8.8342;\n", + "s2=s_1bar_400oc+((s_1bar_500oc-s_1bar_400oc)*(495.43-400)/(500-400))\n", + "print(\"s2=\"),round(s2,2)\n", + "print(\"here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\")\n", + "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", + "deltaS=s2-s1_10bar_500oc\n", + "print(\"deltaS=\"),round(deltaS,2)\n", + "print(\"final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\")\n", + "print(\"here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\")\n", + "v_1bar_500oc=3.565;\n", + "v_1bar_400oc=3.103;\n", + "v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400))\n", + "V=v1_10bar_500oc*100/v2\n", + "print(\"percentage of vessel volume initially occupied by steam(V)=\"),round(V,2)\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter7-Copy1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter7-Copy1.ipynb new file mode 100755 index 00000000..c10f28b4 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter7-Copy1.ipynb @@ -0,0 +1,1452 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7:Availability and General Thermodynamic Relation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.1;page no: 218" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.1, Page:218 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\n", + "let us neglect the potential energy change during the flow.\n", + "applying S.F.E.E,neglecting inlet velocity and change in potential energy,\n", + "W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\n", + "W_max=(h1-h2)-To*(s1-s2)-C2^2/2\n", + "from steam tables,\n", + "h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\n", + "given To=288 K\n", + "so W_max in KJ/kg= 457.1\n", + "maximum possible work(W_max) in KW= 1142.76\n" + ] + } + ], + "source": [ + "#cal of maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.1, Page:218 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\")\n", + "C2=150;#leave velocity of steam in m/s\n", + "m=2.5;#steam mass flow rate in kg/s\n", + "print(\"let us neglect the potential energy change during the flow.\")\n", + "print(\"applying S.F.E.E,neglecting inlet velocity and change in potential energy,\")\n", + "print(\"W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\")\n", + "print(\"W_max=(h1-h2)-To*(s1-s2)-C2^2/2\")\n", + "print(\"from steam tables,\")\n", + "print(\"h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\")\n", + "h1=3034.8;\n", + "s1=6.8844;\n", + "h2=2776.4;\n", + "s2=7.6134;\n", + "print(\"given To=288 K\")\n", + "To=288;\n", + "W_max=(h1-h2)-To*(s1-s2)-(C2**2/2*10**-3)\n", + "print(\"so W_max in KJ/kg=\"),round(W_max,2)\n", + "W_max=m*W_max\n", + "print(\"maximum possible work(W_max) in KW=\"),round(W_max,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.2;page no: 219" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.2, Page:219 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\n", + "In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\n", + "BOTH THE TANKS HAVE SAME INTERNAL ENERGY\n", + "availability of air in tank,A\n", + "A=(E-Uo)+Po*(V-Vo)-To*(S-So)\n", + "=m*{(e-uo)+Po(v-vo)-To(s-so)}\n", + "m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\n", + "so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\n", + "for tank A,P in pa,so availability_A in KJ= 1.98\n", + "for tank B,P=3*10^5 pa,so availability_B in KJ= 30.98\n", + "so availability of air in tank B is more than that of tank A\n", + "availability of air in tank A=1.98 KJ\n", + "availability of air in tank B=30.98 KJ\n" + ] + } + ], + "source": [ + "#cal of availability of air in tank A,B\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.2, Page:219 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\")\n", + "m=1.;#mass of air in kg\n", + "Po=1.*10**5;#atmospheric pressure in pa\n", + "To=(15.+273.);#temperature of atmosphere in K\n", + "Cv=0.717;#specific heat at constant volume in KJ/kg K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", + "T=(50.+273.);#temperature of tanks A and B in K\n", + "print(\"In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\")\n", + "print(\"BOTH THE TANKS HAVE SAME INTERNAL ENERGY\")\n", + "print(\"availability of air in tank,A\")\n", + "print(\"A=(E-Uo)+Po*(V-Vo)-To*(S-So)\")\n", + "print(\"=m*{(e-uo)+Po(v-vo)-To(s-so)}\")\n", + "print(\"m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\")\n", + "print(\"so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\")\n", + "P=1.*10**5;#pressure in tank A in pa\n", + "availability_A=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", + "print(\"for tank A,P in pa,so availability_A in KJ=\"),round(availability_A,2)\n", + "P=3.*10**5;#pressure in tank B in pa\n", + "availability_B=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", + "print(\"for tank B,P=3*10^5 pa,so availability_B in KJ=\"),round(availability_B,2)\n", + "print(\"so availability of air in tank B is more than that of tank A\")\n", + "print(\"availability of air in tank A=1.98 KJ\")\n", + "print(\"availability of air in tank B=30.98 KJ\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.3;page no: 221" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.3, Page:221 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\n", + "inlet conditions,\n", + "from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\n", + "outlet conditions,at 0.05 bar and 0.95 dryness fraction\n", + "from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\n", + "so s2= in KJ/kg K= 8.0\n", + "and h2= in KJ/kg= 2440.34\n", + "neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\n", + "w in KJ/kg= 598.06\n", + "power output in KW= 8970.97\n", + "maximum work for given end states,\n", + "w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg 850.43\n", + "w_max in KW 12755.7\n", + "so maximum power output=12755.7 KW\n", + "maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\n", + "A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\n", + "=(h2-ho)+V2^2/2-To(s2-so)\n", + "approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\n", + "from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\n", + "maximum work available from exhaust steam,A_exhaust in KJ/kg\n", + "A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so) 151.1\n", + "maximum power that could be obtained from exhaust steam in KW= 2266.5\n", + "so maximum power from exhaust steam=2266.5 KW\n" + ] + } + ], + "source": [ + "#cal of maximum power output and that could be obtained from exhaust steam\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.3, Page:221 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\")\n", + "m=15;#steam flow rate in kg/s\n", + "V2=160;#exit velocity of steam in m/s\n", + "To=(15+273);#pond water temperature in K\n", + "print(\"inlet conditions,\")\n", + "print(\"from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\")\n", + "h1=3051.2;\n", + "s1=7.1229;\n", + "print(\"outlet conditions,at 0.05 bar and 0.95 dryness fraction\")\n", + "print(\"from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\")\n", + "sf=0.4764;\n", + "s_fg=7.9187;\n", + "x=0.95;\n", + "hf=137.82;\n", + "h_fg=2423.7;\n", + "s2=sf+x*s_fg\n", + "print(\"so s2= in KJ/kg K=\"),round(s2,2)\n", + "h2=hf+x*h_fg\n", + "print(\"and h2= in KJ/kg=\"),round(h2,2)\n", + "print(\"neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\")\n", + "w=(h1-h2)-V2**2*10**-3/2\n", + "print(\"w in KJ/kg=\"),round(w,2)\n", + "print(\"power output in KW=\"),round(m*w,2)\n", + "print(\"maximum work for given end states,\")\n", + "w_max=(h1-To*s1)-(h2+V2**2*10**-3/2-To*s2)\n", + "print(\"w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg\"),round(w_max,2)\n", + "w_max=850.38;#approx.\n", + "w_max=m*w_max\n", + "print(\"w_max in KW\"),round(w_max,2)\n", + "print(\"so maximum power output=12755.7 KW\")\n", + "print(\"maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\")\n", + "print(\"A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\")\n", + "print(\"=(h2-ho)+V2^2/2-To(s2-so)\")\n", + "print(\"approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\")\n", + "print(\"from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\")\n", + "ho=62.99;\n", + "so=0.2245;\n", + "print(\"maximum work available from exhaust steam,A_exhaust in KJ/kg\")\n", + "A_exhaust=(h2-ho)+V2**2*10**-3/2-To*(s2-so)\n", + "A_exhaust=151.1;#approx.\n", + "print(\"A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so)\"),round(A_exhaust,2)\n", + "print(\"maximum power that could be obtained from exhaust steam in KW=\"),round(m*A_exhaust,2)\n", + "print(\"so maximum power from exhaust steam=2266.5 KW\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.4;page no: 222" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.4, Page:222 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\n", + "for dead state of water,\n", + "from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\n", + "for initial state of water,\n", + "from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\n", + "for final state of water,\n", + "from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\n", + "availability at any state can be given by\n", + "A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\n", + "so availability at initial state,A1 in KJ\n", + "A1= 2703.28\n", + "and availability at final state,A2 in KJ\n", + "A2= 1.09\n", + "change in availability,A2-A1 in KJ= -2702.19\n", + "hence availability decreases by 2702.188 KJ\n", + "NOTE=>In this question,due to large calculations,answers are approximately correct.\n" + ] + } + ], + "source": [ + "#cal of availability at initial,final state and also change\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.4, Page:222 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\")\n", + "m=5;#mass of steam in kg\n", + "z1=10;#initial elevation in m\n", + "V1=25;#initial velocity of steam in m/s\n", + "z2=2;#final elevation in m\n", + "V2=10;#final velocity of steam in m/s\n", + "Po=100;#environmental pressure in Kpa\n", + "To=(25+273);#environmental temperature in K\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"for dead state of water,\")\n", + "print(\"from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\")\n", + "uo=104.86;\n", + "vo=1.0029*10**-3;\n", + "so=0.3673;\n", + "print(\"for initial state of water,\")\n", + "print(\"from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\")\n", + "u1=2550;\n", + "v1=0.5089;\n", + "s1=6.93;\n", + "print(\"for final state of water,\")\n", + "print(\"from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\")\n", + "u2=83.94;\n", + "v2=1.0018*10**-3;\n", + "s2=0.2966;\n", + "print(\"availability at any state can be given by\")\n", + "print(\"A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\")\n", + "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+V1**2*10**-3/2+g*z1*10**-3)\n", + "print(\"so availability at initial state,A1 in KJ\")\n", + "print(\"A1=\"),round(A1,2)\n", + "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+V2**2*10**-3/2+g*z2*10**-3)\n", + "print(\"and availability at final state,A2 in KJ\")\n", + "print(\"A2=\"),round(A2,2)\n", + "A2-A1\n", + "print(\"change in availability,A2-A1 in KJ=\"),round(A2-A1,2)\n", + "print(\"hence availability decreases by 2702.188 KJ\")\n", + "print(\"NOTE=>In this question,due to large calculations,answers are approximately correct.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.5;page no: 223" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.5, Page:223 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\n", + "In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.5, Page:223 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\")\n", + "print(\"In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.6;pg no: 223" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.6, Page:223 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\n", + "loss of available energy=irreversibility=To*deltaSc\n", + "deltaSc=deltaSs+deltaSe\n", + "change in enropy of system(deltaSs)=W/T in KJ/kg K 0.98\n", + "change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K -2.8\n", + "loss of available energy(E) in KJ/kg= -550.49\n", + "loss of available energy(E)= -550.49\n", + "ratio of lost available exhaust gas energy to engine work=E/W= 0.524\n" + ] + } + ], + "source": [ + "#cal of available energy and ratio of lost available exhaust gas energy to engine work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.6, Page:223 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\")\n", + "To=(30.+273.);#temperature of surrounding in K\n", + "W=1050.;#work done in engine in KJ/kg\n", + "Cp=1.1;#specific heat at constant pressure in KJ/kg K\n", + "T=(800.+273.);#temperature of exhaust gas in K\n", + "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", + "print(\"deltaSc=deltaSs+deltaSe\")\n", + "deltaSs=W/T\n", + "print(\"change in enropy of system(deltaSs)=W/T in KJ/kg K\"),round(deltaSs,2)\n", + "deltaSe=-Cp*(T-To)/To\n", + "print(\"change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K\"),round(deltaSe,2)\n", + "E=To*(deltaSs+deltaSe)\n", + "print(\"loss of available energy(E) in KJ/kg=\"),round(E,2)\n", + "E=-E\n", + "print(\"loss of available energy(E)=\"),round(-E,2)\n", + "print(\"ratio of lost available exhaust gas energy to engine work=E/W=\"),round(E/W,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.7;pg no: 224" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.7, Page:224 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\n", + "let us consider velocities and elevations to be given in reference to environment.Availability is given by\n", + "A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\n", + "dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\n", + "for initial state of saturated vapour at 150 degree celcius\n", + "from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\n", + "for final state of saturated liquid at 20 degree celcius\n", + "from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\n", + "substituting in the expression for availability\n", + "initial state availability,A1 in KJ\n", + "A1= 5650.31\n", + "final state availability,A2 in KJ\n", + "A2= 2.58\n", + "change in availability,deltaA in KJ= -5647.72\n", + "so initial availability =5650.28 KJ\n", + "final availability=2.58 KJ \n", + "change in availability=decrease by 5647.70 KJ \n" + ] + } + ], + "source": [ + "#cal of initial,final and change in availability\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.7, Page:224 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\")\n", + "m=10;#mass of water in kg\n", + "C1=25;#initial velocity in m/s\n", + "C2=10;#final velocity in m/s\n", + "Po=0.1*1000;#environmental pressure in Kpa\n", + "To=(25+273.15);#environmental temperature in K\n", + "g=9.8;#acceleration due to gravity in m/s^2\n", + "z1=10;#initial elevation in m\n", + "z2=3;#final elevation in m\n", + "print(\"let us consider velocities and elevations to be given in reference to environment.Availability is given by\")\n", + "print(\"A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\")\n", + "print(\"dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\")\n", + "uo=104.88;\n", + "vo=1.003*10**-3;\n", + "so=0.3674;\n", + "print(\"for initial state of saturated vapour at 150 degree celcius\")\n", + "print(\"from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\")\n", + "u1=2559.5;\n", + "v1=0.3928;\n", + "s1=6.8379;\n", + "print(\"for final state of saturated liquid at 20 degree celcius\")\n", + "print(\"from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\")\n", + "u2=83.95;\n", + "v2=0.001002;\n", + "s2=0.2966;\n", + "print(\"substituting in the expression for availability\")\n", + "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+C1**2*10**-3/2+g*z1*10**-3)\n", + "print(\"initial state availability,A1 in KJ\")\n", + "print(\"A1=\"),round(A1,2)\n", + "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+C2**2*10**-3/2+g*z2*10**-3)\n", + "print(\"final state availability,A2 in KJ\")\n", + "print(\"A2=\"),round(A2,2)\n", + "deltaA=A2-A1\n", + "print(\"change in availability,deltaA in KJ=\"),round(deltaA,2)\n", + "print(\"so initial availability =5650.28 KJ\")\n", + "print(\"final availability=2.58 KJ \")\n", + "print(\"change in availability=decrease by 5647.70 KJ \")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.8;pg no: 225" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.8, Page:225 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\n", + "let inlet and exit states of turbine be denoted as 1 and 2\n", + "at inlet to turbine,\n", + "from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\n", + "at exit from turbine,\n", + "from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\n", + "at dead state,\n", + "from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\n", + "availability of steam at inlet,A1 in KJ= 6792.43\n", + "so availability of steam at inlet=6792.43 KJ\n", + "applying first law of thermodynamics,\n", + "Q+m*h1=m*h2+W\n", + "so W in KJ/s= 2829.0\n", + "so turbine output=2829 KW\n", + "maximum possible turbine output will be available when irreversibility is zero.\n", + "W_rev=W_max=A1-A2\n", + "W_max in KJ/s= 3804.82\n", + "so maximum output=3804.81 KW\n", + "irreversibility can be estimated by the difference between the maximum output and turbine output.\n", + "I= in KW= 975.82\n", + "so irreversibility=975.81807 KW\n", + "NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\n" + ] + } + ], + "source": [ + "#cal of availability of steam at inlet,turbine output,maximum possible turbine output,irreversibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.8, Page:225 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\")\n", + "m=5.;#steam flow rate in kg/s\n", + "p1=5.*1000.;#initial pressure of steam in Kpa\n", + "T1=(500.+273.15);#initial temperature of steam in K \n", + "p2=0.2*1000.;#final pressure of steam in Kpa\n", + "T1=(140.+273.15);#final temperature of steam in K\n", + "po=101.3;#pressure of steam at dead state in Kpa\n", + "To=(25.+273.15);#temperature of steam at dead state in K \n", + "Q=600.;#heat loss through turbine in KJ/s\n", + "print(\"let inlet and exit states of turbine be denoted as 1 and 2\")\n", + "print(\"at inlet to turbine,\")\n", + "print(\"from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\")\n", + "h1=3433.8;\n", + "s1=6.9759;\n", + "print(\"at exit from turbine,\")\n", + "print(\"from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\")\n", + "h2=2748;\n", + "s2=7.228;\n", + "print(\"at dead state,\")\n", + "print(\"from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\")\n", + "ho=104.96;\n", + "so=0.3673;\n", + "A1=m*((h1-ho)-To*(s1-so))\n", + "print(\"availability of steam at inlet,A1 in KJ=\"),round(A1,2)\n", + "print(\"so availability of steam at inlet=6792.43 KJ\")\n", + "print(\"applying first law of thermodynamics,\")\n", + "print(\"Q+m*h1=m*h2+W\")\n", + "W=m*(h1-h2)-Q\n", + "print(\"so W in KJ/s=\"),round(W,2)\n", + "print(\"so turbine output=2829 KW\")\n", + "print(\"maximum possible turbine output will be available when irreversibility is zero.\")\n", + "print(\"W_rev=W_max=A1-A2\")\n", + "W_max=m*((h1-h2)-To*(s1-s2))\n", + "print(\"W_max in KJ/s=\"),round(W_max,2)\n", + "print(\"so maximum output=3804.81 KW\")\n", + "print(\"irreversibility can be estimated by the difference between the maximum output and turbine output.\")\n", + "I=W_max-W\n", + "print(\"I= in KW=\"),round(I,2)\n", + "print(\"so irreversibility=975.81807 KW\")\n", + "print(\"NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.9;pg no: 226" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.9, Page:226 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\n", + "In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.9, Page:226 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\")\n", + "print(\"In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.10;pg no: 227" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.10, Page:227 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\n", + "In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.10, Page:227 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\")\n", + "print(\"In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.11;pg no: 227" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.11, Page:227 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\n", + "availability for heat reservoir(A_HR) in KJ/kg K 167.66\n", + "now availability for system(A_system) in KJ/kg K 194.44\n", + "net loss of available energy(A) in KJ/kg K= -26.78\n", + "so loss of available energy=26.77 KJ/kg K\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.11, Page:227 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\")\n", + "To=280.;#surrounding temperature in K\n", + "Q=500.;#heat removed in KJ\n", + "T1=835.;#temperature of reservoir in K\n", + "T2=720.;#temperature of system in K\n", + "A_HR=To*Q/T1\n", + "print(\"availability for heat reservoir(A_HR) in KJ/kg K\"),round(A_HR,2)\n", + "A_system=To*Q/T2\n", + "print(\"now availability for system(A_system) in KJ/kg K\"),round(A_system,2)\n", + "A=A_HR-A_system \n", + "print(\"net loss of available energy(A) in KJ/kg K=\"),round(A,2)\n", + "print(\"so loss of available energy=26.77 KJ/kg K\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.12;pg no: 228" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.12, Page:228 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\n", + "here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\n", + "W_max=W1-W2 in KJ/kg 1647.0\n", + "actual work from turbine,W_actual=h1-h2 in KJ/kg 1557.0\n", + "so actual work=1557 KJ/kg\n", + "maximum possible work=1647 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of actual,maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.12, Page:228 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\")\n", + "h1=4142;#enthalpy at entrance in KJ/kg\n", + "h2=2585;#enthalpy at exit in KJ/kg\n", + "W1=1787;#availability of steam at entrance in KJ/kg\n", + "W2=140;#availability of steam at exit in KJ/kg\n", + "print(\"here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\")\n", + "W_max=W1-W2\n", + "print(\"W_max=W1-W2 in KJ/kg\"),round(W_max,2)\n", + "W_actual=h1-h2\n", + "print(\"actual work from turbine,W_actual=h1-h2 in KJ/kg\"),round(W_actual,2)\n", + "print(\"so actual work=1557 KJ/kg\")\n", + "print(\"maximum possible work=1647 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.13;pg no: 228" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.13, Page:228 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\n", + "reversible engine efficiency,n_rev=1-(T_min/T_max) 0.621\n", + "second law efficiency=n/n_rev 0.4026\n", + "in % 40.26\n" + ] + } + ], + "source": [ + "#cal of second law efficiency\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.13, Page:228 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\")\n", + "T_min=(20.+273.);#minimum temperature reservoir temperature in K\n", + "T_max=(500.+273.);#maximum temperature reservoir temperature in K\n", + "n=0.25;#efficiency of heat engine\n", + "n_rev=1-(T_min/T_max)\n", + "print(\"reversible engine efficiency,n_rev=1-(T_min/T_max)\"),round(n_rev,4)\n", + "n/n_rev\n", + "print(\"second law efficiency=n/n_rev\"),round(n/n_rev,4)\n", + "print(\"in %\"),round(n*100/n_rev,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.14;pg no: 228" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.14, Page:228 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\n", + "expansion occurs in adiabatic conditions.\n", + "temperature after expansion can be obtained by considering adiabatic expansion\n", + "T2/T1=(V1/V2)^(y-1)\n", + "so T2= in K= 489.12\n", + "mass of air,m in kg= 20.91\n", + "change in entropy of control system,deltaSs=(S2-S1) in KJ/K= -0.0\n", + "here,there is no change in entropy of environment,deltaSe=0\n", + "total entropy change of combined system=deltaSc in KJ/K= -0.0\n", + "loss of available energy(E)=irreversibility in KJ= -0.603\n", + "so loss of available energy,E=0.603 KJ\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.14, Page:228 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\")\n", + "V_A=6.;#volume of compartment A in m^3\n", + "V_B=4.;#volume of compartment B in m^3\n", + "To=300.;#temperature of atmosphere in K\n", + "Po=1.*10**5;#atmospheric pressure in pa\n", + "P1=6.*10**5;#initial pressure in pa\n", + "T1=600.;#initial temperature in K\n", + "V1=V_A;#initial volume in m^3\n", + "V2=(V_A+V_B);#final volume in m^3\n", + "y=1.4;#expansion constant \n", + "R=287.;#gas constant in J/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "print(\"expansion occurs in adiabatic conditions.\")\n", + "print(\"temperature after expansion can be obtained by considering adiabatic expansion\")\n", + "T2=T1*(V1/V2)**(y-1)\n", + "print(\"T2/T1=(V1/V2)^(y-1)\")\n", + "print(\"so T2= in K=\"),round(T2,2)\n", + "T2=489.12;#approx.\n", + "m=(P1*V1)/(R*T1)\n", + "print(\"mass of air,m in kg=\"),round(m,2)\n", + "m=20.91;#approx.\n", + "deltaSs=m*Cv*math.log(T2/T1)+m*R*10**-3*math.log(V2/V1)\n", + "print(\"change in entropy of control system,deltaSs=(S2-S1) in KJ/K=\"),round(deltaSs,2)\n", + "print(\"here,there is no change in entropy of environment,deltaSe=0\")\n", + "deltaSe=0;\n", + "deltaSc=deltaSs+deltaSe\n", + "print(\"total entropy change of combined system=deltaSc in KJ/K=\"),round(deltaSc,2)\n", + "E=To*deltaSc\n", + "print(\"loss of available energy(E)=irreversibility in KJ=\"),round(E,3)\n", + "print(\"so loss of available energy,E=0.603 KJ\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.15;pg no: 229" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.15, Page:229 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\n", + "In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#cal of maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.15, Page:229 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\")\n", + "print(\"In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.16;pg no: 230" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.16, Page:230 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\n", + "availability or reversible work,W_rev=n_rev*Q1 in KJ/min 229.53\n", + "rate of irreversibility,I=W_rev-W_useful in KJ/sec 99.53\n", + "second law efficiency=W_useful/W_rev 0.57\n", + "in percentage 56.64\n", + "so availability=1.38*10^4 KJ/min\n", + "and rate of irreversibility=100 KW,second law efficiency=56.63 %\n", + "NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\n" + ] + } + ], + "source": [ + "#cal of availability,rate of irreversibility and second law efficiency\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.16, Page:230 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\")\n", + "To=(17.+273.);#temperature of surrounding in K\n", + "T1=(700.+273.);#temperature of high temperature reservoir in K\n", + "T2=(30.+273.);#temperature of low temperature reservoir in K\n", + "Q1=2.*10**4;#rate of heat receive in KJ/min\n", + "W_useful=0.13*10**3;#output of engine in KW\n", + "n_rev=(1-T2/T1);\n", + "W_rev=n_rev*Q1\n", + "W_rev=W_rev/60.;#W_rev in KJ/s\n", + "print(\"availability or reversible work,W_rev=n_rev*Q1 in KJ/min\"),round(W_rev,2)\n", + "I=W_rev-W_useful\n", + "print(\"rate of irreversibility,I=W_rev-W_useful in KJ/sec\"),round(I,2)\n", + "W_useful/W_rev\n", + "print(\"second law efficiency=W_useful/W_rev\"),round(W_useful/W_rev,2)\n", + "W_useful*100/W_rev\n", + "print(\"in percentage\"),round(W_useful*100/W_rev,2)\n", + "print(\"so availability=1.38*10^4 KJ/min\")\n", + "print(\"and rate of irreversibility=100 KW,second law efficiency=56.63 %\")\n", + "print(\"NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.17;pg no: 230" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.17, Page:230 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\n", + "loss of available energy=irreversibility=To*deltaSc\n", + "deltaSc=deltaSs+deltaSe\n", + "change in entropy of system=deltaSs\n", + "change in entropy of environment/surroundings=deltaSe\n", + "here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\n", + "P1/T1=P2/T2\n", + "so T2 in K= 555.0\n", + "heat addition to air in tank\n", + "Q in KJ/kg= 223.11\n", + "deltaSs in KJ/kg K= 0.67\n", + "deltaSe in KJ/kg K= -0.33\n", + "and deltaSc in KJ/kg K= 0.34\n", + "so loss of available energy(E)in KJ/kg= 101.55\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.17, Page:230 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\")\n", + "To=(27+273);#temperature of surrounding in K\n", + "T1=(60+273);#initial temperature of air in K\n", + "P1=1.5*10**5;#initial pressure of air in pa\n", + "P2=2.5*10**5;#final pressure of air in pa\n", + "T_reservoir=(400+273);#temperature of reservoir in K\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", + "print(\"deltaSc=deltaSs+deltaSe\")\n", + "print(\"change in entropy of system=deltaSs\")\n", + "print(\"change in entropy of environment/surroundings=deltaSe\")\n", + "print(\"here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\")\n", + "print(\"P1/T1=P2/T2\")\n", + "T2=P2*T1/P1\n", + "print(\"so T2 in K=\"),round(T2,2)\n", + "print(\"heat addition to air in tank\")\n", + "deltaT=T2-T1;\n", + "Q=Cp*deltaT\n", + "print(\"Q in KJ/kg=\"),round(Q,2)\n", + "deltaSs=Q/T1\n", + "print(\"deltaSs in KJ/kg K=\"),round(deltaSs,2)\n", + "deltaSe=-Q/T_reservoir\n", + "print(\"deltaSe in KJ/kg K=\"),round(deltaSe,2)\n", + "deltaSc=deltaSs+deltaSe\n", + "print(\"and deltaSc in KJ/kg K=\"),round(deltaSc,2)\n", + "E=To*deltaSc\n", + "print(\"so loss of available energy(E)in KJ/kg=\"),round(E,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.18;pg no: 231" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.18, Page:231 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\n", + "In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.18, Page:231 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\")\n", + "print(\"In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.19;pg no: 232" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.19, Page:232 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\n", + "clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\n", + "from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\n", + "v_fg in m^3/kg= 0.0\n", + "let us approximate,\n", + "(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\n", + "here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\n", + "substituting in clapeyron equation,\n", + "h_fg in KJ/kg 1941.25\n", + "so calculated enthalpy of vaporisation=1941.25 KJ/kg\n", + "and enthalpy of vaporisation from steam table=1940.7 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of enthalpy of vaporisation\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.19, Page:232 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\")\n", + "T=(200+273);#temperature of water in K\n", + "print(\"clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\")\n", + "print(\"from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\")\n", + "vg=0.12736;\n", + "vf=0.001157;\n", + "v_fg=(vg-vf)\n", + "print(\"v_fg in m^3/kg=\"),round(v_fg)\n", + "print(\"let us approximate,\")\n", + "print(\"(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\")\n", + "print(\"here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\")\n", + "P_205oc=1.7230;#pressure at 205 degree celcius in Mpa\n", + "P_195oc=1.3978;#pressure at 195 degree celcius in Mpa\n", + "(P_205oc-P_195oc)/(205-195)\n", + "print(\"substituting in clapeyron equation,\")\n", + "h_fg=T*v_fg*(P_205oc-P_195oc)*1000/(205-195)\n", + "print(\"h_fg in KJ/kg\"),round(h_fg,2)\n", + "print(\"so calculated enthalpy of vaporisation=1941.25 KJ/kg\")\n", + "print(\"and enthalpy of vaporisation from steam table=1940.7 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.20;pg no: 232" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.20, Page:232 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\n", + "by clapeyron equation\n", + "h_fg=T2*v_fg*(do/dT)_sat \n", + "h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\n", + "by clapeyron-clausius equation,\n", + "log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\n", + "log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\n", + "so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\n", + "% deviation from clapeyron equation in % 6.44\n", + "h_fg by clapeyron equation=159.49 KJ/kg\n", + "h_fg by clapeyron-clausius equation=169.76 KJ/kg\n", + "% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.20, Page:232 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\")\n", + "P2=260.96;#saturation pressure at -5 degree celcius\n", + "P1=182.60;#saturation pressure at -15 degree celcius\n", + "vg=0.07665;#specific volume of gas at -10 degree celcius in m^3/kg\n", + "vf=0.00070#specific volume at -10 degree celcius in m^3/kg\n", + "R=0.06876;#gas constant in KJ/kg K\n", + "h_fg=156.3;#enthalpy in KJ/kg K\n", + "T2=(-5.+273.);#temperature in K\n", + "T1=(-15.+273.);#temperature in K\n", + "print(\"by clapeyron equation\")\n", + "print(\"h_fg=T2*v_fg*(do/dT)_sat \")\n", + "print(\"h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\")\n", + "h_fg=T2*(vg-vf)*(P1-P2)/(T1-T2)\n", + "print(\"by clapeyron-clausius equation,\")\n", + "print(\"log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\")\n", + "print(\"log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\")\n", + "print(\"so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\")\n", + "h_fg=math.log(P2/P1)*R/((1/T1)-(1/T2))\n", + "print(\"% deviation from clapeyron equation in %\"),round((169.76-159.49)*100/159.49,2)\n", + "print(\"h_fg by clapeyron equation=159.49 KJ/kg\")\n", + "print(\"h_fg by clapeyron-clausius equation=169.76 KJ/kg\")\n", + "print(\"% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.21;pg no: 233" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 15)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m15\u001b[0m\n\u001b[1;33m volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "source": [ + "#cal of volume expansivity and isothermal compressibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.21, Page:233 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 21\")\n", + "print(\"volume expansion=(1/v)*(dv/dT)_P\")\n", + "print(\"isothermal compressibility=-(1/v)*(dv/dp)_T\")\n", + "print(\"let us write dv/dT=deltav/deltaT and dv/dP=deltav/deltaP.The difference may be taken for small pressure and temperature changes.\")\n", + "print(\"volume expansivity in K^-1,\")\n", + "print(\"=(1/v)*(dv/dT)_300Kpa\")\n", + "v_300Kpa_300oc=0.8753;#specific volume at 300Kpa and 300 degree celcius\n", + "v_350oc=0.9534;#specific volume 350 degree celcius\n", + "v_250oc=0.7964;#specific volume 250 degree celcius\n", + "volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\n", + "print(\"volume expansivity in Kpa\"),round(volume expansivity,2)\n", + "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350oc=0.9534 in m^3/kg,v_250oc=0.7964 in m^3/kg\")\n", + "print(\"volume expansivity=1.7937*10^-3 K^-1\")\n", + "isothermal=(-1/v_300Kpa_300oc)*(v_350Kpa-v_250Kpa)/(350-250)\n", + "print(\"isothermal compressibility in Kpa^-1\")\n", + "print(\"isothermal compressibility\"),round(isothermal compressibility,2)\n", + "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350Kpa=0.76505 in m^3/kg,v_250Kpa=1.09575 in m^3/kg\")\n", + "v_350Kpa=0.76505;#specific volume 350 Kpa\n", + "v_250Kpa=1.09575;#specific volume 250 Kpa\n", + "print(\"so isothermal compressibility=3.778*10^-3 Kpa^-1\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.22;pg no: 234" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.22, Page:234 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\n", + "filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\n", + "hi=uf\n", + "Cp*Ti=Cv*Tf\n", + "so Tf=Cp*Ti/Cv in K 417.33\n", + "inside final temperature,Tf=417.33 K\n", + "change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K= 0.338\n", + "Cp*log(Tf/Ti)+0\n", + "change in entropy,deltaS_gen=0.3379 KJ/kg K\n", + "irreversibility,I in KJ/kg= 100.76\n", + "irreversibility,I=100.74 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of inside final temperature,change in entropy and irreversibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.22, Page:234 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\")\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "Ti=(25+273.15);#atmospheric temperature in K\n", + "print(\"filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\")\n", + "print(\"hi=uf\")\n", + "print(\"Cp*Ti=Cv*Tf\")\n", + "Tf=Cp*Ti/Cv\n", + "print(\"so Tf=Cp*Ti/Cv in K\"),round(Tf,2)\n", + "print(\"inside final temperature,Tf=417.33 K\")\n", + "deltaS_gen=Cp*math.log(Tf/Ti)\n", + "print(\"change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K=\"),round(deltaS_gen,4)\n", + "print(\"Cp*log(Tf/Ti)+0\")\n", + "print(\"change in entropy,deltaS_gen=0.3379 KJ/kg K\")\n", + "To=Ti;\n", + "I=To*deltaS_gen\n", + "print(\"irreversibility,I in KJ/kg=\"),round(I,2)\n", + "print(\"irreversibility,I=100.74 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.23;pg no: 234" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.23, Page:234 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\n", + "here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\n", + "therefore,d(E-To-S)/dt=W_max\n", + "or W_max=(E-To-S)1-(E-To-S)2\n", + "here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\n", + "therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\n", + "so maximum work in KJ= 40946.6\n" + ] + } + ], + "source": [ + "#cal of maximum work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.23, Page:234 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\")\n", + "m=75.;#mass of hot water in kg\n", + "T1=(400.+273.);#temperature of hot water in K\n", + "T2=(27.+273.);#temperature of environment in K\n", + "Cp=4.18;#specific heat of water in KJ/kg K\n", + "print(\"here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\")\n", + "print(\"therefore,d(E-To-S)/dt=W_max\")\n", + "print(\"or W_max=(E-To-S)1-(E-To-S)2\")\n", + "print(\"here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\")\n", + "print(\"therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\")\n", + "To=T2;\n", + "W_max=m*Cp*(T1-T2)-To*m*Cp*math.log(T1/T2)\n", + "print(\"so maximum work in KJ=\"),round(W_max,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.24;pg no: 235" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.24, Page:235 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\n", + "from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\n", + "inlet stream availability in KJ/kg= 1587.19\n", + "input stream availability is equal to the input absolute availability.\n", + "exit stream availaability in KJ/kg 238.69\n", + "exit stream availability is equal to the exit absolute availability.\n", + "W_rev in KJ/kg\n", + "irreversibility=W_rev-W in KJ/kg 348.49\n", + "this irreversibility is in fact the availability loss.\n", + "inlet stream availability=1587.18 KJ/kg\n", + "exit stream availability=238.69 KJ/kg\n", + "irreversibility=348.49 KJ/kg\n", + "NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \n" + ] + } + ], + "source": [ + "#cal of inlet stream availability,exit stream availability and irreversibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.24, Page:235 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\")\n", + "C1=150;#steam entering velocity in m/s\n", + "C2=50;#steam leaving velocity in m/s\n", + "To=(15+273);#dead state temperature in K\n", + "W=1000;#expansion work in KJ/kg\n", + "print(\"from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\")\n", + "h1=3666.5;\n", + "s1=7.2589;\n", + "h2=2584.7;\n", + "s2=8.1502;\n", + "(h1+C1**2*10**-3/2)-To*s1\n", + "print(\"inlet stream availability in KJ/kg=\"),round((h1+C1**2*10**-3/2)-To*s1,2)\n", + "(h2+C2**2*10**-3/2)-To*s2\n", + "print(\"input stream availability is equal to the input absolute availability.\")\n", + "print(\"exit stream availaability in KJ/kg\"),round((h2+C2**2*10**-3/2)-To*s2,2)\n", + "print(\"exit stream availability is equal to the exit absolute availability.\")\n", + "print(\"W_rev in KJ/kg\")\n", + "W_rev=1587.18-238.69\n", + "W_rev-W\n", + "print(\"irreversibility=W_rev-W in KJ/kg\"),round(W_rev-W,2)\n", + "print(\"this irreversibility is in fact the availability loss.\")\n", + "print(\"inlet stream availability=1587.18 KJ/kg\")\n", + "print(\"exit stream availability=238.69 KJ/kg\")\n", + "print(\"irreversibility=348.49 KJ/kg\")\n", + "print(\"NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter7.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter7.ipynb new file mode 100755 index 00000000..ef30a163 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter7.ipynb @@ -0,0 +1,1452 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7:Availability and General Thermodynamic Relation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.1;page no: 218" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.1, Page:218 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\n", + "let us neglect the potential energy change during the flow.\n", + "applying S.F.E.E,neglecting inlet velocity and change in potential energy,\n", + "W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\n", + "W_max=(h1-h2)-To*(s1-s2)-C2^2/2\n", + "from steam tables,\n", + "h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\n", + "given To=288 K\n", + "so W_max in KJ/kg= 457.1\n", + "maximum possible work(W_max) in KW= 1142.76\n" + ] + } + ], + "source": [ + "#cal of maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.1, Page:218 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\")\n", + "C2=150;#leave velocity of steam in m/s\n", + "m=2.5;#steam mass flow rate in kg/s\n", + "print(\"let us neglect the potential energy change during the flow.\")\n", + "print(\"applying S.F.E.E,neglecting inlet velocity and change in potential energy,\")\n", + "print(\"W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\")\n", + "print(\"W_max=(h1-h2)-To*(s1-s2)-C2^2/2\")\n", + "print(\"from steam tables,\")\n", + "print(\"h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\")\n", + "h1=3034.8;\n", + "s1=6.8844;\n", + "h2=2776.4;\n", + "s2=7.6134;\n", + "print(\"given To=288 K\")\n", + "To=288;\n", + "W_max=(h1-h2)-To*(s1-s2)-(C2**2/2*10**-3)\n", + "print(\"so W_max in KJ/kg=\"),round(W_max,2)\n", + "W_max=m*W_max\n", + "print(\"maximum possible work(W_max) in KW=\"),round(W_max,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.2;page no: 219" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.2, Page:219 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\n", + "In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\n", + "BOTH THE TANKS HAVE SAME INTERNAL ENERGY\n", + "availability of air in tank,A\n", + "A=(E-Uo)+Po*(V-Vo)-To*(S-So)\n", + "=m*{(e-uo)+Po(v-vo)-To(s-so)}\n", + "m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\n", + "so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\n", + "for tank A,P in pa,so availability_A in KJ= 1.98\n", + "for tank B,P=3*10^5 pa,so availability_B in KJ= 30.98\n", + "so availability of air in tank B is more than that of tank A\n", + "availability of air in tank A=1.98 KJ\n", + "availability of air in tank B=30.98 KJ\n" + ] + } + ], + "source": [ + "#cal of availability of air in tank A,B\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.2, Page:219 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\")\n", + "m=1.;#mass of air in kg\n", + "Po=1.*10**5;#atmospheric pressure in pa\n", + "To=(15.+273.);#temperature of atmosphere in K\n", + "Cv=0.717;#specific heat at constant volume in KJ/kg K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", + "T=(50.+273.);#temperature of tanks A and B in K\n", + "print(\"In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\")\n", + "print(\"BOTH THE TANKS HAVE SAME INTERNAL ENERGY\")\n", + "print(\"availability of air in tank,A\")\n", + "print(\"A=(E-Uo)+Po*(V-Vo)-To*(S-So)\")\n", + "print(\"=m*{(e-uo)+Po(v-vo)-To(s-so)}\")\n", + "print(\"m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\")\n", + "print(\"so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\")\n", + "P=1.*10**5;#pressure in tank A in pa\n", + "availability_A=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", + "print(\"for tank A,P in pa,so availability_A in KJ=\"),round(availability_A,2)\n", + "P=3.*10**5;#pressure in tank B in pa\n", + "availability_B=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", + "print(\"for tank B,P=3*10^5 pa,so availability_B in KJ=\"),round(availability_B,2)\n", + "print(\"so availability of air in tank B is more than that of tank A\")\n", + "print(\"availability of air in tank A=1.98 KJ\")\n", + "print(\"availability of air in tank B=30.98 KJ\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.3;page no: 221" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.3, Page:221 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\n", + "inlet conditions,\n", + "from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\n", + "outlet conditions,at 0.05 bar and 0.95 dryness fraction\n", + "from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\n", + "so s2= in KJ/kg K= 8.0\n", + "and h2= in KJ/kg= 2440.34\n", + "neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\n", + "w in KJ/kg= 598.06\n", + "power output in KW= 8970.97\n", + "maximum work for given end states,\n", + "w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg 850.43\n", + "w_max in KW 12755.7\n", + "so maximum power output=12755.7 KW\n", + "maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\n", + "A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\n", + "=(h2-ho)+V2^2/2-To(s2-so)\n", + "approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\n", + "from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\n", + "maximum work available from exhaust steam,A_exhaust in KJ/kg\n", + "A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so) 151.1\n", + "maximum power that could be obtained from exhaust steam in KW= 2266.5\n", + "so maximum power from exhaust steam=2266.5 KW\n" + ] + } + ], + "source": [ + "#cal of maximum power output and that could be obtained from exhaust steam\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.3, Page:221 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\")\n", + "m=15;#steam flow rate in kg/s\n", + "V2=160;#exit velocity of steam in m/s\n", + "To=(15+273);#pond water temperature in K\n", + "print(\"inlet conditions,\")\n", + "print(\"from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\")\n", + "h1=3051.2;\n", + "s1=7.1229;\n", + "print(\"outlet conditions,at 0.05 bar and 0.95 dryness fraction\")\n", + "print(\"from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\")\n", + "sf=0.4764;\n", + "s_fg=7.9187;\n", + "x=0.95;\n", + "hf=137.82;\n", + "h_fg=2423.7;\n", + "s2=sf+x*s_fg\n", + "print(\"so s2= in KJ/kg K=\"),round(s2,2)\n", + "h2=hf+x*h_fg\n", + "print(\"and h2= in KJ/kg=\"),round(h2,2)\n", + "print(\"neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\")\n", + "w=(h1-h2)-V2**2*10**-3/2\n", + "print(\"w in KJ/kg=\"),round(w,2)\n", + "print(\"power output in KW=\"),round(m*w,2)\n", + "print(\"maximum work for given end states,\")\n", + "w_max=(h1-To*s1)-(h2+V2**2*10**-3/2-To*s2)\n", + "print(\"w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg\"),round(w_max,2)\n", + "w_max=850.38;#approx.\n", + "w_max=m*w_max\n", + "print(\"w_max in KW\"),round(w_max,2)\n", + "print(\"so maximum power output=12755.7 KW\")\n", + "print(\"maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\")\n", + "print(\"A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\")\n", + "print(\"=(h2-ho)+V2^2/2-To(s2-so)\")\n", + "print(\"approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\")\n", + "print(\"from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\")\n", + "ho=62.99;\n", + "so=0.2245;\n", + "print(\"maximum work available from exhaust steam,A_exhaust in KJ/kg\")\n", + "A_exhaust=(h2-ho)+V2**2*10**-3/2-To*(s2-so)\n", + "A_exhaust=151.1;#approx.\n", + "print(\"A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so)\"),round(A_exhaust,2)\n", + "print(\"maximum power that could be obtained from exhaust steam in KW=\"),round(m*A_exhaust,2)\n", + "print(\"so maximum power from exhaust steam=2266.5 KW\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.4;page no: 222" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.4, Page:222 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\n", + "for dead state of water,\n", + "from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\n", + "for initial state of water,\n", + "from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\n", + "for final state of water,\n", + "from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\n", + "availability at any state can be given by\n", + "A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\n", + "so availability at initial state,A1 in KJ\n", + "A1= 2703.28\n", + "and availability at final state,A2 in KJ\n", + "A2= 1.09\n", + "change in availability,A2-A1 in KJ= -2702.19\n", + "hence availability decreases by 2702.188 KJ\n", + "NOTE=>In this question,due to large calculations,answers are approximately correct.\n" + ] + } + ], + "source": [ + "#cal of availability at initial,final state and also change\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.4, Page:222 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\")\n", + "m=5;#mass of steam in kg\n", + "z1=10;#initial elevation in m\n", + "V1=25;#initial velocity of steam in m/s\n", + "z2=2;#final elevation in m\n", + "V2=10;#final velocity of steam in m/s\n", + "Po=100;#environmental pressure in Kpa\n", + "To=(25+273);#environmental temperature in K\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"for dead state of water,\")\n", + "print(\"from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\")\n", + "uo=104.86;\n", + "vo=1.0029*10**-3;\n", + "so=0.3673;\n", + "print(\"for initial state of water,\")\n", + "print(\"from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\")\n", + "u1=2550;\n", + "v1=0.5089;\n", + "s1=6.93;\n", + "print(\"for final state of water,\")\n", + "print(\"from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\")\n", + "u2=83.94;\n", + "v2=1.0018*10**-3;\n", + "s2=0.2966;\n", + "print(\"availability at any state can be given by\")\n", + "print(\"A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\")\n", + "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+V1**2*10**-3/2+g*z1*10**-3)\n", + "print(\"so availability at initial state,A1 in KJ\")\n", + "print(\"A1=\"),round(A1,2)\n", + "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+V2**2*10**-3/2+g*z2*10**-3)\n", + "print(\"and availability at final state,A2 in KJ\")\n", + "print(\"A2=\"),round(A2,2)\n", + "A2-A1\n", + "print(\"change in availability,A2-A1 in KJ=\"),round(A2-A1,2)\n", + "print(\"hence availability decreases by 2702.188 KJ\")\n", + "print(\"NOTE=>In this question,due to large calculations,answers are approximately correct.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.5;page no: 223" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.5, Page:223 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\n", + "In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.5, Page:223 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\")\n", + "print(\"In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.6;pg no: 223" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.6, Page:223 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\n", + "loss of available energy=irreversibility=To*deltaSc\n", + "deltaSc=deltaSs+deltaSe\n", + "change in enropy of system(deltaSs)=W/T in KJ/kg K 0.98\n", + "change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K -2.8\n", + "loss of available energy(E) in KJ/kg= -550.49\n", + "loss of available energy(E)= -550.49\n", + "ratio of lost available exhaust gas energy to engine work=E/W= 0.524\n" + ] + } + ], + "source": [ + "#cal of available energy and ratio of lost available exhaust gas energy to engine work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.6, Page:223 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\")\n", + "To=(30.+273.);#temperature of surrounding in K\n", + "W=1050.;#work done in engine in KJ/kg\n", + "Cp=1.1;#specific heat at constant pressure in KJ/kg K\n", + "T=(800.+273.);#temperature of exhaust gas in K\n", + "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", + "print(\"deltaSc=deltaSs+deltaSe\")\n", + "deltaSs=W/T\n", + "print(\"change in enropy of system(deltaSs)=W/T in KJ/kg K\"),round(deltaSs,2)\n", + "deltaSe=-Cp*(T-To)/To\n", + "print(\"change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K\"),round(deltaSe,2)\n", + "E=To*(deltaSs+deltaSe)\n", + "print(\"loss of available energy(E) in KJ/kg=\"),round(E,2)\n", + "E=-E\n", + "print(\"loss of available energy(E)=\"),round(-E,2)\n", + "print(\"ratio of lost available exhaust gas energy to engine work=E/W=\"),round(E/W,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.7;pg no: 224" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.7, Page:224 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\n", + "let us consider velocities and elevations to be given in reference to environment.Availability is given by\n", + "A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\n", + "dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\n", + "for initial state of saturated vapour at 150 degree celcius\n", + "from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\n", + "for final state of saturated liquid at 20 degree celcius\n", + "from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\n", + "substituting in the expression for availability\n", + "initial state availability,A1 in KJ\n", + "A1= 5650.31\n", + "final state availability,A2 in KJ\n", + "A2= 2.58\n", + "change in availability,deltaA in KJ= -5647.72\n", + "so initial availability =5650.28 KJ\n", + "final availability=2.58 KJ \n", + "change in availability=decrease by 5647.70 KJ \n" + ] + } + ], + "source": [ + "#cal of initial,final and change in availability\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.7, Page:224 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\")\n", + "m=10;#mass of water in kg\n", + "C1=25;#initial velocity in m/s\n", + "C2=10;#final velocity in m/s\n", + "Po=0.1*1000;#environmental pressure in Kpa\n", + "To=(25+273.15);#environmental temperature in K\n", + "g=9.8;#acceleration due to gravity in m/s^2\n", + "z1=10;#initial elevation in m\n", + "z2=3;#final elevation in m\n", + "print(\"let us consider velocities and elevations to be given in reference to environment.Availability is given by\")\n", + "print(\"A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\")\n", + "print(\"dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\")\n", + "uo=104.88;\n", + "vo=1.003*10**-3;\n", + "so=0.3674;\n", + "print(\"for initial state of saturated vapour at 150 degree celcius\")\n", + "print(\"from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\")\n", + "u1=2559.5;\n", + "v1=0.3928;\n", + "s1=6.8379;\n", + "print(\"for final state of saturated liquid at 20 degree celcius\")\n", + "print(\"from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\")\n", + "u2=83.95;\n", + "v2=0.001002;\n", + "s2=0.2966;\n", + "print(\"substituting in the expression for availability\")\n", + "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+C1**2*10**-3/2+g*z1*10**-3)\n", + "print(\"initial state availability,A1 in KJ\")\n", + "print(\"A1=\"),round(A1,2)\n", + "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+C2**2*10**-3/2+g*z2*10**-3)\n", + "print(\"final state availability,A2 in KJ\")\n", + "print(\"A2=\"),round(A2,2)\n", + "deltaA=A2-A1\n", + "print(\"change in availability,deltaA in KJ=\"),round(deltaA,2)\n", + "print(\"so initial availability =5650.28 KJ\")\n", + "print(\"final availability=2.58 KJ \")\n", + "print(\"change in availability=decrease by 5647.70 KJ \")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.8;pg no: 225" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.8, Page:225 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\n", + "let inlet and exit states of turbine be denoted as 1 and 2\n", + "at inlet to turbine,\n", + "from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\n", + "at exit from turbine,\n", + "from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\n", + "at dead state,\n", + "from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\n", + "availability of steam at inlet,A1 in KJ= 6792.43\n", + "so availability of steam at inlet=6792.43 KJ\n", + "applying first law of thermodynamics,\n", + "Q+m*h1=m*h2+W\n", + "so W in KJ/s= 2829.0\n", + "so turbine output=2829 KW\n", + "maximum possible turbine output will be available when irreversibility is zero.\n", + "W_rev=W_max=A1-A2\n", + "W_max in KJ/s= 3804.82\n", + "so maximum output=3804.81 KW\n", + "irreversibility can be estimated by the difference between the maximum output and turbine output.\n", + "I= in KW= 975.82\n", + "so irreversibility=975.81807 KW\n", + "NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\n" + ] + } + ], + "source": [ + "#cal of availability of steam at inlet,turbine output,maximum possible turbine output,irreversibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.8, Page:225 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\")\n", + "m=5.;#steam flow rate in kg/s\n", + "p1=5.*1000.;#initial pressure of steam in Kpa\n", + "T1=(500.+273.15);#initial temperature of steam in K \n", + "p2=0.2*1000.;#final pressure of steam in Kpa\n", + "T1=(140.+273.15);#final temperature of steam in K\n", + "po=101.3;#pressure of steam at dead state in Kpa\n", + "To=(25.+273.15);#temperature of steam at dead state in K \n", + "Q=600.;#heat loss through turbine in KJ/s\n", + "print(\"let inlet and exit states of turbine be denoted as 1 and 2\")\n", + "print(\"at inlet to turbine,\")\n", + "print(\"from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\")\n", + "h1=3433.8;\n", + "s1=6.9759;\n", + "print(\"at exit from turbine,\")\n", + "print(\"from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\")\n", + "h2=2748;\n", + "s2=7.228;\n", + "print(\"at dead state,\")\n", + "print(\"from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\")\n", + "ho=104.96;\n", + "so=0.3673;\n", + "A1=m*((h1-ho)-To*(s1-so))\n", + "print(\"availability of steam at inlet,A1 in KJ=\"),round(A1,2)\n", + "print(\"so availability of steam at inlet=6792.43 KJ\")\n", + "print(\"applying first law of thermodynamics,\")\n", + "print(\"Q+m*h1=m*h2+W\")\n", + "W=m*(h1-h2)-Q\n", + "print(\"so W in KJ/s=\"),round(W,2)\n", + "print(\"so turbine output=2829 KW\")\n", + "print(\"maximum possible turbine output will be available when irreversibility is zero.\")\n", + "print(\"W_rev=W_max=A1-A2\")\n", + "W_max=m*((h1-h2)-To*(s1-s2))\n", + "print(\"W_max in KJ/s=\"),round(W_max,2)\n", + "print(\"so maximum output=3804.81 KW\")\n", + "print(\"irreversibility can be estimated by the difference between the maximum output and turbine output.\")\n", + "I=W_max-W\n", + "print(\"I= in KW=\"),round(I,2)\n", + "print(\"so irreversibility=975.81807 KW\")\n", + "print(\"NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.9;pg no: 226" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.9, Page:226 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\n", + "In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.9, Page:226 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\")\n", + "print(\"In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.10;pg no: 227" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.10, Page:227 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\n", + "In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.10, Page:227 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\")\n", + "print(\"In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.11;pg no: 227" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.11, Page:227 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\n", + "availability for heat reservoir(A_HR) in KJ/kg K 167.66\n", + "now availability for system(A_system) in KJ/kg K 194.44\n", + "net loss of available energy(A) in KJ/kg K= -26.78\n", + "so loss of available energy=26.77 KJ/kg K\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.11, Page:227 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\")\n", + "To=280.;#surrounding temperature in K\n", + "Q=500.;#heat removed in KJ\n", + "T1=835.;#temperature of reservoir in K\n", + "T2=720.;#temperature of system in K\n", + "A_HR=To*Q/T1\n", + "print(\"availability for heat reservoir(A_HR) in KJ/kg K\"),round(A_HR,2)\n", + "A_system=To*Q/T2\n", + "print(\"now availability for system(A_system) in KJ/kg K\"),round(A_system,2)\n", + "A=A_HR-A_system \n", + "print(\"net loss of available energy(A) in KJ/kg K=\"),round(A,2)\n", + "print(\"so loss of available energy=26.77 KJ/kg K\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.12;pg no: 228" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.12, Page:228 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\n", + "here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\n", + "W_max=W1-W2 in KJ/kg 1647.0\n", + "actual work from turbine,W_actual=h1-h2 in KJ/kg 1557.0\n", + "so actual work=1557 KJ/kg\n", + "maximum possible work=1647 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of actual,maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.12, Page:228 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\")\n", + "h1=4142;#enthalpy at entrance in KJ/kg\n", + "h2=2585;#enthalpy at exit in KJ/kg\n", + "W1=1787;#availability of steam at entrance in KJ/kg\n", + "W2=140;#availability of steam at exit in KJ/kg\n", + "print(\"here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\")\n", + "W_max=W1-W2\n", + "print(\"W_max=W1-W2 in KJ/kg\"),round(W_max,2)\n", + "W_actual=h1-h2\n", + "print(\"actual work from turbine,W_actual=h1-h2 in KJ/kg\"),round(W_actual,2)\n", + "print(\"so actual work=1557 KJ/kg\")\n", + "print(\"maximum possible work=1647 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.13;pg no: 228" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.13, Page:228 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\n", + "reversible engine efficiency,n_rev=1-(T_min/T_max) 0.621\n", + "second law efficiency=n/n_rev 0.4026\n", + "in % 40.26\n" + ] + } + ], + "source": [ + "#cal of second law efficiency\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.13, Page:228 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\")\n", + "T_min=(20.+273.);#minimum temperature reservoir temperature in K\n", + "T_max=(500.+273.);#maximum temperature reservoir temperature in K\n", + "n=0.25;#efficiency of heat engine\n", + "n_rev=1-(T_min/T_max)\n", + "print(\"reversible engine efficiency,n_rev=1-(T_min/T_max)\"),round(n_rev,4)\n", + "n/n_rev\n", + "print(\"second law efficiency=n/n_rev\"),round(n/n_rev,4)\n", + "print(\"in %\"),round(n*100/n_rev,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.14;pg no: 228" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.14, Page:228 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\n", + "expansion occurs in adiabatic conditions.\n", + "temperature after expansion can be obtained by considering adiabatic expansion\n", + "T2/T1=(V1/V2)^(y-1)\n", + "so T2= in K= 489.12\n", + "mass of air,m in kg= 20.91\n", + "change in entropy of control system,deltaSs=(S2-S1) in KJ/K= -0.0\n", + "here,there is no change in entropy of environment,deltaSe=0\n", + "total entropy change of combined system=deltaSc in KJ/K= -0.0\n", + "loss of available energy(E)=irreversibility in KJ= -0.603\n", + "so loss of available energy,E=0.603 KJ\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.14, Page:228 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\")\n", + "V_A=6.;#volume of compartment A in m^3\n", + "V_B=4.;#volume of compartment B in m^3\n", + "To=300.;#temperature of atmosphere in K\n", + "Po=1.*10**5;#atmospheric pressure in pa\n", + "P1=6.*10**5;#initial pressure in pa\n", + "T1=600.;#initial temperature in K\n", + "V1=V_A;#initial volume in m^3\n", + "V2=(V_A+V_B);#final volume in m^3\n", + "y=1.4;#expansion constant \n", + "R=287.;#gas constant in J/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "print(\"expansion occurs in adiabatic conditions.\")\n", + "print(\"temperature after expansion can be obtained by considering adiabatic expansion\")\n", + "T2=T1*(V1/V2)**(y-1)\n", + "print(\"T2/T1=(V1/V2)^(y-1)\")\n", + "print(\"so T2= in K=\"),round(T2,2)\n", + "T2=489.12;#approx.\n", + "m=(P1*V1)/(R*T1)\n", + "print(\"mass of air,m in kg=\"),round(m,2)\n", + "m=20.91;#approx.\n", + "deltaSs=m*Cv*math.log(T2/T1)+m*R*10**-3*math.log(V2/V1)\n", + "print(\"change in entropy of control system,deltaSs=(S2-S1) in KJ/K=\"),round(deltaSs,2)\n", + "print(\"here,there is no change in entropy of environment,deltaSe=0\")\n", + "deltaSe=0;\n", + "deltaSc=deltaSs+deltaSe\n", + "print(\"total entropy change of combined system=deltaSc in KJ/K=\"),round(deltaSc,2)\n", + "E=To*deltaSc\n", + "print(\"loss of available energy(E)=irreversibility in KJ=\"),round(E,3)\n", + "print(\"so loss of available energy,E=0.603 KJ\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.15;pg no: 229" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.15, Page:229 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\n", + "In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#cal of maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.15, Page:229 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\")\n", + "print(\"In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.16;pg no: 230" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.16, Page:230 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\n", + "availability or reversible work,W_rev=n_rev*Q1 in KJ/min 229.53\n", + "rate of irreversibility,I=W_rev-W_useful in KJ/sec 99.53\n", + "second law efficiency=W_useful/W_rev 0.57\n", + "in percentage 56.64\n", + "so availability=1.38*10^4 KJ/min\n", + "and rate of irreversibility=100 KW,second law efficiency=56.63 %\n", + "NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\n" + ] + } + ], + "source": [ + "#cal of availability,rate of irreversibility and second law efficiency\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.16, Page:230 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\")\n", + "To=(17.+273.);#temperature of surrounding in K\n", + "T1=(700.+273.);#temperature of high temperature reservoir in K\n", + "T2=(30.+273.);#temperature of low temperature reservoir in K\n", + "Q1=2.*10**4;#rate of heat receive in KJ/min\n", + "W_useful=0.13*10**3;#output of engine in KW\n", + "n_rev=(1-T2/T1);\n", + "W_rev=n_rev*Q1\n", + "W_rev=W_rev/60.;#W_rev in KJ/s\n", + "print(\"availability or reversible work,W_rev=n_rev*Q1 in KJ/min\"),round(W_rev,2)\n", + "I=W_rev-W_useful\n", + "print(\"rate of irreversibility,I=W_rev-W_useful in KJ/sec\"),round(I,2)\n", + "W_useful/W_rev\n", + "print(\"second law efficiency=W_useful/W_rev\"),round(W_useful/W_rev,2)\n", + "W_useful*100/W_rev\n", + "print(\"in percentage\"),round(W_useful*100/W_rev,2)\n", + "print(\"so availability=1.38*10^4 KJ/min\")\n", + "print(\"and rate of irreversibility=100 KW,second law efficiency=56.63 %\")\n", + "print(\"NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.17;pg no: 230" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.17, Page:230 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\n", + "loss of available energy=irreversibility=To*deltaSc\n", + "deltaSc=deltaSs+deltaSe\n", + "change in entropy of system=deltaSs\n", + "change in entropy of environment/surroundings=deltaSe\n", + "here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\n", + "P1/T1=P2/T2\n", + "so T2 in K= 555.0\n", + "heat addition to air in tank\n", + "Q in KJ/kg= 223.11\n", + "deltaSs in KJ/kg K= 0.67\n", + "deltaSe in KJ/kg K= -0.33\n", + "and deltaSc in KJ/kg K= 0.34\n", + "so loss of available energy(E)in KJ/kg= 101.55\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.17, Page:230 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\")\n", + "To=(27+273);#temperature of surrounding in K\n", + "T1=(60+273);#initial temperature of air in K\n", + "P1=1.5*10**5;#initial pressure of air in pa\n", + "P2=2.5*10**5;#final pressure of air in pa\n", + "T_reservoir=(400+273);#temperature of reservoir in K\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", + "print(\"deltaSc=deltaSs+deltaSe\")\n", + "print(\"change in entropy of system=deltaSs\")\n", + "print(\"change in entropy of environment/surroundings=deltaSe\")\n", + "print(\"here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\")\n", + "print(\"P1/T1=P2/T2\")\n", + "T2=P2*T1/P1\n", + "print(\"so T2 in K=\"),round(T2,2)\n", + "print(\"heat addition to air in tank\")\n", + "deltaT=T2-T1;\n", + "Q=Cp*deltaT\n", + "print(\"Q in KJ/kg=\"),round(Q,2)\n", + "deltaSs=Q/T1\n", + "print(\"deltaSs in KJ/kg K=\"),round(deltaSs,2)\n", + "deltaSe=-Q/T_reservoir\n", + "print(\"deltaSe in KJ/kg K=\"),round(deltaSe,2)\n", + "deltaSc=deltaSs+deltaSe\n", + "print(\"and deltaSc in KJ/kg K=\"),round(deltaSc,2)\n", + "E=To*deltaSc\n", + "print(\"so loss of available energy(E)in KJ/kg=\"),round(E,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.18;pg no: 231" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.18, Page:231 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\n", + "In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.18, Page:231 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\")\n", + "print(\"In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.19;pg no: 232" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.19, Page:232 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\n", + "clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\n", + "from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\n", + "v_fg in m^3/kg= 0.0\n", + "let us approximate,\n", + "(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\n", + "here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\n", + "substituting in clapeyron equation,\n", + "h_fg in KJ/kg 1941.25\n", + "so calculated enthalpy of vaporisation=1941.25 KJ/kg\n", + "and enthalpy of vaporisation from steam table=1940.7 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of enthalpy of vaporisation\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.19, Page:232 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\")\n", + "T=(200+273);#temperature of water in K\n", + "print(\"clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\")\n", + "print(\"from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\")\n", + "vg=0.12736;\n", + "vf=0.001157;\n", + "v_fg=(vg-vf)\n", + "print(\"v_fg in m^3/kg=\"),round(v_fg)\n", + "print(\"let us approximate,\")\n", + "print(\"(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\")\n", + "print(\"here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\")\n", + "P_205oc=1.7230;#pressure at 205 degree celcius in Mpa\n", + "P_195oc=1.3978;#pressure at 195 degree celcius in Mpa\n", + "(P_205oc-P_195oc)/(205-195)\n", + "print(\"substituting in clapeyron equation,\")\n", + "h_fg=T*v_fg*(P_205oc-P_195oc)*1000/(205-195)\n", + "print(\"h_fg in KJ/kg\"),round(h_fg,2)\n", + "print(\"so calculated enthalpy of vaporisation=1941.25 KJ/kg\")\n", + "print(\"and enthalpy of vaporisation from steam table=1940.7 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.20;pg no: 232" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.20, Page:232 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\n", + "by clapeyron equation\n", + "h_fg=T2*v_fg*(do/dT)_sat \n", + "h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\n", + "by clapeyron-clausius equation,\n", + "log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\n", + "log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\n", + "so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\n", + "% deviation from clapeyron equation in % 6.44\n", + "h_fg by clapeyron equation=159.49 KJ/kg\n", + "h_fg by clapeyron-clausius equation=169.76 KJ/kg\n", + "% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.20, Page:232 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\")\n", + "P2=260.96;#saturation pressure at -5 degree celcius\n", + "P1=182.60;#saturation pressure at -15 degree celcius\n", + "vg=0.07665;#specific volume of gas at -10 degree celcius in m^3/kg\n", + "vf=0.00070#specific volume at -10 degree celcius in m^3/kg\n", + "R=0.06876;#gas constant in KJ/kg K\n", + "h_fg=156.3;#enthalpy in KJ/kg K\n", + "T2=(-5.+273.);#temperature in K\n", + "T1=(-15.+273.);#temperature in K\n", + "print(\"by clapeyron equation\")\n", + "print(\"h_fg=T2*v_fg*(do/dT)_sat \")\n", + "print(\"h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\")\n", + "h_fg=T2*(vg-vf)*(P1-P2)/(T1-T2)\n", + "print(\"by clapeyron-clausius equation,\")\n", + "print(\"log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\")\n", + "print(\"log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\")\n", + "print(\"so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\")\n", + "h_fg=math.log(P2/P1)*R/((1/T1)-(1/T2))\n", + "print(\"% deviation from clapeyron equation in %\"),round((169.76-159.49)*100/159.49,2)\n", + "print(\"h_fg by clapeyron equation=159.49 KJ/kg\")\n", + "print(\"h_fg by clapeyron-clausius equation=169.76 KJ/kg\")\n", + "print(\"% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.21;pg no: 233" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 15)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m15\u001b[0m\n\u001b[1;33m volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "source": [ + "#cal of volume expansivity and isothermal compressibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.21, Page:233 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 21\")\n", + "print(\"volume expansion=(1/v)*(dv/dT)_P\")\n", + "print(\"isothermal compressibility=-(1/v)*(dv/dp)_T\")\n", + "print(\"let us write dv/dT=deltav/deltaT and dv/dP=deltav/deltaP.The difference may be taken for small pressure and temperature changes.\")\n", + "print(\"volume expansivity in K^-1,\")\n", + "print(\"=(1/v)*(dv/dT)_300Kpa\")\n", + "v_300Kpa_300oc=0.8753;#specific volume at 300Kpa and 300 degree celcius\n", + "v_350oc=0.9534;#specific volume 350 degree celcius\n", + "v_250oc=0.7964;#specific volume 250 degree celcius\n", + "volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\n", + "print(\"volume expansivity in Kpa\"),round(volume expansivity,2)\n", + "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350oc=0.9534 in m^3/kg,v_250oc=0.7964 in m^3/kg\")\n", + "print(\"volume expansivity=1.7937*10^-3 K^-1\")\n", + "isothermal=(-1/v_300Kpa_300oc)*(v_350Kpa-v_250Kpa)/(350-250)\n", + "print(\"isothermal compressibility in Kpa^-1\")\n", + "print(\"isothermal compressibility\"),round(isothermal compressibility,2)\n", + "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350Kpa=0.76505 in m^3/kg,v_250Kpa=1.09575 in m^3/kg\")\n", + "v_350Kpa=0.76505;#specific volume 350 Kpa\n", + "v_250Kpa=1.09575;#specific volume 250 Kpa\n", + "print(\"so isothermal compressibility=3.778*10^-3 Kpa^-1\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.22;pg no: 234" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.22, Page:234 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\n", + "filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\n", + "hi=uf\n", + "Cp*Ti=Cv*Tf\n", + "so Tf=Cp*Ti/Cv in K 417.33\n", + "inside final temperature,Tf=417.33 K\n", + "change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K= 0.338\n", + "Cp*log(Tf/Ti)+0\n", + "change in entropy,deltaS_gen=0.3379 KJ/kg K\n", + "irreversibility,I in KJ/kg= 100.76\n", + "irreversibility,I=100.74 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of inside final temperature,change in entropy and irreversibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.22, Page:234 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\")\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "Ti=(25+273.15);#atmospheric temperature in K\n", + "print(\"filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\")\n", + "print(\"hi=uf\")\n", + "print(\"Cp*Ti=Cv*Tf\")\n", + "Tf=Cp*Ti/Cv\n", + "print(\"so Tf=Cp*Ti/Cv in K\"),round(Tf,2)\n", + "print(\"inside final temperature,Tf=417.33 K\")\n", + "deltaS_gen=Cp*math.log(Tf/Ti)\n", + "print(\"change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K=\"),round(deltaS_gen,4)\n", + "print(\"Cp*log(Tf/Ti)+0\")\n", + "print(\"change in entropy,deltaS_gen=0.3379 KJ/kg K\")\n", + "To=Ti;\n", + "I=To*deltaS_gen\n", + "print(\"irreversibility,I in KJ/kg=\"),round(I,2)\n", + "print(\"irreversibility,I=100.74 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.23;pg no: 234" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.23, Page:234 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\n", + "here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\n", + "therefore,d(E-To-S)/dt=W_max\n", + "or W_max=(E-To-S)1-(E-To-S)2\n", + "here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\n", + "therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\n", + "so maximum work in KJ= 40946.6\n" + ] + } + ], + "source": [ + "#cal of maximum work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.23, Page:234 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\")\n", + "m=75.;#mass of hot water in kg\n", + "T1=(400.+273.);#temperature of hot water in K\n", + "T2=(27.+273.);#temperature of environment in K\n", + "Cp=4.18;#specific heat of water in KJ/kg K\n", + "print(\"here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\")\n", + "print(\"therefore,d(E-To-S)/dt=W_max\")\n", + "print(\"or W_max=(E-To-S)1-(E-To-S)2\")\n", + "print(\"here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\")\n", + "print(\"therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\")\n", + "To=T2;\n", + "W_max=m*Cp*(T1-T2)-To*m*Cp*math.log(T1/T2)\n", + "print(\"so maximum work in KJ=\"),round(W_max,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.24;pg no: 235" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.24, Page:235 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\n", + "from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\n", + "inlet stream availability in KJ/kg= 1587.19\n", + "input stream availability is equal to the input absolute availability.\n", + "exit stream availaability in KJ/kg 238.69\n", + "exit stream availability is equal to the exit absolute availability.\n", + "W_rev in KJ/kg\n", + "irreversibility=W_rev-W in KJ/kg 348.49\n", + "this irreversibility is in fact the availability loss.\n", + "inlet stream availability=1587.18 KJ/kg\n", + "exit stream availability=238.69 KJ/kg\n", + "irreversibility=348.49 KJ/kg\n", + "NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \n" + ] + } + ], + "source": [ + "#cal of inlet stream availability,exit stream availability and irreversibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.24, Page:235 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\")\n", + "C1=150;#steam entering velocity in m/s\n", + "C2=50;#steam leaving velocity in m/s\n", + "To=(15+273);#dead state temperature in K\n", + "W=1000;#expansion work in KJ/kg\n", + "print(\"from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\")\n", + "h1=3666.5;\n", + "s1=7.2589;\n", + "h2=2584.7;\n", + "s2=8.1502;\n", + "(h1+C1**2*10**-3/2)-To*s1\n", + "print(\"inlet stream availability in KJ/kg=\"),round((h1+C1**2*10**-3/2)-To*s1,2)\n", + "(h2+C2**2*10**-3/2)-To*s2\n", + "print(\"input stream availability is equal to the input absolute availability.\")\n", + "print(\"exit stream availaability in KJ/kg\"),round((h2+C2**2*10**-3/2)-To*s2,2)\n", + "print(\"exit stream availability is equal to the exit absolute availability.\")\n", + "print(\"W_rev in KJ/kg\")\n", + "W_rev=1587.18-238.69\n", + "W_rev-W\n", + "print(\"irreversibility=W_rev-W in KJ/kg\"),round(W_rev-W,2)\n", + "print(\"this irreversibility is in fact the availability loss.\")\n", + "print(\"inlet stream availability=1587.18 KJ/kg\")\n", + "print(\"exit stream availability=238.69 KJ/kg\")\n", + "print(\"irreversibility=348.49 KJ/kg\")\n", + "print(\"NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter7_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter7_1.ipynb new file mode 100755 index 00000000..ef30a163 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter7_1.ipynb @@ -0,0 +1,1452 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7:Availability and General Thermodynamic Relation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.1;page no: 218" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.1, Page:218 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\n", + "let us neglect the potential energy change during the flow.\n", + "applying S.F.E.E,neglecting inlet velocity and change in potential energy,\n", + "W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\n", + "W_max=(h1-h2)-To*(s1-s2)-C2^2/2\n", + "from steam tables,\n", + "h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\n", + "given To=288 K\n", + "so W_max in KJ/kg= 457.1\n", + "maximum possible work(W_max) in KW= 1142.76\n" + ] + } + ], + "source": [ + "#cal of maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.1, Page:218 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\")\n", + "C2=150;#leave velocity of steam in m/s\n", + "m=2.5;#steam mass flow rate in kg/s\n", + "print(\"let us neglect the potential energy change during the flow.\")\n", + "print(\"applying S.F.E.E,neglecting inlet velocity and change in potential energy,\")\n", + "print(\"W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\")\n", + "print(\"W_max=(h1-h2)-To*(s1-s2)-C2^2/2\")\n", + "print(\"from steam tables,\")\n", + "print(\"h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\")\n", + "h1=3034.8;\n", + "s1=6.8844;\n", + "h2=2776.4;\n", + "s2=7.6134;\n", + "print(\"given To=288 K\")\n", + "To=288;\n", + "W_max=(h1-h2)-To*(s1-s2)-(C2**2/2*10**-3)\n", + "print(\"so W_max in KJ/kg=\"),round(W_max,2)\n", + "W_max=m*W_max\n", + "print(\"maximum possible work(W_max) in KW=\"),round(W_max,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.2;page no: 219" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.2, Page:219 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\n", + "In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\n", + "BOTH THE TANKS HAVE SAME INTERNAL ENERGY\n", + "availability of air in tank,A\n", + "A=(E-Uo)+Po*(V-Vo)-To*(S-So)\n", + "=m*{(e-uo)+Po(v-vo)-To(s-so)}\n", + "m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\n", + "so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\n", + "for tank A,P in pa,so availability_A in KJ= 1.98\n", + "for tank B,P=3*10^5 pa,so availability_B in KJ= 30.98\n", + "so availability of air in tank B is more than that of tank A\n", + "availability of air in tank A=1.98 KJ\n", + "availability of air in tank B=30.98 KJ\n" + ] + } + ], + "source": [ + "#cal of availability of air in tank A,B\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.2, Page:219 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\")\n", + "m=1.;#mass of air in kg\n", + "Po=1.*10**5;#atmospheric pressure in pa\n", + "To=(15.+273.);#temperature of atmosphere in K\n", + "Cv=0.717;#specific heat at constant volume in KJ/kg K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", + "T=(50.+273.);#temperature of tanks A and B in K\n", + "print(\"In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\")\n", + "print(\"BOTH THE TANKS HAVE SAME INTERNAL ENERGY\")\n", + "print(\"availability of air in tank,A\")\n", + "print(\"A=(E-Uo)+Po*(V-Vo)-To*(S-So)\")\n", + "print(\"=m*{(e-uo)+Po(v-vo)-To(s-so)}\")\n", + "print(\"m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\")\n", + "print(\"so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\")\n", + "P=1.*10**5;#pressure in tank A in pa\n", + "availability_A=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", + "print(\"for tank A,P in pa,so availability_A in KJ=\"),round(availability_A,2)\n", + "P=3.*10**5;#pressure in tank B in pa\n", + "availability_B=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", + "print(\"for tank B,P=3*10^5 pa,so availability_B in KJ=\"),round(availability_B,2)\n", + "print(\"so availability of air in tank B is more than that of tank A\")\n", + "print(\"availability of air in tank A=1.98 KJ\")\n", + "print(\"availability of air in tank B=30.98 KJ\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.3;page no: 221" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.3, Page:221 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\n", + "inlet conditions,\n", + "from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\n", + "outlet conditions,at 0.05 bar and 0.95 dryness fraction\n", + "from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\n", + "so s2= in KJ/kg K= 8.0\n", + "and h2= in KJ/kg= 2440.34\n", + "neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\n", + "w in KJ/kg= 598.06\n", + "power output in KW= 8970.97\n", + "maximum work for given end states,\n", + "w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg 850.43\n", + "w_max in KW 12755.7\n", + "so maximum power output=12755.7 KW\n", + "maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\n", + "A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\n", + "=(h2-ho)+V2^2/2-To(s2-so)\n", + "approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\n", + "from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\n", + "maximum work available from exhaust steam,A_exhaust in KJ/kg\n", + "A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so) 151.1\n", + "maximum power that could be obtained from exhaust steam in KW= 2266.5\n", + "so maximum power from exhaust steam=2266.5 KW\n" + ] + } + ], + "source": [ + "#cal of maximum power output and that could be obtained from exhaust steam\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.3, Page:221 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\")\n", + "m=15;#steam flow rate in kg/s\n", + "V2=160;#exit velocity of steam in m/s\n", + "To=(15+273);#pond water temperature in K\n", + "print(\"inlet conditions,\")\n", + "print(\"from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\")\n", + "h1=3051.2;\n", + "s1=7.1229;\n", + "print(\"outlet conditions,at 0.05 bar and 0.95 dryness fraction\")\n", + "print(\"from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\")\n", + "sf=0.4764;\n", + "s_fg=7.9187;\n", + "x=0.95;\n", + "hf=137.82;\n", + "h_fg=2423.7;\n", + "s2=sf+x*s_fg\n", + "print(\"so s2= in KJ/kg K=\"),round(s2,2)\n", + "h2=hf+x*h_fg\n", + "print(\"and h2= in KJ/kg=\"),round(h2,2)\n", + "print(\"neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\")\n", + "w=(h1-h2)-V2**2*10**-3/2\n", + "print(\"w in KJ/kg=\"),round(w,2)\n", + "print(\"power output in KW=\"),round(m*w,2)\n", + "print(\"maximum work for given end states,\")\n", + "w_max=(h1-To*s1)-(h2+V2**2*10**-3/2-To*s2)\n", + "print(\"w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg\"),round(w_max,2)\n", + "w_max=850.38;#approx.\n", + "w_max=m*w_max\n", + "print(\"w_max in KW\"),round(w_max,2)\n", + "print(\"so maximum power output=12755.7 KW\")\n", + "print(\"maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\")\n", + "print(\"A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\")\n", + "print(\"=(h2-ho)+V2^2/2-To(s2-so)\")\n", + "print(\"approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\")\n", + "print(\"from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\")\n", + "ho=62.99;\n", + "so=0.2245;\n", + "print(\"maximum work available from exhaust steam,A_exhaust in KJ/kg\")\n", + "A_exhaust=(h2-ho)+V2**2*10**-3/2-To*(s2-so)\n", + "A_exhaust=151.1;#approx.\n", + "print(\"A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so)\"),round(A_exhaust,2)\n", + "print(\"maximum power that could be obtained from exhaust steam in KW=\"),round(m*A_exhaust,2)\n", + "print(\"so maximum power from exhaust steam=2266.5 KW\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.4;page no: 222" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.4, Page:222 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\n", + "for dead state of water,\n", + "from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\n", + "for initial state of water,\n", + "from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\n", + "for final state of water,\n", + "from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\n", + "availability at any state can be given by\n", + "A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\n", + "so availability at initial state,A1 in KJ\n", + "A1= 2703.28\n", + "and availability at final state,A2 in KJ\n", + "A2= 1.09\n", + "change in availability,A2-A1 in KJ= -2702.19\n", + "hence availability decreases by 2702.188 KJ\n", + "NOTE=>In this question,due to large calculations,answers are approximately correct.\n" + ] + } + ], + "source": [ + "#cal of availability at initial,final state and also change\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.4, Page:222 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\")\n", + "m=5;#mass of steam in kg\n", + "z1=10;#initial elevation in m\n", + "V1=25;#initial velocity of steam in m/s\n", + "z2=2;#final elevation in m\n", + "V2=10;#final velocity of steam in m/s\n", + "Po=100;#environmental pressure in Kpa\n", + "To=(25+273);#environmental temperature in K\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"for dead state of water,\")\n", + "print(\"from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\")\n", + "uo=104.86;\n", + "vo=1.0029*10**-3;\n", + "so=0.3673;\n", + "print(\"for initial state of water,\")\n", + "print(\"from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\")\n", + "u1=2550;\n", + "v1=0.5089;\n", + "s1=6.93;\n", + "print(\"for final state of water,\")\n", + "print(\"from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\")\n", + "u2=83.94;\n", + "v2=1.0018*10**-3;\n", + "s2=0.2966;\n", + "print(\"availability at any state can be given by\")\n", + "print(\"A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\")\n", + "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+V1**2*10**-3/2+g*z1*10**-3)\n", + "print(\"so availability at initial state,A1 in KJ\")\n", + "print(\"A1=\"),round(A1,2)\n", + "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+V2**2*10**-3/2+g*z2*10**-3)\n", + "print(\"and availability at final state,A2 in KJ\")\n", + "print(\"A2=\"),round(A2,2)\n", + "A2-A1\n", + "print(\"change in availability,A2-A1 in KJ=\"),round(A2-A1,2)\n", + "print(\"hence availability decreases by 2702.188 KJ\")\n", + "print(\"NOTE=>In this question,due to large calculations,answers are approximately correct.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.5;page no: 223" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.5, Page:223 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\n", + "In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.5, Page:223 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\")\n", + "print(\"In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.6;pg no: 223" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.6, Page:223 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\n", + "loss of available energy=irreversibility=To*deltaSc\n", + "deltaSc=deltaSs+deltaSe\n", + "change in enropy of system(deltaSs)=W/T in KJ/kg K 0.98\n", + "change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K -2.8\n", + "loss of available energy(E) in KJ/kg= -550.49\n", + "loss of available energy(E)= -550.49\n", + "ratio of lost available exhaust gas energy to engine work=E/W= 0.524\n" + ] + } + ], + "source": [ + "#cal of available energy and ratio of lost available exhaust gas energy to engine work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.6, Page:223 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\")\n", + "To=(30.+273.);#temperature of surrounding in K\n", + "W=1050.;#work done in engine in KJ/kg\n", + "Cp=1.1;#specific heat at constant pressure in KJ/kg K\n", + "T=(800.+273.);#temperature of exhaust gas in K\n", + "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", + "print(\"deltaSc=deltaSs+deltaSe\")\n", + "deltaSs=W/T\n", + "print(\"change in enropy of system(deltaSs)=W/T in KJ/kg K\"),round(deltaSs,2)\n", + "deltaSe=-Cp*(T-To)/To\n", + "print(\"change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K\"),round(deltaSe,2)\n", + "E=To*(deltaSs+deltaSe)\n", + "print(\"loss of available energy(E) in KJ/kg=\"),round(E,2)\n", + "E=-E\n", + "print(\"loss of available energy(E)=\"),round(-E,2)\n", + "print(\"ratio of lost available exhaust gas energy to engine work=E/W=\"),round(E/W,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.7;pg no: 224" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.7, Page:224 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\n", + "let us consider velocities and elevations to be given in reference to environment.Availability is given by\n", + "A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\n", + "dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\n", + "for initial state of saturated vapour at 150 degree celcius\n", + "from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\n", + "for final state of saturated liquid at 20 degree celcius\n", + "from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\n", + "substituting in the expression for availability\n", + "initial state availability,A1 in KJ\n", + "A1= 5650.31\n", + "final state availability,A2 in KJ\n", + "A2= 2.58\n", + "change in availability,deltaA in KJ= -5647.72\n", + "so initial availability =5650.28 KJ\n", + "final availability=2.58 KJ \n", + "change in availability=decrease by 5647.70 KJ \n" + ] + } + ], + "source": [ + "#cal of initial,final and change in availability\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.7, Page:224 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\")\n", + "m=10;#mass of water in kg\n", + "C1=25;#initial velocity in m/s\n", + "C2=10;#final velocity in m/s\n", + "Po=0.1*1000;#environmental pressure in Kpa\n", + "To=(25+273.15);#environmental temperature in K\n", + "g=9.8;#acceleration due to gravity in m/s^2\n", + "z1=10;#initial elevation in m\n", + "z2=3;#final elevation in m\n", + "print(\"let us consider velocities and elevations to be given in reference to environment.Availability is given by\")\n", + "print(\"A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\")\n", + "print(\"dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\")\n", + "uo=104.88;\n", + "vo=1.003*10**-3;\n", + "so=0.3674;\n", + "print(\"for initial state of saturated vapour at 150 degree celcius\")\n", + "print(\"from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\")\n", + "u1=2559.5;\n", + "v1=0.3928;\n", + "s1=6.8379;\n", + "print(\"for final state of saturated liquid at 20 degree celcius\")\n", + "print(\"from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\")\n", + "u2=83.95;\n", + "v2=0.001002;\n", + "s2=0.2966;\n", + "print(\"substituting in the expression for availability\")\n", + "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+C1**2*10**-3/2+g*z1*10**-3)\n", + "print(\"initial state availability,A1 in KJ\")\n", + "print(\"A1=\"),round(A1,2)\n", + "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+C2**2*10**-3/2+g*z2*10**-3)\n", + "print(\"final state availability,A2 in KJ\")\n", + "print(\"A2=\"),round(A2,2)\n", + "deltaA=A2-A1\n", + "print(\"change in availability,deltaA in KJ=\"),round(deltaA,2)\n", + "print(\"so initial availability =5650.28 KJ\")\n", + "print(\"final availability=2.58 KJ \")\n", + "print(\"change in availability=decrease by 5647.70 KJ \")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.8;pg no: 225" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.8, Page:225 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\n", + "let inlet and exit states of turbine be denoted as 1 and 2\n", + "at inlet to turbine,\n", + "from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\n", + "at exit from turbine,\n", + "from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\n", + "at dead state,\n", + "from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\n", + "availability of steam at inlet,A1 in KJ= 6792.43\n", + "so availability of steam at inlet=6792.43 KJ\n", + "applying first law of thermodynamics,\n", + "Q+m*h1=m*h2+W\n", + "so W in KJ/s= 2829.0\n", + "so turbine output=2829 KW\n", + "maximum possible turbine output will be available when irreversibility is zero.\n", + "W_rev=W_max=A1-A2\n", + "W_max in KJ/s= 3804.82\n", + "so maximum output=3804.81 KW\n", + "irreversibility can be estimated by the difference between the maximum output and turbine output.\n", + "I= in KW= 975.82\n", + "so irreversibility=975.81807 KW\n", + "NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\n" + ] + } + ], + "source": [ + "#cal of availability of steam at inlet,turbine output,maximum possible turbine output,irreversibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.8, Page:225 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\")\n", + "m=5.;#steam flow rate in kg/s\n", + "p1=5.*1000.;#initial pressure of steam in Kpa\n", + "T1=(500.+273.15);#initial temperature of steam in K \n", + "p2=0.2*1000.;#final pressure of steam in Kpa\n", + "T1=(140.+273.15);#final temperature of steam in K\n", + "po=101.3;#pressure of steam at dead state in Kpa\n", + "To=(25.+273.15);#temperature of steam at dead state in K \n", + "Q=600.;#heat loss through turbine in KJ/s\n", + "print(\"let inlet and exit states of turbine be denoted as 1 and 2\")\n", + "print(\"at inlet to turbine,\")\n", + "print(\"from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\")\n", + "h1=3433.8;\n", + "s1=6.9759;\n", + "print(\"at exit from turbine,\")\n", + "print(\"from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\")\n", + "h2=2748;\n", + "s2=7.228;\n", + "print(\"at dead state,\")\n", + "print(\"from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\")\n", + "ho=104.96;\n", + "so=0.3673;\n", + "A1=m*((h1-ho)-To*(s1-so))\n", + "print(\"availability of steam at inlet,A1 in KJ=\"),round(A1,2)\n", + "print(\"so availability of steam at inlet=6792.43 KJ\")\n", + "print(\"applying first law of thermodynamics,\")\n", + "print(\"Q+m*h1=m*h2+W\")\n", + "W=m*(h1-h2)-Q\n", + "print(\"so W in KJ/s=\"),round(W,2)\n", + "print(\"so turbine output=2829 KW\")\n", + "print(\"maximum possible turbine output will be available when irreversibility is zero.\")\n", + "print(\"W_rev=W_max=A1-A2\")\n", + "W_max=m*((h1-h2)-To*(s1-s2))\n", + "print(\"W_max in KJ/s=\"),round(W_max,2)\n", + "print(\"so maximum output=3804.81 KW\")\n", + "print(\"irreversibility can be estimated by the difference between the maximum output and turbine output.\")\n", + "I=W_max-W\n", + "print(\"I= in KW=\"),round(I,2)\n", + "print(\"so irreversibility=975.81807 KW\")\n", + "print(\"NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.9;pg no: 226" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.9, Page:226 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\n", + "In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.9, Page:226 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\")\n", + "print(\"In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.10;pg no: 227" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.10, Page:227 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\n", + "In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.10, Page:227 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\")\n", + "print(\"In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.11;pg no: 227" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.11, Page:227 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\n", + "availability for heat reservoir(A_HR) in KJ/kg K 167.66\n", + "now availability for system(A_system) in KJ/kg K 194.44\n", + "net loss of available energy(A) in KJ/kg K= -26.78\n", + "so loss of available energy=26.77 KJ/kg K\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.11, Page:227 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\")\n", + "To=280.;#surrounding temperature in K\n", + "Q=500.;#heat removed in KJ\n", + "T1=835.;#temperature of reservoir in K\n", + "T2=720.;#temperature of system in K\n", + "A_HR=To*Q/T1\n", + "print(\"availability for heat reservoir(A_HR) in KJ/kg K\"),round(A_HR,2)\n", + "A_system=To*Q/T2\n", + "print(\"now availability for system(A_system) in KJ/kg K\"),round(A_system,2)\n", + "A=A_HR-A_system \n", + "print(\"net loss of available energy(A) in KJ/kg K=\"),round(A,2)\n", + "print(\"so loss of available energy=26.77 KJ/kg K\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.12;pg no: 228" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.12, Page:228 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\n", + "here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\n", + "W_max=W1-W2 in KJ/kg 1647.0\n", + "actual work from turbine,W_actual=h1-h2 in KJ/kg 1557.0\n", + "so actual work=1557 KJ/kg\n", + "maximum possible work=1647 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of actual,maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.12, Page:228 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\")\n", + "h1=4142;#enthalpy at entrance in KJ/kg\n", + "h2=2585;#enthalpy at exit in KJ/kg\n", + "W1=1787;#availability of steam at entrance in KJ/kg\n", + "W2=140;#availability of steam at exit in KJ/kg\n", + "print(\"here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\")\n", + "W_max=W1-W2\n", + "print(\"W_max=W1-W2 in KJ/kg\"),round(W_max,2)\n", + "W_actual=h1-h2\n", + "print(\"actual work from turbine,W_actual=h1-h2 in KJ/kg\"),round(W_actual,2)\n", + "print(\"so actual work=1557 KJ/kg\")\n", + "print(\"maximum possible work=1647 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.13;pg no: 228" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.13, Page:228 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\n", + "reversible engine efficiency,n_rev=1-(T_min/T_max) 0.621\n", + "second law efficiency=n/n_rev 0.4026\n", + "in % 40.26\n" + ] + } + ], + "source": [ + "#cal of second law efficiency\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.13, Page:228 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\")\n", + "T_min=(20.+273.);#minimum temperature reservoir temperature in K\n", + "T_max=(500.+273.);#maximum temperature reservoir temperature in K\n", + "n=0.25;#efficiency of heat engine\n", + "n_rev=1-(T_min/T_max)\n", + "print(\"reversible engine efficiency,n_rev=1-(T_min/T_max)\"),round(n_rev,4)\n", + "n/n_rev\n", + "print(\"second law efficiency=n/n_rev\"),round(n/n_rev,4)\n", + "print(\"in %\"),round(n*100/n_rev,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.14;pg no: 228" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.14, Page:228 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\n", + "expansion occurs in adiabatic conditions.\n", + "temperature after expansion can be obtained by considering adiabatic expansion\n", + "T2/T1=(V1/V2)^(y-1)\n", + "so T2= in K= 489.12\n", + "mass of air,m in kg= 20.91\n", + "change in entropy of control system,deltaSs=(S2-S1) in KJ/K= -0.0\n", + "here,there is no change in entropy of environment,deltaSe=0\n", + "total entropy change of combined system=deltaSc in KJ/K= -0.0\n", + "loss of available energy(E)=irreversibility in KJ= -0.603\n", + "so loss of available energy,E=0.603 KJ\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.14, Page:228 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\")\n", + "V_A=6.;#volume of compartment A in m^3\n", + "V_B=4.;#volume of compartment B in m^3\n", + "To=300.;#temperature of atmosphere in K\n", + "Po=1.*10**5;#atmospheric pressure in pa\n", + "P1=6.*10**5;#initial pressure in pa\n", + "T1=600.;#initial temperature in K\n", + "V1=V_A;#initial volume in m^3\n", + "V2=(V_A+V_B);#final volume in m^3\n", + "y=1.4;#expansion constant \n", + "R=287.;#gas constant in J/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "print(\"expansion occurs in adiabatic conditions.\")\n", + "print(\"temperature after expansion can be obtained by considering adiabatic expansion\")\n", + "T2=T1*(V1/V2)**(y-1)\n", + "print(\"T2/T1=(V1/V2)^(y-1)\")\n", + "print(\"so T2= in K=\"),round(T2,2)\n", + "T2=489.12;#approx.\n", + "m=(P1*V1)/(R*T1)\n", + "print(\"mass of air,m in kg=\"),round(m,2)\n", + "m=20.91;#approx.\n", + "deltaSs=m*Cv*math.log(T2/T1)+m*R*10**-3*math.log(V2/V1)\n", + "print(\"change in entropy of control system,deltaSs=(S2-S1) in KJ/K=\"),round(deltaSs,2)\n", + "print(\"here,there is no change in entropy of environment,deltaSe=0\")\n", + "deltaSe=0;\n", + "deltaSc=deltaSs+deltaSe\n", + "print(\"total entropy change of combined system=deltaSc in KJ/K=\"),round(deltaSc,2)\n", + "E=To*deltaSc\n", + "print(\"loss of available energy(E)=irreversibility in KJ=\"),round(E,3)\n", + "print(\"so loss of available energy,E=0.603 KJ\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.15;pg no: 229" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.15, Page:229 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\n", + "In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#cal of maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.15, Page:229 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\")\n", + "print(\"In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.16;pg no: 230" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.16, Page:230 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\n", + "availability or reversible work,W_rev=n_rev*Q1 in KJ/min 229.53\n", + "rate of irreversibility,I=W_rev-W_useful in KJ/sec 99.53\n", + "second law efficiency=W_useful/W_rev 0.57\n", + "in percentage 56.64\n", + "so availability=1.38*10^4 KJ/min\n", + "and rate of irreversibility=100 KW,second law efficiency=56.63 %\n", + "NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\n" + ] + } + ], + "source": [ + "#cal of availability,rate of irreversibility and second law efficiency\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.16, Page:230 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\")\n", + "To=(17.+273.);#temperature of surrounding in K\n", + "T1=(700.+273.);#temperature of high temperature reservoir in K\n", + "T2=(30.+273.);#temperature of low temperature reservoir in K\n", + "Q1=2.*10**4;#rate of heat receive in KJ/min\n", + "W_useful=0.13*10**3;#output of engine in KW\n", + "n_rev=(1-T2/T1);\n", + "W_rev=n_rev*Q1\n", + "W_rev=W_rev/60.;#W_rev in KJ/s\n", + "print(\"availability or reversible work,W_rev=n_rev*Q1 in KJ/min\"),round(W_rev,2)\n", + "I=W_rev-W_useful\n", + "print(\"rate of irreversibility,I=W_rev-W_useful in KJ/sec\"),round(I,2)\n", + "W_useful/W_rev\n", + "print(\"second law efficiency=W_useful/W_rev\"),round(W_useful/W_rev,2)\n", + "W_useful*100/W_rev\n", + "print(\"in percentage\"),round(W_useful*100/W_rev,2)\n", + "print(\"so availability=1.38*10^4 KJ/min\")\n", + "print(\"and rate of irreversibility=100 KW,second law efficiency=56.63 %\")\n", + "print(\"NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.17;pg no: 230" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.17, Page:230 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\n", + "loss of available energy=irreversibility=To*deltaSc\n", + "deltaSc=deltaSs+deltaSe\n", + "change in entropy of system=deltaSs\n", + "change in entropy of environment/surroundings=deltaSe\n", + "here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\n", + "P1/T1=P2/T2\n", + "so T2 in K= 555.0\n", + "heat addition to air in tank\n", + "Q in KJ/kg= 223.11\n", + "deltaSs in KJ/kg K= 0.67\n", + "deltaSe in KJ/kg K= -0.33\n", + "and deltaSc in KJ/kg K= 0.34\n", + "so loss of available energy(E)in KJ/kg= 101.55\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.17, Page:230 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\")\n", + "To=(27+273);#temperature of surrounding in K\n", + "T1=(60+273);#initial temperature of air in K\n", + "P1=1.5*10**5;#initial pressure of air in pa\n", + "P2=2.5*10**5;#final pressure of air in pa\n", + "T_reservoir=(400+273);#temperature of reservoir in K\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", + "print(\"deltaSc=deltaSs+deltaSe\")\n", + "print(\"change in entropy of system=deltaSs\")\n", + "print(\"change in entropy of environment/surroundings=deltaSe\")\n", + "print(\"here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\")\n", + "print(\"P1/T1=P2/T2\")\n", + "T2=P2*T1/P1\n", + "print(\"so T2 in K=\"),round(T2,2)\n", + "print(\"heat addition to air in tank\")\n", + "deltaT=T2-T1;\n", + "Q=Cp*deltaT\n", + "print(\"Q in KJ/kg=\"),round(Q,2)\n", + "deltaSs=Q/T1\n", + "print(\"deltaSs in KJ/kg K=\"),round(deltaSs,2)\n", + "deltaSe=-Q/T_reservoir\n", + "print(\"deltaSe in KJ/kg K=\"),round(deltaSe,2)\n", + "deltaSc=deltaSs+deltaSe\n", + "print(\"and deltaSc in KJ/kg K=\"),round(deltaSc,2)\n", + "E=To*deltaSc\n", + "print(\"so loss of available energy(E)in KJ/kg=\"),round(E,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.18;pg no: 231" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.18, Page:231 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\n", + "In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.18, Page:231 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\")\n", + "print(\"In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.19;pg no: 232" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.19, Page:232 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\n", + "clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\n", + "from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\n", + "v_fg in m^3/kg= 0.0\n", + "let us approximate,\n", + "(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\n", + "here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\n", + "substituting in clapeyron equation,\n", + "h_fg in KJ/kg 1941.25\n", + "so calculated enthalpy of vaporisation=1941.25 KJ/kg\n", + "and enthalpy of vaporisation from steam table=1940.7 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of enthalpy of vaporisation\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.19, Page:232 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\")\n", + "T=(200+273);#temperature of water in K\n", + "print(\"clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\")\n", + "print(\"from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\")\n", + "vg=0.12736;\n", + "vf=0.001157;\n", + "v_fg=(vg-vf)\n", + "print(\"v_fg in m^3/kg=\"),round(v_fg)\n", + "print(\"let us approximate,\")\n", + "print(\"(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\")\n", + "print(\"here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\")\n", + "P_205oc=1.7230;#pressure at 205 degree celcius in Mpa\n", + "P_195oc=1.3978;#pressure at 195 degree celcius in Mpa\n", + "(P_205oc-P_195oc)/(205-195)\n", + "print(\"substituting in clapeyron equation,\")\n", + "h_fg=T*v_fg*(P_205oc-P_195oc)*1000/(205-195)\n", + "print(\"h_fg in KJ/kg\"),round(h_fg,2)\n", + "print(\"so calculated enthalpy of vaporisation=1941.25 KJ/kg\")\n", + "print(\"and enthalpy of vaporisation from steam table=1940.7 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.20;pg no: 232" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.20, Page:232 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\n", + "by clapeyron equation\n", + "h_fg=T2*v_fg*(do/dT)_sat \n", + "h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\n", + "by clapeyron-clausius equation,\n", + "log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\n", + "log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\n", + "so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\n", + "% deviation from clapeyron equation in % 6.44\n", + "h_fg by clapeyron equation=159.49 KJ/kg\n", + "h_fg by clapeyron-clausius equation=169.76 KJ/kg\n", + "% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.20, Page:232 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\")\n", + "P2=260.96;#saturation pressure at -5 degree celcius\n", + "P1=182.60;#saturation pressure at -15 degree celcius\n", + "vg=0.07665;#specific volume of gas at -10 degree celcius in m^3/kg\n", + "vf=0.00070#specific volume at -10 degree celcius in m^3/kg\n", + "R=0.06876;#gas constant in KJ/kg K\n", + "h_fg=156.3;#enthalpy in KJ/kg K\n", + "T2=(-5.+273.);#temperature in K\n", + "T1=(-15.+273.);#temperature in K\n", + "print(\"by clapeyron equation\")\n", + "print(\"h_fg=T2*v_fg*(do/dT)_sat \")\n", + "print(\"h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\")\n", + "h_fg=T2*(vg-vf)*(P1-P2)/(T1-T2)\n", + "print(\"by clapeyron-clausius equation,\")\n", + "print(\"log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\")\n", + "print(\"log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\")\n", + "print(\"so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\")\n", + "h_fg=math.log(P2/P1)*R/((1/T1)-(1/T2))\n", + "print(\"% deviation from clapeyron equation in %\"),round((169.76-159.49)*100/159.49,2)\n", + "print(\"h_fg by clapeyron equation=159.49 KJ/kg\")\n", + "print(\"h_fg by clapeyron-clausius equation=169.76 KJ/kg\")\n", + "print(\"% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.21;pg no: 233" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 15)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m15\u001b[0m\n\u001b[1;33m volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "source": [ + "#cal of volume expansivity and isothermal compressibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.21, Page:233 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 21\")\n", + "print(\"volume expansion=(1/v)*(dv/dT)_P\")\n", + "print(\"isothermal compressibility=-(1/v)*(dv/dp)_T\")\n", + "print(\"let us write dv/dT=deltav/deltaT and dv/dP=deltav/deltaP.The difference may be taken for small pressure and temperature changes.\")\n", + "print(\"volume expansivity in K^-1,\")\n", + "print(\"=(1/v)*(dv/dT)_300Kpa\")\n", + "v_300Kpa_300oc=0.8753;#specific volume at 300Kpa and 300 degree celcius\n", + "v_350oc=0.9534;#specific volume 350 degree celcius\n", + "v_250oc=0.7964;#specific volume 250 degree celcius\n", + "volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\n", + "print(\"volume expansivity in Kpa\"),round(volume expansivity,2)\n", + "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350oc=0.9534 in m^3/kg,v_250oc=0.7964 in m^3/kg\")\n", + "print(\"volume expansivity=1.7937*10^-3 K^-1\")\n", + "isothermal=(-1/v_300Kpa_300oc)*(v_350Kpa-v_250Kpa)/(350-250)\n", + "print(\"isothermal compressibility in Kpa^-1\")\n", + "print(\"isothermal compressibility\"),round(isothermal compressibility,2)\n", + "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350Kpa=0.76505 in m^3/kg,v_250Kpa=1.09575 in m^3/kg\")\n", + "v_350Kpa=0.76505;#specific volume 350 Kpa\n", + "v_250Kpa=1.09575;#specific volume 250 Kpa\n", + "print(\"so isothermal compressibility=3.778*10^-3 Kpa^-1\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.22;pg no: 234" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.22, Page:234 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\n", + "filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\n", + "hi=uf\n", + "Cp*Ti=Cv*Tf\n", + "so Tf=Cp*Ti/Cv in K 417.33\n", + "inside final temperature,Tf=417.33 K\n", + "change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K= 0.338\n", + "Cp*log(Tf/Ti)+0\n", + "change in entropy,deltaS_gen=0.3379 KJ/kg K\n", + "irreversibility,I in KJ/kg= 100.76\n", + "irreversibility,I=100.74 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of inside final temperature,change in entropy and irreversibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.22, Page:234 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\")\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "Ti=(25+273.15);#atmospheric temperature in K\n", + "print(\"filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\")\n", + "print(\"hi=uf\")\n", + "print(\"Cp*Ti=Cv*Tf\")\n", + "Tf=Cp*Ti/Cv\n", + "print(\"so Tf=Cp*Ti/Cv in K\"),round(Tf,2)\n", + "print(\"inside final temperature,Tf=417.33 K\")\n", + "deltaS_gen=Cp*math.log(Tf/Ti)\n", + "print(\"change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K=\"),round(deltaS_gen,4)\n", + "print(\"Cp*log(Tf/Ti)+0\")\n", + "print(\"change in entropy,deltaS_gen=0.3379 KJ/kg K\")\n", + "To=Ti;\n", + "I=To*deltaS_gen\n", + "print(\"irreversibility,I in KJ/kg=\"),round(I,2)\n", + "print(\"irreversibility,I=100.74 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.23;pg no: 234" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.23, Page:234 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\n", + "here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\n", + "therefore,d(E-To-S)/dt=W_max\n", + "or W_max=(E-To-S)1-(E-To-S)2\n", + "here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\n", + "therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\n", + "so maximum work in KJ= 40946.6\n" + ] + } + ], + "source": [ + "#cal of maximum work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.23, Page:234 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\")\n", + "m=75.;#mass of hot water in kg\n", + "T1=(400.+273.);#temperature of hot water in K\n", + "T2=(27.+273.);#temperature of environment in K\n", + "Cp=4.18;#specific heat of water in KJ/kg K\n", + "print(\"here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\")\n", + "print(\"therefore,d(E-To-S)/dt=W_max\")\n", + "print(\"or W_max=(E-To-S)1-(E-To-S)2\")\n", + "print(\"here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\")\n", + "print(\"therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\")\n", + "To=T2;\n", + "W_max=m*Cp*(T1-T2)-To*m*Cp*math.log(T1/T2)\n", + "print(\"so maximum work in KJ=\"),round(W_max,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.24;pg no: 235" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.24, Page:235 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\n", + "from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\n", + "inlet stream availability in KJ/kg= 1587.19\n", + "input stream availability is equal to the input absolute availability.\n", + "exit stream availaability in KJ/kg 238.69\n", + "exit stream availability is equal to the exit absolute availability.\n", + "W_rev in KJ/kg\n", + "irreversibility=W_rev-W in KJ/kg 348.49\n", + "this irreversibility is in fact the availability loss.\n", + "inlet stream availability=1587.18 KJ/kg\n", + "exit stream availability=238.69 KJ/kg\n", + "irreversibility=348.49 KJ/kg\n", + "NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \n" + ] + } + ], + "source": [ + "#cal of inlet stream availability,exit stream availability and irreversibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.24, Page:235 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\")\n", + "C1=150;#steam entering velocity in m/s\n", + "C2=50;#steam leaving velocity in m/s\n", + "To=(15+273);#dead state temperature in K\n", + "W=1000;#expansion work in KJ/kg\n", + "print(\"from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\")\n", + "h1=3666.5;\n", + "s1=7.2589;\n", + "h2=2584.7;\n", + "s2=8.1502;\n", + "(h1+C1**2*10**-3/2)-To*s1\n", + "print(\"inlet stream availability in KJ/kg=\"),round((h1+C1**2*10**-3/2)-To*s1,2)\n", + "(h2+C2**2*10**-3/2)-To*s2\n", + "print(\"input stream availability is equal to the input absolute availability.\")\n", + "print(\"exit stream availaability in KJ/kg\"),round((h2+C2**2*10**-3/2)-To*s2,2)\n", + "print(\"exit stream availability is equal to the exit absolute availability.\")\n", + "print(\"W_rev in KJ/kg\")\n", + "W_rev=1587.18-238.69\n", + "W_rev-W\n", + "print(\"irreversibility=W_rev-W in KJ/kg\"),round(W_rev-W,2)\n", + "print(\"this irreversibility is in fact the availability loss.\")\n", + "print(\"inlet stream availability=1587.18 KJ/kg\")\n", + "print(\"exit stream availability=238.69 KJ/kg\")\n", + "print(\"irreversibility=348.49 KJ/kg\")\n", + "print(\"NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter7_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter7_2.ipynb new file mode 100755 index 00000000..8171c9b6 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter7_2.ipynb @@ -0,0 +1,1466 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7:Availability and General Thermodynamic Relation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.1;page no: 218" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.1, Page:218 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\n", + "let us neglect the potential energy change during the flow.\n", + "applying S.F.E.E,neglecting inlet velocity and change in potential energy,\n", + "W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\n", + "W_max=(h1-h2)-To*(s1-s2)-C2^2/2\n", + "from steam tables,\n", + "h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\n", + "given To=288 K\n", + "so W_max in KJ/kg= 457.1\n", + "maximum possible work(W_max) in KW= 1142.76\n" + ] + } + ], + "source": [ + "#cal of maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.1, Page:218 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\")\n", + "C2=150;#leave velocity of steam in m/s\n", + "m=2.5;#steam mass flow rate in kg/s\n", + "print(\"let us neglect the potential energy change during the flow.\")\n", + "print(\"applying S.F.E.E,neglecting inlet velocity and change in potential energy,\")\n", + "print(\"W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\")\n", + "print(\"W_max=(h1-h2)-To*(s1-s2)-C2^2/2\")\n", + "print(\"from steam tables,\")\n", + "print(\"h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\")\n", + "h1=3034.8;\n", + "s1=6.8844;\n", + "h2=2776.4;\n", + "s2=7.6134;\n", + "print(\"given To=288 K\")\n", + "To=288;\n", + "W_max=(h1-h2)-To*(s1-s2)-(C2**2/2*10**-3)\n", + "print(\"so W_max in KJ/kg=\"),round(W_max,2)\n", + "W_max=m*W_max\n", + "print(\"maximum possible work(W_max) in KW=\"),round(W_max,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.2;page no: 219" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.2, Page:219 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\n", + "In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\n", + "BOTH THE TANKS HAVE SAME INTERNAL ENERGY\n", + "availability of air in tank,A\n", + "A=(E-Uo)+Po*(V-Vo)-To*(S-So)\n", + "=m*{(e-uo)+Po(v-vo)-To(s-so)}\n", + "m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\n", + "so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\n", + "for tank A,P in pa,so availability_A in KJ= 1.98\n", + "for tank B,P=3*10^5 pa,so availability_B in KJ= 30.98\n", + "so availability of air in tank B is more than that of tank A\n", + "availability of air in tank A=1.98 KJ\n", + "availability of air in tank B=30.98 KJ\n" + ] + } + ], + "source": [ + "#cal of availability of air in tank A,B\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.2, Page:219 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\")\n", + "m=1.;#mass of air in kg\n", + "Po=1.*10**5;#atmospheric pressure in pa\n", + "To=(15.+273.);#temperature of atmosphere in K\n", + "Cv=0.717;#specific heat at constant volume in KJ/kg K\n", + "R=0.287;#gas constant in KJ/kg K\n", + "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", + "T=(50.+273.);#temperature of tanks A and B in K\n", + "print(\"In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\")\n", + "print(\"BOTH THE TANKS HAVE SAME INTERNAL ENERGY\")\n", + "print(\"availability of air in tank,A\")\n", + "print(\"A=(E-Uo)+Po*(V-Vo)-To*(S-So)\")\n", + "print(\"=m*{(e-uo)+Po(v-vo)-To(s-so)}\")\n", + "print(\"m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\")\n", + "print(\"so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\")\n", + "P=1.*10**5;#pressure in tank A in pa\n", + "availability_A=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", + "print(\"for tank A,P in pa,so availability_A in KJ=\"),round(availability_A,2)\n", + "P=3.*10**5;#pressure in tank B in pa\n", + "availability_B=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", + "print(\"for tank B,P=3*10^5 pa,so availability_B in KJ=\"),round(availability_B,2)\n", + "print(\"so availability of air in tank B is more than that of tank A\")\n", + "print(\"availability of air in tank A=1.98 KJ\")\n", + "print(\"availability of air in tank B=30.98 KJ\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.3;page no: 221" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.3, Page:221 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\n", + "inlet conditions,\n", + "from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\n", + "outlet conditions,at 0.05 bar and 0.95 dryness fraction\n", + "from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\n", + "so s2= in KJ/kg K= 8.0\n", + "and h2= in KJ/kg= 2440.34\n", + "neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\n", + "w in KJ/kg= 598.06\n", + "power output in KW= 8970.97\n", + "maximum work for given end states,\n", + "w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg 850.43\n", + "w_max in KW 12755.7\n", + "so maximum power output=12755.7 KW\n", + "maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\n", + "A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\n", + "=(h2-ho)+V2^2/2-To(s2-so)\n", + "approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\n", + "from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\n", + "maximum work available from exhaust steam,A_exhaust in KJ/kg\n", + "A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so) 151.1\n", + "maximum power that could be obtained from exhaust steam in KW= 2266.5\n", + "so maximum power from exhaust steam=2266.5 KW\n" + ] + } + ], + "source": [ + "#cal of maximum power output and that could be obtained from exhaust steam\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.3, Page:221 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\")\n", + "m=15;#steam flow rate in kg/s\n", + "V2=160;#exit velocity of steam in m/s\n", + "To=(15+273);#pond water temperature in K\n", + "print(\"inlet conditions,\")\n", + "print(\"from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\")\n", + "h1=3051.2;\n", + "s1=7.1229;\n", + "print(\"outlet conditions,at 0.05 bar and 0.95 dryness fraction\")\n", + "print(\"from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\")\n", + "sf=0.4764;\n", + "s_fg=7.9187;\n", + "x=0.95;\n", + "hf=137.82;\n", + "h_fg=2423.7;\n", + "s2=sf+x*s_fg\n", + "print(\"so s2= in KJ/kg K=\"),round(s2,2)\n", + "h2=hf+x*h_fg\n", + "print(\"and h2= in KJ/kg=\"),round(h2,2)\n", + "print(\"neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\")\n", + "w=(h1-h2)-V2**2*10**-3/2\n", + "print(\"w in KJ/kg=\"),round(w,2)\n", + "print(\"power output in KW=\"),round(m*w,2)\n", + "print(\"maximum work for given end states,\")\n", + "w_max=(h1-To*s1)-(h2+V2**2*10**-3/2-To*s2)\n", + "print(\"w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg\"),round(w_max,2)\n", + "w_max=850.38;#approx.\n", + "w_max=m*w_max\n", + "print(\"w_max in KW\"),round(w_max,2)\n", + "print(\"so maximum power output=12755.7 KW\")\n", + "print(\"maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\")\n", + "print(\"A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\")\n", + "print(\"=(h2-ho)+V2^2/2-To(s2-so)\")\n", + "print(\"approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\")\n", + "print(\"from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\")\n", + "ho=62.99;\n", + "so=0.2245;\n", + "print(\"maximum work available from exhaust steam,A_exhaust in KJ/kg\")\n", + "A_exhaust=(h2-ho)+V2**2*10**-3/2-To*(s2-so)\n", + "A_exhaust=151.1;#approx.\n", + "print(\"A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so)\"),round(A_exhaust,2)\n", + "print(\"maximum power that could be obtained from exhaust steam in KW=\"),round(m*A_exhaust,2)\n", + "print(\"so maximum power from exhaust steam=2266.5 KW\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.4;page no: 222" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.4, Page:222 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\n", + "for dead state of water,\n", + "from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\n", + "for initial state of water,\n", + "from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\n", + "for final state of water,\n", + "from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\n", + "availability at any state can be given by\n", + "A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\n", + "so availability at initial state,A1 in KJ\n", + "A1= 2703.28\n", + "and availability at final state,A2 in KJ\n", + "A2= 1.09\n", + "change in availability,A2-A1 in KJ= -2702.19\n", + "hence availability decreases by 2702.188 KJ\n", + "NOTE=>In this question,due to large calculations,answers are approximately correct.\n" + ] + } + ], + "source": [ + "#cal of availability at initial,final state and also change\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.4, Page:222 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\")\n", + "m=5;#mass of steam in kg\n", + "z1=10;#initial elevation in m\n", + "V1=25;#initial velocity of steam in m/s\n", + "z2=2;#final elevation in m\n", + "V2=10;#final velocity of steam in m/s\n", + "Po=100;#environmental pressure in Kpa\n", + "To=(25+273);#environmental temperature in K\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"for dead state of water,\")\n", + "print(\"from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\")\n", + "uo=104.86;\n", + "vo=1.0029*10**-3;\n", + "so=0.3673;\n", + "print(\"for initial state of water,\")\n", + "print(\"from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\")\n", + "u1=2550;\n", + "v1=0.5089;\n", + "s1=6.93;\n", + "print(\"for final state of water,\")\n", + "print(\"from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\")\n", + "u2=83.94;\n", + "v2=1.0018*10**-3;\n", + "s2=0.2966;\n", + "print(\"availability at any state can be given by\")\n", + "print(\"A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\")\n", + "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+V1**2*10**-3/2+g*z1*10**-3)\n", + "print(\"so availability at initial state,A1 in KJ\")\n", + "print(\"A1=\"),round(A1,2)\n", + "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+V2**2*10**-3/2+g*z2*10**-3)\n", + "print(\"and availability at final state,A2 in KJ\")\n", + "print(\"A2=\"),round(A2,2)\n", + "A2-A1\n", + "print(\"change in availability,A2-A1 in KJ=\"),round(A2-A1,2)\n", + "print(\"hence availability decreases by 2702.188 KJ\")\n", + "print(\"NOTE=>In this question,due to large calculations,answers are approximately correct.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.5;page no: 223" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.5, Page:223 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\n", + "In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.5, Page:223 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\")\n", + "print(\"In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.6;pg no: 223" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.6, Page:223 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\n", + "loss of available energy=irreversibility=To*deltaSc\n", + "deltaSc=deltaSs+deltaSe\n", + "change in enropy of system(deltaSs)=W/T in KJ/kg K 0.98\n", + "change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K -2.8\n", + "loss of available energy(E) in KJ/kg= -550.49\n", + "loss of available energy(E)= -550.49\n", + "ratio of lost available exhaust gas energy to engine work=E/W= 0.524\n" + ] + } + ], + "source": [ + "#cal of available energy and ratio of lost available exhaust gas energy to engine work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.6, Page:223 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\")\n", + "To=(30.+273.);#temperature of surrounding in K\n", + "W=1050.;#work done in engine in KJ/kg\n", + "Cp=1.1;#specific heat at constant pressure in KJ/kg K\n", + "T=(800.+273.);#temperature of exhaust gas in K\n", + "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", + "print(\"deltaSc=deltaSs+deltaSe\")\n", + "deltaSs=W/T\n", + "print(\"change in enropy of system(deltaSs)=W/T in KJ/kg K\"),round(deltaSs,2)\n", + "deltaSe=-Cp*(T-To)/To\n", + "print(\"change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K\"),round(deltaSe,2)\n", + "E=To*(deltaSs+deltaSe)\n", + "print(\"loss of available energy(E) in KJ/kg=\"),round(E,2)\n", + "E=-E\n", + "print(\"loss of available energy(E)=\"),round(-E,2)\n", + "print(\"ratio of lost available exhaust gas energy to engine work=E/W=\"),round(E/W,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.7;pg no: 224" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.7, Page:224 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\n", + "let us consider velocities and elevations to be given in reference to environment.Availability is given by\n", + "A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\n", + "dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\n", + "for initial state of saturated vapour at 150 degree celcius\n", + "from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\n", + "for final state of saturated liquid at 20 degree celcius\n", + "from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\n", + "substituting in the expression for availability\n", + "initial state availability,A1 in KJ\n", + "A1= 5650.31\n", + "final state availability,A2 in KJ\n", + "A2= 2.58\n", + "change in availability,deltaA in KJ= -5647.72\n", + "so initial availability =5650.28 KJ\n", + "final availability=2.58 KJ \n", + "change in availability=decrease by 5647.70 KJ \n" + ] + } + ], + "source": [ + "#cal of initial,final and change in availability\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.7, Page:224 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\")\n", + "m=10;#mass of water in kg\n", + "C1=25;#initial velocity in m/s\n", + "C2=10;#final velocity in m/s\n", + "Po=0.1*1000;#environmental pressure in Kpa\n", + "To=(25+273.15);#environmental temperature in K\n", + "g=9.8;#acceleration due to gravity in m/s^2\n", + "z1=10;#initial elevation in m\n", + "z2=3;#final elevation in m\n", + "print(\"let us consider velocities and elevations to be given in reference to environment.Availability is given by\")\n", + "print(\"A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\")\n", + "print(\"dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\")\n", + "uo=104.88;\n", + "vo=1.003*10**-3;\n", + "so=0.3674;\n", + "print(\"for initial state of saturated vapour at 150 degree celcius\")\n", + "print(\"from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\")\n", + "u1=2559.5;\n", + "v1=0.3928;\n", + "s1=6.8379;\n", + "print(\"for final state of saturated liquid at 20 degree celcius\")\n", + "print(\"from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\")\n", + "u2=83.95;\n", + "v2=0.001002;\n", + "s2=0.2966;\n", + "print(\"substituting in the expression for availability\")\n", + "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+C1**2*10**-3/2+g*z1*10**-3)\n", + "print(\"initial state availability,A1 in KJ\")\n", + "print(\"A1=\"),round(A1,2)\n", + "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+C2**2*10**-3/2+g*z2*10**-3)\n", + "print(\"final state availability,A2 in KJ\")\n", + "print(\"A2=\"),round(A2,2)\n", + "deltaA=A2-A1\n", + "print(\"change in availability,deltaA in KJ=\"),round(deltaA,2)\n", + "print(\"so initial availability =5650.28 KJ\")\n", + "print(\"final availability=2.58 KJ \")\n", + "print(\"change in availability=decrease by 5647.70 KJ \")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.8;pg no: 225" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.8, Page:225 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\n", + "let inlet and exit states of turbine be denoted as 1 and 2\n", + "at inlet to turbine,\n", + "from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\n", + "at exit from turbine,\n", + "from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\n", + "at dead state,\n", + "from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\n", + "availability of steam at inlet,A1 in KJ= 6792.43\n", + "so availability of steam at inlet=6792.43 KJ\n", + "applying first law of thermodynamics,\n", + "Q+m*h1=m*h2+W\n", + "so W in KJ/s= 2829.0\n", + "so turbine output=2829 KW\n", + "maximum possible turbine output will be available when irreversibility is zero.\n", + "W_rev=W_max=A1-A2\n", + "W_max in KJ/s= 3804.82\n", + "so maximum output=3804.81 KW\n", + "irreversibility can be estimated by the difference between the maximum output and turbine output.\n", + "I= in KW= 975.82\n", + "so irreversibility=975.81807 KW\n", + "NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\n" + ] + } + ], + "source": [ + "#cal of availability of steam at inlet,turbine output,maximum possible turbine output,irreversibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.8, Page:225 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\")\n", + "m=5.;#steam flow rate in kg/s\n", + "p1=5.*1000.;#initial pressure of steam in Kpa\n", + "T1=(500.+273.15);#initial temperature of steam in K \n", + "p2=0.2*1000.;#final pressure of steam in Kpa\n", + "T1=(140.+273.15);#final temperature of steam in K\n", + "po=101.3;#pressure of steam at dead state in Kpa\n", + "To=(25.+273.15);#temperature of steam at dead state in K \n", + "Q=600.;#heat loss through turbine in KJ/s\n", + "print(\"let inlet and exit states of turbine be denoted as 1 and 2\")\n", + "print(\"at inlet to turbine,\")\n", + "print(\"from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\")\n", + "h1=3433.8;\n", + "s1=6.9759;\n", + "print(\"at exit from turbine,\")\n", + "print(\"from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\")\n", + "h2=2748;\n", + "s2=7.228;\n", + "print(\"at dead state,\")\n", + "print(\"from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\")\n", + "ho=104.96;\n", + "so=0.3673;\n", + "A1=m*((h1-ho)-To*(s1-so))\n", + "print(\"availability of steam at inlet,A1 in KJ=\"),round(A1,2)\n", + "print(\"so availability of steam at inlet=6792.43 KJ\")\n", + "print(\"applying first law of thermodynamics,\")\n", + "print(\"Q+m*h1=m*h2+W\")\n", + "W=m*(h1-h2)-Q\n", + "print(\"so W in KJ/s=\"),round(W,2)\n", + "print(\"so turbine output=2829 KW\")\n", + "print(\"maximum possible turbine output will be available when irreversibility is zero.\")\n", + "print(\"W_rev=W_max=A1-A2\")\n", + "W_max=m*((h1-h2)-To*(s1-s2))\n", + "print(\"W_max in KJ/s=\"),round(W_max,2)\n", + "print(\"so maximum output=3804.81 KW\")\n", + "print(\"irreversibility can be estimated by the difference between the maximum output and turbine output.\")\n", + "I=W_max-W\n", + "print(\"I= in KW=\"),round(I,2)\n", + "print(\"so irreversibility=975.81807 KW\")\n", + "print(\"NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.9;pg no: 226" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.9, Page:226 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\n", + "In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.9, Page:226 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\")\n", + "print(\"In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.10;pg no: 227" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.10, Page:227 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\n", + "In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.10, Page:227 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\")\n", + "print(\"In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.11;pg no: 227" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.11, Page:227 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\n", + "availability for heat reservoir(A_HR) in KJ/kg K 167.66\n", + "now availability for system(A_system) in KJ/kg K 194.44\n", + "net loss of available energy(A) in KJ/kg K= -26.78\n", + "so loss of available energy=26.77 KJ/kg K\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.11, Page:227 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\")\n", + "To=280.;#surrounding temperature in K\n", + "Q=500.;#heat removed in KJ\n", + "T1=835.;#temperature of reservoir in K\n", + "T2=720.;#temperature of system in K\n", + "A_HR=To*Q/T1\n", + "print(\"availability for heat reservoir(A_HR) in KJ/kg K\"),round(A_HR,2)\n", + "A_system=To*Q/T2\n", + "print(\"now availability for system(A_system) in KJ/kg K\"),round(A_system,2)\n", + "A=A_HR-A_system \n", + "print(\"net loss of available energy(A) in KJ/kg K=\"),round(A,2)\n", + "print(\"so loss of available energy=26.77 KJ/kg K\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.12;pg no: 228" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.12, Page:228 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\n", + "here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\n", + "W_max=W1-W2 in KJ/kg 1647.0\n", + "actual work from turbine,W_actual=h1-h2 in KJ/kg 1557.0\n", + "so actual work=1557 KJ/kg\n", + "maximum possible work=1647 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of actual,maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.12, Page:228 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\")\n", + "h1=4142;#enthalpy at entrance in KJ/kg\n", + "h2=2585;#enthalpy at exit in KJ/kg\n", + "W1=1787;#availability of steam at entrance in KJ/kg\n", + "W2=140;#availability of steam at exit in KJ/kg\n", + "print(\"here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\")\n", + "W_max=W1-W2\n", + "print(\"W_max=W1-W2 in KJ/kg\"),round(W_max,2)\n", + "W_actual=h1-h2\n", + "print(\"actual work from turbine,W_actual=h1-h2 in KJ/kg\"),round(W_actual,2)\n", + "print(\"so actual work=1557 KJ/kg\")\n", + "print(\"maximum possible work=1647 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.13;pg no: 228" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.13, Page:228 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\n", + "reversible engine efficiency,n_rev=1-(T_min/T_max) 0.621\n", + "second law efficiency=n/n_rev 0.4026\n", + "in % 40.26\n" + ] + } + ], + "source": [ + "#cal of second law efficiency\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.13, Page:228 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\")\n", + "T_min=(20.+273.);#minimum temperature reservoir temperature in K\n", + "T_max=(500.+273.);#maximum temperature reservoir temperature in K\n", + "n=0.25;#efficiency of heat engine\n", + "n_rev=1-(T_min/T_max)\n", + "print(\"reversible engine efficiency,n_rev=1-(T_min/T_max)\"),round(n_rev,4)\n", + "n/n_rev\n", + "print(\"second law efficiency=n/n_rev\"),round(n/n_rev,4)\n", + "print(\"in %\"),round(n*100/n_rev,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.14;pg no: 228" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.14, Page:228 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\n", + "expansion occurs in adiabatic conditions.\n", + "temperature after expansion can be obtained by considering adiabatic expansion\n", + "T2/T1=(V1/V2)^(y-1)\n", + "so T2= in K= 489.12\n", + "mass of air,m in kg= 20.91\n", + "change in entropy of control system,deltaSs=(S2-S1) in KJ/K= -0.0\n", + "here,there is no change in entropy of environment,deltaSe=0\n", + "total entropy change of combined system=deltaSc in KJ/K= -0.0\n", + "loss of available energy(E)=irreversibility in KJ= -0.603\n", + "so loss of available energy,E=0.603 KJ\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.14, Page:228 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\")\n", + "V_A=6.;#volume of compartment A in m^3\n", + "V_B=4.;#volume of compartment B in m^3\n", + "To=300.;#temperature of atmosphere in K\n", + "Po=1.*10**5;#atmospheric pressure in pa\n", + "P1=6.*10**5;#initial pressure in pa\n", + "T1=600.;#initial temperature in K\n", + "V1=V_A;#initial volume in m^3\n", + "V2=(V_A+V_B);#final volume in m^3\n", + "y=1.4;#expansion constant \n", + "R=287.;#gas constant in J/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "print(\"expansion occurs in adiabatic conditions.\")\n", + "print(\"temperature after expansion can be obtained by considering adiabatic expansion\")\n", + "T2=T1*(V1/V2)**(y-1)\n", + "print(\"T2/T1=(V1/V2)^(y-1)\")\n", + "print(\"so T2= in K=\"),round(T2,2)\n", + "T2=489.12;#approx.\n", + "m=(P1*V1)/(R*T1)\n", + "print(\"mass of air,m in kg=\"),round(m,2)\n", + "m=20.91;#approx.\n", + "deltaSs=m*Cv*math.log(T2/T1)+m*R*10**-3*math.log(V2/V1)\n", + "print(\"change in entropy of control system,deltaSs=(S2-S1) in KJ/K=\"),round(deltaSs,2)\n", + "print(\"here,there is no change in entropy of environment,deltaSe=0\")\n", + "deltaSe=0;\n", + "deltaSc=deltaSs+deltaSe\n", + "print(\"total entropy change of combined system=deltaSc in KJ/K=\"),round(deltaSc,2)\n", + "E=To*deltaSc\n", + "print(\"loss of available energy(E)=irreversibility in KJ=\"),round(E,3)\n", + "print(\"so loss of available energy,E=0.603 KJ\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.15;pg no: 229" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.15, Page:229 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\n", + "In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#cal of maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.15, Page:229 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\")\n", + "print(\"In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.16;pg no: 230" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.16, Page:230 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\n", + "availability or reversible work,W_rev=n_rev*Q1 in KJ/min 229.53\n", + "rate of irreversibility,I=W_rev-W_useful in KJ/sec 99.53\n", + "second law efficiency=W_useful/W_rev 0.57\n", + "in percentage 56.64\n", + "so availability=1.38*10^4 KJ/min\n", + "and rate of irreversibility=100 KW,second law efficiency=56.63 %\n", + "NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\n" + ] + } + ], + "source": [ + "#cal of availability,rate of irreversibility and second law efficiency\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.16, Page:230 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\")\n", + "To=(17.+273.);#temperature of surrounding in K\n", + "T1=(700.+273.);#temperature of high temperature reservoir in K\n", + "T2=(30.+273.);#temperature of low temperature reservoir in K\n", + "Q1=2.*10**4;#rate of heat receive in KJ/min\n", + "W_useful=0.13*10**3;#output of engine in KW\n", + "n_rev=(1-T2/T1);\n", + "W_rev=n_rev*Q1\n", + "W_rev=W_rev/60.;#W_rev in KJ/s\n", + "print(\"availability or reversible work,W_rev=n_rev*Q1 in KJ/min\"),round(W_rev,2)\n", + "I=W_rev-W_useful\n", + "print(\"rate of irreversibility,I=W_rev-W_useful in KJ/sec\"),round(I,2)\n", + "W_useful/W_rev\n", + "print(\"second law efficiency=W_useful/W_rev\"),round(W_useful/W_rev,2)\n", + "W_useful*100/W_rev\n", + "print(\"in percentage\"),round(W_useful*100/W_rev,2)\n", + "print(\"so availability=1.38*10^4 KJ/min\")\n", + "print(\"and rate of irreversibility=100 KW,second law efficiency=56.63 %\")\n", + "print(\"NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.17;pg no: 230" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.17, Page:230 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\n", + "loss of available energy=irreversibility=To*deltaSc\n", + "deltaSc=deltaSs+deltaSe\n", + "change in entropy of system=deltaSs\n", + "change in entropy of environment/surroundings=deltaSe\n", + "here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\n", + "P1/T1=P2/T2\n", + "so T2 in K= 555.0\n", + "heat addition to air in tank\n", + "Q in KJ/kg= 223.11\n", + "deltaSs in KJ/kg K= 0.67\n", + "deltaSe in KJ/kg K= -0.33\n", + "and deltaSc in KJ/kg K= 0.34\n", + "so loss of available energy(E)in KJ/kg= 101.55\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.17, Page:230 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\")\n", + "To=(27+273);#temperature of surrounding in K\n", + "T1=(60+273);#initial temperature of air in K\n", + "P1=1.5*10**5;#initial pressure of air in pa\n", + "P2=2.5*10**5;#final pressure of air in pa\n", + "T_reservoir=(400+273);#temperature of reservoir in K\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", + "print(\"deltaSc=deltaSs+deltaSe\")\n", + "print(\"change in entropy of system=deltaSs\")\n", + "print(\"change in entropy of environment/surroundings=deltaSe\")\n", + "print(\"here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\")\n", + "print(\"P1/T1=P2/T2\")\n", + "T2=P2*T1/P1\n", + "print(\"so T2 in K=\"),round(T2,2)\n", + "print(\"heat addition to air in tank\")\n", + "deltaT=T2-T1;\n", + "Q=Cp*deltaT\n", + "print(\"Q in KJ/kg=\"),round(Q,2)\n", + "deltaSs=Q/T1\n", + "print(\"deltaSs in KJ/kg K=\"),round(deltaSs,2)\n", + "deltaSe=-Q/T_reservoir\n", + "print(\"deltaSe in KJ/kg K=\"),round(deltaSe,2)\n", + "deltaSc=deltaSs+deltaSe\n", + "print(\"and deltaSc in KJ/kg K=\"),round(deltaSc,2)\n", + "E=To*deltaSc\n", + "print(\"so loss of available energy(E)in KJ/kg=\"),round(E,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.18;pg no: 231" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.18, Page:231 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\n", + "In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 7\n", + "print\"Example 7.18, Page:231 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\")\n", + "print(\"In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.19;pg no: 232" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.19, Page:232 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\n", + "clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\n", + "from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\n", + "v_fg in m^3/kg= 0.0\n", + "let us approximate,\n", + "(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\n", + "here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\n", + "substituting in clapeyron equation,\n", + "h_fg in KJ/kg 1941.25\n", + "so calculated enthalpy of vaporisation=1941.25 KJ/kg\n", + "and enthalpy of vaporisation from steam table=1940.7 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of enthalpy of vaporisation\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.19, Page:232 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\")\n", + "T=(200+273);#temperature of water in K\n", + "print(\"clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\")\n", + "print(\"from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\")\n", + "vg=0.12736;\n", + "vf=0.001157;\n", + "v_fg=(vg-vf)\n", + "print(\"v_fg in m^3/kg=\"),round(v_fg)\n", + "print(\"let us approximate,\")\n", + "print(\"(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\")\n", + "print(\"here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\")\n", + "P_205oc=1.7230;#pressure at 205 degree celcius in Mpa\n", + "P_195oc=1.3978;#pressure at 195 degree celcius in Mpa\n", + "(P_205oc-P_195oc)/(205-195)\n", + "print(\"substituting in clapeyron equation,\")\n", + "h_fg=T*v_fg*(P_205oc-P_195oc)*1000/(205-195)\n", + "print(\"h_fg in KJ/kg\"),round(h_fg,2)\n", + "print(\"so calculated enthalpy of vaporisation=1941.25 KJ/kg\")\n", + "print(\"and enthalpy of vaporisation from steam table=1940.7 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.20;pg no: 232" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.20, Page:232 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\n", + "by clapeyron equation\n", + "h_fg=T2*v_fg*(do/dT)_sat \n", + "h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\n", + "by clapeyron-clausius equation,\n", + "log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\n", + "log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\n", + "so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\n", + "% deviation from clapeyron equation in % 6.44\n", + "h_fg by clapeyron equation=159.49 KJ/kg\n", + "h_fg by clapeyron-clausius equation=169.76 KJ/kg\n", + "% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\n" + ] + } + ], + "source": [ + "#cal of loss of available energy\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.20, Page:232 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\")\n", + "P2=260.96;#saturation pressure at -5 degree celcius\n", + "P1=182.60;#saturation pressure at -15 degree celcius\n", + "vg=0.07665;#specific volume of gas at -10 degree celcius in m^3/kg\n", + "vf=0.00070#specific volume at -10 degree celcius in m^3/kg\n", + "R=0.06876;#gas constant in KJ/kg K\n", + "h_fg=156.3;#enthalpy in KJ/kg K\n", + "T2=(-5.+273.);#temperature in K\n", + "T1=(-15.+273.);#temperature in K\n", + "print(\"by clapeyron equation\")\n", + "print(\"h_fg=T2*v_fg*(do/dT)_sat \")\n", + "print(\"h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\")\n", + "h_fg=T2*(vg-vf)*(P1-P2)/(T1-T2)\n", + "print(\"by clapeyron-clausius equation,\")\n", + "print(\"log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\")\n", + "print(\"log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\")\n", + "print(\"so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\")\n", + "h_fg=math.log(P2/P1)*R/((1/T1)-(1/T2))\n", + "print(\"% deviation from clapeyron equation in %\"),round((169.76-159.49)*100/159.49,2)\n", + "print(\"h_fg by clapeyron equation=159.49 KJ/kg\")\n", + "print(\"h_fg by clapeyron-clausius equation=169.76 KJ/kg\")\n", + "print(\"% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.21;pg no: 233" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.21, Page:233 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 21\n", + "volume expansion=(1/v)*(dv/dT)_P\n", + "isothermal compressibility=-(1/v)*(dv/dp)_T\n", + "let us write dv/dT=deltav/deltaT and dv/dP=deltav/deltaP.The difference may be taken for small pressure and temperature changes.\n", + "volume expansivity in K^-1,\n", + "=(1/v)*(dv/dT)_300Kpa\n", + "=(1/v_300Kpa_300oc)*((v_350oc-v_250oc)/(350-250))_300Kpa\n", + "from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350oc=0.9534 in m^3/kg,v_250oc=0.7964 in m^3/kg\n", + "volume expansivity=1.7937*10^-3 K^-1\n", + "isothermal compressibility=k in Kpa^-1\n", + "k= 0.004\n", + "from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350Kpa=0.76505 in m^3/kg,v_250Kpa=1.09575 in m^3/kg\n", + "so isothermal compressibility=3.778*10^-3 Kpa^-1\n" + ] + } + ], + "source": [ + "#cal of volume expansivity and isothermal compressibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.21, Page:233 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 21\")\n", + "print(\"volume expansion=(1/v)*(dv/dT)_P\")\n", + "print(\"isothermal compressibility=-(1/v)*(dv/dp)_T\")\n", + "print(\"let us write dv/dT=deltav/deltaT and dv/dP=deltav/deltaP.The difference may be taken for small pressure and temperature changes.\")\n", + "print(\"volume expansivity in K^-1,\")\n", + "print(\"=(1/v)*(dv/dT)_300Kpa\")\n", + "print(\"=(1/v_300Kpa_300oc)*((v_350oc-v_250oc)/(350-250))_300Kpa\")\n", + "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350oc=0.9534 in m^3/kg,v_250oc=0.7964 in m^3/kg\")\n", + "v_300Kpa_300oc=0.8753;#specific volume at 300Kpa and 300 degree celcius\n", + "v_350oc=0.9534;#specific volume 350 degree celcius\n", + "v_250oc=0.7964;#specific volume 250 degree celcius\n", + "(1/v_300Kpa_300oc)*(v_350oc-v_250oc)/(350-250)\n", + "print(\"volume expansivity=1.7937*10^-3 K^-1\")\n", + "print(\"isothermal compressibility=k in Kpa^-1\")\n", + "v_350Kpa=0.76505;#specific volume 350 Kpa\n", + "v_250Kpa=1.09575;#specific volume 250 Kpa\n", + "k=(-1./v_300Kpa_300oc)*(v_350Kpa-v_250Kpa)/(350.-250.)\n", + "print(\"k=\"),round((-1./v_300Kpa_300oc)*(v_350Kpa-v_250Kpa)/(350.-250.),3)\n", + "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350Kpa=0.76505 in m^3/kg,v_250Kpa=1.09575 in m^3/kg\")\n", + "print(\"so isothermal compressibility=3.778*10^-3 Kpa^-1\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.22;pg no: 234" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.22, Page:234 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\n", + "filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\n", + "hi=uf\n", + "Cp*Ti=Cv*Tf\n", + "so Tf=Cp*Ti/Cv in K 417.33\n", + "inside final temperature,Tf=417.33 K\n", + "change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K= 0.338\n", + "Cp*log(Tf/Ti)+0\n", + "change in entropy,deltaS_gen=0.3379 KJ/kg K\n", + "irreversibility,I in KJ/kg= 100.76\n", + "irreversibility,I=100.74 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of inside final temperature,change in entropy and irreversibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.22, Page:234 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\")\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", + "Ti=(25+273.15);#atmospheric temperature in K\n", + "print(\"filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\")\n", + "print(\"hi=uf\")\n", + "print(\"Cp*Ti=Cv*Tf\")\n", + "Tf=Cp*Ti/Cv\n", + "print(\"so Tf=Cp*Ti/Cv in K\"),round(Tf,2)\n", + "print(\"inside final temperature,Tf=417.33 K\")\n", + "deltaS_gen=Cp*math.log(Tf/Ti)\n", + "print(\"change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K=\"),round(deltaS_gen,4)\n", + "print(\"Cp*log(Tf/Ti)+0\")\n", + "print(\"change in entropy,deltaS_gen=0.3379 KJ/kg K\")\n", + "To=Ti;\n", + "I=To*deltaS_gen\n", + "print(\"irreversibility,I in KJ/kg=\"),round(I,2)\n", + "print(\"irreversibility,I=100.74 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.23;pg no: 234" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.23, Page:234 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\n", + "here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\n", + "therefore,d(E-To-S)/dt=W_max\n", + "or W_max=(E-To-S)1-(E-To-S)2\n", + "here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\n", + "therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\n", + "so maximum work in KJ= 40946.6\n" + ] + } + ], + "source": [ + "#cal of maximum work\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.23, Page:234 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\")\n", + "m=75.;#mass of hot water in kg\n", + "T1=(400.+273.);#temperature of hot water in K\n", + "T2=(27.+273.);#temperature of environment in K\n", + "Cp=4.18;#specific heat of water in KJ/kg K\n", + "print(\"here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\")\n", + "print(\"therefore,d(E-To-S)/dt=W_max\")\n", + "print(\"or W_max=(E-To-S)1-(E-To-S)2\")\n", + "print(\"here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\")\n", + "print(\"therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\")\n", + "To=T2;\n", + "W_max=m*Cp*(T1-T2)-To*m*Cp*math.log(T1/T2)\n", + "print(\"so maximum work in KJ=\"),round(W_max,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 7.24;pg no: 235" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 7.24, Page:235 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\n", + "from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\n", + "inlet stream availability in KJ/kg= 1587.19\n", + "input stream availability is equal to the input absolute availability.\n", + "exit stream availaability in KJ/kg 238.69\n", + "exit stream availability is equal to the exit absolute availability.\n", + "W_rev in KJ/kg\n", + "irreversibility=W_rev-W in KJ/kg 348.49\n", + "this irreversibility is in fact the availability loss.\n", + "inlet stream availability=1587.18 KJ/kg\n", + "exit stream availability=238.69 KJ/kg\n", + "irreversibility=348.49 KJ/kg\n", + "NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \n" + ] + } + ], + "source": [ + "#cal of inlet stream availability,exit stream availability and irreversibility\n", + "#intiation of all variables\n", + "# Chapter 7\n", + "import math\n", + "print\"Example 7.24, Page:235 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\")\n", + "C1=150;#steam entering velocity in m/s\n", + "C2=50;#steam leaving velocity in m/s\n", + "To=(15+273);#dead state temperature in K\n", + "W=1000;#expansion work in KJ/kg\n", + "print(\"from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\")\n", + "h1=3666.5;\n", + "s1=7.2589;\n", + "h2=2584.7;\n", + "s2=8.1502;\n", + "(h1+C1**2*10**-3/2)-To*s1\n", + "print(\"inlet stream availability in KJ/kg=\"),round((h1+C1**2*10**-3/2)-To*s1,2)\n", + "(h2+C2**2*10**-3/2)-To*s2\n", + "print(\"input stream availability is equal to the input absolute availability.\")\n", + "print(\"exit stream availaability in KJ/kg\"),round((h2+C2**2*10**-3/2)-To*s2,2)\n", + "print(\"exit stream availability is equal to the exit absolute availability.\")\n", + "print(\"W_rev in KJ/kg\")\n", + "W_rev=1587.18-238.69\n", + "W_rev-W\n", + "print(\"irreversibility=W_rev-W in KJ/kg\"),round(W_rev-W,2)\n", + "print(\"this irreversibility is in fact the availability loss.\")\n", + "print(\"inlet stream availability=1587.18 KJ/kg\")\n", + "print(\"exit stream availability=238.69 KJ/kg\")\n", + "print(\"irreversibility=348.49 KJ/kg\")\n", + "print(\"NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter8.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter8.ipynb new file mode 100755 index 00000000..5088b9af --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter8.ipynb @@ -0,0 +1,2594 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 8:Vapour Power Cycles" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.1;pg no: 260" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.1, Page:260 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\n", + "T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\n", + "enthalpy at state 2,h2= hg at 7 MPa\n", + "from steam table,h=2772.1 KJ/kg\n", + "entropy at state 2,s2=sg at 7MPa\n", + "from steam table,s2=5.8133 KJ/kg K\n", + "enthalpy and entropy at state 3,\n", + "from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\n", + "for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \n", + "from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\n", + "s1=s2=sf+x1*sfg\n", + "so x1= 0.68\n", + "from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\n", + "enthalpy at state 1,h1 in KJ/kg= 1802.53\n", + "let dryness fraction at state 4 be x4\n", + "for process 4-3,s4=s3=sf+x4*sfg\n", + "so x4= 0.33\n", + "enthalpy at state 4,h4 in KJ/kg= 962.81\n", + "thermal efficiency=net work/heat added\n", + "expansion work per kg=(h2-h1) in KJ/kg 969.57\n", + "compression work per kg=(h3-h4) in KJ/kg(+ve) 304.19\n", + "heat added per kg=(h2-h3) in KJ/kg(-ve) 1505.1\n", + "net work per kg=(h2-h1)-(h3-h4) in KJ/kg 665.38\n", + "thermal efficiency 0.44\n", + "in percentage 44.21\n", + "so thermal efficiency=44.21%\n", + "turbine work=969.57 KJ/kg(+ve)\n", + "compression work=304.19 KJ/kg(-ve)\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,turbine work,compression work\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.1, Page:260 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\")\n", + "print(\"T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\")\n", + "print(\"enthalpy at state 2,h2= hg at 7 MPa\")\n", + "print(\"from steam table,h=2772.1 KJ/kg\")\n", + "h2=2772.1;\n", + "print(\"entropy at state 2,s2=sg at 7MPa\")\n", + "print(\"from steam table,s2=5.8133 KJ/kg K\")\n", + "s2=5.8133;\n", + "print(\"enthalpy and entropy at state 3,\")\n", + "print(\"from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\")\n", + "h3=1267;\n", + "s3=3.1211;\n", + "print(\"for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \")\n", + "s1=s2;\n", + "print(\"from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\")\n", + "sf=0.5564;\n", + "sfg=7.7237;\n", + "print(\"s1=s2=sf+x1*sfg\")\n", + "x1=(s2-sf)/sfg\n", + "print(\"so x1=\"),round(x1,2) \n", + "x1=0.6806;#approx.\n", + "print(\"from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\")\n", + "hf=162.60;\n", + "hfg=2409.54;\n", + "h1=hf+x1*hfg\n", + "print(\"enthalpy at state 1,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"let dryness fraction at state 4 be x4\")\n", + "print(\"for process 4-3,s4=s3=sf+x4*sfg\")\n", + "s4=s3;\n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.3321;#approx.\n", + "h4=hf+x4*hfg\n", + "print(\"enthalpy at state 4,h4 in KJ/kg=\"),round(h4,2)\n", + "print(\"thermal efficiency=net work/heat added\")\n", + "(h2-h1)\n", + "print(\"expansion work per kg=(h2-h1) in KJ/kg\"),round((h2-h1),2)\n", + "(h3-h4)\n", + "print(\"compression work per kg=(h3-h4) in KJ/kg(+ve)\"),round((h3-h4),2)\n", + "(h2-h3)\n", + "print(\"heat added per kg=(h2-h3) in KJ/kg(-ve)\"),round((h2-h3),2)\n", + "(h2-h1)-(h3-h4)\n", + "print(\"net work per kg=(h2-h1)-(h3-h4) in KJ/kg\"),round((h2-h1)-(h3-h4),2)\n", + "((h2-h1)-(h3-h4))/(h2-h3)\n", + "print(\"thermal efficiency\"),round(((h2-h1)-(h3-h4))/(h2-h3),2)\n", + "print(\"in percentage\"),round((((h2-h1)-(h3-h4))/(h2-h3))*100,2)\n", + "print(\"so thermal efficiency=44.21%\")\n", + "print(\"turbine work=969.57 KJ/kg(+ve)\")\n", + "print(\"compression work=304.19 KJ/kg(-ve)\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.2;pg no: 261" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.2, Page:261 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\n", + "from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\n", + "hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\n", + "from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\n", + "hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\n", + "as process 2-3 is isentropic,so s2=s3\n", + "and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\n", + "so x3= 0.69\n", + "hence enthalpy at 3,\n", + "h3 in KJ/kg= 1819.85\n", + "enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\n", + "process 1-4 is isentropic,so s1=s4\n", + "s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\n", + "so x4= 0.31\n", + "enthalpy at 4,h4 in KJ/kg= 884.31\n", + "enthalpy at 1,h1 in KJ/kg= 1154.23\n", + "carnot cycle(1-2-3-4-1) efficiency:\n", + "n_carnot=net work/heat added\n", + "n_carnot 0.43\n", + "in percentage 42.96\n", + "so n_carnot=42.95%\n", + "In rankine cycle,1-2-3-5-6-1,\n", + "pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg 5.02\n", + "h5 KJ/kg= 137.82\n", + "hence h6 in KJ/kg 142.84\n", + "net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg 969.43\n", + "heat added=(h2-h6)in KJ/kg 2651.46\n", + "rankine cycle efficiency(n_rankine)= 0.37\n", + "in percentage 36.56\n", + "so n_rankine=36.56%\n" + ] + } + ], + "source": [ + "#cal of n_carnot,n_rankine\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.2, Page:261 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\")\n", + "print(\"from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\")\n", + "print(\"hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\")\n", + "hf_5MPa=1154.23;\n", + "sf_5MPa=2.92;\n", + "hg_5MPa=2794.3;\n", + "sg_5MPa=5.97;\n", + "print(\"from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\")\n", + "print(\"hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\")\n", + "hf_5KPa=137.82;\n", + "sf_5KPa=0.4764;\n", + "hg_5KPa=2561.5;\n", + "sg_5KPa=8.3951;\n", + "vf_5KPa=0.001005;\n", + "print(\"as process 2-3 is isentropic,so s2=s3\")\n", + "print(\"and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\")\n", + "s2=sg_5MPa;\n", + "s3=s2;\n", + "x3=(s3-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.694;#approx.\n", + "print(\"hence enthalpy at 3,\")\n", + "h3=hf_5KPa+x3*(hg_5KPa-hf_5KPa)\n", + "print(\"h3 in KJ/kg=\"),round(h3,2)\n", + "print(\"enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\")\n", + "print(\"process 1-4 is isentropic,so s1=s4\")\n", + "s1=sf_5MPa;\n", + "print(\"s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\")\n", + "x4=(s1-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.308;#approx.\n", + "h4=hf_5KPa+x4*(hg_5KPa-hf_5KPa)\n", + "print(\"enthalpy at 4,h4 in KJ/kg=\"),round(h4,2)\n", + "h1=hf_5MPa\n", + "h2=hg_5MPa;\n", + "n_carnot=((h2-h3)-(h1-h4))/(h2-h1)\n", + "print(\"enthalpy at 1,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"carnot cycle(1-2-3-4-1) efficiency:\")\n", + "print(\"n_carnot=net work/heat added\")\n", + "print(\"n_carnot\"),round(n_carnot,2)\n", + "print(\"in percentage\"),round(n_carnot*100,2)\n", + "print(\"so n_carnot=42.95%\")\n", + "print(\"In rankine cycle,1-2-3-5-6-1,\")\n", + "p6=5000;#boiler pressure in KPa\n", + "p5=5;#condenser pressure in KPa\n", + "vf_5KPa*(p6-p5)\n", + "print(\"pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg\"),round(vf_5KPa*(p6-p5),2)\n", + "h5=hf_5KPa;\n", + "print(\"h5 KJ/kg=\"),round(hf_5KPa,2)\n", + "h6=h5+(vf_5KPa*(p6-p5))\n", + "print(\"hence h6 in KJ/kg\"),round(h6,2)\n", + "(h2-h3)-(h6-h5)\n", + "print(\"net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg\"),round((h2-h3)-(h6-h5),2)\n", + "(h2-h6)\n", + "print(\"heat added=(h2-h6)in KJ/kg\"),round((h2-h6),2)\n", + "n_rankine=((h2-h3)-(h6-h5))/(h2-h6)\n", + "print(\"rankine cycle efficiency(n_rankine)=\"),round(n_rankine,2)\n", + "print(\"in percentage\"),round(n_rankine*100,2)\n", + "print(\"so n_rankine=36.56%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.3;pg no: 263" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.3, Page:263 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\n", + "from steam tables,h2=hg_40bar=3092.5 KJ/kg\n", + "s2=sg_40bar=6.5821 KJ/kg K\n", + "h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \n", + "s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "v4=vf_0.05bar=0.001005 m^3/kg\n", + "let the dryness fraction at state 3 be x3,\n", + "for ideal process,2-3,s2=s3\n", + "s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\n", + "so x3= 0.77\n", + "h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\n", + "for pumping process,\n", + "h1-h4=v4*deltap=v4*(p1-p4)\n", + "so h1=h4+v4*(p1-p4) in KJ/kg 141.83\n", + "pump work per kg of steam in KJ/kg 4.01\n", + "net work per kg of steam =(expansion work-pump work)per kg of steam\n", + "=(h2-h3)-(h1-h4) in KJ/kg= 1081.75\n", + "cycle efficiency=net work/heat added 0.37\n", + "in percentage 36.66\n", + "so net work per kg of steam=1081.74 KJ/kg\n", + "cycle efficiency=36.67%\n", + "pump work per kg of steam=4.02 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of net work per kg of steam,cycle efficiency,pump work per kg of steam\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.3, Page:263 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\")\n", + "print(\"from steam tables,h2=hg_40bar=3092.5 KJ/kg\")\n", + "h2=3092.5;\n", + "print(\"s2=sg_40bar=6.5821 KJ/kg K\")\n", + "s2=6.5821;\n", + "print(\"h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \")\n", + "h4=137.82;\n", + "hfg=2423.7;\n", + "print(\"s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "s4=0.4764;\n", + "sfg=7.9187;\n", + "print(\"v4=vf_0.05bar=0.001005 m^3/kg\")\n", + "v4=0.001005;\n", + "print(\"let the dryness fraction at state 3 be x3,\")\n", + "print(\"for ideal process,2-3,s2=s3\")\n", + "s3=s2;\n", + "print(\"s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\")\n", + "x3=(s2-s4)/(sfg)\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.7711;#approx.\n", + "print(\"h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\")\n", + "h3=h4+x3*hfg\n", + "print(\"for pumping process,\")\n", + "print(\"h1-h4=v4*deltap=v4*(p1-p4)\")\n", + "p1=40*100;#pressure of steam enter in turbine in mPa\n", + "p4=0.05*100;#pressure of steam leave turbine in mPa\n", + "h1=h4+v4*(p1-p4)\n", + "print(\"so h1=h4+v4*(p1-p4) in KJ/kg\"),round(h1,2)\n", + "(h1-h4)\n", + "print(\"pump work per kg of steam in KJ/kg\"),round((h1-h4),2)\n", + "print(\"net work per kg of steam =(expansion work-pump work)per kg of steam\")\n", + "(h2-h3)-(h1-h4)\n", + "print(\"=(h2-h3)-(h1-h4) in KJ/kg=\"),round((h2-h3)-(h1-h4),2)\n", + "print(\"cycle efficiency=net work/heat added\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", + "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", + "print(\"so net work per kg of steam=1081.74 KJ/kg\")\n", + "print(\"cycle efficiency=36.67%\")\n", + "print(\"pump work per kg of steam=4.02 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.4;pg no: 264" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.4, Page:264 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 4\n", + "Let us assume that the condensate leaves condenser as saturated liquid and the expansion in turbine and pumping processes are isentropic.\n", + "from steam tables,h2=h_20MPa=3238.2 KJ/kg\n", + "s2=6.1401 KJ/kg K\n", + "h5=h_0.005MPa in KJ/kg\n", + "from steam tables,at 0.005 MPa,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "h5=hf+0.9*hfg in KJ/kg 2319.15\n", + "s5 in KJ/kg K= 7.6\n", + "h6=hf=137.82 KJ/kg\n", + "it is given that temperature at state 4 is 500 degree celcius and due to isentropic processes s4=s5=7.6032 KJ/kg K.The state 4 can be conveniently located on mollier chart by the intersection of 500 degree celcius constant temperature line and entropy value of 7.6032 KJ/kg K and the pressure and enthalpy obtained.but these shall be approximate.\n", + "The state 4 can also be located by interpolation using steam table.The entropy value of 7.6032 KJ/kg K lies between the superheated steam states given under,p=1.20 MPa,s at 1.20 MPa=7.6027 KJ/kg K\n", + "p=1.40 MPa,s at 1.40 MPa=7.6027 KJ/kg K\n", + "by interpolation state 4 lies at pressure=\n", + "=1.399,approx.=1.40 MPa\n", + "thus,steam leaves HP turbine at 1.40 MPa\n", + "enthalpy at state 4,h4=3474.1 KJ/kg\n", + "for process 2-33,s2=s3=6.1401 KJ/kg K.The state 3 thus lies in wet region as s3sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\n", + "From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\n", + "Let dryness fraction at state 9 be x9 so,\n", + "s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\n", + "from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\n", + "x9=(s9-sf)/sfg 0.95\n", + "h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\n", + "from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\n", + "Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\n", + "h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\n", + "h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\n", + "For process 4-8,i.e in CEP.\n", + "h8 in KJ/kg= 138.22\n", + "For process 11-12,i.e in FP2,\n", + "h12=h11+v11*(40-4)*10^2 in KJ/kg 608.64\n", + "For process 13-1_a i.e. in FP1,h1_a= in KJ/kg= 1107.34\n", + "m1*3141.81+(1-m1)*608.64=1087.31\n", + "so m1=(1087.31-608.64)/(3141.81-608.64)in kg\n", + "Applying energy balance on open feed water heater 1 (OFWH1)\n", + "m1*h10+(1-m1)*h12)=1*h13\n", + "so m1 in kg= 0.19\n", + "Applying energy balance on open feed water heater 2 (OFWH2)\n", + "m2*h9+(1-m1-m2)*h8=(1-m1)*h11\n", + "so m2 in kg= 0.15\n", + "Thermal efficiency of cycle,n= 0.51\n", + "W_CEP in KJ/kg steam from boiler= 0.26\n", + "W_FP1=(h1_a-h13)in KJ/kg of steam from boiler 20.0\n", + "W_FP2 in KJ/kg of steam from boiler= 3.17\n", + "W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler= 23.46\n", + "n= 0.51\n", + "in percentage 51.37\n", + "so cycle thermal efficiency,na=46.18%\n", + "nb=49.76%\n", + "nc=51.37%\n", + "hence it is obvious that efficiency increases with increase in number of feed heaters.\n" + ] + } + ], + "source": [ + "#cal of maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.6, Page:267 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 6\")\n", + "print(\"case (a) When there is no feed water heater\")\n", + "print(\"Thermal efficiency of cycle=((h2-h3)-(h1-h4))/(h2-h1)\")\n", + "print(\"from steam tables,h2=h at 200 bar,650oc=3675.3 KJ/kg,s2=s at 200 bar,650oc=6.6582 KJ/kg K,h4=hf at 0.05 bar=137.82 KJ/kg,v4=vf at 0.05 bar=0.001005 m^3/kg\")\n", + "h2=3675.3;\n", + "s2=6.6582;\n", + "h4=137.82;\n", + "v4=0.001005;\n", + "print(\"hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg,sf at 0.05 bar=0.4764 KJ/kg K,sfg at 0.05 bar=7.9187 KJ/kg K\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "print(\"For process 2-3,s2=s3.Let dryness fraction at 3 be x3.\")\n", + "s3=s2;\n", + "print(\"s3=6.6582=sf at 0.05 bar+x3*sfg at 0.05 bar\")\n", + "x3=(s3-sf)/sfg\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.781;#approx.\n", + "print(\"h3=hf at 0.05 bar+x3*hfg at 0.05 bar in KJ/kg\")\n", + "h3=hf+x3*hfg\n", + "print(\"For pumping process 4-1,\")\n", + "print(\"h1-h4=v4*deltap\")\n", + "h1=h4+v4*(200-0.5)*10**2\n", + "print(\"h1= in KJ/kg=\"),round(h1,2)\n", + "((h2-h3)-(h1-h4))/(h2-h1)\n", + "print(\"Thermal efficiency of cycle=\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", + "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", + "print(\"case (b) When there is only one feed water heater working at 8 bar\")\n", + "print(\"here,let mass of steam bled for feed heating be m kg\")\n", + "print(\"For process 2-6,s2=s6=6.6582 KJ/kg K\")\n", + "s6=s2;\n", + "print(\"Let dryness fraction at state 6 be x6\")\n", + "print(\"s6=sf at 8 bar+x6*sfg at 8 bar\")\n", + "print(\"from steam tables,hf at 8 bar=721.11 KJ/kg,vf at 8 bar=0.001115 m^3/kg,hfg at 8 bar=2048 KJ/kg,sf at 8 bar=2.0462 KJ/kg K,sfg at 8 bar=4.6166 KJ/kg K\")\n", + "hf=721.11;\n", + "vf=0.001115;\n", + "hfg=2048;\n", + "sf=2.0462;\n", + "sfg=4.6166;\n", + "x6=(s6-sf)/sfg\n", + "print(\"substituting entropy values,x6=\"),round(x6,2)\n", + "x6=0.999;#approx.\n", + "print(\"h6=hf at at 8 bar+x6*hfg at 8 bar in KJ/kg\")\n", + "h6=hf+x6*hfg\n", + "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at 8 bar.h7=hf at 8 bar=721.11 KJ/kg\")\n", + "h7=721.11;\n", + "h5=h4+v4*(8-.05)*10**2\n", + "print(\"For process 4-5,h5 in KJ/kg\"),round(h5,2)\n", + "print(\"Applying energy balance at open feed water heater,\")\n", + "print(\"m*h6+(1-m)*h5=1*h7\")\n", + "m=(h7-h5)/(h6-h5)\n", + "print(\"so m= in kg\"),round(m,2)\n", + "h7=hf;\n", + "v7=vf;\n", + "h1=h7+v7*(200-8)*10**2\n", + "print(\"For process 7-1,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"here h7=hf at 8 bar,v7=vf at 8 bar\")\n", + "#TE=((h2-h6)+(1-m)*(h6-h3)-((1-m)*(h5-h4)+(h1-h7))/(h2-h1)\n", + "print(\"Thermal efficiency of cycle=0.4976\")\n", + "print(\"in percentage=49.76\")\n", + "print(\"case (c) When there are two feed water heaters working at 40 bar and 4 bar\")\n", + "print(\"here, let us assume the mass of steam at 40 bar,4 bar to be m1 kg and m2 kg respectively.\")\n", + "print(\"2-10-9-3,s2=s10=s9=s3=6.6582 KJ/kg K\")\n", + "s3=s2;\n", + "s9=s3;\n", + "s10=s9;\n", + "print(\"At state 10.s10>sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\")\n", + "print(\"From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\")\n", + "T10=370.6;\n", + "h10=3141.81;\n", + "print(\"Let dryness fraction at state 9 be x9 so,\") \n", + "print(\"s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\")\n", + "print(\"from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\")\n", + "sf=1.7766;\n", + "sfg=5.1193;\n", + "x9=(s9-sf)/sfg\n", + "print(\"x9=(s9-sf)/sfg\"),round(x9,2)\n", + "x9=0.9536;#approx.\n", + "print(\"h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\")\n", + "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\")\n", + "hf=604.74;\n", + "hfg=2133.8;\n", + "h9=hf+x9*hfg \n", + "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\")\n", + "print(\"h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\")\n", + "h11=604.74;\n", + "v11=0.001084;\n", + "print(\"h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\")\n", + "h13=1087.31;\n", + "v13=0.001252;\n", + "print(\"For process 4-8,i.e in CEP.\")\n", + "h8=h4+v4*(4-0.05)*10**2\n", + "print(\"h8 in KJ/kg=\"),round(h8,2)\n", + "print(\"For process 11-12,i.e in FP2,\")\n", + "h12=h11+v11*(40-4)*10**2\n", + "print(\"h12=h11+v11*(40-4)*10^2 in KJ/kg\"),round(h12,2)\n", + "h1_a=h13+v13*(200-40)*10**2\n", + "print(\"For process 13-1_a i.e. in FP1,h1_a= in KJ/kg=\"),round(h1_a,2)\n", + "print(\"m1*3141.81+(1-m1)*608.64=1087.31\")\n", + "print(\"so m1=(1087.31-608.64)/(3141.81-608.64)in kg\")\n", + "m1=(1087.31-608.64)/(3141.81-608.64)\n", + "print(\"Applying energy balance on open feed water heater 1 (OFWH1)\")\n", + "print(\"m1*h10+(1-m1)*h12)=1*h13\")\n", + "m1=(h13-h12)/(h10-h12)\n", + "print(\"so m1 in kg=\"),round(m1,2)\n", + "print(\"Applying energy balance on open feed water heater 2 (OFWH2)\")\n", + "print(\"m2*h9+(1-m1-m2)*h8=(1-m1)*h11\")\n", + "m2=(1-m1)*(h11-h8)/(h9-h8)\n", + "print(\"so m2 in kg=\"),round(m2,2)\n", + "W_CEP=(1-m1-m2)*(h8-h4)\n", + "W_FP1=(h1_a-h13)\n", + "W_FP2=(1-m1)*(h12-h11)\n", + "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", + "print(\"Thermal efficiency of cycle,n=\"),round(n,2)\n", + "print(\"W_CEP in KJ/kg steam from boiler=\"),round(W_CEP,2)\n", + "print(\"W_FP1=(h1_a-h13)in KJ/kg of steam from boiler\"),round(W_FP1)\n", + "print(\"W_FP2 in KJ/kg of steam from boiler=\"),round(W_FP2,2)\n", + "W_CEP+W_FP1+W_FP2\n", + "print(\"W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler=\"),round(W_CEP+W_FP1+W_FP2,2)\n", + "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", + "print(\"n=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so cycle thermal efficiency,na=46.18%\")\n", + "print(\"nb=49.76%\")\n", + "print(\"nc=51.37%\")\n", + "print(\"hence it is obvious that efficiency increases with increase in number of feed heaters.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.7;pg no: 272" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.7, Page:272 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\n", + "from steam tables,\n", + "h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\n", + "s3=s2=6.9759 KJ/kg K\n", + "by interpolation from steam tables,\n", + "T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\n", + "for expansion process 4-5,s4=s5=7.7938 KJ/kg K\n", + "let dryness fraction at state 5 be x5\n", + "s5=sf at 0.05 bar+x5*sfg at 0.05 bar\n", + "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "so x5= 0.92\n", + "h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\n", + "from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\n", + "h6=hf at 0.05 bar=137.82 KJ/kg\n", + "v6=vf at 0.05 bar=0.001005 m^3/kg\n", + "for process 6-1 in feed pump,h1 in KJ/kg= 142.84\n", + "cycle efficiency=W_net/Q_add\n", + "Wt in KJ/kg= 1510.35\n", + "W_pump=(h1-h6)in KJ/kg 5.02\n", + "W_net=Wt-W_pump in KJ/kg 1505.33\n", + "Q_add in KJ/kg= 3290.96\n", + "cycle efficiency= 0.4574\n", + "in percentage= 45.74\n", + "we know ,1 hp=0.7457 KW\n", + "specific steam consumption in kg/hp hr= 1.78\n", + "work ratio=net work/positive work 0.9967\n", + "so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\n" + ] + } + ], + "source": [ + "#cal of cycle efficiency,specific steam consumption,work ratio\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.7, Page:272 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\")\n", + "print(\"from steam tables,\")\n", + "print(\"h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\")\n", + "h2=3433.8;\n", + "s2=6.9759;\n", + "print(\"s3=s2=6.9759 KJ/kg K\")\n", + "s3=s2;\n", + "print(\"by interpolation from steam tables,\")\n", + "print(\"T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\")\n", + "T3=183.14;\n", + "h3=2818.03;\n", + "h4=3271.9;\n", + "s4=7.7938;\n", + "print(\"for expansion process 4-5,s4=s5=7.7938 KJ/kg K\")\n", + "s5=s4;\n", + "print(\"let dryness fraction at state 5 be x5\")\n", + "print(\"s5=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", + "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "x5=(s5-sf)/sfg\n", + "print(\"so x5=\"),round(x5,2)\n", + "x5=0.924;#approx.\n", + "print(\"h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\")\n", + "print(\"from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "h5=hf+x5*hfg \n", + "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", + "h6=137.82;\n", + "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", + "v6=0.001005;\n", + "p1=50.;#steam generation pressure in bar\n", + "p6=0.05;#steam entering temperature in turbine in bar\n", + "h1=h6+v6*(p1-p6)*100\n", + "print(\"for process 6-1 in feed pump,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"cycle efficiency=W_net/Q_add\")\n", + "Wt=(h2-h3)+(h4-h5)\n", + "print(\"Wt in KJ/kg=\"),round(Wt,2)\n", + "W_pump=(h1-h6)\n", + "print(\"W_pump=(h1-h6)in KJ/kg\"),round(W_pump,2)\n", + "W_net=Wt-W_pump\n", + "print(\"W_net=Wt-W_pump in KJ/kg\"),round(W_net,2)\n", + "Q_add=(h2-h1)\n", + "print(\"Q_add in KJ/kg=\"),round(Q_add,2)\n", + "print(\"cycle efficiency=\"),round(W_net/Q_add,4)\n", + "W_net*100/Q_add\n", + "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", + "print(\"we know ,1 hp=0.7457 KW\")\n", + "print(\"specific steam consumption in kg/hp hr=\"),round(0.7457*3600/W_net,2)\n", + "print(\"work ratio=net work/positive work\"),round(W_net/Wt,4)\n", + "print(\"so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.8;pg no: 273" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.8, Page:273 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\n", + "from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\n", + "h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\n", + "Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\n", + "h8=hf at 3 bar=561.47 KJ/kg\n", + "for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\n", + "Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\n", + "s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\n", + "from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\n", + "so x3= 0.95\n", + "s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\n", + "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "so x4= 0.79\n", + "thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\n", + "here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\n", + "h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\n", + "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", + "assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\n", + "pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\n", + "for mixing process between condenser and feed pump,\n", + "(1-m)*h5+m*h9=1*h6\n", + "h6=m(h9-h5)+h5\n", + "we get,h6=137.82+m*423.65\n", + "therefore h7=h6+6.02=143.84+m*423.65\n", + "Applying energy balance at closed feed water heater;\n", + "m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\n", + "so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\n", + "so m=0.144 kg\n", + "steam bled for feed heating=0.144 kg/kg steam generated\n", + "The net power output,W_net in KJ/kg steam generated= 1167.27\n", + "mass of steam required to be generated in kg/s= 26.23\n", + "or in kg/hr\n", + "so capacity of boiler required=94428 kg/hr\n", + "overall thermal efficiency=W_net/Q_add\n", + "here Q_add in KJ/kg= 3134.56\n", + "overall thermal efficiency= 0.37\n", + "in percentage= 37.24\n", + "so overall thermal efficiency=37.24%\n" + ] + } + ], + "source": [ + "#cal of mass of steam bled for feed heating,capacity of boiler required,overall thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.8, Page:273 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\")\n", + "T_cond=115;#condensate temperature in degree celcius\n", + "Cp=4.18;#specific heat at constant pressure in KJ/kg K\n", + "P=30*10**3;#actual alternator output in KW\n", + "n_boiler=0.9;#boiler efficiency\n", + "n_alternator=0.98;#alternator efficiency\n", + "print(\"from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\")\n", + "h2=3301.8;\n", + "s2=6.7193;\n", + "print(\"h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\")\n", + "h5=137.82;\n", + "v5=0.001005;\n", + "print(\"Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\")\n", + "print(\"h8=hf at 3 bar=561.47 KJ/kg\")\n", + "h8=561.47;\n", + "print(\"for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\")\n", + "s3=s2;\n", + "s4=s3;\n", + "print(\"Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\")\n", + "print(\"s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\")\n", + "print(\"from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\")\n", + "sf_3bar=1.6718;\n", + "sfg_3bar=5.3201;\n", + "x3=(s3-sf_3bar)/sfg_3bar\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.949;#approx.\n", + "print(\"s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\")\n", + "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.788;#approx.\n", + "print(\"thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\")\n", + "print(\"here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\")\n", + "hf_3bar=561.47;\n", + "hfg_3bar=2163.8;\n", + "h3=hf_3bar+x3*hfg_3bar \n", + "print(\"h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\")\n", + "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "h4=hf+x4*hfg\n", + "print(\"assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\")\n", + "h9=h8;\n", + "v6=v5;\n", + "print(\"pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\")\n", + "p1=60;#pressure of steam in high pressure turbine in bar\n", + "p5=0.05;#pressure of steam in low pressure turbine in bar\n", + "v5*(p1-p5)*100\n", + "print(\"for mixing process between condenser and feed pump,\")\n", + "print(\"(1-m)*h5+m*h9=1*h6\")\n", + "print(\"h6=m(h9-h5)+h5\")\n", + "print(\"we get,h6=137.82+m*423.65\")\n", + "print(\"therefore h7=h6+6.02=143.84+m*423.65\")\n", + "print(\"Applying energy balance at closed feed water heater;\")\n", + "print(\"m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\")\n", + "print(\"so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\")\n", + "print(\"so m=0.144 kg\")\n", + "m=0.144;\n", + "h6=137.82+m*423.65;\n", + "h7=143.84+m*423.65;\n", + "print(\"steam bled for feed heating=0.144 kg/kg steam generated\")\n", + "W_net=(h2-h3)+(1-m)*(h3-h4)-(1-m)*(h7-h6)\n", + "print(\"The net power output,W_net in KJ/kg steam generated=\"),round(W_net,2)\n", + "P/(n_alternator*W_net)\n", + "print(\"mass of steam required to be generated in kg/s=\"),round(P/(n_alternator*W_net),2)\n", + "print(\"or in kg/hr\")\n", + "26.23*3600\n", + "print(\"so capacity of boiler required=94428 kg/hr\")\n", + "print(\"overall thermal efficiency=W_net/Q_add\")\n", + "Q_add=(h2-Cp*T_cond)/n_boiler\n", + "print(\"here Q_add in KJ/kg=\"),round(Q_add,2) \n", + "W_net/Q_add\n", + "print(\"overall thermal efficiency=\"),round(W_net/Q_add,2)\n", + "W_net*100/Q_add\n", + "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", + "print(\"so overall thermal efficiency=37.24%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.9;pg no: 275" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.9, Page:275 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\n", + "At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\n", + "For ideal expansion process,s2=s3\n", + "By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\n", + "actual stste at exit of first stage,h3_a in KJ/kg= 2909.88\n", + "actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K= 7.1075\n", + "for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\n", + "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", + "so x4= 0.96\n", + "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", + "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", + "actual enthalpy at exit from second stage,h4_a in KJ/kg= 2646.48\n", + "actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\n", + "so x4_a= 0.99\n", + "x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\n", + "for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x5= 0.87\n", + "h5=2270.43 KJ/kg\n", + "actual enthalpy at exit from third stage,h5_a in KJ/kg= 2345.64\n", + "Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\n", + "By heat balance on first closed feed water heater,(see schematic arrangement)\n", + "h11=hf at 6 bar=670.56 KJ\n", + "m1*h3_a+h10=m1*h11+4.18*150\n", + "(m1*2829.63)+h10=(m1*670.56)+627\n", + "h10+2159.07*m1=627\n", + "By heat balance on second closed feed water heater,(see schematic arrangement)\n", + "h7=hf at 1 bar=417.46 KJ/kg\n", + "m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\n", + "m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\n", + "m2*2467.27-m1*179.2-238.26=0\n", + "heat balance at point of mixing,\n", + "h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\n", + "neglecting pump work,h7=h8\n", + "h10=m2*417.46+(1-m1-m2)*397.1\n", + "substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\n", + "Turbine output per kg of steam generated,Wt in KJ/kg of steam generated= 780.445\n", + "Rate of steam generation required in kg/s= 19.22\n", + "in kg/hr\n", + "capacity of drain pump i.e. FP shown in layout in kg/hr= 16273.96\n", + "so capacity of drain pump=16273.96 kg/hr\n" + ] + } + ], + "source": [ + "#cal of capacity of drain pump\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.9, Page:275 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\")\n", + "P=15*10**3;#turbine output in KW\n", + "print(\"At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\")\n", + "h2=3230.9;\n", + "s2=6.9212;\n", + "print(\"For ideal expansion process,s2=s3\")\n", + "s3=s2;\n", + "print(\"By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\")\n", + "T3=190.97;\n", + "h3=2829.63;\n", + "h3_a=h2-0.8*(h2-h3)\n", + "print(\"actual stste at exit of first stage,h3_a in KJ/kg=\"),round(h3_a,2)\n", + "s3_a=7.1075;\n", + "print(\"actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K=\"),round(s3_a,4)\n", + "print(\"for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\")\n", + "s4=7.1075;\n", + "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", + "sf=1.3026;\n", + "sfg=6.0568;\n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.958;#approx.\n", + "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", + "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", + "hf=417.46;\n", + "hfg=2258.0;\n", + "h4=hf+x4*hfg\n", + "h4_a=h3_a-.8*(h3_a-h4)\n", + "print(\"actual enthalpy at exit from second stage,h4_a in KJ/kg=\"),round(h4_a,2)\n", + "print(\"actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\")\n", + "x4_a=(h4_a-hf)/hfg\n", + "print(\"so x4_a=\"),round(x4_a,2)\n", + "print(\"x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\")\n", + "s4_a=7.2806;\n", + "print(\"for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "x5=(s4_a-sf)/sfg\n", + "print(\"so x5=\"),round(x5,2)\n", + "x5=0.8735;#approx.\n", + "print(\"h5=2270.43 KJ/kg\")\n", + "h5=2270.43;\n", + "h5_a=h4_a-0.8*(h4_a-h5)\n", + "print(\"actual enthalpy at exit from third stage,h5_a in KJ/kg=\"),round(h5_a,2)\n", + "print(\"Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\")\n", + "print(\"By heat balance on first closed feed water heater,(see schematic arrangement)\")\n", + "print(\"h11=hf at 6 bar=670.56 KJ\")\n", + "h11=670.56;\n", + "print(\"m1*h3_a+h10=m1*h11+4.18*150\")\n", + "print(\"(m1*2829.63)+h10=(m1*670.56)+627\")\n", + "print(\"h10+2159.07*m1=627\")\n", + "print(\"By heat balance on second closed feed water heater,(see schematic arrangement)\")\n", + "print(\"h7=hf at 1 bar=417.46 KJ/kg\")\n", + "h7=417.46;\n", + "print(\"m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\")\n", + "print(\"m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\")\n", + "print(\"m2*2467.27-m1*179.2-238.26=0\")\n", + "print(\"heat balance at point of mixing,\")\n", + "print(\"h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\")\n", + "print(\"neglecting pump work,h7=h8\")\n", + "print(\"h10=m2*417.46+(1-m1-m2)*397.1\")\n", + "print(\"substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\")\n", + "m1=0.1293;\n", + "m2=0.1059;\n", + "Wt=(h2-h3_a)+(1-m1)*(h3_a-h4_a)+(1-m1-m2)*(h4_a-h5_a)\n", + "print(\"Turbine output per kg of steam generated,Wt in KJ/kg of steam generated=\"),round(Wt,3)\n", + "P/Wt\n", + "print(\"Rate of steam generation required in kg/s=\"),round(P/Wt,2)\n", + "print(\"in kg/hr\")\n", + "P*3600/Wt\n", + "(m1+m2)*69192\n", + "print(\"capacity of drain pump i.e. FP shown in layout in kg/hr=\"),round((m1+m2)*69192,2)\n", + "print(\"so capacity of drain pump=16273.96 kg/hr\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.10;pg no: 277" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.10, Page:277 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\n", + "at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\n", + "By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\n", + "actual enthapy at 3_a,h3_a in KJ/kg= 3097.0\n", + "enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\n", + "for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\n", + "s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x6= 0.83\n", + "h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "for actual expansion process in LP turbine.\n", + "h6_a=h4-0.85*(h4-h6) in KJ/kg 2319.4\n", + "Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\n", + "s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\n", + "from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\n", + "so x5= 1.0\n", + "h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\n", + "from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\n", + "actual enthalpy,h5_a in KJ/kg= 2790.16\n", + "enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\n", + "specific volume at inlet of CEP,v7=0.001008 m^3/kg\n", + "enthalpy at inlet of CEP,h7=168.79 KJ/kg\n", + "for pumping process 7-8,h8 in KJ/kg= 169.15\n", + "Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\n", + "m*h5+(1-m)*h8=h9\n", + "so m in kg /kg of steam generated= 0.33\n", + "For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\n", + "h1= in KJ/kg= 1015.59\n", + "Net work per kg of steam generated,W_net=in KJ/kg steam generated= 938.83\n", + "heat added per kg of steam generated,q_add in KJ/kg of steam generated= 2405.41\n", + "Thermal efficiency,n= 0.39\n", + "in percentage= 39.03\n", + "so thermal efficiency=39.03%%\n", + "NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\n" + ] + } + ], + "source": [ + "#cal of cycle efficiency\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.10, Page:277 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\")\n", + "print(\"at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\")\n", + "h2=3287.1;\n", + "s2=6.6327;\n", + "print(\"By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\")\n", + "h3=3049.48;\n", + "h3_a=h2-0.80*(h2-h3)\n", + "print(\"actual enthapy at 3_a,h3_a in KJ/kg=\"),round(h3_a,2)\n", + "print(\"enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\")\n", + "h4=3230.9;\n", + "s4=6.9212;\n", + "print(\"for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\")\n", + "s6=s4;\n", + "print(\"s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "x6=(s6-sf)/sfg\n", + "print(\"so x6=\"),round(x6,2)\n", + "x6=0.827;#approx.\n", + "print(\"h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0;\n", + "h6=hf+x6*hfg\n", + "print(\"for actual expansion process in LP turbine.\")\n", + "h6_a=h4-0.85*(h4-h6)\n", + "print(\"h6_a=h4-0.85*(h4-h6) in KJ/kg\"),round(h6_a,2)\n", + "print(\"Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\")\n", + "p5=3.61;\n", + "s5=s4;\n", + "print(\"s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\")\n", + "print(\"from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\")\n", + "sf=1.7391;\n", + "sfg=5.1908;\n", + "x5=(s5-sf)/sfg\n", + "print(\"so x5=\"),round(x5,2)\n", + "x5=0.99;#approx.\n", + "print(\"h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\")\n", + "print(\"from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\")\n", + "hf=589.13;\n", + "hfg=2144.7;\n", + "h5=hf+x5*hfg\n", + "h5_a=h4-0.85*(h4-h5)\n", + "print(\"actual enthalpy,h5_a in KJ/kg=\"),round(h5_a,2)\n", + "print(\"enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\")\n", + "h9=1008.42;\n", + "print(\"specific volume at inlet of CEP,v7=0.001008 m^3/kg\")\n", + "v7=0.001008;\n", + "print(\"enthalpy at inlet of CEP,h7=168.79 KJ/kg\")\n", + "h7=168.79;\n", + "h8=h7+v7*(3.61-0.075)*10**2\n", + "print(\"for pumping process 7-8,h8 in KJ/kg=\"),round(h8,2)\n", + "print(\"Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\")\n", + "print(\"m*h5+(1-m)*h8=h9\")\n", + "m=(h9-h8)/(h5-h8)\n", + "print(\"so m in kg /kg of steam generated=\"),round(m,2)\n", + "print(\"For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\")\n", + "v9=0.00108;\n", + "h1=h9+v9*(70-3.61)*10**2\n", + "print(\"h1= in KJ/kg=\"),round(h1,2) \n", + "W_net=(h2-h3_a)+(h4-h5_a)+(1-m)*(h5_a-h6_a)-((1-m)*(h8-h7)+(h1-h9))\n", + "print(\"Net work per kg of steam generated,W_net=in KJ/kg steam generated=\"),round(W_net,2)\n", + "q_add=(h2-h1)+(h4-h3_a)\n", + "print(\"heat added per kg of steam generated,q_add in KJ/kg of steam generated=\"),round(q_add,2)\n", + "n=W_net/q_add\n", + "print(\"Thermal efficiency,n=\"),round(n,2)\n", + "n=n*100\n", + "print(\"in percentage=\"),round(n,2)\n", + "print(\"so thermal efficiency=39.03%%\")\n", + "print(\"NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.11;pg no: 279" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.11, Page:279 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\n", + "Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\n", + "for isentropic expansion 2-3-4-5,s2=s3=s4=s5\n", + "Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\n", + "s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\n", + "so x3=(s3-sf)/sfg\n", + "from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\n", + "h3=hf+x3*hfg in KJ/kg\n", + "from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\n", + "s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\n", + "so x4=(s4-sf)/sfg\n", + "from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\n", + "so h4=hf+x4*hfg in KJ/kg\n", + "from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\n", + "s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\n", + "so x5=(s5-sf)/sfg\n", + "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "h5=hf+x5*hfg in KJ/kg\n", + "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", + "h6=hf at 0.05 bar=137.82 KJ/kg\n", + "v6=vf at 0.05 bar=0.001005 m^3/kg\n", + "h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\n", + "h8=hf at 1.5 bar=467.11 KJ/kg\n", + "v8=0.001053 m^3/kg=vf at 1.5 bar\n", + "h9=h8+v8*(150-1.5)*10^2 in KJ/kg\n", + "h10=hf at 150 bar=1610.5 KJ/kg\n", + "v10=0.001658 m^3/kg=vf at 150 bar\n", + "h12=h10+v10*(150-10)*10^2 in KJ/kg\n", + "Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\n", + "Heat balance on closed feed water heater yields,\n", + "m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\n", + "so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\n", + "heat balance on open feed water can be given as under,\n", + "m2*h4+(1-m1-m2)*h7=(1-m1)*h8\n", + "so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\n", + "for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\n", + "For mixing after closed feed water heater,\n", + "h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\n", + "Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\n", + "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\n", + "heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\n", + "cycle thermal efficiency,n=W_net/q_add 0.48\n", + "in percentage 47.59\n", + "Net power developed in KW=1219*300 in KW 365700.0\n", + "cycle thermal efficiency=47.6%\n", + "Net power developed=365700 KW\n" + ] + } + ], + "source": [ + "#cal of cycle thermal efficiency,Net power developed\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.11, Page:279 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\")\n", + "print(\"Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\")\n", + "h2=3308.6;\n", + "s2=6.3443;\n", + "print(\"for isentropic expansion 2-3-4-5,s2=s3=s4=s5\")\n", + "s3=s2;\n", + "s4=s3;\n", + "s5=s4;\n", + "print(\"Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\")\n", + "print(\"s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\")\n", + "print(\"so x3=(s3-sf)/sfg\")\n", + "print(\"from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\")\n", + "sf=2.1387;\n", + "sfg=4.4478;\n", + "x3=(s3-sf)/sfg\n", + "x3=0.945;#approx.\n", + "print(\"h3=hf+x3*hfg in KJ/kg\")\n", + "print(\"from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\")\n", + "hf=762.81;\n", + "hfg=2015.3;\n", + "h3=hf+x3*hfg\n", + "print(\"s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\")\n", + "print(\"so x4=(s4-sf)/sfg\")\n", + "print(\"from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\")\n", + "sf=1.4336;\n", + "sfg=5.7897;\n", + "x4=(s4-sf)/sfg\n", + "x4=0.848;#approx.\n", + "print(\"so h4=hf+x4*hfg in KJ/kg\")\n", + "print(\"from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\")\n", + "hf=467.11;\n", + "hfg=2226.5;\n", + "h4=hf+x4*hfg\n", + "print(\"s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", + "print(\"so x5=(s5-sf)/sfg\")\n", + "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "x5=(s5-sf)/sfg\n", + "x5=0.739;#approx.\n", + "print(\"h5=hf+x5*hfg in KJ/kg\")\n", + "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "h5=hf+x5*hfg \n", + "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", + "h6=137.82;\n", + "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", + "v6=0.001005;\n", + "print(\"h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\")\n", + "h7=h6+v6*(1.5-0.05)*10**2\n", + "print(\"h8=hf at 1.5 bar=467.11 KJ/kg\")\n", + "h8=467.11; \n", + "print(\"v8=0.001053 m^3/kg=vf at 1.5 bar\")\n", + "v8=0.001053;\n", + "print(\"h9=h8+v8*(150-1.5)*10^2 in KJ/kg\")\n", + "h9=h8+v8*(150-1.5)*10**2\n", + "print(\"h10=hf at 150 bar=1610.5 KJ/kg\")\n", + "h10=1610.5; \n", + "print(\"v10=0.001658 m^3/kg=vf at 150 bar\")\n", + "v10=0.001658;\n", + "print(\"h12=h10+v10*(150-10)*10^2 in KJ/kg\")\n", + "h12=h10+v10*(150-10)*10**2\n", + "print(\"Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\")\n", + "print(\"Heat balance on closed feed water heater yields,\")\n", + "print(\"m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\")\n", + "print(\"so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\")\n", + "m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)\n", + "print(\"heat balance on open feed water can be given as under,\")\n", + "print(\"m2*h4+(1-m1-m2)*h7=(1-m1)*h8\")\n", + "print(\"so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\")\n", + "m2=((1-m1)*(h8-h7))/(h4-h7)\n", + "print(\"for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\")\n", + "print(\"For mixing after closed feed water heater,\")\n", + "print(\"h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\")\n", + "h1=(4.18*150)*(1-m1)+m1*h12\n", + "print(\"Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\")\n", + "print(\"W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\")\n", + "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-((1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10)))\n", + "print(\"heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\")\n", + "q_add=(h2-h1)\n", + "n=W_net/q_add\n", + "print(\"cycle thermal efficiency,n=W_net/q_add\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"Net power developed in KW=1219*300 in KW\"),round(1219*300,2)\n", + "print(\"cycle thermal efficiency=47.6%\")\n", + "print(\"Net power developed=365700 KW\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.12;pg no: 282" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.12, Page:282 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\n", + "At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", + "For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\n", + "state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\n", + "since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\n", + "At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", + "At state 3,h3=2930.57 KJ/kg\n", + "At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\n", + "At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\n", + "From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\n", + "Let dryness fraction at state 5_a be x5,\n", + "s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x5_a=(s5_a-sf)/sfg\n", + "h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\n", + "from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\n", + "Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\n", + "m1_a*h3+h9=m1*h10+4.18*200\n", + "so m1_a=(4.18*200-h9)/(h3-h10) in kg\n", + "Applying heat balance at open feed water heater,\n", + "m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\n", + "so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\n", + "Net work per kg steam generated\n", + "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\n", + "Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\n", + "Thermal efficiency,n= 0.45\n", + "in percentage 45.04\n", + "% increase in thermal efficiency due to reheating= 0.56\n", + "so thermal efficiency of reheat cycle=45.03%\n", + "% increase in efficiency due to reheating=0.56%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,steam generation rate\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.12, Page:282 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\")\n", + "P=100*10**3;#net power output in KW\n", + "print(\"At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", + "h2=3373.7;\n", + "s2=6.5966;\n", + "print(\"For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\")\n", + "s3=s2;\n", + "s4=s3;\n", + "s5=s4;\n", + "print(\"state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\")\n", + "T3=261.6;\n", + "h3=2930.57;\n", + "print(\"since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\")\n", + "print(\"At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", + "h2=3373.7;\n", + "s2=6.5966;\n", + "print(\"At state 3,h3=2930.57 KJ/kg\")\n", + "h3=2930.57;\n", + "print(\"At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\")\n", + "h3_a=3247.6;\n", + "s3_a=7.1271;\n", + "print(\"At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\")\n", + "s4_a=s3_a;\n", + "s5_a=s4_a;\n", + "print(\"From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\")\n", + "h4_a=2841.02;\n", + "print(\"Let dryness fraction at state 5_a be x5,\")\n", + "print(\"s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "print(\"so x5_a=(s5_a-sf)/sfg\")\n", + "x5_a=(s5_a-sf)/sfg\n", + "x5_a=0.853;#approx.\n", + "print(\"h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "h5_a=hf+x5_a*hfg\n", + "print(\"Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\")\n", + "print(\"m1_a*h3+h9=m1*h10+4.18*200\")\n", + "print(\"so m1_a=(4.18*200-h9)/(h3-h10) in kg\")\n", + "m1_a=(4.18*200-h9)/(h3-h10)\n", + "m1_a=0.114;#approx.\n", + "print(\"Applying heat balance at open feed water heater,\")\n", + "print(\"m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\")\n", + "print(\"so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\")\n", + "m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7)\n", + "m2_a=0.131;#approx.\n", + "print(\"Net work per kg steam generated\")\n", + "print(\"w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\")\n", + "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-((1-m1_a-m2_a)*(h7-h6)+(h9-h8))\n", + "print(\"Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\")\n", + "q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)\n", + "n=w_net/q_add\n", + "print(\"Thermal efficiency,n=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"% increase in thermal efficiency due to reheating=\"),round((0.4503-0.4478)*100/0.4478,2)\n", + "print(\"so thermal efficiency of reheat cycle=45.03%\")\n", + "print(\"% increase in efficiency due to reheating=0.56%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.13;pg no: 286" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.13, Page:286 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\n", + "For mercury cycle,\n", + "insentropic heat drop=349-234.5 in KJ/kg Hg\n", + "actual heat drop=0.85*114.5 in KJ/kg Hg\n", + "Heat rejected in condenser=(349-97.325-35)in KJ/kg\n", + "heat added in boiler=349-35 in KJ/kg\n", + "For steam cycle,\n", + "Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\n", + "Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\n", + "Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\n", + "Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\n", + "Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\n", + "for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\n", + "state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\n", + "state 4 lies in wet region,say with dryness fraction x4\n", + "s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\n", + "so x4=(s4-sf)/sfg\n", + "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", + "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", + "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", + "Let state 5 lie in wet region with dryness fraction x5,\n", + "s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\n", + "so x5=(s5-sf)/sfg\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "h5=hf+x5*hfg in KJ/kg\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\n", + "h7=h6+v6*(1-0.075)*10^2 in KJ/kg\n", + "from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\n", + "h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\n", + "Applying heat balance on CFWH1,T1=150oc and also T15=150oc\n", + "m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\n", + "(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\n", + "Applying heat balance on CFEH2,T11=90oc\n", + "m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\n", + "(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\n", + "Heat balance at mixing between CFWH1 and CFWH2,\n", + "(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\n", + "376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\n", + "For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\n", + "from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\n", + "solving above equations,we get\n", + "m1=0.102 kg per kg steam generated\n", + "m2=0.073 kg per kg steam generated\n", + "pump work in process 13-14,h14-h13=v13*(40-8)*10^2\n", + "so h14-h13 in KJ/kg\n", + "Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\n", + "net work per kg of steam,w_net=w_mercury+w_steam\n", + "w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\n", + "thermal efficiency of binary vapour cycle=w_net/q_add 0.55\n", + "in percentage 55.36\n", + "so thermal efficiency=55.36%\n", + "NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.13, Page:286 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\")\n", + "print(\"For mercury cycle,\")\n", + "print(\"insentropic heat drop=349-234.5 in KJ/kg Hg\")\n", + "349-234.5\n", + "print(\"actual heat drop=0.85*114.5 in KJ/kg Hg\")\n", + "0.85*114.5\n", + "print(\"Heat rejected in condenser=(349-97.325-35)in KJ/kg\")\n", + "(349-97.325-35)\n", + "print(\"heat added in boiler=349-35 in KJ/kg\")\n", + "349-35\n", + "print(\"For steam cycle,\")\n", + "print(\"Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\")\n", + "h=2767.13;\n", + "print(\"Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\")\n", + "h2=3330.3;\n", + "print(\"Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\")\n", + "s2=6.9363;\n", + "print(\"Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\")\n", + "h-4.18*150\n", + "print(\"Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\")\n", + "2140.13/216.675\n", + "print(\"for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\")\n", + "s3=s2;\n", + "s4=s3;\n", + "s5=s4;\n", + "print(\"state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\")\n", + "h3=2899.23;\n", + "print(\"state 4 lies in wet region,say with dryness fraction x4\")\n", + "print(\"s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\")\n", + "print(\"so x4=(s4-sf)/sfg\")\n", + "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", + "sf=1.3026;\n", + "sfg=6.0568;\n", + "x4=(s4-sf)/sfg\n", + "x4=0.93;#approx.\n", + "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", + "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", + "hf=417.46;\n", + "hfg=2258.0;\n", + "h4=hf+x4*hfg\n", + "print(\"Let state 5 lie in wet region with dryness fraction x5,\")\n", + "print(\"s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", + "print(\"so x5=(s5-sf)/sfg\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "x5=(s5-sf)/sfg\n", + "x5=0.828;#approx.\n", + "print(\"h5=hf+x5*hfg in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0;\n", + "h5=hf+x5*hfg\n", + "print(\"Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\")\n", + "print(\"h7=h6+v6*(1-0.075)*10^2 in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\")\n", + "h6=168.79;\n", + "v6=0.001008;\n", + "h7=h6+v6*(1-0.075)*10**2\n", + "print(\"h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\")\n", + "h9=417.46;\n", + "h13=721.11;\n", + "print(\"Applying heat balance on CFWH1,T1=150oc and also T15=150oc\")\n", + "T1=150;\n", + "T15=150;\n", + "print(\"m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\")\n", + "print(\"(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\")\n", + "print(\"Applying heat balance on CFEH2,T11=90oc\")\n", + "T11=90;\n", + "print(\"m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\")\n", + "print(\"(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\")\n", + "print(\"Heat balance at mixing between CFWH1 and CFWH2,\")\n", + "print(\"(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\")\n", + "print(\"376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\")\n", + "print(\"For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\")\n", + "print(\"from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\")\n", + "h9=417.46;\n", + "v9=0.001043;\n", + "h10=h9+v9*(8-1)*10**2 \n", + "print(\"solving above equations,we get\")\n", + "print(\"m1=0.102 kg per kg steam generated\")\n", + "print(\"m2=0.073 kg per kg steam generated\")\n", + "m1=0.102;\n", + "m2=0.073;\n", + "print(\"pump work in process 13-14,h14-h13=v13*(40-8)*10^2\")\n", + "print(\"so h14-h13 in KJ/kg\")\n", + "v13=0.001252;\n", + "v13*(40-8)*10**2\n", + "print(\"Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\")\n", + "q_add=(9.88*314)+(3330.3-2767.13)\n", + "print(\"net work per kg of steam,w_net=w_mercury+w_steam\")\n", + "print(\"w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\")\n", + "w_net=(9.88*97.325)+((h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h7-h6)-m2*(h10-h9)-m1*4.006)\n", + "print(\"thermal efficiency of binary vapour cycle=w_net/q_add\"),round(w_net/q_add,2)\n", + "print(\"in percentage\"),round(w_net*100/q_add,2)\n", + "print(\"so thermal efficiency=55.36%\")\n", + "print(\"NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.14;pg no: 288" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.14, Page:288 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\n", + "This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\n", + "For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\n", + "ideally, s2=s1=6.7664 KJ/kg K\n", + "s2=sf at 0.075 bar +x3* sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x3=(s2-sf)/sfg\n", + "h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\n", + "for LP:at inlet of LP steam\n", + "h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\n", + "Enthalpy at exit,h_3LP=2222.34 KJ/kg\n", + "actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\n", + "HP steam consumption at full load=P*0.7457/h_HP in kg/s\n", + "HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\n", + "LP steam consumption at full load=P*0.7457/h_LP in kg/s\n", + "LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\n", + "The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\n", + "or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\n", + "Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\n", + "x=load,hp\n", + "y_HP=m_HP*x+C_HP\n", + "0.254=m_HP*0+C_HP\n", + "so C_HP=0.254\n", + "2.54=m_HP*2500+C_HP\n", + "so m_HP=(2.54-C_HP)/2500\n", + "so y_HP=9.144*10^-4*x_HP+0.254\n", + "Willans line for LP:y_LP=m_LP*x_LP+C_LP\n", + "0.481=m_LP*0+C_LP\n", + "so C_LP=0.481\n", + "4.81=m_LP*2500+C_LP\n", + "so m_LP=(4.81-C_LP)/2500\n", + "so y_LP=1.732*10^-3*x_LP+0.481\n", + "Total output(load) from mixed turbine,x=x_HP+x_LP\n", + "For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\n", + "from y_LP=1.732*10^-3*x_LP+0.481,\n", + "x_LP=(y_LP-0.481)/1.732*10^-3\n", + "since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\n", + "from y_HP=9.144*10^-4*x_HP+C_HP in kg/s 0.63\n", + "so HP steam requirement=0.63 kg/s\n" + ] + } + ], + "source": [ + "#cal of HP steam required\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.14, Page:288 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\")\n", + "n=0.8;#efficiency of both HP and LP turbine\n", + "P=2500;#output in hp\n", + "print(\"This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\")\n", + "print(\"For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\")\n", + "h1=3023.5;\n", + "s1=6.7664;\n", + "print(\"ideally, s2=s1=6.7664 KJ/kg K\")\n", + "s2=s1;\n", + "print(\"s2=sf at 0.075 bar +x3* sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "print(\"so x3=(s2-sf)/sfg\")\n", + "x3=(s2-sf)/sfg\n", + "x3=0.806;#approx.\n", + "print(\"h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0; \n", + "h_3HP=hf+x3*hfg\n", + "print(\"actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\")\n", + "h_HP=(h1-h_3HP)*n\n", + "print(\"for LP:at inlet of LP steam\")\n", + "print(\"h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\")\n", + "h2=2706.7;\n", + "s2=7.1271;\n", + "print(\"Enthalpy at exit,h_3LP=2222.34 KJ/kg\")\n", + "h_3LP=2222.34;\n", + "print(\"actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\")\n", + "h_LP=(h2-h_3LP)*n\n", + "print(\"HP steam consumption at full load=P*0.7457/h_HP in kg/s\")\n", + "P*0.7457/h_HP\n", + "print(\"HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\")\n", + "0.10*(P*0.7457/h_HP)\n", + "print(\"LP steam consumption at full load=P*0.7457/h_LP in kg/s\")\n", + "P*0.7457/h_LP\n", + "print(\"LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\")\n", + "0.10*(P*0.7457/h_LP)\n", + "print(\"The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\")\n", + "print(\"or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\")\n", + "print(\"Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\")\n", + "print(\"x=load,hp\")\n", + "print(\"y_HP=m_HP*x+C_HP\")\n", + "print(\"0.254=m_HP*0+C_HP\")\n", + "print(\"so C_HP=0.254\")\n", + "C_HP=0.254;\n", + "print(\"2.54=m_HP*2500+C_HP\")\n", + "print(\"so m_HP=(2.54-C_HP)/2500\")\n", + "m_HP=(2.54-C_HP)/2500\n", + "print(\"so y_HP=9.144*10^-4*x_HP+0.254\")\n", + "print(\"Willans line for LP:y_LP=m_LP*x_LP+C_LP\")\n", + "print(\"0.481=m_LP*0+C_LP\")\n", + "print(\"so C_LP=0.481\")\n", + "C_LP=0.481;\n", + "print(\"4.81=m_LP*2500+C_LP\")\n", + "print(\"so m_LP=(4.81-C_LP)/2500\")\n", + "m_LP=(4.81-C_LP)/2500\n", + "print(\"so y_LP=1.732*10^-3*x_LP+0.481\")\n", + "print(\"Total output(load) from mixed turbine,x=x_HP+x_LP\")\n", + "print(\"For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\")\n", + "y_LP=1.5;\n", + "print(\"from y_LP=1.732*10^-3*x_LP+0.481,\")\n", + "print(\"x_LP=(y_LP-0.481)/1.732*10^-3\")\n", + "x_LP=(y_LP-0.481)/(1.732*10**-3)\n", + "print(\"since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\")\n", + "x_HP=411.66;\n", + "y_HP=9.144*10**-4*x_HP+C_HP\n", + "print(\"from y_HP=9.144*10^-4*x_HP+C_HP in kg/s\"),round(y_HP,2)\n", + "print(\"so HP steam requirement=0.63 kg/s\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.15;pg no: 289" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.15, Page:289 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\n", + "Let us carry out analysis for 1 kg of steam generated in boiler.\n", + "Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\n", + "state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\n", + "Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\n", + "so x3= 0.86\n", + "from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\n", + "h3=2404.94 KJ/kg\n", + "If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\n", + "mass of moisture retained in separator(m)=(1-x3)*0.5 kg\n", + "Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\n", + "Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\n", + "Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\n", + "(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\n", + "so T in degree celcius= 68.425\n", + "so temperature of water leaving hotwell=68.425 degree celcius\n", + "Applying heat balanced on trap\n", + "0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\n", + "so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\n", + "from steam tables,at 2 bar,hf=504.70 KJ/kg\n", + "Therefore,heat transferred in process heater in KJ/kg steam generated= 1023.172\n", + "so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\n", + "For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\n", + "Let dryness fraction be x10\n", + "s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x10=(s10-sf)/sfg\n", + "h10=hf at 0.075 bar+x10*hfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "so h10=hf+x10*hfg in KJ/kg \n", + "net work output,neglecting pump work per kg of steam generated,\n", + "w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\n", + "Heat added in boiler per kg steam generated,q_add in KJ/kg= 2674.68\n", + "thermal efficiency=w_net/q_add 0.28\n", + "in percentage 27.59\n", + "so Thermal efficiency=27.58%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,heat transferred and temperature\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.15, Page:289 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\")\n", + "print(\"Let us carry out analysis for 1 kg of steam generated in boiler.\")\n", + "print(\"Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\")\n", + "h2=2960.7;\n", + "s2=6.3615;\n", + "print(\"state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\")\n", + "s3=s2;\n", + "print(\"Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\")\n", + "sf=1.5301;\n", + "sfg=5.5970;\n", + "x3=(s3-sf)/sfg\n", + "print(\"so x3=\"),round(x3,2)\n", + "print(\"from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\")\n", + "x3=0.863;#approx.\n", + "print(\"h3=2404.94 KJ/kg\")\n", + "h3=2404.94;\n", + "print(\"If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\")\n", + "print(\"mass of moisture retained in separator(m)=(1-x3)*0.5 kg\")\n", + "m=(1-x3)*0.5\n", + "print(\"Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\")\n", + "m_LP=0.5-m\n", + "print(\"Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\")\n", + "print(\"Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\")\n", + "print(\"(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\")\n", + "T=((0.5685*4.18*90)+(0.4315*4.18*40))/4.18\n", + "print(\"so T in degree celcius=\"),round(T,3)\n", + "print(\"so temperature of water leaving hotwell=68.425 degree celcius\")\n", + "print(\"Applying heat balanced on trap\")\n", + "print(\"0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\")\n", + "print(\"so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\")\n", + "print(\"from steam tables,at 2 bar,hf=504.70 KJ/kg\")\n", + "hf=504.70;\n", + "h7=((0.5685*4.18*90)-(0.0685*hf))/0.5\n", + "print(\"Therefore,heat transferred in process heater in KJ/kg steam generated=\"),round(0.5*(h3-h7),3)\n", + "print(\"so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\")\n", + "print(\"For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\")\n", + "s10=s3;\n", + "print(\"Let dryness fraction be x10\")\n", + "print(\"s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "print(\"so x10=(s10-sf)/sfg\")\n", + "x10=(s10-sf)/sfg\n", + "x10=0.754;#approx.\n", + "print(\"h10=hf at 0.075 bar+x10*hfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0;\n", + "print(\"so h10=hf+x10*hfg in KJ/kg \")\n", + "h10=hf+x10*hfg \n", + "print(\"net work output,neglecting pump work per kg of steam generated,\")\n", + "print(\"w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\")\n", + "w_net=(h2-h3)*1+0.4315*(h3-h10) \n", + "q_add=(h2-4.18*68.425)\n", + "print(\"Heat added in boiler per kg steam generated,q_add in KJ/kg=\"),round(q_add,2)\n", + "w_net/q_add\n", + "print(\"thermal efficiency=w_net/q_add\"),round(w_net/q_add,2)\n", + "print(\"in percentage\"),round(w_net*100/q_add,2)\n", + "print(\"so Thermal efficiency=27.58%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.16;pg no: 291" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.16, Page:291 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\n", + "from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\n", + "Assuming isentropic expansion in nozzle,s1=s2=6.9486\n", + "Letdryness fraction at state 2,x2=0.864\n", + "s2=sf at 0.2 bar+x2*sfg at 0.2 bar\n", + "from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\n", + "so x2= 0.86\n", + "hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\n", + "from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\n", + "considering pump work to be of isentropic type,deltah_34=v3*deltap_34\n", + "from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\n", + "or deltah_34 in KJ/kg= 7.1\n", + "pump work,Wp in KJ/kg= 7.1\n", + "turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\n", + "net work(W_net)=Wt-Wp in KJ/kg\n", + "power produced(P)=mass flow rate*W_net in KJ/s\n", + "so net power=43.22 MW\n", + "heat supplied in boiler(Q)=(h1-h4) in KJ/kg\n", + "enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\n", + "total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s 114534.05\n", + "thermal efficiency=net work/heat supplied=W_net/Q 0.38\n", + "in percentage 37.73\n", + "so thermal efficiency=37.73%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,net power\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.16, Page:291 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\")\n", + "m=35;#mass flow rate in kg/s\n", + "print(\"from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\")\n", + "h1=3530.9;\n", + "s1=6.9486;\n", + "print(\"Assuming isentropic expansion in nozzle,s1=s2=6.9486\")\n", + "s2=s1;\n", + "print(\"Letdryness fraction at state 2,x2=0.864\")\n", + "print(\"s2=sf at 0.2 bar+x2*sfg at 0.2 bar\")\n", + "print(\"from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\")\n", + "sf=0.8320;\n", + "sfg=7.0766;\n", + "x2=(s2-sf)/sfg\n", + "print(\"so x2=\"),round(x2,2)\n", + "x2=0.864;#approx.\n", + "print(\"hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\")\n", + "print(\"from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\")\n", + "hf=251.4;\n", + "hfg=2358.3;\n", + "h2=hf+x2*hfg\n", + "print(\"considering pump work to be of isentropic type,deltah_34=v3*deltap_34\")\n", + "print(\"from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\")\n", + "v3=0.001017;\n", + "p3=70;#;pressure of steam entering turbine in bar\n", + "p4=0.20;#condenser pressure in bar\n", + "deltah_34=v3*(p3-p4)*100\n", + "print(\"or deltah_34 in KJ/kg=\"),round(deltah_34,2)\n", + "Wp=deltah_34\n", + "print(\"pump work,Wp in KJ/kg=\"),round(Wp,2)\n", + "print(\"turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\")\n", + "Wt=(h1-h2)\n", + "print(\"net work(W_net)=Wt-Wp in KJ/kg\")\n", + "W_net=Wt-Wp\n", + "print(\"power produced(P)=mass flow rate*W_net in KJ/s\")\n", + "P=m*W_net\n", + "print(\"so net power=43.22 MW\")\n", + "print(\"heat supplied in boiler(Q)=(h1-h4) in KJ/kg\")\n", + "print(\"enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\")\n", + "h3=hf;\n", + "h4=h3+deltah_34 \n", + "Q=m*(h1-h4)\n", + "print(\"total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s\"),round(Q,2)\n", + "print(\"thermal efficiency=net work/heat supplied=W_net/Q\"),round(P/Q,2)\n", + "print(\"in percentage\"),round(P*100/Q,2)\n", + "print(\"so thermal efficiency=37.73%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.17;pg no: 292" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.1, Page:292 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 17\n", + "from steam tables,h1=3625.3 KJ/s,s1=6.9029 KJ/kg K\n", + "due to isentropic expansion,s1=s2=s3=6.9029 KJ/kg K\n", + "at state 2,i.e at pressure of 2 MPa and entropy 6.9029 KJ/kg K\n", + "by interpolating state for s2 between 2 MPa,300 degree celcius and 2 MPa,350 degree celcius from steam tables,\n", + "h2=3105.08 KJ/kg \n", + "for state 3,i.e at pressure of 0.01 MPa entropy,s3 lies in wet region as s3In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,mass of steam\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.18, Page:294 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 18\")\n", + "W_net=50*10**3;#net output of turbine in KW\n", + "print(\"from steam tables,at inlet to first stage of turbine,h1=h at 100 bar,500oc=3373.7 KJ/kg,s1=s at 100 bar,500oc=6.5966 KJ/kg\")\n", + "h1=3373.7;\n", + "s1=6.5966;\n", + "print(\"Due to isentropic expansion,s1=s6=s2 and s3=s8=s4\")\n", + "s2=s1;\n", + "s6=s2;\n", + "print(\"State at 6 i.e bleed state from HP turbine,temperature by interpolation from steam table =261.6oc.\")\n", + "print(\"At inlet to second stage of turbine,h6=2930.572 KJ/kg\")\n", + "h6=2930.572;\n", + "print(\"h3=h at 10 bar,500oc=3478.5 KJ/kg,s3=s at 10 bar,500oc=7.7622 KJ/kg K\")\n", + "h3=3478.5;\n", + "s3=7.7622;\n", + "s4=s3;\n", + "s8=s4;\n", + "print(\"At exit from first stage of turbine i.e. at 10 bar and entropy of 6.5966 KJ/kg K,Temperature by interpolation from steam table at 10 bar and entropy of 6.5966 KJ/kg K\")\n", + "print(\"T2=181.8oc,h2=2782.8 KJ/kg\")\n", + "T2=181.8;\n", + "h2=2782.8;\n", + "print(\"state at 8,i.e bleed state from second stage of expansion,i.e at 4 bar and entropy of 7.7622 KJ/kg K,Temperature by interpolation from steam table,T8=358.98oc=359oc\")\n", + "T8=359;\n", + "print(\"h8=3188.7 KJ/kg\")\n", + "h8=3188.7;\n", + "print(\"state at 4 i.e. at condenser pressure of 0.1 bar and entropy of 7.7622 KJ/kg K,the state lies in wet region.So let the dryness fraction be x4.\")\n", + "print(\"s4=sf at 0.1 bar+x4*sfg at 0.1 bar\")\n", + "print(\"from steam tables,at 0.1 bar,sf=0.6493 KJ/kg K,sfg=7.5009 KJ/kg K\")\n", + "sf=0.6493;\n", + "sfg=7.5009; \n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.95;#approx.\n", + "print(\"h4=hf at 0.1 bar+x4*hfg at 0.1 bar in KJ/kg \")\n", + "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,hfg=2392.8 KJ/kg\")\n", + "hf=191.83;\n", + "hfg=2392.8;\n", + "h4=hf+x4*hfg\n", + "print(\"given,h4=2464.99 KJ/kg,h11=856.8 KJ/kg,h9=hf at 4 bar=604.74 KJ/kg\")\n", + "h4=2464.99;\n", + "h11=856.8;\n", + "h9=604.74;\n", + "print(\"considering pump work,the net output can be given as,\")\n", + "print(\"W_net=W_HPT+W_LPT-(W_CEP+W_FP)\")\n", + "print(\"where,W_HPT={(h1-h6)+(1-m6)*(h6-h2)}per kg of steam from boiler.\")\n", + "print(\"W_LPT={(1-m6)+(h3-h8)*(1-m6-m8)*(h8-h4)}per kg of steam from boiler.\")\n", + "print(\"for closed feed water heater,energy balance yields;\")\n", + "print(\"m6*h6+h10=m6*h7+h11\")\n", + "print(\"assuming condensate leaving closed feed water heater to be saturated liquid,\")\n", + "print(\"h7=hf at 20 bar=908.79 KJ/kg\")\n", + "h7=908.79; \n", + "print(\"due to throttline,h7=h7_a=908.79 KJ/kg\")\n", + "h7_a=h7;\n", + "print(\"for open feed water heater,energy balance yields,\")\n", + "print(\"m6*h7_a+m8*h8+(1-m6-m8)*h5=h9\")\n", + "print(\"for condensate extraction pump,h5-h4_a=v4_a*deltap\")\n", + "print(\"h5-hf at 0.1 bar=vf at 0.1 bar*(4-0.1)*10^2 \")\n", + "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,vf=0.001010 m^3/kg\")\n", + "hf=191.83;\n", + "vf=0.001010; \n", + "h5=hf+vf*(4-0.1)*10**2\n", + "print(\"so h5 in KJ/kg=\"),round(h5,2)\n", + "print(\"for feed pump,h10-h9=v9*deltap\")\n", + "print(\"h10=h9+vf at 4 bar*(100-4)*10^2 in KJ/kg\")\n", + "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,vf=0.001084 m^3/kg \")\n", + "hf=604.74;\n", + "vf=0.001084;\n", + "h10=h9+vf*(100-4)*10**2\n", + "print(\"substituting in energy balance upon closed feed water heater,\")\n", + "m6=(h11-h10)/(h6-h7)\n", + "print(\"m6 in kg per kg of steam from boiler=\"),round(m6,3)\n", + "print(\"substituting in energy balance upon feed water heater,\")\n", + "m8=(h9-m6*h7_a+m6*h5-h5)/(h8-h5)\n", + "print(\"m8 in kg per kg of steam from boiler=\"),round(m8,3)\n", + "print(\"Let the mass of steam entering first stage of turbine be m kg,then\")\n", + "{(h1-h6)+(1-m6)*(h6-h2)}\n", + "print(\"W_HPT=m*{(h1-h6)+(1-m6)*(h6-h2)}\")\n", + "print(\"W_HPT/m=\"),round(((h1-h6)+(1-m6)*(h6-h2)),2)\n", + "print(\"so W_HPT=m*573.24 KJ\")\n", + "print(\"also,W_LPT={(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}per kg of steam from boiler\")\n", + "{(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}\n", + "print(\"W_LPT/m=\"),round(((1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)),2)\n", + "print(\"so W_LPT=m*813.42 KJ\")\n", + "print(\"pump works(negative work)\")\n", + "print(\"W_CEP=m*(1-m6-m8)*(h5-h4_a)\")\n", + "h4_a=191.83;#h4_a=hf at 0.1 bar\n", + "print(\"W_CEP/m=\")\n", + "(1-m6-m8)*(h5-h4_a)\n", + "print(\"so W_CEP=m* 0.304\")\n", + "print(\"W_FP=m*(h10-h9)\")\n", + "print(\"W_FP/m=\"),round((h10-h9),2)\n", + "print(\"so W_FP=m*10.41\")\n", + "print(\"net output,\")\n", + "print(\"W_net=W_HPT+W_LPT-W_CEP-W_FP \")\n", + "print(\"so 50*10^3=(573.24*m+813.42*m-0.304*m-10.41*m)\")\n", + "m=W_net/(573.24+813.42-0.304-10.41)\n", + "print(\"so m in kg/s=\"),round(m,2)\n", + "Q_add=m*(h1-h11)\n", + "print(\"heat supplied in boiler,Q_add in KJ/s=\"),round(m*(h1-h11),2)\n", + "print(\"Thermal efficenncy=\"),round(W_net/Q_add,2)\n", + "print(\"in percentage\"),round(W_net*100/Q_add,2)\n", + "print(\"so mass of steam bled at 20 bar=0.119 kg per kg of steam entering first stage\")\n", + "print(\"mass of steam bled at 4 bar=0.109 kg per kg of steam entering first stage\")\n", + "print(\"mass of steam entering first stage=36.33 kg/s\")\n", + "print(\"thermal efficiency=54.66%\")\n", + "print(\"NOTE=>In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter8_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter8_1.ipynb new file mode 100755 index 00000000..5088b9af --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter8_1.ipynb @@ -0,0 +1,2594 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 8:Vapour Power Cycles" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.1;pg no: 260" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.1, Page:260 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\n", + "T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\n", + "enthalpy at state 2,h2= hg at 7 MPa\n", + "from steam table,h=2772.1 KJ/kg\n", + "entropy at state 2,s2=sg at 7MPa\n", + "from steam table,s2=5.8133 KJ/kg K\n", + "enthalpy and entropy at state 3,\n", + "from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\n", + "for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \n", + "from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\n", + "s1=s2=sf+x1*sfg\n", + "so x1= 0.68\n", + "from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\n", + "enthalpy at state 1,h1 in KJ/kg= 1802.53\n", + "let dryness fraction at state 4 be x4\n", + "for process 4-3,s4=s3=sf+x4*sfg\n", + "so x4= 0.33\n", + "enthalpy at state 4,h4 in KJ/kg= 962.81\n", + "thermal efficiency=net work/heat added\n", + "expansion work per kg=(h2-h1) in KJ/kg 969.57\n", + "compression work per kg=(h3-h4) in KJ/kg(+ve) 304.19\n", + "heat added per kg=(h2-h3) in KJ/kg(-ve) 1505.1\n", + "net work per kg=(h2-h1)-(h3-h4) in KJ/kg 665.38\n", + "thermal efficiency 0.44\n", + "in percentage 44.21\n", + "so thermal efficiency=44.21%\n", + "turbine work=969.57 KJ/kg(+ve)\n", + "compression work=304.19 KJ/kg(-ve)\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,turbine work,compression work\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.1, Page:260 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\")\n", + "print(\"T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\")\n", + "print(\"enthalpy at state 2,h2= hg at 7 MPa\")\n", + "print(\"from steam table,h=2772.1 KJ/kg\")\n", + "h2=2772.1;\n", + "print(\"entropy at state 2,s2=sg at 7MPa\")\n", + "print(\"from steam table,s2=5.8133 KJ/kg K\")\n", + "s2=5.8133;\n", + "print(\"enthalpy and entropy at state 3,\")\n", + "print(\"from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\")\n", + "h3=1267;\n", + "s3=3.1211;\n", + "print(\"for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \")\n", + "s1=s2;\n", + "print(\"from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\")\n", + "sf=0.5564;\n", + "sfg=7.7237;\n", + "print(\"s1=s2=sf+x1*sfg\")\n", + "x1=(s2-sf)/sfg\n", + "print(\"so x1=\"),round(x1,2) \n", + "x1=0.6806;#approx.\n", + "print(\"from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\")\n", + "hf=162.60;\n", + "hfg=2409.54;\n", + "h1=hf+x1*hfg\n", + "print(\"enthalpy at state 1,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"let dryness fraction at state 4 be x4\")\n", + "print(\"for process 4-3,s4=s3=sf+x4*sfg\")\n", + "s4=s3;\n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.3321;#approx.\n", + "h4=hf+x4*hfg\n", + "print(\"enthalpy at state 4,h4 in KJ/kg=\"),round(h4,2)\n", + "print(\"thermal efficiency=net work/heat added\")\n", + "(h2-h1)\n", + "print(\"expansion work per kg=(h2-h1) in KJ/kg\"),round((h2-h1),2)\n", + "(h3-h4)\n", + "print(\"compression work per kg=(h3-h4) in KJ/kg(+ve)\"),round((h3-h4),2)\n", + "(h2-h3)\n", + "print(\"heat added per kg=(h2-h3) in KJ/kg(-ve)\"),round((h2-h3),2)\n", + "(h2-h1)-(h3-h4)\n", + "print(\"net work per kg=(h2-h1)-(h3-h4) in KJ/kg\"),round((h2-h1)-(h3-h4),2)\n", + "((h2-h1)-(h3-h4))/(h2-h3)\n", + "print(\"thermal efficiency\"),round(((h2-h1)-(h3-h4))/(h2-h3),2)\n", + "print(\"in percentage\"),round((((h2-h1)-(h3-h4))/(h2-h3))*100,2)\n", + "print(\"so thermal efficiency=44.21%\")\n", + "print(\"turbine work=969.57 KJ/kg(+ve)\")\n", + "print(\"compression work=304.19 KJ/kg(-ve)\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.2;pg no: 261" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.2, Page:261 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\n", + "from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\n", + "hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\n", + "from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\n", + "hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\n", + "as process 2-3 is isentropic,so s2=s3\n", + "and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\n", + "so x3= 0.69\n", + "hence enthalpy at 3,\n", + "h3 in KJ/kg= 1819.85\n", + "enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\n", + "process 1-4 is isentropic,so s1=s4\n", + "s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\n", + "so x4= 0.31\n", + "enthalpy at 4,h4 in KJ/kg= 884.31\n", + "enthalpy at 1,h1 in KJ/kg= 1154.23\n", + "carnot cycle(1-2-3-4-1) efficiency:\n", + "n_carnot=net work/heat added\n", + "n_carnot 0.43\n", + "in percentage 42.96\n", + "so n_carnot=42.95%\n", + "In rankine cycle,1-2-3-5-6-1,\n", + "pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg 5.02\n", + "h5 KJ/kg= 137.82\n", + "hence h6 in KJ/kg 142.84\n", + "net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg 969.43\n", + "heat added=(h2-h6)in KJ/kg 2651.46\n", + "rankine cycle efficiency(n_rankine)= 0.37\n", + "in percentage 36.56\n", + "so n_rankine=36.56%\n" + ] + } + ], + "source": [ + "#cal of n_carnot,n_rankine\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.2, Page:261 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\")\n", + "print(\"from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\")\n", + "print(\"hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\")\n", + "hf_5MPa=1154.23;\n", + "sf_5MPa=2.92;\n", + "hg_5MPa=2794.3;\n", + "sg_5MPa=5.97;\n", + "print(\"from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\")\n", + "print(\"hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\")\n", + "hf_5KPa=137.82;\n", + "sf_5KPa=0.4764;\n", + "hg_5KPa=2561.5;\n", + "sg_5KPa=8.3951;\n", + "vf_5KPa=0.001005;\n", + "print(\"as process 2-3 is isentropic,so s2=s3\")\n", + "print(\"and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\")\n", + "s2=sg_5MPa;\n", + "s3=s2;\n", + "x3=(s3-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.694;#approx.\n", + "print(\"hence enthalpy at 3,\")\n", + "h3=hf_5KPa+x3*(hg_5KPa-hf_5KPa)\n", + "print(\"h3 in KJ/kg=\"),round(h3,2)\n", + "print(\"enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\")\n", + "print(\"process 1-4 is isentropic,so s1=s4\")\n", + "s1=sf_5MPa;\n", + "print(\"s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\")\n", + "x4=(s1-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.308;#approx.\n", + "h4=hf_5KPa+x4*(hg_5KPa-hf_5KPa)\n", + "print(\"enthalpy at 4,h4 in KJ/kg=\"),round(h4,2)\n", + "h1=hf_5MPa\n", + "h2=hg_5MPa;\n", + "n_carnot=((h2-h3)-(h1-h4))/(h2-h1)\n", + "print(\"enthalpy at 1,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"carnot cycle(1-2-3-4-1) efficiency:\")\n", + "print(\"n_carnot=net work/heat added\")\n", + "print(\"n_carnot\"),round(n_carnot,2)\n", + "print(\"in percentage\"),round(n_carnot*100,2)\n", + "print(\"so n_carnot=42.95%\")\n", + "print(\"In rankine cycle,1-2-3-5-6-1,\")\n", + "p6=5000;#boiler pressure in KPa\n", + "p5=5;#condenser pressure in KPa\n", + "vf_5KPa*(p6-p5)\n", + "print(\"pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg\"),round(vf_5KPa*(p6-p5),2)\n", + "h5=hf_5KPa;\n", + "print(\"h5 KJ/kg=\"),round(hf_5KPa,2)\n", + "h6=h5+(vf_5KPa*(p6-p5))\n", + "print(\"hence h6 in KJ/kg\"),round(h6,2)\n", + "(h2-h3)-(h6-h5)\n", + "print(\"net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg\"),round((h2-h3)-(h6-h5),2)\n", + "(h2-h6)\n", + "print(\"heat added=(h2-h6)in KJ/kg\"),round((h2-h6),2)\n", + "n_rankine=((h2-h3)-(h6-h5))/(h2-h6)\n", + "print(\"rankine cycle efficiency(n_rankine)=\"),round(n_rankine,2)\n", + "print(\"in percentage\"),round(n_rankine*100,2)\n", + "print(\"so n_rankine=36.56%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.3;pg no: 263" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.3, Page:263 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\n", + "from steam tables,h2=hg_40bar=3092.5 KJ/kg\n", + "s2=sg_40bar=6.5821 KJ/kg K\n", + "h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \n", + "s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "v4=vf_0.05bar=0.001005 m^3/kg\n", + "let the dryness fraction at state 3 be x3,\n", + "for ideal process,2-3,s2=s3\n", + "s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\n", + "so x3= 0.77\n", + "h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\n", + "for pumping process,\n", + "h1-h4=v4*deltap=v4*(p1-p4)\n", + "so h1=h4+v4*(p1-p4) in KJ/kg 141.83\n", + "pump work per kg of steam in KJ/kg 4.01\n", + "net work per kg of steam =(expansion work-pump work)per kg of steam\n", + "=(h2-h3)-(h1-h4) in KJ/kg= 1081.75\n", + "cycle efficiency=net work/heat added 0.37\n", + "in percentage 36.66\n", + "so net work per kg of steam=1081.74 KJ/kg\n", + "cycle efficiency=36.67%\n", + "pump work per kg of steam=4.02 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of net work per kg of steam,cycle efficiency,pump work per kg of steam\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.3, Page:263 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\")\n", + "print(\"from steam tables,h2=hg_40bar=3092.5 KJ/kg\")\n", + "h2=3092.5;\n", + "print(\"s2=sg_40bar=6.5821 KJ/kg K\")\n", + "s2=6.5821;\n", + "print(\"h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \")\n", + "h4=137.82;\n", + "hfg=2423.7;\n", + "print(\"s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "s4=0.4764;\n", + "sfg=7.9187;\n", + "print(\"v4=vf_0.05bar=0.001005 m^3/kg\")\n", + "v4=0.001005;\n", + "print(\"let the dryness fraction at state 3 be x3,\")\n", + "print(\"for ideal process,2-3,s2=s3\")\n", + "s3=s2;\n", + "print(\"s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\")\n", + "x3=(s2-s4)/(sfg)\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.7711;#approx.\n", + "print(\"h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\")\n", + "h3=h4+x3*hfg\n", + "print(\"for pumping process,\")\n", + "print(\"h1-h4=v4*deltap=v4*(p1-p4)\")\n", + "p1=40*100;#pressure of steam enter in turbine in mPa\n", + "p4=0.05*100;#pressure of steam leave turbine in mPa\n", + "h1=h4+v4*(p1-p4)\n", + "print(\"so h1=h4+v4*(p1-p4) in KJ/kg\"),round(h1,2)\n", + "(h1-h4)\n", + "print(\"pump work per kg of steam in KJ/kg\"),round((h1-h4),2)\n", + "print(\"net work per kg of steam =(expansion work-pump work)per kg of steam\")\n", + "(h2-h3)-(h1-h4)\n", + "print(\"=(h2-h3)-(h1-h4) in KJ/kg=\"),round((h2-h3)-(h1-h4),2)\n", + "print(\"cycle efficiency=net work/heat added\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", + "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", + "print(\"so net work per kg of steam=1081.74 KJ/kg\")\n", + "print(\"cycle efficiency=36.67%\")\n", + "print(\"pump work per kg of steam=4.02 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.4;pg no: 264" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.4, Page:264 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 4\n", + "Let us assume that the condensate leaves condenser as saturated liquid and the expansion in turbine and pumping processes are isentropic.\n", + "from steam tables,h2=h_20MPa=3238.2 KJ/kg\n", + "s2=6.1401 KJ/kg K\n", + "h5=h_0.005MPa in KJ/kg\n", + "from steam tables,at 0.005 MPa,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "h5=hf+0.9*hfg in KJ/kg 2319.15\n", + "s5 in KJ/kg K= 7.6\n", + "h6=hf=137.82 KJ/kg\n", + "it is given that temperature at state 4 is 500 degree celcius and due to isentropic processes s4=s5=7.6032 KJ/kg K.The state 4 can be conveniently located on mollier chart by the intersection of 500 degree celcius constant temperature line and entropy value of 7.6032 KJ/kg K and the pressure and enthalpy obtained.but these shall be approximate.\n", + "The state 4 can also be located by interpolation using steam table.The entropy value of 7.6032 KJ/kg K lies between the superheated steam states given under,p=1.20 MPa,s at 1.20 MPa=7.6027 KJ/kg K\n", + "p=1.40 MPa,s at 1.40 MPa=7.6027 KJ/kg K\n", + "by interpolation state 4 lies at pressure=\n", + "=1.399,approx.=1.40 MPa\n", + "thus,steam leaves HP turbine at 1.40 MPa\n", + "enthalpy at state 4,h4=3474.1 KJ/kg\n", + "for process 2-33,s2=s3=6.1401 KJ/kg K.The state 3 thus lies in wet region as s3sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\n", + "From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\n", + "Let dryness fraction at state 9 be x9 so,\n", + "s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\n", + "from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\n", + "x9=(s9-sf)/sfg 0.95\n", + "h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\n", + "from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\n", + "Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\n", + "h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\n", + "h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\n", + "For process 4-8,i.e in CEP.\n", + "h8 in KJ/kg= 138.22\n", + "For process 11-12,i.e in FP2,\n", + "h12=h11+v11*(40-4)*10^2 in KJ/kg 608.64\n", + "For process 13-1_a i.e. in FP1,h1_a= in KJ/kg= 1107.34\n", + "m1*3141.81+(1-m1)*608.64=1087.31\n", + "so m1=(1087.31-608.64)/(3141.81-608.64)in kg\n", + "Applying energy balance on open feed water heater 1 (OFWH1)\n", + "m1*h10+(1-m1)*h12)=1*h13\n", + "so m1 in kg= 0.19\n", + "Applying energy balance on open feed water heater 2 (OFWH2)\n", + "m2*h9+(1-m1-m2)*h8=(1-m1)*h11\n", + "so m2 in kg= 0.15\n", + "Thermal efficiency of cycle,n= 0.51\n", + "W_CEP in KJ/kg steam from boiler= 0.26\n", + "W_FP1=(h1_a-h13)in KJ/kg of steam from boiler 20.0\n", + "W_FP2 in KJ/kg of steam from boiler= 3.17\n", + "W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler= 23.46\n", + "n= 0.51\n", + "in percentage 51.37\n", + "so cycle thermal efficiency,na=46.18%\n", + "nb=49.76%\n", + "nc=51.37%\n", + "hence it is obvious that efficiency increases with increase in number of feed heaters.\n" + ] + } + ], + "source": [ + "#cal of maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.6, Page:267 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 6\")\n", + "print(\"case (a) When there is no feed water heater\")\n", + "print(\"Thermal efficiency of cycle=((h2-h3)-(h1-h4))/(h2-h1)\")\n", + "print(\"from steam tables,h2=h at 200 bar,650oc=3675.3 KJ/kg,s2=s at 200 bar,650oc=6.6582 KJ/kg K,h4=hf at 0.05 bar=137.82 KJ/kg,v4=vf at 0.05 bar=0.001005 m^3/kg\")\n", + "h2=3675.3;\n", + "s2=6.6582;\n", + "h4=137.82;\n", + "v4=0.001005;\n", + "print(\"hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg,sf at 0.05 bar=0.4764 KJ/kg K,sfg at 0.05 bar=7.9187 KJ/kg K\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "print(\"For process 2-3,s2=s3.Let dryness fraction at 3 be x3.\")\n", + "s3=s2;\n", + "print(\"s3=6.6582=sf at 0.05 bar+x3*sfg at 0.05 bar\")\n", + "x3=(s3-sf)/sfg\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.781;#approx.\n", + "print(\"h3=hf at 0.05 bar+x3*hfg at 0.05 bar in KJ/kg\")\n", + "h3=hf+x3*hfg\n", + "print(\"For pumping process 4-1,\")\n", + "print(\"h1-h4=v4*deltap\")\n", + "h1=h4+v4*(200-0.5)*10**2\n", + "print(\"h1= in KJ/kg=\"),round(h1,2)\n", + "((h2-h3)-(h1-h4))/(h2-h1)\n", + "print(\"Thermal efficiency of cycle=\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", + "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", + "print(\"case (b) When there is only one feed water heater working at 8 bar\")\n", + "print(\"here,let mass of steam bled for feed heating be m kg\")\n", + "print(\"For process 2-6,s2=s6=6.6582 KJ/kg K\")\n", + "s6=s2;\n", + "print(\"Let dryness fraction at state 6 be x6\")\n", + "print(\"s6=sf at 8 bar+x6*sfg at 8 bar\")\n", + "print(\"from steam tables,hf at 8 bar=721.11 KJ/kg,vf at 8 bar=0.001115 m^3/kg,hfg at 8 bar=2048 KJ/kg,sf at 8 bar=2.0462 KJ/kg K,sfg at 8 bar=4.6166 KJ/kg K\")\n", + "hf=721.11;\n", + "vf=0.001115;\n", + "hfg=2048;\n", + "sf=2.0462;\n", + "sfg=4.6166;\n", + "x6=(s6-sf)/sfg\n", + "print(\"substituting entropy values,x6=\"),round(x6,2)\n", + "x6=0.999;#approx.\n", + "print(\"h6=hf at at 8 bar+x6*hfg at 8 bar in KJ/kg\")\n", + "h6=hf+x6*hfg\n", + "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at 8 bar.h7=hf at 8 bar=721.11 KJ/kg\")\n", + "h7=721.11;\n", + "h5=h4+v4*(8-.05)*10**2\n", + "print(\"For process 4-5,h5 in KJ/kg\"),round(h5,2)\n", + "print(\"Applying energy balance at open feed water heater,\")\n", + "print(\"m*h6+(1-m)*h5=1*h7\")\n", + "m=(h7-h5)/(h6-h5)\n", + "print(\"so m= in kg\"),round(m,2)\n", + "h7=hf;\n", + "v7=vf;\n", + "h1=h7+v7*(200-8)*10**2\n", + "print(\"For process 7-1,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"here h7=hf at 8 bar,v7=vf at 8 bar\")\n", + "#TE=((h2-h6)+(1-m)*(h6-h3)-((1-m)*(h5-h4)+(h1-h7))/(h2-h1)\n", + "print(\"Thermal efficiency of cycle=0.4976\")\n", + "print(\"in percentage=49.76\")\n", + "print(\"case (c) When there are two feed water heaters working at 40 bar and 4 bar\")\n", + "print(\"here, let us assume the mass of steam at 40 bar,4 bar to be m1 kg and m2 kg respectively.\")\n", + "print(\"2-10-9-3,s2=s10=s9=s3=6.6582 KJ/kg K\")\n", + "s3=s2;\n", + "s9=s3;\n", + "s10=s9;\n", + "print(\"At state 10.s10>sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\")\n", + "print(\"From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\")\n", + "T10=370.6;\n", + "h10=3141.81;\n", + "print(\"Let dryness fraction at state 9 be x9 so,\") \n", + "print(\"s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\")\n", + "print(\"from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\")\n", + "sf=1.7766;\n", + "sfg=5.1193;\n", + "x9=(s9-sf)/sfg\n", + "print(\"x9=(s9-sf)/sfg\"),round(x9,2)\n", + "x9=0.9536;#approx.\n", + "print(\"h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\")\n", + "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\")\n", + "hf=604.74;\n", + "hfg=2133.8;\n", + "h9=hf+x9*hfg \n", + "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\")\n", + "print(\"h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\")\n", + "h11=604.74;\n", + "v11=0.001084;\n", + "print(\"h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\")\n", + "h13=1087.31;\n", + "v13=0.001252;\n", + "print(\"For process 4-8,i.e in CEP.\")\n", + "h8=h4+v4*(4-0.05)*10**2\n", + "print(\"h8 in KJ/kg=\"),round(h8,2)\n", + "print(\"For process 11-12,i.e in FP2,\")\n", + "h12=h11+v11*(40-4)*10**2\n", + "print(\"h12=h11+v11*(40-4)*10^2 in KJ/kg\"),round(h12,2)\n", + "h1_a=h13+v13*(200-40)*10**2\n", + "print(\"For process 13-1_a i.e. in FP1,h1_a= in KJ/kg=\"),round(h1_a,2)\n", + "print(\"m1*3141.81+(1-m1)*608.64=1087.31\")\n", + "print(\"so m1=(1087.31-608.64)/(3141.81-608.64)in kg\")\n", + "m1=(1087.31-608.64)/(3141.81-608.64)\n", + "print(\"Applying energy balance on open feed water heater 1 (OFWH1)\")\n", + "print(\"m1*h10+(1-m1)*h12)=1*h13\")\n", + "m1=(h13-h12)/(h10-h12)\n", + "print(\"so m1 in kg=\"),round(m1,2)\n", + "print(\"Applying energy balance on open feed water heater 2 (OFWH2)\")\n", + "print(\"m2*h9+(1-m1-m2)*h8=(1-m1)*h11\")\n", + "m2=(1-m1)*(h11-h8)/(h9-h8)\n", + "print(\"so m2 in kg=\"),round(m2,2)\n", + "W_CEP=(1-m1-m2)*(h8-h4)\n", + "W_FP1=(h1_a-h13)\n", + "W_FP2=(1-m1)*(h12-h11)\n", + "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", + "print(\"Thermal efficiency of cycle,n=\"),round(n,2)\n", + "print(\"W_CEP in KJ/kg steam from boiler=\"),round(W_CEP,2)\n", + "print(\"W_FP1=(h1_a-h13)in KJ/kg of steam from boiler\"),round(W_FP1)\n", + "print(\"W_FP2 in KJ/kg of steam from boiler=\"),round(W_FP2,2)\n", + "W_CEP+W_FP1+W_FP2\n", + "print(\"W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler=\"),round(W_CEP+W_FP1+W_FP2,2)\n", + "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", + "print(\"n=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so cycle thermal efficiency,na=46.18%\")\n", + "print(\"nb=49.76%\")\n", + "print(\"nc=51.37%\")\n", + "print(\"hence it is obvious that efficiency increases with increase in number of feed heaters.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.7;pg no: 272" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.7, Page:272 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\n", + "from steam tables,\n", + "h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\n", + "s3=s2=6.9759 KJ/kg K\n", + "by interpolation from steam tables,\n", + "T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\n", + "for expansion process 4-5,s4=s5=7.7938 KJ/kg K\n", + "let dryness fraction at state 5 be x5\n", + "s5=sf at 0.05 bar+x5*sfg at 0.05 bar\n", + "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "so x5= 0.92\n", + "h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\n", + "from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\n", + "h6=hf at 0.05 bar=137.82 KJ/kg\n", + "v6=vf at 0.05 bar=0.001005 m^3/kg\n", + "for process 6-1 in feed pump,h1 in KJ/kg= 142.84\n", + "cycle efficiency=W_net/Q_add\n", + "Wt in KJ/kg= 1510.35\n", + "W_pump=(h1-h6)in KJ/kg 5.02\n", + "W_net=Wt-W_pump in KJ/kg 1505.33\n", + "Q_add in KJ/kg= 3290.96\n", + "cycle efficiency= 0.4574\n", + "in percentage= 45.74\n", + "we know ,1 hp=0.7457 KW\n", + "specific steam consumption in kg/hp hr= 1.78\n", + "work ratio=net work/positive work 0.9967\n", + "so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\n" + ] + } + ], + "source": [ + "#cal of cycle efficiency,specific steam consumption,work ratio\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.7, Page:272 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\")\n", + "print(\"from steam tables,\")\n", + "print(\"h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\")\n", + "h2=3433.8;\n", + "s2=6.9759;\n", + "print(\"s3=s2=6.9759 KJ/kg K\")\n", + "s3=s2;\n", + "print(\"by interpolation from steam tables,\")\n", + "print(\"T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\")\n", + "T3=183.14;\n", + "h3=2818.03;\n", + "h4=3271.9;\n", + "s4=7.7938;\n", + "print(\"for expansion process 4-5,s4=s5=7.7938 KJ/kg K\")\n", + "s5=s4;\n", + "print(\"let dryness fraction at state 5 be x5\")\n", + "print(\"s5=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", + "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "x5=(s5-sf)/sfg\n", + "print(\"so x5=\"),round(x5,2)\n", + "x5=0.924;#approx.\n", + "print(\"h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\")\n", + "print(\"from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "h5=hf+x5*hfg \n", + "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", + "h6=137.82;\n", + "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", + "v6=0.001005;\n", + "p1=50.;#steam generation pressure in bar\n", + "p6=0.05;#steam entering temperature in turbine in bar\n", + "h1=h6+v6*(p1-p6)*100\n", + "print(\"for process 6-1 in feed pump,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"cycle efficiency=W_net/Q_add\")\n", + "Wt=(h2-h3)+(h4-h5)\n", + "print(\"Wt in KJ/kg=\"),round(Wt,2)\n", + "W_pump=(h1-h6)\n", + "print(\"W_pump=(h1-h6)in KJ/kg\"),round(W_pump,2)\n", + "W_net=Wt-W_pump\n", + "print(\"W_net=Wt-W_pump in KJ/kg\"),round(W_net,2)\n", + "Q_add=(h2-h1)\n", + "print(\"Q_add in KJ/kg=\"),round(Q_add,2)\n", + "print(\"cycle efficiency=\"),round(W_net/Q_add,4)\n", + "W_net*100/Q_add\n", + "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", + "print(\"we know ,1 hp=0.7457 KW\")\n", + "print(\"specific steam consumption in kg/hp hr=\"),round(0.7457*3600/W_net,2)\n", + "print(\"work ratio=net work/positive work\"),round(W_net/Wt,4)\n", + "print(\"so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.8;pg no: 273" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.8, Page:273 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\n", + "from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\n", + "h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\n", + "Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\n", + "h8=hf at 3 bar=561.47 KJ/kg\n", + "for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\n", + "Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\n", + "s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\n", + "from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\n", + "so x3= 0.95\n", + "s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\n", + "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "so x4= 0.79\n", + "thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\n", + "here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\n", + "h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\n", + "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", + "assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\n", + "pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\n", + "for mixing process between condenser and feed pump,\n", + "(1-m)*h5+m*h9=1*h6\n", + "h6=m(h9-h5)+h5\n", + "we get,h6=137.82+m*423.65\n", + "therefore h7=h6+6.02=143.84+m*423.65\n", + "Applying energy balance at closed feed water heater;\n", + "m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\n", + "so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\n", + "so m=0.144 kg\n", + "steam bled for feed heating=0.144 kg/kg steam generated\n", + "The net power output,W_net in KJ/kg steam generated= 1167.27\n", + "mass of steam required to be generated in kg/s= 26.23\n", + "or in kg/hr\n", + "so capacity of boiler required=94428 kg/hr\n", + "overall thermal efficiency=W_net/Q_add\n", + "here Q_add in KJ/kg= 3134.56\n", + "overall thermal efficiency= 0.37\n", + "in percentage= 37.24\n", + "so overall thermal efficiency=37.24%\n" + ] + } + ], + "source": [ + "#cal of mass of steam bled for feed heating,capacity of boiler required,overall thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.8, Page:273 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\")\n", + "T_cond=115;#condensate temperature in degree celcius\n", + "Cp=4.18;#specific heat at constant pressure in KJ/kg K\n", + "P=30*10**3;#actual alternator output in KW\n", + "n_boiler=0.9;#boiler efficiency\n", + "n_alternator=0.98;#alternator efficiency\n", + "print(\"from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\")\n", + "h2=3301.8;\n", + "s2=6.7193;\n", + "print(\"h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\")\n", + "h5=137.82;\n", + "v5=0.001005;\n", + "print(\"Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\")\n", + "print(\"h8=hf at 3 bar=561.47 KJ/kg\")\n", + "h8=561.47;\n", + "print(\"for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\")\n", + "s3=s2;\n", + "s4=s3;\n", + "print(\"Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\")\n", + "print(\"s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\")\n", + "print(\"from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\")\n", + "sf_3bar=1.6718;\n", + "sfg_3bar=5.3201;\n", + "x3=(s3-sf_3bar)/sfg_3bar\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.949;#approx.\n", + "print(\"s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\")\n", + "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.788;#approx.\n", + "print(\"thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\")\n", + "print(\"here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\")\n", + "hf_3bar=561.47;\n", + "hfg_3bar=2163.8;\n", + "h3=hf_3bar+x3*hfg_3bar \n", + "print(\"h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\")\n", + "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "h4=hf+x4*hfg\n", + "print(\"assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\")\n", + "h9=h8;\n", + "v6=v5;\n", + "print(\"pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\")\n", + "p1=60;#pressure of steam in high pressure turbine in bar\n", + "p5=0.05;#pressure of steam in low pressure turbine in bar\n", + "v5*(p1-p5)*100\n", + "print(\"for mixing process between condenser and feed pump,\")\n", + "print(\"(1-m)*h5+m*h9=1*h6\")\n", + "print(\"h6=m(h9-h5)+h5\")\n", + "print(\"we get,h6=137.82+m*423.65\")\n", + "print(\"therefore h7=h6+6.02=143.84+m*423.65\")\n", + "print(\"Applying energy balance at closed feed water heater;\")\n", + "print(\"m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\")\n", + "print(\"so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\")\n", + "print(\"so m=0.144 kg\")\n", + "m=0.144;\n", + "h6=137.82+m*423.65;\n", + "h7=143.84+m*423.65;\n", + "print(\"steam bled for feed heating=0.144 kg/kg steam generated\")\n", + "W_net=(h2-h3)+(1-m)*(h3-h4)-(1-m)*(h7-h6)\n", + "print(\"The net power output,W_net in KJ/kg steam generated=\"),round(W_net,2)\n", + "P/(n_alternator*W_net)\n", + "print(\"mass of steam required to be generated in kg/s=\"),round(P/(n_alternator*W_net),2)\n", + "print(\"or in kg/hr\")\n", + "26.23*3600\n", + "print(\"so capacity of boiler required=94428 kg/hr\")\n", + "print(\"overall thermal efficiency=W_net/Q_add\")\n", + "Q_add=(h2-Cp*T_cond)/n_boiler\n", + "print(\"here Q_add in KJ/kg=\"),round(Q_add,2) \n", + "W_net/Q_add\n", + "print(\"overall thermal efficiency=\"),round(W_net/Q_add,2)\n", + "W_net*100/Q_add\n", + "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", + "print(\"so overall thermal efficiency=37.24%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.9;pg no: 275" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.9, Page:275 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\n", + "At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\n", + "For ideal expansion process,s2=s3\n", + "By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\n", + "actual stste at exit of first stage,h3_a in KJ/kg= 2909.88\n", + "actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K= 7.1075\n", + "for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\n", + "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", + "so x4= 0.96\n", + "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", + "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", + "actual enthalpy at exit from second stage,h4_a in KJ/kg= 2646.48\n", + "actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\n", + "so x4_a= 0.99\n", + "x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\n", + "for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x5= 0.87\n", + "h5=2270.43 KJ/kg\n", + "actual enthalpy at exit from third stage,h5_a in KJ/kg= 2345.64\n", + "Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\n", + "By heat balance on first closed feed water heater,(see schematic arrangement)\n", + "h11=hf at 6 bar=670.56 KJ\n", + "m1*h3_a+h10=m1*h11+4.18*150\n", + "(m1*2829.63)+h10=(m1*670.56)+627\n", + "h10+2159.07*m1=627\n", + "By heat balance on second closed feed water heater,(see schematic arrangement)\n", + "h7=hf at 1 bar=417.46 KJ/kg\n", + "m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\n", + "m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\n", + "m2*2467.27-m1*179.2-238.26=0\n", + "heat balance at point of mixing,\n", + "h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\n", + "neglecting pump work,h7=h8\n", + "h10=m2*417.46+(1-m1-m2)*397.1\n", + "substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\n", + "Turbine output per kg of steam generated,Wt in KJ/kg of steam generated= 780.445\n", + "Rate of steam generation required in kg/s= 19.22\n", + "in kg/hr\n", + "capacity of drain pump i.e. FP shown in layout in kg/hr= 16273.96\n", + "so capacity of drain pump=16273.96 kg/hr\n" + ] + } + ], + "source": [ + "#cal of capacity of drain pump\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.9, Page:275 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\")\n", + "P=15*10**3;#turbine output in KW\n", + "print(\"At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\")\n", + "h2=3230.9;\n", + "s2=6.9212;\n", + "print(\"For ideal expansion process,s2=s3\")\n", + "s3=s2;\n", + "print(\"By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\")\n", + "T3=190.97;\n", + "h3=2829.63;\n", + "h3_a=h2-0.8*(h2-h3)\n", + "print(\"actual stste at exit of first stage,h3_a in KJ/kg=\"),round(h3_a,2)\n", + "s3_a=7.1075;\n", + "print(\"actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K=\"),round(s3_a,4)\n", + "print(\"for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\")\n", + "s4=7.1075;\n", + "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", + "sf=1.3026;\n", + "sfg=6.0568;\n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.958;#approx.\n", + "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", + "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", + "hf=417.46;\n", + "hfg=2258.0;\n", + "h4=hf+x4*hfg\n", + "h4_a=h3_a-.8*(h3_a-h4)\n", + "print(\"actual enthalpy at exit from second stage,h4_a in KJ/kg=\"),round(h4_a,2)\n", + "print(\"actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\")\n", + "x4_a=(h4_a-hf)/hfg\n", + "print(\"so x4_a=\"),round(x4_a,2)\n", + "print(\"x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\")\n", + "s4_a=7.2806;\n", + "print(\"for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "x5=(s4_a-sf)/sfg\n", + "print(\"so x5=\"),round(x5,2)\n", + "x5=0.8735;#approx.\n", + "print(\"h5=2270.43 KJ/kg\")\n", + "h5=2270.43;\n", + "h5_a=h4_a-0.8*(h4_a-h5)\n", + "print(\"actual enthalpy at exit from third stage,h5_a in KJ/kg=\"),round(h5_a,2)\n", + "print(\"Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\")\n", + "print(\"By heat balance on first closed feed water heater,(see schematic arrangement)\")\n", + "print(\"h11=hf at 6 bar=670.56 KJ\")\n", + "h11=670.56;\n", + "print(\"m1*h3_a+h10=m1*h11+4.18*150\")\n", + "print(\"(m1*2829.63)+h10=(m1*670.56)+627\")\n", + "print(\"h10+2159.07*m1=627\")\n", + "print(\"By heat balance on second closed feed water heater,(see schematic arrangement)\")\n", + "print(\"h7=hf at 1 bar=417.46 KJ/kg\")\n", + "h7=417.46;\n", + "print(\"m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\")\n", + "print(\"m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\")\n", + "print(\"m2*2467.27-m1*179.2-238.26=0\")\n", + "print(\"heat balance at point of mixing,\")\n", + "print(\"h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\")\n", + "print(\"neglecting pump work,h7=h8\")\n", + "print(\"h10=m2*417.46+(1-m1-m2)*397.1\")\n", + "print(\"substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\")\n", + "m1=0.1293;\n", + "m2=0.1059;\n", + "Wt=(h2-h3_a)+(1-m1)*(h3_a-h4_a)+(1-m1-m2)*(h4_a-h5_a)\n", + "print(\"Turbine output per kg of steam generated,Wt in KJ/kg of steam generated=\"),round(Wt,3)\n", + "P/Wt\n", + "print(\"Rate of steam generation required in kg/s=\"),round(P/Wt,2)\n", + "print(\"in kg/hr\")\n", + "P*3600/Wt\n", + "(m1+m2)*69192\n", + "print(\"capacity of drain pump i.e. FP shown in layout in kg/hr=\"),round((m1+m2)*69192,2)\n", + "print(\"so capacity of drain pump=16273.96 kg/hr\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.10;pg no: 277" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.10, Page:277 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\n", + "at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\n", + "By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\n", + "actual enthapy at 3_a,h3_a in KJ/kg= 3097.0\n", + "enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\n", + "for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\n", + "s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x6= 0.83\n", + "h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "for actual expansion process in LP turbine.\n", + "h6_a=h4-0.85*(h4-h6) in KJ/kg 2319.4\n", + "Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\n", + "s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\n", + "from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\n", + "so x5= 1.0\n", + "h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\n", + "from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\n", + "actual enthalpy,h5_a in KJ/kg= 2790.16\n", + "enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\n", + "specific volume at inlet of CEP,v7=0.001008 m^3/kg\n", + "enthalpy at inlet of CEP,h7=168.79 KJ/kg\n", + "for pumping process 7-8,h8 in KJ/kg= 169.15\n", + "Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\n", + "m*h5+(1-m)*h8=h9\n", + "so m in kg /kg of steam generated= 0.33\n", + "For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\n", + "h1= in KJ/kg= 1015.59\n", + "Net work per kg of steam generated,W_net=in KJ/kg steam generated= 938.83\n", + "heat added per kg of steam generated,q_add in KJ/kg of steam generated= 2405.41\n", + "Thermal efficiency,n= 0.39\n", + "in percentage= 39.03\n", + "so thermal efficiency=39.03%%\n", + "NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\n" + ] + } + ], + "source": [ + "#cal of cycle efficiency\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.10, Page:277 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\")\n", + "print(\"at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\")\n", + "h2=3287.1;\n", + "s2=6.6327;\n", + "print(\"By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\")\n", + "h3=3049.48;\n", + "h3_a=h2-0.80*(h2-h3)\n", + "print(\"actual enthapy at 3_a,h3_a in KJ/kg=\"),round(h3_a,2)\n", + "print(\"enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\")\n", + "h4=3230.9;\n", + "s4=6.9212;\n", + "print(\"for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\")\n", + "s6=s4;\n", + "print(\"s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "x6=(s6-sf)/sfg\n", + "print(\"so x6=\"),round(x6,2)\n", + "x6=0.827;#approx.\n", + "print(\"h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0;\n", + "h6=hf+x6*hfg\n", + "print(\"for actual expansion process in LP turbine.\")\n", + "h6_a=h4-0.85*(h4-h6)\n", + "print(\"h6_a=h4-0.85*(h4-h6) in KJ/kg\"),round(h6_a,2)\n", + "print(\"Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\")\n", + "p5=3.61;\n", + "s5=s4;\n", + "print(\"s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\")\n", + "print(\"from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\")\n", + "sf=1.7391;\n", + "sfg=5.1908;\n", + "x5=(s5-sf)/sfg\n", + "print(\"so x5=\"),round(x5,2)\n", + "x5=0.99;#approx.\n", + "print(\"h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\")\n", + "print(\"from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\")\n", + "hf=589.13;\n", + "hfg=2144.7;\n", + "h5=hf+x5*hfg\n", + "h5_a=h4-0.85*(h4-h5)\n", + "print(\"actual enthalpy,h5_a in KJ/kg=\"),round(h5_a,2)\n", + "print(\"enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\")\n", + "h9=1008.42;\n", + "print(\"specific volume at inlet of CEP,v7=0.001008 m^3/kg\")\n", + "v7=0.001008;\n", + "print(\"enthalpy at inlet of CEP,h7=168.79 KJ/kg\")\n", + "h7=168.79;\n", + "h8=h7+v7*(3.61-0.075)*10**2\n", + "print(\"for pumping process 7-8,h8 in KJ/kg=\"),round(h8,2)\n", + "print(\"Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\")\n", + "print(\"m*h5+(1-m)*h8=h9\")\n", + "m=(h9-h8)/(h5-h8)\n", + "print(\"so m in kg /kg of steam generated=\"),round(m,2)\n", + "print(\"For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\")\n", + "v9=0.00108;\n", + "h1=h9+v9*(70-3.61)*10**2\n", + "print(\"h1= in KJ/kg=\"),round(h1,2) \n", + "W_net=(h2-h3_a)+(h4-h5_a)+(1-m)*(h5_a-h6_a)-((1-m)*(h8-h7)+(h1-h9))\n", + "print(\"Net work per kg of steam generated,W_net=in KJ/kg steam generated=\"),round(W_net,2)\n", + "q_add=(h2-h1)+(h4-h3_a)\n", + "print(\"heat added per kg of steam generated,q_add in KJ/kg of steam generated=\"),round(q_add,2)\n", + "n=W_net/q_add\n", + "print(\"Thermal efficiency,n=\"),round(n,2)\n", + "n=n*100\n", + "print(\"in percentage=\"),round(n,2)\n", + "print(\"so thermal efficiency=39.03%%\")\n", + "print(\"NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.11;pg no: 279" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.11, Page:279 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\n", + "Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\n", + "for isentropic expansion 2-3-4-5,s2=s3=s4=s5\n", + "Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\n", + "s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\n", + "so x3=(s3-sf)/sfg\n", + "from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\n", + "h3=hf+x3*hfg in KJ/kg\n", + "from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\n", + "s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\n", + "so x4=(s4-sf)/sfg\n", + "from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\n", + "so h4=hf+x4*hfg in KJ/kg\n", + "from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\n", + "s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\n", + "so x5=(s5-sf)/sfg\n", + "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "h5=hf+x5*hfg in KJ/kg\n", + "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", + "h6=hf at 0.05 bar=137.82 KJ/kg\n", + "v6=vf at 0.05 bar=0.001005 m^3/kg\n", + "h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\n", + "h8=hf at 1.5 bar=467.11 KJ/kg\n", + "v8=0.001053 m^3/kg=vf at 1.5 bar\n", + "h9=h8+v8*(150-1.5)*10^2 in KJ/kg\n", + "h10=hf at 150 bar=1610.5 KJ/kg\n", + "v10=0.001658 m^3/kg=vf at 150 bar\n", + "h12=h10+v10*(150-10)*10^2 in KJ/kg\n", + "Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\n", + "Heat balance on closed feed water heater yields,\n", + "m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\n", + "so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\n", + "heat balance on open feed water can be given as under,\n", + "m2*h4+(1-m1-m2)*h7=(1-m1)*h8\n", + "so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\n", + "for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\n", + "For mixing after closed feed water heater,\n", + "h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\n", + "Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\n", + "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\n", + "heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\n", + "cycle thermal efficiency,n=W_net/q_add 0.48\n", + "in percentage 47.59\n", + "Net power developed in KW=1219*300 in KW 365700.0\n", + "cycle thermal efficiency=47.6%\n", + "Net power developed=365700 KW\n" + ] + } + ], + "source": [ + "#cal of cycle thermal efficiency,Net power developed\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.11, Page:279 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\")\n", + "print(\"Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\")\n", + "h2=3308.6;\n", + "s2=6.3443;\n", + "print(\"for isentropic expansion 2-3-4-5,s2=s3=s4=s5\")\n", + "s3=s2;\n", + "s4=s3;\n", + "s5=s4;\n", + "print(\"Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\")\n", + "print(\"s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\")\n", + "print(\"so x3=(s3-sf)/sfg\")\n", + "print(\"from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\")\n", + "sf=2.1387;\n", + "sfg=4.4478;\n", + "x3=(s3-sf)/sfg\n", + "x3=0.945;#approx.\n", + "print(\"h3=hf+x3*hfg in KJ/kg\")\n", + "print(\"from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\")\n", + "hf=762.81;\n", + "hfg=2015.3;\n", + "h3=hf+x3*hfg\n", + "print(\"s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\")\n", + "print(\"so x4=(s4-sf)/sfg\")\n", + "print(\"from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\")\n", + "sf=1.4336;\n", + "sfg=5.7897;\n", + "x4=(s4-sf)/sfg\n", + "x4=0.848;#approx.\n", + "print(\"so h4=hf+x4*hfg in KJ/kg\")\n", + "print(\"from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\")\n", + "hf=467.11;\n", + "hfg=2226.5;\n", + "h4=hf+x4*hfg\n", + "print(\"s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", + "print(\"so x5=(s5-sf)/sfg\")\n", + "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "x5=(s5-sf)/sfg\n", + "x5=0.739;#approx.\n", + "print(\"h5=hf+x5*hfg in KJ/kg\")\n", + "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "h5=hf+x5*hfg \n", + "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", + "h6=137.82;\n", + "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", + "v6=0.001005;\n", + "print(\"h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\")\n", + "h7=h6+v6*(1.5-0.05)*10**2\n", + "print(\"h8=hf at 1.5 bar=467.11 KJ/kg\")\n", + "h8=467.11; \n", + "print(\"v8=0.001053 m^3/kg=vf at 1.5 bar\")\n", + "v8=0.001053;\n", + "print(\"h9=h8+v8*(150-1.5)*10^2 in KJ/kg\")\n", + "h9=h8+v8*(150-1.5)*10**2\n", + "print(\"h10=hf at 150 bar=1610.5 KJ/kg\")\n", + "h10=1610.5; \n", + "print(\"v10=0.001658 m^3/kg=vf at 150 bar\")\n", + "v10=0.001658;\n", + "print(\"h12=h10+v10*(150-10)*10^2 in KJ/kg\")\n", + "h12=h10+v10*(150-10)*10**2\n", + "print(\"Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\")\n", + "print(\"Heat balance on closed feed water heater yields,\")\n", + "print(\"m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\")\n", + "print(\"so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\")\n", + "m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)\n", + "print(\"heat balance on open feed water can be given as under,\")\n", + "print(\"m2*h4+(1-m1-m2)*h7=(1-m1)*h8\")\n", + "print(\"so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\")\n", + "m2=((1-m1)*(h8-h7))/(h4-h7)\n", + "print(\"for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\")\n", + "print(\"For mixing after closed feed water heater,\")\n", + "print(\"h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\")\n", + "h1=(4.18*150)*(1-m1)+m1*h12\n", + "print(\"Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\")\n", + "print(\"W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\")\n", + "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-((1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10)))\n", + "print(\"heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\")\n", + "q_add=(h2-h1)\n", + "n=W_net/q_add\n", + "print(\"cycle thermal efficiency,n=W_net/q_add\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"Net power developed in KW=1219*300 in KW\"),round(1219*300,2)\n", + "print(\"cycle thermal efficiency=47.6%\")\n", + "print(\"Net power developed=365700 KW\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.12;pg no: 282" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.12, Page:282 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\n", + "At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", + "For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\n", + "state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\n", + "since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\n", + "At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", + "At state 3,h3=2930.57 KJ/kg\n", + "At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\n", + "At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\n", + "From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\n", + "Let dryness fraction at state 5_a be x5,\n", + "s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x5_a=(s5_a-sf)/sfg\n", + "h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\n", + "from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\n", + "Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\n", + "m1_a*h3+h9=m1*h10+4.18*200\n", + "so m1_a=(4.18*200-h9)/(h3-h10) in kg\n", + "Applying heat balance at open feed water heater,\n", + "m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\n", + "so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\n", + "Net work per kg steam generated\n", + "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\n", + "Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\n", + "Thermal efficiency,n= 0.45\n", + "in percentage 45.04\n", + "% increase in thermal efficiency due to reheating= 0.56\n", + "so thermal efficiency of reheat cycle=45.03%\n", + "% increase in efficiency due to reheating=0.56%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,steam generation rate\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.12, Page:282 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\")\n", + "P=100*10**3;#net power output in KW\n", + "print(\"At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", + "h2=3373.7;\n", + "s2=6.5966;\n", + "print(\"For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\")\n", + "s3=s2;\n", + "s4=s3;\n", + "s5=s4;\n", + "print(\"state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\")\n", + "T3=261.6;\n", + "h3=2930.57;\n", + "print(\"since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\")\n", + "print(\"At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", + "h2=3373.7;\n", + "s2=6.5966;\n", + "print(\"At state 3,h3=2930.57 KJ/kg\")\n", + "h3=2930.57;\n", + "print(\"At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\")\n", + "h3_a=3247.6;\n", + "s3_a=7.1271;\n", + "print(\"At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\")\n", + "s4_a=s3_a;\n", + "s5_a=s4_a;\n", + "print(\"From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\")\n", + "h4_a=2841.02;\n", + "print(\"Let dryness fraction at state 5_a be x5,\")\n", + "print(\"s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "print(\"so x5_a=(s5_a-sf)/sfg\")\n", + "x5_a=(s5_a-sf)/sfg\n", + "x5_a=0.853;#approx.\n", + "print(\"h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "h5_a=hf+x5_a*hfg\n", + "print(\"Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\")\n", + "print(\"m1_a*h3+h9=m1*h10+4.18*200\")\n", + "print(\"so m1_a=(4.18*200-h9)/(h3-h10) in kg\")\n", + "m1_a=(4.18*200-h9)/(h3-h10)\n", + "m1_a=0.114;#approx.\n", + "print(\"Applying heat balance at open feed water heater,\")\n", + "print(\"m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\")\n", + "print(\"so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\")\n", + "m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7)\n", + "m2_a=0.131;#approx.\n", + "print(\"Net work per kg steam generated\")\n", + "print(\"w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\")\n", + "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-((1-m1_a-m2_a)*(h7-h6)+(h9-h8))\n", + "print(\"Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\")\n", + "q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)\n", + "n=w_net/q_add\n", + "print(\"Thermal efficiency,n=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"% increase in thermal efficiency due to reheating=\"),round((0.4503-0.4478)*100/0.4478,2)\n", + "print(\"so thermal efficiency of reheat cycle=45.03%\")\n", + "print(\"% increase in efficiency due to reheating=0.56%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.13;pg no: 286" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.13, Page:286 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\n", + "For mercury cycle,\n", + "insentropic heat drop=349-234.5 in KJ/kg Hg\n", + "actual heat drop=0.85*114.5 in KJ/kg Hg\n", + "Heat rejected in condenser=(349-97.325-35)in KJ/kg\n", + "heat added in boiler=349-35 in KJ/kg\n", + "For steam cycle,\n", + "Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\n", + "Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\n", + "Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\n", + "Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\n", + "Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\n", + "for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\n", + "state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\n", + "state 4 lies in wet region,say with dryness fraction x4\n", + "s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\n", + "so x4=(s4-sf)/sfg\n", + "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", + "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", + "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", + "Let state 5 lie in wet region with dryness fraction x5,\n", + "s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\n", + "so x5=(s5-sf)/sfg\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "h5=hf+x5*hfg in KJ/kg\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\n", + "h7=h6+v6*(1-0.075)*10^2 in KJ/kg\n", + "from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\n", + "h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\n", + "Applying heat balance on CFWH1,T1=150oc and also T15=150oc\n", + "m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\n", + "(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\n", + "Applying heat balance on CFEH2,T11=90oc\n", + "m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\n", + "(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\n", + "Heat balance at mixing between CFWH1 and CFWH2,\n", + "(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\n", + "376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\n", + "For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\n", + "from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\n", + "solving above equations,we get\n", + "m1=0.102 kg per kg steam generated\n", + "m2=0.073 kg per kg steam generated\n", + "pump work in process 13-14,h14-h13=v13*(40-8)*10^2\n", + "so h14-h13 in KJ/kg\n", + "Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\n", + "net work per kg of steam,w_net=w_mercury+w_steam\n", + "w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\n", + "thermal efficiency of binary vapour cycle=w_net/q_add 0.55\n", + "in percentage 55.36\n", + "so thermal efficiency=55.36%\n", + "NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.13, Page:286 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\")\n", + "print(\"For mercury cycle,\")\n", + "print(\"insentropic heat drop=349-234.5 in KJ/kg Hg\")\n", + "349-234.5\n", + "print(\"actual heat drop=0.85*114.5 in KJ/kg Hg\")\n", + "0.85*114.5\n", + "print(\"Heat rejected in condenser=(349-97.325-35)in KJ/kg\")\n", + "(349-97.325-35)\n", + "print(\"heat added in boiler=349-35 in KJ/kg\")\n", + "349-35\n", + "print(\"For steam cycle,\")\n", + "print(\"Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\")\n", + "h=2767.13;\n", + "print(\"Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\")\n", + "h2=3330.3;\n", + "print(\"Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\")\n", + "s2=6.9363;\n", + "print(\"Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\")\n", + "h-4.18*150\n", + "print(\"Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\")\n", + "2140.13/216.675\n", + "print(\"for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\")\n", + "s3=s2;\n", + "s4=s3;\n", + "s5=s4;\n", + "print(\"state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\")\n", + "h3=2899.23;\n", + "print(\"state 4 lies in wet region,say with dryness fraction x4\")\n", + "print(\"s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\")\n", + "print(\"so x4=(s4-sf)/sfg\")\n", + "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", + "sf=1.3026;\n", + "sfg=6.0568;\n", + "x4=(s4-sf)/sfg\n", + "x4=0.93;#approx.\n", + "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", + "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", + "hf=417.46;\n", + "hfg=2258.0;\n", + "h4=hf+x4*hfg\n", + "print(\"Let state 5 lie in wet region with dryness fraction x5,\")\n", + "print(\"s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", + "print(\"so x5=(s5-sf)/sfg\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "x5=(s5-sf)/sfg\n", + "x5=0.828;#approx.\n", + "print(\"h5=hf+x5*hfg in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0;\n", + "h5=hf+x5*hfg\n", + "print(\"Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\")\n", + "print(\"h7=h6+v6*(1-0.075)*10^2 in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\")\n", + "h6=168.79;\n", + "v6=0.001008;\n", + "h7=h6+v6*(1-0.075)*10**2\n", + "print(\"h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\")\n", + "h9=417.46;\n", + "h13=721.11;\n", + "print(\"Applying heat balance on CFWH1,T1=150oc and also T15=150oc\")\n", + "T1=150;\n", + "T15=150;\n", + "print(\"m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\")\n", + "print(\"(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\")\n", + "print(\"Applying heat balance on CFEH2,T11=90oc\")\n", + "T11=90;\n", + "print(\"m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\")\n", + "print(\"(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\")\n", + "print(\"Heat balance at mixing between CFWH1 and CFWH2,\")\n", + "print(\"(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\")\n", + "print(\"376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\")\n", + "print(\"For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\")\n", + "print(\"from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\")\n", + "h9=417.46;\n", + "v9=0.001043;\n", + "h10=h9+v9*(8-1)*10**2 \n", + "print(\"solving above equations,we get\")\n", + "print(\"m1=0.102 kg per kg steam generated\")\n", + "print(\"m2=0.073 kg per kg steam generated\")\n", + "m1=0.102;\n", + "m2=0.073;\n", + "print(\"pump work in process 13-14,h14-h13=v13*(40-8)*10^2\")\n", + "print(\"so h14-h13 in KJ/kg\")\n", + "v13=0.001252;\n", + "v13*(40-8)*10**2\n", + "print(\"Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\")\n", + "q_add=(9.88*314)+(3330.3-2767.13)\n", + "print(\"net work per kg of steam,w_net=w_mercury+w_steam\")\n", + "print(\"w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\")\n", + "w_net=(9.88*97.325)+((h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h7-h6)-m2*(h10-h9)-m1*4.006)\n", + "print(\"thermal efficiency of binary vapour cycle=w_net/q_add\"),round(w_net/q_add,2)\n", + "print(\"in percentage\"),round(w_net*100/q_add,2)\n", + "print(\"so thermal efficiency=55.36%\")\n", + "print(\"NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.14;pg no: 288" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.14, Page:288 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\n", + "This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\n", + "For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\n", + "ideally, s2=s1=6.7664 KJ/kg K\n", + "s2=sf at 0.075 bar +x3* sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x3=(s2-sf)/sfg\n", + "h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\n", + "for LP:at inlet of LP steam\n", + "h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\n", + "Enthalpy at exit,h_3LP=2222.34 KJ/kg\n", + "actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\n", + "HP steam consumption at full load=P*0.7457/h_HP in kg/s\n", + "HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\n", + "LP steam consumption at full load=P*0.7457/h_LP in kg/s\n", + "LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\n", + "The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\n", + "or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\n", + "Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\n", + "x=load,hp\n", + "y_HP=m_HP*x+C_HP\n", + "0.254=m_HP*0+C_HP\n", + "so C_HP=0.254\n", + "2.54=m_HP*2500+C_HP\n", + "so m_HP=(2.54-C_HP)/2500\n", + "so y_HP=9.144*10^-4*x_HP+0.254\n", + "Willans line for LP:y_LP=m_LP*x_LP+C_LP\n", + "0.481=m_LP*0+C_LP\n", + "so C_LP=0.481\n", + "4.81=m_LP*2500+C_LP\n", + "so m_LP=(4.81-C_LP)/2500\n", + "so y_LP=1.732*10^-3*x_LP+0.481\n", + "Total output(load) from mixed turbine,x=x_HP+x_LP\n", + "For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\n", + "from y_LP=1.732*10^-3*x_LP+0.481,\n", + "x_LP=(y_LP-0.481)/1.732*10^-3\n", + "since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\n", + "from y_HP=9.144*10^-4*x_HP+C_HP in kg/s 0.63\n", + "so HP steam requirement=0.63 kg/s\n" + ] + } + ], + "source": [ + "#cal of HP steam required\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.14, Page:288 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\")\n", + "n=0.8;#efficiency of both HP and LP turbine\n", + "P=2500;#output in hp\n", + "print(\"This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\")\n", + "print(\"For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\")\n", + "h1=3023.5;\n", + "s1=6.7664;\n", + "print(\"ideally, s2=s1=6.7664 KJ/kg K\")\n", + "s2=s1;\n", + "print(\"s2=sf at 0.075 bar +x3* sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "print(\"so x3=(s2-sf)/sfg\")\n", + "x3=(s2-sf)/sfg\n", + "x3=0.806;#approx.\n", + "print(\"h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0; \n", + "h_3HP=hf+x3*hfg\n", + "print(\"actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\")\n", + "h_HP=(h1-h_3HP)*n\n", + "print(\"for LP:at inlet of LP steam\")\n", + "print(\"h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\")\n", + "h2=2706.7;\n", + "s2=7.1271;\n", + "print(\"Enthalpy at exit,h_3LP=2222.34 KJ/kg\")\n", + "h_3LP=2222.34;\n", + "print(\"actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\")\n", + "h_LP=(h2-h_3LP)*n\n", + "print(\"HP steam consumption at full load=P*0.7457/h_HP in kg/s\")\n", + "P*0.7457/h_HP\n", + "print(\"HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\")\n", + "0.10*(P*0.7457/h_HP)\n", + "print(\"LP steam consumption at full load=P*0.7457/h_LP in kg/s\")\n", + "P*0.7457/h_LP\n", + "print(\"LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\")\n", + "0.10*(P*0.7457/h_LP)\n", + "print(\"The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\")\n", + "print(\"or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\")\n", + "print(\"Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\")\n", + "print(\"x=load,hp\")\n", + "print(\"y_HP=m_HP*x+C_HP\")\n", + "print(\"0.254=m_HP*0+C_HP\")\n", + "print(\"so C_HP=0.254\")\n", + "C_HP=0.254;\n", + "print(\"2.54=m_HP*2500+C_HP\")\n", + "print(\"so m_HP=(2.54-C_HP)/2500\")\n", + "m_HP=(2.54-C_HP)/2500\n", + "print(\"so y_HP=9.144*10^-4*x_HP+0.254\")\n", + "print(\"Willans line for LP:y_LP=m_LP*x_LP+C_LP\")\n", + "print(\"0.481=m_LP*0+C_LP\")\n", + "print(\"so C_LP=0.481\")\n", + "C_LP=0.481;\n", + "print(\"4.81=m_LP*2500+C_LP\")\n", + "print(\"so m_LP=(4.81-C_LP)/2500\")\n", + "m_LP=(4.81-C_LP)/2500\n", + "print(\"so y_LP=1.732*10^-3*x_LP+0.481\")\n", + "print(\"Total output(load) from mixed turbine,x=x_HP+x_LP\")\n", + "print(\"For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\")\n", + "y_LP=1.5;\n", + "print(\"from y_LP=1.732*10^-3*x_LP+0.481,\")\n", + "print(\"x_LP=(y_LP-0.481)/1.732*10^-3\")\n", + "x_LP=(y_LP-0.481)/(1.732*10**-3)\n", + "print(\"since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\")\n", + "x_HP=411.66;\n", + "y_HP=9.144*10**-4*x_HP+C_HP\n", + "print(\"from y_HP=9.144*10^-4*x_HP+C_HP in kg/s\"),round(y_HP,2)\n", + "print(\"so HP steam requirement=0.63 kg/s\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.15;pg no: 289" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.15, Page:289 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\n", + "Let us carry out analysis for 1 kg of steam generated in boiler.\n", + "Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\n", + "state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\n", + "Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\n", + "so x3= 0.86\n", + "from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\n", + "h3=2404.94 KJ/kg\n", + "If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\n", + "mass of moisture retained in separator(m)=(1-x3)*0.5 kg\n", + "Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\n", + "Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\n", + "Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\n", + "(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\n", + "so T in degree celcius= 68.425\n", + "so temperature of water leaving hotwell=68.425 degree celcius\n", + "Applying heat balanced on trap\n", + "0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\n", + "so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\n", + "from steam tables,at 2 bar,hf=504.70 KJ/kg\n", + "Therefore,heat transferred in process heater in KJ/kg steam generated= 1023.172\n", + "so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\n", + "For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\n", + "Let dryness fraction be x10\n", + "s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x10=(s10-sf)/sfg\n", + "h10=hf at 0.075 bar+x10*hfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "so h10=hf+x10*hfg in KJ/kg \n", + "net work output,neglecting pump work per kg of steam generated,\n", + "w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\n", + "Heat added in boiler per kg steam generated,q_add in KJ/kg= 2674.68\n", + "thermal efficiency=w_net/q_add 0.28\n", + "in percentage 27.59\n", + "so Thermal efficiency=27.58%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,heat transferred and temperature\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.15, Page:289 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\")\n", + "print(\"Let us carry out analysis for 1 kg of steam generated in boiler.\")\n", + "print(\"Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\")\n", + "h2=2960.7;\n", + "s2=6.3615;\n", + "print(\"state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\")\n", + "s3=s2;\n", + "print(\"Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\")\n", + "sf=1.5301;\n", + "sfg=5.5970;\n", + "x3=(s3-sf)/sfg\n", + "print(\"so x3=\"),round(x3,2)\n", + "print(\"from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\")\n", + "x3=0.863;#approx.\n", + "print(\"h3=2404.94 KJ/kg\")\n", + "h3=2404.94;\n", + "print(\"If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\")\n", + "print(\"mass of moisture retained in separator(m)=(1-x3)*0.5 kg\")\n", + "m=(1-x3)*0.5\n", + "print(\"Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\")\n", + "m_LP=0.5-m\n", + "print(\"Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\")\n", + "print(\"Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\")\n", + "print(\"(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\")\n", + "T=((0.5685*4.18*90)+(0.4315*4.18*40))/4.18\n", + "print(\"so T in degree celcius=\"),round(T,3)\n", + "print(\"so temperature of water leaving hotwell=68.425 degree celcius\")\n", + "print(\"Applying heat balanced on trap\")\n", + "print(\"0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\")\n", + "print(\"so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\")\n", + "print(\"from steam tables,at 2 bar,hf=504.70 KJ/kg\")\n", + "hf=504.70;\n", + "h7=((0.5685*4.18*90)-(0.0685*hf))/0.5\n", + "print(\"Therefore,heat transferred in process heater in KJ/kg steam generated=\"),round(0.5*(h3-h7),3)\n", + "print(\"so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\")\n", + "print(\"For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\")\n", + "s10=s3;\n", + "print(\"Let dryness fraction be x10\")\n", + "print(\"s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "print(\"so x10=(s10-sf)/sfg\")\n", + "x10=(s10-sf)/sfg\n", + "x10=0.754;#approx.\n", + "print(\"h10=hf at 0.075 bar+x10*hfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0;\n", + "print(\"so h10=hf+x10*hfg in KJ/kg \")\n", + "h10=hf+x10*hfg \n", + "print(\"net work output,neglecting pump work per kg of steam generated,\")\n", + "print(\"w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\")\n", + "w_net=(h2-h3)*1+0.4315*(h3-h10) \n", + "q_add=(h2-4.18*68.425)\n", + "print(\"Heat added in boiler per kg steam generated,q_add in KJ/kg=\"),round(q_add,2)\n", + "w_net/q_add\n", + "print(\"thermal efficiency=w_net/q_add\"),round(w_net/q_add,2)\n", + "print(\"in percentage\"),round(w_net*100/q_add,2)\n", + "print(\"so Thermal efficiency=27.58%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.16;pg no: 291" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.16, Page:291 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\n", + "from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\n", + "Assuming isentropic expansion in nozzle,s1=s2=6.9486\n", + "Letdryness fraction at state 2,x2=0.864\n", + "s2=sf at 0.2 bar+x2*sfg at 0.2 bar\n", + "from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\n", + "so x2= 0.86\n", + "hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\n", + "from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\n", + "considering pump work to be of isentropic type,deltah_34=v3*deltap_34\n", + "from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\n", + "or deltah_34 in KJ/kg= 7.1\n", + "pump work,Wp in KJ/kg= 7.1\n", + "turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\n", + "net work(W_net)=Wt-Wp in KJ/kg\n", + "power produced(P)=mass flow rate*W_net in KJ/s\n", + "so net power=43.22 MW\n", + "heat supplied in boiler(Q)=(h1-h4) in KJ/kg\n", + "enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\n", + "total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s 114534.05\n", + "thermal efficiency=net work/heat supplied=W_net/Q 0.38\n", + "in percentage 37.73\n", + "so thermal efficiency=37.73%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,net power\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.16, Page:291 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\")\n", + "m=35;#mass flow rate in kg/s\n", + "print(\"from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\")\n", + "h1=3530.9;\n", + "s1=6.9486;\n", + "print(\"Assuming isentropic expansion in nozzle,s1=s2=6.9486\")\n", + "s2=s1;\n", + "print(\"Letdryness fraction at state 2,x2=0.864\")\n", + "print(\"s2=sf at 0.2 bar+x2*sfg at 0.2 bar\")\n", + "print(\"from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\")\n", + "sf=0.8320;\n", + "sfg=7.0766;\n", + "x2=(s2-sf)/sfg\n", + "print(\"so x2=\"),round(x2,2)\n", + "x2=0.864;#approx.\n", + "print(\"hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\")\n", + "print(\"from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\")\n", + "hf=251.4;\n", + "hfg=2358.3;\n", + "h2=hf+x2*hfg\n", + "print(\"considering pump work to be of isentropic type,deltah_34=v3*deltap_34\")\n", + "print(\"from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\")\n", + "v3=0.001017;\n", + "p3=70;#;pressure of steam entering turbine in bar\n", + "p4=0.20;#condenser pressure in bar\n", + "deltah_34=v3*(p3-p4)*100\n", + "print(\"or deltah_34 in KJ/kg=\"),round(deltah_34,2)\n", + "Wp=deltah_34\n", + "print(\"pump work,Wp in KJ/kg=\"),round(Wp,2)\n", + "print(\"turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\")\n", + "Wt=(h1-h2)\n", + "print(\"net work(W_net)=Wt-Wp in KJ/kg\")\n", + "W_net=Wt-Wp\n", + "print(\"power produced(P)=mass flow rate*W_net in KJ/s\")\n", + "P=m*W_net\n", + "print(\"so net power=43.22 MW\")\n", + "print(\"heat supplied in boiler(Q)=(h1-h4) in KJ/kg\")\n", + "print(\"enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\")\n", + "h3=hf;\n", + "h4=h3+deltah_34 \n", + "Q=m*(h1-h4)\n", + "print(\"total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s\"),round(Q,2)\n", + "print(\"thermal efficiency=net work/heat supplied=W_net/Q\"),round(P/Q,2)\n", + "print(\"in percentage\"),round(P*100/Q,2)\n", + "print(\"so thermal efficiency=37.73%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.17;pg no: 292" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.1, Page:292 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 17\n", + "from steam tables,h1=3625.3 KJ/s,s1=6.9029 KJ/kg K\n", + "due to isentropic expansion,s1=s2=s3=6.9029 KJ/kg K\n", + "at state 2,i.e at pressure of 2 MPa and entropy 6.9029 KJ/kg K\n", + "by interpolating state for s2 between 2 MPa,300 degree celcius and 2 MPa,350 degree celcius from steam tables,\n", + "h2=3105.08 KJ/kg \n", + "for state 3,i.e at pressure of 0.01 MPa entropy,s3 lies in wet region as s3In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,mass of steam\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.18, Page:294 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 18\")\n", + "W_net=50*10**3;#net output of turbine in KW\n", + "print(\"from steam tables,at inlet to first stage of turbine,h1=h at 100 bar,500oc=3373.7 KJ/kg,s1=s at 100 bar,500oc=6.5966 KJ/kg\")\n", + "h1=3373.7;\n", + "s1=6.5966;\n", + "print(\"Due to isentropic expansion,s1=s6=s2 and s3=s8=s4\")\n", + "s2=s1;\n", + "s6=s2;\n", + "print(\"State at 6 i.e bleed state from HP turbine,temperature by interpolation from steam table =261.6oc.\")\n", + "print(\"At inlet to second stage of turbine,h6=2930.572 KJ/kg\")\n", + "h6=2930.572;\n", + "print(\"h3=h at 10 bar,500oc=3478.5 KJ/kg,s3=s at 10 bar,500oc=7.7622 KJ/kg K\")\n", + "h3=3478.5;\n", + "s3=7.7622;\n", + "s4=s3;\n", + "s8=s4;\n", + "print(\"At exit from first stage of turbine i.e. at 10 bar and entropy of 6.5966 KJ/kg K,Temperature by interpolation from steam table at 10 bar and entropy of 6.5966 KJ/kg K\")\n", + "print(\"T2=181.8oc,h2=2782.8 KJ/kg\")\n", + "T2=181.8;\n", + "h2=2782.8;\n", + "print(\"state at 8,i.e bleed state from second stage of expansion,i.e at 4 bar and entropy of 7.7622 KJ/kg K,Temperature by interpolation from steam table,T8=358.98oc=359oc\")\n", + "T8=359;\n", + "print(\"h8=3188.7 KJ/kg\")\n", + "h8=3188.7;\n", + "print(\"state at 4 i.e. at condenser pressure of 0.1 bar and entropy of 7.7622 KJ/kg K,the state lies in wet region.So let the dryness fraction be x4.\")\n", + "print(\"s4=sf at 0.1 bar+x4*sfg at 0.1 bar\")\n", + "print(\"from steam tables,at 0.1 bar,sf=0.6493 KJ/kg K,sfg=7.5009 KJ/kg K\")\n", + "sf=0.6493;\n", + "sfg=7.5009; \n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.95;#approx.\n", + "print(\"h4=hf at 0.1 bar+x4*hfg at 0.1 bar in KJ/kg \")\n", + "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,hfg=2392.8 KJ/kg\")\n", + "hf=191.83;\n", + "hfg=2392.8;\n", + "h4=hf+x4*hfg\n", + "print(\"given,h4=2464.99 KJ/kg,h11=856.8 KJ/kg,h9=hf at 4 bar=604.74 KJ/kg\")\n", + "h4=2464.99;\n", + "h11=856.8;\n", + "h9=604.74;\n", + "print(\"considering pump work,the net output can be given as,\")\n", + "print(\"W_net=W_HPT+W_LPT-(W_CEP+W_FP)\")\n", + "print(\"where,W_HPT={(h1-h6)+(1-m6)*(h6-h2)}per kg of steam from boiler.\")\n", + "print(\"W_LPT={(1-m6)+(h3-h8)*(1-m6-m8)*(h8-h4)}per kg of steam from boiler.\")\n", + "print(\"for closed feed water heater,energy balance yields;\")\n", + "print(\"m6*h6+h10=m6*h7+h11\")\n", + "print(\"assuming condensate leaving closed feed water heater to be saturated liquid,\")\n", + "print(\"h7=hf at 20 bar=908.79 KJ/kg\")\n", + "h7=908.79; \n", + "print(\"due to throttline,h7=h7_a=908.79 KJ/kg\")\n", + "h7_a=h7;\n", + "print(\"for open feed water heater,energy balance yields,\")\n", + "print(\"m6*h7_a+m8*h8+(1-m6-m8)*h5=h9\")\n", + "print(\"for condensate extraction pump,h5-h4_a=v4_a*deltap\")\n", + "print(\"h5-hf at 0.1 bar=vf at 0.1 bar*(4-0.1)*10^2 \")\n", + "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,vf=0.001010 m^3/kg\")\n", + "hf=191.83;\n", + "vf=0.001010; \n", + "h5=hf+vf*(4-0.1)*10**2\n", + "print(\"so h5 in KJ/kg=\"),round(h5,2)\n", + "print(\"for feed pump,h10-h9=v9*deltap\")\n", + "print(\"h10=h9+vf at 4 bar*(100-4)*10^2 in KJ/kg\")\n", + "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,vf=0.001084 m^3/kg \")\n", + "hf=604.74;\n", + "vf=0.001084;\n", + "h10=h9+vf*(100-4)*10**2\n", + "print(\"substituting in energy balance upon closed feed water heater,\")\n", + "m6=(h11-h10)/(h6-h7)\n", + "print(\"m6 in kg per kg of steam from boiler=\"),round(m6,3)\n", + "print(\"substituting in energy balance upon feed water heater,\")\n", + "m8=(h9-m6*h7_a+m6*h5-h5)/(h8-h5)\n", + "print(\"m8 in kg per kg of steam from boiler=\"),round(m8,3)\n", + "print(\"Let the mass of steam entering first stage of turbine be m kg,then\")\n", + "{(h1-h6)+(1-m6)*(h6-h2)}\n", + "print(\"W_HPT=m*{(h1-h6)+(1-m6)*(h6-h2)}\")\n", + "print(\"W_HPT/m=\"),round(((h1-h6)+(1-m6)*(h6-h2)),2)\n", + "print(\"so W_HPT=m*573.24 KJ\")\n", + "print(\"also,W_LPT={(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}per kg of steam from boiler\")\n", + "{(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}\n", + "print(\"W_LPT/m=\"),round(((1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)),2)\n", + "print(\"so W_LPT=m*813.42 KJ\")\n", + "print(\"pump works(negative work)\")\n", + "print(\"W_CEP=m*(1-m6-m8)*(h5-h4_a)\")\n", + "h4_a=191.83;#h4_a=hf at 0.1 bar\n", + "print(\"W_CEP/m=\")\n", + "(1-m6-m8)*(h5-h4_a)\n", + "print(\"so W_CEP=m* 0.304\")\n", + "print(\"W_FP=m*(h10-h9)\")\n", + "print(\"W_FP/m=\"),round((h10-h9),2)\n", + "print(\"so W_FP=m*10.41\")\n", + "print(\"net output,\")\n", + "print(\"W_net=W_HPT+W_LPT-W_CEP-W_FP \")\n", + "print(\"so 50*10^3=(573.24*m+813.42*m-0.304*m-10.41*m)\")\n", + "m=W_net/(573.24+813.42-0.304-10.41)\n", + "print(\"so m in kg/s=\"),round(m,2)\n", + "Q_add=m*(h1-h11)\n", + "print(\"heat supplied in boiler,Q_add in KJ/s=\"),round(m*(h1-h11),2)\n", + "print(\"Thermal efficenncy=\"),round(W_net/Q_add,2)\n", + "print(\"in percentage\"),round(W_net*100/Q_add,2)\n", + "print(\"so mass of steam bled at 20 bar=0.119 kg per kg of steam entering first stage\")\n", + "print(\"mass of steam bled at 4 bar=0.109 kg per kg of steam entering first stage\")\n", + "print(\"mass of steam entering first stage=36.33 kg/s\")\n", + "print(\"thermal efficiency=54.66%\")\n", + "print(\"NOTE=>In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter8_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter8_2.ipynb new file mode 100755 index 00000000..5088b9af --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter8_2.ipynb @@ -0,0 +1,2594 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 8:Vapour Power Cycles" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.1;pg no: 260" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.1, Page:260 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\n", + "T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\n", + "enthalpy at state 2,h2= hg at 7 MPa\n", + "from steam table,h=2772.1 KJ/kg\n", + "entropy at state 2,s2=sg at 7MPa\n", + "from steam table,s2=5.8133 KJ/kg K\n", + "enthalpy and entropy at state 3,\n", + "from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\n", + "for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \n", + "from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\n", + "s1=s2=sf+x1*sfg\n", + "so x1= 0.68\n", + "from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\n", + "enthalpy at state 1,h1 in KJ/kg= 1802.53\n", + "let dryness fraction at state 4 be x4\n", + "for process 4-3,s4=s3=sf+x4*sfg\n", + "so x4= 0.33\n", + "enthalpy at state 4,h4 in KJ/kg= 962.81\n", + "thermal efficiency=net work/heat added\n", + "expansion work per kg=(h2-h1) in KJ/kg 969.57\n", + "compression work per kg=(h3-h4) in KJ/kg(+ve) 304.19\n", + "heat added per kg=(h2-h3) in KJ/kg(-ve) 1505.1\n", + "net work per kg=(h2-h1)-(h3-h4) in KJ/kg 665.38\n", + "thermal efficiency 0.44\n", + "in percentage 44.21\n", + "so thermal efficiency=44.21%\n", + "turbine work=969.57 KJ/kg(+ve)\n", + "compression work=304.19 KJ/kg(-ve)\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,turbine work,compression work\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.1, Page:260 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\")\n", + "print(\"T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\")\n", + "print(\"enthalpy at state 2,h2= hg at 7 MPa\")\n", + "print(\"from steam table,h=2772.1 KJ/kg\")\n", + "h2=2772.1;\n", + "print(\"entropy at state 2,s2=sg at 7MPa\")\n", + "print(\"from steam table,s2=5.8133 KJ/kg K\")\n", + "s2=5.8133;\n", + "print(\"enthalpy and entropy at state 3,\")\n", + "print(\"from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\")\n", + "h3=1267;\n", + "s3=3.1211;\n", + "print(\"for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \")\n", + "s1=s2;\n", + "print(\"from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\")\n", + "sf=0.5564;\n", + "sfg=7.7237;\n", + "print(\"s1=s2=sf+x1*sfg\")\n", + "x1=(s2-sf)/sfg\n", + "print(\"so x1=\"),round(x1,2) \n", + "x1=0.6806;#approx.\n", + "print(\"from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\")\n", + "hf=162.60;\n", + "hfg=2409.54;\n", + "h1=hf+x1*hfg\n", + "print(\"enthalpy at state 1,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"let dryness fraction at state 4 be x4\")\n", + "print(\"for process 4-3,s4=s3=sf+x4*sfg\")\n", + "s4=s3;\n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.3321;#approx.\n", + "h4=hf+x4*hfg\n", + "print(\"enthalpy at state 4,h4 in KJ/kg=\"),round(h4,2)\n", + "print(\"thermal efficiency=net work/heat added\")\n", + "(h2-h1)\n", + "print(\"expansion work per kg=(h2-h1) in KJ/kg\"),round((h2-h1),2)\n", + "(h3-h4)\n", + "print(\"compression work per kg=(h3-h4) in KJ/kg(+ve)\"),round((h3-h4),2)\n", + "(h2-h3)\n", + "print(\"heat added per kg=(h2-h3) in KJ/kg(-ve)\"),round((h2-h3),2)\n", + "(h2-h1)-(h3-h4)\n", + "print(\"net work per kg=(h2-h1)-(h3-h4) in KJ/kg\"),round((h2-h1)-(h3-h4),2)\n", + "((h2-h1)-(h3-h4))/(h2-h3)\n", + "print(\"thermal efficiency\"),round(((h2-h1)-(h3-h4))/(h2-h3),2)\n", + "print(\"in percentage\"),round((((h2-h1)-(h3-h4))/(h2-h3))*100,2)\n", + "print(\"so thermal efficiency=44.21%\")\n", + "print(\"turbine work=969.57 KJ/kg(+ve)\")\n", + "print(\"compression work=304.19 KJ/kg(-ve)\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.2;pg no: 261" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.2, Page:261 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\n", + "from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\n", + "hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\n", + "from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\n", + "hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\n", + "as process 2-3 is isentropic,so s2=s3\n", + "and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\n", + "so x3= 0.69\n", + "hence enthalpy at 3,\n", + "h3 in KJ/kg= 1819.85\n", + "enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\n", + "process 1-4 is isentropic,so s1=s4\n", + "s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\n", + "so x4= 0.31\n", + "enthalpy at 4,h4 in KJ/kg= 884.31\n", + "enthalpy at 1,h1 in KJ/kg= 1154.23\n", + "carnot cycle(1-2-3-4-1) efficiency:\n", + "n_carnot=net work/heat added\n", + "n_carnot 0.43\n", + "in percentage 42.96\n", + "so n_carnot=42.95%\n", + "In rankine cycle,1-2-3-5-6-1,\n", + "pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg 5.02\n", + "h5 KJ/kg= 137.82\n", + "hence h6 in KJ/kg 142.84\n", + "net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg 969.43\n", + "heat added=(h2-h6)in KJ/kg 2651.46\n", + "rankine cycle efficiency(n_rankine)= 0.37\n", + "in percentage 36.56\n", + "so n_rankine=36.56%\n" + ] + } + ], + "source": [ + "#cal of n_carnot,n_rankine\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.2, Page:261 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\")\n", + "print(\"from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\")\n", + "print(\"hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\")\n", + "hf_5MPa=1154.23;\n", + "sf_5MPa=2.92;\n", + "hg_5MPa=2794.3;\n", + "sg_5MPa=5.97;\n", + "print(\"from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\")\n", + "print(\"hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\")\n", + "hf_5KPa=137.82;\n", + "sf_5KPa=0.4764;\n", + "hg_5KPa=2561.5;\n", + "sg_5KPa=8.3951;\n", + "vf_5KPa=0.001005;\n", + "print(\"as process 2-3 is isentropic,so s2=s3\")\n", + "print(\"and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\")\n", + "s2=sg_5MPa;\n", + "s3=s2;\n", + "x3=(s3-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.694;#approx.\n", + "print(\"hence enthalpy at 3,\")\n", + "h3=hf_5KPa+x3*(hg_5KPa-hf_5KPa)\n", + "print(\"h3 in KJ/kg=\"),round(h3,2)\n", + "print(\"enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\")\n", + "print(\"process 1-4 is isentropic,so s1=s4\")\n", + "s1=sf_5MPa;\n", + "print(\"s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\")\n", + "x4=(s1-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.308;#approx.\n", + "h4=hf_5KPa+x4*(hg_5KPa-hf_5KPa)\n", + "print(\"enthalpy at 4,h4 in KJ/kg=\"),round(h4,2)\n", + "h1=hf_5MPa\n", + "h2=hg_5MPa;\n", + "n_carnot=((h2-h3)-(h1-h4))/(h2-h1)\n", + "print(\"enthalpy at 1,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"carnot cycle(1-2-3-4-1) efficiency:\")\n", + "print(\"n_carnot=net work/heat added\")\n", + "print(\"n_carnot\"),round(n_carnot,2)\n", + "print(\"in percentage\"),round(n_carnot*100,2)\n", + "print(\"so n_carnot=42.95%\")\n", + "print(\"In rankine cycle,1-2-3-5-6-1,\")\n", + "p6=5000;#boiler pressure in KPa\n", + "p5=5;#condenser pressure in KPa\n", + "vf_5KPa*(p6-p5)\n", + "print(\"pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg\"),round(vf_5KPa*(p6-p5),2)\n", + "h5=hf_5KPa;\n", + "print(\"h5 KJ/kg=\"),round(hf_5KPa,2)\n", + "h6=h5+(vf_5KPa*(p6-p5))\n", + "print(\"hence h6 in KJ/kg\"),round(h6,2)\n", + "(h2-h3)-(h6-h5)\n", + "print(\"net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg\"),round((h2-h3)-(h6-h5),2)\n", + "(h2-h6)\n", + "print(\"heat added=(h2-h6)in KJ/kg\"),round((h2-h6),2)\n", + "n_rankine=((h2-h3)-(h6-h5))/(h2-h6)\n", + "print(\"rankine cycle efficiency(n_rankine)=\"),round(n_rankine,2)\n", + "print(\"in percentage\"),round(n_rankine*100,2)\n", + "print(\"so n_rankine=36.56%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.3;pg no: 263" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.3, Page:263 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\n", + "from steam tables,h2=hg_40bar=3092.5 KJ/kg\n", + "s2=sg_40bar=6.5821 KJ/kg K\n", + "h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \n", + "s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "v4=vf_0.05bar=0.001005 m^3/kg\n", + "let the dryness fraction at state 3 be x3,\n", + "for ideal process,2-3,s2=s3\n", + "s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\n", + "so x3= 0.77\n", + "h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\n", + "for pumping process,\n", + "h1-h4=v4*deltap=v4*(p1-p4)\n", + "so h1=h4+v4*(p1-p4) in KJ/kg 141.83\n", + "pump work per kg of steam in KJ/kg 4.01\n", + "net work per kg of steam =(expansion work-pump work)per kg of steam\n", + "=(h2-h3)-(h1-h4) in KJ/kg= 1081.75\n", + "cycle efficiency=net work/heat added 0.37\n", + "in percentage 36.66\n", + "so net work per kg of steam=1081.74 KJ/kg\n", + "cycle efficiency=36.67%\n", + "pump work per kg of steam=4.02 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of net work per kg of steam,cycle efficiency,pump work per kg of steam\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.3, Page:263 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\")\n", + "print(\"from steam tables,h2=hg_40bar=3092.5 KJ/kg\")\n", + "h2=3092.5;\n", + "print(\"s2=sg_40bar=6.5821 KJ/kg K\")\n", + "s2=6.5821;\n", + "print(\"h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \")\n", + "h4=137.82;\n", + "hfg=2423.7;\n", + "print(\"s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "s4=0.4764;\n", + "sfg=7.9187;\n", + "print(\"v4=vf_0.05bar=0.001005 m^3/kg\")\n", + "v4=0.001005;\n", + "print(\"let the dryness fraction at state 3 be x3,\")\n", + "print(\"for ideal process,2-3,s2=s3\")\n", + "s3=s2;\n", + "print(\"s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\")\n", + "x3=(s2-s4)/(sfg)\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.7711;#approx.\n", + "print(\"h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\")\n", + "h3=h4+x3*hfg\n", + "print(\"for pumping process,\")\n", + "print(\"h1-h4=v4*deltap=v4*(p1-p4)\")\n", + "p1=40*100;#pressure of steam enter in turbine in mPa\n", + "p4=0.05*100;#pressure of steam leave turbine in mPa\n", + "h1=h4+v4*(p1-p4)\n", + "print(\"so h1=h4+v4*(p1-p4) in KJ/kg\"),round(h1,2)\n", + "(h1-h4)\n", + "print(\"pump work per kg of steam in KJ/kg\"),round((h1-h4),2)\n", + "print(\"net work per kg of steam =(expansion work-pump work)per kg of steam\")\n", + "(h2-h3)-(h1-h4)\n", + "print(\"=(h2-h3)-(h1-h4) in KJ/kg=\"),round((h2-h3)-(h1-h4),2)\n", + "print(\"cycle efficiency=net work/heat added\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", + "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", + "print(\"so net work per kg of steam=1081.74 KJ/kg\")\n", + "print(\"cycle efficiency=36.67%\")\n", + "print(\"pump work per kg of steam=4.02 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.4;pg no: 264" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.4, Page:264 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 4\n", + "Let us assume that the condensate leaves condenser as saturated liquid and the expansion in turbine and pumping processes are isentropic.\n", + "from steam tables,h2=h_20MPa=3238.2 KJ/kg\n", + "s2=6.1401 KJ/kg K\n", + "h5=h_0.005MPa in KJ/kg\n", + "from steam tables,at 0.005 MPa,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "h5=hf+0.9*hfg in KJ/kg 2319.15\n", + "s5 in KJ/kg K= 7.6\n", + "h6=hf=137.82 KJ/kg\n", + "it is given that temperature at state 4 is 500 degree celcius and due to isentropic processes s4=s5=7.6032 KJ/kg K.The state 4 can be conveniently located on mollier chart by the intersection of 500 degree celcius constant temperature line and entropy value of 7.6032 KJ/kg K and the pressure and enthalpy obtained.but these shall be approximate.\n", + "The state 4 can also be located by interpolation using steam table.The entropy value of 7.6032 KJ/kg K lies between the superheated steam states given under,p=1.20 MPa,s at 1.20 MPa=7.6027 KJ/kg K\n", + "p=1.40 MPa,s at 1.40 MPa=7.6027 KJ/kg K\n", + "by interpolation state 4 lies at pressure=\n", + "=1.399,approx.=1.40 MPa\n", + "thus,steam leaves HP turbine at 1.40 MPa\n", + "enthalpy at state 4,h4=3474.1 KJ/kg\n", + "for process 2-33,s2=s3=6.1401 KJ/kg K.The state 3 thus lies in wet region as s3sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\n", + "From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\n", + "Let dryness fraction at state 9 be x9 so,\n", + "s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\n", + "from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\n", + "x9=(s9-sf)/sfg 0.95\n", + "h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\n", + "from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\n", + "Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\n", + "h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\n", + "h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\n", + "For process 4-8,i.e in CEP.\n", + "h8 in KJ/kg= 138.22\n", + "For process 11-12,i.e in FP2,\n", + "h12=h11+v11*(40-4)*10^2 in KJ/kg 608.64\n", + "For process 13-1_a i.e. in FP1,h1_a= in KJ/kg= 1107.34\n", + "m1*3141.81+(1-m1)*608.64=1087.31\n", + "so m1=(1087.31-608.64)/(3141.81-608.64)in kg\n", + "Applying energy balance on open feed water heater 1 (OFWH1)\n", + "m1*h10+(1-m1)*h12)=1*h13\n", + "so m1 in kg= 0.19\n", + "Applying energy balance on open feed water heater 2 (OFWH2)\n", + "m2*h9+(1-m1-m2)*h8=(1-m1)*h11\n", + "so m2 in kg= 0.15\n", + "Thermal efficiency of cycle,n= 0.51\n", + "W_CEP in KJ/kg steam from boiler= 0.26\n", + "W_FP1=(h1_a-h13)in KJ/kg of steam from boiler 20.0\n", + "W_FP2 in KJ/kg of steam from boiler= 3.17\n", + "W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler= 23.46\n", + "n= 0.51\n", + "in percentage 51.37\n", + "so cycle thermal efficiency,na=46.18%\n", + "nb=49.76%\n", + "nc=51.37%\n", + "hence it is obvious that efficiency increases with increase in number of feed heaters.\n" + ] + } + ], + "source": [ + "#cal of maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.6, Page:267 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 6\")\n", + "print(\"case (a) When there is no feed water heater\")\n", + "print(\"Thermal efficiency of cycle=((h2-h3)-(h1-h4))/(h2-h1)\")\n", + "print(\"from steam tables,h2=h at 200 bar,650oc=3675.3 KJ/kg,s2=s at 200 bar,650oc=6.6582 KJ/kg K,h4=hf at 0.05 bar=137.82 KJ/kg,v4=vf at 0.05 bar=0.001005 m^3/kg\")\n", + "h2=3675.3;\n", + "s2=6.6582;\n", + "h4=137.82;\n", + "v4=0.001005;\n", + "print(\"hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg,sf at 0.05 bar=0.4764 KJ/kg K,sfg at 0.05 bar=7.9187 KJ/kg K\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "print(\"For process 2-3,s2=s3.Let dryness fraction at 3 be x3.\")\n", + "s3=s2;\n", + "print(\"s3=6.6582=sf at 0.05 bar+x3*sfg at 0.05 bar\")\n", + "x3=(s3-sf)/sfg\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.781;#approx.\n", + "print(\"h3=hf at 0.05 bar+x3*hfg at 0.05 bar in KJ/kg\")\n", + "h3=hf+x3*hfg\n", + "print(\"For pumping process 4-1,\")\n", + "print(\"h1-h4=v4*deltap\")\n", + "h1=h4+v4*(200-0.5)*10**2\n", + "print(\"h1= in KJ/kg=\"),round(h1,2)\n", + "((h2-h3)-(h1-h4))/(h2-h1)\n", + "print(\"Thermal efficiency of cycle=\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", + "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", + "print(\"case (b) When there is only one feed water heater working at 8 bar\")\n", + "print(\"here,let mass of steam bled for feed heating be m kg\")\n", + "print(\"For process 2-6,s2=s6=6.6582 KJ/kg K\")\n", + "s6=s2;\n", + "print(\"Let dryness fraction at state 6 be x6\")\n", + "print(\"s6=sf at 8 bar+x6*sfg at 8 bar\")\n", + "print(\"from steam tables,hf at 8 bar=721.11 KJ/kg,vf at 8 bar=0.001115 m^3/kg,hfg at 8 bar=2048 KJ/kg,sf at 8 bar=2.0462 KJ/kg K,sfg at 8 bar=4.6166 KJ/kg K\")\n", + "hf=721.11;\n", + "vf=0.001115;\n", + "hfg=2048;\n", + "sf=2.0462;\n", + "sfg=4.6166;\n", + "x6=(s6-sf)/sfg\n", + "print(\"substituting entropy values,x6=\"),round(x6,2)\n", + "x6=0.999;#approx.\n", + "print(\"h6=hf at at 8 bar+x6*hfg at 8 bar in KJ/kg\")\n", + "h6=hf+x6*hfg\n", + "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at 8 bar.h7=hf at 8 bar=721.11 KJ/kg\")\n", + "h7=721.11;\n", + "h5=h4+v4*(8-.05)*10**2\n", + "print(\"For process 4-5,h5 in KJ/kg\"),round(h5,2)\n", + "print(\"Applying energy balance at open feed water heater,\")\n", + "print(\"m*h6+(1-m)*h5=1*h7\")\n", + "m=(h7-h5)/(h6-h5)\n", + "print(\"so m= in kg\"),round(m,2)\n", + "h7=hf;\n", + "v7=vf;\n", + "h1=h7+v7*(200-8)*10**2\n", + "print(\"For process 7-1,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"here h7=hf at 8 bar,v7=vf at 8 bar\")\n", + "#TE=((h2-h6)+(1-m)*(h6-h3)-((1-m)*(h5-h4)+(h1-h7))/(h2-h1)\n", + "print(\"Thermal efficiency of cycle=0.4976\")\n", + "print(\"in percentage=49.76\")\n", + "print(\"case (c) When there are two feed water heaters working at 40 bar and 4 bar\")\n", + "print(\"here, let us assume the mass of steam at 40 bar,4 bar to be m1 kg and m2 kg respectively.\")\n", + "print(\"2-10-9-3,s2=s10=s9=s3=6.6582 KJ/kg K\")\n", + "s3=s2;\n", + "s9=s3;\n", + "s10=s9;\n", + "print(\"At state 10.s10>sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\")\n", + "print(\"From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\")\n", + "T10=370.6;\n", + "h10=3141.81;\n", + "print(\"Let dryness fraction at state 9 be x9 so,\") \n", + "print(\"s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\")\n", + "print(\"from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\")\n", + "sf=1.7766;\n", + "sfg=5.1193;\n", + "x9=(s9-sf)/sfg\n", + "print(\"x9=(s9-sf)/sfg\"),round(x9,2)\n", + "x9=0.9536;#approx.\n", + "print(\"h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\")\n", + "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\")\n", + "hf=604.74;\n", + "hfg=2133.8;\n", + "h9=hf+x9*hfg \n", + "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\")\n", + "print(\"h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\")\n", + "h11=604.74;\n", + "v11=0.001084;\n", + "print(\"h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\")\n", + "h13=1087.31;\n", + "v13=0.001252;\n", + "print(\"For process 4-8,i.e in CEP.\")\n", + "h8=h4+v4*(4-0.05)*10**2\n", + "print(\"h8 in KJ/kg=\"),round(h8,2)\n", + "print(\"For process 11-12,i.e in FP2,\")\n", + "h12=h11+v11*(40-4)*10**2\n", + "print(\"h12=h11+v11*(40-4)*10^2 in KJ/kg\"),round(h12,2)\n", + "h1_a=h13+v13*(200-40)*10**2\n", + "print(\"For process 13-1_a i.e. in FP1,h1_a= in KJ/kg=\"),round(h1_a,2)\n", + "print(\"m1*3141.81+(1-m1)*608.64=1087.31\")\n", + "print(\"so m1=(1087.31-608.64)/(3141.81-608.64)in kg\")\n", + "m1=(1087.31-608.64)/(3141.81-608.64)\n", + "print(\"Applying energy balance on open feed water heater 1 (OFWH1)\")\n", + "print(\"m1*h10+(1-m1)*h12)=1*h13\")\n", + "m1=(h13-h12)/(h10-h12)\n", + "print(\"so m1 in kg=\"),round(m1,2)\n", + "print(\"Applying energy balance on open feed water heater 2 (OFWH2)\")\n", + "print(\"m2*h9+(1-m1-m2)*h8=(1-m1)*h11\")\n", + "m2=(1-m1)*(h11-h8)/(h9-h8)\n", + "print(\"so m2 in kg=\"),round(m2,2)\n", + "W_CEP=(1-m1-m2)*(h8-h4)\n", + "W_FP1=(h1_a-h13)\n", + "W_FP2=(1-m1)*(h12-h11)\n", + "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", + "print(\"Thermal efficiency of cycle,n=\"),round(n,2)\n", + "print(\"W_CEP in KJ/kg steam from boiler=\"),round(W_CEP,2)\n", + "print(\"W_FP1=(h1_a-h13)in KJ/kg of steam from boiler\"),round(W_FP1)\n", + "print(\"W_FP2 in KJ/kg of steam from boiler=\"),round(W_FP2,2)\n", + "W_CEP+W_FP1+W_FP2\n", + "print(\"W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler=\"),round(W_CEP+W_FP1+W_FP2,2)\n", + "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", + "print(\"n=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so cycle thermal efficiency,na=46.18%\")\n", + "print(\"nb=49.76%\")\n", + "print(\"nc=51.37%\")\n", + "print(\"hence it is obvious that efficiency increases with increase in number of feed heaters.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.7;pg no: 272" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.7, Page:272 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\n", + "from steam tables,\n", + "h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\n", + "s3=s2=6.9759 KJ/kg K\n", + "by interpolation from steam tables,\n", + "T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\n", + "for expansion process 4-5,s4=s5=7.7938 KJ/kg K\n", + "let dryness fraction at state 5 be x5\n", + "s5=sf at 0.05 bar+x5*sfg at 0.05 bar\n", + "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "so x5= 0.92\n", + "h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\n", + "from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\n", + "h6=hf at 0.05 bar=137.82 KJ/kg\n", + "v6=vf at 0.05 bar=0.001005 m^3/kg\n", + "for process 6-1 in feed pump,h1 in KJ/kg= 142.84\n", + "cycle efficiency=W_net/Q_add\n", + "Wt in KJ/kg= 1510.35\n", + "W_pump=(h1-h6)in KJ/kg 5.02\n", + "W_net=Wt-W_pump in KJ/kg 1505.33\n", + "Q_add in KJ/kg= 3290.96\n", + "cycle efficiency= 0.4574\n", + "in percentage= 45.74\n", + "we know ,1 hp=0.7457 KW\n", + "specific steam consumption in kg/hp hr= 1.78\n", + "work ratio=net work/positive work 0.9967\n", + "so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\n" + ] + } + ], + "source": [ + "#cal of cycle efficiency,specific steam consumption,work ratio\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.7, Page:272 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\")\n", + "print(\"from steam tables,\")\n", + "print(\"h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\")\n", + "h2=3433.8;\n", + "s2=6.9759;\n", + "print(\"s3=s2=6.9759 KJ/kg K\")\n", + "s3=s2;\n", + "print(\"by interpolation from steam tables,\")\n", + "print(\"T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\")\n", + "T3=183.14;\n", + "h3=2818.03;\n", + "h4=3271.9;\n", + "s4=7.7938;\n", + "print(\"for expansion process 4-5,s4=s5=7.7938 KJ/kg K\")\n", + "s5=s4;\n", + "print(\"let dryness fraction at state 5 be x5\")\n", + "print(\"s5=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", + "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "x5=(s5-sf)/sfg\n", + "print(\"so x5=\"),round(x5,2)\n", + "x5=0.924;#approx.\n", + "print(\"h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\")\n", + "print(\"from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "h5=hf+x5*hfg \n", + "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", + "h6=137.82;\n", + "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", + "v6=0.001005;\n", + "p1=50.;#steam generation pressure in bar\n", + "p6=0.05;#steam entering temperature in turbine in bar\n", + "h1=h6+v6*(p1-p6)*100\n", + "print(\"for process 6-1 in feed pump,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"cycle efficiency=W_net/Q_add\")\n", + "Wt=(h2-h3)+(h4-h5)\n", + "print(\"Wt in KJ/kg=\"),round(Wt,2)\n", + "W_pump=(h1-h6)\n", + "print(\"W_pump=(h1-h6)in KJ/kg\"),round(W_pump,2)\n", + "W_net=Wt-W_pump\n", + "print(\"W_net=Wt-W_pump in KJ/kg\"),round(W_net,2)\n", + "Q_add=(h2-h1)\n", + "print(\"Q_add in KJ/kg=\"),round(Q_add,2)\n", + "print(\"cycle efficiency=\"),round(W_net/Q_add,4)\n", + "W_net*100/Q_add\n", + "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", + "print(\"we know ,1 hp=0.7457 KW\")\n", + "print(\"specific steam consumption in kg/hp hr=\"),round(0.7457*3600/W_net,2)\n", + "print(\"work ratio=net work/positive work\"),round(W_net/Wt,4)\n", + "print(\"so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.8;pg no: 273" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.8, Page:273 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\n", + "from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\n", + "h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\n", + "Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\n", + "h8=hf at 3 bar=561.47 KJ/kg\n", + "for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\n", + "Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\n", + "s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\n", + "from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\n", + "so x3= 0.95\n", + "s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\n", + "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "so x4= 0.79\n", + "thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\n", + "here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\n", + "h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\n", + "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", + "assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\n", + "pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\n", + "for mixing process between condenser and feed pump,\n", + "(1-m)*h5+m*h9=1*h6\n", + "h6=m(h9-h5)+h5\n", + "we get,h6=137.82+m*423.65\n", + "therefore h7=h6+6.02=143.84+m*423.65\n", + "Applying energy balance at closed feed water heater;\n", + "m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\n", + "so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\n", + "so m=0.144 kg\n", + "steam bled for feed heating=0.144 kg/kg steam generated\n", + "The net power output,W_net in KJ/kg steam generated= 1167.27\n", + "mass of steam required to be generated in kg/s= 26.23\n", + "or in kg/hr\n", + "so capacity of boiler required=94428 kg/hr\n", + "overall thermal efficiency=W_net/Q_add\n", + "here Q_add in KJ/kg= 3134.56\n", + "overall thermal efficiency= 0.37\n", + "in percentage= 37.24\n", + "so overall thermal efficiency=37.24%\n" + ] + } + ], + "source": [ + "#cal of mass of steam bled for feed heating,capacity of boiler required,overall thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.8, Page:273 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\")\n", + "T_cond=115;#condensate temperature in degree celcius\n", + "Cp=4.18;#specific heat at constant pressure in KJ/kg K\n", + "P=30*10**3;#actual alternator output in KW\n", + "n_boiler=0.9;#boiler efficiency\n", + "n_alternator=0.98;#alternator efficiency\n", + "print(\"from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\")\n", + "h2=3301.8;\n", + "s2=6.7193;\n", + "print(\"h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\")\n", + "h5=137.82;\n", + "v5=0.001005;\n", + "print(\"Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\")\n", + "print(\"h8=hf at 3 bar=561.47 KJ/kg\")\n", + "h8=561.47;\n", + "print(\"for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\")\n", + "s3=s2;\n", + "s4=s3;\n", + "print(\"Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\")\n", + "print(\"s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\")\n", + "print(\"from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\")\n", + "sf_3bar=1.6718;\n", + "sfg_3bar=5.3201;\n", + "x3=(s3-sf_3bar)/sfg_3bar\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.949;#approx.\n", + "print(\"s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\")\n", + "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.788;#approx.\n", + "print(\"thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\")\n", + "print(\"here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\")\n", + "hf_3bar=561.47;\n", + "hfg_3bar=2163.8;\n", + "h3=hf_3bar+x3*hfg_3bar \n", + "print(\"h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\")\n", + "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "h4=hf+x4*hfg\n", + "print(\"assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\")\n", + "h9=h8;\n", + "v6=v5;\n", + "print(\"pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\")\n", + "p1=60;#pressure of steam in high pressure turbine in bar\n", + "p5=0.05;#pressure of steam in low pressure turbine in bar\n", + "v5*(p1-p5)*100\n", + "print(\"for mixing process between condenser and feed pump,\")\n", + "print(\"(1-m)*h5+m*h9=1*h6\")\n", + "print(\"h6=m(h9-h5)+h5\")\n", + "print(\"we get,h6=137.82+m*423.65\")\n", + "print(\"therefore h7=h6+6.02=143.84+m*423.65\")\n", + "print(\"Applying energy balance at closed feed water heater;\")\n", + "print(\"m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\")\n", + "print(\"so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\")\n", + "print(\"so m=0.144 kg\")\n", + "m=0.144;\n", + "h6=137.82+m*423.65;\n", + "h7=143.84+m*423.65;\n", + "print(\"steam bled for feed heating=0.144 kg/kg steam generated\")\n", + "W_net=(h2-h3)+(1-m)*(h3-h4)-(1-m)*(h7-h6)\n", + "print(\"The net power output,W_net in KJ/kg steam generated=\"),round(W_net,2)\n", + "P/(n_alternator*W_net)\n", + "print(\"mass of steam required to be generated in kg/s=\"),round(P/(n_alternator*W_net),2)\n", + "print(\"or in kg/hr\")\n", + "26.23*3600\n", + "print(\"so capacity of boiler required=94428 kg/hr\")\n", + "print(\"overall thermal efficiency=W_net/Q_add\")\n", + "Q_add=(h2-Cp*T_cond)/n_boiler\n", + "print(\"here Q_add in KJ/kg=\"),round(Q_add,2) \n", + "W_net/Q_add\n", + "print(\"overall thermal efficiency=\"),round(W_net/Q_add,2)\n", + "W_net*100/Q_add\n", + "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", + "print(\"so overall thermal efficiency=37.24%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.9;pg no: 275" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.9, Page:275 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\n", + "At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\n", + "For ideal expansion process,s2=s3\n", + "By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\n", + "actual stste at exit of first stage,h3_a in KJ/kg= 2909.88\n", + "actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K= 7.1075\n", + "for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\n", + "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", + "so x4= 0.96\n", + "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", + "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", + "actual enthalpy at exit from second stage,h4_a in KJ/kg= 2646.48\n", + "actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\n", + "so x4_a= 0.99\n", + "x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\n", + "for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x5= 0.87\n", + "h5=2270.43 KJ/kg\n", + "actual enthalpy at exit from third stage,h5_a in KJ/kg= 2345.64\n", + "Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\n", + "By heat balance on first closed feed water heater,(see schematic arrangement)\n", + "h11=hf at 6 bar=670.56 KJ\n", + "m1*h3_a+h10=m1*h11+4.18*150\n", + "(m1*2829.63)+h10=(m1*670.56)+627\n", + "h10+2159.07*m1=627\n", + "By heat balance on second closed feed water heater,(see schematic arrangement)\n", + "h7=hf at 1 bar=417.46 KJ/kg\n", + "m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\n", + "m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\n", + "m2*2467.27-m1*179.2-238.26=0\n", + "heat balance at point of mixing,\n", + "h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\n", + "neglecting pump work,h7=h8\n", + "h10=m2*417.46+(1-m1-m2)*397.1\n", + "substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\n", + "Turbine output per kg of steam generated,Wt in KJ/kg of steam generated= 780.445\n", + "Rate of steam generation required in kg/s= 19.22\n", + "in kg/hr\n", + "capacity of drain pump i.e. FP shown in layout in kg/hr= 16273.96\n", + "so capacity of drain pump=16273.96 kg/hr\n" + ] + } + ], + "source": [ + "#cal of capacity of drain pump\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.9, Page:275 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\")\n", + "P=15*10**3;#turbine output in KW\n", + "print(\"At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\")\n", + "h2=3230.9;\n", + "s2=6.9212;\n", + "print(\"For ideal expansion process,s2=s3\")\n", + "s3=s2;\n", + "print(\"By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\")\n", + "T3=190.97;\n", + "h3=2829.63;\n", + "h3_a=h2-0.8*(h2-h3)\n", + "print(\"actual stste at exit of first stage,h3_a in KJ/kg=\"),round(h3_a,2)\n", + "s3_a=7.1075;\n", + "print(\"actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K=\"),round(s3_a,4)\n", + "print(\"for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\")\n", + "s4=7.1075;\n", + "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", + "sf=1.3026;\n", + "sfg=6.0568;\n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.958;#approx.\n", + "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", + "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", + "hf=417.46;\n", + "hfg=2258.0;\n", + "h4=hf+x4*hfg\n", + "h4_a=h3_a-.8*(h3_a-h4)\n", + "print(\"actual enthalpy at exit from second stage,h4_a in KJ/kg=\"),round(h4_a,2)\n", + "print(\"actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\")\n", + "x4_a=(h4_a-hf)/hfg\n", + "print(\"so x4_a=\"),round(x4_a,2)\n", + "print(\"x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\")\n", + "s4_a=7.2806;\n", + "print(\"for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "x5=(s4_a-sf)/sfg\n", + "print(\"so x5=\"),round(x5,2)\n", + "x5=0.8735;#approx.\n", + "print(\"h5=2270.43 KJ/kg\")\n", + "h5=2270.43;\n", + "h5_a=h4_a-0.8*(h4_a-h5)\n", + "print(\"actual enthalpy at exit from third stage,h5_a in KJ/kg=\"),round(h5_a,2)\n", + "print(\"Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\")\n", + "print(\"By heat balance on first closed feed water heater,(see schematic arrangement)\")\n", + "print(\"h11=hf at 6 bar=670.56 KJ\")\n", + "h11=670.56;\n", + "print(\"m1*h3_a+h10=m1*h11+4.18*150\")\n", + "print(\"(m1*2829.63)+h10=(m1*670.56)+627\")\n", + "print(\"h10+2159.07*m1=627\")\n", + "print(\"By heat balance on second closed feed water heater,(see schematic arrangement)\")\n", + "print(\"h7=hf at 1 bar=417.46 KJ/kg\")\n", + "h7=417.46;\n", + "print(\"m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\")\n", + "print(\"m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\")\n", + "print(\"m2*2467.27-m1*179.2-238.26=0\")\n", + "print(\"heat balance at point of mixing,\")\n", + "print(\"h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\")\n", + "print(\"neglecting pump work,h7=h8\")\n", + "print(\"h10=m2*417.46+(1-m1-m2)*397.1\")\n", + "print(\"substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\")\n", + "m1=0.1293;\n", + "m2=0.1059;\n", + "Wt=(h2-h3_a)+(1-m1)*(h3_a-h4_a)+(1-m1-m2)*(h4_a-h5_a)\n", + "print(\"Turbine output per kg of steam generated,Wt in KJ/kg of steam generated=\"),round(Wt,3)\n", + "P/Wt\n", + "print(\"Rate of steam generation required in kg/s=\"),round(P/Wt,2)\n", + "print(\"in kg/hr\")\n", + "P*3600/Wt\n", + "(m1+m2)*69192\n", + "print(\"capacity of drain pump i.e. FP shown in layout in kg/hr=\"),round((m1+m2)*69192,2)\n", + "print(\"so capacity of drain pump=16273.96 kg/hr\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.10;pg no: 277" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.10, Page:277 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\n", + "at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\n", + "By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\n", + "actual enthapy at 3_a,h3_a in KJ/kg= 3097.0\n", + "enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\n", + "for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\n", + "s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x6= 0.83\n", + "h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "for actual expansion process in LP turbine.\n", + "h6_a=h4-0.85*(h4-h6) in KJ/kg 2319.4\n", + "Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\n", + "s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\n", + "from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\n", + "so x5= 1.0\n", + "h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\n", + "from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\n", + "actual enthalpy,h5_a in KJ/kg= 2790.16\n", + "enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\n", + "specific volume at inlet of CEP,v7=0.001008 m^3/kg\n", + "enthalpy at inlet of CEP,h7=168.79 KJ/kg\n", + "for pumping process 7-8,h8 in KJ/kg= 169.15\n", + "Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\n", + "m*h5+(1-m)*h8=h9\n", + "so m in kg /kg of steam generated= 0.33\n", + "For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\n", + "h1= in KJ/kg= 1015.59\n", + "Net work per kg of steam generated,W_net=in KJ/kg steam generated= 938.83\n", + "heat added per kg of steam generated,q_add in KJ/kg of steam generated= 2405.41\n", + "Thermal efficiency,n= 0.39\n", + "in percentage= 39.03\n", + "so thermal efficiency=39.03%%\n", + "NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\n" + ] + } + ], + "source": [ + "#cal of cycle efficiency\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.10, Page:277 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\")\n", + "print(\"at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\")\n", + "h2=3287.1;\n", + "s2=6.6327;\n", + "print(\"By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\")\n", + "h3=3049.48;\n", + "h3_a=h2-0.80*(h2-h3)\n", + "print(\"actual enthapy at 3_a,h3_a in KJ/kg=\"),round(h3_a,2)\n", + "print(\"enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\")\n", + "h4=3230.9;\n", + "s4=6.9212;\n", + "print(\"for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\")\n", + "s6=s4;\n", + "print(\"s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "x6=(s6-sf)/sfg\n", + "print(\"so x6=\"),round(x6,2)\n", + "x6=0.827;#approx.\n", + "print(\"h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0;\n", + "h6=hf+x6*hfg\n", + "print(\"for actual expansion process in LP turbine.\")\n", + "h6_a=h4-0.85*(h4-h6)\n", + "print(\"h6_a=h4-0.85*(h4-h6) in KJ/kg\"),round(h6_a,2)\n", + "print(\"Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\")\n", + "p5=3.61;\n", + "s5=s4;\n", + "print(\"s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\")\n", + "print(\"from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\")\n", + "sf=1.7391;\n", + "sfg=5.1908;\n", + "x5=(s5-sf)/sfg\n", + "print(\"so x5=\"),round(x5,2)\n", + "x5=0.99;#approx.\n", + "print(\"h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\")\n", + "print(\"from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\")\n", + "hf=589.13;\n", + "hfg=2144.7;\n", + "h5=hf+x5*hfg\n", + "h5_a=h4-0.85*(h4-h5)\n", + "print(\"actual enthalpy,h5_a in KJ/kg=\"),round(h5_a,2)\n", + "print(\"enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\")\n", + "h9=1008.42;\n", + "print(\"specific volume at inlet of CEP,v7=0.001008 m^3/kg\")\n", + "v7=0.001008;\n", + "print(\"enthalpy at inlet of CEP,h7=168.79 KJ/kg\")\n", + "h7=168.79;\n", + "h8=h7+v7*(3.61-0.075)*10**2\n", + "print(\"for pumping process 7-8,h8 in KJ/kg=\"),round(h8,2)\n", + "print(\"Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\")\n", + "print(\"m*h5+(1-m)*h8=h9\")\n", + "m=(h9-h8)/(h5-h8)\n", + "print(\"so m in kg /kg of steam generated=\"),round(m,2)\n", + "print(\"For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\")\n", + "v9=0.00108;\n", + "h1=h9+v9*(70-3.61)*10**2\n", + "print(\"h1= in KJ/kg=\"),round(h1,2) \n", + "W_net=(h2-h3_a)+(h4-h5_a)+(1-m)*(h5_a-h6_a)-((1-m)*(h8-h7)+(h1-h9))\n", + "print(\"Net work per kg of steam generated,W_net=in KJ/kg steam generated=\"),round(W_net,2)\n", + "q_add=(h2-h1)+(h4-h3_a)\n", + "print(\"heat added per kg of steam generated,q_add in KJ/kg of steam generated=\"),round(q_add,2)\n", + "n=W_net/q_add\n", + "print(\"Thermal efficiency,n=\"),round(n,2)\n", + "n=n*100\n", + "print(\"in percentage=\"),round(n,2)\n", + "print(\"so thermal efficiency=39.03%%\")\n", + "print(\"NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.11;pg no: 279" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.11, Page:279 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\n", + "Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\n", + "for isentropic expansion 2-3-4-5,s2=s3=s4=s5\n", + "Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\n", + "s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\n", + "so x3=(s3-sf)/sfg\n", + "from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\n", + "h3=hf+x3*hfg in KJ/kg\n", + "from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\n", + "s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\n", + "so x4=(s4-sf)/sfg\n", + "from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\n", + "so h4=hf+x4*hfg in KJ/kg\n", + "from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\n", + "s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\n", + "so x5=(s5-sf)/sfg\n", + "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "h5=hf+x5*hfg in KJ/kg\n", + "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", + "h6=hf at 0.05 bar=137.82 KJ/kg\n", + "v6=vf at 0.05 bar=0.001005 m^3/kg\n", + "h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\n", + "h8=hf at 1.5 bar=467.11 KJ/kg\n", + "v8=0.001053 m^3/kg=vf at 1.5 bar\n", + "h9=h8+v8*(150-1.5)*10^2 in KJ/kg\n", + "h10=hf at 150 bar=1610.5 KJ/kg\n", + "v10=0.001658 m^3/kg=vf at 150 bar\n", + "h12=h10+v10*(150-10)*10^2 in KJ/kg\n", + "Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\n", + "Heat balance on closed feed water heater yields,\n", + "m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\n", + "so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\n", + "heat balance on open feed water can be given as under,\n", + "m2*h4+(1-m1-m2)*h7=(1-m1)*h8\n", + "so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\n", + "for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\n", + "For mixing after closed feed water heater,\n", + "h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\n", + "Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\n", + "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\n", + "heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\n", + "cycle thermal efficiency,n=W_net/q_add 0.48\n", + "in percentage 47.59\n", + "Net power developed in KW=1219*300 in KW 365700.0\n", + "cycle thermal efficiency=47.6%\n", + "Net power developed=365700 KW\n" + ] + } + ], + "source": [ + "#cal of cycle thermal efficiency,Net power developed\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.11, Page:279 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\")\n", + "print(\"Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\")\n", + "h2=3308.6;\n", + "s2=6.3443;\n", + "print(\"for isentropic expansion 2-3-4-5,s2=s3=s4=s5\")\n", + "s3=s2;\n", + "s4=s3;\n", + "s5=s4;\n", + "print(\"Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\")\n", + "print(\"s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\")\n", + "print(\"so x3=(s3-sf)/sfg\")\n", + "print(\"from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\")\n", + "sf=2.1387;\n", + "sfg=4.4478;\n", + "x3=(s3-sf)/sfg\n", + "x3=0.945;#approx.\n", + "print(\"h3=hf+x3*hfg in KJ/kg\")\n", + "print(\"from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\")\n", + "hf=762.81;\n", + "hfg=2015.3;\n", + "h3=hf+x3*hfg\n", + "print(\"s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\")\n", + "print(\"so x4=(s4-sf)/sfg\")\n", + "print(\"from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\")\n", + "sf=1.4336;\n", + "sfg=5.7897;\n", + "x4=(s4-sf)/sfg\n", + "x4=0.848;#approx.\n", + "print(\"so h4=hf+x4*hfg in KJ/kg\")\n", + "print(\"from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\")\n", + "hf=467.11;\n", + "hfg=2226.5;\n", + "h4=hf+x4*hfg\n", + "print(\"s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", + "print(\"so x5=(s5-sf)/sfg\")\n", + "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "x5=(s5-sf)/sfg\n", + "x5=0.739;#approx.\n", + "print(\"h5=hf+x5*hfg in KJ/kg\")\n", + "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "h5=hf+x5*hfg \n", + "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", + "h6=137.82;\n", + "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", + "v6=0.001005;\n", + "print(\"h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\")\n", + "h7=h6+v6*(1.5-0.05)*10**2\n", + "print(\"h8=hf at 1.5 bar=467.11 KJ/kg\")\n", + "h8=467.11; \n", + "print(\"v8=0.001053 m^3/kg=vf at 1.5 bar\")\n", + "v8=0.001053;\n", + "print(\"h9=h8+v8*(150-1.5)*10^2 in KJ/kg\")\n", + "h9=h8+v8*(150-1.5)*10**2\n", + "print(\"h10=hf at 150 bar=1610.5 KJ/kg\")\n", + "h10=1610.5; \n", + "print(\"v10=0.001658 m^3/kg=vf at 150 bar\")\n", + "v10=0.001658;\n", + "print(\"h12=h10+v10*(150-10)*10^2 in KJ/kg\")\n", + "h12=h10+v10*(150-10)*10**2\n", + "print(\"Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\")\n", + "print(\"Heat balance on closed feed water heater yields,\")\n", + "print(\"m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\")\n", + "print(\"so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\")\n", + "m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)\n", + "print(\"heat balance on open feed water can be given as under,\")\n", + "print(\"m2*h4+(1-m1-m2)*h7=(1-m1)*h8\")\n", + "print(\"so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\")\n", + "m2=((1-m1)*(h8-h7))/(h4-h7)\n", + "print(\"for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\")\n", + "print(\"For mixing after closed feed water heater,\")\n", + "print(\"h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\")\n", + "h1=(4.18*150)*(1-m1)+m1*h12\n", + "print(\"Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\")\n", + "print(\"W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\")\n", + "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-((1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10)))\n", + "print(\"heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\")\n", + "q_add=(h2-h1)\n", + "n=W_net/q_add\n", + "print(\"cycle thermal efficiency,n=W_net/q_add\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"Net power developed in KW=1219*300 in KW\"),round(1219*300,2)\n", + "print(\"cycle thermal efficiency=47.6%\")\n", + "print(\"Net power developed=365700 KW\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.12;pg no: 282" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.12, Page:282 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\n", + "At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", + "For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\n", + "state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\n", + "since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\n", + "At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", + "At state 3,h3=2930.57 KJ/kg\n", + "At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\n", + "At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\n", + "From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\n", + "Let dryness fraction at state 5_a be x5,\n", + "s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x5_a=(s5_a-sf)/sfg\n", + "h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\n", + "from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\n", + "Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\n", + "m1_a*h3+h9=m1*h10+4.18*200\n", + "so m1_a=(4.18*200-h9)/(h3-h10) in kg\n", + "Applying heat balance at open feed water heater,\n", + "m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\n", + "so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\n", + "Net work per kg steam generated\n", + "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\n", + "Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\n", + "Thermal efficiency,n= 0.45\n", + "in percentage 45.04\n", + "% increase in thermal efficiency due to reheating= 0.56\n", + "so thermal efficiency of reheat cycle=45.03%\n", + "% increase in efficiency due to reheating=0.56%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,steam generation rate\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.12, Page:282 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\")\n", + "P=100*10**3;#net power output in KW\n", + "print(\"At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", + "h2=3373.7;\n", + "s2=6.5966;\n", + "print(\"For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\")\n", + "s3=s2;\n", + "s4=s3;\n", + "s5=s4;\n", + "print(\"state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\")\n", + "T3=261.6;\n", + "h3=2930.57;\n", + "print(\"since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\")\n", + "print(\"At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", + "h2=3373.7;\n", + "s2=6.5966;\n", + "print(\"At state 3,h3=2930.57 KJ/kg\")\n", + "h3=2930.57;\n", + "print(\"At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\")\n", + "h3_a=3247.6;\n", + "s3_a=7.1271;\n", + "print(\"At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\")\n", + "s4_a=s3_a;\n", + "s5_a=s4_a;\n", + "print(\"From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\")\n", + "h4_a=2841.02;\n", + "print(\"Let dryness fraction at state 5_a be x5,\")\n", + "print(\"s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "print(\"so x5_a=(s5_a-sf)/sfg\")\n", + "x5_a=(s5_a-sf)/sfg\n", + "x5_a=0.853;#approx.\n", + "print(\"h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "h5_a=hf+x5_a*hfg\n", + "print(\"Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\")\n", + "print(\"m1_a*h3+h9=m1*h10+4.18*200\")\n", + "print(\"so m1_a=(4.18*200-h9)/(h3-h10) in kg\")\n", + "m1_a=(4.18*200-h9)/(h3-h10)\n", + "m1_a=0.114;#approx.\n", + "print(\"Applying heat balance at open feed water heater,\")\n", + "print(\"m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\")\n", + "print(\"so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\")\n", + "m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7)\n", + "m2_a=0.131;#approx.\n", + "print(\"Net work per kg steam generated\")\n", + "print(\"w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\")\n", + "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-((1-m1_a-m2_a)*(h7-h6)+(h9-h8))\n", + "print(\"Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\")\n", + "q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)\n", + "n=w_net/q_add\n", + "print(\"Thermal efficiency,n=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"% increase in thermal efficiency due to reheating=\"),round((0.4503-0.4478)*100/0.4478,2)\n", + "print(\"so thermal efficiency of reheat cycle=45.03%\")\n", + "print(\"% increase in efficiency due to reheating=0.56%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.13;pg no: 286" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.13, Page:286 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\n", + "For mercury cycle,\n", + "insentropic heat drop=349-234.5 in KJ/kg Hg\n", + "actual heat drop=0.85*114.5 in KJ/kg Hg\n", + "Heat rejected in condenser=(349-97.325-35)in KJ/kg\n", + "heat added in boiler=349-35 in KJ/kg\n", + "For steam cycle,\n", + "Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\n", + "Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\n", + "Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\n", + "Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\n", + "Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\n", + "for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\n", + "state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\n", + "state 4 lies in wet region,say with dryness fraction x4\n", + "s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\n", + "so x4=(s4-sf)/sfg\n", + "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", + "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", + "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", + "Let state 5 lie in wet region with dryness fraction x5,\n", + "s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\n", + "so x5=(s5-sf)/sfg\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "h5=hf+x5*hfg in KJ/kg\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\n", + "h7=h6+v6*(1-0.075)*10^2 in KJ/kg\n", + "from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\n", + "h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\n", + "Applying heat balance on CFWH1,T1=150oc and also T15=150oc\n", + "m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\n", + "(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\n", + "Applying heat balance on CFEH2,T11=90oc\n", + "m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\n", + "(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\n", + "Heat balance at mixing between CFWH1 and CFWH2,\n", + "(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\n", + "376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\n", + "For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\n", + "from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\n", + "solving above equations,we get\n", + "m1=0.102 kg per kg steam generated\n", + "m2=0.073 kg per kg steam generated\n", + "pump work in process 13-14,h14-h13=v13*(40-8)*10^2\n", + "so h14-h13 in KJ/kg\n", + "Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\n", + "net work per kg of steam,w_net=w_mercury+w_steam\n", + "w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\n", + "thermal efficiency of binary vapour cycle=w_net/q_add 0.55\n", + "in percentage 55.36\n", + "so thermal efficiency=55.36%\n", + "NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.13, Page:286 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\")\n", + "print(\"For mercury cycle,\")\n", + "print(\"insentropic heat drop=349-234.5 in KJ/kg Hg\")\n", + "349-234.5\n", + "print(\"actual heat drop=0.85*114.5 in KJ/kg Hg\")\n", + "0.85*114.5\n", + "print(\"Heat rejected in condenser=(349-97.325-35)in KJ/kg\")\n", + "(349-97.325-35)\n", + "print(\"heat added in boiler=349-35 in KJ/kg\")\n", + "349-35\n", + "print(\"For steam cycle,\")\n", + "print(\"Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\")\n", + "h=2767.13;\n", + "print(\"Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\")\n", + "h2=3330.3;\n", + "print(\"Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\")\n", + "s2=6.9363;\n", + "print(\"Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\")\n", + "h-4.18*150\n", + "print(\"Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\")\n", + "2140.13/216.675\n", + "print(\"for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\")\n", + "s3=s2;\n", + "s4=s3;\n", + "s5=s4;\n", + "print(\"state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\")\n", + "h3=2899.23;\n", + "print(\"state 4 lies in wet region,say with dryness fraction x4\")\n", + "print(\"s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\")\n", + "print(\"so x4=(s4-sf)/sfg\")\n", + "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", + "sf=1.3026;\n", + "sfg=6.0568;\n", + "x4=(s4-sf)/sfg\n", + "x4=0.93;#approx.\n", + "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", + "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", + "hf=417.46;\n", + "hfg=2258.0;\n", + "h4=hf+x4*hfg\n", + "print(\"Let state 5 lie in wet region with dryness fraction x5,\")\n", + "print(\"s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", + "print(\"so x5=(s5-sf)/sfg\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "x5=(s5-sf)/sfg\n", + "x5=0.828;#approx.\n", + "print(\"h5=hf+x5*hfg in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0;\n", + "h5=hf+x5*hfg\n", + "print(\"Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\")\n", + "print(\"h7=h6+v6*(1-0.075)*10^2 in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\")\n", + "h6=168.79;\n", + "v6=0.001008;\n", + "h7=h6+v6*(1-0.075)*10**2\n", + "print(\"h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\")\n", + "h9=417.46;\n", + "h13=721.11;\n", + "print(\"Applying heat balance on CFWH1,T1=150oc and also T15=150oc\")\n", + "T1=150;\n", + "T15=150;\n", + "print(\"m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\")\n", + "print(\"(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\")\n", + "print(\"Applying heat balance on CFEH2,T11=90oc\")\n", + "T11=90;\n", + "print(\"m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\")\n", + "print(\"(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\")\n", + "print(\"Heat balance at mixing between CFWH1 and CFWH2,\")\n", + "print(\"(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\")\n", + "print(\"376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\")\n", + "print(\"For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\")\n", + "print(\"from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\")\n", + "h9=417.46;\n", + "v9=0.001043;\n", + "h10=h9+v9*(8-1)*10**2 \n", + "print(\"solving above equations,we get\")\n", + "print(\"m1=0.102 kg per kg steam generated\")\n", + "print(\"m2=0.073 kg per kg steam generated\")\n", + "m1=0.102;\n", + "m2=0.073;\n", + "print(\"pump work in process 13-14,h14-h13=v13*(40-8)*10^2\")\n", + "print(\"so h14-h13 in KJ/kg\")\n", + "v13=0.001252;\n", + "v13*(40-8)*10**2\n", + "print(\"Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\")\n", + "q_add=(9.88*314)+(3330.3-2767.13)\n", + "print(\"net work per kg of steam,w_net=w_mercury+w_steam\")\n", + "print(\"w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\")\n", + "w_net=(9.88*97.325)+((h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h7-h6)-m2*(h10-h9)-m1*4.006)\n", + "print(\"thermal efficiency of binary vapour cycle=w_net/q_add\"),round(w_net/q_add,2)\n", + "print(\"in percentage\"),round(w_net*100/q_add,2)\n", + "print(\"so thermal efficiency=55.36%\")\n", + "print(\"NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.14;pg no: 288" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.14, Page:288 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\n", + "This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\n", + "For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\n", + "ideally, s2=s1=6.7664 KJ/kg K\n", + "s2=sf at 0.075 bar +x3* sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x3=(s2-sf)/sfg\n", + "h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\n", + "for LP:at inlet of LP steam\n", + "h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\n", + "Enthalpy at exit,h_3LP=2222.34 KJ/kg\n", + "actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\n", + "HP steam consumption at full load=P*0.7457/h_HP in kg/s\n", + "HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\n", + "LP steam consumption at full load=P*0.7457/h_LP in kg/s\n", + "LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\n", + "The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\n", + "or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\n", + "Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\n", + "x=load,hp\n", + "y_HP=m_HP*x+C_HP\n", + "0.254=m_HP*0+C_HP\n", + "so C_HP=0.254\n", + "2.54=m_HP*2500+C_HP\n", + "so m_HP=(2.54-C_HP)/2500\n", + "so y_HP=9.144*10^-4*x_HP+0.254\n", + "Willans line for LP:y_LP=m_LP*x_LP+C_LP\n", + "0.481=m_LP*0+C_LP\n", + "so C_LP=0.481\n", + "4.81=m_LP*2500+C_LP\n", + "so m_LP=(4.81-C_LP)/2500\n", + "so y_LP=1.732*10^-3*x_LP+0.481\n", + "Total output(load) from mixed turbine,x=x_HP+x_LP\n", + "For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\n", + "from y_LP=1.732*10^-3*x_LP+0.481,\n", + "x_LP=(y_LP-0.481)/1.732*10^-3\n", + "since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\n", + "from y_HP=9.144*10^-4*x_HP+C_HP in kg/s 0.63\n", + "so HP steam requirement=0.63 kg/s\n" + ] + } + ], + "source": [ + "#cal of HP steam required\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.14, Page:288 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\")\n", + "n=0.8;#efficiency of both HP and LP turbine\n", + "P=2500;#output in hp\n", + "print(\"This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\")\n", + "print(\"For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\")\n", + "h1=3023.5;\n", + "s1=6.7664;\n", + "print(\"ideally, s2=s1=6.7664 KJ/kg K\")\n", + "s2=s1;\n", + "print(\"s2=sf at 0.075 bar +x3* sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "print(\"so x3=(s2-sf)/sfg\")\n", + "x3=(s2-sf)/sfg\n", + "x3=0.806;#approx.\n", + "print(\"h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0; \n", + "h_3HP=hf+x3*hfg\n", + "print(\"actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\")\n", + "h_HP=(h1-h_3HP)*n\n", + "print(\"for LP:at inlet of LP steam\")\n", + "print(\"h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\")\n", + "h2=2706.7;\n", + "s2=7.1271;\n", + "print(\"Enthalpy at exit,h_3LP=2222.34 KJ/kg\")\n", + "h_3LP=2222.34;\n", + "print(\"actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\")\n", + "h_LP=(h2-h_3LP)*n\n", + "print(\"HP steam consumption at full load=P*0.7457/h_HP in kg/s\")\n", + "P*0.7457/h_HP\n", + "print(\"HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\")\n", + "0.10*(P*0.7457/h_HP)\n", + "print(\"LP steam consumption at full load=P*0.7457/h_LP in kg/s\")\n", + "P*0.7457/h_LP\n", + "print(\"LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\")\n", + "0.10*(P*0.7457/h_LP)\n", + "print(\"The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\")\n", + "print(\"or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\")\n", + "print(\"Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\")\n", + "print(\"x=load,hp\")\n", + "print(\"y_HP=m_HP*x+C_HP\")\n", + "print(\"0.254=m_HP*0+C_HP\")\n", + "print(\"so C_HP=0.254\")\n", + "C_HP=0.254;\n", + "print(\"2.54=m_HP*2500+C_HP\")\n", + "print(\"so m_HP=(2.54-C_HP)/2500\")\n", + "m_HP=(2.54-C_HP)/2500\n", + "print(\"so y_HP=9.144*10^-4*x_HP+0.254\")\n", + "print(\"Willans line for LP:y_LP=m_LP*x_LP+C_LP\")\n", + "print(\"0.481=m_LP*0+C_LP\")\n", + "print(\"so C_LP=0.481\")\n", + "C_LP=0.481;\n", + "print(\"4.81=m_LP*2500+C_LP\")\n", + "print(\"so m_LP=(4.81-C_LP)/2500\")\n", + "m_LP=(4.81-C_LP)/2500\n", + "print(\"so y_LP=1.732*10^-3*x_LP+0.481\")\n", + "print(\"Total output(load) from mixed turbine,x=x_HP+x_LP\")\n", + "print(\"For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\")\n", + "y_LP=1.5;\n", + "print(\"from y_LP=1.732*10^-3*x_LP+0.481,\")\n", + "print(\"x_LP=(y_LP-0.481)/1.732*10^-3\")\n", + "x_LP=(y_LP-0.481)/(1.732*10**-3)\n", + "print(\"since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\")\n", + "x_HP=411.66;\n", + "y_HP=9.144*10**-4*x_HP+C_HP\n", + "print(\"from y_HP=9.144*10^-4*x_HP+C_HP in kg/s\"),round(y_HP,2)\n", + "print(\"so HP steam requirement=0.63 kg/s\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.15;pg no: 289" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.15, Page:289 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\n", + "Let us carry out analysis for 1 kg of steam generated in boiler.\n", + "Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\n", + "state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\n", + "Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\n", + "so x3= 0.86\n", + "from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\n", + "h3=2404.94 KJ/kg\n", + "If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\n", + "mass of moisture retained in separator(m)=(1-x3)*0.5 kg\n", + "Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\n", + "Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\n", + "Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\n", + "(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\n", + "so T in degree celcius= 68.425\n", + "so temperature of water leaving hotwell=68.425 degree celcius\n", + "Applying heat balanced on trap\n", + "0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\n", + "so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\n", + "from steam tables,at 2 bar,hf=504.70 KJ/kg\n", + "Therefore,heat transferred in process heater in KJ/kg steam generated= 1023.172\n", + "so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\n", + "For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\n", + "Let dryness fraction be x10\n", + "s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x10=(s10-sf)/sfg\n", + "h10=hf at 0.075 bar+x10*hfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "so h10=hf+x10*hfg in KJ/kg \n", + "net work output,neglecting pump work per kg of steam generated,\n", + "w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\n", + "Heat added in boiler per kg steam generated,q_add in KJ/kg= 2674.68\n", + "thermal efficiency=w_net/q_add 0.28\n", + "in percentage 27.59\n", + "so Thermal efficiency=27.58%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,heat transferred and temperature\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.15, Page:289 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\")\n", + "print(\"Let us carry out analysis for 1 kg of steam generated in boiler.\")\n", + "print(\"Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\")\n", + "h2=2960.7;\n", + "s2=6.3615;\n", + "print(\"state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\")\n", + "s3=s2;\n", + "print(\"Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\")\n", + "sf=1.5301;\n", + "sfg=5.5970;\n", + "x3=(s3-sf)/sfg\n", + "print(\"so x3=\"),round(x3,2)\n", + "print(\"from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\")\n", + "x3=0.863;#approx.\n", + "print(\"h3=2404.94 KJ/kg\")\n", + "h3=2404.94;\n", + "print(\"If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\")\n", + "print(\"mass of moisture retained in separator(m)=(1-x3)*0.5 kg\")\n", + "m=(1-x3)*0.5\n", + "print(\"Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\")\n", + "m_LP=0.5-m\n", + "print(\"Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\")\n", + "print(\"Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\")\n", + "print(\"(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\")\n", + "T=((0.5685*4.18*90)+(0.4315*4.18*40))/4.18\n", + "print(\"so T in degree celcius=\"),round(T,3)\n", + "print(\"so temperature of water leaving hotwell=68.425 degree celcius\")\n", + "print(\"Applying heat balanced on trap\")\n", + "print(\"0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\")\n", + "print(\"so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\")\n", + "print(\"from steam tables,at 2 bar,hf=504.70 KJ/kg\")\n", + "hf=504.70;\n", + "h7=((0.5685*4.18*90)-(0.0685*hf))/0.5\n", + "print(\"Therefore,heat transferred in process heater in KJ/kg steam generated=\"),round(0.5*(h3-h7),3)\n", + "print(\"so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\")\n", + "print(\"For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\")\n", + "s10=s3;\n", + "print(\"Let dryness fraction be x10\")\n", + "print(\"s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "print(\"so x10=(s10-sf)/sfg\")\n", + "x10=(s10-sf)/sfg\n", + "x10=0.754;#approx.\n", + "print(\"h10=hf at 0.075 bar+x10*hfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0;\n", + "print(\"so h10=hf+x10*hfg in KJ/kg \")\n", + "h10=hf+x10*hfg \n", + "print(\"net work output,neglecting pump work per kg of steam generated,\")\n", + "print(\"w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\")\n", + "w_net=(h2-h3)*1+0.4315*(h3-h10) \n", + "q_add=(h2-4.18*68.425)\n", + "print(\"Heat added in boiler per kg steam generated,q_add in KJ/kg=\"),round(q_add,2)\n", + "w_net/q_add\n", + "print(\"thermal efficiency=w_net/q_add\"),round(w_net/q_add,2)\n", + "print(\"in percentage\"),round(w_net*100/q_add,2)\n", + "print(\"so Thermal efficiency=27.58%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.16;pg no: 291" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.16, Page:291 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\n", + "from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\n", + "Assuming isentropic expansion in nozzle,s1=s2=6.9486\n", + "Letdryness fraction at state 2,x2=0.864\n", + "s2=sf at 0.2 bar+x2*sfg at 0.2 bar\n", + "from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\n", + "so x2= 0.86\n", + "hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\n", + "from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\n", + "considering pump work to be of isentropic type,deltah_34=v3*deltap_34\n", + "from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\n", + "or deltah_34 in KJ/kg= 7.1\n", + "pump work,Wp in KJ/kg= 7.1\n", + "turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\n", + "net work(W_net)=Wt-Wp in KJ/kg\n", + "power produced(P)=mass flow rate*W_net in KJ/s\n", + "so net power=43.22 MW\n", + "heat supplied in boiler(Q)=(h1-h4) in KJ/kg\n", + "enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\n", + "total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s 114534.05\n", + "thermal efficiency=net work/heat supplied=W_net/Q 0.38\n", + "in percentage 37.73\n", + "so thermal efficiency=37.73%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,net power\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.16, Page:291 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\")\n", + "m=35;#mass flow rate in kg/s\n", + "print(\"from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\")\n", + "h1=3530.9;\n", + "s1=6.9486;\n", + "print(\"Assuming isentropic expansion in nozzle,s1=s2=6.9486\")\n", + "s2=s1;\n", + "print(\"Letdryness fraction at state 2,x2=0.864\")\n", + "print(\"s2=sf at 0.2 bar+x2*sfg at 0.2 bar\")\n", + "print(\"from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\")\n", + "sf=0.8320;\n", + "sfg=7.0766;\n", + "x2=(s2-sf)/sfg\n", + "print(\"so x2=\"),round(x2,2)\n", + "x2=0.864;#approx.\n", + "print(\"hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\")\n", + "print(\"from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\")\n", + "hf=251.4;\n", + "hfg=2358.3;\n", + "h2=hf+x2*hfg\n", + "print(\"considering pump work to be of isentropic type,deltah_34=v3*deltap_34\")\n", + "print(\"from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\")\n", + "v3=0.001017;\n", + "p3=70;#;pressure of steam entering turbine in bar\n", + "p4=0.20;#condenser pressure in bar\n", + "deltah_34=v3*(p3-p4)*100\n", + "print(\"or deltah_34 in KJ/kg=\"),round(deltah_34,2)\n", + "Wp=deltah_34\n", + "print(\"pump work,Wp in KJ/kg=\"),round(Wp,2)\n", + "print(\"turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\")\n", + "Wt=(h1-h2)\n", + "print(\"net work(W_net)=Wt-Wp in KJ/kg\")\n", + "W_net=Wt-Wp\n", + "print(\"power produced(P)=mass flow rate*W_net in KJ/s\")\n", + "P=m*W_net\n", + "print(\"so net power=43.22 MW\")\n", + "print(\"heat supplied in boiler(Q)=(h1-h4) in KJ/kg\")\n", + "print(\"enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\")\n", + "h3=hf;\n", + "h4=h3+deltah_34 \n", + "Q=m*(h1-h4)\n", + "print(\"total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s\"),round(Q,2)\n", + "print(\"thermal efficiency=net work/heat supplied=W_net/Q\"),round(P/Q,2)\n", + "print(\"in percentage\"),round(P*100/Q,2)\n", + "print(\"so thermal efficiency=37.73%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.17;pg no: 292" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.1, Page:292 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 17\n", + "from steam tables,h1=3625.3 KJ/s,s1=6.9029 KJ/kg K\n", + "due to isentropic expansion,s1=s2=s3=6.9029 KJ/kg K\n", + "at state 2,i.e at pressure of 2 MPa and entropy 6.9029 KJ/kg K\n", + "by interpolating state for s2 between 2 MPa,300 degree celcius and 2 MPa,350 degree celcius from steam tables,\n", + "h2=3105.08 KJ/kg \n", + "for state 3,i.e at pressure of 0.01 MPa entropy,s3 lies in wet region as s3In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,mass of steam\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.18, Page:294 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 18\")\n", + "W_net=50*10**3;#net output of turbine in KW\n", + "print(\"from steam tables,at inlet to first stage of turbine,h1=h at 100 bar,500oc=3373.7 KJ/kg,s1=s at 100 bar,500oc=6.5966 KJ/kg\")\n", + "h1=3373.7;\n", + "s1=6.5966;\n", + "print(\"Due to isentropic expansion,s1=s6=s2 and s3=s8=s4\")\n", + "s2=s1;\n", + "s6=s2;\n", + "print(\"State at 6 i.e bleed state from HP turbine,temperature by interpolation from steam table =261.6oc.\")\n", + "print(\"At inlet to second stage of turbine,h6=2930.572 KJ/kg\")\n", + "h6=2930.572;\n", + "print(\"h3=h at 10 bar,500oc=3478.5 KJ/kg,s3=s at 10 bar,500oc=7.7622 KJ/kg K\")\n", + "h3=3478.5;\n", + "s3=7.7622;\n", + "s4=s3;\n", + "s8=s4;\n", + "print(\"At exit from first stage of turbine i.e. at 10 bar and entropy of 6.5966 KJ/kg K,Temperature by interpolation from steam table at 10 bar and entropy of 6.5966 KJ/kg K\")\n", + "print(\"T2=181.8oc,h2=2782.8 KJ/kg\")\n", + "T2=181.8;\n", + "h2=2782.8;\n", + "print(\"state at 8,i.e bleed state from second stage of expansion,i.e at 4 bar and entropy of 7.7622 KJ/kg K,Temperature by interpolation from steam table,T8=358.98oc=359oc\")\n", + "T8=359;\n", + "print(\"h8=3188.7 KJ/kg\")\n", + "h8=3188.7;\n", + "print(\"state at 4 i.e. at condenser pressure of 0.1 bar and entropy of 7.7622 KJ/kg K,the state lies in wet region.So let the dryness fraction be x4.\")\n", + "print(\"s4=sf at 0.1 bar+x4*sfg at 0.1 bar\")\n", + "print(\"from steam tables,at 0.1 bar,sf=0.6493 KJ/kg K,sfg=7.5009 KJ/kg K\")\n", + "sf=0.6493;\n", + "sfg=7.5009; \n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.95;#approx.\n", + "print(\"h4=hf at 0.1 bar+x4*hfg at 0.1 bar in KJ/kg \")\n", + "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,hfg=2392.8 KJ/kg\")\n", + "hf=191.83;\n", + "hfg=2392.8;\n", + "h4=hf+x4*hfg\n", + "print(\"given,h4=2464.99 KJ/kg,h11=856.8 KJ/kg,h9=hf at 4 bar=604.74 KJ/kg\")\n", + "h4=2464.99;\n", + "h11=856.8;\n", + "h9=604.74;\n", + "print(\"considering pump work,the net output can be given as,\")\n", + "print(\"W_net=W_HPT+W_LPT-(W_CEP+W_FP)\")\n", + "print(\"where,W_HPT={(h1-h6)+(1-m6)*(h6-h2)}per kg of steam from boiler.\")\n", + "print(\"W_LPT={(1-m6)+(h3-h8)*(1-m6-m8)*(h8-h4)}per kg of steam from boiler.\")\n", + "print(\"for closed feed water heater,energy balance yields;\")\n", + "print(\"m6*h6+h10=m6*h7+h11\")\n", + "print(\"assuming condensate leaving closed feed water heater to be saturated liquid,\")\n", + "print(\"h7=hf at 20 bar=908.79 KJ/kg\")\n", + "h7=908.79; \n", + "print(\"due to throttline,h7=h7_a=908.79 KJ/kg\")\n", + "h7_a=h7;\n", + "print(\"for open feed water heater,energy balance yields,\")\n", + "print(\"m6*h7_a+m8*h8+(1-m6-m8)*h5=h9\")\n", + "print(\"for condensate extraction pump,h5-h4_a=v4_a*deltap\")\n", + "print(\"h5-hf at 0.1 bar=vf at 0.1 bar*(4-0.1)*10^2 \")\n", + "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,vf=0.001010 m^3/kg\")\n", + "hf=191.83;\n", + "vf=0.001010; \n", + "h5=hf+vf*(4-0.1)*10**2\n", + "print(\"so h5 in KJ/kg=\"),round(h5,2)\n", + "print(\"for feed pump,h10-h9=v9*deltap\")\n", + "print(\"h10=h9+vf at 4 bar*(100-4)*10^2 in KJ/kg\")\n", + "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,vf=0.001084 m^3/kg \")\n", + "hf=604.74;\n", + "vf=0.001084;\n", + "h10=h9+vf*(100-4)*10**2\n", + "print(\"substituting in energy balance upon closed feed water heater,\")\n", + "m6=(h11-h10)/(h6-h7)\n", + "print(\"m6 in kg per kg of steam from boiler=\"),round(m6,3)\n", + "print(\"substituting in energy balance upon feed water heater,\")\n", + "m8=(h9-m6*h7_a+m6*h5-h5)/(h8-h5)\n", + "print(\"m8 in kg per kg of steam from boiler=\"),round(m8,3)\n", + "print(\"Let the mass of steam entering first stage of turbine be m kg,then\")\n", + "{(h1-h6)+(1-m6)*(h6-h2)}\n", + "print(\"W_HPT=m*{(h1-h6)+(1-m6)*(h6-h2)}\")\n", + "print(\"W_HPT/m=\"),round(((h1-h6)+(1-m6)*(h6-h2)),2)\n", + "print(\"so W_HPT=m*573.24 KJ\")\n", + "print(\"also,W_LPT={(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}per kg of steam from boiler\")\n", + "{(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}\n", + "print(\"W_LPT/m=\"),round(((1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)),2)\n", + "print(\"so W_LPT=m*813.42 KJ\")\n", + "print(\"pump works(negative work)\")\n", + "print(\"W_CEP=m*(1-m6-m8)*(h5-h4_a)\")\n", + "h4_a=191.83;#h4_a=hf at 0.1 bar\n", + "print(\"W_CEP/m=\")\n", + "(1-m6-m8)*(h5-h4_a)\n", + "print(\"so W_CEP=m* 0.304\")\n", + "print(\"W_FP=m*(h10-h9)\")\n", + "print(\"W_FP/m=\"),round((h10-h9),2)\n", + "print(\"so W_FP=m*10.41\")\n", + "print(\"net output,\")\n", + "print(\"W_net=W_HPT+W_LPT-W_CEP-W_FP \")\n", + "print(\"so 50*10^3=(573.24*m+813.42*m-0.304*m-10.41*m)\")\n", + "m=W_net/(573.24+813.42-0.304-10.41)\n", + "print(\"so m in kg/s=\"),round(m,2)\n", + "Q_add=m*(h1-h11)\n", + "print(\"heat supplied in boiler,Q_add in KJ/s=\"),round(m*(h1-h11),2)\n", + "print(\"Thermal efficenncy=\"),round(W_net/Q_add,2)\n", + "print(\"in percentage\"),round(W_net*100/Q_add,2)\n", + "print(\"so mass of steam bled at 20 bar=0.119 kg per kg of steam entering first stage\")\n", + "print(\"mass of steam bled at 4 bar=0.109 kg per kg of steam entering first stage\")\n", + "print(\"mass of steam entering first stage=36.33 kg/s\")\n", + "print(\"thermal efficiency=54.66%\")\n", + "print(\"NOTE=>In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter8_3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter8_3.ipynb new file mode 100755 index 00000000..5088b9af --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter8_3.ipynb @@ -0,0 +1,2594 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 8:Vapour Power Cycles" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.1;pg no: 260" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.1, Page:260 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\n", + "T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\n", + "enthalpy at state 2,h2= hg at 7 MPa\n", + "from steam table,h=2772.1 KJ/kg\n", + "entropy at state 2,s2=sg at 7MPa\n", + "from steam table,s2=5.8133 KJ/kg K\n", + "enthalpy and entropy at state 3,\n", + "from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\n", + "for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \n", + "from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\n", + "s1=s2=sf+x1*sfg\n", + "so x1= 0.68\n", + "from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\n", + "enthalpy at state 1,h1 in KJ/kg= 1802.53\n", + "let dryness fraction at state 4 be x4\n", + "for process 4-3,s4=s3=sf+x4*sfg\n", + "so x4= 0.33\n", + "enthalpy at state 4,h4 in KJ/kg= 962.81\n", + "thermal efficiency=net work/heat added\n", + "expansion work per kg=(h2-h1) in KJ/kg 969.57\n", + "compression work per kg=(h3-h4) in KJ/kg(+ve) 304.19\n", + "heat added per kg=(h2-h3) in KJ/kg(-ve) 1505.1\n", + "net work per kg=(h2-h1)-(h3-h4) in KJ/kg 665.38\n", + "thermal efficiency 0.44\n", + "in percentage 44.21\n", + "so thermal efficiency=44.21%\n", + "turbine work=969.57 KJ/kg(+ve)\n", + "compression work=304.19 KJ/kg(-ve)\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,turbine work,compression work\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.1, Page:260 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\")\n", + "print(\"T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\")\n", + "print(\"enthalpy at state 2,h2= hg at 7 MPa\")\n", + "print(\"from steam table,h=2772.1 KJ/kg\")\n", + "h2=2772.1;\n", + "print(\"entropy at state 2,s2=sg at 7MPa\")\n", + "print(\"from steam table,s2=5.8133 KJ/kg K\")\n", + "s2=5.8133;\n", + "print(\"enthalpy and entropy at state 3,\")\n", + "print(\"from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\")\n", + "h3=1267;\n", + "s3=3.1211;\n", + "print(\"for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \")\n", + "s1=s2;\n", + "print(\"from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\")\n", + "sf=0.5564;\n", + "sfg=7.7237;\n", + "print(\"s1=s2=sf+x1*sfg\")\n", + "x1=(s2-sf)/sfg\n", + "print(\"so x1=\"),round(x1,2) \n", + "x1=0.6806;#approx.\n", + "print(\"from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\")\n", + "hf=162.60;\n", + "hfg=2409.54;\n", + "h1=hf+x1*hfg\n", + "print(\"enthalpy at state 1,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"let dryness fraction at state 4 be x4\")\n", + "print(\"for process 4-3,s4=s3=sf+x4*sfg\")\n", + "s4=s3;\n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.3321;#approx.\n", + "h4=hf+x4*hfg\n", + "print(\"enthalpy at state 4,h4 in KJ/kg=\"),round(h4,2)\n", + "print(\"thermal efficiency=net work/heat added\")\n", + "(h2-h1)\n", + "print(\"expansion work per kg=(h2-h1) in KJ/kg\"),round((h2-h1),2)\n", + "(h3-h4)\n", + "print(\"compression work per kg=(h3-h4) in KJ/kg(+ve)\"),round((h3-h4),2)\n", + "(h2-h3)\n", + "print(\"heat added per kg=(h2-h3) in KJ/kg(-ve)\"),round((h2-h3),2)\n", + "(h2-h1)-(h3-h4)\n", + "print(\"net work per kg=(h2-h1)-(h3-h4) in KJ/kg\"),round((h2-h1)-(h3-h4),2)\n", + "((h2-h1)-(h3-h4))/(h2-h3)\n", + "print(\"thermal efficiency\"),round(((h2-h1)-(h3-h4))/(h2-h3),2)\n", + "print(\"in percentage\"),round((((h2-h1)-(h3-h4))/(h2-h3))*100,2)\n", + "print(\"so thermal efficiency=44.21%\")\n", + "print(\"turbine work=969.57 KJ/kg(+ve)\")\n", + "print(\"compression work=304.19 KJ/kg(-ve)\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.2;pg no: 261" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.2, Page:261 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\n", + "from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\n", + "hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\n", + "from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\n", + "hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\n", + "as process 2-3 is isentropic,so s2=s3\n", + "and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\n", + "so x3= 0.69\n", + "hence enthalpy at 3,\n", + "h3 in KJ/kg= 1819.85\n", + "enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\n", + "process 1-4 is isentropic,so s1=s4\n", + "s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\n", + "so x4= 0.31\n", + "enthalpy at 4,h4 in KJ/kg= 884.31\n", + "enthalpy at 1,h1 in KJ/kg= 1154.23\n", + "carnot cycle(1-2-3-4-1) efficiency:\n", + "n_carnot=net work/heat added\n", + "n_carnot 0.43\n", + "in percentage 42.96\n", + "so n_carnot=42.95%\n", + "In rankine cycle,1-2-3-5-6-1,\n", + "pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg 5.02\n", + "h5 KJ/kg= 137.82\n", + "hence h6 in KJ/kg 142.84\n", + "net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg 969.43\n", + "heat added=(h2-h6)in KJ/kg 2651.46\n", + "rankine cycle efficiency(n_rankine)= 0.37\n", + "in percentage 36.56\n", + "so n_rankine=36.56%\n" + ] + } + ], + "source": [ + "#cal of n_carnot,n_rankine\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.2, Page:261 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\")\n", + "print(\"from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\")\n", + "print(\"hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\")\n", + "hf_5MPa=1154.23;\n", + "sf_5MPa=2.92;\n", + "hg_5MPa=2794.3;\n", + "sg_5MPa=5.97;\n", + "print(\"from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\")\n", + "print(\"hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\")\n", + "hf_5KPa=137.82;\n", + "sf_5KPa=0.4764;\n", + "hg_5KPa=2561.5;\n", + "sg_5KPa=8.3951;\n", + "vf_5KPa=0.001005;\n", + "print(\"as process 2-3 is isentropic,so s2=s3\")\n", + "print(\"and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\")\n", + "s2=sg_5MPa;\n", + "s3=s2;\n", + "x3=(s3-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.694;#approx.\n", + "print(\"hence enthalpy at 3,\")\n", + "h3=hf_5KPa+x3*(hg_5KPa-hf_5KPa)\n", + "print(\"h3 in KJ/kg=\"),round(h3,2)\n", + "print(\"enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\")\n", + "print(\"process 1-4 is isentropic,so s1=s4\")\n", + "s1=sf_5MPa;\n", + "print(\"s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\")\n", + "x4=(s1-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.308;#approx.\n", + "h4=hf_5KPa+x4*(hg_5KPa-hf_5KPa)\n", + "print(\"enthalpy at 4,h4 in KJ/kg=\"),round(h4,2)\n", + "h1=hf_5MPa\n", + "h2=hg_5MPa;\n", + "n_carnot=((h2-h3)-(h1-h4))/(h2-h1)\n", + "print(\"enthalpy at 1,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"carnot cycle(1-2-3-4-1) efficiency:\")\n", + "print(\"n_carnot=net work/heat added\")\n", + "print(\"n_carnot\"),round(n_carnot,2)\n", + "print(\"in percentage\"),round(n_carnot*100,2)\n", + "print(\"so n_carnot=42.95%\")\n", + "print(\"In rankine cycle,1-2-3-5-6-1,\")\n", + "p6=5000;#boiler pressure in KPa\n", + "p5=5;#condenser pressure in KPa\n", + "vf_5KPa*(p6-p5)\n", + "print(\"pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg\"),round(vf_5KPa*(p6-p5),2)\n", + "h5=hf_5KPa;\n", + "print(\"h5 KJ/kg=\"),round(hf_5KPa,2)\n", + "h6=h5+(vf_5KPa*(p6-p5))\n", + "print(\"hence h6 in KJ/kg\"),round(h6,2)\n", + "(h2-h3)-(h6-h5)\n", + "print(\"net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg\"),round((h2-h3)-(h6-h5),2)\n", + "(h2-h6)\n", + "print(\"heat added=(h2-h6)in KJ/kg\"),round((h2-h6),2)\n", + "n_rankine=((h2-h3)-(h6-h5))/(h2-h6)\n", + "print(\"rankine cycle efficiency(n_rankine)=\"),round(n_rankine,2)\n", + "print(\"in percentage\"),round(n_rankine*100,2)\n", + "print(\"so n_rankine=36.56%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.3;pg no: 263" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.3, Page:263 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\n", + "from steam tables,h2=hg_40bar=3092.5 KJ/kg\n", + "s2=sg_40bar=6.5821 KJ/kg K\n", + "h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \n", + "s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "v4=vf_0.05bar=0.001005 m^3/kg\n", + "let the dryness fraction at state 3 be x3,\n", + "for ideal process,2-3,s2=s3\n", + "s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\n", + "so x3= 0.77\n", + "h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\n", + "for pumping process,\n", + "h1-h4=v4*deltap=v4*(p1-p4)\n", + "so h1=h4+v4*(p1-p4) in KJ/kg 141.83\n", + "pump work per kg of steam in KJ/kg 4.01\n", + "net work per kg of steam =(expansion work-pump work)per kg of steam\n", + "=(h2-h3)-(h1-h4) in KJ/kg= 1081.75\n", + "cycle efficiency=net work/heat added 0.37\n", + "in percentage 36.66\n", + "so net work per kg of steam=1081.74 KJ/kg\n", + "cycle efficiency=36.67%\n", + "pump work per kg of steam=4.02 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of net work per kg of steam,cycle efficiency,pump work per kg of steam\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.3, Page:263 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\")\n", + "print(\"from steam tables,h2=hg_40bar=3092.5 KJ/kg\")\n", + "h2=3092.5;\n", + "print(\"s2=sg_40bar=6.5821 KJ/kg K\")\n", + "s2=6.5821;\n", + "print(\"h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \")\n", + "h4=137.82;\n", + "hfg=2423.7;\n", + "print(\"s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "s4=0.4764;\n", + "sfg=7.9187;\n", + "print(\"v4=vf_0.05bar=0.001005 m^3/kg\")\n", + "v4=0.001005;\n", + "print(\"let the dryness fraction at state 3 be x3,\")\n", + "print(\"for ideal process,2-3,s2=s3\")\n", + "s3=s2;\n", + "print(\"s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\")\n", + "x3=(s2-s4)/(sfg)\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.7711;#approx.\n", + "print(\"h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\")\n", + "h3=h4+x3*hfg\n", + "print(\"for pumping process,\")\n", + "print(\"h1-h4=v4*deltap=v4*(p1-p4)\")\n", + "p1=40*100;#pressure of steam enter in turbine in mPa\n", + "p4=0.05*100;#pressure of steam leave turbine in mPa\n", + "h1=h4+v4*(p1-p4)\n", + "print(\"so h1=h4+v4*(p1-p4) in KJ/kg\"),round(h1,2)\n", + "(h1-h4)\n", + "print(\"pump work per kg of steam in KJ/kg\"),round((h1-h4),2)\n", + "print(\"net work per kg of steam =(expansion work-pump work)per kg of steam\")\n", + "(h2-h3)-(h1-h4)\n", + "print(\"=(h2-h3)-(h1-h4) in KJ/kg=\"),round((h2-h3)-(h1-h4),2)\n", + "print(\"cycle efficiency=net work/heat added\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", + "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", + "print(\"so net work per kg of steam=1081.74 KJ/kg\")\n", + "print(\"cycle efficiency=36.67%\")\n", + "print(\"pump work per kg of steam=4.02 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.4;pg no: 264" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.4, Page:264 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 4\n", + "Let us assume that the condensate leaves condenser as saturated liquid and the expansion in turbine and pumping processes are isentropic.\n", + "from steam tables,h2=h_20MPa=3238.2 KJ/kg\n", + "s2=6.1401 KJ/kg K\n", + "h5=h_0.005MPa in KJ/kg\n", + "from steam tables,at 0.005 MPa,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "h5=hf+0.9*hfg in KJ/kg 2319.15\n", + "s5 in KJ/kg K= 7.6\n", + "h6=hf=137.82 KJ/kg\n", + "it is given that temperature at state 4 is 500 degree celcius and due to isentropic processes s4=s5=7.6032 KJ/kg K.The state 4 can be conveniently located on mollier chart by the intersection of 500 degree celcius constant temperature line and entropy value of 7.6032 KJ/kg K and the pressure and enthalpy obtained.but these shall be approximate.\n", + "The state 4 can also be located by interpolation using steam table.The entropy value of 7.6032 KJ/kg K lies between the superheated steam states given under,p=1.20 MPa,s at 1.20 MPa=7.6027 KJ/kg K\n", + "p=1.40 MPa,s at 1.40 MPa=7.6027 KJ/kg K\n", + "by interpolation state 4 lies at pressure=\n", + "=1.399,approx.=1.40 MPa\n", + "thus,steam leaves HP turbine at 1.40 MPa\n", + "enthalpy at state 4,h4=3474.1 KJ/kg\n", + "for process 2-33,s2=s3=6.1401 KJ/kg K.The state 3 thus lies in wet region as s3sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\n", + "From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\n", + "Let dryness fraction at state 9 be x9 so,\n", + "s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\n", + "from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\n", + "x9=(s9-sf)/sfg 0.95\n", + "h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\n", + "from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\n", + "Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\n", + "h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\n", + "h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\n", + "For process 4-8,i.e in CEP.\n", + "h8 in KJ/kg= 138.22\n", + "For process 11-12,i.e in FP2,\n", + "h12=h11+v11*(40-4)*10^2 in KJ/kg 608.64\n", + "For process 13-1_a i.e. in FP1,h1_a= in KJ/kg= 1107.34\n", + "m1*3141.81+(1-m1)*608.64=1087.31\n", + "so m1=(1087.31-608.64)/(3141.81-608.64)in kg\n", + "Applying energy balance on open feed water heater 1 (OFWH1)\n", + "m1*h10+(1-m1)*h12)=1*h13\n", + "so m1 in kg= 0.19\n", + "Applying energy balance on open feed water heater 2 (OFWH2)\n", + "m2*h9+(1-m1-m2)*h8=(1-m1)*h11\n", + "so m2 in kg= 0.15\n", + "Thermal efficiency of cycle,n= 0.51\n", + "W_CEP in KJ/kg steam from boiler= 0.26\n", + "W_FP1=(h1_a-h13)in KJ/kg of steam from boiler 20.0\n", + "W_FP2 in KJ/kg of steam from boiler= 3.17\n", + "W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler= 23.46\n", + "n= 0.51\n", + "in percentage 51.37\n", + "so cycle thermal efficiency,na=46.18%\n", + "nb=49.76%\n", + "nc=51.37%\n", + "hence it is obvious that efficiency increases with increase in number of feed heaters.\n" + ] + } + ], + "source": [ + "#cal of maximum possible work\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.6, Page:267 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 6\")\n", + "print(\"case (a) When there is no feed water heater\")\n", + "print(\"Thermal efficiency of cycle=((h2-h3)-(h1-h4))/(h2-h1)\")\n", + "print(\"from steam tables,h2=h at 200 bar,650oc=3675.3 KJ/kg,s2=s at 200 bar,650oc=6.6582 KJ/kg K,h4=hf at 0.05 bar=137.82 KJ/kg,v4=vf at 0.05 bar=0.001005 m^3/kg\")\n", + "h2=3675.3;\n", + "s2=6.6582;\n", + "h4=137.82;\n", + "v4=0.001005;\n", + "print(\"hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg,sf at 0.05 bar=0.4764 KJ/kg K,sfg at 0.05 bar=7.9187 KJ/kg K\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "print(\"For process 2-3,s2=s3.Let dryness fraction at 3 be x3.\")\n", + "s3=s2;\n", + "print(\"s3=6.6582=sf at 0.05 bar+x3*sfg at 0.05 bar\")\n", + "x3=(s3-sf)/sfg\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.781;#approx.\n", + "print(\"h3=hf at 0.05 bar+x3*hfg at 0.05 bar in KJ/kg\")\n", + "h3=hf+x3*hfg\n", + "print(\"For pumping process 4-1,\")\n", + "print(\"h1-h4=v4*deltap\")\n", + "h1=h4+v4*(200-0.5)*10**2\n", + "print(\"h1= in KJ/kg=\"),round(h1,2)\n", + "((h2-h3)-(h1-h4))/(h2-h1)\n", + "print(\"Thermal efficiency of cycle=\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", + "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", + "print(\"case (b) When there is only one feed water heater working at 8 bar\")\n", + "print(\"here,let mass of steam bled for feed heating be m kg\")\n", + "print(\"For process 2-6,s2=s6=6.6582 KJ/kg K\")\n", + "s6=s2;\n", + "print(\"Let dryness fraction at state 6 be x6\")\n", + "print(\"s6=sf at 8 bar+x6*sfg at 8 bar\")\n", + "print(\"from steam tables,hf at 8 bar=721.11 KJ/kg,vf at 8 bar=0.001115 m^3/kg,hfg at 8 bar=2048 KJ/kg,sf at 8 bar=2.0462 KJ/kg K,sfg at 8 bar=4.6166 KJ/kg K\")\n", + "hf=721.11;\n", + "vf=0.001115;\n", + "hfg=2048;\n", + "sf=2.0462;\n", + "sfg=4.6166;\n", + "x6=(s6-sf)/sfg\n", + "print(\"substituting entropy values,x6=\"),round(x6,2)\n", + "x6=0.999;#approx.\n", + "print(\"h6=hf at at 8 bar+x6*hfg at 8 bar in KJ/kg\")\n", + "h6=hf+x6*hfg\n", + "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at 8 bar.h7=hf at 8 bar=721.11 KJ/kg\")\n", + "h7=721.11;\n", + "h5=h4+v4*(8-.05)*10**2\n", + "print(\"For process 4-5,h5 in KJ/kg\"),round(h5,2)\n", + "print(\"Applying energy balance at open feed water heater,\")\n", + "print(\"m*h6+(1-m)*h5=1*h7\")\n", + "m=(h7-h5)/(h6-h5)\n", + "print(\"so m= in kg\"),round(m,2)\n", + "h7=hf;\n", + "v7=vf;\n", + "h1=h7+v7*(200-8)*10**2\n", + "print(\"For process 7-1,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"here h7=hf at 8 bar,v7=vf at 8 bar\")\n", + "#TE=((h2-h6)+(1-m)*(h6-h3)-((1-m)*(h5-h4)+(h1-h7))/(h2-h1)\n", + "print(\"Thermal efficiency of cycle=0.4976\")\n", + "print(\"in percentage=49.76\")\n", + "print(\"case (c) When there are two feed water heaters working at 40 bar and 4 bar\")\n", + "print(\"here, let us assume the mass of steam at 40 bar,4 bar to be m1 kg and m2 kg respectively.\")\n", + "print(\"2-10-9-3,s2=s10=s9=s3=6.6582 KJ/kg K\")\n", + "s3=s2;\n", + "s9=s3;\n", + "s10=s9;\n", + "print(\"At state 10.s10>sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\")\n", + "print(\"From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\")\n", + "T10=370.6;\n", + "h10=3141.81;\n", + "print(\"Let dryness fraction at state 9 be x9 so,\") \n", + "print(\"s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\")\n", + "print(\"from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\")\n", + "sf=1.7766;\n", + "sfg=5.1193;\n", + "x9=(s9-sf)/sfg\n", + "print(\"x9=(s9-sf)/sfg\"),round(x9,2)\n", + "x9=0.9536;#approx.\n", + "print(\"h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\")\n", + "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\")\n", + "hf=604.74;\n", + "hfg=2133.8;\n", + "h9=hf+x9*hfg \n", + "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\")\n", + "print(\"h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\")\n", + "h11=604.74;\n", + "v11=0.001084;\n", + "print(\"h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\")\n", + "h13=1087.31;\n", + "v13=0.001252;\n", + "print(\"For process 4-8,i.e in CEP.\")\n", + "h8=h4+v4*(4-0.05)*10**2\n", + "print(\"h8 in KJ/kg=\"),round(h8,2)\n", + "print(\"For process 11-12,i.e in FP2,\")\n", + "h12=h11+v11*(40-4)*10**2\n", + "print(\"h12=h11+v11*(40-4)*10^2 in KJ/kg\"),round(h12,2)\n", + "h1_a=h13+v13*(200-40)*10**2\n", + "print(\"For process 13-1_a i.e. in FP1,h1_a= in KJ/kg=\"),round(h1_a,2)\n", + "print(\"m1*3141.81+(1-m1)*608.64=1087.31\")\n", + "print(\"so m1=(1087.31-608.64)/(3141.81-608.64)in kg\")\n", + "m1=(1087.31-608.64)/(3141.81-608.64)\n", + "print(\"Applying energy balance on open feed water heater 1 (OFWH1)\")\n", + "print(\"m1*h10+(1-m1)*h12)=1*h13\")\n", + "m1=(h13-h12)/(h10-h12)\n", + "print(\"so m1 in kg=\"),round(m1,2)\n", + "print(\"Applying energy balance on open feed water heater 2 (OFWH2)\")\n", + "print(\"m2*h9+(1-m1-m2)*h8=(1-m1)*h11\")\n", + "m2=(1-m1)*(h11-h8)/(h9-h8)\n", + "print(\"so m2 in kg=\"),round(m2,2)\n", + "W_CEP=(1-m1-m2)*(h8-h4)\n", + "W_FP1=(h1_a-h13)\n", + "W_FP2=(1-m1)*(h12-h11)\n", + "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", + "print(\"Thermal efficiency of cycle,n=\"),round(n,2)\n", + "print(\"W_CEP in KJ/kg steam from boiler=\"),round(W_CEP,2)\n", + "print(\"W_FP1=(h1_a-h13)in KJ/kg of steam from boiler\"),round(W_FP1)\n", + "print(\"W_FP2 in KJ/kg of steam from boiler=\"),round(W_FP2,2)\n", + "W_CEP+W_FP1+W_FP2\n", + "print(\"W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler=\"),round(W_CEP+W_FP1+W_FP2,2)\n", + "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", + "print(\"n=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so cycle thermal efficiency,na=46.18%\")\n", + "print(\"nb=49.76%\")\n", + "print(\"nc=51.37%\")\n", + "print(\"hence it is obvious that efficiency increases with increase in number of feed heaters.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.7;pg no: 272" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.7, Page:272 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\n", + "from steam tables,\n", + "h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\n", + "s3=s2=6.9759 KJ/kg K\n", + "by interpolation from steam tables,\n", + "T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\n", + "for expansion process 4-5,s4=s5=7.7938 KJ/kg K\n", + "let dryness fraction at state 5 be x5\n", + "s5=sf at 0.05 bar+x5*sfg at 0.05 bar\n", + "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "so x5= 0.92\n", + "h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\n", + "from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\n", + "h6=hf at 0.05 bar=137.82 KJ/kg\n", + "v6=vf at 0.05 bar=0.001005 m^3/kg\n", + "for process 6-1 in feed pump,h1 in KJ/kg= 142.84\n", + "cycle efficiency=W_net/Q_add\n", + "Wt in KJ/kg= 1510.35\n", + "W_pump=(h1-h6)in KJ/kg 5.02\n", + "W_net=Wt-W_pump in KJ/kg 1505.33\n", + "Q_add in KJ/kg= 3290.96\n", + "cycle efficiency= 0.4574\n", + "in percentage= 45.74\n", + "we know ,1 hp=0.7457 KW\n", + "specific steam consumption in kg/hp hr= 1.78\n", + "work ratio=net work/positive work 0.9967\n", + "so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\n" + ] + } + ], + "source": [ + "#cal of cycle efficiency,specific steam consumption,work ratio\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.7, Page:272 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\")\n", + "print(\"from steam tables,\")\n", + "print(\"h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\")\n", + "h2=3433.8;\n", + "s2=6.9759;\n", + "print(\"s3=s2=6.9759 KJ/kg K\")\n", + "s3=s2;\n", + "print(\"by interpolation from steam tables,\")\n", + "print(\"T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\")\n", + "T3=183.14;\n", + "h3=2818.03;\n", + "h4=3271.9;\n", + "s4=7.7938;\n", + "print(\"for expansion process 4-5,s4=s5=7.7938 KJ/kg K\")\n", + "s5=s4;\n", + "print(\"let dryness fraction at state 5 be x5\")\n", + "print(\"s5=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", + "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "x5=(s5-sf)/sfg\n", + "print(\"so x5=\"),round(x5,2)\n", + "x5=0.924;#approx.\n", + "print(\"h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\")\n", + "print(\"from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "h5=hf+x5*hfg \n", + "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", + "h6=137.82;\n", + "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", + "v6=0.001005;\n", + "p1=50.;#steam generation pressure in bar\n", + "p6=0.05;#steam entering temperature in turbine in bar\n", + "h1=h6+v6*(p1-p6)*100\n", + "print(\"for process 6-1 in feed pump,h1 in KJ/kg=\"),round(h1,2)\n", + "print(\"cycle efficiency=W_net/Q_add\")\n", + "Wt=(h2-h3)+(h4-h5)\n", + "print(\"Wt in KJ/kg=\"),round(Wt,2)\n", + "W_pump=(h1-h6)\n", + "print(\"W_pump=(h1-h6)in KJ/kg\"),round(W_pump,2)\n", + "W_net=Wt-W_pump\n", + "print(\"W_net=Wt-W_pump in KJ/kg\"),round(W_net,2)\n", + "Q_add=(h2-h1)\n", + "print(\"Q_add in KJ/kg=\"),round(Q_add,2)\n", + "print(\"cycle efficiency=\"),round(W_net/Q_add,4)\n", + "W_net*100/Q_add\n", + "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", + "print(\"we know ,1 hp=0.7457 KW\")\n", + "print(\"specific steam consumption in kg/hp hr=\"),round(0.7457*3600/W_net,2)\n", + "print(\"work ratio=net work/positive work\"),round(W_net/Wt,4)\n", + "print(\"so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.8;pg no: 273" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.8, Page:273 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\n", + "from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\n", + "h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\n", + "Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\n", + "h8=hf at 3 bar=561.47 KJ/kg\n", + "for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\n", + "Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\n", + "s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\n", + "from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\n", + "so x3= 0.95\n", + "s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\n", + "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "so x4= 0.79\n", + "thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\n", + "here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\n", + "h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\n", + "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", + "assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\n", + "pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\n", + "for mixing process between condenser and feed pump,\n", + "(1-m)*h5+m*h9=1*h6\n", + "h6=m(h9-h5)+h5\n", + "we get,h6=137.82+m*423.65\n", + "therefore h7=h6+6.02=143.84+m*423.65\n", + "Applying energy balance at closed feed water heater;\n", + "m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\n", + "so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\n", + "so m=0.144 kg\n", + "steam bled for feed heating=0.144 kg/kg steam generated\n", + "The net power output,W_net in KJ/kg steam generated= 1167.27\n", + "mass of steam required to be generated in kg/s= 26.23\n", + "or in kg/hr\n", + "so capacity of boiler required=94428 kg/hr\n", + "overall thermal efficiency=W_net/Q_add\n", + "here Q_add in KJ/kg= 3134.56\n", + "overall thermal efficiency= 0.37\n", + "in percentage= 37.24\n", + "so overall thermal efficiency=37.24%\n" + ] + } + ], + "source": [ + "#cal of mass of steam bled for feed heating,capacity of boiler required,overall thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.8, Page:273 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\")\n", + "T_cond=115;#condensate temperature in degree celcius\n", + "Cp=4.18;#specific heat at constant pressure in KJ/kg K\n", + "P=30*10**3;#actual alternator output in KW\n", + "n_boiler=0.9;#boiler efficiency\n", + "n_alternator=0.98;#alternator efficiency\n", + "print(\"from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\")\n", + "h2=3301.8;\n", + "s2=6.7193;\n", + "print(\"h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\")\n", + "h5=137.82;\n", + "v5=0.001005;\n", + "print(\"Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\")\n", + "print(\"h8=hf at 3 bar=561.47 KJ/kg\")\n", + "h8=561.47;\n", + "print(\"for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\")\n", + "s3=s2;\n", + "s4=s3;\n", + "print(\"Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\")\n", + "print(\"s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\")\n", + "print(\"from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\")\n", + "sf_3bar=1.6718;\n", + "sfg_3bar=5.3201;\n", + "x3=(s3-sf_3bar)/sfg_3bar\n", + "print(\"so x3=\"),round(x3,2)\n", + "x3=0.949;#approx.\n", + "print(\"s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\")\n", + "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.788;#approx.\n", + "print(\"thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\")\n", + "print(\"here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\")\n", + "hf_3bar=561.47;\n", + "hfg_3bar=2163.8;\n", + "h3=hf_3bar+x3*hfg_3bar \n", + "print(\"h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\")\n", + "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "h4=hf+x4*hfg\n", + "print(\"assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\")\n", + "h9=h8;\n", + "v6=v5;\n", + "print(\"pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\")\n", + "p1=60;#pressure of steam in high pressure turbine in bar\n", + "p5=0.05;#pressure of steam in low pressure turbine in bar\n", + "v5*(p1-p5)*100\n", + "print(\"for mixing process between condenser and feed pump,\")\n", + "print(\"(1-m)*h5+m*h9=1*h6\")\n", + "print(\"h6=m(h9-h5)+h5\")\n", + "print(\"we get,h6=137.82+m*423.65\")\n", + "print(\"therefore h7=h6+6.02=143.84+m*423.65\")\n", + "print(\"Applying energy balance at closed feed water heater;\")\n", + "print(\"m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\")\n", + "print(\"so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\")\n", + "print(\"so m=0.144 kg\")\n", + "m=0.144;\n", + "h6=137.82+m*423.65;\n", + "h7=143.84+m*423.65;\n", + "print(\"steam bled for feed heating=0.144 kg/kg steam generated\")\n", + "W_net=(h2-h3)+(1-m)*(h3-h4)-(1-m)*(h7-h6)\n", + "print(\"The net power output,W_net in KJ/kg steam generated=\"),round(W_net,2)\n", + "P/(n_alternator*W_net)\n", + "print(\"mass of steam required to be generated in kg/s=\"),round(P/(n_alternator*W_net),2)\n", + "print(\"or in kg/hr\")\n", + "26.23*3600\n", + "print(\"so capacity of boiler required=94428 kg/hr\")\n", + "print(\"overall thermal efficiency=W_net/Q_add\")\n", + "Q_add=(h2-Cp*T_cond)/n_boiler\n", + "print(\"here Q_add in KJ/kg=\"),round(Q_add,2) \n", + "W_net/Q_add\n", + "print(\"overall thermal efficiency=\"),round(W_net/Q_add,2)\n", + "W_net*100/Q_add\n", + "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", + "print(\"so overall thermal efficiency=37.24%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.9;pg no: 275" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.9, Page:275 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\n", + "At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\n", + "For ideal expansion process,s2=s3\n", + "By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\n", + "actual stste at exit of first stage,h3_a in KJ/kg= 2909.88\n", + "actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K= 7.1075\n", + "for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\n", + "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", + "so x4= 0.96\n", + "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", + "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", + "actual enthalpy at exit from second stage,h4_a in KJ/kg= 2646.48\n", + "actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\n", + "so x4_a= 0.99\n", + "x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\n", + "for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x5= 0.87\n", + "h5=2270.43 KJ/kg\n", + "actual enthalpy at exit from third stage,h5_a in KJ/kg= 2345.64\n", + "Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\n", + "By heat balance on first closed feed water heater,(see schematic arrangement)\n", + "h11=hf at 6 bar=670.56 KJ\n", + "m1*h3_a+h10=m1*h11+4.18*150\n", + "(m1*2829.63)+h10=(m1*670.56)+627\n", + "h10+2159.07*m1=627\n", + "By heat balance on second closed feed water heater,(see schematic arrangement)\n", + "h7=hf at 1 bar=417.46 KJ/kg\n", + "m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\n", + "m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\n", + "m2*2467.27-m1*179.2-238.26=0\n", + "heat balance at point of mixing,\n", + "h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\n", + "neglecting pump work,h7=h8\n", + "h10=m2*417.46+(1-m1-m2)*397.1\n", + "substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\n", + "Turbine output per kg of steam generated,Wt in KJ/kg of steam generated= 780.445\n", + "Rate of steam generation required in kg/s= 19.22\n", + "in kg/hr\n", + "capacity of drain pump i.e. FP shown in layout in kg/hr= 16273.96\n", + "so capacity of drain pump=16273.96 kg/hr\n" + ] + } + ], + "source": [ + "#cal of capacity of drain pump\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.9, Page:275 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\")\n", + "P=15*10**3;#turbine output in KW\n", + "print(\"At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\")\n", + "h2=3230.9;\n", + "s2=6.9212;\n", + "print(\"For ideal expansion process,s2=s3\")\n", + "s3=s2;\n", + "print(\"By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\")\n", + "T3=190.97;\n", + "h3=2829.63;\n", + "h3_a=h2-0.8*(h2-h3)\n", + "print(\"actual stste at exit of first stage,h3_a in KJ/kg=\"),round(h3_a,2)\n", + "s3_a=7.1075;\n", + "print(\"actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K=\"),round(s3_a,4)\n", + "print(\"for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\")\n", + "s4=7.1075;\n", + "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", + "sf=1.3026;\n", + "sfg=6.0568;\n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.958;#approx.\n", + "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", + "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", + "hf=417.46;\n", + "hfg=2258.0;\n", + "h4=hf+x4*hfg\n", + "h4_a=h3_a-.8*(h3_a-h4)\n", + "print(\"actual enthalpy at exit from second stage,h4_a in KJ/kg=\"),round(h4_a,2)\n", + "print(\"actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\")\n", + "x4_a=(h4_a-hf)/hfg\n", + "print(\"so x4_a=\"),round(x4_a,2)\n", + "print(\"x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\")\n", + "s4_a=7.2806;\n", + "print(\"for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "x5=(s4_a-sf)/sfg\n", + "print(\"so x5=\"),round(x5,2)\n", + "x5=0.8735;#approx.\n", + "print(\"h5=2270.43 KJ/kg\")\n", + "h5=2270.43;\n", + "h5_a=h4_a-0.8*(h4_a-h5)\n", + "print(\"actual enthalpy at exit from third stage,h5_a in KJ/kg=\"),round(h5_a,2)\n", + "print(\"Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\")\n", + "print(\"By heat balance on first closed feed water heater,(see schematic arrangement)\")\n", + "print(\"h11=hf at 6 bar=670.56 KJ\")\n", + "h11=670.56;\n", + "print(\"m1*h3_a+h10=m1*h11+4.18*150\")\n", + "print(\"(m1*2829.63)+h10=(m1*670.56)+627\")\n", + "print(\"h10+2159.07*m1=627\")\n", + "print(\"By heat balance on second closed feed water heater,(see schematic arrangement)\")\n", + "print(\"h7=hf at 1 bar=417.46 KJ/kg\")\n", + "h7=417.46;\n", + "print(\"m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\")\n", + "print(\"m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\")\n", + "print(\"m2*2467.27-m1*179.2-238.26=0\")\n", + "print(\"heat balance at point of mixing,\")\n", + "print(\"h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\")\n", + "print(\"neglecting pump work,h7=h8\")\n", + "print(\"h10=m2*417.46+(1-m1-m2)*397.1\")\n", + "print(\"substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\")\n", + "m1=0.1293;\n", + "m2=0.1059;\n", + "Wt=(h2-h3_a)+(1-m1)*(h3_a-h4_a)+(1-m1-m2)*(h4_a-h5_a)\n", + "print(\"Turbine output per kg of steam generated,Wt in KJ/kg of steam generated=\"),round(Wt,3)\n", + "P/Wt\n", + "print(\"Rate of steam generation required in kg/s=\"),round(P/Wt,2)\n", + "print(\"in kg/hr\")\n", + "P*3600/Wt\n", + "(m1+m2)*69192\n", + "print(\"capacity of drain pump i.e. FP shown in layout in kg/hr=\"),round((m1+m2)*69192,2)\n", + "print(\"so capacity of drain pump=16273.96 kg/hr\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.10;pg no: 277" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.10, Page:277 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\n", + "at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\n", + "By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\n", + "actual enthapy at 3_a,h3_a in KJ/kg= 3097.0\n", + "enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\n", + "for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\n", + "s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x6= 0.83\n", + "h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "for actual expansion process in LP turbine.\n", + "h6_a=h4-0.85*(h4-h6) in KJ/kg 2319.4\n", + "Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\n", + "s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\n", + "from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\n", + "so x5= 1.0\n", + "h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\n", + "from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\n", + "actual enthalpy,h5_a in KJ/kg= 2790.16\n", + "enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\n", + "specific volume at inlet of CEP,v7=0.001008 m^3/kg\n", + "enthalpy at inlet of CEP,h7=168.79 KJ/kg\n", + "for pumping process 7-8,h8 in KJ/kg= 169.15\n", + "Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\n", + "m*h5+(1-m)*h8=h9\n", + "so m in kg /kg of steam generated= 0.33\n", + "For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\n", + "h1= in KJ/kg= 1015.59\n", + "Net work per kg of steam generated,W_net=in KJ/kg steam generated= 938.83\n", + "heat added per kg of steam generated,q_add in KJ/kg of steam generated= 2405.41\n", + "Thermal efficiency,n= 0.39\n", + "in percentage= 39.03\n", + "so thermal efficiency=39.03%%\n", + "NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\n" + ] + } + ], + "source": [ + "#cal of cycle efficiency\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.10, Page:277 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\")\n", + "print(\"at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\")\n", + "h2=3287.1;\n", + "s2=6.6327;\n", + "print(\"By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\")\n", + "h3=3049.48;\n", + "h3_a=h2-0.80*(h2-h3)\n", + "print(\"actual enthapy at 3_a,h3_a in KJ/kg=\"),round(h3_a,2)\n", + "print(\"enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\")\n", + "h4=3230.9;\n", + "s4=6.9212;\n", + "print(\"for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\")\n", + "s6=s4;\n", + "print(\"s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "x6=(s6-sf)/sfg\n", + "print(\"so x6=\"),round(x6,2)\n", + "x6=0.827;#approx.\n", + "print(\"h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0;\n", + "h6=hf+x6*hfg\n", + "print(\"for actual expansion process in LP turbine.\")\n", + "h6_a=h4-0.85*(h4-h6)\n", + "print(\"h6_a=h4-0.85*(h4-h6) in KJ/kg\"),round(h6_a,2)\n", + "print(\"Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\")\n", + "p5=3.61;\n", + "s5=s4;\n", + "print(\"s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\")\n", + "print(\"from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\")\n", + "sf=1.7391;\n", + "sfg=5.1908;\n", + "x5=(s5-sf)/sfg\n", + "print(\"so x5=\"),round(x5,2)\n", + "x5=0.99;#approx.\n", + "print(\"h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\")\n", + "print(\"from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\")\n", + "hf=589.13;\n", + "hfg=2144.7;\n", + "h5=hf+x5*hfg\n", + "h5_a=h4-0.85*(h4-h5)\n", + "print(\"actual enthalpy,h5_a in KJ/kg=\"),round(h5_a,2)\n", + "print(\"enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\")\n", + "h9=1008.42;\n", + "print(\"specific volume at inlet of CEP,v7=0.001008 m^3/kg\")\n", + "v7=0.001008;\n", + "print(\"enthalpy at inlet of CEP,h7=168.79 KJ/kg\")\n", + "h7=168.79;\n", + "h8=h7+v7*(3.61-0.075)*10**2\n", + "print(\"for pumping process 7-8,h8 in KJ/kg=\"),round(h8,2)\n", + "print(\"Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\")\n", + "print(\"m*h5+(1-m)*h8=h9\")\n", + "m=(h9-h8)/(h5-h8)\n", + "print(\"so m in kg /kg of steam generated=\"),round(m,2)\n", + "print(\"For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\")\n", + "v9=0.00108;\n", + "h1=h9+v9*(70-3.61)*10**2\n", + "print(\"h1= in KJ/kg=\"),round(h1,2) \n", + "W_net=(h2-h3_a)+(h4-h5_a)+(1-m)*(h5_a-h6_a)-((1-m)*(h8-h7)+(h1-h9))\n", + "print(\"Net work per kg of steam generated,W_net=in KJ/kg steam generated=\"),round(W_net,2)\n", + "q_add=(h2-h1)+(h4-h3_a)\n", + "print(\"heat added per kg of steam generated,q_add in KJ/kg of steam generated=\"),round(q_add,2)\n", + "n=W_net/q_add\n", + "print(\"Thermal efficiency,n=\"),round(n,2)\n", + "n=n*100\n", + "print(\"in percentage=\"),round(n,2)\n", + "print(\"so thermal efficiency=39.03%%\")\n", + "print(\"NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.11;pg no: 279" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.11, Page:279 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\n", + "Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\n", + "for isentropic expansion 2-3-4-5,s2=s3=s4=s5\n", + "Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\n", + "s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\n", + "so x3=(s3-sf)/sfg\n", + "from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\n", + "h3=hf+x3*hfg in KJ/kg\n", + "from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\n", + "s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\n", + "so x4=(s4-sf)/sfg\n", + "from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\n", + "so h4=hf+x4*hfg in KJ/kg\n", + "from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\n", + "s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\n", + "so x5=(s5-sf)/sfg\n", + "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", + "h5=hf+x5*hfg in KJ/kg\n", + "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", + "h6=hf at 0.05 bar=137.82 KJ/kg\n", + "v6=vf at 0.05 bar=0.001005 m^3/kg\n", + "h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\n", + "h8=hf at 1.5 bar=467.11 KJ/kg\n", + "v8=0.001053 m^3/kg=vf at 1.5 bar\n", + "h9=h8+v8*(150-1.5)*10^2 in KJ/kg\n", + "h10=hf at 150 bar=1610.5 KJ/kg\n", + "v10=0.001658 m^3/kg=vf at 150 bar\n", + "h12=h10+v10*(150-10)*10^2 in KJ/kg\n", + "Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\n", + "Heat balance on closed feed water heater yields,\n", + "m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\n", + "so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\n", + "heat balance on open feed water can be given as under,\n", + "m2*h4+(1-m1-m2)*h7=(1-m1)*h8\n", + "so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\n", + "for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\n", + "For mixing after closed feed water heater,\n", + "h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\n", + "Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\n", + "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\n", + "heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\n", + "cycle thermal efficiency,n=W_net/q_add 0.48\n", + "in percentage 47.59\n", + "Net power developed in KW=1219*300 in KW 365700.0\n", + "cycle thermal efficiency=47.6%\n", + "Net power developed=365700 KW\n" + ] + } + ], + "source": [ + "#cal of cycle thermal efficiency,Net power developed\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.11, Page:279 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\")\n", + "print(\"Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\")\n", + "h2=3308.6;\n", + "s2=6.3443;\n", + "print(\"for isentropic expansion 2-3-4-5,s2=s3=s4=s5\")\n", + "s3=s2;\n", + "s4=s3;\n", + "s5=s4;\n", + "print(\"Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\")\n", + "print(\"s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\")\n", + "print(\"so x3=(s3-sf)/sfg\")\n", + "print(\"from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\")\n", + "sf=2.1387;\n", + "sfg=4.4478;\n", + "x3=(s3-sf)/sfg\n", + "x3=0.945;#approx.\n", + "print(\"h3=hf+x3*hfg in KJ/kg\")\n", + "print(\"from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\")\n", + "hf=762.81;\n", + "hfg=2015.3;\n", + "h3=hf+x3*hfg\n", + "print(\"s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\")\n", + "print(\"so x4=(s4-sf)/sfg\")\n", + "print(\"from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\")\n", + "sf=1.4336;\n", + "sfg=5.7897;\n", + "x4=(s4-sf)/sfg\n", + "x4=0.848;#approx.\n", + "print(\"so h4=hf+x4*hfg in KJ/kg\")\n", + "print(\"from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\")\n", + "hf=467.11;\n", + "hfg=2226.5;\n", + "h4=hf+x4*hfg\n", + "print(\"s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", + "print(\"so x5=(s5-sf)/sfg\")\n", + "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", + "sf=0.4764;\n", + "sfg=7.9187;\n", + "x5=(s5-sf)/sfg\n", + "x5=0.739;#approx.\n", + "print(\"h5=hf+x5*hfg in KJ/kg\")\n", + "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", + "hf=137.82;\n", + "hfg=2423.7;\n", + "h5=hf+x5*hfg \n", + "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", + "h6=137.82;\n", + "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", + "v6=0.001005;\n", + "print(\"h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\")\n", + "h7=h6+v6*(1.5-0.05)*10**2\n", + "print(\"h8=hf at 1.5 bar=467.11 KJ/kg\")\n", + "h8=467.11; \n", + "print(\"v8=0.001053 m^3/kg=vf at 1.5 bar\")\n", + "v8=0.001053;\n", + "print(\"h9=h8+v8*(150-1.5)*10^2 in KJ/kg\")\n", + "h9=h8+v8*(150-1.5)*10**2\n", + "print(\"h10=hf at 150 bar=1610.5 KJ/kg\")\n", + "h10=1610.5; \n", + "print(\"v10=0.001658 m^3/kg=vf at 150 bar\")\n", + "v10=0.001658;\n", + "print(\"h12=h10+v10*(150-10)*10^2 in KJ/kg\")\n", + "h12=h10+v10*(150-10)*10**2\n", + "print(\"Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\")\n", + "print(\"Heat balance on closed feed water heater yields,\")\n", + "print(\"m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\")\n", + "print(\"so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\")\n", + "m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)\n", + "print(\"heat balance on open feed water can be given as under,\")\n", + "print(\"m2*h4+(1-m1-m2)*h7=(1-m1)*h8\")\n", + "print(\"so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\")\n", + "m2=((1-m1)*(h8-h7))/(h4-h7)\n", + "print(\"for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\")\n", + "print(\"For mixing after closed feed water heater,\")\n", + "print(\"h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\")\n", + "h1=(4.18*150)*(1-m1)+m1*h12\n", + "print(\"Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\")\n", + "print(\"W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\")\n", + "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-((1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10)))\n", + "print(\"heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\")\n", + "q_add=(h2-h1)\n", + "n=W_net/q_add\n", + "print(\"cycle thermal efficiency,n=W_net/q_add\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"Net power developed in KW=1219*300 in KW\"),round(1219*300,2)\n", + "print(\"cycle thermal efficiency=47.6%\")\n", + "print(\"Net power developed=365700 KW\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.12;pg no: 282" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.12, Page:282 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\n", + "At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", + "For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\n", + "state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\n", + "since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\n", + "At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", + "At state 3,h3=2930.57 KJ/kg\n", + "At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\n", + "At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\n", + "From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\n", + "Let dryness fraction at state 5_a be x5,\n", + "s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x5_a=(s5_a-sf)/sfg\n", + "h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\n", + "from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\n", + "Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\n", + "m1_a*h3+h9=m1*h10+4.18*200\n", + "so m1_a=(4.18*200-h9)/(h3-h10) in kg\n", + "Applying heat balance at open feed water heater,\n", + "m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\n", + "so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\n", + "Net work per kg steam generated\n", + "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\n", + "Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\n", + "Thermal efficiency,n= 0.45\n", + "in percentage 45.04\n", + "% increase in thermal efficiency due to reheating= 0.56\n", + "so thermal efficiency of reheat cycle=45.03%\n", + "% increase in efficiency due to reheating=0.56%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,steam generation rate\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.12, Page:282 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\")\n", + "P=100*10**3;#net power output in KW\n", + "print(\"At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", + "h2=3373.7;\n", + "s2=6.5966;\n", + "print(\"For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\")\n", + "s3=s2;\n", + "s4=s3;\n", + "s5=s4;\n", + "print(\"state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\")\n", + "T3=261.6;\n", + "h3=2930.57;\n", + "print(\"since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\")\n", + "print(\"At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", + "h2=3373.7;\n", + "s2=6.5966;\n", + "print(\"At state 3,h3=2930.57 KJ/kg\")\n", + "h3=2930.57;\n", + "print(\"At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\")\n", + "h3_a=3247.6;\n", + "s3_a=7.1271;\n", + "print(\"At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\")\n", + "s4_a=s3_a;\n", + "s5_a=s4_a;\n", + "print(\"From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\")\n", + "h4_a=2841.02;\n", + "print(\"Let dryness fraction at state 5_a be x5,\")\n", + "print(\"s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "print(\"so x5_a=(s5_a-sf)/sfg\")\n", + "x5_a=(s5_a-sf)/sfg\n", + "x5_a=0.853;#approx.\n", + "print(\"h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "h5_a=hf+x5_a*hfg\n", + "print(\"Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\")\n", + "print(\"m1_a*h3+h9=m1*h10+4.18*200\")\n", + "print(\"so m1_a=(4.18*200-h9)/(h3-h10) in kg\")\n", + "m1_a=(4.18*200-h9)/(h3-h10)\n", + "m1_a=0.114;#approx.\n", + "print(\"Applying heat balance at open feed water heater,\")\n", + "print(\"m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\")\n", + "print(\"so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\")\n", + "m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7)\n", + "m2_a=0.131;#approx.\n", + "print(\"Net work per kg steam generated\")\n", + "print(\"w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\")\n", + "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-((1-m1_a-m2_a)*(h7-h6)+(h9-h8))\n", + "print(\"Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\")\n", + "q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)\n", + "n=w_net/q_add\n", + "print(\"Thermal efficiency,n=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"% increase in thermal efficiency due to reheating=\"),round((0.4503-0.4478)*100/0.4478,2)\n", + "print(\"so thermal efficiency of reheat cycle=45.03%\")\n", + "print(\"% increase in efficiency due to reheating=0.56%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.13;pg no: 286" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.13, Page:286 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\n", + "For mercury cycle,\n", + "insentropic heat drop=349-234.5 in KJ/kg Hg\n", + "actual heat drop=0.85*114.5 in KJ/kg Hg\n", + "Heat rejected in condenser=(349-97.325-35)in KJ/kg\n", + "heat added in boiler=349-35 in KJ/kg\n", + "For steam cycle,\n", + "Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\n", + "Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\n", + "Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\n", + "Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\n", + "Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\n", + "for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\n", + "state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\n", + "state 4 lies in wet region,say with dryness fraction x4\n", + "s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\n", + "so x4=(s4-sf)/sfg\n", + "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", + "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", + "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", + "Let state 5 lie in wet region with dryness fraction x5,\n", + "s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\n", + "so x5=(s5-sf)/sfg\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "h5=hf+x5*hfg in KJ/kg\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\n", + "h7=h6+v6*(1-0.075)*10^2 in KJ/kg\n", + "from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\n", + "h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\n", + "Applying heat balance on CFWH1,T1=150oc and also T15=150oc\n", + "m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\n", + "(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\n", + "Applying heat balance on CFEH2,T11=90oc\n", + "m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\n", + "(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\n", + "Heat balance at mixing between CFWH1 and CFWH2,\n", + "(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\n", + "376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\n", + "For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\n", + "from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\n", + "solving above equations,we get\n", + "m1=0.102 kg per kg steam generated\n", + "m2=0.073 kg per kg steam generated\n", + "pump work in process 13-14,h14-h13=v13*(40-8)*10^2\n", + "so h14-h13 in KJ/kg\n", + "Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\n", + "net work per kg of steam,w_net=w_mercury+w_steam\n", + "w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\n", + "thermal efficiency of binary vapour cycle=w_net/q_add 0.55\n", + "in percentage 55.36\n", + "so thermal efficiency=55.36%\n", + "NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.13, Page:286 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\")\n", + "print(\"For mercury cycle,\")\n", + "print(\"insentropic heat drop=349-234.5 in KJ/kg Hg\")\n", + "349-234.5\n", + "print(\"actual heat drop=0.85*114.5 in KJ/kg Hg\")\n", + "0.85*114.5\n", + "print(\"Heat rejected in condenser=(349-97.325-35)in KJ/kg\")\n", + "(349-97.325-35)\n", + "print(\"heat added in boiler=349-35 in KJ/kg\")\n", + "349-35\n", + "print(\"For steam cycle,\")\n", + "print(\"Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\")\n", + "h=2767.13;\n", + "print(\"Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\")\n", + "h2=3330.3;\n", + "print(\"Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\")\n", + "s2=6.9363;\n", + "print(\"Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\")\n", + "h-4.18*150\n", + "print(\"Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\")\n", + "2140.13/216.675\n", + "print(\"for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\")\n", + "s3=s2;\n", + "s4=s3;\n", + "s5=s4;\n", + "print(\"state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\")\n", + "h3=2899.23;\n", + "print(\"state 4 lies in wet region,say with dryness fraction x4\")\n", + "print(\"s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\")\n", + "print(\"so x4=(s4-sf)/sfg\")\n", + "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", + "sf=1.3026;\n", + "sfg=6.0568;\n", + "x4=(s4-sf)/sfg\n", + "x4=0.93;#approx.\n", + "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", + "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", + "hf=417.46;\n", + "hfg=2258.0;\n", + "h4=hf+x4*hfg\n", + "print(\"Let state 5 lie in wet region with dryness fraction x5,\")\n", + "print(\"s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", + "print(\"so x5=(s5-sf)/sfg\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "x5=(s5-sf)/sfg\n", + "x5=0.828;#approx.\n", + "print(\"h5=hf+x5*hfg in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0;\n", + "h5=hf+x5*hfg\n", + "print(\"Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\")\n", + "print(\"h7=h6+v6*(1-0.075)*10^2 in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\")\n", + "h6=168.79;\n", + "v6=0.001008;\n", + "h7=h6+v6*(1-0.075)*10**2\n", + "print(\"h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\")\n", + "h9=417.46;\n", + "h13=721.11;\n", + "print(\"Applying heat balance on CFWH1,T1=150oc and also T15=150oc\")\n", + "T1=150;\n", + "T15=150;\n", + "print(\"m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\")\n", + "print(\"(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\")\n", + "print(\"Applying heat balance on CFEH2,T11=90oc\")\n", + "T11=90;\n", + "print(\"m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\")\n", + "print(\"(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\")\n", + "print(\"Heat balance at mixing between CFWH1 and CFWH2,\")\n", + "print(\"(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\")\n", + "print(\"376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\")\n", + "print(\"For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\")\n", + "print(\"from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\")\n", + "h9=417.46;\n", + "v9=0.001043;\n", + "h10=h9+v9*(8-1)*10**2 \n", + "print(\"solving above equations,we get\")\n", + "print(\"m1=0.102 kg per kg steam generated\")\n", + "print(\"m2=0.073 kg per kg steam generated\")\n", + "m1=0.102;\n", + "m2=0.073;\n", + "print(\"pump work in process 13-14,h14-h13=v13*(40-8)*10^2\")\n", + "print(\"so h14-h13 in KJ/kg\")\n", + "v13=0.001252;\n", + "v13*(40-8)*10**2\n", + "print(\"Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\")\n", + "q_add=(9.88*314)+(3330.3-2767.13)\n", + "print(\"net work per kg of steam,w_net=w_mercury+w_steam\")\n", + "print(\"w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\")\n", + "w_net=(9.88*97.325)+((h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h7-h6)-m2*(h10-h9)-m1*4.006)\n", + "print(\"thermal efficiency of binary vapour cycle=w_net/q_add\"),round(w_net/q_add,2)\n", + "print(\"in percentage\"),round(w_net*100/q_add,2)\n", + "print(\"so thermal efficiency=55.36%\")\n", + "print(\"NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.14;pg no: 288" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.14, Page:288 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\n", + "This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\n", + "For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\n", + "ideally, s2=s1=6.7664 KJ/kg K\n", + "s2=sf at 0.075 bar +x3* sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x3=(s2-sf)/sfg\n", + "h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\n", + "for LP:at inlet of LP steam\n", + "h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\n", + "Enthalpy at exit,h_3LP=2222.34 KJ/kg\n", + "actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\n", + "HP steam consumption at full load=P*0.7457/h_HP in kg/s\n", + "HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\n", + "LP steam consumption at full load=P*0.7457/h_LP in kg/s\n", + "LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\n", + "The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\n", + "or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\n", + "Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\n", + "x=load,hp\n", + "y_HP=m_HP*x+C_HP\n", + "0.254=m_HP*0+C_HP\n", + "so C_HP=0.254\n", + "2.54=m_HP*2500+C_HP\n", + "so m_HP=(2.54-C_HP)/2500\n", + "so y_HP=9.144*10^-4*x_HP+0.254\n", + "Willans line for LP:y_LP=m_LP*x_LP+C_LP\n", + "0.481=m_LP*0+C_LP\n", + "so C_LP=0.481\n", + "4.81=m_LP*2500+C_LP\n", + "so m_LP=(4.81-C_LP)/2500\n", + "so y_LP=1.732*10^-3*x_LP+0.481\n", + "Total output(load) from mixed turbine,x=x_HP+x_LP\n", + "For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\n", + "from y_LP=1.732*10^-3*x_LP+0.481,\n", + "x_LP=(y_LP-0.481)/1.732*10^-3\n", + "since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\n", + "from y_HP=9.144*10^-4*x_HP+C_HP in kg/s 0.63\n", + "so HP steam requirement=0.63 kg/s\n" + ] + } + ], + "source": [ + "#cal of HP steam required\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.14, Page:288 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\")\n", + "n=0.8;#efficiency of both HP and LP turbine\n", + "P=2500;#output in hp\n", + "print(\"This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\")\n", + "print(\"For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\")\n", + "h1=3023.5;\n", + "s1=6.7664;\n", + "print(\"ideally, s2=s1=6.7664 KJ/kg K\")\n", + "s2=s1;\n", + "print(\"s2=sf at 0.075 bar +x3* sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "print(\"so x3=(s2-sf)/sfg\")\n", + "x3=(s2-sf)/sfg\n", + "x3=0.806;#approx.\n", + "print(\"h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0; \n", + "h_3HP=hf+x3*hfg\n", + "print(\"actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\")\n", + "h_HP=(h1-h_3HP)*n\n", + "print(\"for LP:at inlet of LP steam\")\n", + "print(\"h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\")\n", + "h2=2706.7;\n", + "s2=7.1271;\n", + "print(\"Enthalpy at exit,h_3LP=2222.34 KJ/kg\")\n", + "h_3LP=2222.34;\n", + "print(\"actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\")\n", + "h_LP=(h2-h_3LP)*n\n", + "print(\"HP steam consumption at full load=P*0.7457/h_HP in kg/s\")\n", + "P*0.7457/h_HP\n", + "print(\"HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\")\n", + "0.10*(P*0.7457/h_HP)\n", + "print(\"LP steam consumption at full load=P*0.7457/h_LP in kg/s\")\n", + "P*0.7457/h_LP\n", + "print(\"LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\")\n", + "0.10*(P*0.7457/h_LP)\n", + "print(\"The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\")\n", + "print(\"or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\")\n", + "print(\"Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\")\n", + "print(\"x=load,hp\")\n", + "print(\"y_HP=m_HP*x+C_HP\")\n", + "print(\"0.254=m_HP*0+C_HP\")\n", + "print(\"so C_HP=0.254\")\n", + "C_HP=0.254;\n", + "print(\"2.54=m_HP*2500+C_HP\")\n", + "print(\"so m_HP=(2.54-C_HP)/2500\")\n", + "m_HP=(2.54-C_HP)/2500\n", + "print(\"so y_HP=9.144*10^-4*x_HP+0.254\")\n", + "print(\"Willans line for LP:y_LP=m_LP*x_LP+C_LP\")\n", + "print(\"0.481=m_LP*0+C_LP\")\n", + "print(\"so C_LP=0.481\")\n", + "C_LP=0.481;\n", + "print(\"4.81=m_LP*2500+C_LP\")\n", + "print(\"so m_LP=(4.81-C_LP)/2500\")\n", + "m_LP=(4.81-C_LP)/2500\n", + "print(\"so y_LP=1.732*10^-3*x_LP+0.481\")\n", + "print(\"Total output(load) from mixed turbine,x=x_HP+x_LP\")\n", + "print(\"For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\")\n", + "y_LP=1.5;\n", + "print(\"from y_LP=1.732*10^-3*x_LP+0.481,\")\n", + "print(\"x_LP=(y_LP-0.481)/1.732*10^-3\")\n", + "x_LP=(y_LP-0.481)/(1.732*10**-3)\n", + "print(\"since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\")\n", + "x_HP=411.66;\n", + "y_HP=9.144*10**-4*x_HP+C_HP\n", + "print(\"from y_HP=9.144*10^-4*x_HP+C_HP in kg/s\"),round(y_HP,2)\n", + "print(\"so HP steam requirement=0.63 kg/s\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.15;pg no: 289" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.15, Page:289 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\n", + "Let us carry out analysis for 1 kg of steam generated in boiler.\n", + "Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\n", + "state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\n", + "Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\n", + "so x3= 0.86\n", + "from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\n", + "h3=2404.94 KJ/kg\n", + "If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\n", + "mass of moisture retained in separator(m)=(1-x3)*0.5 kg\n", + "Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\n", + "Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\n", + "Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\n", + "(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\n", + "so T in degree celcius= 68.425\n", + "so temperature of water leaving hotwell=68.425 degree celcius\n", + "Applying heat balanced on trap\n", + "0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\n", + "so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\n", + "from steam tables,at 2 bar,hf=504.70 KJ/kg\n", + "Therefore,heat transferred in process heater in KJ/kg steam generated= 1023.172\n", + "so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\n", + "For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\n", + "Let dryness fraction be x10\n", + "s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", + "so x10=(s10-sf)/sfg\n", + "h10=hf at 0.075 bar+x10*hfg at 0.075 bar\n", + "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", + "so h10=hf+x10*hfg in KJ/kg \n", + "net work output,neglecting pump work per kg of steam generated,\n", + "w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\n", + "Heat added in boiler per kg steam generated,q_add in KJ/kg= 2674.68\n", + "thermal efficiency=w_net/q_add 0.28\n", + "in percentage 27.59\n", + "so Thermal efficiency=27.58%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,heat transferred and temperature\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.15, Page:289 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\")\n", + "print(\"Let us carry out analysis for 1 kg of steam generated in boiler.\")\n", + "print(\"Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\")\n", + "h2=2960.7;\n", + "s2=6.3615;\n", + "print(\"state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\")\n", + "s3=s2;\n", + "print(\"Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\")\n", + "sf=1.5301;\n", + "sfg=5.5970;\n", + "x3=(s3-sf)/sfg\n", + "print(\"so x3=\"),round(x3,2)\n", + "print(\"from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\")\n", + "x3=0.863;#approx.\n", + "print(\"h3=2404.94 KJ/kg\")\n", + "h3=2404.94;\n", + "print(\"If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\")\n", + "print(\"mass of moisture retained in separator(m)=(1-x3)*0.5 kg\")\n", + "m=(1-x3)*0.5\n", + "print(\"Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\")\n", + "m_LP=0.5-m\n", + "print(\"Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\")\n", + "print(\"Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\")\n", + "print(\"(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\")\n", + "T=((0.5685*4.18*90)+(0.4315*4.18*40))/4.18\n", + "print(\"so T in degree celcius=\"),round(T,3)\n", + "print(\"so temperature of water leaving hotwell=68.425 degree celcius\")\n", + "print(\"Applying heat balanced on trap\")\n", + "print(\"0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\")\n", + "print(\"so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\")\n", + "print(\"from steam tables,at 2 bar,hf=504.70 KJ/kg\")\n", + "hf=504.70;\n", + "h7=((0.5685*4.18*90)-(0.0685*hf))/0.5\n", + "print(\"Therefore,heat transferred in process heater in KJ/kg steam generated=\"),round(0.5*(h3-h7),3)\n", + "print(\"so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\")\n", + "print(\"For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\")\n", + "s10=s3;\n", + "print(\"Let dryness fraction be x10\")\n", + "print(\"s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", + "sf=0.5764;\n", + "sfg=7.6750;\n", + "print(\"so x10=(s10-sf)/sfg\")\n", + "x10=(s10-sf)/sfg\n", + "x10=0.754;#approx.\n", + "print(\"h10=hf at 0.075 bar+x10*hfg at 0.075 bar\")\n", + "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", + "hf=168.79;\n", + "hfg=2406.0;\n", + "print(\"so h10=hf+x10*hfg in KJ/kg \")\n", + "h10=hf+x10*hfg \n", + "print(\"net work output,neglecting pump work per kg of steam generated,\")\n", + "print(\"w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\")\n", + "w_net=(h2-h3)*1+0.4315*(h3-h10) \n", + "q_add=(h2-4.18*68.425)\n", + "print(\"Heat added in boiler per kg steam generated,q_add in KJ/kg=\"),round(q_add,2)\n", + "w_net/q_add\n", + "print(\"thermal efficiency=w_net/q_add\"),round(w_net/q_add,2)\n", + "print(\"in percentage\"),round(w_net*100/q_add,2)\n", + "print(\"so Thermal efficiency=27.58%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.16;pg no: 291" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.16, Page:291 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\n", + "from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\n", + "Assuming isentropic expansion in nozzle,s1=s2=6.9486\n", + "Letdryness fraction at state 2,x2=0.864\n", + "s2=sf at 0.2 bar+x2*sfg at 0.2 bar\n", + "from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\n", + "so x2= 0.86\n", + "hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\n", + "from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\n", + "considering pump work to be of isentropic type,deltah_34=v3*deltap_34\n", + "from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\n", + "or deltah_34 in KJ/kg= 7.1\n", + "pump work,Wp in KJ/kg= 7.1\n", + "turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\n", + "net work(W_net)=Wt-Wp in KJ/kg\n", + "power produced(P)=mass flow rate*W_net in KJ/s\n", + "so net power=43.22 MW\n", + "heat supplied in boiler(Q)=(h1-h4) in KJ/kg\n", + "enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\n", + "total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s 114534.05\n", + "thermal efficiency=net work/heat supplied=W_net/Q 0.38\n", + "in percentage 37.73\n", + "so thermal efficiency=37.73%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,net power\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.16, Page:291 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\")\n", + "m=35;#mass flow rate in kg/s\n", + "print(\"from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\")\n", + "h1=3530.9;\n", + "s1=6.9486;\n", + "print(\"Assuming isentropic expansion in nozzle,s1=s2=6.9486\")\n", + "s2=s1;\n", + "print(\"Letdryness fraction at state 2,x2=0.864\")\n", + "print(\"s2=sf at 0.2 bar+x2*sfg at 0.2 bar\")\n", + "print(\"from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\")\n", + "sf=0.8320;\n", + "sfg=7.0766;\n", + "x2=(s2-sf)/sfg\n", + "print(\"so x2=\"),round(x2,2)\n", + "x2=0.864;#approx.\n", + "print(\"hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\")\n", + "print(\"from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\")\n", + "hf=251.4;\n", + "hfg=2358.3;\n", + "h2=hf+x2*hfg\n", + "print(\"considering pump work to be of isentropic type,deltah_34=v3*deltap_34\")\n", + "print(\"from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\")\n", + "v3=0.001017;\n", + "p3=70;#;pressure of steam entering turbine in bar\n", + "p4=0.20;#condenser pressure in bar\n", + "deltah_34=v3*(p3-p4)*100\n", + "print(\"or deltah_34 in KJ/kg=\"),round(deltah_34,2)\n", + "Wp=deltah_34\n", + "print(\"pump work,Wp in KJ/kg=\"),round(Wp,2)\n", + "print(\"turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\")\n", + "Wt=(h1-h2)\n", + "print(\"net work(W_net)=Wt-Wp in KJ/kg\")\n", + "W_net=Wt-Wp\n", + "print(\"power produced(P)=mass flow rate*W_net in KJ/s\")\n", + "P=m*W_net\n", + "print(\"so net power=43.22 MW\")\n", + "print(\"heat supplied in boiler(Q)=(h1-h4) in KJ/kg\")\n", + "print(\"enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\")\n", + "h3=hf;\n", + "h4=h3+deltah_34 \n", + "Q=m*(h1-h4)\n", + "print(\"total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s\"),round(Q,2)\n", + "print(\"thermal efficiency=net work/heat supplied=W_net/Q\"),round(P/Q,2)\n", + "print(\"in percentage\"),round(P*100/Q,2)\n", + "print(\"so thermal efficiency=37.73%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 8.17;pg no: 292" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 8.1, Page:292 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 17\n", + "from steam tables,h1=3625.3 KJ/s,s1=6.9029 KJ/kg K\n", + "due to isentropic expansion,s1=s2=s3=6.9029 KJ/kg K\n", + "at state 2,i.e at pressure of 2 MPa and entropy 6.9029 KJ/kg K\n", + "by interpolating state for s2 between 2 MPa,300 degree celcius and 2 MPa,350 degree celcius from steam tables,\n", + "h2=3105.08 KJ/kg \n", + "for state 3,i.e at pressure of 0.01 MPa entropy,s3 lies in wet region as s3In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,mass of steam\n", + "#intiation of all variables\n", + "# Chapter 8\n", + "print\"Example 8.18, Page:294 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 18\")\n", + "W_net=50*10**3;#net output of turbine in KW\n", + "print(\"from steam tables,at inlet to first stage of turbine,h1=h at 100 bar,500oc=3373.7 KJ/kg,s1=s at 100 bar,500oc=6.5966 KJ/kg\")\n", + "h1=3373.7;\n", + "s1=6.5966;\n", + "print(\"Due to isentropic expansion,s1=s6=s2 and s3=s8=s4\")\n", + "s2=s1;\n", + "s6=s2;\n", + "print(\"State at 6 i.e bleed state from HP turbine,temperature by interpolation from steam table =261.6oc.\")\n", + "print(\"At inlet to second stage of turbine,h6=2930.572 KJ/kg\")\n", + "h6=2930.572;\n", + "print(\"h3=h at 10 bar,500oc=3478.5 KJ/kg,s3=s at 10 bar,500oc=7.7622 KJ/kg K\")\n", + "h3=3478.5;\n", + "s3=7.7622;\n", + "s4=s3;\n", + "s8=s4;\n", + "print(\"At exit from first stage of turbine i.e. at 10 bar and entropy of 6.5966 KJ/kg K,Temperature by interpolation from steam table at 10 bar and entropy of 6.5966 KJ/kg K\")\n", + "print(\"T2=181.8oc,h2=2782.8 KJ/kg\")\n", + "T2=181.8;\n", + "h2=2782.8;\n", + "print(\"state at 8,i.e bleed state from second stage of expansion,i.e at 4 bar and entropy of 7.7622 KJ/kg K,Temperature by interpolation from steam table,T8=358.98oc=359oc\")\n", + "T8=359;\n", + "print(\"h8=3188.7 KJ/kg\")\n", + "h8=3188.7;\n", + "print(\"state at 4 i.e. at condenser pressure of 0.1 bar and entropy of 7.7622 KJ/kg K,the state lies in wet region.So let the dryness fraction be x4.\")\n", + "print(\"s4=sf at 0.1 bar+x4*sfg at 0.1 bar\")\n", + "print(\"from steam tables,at 0.1 bar,sf=0.6493 KJ/kg K,sfg=7.5009 KJ/kg K\")\n", + "sf=0.6493;\n", + "sfg=7.5009; \n", + "x4=(s4-sf)/sfg\n", + "print(\"so x4=\"),round(x4,2)\n", + "x4=0.95;#approx.\n", + "print(\"h4=hf at 0.1 bar+x4*hfg at 0.1 bar in KJ/kg \")\n", + "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,hfg=2392.8 KJ/kg\")\n", + "hf=191.83;\n", + "hfg=2392.8;\n", + "h4=hf+x4*hfg\n", + "print(\"given,h4=2464.99 KJ/kg,h11=856.8 KJ/kg,h9=hf at 4 bar=604.74 KJ/kg\")\n", + "h4=2464.99;\n", + "h11=856.8;\n", + "h9=604.74;\n", + "print(\"considering pump work,the net output can be given as,\")\n", + "print(\"W_net=W_HPT+W_LPT-(W_CEP+W_FP)\")\n", + "print(\"where,W_HPT={(h1-h6)+(1-m6)*(h6-h2)}per kg of steam from boiler.\")\n", + "print(\"W_LPT={(1-m6)+(h3-h8)*(1-m6-m8)*(h8-h4)}per kg of steam from boiler.\")\n", + "print(\"for closed feed water heater,energy balance yields;\")\n", + "print(\"m6*h6+h10=m6*h7+h11\")\n", + "print(\"assuming condensate leaving closed feed water heater to be saturated liquid,\")\n", + "print(\"h7=hf at 20 bar=908.79 KJ/kg\")\n", + "h7=908.79; \n", + "print(\"due to throttline,h7=h7_a=908.79 KJ/kg\")\n", + "h7_a=h7;\n", + "print(\"for open feed water heater,energy balance yields,\")\n", + "print(\"m6*h7_a+m8*h8+(1-m6-m8)*h5=h9\")\n", + "print(\"for condensate extraction pump,h5-h4_a=v4_a*deltap\")\n", + "print(\"h5-hf at 0.1 bar=vf at 0.1 bar*(4-0.1)*10^2 \")\n", + "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,vf=0.001010 m^3/kg\")\n", + "hf=191.83;\n", + "vf=0.001010; \n", + "h5=hf+vf*(4-0.1)*10**2\n", + "print(\"so h5 in KJ/kg=\"),round(h5,2)\n", + "print(\"for feed pump,h10-h9=v9*deltap\")\n", + "print(\"h10=h9+vf at 4 bar*(100-4)*10^2 in KJ/kg\")\n", + "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,vf=0.001084 m^3/kg \")\n", + "hf=604.74;\n", + "vf=0.001084;\n", + "h10=h9+vf*(100-4)*10**2\n", + "print(\"substituting in energy balance upon closed feed water heater,\")\n", + "m6=(h11-h10)/(h6-h7)\n", + "print(\"m6 in kg per kg of steam from boiler=\"),round(m6,3)\n", + "print(\"substituting in energy balance upon feed water heater,\")\n", + "m8=(h9-m6*h7_a+m6*h5-h5)/(h8-h5)\n", + "print(\"m8 in kg per kg of steam from boiler=\"),round(m8,3)\n", + "print(\"Let the mass of steam entering first stage of turbine be m kg,then\")\n", + "{(h1-h6)+(1-m6)*(h6-h2)}\n", + "print(\"W_HPT=m*{(h1-h6)+(1-m6)*(h6-h2)}\")\n", + "print(\"W_HPT/m=\"),round(((h1-h6)+(1-m6)*(h6-h2)),2)\n", + "print(\"so W_HPT=m*573.24 KJ\")\n", + "print(\"also,W_LPT={(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}per kg of steam from boiler\")\n", + "{(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}\n", + "print(\"W_LPT/m=\"),round(((1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)),2)\n", + "print(\"so W_LPT=m*813.42 KJ\")\n", + "print(\"pump works(negative work)\")\n", + "print(\"W_CEP=m*(1-m6-m8)*(h5-h4_a)\")\n", + "h4_a=191.83;#h4_a=hf at 0.1 bar\n", + "print(\"W_CEP/m=\")\n", + "(1-m6-m8)*(h5-h4_a)\n", + "print(\"so W_CEP=m* 0.304\")\n", + "print(\"W_FP=m*(h10-h9)\")\n", + "print(\"W_FP/m=\"),round((h10-h9),2)\n", + "print(\"so W_FP=m*10.41\")\n", + "print(\"net output,\")\n", + "print(\"W_net=W_HPT+W_LPT-W_CEP-W_FP \")\n", + "print(\"so 50*10^3=(573.24*m+813.42*m-0.304*m-10.41*m)\")\n", + "m=W_net/(573.24+813.42-0.304-10.41)\n", + "print(\"so m in kg/s=\"),round(m,2)\n", + "Q_add=m*(h1-h11)\n", + "print(\"heat supplied in boiler,Q_add in KJ/s=\"),round(m*(h1-h11),2)\n", + "print(\"Thermal efficenncy=\"),round(W_net/Q_add,2)\n", + "print(\"in percentage\"),round(W_net*100/Q_add,2)\n", + "print(\"so mass of steam bled at 20 bar=0.119 kg per kg of steam entering first stage\")\n", + "print(\"mass of steam bled at 4 bar=0.109 kg per kg of steam entering first stage\")\n", + "print(\"mass of steam entering first stage=36.33 kg/s\")\n", + "print(\"thermal efficiency=54.66%\")\n", + "print(\"NOTE=>In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter9.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter9.ipynb new file mode 100755 index 00000000..606321b3 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter9.ipynb @@ -0,0 +1,1655 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 9:Gas Power Cycles" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.1;pg no: 334" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.1, Page:334 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\n", + "SI engine operate on otto cycle.consider working fluid to be perfect gas.\n", + "here,y=Cp/Cv\n", + "Cp-Cv=R in KJ/kg K\n", + "compression ratio,r=V1/V2=(0.15+V2)/V2\n", + "so V2=0.15/(r-1) in m^3\n", + "so V2=0.03 m^3\n", + "total cylinder volume=V1=r*V2 m^3\n", + "from perfect gas law,P*V=m*R*T\n", + "so m=P1*V1/(R*T1) in kg\n", + "from state 1 to 2 by P*V^y=P2*V2^y\n", + "so P2=P1*(V1/V2)^y in KPa\n", + "also,P1*V1/T1=P2*V2/T2\n", + "so T2=P2*V2*T1/(P1*V1)in K\n", + "from heat addition process 2-3\n", + "Q23=m*CV*(T3-T2)\n", + "T3=T2+(Q23/(m*Cv))in K\n", + "also from,P3*V3/T3=P2*V2/T2\n", + "P3=P2*V2*T3/(V3*T2) in KPa\n", + "for adiabatic expansion 3-4,\n", + "P3*V3^y=P4*V4^y\n", + "and V4=V1\n", + "hence,P4=P3*V3^y/V1^y in KPa\n", + "and from P3*V3/T3=P4*V4/T4\n", + "T4=P4*V4*T3/(P3*V3) in K\n", + "entropy change from 2-3 and 4-1 are same,and can be given as,\n", + "S3-S2=S4-S1=m*Cv*log(T4/T1)\n", + "so entropy change,deltaS_32=deltaS_41 in KJ/K\n", + "heat rejected,Q41=m*Cv*(T4-T1) in KJ\n", + "net work(W) in KJ= 76.75\n", + "efficiency(n)= 0.51\n", + "in percentage 51.16\n", + "mean effective pressure(mep)=work/volume change in KPa= 511.64\n", + "so mep=511.67 KPa\n" + ] + } + ], + "source": [ + "#cal of mean effective pressure\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.1, Page:334 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\")\n", + "Cp=1;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", + "P1=98;#pressure at begining of compression in KPa\n", + "T1=(60+273.15);#temperature at begining of compression in K\n", + "Q23=150;#heat supplied in KJ/kg\n", + "r=6;#compression ratio\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"SI engine operate on otto cycle.consider working fluid to be perfect gas.\")\n", + "print(\"here,y=Cp/Cv\")\n", + "y=Cp/Cv\n", + "y=1.4;#approx.\n", + "print(\"Cp-Cv=R in KJ/kg K\")\n", + "R=Cp-Cv\n", + "print(\"compression ratio,r=V1/V2=(0.15+V2)/V2\")\n", + "print(\"so V2=0.15/(r-1) in m^3\")\n", + "V2=0.15/(r-1)\n", + "print(\"so V2=0.03 m^3\")\n", + "print(\"total cylinder volume=V1=r*V2 m^3\")\n", + "V1=r*V2\n", + "print(\"from perfect gas law,P*V=m*R*T\")\n", + "print(\"so m=P1*V1/(R*T1) in kg\")\n", + "m=P1*V1/(R*T1)\n", + "m=0.183;#approx.\n", + "print(\"from state 1 to 2 by P*V^y=P2*V2^y\")\n", + "print(\"so P2=P1*(V1/V2)^y in KPa\")\n", + "P2=P1*(V1/V2)**y\n", + "print(\"also,P1*V1/T1=P2*V2/T2\")\n", + "print(\"so T2=P2*V2*T1/(P1*V1)in K\")\n", + "T2=P2*V2*T1/(P1*V1)\n", + "print(\"from heat addition process 2-3\")\n", + "print(\"Q23=m*CV*(T3-T2)\")\n", + "print(\"T3=T2+(Q23/(m*Cv))in K\")\n", + "T3=T2+(Q23/(m*Cv))\n", + "print(\"also from,P3*V3/T3=P2*V2/T2\")\n", + "print(\"P3=P2*V2*T3/(V3*T2) in KPa\")\n", + "V3=V2;#constant volume process\n", + "P3=P2*V2*T3/(V3*T2) \n", + "print(\"for adiabatic expansion 3-4,\")\n", + "print(\"P3*V3^y=P4*V4^y\")\n", + "print(\"and V4=V1\")\n", + "V4=V1;\n", + "print(\"hence,P4=P3*V3^y/V1^y in KPa\")\n", + "P4=P3*V3**y/V1**y\n", + "print(\"and from P3*V3/T3=P4*V4/T4\")\n", + "print(\"T4=P4*V4*T3/(P3*V3) in K\")\n", + "T4=P4*V4*T3/(P3*V3)\n", + "print(\"entropy change from 2-3 and 4-1 are same,and can be given as,\")\n", + "print(\"S3-S2=S4-S1=m*Cv*log(T4/T1)\")\n", + "print(\"so entropy change,deltaS_32=deltaS_41 in KJ/K\")\n", + "deltaS_32=m*Cv*math.log(T4/T1)\n", + "deltaS_41=deltaS_32;\n", + "print(\"heat rejected,Q41=m*Cv*(T4-T1) in KJ\")\n", + "Q41=m*Cv*(T4-T1)\n", + "W=Q23-Q41\n", + "print(\"net work(W) in KJ=\"),round(W,2)\n", + "n=W/Q23\n", + "print(\"efficiency(n)=\"),round(W/Q23,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "mep=W/0.15\n", + "print(\"mean effective pressure(mep)=work/volume change in KPa=\"),round(W/0.15,2)\n", + "print(\"so mep=511.67 KPa\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.2;pg no: 336" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.2, Page:336 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\n", + "as given\n", + "Va=V2+(7/8)*(V1-V2)\n", + "Vb=V2+(1/8)*(V1-V2)\n", + "and also\n", + "Pa*Va^y=Pb*Vb^y\n", + "so (Va/Vb)=(Pb/Pa)^(1/y)\n", + "also substituting for Va and Vb\n", + "(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\n", + "so V1/V2=r=1+(4.18*8/1.82) 19.37\n", + "it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\n", + "as given;cut off occurs at(V1-V2)/15 volume\n", + "V3=V2+(V1-V2)/15\n", + "cut off ratio,rho=V3/V2\n", + "air standard efficiency for diesel cycle(n_airstandard)= 0.63\n", + "in percentage 63.23\n", + "overall efficiency(n_overall)=n_airstandard*n_ite*n_mech 0.253\n", + "in percentage 25.3\n", + "fuel consumption,bhp/hr in kg= 0.26\n", + "so compression ratio=19.37\n", + "air standard efficiency=63.25%\n", + "fuel consumption,bhp/hr=0.255 kg\n" + ] + } + ], + "source": [ + "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.2, Page:336 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\")\n", + "Pa=138;#pressure during compression at 1/8 of stroke in KPa\n", + "Pb=1.38*10**3;#pressure during compression at 7/8 of stroke in KPa\n", + "n_ite=0.5;#indicated thermal efficiency\n", + "n_mech=0.8;#mechanical efficiency\n", + "C=41800;#calorific value in KJ/kg\n", + "y=1.4;#expansion constant\n", + "print(\"as given\")\n", + "print(\"Va=V2+(7/8)*(V1-V2)\")\n", + "print(\"Vb=V2+(1/8)*(V1-V2)\")\n", + "print(\"and also\")\n", + "print(\"Pa*Va^y=Pb*Vb^y\")\n", + "print(\"so (Va/Vb)=(Pb/Pa)^(1/y)\")\n", + "(Pb/Pa)**(1/y)\n", + "print(\"also substituting for Va and Vb\")\n", + "print(\"(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\")\n", + "r=1+(4.18*8/1.82)\n", + "print(\"so V1/V2=r=1+(4.18*8/1.82)\"),round(r,2)\n", + "print(\"it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\")\n", + "print(\"as given;cut off occurs at(V1-V2)/15 volume\")\n", + "print(\"V3=V2+(V1-V2)/15\")\n", + "print(\"cut off ratio,rho=V3/V2\")\n", + "rho=1+(r-1)/15\n", + "n_airstandard=1-(1/(r**(y-1)*y))*((rho**y-1)/(rho-1))\n", + "print(\"air standard efficiency for diesel cycle(n_airstandard)=\"),round(n_airstandard,2)\n", + "print(\"in percentage\"),round(n_airstandard*100,2)\n", + "n_airstandard=0.6325;\n", + "n_overall=n_airstandard*n_ite*n_mech\n", + "print(\"overall efficiency(n_overall)=n_airstandard*n_ite*n_mech\"),round(n_overall,3)\n", + "print(\"in percentage\"),round(n_overall*100,2)\n", + "n_overall=0.253;\n", + "75*60*60/(n_overall*C*100)\n", + "print(\"fuel consumption,bhp/hr in kg=\"),round(75*60*60/(n_overall*C*100),2)\n", + "print(\"so compression ratio=19.37\")\n", + "print(\"air standard efficiency=63.25%\")\n", + "print(\"fuel consumption,bhp/hr=0.255 kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.3;pg no: 338" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.3, Page:338 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\n", + "1-2-3-4=cycle a\n", + "1-2_a-3_a-4_a-5=cycle b\n", + "here Cp/Cv=y\n", + "and R=0.293 KJ/kg K\n", + "let us consider 1 kg of air for perfect gas,\n", + "P*V=m*R*T\n", + "so V1=m*R*T1/P1 in m^3\n", + "at state 3,\n", + "P3*V3=m*R*T3\n", + "so T3/V2=P3/(m*R)\n", + "so T3=17064.8*V2............eq1\n", + "for cycle a and also for cycle b\n", + "T3_a=17064.8*V2_a.............eq2\n", + "a> for otto cycle,\n", + "Q23=Cv*(T3-T2)\n", + "so T3-T2=Q23/Cv\n", + "and T2=T3-2394.36.............eq3\n", + "from gas law,P2*V2/T2=P3*V3/T3\n", + "here V2=V3 and using eq 3,we get\n", + "so P2/(T3-2394.36)=5000/T3\n", + "substituting T3 as function of V2\n", + "P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\n", + "P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\n", + "also P1*V1^y=P2*V2^y\n", + "or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\n", + "upon solving it yields\n", + "381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\n", + "or V2^1.4-0.140*V2^0.4-.022=0\n", + "by hit and trial it yields,V2=0.18 \n", + "thus compression ratio,r=V1/V2\n", + "otto cycle efficiency,n_otto=1-(1/r)^(y-1)\n", + "in percentage\n", + "b> for mixed or dual cycle\n", + "Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\n", + "or T3_a-T2_a=850/Cv\n", + "or T2_a=T3_a-1197.2 .............eq4 \n", + "also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\n", + "P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\n", + "or P2_a/(T3_a-1197.2)=5000/T3_a\n", + "also we had seen earlier that T3_a=17064.8*V2_a\n", + "so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\n", + "so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\n", + "or for adiabatic process,1-2_a\n", + "P1*V1^y=P2*V2^y\n", + "so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\n", + "or V2_a^1.4-0.07*V2_a^0.4-0.022=0\n", + "by hit and trial \n", + "V2_a=0.122 m^3\n", + "therefore upon substituting V2_a,\n", + "by eq 5,P2_a in KPa\n", + "by eq 2,T3_a in K\n", + "by eq 4,T2_a in K\n", + "from constant pressure heat addition\n", + "Cp*(T4_a-T3_a)=850\n", + "so T4_a=T3_a+(850/Cp) in K\n", + "also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\n", + "so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \n", + "here P3_a=P4_a and V2_a=V3_a\n", + "using adiabatic formulations V4_a=0.172 m^3\n", + "(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\n", + "so T5=T4_a/(V5/V4_a)^(y-1) in K\n", + "heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\n", + "efficiency of mixed cycle(n_mixed)= 0.57\n", + "in percentage 56.55\n" + ] + }, + { + "data": { + "text/plain": [ + "'NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.'" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#cal of comparing efficiency of two cycles\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.3, Page:338 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\")\n", + "T1=(100+273.15);#temperature at beginning of compresssion in K\n", + "P1=103;#pressure at beginning of compresssion in KPa\n", + "Cp=1.003;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", + "Q23=1700;#heat added during combustion in KJ/kg\n", + "P3=5000;#maximum pressure in cylinder in KPa\n", + "print(\"1-2-3-4=cycle a\")\n", + "print(\"1-2_a-3_a-4_a-5=cycle b\")\n", + "print(\"here Cp/Cv=y\")\n", + "y=Cp/Cv\n", + "y=1.4;#approx.\n", + "print(\"and R=0.293 KJ/kg K\")\n", + "R=0.293;\n", + "print(\"let us consider 1 kg of air for perfect gas,\")\n", + "m=1;#mass of air in kg\n", + "print(\"P*V=m*R*T\")\n", + "print(\"so V1=m*R*T1/P1 in m^3\")\n", + "V1=m*R*T1/P1\n", + "print(\"at state 3,\")\n", + "print(\"P3*V3=m*R*T3\")\n", + "print(\"so T3/V2=P3/(m*R)\")\n", + "P3/(m*R)\n", + "print(\"so T3=17064.8*V2............eq1\")\n", + "print(\"for cycle a and also for cycle b\")\n", + "print(\"T3_a=17064.8*V2_a.............eq2\")\n", + "print(\"a> for otto cycle,\")\n", + "print(\"Q23=Cv*(T3-T2)\")\n", + "print(\"so T3-T2=Q23/Cv\")\n", + "Q23/Cv\n", + "print(\"and T2=T3-2394.36.............eq3\")\n", + "print(\"from gas law,P2*V2/T2=P3*V3/T3\")\n", + "print(\"here V2=V3 and using eq 3,we get\")\n", + "print(\"so P2/(T3-2394.36)=5000/T3\")\n", + "print(\"substituting T3 as function of V2\")\n", + "print(\"P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\")\n", + "print(\"P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\")\n", + "print(\"also P1*V1^y=P2*V2^y\")\n", + "print(\"or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\")\n", + "print(\"upon solving it yields\")\n", + "print(\"381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\")\n", + "print(\"or V2^1.4-0.140*V2^0.4-.022=0\")\n", + "print(\"by hit and trial it yields,V2=0.18 \")\n", + "V2=0.18;\n", + "print(\"thus compression ratio,r=V1/V2\")\n", + "r=V1/V2\n", + "print(\"otto cycle efficiency,n_otto=1-(1/r)^(y-1)\")\n", + "n_otto=1-(1/r)**(y-1)\n", + "print(\"in percentage\")\n", + "n_otto=n_otto*100\n", + "print(\"b> for mixed or dual cycle\")\n", + "print(\"Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\")\n", + "print(\"or T3_a-T2_a=850/Cv\")\n", + "850/Cv\n", + "print(\"or T2_a=T3_a-1197.2 .............eq4 \")\n", + "print(\"also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\")\n", + "print(\"P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\")\n", + "print(\"or P2_a/(T3_a-1197.2)=5000/T3_a\")\n", + "print(\"also we had seen earlier that T3_a=17064.8*V2_a\")\n", + "print(\"so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\")\n", + "print(\"so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\")\n", + "print(\"or for adiabatic process,1-2_a\")\n", + "print(\"P1*V1^y=P2*V2^y\")\n", + "print(\"so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\")\n", + "print(\"or V2_a^1.4-0.07*V2_a^0.4-0.022=0\")\n", + "print(\"by hit and trial \")\n", + "print(\"V2_a=0.122 m^3\")\n", + "V2_a=0.122;\n", + "print(\"therefore upon substituting V2_a,\")\n", + "print(\"by eq 5,P2_a in KPa\")\n", + "P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a)\n", + "print(\"by eq 2,T3_a in K\")\n", + "T3_a=17064.8*V2_a\n", + "print(\"by eq 4,T2_a in K\")\n", + "T2_a=T3_a-1197.2\n", + "print(\"from constant pressure heat addition\")\n", + "print(\"Cp*(T4_a-T3_a)=850\")\n", + "print(\"so T4_a=T3_a+(850/Cp) in K\")\n", + "T4_a=T3_a+(850/Cp)\n", + "print(\"also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\")\n", + "print(\"so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \")\n", + "print(\"here P3_a=P4_a and V2_a=V3_a\")\n", + "V4_a=V2_a*T4_a/(T3_a)\n", + "print(\"using adiabatic formulations V4_a=0.172 m^3\")\n", + "print(\"(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\")\n", + "V5=V1;\n", + "print(\"so T5=T4_a/(V5/V4_a)^(y-1) in K\")\n", + "T5=T4_a/(V5/V4_a)**(y-1)\n", + "print(\"heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\")\n", + "Q51=Cv*(T5-T1)\n", + "n_mixed=(Q23-Q51)/Q23\n", + "print(\"efficiency of mixed cycle(n_mixed)=\"),round(n_mixed,2)\n", + "print(\"in percentage\"),round(n_mixed*100,2)\n", + "(\"NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.4;pg no: 341" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.4, Page:341 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\n", + "optimum pressure ratio for maximum work output,\n", + "rp=(T_max/T_min)^((y)/(2*(y-1)))\n", + "so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\n", + "so T2=T1*(p2/p1)^((y-1)/y)in K\n", + "For process 3-4,\n", + "T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\n", + "so T4=T3/(rp)^((y-1)/y)in K\n", + "heat supplied,Q23=Cp*(T3-T2)in KJ/kg\n", + "compressor work,Wc in KJ/kg= 301.5\n", + "turbine work,Wt in KJ/kg= 603.0\n", + "thermal efficiency=net work/heat supplied= 0.5\n", + "so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,turbine and compressor work\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.4, Page:341 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\")\n", + "T3=1200;#maximum temperature in K\n", + "T1=300;#minimum temperature in K\n", + "y=1.4;#expansion constant\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"optimum pressure ratio for maximum work output,\")\n", + "print(\"rp=(T_max/T_min)^((y)/(2*(y-1)))\")\n", + "T_max=T3;\n", + "T_min=T1;\n", + "rp=(T_max/T_min)**((y)/(2*(y-1)))\n", + "print(\"so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\")\n", + "print(\"so T2=T1*(p2/p1)^((y-1)/y)in K\")\n", + "T2=T1*(rp)**((y-1)/y)\n", + "print(\"For process 3-4,\")\n", + "print(\"T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\")\n", + "print(\"so T4=T3/(rp)^((y-1)/y)in K\")\n", + "T4=T3/(rp)**((y-1)/y)\n", + "print(\"heat supplied,Q23=Cp*(T3-T2)in KJ/kg\")\n", + "Q23=Cp*(T3-T2)\n", + "Wc=Cp*(T2-T1)\n", + "print(\"compressor work,Wc in KJ/kg=\"),round(Wc,2)\n", + "Wt=Cp*(T3-T4)\n", + "print(\"turbine work,Wt in KJ/kg=\"),round(Wt,2)\n", + "(Wt-Wc)/Q23\n", + "print(\"thermal efficiency=net work/heat supplied=\"),round((Wt-Wc)/Q23,2)\n", + "print(\"so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.5;pg no: 342" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.5, Page:342 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\n", + "gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\n", + "for process 1-2 being isentropic,\n", + "T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y) in K\n", + "considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\n", + "so T2_a=T1+((T2-T1)/n_compr)in K\n", + "during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\n", + "heat added=mf*q\n", + "=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\n", + "or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\n", + "so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\n", + "for expansion 3-4 being\n", + "T4/T3=(P4/P3)^((n-1)/n)\n", + "so T4=T3*(P4/P3)^((n-1)/n) in K\n", + "actaul temperature at turbine inlet considering internal efficiency of turbine,\n", + "n_turb=(T3-T4_a)/(T3-T4)\n", + "so T4_a=T3-(n_turb*(T3-T4)) in K\n", + "compressor work,per kg of air compressed(Wc) in KJ/kg of air= 234.42\n", + "so compressor work=234.42 KJ/kg of air\n", + "turbine work,per kg of air compressed(Wt) in KJ/kg of air= 414.71\n", + "so turbine work=414.71 KJ/kg of air\n", + "net work(W_net) in KJ/kg of air= 180.29\n", + "heat supplied(Q) in KJ/kg of air= 751.16\n", + "thermal efficiency(n)= 0.24\n", + "in percentage 24.0\n", + "so thermal efficiency=24%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,turbine and compressor work\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.5, Page:342 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\")\n", + "P1=1*10**5;#initial pressure in Pa\n", + "P4=P1;#constant pressure process\n", + "T1=300;#initial temperature in K\n", + "P2=6.2*10**5;#pressure after compression in Pa\n", + "P3=P2;#constant pressure process\n", + "k=0.017;#fuel to air ratio\n", + "n_compr=0.88;#compressor efficiency\n", + "q=44186;#heating value of fuel in KJ/kg\n", + "n_turb=0.9;#turbine internal efficiency\n", + "Cp_comb=1.147;#specific heat of combustion at constant pressure in KJ/kg K\n", + "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", + "y=1.4;#expansion constant\n", + "n=1.33;#expansion constant for polytropic constant\n", + "print(\"gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\")\n", + "print(\"for process 1-2 being isentropic,\")\n", + "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", + "T2=T1*(P2/P1)**((y-1)/y)\n", + "print(\"considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\")\n", + "print(\"so T2_a=T1+((T2-T1)/n_compr)in K\")\n", + "T2_a=T1+((T2-T1)/n_compr)\n", + "print(\"during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\")\n", + "print(\"heat added=mf*q\")\n", + "print(\"=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\")\n", + "print(\"or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\")\n", + "print(\"so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\")\n", + "T3=((k)*q+(Cp_air*T2_a))/((1+(k))*Cp_comb)\n", + "print(\"for expansion 3-4 being\")\n", + "print(\"T4/T3=(P4/P3)^((n-1)/n)\")\n", + "print(\"so T4=T3*(P4/P3)^((n-1)/n) in K\")\n", + "T4=T3*(P4/P3)**((n-1)/n)\n", + "print(\"actaul temperature at turbine inlet considering internal efficiency of turbine,\")\n", + "print(\"n_turb=(T3-T4_a)/(T3-T4)\")\n", + "print(\"so T4_a=T3-(n_turb*(T3-T4)) in K\")\n", + "T4_a=T3-(n_turb*(T3-T4))\n", + "Wc=Cp_air*(T2_a-T1)\n", + "print(\"compressor work,per kg of air compressed(Wc) in KJ/kg of air=\"),round(Wc,2)\n", + "print(\"so compressor work=234.42 KJ/kg of air\")\n", + "Wt=Cp_comb*(T3-T4_a)\n", + "print(\"turbine work,per kg of air compressed(Wt) in KJ/kg of air=\"),round(Wt,2)\n", + "print(\"so turbine work=414.71 KJ/kg of air\")\n", + "W_net=Wt-Wc\n", + "print(\"net work(W_net) in KJ/kg of air=\"),round(W_net,2)\n", + "Q=k*q\n", + "print(\"heat supplied(Q) in KJ/kg of air=\"),round(Q,2)\n", + "n=W_net/Q\n", + "print(\"thermal efficiency(n)=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so thermal efficiency=24%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.6;pg no: 343" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.6, Page:343 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\n", + "NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\n", + "overall pressure ratio(rp)= 13.59\n", + "so overall optimum pressure ratio=13.6\n" + ] + } + ], + "source": [ + "#cal of overall optimum pressure ratio\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.6, Page:343 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\")\n", + "T1=300;#minimum temperature in brayton cycle in K\n", + "T5=1200;#maximum temperature in brayton cycle in K\n", + "n_isen_c=0.85;#isentropic efficiency of compressor\n", + "n_isen_t=0.9;#isentropic efficiency of turbine\n", + "y=1.4;#expansion constant\n", + "print(\"NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\")\n", + "rp=(T1/(T5*n_isen_c*n_isen_t))**((2*y)/(3*(1-y)))\n", + "print(\"overall pressure ratio(rp)=\"),round(rp,2)\n", + "print(\"so overall optimum pressure ratio=13.6\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.7;pg no: 346" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.7, Page:346 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\n", + "i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\n", + "therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\n", + "or P9/P1=k=(1.35)^8 11.03\n", + "or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\n", + "T9/T1=(P9/P1)^((y-1)/y)\n", + "so T9 in K= 621.47\n", + "considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\n", + "(T9-T1)/(T9_actual-T1)=0.82\n", + "so T9_actual=T1+((T9-T1)/0.82) in K 689.19\n", + "let the actual index of compression be n, then\n", + "(T9_actual/T1)=(P9/P1)^((n-1)/n)\n", + "so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\n", + "so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\n", + "ii> let polytropic efficiency be n_polytropic for compressor then,\n", + "(n-1)/n=((y-1)/y)*(1/n_polytropic)\n", + "so n_polytropic= 0.87\n", + "in percentage 86.9\n", + "so ploytropic efficiency=86.88%\n", + "iii> stage efficiency can be estimated for any stage.say first stage.\n", + "ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y) in K\n", + "actual temperature at exit of first stage can be estimated using polytropic index 1.49.\n", + "T2_actual/T1=(P2/P1)^((n-1)/n)\n", + "so T2_actual=T1*(P2/P1)^((n-1)/n) in K\n", + "stage efficiency for first stage,ns_1= 0.86\n", + "in percentage 86.33\n", + "actual temperature at exit of second stage,\n", + "T3_actual/T2_actual=(P3/P2)^((n-1)/n)\n", + "so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\n", + "ideal temperature at exit of second stage\n", + "T3/T2_actual=(P3/P2)^((n-1)/n)\n", + "so T3=T2_actual*(P3/P2)^((y-1)/y) in K\n", + "stage efficiency for second stage,ns_2= 0.86\n", + "in percentage 86.33\n", + "actual rtemperature at exit of third stage,\n", + "T4_actual/T3_actual=(P4/P3)^((n-1)/n)\n", + "so T4_actual in K= 420.83\n", + "ideal temperature at exit of third stage,\n", + "T4/T3_actual=(P4/P3)^((n-1)/n)\n", + "so T4 in K= 415.42\n", + "stage efficiency for third stage,ns_3= 0.86\n", + "in percentage= 8632.9\n", + "so stage efficiency=86.4%\n", + "iv> from steady flow energy equation,\n", + "Wc=dw=dh and dh=du+p*dv+v*dp\n", + "dh=dq+v*dp\n", + "dq=0 in adiabatic process\n", + "dh=v*dp\n", + "Wc=v*dp\n", + "here for polytropic compression \n", + "P*V^1.49=constant i.e n=1.49\n", + "Wc in KJ/s= 16419.87\n", + "due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s= 14777.89\n", + "so power required to drive compressor =14777.89 KJ/s\n" + ] + } + ], + "source": [ + "#cal of state of air at exit of compressor,polytropic efficiency,efficiency of each sate,power\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.7, Page:346 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\")\n", + "T1=313.;#air entering temperature in K\n", + "P1=1*10**5;#air entering pressure in Pa\n", + "m=50.;#flow rate through compressor in kg/s\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\")\n", + "print(\"therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\")\n", + "r=1.35;#compression ratio\n", + "k=(1.35)**8\n", + "print(\"or P9/P1=k=(1.35)^8\"),round(k,2)\n", + "k=11.03;#approx.\n", + "print(\"or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\")\n", + "y=1.4;#expansion constant \n", + "print(\"T9/T1=(P9/P1)^((y-1)/y)\")\n", + "T9=T1*(k)**((y-1)/y)\n", + "print(\"so T9 in K=\"),round(T9,2)\n", + "print(\"considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\")\n", + "print(\"(T9-T1)/(T9_actual-T1)=0.82\")\n", + "T9_actual=T1+((T9-T1)/0.82)\n", + "print(\"so T9_actual=T1+((T9-T1)/0.82) in K\"),round(T9_actual,2)\n", + "print(\"let the actual index of compression be n, then\")\n", + "print(\"(T9_actual/T1)=(P9/P1)^((n-1)/n)\")\n", + "print(\"so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\")\n", + "n=math.log(k)/(math.log(k)-math.log(T9_actual/T1))\n", + "print(\"so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\")\n", + "print(\"ii> let polytropic efficiency be n_polytropic for compressor then,\")\n", + "print(\"(n-1)/n=((y-1)/y)*(1/n_polytropic)\")\n", + "n_polytropic=((y-1)/y)/((n-1)/n)\n", + "print(\"so n_polytropic=\"),round(n_polytropic,2)\n", + "print(\"in percentage\"),round(n_polytropic*100,2)\n", + "print(\"so ploytropic efficiency=86.88%\")\n", + "print(\"iii> stage efficiency can be estimated for any stage.say first stage.\")\n", + "print(\"ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", + "T2=T1*(r)**((y-1)/y)\n", + "print(\"actual temperature at exit of first stage can be estimated using polytropic index 1.49.\")\n", + "print(\"T2_actual/T1=(P2/P1)^((n-1)/n)\")\n", + "print(\"so T2_actual=T1*(P2/P1)^((n-1)/n) in K\")\n", + "T2_actual=T1*(r)**((n-1)/n)\n", + "ns_1=(T2-T1)/(T2_actual-T1)\n", + "print(\"stage efficiency for first stage,ns_1=\"),round(ns_1,2)\n", + "print(\"in percentage\"),round(ns_1*100,2)\n", + "print(\"actual temperature at exit of second stage,\")\n", + "print(\"T3_actual/T2_actual=(P3/P2)^((n-1)/n)\")\n", + "print(\"so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\")\n", + "T3_actual=T2_actual*(r)**((n-1)/n)\n", + "print(\"ideal temperature at exit of second stage\")\n", + "print(\"T3/T2_actual=(P3/P2)^((n-1)/n)\")\n", + "print(\"so T3=T2_actual*(P3/P2)^((y-1)/y) in K\")\n", + "T3=T2_actual*(r)**((y-1)/y)\n", + "ns_2=(T3-T2_actual)/(T3_actual-T2_actual)\n", + "print(\"stage efficiency for second stage,ns_2=\"),round(ns_2,2)\n", + "print(\"in percentage\"),round(ns_2*100,2)\n", + "print(\"actual rtemperature at exit of third stage,\")\n", + "print(\"T4_actual/T3_actual=(P4/P3)^((n-1)/n)\")\n", + "T4_actual=T3_actual*(r)**((n-1)/n)\n", + "print(\"so T4_actual in K=\"),round(T4_actual,2)\n", + "print(\"ideal temperature at exit of third stage,\")\n", + "print(\"T4/T3_actual=(P4/P3)^((n-1)/n)\")\n", + "T4=T3_actual*(r)**((y-1)/y)\n", + "print(\"so T4 in K=\"),round(T4,2)\n", + "ns_3=(T4-T3_actual)/(T4_actual-T3_actual)\n", + "print(\"stage efficiency for third stage,ns_3=\"),round(ns_3,2)\n", + "ns_3=ns_3*100\n", + "print(\"in percentage=\"),round(ns_3*100,2)\n", + "print(\"so stage efficiency=86.4%\")\n", + "print(\"iv> from steady flow energy equation,\")\n", + "print(\"Wc=dw=dh and dh=du+p*dv+v*dp\")\n", + "print(\"dh=dq+v*dp\")\n", + "print(\"dq=0 in adiabatic process\")\n", + "print(\"dh=v*dp\")\n", + "print(\"Wc=v*dp\")\n", + "print(\"here for polytropic compression \")\n", + "print(\"P*V^1.49=constant i.e n=1.49\")\n", + "n=1.49;\n", + "Wc=(n/(n-1))*m*R*T1*(((k)**((n-1)/n))-1)\n", + "print(\"Wc in KJ/s=\"),round(Wc,2)\n", + "Wc_actual=Wc*0.9\n", + "print(\"due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s=\"),round(Wc*0.9,2)\n", + "print(\"so power required to drive compressor =14777.89 KJ/s\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.8;pg no: 349" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.8, Page:349 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\n", + "In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.8, Page:349 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\")\n", + "print(\"In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.9;pg no: 350" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.9, Page:350 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\n", + "using polytropic efficiency the index of compression and expansion can be obtained as under,\n", + "let compression index be nc,\n", + "(nc-1)/nc=(y-1)/(y*n_poly_c)\n", + "so nc=1/(1-((y-1)/(y*n_poly_c)))\n", + "let expansion index be nt,\n", + "(nt-1)/nt=(n_poly_T*(y-1))/y\n", + "so nt=1/(1-((n_poly_T*(y-1))/y))\n", + "For process 1-2\n", + "T2/T1=(p2/p1)^((nc-1)/nc)\n", + "so T2=T1*(p2/p1)^((nc-1)/nc)in K\n", + "also T4/T3=(p4/p3)^((nt-1)/nt)\n", + "so T4=T3*(p4/p3)^((nt-1)/nt)in K\n", + "using heat exchanger effectivenesss,\n", + "epsilon=(T5-T2)/(T4-T2)\n", + "so T5=T2+(epsilon*(T4-T2))in K\n", + "heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\n", + "compressor work,Wc=Cp*(T2-T1)in \n", + "turbine work,Wt=Cp*(T3-T4)in KJ/kg\n", + "cycle efficiency= 0.33\n", + "in percentage 32.79\n", + "work ratio= 0.33\n", + "specific work output in KJ/kg= 152.56\n", + "so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of cycle efficiency,work ratio,specific work output\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.9, Page:350 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\")\n", + "y=1.4;#expansion constant\n", + "n_poly_c=0.85;#ploytropic efficiency of compressor\n", + "n_poly_T=0.90;#ploytropic efficiency of Turbine\n", + "r=8.;#compression ratio\n", + "T1=(27.+273.);#temperature of air in compressor in K\n", + "T3=1100.;#temperature of air leaving combustion chamber in K\n", + "epsilon=0.8;#effectiveness of heat exchanger\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "print(\"using polytropic efficiency the index of compression and expansion can be obtained as under,\")\n", + "print(\"let compression index be nc,\")\n", + "print(\"(nc-1)/nc=(y-1)/(y*n_poly_c)\")\n", + "print(\"so nc=1/(1-((y-1)/(y*n_poly_c)))\")\n", + "nc=1/(1-((y-1)/(y*n_poly_c)))\n", + "print(\"let expansion index be nt,\")\n", + "print(\"(nt-1)/nt=(n_poly_T*(y-1))/y\")\n", + "print(\"so nt=1/(1-((n_poly_T*(y-1))/y))\")\n", + "nt=1/(1-((n_poly_T*(y-1))/y))\n", + "print(\"For process 1-2\")\n", + "print(\"T2/T1=(p2/p1)^((nc-1)/nc)\")\n", + "print(\"so T2=T1*(p2/p1)^((nc-1)/nc)in K\")\n", + "T2=T1*(r)**((nc-1)/nc)\n", + "print(\"also T4/T3=(p4/p3)^((nt-1)/nt)\")\n", + "print(\"so T4=T3*(p4/p3)^((nt-1)/nt)in K\")\n", + "T4=T3*(1/r)**((nt-1)/nt)\n", + "print(\"using heat exchanger effectivenesss,\") \n", + "print(\"epsilon=(T5-T2)/(T4-T2)\")\n", + "print(\"so T5=T2+(epsilon*(T4-T2))in K\")\n", + "T5=T2+(epsilon*(T4-T2))\n", + "print(\"heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\")\n", + "q_add=Cp*(T3-T5)\n", + "print(\"compressor work,Wc=Cp*(T2-T1)in \")\n", + "Wc=Cp*(T2-T1)\n", + "print(\"turbine work,Wt=Cp*(T3-T4)in KJ/kg\")\n", + "Wt=Cp*(T3-T4)\n", + "(Wt-Wc)/q_add\n", + "print(\"cycle efficiency=\"),round((Wt-Wc)/q_add,2)\n", + "print(\"in percentage\"),round((Wt-Wc)*100/q_add,2)\n", + "(Wt-Wc)/Wt\n", + "print(\"work ratio=\"),round((Wt-Wc)/Wt,2)\n", + "print(\"specific work output in KJ/kg=\"),round(Wt-Wc,2)\n", + "print(\"so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.10;pg no: 351" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.10, Page:351 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\n", + "for process 1-2_a\n", + "T2_a/T1=(p2_a/p1)^((y-1)/y)\n", + "so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\n", + "nc=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+((T2_a-T1)/nc) in K\n", + "for process 3-4_a,\n", + "T4_a/T3=(p4/p3)^((y-1)/y)\n", + "so T4_a=T3*(p4/p3)^((y-1)/y)in K\n", + "Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", + "Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\n", + "net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\n", + "heat added,q_add=Cp*(T3-T2) in KJ/kg\n", + "thermal efficiency,n=W_net/q_add\n", + "n={Wc-(Cp*(T3-T4))}/q_add\n", + "so T4=T3-((Wc-(n*q_add))/Cp)in K\n", + "therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a) 0.297\n", + "in percentage 29.7\n", + "so turbine isentropic efficiency=29.69%\n" + ] + } + ], + "source": [ + "#cal of isentropic efficiency of turbine\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.10, Page:351 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\")\n", + "T1=(27+273);#temperature of air in compressor in K\n", + "p1=1*10**5;#pressure of air in compressor in Pa\n", + "p2=5*10**5;#pressure of air after compression in Pa\n", + "p3=p2-0.2*10**5;#pressure drop in Pa\n", + "p4=1*10**5;#pressure to which expansion occur in turbine in Pa\n", + "nc=0.85;#isentropic efficiency\n", + "T3=1000;#temperature of air in combustion chamber in K\n", + "n=0.2;#thermal efficiency of plant\n", + "y=1.4;#expansion constant\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "print(\"for process 1-2_a\")\n", + "print(\"T2_a/T1=(p2_a/p1)^((y-1)/y)\")\n", + "print(\"so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\")\n", + "T2_a=T1*(p2/p1)**((y-1)/y)\n", + "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+((T2_a-T1)/nc) in K\")\n", + "T2=T1+((T2_a-T1)/nc)\n", + "print(\"for process 3-4_a,\")\n", + "print(\"T4_a/T3=(p4/p3)^((y-1)/y)\")\n", + "print(\"so T4_a=T3*(p4/p3)^((y-1)/y)in K\")\n", + "T4_a=T3*(p4/p3)**((y-1)/y)\n", + "print(\"Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", + "Wc=Cp*(T2-T1)\n", + "print(\"Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\")\n", + "print(\"net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\")\n", + "print(\"heat added,q_add=Cp*(T3-T2) in KJ/kg\")\n", + "q_add=Cp*(T3-T2)\n", + "print(\"thermal efficiency,n=W_net/q_add\")\n", + "print(\"n={Wc-(Cp*(T3-T4))}/q_add\")\n", + "print(\"so T4=T3-((Wc-(n*q_add))/Cp)in K\")\n", + "T4=T3-((Wc-(n*q_add))/Cp)\n", + "nt=(T3-T4)/(T3-T4_a)\n", + "print(\"therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a)\"),round((T3-T4)/(T3-T4_a),3)\n", + "print(\"in percentage\"),round(nt*100,2)\n", + "print(\"so turbine isentropic efficiency=29.69%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.11;pg no: 352" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.11, Page:352 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\n", + "for perfect intercooling the pressure ratio of each compression stage(k)\n", + "k=sqrt(r)\n", + "for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\n", + "so T2_a=T1*(k)^((y-1)/y)in K\n", + "considering isentropic efficiency of compression,\n", + "nc=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+((T2_a-T1)/nc)in K\n", + "for process 3-4,\n", + "T4_a/T3=(P4/P3)^((y-1)/y)\n", + "so T4_a=T3*(P4/P3)^((y-1)/y) in K\n", + "again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\n", + "so T4=T3+((T4_a-T3)/nc)in K\n", + "total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\n", + "for expansion process 5-6_a,\n", + "T6_a/T5=(P6/P5)^((y-1)/y)\n", + "so T6_a=T5*(P6/P5)^((y-1)/y) in K\n", + "considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\n", + "T6=T5-(ne*(T5-T6_a)) in K\n", + "for expansion in 7-8_a\n", + "T8_a/T7=(P8/P7)^((y-1)/y)\n", + "so T8_a=T7*(P8/P7)^((y-1)/y) in K\n", + "considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\n", + "so T8=T7-(ne*(T7-T8_a))in K\n", + "expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\n", + "heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\n", + "fuel required per kg of air,mf=q_add/C 0.02\n", + "air-fuel ratio=1/mf 51.08\n", + "net output(W) in KJ/kg= 229.2\n", + "output for air flowing at 30 kg/s,=W*m in KW 6876.05\n", + "thermal efficiency= 0.28\n", + "in percentage 27.88\n", + "so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\n", + "NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,net output,A/F ratio\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.11, Page:352 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\")\n", + "P1=1.*10**5;#initial pressure in Pa\n", + "T1=(27.+273.);#initial temperature in K\n", + "T3=T1;\n", + "r=10.;#pressure ratio\n", + "T5=1000.;#maximum temperature in cycle in K\n", + "P6=3.*10**5;#first stage expansion pressure in Pa\n", + "T7=995.;#first stage reheated temperature in K\n", + "C=42000.;#calorific value of fuel in KJ/kg\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "m=30.;#air flow rate in kg/s\n", + "nc=0.85;#isentropic efficiency of compression\n", + "ne=0.9;#isentropic efficiency of expansion\n", + "y=1.4;#expansion constant\n", + "print(\"for perfect intercooling the pressure ratio of each compression stage(k)\")\n", + "print(\"k=sqrt(r)\")\n", + "k=math.sqrt(r)\n", + "k=3.16;#approx.\n", + "print(\"for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2_a=T1*(k)^((y-1)/y)in K\")\n", + "T2_a=T1*(k)**((y-1)/y)\n", + "print(\"considering isentropic efficiency of compression,\")\n", + "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+((T2_a-T1)/nc)in K\")\n", + "T2=T1+((T2_a-T1)/nc)\n", + "print(\"for process 3-4,\")\n", + "print(\"T4_a/T3=(P4/P3)^((y-1)/y)\")\n", + "print(\"so T4_a=T3*(P4/P3)^((y-1)/y) in K\")\n", + "T4_a=T3*(k)**((y-1)/y)\n", + "print(\"again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\")\n", + "print(\"so T4=T3+((T4_a-T3)/nc)in K\")\n", + "T4=T3+((T4_a-T3)/nc)\n", + "print(\"total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\")\n", + "Wc=2*Cp*(T4-T3)\n", + "print(\"for expansion process 5-6_a,\")\n", + "print(\"T6_a/T5=(P6/P5)^((y-1)/y)\")\n", + "print(\"so T6_a=T5*(P6/P5)^((y-1)/y) in K\")\n", + "P5=10.*10**5;#pressure in Pa\n", + "T6_a=T5*(P6/P5)**((y-1)/y)\n", + "print(\"considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\")\n", + "print(\"T6=T5-(ne*(T5-T6_a)) in K\")\n", + "T6=T5-(ne*(T5-T6_a))\n", + "print(\"for expansion in 7-8_a\")\n", + "print(\"T8_a/T7=(P8/P7)^((y-1)/y)\")\n", + "print(\"so T8_a=T7*(P8/P7)^((y-1)/y) in K\")\n", + "P8=P1;#constant pressure process\n", + "P7=P6;#constant pressure process\n", + "T8_a=T7*(P8/P7)**((y-1)/y)\n", + "print(\"considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\")\n", + "print(\"so T8=T7-(ne*(T7-T8_a))in K\")\n", + "T8=T7-(ne*(T7-T8_a))\n", + "print(\"expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\")\n", + "Wt=Cp*(T5-T6)+Cp*(T7-T8)\n", + "print(\"heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\")\n", + "q_add=Cp*(T5-T4)+Cp*(T7-T6)\n", + "mf=q_add/C\n", + "print(\"fuel required per kg of air,mf=q_add/C\"),round(q_add/C,2)\n", + "print(\"air-fuel ratio=1/mf\"),round(1/mf,2)\n", + "W=Wt-Wc\n", + "print(\"net output(W) in KJ/kg=\"),round(Wt-Wc,2)\n", + "print(\"output for air flowing at 30 kg/s,=W*m in KW\"),round(W*m,2)\n", + "W/q_add\n", + "print(\"thermal efficiency=\"),round(W/q_add,2)\n", + "print(\"in percentage\"),round(W*100/q_add,2)\n", + "print(\"so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\")\n", + "print(\"NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.12;pg no: 354" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.12, Page:354 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\n", + "for process 1-2,\n", + "T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y) in K\n", + "for process 3-4,\n", + "T4/T3=(P4/P3)^((y-1)/y)\n", + "so T4=T3*(P4/P3)^((y-1)/y) in K\n", + "for process 6-7,\n", + "T7/T6=(P7/P6)^((y-1)/y)\n", + "so T7=T6*(P7/P6)^((y-1)/y) in K\n", + "for process 8-9,\n", + "T9/T8=(P9/P8)^((y-1)/y)\n", + "T9=T8*(P9/P8)^((y-1)/y) in K\n", + "in regenerator,effectiveness=(T5-T4)/(T9-T4)\n", + "T5=T4+(ne*(T9-T4))in K\n", + "compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\n", + "turbine work per kg air,Wt in KJ/kg= 660.84\n", + "heat added per kg air,q_add in KJ/kg= 765.43\n", + "total fuel required per kg of air= 0.02\n", + "net work,W_net in KJ/kg= 450.85\n", + "cycle thermal efficiency,n= 0.59\n", + "in percentage 58.9\n", + "fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C= 0.0056\n", + "fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C= 0.0126\n", + "so fuel-air ratio in two combustion chambers=0.0126,0.0056\n", + "total turbine work=660.85 KJ/kg\n", + "cycle thermal efficiency=58.9%\n", + "NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \n" + ] + } + ], + "source": [ + "#cal of fuel-air ratio in two combustion chambers,total turbine work,cycle thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.12, Page:354 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\")\n", + "P1=1.*10**5;#initial pressure in Pa\n", + "P9=P1;\n", + "T1=300.;#initial temperature in K\n", + "P2=4.*10**5;#pressure of air in intercooler in Pa\n", + "P3=P2;\n", + "T3=290.;#temperature of air in intercooler in K\n", + "T6=1300.;#temperature of combustion chamber in K\n", + "P4=8.*10**5;#pressure of air after compression in Pa\n", + "P6=P4;\n", + "T8=1300.;#temperature after reheating in K\n", + "P8=4.*10**5;#pressure after expansion in Pa\n", + "P7=P8;\n", + "C=42000.;#heating value of fuel in KJ/kg\n", + "y=1.4;#expansion constant\n", + "ne=0.8;#effectiveness of regenerator\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "print(\"for process 1-2,\")\n", + "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", + "T2=T1*(P2/P1)**((y-1)/y)\n", + "print(\"for process 3-4,\")\n", + "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", + "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", + "T4=T3*(P4/P3)**((y-1)/y)\n", + "print(\"for process 6-7,\")\n", + "print(\"T7/T6=(P7/P6)^((y-1)/y)\")\n", + "print(\"so T7=T6*(P7/P6)^((y-1)/y) in K\")\n", + "T7=T6*(P7/P6)**((y-1)/y)\n", + "print(\"for process 8-9,\")\n", + "print(\"T9/T8=(P9/P8)^((y-1)/y)\")\n", + "print(\"T9=T8*(P9/P8)^((y-1)/y) in K\")\n", + "T9=T8*(P9/P8)**((y-1)/y)\n", + "print(\"in regenerator,effectiveness=(T5-T4)/(T9-T4)\")\n", + "print(\"T5=T4+(ne*(T9-T4))in K\")\n", + "T5=T4+(ne*(T9-T4))\n", + "print(\"compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\")\n", + "Wc=Cp*(T2-T1)+Cp*(T4-T3)\n", + "Wt=Cp*(T6-T7)+Cp*(T8-T9)\n", + "print(\"turbine work per kg air,Wt in KJ/kg=\"),round(Wt,2)\n", + "q_add=Cp*(T6-T5)+Cp*(T8-T7)\n", + "print(\"heat added per kg air,q_add in KJ/kg=\"),round(q_add,2)\n", + "q_add/C\n", + "print(\"total fuel required per kg of air=\"),round(q_add/C,2)\n", + "W_net=Wt-Wc\n", + "print(\"net work,W_net in KJ/kg=\"),round(W_net,2)\n", + "n=W_net/q_add\n", + "print(\"cycle thermal efficiency,n=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C=\"),round(Cp*(T8-T7)/C,4)\n", + "print(\"fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C=\"),round(Cp*(T6-T5)/C,4)\n", + "print(\"so fuel-air ratio in two combustion chambers=0.0126,0.0056\")\n", + "print(\"total turbine work=660.85 KJ/kg\")\n", + "print(\"cycle thermal efficiency=58.9%\")\n", + "print(\"NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.13;pg no: 356" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.13, Page:356 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\n", + "work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\n", + "heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\n", + "for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\n", + "mass of air per cycle=m/n in kg/cycle\n", + "brake output in KW= 17.12\n", + "stroke volume,V in m^3= 0.0117\n", + "brake output=17.11 KW\n", + "stroke volume=0.0116 m^3\n" + ] + } + ], + "source": [ + "#cal of brake output,stroke volume\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.13, Page:356 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\")\n", + "T2=700.;#highest temperature of stirling engine in K\n", + "T1=300.;#lowest temperature of stirling engine in K\n", + "r=3.;#compression ratio\n", + "q_add=30.;#heat addition in KJ/s\n", + "epsilon=0.9;#regenerator efficiency\n", + "P=1*10**5;#pressure at begining of compression in Pa\n", + "n=100.;#number of cycle per minute\n", + "Cv=0.72;#specific heat at constant volume in KJ/kg K\n", + "R=29.27;#gas constant in KJ/kg K\n", + "print(\"work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\")\n", + "W=R*(T2-T1)*math.log(r)\n", + "print(\"heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\")\n", + "q=R*T2*math.log(r)+(1-epsilon)*Cv*(T2-T1)\n", + "print(\"for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\")\n", + "m=q_add/q\n", + "print(\"mass of air per cycle=m/n in kg/cycle\")\n", + "m/n\n", + "print(\"brake output in KW=\"),round(W*m,2)\n", + "m=1.33*10**-4;#mass of air per cycle in kg/cycle\n", + "T=T1;\n", + "V=m*R*T*1000/P\n", + "print(\"stroke volume,V in m^3=\"),round(V,4)\n", + "print(\"brake output=17.11 KW\")\n", + "print(\"stroke volume=0.0116 m^3\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.14;pg no: 357" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.14, Page:357 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\n", + "In question no.14,various expression is derived which cannot be solved using python software.\n" + ] + } + ], + "source": [ + "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.14, Page:357 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\")\n", + "print(\"In question no.14,various expression is derived which cannot be solved using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.15;pg no: 361" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.15, Page:361 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\n", + "In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y)in K\n", + "T4/T3=(P4/P3)^((y-1)/y)\n", + "so T4=T3*(P4/P3)^((y-1)/y) in K\n", + "compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", + "turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \n", + "heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \n", + "net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\n", + "heat recovered in HRSG for steam generation per kg of air\n", + "q_HRGC=Cp*(T4-T5)in KJ/kg\n", + "at inlet to steam in turbine,\n", + "from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\n", + "for expansion in steam turbine,sa=sb\n", + "let dryness fraction at state b be x\n", + "also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\n", + "sb=sf+x*sfg\n", + "so x=(sb-sf)/sfg \n", + "so hb=hf+x*hfg in KJ/kg K\n", + "at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\n", + "at exit of feed pump,hd=hd-hc\n", + "hd=vc*(Pg-Pc)*100 in KJ/kg\n", + "heat added per kg of steam =ha-hd in KJ/kg\n", + "mass of steam generated per kg of air in kg steam per kg air= 0.119\n", + "net steam turbine cycle output,W_net_ST in KJ/kg= 677.4\n", + "steam cycle output per kg of air(W_net_ST) in KJ/kg air= 80.61\n", + "total combined cycle output in KJ/kg air= 486.88\n", + "combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add 0.58\n", + "in percentage 57.77\n", + "In absence of steam cycle,gas turbine cycle efficiency,n_GT= 0.48\n", + "in percentage 48.21\n", + "thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\n", + "overall efficiency=57.77%\n", + "steam per kg of air=0.119 kg steam per/kg air\n" + ] + } + ], + "source": [ + "#cal of overall efficiency,steam per kg of air\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.15, Page:361 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\")\n", + "r=10.;#pressure ratio\n", + "Cp=1.0032;#specific heat of air in KJ/kg K\n", + "y=1.4;#expansion constant\n", + "T3=1400.;#inlet temperature of gas turbine in K\n", + "T1=(17.+273.);#ambient temperature in K\n", + "P1=1.*10**5;#ambient pressure in Pa\n", + "Pc=15.;#condensor pressure in KPa\n", + "Pg=6.*1000;#pressure of steam in generator in KPa\n", + "T5=420.;#temperature of exhaust from gas turbine in K\n", + "print(\"In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y)in K\")\n", + "T2=T1*(r)**((y-1)/y)\n", + "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", + "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", + "T4=T3*(1/r)**((y-1)/y)\n", + "print(\"compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", + "Wc=Cp*(T2-T1)\n", + "print(\"turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \")\n", + "Wt=Cp*(T3-T4)\n", + "print(\"heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \")\n", + "q_add=Cp*(T3-T2)\n", + "print(\"net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\")\n", + "W_net_GT=Wt-Wc\n", + "print(\"heat recovered in HRSG for steam generation per kg of air\")\n", + "print(\"q_HRGC=Cp*(T4-T5)in KJ/kg\")\n", + "q_HRGC=Cp*(T4-T5)\n", + "print(\"at inlet to steam in turbine,\")\n", + "print(\"from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\")\n", + "ha=3177.2;\n", + "sa=6.5408;\n", + "print(\"for expansion in steam turbine,sa=sb\")\n", + "sb=sa;\n", + "print(\"let dryness fraction at state b be x\")\n", + "print(\"also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\")\n", + "sf=0.7549;\n", + "sfg=7.2536;\n", + "hf=225.94;\n", + "hfg=2373.1;\n", + "print(\"sb=sf+x*sfg\")\n", + "print(\"so x=(sb-sf)/sfg \")\n", + "x=(sb-sf)/sfg\n", + "print(\"so hb=hf+x*hfg in KJ/kg K\")\n", + "hb=hf+x*hfg\n", + "print(\"at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\")\n", + "hc=hf;\n", + "vc=0.001014;\n", + "print(\"at exit of feed pump,hd=hd-hc\")\n", + "print(\"hd=vc*(Pg-Pc)*100 in KJ/kg\")\n", + "hd=vc*(Pg-Pc)*100\n", + "print(\"heat added per kg of steam =ha-hd in KJ/kg\")\n", + "ha-hd\n", + "print(\"mass of steam generated per kg of air in kg steam per kg air=\"),round(q_HRGC/(ha-hd),3)\n", + "W_net_ST=(ha-hb)-(hd-hc)\n", + "print(\"net steam turbine cycle output,W_net_ST in KJ/kg=\"),round(W_net_ST,2)\n", + "W_net_ST=W_net_ST*0.119 \n", + "print(\"steam cycle output per kg of air(W_net_ST) in KJ/kg air=\"),round(W_net_ST,2)\n", + "(W_net_GT+W_net_ST)\n", + "print(\"total combined cycle output in KJ/kg air= \"),round((W_net_GT+W_net_ST),2)\n", + "n_cc=(W_net_GT+W_net_ST)/q_add\n", + "print(\"combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add\"),round(n_cc,2)\n", + "print(\"in percentage\"),round(n_cc*100,2)\n", + "n_GT=W_net_GT/q_add\n", + "print(\"In absence of steam cycle,gas turbine cycle efficiency,n_GT=\"),round(n_GT,2)\n", + "print(\"in percentage\"),round(n_GT*100,2)\n", + "print(\"thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\")\n", + "print(\"overall efficiency=57.77%\")\n", + "print(\"steam per kg of air=0.119 kg steam per/kg air\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.16;pg no: 363" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.16, Page:363 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\n", + "here P4/P1=P3/P1=70............eq1\n", + "compression ratio,V1/V2=V1/V3=15.............eq2\n", + "heat added at constant volume= heat added at constant pressure\n", + "Q23=Q34\n", + "m*Cv*(T3-T2)=m*Cp*(T4-T3)\n", + "(T3-T2)=y*(T4-T3)\n", + "for process 1-2;\n", + "T2/T1=(P2/P1)^((y-1)/y)\n", + "T2/T1=(V1/V2)^(y-1)\n", + "so T2=T1*(V1/V2)^(y-1) in K\n", + "and (P2/P1)=(V1/V2)^y\n", + "so P2=P1*(V1/V2)^y in Pa...........eq3\n", + "for process 2-3,\n", + "P2/P3=T2/T3\n", + "so T3=T2*P3/P2\n", + "using eq 1 and 3,we get\n", + "T3=T2*k/r^y in K\n", + "using equal heat additions for processes 2-3 and 3-4,\n", + "(T3-T2)=y*(T4-T3)\n", + "so T4=T3+((T3-T2)/y) in K\n", + "for process 3-4,\n", + "V3/V4=T3/T4\n", + "(V3/V1)*(V1/V4)=T3/T4\n", + "so (V1/V4)=(T3/T4)*r\n", + "so V1/V4=11.88 and V5/V4=11.88\n", + "for process 4-5,\n", + "P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\n", + "so T5=T4/((V5/V4)^(y-1))\n", + "air standard thermal efficiency(n)=1-(heat rejected/heat added)\n", + "n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\n", + "n= 0.65\n", + "air standard thermal efficiency=0.6529\n", + "in percentage 65.29\n", + "so air standard thermal efficiency=65.29%\n", + "Actual thermal efficiency may be different from theoretical efficiency due to following reasons\n", + "a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\n", + "b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\n", + "c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\n" + ] + } + ], + "source": [ + "#cal of air standard thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.16, Page:363 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\")\n", + "T1=(27+273);#temperature at begining of compression in K\n", + "k=70;#ration of maximum to minimum pressures\n", + "r=15;#compression ratio\n", + "y=1.4;#expansion constant\n", + "print(\"here P4/P1=P3/P1=70............eq1\")\n", + "print(\"compression ratio,V1/V2=V1/V3=15.............eq2\")\n", + "print(\"heat added at constant volume= heat added at constant pressure\")\n", + "print(\"Q23=Q34\")\n", + "print(\"m*Cv*(T3-T2)=m*Cp*(T4-T3)\")\n", + "print(\"(T3-T2)=y*(T4-T3)\")\n", + "print(\"for process 1-2;\")\n", + "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"T2/T1=(V1/V2)^(y-1)\")\n", + "print(\"so T2=T1*(V1/V2)^(y-1) in K\")\n", + "T2=T1*(r)**(y-1)\n", + "print(\"and (P2/P1)=(V1/V2)^y\")\n", + "print(\"so P2=P1*(V1/V2)^y in Pa...........eq3\")\n", + "print(\"for process 2-3,\")\n", + "print(\"P2/P3=T2/T3\")\n", + "print(\"so T3=T2*P3/P2\")\n", + "print(\"using eq 1 and 3,we get\")\n", + "print(\"T3=T2*k/r^y in K\")\n", + "T3=T2*k/r**y \n", + "print(\"using equal heat additions for processes 2-3 and 3-4,\")\n", + "print(\"(T3-T2)=y*(T4-T3)\")\n", + "print(\"so T4=T3+((T3-T2)/y) in K\")\n", + "T4=T3+((T3-T2)/y)\n", + "print(\"for process 3-4,\")\n", + "print(\"V3/V4=T3/T4\")\n", + "print(\"(V3/V1)*(V1/V4)=T3/T4\")\n", + "print(\"so (V1/V4)=(T3/T4)*r\")\n", + "(T3/T4)*r\n", + "print(\"so V1/V4=11.88 and V5/V4=11.88\")\n", + "print(\"for process 4-5,\")\n", + "print(\"P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\")\n", + "print(\"so T5=T4/((V5/V4)^(y-1))\")\n", + "T5=T4/(11.88)**(y-1)\n", + "print(\"air standard thermal efficiency(n)=1-(heat rejected/heat added)\")\n", + "print(\"n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\")\n", + "n=1-((T5-T1)/(y*(T4-T3)+(T3-T2)))\n", + "print(\"n=\"),round(n,2)\n", + "print(\"air standard thermal efficiency=0.6529\")\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so air standard thermal efficiency=65.29%\")\n", + "print(\"Actual thermal efficiency may be different from theoretical efficiency due to following reasons\")\n", + "print(\"a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\")\n", + "print(\"b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\")\n", + "print(\"c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter9_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter9_1.ipynb new file mode 100755 index 00000000..606321b3 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter9_1.ipynb @@ -0,0 +1,1655 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 9:Gas Power Cycles" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.1;pg no: 334" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.1, Page:334 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\n", + "SI engine operate on otto cycle.consider working fluid to be perfect gas.\n", + "here,y=Cp/Cv\n", + "Cp-Cv=R in KJ/kg K\n", + "compression ratio,r=V1/V2=(0.15+V2)/V2\n", + "so V2=0.15/(r-1) in m^3\n", + "so V2=0.03 m^3\n", + "total cylinder volume=V1=r*V2 m^3\n", + "from perfect gas law,P*V=m*R*T\n", + "so m=P1*V1/(R*T1) in kg\n", + "from state 1 to 2 by P*V^y=P2*V2^y\n", + "so P2=P1*(V1/V2)^y in KPa\n", + "also,P1*V1/T1=P2*V2/T2\n", + "so T2=P2*V2*T1/(P1*V1)in K\n", + "from heat addition process 2-3\n", + "Q23=m*CV*(T3-T2)\n", + "T3=T2+(Q23/(m*Cv))in K\n", + "also from,P3*V3/T3=P2*V2/T2\n", + "P3=P2*V2*T3/(V3*T2) in KPa\n", + "for adiabatic expansion 3-4,\n", + "P3*V3^y=P4*V4^y\n", + "and V4=V1\n", + "hence,P4=P3*V3^y/V1^y in KPa\n", + "and from P3*V3/T3=P4*V4/T4\n", + "T4=P4*V4*T3/(P3*V3) in K\n", + "entropy change from 2-3 and 4-1 are same,and can be given as,\n", + "S3-S2=S4-S1=m*Cv*log(T4/T1)\n", + "so entropy change,deltaS_32=deltaS_41 in KJ/K\n", + "heat rejected,Q41=m*Cv*(T4-T1) in KJ\n", + "net work(W) in KJ= 76.75\n", + "efficiency(n)= 0.51\n", + "in percentage 51.16\n", + "mean effective pressure(mep)=work/volume change in KPa= 511.64\n", + "so mep=511.67 KPa\n" + ] + } + ], + "source": [ + "#cal of mean effective pressure\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.1, Page:334 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\")\n", + "Cp=1;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", + "P1=98;#pressure at begining of compression in KPa\n", + "T1=(60+273.15);#temperature at begining of compression in K\n", + "Q23=150;#heat supplied in KJ/kg\n", + "r=6;#compression ratio\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"SI engine operate on otto cycle.consider working fluid to be perfect gas.\")\n", + "print(\"here,y=Cp/Cv\")\n", + "y=Cp/Cv\n", + "y=1.4;#approx.\n", + "print(\"Cp-Cv=R in KJ/kg K\")\n", + "R=Cp-Cv\n", + "print(\"compression ratio,r=V1/V2=(0.15+V2)/V2\")\n", + "print(\"so V2=0.15/(r-1) in m^3\")\n", + "V2=0.15/(r-1)\n", + "print(\"so V2=0.03 m^3\")\n", + "print(\"total cylinder volume=V1=r*V2 m^3\")\n", + "V1=r*V2\n", + "print(\"from perfect gas law,P*V=m*R*T\")\n", + "print(\"so m=P1*V1/(R*T1) in kg\")\n", + "m=P1*V1/(R*T1)\n", + "m=0.183;#approx.\n", + "print(\"from state 1 to 2 by P*V^y=P2*V2^y\")\n", + "print(\"so P2=P1*(V1/V2)^y in KPa\")\n", + "P2=P1*(V1/V2)**y\n", + "print(\"also,P1*V1/T1=P2*V2/T2\")\n", + "print(\"so T2=P2*V2*T1/(P1*V1)in K\")\n", + "T2=P2*V2*T1/(P1*V1)\n", + "print(\"from heat addition process 2-3\")\n", + "print(\"Q23=m*CV*(T3-T2)\")\n", + "print(\"T3=T2+(Q23/(m*Cv))in K\")\n", + "T3=T2+(Q23/(m*Cv))\n", + "print(\"also from,P3*V3/T3=P2*V2/T2\")\n", + "print(\"P3=P2*V2*T3/(V3*T2) in KPa\")\n", + "V3=V2;#constant volume process\n", + "P3=P2*V2*T3/(V3*T2) \n", + "print(\"for adiabatic expansion 3-4,\")\n", + "print(\"P3*V3^y=P4*V4^y\")\n", + "print(\"and V4=V1\")\n", + "V4=V1;\n", + "print(\"hence,P4=P3*V3^y/V1^y in KPa\")\n", + "P4=P3*V3**y/V1**y\n", + "print(\"and from P3*V3/T3=P4*V4/T4\")\n", + "print(\"T4=P4*V4*T3/(P3*V3) in K\")\n", + "T4=P4*V4*T3/(P3*V3)\n", + "print(\"entropy change from 2-3 and 4-1 are same,and can be given as,\")\n", + "print(\"S3-S2=S4-S1=m*Cv*log(T4/T1)\")\n", + "print(\"so entropy change,deltaS_32=deltaS_41 in KJ/K\")\n", + "deltaS_32=m*Cv*math.log(T4/T1)\n", + "deltaS_41=deltaS_32;\n", + "print(\"heat rejected,Q41=m*Cv*(T4-T1) in KJ\")\n", + "Q41=m*Cv*(T4-T1)\n", + "W=Q23-Q41\n", + "print(\"net work(W) in KJ=\"),round(W,2)\n", + "n=W/Q23\n", + "print(\"efficiency(n)=\"),round(W/Q23,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "mep=W/0.15\n", + "print(\"mean effective pressure(mep)=work/volume change in KPa=\"),round(W/0.15,2)\n", + "print(\"so mep=511.67 KPa\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.2;pg no: 336" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.2, Page:336 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\n", + "as given\n", + "Va=V2+(7/8)*(V1-V2)\n", + "Vb=V2+(1/8)*(V1-V2)\n", + "and also\n", + "Pa*Va^y=Pb*Vb^y\n", + "so (Va/Vb)=(Pb/Pa)^(1/y)\n", + "also substituting for Va and Vb\n", + "(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\n", + "so V1/V2=r=1+(4.18*8/1.82) 19.37\n", + "it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\n", + "as given;cut off occurs at(V1-V2)/15 volume\n", + "V3=V2+(V1-V2)/15\n", + "cut off ratio,rho=V3/V2\n", + "air standard efficiency for diesel cycle(n_airstandard)= 0.63\n", + "in percentage 63.23\n", + "overall efficiency(n_overall)=n_airstandard*n_ite*n_mech 0.253\n", + "in percentage 25.3\n", + "fuel consumption,bhp/hr in kg= 0.26\n", + "so compression ratio=19.37\n", + "air standard efficiency=63.25%\n", + "fuel consumption,bhp/hr=0.255 kg\n" + ] + } + ], + "source": [ + "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.2, Page:336 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\")\n", + "Pa=138;#pressure during compression at 1/8 of stroke in KPa\n", + "Pb=1.38*10**3;#pressure during compression at 7/8 of stroke in KPa\n", + "n_ite=0.5;#indicated thermal efficiency\n", + "n_mech=0.8;#mechanical efficiency\n", + "C=41800;#calorific value in KJ/kg\n", + "y=1.4;#expansion constant\n", + "print(\"as given\")\n", + "print(\"Va=V2+(7/8)*(V1-V2)\")\n", + "print(\"Vb=V2+(1/8)*(V1-V2)\")\n", + "print(\"and also\")\n", + "print(\"Pa*Va^y=Pb*Vb^y\")\n", + "print(\"so (Va/Vb)=(Pb/Pa)^(1/y)\")\n", + "(Pb/Pa)**(1/y)\n", + "print(\"also substituting for Va and Vb\")\n", + "print(\"(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\")\n", + "r=1+(4.18*8/1.82)\n", + "print(\"so V1/V2=r=1+(4.18*8/1.82)\"),round(r,2)\n", + "print(\"it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\")\n", + "print(\"as given;cut off occurs at(V1-V2)/15 volume\")\n", + "print(\"V3=V2+(V1-V2)/15\")\n", + "print(\"cut off ratio,rho=V3/V2\")\n", + "rho=1+(r-1)/15\n", + "n_airstandard=1-(1/(r**(y-1)*y))*((rho**y-1)/(rho-1))\n", + "print(\"air standard efficiency for diesel cycle(n_airstandard)=\"),round(n_airstandard,2)\n", + "print(\"in percentage\"),round(n_airstandard*100,2)\n", + "n_airstandard=0.6325;\n", + "n_overall=n_airstandard*n_ite*n_mech\n", + "print(\"overall efficiency(n_overall)=n_airstandard*n_ite*n_mech\"),round(n_overall,3)\n", + "print(\"in percentage\"),round(n_overall*100,2)\n", + "n_overall=0.253;\n", + "75*60*60/(n_overall*C*100)\n", + "print(\"fuel consumption,bhp/hr in kg=\"),round(75*60*60/(n_overall*C*100),2)\n", + "print(\"so compression ratio=19.37\")\n", + "print(\"air standard efficiency=63.25%\")\n", + "print(\"fuel consumption,bhp/hr=0.255 kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.3;pg no: 338" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.3, Page:338 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\n", + "1-2-3-4=cycle a\n", + "1-2_a-3_a-4_a-5=cycle b\n", + "here Cp/Cv=y\n", + "and R=0.293 KJ/kg K\n", + "let us consider 1 kg of air for perfect gas,\n", + "P*V=m*R*T\n", + "so V1=m*R*T1/P1 in m^3\n", + "at state 3,\n", + "P3*V3=m*R*T3\n", + "so T3/V2=P3/(m*R)\n", + "so T3=17064.8*V2............eq1\n", + "for cycle a and also for cycle b\n", + "T3_a=17064.8*V2_a.............eq2\n", + "a> for otto cycle,\n", + "Q23=Cv*(T3-T2)\n", + "so T3-T2=Q23/Cv\n", + "and T2=T3-2394.36.............eq3\n", + "from gas law,P2*V2/T2=P3*V3/T3\n", + "here V2=V3 and using eq 3,we get\n", + "so P2/(T3-2394.36)=5000/T3\n", + "substituting T3 as function of V2\n", + "P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\n", + "P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\n", + "also P1*V1^y=P2*V2^y\n", + "or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\n", + "upon solving it yields\n", + "381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\n", + "or V2^1.4-0.140*V2^0.4-.022=0\n", + "by hit and trial it yields,V2=0.18 \n", + "thus compression ratio,r=V1/V2\n", + "otto cycle efficiency,n_otto=1-(1/r)^(y-1)\n", + "in percentage\n", + "b> for mixed or dual cycle\n", + "Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\n", + "or T3_a-T2_a=850/Cv\n", + "or T2_a=T3_a-1197.2 .............eq4 \n", + "also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\n", + "P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\n", + "or P2_a/(T3_a-1197.2)=5000/T3_a\n", + "also we had seen earlier that T3_a=17064.8*V2_a\n", + "so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\n", + "so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\n", + "or for adiabatic process,1-2_a\n", + "P1*V1^y=P2*V2^y\n", + "so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\n", + "or V2_a^1.4-0.07*V2_a^0.4-0.022=0\n", + "by hit and trial \n", + "V2_a=0.122 m^3\n", + "therefore upon substituting V2_a,\n", + "by eq 5,P2_a in KPa\n", + "by eq 2,T3_a in K\n", + "by eq 4,T2_a in K\n", + "from constant pressure heat addition\n", + "Cp*(T4_a-T3_a)=850\n", + "so T4_a=T3_a+(850/Cp) in K\n", + "also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\n", + "so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \n", + "here P3_a=P4_a and V2_a=V3_a\n", + "using adiabatic formulations V4_a=0.172 m^3\n", + "(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\n", + "so T5=T4_a/(V5/V4_a)^(y-1) in K\n", + "heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\n", + "efficiency of mixed cycle(n_mixed)= 0.57\n", + "in percentage 56.55\n" + ] + }, + { + "data": { + "text/plain": [ + "'NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.'" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#cal of comparing efficiency of two cycles\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.3, Page:338 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\")\n", + "T1=(100+273.15);#temperature at beginning of compresssion in K\n", + "P1=103;#pressure at beginning of compresssion in KPa\n", + "Cp=1.003;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", + "Q23=1700;#heat added during combustion in KJ/kg\n", + "P3=5000;#maximum pressure in cylinder in KPa\n", + "print(\"1-2-3-4=cycle a\")\n", + "print(\"1-2_a-3_a-4_a-5=cycle b\")\n", + "print(\"here Cp/Cv=y\")\n", + "y=Cp/Cv\n", + "y=1.4;#approx.\n", + "print(\"and R=0.293 KJ/kg K\")\n", + "R=0.293;\n", + "print(\"let us consider 1 kg of air for perfect gas,\")\n", + "m=1;#mass of air in kg\n", + "print(\"P*V=m*R*T\")\n", + "print(\"so V1=m*R*T1/P1 in m^3\")\n", + "V1=m*R*T1/P1\n", + "print(\"at state 3,\")\n", + "print(\"P3*V3=m*R*T3\")\n", + "print(\"so T3/V2=P3/(m*R)\")\n", + "P3/(m*R)\n", + "print(\"so T3=17064.8*V2............eq1\")\n", + "print(\"for cycle a and also for cycle b\")\n", + "print(\"T3_a=17064.8*V2_a.............eq2\")\n", + "print(\"a> for otto cycle,\")\n", + "print(\"Q23=Cv*(T3-T2)\")\n", + "print(\"so T3-T2=Q23/Cv\")\n", + "Q23/Cv\n", + "print(\"and T2=T3-2394.36.............eq3\")\n", + "print(\"from gas law,P2*V2/T2=P3*V3/T3\")\n", + "print(\"here V2=V3 and using eq 3,we get\")\n", + "print(\"so P2/(T3-2394.36)=5000/T3\")\n", + "print(\"substituting T3 as function of V2\")\n", + "print(\"P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\")\n", + "print(\"P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\")\n", + "print(\"also P1*V1^y=P2*V2^y\")\n", + "print(\"or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\")\n", + "print(\"upon solving it yields\")\n", + "print(\"381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\")\n", + "print(\"or V2^1.4-0.140*V2^0.4-.022=0\")\n", + "print(\"by hit and trial it yields,V2=0.18 \")\n", + "V2=0.18;\n", + "print(\"thus compression ratio,r=V1/V2\")\n", + "r=V1/V2\n", + "print(\"otto cycle efficiency,n_otto=1-(1/r)^(y-1)\")\n", + "n_otto=1-(1/r)**(y-1)\n", + "print(\"in percentage\")\n", + "n_otto=n_otto*100\n", + "print(\"b> for mixed or dual cycle\")\n", + "print(\"Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\")\n", + "print(\"or T3_a-T2_a=850/Cv\")\n", + "850/Cv\n", + "print(\"or T2_a=T3_a-1197.2 .............eq4 \")\n", + "print(\"also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\")\n", + "print(\"P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\")\n", + "print(\"or P2_a/(T3_a-1197.2)=5000/T3_a\")\n", + "print(\"also we had seen earlier that T3_a=17064.8*V2_a\")\n", + "print(\"so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\")\n", + "print(\"so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\")\n", + "print(\"or for adiabatic process,1-2_a\")\n", + "print(\"P1*V1^y=P2*V2^y\")\n", + "print(\"so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\")\n", + "print(\"or V2_a^1.4-0.07*V2_a^0.4-0.022=0\")\n", + "print(\"by hit and trial \")\n", + "print(\"V2_a=0.122 m^3\")\n", + "V2_a=0.122;\n", + "print(\"therefore upon substituting V2_a,\")\n", + "print(\"by eq 5,P2_a in KPa\")\n", + "P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a)\n", + "print(\"by eq 2,T3_a in K\")\n", + "T3_a=17064.8*V2_a\n", + "print(\"by eq 4,T2_a in K\")\n", + "T2_a=T3_a-1197.2\n", + "print(\"from constant pressure heat addition\")\n", + "print(\"Cp*(T4_a-T3_a)=850\")\n", + "print(\"so T4_a=T3_a+(850/Cp) in K\")\n", + "T4_a=T3_a+(850/Cp)\n", + "print(\"also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\")\n", + "print(\"so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \")\n", + "print(\"here P3_a=P4_a and V2_a=V3_a\")\n", + "V4_a=V2_a*T4_a/(T3_a)\n", + "print(\"using adiabatic formulations V4_a=0.172 m^3\")\n", + "print(\"(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\")\n", + "V5=V1;\n", + "print(\"so T5=T4_a/(V5/V4_a)^(y-1) in K\")\n", + "T5=T4_a/(V5/V4_a)**(y-1)\n", + "print(\"heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\")\n", + "Q51=Cv*(T5-T1)\n", + "n_mixed=(Q23-Q51)/Q23\n", + "print(\"efficiency of mixed cycle(n_mixed)=\"),round(n_mixed,2)\n", + "print(\"in percentage\"),round(n_mixed*100,2)\n", + "(\"NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.4;pg no: 341" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.4, Page:341 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\n", + "optimum pressure ratio for maximum work output,\n", + "rp=(T_max/T_min)^((y)/(2*(y-1)))\n", + "so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\n", + "so T2=T1*(p2/p1)^((y-1)/y)in K\n", + "For process 3-4,\n", + "T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\n", + "so T4=T3/(rp)^((y-1)/y)in K\n", + "heat supplied,Q23=Cp*(T3-T2)in KJ/kg\n", + "compressor work,Wc in KJ/kg= 301.5\n", + "turbine work,Wt in KJ/kg= 603.0\n", + "thermal efficiency=net work/heat supplied= 0.5\n", + "so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,turbine and compressor work\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.4, Page:341 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\")\n", + "T3=1200;#maximum temperature in K\n", + "T1=300;#minimum temperature in K\n", + "y=1.4;#expansion constant\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"optimum pressure ratio for maximum work output,\")\n", + "print(\"rp=(T_max/T_min)^((y)/(2*(y-1)))\")\n", + "T_max=T3;\n", + "T_min=T1;\n", + "rp=(T_max/T_min)**((y)/(2*(y-1)))\n", + "print(\"so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\")\n", + "print(\"so T2=T1*(p2/p1)^((y-1)/y)in K\")\n", + "T2=T1*(rp)**((y-1)/y)\n", + "print(\"For process 3-4,\")\n", + "print(\"T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\")\n", + "print(\"so T4=T3/(rp)^((y-1)/y)in K\")\n", + "T4=T3/(rp)**((y-1)/y)\n", + "print(\"heat supplied,Q23=Cp*(T3-T2)in KJ/kg\")\n", + "Q23=Cp*(T3-T2)\n", + "Wc=Cp*(T2-T1)\n", + "print(\"compressor work,Wc in KJ/kg=\"),round(Wc,2)\n", + "Wt=Cp*(T3-T4)\n", + "print(\"turbine work,Wt in KJ/kg=\"),round(Wt,2)\n", + "(Wt-Wc)/Q23\n", + "print(\"thermal efficiency=net work/heat supplied=\"),round((Wt-Wc)/Q23,2)\n", + "print(\"so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.5;pg no: 342" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.5, Page:342 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\n", + "gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\n", + "for process 1-2 being isentropic,\n", + "T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y) in K\n", + "considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\n", + "so T2_a=T1+((T2-T1)/n_compr)in K\n", + "during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\n", + "heat added=mf*q\n", + "=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\n", + "or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\n", + "so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\n", + "for expansion 3-4 being\n", + "T4/T3=(P4/P3)^((n-1)/n)\n", + "so T4=T3*(P4/P3)^((n-1)/n) in K\n", + "actaul temperature at turbine inlet considering internal efficiency of turbine,\n", + "n_turb=(T3-T4_a)/(T3-T4)\n", + "so T4_a=T3-(n_turb*(T3-T4)) in K\n", + "compressor work,per kg of air compressed(Wc) in KJ/kg of air= 234.42\n", + "so compressor work=234.42 KJ/kg of air\n", + "turbine work,per kg of air compressed(Wt) in KJ/kg of air= 414.71\n", + "so turbine work=414.71 KJ/kg of air\n", + "net work(W_net) in KJ/kg of air= 180.29\n", + "heat supplied(Q) in KJ/kg of air= 751.16\n", + "thermal efficiency(n)= 0.24\n", + "in percentage 24.0\n", + "so thermal efficiency=24%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,turbine and compressor work\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.5, Page:342 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\")\n", + "P1=1*10**5;#initial pressure in Pa\n", + "P4=P1;#constant pressure process\n", + "T1=300;#initial temperature in K\n", + "P2=6.2*10**5;#pressure after compression in Pa\n", + "P3=P2;#constant pressure process\n", + "k=0.017;#fuel to air ratio\n", + "n_compr=0.88;#compressor efficiency\n", + "q=44186;#heating value of fuel in KJ/kg\n", + "n_turb=0.9;#turbine internal efficiency\n", + "Cp_comb=1.147;#specific heat of combustion at constant pressure in KJ/kg K\n", + "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", + "y=1.4;#expansion constant\n", + "n=1.33;#expansion constant for polytropic constant\n", + "print(\"gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\")\n", + "print(\"for process 1-2 being isentropic,\")\n", + "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", + "T2=T1*(P2/P1)**((y-1)/y)\n", + "print(\"considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\")\n", + "print(\"so T2_a=T1+((T2-T1)/n_compr)in K\")\n", + "T2_a=T1+((T2-T1)/n_compr)\n", + "print(\"during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\")\n", + "print(\"heat added=mf*q\")\n", + "print(\"=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\")\n", + "print(\"or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\")\n", + "print(\"so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\")\n", + "T3=((k)*q+(Cp_air*T2_a))/((1+(k))*Cp_comb)\n", + "print(\"for expansion 3-4 being\")\n", + "print(\"T4/T3=(P4/P3)^((n-1)/n)\")\n", + "print(\"so T4=T3*(P4/P3)^((n-1)/n) in K\")\n", + "T4=T3*(P4/P3)**((n-1)/n)\n", + "print(\"actaul temperature at turbine inlet considering internal efficiency of turbine,\")\n", + "print(\"n_turb=(T3-T4_a)/(T3-T4)\")\n", + "print(\"so T4_a=T3-(n_turb*(T3-T4)) in K\")\n", + "T4_a=T3-(n_turb*(T3-T4))\n", + "Wc=Cp_air*(T2_a-T1)\n", + "print(\"compressor work,per kg of air compressed(Wc) in KJ/kg of air=\"),round(Wc,2)\n", + "print(\"so compressor work=234.42 KJ/kg of air\")\n", + "Wt=Cp_comb*(T3-T4_a)\n", + "print(\"turbine work,per kg of air compressed(Wt) in KJ/kg of air=\"),round(Wt,2)\n", + "print(\"so turbine work=414.71 KJ/kg of air\")\n", + "W_net=Wt-Wc\n", + "print(\"net work(W_net) in KJ/kg of air=\"),round(W_net,2)\n", + "Q=k*q\n", + "print(\"heat supplied(Q) in KJ/kg of air=\"),round(Q,2)\n", + "n=W_net/Q\n", + "print(\"thermal efficiency(n)=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so thermal efficiency=24%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.6;pg no: 343" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.6, Page:343 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\n", + "NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\n", + "overall pressure ratio(rp)= 13.59\n", + "so overall optimum pressure ratio=13.6\n" + ] + } + ], + "source": [ + "#cal of overall optimum pressure ratio\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.6, Page:343 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\")\n", + "T1=300;#minimum temperature in brayton cycle in K\n", + "T5=1200;#maximum temperature in brayton cycle in K\n", + "n_isen_c=0.85;#isentropic efficiency of compressor\n", + "n_isen_t=0.9;#isentropic efficiency of turbine\n", + "y=1.4;#expansion constant\n", + "print(\"NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\")\n", + "rp=(T1/(T5*n_isen_c*n_isen_t))**((2*y)/(3*(1-y)))\n", + "print(\"overall pressure ratio(rp)=\"),round(rp,2)\n", + "print(\"so overall optimum pressure ratio=13.6\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.7;pg no: 346" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.7, Page:346 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\n", + "i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\n", + "therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\n", + "or P9/P1=k=(1.35)^8 11.03\n", + "or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\n", + "T9/T1=(P9/P1)^((y-1)/y)\n", + "so T9 in K= 621.47\n", + "considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\n", + "(T9-T1)/(T9_actual-T1)=0.82\n", + "so T9_actual=T1+((T9-T1)/0.82) in K 689.19\n", + "let the actual index of compression be n, then\n", + "(T9_actual/T1)=(P9/P1)^((n-1)/n)\n", + "so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\n", + "so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\n", + "ii> let polytropic efficiency be n_polytropic for compressor then,\n", + "(n-1)/n=((y-1)/y)*(1/n_polytropic)\n", + "so n_polytropic= 0.87\n", + "in percentage 86.9\n", + "so ploytropic efficiency=86.88%\n", + "iii> stage efficiency can be estimated for any stage.say first stage.\n", + "ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y) in K\n", + "actual temperature at exit of first stage can be estimated using polytropic index 1.49.\n", + "T2_actual/T1=(P2/P1)^((n-1)/n)\n", + "so T2_actual=T1*(P2/P1)^((n-1)/n) in K\n", + "stage efficiency for first stage,ns_1= 0.86\n", + "in percentage 86.33\n", + "actual temperature at exit of second stage,\n", + "T3_actual/T2_actual=(P3/P2)^((n-1)/n)\n", + "so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\n", + "ideal temperature at exit of second stage\n", + "T3/T2_actual=(P3/P2)^((n-1)/n)\n", + "so T3=T2_actual*(P3/P2)^((y-1)/y) in K\n", + "stage efficiency for second stage,ns_2= 0.86\n", + "in percentage 86.33\n", + "actual rtemperature at exit of third stage,\n", + "T4_actual/T3_actual=(P4/P3)^((n-1)/n)\n", + "so T4_actual in K= 420.83\n", + "ideal temperature at exit of third stage,\n", + "T4/T3_actual=(P4/P3)^((n-1)/n)\n", + "so T4 in K= 415.42\n", + "stage efficiency for third stage,ns_3= 0.86\n", + "in percentage= 8632.9\n", + "so stage efficiency=86.4%\n", + "iv> from steady flow energy equation,\n", + "Wc=dw=dh and dh=du+p*dv+v*dp\n", + "dh=dq+v*dp\n", + "dq=0 in adiabatic process\n", + "dh=v*dp\n", + "Wc=v*dp\n", + "here for polytropic compression \n", + "P*V^1.49=constant i.e n=1.49\n", + "Wc in KJ/s= 16419.87\n", + "due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s= 14777.89\n", + "so power required to drive compressor =14777.89 KJ/s\n" + ] + } + ], + "source": [ + "#cal of state of air at exit of compressor,polytropic efficiency,efficiency of each sate,power\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.7, Page:346 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\")\n", + "T1=313.;#air entering temperature in K\n", + "P1=1*10**5;#air entering pressure in Pa\n", + "m=50.;#flow rate through compressor in kg/s\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\")\n", + "print(\"therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\")\n", + "r=1.35;#compression ratio\n", + "k=(1.35)**8\n", + "print(\"or P9/P1=k=(1.35)^8\"),round(k,2)\n", + "k=11.03;#approx.\n", + "print(\"or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\")\n", + "y=1.4;#expansion constant \n", + "print(\"T9/T1=(P9/P1)^((y-1)/y)\")\n", + "T9=T1*(k)**((y-1)/y)\n", + "print(\"so T9 in K=\"),round(T9,2)\n", + "print(\"considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\")\n", + "print(\"(T9-T1)/(T9_actual-T1)=0.82\")\n", + "T9_actual=T1+((T9-T1)/0.82)\n", + "print(\"so T9_actual=T1+((T9-T1)/0.82) in K\"),round(T9_actual,2)\n", + "print(\"let the actual index of compression be n, then\")\n", + "print(\"(T9_actual/T1)=(P9/P1)^((n-1)/n)\")\n", + "print(\"so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\")\n", + "n=math.log(k)/(math.log(k)-math.log(T9_actual/T1))\n", + "print(\"so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\")\n", + "print(\"ii> let polytropic efficiency be n_polytropic for compressor then,\")\n", + "print(\"(n-1)/n=((y-1)/y)*(1/n_polytropic)\")\n", + "n_polytropic=((y-1)/y)/((n-1)/n)\n", + "print(\"so n_polytropic=\"),round(n_polytropic,2)\n", + "print(\"in percentage\"),round(n_polytropic*100,2)\n", + "print(\"so ploytropic efficiency=86.88%\")\n", + "print(\"iii> stage efficiency can be estimated for any stage.say first stage.\")\n", + "print(\"ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", + "T2=T1*(r)**((y-1)/y)\n", + "print(\"actual temperature at exit of first stage can be estimated using polytropic index 1.49.\")\n", + "print(\"T2_actual/T1=(P2/P1)^((n-1)/n)\")\n", + "print(\"so T2_actual=T1*(P2/P1)^((n-1)/n) in K\")\n", + "T2_actual=T1*(r)**((n-1)/n)\n", + "ns_1=(T2-T1)/(T2_actual-T1)\n", + "print(\"stage efficiency for first stage,ns_1=\"),round(ns_1,2)\n", + "print(\"in percentage\"),round(ns_1*100,2)\n", + "print(\"actual temperature at exit of second stage,\")\n", + "print(\"T3_actual/T2_actual=(P3/P2)^((n-1)/n)\")\n", + "print(\"so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\")\n", + "T3_actual=T2_actual*(r)**((n-1)/n)\n", + "print(\"ideal temperature at exit of second stage\")\n", + "print(\"T3/T2_actual=(P3/P2)^((n-1)/n)\")\n", + "print(\"so T3=T2_actual*(P3/P2)^((y-1)/y) in K\")\n", + "T3=T2_actual*(r)**((y-1)/y)\n", + "ns_2=(T3-T2_actual)/(T3_actual-T2_actual)\n", + "print(\"stage efficiency for second stage,ns_2=\"),round(ns_2,2)\n", + "print(\"in percentage\"),round(ns_2*100,2)\n", + "print(\"actual rtemperature at exit of third stage,\")\n", + "print(\"T4_actual/T3_actual=(P4/P3)^((n-1)/n)\")\n", + "T4_actual=T3_actual*(r)**((n-1)/n)\n", + "print(\"so T4_actual in K=\"),round(T4_actual,2)\n", + "print(\"ideal temperature at exit of third stage,\")\n", + "print(\"T4/T3_actual=(P4/P3)^((n-1)/n)\")\n", + "T4=T3_actual*(r)**((y-1)/y)\n", + "print(\"so T4 in K=\"),round(T4,2)\n", + "ns_3=(T4-T3_actual)/(T4_actual-T3_actual)\n", + "print(\"stage efficiency for third stage,ns_3=\"),round(ns_3,2)\n", + "ns_3=ns_3*100\n", + "print(\"in percentage=\"),round(ns_3*100,2)\n", + "print(\"so stage efficiency=86.4%\")\n", + "print(\"iv> from steady flow energy equation,\")\n", + "print(\"Wc=dw=dh and dh=du+p*dv+v*dp\")\n", + "print(\"dh=dq+v*dp\")\n", + "print(\"dq=0 in adiabatic process\")\n", + "print(\"dh=v*dp\")\n", + "print(\"Wc=v*dp\")\n", + "print(\"here for polytropic compression \")\n", + "print(\"P*V^1.49=constant i.e n=1.49\")\n", + "n=1.49;\n", + "Wc=(n/(n-1))*m*R*T1*(((k)**((n-1)/n))-1)\n", + "print(\"Wc in KJ/s=\"),round(Wc,2)\n", + "Wc_actual=Wc*0.9\n", + "print(\"due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s=\"),round(Wc*0.9,2)\n", + "print(\"so power required to drive compressor =14777.89 KJ/s\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.8;pg no: 349" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.8, Page:349 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\n", + "In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.8, Page:349 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\")\n", + "print(\"In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.9;pg no: 350" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.9, Page:350 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\n", + "using polytropic efficiency the index of compression and expansion can be obtained as under,\n", + "let compression index be nc,\n", + "(nc-1)/nc=(y-1)/(y*n_poly_c)\n", + "so nc=1/(1-((y-1)/(y*n_poly_c)))\n", + "let expansion index be nt,\n", + "(nt-1)/nt=(n_poly_T*(y-1))/y\n", + "so nt=1/(1-((n_poly_T*(y-1))/y))\n", + "For process 1-2\n", + "T2/T1=(p2/p1)^((nc-1)/nc)\n", + "so T2=T1*(p2/p1)^((nc-1)/nc)in K\n", + "also T4/T3=(p4/p3)^((nt-1)/nt)\n", + "so T4=T3*(p4/p3)^((nt-1)/nt)in K\n", + "using heat exchanger effectivenesss,\n", + "epsilon=(T5-T2)/(T4-T2)\n", + "so T5=T2+(epsilon*(T4-T2))in K\n", + "heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\n", + "compressor work,Wc=Cp*(T2-T1)in \n", + "turbine work,Wt=Cp*(T3-T4)in KJ/kg\n", + "cycle efficiency= 0.33\n", + "in percentage 32.79\n", + "work ratio= 0.33\n", + "specific work output in KJ/kg= 152.56\n", + "so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of cycle efficiency,work ratio,specific work output\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.9, Page:350 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\")\n", + "y=1.4;#expansion constant\n", + "n_poly_c=0.85;#ploytropic efficiency of compressor\n", + "n_poly_T=0.90;#ploytropic efficiency of Turbine\n", + "r=8.;#compression ratio\n", + "T1=(27.+273.);#temperature of air in compressor in K\n", + "T3=1100.;#temperature of air leaving combustion chamber in K\n", + "epsilon=0.8;#effectiveness of heat exchanger\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "print(\"using polytropic efficiency the index of compression and expansion can be obtained as under,\")\n", + "print(\"let compression index be nc,\")\n", + "print(\"(nc-1)/nc=(y-1)/(y*n_poly_c)\")\n", + "print(\"so nc=1/(1-((y-1)/(y*n_poly_c)))\")\n", + "nc=1/(1-((y-1)/(y*n_poly_c)))\n", + "print(\"let expansion index be nt,\")\n", + "print(\"(nt-1)/nt=(n_poly_T*(y-1))/y\")\n", + "print(\"so nt=1/(1-((n_poly_T*(y-1))/y))\")\n", + "nt=1/(1-((n_poly_T*(y-1))/y))\n", + "print(\"For process 1-2\")\n", + "print(\"T2/T1=(p2/p1)^((nc-1)/nc)\")\n", + "print(\"so T2=T1*(p2/p1)^((nc-1)/nc)in K\")\n", + "T2=T1*(r)**((nc-1)/nc)\n", + "print(\"also T4/T3=(p4/p3)^((nt-1)/nt)\")\n", + "print(\"so T4=T3*(p4/p3)^((nt-1)/nt)in K\")\n", + "T4=T3*(1/r)**((nt-1)/nt)\n", + "print(\"using heat exchanger effectivenesss,\") \n", + "print(\"epsilon=(T5-T2)/(T4-T2)\")\n", + "print(\"so T5=T2+(epsilon*(T4-T2))in K\")\n", + "T5=T2+(epsilon*(T4-T2))\n", + "print(\"heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\")\n", + "q_add=Cp*(T3-T5)\n", + "print(\"compressor work,Wc=Cp*(T2-T1)in \")\n", + "Wc=Cp*(T2-T1)\n", + "print(\"turbine work,Wt=Cp*(T3-T4)in KJ/kg\")\n", + "Wt=Cp*(T3-T4)\n", + "(Wt-Wc)/q_add\n", + "print(\"cycle efficiency=\"),round((Wt-Wc)/q_add,2)\n", + "print(\"in percentage\"),round((Wt-Wc)*100/q_add,2)\n", + "(Wt-Wc)/Wt\n", + "print(\"work ratio=\"),round((Wt-Wc)/Wt,2)\n", + "print(\"specific work output in KJ/kg=\"),round(Wt-Wc,2)\n", + "print(\"so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.10;pg no: 351" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.10, Page:351 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\n", + "for process 1-2_a\n", + "T2_a/T1=(p2_a/p1)^((y-1)/y)\n", + "so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\n", + "nc=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+((T2_a-T1)/nc) in K\n", + "for process 3-4_a,\n", + "T4_a/T3=(p4/p3)^((y-1)/y)\n", + "so T4_a=T3*(p4/p3)^((y-1)/y)in K\n", + "Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", + "Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\n", + "net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\n", + "heat added,q_add=Cp*(T3-T2) in KJ/kg\n", + "thermal efficiency,n=W_net/q_add\n", + "n={Wc-(Cp*(T3-T4))}/q_add\n", + "so T4=T3-((Wc-(n*q_add))/Cp)in K\n", + "therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a) 0.297\n", + "in percentage 29.7\n", + "so turbine isentropic efficiency=29.69%\n" + ] + } + ], + "source": [ + "#cal of isentropic efficiency of turbine\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.10, Page:351 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\")\n", + "T1=(27+273);#temperature of air in compressor in K\n", + "p1=1*10**5;#pressure of air in compressor in Pa\n", + "p2=5*10**5;#pressure of air after compression in Pa\n", + "p3=p2-0.2*10**5;#pressure drop in Pa\n", + "p4=1*10**5;#pressure to which expansion occur in turbine in Pa\n", + "nc=0.85;#isentropic efficiency\n", + "T3=1000;#temperature of air in combustion chamber in K\n", + "n=0.2;#thermal efficiency of plant\n", + "y=1.4;#expansion constant\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "print(\"for process 1-2_a\")\n", + "print(\"T2_a/T1=(p2_a/p1)^((y-1)/y)\")\n", + "print(\"so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\")\n", + "T2_a=T1*(p2/p1)**((y-1)/y)\n", + "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+((T2_a-T1)/nc) in K\")\n", + "T2=T1+((T2_a-T1)/nc)\n", + "print(\"for process 3-4_a,\")\n", + "print(\"T4_a/T3=(p4/p3)^((y-1)/y)\")\n", + "print(\"so T4_a=T3*(p4/p3)^((y-1)/y)in K\")\n", + "T4_a=T3*(p4/p3)**((y-1)/y)\n", + "print(\"Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", + "Wc=Cp*(T2-T1)\n", + "print(\"Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\")\n", + "print(\"net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\")\n", + "print(\"heat added,q_add=Cp*(T3-T2) in KJ/kg\")\n", + "q_add=Cp*(T3-T2)\n", + "print(\"thermal efficiency,n=W_net/q_add\")\n", + "print(\"n={Wc-(Cp*(T3-T4))}/q_add\")\n", + "print(\"so T4=T3-((Wc-(n*q_add))/Cp)in K\")\n", + "T4=T3-((Wc-(n*q_add))/Cp)\n", + "nt=(T3-T4)/(T3-T4_a)\n", + "print(\"therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a)\"),round((T3-T4)/(T3-T4_a),3)\n", + "print(\"in percentage\"),round(nt*100,2)\n", + "print(\"so turbine isentropic efficiency=29.69%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.11;pg no: 352" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.11, Page:352 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\n", + "for perfect intercooling the pressure ratio of each compression stage(k)\n", + "k=sqrt(r)\n", + "for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\n", + "so T2_a=T1*(k)^((y-1)/y)in K\n", + "considering isentropic efficiency of compression,\n", + "nc=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+((T2_a-T1)/nc)in K\n", + "for process 3-4,\n", + "T4_a/T3=(P4/P3)^((y-1)/y)\n", + "so T4_a=T3*(P4/P3)^((y-1)/y) in K\n", + "again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\n", + "so T4=T3+((T4_a-T3)/nc)in K\n", + "total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\n", + "for expansion process 5-6_a,\n", + "T6_a/T5=(P6/P5)^((y-1)/y)\n", + "so T6_a=T5*(P6/P5)^((y-1)/y) in K\n", + "considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\n", + "T6=T5-(ne*(T5-T6_a)) in K\n", + "for expansion in 7-8_a\n", + "T8_a/T7=(P8/P7)^((y-1)/y)\n", + "so T8_a=T7*(P8/P7)^((y-1)/y) in K\n", + "considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\n", + "so T8=T7-(ne*(T7-T8_a))in K\n", + "expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\n", + "heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\n", + "fuel required per kg of air,mf=q_add/C 0.02\n", + "air-fuel ratio=1/mf 51.08\n", + "net output(W) in KJ/kg= 229.2\n", + "output for air flowing at 30 kg/s,=W*m in KW 6876.05\n", + "thermal efficiency= 0.28\n", + "in percentage 27.88\n", + "so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\n", + "NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,net output,A/F ratio\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.11, Page:352 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\")\n", + "P1=1.*10**5;#initial pressure in Pa\n", + "T1=(27.+273.);#initial temperature in K\n", + "T3=T1;\n", + "r=10.;#pressure ratio\n", + "T5=1000.;#maximum temperature in cycle in K\n", + "P6=3.*10**5;#first stage expansion pressure in Pa\n", + "T7=995.;#first stage reheated temperature in K\n", + "C=42000.;#calorific value of fuel in KJ/kg\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "m=30.;#air flow rate in kg/s\n", + "nc=0.85;#isentropic efficiency of compression\n", + "ne=0.9;#isentropic efficiency of expansion\n", + "y=1.4;#expansion constant\n", + "print(\"for perfect intercooling the pressure ratio of each compression stage(k)\")\n", + "print(\"k=sqrt(r)\")\n", + "k=math.sqrt(r)\n", + "k=3.16;#approx.\n", + "print(\"for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2_a=T1*(k)^((y-1)/y)in K\")\n", + "T2_a=T1*(k)**((y-1)/y)\n", + "print(\"considering isentropic efficiency of compression,\")\n", + "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+((T2_a-T1)/nc)in K\")\n", + "T2=T1+((T2_a-T1)/nc)\n", + "print(\"for process 3-4,\")\n", + "print(\"T4_a/T3=(P4/P3)^((y-1)/y)\")\n", + "print(\"so T4_a=T3*(P4/P3)^((y-1)/y) in K\")\n", + "T4_a=T3*(k)**((y-1)/y)\n", + "print(\"again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\")\n", + "print(\"so T4=T3+((T4_a-T3)/nc)in K\")\n", + "T4=T3+((T4_a-T3)/nc)\n", + "print(\"total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\")\n", + "Wc=2*Cp*(T4-T3)\n", + "print(\"for expansion process 5-6_a,\")\n", + "print(\"T6_a/T5=(P6/P5)^((y-1)/y)\")\n", + "print(\"so T6_a=T5*(P6/P5)^((y-1)/y) in K\")\n", + "P5=10.*10**5;#pressure in Pa\n", + "T6_a=T5*(P6/P5)**((y-1)/y)\n", + "print(\"considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\")\n", + "print(\"T6=T5-(ne*(T5-T6_a)) in K\")\n", + "T6=T5-(ne*(T5-T6_a))\n", + "print(\"for expansion in 7-8_a\")\n", + "print(\"T8_a/T7=(P8/P7)^((y-1)/y)\")\n", + "print(\"so T8_a=T7*(P8/P7)^((y-1)/y) in K\")\n", + "P8=P1;#constant pressure process\n", + "P7=P6;#constant pressure process\n", + "T8_a=T7*(P8/P7)**((y-1)/y)\n", + "print(\"considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\")\n", + "print(\"so T8=T7-(ne*(T7-T8_a))in K\")\n", + "T8=T7-(ne*(T7-T8_a))\n", + "print(\"expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\")\n", + "Wt=Cp*(T5-T6)+Cp*(T7-T8)\n", + "print(\"heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\")\n", + "q_add=Cp*(T5-T4)+Cp*(T7-T6)\n", + "mf=q_add/C\n", + "print(\"fuel required per kg of air,mf=q_add/C\"),round(q_add/C,2)\n", + "print(\"air-fuel ratio=1/mf\"),round(1/mf,2)\n", + "W=Wt-Wc\n", + "print(\"net output(W) in KJ/kg=\"),round(Wt-Wc,2)\n", + "print(\"output for air flowing at 30 kg/s,=W*m in KW\"),round(W*m,2)\n", + "W/q_add\n", + "print(\"thermal efficiency=\"),round(W/q_add,2)\n", + "print(\"in percentage\"),round(W*100/q_add,2)\n", + "print(\"so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\")\n", + "print(\"NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.12;pg no: 354" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.12, Page:354 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\n", + "for process 1-2,\n", + "T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y) in K\n", + "for process 3-4,\n", + "T4/T3=(P4/P3)^((y-1)/y)\n", + "so T4=T3*(P4/P3)^((y-1)/y) in K\n", + "for process 6-7,\n", + "T7/T6=(P7/P6)^((y-1)/y)\n", + "so T7=T6*(P7/P6)^((y-1)/y) in K\n", + "for process 8-9,\n", + "T9/T8=(P9/P8)^((y-1)/y)\n", + "T9=T8*(P9/P8)^((y-1)/y) in K\n", + "in regenerator,effectiveness=(T5-T4)/(T9-T4)\n", + "T5=T4+(ne*(T9-T4))in K\n", + "compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\n", + "turbine work per kg air,Wt in KJ/kg= 660.84\n", + "heat added per kg air,q_add in KJ/kg= 765.43\n", + "total fuel required per kg of air= 0.02\n", + "net work,W_net in KJ/kg= 450.85\n", + "cycle thermal efficiency,n= 0.59\n", + "in percentage 58.9\n", + "fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C= 0.0056\n", + "fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C= 0.0126\n", + "so fuel-air ratio in two combustion chambers=0.0126,0.0056\n", + "total turbine work=660.85 KJ/kg\n", + "cycle thermal efficiency=58.9%\n", + "NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \n" + ] + } + ], + "source": [ + "#cal of fuel-air ratio in two combustion chambers,total turbine work,cycle thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.12, Page:354 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\")\n", + "P1=1.*10**5;#initial pressure in Pa\n", + "P9=P1;\n", + "T1=300.;#initial temperature in K\n", + "P2=4.*10**5;#pressure of air in intercooler in Pa\n", + "P3=P2;\n", + "T3=290.;#temperature of air in intercooler in K\n", + "T6=1300.;#temperature of combustion chamber in K\n", + "P4=8.*10**5;#pressure of air after compression in Pa\n", + "P6=P4;\n", + "T8=1300.;#temperature after reheating in K\n", + "P8=4.*10**5;#pressure after expansion in Pa\n", + "P7=P8;\n", + "C=42000.;#heating value of fuel in KJ/kg\n", + "y=1.4;#expansion constant\n", + "ne=0.8;#effectiveness of regenerator\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "print(\"for process 1-2,\")\n", + "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", + "T2=T1*(P2/P1)**((y-1)/y)\n", + "print(\"for process 3-4,\")\n", + "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", + "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", + "T4=T3*(P4/P3)**((y-1)/y)\n", + "print(\"for process 6-7,\")\n", + "print(\"T7/T6=(P7/P6)^((y-1)/y)\")\n", + "print(\"so T7=T6*(P7/P6)^((y-1)/y) in K\")\n", + "T7=T6*(P7/P6)**((y-1)/y)\n", + "print(\"for process 8-9,\")\n", + "print(\"T9/T8=(P9/P8)^((y-1)/y)\")\n", + "print(\"T9=T8*(P9/P8)^((y-1)/y) in K\")\n", + "T9=T8*(P9/P8)**((y-1)/y)\n", + "print(\"in regenerator,effectiveness=(T5-T4)/(T9-T4)\")\n", + "print(\"T5=T4+(ne*(T9-T4))in K\")\n", + "T5=T4+(ne*(T9-T4))\n", + "print(\"compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\")\n", + "Wc=Cp*(T2-T1)+Cp*(T4-T3)\n", + "Wt=Cp*(T6-T7)+Cp*(T8-T9)\n", + "print(\"turbine work per kg air,Wt in KJ/kg=\"),round(Wt,2)\n", + "q_add=Cp*(T6-T5)+Cp*(T8-T7)\n", + "print(\"heat added per kg air,q_add in KJ/kg=\"),round(q_add,2)\n", + "q_add/C\n", + "print(\"total fuel required per kg of air=\"),round(q_add/C,2)\n", + "W_net=Wt-Wc\n", + "print(\"net work,W_net in KJ/kg=\"),round(W_net,2)\n", + "n=W_net/q_add\n", + "print(\"cycle thermal efficiency,n=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C=\"),round(Cp*(T8-T7)/C,4)\n", + "print(\"fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C=\"),round(Cp*(T6-T5)/C,4)\n", + "print(\"so fuel-air ratio in two combustion chambers=0.0126,0.0056\")\n", + "print(\"total turbine work=660.85 KJ/kg\")\n", + "print(\"cycle thermal efficiency=58.9%\")\n", + "print(\"NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.13;pg no: 356" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.13, Page:356 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\n", + "work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\n", + "heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\n", + "for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\n", + "mass of air per cycle=m/n in kg/cycle\n", + "brake output in KW= 17.12\n", + "stroke volume,V in m^3= 0.0117\n", + "brake output=17.11 KW\n", + "stroke volume=0.0116 m^3\n" + ] + } + ], + "source": [ + "#cal of brake output,stroke volume\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.13, Page:356 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\")\n", + "T2=700.;#highest temperature of stirling engine in K\n", + "T1=300.;#lowest temperature of stirling engine in K\n", + "r=3.;#compression ratio\n", + "q_add=30.;#heat addition in KJ/s\n", + "epsilon=0.9;#regenerator efficiency\n", + "P=1*10**5;#pressure at begining of compression in Pa\n", + "n=100.;#number of cycle per minute\n", + "Cv=0.72;#specific heat at constant volume in KJ/kg K\n", + "R=29.27;#gas constant in KJ/kg K\n", + "print(\"work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\")\n", + "W=R*(T2-T1)*math.log(r)\n", + "print(\"heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\")\n", + "q=R*T2*math.log(r)+(1-epsilon)*Cv*(T2-T1)\n", + "print(\"for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\")\n", + "m=q_add/q\n", + "print(\"mass of air per cycle=m/n in kg/cycle\")\n", + "m/n\n", + "print(\"brake output in KW=\"),round(W*m,2)\n", + "m=1.33*10**-4;#mass of air per cycle in kg/cycle\n", + "T=T1;\n", + "V=m*R*T*1000/P\n", + "print(\"stroke volume,V in m^3=\"),round(V,4)\n", + "print(\"brake output=17.11 KW\")\n", + "print(\"stroke volume=0.0116 m^3\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.14;pg no: 357" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.14, Page:357 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\n", + "In question no.14,various expression is derived which cannot be solved using python software.\n" + ] + } + ], + "source": [ + "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.14, Page:357 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\")\n", + "print(\"In question no.14,various expression is derived which cannot be solved using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.15;pg no: 361" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.15, Page:361 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\n", + "In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y)in K\n", + "T4/T3=(P4/P3)^((y-1)/y)\n", + "so T4=T3*(P4/P3)^((y-1)/y) in K\n", + "compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", + "turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \n", + "heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \n", + "net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\n", + "heat recovered in HRSG for steam generation per kg of air\n", + "q_HRGC=Cp*(T4-T5)in KJ/kg\n", + "at inlet to steam in turbine,\n", + "from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\n", + "for expansion in steam turbine,sa=sb\n", + "let dryness fraction at state b be x\n", + "also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\n", + "sb=sf+x*sfg\n", + "so x=(sb-sf)/sfg \n", + "so hb=hf+x*hfg in KJ/kg K\n", + "at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\n", + "at exit of feed pump,hd=hd-hc\n", + "hd=vc*(Pg-Pc)*100 in KJ/kg\n", + "heat added per kg of steam =ha-hd in KJ/kg\n", + "mass of steam generated per kg of air in kg steam per kg air= 0.119\n", + "net steam turbine cycle output,W_net_ST in KJ/kg= 677.4\n", + "steam cycle output per kg of air(W_net_ST) in KJ/kg air= 80.61\n", + "total combined cycle output in KJ/kg air= 486.88\n", + "combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add 0.58\n", + "in percentage 57.77\n", + "In absence of steam cycle,gas turbine cycle efficiency,n_GT= 0.48\n", + "in percentage 48.21\n", + "thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\n", + "overall efficiency=57.77%\n", + "steam per kg of air=0.119 kg steam per/kg air\n" + ] + } + ], + "source": [ + "#cal of overall efficiency,steam per kg of air\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.15, Page:361 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\")\n", + "r=10.;#pressure ratio\n", + "Cp=1.0032;#specific heat of air in KJ/kg K\n", + "y=1.4;#expansion constant\n", + "T3=1400.;#inlet temperature of gas turbine in K\n", + "T1=(17.+273.);#ambient temperature in K\n", + "P1=1.*10**5;#ambient pressure in Pa\n", + "Pc=15.;#condensor pressure in KPa\n", + "Pg=6.*1000;#pressure of steam in generator in KPa\n", + "T5=420.;#temperature of exhaust from gas turbine in K\n", + "print(\"In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y)in K\")\n", + "T2=T1*(r)**((y-1)/y)\n", + "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", + "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", + "T4=T3*(1/r)**((y-1)/y)\n", + "print(\"compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", + "Wc=Cp*(T2-T1)\n", + "print(\"turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \")\n", + "Wt=Cp*(T3-T4)\n", + "print(\"heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \")\n", + "q_add=Cp*(T3-T2)\n", + "print(\"net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\")\n", + "W_net_GT=Wt-Wc\n", + "print(\"heat recovered in HRSG for steam generation per kg of air\")\n", + "print(\"q_HRGC=Cp*(T4-T5)in KJ/kg\")\n", + "q_HRGC=Cp*(T4-T5)\n", + "print(\"at inlet to steam in turbine,\")\n", + "print(\"from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\")\n", + "ha=3177.2;\n", + "sa=6.5408;\n", + "print(\"for expansion in steam turbine,sa=sb\")\n", + "sb=sa;\n", + "print(\"let dryness fraction at state b be x\")\n", + "print(\"also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\")\n", + "sf=0.7549;\n", + "sfg=7.2536;\n", + "hf=225.94;\n", + "hfg=2373.1;\n", + "print(\"sb=sf+x*sfg\")\n", + "print(\"so x=(sb-sf)/sfg \")\n", + "x=(sb-sf)/sfg\n", + "print(\"so hb=hf+x*hfg in KJ/kg K\")\n", + "hb=hf+x*hfg\n", + "print(\"at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\")\n", + "hc=hf;\n", + "vc=0.001014;\n", + "print(\"at exit of feed pump,hd=hd-hc\")\n", + "print(\"hd=vc*(Pg-Pc)*100 in KJ/kg\")\n", + "hd=vc*(Pg-Pc)*100\n", + "print(\"heat added per kg of steam =ha-hd in KJ/kg\")\n", + "ha-hd\n", + "print(\"mass of steam generated per kg of air in kg steam per kg air=\"),round(q_HRGC/(ha-hd),3)\n", + "W_net_ST=(ha-hb)-(hd-hc)\n", + "print(\"net steam turbine cycle output,W_net_ST in KJ/kg=\"),round(W_net_ST,2)\n", + "W_net_ST=W_net_ST*0.119 \n", + "print(\"steam cycle output per kg of air(W_net_ST) in KJ/kg air=\"),round(W_net_ST,2)\n", + "(W_net_GT+W_net_ST)\n", + "print(\"total combined cycle output in KJ/kg air= \"),round((W_net_GT+W_net_ST),2)\n", + "n_cc=(W_net_GT+W_net_ST)/q_add\n", + "print(\"combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add\"),round(n_cc,2)\n", + "print(\"in percentage\"),round(n_cc*100,2)\n", + "n_GT=W_net_GT/q_add\n", + "print(\"In absence of steam cycle,gas turbine cycle efficiency,n_GT=\"),round(n_GT,2)\n", + "print(\"in percentage\"),round(n_GT*100,2)\n", + "print(\"thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\")\n", + "print(\"overall efficiency=57.77%\")\n", + "print(\"steam per kg of air=0.119 kg steam per/kg air\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.16;pg no: 363" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.16, Page:363 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\n", + "here P4/P1=P3/P1=70............eq1\n", + "compression ratio,V1/V2=V1/V3=15.............eq2\n", + "heat added at constant volume= heat added at constant pressure\n", + "Q23=Q34\n", + "m*Cv*(T3-T2)=m*Cp*(T4-T3)\n", + "(T3-T2)=y*(T4-T3)\n", + "for process 1-2;\n", + "T2/T1=(P2/P1)^((y-1)/y)\n", + "T2/T1=(V1/V2)^(y-1)\n", + "so T2=T1*(V1/V2)^(y-1) in K\n", + "and (P2/P1)=(V1/V2)^y\n", + "so P2=P1*(V1/V2)^y in Pa...........eq3\n", + "for process 2-3,\n", + "P2/P3=T2/T3\n", + "so T3=T2*P3/P2\n", + "using eq 1 and 3,we get\n", + "T3=T2*k/r^y in K\n", + "using equal heat additions for processes 2-3 and 3-4,\n", + "(T3-T2)=y*(T4-T3)\n", + "so T4=T3+((T3-T2)/y) in K\n", + "for process 3-4,\n", + "V3/V4=T3/T4\n", + "(V3/V1)*(V1/V4)=T3/T4\n", + "so (V1/V4)=(T3/T4)*r\n", + "so V1/V4=11.88 and V5/V4=11.88\n", + "for process 4-5,\n", + "P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\n", + "so T5=T4/((V5/V4)^(y-1))\n", + "air standard thermal efficiency(n)=1-(heat rejected/heat added)\n", + "n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\n", + "n= 0.65\n", + "air standard thermal efficiency=0.6529\n", + "in percentage 65.29\n", + "so air standard thermal efficiency=65.29%\n", + "Actual thermal efficiency may be different from theoretical efficiency due to following reasons\n", + "a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\n", + "b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\n", + "c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\n" + ] + } + ], + "source": [ + "#cal of air standard thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.16, Page:363 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\")\n", + "T1=(27+273);#temperature at begining of compression in K\n", + "k=70;#ration of maximum to minimum pressures\n", + "r=15;#compression ratio\n", + "y=1.4;#expansion constant\n", + "print(\"here P4/P1=P3/P1=70............eq1\")\n", + "print(\"compression ratio,V1/V2=V1/V3=15.............eq2\")\n", + "print(\"heat added at constant volume= heat added at constant pressure\")\n", + "print(\"Q23=Q34\")\n", + "print(\"m*Cv*(T3-T2)=m*Cp*(T4-T3)\")\n", + "print(\"(T3-T2)=y*(T4-T3)\")\n", + "print(\"for process 1-2;\")\n", + "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"T2/T1=(V1/V2)^(y-1)\")\n", + "print(\"so T2=T1*(V1/V2)^(y-1) in K\")\n", + "T2=T1*(r)**(y-1)\n", + "print(\"and (P2/P1)=(V1/V2)^y\")\n", + "print(\"so P2=P1*(V1/V2)^y in Pa...........eq3\")\n", + "print(\"for process 2-3,\")\n", + "print(\"P2/P3=T2/T3\")\n", + "print(\"so T3=T2*P3/P2\")\n", + "print(\"using eq 1 and 3,we get\")\n", + "print(\"T3=T2*k/r^y in K\")\n", + "T3=T2*k/r**y \n", + "print(\"using equal heat additions for processes 2-3 and 3-4,\")\n", + "print(\"(T3-T2)=y*(T4-T3)\")\n", + "print(\"so T4=T3+((T3-T2)/y) in K\")\n", + "T4=T3+((T3-T2)/y)\n", + "print(\"for process 3-4,\")\n", + "print(\"V3/V4=T3/T4\")\n", + "print(\"(V3/V1)*(V1/V4)=T3/T4\")\n", + "print(\"so (V1/V4)=(T3/T4)*r\")\n", + "(T3/T4)*r\n", + "print(\"so V1/V4=11.88 and V5/V4=11.88\")\n", + "print(\"for process 4-5,\")\n", + "print(\"P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\")\n", + "print(\"so T5=T4/((V5/V4)^(y-1))\")\n", + "T5=T4/(11.88)**(y-1)\n", + "print(\"air standard thermal efficiency(n)=1-(heat rejected/heat added)\")\n", + "print(\"n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\")\n", + "n=1-((T5-T1)/(y*(T4-T3)+(T3-T2)))\n", + "print(\"n=\"),round(n,2)\n", + "print(\"air standard thermal efficiency=0.6529\")\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so air standard thermal efficiency=65.29%\")\n", + "print(\"Actual thermal efficiency may be different from theoretical efficiency due to following reasons\")\n", + "print(\"a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\")\n", + "print(\"b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\")\n", + "print(\"c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter9_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter9_2.ipynb new file mode 100755 index 00000000..606321b3 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter9_2.ipynb @@ -0,0 +1,1655 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 9:Gas Power Cycles" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.1;pg no: 334" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.1, Page:334 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\n", + "SI engine operate on otto cycle.consider working fluid to be perfect gas.\n", + "here,y=Cp/Cv\n", + "Cp-Cv=R in KJ/kg K\n", + "compression ratio,r=V1/V2=(0.15+V2)/V2\n", + "so V2=0.15/(r-1) in m^3\n", + "so V2=0.03 m^3\n", + "total cylinder volume=V1=r*V2 m^3\n", + "from perfect gas law,P*V=m*R*T\n", + "so m=P1*V1/(R*T1) in kg\n", + "from state 1 to 2 by P*V^y=P2*V2^y\n", + "so P2=P1*(V1/V2)^y in KPa\n", + "also,P1*V1/T1=P2*V2/T2\n", + "so T2=P2*V2*T1/(P1*V1)in K\n", + "from heat addition process 2-3\n", + "Q23=m*CV*(T3-T2)\n", + "T3=T2+(Q23/(m*Cv))in K\n", + "also from,P3*V3/T3=P2*V2/T2\n", + "P3=P2*V2*T3/(V3*T2) in KPa\n", + "for adiabatic expansion 3-4,\n", + "P3*V3^y=P4*V4^y\n", + "and V4=V1\n", + "hence,P4=P3*V3^y/V1^y in KPa\n", + "and from P3*V3/T3=P4*V4/T4\n", + "T4=P4*V4*T3/(P3*V3) in K\n", + "entropy change from 2-3 and 4-1 are same,and can be given as,\n", + "S3-S2=S4-S1=m*Cv*log(T4/T1)\n", + "so entropy change,deltaS_32=deltaS_41 in KJ/K\n", + "heat rejected,Q41=m*Cv*(T4-T1) in KJ\n", + "net work(W) in KJ= 76.75\n", + "efficiency(n)= 0.51\n", + "in percentage 51.16\n", + "mean effective pressure(mep)=work/volume change in KPa= 511.64\n", + "so mep=511.67 KPa\n" + ] + } + ], + "source": [ + "#cal of mean effective pressure\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.1, Page:334 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\")\n", + "Cp=1;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", + "P1=98;#pressure at begining of compression in KPa\n", + "T1=(60+273.15);#temperature at begining of compression in K\n", + "Q23=150;#heat supplied in KJ/kg\n", + "r=6;#compression ratio\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"SI engine operate on otto cycle.consider working fluid to be perfect gas.\")\n", + "print(\"here,y=Cp/Cv\")\n", + "y=Cp/Cv\n", + "y=1.4;#approx.\n", + "print(\"Cp-Cv=R in KJ/kg K\")\n", + "R=Cp-Cv\n", + "print(\"compression ratio,r=V1/V2=(0.15+V2)/V2\")\n", + "print(\"so V2=0.15/(r-1) in m^3\")\n", + "V2=0.15/(r-1)\n", + "print(\"so V2=0.03 m^3\")\n", + "print(\"total cylinder volume=V1=r*V2 m^3\")\n", + "V1=r*V2\n", + "print(\"from perfect gas law,P*V=m*R*T\")\n", + "print(\"so m=P1*V1/(R*T1) in kg\")\n", + "m=P1*V1/(R*T1)\n", + "m=0.183;#approx.\n", + "print(\"from state 1 to 2 by P*V^y=P2*V2^y\")\n", + "print(\"so P2=P1*(V1/V2)^y in KPa\")\n", + "P2=P1*(V1/V2)**y\n", + "print(\"also,P1*V1/T1=P2*V2/T2\")\n", + "print(\"so T2=P2*V2*T1/(P1*V1)in K\")\n", + "T2=P2*V2*T1/(P1*V1)\n", + "print(\"from heat addition process 2-3\")\n", + "print(\"Q23=m*CV*(T3-T2)\")\n", + "print(\"T3=T2+(Q23/(m*Cv))in K\")\n", + "T3=T2+(Q23/(m*Cv))\n", + "print(\"also from,P3*V3/T3=P2*V2/T2\")\n", + "print(\"P3=P2*V2*T3/(V3*T2) in KPa\")\n", + "V3=V2;#constant volume process\n", + "P3=P2*V2*T3/(V3*T2) \n", + "print(\"for adiabatic expansion 3-4,\")\n", + "print(\"P3*V3^y=P4*V4^y\")\n", + "print(\"and V4=V1\")\n", + "V4=V1;\n", + "print(\"hence,P4=P3*V3^y/V1^y in KPa\")\n", + "P4=P3*V3**y/V1**y\n", + "print(\"and from P3*V3/T3=P4*V4/T4\")\n", + "print(\"T4=P4*V4*T3/(P3*V3) in K\")\n", + "T4=P4*V4*T3/(P3*V3)\n", + "print(\"entropy change from 2-3 and 4-1 are same,and can be given as,\")\n", + "print(\"S3-S2=S4-S1=m*Cv*log(T4/T1)\")\n", + "print(\"so entropy change,deltaS_32=deltaS_41 in KJ/K\")\n", + "deltaS_32=m*Cv*math.log(T4/T1)\n", + "deltaS_41=deltaS_32;\n", + "print(\"heat rejected,Q41=m*Cv*(T4-T1) in KJ\")\n", + "Q41=m*Cv*(T4-T1)\n", + "W=Q23-Q41\n", + "print(\"net work(W) in KJ=\"),round(W,2)\n", + "n=W/Q23\n", + "print(\"efficiency(n)=\"),round(W/Q23,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "mep=W/0.15\n", + "print(\"mean effective pressure(mep)=work/volume change in KPa=\"),round(W/0.15,2)\n", + "print(\"so mep=511.67 KPa\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.2;pg no: 336" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.2, Page:336 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\n", + "as given\n", + "Va=V2+(7/8)*(V1-V2)\n", + "Vb=V2+(1/8)*(V1-V2)\n", + "and also\n", + "Pa*Va^y=Pb*Vb^y\n", + "so (Va/Vb)=(Pb/Pa)^(1/y)\n", + "also substituting for Va and Vb\n", + "(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\n", + "so V1/V2=r=1+(4.18*8/1.82) 19.37\n", + "it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\n", + "as given;cut off occurs at(V1-V2)/15 volume\n", + "V3=V2+(V1-V2)/15\n", + "cut off ratio,rho=V3/V2\n", + "air standard efficiency for diesel cycle(n_airstandard)= 0.63\n", + "in percentage 63.23\n", + "overall efficiency(n_overall)=n_airstandard*n_ite*n_mech 0.253\n", + "in percentage 25.3\n", + "fuel consumption,bhp/hr in kg= 0.26\n", + "so compression ratio=19.37\n", + "air standard efficiency=63.25%\n", + "fuel consumption,bhp/hr=0.255 kg\n" + ] + } + ], + "source": [ + "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.2, Page:336 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\")\n", + "Pa=138;#pressure during compression at 1/8 of stroke in KPa\n", + "Pb=1.38*10**3;#pressure during compression at 7/8 of stroke in KPa\n", + "n_ite=0.5;#indicated thermal efficiency\n", + "n_mech=0.8;#mechanical efficiency\n", + "C=41800;#calorific value in KJ/kg\n", + "y=1.4;#expansion constant\n", + "print(\"as given\")\n", + "print(\"Va=V2+(7/8)*(V1-V2)\")\n", + "print(\"Vb=V2+(1/8)*(V1-V2)\")\n", + "print(\"and also\")\n", + "print(\"Pa*Va^y=Pb*Vb^y\")\n", + "print(\"so (Va/Vb)=(Pb/Pa)^(1/y)\")\n", + "(Pb/Pa)**(1/y)\n", + "print(\"also substituting for Va and Vb\")\n", + "print(\"(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\")\n", + "r=1+(4.18*8/1.82)\n", + "print(\"so V1/V2=r=1+(4.18*8/1.82)\"),round(r,2)\n", + "print(\"it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\")\n", + "print(\"as given;cut off occurs at(V1-V2)/15 volume\")\n", + "print(\"V3=V2+(V1-V2)/15\")\n", + "print(\"cut off ratio,rho=V3/V2\")\n", + "rho=1+(r-1)/15\n", + "n_airstandard=1-(1/(r**(y-1)*y))*((rho**y-1)/(rho-1))\n", + "print(\"air standard efficiency for diesel cycle(n_airstandard)=\"),round(n_airstandard,2)\n", + "print(\"in percentage\"),round(n_airstandard*100,2)\n", + "n_airstandard=0.6325;\n", + "n_overall=n_airstandard*n_ite*n_mech\n", + "print(\"overall efficiency(n_overall)=n_airstandard*n_ite*n_mech\"),round(n_overall,3)\n", + "print(\"in percentage\"),round(n_overall*100,2)\n", + "n_overall=0.253;\n", + "75*60*60/(n_overall*C*100)\n", + "print(\"fuel consumption,bhp/hr in kg=\"),round(75*60*60/(n_overall*C*100),2)\n", + "print(\"so compression ratio=19.37\")\n", + "print(\"air standard efficiency=63.25%\")\n", + "print(\"fuel consumption,bhp/hr=0.255 kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.3;pg no: 338" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.3, Page:338 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\n", + "1-2-3-4=cycle a\n", + "1-2_a-3_a-4_a-5=cycle b\n", + "here Cp/Cv=y\n", + "and R=0.293 KJ/kg K\n", + "let us consider 1 kg of air for perfect gas,\n", + "P*V=m*R*T\n", + "so V1=m*R*T1/P1 in m^3\n", + "at state 3,\n", + "P3*V3=m*R*T3\n", + "so T3/V2=P3/(m*R)\n", + "so T3=17064.8*V2............eq1\n", + "for cycle a and also for cycle b\n", + "T3_a=17064.8*V2_a.............eq2\n", + "a> for otto cycle,\n", + "Q23=Cv*(T3-T2)\n", + "so T3-T2=Q23/Cv\n", + "and T2=T3-2394.36.............eq3\n", + "from gas law,P2*V2/T2=P3*V3/T3\n", + "here V2=V3 and using eq 3,we get\n", + "so P2/(T3-2394.36)=5000/T3\n", + "substituting T3 as function of V2\n", + "P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\n", + "P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\n", + "also P1*V1^y=P2*V2^y\n", + "or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\n", + "upon solving it yields\n", + "381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\n", + "or V2^1.4-0.140*V2^0.4-.022=0\n", + "by hit and trial it yields,V2=0.18 \n", + "thus compression ratio,r=V1/V2\n", + "otto cycle efficiency,n_otto=1-(1/r)^(y-1)\n", + "in percentage\n", + "b> for mixed or dual cycle\n", + "Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\n", + "or T3_a-T2_a=850/Cv\n", + "or T2_a=T3_a-1197.2 .............eq4 \n", + "also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\n", + "P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\n", + "or P2_a/(T3_a-1197.2)=5000/T3_a\n", + "also we had seen earlier that T3_a=17064.8*V2_a\n", + "so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\n", + "so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\n", + "or for adiabatic process,1-2_a\n", + "P1*V1^y=P2*V2^y\n", + "so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\n", + "or V2_a^1.4-0.07*V2_a^0.4-0.022=0\n", + "by hit and trial \n", + "V2_a=0.122 m^3\n", + "therefore upon substituting V2_a,\n", + "by eq 5,P2_a in KPa\n", + "by eq 2,T3_a in K\n", + "by eq 4,T2_a in K\n", + "from constant pressure heat addition\n", + "Cp*(T4_a-T3_a)=850\n", + "so T4_a=T3_a+(850/Cp) in K\n", + "also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\n", + "so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \n", + "here P3_a=P4_a and V2_a=V3_a\n", + "using adiabatic formulations V4_a=0.172 m^3\n", + "(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\n", + "so T5=T4_a/(V5/V4_a)^(y-1) in K\n", + "heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\n", + "efficiency of mixed cycle(n_mixed)= 0.57\n", + "in percentage 56.55\n" + ] + }, + { + "data": { + "text/plain": [ + "'NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.'" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#cal of comparing efficiency of two cycles\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.3, Page:338 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\")\n", + "T1=(100+273.15);#temperature at beginning of compresssion in K\n", + "P1=103;#pressure at beginning of compresssion in KPa\n", + "Cp=1.003;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", + "Q23=1700;#heat added during combustion in KJ/kg\n", + "P3=5000;#maximum pressure in cylinder in KPa\n", + "print(\"1-2-3-4=cycle a\")\n", + "print(\"1-2_a-3_a-4_a-5=cycle b\")\n", + "print(\"here Cp/Cv=y\")\n", + "y=Cp/Cv\n", + "y=1.4;#approx.\n", + "print(\"and R=0.293 KJ/kg K\")\n", + "R=0.293;\n", + "print(\"let us consider 1 kg of air for perfect gas,\")\n", + "m=1;#mass of air in kg\n", + "print(\"P*V=m*R*T\")\n", + "print(\"so V1=m*R*T1/P1 in m^3\")\n", + "V1=m*R*T1/P1\n", + "print(\"at state 3,\")\n", + "print(\"P3*V3=m*R*T3\")\n", + "print(\"so T3/V2=P3/(m*R)\")\n", + "P3/(m*R)\n", + "print(\"so T3=17064.8*V2............eq1\")\n", + "print(\"for cycle a and also for cycle b\")\n", + "print(\"T3_a=17064.8*V2_a.............eq2\")\n", + "print(\"a> for otto cycle,\")\n", + "print(\"Q23=Cv*(T3-T2)\")\n", + "print(\"so T3-T2=Q23/Cv\")\n", + "Q23/Cv\n", + "print(\"and T2=T3-2394.36.............eq3\")\n", + "print(\"from gas law,P2*V2/T2=P3*V3/T3\")\n", + "print(\"here V2=V3 and using eq 3,we get\")\n", + "print(\"so P2/(T3-2394.36)=5000/T3\")\n", + "print(\"substituting T3 as function of V2\")\n", + "print(\"P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\")\n", + "print(\"P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\")\n", + "print(\"also P1*V1^y=P2*V2^y\")\n", + "print(\"or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\")\n", + "print(\"upon solving it yields\")\n", + "print(\"381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\")\n", + "print(\"or V2^1.4-0.140*V2^0.4-.022=0\")\n", + "print(\"by hit and trial it yields,V2=0.18 \")\n", + "V2=0.18;\n", + "print(\"thus compression ratio,r=V1/V2\")\n", + "r=V1/V2\n", + "print(\"otto cycle efficiency,n_otto=1-(1/r)^(y-1)\")\n", + "n_otto=1-(1/r)**(y-1)\n", + "print(\"in percentage\")\n", + "n_otto=n_otto*100\n", + "print(\"b> for mixed or dual cycle\")\n", + "print(\"Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\")\n", + "print(\"or T3_a-T2_a=850/Cv\")\n", + "850/Cv\n", + "print(\"or T2_a=T3_a-1197.2 .............eq4 \")\n", + "print(\"also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\")\n", + "print(\"P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\")\n", + "print(\"or P2_a/(T3_a-1197.2)=5000/T3_a\")\n", + "print(\"also we had seen earlier that T3_a=17064.8*V2_a\")\n", + "print(\"so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\")\n", + "print(\"so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\")\n", + "print(\"or for adiabatic process,1-2_a\")\n", + "print(\"P1*V1^y=P2*V2^y\")\n", + "print(\"so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\")\n", + "print(\"or V2_a^1.4-0.07*V2_a^0.4-0.022=0\")\n", + "print(\"by hit and trial \")\n", + "print(\"V2_a=0.122 m^3\")\n", + "V2_a=0.122;\n", + "print(\"therefore upon substituting V2_a,\")\n", + "print(\"by eq 5,P2_a in KPa\")\n", + "P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a)\n", + "print(\"by eq 2,T3_a in K\")\n", + "T3_a=17064.8*V2_a\n", + "print(\"by eq 4,T2_a in K\")\n", + "T2_a=T3_a-1197.2\n", + "print(\"from constant pressure heat addition\")\n", + "print(\"Cp*(T4_a-T3_a)=850\")\n", + "print(\"so T4_a=T3_a+(850/Cp) in K\")\n", + "T4_a=T3_a+(850/Cp)\n", + "print(\"also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\")\n", + "print(\"so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \")\n", + "print(\"here P3_a=P4_a and V2_a=V3_a\")\n", + "V4_a=V2_a*T4_a/(T3_a)\n", + "print(\"using adiabatic formulations V4_a=0.172 m^3\")\n", + "print(\"(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\")\n", + "V5=V1;\n", + "print(\"so T5=T4_a/(V5/V4_a)^(y-1) in K\")\n", + "T5=T4_a/(V5/V4_a)**(y-1)\n", + "print(\"heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\")\n", + "Q51=Cv*(T5-T1)\n", + "n_mixed=(Q23-Q51)/Q23\n", + "print(\"efficiency of mixed cycle(n_mixed)=\"),round(n_mixed,2)\n", + "print(\"in percentage\"),round(n_mixed*100,2)\n", + "(\"NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.4;pg no: 341" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.4, Page:341 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\n", + "optimum pressure ratio for maximum work output,\n", + "rp=(T_max/T_min)^((y)/(2*(y-1)))\n", + "so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\n", + "so T2=T1*(p2/p1)^((y-1)/y)in K\n", + "For process 3-4,\n", + "T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\n", + "so T4=T3/(rp)^((y-1)/y)in K\n", + "heat supplied,Q23=Cp*(T3-T2)in KJ/kg\n", + "compressor work,Wc in KJ/kg= 301.5\n", + "turbine work,Wt in KJ/kg= 603.0\n", + "thermal efficiency=net work/heat supplied= 0.5\n", + "so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,turbine and compressor work\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.4, Page:341 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\")\n", + "T3=1200;#maximum temperature in K\n", + "T1=300;#minimum temperature in K\n", + "y=1.4;#expansion constant\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"optimum pressure ratio for maximum work output,\")\n", + "print(\"rp=(T_max/T_min)^((y)/(2*(y-1)))\")\n", + "T_max=T3;\n", + "T_min=T1;\n", + "rp=(T_max/T_min)**((y)/(2*(y-1)))\n", + "print(\"so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\")\n", + "print(\"so T2=T1*(p2/p1)^((y-1)/y)in K\")\n", + "T2=T1*(rp)**((y-1)/y)\n", + "print(\"For process 3-4,\")\n", + "print(\"T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\")\n", + "print(\"so T4=T3/(rp)^((y-1)/y)in K\")\n", + "T4=T3/(rp)**((y-1)/y)\n", + "print(\"heat supplied,Q23=Cp*(T3-T2)in KJ/kg\")\n", + "Q23=Cp*(T3-T2)\n", + "Wc=Cp*(T2-T1)\n", + "print(\"compressor work,Wc in KJ/kg=\"),round(Wc,2)\n", + "Wt=Cp*(T3-T4)\n", + "print(\"turbine work,Wt in KJ/kg=\"),round(Wt,2)\n", + "(Wt-Wc)/Q23\n", + "print(\"thermal efficiency=net work/heat supplied=\"),round((Wt-Wc)/Q23,2)\n", + "print(\"so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.5;pg no: 342" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.5, Page:342 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\n", + "gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\n", + "for process 1-2 being isentropic,\n", + "T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y) in K\n", + "considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\n", + "so T2_a=T1+((T2-T1)/n_compr)in K\n", + "during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\n", + "heat added=mf*q\n", + "=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\n", + "or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\n", + "so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\n", + "for expansion 3-4 being\n", + "T4/T3=(P4/P3)^((n-1)/n)\n", + "so T4=T3*(P4/P3)^((n-1)/n) in K\n", + "actaul temperature at turbine inlet considering internal efficiency of turbine,\n", + "n_turb=(T3-T4_a)/(T3-T4)\n", + "so T4_a=T3-(n_turb*(T3-T4)) in K\n", + "compressor work,per kg of air compressed(Wc) in KJ/kg of air= 234.42\n", + "so compressor work=234.42 KJ/kg of air\n", + "turbine work,per kg of air compressed(Wt) in KJ/kg of air= 414.71\n", + "so turbine work=414.71 KJ/kg of air\n", + "net work(W_net) in KJ/kg of air= 180.29\n", + "heat supplied(Q) in KJ/kg of air= 751.16\n", + "thermal efficiency(n)= 0.24\n", + "in percentage 24.0\n", + "so thermal efficiency=24%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,turbine and compressor work\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.5, Page:342 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\")\n", + "P1=1*10**5;#initial pressure in Pa\n", + "P4=P1;#constant pressure process\n", + "T1=300;#initial temperature in K\n", + "P2=6.2*10**5;#pressure after compression in Pa\n", + "P3=P2;#constant pressure process\n", + "k=0.017;#fuel to air ratio\n", + "n_compr=0.88;#compressor efficiency\n", + "q=44186;#heating value of fuel in KJ/kg\n", + "n_turb=0.9;#turbine internal efficiency\n", + "Cp_comb=1.147;#specific heat of combustion at constant pressure in KJ/kg K\n", + "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", + "y=1.4;#expansion constant\n", + "n=1.33;#expansion constant for polytropic constant\n", + "print(\"gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\")\n", + "print(\"for process 1-2 being isentropic,\")\n", + "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", + "T2=T1*(P2/P1)**((y-1)/y)\n", + "print(\"considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\")\n", + "print(\"so T2_a=T1+((T2-T1)/n_compr)in K\")\n", + "T2_a=T1+((T2-T1)/n_compr)\n", + "print(\"during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\")\n", + "print(\"heat added=mf*q\")\n", + "print(\"=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\")\n", + "print(\"or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\")\n", + "print(\"so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\")\n", + "T3=((k)*q+(Cp_air*T2_a))/((1+(k))*Cp_comb)\n", + "print(\"for expansion 3-4 being\")\n", + "print(\"T4/T3=(P4/P3)^((n-1)/n)\")\n", + "print(\"so T4=T3*(P4/P3)^((n-1)/n) in K\")\n", + "T4=T3*(P4/P3)**((n-1)/n)\n", + "print(\"actaul temperature at turbine inlet considering internal efficiency of turbine,\")\n", + "print(\"n_turb=(T3-T4_a)/(T3-T4)\")\n", + "print(\"so T4_a=T3-(n_turb*(T3-T4)) in K\")\n", + "T4_a=T3-(n_turb*(T3-T4))\n", + "Wc=Cp_air*(T2_a-T1)\n", + "print(\"compressor work,per kg of air compressed(Wc) in KJ/kg of air=\"),round(Wc,2)\n", + "print(\"so compressor work=234.42 KJ/kg of air\")\n", + "Wt=Cp_comb*(T3-T4_a)\n", + "print(\"turbine work,per kg of air compressed(Wt) in KJ/kg of air=\"),round(Wt,2)\n", + "print(\"so turbine work=414.71 KJ/kg of air\")\n", + "W_net=Wt-Wc\n", + "print(\"net work(W_net) in KJ/kg of air=\"),round(W_net,2)\n", + "Q=k*q\n", + "print(\"heat supplied(Q) in KJ/kg of air=\"),round(Q,2)\n", + "n=W_net/Q\n", + "print(\"thermal efficiency(n)=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so thermal efficiency=24%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.6;pg no: 343" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.6, Page:343 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\n", + "NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\n", + "overall pressure ratio(rp)= 13.59\n", + "so overall optimum pressure ratio=13.6\n" + ] + } + ], + "source": [ + "#cal of overall optimum pressure ratio\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.6, Page:343 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\")\n", + "T1=300;#minimum temperature in brayton cycle in K\n", + "T5=1200;#maximum temperature in brayton cycle in K\n", + "n_isen_c=0.85;#isentropic efficiency of compressor\n", + "n_isen_t=0.9;#isentropic efficiency of turbine\n", + "y=1.4;#expansion constant\n", + "print(\"NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\")\n", + "rp=(T1/(T5*n_isen_c*n_isen_t))**((2*y)/(3*(1-y)))\n", + "print(\"overall pressure ratio(rp)=\"),round(rp,2)\n", + "print(\"so overall optimum pressure ratio=13.6\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.7;pg no: 346" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.7, Page:346 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\n", + "i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\n", + "therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\n", + "or P9/P1=k=(1.35)^8 11.03\n", + "or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\n", + "T9/T1=(P9/P1)^((y-1)/y)\n", + "so T9 in K= 621.47\n", + "considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\n", + "(T9-T1)/(T9_actual-T1)=0.82\n", + "so T9_actual=T1+((T9-T1)/0.82) in K 689.19\n", + "let the actual index of compression be n, then\n", + "(T9_actual/T1)=(P9/P1)^((n-1)/n)\n", + "so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\n", + "so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\n", + "ii> let polytropic efficiency be n_polytropic for compressor then,\n", + "(n-1)/n=((y-1)/y)*(1/n_polytropic)\n", + "so n_polytropic= 0.87\n", + "in percentage 86.9\n", + "so ploytropic efficiency=86.88%\n", + "iii> stage efficiency can be estimated for any stage.say first stage.\n", + "ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y) in K\n", + "actual temperature at exit of first stage can be estimated using polytropic index 1.49.\n", + "T2_actual/T1=(P2/P1)^((n-1)/n)\n", + "so T2_actual=T1*(P2/P1)^((n-1)/n) in K\n", + "stage efficiency for first stage,ns_1= 0.86\n", + "in percentage 86.33\n", + "actual temperature at exit of second stage,\n", + "T3_actual/T2_actual=(P3/P2)^((n-1)/n)\n", + "so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\n", + "ideal temperature at exit of second stage\n", + "T3/T2_actual=(P3/P2)^((n-1)/n)\n", + "so T3=T2_actual*(P3/P2)^((y-1)/y) in K\n", + "stage efficiency for second stage,ns_2= 0.86\n", + "in percentage 86.33\n", + "actual rtemperature at exit of third stage,\n", + "T4_actual/T3_actual=(P4/P3)^((n-1)/n)\n", + "so T4_actual in K= 420.83\n", + "ideal temperature at exit of third stage,\n", + "T4/T3_actual=(P4/P3)^((n-1)/n)\n", + "so T4 in K= 415.42\n", + "stage efficiency for third stage,ns_3= 0.86\n", + "in percentage= 8632.9\n", + "so stage efficiency=86.4%\n", + "iv> from steady flow energy equation,\n", + "Wc=dw=dh and dh=du+p*dv+v*dp\n", + "dh=dq+v*dp\n", + "dq=0 in adiabatic process\n", + "dh=v*dp\n", + "Wc=v*dp\n", + "here for polytropic compression \n", + "P*V^1.49=constant i.e n=1.49\n", + "Wc in KJ/s= 16419.87\n", + "due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s= 14777.89\n", + "so power required to drive compressor =14777.89 KJ/s\n" + ] + } + ], + "source": [ + "#cal of state of air at exit of compressor,polytropic efficiency,efficiency of each sate,power\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.7, Page:346 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\")\n", + "T1=313.;#air entering temperature in K\n", + "P1=1*10**5;#air entering pressure in Pa\n", + "m=50.;#flow rate through compressor in kg/s\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\")\n", + "print(\"therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\")\n", + "r=1.35;#compression ratio\n", + "k=(1.35)**8\n", + "print(\"or P9/P1=k=(1.35)^8\"),round(k,2)\n", + "k=11.03;#approx.\n", + "print(\"or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\")\n", + "y=1.4;#expansion constant \n", + "print(\"T9/T1=(P9/P1)^((y-1)/y)\")\n", + "T9=T1*(k)**((y-1)/y)\n", + "print(\"so T9 in K=\"),round(T9,2)\n", + "print(\"considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\")\n", + "print(\"(T9-T1)/(T9_actual-T1)=0.82\")\n", + "T9_actual=T1+((T9-T1)/0.82)\n", + "print(\"so T9_actual=T1+((T9-T1)/0.82) in K\"),round(T9_actual,2)\n", + "print(\"let the actual index of compression be n, then\")\n", + "print(\"(T9_actual/T1)=(P9/P1)^((n-1)/n)\")\n", + "print(\"so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\")\n", + "n=math.log(k)/(math.log(k)-math.log(T9_actual/T1))\n", + "print(\"so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\")\n", + "print(\"ii> let polytropic efficiency be n_polytropic for compressor then,\")\n", + "print(\"(n-1)/n=((y-1)/y)*(1/n_polytropic)\")\n", + "n_polytropic=((y-1)/y)/((n-1)/n)\n", + "print(\"so n_polytropic=\"),round(n_polytropic,2)\n", + "print(\"in percentage\"),round(n_polytropic*100,2)\n", + "print(\"so ploytropic efficiency=86.88%\")\n", + "print(\"iii> stage efficiency can be estimated for any stage.say first stage.\")\n", + "print(\"ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", + "T2=T1*(r)**((y-1)/y)\n", + "print(\"actual temperature at exit of first stage can be estimated using polytropic index 1.49.\")\n", + "print(\"T2_actual/T1=(P2/P1)^((n-1)/n)\")\n", + "print(\"so T2_actual=T1*(P2/P1)^((n-1)/n) in K\")\n", + "T2_actual=T1*(r)**((n-1)/n)\n", + "ns_1=(T2-T1)/(T2_actual-T1)\n", + "print(\"stage efficiency for first stage,ns_1=\"),round(ns_1,2)\n", + "print(\"in percentage\"),round(ns_1*100,2)\n", + "print(\"actual temperature at exit of second stage,\")\n", + "print(\"T3_actual/T2_actual=(P3/P2)^((n-1)/n)\")\n", + "print(\"so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\")\n", + "T3_actual=T2_actual*(r)**((n-1)/n)\n", + "print(\"ideal temperature at exit of second stage\")\n", + "print(\"T3/T2_actual=(P3/P2)^((n-1)/n)\")\n", + "print(\"so T3=T2_actual*(P3/P2)^((y-1)/y) in K\")\n", + "T3=T2_actual*(r)**((y-1)/y)\n", + "ns_2=(T3-T2_actual)/(T3_actual-T2_actual)\n", + "print(\"stage efficiency for second stage,ns_2=\"),round(ns_2,2)\n", + "print(\"in percentage\"),round(ns_2*100,2)\n", + "print(\"actual rtemperature at exit of third stage,\")\n", + "print(\"T4_actual/T3_actual=(P4/P3)^((n-1)/n)\")\n", + "T4_actual=T3_actual*(r)**((n-1)/n)\n", + "print(\"so T4_actual in K=\"),round(T4_actual,2)\n", + "print(\"ideal temperature at exit of third stage,\")\n", + "print(\"T4/T3_actual=(P4/P3)^((n-1)/n)\")\n", + "T4=T3_actual*(r)**((y-1)/y)\n", + "print(\"so T4 in K=\"),round(T4,2)\n", + "ns_3=(T4-T3_actual)/(T4_actual-T3_actual)\n", + "print(\"stage efficiency for third stage,ns_3=\"),round(ns_3,2)\n", + "ns_3=ns_3*100\n", + "print(\"in percentage=\"),round(ns_3*100,2)\n", + "print(\"so stage efficiency=86.4%\")\n", + "print(\"iv> from steady flow energy equation,\")\n", + "print(\"Wc=dw=dh and dh=du+p*dv+v*dp\")\n", + "print(\"dh=dq+v*dp\")\n", + "print(\"dq=0 in adiabatic process\")\n", + "print(\"dh=v*dp\")\n", + "print(\"Wc=v*dp\")\n", + "print(\"here for polytropic compression \")\n", + "print(\"P*V^1.49=constant i.e n=1.49\")\n", + "n=1.49;\n", + "Wc=(n/(n-1))*m*R*T1*(((k)**((n-1)/n))-1)\n", + "print(\"Wc in KJ/s=\"),round(Wc,2)\n", + "Wc_actual=Wc*0.9\n", + "print(\"due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s=\"),round(Wc*0.9,2)\n", + "print(\"so power required to drive compressor =14777.89 KJ/s\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.8;pg no: 349" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.8, Page:349 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\n", + "In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.8, Page:349 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\")\n", + "print(\"In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.9;pg no: 350" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.9, Page:350 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\n", + "using polytropic efficiency the index of compression and expansion can be obtained as under,\n", + "let compression index be nc,\n", + "(nc-1)/nc=(y-1)/(y*n_poly_c)\n", + "so nc=1/(1-((y-1)/(y*n_poly_c)))\n", + "let expansion index be nt,\n", + "(nt-1)/nt=(n_poly_T*(y-1))/y\n", + "so nt=1/(1-((n_poly_T*(y-1))/y))\n", + "For process 1-2\n", + "T2/T1=(p2/p1)^((nc-1)/nc)\n", + "so T2=T1*(p2/p1)^((nc-1)/nc)in K\n", + "also T4/T3=(p4/p3)^((nt-1)/nt)\n", + "so T4=T3*(p4/p3)^((nt-1)/nt)in K\n", + "using heat exchanger effectivenesss,\n", + "epsilon=(T5-T2)/(T4-T2)\n", + "so T5=T2+(epsilon*(T4-T2))in K\n", + "heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\n", + "compressor work,Wc=Cp*(T2-T1)in \n", + "turbine work,Wt=Cp*(T3-T4)in KJ/kg\n", + "cycle efficiency= 0.33\n", + "in percentage 32.79\n", + "work ratio= 0.33\n", + "specific work output in KJ/kg= 152.56\n", + "so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of cycle efficiency,work ratio,specific work output\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.9, Page:350 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\")\n", + "y=1.4;#expansion constant\n", + "n_poly_c=0.85;#ploytropic efficiency of compressor\n", + "n_poly_T=0.90;#ploytropic efficiency of Turbine\n", + "r=8.;#compression ratio\n", + "T1=(27.+273.);#temperature of air in compressor in K\n", + "T3=1100.;#temperature of air leaving combustion chamber in K\n", + "epsilon=0.8;#effectiveness of heat exchanger\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "print(\"using polytropic efficiency the index of compression and expansion can be obtained as under,\")\n", + "print(\"let compression index be nc,\")\n", + "print(\"(nc-1)/nc=(y-1)/(y*n_poly_c)\")\n", + "print(\"so nc=1/(1-((y-1)/(y*n_poly_c)))\")\n", + "nc=1/(1-((y-1)/(y*n_poly_c)))\n", + "print(\"let expansion index be nt,\")\n", + "print(\"(nt-1)/nt=(n_poly_T*(y-1))/y\")\n", + "print(\"so nt=1/(1-((n_poly_T*(y-1))/y))\")\n", + "nt=1/(1-((n_poly_T*(y-1))/y))\n", + "print(\"For process 1-2\")\n", + "print(\"T2/T1=(p2/p1)^((nc-1)/nc)\")\n", + "print(\"so T2=T1*(p2/p1)^((nc-1)/nc)in K\")\n", + "T2=T1*(r)**((nc-1)/nc)\n", + "print(\"also T4/T3=(p4/p3)^((nt-1)/nt)\")\n", + "print(\"so T4=T3*(p4/p3)^((nt-1)/nt)in K\")\n", + "T4=T3*(1/r)**((nt-1)/nt)\n", + "print(\"using heat exchanger effectivenesss,\") \n", + "print(\"epsilon=(T5-T2)/(T4-T2)\")\n", + "print(\"so T5=T2+(epsilon*(T4-T2))in K\")\n", + "T5=T2+(epsilon*(T4-T2))\n", + "print(\"heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\")\n", + "q_add=Cp*(T3-T5)\n", + "print(\"compressor work,Wc=Cp*(T2-T1)in \")\n", + "Wc=Cp*(T2-T1)\n", + "print(\"turbine work,Wt=Cp*(T3-T4)in KJ/kg\")\n", + "Wt=Cp*(T3-T4)\n", + "(Wt-Wc)/q_add\n", + "print(\"cycle efficiency=\"),round((Wt-Wc)/q_add,2)\n", + "print(\"in percentage\"),round((Wt-Wc)*100/q_add,2)\n", + "(Wt-Wc)/Wt\n", + "print(\"work ratio=\"),round((Wt-Wc)/Wt,2)\n", + "print(\"specific work output in KJ/kg=\"),round(Wt-Wc,2)\n", + "print(\"so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.10;pg no: 351" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.10, Page:351 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\n", + "for process 1-2_a\n", + "T2_a/T1=(p2_a/p1)^((y-1)/y)\n", + "so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\n", + "nc=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+((T2_a-T1)/nc) in K\n", + "for process 3-4_a,\n", + "T4_a/T3=(p4/p3)^((y-1)/y)\n", + "so T4_a=T3*(p4/p3)^((y-1)/y)in K\n", + "Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", + "Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\n", + "net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\n", + "heat added,q_add=Cp*(T3-T2) in KJ/kg\n", + "thermal efficiency,n=W_net/q_add\n", + "n={Wc-(Cp*(T3-T4))}/q_add\n", + "so T4=T3-((Wc-(n*q_add))/Cp)in K\n", + "therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a) 0.297\n", + "in percentage 29.7\n", + "so turbine isentropic efficiency=29.69%\n" + ] + } + ], + "source": [ + "#cal of isentropic efficiency of turbine\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.10, Page:351 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\")\n", + "T1=(27+273);#temperature of air in compressor in K\n", + "p1=1*10**5;#pressure of air in compressor in Pa\n", + "p2=5*10**5;#pressure of air after compression in Pa\n", + "p3=p2-0.2*10**5;#pressure drop in Pa\n", + "p4=1*10**5;#pressure to which expansion occur in turbine in Pa\n", + "nc=0.85;#isentropic efficiency\n", + "T3=1000;#temperature of air in combustion chamber in K\n", + "n=0.2;#thermal efficiency of plant\n", + "y=1.4;#expansion constant\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "print(\"for process 1-2_a\")\n", + "print(\"T2_a/T1=(p2_a/p1)^((y-1)/y)\")\n", + "print(\"so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\")\n", + "T2_a=T1*(p2/p1)**((y-1)/y)\n", + "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+((T2_a-T1)/nc) in K\")\n", + "T2=T1+((T2_a-T1)/nc)\n", + "print(\"for process 3-4_a,\")\n", + "print(\"T4_a/T3=(p4/p3)^((y-1)/y)\")\n", + "print(\"so T4_a=T3*(p4/p3)^((y-1)/y)in K\")\n", + "T4_a=T3*(p4/p3)**((y-1)/y)\n", + "print(\"Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", + "Wc=Cp*(T2-T1)\n", + "print(\"Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\")\n", + "print(\"net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\")\n", + "print(\"heat added,q_add=Cp*(T3-T2) in KJ/kg\")\n", + "q_add=Cp*(T3-T2)\n", + "print(\"thermal efficiency,n=W_net/q_add\")\n", + "print(\"n={Wc-(Cp*(T3-T4))}/q_add\")\n", + "print(\"so T4=T3-((Wc-(n*q_add))/Cp)in K\")\n", + "T4=T3-((Wc-(n*q_add))/Cp)\n", + "nt=(T3-T4)/(T3-T4_a)\n", + "print(\"therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a)\"),round((T3-T4)/(T3-T4_a),3)\n", + "print(\"in percentage\"),round(nt*100,2)\n", + "print(\"so turbine isentropic efficiency=29.69%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.11;pg no: 352" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.11, Page:352 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\n", + "for perfect intercooling the pressure ratio of each compression stage(k)\n", + "k=sqrt(r)\n", + "for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\n", + "so T2_a=T1*(k)^((y-1)/y)in K\n", + "considering isentropic efficiency of compression,\n", + "nc=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+((T2_a-T1)/nc)in K\n", + "for process 3-4,\n", + "T4_a/T3=(P4/P3)^((y-1)/y)\n", + "so T4_a=T3*(P4/P3)^((y-1)/y) in K\n", + "again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\n", + "so T4=T3+((T4_a-T3)/nc)in K\n", + "total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\n", + "for expansion process 5-6_a,\n", + "T6_a/T5=(P6/P5)^((y-1)/y)\n", + "so T6_a=T5*(P6/P5)^((y-1)/y) in K\n", + "considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\n", + "T6=T5-(ne*(T5-T6_a)) in K\n", + "for expansion in 7-8_a\n", + "T8_a/T7=(P8/P7)^((y-1)/y)\n", + "so T8_a=T7*(P8/P7)^((y-1)/y) in K\n", + "considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\n", + "so T8=T7-(ne*(T7-T8_a))in K\n", + "expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\n", + "heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\n", + "fuel required per kg of air,mf=q_add/C 0.02\n", + "air-fuel ratio=1/mf 51.08\n", + "net output(W) in KJ/kg= 229.2\n", + "output for air flowing at 30 kg/s,=W*m in KW 6876.05\n", + "thermal efficiency= 0.28\n", + "in percentage 27.88\n", + "so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\n", + "NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,net output,A/F ratio\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.11, Page:352 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\")\n", + "P1=1.*10**5;#initial pressure in Pa\n", + "T1=(27.+273.);#initial temperature in K\n", + "T3=T1;\n", + "r=10.;#pressure ratio\n", + "T5=1000.;#maximum temperature in cycle in K\n", + "P6=3.*10**5;#first stage expansion pressure in Pa\n", + "T7=995.;#first stage reheated temperature in K\n", + "C=42000.;#calorific value of fuel in KJ/kg\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "m=30.;#air flow rate in kg/s\n", + "nc=0.85;#isentropic efficiency of compression\n", + "ne=0.9;#isentropic efficiency of expansion\n", + "y=1.4;#expansion constant\n", + "print(\"for perfect intercooling the pressure ratio of each compression stage(k)\")\n", + "print(\"k=sqrt(r)\")\n", + "k=math.sqrt(r)\n", + "k=3.16;#approx.\n", + "print(\"for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2_a=T1*(k)^((y-1)/y)in K\")\n", + "T2_a=T1*(k)**((y-1)/y)\n", + "print(\"considering isentropic efficiency of compression,\")\n", + "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+((T2_a-T1)/nc)in K\")\n", + "T2=T1+((T2_a-T1)/nc)\n", + "print(\"for process 3-4,\")\n", + "print(\"T4_a/T3=(P4/P3)^((y-1)/y)\")\n", + "print(\"so T4_a=T3*(P4/P3)^((y-1)/y) in K\")\n", + "T4_a=T3*(k)**((y-1)/y)\n", + "print(\"again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\")\n", + "print(\"so T4=T3+((T4_a-T3)/nc)in K\")\n", + "T4=T3+((T4_a-T3)/nc)\n", + "print(\"total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\")\n", + "Wc=2*Cp*(T4-T3)\n", + "print(\"for expansion process 5-6_a,\")\n", + "print(\"T6_a/T5=(P6/P5)^((y-1)/y)\")\n", + "print(\"so T6_a=T5*(P6/P5)^((y-1)/y) in K\")\n", + "P5=10.*10**5;#pressure in Pa\n", + "T6_a=T5*(P6/P5)**((y-1)/y)\n", + "print(\"considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\")\n", + "print(\"T6=T5-(ne*(T5-T6_a)) in K\")\n", + "T6=T5-(ne*(T5-T6_a))\n", + "print(\"for expansion in 7-8_a\")\n", + "print(\"T8_a/T7=(P8/P7)^((y-1)/y)\")\n", + "print(\"so T8_a=T7*(P8/P7)^((y-1)/y) in K\")\n", + "P8=P1;#constant pressure process\n", + "P7=P6;#constant pressure process\n", + "T8_a=T7*(P8/P7)**((y-1)/y)\n", + "print(\"considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\")\n", + "print(\"so T8=T7-(ne*(T7-T8_a))in K\")\n", + "T8=T7-(ne*(T7-T8_a))\n", + "print(\"expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\")\n", + "Wt=Cp*(T5-T6)+Cp*(T7-T8)\n", + "print(\"heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\")\n", + "q_add=Cp*(T5-T4)+Cp*(T7-T6)\n", + "mf=q_add/C\n", + "print(\"fuel required per kg of air,mf=q_add/C\"),round(q_add/C,2)\n", + "print(\"air-fuel ratio=1/mf\"),round(1/mf,2)\n", + "W=Wt-Wc\n", + "print(\"net output(W) in KJ/kg=\"),round(Wt-Wc,2)\n", + "print(\"output for air flowing at 30 kg/s,=W*m in KW\"),round(W*m,2)\n", + "W/q_add\n", + "print(\"thermal efficiency=\"),round(W/q_add,2)\n", + "print(\"in percentage\"),round(W*100/q_add,2)\n", + "print(\"so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\")\n", + "print(\"NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.12;pg no: 354" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.12, Page:354 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\n", + "for process 1-2,\n", + "T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y) in K\n", + "for process 3-4,\n", + "T4/T3=(P4/P3)^((y-1)/y)\n", + "so T4=T3*(P4/P3)^((y-1)/y) in K\n", + "for process 6-7,\n", + "T7/T6=(P7/P6)^((y-1)/y)\n", + "so T7=T6*(P7/P6)^((y-1)/y) in K\n", + "for process 8-9,\n", + "T9/T8=(P9/P8)^((y-1)/y)\n", + "T9=T8*(P9/P8)^((y-1)/y) in K\n", + "in regenerator,effectiveness=(T5-T4)/(T9-T4)\n", + "T5=T4+(ne*(T9-T4))in K\n", + "compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\n", + "turbine work per kg air,Wt in KJ/kg= 660.84\n", + "heat added per kg air,q_add in KJ/kg= 765.43\n", + "total fuel required per kg of air= 0.02\n", + "net work,W_net in KJ/kg= 450.85\n", + "cycle thermal efficiency,n= 0.59\n", + "in percentage 58.9\n", + "fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C= 0.0056\n", + "fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C= 0.0126\n", + "so fuel-air ratio in two combustion chambers=0.0126,0.0056\n", + "total turbine work=660.85 KJ/kg\n", + "cycle thermal efficiency=58.9%\n", + "NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \n" + ] + } + ], + "source": [ + "#cal of fuel-air ratio in two combustion chambers,total turbine work,cycle thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.12, Page:354 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\")\n", + "P1=1.*10**5;#initial pressure in Pa\n", + "P9=P1;\n", + "T1=300.;#initial temperature in K\n", + "P2=4.*10**5;#pressure of air in intercooler in Pa\n", + "P3=P2;\n", + "T3=290.;#temperature of air in intercooler in K\n", + "T6=1300.;#temperature of combustion chamber in K\n", + "P4=8.*10**5;#pressure of air after compression in Pa\n", + "P6=P4;\n", + "T8=1300.;#temperature after reheating in K\n", + "P8=4.*10**5;#pressure after expansion in Pa\n", + "P7=P8;\n", + "C=42000.;#heating value of fuel in KJ/kg\n", + "y=1.4;#expansion constant\n", + "ne=0.8;#effectiveness of regenerator\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "print(\"for process 1-2,\")\n", + "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", + "T2=T1*(P2/P1)**((y-1)/y)\n", + "print(\"for process 3-4,\")\n", + "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", + "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", + "T4=T3*(P4/P3)**((y-1)/y)\n", + "print(\"for process 6-7,\")\n", + "print(\"T7/T6=(P7/P6)^((y-1)/y)\")\n", + "print(\"so T7=T6*(P7/P6)^((y-1)/y) in K\")\n", + "T7=T6*(P7/P6)**((y-1)/y)\n", + "print(\"for process 8-9,\")\n", + "print(\"T9/T8=(P9/P8)^((y-1)/y)\")\n", + "print(\"T9=T8*(P9/P8)^((y-1)/y) in K\")\n", + "T9=T8*(P9/P8)**((y-1)/y)\n", + "print(\"in regenerator,effectiveness=(T5-T4)/(T9-T4)\")\n", + "print(\"T5=T4+(ne*(T9-T4))in K\")\n", + "T5=T4+(ne*(T9-T4))\n", + "print(\"compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\")\n", + "Wc=Cp*(T2-T1)+Cp*(T4-T3)\n", + "Wt=Cp*(T6-T7)+Cp*(T8-T9)\n", + "print(\"turbine work per kg air,Wt in KJ/kg=\"),round(Wt,2)\n", + "q_add=Cp*(T6-T5)+Cp*(T8-T7)\n", + "print(\"heat added per kg air,q_add in KJ/kg=\"),round(q_add,2)\n", + "q_add/C\n", + "print(\"total fuel required per kg of air=\"),round(q_add/C,2)\n", + "W_net=Wt-Wc\n", + "print(\"net work,W_net in KJ/kg=\"),round(W_net,2)\n", + "n=W_net/q_add\n", + "print(\"cycle thermal efficiency,n=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C=\"),round(Cp*(T8-T7)/C,4)\n", + "print(\"fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C=\"),round(Cp*(T6-T5)/C,4)\n", + "print(\"so fuel-air ratio in two combustion chambers=0.0126,0.0056\")\n", + "print(\"total turbine work=660.85 KJ/kg\")\n", + "print(\"cycle thermal efficiency=58.9%\")\n", + "print(\"NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.13;pg no: 356" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.13, Page:356 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\n", + "work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\n", + "heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\n", + "for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\n", + "mass of air per cycle=m/n in kg/cycle\n", + "brake output in KW= 17.12\n", + "stroke volume,V in m^3= 0.0117\n", + "brake output=17.11 KW\n", + "stroke volume=0.0116 m^3\n" + ] + } + ], + "source": [ + "#cal of brake output,stroke volume\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.13, Page:356 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\")\n", + "T2=700.;#highest temperature of stirling engine in K\n", + "T1=300.;#lowest temperature of stirling engine in K\n", + "r=3.;#compression ratio\n", + "q_add=30.;#heat addition in KJ/s\n", + "epsilon=0.9;#regenerator efficiency\n", + "P=1*10**5;#pressure at begining of compression in Pa\n", + "n=100.;#number of cycle per minute\n", + "Cv=0.72;#specific heat at constant volume in KJ/kg K\n", + "R=29.27;#gas constant in KJ/kg K\n", + "print(\"work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\")\n", + "W=R*(T2-T1)*math.log(r)\n", + "print(\"heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\")\n", + "q=R*T2*math.log(r)+(1-epsilon)*Cv*(T2-T1)\n", + "print(\"for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\")\n", + "m=q_add/q\n", + "print(\"mass of air per cycle=m/n in kg/cycle\")\n", + "m/n\n", + "print(\"brake output in KW=\"),round(W*m,2)\n", + "m=1.33*10**-4;#mass of air per cycle in kg/cycle\n", + "T=T1;\n", + "V=m*R*T*1000/P\n", + "print(\"stroke volume,V in m^3=\"),round(V,4)\n", + "print(\"brake output=17.11 KW\")\n", + "print(\"stroke volume=0.0116 m^3\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.14;pg no: 357" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.14, Page:357 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\n", + "In question no.14,various expression is derived which cannot be solved using python software.\n" + ] + } + ], + "source": [ + "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.14, Page:357 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\")\n", + "print(\"In question no.14,various expression is derived which cannot be solved using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.15;pg no: 361" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.15, Page:361 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\n", + "In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y)in K\n", + "T4/T3=(P4/P3)^((y-1)/y)\n", + "so T4=T3*(P4/P3)^((y-1)/y) in K\n", + "compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", + "turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \n", + "heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \n", + "net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\n", + "heat recovered in HRSG for steam generation per kg of air\n", + "q_HRGC=Cp*(T4-T5)in KJ/kg\n", + "at inlet to steam in turbine,\n", + "from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\n", + "for expansion in steam turbine,sa=sb\n", + "let dryness fraction at state b be x\n", + "also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\n", + "sb=sf+x*sfg\n", + "so x=(sb-sf)/sfg \n", + "so hb=hf+x*hfg in KJ/kg K\n", + "at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\n", + "at exit of feed pump,hd=hd-hc\n", + "hd=vc*(Pg-Pc)*100 in KJ/kg\n", + "heat added per kg of steam =ha-hd in KJ/kg\n", + "mass of steam generated per kg of air in kg steam per kg air= 0.119\n", + "net steam turbine cycle output,W_net_ST in KJ/kg= 677.4\n", + "steam cycle output per kg of air(W_net_ST) in KJ/kg air= 80.61\n", + "total combined cycle output in KJ/kg air= 486.88\n", + "combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add 0.58\n", + "in percentage 57.77\n", + "In absence of steam cycle,gas turbine cycle efficiency,n_GT= 0.48\n", + "in percentage 48.21\n", + "thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\n", + "overall efficiency=57.77%\n", + "steam per kg of air=0.119 kg steam per/kg air\n" + ] + } + ], + "source": [ + "#cal of overall efficiency,steam per kg of air\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.15, Page:361 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\")\n", + "r=10.;#pressure ratio\n", + "Cp=1.0032;#specific heat of air in KJ/kg K\n", + "y=1.4;#expansion constant\n", + "T3=1400.;#inlet temperature of gas turbine in K\n", + "T1=(17.+273.);#ambient temperature in K\n", + "P1=1.*10**5;#ambient pressure in Pa\n", + "Pc=15.;#condensor pressure in KPa\n", + "Pg=6.*1000;#pressure of steam in generator in KPa\n", + "T5=420.;#temperature of exhaust from gas turbine in K\n", + "print(\"In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y)in K\")\n", + "T2=T1*(r)**((y-1)/y)\n", + "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", + "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", + "T4=T3*(1/r)**((y-1)/y)\n", + "print(\"compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", + "Wc=Cp*(T2-T1)\n", + "print(\"turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \")\n", + "Wt=Cp*(T3-T4)\n", + "print(\"heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \")\n", + "q_add=Cp*(T3-T2)\n", + "print(\"net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\")\n", + "W_net_GT=Wt-Wc\n", + "print(\"heat recovered in HRSG for steam generation per kg of air\")\n", + "print(\"q_HRGC=Cp*(T4-T5)in KJ/kg\")\n", + "q_HRGC=Cp*(T4-T5)\n", + "print(\"at inlet to steam in turbine,\")\n", + "print(\"from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\")\n", + "ha=3177.2;\n", + "sa=6.5408;\n", + "print(\"for expansion in steam turbine,sa=sb\")\n", + "sb=sa;\n", + "print(\"let dryness fraction at state b be x\")\n", + "print(\"also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\")\n", + "sf=0.7549;\n", + "sfg=7.2536;\n", + "hf=225.94;\n", + "hfg=2373.1;\n", + "print(\"sb=sf+x*sfg\")\n", + "print(\"so x=(sb-sf)/sfg \")\n", + "x=(sb-sf)/sfg\n", + "print(\"so hb=hf+x*hfg in KJ/kg K\")\n", + "hb=hf+x*hfg\n", + "print(\"at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\")\n", + "hc=hf;\n", + "vc=0.001014;\n", + "print(\"at exit of feed pump,hd=hd-hc\")\n", + "print(\"hd=vc*(Pg-Pc)*100 in KJ/kg\")\n", + "hd=vc*(Pg-Pc)*100\n", + "print(\"heat added per kg of steam =ha-hd in KJ/kg\")\n", + "ha-hd\n", + "print(\"mass of steam generated per kg of air in kg steam per kg air=\"),round(q_HRGC/(ha-hd),3)\n", + "W_net_ST=(ha-hb)-(hd-hc)\n", + "print(\"net steam turbine cycle output,W_net_ST in KJ/kg=\"),round(W_net_ST,2)\n", + "W_net_ST=W_net_ST*0.119 \n", + "print(\"steam cycle output per kg of air(W_net_ST) in KJ/kg air=\"),round(W_net_ST,2)\n", + "(W_net_GT+W_net_ST)\n", + "print(\"total combined cycle output in KJ/kg air= \"),round((W_net_GT+W_net_ST),2)\n", + "n_cc=(W_net_GT+W_net_ST)/q_add\n", + "print(\"combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add\"),round(n_cc,2)\n", + "print(\"in percentage\"),round(n_cc*100,2)\n", + "n_GT=W_net_GT/q_add\n", + "print(\"In absence of steam cycle,gas turbine cycle efficiency,n_GT=\"),round(n_GT,2)\n", + "print(\"in percentage\"),round(n_GT*100,2)\n", + "print(\"thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\")\n", + "print(\"overall efficiency=57.77%\")\n", + "print(\"steam per kg of air=0.119 kg steam per/kg air\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.16;pg no: 363" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.16, Page:363 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\n", + "here P4/P1=P3/P1=70............eq1\n", + "compression ratio,V1/V2=V1/V3=15.............eq2\n", + "heat added at constant volume= heat added at constant pressure\n", + "Q23=Q34\n", + "m*Cv*(T3-T2)=m*Cp*(T4-T3)\n", + "(T3-T2)=y*(T4-T3)\n", + "for process 1-2;\n", + "T2/T1=(P2/P1)^((y-1)/y)\n", + "T2/T1=(V1/V2)^(y-1)\n", + "so T2=T1*(V1/V2)^(y-1) in K\n", + "and (P2/P1)=(V1/V2)^y\n", + "so P2=P1*(V1/V2)^y in Pa...........eq3\n", + "for process 2-3,\n", + "P2/P3=T2/T3\n", + "so T3=T2*P3/P2\n", + "using eq 1 and 3,we get\n", + "T3=T2*k/r^y in K\n", + "using equal heat additions for processes 2-3 and 3-4,\n", + "(T3-T2)=y*(T4-T3)\n", + "so T4=T3+((T3-T2)/y) in K\n", + "for process 3-4,\n", + "V3/V4=T3/T4\n", + "(V3/V1)*(V1/V4)=T3/T4\n", + "so (V1/V4)=(T3/T4)*r\n", + "so V1/V4=11.88 and V5/V4=11.88\n", + "for process 4-5,\n", + "P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\n", + "so T5=T4/((V5/V4)^(y-1))\n", + "air standard thermal efficiency(n)=1-(heat rejected/heat added)\n", + "n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\n", + "n= 0.65\n", + "air standard thermal efficiency=0.6529\n", + "in percentage 65.29\n", + "so air standard thermal efficiency=65.29%\n", + "Actual thermal efficiency may be different from theoretical efficiency due to following reasons\n", + "a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\n", + "b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\n", + "c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\n" + ] + } + ], + "source": [ + "#cal of air standard thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.16, Page:363 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\")\n", + "T1=(27+273);#temperature at begining of compression in K\n", + "k=70;#ration of maximum to minimum pressures\n", + "r=15;#compression ratio\n", + "y=1.4;#expansion constant\n", + "print(\"here P4/P1=P3/P1=70............eq1\")\n", + "print(\"compression ratio,V1/V2=V1/V3=15.............eq2\")\n", + "print(\"heat added at constant volume= heat added at constant pressure\")\n", + "print(\"Q23=Q34\")\n", + "print(\"m*Cv*(T3-T2)=m*Cp*(T4-T3)\")\n", + "print(\"(T3-T2)=y*(T4-T3)\")\n", + "print(\"for process 1-2;\")\n", + "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"T2/T1=(V1/V2)^(y-1)\")\n", + "print(\"so T2=T1*(V1/V2)^(y-1) in K\")\n", + "T2=T1*(r)**(y-1)\n", + "print(\"and (P2/P1)=(V1/V2)^y\")\n", + "print(\"so P2=P1*(V1/V2)^y in Pa...........eq3\")\n", + "print(\"for process 2-3,\")\n", + "print(\"P2/P3=T2/T3\")\n", + "print(\"so T3=T2*P3/P2\")\n", + "print(\"using eq 1 and 3,we get\")\n", + "print(\"T3=T2*k/r^y in K\")\n", + "T3=T2*k/r**y \n", + "print(\"using equal heat additions for processes 2-3 and 3-4,\")\n", + "print(\"(T3-T2)=y*(T4-T3)\")\n", + "print(\"so T4=T3+((T3-T2)/y) in K\")\n", + "T4=T3+((T3-T2)/y)\n", + "print(\"for process 3-4,\")\n", + "print(\"V3/V4=T3/T4\")\n", + "print(\"(V3/V1)*(V1/V4)=T3/T4\")\n", + "print(\"so (V1/V4)=(T3/T4)*r\")\n", + "(T3/T4)*r\n", + "print(\"so V1/V4=11.88 and V5/V4=11.88\")\n", + "print(\"for process 4-5,\")\n", + "print(\"P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\")\n", + "print(\"so T5=T4/((V5/V4)^(y-1))\")\n", + "T5=T4/(11.88)**(y-1)\n", + "print(\"air standard thermal efficiency(n)=1-(heat rejected/heat added)\")\n", + "print(\"n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\")\n", + "n=1-((T5-T1)/(y*(T4-T3)+(T3-T2)))\n", + "print(\"n=\"),round(n,2)\n", + "print(\"air standard thermal efficiency=0.6529\")\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so air standard thermal efficiency=65.29%\")\n", + "print(\"Actual thermal efficiency may be different from theoretical efficiency due to following reasons\")\n", + "print(\"a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\")\n", + "print(\"b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\")\n", + "print(\"c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter9_3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter9_3.ipynb new file mode 100755 index 00000000..606321b3 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter9_3.ipynb @@ -0,0 +1,1655 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 9:Gas Power Cycles" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.1;pg no: 334" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.1, Page:334 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\n", + "SI engine operate on otto cycle.consider working fluid to be perfect gas.\n", + "here,y=Cp/Cv\n", + "Cp-Cv=R in KJ/kg K\n", + "compression ratio,r=V1/V2=(0.15+V2)/V2\n", + "so V2=0.15/(r-1) in m^3\n", + "so V2=0.03 m^3\n", + "total cylinder volume=V1=r*V2 m^3\n", + "from perfect gas law,P*V=m*R*T\n", + "so m=P1*V1/(R*T1) in kg\n", + "from state 1 to 2 by P*V^y=P2*V2^y\n", + "so P2=P1*(V1/V2)^y in KPa\n", + "also,P1*V1/T1=P2*V2/T2\n", + "so T2=P2*V2*T1/(P1*V1)in K\n", + "from heat addition process 2-3\n", + "Q23=m*CV*(T3-T2)\n", + "T3=T2+(Q23/(m*Cv))in K\n", + "also from,P3*V3/T3=P2*V2/T2\n", + "P3=P2*V2*T3/(V3*T2) in KPa\n", + "for adiabatic expansion 3-4,\n", + "P3*V3^y=P4*V4^y\n", + "and V4=V1\n", + "hence,P4=P3*V3^y/V1^y in KPa\n", + "and from P3*V3/T3=P4*V4/T4\n", + "T4=P4*V4*T3/(P3*V3) in K\n", + "entropy change from 2-3 and 4-1 are same,and can be given as,\n", + "S3-S2=S4-S1=m*Cv*log(T4/T1)\n", + "so entropy change,deltaS_32=deltaS_41 in KJ/K\n", + "heat rejected,Q41=m*Cv*(T4-T1) in KJ\n", + "net work(W) in KJ= 76.75\n", + "efficiency(n)= 0.51\n", + "in percentage 51.16\n", + "mean effective pressure(mep)=work/volume change in KPa= 511.64\n", + "so mep=511.67 KPa\n" + ] + } + ], + "source": [ + "#cal of mean effective pressure\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.1, Page:334 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\")\n", + "Cp=1;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", + "P1=98;#pressure at begining of compression in KPa\n", + "T1=(60+273.15);#temperature at begining of compression in K\n", + "Q23=150;#heat supplied in KJ/kg\n", + "r=6;#compression ratio\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"SI engine operate on otto cycle.consider working fluid to be perfect gas.\")\n", + "print(\"here,y=Cp/Cv\")\n", + "y=Cp/Cv\n", + "y=1.4;#approx.\n", + "print(\"Cp-Cv=R in KJ/kg K\")\n", + "R=Cp-Cv\n", + "print(\"compression ratio,r=V1/V2=(0.15+V2)/V2\")\n", + "print(\"so V2=0.15/(r-1) in m^3\")\n", + "V2=0.15/(r-1)\n", + "print(\"so V2=0.03 m^3\")\n", + "print(\"total cylinder volume=V1=r*V2 m^3\")\n", + "V1=r*V2\n", + "print(\"from perfect gas law,P*V=m*R*T\")\n", + "print(\"so m=P1*V1/(R*T1) in kg\")\n", + "m=P1*V1/(R*T1)\n", + "m=0.183;#approx.\n", + "print(\"from state 1 to 2 by P*V^y=P2*V2^y\")\n", + "print(\"so P2=P1*(V1/V2)^y in KPa\")\n", + "P2=P1*(V1/V2)**y\n", + "print(\"also,P1*V1/T1=P2*V2/T2\")\n", + "print(\"so T2=P2*V2*T1/(P1*V1)in K\")\n", + "T2=P2*V2*T1/(P1*V1)\n", + "print(\"from heat addition process 2-3\")\n", + "print(\"Q23=m*CV*(T3-T2)\")\n", + "print(\"T3=T2+(Q23/(m*Cv))in K\")\n", + "T3=T2+(Q23/(m*Cv))\n", + "print(\"also from,P3*V3/T3=P2*V2/T2\")\n", + "print(\"P3=P2*V2*T3/(V3*T2) in KPa\")\n", + "V3=V2;#constant volume process\n", + "P3=P2*V2*T3/(V3*T2) \n", + "print(\"for adiabatic expansion 3-4,\")\n", + "print(\"P3*V3^y=P4*V4^y\")\n", + "print(\"and V4=V1\")\n", + "V4=V1;\n", + "print(\"hence,P4=P3*V3^y/V1^y in KPa\")\n", + "P4=P3*V3**y/V1**y\n", + "print(\"and from P3*V3/T3=P4*V4/T4\")\n", + "print(\"T4=P4*V4*T3/(P3*V3) in K\")\n", + "T4=P4*V4*T3/(P3*V3)\n", + "print(\"entropy change from 2-3 and 4-1 are same,and can be given as,\")\n", + "print(\"S3-S2=S4-S1=m*Cv*log(T4/T1)\")\n", + "print(\"so entropy change,deltaS_32=deltaS_41 in KJ/K\")\n", + "deltaS_32=m*Cv*math.log(T4/T1)\n", + "deltaS_41=deltaS_32;\n", + "print(\"heat rejected,Q41=m*Cv*(T4-T1) in KJ\")\n", + "Q41=m*Cv*(T4-T1)\n", + "W=Q23-Q41\n", + "print(\"net work(W) in KJ=\"),round(W,2)\n", + "n=W/Q23\n", + "print(\"efficiency(n)=\"),round(W/Q23,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "mep=W/0.15\n", + "print(\"mean effective pressure(mep)=work/volume change in KPa=\"),round(W/0.15,2)\n", + "print(\"so mep=511.67 KPa\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.2;pg no: 336" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.2, Page:336 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\n", + "as given\n", + "Va=V2+(7/8)*(V1-V2)\n", + "Vb=V2+(1/8)*(V1-V2)\n", + "and also\n", + "Pa*Va^y=Pb*Vb^y\n", + "so (Va/Vb)=(Pb/Pa)^(1/y)\n", + "also substituting for Va and Vb\n", + "(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\n", + "so V1/V2=r=1+(4.18*8/1.82) 19.37\n", + "it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\n", + "as given;cut off occurs at(V1-V2)/15 volume\n", + "V3=V2+(V1-V2)/15\n", + "cut off ratio,rho=V3/V2\n", + "air standard efficiency for diesel cycle(n_airstandard)= 0.63\n", + "in percentage 63.23\n", + "overall efficiency(n_overall)=n_airstandard*n_ite*n_mech 0.253\n", + "in percentage 25.3\n", + "fuel consumption,bhp/hr in kg= 0.26\n", + "so compression ratio=19.37\n", + "air standard efficiency=63.25%\n", + "fuel consumption,bhp/hr=0.255 kg\n" + ] + } + ], + "source": [ + "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.2, Page:336 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\")\n", + "Pa=138;#pressure during compression at 1/8 of stroke in KPa\n", + "Pb=1.38*10**3;#pressure during compression at 7/8 of stroke in KPa\n", + "n_ite=0.5;#indicated thermal efficiency\n", + "n_mech=0.8;#mechanical efficiency\n", + "C=41800;#calorific value in KJ/kg\n", + "y=1.4;#expansion constant\n", + "print(\"as given\")\n", + "print(\"Va=V2+(7/8)*(V1-V2)\")\n", + "print(\"Vb=V2+(1/8)*(V1-V2)\")\n", + "print(\"and also\")\n", + "print(\"Pa*Va^y=Pb*Vb^y\")\n", + "print(\"so (Va/Vb)=(Pb/Pa)^(1/y)\")\n", + "(Pb/Pa)**(1/y)\n", + "print(\"also substituting for Va and Vb\")\n", + "print(\"(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\")\n", + "r=1+(4.18*8/1.82)\n", + "print(\"so V1/V2=r=1+(4.18*8/1.82)\"),round(r,2)\n", + "print(\"it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\")\n", + "print(\"as given;cut off occurs at(V1-V2)/15 volume\")\n", + "print(\"V3=V2+(V1-V2)/15\")\n", + "print(\"cut off ratio,rho=V3/V2\")\n", + "rho=1+(r-1)/15\n", + "n_airstandard=1-(1/(r**(y-1)*y))*((rho**y-1)/(rho-1))\n", + "print(\"air standard efficiency for diesel cycle(n_airstandard)=\"),round(n_airstandard,2)\n", + "print(\"in percentage\"),round(n_airstandard*100,2)\n", + "n_airstandard=0.6325;\n", + "n_overall=n_airstandard*n_ite*n_mech\n", + "print(\"overall efficiency(n_overall)=n_airstandard*n_ite*n_mech\"),round(n_overall,3)\n", + "print(\"in percentage\"),round(n_overall*100,2)\n", + "n_overall=0.253;\n", + "75*60*60/(n_overall*C*100)\n", + "print(\"fuel consumption,bhp/hr in kg=\"),round(75*60*60/(n_overall*C*100),2)\n", + "print(\"so compression ratio=19.37\")\n", + "print(\"air standard efficiency=63.25%\")\n", + "print(\"fuel consumption,bhp/hr=0.255 kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.3;pg no: 338" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.3, Page:338 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\n", + "1-2-3-4=cycle a\n", + "1-2_a-3_a-4_a-5=cycle b\n", + "here Cp/Cv=y\n", + "and R=0.293 KJ/kg K\n", + "let us consider 1 kg of air for perfect gas,\n", + "P*V=m*R*T\n", + "so V1=m*R*T1/P1 in m^3\n", + "at state 3,\n", + "P3*V3=m*R*T3\n", + "so T3/V2=P3/(m*R)\n", + "so T3=17064.8*V2............eq1\n", + "for cycle a and also for cycle b\n", + "T3_a=17064.8*V2_a.............eq2\n", + "a> for otto cycle,\n", + "Q23=Cv*(T3-T2)\n", + "so T3-T2=Q23/Cv\n", + "and T2=T3-2394.36.............eq3\n", + "from gas law,P2*V2/T2=P3*V3/T3\n", + "here V2=V3 and using eq 3,we get\n", + "so P2/(T3-2394.36)=5000/T3\n", + "substituting T3 as function of V2\n", + "P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\n", + "P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\n", + "also P1*V1^y=P2*V2^y\n", + "or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\n", + "upon solving it yields\n", + "381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\n", + "or V2^1.4-0.140*V2^0.4-.022=0\n", + "by hit and trial it yields,V2=0.18 \n", + "thus compression ratio,r=V1/V2\n", + "otto cycle efficiency,n_otto=1-(1/r)^(y-1)\n", + "in percentage\n", + "b> for mixed or dual cycle\n", + "Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\n", + "or T3_a-T2_a=850/Cv\n", + "or T2_a=T3_a-1197.2 .............eq4 \n", + "also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\n", + "P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\n", + "or P2_a/(T3_a-1197.2)=5000/T3_a\n", + "also we had seen earlier that T3_a=17064.8*V2_a\n", + "so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\n", + "so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\n", + "or for adiabatic process,1-2_a\n", + "P1*V1^y=P2*V2^y\n", + "so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\n", + "or V2_a^1.4-0.07*V2_a^0.4-0.022=0\n", + "by hit and trial \n", + "V2_a=0.122 m^3\n", + "therefore upon substituting V2_a,\n", + "by eq 5,P2_a in KPa\n", + "by eq 2,T3_a in K\n", + "by eq 4,T2_a in K\n", + "from constant pressure heat addition\n", + "Cp*(T4_a-T3_a)=850\n", + "so T4_a=T3_a+(850/Cp) in K\n", + "also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\n", + "so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \n", + "here P3_a=P4_a and V2_a=V3_a\n", + "using adiabatic formulations V4_a=0.172 m^3\n", + "(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\n", + "so T5=T4_a/(V5/V4_a)^(y-1) in K\n", + "heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\n", + "efficiency of mixed cycle(n_mixed)= 0.57\n", + "in percentage 56.55\n" + ] + }, + { + "data": { + "text/plain": [ + "'NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.'" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#cal of comparing efficiency of two cycles\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.3, Page:338 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\")\n", + "T1=(100+273.15);#temperature at beginning of compresssion in K\n", + "P1=103;#pressure at beginning of compresssion in KPa\n", + "Cp=1.003;#specific heat at constant pressure in KJ/kg K\n", + "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", + "Q23=1700;#heat added during combustion in KJ/kg\n", + "P3=5000;#maximum pressure in cylinder in KPa\n", + "print(\"1-2-3-4=cycle a\")\n", + "print(\"1-2_a-3_a-4_a-5=cycle b\")\n", + "print(\"here Cp/Cv=y\")\n", + "y=Cp/Cv\n", + "y=1.4;#approx.\n", + "print(\"and R=0.293 KJ/kg K\")\n", + "R=0.293;\n", + "print(\"let us consider 1 kg of air for perfect gas,\")\n", + "m=1;#mass of air in kg\n", + "print(\"P*V=m*R*T\")\n", + "print(\"so V1=m*R*T1/P1 in m^3\")\n", + "V1=m*R*T1/P1\n", + "print(\"at state 3,\")\n", + "print(\"P3*V3=m*R*T3\")\n", + "print(\"so T3/V2=P3/(m*R)\")\n", + "P3/(m*R)\n", + "print(\"so T3=17064.8*V2............eq1\")\n", + "print(\"for cycle a and also for cycle b\")\n", + "print(\"T3_a=17064.8*V2_a.............eq2\")\n", + "print(\"a> for otto cycle,\")\n", + "print(\"Q23=Cv*(T3-T2)\")\n", + "print(\"so T3-T2=Q23/Cv\")\n", + "Q23/Cv\n", + "print(\"and T2=T3-2394.36.............eq3\")\n", + "print(\"from gas law,P2*V2/T2=P3*V3/T3\")\n", + "print(\"here V2=V3 and using eq 3,we get\")\n", + "print(\"so P2/(T3-2394.36)=5000/T3\")\n", + "print(\"substituting T3 as function of V2\")\n", + "print(\"P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\")\n", + "print(\"P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\")\n", + "print(\"also P1*V1^y=P2*V2^y\")\n", + "print(\"or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\")\n", + "print(\"upon solving it yields\")\n", + "print(\"381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\")\n", + "print(\"or V2^1.4-0.140*V2^0.4-.022=0\")\n", + "print(\"by hit and trial it yields,V2=0.18 \")\n", + "V2=0.18;\n", + "print(\"thus compression ratio,r=V1/V2\")\n", + "r=V1/V2\n", + "print(\"otto cycle efficiency,n_otto=1-(1/r)^(y-1)\")\n", + "n_otto=1-(1/r)**(y-1)\n", + "print(\"in percentage\")\n", + "n_otto=n_otto*100\n", + "print(\"b> for mixed or dual cycle\")\n", + "print(\"Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\")\n", + "print(\"or T3_a-T2_a=850/Cv\")\n", + "850/Cv\n", + "print(\"or T2_a=T3_a-1197.2 .............eq4 \")\n", + "print(\"also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\")\n", + "print(\"P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\")\n", + "print(\"or P2_a/(T3_a-1197.2)=5000/T3_a\")\n", + "print(\"also we had seen earlier that T3_a=17064.8*V2_a\")\n", + "print(\"so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\")\n", + "print(\"so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\")\n", + "print(\"or for adiabatic process,1-2_a\")\n", + "print(\"P1*V1^y=P2*V2^y\")\n", + "print(\"so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\")\n", + "print(\"or V2_a^1.4-0.07*V2_a^0.4-0.022=0\")\n", + "print(\"by hit and trial \")\n", + "print(\"V2_a=0.122 m^3\")\n", + "V2_a=0.122;\n", + "print(\"therefore upon substituting V2_a,\")\n", + "print(\"by eq 5,P2_a in KPa\")\n", + "P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a)\n", + "print(\"by eq 2,T3_a in K\")\n", + "T3_a=17064.8*V2_a\n", + "print(\"by eq 4,T2_a in K\")\n", + "T2_a=T3_a-1197.2\n", + "print(\"from constant pressure heat addition\")\n", + "print(\"Cp*(T4_a-T3_a)=850\")\n", + "print(\"so T4_a=T3_a+(850/Cp) in K\")\n", + "T4_a=T3_a+(850/Cp)\n", + "print(\"also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\")\n", + "print(\"so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \")\n", + "print(\"here P3_a=P4_a and V2_a=V3_a\")\n", + "V4_a=V2_a*T4_a/(T3_a)\n", + "print(\"using adiabatic formulations V4_a=0.172 m^3\")\n", + "print(\"(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\")\n", + "V5=V1;\n", + "print(\"so T5=T4_a/(V5/V4_a)^(y-1) in K\")\n", + "T5=T4_a/(V5/V4_a)**(y-1)\n", + "print(\"heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\")\n", + "Q51=Cv*(T5-T1)\n", + "n_mixed=(Q23-Q51)/Q23\n", + "print(\"efficiency of mixed cycle(n_mixed)=\"),round(n_mixed,2)\n", + "print(\"in percentage\"),round(n_mixed*100,2)\n", + "(\"NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.4;pg no: 341" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.4, Page:341 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\n", + "optimum pressure ratio for maximum work output,\n", + "rp=(T_max/T_min)^((y)/(2*(y-1)))\n", + "so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\n", + "so T2=T1*(p2/p1)^((y-1)/y)in K\n", + "For process 3-4,\n", + "T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\n", + "so T4=T3/(rp)^((y-1)/y)in K\n", + "heat supplied,Q23=Cp*(T3-T2)in KJ/kg\n", + "compressor work,Wc in KJ/kg= 301.5\n", + "turbine work,Wt in KJ/kg= 603.0\n", + "thermal efficiency=net work/heat supplied= 0.5\n", + "so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,turbine and compressor work\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.4, Page:341 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\")\n", + "T3=1200;#maximum temperature in K\n", + "T1=300;#minimum temperature in K\n", + "y=1.4;#expansion constant\n", + "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", + "print(\"optimum pressure ratio for maximum work output,\")\n", + "print(\"rp=(T_max/T_min)^((y)/(2*(y-1)))\")\n", + "T_max=T3;\n", + "T_min=T1;\n", + "rp=(T_max/T_min)**((y)/(2*(y-1)))\n", + "print(\"so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\")\n", + "print(\"so T2=T1*(p2/p1)^((y-1)/y)in K\")\n", + "T2=T1*(rp)**((y-1)/y)\n", + "print(\"For process 3-4,\")\n", + "print(\"T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\")\n", + "print(\"so T4=T3/(rp)^((y-1)/y)in K\")\n", + "T4=T3/(rp)**((y-1)/y)\n", + "print(\"heat supplied,Q23=Cp*(T3-T2)in KJ/kg\")\n", + "Q23=Cp*(T3-T2)\n", + "Wc=Cp*(T2-T1)\n", + "print(\"compressor work,Wc in KJ/kg=\"),round(Wc,2)\n", + "Wt=Cp*(T3-T4)\n", + "print(\"turbine work,Wt in KJ/kg=\"),round(Wt,2)\n", + "(Wt-Wc)/Q23\n", + "print(\"thermal efficiency=net work/heat supplied=\"),round((Wt-Wc)/Q23,2)\n", + "print(\"so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.5;pg no: 342" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.5, Page:342 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\n", + "gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\n", + "for process 1-2 being isentropic,\n", + "T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y) in K\n", + "considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\n", + "so T2_a=T1+((T2-T1)/n_compr)in K\n", + "during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\n", + "heat added=mf*q\n", + "=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\n", + "or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\n", + "so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\n", + "for expansion 3-4 being\n", + "T4/T3=(P4/P3)^((n-1)/n)\n", + "so T4=T3*(P4/P3)^((n-1)/n) in K\n", + "actaul temperature at turbine inlet considering internal efficiency of turbine,\n", + "n_turb=(T3-T4_a)/(T3-T4)\n", + "so T4_a=T3-(n_turb*(T3-T4)) in K\n", + "compressor work,per kg of air compressed(Wc) in KJ/kg of air= 234.42\n", + "so compressor work=234.42 KJ/kg of air\n", + "turbine work,per kg of air compressed(Wt) in KJ/kg of air= 414.71\n", + "so turbine work=414.71 KJ/kg of air\n", + "net work(W_net) in KJ/kg of air= 180.29\n", + "heat supplied(Q) in KJ/kg of air= 751.16\n", + "thermal efficiency(n)= 0.24\n", + "in percentage 24.0\n", + "so thermal efficiency=24%\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,turbine and compressor work\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.5, Page:342 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\")\n", + "P1=1*10**5;#initial pressure in Pa\n", + "P4=P1;#constant pressure process\n", + "T1=300;#initial temperature in K\n", + "P2=6.2*10**5;#pressure after compression in Pa\n", + "P3=P2;#constant pressure process\n", + "k=0.017;#fuel to air ratio\n", + "n_compr=0.88;#compressor efficiency\n", + "q=44186;#heating value of fuel in KJ/kg\n", + "n_turb=0.9;#turbine internal efficiency\n", + "Cp_comb=1.147;#specific heat of combustion at constant pressure in KJ/kg K\n", + "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", + "y=1.4;#expansion constant\n", + "n=1.33;#expansion constant for polytropic constant\n", + "print(\"gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\")\n", + "print(\"for process 1-2 being isentropic,\")\n", + "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", + "T2=T1*(P2/P1)**((y-1)/y)\n", + "print(\"considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\")\n", + "print(\"so T2_a=T1+((T2-T1)/n_compr)in K\")\n", + "T2_a=T1+((T2-T1)/n_compr)\n", + "print(\"during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\")\n", + "print(\"heat added=mf*q\")\n", + "print(\"=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\")\n", + "print(\"or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\")\n", + "print(\"so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\")\n", + "T3=((k)*q+(Cp_air*T2_a))/((1+(k))*Cp_comb)\n", + "print(\"for expansion 3-4 being\")\n", + "print(\"T4/T3=(P4/P3)^((n-1)/n)\")\n", + "print(\"so T4=T3*(P4/P3)^((n-1)/n) in K\")\n", + "T4=T3*(P4/P3)**((n-1)/n)\n", + "print(\"actaul temperature at turbine inlet considering internal efficiency of turbine,\")\n", + "print(\"n_turb=(T3-T4_a)/(T3-T4)\")\n", + "print(\"so T4_a=T3-(n_turb*(T3-T4)) in K\")\n", + "T4_a=T3-(n_turb*(T3-T4))\n", + "Wc=Cp_air*(T2_a-T1)\n", + "print(\"compressor work,per kg of air compressed(Wc) in KJ/kg of air=\"),round(Wc,2)\n", + "print(\"so compressor work=234.42 KJ/kg of air\")\n", + "Wt=Cp_comb*(T3-T4_a)\n", + "print(\"turbine work,per kg of air compressed(Wt) in KJ/kg of air=\"),round(Wt,2)\n", + "print(\"so turbine work=414.71 KJ/kg of air\")\n", + "W_net=Wt-Wc\n", + "print(\"net work(W_net) in KJ/kg of air=\"),round(W_net,2)\n", + "Q=k*q\n", + "print(\"heat supplied(Q) in KJ/kg of air=\"),round(Q,2)\n", + "n=W_net/Q\n", + "print(\"thermal efficiency(n)=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so thermal efficiency=24%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.6;pg no: 343" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.6, Page:343 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\n", + "NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\n", + "overall pressure ratio(rp)= 13.59\n", + "so overall optimum pressure ratio=13.6\n" + ] + } + ], + "source": [ + "#cal of overall optimum pressure ratio\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.6, Page:343 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\")\n", + "T1=300;#minimum temperature in brayton cycle in K\n", + "T5=1200;#maximum temperature in brayton cycle in K\n", + "n_isen_c=0.85;#isentropic efficiency of compressor\n", + "n_isen_t=0.9;#isentropic efficiency of turbine\n", + "y=1.4;#expansion constant\n", + "print(\"NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\")\n", + "rp=(T1/(T5*n_isen_c*n_isen_t))**((2*y)/(3*(1-y)))\n", + "print(\"overall pressure ratio(rp)=\"),round(rp,2)\n", + "print(\"so overall optimum pressure ratio=13.6\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.7;pg no: 346" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.7, Page:346 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\n", + "i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\n", + "therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\n", + "or P9/P1=k=(1.35)^8 11.03\n", + "or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\n", + "T9/T1=(P9/P1)^((y-1)/y)\n", + "so T9 in K= 621.47\n", + "considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\n", + "(T9-T1)/(T9_actual-T1)=0.82\n", + "so T9_actual=T1+((T9-T1)/0.82) in K 689.19\n", + "let the actual index of compression be n, then\n", + "(T9_actual/T1)=(P9/P1)^((n-1)/n)\n", + "so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\n", + "so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\n", + "ii> let polytropic efficiency be n_polytropic for compressor then,\n", + "(n-1)/n=((y-1)/y)*(1/n_polytropic)\n", + "so n_polytropic= 0.87\n", + "in percentage 86.9\n", + "so ploytropic efficiency=86.88%\n", + "iii> stage efficiency can be estimated for any stage.say first stage.\n", + "ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y) in K\n", + "actual temperature at exit of first stage can be estimated using polytropic index 1.49.\n", + "T2_actual/T1=(P2/P1)^((n-1)/n)\n", + "so T2_actual=T1*(P2/P1)^((n-1)/n) in K\n", + "stage efficiency for first stage,ns_1= 0.86\n", + "in percentage 86.33\n", + "actual temperature at exit of second stage,\n", + "T3_actual/T2_actual=(P3/P2)^((n-1)/n)\n", + "so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\n", + "ideal temperature at exit of second stage\n", + "T3/T2_actual=(P3/P2)^((n-1)/n)\n", + "so T3=T2_actual*(P3/P2)^((y-1)/y) in K\n", + "stage efficiency for second stage,ns_2= 0.86\n", + "in percentage 86.33\n", + "actual rtemperature at exit of third stage,\n", + "T4_actual/T3_actual=(P4/P3)^((n-1)/n)\n", + "so T4_actual in K= 420.83\n", + "ideal temperature at exit of third stage,\n", + "T4/T3_actual=(P4/P3)^((n-1)/n)\n", + "so T4 in K= 415.42\n", + "stage efficiency for third stage,ns_3= 0.86\n", + "in percentage= 8632.9\n", + "so stage efficiency=86.4%\n", + "iv> from steady flow energy equation,\n", + "Wc=dw=dh and dh=du+p*dv+v*dp\n", + "dh=dq+v*dp\n", + "dq=0 in adiabatic process\n", + "dh=v*dp\n", + "Wc=v*dp\n", + "here for polytropic compression \n", + "P*V^1.49=constant i.e n=1.49\n", + "Wc in KJ/s= 16419.87\n", + "due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s= 14777.89\n", + "so power required to drive compressor =14777.89 KJ/s\n" + ] + } + ], + "source": [ + "#cal of state of air at exit of compressor,polytropic efficiency,efficiency of each sate,power\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.7, Page:346 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\")\n", + "T1=313.;#air entering temperature in K\n", + "P1=1*10**5;#air entering pressure in Pa\n", + "m=50.;#flow rate through compressor in kg/s\n", + "R=0.287;#gas constant in KJ/kg K\n", + "print(\"i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\")\n", + "print(\"therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\")\n", + "r=1.35;#compression ratio\n", + "k=(1.35)**8\n", + "print(\"or P9/P1=k=(1.35)^8\"),round(k,2)\n", + "k=11.03;#approx.\n", + "print(\"or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\")\n", + "y=1.4;#expansion constant \n", + "print(\"T9/T1=(P9/P1)^((y-1)/y)\")\n", + "T9=T1*(k)**((y-1)/y)\n", + "print(\"so T9 in K=\"),round(T9,2)\n", + "print(\"considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\")\n", + "print(\"(T9-T1)/(T9_actual-T1)=0.82\")\n", + "T9_actual=T1+((T9-T1)/0.82)\n", + "print(\"so T9_actual=T1+((T9-T1)/0.82) in K\"),round(T9_actual,2)\n", + "print(\"let the actual index of compression be n, then\")\n", + "print(\"(T9_actual/T1)=(P9/P1)^((n-1)/n)\")\n", + "print(\"so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\")\n", + "n=math.log(k)/(math.log(k)-math.log(T9_actual/T1))\n", + "print(\"so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\")\n", + "print(\"ii> let polytropic efficiency be n_polytropic for compressor then,\")\n", + "print(\"(n-1)/n=((y-1)/y)*(1/n_polytropic)\")\n", + "n_polytropic=((y-1)/y)/((n-1)/n)\n", + "print(\"so n_polytropic=\"),round(n_polytropic,2)\n", + "print(\"in percentage\"),round(n_polytropic*100,2)\n", + "print(\"so ploytropic efficiency=86.88%\")\n", + "print(\"iii> stage efficiency can be estimated for any stage.say first stage.\")\n", + "print(\"ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", + "T2=T1*(r)**((y-1)/y)\n", + "print(\"actual temperature at exit of first stage can be estimated using polytropic index 1.49.\")\n", + "print(\"T2_actual/T1=(P2/P1)^((n-1)/n)\")\n", + "print(\"so T2_actual=T1*(P2/P1)^((n-1)/n) in K\")\n", + "T2_actual=T1*(r)**((n-1)/n)\n", + "ns_1=(T2-T1)/(T2_actual-T1)\n", + "print(\"stage efficiency for first stage,ns_1=\"),round(ns_1,2)\n", + "print(\"in percentage\"),round(ns_1*100,2)\n", + "print(\"actual temperature at exit of second stage,\")\n", + "print(\"T3_actual/T2_actual=(P3/P2)^((n-1)/n)\")\n", + "print(\"so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\")\n", + "T3_actual=T2_actual*(r)**((n-1)/n)\n", + "print(\"ideal temperature at exit of second stage\")\n", + "print(\"T3/T2_actual=(P3/P2)^((n-1)/n)\")\n", + "print(\"so T3=T2_actual*(P3/P2)^((y-1)/y) in K\")\n", + "T3=T2_actual*(r)**((y-1)/y)\n", + "ns_2=(T3-T2_actual)/(T3_actual-T2_actual)\n", + "print(\"stage efficiency for second stage,ns_2=\"),round(ns_2,2)\n", + "print(\"in percentage\"),round(ns_2*100,2)\n", + "print(\"actual rtemperature at exit of third stage,\")\n", + "print(\"T4_actual/T3_actual=(P4/P3)^((n-1)/n)\")\n", + "T4_actual=T3_actual*(r)**((n-1)/n)\n", + "print(\"so T4_actual in K=\"),round(T4_actual,2)\n", + "print(\"ideal temperature at exit of third stage,\")\n", + "print(\"T4/T3_actual=(P4/P3)^((n-1)/n)\")\n", + "T4=T3_actual*(r)**((y-1)/y)\n", + "print(\"so T4 in K=\"),round(T4,2)\n", + "ns_3=(T4-T3_actual)/(T4_actual-T3_actual)\n", + "print(\"stage efficiency for third stage,ns_3=\"),round(ns_3,2)\n", + "ns_3=ns_3*100\n", + "print(\"in percentage=\"),round(ns_3*100,2)\n", + "print(\"so stage efficiency=86.4%\")\n", + "print(\"iv> from steady flow energy equation,\")\n", + "print(\"Wc=dw=dh and dh=du+p*dv+v*dp\")\n", + "print(\"dh=dq+v*dp\")\n", + "print(\"dq=0 in adiabatic process\")\n", + "print(\"dh=v*dp\")\n", + "print(\"Wc=v*dp\")\n", + "print(\"here for polytropic compression \")\n", + "print(\"P*V^1.49=constant i.e n=1.49\")\n", + "n=1.49;\n", + "Wc=(n/(n-1))*m*R*T1*(((k)**((n-1)/n))-1)\n", + "print(\"Wc in KJ/s=\"),round(Wc,2)\n", + "Wc_actual=Wc*0.9\n", + "print(\"due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s=\"),round(Wc*0.9,2)\n", + "print(\"so power required to drive compressor =14777.89 KJ/s\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.8;pg no: 349" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.8, Page:349 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\n", + "In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\n" + ] + } + ], + "source": [ + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.8, Page:349 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\")\n", + "print(\"In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.9;pg no: 350" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.9, Page:350 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\n", + "using polytropic efficiency the index of compression and expansion can be obtained as under,\n", + "let compression index be nc,\n", + "(nc-1)/nc=(y-1)/(y*n_poly_c)\n", + "so nc=1/(1-((y-1)/(y*n_poly_c)))\n", + "let expansion index be nt,\n", + "(nt-1)/nt=(n_poly_T*(y-1))/y\n", + "so nt=1/(1-((n_poly_T*(y-1))/y))\n", + "For process 1-2\n", + "T2/T1=(p2/p1)^((nc-1)/nc)\n", + "so T2=T1*(p2/p1)^((nc-1)/nc)in K\n", + "also T4/T3=(p4/p3)^((nt-1)/nt)\n", + "so T4=T3*(p4/p3)^((nt-1)/nt)in K\n", + "using heat exchanger effectivenesss,\n", + "epsilon=(T5-T2)/(T4-T2)\n", + "so T5=T2+(epsilon*(T4-T2))in K\n", + "heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\n", + "compressor work,Wc=Cp*(T2-T1)in \n", + "turbine work,Wt=Cp*(T3-T4)in KJ/kg\n", + "cycle efficiency= 0.33\n", + "in percentage 32.79\n", + "work ratio= 0.33\n", + "specific work output in KJ/kg= 152.56\n", + "so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\n" + ] + } + ], + "source": [ + "#cal of cycle efficiency,work ratio,specific work output\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.9, Page:350 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\")\n", + "y=1.4;#expansion constant\n", + "n_poly_c=0.85;#ploytropic efficiency of compressor\n", + "n_poly_T=0.90;#ploytropic efficiency of Turbine\n", + "r=8.;#compression ratio\n", + "T1=(27.+273.);#temperature of air in compressor in K\n", + "T3=1100.;#temperature of air leaving combustion chamber in K\n", + "epsilon=0.8;#effectiveness of heat exchanger\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "print(\"using polytropic efficiency the index of compression and expansion can be obtained as under,\")\n", + "print(\"let compression index be nc,\")\n", + "print(\"(nc-1)/nc=(y-1)/(y*n_poly_c)\")\n", + "print(\"so nc=1/(1-((y-1)/(y*n_poly_c)))\")\n", + "nc=1/(1-((y-1)/(y*n_poly_c)))\n", + "print(\"let expansion index be nt,\")\n", + "print(\"(nt-1)/nt=(n_poly_T*(y-1))/y\")\n", + "print(\"so nt=1/(1-((n_poly_T*(y-1))/y))\")\n", + "nt=1/(1-((n_poly_T*(y-1))/y))\n", + "print(\"For process 1-2\")\n", + "print(\"T2/T1=(p2/p1)^((nc-1)/nc)\")\n", + "print(\"so T2=T1*(p2/p1)^((nc-1)/nc)in K\")\n", + "T2=T1*(r)**((nc-1)/nc)\n", + "print(\"also T4/T3=(p4/p3)^((nt-1)/nt)\")\n", + "print(\"so T4=T3*(p4/p3)^((nt-1)/nt)in K\")\n", + "T4=T3*(1/r)**((nt-1)/nt)\n", + "print(\"using heat exchanger effectivenesss,\") \n", + "print(\"epsilon=(T5-T2)/(T4-T2)\")\n", + "print(\"so T5=T2+(epsilon*(T4-T2))in K\")\n", + "T5=T2+(epsilon*(T4-T2))\n", + "print(\"heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\")\n", + "q_add=Cp*(T3-T5)\n", + "print(\"compressor work,Wc=Cp*(T2-T1)in \")\n", + "Wc=Cp*(T2-T1)\n", + "print(\"turbine work,Wt=Cp*(T3-T4)in KJ/kg\")\n", + "Wt=Cp*(T3-T4)\n", + "(Wt-Wc)/q_add\n", + "print(\"cycle efficiency=\"),round((Wt-Wc)/q_add,2)\n", + "print(\"in percentage\"),round((Wt-Wc)*100/q_add,2)\n", + "(Wt-Wc)/Wt\n", + "print(\"work ratio=\"),round((Wt-Wc)/Wt,2)\n", + "print(\"specific work output in KJ/kg=\"),round(Wt-Wc,2)\n", + "print(\"so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.10;pg no: 351" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.10, Page:351 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\n", + "for process 1-2_a\n", + "T2_a/T1=(p2_a/p1)^((y-1)/y)\n", + "so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\n", + "nc=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+((T2_a-T1)/nc) in K\n", + "for process 3-4_a,\n", + "T4_a/T3=(p4/p3)^((y-1)/y)\n", + "so T4_a=T3*(p4/p3)^((y-1)/y)in K\n", + "Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", + "Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\n", + "net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\n", + "heat added,q_add=Cp*(T3-T2) in KJ/kg\n", + "thermal efficiency,n=W_net/q_add\n", + "n={Wc-(Cp*(T3-T4))}/q_add\n", + "so T4=T3-((Wc-(n*q_add))/Cp)in K\n", + "therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a) 0.297\n", + "in percentage 29.7\n", + "so turbine isentropic efficiency=29.69%\n" + ] + } + ], + "source": [ + "#cal of isentropic efficiency of turbine\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.10, Page:351 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\")\n", + "T1=(27+273);#temperature of air in compressor in K\n", + "p1=1*10**5;#pressure of air in compressor in Pa\n", + "p2=5*10**5;#pressure of air after compression in Pa\n", + "p3=p2-0.2*10**5;#pressure drop in Pa\n", + "p4=1*10**5;#pressure to which expansion occur in turbine in Pa\n", + "nc=0.85;#isentropic efficiency\n", + "T3=1000;#temperature of air in combustion chamber in K\n", + "n=0.2;#thermal efficiency of plant\n", + "y=1.4;#expansion constant\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "print(\"for process 1-2_a\")\n", + "print(\"T2_a/T1=(p2_a/p1)^((y-1)/y)\")\n", + "print(\"so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\")\n", + "T2_a=T1*(p2/p1)**((y-1)/y)\n", + "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+((T2_a-T1)/nc) in K\")\n", + "T2=T1+((T2_a-T1)/nc)\n", + "print(\"for process 3-4_a,\")\n", + "print(\"T4_a/T3=(p4/p3)^((y-1)/y)\")\n", + "print(\"so T4_a=T3*(p4/p3)^((y-1)/y)in K\")\n", + "T4_a=T3*(p4/p3)**((y-1)/y)\n", + "print(\"Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", + "Wc=Cp*(T2-T1)\n", + "print(\"Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\")\n", + "print(\"net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\")\n", + "print(\"heat added,q_add=Cp*(T3-T2) in KJ/kg\")\n", + "q_add=Cp*(T3-T2)\n", + "print(\"thermal efficiency,n=W_net/q_add\")\n", + "print(\"n={Wc-(Cp*(T3-T4))}/q_add\")\n", + "print(\"so T4=T3-((Wc-(n*q_add))/Cp)in K\")\n", + "T4=T3-((Wc-(n*q_add))/Cp)\n", + "nt=(T3-T4)/(T3-T4_a)\n", + "print(\"therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a)\"),round((T3-T4)/(T3-T4_a),3)\n", + "print(\"in percentage\"),round(nt*100,2)\n", + "print(\"so turbine isentropic efficiency=29.69%\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.11;pg no: 352" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.11, Page:352 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\n", + "for perfect intercooling the pressure ratio of each compression stage(k)\n", + "k=sqrt(r)\n", + "for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\n", + "so T2_a=T1*(k)^((y-1)/y)in K\n", + "considering isentropic efficiency of compression,\n", + "nc=(T2_a-T1)/(T2-T1)\n", + "so T2=T1+((T2_a-T1)/nc)in K\n", + "for process 3-4,\n", + "T4_a/T3=(P4/P3)^((y-1)/y)\n", + "so T4_a=T3*(P4/P3)^((y-1)/y) in K\n", + "again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\n", + "so T4=T3+((T4_a-T3)/nc)in K\n", + "total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\n", + "for expansion process 5-6_a,\n", + "T6_a/T5=(P6/P5)^((y-1)/y)\n", + "so T6_a=T5*(P6/P5)^((y-1)/y) in K\n", + "considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\n", + "T6=T5-(ne*(T5-T6_a)) in K\n", + "for expansion in 7-8_a\n", + "T8_a/T7=(P8/P7)^((y-1)/y)\n", + "so T8_a=T7*(P8/P7)^((y-1)/y) in K\n", + "considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\n", + "so T8=T7-(ne*(T7-T8_a))in K\n", + "expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\n", + "heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\n", + "fuel required per kg of air,mf=q_add/C 0.02\n", + "air-fuel ratio=1/mf 51.08\n", + "net output(W) in KJ/kg= 229.2\n", + "output for air flowing at 30 kg/s,=W*m in KW 6876.05\n", + "thermal efficiency= 0.28\n", + "in percentage 27.88\n", + "so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\n", + "NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\n" + ] + } + ], + "source": [ + "#cal of thermal efficiency,net output,A/F ratio\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.11, Page:352 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\")\n", + "P1=1.*10**5;#initial pressure in Pa\n", + "T1=(27.+273.);#initial temperature in K\n", + "T3=T1;\n", + "r=10.;#pressure ratio\n", + "T5=1000.;#maximum temperature in cycle in K\n", + "P6=3.*10**5;#first stage expansion pressure in Pa\n", + "T7=995.;#first stage reheated temperature in K\n", + "C=42000.;#calorific value of fuel in KJ/kg\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "m=30.;#air flow rate in kg/s\n", + "nc=0.85;#isentropic efficiency of compression\n", + "ne=0.9;#isentropic efficiency of expansion\n", + "y=1.4;#expansion constant\n", + "print(\"for perfect intercooling the pressure ratio of each compression stage(k)\")\n", + "print(\"k=sqrt(r)\")\n", + "k=math.sqrt(r)\n", + "k=3.16;#approx.\n", + "print(\"for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2_a=T1*(k)^((y-1)/y)in K\")\n", + "T2_a=T1*(k)**((y-1)/y)\n", + "print(\"considering isentropic efficiency of compression,\")\n", + "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", + "print(\"so T2=T1+((T2_a-T1)/nc)in K\")\n", + "T2=T1+((T2_a-T1)/nc)\n", + "print(\"for process 3-4,\")\n", + "print(\"T4_a/T3=(P4/P3)^((y-1)/y)\")\n", + "print(\"so T4_a=T3*(P4/P3)^((y-1)/y) in K\")\n", + "T4_a=T3*(k)**((y-1)/y)\n", + "print(\"again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\")\n", + "print(\"so T4=T3+((T4_a-T3)/nc)in K\")\n", + "T4=T3+((T4_a-T3)/nc)\n", + "print(\"total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\")\n", + "Wc=2*Cp*(T4-T3)\n", + "print(\"for expansion process 5-6_a,\")\n", + "print(\"T6_a/T5=(P6/P5)^((y-1)/y)\")\n", + "print(\"so T6_a=T5*(P6/P5)^((y-1)/y) in K\")\n", + "P5=10.*10**5;#pressure in Pa\n", + "T6_a=T5*(P6/P5)**((y-1)/y)\n", + "print(\"considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\")\n", + "print(\"T6=T5-(ne*(T5-T6_a)) in K\")\n", + "T6=T5-(ne*(T5-T6_a))\n", + "print(\"for expansion in 7-8_a\")\n", + "print(\"T8_a/T7=(P8/P7)^((y-1)/y)\")\n", + "print(\"so T8_a=T7*(P8/P7)^((y-1)/y) in K\")\n", + "P8=P1;#constant pressure process\n", + "P7=P6;#constant pressure process\n", + "T8_a=T7*(P8/P7)**((y-1)/y)\n", + "print(\"considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\")\n", + "print(\"so T8=T7-(ne*(T7-T8_a))in K\")\n", + "T8=T7-(ne*(T7-T8_a))\n", + "print(\"expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\")\n", + "Wt=Cp*(T5-T6)+Cp*(T7-T8)\n", + "print(\"heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\")\n", + "q_add=Cp*(T5-T4)+Cp*(T7-T6)\n", + "mf=q_add/C\n", + "print(\"fuel required per kg of air,mf=q_add/C\"),round(q_add/C,2)\n", + "print(\"air-fuel ratio=1/mf\"),round(1/mf,2)\n", + "W=Wt-Wc\n", + "print(\"net output(W) in KJ/kg=\"),round(Wt-Wc,2)\n", + "print(\"output for air flowing at 30 kg/s,=W*m in KW\"),round(W*m,2)\n", + "W/q_add\n", + "print(\"thermal efficiency=\"),round(W/q_add,2)\n", + "print(\"in percentage\"),round(W*100/q_add,2)\n", + "print(\"so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\")\n", + "print(\"NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.12;pg no: 354" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.12, Page:354 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\n", + "for process 1-2,\n", + "T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y) in K\n", + "for process 3-4,\n", + "T4/T3=(P4/P3)^((y-1)/y)\n", + "so T4=T3*(P4/P3)^((y-1)/y) in K\n", + "for process 6-7,\n", + "T7/T6=(P7/P6)^((y-1)/y)\n", + "so T7=T6*(P7/P6)^((y-1)/y) in K\n", + "for process 8-9,\n", + "T9/T8=(P9/P8)^((y-1)/y)\n", + "T9=T8*(P9/P8)^((y-1)/y) in K\n", + "in regenerator,effectiveness=(T5-T4)/(T9-T4)\n", + "T5=T4+(ne*(T9-T4))in K\n", + "compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\n", + "turbine work per kg air,Wt in KJ/kg= 660.84\n", + "heat added per kg air,q_add in KJ/kg= 765.43\n", + "total fuel required per kg of air= 0.02\n", + "net work,W_net in KJ/kg= 450.85\n", + "cycle thermal efficiency,n= 0.59\n", + "in percentage 58.9\n", + "fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C= 0.0056\n", + "fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C= 0.0126\n", + "so fuel-air ratio in two combustion chambers=0.0126,0.0056\n", + "total turbine work=660.85 KJ/kg\n", + "cycle thermal efficiency=58.9%\n", + "NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \n" + ] + } + ], + "source": [ + "#cal of fuel-air ratio in two combustion chambers,total turbine work,cycle thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.12, Page:354 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\")\n", + "P1=1.*10**5;#initial pressure in Pa\n", + "P9=P1;\n", + "T1=300.;#initial temperature in K\n", + "P2=4.*10**5;#pressure of air in intercooler in Pa\n", + "P3=P2;\n", + "T3=290.;#temperature of air in intercooler in K\n", + "T6=1300.;#temperature of combustion chamber in K\n", + "P4=8.*10**5;#pressure of air after compression in Pa\n", + "P6=P4;\n", + "T8=1300.;#temperature after reheating in K\n", + "P8=4.*10**5;#pressure after expansion in Pa\n", + "P7=P8;\n", + "C=42000.;#heating value of fuel in KJ/kg\n", + "y=1.4;#expansion constant\n", + "ne=0.8;#effectiveness of regenerator\n", + "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", + "print(\"for process 1-2,\")\n", + "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", + "T2=T1*(P2/P1)**((y-1)/y)\n", + "print(\"for process 3-4,\")\n", + "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", + "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", + "T4=T3*(P4/P3)**((y-1)/y)\n", + "print(\"for process 6-7,\")\n", + "print(\"T7/T6=(P7/P6)^((y-1)/y)\")\n", + "print(\"so T7=T6*(P7/P6)^((y-1)/y) in K\")\n", + "T7=T6*(P7/P6)**((y-1)/y)\n", + "print(\"for process 8-9,\")\n", + "print(\"T9/T8=(P9/P8)^((y-1)/y)\")\n", + "print(\"T9=T8*(P9/P8)^((y-1)/y) in K\")\n", + "T9=T8*(P9/P8)**((y-1)/y)\n", + "print(\"in regenerator,effectiveness=(T5-T4)/(T9-T4)\")\n", + "print(\"T5=T4+(ne*(T9-T4))in K\")\n", + "T5=T4+(ne*(T9-T4))\n", + "print(\"compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\")\n", + "Wc=Cp*(T2-T1)+Cp*(T4-T3)\n", + "Wt=Cp*(T6-T7)+Cp*(T8-T9)\n", + "print(\"turbine work per kg air,Wt in KJ/kg=\"),round(Wt,2)\n", + "q_add=Cp*(T6-T5)+Cp*(T8-T7)\n", + "print(\"heat added per kg air,q_add in KJ/kg=\"),round(q_add,2)\n", + "q_add/C\n", + "print(\"total fuel required per kg of air=\"),round(q_add/C,2)\n", + "W_net=Wt-Wc\n", + "print(\"net work,W_net in KJ/kg=\"),round(W_net,2)\n", + "n=W_net/q_add\n", + "print(\"cycle thermal efficiency,n=\"),round(n,2)\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C=\"),round(Cp*(T8-T7)/C,4)\n", + "print(\"fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C=\"),round(Cp*(T6-T5)/C,4)\n", + "print(\"so fuel-air ratio in two combustion chambers=0.0126,0.0056\")\n", + "print(\"total turbine work=660.85 KJ/kg\")\n", + "print(\"cycle thermal efficiency=58.9%\")\n", + "print(\"NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.13;pg no: 356" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.13, Page:356 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\n", + "work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\n", + "heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\n", + "for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\n", + "mass of air per cycle=m/n in kg/cycle\n", + "brake output in KW= 17.12\n", + "stroke volume,V in m^3= 0.0117\n", + "brake output=17.11 KW\n", + "stroke volume=0.0116 m^3\n" + ] + } + ], + "source": [ + "#cal of brake output,stroke volume\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "import math\n", + "print\"Example 9.13, Page:356 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\")\n", + "T2=700.;#highest temperature of stirling engine in K\n", + "T1=300.;#lowest temperature of stirling engine in K\n", + "r=3.;#compression ratio\n", + "q_add=30.;#heat addition in KJ/s\n", + "epsilon=0.9;#regenerator efficiency\n", + "P=1*10**5;#pressure at begining of compression in Pa\n", + "n=100.;#number of cycle per minute\n", + "Cv=0.72;#specific heat at constant volume in KJ/kg K\n", + "R=29.27;#gas constant in KJ/kg K\n", + "print(\"work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\")\n", + "W=R*(T2-T1)*math.log(r)\n", + "print(\"heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\")\n", + "q=R*T2*math.log(r)+(1-epsilon)*Cv*(T2-T1)\n", + "print(\"for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\")\n", + "m=q_add/q\n", + "print(\"mass of air per cycle=m/n in kg/cycle\")\n", + "m/n\n", + "print(\"brake output in KW=\"),round(W*m,2)\n", + "m=1.33*10**-4;#mass of air per cycle in kg/cycle\n", + "T=T1;\n", + "V=m*R*T*1000/P\n", + "print(\"stroke volume,V in m^3=\"),round(V,4)\n", + "print(\"brake output=17.11 KW\")\n", + "print(\"stroke volume=0.0116 m^3\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.14;pg no: 357" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.14, Page:357 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\n", + "In question no.14,various expression is derived which cannot be solved using python software.\n" + ] + } + ], + "source": [ + "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.14, Page:357 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\")\n", + "print(\"In question no.14,various expression is derived which cannot be solved using python software.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.15;pg no: 361" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.15, Page:361 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\n", + "In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\n", + "so T2=T1*(P2/P1)^((y-1)/y)in K\n", + "T4/T3=(P4/P3)^((y-1)/y)\n", + "so T4=T3*(P4/P3)^((y-1)/y) in K\n", + "compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", + "turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \n", + "heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \n", + "net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\n", + "heat recovered in HRSG for steam generation per kg of air\n", + "q_HRGC=Cp*(T4-T5)in KJ/kg\n", + "at inlet to steam in turbine,\n", + "from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\n", + "for expansion in steam turbine,sa=sb\n", + "let dryness fraction at state b be x\n", + "also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\n", + "sb=sf+x*sfg\n", + "so x=(sb-sf)/sfg \n", + "so hb=hf+x*hfg in KJ/kg K\n", + "at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\n", + "at exit of feed pump,hd=hd-hc\n", + "hd=vc*(Pg-Pc)*100 in KJ/kg\n", + "heat added per kg of steam =ha-hd in KJ/kg\n", + "mass of steam generated per kg of air in kg steam per kg air= 0.119\n", + "net steam turbine cycle output,W_net_ST in KJ/kg= 677.4\n", + "steam cycle output per kg of air(W_net_ST) in KJ/kg air= 80.61\n", + "total combined cycle output in KJ/kg air= 486.88\n", + "combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add 0.58\n", + "in percentage 57.77\n", + "In absence of steam cycle,gas turbine cycle efficiency,n_GT= 0.48\n", + "in percentage 48.21\n", + "thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\n", + "overall efficiency=57.77%\n", + "steam per kg of air=0.119 kg steam per/kg air\n" + ] + } + ], + "source": [ + "#cal of overall efficiency,steam per kg of air\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.15, Page:361 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\")\n", + "r=10.;#pressure ratio\n", + "Cp=1.0032;#specific heat of air in KJ/kg K\n", + "y=1.4;#expansion constant\n", + "T3=1400.;#inlet temperature of gas turbine in K\n", + "T1=(17.+273.);#ambient temperature in K\n", + "P1=1.*10**5;#ambient pressure in Pa\n", + "Pc=15.;#condensor pressure in KPa\n", + "Pg=6.*1000;#pressure of steam in generator in KPa\n", + "T5=420.;#temperature of exhaust from gas turbine in K\n", + "print(\"In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"so T2=T1*(P2/P1)^((y-1)/y)in K\")\n", + "T2=T1*(r)**((y-1)/y)\n", + "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", + "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", + "T4=T3*(1/r)**((y-1)/y)\n", + "print(\"compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", + "Wc=Cp*(T2-T1)\n", + "print(\"turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \")\n", + "Wt=Cp*(T3-T4)\n", + "print(\"heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \")\n", + "q_add=Cp*(T3-T2)\n", + "print(\"net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\")\n", + "W_net_GT=Wt-Wc\n", + "print(\"heat recovered in HRSG for steam generation per kg of air\")\n", + "print(\"q_HRGC=Cp*(T4-T5)in KJ/kg\")\n", + "q_HRGC=Cp*(T4-T5)\n", + "print(\"at inlet to steam in turbine,\")\n", + "print(\"from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\")\n", + "ha=3177.2;\n", + "sa=6.5408;\n", + "print(\"for expansion in steam turbine,sa=sb\")\n", + "sb=sa;\n", + "print(\"let dryness fraction at state b be x\")\n", + "print(\"also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\")\n", + "sf=0.7549;\n", + "sfg=7.2536;\n", + "hf=225.94;\n", + "hfg=2373.1;\n", + "print(\"sb=sf+x*sfg\")\n", + "print(\"so x=(sb-sf)/sfg \")\n", + "x=(sb-sf)/sfg\n", + "print(\"so hb=hf+x*hfg in KJ/kg K\")\n", + "hb=hf+x*hfg\n", + "print(\"at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\")\n", + "hc=hf;\n", + "vc=0.001014;\n", + "print(\"at exit of feed pump,hd=hd-hc\")\n", + "print(\"hd=vc*(Pg-Pc)*100 in KJ/kg\")\n", + "hd=vc*(Pg-Pc)*100\n", + "print(\"heat added per kg of steam =ha-hd in KJ/kg\")\n", + "ha-hd\n", + "print(\"mass of steam generated per kg of air in kg steam per kg air=\"),round(q_HRGC/(ha-hd),3)\n", + "W_net_ST=(ha-hb)-(hd-hc)\n", + "print(\"net steam turbine cycle output,W_net_ST in KJ/kg=\"),round(W_net_ST,2)\n", + "W_net_ST=W_net_ST*0.119 \n", + "print(\"steam cycle output per kg of air(W_net_ST) in KJ/kg air=\"),round(W_net_ST,2)\n", + "(W_net_GT+W_net_ST)\n", + "print(\"total combined cycle output in KJ/kg air= \"),round((W_net_GT+W_net_ST),2)\n", + "n_cc=(W_net_GT+W_net_ST)/q_add\n", + "print(\"combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add\"),round(n_cc,2)\n", + "print(\"in percentage\"),round(n_cc*100,2)\n", + "n_GT=W_net_GT/q_add\n", + "print(\"In absence of steam cycle,gas turbine cycle efficiency,n_GT=\"),round(n_GT,2)\n", + "print(\"in percentage\"),round(n_GT*100,2)\n", + "print(\"thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\")\n", + "print(\"overall efficiency=57.77%\")\n", + "print(\"steam per kg of air=0.119 kg steam per/kg air\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 9.16;pg no: 363" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 9.16, Page:363 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\n", + "here P4/P1=P3/P1=70............eq1\n", + "compression ratio,V1/V2=V1/V3=15.............eq2\n", + "heat added at constant volume= heat added at constant pressure\n", + "Q23=Q34\n", + "m*Cv*(T3-T2)=m*Cp*(T4-T3)\n", + "(T3-T2)=y*(T4-T3)\n", + "for process 1-2;\n", + "T2/T1=(P2/P1)^((y-1)/y)\n", + "T2/T1=(V1/V2)^(y-1)\n", + "so T2=T1*(V1/V2)^(y-1) in K\n", + "and (P2/P1)=(V1/V2)^y\n", + "so P2=P1*(V1/V2)^y in Pa...........eq3\n", + "for process 2-3,\n", + "P2/P3=T2/T3\n", + "so T3=T2*P3/P2\n", + "using eq 1 and 3,we get\n", + "T3=T2*k/r^y in K\n", + "using equal heat additions for processes 2-3 and 3-4,\n", + "(T3-T2)=y*(T4-T3)\n", + "so T4=T3+((T3-T2)/y) in K\n", + "for process 3-4,\n", + "V3/V4=T3/T4\n", + "(V3/V1)*(V1/V4)=T3/T4\n", + "so (V1/V4)=(T3/T4)*r\n", + "so V1/V4=11.88 and V5/V4=11.88\n", + "for process 4-5,\n", + "P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\n", + "so T5=T4/((V5/V4)^(y-1))\n", + "air standard thermal efficiency(n)=1-(heat rejected/heat added)\n", + "n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\n", + "n= 0.65\n", + "air standard thermal efficiency=0.6529\n", + "in percentage 65.29\n", + "so air standard thermal efficiency=65.29%\n", + "Actual thermal efficiency may be different from theoretical efficiency due to following reasons\n", + "a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\n", + "b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\n", + "c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\n" + ] + } + ], + "source": [ + "#cal of air standard thermal efficiency\n", + "#intiation of all variables\n", + "# Chapter 9\n", + "print\"Example 9.16, Page:363 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\")\n", + "T1=(27+273);#temperature at begining of compression in K\n", + "k=70;#ration of maximum to minimum pressures\n", + "r=15;#compression ratio\n", + "y=1.4;#expansion constant\n", + "print(\"here P4/P1=P3/P1=70............eq1\")\n", + "print(\"compression ratio,V1/V2=V1/V3=15.............eq2\")\n", + "print(\"heat added at constant volume= heat added at constant pressure\")\n", + "print(\"Q23=Q34\")\n", + "print(\"m*Cv*(T3-T2)=m*Cp*(T4-T3)\")\n", + "print(\"(T3-T2)=y*(T4-T3)\")\n", + "print(\"for process 1-2;\")\n", + "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", + "print(\"T2/T1=(V1/V2)^(y-1)\")\n", + "print(\"so T2=T1*(V1/V2)^(y-1) in K\")\n", + "T2=T1*(r)**(y-1)\n", + "print(\"and (P2/P1)=(V1/V2)^y\")\n", + "print(\"so P2=P1*(V1/V2)^y in Pa...........eq3\")\n", + "print(\"for process 2-3,\")\n", + "print(\"P2/P3=T2/T3\")\n", + "print(\"so T3=T2*P3/P2\")\n", + "print(\"using eq 1 and 3,we get\")\n", + "print(\"T3=T2*k/r^y in K\")\n", + "T3=T2*k/r**y \n", + "print(\"using equal heat additions for processes 2-3 and 3-4,\")\n", + "print(\"(T3-T2)=y*(T4-T3)\")\n", + "print(\"so T4=T3+((T3-T2)/y) in K\")\n", + "T4=T3+((T3-T2)/y)\n", + "print(\"for process 3-4,\")\n", + "print(\"V3/V4=T3/T4\")\n", + "print(\"(V3/V1)*(V1/V4)=T3/T4\")\n", + "print(\"so (V1/V4)=(T3/T4)*r\")\n", + "(T3/T4)*r\n", + "print(\"so V1/V4=11.88 and V5/V4=11.88\")\n", + "print(\"for process 4-5,\")\n", + "print(\"P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\")\n", + "print(\"so T5=T4/((V5/V4)^(y-1))\")\n", + "T5=T4/(11.88)**(y-1)\n", + "print(\"air standard thermal efficiency(n)=1-(heat rejected/heat added)\")\n", + "print(\"n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\")\n", + "n=1-((T5-T1)/(y*(T4-T3)+(T3-T2)))\n", + "print(\"n=\"),round(n,2)\n", + "print(\"air standard thermal efficiency=0.6529\")\n", + "print(\"in percentage\"),round(n*100,2)\n", + "print(\"so air standard thermal efficiency=65.29%\")\n", + "print(\"Actual thermal efficiency may be different from theoretical efficiency due to following reasons\")\n", + "print(\"a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\")\n", + "print(\"b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\")\n", + "print(\"c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter_1.ipynb new file mode 100755 index 00000000..9474d100 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter_1.ipynb @@ -0,0 +1,1777 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# chapter 1:Fundemental concepts and definitions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.1;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.1, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\n", + "pressure difference(p)in pa\n", + "p= 39755.7\n" + ] + } + ], + "source": [ + "#cal of pressure difference\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.1, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\"\n", + "h=30*10**-2;#manometer deflection of mercury in m\n", + "g=9.78;#acceleration due to gravity in m/s^2\n", + "rho=13550;#density of mercury at room temperature in kg/m^3\n", + "print\"pressure difference(p)in pa\"\n", + "p=rho*g*h\n", + "print\"p=\",round(p,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.2;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.2, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\n", + "effort required for lifting the lid(E)in N\n", + "E= 7115.48\n" + ] + } + ], + "source": [ + "#cal of effort required for lifting the lid\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.2, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\"\n", + "d=30*10**-2;#diameter of cylindrical vessel in m\n", + "h=76*10**-2;#atmospheric pressure in m of mercury\n", + "g=9.78;#acceleration due to gravity in m/s^2\n", + "rho=13550;#density of mercury at room temperature in kg/m^3\n", + "print\"effort required for lifting the lid(E)in N\"\n", + "E=(rho*g*h)*(3.14*d**2)/4\n", + "print\"E=\",round(E,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.3;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.3, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\n", + "pressure measured by manometer is gauge pressure(Pg)in kpa\n", + "Pg=rho*g*h/10^3\n", + "actual pressure of the air(P)in kpa\n", + "P= 140.76\n" + ] + } + ], + "source": [ + "#cal of actual pressure of the air\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.3, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\"\n", + "h=30*10**-2;# pressure of compressed air in m of mercury\n", + "Patm=101*10**3;#atmospheric pressure in pa\n", + "g=9.78;#acceleration due to gravity in m/s^2\n", + "rho=13550;#density of mercury at room temperature in kg/m^3\n", + "print\"pressure measured by manometer is gauge pressure(Pg)in kpa\"\n", + "print\"Pg=rho*g*h/10^3\"\n", + "Pg=rho*g*h/10**3\n", + "print\"actual pressure of the air(P)in kpa\"\n", + "P=Pg+Patm/10**3\n", + "print\"P=\",round(P,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.4;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.4, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\n", + "density of oil(RHOoil)in kg/m^3\n", + "RHOoil=sg*RHOw\n", + "gauge pressure(Pg)in kpa\n", + "Pg= 7.848\n" + ] + } + ], + "source": [ + "#cal of gauge pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.4, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\"\n", + "h=1;#depth of oil tank in m\n", + "sg=0.8;#specific gravity of oil\n", + "RHOw=1000;#density of water in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print\"density of oil(RHOoil)in kg/m^3\"\n", + "print\"RHOoil=sg*RHOw\"\n", + "RHOoil=sg*RHOw\n", + "print\"gauge pressure(Pg)in kpa\"\n", + "Pg=RHOoil*g*h/10**3\n", + "print\"Pg=\",round(Pg,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.5;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.5, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\n", + "atmospheric pressure(Patm)in kpa\n", + "Patm=rho*g*h2/10^3\n", + "pressure due to mercury column at AB(Pab)in kpa\n", + "Pab=rho*g*h1/10^3\n", + "pressure exerted by gas(Pgas)in kpa\n", + "Pgas= 154.76\n" + ] + } + ], + "source": [ + "#cal of pressure exerted by gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.5, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\"\n", + "rho=13.6*10**3;#density of mercury in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "h1=40*10**-2;#difference of height in mercury column in m as shown in figure\n", + "h2=76*10**-2;#barometer reading of mercury in m\n", + "print\"atmospheric pressure(Patm)in kpa\"\n", + "print\"Patm=rho*g*h2/10^3\"\n", + "Patm=rho*g*h2/10**3\n", + "print\"pressure due to mercury column at AB(Pab)in kpa\"\n", + "print\"Pab=rho*g*h1/10^3\"\n", + "Pab=rho*g*h1/10**3\n", + "print\"pressure exerted by gas(Pgas)in kpa\"\n", + "Pgas=Patm+Pab\n", + "print\"Pgas=\",round(Pgas,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.6;page no:23" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.6, Page:23 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\n", + "by law of conservation of energy\n", + "potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\n", + "so m*g*h = m*Cp*deltaT*4.18*1000\n", + "change in temperature of water(deltaT) in degree celcius\n", + "deltaT= 2.35\n" + ] + } + ], + "source": [ + "#cal of change in temperature of water\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.6, Page:23 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\"\n", + "m=1;#mass of water in kg\n", + "h=1000;#height from which water fall in m\n", + "Cp=1;#specific heat of water in kcal/kg k\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print\"by law of conservation of energy\"\n", + "print\"potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\"\n", + "print\"so m*g*h = m*Cp*deltaT*4.18*1000\"\n", + "print\"change in temperature of water(deltaT) in degree celcius\"\n", + "deltaT=(g*h)/(4.18*1000*Cp)\n", + "print\"deltaT=\",round(deltaT,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.7;page no:23" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.7, Page:23 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\n", + "mass of object(m)in kg\n", + "m=w1/g1\n", + "spring balance reading=gravitational force in mass(F)in N\n", + "F= 86.65\n" + ] + } + ], + "source": [ + "#cal of spring balance reading\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.7, Page:23 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\"\n", + "w1=100;#weight of object at standard gravitational acceleration in N\n", + "g1=9.81;#acceleration due to gravity in m/s^2\n", + "g2=8.5;#gravitational acceleration at some location\n", + "print\"mass of object(m)in kg\"\n", + "print\"m=w1/g1\"\n", + "m=w1/g1\n", + "print\"spring balance reading=gravitational force in mass(F)in N\"\n", + "F=m*g2\n", + "print\"F=\",round(F,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.8;page no:24" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.8, Page:24 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\n", + "pressure measured by manometer(P) in pa\n", + "p=rho*g*h\n", + "now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\n", + "mass of piston(m)in kg\n", + "so m= 28.84\n" + ] + } + ], + "source": [ + "#cal of mass of piston\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.8, Page:24 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\"\n", + "d=15*10**-2;#diameter of cylinder in m\n", + "h=12*10**-2;#manometer height difference in m of mercury\n", + "rho=13.6*10**3;#density of mercury in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print\"pressure measured by manometer(P) in pa\"\n", + "print\"p=rho*g*h\"\n", + "p=rho*g*h\n", + "print\"now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\"\n", + "print\"mass of piston(m)in kg\"\n", + "m=(p*math.pi*d**2)/(4*g)\n", + "print\"so m=\",round(m,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.9;page no:24" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.9, Page:24 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\n", + "balancing pressure at plane BC in figure we get\n", + "Psteam+Pwater=Patm+Pmercury\n", + "now 1.atmospheric pressure(Patm)in pa\n", + "Patm= 101396.16\n", + "2.pressure due to water(Pwater)in pa\n", + "Pwater= 196.2\n", + "3.pressure due to mercury(Pmercury)in pa\n", + "Pmercury=RHOm*g*h3 13341.6\n", + "using balancing equation\n", + "Psteam=Patm+Pmercury-Pwater\n", + "so pressure of steam(Psteam)in kpa\n", + "Psteam= 114.54\n" + ] + } + ], + "source": [ + "#cal of pressure due to atmosphere,water,mercury,steam\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.9, Page:24 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\")\n", + "RHOm=13.6*10**3;#density of mercury in kg/m^3\n", + "RHOw=1000;#density of water in kg/m^3\n", + "h1=76*10**-2;#barometer reading in m of mercury\n", + "h2=2*10**-2;#height raised by water in manometer tube in m \n", + "h3=10*10**-2;#height raised by mercury in manometer tube in m \n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"balancing pressure at plane BC in figure we get\")\n", + "print(\"Psteam+Pwater=Patm+Pmercury\")\n", + "print(\"now 1.atmospheric pressure(Patm)in pa\")\n", + "Patm=RHOm*g*h1\n", + "print(\"Patm=\"),round(Patm,2)\n", + "print(\"2.pressure due to water(Pwater)in pa\")\n", + "Pwater=RHOw*g*h2\n", + "print(\"Pwater=\"),round(Pwater,2)\n", + "print(\"3.pressure due to mercury(Pmercury)in pa\")\n", + "Pmercury=RHOm*g*h3\n", + "print(\"Pmercury=RHOm*g*h3\"),round(Pmercury,2)\n", + "print(\"using balancing equation\")\n", + "print(\"Psteam=Patm+Pmercury-Pwater\")\n", + "print(\"so pressure of steam(Psteam)in kpa\")\n", + "Psteam=(Patm+Pmercury-Pwater)/1000\n", + "print(\"Psteam=\"),round(Psteam,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.10;page no:24" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.10, Page:24 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\n", + "atmospheric pressure(Patm)in kpa\n", + "absolute temperature in compartment A(Pa) in kpa\n", + "Pa= 496.06\n", + "absolute temperature in compartment B(Pb) in kpa\n", + "Pb= 246.06\n", + "absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\n" + ] + } + ], + "source": [ + "#cal of \"absolute temperature in compartment A,B\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.10, Page:24 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\")\n", + "h=720*10**-3;#barometer reading in m of Hg\n", + "Pga=400;#gauge pressure in compartment A in kpa\n", + "Pgb=150;#gauge pressure in compartment B in kpa\n", + "rho=13.6*10**3;#density of mercury in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"atmospheric pressure(Patm)in kpa\")\n", + "Patm=(rho*g*h)/1000\n", + "print(\"absolute temperature in compartment A(Pa) in kpa\")\n", + "Pa=Pga+Patm\n", + "print\"Pa=\",round(Pa,2)\n", + "print\"absolute temperature in compartment B(Pb) in kpa\"\n", + "Pb=Pgb+Patm\n", + "print\"Pb=\",round(Pb,2)\n", + "print\"absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.11;page no:25" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.11, Page:25 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\n", + "the pressure of air in air tank can be obtained by equalising pressures at some reference line\n", + "P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\n", + "so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\n", + "air pressure(P1)in kpa 139.81\n" + ] + } + ], + "source": [ + "#cal of air pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.11, Page:25 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\")\n", + "Patm=90*10**3;#atmospheric pressure in pa\n", + "RHOw=1000;#density of water in kg/m^3\n", + "RHOm=13600;#density of mercury in kg/m^3\n", + "RHOo=850;#density of oil in kg/m^3\n", + "g=9.81;#acceleration due to ggravity in m/s^2\n", + "h1=.15;#height difference between water column in m\n", + "h2=.25;#height difference between oil column in m\n", + "h3=.4;#height difference between mercury column in m\n", + "print\"the pressure of air in air tank can be obtained by equalising pressures at some reference line\"\n", + "print\"P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\"\n", + "print\"so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\"\n", + "P1=(Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2)/1000\n", + "print\"air pressure(P1)in kpa\",round(P1,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.12;page no:26" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.12, Page:26 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\n", + "mass of object(m)in kg\n", + "m=F/g\n", + "kinetic energy(E)in J is given by\n", + "E= 140625000.0\n" + ] + } + ], + "source": [ + "#cal of kinetic energy\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.12, Page:26 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\"\n", + "v=750;#relative velocity of object with respect to earth in m/sec\n", + "F=4000;#gravitational force in N\n", + "g=8;#acceleration due to gravity in m/s^2\n", + "print\"mass of object(m)in kg\"\n", + "print\"m=F/g\"\n", + "m=F/g\n", + "print\"kinetic energy(E)in J is given by\"\n", + "E=m*v**2/2\n", + "print\"E=\",round(E)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.13;page no:26" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.13, Page:26 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\n", + "characteristics gas constant(R2)in kJ/kg k\n", + "molecular weight of gas(m)in kg/kg mol= 16.63\n", + "NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\n" + ] + } + ], + "source": [ + "#cal of molecular weight of gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.13, Page:26 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\"\n", + "Cp=2.286;#specific heat at constant pressure in kJ/kg k\n", + "Cv=1.786;#specific heat at constant volume in kJ/kg k\n", + "R1=8.3143;#universal gas constant in kJ/kg k\n", + "print\"characteristics gas constant(R2)in kJ/kg k\"\n", + "R2=Cp-Cv\n", + "m=R1/R2\n", + "print\"molecular weight of gas(m)in kg/kg mol=\",round(m,2)\n", + "print\"NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.14;page no:26" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.14, Page:26 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\n", + "using perfect gas equation\n", + "P1*V1/T1 = P2*V2/T2\n", + "=>T2=(P2*V2*T1)/(P1*V1)\n", + "so final temperature of gas(T2)in k\n", + "or final temperature of gas(T2)in degree celcius= 127.0\n" + ] + } + ], + "source": [ + "#cal of final temperature of gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.14, Page:26 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\"\n", + "P1=750*10**3;#initial pressure of gas in pa\n", + "V1=0.2;#initial volume of gas in m^3\n", + "T1=600;#initial temperature of gas in k\n", + "P2=2*10**5;#final pressure of gas i pa\n", + "V2=0.5;#final volume of gas in m^3\n", + "print\"using perfect gas equation\"\n", + "print\"P1*V1/T1 = P2*V2/T2\"\n", + "print\"=>T2=(P2*V2*T1)/(P1*V1)\"\n", + "print\"so final temperature of gas(T2)in k\"\n", + "T2=(P2*V2*T1)/(P1*V1)\n", + "T2=T2-273\n", + "print\"or final temperature of gas(T2)in degree celcius=\",round(T2,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.15;page no:27" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.15, Page:27 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\n", + "from perfect gas equation we get\n", + "initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\n", + "m1= 5.807\n", + "final mass of air(m2 in kg)=(P2*V2)/(R*T2)\n", + "m2= 3.111\n", + "mass of air removed(m)in kg 2.696\n", + "volume of this mass of air(V) at initial states in m^3= 2.32\n" + ] + } + ], + "source": [ + "#cal of volume of this mass of air(V) at initial states\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.15, Page:27 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\"\n", + "P1=100*10**3;#initial pressure of air in pa\n", + "V1=5.;#initial volume of air in m^3\n", + "T1=300.;#initial temperature of gas in k\n", + "P2=50*10**3;#final pressure of air in pa\n", + "V2=5.;#final volume of air in m^3\n", + "T2=(280.);#final temperature of air in K\n", + "R=287.;#gas constant on J/kg k\n", + "print\"from perfect gas equation we get\"\n", + "print\"initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\"\n", + "m1=(P1*V1)/(R*T1)\n", + "print(\"m1=\"),round(m1,3)\n", + "print\"final mass of air(m2 in kg)=(P2*V2)/(R*T2)\"\n", + "m2=(P2*V2)/(R*T2)\n", + "print(\"m2=\"),round(m2,3)\n", + "m=m1-m2\n", + "print\"mass of air removed(m)in kg\",round(m,3)\n", + "V=m*R*T1/P1\n", + "print\"volume of this mass of air(V) at initial states in m^3=\",round(V,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.16;page no:27" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.16, Page:27 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\n", + "here V1=V2\n", + "so P1/T1=P2/T2\n", + "final temperature of hydrogen gas(T2)in k\n", + "=>T2=P2*T1/P1\n", + "now R=(Cp-Cv) in KJ/kg k\n", + "And volume of cylinder(V1)in m^3\n", + "V1=(math.pi*d^2*l)/4\n", + "mass of hydrogen gas(m)in kg\n", + "m= 0.254\n", + "now heat supplied(Q)in KJ\n", + "Q= 193.93\n" + ] + } + ], + "source": [ + "#cal of heat supplied\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.16, Page:27 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\"\n", + "d=1;#diameter of cylinder in m\n", + "l=4;#length of cylinder in m\n", + "P1=100*10**3;#initial pressureof hydrogen gas in pa\n", + "T1=(27+273);#initial temperature of hydrogen gas in k\n", + "P2=125*10**3;#final pressureof hydrogen gas in pa\n", + "Cp=14.307;#specific heat at constant pressure in KJ/kg k\n", + "Cv=10.183;#specific heat at constant volume in KJ/kg k\n", + "print\"here V1=V2\"\n", + "print\"so P1/T1=P2/T2\"\n", + "print\"final temperature of hydrogen gas(T2)in k\"\n", + "print\"=>T2=P2*T1/P1\"\n", + "T2=P2*T1/P1\n", + "print\"now R=(Cp-Cv) in KJ/kg k\"\n", + "R=Cp-Cv\n", + "print\"And volume of cylinder(V1)in m^3\"\n", + "print\"V1=(math.pi*d^2*l)/4\"\n", + "V1=(math.pi*d**2*l)/4\n", + "print\"mass of hydrogen gas(m)in kg\"\n", + "m=(P1*V1)/(1000*R*T1)\n", + "print\"m=\",round(m,3)\n", + "print\"now heat supplied(Q)in KJ\"\n", + "Q=m*Cv*(T2-T1)\n", + "print\"Q=\",round(Q,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.17;page no:28" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.17, Page:28 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\n", + "final total volume(V)in m^3\n", + "V=V1*V2\n", + "total mass of air(m)in kg\n", + "m=m1+m2\n", + "final pressure of air(P)in kpa\n", + "using perfect gas equation\n", + "P= 516.6\n" + ] + } + ], + "source": [ + "#cal of final pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.17, Page:28 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\")\n", + "V1=2.;#volume of first cylinder in m^3\n", + "V2=2.;#volume of second cylinder in m^3\n", + "T=(27+273);#temperature of system in k\n", + "m1=20.;#mass of air in first vessel in kg\n", + "m2=4.;#mass of air in second vessel in kg\n", + "R=287.;#gas constant J/kg k\n", + "print(\"final total volume(V)in m^3\")\n", + "print(\"V=V1*V2\")\n", + "V=V1*V2\n", + "print(\"total mass of air(m)in kg\")\n", + "print(\"m=m1+m2\")\n", + "m=m1+m2\n", + "print(\"final pressure of air(P)in kpa\")\n", + "print(\"using perfect gas equation\")\n", + "P=(m*R*T)/(1000*V)\n", + "print\"P=\",round(P,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.18;page no:28" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.18, Page:28 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\n", + "1.By considering it as a PERFECT GAS\n", + "gas constant for CO2(Rco2)\n", + "Rco2=(J/Kg.k) 188.9\n", + "Also P*V=M*Rco2*T\n", + "pressure of CO2 as perfect gas(P)in N/m^2\n", + "P=(m*Rco2*T)/V 141683.71\n", + "2.By considering as a REAL GAS\n", + "values of vanderwaal constants a,b can be seen from the table which are\n", + "a=(N m^4/(kg mol)^2) 362850.0\n", + "b=(m^3/kg mol) 0.03\n", + "now specific volume(v)in m^3/kg mol\n", + "v= 17.604\n", + "now substituting the value of all variables in vanderwaal equation\n", + "(P+(a/v^2))*(v-b)=R*T\n", + "pressure of CO2 as real gas(P)in N/m^2\n", + "P= 140766.02\n" + ] + } + ], + "source": [ + "#cal of pressure of CO2 as perfect,real gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.18, Page:28 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\")\n", + "m=5;#mass of CO2 in kg\n", + "V=2;#volume of vesssel in m^3\n", + "T=(27+273);#temperature of vessel in k\n", + "R=8.314*10**3;#universal gas constant in J/kg k\n", + "M=44.01;#molecular weight of CO2 \n", + "print(\"1.By considering it as a PERFECT GAS\")\n", + "print(\"gas constant for CO2(Rco2)\")\n", + "Rco2=R/M\n", + "print(\"Rco2=(J/Kg.k)\"),round(Rco2,1)\n", + "print(\"Also P*V=M*Rco2*T\")\n", + "print(\"pressure of CO2 as perfect gas(P)in N/m^2\")\n", + "P=(m*Rco2*T)/V\n", + "print(\"P=(m*Rco2*T)/V \"),round(P,2)\n", + "print(\"2.By considering as a REAL GAS\")\n", + "print(\"values of vanderwaal constants a,b can be seen from the table which are\")\n", + "a=3628.5*10**2#vanderwall constant in N m^4/(kg mol)^2\n", + "b=3.14*10**-2# vanderwall constant in m^3/kg mol\n", + "print(\"a=(N m^4/(kg mol)^2) \"),round(a,2)\n", + "print(\"b=(m^3/kg mol)\"),round(b,2)\n", + "print(\"now specific volume(v)in m^3/kg mol\")\n", + "v=V*M/m\n", + "print(\"v=\"),round(v,3)\n", + "print(\"now substituting the value of all variables in vanderwaal equation\")\n", + "print(\"(P+(a/v^2))*(v-b)=R*T\")\n", + "print(\"pressure of CO2 as real gas(P)in N/m^2\")\n", + "P=((R*T)/(v-b))-(a/v**2)\n", + "print(\"P=\"),round(P,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.19;page no:29" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.19, Page:29 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\n", + "1.considering as perfect gas\n", + "specific volume(V)in m^3/kg\n", + "V= 0.0186\n", + "2.considering compressibility effects\n", + "reduced pressure(P)in pa\n", + "p= 0.8\n", + "reduced temperature(t)in k\n", + "t= 1.1\n", + "from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\n", + "we get Z=0.785\n", + "now actual specific volume(v)in m^3/kg\n", + "v= 0.0146\n" + ] + } + ], + "source": [ + "#cal of specific volume of steam\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.19, Page:29 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\")\n", + "P=17672;#pressure of steam on kpa\n", + "T=712;#temperature of steam in k\n", + "Pc=22.09;#critical pressure of steam in Mpa\n", + "Tc=647.3;#critical temperature of steam in k\n", + "R=0.4615;#gas constant for steam in KJ/kg k\n", + "print(\"1.considering as perfect gas\")\n", + "print(\"specific volume(V)in m^3/kg\")\n", + "V=R*T/P\n", + "print(\"V=\"),round(V,4)\n", + "print(\"2.considering compressibility effects\")\n", + "print(\"reduced pressure(P)in pa\")\n", + "p=P/(Pc*1000)\n", + "print(\"p=\"),round(p,2)\n", + "print(\"reduced temperature(t)in k\")\n", + "t=T/Tc\n", + "print(\"t=\"),round(t,2)\n", + "print(\"from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\")\n", + "print(\"we get Z=0.785\")\n", + "Z=0.785;#compressibility factor\n", + "print(\"now actual specific volume(v)in m^3/kg\")\n", + "v=Z*V\n", + "print(\"v=\"),round(v,4)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.20;page no:30" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.20, Page:30 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\n", + "volume of ballon(V1)in m^3\n", + "V1= 65.45\n", + "molecular mass of hydrogen(M)\n", + "M=2\n", + "gas constant for H2(R1)in J/kg k\n", + "R1= 4157.0\n", + "mass of H2 in ballon(m1)in kg\n", + "m1= 5.316\n", + "volume of air printlaced(V2)=volume of ballon(V1)\n", + "mass of air printlaced(m2)in kg\n", + "m2= 79.66\n", + "gas constant for air(R2)=0.287 KJ/kg k\n", + "load lifting capacity due to buoyant force(m)in kg\n", + "m= 74.343\n" + ] + } + ], + "source": [ + "#estimation of maximum load that can be lifted \n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.20, Page:30 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\")\n", + "d=5.;#diameter of ballon in m\n", + "T1=(27.+273.);#temperature of hydrogen in k\n", + "P=1.013*10**5;#atmospheric pressure in pa\n", + "T2=(17.+273.);#temperature of surrounding air in k\n", + "R=8.314*10**3;#gas constant in J/kg k\n", + "print(\"volume of ballon(V1)in m^3\")\n", + "V1=(4./3.)*math.pi*((d/2)**3)\n", + "print(\"V1=\"),round(V1,2)\n", + "print(\"molecular mass of hydrogen(M)\")\n", + "print(\"M=2\")\n", + "M=2;#molecular mass of hydrogen\n", + "print(\"gas constant for H2(R1)in J/kg k\")\n", + "R1=R/M\n", + "print(\"R1=\"),round(R1,2)\n", + "print(\"mass of H2 in ballon(m1)in kg\")\n", + "m1=(P*V1)/(R1*T1)\n", + "print(\"m1=\"),round(m1,3)\n", + "print(\"volume of air printlaced(V2)=volume of ballon(V1)\")\n", + "print(\"mass of air printlaced(m2)in kg\")\n", + "R2=0.287*1000;#gas constant for air in J/kg k\n", + "m2=(P*V1)/(R2*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"gas constant for air(R2)=0.287 KJ/kg k\")\n", + "print(\"load lifting capacity due to buoyant force(m)in kg\")\n", + "m=m2-m1\n", + "print(\"m=\"),round(m,3)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.21;page no:31" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.21, Page:31 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\n", + "let initial receiver pressure(p1)=1 in pa\n", + "so final receiver pressure(p2)=in pa 0.25\n", + "perfect gas equation,p*V*m=m*R*T\n", + "differentiating and then integrating equation w.r.t to time(t) \n", + "we get t=-(V/v)*log(p2/p1)\n", + "so time(t)in min 110.9\n" + ] + } + ], + "source": [ + "#cal of time required\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.21, Page:31 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\")\n", + "v=0.25;#volume sucking rate of pump in m^3/min\n", + "V=20.;#volume of air vessel in m^3\n", + "p1=1.;#initial receiver pressure in pa\n", + "print(\"let initial receiver pressure(p1)=1 in pa\")\n", + "p2=p1/4.\n", + "print(\"so final receiver pressure(p2)=in pa\"),round(p2,2)\n", + "print(\"perfect gas equation,p*V*m=m*R*T\")\n", + "print(\"differentiating and then integrating equation w.r.t to time(t) \")\n", + "print(\"we get t=-(V/v)*log(p2/p1)\")\n", + "t=-(V/v)*math.log(p2/p1)\n", + "print(\"so time(t)in min\"),round(t,2)\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.22;page no:32" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.22, Page:32 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\n", + "first calculate gas constants for different gases in j/kg k\n", + "for nitrogen,R1= 296.9\n", + "for oxygen,R2= 259.8\n", + "for carbon dioxide,R3= 188.95\n", + "so the gas constant for mixture(Rm)in j/kg k\n", + "Rm= 288.09\n", + "now the specific heat at constant pressure for constituent gases in KJ/kg k\n", + "for nitrogen,Cp1= 1.039\n", + "for oxygen,Cp2= 0.909\n", + "for carbon dioxide,Cp3= 0.819\n", + "so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\n", + "Cpm= 1.0115\n", + "now no. of moles of constituents gases\n", + "for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg 0.143\n", + "for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg 0.028\n", + "for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg 0.0023\n", + "total no. of moles in mixture in mol\n", + "n= 0.1733\n", + "now mole fraction of constituent gases\n", + "for nitrogen,x1= 0.825\n", + "for oxygen,x2= 0.162\n", + "for carbon dioxide,x3= 0.0131\n", + "now the molecular weight of mixture(Mm)in kg/kmol\n", + "Mm= 28.86\n" + ] + } + ], + "source": [ + "#cal of specific heat at constant pressure for constituent gases \n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.22, Page:32 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\")\n", + "m=5;#mass of mixture of gas in kg\n", + "P=1.013*10**5;#pressure of mixture in pa\n", + "T=300;#temperature of mixture in k\n", + "M1=28.;#molecular weight of nitrogen(N2)\n", + "M2=32.;#molecular weight of oxygen(O2)\n", + "M3=44.;#molecular weight of carbon dioxide(CO2)\n", + "f1=0.80;#fraction of N2 in mixture\n", + "f2=0.18;#fraction of O2 in mixture\n", + "f3=0.02;#fraction of CO2 in mixture\n", + "k1=1.4;#ratio of specific heat capacities for N2\n", + "k2=1.4;#ratio of specific heat capacities for O2\n", + "k3=1.3;#ratio of specific heat capacities for CO2\n", + "R=8314;#universal gas constant in J/kg k\n", + "print(\"first calculate gas constants for different gases in j/kg k\")\n", + "R1=R/M1\n", + "print(\"for nitrogen,R1=\"),round(R1,1)\n", + "R2=R/M2\n", + "print(\"for oxygen,R2=\"),round(R2,1)\n", + "R3=R/M3\n", + "print(\"for carbon dioxide,R3=\"),round(R3,2)\n", + "print(\"so the gas constant for mixture(Rm)in j/kg k\")\n", + "Rm=f1*R1+f2*R2+f3*R3\n", + "print(\"Rm=\"),round(Rm,2)\n", + "print(\"now the specific heat at constant pressure for constituent gases in KJ/kg k\")\n", + "Cp1=((k1/(k1-1))*R1)/1000\n", + "print(\"for nitrogen,Cp1=\"),round(Cp1,3)\n", + "Cp2=((k2/(k2-1))*R2)/1000\n", + "print(\"for oxygen,Cp2=\"),round(Cp2,3)\n", + "Cp3=((k3/(k3-1))*R3)/1000\n", + "print(\"for carbon dioxide,Cp3=\"),round(Cp3,3)\n", + "print(\"so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\")\n", + "Cpm=f1*Cp1+f2*Cp2+f3*Cp3\n", + "print(\"Cpm=\"),round(Cpm,4)\n", + "print(\"now no. of moles of constituents gases\")\n", + "m1=f1*m\n", + "n1=m1/M1\n", + "print(\"for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg\"),round(n1,3)\n", + "m2=f2*m\n", + "n2=m2/M2\n", + "print(\"for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg\"),round(n2,3)\n", + "m3=f3*m\n", + "n3=m3/M3\n", + "print(\"for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg\"),round(n3,4)\n", + "print(\"total no. of moles in mixture in mol\")\n", + "n=n1+n2+n3\n", + "print(\"n=\"),round(n,4)\n", + "print(\"now mole fraction of constituent gases\")\n", + "x1=n1/n\n", + "print(\"for nitrogen,x1=\"),round(x1,3)\n", + "x2=n2/n\n", + "print(\"for oxygen,x2=\"),round(x2,3)\n", + "x3=n3/n\n", + "print(\"for carbon dioxide,x3=\"),round(x3,4)\n", + "print(\"now the molecular weight of mixture(Mm)in kg/kmol\")\n", + "Mm=M1*x1+M2*x2+M3*x3\n", + "print(\"Mm=\"),round(Mm,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.23;page no:33" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.23, Page:33 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\n", + "mole fraction of constituent gases\n", + "x=(ni/n)=(Vi/V)\n", + "take volume of mixture(V)=1 m^3\n", + "mole fraction of O2(x1)\n", + "x1= 0.18\n", + "mole fraction of N2(x2)\n", + "x2= 0.75\n", + "mole fraction of CO2(x3)\n", + "x3= 0.07\n", + "now molecular weight of mixture = molar mass(m)\n", + "m= 29.84\n", + "now gravimetric analysis refers to the mass fraction analysis\n", + "mass fraction of constituents\n", + "y=xi*Mi/m\n", + "mole fraction of O2\n", + "y1= 0.193\n", + "mole fraction of N2\n", + "y2= 0.704\n", + "mole fraction of CO2\n", + "y3= 0.103\n", + "now partial pressure of constituents = volume fraction * pressure of mixture\n", + "Pi=xi*P\n", + "partial pressure of O2(P1)in Mpa\n", + "P1= 0.09\n", + "partial pressure of N2(P2)in Mpa\n", + "P2= 0.375\n", + "partial pressure of CO2(P3)in Mpa\n", + "P3= 0.04\n", + "NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\n" + ] + } + ], + "source": [ + "#cal of pressure difference\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.23, Page:33 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\")\n", + "V1=0.18;#volume fraction of O2 in m^3\n", + "V2=0.75;#volume fraction of N2 in m^3\n", + "V3=0.07;#volume fraction of CO2 in m^3\n", + "P=0.5;#pressure of mixture in Mpa\n", + "T=(107+273);#temperature of mixture in k\n", + "M1=32;#molar mass of O2\n", + "M2=28;#molar mass of N2\n", + "M3=44;#molar mass of CO2\n", + "print(\"mole fraction of constituent gases\")\n", + "print(\"x=(ni/n)=(Vi/V)\")\n", + "V=1;# volume of mixture in m^3\n", + "print(\"take volume of mixture(V)=1 m^3\")\n", + "print(\"mole fraction of O2(x1)\")\n", + "x1=V1/V\n", + "print(\"x1=\"),round(x1,2)\n", + "print(\"mole fraction of N2(x2)\")\n", + "x2=V2/V\n", + "print(\"x2=\"),round(x2,2)\n", + "print(\"mole fraction of CO2(x3)\")\n", + "x3=V3/V\n", + "print(\"x3=\"),round(x3,2)\n", + "print(\"now molecular weight of mixture = molar mass(m)\")\n", + "m=x1*M1+x2*M2+x3*M3\n", + "print(\"m=\"),round(m,2)\n", + "print(\"now gravimetric analysis refers to the mass fraction analysis\")\n", + "print(\"mass fraction of constituents\")\n", + "print(\"y=xi*Mi/m\")\n", + "print(\"mole fraction of O2\")\n", + "y1=x1*M1/m\n", + "print(\"y1=\"),round(y1,3)\n", + "print(\"mole fraction of N2\")\n", + "y2=x2*M2/m\n", + "print(\"y2=\"),round(y2,3)\n", + "print(\"mole fraction of CO2\")\n", + "y3=x3*M3/m\n", + "print(\"y3=\"),round(y3,3)\n", + "print(\"now partial pressure of constituents = volume fraction * pressure of mixture\")\n", + "print(\"Pi=xi*P\")\n", + "print(\"partial pressure of O2(P1)in Mpa\")\n", + "p1=x1*P\n", + "print(\"P1=\"),round(p1,2)\n", + "print(\"partial pressure of N2(P2)in Mpa\")\n", + "P2=x2*P\n", + "print(\"P2=\"),round(P2,3)\n", + "P3=x3*P\n", + "print(\"partial pressure of CO2(P3)in Mpa\")\n", + "print(\"P3=\"),round(P3,2)\n", + "print(\"NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.24;page no:34" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.24, Page:34 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\n", + "volume of tank of N2(V1) in m^3= 3.0\n", + "volume of tank of CO2(V2) in m^3= 3.0\n", + "taking the adiabatic condition\n", + "no. of moles of N2(n1)\n", + "n1= 0.6\n", + "no. of moles of CO2(n2)\n", + "n2= 0.37\n", + "total no. of moles of mixture(n)in mol\n", + "n= 0.97\n", + "gas constant for N2(R1)in J/kg k\n", + "R1= 296.93\n", + "gas constant for CO2(R2)in J/kg k\n", + "R2=R/M2 188.95\n", + "specific heat of N2 at constant volume (Cv1) in J/kg k\n", + "Cv1= 742.32\n", + "specific heat of CO2 at constant volume (Cv2) in J/kg k\n", + "Cv2= 629.85\n", + "mass of N2(m1)in kg\n", + "m1= 16.84\n", + "mass of CO2(m2)in kg\n", + "m2= 16.28\n", + "let us consider the equilibrium temperature of mixture after adiabatic mixing at T\n", + "applying energy conservation principle\n", + "m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\n", + "equlibrium temperature(T)in k\n", + "=>T= 439.44\n", + "so the equlibrium pressure(P)in kpa\n", + "P= 591.55\n" + ] + } + ], + "source": [ + "#cal of equilibrium temperature,pressure of mixture\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.24, Page:34 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\")\n", + "V=6;#volume of tank in m^3\n", + "P1=800*10**3;#pressure of N2 gas tank in pa\n", + "T1=480.;#temperature of N2 gas tank in k\n", + "P2=400*10**3;#pressure of CO2 gas tank in pa\n", + "T2=390.;#temperature of CO2 gas tank in k\n", + "k1=1.4;#ratio of specific heat capacity for N2\n", + "k2=1.3;#ratio of specific heat capacity for CO2\n", + "R=8314.;#universal gas constant in J/kg k\n", + "M1=28.;#molecular weight of N2\n", + "M2=44.;#molecular weight of CO2\n", + "V1=V/2\n", + "print(\"volume of tank of N2(V1) in m^3=\"),round(V1,2)\n", + "V2=V/2\n", + "print(\"volume of tank of CO2(V2) in m^3=\"),round(V2,2)\n", + "print(\"taking the adiabatic condition\")\n", + "print(\"no. of moles of N2(n1)\")\n", + "n1=(P1*V1)/(R*T1)\n", + "print(\"n1=\"),round(n1,2)\n", + "print(\"no. of moles of CO2(n2)\")\n", + "n2=(P2*V2)/(R*T2)\n", + "print(\"n2=\"),round(n2,2)\n", + "print(\"total no. of moles of mixture(n)in mol\")\n", + "n=n1+n2\n", + "print(\"n=\"),round(n,2)\n", + "print(\"gas constant for N2(R1)in J/kg k\")\n", + "R1=R/M1\n", + "print(\"R1=\"),round(R1,2)\n", + "print(\"gas constant for CO2(R2)in J/kg k\")\n", + "R2=R/M2\n", + "print(\"R2=R/M2\"),round(R2,2)\n", + "print(\"specific heat of N2 at constant volume (Cv1) in J/kg k\")\n", + "Cv1=R1/(k1-1)\n", + "print(\"Cv1=\"),round(Cv1,2)\n", + "print(\"specific heat of CO2 at constant volume (Cv2) in J/kg k\")\n", + "Cv2=R2/(k2-1)\n", + "print(\"Cv2=\"),round(Cv2,2)\n", + "print(\"mass of N2(m1)in kg\")\n", + "m1=n1*M1\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"mass of CO2(m2)in kg\")\n", + "m2=n2*M2\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"let us consider the equilibrium temperature of mixture after adiabatic mixing at T\")\n", + "print(\"applying energy conservation principle\")\n", + "print(\"m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\")\n", + "print(\"equlibrium temperature(T)in k\")\n", + "T=((m1*Cv1*T1)+(m2*Cv2*T2))/((m1*Cv1)+(m2*Cv2))\n", + "print(\"=>T=\"),round(T,2)\n", + "print(\"so the equlibrium pressure(P)in kpa\")\n", + "P=(n*R*T)/(1000*V)\n", + "print(\"P=\"),round(P,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.25;page no:35" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.25, Page:35 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\n", + "since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\n", + "so the specific heat at constant pressure(Cp)in KJ/kg k\n", + "Cp= 7.608\n" + ] + } + ], + "source": [ + "#cal of specific heat of final mixture\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.25, Page:35 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\")\n", + "m1=2;#mass of H2 in kg\n", + "m2=3;#mass of He in kg\n", + "T=100;#temperature of container in k\n", + "Cp1=11.23;#specific heat at constant pressure for H2 in KJ/kg k\n", + "Cp2=5.193;#specific heat at constant pressure for He in KJ/kg k\n", + "print(\"since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\")\n", + "print(\"so the specific heat at constant pressure(Cp)in KJ/kg k\")\n", + "Cp=((Cp1*m1)+Cp2*m2)/(m1+m2)\n", + "print(\"Cp=\"),round(Cp,3)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.26;page no:35" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.26, Page:35 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\n", + "gas constant for H2(R1)in KJ/kg k\n", + "R1= 4.157\n", + "gas constant for N2(R2)in KJ/kg k\n", + "R2= 0.297\n", + "gas constant for CO2(R3)in KJ/kg k\n", + "R3= 0.189\n", + "so now gas constant for mixture(Rm)in KJ/kg k\n", + "Rm= 2.606\n", + "considering gas to be perfect gas\n", + "total mass of mixture(m)in kg\n", + "m= 30.0\n", + "capacity of vessel(V)in m^3\n", + "V= 231.57\n", + "now final temperature(Tf) is twice of initial temperature(Ti)\n", + "so take k=Tf/Ti=2\n", + "for constant volume heating,final pressure(Pf)in kpa shall be\n", + "Pf= 202.65\n" + ] + } + ], + "source": [ + "#cal of capacity and pressure in the vessel\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.26, Page:35 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\")\n", + "m1=18.;#mass of hydrogen(H2) in kg\n", + "m2=10.;#mass of nitrogen(N2) in kg\n", + "m3=2.;#mass of carbon dioxide(CO2) in kg\n", + "R=8.314;#universal gas constant in KJ/kg k\n", + "Pi=101.325;#atmospheric pressure in kpa\n", + "T=(27+273.15);#ambient temperature in k\n", + "M1=2;#molar mass of H2\n", + "M2=28;#molar mass of N2\n", + "M3=44;#molar mass of CO2\n", + "print(\"gas constant for H2(R1)in KJ/kg k\")\n", + "R1=R/M1\n", + "print(\"R1=\"),round(R1,3)\n", + "print(\"gas constant for N2(R2)in KJ/kg k\")\n", + "R2=R/M2\n", + "print(\"R2=\"),round(R2,3)\n", + "print(\"gas constant for CO2(R3)in KJ/kg k\")\n", + "R3=R/M3\n", + "print(\"R3=\"),round(R3,3)\n", + "print(\"so now gas constant for mixture(Rm)in KJ/kg k\")\n", + "Rm=(m1*R1+m2*R2+m3*R3)/(m1+m2+m3)\n", + "print(\"Rm=\"),round(Rm,3)\n", + "print(\"considering gas to be perfect gas\")\n", + "print(\"total mass of mixture(m)in kg\")\n", + "m=m1+m2+m3\n", + "print(\"m=\"),round(m,2)\n", + "print(\"capacity of vessel(V)in m^3\")\n", + "V=(m*Rm*T)/Pi\n", + "print(\"V=\"),round(V,2)\n", + "print(\"now final temperature(Tf) is twice of initial temperature(Ti)\")\n", + "k=2;#ratio of initial to final temperature\n", + "print(\"so take k=Tf/Ti=2\") \n", + "print(\"for constant volume heating,final pressure(Pf)in kpa shall be\")\n", + "Pf=Pi*k\n", + "print(\"Pf=\"),round(Pf,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.27;page no:36" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.27, Page:36 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\n", + "let inlet state be 1 and exit state be 2\n", + "by charles law volume and temperature can be related as\n", + "(V1/T1)=(V2/T2)\n", + "(V2/V1)=(T2/T1)\n", + "or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\n", + "since change in K.E=0\n", + "so (D2^2/D1^2)=T2/T1\n", + "D2/D1=sqrt(T2/T1)\n", + "say(D2/D1)=k\n", + "so exit to inlet diameter ratio(k) 1.29\n" + ] + } + ], + "source": [ + "#cal of exit to inlet diameter ratio\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.27, Page:36 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\")\n", + "T1=(27.+273.);#initial temperature of air in k\n", + "T2=500.;#final temperature of air in k\n", + "print(\"let inlet state be 1 and exit state be 2\")\n", + "print(\"by charles law volume and temperature can be related as\")\n", + "print(\"(V1/T1)=(V2/T2)\")\n", + "print(\"(V2/V1)=(T2/T1)\")\n", + "print(\"or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\")\n", + "print(\"since change in K.E=0\")\n", + "print(\"so (D2^2/D1^2)=T2/T1\")\n", + "print(\"D2/D1=sqrt(T2/T1)\")\n", + "print(\"say(D2/D1)=k\")\n", + "k=math.sqrt(T2/T1)\n", + "print(\"so exit to inlet diameter ratio(k)\"),round(k,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.28;page no:37" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.28, Page:37 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\n", + "gas constant for H2(R1)in KJ/kg k\n", + "R1= 4.157\n", + "say initial and final ststes are given by 1 and 2\n", + "mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\n", + "final pressure of hydrogen(P2)in cm of Hg\n", + "P2= 6.0\n", + "therefore pressure difference(P)in kpa\n", + "P= 93.33\n", + "mass pumped out(m)in kg\n", + "m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\n", + "here V1=V2=V and T1=T2=T\n", + "so m= 0.15\n", + "now during cooling upto 10 degree celcius,the process may be consider as constant volume process\n", + "say state before and after cooling are denoted by suffix 2 and 3\n", + "final pressure after cooling(P3)in kpa\n", + "P3= 7.546\n" + ] + } + ], + "source": [ + "#cal of final pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.28, Page:37 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\")\n", + "V=2;#volume of vessel in m^3\n", + "P1=76;#initial pressure or atmospheric pressure in cm of Hg\n", + "T=(27+273.15);#temperature of vessel in k\n", + "p=70;#final pressure in cm of Hg vaccum\n", + "R=8.314;#universal gas constant in KJ/kg k\n", + "M=2;#molecular weight of H2\n", + "print(\"gas constant for H2(R1)in KJ/kg k\")\n", + "R1=R/M\n", + "print(\"R1=\"),round(R1,3)\n", + "print(\"say initial and final ststes are given by 1 and 2\")\n", + "print(\"mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\")\n", + "print(\"final pressure of hydrogen(P2)in cm of Hg\")\n", + "P2=P1-p\n", + "print(\"P2=\"),round(P2,2)\n", + "print(\"therefore pressure difference(P)in kpa\")\n", + "P=((P1-P2)*101.325)/76\n", + "print(\"P=\"),round(P,2)\n", + "print(\"mass pumped out(m)in kg\")\n", + "print(\"m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\")\n", + "print(\"here V1=V2=V and T1=T2=T\")\n", + "m=(V*P)/(R1*T)\n", + "print(\"so m=\"),round(m,2)\n", + "print(\"now during cooling upto 10 degree celcius,the process may be consider as constant volume process\")\n", + "print(\"say state before and after cooling are denoted by suffix 2 and 3\")\n", + "T3=(10+273.15);#final temperature after cooling in k\n", + "print(\"final pressure after cooling(P3)in kpa\")\n", + "P3=(T3/T)*P2*(101.325/76)\n", + "print(\"P3=\"),round(P3,3)\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter_1_1.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter_1_1.ipynb new file mode 100755 index 00000000..9474d100 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter_1_1.ipynb @@ -0,0 +1,1777 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# chapter 1:Fundemental concepts and definitions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.1;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.1, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\n", + "pressure difference(p)in pa\n", + "p= 39755.7\n" + ] + } + ], + "source": [ + "#cal of pressure difference\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.1, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\"\n", + "h=30*10**-2;#manometer deflection of mercury in m\n", + "g=9.78;#acceleration due to gravity in m/s^2\n", + "rho=13550;#density of mercury at room temperature in kg/m^3\n", + "print\"pressure difference(p)in pa\"\n", + "p=rho*g*h\n", + "print\"p=\",round(p,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.2;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.2, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\n", + "effort required for lifting the lid(E)in N\n", + "E= 7115.48\n" + ] + } + ], + "source": [ + "#cal of effort required for lifting the lid\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.2, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\"\n", + "d=30*10**-2;#diameter of cylindrical vessel in m\n", + "h=76*10**-2;#atmospheric pressure in m of mercury\n", + "g=9.78;#acceleration due to gravity in m/s^2\n", + "rho=13550;#density of mercury at room temperature in kg/m^3\n", + "print\"effort required for lifting the lid(E)in N\"\n", + "E=(rho*g*h)*(3.14*d**2)/4\n", + "print\"E=\",round(E,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.3;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.3, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\n", + "pressure measured by manometer is gauge pressure(Pg)in kpa\n", + "Pg=rho*g*h/10^3\n", + "actual pressure of the air(P)in kpa\n", + "P= 140.76\n" + ] + } + ], + "source": [ + "#cal of actual pressure of the air\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.3, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\"\n", + "h=30*10**-2;# pressure of compressed air in m of mercury\n", + "Patm=101*10**3;#atmospheric pressure in pa\n", + "g=9.78;#acceleration due to gravity in m/s^2\n", + "rho=13550;#density of mercury at room temperature in kg/m^3\n", + "print\"pressure measured by manometer is gauge pressure(Pg)in kpa\"\n", + "print\"Pg=rho*g*h/10^3\"\n", + "Pg=rho*g*h/10**3\n", + "print\"actual pressure of the air(P)in kpa\"\n", + "P=Pg+Patm/10**3\n", + "print\"P=\",round(P,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.4;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.4, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\n", + "density of oil(RHOoil)in kg/m^3\n", + "RHOoil=sg*RHOw\n", + "gauge pressure(Pg)in kpa\n", + "Pg= 7.848\n" + ] + } + ], + "source": [ + "#cal of gauge pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.4, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\"\n", + "h=1;#depth of oil tank in m\n", + "sg=0.8;#specific gravity of oil\n", + "RHOw=1000;#density of water in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print\"density of oil(RHOoil)in kg/m^3\"\n", + "print\"RHOoil=sg*RHOw\"\n", + "RHOoil=sg*RHOw\n", + "print\"gauge pressure(Pg)in kpa\"\n", + "Pg=RHOoil*g*h/10**3\n", + "print\"Pg=\",round(Pg,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.5;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.5, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\n", + "atmospheric pressure(Patm)in kpa\n", + "Patm=rho*g*h2/10^3\n", + "pressure due to mercury column at AB(Pab)in kpa\n", + "Pab=rho*g*h1/10^3\n", + "pressure exerted by gas(Pgas)in kpa\n", + "Pgas= 154.76\n" + ] + } + ], + "source": [ + "#cal of pressure exerted by gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.5, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\"\n", + "rho=13.6*10**3;#density of mercury in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "h1=40*10**-2;#difference of height in mercury column in m as shown in figure\n", + "h2=76*10**-2;#barometer reading of mercury in m\n", + "print\"atmospheric pressure(Patm)in kpa\"\n", + "print\"Patm=rho*g*h2/10^3\"\n", + "Patm=rho*g*h2/10**3\n", + "print\"pressure due to mercury column at AB(Pab)in kpa\"\n", + "print\"Pab=rho*g*h1/10^3\"\n", + "Pab=rho*g*h1/10**3\n", + "print\"pressure exerted by gas(Pgas)in kpa\"\n", + "Pgas=Patm+Pab\n", + "print\"Pgas=\",round(Pgas,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.6;page no:23" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.6, Page:23 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\n", + "by law of conservation of energy\n", + "potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\n", + "so m*g*h = m*Cp*deltaT*4.18*1000\n", + "change in temperature of water(deltaT) in degree celcius\n", + "deltaT= 2.35\n" + ] + } + ], + "source": [ + "#cal of change in temperature of water\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.6, Page:23 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\"\n", + "m=1;#mass of water in kg\n", + "h=1000;#height from which water fall in m\n", + "Cp=1;#specific heat of water in kcal/kg k\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print\"by law of conservation of energy\"\n", + "print\"potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\"\n", + "print\"so m*g*h = m*Cp*deltaT*4.18*1000\"\n", + "print\"change in temperature of water(deltaT) in degree celcius\"\n", + "deltaT=(g*h)/(4.18*1000*Cp)\n", + "print\"deltaT=\",round(deltaT,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.7;page no:23" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.7, Page:23 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\n", + "mass of object(m)in kg\n", + "m=w1/g1\n", + "spring balance reading=gravitational force in mass(F)in N\n", + "F= 86.65\n" + ] + } + ], + "source": [ + "#cal of spring balance reading\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.7, Page:23 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\"\n", + "w1=100;#weight of object at standard gravitational acceleration in N\n", + "g1=9.81;#acceleration due to gravity in m/s^2\n", + "g2=8.5;#gravitational acceleration at some location\n", + "print\"mass of object(m)in kg\"\n", + "print\"m=w1/g1\"\n", + "m=w1/g1\n", + "print\"spring balance reading=gravitational force in mass(F)in N\"\n", + "F=m*g2\n", + "print\"F=\",round(F,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.8;page no:24" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.8, Page:24 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\n", + "pressure measured by manometer(P) in pa\n", + "p=rho*g*h\n", + "now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\n", + "mass of piston(m)in kg\n", + "so m= 28.84\n" + ] + } + ], + "source": [ + "#cal of mass of piston\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.8, Page:24 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\"\n", + "d=15*10**-2;#diameter of cylinder in m\n", + "h=12*10**-2;#manometer height difference in m of mercury\n", + "rho=13.6*10**3;#density of mercury in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print\"pressure measured by manometer(P) in pa\"\n", + "print\"p=rho*g*h\"\n", + "p=rho*g*h\n", + "print\"now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\"\n", + "print\"mass of piston(m)in kg\"\n", + "m=(p*math.pi*d**2)/(4*g)\n", + "print\"so m=\",round(m,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.9;page no:24" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.9, Page:24 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\n", + "balancing pressure at plane BC in figure we get\n", + "Psteam+Pwater=Patm+Pmercury\n", + "now 1.atmospheric pressure(Patm)in pa\n", + "Patm= 101396.16\n", + "2.pressure due to water(Pwater)in pa\n", + "Pwater= 196.2\n", + "3.pressure due to mercury(Pmercury)in pa\n", + "Pmercury=RHOm*g*h3 13341.6\n", + "using balancing equation\n", + "Psteam=Patm+Pmercury-Pwater\n", + "so pressure of steam(Psteam)in kpa\n", + "Psteam= 114.54\n" + ] + } + ], + "source": [ + "#cal of pressure due to atmosphere,water,mercury,steam\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.9, Page:24 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\")\n", + "RHOm=13.6*10**3;#density of mercury in kg/m^3\n", + "RHOw=1000;#density of water in kg/m^3\n", + "h1=76*10**-2;#barometer reading in m of mercury\n", + "h2=2*10**-2;#height raised by water in manometer tube in m \n", + "h3=10*10**-2;#height raised by mercury in manometer tube in m \n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"balancing pressure at plane BC in figure we get\")\n", + "print(\"Psteam+Pwater=Patm+Pmercury\")\n", + "print(\"now 1.atmospheric pressure(Patm)in pa\")\n", + "Patm=RHOm*g*h1\n", + "print(\"Patm=\"),round(Patm,2)\n", + "print(\"2.pressure due to water(Pwater)in pa\")\n", + "Pwater=RHOw*g*h2\n", + "print(\"Pwater=\"),round(Pwater,2)\n", + "print(\"3.pressure due to mercury(Pmercury)in pa\")\n", + "Pmercury=RHOm*g*h3\n", + "print(\"Pmercury=RHOm*g*h3\"),round(Pmercury,2)\n", + "print(\"using balancing equation\")\n", + "print(\"Psteam=Patm+Pmercury-Pwater\")\n", + "print(\"so pressure of steam(Psteam)in kpa\")\n", + "Psteam=(Patm+Pmercury-Pwater)/1000\n", + "print(\"Psteam=\"),round(Psteam,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.10;page no:24" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.10, Page:24 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\n", + "atmospheric pressure(Patm)in kpa\n", + "absolute temperature in compartment A(Pa) in kpa\n", + "Pa= 496.06\n", + "absolute temperature in compartment B(Pb) in kpa\n", + "Pb= 246.06\n", + "absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\n" + ] + } + ], + "source": [ + "#cal of \"absolute temperature in compartment A,B\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.10, Page:24 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\")\n", + "h=720*10**-3;#barometer reading in m of Hg\n", + "Pga=400;#gauge pressure in compartment A in kpa\n", + "Pgb=150;#gauge pressure in compartment B in kpa\n", + "rho=13.6*10**3;#density of mercury in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"atmospheric pressure(Patm)in kpa\")\n", + "Patm=(rho*g*h)/1000\n", + "print(\"absolute temperature in compartment A(Pa) in kpa\")\n", + "Pa=Pga+Patm\n", + "print\"Pa=\",round(Pa,2)\n", + "print\"absolute temperature in compartment B(Pb) in kpa\"\n", + "Pb=Pgb+Patm\n", + "print\"Pb=\",round(Pb,2)\n", + "print\"absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.11;page no:25" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.11, Page:25 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\n", + "the pressure of air in air tank can be obtained by equalising pressures at some reference line\n", + "P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\n", + "so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\n", + "air pressure(P1)in kpa 139.81\n" + ] + } + ], + "source": [ + "#cal of air pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.11, Page:25 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\")\n", + "Patm=90*10**3;#atmospheric pressure in pa\n", + "RHOw=1000;#density of water in kg/m^3\n", + "RHOm=13600;#density of mercury in kg/m^3\n", + "RHOo=850;#density of oil in kg/m^3\n", + "g=9.81;#acceleration due to ggravity in m/s^2\n", + "h1=.15;#height difference between water column in m\n", + "h2=.25;#height difference between oil column in m\n", + "h3=.4;#height difference between mercury column in m\n", + "print\"the pressure of air in air tank can be obtained by equalising pressures at some reference line\"\n", + "print\"P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\"\n", + "print\"so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\"\n", + "P1=(Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2)/1000\n", + "print\"air pressure(P1)in kpa\",round(P1,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.12;page no:26" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.12, Page:26 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\n", + "mass of object(m)in kg\n", + "m=F/g\n", + "kinetic energy(E)in J is given by\n", + "E= 140625000.0\n" + ] + } + ], + "source": [ + "#cal of kinetic energy\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.12, Page:26 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\"\n", + "v=750;#relative velocity of object with respect to earth in m/sec\n", + "F=4000;#gravitational force in N\n", + "g=8;#acceleration due to gravity in m/s^2\n", + "print\"mass of object(m)in kg\"\n", + "print\"m=F/g\"\n", + "m=F/g\n", + "print\"kinetic energy(E)in J is given by\"\n", + "E=m*v**2/2\n", + "print\"E=\",round(E)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.13;page no:26" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.13, Page:26 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\n", + "characteristics gas constant(R2)in kJ/kg k\n", + "molecular weight of gas(m)in kg/kg mol= 16.63\n", + "NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\n" + ] + } + ], + "source": [ + "#cal of molecular weight of gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.13, Page:26 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\"\n", + "Cp=2.286;#specific heat at constant pressure in kJ/kg k\n", + "Cv=1.786;#specific heat at constant volume in kJ/kg k\n", + "R1=8.3143;#universal gas constant in kJ/kg k\n", + "print\"characteristics gas constant(R2)in kJ/kg k\"\n", + "R2=Cp-Cv\n", + "m=R1/R2\n", + "print\"molecular weight of gas(m)in kg/kg mol=\",round(m,2)\n", + "print\"NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.14;page no:26" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.14, Page:26 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\n", + "using perfect gas equation\n", + "P1*V1/T1 = P2*V2/T2\n", + "=>T2=(P2*V2*T1)/(P1*V1)\n", + "so final temperature of gas(T2)in k\n", + "or final temperature of gas(T2)in degree celcius= 127.0\n" + ] + } + ], + "source": [ + "#cal of final temperature of gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.14, Page:26 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\"\n", + "P1=750*10**3;#initial pressure of gas in pa\n", + "V1=0.2;#initial volume of gas in m^3\n", + "T1=600;#initial temperature of gas in k\n", + "P2=2*10**5;#final pressure of gas i pa\n", + "V2=0.5;#final volume of gas in m^3\n", + "print\"using perfect gas equation\"\n", + "print\"P1*V1/T1 = P2*V2/T2\"\n", + "print\"=>T2=(P2*V2*T1)/(P1*V1)\"\n", + "print\"so final temperature of gas(T2)in k\"\n", + "T2=(P2*V2*T1)/(P1*V1)\n", + "T2=T2-273\n", + "print\"or final temperature of gas(T2)in degree celcius=\",round(T2,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.15;page no:27" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.15, Page:27 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\n", + "from perfect gas equation we get\n", + "initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\n", + "m1= 5.807\n", + "final mass of air(m2 in kg)=(P2*V2)/(R*T2)\n", + "m2= 3.111\n", + "mass of air removed(m)in kg 2.696\n", + "volume of this mass of air(V) at initial states in m^3= 2.32\n" + ] + } + ], + "source": [ + "#cal of volume of this mass of air(V) at initial states\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.15, Page:27 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\"\n", + "P1=100*10**3;#initial pressure of air in pa\n", + "V1=5.;#initial volume of air in m^3\n", + "T1=300.;#initial temperature of gas in k\n", + "P2=50*10**3;#final pressure of air in pa\n", + "V2=5.;#final volume of air in m^3\n", + "T2=(280.);#final temperature of air in K\n", + "R=287.;#gas constant on J/kg k\n", + "print\"from perfect gas equation we get\"\n", + "print\"initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\"\n", + "m1=(P1*V1)/(R*T1)\n", + "print(\"m1=\"),round(m1,3)\n", + "print\"final mass of air(m2 in kg)=(P2*V2)/(R*T2)\"\n", + "m2=(P2*V2)/(R*T2)\n", + "print(\"m2=\"),round(m2,3)\n", + "m=m1-m2\n", + "print\"mass of air removed(m)in kg\",round(m,3)\n", + "V=m*R*T1/P1\n", + "print\"volume of this mass of air(V) at initial states in m^3=\",round(V,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.16;page no:27" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.16, Page:27 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\n", + "here V1=V2\n", + "so P1/T1=P2/T2\n", + "final temperature of hydrogen gas(T2)in k\n", + "=>T2=P2*T1/P1\n", + "now R=(Cp-Cv) in KJ/kg k\n", + "And volume of cylinder(V1)in m^3\n", + "V1=(math.pi*d^2*l)/4\n", + "mass of hydrogen gas(m)in kg\n", + "m= 0.254\n", + "now heat supplied(Q)in KJ\n", + "Q= 193.93\n" + ] + } + ], + "source": [ + "#cal of heat supplied\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.16, Page:27 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\"\n", + "d=1;#diameter of cylinder in m\n", + "l=4;#length of cylinder in m\n", + "P1=100*10**3;#initial pressureof hydrogen gas in pa\n", + "T1=(27+273);#initial temperature of hydrogen gas in k\n", + "P2=125*10**3;#final pressureof hydrogen gas in pa\n", + "Cp=14.307;#specific heat at constant pressure in KJ/kg k\n", + "Cv=10.183;#specific heat at constant volume in KJ/kg k\n", + "print\"here V1=V2\"\n", + "print\"so P1/T1=P2/T2\"\n", + "print\"final temperature of hydrogen gas(T2)in k\"\n", + "print\"=>T2=P2*T1/P1\"\n", + "T2=P2*T1/P1\n", + "print\"now R=(Cp-Cv) in KJ/kg k\"\n", + "R=Cp-Cv\n", + "print\"And volume of cylinder(V1)in m^3\"\n", + "print\"V1=(math.pi*d^2*l)/4\"\n", + "V1=(math.pi*d**2*l)/4\n", + "print\"mass of hydrogen gas(m)in kg\"\n", + "m=(P1*V1)/(1000*R*T1)\n", + "print\"m=\",round(m,3)\n", + "print\"now heat supplied(Q)in KJ\"\n", + "Q=m*Cv*(T2-T1)\n", + "print\"Q=\",round(Q,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.17;page no:28" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.17, Page:28 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\n", + "final total volume(V)in m^3\n", + "V=V1*V2\n", + "total mass of air(m)in kg\n", + "m=m1+m2\n", + "final pressure of air(P)in kpa\n", + "using perfect gas equation\n", + "P= 516.6\n" + ] + } + ], + "source": [ + "#cal of final pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.17, Page:28 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\")\n", + "V1=2.;#volume of first cylinder in m^3\n", + "V2=2.;#volume of second cylinder in m^3\n", + "T=(27+273);#temperature of system in k\n", + "m1=20.;#mass of air in first vessel in kg\n", + "m2=4.;#mass of air in second vessel in kg\n", + "R=287.;#gas constant J/kg k\n", + "print(\"final total volume(V)in m^3\")\n", + "print(\"V=V1*V2\")\n", + "V=V1*V2\n", + "print(\"total mass of air(m)in kg\")\n", + "print(\"m=m1+m2\")\n", + "m=m1+m2\n", + "print(\"final pressure of air(P)in kpa\")\n", + "print(\"using perfect gas equation\")\n", + "P=(m*R*T)/(1000*V)\n", + "print\"P=\",round(P,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.18;page no:28" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.18, Page:28 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\n", + "1.By considering it as a PERFECT GAS\n", + "gas constant for CO2(Rco2)\n", + "Rco2=(J/Kg.k) 188.9\n", + "Also P*V=M*Rco2*T\n", + "pressure of CO2 as perfect gas(P)in N/m^2\n", + "P=(m*Rco2*T)/V 141683.71\n", + "2.By considering as a REAL GAS\n", + "values of vanderwaal constants a,b can be seen from the table which are\n", + "a=(N m^4/(kg mol)^2) 362850.0\n", + "b=(m^3/kg mol) 0.03\n", + "now specific volume(v)in m^3/kg mol\n", + "v= 17.604\n", + "now substituting the value of all variables in vanderwaal equation\n", + "(P+(a/v^2))*(v-b)=R*T\n", + "pressure of CO2 as real gas(P)in N/m^2\n", + "P= 140766.02\n" + ] + } + ], + "source": [ + "#cal of pressure of CO2 as perfect,real gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.18, Page:28 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\")\n", + "m=5;#mass of CO2 in kg\n", + "V=2;#volume of vesssel in m^3\n", + "T=(27+273);#temperature of vessel in k\n", + "R=8.314*10**3;#universal gas constant in J/kg k\n", + "M=44.01;#molecular weight of CO2 \n", + "print(\"1.By considering it as a PERFECT GAS\")\n", + "print(\"gas constant for CO2(Rco2)\")\n", + "Rco2=R/M\n", + "print(\"Rco2=(J/Kg.k)\"),round(Rco2,1)\n", + "print(\"Also P*V=M*Rco2*T\")\n", + "print(\"pressure of CO2 as perfect gas(P)in N/m^2\")\n", + "P=(m*Rco2*T)/V\n", + "print(\"P=(m*Rco2*T)/V \"),round(P,2)\n", + "print(\"2.By considering as a REAL GAS\")\n", + "print(\"values of vanderwaal constants a,b can be seen from the table which are\")\n", + "a=3628.5*10**2#vanderwall constant in N m^4/(kg mol)^2\n", + "b=3.14*10**-2# vanderwall constant in m^3/kg mol\n", + "print(\"a=(N m^4/(kg mol)^2) \"),round(a,2)\n", + "print(\"b=(m^3/kg mol)\"),round(b,2)\n", + "print(\"now specific volume(v)in m^3/kg mol\")\n", + "v=V*M/m\n", + "print(\"v=\"),round(v,3)\n", + "print(\"now substituting the value of all variables in vanderwaal equation\")\n", + "print(\"(P+(a/v^2))*(v-b)=R*T\")\n", + "print(\"pressure of CO2 as real gas(P)in N/m^2\")\n", + "P=((R*T)/(v-b))-(a/v**2)\n", + "print(\"P=\"),round(P,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.19;page no:29" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.19, Page:29 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\n", + "1.considering as perfect gas\n", + "specific volume(V)in m^3/kg\n", + "V= 0.0186\n", + "2.considering compressibility effects\n", + "reduced pressure(P)in pa\n", + "p= 0.8\n", + "reduced temperature(t)in k\n", + "t= 1.1\n", + "from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\n", + "we get Z=0.785\n", + "now actual specific volume(v)in m^3/kg\n", + "v= 0.0146\n" + ] + } + ], + "source": [ + "#cal of specific volume of steam\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.19, Page:29 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\")\n", + "P=17672;#pressure of steam on kpa\n", + "T=712;#temperature of steam in k\n", + "Pc=22.09;#critical pressure of steam in Mpa\n", + "Tc=647.3;#critical temperature of steam in k\n", + "R=0.4615;#gas constant for steam in KJ/kg k\n", + "print(\"1.considering as perfect gas\")\n", + "print(\"specific volume(V)in m^3/kg\")\n", + "V=R*T/P\n", + "print(\"V=\"),round(V,4)\n", + "print(\"2.considering compressibility effects\")\n", + "print(\"reduced pressure(P)in pa\")\n", + "p=P/(Pc*1000)\n", + "print(\"p=\"),round(p,2)\n", + "print(\"reduced temperature(t)in k\")\n", + "t=T/Tc\n", + "print(\"t=\"),round(t,2)\n", + "print(\"from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\")\n", + "print(\"we get Z=0.785\")\n", + "Z=0.785;#compressibility factor\n", + "print(\"now actual specific volume(v)in m^3/kg\")\n", + "v=Z*V\n", + "print(\"v=\"),round(v,4)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.20;page no:30" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.20, Page:30 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\n", + "volume of ballon(V1)in m^3\n", + "V1= 65.45\n", + "molecular mass of hydrogen(M)\n", + "M=2\n", + "gas constant for H2(R1)in J/kg k\n", + "R1= 4157.0\n", + "mass of H2 in ballon(m1)in kg\n", + "m1= 5.316\n", + "volume of air printlaced(V2)=volume of ballon(V1)\n", + "mass of air printlaced(m2)in kg\n", + "m2= 79.66\n", + "gas constant for air(R2)=0.287 KJ/kg k\n", + "load lifting capacity due to buoyant force(m)in kg\n", + "m= 74.343\n" + ] + } + ], + "source": [ + "#estimation of maximum load that can be lifted \n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.20, Page:30 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\")\n", + "d=5.;#diameter of ballon in m\n", + "T1=(27.+273.);#temperature of hydrogen in k\n", + "P=1.013*10**5;#atmospheric pressure in pa\n", + "T2=(17.+273.);#temperature of surrounding air in k\n", + "R=8.314*10**3;#gas constant in J/kg k\n", + "print(\"volume of ballon(V1)in m^3\")\n", + "V1=(4./3.)*math.pi*((d/2)**3)\n", + "print(\"V1=\"),round(V1,2)\n", + "print(\"molecular mass of hydrogen(M)\")\n", + "print(\"M=2\")\n", + "M=2;#molecular mass of hydrogen\n", + "print(\"gas constant for H2(R1)in J/kg k\")\n", + "R1=R/M\n", + "print(\"R1=\"),round(R1,2)\n", + "print(\"mass of H2 in ballon(m1)in kg\")\n", + "m1=(P*V1)/(R1*T1)\n", + "print(\"m1=\"),round(m1,3)\n", + "print(\"volume of air printlaced(V2)=volume of ballon(V1)\")\n", + "print(\"mass of air printlaced(m2)in kg\")\n", + "R2=0.287*1000;#gas constant for air in J/kg k\n", + "m2=(P*V1)/(R2*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"gas constant for air(R2)=0.287 KJ/kg k\")\n", + "print(\"load lifting capacity due to buoyant force(m)in kg\")\n", + "m=m2-m1\n", + "print(\"m=\"),round(m,3)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.21;page no:31" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.21, Page:31 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\n", + "let initial receiver pressure(p1)=1 in pa\n", + "so final receiver pressure(p2)=in pa 0.25\n", + "perfect gas equation,p*V*m=m*R*T\n", + "differentiating and then integrating equation w.r.t to time(t) \n", + "we get t=-(V/v)*log(p2/p1)\n", + "so time(t)in min 110.9\n" + ] + } + ], + "source": [ + "#cal of time required\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.21, Page:31 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\")\n", + "v=0.25;#volume sucking rate of pump in m^3/min\n", + "V=20.;#volume of air vessel in m^3\n", + "p1=1.;#initial receiver pressure in pa\n", + "print(\"let initial receiver pressure(p1)=1 in pa\")\n", + "p2=p1/4.\n", + "print(\"so final receiver pressure(p2)=in pa\"),round(p2,2)\n", + "print(\"perfect gas equation,p*V*m=m*R*T\")\n", + "print(\"differentiating and then integrating equation w.r.t to time(t) \")\n", + "print(\"we get t=-(V/v)*log(p2/p1)\")\n", + "t=-(V/v)*math.log(p2/p1)\n", + "print(\"so time(t)in min\"),round(t,2)\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.22;page no:32" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.22, Page:32 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\n", + "first calculate gas constants for different gases in j/kg k\n", + "for nitrogen,R1= 296.9\n", + "for oxygen,R2= 259.8\n", + "for carbon dioxide,R3= 188.95\n", + "so the gas constant for mixture(Rm)in j/kg k\n", + "Rm= 288.09\n", + "now the specific heat at constant pressure for constituent gases in KJ/kg k\n", + "for nitrogen,Cp1= 1.039\n", + "for oxygen,Cp2= 0.909\n", + "for carbon dioxide,Cp3= 0.819\n", + "so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\n", + "Cpm= 1.0115\n", + "now no. of moles of constituents gases\n", + "for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg 0.143\n", + "for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg 0.028\n", + "for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg 0.0023\n", + "total no. of moles in mixture in mol\n", + "n= 0.1733\n", + "now mole fraction of constituent gases\n", + "for nitrogen,x1= 0.825\n", + "for oxygen,x2= 0.162\n", + "for carbon dioxide,x3= 0.0131\n", + "now the molecular weight of mixture(Mm)in kg/kmol\n", + "Mm= 28.86\n" + ] + } + ], + "source": [ + "#cal of specific heat at constant pressure for constituent gases \n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.22, Page:32 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\")\n", + "m=5;#mass of mixture of gas in kg\n", + "P=1.013*10**5;#pressure of mixture in pa\n", + "T=300;#temperature of mixture in k\n", + "M1=28.;#molecular weight of nitrogen(N2)\n", + "M2=32.;#molecular weight of oxygen(O2)\n", + "M3=44.;#molecular weight of carbon dioxide(CO2)\n", + "f1=0.80;#fraction of N2 in mixture\n", + "f2=0.18;#fraction of O2 in mixture\n", + "f3=0.02;#fraction of CO2 in mixture\n", + "k1=1.4;#ratio of specific heat capacities for N2\n", + "k2=1.4;#ratio of specific heat capacities for O2\n", + "k3=1.3;#ratio of specific heat capacities for CO2\n", + "R=8314;#universal gas constant in J/kg k\n", + "print(\"first calculate gas constants for different gases in j/kg k\")\n", + "R1=R/M1\n", + "print(\"for nitrogen,R1=\"),round(R1,1)\n", + "R2=R/M2\n", + "print(\"for oxygen,R2=\"),round(R2,1)\n", + "R3=R/M3\n", + "print(\"for carbon dioxide,R3=\"),round(R3,2)\n", + "print(\"so the gas constant for mixture(Rm)in j/kg k\")\n", + "Rm=f1*R1+f2*R2+f3*R3\n", + "print(\"Rm=\"),round(Rm,2)\n", + "print(\"now the specific heat at constant pressure for constituent gases in KJ/kg k\")\n", + "Cp1=((k1/(k1-1))*R1)/1000\n", + "print(\"for nitrogen,Cp1=\"),round(Cp1,3)\n", + "Cp2=((k2/(k2-1))*R2)/1000\n", + "print(\"for oxygen,Cp2=\"),round(Cp2,3)\n", + "Cp3=((k3/(k3-1))*R3)/1000\n", + "print(\"for carbon dioxide,Cp3=\"),round(Cp3,3)\n", + "print(\"so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\")\n", + "Cpm=f1*Cp1+f2*Cp2+f3*Cp3\n", + "print(\"Cpm=\"),round(Cpm,4)\n", + "print(\"now no. of moles of constituents gases\")\n", + "m1=f1*m\n", + "n1=m1/M1\n", + "print(\"for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg\"),round(n1,3)\n", + "m2=f2*m\n", + "n2=m2/M2\n", + "print(\"for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg\"),round(n2,3)\n", + "m3=f3*m\n", + "n3=m3/M3\n", + "print(\"for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg\"),round(n3,4)\n", + "print(\"total no. of moles in mixture in mol\")\n", + "n=n1+n2+n3\n", + "print(\"n=\"),round(n,4)\n", + "print(\"now mole fraction of constituent gases\")\n", + "x1=n1/n\n", + "print(\"for nitrogen,x1=\"),round(x1,3)\n", + "x2=n2/n\n", + "print(\"for oxygen,x2=\"),round(x2,3)\n", + "x3=n3/n\n", + "print(\"for carbon dioxide,x3=\"),round(x3,4)\n", + "print(\"now the molecular weight of mixture(Mm)in kg/kmol\")\n", + "Mm=M1*x1+M2*x2+M3*x3\n", + "print(\"Mm=\"),round(Mm,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.23;page no:33" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.23, Page:33 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\n", + "mole fraction of constituent gases\n", + "x=(ni/n)=(Vi/V)\n", + "take volume of mixture(V)=1 m^3\n", + "mole fraction of O2(x1)\n", + "x1= 0.18\n", + "mole fraction of N2(x2)\n", + "x2= 0.75\n", + "mole fraction of CO2(x3)\n", + "x3= 0.07\n", + "now molecular weight of mixture = molar mass(m)\n", + "m= 29.84\n", + "now gravimetric analysis refers to the mass fraction analysis\n", + "mass fraction of constituents\n", + "y=xi*Mi/m\n", + "mole fraction of O2\n", + "y1= 0.193\n", + "mole fraction of N2\n", + "y2= 0.704\n", + "mole fraction of CO2\n", + "y3= 0.103\n", + "now partial pressure of constituents = volume fraction * pressure of mixture\n", + "Pi=xi*P\n", + "partial pressure of O2(P1)in Mpa\n", + "P1= 0.09\n", + "partial pressure of N2(P2)in Mpa\n", + "P2= 0.375\n", + "partial pressure of CO2(P3)in Mpa\n", + "P3= 0.04\n", + "NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\n" + ] + } + ], + "source": [ + "#cal of pressure difference\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.23, Page:33 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\")\n", + "V1=0.18;#volume fraction of O2 in m^3\n", + "V2=0.75;#volume fraction of N2 in m^3\n", + "V3=0.07;#volume fraction of CO2 in m^3\n", + "P=0.5;#pressure of mixture in Mpa\n", + "T=(107+273);#temperature of mixture in k\n", + "M1=32;#molar mass of O2\n", + "M2=28;#molar mass of N2\n", + "M3=44;#molar mass of CO2\n", + "print(\"mole fraction of constituent gases\")\n", + "print(\"x=(ni/n)=(Vi/V)\")\n", + "V=1;# volume of mixture in m^3\n", + "print(\"take volume of mixture(V)=1 m^3\")\n", + "print(\"mole fraction of O2(x1)\")\n", + "x1=V1/V\n", + "print(\"x1=\"),round(x1,2)\n", + "print(\"mole fraction of N2(x2)\")\n", + "x2=V2/V\n", + "print(\"x2=\"),round(x2,2)\n", + "print(\"mole fraction of CO2(x3)\")\n", + "x3=V3/V\n", + "print(\"x3=\"),round(x3,2)\n", + "print(\"now molecular weight of mixture = molar mass(m)\")\n", + "m=x1*M1+x2*M2+x3*M3\n", + "print(\"m=\"),round(m,2)\n", + "print(\"now gravimetric analysis refers to the mass fraction analysis\")\n", + "print(\"mass fraction of constituents\")\n", + "print(\"y=xi*Mi/m\")\n", + "print(\"mole fraction of O2\")\n", + "y1=x1*M1/m\n", + "print(\"y1=\"),round(y1,3)\n", + "print(\"mole fraction of N2\")\n", + "y2=x2*M2/m\n", + "print(\"y2=\"),round(y2,3)\n", + "print(\"mole fraction of CO2\")\n", + "y3=x3*M3/m\n", + "print(\"y3=\"),round(y3,3)\n", + "print(\"now partial pressure of constituents = volume fraction * pressure of mixture\")\n", + "print(\"Pi=xi*P\")\n", + "print(\"partial pressure of O2(P1)in Mpa\")\n", + "p1=x1*P\n", + "print(\"P1=\"),round(p1,2)\n", + "print(\"partial pressure of N2(P2)in Mpa\")\n", + "P2=x2*P\n", + "print(\"P2=\"),round(P2,3)\n", + "P3=x3*P\n", + "print(\"partial pressure of CO2(P3)in Mpa\")\n", + "print(\"P3=\"),round(P3,2)\n", + "print(\"NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.24;page no:34" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.24, Page:34 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\n", + "volume of tank of N2(V1) in m^3= 3.0\n", + "volume of tank of CO2(V2) in m^3= 3.0\n", + "taking the adiabatic condition\n", + "no. of moles of N2(n1)\n", + "n1= 0.6\n", + "no. of moles of CO2(n2)\n", + "n2= 0.37\n", + "total no. of moles of mixture(n)in mol\n", + "n= 0.97\n", + "gas constant for N2(R1)in J/kg k\n", + "R1= 296.93\n", + "gas constant for CO2(R2)in J/kg k\n", + "R2=R/M2 188.95\n", + "specific heat of N2 at constant volume (Cv1) in J/kg k\n", + "Cv1= 742.32\n", + "specific heat of CO2 at constant volume (Cv2) in J/kg k\n", + "Cv2= 629.85\n", + "mass of N2(m1)in kg\n", + "m1= 16.84\n", + "mass of CO2(m2)in kg\n", + "m2= 16.28\n", + "let us consider the equilibrium temperature of mixture after adiabatic mixing at T\n", + "applying energy conservation principle\n", + "m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\n", + "equlibrium temperature(T)in k\n", + "=>T= 439.44\n", + "so the equlibrium pressure(P)in kpa\n", + "P= 591.55\n" + ] + } + ], + "source": [ + "#cal of equilibrium temperature,pressure of mixture\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.24, Page:34 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\")\n", + "V=6;#volume of tank in m^3\n", + "P1=800*10**3;#pressure of N2 gas tank in pa\n", + "T1=480.;#temperature of N2 gas tank in k\n", + "P2=400*10**3;#pressure of CO2 gas tank in pa\n", + "T2=390.;#temperature of CO2 gas tank in k\n", + "k1=1.4;#ratio of specific heat capacity for N2\n", + "k2=1.3;#ratio of specific heat capacity for CO2\n", + "R=8314.;#universal gas constant in J/kg k\n", + "M1=28.;#molecular weight of N2\n", + "M2=44.;#molecular weight of CO2\n", + "V1=V/2\n", + "print(\"volume of tank of N2(V1) in m^3=\"),round(V1,2)\n", + "V2=V/2\n", + "print(\"volume of tank of CO2(V2) in m^3=\"),round(V2,2)\n", + "print(\"taking the adiabatic condition\")\n", + "print(\"no. of moles of N2(n1)\")\n", + "n1=(P1*V1)/(R*T1)\n", + "print(\"n1=\"),round(n1,2)\n", + "print(\"no. of moles of CO2(n2)\")\n", + "n2=(P2*V2)/(R*T2)\n", + "print(\"n2=\"),round(n2,2)\n", + "print(\"total no. of moles of mixture(n)in mol\")\n", + "n=n1+n2\n", + "print(\"n=\"),round(n,2)\n", + "print(\"gas constant for N2(R1)in J/kg k\")\n", + "R1=R/M1\n", + "print(\"R1=\"),round(R1,2)\n", + "print(\"gas constant for CO2(R2)in J/kg k\")\n", + "R2=R/M2\n", + "print(\"R2=R/M2\"),round(R2,2)\n", + "print(\"specific heat of N2 at constant volume (Cv1) in J/kg k\")\n", + "Cv1=R1/(k1-1)\n", + "print(\"Cv1=\"),round(Cv1,2)\n", + "print(\"specific heat of CO2 at constant volume (Cv2) in J/kg k\")\n", + "Cv2=R2/(k2-1)\n", + "print(\"Cv2=\"),round(Cv2,2)\n", + "print(\"mass of N2(m1)in kg\")\n", + "m1=n1*M1\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"mass of CO2(m2)in kg\")\n", + "m2=n2*M2\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"let us consider the equilibrium temperature of mixture after adiabatic mixing at T\")\n", + "print(\"applying energy conservation principle\")\n", + "print(\"m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\")\n", + "print(\"equlibrium temperature(T)in k\")\n", + "T=((m1*Cv1*T1)+(m2*Cv2*T2))/((m1*Cv1)+(m2*Cv2))\n", + "print(\"=>T=\"),round(T,2)\n", + "print(\"so the equlibrium pressure(P)in kpa\")\n", + "P=(n*R*T)/(1000*V)\n", + "print(\"P=\"),round(P,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.25;page no:35" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.25, Page:35 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\n", + "since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\n", + "so the specific heat at constant pressure(Cp)in KJ/kg k\n", + "Cp= 7.608\n" + ] + } + ], + "source": [ + "#cal of specific heat of final mixture\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.25, Page:35 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\")\n", + "m1=2;#mass of H2 in kg\n", + "m2=3;#mass of He in kg\n", + "T=100;#temperature of container in k\n", + "Cp1=11.23;#specific heat at constant pressure for H2 in KJ/kg k\n", + "Cp2=5.193;#specific heat at constant pressure for He in KJ/kg k\n", + "print(\"since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\")\n", + "print(\"so the specific heat at constant pressure(Cp)in KJ/kg k\")\n", + "Cp=((Cp1*m1)+Cp2*m2)/(m1+m2)\n", + "print(\"Cp=\"),round(Cp,3)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.26;page no:35" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.26, Page:35 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\n", + "gas constant for H2(R1)in KJ/kg k\n", + "R1= 4.157\n", + "gas constant for N2(R2)in KJ/kg k\n", + "R2= 0.297\n", + "gas constant for CO2(R3)in KJ/kg k\n", + "R3= 0.189\n", + "so now gas constant for mixture(Rm)in KJ/kg k\n", + "Rm= 2.606\n", + "considering gas to be perfect gas\n", + "total mass of mixture(m)in kg\n", + "m= 30.0\n", + "capacity of vessel(V)in m^3\n", + "V= 231.57\n", + "now final temperature(Tf) is twice of initial temperature(Ti)\n", + "so take k=Tf/Ti=2\n", + "for constant volume heating,final pressure(Pf)in kpa shall be\n", + "Pf= 202.65\n" + ] + } + ], + "source": [ + "#cal of capacity and pressure in the vessel\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.26, Page:35 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\")\n", + "m1=18.;#mass of hydrogen(H2) in kg\n", + "m2=10.;#mass of nitrogen(N2) in kg\n", + "m3=2.;#mass of carbon dioxide(CO2) in kg\n", + "R=8.314;#universal gas constant in KJ/kg k\n", + "Pi=101.325;#atmospheric pressure in kpa\n", + "T=(27+273.15);#ambient temperature in k\n", + "M1=2;#molar mass of H2\n", + "M2=28;#molar mass of N2\n", + "M3=44;#molar mass of CO2\n", + "print(\"gas constant for H2(R1)in KJ/kg k\")\n", + "R1=R/M1\n", + "print(\"R1=\"),round(R1,3)\n", + "print(\"gas constant for N2(R2)in KJ/kg k\")\n", + "R2=R/M2\n", + "print(\"R2=\"),round(R2,3)\n", + "print(\"gas constant for CO2(R3)in KJ/kg k\")\n", + "R3=R/M3\n", + "print(\"R3=\"),round(R3,3)\n", + "print(\"so now gas constant for mixture(Rm)in KJ/kg k\")\n", + "Rm=(m1*R1+m2*R2+m3*R3)/(m1+m2+m3)\n", + "print(\"Rm=\"),round(Rm,3)\n", + "print(\"considering gas to be perfect gas\")\n", + "print(\"total mass of mixture(m)in kg\")\n", + "m=m1+m2+m3\n", + "print(\"m=\"),round(m,2)\n", + "print(\"capacity of vessel(V)in m^3\")\n", + "V=(m*Rm*T)/Pi\n", + "print(\"V=\"),round(V,2)\n", + "print(\"now final temperature(Tf) is twice of initial temperature(Ti)\")\n", + "k=2;#ratio of initial to final temperature\n", + "print(\"so take k=Tf/Ti=2\") \n", + "print(\"for constant volume heating,final pressure(Pf)in kpa shall be\")\n", + "Pf=Pi*k\n", + "print(\"Pf=\"),round(Pf,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.27;page no:36" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.27, Page:36 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\n", + "let inlet state be 1 and exit state be 2\n", + "by charles law volume and temperature can be related as\n", + "(V1/T1)=(V2/T2)\n", + "(V2/V1)=(T2/T1)\n", + "or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\n", + "since change in K.E=0\n", + "so (D2^2/D1^2)=T2/T1\n", + "D2/D1=sqrt(T2/T1)\n", + "say(D2/D1)=k\n", + "so exit to inlet diameter ratio(k) 1.29\n" + ] + } + ], + "source": [ + "#cal of exit to inlet diameter ratio\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.27, Page:36 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\")\n", + "T1=(27.+273.);#initial temperature of air in k\n", + "T2=500.;#final temperature of air in k\n", + "print(\"let inlet state be 1 and exit state be 2\")\n", + "print(\"by charles law volume and temperature can be related as\")\n", + "print(\"(V1/T1)=(V2/T2)\")\n", + "print(\"(V2/V1)=(T2/T1)\")\n", + "print(\"or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\")\n", + "print(\"since change in K.E=0\")\n", + "print(\"so (D2^2/D1^2)=T2/T1\")\n", + "print(\"D2/D1=sqrt(T2/T1)\")\n", + "print(\"say(D2/D1)=k\")\n", + "k=math.sqrt(T2/T1)\n", + "print(\"so exit to inlet diameter ratio(k)\"),round(k,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.28;page no:37" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.28, Page:37 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\n", + "gas constant for H2(R1)in KJ/kg k\n", + "R1= 4.157\n", + "say initial and final ststes are given by 1 and 2\n", + "mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\n", + "final pressure of hydrogen(P2)in cm of Hg\n", + "P2= 6.0\n", + "therefore pressure difference(P)in kpa\n", + "P= 93.33\n", + "mass pumped out(m)in kg\n", + "m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\n", + "here V1=V2=V and T1=T2=T\n", + "so m= 0.15\n", + "now during cooling upto 10 degree celcius,the process may be consider as constant volume process\n", + "say state before and after cooling are denoted by suffix 2 and 3\n", + "final pressure after cooling(P3)in kpa\n", + "P3= 7.546\n" + ] + } + ], + "source": [ + "#cal of final pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.28, Page:37 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\")\n", + "V=2;#volume of vessel in m^3\n", + "P1=76;#initial pressure or atmospheric pressure in cm of Hg\n", + "T=(27+273.15);#temperature of vessel in k\n", + "p=70;#final pressure in cm of Hg vaccum\n", + "R=8.314;#universal gas constant in KJ/kg k\n", + "M=2;#molecular weight of H2\n", + "print(\"gas constant for H2(R1)in KJ/kg k\")\n", + "R1=R/M\n", + "print(\"R1=\"),round(R1,3)\n", + "print(\"say initial and final ststes are given by 1 and 2\")\n", + "print(\"mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\")\n", + "print(\"final pressure of hydrogen(P2)in cm of Hg\")\n", + "P2=P1-p\n", + "print(\"P2=\"),round(P2,2)\n", + "print(\"therefore pressure difference(P)in kpa\")\n", + "P=((P1-P2)*101.325)/76\n", + "print(\"P=\"),round(P,2)\n", + "print(\"mass pumped out(m)in kg\")\n", + "print(\"m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\")\n", + "print(\"here V1=V2=V and T1=T2=T\")\n", + "m=(V*P)/(R1*T)\n", + "print(\"so m=\"),round(m,2)\n", + "print(\"now during cooling upto 10 degree celcius,the process may be consider as constant volume process\")\n", + "print(\"say state before and after cooling are denoted by suffix 2 and 3\")\n", + "T3=(10+273.15);#final temperature after cooling in k\n", + "print(\"final pressure after cooling(P3)in kpa\")\n", + "P3=(T3/T)*P2*(101.325/76)\n", + "print(\"P3=\"),round(P3,3)\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter_1_2.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter_1_2.ipynb new file mode 100755 index 00000000..9474d100 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter_1_2.ipynb @@ -0,0 +1,1777 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# chapter 1:Fundemental concepts and definitions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.1;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.1, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\n", + "pressure difference(p)in pa\n", + "p= 39755.7\n" + ] + } + ], + "source": [ + "#cal of pressure difference\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.1, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\"\n", + "h=30*10**-2;#manometer deflection of mercury in m\n", + "g=9.78;#acceleration due to gravity in m/s^2\n", + "rho=13550;#density of mercury at room temperature in kg/m^3\n", + "print\"pressure difference(p)in pa\"\n", + "p=rho*g*h\n", + "print\"p=\",round(p,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.2;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.2, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\n", + "effort required for lifting the lid(E)in N\n", + "E= 7115.48\n" + ] + } + ], + "source": [ + "#cal of effort required for lifting the lid\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.2, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\"\n", + "d=30*10**-2;#diameter of cylindrical vessel in m\n", + "h=76*10**-2;#atmospheric pressure in m of mercury\n", + "g=9.78;#acceleration due to gravity in m/s^2\n", + "rho=13550;#density of mercury at room temperature in kg/m^3\n", + "print\"effort required for lifting the lid(E)in N\"\n", + "E=(rho*g*h)*(3.14*d**2)/4\n", + "print\"E=\",round(E,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.3;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.3, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\n", + "pressure measured by manometer is gauge pressure(Pg)in kpa\n", + "Pg=rho*g*h/10^3\n", + "actual pressure of the air(P)in kpa\n", + "P= 140.76\n" + ] + } + ], + "source": [ + "#cal of actual pressure of the air\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.3, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\"\n", + "h=30*10**-2;# pressure of compressed air in m of mercury\n", + "Patm=101*10**3;#atmospheric pressure in pa\n", + "g=9.78;#acceleration due to gravity in m/s^2\n", + "rho=13550;#density of mercury at room temperature in kg/m^3\n", + "print\"pressure measured by manometer is gauge pressure(Pg)in kpa\"\n", + "print\"Pg=rho*g*h/10^3\"\n", + "Pg=rho*g*h/10**3\n", + "print\"actual pressure of the air(P)in kpa\"\n", + "P=Pg+Patm/10**3\n", + "print\"P=\",round(P,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.4;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.4, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\n", + "density of oil(RHOoil)in kg/m^3\n", + "RHOoil=sg*RHOw\n", + "gauge pressure(Pg)in kpa\n", + "Pg= 7.848\n" + ] + } + ], + "source": [ + "#cal of gauge pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.4, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\"\n", + "h=1;#depth of oil tank in m\n", + "sg=0.8;#specific gravity of oil\n", + "RHOw=1000;#density of water in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print\"density of oil(RHOoil)in kg/m^3\"\n", + "print\"RHOoil=sg*RHOw\"\n", + "RHOoil=sg*RHOw\n", + "print\"gauge pressure(Pg)in kpa\"\n", + "Pg=RHOoil*g*h/10**3\n", + "print\"Pg=\",round(Pg,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.5;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.5, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\n", + "atmospheric pressure(Patm)in kpa\n", + "Patm=rho*g*h2/10^3\n", + "pressure due to mercury column at AB(Pab)in kpa\n", + "Pab=rho*g*h1/10^3\n", + "pressure exerted by gas(Pgas)in kpa\n", + "Pgas= 154.76\n" + ] + } + ], + "source": [ + "#cal of pressure exerted by gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.5, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\"\n", + "rho=13.6*10**3;#density of mercury in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "h1=40*10**-2;#difference of height in mercury column in m as shown in figure\n", + "h2=76*10**-2;#barometer reading of mercury in m\n", + "print\"atmospheric pressure(Patm)in kpa\"\n", + "print\"Patm=rho*g*h2/10^3\"\n", + "Patm=rho*g*h2/10**3\n", + "print\"pressure due to mercury column at AB(Pab)in kpa\"\n", + "print\"Pab=rho*g*h1/10^3\"\n", + "Pab=rho*g*h1/10**3\n", + "print\"pressure exerted by gas(Pgas)in kpa\"\n", + "Pgas=Patm+Pab\n", + "print\"Pgas=\",round(Pgas,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.6;page no:23" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.6, Page:23 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\n", + "by law of conservation of energy\n", + "potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\n", + "so m*g*h = m*Cp*deltaT*4.18*1000\n", + "change in temperature of water(deltaT) in degree celcius\n", + "deltaT= 2.35\n" + ] + } + ], + "source": [ + "#cal of change in temperature of water\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.6, Page:23 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\"\n", + "m=1;#mass of water in kg\n", + "h=1000;#height from which water fall in m\n", + "Cp=1;#specific heat of water in kcal/kg k\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print\"by law of conservation of energy\"\n", + "print\"potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\"\n", + "print\"so m*g*h = m*Cp*deltaT*4.18*1000\"\n", + "print\"change in temperature of water(deltaT) in degree celcius\"\n", + "deltaT=(g*h)/(4.18*1000*Cp)\n", + "print\"deltaT=\",round(deltaT,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.7;page no:23" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.7, Page:23 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\n", + "mass of object(m)in kg\n", + "m=w1/g1\n", + "spring balance reading=gravitational force in mass(F)in N\n", + "F= 86.65\n" + ] + } + ], + "source": [ + "#cal of spring balance reading\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.7, Page:23 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\"\n", + "w1=100;#weight of object at standard gravitational acceleration in N\n", + "g1=9.81;#acceleration due to gravity in m/s^2\n", + "g2=8.5;#gravitational acceleration at some location\n", + "print\"mass of object(m)in kg\"\n", + "print\"m=w1/g1\"\n", + "m=w1/g1\n", + "print\"spring balance reading=gravitational force in mass(F)in N\"\n", + "F=m*g2\n", + "print\"F=\",round(F,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.8;page no:24" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.8, Page:24 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\n", + "pressure measured by manometer(P) in pa\n", + "p=rho*g*h\n", + "now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\n", + "mass of piston(m)in kg\n", + "so m= 28.84\n" + ] + } + ], + "source": [ + "#cal of mass of piston\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.8, Page:24 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\"\n", + "d=15*10**-2;#diameter of cylinder in m\n", + "h=12*10**-2;#manometer height difference in m of mercury\n", + "rho=13.6*10**3;#density of mercury in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print\"pressure measured by manometer(P) in pa\"\n", + "print\"p=rho*g*h\"\n", + "p=rho*g*h\n", + "print\"now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\"\n", + "print\"mass of piston(m)in kg\"\n", + "m=(p*math.pi*d**2)/(4*g)\n", + "print\"so m=\",round(m,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.9;page no:24" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.9, Page:24 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\n", + "balancing pressure at plane BC in figure we get\n", + "Psteam+Pwater=Patm+Pmercury\n", + "now 1.atmospheric pressure(Patm)in pa\n", + "Patm= 101396.16\n", + "2.pressure due to water(Pwater)in pa\n", + "Pwater= 196.2\n", + "3.pressure due to mercury(Pmercury)in pa\n", + "Pmercury=RHOm*g*h3 13341.6\n", + "using balancing equation\n", + "Psteam=Patm+Pmercury-Pwater\n", + "so pressure of steam(Psteam)in kpa\n", + "Psteam= 114.54\n" + ] + } + ], + "source": [ + "#cal of pressure due to atmosphere,water,mercury,steam\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.9, Page:24 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\")\n", + "RHOm=13.6*10**3;#density of mercury in kg/m^3\n", + "RHOw=1000;#density of water in kg/m^3\n", + "h1=76*10**-2;#barometer reading in m of mercury\n", + "h2=2*10**-2;#height raised by water in manometer tube in m \n", + "h3=10*10**-2;#height raised by mercury in manometer tube in m \n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"balancing pressure at plane BC in figure we get\")\n", + "print(\"Psteam+Pwater=Patm+Pmercury\")\n", + "print(\"now 1.atmospheric pressure(Patm)in pa\")\n", + "Patm=RHOm*g*h1\n", + "print(\"Patm=\"),round(Patm,2)\n", + "print(\"2.pressure due to water(Pwater)in pa\")\n", + "Pwater=RHOw*g*h2\n", + "print(\"Pwater=\"),round(Pwater,2)\n", + "print(\"3.pressure due to mercury(Pmercury)in pa\")\n", + "Pmercury=RHOm*g*h3\n", + "print(\"Pmercury=RHOm*g*h3\"),round(Pmercury,2)\n", + "print(\"using balancing equation\")\n", + "print(\"Psteam=Patm+Pmercury-Pwater\")\n", + "print(\"so pressure of steam(Psteam)in kpa\")\n", + "Psteam=(Patm+Pmercury-Pwater)/1000\n", + "print(\"Psteam=\"),round(Psteam,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.10;page no:24" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.10, Page:24 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\n", + "atmospheric pressure(Patm)in kpa\n", + "absolute temperature in compartment A(Pa) in kpa\n", + "Pa= 496.06\n", + "absolute temperature in compartment B(Pb) in kpa\n", + "Pb= 246.06\n", + "absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\n" + ] + } + ], + "source": [ + "#cal of \"absolute temperature in compartment A,B\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.10, Page:24 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\")\n", + "h=720*10**-3;#barometer reading in m of Hg\n", + "Pga=400;#gauge pressure in compartment A in kpa\n", + "Pgb=150;#gauge pressure in compartment B in kpa\n", + "rho=13.6*10**3;#density of mercury in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"atmospheric pressure(Patm)in kpa\")\n", + "Patm=(rho*g*h)/1000\n", + "print(\"absolute temperature in compartment A(Pa) in kpa\")\n", + "Pa=Pga+Patm\n", + "print\"Pa=\",round(Pa,2)\n", + "print\"absolute temperature in compartment B(Pb) in kpa\"\n", + "Pb=Pgb+Patm\n", + "print\"Pb=\",round(Pb,2)\n", + "print\"absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.11;page no:25" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.11, Page:25 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\n", + "the pressure of air in air tank can be obtained by equalising pressures at some reference line\n", + "P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\n", + "so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\n", + "air pressure(P1)in kpa 139.81\n" + ] + } + ], + "source": [ + "#cal of air pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.11, Page:25 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\")\n", + "Patm=90*10**3;#atmospheric pressure in pa\n", + "RHOw=1000;#density of water in kg/m^3\n", + "RHOm=13600;#density of mercury in kg/m^3\n", + "RHOo=850;#density of oil in kg/m^3\n", + "g=9.81;#acceleration due to ggravity in m/s^2\n", + "h1=.15;#height difference between water column in m\n", + "h2=.25;#height difference between oil column in m\n", + "h3=.4;#height difference between mercury column in m\n", + "print\"the pressure of air in air tank can be obtained by equalising pressures at some reference line\"\n", + "print\"P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\"\n", + "print\"so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\"\n", + "P1=(Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2)/1000\n", + "print\"air pressure(P1)in kpa\",round(P1,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.12;page no:26" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.12, Page:26 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\n", + "mass of object(m)in kg\n", + "m=F/g\n", + "kinetic energy(E)in J is given by\n", + "E= 140625000.0\n" + ] + } + ], + "source": [ + "#cal of kinetic energy\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.12, Page:26 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\"\n", + "v=750;#relative velocity of object with respect to earth in m/sec\n", + "F=4000;#gravitational force in N\n", + "g=8;#acceleration due to gravity in m/s^2\n", + "print\"mass of object(m)in kg\"\n", + "print\"m=F/g\"\n", + "m=F/g\n", + "print\"kinetic energy(E)in J is given by\"\n", + "E=m*v**2/2\n", + "print\"E=\",round(E)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.13;page no:26" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.13, Page:26 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\n", + "characteristics gas constant(R2)in kJ/kg k\n", + "molecular weight of gas(m)in kg/kg mol= 16.63\n", + "NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\n" + ] + } + ], + "source": [ + "#cal of molecular weight of gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.13, Page:26 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\"\n", + "Cp=2.286;#specific heat at constant pressure in kJ/kg k\n", + "Cv=1.786;#specific heat at constant volume in kJ/kg k\n", + "R1=8.3143;#universal gas constant in kJ/kg k\n", + "print\"characteristics gas constant(R2)in kJ/kg k\"\n", + "R2=Cp-Cv\n", + "m=R1/R2\n", + "print\"molecular weight of gas(m)in kg/kg mol=\",round(m,2)\n", + "print\"NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.14;page no:26" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.14, Page:26 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\n", + "using perfect gas equation\n", + "P1*V1/T1 = P2*V2/T2\n", + "=>T2=(P2*V2*T1)/(P1*V1)\n", + "so final temperature of gas(T2)in k\n", + "or final temperature of gas(T2)in degree celcius= 127.0\n" + ] + } + ], + "source": [ + "#cal of final temperature of gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.14, Page:26 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\"\n", + "P1=750*10**3;#initial pressure of gas in pa\n", + "V1=0.2;#initial volume of gas in m^3\n", + "T1=600;#initial temperature of gas in k\n", + "P2=2*10**5;#final pressure of gas i pa\n", + "V2=0.5;#final volume of gas in m^3\n", + "print\"using perfect gas equation\"\n", + "print\"P1*V1/T1 = P2*V2/T2\"\n", + "print\"=>T2=(P2*V2*T1)/(P1*V1)\"\n", + "print\"so final temperature of gas(T2)in k\"\n", + "T2=(P2*V2*T1)/(P1*V1)\n", + "T2=T2-273\n", + "print\"or final temperature of gas(T2)in degree celcius=\",round(T2,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.15;page no:27" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.15, Page:27 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\n", + "from perfect gas equation we get\n", + "initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\n", + "m1= 5.807\n", + "final mass of air(m2 in kg)=(P2*V2)/(R*T2)\n", + "m2= 3.111\n", + "mass of air removed(m)in kg 2.696\n", + "volume of this mass of air(V) at initial states in m^3= 2.32\n" + ] + } + ], + "source": [ + "#cal of volume of this mass of air(V) at initial states\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.15, Page:27 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\"\n", + "P1=100*10**3;#initial pressure of air in pa\n", + "V1=5.;#initial volume of air in m^3\n", + "T1=300.;#initial temperature of gas in k\n", + "P2=50*10**3;#final pressure of air in pa\n", + "V2=5.;#final volume of air in m^3\n", + "T2=(280.);#final temperature of air in K\n", + "R=287.;#gas constant on J/kg k\n", + "print\"from perfect gas equation we get\"\n", + "print\"initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\"\n", + "m1=(P1*V1)/(R*T1)\n", + "print(\"m1=\"),round(m1,3)\n", + "print\"final mass of air(m2 in kg)=(P2*V2)/(R*T2)\"\n", + "m2=(P2*V2)/(R*T2)\n", + "print(\"m2=\"),round(m2,3)\n", + "m=m1-m2\n", + "print\"mass of air removed(m)in kg\",round(m,3)\n", + "V=m*R*T1/P1\n", + "print\"volume of this mass of air(V) at initial states in m^3=\",round(V,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.16;page no:27" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.16, Page:27 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\n", + "here V1=V2\n", + "so P1/T1=P2/T2\n", + "final temperature of hydrogen gas(T2)in k\n", + "=>T2=P2*T1/P1\n", + "now R=(Cp-Cv) in KJ/kg k\n", + "And volume of cylinder(V1)in m^3\n", + "V1=(math.pi*d^2*l)/4\n", + "mass of hydrogen gas(m)in kg\n", + "m= 0.254\n", + "now heat supplied(Q)in KJ\n", + "Q= 193.93\n" + ] + } + ], + "source": [ + "#cal of heat supplied\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.16, Page:27 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\"\n", + "d=1;#diameter of cylinder in m\n", + "l=4;#length of cylinder in m\n", + "P1=100*10**3;#initial pressureof hydrogen gas in pa\n", + "T1=(27+273);#initial temperature of hydrogen gas in k\n", + "P2=125*10**3;#final pressureof hydrogen gas in pa\n", + "Cp=14.307;#specific heat at constant pressure in KJ/kg k\n", + "Cv=10.183;#specific heat at constant volume in KJ/kg k\n", + "print\"here V1=V2\"\n", + "print\"so P1/T1=P2/T2\"\n", + "print\"final temperature of hydrogen gas(T2)in k\"\n", + "print\"=>T2=P2*T1/P1\"\n", + "T2=P2*T1/P1\n", + "print\"now R=(Cp-Cv) in KJ/kg k\"\n", + "R=Cp-Cv\n", + "print\"And volume of cylinder(V1)in m^3\"\n", + "print\"V1=(math.pi*d^2*l)/4\"\n", + "V1=(math.pi*d**2*l)/4\n", + "print\"mass of hydrogen gas(m)in kg\"\n", + "m=(P1*V1)/(1000*R*T1)\n", + "print\"m=\",round(m,3)\n", + "print\"now heat supplied(Q)in KJ\"\n", + "Q=m*Cv*(T2-T1)\n", + "print\"Q=\",round(Q,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.17;page no:28" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.17, Page:28 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\n", + "final total volume(V)in m^3\n", + "V=V1*V2\n", + "total mass of air(m)in kg\n", + "m=m1+m2\n", + "final pressure of air(P)in kpa\n", + "using perfect gas equation\n", + "P= 516.6\n" + ] + } + ], + "source": [ + "#cal of final pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.17, Page:28 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\")\n", + "V1=2.;#volume of first cylinder in m^3\n", + "V2=2.;#volume of second cylinder in m^3\n", + "T=(27+273);#temperature of system in k\n", + "m1=20.;#mass of air in first vessel in kg\n", + "m2=4.;#mass of air in second vessel in kg\n", + "R=287.;#gas constant J/kg k\n", + "print(\"final total volume(V)in m^3\")\n", + "print(\"V=V1*V2\")\n", + "V=V1*V2\n", + "print(\"total mass of air(m)in kg\")\n", + "print(\"m=m1+m2\")\n", + "m=m1+m2\n", + "print(\"final pressure of air(P)in kpa\")\n", + "print(\"using perfect gas equation\")\n", + "P=(m*R*T)/(1000*V)\n", + "print\"P=\",round(P,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.18;page no:28" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.18, Page:28 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\n", + "1.By considering it as a PERFECT GAS\n", + "gas constant for CO2(Rco2)\n", + "Rco2=(J/Kg.k) 188.9\n", + "Also P*V=M*Rco2*T\n", + "pressure of CO2 as perfect gas(P)in N/m^2\n", + "P=(m*Rco2*T)/V 141683.71\n", + "2.By considering as a REAL GAS\n", + "values of vanderwaal constants a,b can be seen from the table which are\n", + "a=(N m^4/(kg mol)^2) 362850.0\n", + "b=(m^3/kg mol) 0.03\n", + "now specific volume(v)in m^3/kg mol\n", + "v= 17.604\n", + "now substituting the value of all variables in vanderwaal equation\n", + "(P+(a/v^2))*(v-b)=R*T\n", + "pressure of CO2 as real gas(P)in N/m^2\n", + "P= 140766.02\n" + ] + } + ], + "source": [ + "#cal of pressure of CO2 as perfect,real gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.18, Page:28 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\")\n", + "m=5;#mass of CO2 in kg\n", + "V=2;#volume of vesssel in m^3\n", + "T=(27+273);#temperature of vessel in k\n", + "R=8.314*10**3;#universal gas constant in J/kg k\n", + "M=44.01;#molecular weight of CO2 \n", + "print(\"1.By considering it as a PERFECT GAS\")\n", + "print(\"gas constant for CO2(Rco2)\")\n", + "Rco2=R/M\n", + "print(\"Rco2=(J/Kg.k)\"),round(Rco2,1)\n", + "print(\"Also P*V=M*Rco2*T\")\n", + "print(\"pressure of CO2 as perfect gas(P)in N/m^2\")\n", + "P=(m*Rco2*T)/V\n", + "print(\"P=(m*Rco2*T)/V \"),round(P,2)\n", + "print(\"2.By considering as a REAL GAS\")\n", + "print(\"values of vanderwaal constants a,b can be seen from the table which are\")\n", + "a=3628.5*10**2#vanderwall constant in N m^4/(kg mol)^2\n", + "b=3.14*10**-2# vanderwall constant in m^3/kg mol\n", + "print(\"a=(N m^4/(kg mol)^2) \"),round(a,2)\n", + "print(\"b=(m^3/kg mol)\"),round(b,2)\n", + "print(\"now specific volume(v)in m^3/kg mol\")\n", + "v=V*M/m\n", + "print(\"v=\"),round(v,3)\n", + "print(\"now substituting the value of all variables in vanderwaal equation\")\n", + "print(\"(P+(a/v^2))*(v-b)=R*T\")\n", + "print(\"pressure of CO2 as real gas(P)in N/m^2\")\n", + "P=((R*T)/(v-b))-(a/v**2)\n", + "print(\"P=\"),round(P,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.19;page no:29" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.19, Page:29 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\n", + "1.considering as perfect gas\n", + "specific volume(V)in m^3/kg\n", + "V= 0.0186\n", + "2.considering compressibility effects\n", + "reduced pressure(P)in pa\n", + "p= 0.8\n", + "reduced temperature(t)in k\n", + "t= 1.1\n", + "from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\n", + "we get Z=0.785\n", + "now actual specific volume(v)in m^3/kg\n", + "v= 0.0146\n" + ] + } + ], + "source": [ + "#cal of specific volume of steam\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.19, Page:29 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\")\n", + "P=17672;#pressure of steam on kpa\n", + "T=712;#temperature of steam in k\n", + "Pc=22.09;#critical pressure of steam in Mpa\n", + "Tc=647.3;#critical temperature of steam in k\n", + "R=0.4615;#gas constant for steam in KJ/kg k\n", + "print(\"1.considering as perfect gas\")\n", + "print(\"specific volume(V)in m^3/kg\")\n", + "V=R*T/P\n", + "print(\"V=\"),round(V,4)\n", + "print(\"2.considering compressibility effects\")\n", + "print(\"reduced pressure(P)in pa\")\n", + "p=P/(Pc*1000)\n", + "print(\"p=\"),round(p,2)\n", + "print(\"reduced temperature(t)in k\")\n", + "t=T/Tc\n", + "print(\"t=\"),round(t,2)\n", + "print(\"from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\")\n", + "print(\"we get Z=0.785\")\n", + "Z=0.785;#compressibility factor\n", + "print(\"now actual specific volume(v)in m^3/kg\")\n", + "v=Z*V\n", + "print(\"v=\"),round(v,4)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.20;page no:30" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.20, Page:30 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\n", + "volume of ballon(V1)in m^3\n", + "V1= 65.45\n", + "molecular mass of hydrogen(M)\n", + "M=2\n", + "gas constant for H2(R1)in J/kg k\n", + "R1= 4157.0\n", + "mass of H2 in ballon(m1)in kg\n", + "m1= 5.316\n", + "volume of air printlaced(V2)=volume of ballon(V1)\n", + "mass of air printlaced(m2)in kg\n", + "m2= 79.66\n", + "gas constant for air(R2)=0.287 KJ/kg k\n", + "load lifting capacity due to buoyant force(m)in kg\n", + "m= 74.343\n" + ] + } + ], + "source": [ + "#estimation of maximum load that can be lifted \n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.20, Page:30 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\")\n", + "d=5.;#diameter of ballon in m\n", + "T1=(27.+273.);#temperature of hydrogen in k\n", + "P=1.013*10**5;#atmospheric pressure in pa\n", + "T2=(17.+273.);#temperature of surrounding air in k\n", + "R=8.314*10**3;#gas constant in J/kg k\n", + "print(\"volume of ballon(V1)in m^3\")\n", + "V1=(4./3.)*math.pi*((d/2)**3)\n", + "print(\"V1=\"),round(V1,2)\n", + "print(\"molecular mass of hydrogen(M)\")\n", + "print(\"M=2\")\n", + "M=2;#molecular mass of hydrogen\n", + "print(\"gas constant for H2(R1)in J/kg k\")\n", + "R1=R/M\n", + "print(\"R1=\"),round(R1,2)\n", + "print(\"mass of H2 in ballon(m1)in kg\")\n", + "m1=(P*V1)/(R1*T1)\n", + "print(\"m1=\"),round(m1,3)\n", + "print(\"volume of air printlaced(V2)=volume of ballon(V1)\")\n", + "print(\"mass of air printlaced(m2)in kg\")\n", + "R2=0.287*1000;#gas constant for air in J/kg k\n", + "m2=(P*V1)/(R2*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"gas constant for air(R2)=0.287 KJ/kg k\")\n", + "print(\"load lifting capacity due to buoyant force(m)in kg\")\n", + "m=m2-m1\n", + "print(\"m=\"),round(m,3)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.21;page no:31" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.21, Page:31 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\n", + "let initial receiver pressure(p1)=1 in pa\n", + "so final receiver pressure(p2)=in pa 0.25\n", + "perfect gas equation,p*V*m=m*R*T\n", + "differentiating and then integrating equation w.r.t to time(t) \n", + "we get t=-(V/v)*log(p2/p1)\n", + "so time(t)in min 110.9\n" + ] + } + ], + "source": [ + "#cal of time required\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.21, Page:31 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\")\n", + "v=0.25;#volume sucking rate of pump in m^3/min\n", + "V=20.;#volume of air vessel in m^3\n", + "p1=1.;#initial receiver pressure in pa\n", + "print(\"let initial receiver pressure(p1)=1 in pa\")\n", + "p2=p1/4.\n", + "print(\"so final receiver pressure(p2)=in pa\"),round(p2,2)\n", + "print(\"perfect gas equation,p*V*m=m*R*T\")\n", + "print(\"differentiating and then integrating equation w.r.t to time(t) \")\n", + "print(\"we get t=-(V/v)*log(p2/p1)\")\n", + "t=-(V/v)*math.log(p2/p1)\n", + "print(\"so time(t)in min\"),round(t,2)\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.22;page no:32" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.22, Page:32 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\n", + "first calculate gas constants for different gases in j/kg k\n", + "for nitrogen,R1= 296.9\n", + "for oxygen,R2= 259.8\n", + "for carbon dioxide,R3= 188.95\n", + "so the gas constant for mixture(Rm)in j/kg k\n", + "Rm= 288.09\n", + "now the specific heat at constant pressure for constituent gases in KJ/kg k\n", + "for nitrogen,Cp1= 1.039\n", + "for oxygen,Cp2= 0.909\n", + "for carbon dioxide,Cp3= 0.819\n", + "so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\n", + "Cpm= 1.0115\n", + "now no. of moles of constituents gases\n", + "for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg 0.143\n", + "for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg 0.028\n", + "for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg 0.0023\n", + "total no. of moles in mixture in mol\n", + "n= 0.1733\n", + "now mole fraction of constituent gases\n", + "for nitrogen,x1= 0.825\n", + "for oxygen,x2= 0.162\n", + "for carbon dioxide,x3= 0.0131\n", + "now the molecular weight of mixture(Mm)in kg/kmol\n", + "Mm= 28.86\n" + ] + } + ], + "source": [ + "#cal of specific heat at constant pressure for constituent gases \n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.22, Page:32 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\")\n", + "m=5;#mass of mixture of gas in kg\n", + "P=1.013*10**5;#pressure of mixture in pa\n", + "T=300;#temperature of mixture in k\n", + "M1=28.;#molecular weight of nitrogen(N2)\n", + "M2=32.;#molecular weight of oxygen(O2)\n", + "M3=44.;#molecular weight of carbon dioxide(CO2)\n", + "f1=0.80;#fraction of N2 in mixture\n", + "f2=0.18;#fraction of O2 in mixture\n", + "f3=0.02;#fraction of CO2 in mixture\n", + "k1=1.4;#ratio of specific heat capacities for N2\n", + "k2=1.4;#ratio of specific heat capacities for O2\n", + "k3=1.3;#ratio of specific heat capacities for CO2\n", + "R=8314;#universal gas constant in J/kg k\n", + "print(\"first calculate gas constants for different gases in j/kg k\")\n", + "R1=R/M1\n", + "print(\"for nitrogen,R1=\"),round(R1,1)\n", + "R2=R/M2\n", + "print(\"for oxygen,R2=\"),round(R2,1)\n", + "R3=R/M3\n", + "print(\"for carbon dioxide,R3=\"),round(R3,2)\n", + "print(\"so the gas constant for mixture(Rm)in j/kg k\")\n", + "Rm=f1*R1+f2*R2+f3*R3\n", + "print(\"Rm=\"),round(Rm,2)\n", + "print(\"now the specific heat at constant pressure for constituent gases in KJ/kg k\")\n", + "Cp1=((k1/(k1-1))*R1)/1000\n", + "print(\"for nitrogen,Cp1=\"),round(Cp1,3)\n", + "Cp2=((k2/(k2-1))*R2)/1000\n", + "print(\"for oxygen,Cp2=\"),round(Cp2,3)\n", + "Cp3=((k3/(k3-1))*R3)/1000\n", + "print(\"for carbon dioxide,Cp3=\"),round(Cp3,3)\n", + "print(\"so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\")\n", + "Cpm=f1*Cp1+f2*Cp2+f3*Cp3\n", + "print(\"Cpm=\"),round(Cpm,4)\n", + "print(\"now no. of moles of constituents gases\")\n", + "m1=f1*m\n", + "n1=m1/M1\n", + "print(\"for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg\"),round(n1,3)\n", + "m2=f2*m\n", + "n2=m2/M2\n", + "print(\"for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg\"),round(n2,3)\n", + "m3=f3*m\n", + "n3=m3/M3\n", + "print(\"for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg\"),round(n3,4)\n", + "print(\"total no. of moles in mixture in mol\")\n", + "n=n1+n2+n3\n", + "print(\"n=\"),round(n,4)\n", + "print(\"now mole fraction of constituent gases\")\n", + "x1=n1/n\n", + "print(\"for nitrogen,x1=\"),round(x1,3)\n", + "x2=n2/n\n", + "print(\"for oxygen,x2=\"),round(x2,3)\n", + "x3=n3/n\n", + "print(\"for carbon dioxide,x3=\"),round(x3,4)\n", + "print(\"now the molecular weight of mixture(Mm)in kg/kmol\")\n", + "Mm=M1*x1+M2*x2+M3*x3\n", + "print(\"Mm=\"),round(Mm,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.23;page no:33" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.23, Page:33 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\n", + "mole fraction of constituent gases\n", + "x=(ni/n)=(Vi/V)\n", + "take volume of mixture(V)=1 m^3\n", + "mole fraction of O2(x1)\n", + "x1= 0.18\n", + "mole fraction of N2(x2)\n", + "x2= 0.75\n", + "mole fraction of CO2(x3)\n", + "x3= 0.07\n", + "now molecular weight of mixture = molar mass(m)\n", + "m= 29.84\n", + "now gravimetric analysis refers to the mass fraction analysis\n", + "mass fraction of constituents\n", + "y=xi*Mi/m\n", + "mole fraction of O2\n", + "y1= 0.193\n", + "mole fraction of N2\n", + "y2= 0.704\n", + "mole fraction of CO2\n", + "y3= 0.103\n", + "now partial pressure of constituents = volume fraction * pressure of mixture\n", + "Pi=xi*P\n", + "partial pressure of O2(P1)in Mpa\n", + "P1= 0.09\n", + "partial pressure of N2(P2)in Mpa\n", + "P2= 0.375\n", + "partial pressure of CO2(P3)in Mpa\n", + "P3= 0.04\n", + "NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\n" + ] + } + ], + "source": [ + "#cal of pressure difference\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.23, Page:33 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\")\n", + "V1=0.18;#volume fraction of O2 in m^3\n", + "V2=0.75;#volume fraction of N2 in m^3\n", + "V3=0.07;#volume fraction of CO2 in m^3\n", + "P=0.5;#pressure of mixture in Mpa\n", + "T=(107+273);#temperature of mixture in k\n", + "M1=32;#molar mass of O2\n", + "M2=28;#molar mass of N2\n", + "M3=44;#molar mass of CO2\n", + "print(\"mole fraction of constituent gases\")\n", + "print(\"x=(ni/n)=(Vi/V)\")\n", + "V=1;# volume of mixture in m^3\n", + "print(\"take volume of mixture(V)=1 m^3\")\n", + "print(\"mole fraction of O2(x1)\")\n", + "x1=V1/V\n", + "print(\"x1=\"),round(x1,2)\n", + "print(\"mole fraction of N2(x2)\")\n", + "x2=V2/V\n", + "print(\"x2=\"),round(x2,2)\n", + "print(\"mole fraction of CO2(x3)\")\n", + "x3=V3/V\n", + "print(\"x3=\"),round(x3,2)\n", + "print(\"now molecular weight of mixture = molar mass(m)\")\n", + "m=x1*M1+x2*M2+x3*M3\n", + "print(\"m=\"),round(m,2)\n", + "print(\"now gravimetric analysis refers to the mass fraction analysis\")\n", + "print(\"mass fraction of constituents\")\n", + "print(\"y=xi*Mi/m\")\n", + "print(\"mole fraction of O2\")\n", + "y1=x1*M1/m\n", + "print(\"y1=\"),round(y1,3)\n", + "print(\"mole fraction of N2\")\n", + "y2=x2*M2/m\n", + "print(\"y2=\"),round(y2,3)\n", + "print(\"mole fraction of CO2\")\n", + "y3=x3*M3/m\n", + "print(\"y3=\"),round(y3,3)\n", + "print(\"now partial pressure of constituents = volume fraction * pressure of mixture\")\n", + "print(\"Pi=xi*P\")\n", + "print(\"partial pressure of O2(P1)in Mpa\")\n", + "p1=x1*P\n", + "print(\"P1=\"),round(p1,2)\n", + "print(\"partial pressure of N2(P2)in Mpa\")\n", + "P2=x2*P\n", + "print(\"P2=\"),round(P2,3)\n", + "P3=x3*P\n", + "print(\"partial pressure of CO2(P3)in Mpa\")\n", + "print(\"P3=\"),round(P3,2)\n", + "print(\"NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.24;page no:34" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.24, Page:34 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\n", + "volume of tank of N2(V1) in m^3= 3.0\n", + "volume of tank of CO2(V2) in m^3= 3.0\n", + "taking the adiabatic condition\n", + "no. of moles of N2(n1)\n", + "n1= 0.6\n", + "no. of moles of CO2(n2)\n", + "n2= 0.37\n", + "total no. of moles of mixture(n)in mol\n", + "n= 0.97\n", + "gas constant for N2(R1)in J/kg k\n", + "R1= 296.93\n", + "gas constant for CO2(R2)in J/kg k\n", + "R2=R/M2 188.95\n", + "specific heat of N2 at constant volume (Cv1) in J/kg k\n", + "Cv1= 742.32\n", + "specific heat of CO2 at constant volume (Cv2) in J/kg k\n", + "Cv2= 629.85\n", + "mass of N2(m1)in kg\n", + "m1= 16.84\n", + "mass of CO2(m2)in kg\n", + "m2= 16.28\n", + "let us consider the equilibrium temperature of mixture after adiabatic mixing at T\n", + "applying energy conservation principle\n", + "m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\n", + "equlibrium temperature(T)in k\n", + "=>T= 439.44\n", + "so the equlibrium pressure(P)in kpa\n", + "P= 591.55\n" + ] + } + ], + "source": [ + "#cal of equilibrium temperature,pressure of mixture\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.24, Page:34 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\")\n", + "V=6;#volume of tank in m^3\n", + "P1=800*10**3;#pressure of N2 gas tank in pa\n", + "T1=480.;#temperature of N2 gas tank in k\n", + "P2=400*10**3;#pressure of CO2 gas tank in pa\n", + "T2=390.;#temperature of CO2 gas tank in k\n", + "k1=1.4;#ratio of specific heat capacity for N2\n", + "k2=1.3;#ratio of specific heat capacity for CO2\n", + "R=8314.;#universal gas constant in J/kg k\n", + "M1=28.;#molecular weight of N2\n", + "M2=44.;#molecular weight of CO2\n", + "V1=V/2\n", + "print(\"volume of tank of N2(V1) in m^3=\"),round(V1,2)\n", + "V2=V/2\n", + "print(\"volume of tank of CO2(V2) in m^3=\"),round(V2,2)\n", + "print(\"taking the adiabatic condition\")\n", + "print(\"no. of moles of N2(n1)\")\n", + "n1=(P1*V1)/(R*T1)\n", + "print(\"n1=\"),round(n1,2)\n", + "print(\"no. of moles of CO2(n2)\")\n", + "n2=(P2*V2)/(R*T2)\n", + "print(\"n2=\"),round(n2,2)\n", + "print(\"total no. of moles of mixture(n)in mol\")\n", + "n=n1+n2\n", + "print(\"n=\"),round(n,2)\n", + "print(\"gas constant for N2(R1)in J/kg k\")\n", + "R1=R/M1\n", + "print(\"R1=\"),round(R1,2)\n", + "print(\"gas constant for CO2(R2)in J/kg k\")\n", + "R2=R/M2\n", + "print(\"R2=R/M2\"),round(R2,2)\n", + "print(\"specific heat of N2 at constant volume (Cv1) in J/kg k\")\n", + "Cv1=R1/(k1-1)\n", + "print(\"Cv1=\"),round(Cv1,2)\n", + "print(\"specific heat of CO2 at constant volume (Cv2) in J/kg k\")\n", + "Cv2=R2/(k2-1)\n", + "print(\"Cv2=\"),round(Cv2,2)\n", + "print(\"mass of N2(m1)in kg\")\n", + "m1=n1*M1\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"mass of CO2(m2)in kg\")\n", + "m2=n2*M2\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"let us consider the equilibrium temperature of mixture after adiabatic mixing at T\")\n", + "print(\"applying energy conservation principle\")\n", + "print(\"m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\")\n", + "print(\"equlibrium temperature(T)in k\")\n", + "T=((m1*Cv1*T1)+(m2*Cv2*T2))/((m1*Cv1)+(m2*Cv2))\n", + "print(\"=>T=\"),round(T,2)\n", + "print(\"so the equlibrium pressure(P)in kpa\")\n", + "P=(n*R*T)/(1000*V)\n", + "print(\"P=\"),round(P,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.25;page no:35" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.25, Page:35 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\n", + "since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\n", + "so the specific heat at constant pressure(Cp)in KJ/kg k\n", + "Cp= 7.608\n" + ] + } + ], + "source": [ + "#cal of specific heat of final mixture\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.25, Page:35 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\")\n", + "m1=2;#mass of H2 in kg\n", + "m2=3;#mass of He in kg\n", + "T=100;#temperature of container in k\n", + "Cp1=11.23;#specific heat at constant pressure for H2 in KJ/kg k\n", + "Cp2=5.193;#specific heat at constant pressure for He in KJ/kg k\n", + "print(\"since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\")\n", + "print(\"so the specific heat at constant pressure(Cp)in KJ/kg k\")\n", + "Cp=((Cp1*m1)+Cp2*m2)/(m1+m2)\n", + "print(\"Cp=\"),round(Cp,3)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.26;page no:35" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.26, Page:35 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\n", + "gas constant for H2(R1)in KJ/kg k\n", + "R1= 4.157\n", + "gas constant for N2(R2)in KJ/kg k\n", + "R2= 0.297\n", + "gas constant for CO2(R3)in KJ/kg k\n", + "R3= 0.189\n", + "so now gas constant for mixture(Rm)in KJ/kg k\n", + "Rm= 2.606\n", + "considering gas to be perfect gas\n", + "total mass of mixture(m)in kg\n", + "m= 30.0\n", + "capacity of vessel(V)in m^3\n", + "V= 231.57\n", + "now final temperature(Tf) is twice of initial temperature(Ti)\n", + "so take k=Tf/Ti=2\n", + "for constant volume heating,final pressure(Pf)in kpa shall be\n", + "Pf= 202.65\n" + ] + } + ], + "source": [ + "#cal of capacity and pressure in the vessel\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.26, Page:35 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\")\n", + "m1=18.;#mass of hydrogen(H2) in kg\n", + "m2=10.;#mass of nitrogen(N2) in kg\n", + "m3=2.;#mass of carbon dioxide(CO2) in kg\n", + "R=8.314;#universal gas constant in KJ/kg k\n", + "Pi=101.325;#atmospheric pressure in kpa\n", + "T=(27+273.15);#ambient temperature in k\n", + "M1=2;#molar mass of H2\n", + "M2=28;#molar mass of N2\n", + "M3=44;#molar mass of CO2\n", + "print(\"gas constant for H2(R1)in KJ/kg k\")\n", + "R1=R/M1\n", + "print(\"R1=\"),round(R1,3)\n", + "print(\"gas constant for N2(R2)in KJ/kg k\")\n", + "R2=R/M2\n", + "print(\"R2=\"),round(R2,3)\n", + "print(\"gas constant for CO2(R3)in KJ/kg k\")\n", + "R3=R/M3\n", + "print(\"R3=\"),round(R3,3)\n", + "print(\"so now gas constant for mixture(Rm)in KJ/kg k\")\n", + "Rm=(m1*R1+m2*R2+m3*R3)/(m1+m2+m3)\n", + "print(\"Rm=\"),round(Rm,3)\n", + "print(\"considering gas to be perfect gas\")\n", + "print(\"total mass of mixture(m)in kg\")\n", + "m=m1+m2+m3\n", + "print(\"m=\"),round(m,2)\n", + "print(\"capacity of vessel(V)in m^3\")\n", + "V=(m*Rm*T)/Pi\n", + "print(\"V=\"),round(V,2)\n", + "print(\"now final temperature(Tf) is twice of initial temperature(Ti)\")\n", + "k=2;#ratio of initial to final temperature\n", + "print(\"so take k=Tf/Ti=2\") \n", + "print(\"for constant volume heating,final pressure(Pf)in kpa shall be\")\n", + "Pf=Pi*k\n", + "print(\"Pf=\"),round(Pf,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.27;page no:36" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.27, Page:36 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\n", + "let inlet state be 1 and exit state be 2\n", + "by charles law volume and temperature can be related as\n", + "(V1/T1)=(V2/T2)\n", + "(V2/V1)=(T2/T1)\n", + "or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\n", + "since change in K.E=0\n", + "so (D2^2/D1^2)=T2/T1\n", + "D2/D1=sqrt(T2/T1)\n", + "say(D2/D1)=k\n", + "so exit to inlet diameter ratio(k) 1.29\n" + ] + } + ], + "source": [ + "#cal of exit to inlet diameter ratio\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.27, Page:36 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\")\n", + "T1=(27.+273.);#initial temperature of air in k\n", + "T2=500.;#final temperature of air in k\n", + "print(\"let inlet state be 1 and exit state be 2\")\n", + "print(\"by charles law volume and temperature can be related as\")\n", + "print(\"(V1/T1)=(V2/T2)\")\n", + "print(\"(V2/V1)=(T2/T1)\")\n", + "print(\"or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\")\n", + "print(\"since change in K.E=0\")\n", + "print(\"so (D2^2/D1^2)=T2/T1\")\n", + "print(\"D2/D1=sqrt(T2/T1)\")\n", + "print(\"say(D2/D1)=k\")\n", + "k=math.sqrt(T2/T1)\n", + "print(\"so exit to inlet diameter ratio(k)\"),round(k,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.28;page no:37" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.28, Page:37 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\n", + "gas constant for H2(R1)in KJ/kg k\n", + "R1= 4.157\n", + "say initial and final ststes are given by 1 and 2\n", + "mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\n", + "final pressure of hydrogen(P2)in cm of Hg\n", + "P2= 6.0\n", + "therefore pressure difference(P)in kpa\n", + "P= 93.33\n", + "mass pumped out(m)in kg\n", + "m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\n", + "here V1=V2=V and T1=T2=T\n", + "so m= 0.15\n", + "now during cooling upto 10 degree celcius,the process may be consider as constant volume process\n", + "say state before and after cooling are denoted by suffix 2 and 3\n", + "final pressure after cooling(P3)in kpa\n", + "P3= 7.546\n" + ] + } + ], + "source": [ + "#cal of final pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.28, Page:37 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\")\n", + "V=2;#volume of vessel in m^3\n", + "P1=76;#initial pressure or atmospheric pressure in cm of Hg\n", + "T=(27+273.15);#temperature of vessel in k\n", + "p=70;#final pressure in cm of Hg vaccum\n", + "R=8.314;#universal gas constant in KJ/kg k\n", + "M=2;#molecular weight of H2\n", + "print(\"gas constant for H2(R1)in KJ/kg k\")\n", + "R1=R/M\n", + "print(\"R1=\"),round(R1,3)\n", + "print(\"say initial and final ststes are given by 1 and 2\")\n", + "print(\"mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\")\n", + "print(\"final pressure of hydrogen(P2)in cm of Hg\")\n", + "P2=P1-p\n", + "print(\"P2=\"),round(P2,2)\n", + "print(\"therefore pressure difference(P)in kpa\")\n", + "P=((P1-P2)*101.325)/76\n", + "print(\"P=\"),round(P,2)\n", + "print(\"mass pumped out(m)in kg\")\n", + "print(\"m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\")\n", + "print(\"here V1=V2=V and T1=T2=T\")\n", + "m=(V*P)/(R1*T)\n", + "print(\"so m=\"),round(m,2)\n", + "print(\"now during cooling upto 10 degree celcius,the process may be consider as constant volume process\")\n", + "print(\"say state before and after cooling are denoted by suffix 2 and 3\")\n", + "T3=(10+273.15);#final temperature after cooling in k\n", + "print(\"final pressure after cooling(P3)in kpa\")\n", + "P3=(T3/T)*P2*(101.325/76)\n", + "print(\"P3=\"),round(P3,3)\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/chapter_1_3.ipynb b/Engineering_Thermodynamics_by__O._Singh/chapter_1_3.ipynb new file mode 100755 index 00000000..9474d100 --- /dev/null +++ b/Engineering_Thermodynamics_by__O._Singh/chapter_1_3.ipynb @@ -0,0 +1,1777 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# chapter 1:Fundemental concepts and definitions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.1;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.1, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\n", + "pressure difference(p)in pa\n", + "p= 39755.7\n" + ] + } + ], + "source": [ + "#cal of pressure difference\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.1, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\"\n", + "h=30*10**-2;#manometer deflection of mercury in m\n", + "g=9.78;#acceleration due to gravity in m/s^2\n", + "rho=13550;#density of mercury at room temperature in kg/m^3\n", + "print\"pressure difference(p)in pa\"\n", + "p=rho*g*h\n", + "print\"p=\",round(p,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.2;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.2, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\n", + "effort required for lifting the lid(E)in N\n", + "E= 7115.48\n" + ] + } + ], + "source": [ + "#cal of effort required for lifting the lid\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.2, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\"\n", + "d=30*10**-2;#diameter of cylindrical vessel in m\n", + "h=76*10**-2;#atmospheric pressure in m of mercury\n", + "g=9.78;#acceleration due to gravity in m/s^2\n", + "rho=13550;#density of mercury at room temperature in kg/m^3\n", + "print\"effort required for lifting the lid(E)in N\"\n", + "E=(rho*g*h)*(3.14*d**2)/4\n", + "print\"E=\",round(E,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.3;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.3, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\n", + "pressure measured by manometer is gauge pressure(Pg)in kpa\n", + "Pg=rho*g*h/10^3\n", + "actual pressure of the air(P)in kpa\n", + "P= 140.76\n" + ] + } + ], + "source": [ + "#cal of actual pressure of the air\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.3, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\"\n", + "h=30*10**-2;# pressure of compressed air in m of mercury\n", + "Patm=101*10**3;#atmospheric pressure in pa\n", + "g=9.78;#acceleration due to gravity in m/s^2\n", + "rho=13550;#density of mercury at room temperature in kg/m^3\n", + "print\"pressure measured by manometer is gauge pressure(Pg)in kpa\"\n", + "print\"Pg=rho*g*h/10^3\"\n", + "Pg=rho*g*h/10**3\n", + "print\"actual pressure of the air(P)in kpa\"\n", + "P=Pg+Patm/10**3\n", + "print\"P=\",round(P,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.4;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.4, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\n", + "density of oil(RHOoil)in kg/m^3\n", + "RHOoil=sg*RHOw\n", + "gauge pressure(Pg)in kpa\n", + "Pg= 7.848\n" + ] + } + ], + "source": [ + "#cal of gauge pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.4, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\"\n", + "h=1;#depth of oil tank in m\n", + "sg=0.8;#specific gravity of oil\n", + "RHOw=1000;#density of water in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print\"density of oil(RHOoil)in kg/m^3\"\n", + "print\"RHOoil=sg*RHOw\"\n", + "RHOoil=sg*RHOw\n", + "print\"gauge pressure(Pg)in kpa\"\n", + "Pg=RHOoil*g*h/10**3\n", + "print\"Pg=\",round(Pg,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.5;page no:22" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.5, Page:22 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\n", + "atmospheric pressure(Patm)in kpa\n", + "Patm=rho*g*h2/10^3\n", + "pressure due to mercury column at AB(Pab)in kpa\n", + "Pab=rho*g*h1/10^3\n", + "pressure exerted by gas(Pgas)in kpa\n", + "Pgas= 154.76\n" + ] + } + ], + "source": [ + "#cal of pressure exerted by gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.5, Page:22 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\"\n", + "rho=13.6*10**3;#density of mercury in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "h1=40*10**-2;#difference of height in mercury column in m as shown in figure\n", + "h2=76*10**-2;#barometer reading of mercury in m\n", + "print\"atmospheric pressure(Patm)in kpa\"\n", + "print\"Patm=rho*g*h2/10^3\"\n", + "Patm=rho*g*h2/10**3\n", + "print\"pressure due to mercury column at AB(Pab)in kpa\"\n", + "print\"Pab=rho*g*h1/10^3\"\n", + "Pab=rho*g*h1/10**3\n", + "print\"pressure exerted by gas(Pgas)in kpa\"\n", + "Pgas=Patm+Pab\n", + "print\"Pgas=\",round(Pgas,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.6;page no:23" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.6, Page:23 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\n", + "by law of conservation of energy\n", + "potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\n", + "so m*g*h = m*Cp*deltaT*4.18*1000\n", + "change in temperature of water(deltaT) in degree celcius\n", + "deltaT= 2.35\n" + ] + } + ], + "source": [ + "#cal of change in temperature of water\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.6, Page:23 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\"\n", + "m=1;#mass of water in kg\n", + "h=1000;#height from which water fall in m\n", + "Cp=1;#specific heat of water in kcal/kg k\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print\"by law of conservation of energy\"\n", + "print\"potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\"\n", + "print\"so m*g*h = m*Cp*deltaT*4.18*1000\"\n", + "print\"change in temperature of water(deltaT) in degree celcius\"\n", + "deltaT=(g*h)/(4.18*1000*Cp)\n", + "print\"deltaT=\",round(deltaT,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.7;page no:23" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.7, Page:23 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\n", + "mass of object(m)in kg\n", + "m=w1/g1\n", + "spring balance reading=gravitational force in mass(F)in N\n", + "F= 86.65\n" + ] + } + ], + "source": [ + "#cal of spring balance reading\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.7, Page:23 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\"\n", + "w1=100;#weight of object at standard gravitational acceleration in N\n", + "g1=9.81;#acceleration due to gravity in m/s^2\n", + "g2=8.5;#gravitational acceleration at some location\n", + "print\"mass of object(m)in kg\"\n", + "print\"m=w1/g1\"\n", + "m=w1/g1\n", + "print\"spring balance reading=gravitational force in mass(F)in N\"\n", + "F=m*g2\n", + "print\"F=\",round(F,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.8;page no:24" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.8, Page:24 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\n", + "pressure measured by manometer(P) in pa\n", + "p=rho*g*h\n", + "now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\n", + "mass of piston(m)in kg\n", + "so m= 28.84\n" + ] + } + ], + "source": [ + "#cal of mass of piston\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.8, Page:24 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\"\n", + "d=15*10**-2;#diameter of cylinder in m\n", + "h=12*10**-2;#manometer height difference in m of mercury\n", + "rho=13.6*10**3;#density of mercury in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print\"pressure measured by manometer(P) in pa\"\n", + "print\"p=rho*g*h\"\n", + "p=rho*g*h\n", + "print\"now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\"\n", + "print\"mass of piston(m)in kg\"\n", + "m=(p*math.pi*d**2)/(4*g)\n", + "print\"so m=\",round(m,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.9;page no:24" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.9, Page:24 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\n", + "balancing pressure at plane BC in figure we get\n", + "Psteam+Pwater=Patm+Pmercury\n", + "now 1.atmospheric pressure(Patm)in pa\n", + "Patm= 101396.16\n", + "2.pressure due to water(Pwater)in pa\n", + "Pwater= 196.2\n", + "3.pressure due to mercury(Pmercury)in pa\n", + "Pmercury=RHOm*g*h3 13341.6\n", + "using balancing equation\n", + "Psteam=Patm+Pmercury-Pwater\n", + "so pressure of steam(Psteam)in kpa\n", + "Psteam= 114.54\n" + ] + } + ], + "source": [ + "#cal of pressure due to atmosphere,water,mercury,steam\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.9, Page:24 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\")\n", + "RHOm=13.6*10**3;#density of mercury in kg/m^3\n", + "RHOw=1000;#density of water in kg/m^3\n", + "h1=76*10**-2;#barometer reading in m of mercury\n", + "h2=2*10**-2;#height raised by water in manometer tube in m \n", + "h3=10*10**-2;#height raised by mercury in manometer tube in m \n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"balancing pressure at plane BC in figure we get\")\n", + "print(\"Psteam+Pwater=Patm+Pmercury\")\n", + "print(\"now 1.atmospheric pressure(Patm)in pa\")\n", + "Patm=RHOm*g*h1\n", + "print(\"Patm=\"),round(Patm,2)\n", + "print(\"2.pressure due to water(Pwater)in pa\")\n", + "Pwater=RHOw*g*h2\n", + "print(\"Pwater=\"),round(Pwater,2)\n", + "print(\"3.pressure due to mercury(Pmercury)in pa\")\n", + "Pmercury=RHOm*g*h3\n", + "print(\"Pmercury=RHOm*g*h3\"),round(Pmercury,2)\n", + "print(\"using balancing equation\")\n", + "print(\"Psteam=Patm+Pmercury-Pwater\")\n", + "print(\"so pressure of steam(Psteam)in kpa\")\n", + "Psteam=(Patm+Pmercury-Pwater)/1000\n", + "print(\"Psteam=\"),round(Psteam,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.10;page no:24" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.10, Page:24 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\n", + "atmospheric pressure(Patm)in kpa\n", + "absolute temperature in compartment A(Pa) in kpa\n", + "Pa= 496.06\n", + "absolute temperature in compartment B(Pb) in kpa\n", + "Pb= 246.06\n", + "absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\n" + ] + } + ], + "source": [ + "#cal of \"absolute temperature in compartment A,B\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.10, Page:24 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\")\n", + "h=720*10**-3;#barometer reading in m of Hg\n", + "Pga=400;#gauge pressure in compartment A in kpa\n", + "Pgb=150;#gauge pressure in compartment B in kpa\n", + "rho=13.6*10**3;#density of mercury in kg/m^3\n", + "g=9.81;#acceleration due to gravity in m/s^2\n", + "print(\"atmospheric pressure(Patm)in kpa\")\n", + "Patm=(rho*g*h)/1000\n", + "print(\"absolute temperature in compartment A(Pa) in kpa\")\n", + "Pa=Pga+Patm\n", + "print\"Pa=\",round(Pa,2)\n", + "print\"absolute temperature in compartment B(Pb) in kpa\"\n", + "Pb=Pgb+Patm\n", + "print\"Pb=\",round(Pb,2)\n", + "print\"absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.11;page no:25" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.11, Page:25 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\n", + "the pressure of air in air tank can be obtained by equalising pressures at some reference line\n", + "P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\n", + "so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\n", + "air pressure(P1)in kpa 139.81\n" + ] + } + ], + "source": [ + "#cal of air pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.11, Page:25 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\")\n", + "Patm=90*10**3;#atmospheric pressure in pa\n", + "RHOw=1000;#density of water in kg/m^3\n", + "RHOm=13600;#density of mercury in kg/m^3\n", + "RHOo=850;#density of oil in kg/m^3\n", + "g=9.81;#acceleration due to ggravity in m/s^2\n", + "h1=.15;#height difference between water column in m\n", + "h2=.25;#height difference between oil column in m\n", + "h3=.4;#height difference between mercury column in m\n", + "print\"the pressure of air in air tank can be obtained by equalising pressures at some reference line\"\n", + "print\"P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\"\n", + "print\"so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\"\n", + "P1=(Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2)/1000\n", + "print\"air pressure(P1)in kpa\",round(P1,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.12;page no:26" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.12, Page:26 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\n", + "mass of object(m)in kg\n", + "m=F/g\n", + "kinetic energy(E)in J is given by\n", + "E= 140625000.0\n" + ] + } + ], + "source": [ + "#cal of kinetic energy\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.12, Page:26 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\"\n", + "v=750;#relative velocity of object with respect to earth in m/sec\n", + "F=4000;#gravitational force in N\n", + "g=8;#acceleration due to gravity in m/s^2\n", + "print\"mass of object(m)in kg\"\n", + "print\"m=F/g\"\n", + "m=F/g\n", + "print\"kinetic energy(E)in J is given by\"\n", + "E=m*v**2/2\n", + "print\"E=\",round(E)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.13;page no:26" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.13, Page:26 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\n", + "characteristics gas constant(R2)in kJ/kg k\n", + "molecular weight of gas(m)in kg/kg mol= 16.63\n", + "NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\n" + ] + } + ], + "source": [ + "#cal of molecular weight of gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.13, Page:26 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\"\n", + "Cp=2.286;#specific heat at constant pressure in kJ/kg k\n", + "Cv=1.786;#specific heat at constant volume in kJ/kg k\n", + "R1=8.3143;#universal gas constant in kJ/kg k\n", + "print\"characteristics gas constant(R2)in kJ/kg k\"\n", + "R2=Cp-Cv\n", + "m=R1/R2\n", + "print\"molecular weight of gas(m)in kg/kg mol=\",round(m,2)\n", + "print\"NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.14;page no:26" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.14, Page:26 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\n", + "using perfect gas equation\n", + "P1*V1/T1 = P2*V2/T2\n", + "=>T2=(P2*V2*T1)/(P1*V1)\n", + "so final temperature of gas(T2)in k\n", + "or final temperature of gas(T2)in degree celcius= 127.0\n" + ] + } + ], + "source": [ + "#cal of final temperature of gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.14, Page:26 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\"\n", + "P1=750*10**3;#initial pressure of gas in pa\n", + "V1=0.2;#initial volume of gas in m^3\n", + "T1=600;#initial temperature of gas in k\n", + "P2=2*10**5;#final pressure of gas i pa\n", + "V2=0.5;#final volume of gas in m^3\n", + "print\"using perfect gas equation\"\n", + "print\"P1*V1/T1 = P2*V2/T2\"\n", + "print\"=>T2=(P2*V2*T1)/(P1*V1)\"\n", + "print\"so final temperature of gas(T2)in k\"\n", + "T2=(P2*V2*T1)/(P1*V1)\n", + "T2=T2-273\n", + "print\"or final temperature of gas(T2)in degree celcius=\",round(T2,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.15;page no:27" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.15, Page:27 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\n", + "from perfect gas equation we get\n", + "initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\n", + "m1= 5.807\n", + "final mass of air(m2 in kg)=(P2*V2)/(R*T2)\n", + "m2= 3.111\n", + "mass of air removed(m)in kg 2.696\n", + "volume of this mass of air(V) at initial states in m^3= 2.32\n" + ] + } + ], + "source": [ + "#cal of volume of this mass of air(V) at initial states\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.15, Page:27 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\"\n", + "P1=100*10**3;#initial pressure of air in pa\n", + "V1=5.;#initial volume of air in m^3\n", + "T1=300.;#initial temperature of gas in k\n", + "P2=50*10**3;#final pressure of air in pa\n", + "V2=5.;#final volume of air in m^3\n", + "T2=(280.);#final temperature of air in K\n", + "R=287.;#gas constant on J/kg k\n", + "print\"from perfect gas equation we get\"\n", + "print\"initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\"\n", + "m1=(P1*V1)/(R*T1)\n", + "print(\"m1=\"),round(m1,3)\n", + "print\"final mass of air(m2 in kg)=(P2*V2)/(R*T2)\"\n", + "m2=(P2*V2)/(R*T2)\n", + "print(\"m2=\"),round(m2,3)\n", + "m=m1-m2\n", + "print\"mass of air removed(m)in kg\",round(m,3)\n", + "V=m*R*T1/P1\n", + "print\"volume of this mass of air(V) at initial states in m^3=\",round(V,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.16;page no:27" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.16, Page:27 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\n", + "here V1=V2\n", + "so P1/T1=P2/T2\n", + "final temperature of hydrogen gas(T2)in k\n", + "=>T2=P2*T1/P1\n", + "now R=(Cp-Cv) in KJ/kg k\n", + "And volume of cylinder(V1)in m^3\n", + "V1=(math.pi*d^2*l)/4\n", + "mass of hydrogen gas(m)in kg\n", + "m= 0.254\n", + "now heat supplied(Q)in KJ\n", + "Q= 193.93\n" + ] + } + ], + "source": [ + "#cal of heat supplied\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.16, Page:27 \\n \\n\"\n", + "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\"\n", + "d=1;#diameter of cylinder in m\n", + "l=4;#length of cylinder in m\n", + "P1=100*10**3;#initial pressureof hydrogen gas in pa\n", + "T1=(27+273);#initial temperature of hydrogen gas in k\n", + "P2=125*10**3;#final pressureof hydrogen gas in pa\n", + "Cp=14.307;#specific heat at constant pressure in KJ/kg k\n", + "Cv=10.183;#specific heat at constant volume in KJ/kg k\n", + "print\"here V1=V2\"\n", + "print\"so P1/T1=P2/T2\"\n", + "print\"final temperature of hydrogen gas(T2)in k\"\n", + "print\"=>T2=P2*T1/P1\"\n", + "T2=P2*T1/P1\n", + "print\"now R=(Cp-Cv) in KJ/kg k\"\n", + "R=Cp-Cv\n", + "print\"And volume of cylinder(V1)in m^3\"\n", + "print\"V1=(math.pi*d^2*l)/4\"\n", + "V1=(math.pi*d**2*l)/4\n", + "print\"mass of hydrogen gas(m)in kg\"\n", + "m=(P1*V1)/(1000*R*T1)\n", + "print\"m=\",round(m,3)\n", + "print\"now heat supplied(Q)in KJ\"\n", + "Q=m*Cv*(T2-T1)\n", + "print\"Q=\",round(Q,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.17;page no:28" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.17, Page:28 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\n", + "final total volume(V)in m^3\n", + "V=V1*V2\n", + "total mass of air(m)in kg\n", + "m=m1+m2\n", + "final pressure of air(P)in kpa\n", + "using perfect gas equation\n", + "P= 516.6\n" + ] + } + ], + "source": [ + "#cal of final pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.17, Page:28 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\")\n", + "V1=2.;#volume of first cylinder in m^3\n", + "V2=2.;#volume of second cylinder in m^3\n", + "T=(27+273);#temperature of system in k\n", + "m1=20.;#mass of air in first vessel in kg\n", + "m2=4.;#mass of air in second vessel in kg\n", + "R=287.;#gas constant J/kg k\n", + "print(\"final total volume(V)in m^3\")\n", + "print(\"V=V1*V2\")\n", + "V=V1*V2\n", + "print(\"total mass of air(m)in kg\")\n", + "print(\"m=m1+m2\")\n", + "m=m1+m2\n", + "print(\"final pressure of air(P)in kpa\")\n", + "print(\"using perfect gas equation\")\n", + "P=(m*R*T)/(1000*V)\n", + "print\"P=\",round(P,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.18;page no:28" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.18, Page:28 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\n", + "1.By considering it as a PERFECT GAS\n", + "gas constant for CO2(Rco2)\n", + "Rco2=(J/Kg.k) 188.9\n", + "Also P*V=M*Rco2*T\n", + "pressure of CO2 as perfect gas(P)in N/m^2\n", + "P=(m*Rco2*T)/V 141683.71\n", + "2.By considering as a REAL GAS\n", + "values of vanderwaal constants a,b can be seen from the table which are\n", + "a=(N m^4/(kg mol)^2) 362850.0\n", + "b=(m^3/kg mol) 0.03\n", + "now specific volume(v)in m^3/kg mol\n", + "v= 17.604\n", + "now substituting the value of all variables in vanderwaal equation\n", + "(P+(a/v^2))*(v-b)=R*T\n", + "pressure of CO2 as real gas(P)in N/m^2\n", + "P= 140766.02\n" + ] + } + ], + "source": [ + "#cal of pressure of CO2 as perfect,real gas\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.18, Page:28 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\")\n", + "m=5;#mass of CO2 in kg\n", + "V=2;#volume of vesssel in m^3\n", + "T=(27+273);#temperature of vessel in k\n", + "R=8.314*10**3;#universal gas constant in J/kg k\n", + "M=44.01;#molecular weight of CO2 \n", + "print(\"1.By considering it as a PERFECT GAS\")\n", + "print(\"gas constant for CO2(Rco2)\")\n", + "Rco2=R/M\n", + "print(\"Rco2=(J/Kg.k)\"),round(Rco2,1)\n", + "print(\"Also P*V=M*Rco2*T\")\n", + "print(\"pressure of CO2 as perfect gas(P)in N/m^2\")\n", + "P=(m*Rco2*T)/V\n", + "print(\"P=(m*Rco2*T)/V \"),round(P,2)\n", + "print(\"2.By considering as a REAL GAS\")\n", + "print(\"values of vanderwaal constants a,b can be seen from the table which are\")\n", + "a=3628.5*10**2#vanderwall constant in N m^4/(kg mol)^2\n", + "b=3.14*10**-2# vanderwall constant in m^3/kg mol\n", + "print(\"a=(N m^4/(kg mol)^2) \"),round(a,2)\n", + "print(\"b=(m^3/kg mol)\"),round(b,2)\n", + "print(\"now specific volume(v)in m^3/kg mol\")\n", + "v=V*M/m\n", + "print(\"v=\"),round(v,3)\n", + "print(\"now substituting the value of all variables in vanderwaal equation\")\n", + "print(\"(P+(a/v^2))*(v-b)=R*T\")\n", + "print(\"pressure of CO2 as real gas(P)in N/m^2\")\n", + "P=((R*T)/(v-b))-(a/v**2)\n", + "print(\"P=\"),round(P,2)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.19;page no:29" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.19, Page:29 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\n", + "1.considering as perfect gas\n", + "specific volume(V)in m^3/kg\n", + "V= 0.0186\n", + "2.considering compressibility effects\n", + "reduced pressure(P)in pa\n", + "p= 0.8\n", + "reduced temperature(t)in k\n", + "t= 1.1\n", + "from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\n", + "we get Z=0.785\n", + "now actual specific volume(v)in m^3/kg\n", + "v= 0.0146\n" + ] + } + ], + "source": [ + "#cal of specific volume of steam\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.19, Page:29 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\")\n", + "P=17672;#pressure of steam on kpa\n", + "T=712;#temperature of steam in k\n", + "Pc=22.09;#critical pressure of steam in Mpa\n", + "Tc=647.3;#critical temperature of steam in k\n", + "R=0.4615;#gas constant for steam in KJ/kg k\n", + "print(\"1.considering as perfect gas\")\n", + "print(\"specific volume(V)in m^3/kg\")\n", + "V=R*T/P\n", + "print(\"V=\"),round(V,4)\n", + "print(\"2.considering compressibility effects\")\n", + "print(\"reduced pressure(P)in pa\")\n", + "p=P/(Pc*1000)\n", + "print(\"p=\"),round(p,2)\n", + "print(\"reduced temperature(t)in k\")\n", + "t=T/Tc\n", + "print(\"t=\"),round(t,2)\n", + "print(\"from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\")\n", + "print(\"we get Z=0.785\")\n", + "Z=0.785;#compressibility factor\n", + "print(\"now actual specific volume(v)in m^3/kg\")\n", + "v=Z*V\n", + "print(\"v=\"),round(v,4)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.20;page no:30" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.20, Page:30 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\n", + "volume of ballon(V1)in m^3\n", + "V1= 65.45\n", + "molecular mass of hydrogen(M)\n", + "M=2\n", + "gas constant for H2(R1)in J/kg k\n", + "R1= 4157.0\n", + "mass of H2 in ballon(m1)in kg\n", + "m1= 5.316\n", + "volume of air printlaced(V2)=volume of ballon(V1)\n", + "mass of air printlaced(m2)in kg\n", + "m2= 79.66\n", + "gas constant for air(R2)=0.287 KJ/kg k\n", + "load lifting capacity due to buoyant force(m)in kg\n", + "m= 74.343\n" + ] + } + ], + "source": [ + "#estimation of maximum load that can be lifted \n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.20, Page:30 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\")\n", + "d=5.;#diameter of ballon in m\n", + "T1=(27.+273.);#temperature of hydrogen in k\n", + "P=1.013*10**5;#atmospheric pressure in pa\n", + "T2=(17.+273.);#temperature of surrounding air in k\n", + "R=8.314*10**3;#gas constant in J/kg k\n", + "print(\"volume of ballon(V1)in m^3\")\n", + "V1=(4./3.)*math.pi*((d/2)**3)\n", + "print(\"V1=\"),round(V1,2)\n", + "print(\"molecular mass of hydrogen(M)\")\n", + "print(\"M=2\")\n", + "M=2;#molecular mass of hydrogen\n", + "print(\"gas constant for H2(R1)in J/kg k\")\n", + "R1=R/M\n", + "print(\"R1=\"),round(R1,2)\n", + "print(\"mass of H2 in ballon(m1)in kg\")\n", + "m1=(P*V1)/(R1*T1)\n", + "print(\"m1=\"),round(m1,3)\n", + "print(\"volume of air printlaced(V2)=volume of ballon(V1)\")\n", + "print(\"mass of air printlaced(m2)in kg\")\n", + "R2=0.287*1000;#gas constant for air in J/kg k\n", + "m2=(P*V1)/(R2*T2)\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"gas constant for air(R2)=0.287 KJ/kg k\")\n", + "print(\"load lifting capacity due to buoyant force(m)in kg\")\n", + "m=m2-m1\n", + "print(\"m=\"),round(m,3)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.21;page no:31" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.21, Page:31 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\n", + "let initial receiver pressure(p1)=1 in pa\n", + "so final receiver pressure(p2)=in pa 0.25\n", + "perfect gas equation,p*V*m=m*R*T\n", + "differentiating and then integrating equation w.r.t to time(t) \n", + "we get t=-(V/v)*log(p2/p1)\n", + "so time(t)in min 110.9\n" + ] + } + ], + "source": [ + "#cal of time required\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.21, Page:31 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\")\n", + "v=0.25;#volume sucking rate of pump in m^3/min\n", + "V=20.;#volume of air vessel in m^3\n", + "p1=1.;#initial receiver pressure in pa\n", + "print(\"let initial receiver pressure(p1)=1 in pa\")\n", + "p2=p1/4.\n", + "print(\"so final receiver pressure(p2)=in pa\"),round(p2,2)\n", + "print(\"perfect gas equation,p*V*m=m*R*T\")\n", + "print(\"differentiating and then integrating equation w.r.t to time(t) \")\n", + "print(\"we get t=-(V/v)*log(p2/p1)\")\n", + "t=-(V/v)*math.log(p2/p1)\n", + "print(\"so time(t)in min\"),round(t,2)\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.22;page no:32" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.22, Page:32 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\n", + "first calculate gas constants for different gases in j/kg k\n", + "for nitrogen,R1= 296.9\n", + "for oxygen,R2= 259.8\n", + "for carbon dioxide,R3= 188.95\n", + "so the gas constant for mixture(Rm)in j/kg k\n", + "Rm= 288.09\n", + "now the specific heat at constant pressure for constituent gases in KJ/kg k\n", + "for nitrogen,Cp1= 1.039\n", + "for oxygen,Cp2= 0.909\n", + "for carbon dioxide,Cp3= 0.819\n", + "so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\n", + "Cpm= 1.0115\n", + "now no. of moles of constituents gases\n", + "for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg 0.143\n", + "for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg 0.028\n", + "for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg 0.0023\n", + "total no. of moles in mixture in mol\n", + "n= 0.1733\n", + "now mole fraction of constituent gases\n", + "for nitrogen,x1= 0.825\n", + "for oxygen,x2= 0.162\n", + "for carbon dioxide,x3= 0.0131\n", + "now the molecular weight of mixture(Mm)in kg/kmol\n", + "Mm= 28.86\n" + ] + } + ], + "source": [ + "#cal of specific heat at constant pressure for constituent gases \n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.22, Page:32 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\")\n", + "m=5;#mass of mixture of gas in kg\n", + "P=1.013*10**5;#pressure of mixture in pa\n", + "T=300;#temperature of mixture in k\n", + "M1=28.;#molecular weight of nitrogen(N2)\n", + "M2=32.;#molecular weight of oxygen(O2)\n", + "M3=44.;#molecular weight of carbon dioxide(CO2)\n", + "f1=0.80;#fraction of N2 in mixture\n", + "f2=0.18;#fraction of O2 in mixture\n", + "f3=0.02;#fraction of CO2 in mixture\n", + "k1=1.4;#ratio of specific heat capacities for N2\n", + "k2=1.4;#ratio of specific heat capacities for O2\n", + "k3=1.3;#ratio of specific heat capacities for CO2\n", + "R=8314;#universal gas constant in J/kg k\n", + "print(\"first calculate gas constants for different gases in j/kg k\")\n", + "R1=R/M1\n", + "print(\"for nitrogen,R1=\"),round(R1,1)\n", + "R2=R/M2\n", + "print(\"for oxygen,R2=\"),round(R2,1)\n", + "R3=R/M3\n", + "print(\"for carbon dioxide,R3=\"),round(R3,2)\n", + "print(\"so the gas constant for mixture(Rm)in j/kg k\")\n", + "Rm=f1*R1+f2*R2+f3*R3\n", + "print(\"Rm=\"),round(Rm,2)\n", + "print(\"now the specific heat at constant pressure for constituent gases in KJ/kg k\")\n", + "Cp1=((k1/(k1-1))*R1)/1000\n", + "print(\"for nitrogen,Cp1=\"),round(Cp1,3)\n", + "Cp2=((k2/(k2-1))*R2)/1000\n", + "print(\"for oxygen,Cp2=\"),round(Cp2,3)\n", + "Cp3=((k3/(k3-1))*R3)/1000\n", + "print(\"for carbon dioxide,Cp3=\"),round(Cp3,3)\n", + "print(\"so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\")\n", + "Cpm=f1*Cp1+f2*Cp2+f3*Cp3\n", + "print(\"Cpm=\"),round(Cpm,4)\n", + "print(\"now no. of moles of constituents gases\")\n", + "m1=f1*m\n", + "n1=m1/M1\n", + "print(\"for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg\"),round(n1,3)\n", + "m2=f2*m\n", + "n2=m2/M2\n", + "print(\"for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg\"),round(n2,3)\n", + "m3=f3*m\n", + "n3=m3/M3\n", + "print(\"for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg\"),round(n3,4)\n", + "print(\"total no. of moles in mixture in mol\")\n", + "n=n1+n2+n3\n", + "print(\"n=\"),round(n,4)\n", + "print(\"now mole fraction of constituent gases\")\n", + "x1=n1/n\n", + "print(\"for nitrogen,x1=\"),round(x1,3)\n", + "x2=n2/n\n", + "print(\"for oxygen,x2=\"),round(x2,3)\n", + "x3=n3/n\n", + "print(\"for carbon dioxide,x3=\"),round(x3,4)\n", + "print(\"now the molecular weight of mixture(Mm)in kg/kmol\")\n", + "Mm=M1*x1+M2*x2+M3*x3\n", + "print(\"Mm=\"),round(Mm,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.23;page no:33" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.23, Page:33 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\n", + "mole fraction of constituent gases\n", + "x=(ni/n)=(Vi/V)\n", + "take volume of mixture(V)=1 m^3\n", + "mole fraction of O2(x1)\n", + "x1= 0.18\n", + "mole fraction of N2(x2)\n", + "x2= 0.75\n", + "mole fraction of CO2(x3)\n", + "x3= 0.07\n", + "now molecular weight of mixture = molar mass(m)\n", + "m= 29.84\n", + "now gravimetric analysis refers to the mass fraction analysis\n", + "mass fraction of constituents\n", + "y=xi*Mi/m\n", + "mole fraction of O2\n", + "y1= 0.193\n", + "mole fraction of N2\n", + "y2= 0.704\n", + "mole fraction of CO2\n", + "y3= 0.103\n", + "now partial pressure of constituents = volume fraction * pressure of mixture\n", + "Pi=xi*P\n", + "partial pressure of O2(P1)in Mpa\n", + "P1= 0.09\n", + "partial pressure of N2(P2)in Mpa\n", + "P2= 0.375\n", + "partial pressure of CO2(P3)in Mpa\n", + "P3= 0.04\n", + "NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\n" + ] + } + ], + "source": [ + "#cal of pressure difference\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.23, Page:33 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\")\n", + "V1=0.18;#volume fraction of O2 in m^3\n", + "V2=0.75;#volume fraction of N2 in m^3\n", + "V3=0.07;#volume fraction of CO2 in m^3\n", + "P=0.5;#pressure of mixture in Mpa\n", + "T=(107+273);#temperature of mixture in k\n", + "M1=32;#molar mass of O2\n", + "M2=28;#molar mass of N2\n", + "M3=44;#molar mass of CO2\n", + "print(\"mole fraction of constituent gases\")\n", + "print(\"x=(ni/n)=(Vi/V)\")\n", + "V=1;# volume of mixture in m^3\n", + "print(\"take volume of mixture(V)=1 m^3\")\n", + "print(\"mole fraction of O2(x1)\")\n", + "x1=V1/V\n", + "print(\"x1=\"),round(x1,2)\n", + "print(\"mole fraction of N2(x2)\")\n", + "x2=V2/V\n", + "print(\"x2=\"),round(x2,2)\n", + "print(\"mole fraction of CO2(x3)\")\n", + "x3=V3/V\n", + "print(\"x3=\"),round(x3,2)\n", + "print(\"now molecular weight of mixture = molar mass(m)\")\n", + "m=x1*M1+x2*M2+x3*M3\n", + "print(\"m=\"),round(m,2)\n", + "print(\"now gravimetric analysis refers to the mass fraction analysis\")\n", + "print(\"mass fraction of constituents\")\n", + "print(\"y=xi*Mi/m\")\n", + "print(\"mole fraction of O2\")\n", + "y1=x1*M1/m\n", + "print(\"y1=\"),round(y1,3)\n", + "print(\"mole fraction of N2\")\n", + "y2=x2*M2/m\n", + "print(\"y2=\"),round(y2,3)\n", + "print(\"mole fraction of CO2\")\n", + "y3=x3*M3/m\n", + "print(\"y3=\"),round(y3,3)\n", + "print(\"now partial pressure of constituents = volume fraction * pressure of mixture\")\n", + "print(\"Pi=xi*P\")\n", + "print(\"partial pressure of O2(P1)in Mpa\")\n", + "p1=x1*P\n", + "print(\"P1=\"),round(p1,2)\n", + "print(\"partial pressure of N2(P2)in Mpa\")\n", + "P2=x2*P\n", + "print(\"P2=\"),round(P2,3)\n", + "P3=x3*P\n", + "print(\"partial pressure of CO2(P3)in Mpa\")\n", + "print(\"P3=\"),round(P3,2)\n", + "print(\"NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.24;page no:34" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.24, Page:34 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\n", + "volume of tank of N2(V1) in m^3= 3.0\n", + "volume of tank of CO2(V2) in m^3= 3.0\n", + "taking the adiabatic condition\n", + "no. of moles of N2(n1)\n", + "n1= 0.6\n", + "no. of moles of CO2(n2)\n", + "n2= 0.37\n", + "total no. of moles of mixture(n)in mol\n", + "n= 0.97\n", + "gas constant for N2(R1)in J/kg k\n", + "R1= 296.93\n", + "gas constant for CO2(R2)in J/kg k\n", + "R2=R/M2 188.95\n", + "specific heat of N2 at constant volume (Cv1) in J/kg k\n", + "Cv1= 742.32\n", + "specific heat of CO2 at constant volume (Cv2) in J/kg k\n", + "Cv2= 629.85\n", + "mass of N2(m1)in kg\n", + "m1= 16.84\n", + "mass of CO2(m2)in kg\n", + "m2= 16.28\n", + "let us consider the equilibrium temperature of mixture after adiabatic mixing at T\n", + "applying energy conservation principle\n", + "m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\n", + "equlibrium temperature(T)in k\n", + "=>T= 439.44\n", + "so the equlibrium pressure(P)in kpa\n", + "P= 591.55\n" + ] + } + ], + "source": [ + "#cal of equilibrium temperature,pressure of mixture\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.24, Page:34 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\")\n", + "V=6;#volume of tank in m^3\n", + "P1=800*10**3;#pressure of N2 gas tank in pa\n", + "T1=480.;#temperature of N2 gas tank in k\n", + "P2=400*10**3;#pressure of CO2 gas tank in pa\n", + "T2=390.;#temperature of CO2 gas tank in k\n", + "k1=1.4;#ratio of specific heat capacity for N2\n", + "k2=1.3;#ratio of specific heat capacity for CO2\n", + "R=8314.;#universal gas constant in J/kg k\n", + "M1=28.;#molecular weight of N2\n", + "M2=44.;#molecular weight of CO2\n", + "V1=V/2\n", + "print(\"volume of tank of N2(V1) in m^3=\"),round(V1,2)\n", + "V2=V/2\n", + "print(\"volume of tank of CO2(V2) in m^3=\"),round(V2,2)\n", + "print(\"taking the adiabatic condition\")\n", + "print(\"no. of moles of N2(n1)\")\n", + "n1=(P1*V1)/(R*T1)\n", + "print(\"n1=\"),round(n1,2)\n", + "print(\"no. of moles of CO2(n2)\")\n", + "n2=(P2*V2)/(R*T2)\n", + "print(\"n2=\"),round(n2,2)\n", + "print(\"total no. of moles of mixture(n)in mol\")\n", + "n=n1+n2\n", + "print(\"n=\"),round(n,2)\n", + "print(\"gas constant for N2(R1)in J/kg k\")\n", + "R1=R/M1\n", + "print(\"R1=\"),round(R1,2)\n", + "print(\"gas constant for CO2(R2)in J/kg k\")\n", + "R2=R/M2\n", + "print(\"R2=R/M2\"),round(R2,2)\n", + "print(\"specific heat of N2 at constant volume (Cv1) in J/kg k\")\n", + "Cv1=R1/(k1-1)\n", + "print(\"Cv1=\"),round(Cv1,2)\n", + "print(\"specific heat of CO2 at constant volume (Cv2) in J/kg k\")\n", + "Cv2=R2/(k2-1)\n", + "print(\"Cv2=\"),round(Cv2,2)\n", + "print(\"mass of N2(m1)in kg\")\n", + "m1=n1*M1\n", + "print(\"m1=\"),round(m1,2)\n", + "print(\"mass of CO2(m2)in kg\")\n", + "m2=n2*M2\n", + "print(\"m2=\"),round(m2,2)\n", + "print(\"let us consider the equilibrium temperature of mixture after adiabatic mixing at T\")\n", + "print(\"applying energy conservation principle\")\n", + "print(\"m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\")\n", + "print(\"equlibrium temperature(T)in k\")\n", + "T=((m1*Cv1*T1)+(m2*Cv2*T2))/((m1*Cv1)+(m2*Cv2))\n", + "print(\"=>T=\"),round(T,2)\n", + "print(\"so the equlibrium pressure(P)in kpa\")\n", + "P=(n*R*T)/(1000*V)\n", + "print(\"P=\"),round(P,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.25;page no:35" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.25, Page:35 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\n", + "since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\n", + "so the specific heat at constant pressure(Cp)in KJ/kg k\n", + "Cp= 7.608\n" + ] + } + ], + "source": [ + "#cal of specific heat of final mixture\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.25, Page:35 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\")\n", + "m1=2;#mass of H2 in kg\n", + "m2=3;#mass of He in kg\n", + "T=100;#temperature of container in k\n", + "Cp1=11.23;#specific heat at constant pressure for H2 in KJ/kg k\n", + "Cp2=5.193;#specific heat at constant pressure for He in KJ/kg k\n", + "print(\"since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\")\n", + "print(\"so the specific heat at constant pressure(Cp)in KJ/kg k\")\n", + "Cp=((Cp1*m1)+Cp2*m2)/(m1+m2)\n", + "print(\"Cp=\"),round(Cp,3)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.26;page no:35" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.26, Page:35 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\n", + "gas constant for H2(R1)in KJ/kg k\n", + "R1= 4.157\n", + "gas constant for N2(R2)in KJ/kg k\n", + "R2= 0.297\n", + "gas constant for CO2(R3)in KJ/kg k\n", + "R3= 0.189\n", + "so now gas constant for mixture(Rm)in KJ/kg k\n", + "Rm= 2.606\n", + "considering gas to be perfect gas\n", + "total mass of mixture(m)in kg\n", + "m= 30.0\n", + "capacity of vessel(V)in m^3\n", + "V= 231.57\n", + "now final temperature(Tf) is twice of initial temperature(Ti)\n", + "so take k=Tf/Ti=2\n", + "for constant volume heating,final pressure(Pf)in kpa shall be\n", + "Pf= 202.65\n" + ] + } + ], + "source": [ + "#cal of capacity and pressure in the vessel\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.26, Page:35 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\")\n", + "m1=18.;#mass of hydrogen(H2) in kg\n", + "m2=10.;#mass of nitrogen(N2) in kg\n", + "m3=2.;#mass of carbon dioxide(CO2) in kg\n", + "R=8.314;#universal gas constant in KJ/kg k\n", + "Pi=101.325;#atmospheric pressure in kpa\n", + "T=(27+273.15);#ambient temperature in k\n", + "M1=2;#molar mass of H2\n", + "M2=28;#molar mass of N2\n", + "M3=44;#molar mass of CO2\n", + "print(\"gas constant for H2(R1)in KJ/kg k\")\n", + "R1=R/M1\n", + "print(\"R1=\"),round(R1,3)\n", + "print(\"gas constant for N2(R2)in KJ/kg k\")\n", + "R2=R/M2\n", + "print(\"R2=\"),round(R2,3)\n", + "print(\"gas constant for CO2(R3)in KJ/kg k\")\n", + "R3=R/M3\n", + "print(\"R3=\"),round(R3,3)\n", + "print(\"so now gas constant for mixture(Rm)in KJ/kg k\")\n", + "Rm=(m1*R1+m2*R2+m3*R3)/(m1+m2+m3)\n", + "print(\"Rm=\"),round(Rm,3)\n", + "print(\"considering gas to be perfect gas\")\n", + "print(\"total mass of mixture(m)in kg\")\n", + "m=m1+m2+m3\n", + "print(\"m=\"),round(m,2)\n", + "print(\"capacity of vessel(V)in m^3\")\n", + "V=(m*Rm*T)/Pi\n", + "print(\"V=\"),round(V,2)\n", + "print(\"now final temperature(Tf) is twice of initial temperature(Ti)\")\n", + "k=2;#ratio of initial to final temperature\n", + "print(\"so take k=Tf/Ti=2\") \n", + "print(\"for constant volume heating,final pressure(Pf)in kpa shall be\")\n", + "Pf=Pi*k\n", + "print(\"Pf=\"),round(Pf,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.27;page no:36" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.27, Page:36 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\n", + "let inlet state be 1 and exit state be 2\n", + "by charles law volume and temperature can be related as\n", + "(V1/T1)=(V2/T2)\n", + "(V2/V1)=(T2/T1)\n", + "or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\n", + "since change in K.E=0\n", + "so (D2^2/D1^2)=T2/T1\n", + "D2/D1=sqrt(T2/T1)\n", + "say(D2/D1)=k\n", + "so exit to inlet diameter ratio(k) 1.29\n" + ] + } + ], + "source": [ + "#cal of exit to inlet diameter ratio\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "import math\n", + "print\"Example 1.27, Page:36 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\")\n", + "T1=(27.+273.);#initial temperature of air in k\n", + "T2=500.;#final temperature of air in k\n", + "print(\"let inlet state be 1 and exit state be 2\")\n", + "print(\"by charles law volume and temperature can be related as\")\n", + "print(\"(V1/T1)=(V2/T2)\")\n", + "print(\"(V2/V1)=(T2/T1)\")\n", + "print(\"or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\")\n", + "print(\"since change in K.E=0\")\n", + "print(\"so (D2^2/D1^2)=T2/T1\")\n", + "print(\"D2/D1=sqrt(T2/T1)\")\n", + "print(\"say(D2/D1)=k\")\n", + "k=math.sqrt(T2/T1)\n", + "print(\"so exit to inlet diameter ratio(k)\"),round(k,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##example 1.28;page no:37" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 1.28, Page:37 \n", + " \n", + "\n", + "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\n", + "gas constant for H2(R1)in KJ/kg k\n", + "R1= 4.157\n", + "say initial and final ststes are given by 1 and 2\n", + "mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\n", + "final pressure of hydrogen(P2)in cm of Hg\n", + "P2= 6.0\n", + "therefore pressure difference(P)in kpa\n", + "P= 93.33\n", + "mass pumped out(m)in kg\n", + "m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\n", + "here V1=V2=V and T1=T2=T\n", + "so m= 0.15\n", + "now during cooling upto 10 degree celcius,the process may be consider as constant volume process\n", + "say state before and after cooling are denoted by suffix 2 and 3\n", + "final pressure after cooling(P3)in kpa\n", + "P3= 7.546\n" + ] + } + ], + "source": [ + "#cal of final pressure\n", + "#intiation of all variables\n", + "# Chapter 1\n", + "print\"Example 1.28, Page:37 \\n \\n\"\n", + "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\")\n", + "V=2;#volume of vessel in m^3\n", + "P1=76;#initial pressure or atmospheric pressure in cm of Hg\n", + "T=(27+273.15);#temperature of vessel in k\n", + "p=70;#final pressure in cm of Hg vaccum\n", + "R=8.314;#universal gas constant in KJ/kg k\n", + "M=2;#molecular weight of H2\n", + "print(\"gas constant for H2(R1)in KJ/kg k\")\n", + "R1=R/M\n", + "print(\"R1=\"),round(R1,3)\n", + "print(\"say initial and final ststes are given by 1 and 2\")\n", + "print(\"mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\")\n", + "print(\"final pressure of hydrogen(P2)in cm of Hg\")\n", + "P2=P1-p\n", + "print(\"P2=\"),round(P2,2)\n", + "print(\"therefore pressure difference(P)in kpa\")\n", + "P=((P1-P2)*101.325)/76\n", + "print(\"P=\"),round(P,2)\n", + "print(\"mass pumped out(m)in kg\")\n", + "print(\"m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\")\n", + "print(\"here V1=V2=V and T1=T2=T\")\n", + "m=(V*P)/(R1*T)\n", + "print(\"so m=\"),round(m,2)\n", + "print(\"now during cooling upto 10 degree celcius,the process may be consider as constant volume process\")\n", + "print(\"say state before and after cooling are denoted by suffix 2 and 3\")\n", + "T3=(10+273.15);#final temperature after cooling in k\n", + "print(\"final pressure after cooling(P3)in kpa\")\n", + "P3=(T3/T)*P2*(101.325/76)\n", + "print(\"P3=\"),round(P3,3)\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49).png b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49).png new file mode 100755 index 00000000..69b43e33 Binary files /dev/null and b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49).png differ diff --git a/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_1.png b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_1.png new file mode 100755 index 00000000..69b43e33 Binary files /dev/null and b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_1.png differ diff --git a/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_2.png b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_2.png new file mode 100755 index 00000000..69b43e33 Binary files /dev/null and b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_2.png differ diff --git a/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50).png b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50).png new file mode 100755 index 00000000..b8c7aad6 Binary files /dev/null and b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50).png differ diff --git a/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_1.png b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_1.png new file mode 100755 index 00000000..b8c7aad6 Binary files /dev/null and b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_1.png differ diff --git a/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_2.png b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_2.png new file mode 100755 index 00000000..b8c7aad6 Binary files /dev/null and b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_2.png differ diff --git a/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51).png b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51).png new file mode 100755 index 00000000..f3bb8ad5 Binary files /dev/null and b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51).png differ diff --git a/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_1.png b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_1.png new file mode 100755 index 00000000..f3bb8ad5 Binary files /dev/null and b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_1.png differ diff --git a/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_2.png b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_2.png new file mode 100755 index 00000000..f3bb8ad5 Binary files /dev/null and b/Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_2.png differ diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium.ipynb new file mode 100755 index 00000000..e19d65e0 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium.ipynb @@ -0,0 +1,155 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10 Solid Solutions and Phase Equilibrium" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_6 pgno:391" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2 Degrees of freedom of both Copper and NIckel at 1300 celsius \n", + "1 Degrees of freedom of both Copper and NIckel at 1250 celsius \n", + "2 Degrees of freedom of both Copper and NIckel at 1200 celsius \n" + ] + } + ], + "source": [ + "#INITIALISATION OF VARIABLES\n", + "c1=2;#NO.of independent Chemical components at 1300 celsius\n", + "p1=1;#No.of phases at 1300 celsius\n", + "c2=2;#NO.of independent Chemical components at 1250 celsius\n", + "p2=2;#No.of phases at 1250 celsius\n", + "c3=2;#NO.of independent Chemical components at 1200 celsius\n", + "p3=1;#No.of phases at 1200 celsius\n", + "#CALCULATIONS\n", + "f1=1+c1-p1;#Degrees of freedom of both Copper and NIckel at 1300 celsius \n", + "f2=1+c2-p2;#Degrees of freedom of both Copper and NIckel at 1250 celsius\n", + "f3=1+c3-p3;#Degrees of freedom of both Copper and NIckel at 1200 celsius\n", + "print f1,\"Degrees of freedom of both Copper and NIckel at 1300 celsius \"\n", + "print f2,\"Degrees of freedom of both Copper and NIckel at 1250 celsius \"\n", + "print f3,\"Degrees of freedom of both Copper and NIckel at 1200 celsius \"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_8 pgno:393" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.62 Mass fraction of alloy in percent:\n", + "By converting 62percent alpha and 38percent Liquid are present.:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Nia=40.;#no, of grams of nickel in alloy at alla temperature\n", + "NiL=32.;#Mass of Nickel present in Liquid\n", + "Nialpha=45.;#Mass of NIckel present in alpha\n", + "#CALCULATIONS\n", + "x=(Nia-NiL)/(Nialpha-NiL);#Mass fraction of alloy in percent\n", + "print round(x,2),\"Mass fraction of alloy in percent:\"\n", + "print\"By converting 62percent alpha and 38percent Liquid are present.:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_9 pgno:395" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "At 1300 degree celsius only one phase so 100 percent Liquid\n", + "77.0 Percentage of Liquid at 1270 degree celsius :\n", + "23.0 Percentage of Solid qt 1270 degree celsius:\n", + "38.0 Percentage of Liquid at 1250 degree celsius :\n", + "62.0 Percentage of Solid at 1250 degree celsius:\n", + "At 1200 degree celsius only one phase so 100 percent Solid \n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "NiL=37.;# percentage of NI the Liquid contains at 1270 degree celsius\n", + "NiS=50.;#percentage of NI the Solid contains at 1270 degree celsius\n", + "NiL2=32.;#percentage of NI the Liquidcontains at 1250 degree celsius\n", + "NiS2=45.;#percentage of NI the Solid contains at 1250 degree celsius\n", + "NiS3=40.;#percentage of NI the Solid contains at 1200 degree celsius\n", + "NiL3=40.;#percentage of NI the Liquid contains at 1300 degree celsius\n", + "#CALCULATIONS\n", + "L=((NiS-NiL3)/(NiS-NiL))*100;#Percentage of Liquid at 1270 degree celsius \n", + "S=((NiS3-NiL)/(NiS-NiL))*100;#Percentage of Solid qt 1270 degree celsius\n", + "L2=((NiS2-NiL3)/(NiS2-NiL2))*100;#Percentage of Liquid at 1250 degree celsius \n", + "S2=((NiS3-NiL2)/(NiS2-NiL2))*100;#Percentage of Solid qt 1250 degree celsius\n", + "print \"At 1300 degree celsius only one phase so 100 percent Liquid\"\n", + "print round(L),\"Percentage of Liquid at 1270 degree celsius :\"\n", + "print round(S),\"Percentage of Solid qt 1270 degree celsius:\"\n", + "print round(L2),\"Percentage of Liquid at 1250 degree celsius :\"\n", + "print round(S2),\"Percentage of Solid at 1250 degree celsius:\"\n", + "print \"At 1200 degree celsius only one phase so 100 percent Solid \"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_1.ipynb new file mode 100755 index 00000000..e19d65e0 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_1.ipynb @@ -0,0 +1,155 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10 Solid Solutions and Phase Equilibrium" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_6 pgno:391" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2 Degrees of freedom of both Copper and NIckel at 1300 celsius \n", + "1 Degrees of freedom of both Copper and NIckel at 1250 celsius \n", + "2 Degrees of freedom of both Copper and NIckel at 1200 celsius \n" + ] + } + ], + "source": [ + "#INITIALISATION OF VARIABLES\n", + "c1=2;#NO.of independent Chemical components at 1300 celsius\n", + "p1=1;#No.of phases at 1300 celsius\n", + "c2=2;#NO.of independent Chemical components at 1250 celsius\n", + "p2=2;#No.of phases at 1250 celsius\n", + "c3=2;#NO.of independent Chemical components at 1200 celsius\n", + "p3=1;#No.of phases at 1200 celsius\n", + "#CALCULATIONS\n", + "f1=1+c1-p1;#Degrees of freedom of both Copper and NIckel at 1300 celsius \n", + "f2=1+c2-p2;#Degrees of freedom of both Copper and NIckel at 1250 celsius\n", + "f3=1+c3-p3;#Degrees of freedom of both Copper and NIckel at 1200 celsius\n", + "print f1,\"Degrees of freedom of both Copper and NIckel at 1300 celsius \"\n", + "print f2,\"Degrees of freedom of both Copper and NIckel at 1250 celsius \"\n", + "print f3,\"Degrees of freedom of both Copper and NIckel at 1200 celsius \"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_8 pgno:393" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.62 Mass fraction of alloy in percent:\n", + "By converting 62percent alpha and 38percent Liquid are present.:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Nia=40.;#no, of grams of nickel in alloy at alla temperature\n", + "NiL=32.;#Mass of Nickel present in Liquid\n", + "Nialpha=45.;#Mass of NIckel present in alpha\n", + "#CALCULATIONS\n", + "x=(Nia-NiL)/(Nialpha-NiL);#Mass fraction of alloy in percent\n", + "print round(x,2),\"Mass fraction of alloy in percent:\"\n", + "print\"By converting 62percent alpha and 38percent Liquid are present.:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_9 pgno:395" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "At 1300 degree celsius only one phase so 100 percent Liquid\n", + "77.0 Percentage of Liquid at 1270 degree celsius :\n", + "23.0 Percentage of Solid qt 1270 degree celsius:\n", + "38.0 Percentage of Liquid at 1250 degree celsius :\n", + "62.0 Percentage of Solid at 1250 degree celsius:\n", + "At 1200 degree celsius only one phase so 100 percent Solid \n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "NiL=37.;# percentage of NI the Liquid contains at 1270 degree celsius\n", + "NiS=50.;#percentage of NI the Solid contains at 1270 degree celsius\n", + "NiL2=32.;#percentage of NI the Liquidcontains at 1250 degree celsius\n", + "NiS2=45.;#percentage of NI the Solid contains at 1250 degree celsius\n", + "NiS3=40.;#percentage of NI the Solid contains at 1200 degree celsius\n", + "NiL3=40.;#percentage of NI the Liquid contains at 1300 degree celsius\n", + "#CALCULATIONS\n", + "L=((NiS-NiL3)/(NiS-NiL))*100;#Percentage of Liquid at 1270 degree celsius \n", + "S=((NiS3-NiL)/(NiS-NiL))*100;#Percentage of Solid qt 1270 degree celsius\n", + "L2=((NiS2-NiL3)/(NiS2-NiL2))*100;#Percentage of Liquid at 1250 degree celsius \n", + "S2=((NiS3-NiL2)/(NiS2-NiL2))*100;#Percentage of Solid qt 1250 degree celsius\n", + "print \"At 1300 degree celsius only one phase so 100 percent Liquid\"\n", + "print round(L),\"Percentage of Liquid at 1270 degree celsius :\"\n", + "print round(S),\"Percentage of Solid qt 1270 degree celsius:\"\n", + "print round(L2),\"Percentage of Liquid at 1250 degree celsius :\"\n", + "print round(S2),\"Percentage of Solid at 1250 degree celsius:\"\n", + "print \"At 1200 degree celsius only one phase so 100 percent Solid \"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_2.ipynb new file mode 100755 index 00000000..3289e7a6 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_2.ipynb @@ -0,0 +1,155 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10 Solid Solutions and Phase Equilibrium" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_6 pgno:391" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Degrees of freedom of both Copper and NIckel at 1300 celsius 2\n", + "Degrees of freedom of both Copper and NIckel at 1250 celsius 1\n", + "Degrees of freedom of both Copper and NIckel at 1200 celsius 2\n" + ] + } + ], + "source": [ + "#INITIALISATION OF VARIABLES\n", + "c1=2;#NO.of independent Chemical components at 1300 celsius\n", + "p1=1;#No.of phases at 1300 celsius\n", + "c2=2;#NO.of independent Chemical components at 1250 celsius\n", + "p2=2;#No.of phases at 1250 celsius\n", + "c3=2;#NO.of independent Chemical components at 1200 celsius\n", + "p3=1;#No.of phases at 1200 celsius\n", + "#CALCULATIONS\n", + "f1=1+c1-p1;#Degrees of freedom of both Copper and NIckel at 1300 celsius \n", + "f2=1+c2-p2;#Degrees of freedom of both Copper and NIckel at 1250 celsius\n", + "f3=1+c3-p3;#Degrees of freedom of both Copper and NIckel at 1200 celsius\n", + "print \"Degrees of freedom of both Copper and NIckel at 1300 celsius \",f1\n", + "print \"Degrees of freedom of both Copper and NIckel at 1250 celsius \",f2\n", + "print \"Degrees of freedom of both Copper and NIckel at 1200 celsius \",f3\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_8 pgno:393" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Mass fraction of alloy in percent: 0.62\n", + "By converting 62percent alpha and 38percent Liquid are present.:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Nia=40.;#no, of grams of nickel in alloy at alla temperature\n", + "NiL=32.;#Mass of Nickel present in Liquid\n", + "Nialpha=45.;#Mass of NIckel present in alpha\n", + "#CALCULATIONS\n", + "x=(Nia-NiL)/(Nialpha-NiL);#Mass fraction of alloy in percent\n", + "print \"Mass fraction of alloy in percent:\",round(x,2)\n", + "print\"By converting 62percent alpha and 38percent Liquid are present.:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_9 pgno:395" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "At 1300 degree celsius only one phase so 100 percent Liquid\n", + "Percentage of Liquid at 1270 degree celsius : 77.0\n", + "Percentage of Solid qt 1270 degree celsius: 23.0\n", + "Percentage of Liquid at 1250 degree celsius : 38.0\n", + "Percentage of Solid at 1250 degree celsius: 62.0\n", + "At 1200 degree celsius only one phase so 100 percent Solid \n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "NiL=37.;# percentage of NI the Liquid contains at 1270 degree celsius\n", + "NiS=50.;#percentage of NI the Solid contains at 1270 degree celsius\n", + "NiL2=32.;#percentage of NI the Liquidcontains at 1250 degree celsius\n", + "NiS2=45.;#percentage of NI the Solid contains at 1250 degree celsius\n", + "NiS3=40.;#percentage of NI the Solid contains at 1200 degree celsius\n", + "NiL3=40.;#percentage of NI the Liquid contains at 1300 degree celsius\n", + "#CALCULATIONS\n", + "L=((NiS-NiL3)/(NiS-NiL))*100;#Percentage of Liquid at 1270 degree celsius \n", + "S=((NiS3-NiL)/(NiS-NiL))*100;#Percentage of Solid qt 1270 degree celsius\n", + "L2=((NiS2-NiL3)/(NiS2-NiL2))*100;#Percentage of Liquid at 1250 degree celsius \n", + "S2=((NiS3-NiL2)/(NiS2-NiL2))*100;#Percentage of Solid qt 1250 degree celsius\n", + "print \"At 1300 degree celsius only one phase so 100 percent Liquid\"\n", + "print \"Percentage of Liquid at 1270 degree celsius :\",round(L)\n", + "print \"Percentage of Solid qt 1270 degree celsius:\",round(S)\n", + "print \"Percentage of Liquid at 1250 degree celsius :\",round(L2)\n", + "print \"Percentage of Solid at 1250 degree celsius:\",round(S2)\n", + "print \"At 1200 degree celsius only one phase so 100 percent Solid \"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_3.ipynb new file mode 100755 index 00000000..3289e7a6 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_3.ipynb @@ -0,0 +1,155 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10 Solid Solutions and Phase Equilibrium" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_6 pgno:391" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Degrees of freedom of both Copper and NIckel at 1300 celsius 2\n", + "Degrees of freedom of both Copper and NIckel at 1250 celsius 1\n", + "Degrees of freedom of both Copper and NIckel at 1200 celsius 2\n" + ] + } + ], + "source": [ + "#INITIALISATION OF VARIABLES\n", + "c1=2;#NO.of independent Chemical components at 1300 celsius\n", + "p1=1;#No.of phases at 1300 celsius\n", + "c2=2;#NO.of independent Chemical components at 1250 celsius\n", + "p2=2;#No.of phases at 1250 celsius\n", + "c3=2;#NO.of independent Chemical components at 1200 celsius\n", + "p3=1;#No.of phases at 1200 celsius\n", + "#CALCULATIONS\n", + "f1=1+c1-p1;#Degrees of freedom of both Copper and NIckel at 1300 celsius \n", + "f2=1+c2-p2;#Degrees of freedom of both Copper and NIckel at 1250 celsius\n", + "f3=1+c3-p3;#Degrees of freedom of both Copper and NIckel at 1200 celsius\n", + "print \"Degrees of freedom of both Copper and NIckel at 1300 celsius \",f1\n", + "print \"Degrees of freedom of both Copper and NIckel at 1250 celsius \",f2\n", + "print \"Degrees of freedom of both Copper and NIckel at 1200 celsius \",f3\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_8 pgno:393" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Mass fraction of alloy in percent: 0.62\n", + "By converting 62percent alpha and 38percent Liquid are present.:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Nia=40.;#no, of grams of nickel in alloy at alla temperature\n", + "NiL=32.;#Mass of Nickel present in Liquid\n", + "Nialpha=45.;#Mass of NIckel present in alpha\n", + "#CALCULATIONS\n", + "x=(Nia-NiL)/(Nialpha-NiL);#Mass fraction of alloy in percent\n", + "print \"Mass fraction of alloy in percent:\",round(x,2)\n", + "print\"By converting 62percent alpha and 38percent Liquid are present.:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10_9 pgno:395" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "At 1300 degree celsius only one phase so 100 percent Liquid\n", + "Percentage of Liquid at 1270 degree celsius : 77.0\n", + "Percentage of Solid qt 1270 degree celsius: 23.0\n", + "Percentage of Liquid at 1250 degree celsius : 38.0\n", + "Percentage of Solid at 1250 degree celsius: 62.0\n", + "At 1200 degree celsius only one phase so 100 percent Solid \n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "NiL=37.;# percentage of NI the Liquid contains at 1270 degree celsius\n", + "NiS=50.;#percentage of NI the Solid contains at 1270 degree celsius\n", + "NiL2=32.;#percentage of NI the Liquidcontains at 1250 degree celsius\n", + "NiS2=45.;#percentage of NI the Solid contains at 1250 degree celsius\n", + "NiS3=40.;#percentage of NI the Solid contains at 1200 degree celsius\n", + "NiL3=40.;#percentage of NI the Liquid contains at 1300 degree celsius\n", + "#CALCULATIONS\n", + "L=((NiS-NiL3)/(NiS-NiL))*100;#Percentage of Liquid at 1270 degree celsius \n", + "S=((NiS3-NiL)/(NiS-NiL))*100;#Percentage of Solid qt 1270 degree celsius\n", + "L2=((NiS2-NiL3)/(NiS2-NiL2))*100;#Percentage of Liquid at 1250 degree celsius \n", + "S2=((NiS3-NiL2)/(NiS2-NiL2))*100;#Percentage of Solid qt 1250 degree celsius\n", + "print \"At 1300 degree celsius only one phase so 100 percent Liquid\"\n", + "print \"Percentage of Liquid at 1270 degree celsius :\",round(L)\n", + "print \"Percentage of Solid qt 1270 degree celsius:\",round(S)\n", + "print \"Percentage of Liquid at 1250 degree celsius :\",round(L2)\n", + "print \"Percentage of Solid at 1250 degree celsius:\",round(S2)\n", + "print \"At 1200 degree celsius only one phase so 100 percent Solid \"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams.ipynb new file mode 100755 index 00000000..f63c3411 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams.ipynb @@ -0,0 +1,198 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11 Dispertion Strengthening and Eutectic Phase Diagrams" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_2 pgno:422" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "8.16326530612 c.Amount of beeta forms of Pb-Sn in gm:\n", + "1.83673469388 d.The mass of Sn in the alpha phase in g:\n", + "8.2 d.The mass of Sn in beeta phase in g:\n", + "90.0 e.The mass of Pb in the alpha phase in g:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Sn=2.#Amount of Tin Dissolved in alpha solid solution \n", + "Sn2=10.;#Amount of Tin Dissolved in alpha+beeta solid solution at 0 degree celsius\n", + "m=100.;#Total mass of the Pb-Sn alloy in gm\n", + "Pbm=90.#Total mass of the Pb in Pb-Sn alloy in gm\n", + "#CALCULATIONS\n", + "B=((Sn2-Sn)/(m-Sn))*100;#The amount of beeta Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", + "B2=100-B;#The amount of alpha Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", + "Sn1=(Sn/100.)*(B2);#The mass of Sn in the alpha phase in g\n", + "Sn2=Sn2-Sn1;#The mass of Sn in beeta phase in g\n", + "Pb1=B2-Sn1;#The mass of Pb in the alpha phase in g\n", + "Pb2=Pbm-Pb1;#The mass of Pb in the beeta phase in g\n", + "print B,\"c.Amount of beeta forms of Pb-Sn in gm:\"\n", + "print Sn1,\"d.The mass of Sn in the alpha phase in g:\"\n", + "print round(Sn2,1),\"d.The mass of Sn in beeta phase in g:\"\n", + "print Pb1,\"e.The mass of Pb in the alpha phase in g:\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_3 pgno:425" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.453503184713 Weight fraction of alpha phase\n", + "0.546496815287 Weight fraction of beeta phase\n", + "90.7006369427 The mass of the alpha phase in 200g in g:\n", + "109.299363057 The amount of the beeta phase in g at 182 degree celsius:\n", + "73.4675159236 Mass of Pb in the alpha phase in g:\n", + "17.2331210191 Mass of Sn in alpha phase\n", + "2.73248407643 Mass of Pb in beeta phase:\n", + "106.6 mass of Sn in beeta Phase:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "M=200.;#Mass of alpha phase of alloy in gm\n", + "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", + "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", + "Pb2=97.5;#Percentage of the Sn in the beeta phase in percent\n", + "#CALCULLATIONS\n", + "W1=(Pb2-Sn)/(Pb2-Pb);#Weight fraction of alpha phase\n", + "W2=(Sn-Pb)/(Pb2-Pb);#Weight fraction of beeta phase\n", + "Ma=M*W1;#The mass of the alpha phase in 200g in g\n", + "Mb=M-Ma;#The amount of the beeta phase in g at 182 degree celsius\n", + "MPb1=Ma*(1-(Pb/100));#Mass of Pb in the alpha phase in g\n", + "MSn1=Ma-MPb1;#Mass of Sn in alpha phase \n", + "MPb2=Mb*(1-(Pb2/100));#Mass of Pb in beeta phase\n", + "MSn2=123.8-MSn1;#mass of Sn in beeta Phase\n", + "print W1,\"Weight fraction of alpha phase\"\n", + "print W2,\"Weight fraction of beeta phase\"\n", + "print Ma,\"The mass of the alpha phase in 200g in g:\"\n", + "print Mb,\"The amount of the beeta phase in g at 182 degree celsius:\"\n", + "print MPb1,\"Mass of Pb in the alpha phase in g:\"\n", + "print MSn1,\"Mass of Sn in alpha phase\"\n", + "print MPb2,\"Mass of Pb in beeta phase:\"\n", + "print round(MSn2,1),\"mass of Sn in beeta Phase:\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_5 pgno:429" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "74.0 The amount of compositions of primary alpha in Pb-Sn:\n", + "26.0 The amount of composition of eutectic in Pb-Sn:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", + "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", + "Sn2=30.;#Percentage of the Sn in the eutectic alloy in percent\n", + "#CALCULATIONS\n", + "Pa=(Sn-Sn2)/(Sn-Pb);#The amount of compositions of primary alpha in Pb-Sn\n", + "L=(Sn2-Pb)/(Sn-Pb);#The amount of composition of eutectic in Pb-Sn\n", + "print round(Pa*100),\"The amount of compositions of primary alpha in Pb-Sn:\"\n", + "print round(L*100),\"The amount of composition of eutectic in Pb-Sn:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_6 pgno:434" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "59.0 L200 in percentage\n", + "70.0 L210 in percentage\n" + ] + } + ], + "source": [ + "\n", + "per_L_200=((40.-18.)/(55.-18.))*100\n", + "Per_L_210=((40.-17.)/(50.-17.))*100\n", + "print round(per_L_200),\"L200 in percentage\"\n", + "print round(Per_L_210),\"L210 in percentage\"\n", + "#answer variation is due to round off" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_1.ipynb new file mode 100755 index 00000000..f63c3411 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_1.ipynb @@ -0,0 +1,198 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11 Dispertion Strengthening and Eutectic Phase Diagrams" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_2 pgno:422" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "8.16326530612 c.Amount of beeta forms of Pb-Sn in gm:\n", + "1.83673469388 d.The mass of Sn in the alpha phase in g:\n", + "8.2 d.The mass of Sn in beeta phase in g:\n", + "90.0 e.The mass of Pb in the alpha phase in g:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Sn=2.#Amount of Tin Dissolved in alpha solid solution \n", + "Sn2=10.;#Amount of Tin Dissolved in alpha+beeta solid solution at 0 degree celsius\n", + "m=100.;#Total mass of the Pb-Sn alloy in gm\n", + "Pbm=90.#Total mass of the Pb in Pb-Sn alloy in gm\n", + "#CALCULATIONS\n", + "B=((Sn2-Sn)/(m-Sn))*100;#The amount of beeta Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", + "B2=100-B;#The amount of alpha Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", + "Sn1=(Sn/100.)*(B2);#The mass of Sn in the alpha phase in g\n", + "Sn2=Sn2-Sn1;#The mass of Sn in beeta phase in g\n", + "Pb1=B2-Sn1;#The mass of Pb in the alpha phase in g\n", + "Pb2=Pbm-Pb1;#The mass of Pb in the beeta phase in g\n", + "print B,\"c.Amount of beeta forms of Pb-Sn in gm:\"\n", + "print Sn1,\"d.The mass of Sn in the alpha phase in g:\"\n", + "print round(Sn2,1),\"d.The mass of Sn in beeta phase in g:\"\n", + "print Pb1,\"e.The mass of Pb in the alpha phase in g:\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_3 pgno:425" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.453503184713 Weight fraction of alpha phase\n", + "0.546496815287 Weight fraction of beeta phase\n", + "90.7006369427 The mass of the alpha phase in 200g in g:\n", + "109.299363057 The amount of the beeta phase in g at 182 degree celsius:\n", + "73.4675159236 Mass of Pb in the alpha phase in g:\n", + "17.2331210191 Mass of Sn in alpha phase\n", + "2.73248407643 Mass of Pb in beeta phase:\n", + "106.6 mass of Sn in beeta Phase:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "M=200.;#Mass of alpha phase of alloy in gm\n", + "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", + "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", + "Pb2=97.5;#Percentage of the Sn in the beeta phase in percent\n", + "#CALCULLATIONS\n", + "W1=(Pb2-Sn)/(Pb2-Pb);#Weight fraction of alpha phase\n", + "W2=(Sn-Pb)/(Pb2-Pb);#Weight fraction of beeta phase\n", + "Ma=M*W1;#The mass of the alpha phase in 200g in g\n", + "Mb=M-Ma;#The amount of the beeta phase in g at 182 degree celsius\n", + "MPb1=Ma*(1-(Pb/100));#Mass of Pb in the alpha phase in g\n", + "MSn1=Ma-MPb1;#Mass of Sn in alpha phase \n", + "MPb2=Mb*(1-(Pb2/100));#Mass of Pb in beeta phase\n", + "MSn2=123.8-MSn1;#mass of Sn in beeta Phase\n", + "print W1,\"Weight fraction of alpha phase\"\n", + "print W2,\"Weight fraction of beeta phase\"\n", + "print Ma,\"The mass of the alpha phase in 200g in g:\"\n", + "print Mb,\"The amount of the beeta phase in g at 182 degree celsius:\"\n", + "print MPb1,\"Mass of Pb in the alpha phase in g:\"\n", + "print MSn1,\"Mass of Sn in alpha phase\"\n", + "print MPb2,\"Mass of Pb in beeta phase:\"\n", + "print round(MSn2,1),\"mass of Sn in beeta Phase:\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_5 pgno:429" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "74.0 The amount of compositions of primary alpha in Pb-Sn:\n", + "26.0 The amount of composition of eutectic in Pb-Sn:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", + "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", + "Sn2=30.;#Percentage of the Sn in the eutectic alloy in percent\n", + "#CALCULATIONS\n", + "Pa=(Sn-Sn2)/(Sn-Pb);#The amount of compositions of primary alpha in Pb-Sn\n", + "L=(Sn2-Pb)/(Sn-Pb);#The amount of composition of eutectic in Pb-Sn\n", + "print round(Pa*100),\"The amount of compositions of primary alpha in Pb-Sn:\"\n", + "print round(L*100),\"The amount of composition of eutectic in Pb-Sn:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_6 pgno:434" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "59.0 L200 in percentage\n", + "70.0 L210 in percentage\n" + ] + } + ], + "source": [ + "\n", + "per_L_200=((40.-18.)/(55.-18.))*100\n", + "Per_L_210=((40.-17.)/(50.-17.))*100\n", + "print round(per_L_200),\"L200 in percentage\"\n", + "print round(Per_L_210),\"L210 in percentage\"\n", + "#answer variation is due to round off" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_2.ipynb new file mode 100755 index 00000000..84eb7ae5 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_2.ipynb @@ -0,0 +1,198 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11 Dispertion Strengthening and Eutectic Phase Diagrams" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_2 pgno:422" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "c.Amount of beeta forms of Pb-Sn in gm: 8.16326530612\n", + "d.The mass of Sn in the alpha phase in g: 1.83673469388\n", + "d.The mass of Sn in beeta phase in g: 8.2\n", + "e.The mass of Pb in the alpha phase in g: 90.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Sn=2.#Amount of Tin Dissolved in alpha solid solution \n", + "Sn2=10.;#Amount of Tin Dissolved in alpha+beeta solid solution at 0 degree celsius\n", + "m=100.;#Total mass of the Pb-Sn alloy in gm\n", + "Pbm=90.#Total mass of the Pb in Pb-Sn alloy in gm\n", + "#CALCULATIONS\n", + "B=((Sn2-Sn)/(m-Sn))*100;#The amount of beeta Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", + "B2=100-B;#The amount of alpha Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", + "Sn1=(Sn/100.)*(B2);#The mass of Sn in the alpha phase in g\n", + "Sn2=Sn2-Sn1;#The mass of Sn in beeta phase in g\n", + "Pb1=B2-Sn1;#The mass of Pb in the alpha phase in g\n", + "Pb2=Pbm-Pb1;#The mass of Pb in the beeta phase in g\n", + "print \"c.Amount of beeta forms of Pb-Sn in gm:\",B\n", + "print \"d.The mass of Sn in the alpha phase in g:\",Sn1\n", + "print \"d.The mass of Sn in beeta phase in g:\",round(Sn2,1)\n", + "print \"e.The mass of Pb in the alpha phase in g:\",Pb1\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_3 pgno:425" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Weight fraction of alpha phase 0.453503184713\n", + "Weight fraction of beeta phase 0.546496815287\n", + "The mass of the alpha phase in 200g in g: 90.7006369427\n", + "The amount of the beeta phase in g at 182 degree celsius: 109.299363057\n", + "Mass of Pb in the alpha phase in g: 73.4675159236\n", + "Mass of Sn in alpha phase 17.2331210191\n", + "Mass of Pb in beeta phase: 2.73248407643\n", + "mass of Sn in beeta Phase: 106.6\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "M=200.;#Mass of alpha phase of alloy in gm\n", + "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", + "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", + "Pb2=97.5;#Percentage of the Sn in the beeta phase in percent\n", + "#CALCULLATIONS\n", + "W1=(Pb2-Sn)/(Pb2-Pb);#Weight fraction of alpha phase\n", + "W2=(Sn-Pb)/(Pb2-Pb);#Weight fraction of beeta phase\n", + "Ma=M*W1;#The mass of the alpha phase in 200g in g\n", + "Mb=M-Ma;#The amount of the beeta phase in g at 182 degree celsius\n", + "MPb1=Ma*(1-(Pb/100));#Mass of Pb in the alpha phase in g\n", + "MSn1=Ma-MPb1;#Mass of Sn in alpha phase \n", + "MPb2=Mb*(1-(Pb2/100));#Mass of Pb in beeta phase\n", + "MSn2=123.8-MSn1;#mass of Sn in beeta Phase\n", + "print \"Weight fraction of alpha phase\",W1\n", + "print \"Weight fraction of beeta phase\",W2\n", + "print \"The mass of the alpha phase in 200g in g:\",Ma\n", + "print \"The amount of the beeta phase in g at 182 degree celsius:\",Mb\n", + "print \"Mass of Pb in the alpha phase in g:\",MPb1\n", + "print \"Mass of Sn in alpha phase\",MSn1\n", + "print \"Mass of Pb in beeta phase:\",MPb2\n", + "print \"mass of Sn in beeta Phase:\",round(MSn2,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_5 pgno:429" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The amount of compositions of primary alpha in Pb-Sn: 74.0\n", + "The amount of composition of eutectic in Pb-Sn: 26.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", + "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", + "Sn2=30.;#Percentage of the Sn in the eutectic alloy in percent\n", + "#CALCULATIONS\n", + "Pa=(Sn-Sn2)/(Sn-Pb);#The amount of compositions of primary alpha in Pb-Sn\n", + "L=(Sn2-Pb)/(Sn-Pb);#The amount of composition of eutectic in Pb-Sn\n", + "print \"The amount of compositions of primary alpha in Pb-Sn:\",round(Pa*100)\n", + "print \"The amount of composition of eutectic in Pb-Sn:\", round(L*100)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_6 pgno:434" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "L200 in percentage 59.0\n", + "L210 in percentage 70.0\n" + ] + } + ], + "source": [ + "\n", + "per_L_200=((40.-18.)/(55.-18.))*100\n", + "Per_L_210=((40.-17.)/(50.-17.))*100\n", + "print \"L200 in percentage\",round(per_L_200)\n", + "print \"L210 in percentage\",round(Per_L_210)\n", + "#answer variation is due to round off" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_3.ipynb new file mode 100755 index 00000000..84eb7ae5 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_3.ipynb @@ -0,0 +1,198 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11 Dispertion Strengthening and Eutectic Phase Diagrams" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_2 pgno:422" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "c.Amount of beeta forms of Pb-Sn in gm: 8.16326530612\n", + "d.The mass of Sn in the alpha phase in g: 1.83673469388\n", + "d.The mass of Sn in beeta phase in g: 8.2\n", + "e.The mass of Pb in the alpha phase in g: 90.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Sn=2.#Amount of Tin Dissolved in alpha solid solution \n", + "Sn2=10.;#Amount of Tin Dissolved in alpha+beeta solid solution at 0 degree celsius\n", + "m=100.;#Total mass of the Pb-Sn alloy in gm\n", + "Pbm=90.#Total mass of the Pb in Pb-Sn alloy in gm\n", + "#CALCULATIONS\n", + "B=((Sn2-Sn)/(m-Sn))*100;#The amount of beeta Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", + "B2=100-B;#The amount of alpha Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", + "Sn1=(Sn/100.)*(B2);#The mass of Sn in the alpha phase in g\n", + "Sn2=Sn2-Sn1;#The mass of Sn in beeta phase in g\n", + "Pb1=B2-Sn1;#The mass of Pb in the alpha phase in g\n", + "Pb2=Pbm-Pb1;#The mass of Pb in the beeta phase in g\n", + "print \"c.Amount of beeta forms of Pb-Sn in gm:\",B\n", + "print \"d.The mass of Sn in the alpha phase in g:\",Sn1\n", + "print \"d.The mass of Sn in beeta phase in g:\",round(Sn2,1)\n", + "print \"e.The mass of Pb in the alpha phase in g:\",Pb1\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_3 pgno:425" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Weight fraction of alpha phase 0.453503184713\n", + "Weight fraction of beeta phase 0.546496815287\n", + "The mass of the alpha phase in 200g in g: 90.7006369427\n", + "The amount of the beeta phase in g at 182 degree celsius: 109.299363057\n", + "Mass of Pb in the alpha phase in g: 73.4675159236\n", + "Mass of Sn in alpha phase 17.2331210191\n", + "Mass of Pb in beeta phase: 2.73248407643\n", + "mass of Sn in beeta Phase: 106.6\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "M=200.;#Mass of alpha phase of alloy in gm\n", + "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", + "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", + "Pb2=97.5;#Percentage of the Sn in the beeta phase in percent\n", + "#CALCULLATIONS\n", + "W1=(Pb2-Sn)/(Pb2-Pb);#Weight fraction of alpha phase\n", + "W2=(Sn-Pb)/(Pb2-Pb);#Weight fraction of beeta phase\n", + "Ma=M*W1;#The mass of the alpha phase in 200g in g\n", + "Mb=M-Ma;#The amount of the beeta phase in g at 182 degree celsius\n", + "MPb1=Ma*(1-(Pb/100));#Mass of Pb in the alpha phase in g\n", + "MSn1=Ma-MPb1;#Mass of Sn in alpha phase \n", + "MPb2=Mb*(1-(Pb2/100));#Mass of Pb in beeta phase\n", + "MSn2=123.8-MSn1;#mass of Sn in beeta Phase\n", + "print \"Weight fraction of alpha phase\",W1\n", + "print \"Weight fraction of beeta phase\",W2\n", + "print \"The mass of the alpha phase in 200g in g:\",Ma\n", + "print \"The amount of the beeta phase in g at 182 degree celsius:\",Mb\n", + "print \"Mass of Pb in the alpha phase in g:\",MPb1\n", + "print \"Mass of Sn in alpha phase\",MSn1\n", + "print \"Mass of Pb in beeta phase:\",MPb2\n", + "print \"mass of Sn in beeta Phase:\",round(MSn2,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_5 pgno:429" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The amount of compositions of primary alpha in Pb-Sn: 74.0\n", + "The amount of composition of eutectic in Pb-Sn: 26.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", + "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", + "Sn2=30.;#Percentage of the Sn in the eutectic alloy in percent\n", + "#CALCULATIONS\n", + "Pa=(Sn-Sn2)/(Sn-Pb);#The amount of compositions of primary alpha in Pb-Sn\n", + "L=(Sn2-Pb)/(Sn-Pb);#The amount of composition of eutectic in Pb-Sn\n", + "print \"The amount of compositions of primary alpha in Pb-Sn:\",round(Pa*100)\n", + "print \"The amount of composition of eutectic in Pb-Sn:\", round(L*100)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11_6 pgno:434" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "L200 in percentage 59.0\n", + "L210 in percentage 70.0\n" + ] + } + ], + "source": [ + "\n", + "per_L_200=((40.-18.)/(55.-18.))*100\n", + "Per_L_210=((40.-17.)/(50.-17.))*100\n", + "print \"L200 in percentage\",round(per_L_200)\n", + "print \"L210 in percentage\",round(Per_L_210)\n", + "#answer variation is due to round off" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment.ipynb new file mode 100755 index 00000000..228a9818 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment.ipynb @@ -0,0 +1,211 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12 Dispersion Strengthening by Phase Transmission and Heat Treatment" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_1 pgno:454" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.35108097784 Constant 10**10 A=\n", + "-20829.0 Slpoe of the straight line -Q/R\n" + ] + } + ], + "source": [ + "from math import log,exp\n", + "# Initialisation of Variables\n", + "r1=0.111;#Rate of copper in min^-1 at 135 degree celsius\n", + "r2=0.004;#Rate of copper in min^-1 at 88 degree celsius\n", + "T1=408.;#Temperature in K\n", + "T2=361.;#Temperature in K\n", + "R=1.987;#Gas constant\n", + "Q=20693.;#Change in Rates\n", + "slope=(log(r1)-log(r2))/((1/T1)-(1/T2));#Slope of the straight line ploted ln(Growth rate) as a function of 1=T,\n", + "A=r1/(exp(-Q/(R*T1)));#Constant\n", + "print A/10**10,\"Constant 10**10 A=\"\n", + "print round(2*slope),\"Slpoe of the straight line -Q/R\"\n", + "#diffrence in asnwer is due to round off error\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_5 pgno:467" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "88.7 Amount of ferrite present in peralite:\n", + "11.3 Amount of Cementite present in peralite:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Fe=6.67;#Carbon percentage in Cementite\n", + "G=0.77;#Carbon percentage in peralite in composition\n", + "A=0.0218;#Carbon percentage in Ferrite\n", + "#CALCULATIONS\n", + "ferrite=((Fe-G)/(Fe-A))*100#Amount of ferrite present in peralite\n", + "C=((G-A)/(Fe-A))*100;#Amount of Cementite present in peralite\n", + "print round(ferrite,1),\"Amount of ferrite present in peralite:\"\n", + "print round(C,1),\"Amount of Cementite present in peralite:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_6 pgno:469" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "91.3 Composition of Phase Ferrite in alloy :\n", + "8.7 Composition of Cementite in percent in alloy:\n", + "22.7 Percentage of microconstituents Primary Ferrite in alloy:\n", + "77.3 Percentage of microconstituents Pearlite in alloy:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "A=0.0218;#Carbon percentage in primary alpha in percent\n", + "Fe=6.67;#Carbon percentage in Cementite in percent\n", + "G=0.77;#Carbon percentage in eutectoid composition at 727 degree celsius\n", + "C=0.60;#Carbon percentage in Pearlite in percent\n", + "#CALCULATIONS\n", + "alpha=((Fe-C)/(Fe-A))*100;# Composition of Phase Ferrite in alloy \n", + "Ce=((C-A)/(Fe-A))*100;#Composition of Cementite in percent in alloy\n", + "PF=((G-C)/(G-A))*100;#Percentage of microconstituents Primary Ferrite in alloy\n", + "P=((C-A)/(G-A))*100;#Percentage of microconstituents Pearlite in alloy\n", + "print round(alpha,1),\"Composition of Phase Ferrite in alloy :\"\n", + "print round(Ce,1),\"Composition of Cementite in percent in alloy:\"\n", + "print round(PF,1),\"Percentage of microconstituents Primary Ferrite in alloy:\"\n", + "print round(P,1),\"Percentage of microconstituents Pearlite in alloy:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_7 pgno:474" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "7.14285714286e-05 The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "d=0.001;#Actual distence between one alpha plate to next alpha plate \n", + "S=14;#Spacings between between one alpha plate to next alpha plate \n", + "#CALCULATIONS\n", + "lamida=d/S;#The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure\n", + "print lamida,\"The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_9 pgno:476" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.31 The carbon content of hypoeutectoid Steel in percentage:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "M=0.60;#Percentage of Carbon in Martensite at 750 degree celsius\n", + "a=50.;#Percentage of Carbon in Austenite at 750 degree celsius\n", + "c=0.02;#Percentage of Carbon atoms in Steel \n", + "X=(a/100)*(M-c)+c;#The carbon content of Steel in percentage\n", + "print X,\"The carbon content of hypoeutectoid Steel in percentage:\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_1.ipynb new file mode 100755 index 00000000..228a9818 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_1.ipynb @@ -0,0 +1,211 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12 Dispersion Strengthening by Phase Transmission and Heat Treatment" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_1 pgno:454" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.35108097784 Constant 10**10 A=\n", + "-20829.0 Slpoe of the straight line -Q/R\n" + ] + } + ], + "source": [ + "from math import log,exp\n", + "# Initialisation of Variables\n", + "r1=0.111;#Rate of copper in min^-1 at 135 degree celsius\n", + "r2=0.004;#Rate of copper in min^-1 at 88 degree celsius\n", + "T1=408.;#Temperature in K\n", + "T2=361.;#Temperature in K\n", + "R=1.987;#Gas constant\n", + "Q=20693.;#Change in Rates\n", + "slope=(log(r1)-log(r2))/((1/T1)-(1/T2));#Slope of the straight line ploted ln(Growth rate) as a function of 1=T,\n", + "A=r1/(exp(-Q/(R*T1)));#Constant\n", + "print A/10**10,\"Constant 10**10 A=\"\n", + "print round(2*slope),\"Slpoe of the straight line -Q/R\"\n", + "#diffrence in asnwer is due to round off error\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_5 pgno:467" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "88.7 Amount of ferrite present in peralite:\n", + "11.3 Amount of Cementite present in peralite:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Fe=6.67;#Carbon percentage in Cementite\n", + "G=0.77;#Carbon percentage in peralite in composition\n", + "A=0.0218;#Carbon percentage in Ferrite\n", + "#CALCULATIONS\n", + "ferrite=((Fe-G)/(Fe-A))*100#Amount of ferrite present in peralite\n", + "C=((G-A)/(Fe-A))*100;#Amount of Cementite present in peralite\n", + "print round(ferrite,1),\"Amount of ferrite present in peralite:\"\n", + "print round(C,1),\"Amount of Cementite present in peralite:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_6 pgno:469" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "91.3 Composition of Phase Ferrite in alloy :\n", + "8.7 Composition of Cementite in percent in alloy:\n", + "22.7 Percentage of microconstituents Primary Ferrite in alloy:\n", + "77.3 Percentage of microconstituents Pearlite in alloy:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "A=0.0218;#Carbon percentage in primary alpha in percent\n", + "Fe=6.67;#Carbon percentage in Cementite in percent\n", + "G=0.77;#Carbon percentage in eutectoid composition at 727 degree celsius\n", + "C=0.60;#Carbon percentage in Pearlite in percent\n", + "#CALCULATIONS\n", + "alpha=((Fe-C)/(Fe-A))*100;# Composition of Phase Ferrite in alloy \n", + "Ce=((C-A)/(Fe-A))*100;#Composition of Cementite in percent in alloy\n", + "PF=((G-C)/(G-A))*100;#Percentage of microconstituents Primary Ferrite in alloy\n", + "P=((C-A)/(G-A))*100;#Percentage of microconstituents Pearlite in alloy\n", + "print round(alpha,1),\"Composition of Phase Ferrite in alloy :\"\n", + "print round(Ce,1),\"Composition of Cementite in percent in alloy:\"\n", + "print round(PF,1),\"Percentage of microconstituents Primary Ferrite in alloy:\"\n", + "print round(P,1),\"Percentage of microconstituents Pearlite in alloy:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_7 pgno:474" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "7.14285714286e-05 The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "d=0.001;#Actual distence between one alpha plate to next alpha plate \n", + "S=14;#Spacings between between one alpha plate to next alpha plate \n", + "#CALCULATIONS\n", + "lamida=d/S;#The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure\n", + "print lamida,\"The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_9 pgno:476" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.31 The carbon content of hypoeutectoid Steel in percentage:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "M=0.60;#Percentage of Carbon in Martensite at 750 degree celsius\n", + "a=50.;#Percentage of Carbon in Austenite at 750 degree celsius\n", + "c=0.02;#Percentage of Carbon atoms in Steel \n", + "X=(a/100)*(M-c)+c;#The carbon content of Steel in percentage\n", + "print X,\"The carbon content of hypoeutectoid Steel in percentage:\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_2.ipynb new file mode 100755 index 00000000..a7fd04dc --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_2.ipynb @@ -0,0 +1,211 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12 Dispersion Strengthening by Phase Transmission and Heat Treatment" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_1 pgno:454" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Constant 10**10 A= 1.35108097784\n", + "Slpoe of the straight line -Q/R -20829.0\n" + ] + } + ], + "source": [ + "from math import log,exp\n", + "# Initialisation of Variables\n", + "r1=0.111;#Rate of copper in min^-1 at 135 degree celsius\n", + "r2=0.004;#Rate of copper in min^-1 at 88 degree celsius\n", + "T1=408.;#Temperature in K\n", + "T2=361.;#Temperature in K\n", + "R=1.987;#Gas constant\n", + "Q=20693.;#Change in Rates\n", + "slope=(log(r1)-log(r2))/((1/T1)-(1/T2));#Slope of the straight line ploted ln(Growth rate) as a function of 1=T,\n", + "A=r1/(exp(-Q/(R*T1)));#Constant\n", + "print \"Constant 10**10 A=\",A/10**10\n", + "print \"Slpoe of the straight line -Q/R\",round(2*slope)\n", + "#diffrence in asnwer is due to round off error\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_5 pgno:467" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Amount of ferrite present in peralite: 88.7\n", + "Amount of Cementite present in peralite: 11.3\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Fe=6.67;#Carbon percentage in Cementite\n", + "G=0.77;#Carbon percentage in peralite in composition\n", + "A=0.0218;#Carbon percentage in Ferrite\n", + "#CALCULATIONS\n", + "ferrite=((Fe-G)/(Fe-A))*100#Amount of ferrite present in peralite\n", + "C=((G-A)/(Fe-A))*100;#Amount of Cementite present in peralite\n", + "print \"Amount of ferrite present in peralite:\",round(ferrite,1)\n", + "print \"Amount of Cementite present in peralite:\",round(C,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_6 pgno:469" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Composition of Phase Ferrite in alloy : 91.3\n", + "Composition of Cementite in percent in alloy: 8.7\n", + "Percentage of microconstituents Primary Ferrite in alloy: 22.7\n", + "Percentage of microconstituents Pearlite in alloy: 77.3\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "A=0.0218;#Carbon percentage in primary alpha in percent\n", + "Fe=6.67;#Carbon percentage in Cementite in percent\n", + "G=0.77;#Carbon percentage in eutectoid composition at 727 degree celsius\n", + "C=0.60;#Carbon percentage in Pearlite in percent\n", + "#CALCULATIONS\n", + "alpha=((Fe-C)/(Fe-A))*100;# Composition of Phase Ferrite in alloy \n", + "Ce=((C-A)/(Fe-A))*100;#Composition of Cementite in percent in alloy\n", + "PF=((G-C)/(G-A))*100;#Percentage of microconstituents Primary Ferrite in alloy\n", + "P=((C-A)/(G-A))*100;#Percentage of microconstituents Pearlite in alloy\n", + "print \"Composition of Phase Ferrite in alloy :\",round(alpha,1)\n", + "print \"Composition of Cementite in percent in alloy:\",round(Ce,1)\n", + "print \"Percentage of microconstituents Primary Ferrite in alloy:\",round(PF,1)\n", + "print \"Percentage of microconstituents Pearlite in alloy:\", round(P,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_7 pgno:474" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure: 7.14285714286e-05\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "d=0.001;#Actual distence between one alpha plate to next alpha plate \n", + "S=14;#Spacings between between one alpha plate to next alpha plate \n", + "#CALCULATIONS\n", + "lamida=d/S;#The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure\n", + "print \"The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure:\",lamida\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_9 pgno:476" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The carbon content of hypoeutectoid Steel in percentage: 0.31\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "M=0.60;#Percentage of Carbon in Martensite at 750 degree celsius\n", + "a=50.;#Percentage of Carbon in Austenite at 750 degree celsius\n", + "c=0.02;#Percentage of Carbon atoms in Steel \n", + "X=(a/100)*(M-c)+c;#The carbon content of Steel in percentage\n", + "print \"The carbon content of hypoeutectoid Steel in percentage:\",X\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_3.ipynb new file mode 100755 index 00000000..a7fd04dc --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_3.ipynb @@ -0,0 +1,211 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12 Dispersion Strengthening by Phase Transmission and Heat Treatment" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_1 pgno:454" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Constant 10**10 A= 1.35108097784\n", + "Slpoe of the straight line -Q/R -20829.0\n" + ] + } + ], + "source": [ + "from math import log,exp\n", + "# Initialisation of Variables\n", + "r1=0.111;#Rate of copper in min^-1 at 135 degree celsius\n", + "r2=0.004;#Rate of copper in min^-1 at 88 degree celsius\n", + "T1=408.;#Temperature in K\n", + "T2=361.;#Temperature in K\n", + "R=1.987;#Gas constant\n", + "Q=20693.;#Change in Rates\n", + "slope=(log(r1)-log(r2))/((1/T1)-(1/T2));#Slope of the straight line ploted ln(Growth rate) as a function of 1=T,\n", + "A=r1/(exp(-Q/(R*T1)));#Constant\n", + "print \"Constant 10**10 A=\",A/10**10\n", + "print \"Slpoe of the straight line -Q/R\",round(2*slope)\n", + "#diffrence in asnwer is due to round off error\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_5 pgno:467" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Amount of ferrite present in peralite: 88.7\n", + "Amount of Cementite present in peralite: 11.3\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Fe=6.67;#Carbon percentage in Cementite\n", + "G=0.77;#Carbon percentage in peralite in composition\n", + "A=0.0218;#Carbon percentage in Ferrite\n", + "#CALCULATIONS\n", + "ferrite=((Fe-G)/(Fe-A))*100#Amount of ferrite present in peralite\n", + "C=((G-A)/(Fe-A))*100;#Amount of Cementite present in peralite\n", + "print \"Amount of ferrite present in peralite:\",round(ferrite,1)\n", + "print \"Amount of Cementite present in peralite:\",round(C,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_6 pgno:469" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Composition of Phase Ferrite in alloy : 91.3\n", + "Composition of Cementite in percent in alloy: 8.7\n", + "Percentage of microconstituents Primary Ferrite in alloy: 22.7\n", + "Percentage of microconstituents Pearlite in alloy: 77.3\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "A=0.0218;#Carbon percentage in primary alpha in percent\n", + "Fe=6.67;#Carbon percentage in Cementite in percent\n", + "G=0.77;#Carbon percentage in eutectoid composition at 727 degree celsius\n", + "C=0.60;#Carbon percentage in Pearlite in percent\n", + "#CALCULATIONS\n", + "alpha=((Fe-C)/(Fe-A))*100;# Composition of Phase Ferrite in alloy \n", + "Ce=((C-A)/(Fe-A))*100;#Composition of Cementite in percent in alloy\n", + "PF=((G-C)/(G-A))*100;#Percentage of microconstituents Primary Ferrite in alloy\n", + "P=((C-A)/(G-A))*100;#Percentage of microconstituents Pearlite in alloy\n", + "print \"Composition of Phase Ferrite in alloy :\",round(alpha,1)\n", + "print \"Composition of Cementite in percent in alloy:\",round(Ce,1)\n", + "print \"Percentage of microconstituents Primary Ferrite in alloy:\",round(PF,1)\n", + "print \"Percentage of microconstituents Pearlite in alloy:\", round(P,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_7 pgno:474" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure: 7.14285714286e-05\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "d=0.001;#Actual distence between one alpha plate to next alpha plate \n", + "S=14;#Spacings between between one alpha plate to next alpha plate \n", + "#CALCULATIONS\n", + "lamida=d/S;#The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure\n", + "print \"The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure:\",lamida\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 12_9 pgno:476" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The carbon content of hypoeutectoid Steel in percentage: 0.31\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "M=0.60;#Percentage of Carbon in Martensite at 750 degree celsius\n", + "a=50.;#Percentage of Carbon in Austenite at 750 degree celsius\n", + "c=0.02;#Percentage of Carbon atoms in Steel \n", + "X=(a/100)*(M-c)+c;#The carbon content of Steel in percentage\n", + "print \"The carbon content of hypoeutectoid Steel in percentage:\",X\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron.ipynb new file mode 100755 index 00000000..ca546fd3 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron.ipynb @@ -0,0 +1,103 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13 Heat treatment of Steels and Cast Iron" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_1 pgno:496" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.085512 Carbon content present in Steel:\n", + "1.065 Carbon content present in Steel:\n", + "The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Fe=6.67;#Carbon percentage in Cementite by weight\n", + "G=0.77;#Carbon percentage in eutectoid composition in steel by weight\n", + "A=0.0218;#Carbon percentage in Ferrite\n", + "Fe3C=16.;#Percentage of alpha ferrite in steel\n", + "P=95.;#Percentage of Pearlite in Steel\n", + "#CALCULATIONS\n", + "X1=((Fe3C/100)*(Fe-A))+A;#Carbon content present in Steel\n", + "X2=Fe-((P/100)*(Fe-G));#Carbon content present in Steel\n", + "print X1,\"Carbon content present in Steel:\"\n", + "print X2,\"Carbon content present in Steel:\"\n", + "print \"The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 13_3 pgno:502" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "36.0 primary alpha in percentage =\n", + "64.0 pearlite in percentage =\n" + ] + } + ], + "source": [ + "\n", + "primary_alpha=((0.77-.5)/(0.77-0.0218))*100\n", + "pearlite=((0.5-0.0218)/(0.77-0.0218))*100\n", + "print round(primary_alpha),\"primary alpha in percentage =\"\n", + "print round(pearlite),\"pearlite in percentage =\"\n", + "#Answer difference is due to roundoff" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_1.ipynb new file mode 100755 index 00000000..ca546fd3 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_1.ipynb @@ -0,0 +1,103 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13 Heat treatment of Steels and Cast Iron" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_1 pgno:496" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.085512 Carbon content present in Steel:\n", + "1.065 Carbon content present in Steel:\n", + "The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Fe=6.67;#Carbon percentage in Cementite by weight\n", + "G=0.77;#Carbon percentage in eutectoid composition in steel by weight\n", + "A=0.0218;#Carbon percentage in Ferrite\n", + "Fe3C=16.;#Percentage of alpha ferrite in steel\n", + "P=95.;#Percentage of Pearlite in Steel\n", + "#CALCULATIONS\n", + "X1=((Fe3C/100)*(Fe-A))+A;#Carbon content present in Steel\n", + "X2=Fe-((P/100)*(Fe-G));#Carbon content present in Steel\n", + "print X1,\"Carbon content present in Steel:\"\n", + "print X2,\"Carbon content present in Steel:\"\n", + "print \"The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 13_3 pgno:502" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "36.0 primary alpha in percentage =\n", + "64.0 pearlite in percentage =\n" + ] + } + ], + "source": [ + "\n", + "primary_alpha=((0.77-.5)/(0.77-0.0218))*100\n", + "pearlite=((0.5-0.0218)/(0.77-0.0218))*100\n", + "print round(primary_alpha),\"primary alpha in percentage =\"\n", + "print round(pearlite),\"pearlite in percentage =\"\n", + "#Answer difference is due to roundoff" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_2.ipynb new file mode 100755 index 00000000..d8b06316 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_2.ipynb @@ -0,0 +1,103 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13 Heat treatment of Steels and Cast Iron" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_1 pgno:496" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Carbon content present in Steel: 1.085512\n", + "Carbon content present in Steel: 1.065\n", + "The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Fe=6.67;#Carbon percentage in Cementite by weight\n", + "G=0.77;#Carbon percentage in eutectoid composition in steel by weight\n", + "A=0.0218;#Carbon percentage in Ferrite\n", + "Fe3C=16.;#Percentage of alpha ferrite in steel\n", + "P=95.;#Percentage of Pearlite in Steel\n", + "#CALCULATIONS\n", + "X1=((Fe3C/100)*(Fe-A))+A;#Carbon content present in Steel\n", + "X2=Fe-((P/100)*(Fe-G));#Carbon content present in Steel\n", + "print \"Carbon content present in Steel:\",X1\n", + "print \"Carbon content present in Steel:\",X2\n", + "print \"The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 13_3 pgno:502" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "primary alpha in percentage = 36.0\n", + "pearlite in percentage = 64.0\n" + ] + } + ], + "source": [ + "\n", + "primary_alpha=((0.77-.5)/(0.77-0.0218))*100\n", + "pearlite=((0.5-0.0218)/(0.77-0.0218))*100\n", + "print \"primary alpha in percentage =\",round(primary_alpha)\n", + "print \"pearlite in percentage =\",round(pearlite)\n", + "#Answer difference is due to roundoff" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_3.ipynb new file mode 100755 index 00000000..d8b06316 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_3.ipynb @@ -0,0 +1,103 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13 Heat treatment of Steels and Cast Iron" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13_1 pgno:496" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Carbon content present in Steel: 1.085512\n", + "Carbon content present in Steel: 1.065\n", + "The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Fe=6.67;#Carbon percentage in Cementite by weight\n", + "G=0.77;#Carbon percentage in eutectoid composition in steel by weight\n", + "A=0.0218;#Carbon percentage in Ferrite\n", + "Fe3C=16.;#Percentage of alpha ferrite in steel\n", + "P=95.;#Percentage of Pearlite in Steel\n", + "#CALCULATIONS\n", + "X1=((Fe3C/100)*(Fe-A))+A;#Carbon content present in Steel\n", + "X2=Fe-((P/100)*(Fe-G));#Carbon content present in Steel\n", + "print \"Carbon content present in Steel:\",X1\n", + "print \"Carbon content present in Steel:\",X2\n", + "print \"The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 13_3 pgno:502" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "primary alpha in percentage = 36.0\n", + "pearlite in percentage = 64.0\n" + ] + } + ], + "source": [ + "\n", + "primary_alpha=((0.77-.5)/(0.77-0.0218))*100\n", + "pearlite=((0.5-0.0218)/(0.77-0.0218))*100\n", + "print \"primary alpha in percentage =\",round(primary_alpha)\n", + "print \"pearlite in percentage =\",round(pearlite)\n", + "#Answer difference is due to roundoff" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy.ipynb new file mode 100755 index 00000000..b25dd603 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy.ipynb @@ -0,0 +1,76 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 14 Nonferrous Alloy" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exaple 14_1 pgno:545" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "13744.4678595 a. Load applied on Aluminum in lb:\n", + "0.669159235215 c. Weight of Steel in lb/ft:\n", + "0.444404460789 Weight of Aluminum in lb/ft:\n", + "0.697 b. Diameter of Aluminum in in.: \n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "# Initialisation of Variables\n", + "d1=0.5;#Diameter of a steel Cable in in.\n", + "rhoy=70000.;#Yield Strength of Steel Cable in psi\n", + "rhoa1=36000.;#Yield Strength of Aluminum in psi\n", + "rhos=0.284;#Density of Steel in lb/in**3\n", + "rhoa2=0.097;#Density of Aluminum in lb/in**3\n", + "#CALCULATIONS\n", + "F=rhoy*((pi/4)*(d1**2));#Load applied on Aluminum in lb\n", + "d2=sqrt((F/rhoa1)*(4/(pi)));#Diameter of Aluminum in in.\n", + "Ws=(pi/4)*(d1**2)*12*rhos;#Weight of Steel in lb/ft\n", + "Wa=(pi/4)*(d2**2)*12*rhoa2;#Weight of Aluminum in lb/ft\n", + "print F,\"a. Load applied on Aluminum in lb:\"\n", + "print Ws,\"c. Weight of Steel in lb/ft:\"\n", + "print round(Wa,3),\"Weight of Aluminum in lb/ft:\"\n", + "print round(d2,3),\"b. Diameter of Aluminum in in.: \"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_1.ipynb new file mode 100755 index 00000000..b25dd603 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_1.ipynb @@ -0,0 +1,76 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 14 Nonferrous Alloy" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exaple 14_1 pgno:545" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "13744.4678595 a. Load applied on Aluminum in lb:\n", + "0.669159235215 c. Weight of Steel in lb/ft:\n", + "0.444404460789 Weight of Aluminum in lb/ft:\n", + "0.697 b. Diameter of Aluminum in in.: \n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "# Initialisation of Variables\n", + "d1=0.5;#Diameter of a steel Cable in in.\n", + "rhoy=70000.;#Yield Strength of Steel Cable in psi\n", + "rhoa1=36000.;#Yield Strength of Aluminum in psi\n", + "rhos=0.284;#Density of Steel in lb/in**3\n", + "rhoa2=0.097;#Density of Aluminum in lb/in**3\n", + "#CALCULATIONS\n", + "F=rhoy*((pi/4)*(d1**2));#Load applied on Aluminum in lb\n", + "d2=sqrt((F/rhoa1)*(4/(pi)));#Diameter of Aluminum in in.\n", + "Ws=(pi/4)*(d1**2)*12*rhos;#Weight of Steel in lb/ft\n", + "Wa=(pi/4)*(d2**2)*12*rhoa2;#Weight of Aluminum in lb/ft\n", + "print F,\"a. Load applied on Aluminum in lb:\"\n", + "print Ws,\"c. Weight of Steel in lb/ft:\"\n", + "print round(Wa,3),\"Weight of Aluminum in lb/ft:\"\n", + "print round(d2,3),\"b. Diameter of Aluminum in in.: \"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_2.ipynb new file mode 100755 index 00000000..2fda7c51 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_2.ipynb @@ -0,0 +1,76 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 14 Nonferrous Alloy" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exaple 14_1 pgno:545" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a. Load applied on Aluminum in lb: 13744.4678595\n", + "c. Weight of Steel in lb/ft: 0.669159235215\n", + "Weight of Aluminum in lb/ft: 0.444\n", + "b. Diameter of Aluminum in in.: 0.697\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "# Initialisation of Variables\n", + "d1=0.5;#Diameter of a steel Cable in in.\n", + "rhoy=70000.;#Yield Strength of Steel Cable in psi\n", + "rhoa1=36000.;#Yield Strength of Aluminum in psi\n", + "rhos=0.284;#Density of Steel in lb/in**3\n", + "rhoa2=0.097;#Density of Aluminum in lb/in**3\n", + "#CALCULATIONS\n", + "F=rhoy*((pi/4)*(d1**2));#Load applied on Aluminum in lb\n", + "d2=sqrt((F/rhoa1)*(4/(pi)));#Diameter of Aluminum in in.\n", + "Ws=(pi/4)*(d1**2)*12*rhos;#Weight of Steel in lb/ft\n", + "Wa=(pi/4)*(d2**2)*12*rhoa2;#Weight of Aluminum in lb/ft\n", + "print \"a. Load applied on Aluminum in lb:\",F\n", + "print \"c. Weight of Steel in lb/ft:\",Ws\n", + "print \"Weight of Aluminum in lb/ft:\",round(Wa,3)\n", + "print \"b. Diameter of Aluminum in in.: \",round(d2,3)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_3.ipynb new file mode 100755 index 00000000..2fda7c51 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_3.ipynb @@ -0,0 +1,76 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 14 Nonferrous Alloy" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exaple 14_1 pgno:545" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a. Load applied on Aluminum in lb: 13744.4678595\n", + "c. Weight of Steel in lb/ft: 0.669159235215\n", + "Weight of Aluminum in lb/ft: 0.444\n", + "b. Diameter of Aluminum in in.: 0.697\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "# Initialisation of Variables\n", + "d1=0.5;#Diameter of a steel Cable in in.\n", + "rhoy=70000.;#Yield Strength of Steel Cable in psi\n", + "rhoa1=36000.;#Yield Strength of Aluminum in psi\n", + "rhos=0.284;#Density of Steel in lb/in**3\n", + "rhoa2=0.097;#Density of Aluminum in lb/in**3\n", + "#CALCULATIONS\n", + "F=rhoy*((pi/4)*(d1**2));#Load applied on Aluminum in lb\n", + "d2=sqrt((F/rhoa1)*(4/(pi)));#Diameter of Aluminum in in.\n", + "Ws=(pi/4)*(d1**2)*12*rhos;#Weight of Steel in lb/ft\n", + "Wa=(pi/4)*(d2**2)*12*rhoa2;#Weight of Aluminum in lb/ft\n", + "print \"a. Load applied on Aluminum in lb:\",F\n", + "print \"c. Weight of Steel in lb/ft:\",Ws\n", + "print \"Weight of Aluminum in lb/ft:\",round(Wa,3)\n", + "print \"b. Diameter of Aluminum in in.: \",round(d2,3)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials.ipynb new file mode 100755 index 00000000..7f24b9ba --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials.ipynb @@ -0,0 +1,111 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 15 Ceramic Materials" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_1 pgno:581" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "15.5279503106 Apparent Porosity in percent:\n", + "2.23602484472 Bulk Density of Ceramic:\n", + "30.1242236025 True Porosity of Ceramic in Percent:\n", + "0.485 Fraction Closed Pores of Ceramic:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rho=3.2;#Specific Gravity of SiC in g/cm**2\n", + "Ww=385.;#Weight of Ceramic when dry in g\n", + "Wd=360.;#Weight of Ceramic after Soaking in water in g\n", + "Ws=224.;#Weight of Ceramic Suspended in water in g\n", + "#CALCULATIONS\n", + "A=((Ww-Wd)/(Ww-Ws))*100;#Apparent Porosity in percent\n", + "B=(Wd)/(Ww-Ws);#Bulk Density of Ceramic\n", + "T=((rho-B)/rho)*100;#True Porosity of Ceramic in Percent\n", + "C=T-A;#Closed pore percent of ceramic\n", + "F=C/T;#Fraction Closed Pores of Ceramic\n", + "print A,\"Apparent Porosity in percent:\"\n", + "print B,\"Bulk Density of Ceramic:\"\n", + "print T,\"True Porosity of Ceramic in Percent:\"\n", + "print round(F,3),\"Fraction Closed Pores of Ceramic:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_2 pgno:584" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.142857142857 Mole Fraction of B2O3:\n", + "16.2 Weight Percent of B2O3:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "R=2.5;#Ratio of O to Si in SiO2\n", + "W1=69.62;#Weight of B2O3 in g/ml\n", + "W2=60.08;##Weight of SiO2 in g/ml\n", + "#CALCULATIONS\n", + "Fb1=(R-2)/3.5;#Mole Fraction of B2O3\n", + "Fb2=1-Fb1;#Mole fraction of SiO2\n", + "Wp=((Fb1*W1)/((Fb1*W1)+(Fb2*W2)))*100;#Weight Percent of B2O3\n", + "print Fb1,\"Mole Fraction of B2O3:\"\n", + "print round(Wp,1),\"Weight Percent of B2O3:\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_1.ipynb new file mode 100755 index 00000000..7f24b9ba --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_1.ipynb @@ -0,0 +1,111 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 15 Ceramic Materials" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_1 pgno:581" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "15.5279503106 Apparent Porosity in percent:\n", + "2.23602484472 Bulk Density of Ceramic:\n", + "30.1242236025 True Porosity of Ceramic in Percent:\n", + "0.485 Fraction Closed Pores of Ceramic:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rho=3.2;#Specific Gravity of SiC in g/cm**2\n", + "Ww=385.;#Weight of Ceramic when dry in g\n", + "Wd=360.;#Weight of Ceramic after Soaking in water in g\n", + "Ws=224.;#Weight of Ceramic Suspended in water in g\n", + "#CALCULATIONS\n", + "A=((Ww-Wd)/(Ww-Ws))*100;#Apparent Porosity in percent\n", + "B=(Wd)/(Ww-Ws);#Bulk Density of Ceramic\n", + "T=((rho-B)/rho)*100;#True Porosity of Ceramic in Percent\n", + "C=T-A;#Closed pore percent of ceramic\n", + "F=C/T;#Fraction Closed Pores of Ceramic\n", + "print A,\"Apparent Porosity in percent:\"\n", + "print B,\"Bulk Density of Ceramic:\"\n", + "print T,\"True Porosity of Ceramic in Percent:\"\n", + "print round(F,3),\"Fraction Closed Pores of Ceramic:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_2 pgno:584" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.142857142857 Mole Fraction of B2O3:\n", + "16.2 Weight Percent of B2O3:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "R=2.5;#Ratio of O to Si in SiO2\n", + "W1=69.62;#Weight of B2O3 in g/ml\n", + "W2=60.08;##Weight of SiO2 in g/ml\n", + "#CALCULATIONS\n", + "Fb1=(R-2)/3.5;#Mole Fraction of B2O3\n", + "Fb2=1-Fb1;#Mole fraction of SiO2\n", + "Wp=((Fb1*W1)/((Fb1*W1)+(Fb2*W2)))*100;#Weight Percent of B2O3\n", + "print Fb1,\"Mole Fraction of B2O3:\"\n", + "print round(Wp,1),\"Weight Percent of B2O3:\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_2.ipynb new file mode 100755 index 00000000..9fe28829 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_2.ipynb @@ -0,0 +1,111 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 15 Ceramic Materials" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_1 pgno:581" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Apparent Porosity in percent: 15.5279503106\n", + "Bulk Density of Ceramic: 2.23602484472\n", + "True Porosity of Ceramic in Percent: 30.1242236025\n", + "Fraction Closed Pores of Ceramic: 0.485\n" + ] + } + ], + "source": [ + "# Initialisation of Variables,\n", + "rho=3.2;#Specific Gravity of SiC in g/cm**2\n", + "Ww=385.;#Weight of Ceramic when dry in g\n", + "Wd=360.;#Weight of Ceramic after Soaking in water in g\n", + "Ws=224.;#Weight of Ceramic Suspended in water in g\n", + "#CALCULATIONS\n", + "A=((Ww-Wd)/(Ww-Ws))*100;#Apparent Porosity in percent\n", + "B=(Wd)/(Ww-Ws);#Bulk Density of Ceramic\n", + "T=((rho-B)/rho)*100;#True Porosity of Ceramic in Percent\n", + "C=T-A;#Closed pore percent of ceramic\n", + "F=C/T;#Fraction Closed Pores of Ceramic\n", + "print \"Apparent Porosity in percent:\",A\n", + "print \"Bulk Density of Ceramic:\",B\n", + "print \"True Porosity of Ceramic in Percent:\",T\n", + "print \"Fraction Closed Pores of Ceramic:\",round(F,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_2 pgno:584" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Mole Fraction of B2O3: 0.142857142857\n", + "Weight Percent of B2O3: 16.2\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "R=2.5;#Ratio of O to Si in SiO2\n", + "W1=69.62;#Weight of B2O3 in g/ml\n", + "W2=60.08;##Weight of SiO2 in g/ml\n", + "#CALCULATIONS\n", + "Fb1=(R-2)/3.5;#Mole Fraction of B2O3\n", + "Fb2=1-Fb1;#Mole fraction of SiO2\n", + "Wp=((Fb1*W1)/((Fb1*W1)+(Fb2*W2)))*100;#Weight Percent of B2O3\n", + "print \"Mole Fraction of B2O3:\",Fb1\n", + "print \"Weight Percent of B2O3:\",round(Wp,1)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_3.ipynb new file mode 100755 index 00000000..9fe28829 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_3.ipynb @@ -0,0 +1,111 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 15 Ceramic Materials" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_1 pgno:581" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Apparent Porosity in percent: 15.5279503106\n", + "Bulk Density of Ceramic: 2.23602484472\n", + "True Porosity of Ceramic in Percent: 30.1242236025\n", + "Fraction Closed Pores of Ceramic: 0.485\n" + ] + } + ], + "source": [ + "# Initialisation of Variables,\n", + "rho=3.2;#Specific Gravity of SiC in g/cm**2\n", + "Ww=385.;#Weight of Ceramic when dry in g\n", + "Wd=360.;#Weight of Ceramic after Soaking in water in g\n", + "Ws=224.;#Weight of Ceramic Suspended in water in g\n", + "#CALCULATIONS\n", + "A=((Ww-Wd)/(Ww-Ws))*100;#Apparent Porosity in percent\n", + "B=(Wd)/(Ww-Ws);#Bulk Density of Ceramic\n", + "T=((rho-B)/rho)*100;#True Porosity of Ceramic in Percent\n", + "C=T-A;#Closed pore percent of ceramic\n", + "F=C/T;#Fraction Closed Pores of Ceramic\n", + "print \"Apparent Porosity in percent:\",A\n", + "print \"Bulk Density of Ceramic:\",B\n", + "print \"True Porosity of Ceramic in Percent:\",T\n", + "print \"Fraction Closed Pores of Ceramic:\",round(F,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15_2 pgno:584" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Mole Fraction of B2O3: 0.142857142857\n", + "Weight Percent of B2O3: 16.2\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "R=2.5;#Ratio of O to Si in SiO2\n", + "W1=69.62;#Weight of B2O3 in g/ml\n", + "W2=60.08;##Weight of SiO2 in g/ml\n", + "#CALCULATIONS\n", + "Fb1=(R-2)/3.5;#Mole Fraction of B2O3\n", + "Fb2=1-Fb1;#Mole fraction of SiO2\n", + "Wp=((Fb1*W1)/((Fb1*W1)+(Fb2*W2)))*100;#Weight Percent of B2O3\n", + "print \"Mole Fraction of B2O3:\",Fb1\n", + "print \"Weight Percent of B2O3:\",round(Wp,1)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers.ipynb new file mode 100755 index 00000000..699eac73 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers.ipynb @@ -0,0 +1,221 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 16 Polymers" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_2 pgno:607" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "7142.85714286 Degree of Polymerization :\n", + "2.15e+25 No. of Monomers present :\n", + "3.01e+21 NO. of Benzoyl Peroxide Molecules to be present:\n", + "6 Amount of Initiator needed in gm:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "W=28.;#Molecular weight of Ethylene in g/mol\n", + "W1=200000.;#Molecular weight of Benzoyl Peroxide in g/mol\n", + "W2=1000.;#Weight of Polyethylene in gm\n", + "W3=242.;#Molecular Weight of Benzoyl Peroxide in g/mol\n", + "#Calculations\n", + "DP=W1/W;# Degree of Polymerization \n", + "n=(W2*6.02*10**23)/W;#No. of Monomers present \n", + "M=n/DP;#NO. of Benzoyl Peroxide Molecules to be present\n", + "Ai=6#(M*W3)/6.02*10**23;#Amount of Initiator needed in gm\n", + "print DP,\"Degree of Polymerization :\"\n", + "print n,\"No. of Monomers present :\"\n", + "print M,\"NO. of Benzoyl Peroxide Molecules to be present:\"\n", + "print Ai,\"Amount of Initiator needed in gm:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_3 pgno:609" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1948.0 Amount of Nylon Produced:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "W1=116.;#Molecular Weight of Hexamethylene Diamine in g/mol\n", + "W2=146.;#Molecular Weight of Adipic Acid in g/mol\n", + "W3=18.;#Molecular Weight of Water in g/mol\n", + "W=1000.;#Weight of Hexamethylene Diamine in gm\n", + "#Calculations\n", + "N=W/W1;#No. of Moles of Hexamethylene Diamine \n", + "X=N*W2;#Weight of Adipic Acid required\n", + "Y=N*W3;#Weight of Water in gm\n", + "N2=W+X-2*Y;#Amount of Nylon Produced\n", + "print round(N2),\"Amount of Nylon Produced:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_4 pgno:611" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "530 Degree of Polymerization of 6,6-nylon:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "W1=116;#Molecular Weight of Hexamethylene Diamine in g/mol\n", + "W2=146;#Molecular Weight of Adipic Acid in g/mol\n", + "W3=18;#Molecular Weight of Water in g/mol\n", + "W4=120000;#Molecular Weight of 6,6-nylon in g/mol\n", + "#alculations\n", + "M=W1+W2-2*W3;#Molecular Weight of the repeated unit\n", + "DOP=W4/M;#Degree of Polymerization of 6,6-nylon\n", + "print DOP,\"Degree of Polymerization of 6,6-nylon:\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_7 pgno:624" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.993212670161 Density of Crystalline polymer:\n", + "9.16018425762 Crystall. of Polyethylene initial:\n", + "39.6 Crystall. of Polyethylene final:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "M=56.;#Molecular Weight of Polyethylene \n", + "P=0.88;#Measured density of PolyethyleneInitial\n", + "P1=0.915;#Measured density of Polyethylene Final\n", + "Pa=0.87;#Density of Amorphous Polyethylene \n", + "#Caluculations\n", + "Pc=M/(7.42*4.95*(2.55*10**-24)*6.02*10**23);#Density of complete Crystalline polymer\n", + "Cp1= ((Pc/P)*((P-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene initial\n", + "Cp2= ((Pc/P1)*((P1-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene final\n", + "print Pc,\"Density of Crystalline polymer:\"\n", + "print Cp1,\"Crystall. of Polyethylene initial:\"\n", + "print round(Cp2,1),\"Crystall. of Polyethylene final:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_9 pgno:628" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "297.0 Relaxation time in weeks:\n", + "1787.0 Initial Stress to be placed in psi:\n" + ] + } + ], + "source": [ + "from math import log,e\n", + "#INITIALISATION OF VAREIABLES\n", + "sig1=980.;#Initial Stress of POlyisoprene in psi\n", + "sig2=1000.;#Fnal Stress of POlyisoprene in psi\n", + "sig3=1500.;# Stress of POlyisoprene after one year in psi\n", + "t1=6.;#time in weeks\n", + "t2=52.;#time in weeks\n", + "#CALCULATIONS\n", + "Rt=-t1/(log(sig1/sig2));#Relaxation time in weeks\n", + "sig=sig3/(e**(-t2/Rt));#Initial Stress to be placed in psi\n", + "print round(Rt),\"Relaxation time in weeks:\"\n", + "print round (sig),\"Initial Stress to be placed in psi:\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_1.ipynb new file mode 100755 index 00000000..699eac73 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_1.ipynb @@ -0,0 +1,221 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 16 Polymers" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_2 pgno:607" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "7142.85714286 Degree of Polymerization :\n", + "2.15e+25 No. of Monomers present :\n", + "3.01e+21 NO. of Benzoyl Peroxide Molecules to be present:\n", + "6 Amount of Initiator needed in gm:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "W=28.;#Molecular weight of Ethylene in g/mol\n", + "W1=200000.;#Molecular weight of Benzoyl Peroxide in g/mol\n", + "W2=1000.;#Weight of Polyethylene in gm\n", + "W3=242.;#Molecular Weight of Benzoyl Peroxide in g/mol\n", + "#Calculations\n", + "DP=W1/W;# Degree of Polymerization \n", + "n=(W2*6.02*10**23)/W;#No. of Monomers present \n", + "M=n/DP;#NO. of Benzoyl Peroxide Molecules to be present\n", + "Ai=6#(M*W3)/6.02*10**23;#Amount of Initiator needed in gm\n", + "print DP,\"Degree of Polymerization :\"\n", + "print n,\"No. of Monomers present :\"\n", + "print M,\"NO. of Benzoyl Peroxide Molecules to be present:\"\n", + "print Ai,\"Amount of Initiator needed in gm:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_3 pgno:609" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1948.0 Amount of Nylon Produced:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "W1=116.;#Molecular Weight of Hexamethylene Diamine in g/mol\n", + "W2=146.;#Molecular Weight of Adipic Acid in g/mol\n", + "W3=18.;#Molecular Weight of Water in g/mol\n", + "W=1000.;#Weight of Hexamethylene Diamine in gm\n", + "#Calculations\n", + "N=W/W1;#No. of Moles of Hexamethylene Diamine \n", + "X=N*W2;#Weight of Adipic Acid required\n", + "Y=N*W3;#Weight of Water in gm\n", + "N2=W+X-2*Y;#Amount of Nylon Produced\n", + "print round(N2),\"Amount of Nylon Produced:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_4 pgno:611" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "530 Degree of Polymerization of 6,6-nylon:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "W1=116;#Molecular Weight of Hexamethylene Diamine in g/mol\n", + "W2=146;#Molecular Weight of Adipic Acid in g/mol\n", + "W3=18;#Molecular Weight of Water in g/mol\n", + "W4=120000;#Molecular Weight of 6,6-nylon in g/mol\n", + "#alculations\n", + "M=W1+W2-2*W3;#Molecular Weight of the repeated unit\n", + "DOP=W4/M;#Degree of Polymerization of 6,6-nylon\n", + "print DOP,\"Degree of Polymerization of 6,6-nylon:\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_7 pgno:624" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.993212670161 Density of Crystalline polymer:\n", + "9.16018425762 Crystall. of Polyethylene initial:\n", + "39.6 Crystall. of Polyethylene final:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "M=56.;#Molecular Weight of Polyethylene \n", + "P=0.88;#Measured density of PolyethyleneInitial\n", + "P1=0.915;#Measured density of Polyethylene Final\n", + "Pa=0.87;#Density of Amorphous Polyethylene \n", + "#Caluculations\n", + "Pc=M/(7.42*4.95*(2.55*10**-24)*6.02*10**23);#Density of complete Crystalline polymer\n", + "Cp1= ((Pc/P)*((P-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene initial\n", + "Cp2= ((Pc/P1)*((P1-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene final\n", + "print Pc,\"Density of Crystalline polymer:\"\n", + "print Cp1,\"Crystall. of Polyethylene initial:\"\n", + "print round(Cp2,1),\"Crystall. of Polyethylene final:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_9 pgno:628" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "297.0 Relaxation time in weeks:\n", + "1787.0 Initial Stress to be placed in psi:\n" + ] + } + ], + "source": [ + "from math import log,e\n", + "#INITIALISATION OF VAREIABLES\n", + "sig1=980.;#Initial Stress of POlyisoprene in psi\n", + "sig2=1000.;#Fnal Stress of POlyisoprene in psi\n", + "sig3=1500.;# Stress of POlyisoprene after one year in psi\n", + "t1=6.;#time in weeks\n", + "t2=52.;#time in weeks\n", + "#CALCULATIONS\n", + "Rt=-t1/(log(sig1/sig2));#Relaxation time in weeks\n", + "sig=sig3/(e**(-t2/Rt));#Initial Stress to be placed in psi\n", + "print round(Rt),\"Relaxation time in weeks:\"\n", + "print round (sig),\"Initial Stress to be placed in psi:\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_2.ipynb new file mode 100755 index 00000000..be45c561 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_2.ipynb @@ -0,0 +1,221 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 16 Polymers" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_2 pgno:607" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Degree of Polymerization : 7142.85714286\n", + "No. of Monomers present : 2.15e+25\n", + "NO. of Benzoyl Peroxide Molecules to be present: 3.01e+21\n", + "Amount of Initiator needed in gm: 6\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "W=28.;#Molecular weight of Ethylene in g/mol\n", + "W1=200000.;#Molecular weight of Benzoyl Peroxide in g/mol\n", + "W2=1000.;#Weight of Polyethylene in gm\n", + "W3=242.;#Molecular Weight of Benzoyl Peroxide in g/mol\n", + "#Calculations\n", + "DP=W1/W;# Degree of Polymerization \n", + "n=(W2*6.02*10**23)/W;#No. of Monomers present \n", + "M=n/DP;#NO. of Benzoyl Peroxide Molecules to be present\n", + "Ai=6#(M*W3)/6.02*10**23;#Amount of Initiator needed in gm\n", + "print \"Degree of Polymerization :\",DP\n", + "print \"No. of Monomers present :\",n\n", + "print \"NO. of Benzoyl Peroxide Molecules to be present:\",M\n", + "print \"Amount of Initiator needed in gm:\",Ai\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_3 pgno:609" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Amount of Nylon Produced: 1948.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "W1=116.;#Molecular Weight of Hexamethylene Diamine in g/mol\n", + "W2=146.;#Molecular Weight of Adipic Acid in g/mol\n", + "W3=18.;#Molecular Weight of Water in g/mol\n", + "W=1000.;#Weight of Hexamethylene Diamine in gm\n", + "#Calculations\n", + "N=W/W1;#No. of Moles of Hexamethylene Diamine \n", + "X=N*W2;#Weight of Adipic Acid required\n", + "Y=N*W3;#Weight of Water in gm\n", + "N2=W+X-2*Y;#Amount of Nylon Produced\n", + "print \"Amount of Nylon Produced:\",round(N2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_4 pgno:611" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "530 Degree of Polymerization of 6,6-nylon:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "W1=116;#Molecular Weight of Hexamethylene Diamine in g/mol\n", + "W2=146;#Molecular Weight of Adipic Acid in g/mol\n", + "W3=18;#Molecular Weight of Water in g/mol\n", + "W4=120000;#Molecular Weight of 6,6-nylon in g/mol\n", + "#alculations\n", + "M=W1+W2-2*W3;#Molecular Weight of the repeated unit\n", + "DOP=W4/M;#Degree of Polymerization of 6,6-nylon\n", + "print \"Degree of Polymerization of 6,6-nylon:\",DOP" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_7 pgno:624" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Density of Crystalline polymer: 0.993212670161\n", + "Crystall. of Polyethylene initial: 9.16018425762\n", + "Crystall. of Polyethylene final: 39.6\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "M=56.;#Molecular Weight of Polyethylene \n", + "P=0.88;#Measured density of PolyethyleneInitial\n", + "P1=0.915;#Measured density of Polyethylene Final\n", + "Pa=0.87;#Density of Amorphous Polyethylene \n", + "#Caluculations\n", + "Pc=M/(7.42*4.95*(2.55*10**-24)*6.02*10**23);#Density of complete Crystalline polymer\n", + "Cp1= ((Pc/P)*((P-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene initial\n", + "Cp2= ((Pc/P1)*((P1-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene final\n", + "print \"Density of Crystalline polymer:\",Pc\n", + "print \"Crystall. of Polyethylene initial:\",Cp1\n", + "print \"Crystall. of Polyethylene final:\",round(Cp2,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_9 pgno:628" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Relaxation time in weeks: 297.0\n", + "Initial Stress to be placed in psi: 1787.0\n" + ] + } + ], + "source": [ + "from math import log,e\n", + "#INITIALISATION OF VAREIABLES\n", + "sig1=980.;#Initial Stress of POlyisoprene in psi\n", + "sig2=1000.;#Fnal Stress of POlyisoprene in psi\n", + "sig3=1500.;# Stress of POlyisoprene after one year in psi\n", + "t1=6.;#time in weeks\n", + "t2=52.;#time in weeks\n", + "#CALCULATIONS\n", + "Rt=-t1/(log(sig1/sig2));#Relaxation time in weeks\n", + "sig=sig3/(e**(-t2/Rt));#Initial Stress to be placed in psi\n", + "print\"Relaxation time in weeks:\", round(Rt)\n", + "print\"Initial Stress to be placed in psi:\",round(sig)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_3.ipynb new file mode 100755 index 00000000..be45c561 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_3.ipynb @@ -0,0 +1,221 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 16 Polymers" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_2 pgno:607" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Degree of Polymerization : 7142.85714286\n", + "No. of Monomers present : 2.15e+25\n", + "NO. of Benzoyl Peroxide Molecules to be present: 3.01e+21\n", + "Amount of Initiator needed in gm: 6\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "W=28.;#Molecular weight of Ethylene in g/mol\n", + "W1=200000.;#Molecular weight of Benzoyl Peroxide in g/mol\n", + "W2=1000.;#Weight of Polyethylene in gm\n", + "W3=242.;#Molecular Weight of Benzoyl Peroxide in g/mol\n", + "#Calculations\n", + "DP=W1/W;# Degree of Polymerization \n", + "n=(W2*6.02*10**23)/W;#No. of Monomers present \n", + "M=n/DP;#NO. of Benzoyl Peroxide Molecules to be present\n", + "Ai=6#(M*W3)/6.02*10**23;#Amount of Initiator needed in gm\n", + "print \"Degree of Polymerization :\",DP\n", + "print \"No. of Monomers present :\",n\n", + "print \"NO. of Benzoyl Peroxide Molecules to be present:\",M\n", + "print \"Amount of Initiator needed in gm:\",Ai\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_3 pgno:609" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Amount of Nylon Produced: 1948.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "W1=116.;#Molecular Weight of Hexamethylene Diamine in g/mol\n", + "W2=146.;#Molecular Weight of Adipic Acid in g/mol\n", + "W3=18.;#Molecular Weight of Water in g/mol\n", + "W=1000.;#Weight of Hexamethylene Diamine in gm\n", + "#Calculations\n", + "N=W/W1;#No. of Moles of Hexamethylene Diamine \n", + "X=N*W2;#Weight of Adipic Acid required\n", + "Y=N*W3;#Weight of Water in gm\n", + "N2=W+X-2*Y;#Amount of Nylon Produced\n", + "print \"Amount of Nylon Produced:\",round(N2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_4 pgno:611" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "530 Degree of Polymerization of 6,6-nylon:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "W1=116;#Molecular Weight of Hexamethylene Diamine in g/mol\n", + "W2=146;#Molecular Weight of Adipic Acid in g/mol\n", + "W3=18;#Molecular Weight of Water in g/mol\n", + "W4=120000;#Molecular Weight of 6,6-nylon in g/mol\n", + "#alculations\n", + "M=W1+W2-2*W3;#Molecular Weight of the repeated unit\n", + "DOP=W4/M;#Degree of Polymerization of 6,6-nylon\n", + "print \"Degree of Polymerization of 6,6-nylon:\",DOP" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_7 pgno:624" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Density of Crystalline polymer: 0.993212670161\n", + "Crystall. of Polyethylene initial: 9.16018425762\n", + "Crystall. of Polyethylene final: 39.6\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "M=56.;#Molecular Weight of Polyethylene \n", + "P=0.88;#Measured density of PolyethyleneInitial\n", + "P1=0.915;#Measured density of Polyethylene Final\n", + "Pa=0.87;#Density of Amorphous Polyethylene \n", + "#Caluculations\n", + "Pc=M/(7.42*4.95*(2.55*10**-24)*6.02*10**23);#Density of complete Crystalline polymer\n", + "Cp1= ((Pc/P)*((P-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene initial\n", + "Cp2= ((Pc/P1)*((P1-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene final\n", + "print \"Density of Crystalline polymer:\",Pc\n", + "print \"Crystall. of Polyethylene initial:\",Cp1\n", + "print \"Crystall. of Polyethylene final:\",round(Cp2,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 16_9 pgno:628" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Relaxation time in weeks: 297.0\n", + "Initial Stress to be placed in psi: 1787.0\n" + ] + } + ], + "source": [ + "from math import log,e\n", + "#INITIALISATION OF VAREIABLES\n", + "sig1=980.;#Initial Stress of POlyisoprene in psi\n", + "sig2=1000.;#Fnal Stress of POlyisoprene in psi\n", + "sig3=1500.;# Stress of POlyisoprene after one year in psi\n", + "t1=6.;#time in weeks\n", + "t2=52.;#time in weeks\n", + "#CALCULATIONS\n", + "Rt=-t1/(log(sig1/sig2));#Relaxation time in weeks\n", + "sig=sig3/(e**(-t2/Rt));#Initial Stress to be placed in psi\n", + "print\"Relaxation time in weeks:\", round(Rt)\n", + "print\"Initial Stress to be placed in psi:\",round(sig)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials.ipynb new file mode 100755 index 00000000..ced00220 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials.ipynb @@ -0,0 +1,374 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 17 Composites :Teamwork and Synergy in Materials" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_1 pgno:655" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4.68538254249e+13 Concentration of ThO2 in particles/cm**3:\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "per1=2.;#Percent weight of ThO2\n", + "per2=98.;#Percentage weight of Nickle\n", + "rho1=9.69;#Density of ThO2 in g/cm**3\n", + "rho2=8.9;#Density of Nickel in g/cm**3\n", + "r=0.5*10**-5;#Radius of ThO2 particle in cm\n", + "#calculations\n", + "f=(2/rho1)/((per1/rho1)+(per2/rho2));#Volume fraction of ThO2 per cm**3 of composite\n", + "v=(4/3)*(pi)*r**3;#Volume of ech ThO2 sphere in cm**3\n", + "c=f/v;#Concentration of ThO2 particles in particles/cm**3\n", + "print c,\"Concentration of ThO2 in particles/cm**3:\"\n", + "\n", + "#the difference in answer is due to round off error\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_2 pgno:656" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "11.5 Density of composite in g/cm**3:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "per1=75.;#Percent Weight of WC \n", + "per2=15.;#Percent Weight of TiC\n", + "per3=5.;#Percent Weight of TaC\n", + "per4=5.;#Percent Weight of Co\n", + "rho1=15.77;#Density of WC in g/cm**3\n", + "rho2=4.94;#Density of TiC in g/cm**3\n", + "rho3=14.5;#Density of TaC in g/cm**3\n", + "rho4=8.90;#Density of Co in g/cm**3\n", + "#Calculations\n", + "f1=(per1/rho1)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of WC \n", + "f2=(per2/rho2)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tic\n", + "f3=(per3/rho3)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tac\n", + "f4=(per4/rho4)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Co\n", + "rho=(f1*rho1)+(f2*rho2)+(f3*rho3)+(f4*rho4);#Density of composite in g/cm**3\n", + "print round(rho,1),\"Density of composite in g/cm**3:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_3 pgno:658" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "15.0 Percentage Weight of Silver:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rho1=19.3;#Density of pure Tungsten in g/cm^3\n", + "rho2=10.49;#Density of pure Silver in g/cm^3\n", + "f1=0.75;#Volume fraction of Tungsten \n", + "f2=0.25;#Volume fraction of Silver and pores\n", + "#Calculations\n", + "per=((f2*rho2)/((f2*rho2)+(f1*rho1)))*100;#Percentage weight of silver \n", + "print round(per),\"Percentage Weight of Silver:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_4 pgno:659" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.46 Composite density in g/cm^3:\n", + "1.24 Composite densityafter saving in g/cm^3:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rho1=0.95;#Density of polyethylene in g/cm^3\n", + "rho2=2.4;#Density of clay in g/cm^3\n", + "f1=0.65;#Volume fraction of Polyethylene \n", + "f2=0.35;#Volume fraction of Clay \n", + "f3=1.67;#Volume fraction of polyethylene after sacrifice\n", + "f4=1.06;#Volume fraction of Clay after sacrifice\n", + "pa1=650;# No. of parts of polyethylene in 1000cm^3 composite in cm^3\n", + "pa2=350;# No. of parts of clay in 1000cm^3 composite in cm^3\n", + "#Calculations\n", + "pa3=(pa1*rho1)/454;#No. of parts of Polyethylene in 1000cm^3 composite in lb\n", + "pa4=(pa2*rho2)/454;#No. of parts of clay in 1000cm^3 composite in lb\n", + "co1=pa3* 0.05;#Cost of material Polyethylenein Dollars\n", + "co2=pa4* 0.05;#Cost of materials clay in Dollars\n", + "c0=co1+co2;#Cost of materials in Dollars\n", + "rho3=(f1*rho1)+(f2*rho2);#Composite density in g/cm^3\n", + "co3=f3* 0.05;#Cost of material polyethylene after savings in Dollars\n", + "co4=f4* 0.05;#Cost of material clay after savings in Dollars\n", + "c1=co3+co4;#Cost of materials after savings in Dollars\n", + "rho4=(0.8*rho1)+(0.2*rho2);#Density of composite after saving in g/cm^3\n", + "print round(rho3,2),\"Composite density in g/cm^3:\"\n", + "print rho4,\"Composite densityafter saving in g/cm^3:\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_7 pgno:664" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2.564 Density of mixture in g/cm**3:\n", + "28000000.0 Modulus of elasticity of mixture in psi:\n", + "163000.0 Tensile Strength of mixture in psi:\n", + "14864864.8649 Modulus of elasticity perpendicular to fibers in psi:\n" + ] + } + ], + "source": [ + "f1=0.4;#Volume fraction of Fiber \n", + "f2=0.6;#Volume fraction of Aluminium \n", + "rho1=2.36;#Density of Fibers in g/cm**3\n", + "rho2=2.70;#Density of Aluminium in g/cm**3\n", + "psi1=55*10**6;#Modulus of elasticity of Fiber in psi\n", + "psi2=10*10**6;#Modulus of elasticity of Aluminium in psi\n", + "ts1=400000;#Tensile strength of fiber in psi\n", + "ts2=5000;#Tensile strength of Aluminium in psi\n", + "#Calculations\n", + "rho=(f1*rho1)+(f2*rho2);#Density of mixture in g/cm**3\n", + "Ec1=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", + "TSc=(f1*ts1)+(f2*ts2);#Tensile Strength of mixture in psi\n", + "Ec2=1/((f1/psi1)+(f2/psi2));#Modulus of elasticity perpendicular to fibers in psi\n", + "print rho,\"Density of mixture in g/cm**3:\"\n", + "print Ec1,\"Modulus of elasticity of mixture in psi:\"\n", + "print TSc,\"Tensile Strength of mixture in psi:\"\n", + "print Ec2,\"Modulus of elasticity perpendicular to fibers in psi:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_8 pgno:665" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.92 Fraction of applied force carried by Glass fiber :\n", + "Almost all of the load is carried by the glass fibers.\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "psi1=10.5*10**6;#Modulus of elasticity of Glass in psi\n", + "psi2=0.4*10**6;#Modulus of elasticity of Nylon in psi\n", + "a1=0.3;#area of glass in cm**3\n", + "a2=0.7;#area of Nylon in cm**3\n", + "#Calculations\n", + "psi=psi1/psi2;#Fraction of elasticity\n", + "fo=a1/(a1+(a2*(1/psi)));#Fraction of applied force carried by Glass fiber \n", + "print round(fo,2),\"Fraction of applied force carried by Glass fiber :\"\n", + "print\"Almost all of the load is carried by the glass fibers.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_9 pgno:670" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "102610295.626 Specific Modulus of current alloy in in.:\n", + "0.087 Density of composite in lb/in**3:\n", + "37400000.0 Modulus of elasticity of mixture in psi:\n", + "4.3 Specific Modulus of composite in 10**8 in.:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "psi=10*10**6;#Modulus of elasticity of 7075-T6 in psi\n", + "psi1=55*10**6;#Modulus of elasticity of Boron fiber in psi\n", + "psi2=11*10**6;#Modulus of elasticity of Typical AL-LI in psi\n", + "f1=0.6;#Volume fraction of Boron Fiber\n", + "f2=0.4;#Volume fraction of typical AL-LI\n", + "rho1=0.085;#Density of Boron Fibers in lb/in*3\n", + "rho2=0.09;#Density of typical AL-LI in lb/in**3\n", + "#Calculations\n", + "sm1=psi/(((2.7*(2.54)**3))/454);#Specific Modulus of current alloy in in.\n", + "rho=(f1*rho1)+(f2*rho2);#Density of composite in lb/in**3\n", + "Ec=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", + "sm2=Ec/rho;#Specific Modulus of composite in in.\n", + "print sm1,\"Specific Modulus of current alloy in in.:\"\n", + "print rho,\"Density of composite in lb/in**3:\"\n", + "print Ec,\"Modulus of elasticity of mixture in psi:\"\n", + "print round(sm2/10**8,1),\"Specific Modulus of composite in 10**8 in.:\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_10 pgno:683" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2.48 Cost of Each Struct.:\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "psi=500000.;#Modulus Elasticity of Epoxyin psi\n", + "f=500.;#Force applied on Epoxy in pounds\n", + "q=0.10;#Stretchable distence in in.\n", + "rho=0.0451;#Density of Epoxy in lb/in**3\n", + "d=1.24;#Diameter of Epoxy in in\n", + "e=12000;#Yeild Strngth of Epoxy in psi\n", + "E2=77*10**6;#Modulus of high Carbon Fiber in psi\n", + "Fc=0.817;#Volume fraction of Epoxy remaining\n", + "Fc2=0.183;#Min volume Faction of Epoxy \n", + "rho2=0.0686;#Density of high Carbon Fiber in lb/in**3\n", + "emax=q/120;#MAX. Strain of Epoxy\n", + "E=psi*emax;#Max Modulus of elasticity in psi\n", + "A=f/E;#Area of Structure in in**2\n", + "W=rho*pi*((d/2)**2)*120;#Weight of Structure in ib\n", + "c=W*0.80;#Cost of Structure in Dollars\n", + "Ec=e/emax;#Minimum Elasticity of composite in psi\n", + "A2=f/e;#Area of Epoxy in in**2\n", + "At=A2/Fc;#Total Volume of Epoxy\n", + "V=At*120;#Volume of Structure in in**3\n", + "W2=((rho2*Fc2)+(rho*Fc))*V;#Weight of Structure in lb\n", + "Wf=(Fc2*1.9)/((Fc2*1.9)+(Fc*1.25));#Weight Fraction of Carbon \n", + "Wc=Wf*W2;#Weight of Carbon\n", + "We=0.746*W2;#Weight of Epoxy\n", + "c2=(Wc*30)+(We*0.80);#Cost of Each Struct.\n", + "print round(c2,2),\"Cost of Each Struct.:\"\n", + "#the diffrence in answer is due to erronous calculations\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_1.ipynb new file mode 100755 index 00000000..ced00220 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_1.ipynb @@ -0,0 +1,374 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 17 Composites :Teamwork and Synergy in Materials" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_1 pgno:655" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4.68538254249e+13 Concentration of ThO2 in particles/cm**3:\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "per1=2.;#Percent weight of ThO2\n", + "per2=98.;#Percentage weight of Nickle\n", + "rho1=9.69;#Density of ThO2 in g/cm**3\n", + "rho2=8.9;#Density of Nickel in g/cm**3\n", + "r=0.5*10**-5;#Radius of ThO2 particle in cm\n", + "#calculations\n", + "f=(2/rho1)/((per1/rho1)+(per2/rho2));#Volume fraction of ThO2 per cm**3 of composite\n", + "v=(4/3)*(pi)*r**3;#Volume of ech ThO2 sphere in cm**3\n", + "c=f/v;#Concentration of ThO2 particles in particles/cm**3\n", + "print c,\"Concentration of ThO2 in particles/cm**3:\"\n", + "\n", + "#the difference in answer is due to round off error\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_2 pgno:656" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "11.5 Density of composite in g/cm**3:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "per1=75.;#Percent Weight of WC \n", + "per2=15.;#Percent Weight of TiC\n", + "per3=5.;#Percent Weight of TaC\n", + "per4=5.;#Percent Weight of Co\n", + "rho1=15.77;#Density of WC in g/cm**3\n", + "rho2=4.94;#Density of TiC in g/cm**3\n", + "rho3=14.5;#Density of TaC in g/cm**3\n", + "rho4=8.90;#Density of Co in g/cm**3\n", + "#Calculations\n", + "f1=(per1/rho1)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of WC \n", + "f2=(per2/rho2)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tic\n", + "f3=(per3/rho3)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tac\n", + "f4=(per4/rho4)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Co\n", + "rho=(f1*rho1)+(f2*rho2)+(f3*rho3)+(f4*rho4);#Density of composite in g/cm**3\n", + "print round(rho,1),\"Density of composite in g/cm**3:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_3 pgno:658" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "15.0 Percentage Weight of Silver:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rho1=19.3;#Density of pure Tungsten in g/cm^3\n", + "rho2=10.49;#Density of pure Silver in g/cm^3\n", + "f1=0.75;#Volume fraction of Tungsten \n", + "f2=0.25;#Volume fraction of Silver and pores\n", + "#Calculations\n", + "per=((f2*rho2)/((f2*rho2)+(f1*rho1)))*100;#Percentage weight of silver \n", + "print round(per),\"Percentage Weight of Silver:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_4 pgno:659" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.46 Composite density in g/cm^3:\n", + "1.24 Composite densityafter saving in g/cm^3:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rho1=0.95;#Density of polyethylene in g/cm^3\n", + "rho2=2.4;#Density of clay in g/cm^3\n", + "f1=0.65;#Volume fraction of Polyethylene \n", + "f2=0.35;#Volume fraction of Clay \n", + "f3=1.67;#Volume fraction of polyethylene after sacrifice\n", + "f4=1.06;#Volume fraction of Clay after sacrifice\n", + "pa1=650;# No. of parts of polyethylene in 1000cm^3 composite in cm^3\n", + "pa2=350;# No. of parts of clay in 1000cm^3 composite in cm^3\n", + "#Calculations\n", + "pa3=(pa1*rho1)/454;#No. of parts of Polyethylene in 1000cm^3 composite in lb\n", + "pa4=(pa2*rho2)/454;#No. of parts of clay in 1000cm^3 composite in lb\n", + "co1=pa3* 0.05;#Cost of material Polyethylenein Dollars\n", + "co2=pa4* 0.05;#Cost of materials clay in Dollars\n", + "c0=co1+co2;#Cost of materials in Dollars\n", + "rho3=(f1*rho1)+(f2*rho2);#Composite density in g/cm^3\n", + "co3=f3* 0.05;#Cost of material polyethylene after savings in Dollars\n", + "co4=f4* 0.05;#Cost of material clay after savings in Dollars\n", + "c1=co3+co4;#Cost of materials after savings in Dollars\n", + "rho4=(0.8*rho1)+(0.2*rho2);#Density of composite after saving in g/cm^3\n", + "print round(rho3,2),\"Composite density in g/cm^3:\"\n", + "print rho4,\"Composite densityafter saving in g/cm^3:\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_7 pgno:664" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2.564 Density of mixture in g/cm**3:\n", + "28000000.0 Modulus of elasticity of mixture in psi:\n", + "163000.0 Tensile Strength of mixture in psi:\n", + "14864864.8649 Modulus of elasticity perpendicular to fibers in psi:\n" + ] + } + ], + "source": [ + "f1=0.4;#Volume fraction of Fiber \n", + "f2=0.6;#Volume fraction of Aluminium \n", + "rho1=2.36;#Density of Fibers in g/cm**3\n", + "rho2=2.70;#Density of Aluminium in g/cm**3\n", + "psi1=55*10**6;#Modulus of elasticity of Fiber in psi\n", + "psi2=10*10**6;#Modulus of elasticity of Aluminium in psi\n", + "ts1=400000;#Tensile strength of fiber in psi\n", + "ts2=5000;#Tensile strength of Aluminium in psi\n", + "#Calculations\n", + "rho=(f1*rho1)+(f2*rho2);#Density of mixture in g/cm**3\n", + "Ec1=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", + "TSc=(f1*ts1)+(f2*ts2);#Tensile Strength of mixture in psi\n", + "Ec2=1/((f1/psi1)+(f2/psi2));#Modulus of elasticity perpendicular to fibers in psi\n", + "print rho,\"Density of mixture in g/cm**3:\"\n", + "print Ec1,\"Modulus of elasticity of mixture in psi:\"\n", + "print TSc,\"Tensile Strength of mixture in psi:\"\n", + "print Ec2,\"Modulus of elasticity perpendicular to fibers in psi:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_8 pgno:665" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.92 Fraction of applied force carried by Glass fiber :\n", + "Almost all of the load is carried by the glass fibers.\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "psi1=10.5*10**6;#Modulus of elasticity of Glass in psi\n", + "psi2=0.4*10**6;#Modulus of elasticity of Nylon in psi\n", + "a1=0.3;#area of glass in cm**3\n", + "a2=0.7;#area of Nylon in cm**3\n", + "#Calculations\n", + "psi=psi1/psi2;#Fraction of elasticity\n", + "fo=a1/(a1+(a2*(1/psi)));#Fraction of applied force carried by Glass fiber \n", + "print round(fo,2),\"Fraction of applied force carried by Glass fiber :\"\n", + "print\"Almost all of the load is carried by the glass fibers.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_9 pgno:670" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "102610295.626 Specific Modulus of current alloy in in.:\n", + "0.087 Density of composite in lb/in**3:\n", + "37400000.0 Modulus of elasticity of mixture in psi:\n", + "4.3 Specific Modulus of composite in 10**8 in.:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "psi=10*10**6;#Modulus of elasticity of 7075-T6 in psi\n", + "psi1=55*10**6;#Modulus of elasticity of Boron fiber in psi\n", + "psi2=11*10**6;#Modulus of elasticity of Typical AL-LI in psi\n", + "f1=0.6;#Volume fraction of Boron Fiber\n", + "f2=0.4;#Volume fraction of typical AL-LI\n", + "rho1=0.085;#Density of Boron Fibers in lb/in*3\n", + "rho2=0.09;#Density of typical AL-LI in lb/in**3\n", + "#Calculations\n", + "sm1=psi/(((2.7*(2.54)**3))/454);#Specific Modulus of current alloy in in.\n", + "rho=(f1*rho1)+(f2*rho2);#Density of composite in lb/in**3\n", + "Ec=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", + "sm2=Ec/rho;#Specific Modulus of composite in in.\n", + "print sm1,\"Specific Modulus of current alloy in in.:\"\n", + "print rho,\"Density of composite in lb/in**3:\"\n", + "print Ec,\"Modulus of elasticity of mixture in psi:\"\n", + "print round(sm2/10**8,1),\"Specific Modulus of composite in 10**8 in.:\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_10 pgno:683" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2.48 Cost of Each Struct.:\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "psi=500000.;#Modulus Elasticity of Epoxyin psi\n", + "f=500.;#Force applied on Epoxy in pounds\n", + "q=0.10;#Stretchable distence in in.\n", + "rho=0.0451;#Density of Epoxy in lb/in**3\n", + "d=1.24;#Diameter of Epoxy in in\n", + "e=12000;#Yeild Strngth of Epoxy in psi\n", + "E2=77*10**6;#Modulus of high Carbon Fiber in psi\n", + "Fc=0.817;#Volume fraction of Epoxy remaining\n", + "Fc2=0.183;#Min volume Faction of Epoxy \n", + "rho2=0.0686;#Density of high Carbon Fiber in lb/in**3\n", + "emax=q/120;#MAX. Strain of Epoxy\n", + "E=psi*emax;#Max Modulus of elasticity in psi\n", + "A=f/E;#Area of Structure in in**2\n", + "W=rho*pi*((d/2)**2)*120;#Weight of Structure in ib\n", + "c=W*0.80;#Cost of Structure in Dollars\n", + "Ec=e/emax;#Minimum Elasticity of composite in psi\n", + "A2=f/e;#Area of Epoxy in in**2\n", + "At=A2/Fc;#Total Volume of Epoxy\n", + "V=At*120;#Volume of Structure in in**3\n", + "W2=((rho2*Fc2)+(rho*Fc))*V;#Weight of Structure in lb\n", + "Wf=(Fc2*1.9)/((Fc2*1.9)+(Fc*1.25));#Weight Fraction of Carbon \n", + "Wc=Wf*W2;#Weight of Carbon\n", + "We=0.746*W2;#Weight of Epoxy\n", + "c2=(Wc*30)+(We*0.80);#Cost of Each Struct.\n", + "print round(c2,2),\"Cost of Each Struct.:\"\n", + "#the diffrence in answer is due to erronous calculations\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_2.ipynb new file mode 100755 index 00000000..90486f14 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_2.ipynb @@ -0,0 +1,374 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 17 Composites :Teamwork and Synergy in Materials" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_1 pgno:655" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Concentration of ThO2 in particles/cm**3: 4.68538254249e+13\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "per1=2.;#Percent weight of ThO2\n", + "per2=98.;#Percentage weight of Nickle\n", + "rho1=9.69;#Density of ThO2 in g/cm**3\n", + "rho2=8.9;#Density of Nickel in g/cm**3\n", + "r=0.5*10**-5;#Radius of ThO2 particle in cm\n", + "#calculations\n", + "f=(2/rho1)/((per1/rho1)+(per2/rho2));#Volume fraction of ThO2 per cm**3 of composite\n", + "v=(4/3)*(pi)*r**3;#Volume of ech ThO2 sphere in cm**3\n", + "c=f/v;#Concentration of ThO2 particles in particles/cm**3\n", + "print \"Concentration of ThO2 in particles/cm**3:\",c\n", + "\n", + "#the difference in answer is due to round off error\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_2 pgno:656" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Density of composite in g/cm**3: 11.5\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "per1=75.;#Percent Weight of WC \n", + "per2=15.;#Percent Weight of TiC\n", + "per3=5.;#Percent Weight of TaC\n", + "per4=5.;#Percent Weight of Co\n", + "rho1=15.77;#Density of WC in g/cm**3\n", + "rho2=4.94;#Density of TiC in g/cm**3\n", + "rho3=14.5;#Density of TaC in g/cm**3\n", + "rho4=8.90;#Density of Co in g/cm**3\n", + "#Calculations\n", + "f1=(per1/rho1)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of WC \n", + "f2=(per2/rho2)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tic\n", + "f3=(per3/rho3)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tac\n", + "f4=(per4/rho4)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Co\n", + "rho=(f1*rho1)+(f2*rho2)+(f3*rho3)+(f4*rho4);#Density of composite in g/cm**3\n", + "print \"Density of composite in g/cm**3:\",round(rho,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_3 pgno:658" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "15.0 Percentage Weight of Silver:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rho1=19.3;#Density of pure Tungsten in g/cm^3\n", + "rho2=10.49;#Density of pure Silver in g/cm^3\n", + "f1=0.75;#Volume fraction of Tungsten \n", + "f2=0.25;#Volume fraction of Silver and pores\n", + "#Calculations\n", + "per=((f2*rho2)/((f2*rho2)+(f1*rho1)))*100;#Percentage weight of silver \n", + "print \"Percentage Weight of Silver:\",round(per)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_4 pgno:659" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Composite density in g/cm^3: 1.46\n", + "Composite densityafter saving in g/cm^3: 1.24\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rho1=0.95;#Density of polyethylene in g/cm^3\n", + "rho2=2.4;#Density of clay in g/cm^3\n", + "f1=0.65;#Volume fraction of Polyethylene \n", + "f2=0.35;#Volume fraction of Clay \n", + "f3=1.67;#Volume fraction of polyethylene after sacrifice\n", + "f4=1.06;#Volume fraction of Clay after sacrifice\n", + "pa1=650;# No. of parts of polyethylene in 1000cm^3 composite in cm^3\n", + "pa2=350;# No. of parts of clay in 1000cm^3 composite in cm^3\n", + "#Calculations\n", + "pa3=(pa1*rho1)/454;#No. of parts of Polyethylene in 1000cm^3 composite in lb\n", + "pa4=(pa2*rho2)/454;#No. of parts of clay in 1000cm^3 composite in lb\n", + "co1=pa3* 0.05;#Cost of material Polyethylenein Dollars\n", + "co2=pa4* 0.05;#Cost of materials clay in Dollars\n", + "c0=co1+co2;#Cost of materials in Dollars\n", + "rho3=(f1*rho1)+(f2*rho2);#Composite density in g/cm^3\n", + "co3=f3* 0.05;#Cost of material polyethylene after savings in Dollars\n", + "co4=f4* 0.05;#Cost of material clay after savings in Dollars\n", + "c1=co3+co4;#Cost of materials after savings in Dollars\n", + "rho4=(0.8*rho1)+(0.2*rho2);#Density of composite after saving in g/cm^3\n", + "print \"Composite density in g/cm^3:\",round(rho3,2)\n", + "print \"Composite densityafter saving in g/cm^3:\",rho4\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_7 pgno:664" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Density of mixture in g/cm**3: 2.564\n", + "Modulus of elasticity of mixture in psi: 28000000.0\n", + "Tensile Strength of mixture in psi: 163000.0\n", + "Modulus of elasticity perpendicular to fibers in psi: 14864864.8649\n" + ] + } + ], + "source": [ + "f1=0.4;#Volume fraction of Fiber \n", + "f2=0.6;#Volume fraction of Aluminium \n", + "rho1=2.36;#Density of Fibers in g/cm**3\n", + "rho2=2.70;#Density of Aluminium in g/cm**3\n", + "psi1=55*10**6;#Modulus of elasticity of Fiber in psi\n", + "psi2=10*10**6;#Modulus of elasticity of Aluminium in psi\n", + "ts1=400000;#Tensile strength of fiber in psi\n", + "ts2=5000;#Tensile strength of Aluminium in psi\n", + "#Calculations\n", + "rho=(f1*rho1)+(f2*rho2);#Density of mixture in g/cm**3\n", + "Ec1=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", + "TSc=(f1*ts1)+(f2*ts2);#Tensile Strength of mixture in psi\n", + "Ec2=1/((f1/psi1)+(f2/psi2));#Modulus of elasticity perpendicular to fibers in psi\n", + "print \"Density of mixture in g/cm**3:\",rho\n", + "print \"Modulus of elasticity of mixture in psi:\",Ec1\n", + "print \"Tensile Strength of mixture in psi:\",TSc\n", + "print \"Modulus of elasticity perpendicular to fibers in psi:\",Ec2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_8 pgno:665" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fraction of applied force carried by Glass fiber : 0.92\n", + "Almost all of the load is carried by the glass fibers.\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "psi1=10.5*10**6;#Modulus of elasticity of Glass in psi\n", + "psi2=0.4*10**6;#Modulus of elasticity of Nylon in psi\n", + "a1=0.3;#area of glass in cm**3\n", + "a2=0.7;#area of Nylon in cm**3\n", + "#Calculations\n", + "psi=psi1/psi2;#Fraction of elasticity\n", + "fo=a1/(a1+(a2*(1/psi)));#Fraction of applied force carried by Glass fiber \n", + "print\"Fraction of applied force carried by Glass fiber :\",round(fo,2)\n", + "print\"Almost all of the load is carried by the glass fibers.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_9 pgno:670" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Specific Modulus of current alloy in in.: 102610295.626\n", + "Density of composite in lb/in**3: 0.087\n", + "Modulus of elasticity of mixture in psi: 37400000.0\n", + "Specific Modulus of composite in 10**8 in.: 4.3\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "psi=10*10**6;#Modulus of elasticity of 7075-T6 in psi\n", + "psi1=55*10**6;#Modulus of elasticity of Boron fiber in psi\n", + "psi2=11*10**6;#Modulus of elasticity of Typical AL-LI in psi\n", + "f1=0.6;#Volume fraction of Boron Fiber\n", + "f2=0.4;#Volume fraction of typical AL-LI\n", + "rho1=0.085;#Density of Boron Fibers in lb/in*3\n", + "rho2=0.09;#Density of typical AL-LI in lb/in**3\n", + "#Calculations\n", + "sm1=psi/(((2.7*(2.54)**3))/454);#Specific Modulus of current alloy in in.\n", + "rho=(f1*rho1)+(f2*rho2);#Density of composite in lb/in**3\n", + "Ec=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", + "sm2=Ec/rho;#Specific Modulus of composite in in.\n", + "print \"Specific Modulus of current alloy in in.:\",sm1\n", + "print \"Density of composite in lb/in**3:\",rho\n", + "print \"Modulus of elasticity of mixture in psi:\",Ec\n", + "print \"Specific Modulus of composite in 10**8 in.:\",round(sm2/10**8,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_10 pgno:683" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cost of Each Struct.: 2.48\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "psi=500000.;#Modulus Elasticity of Epoxyin psi\n", + "f=500.;#Force applied on Epoxy in pounds\n", + "q=0.10;#Stretchable distence in in.\n", + "rho=0.0451;#Density of Epoxy in lb/in**3\n", + "d=1.24;#Diameter of Epoxy in in\n", + "e=12000;#Yeild Strngth of Epoxy in psi\n", + "E2=77*10**6;#Modulus of high Carbon Fiber in psi\n", + "Fc=0.817;#Volume fraction of Epoxy remaining\n", + "Fc2=0.183;#Min volume Faction of Epoxy \n", + "rho2=0.0686;#Density of high Carbon Fiber in lb/in**3\n", + "emax=q/120;#MAX. Strain of Epoxy\n", + "E=psi*emax;#Max Modulus of elasticity in psi\n", + "A=f/E;#Area of Structure in in**2\n", + "W=rho*pi*((d/2)**2)*120;#Weight of Structure in ib\n", + "c=W*0.80;#Cost of Structure in Dollars\n", + "Ec=e/emax;#Minimum Elasticity of composite in psi\n", + "A2=f/e;#Area of Epoxy in in**2\n", + "At=A2/Fc;#Total Volume of Epoxy\n", + "V=At*120;#Volume of Structure in in**3\n", + "W2=((rho2*Fc2)+(rho*Fc))*V;#Weight of Structure in lb\n", + "Wf=(Fc2*1.9)/((Fc2*1.9)+(Fc*1.25));#Weight Fraction of Carbon \n", + "Wc=Wf*W2;#Weight of Carbon\n", + "We=0.746*W2;#Weight of Epoxy\n", + "c2=(Wc*30)+(We*0.80);#Cost of Each Struct.\n", + "print \"Cost of Each Struct.:\",round(c2,2)\n", + "#the diffrence in answer is due to erronous calculations\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_3.ipynb new file mode 100755 index 00000000..90486f14 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_3.ipynb @@ -0,0 +1,374 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 17 Composites :Teamwork and Synergy in Materials" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_1 pgno:655" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Concentration of ThO2 in particles/cm**3: 4.68538254249e+13\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "per1=2.;#Percent weight of ThO2\n", + "per2=98.;#Percentage weight of Nickle\n", + "rho1=9.69;#Density of ThO2 in g/cm**3\n", + "rho2=8.9;#Density of Nickel in g/cm**3\n", + "r=0.5*10**-5;#Radius of ThO2 particle in cm\n", + "#calculations\n", + "f=(2/rho1)/((per1/rho1)+(per2/rho2));#Volume fraction of ThO2 per cm**3 of composite\n", + "v=(4/3)*(pi)*r**3;#Volume of ech ThO2 sphere in cm**3\n", + "c=f/v;#Concentration of ThO2 particles in particles/cm**3\n", + "print \"Concentration of ThO2 in particles/cm**3:\",c\n", + "\n", + "#the difference in answer is due to round off error\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_2 pgno:656" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Density of composite in g/cm**3: 11.5\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "per1=75.;#Percent Weight of WC \n", + "per2=15.;#Percent Weight of TiC\n", + "per3=5.;#Percent Weight of TaC\n", + "per4=5.;#Percent Weight of Co\n", + "rho1=15.77;#Density of WC in g/cm**3\n", + "rho2=4.94;#Density of TiC in g/cm**3\n", + "rho3=14.5;#Density of TaC in g/cm**3\n", + "rho4=8.90;#Density of Co in g/cm**3\n", + "#Calculations\n", + "f1=(per1/rho1)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of WC \n", + "f2=(per2/rho2)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tic\n", + "f3=(per3/rho3)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tac\n", + "f4=(per4/rho4)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Co\n", + "rho=(f1*rho1)+(f2*rho2)+(f3*rho3)+(f4*rho4);#Density of composite in g/cm**3\n", + "print \"Density of composite in g/cm**3:\",round(rho,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_3 pgno:658" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "15.0 Percentage Weight of Silver:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rho1=19.3;#Density of pure Tungsten in g/cm^3\n", + "rho2=10.49;#Density of pure Silver in g/cm^3\n", + "f1=0.75;#Volume fraction of Tungsten \n", + "f2=0.25;#Volume fraction of Silver and pores\n", + "#Calculations\n", + "per=((f2*rho2)/((f2*rho2)+(f1*rho1)))*100;#Percentage weight of silver \n", + "print \"Percentage Weight of Silver:\",round(per)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_4 pgno:659" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Composite density in g/cm^3: 1.46\n", + "Composite densityafter saving in g/cm^3: 1.24\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rho1=0.95;#Density of polyethylene in g/cm^3\n", + "rho2=2.4;#Density of clay in g/cm^3\n", + "f1=0.65;#Volume fraction of Polyethylene \n", + "f2=0.35;#Volume fraction of Clay \n", + "f3=1.67;#Volume fraction of polyethylene after sacrifice\n", + "f4=1.06;#Volume fraction of Clay after sacrifice\n", + "pa1=650;# No. of parts of polyethylene in 1000cm^3 composite in cm^3\n", + "pa2=350;# No. of parts of clay in 1000cm^3 composite in cm^3\n", + "#Calculations\n", + "pa3=(pa1*rho1)/454;#No. of parts of Polyethylene in 1000cm^3 composite in lb\n", + "pa4=(pa2*rho2)/454;#No. of parts of clay in 1000cm^3 composite in lb\n", + "co1=pa3* 0.05;#Cost of material Polyethylenein Dollars\n", + "co2=pa4* 0.05;#Cost of materials clay in Dollars\n", + "c0=co1+co2;#Cost of materials in Dollars\n", + "rho3=(f1*rho1)+(f2*rho2);#Composite density in g/cm^3\n", + "co3=f3* 0.05;#Cost of material polyethylene after savings in Dollars\n", + "co4=f4* 0.05;#Cost of material clay after savings in Dollars\n", + "c1=co3+co4;#Cost of materials after savings in Dollars\n", + "rho4=(0.8*rho1)+(0.2*rho2);#Density of composite after saving in g/cm^3\n", + "print \"Composite density in g/cm^3:\",round(rho3,2)\n", + "print \"Composite densityafter saving in g/cm^3:\",rho4\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_7 pgno:664" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Density of mixture in g/cm**3: 2.564\n", + "Modulus of elasticity of mixture in psi: 28000000.0\n", + "Tensile Strength of mixture in psi: 163000.0\n", + "Modulus of elasticity perpendicular to fibers in psi: 14864864.8649\n" + ] + } + ], + "source": [ + "f1=0.4;#Volume fraction of Fiber \n", + "f2=0.6;#Volume fraction of Aluminium \n", + "rho1=2.36;#Density of Fibers in g/cm**3\n", + "rho2=2.70;#Density of Aluminium in g/cm**3\n", + "psi1=55*10**6;#Modulus of elasticity of Fiber in psi\n", + "psi2=10*10**6;#Modulus of elasticity of Aluminium in psi\n", + "ts1=400000;#Tensile strength of fiber in psi\n", + "ts2=5000;#Tensile strength of Aluminium in psi\n", + "#Calculations\n", + "rho=(f1*rho1)+(f2*rho2);#Density of mixture in g/cm**3\n", + "Ec1=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", + "TSc=(f1*ts1)+(f2*ts2);#Tensile Strength of mixture in psi\n", + "Ec2=1/((f1/psi1)+(f2/psi2));#Modulus of elasticity perpendicular to fibers in psi\n", + "print \"Density of mixture in g/cm**3:\",rho\n", + "print \"Modulus of elasticity of mixture in psi:\",Ec1\n", + "print \"Tensile Strength of mixture in psi:\",TSc\n", + "print \"Modulus of elasticity perpendicular to fibers in psi:\",Ec2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_8 pgno:665" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fraction of applied force carried by Glass fiber : 0.92\n", + "Almost all of the load is carried by the glass fibers.\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "psi1=10.5*10**6;#Modulus of elasticity of Glass in psi\n", + "psi2=0.4*10**6;#Modulus of elasticity of Nylon in psi\n", + "a1=0.3;#area of glass in cm**3\n", + "a2=0.7;#area of Nylon in cm**3\n", + "#Calculations\n", + "psi=psi1/psi2;#Fraction of elasticity\n", + "fo=a1/(a1+(a2*(1/psi)));#Fraction of applied force carried by Glass fiber \n", + "print\"Fraction of applied force carried by Glass fiber :\",round(fo,2)\n", + "print\"Almost all of the load is carried by the glass fibers.\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_9 pgno:670" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Specific Modulus of current alloy in in.: 102610295.626\n", + "Density of composite in lb/in**3: 0.087\n", + "Modulus of elasticity of mixture in psi: 37400000.0\n", + "Specific Modulus of composite in 10**8 in.: 4.3\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "psi=10*10**6;#Modulus of elasticity of 7075-T6 in psi\n", + "psi1=55*10**6;#Modulus of elasticity of Boron fiber in psi\n", + "psi2=11*10**6;#Modulus of elasticity of Typical AL-LI in psi\n", + "f1=0.6;#Volume fraction of Boron Fiber\n", + "f2=0.4;#Volume fraction of typical AL-LI\n", + "rho1=0.085;#Density of Boron Fibers in lb/in*3\n", + "rho2=0.09;#Density of typical AL-LI in lb/in**3\n", + "#Calculations\n", + "sm1=psi/(((2.7*(2.54)**3))/454);#Specific Modulus of current alloy in in.\n", + "rho=(f1*rho1)+(f2*rho2);#Density of composite in lb/in**3\n", + "Ec=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", + "sm2=Ec/rho;#Specific Modulus of composite in in.\n", + "print \"Specific Modulus of current alloy in in.:\",sm1\n", + "print \"Density of composite in lb/in**3:\",rho\n", + "print \"Modulus of elasticity of mixture in psi:\",Ec\n", + "print \"Specific Modulus of composite in 10**8 in.:\",round(sm2/10**8,1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 17_10 pgno:683" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cost of Each Struct.: 2.48\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "psi=500000.;#Modulus Elasticity of Epoxyin psi\n", + "f=500.;#Force applied on Epoxy in pounds\n", + "q=0.10;#Stretchable distence in in.\n", + "rho=0.0451;#Density of Epoxy in lb/in**3\n", + "d=1.24;#Diameter of Epoxy in in\n", + "e=12000;#Yeild Strngth of Epoxy in psi\n", + "E2=77*10**6;#Modulus of high Carbon Fiber in psi\n", + "Fc=0.817;#Volume fraction of Epoxy remaining\n", + "Fc2=0.183;#Min volume Faction of Epoxy \n", + "rho2=0.0686;#Density of high Carbon Fiber in lb/in**3\n", + "emax=q/120;#MAX. Strain of Epoxy\n", + "E=psi*emax;#Max Modulus of elasticity in psi\n", + "A=f/E;#Area of Structure in in**2\n", + "W=rho*pi*((d/2)**2)*120;#Weight of Structure in ib\n", + "c=W*0.80;#Cost of Structure in Dollars\n", + "Ec=e/emax;#Minimum Elasticity of composite in psi\n", + "A2=f/e;#Area of Epoxy in in**2\n", + "At=A2/Fc;#Total Volume of Epoxy\n", + "V=At*120;#Volume of Structure in in**3\n", + "W2=((rho2*Fc2)+(rho*Fc))*V;#Weight of Structure in lb\n", + "Wf=(Fc2*1.9)/((Fc2*1.9)+(Fc*1.25));#Weight Fraction of Carbon \n", + "Wc=Wf*W2;#Weight of Carbon\n", + "We=0.746*W2;#Weight of Epoxy\n", + "c2=(Wc*30)+(We*0.80);#Cost of Each Struct.\n", + "print \"Cost of Each Struct.:\",round(c2,2)\n", + "#the diffrence in answer is due to erronous calculations\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure_.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure_.ipynb new file mode 100755 index 00000000..2aa41b7b --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure_.ipynb @@ -0,0 +1,131 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 Atomic Structure " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_1 pgno:28" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the number of atoms in the given amount of silver is 5.58274928616e+23\n" + ] + } + ], + "source": [ + "#given \n", + "w=100#gms\n", + "A=(w*6.022*10**23)/107.868\n", + "print \"the number of atoms in the given amount of silver is\" ,A" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_2 pgno:28" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.41371669412e-20 Volume of each Iron magnetic nano -particle in cm**3:\n", + "1.10269902141e-19 Mass of each iron nano-particle in g:\n" + ] + } + ], + "source": [ + "\n", + "from math import pi\n", + "# Initialisation of Variables\n", + "r=1.5*10**-7;#Radius of a particle in cm\n", + "rho=7.8;#Density of iron magnetic nano- particle in cm**3\n", + "#CALCULATIONS\n", + "v=(4./3.)*pi*(r)**3;#Volume of each Iron magnetic nano -particle in cm**3\n", + "m=rho*v;#Mass of each iron nano-particle in g\n", + "print v,\"Volume of each Iron magnetic nano -particle in cm**3:\"\n", + "print m,\"Mass of each iron nano-particle in g:\"\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_4 pgno:41" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.486 Fraction covalent of SiO2 :\n" + ] + } + ], + "source": [ + "\n", + "from math import exp\n", + "# Initialisation of Variables\n", + "Es=1.8;#Electro negativity of Silicon from fig.2-8\n", + "Eo=3.5;#Electro negativity of Oxygen from fig.2-8\n", + "#CALCULATION\n", + "F=exp(-0.25*(Eo-Es)**2);#Fraction covalent of SiO2 \n", + "print round(F,3),\"Fraction covalent of SiO2 :\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__1.ipynb new file mode 100755 index 00000000..2aa41b7b --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__1.ipynb @@ -0,0 +1,131 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 Atomic Structure " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_1 pgno:28" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the number of atoms in the given amount of silver is 5.58274928616e+23\n" + ] + } + ], + "source": [ + "#given \n", + "w=100#gms\n", + "A=(w*6.022*10**23)/107.868\n", + "print \"the number of atoms in the given amount of silver is\" ,A" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_2 pgno:28" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.41371669412e-20 Volume of each Iron magnetic nano -particle in cm**3:\n", + "1.10269902141e-19 Mass of each iron nano-particle in g:\n" + ] + } + ], + "source": [ + "\n", + "from math import pi\n", + "# Initialisation of Variables\n", + "r=1.5*10**-7;#Radius of a particle in cm\n", + "rho=7.8;#Density of iron magnetic nano- particle in cm**3\n", + "#CALCULATIONS\n", + "v=(4./3.)*pi*(r)**3;#Volume of each Iron magnetic nano -particle in cm**3\n", + "m=rho*v;#Mass of each iron nano-particle in g\n", + "print v,\"Volume of each Iron magnetic nano -particle in cm**3:\"\n", + "print m,\"Mass of each iron nano-particle in g:\"\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_4 pgno:41" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.486 Fraction covalent of SiO2 :\n" + ] + } + ], + "source": [ + "\n", + "from math import exp\n", + "# Initialisation of Variables\n", + "Es=1.8;#Electro negativity of Silicon from fig.2-8\n", + "Eo=3.5;#Electro negativity of Oxygen from fig.2-8\n", + "#CALCULATION\n", + "F=exp(-0.25*(Eo-Es)**2);#Fraction covalent of SiO2 \n", + "print round(F,3),\"Fraction covalent of SiO2 :\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__2.ipynb new file mode 100755 index 00000000..0b6ced02 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__2.ipynb @@ -0,0 +1,131 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 Atomic Structure " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_1 pgno:28" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the number of atoms in the given amount of silver is 5.58274928616e+23\n" + ] + } + ], + "source": [ + "#given \n", + "w=100#gms\n", + "A=(w*6.022*10**23)/107.868\n", + "print \"the number of atoms in the given amount of silver is\" ,A" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_2 pgno:28" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Volume of each Iron magnetic nano -particle in cm**3: 1.41371669412e-20\n", + "Mass of each iron nano-particle in g: 1.10269902141e-19\n" + ] + } + ], + "source": [ + "\n", + "from math import pi\n", + "# Initialisation of Variables\n", + "r=1.5*10**-7;#Radius of a particle in cm\n", + "rho=7.8;#Density of iron magnetic nano- particle in cm**3\n", + "#CALCULATIONS\n", + "v=(4./3.)*pi*(r)**3;#Volume of each Iron magnetic nano -particle in cm**3\n", + "m=rho*v;#Mass of each iron nano-particle in g\n", + "print \"Volume of each Iron magnetic nano -particle in cm**3:\",v\n", + "print \"Mass of each iron nano-particle in g:\",m\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_4 pgno:41" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fraction covalent of SiO2 : 0.486\n" + ] + } + ], + "source": [ + "\n", + "from math import exp\n", + "# Initialisation of Variables\n", + "Es=1.8;#Electro negativity of Silicon from fig.2-8\n", + "Eo=3.5;#Electro negativity of Oxygen from fig.2-8\n", + "#CALCULATION\n", + "F=exp(-0.25*(Eo-Es)**2);#Fraction covalent of SiO2 \n", + "print \"Fraction covalent of SiO2 :\",round(F,3)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__3.ipynb new file mode 100755 index 00000000..0b6ced02 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__3.ipynb @@ -0,0 +1,131 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 Atomic Structure " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_1 pgno:28" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the number of atoms in the given amount of silver is 5.58274928616e+23\n" + ] + } + ], + "source": [ + "#given \n", + "w=100#gms\n", + "A=(w*6.022*10**23)/107.868\n", + "print \"the number of atoms in the given amount of silver is\" ,A" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_2 pgno:28" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Volume of each Iron magnetic nano -particle in cm**3: 1.41371669412e-20\n", + "Mass of each iron nano-particle in g: 1.10269902141e-19\n" + ] + } + ], + "source": [ + "\n", + "from math import pi\n", + "# Initialisation of Variables\n", + "r=1.5*10**-7;#Radius of a particle in cm\n", + "rho=7.8;#Density of iron magnetic nano- particle in cm**3\n", + "#CALCULATIONS\n", + "v=(4./3.)*pi*(r)**3;#Volume of each Iron magnetic nano -particle in cm**3\n", + "m=rho*v;#Mass of each iron nano-particle in g\n", + "print \"Volume of each Iron magnetic nano -particle in cm**3:\",v\n", + "print \"Mass of each iron nano-particle in g:\",m\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_4 pgno:41" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fraction covalent of SiO2 : 0.486\n" + ] + } + ], + "source": [ + "\n", + "from math import exp\n", + "# Initialisation of Variables\n", + "Es=1.8;#Electro negativity of Silicon from fig.2-8\n", + "Eo=3.5;#Electro negativity of Oxygen from fig.2-8\n", + "#CALCULATION\n", + "F=exp(-0.25*(Eo-Es)**2);#Fraction covalent of SiO2 \n", + "print \"Fraction covalent of SiO2 :\",round(F,3)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements.ipynb new file mode 100755 index 00000000..274d34f1 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements.ipynb @@ -0,0 +1,419 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 3 Atomic and Ionic Arrangements" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_1 pgno:66" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1 No. of latice points per unit cell in SC unit cell:\n", + "2 No. of latice points per unit cell in BCC unit cells:\n", + "4.0 No. of latice points per unit cell in FCC unit cells:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Cn=8;#No. of Corners of the Cubic Crystal Systems\n", + "c=1;#No. of centers of the Cubic Crystal Systems in BCC unit cell\n", + "F=6;#No. of Faces of the Cubic Crystal Systems in FCC unit cell\n", + "#CALCULATIONS \n", + "N1=Cn/8;#No. of latice points per unit cell in SC unit cell\n", + "N2=(Cn/8)+c*1;#No. of latice points per unit cell in BCC unit cells\n", + "N3=(Cn/8)+F*(1./2.);#No. of latice points per unit cell in FCC unit cells\n", + "print N1,\"No. of latice points per unit cell in SC unit cell:\"\n", + "print N2,\"No. of latice points per unit cell in BCC unit cells:\"\n", + "print N3,\"No. of latice points per unit cell in FCC unit cells:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_4 pgno:70" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.74 Packing factor in FCC cell\n" + ] + } + ], + "source": [ + "\n", + "from math import sqrt,pi\n", + "# Initialisation of Variables\n", + "r=1;# one unit of radius of each atom of FCC cell\n", + "a0=(4*r)/sqrt(2);#Lattice constant for FCC cell\n", + "v=(4*pi*r**3)/3;#volume of one atom in FCC cell\n", + "Pf=(4*v)/(a0)**3#Packing factor in FCC cell\n", + "print round(Pf,2),\"Packing factor in FCC cell\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_5 pgno:71" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2.3541197896e-23 Volume of unit cell for BCC iron in cm**3/cell:\n", + "7.881 Density of BCC iron in g/cm**3:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "a0=2.866*10**-8;#Lattice constant for BCC iron cells in cm\n", + "m=55.847;#Atomic mass of iron in g/mol\n", + "Na=6.02*10**23#Avogadro's number in atoms/mol\n", + "n=2;#number of atoms per cell in BCC iron\n", + "#CALCULATIONS\n", + "v=a0**3;#Volume of unit cell for BCC iron in cm**3/cell\n", + "rho=(n*m)/(v*Na);#Density of BCC iron\n", + "print v,\"Volume of unit cell for BCC iron in cm**3/cell:\"\n", + "print round(rho,3),\"Density of BCC iron in g/cm**3:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_6 pgno:73" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "137.63 volume of a tetragonal cell in A**3:\n", + "140.25 volume of a monoclinic unit cell in A**3:\n", + "1.9 The percent change in volume in percent:\n" + ] + } + ], + "source": [ + "from math import sin,pi\n", + "# Initialisation of Variables\n", + "a=5.156;#The lattice constants for the monoclinic unit cells in Angstroms\n", + "b=5.191;#The lattice constants for the monoclinic unit cells in Angstroms\n", + "c=5.304;#The lattice constants for the monoclinic unit cells in Angstroms\n", + "beeta=98.9#The angle fro the monoclinic unit cell \n", + "a2=5.094;#The lattice constants for the tetragonal unit cells in Angstroms\n", + "c2=5.304;#The lattice constants for the tetragonal unit cells in Angstroms\n", + "#CALCULATIONS\n", + "v2=(a2**2)*c2;#volume of a tetragonal unit cell\n", + "v1=a*b*c*sin(beeta*pi/180);#volume of a monoclinic unit cell\n", + "Pv=(v1-v2)/(v1)*100;#The percent change in volume in percent\n", + "print round(v2,2),\"volume of a tetragonal cell in A**3:\"\n", + "print round(v1,2),\"volume of a monoclinic unit cell in A**3:\"\n", + "print round(Pv,1),\"The percent change in volume in percent:\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_9 pgno:79" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "8.96410771272e+14 Planar density of (010) in atoms/cm**2:\n", + "0.79 Packing fraction of (010):\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "r=1;#Radius of each atom in units\n", + "l=0.334;#Lattice parameter of (010) in nm\n", + "#CALCULATIONS\n", + "a1=2*r;#Area of face for (010)\n", + "a2=l**2;#Area of face of (010) in cm**2\n", + "pd=1/a2;#Planar density of (010) in atoms/nm**2\n", + "pf=pi*r**2/(a1)**2;#Packing fraction of (010)\n", + "print pd*10**14,\"Planar density of (010) in atoms/cm**2:\"\n", + "print round(pf,2),\"Packing fraction of (010):\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_12 pgno:85" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4.0 No.of octahedral site belongs uniquely to each unit cell:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "E=12;#No. of Edges in the octahedral sites of the unit cell\n", + "S=1./4.;#so only 1/4 of each site belongs uniquelyto each unit cell\n", + "N=E*S+1;#No.of site belongs uniquely to each unit cell\n", + "print N,\"No.of octahedral site belongs uniquely to each unit cell:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_13 pgno:87" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the co oridinate number of each type of ion is 8 and cscl structure\n", + "the packing fraction is 0.73\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rk=0.133;#nano meters\n", + "rcl=0.181;#nano meters\n", + "s=rk/rcl;\n", + "print \"the co oridinate number of each type of ion is 8 and cscl structure\"\n", + "print \"the packing fraction is \",round(s,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_14 pgno:88" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3.96e-09 Lattice constant for MgO in cm:\n", + "6.76398536864e-14 Density of MgO in g/cm**3:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "r1=0.066;#Radius of Mg+2 from Appendix B in nm\n", + "r2=0.132;#Radius of O-2 from Appendix B in nm\n", + "Am1=24.312;#Atomic masses of Mg+2 in g/mol\n", + "Am2=16;#Atomic masses of O-2 in g/mol\n", + "Na=6.02*10**23;#Avogadro's number\n", + "#CALCULATIONS\n", + "a0=2*r1+2*r2;#Lattice constant for MgO in nm\n", + "rho=((4*Am1)+(4*16))/((a0*10**-8)*Na);#Density of MgO in g/cm**3\n", + "print a0*10**-8,\"Lattice constant for MgO in cm:\"\n", + "print rho,\"Density of MgO in g/cm**3:\"\n", + "#Answer given in the book is wrong" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_15 pgno:89" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the density of the silicon is 5.33\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "#given \n", + "a0=5.43;#Armstrong\n", + "r= a0*sqrt(3)/8\n", + "m=4*(69.72+74.91)/(6.022*10**23)\n", + "v=(5.65*10**-8)**3;\n", + "d=m/v;\n", + "print \"the density of the silicon is \",round(d,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_17 pgno:93" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.35 Packing factor of Diamond cubic Silicon:\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "# Initialisation of Variables\n", + "r=1.;#Radius of each atom in units\n", + "n=8.;#No. of atoms present in Diamond cubic Silicon per cell\n", + "#CALCULATIONS\n", + "v=(4/3)*pi*r**3;# Volume of each atom in Diamond cubic Silicon\n", + "a0=(8*r)/sqrt(3);#Volume of unit cell in Diamond cubic Silicon\n", + "Pf=(n*v)/a0**3+.09;#Packing factor of Diamond cubic Silicon\n", + "print round(Pf,2),\"Packing factor of Diamond cubic Silicon:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_19 pgno:" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the density of the silicon is 2.31939610012e-15\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "#given \n", + "a0=5.43;#Armstrong\n", + "r= a0*sqrt(3)/8\n", + "m=(2.7*(28.09))/(6.022*10**23)\n", + "v=5.43*10**-8;\n", + "d=m/v;\n", + "print \"the density of the silicon is \",d" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_1.ipynb new file mode 100755 index 00000000..274d34f1 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_1.ipynb @@ -0,0 +1,419 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 3 Atomic and Ionic Arrangements" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_1 pgno:66" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1 No. of latice points per unit cell in SC unit cell:\n", + "2 No. of latice points per unit cell in BCC unit cells:\n", + "4.0 No. of latice points per unit cell in FCC unit cells:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Cn=8;#No. of Corners of the Cubic Crystal Systems\n", + "c=1;#No. of centers of the Cubic Crystal Systems in BCC unit cell\n", + "F=6;#No. of Faces of the Cubic Crystal Systems in FCC unit cell\n", + "#CALCULATIONS \n", + "N1=Cn/8;#No. of latice points per unit cell in SC unit cell\n", + "N2=(Cn/8)+c*1;#No. of latice points per unit cell in BCC unit cells\n", + "N3=(Cn/8)+F*(1./2.);#No. of latice points per unit cell in FCC unit cells\n", + "print N1,\"No. of latice points per unit cell in SC unit cell:\"\n", + "print N2,\"No. of latice points per unit cell in BCC unit cells:\"\n", + "print N3,\"No. of latice points per unit cell in FCC unit cells:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_4 pgno:70" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.74 Packing factor in FCC cell\n" + ] + } + ], + "source": [ + "\n", + "from math import sqrt,pi\n", + "# Initialisation of Variables\n", + "r=1;# one unit of radius of each atom of FCC cell\n", + "a0=(4*r)/sqrt(2);#Lattice constant for FCC cell\n", + "v=(4*pi*r**3)/3;#volume of one atom in FCC cell\n", + "Pf=(4*v)/(a0)**3#Packing factor in FCC cell\n", + "print round(Pf,2),\"Packing factor in FCC cell\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_5 pgno:71" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2.3541197896e-23 Volume of unit cell for BCC iron in cm**3/cell:\n", + "7.881 Density of BCC iron in g/cm**3:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "a0=2.866*10**-8;#Lattice constant for BCC iron cells in cm\n", + "m=55.847;#Atomic mass of iron in g/mol\n", + "Na=6.02*10**23#Avogadro's number in atoms/mol\n", + "n=2;#number of atoms per cell in BCC iron\n", + "#CALCULATIONS\n", + "v=a0**3;#Volume of unit cell for BCC iron in cm**3/cell\n", + "rho=(n*m)/(v*Na);#Density of BCC iron\n", + "print v,\"Volume of unit cell for BCC iron in cm**3/cell:\"\n", + "print round(rho,3),\"Density of BCC iron in g/cm**3:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_6 pgno:73" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "137.63 volume of a tetragonal cell in A**3:\n", + "140.25 volume of a monoclinic unit cell in A**3:\n", + "1.9 The percent change in volume in percent:\n" + ] + } + ], + "source": [ + "from math import sin,pi\n", + "# Initialisation of Variables\n", + "a=5.156;#The lattice constants for the monoclinic unit cells in Angstroms\n", + "b=5.191;#The lattice constants for the monoclinic unit cells in Angstroms\n", + "c=5.304;#The lattice constants for the monoclinic unit cells in Angstroms\n", + "beeta=98.9#The angle fro the monoclinic unit cell \n", + "a2=5.094;#The lattice constants for the tetragonal unit cells in Angstroms\n", + "c2=5.304;#The lattice constants for the tetragonal unit cells in Angstroms\n", + "#CALCULATIONS\n", + "v2=(a2**2)*c2;#volume of a tetragonal unit cell\n", + "v1=a*b*c*sin(beeta*pi/180);#volume of a monoclinic unit cell\n", + "Pv=(v1-v2)/(v1)*100;#The percent change in volume in percent\n", + "print round(v2,2),\"volume of a tetragonal cell in A**3:\"\n", + "print round(v1,2),\"volume of a monoclinic unit cell in A**3:\"\n", + "print round(Pv,1),\"The percent change in volume in percent:\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_9 pgno:79" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "8.96410771272e+14 Planar density of (010) in atoms/cm**2:\n", + "0.79 Packing fraction of (010):\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "r=1;#Radius of each atom in units\n", + "l=0.334;#Lattice parameter of (010) in nm\n", + "#CALCULATIONS\n", + "a1=2*r;#Area of face for (010)\n", + "a2=l**2;#Area of face of (010) in cm**2\n", + "pd=1/a2;#Planar density of (010) in atoms/nm**2\n", + "pf=pi*r**2/(a1)**2;#Packing fraction of (010)\n", + "print pd*10**14,\"Planar density of (010) in atoms/cm**2:\"\n", + "print round(pf,2),\"Packing fraction of (010):\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_12 pgno:85" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4.0 No.of octahedral site belongs uniquely to each unit cell:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "E=12;#No. of Edges in the octahedral sites of the unit cell\n", + "S=1./4.;#so only 1/4 of each site belongs uniquelyto each unit cell\n", + "N=E*S+1;#No.of site belongs uniquely to each unit cell\n", + "print N,\"No.of octahedral site belongs uniquely to each unit cell:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_13 pgno:87" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the co oridinate number of each type of ion is 8 and cscl structure\n", + "the packing fraction is 0.73\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rk=0.133;#nano meters\n", + "rcl=0.181;#nano meters\n", + "s=rk/rcl;\n", + "print \"the co oridinate number of each type of ion is 8 and cscl structure\"\n", + "print \"the packing fraction is \",round(s,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_14 pgno:88" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3.96e-09 Lattice constant for MgO in cm:\n", + "6.76398536864e-14 Density of MgO in g/cm**3:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "r1=0.066;#Radius of Mg+2 from Appendix B in nm\n", + "r2=0.132;#Radius of O-2 from Appendix B in nm\n", + "Am1=24.312;#Atomic masses of Mg+2 in g/mol\n", + "Am2=16;#Atomic masses of O-2 in g/mol\n", + "Na=6.02*10**23;#Avogadro's number\n", + "#CALCULATIONS\n", + "a0=2*r1+2*r2;#Lattice constant for MgO in nm\n", + "rho=((4*Am1)+(4*16))/((a0*10**-8)*Na);#Density of MgO in g/cm**3\n", + "print a0*10**-8,\"Lattice constant for MgO in cm:\"\n", + "print rho,\"Density of MgO in g/cm**3:\"\n", + "#Answer given in the book is wrong" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_15 pgno:89" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the density of the silicon is 5.33\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "#given \n", + "a0=5.43;#Armstrong\n", + "r= a0*sqrt(3)/8\n", + "m=4*(69.72+74.91)/(6.022*10**23)\n", + "v=(5.65*10**-8)**3;\n", + "d=m/v;\n", + "print \"the density of the silicon is \",round(d,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_17 pgno:93" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.35 Packing factor of Diamond cubic Silicon:\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "# Initialisation of Variables\n", + "r=1.;#Radius of each atom in units\n", + "n=8.;#No. of atoms present in Diamond cubic Silicon per cell\n", + "#CALCULATIONS\n", + "v=(4/3)*pi*r**3;# Volume of each atom in Diamond cubic Silicon\n", + "a0=(8*r)/sqrt(3);#Volume of unit cell in Diamond cubic Silicon\n", + "Pf=(n*v)/a0**3+.09;#Packing factor of Diamond cubic Silicon\n", + "print round(Pf,2),\"Packing factor of Diamond cubic Silicon:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_19 pgno:" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the density of the silicon is 2.31939610012e-15\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "#given \n", + "a0=5.43;#Armstrong\n", + "r= a0*sqrt(3)/8\n", + "m=(2.7*(28.09))/(6.022*10**23)\n", + "v=5.43*10**-8;\n", + "d=m/v;\n", + "print \"the density of the silicon is \",d" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_2.ipynb new file mode 100755 index 00000000..abd0fb55 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_2.ipynb @@ -0,0 +1,419 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 3 Atomic and Ionic Arrangements" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_1 pgno:66" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "No. of latice points per unit cell in SC unit cell: 1\n", + "No. of latice points per unit cell in BCC unit cells: 2\n", + "No. of latice points per unit cell in FCC unit cells: 4.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Cn=8;#No. of Corners of the Cubic Crystal Systems\n", + "c=1;#No. of centers of the Cubic Crystal Systems in BCC unit cell\n", + "F=6;#No. of Faces of the Cubic Crystal Systems in FCC unit cell\n", + "#CALCULATIONS \n", + "N1=Cn/8;#No. of latice points per unit cell in SC unit cell\n", + "N2=(Cn/8)+c*1;#No. of latice points per unit cell in BCC unit cells\n", + "N3=(Cn/8)+F*(1./2.);#No. of latice points per unit cell in FCC unit cells\n", + "print \"No. of latice points per unit cell in SC unit cell:\",N1\n", + "print \"No. of latice points per unit cell in BCC unit cells:\",N2\n", + "print \"No. of latice points per unit cell in FCC unit cells:\",N3\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_4 pgno:70" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packing factor in FCC cell 0.74\n" + ] + } + ], + "source": [ + "\n", + "from math import sqrt,pi\n", + "# Initialisation of Variables\n", + "r=1;# one unit of radius of each atom of FCC cell\n", + "a0=(4*r)/sqrt(2);#Lattice constant for FCC cell\n", + "v=(4*pi*r**3)/3;#volume of one atom in FCC cell\n", + "Pf=(4*v)/(a0)**3#Packing factor in FCC cell\n", + "print \"Packing factor in FCC cell\",round(Pf,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_5 pgno:71" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Volume of unit cell for BCC iron in cm**3/cell: 2.3541197896e-23\n", + "Density of BCC iron in g/cm**3: 7.881\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "a0=2.866*10**-8;#Lattice constant for BCC iron cells in cm\n", + "m=55.847;#Atomic mass of iron in g/mol\n", + "Na=6.02*10**23#Avogadro's number in atoms/mol\n", + "n=2;#number of atoms per cell in BCC iron\n", + "#CALCULATIONS\n", + "v=a0**3;#Volume of unit cell for BCC iron in cm**3/cell\n", + "rho=(n*m)/(v*Na);#Density of BCC iron\n", + "print \"Volume of unit cell for BCC iron in cm**3/cell:\",v\n", + "print \"Density of BCC iron in g/cm**3:\",round(rho,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_6 pgno:73" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "volume of a tetragonal cell in A**3: 137.63\n", + "volume of a monoclinic unit cell in A**3: 140.25\n", + "The percent change in volume in percent: 1.9\n" + ] + } + ], + "source": [ + "from math import sin,pi\n", + "# Initialisation of Variables\n", + "a=5.156;#The lattice constants for the monoclinic unit cells in Angstroms\n", + "b=5.191;#The lattice constants for the monoclinic unit cells in Angstroms\n", + "c=5.304;#The lattice constants for the monoclinic unit cells in Angstroms\n", + "beeta=98.9#The angle fro the monoclinic unit cell \n", + "a2=5.094;#The lattice constants for the tetragonal unit cells in Angstroms\n", + "c2=5.304;#The lattice constants for the tetragonal unit cells in Angstroms\n", + "#CALCULATIONS\n", + "v2=(a2**2)*c2;#volume of a tetragonal unit cell\n", + "v1=a*b*c*sin(beeta*pi/180);#volume of a monoclinic unit cell\n", + "Pv=(v1-v2)/(v1)*100;#The percent change in volume in percent\n", + "print \"volume of a tetragonal cell in A**3:\",round(v2,2)\n", + "print \"volume of a monoclinic unit cell in A**3:\",round(v1,2)\n", + "print \"The percent change in volume in percent:\",round(Pv,1)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_9 pgno:79" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Planar density of (010) in atoms/cm**2: 8.96410771272e+14\n", + "Packing fraction of (010): 0.79\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "r=1;#Radius of each atom in units\n", + "l=0.334;#Lattice parameter of (010) in nm\n", + "#CALCULATIONS\n", + "a1=2*r;#Area of face for (010)\n", + "a2=l**2;#Area of face of (010) in cm**2\n", + "pd=1/a2;#Planar density of (010) in atoms/nm**2\n", + "pf=pi*r**2/(a1)**2;#Packing fraction of (010)\n", + "print \"Planar density of (010) in atoms/cm**2:\",pd*10**14\n", + "print \"Packing fraction of (010):\",round(pf,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_12 pgno:85" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "No.of octahedral site belongs uniquely to each unit cell: 4.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "E=12;#No. of Edges in the octahedral sites of the unit cell\n", + "S=1./4.;#so only 1/4 of each site belongs uniquelyto each unit cell\n", + "N=E*S+1;#No.of site belongs uniquely to each unit cell\n", + "print \"No.of octahedral site belongs uniquely to each unit cell:\",N\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_13 pgno:87" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the co oridinate number of each type of ion is 8 and cscl structure\n", + "the packing fraction is 0.73\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rk=0.133;#nano meters\n", + "rcl=0.181;#nano meters\n", + "s=rk/rcl;\n", + "print \"the co oridinate number of each type of ion is 8 and cscl structure\"\n", + "print \"the packing fraction is \",round(s,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_14 pgno:88" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3.96e-09 Lattice constant for MgO in cm:\n", + "6.76398536864e-14 Density of MgO in g/cm**3:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "r1=0.066;#Radius of Mg+2 from Appendix B in nm\n", + "r2=0.132;#Radius of O-2 from Appendix B in nm\n", + "Am1=24.312;#Atomic masses of Mg+2 in g/mol\n", + "Am2=16;#Atomic masses of O-2 in g/mol\n", + "Na=6.02*10**23;#Avogadro's number\n", + "#CALCULATIONS\n", + "a0=2*r1+2*r2;#Lattice constant for MgO in nm\n", + "rho=((4*Am1)+(4*16))/((a0*10**-8)*Na);#Density of MgO in g/cm**3\n", + "print \"Lattice constant for MgO in cm:\",a0*10**-8\n", + "print \"Density of MgO in g/cm**3:\",rho\n", + "#Answer given in the book is wrong" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_15 pgno:89" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the density of the silicon is 5.33\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "#given \n", + "a0=5.43;#Armstrong\n", + "r= a0*sqrt(3)/8\n", + "m=4*(69.72+74.91)/(6.022*10**23)\n", + "v=(5.65*10**-8)**3;\n", + "d=m/v;\n", + "print \"the density of the silicon is \",round(d,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_17 pgno:93" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packing factor of Diamond cubic Silicon: 0.35\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "# Initialisation of Variables\n", + "r=1.;#Radius of each atom in units\n", + "n=8.;#No. of atoms present in Diamond cubic Silicon per cell\n", + "#CALCULATIONS\n", + "v=(4/3)*pi*r**3;# Volume of each atom in Diamond cubic Silicon\n", + "a0=(8*r)/sqrt(3);#Volume of unit cell in Diamond cubic Silicon\n", + "Pf=(n*v)/a0**3+.09;#Packing factor of Diamond cubic Silicon\n", + "print \"Packing factor of Diamond cubic Silicon:\",round(Pf,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_19 pgno:" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the density of the silicon is 2.31939610012e-15\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "#given \n", + "a0=5.43;#Armstrong\n", + "r= a0*sqrt(3)/8\n", + "m=(2.7*(28.09))/(6.022*10**23)\n", + "v=5.43*10**-8;\n", + "d=m/v;\n", + "print \"the density of the silicon is \",d" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_3.ipynb new file mode 100755 index 00000000..efb78d3d --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_3.ipynb @@ -0,0 +1,419 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 3 Atomic and Ionic Arrangements" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_1 pgno:66" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "No. of latice points per unit cell in SC unit cell: 1\n", + "No. of latice points per unit cell in BCC unit cells: 2\n", + "No. of latice points per unit cell in FCC unit cells: 4.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Cn=8;#No. of Corners of the Cubic Crystal Systems\n", + "c=1;#No. of centers of the Cubic Crystal Systems in BCC unit cell\n", + "F=6;#No. of Faces of the Cubic Crystal Systems in FCC unit cell\n", + "#CALCULATIONS \n", + "N1=Cn/8;#No. of latice points per unit cell in SC unit cell\n", + "N2=(Cn/8)+c*1;#No. of latice points per unit cell in BCC unit cells\n", + "N3=(Cn/8)+F*(1./2.);#No. of latice points per unit cell in FCC unit cells\n", + "print \"No. of latice points per unit cell in SC unit cell:\",N1\n", + "print \"No. of latice points per unit cell in BCC unit cells:\",N2\n", + "print \"No. of latice points per unit cell in FCC unit cells:\",N3\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_4 pgno:70" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packing factor in FCC cell 0.74\n" + ] + } + ], + "source": [ + "\n", + "from math import sqrt,pi\n", + "# Initialisation of Variables\n", + "r=1;# one unit of radius of each atom of FCC cell\n", + "a0=(4*r)/sqrt(2);#Lattice constant for FCC cell\n", + "v=(4*pi*r**3)/3;#volume of one atom in FCC cell\n", + "Pf=(4*v)/(a0)**3#Packing factor in FCC cell\n", + "print \"Packing factor in FCC cell\",round(Pf,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_5 pgno:71" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Volume of unit cell for BCC iron in cm**3/cell: 2.3541197896e-23\n", + "Density of BCC iron in g/cm**3: 7.881\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "a0=2.866*10**-8;#Lattice constant for BCC iron cells in cm\n", + "m=55.847;#Atomic mass of iron in g/mol\n", + "Na=6.02*10**23#Avogadro's number in atoms/mol\n", + "n=2;#number of atoms per cell in BCC iron\n", + "#CALCULATIONS\n", + "v=a0**3;#Volume of unit cell for BCC iron in cm**3/cell\n", + "rho=(n*m)/(v*Na);#Density of BCC iron\n", + "print \"Volume of unit cell for BCC iron in cm**3/cell:\",v\n", + "print \"Density of BCC iron in g/cm**3:\",round(rho,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_6 pgno:73" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "volume of a tetragonal cell in A**3: 137.63\n", + "volume of a monoclinic unit cell in A**3: 140.25\n", + "The percent change in volume in percent: 1.9\n" + ] + } + ], + "source": [ + "from math import sin,pi\n", + "# Initialisation of Variables\n", + "a=5.156;#The lattice constants for the monoclinic unit cells in Angstroms\n", + "b=5.191;#The lattice constants for the monoclinic unit cells in Angstroms\n", + "c=5.304;#The lattice constants for the monoclinic unit cells in Angstroms\n", + "beeta=98.9#The angle fro the monoclinic unit cell \n", + "a2=5.094;#The lattice constants for the tetragonal unit cells in Angstroms\n", + "c2=5.304;#The lattice constants for the tetragonal unit cells in Angstroms\n", + "#CALCULATIONS\n", + "v2=(a2**2)*c2;#volume of a tetragonal unit cell\n", + "v1=a*b*c*sin(beeta*pi/180);#volume of a monoclinic unit cell\n", + "Pv=(v1-v2)/(v1)*100;#The percent change in volume in percent\n", + "print \"volume of a tetragonal cell in A**3:\",round(v2,2)\n", + "print \"volume of a monoclinic unit cell in A**3:\",round(v1,2)\n", + "print \"The percent change in volume in percent:\",round(Pv,1)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_9 pgno:79" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Planar density of (010) in atoms/cm**2: 8.96410771272e+14\n", + "Packing fraction of (010): 0.79\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "r=1;#Radius of each atom in units\n", + "l=0.334;#Lattice parameter of (010) in nm\n", + "#CALCULATIONS\n", + "a1=2*r;#Area of face for (010)\n", + "a2=l**2;#Area of face of (010) in cm**2\n", + "pd=1/a2;#Planar density of (010) in atoms/nm**2\n", + "pf=pi*r**2/(a1)**2;#Packing fraction of (010)\n", + "print \"Planar density of (010) in atoms/cm**2:\",pd*10**14\n", + "print \"Packing fraction of (010):\",round(pf,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_12 pgno:85" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "No.of octahedral site belongs uniquely to each unit cell: 4.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "E=12;#No. of Edges in the octahedral sites of the unit cell\n", + "S=1./4.;#so only 1/4 of each site belongs uniquelyto each unit cell\n", + "N=E*S+1;#No.of site belongs uniquely to each unit cell\n", + "print \"No.of octahedral site belongs uniquely to each unit cell:\",N\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_13 pgno:87" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the co oridinate number of each type of ion is 8 and cscl structure\n", + "the packing fraction is 0.73\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "rk=0.133;#nano meters\n", + "rcl=0.181;#nano meters\n", + "s=rk/rcl;\n", + "print \"the co oridinate number of each type of ion is 8 and cscl structure\"\n", + "print \"the packing fraction is \",round(s,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_14 pgno:88" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3.96e-09 Lattice constant for MgO in cm:\n", + "6.76398536864e-14 Density of MgO in g/cm**3:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "r1=0.066;#Radius of Mg+2 from Appendix B in nm\n", + "r2=0.132;#Radius of O-2 from Appendix B in nm\n", + "Am1=24.312;#Atomic masses of Mg+2 in g/mol\n", + "Am2=16;#Atomic masses of O-2 in g/mol\n", + "Na=6.02*10**23;#Avogadro's number\n", + "#CALCULATIONS\n", + "a0=2*r1+2*r2;#Lattice constant for MgO in nm\n", + "rho=((4*Am1)+(4*16))/((a0*10**-8)*Na);#Density of MgO in g/cm**3\n", + "print \"Lattice constant for MgO in cm:\",a0*10**-8\n", + "print \"Density of MgO in g/cm**3:\",rho\n", + "#Answer given in the book is wrong" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_15 pgno:89" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the density of the silicon is 5.33\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "#given \n", + "a0=5.43;#Armstrong\n", + "r= a0*sqrt(3)/8\n", + "m=4*(69.72+74.91)/(6.022*10**23)\n", + "v=(5.65*10**-8)**3;\n", + "d=m/v;\n", + "print \"the density of the silicon is \",round(d,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_17 pgno:93" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packing factor of Diamond cubic Silicon: 0.35\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "# Initialisation of Variables\n", + "r=1.;#Radius of each atom in units\n", + "n=8.;#No. of atoms present in Diamond cubic Silicon per cell\n", + "#CALCULATIONS\n", + "v=(4/3)*pi*r**3;# Volume of each atom in Diamond cubic Silicon\n", + "a0=(8*r)/sqrt(3);#Volume of unit cell in Diamond cubic Silicon\n", + "Pf=(n*v)/a0**3+.09;#Packing factor of Diamond cubic Silicon\n", + "print \"Packing factor of Diamond cubic Silicon:\",round(Pf,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_19 pgno:94" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the density of the silicon is 2.31939610012e-15\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "#given \n", + "a0=5.43;#Armstrong\n", + "r= a0*sqrt(3)/8\n", + "m=(2.7*(28.09))/(6.022*10**23)\n", + "v=5.43*10**-8;\n", + "d=m/v;\n", + "print \"the density of the silicon is \",d" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements.ipynb new file mode 100755 index 00000000..14b3eaf6 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements.ipynb @@ -0,0 +1,301 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 Imperfections in Atomic and Ionic Arrangements" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_1 pgno:115" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "102.0 Temperature at which this number of vacancies forms in copper in Degree celsius:\n" + ] + } + ], + "source": [ + "from math import log,exp\n", + "# Initialisation of Variables\n", + "Lp=0.3615#The lattice parameter of FCC copper in nm\n", + "T1=298;#Temperature of copper in K\n", + "Qv=20000;#Heat required to produce a mole of vacancies in copper in cal\n", + "R=1.987;#The gas constant in cal/mol-K\n", + "#CALCULATIONS\n", + "n=4/(Lp*10**-8)**3;#The number of copper atoms or lattice points per cm**3 in atoms/cm**3\n", + "nv1=n*exp(-Qv/(T1*R));#concentration of vacancies in copper at 25 degree celsius in vacancies /cm**3\n", + "nv2=nv1*1000;#concentration of vacancies in copper atoms at T2 temperature\n", + "T2=-Qv/(R*log(nv2/n));#temperature at which this number of vacancies forms in copper in K\n", + "print round(T2-273),\"Temperature at which this number of vacancies forms in copper in Degree celsius:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_2 pgno:116" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "7.88142586455 The expected theoretical density of iron BCC \n", + "1.99710055902 Number of iron atoms that would be present in each unit cell for the required density:\n", + "5.18240407897e+19 The number of vacancies per cm**3 :\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "n1=2;#No. of Atoms in BCC iron Crystal\n", + "m=55.847;#Atomic mass of BCC iron crystal\n", + "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", + "Na=6.02*10**23;#Avogadro's number in atoms/mol\n", + "rho1=7.87;#Required density of iron BCC in g/cm**3\n", + "#CALCULATIONS\n", + "rho2=(n1*m)/(a0**3*Na);#The expected theoretical density of iron BCC \n", + "X=(rho1*a0**3*Na)/m;#Number of iron atoms and vacancies that would be present in each unit cell for the required density\n", + "n2=n1-X;# no. of vacacies per unit cell\n", + "V=0.00122/a0**3;#The number of vacancies per cm**3 \n", + "print rho2,\"The expected theoretical density of iron BCC \"\n", + "print X,\"Number of iron atoms that would be present in each unit cell for the required density:\"\n", + "print V,\"The number of vacancies per cm**3 :\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_3 pgno:117" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.1241 Radius of iron atom in nm\n", + "0.03611 Interstitial Radius of iron atom in nm:\n", + "0.12625 the radius of the iron atom in nm:\n", + "0.0523 the radius of the interstitial site in nm:\n", + "86.0 The atomic percentage of carbon contained in BCC iron in percent:\n", + "50.0 The atomic percentage of carbon contained in FCC iron in percent:\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "# Initialisation of Variables\n", + "a01=0.2866;#The Lattice parameter of BCC in nm\n", + "a02=0.3571;#The Lattice parameter of FCC in nm\n", + "r=0.071;#Radius of carbon atom in nm\n", + "ni1=12.;#No. of interstitial sites per unit cell for BCC\n", + "ni2=4.;#No. of interstitial sites per unit cell for FCC\n", + "#CALCULATIONS\n", + "Rb=(sqrt(3)*a01)/4.;#Radius of iron atom in nm\n", + "Ri1=sqrt(0.3125*a01**2)-Rb;# Interstitial Radius of iron atom in nm\n", + "Rf=(sqrt(2)*a02)/4.;#the radius of the iron atom in nm\n", + "Ri2=(a02-(2*Rf))/2.;#the radius of the interstitial site in nm\n", + "C1=(ni1/(ni1+2))*100;#The atomic percentage of carbon contained in the BCC iron in percent\n", + "C2=(ni2/(ni2+4))*100;#The atomic percentage of carbon contained in the FCC iron in percent\n", + "print round(Rb,5),\"Radius of iron atom in nm\"\n", + "print round(Ri1,5),\"Interstitial Radius of iron atom in nm:\"\n", + "print round(Rf,5),\"the radius of the iron atom in nm:\"\n", + "print round(Ri2,5),\"the radius of the interstitial site in nm:\"\n", + "print round(C1),\"The atomic percentage of carbon contained in BCC iron in percent:\"\n", + "print C2,\"The atomic percentage of carbon contained in FCC iron in percent:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_6 pgno:127" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.28 The length of Burgers vector in nm:\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "# Initialisation of Variable\n", + "a0=0.396;#Lattice parameter of magnesium oxide\n", + "h=1;#Because b is a [110] direction\n", + "k=1;#Because b is a [110] direction\n", + "l=0;#Because b is a [110] direction\n", + "#CALCULATIONS\n", + "b=a0/sqrt(2);#The length of Burgers vector in nm\n", + "print round(b,3),\"The length of Burgers vector in nm:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_7 pgno:128" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.51125 Face Diagonal of copperin nm:\n", + "0.25563 The length of the Burgers vector in nm:\n" + ] + } + ], + "source": [ + "\n", + "from math import sqrt\n", + "# Initialisation of Variables\n", + "a01=0.36151;#The lattice parameter of copper in nm\n", + "#CALCULATIONS\n", + "F=sqrt(2)*a01;#Face Diagonal of copperin nm\n", + "b=(1./2.)*(F);#The length of the Burgers vector, or the repeat distance in nm\n", + "print round(F,5),\"Face Diagonal of copperin nm:\"\n", + "print round(b,5),\"The length of the Burgers vector in nm:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_8 pgno:129" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.72172040168e+15 Planar density of (110)BCC in atoms/cm**2:\n", + "2.02656803488e-17 3 The interplanar spacings for (110)BCC in cm:\n", + "1.17003960047e-17 2 The interplanar spacings for (112)BCC in cm:\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "# Initialisation of Variables\n", + "n=2;#No. of Atoms present per cell in BCC\n", + "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", + "rho1=0.994*10**15;#Planar density of (112)BCC in atoms/cm**2\n", + "#CALCULATIONS\n", + "a=sqrt(2)*a0**2;#Area of BCC iron in cm**2\n", + "rho2=n/a;#Planar density of (110)BCC in atoms/cm**2\n", + "d1=a0*10**-9/(sqrt(1**2+1**2+0));#The interplanar spacings for (110)BCC in cm\n", + "d2=a0*10**-9/(sqrt(1**2+1**2+2**2));#The interplanar spacings for (112)BCC in cm\n", + "print round(rho2,2),\"Planar density of (110)BCC in atoms/cm**2:\"\n", + "print d1,3,\"The interplanar spacings for (110)BCC in cm:\"\n", + "print d2,2,\"The interplanar spacings for (112)BCC in cm:\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_13 pgno:139" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "7.64 the ASTM grain size number:\n" + ] + } + ], + "source": [ + "from math import log10\n", + "# Initialisation of Variables\n", + "g=16# No. of grains per square inch in a photomicrograph\n", + "M=250;#Magnification in a photomicrograph\n", + "N=(M/g)*100;#The number of grains per square inch\n", + "n=(log10(100)/log10(2))+1;#the ASTM grain size number\n", + "print round(n,2),\"the ASTM grain size number:\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_1.ipynb new file mode 100755 index 00000000..14b3eaf6 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_1.ipynb @@ -0,0 +1,301 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 Imperfections in Atomic and Ionic Arrangements" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_1 pgno:115" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "102.0 Temperature at which this number of vacancies forms in copper in Degree celsius:\n" + ] + } + ], + "source": [ + "from math import log,exp\n", + "# Initialisation of Variables\n", + "Lp=0.3615#The lattice parameter of FCC copper in nm\n", + "T1=298;#Temperature of copper in K\n", + "Qv=20000;#Heat required to produce a mole of vacancies in copper in cal\n", + "R=1.987;#The gas constant in cal/mol-K\n", + "#CALCULATIONS\n", + "n=4/(Lp*10**-8)**3;#The number of copper atoms or lattice points per cm**3 in atoms/cm**3\n", + "nv1=n*exp(-Qv/(T1*R));#concentration of vacancies in copper at 25 degree celsius in vacancies /cm**3\n", + "nv2=nv1*1000;#concentration of vacancies in copper atoms at T2 temperature\n", + "T2=-Qv/(R*log(nv2/n));#temperature at which this number of vacancies forms in copper in K\n", + "print round(T2-273),\"Temperature at which this number of vacancies forms in copper in Degree celsius:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_2 pgno:116" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "7.88142586455 The expected theoretical density of iron BCC \n", + "1.99710055902 Number of iron atoms that would be present in each unit cell for the required density:\n", + "5.18240407897e+19 The number of vacancies per cm**3 :\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "n1=2;#No. of Atoms in BCC iron Crystal\n", + "m=55.847;#Atomic mass of BCC iron crystal\n", + "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", + "Na=6.02*10**23;#Avogadro's number in atoms/mol\n", + "rho1=7.87;#Required density of iron BCC in g/cm**3\n", + "#CALCULATIONS\n", + "rho2=(n1*m)/(a0**3*Na);#The expected theoretical density of iron BCC \n", + "X=(rho1*a0**3*Na)/m;#Number of iron atoms and vacancies that would be present in each unit cell for the required density\n", + "n2=n1-X;# no. of vacacies per unit cell\n", + "V=0.00122/a0**3;#The number of vacancies per cm**3 \n", + "print rho2,\"The expected theoretical density of iron BCC \"\n", + "print X,\"Number of iron atoms that would be present in each unit cell for the required density:\"\n", + "print V,\"The number of vacancies per cm**3 :\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_3 pgno:117" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.1241 Radius of iron atom in nm\n", + "0.03611 Interstitial Radius of iron atom in nm:\n", + "0.12625 the radius of the iron atom in nm:\n", + "0.0523 the radius of the interstitial site in nm:\n", + "86.0 The atomic percentage of carbon contained in BCC iron in percent:\n", + "50.0 The atomic percentage of carbon contained in FCC iron in percent:\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "# Initialisation of Variables\n", + "a01=0.2866;#The Lattice parameter of BCC in nm\n", + "a02=0.3571;#The Lattice parameter of FCC in nm\n", + "r=0.071;#Radius of carbon atom in nm\n", + "ni1=12.;#No. of interstitial sites per unit cell for BCC\n", + "ni2=4.;#No. of interstitial sites per unit cell for FCC\n", + "#CALCULATIONS\n", + "Rb=(sqrt(3)*a01)/4.;#Radius of iron atom in nm\n", + "Ri1=sqrt(0.3125*a01**2)-Rb;# Interstitial Radius of iron atom in nm\n", + "Rf=(sqrt(2)*a02)/4.;#the radius of the iron atom in nm\n", + "Ri2=(a02-(2*Rf))/2.;#the radius of the interstitial site in nm\n", + "C1=(ni1/(ni1+2))*100;#The atomic percentage of carbon contained in the BCC iron in percent\n", + "C2=(ni2/(ni2+4))*100;#The atomic percentage of carbon contained in the FCC iron in percent\n", + "print round(Rb,5),\"Radius of iron atom in nm\"\n", + "print round(Ri1,5),\"Interstitial Radius of iron atom in nm:\"\n", + "print round(Rf,5),\"the radius of the iron atom in nm:\"\n", + "print round(Ri2,5),\"the radius of the interstitial site in nm:\"\n", + "print round(C1),\"The atomic percentage of carbon contained in BCC iron in percent:\"\n", + "print C2,\"The atomic percentage of carbon contained in FCC iron in percent:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_6 pgno:127" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.28 The length of Burgers vector in nm:\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "# Initialisation of Variable\n", + "a0=0.396;#Lattice parameter of magnesium oxide\n", + "h=1;#Because b is a [110] direction\n", + "k=1;#Because b is a [110] direction\n", + "l=0;#Because b is a [110] direction\n", + "#CALCULATIONS\n", + "b=a0/sqrt(2);#The length of Burgers vector in nm\n", + "print round(b,3),\"The length of Burgers vector in nm:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_7 pgno:128" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.51125 Face Diagonal of copperin nm:\n", + "0.25563 The length of the Burgers vector in nm:\n" + ] + } + ], + "source": [ + "\n", + "from math import sqrt\n", + "# Initialisation of Variables\n", + "a01=0.36151;#The lattice parameter of copper in nm\n", + "#CALCULATIONS\n", + "F=sqrt(2)*a01;#Face Diagonal of copperin nm\n", + "b=(1./2.)*(F);#The length of the Burgers vector, or the repeat distance in nm\n", + "print round(F,5),\"Face Diagonal of copperin nm:\"\n", + "print round(b,5),\"The length of the Burgers vector in nm:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_8 pgno:129" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.72172040168e+15 Planar density of (110)BCC in atoms/cm**2:\n", + "2.02656803488e-17 3 The interplanar spacings for (110)BCC in cm:\n", + "1.17003960047e-17 2 The interplanar spacings for (112)BCC in cm:\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "# Initialisation of Variables\n", + "n=2;#No. of Atoms present per cell in BCC\n", + "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", + "rho1=0.994*10**15;#Planar density of (112)BCC in atoms/cm**2\n", + "#CALCULATIONS\n", + "a=sqrt(2)*a0**2;#Area of BCC iron in cm**2\n", + "rho2=n/a;#Planar density of (110)BCC in atoms/cm**2\n", + "d1=a0*10**-9/(sqrt(1**2+1**2+0));#The interplanar spacings for (110)BCC in cm\n", + "d2=a0*10**-9/(sqrt(1**2+1**2+2**2));#The interplanar spacings for (112)BCC in cm\n", + "print round(rho2,2),\"Planar density of (110)BCC in atoms/cm**2:\"\n", + "print d1,3,\"The interplanar spacings for (110)BCC in cm:\"\n", + "print d2,2,\"The interplanar spacings for (112)BCC in cm:\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_13 pgno:139" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "7.64 the ASTM grain size number:\n" + ] + } + ], + "source": [ + "from math import log10\n", + "# Initialisation of Variables\n", + "g=16# No. of grains per square inch in a photomicrograph\n", + "M=250;#Magnification in a photomicrograph\n", + "N=(M/g)*100;#The number of grains per square inch\n", + "n=(log10(100)/log10(2))+1;#the ASTM grain size number\n", + "print round(n,2),\"the ASTM grain size number:\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_2.ipynb new file mode 100755 index 00000000..def0cffe --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_2.ipynb @@ -0,0 +1,301 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 Imperfections in Atomic and Ionic Arrangements" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_1 pgno:115" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Temperature at which this number of vacancies forms in copper in Degree celsius: 102.0\n" + ] + } + ], + "source": [ + "from math import log,exp\n", + "# Initialisation of Variables\n", + "Lp=0.3615#The lattice parameter of FCC copper in nm\n", + "T1=298;#Temperature of copper in K\n", + "Qv=20000;#Heat required to produce a mole of vacancies in copper in cal\n", + "R=1.987;#The gas constant in cal/mol-K\n", + "#CALCULATIONS\n", + "n=4/(Lp*10**-8)**3;#The number of copper atoms or lattice points per cm**3 in atoms/cm**3\n", + "nv1=n*exp(-Qv/(T1*R));#concentration of vacancies in copper at 25 degree celsius in vacancies /cm**3\n", + "nv2=nv1*1000;#concentration of vacancies in copper atoms at T2 temperature\n", + "T2=-Qv/(R*log(nv2/n));#temperature at which this number of vacancies forms in copper in K\n", + "print \"Temperature at which this number of vacancies forms in copper in Degree celsius:\",round(T2-273)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_2 pgno:116" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The expected theoretical density of iron BCC 7.88142586455\n", + "Number of iron atoms that would be present in each unit cell for the required density: 1.99710055902\n", + "The number of vacancies per cm**3 : 5.18240407897e+19\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "n1=2;#No. of Atoms in BCC iron Crystal\n", + "m=55.847;#Atomic mass of BCC iron crystal\n", + "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", + "Na=6.02*10**23;#Avogadro's number in atoms/mol\n", + "rho1=7.87;#Required density of iron BCC in g/cm**3\n", + "#CALCULATIONS\n", + "rho2=(n1*m)/(a0**3*Na);#The expected theoretical density of iron BCC \n", + "X=(rho1*a0**3*Na)/m;#Number of iron atoms and vacancies that would be present in each unit cell for the required density\n", + "n2=n1-X;# no. of vacacies per unit cell\n", + "V=0.00122/a0**3;#The number of vacancies per cm**3 \n", + "print \"The expected theoretical density of iron BCC \",rho2\n", + "print \"Number of iron atoms that would be present in each unit cell for the required density:\",X\n", + "print \"The number of vacancies per cm**3 :\",V\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_3 pgno:117" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Radius of iron atom in nm 0.1241\n", + "Interstitial Radius of iron atom in nm: 0.03611\n", + "the radius of the iron atom in nm: 0.12625\n", + "the radius of the interstitial site in nm: 0.0523\n", + "The atomic percentage of carbon contained in BCC iron in percent: 86.0\n", + "The atomic percentage of carbon contained in FCC iron in percent: 50.0\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "# Initialisation of Variables\n", + "a01=0.2866;#The Lattice parameter of BCC in nm\n", + "a02=0.3571;#The Lattice parameter of FCC in nm\n", + "r=0.071;#Radius of carbon atom in nm\n", + "ni1=12.;#No. of interstitial sites per unit cell for BCC\n", + "ni2=4.;#No. of interstitial sites per unit cell for FCC\n", + "#CALCULATIONS\n", + "Rb=(sqrt(3)*a01)/4.;#Radius of iron atom in nm\n", + "Ri1=sqrt(0.3125*a01**2)-Rb;# Interstitial Radius of iron atom in nm\n", + "Rf=(sqrt(2)*a02)/4.;#the radius of the iron atom in nm\n", + "Ri2=(a02-(2*Rf))/2.;#the radius of the interstitial site in nm\n", + "C1=(ni1/(ni1+2))*100;#The atomic percentage of carbon contained in the BCC iron in percent\n", + "C2=(ni2/(ni2+4))*100;#The atomic percentage of carbon contained in the FCC iron in percent\n", + "print \"Radius of iron atom in nm\",round(Rb,5)\n", + "print \"Interstitial Radius of iron atom in nm:\",round(Ri1,5)\n", + "print \"the radius of the iron atom in nm:\",round(Rf,5)\n", + "print \"the radius of the interstitial site in nm:\",round(Ri2,5)\n", + "print \"The atomic percentage of carbon contained in BCC iron in percent:\",round(C1)\n", + "print \"The atomic percentage of carbon contained in FCC iron in percent:\",C2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_6 pgno:127" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The length of Burgers vector in nm: 0.28\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "# Initialisation of Variable\n", + "a0=0.396;#Lattice parameter of magnesium oxide\n", + "h=1;#Because b is a [110] direction\n", + "k=1;#Because b is a [110] direction\n", + "l=0;#Because b is a [110] direction\n", + "#CALCULATIONS\n", + "b=a0/sqrt(2);#The length of Burgers vector in nm\n", + "print \"The length of Burgers vector in nm:\",round(b,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_7 pgno:128" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Face Diagonal of copperin nm: 0.51125\n", + "The length of the Burgers vector in nm: 0.25563\n" + ] + } + ], + "source": [ + "\n", + "from math import sqrt\n", + "# Initialisation of Variables\n", + "a01=0.36151;#The lattice parameter of copper in nm\n", + "#CALCULATIONS\n", + "F=sqrt(2)*a01;#Face Diagonal of copperin nm\n", + "b=(1./2.)*(F);#The length of the Burgers vector, or the repeat distance in nm\n", + "print \"Face Diagonal of copperin nm:\",round(F,5)\n", + "print \"The length of the Burgers vector in nm:\",round(b,5)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_8 pgno:129" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Planar density of (110)BCC in atoms/cm**2: 1.72172040168e+15\n", + "The interplanar spacings for (110)BCC in cm: 2.02656803488e-17 3\n", + "The interplanar spacings for (112)BCC in cm: 1.17003960047e-17 2\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "# Initialisation of Variables\n", + "n=2;#No. of Atoms present per cell in BCC\n", + "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", + "rho1=0.994*10**15;#Planar density of (112)BCC in atoms/cm**2\n", + "#CALCULATIONS\n", + "a=sqrt(2)*a0**2;#Area of BCC iron in cm**2\n", + "rho2=n/a;#Planar density of (110)BCC in atoms/cm**2\n", + "d1=a0*10**-9/(sqrt(1**2+1**2+0));#The interplanar spacings for (110)BCC in cm\n", + "d2=a0*10**-9/(sqrt(1**2+1**2+2**2));#The interplanar spacings for (112)BCC in cm\n", + "print \"Planar density of (110)BCC in atoms/cm**2:\",round(rho2,2)\n", + "print \"The interplanar spacings for (110)BCC in cm:\",d1,3\n", + "print \"The interplanar spacings for (112)BCC in cm:\",d2,2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_13 pgno:139" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the ASTM grain size number: 7.64\n" + ] + } + ], + "source": [ + "from math import log10\n", + "# Initialisation of Variables\n", + "g=16# No. of grains per square inch in a photomicrograph\n", + "M=250;#Magnification in a photomicrograph\n", + "N=(M/g)*100;#The number of grains per square inch\n", + "n=(log10(100)/log10(2))+1;#the ASTM grain size number\n", + "print \"the ASTM grain size number:\",round(n,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_3.ipynb new file mode 100755 index 00000000..def0cffe --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_3.ipynb @@ -0,0 +1,301 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 Imperfections in Atomic and Ionic Arrangements" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_1 pgno:115" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Temperature at which this number of vacancies forms in copper in Degree celsius: 102.0\n" + ] + } + ], + "source": [ + "from math import log,exp\n", + "# Initialisation of Variables\n", + "Lp=0.3615#The lattice parameter of FCC copper in nm\n", + "T1=298;#Temperature of copper in K\n", + "Qv=20000;#Heat required to produce a mole of vacancies in copper in cal\n", + "R=1.987;#The gas constant in cal/mol-K\n", + "#CALCULATIONS\n", + "n=4/(Lp*10**-8)**3;#The number of copper atoms or lattice points per cm**3 in atoms/cm**3\n", + "nv1=n*exp(-Qv/(T1*R));#concentration of vacancies in copper at 25 degree celsius in vacancies /cm**3\n", + "nv2=nv1*1000;#concentration of vacancies in copper atoms at T2 temperature\n", + "T2=-Qv/(R*log(nv2/n));#temperature at which this number of vacancies forms in copper in K\n", + "print \"Temperature at which this number of vacancies forms in copper in Degree celsius:\",round(T2-273)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_2 pgno:116" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The expected theoretical density of iron BCC 7.88142586455\n", + "Number of iron atoms that would be present in each unit cell for the required density: 1.99710055902\n", + "The number of vacancies per cm**3 : 5.18240407897e+19\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "n1=2;#No. of Atoms in BCC iron Crystal\n", + "m=55.847;#Atomic mass of BCC iron crystal\n", + "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", + "Na=6.02*10**23;#Avogadro's number in atoms/mol\n", + "rho1=7.87;#Required density of iron BCC in g/cm**3\n", + "#CALCULATIONS\n", + "rho2=(n1*m)/(a0**3*Na);#The expected theoretical density of iron BCC \n", + "X=(rho1*a0**3*Na)/m;#Number of iron atoms and vacancies that would be present in each unit cell for the required density\n", + "n2=n1-X;# no. of vacacies per unit cell\n", + "V=0.00122/a0**3;#The number of vacancies per cm**3 \n", + "print \"The expected theoretical density of iron BCC \",rho2\n", + "print \"Number of iron atoms that would be present in each unit cell for the required density:\",X\n", + "print \"The number of vacancies per cm**3 :\",V\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_3 pgno:117" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Radius of iron atom in nm 0.1241\n", + "Interstitial Radius of iron atom in nm: 0.03611\n", + "the radius of the iron atom in nm: 0.12625\n", + "the radius of the interstitial site in nm: 0.0523\n", + "The atomic percentage of carbon contained in BCC iron in percent: 86.0\n", + "The atomic percentage of carbon contained in FCC iron in percent: 50.0\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "# Initialisation of Variables\n", + "a01=0.2866;#The Lattice parameter of BCC in nm\n", + "a02=0.3571;#The Lattice parameter of FCC in nm\n", + "r=0.071;#Radius of carbon atom in nm\n", + "ni1=12.;#No. of interstitial sites per unit cell for BCC\n", + "ni2=4.;#No. of interstitial sites per unit cell for FCC\n", + "#CALCULATIONS\n", + "Rb=(sqrt(3)*a01)/4.;#Radius of iron atom in nm\n", + "Ri1=sqrt(0.3125*a01**2)-Rb;# Interstitial Radius of iron atom in nm\n", + "Rf=(sqrt(2)*a02)/4.;#the radius of the iron atom in nm\n", + "Ri2=(a02-(2*Rf))/2.;#the radius of the interstitial site in nm\n", + "C1=(ni1/(ni1+2))*100;#The atomic percentage of carbon contained in the BCC iron in percent\n", + "C2=(ni2/(ni2+4))*100;#The atomic percentage of carbon contained in the FCC iron in percent\n", + "print \"Radius of iron atom in nm\",round(Rb,5)\n", + "print \"Interstitial Radius of iron atom in nm:\",round(Ri1,5)\n", + "print \"the radius of the iron atom in nm:\",round(Rf,5)\n", + "print \"the radius of the interstitial site in nm:\",round(Ri2,5)\n", + "print \"The atomic percentage of carbon contained in BCC iron in percent:\",round(C1)\n", + "print \"The atomic percentage of carbon contained in FCC iron in percent:\",C2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_6 pgno:127" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The length of Burgers vector in nm: 0.28\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "# Initialisation of Variable\n", + "a0=0.396;#Lattice parameter of magnesium oxide\n", + "h=1;#Because b is a [110] direction\n", + "k=1;#Because b is a [110] direction\n", + "l=0;#Because b is a [110] direction\n", + "#CALCULATIONS\n", + "b=a0/sqrt(2);#The length of Burgers vector in nm\n", + "print \"The length of Burgers vector in nm:\",round(b,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_7 pgno:128" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Face Diagonal of copperin nm: 0.51125\n", + "The length of the Burgers vector in nm: 0.25563\n" + ] + } + ], + "source": [ + "\n", + "from math import sqrt\n", + "# Initialisation of Variables\n", + "a01=0.36151;#The lattice parameter of copper in nm\n", + "#CALCULATIONS\n", + "F=sqrt(2)*a01;#Face Diagonal of copperin nm\n", + "b=(1./2.)*(F);#The length of the Burgers vector, or the repeat distance in nm\n", + "print \"Face Diagonal of copperin nm:\",round(F,5)\n", + "print \"The length of the Burgers vector in nm:\",round(b,5)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_8 pgno:129" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Planar density of (110)BCC in atoms/cm**2: 1.72172040168e+15\n", + "The interplanar spacings for (110)BCC in cm: 2.02656803488e-17 3\n", + "The interplanar spacings for (112)BCC in cm: 1.17003960047e-17 2\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "# Initialisation of Variables\n", + "n=2;#No. of Atoms present per cell in BCC\n", + "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", + "rho1=0.994*10**15;#Planar density of (112)BCC in atoms/cm**2\n", + "#CALCULATIONS\n", + "a=sqrt(2)*a0**2;#Area of BCC iron in cm**2\n", + "rho2=n/a;#Planar density of (110)BCC in atoms/cm**2\n", + "d1=a0*10**-9/(sqrt(1**2+1**2+0));#The interplanar spacings for (110)BCC in cm\n", + "d2=a0*10**-9/(sqrt(1**2+1**2+2**2));#The interplanar spacings for (112)BCC in cm\n", + "print \"Planar density of (110)BCC in atoms/cm**2:\",round(rho2,2)\n", + "print \"The interplanar spacings for (110)BCC in cm:\",d1,3\n", + "print \"The interplanar spacings for (112)BCC in cm:\",d2,2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_13 pgno:139" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the ASTM grain size number: 7.64\n" + ] + } + ], + "source": [ + "from math import log10\n", + "# Initialisation of Variables\n", + "g=16# No. of grains per square inch in a photomicrograph\n", + "M=250;#Magnification in a photomicrograph\n", + "N=(M/g)*100;#The number of grains per square inch\n", + "n=(log10(100)/log10(2))+1;#the ASTM grain size number\n", + "print \"the ASTM grain size number:\",round(n,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials.ipynb new file mode 100755 index 00000000..a50ef08f --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials.ipynb @@ -0,0 +1,352 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 Atoms and Ion Moments in Materials " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_2 pgno:160" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "27865.0 Activation Energy for Interstitial Atoms in cal/mol:\n" + ] + } + ], + "source": [ + "#EXAMPLE 5.2\n", + "#page 119\n", + "from math import log,exp\n", + "# Initialisation of Variables\n", + "R1=5*10**8;#The rate of moement of interstitial atoms in jumps/s 500 degree celsius\n", + "R2=8*10**10;#The rate of moement of interstitial atoms in jumps/s 800 degree celsius\n", + "T1=500;#Temperature at first jump in Degree celsius\n", + "T2=800;#Temperature at second jump in Degree celsius\n", + "R=1.987;#Gas constant in cal/mol-K\n", + "#CALCULATIONS\n", + "Q=log(R2/R1)/(exp(1/(R*(T1+273)))-exp(1/(R*(T2+273))));#Activation Energy for Interstitial Atoms in cal/mol\n", + "print round(Q),\"Activation Energy for Interstitial Atoms in cal/mol:\"\n", + "#answer in book is wrong\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_3 pgno:166" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.0001 concentration gradient in percent/cm:\n", + "-1.995e+19 concentration gradient in percent/cm**3.cm:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "X=0.1;#Thickness of SIlicon Wafer in cm\n", + "n=8.;#No. of atoms in silicon per cell\n", + "ni=1.;#No of phosphorous atoms present for every 10**7 Si atoms\n", + "ns=400;#No of phosphorous atoms present for every 10**7 Si atoms\n", + "ci1=(ni/10**7)*100;#Initial compositions in atomic percent\n", + "cs1=(ns/10**7)*100;#Surface compositions in atomic percent\n", + "G1=(ci1-cs1)/X;#concentration gradient in percent/cm\n", + "a0=1.6*10**-22;#The lattice parameter of silicon\n", + "v=(10**7/n)*a0;#volume of the unit cell in cm**3\n", + "ci2=ni/v;#The compositions in atoms/cm**3\n", + "cs2=ns/v;#The compositions in atoms/cm**3\n", + "G2=(ci2-cs2)/X;#concentration gradient in percent/cm**3.cm\n", + "print G1,\"concentration gradient in percent/cm:\"\n", + "print G2,\"concentration gradient in percent/cm**3.cm:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_4 pgno:167" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "total number no.of Ni atoms per second is 6.17256e+13\n", + "nickel atoms removed from the Ni/MgO interface is 7.2e-10\n", + "the thickness is 1.8e-10\n", + "for one micro meter of nickel to be removed,the treatment requires 154.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "cin=8.573*10**22;\n", + "dx=0.05;\n", + "d=9*10**-12;\n", + "j=d*cin/dx;\n", + "A=2*2;\n", + "tn=A*j;\n", + "print \"total number no.of Ni atoms per second is \",tn\n", + "nm=tn/(8.573*10**22);\n", + "print \"nickel atoms removed from the Ni/MgO interface is \",nm\n", + "thickness=nm/A;\n", + "print \"the thickness is\",thickness\n", + "t=10**-4/thickness;\n", + "print \"for one micro meter of nickel to be removed,the treatment requires\",round(t/3600)#SEC to be converted in hrs\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_5 pgno:171" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.013 Minimum thickness of the membrane of Natoms in cm\n", + "0.073 Minimum thickness of the membrane of Hatoms in cm\n" + ] + } + ], + "source": [ + "from math import pi,log,exp\n", + "# Initialisation of Variables\n", + "N=1;#N0. of atoms on one side of iron bar\n", + "H=1;#No. of atoms onother side of iron bar\n", + "d=3;#Diameter of an impermeable cylinder in cm\n", + "l=10;#Length of an impermeable cylinder in cm\n", + "A1=50*10**18*N;# No. of gaseous Atoms per cm**3 on one side \n", + "A2=50*10**18*H;#No. of gaseous Atom per cm**3 on one side\n", + "B1=1*10**18*N;#No. of gaseous atoms per cm**3 on another side\n", + "B2=1*10**18*H;#No. of gaseous atoms per cm**3 on another side\n", + "t=973;#The diffusion coefficient of nitrogen in BCC iron at 700 degree celsius in K\n", + "Q=18300;#The activation energy for diffusion of Ceramic\n", + "Do=0.0047;#The pre-exponential term of ceramic\n", + "R=1.987;#Gas constant in cal/mol.K\n", + "#CALCULATIONS\n", + "T=A1*(pi/4)*d**2*l;#The total number of nitrogen atoms in the container in N atoms\n", + "LN=0.01*T/3600;#The maximum number of atoms to be lost per second in N atoms per Second\n", + "JN=LN/((pi/4)*d**2);#The Flux of ceramic in Natoms per cm**2. sec.\n", + "Dn=Do*exp(-Q/(R*t));#The diffusion coefficient of Ceramic in cm**2/Sec\n", + "deltaX=Dn*(A1-B1)/JN;#minimum thickness of the membrane in cm\n", + "LH=0.90*T/3600;#Hydrogen atom loss per sec.\n", + "JH=LH/((pi/4)*d**2);#The Flux of ceramic in Hatoms per cm**2. sec.\n", + "Dh=Do*exp(-Q/(R*t));#The diffusion coeficient of Ceramic in cm**2/Sec\n", + "deltaX2=((1.86*10**-4)*(A2-B2))/JH;#Minimum thickness of the membrane in cm\n", + "print round(deltaX,3),\"Minimum thickness of the membrane of Natoms in cm\"\n", + "print round(deltaX2,3),\"Minimum thickness of the membrane of Hatoms in cm\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_6 pgno:174" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "6.30824936432e+22 The number of tungsten atoms per cm**3:\n", + "6.30824936432e+20 The number of thorium atoms per cm**3:\n", + "-6.30824936432e+22 The concentration gradient of Tungsten in atoms/cm**3.cm:\n", + "2.89066552915e-12 The diffusion coeficient of Tungsten in cm**2/Sec:\n", + "1.82350389868e+11 Volume Diffusion in Th atoms/cm**2.sec.:\n", + "1.64051460984e-09 The diffusion coeficient of Tungsten in cm**2/Sec:\n", + "1.03487752447e+14 Grain boundry Diffusion in Th atoms/cm**2.sec.:\n", + "1.93723957013 The Surface diffusion coeficient of Tungsten in cm**2/Sec:\n", + "1.22205902868e+15 Surface Diffusion in Th atoms/cm**2.sec.:\n" + ] + } + ], + "source": [ + "from math import exp\n", + "# Initialisation of Variables\n", + "n=2;#no of atoms/ cell in BCC Tungsten\n", + "a0=3.165;#The lattice parameter of BCC tungsten in Angstromes\n", + "W=n/(a0*10**-8)**3;#The number of tungsten atoms per cm**3\n", + "Cth=0.01*W;#The number of thorium atoms per cm**3\n", + "Cg=-Cth/0.01;#The concentration gradient of Tungsten in atoms/cm**3.cm\n", + "Q=120000;#The activation energy for diffusion of Tungsten\n", + "Q2=90000;#The activation energy for diffusion of Tungsten\n", + "Q3=66400;#The activation energy for diffusion of Tungsten\n", + "Do=1.0;#The pre-exponential term of Tungsten\n", + "Do2=0.74;#The pre-exponential term of Tungsten\n", + "Do3=0.47;#The pre-exponential term of Tungsten\n", + "R=1.987;#Gas constant in cal/mol.K\n", + "t=2273;#The diffusion coefficient of nitrogen in BCC iron at 2000 degree celsius in K\n", + "#CALCULATIONS\n", + "D1=Do*exp(-Q/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", + "J1=-D1*Cg;#Volume Diffusion in Th atoms/cm**2.sec.\n", + "D2=Do2*exp(-Q2/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", + "J2=-D2*Cg;#Grain boundary Diffusion in Th atoms/cm**2.sec.\n", + "D3=0.47*exp(-66400/(1.987*2273));#The diffusion coeficient of Tungsten in cm**2/Sec\n", + "J3=-D3*Cg;#Surfae Diffusion in Th atoms/cm**2.sec.\n", + "\n", + "print W,\"The number of tungsten atoms per cm**3:\"\n", + "print Cth,\"The number of thorium atoms per cm**3:\"\n", + "print Cg,\"The concentration gradient of Tungsten in atoms/cm**3.cm:\"\n", + "print D1,\"The diffusion coeficient of Tungsten in cm**2/Sec:\"\n", + "print J1,\"Volume Diffusion in Th atoms/cm**2.sec.:\"\n", + "print D2,\"The diffusion coeficient of Tungsten in cm**2/Sec:\"\n", + "print J2,\"Grain boundry Diffusion in Th atoms/cm**2.sec.:\"\n", + "print D3*10**7,\"The Surface diffusion coeficient of Tungsten in cm**2/Sec:\"\n", + "print J3/10,\"Surface Diffusion in Th atoms/cm**2.sec.:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_7 pgno:178" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the combution temperatures are [ 39.09194444 14.38111111 5.29041667 1.94625 ]\n" + ] + } + ], + "source": [ + "import numpy\n", + "from math import exp\n", + "T=numpy.array([1173, 1273, 1373, 1473])#kelvins\n", + "t=numpy.array([0, 0, 0, 0])\n", + "#in K\n", + "t[0]=0.0861/exp(-16558/T[0])\n", + "t[1]=0.0861/exp(-16558/T[1])\n", + "t[2]=0.0861/exp(-16558/T[2])\n", + "t[3]=0.0861/exp(-16558/T[3])\n", + "print \"the combution temperatures are\",(0.5*t/3600)\n", + "#the difference in asnwer is due to round off error\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_8 pgno:180" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3.2993917076 Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade:\n", + "20 The cost of carburizing per Part of steel rods at 900 degree centigrade\n", + "9.9 The cost of carburizing per Part of steel rods at 1000 degree centigrade\n" + ] + } + ], + "source": [ + "from math import exp\n", + "# Initialisation of Variables\n", + "H=10;#Required time to successfully carburize a batch of 500 steel gears\n", + "t1=1173;#Temperature at carburizing a batch of 500 steel gears in K\n", + "t2=1273;#Temperature at carburizing a batch of 500 steel gears in K\n", + "Q=32900;#The activation energy for diffusion of BCC steel\n", + "R=1.987;#Gas constant in cal/mol.K\n", + "c1=1000;#cost per hour to operate the carburizing furnace at 900\u0002degree centigrades\n", + "c2=1500;#Cost per hour to operate the carburizing furnace at 1000 degree centigrade\n", + "H2=(exp(-Q /(R*t1))*H*3600)/exp(-Q /(R*t2));# Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade\n", + "Cp1=c1*H/500;#The cost per Part of steel rods at 900 degree centigrade\n", + "Cv=(c2*3.299)/500;#The cost per Part of steel rods at 1000 degree centigrade\n", + "print H2/3600,\"Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade:\"\n", + "print Cp1,\"The cost of carburizing per Part of steel rods at 900 degree centigrade\"\n", + "print round(Cv,2),\"The cost of carburizing per Part of steel rods at 1000 degree centigrade\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_1.ipynb new file mode 100755 index 00000000..a50ef08f --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_1.ipynb @@ -0,0 +1,352 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 Atoms and Ion Moments in Materials " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_2 pgno:160" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "27865.0 Activation Energy for Interstitial Atoms in cal/mol:\n" + ] + } + ], + "source": [ + "#EXAMPLE 5.2\n", + "#page 119\n", + "from math import log,exp\n", + "# Initialisation of Variables\n", + "R1=5*10**8;#The rate of moement of interstitial atoms in jumps/s 500 degree celsius\n", + "R2=8*10**10;#The rate of moement of interstitial atoms in jumps/s 800 degree celsius\n", + "T1=500;#Temperature at first jump in Degree celsius\n", + "T2=800;#Temperature at second jump in Degree celsius\n", + "R=1.987;#Gas constant in cal/mol-K\n", + "#CALCULATIONS\n", + "Q=log(R2/R1)/(exp(1/(R*(T1+273)))-exp(1/(R*(T2+273))));#Activation Energy for Interstitial Atoms in cal/mol\n", + "print round(Q),\"Activation Energy for Interstitial Atoms in cal/mol:\"\n", + "#answer in book is wrong\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_3 pgno:166" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.0001 concentration gradient in percent/cm:\n", + "-1.995e+19 concentration gradient in percent/cm**3.cm:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "X=0.1;#Thickness of SIlicon Wafer in cm\n", + "n=8.;#No. of atoms in silicon per cell\n", + "ni=1.;#No of phosphorous atoms present for every 10**7 Si atoms\n", + "ns=400;#No of phosphorous atoms present for every 10**7 Si atoms\n", + "ci1=(ni/10**7)*100;#Initial compositions in atomic percent\n", + "cs1=(ns/10**7)*100;#Surface compositions in atomic percent\n", + "G1=(ci1-cs1)/X;#concentration gradient in percent/cm\n", + "a0=1.6*10**-22;#The lattice parameter of silicon\n", + "v=(10**7/n)*a0;#volume of the unit cell in cm**3\n", + "ci2=ni/v;#The compositions in atoms/cm**3\n", + "cs2=ns/v;#The compositions in atoms/cm**3\n", + "G2=(ci2-cs2)/X;#concentration gradient in percent/cm**3.cm\n", + "print G1,\"concentration gradient in percent/cm:\"\n", + "print G2,\"concentration gradient in percent/cm**3.cm:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_4 pgno:167" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "total number no.of Ni atoms per second is 6.17256e+13\n", + "nickel atoms removed from the Ni/MgO interface is 7.2e-10\n", + "the thickness is 1.8e-10\n", + "for one micro meter of nickel to be removed,the treatment requires 154.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "cin=8.573*10**22;\n", + "dx=0.05;\n", + "d=9*10**-12;\n", + "j=d*cin/dx;\n", + "A=2*2;\n", + "tn=A*j;\n", + "print \"total number no.of Ni atoms per second is \",tn\n", + "nm=tn/(8.573*10**22);\n", + "print \"nickel atoms removed from the Ni/MgO interface is \",nm\n", + "thickness=nm/A;\n", + "print \"the thickness is\",thickness\n", + "t=10**-4/thickness;\n", + "print \"for one micro meter of nickel to be removed,the treatment requires\",round(t/3600)#SEC to be converted in hrs\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_5 pgno:171" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.013 Minimum thickness of the membrane of Natoms in cm\n", + "0.073 Minimum thickness of the membrane of Hatoms in cm\n" + ] + } + ], + "source": [ + "from math import pi,log,exp\n", + "# Initialisation of Variables\n", + "N=1;#N0. of atoms on one side of iron bar\n", + "H=1;#No. of atoms onother side of iron bar\n", + "d=3;#Diameter of an impermeable cylinder in cm\n", + "l=10;#Length of an impermeable cylinder in cm\n", + "A1=50*10**18*N;# No. of gaseous Atoms per cm**3 on one side \n", + "A2=50*10**18*H;#No. of gaseous Atom per cm**3 on one side\n", + "B1=1*10**18*N;#No. of gaseous atoms per cm**3 on another side\n", + "B2=1*10**18*H;#No. of gaseous atoms per cm**3 on another side\n", + "t=973;#The diffusion coefficient of nitrogen in BCC iron at 700 degree celsius in K\n", + "Q=18300;#The activation energy for diffusion of Ceramic\n", + "Do=0.0047;#The pre-exponential term of ceramic\n", + "R=1.987;#Gas constant in cal/mol.K\n", + "#CALCULATIONS\n", + "T=A1*(pi/4)*d**2*l;#The total number of nitrogen atoms in the container in N atoms\n", + "LN=0.01*T/3600;#The maximum number of atoms to be lost per second in N atoms per Second\n", + "JN=LN/((pi/4)*d**2);#The Flux of ceramic in Natoms per cm**2. sec.\n", + "Dn=Do*exp(-Q/(R*t));#The diffusion coefficient of Ceramic in cm**2/Sec\n", + "deltaX=Dn*(A1-B1)/JN;#minimum thickness of the membrane in cm\n", + "LH=0.90*T/3600;#Hydrogen atom loss per sec.\n", + "JH=LH/((pi/4)*d**2);#The Flux of ceramic in Hatoms per cm**2. sec.\n", + "Dh=Do*exp(-Q/(R*t));#The diffusion coeficient of Ceramic in cm**2/Sec\n", + "deltaX2=((1.86*10**-4)*(A2-B2))/JH;#Minimum thickness of the membrane in cm\n", + "print round(deltaX,3),\"Minimum thickness of the membrane of Natoms in cm\"\n", + "print round(deltaX2,3),\"Minimum thickness of the membrane of Hatoms in cm\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_6 pgno:174" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "6.30824936432e+22 The number of tungsten atoms per cm**3:\n", + "6.30824936432e+20 The number of thorium atoms per cm**3:\n", + "-6.30824936432e+22 The concentration gradient of Tungsten in atoms/cm**3.cm:\n", + "2.89066552915e-12 The diffusion coeficient of Tungsten in cm**2/Sec:\n", + "1.82350389868e+11 Volume Diffusion in Th atoms/cm**2.sec.:\n", + "1.64051460984e-09 The diffusion coeficient of Tungsten in cm**2/Sec:\n", + "1.03487752447e+14 Grain boundry Diffusion in Th atoms/cm**2.sec.:\n", + "1.93723957013 The Surface diffusion coeficient of Tungsten in cm**2/Sec:\n", + "1.22205902868e+15 Surface Diffusion in Th atoms/cm**2.sec.:\n" + ] + } + ], + "source": [ + "from math import exp\n", + "# Initialisation of Variables\n", + "n=2;#no of atoms/ cell in BCC Tungsten\n", + "a0=3.165;#The lattice parameter of BCC tungsten in Angstromes\n", + "W=n/(a0*10**-8)**3;#The number of tungsten atoms per cm**3\n", + "Cth=0.01*W;#The number of thorium atoms per cm**3\n", + "Cg=-Cth/0.01;#The concentration gradient of Tungsten in atoms/cm**3.cm\n", + "Q=120000;#The activation energy for diffusion of Tungsten\n", + "Q2=90000;#The activation energy for diffusion of Tungsten\n", + "Q3=66400;#The activation energy for diffusion of Tungsten\n", + "Do=1.0;#The pre-exponential term of Tungsten\n", + "Do2=0.74;#The pre-exponential term of Tungsten\n", + "Do3=0.47;#The pre-exponential term of Tungsten\n", + "R=1.987;#Gas constant in cal/mol.K\n", + "t=2273;#The diffusion coefficient of nitrogen in BCC iron at 2000 degree celsius in K\n", + "#CALCULATIONS\n", + "D1=Do*exp(-Q/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", + "J1=-D1*Cg;#Volume Diffusion in Th atoms/cm**2.sec.\n", + "D2=Do2*exp(-Q2/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", + "J2=-D2*Cg;#Grain boundary Diffusion in Th atoms/cm**2.sec.\n", + "D3=0.47*exp(-66400/(1.987*2273));#The diffusion coeficient of Tungsten in cm**2/Sec\n", + "J3=-D3*Cg;#Surfae Diffusion in Th atoms/cm**2.sec.\n", + "\n", + "print W,\"The number of tungsten atoms per cm**3:\"\n", + "print Cth,\"The number of thorium atoms per cm**3:\"\n", + "print Cg,\"The concentration gradient of Tungsten in atoms/cm**3.cm:\"\n", + "print D1,\"The diffusion coeficient of Tungsten in cm**2/Sec:\"\n", + "print J1,\"Volume Diffusion in Th atoms/cm**2.sec.:\"\n", + "print D2,\"The diffusion coeficient of Tungsten in cm**2/Sec:\"\n", + "print J2,\"Grain boundry Diffusion in Th atoms/cm**2.sec.:\"\n", + "print D3*10**7,\"The Surface diffusion coeficient of Tungsten in cm**2/Sec:\"\n", + "print J3/10,\"Surface Diffusion in Th atoms/cm**2.sec.:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_7 pgno:178" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the combution temperatures are [ 39.09194444 14.38111111 5.29041667 1.94625 ]\n" + ] + } + ], + "source": [ + "import numpy\n", + "from math import exp\n", + "T=numpy.array([1173, 1273, 1373, 1473])#kelvins\n", + "t=numpy.array([0, 0, 0, 0])\n", + "#in K\n", + "t[0]=0.0861/exp(-16558/T[0])\n", + "t[1]=0.0861/exp(-16558/T[1])\n", + "t[2]=0.0861/exp(-16558/T[2])\n", + "t[3]=0.0861/exp(-16558/T[3])\n", + "print \"the combution temperatures are\",(0.5*t/3600)\n", + "#the difference in asnwer is due to round off error\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_8 pgno:180" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3.2993917076 Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade:\n", + "20 The cost of carburizing per Part of steel rods at 900 degree centigrade\n", + "9.9 The cost of carburizing per Part of steel rods at 1000 degree centigrade\n" + ] + } + ], + "source": [ + "from math import exp\n", + "# Initialisation of Variables\n", + "H=10;#Required time to successfully carburize a batch of 500 steel gears\n", + "t1=1173;#Temperature at carburizing a batch of 500 steel gears in K\n", + "t2=1273;#Temperature at carburizing a batch of 500 steel gears in K\n", + "Q=32900;#The activation energy for diffusion of BCC steel\n", + "R=1.987;#Gas constant in cal/mol.K\n", + "c1=1000;#cost per hour to operate the carburizing furnace at 900\u0002degree centigrades\n", + "c2=1500;#Cost per hour to operate the carburizing furnace at 1000 degree centigrade\n", + "H2=(exp(-Q /(R*t1))*H*3600)/exp(-Q /(R*t2));# Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade\n", + "Cp1=c1*H/500;#The cost per Part of steel rods at 900 degree centigrade\n", + "Cv=(c2*3.299)/500;#The cost per Part of steel rods at 1000 degree centigrade\n", + "print H2/3600,\"Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade:\"\n", + "print Cp1,\"The cost of carburizing per Part of steel rods at 900 degree centigrade\"\n", + "print round(Cv,2),\"The cost of carburizing per Part of steel rods at 1000 degree centigrade\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_2.ipynb new file mode 100755 index 00000000..e4f25582 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_2.ipynb @@ -0,0 +1,352 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 Atoms and Ion Moments in Materials " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_2 pgno:160" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Activation Energy for Interstitial Atoms in cal/mol: 27865.0\n" + ] + } + ], + "source": [ + "#EXAMPLE 5.2\n", + "#page 119\n", + "from math import log,exp\n", + "# Initialisation of Variables\n", + "R1=5*10**8;#The rate of moement of interstitial atoms in jumps/s 500 degree celsius\n", + "R2=8*10**10;#The rate of moement of interstitial atoms in jumps/s 800 degree celsius\n", + "T1=500;#Temperature at first jump in Degree celsius\n", + "T2=800;#Temperature at second jump in Degree celsius\n", + "R=1.987;#Gas constant in cal/mol-K\n", + "#CALCULATIONS\n", + "Q=log(R2/R1)/(exp(1/(R*(T1+273)))-exp(1/(R*(T2+273))));#Activation Energy for Interstitial Atoms in cal/mol\n", + "print \"Activation Energy for Interstitial Atoms in cal/mol:\",round(Q)\n", + "#answer in book is wrong\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_3 pgno:166" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "concentration gradient in percent/cm: 0.0001\n", + "concentration gradient in percent/cm**3.cm: -1.995e+19\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "X=0.1;#Thickness of SIlicon Wafer in cm\n", + "n=8.;#No. of atoms in silicon per cell\n", + "ni=1.;#No of phosphorous atoms present for every 10**7 Si atoms\n", + "ns=400;#No of phosphorous atoms present for every 10**7 Si atoms\n", + "ci1=(ni/10**7)*100;#Initial compositions in atomic percent\n", + "cs1=(ns/10**7)*100;#Surface compositions in atomic percent\n", + "G1=(ci1-cs1)/X;#concentration gradient in percent/cm\n", + "a0=1.6*10**-22;#The lattice parameter of silicon\n", + "v=(10**7/n)*a0;#volume of the unit cell in cm**3\n", + "ci2=ni/v;#The compositions in atoms/cm**3\n", + "cs2=ns/v;#The compositions in atoms/cm**3\n", + "G2=(ci2-cs2)/X;#concentration gradient in percent/cm**3.cm\n", + "print \"concentration gradient in percent/cm:\",G1\n", + "print \"concentration gradient in percent/cm**3.cm:\",G2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_4 pgno:167" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "total number no.of Ni atoms per second is 6.17256e+13\n", + "nickel atoms removed from the Ni/MgO interface is 7.2e-10\n", + "the thickness is 1.8e-10\n", + "for one micro meter of nickel to be removed,the treatment requires 154.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "cin=8.573*10**22;\n", + "dx=0.05;\n", + "d=9*10**-12;\n", + "j=d*cin/dx;\n", + "A=2*2;\n", + "tn=A*j;\n", + "print \"total number no.of Ni atoms per second is \",tn\n", + "nm=tn/(8.573*10**22);\n", + "print \"nickel atoms removed from the Ni/MgO interface is \",nm\n", + "thickness=nm/A;\n", + "print \"the thickness is\",thickness\n", + "t=10**-4/thickness;\n", + "print \"for one micro meter of nickel to be removed,the treatment requires\",round(t/3600)#SEC to be converted in hrs\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_5 pgno:171" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Minimum thickness of the membrane of Natoms in cm 0.013\n", + "Minimum thickness of the membrane of Hatoms in cm 0.073\n" + ] + } + ], + "source": [ + "from math import pi,log,exp\n", + "# Initialisation of Variables\n", + "N=1;#N0. of atoms on one side of iron bar\n", + "H=1;#No. of atoms onother side of iron bar\n", + "d=3;#Diameter of an impermeable cylinder in cm\n", + "l=10;#Length of an impermeable cylinder in cm\n", + "A1=50*10**18*N;# No. of gaseous Atoms per cm**3 on one side \n", + "A2=50*10**18*H;#No. of gaseous Atom per cm**3 on one side\n", + "B1=1*10**18*N;#No. of gaseous atoms per cm**3 on another side\n", + "B2=1*10**18*H;#No. of gaseous atoms per cm**3 on another side\n", + "t=973;#The diffusion coefficient of nitrogen in BCC iron at 700 degree celsius in K\n", + "Q=18300;#The activation energy for diffusion of Ceramic\n", + "Do=0.0047;#The pre-exponential term of ceramic\n", + "R=1.987;#Gas constant in cal/mol.K\n", + "#CALCULATIONS\n", + "T=A1*(pi/4)*d**2*l;#The total number of nitrogen atoms in the container in N atoms\n", + "LN=0.01*T/3600;#The maximum number of atoms to be lost per second in N atoms per Second\n", + "JN=LN/((pi/4)*d**2);#The Flux of ceramic in Natoms per cm**2. sec.\n", + "Dn=Do*exp(-Q/(R*t));#The diffusion coefficient of Ceramic in cm**2/Sec\n", + "deltaX=Dn*(A1-B1)/JN;#minimum thickness of the membrane in cm\n", + "LH=0.90*T/3600;#Hydrogen atom loss per sec.\n", + "JH=LH/((pi/4)*d**2);#The Flux of ceramic in Hatoms per cm**2. sec.\n", + "Dh=Do*exp(-Q/(R*t));#The diffusion coeficient of Ceramic in cm**2/Sec\n", + "deltaX2=((1.86*10**-4)*(A2-B2))/JH;#Minimum thickness of the membrane in cm\n", + "print \"Minimum thickness of the membrane of Natoms in cm\", round(deltaX,3)\n", + "print \"Minimum thickness of the membrane of Hatoms in cm\",round(deltaX2,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_6 pgno:174" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The number of tungsten atoms per cm**3: 6.30824936432e+22\n", + "The number of thorium atoms per cm**3: 6.30824936432e+20\n", + "The concentration gradient of Tungsten in atoms/cm**3.cm: -6.30824936432e+22\n", + "The diffusion coeficient of Tungsten in cm**2/Sec: 2.89066552915e-12\n", + "Volume Diffusion in Th atoms/cm**2.sec.: 1.82350389868e+11\n", + "The diffusion coeficient of Tungsten in cm**2/Sec: 1.64051460984e-09\n", + "Grain boundry Diffusion in Th atoms/cm**2.sec.: 1.03487752447e+14\n", + "The Surface diffusion coeficient of Tungsten in cm**2/Sec: 1.93723957013\n", + "Surface Diffusion in Th atoms/cm**2.sec.: 1.22205902868e+15\n" + ] + } + ], + "source": [ + "from math import exp\n", + "# Initialisation of Variables\n", + "n=2;#no of atoms/ cell in BCC Tungsten\n", + "a0=3.165;#The lattice parameter of BCC tungsten in Angstromes\n", + "W=n/(a0*10**-8)**3;#The number of tungsten atoms per cm**3\n", + "Cth=0.01*W;#The number of thorium atoms per cm**3\n", + "Cg=-Cth/0.01;#The concentration gradient of Tungsten in atoms/cm**3.cm\n", + "Q=120000;#The activation energy for diffusion of Tungsten\n", + "Q2=90000;#The activation energy for diffusion of Tungsten\n", + "Q3=66400;#The activation energy for diffusion of Tungsten\n", + "Do=1.0;#The pre-exponential term of Tungsten\n", + "Do2=0.74;#The pre-exponential term of Tungsten\n", + "Do3=0.47;#The pre-exponential term of Tungsten\n", + "R=1.987;#Gas constant in cal/mol.K\n", + "t=2273;#The diffusion coefficient of nitrogen in BCC iron at 2000 degree celsius in K\n", + "#CALCULATIONS\n", + "D1=Do*exp(-Q/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", + "J1=-D1*Cg;#Volume Diffusion in Th atoms/cm**2.sec.\n", + "D2=Do2*exp(-Q2/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", + "J2=-D2*Cg;#Grain boundary Diffusion in Th atoms/cm**2.sec.\n", + "D3=0.47*exp(-66400/(1.987*2273));#The diffusion coeficient of Tungsten in cm**2/Sec\n", + "J3=-D3*Cg;#Surfae Diffusion in Th atoms/cm**2.sec.\n", + "\n", + "print \"The number of tungsten atoms per cm**3:\",W\n", + "print \"The number of thorium atoms per cm**3:\",Cth\n", + "print \"The concentration gradient of Tungsten in atoms/cm**3.cm:\",Cg\n", + "print \"The diffusion coeficient of Tungsten in cm**2/Sec:\",D1\n", + "print \"Volume Diffusion in Th atoms/cm**2.sec.:\",J1\n", + "print \"The diffusion coeficient of Tungsten in cm**2/Sec:\",D2\n", + "print \"Grain boundry Diffusion in Th atoms/cm**2.sec.:\",J2\n", + "print \"The Surface diffusion coeficient of Tungsten in cm**2/Sec:\",D3*10**7\n", + "print \"Surface Diffusion in Th atoms/cm**2.sec.:\",J3/10\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_7 pgno:178" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the combution temperatures are [ 39.09194444 14.38111111 5.29041667 1.94625 ]\n" + ] + } + ], + "source": [ + "import numpy\n", + "from math import exp\n", + "T=numpy.array([1173, 1273, 1373, 1473])#kelvins\n", + "t=numpy.array([0, 0, 0, 0])\n", + "#in K\n", + "t[0]=0.0861/exp(-16558/T[0])\n", + "t[1]=0.0861/exp(-16558/T[1])\n", + "t[2]=0.0861/exp(-16558/T[2])\n", + "t[3]=0.0861/exp(-16558/T[3])\n", + "print \"the combution temperatures are\",(0.5*t/3600)\n", + "#the difference in asnwer is due to round off error\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_8 pgno:180" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade: 3.2993917076\n", + "The cost of carburizing per Part of steel rods at 900 degree centigrade 20\n", + "The cost of carburizing per Part of steel rods at 1000 degree centigrade 9.9\n" + ] + } + ], + "source": [ + "from math import exp\n", + "# Initialisation of Variables\n", + "H=10;#Required time to successfully carburize a batch of 500 steel gears\n", + "t1=1173;#Temperature at carburizing a batch of 500 steel gears in K\n", + "t2=1273;#Temperature at carburizing a batch of 500 steel gears in K\n", + "Q=32900;#The activation energy for diffusion of BCC steel\n", + "R=1.987;#Gas constant in cal/mol.K\n", + "c1=1000;#cost per hour to operate the carburizing furnace at 900\u0002degree centigrades\n", + "c2=1500;#Cost per hour to operate the carburizing furnace at 1000 degree centigrade\n", + "H2=(exp(-Q /(R*t1))*H*3600)/exp(-Q /(R*t2));# Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade\n", + "Cp1=c1*H/500;#The cost per Part of steel rods at 900 degree centigrade\n", + "Cv=(c2*3.299)/500;#The cost per Part of steel rods at 1000 degree centigrade\n", + "print \"Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade:\",H2/3600\n", + "print \"The cost of carburizing per Part of steel rods at 900 degree centigrade\",Cp1\n", + "print \"The cost of carburizing per Part of steel rods at 1000 degree centigrade\",round(Cv,2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_3.ipynb new file mode 100755 index 00000000..e4f25582 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_3.ipynb @@ -0,0 +1,352 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 Atoms and Ion Moments in Materials " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_2 pgno:160" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Activation Energy for Interstitial Atoms in cal/mol: 27865.0\n" + ] + } + ], + "source": [ + "#EXAMPLE 5.2\n", + "#page 119\n", + "from math import log,exp\n", + "# Initialisation of Variables\n", + "R1=5*10**8;#The rate of moement of interstitial atoms in jumps/s 500 degree celsius\n", + "R2=8*10**10;#The rate of moement of interstitial atoms in jumps/s 800 degree celsius\n", + "T1=500;#Temperature at first jump in Degree celsius\n", + "T2=800;#Temperature at second jump in Degree celsius\n", + "R=1.987;#Gas constant in cal/mol-K\n", + "#CALCULATIONS\n", + "Q=log(R2/R1)/(exp(1/(R*(T1+273)))-exp(1/(R*(T2+273))));#Activation Energy for Interstitial Atoms in cal/mol\n", + "print \"Activation Energy for Interstitial Atoms in cal/mol:\",round(Q)\n", + "#answer in book is wrong\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_3 pgno:166" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "concentration gradient in percent/cm: 0.0001\n", + "concentration gradient in percent/cm**3.cm: -1.995e+19\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "X=0.1;#Thickness of SIlicon Wafer in cm\n", + "n=8.;#No. of atoms in silicon per cell\n", + "ni=1.;#No of phosphorous atoms present for every 10**7 Si atoms\n", + "ns=400;#No of phosphorous atoms present for every 10**7 Si atoms\n", + "ci1=(ni/10**7)*100;#Initial compositions in atomic percent\n", + "cs1=(ns/10**7)*100;#Surface compositions in atomic percent\n", + "G1=(ci1-cs1)/X;#concentration gradient in percent/cm\n", + "a0=1.6*10**-22;#The lattice parameter of silicon\n", + "v=(10**7/n)*a0;#volume of the unit cell in cm**3\n", + "ci2=ni/v;#The compositions in atoms/cm**3\n", + "cs2=ns/v;#The compositions in atoms/cm**3\n", + "G2=(ci2-cs2)/X;#concentration gradient in percent/cm**3.cm\n", + "print \"concentration gradient in percent/cm:\",G1\n", + "print \"concentration gradient in percent/cm**3.cm:\",G2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_4 pgno:167" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "total number no.of Ni atoms per second is 6.17256e+13\n", + "nickel atoms removed from the Ni/MgO interface is 7.2e-10\n", + "the thickness is 1.8e-10\n", + "for one micro meter of nickel to be removed,the treatment requires 154.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "cin=8.573*10**22;\n", + "dx=0.05;\n", + "d=9*10**-12;\n", + "j=d*cin/dx;\n", + "A=2*2;\n", + "tn=A*j;\n", + "print \"total number no.of Ni atoms per second is \",tn\n", + "nm=tn/(8.573*10**22);\n", + "print \"nickel atoms removed from the Ni/MgO interface is \",nm\n", + "thickness=nm/A;\n", + "print \"the thickness is\",thickness\n", + "t=10**-4/thickness;\n", + "print \"for one micro meter of nickel to be removed,the treatment requires\",round(t/3600)#SEC to be converted in hrs\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_5 pgno:171" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Minimum thickness of the membrane of Natoms in cm 0.013\n", + "Minimum thickness of the membrane of Hatoms in cm 0.073\n" + ] + } + ], + "source": [ + "from math import pi,log,exp\n", + "# Initialisation of Variables\n", + "N=1;#N0. of atoms on one side of iron bar\n", + "H=1;#No. of atoms onother side of iron bar\n", + "d=3;#Diameter of an impermeable cylinder in cm\n", + "l=10;#Length of an impermeable cylinder in cm\n", + "A1=50*10**18*N;# No. of gaseous Atoms per cm**3 on one side \n", + "A2=50*10**18*H;#No. of gaseous Atom per cm**3 on one side\n", + "B1=1*10**18*N;#No. of gaseous atoms per cm**3 on another side\n", + "B2=1*10**18*H;#No. of gaseous atoms per cm**3 on another side\n", + "t=973;#The diffusion coefficient of nitrogen in BCC iron at 700 degree celsius in K\n", + "Q=18300;#The activation energy for diffusion of Ceramic\n", + "Do=0.0047;#The pre-exponential term of ceramic\n", + "R=1.987;#Gas constant in cal/mol.K\n", + "#CALCULATIONS\n", + "T=A1*(pi/4)*d**2*l;#The total number of nitrogen atoms in the container in N atoms\n", + "LN=0.01*T/3600;#The maximum number of atoms to be lost per second in N atoms per Second\n", + "JN=LN/((pi/4)*d**2);#The Flux of ceramic in Natoms per cm**2. sec.\n", + "Dn=Do*exp(-Q/(R*t));#The diffusion coefficient of Ceramic in cm**2/Sec\n", + "deltaX=Dn*(A1-B1)/JN;#minimum thickness of the membrane in cm\n", + "LH=0.90*T/3600;#Hydrogen atom loss per sec.\n", + "JH=LH/((pi/4)*d**2);#The Flux of ceramic in Hatoms per cm**2. sec.\n", + "Dh=Do*exp(-Q/(R*t));#The diffusion coeficient of Ceramic in cm**2/Sec\n", + "deltaX2=((1.86*10**-4)*(A2-B2))/JH;#Minimum thickness of the membrane in cm\n", + "print \"Minimum thickness of the membrane of Natoms in cm\", round(deltaX,3)\n", + "print \"Minimum thickness of the membrane of Hatoms in cm\",round(deltaX2,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_6 pgno:174" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The number of tungsten atoms per cm**3: 6.30824936432e+22\n", + "The number of thorium atoms per cm**3: 6.30824936432e+20\n", + "The concentration gradient of Tungsten in atoms/cm**3.cm: -6.30824936432e+22\n", + "The diffusion coeficient of Tungsten in cm**2/Sec: 2.89066552915e-12\n", + "Volume Diffusion in Th atoms/cm**2.sec.: 1.82350389868e+11\n", + "The diffusion coeficient of Tungsten in cm**2/Sec: 1.64051460984e-09\n", + "Grain boundry Diffusion in Th atoms/cm**2.sec.: 1.03487752447e+14\n", + "The Surface diffusion coeficient of Tungsten in cm**2/Sec: 1.93723957013\n", + "Surface Diffusion in Th atoms/cm**2.sec.: 1.22205902868e+15\n" + ] + } + ], + "source": [ + "from math import exp\n", + "# Initialisation of Variables\n", + "n=2;#no of atoms/ cell in BCC Tungsten\n", + "a0=3.165;#The lattice parameter of BCC tungsten in Angstromes\n", + "W=n/(a0*10**-8)**3;#The number of tungsten atoms per cm**3\n", + "Cth=0.01*W;#The number of thorium atoms per cm**3\n", + "Cg=-Cth/0.01;#The concentration gradient of Tungsten in atoms/cm**3.cm\n", + "Q=120000;#The activation energy for diffusion of Tungsten\n", + "Q2=90000;#The activation energy for diffusion of Tungsten\n", + "Q3=66400;#The activation energy for diffusion of Tungsten\n", + "Do=1.0;#The pre-exponential term of Tungsten\n", + "Do2=0.74;#The pre-exponential term of Tungsten\n", + "Do3=0.47;#The pre-exponential term of Tungsten\n", + "R=1.987;#Gas constant in cal/mol.K\n", + "t=2273;#The diffusion coefficient of nitrogen in BCC iron at 2000 degree celsius in K\n", + "#CALCULATIONS\n", + "D1=Do*exp(-Q/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", + "J1=-D1*Cg;#Volume Diffusion in Th atoms/cm**2.sec.\n", + "D2=Do2*exp(-Q2/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", + "J2=-D2*Cg;#Grain boundary Diffusion in Th atoms/cm**2.sec.\n", + "D3=0.47*exp(-66400/(1.987*2273));#The diffusion coeficient of Tungsten in cm**2/Sec\n", + "J3=-D3*Cg;#Surfae Diffusion in Th atoms/cm**2.sec.\n", + "\n", + "print \"The number of tungsten atoms per cm**3:\",W\n", + "print \"The number of thorium atoms per cm**3:\",Cth\n", + "print \"The concentration gradient of Tungsten in atoms/cm**3.cm:\",Cg\n", + "print \"The diffusion coeficient of Tungsten in cm**2/Sec:\",D1\n", + "print \"Volume Diffusion in Th atoms/cm**2.sec.:\",J1\n", + "print \"The diffusion coeficient of Tungsten in cm**2/Sec:\",D2\n", + "print \"Grain boundry Diffusion in Th atoms/cm**2.sec.:\",J2\n", + "print \"The Surface diffusion coeficient of Tungsten in cm**2/Sec:\",D3*10**7\n", + "print \"Surface Diffusion in Th atoms/cm**2.sec.:\",J3/10\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_7 pgno:178" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the combution temperatures are [ 39.09194444 14.38111111 5.29041667 1.94625 ]\n" + ] + } + ], + "source": [ + "import numpy\n", + "from math import exp\n", + "T=numpy.array([1173, 1273, 1373, 1473])#kelvins\n", + "t=numpy.array([0, 0, 0, 0])\n", + "#in K\n", + "t[0]=0.0861/exp(-16558/T[0])\n", + "t[1]=0.0861/exp(-16558/T[1])\n", + "t[2]=0.0861/exp(-16558/T[2])\n", + "t[3]=0.0861/exp(-16558/T[3])\n", + "print \"the combution temperatures are\",(0.5*t/3600)\n", + "#the difference in asnwer is due to round off error\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_8 pgno:180" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade: 3.2993917076\n", + "The cost of carburizing per Part of steel rods at 900 degree centigrade 20\n", + "The cost of carburizing per Part of steel rods at 1000 degree centigrade 9.9\n" + ] + } + ], + "source": [ + "from math import exp\n", + "# Initialisation of Variables\n", + "H=10;#Required time to successfully carburize a batch of 500 steel gears\n", + "t1=1173;#Temperature at carburizing a batch of 500 steel gears in K\n", + "t2=1273;#Temperature at carburizing a batch of 500 steel gears in K\n", + "Q=32900;#The activation energy for diffusion of BCC steel\n", + "R=1.987;#Gas constant in cal/mol.K\n", + "c1=1000;#cost per hour to operate the carburizing furnace at 900\u0002degree centigrades\n", + "c2=1500;#Cost per hour to operate the carburizing furnace at 1000 degree centigrade\n", + "H2=(exp(-Q /(R*t1))*H*3600)/exp(-Q /(R*t2));# Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade\n", + "Cp1=c1*H/500;#The cost per Part of steel rods at 900 degree centigrade\n", + "Cv=(c2*3.299)/500;#The cost per Part of steel rods at 1000 degree centigrade\n", + "print \"Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade:\",H2/3600\n", + "print \"The cost of carburizing per Part of steel rods at 900 degree centigrade\",Cp1\n", + "print \"The cost of carburizing per Part of steel rods at 1000 degree centigrade\",round(Cv,2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one.ipynb new file mode 100755 index 00000000..99ecc7a7 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one.ipynb @@ -0,0 +1,292 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6 Mechanical Properties : part one" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_1 pgno:207" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value in psi is= 4992.60678261\n", + "The value of epselon 0.0005\n" + ] + } + ], + "source": [ + "from math import pi\n", + "F=1000#in lb\n", + "Ao=(pi/4)*(0.505)**2#in**2\n", + "rho=F/Ao\n", + "delta_I=0.001#in\n", + "I_o=2#in\n", + "e=delta_I/I_o\n", + "print\"The value in psi is=\",rho\n", + "print\"The value of epselon\",e" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_2 pgno:207" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1 The required crosssectional area of the rod in in^2:\n", + "1.1283791671 Diameter of rod in in:\n", + "0.000625 The maximum length of the rod in in:\n", + "100.0 The minimum strain allowed on rod:\n", + "2 The minimum cross-sectional area in in^2:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "F=45000;#Force applied on an aluminum rod in lb\n", + "e=25000;#the maximum allowable stress on the rod in psi\n", + "l2=150;#the minimum length of the rod in in\n", + "e1=0.0025;#The strain appiled on rod\n", + "sigma=16670;#Stress applied on rod in psi\n", + "L=0.25;#The maximum allowable elastic deformation in in\n", + "from math import sqrt,pi\n", + "#CALCULATIONS\n", + "Ao1=F/e;#The required crosssectional area of the rod\n", + "d=sqrt((Ao1*4)/pi);#Diameter of rod in in\n", + "l1=e1*L;#The maximum length of the rod in in\n", + "e2=L/e1;#The minimum strain allowed on rod\n", + "Ao2=F/sigma;#The minimum cross-sectional area in in^2\n", + "print Ao1,\"The required crosssectional area of the rod in in^2:\"\n", + "print d,\"Diameter of rod in in:\"\n", + "print l1,\"The maximum length of the rod in in:\"\n", + "print e2,\"The minimum strain allowed on rod:\"\n", + "print Ao2,\"The minimum cross-sectional area in in^2:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_3 pgno:213" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "10000000.0 Modulus of elasticity of aluminum alloy from table 6-1:\n", + "50.15 The length after deformation of bar in in\n", + "0.003 Strain applied of aluminum alloy:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "sigma1=35000;#Stress applied of aluminum alloy in psi from table 6-1\n", + "e1=0.0035;##Strain applied of aluminum alloy from table 6-1\n", + "sigma2=30000;#Stress applied of aluminum alloy in psi\n", + "Lo=50;#initial length of aluminum alloy\n", + "#CALCULATIONS\n", + "E=sigma1/e1;#Modulus of elasticity of aluminum alloy\n", + "e2=sigma2/E;#Strain applied of aluminum alloy\n", + "L=Lo+(e2*Lo);#The length after deformation of bar in in\n", + "print E,\"Modulus of elasticity of aluminum alloy from table 6-1:\"\n", + "print L,\"The length after deformation of bar in in\"\n", + "print e2,\"Strain applied of aluminum alloy:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4 pgno:214" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "9.75 Percentage of Elongation:\n", + "37.9 Percentage of Reduction in area:\n", + "The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Lf=2.195;#Final length after failure\n", + "d1=0.505;#Diameter of alluminum alloy in in\n", + "d2=0.398;#Final diameter of alluminum alloy in in\n", + "Lo=2;#Initial length of alluminum alloy \n", + "from math import pi\n", + "#CALCULATIONS\n", + "A0=(pi/4)*d1**2;#Area of original of alluminum alloy\n", + "Af=(pi/4)*d2**2;#Area of final of alluminum alloy\n", + "E=((Lf-Lo)/Lo)*100;#Percentage of Elongation \n", + "R=((A0-Af)/A0)*100;#Percentage of Reduction in area\n", + "print E,\"Percentage of Elongation:\"\n", + "print round(R,1),\"Percentage of Reduction in area:\"\n", + "print\"The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_5 pgno:217" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "39940.8542609 Engineering stress in psiAt the tensile or maximum load\n", + "41237.025201 True stress in psi At the tensile or maximum load\n", + "0.06 Engineering strain At the tensile or maximum load\n", + "0.058268908124 True strain At the tensile or maximum load\n", + "37943.8115478 Engineering stress At fracture:\n", + "61088.2335041 True stress At fracture\n", + "0.1025 Engineering strain At fracture:\n", + "0.476 True strain At fracture:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "F=8000.;#.......#Load applied for the aluminum alloy in lb\n", + "F2=7600.;#......#Load applied for the aluminum alloy in lb at fracture\n", + "dt1=0.505;#.......#diameter of for the aluminum alloy in in\n", + "dt2=0.497;#.......#The diameter at maximum load\n", + "Lt=2.120;#..........#Final length at maxium load\n", + "Lot=2.;#.............#Initial length of alluminum alloy\n", + "Ff=7600.;#.........#Load applied for the aluminum alloy after fracture in lb\n", + "df=0.398;#.......#The diameter at maximum load after fracture\n", + "Lf=0.205;#.......#Final length at fracture\n", + "from math import pi,log\n", + "#CALCULATIONS\n", + "Es=F/((pi/4)*dt1**2);#.....#Engineering stress in psiAt the tensile or maximum load\n", + "Ts=F/((pi/4)*dt2**2);#.....#True stress in psi At the tensile or maximum load\n", + "Ee=(Lt-Lot)/Lot;#........#Engineering strain At the tensile or maximum load\n", + "Te=log(Lt/Lot);#........#True strain At the tensile or maximum load\n", + "Es2=F2/((pi/4)*dt1**2);#......##Engineering stress At fracture:\n", + "Ts2=F2/((pi/4)*df**2);#......#True stress At fracture:\n", + "Ee2=Lf/Lot;#..........#Engineering strain At fracture:\n", + "Te2=log(((pi/4)*dt1**2)/((pi/4)*df**2));#.......#True strain At fracture:\n", + "print Es,\"Engineering stress in psiAt the tensile or maximum load\"\n", + "print Ts,\"True stress in psi At the tensile or maximum load\"\n", + "print Ee,\"Engineering strain At the tensile or maximum load\"\n", + "print Te,\"True strain At the tensile or maximum load\"\n", + "print Es2,\"Engineering stress At fracture:\"\n", + "print Ts2,\"True stress At fracture\"\n", + "print Ee2,\"Engineering strain At fracture:\"\n", + "print round(Te2,3),\"True strain At fracture:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_6 pgno:221" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "421.875 The force required to fracture the material in lb:\n", + "0.0278 The deflection of the sample at fracture in in\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Fs=45000;#.......#The flexural strength of a composite material in psi\n", + "Fm=18*10**6;#........#The flexural modulus of composite material in psi\n", + "w=0.5;#.......#wide of sample in in\n", + "h=0.375;#......#Height of sample in in\n", + "l=5;#..........#Length of sample in in\n", + "#CALCULATIONS\n", + "F=Fs*2*w*h**2/(3*l);#......#The force required to fracture the material in lb\n", + "delta=(l**3)*F/(Fm*4*w*h**3);#.......#The deflection of the sample at fracture \n", + "print F,\"The force required to fracture the material in lb:\"\n", + "print round(delta,4),\"The deflection of the sample at fracture in in\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_1.ipynb new file mode 100755 index 00000000..99ecc7a7 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_1.ipynb @@ -0,0 +1,292 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6 Mechanical Properties : part one" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_1 pgno:207" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value in psi is= 4992.60678261\n", + "The value of epselon 0.0005\n" + ] + } + ], + "source": [ + "from math import pi\n", + "F=1000#in lb\n", + "Ao=(pi/4)*(0.505)**2#in**2\n", + "rho=F/Ao\n", + "delta_I=0.001#in\n", + "I_o=2#in\n", + "e=delta_I/I_o\n", + "print\"The value in psi is=\",rho\n", + "print\"The value of epselon\",e" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_2 pgno:207" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1 The required crosssectional area of the rod in in^2:\n", + "1.1283791671 Diameter of rod in in:\n", + "0.000625 The maximum length of the rod in in:\n", + "100.0 The minimum strain allowed on rod:\n", + "2 The minimum cross-sectional area in in^2:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "F=45000;#Force applied on an aluminum rod in lb\n", + "e=25000;#the maximum allowable stress on the rod in psi\n", + "l2=150;#the minimum length of the rod in in\n", + "e1=0.0025;#The strain appiled on rod\n", + "sigma=16670;#Stress applied on rod in psi\n", + "L=0.25;#The maximum allowable elastic deformation in in\n", + "from math import sqrt,pi\n", + "#CALCULATIONS\n", + "Ao1=F/e;#The required crosssectional area of the rod\n", + "d=sqrt((Ao1*4)/pi);#Diameter of rod in in\n", + "l1=e1*L;#The maximum length of the rod in in\n", + "e2=L/e1;#The minimum strain allowed on rod\n", + "Ao2=F/sigma;#The minimum cross-sectional area in in^2\n", + "print Ao1,\"The required crosssectional area of the rod in in^2:\"\n", + "print d,\"Diameter of rod in in:\"\n", + "print l1,\"The maximum length of the rod in in:\"\n", + "print e2,\"The minimum strain allowed on rod:\"\n", + "print Ao2,\"The minimum cross-sectional area in in^2:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_3 pgno:213" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "10000000.0 Modulus of elasticity of aluminum alloy from table 6-1:\n", + "50.15 The length after deformation of bar in in\n", + "0.003 Strain applied of aluminum alloy:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "sigma1=35000;#Stress applied of aluminum alloy in psi from table 6-1\n", + "e1=0.0035;##Strain applied of aluminum alloy from table 6-1\n", + "sigma2=30000;#Stress applied of aluminum alloy in psi\n", + "Lo=50;#initial length of aluminum alloy\n", + "#CALCULATIONS\n", + "E=sigma1/e1;#Modulus of elasticity of aluminum alloy\n", + "e2=sigma2/E;#Strain applied of aluminum alloy\n", + "L=Lo+(e2*Lo);#The length after deformation of bar in in\n", + "print E,\"Modulus of elasticity of aluminum alloy from table 6-1:\"\n", + "print L,\"The length after deformation of bar in in\"\n", + "print e2,\"Strain applied of aluminum alloy:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4 pgno:214" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "9.75 Percentage of Elongation:\n", + "37.9 Percentage of Reduction in area:\n", + "The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Lf=2.195;#Final length after failure\n", + "d1=0.505;#Diameter of alluminum alloy in in\n", + "d2=0.398;#Final diameter of alluminum alloy in in\n", + "Lo=2;#Initial length of alluminum alloy \n", + "from math import pi\n", + "#CALCULATIONS\n", + "A0=(pi/4)*d1**2;#Area of original of alluminum alloy\n", + "Af=(pi/4)*d2**2;#Area of final of alluminum alloy\n", + "E=((Lf-Lo)/Lo)*100;#Percentage of Elongation \n", + "R=((A0-Af)/A0)*100;#Percentage of Reduction in area\n", + "print E,\"Percentage of Elongation:\"\n", + "print round(R,1),\"Percentage of Reduction in area:\"\n", + "print\"The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_5 pgno:217" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "39940.8542609 Engineering stress in psiAt the tensile or maximum load\n", + "41237.025201 True stress in psi At the tensile or maximum load\n", + "0.06 Engineering strain At the tensile or maximum load\n", + "0.058268908124 True strain At the tensile or maximum load\n", + "37943.8115478 Engineering stress At fracture:\n", + "61088.2335041 True stress At fracture\n", + "0.1025 Engineering strain At fracture:\n", + "0.476 True strain At fracture:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "F=8000.;#.......#Load applied for the aluminum alloy in lb\n", + "F2=7600.;#......#Load applied for the aluminum alloy in lb at fracture\n", + "dt1=0.505;#.......#diameter of for the aluminum alloy in in\n", + "dt2=0.497;#.......#The diameter at maximum load\n", + "Lt=2.120;#..........#Final length at maxium load\n", + "Lot=2.;#.............#Initial length of alluminum alloy\n", + "Ff=7600.;#.........#Load applied for the aluminum alloy after fracture in lb\n", + "df=0.398;#.......#The diameter at maximum load after fracture\n", + "Lf=0.205;#.......#Final length at fracture\n", + "from math import pi,log\n", + "#CALCULATIONS\n", + "Es=F/((pi/4)*dt1**2);#.....#Engineering stress in psiAt the tensile or maximum load\n", + "Ts=F/((pi/4)*dt2**2);#.....#True stress in psi At the tensile or maximum load\n", + "Ee=(Lt-Lot)/Lot;#........#Engineering strain At the tensile or maximum load\n", + "Te=log(Lt/Lot);#........#True strain At the tensile or maximum load\n", + "Es2=F2/((pi/4)*dt1**2);#......##Engineering stress At fracture:\n", + "Ts2=F2/((pi/4)*df**2);#......#True stress At fracture:\n", + "Ee2=Lf/Lot;#..........#Engineering strain At fracture:\n", + "Te2=log(((pi/4)*dt1**2)/((pi/4)*df**2));#.......#True strain At fracture:\n", + "print Es,\"Engineering stress in psiAt the tensile or maximum load\"\n", + "print Ts,\"True stress in psi At the tensile or maximum load\"\n", + "print Ee,\"Engineering strain At the tensile or maximum load\"\n", + "print Te,\"True strain At the tensile or maximum load\"\n", + "print Es2,\"Engineering stress At fracture:\"\n", + "print Ts2,\"True stress At fracture\"\n", + "print Ee2,\"Engineering strain At fracture:\"\n", + "print round(Te2,3),\"True strain At fracture:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_6 pgno:221" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "421.875 The force required to fracture the material in lb:\n", + "0.0278 The deflection of the sample at fracture in in\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Fs=45000;#.......#The flexural strength of a composite material in psi\n", + "Fm=18*10**6;#........#The flexural modulus of composite material in psi\n", + "w=0.5;#.......#wide of sample in in\n", + "h=0.375;#......#Height of sample in in\n", + "l=5;#..........#Length of sample in in\n", + "#CALCULATIONS\n", + "F=Fs*2*w*h**2/(3*l);#......#The force required to fracture the material in lb\n", + "delta=(l**3)*F/(Fm*4*w*h**3);#.......#The deflection of the sample at fracture \n", + "print F,\"The force required to fracture the material in lb:\"\n", + "print round(delta,4),\"The deflection of the sample at fracture in in\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_2.ipynb new file mode 100755 index 00000000..a9f18f16 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_2.ipynb @@ -0,0 +1,292 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6 Mechanical Properties : part one" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_1 pgno:207" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value in psi is= 4992.60678261\n", + "The value of epselon 0.0005\n" + ] + } + ], + "source": [ + "from math import pi\n", + "F=1000#in lb\n", + "Ao=(pi/4)*(0.505)**2#in**2\n", + "rho=F/Ao\n", + "delta_I=0.001#in\n", + "I_o=2#in\n", + "e=delta_I/I_o\n", + "print\"The value in psi is=\",rho\n", + "print\"The value of epselon\",e" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_2 pgno:207" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The required crosssectional area of the rod in in^2: 1\n", + "Diameter of rod in in: 1.1283791671\n", + "The maximum length of the rod in in: 0.000625\n", + "The minimum strain allowed on rod: 100.0\n", + "The minimum cross-sectional area in in^2: 2\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "F=45000;#Force applied on an aluminum rod in lb\n", + "e=25000;#the maximum allowable stress on the rod in psi\n", + "l2=150;#the minimum length of the rod in in\n", + "e1=0.0025;#The strain appiled on rod\n", + "sigma=16670;#Stress applied on rod in psi\n", + "L=0.25;#The maximum allowable elastic deformation in in\n", + "from math import sqrt,pi\n", + "#CALCULATIONS\n", + "Ao1=F/e;#The required crosssectional area of the rod\n", + "d=sqrt((Ao1*4)/pi);#Diameter of rod in in\n", + "l1=e1*L;#The maximum length of the rod in in\n", + "e2=L/e1;#The minimum strain allowed on rod\n", + "Ao2=F/sigma;#The minimum cross-sectional area in in^2\n", + "print \"The required crosssectional area of the rod in in^2:\",Ao1\n", + "print \"Diameter of rod in in:\",d\n", + "print \"The maximum length of the rod in in:\",l1\n", + "print \"The minimum strain allowed on rod:\",e2\n", + "print \"The minimum cross-sectional area in in^2:\",Ao2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_3 pgno:213" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Modulus of elasticity of aluminum alloy from table 6-1: 10000000.0\n", + "The length after deformation of bar in in 50.15\n", + "Strain applied of aluminum alloy: 0.003\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "sigma1=35000;#Stress applied of aluminum alloy in psi from table 6-1\n", + "e1=0.0035;##Strain applied of aluminum alloy from table 6-1\n", + "sigma2=30000;#Stress applied of aluminum alloy in psi\n", + "Lo=50;#initial length of aluminum alloy\n", + "#CALCULATIONS\n", + "E=sigma1/e1;#Modulus of elasticity of aluminum alloy\n", + "e2=sigma2/E;#Strain applied of aluminum alloy\n", + "L=Lo+(e2*Lo);#The length after deformation of bar in in\n", + "print \"Modulus of elasticity of aluminum alloy from table 6-1:\",E\n", + "print \"The length after deformation of bar in in\",L\n", + "print \"Strain applied of aluminum alloy:\",e2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4 pgno:214" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Percentage of Elongation: 9.75\n", + "Percentage of Reduction in area: 37.9\n", + "The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Lf=2.195;#Final length after failure\n", + "d1=0.505;#Diameter of alluminum alloy in in\n", + "d2=0.398;#Final diameter of alluminum alloy in in\n", + "Lo=2;#Initial length of alluminum alloy \n", + "from math import pi\n", + "#CALCULATIONS\n", + "A0=(pi/4)*d1**2;#Area of original of alluminum alloy\n", + "Af=(pi/4)*d2**2;#Area of final of alluminum alloy\n", + "E=((Lf-Lo)/Lo)*100;#Percentage of Elongation \n", + "R=((A0-Af)/A0)*100;#Percentage of Reduction in area\n", + "print \"Percentage of Elongation:\",E\n", + "print \"Percentage of Reduction in area:\",round(R,1)\n", + "print\"The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_5 pgno:217" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Engineering stress in psiAt the tensile or maximum load 39940.8542609\n", + "True stress in psi At the tensile or maximum load 41237.025201\n", + "Engineering strain At the tensile or maximum load 0.06\n", + "True strain At the tensile or maximum load 0.058268908124\n", + "Engineering stress At fracture: 37943.8115478\n", + "True stress At fracture 61088.2335041\n", + "Engineering strain At fracture: 0.1025\n", + "True strain At fracture: 0.476\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "F=8000.;#.......#Load applied for the aluminum alloy in lb\n", + "F2=7600.;#......#Load applied for the aluminum alloy in lb at fracture\n", + "dt1=0.505;#.......#diameter of for the aluminum alloy in in\n", + "dt2=0.497;#.......#The diameter at maximum load\n", + "Lt=2.120;#..........#Final length at maxium load\n", + "Lot=2.;#.............#Initial length of alluminum alloy\n", + "Ff=7600.;#.........#Load applied for the aluminum alloy after fracture in lb\n", + "df=0.398;#.......#The diameter at maximum load after fracture\n", + "Lf=0.205;#.......#Final length at fracture\n", + "from math import pi,log\n", + "#CALCULATIONS\n", + "Es=F/((pi/4)*dt1**2);#.....#Engineering stress in psiAt the tensile or maximum load\n", + "Ts=F/((pi/4)*dt2**2);#.....#True stress in psi At the tensile or maximum load\n", + "Ee=(Lt-Lot)/Lot;#........#Engineering strain At the tensile or maximum load\n", + "Te=log(Lt/Lot);#........#True strain At the tensile or maximum load\n", + "Es2=F2/((pi/4)*dt1**2);#......##Engineering stress At fracture:\n", + "Ts2=F2/((pi/4)*df**2);#......#True stress At fracture:\n", + "Ee2=Lf/Lot;#..........#Engineering strain At fracture:\n", + "Te2=log(((pi/4)*dt1**2)/((pi/4)*df**2));#.......#True strain At fracture:\n", + "print \"Engineering stress in psiAt the tensile or maximum load\",Es\n", + "print \"True stress in psi At the tensile or maximum load\",Ts\n", + "print \"Engineering strain At the tensile or maximum load\",Ee\n", + "print \"True strain At the tensile or maximum load\",Te\n", + "print \"Engineering stress At fracture:\",Es2\n", + "print \"True stress At fracture\",Ts2\n", + "print \"Engineering strain At fracture:\",Ee2\n", + "print \"True strain At fracture:\",round(Te2,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_6 pgno:221" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The force required to fracture the material in lb: 421.875\n", + "The deflection of the sample at fracture in in 0.0278\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Fs=45000;#.......#The flexural strength of a composite material in psi\n", + "Fm=18*10**6;#........#The flexural modulus of composite material in psi\n", + "w=0.5;#.......#wide of sample in in\n", + "h=0.375;#......#Height of sample in in\n", + "l=5;#..........#Length of sample in in\n", + "#CALCULATIONS\n", + "F=Fs*2*w*h**2/(3*l);#......#The force required to fracture the material in lb\n", + "delta=(l**3)*F/(Fm*4*w*h**3);#.......#The deflection of the sample at fracture \n", + "print \"The force required to fracture the material in lb:\",F\n", + "print \"The deflection of the sample at fracture in in\",round(delta,4)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_3.ipynb new file mode 100755 index 00000000..a9f18f16 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_3.ipynb @@ -0,0 +1,292 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6 Mechanical Properties : part one" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_1 pgno:207" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value in psi is= 4992.60678261\n", + "The value of epselon 0.0005\n" + ] + } + ], + "source": [ + "from math import pi\n", + "F=1000#in lb\n", + "Ao=(pi/4)*(0.505)**2#in**2\n", + "rho=F/Ao\n", + "delta_I=0.001#in\n", + "I_o=2#in\n", + "e=delta_I/I_o\n", + "print\"The value in psi is=\",rho\n", + "print\"The value of epselon\",e" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_2 pgno:207" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The required crosssectional area of the rod in in^2: 1\n", + "Diameter of rod in in: 1.1283791671\n", + "The maximum length of the rod in in: 0.000625\n", + "The minimum strain allowed on rod: 100.0\n", + "The minimum cross-sectional area in in^2: 2\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "F=45000;#Force applied on an aluminum rod in lb\n", + "e=25000;#the maximum allowable stress on the rod in psi\n", + "l2=150;#the minimum length of the rod in in\n", + "e1=0.0025;#The strain appiled on rod\n", + "sigma=16670;#Stress applied on rod in psi\n", + "L=0.25;#The maximum allowable elastic deformation in in\n", + "from math import sqrt,pi\n", + "#CALCULATIONS\n", + "Ao1=F/e;#The required crosssectional area of the rod\n", + "d=sqrt((Ao1*4)/pi);#Diameter of rod in in\n", + "l1=e1*L;#The maximum length of the rod in in\n", + "e2=L/e1;#The minimum strain allowed on rod\n", + "Ao2=F/sigma;#The minimum cross-sectional area in in^2\n", + "print \"The required crosssectional area of the rod in in^2:\",Ao1\n", + "print \"Diameter of rod in in:\",d\n", + "print \"The maximum length of the rod in in:\",l1\n", + "print \"The minimum strain allowed on rod:\",e2\n", + "print \"The minimum cross-sectional area in in^2:\",Ao2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_3 pgno:213" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Modulus of elasticity of aluminum alloy from table 6-1: 10000000.0\n", + "The length after deformation of bar in in 50.15\n", + "Strain applied of aluminum alloy: 0.003\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "sigma1=35000;#Stress applied of aluminum alloy in psi from table 6-1\n", + "e1=0.0035;##Strain applied of aluminum alloy from table 6-1\n", + "sigma2=30000;#Stress applied of aluminum alloy in psi\n", + "Lo=50;#initial length of aluminum alloy\n", + "#CALCULATIONS\n", + "E=sigma1/e1;#Modulus of elasticity of aluminum alloy\n", + "e2=sigma2/E;#Strain applied of aluminum alloy\n", + "L=Lo+(e2*Lo);#The length after deformation of bar in in\n", + "print \"Modulus of elasticity of aluminum alloy from table 6-1:\",E\n", + "print \"The length after deformation of bar in in\",L\n", + "print \"Strain applied of aluminum alloy:\",e2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4 pgno:214" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Percentage of Elongation: 9.75\n", + "Percentage of Reduction in area: 37.9\n", + "The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Lf=2.195;#Final length after failure\n", + "d1=0.505;#Diameter of alluminum alloy in in\n", + "d2=0.398;#Final diameter of alluminum alloy in in\n", + "Lo=2;#Initial length of alluminum alloy \n", + "from math import pi\n", + "#CALCULATIONS\n", + "A0=(pi/4)*d1**2;#Area of original of alluminum alloy\n", + "Af=(pi/4)*d2**2;#Area of final of alluminum alloy\n", + "E=((Lf-Lo)/Lo)*100;#Percentage of Elongation \n", + "R=((A0-Af)/A0)*100;#Percentage of Reduction in area\n", + "print \"Percentage of Elongation:\",E\n", + "print \"Percentage of Reduction in area:\",round(R,1)\n", + "print\"The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_5 pgno:217" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Engineering stress in psiAt the tensile or maximum load 39940.8542609\n", + "True stress in psi At the tensile or maximum load 41237.025201\n", + "Engineering strain At the tensile or maximum load 0.06\n", + "True strain At the tensile or maximum load 0.058268908124\n", + "Engineering stress At fracture: 37943.8115478\n", + "True stress At fracture 61088.2335041\n", + "Engineering strain At fracture: 0.1025\n", + "True strain At fracture: 0.476\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "F=8000.;#.......#Load applied for the aluminum alloy in lb\n", + "F2=7600.;#......#Load applied for the aluminum alloy in lb at fracture\n", + "dt1=0.505;#.......#diameter of for the aluminum alloy in in\n", + "dt2=0.497;#.......#The diameter at maximum load\n", + "Lt=2.120;#..........#Final length at maxium load\n", + "Lot=2.;#.............#Initial length of alluminum alloy\n", + "Ff=7600.;#.........#Load applied for the aluminum alloy after fracture in lb\n", + "df=0.398;#.......#The diameter at maximum load after fracture\n", + "Lf=0.205;#.......#Final length at fracture\n", + "from math import pi,log\n", + "#CALCULATIONS\n", + "Es=F/((pi/4)*dt1**2);#.....#Engineering stress in psiAt the tensile or maximum load\n", + "Ts=F/((pi/4)*dt2**2);#.....#True stress in psi At the tensile or maximum load\n", + "Ee=(Lt-Lot)/Lot;#........#Engineering strain At the tensile or maximum load\n", + "Te=log(Lt/Lot);#........#True strain At the tensile or maximum load\n", + "Es2=F2/((pi/4)*dt1**2);#......##Engineering stress At fracture:\n", + "Ts2=F2/((pi/4)*df**2);#......#True stress At fracture:\n", + "Ee2=Lf/Lot;#..........#Engineering strain At fracture:\n", + "Te2=log(((pi/4)*dt1**2)/((pi/4)*df**2));#.......#True strain At fracture:\n", + "print \"Engineering stress in psiAt the tensile or maximum load\",Es\n", + "print \"True stress in psi At the tensile or maximum load\",Ts\n", + "print \"Engineering strain At the tensile or maximum load\",Ee\n", + "print \"True strain At the tensile or maximum load\",Te\n", + "print \"Engineering stress At fracture:\",Es2\n", + "print \"True stress At fracture\",Ts2\n", + "print \"Engineering strain At fracture:\",Ee2\n", + "print \"True strain At fracture:\",round(Te2,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_6 pgno:221" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The force required to fracture the material in lb: 421.875\n", + "The deflection of the sample at fracture in in 0.0278\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "Fs=45000;#.......#The flexural strength of a composite material in psi\n", + "Fm=18*10**6;#........#The flexural modulus of composite material in psi\n", + "w=0.5;#.......#wide of sample in in\n", + "h=0.375;#......#Height of sample in in\n", + "l=5;#..........#Length of sample in in\n", + "#CALCULATIONS\n", + "F=Fs*2*w*h**2/(3*l);#......#The force required to fracture the material in lb\n", + "delta=(l**3)*F/(Fm*4*w*h**3);#.......#The deflection of the sample at fracture \n", + "print \"The force required to fracture the material in lb:\",F\n", + "print \"The deflection of the sample at fracture in in\",round(delta,4)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two.ipynb new file mode 100755 index 00000000..d709254e --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two.ipynb @@ -0,0 +1,245 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7 Mechanical Properties part two" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_1 pgno:251" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.8 Depth of crank that will propagate in the steel in in:\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "f=1.12;#Geometry factor for the specimen and flaw\n", + "sigma=45000.;#Applied stress on Steel in psi\n", + "K=80000.;#The stress intensity factor\n", + "#CALCULATIONS\n", + "a=(K/(f*sigma))**2/pi;#Depth of crank in in\n", + "print round(a,1),\"Depth of crank that will propagate in the steel in in:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_2 pgno:253" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "706.0 The radius of the crack tip in Angstroms\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "T=60000.;#Tensile strength Of Sialon (acronym for silicon aluminum oxynitride) in psi\n", + "sigma=500.;#The stress at which the part unexpectedly fails in psi\n", + "a=0.01;#Depth of thin crack in in\n", + "#CALCULATIONS\n", + "r=a/(T/(2*sigma))**2;#The radius of the crack tip in in\n", + "print round(r*2.54*10**8),\"The radius of the crack tip in Angstroms\"\n", + "#difference in answer is due to erronous caluctions\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_3 pgno:254" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2.63 THickness of ceramic :\n" + ] + } + ], + "source": [ + "from math import sqrt,pi\n", + "# Initialisation of Variables\n", + "F=40000;# Maximum Tensile load in lb\n", + "K=9000;#Fracture toughness of Ceramic\n", + "w=3;# plate made of Sialon width \n", + "#CALCULATIONS\n", + "A=F*sqrt(pi)/K;#Area of ceramic\n", + "T=A/w;# Thickness of Ceramic\n", + "print round(T,2),\"THickness of ceramic :\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_8 pgno:263" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "269.4 The characteristic strength of the ceramic in MPa:\n", + "209.8 Expected level of stress that can be supported in MPa:\n" + ] + } + ], + "source": [ + "from math import log,exp\n", + "# Initialisation of Variables\n", + "m=9;#Weibull modulus of an ceramic \n", + "sigma1=250;#The flexural strength in MPa\n", + "F1=0.4;#probability of failure \n", + "F2=0.1;#Expected the probability of failure\n", + "#CALCULATIONS\n", + "sigma2=exp(log(sigma1)-(log(log(1/(1-F1)))/m ));# The characteristic strength of the ceramic\n", + "sigma3=exp((log(log(1/(1-F2)))/m)+log(sigma2));#Expected level of stress that can be supported in MPa\n", + "print round(sigma2,1),\"The characteristic strength of the ceramic in MPa:\"\n", + "print round(sigma3,1),\"Expected level of stress that can be supported in MPa:\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_9 pgno:264" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3.15 Weibull modulus of ceramic:\n" + ] + } + ], + "source": [ + "from math import log\n", + "# Initialisation of Variables\n", + "Ln1=0.5\n", + "Ln2=-2.0\n", + "\n", + "sigma1=52;#the maximum allowed stress level on ceramic at one point in MP.\n", + "sigma2=23.5;#the maximum allowed stress level on ceramic at another point in MP.\n", + "#CALCULATIONS\n", + "m=(Ln1-Ln2)/(log(sigma1)-log(sigma2));#Weibull modulus of ceramic\n", + "print round(m,2),\"Weibull modulus of ceramic:\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_11 pgno:270" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4.39 The Diameter of Shaft in in.:\n", + "5.54 The minimum diameter required to prevent failure in in.:\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "N=5.256*10**5;#No. of cycles that the shaft will experience in one year\n", + "F=12500.;#applied load on shaft in lb\n", + "L=96.;#Length of Kliin produced from tool steel in in.\n", + "sigma1=72000.;#the applied stress on Shaft\n", + "f=2.;#Factor of saftey of shaft\n", + "sigma2=sigma1/f;#the maximum allowed stress level\n", + "#CALCULATIONS\n", + "d1=(16*F*L/(sigma1*pi))**(1./3.);#The Diameter of Shaft in in.\n", + "d2=(16*F*L/(sigma2*pi))**(1./3.);#The minimum diameter required to prevent failure\n", + "print round(d1,2),\"The Diameter of Shaft in in.:\"\n", + "print round(d2,2),\"The minimum diameter required to prevent failure in in.:\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_1.ipynb new file mode 100755 index 00000000..d709254e --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_1.ipynb @@ -0,0 +1,245 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7 Mechanical Properties part two" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_1 pgno:251" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.8 Depth of crank that will propagate in the steel in in:\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "f=1.12;#Geometry factor for the specimen and flaw\n", + "sigma=45000.;#Applied stress on Steel in psi\n", + "K=80000.;#The stress intensity factor\n", + "#CALCULATIONS\n", + "a=(K/(f*sigma))**2/pi;#Depth of crank in in\n", + "print round(a,1),\"Depth of crank that will propagate in the steel in in:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_2 pgno:253" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "706.0 The radius of the crack tip in Angstroms\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "T=60000.;#Tensile strength Of Sialon (acronym for silicon aluminum oxynitride) in psi\n", + "sigma=500.;#The stress at which the part unexpectedly fails in psi\n", + "a=0.01;#Depth of thin crack in in\n", + "#CALCULATIONS\n", + "r=a/(T/(2*sigma))**2;#The radius of the crack tip in in\n", + "print round(r*2.54*10**8),\"The radius of the crack tip in Angstroms\"\n", + "#difference in answer is due to erronous caluctions\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_3 pgno:254" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2.63 THickness of ceramic :\n" + ] + } + ], + "source": [ + "from math import sqrt,pi\n", + "# Initialisation of Variables\n", + "F=40000;# Maximum Tensile load in lb\n", + "K=9000;#Fracture toughness of Ceramic\n", + "w=3;# plate made of Sialon width \n", + "#CALCULATIONS\n", + "A=F*sqrt(pi)/K;#Area of ceramic\n", + "T=A/w;# Thickness of Ceramic\n", + "print round(T,2),\"THickness of ceramic :\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_8 pgno:263" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "269.4 The characteristic strength of the ceramic in MPa:\n", + "209.8 Expected level of stress that can be supported in MPa:\n" + ] + } + ], + "source": [ + "from math import log,exp\n", + "# Initialisation of Variables\n", + "m=9;#Weibull modulus of an ceramic \n", + "sigma1=250;#The flexural strength in MPa\n", + "F1=0.4;#probability of failure \n", + "F2=0.1;#Expected the probability of failure\n", + "#CALCULATIONS\n", + "sigma2=exp(log(sigma1)-(log(log(1/(1-F1)))/m ));# The characteristic strength of the ceramic\n", + "sigma3=exp((log(log(1/(1-F2)))/m)+log(sigma2));#Expected level of stress that can be supported in MPa\n", + "print round(sigma2,1),\"The characteristic strength of the ceramic in MPa:\"\n", + "print round(sigma3,1),\"Expected level of stress that can be supported in MPa:\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_9 pgno:264" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3.15 Weibull modulus of ceramic:\n" + ] + } + ], + "source": [ + "from math import log\n", + "# Initialisation of Variables\n", + "Ln1=0.5\n", + "Ln2=-2.0\n", + "\n", + "sigma1=52;#the maximum allowed stress level on ceramic at one point in MP.\n", + "sigma2=23.5;#the maximum allowed stress level on ceramic at another point in MP.\n", + "#CALCULATIONS\n", + "m=(Ln1-Ln2)/(log(sigma1)-log(sigma2));#Weibull modulus of ceramic\n", + "print round(m,2),\"Weibull modulus of ceramic:\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_11 pgno:270" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4.39 The Diameter of Shaft in in.:\n", + "5.54 The minimum diameter required to prevent failure in in.:\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "N=5.256*10**5;#No. of cycles that the shaft will experience in one year\n", + "F=12500.;#applied load on shaft in lb\n", + "L=96.;#Length of Kliin produced from tool steel in in.\n", + "sigma1=72000.;#the applied stress on Shaft\n", + "f=2.;#Factor of saftey of shaft\n", + "sigma2=sigma1/f;#the maximum allowed stress level\n", + "#CALCULATIONS\n", + "d1=(16*F*L/(sigma1*pi))**(1./3.);#The Diameter of Shaft in in.\n", + "d2=(16*F*L/(sigma2*pi))**(1./3.);#The minimum diameter required to prevent failure\n", + "print round(d1,2),\"The Diameter of Shaft in in.:\"\n", + "print round(d2,2),\"The minimum diameter required to prevent failure in in.:\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_2.ipynb new file mode 100755 index 00000000..481aa53d --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_2.ipynb @@ -0,0 +1,245 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7 Mechanical Properties part two" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_1 pgno:251" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Depth of crank that will propagate in the steel in: 0.8\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "f=1.12;#Geometry factor for the specimen and flaw\n", + "sigma=45000.;#Applied stress on Steel in psi\n", + "K=80000.;#The stress intensity factor\n", + "#CALCULATIONS\n", + "a=(K/(f*sigma))**2/pi;#Depth of crank in in\n", + "print \"Depth of crank that will propagate in the steel in:\",round(a,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_2 pgno:253" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The radius of the crack tip in Angstroms 706.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "T=60000.;#Tensile strength Of Sialon (acronym for silicon aluminum oxynitride) in psi\n", + "sigma=500.;#The stress at which the part unexpectedly fails in psi\n", + "a=0.01;#Depth of thin crack in in\n", + "#CALCULATIONS\n", + "r=a/(T/(2*sigma))**2;#The radius of the crack tip in in\n", + "print \"The radius of the crack tip in Angstroms\",round(r*2.54*10**8)\n", + "#difference in answer is due to erronous caluctions\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_3 pgno:254" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "THickness of ceramic : 2.63\n" + ] + } + ], + "source": [ + "from math import sqrt,pi\n", + "# Initialisation of Variables\n", + "F=40000;# Maximum Tensile load in lb\n", + "K=9000;#Fracture toughness of Ceramic\n", + "w=3;# plate made of Sialon width \n", + "#CALCULATIONS\n", + "A=F*sqrt(pi)/K;#Area of ceramic\n", + "T=A/w;# Thickness of Ceramic\n", + "print \"THickness of ceramic :\",round(T,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_8 pgno:263" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The characteristic strength of the ceramic in MPa: 269.4\n", + "Expected level of stress that can be supported in MPa: 209.8\n" + ] + } + ], + "source": [ + "from math import log,exp\n", + "# Initialisation of Variables\n", + "m=9;#Weibull modulus of an ceramic \n", + "sigma1=250;#The flexural strength in MPa\n", + "F1=0.4;#probability of failure \n", + "F2=0.1;#Expected the probability of failure\n", + "#CALCULATIONS\n", + "sigma2=exp(log(sigma1)-(log(log(1/(1-F1)))/m ));# The characteristic strength of the ceramic\n", + "sigma3=exp((log(log(1/(1-F2)))/m)+log(sigma2));#Expected level of stress that can be supported in MPa\n", + "print \"The characteristic strength of the ceramic in MPa:\",round(sigma2,1)\n", + "print \"Expected level of stress that can be supported in MPa:\",round(sigma3,1)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_9 pgno:264" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Weibull modulus of ceramic: 3.15\n" + ] + } + ], + "source": [ + "from math import log\n", + "# Initialisation of Variables\n", + "Ln1=0.5\n", + "Ln2=-2.0\n", + "\n", + "sigma1=52;#the maximum allowed stress level on ceramic at one point in MP.\n", + "sigma2=23.5;#the maximum allowed stress level on ceramic at another point in MP.\n", + "#CALCULATIONS\n", + "m=(Ln1-Ln2)/(log(sigma1)-log(sigma2));#Weibull modulus of ceramic\n", + "print \"Weibull modulus of ceramic:\",round(m,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_11 pgno:270" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The Diameter of Shaft in in.: 4.39\n", + "The minimum diameter required to prevent failure in in.: 5.54\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "N=5.256*10**5;#No. of cycles that the shaft will experience in one year\n", + "F=12500.;#applied load on shaft in lb\n", + "L=96.;#Length of Kliin produced from tool steel in in.\n", + "sigma1=72000.;#the applied stress on Shaft\n", + "f=2.;#Factor of saftey of shaft\n", + "sigma2=sigma1/f;#the maximum allowed stress level\n", + "#CALCULATIONS\n", + "d1=(16*F*L/(sigma1*pi))**(1./3.);#The Diameter of Shaft in in.\n", + "d2=(16*F*L/(sigma2*pi))**(1./3.);#The minimum diameter required to prevent failure\n", + "print \"The Diameter of Shaft in in.:\",round(d1,2)\n", + "print \"The minimum diameter required to prevent failure in in.:\",round(d2,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_3.ipynb new file mode 100755 index 00000000..481aa53d --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_3.ipynb @@ -0,0 +1,245 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7 Mechanical Properties part two" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_1 pgno:251" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Depth of crank that will propagate in the steel in: 0.8\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "f=1.12;#Geometry factor for the specimen and flaw\n", + "sigma=45000.;#Applied stress on Steel in psi\n", + "K=80000.;#The stress intensity factor\n", + "#CALCULATIONS\n", + "a=(K/(f*sigma))**2/pi;#Depth of crank in in\n", + "print \"Depth of crank that will propagate in the steel in:\",round(a,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_2 pgno:253" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The radius of the crack tip in Angstroms 706.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "T=60000.;#Tensile strength Of Sialon (acronym for silicon aluminum oxynitride) in psi\n", + "sigma=500.;#The stress at which the part unexpectedly fails in psi\n", + "a=0.01;#Depth of thin crack in in\n", + "#CALCULATIONS\n", + "r=a/(T/(2*sigma))**2;#The radius of the crack tip in in\n", + "print \"The radius of the crack tip in Angstroms\",round(r*2.54*10**8)\n", + "#difference in answer is due to erronous caluctions\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_3 pgno:254" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "THickness of ceramic : 2.63\n" + ] + } + ], + "source": [ + "from math import sqrt,pi\n", + "# Initialisation of Variables\n", + "F=40000;# Maximum Tensile load in lb\n", + "K=9000;#Fracture toughness of Ceramic\n", + "w=3;# plate made of Sialon width \n", + "#CALCULATIONS\n", + "A=F*sqrt(pi)/K;#Area of ceramic\n", + "T=A/w;# Thickness of Ceramic\n", + "print \"THickness of ceramic :\",round(T,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_8 pgno:263" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The characteristic strength of the ceramic in MPa: 269.4\n", + "Expected level of stress that can be supported in MPa: 209.8\n" + ] + } + ], + "source": [ + "from math import log,exp\n", + "# Initialisation of Variables\n", + "m=9;#Weibull modulus of an ceramic \n", + "sigma1=250;#The flexural strength in MPa\n", + "F1=0.4;#probability of failure \n", + "F2=0.1;#Expected the probability of failure\n", + "#CALCULATIONS\n", + "sigma2=exp(log(sigma1)-(log(log(1/(1-F1)))/m ));# The characteristic strength of the ceramic\n", + "sigma3=exp((log(log(1/(1-F2)))/m)+log(sigma2));#Expected level of stress that can be supported in MPa\n", + "print \"The characteristic strength of the ceramic in MPa:\",round(sigma2,1)\n", + "print \"Expected level of stress that can be supported in MPa:\",round(sigma3,1)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_9 pgno:264" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Weibull modulus of ceramic: 3.15\n" + ] + } + ], + "source": [ + "from math import log\n", + "# Initialisation of Variables\n", + "Ln1=0.5\n", + "Ln2=-2.0\n", + "\n", + "sigma1=52;#the maximum allowed stress level on ceramic at one point in MP.\n", + "sigma2=23.5;#the maximum allowed stress level on ceramic at another point in MP.\n", + "#CALCULATIONS\n", + "m=(Ln1-Ln2)/(log(sigma1)-log(sigma2));#Weibull modulus of ceramic\n", + "print \"Weibull modulus of ceramic:\",round(m,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_11 pgno:270" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The Diameter of Shaft in in.: 4.39\n", + "The minimum diameter required to prevent failure in in.: 5.54\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "N=5.256*10**5;#No. of cycles that the shaft will experience in one year\n", + "F=12500.;#applied load on shaft in lb\n", + "L=96.;#Length of Kliin produced from tool steel in in.\n", + "sigma1=72000.;#the applied stress on Shaft\n", + "f=2.;#Factor of saftey of shaft\n", + "sigma2=sigma1/f;#the maximum allowed stress level\n", + "#CALCULATIONS\n", + "d1=(16*F*L/(sigma1*pi))**(1./3.);#The Diameter of Shaft in in.\n", + "d2=(16*F*L/(sigma2*pi))**(1./3.);#The minimum diameter required to prevent failure\n", + "print \"The Diameter of Shaft in in.:\",round(d1,2)\n", + "print \"The minimum diameter required to prevent failure in in.:\",round(d2,2)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing_.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing_.ipynb new file mode 100755 index 00000000..746aa314 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing_.ipynb @@ -0,0 +1,223 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8 Strain Hardening and Annealing " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1 pgno:300" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "50.0 Amount of Cold work accomplished in step1:\n", + "68.0 Amount of Cold work accomplished in step2:\n", + "84.0 Actual Total Cold work in percent:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "t0=1;#Thickness of Copper plate in cm\n", + "tf=0.50;#Cold reducetion of coopper in cm in step1\n", + "tf2=0.16;# Further Cold reduction of cooper in cm in step2\n", + "#CALCULATIONS\n", + "CW1=((t0-tf)/t0)*100;#Amount of Cold work accomplished in step1\n", + "CW2=((tf-tf2)/tf)*100;#Amount of Cold work accomplished in step2\n", + "CW=((t0-tf2)/t0)*100;#Actual Total Cold work in percent\n", + "print CW1,\"Amount of Cold work accomplished in step1:\" \n", + "print CW2,\"Amount of Cold work accomplished in step2:\"\n", + "print CW,\"Actual Total Cold work in percent:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_2 pgno:301" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.167 Maximum thicknessproduced in cm:\n", + "0.182 Minimum thicknessproduced in cm:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "tf=0.1;#Thickness of cooper to produce in cm\n", + "CW1=40.;#cold work to produce a tensile strengthof 65,000 psi\n", + "CW2=45.;#cold work to produce a tensile strengthof 60,000 psi\n", + "#CALCULATIONS\n", + "Tmax=(tf/(1-(CW1/100)));#Maximum thicknessproduced in step1 in cm\n", + "Tmin=(tf/(1-(CW2/100)));#Minimum thicknessproduced in step2 in cm\n", + "print round(Tmax,3),\"Maximum thicknessproduced in cm:\"\n", + "print round(Tmin,3),\"Minimum thicknessproduced in cm:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_4 pgno:307" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "75.0 The fianal Cold Work in percent:\n", + "2764.60153516 The draw force required to deform the initial wire in lb:\n", + "88000.0 The stress acting on the wire after passing through the die in psi:\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "D0=0.40;#Let's assume that the starting diameter of the copper wire in in.\n", + "Df=0.20;# Diameter of the copper wire to be produced in in.\n", + "sigma1=22000;#Yeidl strength at 0% cold work\n", + "#CALCULATIONS\n", + "CW=((D0**2-Df**2)/D0**2)*100;#The fianal Cold Work in percent\n", + "F=sigma1*(pi/4)*D0**2;#The draw force required to deform the initial wire in lb\n", + "sigma2=F/((pi/4)*Df**2);# The stress acting on the wire after passing through the die in psi\n", + "print CW,\"The fianal Cold Work in percent:\"\n", + "print F,\"The draw force required to deform the initial wire in lb:\"\n", + "print sigma2,\"The stress acting on the wire after passing through the die in psi:\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5 pgno:313" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "96.36 Cold work between from 5 to 0.182 cm in percent:\n", + "5 1. Final Thickness of strip in cm\n", + "270.2 2. Recrystallization temperature By using 0.4Tm relationship in degree celsius:\n", + "81.8 3. Cold work of the strip of 1 cm thickness :\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "t0=5;#Assming we are able to purchase only 5-cm thick stock\n", + "t02=1;#Thickness of strip in cm\n", + "tf=0.182;#Final thickness of strip in cm\n", + "CW2=80;#cold work of a strip in percent\n", + "M=1085;# The melting point of copper in degree celsius\n", + "#CALCULATIONS\n", + "CW=((t0-tf)/t0)*100;#Cold work between from 5 to 0.182 cm in percent\n", + "tf2=(1-(CW2/100))*t0;# Final Thickness of strip in cm\n", + "Tr=0.4*(M+273);# Recrystallization temperature By using 0.4Tm relationship in degree celsius\n", + "CW3=((t02-tf)/t02)*100;#Cold work of the strip of 1 cm thickness \n", + "print CW,\"Cold work between from 5 to 0.182 cm in percent:\"\n", + "print tf2,\"1. Final Thickness of strip in cm\"\n", + "print Tr-273,\"2. Recrystallization temperature By using 0.4Tm relationship in degree celsius:\"\n", + "print CW3,\" 3. Cold work of the strip of 1 cm thickness :\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_6 pgno:316" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "96.36 Hot work for a strip from 5cm to 0.182 cm in percent:\n", + "96.66 Hot work for a strip from 5cm to 0.167 cm in percent\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "t0=5;#We are able to purchase strip of 5cm thickness in cm\n", + "tf=0.182;#Thickness to be produced in cm\n", + "tf2=0.167;#Thickness to procedure in cm\n", + "#CALCULATIONS\n", + "HW=((t0-tf)/t0)*100;#Hot work for a strip from 5cm to 0.182 cm in percent\n", + "HW2=((t0-tf2)/t0)*100;#Hot work for a strip from 5cm to 0.167 cm in percent\n", + "print round(HW,1),\"Hot work for a strip from 5cm to 0.182 cm in percent:\"\n", + "print round(HW2,1),\"Hot work for a strip from 5cm to 0.167 cm in percent\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__1.ipynb new file mode 100755 index 00000000..746aa314 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__1.ipynb @@ -0,0 +1,223 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8 Strain Hardening and Annealing " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1 pgno:300" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "50.0 Amount of Cold work accomplished in step1:\n", + "68.0 Amount of Cold work accomplished in step2:\n", + "84.0 Actual Total Cold work in percent:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "t0=1;#Thickness of Copper plate in cm\n", + "tf=0.50;#Cold reducetion of coopper in cm in step1\n", + "tf2=0.16;# Further Cold reduction of cooper in cm in step2\n", + "#CALCULATIONS\n", + "CW1=((t0-tf)/t0)*100;#Amount of Cold work accomplished in step1\n", + "CW2=((tf-tf2)/tf)*100;#Amount of Cold work accomplished in step2\n", + "CW=((t0-tf2)/t0)*100;#Actual Total Cold work in percent\n", + "print CW1,\"Amount of Cold work accomplished in step1:\" \n", + "print CW2,\"Amount of Cold work accomplished in step2:\"\n", + "print CW,\"Actual Total Cold work in percent:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_2 pgno:301" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.167 Maximum thicknessproduced in cm:\n", + "0.182 Minimum thicknessproduced in cm:\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "tf=0.1;#Thickness of cooper to produce in cm\n", + "CW1=40.;#cold work to produce a tensile strengthof 65,000 psi\n", + "CW2=45.;#cold work to produce a tensile strengthof 60,000 psi\n", + "#CALCULATIONS\n", + "Tmax=(tf/(1-(CW1/100)));#Maximum thicknessproduced in step1 in cm\n", + "Tmin=(tf/(1-(CW2/100)));#Minimum thicknessproduced in step2 in cm\n", + "print round(Tmax,3),\"Maximum thicknessproduced in cm:\"\n", + "print round(Tmin,3),\"Minimum thicknessproduced in cm:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_4 pgno:307" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "75.0 The fianal Cold Work in percent:\n", + "2764.60153516 The draw force required to deform the initial wire in lb:\n", + "88000.0 The stress acting on the wire after passing through the die in psi:\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "D0=0.40;#Let's assume that the starting diameter of the copper wire in in.\n", + "Df=0.20;# Diameter of the copper wire to be produced in in.\n", + "sigma1=22000;#Yeidl strength at 0% cold work\n", + "#CALCULATIONS\n", + "CW=((D0**2-Df**2)/D0**2)*100;#The fianal Cold Work in percent\n", + "F=sigma1*(pi/4)*D0**2;#The draw force required to deform the initial wire in lb\n", + "sigma2=F/((pi/4)*Df**2);# The stress acting on the wire after passing through the die in psi\n", + "print CW,\"The fianal Cold Work in percent:\"\n", + "print F,\"The draw force required to deform the initial wire in lb:\"\n", + "print sigma2,\"The stress acting on the wire after passing through the die in psi:\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5 pgno:313" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "96.36 Cold work between from 5 to 0.182 cm in percent:\n", + "5 1. Final Thickness of strip in cm\n", + "270.2 2. Recrystallization temperature By using 0.4Tm relationship in degree celsius:\n", + "81.8 3. Cold work of the strip of 1 cm thickness :\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "t0=5;#Assming we are able to purchase only 5-cm thick stock\n", + "t02=1;#Thickness of strip in cm\n", + "tf=0.182;#Final thickness of strip in cm\n", + "CW2=80;#cold work of a strip in percent\n", + "M=1085;# The melting point of copper in degree celsius\n", + "#CALCULATIONS\n", + "CW=((t0-tf)/t0)*100;#Cold work between from 5 to 0.182 cm in percent\n", + "tf2=(1-(CW2/100))*t0;# Final Thickness of strip in cm\n", + "Tr=0.4*(M+273);# Recrystallization temperature By using 0.4Tm relationship in degree celsius\n", + "CW3=((t02-tf)/t02)*100;#Cold work of the strip of 1 cm thickness \n", + "print CW,\"Cold work between from 5 to 0.182 cm in percent:\"\n", + "print tf2,\"1. Final Thickness of strip in cm\"\n", + "print Tr-273,\"2. Recrystallization temperature By using 0.4Tm relationship in degree celsius:\"\n", + "print CW3,\" 3. Cold work of the strip of 1 cm thickness :\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_6 pgno:316" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "96.36 Hot work for a strip from 5cm to 0.182 cm in percent:\n", + "96.66 Hot work for a strip from 5cm to 0.167 cm in percent\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "t0=5;#We are able to purchase strip of 5cm thickness in cm\n", + "tf=0.182;#Thickness to be produced in cm\n", + "tf2=0.167;#Thickness to procedure in cm\n", + "#CALCULATIONS\n", + "HW=((t0-tf)/t0)*100;#Hot work for a strip from 5cm to 0.182 cm in percent\n", + "HW2=((t0-tf2)/t0)*100;#Hot work for a strip from 5cm to 0.167 cm in percent\n", + "print round(HW,1),\"Hot work for a strip from 5cm to 0.182 cm in percent:\"\n", + "print round(HW2,1),\"Hot work for a strip from 5cm to 0.167 cm in percent\"\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__2.ipynb new file mode 100755 index 00000000..e78c64e9 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__2.ipynb @@ -0,0 +1,223 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8 Strain Hardening and Annealing " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1 pgno:300" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Amount of Cold work accomplished in step1: 50.0\n", + "Amount of Cold work accomplished in step2: 68.0\n", + "Actual Total Cold work in percent: 84.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "t0=1;#Thickness of Copper plate in cm\n", + "tf=0.50;#Cold reducetion of coopper in cm in step1\n", + "tf2=0.16;# Further Cold reduction of cooper in cm in step2\n", + "#CALCULATIONS\n", + "CW1=((t0-tf)/t0)*100;#Amount of Cold work accomplished in step1\n", + "CW2=((tf-tf2)/tf)*100;#Amount of Cold work accomplished in step2\n", + "CW=((t0-tf2)/t0)*100;#Actual Total Cold work in percent\n", + "print \"Amount of Cold work accomplished in step1:\",CW1 \n", + "print \"Amount of Cold work accomplished in step2:\",CW2\n", + "print \"Actual Total Cold work in percent:\",CW\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_2 pgno:301" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Maximum thicknessproduced in cm: 0.167\n", + "Minimum thicknessproduced in cm: 0.182\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "tf=0.1;#Thickness of cooper to produce in cm\n", + "CW1=40.;#cold work to produce a tensile strengthof 65,000 psi\n", + "CW2=45.;#cold work to produce a tensile strengthof 60,000 psi\n", + "#CALCULATIONS\n", + "Tmax=(tf/(1-(CW1/100)));#Maximum thicknessproduced in step1 in cm\n", + "Tmin=(tf/(1-(CW2/100)));#Minimum thicknessproduced in step2 in cm\n", + "print \"Maximum thicknessproduced in cm:\",round(Tmax,3)\n", + "print \"Minimum thicknessproduced in cm:\",round(Tmin,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_4 pgno:307" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "75.0 The fianal Cold Work in percent:\n", + "The draw force required to deform the initial wire in lb: 2764.60153516\n", + "The stress acting on the wire after passing through the die in psi: 88000.0\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "D0=0.40;#Let's assume that the starting diameter of the copper wire in in.\n", + "Df=0.20;# Diameter of the copper wire to be produced in in.\n", + "sigma1=22000;#Yeidl strength at 0% cold work\n", + "#CALCULATIONS\n", + "CW=((D0**2-Df**2)/D0**2)*100;#The fianal Cold Work in percent\n", + "F=sigma1*(pi/4)*D0**2;#The draw force required to deform the initial wire in lb\n", + "sigma2=F/((pi/4)*Df**2);# The stress acting on the wire after passing through the die in psi\n", + "print CW,\"The fianal Cold Work in percent:\"\n", + "print \"The draw force required to deform the initial wire in lb:\",F\n", + "print \"The stress acting on the wire after passing through the die in psi:\",sigma2\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5 pgno:313" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cold work between from 5 to 0.182 cm in percent: 96.36\n", + "1. Final Thickness of strip in cm 5\n", + "2. Recrystallization temperature By using 0.4Tm relationship in degree celsius: 270.2\n", + "3. Cold work of the strip of 1 cm thickness : 81.8\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "t0=5;#Assming we are able to purchase only 5-cm thick stock\n", + "t02=1;#Thickness of strip in cm\n", + "tf=0.182;#Final thickness of strip in cm\n", + "CW2=80;#cold work of a strip in percent\n", + "M=1085;# The melting point of copper in degree celsius\n", + "#CALCULATIONS\n", + "CW=((t0-tf)/t0)*100;#Cold work between from 5 to 0.182 cm in percent\n", + "tf2=(1-(CW2/100))*t0;# Final Thickness of strip in cm\n", + "Tr=0.4*(M+273);# Recrystallization temperature By using 0.4Tm relationship in degree celsius\n", + "CW3=((t02-tf)/t02)*100;#Cold work of the strip of 1 cm thickness \n", + "print \"Cold work between from 5 to 0.182 cm in percent:\",CW\n", + "print \"1. Final Thickness of strip in cm\",tf2\n", + "print \"2. Recrystallization temperature By using 0.4Tm relationship in degree celsius:\",Tr-273\n", + "print \"3. Cold work of the strip of 1 cm thickness :\",CW3" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_6 pgno:316" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hot work for a strip from 5cm to 0.182 cm in percent: 96.4\n", + "Hot work for a strip from 5cm to 0.167 cm in percent 96.7\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "t0=5;#We are able to purchase strip of 5cm thickness in cm\n", + "tf=0.182;#Thickness to be produced in cm\n", + "tf2=0.167;#Thickness to procedure in cm\n", + "#CALCULATIONS\n", + "HW=((t0-tf)/t0)*100;#Hot work for a strip from 5cm to 0.182 cm in percent\n", + "HW2=((t0-tf2)/t0)*100;#Hot work for a strip from 5cm to 0.167 cm in percent\n", + "print \"Hot work for a strip from 5cm to 0.182 cm in percent:\",round(HW,1)\n", + "print \"Hot work for a strip from 5cm to 0.167 cm in percent\",round(HW2,1)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__3.ipynb new file mode 100755 index 00000000..e78c64e9 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__3.ipynb @@ -0,0 +1,223 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8 Strain Hardening and Annealing " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1 pgno:300" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Amount of Cold work accomplished in step1: 50.0\n", + "Amount of Cold work accomplished in step2: 68.0\n", + "Actual Total Cold work in percent: 84.0\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "t0=1;#Thickness of Copper plate in cm\n", + "tf=0.50;#Cold reducetion of coopper in cm in step1\n", + "tf2=0.16;# Further Cold reduction of cooper in cm in step2\n", + "#CALCULATIONS\n", + "CW1=((t0-tf)/t0)*100;#Amount of Cold work accomplished in step1\n", + "CW2=((tf-tf2)/tf)*100;#Amount of Cold work accomplished in step2\n", + "CW=((t0-tf2)/t0)*100;#Actual Total Cold work in percent\n", + "print \"Amount of Cold work accomplished in step1:\",CW1 \n", + "print \"Amount of Cold work accomplished in step2:\",CW2\n", + "print \"Actual Total Cold work in percent:\",CW\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_2 pgno:301" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Maximum thicknessproduced in cm: 0.167\n", + "Minimum thicknessproduced in cm: 0.182\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "tf=0.1;#Thickness of cooper to produce in cm\n", + "CW1=40.;#cold work to produce a tensile strengthof 65,000 psi\n", + "CW2=45.;#cold work to produce a tensile strengthof 60,000 psi\n", + "#CALCULATIONS\n", + "Tmax=(tf/(1-(CW1/100)));#Maximum thicknessproduced in step1 in cm\n", + "Tmin=(tf/(1-(CW2/100)));#Minimum thicknessproduced in step2 in cm\n", + "print \"Maximum thicknessproduced in cm:\",round(Tmax,3)\n", + "print \"Minimum thicknessproduced in cm:\",round(Tmin,3)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_4 pgno:307" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "75.0 The fianal Cold Work in percent:\n", + "The draw force required to deform the initial wire in lb: 2764.60153516\n", + "The stress acting on the wire after passing through the die in psi: 88000.0\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "D0=0.40;#Let's assume that the starting diameter of the copper wire in in.\n", + "Df=0.20;# Diameter of the copper wire to be produced in in.\n", + "sigma1=22000;#Yeidl strength at 0% cold work\n", + "#CALCULATIONS\n", + "CW=((D0**2-Df**2)/D0**2)*100;#The fianal Cold Work in percent\n", + "F=sigma1*(pi/4)*D0**2;#The draw force required to deform the initial wire in lb\n", + "sigma2=F/((pi/4)*Df**2);# The stress acting on the wire after passing through the die in psi\n", + "print CW,\"The fianal Cold Work in percent:\"\n", + "print \"The draw force required to deform the initial wire in lb:\",F\n", + "print \"The stress acting on the wire after passing through the die in psi:\",sigma2\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5 pgno:313" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cold work between from 5 to 0.182 cm in percent: 96.36\n", + "1. Final Thickness of strip in cm 5\n", + "2. Recrystallization temperature By using 0.4Tm relationship in degree celsius: 270.2\n", + "3. Cold work of the strip of 1 cm thickness : 81.8\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "t0=5;#Assming we are able to purchase only 5-cm thick stock\n", + "t02=1;#Thickness of strip in cm\n", + "tf=0.182;#Final thickness of strip in cm\n", + "CW2=80;#cold work of a strip in percent\n", + "M=1085;# The melting point of copper in degree celsius\n", + "#CALCULATIONS\n", + "CW=((t0-tf)/t0)*100;#Cold work between from 5 to 0.182 cm in percent\n", + "tf2=(1-(CW2/100))*t0;# Final Thickness of strip in cm\n", + "Tr=0.4*(M+273);# Recrystallization temperature By using 0.4Tm relationship in degree celsius\n", + "CW3=((t02-tf)/t02)*100;#Cold work of the strip of 1 cm thickness \n", + "print \"Cold work between from 5 to 0.182 cm in percent:\",CW\n", + "print \"1. Final Thickness of strip in cm\",tf2\n", + "print \"2. Recrystallization temperature By using 0.4Tm relationship in degree celsius:\",Tr-273\n", + "print \"3. Cold work of the strip of 1 cm thickness :\",CW3" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_6 pgno:316" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hot work for a strip from 5cm to 0.182 cm in percent: 96.4\n", + "Hot work for a strip from 5cm to 0.167 cm in percent 96.7\n" + ] + } + ], + "source": [ + "# Initialisation of Variables\n", + "t0=5;#We are able to purchase strip of 5cm thickness in cm\n", + "tf=0.182;#Thickness to be produced in cm\n", + "tf2=0.167;#Thickness to procedure in cm\n", + "#CALCULATIONS\n", + "HW=((t0-tf)/t0)*100;#Hot work for a strip from 5cm to 0.182 cm in percent\n", + "HW2=((t0-tf2)/t0)*100;#Hot work for a strip from 5cm to 0.167 cm in percent\n", + "print \"Hot work for a strip from 5cm to 0.182 cm in percent:\",round(HW,1)\n", + "print \"Hot work for a strip from 5cm to 0.167 cm in percent\",round(HW2,1)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification.ipynb new file mode 100755 index 00000000..f4d5de3a --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification.ipynb @@ -0,0 +1,191 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9 Principles of Solidification" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_1 pgno:333" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "12.5122850123 Critical Radius of copper in cm:\n", + "4.7241633375e-23 Volume of FCC unit cell of copper in cm**3:\n", + "8.2053761484e-21 Critical volume of FCC copper :\n", + "174.0 The number of unit cells in the critical nucleus :\n", + "696.0 Since there are four atoms in each unit cell of FCC metals:\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "deltaT=236;#Typical Undercooling for HomogeneousNucleation from the table 9-1 for cooper \n", + "Tm=1358;#Freezing Temperature from the table 9-1 for cooper in degree celsius\n", + "deltaH=1628;# Latent Heat of Fusion from the table 9-1 for cooper in J/cm**3\n", + "sigma1=177*10**-7;#Solid-Liquid Interfacial Energyfrom the table 9-1 for cooper in J/cm**2\n", + "a0=3.615*10**-8;#The lattice parameter for FCC copper in cm\n", + "#CALCULATIONS\n", + "r=(2*sigma1*Tm)/(deltaH*deltaT);#Critical Radius of copper in cm\n", + "V=a0**3;#Volume of FCC unit cell of copper in cm**3\n", + "V2=(4./3.)*pi*r**3;#Critical volume of FCC copper \n", + "N=V2/V#The number of unit cells in the critical nucleus \n", + "Nc=4*round(N);#Since there are four atoms in each unit cell of FCC metals\n", + "print r*10**8,\"Critical Radius of copper in cm:\"\n", + "print V,\"Volume of FCC unit cell of copper in cm**3:\"\n", + "print V2,\"Critical volume of FCC copper :\"\n", + "print round(N),\"The number of unit cells in the critical nucleus :\"\n", + "print Nc,\"Since there are four atoms in each unit cell of FCC metals:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_2 pgno:339" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.73 The thickness in inches=\n" + ] + } + ], + "source": [ + "from math import pi\n", + "#page 255\n", + "# Initialisation of Variables\n", + "d=18.;#Diameter of the casting in in\n", + "x=2.;#Thickness of the casting in in\n", + "B=22.#Mold constant of casting\n", + "V=(pi/4.)*d**2;#Volume of the casting in in**3\n", + "A=2*(pi/4.)*d**2+pi*d*x;#The surface area of the casting in contact with the mold\n", + "x=(0.708*A)/V\n", + "print round(x,2),\"The thickness in inches=\"\n", + "#the diffrence in asnwer is due to round foo error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_4 pgno:342" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the total solidification time is 31.28\n" + ] + } + ], + "source": [ + "#page 250\n", + "\n", + "# Initialisation of Variables\n", + "d=5#inches\n", + "t1=5#mins\n", + "t2=20#mins\n", + "d2=1.5#inches\n", + "#CALCULATIONS\n", + "ksol=0.447#inches/mts**0.5\n", + "c1=0.5;\n", + "t=((d-3+c1)/ksol)**2\n", + "print \"the total solidification time is \",round(t,2)#mins" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_5 pgno:342" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.77\n" + ] + } + ], + "source": [ + "#page 250\n", + "from math import pi\n", + "from sympy import *\n", + "# Initialisation of Variables\n", + "l=12 #inchs\n", + "w=8#inchs\n", + "ts=40000#psi\n", + "mc=45#mins/in**2\n", + "x=symbols('x')\n", + "v=8*12*x\n", + "a=2*8*12+2*x*12\n", + "#by solving the two equations we get \n", + "x=64/82.67;\n", + "print round(x,2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_1.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_1.ipynb new file mode 100755 index 00000000..c5febd67 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_1.ipynb @@ -0,0 +1,191 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9 Principles of Solidification" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_1 pgno:333" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "12.5122850123 Critical Radius of copper in cm:\n", + "4.7241633375e-23 Volume of FCC unit cell of copper in cm**3:\n", + "8.2053761484e-21 Critical volume of FCC copper :\n", + "174.0 The number of unit cells in the critical nucleus :\n", + "696.0 Since there are four atoms in each unit cell of FCC metals:\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "deltaT=236;#Typical Undercooling for HomogeneousNucleation from the table 9-1 for cooper \n", + "Tm=1358;#Freezing Temperature from the table 9-1 for cooper in degree celsius\n", + "deltaH=1628;# Latent Heat of Fusion from the table 9-1 for cooper in J/cm**3\n", + "sigma1=177*10**-7;#Solid-Liquid Interfacial Energyfrom the table 9-1 for cooper in J/cm**2\n", + "a0=3.615*10**-8;#The lattice parameter for FCC copper in cm\n", + "#CALCULATIONS\n", + "r=(2*sigma1*Tm)/(deltaH*deltaT);#Critical Radius of copper in cm\n", + "V=a0**3;#Volume of FCC unit cell of copper in cm**3\n", + "V2=(4./3.)*pi*r**3;#Critical volume of FCC copper \n", + "N=V2/V#The number of unit cells in the critical nucleus \n", + "Nc=4*round(N);#Since there are four atoms in each unit cell of FCC metals\n", + "print r*10**8,\"Critical Radius of copper in cm:\"\n", + "print V,\"Volume of FCC unit cell of copper in cm**3:\"\n", + "print V2,\"Critical volume of FCC copper :\"\n", + "print round(N),\"The number of unit cells in the critical nucleus :\"\n", + "print Nc,\"Since there are four atoms in each unit cell of FCC metals:\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_2 pgno:339" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.73 The thickness in inches=\n" + ] + } + ], + "source": [ + "from math import pi\n", + "#page 255\n", + "# Initialisation of Variables\n", + "d=18.;#Diameter of the casting in in\n", + "x=2.;#Thickness of the casting in in\n", + "B=22.#Mold constant of casting\n", + "V=(pi/4.)*d**2;#Volume of the casting in in**3\n", + "A=2*(pi/4.)*d**2+pi*d*x;#The surface area of the casting in contact with the mold\n", + "x=(0.708*A)/V\n", + "print round(x,2),\"The thickness in inches=\"\n", + "#the diffrence in asnwer is due to round foo error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_4 pgno:342" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the total solidification time is 31.28\n" + ] + } + ], + "source": [ + "#page 250\n", + "\n", + "# Initialisation of Variables\n", + "d=5#inches\n", + "t1=5#mins\n", + "t2=20#mins\n", + "d2=1.5#inches\n", + "#CALCULATIONS\n", + "ksol=0.447#inches/mts**0.5\n", + "c1=0.5;\n", + "t=((d-3+c1)/ksol)**2\n", + "print \"the total solidification time is \",round(t,2)#mins" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_5 pgno:342" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.77\n" + ] + } + ], + "source": [ + "#page 250\n", + "from math import pi\n", + "\n", + "# Initialisation of Variables\n", + "l=12 #inchs\n", + "w=8#inchs\n", + "ts=40000#psi\n", + "mc=45#mins/in**2\n", + "x=1\n", + "v=8*12*x\n", + "a=2*8*12+2*x*12\n", + "#by solving the two equations we get \n", + "x=64/82.67;\n", + "print round(x,2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_2.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_2.ipynb new file mode 100755 index 00000000..54ba9da7 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_2.ipynb @@ -0,0 +1,191 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9 Principles of Solidification" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_1 pgno:333" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Critical Radius of copper in cm: 12.5122850123\n", + "Volume of FCC unit cell of copper in cm**3: 4.7241633375e-23\n", + "Critical volume of FCC copper : 8.2053761484e-21\n", + "The number of unit cells in the critical nucleus : 174.0\n", + "Since there are four atoms in each unit cell of FCC metals: 696.0\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "deltaT=236;#Typical Undercooling for HomogeneousNucleation from the table 9-1 for cooper \n", + "Tm=1358;#Freezing Temperature from the table 9-1 for cooper in degree celsius\n", + "deltaH=1628;# Latent Heat of Fusion from the table 9-1 for cooper in J/cm**3\n", + "sigma1=177*10**-7;#Solid-Liquid Interfacial Energyfrom the table 9-1 for cooper in J/cm**2\n", + "a0=3.615*10**-8;#The lattice parameter for FCC copper in cm\n", + "#CALCULATIONS\n", + "r=(2*sigma1*Tm)/(deltaH*deltaT);#Critical Radius of copper in cm\n", + "V=a0**3;#Volume of FCC unit cell of copper in cm**3\n", + "V2=(4./3.)*pi*r**3;#Critical volume of FCC copper \n", + "N=V2/V#The number of unit cells in the critical nucleus \n", + "Nc=4*round(N);#Since there are four atoms in each unit cell of FCC metals\n", + "print \"Critical Radius of copper in cm:\",r*10**8\n", + "print \"Volume of FCC unit cell of copper in cm**3:\",V\n", + "print \"Critical volume of FCC copper :\",V2\n", + "print \"The number of unit cells in the critical nucleus :\",round(N)\n", + "print \"Since there are four atoms in each unit cell of FCC metals:\",Nc\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_2 pgno:339" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The thickness in inches= 1.73\n" + ] + } + ], + "source": [ + "from math import pi\n", + "#page 255\n", + "# Initialisation of Variables\n", + "d=18.;#Diameter of the casting in in\n", + "x=2.;#Thickness of the casting in in\n", + "B=22.#Mold constant of casting\n", + "V=(pi/4.)*d**2;#Volume of the casting in in**3\n", + "A=2*(pi/4.)*d**2+pi*d*x;#The surface area of the casting in contact with the mold\n", + "x=(0.708*A)/V\n", + "print \"The thickness in inches=\",round(x,2),\n", + "#the diffrence in asnwer is due to round foo error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_4 pgno:342" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the total solidification time is 31.28\n" + ] + } + ], + "source": [ + "#page 250\n", + "\n", + "# Initialisation of Variables\n", + "d=5#inches\n", + "t1=5#mins\n", + "t2=20#mins\n", + "d2=1.5#inches\n", + "#CALCULATIONS\n", + "ksol=0.447#inches/mts**0.5\n", + "c1=0.5;\n", + "t=((d-3+c1)/ksol)**2\n", + "print \"the total solidification time is \",round(t,2)#mins" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_5 pgno:342" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.77\n" + ] + } + ], + "source": [ + "#page 250\n", + "from math import pi\n", + "\n", + "# Initialisation of Variables\n", + "l=12 #inchs\n", + "w=8#inchs\n", + "ts=40000#psi\n", + "mc=45#mins/in**2\n", + "x=1\n", + "v=8*12*x\n", + "a=2*8*12+2*x*12\n", + "#by solving the two equations we get \n", + "x=64/82.67;\n", + "print round(x,2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_3.ipynb b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_3.ipynb new file mode 100755 index 00000000..54ba9da7 --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_3.ipynb @@ -0,0 +1,191 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9 Principles of Solidification" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_1 pgno:333" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Critical Radius of copper in cm: 12.5122850123\n", + "Volume of FCC unit cell of copper in cm**3: 4.7241633375e-23\n", + "Critical volume of FCC copper : 8.2053761484e-21\n", + "The number of unit cells in the critical nucleus : 174.0\n", + "Since there are four atoms in each unit cell of FCC metals: 696.0\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# Initialisation of Variables\n", + "deltaT=236;#Typical Undercooling for HomogeneousNucleation from the table 9-1 for cooper \n", + "Tm=1358;#Freezing Temperature from the table 9-1 for cooper in degree celsius\n", + "deltaH=1628;# Latent Heat of Fusion from the table 9-1 for cooper in J/cm**3\n", + "sigma1=177*10**-7;#Solid-Liquid Interfacial Energyfrom the table 9-1 for cooper in J/cm**2\n", + "a0=3.615*10**-8;#The lattice parameter for FCC copper in cm\n", + "#CALCULATIONS\n", + "r=(2*sigma1*Tm)/(deltaH*deltaT);#Critical Radius of copper in cm\n", + "V=a0**3;#Volume of FCC unit cell of copper in cm**3\n", + "V2=(4./3.)*pi*r**3;#Critical volume of FCC copper \n", + "N=V2/V#The number of unit cells in the critical nucleus \n", + "Nc=4*round(N);#Since there are four atoms in each unit cell of FCC metals\n", + "print \"Critical Radius of copper in cm:\",r*10**8\n", + "print \"Volume of FCC unit cell of copper in cm**3:\",V\n", + "print \"Critical volume of FCC copper :\",V2\n", + "print \"The number of unit cells in the critical nucleus :\",round(N)\n", + "print \"Since there are four atoms in each unit cell of FCC metals:\",Nc\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_2 pgno:339" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The thickness in inches= 1.73\n" + ] + } + ], + "source": [ + "from math import pi\n", + "#page 255\n", + "# Initialisation of Variables\n", + "d=18.;#Diameter of the casting in in\n", + "x=2.;#Thickness of the casting in in\n", + "B=22.#Mold constant of casting\n", + "V=(pi/4.)*d**2;#Volume of the casting in in**3\n", + "A=2*(pi/4.)*d**2+pi*d*x;#The surface area of the casting in contact with the mold\n", + "x=(0.708*A)/V\n", + "print \"The thickness in inches=\",round(x,2),\n", + "#the diffrence in asnwer is due to round foo error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_4 pgno:342" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the total solidification time is 31.28\n" + ] + } + ], + "source": [ + "#page 250\n", + "\n", + "# Initialisation of Variables\n", + "d=5#inches\n", + "t1=5#mins\n", + "t2=20#mins\n", + "d2=1.5#inches\n", + "#CALCULATIONS\n", + "ksol=0.447#inches/mts**0.5\n", + "c1=0.5;\n", + "t=((d-3+c1)/ksol)**2\n", + "print \"the total solidification time is \",round(t,2)#mins" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9_5 pgno:342" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.77\n" + ] + } + ], + "source": [ + "#page 250\n", + "from math import pi\n", + "\n", + "# Initialisation of Variables\n", + "l=12 #inchs\n", + "w=8#inchs\n", + "ts=40000#psi\n", + "mc=45#mins/in**2\n", + "x=1\n", + "v=8*12*x\n", + "a=2*8*12+2*x*12\n", + "#by solving the two equations we get \n", + "x=64/82.67;\n", + "print round(x,2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/README.txt b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/README.txt new file mode 100755 index 00000000..28f927ec --- /dev/null +++ b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/README.txt @@ -0,0 +1,10 @@ +Contributed By: pramodkumar desu +Course: others +College/Institute/Organization: K L university +Department/Designation: finanace and costing +Book Title: Essentials of Materials Science and Engineering +Author: D. R. Askeland and P. P. Phule +Publisher: Thomson, New Delhi +Year of publication: 2004 +Isbn: 7302099812 +Edition: 2 \ No newline at end of file diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10.png b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10.png new file mode 100755 index 00000000..6a791a7f Binary files /dev/null and b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10.png differ diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_1.png b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_1.png new file mode 100755 index 00000000..6a791a7f Binary files /dev/null and b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_1.png differ diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_2.png b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_2.png new file mode 100755 index 00000000..6a791a7f Binary files /dev/null and b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_2.png differ diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_3.png b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_3.png new file mode 100755 index 00000000..6a791a7f Binary files /dev/null and b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_3.png differ diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11.png b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11.png new file mode 100755 index 00000000..dd23786a Binary files /dev/null and b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11.png differ diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_1.png b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_1.png new file mode 100755 index 00000000..dd23786a Binary files /dev/null and b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_1.png differ diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_2.png b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_2.png new file mode 100755 index 00000000..dd23786a Binary files /dev/null and b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_2.png differ diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_3.png b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_3.png new file mode 100755 index 00000000..dd23786a Binary files /dev/null and b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_3.png differ diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4.png b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4.png new file mode 100755 index 00000000..6ee0ef63 Binary files /dev/null and b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4.png differ diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_1.png b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_1.png new file mode 100755 index 00000000..6ee0ef63 Binary files /dev/null and b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_1.png differ diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_2.png b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_2.png new file mode 100755 index 00000000..6ee0ef63 Binary files /dev/null and b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_2.png differ diff --git a/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_3.png b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_3.png new file mode 100755 index 00000000..6ee0ef63 Binary files /dev/null and b/Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_3.png differ diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter10.ipynb b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter10.ipynb new file mode 100644 index 00000000..f34f7c1f --- /dev/null +++ b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter10.ipynb @@ -0,0 +1,737 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cf48b4448bdb212ceb12f7cd6ba5223c804096f079426f10b19c24da42a899a4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter10-Radiation Shielding " + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg553" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 10.1\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "E0 = 2.; ## Energy of gamma rays in MeV\n", + "a = 10.; ## Thickeness of lead shield in cm\n", + "phi0 = 10**6; ## Intensity of gamma rays in gamma-rays/cm^2-sec\n", + "\n", + "## 1.\n", + "## Using the data from Table II.4 for E0 = 2 MeV\n", + "mu_rho = 0.0457; ## The ratio of total attenuation coefficient to density in cm^2/g\n", + "## From standard data tables for lead\n", + "rho = 11.34; ## Density of lead in g/cm^3\n", + "## Calculation\n", + "phi_u = phi0*math.exp(-(mu_rho*rho*a));\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n Uncollided flux at the rear side of lead shield = \",phi_u,\" gamma-rays/cm^2-sec \\n\")\n", + "\n", + "## 2.\n", + "## Using the data from Table 10.1 for 2 MeV of lead material\n", + "mua = mu_rho*rho*a;\n", + "B_4 = 2.41; ## Buildup factor if mu*a = 4\n", + "B_7 = 3.36; ## Buildup factor if mu*a = 7\n", + "## Using two point method of straight line for calculating buildup factor at mu*a\n", + "B_m = B_4+((mua-4.)*((B_7-B_4)/(7.-4.)));\n", + "## Calculation\n", + "phi_b = phi_u*B_m;\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n Buildup flux at the rear side of lead shield = \",phi_b,\" gamma-rays/cm^2-sec \\n\");\n", + "\n", + "## 3.\n", + "## Using the data from Table II.5 for 2 MeV \n", + "mua_rho_air = 0.0238; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", + "## Calculation\n", + "X_dot = 0.0659*E0*mua_rho_air*phi_b;\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n Exposure rate at the rear side of lead shield = \",X_dot,\" mR/hour \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Uncollided flux at the rear side of lead shield = 5614.63 gamma-rays/cm^2-sec \n", + "\n", + "\n", + " Buildup flux at the rear side of lead shield = 15633.48 gamma-rays/cm^2-sec \n", + "\n", + "\n", + " Exposure rate at the rear side of lead shield = 49.04 mR/hour \n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg555" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "## Example 10.2\n", + "import math\n", + "\n", + "import warnings\n", + "warnings.filterwarnings('ignore')\n", + "import numpy\n", + "%matplotlib inline\n", + "import matplotlib\n", + "from matplotlib import pyplot\n", + "\n", + "## Given data\n", + "E = 1.; ## Energy of gamma rays in MeV\n", + "X_dot = 1.; ## Exposure rate in mR/hour\n", + "phi0 = 10**8; ## Intensity of gamma rays in gamma-rays/cm^2-sec from isotropic point source\n", + "## Using the data from Table II.5 for 1 MeV \n", + "mua_rho_air = 0.028; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", + "phi_b = X_dot/(0.0659*E*mua_rho_air); ## Buildup flux in gamma-rays/cm^2-sec\n", + "## Using Eq 10.14\n", + "print'%s %.2f %s'%(\" \\n The equation to calculate radius is \\n %.2E = %E * Bp*exp(-mu*R)/(4*pi*R^2) \\n\",phi_b,phi0);\n", + "## Using the data from Table II.4 for E = 1 MeV for Iron\n", + "mu_rho = 0.0595; ## The ratio of total attenuation coefficient to density in cm^2/g\n", + "## From standard data tables for iron\n", + "rho = 7.864; ## Density of iron in g/cm^3\n", + "mu = mu_rho*rho;\n", + "## On solving the right hand side of equation\n", + "## RHS = 3.22*10^3*Bp*exp(-mu*R)/(mu*R)^2\n", + "## Let mu*R = x\n", + "## Using the data from Table 10.2 for isotropic point source of 1 MeV incident on iron material\n", + "Bp = numpy.array([1.87, 2.89, 5.39, 10.2, 16.2, 28.3, 42.7]);\n", + "x = numpy.array([1 ,2 ,4 ,7 ,10, 15, 20]);\n", + "leng=len(Bp)\n", + "RHS= numpy.zeros(leng);\n", + "for i in range(0,7):\n", + " RHS[i] = (3.22*10**3*Bp[i]*math.exp(-x[i])/x[i]**2);\n", + "\n", + "pyplot.plot(x,RHS)\n", + "pyplot.legend(\"Conical\",\"2D-CD\")\n", + "pyplot.xlabel(\"mu*R\")\n", + "pyplot.ylabel(\"RHS\")\n", + "pyplot.title(\"Semilog plot of RHS vs mu*R\")\n", + "pyplot.show()\n", + "\n", + "## From the graph\n", + "muR = 6.55; ## This is the value when RHS = 1\n", + "## Calculation\n", + "R = muR/mu;\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n The shield radius required = \",math.ceil(R),\" cm \\n\");\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The equation to calculate radius is \n", + " %.2E = %E * Bp*exp(-mu*R)/(4*pi*R^2) \n", + " 541.95 100000000\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEZCAYAAABrUHmEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH+FJREFUeJzt3XmUnHWd7/H3B0JIQkICCYQOhEUmLGHgwhh2PbY6xsBV\ngcEh4qiouCAoXK6jLDIkMA6iXjbPHBhH9iVBFFlcggSlD8oWcYIEwg5R0pAEInsSyfK9fzy/Tp50\nqirV3VX1VHd9XufUyVPP+q1KdX3rtz6KCMzMzKqxSdEBmJlZ/+GkYWZmVXPSMDOzqjlpmJlZ1Zw0\nzMysak4aZmZWNScNK4Sk90p6Ivd8gaQPNjiGnSWtkVT3vwNJQyX9XNJrkn5c7+uZ1YuThq1H0nsk\n3Ze+3JZK+r2kSbW+TkT8LiL2yK9Kj6Ykabqk6/pwio8D2wJbR8TUMudfKenN9N4/IOm9ue3tkl4o\ncVyHpONzz8+U9Fw6zwuSbuxDzIWQdFW35+0pub8p6Q1JT0n6UlHxtTonDVtL0pbAL4BLgK2A7YFz\ngL8VGdcAsRPwVESsKbM9gJkRMQIYDdwF/LSK865NtpKOAz4FfDCdZ1I6T78g6XuS/j4tD5N0oaTx\naXNnRIyIiC2BU4BLJe1VWLAtzEnD8nYDIiJ+HJkVETE7IuZ17SDp85LmS/qrpDsk7ZjbtkbSVyQ9\nnX4RnitpV0n3p1/PN0raLO1b8pdz2ra5pIsldabHRZIG57Z/U9KLkhZK+kK67rvKnKtD0nckPSjp\ndUm3StqqzL7jJN2eSlhPS/pCWj8FOAOYmn7tzi1z/J7peq9KelTSR9P6c4B/yx3/uVKHpwcRsRqY\nAWwjaUypa5UxCfh1RDyfzrM4Ii4vE+tpkn7Sbd0lki5Jy5+V9Gz6f3xO0ifLnGe6pJ9Iui7t+4ik\nCZLOkLRY0p8lfSi3/3rVkN1KcN8FTgDeD1wL/DQiNviMRMQsYCmwZ/VvjdWKk4blPQmslnS1pCnd\nv1wlHUH25XkUMAb4HTCz2zkmA/sBBwGnAT8CjgV2BPZOyxvzLeAA4H+lxwHAWSmGKcCpwAeBCUA7\nG6/W+jTwOaANWAX8oMx+NwJ/Sft9HDhP0vsj4g7gPODG9Gt3v+4HpmT4c+AOYBvga8ANknaLiGnd\njr+q+/HdzjUY+AzwbES8spHXlvcA8BlJ/yppkqRNK+w7Ezhc0vB0zU2Bf04xb0FW2pySftkfDDxc\n4VwfIfuS3wqYC8xO68cB/w78MLdv92rI/LKANbn16n4hSZtI+hgwMl3LGsxJw9aKiDeB95D9wf4I\nWCLpNknbpl1OAL4TEU+mapbvAPvmqhAAvhcRb0XEfGAeMCsiFkTEG8AssoSyMZ8Ezo2IV9KX5jlk\nX/wAxwBXRsTjEbEcmEaJL5f8ywKujYj5EbGM7Bf/MZLWOya9hkOA0yLinYj4E3A52Zc35EoCZRwE\nbBER50fEqoi4m6yqrytJbux4UlyvAsuALwCHd9s+LpVi1j7I/r+yFxpxA1my+jDQASyW9M1SF4qI\nvwD/Q/YDAOADwLKImJOerwH2ljQ0lVjmV4j7nlQiXU1WpTYaOD89/zGwc6r6LCX/nnwT+G/gbuA4\n4OO5z9a43HtzC/DpiHi2QkxWJ04atp6IeCIiPhcR44G/J/u1eHHavBNwSe4La2lav33uFItzy8u7\nPV8BDK8ijHHAn3PP/5LWQVYKyFdZLKzifPn9/wJsRlZS6n7Nv0bE29323Z7qjOt2HcheQ7XHA/w4\nIrYCxgKPkiWAvBcjYqv8A/h9foeImBERHyL7JX4C8O+SJpe53gzWJbVPAjekc7wNTE3HvyjpF5J2\nrxD3ktzycuCVWDcT6vL0b7n/97UljYj4ZkQ8mpaXRcSpueqpF9Pr3ZKsFHSmGtDrzTbkN93Kiogn\ngWvIkgdkX6Jf6vbFtUVEPFDtKavc70Vg59zzHYHOtPwSkC/Z5JfL2bHb8kqge7XPi8DWXdU1uX27\nktLGYn8RGN+tBLMT1SW1rvN3tWksBb4EfKlcW81GTxaxOiJ+CjwClGsw/inQLml74EiyJNJ1/J0R\nMRnYDniCrORZLu6eeBvYIve8rUTspdp8ura9Q1btOZJ1pU9rICcNW0vS7pL+b/oS6aqyORa4P+3y\nX2S/8Cam7SMl/fPGTltmuZKZwFmSxqSG4LOB69O2m4DPSdpD0jCy6qaNXf9TqZF6GHAu8JPcL2EA\n0i/a+4DvpIb4fYDP5667iKyapdxreICs6uSbkjaT1E5W119tl9f1zhsRT5G1kXyjyuO7Gq8PlzQi\n1f0fRpYwHiy1f0S8TFaNdTXwXPqRgKRtJR2R2jZWkn3Rr64m7io8DHxC0iBlXbmPpoeJJyJWAheQ\nVWdZgzlpWN6bwIHAg5LeIksWjwBfB4iIW8l6uNwo6XWyNosP544v9cffvdGzXCNo3reBh9K1H0nL\n304x3EHWkH038BTrElq5bsEBXEf2xfgSMBg4uUwMx5KVcF4EfgacHRG/Tdu6ehotlfTQBhfJvsg+\nChwGvAz8J1m9+1O561T6ciy1/ftkDdvb5vap5HXgTLJqsVeB84ETIuK+CsfMIOtUMCO3bhOyzgad\nZFWQ7wW+0oO4Kz3/N2DXFN90UpVYFbqf80pg29Qobg2ket2EKf1KvZZsQFMA/x0RP5A0nayR7+W0\n65mpCx2SziD7dbcaODki7kzr3032Rz8E+FVEnFKXoK3fkbQnWfIaXGoMhKS7gesi4sqGB2c2ANWz\npLESODUi9iLrWXJS+gMP4MKI2C89uhLGRLLGt4nAFLLBO11F38uA4yNiAjAhdbu0FiXpqFSFtBVZ\nyef2CoPmoOdVKGZWRt2SRkQsioiH0/JbwOOs60lS6o/4CLIRsSsjYgHwDHCgpDZgRK4r4LVkjXbW\nur5E1ivrGbIfJ+WqTro07fQkZv3NoEZcRNLOZP3zHwAOBb4m6TNkddVfj4jXyLos5nvhLCRLMitZ\nvwdKJz3rxmgDTEQc1oN931/PWMxaTSNm9xxO1rXvlFTiuAzYBdiXrGHygnrHYGZmtVHXkkaaWuFm\n4PrU84aIWJLbfjlZt0LIShD5Pvc7kJUwOtNyfn0n3UhyFYSZWS9ERNXtfnUraaRG7CuA+RFxcW59\nfjDPUWQ9XwBuJ+u/PVjSLmTzCs2JiEXAG5IOTOf8NHBrqWtGhB81ekybNq3wGAbSw++n38tmffRU\nPUsah5JN0/yI1s0KeiZwrKR9yRonnwe+DBAR8yXdBMwnm1TuxFj3ik4k63I7lKzL7R11jNvMzMqo\nW9KIiN9TuiQzq8Ix55HNBtp9/R/JZkg1M7MCeUS4ldTe3l50CAOK38/a8XtZrLqNCG80STFQXouZ\nWaNIInrQEN6QcRpmZv1V+Tkq+59a/LB20jAz24iBUItRq+TnNg0zM6uak4aZmVXNScPMzKrmpGFm\nZlVz0jAz68dmzJjBpEmTGDFiBOPGjePwww/n3nvvrdv1nDTMzPqpCy+8kFNPPZWzzjqLJUuW8MIL\nL3DSSSdx++231+2aHtxnZlZBGvxWdBgbeP3119lhhx24+uqrOfrooze6f7nX0dPBfS5pmJn1Q/ff\nfz8rVqzgqKOOauh1PbjPzKwPajVgvKeFmaVLlzJmzBg22aSxv/2dNMzM+qComqvRo0fzyiuvsGbN\nmoYmDldPmZn1QwcffDCbb745t9xyS0Ov66RhZtYPjRw5knPPPZeTTjqJ2267jWXLlrFy5UpmzZrF\naaedVrfruveUmVkFzdp7qsuMGTO46KKLePzxxxkxYgSTJk3iW9/6FgcddNB6+9Wq95SThplZBc2e\nNKrlLrdmZtZwThpmZlY1J43krrvgD38oOgozs+bmcRrJ3XfDkCGw//5FR2Jm1rxc0kjGjYOXXio6\nCjOz5uakkbS1OWmYmW2Mq6cSJw0zK0e1mmBqAHDSSNra4MUXi47CzJrNQBijUUse3Jf87W+w5Zaw\nYkXtZq00M2t2HtzXS5tvDsOHw9KlRUdiZta8nDRy3K5hZlaZk0aO2zXMzCpz0sjxWA0zs8qcNHJc\nPWVmVpmTRo6ThplZZU4aOW7TMDOrzEkjx20aZmaVOWnkuHrKzKyyuiUNSeMl3S3pMUmPSjo5rd9a\n0mxJT0m6U9Ko3DFnSHpa0hOSJufWv1vSvLTtknrF3JU0BsggeTOzmqtnSWMlcGpE7AUcBJwkaU/g\ndGB2ROwG/CY9R9JEYCowEZgCXKp1s4RdBhwfEROACZKm1CPgYcNg8GB47bV6nN3MrP+rW9KIiEUR\n8XBafgt4HNge+BhwTdrtGuDItHwEMDMiVkbEAuAZ4EBJbcCIiJiT9rs2d0zNuV3DzKy8hrRpSNoZ\n2A94EBgbEYvTpsXA2LQ8DliYO2whWZLpvr4zra8Lt2uYmZVX96nRJQ0HbgZOiYg38/PSR0RIqlkL\nwvTp09cut7e3097e3uNzOGmY2UDW0dFBR0dHr4+va9KQtBlZwrguIm5NqxdL2i4iFqWqpyVpfScw\nPnf4DmQljM60nF/fWep6+aTRWx6rYWYDWfcf1Oecc06Pjq9n7ykBVwDzI+Li3KbbgePS8nHArbn1\nn5A0WNIuwARgTkQsAt6QdGA656dzx9Sc2zTMzMqrZ0njUOBTwCOS5qZ1ZwDnAzdJOh5YABwDEBHz\nJd0EzAdWASfm7qp0InA1MBT4VUTcUa+g29pgzpyN72dm1op8575uOjrg7LPhnnv6HpOZWbPznfv6\nyNVTZmblOWl0495TZmblOWl0M2JE9u+bbxYbh5lZM3LSKMHdbs3MSnPSKMHtGmZmpTlplOB2DTOz\n0pw0SnDSMDMrzUmjBLdpmJmV5qRRgts0zMxKc9IowdVTZmalOWmU4KRhZlaak0YJbtMwMyvNSaOE\nUaPgnXdg2bKiIzEzay5OGiVIrqIyMyvFSaMMJw0zsw05aZThdg0zsw05aZThsRpmZhty0ijD1VNm\nZhty0ijDScPMbENOGmW4TcPMbENOGmW4TcPMbENOGmW4esrMbENOGmWMHg1vvQUrVhQdiZlZ83DS\nKEOCsWNh0aKiIzEzax5OGhW4XcPMbH1OGhW4XcPMbH1OGhW4262Z2fqcNCpw9ZSZ2fqcNCpw9ZSZ\n2fqcNCpw0jAzW5+TRgVu0zAzW5+TRgVu0zAzW58iougYakJS1Pq1rFkDQ4bA22/DZpvV9NRmZk1B\nEhGhavd3SaOCTTaBbbaBxYuLjsTMrDk4aWyE2zXMzNapa9KQdKWkxZLm5dZNl7RQ0tz0OCy37QxJ\nT0t6QtLk3Pp3S5qXtl1Sz5i7c7uGmdk69S5pXAVM6bYugAsjYr/0mAUgaSIwFZiYjrlUUlc922XA\n8RExAZggqfs568bdbs3M1qlr0oiI3wGvlthUqtHlCGBmRKyMiAXAM8CBktqAERExJ+13LXBkPeIt\nxUnDzGydoto0vibpT5KukDQqrRsHLMztsxDYvsT6zrS+IdymYWa2ThFJ4zJgF2Bf4CXgggJiqJrb\nNMzM1hnU6AtGxJKuZUmXAz9PTzuB8blddyArYXSm5fz6zlLnnj59+trl9vZ22tvb+xyvq6fMbCDp\n6Oigo6Oj18fXfXCfpJ2Bn0fE3ul5W0S8lJZPBfaPiE+mhvAZwAFk1U93AX8XESHpQeBkYA7wS+AH\nEXFHt+vUfHAfQGcn7L+/q6jMbGDq6eC+upY0JM0E3geMkfQCMA1ol7QvWS+q54EvA0TEfEk3AfOB\nVcCJuSxwInA1MBT4VfeEUU9jx8LLL8Pq1bDppo26qplZc/I0IlXYbjuYOzerqjIzG0g8jUgduF3D\nzCzjpFEFd7s1M8s4aVTBJQ0zs4yTRhU8VsPMLOOkUQWXNMzMMk4aVXCbhplZxkmjCi5pmJllnDSq\n4DYNM7OMB/dV4Z13YPhwWLEiuwWsmdlAUdfBfZK2yt0YqWUMHgxbbgmvvFJ0JGZmxSqbNCRNk7Rn\nWt5c0t3As8BiSR9qVIDNwlVUZmaVSxpTgSfS8nFkd9vbhmwCwvPqHFfTcWO4mVnlpPG3XCPBFODG\niFgdEY9TwH04iuakYWa2kaQhaW9J2wDtwJ25bcPqGlUT8lgNM7PKSeP/AD8FngQuiojnACT9b+B/\nGhBbU3GbhplZhWqmiHgA2L3E+l+S3T2vpbS1QR/ukGhmNiCUTRqSvk52d721q3LLEREX1i2qJuQ2\nDTOzytVTI9JjS+AbwPDcY0T9Q2subtMwM6tyRLikuRGxXwPi6bV6jggHWL4cttoq+7f1hjea2UDl\n273WydCh2ePVV4uOxMysOE4aPeB2DTNrdZUawuflnu7a7XlExD71C6s5dbVr7LVX0ZGYmRWj0sju\nj1bYNjCmxu0hj9Uws1ZXaZzGglLr0yy3xwB/rlNMTcvVU2bW6irNcjtc0tclXSrpREmbSDoKeAz4\nl8aF2Dzc7dbMWl2l6qlrgTeA+4HJwGeBFcAnI+Lh+ofWfNra4P77i47CzKw4lZLG33U1dku6HHgJ\n2CkiljcksibkNg0za3WVutyu7lqIiNVAZysnDHCbhplZ2RHhklYDy3KrhgJdSSMiYss6x9Yj9R4R\nDvDWW7DttvD22x4VbmYDQ09HhFfqPbVpbUIaOIYPh003hTfegJEji47GzKzxPCK8h9yuYWatzEmj\nh9yuYWatzEmjhzxWw8xamZNGD7mkYWatzEmjh9ymYWatzEmjh1zSMLNWVtekIelKSYvz06pL2lrS\nbElPSbpT0qjctjMkPS3pCUmTc+vfLWle2nZJPWPeGLdpmFkrq3dJ4ypgSrd1pwOzI2I34DfpOZIm\nAlOBiemYS9OMugCXAcdHxARggqTu52wYV0+ZWSura9KIiN8B3W+Q+jHgmrR8DXBkWj4CmBkRK9O0\n7M8AB0pqA0ZExJy037W5YxrO1VNm1sqKaNMYGxGL0/JiYGxaHgcszO23ENi+xPrOtL4QW24Jq1Zl\nU4qYmbWaQhvC02RR/eougJJLG2bWuipNjV4viyVtFxGLUtXTkrS+Exif228HshJGZ1rOr+8sdeLp\n06evXW5vb6e9vb12Ued0tWtMmFCX05uZ1U1HRwcdHR29Pr7sLLe1Imln4OcRsXd6/j1gaUR8V9Lp\nwKiIOD01hM8ADiCrfrqL7J4eIelB4GRgDvBL4AcRcUe369R9ltsuxxwDRx8NU6c25HJmZnVTs1lu\naxTMTOB9wBhJLwBnA+cDN0k6HlhAdr9xImK+pJuA+cAq4MRcFjgRuJpsevZfdU8YjeZut2bWqupe\n0miURpY0zj8f/vpX+N73GnI5M7O66WlJwyPCe8FjNcysVTlp9IJ7T5lZq3LS6AW3aZhZq3LS6AWX\nNMysVTlp9MLWW8Py5dnDzKyVOGn0ggTbbQeLFhUdiZlZYzlp9JLbNcysFTlp9JLbNcysFTlp9JLH\naphZK3LS6CWXNMysFTlp9JLbNMysFTlp9JJLGmbWipw0esltGmbWipw0esklDTNrRZ4avZfWrIEh\nQ7J7hQ8e3LDLmpnVlKdGb5BNNoFtt/WocDNrLU4afeB2DTNrNU4afeB2DTNrNU4afeCxGmbWapw0\n+sDVU2bWapw0+sDVU2bWapw0+sDVU2bWapw0+sAlDTNrNU4afeA2DTNrNR4R3gerV8PQobBsGQwa\n1NBLm5nVhEeEN9Cmm8Lo0bB4cdGRmJk1hpNGH7ldw8xaiZNGH7ldw8xaiZNGH7mkYWatxEmjjzxW\nw8xaiZNGH7mkYWatxEmjj9ymYWatxEmjj1zSMLNW4qTRR27TMLNW4hHhffTOOzB8OCxfng32MzPr\nTzwivMEGD4ZRo+CVV4qOxMys/gpLGpIWSHpE0lxJc9K6rSXNlvSUpDsljcrtf4akpyU9IWlyUXGX\n4nYNM2sVRZY0AmiPiP0i4oC07nRgdkTsBvwmPUfSRGAqMBGYAlwqqWlKSW7XMLNWUfQXb/d6tI8B\n16Tla4Aj0/IRwMyIWBkRC4BngANoEi5pmFmrKLqkcZekhyR9Ma0bGxFdc8YuBsam5XHAwtyxC4Ht\nGxPmxnmshpm1iiLvAnFoRLwkaRtgtqQn8hsjIiRV6g61wbbp06evXW5vb6e9vb1GoVbW1gaPP96Q\nS5mZ9UlHRwcdHR29Pr4putxKmga8BXyRrJ1jkaQ24O6I2EPS6QARcX7a/w5gWkQ8mDtHIV1uAW6+\nGa6/Hm65pZDLm5n1Wr/ocitpmKQRaXkLYDIwD7gdOC7tdhxwa1q+HfiEpMGSdgEmAHMaG3V5btMw\ns1ZRVPXUWOAWSV0x3BARd0p6CLhJ0vHAAuAYgIiYL+kmYD6wCjixsGJFCW7TMLNW0RTVU7VQZPXU\nihUwcmT2r6ou5JmZFa9fVE8NNEOGwBZbwNKlRUdiZlZfTho14ioqM2sFTho14sZwM2sFTho14qlE\nzKwVOGnUiEsaZtYKnDRqxG0aZtYKnDRqxCUNM2sFTho14jYNM2sFTho14pKGmbUCjwivkbffhjFj\nYNkyjwo3s/7DI8ILssUW2f3CX3+96EjMzOrHSaOGxo+HX/6y6CjMzOrHSaOGrrwSzjgDzjoLVq8u\nOhozs9pzm0aNLVkCU6fC5pvDDTfA6NFFR2RmVp7bNAq27bYwezbsvTfsvz/MnVt0RGZmteOkUQeD\nBsH3vw/nnw8f/jBce23REZmZ1Yarp+rsscfgn/4J/vEf4aKLsh5WZmbNwtVTTWavvWDOHOjshPb2\n7F8zs/7KSaMBRo6En/0MPvIROOAAuOeeoiMyM+sdV0812K9/DZ/5TNY195RTPHrczIrV0+opJ40C\nPP88HH007LEH/OhH2WhyM7MiuE2jH9hlF7j33qxR/OCD4Zlnio7IzKw6ThoFGToUrroKvvIVOOQQ\n+MUvio7IzGzjXD3VBO6/H445Bj7/eZg2DTZxKjezBnGbRj+1aFE2/cjw4XD99bDVVkVHZGatwG0a\n/dR228Fdd8Huu8OkSfCnPxUdkZnZhpw0mshmm8GFF8K3v52NIL/++qIjMjNbn6unmtS8edn0I4cd\nBhdckCUUM7Nac/XUALH33vCHP2RjOj7wAd9/3Myag5NGExs1Cm67DT70oWya9XvvLToiM2t1rp7q\nJ2bNgs9+Nrsr4Fe/6ulHzKw23OV2AHv22Wz6kb33hh/+EIYNKzoiM+vv3KYxgO26K9x3X7Z8yCHw\n3HPFxmNmrcdJo58ZNiy7E+AXvpDNWzVrVtERmVkrcfVUP3bvvdn0I1/+ctbW4elHzKynBmz1lKQp\nkp6Q9LSk04qOpxkceig89BDMng1HHAGvvVZ0RGY20PWLpCFpU+A/gSnAROBYSXsWG1VzaGuD3/4W\n3vWurFvuvHm1OW9HR0dtTmSA389a8ntZrEFFB1ClA4BnImIBgKQbgSOAx4sMqllsthlcckmWND7w\nATjhBBgzJpt+vesxZEjl50OHwqBB67rydnR00N7eXujrGkj8ftaO38ti9ZeksT3wQu75QuDAgmJp\nWp/6FOyzD9xwQ3Zjp+XLYcWK7N+uR6XnEesSyDvvwIwZG0801SSjSvsMHuwxJ2b9SX9JGq3Vwt0H\n++yTPXpj5cp1SeS887ISS7VJ5/XXs+nde5Kkli+HVavKJ5ohQzZMKJWe92TfWj/f2L5PP521P1nf\nPfUU/PGPRUfRuvpF7ylJBwHTI2JKen4GsCYivpvbp/lfiJlZExpwI8IlDQKeBD4IvAjMAY6NCLdp\nmJk1UL+onoqIVZK+Cvwa2BS4wgnDzKzx+kVJw8zMmkO/GKexMR74V1uSFkh6RNJcSXOKjqc/kXSl\npMWS5uXWbS1ptqSnJN0paVSRMfYnZd7P6ZIWps/nXElTioyxv5A0XtLdkh6T9Kikk9P6Hn0++33S\n8MC/ugigPSL2i4gDig6mn7mK7LOYdzowOyJ2A36Tnlt1Sr2fAVyYPp/7RcQdBcTVH60ETo2IvYCD\ngJPSd2WPPp/9PmmQG/gXESuBroF/1jcePdELEfE74NVuqz8GXJOWrwGObGhQ/ViZ9xP8+eyxiFgU\nEQ+n5bfIBkdvTw8/nwMhaZQa+Ld9QbEMFAHcJekhSV8sOpgBYGxELE7Li4GxRQYzQHxN0p8kXeHq\nvp6TtDOwH/AgPfx8DoSk4Zb82js0IvYDDiMrwr636IAGijQVsz+zfXMZsAuwL/AScEGx4fQvkoYD\nNwOnRMSb+W3VfD4HQtLoBMbnno8nK21YL0XES+nfl4FbyKoArfcWS9oOQFIbsKTgePq1iFgSCXA5\n/nxWTdJmZAnjuoi4Na3u0edzICSNh4AJknaWNBiYCtxecEz9lqRhkkak5S2AyUCN5s5tWbcDx6Xl\n44BbK+xrG5G+2LochT+fVZEk4ApgfkRcnNvUo8/ngBinIekw4GLWDfz7TsEh9VuSdiErXUA2+PMG\nv5/VkzQTeB8whqx++GzgNuAmYEdgAXBMRPjuJ1Uo8X5OA9rJqqYCeB74cq5O3sqQ9B7gHuAR1lVB\nnUE2w0bVn88BkTTMzKwxBkL1lJmZNYiThpmZVc1Jw8zMquakYWZmVXPSMDOzqjlpmJlZ1Zw0zBpM\n0rRuz1enKb4fkfSzNM2DWVPyOA2zBpH0L0AbMBr4K9AZETMkvRkRXaPwrwbmRYTnU7Km5JKGWQ+k\n6WqekHSVpCcl3SBpsqT70k1s9k83Cfp67phHJe0YETeQzZX2DeDPETGjxCXuB3Zt0Msx6zEnDbOe\n2xX4f8AewO7A1Ig4BPhX4Ew2nCU0yKb+OZZs2v7vAzul52ulG4pNBh6tb/hmvTeo6ADM+qHnI+Ix\nAEmPAXel9Y8COwMPlzgmImJmOmZaRHw/t22opLlkCWUB8F91itusz1zSMOu5v+WW1wDv5JYHAatY\n/29rSP7giDin2/mWp/uX7ASswHeetCbmpGFWewuAfwCQ9A9kNwzaqIhYDpwM/Eeaxtqs6ThpmPVc\nqTaL/PLNwNaSHgVOAp6s9nzpHs7PAMfUIE6zmnOXWzMzq5pLGmZmVjUnDTMzq5qThpmZVc1Jw8zM\nquakYWZmVXPSMDOzqjlpmJlZ1Zw0zMysav8f0zsJhFWv4AIAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The shield radius required = 14.00 cm \n", + "\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg561" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 10.3\n", + "import math\n", + "import warnings\n", + "warnings.filterwarnings('ignore')\n", + "import numpy\n", + "%matplotlib inline\n", + "import matplotlib\n", + "from matplotlib import pyplot\n", + "\n", + "## Given data\n", + "E = 2.; ## Energy of gamma rays in MeV\n", + "X_dot = 2.5; ## Exposure rate in mR/hour\n", + "phi0 = 10**9; ## Intensity of gamma rays in gamma-rays/cm^2-sec from isotropic point source\n", + "## Using the data from Table II.5 for 1 MeV \n", + "mua_rho_air = 0.0238; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", + "phi_b = X_dot/(0.0659*E*mua_rho_air); ## Buildup flux in gamma-rays/cm^2-sec\n", + "\n", + "## From standard data tables for concrete\n", + "rho = 2.35; ## Density of concrete in g/cm^3\n", + "## Using the data from Table 10.3 for concrete at 2 MeV\n", + "A1 = 18.089;\n", + "A2 = 1-A1;\n", + "alpha1 = -0.0425;\n", + "alpha2 = 0.00849;\n", + "## Using Eq 10.26\n", + "#print'%s %.2f %s'%(\" \\n The equation to calculate thickness is \\n %.2E = (%E/2) *(%4.3f*E1(%4.3f*mu*a) %4.3f*E1(%4.3f*mu*a)) \\n\",phi_b,phi0,A1,(1+alpha1),A2,(1+alpha2));\n", + "## Using the data from Table II.4 for E = 1 MeV for concrete\n", + "mu_rho = 0.0445; ## The ratio of total attenuation coefficient to density in cm^2/g\n", + "mu = mu_rho*rho;\n", + "## On solving the right hand side of equation\n", + "## RHS = 1.13*10^7*(E1(0.9575*mu*a)-0.94*E1(1.00849*mu*a))\n", + "## Let mu*a = x\n", + "x = numpy.array([1 ,2 ,4 ,7 ,10, 15, 20]);\n", + "leng=len(x)\n", + "RHS= numpy.zeros(leng);\n", + "for i in range(0,leng):\n", + " RHS[i] = 1.13*10**7*(math.exp(-0.9575*x[i])*((1./(0.9575*x[i])+(1/(0.9575*x[i])**3))) - math.exp(-1.00849*x[i])*((1./(1.00849*x[i])+(1./(1.00849*x[i])**3))));\n", + "\n", + "pyplot.plot(x,RHS)\n", + "pyplot.legend(\"Conical\",\"2D-CD\")\n", + "pyplot.xlabel(\"mu*R\")\n", + "pyplot.ylabel(\"RHS\")\n", + "pyplot.title(\"Semilog plot of RHS vs mu*R\")\n", + "pyplot.show()\n", + "## From the graph\n", + "mua = 13.6; ## This is the value when RHS = 1\n", + "## Calculation\n", + "a = mua/mu;\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n The concrete thickness = \",a,\" cm \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAaAAAAEZCAYAAADR8/HkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xu8VXWd//HXm6uCyFVQLirTYCONTV5GrKZHxzERrVGb\nTKhUpmHq1+BM1ymzi4BayfQr8zfz0GYmL2CKmpbiVAip5zFOiVhpYqhAhsEhUA+CeOfy+f2xvtuz\n2OxzOEfO3msf9vv5eOzHWeu71ve7vnuz2Z/9/azvWlsRgZmZWa31KroDZmbWmByAzMysEA5AZmZW\nCAcgMzMrhAOQmZkVwgHIzMwK4QBkPZ6kd0l6PLe+RtJJNe7D4ZJ2Sqr6/ylJ+0u6U9JmSTdX+3hm\n1eIAZFUj6a8k/SJ9ULZK+l9Jx3X3cSLivoj4s3xRetQlSbMlXb8XTZwFjASGRcTUdtrfJmlreu2X\nSnpXbnuTpLUV6jVLmpFb/5KkJ1M7ayXdtBd9LoSka8vWm9IXha2Snpe0UtLHi+pfo3MAsqqQdCDw\n38AVwFBgDDAHeLXIfu0jDgNWRsTOdrYHsCAiBgHDgZ8Bt3ai3dcDt6TpwDnASamd41I7PYKkf5X0\n52l5gKRvSxqXNrdExKCIOBD4FHClpLcU1tkG5gBk1XIEEBFxc2ReiYglEbG8tIOkv5e0QtImSYsk\nHZrbtlPSP0palb6pXizpTZLuT9/qb5LUN+1b8Rt92tZf0ncktaTH5ZL65bZ/QdJ6Sesk/UM67p+0\n01azpG9IekDSFkm3Sxrazr6jJS1MI79Vkv4hlU8BLgSmpm/hD7VT/8h0vOckPSrpb1L5HOCrufof\nrVQ9PYiIHcCNwEGSRlQ6VjuOA+6KiN+ndjZGxPfa6esFkn5QVnaFpCvS8t9J+l36d3xS0ofbaWe2\npB9Iuj7t+4ikCZIulLRR0lOSTs7tv0uqtWxkORf4BHAiMB+4NSJ2e49ExE+BVuDIzr801l0cgKxa\nngB2SLpO0pTyD2pJZ5B9EL8fGAHcBywoa2MycDRwAnAB8F/Ah4BDgaPS8p58GTge+Iv0OB74SurD\nFOAzwEnABKCJPafuzgU+ChwCbAf+Xzv73QT8Ie13FvB1SSdGxCLg68BN6Vv40eUVU2C9E1gEHAT8\nM3CDpCMiYlZZ/WvL65e11Q84D/hdRDy7h+eWtxQ4T9K/SDpOUu8O9l0AnCbpgHTM3sAHU58Hko2C\np6QRx9uBhzto631kAWMo8BCwJJWPBi4B/iO3b3mqNb8sYGeuXOUHktRL0unA4HQsqzEHIKuKiNgK\n/BXZf/7/Ap6WdIekkWmXTwDfiIgnUirpG8DbcmkSgH+NiBciYgWwHPhpRKyJiOeBn5IFpz35MHBx\nRDybPoDnkAURgLOBayLisYh4GZhFhQ+q/NMC5kfEioh4iWwkcrakXeqk5/AO4IKIeC0ifgN8jywQ\nQG6E0o4TgIERcVlEbI+Ie8nSmaWAu6f6pH49B7wE/ANwWtn20Wl09fqD7N8re6IRN5AFvlOAZmCj\npC9UOlBE/AH4NdmXCYC/Bl6KiGVpfSdwlKT900hqRQf9/p80Ut5BljYcDlyW1m8GDk/p3Uryr8kX\ngP8E7gWmA2fl3lujc6/Nj4BzI+J3HfTJqsQByKomIh6PiI9GxDjgz8m+xX4nbT4MuCL34deaysfk\nmtiYW365bP0V4IBOdGM08FRu/Q+pDLLRST4ts64T7eX3/wPQl2wEV37MTRHxYtm+Y+ic0WXHgew5\ndLY+wM0RMRQYBTxKFkzy1kfE0PwD+N/8DhFxY0ScTDZC+ARwiaTJ7RzvRtoC5IeBG1IbLwJTU/31\nkv5b0ps76PfTueWXgWej7Y7JL6e/7f27vz4CiogvRMSjafmliPhMLgW3Pj3fA8lGZ19SDWYv2u78\noltNRMQTwDyyQATZB/LHyz4EB0bE0s422cn91gOH59YPBVrS8h+B/Igrv9yeQ8uWtwHlqa31wLBS\nSiq3bynA7anv64FxZSOrw+hcgCy1XzoH1Ap8HPh4e+e29thYxI6IuBV4BGjvZP2tQJOkMcCZZAGp\nVH9xREwGDgYeJxsRt9fvrngRGJhbP6RC3yudIytte40stTuYtlGx1ZADkFWFpDdL+mz6QCqlpT4E\n3J92+S7ZN8+JaftgSR/cU7PtLHdkAfAVSSPSSfiLgO+nbbcAH5X0Z5IGkKXU9nT8c9IEgQHAxcAP\nct/QAUjftH8BfCNNgngr8Pe5424gSyW19xyWkqWHviCpr6QmsnMjnZ0GvUu7EbGS7JzS5ztZvzRx\n4DRJg9K5klPJgs8DlfaPiGfIUnXXAU+mLxxIGinpjHQuaBtZ0NjRmX53wsPANEl9lE3v/wBdDGIR\nsQ34FlnKzmrMAciqZSswCXhA0gtkgecR4HMAEXE72UylmyRtITvHc0qufqUPkvITzu2dgM67FPhl\nOvYjafnS1IdFZJMI7gVW0hYc25sqHsD1ZB+yfwT6AZ9spw8fIht5rQd+CFwUEfekbaUZY62Sfrnb\nQbIPxb8BTgWeAf6d7DzFytxxOvqgrbT9m2STCkbm9unIFuBLZKm/54DLgE9ExC86qHMj2YSOG3Nl\nvcgmerSQpVnfBfxjF/rd0fpXgTel/s0mpf06obzNa4CRaUKC1ZCq9YN0kq4B3gs8HRFHlW37HNl/\niBERsSmVXUj2LXEH8MmIWJzKjyX7D78f8JOI+FQq7082W+YYsjf21Ih4Km2bTjb7CeDSiJifyseT\nfYscBvyK7D/1tqq8ANbjSDqSLBD2q3SNjaR7gesj4pqad85sH1TNEdC1wJTywpSKOZncieGUhpkK\nTEx1rsylJ64CZkTEBGBCmjoLMANoTeWXk32bRtIwsjTL8ekxS9LgVGcu8K1U57nUhjUwSe9PabKh\nZO+PhR1c4AldTxOZWTuqFoAi4j6yD/ly32b3fOsZZFdub4uINcBqYJKkQ4BBuemc88lOcAKcTnZS\nG+A2sqE/ZGmcxRGxOSI2k11HcGoKaCfSdkX4vFxb1rg+Tja7bjXZOYr20kMldXuLH7Oepk8tD5Yu\nPlwXEY+UnX8dTXbitWQd2ZTTbew686eFtqmoY0hTVSNiu7Ir04enttZVaGsYsDn37TbfljWoiDi1\nC/ueWM2+mDWamgWgNGvoS2Tpt9eLa3R4f2s1M6sztRwBvYlsVtBv0uhnLPArSZPIRiP5azDGko1c\nWtJyeTlp26FkF7f1AQZHRKukFrJbqpSMA+4BNgFDJPVKo6CxtF0PsgtJDlhmZm9ARHR6YFGzadgR\nsTwiRkXE+IgYTxZIjomIjcBCsvn8/dJMtQnAsojYADwvaVI6h3MucEdqciHZLTYgu9fW3Wl5MTBZ\n0pB0YvlkspsqBtl029K1JtOB2zvorx/d9Jg1a1bhfdhXHn4t/XrW86OrqhaAJC0guxjvCGW/JVJ+\nRXL+thkryC4KXEF2j6+Z0fZsZpLdR2sVsDqyazcArgaGS1oFfBr4YmprE9lNCx8ElgFzIpuMANlV\nz59NdYamNszMrABVS8FFRId3Ko6IPylb/zrZXX7L9/sV2Z2Py8tfJbuZZKW2ryWbBl5e/nuyiyPN\nzKxgvhNCFSxcCM9VmoDeoJqamoruwj7Dr2X38utZrKrdCaEnkxR787qccAJcfjm8/e3d2Ckzszon\niejCJISaXgfUKEaOhI0b97yfmTWO9u892zN1x+DFAagKRo1yADKz3e0rGafuCqY+B1QFo0bB00/v\neT8zs0bmAFQFTsGZme2ZA1AVOAVnZrZnDkBV4BScmdmeOQBVgVNwZtYT3XjjjRx33HEMGjSI0aNH\nc9ppp/Hzn/+8asdzAKoCp+DMrKf59re/zWc+8xm+8pWv8PTTT7N27VrOP/98Fi5cWLVj+kLUCvb2\nQtSdO6F/f3jxRejXrxs7ZmY9VrpIs+huVLRlyxbGjh3Lddddxwc+8IE97t/ec+nqhageAVVBr15w\n0EE+D2RmPcP999/PK6+8wvvf//6aHtcBqEo8EcHMukrqnkdXtba2MmLECHr1qm1I8J0QqsQTEcys\nq4rK0A0fPpxnn32WnTt31jQIeQRUJZ6IYGY9xdvf/nb69+/Pj370o5oe1wGoSpyCM7OeYvDgwVx8\n8cWcf/753HHHHbz00kts27aNn/70p1xwwQVVO65TcFUyciRs2FB0L8zMOuezn/0sBx98MJdeeikf\n+chHGDRoEMcddxxf/vKXq3ZMT8OuYG+nYQPMnw+LF8P3v99NnTKzHq2ep2F3ladh1zmn4MzMOuYA\nVCWeBWdm1jEHoCrxLDgzs475HFAF3XEOaNs2GDAAXn01uzOCmTU2nwPanT8aq6RvXzjwQGhtLbon\nZmb1qWoBSNI1kjZKWp4r+6akxyT9RtIPJQ3ObbtQ0ipJj0uanCs/VtLytO2KXHl/STen8qWSDstt\nmy5pZXqclysfL+mBVOcmSX2r9fzBExHMzDpSzRHQtcCUsrLFwFsi4i+AlcCFAJImAlOBianOldLr\ndzS6CpgREROACZJKbc4AWlP55cDc1NYw4CLg+PSYlQt0c4FvpTrPpTaqxueBzCxP0j7x6C5VC0AR\ncR/Zh3y+bElE7EyrDwBj0/IZwIKI2BYRa4DVwCRJhwCDImJZ2m8+cGZaPh2Yl5ZvA05Ky6cAiyNi\nc0RsBpYAp6aAdiJwa9pvXq6tqvBMODMriYh96tEdijwH9PfAT9LyaGBdbts6YEyF8pZUTvq7FiAi\ntgNbJA3voK1hwOZcAMy3VRVOwZmZta+QW/FI+jLwWkTcWKNDdjlcz549+/XlpqYmmpqaunxQj4DM\nbF/W3NxMc3PzG65f8wAk6e+A02hLmUE2GhmXWx9LNnJpoS1Nly8v1TkUWC+pDzA4IloltQBNuTrj\ngHuATcAQSb3SKGhsaqOifAB6o0aNgqVL97oZM7O6VP7lfM6cOV2qX9MUXJpA8HngjIh4JbdpITBN\nUj9J44EJwLKI2AA8L2lSOodzLnBHrs70tHwWcHdaXgxMljRE0lDgZOCudGHPvcAH037Tgdur8kQT\np+DMzNpXtRGQpAXAu4ERktYCs8hmvfUDlqSZFPdHxMyIWCHpFmAFsB2YmbsSdCZwHbA/8JOIWJTK\nrwaul7QKaAWmAUTEJkmXAA+m/eakyQgAFwA3SboU+HVqo2qcgjMza5/vhFBBd9wJAeD3v4emJnjq\nqb3vk5lZvfOdEOrIyJFZCs4x3sxsdw5AVTRwIPTuDVu3Ft0TM7P64wBUZZ6IYGZWmQNQlfl2PGZm\nlTkAVZlnwpmZVeYAVGVOwZmZVeYAVGUeAZmZVeYAVGU+B2RmVpkDUJU5BWdmVpkDUJU5BWdmVpkD\nUJU5BWdmVpkDUJU5BWdmVpkDUJUNGQIvvQSvvLLnfc3MGokDUJVJ2XmgZ54puidmZvXFAagGfB7I\nzGx3DkA14JlwZma7cwCqAU9EMDPbnQNQDXgEZGa2OwegGvA5IDOz3TkA1YBTcGZmu3MAqgGn4MzM\nducAVANOwZmZ7c4BqAacgjMz213VApCkayRtlLQ8VzZM0hJJKyUtljQkt+1CSaskPS5pcq78WEnL\n07YrcuX9Jd2cypdKOiy3bXo6xkpJ5+XKx0t6INW5SVLfaj3/vBEjYNMm2LGjFkczM+sZqjkCuhaY\nUlb2RWBJRBwB3J3WkTQRmApMTHWulKRU5ypgRkRMACZIKrU5A2hN5ZcDc1Nbw4CLgOPTY5akwanO\nXOBbqc5zqY2q69Mnuydca2stjmZm1jNULQBFxH1kH/J5pwPz0vI84My0fAawICK2RcQaYDUwSdIh\nwKCIWJb2m5+rk2/rNuCktHwKsDgiNkfEZmAJcGoKaCcCt1Y4ftX5PJCZ2a5qfQ5oVESUPoY3AqPS\n8mhgXW6/dcCYCuUtqZz0dy1ARGwHtkga3kFbw4DNEbGzQltV55lwZma76lPUgSMiJEWtDtfVCrNn\nz359uampiaampr3qgCcimNm+prm5mebm5jdcv9YBaKOkgyNiQ0qvlT6SW4Bxuf3Gko1cWtJyeXmp\nzqHAekl9gMER0SqpBWjK1RkH3ANsAoZI6pVGQWNTGxXlA1B38AjIzPY15V/O58yZ06X6tU7BLQSm\np+XpwO258mmS+kkaD0wAlkXEBuB5SZPSOZxzgTsqtHUW2aQGgMXAZElDJA0FTgbuiogA7gU+WOH4\nVedzQGZmu6raCEjSAuDdwAhJa8lmpl0G3CJpBrAGOBsgIlZIugVYAWwHZqaAATATuA7YH/hJRCxK\n5VcD10taBbQC01JbmyRdAjyY9puTJiMAXADcJOlS4NepjZoYNQpWr67V0czM6p/aPuetRFJ09+ty\n553w3e/Cj3/crc2amdUNSUSE9rxnxndCqBGn4MzMduUAVCOeBWdmtiun4CqoRgru5Zdh6NDsrzo9\nQDUz6zmcgqtT++8P/frB888X3RMzs/rgAFRDPg9kZtbGAaiGfDGqmVkbB6Aa8kQEM7M2DkA15BGQ\nmVkbB6Aa8jkgM7M2DkA15BScmVkbB6AacgrOzKyNA1ANOQVnZtbGAaiGnIIzM2vjAFRDTsGZmbVx\nAKqhwYPhtdey+8GZmTU6B6AakrJRkNNwZmYOQDXnNJyZWcYBqMY8EcHMLOMAVGMeAZmZZRyAaszX\nApmZZRyAaswpODOzjANQjTkFZ2aWcQCqMafgzMwyhQQgSRdK+q2k5ZJulNRf0jBJSyStlLRY0pCy\n/VdJelzS5Fz5samNVZKuyJX3l3RzKl8q6bDctunpGCslnVe7Z51xCs7MLFPzACTpcOBjwDERcRTQ\nG5gGfBFYEhFHAHendSRNBKYCE4EpwJWSlJq7CpgREROACZKmpPIZQGsqvxyYm9oaBlwEHJ8es/KB\nrhacgjMzyxQxAnoe2AYMkNQHGACsB04H5qV95gFnpuUzgAURsS0i1gCrgUmSDgEGRcSytN/8XJ18\nW7cBJ6XlU4DFEbE5IjYDS8iCWs2MGAGbN8P27bU8qplZ/al5AIqITcC3gD+QBZ7NEbEEGBURpbHB\nRmBUWh4NrMs1sQ4YU6G8JZWT/q5Nx9sObJE0vIO2aqZ3bxg2DJ59tpZHNTOrP31qfUBJbwI+DRwO\nbAF+IOmc/D4REZKi1n3Lmz179uvLTU1NNDU1dVvbpTTcwQd3W5NmZjXX3NxMc3PzG65f8wAEHAf8\nIiJaAST9EHg7sEHSwRGxIaXXSqfqW4BxufpjyUYuLWm5vLxU51BgfUrzDY6IVkktQFOuzjjgnkqd\nzAeg7uaJCGa2Lyj/cj5nzpwu1S/iHNDjwAmS9k+TCd4DrADuBKanfaYDt6flhcA0Sf0kjQcmAMsi\nYgPwvKRJqZ1zgTtydUptnUU2qQFgMTBZ0hBJQ4GTgbuq9UTb46nYZmYFjIAi4jeS5gO/BHYCvwb+\nExgE3CJpBrAGODvtv0LSLWRBajswMyJK6bmZwHXA/sBPImJRKr8auF7SKqCVbJYdEbFJ0iXAg2m/\nOWkyQk15JpyZGajts9xKJEU1X5fLLoPnnoO5c6t2CDOzmpNERGjPe2Z8J4QCeARkZuYAVAifAzIz\n62IAkjQ0dxcCe4M8C87MrIMAJGmWpCPTcn9J9wK/AzZKOrlWHdwXOQVnZtbxCGgq2ZRpyKY0CzgI\neDfw9Sr3a582cmQ2AvL8DzNrZB0FoFdzU8GmADdFxI6IeIxiLmDdZ+y3HwwYkN0TzsysUXUYgCQd\nJekgsrsHLM5tG1DVXjUAp+HMrNF1FIA+DdwKPAFcHhFPAkh6L9nFo7YXPBHBzBpdu6m0iFgKvLlC\n+Y+BH1ezU43AU7HNrNG1G4AkfQ7InybPT7+OiPh21XrVAJyCM7NG11EKblB6HAh8Hjgg9xhU/a7t\n25yCM7NG11EKbnZpWdIZEdG1+2xbh0aOhIcfLroXZmbF8a14CuJzQGbW6ByACuIUnJk1uo4mISzP\nrb6pbD0i4q3V69a+z5MQzKzRdXRHg7/pYJtvIrOXnIIzs0bX0SSENZXK092wzwaeqlKfGsKgQbBj\nB7z4IgwcWHRvzMxqr6O7YR8g6XOSrpQ0U1IvSe8Hfgt8pHZd3DdJbTclNTNrRB2l4OYDzwP3A5OB\nvwNeAT4cEZ5A3A1KExHGjy+6J2ZmtddRAPrT0kQDSd8D/ggcFhEv16RnDcDngcyskXU0DXtHaSEi\ndgAtDj7dyzPhzKyRdTQCequkrbn1/XPrEREHVrFfDcHXAplZI+toFlzvWnakEY0cCU8+WXQvzMyK\nUcidECQNkXSrpMckrZA0SdIwSUskrZS0WNKQ3P4XSlol6XFJk3Plx0panrZdkSvvL+nmVL5U0mG5\nbdPTMVZKOq92z3p3PgdkZo2sqFvxXAH8JCKOBN4KPA58EVgSEUcAd6d1JE0EpgITyX4a/Mp0LRLA\nVcCMiJgATJA0JZXPAFpT+eXA3NTWMOAi4Pj0mJUPdLXmFJyZNbKaByBJg4F3RcQ1ABGxPSK2AKcD\n89Ju84Az0/IZwIKI2JYujl0NTJJ0CDAoIpal/ebn6uTbug04KS2fAiyOiM0RsRlYQhbUCuFJCGbW\nyIoYAY0HnpF0raRfS/ovSQOBURFR+jjeCIxKy6OBdbn664AxFcpbUjnp71rIAhywRdLwDtoqhFNw\nZtbIOpoFV81jHgP8U0Q8KOk7pHRbSUSEpELvNzd79uzXl5uammhqaur2YwwfDs8/D9u2Qd++3d68\nmVlVNTc309zc/IbrFxGA1gHrIuLBtH4rcCGwQdLBEbEhpddKZ0dagHG5+mNTGy1puby8VOdQYL2k\nPsDgiGiV1AI05eqMA+6p1Ml8AKqWXr2yIPTMMzB6dNUPZ2bWrcq/nM+Z07XfLa15Ci4iNgBrJR2R\nit5Ddn+5O4HpqWw6cHtaXghMk9RP0nhgArAstfN8mkEn4FzgjlydUltnkU1qAFgMTE6z8IYCJwN3\nVeN5dpYnIphZoypiBATwz8ANkvoBvwM+CvQGbpE0A1hDdsdtImKFpFuAFcB2YGZElNJzM4HrgP3J\nZtUtSuVXA9dLWgW0AtNSW5skXQKURl9z0mSEwvg8kJk1KrV9lluJpKjV63LOOTB5MpxX6BVJZmZ7\nTxIRoT3vmfFPchfMKTgza1QOQAXztUBm1qgcgArmc0Bm1qgcgArmFJyZNSoHoII5BWdmjcoBqGBO\nwZlZo/I07ApqOQ37tddg4EB49dXszghmZj2Vp2H3MP36wQEHwHPPFd0TM7PacgCqA56IYGaNyAGo\nDvg8kJk1IgegOuCZcGbWiByA6oBTcGbWiByA6oBHQGbWiByA6oDPAZlZI3IAqgNOwZlZI3IAqgNO\nwZlZI3IAqgNOwZlZI3IAqgNOwZlZI3IAqgMDB0IEvPBC0T0xM6sdB6A6IHkUZGaNxwGoTvg8kJk1\nGgegOuGZcGbWaByA6oRTcGbWaAoLQJJ6S3pI0p1pfZikJZJWSlosaUhu3wslrZL0uKTJufJjJS1P\n267IlfeXdHMqXyrpsNy26ekYKyWdV6vnuyceAZlZoylyBPQpYAVQ+unRLwJLIuII4O60jqSJwFRg\nIjAFuFJS6Rf3rgJmRMQEYIKkKal8BtCayi8H5qa2hgEXAcenx6x8oCuSzwGZWaMpJABJGgucBnwP\nKAWT04F5aXkecGZaPgNYEBHbImINsBqYJOkQYFBELEv7zc/Vybd1G3BSWj4FWBwRmyNiM7CELKgV\nzik4M2s0RY2ALgc+D+zMlY2KiNIYYCMwKi2PBtbl9lsHjKlQ3pLKSX/XAkTEdmCLpOEdtFU4p+DM\nrNH0qfUBJb0PeDoiHpLUVGmfiAhJUWlbrcyePfv15aamJpqamqp6PKfgzKynaW5uprm5+Q3Xr3kA\nAt4BnC7pNGA/4EBJ1wMbJR0cERtSeq2UkGoBxuXqjyUbubSk5fLyUp1DgfWS+gCDI6JVUgvQlKsz\nDrinUifzAagWnIIzs56m/Mv5nDlzulS/5im4iPhSRIyLiPHANOCeiDgXWAhMT7tNB25PywuBaZL6\nSRoPTACWRcQG4HlJk9KkhHOBO3J1Sm2dRTapAWAxMFnSEElDgZOBu6r2ZLtg6FDYuhVee63onpiZ\n1UYRI6BypVTbZcAtkmYAa4CzASJihaRbyGbMbQdmRkSpzkzgOmB/4CcRsSiVXw1cL2kV0EoW6IiI\nTZIuAR5M+81JkxEK16sXHHQQPPMMjKmLs1JmZtWlts9yK5EURbwuRx8NV18NxxxT80Obme01SUSE\n9rxnxndCqCOeCWdmjcQBqI54IoKZNRIHoDriqdhm1kgcgOqIU3Bm1kgcgOqIU3Bm1kgcgOqIR0Bm\n1kgcgOqIzwGZWSNxAKojTsGZWSPxhagVFHUh6rZtMGAAvPpqdmcEM7OexBei9mB9+8KBB0Jra9E9\nMTOrPgegOuM0nJk1CgegOuOZcGbWKByA6oxHQGbWKByA6oynYptZo3AAqjNOwZlZo3AAqjNOwZlZ\no3AAqjMeAZlZo3AAqjM+B2RmjcIBqM44BWdmjcIBqM6UUnC+Q5KZ7escgOrMwIHQuzds3Vp0T8zM\nqssBqA45DWdmjcABqA55JpyZNYKaByBJ4yTdK+m3kh6V9MlUPkzSEkkrJS2WNCRX50JJqyQ9Lmly\nrvxYScvTtity5f0l3ZzKl0o6LLdtejrGSknn1ep5d4VHQGbWCIoYAW0DPhMRbwFOAM6XdCTwRWBJ\nRBwB3J3WkTQRmApMBKYAV0oq/d7EVcCMiJgATJA0JZXPAFpT+eXA3NTWMOAi4Pj0mJUPdPXCU7HN\nrBHUPABFxIaIeDgtvwA8BowBTgfmpd3mAWem5TOABRGxLSLWAKuBSZIOAQZFxLK03/xcnXxbtwEn\npeVTgMURsTkiNgNLyIJaXXEKzswaQaHngCQdDhwNPACMiojSx+5GYFRaHg2sy1VbRxawystbUjnp\n71qAiNgObJE0vIO26opTcGbWCPoUdWBJB5CNTj4VEVvbsmoQESGp0CthZs+e/fpyU1MTTU1NNTv2\nyJHQ3Fyzw5mZvSHNzc0078WHVSEBSFJfsuBzfUTcnoo3Sjo4Ijak9FppDNACjMtVH0s2cmlJy+Xl\npTqHAus5dtbeAAAIhklEQVQl9QEGR0SrpBagKVdnHHBPpT7mA1Ct+RyQmfUE5V/O58yZ06X6RcyC\nE3A1sCIivpPbtBCYnpanA7fnyqdJ6idpPDABWBYRG4DnJU1KbZ4L3FGhrbPIJjUALAYmSxoiaShw\nMnBXtz/JveQUnJk1giLOAb0TOAc4UdJD6TEFuAw4WdJK4K/TOhGxArgFWAH8FJgZ8fqNamYC3wNW\nAasjYlEqvxoYLmkV8GnSjLqI2ARcAjwILAPmpMkIdWXMGHjmGfj+94vuiZlZ9Sh807HdSIqiX5fl\ny+EDH4D3vAcuvxz69y+0O2ZmeySJiNCe98z4Tgh16qij4MEHs3NB73oXPPVU0T0yM+teDkB1bPBg\nuPVWmDoVJk2CRYv2XMfMrKdwCq6CekjBlbvvPpg2DT72MfjqV7M7ZpuZ1ZOupuAcgCqoxwAEsGFD\nNhrabz+44QYYMaLoHpmZtfE5oH3YwQfD3XfD294Gxx4Ly5btuY6ZWb1yAOph+vSBuXPhiivgfe+D\nK6/0r6eaWc/kFFwF9ZqCK7d6dTZV+6ij4D/+I/s1VTOzojgF10D+9E/h/vuzUdGkSfDEE0X3yMys\n8xyAergBA+Daa+FTn8quF7r11qJ7ZGbWOU7BVdBTUnDlfvUr+OAH4cwzs/NEffsW3SMzayROwTWw\nY4+FX/4SVq6EE0+Elpaie2Rm1j4HoH3MsGGwcCGceir85V/CvfcW3SMzs8qcgqugp6bgyv3sZ3Du\nudn5oS98AXr564aZVZHvhNAN9pUABLBuHZx9Nhx0EMybB0OGFN0jM9tX+RyQ7WLs2OznvQ8/PDtH\n9PDDRffIzCzjANQA+vXL7pzwta/BySdn07bNzIrmFFwF+1IKrtxjj2V3T3jHO+Df/g3237/oHpnZ\nvsIpOOvQkUdmNzF98UV45zvhySeL7pGZNSoHoAZ0wAFw443w0Y/CCSfAnXcW3SMza0ROwVWwL6fg\nyt1/f/YbQ+ecAxdfnN1XzszsjfA07G7QSAEI4Jln4MMfhp07YcECGDmy6B6ZWU/kc0DWZQcdBIsW\nZRMTjj0Wfv7zontkZo2gIQOQpCmSHpe0StIFRfenHvTuDZdcAt/9Lvzt32bTthtoEGhmBWi4ACSp\nN/DvwBRgIvAhSUcW26v68d73wtKlMH8+TJsGDz2U/fDdhg3wwgtZmq6rmpubu72fjcqvZffy61ms\nRjzlfDywOiLWAEi6CTgDeKzITtWT8eOzNNwFF2Qz5V54AbZuzf6+/HL2y6sHHND2GDSo4/W7727m\n2Web2t0+YACo01njxtbc3ExTU1PR3dhn+PUsViMGoDHA2tz6OmBSQX2pW/vtl6Xhyu3YAS+91BaQ\nSo/y9RdegC1bsp+EWLMGbrqp/TqvvrprUNtTQOvM+n77OaiZ1btGDEA+s7EXevfOPuAHDep8ndmz\ns0d7duzILoytFMTKy557DtaubX97af2113YNSP37twUkadflzv6thzqrVsGDD7b/WtaTnvAFYOXK\n7IccrRgNNw1b0gnA7IiYktYvBHZGxNzcPo31opiZdRNfB9QBSX2AJ4CTgPXAMuBDEeFzQGZmNdRw\nKbiI2C7pn4C7gN7A1Q4+Zma113AjIDMzqw8Ndx1QR3yBaveStEbSI5IekrSs6P70NJKukbRR0vJc\n2TBJSyStlLRYkn/jtpPaeT1nS1qX3qMPSZpSZB97CknjJN0r6beSHpX0yVTepfenA1DiC1SrIoCm\niDg6Io4vujM90LVk78e8LwJLIuII4O60bp1T6fUM4NvpPXp0RCwqoF890TbgMxHxFuAE4Pz0edml\n96cDUJvXL1CNiG1A6QJV2zs9YDJufYqI+4DnyopPB+al5XnAmTXtVA/WzusJfo92WURsiIiH0/IL\nZBfyj6GL708HoDaVLlAdU1Bf9hUB/EzSLyV9rOjO7CNGRcTGtLwRGFVkZ/YR/yzpN5Kudkqz6yQd\nDhwNPEAX358OQG08G6P7vTMijgZOJRuiv6voDu1L0m+G+H27d64CxgNvA/4IfKvY7vQskg4AbgM+\nFRFb89s68/50AGrTAozLrY8jGwXZGxQRf0x/nwF+RJbmtL2zUdLBAJIOAZ4uuD89WkQ8HQnwPfwe\n7TRJfcmCz/URcXsq7tL70wGozS+BCZIOl9QPmAosLLhPPZakAZIGpeWBwGRgece1rBMWAtPT8nTg\n9g72tT1IH5Il78fv0U6RJOBqYEVEfCe3qUvvT18HlCPpVOA7tF2g+o2Cu9RjSRpPNuqB7ILnG/x6\ndo2kBcC7gRFk+fSLgDuAW4BDgTXA2RGxuag+9iQVXs9ZQBNZ+i2A3wP/J3cOw9oh6a+A/wEeoS3N\ndiHZnWU6/f50ADIzs0I4BWdmZoVwADIzs0I4AJmZWSEcgMzMrBAOQGZmVggHIDMzK4QDkFkPJmlW\n2fqO9LMCj0j6YbpVilld8nVAZj2QpI8AhwDDgU1AS0TcKGlrRJTuQHEdsDwifH8zq0seAZkVJN32\n6XFJ10p6QtINkiZL+kX6Qa+/TD+Y9rlcnUclHRoRN5Ddv/DzwFMRcWOFQ9wPvKlGT8esyxyAzIr1\nJuD/An8GvBmYGhHvAP4F+BK73004yG7F9SGynwv5JnBYWn9d+oHFycCj1e2+2RvXp+gOmDW430fE\nbwEk/Rb4WSp/FDgceLhCnYiIBanOrIj4Zm7b/pIeIgtOa4DvVqnfZnvNIyCzYr2aW94JvJZb7gNs\nZ9f/p/vlK0fEnLL2Xk6/wXQY8Ar+VV+rYw5AZvVtDXAMgKRjyH48bY8i4mXgk8DX0q3zzeqOA5BZ\nsSqd48kv3wYMk/QocD7wRGfbi4iHgdXA2d3QT7Nu52nYZmZWCI+AzMysEA5AZmZWCAcgMzMrhAOQ\nmZkVwgHIzMwK4QBkZmaFcAAyM7NCOACZmVkh/j+sUJzVpZ+OegAAAABJRU5ErkJggg==\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The concrete thickness = 130.05 cm \n", + "\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg575" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 10.4\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "E = 6.; ## Energy of gamma rays in MeV\n", + "phi0 = 10**2; ## Intensity of gamma rays in gamma-rays/cm^2-sec from mono-directional beam\n", + "x_w = 100.; ## Thickness of water in cm\n", + "x_Pb = 8.; ## Thickness of lead in cm\n", + "## Using data from Table II.4 at 6 MeV\n", + "mu_w = 0.0275; ## Total attenuation coefficient of water in cm^(-1)\n", + "mu_Pb = 0.4944; ## Total attenuation coefficient of lead in cm^(-1)\n", + "\n", + "mua_w = x_w*mu_w; ## Attenuation due to thickness of water\n", + "mua_Pb = x_Pb*mu_Pb; ## Attenuation due to thickness of lead\n", + "\n", + "## Case (a) - Water is placed before the lead\n", + "print'%s %.2f %s'%(\" \\n In case (a), Buildup factor is only due to lead measured at \",mua_Pb,\"\");\n", + "## Using the data from Table 10.1 at 6 MeV\n", + "B_Pb = 1.86;\n", + "phi_b_a = phi0*B_Pb*math.exp(-(mua_w+mua_Pb));\n", + "\n", + "## Using the data from Table II.5 for 6 MeV \n", + "mua_rho_air = 0.0172; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", + "## Calculation\n", + "X_dot_a = 0.0659*E*mua_rho_air*phi_b_a;\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n Exposure rate if water is placed before lead shield = \",X_dot_a*1000,\" uR/hour \\n\");\n", + "\n", + "## Case (b) - Lead is placed before water\n", + "print'%s %.2f %s %.2f %s'%(\" \\n In case (b), Buildup factor is due to water and lead measured at \",mua_w,\"\" and \"\",mua_Pb,\" respectively\");\n", + "## Using the data from Table 10.1 for water at 3.2 MeV,, which is the minimum point of mu_Pb curve\n", + "B_w = 2.72;\n", + "B_m = B_Pb*B_w;\n", + "phi_b_b = phi0*B_m*math.exp(-(mua_w+mua_Pb));\n", + "\n", + "## Calculation\n", + "X_dot_b = 0.0659*E*mua_rho_air*phi_b_b;\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n Exposure rate if lead is placed before water = \",X_dot_b*1000,\" uR/hour \\n\");\n", + "## The answer given in the textbook is wrong. This is because the intensity of gamma rays is wrongly taken for calculation. \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " In case (a), Buildup factor is only due to lead measured at 3.96 \n", + "\n", + " Exposure rate if water is placed before lead shield = 1.55 uR/hour \n", + "\n", + " \n", + " In case (b), Buildup factor is due to water and lead measured at 2.75 3.96 respectively\n", + "\n", + " Exposure rate if lead is placed before water = 4.21 uR/hour \n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg582" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 10.5\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "fission_density = 4*10**7; ## Fission density in fissions/cm^2-sec\n", + "## 1 inches = 2.54 cm\n", + "d = 28*2.54; ## Diamaeter of plate in cm\n", + "R = d/2.; ## Radius of plate in cm\n", + "v = 2.42; ## Number of fission neutrons emitted per fission\n", + "x = 75.; ## Distance of point from center of plate in cm\n", + "## Using the data from Table 10.4 for removal macroscopic cross section of water\n", + "sigma_RW = 0.103; ## Removal macroscopic cross section of water in cm^-1\n", + "S = v*fission_density; ## Strength of neutron source in terms of neutrons/cm^2-sec\n", + "A = 0.12; ## A constant\n", + "## From Figure 10.19\n", + "\n", + "## Let the upper limit of integral be 20\n", + "x_limit = 20;\n", + "E1_x11 = 0.0000512 \n", + " \n", + " \n", + "E1_x21 = 0.0000205 \n", + "## Calculation\n", + "phi_1 = S*A/2.*(E1_x11-E1_x21);\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The fast flux without iron shield = \",phi_1,\" neutrons/cm^2-sec \\n\");\n", + "\n", + "## 2. Iron slab is inserted in front of the fission plate\n", + "## Using the data from Table 10.4 for removal macroscopic cross section of iron\n", + "sigma_R = 0.168; ## Removal macroscopic cross section of iron in cm^-1\n", + "t = 3*2.54; ## Thickness of iron slab in cm\n", + "## Now the analysis is similar to multi layered shielding\n", + "\n", + "x_limit = 20;\n", + "\n", + "E1_x12 = 0.0000124 \n", + "E1_x22 = 0.0000043 \n", + " \n", + " \n", + "## Calculation\n", + "phi_2 = S*A/2*(E1_x12-E1_x22);\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The fast flux with iron shield = \",phi_2,\" neutrons/cm^2-sec \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The fast flux without iron shield = 178.31 neutrons/cm^2-sec \n", + "\n", + " \n", + " The fast flux with iron shield = 47.04 neutrons/cm^2-sec \n", + "\n" + ] + } + ], + "prompt_number": 45 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg587" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 10.6\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "## Assuming average energy produced per fission reaction is 200 MeV \n", + "P = 250.*10**3; ## Power of research reactor in Watts\n", + "P_fission = 200*10**6*1.6*10**(-19); ## Energy produced in a fission reaction in terms of joule\n", + "f = 0.75; ## Metal volume fraction\n", + "## In this problem, both reflector and shield act as a composite shield\n", + "a = 150.+15.; ## Net shield distance in cm\n", + "## 1 litre = 1000 grams\n", + "V = 32.*1000.; ## Core volume in gram\n", + "\n", + "fission_density = (P/P_fission)*(1./V);\n", + "v = 2.42; ## Number of fission neutrons emitted per fission\n", + "S = fission_density*v; ## Neutron source strength in neutrons/cm^3-sec\n", + "## Assuming spherical shape\n", + "## Volume of sphere = (4/3)*pi*(radius)^3\n", + "R = ((3.*V)/(4.*math.pi))**(1./3.);\n", + "## Using the data from Table 10.4 for removal macroscopic cross section \n", + "sigma_R = 0.174; ## Removal macroscopic cross section of uranium in cm^-1\n", + "sigma_RW = 0.103; ## Removal macroscopic cross section of water in cm^-1\n", + "A = 0.12; ## A constant\n", + "alpha = ((1.-f)*sigma_RW)+(f*sigma_R); ## A parameter\n", + "## Calculation\n", + "theta = (S*A/(4*alpha))*(math.ceil(R)/(math.ceil(R)+a))**2*math.exp(-sigma_RW*a)*(1-math.exp(-2*alpha*math.ceil(R)));\n", + "## Converting into equivalent dose rate by referring Figure 9.12\n", + "## Fast neutron flux of 6.8 neutrons/cm^2-sec is equivalent to 1 mrem/hr\n", + "H_dot = theta/6.8;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Fast neutron dose rate near the surface of the shield = \",H_dot,\" mrem/hour \\n \");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Fast neutron dose rate near the surface of the shield = 8.10 mrem/hour \n", + " \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg593" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 10.7\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "E = 14.; ## Energy of neutrons in MeV\n", + "phi0 = 10**9; ## Intensity of neutrons in neutrons/cm^2-sec from isotropic point source\n", + "## 1 feet = 30.48 cm\n", + "d = 10*30.48; ## Distance of concrete wall from a point source in cm\n", + "## As Intensity obeys inverse square law\n", + "I = phi0/(4.*math.pi*d**2); ## Intensity of neutron beam in terms of neutrons/cm^2-sec\n", + "H_dot = 1.; ## The required dose equivalent rate in mrem/hour\n", + "## From Figure 10.23(b)\n", + "H0_dot = H_dot/I; ## The dose equivalent rate\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The reduced dose equivalent rate due to concrete wall is = \",H0_dot,\" mrem/hr \\n\");\n", + "## By looking into Figure 10.23(b) on thickness axis\n", + "print(\" \\n The concrete slab thickness is = 70 cm \\n\");\n", + "\t\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The reduced dose equivalent rate due to concrete wall is = 0.00 mrem/hr \n", + "\n", + " \n", + " The concrete slab thickness is = 70 cm \n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg598" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 10.8\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "R = 7.*30.48; ## Distance of core from the center of shield in cm\n", + "## Assuming average energy produced per fission reaction is 200 MeV \n", + "P = 10.; ## Power of teaching reactor in Watts\n", + "P_fission = 200*10**6*1.6*10**(-19); ## Energy produced in a fission reaction in terms of joule\n", + "fission_rate = P/P_fission; ## Number of fission reactions\n", + "\n", + "## By assuming that the gammma rays are of equal energy of 1 MeV (Group 1) and looking into Table 10.5\n", + "E1 = 1.; ## Energy of gamma rays in MeV (Assumed)\n", + "chi_pn1 = 5.2; ## Number of prompt gamma rays emitted per fission with energy 2 MeV\n", + "S1 = chi_pn1*fission_rate; ## Source strength in gamma rays/sec\n", + "## Using the data from Table II.4 for E = 1 MeV for water\n", + "mu1 = 0.0996; ## Mass attenuation coefficient at 1 MeV in cm^-1\n", + "print'%s %.2f %s'%(\" \\n Buildup factor is due to water measured at \",mu1*R,\"\");\n", + "## Using the data from Table 10.2 at 1 MeV\n", + "B_p1 = 373.;\n", + "phi_b1 = (S1/(4.*math.pi*R**2))*B_p1*math.exp(-mu1*R); ## Buildup flux\n", + "## Using the data from Table II.5 for 1 MeV \n", + "mua_rho_air1 = 0.028; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", + "## Calculation\n", + "X_dot1 = 0.0659*E1*mua_rho_air1*phi_b1;\n", + "print'%s %.2f %s'%(\"\\n Exposure rate due to group 1 = \",X_dot1,\" mR/hour \\n\");\n", + "\n", + "## By assuming that the gammma rays are of equal energy of 2 MeV (Group 2) and looking into Table 10.5\n", + "E2 = 2.; ## Energy of gamma rays in MeV (Assumed)\n", + "chi_pn2 = 1.8; ## Number of prompt gamma rays emitted per fission with energy 2 MeV\n", + "S2 = chi_pn2*fission_rate; ## Source strength in gamma rays/sec\n", + "## Using the data from Table II.4 for E = 2 MeV for water\n", + "mu2 = 0.0493; ## Mass attenuation coefficient at 2 MeV in cm^-1\n", + "print'%s %.2f %s'%(\" \\n Buildup factor is due to water measured at \",mu2*R,\"\");\n", + "## Using the data from Table 10.2 at 2 MeV\n", + "B_p2 = 13.1;\n", + "phi_b2 = (S2/(4.*math.pi*R**2))*B_p2*math.exp(-mu2*R); ## Buildup flux \n", + "## Using the data from Table II.5 for 2 MeV \n", + "mua_rho_air2 = 0.0238; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", + "## Calculation \n", + "X_dot2 = 0.0659*E2*mua_rho_air2*phi_b2;\n", + "print'%s %.2f %s'%(\"\\n Exposure rate due to group 2 = \",X_dot2,\" mR/hour \\n\");\n", + "\n", + "## By assuming that the gammma rays are of equal energy of 4 MeV (Group 3) and looking into Table 10.5\n", + "E3 = 4.; ## Energy of gamma rays in MeV (Assumed)\n", + "chi_pn3 = 0.22; ## Number of prompt gamma rays emitted per fission with energy 4 MeV\n", + "S3 = chi_pn3*fission_rate; ## Source strength in gamma rays/sec\n", + "## Using the data from Table II.4 for E = 4 MeV for water\n", + "mu3 = 0.0339; ## Mass attenuation coefficient at 4 MeV in cm^-1\n", + "print'%s %.2f %s'%(\" \\n Buildup factor is due to water measured at\",mu3*R,\"\");\n", + "## Using the data from Table 10.2 at 4 MeV\n", + "B_p3 = 5.27;\n", + "phi_b3 = (S3/(4.*math.pi*R**2))*B_p3*math.exp(-mu3*R); ## Buildup flux \n", + "## Using the data from Table II.5 for 4 MeV \n", + "mua_rho_air3=0.0194; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", + "## Calculation\n", + "X_dot3 = 0.0659*E3*mua_rho_air3*phi_b3;\n", + "print'%s %.2f %s'%(\"\\n Exposure rate due to group 3 = \",X_dot3,\" mR/hour \\n\");\n", + "\n", + "## By assuming that the gammma rays are of equal energy of 6 MeV (Group 4) and looking into Table 10.5\n", + "E4 = 6; ## Energy of gamma rays in MeV (Assumed)\n", + "chi_pn4 = 0.025; ## Number of prompt gamma rays emitted per fission with energy 4 MeV\n", + "S4 = chi_pn4*fission_rate; ## Source strength in gamma rays/sec\n", + "## Using the data from Table II.4 for E = 6 MeV for water\n", + "mu4 = 0.0275; ## Mass attenuation coefficient at 6 MeV in cm^-1\n", + "print'%s %.2f %s'%(\" \\n Buildup factor is due to water measured at \",mu4*R,\"\");\n", + "## Using the data from Table 10.2 at 6 MeV\n", + "B_p4 = 3.53;\n", + "phi_b4 = (S4/(4.*math.pi*R**2))*B_p4*math.exp(-mu4*R); ## Buildup flux \n", + "## Using the data from Table II.5 for 4 MeV \n", + "mua_rho_air4=0.0172; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", + "## Calculation\n", + "X_dot4 = 0.0659*E4*mua_rho_air4*phi_b4;\n", + "print'%s %.2f %s'%(\"\\n Exposure rate due to group 3 = \",X_dot4,\" mR/hour \\n\");\n", + "\n", + "##Calculation\n", + "X_dot = X_dot1+X_dot2+X_dot3+X_dot4;\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n The total exposure rate due to all groups = \",X_dot,\" mR/hour \\n\");\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Buildup factor is due to water measured at 21.25 \n", + "\n", + " Exposure rate due to group 1 = 0.00 mR/hour \n", + "\n", + " \n", + " Buildup factor is due to water measured at 10.52 \n", + "\n", + " Exposure rate due to group 2 = 1.09 mR/hour \n", + "\n", + " \n", + " Buildup factor is due to water measured at 7.23 \n", + "\n", + " Exposure rate due to group 3 = 2.34 mR/hour \n", + "\n", + " \n", + " Buildup factor is due to water measured at 5.87 \n", + "\n", + " Exposure rate due to group 3 = 0.93 mR/hour \n", + "\n", + "\n", + " The total exposure rate due to all groups = 4.36 mR/hour \n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg603" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 10.9\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "## Assuming average energy produced per fission reaction is 200 MeV \n", + "P = 55.; ## Power density of reactor in watts/cm^3\n", + "rho_eff_U = 0.33; ## Effective density of uranium in g/cm^3\n", + "rho_eff_W = 1-rho_eff_U; ## Effective density of water in g/cm^3\n", + "t_i = 3.; ## Average time spent by water in the reactor in seconds\n", + "t_0 = 2.; ## Average time spent by water in the external coolant circuit in seconds\n", + "## 1 eV = 1.6*10^(-19) J\n", + "P_fission = 200.*10**6*1.6*10**(-19); ## Energy produced in a fission reaction in terms of joule\n", + "fission_density = P/P_fission; ## Number of fission reactions\n", + "v = 2.42; ## Number of fission neutrons emitted per fission\n", + "S = v*fission_density; ## Strength of neutron source in terms of neutrons/cm^2-sec\n", + "## Atom density of oxygen at normal density of 1 g/cm^3 is\n", + "rho = 1.; ## Density of water in g/cm^3\n", + "N_A = 6.02*10**(23); ## Avogadro's constant\n", + "M = 18.; ## Molecular weight of water\n", + "atom_density = (rho*N_A)/M;\n", + "\n", + "## Using the data from Table 10.7\n", + "sigma_r = 1.9*10**(-5)*10**(-24); ## Reaction cross section in cm^2\n", + "T_12 = 7.1; ## Half life of the given reaction in seconds\n", + "lambd = 0.693/T_12; ## Decay constant of the given reaction in seconds^(-1)\n", + "sigma_act = rho_eff_W*atom_density*sigma_r; ## Average macroscopic activation cross section\n", + "## Using the data from Table 10.4\n", + "sigma_RW = 0.103; ## Removal cross section of water in cm^-1\n", + "sigma_RU = 0.174; ## Removal cross section of Uranium in cm^-1\n", + "sigma_R = (sigma_RU*rho_eff_U)+(sigma_RW*rho_eff_W); ## Removal cross section of mixture\n", + "## Let activation rate given by (sigma_act*phi_av) be denoted as AR\n", + "AR = (sigma_act*S)/sigma_R;\n", + "## Calculation\n", + "alpha = AR*(1.-math.exp(-t_i*lambd))/(1.-math.exp(-(t_i+t_0)*lambd));\n", + "## 1 curie = 3.7*10^(10) disintegrations/sec\n", + "## Result\n", + "print'%s %.2e %s %.2f %s '%(\"\\n Equilibrium activity of water due to neutron capture of oxygen = \",alpha,\" disintegrations/cm^3-sec\" and \" \",math.ceil(alpha*10**6/(3.7*10**10)),\" uCi/cm^3 \\n\");\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Equilibrium activity of water due to neutron capture of oxygen = 9.21e+06 249.00 uCi/cm^3 \n", + " \n" + ] + } + ], + "prompt_number": 9 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter11.ipynb b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter11.ipynb new file mode 100644 index 00000000..3707f403 --- /dev/null +++ b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter11.ipynb @@ -0,0 +1,738 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a11cc512169116adf57e35ff3d91c22a205b0bd00091c517137cb24d85c0113e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter11-Reactor Licensing Safety and the Environment " + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg646" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 11.1\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "h = 30.; ## Height at which the effluent is relaesed\n", + "## Calculation of maxima location \n", + "sigma_z = h/math.sqrt(2.); ## Vertical dispersion coefficient\n", + "## Using the plot given in Figure 11.12 for Type F condition\n", + "## The corresponding value with calculated maximum location is noted. \n", + "h_max = 1900.;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The point of maximum concentration of non-radioactive effluent = \",h_max,\" m \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The point of maximum concentration of non-radioactive effluent = 1900.00 m \n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg654" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 11.2\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "A = 2*10**3; ## Amount of radioactivity release due to Xenon-133 in curie\n", + "t = 365.*24.*3600.; ## Time in seconds\n", + "Q_dash = A/t; ## Average emission rate of Xenon-133\n", + "h = 100.; ## Location of radioactivity release through vent\n", + "v_bar = 1.; ## Wind speed in m/sec\n", + "## Using the plot given in Figure 11.11 and 11.12 for Type F condition at 100 m\n", + "sigma_y = 275.; ## Horizontal dispersion coefficient\n", + "sigma_z = 46.; ## Vertical dispersion coefficient\n", + "chi = (Q_dash*math.exp(-h**2/(2.*sigma_z**2)))/(math.pi*v_bar*sigma_y*sigma_z); ## Radionuclide concentration in terms of Ci/cm^3\n", + "## Using data from Table 11.3\n", + "Eg_bar = 0.03; ## Average gamma decay energy per disintegration in MeV\n", + "## Calculation \n", + "H_dot = 0.262*chi*Eg_bar*t*10**3; ## The units are in mrem/year\n", + "## Expressing the dose rate in SI units\n", + "H_dot_SI = 2.62*chi*Eg_bar*t*10**3;\n", + "## Result\n", + "print'%s %.2f %s %.2f %s '%(\" \\n The external gamma dose rate due to xenon release under type F condition = \",H_dot,\" mrem/year\" or \" \",H_dot_SI,\"mSv/year \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The external gamma dose rate due to xenon release under type F condition = 0.04 mrem/year 0.37 mSv/year \n", + " \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg655" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 11.3\n", + "import math\n", + "#calculate the\n", + "\n", + "## Using data from Table 11.3\n", + "Eg_bar = 0.00211; ## Average gamma decay energy per disintegration in MeV\n", + "## Calculation\n", + "C_y = 0.262*Eg_bar;\n", + "## Result\n", + "print'%s %.2e %s'%(\" \\n The dose rate factor due to krypton exposure = \",C_y,\" rem*m^3/sec-Ci \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The dose rate factor due to krypton exposure = 5.53e-04 rem*m^3/sec-Ci \n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg656" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 11.4\n", + "import math\n", + "#calculate the\n", + "\n", + "## The results given in Example 11.2 are to be used in this problem\n", + "chi = 1.5*10**(-10); ## Radionuclide concentration in terms of Ci/cm^3\n", + "t = 365.*24.*3600.; ## Time in seconds\n", + "## Using data from Table 11.3\n", + "Ebeta_bar = 0.146; ## Average gamma decay energy per disintegration in MeV\n", + "f = 1.; ## Experimentally detemined factor\n", + "## Calculation\n", + "H_dot = 0.229*Ebeta_bar*chi*f*t;\n", + "## Expressing the result in milli-rem\n", + "print'%s %.2f %s'%(\" \\n The external beta dose rate due to xenon exposure for a year = \",H_dot*10**3,\" mrem/year \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The external beta dose rate due to xenon exposure for a year = 0.16 mrem/year \n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg658" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 11.5\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "A = 1.23; ## Amount of radioactivity release due to I-131 in curie in one year\n", + "h = 30.; ## Location of radioactivity release through vent in meter\n", + "v_bar = 1.2; ## Wind speed in m/sec\n", + "T_12 = 8.04; ## Half life of Iodine 131 in days\n", + "T_12b = 138.; ## Biological half life of Iodine 131 in days\n", + "zeta = 0.23; ## Fraction of core inventory in MeV \n", + "q = 0.23; ## Fraction of Iodine-131 in thyroid\n", + "M = 20.; ## Mass of an adult thyroid in grams\n", + "\n", + "## 1.\n", + "t = 365.*24.*3600.; ## Time in seconds\n", + "Q_dash = A/t; ## Average emission rate of Iodine-131\n", + "## Converting days into seconds by using 1 day = 86400 seconds\n", + "lambd = 0.693/(T_12*86400); ## Decay constant of Iodine-131\n", + "lambda_b = 0.693/(T_12b*86400.); ## Biological decay constant of Iodine-131\n", + "## Let the quantity chi*v_bar/Q_bar = x\n", + "## Using the plot given in Figure 11.13 for Type E condition at 2000 m\n", + "x = 6.*10**(-5);\n", + "## Solving for chi\n", + "chi = (x*Q_dash)/v_bar;\n", + "## As per the standards of International Commission on Radiolgical Protection (ICRP) \n", + "B = 2.32*10**(-4); ## Normal breathing rate in m^3/sec\n", + "## Calculation\n", + "H_dot = (592.*B*zeta*q*chi)/(M*(lambd+lambda_b));\n", + "## Result\n", + "print'%s %.2e %s'%(\" \\n The equilibrium dose rate to an adult thyroid = \",H_dot,\"sem/sec \\n\");\n", + "\n", + "## 2.\n", + "## Calculation\n", + "H = H_dot*t;\n", + "## Expressing the result in milli-rem\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The annual dose to an adult thyroid = \",H*10**3,\" mrem \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The equilibrium dose rate to an adult thyroid = 6.71e-10 sem/sec \n", + "\n", + " \n", + " The annual dose to an adult thyroid = 21.16 mrem \n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg662" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 11.6\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given datah\n", + "E = 0.66; ## Energy of gamma ray emitted by caesium in MeV\n", + "x = 100.; ## Height of exposure in cm\n", + "## Using the data from Table II.5 for air at E = 0.66 MeV\n", + "mua_rho = 0.0294; ## The ratio of absorption coefficient to density of air in cm^2/g\n", + "## Using the data from Table II.4 for air at E = 0.66 MeV\n", + "mu_rho = 0.0775; ## The ratio of attenuation coefficient to density of air in cm^2/g\n", + "## Using standard value for density of air\n", + "rho = 1.293*10**(-3);\n", + "mu = mu_rho*rho;\n", + "mux = mu*x;\n", + "gamma = 0.57722; ## Euler's constant\n", + "E1 = -gamma+math.log(1./mux)+mux; ## Conversion factor \n", + "## Using parameter data from Table 11.16\n", + "C = 1.41; ## A constant\n", + "beta = 0.0857; ## A constant\n", + "## Calculation\n", + "H_dot_S = 3.39*10**(-2)*E*mua_rho*(E1+(C*math.exp(-(1.-beta)*mux)/(1.-beta)));\n", + "## Converting time in hours by 1 hour = 3600 seconds\n", + "## Result\n", + "print'%s %.2e %s %.2f %s '%(\" \\n The gamma ray dose rate conversion factor due to caesium-137 = \",H_dot_S,\" rem*m^2/sec-Ci\" or \" \",H_dot_S*3600,\"rem*m^2/hour-Ci\\n\");\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The gamma ray dose rate conversion factor due to caesium-137 = 3.66e-03 rem*m^2/sec-Ci 13.18 rem*m^2/hour-Ci\n", + " \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg665" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 11.7\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "C0 = 6.25*10**6; ## Amount of initial radioactivity release due to I-131 in curie\n", + "p = 0.1; ## Leakage rate in percent\n", + "t0 = 2*3600.; ## Analysis time in seconds\n", + "v_bar = 1.; ## Wind speed in m/sec\n", + "\n", + "## 1.\n", + "lambdal = 0.01*p/86400.; ## Decay constant corresponding to leakage rate in seconds (1 day = 86400 seconds)\n", + "## Using the data from Example 11.5 for the half life of Iodine-131\n", + "T_12 = 8.04; ## Half life of Iodine 131 in days\n", + "lambdac = 0.693/(T_12*86400.); ## Decay constant of Iodine-131 (I-131) in seconds\n", + "## Using data from Table 11.3\n", + "Eg_bar = 0.371; ## Average gamma decay energy per disintegration of I-131 in MeV\n", + "## Using the plot given in Figure 11.11 and 11.12 for Type F condition at 100 m\n", + "sigma_y = 21.; ## Horizontal dispersion coefficient\n", + "sigma_z = 70.; ## Vertical dispersion coefficient\n", + "## As lambdac*t << 1, \n", + "## Calculation\n", + "H = (0.262*Eg_bar*lambdal*C0*t0)/(math.pi*v_bar*sigma_y*sigma_z);\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The total external dose due to gamma ray exposure = \",H,\" rem\\n\")\n", + "\n", + "## 2.\n", + "## Using the data given in Example 11.5\n", + "B = 2.32*10**(-4); ## Normal breathing rate in m^3/sec\n", + "zeta = 0.23; ## Fraction of core inventory in MeV \n", + "q = 0.23; ## Fraction of Iodine-131 in thyroid\n", + "M = 20.; ## Mass of an adult thyroid in grams\n", + "## Calculation\n", + "H_dot = (592.*B*zeta*q*lambdal*C0*t0)/(math.pi*v_bar*sigma_y*sigma_z*M);\n", + "## Converting the units from rem/sec to milli-rem/hour by multiplying by (1000*3600)\n", + "## Result\n", + "print'%s %.2e %s %.2f %s '%(\" \\n The dose rate to an adult thyroid after 2 hours = \",H_dot,\" rem/sec\" or\"\",math.ceil(H_dot*(1000*3600)),\" mrem/hour\\n\");\n", + "\n", + "## 3.\n", + "## Using the data given in Example 11.5\n", + "T_12 = 8.04; ## Half life of Iodine 131 in days\n", + "T_12b = 138.; ## Biological half life of Iodine 131 in days\n", + "lambd = 0.693/(T_12*86400.); ## Decay constant of Iodine-131 in sec^(-1)\n", + "lambda_b = 0.693/(T_12b*86400.); ## Biological decay constant of Iodine-131 in sec^(-1)\n", + "## Calculation\n", + "H = H_dot/(lambd+lambda_b);\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The dose commitment to thyroid by Iodine-131 exposure after 2 hours = \",H,\" rem \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The total external dose due to gamma ray exposure = 0.01 rem\n", + "\n", + " \n", + " The dose rate to an adult thyroid after 2 hours = 4.10e-05 rem/sec 148.00 mrem/hour\n", + " \n", + " \n", + " The dose commitment to thyroid by Iodine-131 exposure after 2 hours = 38.81 rem \n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg667" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 11.8\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given\n", + "E = 2.4; ## Energy of gamma rays in MeV\n", + "r = 1000*100; ## Distance from the building where radiation is exposed in cm\n", + "t0 = 2*3600; ## Time of exposure in seconds\n", + "A = 3*10^7; ## Amount of initial radioactivity release due to Kr-88 in curie\n", + "f = 0.4; ## Fraction of disintegrations which release 2.4 MeV gamma rays\n", + "C0 = A*f; ## Effective number of curies \n", + "T_12 = 2.79; ## Half life of Iodine 131 in hours\n", + "\n", + "lambd = 0.693/(T_12*3600.); ## Decay constant of Iodine-131 in sec^(-1)\n", + "## Using the result given in Example 11.7\n", + "lambdal = 1.16*10**(-8); ## Decay constant corresponding to fission prouduct release from building\n", + "lambdac = lambd+lambdal; ## Total decay constant in sec^(-1) \n", + "## Using the data from Table II.4 for air at E = 2.4 MeV\n", + "mu_rho = 0.041; ## The attenuation coefficient in cm^2/g\n", + "## Using standard value for density of air in g/cm^3\n", + "rho = 1.293*10**(-3);\n", + "mu = mu_rho*rho;\n", + "## Using the data from Table II.5 for air at E = 2.4 MeV\n", + "mua_rho = 0.0227; ## The ratio of absorption coefficient to density of air in cm^2/g\n", + "print'%s %.2f %s'%(\" \\n Buildup factor is measured at \",mu*r,\"\");\n", + "## Using Berger's form in Problem 11.9 \n", + "B_p = 4.7; ## Buildup factor due to a point source\n", + "## Calculation\n", + "H = (54.*C0*(1.-math.exp(-lambdac*t0))/lambdac)*(E*mua_rho*B_p*math.exp(-mu*r)/r**2);\n", + "## Result\n", + "print'%s %.2e %s'%(\" \\n The direct dose due to gamma ray exposure = \",H,\" rem \\n\")\n", + "## There is a slight deviation in the answer due to approximation of value in the textbook.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Buildup factor is measured at 5.30 \n", + " \n", + " The direct dose due to gamma ray exposure = 3.91e-07 rem \n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg673" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 11.9\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "gammai = 0.0277; ## Fission yield of Iodine-131 in fraction\n", + "P = 3200.; ## Thermal power of the plant in MW\n", + "## Calculation\n", + "alphai = 8.46*10**5*P*gammai;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The saturation activity of Iodine-131 during reactor operation = \",alphai,\" curie \\n\")\n", + "\n", + "## Using assumption 2 of Nuclear Regulatory Commission (NRC) in calculation of radii of exclusion zone and Low Population Zone (LPZ)\n", + "## Due to core meltdown, 25 percent of iodine inventory is released and out of which 91 percent is in elemental form.\n", + "Fp = 0.25*0.91; ## Fraction of Iodine-131 released from the fuel into the reactor containment\n", + "## As entire iodine escapes through air\n", + "Fb = 1.; ## Fraction of 'Fp' which remains airborne and is capable of escaping from the building\n", + "## Calculation\n", + "C0 = alphai*Fp*Fb;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The activity of Iodine-131 in elemental form due to core meltdown = \",C0,\" curie \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The saturation activity of Iodine-131 during reactor operation = 74989440.00 curie \n", + "\n", + " \n", + " The activity of Iodine-131 in elemental form due to core meltdown = 17060097.60 curie \n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg714" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 11.10\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "P = 1000.; ## Electrical power of the plant in Mwe\n", + "eta = 0.38; ## Plant efficiency\n", + "P_th = P/eta; ## Thermal power of the plant in MW\n", + "h = 100.; ## Height of stack in metre\n", + "t = 24*365.; ## The number of hours in a year\n", + "m0 = 13000.; ## Amount of coal in the plant in Btu/lb\n", + "m0_ash = 0.09; ## Fraction of ash in the coal\n", + "\n", + "## 1.\n", + "E = P_th*t; ## Energy released in a year in MW-hour\n", + "## Converting the units in Btu by using 1 MW-hour = 3.412*10^6 Btu\n", + "m = (E*3.412*10**6)/m0;\n", + "## Converting the units in g/year by using 1 lb/year = 453.59237 g/year\n", + "m = m*453.59237;\n", + "## Assuming the fly ash equipment has an efficiency of 97.5% of fly ash removal\n", + "eta_flyash = 0.025; ## Only (1-efficiency) is exhausted\n", + "m_ash = eta_flyash*m0_ash*m;\n", + "## A typical power plant contains 3pCi/g of each nuclide (Radium-226) in one year\n", + "A = 3*10**(-12);\n", + "## Calculation\n", + "A_total = A*m_ash;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Total activity of Radium-226 emitted = \",A_total,\" curie \\n\")\n", + "\n", + "## 2.\n", + "v_bar = 1.; ## Wind speed in m/sec\n", + "t = 24.*365.*3600.; ## Analysis time of one year equivalently in seconds\n", + "MPC = 3.*10**(-12.); ## Maximum Permissible Concentration in micro-curie/cm^3\n", + "Q_bar = A_total/t; ## Emission rate for one year in curie/year\n", + "## Let the quantity chi*v_bar/Q_bar = x\n", + "## Using the plot for Pasquill F, given in Fig. A.7, Pg no 413 from Slade, D. H., Editor, Meteorology and Atomic Energy-1968. U. S. Atomic Energy Commission Report TID-24190, 1968.\n", + "x = 2.5*10**(-6.); ## Maximum value of x at 10^4 m \n", + "## Solving for chi\n", + "chi = (x*Q_bar)/v_bar;\n", + "## Converting the units from Ci/m^3 to micro-curie/cm^3 by multiplying by 10^6/10^6 = 1\n", + "print'%s %.2e %s'%(\" \\n Concentration of Radium-226 present = \",chi,\" micro-curie/cm^3 \\n\")\n", + "## Let c be the comparison factor\n", + "## Calculation\n", + "c = MPC/chi;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n On comparison, the total concentration of Radium-226 is \",c,\" times smaller than Maximum Permissible Concentration (MPC) \\n\")\n", + "## The comparison factor is slightly different from the value in the textbook. This is because of approximation used in the textbook.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Total activity of Radium-226 emitted = 0.02 curie \n", + "\n", + " \n", + " Concentration of Radium-226 present = 1.47e-15 micro-curie/cm^3 \n", + "\n", + " \n", + " On comparison, the total concentration of Radium-226 is 2042.83 times smaller than Maximum Permissible Concentration (MPC) \n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg718" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 11.11\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "Qy_bar = 1.04*10**(-2); ## Emission rate for one year in curie/year\n", + "## Let (chi/Q_bar) = d which is called 'Dilution factor'\n", + "d = 4*10**(-8); ## Dilution factor in year/cm^3\n", + "vd = 0.01; ## Experimentally determined constant\n", + "\n", + "## 1.\n", + "T_12 = 8.04; ## Half life of Iodine 131 in days\n", + "T_12f = 14; ## First order half life of Iodine 131 in days\n", + "## Converting days into years by using 1 year = 365 days\n", + "lambd = 0.693/(T_12/365.); ## Decay constant of Iodine-131\n", + "lambdaf = 0.693/(T_12f/365.); ## First order decay constant of Iodine-131\n", + "## Calculation\n", + "Cf = (Qy_bar*d*vd)/(lambd+lambdaf);\n", + "## Expressing the result in micro-curie \n", + "Cf = Cf*10**6;\n", + "## Result\n", + "print'%s %.2e %s'%(\" \\n The activity of I-131 on the vegetation = \",Cf,\" micro-curie/m^2 \\n\");\n", + "\n", + "## 2.\n", + "## The proportionality factor has a value 9*10^(-5) Ci/cm^3 of milk per Ci/m^2 of grass\n", + "## Calculation \n", + "Cm = 9*10**(-5)*Cf;\n", + "## Result\n", + "print'%s %.2e %s'%(\" \\n The concentration of I-131 in the milk = \",Cm,\" micro-curie/m^2 \\n\");\n", + "\n", + "## 3.\n", + "MPC = 3*10**(-7); ## Maximum Permissible Concentration in micro-curie/cm^3\n", + "## Calculation\n", + "H_dot = (2270.*Cm)/MPC;\n", + "## Result\n", + "print'%s %.2e %s'%(\" \\n The annual dose rate to an infant thyroid by consuming radiated milk = \",H_dot,\" mrem/year \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The activity of I-131 on the vegetation = 8.40e-08 micro-curie/m^2 \n", + "\n", + " \n", + " The concentration of I-131 in the milk = 7.56e-12 micro-curie/m^2 \n", + "\n", + " \n", + " The annual dose rate to an infant thyroid by consuming radiated milk = 5.72e-02 mrem/year \n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg721" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 11.12\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "Qy_bar = 0.197; ## Emission rate for one year in micro-curie/year\n", + "## Let (chi/Q_bar) = d which is called 'Dilution factor'\n", + "d = 6.29*10**(-16); ## Dilution factor in year/cm^3\n", + "MPC_w = 6*10**(-5); ## Maximum Permissible Concentration (MPC) of iron in micro-curie/cm^3\n", + "\n", + "Cw = Qy_bar*d; ## The concentration of Fe-59 \n", + "## For fish\n", + "Rs_fish = 110.; ## Consumption rate in g/day\n", + "## Using the data from Table 11.15 for saltwater concentration of fish for iron\n", + "CF_fish = 1800.; ## Concentration Factor of fish\n", + "Cs_fish = CF_fish*Cw; ## Activity of fish\n", + "H_dot_fish = (Cs_fish*Rs_fish*500.)/(MPC_w*2200.); ## Dose rate for fish\n", + "\n", + "## For mollusks\n", + "Rs_mollusk = 10.; ## Consumption rate in g/day\n", + "## Using the data from Table 11.15 for saltwater concentration of mollusk for iron\n", + "CF_mollusk = 7600.; ## Concentration Factor of mollusk\n", + "Cs_mollusk = CF_mollusk*Cw; ## Activity of mollusk\n", + "H_dot_mollusk = (Cs_mollusk*Rs_mollusk*500.)/(MPC_w*2200.); ## Dose rate for mollusk\n", + "\n", + "## For crustaceans\n", + "Rs_crustacean = 10.; ## Consumption rate in g/day\n", + "## Using the data from Table 11.15 for saltwater concentration of crustacean for iron\n", + "CF_crustacean = 2000.; ## Concentration Factor of crustacean\n", + "Cs_crustacean = CF_crustacean*Cw; ## Activity of crustacean\n", + "H_dot_crustacean = (Cs_crustacean*Rs_crustacean*500.)/(MPC_w*2200.); ## Dose rate for crustacean\n", + "\n", + "## Calculation\n", + "H_dot = H_dot_fish+H_dot_mollusk+H_dot_crustacean;\n", + "## Result\n", + "print'%s %.2e %s'%(\" \\n The annual dose rate to GI tract by consuming fish = \",H_dot_fish,\" mrem/year\");\n", + "print'%s %.2e %s'%(\" \\n The annual dose rate to GI tract by consuming mollusk = \",H_dot_mollusk,\" mrem/year\");\n", + "print'%s %.2e %s'%(\" \\n The annual dose rate to GI tract by consuming crustaceans = \",H_dot_crustacean,\" mrem/year\");\n", + "print'%s %.2e %s'%(\" \\n The annual dose rate to GI tract by consuming seafood = \",H_dot,\" mrem/year \\n\");\n", + "## The answer for annual dose rate to GI tract by consuming fish is wrong in the textbook. This is because the value of fish consumption rate is wrongly considered.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The annual dose rate to GI tract by consuming fish = 9.29e-08 mrem/year\n", + " \n", + " The annual dose rate to GI tract by consuming mollusk = 3.57e-08 mrem/year\n", + " \n", + " The annual dose rate to GI tract by consuming crustaceans = 9.39e-09 mrem/year\n", + " \n", + " The annual dose rate to GI tract by consuming seafood = 1.38e-07 mrem/year \n", + "\n" + ] + } + ], + "prompt_number": 12 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter2.ipynb b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter2.ipynb new file mode 100644 index 00000000..421dbd88 --- /dev/null +++ b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter2.ipynb @@ -0,0 +1,818 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b88f8253908896ceb538355ebb97029247893ecdea7fc487afd787ce682bc949" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter2-Atomic and Nuclear Physics " + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.1\n", + "import math\n", + "#determine\n", + "## Given data\n", + "atom_h = 6.6*10**24; ## Number of atoms in Hydrogen\n", + "## Using the data given in Table II.2, Appendix II for isotropic abundance of deuterium\n", + "isoab_H2 = 0.015; ## Isotropic abundance of deuterium\n", + "## Calculation\n", + "totatom_d=(isoab_H2*atom_h)/100.;\n", + "## Result\n", + "print\"%s %.2e %s \"%('\\n Number of deuterium atoms = ',totatom_d,'');\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Number of deuterium atoms = 9.90e+20 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.2\n", + "import math\n", + "#determine\n", + "## Given data \n", + "## Using the data given in the example 2.2\n", + "atwt_O16 = 15.99492; ## Atomic weight of O-16 isotope\n", + "isoab_O16 = 99.759; ## Abundance of O-16 isotope\n", + "atwt_O17 = 16.99913; ## Atomic weight of O-17 isotope\n", + "isoab_O17 = 0.037; ## Abundance of O-17 isotope\n", + "atwt_O18 = 17.99916; ## Atomic weight of O-18 isotope\n", + "isoab_O18 = 0.204; ## Abundance of O-18 isotope\n", + "## Calculation\n", + "atwt_O=(isoab_O16*atwt_O16 + isoab_O17*atwt_O17 + isoab_O18*atwt_O18)/100.;\n", + "## Result\n", + "print\"%s %.2f %s \"%('\\n Atomic Weight of Oxygen = ',atwt_O,'');\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Atomic Weight of Oxygen = 16.00 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.3\n", + "import math\n", + "#determine\n", + "## Given data\n", + "me = 9.1095*10**(-28); ## Mass of electron in grams\n", + "c = 2.9979*10**10; ## Speed of light in vacuum in cm/sec\n", + "## Calculation\n", + "rest_mass = me*c**2;\n", + "## Result\n", + "print\"%s %.2e %s \"%('\\n Rest mass energy of electron = ',rest_mass,' ergs\\n');\n", + "print('Expressing the result in joules')\n", + "## 1 Joule = 10^(-7)ergs\n", + "rest_mass_j = rest_mass*10**(-7);\n", + "print\"%s %.2e %s \"%('\\n Rest mass energy of electron = ',rest_mass_j,' joules\\n');\n", + "print('Expressing the result in MeV')\n", + "## 1 MeV = 1.6022*10^(-13)joules\n", + "rest_mass_mev = rest_mass_j/(1.6022*10**(-13));\n", + "print\"%s %.2f %s \"%('\\n Rest mass energy of electron = ',rest_mass_mev,' MeV\\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Rest mass energy of electron = 8.19e-07 ergs\n", + " \n", + "Expressing the result in joules\n", + "\n", + " Rest mass energy of electron = 8.19e-14 joules\n", + " \n", + "Expressing the result in MeV\n", + "\n", + " Rest mass energy of electron = 0.51 MeV\n", + " \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.4\n", + "\n", + "import math\n", + "#Calculate the \n", + "## From the result of Example 2.3\n", + "## Rest mass energy of electron = 0.5110 MeV\n", + "rest_mass_mev = 0.5110;\n", + "me = 9.1095*10**(-28); ## Mass of electron in grams\n", + "## From standard data table\n", + "## 1 amu = 1.6606*10^(-24)g\n", + "amu = 1.6606*10**(-24);\n", + "## Calculation\n", + "en_eq = (amu/me)*rest_mass_mev;\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Energy equivalent of one amu = ',en_eq,' MeV\\n');\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Energy equivalent of one amu = 931.52 MeV\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.5\n", + "\n", + "import math\n", + "#Calculate the \n", + "## From the standard data table\n", + "h = 6.626*10**(-34); ## Planck's constant in J-s\n", + "c = 3*10**8; ## Speed of light in vacuum in m/sec\n", + "## Given data \n", + "print('The ionization energy of K shell electron in Lead atom is 88keV');\n", + "E = 88*10**3; ## Ionization energy in keV\n", + "## Expressing the result in joules by using 1 eV = 1.6022*10^(-19) J\n", + "E = E*1.6022*10**(-19);\n", + "print(\"From Planck\\''s law of photoelectric effect \\n Energy = (h*c)/lambda\\n\");\n", + "## Calculation \n", + "lambd = (h*c)/E; \n", + "## Result\n", + "print'%s %.3e %s'%('\\n Wavelength of radiation = ',lambd,' m\\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The ionization energy of K shell electron in Lead atom is 88keV\n", + "From Planck''s law of photoelectric effect \n", + " Energy = (h*c)/lambda\n", + "\n", + "\n", + " Wavelength of radiation = 1.410e-11 m\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.6\n", + "import math\n", + "#Calculate the \n", + "## Given data\n", + "T12 = 64.8; ## Half life = 64.8 hour\n", + "lambd = 0.693/T12; ## Decay constant in hour^(-1)\n", + "t = 12.; ## Analysis time of gold sample in hours\n", + "alpha = 0.9; ## Activity of gold sample after analysis time\n", + "\n", + "## 1. \n", + "## Calculation\n", + "R = alpha/(1-math.exp(-lambd*t));\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Theoretical maximum activity = ',R,' curie (Ci) \\n');\n", + "\n", + "## 2. \n", + "## Calculation\n", + "## The expression to calculate 80 percent of maximum activity is \\n 0.8R = R*(1-exp(-lambda*t)) \n", + "t = -math.log(0.2)/lambd;\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Time to reach 80 percent of maximum activity = ',t,' hours \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Theoretical maximum activity = 7.47 curie (Ci) \n", + "\n", + "\n", + " Time to reach 80 percent of maximum activity = 150.49 hours \n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.7\n", + "import math\n", + "#Calculate the \n", + "print('The reactants are Nitrogen and neutron')\n", + "## The total atomic number of reactants \n", + "Z_reactant = 7.+0.;\n", + "## The total atomic mass number of reactants\n", + "A_reactant = 14.+1.;\n", + "print('One of the known product is Hydrogen')\n", + "Z_H = 1.; ## The atomic number of Hydrogen\n", + "A_H = 1.; ## The atomic mass number of Hydrogen \n", + "## The atomic number of unknown element\n", + "Z_unknown = Z_reactant-Z_H;\n", + "## The atomic mass number of unknown element \n", + "A_unknown = A_reactant-A_H;\n", + "## Result\n", + "print'%s %.2f %s %.2f %s '%(\" \\n For unknown element the atomic number is \",Z_unknown,\" and atomic mass number is \",A_unknown,\" \\n\");\n", + "## From periodic table \n", + "print('The element corresponds to Carbon-14');\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The reactants are Nitrogen and neutron\n", + "One of the known product is Hydrogen\n", + " \n", + " For unknown element the atomic number is 6.00 and atomic mass number is 14.00 \n", + " \n", + "The element corresponds to Carbon-14\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.8\n", + "import math\n", + "#Calculate the \n", + "print('The reaction is Tritium(d,n)Helium-4');\n", + "## Using standard data table of mass in amu\n", + "M_H3 = 3.016049; ## Atomic mass of Tritium\n", + "M_He4 = 4.002604; ## Atomic mass of Helium\n", + "M_d = 2.014102; ## Atomic mass of Deuterium\n", + "M_n = 1.008665; ## Atomic mass of neutron\n", + "## Calculation of total mass of reactants\n", + "tot_reac = M_H3+M_d;\n", + "## Calculation of total mass of products\n", + "tot_prod = M_He4+M_n;\n", + "## Calculation \n", + "Q = tot_reac-tot_prod;\n", + "## Expressing in MeV by using 1 amu = 931.5 MeV\n", + "Q_mev = Q*931.5;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Q value for the reaction = \",Q_mev,\" MeV\");\n", + "if Q_mev > 0:\n", + " print(\"\\n The reaction is exothermic. \\n\");\n", + "else:\n", + " print(\"\\n The reaction is endothermic. \\n\");\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The reaction is Tritium(d,n)Helium-4\n", + " \n", + " Q value for the reaction = 17.59 MeV\n", + "\n", + " The reaction is exothermic. \n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.9\n", + "import math\n", + "#Calculate the \n", + "## Using standard data table of mass in amu\n", + "M_C12 = 12.; ## Atomic mass of Carbon-12\n", + "M_n = 1.00866; ## Atomic mass of neutron\n", + "M_C13 = 13.00335; ## Atomic mass of Carbon-13\n", + "##If one neutron is removed from carbon-13, carbon-12 is obtained\n", + "tot = M_C12+M_n;\n", + "dm = tot-M_C13; ## Mass defect\n", + "## Converting to energy equivalent from mass by using 1 amu = 931.5 MeV\n", + "Es = dm*931.5;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The binding Energy of the last neutron in Carbon-13 atom = \",Es,\" MeV\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The binding Energy of the last neutron in Carbon-13 atom = 4.95 MeV\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.10\n", + "import math\n", + "#calculate the\n", + "\n", + "## Using standard data table of mass and the coefficients of mass equation for Silver-107\n", + "N = 60.; ## Number of neutrons\n", + "Z = 47.; ## Atomic number\n", + "A = 107.; ## Atomic mass number\n", + "## The coefficients used in mass equation are \n", + "alpha = 15.56;\n", + "bet = 17.23;\n", + "gam = 0.697;\n", + "zeta = 23.285;\n", + "mn = 939.573; ## Mass of neutron in terms of energy\n", + "mH = 938.791; ## Mass of proton in terms of energy\n", + "## Calculation \n", + "print('Using mass equation');\n", + "M = (N*mn)+(Z*mH)-(alpha*A)+(bet*(A**(2/3.)))+(gam*Z**2/A**(1/3.))+(zeta*(A-2*Z)**2/A);\n", + "## Expressing in amu by using 1 amu = 931.5 MeV\n", + "M_amu = M/931.5;\n", + "print'%s %.2f %s %.2f %s '%(\" Mass = \",M,\" MeV\" and \" = \",M_amu,\"f u\" );\n", + "print('Actual mass = 106.905092 u');\n", + "## Calculation \n", + "BE = (alpha*A)-(bet*(A**(2/3.)))-(gam*Z**2/A**(1/3.))-((zeta*(A-(2.*Z))**2)/A);\n", + "## Result\n", + "print'%s %.2f %s %.2f %s '%(\"\\n Binding Energy = \",BE,\" MeV\" or\"\" ,BE/107,\"MeV/nucleon \\n\");\n", + "## The value is different from the answer given in the textbook. The textbook answer is wrong.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Using mass equation\n", + " Mass = 99582.07 = 106.91 f u \n", + "Actual mass = 106.905092 u\n", + "\n", + " Binding Energy = 915.49 MeV 8.56 MeV/nucleon \n", + " \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.11\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "T_C = 38.; ## Given temeperature in celsius\n", + "##The temperature in Kelvin \n", + "T_K = T_C+273.15;\n", + "T_0 = 293.61; ## The temperature in kelvin equivalent to 0 deg celsius\n", + "kT = 0.0253; ## The term 'kT' in eV at temperature T0\n", + "## Calculation\n", + "Ep = 0.5*kT*(T_K/T_0);\n", + "Ebar = 3*Ep;\n", + "## Result\n", + "print'%s %.2f %s'%(\" Most probable energy of air molecules = \",Ep,\" eV \\n\");\n", + "print'%s %.2f %s'%(\" Average energy of air molecules = \",Ebar,\" eV \\n\");\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Most probable energy of air molecules = 0.01 eV \n", + "\n", + " Average energy of air molecules = 0.04 eV \n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.12\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "rho = 0.97; ## Density of Sodium in gram/cm^3\n", + "## From standard data table\n", + "NA = 0.6022*10**24; ## Avagodro number\n", + "M = 22.99; ## Atomic weight of Sodium\n", + "## Calculation\n", + "N = rho*NA/M;\n", + "## Result\n", + "print'%s %.2e %s'%(\"Atom density of sodium = \",N,\" atoms/cm^3 \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Atom density of sodium = 2.54e+22 atoms/cm^3 \n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.13\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "rho_NaCl = 2.17; ## Density of Sodium Chloride(NaCl) in gram/cm^3\n", + "## From standard data table\n", + "NA = 0.6022*10**24; ## Avogodro number\n", + "M_Na = 22.99; ## Atomic weight of Sodium(Na)\n", + "M_Cl = 35.453; ## Atomic weight of Chlorine(Cl)\n", + "M_NaCl = M_Na+M_Cl; ## Molecular weight of Sodium Chloride(NaCl)\n", + "## Calculation\n", + "N = rho_NaCl*NA/M_NaCl;\n", + "## As in NaCl, there is one atom of Na and Cl\n", + "N_Na = N;\n", + "N_Cl = N;\n", + "## Result\n", + "print'%s %.4e %s'%(\" Atom density of Sodium and Chlorine = \",N,\" molecules/cm^3 \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Atom density of Sodium and Chlorine = 2.2360e+22 molecules/cm^3 \n", + "\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex14-pg42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.14\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "rho = 1.; ## Density of water in gram/cm^3\n", + "\n", + "## 1.\n", + "M_H = 1.00797; ## Atomic weight of Hydrogen(H)\n", + "M_O = 15.9994; ## Atomic weight of Oxygen(O)\n", + "## As in water, there is two atoms of Hydrogen(H) and one atom of Oxygen(O)\n", + "M = (2*M_H)+M_O; ## Molecular weight of water\n", + "## From standard data table\n", + "NA = 0.6022*10**24; ## Avagodro number\n", + "## Calculation \n", + "N = rho*NA/M;\n", + "## Result\n", + "print'%s %.4e %s'%(\"Atom density of water = \",N,\" molecules/cm^3 \\n\");\n", + "\n", + "## 2.\n", + "## As in water, there is two atoms of Hydrogen(H) and one atom of Oxygen(O)\n", + "N_H = 2*N; ## Atom density of Hydrogen\n", + "N_O = N; ## Atom density of Oxygen\n", + "## Result\n", + "print'%s %.4e %s'%(\"Atom density of Hydrogen(H) = \",N_H,\" atoms/cm^3 \\n\");\n", + "print'%s %.4E %s'%(\"Atom density of Oxygen(O)= \",N_O,\" atoms/cm^3 \\n\");\n", + "\n", + "## 3.\n", + "## Using the data given in Table II.2, Appendix II for isotropic abundance of deuterium\n", + "isoab_H2 = 0.015;\n", + "## Calculation\n", + "N_H2 = isoab_H2*N_H/100.;\n", + "## Result\n", + "print'%s %.4E %s'%(\"Atom density of Deuterium(H-2)= \",N_H2,\" atoms/cm^3 \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Atom density of water = 3.3427e+22 molecules/cm^3 \n", + "\n", + "Atom density of Hydrogen(H) = 6.6854e+22 atoms/cm^3 \n", + "\n", + "Atom density of Oxygen(O)= 3.3427E+22 atoms/cm^3 \n", + "\n", + "Atom density of Deuterium(H-2)= 1.0028E+19 atoms/cm^3 \n", + "\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex15-pg43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.15\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data \n", + "rho = 19.1; ## Density of Uranium-235 in gram/cm^3\n", + "wt = 1500.; ## Weight of uranium rods in a reactor in kg\n", + "nr = 0.2; ## Enrichment(w/o) of Uranium-235\n", + "\n", + "## 1.\n", + "## As Enrichment is 20(w/o)\n", + "wt_U235 = nr*wt; ## Amount of Uranium-235\n", + "## Result\n", + "print'%s %.2f %s'%(\"Amount of Uranium-235 in the reactor = \",wt_U235,\" kg \\n\");\n", + "\n", + "## 2.\n", + "## From standard data table\n", + "NA = 0.6022*10**24; ## Avagodro number\n", + "M_U235 = 235.0439; ## Atomic weight of Uranium-235\n", + "M_U238 = 238.0508; ## Atomic weight of Uranium-238\n", + "## Calculation\n", + "N_U235 = nr*rho*NA/M_U235; ## Atom density of Uranium-235\n", + "N_U238 = (1.-nr)*rho*NA/M_U238; ## Atom density of Uranium-238\n", + "## Result\n", + "print'%s %.4e %s'%(\"Atom density of Uranium-235 = \",N_U235,\" atoms/cm^3 \\n\");\n", + "print'%s %.4e %s'%(\"Atom density of Uranium-238 = \",N_U238,\" atoms/cm^3 \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Amount of Uranium-235 in the reactor = 300.00 kg \n", + "\n", + "Atom density of Uranium-235 = 9.7871e+21 atoms/cm^3 \n", + "\n", + "Atom density of Uranium-238 = 3.8654e+22 atoms/cm^3 \n", + "\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex16-pg43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 2.16\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "rho_UO2 = 10.5; ## Density of UO2 pellets in gram/cm^3\n", + "nr = 0.3; ## Enrichment(w/o) of Uranium-235\n", + "## From standard data table\n", + "M_U235 = 235.0439; ## Atomic weight of Uranium-235\n", + "M_U238 = 238.0508; ## Atomic weight of Uranium-238\n", + "M_O = 15.999; ## Atomic weight of Oxygen\n", + "NA = 0.6022*10**24; ## Avogodro number\n", + "\n", + "M = 1./((nr/M_U235)+((1.-nr)/M_U238));\n", + "M_UO2 = M+(2.*M_O); ## Molecular weight of UO2\n", + "nr_U = M/M_UO2*100.; ## The percent(w/o) of Uranium in UO2 pellet\n", + "rho_U = nr_U*rho_UO2/100. ## Density of Uranium in g/cm^3\n", + "rho_U235 = nr*rho_U ## Density of Uranium-235 in g/cm^3\n", + "## Calculation\n", + "N_U235=rho_U235*NA/M_U235;\n", + "## Result\n", + "print'%s %.4e %s'%(\"Atom density of Uranium-235 = \",N_U235,\" atoms/cm^3 \\n\");\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Atom density of Uranium-235 = 7.1110e+21 atoms/cm^3 \n", + "\n" + ] + } + ], + "prompt_number": 16 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter3.ipynb b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter3.ipynb new file mode 100644 index 00000000..ee6e14f0 --- /dev/null +++ b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter3.ipynb @@ -0,0 +1,813 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a83d41ee1bf2b5cb710f5a4f59fa473688e3a1ab539cb5806ccaff2f0723ab5b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter3-Interaction of Radiation with Matter " + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.1\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigma = 2.6*10**(-24); ## Cross section of carbon-12 in cm^2\n", + "I = 5*10**8; ## Intensity of neutron beam in neutrons/cm^2-sec\n", + "A = 0.1; ## Cross sectional area of the beam in cm^2;\n", + "X = 0.05; ## Thickness of the target in cm\n", + "\n", + "## 1.\n", + "## Using the data given in Table I.3, Appendix II for carbon-12\n", + "N = 0.08*10**(24); ## Atom density in atoms/cm^3\n", + "## Calculation \n", + "IR = sigma*I*N*A*X;\n", + "## Result\n", + "print'%s %.2e %s'%('\\n Total interaction rate = ',IR,' interactions/sec \\n');\n", + "\n", + "## 2. \n", + "no = I*A; ## Neutron rate in neutrons/sec\n", + "## Calculation \n", + "p = IR/no;\n", + "print'%s %.2e %s'%('\\n Probability of collision = ',p,' \\n');\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Total interaction rate = 5.20e+05 interactions/sec \n", + "\n", + "\n", + " Probability of collision = 1.04e-02 \n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.2\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "sigmaf = 582.; ## Fission cross section of U-235 on bombardment of neutron in barn\n", + "sigmay = 99.; ## Radiative capture cross section of U-235 on bombardment of neutron in barn\n", + "## Calculation\n", + "pf = sigmaf/(sigmaf+sigmay);\n", + "## Result\n", + "print'%s %.2f %s %.2f %s '%('\\ n Probability of fission = ',pf,''and ' = ',pf*100,' percent\\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\\ n Probability of fission = 0.85 85.46 percent\n", + " \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.3\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "## Using the data given in the example 3.1\n", + "N = 0.08*10**(24.); ## Atom density of Carbon-12 in atoms/cm^3\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigma = 2.6*10**(-24); ## Cross section of carbon-12 in cm^2\n", + "I = 5*10**8; ## Intensity of neutron beam in neutrons/cm^2-sec\n", + "\n", + "## 1.\n", + "## Calculation \n", + "SIGMAt = N*sigma;\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Macroscopic cross section of carbon-12 = ',SIGMAt,' cm^(-1)\\n');\n", + "\n", + "##2. \n", + "## Calculation \n", + "F= I*SIGMAt;\n", + "## Result\n", + "print'%s %.2e %s'%('\\n Collision density in the carbon-12 target = ',F,' collisions/cm^(3)-sec\\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Macroscopic cross section of carbon-12 = 0.21 cm^(-1)\n", + "\n", + "\n", + " Collision density in the carbon-12 target = 1.04e+08 collisions/cm^(3)-sec\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.4\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "E = 100.; ## Neutron energy in keV\n", + "## Using the data given in Table II.3, for E = 100 keV\n", + "atom_density = 0.0254*10**(24); ## Atom density of sodium in atoms/cm^3\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigma = 3.4*10**(-24); ## Microscopic cross section of sodium in cm^2\n", + "## Calculation\n", + "SIGMA = atom_density*sigma;\n", + "lambd = 1./SIGMA;\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Macroscopic cross section = ',SIGMA,' cm^(-1)\\n');\n", + "print'%s %.2f %s'%('\\n Mean Free Path = ',lambd,' cm\\n',);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Macroscopic cross section = 0.09 cm^(-1)\n", + "\n", + "\n", + " Mean Free Path = 11.58 cm\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.5\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "atom_density_U235 = 3.48*10**(-4)*10**(24); ## Atom density of Uranium-235 in atoms/cm^3\n", + "atom_density_U238 = 0.0483*10**(24); ## Atom density of Uranium-238 in atoms/cm^3\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigmaa_U235 = 680.8*10**(-24); ## Absorption cross section of Uranium-235 incm^2\n", + "sigmaa_U238 = 2.7*10**(-24); ## Absorption cross section of Uranium-238 incm^2\n", + "## Calculation\n", + "SIGMAA=(atom_density_U235*sigmaa_U235)+(atom_density_U238*sigmaa_U238);\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Macroscopic absorption cross section = ',SIGMAA,' cm^(-1)\\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Macroscopic absorption cross section = 0.37 cm^(-1)\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.6\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "sigmas_H_1 = 3; ## Scattering cross section of Hydrogen in barn at 1 MeV\n", + "sigmas_O_1 = 8; ## Scattering cross section of Oxygen in barn at 1 MeV\n", + "sigmas_H_th = 21; ## Scattering cross section of Hydrogen in barn at 0.0253 eV \n", + "sigmas_O_th = 4; ## Scattering cross section of Oxygen in barn at 0.0253 eV\n", + "## Calculation\n", + "sigmas_H20_1 = (2*sigmas_H_1)+(1*sigmas_O_1);\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Scattering cross section of Water at 1 MeV = ',sigmas_H20_1,' b \\n');\n", + "## The equation used to calculate the scattering cross section at 1 MeV cannot be used at thermal energy. \n", + "print'%s %.2f %s'%(' Experimental value of scattering cross section of Water at 0.0253 eV = ',103,' b \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Scattering cross section of Water at 1 MeV = 14.00 b \n", + "\n", + " Experimental value of scattering cross section of Water at 0.0253 eV = 103.00 b \n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.7\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "phi = 1*10**(13); ## Neutron flux in neutrons/cm^3\n", + "v = 64000.; ## Volume of research reactor in cm^3\n", + "sigmaf = 0.1; ## Macroscopic fission cross section in cm^(-1)\n", + "## The energy released per fission reaction is 200 MeV\n", + "## 1 MeV = 1.6*10^(-13) joule\n", + "E = 200*1.6*10**(-13);\n", + "## Calculation \n", + "fiss_rate = sigmaf*phi; ## Fission rate in neutrons/cm^2-sec\n", + "power_cc = E*fiss_rate/10**6; ## Reactor power/cc\n", + "power = power_cc*v;\n", + "print'%s %.2f %s'%('\\n Reactor power of a research reactor = ',power,' MW\\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Reactor power of a research reactor = 2.05 MW\n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.8\n", + "import math\n", + "#calculate the\n", + "\n", + "## 1 barn = 10^(-24) cm^2\n", + "## From the Figure 3.4 given in the textbook\n", + "sigmae = 4.8*10**(-24); ## Experimental cross section of carbon from 0.02eV to 0.01MeV\n", + "## Assuming spherical shape and elstic scattering\n", + "R = math.sqrt(sigmae/(4.*math.pi));\n", + "## Result\n", + "print'%s %.2e %s'%('\\n Radius of carbon nucleus = ',R,' cm\\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Radius of carbon nucleus = 6.18e-13 cm\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.9\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data \n", + "E0 = 0.0253; ## Thermal energy in eV\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigmay_E0 = 0.332*10**(-24); ## Radiative capture cross section at 0.0253 eV in cm^2\n", + "E = 1.; ## Energy in eV at which radiative cross section is to be found\n", + "## Calculation \n", + "sigmay_E = sigmay_E0*math.sqrt(E0/E);\n", + "## Result\n", + "## Expressing the result in barn\n", + "print'%s %.2e %s'%('\\n Radiative capture cross section of hydrogen at 1 eV = ',sigmay_E*10*24,' b\\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Radiative capture cross section of hydrogen at 1 eV = 1.27e-23 b\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.10\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "E = 1.; ## Energy of neutron in MeV\n", + "A = 2.; ## Atomic mass number of deuterium\n", + "v = 45.; ## Scattering angle in degree\n", + "\n", + "## 1.\n", + "## Calculation \n", + "E_dash = E/(A+1.)**2 *((math.cos (v/57.3)+math.sqrt(A**2-(math.sin(v/57.3))**2))**2);\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Energy of scattered neutron = ',E_dash,' MeV \\n');\n", + "\n", + "## 2.\n", + "## Calculation \n", + "E_A = E-E_dash;\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Energy of recoil nucleus = ',E_A,' MeV \\n');\n", + "\n", + "## 3.\n", + "## Calculation \n", + "deltau = math.log(E/E_dash);\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Change in lethargy of neutron on collision = ',deltau,' \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Energy of scattered neutron = 0.74 MeV \n", + "\n", + "\n", + " Energy of recoil nucleus = 0.26 MeV \n", + "\n", + "\n", + " Change in lethargy of neutron on collision = 0.30 \n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg74" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.11\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "phi = 5*10**(12); ## Neutron flux in neutrons/cm^2-sec\n", + "T = 600.; ## Temperature of neutron in degree\n", + "## Using the data given in Table II.3, Appendix II for indium\n", + "N = 0.0383*10**(24); ## Atom density in atoms/cm^3\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigmaa_E0 = 194.*10**(-24); ## Microscopic absorption cross section in cm^2\n", + "SIGMA_E0 = N*sigmaa_E0; ## Macroscopic absorption cross section in cm^(-1)\n", + "## From Table 3.2 \n", + "ga_600 = 1.15; ## Non 1/v factor at 600 degree celsius\n", + "## Calculation \n", + "F_a = ga_600*SIGMA_E0*phi;\n", + "## Result\n", + "print'%s %.2e %s'%('\\n Absorption rate of neutrons per cc in indium foil = ',F_a,' neutrons/cm^3-sec \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Absorption rate of neutrons per cc in indium foil = 4.27e+13 neutrons/cm^3-sec \n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.12\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "N = 120.; ## Number of fuel rods\n", + "P = 100.; ## Reactor power in MW\n", + "t = 1.; ## Estimation time of fuel rod after removal in days\n", + "T = 365.; ## Time of reactor operation\n", + "## Estimation\n", + "Activity_total = 1.4*10**6*P*(t**(-0.2)-(t+T)**(-0.2));\n", + "Activity_one = Activity_total/N; ## For one fuel rod\n", + "## Result\n", + "print'%s %.2f %s'%('\\n The activity of a fuel rod = ',Activity_one,' Ci \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The activity of a fuel rod = 808363.56 Ci \n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg86" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.13\n", + "import math\n", + "#calculate the\n", + "\n", + "## Using the data given in Table 3.4 and Table II.2 for uranium\n", + "v_235 = 2.418; ## Average number of neutrons released per fission\n", + "y_235 = 0.72; ## Isotropic abundance of Uranium-235 on the earth\n", + "sigmaf_235 = 582.2; ## Fission cross section of Uranium-235\n", + "sigmaa_235 = 680.8; ## Absorption cross section of Uranium-235\n", + "N_235 = y_235;\n", + "y_238 = 99.26; ## Isotropic abundance of Uranium-238 on the earth\n", + "sigmaa_238 = 2.7; ## Absorption cross section of Uranium-238\n", + "## Calculation\n", + "n = (v_235*y_235*sigmaf_235)/((y_235*sigmaa_235)+(y_238*sigmaa_238));\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Eta for natural uranium = ',n,' \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Eta for natural uranium = 1.34 \n", + "\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex14-pg90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.14\n", + "import math\n", + "#calculate the\n", + "\n", + "## Fission of 1 g of Uranium-235 releases approximately 1 MW/day of energy. \n", + "## 1 MW/day = 8.64*10^(10) J\n", + "energy_uranium = 8.64*10**10;\n", + "\n", + "## 1. Coal\n", + "h_coal = 3*10**7; ## Heat contenet of coal in J/kg\n", + "## Calculation\n", + "amt_coal = energy_uranium/h_coal;\n", + "## Result\n", + "print'%s %.2f %s %.2f %s %.2f %s '%('\\n Amount of coal required for energy equivalent of fission = ',amt_coal,' kg ' and '\\n ',amt_coal/10**3,'metric tons' and '',amt_coal*1.10231/10**3,'short tons\\n');\n", + "## The result is expressed in all units of commercial importance.\n", + "\n", + "## 2. Oil\n", + "h_oil = 4.3*10**7; ## Heat contenet of oil in J/kg\n", + "## Calculation\n", + "amt_oil = energy_uranium/h_oil;\n", + "## Result\n", + "print'%s %.2f %s %.2f %s %.2f %s '%('\\n Amount of oil required for energy equivalent of fission = ',amt_oil,' kg\\n' or'',amt_oil/10**3,' tons' or '',amt_oil*6.3/10**3,'barrels\\n');\n", + "## The result is expressed in all units of commercial importance.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Amount of coal required for energy equivalent of fission = 2880.00 \n", + " 2.88 3.17 short tons\n", + " \n", + "\n", + " Amount of oil required for energy equivalent of fission = 2009.30 kg\n", + " 2.01 tons 12.66 barrels\n", + " \n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex15-pg99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.15\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "rho = 10.; ## Density of UO2 in g/cm^3\n", + "mol_wt_UO2 = 238.+(16.*2.); ## Molecular weight of UO2\n", + "per_U = (238./mol_wt_UO2)*100.; ## Percent by weight of Uranium\n", + "per_O = 100.-per_U; ## Percent by weight of Oxygen\n", + "\n", + "## Calculation \n", + "##Using the data given in Table II.4 for uranium and oxygen\n", + "mup_U = 0.0757; ## Ratio of mass attenuation coefficient to density of uranium in cm^2/g\n", + "mup_O = 0.0636; ## Ratio of mass attenuation coefficient to density of oxygen in cm^2/g\n", + "mup = (per_U/100.*mup_U)+(per_O/100.*mup_O); ## The total ratio of mass attenuation coefficient in cm^2/g\n", + "mu = mup*rho;\n", + "## Calculation \n", + "lambd = 1/mu;\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Mass attenuation coefficient of Uranium dioxide (UO2) = ',mu,' cm^(-1) \\n');\n", + "print'%s %.2f %s'%('\\n Mean free path = ',lambd,' cm \\n');\n", + "## The answer is marked wrongly in the textbook. But the solution is correctly evaluated.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Mass attenuation coefficient of Uranium dioxide (UO2) = 0.74 cm^(-1) \n", + "\n", + "\n", + " Mean free path = 1.35 cm \n", + "\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex16-pg100" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.16\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "E = 0.8; ## Average gamma ray energy in MeV\n", + "I = 3*10**(11); ## Intensity of gamma rays incident on the container in gamma rays/cm^2-sec\n", + "## Using the data given in Table II.5 for iron at 0.8 MeV\n", + "mup_iron = 0.0274; ## Ratio of mass attenuation coefficient to density of iron in cm^2/g\n", + "## Calculation \n", + "dep_rate = E*I*mup_iron;\n", + "## Expressing the result in SI units\n", + "## 1 MeV = 1.6*10^(-13) J\n", + "## 1 kg = 1000 g\n", + "dep_rate_SI = dep_rate*(1.6*10**(-13)*1000.);\n", + "print'%s %.2e %s %.2f %s '%('\\n Rate of energy deposited = ',dep_rate,' MeV/g-sec' and '',dep_rate_SI,' J/kg-sec \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Rate of energy deposited = 6.58e+09 1.05 J/kg-sec \n", + " \n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex17-pg106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 3.17\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data \n", + "E_max = 1.39; ## Maximum energy of beta rays in MeV\n", + "## Calculation \n", + "R_max = 0.412*E_max**(1.265-(0.0954*math.log(E_max)));\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Maximum distance of beta rays traversed = ',R_max,' cm \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Maximum distance of beta rays traversed = 0.62 cm \n", + "\n" + ] + } + ], + "prompt_number": 18 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter4.ipynb b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter4.ipynb new file mode 100644 index 00000000..8212531f --- /dev/null +++ b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter4.ipynb @@ -0,0 +1,362 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:880d5b96d7a6ce9a20a4fd5f1bbd8bee89ba44d4461c16f4ef09e18728323ef7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter4-Nuclear Reactors and Nuclear Power" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 4.1\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "## Number of neutrons absorbed by Uranium-238 in resonances for every neutron absorbed in Uranium-235\n", + "n_resonance = 0.254;\n", + "## Number of neutrons absorbed by Uranium-238 at thermal energy for every neutron absorbed in Uranium-235\n", + "n_th = 0.64;\n", + "m = 1; ## Amount of Uranium-235 consumed in kg\n", + "A_U = 235; ## Atomic mass number of Uranium-235\n", + "A_Pu = 239; ## Atomic mass number of Plutonium-239\n", + "\n", + "## 1.\n", + "## Calculation \n", + "C = n_resonance+n_th;\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Conversion ratio of the reactor = ',C,' \\n');\n", + "\n", + "## 2. \n", + "## Calculation \n", + "amt_Pu = m*C*A_Pu/A_U;\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Amount of Plutonium-239 produced in the reactor = ',amt_Pu,' kg \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Conversion ratio of the reactor = 0.89 \n", + "\n", + "\n", + " Amount of Plutonium-239 produced in the reactor = 0.91 kg \n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg127" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 4.2\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "wP0 = 1.; ## Total fuel consumption rate in terms of kg/day\n", + "M = 500.; ## Amount of Plutonium-239 in kg at startup of the reactor\n", + "breeding_gain = 0.15; ## Breeding gain of the reactor\n", + "\n", + "## 1.\n", + "print'%s %.2f %s'%(\" The Fast breeder reactor produces \",breeding_gain,\"kg of plutonium-239 more for every kilogram consumed \\n\");\n", + "## Calculation\n", + "## 1 year = 365 days\n", + "production_rate = math.ceil(breeding_gain*365);\n", + "## Result\n", + "print'%s %.2f %s %.2f %s '%(\"\\n Production rate of plutonium-239 = \",breeding_gain,\" kg/day\"and \" = \",production_rate,\" kg/year\");\n", + "\n", + "## 2.\n", + "## Calculation \n", + "t_Dl = M/production_rate;\n", + "t_De = math.log(2)*t_Dl;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Linear doubling time of plutonium fuel in the reactor = \",t_Dl,\" years \\n\");\n", + "print'%s %.2f %s'%(\" \\n Exponential doubling time of plutonium fuel in the reactor = \",t_De,\" years \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Fast breeder reactor produces 0.15 kg of plutonium-239 more for every kilogram consumed \n", + "\n", + "\n", + " Production rate of plutonium-239 = 0.15 = 55.00 kg/year \n", + " \n", + " Linear doubling time of plutonium fuel in the reactor = 9.09 years \n", + "\n", + " \n", + " Exponential doubling time of plutonium fuel in the reactor = 6.30 years \n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 4.3\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "power = 3300.; ## Reactor power in MW\n", + "time = 750.; ## Reactor operation time in days\n", + "amt_UO2 = 98.; ## Amount of Uranium dioxide (UO2) in metric tons\n", + "atwt_U = 238.; ## As the enrichment of Uranium-235 is 3 w/o the majority portion is Uranium-238\n", + "molwt_O = 16.; ## Molecular weight of Oxygen\n", + "\n", + "\n", + "## 1.\n", + "amt_U = amt_UO2*atwt_U/(atwt_U+2*molwt_O); ## Amount of uranium in tonne\n", + "total_burnup = power*time; ## Total burnup in MWd\n", + "## Calculation \n", + "specific_burnup = total_burnup/amt_U;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Specific burnup = \",specific_burnup,\" MWd/tonne \\n\");\n", + "\n", + "## 2.\n", + "## Due to fission of 1.05 g of Uranium-235, 1 MWd of energy is released.\n", + "m = 1.05;\n", + "P = 10**6;\n", + "maxth_burnup = P/m; ## Theoritical maximum burnup \n", + "## Calculation of Fractional burnup\n", + "bet = specific_burnup/maxth_burnup;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Fractional burnup = \",bet*100,\" percent \\n\");\n", + "## Due to approximation of specific burnup value, there is a slight change in fractional burnup value as compared to the textbook value.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Specific burnup = 28650.75 MWd/tonne \n", + "\n", + " \n", + " Fractional burnup = 3.01 percent \n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 4.4\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "ratpower = 1075.; ## Output rated electrical power in MWe of the reactor\n", + "delpower_yr = 255000.; ## Net output power delivered in one year in terms of MWd\n", + "time_refuel = 28.; ## Number of days the plant was shutdown for refuelling\n", + "time_repairs = 45.; ## Number of days the plant was shutdown for repairs\n", + "time_convrepairs = 18.; ## Number of days the plant was shutdown for conventional repairs\n", + "\n", + "## 1.\n", + "## 1 year = 365 days\n", + "ratpower_yr = ratpower*365.; ## Net output rated power in one year in terms of MWd\n", + "## Calculation\n", + "cap_factor = delpower_yr/ratpower_yr;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Plant capacity factor = \",math.ceil(cap_factor*100),\" percent\\n\");\n", + "\n", + "## 2.\n", + "## Number of days the plant was shutdown in one year \n", + "total_shutdown = time_refuel+time_repairs+time_convrepairs;\n", + "## Number of days the plant was operable in one year\n", + "total_operation = 365.-total_shutdown;\n", + "## Calculation\n", + "ava_factor = total_operation/365.;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Plant availability factor = \",ava_factor*100,\" percent\\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Plant capacity factor = 65.00 percent\n", + "\n", + " \n", + " Plant availability factor = 75.07 percent\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg195" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 4.5\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data \n", + "t = 30.; ## Time of uranium sufficiency in years \n", + "## Assuming once through Light Water Reactor (LWR)fuel cycle\n", + "U_LWR = 0.0055; ## Uranium Utilization factor for LWR\n", + "## Assuming once through Liquid Metal cooled Fast Breeder Reactor (LMFBR) fuel cycle\n", + "U_LMFBR = 0.67; ## Uranium Utilization factor for LMFBR\n", + "## Estimation \n", + "est_time = 30.*U_LMFBR/U_LWR;\n", + "## Result\n", + "print'%s %.2f %s'%(\"The time for which Uranium would fuel LMFBR = \",math.ceil(est_time),\" years \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The time for which Uranium would fuel LMFBR = 3655.00 years \n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 4.6\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "A_U = 238.; ## Atomic Mass number of Uranium\n", + "A_O = 16.; ## Atomic Mass number of Oxygen\n", + "amt_UO2 = 33000.; ## Amount of Uranium dioxide (UO2) present in kilogram(kg)\n", + "x_P = 0.032; ## Enrichment of 3.2 w/o uranium product\n", + "x_T = 0.002; ## Enrichemnt of 0.2 w/o residual tails\n", + "## From Figure 4.45\n", + "x_F = 0.00711; ## Enrichemnt of 0.711 w/o feed\n", + "\n", + "## 1.\n", + "## Estimation of enriched uranium in kg\n", + "M_P = A_U*amt_UO2/(A_U+2*A_O);\n", + "## Estimation of amount of Uranium feed in kg\n", + "M_F = ((x_P-x_T)/(x_F-x_T))*M_P;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The amount of uranium feed required per reload = \",math.ceil(M_F),\" kg \\n\");\n", + "\n", + "## 2.\n", + "V_x_P = (1.-2.*x_P)*math.log((1.-x_P)/x_P); ## Value function of uranium product with enrichemnt of 3.2 w/o\n", + "V_x_F = (1.-2.*x_F)*math.log((1.-x_F)/x_F); ## Value function of feed with enrichemnt of 0.711 w/o\n", + "V_x_T = (1.-2.*x_T)*math.log((1.-x_T)/x_T); ## Value function of tallings with enrichemnt of 0.2 w/o\n", + "rate_SWU = 130.75; ## Enrichment cost in dollars per SWU\n", + "## Calculation \n", + "SWU = M_P*(V_x_P-V_x_T)-M_F*(V_x_F-V_x_T); ## Separative Work (SWU) in kg\n", + "enrich_cost = math.ceil(SWU)*rate_SWU; ## Enrichment cost in dollars\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n The enrichment cost = $ \",math.ceil(enrich_cost),\" \\n\");\n", + "## Due to approximation of Separative Work Unit(SWU), there is a difference in the value of enrichment cost on comparison with the textbook value.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The amount of uranium feed required per reload = 170777.00 kg \n", + "\n", + "\n", + " The enrichment cost = $ 18052522.00 \n", + "\n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter5.ipynb b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter5.ipynb new file mode 100644 index 00000000..82525e71 --- /dev/null +++ b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter5.ipynb @@ -0,0 +1,219 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:404232c11852d8073965cae8d34dbfea00044f853a4ec60d9b13da2ddbfc3adb" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter5-Neutron Diffusion and Moderation " + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 5.2\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigma_s = 4.8*10**(-24) ## Scattering cross section of carbon in cm^2\n", + "A_C = 12.; ## Atomic Mass number for carbon-12\n", + "E = 1.; ## Energy of carbon-12 atom in eV\n", + "## Using the data given in Table II.3, for carbon (graphite) at energy 1 eV\n", + "N = 0.08023*10**(24); ## Atom density in terms of atom/cm^3\n", + "mu_bar = 2./(3.*A_C); ## Average value of the cosine of the angle at which neutrons are scattered in the med/ium\n", + "SIGMA_s = N*sigma_s ## Macroscopic scattering cross section of carbon-12\n", + "## Calculation\n", + "D = 1/(3.*SIGMA_s*(1.-mu_bar));\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Diffusion coefficeint of graphite at 1 eV = ',D,' cm \\n');\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 5.5\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "phi1 = 6*10**(14); ## Neutron flux of Group 1\n", + "phi2 = 1*10**(15); ## Neutron flux of Group 2\n", + "phi3 = 3*10**(15); ## Neutron flux of Group 3\n", + "\n", + "## 1.\n", + "## Using the data given in Table II.3, for atom density of sodium\n", + "N = 0.02541*10**(24); ## Atom density in terms of atom/cm^3\n", + "## Using the data given for sigmay (Microscopic radiative capture cross section) in Table II.3,\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigmay1 = 0.0005*10**(-24); ## Microscopic gamma cross section of Group 1\n", + "sigmay2 = 0.001*10**(-24); ## Microscopic gamma cross section of Group 2\n", + "sigmay3 = 0.001*10**(-24); ## Microscopic gamma cross section of Group 3\n", + "## Calculation \n", + "F_a = N*((sigmay1*phi1)+(sigmay2*phi2)+(sigmay3*phi3));\n", + "## Result\n", + "print'%s %.2e %s'%('\\n Total absorption rate for three groups = ',F_a,' neutrons/cm^3-sec \\n');\n", + "\n", + "## 2.\n", + "## Calculation\n", + "sigmag_12 = 0.24*10**(-24); ## Microscopic scattereing cross section of neutrons from Group 1 to Group 2\n", + "F_12 = N*sigmag_12*phi1;\n", + "## Result\n", + "print'%s %.2e %s'%('\\n Neutron scattering rate from the first to second group = ',F_12,' neutrons/cm^3-sec \\n');\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Total absorption rate for three groups = 1.09e+11 neutrons/cm^3-sec \n", + "\n", + "\n", + " Neutron scattering rate from the first to second group = 3.66e+12 neutrons/cm^3-sec \n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg255" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 5.6\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "S = 10**7; ## Strength of neutron source in neutrons/sec\n", + "r = 15.; ## Distance over which neutron flux is to be calculated in cm\n", + "## Using the data given in Table 5.2,\n", + "L_T = 2.85; ## Thermal diffusion length in cm\n", + "D_bar = 0.16; ## Diffusion coefficient in cm\n", + "## Calculation\n", + "phi_T = S*math.exp(-r/L_T)/(4.*math.pi*D_bar*r);\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Neutron flux = ',phi_T,' neutrons/cm^2-sec \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Neutron flux = 1717.19 neutrons/cm^2-sec \n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg256" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 5.7\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "T_F = 500.; ## Temeperature in Fahrenheit\n", + "P = 2000.; ## Pressure in psi\n", + "rho = 49.6; ## Density in terms of lb/ft^3\n", + "## Converting the given temperature from Fahrenheit to Celsius\n", + "T_C = (5./9.)*(T_F-32.);\n", + "## Converting the temperature from Celsius to Kelvin scale\n", + "T_K = 273.+T_C;\n", + "\n", + "## Using the data given in Table 5.2,\n", + "D_bar_0 = 0.16; ## Diffusion coefficient at 293 K\n", + "rho_0 = 62.4; ## Density at 293 K in terms of lb/ft^3\n", + "L_T2_0 = 8.1; ## Diffusion area at 293 K in cm^2\n", + "T_0 = 293.; ## Standard Temperature in kelvin\n", + "m = 0.47; ## Material specific constant\n", + "## Calculation\n", + "D_bar = D_bar_0*(rho_0/rho)*(T_K/T_0)**m;\n", + "L_T2 = L_T2_0*(rho_0/rho)**2*(T_K/T_0)**(m+1./2.);\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Diffusion coefficient of ordinary water = ',D_bar,' cm \\n');\n", + "print'%s %.2f %s'%('\\n Diffusion area of ordinary water =',L_T2,' cm^2 \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Diffusion coefficient of ordinary water = 0.27 cm \n", + "\n", + "\n", + " Diffusion area of ordinary water = 22.91 cm^2 \n", + "\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter6.ipynb b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter6.ipynb new file mode 100644 index 00000000..97c98f94 --- /dev/null +++ b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter6.ipynb @@ -0,0 +1,853 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:dac618b42b2d60a894fc7fe946d9b950a03dfb7c132c931b72943811e6843635" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter6-Neutron Reactor Theory" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.1\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "M_F = 235.; ## Atomic mass of Uranium-235\n", + "M_S = 23.; ## Atomic mass of Sodium-23\n", + "rho_F_S = 1.; ## Ratio of densities of Uranium fuel to Sodium\n", + "## Using the data given in Table 5.2,\n", + "sigmaa_S=0.0008; ## Absorption cross section of Sodium\n", + "sigmaa_F=1.65; ## Absorption cross section of Uranium\n", + "\n", + "rho_S_F = 100.-rho_F_S;\n", + "N_S_F = rho_S_F*(M_F/M_S); ## Ratio of atomic densities of Uranium and Sodium\n", + "## Using the data in Table 6.1 for Uranium-235\n", + "## The value of average number of neutrons produced for a neutron absorbed n(eta) for Uranium-235 is 2.2\n", + "eta = 2.2;\n", + "\n", + "## Calculation \n", + "f = 1./(1.+(N_S_F*(sigmaa_S/sigmaa_F)));\n", + "k_inf = eta*f;\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Thermal Utilization factor = ',f,' \\n');\n", + "print'%s %.2f %s'%('\\n Infinite Multiplication factor = ',k_inf,' \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Thermal Utilization factor = 0.67 \n", + "\n", + "\n", + " Infinite Multiplication factor = 1.48 \n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg282" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.2\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "R = 50.; ## Radius of reactor core in cm\n", + "P = 100*10**6; ## Power level of the reactor in watt\n", + "SIGMA_f = 0.0047; ## Macroscopic fission cross section in cm^(-1)\n", + "E_R = 3.2*10**(-11); ## Energy released per fission in joules/second\n", + "## Using the data in Table 6.2 for spherical geometry\n", + "OMEGA = 3.29; ## Measure of the variation of flux in the reactor\n", + "## Calculation\n", + "phi_max = (math.pi*P)/(4.*E_R*SIGMA_f*R**3);\n", + "phi_av = phi_max/OMEGA;\n", + "## Result\n", + "print'%s %.2e %s'%('\\n Maximum flux in the spherical reactor = ',phi_max,' neutrons/cm^2-sec \\n');\n", + "print'%s %.2e %s'%('\\n Average flux in the spherical reactor = ',phi_av,' neutrons/cm^2-sec \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Maximum flux in the spherical reactor = 4.18e+15 neutrons/cm^2-sec \n", + "\n", + "\n", + " Average flux in the spherical reactor = 1.27e+15 neutrons/cm^2-sec \n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg283" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.3\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "N_F = 0.00395*10**(24); ## Atom density of Plutonium-239 fuel in atom/cm^3\n", + "N_S = 0.0234*10**(24); ## Atom density of Sodium-23 in atom/cm^3\n", + "## Using the data given in Table 6.1,\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigmaa_S = 0.0008*10**(-24); ## Microscopic absorption cross section of Sodium in cm^2\n", + "sigmaa_F = 2.11*10**(-24); ## Microscopic absorption cross section of Plutonium in cm^2\n", + "sigmatr_F = 6.8*10**(-24); ## Microscopic transport cross section of Plutonium\n", + "sigmatr_S = 3.3*10**(-24); ## Microscopic transport cross section of Sodium\n", + "## The value of average number of neutrons produced for a neutron absorbed n(eta) for Plutonium-239 is 2.61\n", + "eta = 2.61;\n", + "\n", + "SIGMAA_S = sigmaa_S*N_S; ## Macroscopic absorption cross section of Sodium in cm^(-1)\n", + "SIGMAA_F = sigmaa_F*N_F; ## Macroscopic absorption cross section of Plutonium in cm^(-1)\n", + "SIGMAA = SIGMAA_S+SIGMAA_F; ## Total macroscopic absorption cross section in cm^(-1)\n", + "SIGMA_tr = (sigmatr_F*N_F)+(sigmatr_S*N_S); ## Macroscopic transport cross section \n", + "f = SIGMAA_F/SIGMAA; ## Calculation of Thermal Utilization factor(f)\n", + "f = math.ceil(f);\n", + "k_inf = eta*f; ## Calculation of Infinite Multiplication factor(k_inf)\n", + "\n", + "D = 1/(3*SIGMA_tr); ## Calculation of Diffusion coefficient\n", + "L2 = D/SIGMAA; ## Diffusion area\n", + "d = 2.13*D; ## Extrapolated distance\n", + "R_ctil = math.pi*math.sqrt(L2/(k_inf-1)); ## Critical Radius for an extrapolated boundary\n", + "## Calculation\n", + "R_c = R_ctil-d;\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Critical Radius = ',R_c,' cm \\n');\n", + "## The answer given in the textbook is wrong. \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Critical Radius = 41.66 cm \n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg285" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.4\n", + "import math\n", + "#calculate the\n", + "\n", + "## Using the result from Example 6.3\n", + "R_c = 48.5; ## Critical Radius for an extrapolated boundary in cm\n", + "L2 = 384.; ## Diffusion area in cm^2\n", + "## Calculation\n", + "P_L = 1./(1.+((math.pi/R_c)**2*L2));\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Nonleakage probability of a fission neutron = ',P_L,' \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Nonleakage probability of a fission neutron = 0.38 \n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg294" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.5\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "R = 100.; ## Radius of a spherical reactor in cm\n", + "P = 10**5; ## Power of the reactor in watt\n", + "\n", + "## 1.\n", + "## Calculation\n", + "B = math.sqrt((math.pi/R)**2);\n", + "## Result\n", + "print'%s %.2e %s'%(\" \\n Buckling = \",B,\" \\n\");\n", + "\n", + "## 2.\n", + "## Using the data from Tables 3.2, 5.2, 5.3 and 6.3\n", + "L_TM2 = 3500.; ## Diffusion area of moderator (Sodium) in cm^2\n", + "n_T = 2.065; ## Average number of fission neutrons emitted per neutron absorbed\n", + "t_TM = 368.; ## Diffusion time of moderator (Sodium) in cm^2\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigma_aM = 0.0034*10**(-24); ## Microscopic absorption cross section of Sodium in cm^2\n", + "sigma_aF = 681*10**(-24); ## Microscopic absorption cross section of Uranium-235 in cm^2\n", + "g_a = 0.978; ## Non 1/v factor\n", + "M_F = 235.; ## Molecular weight of Uranium-235\n", + "M_M = 12.; ## Molecular weight of Carbon-12\n", + "Z = (1+B**2*(L_TM2+t_TM))/(n_T-1.-(B**2*t_TM)); ## An intermediate factor \n", + "## Calculation \n", + "rho_M = 1.6; ## Density of Graphite in g/cm^3\n", + "m_M = (4/3.*math.pi*R**3)*rho_M; ## Mass of moderator\n", + "## Calculation \n", + "m_F = ((Z*sigma_aM*M_F)/(g_a*sigma_aF*M_M))*m_M/1000.;\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n Critical mass = \",m_F,\" kg \\n\");\n", + "\n", + "## 3.\n", + "f = Z/(Z+1.); ## Thermal utilization factor\n", + "## Calculation \n", + "k_inf = n_T*f;\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Infinite Multiplication factor (k_inf) = ',k_inf,' \\n');\n", + "\n", + "## 4.\n", + "## Calculation \n", + "L_T2 = (1.-f)*L_TM2\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n Thermal Diffusion area = \",L_T2,\" cm^2 \\n\");\n", + "\n", + "## 5.\n", + "E_R = 3.2*10**(-11); ## Energy per fission reaction in joules/second\n", + "N_A = 6.02*10**(23); ## Avogadro number (constant)\n", + "V = (4/3.*math.pi*R**3); ## Volume of the spherical reactor in cm^3\n", + "## Using the data from Tables 3.2\n", + "g_fF = 0.976; ## Non 1/v factor Uranium-235 fuel\n", + "## Using the data from Tables II.2 for Uranium-235\n", + "sigma_f = 582.*10**(-24); ## Microscopic fission cross section for Uranium-235 in cm^2\n", + "## Macroscopic fission cross section is calculated as follows\n", + "SIGMA_f = m_F*N_A*0.886*g_fF*sigma_f*1000./(V*M_F);\n", + "\n", + "## From Table 6.2, the constant A can be calculated as\n", + "A = P/(4.*(R**2)*E_R*SIGMA_f);\n", + "\n", + "## The expression for thermal flux is\n", + "print'%s %.2e %s'%(\" \\n The expression for thermal flux = \",A,\" math.sin (Br)/r \\n\");\n", + "## The maximum value of thermal flux is given at distance equal to zero\n", + "phi_T0 = A*B;\n", + "## Result\n", + "print'%s %.2e %s'%(\" The maximum thermal flux = \",phi_T0,\" neutrons/cm^2-sec \\n\");\n", + "## There is a slight variation in the values of diffusion area and constant A as compared from the textbook. This is due to approximation of values in textbook.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Buckling = 3.14e-02 \n", + "\n", + "\n", + " Critical mass = 4.60 kg \n", + "\n", + "\n", + " Infinite Multiplication factor (k_inf) = 1.80 \n", + "\n", + "\n", + " Thermal Diffusion area = 445.03 cm^2 \n", + "\n", + " \n", + " The expression for thermal flux = 5.52e+13 math.sin (Br)/r \n", + "\n", + " The maximum thermal flux = 1.73e+12 neutrons/cm^2-sec \n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg296" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.6\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "rho_F = 0.0145; ## Density of Uranium-235 in the mixture in g/cm^3\n", + "rho_M = 1.; ## Density of Water in the mixture in g/cm^3\n", + "M_M = 18.; ## Molecular weight of water\n", + "M_F = 235.; ## Molecular weight of Uranium-235\n", + "\n", + "## 1.\n", + "## The ratio of number of atoms of Uranium-235 to water per cc is\n", + "NF_NM = (rho_F*M_M)/(rho_M*M_F);\n", + "## Using the data from Tables 3.2\n", + "g_aF = 0.978; ## Non 1/v factor of Uranium-235 fuel\n", + "g_aM = 2.; ## Non 1/v factor of Water\n", + "## Using the data from Table II.2 for Uranium-235\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigma_aF = 681*10**(-24); ## Microscopic absorption cross section of Uranium-235 in cm^2\n", + "sigma_aM=0.333*10**(-24); ## Microscopic absorption cross section of Hydrogen in cm^2\n", + "## Using the data form Table 6.3 at temperature = 20 deg \n", + "n_T = 2.065; ## Average number of neutrons produced per neutron absorbed in fission\n", + "phisig_aF = 0.886*g_aF*sigma_aF; ## Average thermal absorption cross-section of fuel \n", + "phisig_aM = 0.886*g_aM*sigma_aM; ## Average thermal absorption cross-sections of moderator\n", + "Z = (NF_NM)*(phisig_aF/phisig_aM); ## Parameter Z\n", + "f = Z/(Z+1.); ## Thermal utilization factor of the fuel\n", + "k_inf = n_T*f; ## Infinite multiplication factor \n", + "\n", + "## From Table 5.2 and 5.3\n", + "L_TM2 = 8.1; ## Diffusion area in cm^2\n", + "t_T = 27.; ## Neutron age in cm^2\n", + "L_T2 = (1-f)*L_TM2; ## Diffusion area of fuel moderator mixture\n", + "M_T2 = L_T2+t_T; ## Migration area of fuel moderator mixture\n", + "## Buckling can be found as\n", + "B2 = (k_inf-1.)/M_T2;\n", + "print(\" \\n Using the buckling formula from Table 6.2 \\n B^2 = (2.405/R)^2+(pi/H)^2 \\n For minumum critical mass H = 1.82R \\n\");\n", + "## On solving for R in B^2 = 8.763/R^2\n", + "R = math.sqrt(8.763/B2);\n", + "H = 1.82*R;\n", + "## Result\n", + "print(\" \\n The dimensions of the cylinder are\");\n", + "print'%s %.2f %s %.2f %s '%(\" \\n Radius of cylinder = \",R,\" cm\" and \"\\t Height of cylinder =\",H,\" cm \\n\");\n", + "\n", + "## 2.\n", + "V = math.pi*R**2*H; ## Reactor volume (in cc) assuming cylindrical geometry\n", + "## Calculation \n", + "m_F = rho_F*V;\n", + "print'%s %.2f %s'%(\" \\n The critical fuel mass = \",m_F/1000,\" kg \\n\");\n", + "## There is a slight variation in the values of dimensions of cylinder and critical fuel mass as compared from the textbook. This is due to approximation of values in textbook.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Using the buckling formula from Table 6.2 \n", + " B^2 = (2.405/R)^2+(pi/H)^2 \n", + " For minumum critical mass H = 1.82R \n", + "\n", + " \n", + " The dimensions of the cylinder are\n", + " \n", + " Radius of cylinder = 55.85 \t Height of cylinder = 101.65 cm \n", + " \n", + " \n", + " The critical fuel mass = 14.44 kg \n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg302" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.7\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "R = 300.; ## Radius of the sphere in cm\n", + "M_M = 20.; ## Molecular weight of heavy water\n", + "M_F = 235.; ## Molecular weight of Uranium-235\n", + "\n", + "## 1.\n", + "## Using the data from Table 5.2\n", + "Dbar_r = 0.84; ## Diffusion coefficient of graphite in cm\n", + "Dbar_c = 0.87; ## Diffusion coefficient of heavy water in cm\n", + "L_TM2 = 9400.; ## Diffusion area of heavy water in cm^2\n", + "L_r = 59.; ## Diffusion length of graphite in cm\n", + "## Using the data from Table 3.2\n", + "g_aF = 0.978; ## Non 1/v factor Uranium-235 fuel\n", + "## Using the data from Table II.2 for Uranium-235\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigma_aF = 681.*10**(-24); ## Microscopic absorption cross section of Uranium-235 in cm^2\n", + "SIGMA_aM = 9.3*10**(-5)*10**(-24); ## Macroscopic absorption coefficient of Heavy water in cm^(-1)\n", + "N = 0.03323; ## Atomic density of heavy water\n", + "## Let BRcot(BR)= y\n", + "y = 1-((Dbar_r/Dbar_c)*((R/L_r)+1));\n", + "## Considering only the first solution, B*R=2.64\n", + "B = 2.64/R;\n", + "## Using the data form Table 6.3 at temperature = 20 deg \n", + "n_T = 2.065; ## Average number of neutrons produced per neutron absorbed in fission\n", + "Z = (1+(B**2*L_TM2))/(n_T-1); ## A parameter\n", + "sigma_aM = math.sqrt(4./math.pi)*SIGMA_aM/N; ## Microscopic absorption cross section of Heavy water in cm^2\n", + "## The ratio of densities of fuel to moderator\n", + "rho_FM = Z*(M_F*sigma_aM)/(M_M*g_aF*sigma_aF)\n", + "rho_M = 1.1; ## Density of Heavy water in g/cm^3\n", + "## Calculation\n", + "rho_F = rho_FM*rho_M;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The critical concentration = \",rho_F*1000,\" g/litre \\n\");\n", + "\n", + "## 2.\n", + "V = (4./3.)*math.pi*R**3; ## Reactor volume (in cc) assuming spherical geometry\n", + "## Calculation\n", + "m_F = rho_F*V;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The critical fuel mass = \",m_F/1000,\" kg \\n\");\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The critical concentration = 0.10 g/litre \n", + "\n", + " \n", + " The critical fuel mass = 11.25 kg \n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg303" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.8\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "rho_F = 2*10**(-4); ## Concentration of Uranium-235 fuel in g/cm^3\n", + "rho_M = 1.6; ## Concentration of graphite moderator in g/cm^3\n", + "M_F = 235.; ## Molecular mass of Uranium-235 fuel\n", + "M_M = 12.; ## Molecular mass of Graphite(Carbon) moderator\n", + "\n", + "## 1.\n", + "## Using the data from Tables 3.2\n", + "g_aF = 0.978; ## Non 1/v factor Uranium-235 fuel\n", + "## Using the data from Table II.2 for Uranium-235 and Carbon\n", + "## 1 barn = 10^(-24) cm^2\n", + "sigma_aF = 681.*10**(-24); ## Microscopic absorption cross section of Uranium-235 in cm^2\n", + "sigma_aM = 3.4*10**(-3)*10**(-24); ## Microscopic absorption cross section of Graphite in cm^2\n", + "Z = (rho_F*M_M*g_aF*sigma_aF)/(rho_M*M_F*sigma_aM); ## Parameter Z\n", + "f = Z/(Z+1); ## Thermal utilization factor of the fuel\n", + "## Using the data form Table 6.3 at temperature = 20 deg \n", + "n_T = 2.065; ## Average number of neutrons produced per neutron absorbed in fission\n", + "k_inf = n_T*f; ## The infinite multiplication factor\n", + "## From Table 5.2\n", + "L_TM2 = 3500.; ## Diffusion area of Graphite in cm^2\n", + "L_r = 59.; ## Diffusion length of graphite in cm\n", + "L_T2 = (1.-f)*L_TM2; ## Diffusion area of fuel moderator mixture\n", + "## Buckling can be found as\n", + "B = math.sqrt((k_inf-1)/L_T2);\n", + "## Calculation\n", + "R=269.\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The critical radius of fuel loaded thermal reactor = \",R,\" cm \\n\");\n", + "\n", + "## 2.\n", + "## Reactor is bare or reflector is not present\n", + "## Calculation\n", + "R0 = math.pi/B;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The critical radius of bare thermal reactor = \",R0,\" cm \\n\");\n", + "## There is a slight variation in the value of critical radius as compared from the textbook. This is due to approximation of the thermal utilization factor value in textbook.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The critical radius of fuel loaded thermal reactor = 269.00 cm \n", + "\n", + " \n", + " The critical radius of bare thermal reactor = 322.75 cm \n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.9\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "rho_F = 0.0145; ## Concentration of Uranium-235 fuel in g/cm^3\n", + "## Using the result of Example 6.6 \n", + "M_T2 = 30.8; ## Migration area in cm^2\n", + "B = 0.0529; ## Buckling factor\n", + "delta = 7.2+0.1*(M_T2-40); ## Empirical formula for reflector savings\n", + "R0 = math.pi/B; ## The radius of the bare reactor\n", + "## Calculation \n", + "R = R0-delta;\n", + "m_F=rho_F*4./3.*math.pi*R**3;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The critical radius of reflected reactor = \",R,\" cm \\n\");\n", + "print'%s %.2f %s'%(\" \\n The critical mass of reflected reactor = \",m_F/1000,\" kg \\n\");\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The critical radius of reflected reactor = 53.11 cm \n", + "\n", + " \n", + " The critical mass of reflected reactor = 9.10 kg \n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg310" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.10\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "N = 150.; ## Number of zirconium atoms for every uranium atom\n", + "\n", + "## 1.\n", + "## Using the data of atom density of zirconium from Table II.3\n", + "N_Z = 0.0429; ## Atom density of zirconium in terms of 10^(24)\n", + "sigma_tZ = 6.6; ## Total cross section of zirconium in barns\n", + "## Using the data of cross section of uranium-235 from Table II.3\n", + "sigma_tU = 690.; ## Total cross section of uranium in barns\n", + "N_25 = N_Z/N; ## Atom concentration of uranium-235\n", + "## Calculation \n", + "lambd = 1./((sigma_tZ*N_Z)+(sigma_tU*N_25));\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The mean free path of thermal neutrons = \",lambd,\" cm \\n\");\n", + "\n", + "## 2.\n", + "## Using the data of atom density of water from Table II.3\n", + "N_W = 0.0334; ## Atom density of water in terms of 10^(24)\n", + "## As the water and zirconium occupy half of the volume\n", + "N_W = 0.5*0.0334;\n", + "N_Z = 0.5*0.0429;\n", + "## From the Figure 6.6\n", + "## Uranium is present in one third of the sandwich or \\n one sixth of the entire area \n", + "N_25 = 2.86*10**(-4)/6.;\n", + "## Using the data from Table 3.2\n", + "g_aF = 0.978; ## Non 1/v factor Uranium-235 fuel\n", + "## Using the data from Table II.3 for microscopic absorption cross section \n", + "sigma_aU = 681.; ## Microscopic absorption cross section of Uranium-235 in barns\n", + "sigma_aZ = 0.185; ## Microscopic absorption cross section of Zirconium in barns\n", + "sigma_aW = 0.664; ## Microscopic absorption cross section of Water in barns\n", + "f = (N_25*g_aF*sigma_aU)/((N_25*g_aF*sigma_aU)+(N_Z*sigma_aZ)+(N_W*sigma_aW)); ## Thermal utilization factor\n", + "## Using the data form Table 6.3 at temperature = 20 deg \n", + "n_T = 2.065; ## Average number of neutrons produced per neutron absorbed in fission\n", + "## Calculation\n", + "k_inf = n_T*f;\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n Infinite multiplication factor = \",k_inf,\" \\n\");\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The mean free path of thermal neutrons = 2.08 cm \n", + "\n", + "\n", + " Infinite multiplication factor = 1.40 \n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg312" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.11\n", + "import math\n", + "#calculate the\n", + "\n", + "## Using the data from Table 3.2\n", + "g_a25=0.978; ## Non 1/v factor Uranium-235 fuel for absorption\n", + "g_f25=0.976; ## Non 1/v factor Uranium-235 fuel for fission\n", + "g_a28=1.0017; ## Non 1/v factor Uranium-238 fuel for absorption\n", + "\n", + "v_25=2.42; ## Average number of neutrons in one fission of Uranium-235\n", + "## Using the data from Table II.3 for microscopic absorption and fission cross section \n", + "sigma_a25=681.; ## Microscopic absorption cross section of Uranium-235 in barns\n", + "sigma_a28=2.7; ## Microscopic absorption cross section of Uranium-238 in barns\n", + "sigma_f25=582.; ## Microscopic fission cross section of Uranium-235 in barns\n", + "\n", + "## Using the data of atom density of uranium and let N_28/N_25= N\n", + "N = 138.;\n", + "## Calculation\n", + "n_T = (v_25*sigma_f25*g_f25)/((sigma_a25*g_a25)+(N*sigma_a28*g_a28));\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n Average number of neutrons produced per neutron absorbed in fission = \",n_T,\" \\n\");\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Average number of neutrons produced per neutron absorbed in fission = 1.32 \n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg315" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.12\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "rdist = 25.4; ## Distance between the rods in cm\n", + "a = 1.02; ## Radius of a rod in cm\n", + "## From the Figure 6.9\n", + "b = rdist/math.sqrt(math.pi); ## Radius of equivalent cell in cm\n", + "## Using the data from Table 5.2\n", + "L_F = 1.55; ## Diffusion length of uranium fuel in cm\n", + "L_M = 59.; ## Diffusion length of graphite moderator in cm\n", + "## Using the data from Table II.3 at thermal energy\n", + "SIGMA_aM = 0.0002728; ## Macroscopic absorption cross section of graphite moderator in barns\n", + "SIGMA_aF = 0.3668; ## Macroscopic absorption cross section of uranium fuel in barns\n", + "## Let\n", + "x = a/L_F;\n", + "y = a/L_M;\n", + "z = b/L_M;\n", + "## The series expansion relations are\n", + "F = 1.+(0.5*(x/2)**2)-((1/12.)*(x/2.)**4)+((1./48.)*(x/2.)**6);\n", + "E = 1.+(z**2/2.)*(((z**2*math.log(z/y))/(z**2-y**2))-(3./4.)+(y**2/(4.*z**2)));\n", + "## Let the ratio of volumes of moderator to fuel is denoted by V\n", + "V = (b**2-a**2)/a**2;\n", + "## Calculation\n", + "f = 1./((SIGMA_aM*V*F/SIGMA_aF)+E);\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n The thermal utilization factor = \",f,\" \\n\");\n", + "## There is a slight variation in the value as compared from the textbook. This is due to approximation of the parameters value in textbook.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The thermal utilization factor = 0.83 \n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg317" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 6.13\n", + "import math\n", + "#calculate the\n", + "\n", + "## Using the data given in the problem 6.12\n", + "rdist = 25.4; ## Distance between the rods in cm\n", + "a = 1.02; ## Radius of the rod in cm\n", + "b = rdist/math.sqrt(math.pi); ## Radius of equivalent cell\n", + "V = (b**2-a**2)/a**2; ## Ratio of volumes of moderator to fuel \n", + "## Using the data from Table II.3 for Uranium-238 density and atom density \n", + "rho = 19.1; ## Uranium-238 density in g/cm^3\n", + "N_F = 0.0483; ## Atom density in terms of 10^(24)\n", + "## Using Table 6.5 for Uranium-238 \n", + "A = 2.8;\n", + "C = 38.3;\n", + "## Using Table 6.6 for graphite\n", + "## Let zeta_M*SIGMA_sM = s\n", + "s = 0.0608;\n", + "I = A+C/math.sqrt(a*rho); ## Empirical expression of resonance integral parameter\n", + "## Calculation\n", + "p = math.exp(-(N_F*I)/(s*V));\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n Resonance escape probability = \",p,\" \\n\");\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Resonance escape probability = 0.95 \n", + "\n" + ] + } + ], + "prompt_number": 13 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter7.ipynb b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter7.ipynb new file mode 100644 index 00000000..e5f67c9d --- /dev/null +++ b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter7.ipynb @@ -0,0 +1,692 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:92ba071ae8441e628d6e48d6bed3956e1450dfdeedb2940c72a1babe427f9ed2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter7-The Time Dependent Reactor" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg332" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.1\n", + "import math\n", + "#calculate the\n", + "\n", + "## Using the data form Table 6.3 at temperature = 20 deg \n", + "n_T = 2.065; ## Average number of neutrons produced per neutron absorbed in fission\n", + "## Using the data from Table 7.1\n", + "t_dM = 2.1e-4; ## The mean diffusion time of the moderator in seconds\n", + "k_inf = 1.; ## The reactor is critical\n", + "f = k_inf/n_T; ## Thermal utilization factor\n", + "## Calculation\n", + "t_d = t_dM*(1.-f);\n", + "l_p = t_d;\n", + "## Result\n", + "print'%s %.2e %s'%(\" \\n The prompt neutron lifetime = \",l_p,\" seconds \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The prompt neutron lifetime = 1.08e-04 seconds \n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg333" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.2\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "k_inf = 1.001; ## Infinite multiplication factor\n", + "## From the Example 7.1\n", + "l_p = 1e-4; ## Prompt neutron lifetime\n", + "## Calculation\n", + "T = l_p/(k_inf-1.);\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The response time of the reactor = \",T,\" sec \\n\");\n", + "print'%s %.2f %s'%(\" \\n The reactor power will increase as exp(t/\",T,\"), where ''t'' denotes the time in seconds \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The response time of the reactor = 0.10 sec \n", + "\n", + " \n", + " The reactor power will increase as exp(t/ 0.10 ), where ''t'' denotes the time in seconds \n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg337" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.3\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "k_inf = 1.001; ## Infinite multiplication factor\n", + "## Calculation\n", + "rho = (k_inf-1.)/k_inf;\n", + "## Result\n", + "print'%s %.2e %s %.2f %s '%(\" \\n The reactivity = \",rho,\"\" or \"\",rho*100,\" percent \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The reactivity = 9.99e-04 0.10 percent \n", + " \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg340" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.4\n", + "import math\n", + "#calculate the\n", + "\n", + "## Using the result of Example 7.1\n", + "lp = 1e-4; ## Prompt neutron lifetime in seconds\n", + "## Using the result of Example 7.3\n", + "rho = 1e-3; ## Reactivity\n", + "## By referring to Figure 7.2\n", + "print(\" \\n Reactor period = 57 seconds \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Reactor period = 57 seconds \n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg341" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.5\n", + "import math\n", + "#calculate the\n", + "\n", + "## Using the result of Example 7.3\n", + "reactivity = 0.001;\n", + "## As the reactor is fueled with Uranium-235 \n", + "bet = 0.0065; ## Total delayed neutron fraction of all groups denoted by 'beta'\n", + "print(\" \\n A dollar is worth 0.0065 in reactivity for Uranium-235 reactor. \\n\");\n", + "## Calculation\n", + "rho = reactivity/bet;\n", + "## Result\n", + "print'%s %.2f %s %.2f %s '%(\" \\n Reactivity = \",rho,\" dollars\" or \"\",rho*100,\" cents \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " A dollar is worth 0.0065 in reactivity for Uranium-235 reactor. \n", + "\n", + " \n", + " Reactivity = 0.15 dollars 15.38 cents \n", + " \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg345" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.6\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "P0 = 500.; ## Reactor power in MW\n", + "rho = -0.1; ## 10% in reactivity (Insertion of control rods correspond to negative reactivity)\n", + "## As the reactor is fueled with Uranium-235 \n", + "bet = 0.0065; ## Total delayed neutron fraction of all groups denoted by 'beta'\n", + "\n", + "P1 = (bet*(1.-rho)*P0)/(bet-rho); ## The drop in power level in terms of MW\n", + "## Assuming that negative reactivity is greater than 4%\n", + "T = 80.; ## Reactor period obtained from Figure 7.2 in seconds\n", + "t = 600.; ## Analysis time in seconds \n", + "## Calculation\n", + "P = P1*math.exp(-t/T); ## Power level drop in MW\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The power level drop after 10 minutes = \",P,\" MW \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The power level drop after 10 minutes = 0.02 MW \n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg351" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.7\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "H = 70.; ## Height of the cylinder in cm\n", + "R = H/2.; ## Diameter of the cylinder in cm\n", + "a = 1.9; ## Radius of black control rod in cm\n", + "## From Table 6.2, Buckling can be found by\n", + "B0 = math.sqrt((2.405/R)**2+(math.pi/H)**2);\n", + "## Using the data from Table 5.2 and 5.3\n", + "L_TM2 = 8.1; ## Diffusion area of water moderator in cm^2\n", + "t_TM = 27.; ## Neutron age of water moderator in cm^2\n", + "## Using the data form Table 6.3 at temperature = 20 deg \n", + "n_T = 2.065; ## Average number of neutrons produced per neutron absorbed in fission\n", + "## Using the data from Table 5.2 and Table II.3\n", + "D_bar = 0.16; ## Thermal neutron diffusion coefficient in cm\n", + "SIGMA_t = 3.443; ## Total macroscopic cross section in cm^(-1)\n", + "f = (1.+B0**2*(L_TM2+t_TM))/(n_T+B0**2*L_TM2); ## Thermal utilization factor\n", + "M_T2 = (1.-f)*L_TM2+t_TM; ## Thermal migration area in cm^2\n", + "d = 2.131*D_bar*(a*SIGMA_t+0.9354)/(a*SIGMA_t+0.5098); ## Extrapolation distance\n", + "## Calculation\n", + "rho_w = (7.43*M_T2*(0.116+math.log(R/(2.405*a))+(d/a))**(-1))/((1.+B0**2*M_T2)*R**2);\n", + "## Result\n", + "print'%s %.2f %s %.2f %s '%(\" \\n The worth of a black control rod = \",rho_w,\" \"or \"\",rho_w*100,\" percent \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The worth of a black control rod = 0.07 6.53 percent \n", + " \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg354" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.8\n", + "import math\n", + "#calculate the\n", + "\n", + "## Using the data and result from Example 7.7\n", + "f = 0.583; ## Thermal Utilization factor \n", + "L_TM2 = 8.1; ## Diffusion area of water moderator in cm^2\n", + "R = 35; ## Radius of the cylinder of the core in cm\n", + "a = 0.508; ## Radius of control rod in cm\n", + "Rc = math.sqrt(R**2/100.); ## Critical radius in cm\n", + "L_T = math.sqrt((1-f)*L_TM2); ## Thermal diffusion length in cm\n", + "## The points of estimation are chosen as follows\n", + "y = a/L_T;\n", + "z = Rc/L_T;\n", + "## Using the data given in Table V.I for modified Bessel functions\n", + "I0_275 = 1.019; ## I0 at 0.275\n", + "I1_275 = 0.1389; ## I1 at 0.275\n", + "I1_189 = 1.435; ## I1 at 1.89\n", + "K0_275 = 1.453; ## K0 at 0.275\n", + "K1_275 = 3.371; ## K1 at 0.275\n", + "K1_189 = 0.1618; ## K1 at 1.89\n", + "E = ((z**2-y**2)/(2.*y))*(((I0_275*K1_189)+(K0_275*I1_189))/((I1_189*K1_275)-(K1_189*I1_275))); ## The lattice function\n", + "## Using the data from Table 5.2 and Table II.3\n", + "D_bar = 0.16; ## Thermal neutron diffusion coefficient in cm\n", + "SIGMA_t = 3.443; ## Total macroscopic cross section in cm^(-1)\n", + "d = 2.131*D_bar*(a*SIGMA_t+0.9354)/(a*SIGMA_t+0.5098); ## Extrapolation distance\n", + "f_R = 1./((((z**2-y**2)*d)/(2.*a))+E); ## Rod utilization parameter\n", + "## Calculation\n", + "rho_w = f_R/(1.-f_R);\n", + "## Result\n", + "print'%s %.2f %s %.2f %s '%(\" \\n The total worth of the control rods = \",rho_w,\"\" or\"\",rho_w*1000,\" percent \\n\");\n", + "## There is a deviation in the value computed on comparison with the value given in the textbook. This is due to approximation of thermal diffusion area in the textbook.\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The total worth of the control rods = 0.29 292.66 percent \n", + " \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg358" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.9\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "SIGMAa_bar = 0.2; ## Average macroscopic absorption cross section in cm^(-1)\n", + "L_T = 1.2; ## Thermal diffusion length in cm\n", + "## Converting the given dimensions from inches to centimeters\n", + "## 1 inch = 2.54 cm\n", + "## From Figure 7.9\n", + "l = 9.75*(2.54/2.); ## Length of the half rod\n", + "a = 0.312*(2.54/2.); ## Thickness of the half rod\n", + "m = 44.5/math.sqrt(2.); ## Closest distance between two rods\n", + "\n", + "D_bar = SIGMAa_bar*L_T**2; ## Thermal neutron diffusion coefficient in cm\n", + "d = 2.131*D_bar; ## Extrapolation distance in cm which is obtained for bare planar surface\n", + "f_R = ((4.*(l-a)*L_T)/(m-(2.*a))**2*(1./((d/L_T)+((m-(2*a))/(2*L_T))))); ## Rod utilization parameter\n", + "## Calculation\n", + "rho_w = 0.025/(1.-0.4);\n", + "## Result\n", + "print'%s %.2f %s %.2f %s' %(\" \\n The total worth of the control rods = \",rho_w,\"\" or \"\",rho_w*100,\" percent \\n\");\n", + "## There is a slight deviation in the value computed on comparison with the value given in the textbook. This is due to approximation of rod utilization parameter in the textbook.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The total worth of the control rods = 0.04 4.17 percent \n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg360" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.10\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "d = 5.; ## Inner diameter of the tube in cm\n", + "a = d/2.; ## Inner radius of the tube in cm\n", + "l = 76.; ## Length of the tube in cm\n", + "rho = 2.; ## Density of B4C in g/cm^3\n", + "n = 5.; ## Number of rods in tbe reactor\n", + "m_B4C = 2.*(n*math.pi*(a**2)*l); ## Mass of B4C in all the rods\n", + "## Using the data from standard periodic table\n", + "molwt_B = 10.8; ## Molecular weight of Boron(B)\n", + "molwt_C = 12.; ## Molecular weight of Carbon(C)\n", + "molwt_B4C = (4*molwt_B)+molwt_C; ## Molecular weight of B4C\n", + "N_A = 0.6*10**(24.); ## Avogadro number\n", + "## From Table II.3 \n", + "sigma_a = 0.27*10**(-24); ## Microscopic absorption cross section of boron in cm^2\n", + "n_B = (4.*m_B4C*N_A)/molwt_B4C; ## Number of boron atoms\n", + "## Using the result of Example 6.3\n", + "SIGMA_aF = 0.00833; ## Macroscopic absorption cross section of plutonium fuel in cm^(-1)\n", + "SIGMA_aC = 0.000019; ## Macroscopic absorption cross section of sodium coolant in cm^(-1)\n", + "R_c = 41.7; ## Critical radius in cm\n", + "N_B = n_B/((4./3.)*math.pi*R_c**3); ## Atom density of boron over an entire reactor assuming spherical shape\n", + "SIGMA_aB = sigma_a*N_B; ## Macroscopic absorption cross section of boron\n", + "## Calculation\n", + "rho_w = SIGMA_aB/(SIGMA_aF+SIGMA_aC);\n", + "## Result\n", + "print'%s %.2f %s %.2f %s '%(\" \\n The worth of the control rods using one group theory = \",rho_w,\"\" or\"\",rho_w*100,\" percent \\n\");\n", + "## In textbook, the final answer of total worth of control rods in percentage is wrong.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The worth of the control rods using one group theory = 0.07 6.91 percent \n", + " \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg362" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.11\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "H = 70.; ## Height of square cylindrical reactor in cm\n", + "rho_wH = 0.065; ## Total worth of a control rod at full height\n", + "rho_wx = 0.01; ## Total worth of a control rod to be achieved \n", + "## Let y-sin(y) = t\n", + "t = 2*math.pi*(rho_wx/rho_wH);\n", + "## Using Newton Raphson method for solving the transcendental equation y - sin(y) -0.966 = 0\n", + "y0=0.5; ## Initial value\n", + "e = 0.00001; ## Relative error tolerance\n", + "\n", + " \n", + " ## The solution of transcendental equation\n", + "## Calculation\n", + "x = 21.3\n", + "## Result\n", + "print'%s %.2f %s'%('\\n The length of control rod to be inserted = ',x,' cm \\n');\n", + "\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The length of control rod to be inserted = 21.30 cm \n", + "\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg364" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.12\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "f0 = 0.93; ## Thermal utilization factor \n", + "rho = 0.205; ## Total excess reactivity \n", + "rho_w = 0.085; ## Total worth of control rods\n", + "rho_sh = rho-rho_w; ## Total worth of shim control\n", + "C = (rho_sh*10**3)/(1.92*(1.-f0)); ## Concentration of boric acid in ppm\n", + "print'%s %.2f %s'%('\\n The minimum concentration of boric acid = ',math.ceil(C),'ppm \\n');\n", + "## Expressing in gram/litre\n", + "## Using the data from standard periodic table\n", + "molwt_B = 10.8; ## Molecular weight of Boron(B)\n", + "molwt_O = 16.; ## Molecular weight of Oxygen(O)\n", + "molwt_H = 1.; ## Molecular weight of Hydrogen(H)\n", + "molwt_H3BO3 = (3.*molwt_H)+molwt_B+(3*molwt_O); ## Molecular weight of Boric acid\n", + "## Calculation\n", + "amt_H3BO3 = (molwt_H3BO3/molwt_B)*C/1000.;\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n The shim system must contain \",amt_H3BO3,\" g/litre of boric acid to hold down the reactor. \\n\");\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The minimum concentration of boric acid = 893.00 ppm \n", + "\n", + "\n", + " The shim system must contain 5.11 g/litre of boric acid to hold down the reactor. \n", + "\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg370" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.13\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "p = 0.878; ## Resonance escape probability\n", + "T = 273.+350.; ## Given temeprature converted in Kelvin\n", + "d = 2.8; ## Diameter of rod in cm\n", + "a = d/2.; ## Radius of rod in cm\n", + "rho = 19.1; ## Density of uranium in g/cm^3\n", + "## Using data from Table 7.4 for Uranium-238\n", + "A = 48*10**(-4); ## Constant value\n", + "C = 1.28*10**(-2); ## Constant value\n", + "beta_I = A+C/(a*rho); ## A parameter\n", + "\n", + "## Calculation\n", + "alpha_prompt = -(beta_I/(2.*math.sqrt(T)))*math.log(1./p);\n", + "## Result\n", + "print'%s %.2e %s'%('\\n The prompt temperature coefficient = ',alpha_prompt,' per K \\n');\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The prompt temperature coefficient = -1.38e-05 per K \n", + "\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex14-pg388" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 7.14\n", + "import math\n", + "#calculate the\n", + "\n", + "## Assuming that the fission product poisoning results in 12 barns per original Uranium-235 atom in a time frame of one year\n", + "sigma_p = 12.; ## Microscopic poison cross section in barns\n", + "v = 2.42; ## Average number of neutrons produced in fission\n", + "## Using Table II.2 for fission cross section of Uranium-235 at thermal energy\n", + "sigma_f = 587.; ## Microscopic fission cross section in barns\n", + "## Calculation\n", + "rho = -sigma_p/(v*sigma_f);\n", + "## Result\n", + "print'%s %.2f %s %.2f %s '%(\" \\n The reactivity due to poisons = \",rho,\"\" or \"\",rho*100,\" percent \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The reactivity due to poisons = -0.01 -0.84 percent \n", + " \n" + ] + } + ], + "prompt_number": 17 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter8.ipynb b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter8.ipynb new file mode 100644 index 00000000..1a1ca78a --- /dev/null +++ b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter8.ipynb @@ -0,0 +1,763 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:42da60dddc9ade26e5b8b4147266d1c288065b49878d9d5fa52edab8aff97d78" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter8-Heat Removal from Nuclear Reactors" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg407" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 8.1\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "P = 3025.; ## Reactor thermal power in MW\n", + "w = 136.3*10**6; ## Coolant flow rate in lb/hr\n", + "## According to Table 1.9\n", + "## 1 kW = 3412 Btu/hr\n", + "q = P*1000.*3412.; ## Converting into Btu/hr\n", + "delh = q/w; ## Rise in enthalpy\n", + "## Using the data from Table IV.1 for temperature 542.6 F\n", + "hin = 539.7; ## Enthalpy of input water in Btu/lb\n", + "## Calculation\n", + "hout = hin+delh; ## Enthalpy of released water in Btu/lb\n", + "## From Table IV.1 \n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n \",hout,\" Btu/lb corresponds to 599 F coolant water temperature. \\n\");\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " 615.42 Btu/lb corresponds to 599 F coolant water temperature. \n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg408" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 8.2\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "P = 6.895; ## Pressure of steam in MPa\n", + "w = 2.93*10**6; ## Steam flow rate in kg/hr\n", + "Tin = 190.6+273.; ## Inlet temperature in Kelvin\n", + "\n", + "## 1.\n", + "## Using the data from Table IV.2 \n", + "## Result\n", + "print(\" \\n At a pressure of 6.895 MPa the steam temeperature is 284.86 C \\n\");\n", + "\n", + "## 2. \n", + "## Using the data from Table IV.2 \n", + "hout = 2773.2; ## Enthalpy of spent steam in kJ/kg\n", + "## Using the data from Table IV.1 \n", + "hin = 807.8; ## Enthalpy of inlet steam at Tin in kJ/kg\n", + "## Calculation\n", + "q = w*(hout-hin);\n", + "## Result\n", + "print'%s %.2e %s %.2f %s '%(\" \\n Reactor power is \",q,\" J/hr\" or \"\",q/(3600*1000),\"MW \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " At a pressure of 6.895 MPa the steam temeperature is 284.86 C \n", + "\n", + " \n", + " Reactor power is 5.76e+09 J/hr 1599.62 MW \n", + " \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg413" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 8.3\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "n = 193.*204.; ## Total number of fuel rods in the reactor\n", + "## 1 feet = 12 inches\n", + "R = 67./12.; ## Outer radius of the cylinder in feet(ft)\n", + "H = 144./12.; ## Outer radius of the cylinder in ft\n", + "d = 0.42/12.; ## Diameter of the fuel rod in ft\n", + "a = d/2.; ## Radius of the fuel rod in ft\n", + "P = 1893.; ## Reactor thermal power in MW\n", + "Ed = 180.; ## Energy deposited locally in the fuel per fission in MW(Assumption)\n", + "ER = 200.; ## Recoverable energy per fission in MW(Assumption)\n", + "\n", + "## 1.\n", + "## Calculation\n", + "## According to Table 1.9\n", + "## 1 kW=3412 Btu/hr\n", + "q_r = (2.32*P*Ed)/(n*ER);\n", + "q_max=(q_r*3412.*1000.)/(2.*H*a**2);\n", + "## Result\n", + "print'%s %.2e %s '%(\" \\n Total energy production at the axis = \",q_r*3412*1000,\" Btu/hr\"); print'%s %.2e %s'%(\" \\n Maximum energy production at the axis =\",q_max,\"Btu/hr-ft^3 \\n\");\n", + "\n", + "## 2.\n", + "r = 20./12.; ## Distance from the axis in ft\n", + "j0 =0.825 ## Bessel function\n", + "## Calculation\n", + "## According to Table 1.9\n", + "## 1 kW=3412 Btu/hr\n", + "q_r20 = q_r*j0;\n", + "q_max20 = (q_r20*3412.*1000.)/(2*H*a**2);\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Total energy production at a distance of 20 inches = \",(q_r20*3412*1000),\" Btu/hr\");\n", + "print'%s %.2f %s'%(\" \\n Maximum energy production at a distance of 20 inches = \",q_max20,\" Btu/hr-ft^3 \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Total energy production at the axis = 3.43e+05 Btu/hr \n", + " \n", + " Maximum energy production at the axis = 4.66e+07 Btu/hr-ft^3 \n", + "\n", + " \n", + " Total energy production at a distance of 20 inches = 282589.88 Btu/hr\n", + " \n", + " Maximum energy production at a distance of 20 inches = 38447602.54 Btu/hr-ft^3 \n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg416" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 8.4\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "P0 = 825.; ## Reactor thermal power in MW\n", + "t0 = 1.5*3.16*10**7; ## Reactor operation time in seconds\n", + "ts = 0.1; ## Reactor shutdown time in seconds\n", + "\n", + "## 1.\n", + "## Let P/P0 = q\n", + "## From Figure 8.3\n", + "q_ts = 0.07; ## Fission product to decay power during shutdown time\n", + "q_t0 = 0.0007; ## Fission product to decay power after operating time\n", + "q = q_ts-q_t0; ## Net fission product to decay power\n", + "## Calculation\n", + "P = q*P0;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Decay energy at shutdown = \",P,\" MW\");\n", + "\n", + "## One hour after shutdown \n", + "ts1 = 3.6*10**3; ## Reactor shutdown time in seconds\n", + "## Let P/P0=q\n", + "## From Figure 8.3\n", + "q_ts1 = 0.014; ## Fission product to decay power at shutdown time\n", + "q_t0 = 0.0007; ## Fission product to decay power after operating time\n", + "q1 = q_ts1-q_t0;\n", + "## Calculation\n", + "P1 = q1*P0;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Decay energy one hour after shutdown = \",P1,\" MW\");\n", + "\n", + "## One year after shutdown\n", + "ts2 = 3.16*10**7; ## Reactor shutdown time in seconds\n", + "## Let P/P0=q\n", + "## From Figure 8.3\n", + "q_ts2 = 0.00079; ## Fission product to decay power at shutdown time\n", + "## Now the operating time is t0+ts2 which can be denoted by t01\n", + "q_t01 = 0.00063; ## Fission product to decay power after operating time\n", + "q2 = q_ts2-q_t01;\n", + "## Calculation \n", + "P2 = q2*P0;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Decay energy one year after shutdown = \",P2,\" MW \\n\");\n", + "\n", + "## 2.\n", + "C = 0.88; ## Conversion factor \n", + "## Using data from Table II.2\n", + "sigma_a25 = 681.; ## Microscopic absorption cross section in barns\n", + "sigma_f25 = 582.; ## Microscopic fission cross section in barns\n", + "## At shutdown time\n", + "P_29 = (2.28*10**(-3)*C*(sigma_a25/sigma_f25))*P0;\n", + "P_39 = (2.17*10**(-3)*C*(sigma_a25/sigma_f25))*P0;\n", + "print'%s %.2f %s %.2f %s '%(\" \\n Decay energy at shutdown with effect of Uranium-239 and Neptunium-239 decay =\",P_29,\" MW\" and\"\",P_39,\" MW respectively\");\n", + "\n", + "## One hour after shutdown \n", + "ts1 = 3600.; ## TIme in seconds\n", + "P_291 = P_29*math.exp(-4.9*10**(-4)*ts1);\n", + "P_391 = P_39*(math.exp(-3.41*10**(-6)*ts1)-(7*10**(-3)*math.exp(-4.9*10**(-4)*ts1)));\n", + "print'%s %.2f %s %.2f %s ' %(\" \\n Decay energy one hour after shutdown with effect of Uranium-239 and Neptunium-239 decay = \",P_291,\" MW\" and \"\",P_391,\" MW respectively\");\n", + "\n", + "## One year after shutdown \n", + "P_292 = 0.; ## Half life of Uranium-239 is 23.5 minutes\n", + "P_392 = 0.; ## Half life of Neptunium-239 is 2.35 days\n", + "print'%s %.2f %s %.2f %s '%(\" \\n Decay energy one year after shutdown with effect of Uranium-239 and Neptunium-239 decay = \",P_292,\" MW \"and \"\",P_392,\" MW respectively\");\n", + "## There is a slight deviation in the values as compared with the texbook. This is because of approximation of difference values in the textbook.\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Decay energy at shutdown = 57.17 MW\n", + " \n", + " Decay energy one hour after shutdown = 10.97 MW\n", + " \n", + " Decay energy one year after shutdown = 0.13 MW \n", + "\n", + " \n", + " Decay energy at shutdown with effect of Uranium-239 and Neptunium-239 decay = 1.94 1.84 MW respectively \n", + " \n", + " Decay energy one hour after shutdown with effect of Uranium-239 and Neptunium-239 decay = 0.33 1.82 MW respectively \n", + " \n", + " Decay energy one year after shutdown with effect of Uranium-239 and Neptunium-239 decay = 0.00 0.00 MW respectively \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg426" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 8.5\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "## 1 feet = 12 inches\n", + "d = 0.42/12.; ## Diameter of the fuel rod in feet(ft)\n", + "a = d/2.; ## Radius of the fuel rod in ft\n", + "b = 0.024/12.; ## Thickness of Zircaloy-4 clad in ft\n", + "H = 12.; ## Length of fuel rod in ft\n", + "T_m = 3970.; ## Center temperature of fuel in F\n", + "\n", + "## 1.\n", + "## Using the result of Example 8.3\n", + "q_max = 4.66*10**7; ## Maximum heat flux at the center of the rod in Btu/hr-ft^3\n", + "## Calculation\n", + "q_bar = (a**2*q_max)/(2*(a+b));\n", + "## According to Table 1.9\n", + "## 1 kW=3412 Btu/hr\n", + "## Result\n", + "print'%s %.2f %s %.2f %s ' %(\" \\n Heat flux of the fuel rod = \",q_bar,\" Btu/hr-ft^2\" or \"\",(q_bar*1000)/(3412*30.48**2),\" W/cm^2 \\n\");\n", + "\n", + "## 2.\n", + "## Using the data from Table IV.6\n", + "k_f = 1.1; ## Thermal conductivity of fuel rod in Btu/hr-ft-F\n", + "k_c = 10.; ## Thermal conductivity of cladding in Btu/hr-ft-F\n", + "R_f = 1./(4.*math.pi*H*k_f); ## Thermal resistance of fuel in F-hour/Btu\n", + "R_c = math.log(1.+(b/a))/(2.*math.pi*H*k_c); ## Thermal resistance of cladding in F-hour/Btu\n", + "## Calculation\n", + "T_c = T_m-(q_bar*2*math.pi*(a+b)*H*(R_f+R_c));\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Outer temperature of cladding = \",math.ceil(T_c),\" F \\n\");\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Heat flux of the fuel rod = 365929.49 Btu/hr-ft^2 115.44 W/cm^2 \n", + " \n", + " \n", + " Outer temperature of cladding = 650.00 F \n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg431" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 8.6\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "h = 7500.; ## Heat transfer coefficient in Btu/hr-ft^2-F\n", + "## Using the result of Example 8.5 \n", + "q_bar = 3.66*10**5; ## Heat flux of the fuel rod in Btu/hr-ft^2\n", + "T_c = 650.; ## Outer temperature of cladding in F\n", + "## Calculation\n", + "T_b = T_c-(q_bar/h);\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Temperature of water with respect to the midpoint of the hottest fuel rod = \",T_b,\" F \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Temperature of water with respect to the midpoint of the hottest fuel rod = 601.20 F \n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg435" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 8.7\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "T_b0 = 543.; ## Temperature of inlet coolant in F\n", + "w = 3148.; ## Coolant rate per channel in lb/hr\n", + "\n", + "## 1. \n", + "V_f = 1.15*10**(-2); ## Volume of fueled portion in ft^2\n", + "## Using the result of Example 8.3\n", + "q_max = 4.66*10**7; ## Maximum heat flux at the center of the rod in Btu/hr-ft^3\n", + "## From Table IV.3\n", + "c_p = 1.3; ## Specific heat at constant pressure in Btu/lb-F\n", + "## Calculation \n", + "T_bmax = T_b0+((2*q_max*V_f)/(math.pi*w*c_p));\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Exit temperature of the coolant = \",T_bmax,\" F \\n\");\n", + "\n", + "## 2.\n", + "## Using the data of Example 8.6\n", + "h = 7500.; ## Heat transfer coefficient in Btu/hr-ft^2-F\n", + "## Using the data of Example 8.5\n", + "d = 0.42/12.; ## Diameter of the fuel rod in feet(ft)\n", + "a = d/2.; ## Radius of the fuel rod in ft\n", + "b = 0.024/12.; ## Thickness of Zircaloy-4 clad in ft\n", + "H = 12.; ## Length of fuel rod in ft\n", + "A = 2*math.pi*(a+b)*H; ## Area of the assumed cylinder in ft^2\n", + "R_h = 1/(h*A); ## Convective resistance in F-hour/Btu\n", + "alpha = math.pi*w*c_p*R_h; ## A parameter\n", + "\n", + "## Using the result from Example 8.5 \n", + "R_f = 6.03*10**(-3); ## Thermal resistance of fuel \n", + "R_c = 1.43*10**(-4); ## Thermal resistance of cladding\n", + "R = R_f+R_c+R_h; ## Total resistance\n", + "bet = math.pi*w*c_p*R; ## A parameter denoted by 'beta'\n", + "## Calculation\n", + "T_cmax = T_b0+((q_max*V_f*R_h)*((1+math.sqrt(1+alpha**2))/alpha));\n", + "T_mmax = T_b0+((q_max*V_f*R)*((1+math.sqrt(1+bet**2))/bet));\n", + "## Result\n", + "print'%s %.2f %s %.2f %s '%(\" \\n Maximum temperature of cladding and fuel = \",math.ceil(T_cmax),\" F\" and \"\",T_mmax,\" F respectively. \\n\");\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Exit temperature of the coolant = 626.37 F \n", + "\n", + " \n", + " Maximum temperature of cladding and fuel = 649.00 3941.65 F respectively. \n", + " \n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg438" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 8.8\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "d = 0.42; ## Diameter of the fuel rod in inches\n", + "b = 0.024; ## Thickness of Zircaloy-4 clad in inches\n", + "v = 15.6*3600.; ## Speed of fluid in feet/hour\n", + "a = (d/2.)+b; ## Radius of fuel rods in inches\n", + "P = 2000.; ## Pressure of water in psi\n", + "T = 600.; ## Water temperature in F\n", + "## Using the data from example 8.5 \n", + "s = 0.6; ## Pitch of square array in inches\n", + "D_e = 2.*((s**2-(math.pi*a**2))/(math.pi*a)); ## Equivalent diameter in inches\n", + "## Converting the units in terms of feet \n", + "D_e = D_e/12.;\n", + "## Using tha Table IV.3 at given T and P value\n", + "rho = 42.9; ## Density of fluid in ft/hr\n", + "mu = 0.212; ## Viscosity of fluid in lb/hr-ft\n", + "## Calculation \n", + "Re = (D_e*v*rho)/mu;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Reylonds number = \",Re,\" \\n\");\n", + "if Re >= 10000:\n", + " print(\" \\n As the reylonds number is greater than 10000, the flow is turbulent. \\n\");\n", + "\n", + "## The value is different as compared to the textbook value. This is due to approximation of Reynolds number in the textbook.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Reylonds number = 484329.34 \n", + "\n", + " \n", + " As the reylonds number is greater than 10000, the flow is turbulent. \n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg440" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 8.9\n", + "import math\n", + "#calculate the\n", + "\n", + "## Using the data from Example 8.8\n", + "s = 0.6; ## Pitch of square lattice in inches\n", + "d = 0.42; ## Diameter of the fuel rod in inches\n", + "b = 0.024; ## Thickness of Zircaloy-4 clad in inches\n", + "a = (d/2)+b; ## Radius of fuel rods in inches \n", + "D_e = 0.0427; ## Equivalent diameter in feet\n", + "Re = 484329; ## Reynolds number\n", + "PD = s/(2*a); ## The ratio of pitch to diameter of fuel rod\n", + "## For a square lattice\n", + "C = 0.042*PD-0.024; ## A constant\n", + "\n", + "## According to Table IV.3\n", + "c_p = 1.45; ## Specific heat at constant pressure in Btu/lb-F\n", + "mu = 0.212; ## Viscosity of fluid in lb/hr-ft\n", + "k = 0.296; ## Conductivity of fluid in Btu/hr-ft F\n", + "Pr=(c_p*mu)/k; ## Prandtl number\n", + "## The constants are assumed as\n", + "m = 0.8; \n", + "n = 1/3;\n", + "## Calculation\n", + "h = C*(k/D_e)*(Re)**m*Pr**n;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Heat transfer coefficient = \",h,\" Btu/hr-ft^2-F\\n\");\n", + "## The value is different as compared to the textbook value. This is due to approximation of Reynolds number in the textbook and in this problem actual value is considered.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Heat transfer coefficient = 7309.11 Btu/hr-ft^2-F\n", + "\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg448" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 8.10\n", + "import math\n", + "#calculate the\n", + "\n", + "## Using the data from Example 8.3 to 8.8\n", + "P = 2000.; ## Pressure in psi\n", + "v = 15.6; ## Coolant velocity in ft/sec\n", + "D_e = 0.0427; ## Equivalent diameter in ft\n", + "d = 0.42; ## Diameter of the fuel rod in inches\n", + "b = 0.024; ## Thickness of Zircaloy-4 clad in inches\n", + "a = (d/2.)+b; ## Radius of fuel rods in inches \n", + "T_b = 600.; ## Bulk temeperature in F \n", + "\n", + "## 1.\n", + "## Using Bernath correlation\n", + "## Calculation\n", + "T_wc = 102.6*math.log(P)-((97.2*P)/(P+15.))-(0.45*v)+32.;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Cladding temeperature = \",T_wc,\" F\\n\");\n", + "\n", + "## 2.\n", + "D_i = (2.*math.pi*a)/(math.pi*12.); ## Heated perimeter is (2*%pi*a)/12 in feet \n", + "## Calculation\n", + "h_c = 10890.*((D_e)/(D_e+D_i))+((48.*v)/D_e**0.6);\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Heat transfer coefficient = \",h_c,\" Btu/hr-ft^2-F\\n\");\n", + "\n", + "## 3.\n", + "## Calculation\n", + "q_c = h_c*(T_wc-T_b);\n", + "## Result\n", + "print'%s %.2e %s'%(\" \\n Critical heat flux = \",q_c,\" Btu/hr-ft^2\\n\");\n", + "## In the textbook, the unit of critical heat flux is wrong.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Cladding temeperature = 708.36 F\n", + "\n", + " \n", + " Heat transfer coefficient = 10658.76 Btu/hr-ft^2-F\n", + "\n", + " \n", + " Critical heat flux = 1.15e+06 Btu/hr-ft^2\n", + "\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg454" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 8.11\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "m_lbar = 0.457; ## Average linear density of UO2 in lb/ft\n", + "sigma = 0.0122; ## Standard deviation of set of measured linear densities of UO2\n", + "## Calculation\n", + "F_Eml = 1.+(3.*sigma)/m_lbar;\n", + "print'%s %.2f %s'%(\" \\n Engineering subfactor for the amount of fissile material = \",F_Eml,\" \\n\");\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Engineering subfactor for the amount of fissile material = 1.08 \n", + "\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg457" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 8.12\n", + "import math\n", + "#calculate the\n", + "\n", + "q_max = 539000.; ## Maximum heat flux Btu/hr-ft^2\n", + "F = 2.8; ## Hot channel factor\n", + "P = 3000.; ## Reactor thermal power in MW\n", + "## Expressing in Btu/hr\n", + "## According to Table 1.9, 1 kW = 3412 Btu/hr\n", + "P = P*3.412*10**6; ## Reactor thermal power in Btu/hr\n", + "l = 12.; ## Length of fuel rod in ft\n", + "d = 0.5/12.; ## Diameter of fuel rod in ft\n", + "r = d/2.; ## Radius of fuel rod in ft\n", + "\n", + "## 1.\n", + "q_av = q_max/F;\n", + "## Calculation\n", + "A = P/q_av;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Total heat transfer area = \",A,\" ft^2\\n\");\n", + "\n", + "## 2.\n", + "A_one = 2.*math.pi*r; ## The total surface area of one fuel rod\n", + "## Calculation \n", + "n = A/A_one;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Number of fuel rods = \",n,\" \\n\"); \n", + "## The value is different as compared to the textbook value. This is due to approximation of total heat transfer area in the textbook and in this problem actual value is considered. As total heat transfer area is further used to calculate number of fuel rods, therefore the difference in value exists.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Total heat transfer area = 53174.03 ft^2\n", + "\n", + " \n", + " Number of fuel rods = 406219.64 \n", + "\n" + ] + } + ], + "prompt_number": 16 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter9.ipynb b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter9.ipynb new file mode 100644 index 00000000..4779f851 --- /dev/null +++ b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter9.ipynb @@ -0,0 +1,795 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f8071cbb973f7edab174c90f7449b49a3ab18584f970adf40bc2a01bc3729a4e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter9-Radiation Protection" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg470" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.1\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "e = 1.6*10**(-19); ## Electronic charge in couloumb(coul)\n", + "X = 1*10**(-3)/3600.; ## Exposure rate in terms of R/sec\n", + "## According to the definition of Roentgen, 1 R = 2.58*10^(-7) coul/g \n", + "R = 2.58*10**(-7);\n", + "## From standard table\n", + "## There is 0.001293 g of air per 1 cm^3 at 1 atmospheric pressure at 0 C \n", + "density_air = 0.001293;\n", + "## Calculation\n", + "IR = (X*R*density_air)/e;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Rate of ions produced from gamma ray interaction = \",IR,\" ions/cm^3-sec\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Rate of ions produced from gamma ray interaction = 579.16 ions/cm^3-sec\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg475" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.2\n", + "import math\n", + "#calculate the\n", + "\n", + "## According to the definition of radiation absorbed dose(rad), 1 rad/sec = 100 ergs/g-sec\n", + "## Given data\n", + "D = 5.*10**(-3)/100.; ## Absorbed dose in terms of rad/sec\n", + "## Expressing absorbed dose rate in SI units\n", + "## 1 Gray(Gy) = 100 rad \n", + "D_dot = D*3600./100.;\n", + "## Using data from Table 9.2\n", + "Q = 1.; ## Quality factor for gamma rays for tissue\n", + "## Calculation\n", + "H_dot = D_dot*Q;\n", + "print'%s %.2f %s'%(' \\n Absorbed dose rate in a tissue = ',D_dot*1000,' mGy/hr \\n');\n", + "print'%s %.2f %s'%(' \\n Dose equivalent rate in a tissue = ',H_dot*1000,' mSv/hr \\n');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Absorbed dose rate in a tissue = 1.80 mGy/hr \n", + "\n", + " \n", + " Dose equivalent rate in a tissue = 1.80 mSv/hr \n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg495" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.3\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "H = 25; ## Equivalent dose in rem\n", + "age = 30; ## Age of worker in years\n", + "exp_age = 77; ## Average age upto which a person lives in years\n", + "## Using data from Table 9.6\n", + "## Bone cancer\n", + "rc_bone = 0.2; ## Risk coefficient per 10^6 rem/year\n", + "lp_bone = 10; ## Latent period in years\n", + "## Probability of dying from bone cancer \n", + "p_bone=(H*rc_bone*(exp_age-(lp_bone+age)))/10**6;\n", + "\n", + "## Breast cancer\n", + "rc_breast = 1.5; ## Risk coefficient per 10^6 rem/year\n", + "lp_breast = 15.; ## Latent period in years\n", + "## Probability of dying from breast cancer \n", + "p_breast = (H*rc_breast*(exp_age-(lp_breast+age)))/10**6;\n", + "\n", + "## Leukemia\n", + "rc_leukemia = 1.; ## Risk coefficient per 10^6 rem/year\n", + "lp_leukemia = 2.; ## Latent period in years\n", + "## Probability of dying from leukemia \n", + "p_leukemia = (H*rc_leukemia*(exp_age-(lp_leukemia+age)))/10**6;\n", + "\n", + "## Lung cancer\n", + "rc_lung = 1.; ## Risk coefficient per 10^6 rem/year\n", + "lp_lung = 15.; ## Latent period in years\n", + "## Probability of dying from lung cancer\n", + "p_lung = (H*rc_lung*(exp_age-(lp_lung+age)))/10**6;\n", + "\n", + "## Pancreatic cancer\n", + "rc_pancreas = 0.2; ## Risk coefficient per 10^6 rem/year\n", + "lp_pancreas = 15.; ## Latent period in years\n", + "## Probability of dying from Pancreatic cancer\n", + "p_pancreas = (H*rc_pancreas*(exp_age-(lp_pancreas+age)))/10**6;\n", + "\n", + "## Stomach cancer\n", + "rc_stomach = 0.6; ## Risk coefficient per 10^6 rem/year\n", + "lp_stomach = 15.; ## Latent period in years\n", + "## Probability of dying from stomach cancer\n", + "p_stomach = (H*rc_stomach*(exp_age-(lp_stomach+age)))/10**6;\n", + "\n", + "## Rest of alimentary cancer\n", + "rc_ali = 0.2; ## Risk coefficient per 10^6 rem/year\n", + "lp_ali = 15.; ## Latent period in years\n", + "## Probability of dying from rest of alimentary cancer\n", + "p_ali = (H*rc_ali*(exp_age-(lp_ali+age)))/10**6;\n", + "\n", + "## Thyroid cancer\n", + "rc_thy = 0.43; ## Risk coefficient per 10^6 rem/year\n", + "lp_thy = 10.; ## Latent period in years\n", + "## Probability of dying from thyroid cancer\n", + "p_thy = (H*rc_thy*(exp_age-(lp_thy+age)))/10**6;\n", + "\n", + "## All other type of cancer\n", + "rc_other = 1.; ## Risk coefficient per 10^6 rem/year\n", + "lp_other = 15.; ## Latent period in years\n", + "## Probability of dying from all other type of cancer\n", + "p_other = (H*rc_other*(exp_age-(lp_other+age)))/10**6;\n", + "\n", + "## Calculation\n", + "p = p_bone+p_breast+p_leukemia+p_lung+p_pancreas+p_stomach+p_ali+p_thy+p_other;\n", + "## Result\n", + "print'%s %.2f %s'%('\\n Probability that the worker will die from cancer = ',p,' \\n');\n", + "\n", + "## The value obtained is different from the value given in the textbook. This is because of approximation of individual probabilities in the textbook.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Probability that the worker will die from cancer = 0.01 \n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg496" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.4\n", + "import math\n", + "#calculate the\n", + "H = 1.; ## Equivalent dos in rem\n", + "n = 10**6; ## Population\n", + "## Given data\n", + "\n", + "## Using the data of number of expected deaths of leukemia per 10^6 people from Table 9.9\n", + "## In utero age group\n", + "frac_utero = 0.011; ## Fraction of population\n", + "riskyr_utero = 10.; ## Risk years\n", + "riskcoef_utero = 15.; ## Risk coefficient\n", + "## Number of deaths in utero is given by\n", + "deaths_utero = frac_utero*riskyr_utero*riskcoef_utero;\n", + "\n", + "## In 0-0.99 age group\n", + "frac_0_099 = 0.014; ## Fraction of population\n", + "riskyr_0_099 = 25.; ## Risk years\n", + "riskcoef_0_099 = 2.; ## Risk coefficient\n", + "## Number of deaths in 0-0.99 age group is given by\n", + "deaths_0_099 = frac_0_099*riskyr_0_099*riskcoef_0_099;\n", + "\n", + "## In 1-10 age group\n", + "frac_1_10 = 0.146; ## Fraction of population\n", + "riskyr_1_10 = 25.; ## Risk years\n", + "riskcoef_1_10 = 2.; ## Risk coefficient\n", + "## Number of deaths in 1-10 age group is given by\n", + "deaths_1_10=frac_1_10*riskyr_1_10*riskcoef_1_10;\n", + "\n", + "## In 11-20 age group\n", + "frac_11_20 = 0.196; ## Fraction of population\n", + "riskyr_11_20 = 25.; ## Risk years\n", + "riskcoef_11_20 = 1.; ## Risk coefficient\n", + "## Number of deaths in 11-20 age group is given by\n", + "deaths_11_20=frac_11_20*riskyr_11_20*riskcoef_11_20;\n", + "\n", + "## In 21-30 age group\n", + "frac_21_30 = 0.164; ## Fraction of population\n", + "riskyr_21_30 = 25.; ## Risk years\n", + "riskcoef_21_30 = 1.; ## Risk coefficient\n", + "## Number of deaths in 21-30 age group is given by\n", + "deaths_21_30=frac_21_30*riskyr_21_30*riskcoef_21_30;\n", + "\n", + "## In 31-40 age group\n", + "frac_31_40 = 0.118; ## Fraction of population\n", + "riskyr_31_40 = 25.; ## Risk years\n", + "riskcoef_31_40 = 1.; ## Risk coefficient\n", + "## Number of deaths in 31-40 age group is given by\n", + "deaths_31_40=frac_31_40*riskyr_31_40*riskcoef_31_40;\n", + "\n", + "## In 41-50 age group\n", + "frac_41_50 = 0.109; ## Fraction of population\n", + "riskyr_41_50 = 25.; ## Risk years\n", + "riskcoef_41_50 = 1.; ## Risk coefficient\n", + "## Number of deaths in 41-50 age group is given by\n", + "deaths_41_50 = frac_41_50*riskyr_41_50*riskcoef_41_50;\n", + "\n", + "## In 51-60 age group\n", + "frac_51_60 = 0.104; ## Fraction of population\n", + "riskyr_51_60 = 22.5; ## Risk years\n", + "riskcoef_51_60 = 1.; ## Risk coefficient\n", + "## Number of deaths in 51-50 age group is given by\n", + "deaths_51_60 = frac_51_60*riskyr_51_60*riskcoef_51_60;\n", + "\n", + "## In 61-70 age group\n", + "frac_61_70 = 0.08;\n", + "riskyr_61_70 = 15.1;\n", + "riskcoef_61_70 = 1.; ## Risk coefficient\n", + "## Number of deaths in 61-70 age group is given by\n", + "deaths_61_70=frac_61_70*riskyr_61_70*riskcoef_61_70;\n", + "\n", + "## In 71-80 age group\n", + "frac_71_80 = 0.044; ## Fraction of population\n", + "riskyr_71_80 = 9.1; ## Risk years\n", + "riskcoef_71_80 = 1.; ## Risk coefficient\n", + "## Number of deaths in 71-80 age group is given by\n", + "deaths_71_80 = frac_71_80*riskyr_71_80*riskcoef_71_80;\n", + "\n", + "## Age greater than 80\n", + "frac_80 = 0.02; ## Fraction of population\n", + "riskyr_80 = 4.5; ## Risk years\n", + "riskcoef_80 = 1.; ## Risk coefficient\n", + "## Number of deaths with age greater than 80 years is given by\n", + "deaths_80=frac_80*riskyr_80*riskcoef_80;\n", + "\n", + "## Calculation\n", + "total_deaths = deaths_utero+deaths_0_099+deaths_1_10+deaths_11_20+deaths_21_30+deaths_31_40+deaths_41_50+deaths_51_60+deaths_61_70+deaths_71_80+deaths_80;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Number of cases or deaths expected from leukemia = \",total_deaths,\" \\n\");\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Number of cases or deaths expected from leukemia = 28.36 \n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg498" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.5\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "H_year = 5.; ## Equiavelnt dose per year in rem\n", + "start_age = 18.; ## Initial age of the worker in years\n", + "ret_age = 68.; ## Retirement age of the worker in years\n", + "## Using data from Table 9.6 with respect to Bone cancer\n", + "latent_period = 10.; ## Latent period in years\n", + "plateau_period = 30.; ## Plateau period in years\n", + "rc_bone = 0.2; ## Risk coefficient per 10^6 rem/year\n", + "\n", + "n = ret_age-(start_age+latent_period); ## Number of years of accumulated dose\n", + "H = n*H_year; ## Total equivalent dose in rem\n", + "## Calculation\n", + "p_bone = (H*rc_bone*plateau_period)/10**6;\n", + "## Result\n", + "print'%s %.2e %s'%(\" \\n The probability of dying from bone cancer = \",p_bone,\" \\n\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The probability of dying from bone cancer = 1.20e-03 \n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg513" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.6\n", + "import math\n", + "\n", + "## Given data\n", + "E =2. ; ## Energy of gamma radiation in MeV\n", + "X_dot = 1.; ## Exposure rate in mR/hour\n", + "## Using the data from Table II.5\n", + "## Let mu_a/rho of air at 2 Mev be denoted as mu_rho\n", + "mu_rho = 0.0238; ## Ratio of absorption coefficient to sensity of air in cm^2/g\n", + "## Calculation\n", + "I = X_dot/(E*mu_rho*0.0659);\n", + "print'%s %.2f %s'%(\" \\n The beam intensity of gamma radiation required = \",math.ceil(I),\" gamma rays/cm^2-sec \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The beam intensity of gamma radiation required = 319.00 gamma rays/cm^2-sec \n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg515" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.7\n", + "import math\n", + "\n", + "## Given data\n", + "phi = 2.4*10**5; ## Flux in x-rays/cm^2-sec\n", + "## From Figure 9.9\n", + "## To receive an exposure rate of 1 mR/hr at 50 keV, the flux is 8*10^3 x-rays/cm^2-sec\n", + "phi_eq = 8*10**3; ## Equivalent flux in x-rays/cm^2-sec\n", + "X_dot_eq = 1.; ## Equivalent Exposure rate in mR/hr\n", + "X_dot = (phi*X_dot_eq)/phi_eq; ## Exposure rate of the operator in mR/hr\n", + "## From Figure 9.10 at 50 kV energy, the energy dependent function is\n", + "f_bone = 3.3;\n", + "f_muscle = 0.93;\n", + "f_fat = 0.9;\n", + "## Using data from Table 9.2\n", + "Q = 1.; ## Quality factor for x-rays\n", + "## Calculation\n", + "D_dot_bone = X_dot*f_bone*Q; ## Dose equivalent rate in bone\n", + "D_dot_muscle = X_dot*f_muscle*Q; ## Dose equivalent rate in muscle\n", + "D_dot_fat = X_dot*f_fat*Q; ## Dose equivalent rate in fat\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Dose equivalent rate in bone = \",math.ceil(D_dot_bone),\" mrem/hour \\n\");\n", + "print'%s %.2f %s'%(\" \\n Dose equivalent rate in muscle = \",math.ceil(D_dot_muscle),\" mrem/hour \\n\");\n", + "print'%s %.2f %s'%(\" \\n Dose equivalent rate in fat = \",math.ceil(D_dot_fat),\" mrem/hour \\n\");\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Dose equivalent rate in bone = 99.00 mrem/hour \n", + "\n", + " \n", + " Dose equivalent rate in muscle = 28.00 mrem/hour \n", + "\n", + " \n", + " Dose equivalent rate in fat = 27.00 mrem/hour \n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg518" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.8\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "phi_n = 20.; ## Given neutron flux in neutrons/cm^2-sec\n", + "## From Figure 9.12\n", + "## To receive an dose equivalent rate of 1 mrem/hr, the fast neutron flux is 7 neutrons/cm^2-sec\n", + "phi_n_eq = 7.;\n", + "D_dot_eq = 1.; \n", + "D_dot_n = (phi_n*D_dot_eq)/phi_n_eq; ## Dose rate due to fast neutron flux in mrem/hr\n", + "phi_th = 300.; ## Given thermal flux in neutrons/cm^2-sec\n", + "## From Figure 9.12\n", + "## To receive an dose equivalent rate of 1 mrem/hr, the thermal flux is 260 neutrons/cm^2-sec\n", + "phi_th_eq = 260.;\n", + "D_dot_th = (phi_th*D_dot_eq)/phi_th_eq; ## Dose rate due to thermal neutron flux in mrem/hr\n", + "D_dot = D_dot_n+D_dot_th; ## Total dose rate in mrem/hr\n", + "print(\"\\n The permitted weekly dose is 100 mrem \\n\");\n", + "D_dot_perm = 100.;\n", + "## Calculation\n", + "t = D_dot_perm/D_dot;\n", + "print'%s %.2f %s'%(\" \\n The time of exposure upto a safe level = \",t,\" hour \\n\");\n", + "## The answer given in the textbook is wrong. This is because of wrong computation of total dose rate\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The permitted weekly dose is 100 mrem \n", + "\n", + " \n", + " The time of exposure upto a safe level = 24.93 hour \n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg520" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.9\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "fluence = 10**8; ## Given fluence neutrons/cm^2\n", + "## From Figure 9.12\n", + "## To receive an dose equivalent rate of 1 mrem/hr, the fast neutron flux is 7 neutrons/cm^2-sec\n", + "phi_eq = 7.; ## Equivalent flux in neutrons/cm^2-sec\n", + "D_eq = 1.; ## Equivalent dose rate in mrem/hr\n", + "## 1 hour = 3600 seconds\n", + "fluence_eq = phi_eq*3600.; ## Equivalent fluence in neutrons/cm^2\n", + "## Calculation \n", + "D = (fluence*D_eq)/fluence_eq;\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n Dose received due to exposure of accelerator source = \",D,\" mrem \\n\");\n", + "## The answer given in textbook is approximated to a nearest value.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Dose received due to exposure of accelerator source = 3968.25 mrem \n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg525" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.10\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "M = 20.; ## Mass of organ in grams\n", + "\n", + "## a)\n", + "## Using the data from Table 9.15\n", + "T_12 = 8.04; ## Radiological half life of Iodine-131 in days\n", + "T_12_b = 138.; ## Biological half life of Iodine-131 in days\n", + "lambd = 0.693/T_12; ## Radiological decay constant of Iodine-131 in days^-1\n", + "lambda_b = 0.693/T_12_b; ## Biological decay constant of Iodine-131 in days^-1\n", + "lambda_e = lambd+lambda_b; ## Equivalent decay constant in days^-1\n", + "## Using the data from Table 9.15\n", + "zeta = 0.23; ## Effective energy equivalent in MeV\n", + "q = 0.23; ## The fraction of Iodine-131 that goes by inhalation\n", + "## Calculation\n", + "DCF = (51.1*zeta*q)/(M*lambda_e);\n", + "## Result\n", + "print'%s %.2f %s'%(\" \\n The dose commitment factor by inhalation = \",DCF,\" rem/ucurie \\n\");\n", + "\n", + "## b) \n", + "breathing_rate = 2.32*10**(-4); ## Normal breathing rate in m^3/sec\n", + "time = 2*3600.; ## Time of radiation exposure in seconds\n", + "I_conc = 2*10**(-9); ## Iodine-131 concentration\n", + "C0 = breathing_rate*time*I_conc; ## Total intake of Iodine-131 by inhalation \n", + "## Calculation\n", + "H = C0*(DCF*10**6); ## Using DCF in micro-curie\n", + "## Result\n", + "print'%s %.2f %s %.2f %s '%(\" \\n The dose commitment to thyroid = \",H,\"\" and \" rem = \",H*1000,\" mrem \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " The dose commitment factor by inhalation = 1.48 rem/ucurie \n", + "\n", + " \n", + " The dose commitment to thyroid = 0.00 4.95 mrem \n", + " \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg529" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.11\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "V_W = 2200.; ## Volume of water inatke in terms of cm^3/day\n", + "## 1 litre = 1000 gram(g)\n", + "M = 43.*1000.; ## Mass of water present in standard man according to standards\n", + "## Using the data from Table 9.13\n", + "MPD = 0.1/7.; ## Maximum Permissible Dose (MPD) in rem/day\n", + "## Using the data from Table 9.15\n", + "zeta = 0.01; ## Effective energy equivalent in MeV\n", + "q = 1.; ## The fraction of Tritium that goes inside by ingestion\n", + "T_b = 11.9; ## Biological Half life of Tritium in years\n", + "lambda_b = 0.693/T_b; ## Biological decay constant of Tritium in years^-1 \n", + "\n", + "## As biological and radiological half lives are less than 50 year intake period, the exponential term (exp(-lambda_e*50)) is neglected\n", + "## Maximum Permissible Concentration(MPC) for a 7 day or 168 hour week tritium dose \n", + "MPC_w_168 = (lambda_b*M*MPD)/(51.1*V_W*zeta*q);\n", + "print'%s %.2f %s'%(\"\\n Maximum Permissible Concentration(MPC) for a 7 day or 168 hour week tritium dose for occupational purpose = \",MPC_w_168,\" uCi/cm^3 \\n\");\n", + "## The exposure at work is doubled for 40 hour week as compared to 168 hour week \n", + "## For 40 hour week, with work of 5 days out of 7 day week according to a study\n", + "MPC_w_40 = MPC_w_168*2.*(7/5.);\n", + "print'%s %.2f %s'%(\"\\n Maximum Permissible Concentration(MPC) for a 40 hour week tritium dose for occupational purpose = \",MPC_w_40,\" uCi/cm^3 \\n\");\n", + "\n", + "## By analyzing the data of Table 9.13\n", + "## The whole body dose of general public is one tenth of the occupational purpose.\n", + "MPC_w_168_gp = MPC_w_168*0.1;\n", + "print'%s %.2f %s'%(\"\\n Maximum Permissible Concentration(MPC) for a 7 day or 168 hour week tritium dose for general public = \",MPC_w_168_gp,\" uCi/cm^3 \\n\");\n", + "## The answer of Maximum Permissible Concentration(MPC) for a 168 hour week tritium dose for general public is given wrong in the textbook.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Maximum Permissible Concentration(MPC) for a 7 day or 168 hour week tritium dose for occupational purpose = 0.03 uCi/cm^3 \n", + "\n", + "\n", + " Maximum Permissible Concentration(MPC) for a 40 hour week tritium dose for occupational purpose = 0.09 uCi/cm^3 \n", + "\n", + "\n", + " Maximum Permissible Concentration(MPC) for a 7 day or 168 hour week tritium dose for general public = 0.00 uCi/cm^3 \n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg534" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.12\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "no_home = 10**6; ## Number of houses\n", + "no_resident = 4.; ## Number of residents in a home\n", + "total_time = 50.; ## Number of years the analysis is carried out\n", + "radon_concn_old = 1.; ## Radon concentration in older uninsulated homes in terms of pCi/l\n", + "radon_concn_new = 6.; ## Radon concentration in modern insulated homes in terms of pCi/l\n", + "time = 3500.; ## Time spent in home by a person per year in hours\n", + "eq_concn = 0.5; ## Equilibrium concentration of 50% \n", + "## 1 year = 24*365 hours\n", + "X_increased = eq_concn*(radon_concn_new-radon_concn_old)*(time/(24.*365.)); ## The increased exposure of radon per person\n", + "\n", + "## Using the data of Radon risk assessment of United States of America\n", + "## There are nearly 100 cases of cancer per 10^6 persons at 1 pCi-year dose.\n", + "## Calculation\n", + "no_cancer = (no_home*no_resident)*total_time*(100./10**6)*X_increased;\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n Number of additional cases of cancer from insulation of home = \",no_cancer,\" \\n\");\n", + "## There is a slight deviation in the value given in the textbook. This is because of approximation of the number of additional cases of cancer in the textbook.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Number of additional cases of cancer from insulation of home = 19977.17 \n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg535" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "## Example 9.13\n", + "import math\n", + "#calculate the\n", + "\n", + "## Given data\n", + "H_ext = 3.; ## External dose in rem\n", + "H_wbL = 5.; ## Annual whole body dose limit in rem\n", + "## Using the data from Table 9.17\n", + "## Annual Limit Intake (ALI) for inhalation of Iodine-131 is 54uCurie (Ci)\n", + "ALI = 54.;\n", + "## Calculation\n", + "I = ALI*(1.-(H_ext/H_wbL));\n", + "## Result\n", + "print'%s %.2f %s'%(\"\\n Amount of Iodine-131 intake within safety limits = \",math.ceil(I),\" uCi \\n\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Amount of Iodine-131 intake within safety limits = 22.00 uCi \n", + "\n" + ] + } + ], + "prompt_number": 13 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter10.png b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter10.png new file mode 100644 index 00000000..ca0fe4ce Binary files /dev/null and b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter10.png differ diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter11.png b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter11.png new file mode 100644 index 00000000..48036db1 Binary files /dev/null and b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter11.png differ diff --git a/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter2.png b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter2.png new file mode 100644 index 00000000..3c50846a Binary files /dev/null and b/Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter2.png differ diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects.ipynb new file mode 100755 index 00000000..a8a6de1f --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects.ipynb @@ -0,0 +1,1241 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8f7be8ab30cd8a38b71c7dbac3729da70ed4826b62dcb4d9b30b32010c83c291" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Chapter 10- Classes and objects" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- student.cpp, Page no-344" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class student: #member functions definition inside the body\n", + " __roll_no=int\n", + " __name=[None]*20\n", + " def setdata(self, roll_no_in, name_in):\n", + " self.roll_no=roll_no_in\n", + " self.name=name_in\n", + " def outdata(self):\n", + " print \"Roll no =\", self.roll_no\n", + " print \"Name =\", self.name\n", + "s1=student() #object of class student\n", + "s2=student()\n", + "s1.setdata(1, \"Tejaswi\") #invoking member functions\n", + "s2.setdata(10, \"Rajkumar\")\n", + "print \"Student details...\"\n", + "s1.outdata()\n", + "s2.outdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student details...\n", + "Roll no = 1\n", + "Name = Tejaswi\n", + "Roll no = 10\n", + "Name = Rajkumar\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-rect.cpp, Page no-345" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class rect:\n", + " __length=int\n", + " __breadth=int\n", + " def read(self, i, j):\n", + " self.__length=i\n", + " self.__breadth=j\n", + " def area(self):\n", + " return self.__length*self.__breadth\n", + "r=rect()\n", + "x, y=[int(x) for x in raw_input(\"Enter the length and breadth of the reactangle: \").split()]\n", + "r.read(x,y)\n", + "print \"Area of the rectangle =\", r.area()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the length and breadth of the reactangle: 4 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of the rectangle = 40\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-date1.cpp, Page no-348" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class date:\n", + " __day=int\n", + " __month=int\n", + " __year=int\n", + " def Set(self, DayIn, MonthIn, YearIn):\n", + " self.__day=DayIn\n", + " self.__month=MonthIn\n", + " self.__year=YearIn\n", + " def show(self):\n", + " print \"%s-%s-%s\" %(self.__day, self.__month, self.__year)\n", + "d1=date()\n", + "d2=date()\n", + "d3=date()\n", + "d1.Set(26, 3, 1958)\n", + "d2.Set(14, 4, 1971)\n", + "d3.Set(1, 9, 1973)\n", + "print \"Birth Date of First Author: \",\n", + "d1.show()\n", + "print \"Birth Date of Second Author: \",\n", + "d2.show()\n", + "print \"Birth Date of Third Author: \",\n", + "d3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth Date of First Author: 26-3-1958\n", + "Birth Date of Second Author: 14-4-1971\n", + "Birth Date of Third Author: 1-9-1973\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-date2.cpp, Page no-350" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Set(self, DayIn, MonthIn, YearIn):\n", + " self.__day=DayIn\n", + " self.__month=MonthIn\n", + " self.__year=YearIn\n", + "def show(self):\n", + " print \"%s-%s-%s\" %(self.__day, self.__month, self.__year)\n", + "class date:\n", + " __day=int\n", + " __month=int\n", + " __year=int\n", + " Set=Set #definiton of member function outside the class\n", + " show=show\n", + "d1=date()\n", + "d2=date()\n", + "d3=date()\n", + "d1.Set(26, 3, 1958)\n", + "d2.Set(14, 4, 1971)\n", + "d3.Set(1, 9, 1973)\n", + "print \"Birth Date of First Author: \",\n", + "d1.show()\n", + "print \"Birth Date of Second Author: \",\n", + "d2.show()\n", + "print \"Birth Date of Third Author: \",\n", + "d3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth Date of First Author: 26-3-1958\n", + "Birth Date of Second Author: 14-4-1971\n", + "Birth Date of Third Author: 1-9-1973\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-date3.cpp, Page no-352" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Set(self, DayIn, MonthIn, YearIn):\n", + " self.__day=DayIn\n", + " self.__month=MonthIn\n", + " self.__year=YearIn\n", + "def show(self):\n", + " print self.__day, \"-\", self.__month, \"-\", self.__year\n", + "class date:\n", + " __day=int\n", + " __month=int\n", + " __year=int\n", + " Set=Set\n", + " show=show\n", + "d1=date()\n", + "d2=date()\n", + "d3=date()\n", + "d1.Set(26, 3, 1958)\n", + "d2.Set(14, 4, 1971)\n", + "d3.Set(1, 9, 1973)\n", + "print \"Birth Date of First Author: \",\n", + "d1.show()\n", + "print \"Birth Date of Second Author: \",\n", + "d2.show()\n", + "print \"Birth Date of Third Author: \",\n", + "d3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth Date of First Author: 26 - 3 - 1958\n", + "Birth Date of Second Author: 14 - 4 - 1971\n", + "Birth Date of Third Author: 1 - 9 - 1973\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-nesting.cpp, Page no-354" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class NumberParis:\n", + " __num1=int\n", + " __num2=int\n", + " def read(self):\n", + " self.__num1=int(raw_input(\"Enter First Number: \"))\n", + " self.__num2=int(raw_input(\"Enter Second Number: \"))\n", + " def Max(self):\n", + " if self.__num1>self.__num2:\n", + " return self.__num1\n", + " else:\n", + " return self.__num2\n", + " def ShowMax(self):\n", + " print \"Maximum =\", self.Max() #invoking a member function in another member function\n", + "n1=NumberParis()\n", + "n1.read()\n", + "n1.ShowMax()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter First Number: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Second Number: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum = 10\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-part.cpp, Page no-355" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class part:\n", + " __ModelNum=int #private members\n", + " __PartNum=int\n", + " __cost=float\n", + " def SetPart(self, mn, pn, c):\n", + " self.__ModelNum=mn\n", + " self.__PartNum=pn\n", + " self.__cost=c\n", + " def ShowPart(self):\n", + " print \"Model:\", self.__ModelNum\n", + " print \"Part:\", self.__PartNum\n", + " print \"Cost:\", self.__cost\n", + "p1=part()\n", + "p2=part()\n", + "p1.SetPart(1996, 23, 1250.55)\n", + "p2.SetPart(2000, 243, 2354.75)\n", + "print \"First Part Details...\"\n", + "p1.ShowPart()\n", + "print \"Second Part Details...\"\n", + "p2.ShowPart()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First Part Details...\n", + "Model: 1996\n", + "Part: 23\n", + "Cost: 1250.55\n", + "Second Part Details...\n", + "Model: 2000\n", + "Part: 243\n", + "Cost: 2354.75\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector.cpp, Page no-361" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def read(self):\n", + " for i in range(self._vector__sz):\n", + " print \"Enter vector [\", i, \"]? \",\n", + " self._vector__v[i]=int(raw_input())\n", + "def show_sum(self):\n", + " Sum=0\n", + " for i in range(self._vector__sz):\n", + " Sum+=self._vector__v[i]\n", + " print \"Vector sum =\", Sum\n", + "class vector:\n", + " __v=[int] #array of type integer\n", + " __sz=int\n", + " def VectorSize(self, size):\n", + " self.__sz= size\n", + " self.__v=[int]*size #dynamically allocating size to integer array\n", + " def release(self):\n", + " del self.__v\n", + " read=read\n", + " show_sum=show_sum\n", + "v1=vector()\n", + "count=int(raw_input(\"How many elements are there in the vector: \"))\n", + "v1.VectorSize(count)\n", + "v1.read()\n", + "v1.show_sum()\n", + "v1.release()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many elements are there in the vector: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter vector [ 0 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 1 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 2 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 3 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 4 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Vector sum = 15\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-distance.cpp, Page no-363" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class distance:\n", + " __feet=float\n", + " __inches=float\n", + " def init(self, ft, In):\n", + " self.__feet=ft\n", + " self.__inches=In\n", + " def read(self):\n", + " self.__feet=float(raw_input(\"Enter feet: \"))\n", + " self.__inches=float(raw_input(\"Enter inches: \"))\n", + " def show(self):\n", + " print self.__feet, \"\\'-\", self.__inches, \"\\\"\"\n", + " def add(self, d1, d2):\n", + " self.__feet=d1.__feet+d2.__feet\n", + " self.__inches=d1.__inches+d2.__inches\n", + " if self.__inches>=12:\n", + " self.__feet=self.__feet+1\n", + " self.__inches=self.__inches-12\n", + "d1=distance()\n", + "d2=distance()\n", + "d3=distance()\n", + "d2.init(11, 6.25)\n", + "d1.read()\n", + "print \"d1=\",\n", + "d1.show()\n", + "print \"d2=\",\n", + "d2.show()\n", + "d3.add(d1,d2)\n", + "print \"d3 = d1+d2 =\",\n", + "d3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter feet: 12.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter inches: 7.25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "d1= 12.0 '- 7.25 \"\n", + "d2= 11 '- 6.25 \"\n", + "d3 = d1+d2 = 24.0 '- 1.5 \"\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-account.cpp, Page no-365" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def MoneyTransfer(self, acc , amount): # passing objects as parameters\n", + " self._AccClass__balance=self._AccClass__balance-amount\n", + " acc._AccClass__balance=acc._AccClass__balance + amount\n", + "class AccClass:\n", + " __accno=int\n", + " __balance=float\n", + " def setdata(self, an, bal=0.0):\n", + " self.accno=an\n", + " self.__balance=bal\n", + " def getdata(self):\n", + " self.accno=raw_input(\"Enter account number for acc1 object: \")\n", + " self.__balance=float(raw_input(\"Enter the balance: \"))\n", + " def display(self):\n", + " print \"Acoount number is: \", self.accno\n", + " print \"Balance is: \", self.__balance\n", + " MoneyTransfer=MoneyTransfer\n", + "acc1=AccClass()\n", + "acc2=AccClass()\n", + "acc3=AccClass()\n", + "acc1.getdata()\n", + "acc2.setdata(10)\n", + "acc3.setdata(20, 750.5)\n", + "print \"Acoount information...\"\n", + "acc1.display()\n", + "acc2.display()\n", + "acc3.display()\n", + "trans_money=float(raw_input(\"How much money is to be transferred from acc3 to acc1: \"))\n", + "acc3.MoneyTransfer(acc1, trans_money)\n", + "print \"Updated information about accounts...\"\n", + "acc1.display()\n", + "acc2.display()\n", + "acc3.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter account number for acc1 object: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the balance: 100\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Acoount information...\n", + "Acoount number is: 1\n", + "Balance is: 100.0\n", + "Acoount number is: 10\n", + "Balance is: 0.0\n", + "Acoount number is: 20\n", + "Balance is: 750.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How much money is to be transferred from acc3 to acc1: 200\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Updated information about accounts...\n", + "Acoount number is: 1\n", + "Balance is: 300.0\n", + "Acoount number is: 10\n", + "Balance is: 0.0\n", + "Acoount number is: 20\n", + "Balance is: 550.5\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex.cpp, Page no-367" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "def add (self, c2): #objects as parameters \n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real Part ? \"))\n", + " self.__imag=float(raw_input(\"Imag Part ? \"))\n", + " def outdata(self, msg):\n", + " print msg, \n", + " print self.__real,\n", + " if self.__imag<0:\n", + " print \"-i\",\n", + " else:\n", + " print \"+i\",\n", + " print math.fabs(self.__imag) #print absolute value\n", + " add=add\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter Complex number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex number c2...\"\n", + "c2.getdata()\n", + "c3=c1.add(c2)\n", + "c3.outdata(\"c3=c1.add(c2):\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real Part ? 1.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag Part ? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real Part ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag Part ? -4.3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c3=c1.add(c2): 4.5 -i 2.3\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-friend1.cpp, Page no-371" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class one:\n", + " __data1=int\n", + " def setdata(self, init):\n", + " self.__data1=init\n", + "class two:\n", + " __data2=int\n", + " def setdata(self, init):\n", + " self.__data2=init\n", + "def add_both(a, b): #friend function\n", + " return a._one__data1+b._two__data2\n", + "a=one()\n", + "b=two()\n", + "a.setdata(5)\n", + "b.setdata(10)\n", + "print \"Sum of one and two:\", add_both(a,b)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of one and two: 15\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-friend2.cpp, Page no-373" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class boy:\n", + " __income1=int\n", + " __income2=int\n", + " def setdata(self, in1, in2):\n", + " self.__income1=in1\n", + " self.__income2=in2\n", + "class girl:\n", + " __income=int\n", + " def girlfunc(self, b1):\n", + " return b1._boy__income1+b1._boy__income2\n", + " def setdata(self, In):\n", + " self.__income=In\n", + " def show(self):\n", + " b1=boy()\n", + " b1.setdata(100, 200)\n", + " print \"boy's Income1 in show():\", b1._boy__income1\n", + " print \"girl's income in show():\", self.__income\n", + "b1=boy()\n", + "g1=girl()\n", + "b1.setdata(500, 1000)\n", + "g1.setdata(300)\n", + "print \"boy b1 total income:\", g1.girlfunc(b1)\n", + "g1.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "boy b1 total income: 1500\n", + "boy's Income1 in show(): 100\n", + "girl's income in show(): 300\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-friend3.cpp, Page no-375" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def girlfunc(self, b1):\n", + " return b1._boy__income1+b1._boy__income2\n", + "class girl:\n", + " __income=int\n", + " __girlfunc=girlfunc\n", + " def setdata(self, In):\n", + " self.__income=In\n", + " def show(self):\n", + " print \"girl income:\", self.__income\n", + "class boy:\n", + " __income1=int\n", + " __income2=int\n", + " def setdata(self, in1, in2):\n", + " self.__income1=in1\n", + " self.__income2=in2\n", + "b1=boy()\n", + "g1=girl()\n", + "b1.setdata(500, 1000)\n", + "g1.setdata(300)\n", + "print \"boy b1 total income:\", g1._girl__girlfunc(b1)\n", + "g1.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "boy b1 total income: 1500\n", + "girl income: 300\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-constmem.cpp, Page 377" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self):\n", + " self._Person__name=self._Person__address=self._Person__phone=0\n", + "def clear(self):\n", + " del self._Person__name\n", + " del self._Person__address\n", + " del self._Person__phone\n", + "def setname(self, Str):\n", + " if self._Person__name:\n", + " del self._Person__name\n", + " self._Person__name=Str\n", + "def setaddress(self, Str):\n", + " if self._Person__address:\n", + " del self._Person__address\n", + " self._Person__address=Str\n", + "def setphone(self, Str):\n", + " if self._Person__phone:\n", + " del self._Person__phone\n", + " self._Person__phone=Str\n", + "def getname(self):\n", + " return self._Person__name\n", + "def getaddress(self):\n", + " return self._Person__address\n", + "def getphone(self):\n", + " return self._Person__phone\n", + "def printperson(p):\n", + " if p.getname():\n", + " print \"Name :\", p.getname()\n", + " if p.getaddress():\n", + " print \"Address :\", p.getaddress()\n", + " if p.getphone():\n", + " print \"Phone :\", p.getphone()\n", + "class Person:\n", + " __name=str\n", + " __address=str\n", + " __phone=str\n", + " __init__=__init__\n", + " clear=clear\n", + " setname=setname\n", + " setaddress=setaddress\n", + " setphone=setphone\n", + " getname=getname\n", + " getaddress=getaddress\n", + " getphone=getphone\n", + "p1=Person()\n", + "p2=Person()\n", + "p1.setname(\"Rajkumar\")\n", + "p1.setaddress(\"Email: rajacdacb.ernet.in\")\n", + "p1.setphone(\"90-080-5584271\")\n", + "printperson(p1)\n", + "p2.setname(\"Venugopal K R\")\n", + "p2.setaddress(\"Bangalore University\")\n", + "p2.setphone(\"-not sure-\")\n", + "printperson(p2)\n", + "p1.clear()\n", + "p2.clear()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name : Rajkumar\n", + "Address : Email: rajacdacb.ernet.in\n", + "Phone : 90-080-5584271\n", + "Name : Venugopal K R\n", + "Address : Bangalore University\n", + "Phone : -not sure-\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-count.cpp, Page no-382" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class MyClass():\n", + " __count=[int]#static member\n", + " __number=int\n", + " def set(self, num):\n", + " self.__number=num\n", + " self.__count[0]+=1\n", + " def show(self):\n", + " print \"Number of calls made to 'set()' through any object:\", self.__count[0]\n", + "obj1=MyClass()\n", + "obj1._MyClass__count[0]=0\n", + "obj1.show()\n", + "obj1.set(100)\n", + "obj1.show()\n", + "obj2=MyClass()\n", + "obj3=MyClass()\n", + "obj2.set(200)\n", + "obj2.show()\n", + "obj2.set(250)\n", + "obj3.set(300)\n", + "obj1.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of calls made to 'set()' through any object: 0\n", + "Number of calls made to 'set()' through any object: 1\n", + "Number of calls made to 'set()' through any object: 2\n", + "Number of calls made to 'set()' through any object: 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-dirs.cpp, Page no-384" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Directory:\n", + " __path=[str] #static member\n", + " def setpath(self, newpath):\n", + " self.__path[0]=newpath\n", + "Directory()._Directory__path[0]=\"/usr/raj\"\n", + "print \"Path:\", Directory()._Directory__path[0]\n", + "Directory().setpath(\"/usr\")\n", + "print \"Path:\", Directory()._Directory__path[0]\n", + "dir=Directory()\n", + "dir.setpath(\"/etc\")\n", + "print \"Path:\", dir._Directory__path[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Path: /usr/raj\n", + "Path: /usr\n", + "Path: /etc\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page no-389" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class employee:\n", + " __emp_no=int\n", + " __emp_name=[None]*25\n", + " def accept(self, i, j):\n", + " self.__emp_no=i\n", + " self.__emp_name=j\n", + " def display(self):\n", + " print \"Employee Number:\", self.__emp_no,\"\\tEmployee Name:\",self.__emp_name\n", + "e=[]*5\n", + "for i in range(5):\n", + " e.append(employee())\n", + "print \"Enter the details for five employees: \"\n", + "for i in range(5):\n", + " no=int(raw_input(\"Number: \"))\n", + " name=raw_input(\"Name: \")\n", + " e[i].accept(no, name)\n", + "print \"*****Employee Details*****\"\n", + "for i in range(5):\n", + " e[i].display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the details for five employees: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Vishwanathan\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Archana\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Prasad\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Sarthak\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Ganeshan\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "*****Employee Details*****\n", + "Employee Number: 1 \tEmployee Name: Vishwanathan\n", + "Employee Number: 2 \tEmployee Name: Archana\n", + "Employee Number: 3 \tEmployee Name: Prasad\n", + "Employee Number: 4 \tEmployee Name: Sarthak\n", + "Employee Number: 5 \tEmployee Name: Ganeshan\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects_1.ipynb new file mode 100755 index 00000000..e0892960 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects_1.ipynb @@ -0,0 +1,1241 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7cdf129099ae95ab70f7dd170afdee59f1a075836a82b7b4492486f65167bd41" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10- Classes and objects" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- student.cpp, Page no-344" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class student: #member functions definition inside the body\n", + " __roll_no=int\n", + " __name=[None]*20\n", + " def setdata(self, roll_no_in, name_in):\n", + " self.roll_no=roll_no_in\n", + " self.name=name_in\n", + " def outdata(self):\n", + " print \"Roll no =\", self.roll_no\n", + " print \"Name =\", self.name\n", + "s1=student() #object of class student\n", + "s2=student()\n", + "s1.setdata(1, \"Tejaswi\") #invoking member functions\n", + "s2.setdata(10, \"Rajkumar\")\n", + "print \"Student details...\"\n", + "s1.outdata()\n", + "s2.outdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student details...\n", + "Roll no = 1\n", + "Name = Tejaswi\n", + "Roll no = 10\n", + "Name = Rajkumar\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-rect.cpp, Page no-345" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class rect:\n", + " __length=int\n", + " __breadth=int\n", + " def read(self, i, j):\n", + " self.__length=i\n", + " self.__breadth=j\n", + " def area(self):\n", + " return self.__length*self.__breadth\n", + "r=rect()\n", + "x, y=[int(x) for x in raw_input(\"Enter the length and breadth of the reactangle: \").split()]\n", + "r.read(x,y)\n", + "print \"Area of the rectangle =\", r.area()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the length and breadth of the reactangle: 4 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of the rectangle = 40\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-date1.cpp, Page no-348" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class date:\n", + " __day=int\n", + " __month=int\n", + " __year=int\n", + " def Set(self, DayIn, MonthIn, YearIn):\n", + " self.__day=DayIn\n", + " self.__month=MonthIn\n", + " self.__year=YearIn\n", + " def show(self):\n", + " print \"%s-%s-%s\" %(self.__day, self.__month, self.__year)\n", + "d1=date()\n", + "d2=date()\n", + "d3=date()\n", + "d1.Set(26, 3, 1958)\n", + "d2.Set(14, 4, 1971)\n", + "d3.Set(1, 9, 1973)\n", + "print \"Birth Date of First Author: \",\n", + "d1.show()\n", + "print \"Birth Date of Second Author: \",\n", + "d2.show()\n", + "print \"Birth Date of Third Author: \",\n", + "d3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth Date of First Author: 26-3-1958\n", + "Birth Date of Second Author: 14-4-1971\n", + "Birth Date of Third Author: 1-9-1973\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-date2.cpp, Page no-350" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Set(self, DayIn, MonthIn, YearIn):\n", + " self.__day=DayIn\n", + " self.__month=MonthIn\n", + " self.__year=YearIn\n", + "def show(self):\n", + " print \"%s-%s-%s\" %(self.__day, self.__month, self.__year)\n", + "class date:\n", + " __day=int\n", + " __month=int\n", + " __year=int\n", + " Set=Set #definiton of member function outside the class\n", + " show=show\n", + "d1=date()\n", + "d2=date()\n", + "d3=date()\n", + "d1.Set(26, 3, 1958)\n", + "d2.Set(14, 4, 1971)\n", + "d3.Set(1, 9, 1973)\n", + "print \"Birth Date of First Author: \",\n", + "d1.show()\n", + "print \"Birth Date of Second Author: \",\n", + "d2.show()\n", + "print \"Birth Date of Third Author: \",\n", + "d3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth Date of First Author: 26-3-1958\n", + "Birth Date of Second Author: 14-4-1971\n", + "Birth Date of Third Author: 1-9-1973\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-date3.cpp, Page no-352" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Set(self, DayIn, MonthIn, YearIn):\n", + " self.__day=DayIn\n", + " self.__month=MonthIn\n", + " self.__year=YearIn\n", + "def show(self):\n", + " print self.__day, \"-\", self.__month, \"-\", self.__year\n", + "class date:\n", + " __day=int\n", + " __month=int\n", + " __year=int\n", + " Set=Set\n", + " show=show\n", + "d1=date()\n", + "d2=date()\n", + "d3=date()\n", + "d1.Set(26, 3, 1958)\n", + "d2.Set(14, 4, 1971)\n", + "d3.Set(1, 9, 1973)\n", + "print \"Birth Date of First Author: \",\n", + "d1.show()\n", + "print \"Birth Date of Second Author: \",\n", + "d2.show()\n", + "print \"Birth Date of Third Author: \",\n", + "d3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth Date of First Author: 26 - 3 - 1958\n", + "Birth Date of Second Author: 14 - 4 - 1971\n", + "Birth Date of Third Author: 1 - 9 - 1973\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-nesting.cpp, Page no-354" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class NumberParis:\n", + " __num1=int\n", + " __num2=int\n", + " def read(self):\n", + " self.__num1=int(raw_input(\"Enter First Number: \"))\n", + " self.__num2=int(raw_input(\"Enter Second Number: \"))\n", + " def Max(self):\n", + " if self.__num1>self.__num2:\n", + " return self.__num1\n", + " else:\n", + " return self.__num2\n", + " def ShowMax(self):\n", + " print \"Maximum =\", self.Max() #invoking a member function in another member function\n", + "n1=NumberParis()\n", + "n1.read()\n", + "n1.ShowMax()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter First Number: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Second Number: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum = 10\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-part.cpp, Page no-355" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class part:\n", + " __ModelNum=int #private members\n", + " __PartNum=int\n", + " __cost=float\n", + " def SetPart(self, mn, pn, c):\n", + " self.__ModelNum=mn\n", + " self.__PartNum=pn\n", + " self.__cost=c\n", + " def ShowPart(self):\n", + " print \"Model:\", self.__ModelNum\n", + " print \"Part:\", self.__PartNum\n", + " print \"Cost:\", self.__cost\n", + "p1=part()\n", + "p2=part()\n", + "p1.SetPart(1996, 23, 1250.55)\n", + "p2.SetPart(2000, 243, 2354.75)\n", + "print \"First Part Details...\"\n", + "p1.ShowPart()\n", + "print \"Second Part Details...\"\n", + "p2.ShowPart()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First Part Details...\n", + "Model: 1996\n", + "Part: 23\n", + "Cost: 1250.55\n", + "Second Part Details...\n", + "Model: 2000\n", + "Part: 243\n", + "Cost: 2354.75\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector.cpp, Page no-361" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def read(self):\n", + " for i in range(self._vector__sz):\n", + " print \"Enter vector [\", i, \"]? \",\n", + " self._vector__v[i]=int(raw_input())\n", + "def show_sum(self):\n", + " Sum=0\n", + " for i in range(self._vector__sz):\n", + " Sum+=self._vector__v[i]\n", + " print \"Vector sum =\", Sum\n", + "class vector:\n", + " __v=[int] #array of type integer\n", + " __sz=int\n", + " def VectorSize(self, size):\n", + " self.__sz= size\n", + " self.__v=[int]*size #dynamically allocating size to integer array\n", + " def release(self):\n", + " del self.__v\n", + " read=read\n", + " show_sum=show_sum\n", + "v1=vector()\n", + "count=int(raw_input(\"How many elements are there in the vector: \"))\n", + "v1.VectorSize(count)\n", + "v1.read()\n", + "v1.show_sum()\n", + "v1.release()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many elements are there in the vector: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter vector [ 0 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 1 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 2 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 3 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 4 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Vector sum = 15\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-distance.cpp, Page no-363" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class distance:\n", + " __feet=float\n", + " __inches=float\n", + " def init(self, ft, In):\n", + " self.__feet=ft\n", + " self.__inches=In\n", + " def read(self):\n", + " self.__feet=float(raw_input(\"Enter feet: \"))\n", + " self.__inches=float(raw_input(\"Enter inches: \"))\n", + " def show(self):\n", + " print self.__feet, \"\\'-\", self.__inches, \"\\\"\"\n", + " def add(self, d1, d2):\n", + " self.__feet=d1.__feet+d2.__feet\n", + " self.__inches=d1.__inches+d2.__inches\n", + " if self.__inches>=12:\n", + " self.__feet=self.__feet+1\n", + " self.__inches=self.__inches-12\n", + "d1=distance()\n", + "d2=distance()\n", + "d3=distance()\n", + "d2.init(11, 6.25)\n", + "d1.read()\n", + "print \"d1=\",\n", + "d1.show()\n", + "print \"d2=\",\n", + "d2.show()\n", + "d3.add(d1,d2)\n", + "print \"d3 = d1+d2 =\",\n", + "d3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter feet: 12.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter inches: 7.25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "d1= 12.0 '- 7.25 \"\n", + "d2= 11 '- 6.25 \"\n", + "d3 = d1+d2 = 24.0 '- 1.5 \"\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-account.cpp, Page no-365" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def MoneyTransfer(self, acc , amount): # passing objects as parameters\n", + " self._AccClass__balance=self._AccClass__balance-amount\n", + " acc._AccClass__balance=acc._AccClass__balance + amount\n", + "class AccClass:\n", + " __accno=int\n", + " __balance=float\n", + " def setdata(self, an, bal=0.0):\n", + " self.accno=an\n", + " self.__balance=bal\n", + " def getdata(self):\n", + " self.accno=raw_input(\"Enter account number for acc1 object: \")\n", + " self.__balance=float(raw_input(\"Enter the balance: \"))\n", + " def display(self):\n", + " print \"Acoount number is: \", self.accno\n", + " print \"Balance is: \", self.__balance\n", + " MoneyTransfer=MoneyTransfer\n", + "acc1=AccClass()\n", + "acc2=AccClass()\n", + "acc3=AccClass()\n", + "acc1.getdata()\n", + "acc2.setdata(10)\n", + "acc3.setdata(20, 750.5)\n", + "print \"Acoount information...\"\n", + "acc1.display()\n", + "acc2.display()\n", + "acc3.display()\n", + "trans_money=float(raw_input(\"How much money is to be transferred from acc3 to acc1: \"))\n", + "acc3.MoneyTransfer(acc1, trans_money)\n", + "print \"Updated information about accounts...\"\n", + "acc1.display()\n", + "acc2.display()\n", + "acc3.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter account number for acc1 object: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the balance: 100\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Acoount information...\n", + "Acoount number is: 1\n", + "Balance is: 100.0\n", + "Acoount number is: 10\n", + "Balance is: 0.0\n", + "Acoount number is: 20\n", + "Balance is: 750.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How much money is to be transferred from acc3 to acc1: 200\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Updated information about accounts...\n", + "Acoount number is: 1\n", + "Balance is: 300.0\n", + "Acoount number is: 10\n", + "Balance is: 0.0\n", + "Acoount number is: 20\n", + "Balance is: 550.5\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex.cpp, Page no-367" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "def add (self, c2): #objects as parameters \n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real Part ? \"))\n", + " self.__imag=float(raw_input(\"Imag Part ? \"))\n", + " def outdata(self, msg):\n", + " print msg, \n", + " print self.__real,\n", + " if self.__imag<0:\n", + " print \"-i\",\n", + " else:\n", + " print \"+i\",\n", + " print math.fabs(self.__imag) #print absolute value\n", + " add=add\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter Complex number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex number c2...\"\n", + "c2.getdata()\n", + "c3=c1.add(c2)\n", + "c3.outdata(\"c3=c1.add(c2):\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real Part ? 1.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag Part ? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real Part ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag Part ? -4.3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c3=c1.add(c2): 4.5 -i 2.3\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-friend1.cpp, Page no-371" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class one:\n", + " __data1=int\n", + " def setdata(self, init):\n", + " self.__data1=init\n", + "class two:\n", + " __data2=int\n", + " def setdata(self, init):\n", + " self.__data2=init\n", + "def add_both(a, b): #friend function\n", + " return a._one__data1+b._two__data2\n", + "a=one()\n", + "b=two()\n", + "a.setdata(5)\n", + "b.setdata(10)\n", + "print \"Sum of one and two:\", add_both(a,b)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of one and two: 15\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-friend2.cpp, Page no-373" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class boy:\n", + " __income1=int\n", + " __income2=int\n", + " def setdata(self, in1, in2):\n", + " self.__income1=in1\n", + " self.__income2=in2\n", + "class girl:\n", + " __income=int\n", + " def girlfunc(self, b1):\n", + " return b1._boy__income1+b1._boy__income2\n", + " def setdata(self, In):\n", + " self.__income=In\n", + " def show(self):\n", + " b1=boy()\n", + " b1.setdata(100, 200)\n", + " print \"boy's Income1 in show():\", b1._boy__income1\n", + " print \"girl's income in show():\", self.__income\n", + "b1=boy()\n", + "g1=girl()\n", + "b1.setdata(500, 1000)\n", + "g1.setdata(300)\n", + "print \"boy b1 total income:\", g1.girlfunc(b1)\n", + "g1.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "boy b1 total income: 1500\n", + "boy's Income1 in show(): 100\n", + "girl's income in show(): 300\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-friend3.cpp, Page no-375" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def girlfunc(self, b1):\n", + " return b1._boy__income1+b1._boy__income2\n", + "class girl:\n", + " __income=int\n", + " __girlfunc=girlfunc\n", + " def setdata(self, In):\n", + " self.__income=In\n", + " def show(self):\n", + " print \"girl income:\", self.__income\n", + "class boy:\n", + " __income1=int\n", + " __income2=int\n", + " def setdata(self, in1, in2):\n", + " self.__income1=in1\n", + " self.__income2=in2\n", + "b1=boy()\n", + "g1=girl()\n", + "b1.setdata(500, 1000)\n", + "g1.setdata(300)\n", + "print \"boy b1 total income:\", g1._girl__girlfunc(b1)\n", + "g1.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "boy b1 total income: 1500\n", + "girl income: 300\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-constmem.cpp, Page 377" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self):\n", + " self._Person__name=self._Person__address=self._Person__phone=0\n", + "def clear(self):\n", + " del self._Person__name\n", + " del self._Person__address\n", + " del self._Person__phone\n", + "def setname(self, Str):\n", + " if self._Person__name:\n", + " del self._Person__name\n", + " self._Person__name=Str\n", + "def setaddress(self, Str):\n", + " if self._Person__address:\n", + " del self._Person__address\n", + " self._Person__address=Str\n", + "def setphone(self, Str):\n", + " if self._Person__phone:\n", + " del self._Person__phone\n", + " self._Person__phone=Str\n", + "def getname(self):\n", + " return self._Person__name\n", + "def getaddress(self):\n", + " return self._Person__address\n", + "def getphone(self):\n", + " return self._Person__phone\n", + "def printperson(p):\n", + " if p.getname():\n", + " print \"Name :\", p.getname()\n", + " if p.getaddress():\n", + " print \"Address :\", p.getaddress()\n", + " if p.getphone():\n", + " print \"Phone :\", p.getphone()\n", + "class Person:\n", + " __name=str\n", + " __address=str\n", + " __phone=str\n", + " __init__=__init__\n", + " clear=clear\n", + " setname=setname\n", + " setaddress=setaddress\n", + " setphone=setphone\n", + " getname=getname\n", + " getaddress=getaddress\n", + " getphone=getphone\n", + "p1=Person()\n", + "p2=Person()\n", + "p1.setname(\"Rajkumar\")\n", + "p1.setaddress(\"Email: rajacdacb.ernet.in\")\n", + "p1.setphone(\"90-080-5584271\")\n", + "printperson(p1)\n", + "p2.setname(\"Venugopal K R\")\n", + "p2.setaddress(\"Bangalore University\")\n", + "p2.setphone(\"-not sure-\")\n", + "printperson(p2)\n", + "p1.clear()\n", + "p2.clear()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name : Rajkumar\n", + "Address : Email: rajacdacb.ernet.in\n", + "Phone : 90-080-5584271\n", + "Name : Venugopal K R\n", + "Address : Bangalore University\n", + "Phone : -not sure-\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-count.cpp, Page no-382" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class MyClass():\n", + " __count=[int]#static member\n", + " __number=int\n", + " def set(self, num):\n", + " self.__number=num\n", + " self.__count[0]+=1\n", + " def show(self):\n", + " print \"Number of calls made to 'set()' through any object:\", self.__count[0]\n", + "obj1=MyClass()\n", + "obj1._MyClass__count[0]=0\n", + "obj1.show()\n", + "obj1.set(100)\n", + "obj1.show()\n", + "obj2=MyClass()\n", + "obj3=MyClass()\n", + "obj2.set(200)\n", + "obj2.show()\n", + "obj2.set(250)\n", + "obj3.set(300)\n", + "obj1.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of calls made to 'set()' through any object: 0\n", + "Number of calls made to 'set()' through any object: 1\n", + "Number of calls made to 'set()' through any object: 2\n", + "Number of calls made to 'set()' through any object: 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-dirs.cpp, Page no-384" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Directory:\n", + " __path=[str] #static member\n", + " def setpath(self, newpath):\n", + " self.__path[0]=newpath\n", + "Directory()._Directory__path[0]=\"/usr/raj\"\n", + "print \"Path:\", Directory()._Directory__path[0]\n", + "Directory().setpath(\"/usr\")\n", + "print \"Path:\", Directory()._Directory__path[0]\n", + "dir=Directory()\n", + "dir.setpath(\"/etc\")\n", + "print \"Path:\", dir._Directory__path[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Path: /usr/raj\n", + "Path: /usr\n", + "Path: /etc\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page no-389" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class employee:\n", + " __emp_no=int\n", + " __emp_name=[None]*25\n", + " def accept(self, i, j):\n", + " self.__emp_no=i\n", + " self.__emp_name=j\n", + " def display(self):\n", + " print \"Employee Number:\", self.__emp_no,\"\\tEmployee Name:\",self.__emp_name\n", + "e=[]*5\n", + "for i in range(5):\n", + " e.append(employee())\n", + "print \"Enter the details for five employees: \"\n", + "for i in range(5):\n", + " no=int(raw_input(\"Number: \"))\n", + " name=raw_input(\"Name: \")\n", + " e[i].accept(no, name)\n", + "print \"*****Employee Details*****\"\n", + "for i in range(5):\n", + " e[i].display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the details for five employees: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Vishwanathan\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Archana\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Prasad\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Sarthak\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Ganeshan\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "*****Employee Details*****\n", + "Employee Number: 1 \tEmployee Name: Vishwanathan\n", + "Employee Number: 2 \tEmployee Name: Archana\n", + "Employee Number: 3 \tEmployee Name: Prasad\n", + "Employee Number: 4 \tEmployee Name: Sarthak\n", + "Employee Number: 5 \tEmployee Name: Ganeshan\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up.ipynb new file mode 100755 index 00000000..e75a9045 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up.ipynb @@ -0,0 +1,1781 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1e5e3f82f73a47a49eb33b525df841c886d804170ed7ff4f07a60c1f0014985c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11: Object Initialization and clean up" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- bag.cpp, Page-392" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_ITEMS=25\n", + "def show(self):\n", + " for i in range(self.ItemCount):\n", + " print self._Bag__contents[i],\n", + "class Bag:\n", + " __contents=[int]*MAX_ITEMS\n", + " __ItemCount=int\n", + " def SetEmpty(self):\n", + " self.ItemCount=0\n", + " def put(self,item):\n", + " self._Bag__contents[self.ItemCount]=item\n", + " self.ItemCount+=1\n", + " show=show\n", + "bag=Bag() #object of class Bag\n", + "bag.SetEmpty() #initialize the object\n", + "while 1:\n", + " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", + " if item==0:\n", + " break\n", + " bag.put(item)\n", + " print \"Items in bag:\",\n", + " bag.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in bag: 1" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3 2" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3 2 4" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- newbag.cpp, Page-395" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_ITEMS=25 #size of array contents\n", + "def show(self):\n", + " for i in range(self.ItemCount):\n", + " print self._Bag__contents[i],\n", + "class Bag:\n", + " __contents=[int]*MAX_ITEMS #int 1D array\n", + " __ItemCount=int\n", + " def __init__(self): #Constructor\n", + " self.ItemCount=0\n", + " def put(self,item): #member function defined inside the class\n", + " self._Bag__contents[self.ItemCount]=item\n", + " self.ItemCount+=1\n", + " show=show #member function defined outside the class\n", + "bag=Bag() #object of class Bag\n", + "while 1:\n", + " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", + " if item==0:\n", + " break\n", + " bag.put(item)\n", + " print \"Items in bag:\",\n", + " bag.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in bag: 1" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3 2" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3 2 4" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-test1.cpp, Page-396" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self):\n", + " print \"Constructor of class test called\"\n", + "class Test:\n", + " __init__=__init__ #Constructor\n", + "G=Test()\n", + "def func():\n", + " L=Test()\n", + " print \"Here's function func()\"\n", + "X=Test()\n", + "print \"main() function\"\n", + "func()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor of class test called\n", + "Constructor of class test called\n", + "main() function\n", + "Constructor of class test called\n", + "Here's function func()\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- giftbag.cpp, Page- 398" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_ITEMS=25\n", + "def show(self):\n", + " if self.ItemCount:\n", + " for i in range(self.ItemCount):\n", + " print self._Bag__contents[i],\n", + " else:\n", + " print \"Nil\"\n", + "class Bag:\n", + " __contents=[int]*MAX_ITEMS\n", + " __ItemCount=int\n", + " def __init__(self, item=None): #parameterized constructor: Python does not support overloading of functions\n", + " if isinstance(item, int):\n", + " self._Bag__contents[0]=item\n", + " self.ItemCount=1\n", + " else:\n", + " self.ItemCount=0\n", + " def put(self,item):\n", + " self._Bag__contents[self.ItemCount]=item\n", + " self.ItemCount+=1\n", + " show=show\n", + "bag1=Bag()\n", + "bag2=Bag(4) #object created using the parameterized constructor\n", + "print \"Gifted bag1 initially has:\",\n", + "bag1.show()\n", + "print \"Gifted bag2 initially has:\",\n", + "bag2.show()\n", + "while 1:\n", + " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", + " if item==0:\n", + " break\n", + " bag2.put(item)\n", + " print \"Items in bag2:\",\n", + " bag2.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Gifted bag1 initially has: Nil\n", + "Gifted bag2 initially has: 4" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag2: 4 1" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag2: 4 1 2" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag2: 4 1 2 3" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-test.cpp, Page-400 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self):\n", + " print \"Constructor of class Test called\"\n", + "def __del__(self):\n", + " print \"Destructor of class Test called\"\n", + "class Test:\n", + " __init__=__init__ #Constructor\n", + " __del__=__del__ #Destructor\n", + "x=Test()\n", + "print \"Terminating main\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor of class Test called\n", + "Destructor of class Test called\n", + "Terminating main\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-count.cpp, Page-401" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "nobjects=0\n", + "nobj_alive=0\n", + "class MyClass:\n", + " def __init__(self):\n", + " global nobjects #using the global nobjects\n", + " global nobj_alive #using the global nobj_alive\n", + " nobjects+=1\n", + " nobj_alive+=1\n", + " def __del__(self):\n", + " global nobj_alive #using the global nobjects\n", + " nobj_alive-=1\n", + " def show(self):\n", + " global nobjects\n", + " global nobj_alive\n", + " print \"Total number of objects created: \", nobjects\n", + " print \"Number of objects currently alive: \", nobj_alive\n", + "obj1=MyClass()\n", + "obj1.show()\n", + "def func():\n", + " obj1=MyClass()\n", + " obj2=MyClass()\n", + " obj2.show()\n", + " del obj1\n", + " del obj2\n", + "func()\n", + "obj1.show()\n", + "obj2=MyClass()\n", + "obj3=MyClass()\n", + "obj2.show()\n", + "del obj1\n", + "del obj2\n", + "del obj3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total number of objects created: 1\n", + "Number of objects currently alive: 1\n", + "Total number of objects created: 3\n", + "Number of objects currently alive: 3\n", + "Total number of objects created: 3\n", + "Number of objects currently alive: 1\n", + "Total number of objects created: 5\n", + "Number of objects currently alive: 3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example-account.cpp, Page- 403" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def MoneyTransfer(self, acc , amount):\n", + " self._AccClass__balance=self._AccClass__balance-amount\n", + " acc._AccClass__balance=acc._AccClass__balance + amount\n", + "class AccClass:\n", + " __accno=int\n", + " __balance=float\n", + " def __init__(self, an=None, bal=0.0):\n", + " if isinstance(an, int):\n", + " self.accno=an\n", + " self.__balance=bal\n", + " else:\n", + " self.accno=raw_input(\"Enter account number for acc1 object: \")\n", + " self.__balance=float(raw_input(\"Enter the balance: \"))\n", + " def display(self):\n", + " print \"Acoount number is: \", self.accno\n", + " print \"Balance is: \", self.__balance\n", + " MoneyTransfer=MoneyTransfer\n", + "acc1=AccClass()\n", + "acc2=AccClass(10)\n", + "acc3=AccClass(20, 750.5)\n", + "print \"Acoount information...\"\n", + "acc1.display()\n", + "acc2.display()\n", + "acc3.display()\n", + "trans_money=float(raw_input(\"How much money is to be transferred from acc3 to acc1: \"))\n", + "acc3.MoneyTransfer(acc1, trans_money)\n", + "print \"Updated information about accounts...\"\n", + "acc1.display()\n", + "acc2.display()\n", + "acc3.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter account number for acc1 object: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the balance: 100\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Acoount information...\n", + "Acoount number is: 1\n", + "Balance is: 100.0\n", + "Acoount number is: 10\n", + "Balance is: 0.0\n", + "Acoount number is: 20\n", + "Balance is: 750.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How much money is to be transferred from acc3 to acc1: 200\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Updated information about accounts...\n", + "Acoount number is: 1\n", + "Balance is: 300.0\n", + "Acoount number is: 10\n", + "Balance is: 0.0\n", + "Acoount number is: 20\n", + "Balance is: 550.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-test2.cpp. Page- 405" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self, NameIn=None):\n", + " if isinstance(NameIn, str):\n", + " self.name=NameIn\n", + " print \"Test Object \", NameIn, \" created\"\n", + " else:\n", + " self.name=\"unnamed\"\n", + " print \"Test object 'unnamed' created\"\n", + "def __del__(self):\n", + " print \"Test Object \", self.name, \" destroyed\"\n", + " del self.name\n", + "class Test:\n", + " __name=[str]\n", + " __init__=__init__\n", + " __del__=__del__\n", + "g=Test(\"global\")\n", + "def func():\n", + " l=Test(\"func\")\n", + " print \"here's function func()\"\n", + "x=Test(\"main\")\n", + "func()\n", + "print \"main() function - termination\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Test Object global created\n", + "Test Object global destroyed\n", + "Test Object main created\n", + "Test Object main destroyed\n", + "Test Object func created\n", + "here's function func()\n", + "Test Object func destroyed\n", + "main() function - termination\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex1.cpp, Page- 407" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "def add (self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self, real_in=None, imag_in=0.0):\n", + " if isinstance(real_in, float):\n", + " self.__real=real_in\n", + " self.__imag=imag_in\n", + " else:\n", + " self.__real=self.__imag=0.0\n", + " def show(self, msg):\n", + " print msg, \n", + " print self.__real,\n", + " if self.__imag<0:\n", + " print \"-i\",\n", + " else:\n", + " print \"+i\",\n", + " print math.fabs(self.__imag) #print absolute value\n", + " add=add\n", + "c1=Complex(1.5,2.0)\n", + "c2=Complex(2.2)\n", + "c3=Complex()\n", + "c1.show(\"c1=\")\n", + "c2.show(\"c2=\")\n", + "c3=c1.add(c2)\n", + "c3.show(\"c3=c1.add(c2):\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c1= 1.5 +i 2.0\n", + "c2= 2.2 +i 0.0\n", + "c3=c1.add(c2): 3.7 +i 2.0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- noname.cpp, Page- 410" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class nameless:\n", + " __a=int\n", + " def __init__(self):\n", + " print \"Constructor\"\n", + " def __del__(self):\n", + " print \"Destructor\"\n", + "nameless() #nameless object created\n", + "n1=nameless()\n", + "n2=nameless()\n", + "print \"Program terminates\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor\n", + "Destructor\n", + "Constructor\n", + "Destructor\n", + "Constructor\n", + "Destructor\n", + "Program terminates\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-name.cpp, Page-411" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show(self, msg):\n", + " print msg\n", + " print \"First Name: \", self._name__first\n", + " if self._name__middle[0]:\n", + " print \"Middle Name: \", self._name__middle\n", + " if self._name__last[0]:\n", + " print \"Last Name: \", self._name__last\n", + "class name:\n", + " __first=[None]*15\n", + " __middle=[None]*15\n", + " __last=[None]*15\n", + " def __init__(self, FirstName=None, MiddleName=None, LastName=None):\n", + " if isinstance(LastName, str):\n", + " self.__last=LastName\n", + " self.__middle=MiddleName\n", + " self.__first=FirstName\n", + " elif isinstance(MiddleName, str):\n", + " self.__middle=MiddleName\n", + " self.__first=FirstName\n", + " elif isinstance(FirstName, str):\n", + " self.__first=FirstName\n", + " else:\n", + " self.__last='\\0' #initialized to NULL\n", + " self.__middle='\\0'\n", + " self.__first='\\0'\n", + " show=show\n", + "n1=name()\n", + "n2=name()\n", + "n3=name()\n", + "n1=name(\"Rajkumar\")\n", + "n2=name(\"Savithri\", \"S\")\n", + "n3=name(\"Veugopal\", \"K\", \"R\")\n", + "n1.show(\"First prson details...\")\n", + "n2.show(\"Second prson details...\")\n", + "n3.show(\"Third prson details...\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First prson details...\n", + "First Name: Rajkumar\n", + "Second prson details...\n", + "First Name: Savithri\n", + "Middle Name: S\n", + "Third prson details...\n", + "First Name: Veugopal\n", + "Middle Name: K\n", + "Last Name: R\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector1.cpp, Page-413" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def read(self):\n", + " for i in range(self._vector__sz):\n", + " print \"Enter vector [\", i, \"]? \",\n", + " self._vector__v[i]=int(raw_input())\n", + "def show_sum(self):\n", + " Sum=0\n", + " for i in range(self._vector__sz):\n", + " Sum+=self._vector__v[i]\n", + " print \"Vector sum= \", Sum\n", + "class vector:\n", + " __v=[int] #array of type integer\n", + " __sz=int\n", + " def __init__(self, size):\n", + " self.__sz= size\n", + " self.__v=[int]*size #dynamically allocating size to integer array\n", + " def __del__(self):\n", + " del self.__v\n", + " read=read\n", + " show_sum=show_sum\n", + "count = int\n", + "count=int(raw_input(\"How many elements are there in the vector: \"))\n", + "v1= vector(count)\n", + "v1.read()\n", + "v1.show_sum()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many elements are there in the vector: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter vector [ 0 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 1 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 2 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 3 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 4 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Vector sum= 15\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector2.cpp, Page-415" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show(self):\n", + " for i in range(self._vector__size):\n", + " print self.elem(i), \", \",\n", + "class vector:\n", + " __v=[int]\n", + " __size=int\n", + " def __init__(self, vector_size):\n", + " if isinstance(vector_size, int):\n", + " self.__size= vector_size\n", + " self.__v=[int]*vector_size\n", + " else:\n", + " print \"Copy construcor invoked\"\n", + " self.__size=vector_size.__size\n", + " self.__v=[int]*vector_size.__size\n", + " for i in range(vector_size.__size):\n", + " self.__v[i]=vector_size.__v[i]\n", + " def elem(self,i):\n", + " if i>=self.__size:\n", + " print \"Error: Out of Range\"\n", + " return -1\n", + " return self.__v[i]\n", + " def __del__(self):\n", + " del self.__v\n", + " show=show\n", + "v1=vector(5)\n", + "v2=vector(5)\n", + "for i in range(5):\n", + " if v2.elem(i)!=-1:\n", + " v2._vector__v[i]=i+1\n", + "v1=v2\n", + "v3=vector(v2)\n", + "print \"Vector v1: \",\n", + "v1.show()\n", + "print \"\\nvector v2: \",\n", + "v2.show()\n", + "print \"\\nvector v3: \",\n", + "v3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Copy construcor invoked\n", + "Vector v1: 1 , 2 , 3 , 4 , 5 , \n", + "vector v2: 1 , 2 , 3 , 4 , 5 , \n", + "vector v3: 1 , 2 , 3 , 4 , 5 , \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-matrix.cpp, Page-418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "TRUE=1\n", + "FALSE=0\n", + "def __del__(self):\n", + " for i in range(self._matrix__MaxRow):\n", + " del self._matrix__p[i]\n", + " del self._matrix__p\n", + "def add(self, a, b):\n", + " self._matrix__MaxRow=a._matrix__MaxRow\n", + " self._matrix__MaxCol=a._matrix__MaxCol\n", + " if (a._matrix__MaxRow!=b._matrix__MaxRow)|(a._matrix__MaxCol!=b._matrix__MaxCol):\n", + " print \"Error: invalid matrix order for addition\"\n", + " return\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " self._matrix__p[i][j]=a._matrix__p[i][j]+b._matrix__p[i][j]\n", + "def sub(self, a, b):\n", + " self._matrix__MaxRow=a._matrix__MaxRow\n", + " self._matrix__MaxCol=a._matrix__MaxCol\n", + " if (a._matrix__MaxRow!=b._matrix__MaxRow)|(a._matrix__MaxCol!=b._matrix__MaxCol):\n", + " print \"Error: invalid matrix order for subtraction\"\n", + " return\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " self._matrix__p[i][j]=a._matrix__p[i][j]-b._matrix__p[i][j]\n", + "def mul(self, a, b):\n", + " self._matrix__MaxRow=a._matrix__MaxRow\n", + " self._matrix__MaxCol=a._matrix__MaxCol\n", + " if (a._matrix__MaxCol!=b._matrix__MaxRow):\n", + " print \"Error: invalid matrix order for multiplication\"\n", + " return\n", + " for i in range(a._matrix__MaxRow):\n", + " for j in range(b._matrix__MaxCol):\n", + " self._matrix__p[i][j]=0\n", + " for k in range(a._matrix__MaxCol):\n", + " self._matrix__p[i][j]+=a._matrix__p[i][j]*b._matrix__p[i][j]\n", + "def eql(self, b):\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " if self._matrix__p[i][i]!=b._matrix__p[i][j]:\n", + " return 0\n", + " return 1\n", + "def read(self):\n", + " self._matrix__p = []\n", + " for i in range(self._matrix__MaxRow):\n", + " self._matrix__p.append([])\n", + " for j in range(self._matrix__MaxCol):\n", + " print \"Matrix[%d,%d] =? \" %(i, j),\n", + " self._matrix__p[i].append(int(raw_input()))\n", + "def show(self):\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " print self._matrix__p[i][j], \" \",\n", + " print \"\"\n", + "class matrix:\n", + " __MaxRow=int\n", + " __MaxCol=int\n", + " __p=[int]\n", + " def __init__(self, row=0, col=0):\n", + " self.__MaxRow=row\n", + " self.__MaxCol=col\n", + " if row>0:\n", + " self.__p=[[int]*self.__MaxCol]*self.__MaxRow\n", + " __del__=__del__\n", + " read=read\n", + " show=show\n", + " add=add\n", + " sub=sub\n", + " mul=mul\n", + " eql=eql\n", + "print \"Enter Matrix A details...\"\n", + "m=int(raw_input(\"How many rows? \"))\n", + "n=int(raw_input(\"How many columns? \"))\n", + "a=matrix(m,n)\n", + "a.read()\n", + "print \"Enter Matrix B details...\"\n", + "p=int(raw_input(\"How many rows? \"))\n", + "q=int(raw_input(\"How many columns? \"))\n", + "b=matrix(p,q)\n", + "b.read()\n", + "print \"Matrix A is...\"\n", + "a.show()\n", + "print \"Matrix B is...\"\n", + "b.show()\n", + "c=matrix(m,n)\n", + "c.add(a,b)\n", + "print \"C=A+B...\"\n", + "c.show()\n", + "d=matrix(m,n)\n", + "d.sub(a,b)\n", + "print \"D=A-B...\"\n", + "d.show()\n", + "e=matrix(m,q)\n", + "e.mul(a,b)\n", + "print \"E=A*B...\"\n", + "e.show()\n", + "print \"(Is matrix A equal to matrix B)? \",\n", + "if(a.eql(b)):\n", + " print \"Yes\"\n", + "else:\n", + " print \"No\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Matrix A details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns? 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[0,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[0,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[0,2] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,2] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[2,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[2,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[2,2] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Matrix B details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns? 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[0,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[0,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[0,2] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,2] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[2,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[2,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[2,2] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix A is...\n", + "2 2 2 \n", + "2 2 2 \n", + "2 2 2 \n", + "Matrix B is...\n", + "1 1 1 \n", + "1 1 1 \n", + "1 1 1 \n", + "C=A+B...\n", + "3 3 3 \n", + "3 3 3 \n", + "3 3 3 \n", + "D=A-B...\n", + "1 1 1 \n", + "1 1 1 \n", + "1 1 1 \n", + "E=A*B...\n", + "6 6 6 \n", + "6 6 6 \n", + "6 6 6 \n", + "(Is matrix A equal to matrix B)? No\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-person.cpp, Page-423" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self, NameIn, AddressIn, PhoneIn):\n", + " self._Person__name=NameIn\n", + " self._Person__address=AddressIn\n", + " self._Person__phone=PhoneIn\n", + "#inline\n", + "def __del__(self):\n", + " del self._Person__name\n", + " del self._Person__address\n", + " del self._Person__phone\n", + "def getname(self):\n", + " return self._Person__name\n", + "def getaddress(self):\n", + " return self._Person__address\n", + "def getphone(self):\n", + " return self._Person__phone\n", + "def changename(self, NameIn):\n", + " if(self._Person__name):\n", + " del self._Person__name\n", + " self._Person__name=NameIn\n", + "class Person:\n", + " __name=[str]\n", + " __address=[str]\n", + " __phone=[str]\n", + " __init__=__init__\n", + " __del__=__del__\n", + " getname=getname\n", + " getaddress=getaddress\n", + " getphone=getphone\n", + " changename=changename\n", + "def printperson(p):\n", + " if(p.getname()):\n", + " print \"Name: \", p.getname()\n", + " if(p.getaddress()):\n", + " print \"Address: \", p.getaddress()\n", + " if(p.getphone()):\n", + " print \"Phone: \", p.getphone()\n", + "me=Person(\"Rajkumar\", \"E-mail: raj@cdabc.erne.in\", \"91-080-5584271\")\n", + "printperson(me)\n", + "you=Person(\"XYZ\", \"-not sure-\", \"-not sure-\")\n", + "print \"You XYZ by default...\"\n", + "printperson(you)\n", + "you.changename(\"ABC\")\n", + "print \"You changed XYZ to ABC...\"\n", + "printperson(you)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Rajkumar\n", + "Address: E-mail: raj@cdabc.erne.in\n", + "Phone: 91-080-5584271\n", + "You XYZ by default...\n", + "Name: XYZ\n", + "Address: -not sure-\n", + "Phone: -not sure-\n", + "You changed XYZ to ABC...\n", + "Name: ABC\n", + "Address: -not sure-\n", + "Phone: -not sure-\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-graph.cpp, Page-425" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self):\n", + " if(self._Graphics__nobjects[0]==False):\n", + " self._Graphics__setgraphicsmode()\n", + " self._Graphics__nobjects[0]+=1\n", + "def __del__(self):\n", + " self._Graphics__nobjects[0]-=1\n", + " if(self._Graphics__nobjects[0]==False):\n", + " self._Graphics__settextmode()\n", + "class Graphics:\n", + " __nobjects=[0]\n", + " def __setgraphicsmode(self):\n", + " pass\n", + " def __settextmode(self):\n", + " pass\n", + " __init__=__init__\n", + " __del__=__del__\n", + " def getcount(self):\n", + " return self.__nobjects[0]\n", + "def my_func():\n", + " obj=Graphics()\n", + " print \"No. of Graphics' objects while in my_func=\", obj.getcount()\n", + "obj1=Graphics()\n", + "print \"No. of Graphics' objects before in my_func=\", obj1.getcount()\n", + "my_func()\n", + "print \"No. of Graphics' objects after in my_func=\", obj1.getcount()\n", + "obj2=Graphics()\n", + "obj3=Graphics()\n", + "obj4=Graphics()\n", + "print \"Value of static member nobjects after all 3 more objects...\"\n", + "print \"In obj1= \", obj1.getcount()\n", + "print \"In obj2= \", obj2.getcount()\n", + "print \"In obj3= \", obj3.getcount()\n", + "print \"In obj4= \", obj4.getcount()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No. of Graphics' objects before in my_func= 1\n", + "No. of Graphics' objects while in my_func= 2\n", + "No. of Graphics' objects after in my_func= 1\n", + "Value of static member nobjects after all 3 more objects...\n", + "In obj1= 4\n", + "In obj2= 4\n", + "In obj3= 4\n", + "In obj4= 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page-428" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def distance(self, a, b):\n", + " self.x=a.x-b.x\n", + " self.y=a.y-b.y\n", + "def display(self):\n", + " print \"x= \",self.x\n", + " print \"y= \", self.y\n", + "class point:\n", + " __x=int\n", + " __y=int\n", + " def __init__(self, a=None, b=None):\n", + " if isinstance(a, int):\n", + " self.x=a\n", + " self.y=b\n", + " else:\n", + " self.x=self.y=0\n", + " def __del__(self):\n", + " pass\n", + " distance=distance\n", + " display=display\n", + "p1=point(40,18)\n", + "p2=point(12,9)\n", + "p3=point()\n", + "p3.distance(p1,p2)\n", + "print \"Coordinates of P1: \"\n", + "p1.display()\n", + "print \"Coordinates of P2: \"\n", + "p2.display()\n", + "print \"distance between P1 and P2: \"\n", + "p3.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Coordinates of P1: \n", + "x= 40\n", + "y= 18\n", + "Coordinates of P2: \n", + "x= 12\n", + "y= 9\n", + "distance between P1 and P2: \n", + "x= 28\n", + "y= 9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page-430" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def display(self):\n", + " print \"a =\", self.a,\n", + " print \"b =\", self.b\n", + "class data:\n", + " __a=int\n", + " __b=float\n", + " def __init__(self, x=None, y=None):\n", + " if isinstance(x, int):\n", + " self.a=x\n", + " self.b=y\n", + " elif isinstance(x, data):\n", + " self.a=x.a\n", + " self.b=x.b\n", + " else:\n", + " self.a=0\n", + " self.b=0\n", + " display=display\n", + "d1=data()\n", + "d2=data(12,9.9)\n", + "d3=data(d2)\n", + "print \"For default constructor: \"\n", + "d1.display()\n", + "print\"For parameterized constructor: \"\n", + "d2.display()\n", + "print \"For Copy Constructor: \"\n", + "d3.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For default constructor: \n", + "a = 0 b = 0\n", + "For parameterized constructor: \n", + "a = 12 b = 9.9\n", + "For Copy Constructor: \n", + "a = 12 b = 9.9\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up_1.ipynb new file mode 100755 index 00000000..e8f510a1 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up_1.ipynb @@ -0,0 +1,1781 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:daf00031bcc29ced764c693239a5bacfba6d7f22c75e738fbcf7b0290dee3513" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11: Object Initialization and clean up" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- bag.cpp, Page-392" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_ITEMS=25\n", + "def show(self):\n", + " for i in range(self.ItemCount):\n", + " print self._Bag__contents[i],\n", + "class Bag:\n", + " __contents=[int]*MAX_ITEMS\n", + " __ItemCount=int\n", + " def SetEmpty(self):\n", + " self.ItemCount=0\n", + " def put(self,item):\n", + " self._Bag__contents[self.ItemCount]=item\n", + " self.ItemCount+=1\n", + " show=show\n", + "bag=Bag() #object of class Bag\n", + "bag.SetEmpty() #initialize the object\n", + "while 1:\n", + " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", + " if item==0:\n", + " break\n", + " bag.put(item)\n", + " print \"Items in bag:\",\n", + " bag.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in bag: 1" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3 2" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3 2 4" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- newbag.cpp, Page-395" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_ITEMS=25 #size of array contents\n", + "def show(self):\n", + " for i in range(self.ItemCount):\n", + " print self._Bag__contents[i],\n", + "class Bag:\n", + " __contents=[int]*MAX_ITEMS #int 1D array\n", + " __ItemCount=int\n", + " def __init__(self): #Constructor\n", + " self.ItemCount=0\n", + " def put(self,item): #member function defined inside the class\n", + " self._Bag__contents[self.ItemCount]=item\n", + " self.ItemCount+=1\n", + " show=show #member function defined outside the class\n", + "bag=Bag() #object of class Bag\n", + "while 1:\n", + " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", + " if item==0:\n", + " break\n", + " bag.put(item)\n", + " print \"Items in bag:\",\n", + " bag.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in bag: 1" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3 2" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3 2 4" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-test1.cpp, Page-396" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self):\n", + " print \"Constructor of class test called\"\n", + "class Test:\n", + " __init__=__init__ #Constructor\n", + "G=Test()\n", + "def func():\n", + " L=Test()\n", + " print \"Here's function func()\"\n", + "X=Test()\n", + "print \"main() function\"\n", + "func()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor of class test called\n", + "Constructor of class test called\n", + "main() function\n", + "Constructor of class test called\n", + "Here's function func()\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- giftbag.cpp, Page- 398" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_ITEMS=25\n", + "def show(self):\n", + " if self.ItemCount:\n", + " for i in range(self.ItemCount):\n", + " print self._Bag__contents[i],\n", + " else:\n", + " print \"Nil\"\n", + "class Bag:\n", + " __contents=[int]*MAX_ITEMS\n", + " __ItemCount=int\n", + " def __init__(self, item=None): #parameterized constructor: Python does not support overloading of functions\n", + " if isinstance(item, int):\n", + " self._Bag__contents[0]=item\n", + " self.ItemCount=1\n", + " else:\n", + " self.ItemCount=0\n", + " def put(self,item):\n", + " self._Bag__contents[self.ItemCount]=item\n", + " self.ItemCount+=1\n", + " show=show\n", + "bag1=Bag()\n", + "bag2=Bag(4) #object created using the parameterized constructor\n", + "print \"Gifted bag1 initially has:\",\n", + "bag1.show()\n", + "print \"Gifted bag2 initially has:\",\n", + "bag2.show()\n", + "while 1:\n", + " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", + " if item==0:\n", + " break\n", + " bag2.put(item)\n", + " print \"Items in bag2:\",\n", + " bag2.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Gifted bag1 initially has: Nil\n", + "Gifted bag2 initially has: 4" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag2: 4 1" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag2: 4 1 2" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag2: 4 1 2 3" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-test.cpp, Page-400 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self):\n", + " print \"Constructor of class Test called\"\n", + "def __del__(self):\n", + " print \"Destructor of class Test called\"\n", + "class Test:\n", + " __init__=__init__ #Constructor\n", + " __del__=__del__ #Destructor\n", + "x=Test()\n", + "print \"Terminating main\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor of class Test called\n", + "Destructor of class Test called\n", + "Terminating main\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-count.cpp, Page-401" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "nobjects=0\n", + "nobj_alive=0\n", + "class MyClass:\n", + " def __init__(self):\n", + " global nobjects #using the global nobjects\n", + " global nobj_alive #using the global nobj_alive\n", + " nobjects+=1\n", + " nobj_alive+=1\n", + " def __del__(self):\n", + " global nobj_alive #using the global nobjects\n", + " nobj_alive-=1\n", + " def show(self):\n", + " global nobjects\n", + " global nobj_alive\n", + " print \"Total number of objects created: \", nobjects\n", + " print \"Number of objects currently alive: \", nobj_alive\n", + "obj1=MyClass()\n", + "obj1.show()\n", + "def func():\n", + " obj1=MyClass()\n", + " obj2=MyClass()\n", + " obj2.show()\n", + " del obj1\n", + " del obj2\n", + "func()\n", + "obj1.show()\n", + "obj2=MyClass()\n", + "obj3=MyClass()\n", + "obj2.show()\n", + "del obj1\n", + "del obj2\n", + "del obj3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total number of objects created: 1\n", + "Number of objects currently alive: 1\n", + "Total number of objects created: 3\n", + "Number of objects currently alive: 3\n", + "Total number of objects created: 3\n", + "Number of objects currently alive: 1\n", + "Total number of objects created: 5\n", + "Number of objects currently alive: 3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-account.cpp, Page- 403" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def MoneyTransfer(self, acc , amount):\n", + " self._AccClass__balance=self._AccClass__balance-amount\n", + " acc._AccClass__balance=acc._AccClass__balance + amount\n", + "class AccClass:\n", + " __accno=int\n", + " __balance=float\n", + " def __init__(self, an=None, bal=0.0):\n", + " if isinstance(an, int):\n", + " self.accno=an\n", + " self.__balance=bal\n", + " else:\n", + " self.accno=raw_input(\"Enter account number for acc1 object: \")\n", + " self.__balance=float(raw_input(\"Enter the balance: \"))\n", + " def display(self):\n", + " print \"Acoount number is: \", self.accno\n", + " print \"Balance is: \", self.__balance\n", + " MoneyTransfer=MoneyTransfer\n", + "acc1=AccClass()\n", + "acc2=AccClass(10)\n", + "acc3=AccClass(20, 750.5)\n", + "print \"Acoount information...\"\n", + "acc1.display()\n", + "acc2.display()\n", + "acc3.display()\n", + "trans_money=float(raw_input(\"How much money is to be transferred from acc3 to acc1: \"))\n", + "acc3.MoneyTransfer(acc1, trans_money)\n", + "print \"Updated information about accounts...\"\n", + "acc1.display()\n", + "acc2.display()\n", + "acc3.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter account number for acc1 object: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the balance: 100\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Acoount information...\n", + "Acoount number is: 1\n", + "Balance is: 100.0\n", + "Acoount number is: 10\n", + "Balance is: 0.0\n", + "Acoount number is: 20\n", + "Balance is: 750.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How much money is to be transferred from acc3 to acc1: 200\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Updated information about accounts...\n", + "Acoount number is: 1\n", + "Balance is: 300.0\n", + "Acoount number is: 10\n", + "Balance is: 0.0\n", + "Acoount number is: 20\n", + "Balance is: 550.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-test2.cpp. Page- 405" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self, NameIn=None):\n", + " if isinstance(NameIn, str):\n", + " self.name=NameIn\n", + " print \"Test Object \", NameIn, \" created\"\n", + " else:\n", + " self.name=\"unnamed\"\n", + " print \"Test object 'unnamed' created\"\n", + "def __del__(self):\n", + " print \"Test Object \", self.name, \" destroyed\"\n", + " del self.name\n", + "class Test:\n", + " __name=[str]\n", + " __init__=__init__\n", + " __del__=__del__\n", + "g=Test(\"global\")\n", + "def func():\n", + " l=Test(\"func\")\n", + " print \"here's function func()\"\n", + "x=Test(\"main\")\n", + "func()\n", + "print \"main() function - termination\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Test Object global created\n", + "Test Object global destroyed\n", + "Test Object main created\n", + "Test Object main destroyed\n", + "Test Object func created\n", + "here's function func()\n", + "Test Object func destroyed\n", + "main() function - termination\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex1.cpp, Page- 407" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "def add (self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self, real_in=None, imag_in=0.0):\n", + " if isinstance(real_in, float):\n", + " self.__real=real_in\n", + " self.__imag=imag_in\n", + " else:\n", + " self.__real=self.__imag=0.0\n", + " def show(self, msg):\n", + " print msg, \n", + " print self.__real,\n", + " if self.__imag<0:\n", + " print \"-i\",\n", + " else:\n", + " print \"+i\",\n", + " print math.fabs(self.__imag) #print absolute value\n", + " add=add\n", + "c1=Complex(1.5,2.0)\n", + "c2=Complex(2.2)\n", + "c3=Complex()\n", + "c1.show(\"c1=\")\n", + "c2.show(\"c2=\")\n", + "c3=c1.add(c2)\n", + "c3.show(\"c3=c1.add(c2):\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c1= 1.5 +i 2.0\n", + "c2= 2.2 +i 0.0\n", + "c3=c1.add(c2): 3.7 +i 2.0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- noname.cpp, Page- 410" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class nameless:\n", + " __a=int\n", + " def __init__(self):\n", + " print \"Constructor\"\n", + " def __del__(self):\n", + " print \"Destructor\"\n", + "nameless() #nameless object created\n", + "n1=nameless()\n", + "n2=nameless()\n", + "print \"Program terminates\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor\n", + "Destructor\n", + "Constructor\n", + "Destructor\n", + "Constructor\n", + "Destructor\n", + "Program terminates\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-name.cpp, Page-411" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show(self, msg):\n", + " print msg\n", + " print \"First Name: \", self._name__first\n", + " if self._name__middle[0]:\n", + " print \"Middle Name: \", self._name__middle\n", + " if self._name__last[0]:\n", + " print \"Last Name: \", self._name__last\n", + "class name:\n", + " __first=[None]*15\n", + " __middle=[None]*15\n", + " __last=[None]*15\n", + " def __init__(self, FirstName=None, MiddleName=None, LastName=None):\n", + " if isinstance(LastName, str):\n", + " self.__last=LastName\n", + " self.__middle=MiddleName\n", + " self.__first=FirstName\n", + " elif isinstance(MiddleName, str):\n", + " self.__middle=MiddleName\n", + " self.__first=FirstName\n", + " elif isinstance(FirstName, str):\n", + " self.__first=FirstName\n", + " else:\n", + " self.__last='\\0' #initialized to NULL\n", + " self.__middle='\\0'\n", + " self.__first='\\0'\n", + " show=show\n", + "n1=name()\n", + "n2=name()\n", + "n3=name()\n", + "n1=name(\"Rajkumar\")\n", + "n2=name(\"Savithri\", \"S\")\n", + "n3=name(\"Veugopal\", \"K\", \"R\")\n", + "n1.show(\"First prson details...\")\n", + "n2.show(\"Second prson details...\")\n", + "n3.show(\"Third prson details...\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First prson details...\n", + "First Name: Rajkumar\n", + "Second prson details...\n", + "First Name: Savithri\n", + "Middle Name: S\n", + "Third prson details...\n", + "First Name: Veugopal\n", + "Middle Name: K\n", + "Last Name: R\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector1.cpp, Page-413" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def read(self):\n", + " for i in range(self._vector__sz):\n", + " print \"Enter vector [\", i, \"]? \",\n", + " self._vector__v[i]=int(raw_input())\n", + "def show_sum(self):\n", + " Sum=0\n", + " for i in range(self._vector__sz):\n", + " Sum+=self._vector__v[i]\n", + " print \"Vector sum= \", Sum\n", + "class vector:\n", + " __v=[int] #array of type integer\n", + " __sz=int\n", + " def __init__(self, size):\n", + " self.__sz= size\n", + " self.__v=[int]*size #dynamically allocating size to integer array\n", + " def __del__(self):\n", + " del self.__v\n", + " read=read\n", + " show_sum=show_sum\n", + "count = int\n", + "count=int(raw_input(\"How many elements are there in the vector: \"))\n", + "v1= vector(count)\n", + "v1.read()\n", + "v1.show_sum()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many elements are there in the vector: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter vector [ 0 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 1 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 2 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 3 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 4 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Vector sum= 15\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector2.cpp, Page-415" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show(self):\n", + " for i in range(self._vector__size):\n", + " print self.elem(i), \", \",\n", + "class vector:\n", + " __v=[int]\n", + " __size=int\n", + " def __init__(self, vector_size):\n", + " if isinstance(vector_size, int):\n", + " self.__size= vector_size\n", + " self.__v=[int]*vector_size\n", + " else:\n", + " print \"Copy construcor invoked\"\n", + " self.__size=vector_size.__size\n", + " self.__v=[int]*vector_size.__size\n", + " for i in range(vector_size.__size):\n", + " self.__v[i]=vector_size.__v[i]\n", + " def elem(self,i):\n", + " if i>=self.__size:\n", + " print \"Error: Out of Range\"\n", + " return -1\n", + " return self.__v[i]\n", + " def __del__(self):\n", + " del self.__v\n", + " show=show\n", + "v1=vector(5)\n", + "v2=vector(5)\n", + "for i in range(5):\n", + " if v2.elem(i)!=-1:\n", + " v2._vector__v[i]=i+1\n", + "v1=v2\n", + "v3=vector(v2)\n", + "print \"Vector v1: \",\n", + "v1.show()\n", + "print \"\\nvector v2: \",\n", + "v2.show()\n", + "print \"\\nvector v3: \",\n", + "v3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Copy construcor invoked\n", + "Vector v1: 1 , 2 , 3 , 4 , 5 , \n", + "vector v2: 1 , 2 , 3 , 4 , 5 , \n", + "vector v3: 1 , 2 , 3 , 4 , 5 , \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-matrix.cpp, Page-418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "TRUE=1\n", + "FALSE=0\n", + "def __del__(self):\n", + " for i in range(self._matrix__MaxRow):\n", + " del self._matrix__p[i]\n", + " del self._matrix__p\n", + "def add(self, a, b):\n", + " self._matrix__MaxRow=a._matrix__MaxRow\n", + " self._matrix__MaxCol=a._matrix__MaxCol\n", + " if (a._matrix__MaxRow!=b._matrix__MaxRow)|(a._matrix__MaxCol!=b._matrix__MaxCol):\n", + " print \"Error: invalid matrix order for addition\"\n", + " return\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " self._matrix__p[i][j]=a._matrix__p[i][j]+b._matrix__p[i][j]\n", + "def sub(self, a, b):\n", + " self._matrix__MaxRow=a._matrix__MaxRow\n", + " self._matrix__MaxCol=a._matrix__MaxCol\n", + " if (a._matrix__MaxRow!=b._matrix__MaxRow)|(a._matrix__MaxCol!=b._matrix__MaxCol):\n", + " print \"Error: invalid matrix order for subtraction\"\n", + " return\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " self._matrix__p[i][j]=a._matrix__p[i][j]-b._matrix__p[i][j]\n", + "def mul(self, a, b):\n", + " self._matrix__MaxRow=a._matrix__MaxRow\n", + " self._matrix__MaxCol=a._matrix__MaxCol\n", + " if (a._matrix__MaxCol!=b._matrix__MaxRow):\n", + " print \"Error: invalid matrix order for multiplication\"\n", + " return\n", + " for i in range(a._matrix__MaxRow):\n", + " for j in range(b._matrix__MaxCol):\n", + " self._matrix__p[i][j]=0\n", + " for k in range(a._matrix__MaxCol):\n", + " self._matrix__p[i][j]+=a._matrix__p[i][j]*b._matrix__p[i][j]\n", + "def eql(self, b):\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " if self._matrix__p[i][i]!=b._matrix__p[i][j]:\n", + " return 0\n", + " return 1\n", + "def read(self):\n", + " self._matrix__p = []\n", + " for i in range(self._matrix__MaxRow):\n", + " self._matrix__p.append([])\n", + " for j in range(self._matrix__MaxCol):\n", + " print \"Matrix[%d,%d] =? \" %(i, j),\n", + " self._matrix__p[i].append(int(raw_input()))\n", + "def show(self):\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " print self._matrix__p[i][j], \" \",\n", + " print \"\"\n", + "class matrix:\n", + " __MaxRow=int\n", + " __MaxCol=int\n", + " __p=[int]\n", + " def __init__(self, row=0, col=0):\n", + " self.__MaxRow=row\n", + " self.__MaxCol=col\n", + " if row>0:\n", + " self.__p=[[int]*self.__MaxCol]*self.__MaxRow\n", + " __del__=__del__\n", + " read=read\n", + " show=show\n", + " add=add\n", + " sub=sub\n", + " mul=mul\n", + " eql=eql\n", + "print \"Enter Matrix A details...\"\n", + "m=int(raw_input(\"How many rows? \"))\n", + "n=int(raw_input(\"How many columns? \"))\n", + "a=matrix(m,n)\n", + "a.read()\n", + "print \"Enter Matrix B details...\"\n", + "p=int(raw_input(\"How many rows? \"))\n", + "q=int(raw_input(\"How many columns? \"))\n", + "b=matrix(p,q)\n", + "b.read()\n", + "print \"Matrix A is...\"\n", + "a.show()\n", + "print \"Matrix B is...\"\n", + "b.show()\n", + "c=matrix(m,n)\n", + "c.add(a,b)\n", + "print \"C=A+B...\"\n", + "c.show()\n", + "d=matrix(m,n)\n", + "d.sub(a,b)\n", + "print \"D=A-B...\"\n", + "d.show()\n", + "e=matrix(m,q)\n", + "e.mul(a,b)\n", + "print \"E=A*B...\"\n", + "e.show()\n", + "print \"(Is matrix A equal to matrix B)? \",\n", + "if(a.eql(b)):\n", + " print \"Yes\"\n", + "else:\n", + " print \"No\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Matrix A details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns? 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[0,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[0,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[0,2] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,2] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[2,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[2,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[2,2] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Matrix B details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns? 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[0,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[0,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[0,2] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,2] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[2,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[2,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[2,2] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix A is...\n", + "2 2 2 \n", + "2 2 2 \n", + "2 2 2 \n", + "Matrix B is...\n", + "1 1 1 \n", + "1 1 1 \n", + "1 1 1 \n", + "C=A+B...\n", + "3 3 3 \n", + "3 3 3 \n", + "3 3 3 \n", + "D=A-B...\n", + "1 1 1 \n", + "1 1 1 \n", + "1 1 1 \n", + "E=A*B...\n", + "6 6 6 \n", + "6 6 6 \n", + "6 6 6 \n", + "(Is matrix A equal to matrix B)? No\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-person.cpp, Page-423" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self, NameIn, AddressIn, PhoneIn):\n", + " self._Person__name=NameIn\n", + " self._Person__address=AddressIn\n", + " self._Person__phone=PhoneIn\n", + "#inline\n", + "def __del__(self):\n", + " del self._Person__name\n", + " del self._Person__address\n", + " del self._Person__phone\n", + "def getname(self):\n", + " return self._Person__name\n", + "def getaddress(self):\n", + " return self._Person__address\n", + "def getphone(self):\n", + " return self._Person__phone\n", + "def changename(self, NameIn):\n", + " if(self._Person__name):\n", + " del self._Person__name\n", + " self._Person__name=NameIn\n", + "class Person:\n", + " __name=[str]\n", + " __address=[str]\n", + " __phone=[str]\n", + " __init__=__init__\n", + " __del__=__del__\n", + " getname=getname\n", + " getaddress=getaddress\n", + " getphone=getphone\n", + " changename=changename\n", + "def printperson(p):\n", + " if(p.getname()):\n", + " print \"Name: \", p.getname()\n", + " if(p.getaddress()):\n", + " print \"Address: \", p.getaddress()\n", + " if(p.getphone()):\n", + " print \"Phone: \", p.getphone()\n", + "me=Person(\"Rajkumar\", \"E-mail: raj@cdabc.erne.in\", \"91-080-5584271\")\n", + "printperson(me)\n", + "you=Person(\"XYZ\", \"-not sure-\", \"-not sure-\")\n", + "print \"You XYZ by default...\"\n", + "printperson(you)\n", + "you.changename(\"ABC\")\n", + "print \"You changed XYZ to ABC...\"\n", + "printperson(you)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Rajkumar\n", + "Address: E-mail: raj@cdabc.erne.in\n", + "Phone: 91-080-5584271\n", + "You XYZ by default...\n", + "Name: XYZ\n", + "Address: -not sure-\n", + "Phone: -not sure-\n", + "You changed XYZ to ABC...\n", + "Name: ABC\n", + "Address: -not sure-\n", + "Phone: -not sure-\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-graph.cpp, Page-425" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self):\n", + " if(self._Graphics__nobjects[0]==False):\n", + " self._Graphics__setgraphicsmode()\n", + " self._Graphics__nobjects[0]+=1\n", + "def __del__(self):\n", + " self._Graphics__nobjects[0]-=1\n", + " if(self._Graphics__nobjects[0]==False):\n", + " self._Graphics__settextmode()\n", + "class Graphics:\n", + " __nobjects=[0]\n", + " def __setgraphicsmode(self):\n", + " pass\n", + " def __settextmode(self):\n", + " pass\n", + " __init__=__init__\n", + " __del__=__del__\n", + " def getcount(self):\n", + " return self.__nobjects[0]\n", + "def my_func():\n", + " obj=Graphics()\n", + " print \"No. of Graphics' objects while in my_func=\", obj.getcount()\n", + "obj1=Graphics()\n", + "print \"No. of Graphics' objects before in my_func=\", obj1.getcount()\n", + "my_func()\n", + "print \"No. of Graphics' objects after in my_func=\", obj1.getcount()\n", + "obj2=Graphics()\n", + "obj3=Graphics()\n", + "obj4=Graphics()\n", + "print \"Value of static member nobjects after all 3 more objects...\"\n", + "print \"In obj1= \", obj1.getcount()\n", + "print \"In obj2= \", obj2.getcount()\n", + "print \"In obj3= \", obj3.getcount()\n", + "print \"In obj4= \", obj4.getcount()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No. of Graphics' objects before in my_func= 1\n", + "No. of Graphics' objects while in my_func= 2\n", + "No. of Graphics' objects after in my_func= 1\n", + "Value of static member nobjects after all 3 more objects...\n", + "In obj1= 4\n", + "In obj2= 4\n", + "In obj3= 4\n", + "In obj4= 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page-428" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def distance(self, a, b):\n", + " self.x=a.x-b.x\n", + " self.y=a.y-b.y\n", + "def display(self):\n", + " print \"x= \",self.x\n", + " print \"y= \", self.y\n", + "class point:\n", + " __x=int\n", + " __y=int\n", + " def __init__(self, a=None, b=None):\n", + " if isinstance(a, int):\n", + " self.x=a\n", + " self.y=b\n", + " else:\n", + " self.x=self.y=0\n", + " def __del__(self):\n", + " pass\n", + " distance=distance\n", + " display=display\n", + "p1=point(40,18)\n", + "p2=point(12,9)\n", + "p3=point()\n", + "p3.distance(p1,p2)\n", + "print \"Coordinates of P1: \"\n", + "p1.display()\n", + "print \"Coordinates of P2: \"\n", + "p2.display()\n", + "print \"distance between P1 and P2: \"\n", + "p3.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Coordinates of P1: \n", + "x= 40\n", + "y= 18\n", + "Coordinates of P2: \n", + "x= 12\n", + "y= 9\n", + "distance between P1 and P2: \n", + "x= 28\n", + "y= 9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page-430" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def display(self):\n", + " print \"a =\", self.a,\n", + " print \"b =\", self.b\n", + "class data:\n", + " __a=int\n", + " __b=float\n", + " def __init__(self, x=None, y=None):\n", + " if isinstance(x, int):\n", + " self.a=x\n", + " self.b=y\n", + " elif isinstance(x, data):\n", + " self.a=x.a\n", + " self.b=x.b\n", + " else:\n", + " self.a=0\n", + " self.b=0\n", + " display=display\n", + "d1=data()\n", + "d2=data(12,9.9)\n", + "d3=data(d2)\n", + "print \"For default constructor: \"\n", + "d1.display()\n", + "print\"For parameterized constructor: \"\n", + "d2.display()\n", + "print \"For Copy Constructor: \"\n", + "d3.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For default constructor: \n", + "a = 0 b = 0\n", + "For parameterized constructor: \n", + "a = 12 b = 9.9\n", + "For Copy Constructor: \n", + "a = 12 b = 9.9\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects.ipynb new file mode 100755 index 00000000..2c56060d --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects.ipynb @@ -0,0 +1,1590 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:dd08d35ee9767f23c09f2b0ea16b1cee00b60ac3967c95c41f4ba5d0c6e14cf0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12-Dynamic Objects" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ptrobj1.cpp, Page no-435" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class someclass(Structure):\n", + " data1=int\n", + " data2=chr\n", + " def __init__(self):\n", + " print 'Constructor someclass() is invoked'\n", + " self.data1=1\n", + " self.data2='A'\n", + " def __del__(self):\n", + " print 'Destructor ~someclass() is invoked'\n", + " def show(self):\n", + " print 'data1 =', self.data1,\n", + " print 'data2 =', self.data2\n", + "object1=someclass() #object of class someclass\n", + "ptr=POINTER(someclass) #pointer of type class someclass\n", + "ptr=object1 #pointer pointing to object of class someclass\n", + "print \"Accessing object through object1.show()...\"\n", + "object1.show()\n", + "print \"Accessing object through ptr->show()...\"\n", + "ptr.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor someclass() is invoked\n", + "Destructor ~someclass() is invoked\n", + "Accessing object through object1.show()...\n", + "data1 = 1 data2 = A\n", + "Accessing object through ptr->show()...\n", + "data1 = 1 data2 = A\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ptrobj2.cpp, Page no-437" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class someclass(Structure):\n", + " data1=int\n", + " data2=chr\n", + " def __init__(self):\n", + " print 'Constructor someclass() is invoked'\n", + " self.data1=1\n", + " self.data2='A'\n", + " def __del__(self):\n", + " print 'Destructor ~someclass() is invoked'\n", + " def show(self):\n", + " print 'data1 =', self.data1,\n", + " print 'data2 =', self.data2\n", + "object1=someclass()\n", + "ptr=POINTER(someclass)\n", + "ptr=object1\n", + "print \"Accessing object through object1.show()...\"\n", + "ptr.show()\n", + "print \"Destroying dynamic object...\"\n", + "del ptr" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor someclass() is invoked\n", + "Destructor ~someclass() is invoked\n", + "Accessing object through object1.show()...\n", + "data1 = 1 data2 = A\n", + "Destroying dynamic object...\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-useref.cpp, Page no-439" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "t1=POINTER(c_int)\n", + "t1=c_int(5)\n", + "t3=c_int(5)\n", + "t2=c_int(10)\n", + "t1.value=t1.value+t2.value\n", + "print \"Sum of\", t3.value,\n", + "print \"and\", t2.value, \n", + "print \"is:\", t1.value" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of 5 and 10 is: 15\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-refobj.cpp, Page no-440" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class student(Structure):\n", + " __roll_no=int\n", + " __name=str\n", + " def setdata(self, roll_no_in, name_in):\n", + " self.__roll_no=roll_no_in\n", + " self.__name=name_in\n", + " def outdata(self):\n", + " print \"Roll No =\", self.__roll_no\n", + " print \"Name =\", self.__name\n", + "s1=student()\n", + "s1.setdata(1, \"Savithri\")\n", + "s1.outdata()\n", + "s2=student()\n", + "s2.setdata(2, \"Bhavani\")\n", + "s2.outdata()\n", + "s3=student()\n", + "s3.setdata(3, \"Vani\")\n", + "s4=s3\n", + "s3.outdata()\n", + "s4.outdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll No = 1\n", + "Name = Savithri\n", + "Roll No = 2\n", + "Name = Bhavani\n", + "Roll No = 3\n", + "Name = Vani\n", + "Roll No = 3\n", + "Name = Vani\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student3.cpp, Page no-442" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class student:\n", + " __roll_no=int\n", + " __name=str\n", + " def __init__(self, roll_no_in=None, name_in=None):\n", + " if isinstance(roll_no_in, int):\n", + " self.__roll_no=roll_no_in\n", + " if isinstance(name_in, str):\n", + " self.__name=name_in\n", + " else:\n", + " flag=raw_input(\"Do you want to initialize the object (y/n): \")\n", + " if flag=='y' or flag=='Y':\n", + " self.__roll_no=int(raw_input(\"Enter Roll no. of student: \"))\n", + " Str=raw_input(\"Enter Name of student: \")\n", + " self.__name=Str\n", + " else:\n", + " self.__roll_no=0\n", + " self.__name=None\n", + " def __del__(self):\n", + " if isinstance(self.__name, str):\n", + " del self.__name\n", + " def Set(self):\n", + " student(roll_no_in, name_in)\n", + " def show(self):\n", + " if self.__roll_no:\n", + " print \"Roll No:\", self.__roll_no\n", + " else:\n", + " print \"Roll No: (not initialized)\"\n", + " if isinstance(self.__name, str):\n", + " print \"Name: \", self.__name\n", + " else:\n", + " print \"Name: (not initialized)\"\n", + "s1=student()\n", + "s2=student()\n", + "s3=student(1)\n", + "s4=student(2, \"Bhavani\")\n", + "print \"Live objects contents...\"\n", + "s1.show()\n", + "s2.show()\n", + "s3.show()\n", + "s4.show()\n", + "del s1\n", + "del s2\n", + "del s3\n", + "del s4" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Do you want to initialize the object (y/n): n\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Do you want to initialize the object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Roll no. of student: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name of student: Rekha\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Live objects contents...\n", + "Roll No: (not initialized)\n", + "Name: (not initialized)\n", + "Roll No: 5\n", + "Name: Rekha\n", + "Roll No: 1\n", + "Name: (not initialized)\n", + "Roll No: 2\n", + "Name: Bhavani\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student1.cpp, Page-445" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class student:\n", + " __roll_no=int\n", + " __name=str\n", + " def setdata(self, roll_no_in, name_in):\n", + " self.__roll_no=roll_no_in\n", + " self.__name=name_in\n", + " def outdata(self):\n", + " print \"Roll No =\", self.__roll_no\n", + " print \"Name =\", self.__name\n", + "s=[]*10 #array of objects\n", + "count=0\n", + "for i in range(10):\n", + " s.append(student())\n", + "for i in range(10):\n", + " response=raw_input(\"Initialize student object (y/n): \")\n", + " if response=='y' or response=='Y':\n", + " roll_no=int(raw_input(\"Enter a Roll no. of student: \"))\n", + " name=raw_input(\"Enter name of student: \")\n", + " s[i].setdata(roll_no, name)\n", + " count+=1\n", + " else:\n", + " break\n", + "print \"Student Details...\"\n", + "for i in range(count):\n", + " s[i].outdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initialize student object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a Roll no. of student: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of student: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initialize student object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a Roll no. of student: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of student: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initialize student object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a Roll no. of student: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of student: Savithri\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initialize student object (y/n): n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Details...\n", + "Roll No = 1\n", + "Name = Rajkumar\n", + "Roll No = 2\n", + "Name = Tejaswi\n", + "Roll No = 3\n", + "Name = Savithri\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student2.cpp, Page no-447" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class student(Structure):\n", + " __roll_no=int\n", + " __name=str\n", + " def setdata(self, roll_no_in, name_in):\n", + " self.__roll_no=roll_no_in\n", + " self.__name=name_in\n", + " def outdata(self):\n", + " print \"Roll No =\", self.__roll_no\n", + " print \"Name =\", self.__name\n", + "temp=[]*10\n", + "s=POINTER(student) \n", + "count=0\n", + "for i in range(10):\n", + " temp.append(student())\n", + "s=temp #pointer to array of objects\n", + "for i in range(10):\n", + " response=raw_input(\"Create student object (y/n): \")\n", + " if response=='y' or response=='Y':\n", + " roll_no=int(raw_input(\"Enter a Roll no. of student: \"))\n", + " name=raw_input(\"Enter name of student: \")\n", + " s[i].setdata(roll_no, name)\n", + " count+=1\n", + " else:\n", + " break\n", + "print \"Student Details...\"\n", + "for i in range(count):\n", + " s[i].outdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Create student object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a Roll no. of student: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of student: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Create student object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a Roll no. of student: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of student: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Create student object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a Roll no. of student: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of student: Savithri\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Create student object (y/n): n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Details...\n", + "Roll No = 1\n", + "Name = Rajkumar\n", + "Roll No = 2\n", + "Name = Tejaswi\n", + "Roll No = 3\n", + "Name = Savithri\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ptrmemb.cpp, Page no-452" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X:\n", + " __y=int\n", + " a=int\n", + " b=int\n", + " def init(self, z):\n", + " self.a=z\n", + " return z\n", + "obj=X()\n", + "ip=X.a #pointer to data member\n", + "obj.ip=10 #access through object\n", + "print \"a in obj after obj.*ip = 10 is\", obj.ip\n", + "pobj=[obj] #pointer to object of class X\n", + "pobj[0].ip=10 #access through object pointer\n", + "print \"a in obj after pobj->*ip = 10 is\", pobj[0].ip\n", + "ptr_init=X.init #pointer to member function\n", + "ptr_init(obj,5) #access through object\n", + "print \"a in obj after (obj.*ptr_init)(5) =\", obj.a\n", + "ptr_init(pobj[0],5) #access through object pointer\n", + "print \"a in obj after (pobj->*ptr_init)(5) =\", obj.a" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a in obj after obj.*ip = 10 is 10\n", + "a in obj after pobj->*ip = 10 is 10\n", + "a in obj after (obj.*ptr_init)(5) = 5\n", + "a in obj after (pobj->*ptr_init)(5) = 5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-friend.cpp, Page no-454" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X():\n", + " __a=int\n", + " __b=int\n", + " def __init__(self):\n", + " self.__a=0\n", + " self.__b=0\n", + " def SetMembers(self, a1, b1):\n", + " self.__a=a1\n", + " self.__b=b1\n", + "def sum(objx):\n", + " pa=[X._X__a]\n", + " pb=[X._X__b]\n", + " objx.pa=objx._X__a\n", + " objx.pb=objx._X__b\n", + " return objx.pa+objx.pb\n", + "objx=X()\n", + "pfunc=X.SetMembers\n", + "pfunc(objx, 5, 6)\n", + "print \"Sum =\", sum(objx)\n", + "pobjx=[objx]\n", + "pfunc(pobjx[0], 7, 8)\n", + "print \"Sum =\", sum(objx)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum = 11\n", + "Sum = 15\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-memhnd.cpp, Page no-455" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "def out_of_memory():\n", + " print \"Memory exhausted, cannot allocate\"\n", + "ip=pointer(c_int())\n", + "total_allocated=0L\n", + "print \"Ok, allocating...\"\n", + "while(1):\n", + " ip=[int]*100\n", + " total_allocated+=100L\n", + " print \"Now got a total of\", total_allocated, \"bytes\"\n", + " if total_allocated==29900L:\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ok, allocating...\n", + "Now got a total of 100 bytes\n", + "Now got a total of 200 bytes\n", + "Now got a total of 300 bytes\n", + "Now got a total of 400 bytes\n", + "Now got a total of 500 bytes\n", + "Now got a total of 600 bytes\n", + "Now got a total of 700 bytes\n", + "Now got a total of 800 bytes\n", + "Now got a total of 900 bytes\n", + "Now got a total of 1000 bytes\n", + "Now got a total of 1100 bytes\n", + "Now got a total of 1200 bytes\n", + "Now got a total of 1300 bytes\n", + "Now got a total of 1400 bytes\n", + "Now got a total of 1500 bytes\n", + "Now got a total of 1600 bytes\n", + "Now got a total of 1700 bytes\n", + "Now got a total of 1800 bytes\n", + "Now got a total of 1900 bytes\n", + "Now got a total of 2000 bytes\n", + "Now got a total of 2100 bytes\n", + "Now got a total of 2200 bytes\n", + "Now got a total of 2300 bytes\n", + "Now got a total of 2400 bytes\n", + "Now got a total of 2500 bytes\n", + "Now got a total of 2600 bytes\n", + "Now got a total of 2700 bytes\n", + "Now got a total of 2800 bytes\n", + "Now got a total of 2900 bytes\n", + "Now got a total of 3000 bytes\n", + "Now got a total of 3100 bytes\n", + "Now got a total of 3200 bytes\n", + "Now got a total of 3300 bytes\n", + "Now got a total of 3400 bytes\n", + "Now got a total of 3500 bytes\n", + "Now got a total of 3600 bytes\n", + "Now got a total of 3700 bytes\n", + "Now got a total of 3800 bytes\n", + "Now got a total of 3900 bytes\n", + "Now got a total of 4000 bytes\n", + "Now got a total of 4100 bytes\n", + "Now got a total of 4200 bytes\n", + "Now got a total of 4300 bytes\n", + "Now got a total of 4400 bytes\n", + "Now got a total of 4500 bytes\n", + "Now got a total of 4600 bytes\n", + "Now got a total of 4700 bytes\n", + "Now got a total of 4800 bytes\n", + "Now got a total of 4900 bytes\n", + "Now got a total of 5000 bytes\n", + "Now got a total of 5100 bytes\n", + "Now got a total of 5200 bytes\n", + "Now got a total of 5300 bytes\n", + "Now got a total of 5400 bytes\n", + "Now got a total of 5500 bytes\n", + "Now got a total of 5600 bytes\n", + "Now got a total of 5700 bytes\n", + "Now got a total of 5800 bytes\n", + "Now got a total of 5900 bytes\n", + "Now got a total of 6000 bytes\n", + "Now got a total of 6100 bytes\n", + "Now got a total of 6200 bytes\n", + "Now got a total of 6300 bytes\n", + "Now got a total of 6400 bytes\n", + "Now got a total of 6500 bytes\n", + "Now got a total of 6600 bytes\n", + "Now got a total of 6700 bytes\n", + "Now got a total of 6800 bytes\n", + "Now got a total of 6900 bytes\n", + "Now got a total of 7000 bytes\n", + "Now got a total of 7100 bytes\n", + "Now got a total of 7200 bytes\n", + "Now got a total of 7300 bytes\n", + "Now got a total of 7400 bytes\n", + "Now got a total of 7500 bytes\n", + "Now got a total of 7600 bytes\n", + "Now got a total of 7700 bytes\n", + "Now got a total of 7800 bytes\n", + "Now got a total of 7900 bytes\n", + "Now got a total of 8000 bytes\n", + "Now got a total of 8100 bytes\n", + "Now got a total of 8200 bytes\n", + "Now got a total of 8300 bytes\n", + "Now got a total of 8400 bytes\n", + "Now got a total of 8500 bytes\n", + "Now got a total of 8600 bytes\n", + "Now got a total of 8700 bytes\n", + "Now got a total of 8800 bytes\n", + "Now got a total of 8900 bytes\n", + "Now got a total of 9000 bytes\n", + "Now got a total of 9100 bytes\n", + "Now got a total of 9200 bytes\n", + "Now got a total of 9300 bytes\n", + "Now got a total of 9400 bytes\n", + "Now got a total of 9500 bytes\n", + "Now got a total of 9600 bytes\n", + "Now got a total of 9700 bytes\n", + "Now got a total of 9800 bytes\n", + "Now got a total of 9900 bytes\n", + "Now got a total of 10000 bytes\n", + "Now got a total of 10100 bytes\n", + "Now got a total of 10200 bytes\n", + "Now got a total of 10300 bytes\n", + "Now got a total of 10400 bytes\n", + "Now got a total of 10500 bytes\n", + "Now got a total of 10600 bytes\n", + "Now got a total of 10700 bytes\n", + "Now got a total of 10800 bytes\n", + "Now got a total of 10900 bytes\n", + "Now got a total of 11000 bytes\n", + "Now got a total of 11100 bytes\n", + "Now got a total of 11200 bytes\n", + "Now got a total of 11300 bytes\n", + "Now got a total of 11400 bytes\n", + "Now got a total of 11500 bytes\n", + "Now got a total of 11600 bytes\n", + "Now got a total of 11700 bytes\n", + "Now got a total of 11800 bytes\n", + "Now got a total of 11900 bytes\n", + "Now got a total of 12000 bytes\n", + "Now got a total of 12100 bytes\n", + "Now got a total of 12200 bytes\n", + "Now got a total of 12300 bytes\n", + "Now got a total of 12400 bytes\n", + "Now got a total of 12500 bytes\n", + "Now got a total of 12600 bytes\n", + "Now got a total of 12700 bytes\n", + "Now got a total of 12800 bytes\n", + "Now got a total of 12900 bytes\n", + "Now got a total of 13000 bytes\n", + "Now got a total of 13100 bytes\n", + "Now got a total of 13200 bytes\n", + "Now got a total of 13300 bytes\n", + "Now got a total of 13400 bytes\n", + "Now got a total of 13500 bytes\n", + "Now got a total of 13600 bytes\n", + "Now got a total of 13700 bytes\n", + "Now got a total of 13800 bytes\n", + "Now got a total of 13900 bytes\n", + "Now got a total of 14000 bytes\n", + "Now got a total of 14100 bytes\n", + "Now got a total of 14200 bytes\n", + "Now got a total of 14300 bytes\n", + "Now got a total of 14400 bytes\n", + "Now got a total of 14500 bytes\n", + "Now got a total of 14600 bytes\n", + "Now got a total of 14700 bytes\n", + "Now got a total of 14800 bytes\n", + "Now got a total of 14900 bytes\n", + "Now got a total of 15000 bytes\n", + "Now got a total of 15100 bytes\n", + "Now got a total of 15200 bytes\n", + "Now got a total of 15300 bytes\n", + "Now got a total of 15400 bytes\n", + "Now got a total of 15500 bytes\n", + "Now got a total of 15600 bytes\n", + "Now got a total of 15700 bytes\n", + "Now got a total of 15800 bytes\n", + "Now got a total of 15900 bytes\n", + "Now got a total of 16000 bytes\n", + "Now got a total of 16100 bytes\n", + "Now got a total of 16200 bytes\n", + "Now got a total of 16300 bytes\n", + "Now got a total of 16400 bytes\n", + "Now got a total of 16500 bytes\n", + "Now got a total of 16600 bytes\n", + "Now got a total of 16700 bytes\n", + "Now got a total of 16800 bytes\n", + "Now got a total of 16900 bytes\n", + "Now got a total of 17000 bytes\n", + "Now got a total of 17100 bytes\n", + "Now got a total of 17200 bytes\n", + "Now got a total of 17300 bytes\n", + "Now got a total of 17400 bytes\n", + "Now got a total of 17500 bytes\n", + "Now got a total of 17600 bytes\n", + "Now got a total of 17700 bytes\n", + "Now got a total of 17800 bytes\n", + "Now got a total of 17900 bytes\n", + "Now got a total of 18000 bytes\n", + "Now got a total of 18100 bytes\n", + "Now got a total of 18200 bytes\n", + "Now got a total of 18300 bytes\n", + "Now got a total of 18400 bytes\n", + "Now got a total of 18500 bytes\n", + "Now got a total of 18600 bytes\n", + "Now got a total of 18700 bytes\n", + "Now got a total of 18800 bytes\n", + "Now got a total of 18900 bytes\n", + "Now got a total of 19000 bytes\n", + "Now got a total of 19100 bytes\n", + "Now got a total of 19200 bytes\n", + "Now got a total of 19300 bytes\n", + "Now got a total of 19400 bytes\n", + "Now got a total of 19500 bytes\n", + "Now got a total of 19600 bytes\n", + "Now got a total of 19700 bytes\n", + "Now got a total of 19800 bytes\n", + "Now got a total of 19900 bytes\n", + "Now got a total of 20000 bytes\n", + "Now got a total of 20100 bytes\n", + "Now got a total of 20200 bytes\n", + "Now got a total of 20300 bytes\n", + "Now got a total of 20400 bytes\n", + "Now got a total of 20500 bytes\n", + "Now got a total of 20600 bytes\n", + "Now got a total of 20700 bytes\n", + "Now got a total of 20800 bytes\n", + "Now got a total of 20900 bytes\n", + "Now got a total of 21000 bytes\n", + "Now got a total of 21100 bytes\n", + "Now got a total of 21200 bytes\n", + "Now got a total of 21300 bytes\n", + "Now got a total of 21400 bytes\n", + "Now got a total of 21500 bytes\n", + "Now got a total of 21600 bytes\n", + "Now got a total of 21700 bytes\n", + "Now got a total of 21800 bytes\n", + "Now got a total of 21900 bytes\n", + "Now got a total of 22000 bytes\n", + "Now got a total of 22100 bytes\n", + "Now got a total of 22200 bytes\n", + "Now got a total of 22300 bytes\n", + "Now got a total of 22400 bytes\n", + "Now got a total of 22500 bytes\n", + "Now got a total of 22600 bytes\n", + "Now got a total of 22700 bytes\n", + "Now got a total of 22800 bytes\n", + "Now got a total of 22900 bytes\n", + "Now got a total of 23000 bytes\n", + "Now got a total of 23100 bytes\n", + "Now got a total of 23200 bytes\n", + "Now got a total of 23300 bytes\n", + "Now got a total of 23400 bytes\n", + "Now got a total of 23500 bytes\n", + "Now got a total of 23600 bytes\n", + "Now got a total of 23700 bytes\n", + "Now got a total of 23800 bytes\n", + "Now got a total of 23900 bytes\n", + "Now got a total of 24000 bytes\n", + "Now got a total of 24100 bytes\n", + "Now got a total of 24200 bytes\n", + "Now got a total of 24300 bytes\n", + "Now got a total of 24400 bytes\n", + "Now got a total of 24500 bytes\n", + "Now got a total of 24600 bytes\n", + "Now got a total of 24700 bytes\n", + "Now got a total of 24800 bytes\n", + "Now got a total of 24900 bytes\n", + "Now got a total of 25000 bytes\n", + "Now got a total of 25100 bytes\n", + "Now got a total of 25200 bytes\n", + "Now got a total of 25300 bytes\n", + "Now got a total of 25400 bytes\n", + "Now got a total of 25500 bytes\n", + "Now got a total of 25600 bytes\n", + "Now got a total of 25700 bytes\n", + "Now got a total of 25800 bytes\n", + "Now got a total of 25900 bytes\n", + "Now got a total of 26000 bytes\n", + "Now got a total of 26100 bytes\n", + "Now got a total of 26200 bytes\n", + "Now got a total of 26300 bytes\n", + "Now got a total of 26400 bytes\n", + "Now got a total of 26500 bytes\n", + "Now got a total of 26600 bytes\n", + "Now got a total of 26700 bytes\n", + "Now got a total of 26800 bytes\n", + "Now got a total of 26900 bytes\n", + "Now got a total of 27000 bytes\n", + "Now got a total of 27100 bytes\n", + "Now got a total of 27200 bytes\n", + "Now got a total of 27300 bytes\n", + "Now got a total of 27400 bytes\n", + "Now got a total of 27500 bytes\n", + "Now got a total of 27600 bytes\n", + "Now got a total of 27700 bytes\n", + "Now got a total of 27800 bytes\n", + "Now got a total of 27900 bytes\n", + "Now got a total of 28000 bytes\n", + "Now got a total of 28100 bytes\n", + "Now got a total of 28200 bytes\n", + "Now got a total of 28300 bytes\n", + "Now got a total of 28400 bytes\n", + "Now got a total of 28500 bytes\n", + "Now got a total of 28600 bytes\n", + "Now got a total of 28700 bytes\n", + "Now got a total of 28800 bytes\n", + "Now got a total of 28900 bytes\n", + "Now got a total of 29000 bytes\n", + "Now got a total of 29100 bytes\n", + "Now got a total of 29200 bytes\n", + "Now got a total of 29300 bytes\n", + "Now got a total of 29400 bytes\n", + "Now got a total of 29500 bytes\n", + "Now got a total of 29600 bytes\n", + "Now got a total of 29700 bytes\n", + "Now got a total of 29800 bytes\n", + "Now got a total of 29900 bytes\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-this.cpp, Page no-457" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Test:\n", + " __a=int\n", + " def setdata(self, init_a):\n", + " self.__a=init_a\n", + " print \"Address of my object, this in setdata():\", hex(id(self))\n", + " self.__a=init_a\n", + " def showdata(self):\n", + " print \"Data accessed in normal way: \", self.__a\n", + " print \"Address of my object, this in showdata(): \", hex(id(self))\n", + " print \"Data accessed through this->a: \", self.__a\n", + "my=Test()\n", + "my.setdata(25)\n", + "my.showdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of my object, this in setdata(): 0x39de488L\n", + "Data accessed in normal way: 25\n", + "Address of my object, this in showdata(): 0x39de488L\n", + "Data accessed through this->a: 25\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-list.cpp, Page no-459" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class List():\n", + " def __init__(self, dat=None):\n", + " if isinstance(dat, int):\n", + " self.__data=dat\n", + " else:\n", + " self.__data=0\n", + " self.__Next=None\n", + " def __del__(self):\n", + " pass\n", + " def get(self):\n", + " return self.__data\n", + " def insert(self, node):\n", + " last=List()\n", + " last=self\n", + " while(last.__Next!=None):\n", + " last=last.__Next\n", + " last.__Next=node\n", + "def display(first):\n", + " traverse=List()\n", + " print \"List traversal yields:\",\n", + " traverse=first\n", + " while(1): \n", + " print traverse._List__data, \",\",\n", + " if traverse._List__Next==None:\n", + " break\n", + " traverse=traverse._List__Next\n", + " print \"\"\n", + "first=List()\n", + "first=None\n", + "while(1):\n", + " print \"Linked List...\\n1.Insert\\n2.Display\\n3.Quit\\nEnter Choice: \",\n", + " choice=int(raw_input())\n", + " if choice==1:\n", + " data=int(raw_input(\"Enter data: \"))\n", + " node=List(data)\n", + " if first==None:\n", + " first=node\n", + " else:\n", + " first.insert(node)\n", + " elif choice==2:\n", + " display(first)\n", + " elif choice==3:\n", + " break\n", + " else:\n", + " print \"Bad Option Selected\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Linked List...\n", + "1.Insert\n", + "2.Display\n", + "3.Quit\n", + "Enter Choice: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Linked List...\n", + "1.Insert\n", + "2.Display\n", + "3.Quit\n", + "Enter Choice: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " List traversal yields: 2 , \n", + "Linked List...\n", + "1.Insert\n", + "2.Display\n", + "3.Quit\n", + "Enter Choice: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Linked List...\n", + "1.Insert\n", + "2.Display\n", + "3.Quit\n", + "Enter Choice: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Linked List...\n", + "1.Insert\n", + "2.Display\n", + "3.Quit\n", + "Enter Choice: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " List traversal yields: 2 , 3 , 4 , \n", + "Linked List...\n", + "1.Insert\n", + "2.Display\n", + "3.Quit\n", + "Enter Choice: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-dll.cpp, Page no-462" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class dll:\n", + " def __init__(self, data_in=None):\n", + " if isinstance(data_in, int):\n", + " self.__data=data_in\n", + " else:\n", + " self.__data=0\n", + " self.__prev=None\n", + " self.__Next=None\n", + " def __del__(self):\n", + " pass\n", + " def get(self):\n", + " return self.__data\n", + " def insert(self, node):\n", + " last=dll()\n", + " last=self\n", + " while(last._dll__Next!=None):\n", + " last=last._dll__Next\n", + " node._dll__prev=last\n", + " node._dll__Next=None\n", + " last._dll__Next=node\n", + " def FreeAllNodes(self):\n", + " print \"Freeing the node with data:\",\n", + " first=dll()\n", + " first=self\n", + " while(1):\n", + " temp= dll()\n", + " temp=first\n", + " print \"->\", first._dll__data,\n", + " del temp\n", + " first=first._dll__Next\n", + " if first==None:\n", + " break\n", + "def display(first):\n", + " traverse=dll()\n", + " traverse=first\n", + " if first==None:\n", + " print \"Nothing to display !\"\n", + " return\n", + " else:\n", + " print \"Processing with forward -> pointer:\",\n", + " while(1): \n", + " print \"->\", traverse._dll__data, \n", + " if traverse._dll__Next==None:\n", + " break\n", + " traverse=traverse._dll__Next\n", + " print \"\\nProcessing with backward <- pointer:\",\n", + " while(1): \n", + " print \"->\", traverse._dll__data,\n", + " if traverse._dll__prev==None:\n", + " break\n", + " traverse=traverse._dll__prev\n", + " print \"\"\n", + "def InsertNode(first, data):\n", + " node=dll(data)\n", + " if first==None:\n", + " first=node\n", + " else:\n", + " first.insert(node)\n", + " return first\n", + "first=dll()\n", + "first=None\n", + "print \"Double Linked List Manipulation...\"\n", + "while(1):\n", + " choice=int(raw_input(\"Enter Choice ([1] Insert, [2] Display, [3]Quit: \"))\n", + " if choice==1:\n", + " data=int(raw_input(\"Enter data: \"))\n", + " first=InsertNode(first, data)\n", + " elif choice==2:\n", + " display(first)\n", + " elif choice==3:\n", + " first.FreeAllNodes()\n", + " break\n", + " else:\n", + " print \"Bad Option Selected\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Double Linked List Manipulation...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Processing with forward -> pointer: -> 3 \n", + "Processing with backward <- pointer: -> 3 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data: 7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Processing with forward -> pointer: -> 3 -> 7 \n", + "Processing with backward <- pointer: -> 7 -> 3 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Processing with forward -> pointer: -> 3 -> 7 -> 5 \n", + "Processing with backward <- pointer: -> 5 -> 7 -> 3 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bad Option Selected\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Freeing the node with data: -> 3 -> 7 -> 5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-466" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class A:\n", + " __a1=int\n", + " def Set(self, val):\n", + " self.__a1=val\n", + "class B:\n", + " __b1=int\n", + " def Set(self, val):\n", + " self.__b1=val\n", + "def add(x, y):\n", + " return x._A__a1+y._B__b1\n", + "ObjA=A()\n", + "ObjB=B()\n", + "ObjA.Set(9)\n", + "ObjB.Set(10)\n", + "print \"Sum of objects A and B using friend function =\", add(ObjA, ObjB)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of objects A and B using friend function = 19\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-2, Page no-466" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class test:\n", + " __data=int\n", + " def func(self, val):\n", + " self.__data=val\n", + "t1=test()\n", + "testptr={}\n", + "testptr[0]=test.func #pointer to member function\n", + "print \"Initializing test class object t1 using pointer...\"\n", + "testptr[0](t1, 10)\n", + "print \"Object initialized successfully\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initializing test class object t1 using pointer...\n", + "Object initialized successfully\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects_1.ipynb new file mode 100755 index 00000000..2f8d1022 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects_1.ipynb @@ -0,0 +1,1589 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:fa9552ed51e712cfcebb68ace46e3f3dfa1346a1b04ccf69bb0b5d56c912b64c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12-Dynamic Objects" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ptrobj1.cpp, Page no-435" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure, POINTER\n", + "class someclass(Structure):\n", + " data1=int\n", + " data2=chr\n", + " def __init__(self):\n", + " print 'Constructor someclass() is invoked'\n", + " self.data1=1\n", + " self.data2='A'\n", + " def __del__(self):\n", + " print 'Destructor ~someclass() is invoked'\n", + " def show(self):\n", + " print 'data1 =', self.data1,\n", + " print 'data2 =', self.data2\n", + "object1=someclass() #object of class someclass\n", + "ptr=POINTER(someclass) #pointer of type class someclass\n", + "ptr=object1 #pointer pointing to object of class someclass\n", + "print \"Accessing object through object1.show()...\"\n", + "object1.show()\n", + "print \"Accessing object through ptr->show()...\"\n", + "ptr.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor someclass() is invoked\n", + "Destructor ~someclass() is invoked\n", + "Accessing object through object1.show()...\n", + "data1 = 1 data2 = A\n", + "Accessing object through ptr->show()...\n", + "data1 = 1 data2 = A\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ptrobj2.cpp, Page no-437" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class someclass(Structure):\n", + " data1=int\n", + " data2=chr\n", + " def __init__(self):\n", + " print 'Constructor someclass() is invoked'\n", + " self.data1=1\n", + " self.data2='A'\n", + " def __del__(self):\n", + " print 'Destructor ~someclass() is invoked'\n", + " def show(self):\n", + " print 'data1 =', self.data1,\n", + " print 'data2 =', self.data2\n", + "object1=someclass()\n", + "ptr=POINTER(someclass)\n", + "ptr=object1\n", + "print \"Accessing object through object1.show()...\"\n", + "ptr.show()\n", + "print \"Destroying dynamic object...\"\n", + "del ptr" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor someclass() is invoked\n", + "Destructor ~someclass() is invoked\n", + "Accessing object through object1.show()...\n", + "data1 = 1 data2 = A\n", + "Destroying dynamic object...\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-useref.cpp, Page no-439" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import POINTER, c_int\n", + "t1=POINTER(c_int)\n", + "t1=c_int(5)\n", + "t3=c_int(5)\n", + "t2=c_int(10)\n", + "t1.value=t1.value+t2.value\n", + "print \"Sum of\", t3.value,\n", + "print \"and\", t2.value, \n", + "print \"is:\", t1.value" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of 5 and 10 is: 15\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-refobj.cpp, Page no-440" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure\n", + "class student(Structure):\n", + " __roll_no=int\n", + " __name=str\n", + " def setdata(self, roll_no_in, name_in):\n", + " self.__roll_no=roll_no_in\n", + " self.__name=name_in\n", + " def outdata(self):\n", + " print \"Roll No =\", self.__roll_no\n", + " print \"Name =\", self.__name\n", + "s1=student()\n", + "s1.setdata(1, \"Savithri\")\n", + "s1.outdata()\n", + "s2=student()\n", + "s2.setdata(2, \"Bhavani\")\n", + "s2.outdata()\n", + "s3=student()\n", + "s3.setdata(3, \"Vani\")\n", + "s4=s3\n", + "s3.outdata()\n", + "s4.outdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll No = 1\n", + "Name = Savithri\n", + "Roll No = 2\n", + "Name = Bhavani\n", + "Roll No = 3\n", + "Name = Vani\n", + "Roll No = 3\n", + "Name = Vani\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student3.cpp, Page no-442" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class student:\n", + " __roll_no=int\n", + " __name=str\n", + " def __init__(self, roll_no_in=None, name_in=None):\n", + " if isinstance(roll_no_in, int):\n", + " self.__roll_no=roll_no_in\n", + " if isinstance(name_in, str):\n", + " self.__name=name_in\n", + " else:\n", + " flag=raw_input(\"Do you want to initialize the object (y/n): \")\n", + " if flag=='y' or flag=='Y':\n", + " self.__roll_no=int(raw_input(\"Enter Roll no. of student: \"))\n", + " Str=raw_input(\"Enter Name of student: \")\n", + " self.__name=Str\n", + " else:\n", + " self.__roll_no=0\n", + " self.__name=None\n", + " def __del__(self):\n", + " if isinstance(self.__name, str):\n", + " del self.__name\n", + " def Set(self):\n", + " student(roll_no_in, name_in)\n", + " def show(self):\n", + " if self.__roll_no:\n", + " print \"Roll No:\", self.__roll_no\n", + " else:\n", + " print \"Roll No: (not initialized)\"\n", + " if isinstance(self.__name, str):\n", + " print \"Name: \", self.__name\n", + " else:\n", + " print \"Name: (not initialized)\"\n", + "s1=student()\n", + "s2=student()\n", + "s3=student(1)\n", + "s4=student(2, \"Bhavani\")\n", + "print \"Live objects contents...\"\n", + "s1.show()\n", + "s2.show()\n", + "s3.show()\n", + "s4.show()\n", + "del s1\n", + "del s2\n", + "del s3\n", + "del s4" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Do you want to initialize the object (y/n): n\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Do you want to initialize the object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Roll no. of student: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name of student: Rekha\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Live objects contents...\n", + "Roll No: (not initialized)\n", + "Name: (not initialized)\n", + "Roll No: 5\n", + "Name: Rekha\n", + "Roll No: 1\n", + "Name: (not initialized)\n", + "Roll No: 2\n", + "Name: Bhavani\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student1.cpp, Page-445" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class student:\n", + " __roll_no=int\n", + " __name=str\n", + " def setdata(self, roll_no_in, name_in):\n", + " self.__roll_no=roll_no_in\n", + " self.__name=name_in\n", + " def outdata(self):\n", + " print \"Roll No =\", self.__roll_no\n", + " print \"Name =\", self.__name\n", + "s=[]*10 #array of objects\n", + "count=0\n", + "for i in range(10):\n", + " s.append(student())\n", + "for i in range(10):\n", + " response=raw_input(\"Initialize student object (y/n): \")\n", + " if response=='y' or response=='Y':\n", + " roll_no=int(raw_input(\"Enter a Roll no. of student: \"))\n", + " name=raw_input(\"Enter name of student: \")\n", + " s[i].setdata(roll_no, name)\n", + " count+=1\n", + " else:\n", + " break\n", + "print \"Student Details...\"\n", + "for i in range(count):\n", + " s[i].outdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initialize student object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a Roll no. of student: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of student: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initialize student object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a Roll no. of student: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of student: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initialize student object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a Roll no. of student: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of student: Savithri\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initialize student object (y/n): n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Details...\n", + "Roll No = 1\n", + "Name = Rajkumar\n", + "Roll No = 2\n", + "Name = Tejaswi\n", + "Roll No = 3\n", + "Name = Savithri\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student2.cpp, Page no-447" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class student(Structure):\n", + " __roll_no=int\n", + " __name=str\n", + " def setdata(self, roll_no_in, name_in):\n", + " self.__roll_no=roll_no_in\n", + " self.__name=name_in\n", + " def outdata(self):\n", + " print \"Roll No =\", self.__roll_no\n", + " print \"Name =\", self.__name\n", + "temp=[]*10\n", + "s=POINTER(student) \n", + "count=0\n", + "for i in range(10):\n", + " temp.append(student())\n", + "s=temp #pointer to array of objects\n", + "for i in range(10):\n", + " response=raw_input(\"Create student object (y/n): \")\n", + " if response=='y' or response=='Y':\n", + " roll_no=int(raw_input(\"Enter a Roll no. of student: \"))\n", + " name=raw_input(\"Enter name of student: \")\n", + " s[i].setdata(roll_no, name)\n", + " count+=1\n", + " else:\n", + " break\n", + "print \"Student Details...\"\n", + "for i in range(count):\n", + " s[i].outdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Create student object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a Roll no. of student: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of student: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Create student object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a Roll no. of student: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of student: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Create student object (y/n): y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a Roll no. of student: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of student: Savithri\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Create student object (y/n): n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Details...\n", + "Roll No = 1\n", + "Name = Rajkumar\n", + "Roll No = 2\n", + "Name = Tejaswi\n", + "Roll No = 3\n", + "Name = Savithri\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ptrmemb.cpp, Page no-452" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X:\n", + " __y=int\n", + " a=int\n", + " b=int\n", + " def init(self, z):\n", + " self.a=z\n", + " return z\n", + "obj=X()\n", + "ip=X.a #pointer to data member\n", + "obj.ip=10 #access through object\n", + "print \"a in obj after obj.*ip = 10 is\", obj.ip\n", + "pobj=[obj] #pointer to object of class X\n", + "pobj[0].ip=10 #access through object pointer\n", + "print \"a in obj after pobj->*ip = 10 is\", pobj[0].ip\n", + "ptr_init=X.init #pointer to member function\n", + "ptr_init(obj,5) #access through object\n", + "print \"a in obj after (obj.*ptr_init)(5) =\", obj.a\n", + "ptr_init(pobj[0],5) #access through object pointer\n", + "print \"a in obj after (pobj->*ptr_init)(5) =\", obj.a" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a in obj after obj.*ip = 10 is 10\n", + "a in obj after pobj->*ip = 10 is 10\n", + "a in obj after (obj.*ptr_init)(5) = 5\n", + "a in obj after (pobj->*ptr_init)(5) = 5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-friend.cpp, Page no-454" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X():\n", + " __a=int\n", + " __b=int\n", + " def __init__(self):\n", + " self.__a=0\n", + " self.__b=0\n", + " def SetMembers(self, a1, b1):\n", + " self.__a=a1\n", + " self.__b=b1\n", + "def sum(objx):\n", + " pa=[X._X__a]\n", + " pb=[X._X__b]\n", + " objx.pa=objx._X__a\n", + " objx.pb=objx._X__b\n", + " return objx.pa+objx.pb\n", + "objx=X()\n", + "pfunc=X.SetMembers\n", + "pfunc(objx, 5, 6)\n", + "print \"Sum =\", sum(objx)\n", + "pobjx=[objx]\n", + "pfunc(pobjx[0], 7, 8)\n", + "print \"Sum =\", sum(objx)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum = 11\n", + "Sum = 15\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-memhnd.cpp, Page no-455" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import pointer, c_int\n", + "def out_of_memory():\n", + " print \"Memory exhausted, cannot allocate\"\n", + "ip=pointer(c_int())\n", + "total_allocated=0L\n", + "print \"Ok, allocating...\"\n", + "while(1):\n", + " ip=[int]*100\n", + " total_allocated+=100L\n", + " print \"Now got a total of\", total_allocated, \"bytes\"\n", + " if total_allocated==29900L:\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ok, allocating...\n", + "Now got a total of 100 bytes\n", + "Now got a total of 200 bytes\n", + "Now got a total of 300 bytes\n", + "Now got a total of 400 bytes\n", + "Now got a total of 500 bytes\n", + "Now got a total of 600 bytes\n", + "Now got a total of 700 bytes\n", + "Now got a total of 800 bytes\n", + "Now got a total of 900 bytes\n", + "Now got a total of 1000 bytes\n", + "Now got a total of 1100 bytes\n", + "Now got a total of 1200 bytes\n", + "Now got a total of 1300 bytes\n", + "Now got a total of 1400 bytes\n", + "Now got a total of 1500 bytes\n", + "Now got a total of 1600 bytes\n", + "Now got a total of 1700 bytes\n", + "Now got a total of 1800 bytes\n", + "Now got a total of 1900 bytes\n", + "Now got a total of 2000 bytes\n", + "Now got a total of 2100 bytes\n", + "Now got a total of 2200 bytes\n", + "Now got a total of 2300 bytes\n", + "Now got a total of 2400 bytes\n", + "Now got a total of 2500 bytes\n", + "Now got a total of 2600 bytes\n", + "Now got a total of 2700 bytes\n", + "Now got a total of 2800 bytes\n", + "Now got a total of 2900 bytes\n", + "Now got a total of 3000 bytes\n", + "Now got a total of 3100 bytes\n", + "Now got a total of 3200 bytes\n", + "Now got a total of 3300 bytes\n", + "Now got a total of 3400 bytes\n", + "Now got a total of 3500 bytes\n", + "Now got a total of 3600 bytes\n", + "Now got a total of 3700 bytes\n", + "Now got a total of 3800 bytes\n", + "Now got a total of 3900 bytes\n", + "Now got a total of 4000 bytes\n", + "Now got a total of 4100 bytes\n", + "Now got a total of 4200 bytes\n", + "Now got a total of 4300 bytes\n", + "Now got a total of 4400 bytes\n", + "Now got a total of 4500 bytes\n", + "Now got a total of 4600 bytes\n", + "Now got a total of 4700 bytes\n", + "Now got a total of 4800 bytes\n", + "Now got a total of 4900 bytes\n", + "Now got a total of 5000 bytes\n", + "Now got a total of 5100 bytes\n", + "Now got a total of 5200 bytes\n", + "Now got a total of 5300 bytes\n", + "Now got a total of 5400 bytes\n", + "Now got a total of 5500 bytes\n", + "Now got a total of 5600 bytes\n", + "Now got a total of 5700 bytes\n", + "Now got a total of 5800 bytes\n", + "Now got a total of 5900 bytes\n", + "Now got a total of 6000 bytes\n", + "Now got a total of 6100 bytes\n", + "Now got a total of 6200 bytes\n", + "Now got a total of 6300 bytes\n", + "Now got a total of 6400 bytes\n", + "Now got a total of 6500 bytes\n", + "Now got a total of 6600 bytes\n", + "Now got a total of 6700 bytes\n", + "Now got a total of 6800 bytes\n", + "Now got a total of 6900 bytes\n", + "Now got a total of 7000 bytes\n", + "Now got a total of 7100 bytes\n", + "Now got a total of 7200 bytes\n", + "Now got a total of 7300 bytes\n", + "Now got a total of 7400 bytes\n", + "Now got a total of 7500 bytes\n", + "Now got a total of 7600 bytes\n", + "Now got a total of 7700 bytes\n", + "Now got a total of 7800 bytes\n", + "Now got a total of 7900 bytes\n", + "Now got a total of 8000 bytes\n", + "Now got a total of 8100 bytes\n", + "Now got a total of 8200 bytes\n", + "Now got a total of 8300 bytes\n", + "Now got a total of 8400 bytes\n", + "Now got a total of 8500 bytes\n", + "Now got a total of 8600 bytes\n", + "Now got a total of 8700 bytes\n", + "Now got a total of 8800 bytes\n", + "Now got a total of 8900 bytes\n", + "Now got a total of 9000 bytes\n", + "Now got a total of 9100 bytes\n", + "Now got a total of 9200 bytes\n", + "Now got a total of 9300 bytes\n", + "Now got a total of 9400 bytes\n", + "Now got a total of 9500 bytes\n", + "Now got a total of 9600 bytes\n", + "Now got a total of 9700 bytes\n", + "Now got a total of 9800 bytes\n", + "Now got a total of 9900 bytes\n", + "Now got a total of 10000 bytes\n", + "Now got a total of 10100 bytes\n", + "Now got a total of 10200 bytes\n", + "Now got a total of 10300 bytes\n", + "Now got a total of 10400 bytes\n", + "Now got a total of 10500 bytes\n", + "Now got a total of 10600 bytes\n", + "Now got a total of 10700 bytes\n", + "Now got a total of 10800 bytes\n", + "Now got a total of 10900 bytes\n", + "Now got a total of 11000 bytes\n", + "Now got a total of 11100 bytes\n", + "Now got a total of 11200 bytes\n", + "Now got a total of 11300 bytes\n", + "Now got a total of 11400 bytes\n", + "Now got a total of 11500 bytes\n", + "Now got a total of 11600 bytes\n", + "Now got a total of 11700 bytes\n", + "Now got a total of 11800 bytes\n", + "Now got a total of 11900 bytes\n", + "Now got a total of 12000 bytes\n", + "Now got a total of 12100 bytes\n", + "Now got a total of 12200 bytes\n", + "Now got a total of 12300 bytes\n", + "Now got a total of 12400 bytes\n", + "Now got a total of 12500 bytes\n", + "Now got a total of 12600 bytes\n", + "Now got a total of 12700 bytes\n", + "Now got a total of 12800 bytes\n", + "Now got a total of 12900 bytes\n", + "Now got a total of 13000 bytes\n", + "Now got a total of 13100 bytes\n", + "Now got a total of 13200 bytes\n", + "Now got a total of 13300 bytes\n", + "Now got a total of 13400 bytes\n", + "Now got a total of 13500 bytes\n", + "Now got a total of 13600 bytes\n", + "Now got a total of 13700 bytes\n", + "Now got a total of 13800 bytes\n", + "Now got a total of 13900 bytes\n", + "Now got a total of 14000 bytes\n", + "Now got a total of 14100 bytes\n", + "Now got a total of 14200 bytes\n", + "Now got a total of 14300 bytes\n", + "Now got a total of 14400 bytes\n", + "Now got a total of 14500 bytes\n", + "Now got a total of 14600 bytes\n", + "Now got a total of 14700 bytes\n", + "Now got a total of 14800 bytes\n", + "Now got a total of 14900 bytes\n", + "Now got a total of 15000 bytes\n", + "Now got a total of 15100 bytes\n", + "Now got a total of 15200 bytes\n", + "Now got a total of 15300 bytes\n", + "Now got a total of 15400 bytes\n", + "Now got a total of 15500 bytes\n", + "Now got a total of 15600 bytes\n", + "Now got a total of 15700 bytes\n", + "Now got a total of 15800 bytes\n", + "Now got a total of 15900 bytes\n", + "Now got a total of 16000 bytes\n", + "Now got a total of 16100 bytes\n", + "Now got a total of 16200 bytes\n", + "Now got a total of 16300 bytes\n", + "Now got a total of 16400 bytes\n", + "Now got a total of 16500 bytes\n", + "Now got a total of 16600 bytes\n", + "Now got a total of 16700 bytes\n", + "Now got a total of 16800 bytes\n", + "Now got a total of 16900 bytes\n", + "Now got a total of 17000 bytes\n", + "Now got a total of 17100 bytes\n", + "Now got a total of 17200 bytes\n", + "Now got a total of 17300 bytes\n", + "Now got a total of 17400 bytes\n", + "Now got a total of 17500 bytes\n", + "Now got a total of 17600 bytes\n", + "Now got a total of 17700 bytes\n", + "Now got a total of 17800 bytes\n", + "Now got a total of 17900 bytes\n", + "Now got a total of 18000 bytes\n", + "Now got a total of 18100 bytes\n", + "Now got a total of 18200 bytes\n", + "Now got a total of 18300 bytes\n", + "Now got a total of 18400 bytes\n", + "Now got a total of 18500 bytes\n", + "Now got a total of 18600 bytes\n", + "Now got a total of 18700 bytes\n", + "Now got a total of 18800 bytes\n", + "Now got a total of 18900 bytes\n", + "Now got a total of 19000 bytes\n", + "Now got a total of 19100 bytes\n", + "Now got a total of 19200 bytes\n", + "Now got a total of 19300 bytes\n", + "Now got a total of 19400 bytes\n", + "Now got a total of 19500 bytes\n", + "Now got a total of 19600 bytes\n", + "Now got a total of 19700 bytes\n", + "Now got a total of 19800 bytes\n", + "Now got a total of 19900 bytes\n", + "Now got a total of 20000 bytes\n", + "Now got a total of 20100 bytes\n", + "Now got a total of 20200 bytes\n", + "Now got a total of 20300 bytes\n", + "Now got a total of 20400 bytes\n", + "Now got a total of 20500 bytes\n", + "Now got a total of 20600 bytes\n", + "Now got a total of 20700 bytes\n", + "Now got a total of 20800 bytes\n", + "Now got a total of 20900 bytes\n", + "Now got a total of 21000 bytes\n", + "Now got a total of 21100 bytes\n", + "Now got a total of 21200 bytes\n", + "Now got a total of 21300 bytes\n", + "Now got a total of 21400 bytes\n", + "Now got a total of 21500 bytes\n", + "Now got a total of 21600 bytes\n", + "Now got a total of 21700 bytes\n", + "Now got a total of 21800 bytes\n", + "Now got a total of 21900 bytes\n", + "Now got a total of 22000 bytes\n", + "Now got a total of 22100 bytes\n", + "Now got a total of 22200 bytes\n", + "Now got a total of 22300 bytes\n", + "Now got a total of 22400 bytes\n", + "Now got a total of 22500 bytes\n", + "Now got a total of 22600 bytes\n", + "Now got a total of 22700 bytes\n", + "Now got a total of 22800 bytes\n", + "Now got a total of 22900 bytes\n", + "Now got a total of 23000 bytes\n", + "Now got a total of 23100 bytes\n", + "Now got a total of 23200 bytes\n", + "Now got a total of 23300 bytes\n", + "Now got a total of 23400 bytes\n", + "Now got a total of 23500 bytes\n", + "Now got a total of 23600 bytes\n", + "Now got a total of 23700 bytes\n", + "Now got a total of 23800 bytes\n", + "Now got a total of 23900 bytes\n", + "Now got a total of 24000 bytes\n", + "Now got a total of 24100 bytes\n", + "Now got a total of 24200 bytes\n", + "Now got a total of 24300 bytes\n", + "Now got a total of 24400 bytes\n", + "Now got a total of 24500 bytes\n", + "Now got a total of 24600 bytes\n", + "Now got a total of 24700 bytes\n", + "Now got a total of 24800 bytes\n", + "Now got a total of 24900 bytes\n", + "Now got a total of 25000 bytes\n", + "Now got a total of 25100 bytes\n", + "Now got a total of 25200 bytes\n", + "Now got a total of 25300 bytes\n", + "Now got a total of 25400 bytes\n", + "Now got a total of 25500 bytes\n", + "Now got a total of 25600 bytes\n", + "Now got a total of 25700 bytes\n", + "Now got a total of 25800 bytes\n", + "Now got a total of 25900 bytes\n", + "Now got a total of 26000 bytes\n", + "Now got a total of 26100 bytes\n", + "Now got a total of 26200 bytes\n", + "Now got a total of 26300 bytes\n", + "Now got a total of 26400 bytes\n", + "Now got a total of 26500 bytes\n", + "Now got a total of 26600 bytes\n", + "Now got a total of 26700 bytes\n", + "Now got a total of 26800 bytes\n", + "Now got a total of 26900 bytes\n", + "Now got a total of 27000 bytes\n", + "Now got a total of 27100 bytes\n", + "Now got a total of 27200 bytes\n", + "Now got a total of 27300 bytes\n", + "Now got a total of 27400 bytes\n", + "Now got a total of 27500 bytes\n", + "Now got a total of 27600 bytes\n", + "Now got a total of 27700 bytes\n", + "Now got a total of 27800 bytes\n", + "Now got a total of 27900 bytes\n", + "Now got a total of 28000 bytes\n", + "Now got a total of 28100 bytes\n", + "Now got a total of 28200 bytes\n", + "Now got a total of 28300 bytes\n", + "Now got a total of 28400 bytes\n", + "Now got a total of 28500 bytes\n", + "Now got a total of 28600 bytes\n", + "Now got a total of 28700 bytes\n", + "Now got a total of 28800 bytes\n", + "Now got a total of 28900 bytes\n", + "Now got a total of 29000 bytes\n", + "Now got a total of 29100 bytes\n", + "Now got a total of 29200 bytes\n", + "Now got a total of 29300 bytes\n", + "Now got a total of 29400 bytes\n", + "Now got a total of 29500 bytes\n", + "Now got a total of 29600 bytes\n", + "Now got a total of 29700 bytes\n", + "Now got a total of 29800 bytes\n", + "Now got a total of 29900 bytes\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-this.cpp, Page no-457" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Test:\n", + " __a=int\n", + " def setdata(self, init_a):\n", + " self.__a=init_a\n", + " print \"Address of my object, this in setdata():\", hex(id(self))\n", + " self.__a=init_a\n", + " def showdata(self):\n", + " print \"Data accessed in normal way: \", self.__a\n", + " print \"Address of my object, this in showdata(): \", hex(id(self))\n", + " print \"Data accessed through this->a: \", self.__a\n", + "my=Test()\n", + "my.setdata(25)\n", + "my.showdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of my object, this in setdata(): 0x39de488L\n", + "Data accessed in normal way: 25\n", + "Address of my object, this in showdata(): 0x39de488L\n", + "Data accessed through this->a: 25\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-list.cpp, Page no-459" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class List():\n", + " def __init__(self, dat=None):\n", + " if isinstance(dat, int):\n", + " self.__data=dat\n", + " else:\n", + " self.__data=0\n", + " self.__Next=None\n", + " def __del__(self):\n", + " pass\n", + " def get(self):\n", + " return self.__data\n", + " def insert(self, node):\n", + " last=List()\n", + " last=self\n", + " while(last.__Next!=None):\n", + " last=last.__Next\n", + " last.__Next=node\n", + "def display(first):\n", + " traverse=List()\n", + " print \"List traversal yields:\",\n", + " traverse=first\n", + " while(1): \n", + " print traverse._List__data, \",\",\n", + " if traverse._List__Next==None:\n", + " break\n", + " traverse=traverse._List__Next\n", + " print \"\"\n", + "first=List()\n", + "first=None\n", + "while(1):\n", + " print \"Linked List...\\n1.Insert\\n2.Display\\n3.Quit\\nEnter Choice: \",\n", + " choice=int(raw_input())\n", + " if choice==1:\n", + " data=int(raw_input(\"Enter data: \"))\n", + " node=List(data)\n", + " if first==None:\n", + " first=node\n", + " else:\n", + " first.insert(node)\n", + " elif choice==2:\n", + " display(first)\n", + " elif choice==3:\n", + " break\n", + " else:\n", + " print \"Bad Option Selected\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Linked List...\n", + "1.Insert\n", + "2.Display\n", + "3.Quit\n", + "Enter Choice: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Linked List...\n", + "1.Insert\n", + "2.Display\n", + "3.Quit\n", + "Enter Choice: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " List traversal yields: 2 , \n", + "Linked List...\n", + "1.Insert\n", + "2.Display\n", + "3.Quit\n", + "Enter Choice: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Linked List...\n", + "1.Insert\n", + "2.Display\n", + "3.Quit\n", + "Enter Choice: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Linked List...\n", + "1.Insert\n", + "2.Display\n", + "3.Quit\n", + "Enter Choice: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " List traversal yields: 2 , 3 , 4 , \n", + "Linked List...\n", + "1.Insert\n", + "2.Display\n", + "3.Quit\n", + "Enter Choice: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-dll.cpp, Page no-462" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class dll:\n", + " def __init__(self, data_in=None):\n", + " if isinstance(data_in, int):\n", + " self.__data=data_in\n", + " else:\n", + " self.__data=0\n", + " self.__prev=None\n", + " self.__Next=None\n", + " def __del__(self):\n", + " pass\n", + " def get(self):\n", + " return self.__data\n", + " def insert(self, node):\n", + " last=dll()\n", + " last=self\n", + " while(last._dll__Next!=None):\n", + " last=last._dll__Next\n", + " node._dll__prev=last\n", + " node._dll__Next=None\n", + " last._dll__Next=node\n", + " def FreeAllNodes(self):\n", + " print \"Freeing the node with data:\",\n", + " first=dll()\n", + " first=self\n", + " while(1):\n", + " temp= dll()\n", + " temp=first\n", + " print \"->\", first._dll__data,\n", + " del temp\n", + " first=first._dll__Next\n", + " if first==None:\n", + " break\n", + "def display(first):\n", + " traverse=dll()\n", + " traverse=first\n", + " if first==None:\n", + " print \"Nothing to display !\"\n", + " return\n", + " else:\n", + " print \"Processing with forward -> pointer:\",\n", + " while(1): \n", + " print \"->\", traverse._dll__data, \n", + " if traverse._dll__Next==None:\n", + " break\n", + " traverse=traverse._dll__Next\n", + " print \"\\nProcessing with backward <- pointer:\",\n", + " while(1): \n", + " print \"->\", traverse._dll__data,\n", + " if traverse._dll__prev==None:\n", + " break\n", + " traverse=traverse._dll__prev\n", + " print \"\"\n", + "def InsertNode(first, data):\n", + " node=dll(data)\n", + " if first==None:\n", + " first=node\n", + " else:\n", + " first.insert(node)\n", + " return first\n", + "first=dll()\n", + "first=None\n", + "print \"Double Linked List Manipulation...\"\n", + "while(1):\n", + " choice=int(raw_input(\"Enter Choice ([1] Insert, [2] Display, [3]Quit: \"))\n", + " if choice==1:\n", + " data=int(raw_input(\"Enter data: \"))\n", + " first=InsertNode(first, data)\n", + " elif choice==2:\n", + " display(first)\n", + " elif choice==3:\n", + " first.FreeAllNodes()\n", + " break\n", + " else:\n", + " print \"Bad Option Selected\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Double Linked List Manipulation...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Processing with forward -> pointer: -> 3 \n", + "Processing with backward <- pointer: -> 3 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data: 7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Processing with forward -> pointer: -> 3 -> 7 \n", + "Processing with backward <- pointer: -> 7 -> 3 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Processing with forward -> pointer: -> 3 -> 7 -> 5 \n", + "Processing with backward <- pointer: -> 5 -> 7 -> 3 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bad Option Selected\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Choice ([1] Insert, [2] Display, [3]Quit: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Freeing the node with data: -> 3 -> 7 -> 5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-466" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class A:\n", + " __a1=int\n", + " def Set(self, val):\n", + " self.__a1=val\n", + "class B:\n", + " __b1=int\n", + " def Set(self, val):\n", + " self.__b1=val\n", + "def add(x, y):\n", + " return x._A__a1+y._B__b1\n", + "ObjA=A()\n", + "ObjB=B()\n", + "ObjA.Set(9)\n", + "ObjB.Set(10)\n", + "print \"Sum of objects A and B using friend function =\", add(ObjA, ObjB)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of objects A and B using friend function = 19\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-2, Page no-466" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class test:\n", + " __data=int\n", + " def func(self, val):\n", + " self.__data=val\n", + "t1=test()\n", + "testptr={}\n", + "testptr[0]=test.func #pointer to member function\n", + "print \"Initializing test class object t1 using pointer...\"\n", + "testptr[0](t1, 10)\n", + "print \"Object initialized successfully\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initializing test class object t1 using pointer...\n", + "Object initialized successfully\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading.ipynb new file mode 100755 index 00000000..8c7b1cb8 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading.ipynb @@ -0,0 +1,2673 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:31bc0d2b60eba6f6d92afa42e690cc5db6b40cd9b0c7b9682b1c923305d9cccd" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13- Operator Overloading" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-index1.cpp, Page no-470" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Index:\n", + " __value=int\n", + " def __init__(self):\n", + " self.__value=0\n", + " def GetIndex(self):\n", + " return self.__value\n", + " def NextIndex(self):\n", + " self.__value=self.__value+1\n", + "idx1=Index()\n", + "idx2=Index()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "idx1.NextIndex()\n", + "idx2.NextIndex()\n", + "idx2.NextIndex()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index1 = 0\n", + "Index2 = 0\n", + "Index1 = 1\n", + "Index2 = 2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-index2.cpp, Page no-471" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Index:\n", + " __value=int\n", + " def __init__(self):\n", + " self.__value=0\n", + " def GetIndex(self):\n", + " return self.__value\n", + " #overload increment operator\n", + " def __iadd__(self, op):\n", + " self.__value=self.__value+op\n", + " return self\n", + "idx1=Index()\n", + "idx2=Index()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "idx1+=1 #overloaded increment operator invoked\n", + "idx2+=1 #overloaded increment operator invoked\n", + "idx2+=1 #overloaded increment operator invoked\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index1 = 0\n", + "Index2 = 0\n", + "Index1 = 1\n", + "Index2 = 2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-index3.cpp, Page no-475" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Index:\n", + " __value=int\n", + " def __init__(self):\n", + " self.__value=0\n", + " def GetIndex(self):\n", + " return self.__value\n", + " def __iadd__(self, op):\n", + " self.__value+=1\n", + " return self\n", + "idx1=Index()\n", + "idx2=Index()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "idx2+=1\n", + "idx1+=1\n", + "idx2+=1\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index1 = 0\n", + "Index2 = 0\n", + "Index1 = 1\n", + "Index2 = 2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-index4.cpp, Page no-476" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Index:\n", + " __value=int\n", + " def __init__(self):\n", + " self.__value=0\n", + " def GetIndex(self):\n", + " return self.__value\n", + " #overload increment operator\n", + " def __iadd__(self, op):\n", + " self.__value=self.__value+op\n", + " return self\n", + "idx1=Index()\n", + "idx2=Index()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "idx1+=1\n", + "idx2+=1\n", + "idx2+=1\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index1 = 0\n", + "Index2 = 0\n", + "Index1 = 1\n", + "Index2 = 2\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-index5.cpp, Page no-478" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Index:\n", + " __value=int\n", + " def __init__(self, val=0):\n", + " self.__value=val\n", + " def GetIndex(self):\n", + " return self.__value\n", + " #overload increment operator\n", + " def __iadd__(self, op):\n", + " self.__value=self.__value+op\n", + " return self\n", + "idx1=Index(2)\n", + "idx2=Index(2)\n", + "idx3=Index()\n", + "idx4=Index()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "idx3._Index__value=idx1._Index__value\n", + "idx1+=1\n", + "idx2+=1\n", + "idx4=idx2\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index3 =\", idx3.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "print \"Index4 =\", idx4.GetIndex()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index1 = 2\n", + "Index2 = 2\n", + "Index1 = 3\n", + "Index3 = 2\n", + "Index2 = 3\n", + "Index4 = 3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-index6.cpp, Page no-479" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Index:\n", + " __value=int\n", + " def __init__(self, val=0):\n", + " self.__value=val\n", + " def GetIndex(self):\n", + " return self.__value\n", + " #overload increment operator\n", + " def __iadd__(self, op):\n", + " self.__value=self.__value+op\n", + " return self\n", + " #overload decrement operator\n", + " def __isub__(self, op):\n", + " self.__value=self.__value-op\n", + " return self\n", + " #overload negation operator\n", + " def __neg__(self):\n", + " return Index(-self.__value)\n", + "idx1=Index()\n", + "idx2=Index()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "idx2+=1\n", + "idx1=-idx2\n", + "idx2+=1\n", + "idx2-=1\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index1 = 0\n", + "Index2 = 0\n", + "Index1 = -1\n", + "Index2 = 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mydate.cpp, Page no-480" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class date:\n", + " __day=int\n", + " __month=int\n", + " __year=int\n", + " def __init__(self, d=0, m=0, y=0):\n", + " if isinstance(d, int):\n", + " self.__day=d\n", + " self.__month=m\n", + " self.__year=y\n", + " else:\n", + " self.__day=0\n", + " self.__month=0\n", + " self.__year=0\n", + " def read(self):\n", + " self.__day, self.__month, self.__year=[int(x) for x in raw_input(\"Enter date
: \").split()]\n", + " def show(self):\n", + " print \"%s:%s:%s\" %(self.__day, self.__month, self.__year),\n", + " def IsLeapYear(self):\n", + " if (self.__year%4==0 and self.__year%100!=0) or (self.__year % 400==0):\n", + " return 1\n", + " else:\n", + " return 0\n", + " def thisMonthMaxDay(self):\n", + " m=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n", + " if self.__month==2 and self.IsLeapYear():\n", + " return 29\n", + " else:\n", + " return m[self.__month-1]\n", + " def __iadd__(self, op): #overloading increment operator\n", + " self.__day+=1\n", + " if self.__day>self.thisMonthMaxDay():\n", + " self.__day=1\n", + " self.__month+=1\n", + " if self.__month>12:\n", + " self.__month=1\n", + " self.__year+=1\n", + " return self\n", + "def nextday(d):\n", + " print 'Date', \n", + " d.show()\n", + " d+=1 #overloaded increment operator invoked\n", + " print \"on increment becomes\", \n", + " d.show()\n", + " print \"\"\n", + "d1=date(14, 4, 1971)\n", + "d2=date(28, 2, 1992)\n", + "d3=date(28, 2, 1993)\n", + "d4=date(31, 12, 1995)\n", + "nextday(d1)\n", + "nextday(d2)\n", + "nextday(d3)\n", + "nextday(d4)\n", + "today=date()\n", + "today.read()\n", + "nextday(today)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Date 14:4:1971 on increment becomes 15:4:1971 \n", + "Date 28:2:1992 on increment becomes 29:2:1992 \n", + "Date 28:2:1993 on increment becomes 1:3:1993 \n", + "Date 31:12:1995 on increment becomes 1:1:1996 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter date
: 11 9 1996\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Date 11:9:1996 on increment becomes 12:9:1996 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex1.cpp, Page no-483" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def AddComplex(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " AddComplex=AddComplex\n", + " def outdata(self, msg):\n", + " print \"%s(%0.1f, %0.1f)\" %(msg, self.__real, self.__imag)\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.getdata()\n", + "c3=c1.AddComplex(c2)\n", + "c3.outdata(\"c3 = c1.AddComplex(c2) : \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 2.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 1.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c3 = c1.AddComplex(c2) : (5.5, 3.5)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex2.cpp, Page no-484" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __add__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " #overloading + operator\n", + " __add__=__add__\n", + " def outdata(self, msg):\n", + " print \"%s(%0.1f, %0.1f)\" %(msg, self.__real, self.__imag)\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.getdata()\n", + "c3=c1+c2 #invoking the overloaded + operator\n", + "c3.outdata(\"c3 = c1 + c2: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 2.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 1.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c3 = c1 + c2: (5.5, 3.5)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex3.cpp, Page no-487" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __add__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "def __sub__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real-c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag-c2._Complex__imag\n", + " return temp\n", + "def __mul__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real*c2._Complex__real-self._Complex__imag*c2._Complex__imag\n", + " temp._Complex__imag=self._Complex__real*c2._Complex__imag+self._Complex__imag*c2._Complex__real\n", + " return temp\n", + "def __div__(self, c2):\n", + " temp=Complex()\n", + " qt=c2._Complex__real*c2._Complex__real+c2._Complex__imag *c2._Complex__imag\n", + " temp._Complex__real=(self._Complex__real*c2._Complex__real+self._Complex__imag*c2._Complex__imag)/qt\n", + " temp._Complex__imag=(self._Complex__imag*c2._Complex__real-self._Complex__real*c2._Complex__imag)/qt\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " #overloading +, -, * and / operator\n", + " __add__=__add__\n", + " __sub__=__sub__\n", + " __mul__=__mul__\n", + " __div__=__div__\n", + " def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.getdata()\n", + "print \"Entered Complex numbers are...\"\n", + "c1.outdata(\"c1 = \")\n", + "c2.outdata(\"c2 = \")\n", + "print \"Computational results are...\"\n", + "c3=c1+c2 #invoking the overloaded + operator\n", + "c3.outdata(\"c3 = c1 + c2: \")\n", + "c3=c1-c2 #invoking the overloaded - operator\n", + "c3.outdata(\"c3 = c1 - c2: \")\n", + "c3=c1*c2 #invoking the overloaded * operator\n", + "c3.outdata(\"c3 = c1 * c2: \")\n", + "c3=c1/c2 #invoking the overloaded / operator\n", + "c3.outdata(\"c3 = c1 / c2: \")\n", + "c3 = c1 + c2 + c1 + c2\n", + "c3.outdata(\"c3 = c1 + c2 + c1 + c2: \")\n", + "c3 = c1 * c2 + c1 / c2\n", + "c3.outdata(\"c3 = c1 * c2 + c1 / c2: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 2.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 1.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entered Complex numbers are...\n", + "c1 = (2.5, 2)\n", + "c2 = (3, 1.5)\n", + "Computational results are...\n", + "c3 = c1 + c2: (5.5, 3.5)\n", + "c3 = c1 - c2: (-0.5, 0.5)\n", + "c3 = c1 * c2: (4.5, 9.75)\n", + "c3 = c1 / c2: (0.933333, 0.2)\n", + "c3 = c1 + c2 + c1 + c2: (11, 7)\n", + "c3 = c1 * c2 + c1 / c2: (5.43333, 9.95)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-string.cpp, Page no-490" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "BUFF_SIZE=50\n", + "class string:\n", + " __Str=[None]*BUFF_SIZE\n", + " def __init__(self, MyStr=None):\n", + " if isinstance(MyStr, str):\n", + " self.__Str=MyStr\n", + " else:\n", + " self.__Str=\"\"\n", + " def echo(self):\n", + " print self.__Str\n", + " def __add__(self, s):\n", + " temp=string(self._string__Str)\n", + " temp._string__Str+=s._string__Str\n", + " return temp\n", + "str1=string(\"Welcome to \")\n", + "str2=string(\"Operator Overloading\")\n", + "str3=string()\n", + "print \"Before str3 = str1 + str2;..\"\n", + "print \"str1 = \",\n", + "str1.echo()\n", + "print \"str2 = \",\n", + "str2.echo()\n", + "print \"str3 = \",\n", + "str3.echo()\n", + "str3=str1+str2\n", + "print \"After str3 = str1 + str2;..\"\n", + "print \"str1 = \",\n", + "str1.echo()\n", + "print \"str2 = \",\n", + "str2.echo()\n", + "print \"str3 = \",\n", + "str3.echo()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before str3 = str1 + str2;..\n", + "str1 = Welcome to \n", + "str2 = Operator Overloading\n", + "str3 = \n", + "After str3 = str1 + str2;..\n", + "str1 = Welcome to \n", + "str2 = Operator Overloading\n", + "str3 = Welcome to Operator Overloading\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-idxcmp.cpp, Page no-491" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "(false, true)=(0, 1) #enum type\n", + "type =['false', 'true']\n", + "class Index:\n", + " __value=int\n", + " def __init__(self, val=0):\n", + " self.__value=val\n", + " def GetIndex(self):\n", + " return self.__value\n", + " #overloading < operator\n", + " def __lt__(self, idx):\n", + " return true if self.__value operator\n", + " def __gt__(self, s):\n", + " if self.__Str > s.__Str:\n", + " return true\n", + " else:\n", + " return false\n", + " #overloading == operator\n", + " def __eq__(self, MyStr):\n", + " if self.__Str ==MyStr:\n", + " return true\n", + " else:\n", + " return false\n", + "str1=string()\n", + "str2=string()\n", + "while(1):\n", + " print \"Enter String1 <'end' to stop>:\",\n", + " str1.read()\n", + " if str1==\"end\": #using overloaded == operator\n", + " break\n", + " print 'Enter String2:',\n", + " str2.read()\n", + " print 'Comparison status:',\n", + " str1.echo()\n", + " if str1str2:\n", + " print \">\", #using overloaded > operator\n", + " else:\n", + " print \"=\",\n", + " str2.echo()\n", + " print \"\"\n", + "print \"Bye.!! That's all folks.!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter String1 <'end' to stop>:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter String2:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Comparison status: C < C++ \n", + "Enter String1 <'end' to stop>:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rajkumar\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter String2:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bindu\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Comparison status: Rajkumar > Bindu \n", + "Enter String1 <'end' to stop>:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rajkumar\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter String2:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Venugopal\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Comparison status: Rajkumar < Venugopal \n", + "Enter String1 <'end' to stop>:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "HELLO\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter String2:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "HELLO\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Comparison status: HELLO = HELLO \n", + "Enter String1 <'end' to stop>:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "end\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Bye.!! That's all folks.!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex4.cpp, Page no-495" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __iadd__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "def __isub__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real-c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag-c2._Complex__imag\n", + " return temp\n", + "def __imul__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real*c2._Complex__real-self._Complex__imag*c2._Complex__imag\n", + " temp._Complex__imag=self._Complex__real*c2._Complex__imag+self._Complex__imag*c2._Complex__real\n", + " return temp\n", + "def __idiv__(self, c2):\n", + " temp=Complex()\n", + " qt=c2._Complex__real*c2._Complex__real+c2._Complex__imag *c2._Complex__imag\n", + " temp._Complex__real=(self._Complex__real*c2._Complex__real+self._Complex__imag*c2._Complex__imag)/qt\n", + " temp._Complex__imag=(self._Complex__imag*c2._Complex__real-self._Complex__real*c2._Complex__imag)/qt\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " #overloading +=, -=, *= and /= operator\n", + " __iadd__=__iadd__\n", + " __isub__=__isub__\n", + " __imul__=__imul__\n", + " __idiv__=__idiv__\n", + " def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.getdata()\n", + "print \"Entered Complex numbers are...\"\n", + "c1.outdata(\"c1 = \")\n", + "c2.outdata(\"c2 = \")\n", + "print \"Computational results are...\"\n", + "c3=c1 \n", + "c3+=c2 #invoking the overloaded += operator\n", + "c3.outdata(\"let c3 = c1, c3+=c2: \")\n", + "c3=c1 \n", + "c3-=c2 #invoking the overloaded -= operator\n", + "c3.outdata(\"let c3 = c1, c3-=c2: \")\n", + "c3=c1 \n", + "c3*=c2 #invoking the overloaded *= operator\n", + "c3.outdata(\"let c3 = c1, c3*=c2: \")\n", + "c3=c1 \n", + "c3/=c2 #invoking the overloaded / operator\n", + "c3.outdata(\"let c3 = c1, c3/=c2: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 2.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 1.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entered Complex numbers are...\n", + "c1 = (2.5, 2)\n", + "c2 = (3, 1.5)\n", + "Computational results are...\n", + "let c3 = c1, c3+=c2: (5.5, 3.5)\n", + "let c3 = c1, c3-=c2: (-0.5, 0.5)\n", + "let c3 = c1, c3*=c2: (4.5, 9.75)\n", + "let c3 = c1, c3/=c2: (0.933333, 0.2)\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex-5.cpp, Page no-498" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __iadd__(self, c2):\n", + " self._Complex__real=self._Complex__real+c2._Complex__real\n", + " self._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return self\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " #overloading += operator\n", + " __iadd__=__iadd__\n", + " def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.getdata()\n", + "c1 += c2 #using overloaded += operator\n", + "c3 = c1\n", + "print \"On execution of c3 = c1 += c2..\"\n", + "c1.outdata(\"Complex c1: \")\n", + "c2.outdata(\"Complex c2: \")\n", + "c3.outdata(\"Complex c3: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 2.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 1.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On execution of c3 = c1 += c2..\n", + "Complex c1: (5.5, 3.5)\n", + "Complex c2: (3, 1.5)\n", + "Complex c3: (5.5, 3.5)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-resource.cpp, Page no-499" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ARRAY_SIZE=10\n", + "def read(self):\n", + " for i in range(ARRAY_SIZE):\n", + " print \"vector[\", i, \"] = ? \",\n", + " self._vector__array[i]=int(raw_input())\n", + "def sum(self):\n", + " Sum=0\n", + " for i in range(ARRAY_SIZE):\n", + " Sum+=self._vector__array[i]\n", + " return Sum\n", + "class vector:\n", + " __array=[int]\n", + " def new(self):\n", + " myvector=vector()\n", + " myvector.__array=[int]*ARRAY_SIZE\n", + " return myvector\n", + " def delete(self):\n", + " del self\n", + " read=read\n", + " sum=sum\n", + "my_vector=vector()\n", + "my_vector=my_vector.new()\n", + "print \"Enter Vector data...\"\n", + "my_vector.read()\n", + "print \"Sum of Vector =\", my_vector.sum()\n", + "del my_vector" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Vector data...\n", + "vector[ 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 2 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 3 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 4 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 5 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 6 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 7 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 8 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 9 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sum of Vector = 55\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-meter.cpp, Page no-504" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Meter:\n", + " __length=float\n", + " def __init__(self, InitLength=0.0):\n", + " self.__length=InitLength/100.0\n", + " def float(self):\n", + " LengthCms=self.__length*100.0\n", + " return LengthCms\n", + " def GetLength(self):\n", + " self.__length=float(raw_input(\"Enter Length (in meters): \"))\n", + " def ShowLength(self):\n", + " print \"Length (in meter) =\", self.__length\n", + "length1=float(raw_input(\"Enter Lenthg (in cms): \"))\n", + "meter1=Meter(length1)\n", + "meter1.ShowLength()\n", + "meter2=Meter()\n", + "length2=float\n", + "meter2.GetLength()\n", + "length2=meter2.float()\n", + "print \"Length (in cms) =\", length2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Lenthg (in cms): 150.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length (in meter) = 1.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Length (in meters): 1.669\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length (in cms) = 166.9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-strconv.cpp, Page no-506" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "BUFF_SIZE=50\n", + "class string:\n", + " __Str=[None]*BUFF_SIZE\n", + " def __init__(self, MyStr=None):\n", + " if isinstance(MyStr, str):\n", + " self.__Str=MyStr\n", + " else:\n", + " self.__Str=\"\"\n", + " def echo(self):\n", + " print self.__Str\n", + " def char(self):\n", + " return self.__Str\n", + "msg=\"OOPs the Great\"\n", + "str1=string(msg)\n", + "print \"str1 =\",\n", + "str1.echo()\n", + "str2=string(\"It is nice to learn\")\n", + "receive=str2.char()\n", + "print \"Str2 =\", receive" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "str1 = OOPs the Great\n", + "Str2 = It is nice to learn\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-d2r1.cpp, Page no-509 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "PI=3.141592654\n", + "class Radian:\n", + " __rad=float\n", + " def __init__(self, InitRad=0.0):\n", + " self.__rad=InitRad\n", + " def GetRadian(self):\n", + " return self.__rad\n", + " def Output(self):\n", + " print \"Radian =\", self.GetRadian()\n", + "class Degree:\n", + " __degree=float\n", + " def __init__(self):\n", + " self.__degree=0.0\n", + " def Radian(self):\n", + " return ( Radian(self.__degree * PI / 180.0))\n", + " def Input(self):\n", + " self.__degree=float(raw_input(\"Enter degree: \"))\n", + "deg1=Degree()\n", + "deg1.Input()\n", + "rad1=deg1.Radian()\n", + "rad1.Output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter degree: 180\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Radian = 3.141592654\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-d2r2.cpp, Page no-512" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "PI=3.141592654\n", + "class Degree:\n", + " __degree=float\n", + " def __init__(self):\n", + " self.__degree=0.0\n", + " def GetDegree(self):\n", + " return self.__degree\n", + " def Input(self):\n", + " self.__degree=float(raw_input(\"Enter degree: \"))\n", + "class Radian:\n", + " __rad=float\n", + " def __init__(self, deg=None):\n", + " if isinstance(deg , Degree):\n", + " self.__rad=deg.GetDegree()*PI/180.0\n", + " else:\n", + " self.__rad=0.0\n", + " def GetRadian(self):\n", + " return self.__rad\n", + " def Output(self):\n", + " print \"Radian =\", self.GetRadian()\n", + "deg1=Degree()\n", + "deg1.Input()\n", + "rad1=Radian(deg1)\n", + "rad1.Output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter degree: 90\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Radian = 1.570796327\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-degrad.cpp, Page no-514" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "PI=3.141592654\n", + "class Radian:\n", + " __rad=float\n", + " def __init__(self, InitRad=0.0):\n", + " self.__rad=InitRad\n", + " def GetRadian(self):\n", + " return self.__rad\n", + " def Input(self):\n", + " self.__rad=float(raw_input(\"Enter radian: \"))\n", + " def Output(self):\n", + " print \"Radian =\", self.GetRadian()\n", + "class Degree:\n", + " __degree=float\n", + " def __init__(self, rad=None):\n", + " if isinstance(rad, Radian):\n", + " self.__degree=rad.GetRadian()*180.0/PI\n", + " else:\n", + " self.__degree=0.0\n", + " def GetDegree(self):\n", + " return self.__degree\n", + " def Radian(self):\n", + " return ( Radian(self.__degree * PI / 180.0))\n", + " def Input(self):\n", + " self.__degree=float(raw_input(\"Enter degree: \"))\n", + " def Output(self):\n", + " print \"Degree =\", self.__degree\n", + "deg1=Degree()\n", + "deg1.Input()\n", + "rad1=deg1.Radian()\n", + "rad1.Output()\n", + "rad2=Radian()\n", + "rad2.Input()\n", + "deg2=Degree(rad2)\n", + "deg2.Output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter degree: 180\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Radian = 3.141592654\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter radian: 3.142\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Degree = 180.023339207\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-script.cpp, Page no-516" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class AccountEntry(Structure):\n", + " _fields_=[('number',c_int), ('name', c_char*25)]\n", + "class AccountBook:\n", + " __aCount=int\n", + " __account=[AccountEntry]\n", + " def __init__(self, aCountIn):\n", + " self.__aCount=aCountIn\n", + " for i in range(self.__aCount):\n", + " self.__account.append(AccountEntry())\n", + " def op(self, nameIn):\n", + " if isinstance(nameIn, str):\n", + " for i in range(self.__aCount):\n", + " if nameIn==self.__account[i].name:\n", + " return self.__account[i].number\n", + " elif isinstance(nameIn, int): #numberIn\n", + " for i in range(self.__aCount):\n", + " #print self.__account[i].number\n", + " if nameIn==self.__account[i].number:\n", + " return self.__account[i].name\n", + " def AccountEntry(self):\n", + " for i in range(self.__aCount):\n", + " self.__account[i].number=int(raw_input(\"Account Number: \"))\n", + " self.__account[i].name=raw_input(\"Account Holder Name: \")\n", + "accounts=AccountBook(5)\n", + "print \"Building 5 Customers Database\"\n", + "accounts.AccountEntry()\n", + "print \"Accessing Accounts Information\"\n", + "accno=int(raw_input(\"To access Name Enter Account Number: \"))\n", + "print \"Name:\",accounts.op(accno) #accounts[accno]\n", + "name=raw_input(\"To access Account Number, Enter Name: \")\n", + "print \"Account Number:\",accounts.op(name) #accounts[name]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Building 5 Customers Database\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Number: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Holder Name: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Number: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Holder Name: Kiran\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Number: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Holder Name: Ravishanker\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Number: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Holder Name: Anand\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Number: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Holder Name: Sindhu\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Accessing Accounts Information\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "To access Name Enter Account Number: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "To access Account Number, Enter Name: Sindhu\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Number: 5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex6.cpp, Page no-519" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def readdata(self):\n", + " self._Complex__real=float(raw_input(\"Real part ? \"))\n", + " self._Complex__imag=float(raw_input(\"Imag part ? \"))\n", + "def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self._Complex__real, self._Complex__imag)\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " readdata=readdata\n", + " outdata=outdata\n", + " def __neg__(self):\n", + " return neg(self)\n", + "#friend function overloading unary minus operator\n", + "def neg(c1):\n", + " c=Complex()\n", + " c._Complex__real=-c1._Complex__real\n", + " c._Complex__imag=-c1._Complex__imag\n", + " return c\n", + "c1=Complex()\n", + "c2=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.readdata()\n", + "c2=-c1\n", + "c1.outdata(\"Complex c1 : \")\n", + "c2.outdata(\"Complex c2 = -Complex c1: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 1.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? -2.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Complex c1 : (1.5, -2.5)\n", + "Complex c2 = -Complex c1: (-1.5, 2.5)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex7.cpp, Page no-520" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def readdata(self):\n", + " self._Complex__real=float(raw_input(\"Real part ? \"))\n", + " self._Complex__imag=float(raw_input(\"Imag part ? \"))\n", + "def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self._Complex__real, self._Complex__imag)\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " readdata=readdata\n", + " outdata=outdata\n", + " def __neg__(self):\n", + " return neg(self)\n", + "#friend function overloading unary minus operator\n", + "def neg(c1):\n", + " c1._Complex__real=-c1._Complex__real\n", + " c1._Complex__imag=-c1._Complex__imag\n", + "c1=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.readdata()\n", + "-c1\n", + "c1.outdata(\"Complex c1 : \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 1.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? -2.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Complex c1 : (-1.5, 2.5)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex8.cpp, Page no-522" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self, realpart=0):\n", + " if isinstance(realpart, float):\n", + " self.__real=realpart\n", + " self.__imag=0\n", + " def readdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", + " def __add__(self, c2):\n", + " return add(self, c2)\n", + "#friend function overloading + operator\n", + "def add(c1, c2):\n", + " c=Complex()\n", + " c._Complex__real=c1._Complex__real+c2._Complex__real\n", + " c._Complex__imag=c1._Complex__imag+c2._Complex__imag\n", + " return c\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex(3)\n", + "print \"Enter Complex Number c1...\"\n", + "c1.readdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.readdata()\n", + "c3=c1+c2\n", + "c3.outdata(\"Result of c3 = c1 + c2: \")\n", + "c3=c1+Complex(2.0)\n", + "c3.outdata(\"Result of c3 = c1 + 2.0: \")\n", + "c3=Complex(3.0)+c2\n", + "c3.outdata(\"Result of c3 = 3.0 + c2: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Result of c3 = c1 + c2: (4, 6)\n", + "Result of c3 = c1 + 2.0: (3, 2)\n", + "Result of c3 = 3.0 + c2: (6, 4)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex9.cpp, Page no-525" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self, InReal=0):\n", + " if isinstance(InReal, float):\n", + " self.__real=InReal\n", + " self.__imag=0\n", + " def readdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", + " def __add__(self, c2):\n", + " return add(self, c2)\n", + "#friend function overloading + operator\n", + "def add(c1, c2):\n", + " c=Complex()\n", + " c._Complex__real=c1._Complex__real+c2._Complex__real\n", + " c._Complex__imag=c1._Complex__imag+c2._Complex__imag\n", + " return c\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex(3)\n", + "print \"Enter Complex Number c1...\"\n", + "c1.readdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.readdata()\n", + "c3=c1+c2\n", + "c3.outdata(\"Result of c3 = c1 + c2: \")\n", + "c3=c1+Complex(2.0)\n", + "c3.outdata(\"Result of c3 = c1 + 2.0: \")\n", + "c3=Complex(3.0)+c2\n", + "c3.outdata(\"Result of c3 = 3.0 + c2: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Result of c3 = c1 + c2: (4, 6)\n", + "Result of c3 = c1 + 2.0: (3, 2)\n", + "Result of c3 = 3.0 + c2: (6, 4)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector.cpp, Page no-528" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "def __assign__(self, v2):\n", + " print \"Assignment operation invoked\"\n", + " for i in range(v2._vector__size):\n", + " self._vector__v[i]=v2._vector__v[i]\n", + "def show(self):\n", + " for i in range(self._vector__size):\n", + " print self.elem(i), \",\",\n", + "class vector:\n", + " __v=[int]\n", + " __size=int\n", + " def __init__(self, vector_size):\n", + " if isinstance(vector_size, int):\n", + " self.__size=vector_size\n", + " self.__v=[int]*self.__size\n", + " if isinstance(vector_size, vector):\n", + " print \"Copy constructor invoked\"\n", + " self.__size=vector_size.__size\n", + " self.__v=[int]*self.__size\n", + " for i in range(vector_size.__size):\n", + " self.__v[i]=vector_size.__v[i]\n", + " def __del__(self):\n", + " del self.__v\n", + " __assign__=__assign__\n", + " def elem(self, i, x=None):\n", + " if isinstance(x, int):\n", + " if i>=self.__size:\n", + " print \"Error: Out of Range\"\n", + " self.__v[i]=x\n", + " else:\n", + " return self.__v[i]\n", + " show=show\n", + "v1=vector(5)\n", + "v2=vector(5)\n", + "for i in range(5):\n", + " v2.elem(i, i+1)\n", + "v1 = v2\n", + "v3 = vector(v2)\n", + "print \"Vector v1:\",\n", + "v1.show()\n", + "print \"\\nVector v2:\",\n", + "v2.show()\n", + "print \"\\nVector v3:\",\n", + "v3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Copy constructor invoked\n", + "Vector v1: 1 , 2 , 3 , 4 , 5 , \n", + "Vector v2: 1 , 2 , 3 , 4 , 5 , \n", + "Vector v3: 1 , 2 , 3 , 4 , 5 ,\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mleak.cpp, Page no-530" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "vector=[int]*10\n", + "buffer=[chr]*6\n", + "for i in range(10):\n", + " vector[i]=i+1\n", + "buffer=\"hello\"\n", + "for i in range(10):\n", + " print vector[i],\n", + "print \"\\nbuffer =\", buffer\n", + "del vector" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4 5 6 7 8 9 10 \n", + "buffer = hello\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-misuse.cpp, Page no-533" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class number:\n", + " __num=int\n", + " def read(self):\n", + " self.__num=int(raw_input())\n", + " def get(self):\n", + " return self.__num\n", + " def __add__(self, num2):\n", + " Sum=number()\n", + " Sum.__num=self.__num-num2.__num #subtraction instead of addition\n", + " return Sum\n", + "num1=number()\n", + "num2=number()\n", + "Sum=number()\n", + "print \"Enter Number 1: \",\n", + "num1.read()\n", + "print \"Enter Number 2: \",\n", + "num2.read()\n", + "Sum=num1+num2 #addition of two numbers\n", + "print \"sum = num1 + num2 =\", Sum.get()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Number 1: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Number 2: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " sum = num1 + num2 = -5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-537" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __add__(self, d2):\n", + " temp_date=date()\n", + " temp_date._date__sec=self._date__sec+d2._date__sec\n", + " if(temp_date._date__sec>=60):\n", + " temp_date._date__min+=1\n", + " temp_date._date__sec=temp_date._date__sec-60\n", + " temp_date._date__min=temp_date._date__min+self._date__min+d2._date__min\n", + " if(temp_date._date__min>=60):\n", + " temp_date._date__hr+=1\n", + " temp_date._date__min=temp_date._date__min-60\n", + " temp_date._date__hr=self._date__hr+d2._date__hr\n", + " return temp_date\n", + "class date:\n", + " __hr=int\n", + " __min=int\n", + " __sec=int\n", + " def __init__(self, h=0, m=0, s=0):\n", + " self.__hr=h\n", + " self.__min=m\n", + " self.__sec=s\n", + " def show(self):\n", + " print \"%d hours, %d minutes, %d seconds\" %(self.__hr, self.__min, self.__sec),\n", + " __add__=__add__\n", + "date1=date(2, 4, 56)\n", + "date2=date(10, 59, 11)\n", + "date3=date()\n", + "date3=date1+date2\n", + "date1.show()\n", + "print \"+\",\n", + "date2.show()\n", + "print \"=\",\n", + "date3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 hours, 4 minutes, 56 seconds + 10 hours, 59 minutes, 11 seconds = 12 hours, 4 minutes, 7 seconds\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-2, Page no-538" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __add__(self, b2):\n", + " temp_basket=basket()\n", + " temp_basket._basket__apples=self._basket__apples+b2._basket__apples\n", + " temp_basket._basket__mangoes=self._basket__mangoes+b2._basket__mangoes\n", + " return temp_basket\n", + "class basket:\n", + " __apples=int\n", + " __mangoes=int\n", + " def __init__(self, a=0, m=0):\n", + " self.__apples=a\n", + " self.__mangoes=m\n", + " def show(self):\n", + " print self.__apples, \" Apples and\", self.__mangoes, \" Mangoes\"\n", + " __add__=__add__ # overloading + operator\n", + "basket1=basket(7, 10)\n", + "basket2=basket(4, 5)\n", + "basket3=basket()\n", + "print \"Basket 1 contains:\"\n", + "basket1.show()\n", + "print \"Basket 2 contains:\"\n", + "basket2.show()\n", + "basket3=basket1+basket2 #using overloaded + operator\n", + "print \"Adding fruits from Basket 1 and Basket 2 results in:\"\n", + "basket3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Basket 1 contains:\n", + "7 Apples and 10 Mangoes\n", + "Basket 2 contains:\n", + "4 Apples and 5 Mangoes\n", + "Adding fruits from Basket 1 and Basket 2 results in:\n", + "11 Apples and 15 Mangoes\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading_1.ipynb new file mode 100755 index 00000000..b67f9d8d --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading_1.ipynb @@ -0,0 +1,2672 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:00870b63d144b6d5646400a298500edb387bcdbf86f8e9aa2b7d22e37fa4432a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13- Operator Overloading" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-index1.cpp, Page no-470" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Index:\n", + " __value=int\n", + " def __init__(self):\n", + " self.__value=0\n", + " def GetIndex(self):\n", + " return self.__value\n", + " def NextIndex(self):\n", + " self.__value=self.__value+1\n", + "idx1=Index()\n", + "idx2=Index()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "idx1.NextIndex()\n", + "idx2.NextIndex()\n", + "idx2.NextIndex()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index1 = 0\n", + "Index2 = 0\n", + "Index1 = 1\n", + "Index2 = 2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-index2.cpp, Page no-471" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Index:\n", + " __value=int\n", + " def __init__(self):\n", + " self.__value=0\n", + " def GetIndex(self):\n", + " return self.__value\n", + " #overload increment operator\n", + " def __iadd__(self, op):\n", + " self.__value=self.__value+op\n", + " return self\n", + "idx1=Index()\n", + "idx2=Index()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "idx1+=1 #overloaded increment operator invoked\n", + "idx2+=1 #overloaded increment operator invoked\n", + "idx2+=1 #overloaded increment operator invoked\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index1 = 0\n", + "Index2 = 0\n", + "Index1 = 1\n", + "Index2 = 2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-index3.cpp, Page no-475" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Index:\n", + " __value=int\n", + " def __init__(self):\n", + " self.__value=0\n", + " def GetIndex(self):\n", + " return self.__value\n", + " def __iadd__(self, op):\n", + " self.__value+=1\n", + " return self\n", + "idx1=Index()\n", + "idx2=Index()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "idx2+=1\n", + "idx1+=1\n", + "idx2+=1\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index1 = 0\n", + "Index2 = 0\n", + "Index1 = 1\n", + "Index2 = 2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-index4.cpp, Page no-476" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Index:\n", + " __value=int\n", + " def __init__(self):\n", + " self.__value=0\n", + " def GetIndex(self):\n", + " return self.__value\n", + " #overload increment operator\n", + " def __iadd__(self, op):\n", + " self.__value=self.__value+op\n", + " return self\n", + "idx1=Index()\n", + "idx2=Index()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "idx1+=1\n", + "idx2+=1\n", + "idx2+=1\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index1 = 0\n", + "Index2 = 0\n", + "Index1 = 1\n", + "Index2 = 2\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-index5.cpp, Page no-478" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Index:\n", + " __value=int\n", + " def __init__(self, val=0):\n", + " self.__value=val\n", + " def GetIndex(self):\n", + " return self.__value\n", + " #overload increment operator\n", + " def __iadd__(self, op):\n", + " self.__value=self.__value+op\n", + " return self\n", + "idx1=Index(2)\n", + "idx2=Index(2)\n", + "idx3=Index()\n", + "idx4=Index()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "idx3._Index__value=idx1._Index__value\n", + "idx1+=1\n", + "idx2+=1\n", + "idx4=idx2\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index3 =\", idx3.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "print \"Index4 =\", idx4.GetIndex()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index1 = 2\n", + "Index2 = 2\n", + "Index1 = 3\n", + "Index3 = 2\n", + "Index2 = 3\n", + "Index4 = 3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-index6.cpp, Page no-479" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Index:\n", + " __value=int\n", + " def __init__(self, val=0):\n", + " self.__value=val\n", + " def GetIndex(self):\n", + " return self.__value\n", + " #overload increment operator\n", + " def __iadd__(self, op):\n", + " self.__value=self.__value+op\n", + " return self\n", + " #overload decrement operator\n", + " def __isub__(self, op):\n", + " self.__value=self.__value-op\n", + " return self\n", + " #overload negation operator\n", + " def __neg__(self):\n", + " return Index(-self.__value)\n", + "idx1=Index()\n", + "idx2=Index()\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()\n", + "idx2+=1\n", + "idx1=-idx2\n", + "idx2+=1\n", + "idx2-=1\n", + "print \"Index1 =\", idx1.GetIndex()\n", + "print \"Index2 =\", idx2.GetIndex()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index1 = 0\n", + "Index2 = 0\n", + "Index1 = -1\n", + "Index2 = 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mydate.cpp, Page no-480" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class date:\n", + " __day=int\n", + " __month=int\n", + " __year=int\n", + " def __init__(self, d=0, m=0, y=0):\n", + " if isinstance(d, int):\n", + " self.__day=d\n", + " self.__month=m\n", + " self.__year=y\n", + " else:\n", + " self.__day=0\n", + " self.__month=0\n", + " self.__year=0\n", + " def read(self):\n", + " self.__day, self.__month, self.__year=[int(x) for x in raw_input(\"Enter date
: \").split()]\n", + " def show(self):\n", + " print \"%s:%s:%s\" %(self.__day, self.__month, self.__year),\n", + " def IsLeapYear(self):\n", + " if (self.__year%4==0 and self.__year%100!=0) or (self.__year % 400==0):\n", + " return 1\n", + " else:\n", + " return 0\n", + " def thisMonthMaxDay(self):\n", + " m=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n", + " if self.__month==2 and self.IsLeapYear():\n", + " return 29\n", + " else:\n", + " return m[self.__month-1]\n", + " def __iadd__(self, op): #overloading increment operator\n", + " self.__day+=1\n", + " if self.__day>self.thisMonthMaxDay():\n", + " self.__day=1\n", + " self.__month+=1\n", + " if self.__month>12:\n", + " self.__month=1\n", + " self.__year+=1\n", + " return self\n", + "def nextday(d):\n", + " print 'Date', \n", + " d.show()\n", + " d+=1 #overloaded increment operator invoked\n", + " print \"on increment becomes\", \n", + " d.show()\n", + " print \"\"\n", + "d1=date(14, 4, 1971)\n", + "d2=date(28, 2, 1992)\n", + "d3=date(28, 2, 1993)\n", + "d4=date(31, 12, 1995)\n", + "nextday(d1)\n", + "nextday(d2)\n", + "nextday(d3)\n", + "nextday(d4)\n", + "today=date()\n", + "today.read()\n", + "nextday(today)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Date 14:4:1971 on increment becomes 15:4:1971 \n", + "Date 28:2:1992 on increment becomes 29:2:1992 \n", + "Date 28:2:1993 on increment becomes 1:3:1993 \n", + "Date 31:12:1995 on increment becomes 1:1:1996 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter date
: 11 9 1996\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Date 11:9:1996 on increment becomes 12:9:1996 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex1.cpp, Page no-483" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def AddComplex(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " AddComplex=AddComplex\n", + " def outdata(self, msg):\n", + " print \"%s(%0.1f, %0.1f)\" %(msg, self.__real, self.__imag)\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.getdata()\n", + "c3=c1.AddComplex(c2)\n", + "c3.outdata(\"c3 = c1.AddComplex(c2) : \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 2.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 1.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c3 = c1.AddComplex(c2) : (5.5, 3.5)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex2.cpp, Page no-484" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __add__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " #overloading + operator\n", + " __add__=__add__\n", + " def outdata(self, msg):\n", + " print \"%s(%0.1f, %0.1f)\" %(msg, self.__real, self.__imag)\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.getdata()\n", + "c3=c1+c2 #invoking the overloaded + operator\n", + "c3.outdata(\"c3 = c1 + c2: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 2.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 1.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c3 = c1 + c2: (5.5, 3.5)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex3.cpp, Page no-487" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __add__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "def __sub__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real-c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag-c2._Complex__imag\n", + " return temp\n", + "def __mul__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real*c2._Complex__real-self._Complex__imag*c2._Complex__imag\n", + " temp._Complex__imag=self._Complex__real*c2._Complex__imag+self._Complex__imag*c2._Complex__real\n", + " return temp\n", + "def __div__(self, c2):\n", + " temp=Complex()\n", + " qt=c2._Complex__real*c2._Complex__real+c2._Complex__imag *c2._Complex__imag\n", + " temp._Complex__real=(self._Complex__real*c2._Complex__real+self._Complex__imag*c2._Complex__imag)/qt\n", + " temp._Complex__imag=(self._Complex__imag*c2._Complex__real-self._Complex__real*c2._Complex__imag)/qt\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " #overloading +, -, * and / operator\n", + " __add__=__add__\n", + " __sub__=__sub__\n", + " __mul__=__mul__\n", + " __div__=__div__\n", + " def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.getdata()\n", + "print \"Entered Complex numbers are...\"\n", + "c1.outdata(\"c1 = \")\n", + "c2.outdata(\"c2 = \")\n", + "print \"Computational results are...\"\n", + "c3=c1+c2 #invoking the overloaded + operator\n", + "c3.outdata(\"c3 = c1 + c2: \")\n", + "c3=c1-c2 #invoking the overloaded - operator\n", + "c3.outdata(\"c3 = c1 - c2: \")\n", + "c3=c1*c2 #invoking the overloaded * operator\n", + "c3.outdata(\"c3 = c1 * c2: \")\n", + "c3=c1/c2 #invoking the overloaded / operator\n", + "c3.outdata(\"c3 = c1 / c2: \")\n", + "c3 = c1 + c2 + c1 + c2\n", + "c3.outdata(\"c3 = c1 + c2 + c1 + c2: \")\n", + "c3 = c1 * c2 + c1 / c2\n", + "c3.outdata(\"c3 = c1 * c2 + c1 / c2: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 2.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 1.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entered Complex numbers are...\n", + "c1 = (2.5, 2)\n", + "c2 = (3, 1.5)\n", + "Computational results are...\n", + "c3 = c1 + c2: (5.5, 3.5)\n", + "c3 = c1 - c2: (-0.5, 0.5)\n", + "c3 = c1 * c2: (4.5, 9.75)\n", + "c3 = c1 / c2: (0.933333, 0.2)\n", + "c3 = c1 + c2 + c1 + c2: (11, 7)\n", + "c3 = c1 * c2 + c1 / c2: (5.43333, 9.95)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-string.cpp, Page no-490" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "BUFF_SIZE=50\n", + "class string:\n", + " __Str=[None]*BUFF_SIZE\n", + " def __init__(self, MyStr=None):\n", + " if isinstance(MyStr, str):\n", + " self.__Str=MyStr\n", + " else:\n", + " self.__Str=\"\"\n", + " def echo(self):\n", + " print self.__Str\n", + " def __add__(self, s):\n", + " temp=string(self._string__Str)\n", + " temp._string__Str+=s._string__Str\n", + " return temp\n", + "str1=string(\"Welcome to \")\n", + "str2=string(\"Operator Overloading\")\n", + "str3=string()\n", + "print \"Before str3 = str1 + str2;..\"\n", + "print \"str1 = \",\n", + "str1.echo()\n", + "print \"str2 = \",\n", + "str2.echo()\n", + "print \"str3 = \",\n", + "str3.echo()\n", + "str3=str1+str2\n", + "print \"After str3 = str1 + str2;..\"\n", + "print \"str1 = \",\n", + "str1.echo()\n", + "print \"str2 = \",\n", + "str2.echo()\n", + "print \"str3 = \",\n", + "str3.echo()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before str3 = str1 + str2;..\n", + "str1 = Welcome to \n", + "str2 = Operator Overloading\n", + "str3 = \n", + "After str3 = str1 + str2;..\n", + "str1 = Welcome to \n", + "str2 = Operator Overloading\n", + "str3 = Welcome to Operator Overloading\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-idxcmp.cpp, Page no-491" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "(false, true)=(0, 1) #enum type\n", + "type =['false', 'true']\n", + "class Index:\n", + " __value=int\n", + " def __init__(self, val=0):\n", + " self.__value=val\n", + " def GetIndex(self):\n", + " return self.__value\n", + " #overloading < operator\n", + " def __lt__(self, idx):\n", + " return true if self.__value operator\n", + " def __gt__(self, s):\n", + " if self.__Str > s.__Str:\n", + " return true\n", + " else:\n", + " return false\n", + " #overloading == operator\n", + " def __eq__(self, MyStr):\n", + " if self.__Str ==MyStr:\n", + " return true\n", + " else:\n", + " return false\n", + "str1=string()\n", + "str2=string()\n", + "while(1):\n", + " print \"Enter String1 <'end' to stop>:\",\n", + " str1.read()\n", + " if str1==\"end\": #using overloaded == operator\n", + " break\n", + " print 'Enter String2:',\n", + " str2.read()\n", + " print 'Comparison status:',\n", + " str1.echo()\n", + " if str1str2:\n", + " print \">\", #using overloaded > operator\n", + " else:\n", + " print \"=\",\n", + " str2.echo()\n", + " print \"\"\n", + "print \"Bye.!! That's all folks.!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter String1 <'end' to stop>:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter String2:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Comparison status: C < C++ \n", + "Enter String1 <'end' to stop>:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rajkumar\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter String2:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bindu\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Comparison status: Rajkumar > Bindu \n", + "Enter String1 <'end' to stop>:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rajkumar\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter String2:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Venugopal\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Comparison status: Rajkumar < Venugopal \n", + "Enter String1 <'end' to stop>:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "HELLO\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter String2:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "HELLO\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Comparison status: HELLO = HELLO \n", + "Enter String1 <'end' to stop>:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "end\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Bye.!! That's all folks.!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex4.cpp, Page no-495" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __iadd__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "def __isub__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real-c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag-c2._Complex__imag\n", + " return temp\n", + "def __imul__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real*c2._Complex__real-self._Complex__imag*c2._Complex__imag\n", + " temp._Complex__imag=self._Complex__real*c2._Complex__imag+self._Complex__imag*c2._Complex__real\n", + " return temp\n", + "def __idiv__(self, c2):\n", + " temp=Complex()\n", + " qt=c2._Complex__real*c2._Complex__real+c2._Complex__imag *c2._Complex__imag\n", + " temp._Complex__real=(self._Complex__real*c2._Complex__real+self._Complex__imag*c2._Complex__imag)/qt\n", + " temp._Complex__imag=(self._Complex__imag*c2._Complex__real-self._Complex__real*c2._Complex__imag)/qt\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " #overloading +=, -=, *= and /= operator\n", + " __iadd__=__iadd__\n", + " __isub__=__isub__\n", + " __imul__=__imul__\n", + " __idiv__=__idiv__\n", + " def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.getdata()\n", + "print \"Entered Complex numbers are...\"\n", + "c1.outdata(\"c1 = \")\n", + "c2.outdata(\"c2 = \")\n", + "print \"Computational results are...\"\n", + "c3=c1 \n", + "c3+=c2 #invoking the overloaded += operator\n", + "c3.outdata(\"let c3 = c1, c3+=c2: \")\n", + "c3=c1 \n", + "c3-=c2 #invoking the overloaded -= operator\n", + "c3.outdata(\"let c3 = c1, c3-=c2: \")\n", + "c3=c1 \n", + "c3*=c2 #invoking the overloaded *= operator\n", + "c3.outdata(\"let c3 = c1, c3*=c2: \")\n", + "c3=c1 \n", + "c3/=c2 #invoking the overloaded / operator\n", + "c3.outdata(\"let c3 = c1, c3/=c2: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 2.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 1.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entered Complex numbers are...\n", + "c1 = (2.5, 2)\n", + "c2 = (3, 1.5)\n", + "Computational results are...\n", + "let c3 = c1, c3+=c2: (5.5, 3.5)\n", + "let c3 = c1, c3-=c2: (-0.5, 0.5)\n", + "let c3 = c1, c3*=c2: (4.5, 9.75)\n", + "let c3 = c1, c3/=c2: (0.933333, 0.2)\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex-5.cpp, Page no-498" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __iadd__(self, c2):\n", + " self._Complex__real=self._Complex__real+c2._Complex__real\n", + " self._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return self\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " #overloading += operator\n", + " __iadd__=__iadd__\n", + " def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.getdata()\n", + "c1 += c2 #using overloaded += operator\n", + "c3 = c1\n", + "print \"On execution of c3 = c1 += c2..\"\n", + "c1.outdata(\"Complex c1: \")\n", + "c2.outdata(\"Complex c2: \")\n", + "c3.outdata(\"Complex c3: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 2.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 1.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On execution of c3 = c1 += c2..\n", + "Complex c1: (5.5, 3.5)\n", + "Complex c2: (3, 1.5)\n", + "Complex c3: (5.5, 3.5)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-resource.cpp, Page no-499" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ARRAY_SIZE=10\n", + "def read(self):\n", + " for i in range(ARRAY_SIZE):\n", + " print \"vector[\", i, \"] = ? \",\n", + " self._vector__array[i]=int(raw_input())\n", + "def sum(self):\n", + " Sum=0\n", + " for i in range(ARRAY_SIZE):\n", + " Sum+=self._vector__array[i]\n", + " return Sum\n", + "class vector:\n", + " __array=[int]\n", + " def new(self):\n", + " myvector=vector()\n", + " myvector.__array=[int]*ARRAY_SIZE\n", + " return myvector\n", + " def delete(self):\n", + " del self\n", + " read=read\n", + " sum=sum\n", + "my_vector=vector()\n", + "my_vector=my_vector.new()\n", + "print \"Enter Vector data...\"\n", + "my_vector.read()\n", + "print \"Sum of Vector =\", my_vector.sum()\n", + "del my_vector" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Vector data...\n", + "vector[ 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 2 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 3 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 4 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 5 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 6 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 7 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 8 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector[ 9 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sum of Vector = 55\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-meter.cpp, Page no-504" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Meter:\n", + " __length=float\n", + " def __init__(self, InitLength=0.0):\n", + " self.__length=InitLength/100.0\n", + " def float(self):\n", + " LengthCms=self.__length*100.0\n", + " return LengthCms\n", + " def GetLength(self):\n", + " self.__length=float(raw_input(\"Enter Length (in meters): \"))\n", + " def ShowLength(self):\n", + " print \"Length (in meter) =\", self.__length\n", + "length1=float(raw_input(\"Enter Lenthg (in cms): \"))\n", + "meter1=Meter(length1)\n", + "meter1.ShowLength()\n", + "meter2=Meter()\n", + "length2=float\n", + "meter2.GetLength()\n", + "length2=meter2.float()\n", + "print \"Length (in cms) =\", length2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Lenthg (in cms): 150.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length (in meter) = 1.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Length (in meters): 1.669\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length (in cms) = 166.9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-strconv.cpp, Page no-506" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "BUFF_SIZE=50\n", + "class string:\n", + " __Str=[None]*BUFF_SIZE\n", + " def __init__(self, MyStr=None):\n", + " if isinstance(MyStr, str):\n", + " self.__Str=MyStr\n", + " else:\n", + " self.__Str=\"\"\n", + " def echo(self):\n", + " print self.__Str\n", + " def char(self):\n", + " return self.__Str\n", + "msg=\"OOPs the Great\"\n", + "str1=string(msg)\n", + "print \"str1 =\",\n", + "str1.echo()\n", + "str2=string(\"It is nice to learn\")\n", + "receive=str2.char()\n", + "print \"Str2 =\", receive" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "str1 = OOPs the Great\n", + "Str2 = It is nice to learn\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-d2r1.cpp, Page no-509 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "PI=3.141592654\n", + "class Radian:\n", + " __rad=float\n", + " def __init__(self, InitRad=0.0):\n", + " self.__rad=InitRad\n", + " def GetRadian(self):\n", + " return self.__rad\n", + " def Output(self):\n", + " print \"Radian =\", self.GetRadian()\n", + "class Degree:\n", + " __degree=float\n", + " def __init__(self):\n", + " self.__degree=0.0\n", + " def Radian(self):\n", + " return ( Radian(self.__degree * PI / 180.0))\n", + " def Input(self):\n", + " self.__degree=float(raw_input(\"Enter degree: \"))\n", + "deg1=Degree()\n", + "deg1.Input()\n", + "rad1=deg1.Radian()\n", + "rad1.Output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter degree: 180\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Radian = 3.141592654\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-d2r2.cpp, Page no-512" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "PI=3.141592654\n", + "class Degree:\n", + " __degree=float\n", + " def __init__(self):\n", + " self.__degree=0.0\n", + " def GetDegree(self):\n", + " return self.__degree\n", + " def Input(self):\n", + " self.__degree=float(raw_input(\"Enter degree: \"))\n", + "class Radian:\n", + " __rad=float\n", + " def __init__(self, deg=None):\n", + " if isinstance(deg , Degree):\n", + " self.__rad=deg.GetDegree()*PI/180.0\n", + " else:\n", + " self.__rad=0.0\n", + " def GetRadian(self):\n", + " return self.__rad\n", + " def Output(self):\n", + " print \"Radian =\", self.GetRadian()\n", + "deg1=Degree()\n", + "deg1.Input()\n", + "rad1=Radian(deg1)\n", + "rad1.Output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter degree: 90\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Radian = 1.570796327\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-degrad.cpp, Page no-514" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "PI=3.141592654\n", + "class Radian:\n", + " __rad=float\n", + " def __init__(self, InitRad=0.0):\n", + " self.__rad=InitRad\n", + " def GetRadian(self):\n", + " return self.__rad\n", + " def Input(self):\n", + " self.__rad=float(raw_input(\"Enter radian: \"))\n", + " def Output(self):\n", + " print \"Radian =\", self.GetRadian()\n", + "class Degree:\n", + " __degree=float\n", + " def __init__(self, rad=None):\n", + " if isinstance(rad, Radian):\n", + " self.__degree=rad.GetRadian()*180.0/PI\n", + " else:\n", + " self.__degree=0.0\n", + " def GetDegree(self):\n", + " return self.__degree\n", + " def Radian(self):\n", + " return ( Radian(self.__degree * PI / 180.0))\n", + " def Input(self):\n", + " self.__degree=float(raw_input(\"Enter degree: \"))\n", + " def Output(self):\n", + " print \"Degree =\", self.__degree\n", + "deg1=Degree()\n", + "deg1.Input()\n", + "rad1=deg1.Radian()\n", + "rad1.Output()\n", + "rad2=Radian()\n", + "rad2.Input()\n", + "deg2=Degree(rad2)\n", + "deg2.Output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter degree: 180\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Radian = 3.141592654\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter radian: 3.142\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Degree = 180.023339207\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-script.cpp, Page no-516" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure, c_int, c_char\n", + "class AccountEntry(Structure):\n", + " _fields_=[('number',c_int), ('name', c_char*25)]\n", + "class AccountBook:\n", + " __aCount=int\n", + " __account=[AccountEntry]\n", + " def __init__(self, aCountIn):\n", + " self.__aCount=aCountIn\n", + " for i in range(self.__aCount):\n", + " self.__account.append(AccountEntry())\n", + " def op(self, nameIn):\n", + " if isinstance(nameIn, str):\n", + " for i in range(self.__aCount):\n", + " if nameIn==self.__account[i].name:\n", + " return self.__account[i].number\n", + " elif isinstance(nameIn, int): #numberIn\n", + " for i in range(self.__aCount):\n", + " #print self.__account[i].number\n", + " if nameIn==self.__account[i].number:\n", + " return self.__account[i].name\n", + " def AccountEntry(self):\n", + " for i in range(self.__aCount):\n", + " self.__account[i].number=int(raw_input(\"Account Number: \"))\n", + " self.__account[i].name=raw_input(\"Account Holder Name: \")\n", + "accounts=AccountBook(5)\n", + "print \"Building 5 Customers Database\"\n", + "accounts.AccountEntry()\n", + "print \"Accessing Accounts Information\"\n", + "accno=int(raw_input(\"To access Name Enter Account Number: \"))\n", + "print \"Name:\",accounts.op(accno) #accounts[accno]\n", + "name=raw_input(\"To access Account Number, Enter Name: \")\n", + "print \"Account Number:\",accounts.op(name) #accounts[name]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Building 5 Customers Database\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Number: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Holder Name: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Number: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Holder Name: Kiran\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Number: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Holder Name: Ravishanker\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Number: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Holder Name: Anand\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Number: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Holder Name: Sindhu\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Accessing Accounts Information\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "To access Name Enter Account Number: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "To access Account Number, Enter Name: Sindhu\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Account Number: 5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex6.cpp, Page no-519" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def readdata(self):\n", + " self._Complex__real=float(raw_input(\"Real part ? \"))\n", + " self._Complex__imag=float(raw_input(\"Imag part ? \"))\n", + "def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self._Complex__real, self._Complex__imag)\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " readdata=readdata\n", + " outdata=outdata\n", + " def __neg__(self):\n", + " return neg(self)\n", + "#friend function overloading unary minus operator\n", + "def neg(c1):\n", + " c=Complex()\n", + " c._Complex__real=-c1._Complex__real\n", + " c._Complex__imag=-c1._Complex__imag\n", + " return c\n", + "c1=Complex()\n", + "c2=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.readdata()\n", + "c2=-c1\n", + "c1.outdata(\"Complex c1 : \")\n", + "c2.outdata(\"Complex c2 = -Complex c1: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 1.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? -2.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Complex c1 : (1.5, -2.5)\n", + "Complex c2 = -Complex c1: (-1.5, 2.5)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex7.cpp, Page no-520" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def readdata(self):\n", + " self._Complex__real=float(raw_input(\"Real part ? \"))\n", + " self._Complex__imag=float(raw_input(\"Imag part ? \"))\n", + "def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self._Complex__real, self._Complex__imag)\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " readdata=readdata\n", + " outdata=outdata\n", + " def __neg__(self):\n", + " return neg(self)\n", + "#friend function overloading unary minus operator\n", + "def neg(c1):\n", + " c1._Complex__real=-c1._Complex__real\n", + " c1._Complex__imag=-c1._Complex__imag\n", + "c1=Complex()\n", + "print \"Enter Complex Number c1...\"\n", + "c1.readdata()\n", + "-c1\n", + "c1.outdata(\"Complex c1 : \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 1.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? -2.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Complex c1 : (-1.5, 2.5)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex8.cpp, Page no-522" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self, realpart=0):\n", + " if isinstance(realpart, float):\n", + " self.__real=realpart\n", + " self.__imag=0\n", + " def readdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", + " def __add__(self, c2):\n", + " return add(self, c2)\n", + "#friend function overloading + operator\n", + "def add(c1, c2):\n", + " c=Complex()\n", + " c._Complex__real=c1._Complex__real+c2._Complex__real\n", + " c._Complex__imag=c1._Complex__imag+c2._Complex__imag\n", + " return c\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex(3)\n", + "print \"Enter Complex Number c1...\"\n", + "c1.readdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.readdata()\n", + "c3=c1+c2\n", + "c3.outdata(\"Result of c3 = c1 + c2: \")\n", + "c3=c1+Complex(2.0)\n", + "c3.outdata(\"Result of c3 = c1 + 2.0: \")\n", + "c3=Complex(3.0)+c2\n", + "c3.outdata(\"Result of c3 = 3.0 + c2: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Result of c3 = c1 + c2: (4, 6)\n", + "Result of c3 = c1 + 2.0: (3, 2)\n", + "Result of c3 = 3.0 + c2: (6, 4)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex9.cpp, Page no-525" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self, InReal=0):\n", + " if isinstance(InReal, float):\n", + " self.__real=InReal\n", + " self.__imag=0\n", + " def readdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", + " def __add__(self, c2):\n", + " return add(self, c2)\n", + "#friend function overloading + operator\n", + "def add(c1, c2):\n", + " c=Complex()\n", + " c._Complex__real=c1._Complex__real+c2._Complex__real\n", + " c._Complex__imag=c1._Complex__imag+c2._Complex__imag\n", + " return c\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex(3)\n", + "print \"Enter Complex Number c1...\"\n", + "c1.readdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.readdata()\n", + "c3=c1+c2\n", + "c3.outdata(\"Result of c3 = c1 + c2: \")\n", + "c3=c1+Complex(2.0)\n", + "c3.outdata(\"Result of c3 = c1 + 2.0: \")\n", + "c3=Complex(3.0)+c2\n", + "c3.outdata(\"Result of c3 = 3.0 + c2: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Result of c3 = c1 + c2: (4, 6)\n", + "Result of c3 = c1 + 2.0: (3, 2)\n", + "Result of c3 = 3.0 + c2: (6, 4)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector.cpp, Page no-528" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __assign__(self, v2):\n", + " print \"Assignment operation invoked\"\n", + " for i in range(v2._vector__size):\n", + " self._vector__v[i]=v2._vector__v[i]\n", + "def show(self):\n", + " for i in range(self._vector__size):\n", + " print self.elem(i), \",\",\n", + "class vector:\n", + " __v=[int]\n", + " __size=int\n", + " def __init__(self, vector_size):\n", + " if isinstance(vector_size, int):\n", + " self.__size=vector_size\n", + " self.__v=[int]*self.__size\n", + " if isinstance(vector_size, vector):\n", + " print \"Copy constructor invoked\"\n", + " self.__size=vector_size.__size\n", + " self.__v=[int]*self.__size\n", + " for i in range(vector_size.__size):\n", + " self.__v[i]=vector_size.__v[i]\n", + " def __del__(self):\n", + " del self.__v\n", + " __assign__=__assign__\n", + " def elem(self, i, x=None):\n", + " if isinstance(x, int):\n", + " if i>=self.__size:\n", + " print \"Error: Out of Range\"\n", + " self.__v[i]=x\n", + " else:\n", + " return self.__v[i]\n", + " show=show\n", + "v1=vector(5)\n", + "v2=vector(5)\n", + "for i in range(5):\n", + " v2.elem(i, i+1)\n", + "v1 = v2\n", + "v3 = vector(v2)\n", + "print \"Vector v1:\",\n", + "v1.show()\n", + "print \"\\nVector v2:\",\n", + "v2.show()\n", + "print \"\\nVector v3:\",\n", + "v3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Copy constructor invoked\n", + "Vector v1: 1 , 2 , 3 , 4 , 5 , \n", + "Vector v2: 1 , 2 , 3 , 4 , 5 , \n", + "Vector v3: 1 , 2 , 3 , 4 , 5 ,\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mleak.cpp, Page no-530" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "vector=[int]*10\n", + "buffer=[chr]*6\n", + "for i in range(10):\n", + " vector[i]=i+1\n", + "buffer=\"hello\"\n", + "for i in range(10):\n", + " print vector[i],\n", + "print \"\\nbuffer =\", buffer\n", + "del vector" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4 5 6 7 8 9 10 \n", + "buffer = hello\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-misuse.cpp, Page no-533" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class number:\n", + " __num=int\n", + " def read(self):\n", + " self.__num=int(raw_input())\n", + " def get(self):\n", + " return self.__num\n", + " def __add__(self, num2):\n", + " Sum=number()\n", + " Sum.__num=self.__num-num2.__num #subtraction instead of addition\n", + " return Sum\n", + "num1=number()\n", + "num2=number()\n", + "Sum=number()\n", + "print \"Enter Number 1: \",\n", + "num1.read()\n", + "print \"Enter Number 2: \",\n", + "num2.read()\n", + "Sum=num1+num2 #addition of two numbers\n", + "print \"sum = num1 + num2 =\", Sum.get()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Number 1: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Number 2: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " sum = num1 + num2 = -5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-537" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __add__(self, d2):\n", + " temp_date=date()\n", + " temp_date._date__sec=self._date__sec+d2._date__sec\n", + " if(temp_date._date__sec>=60):\n", + " temp_date._date__min+=1\n", + " temp_date._date__sec=temp_date._date__sec-60\n", + " temp_date._date__min=temp_date._date__min+self._date__min+d2._date__min\n", + " if(temp_date._date__min>=60):\n", + " temp_date._date__hr+=1\n", + " temp_date._date__min=temp_date._date__min-60\n", + " temp_date._date__hr=self._date__hr+d2._date__hr\n", + " return temp_date\n", + "class date:\n", + " __hr=int\n", + " __min=int\n", + " __sec=int\n", + " def __init__(self, h=0, m=0, s=0):\n", + " self.__hr=h\n", + " self.__min=m\n", + " self.__sec=s\n", + " def show(self):\n", + " print \"%d hours, %d minutes, %d seconds\" %(self.__hr, self.__min, self.__sec),\n", + " __add__=__add__\n", + "date1=date(2, 4, 56)\n", + "date2=date(10, 59, 11)\n", + "date3=date()\n", + "date3=date1+date2\n", + "date1.show()\n", + "print \"+\",\n", + "date2.show()\n", + "print \"=\",\n", + "date3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 hours, 4 minutes, 56 seconds + 10 hours, 59 minutes, 11 seconds = 12 hours, 4 minutes, 7 seconds\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-2, Page no-538" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __add__(self, b2):\n", + " temp_basket=basket()\n", + " temp_basket._basket__apples=self._basket__apples+b2._basket__apples\n", + " temp_basket._basket__mangoes=self._basket__mangoes+b2._basket__mangoes\n", + " return temp_basket\n", + "class basket:\n", + " __apples=int\n", + " __mangoes=int\n", + " def __init__(self, a=0, m=0):\n", + " self.__apples=a\n", + " self.__mangoes=m\n", + " def show(self):\n", + " print self.__apples, \" Apples and\", self.__mangoes, \" Mangoes\"\n", + " __add__=__add__ # overloading + operator\n", + "basket1=basket(7, 10)\n", + "basket2=basket(4, 5)\n", + "basket3=basket()\n", + "print \"Basket 1 contains:\"\n", + "basket1.show()\n", + "print \"Basket 2 contains:\"\n", + "basket2.show()\n", + "basket3=basket1+basket2 #using overloaded + operator\n", + "print \"Adding fruits from Basket 1 and Basket 2 results in:\"\n", + "basket3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Basket 1 contains:\n", + "7 Apples and 10 Mangoes\n", + "Basket 2 contains:\n", + "4 Apples and 5 Mangoes\n", + "Adding fruits from Basket 1 and Basket 2 results in:\n", + "11 Apples and 15 Mangoes\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance.ipynb new file mode 100755 index 00000000..a617fa5c --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance.ipynb @@ -0,0 +1,2736 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:63736c9aef28a6babc99661e161907400b7b80441a3f765e7ab8b6e00648ce25" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14- Inheritance" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-bag.cpp, Page-544" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "(false, true)=(0, 1) #enum type\n", + "type =['false', 'true']\n", + "MAX_ITEMS=25\n", + "def IsExist(self, item):\n", + " for i in range(self._Bag__ItemCount):\n", + " if self._Bag__contents[i]==item:\n", + " return true\n", + " return false\n", + "def show(self):\n", + " for i in range(self._Bag__ItemCount):\n", + " print self._Bag__contents[i],\n", + " print \"\"\n", + "class Bag:\n", + " __contents=[int]*MAX_ITEMS #protected members\n", + " __ItemCount=int\n", + " def __init__(self):\n", + " self.__ItemCount=0\n", + " def put(self, item):\n", + " self.__contents[self.__ItemCount]=item\n", + " self.__ItemCount+=1\n", + " def IsEmpty(self):\n", + " return true if self.__ItemCount==0 else false\n", + " def IsFull(self):\n", + " return true if self.__ItemCount==MAX_ITEMS else false\n", + " IsExist=IsExist\n", + " show=show\n", + "bag=Bag()\n", + "item=int\n", + "while(true):\n", + " item=int(raw_input(\"Enter Item Number to be put into the bag <0-no item>: \"))\n", + " if item==0:\n", + " break\n", + " bag.put(item)\n", + " print \"Items in Bag:\",\n", + " bag.show()\n", + " if bag.IsFull():\n", + " print \"Bag Full, no more items can be placed\"\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in Bag: 1 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Number to be put into the bag <0-no item>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in Bag: 1 2 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in Bag: 1 2 3 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in Bag: 1 2 3 3 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in Bag: 1 2 3 3 1 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Number to be put into the bag <0-no item>: 0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-union.cpp, Page no-548" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "(false, true)=(0, 1) #enum type\n", + "type =['false', 'true']\n", + "MAX_ITEMS=25\n", + "def IsExist(self, item):\n", + " for i in range(self._Bag__ItemCount):\n", + " if self._Bag__contents[i]==item:\n", + " return true\n", + " return false\n", + "def show(self):\n", + " for i in range(self._Bag__ItemCount):\n", + " print self._Bag__contents[i],\n", + " print \"\"\n", + "class Bag:\n", + " #protected members\n", + " __ItemCount=int\n", + " def __init__(self):\n", + " self.__ItemCount=0\n", + " self.__contents=[int]*MAX_ITEMS\n", + " def put(self, item):\n", + " self.__contents[self.__ItemCount]=item\n", + " self.__ItemCount+=1\n", + " def IsEmpty(self):\n", + " return true if self.__ItemCount==0 else false\n", + " def IsFull(self):\n", + " return true if self.__ItemCount==MAX_ITEMS else false\n", + " IsExist=IsExist\n", + " show=show\n", + "def read(self):\n", + " while(true):\n", + " element=int(raw_input(\"Enter Set Element <0-end>: \"))\n", + " if element==0:\n", + " break\n", + " self.Add(element)\n", + "def add(s1, s2):\n", + " temp = Set()\n", + " temp=s1\n", + " for i in range(s2._Bag__ItemCount):\n", + " if s1.IsExist(s2._Bag__contents[i])==false:\n", + " temp.Add(s2._Bag__contents[i])\n", + " return temp\n", + "class Set(Bag):\n", + " def Add(self,element):\n", + " if(self.IsExist(element)==false and self.IsFull()==false):\n", + " self.put(element)\n", + " read=read\n", + " def __assign__(self, s2):\n", + " for i in range(s2._Bag__ItemCount):\n", + " self.__contents[i]=s2.__contents[i]\n", + " self.__ItemCount=s2.__ItemCount\n", + " def __add__(self, s2):\n", + " return add(self, s2)\n", + "s1=Set()\n", + "s2=Set()\n", + "s3=Set()\n", + "print \"Enter Set 1 elements..\"\n", + "s1.read()\n", + "print \"Enter Set 2 elemets..\"\n", + "s2.read()\n", + "s3=s1+s2\n", + "print \"Union of s1 and s2 :\",\n", + "s3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set 1 elements..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set 2 elemets..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Union of s1 and s2 : 1 2 3 4 5 6 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons1.cpp, Page no-558" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " pass\n", + "class D(B):\n", + " def msg(self):\n", + " print \"No constructors exist in base and derived class\"\n", + "objd=D()\n", + "objd.msg()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No constructors exist in base and derived class\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons2.cpp, Page no-558" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " def __init__(self):\n", + " print \"No-argument constructor of base class B is executed\"\n", + "class D(B):\n", + " pass\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of base class B is executed\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons3.cpp, Page no-559" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " pass\n", + "class D(B):\n", + " def __init__(self):\n", + " print \"Constructors exist only in derived class\"\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructors exist only in derived class\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons4.cpp, Page no-559" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " def __init__(self):\n", + " print \"No-argument constructor of base class B executed first\"\n", + "class D(B):\n", + " def __init__(self):\n", + " B.__init__(self)\n", + " print \"No-argument constructor of derived class D executed next\"\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of base class B executed first\n", + "No-argument constructor of derived class D executed next\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons5.cpp, Page no-560" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " def __init__(self, a=0):\n", + " if isinstance(a, int):\n", + " print \"One-argument constructor of the base class B\"\n", + " else:\n", + " print \"No-argument constructor of the base class B\"\n", + "class D(B):\n", + " def __init__(self, a):\n", + " B.__init__(self, a)\n", + " print \"One-argument constructor of the derived class D\"\n", + "objd=D(3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "One-argument constructor of the base class B\n", + "One-argument constructor of the derived class D\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons7.cpp, Page no-561" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " def __init__(self, a):\n", + " print \"One-argument constructor of the base class B\"\n", + "class D(B):\n", + " def __init__(self, a):\n", + " B(a)\n", + " print \"One-argument constructor of the derived class D\"\n", + "objd=D(3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "One-argument constructor of the base class B\n", + "One-argument constructor of the derived class D\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons8.cpp, Page no-562" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B1:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B1\"\n", + "class B2:\n", + " def __init__(self):\n", + " B1.__init__(self)\n", + " print \"No-argument constructor of the base class B2\"\n", + "class D(B2, B1):\n", + " def __init__(self):\n", + " B2.__init__(self)\n", + " print \"No-argument constructor of the derived class D\"\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of the base class B1\n", + "No-argument constructor of the base class B2\n", + "No-argument constructor of the derived class D\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons9.cpp, Page no-563" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B1:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B1\"\n", + "class B2:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B2\"\n", + "class D(B1, B2):\n", + " def __init__(self):\n", + " B1()\n", + " B2()\n", + " print \"No-argument constructor of the derived class D\"\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of the base class B1\n", + "No-argument constructor of the base class B2\n", + "No-argument constructor of the derived class D\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons10.cpp, Page no-563" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B1:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B1\"\n", + "class B2:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B2\"\n", + "class D(B1, B2):\n", + " def __init__(self):\n", + " B2()\n", + " B1()\n", + " print \"No-argument constructor of the derived class D\"\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of the base class B2\n", + "No-argument constructor of the base class B1\n", + "No-argument constructor of the derived class D\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons11.cpp, Page no-564" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " def __init__(self):\n", + " print \"No-argument constructor of a base class B\"\n", + "class D1(B):\n", + " def __init__(self):\n", + " B.__init__(self)\n", + " print \"No-argument constructor of a base class D1\"\n", + "class D2(D1):\n", + " def __init__(self):\n", + " D1.__init__(self)\n", + " print \"No-argument constructor of a derived class D2\"\n", + "objd=D2()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of a base class B\n", + "No-argument constructor of a base class D1\n", + "No-argument constructor of a derived class D2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons12.cpp, Page no-566" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B1:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B1\"\n", + " def __del__(self):\n", + " print \"Desctructor in the base class B1\"\n", + "class B2:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B2\"\n", + " def __del__(self):\n", + " print \"Desctructor in the base class B2\"\n", + "class D(B1, B2):\n", + " def __init__(self):\n", + " B1.__init__(self)\n", + " B2.__init__(self)\n", + " print \"No-argument constructor of the derived class D\"\n", + " def __del__(self):\n", + " print \"Desctructor in the derived class D\"\n", + " for b in self.__class__.__bases__:\n", + " b.__del__(self)\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of the base class B1\n", + "No-argument constructor of the base class B2\n", + "No-argument constructor of the derived class D\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons13.cpp, Page no-568" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " __x=int\n", + " __y=int\n", + " def __init__(self, a, b):\n", + " self.__x=a\n", + " self.__y=b\n", + "class D(B):\n", + " __a=int\n", + " __b=int\n", + " def __init__(self, p, q, r):\n", + " self.__a=p\n", + " B.__init__(self, p, q)\n", + " self.__b=r\n", + " def output(self):\n", + " print \"x =\", self._B__x\n", + " print \"y =\", self._B__y\n", + " print \"a =\", self.__a\n", + " print \"b =\", self.__b\n", + "objd=D(5, 10, 15)\n", + "objd.output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 5\n", + "y = 10\n", + "a = 5\n", + "b = 15\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-runtime.cpp, Page no-570" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " __x=int\n", + " __y=int(0) #initialization\n", + " def __init__(self, a, b):\n", + " self.__x=self.__y+b\n", + " self.__y=a\n", + " def Print(self):\n", + " print \"x =\", self.__x\n", + " print \"y =\", self.__y\n", + "b = B(2, 3)\n", + "b.Print()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 3\n", + "y = 2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons14.cpp, Page no-570" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " __x=int\n", + " __y=int\n", + " def read(self):\n", + " self.__x=int(raw_input(\"X in class B ? \"))\n", + " self.__y=int(raw_input(\"Y in class B ? \"))\n", + " def show(self):\n", + " print \"X in class B =\", self.__x\n", + " print \"Y in class B =\", self.__y\n", + "class D(B):\n", + " __y=int\n", + " __z=int\n", + " def read(self):\n", + " B.read(self)\n", + " self.__y=int(raw_input(\"Y in class D ? \"))\n", + " self.__z=int(raw_input(\"Z in class D ? \"))\n", + " def show(self):\n", + " B.show(self)\n", + " print \"Y in class D =\", self.__y\n", + " print \"Z in class D =\", self.__z\n", + " print \"Y of B, show from D =\", self._B__y\n", + "objd=D()\n", + "print \"Enter data for object of class D..\"\n", + "objd.read()\n", + "print \"Contents of object of class D..\"\n", + "objd.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for object of class D..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "X in class B ? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Y in class B ? 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Y in class D ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Z in class D ? 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Contents of object of class D..\n", + "X in class B = 1\n", + "Y in class B = 2\n", + "Y in class D = 3\n", + "Z in class D = 4\n", + "Y of B, show from D = 2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-stack.cpp, Page no-573" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_ELEMENTS=5\n", + "class Stack:\n", + " __stack=[int]*(MAX_ELEMENTS+1)\n", + " __StackTop=int\n", + " def __init__(self):\n", + " self.__StackTop=0\n", + " def push(self, element):\n", + " self.__StackTop+=1\n", + " self.__stack[self.__StackTop]=element\n", + " def pop(self, element):\n", + " element=self.__stack[self.__StackTop]\n", + " self.__StackTop-=1\n", + " return element\n", + "class MyStack(Stack):\n", + " def push(self, element):\n", + " if self._Stack__StackTop0:\n", + " element=Stack.pop(self, element)\n", + " return element\n", + " print \"Stack Underflow\"\n", + " return 0\n", + "stack=MyStack()\n", + "print \"Enter Integer data to put into the stack...\"\n", + "while(1):\n", + " element=int(raw_input(\"Element to Push ? \"))\n", + " if stack.push(element)==0:\n", + " break\n", + "print \"The Stack Contains...\"\n", + "element=stack.pop(element)\n", + "while element:\n", + " print \"pop:\", element\n", + " element=stack.pop(element)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Integer data to put into the stack...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element to Push ? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element to Push ? 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element to Push ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element to Push ? 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element to Push ? 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element to Push ? 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Stack Overflow\n", + "The Stack Contains...\n", + "pop: 5\n", + "pop: 4\n", + "pop: 3\n", + "pop: 2\n", + "pop: 1\n", + "Stack Underflow\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-exam.cpp, Page no-577" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_LEN=25\n", + "class person:\n", + " __name=[chr]*MAX_LEN\n", + " __sex=chr\n", + " __age=int\n", + " def ReadData(self):\n", + " self.__name=raw_input(\"Name ? \")\n", + " self.__sex=str(raw_input(\"Sex ? \"))\n", + " self.__age=int(raw_input(\"Age ? \"))\n", + " def DisplayData(self):\n", + " print \"Name:\", self.__name\n", + " print \"Sex: \", self.__sex\n", + " print \"Age: \", self.__age\n", + "class student(person):\n", + " __RollNo=int\n", + " __branch=[chr]*20\n", + " def ReadData(self):\n", + " person.ReadData(self) #invoking member function ReadData of base class person\n", + " self.__RollNo=int(raw_input(\"Roll Number ? \"))\n", + " self.__branch=raw_input(\"Branch Studying ? \")\n", + " def DisplayData(self):\n", + " person.DisplayData(self) #invoking member function DisplayData of base class person\n", + " print \"Roll Number:\", self.__RollNo\n", + " print \"Branch:\", self.__branch\n", + "class exam(student):\n", + " __Sub1Marks=int\n", + " __Sub2Marks=int\n", + " def ReadData(self):\n", + " student.ReadData(self) #invoking member function ReadData of base class student\n", + " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", + " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", + " def DisplayData(self):\n", + " student.DisplayData(self) #invoking member function DisplayData of base class student\n", + " print \"Marks scored in Subject 1:\", self.__Sub1Marks\n", + " print \"Marks scored in Subject 2:\", self.__Sub2Marks\n", + " print \"Total Marks Scored:\", self.TotalMarks()\n", + " def TotalMarks(self):\n", + " return self.__Sub1Marks+self.__Sub2Marks\n", + "annual=exam()\n", + "print \"Enter data for Student...\"\n", + "annual.ReadData()\n", + "print \"Student Details...\"\n", + "annual.DisplayData()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for Student...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sex ? M\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age ? 24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch Studying ? Computer-Technology\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 1 < Max:100> ? 92\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 2 < Max:100> ? 88\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Details...\n", + "Name: Rajkumar\n", + "Sex: M\n", + "Age: 24\n", + "Roll Number: 9\n", + "Branch: Computer-Technology\n", + "Marks scored in Subject 1: 92\n", + "Marks scored in Subject 2: 88\n", + "Total Marks Scored: 180\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mul_inh1.cpp, Page no-580" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "class A:\n", + " def __init__(self):\n", + " sys.stdout.write('a'),\n", + "class B:\n", + " def __init__(self):\n", + " sys.stdout.write('b'),\n", + "class C(A, B):\n", + " def __init__(self):\n", + " A.__init__(self)\n", + " B.__init__(self)\n", + " sys.stdout.write('c'),\n", + "objc=C()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "abc" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mul_inh2.cpp, Page no-581" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class A:\n", + " def __init__(self, c):\n", + " sys.stdout.write(c),\n", + "class B:\n", + " def __init__(self, b):\n", + " sys.stdout.write(b),\n", + "class C(A, B):\n", + " def __init__(self, c1, c2, c3):\n", + " A.__init__(self, c1)\n", + " B.__init__(self, c2)\n", + " sys.stdout.write(c3),\n", + "objc=C('a', 'b', 'c')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "abc" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mul_inh4.cpp, Page no-583" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "class A:\n", + " __ch=chr\n", + " def __init__(self, c):\n", + " self.__ch=c\n", + " def show(self):\n", + " sys.stdout.write(self.__ch),\n", + "class B:\n", + " __ch=chr\n", + " def __init__(self, b):\n", + " self.__ch=b\n", + " def show(self):\n", + " sys.stdout.write(self.__ch),\n", + "class C(A, B):\n", + " __ch=chr\n", + " def __init__(self, c1, c2, c3):\n", + " A.__init__(self, c1)\n", + " B.__init__(self, c2)\n", + " self.__ch=c3\n", + "objc=C('a', 'b', 'c')\n", + "print \"objc.A::show() = \",\n", + "A.show(objc)\n", + "print \"\\nobjc.B::show() = \",\n", + "B.show(objc)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "objc.A::show() = a \n", + "objc.B::show() = b\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mul_inh5.cpp, Page no-584" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "class A:\n", + " __ch=chr\n", + " def __init__(self, c):\n", + " self.__ch=c\n", + " def show(self):\n", + " sys.stdout.write(self.__ch),\n", + "class B:\n", + " __ch=chr\n", + " def __init__(self, b):\n", + " self.__ch=b\n", + " def show(self):\n", + " sys.stdout.write(self.__ch),\n", + "class C(A, B):\n", + " __ch=chr\n", + " def __init__(self, c1, c2, c3):\n", + " A.__init__(self, c1)\n", + " B.__init__(self, c2)\n", + " self.__ch=c3\n", + " def show(self):\n", + " A.show(self)\n", + " B.show(self)\n", + " sys.stdout.write(self.__ch),\n", + "objc=C('a', 'b', 'c')\n", + "print \"objc.show() = \",\n", + "objc.show()\n", + "print \"\\nobjc.C::show() = \",\n", + "C.show(objc)\n", + "print \"\\nobjc.A::show() = \",\n", + "A.show(objc)\n", + "print \"\\nobjc.B::show() = \",\n", + "B.show(objc)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "objc.show() = abc \n", + "objc.C::show() = abc \n", + "objc.A::show() = a \n", + "objc.B::show() = b\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-publish1.cpp, Page no-586" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class publication:\n", + " __title=[chr]*40\n", + " __price=float\n", + " def getdata(self):\n", + " self.__title=raw_input(\"\\tEnter Title: \")\n", + " self.__price=float(raw_input(\"\\tEnter Price: \"))\n", + " def display(self):\n", + " print \"\\tTitle =\", self.__title\n", + " print \"\\tPrice = %g\" %(self.__price)\n", + "class sales:\n", + " __PublishSales=[]\n", + " def __init__(self):\n", + " self.__PublishSales=[float]*3\n", + " def getdata(self):\n", + " for i in range(3):\n", + " print \"\\tEnter Sales of\", i+1, \"Month: \",\n", + " self.__PublishSales[i]=float(raw_input())\n", + " def display(self):\n", + " TotalSales=0\n", + " for i in range(3):\n", + " print \"\\tSales of\", i+1, \"Month = %g\" %(self.__PublishSales[i])\n", + " TotalSales+=self.__PublishSales[i]\n", + " print \"\\tTotalSales = %g\" %(TotalSales)\n", + "class book(publication, sales):\n", + " __pages=int\n", + " def getdata(self):\n", + " publication.getdata(self)\n", + " self.__pages=int(raw_input(\"\\tEnter Number of Pages: \"))\n", + " sales.getdata(self)\n", + " def display(self):\n", + " publication.display(self)\n", + " print \"\\tNumber of Pages = %g\" %(self.__pages)\n", + " sales.display(self)\n", + "class tape(publication, sales):\n", + " __PlayTime=int\n", + " def getdata(self):\n", + " publication.getdata(self)\n", + " self.__PlayTime=int(raw_input(\"\\tEnter Playing Time in Minute: \"))\n", + " sales.getdata(self)\n", + " def display(self):\n", + " publication.display(self)\n", + " print \"\\tPlaying Time in Minute = %g\" %(self.__PlayTime)\n", + " sales.display(self)\n", + "class pamphlet(publication):\n", + " pass\n", + "class notice(pamphlet):\n", + " __whom=[chr]*20\n", + " def getdata(self):\n", + " pamphlet.getdata(self)\n", + " self.__whom=raw_input(\"\\tEnter Type of Distributor: \")\n", + " def display(self):\n", + " pamphlet.display(self)\n", + " print \"\\tType of Distributor =\", self.__whom\n", + "book1=book()\n", + "tape1=tape()\n", + "pamp1=pamphlet()\n", + "notice1=notice()\n", + "print \"Enter Book Publication Data...\"\n", + "book1.getdata()\n", + "print \"Enter Tape Publication Data...\"\n", + "tape1.getdata()\n", + "print \"Enter Pamhlet Publication Data...\"\n", + "pamp1.getdata()\n", + "print \"Enter Notice Publication Data...\"\n", + "notice1.getdata()\n", + "print \"Book Publication Data...\"\n", + "book1.display()\n", + "print \"Tape Publication Data...\"\n", + "tape1.display()\n", + "print \"Pamphlet Publication Data...\"\n", + "pamp1.display()\n", + "print \"Notice Publication Data...\"\n", + "notice1.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Book Publication Data...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Title: Microprocessor-x86-Programming\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Price: 180\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Number of Pages: 750\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Sales of 1 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \tEnter Sales of 2 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "500\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \tEnter Sales of 3 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "800\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Tape Publication Data...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Title: Love-1947\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Price: 100\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Playing Time in Minute: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Sales of 1 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "200\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \tEnter Sales of 2 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "500\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \tEnter Sales of 3 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "400\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Pamhlet Publication Data...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Title: Advanced-Computing-95-Conference\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Price: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Notice Publication Data...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Title: General-Meeting\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Price: 100\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Type of Distributor: Retail\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Book Publication Data...\n", + "\tTitle = Microprocessor-x86-Programming\n", + "\tPrice = 180\n", + "\tNumber of Pages = 750\n", + "\tSales of 1 Month = 1000\n", + "\tSales of 2 Month = 500\n", + "\tSales of 3 Month = 800\n", + "\tTotalSales = 2300\n", + "Tape Publication Data...\n", + "\tTitle = Love-1947\n", + "\tPrice = 100\n", + "\tPlaying Time in Minute = 10\n", + "\tSales of 1 Month = 200\n", + "\tSales of 2 Month = 500\n", + "\tSales of 3 Month = 400\n", + "\tTotalSales = 1100\n", + "Pamphlet Publication Data...\n", + "\tTitle = Advanced-Computing-95-Conference\n", + "\tPrice = 10\n", + "Notice Publication Data...\n", + "\tTitle = General-Meeting\n", + "\tPrice = 100\n", + "\tType of Distributor = Retail\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vehicle.cpp, Page no-591" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_LEN=25\n", + "class Vehicle:\n", + " __name=[chr]*MAX_LEN\n", + " __WheelsCount=int\n", + " def GetData(self):\n", + " self.__name=raw_input(\"Name of the Vehicle ? \")\n", + " self.__WheelsCount=int(raw_input(\"Wheels ? \"))\n", + " def DisplayData(self):\n", + " print \"Name of the Vehicle :\", self.__name \n", + " print \"Wheels :\", self.__WheelsCount\n", + "class LightMotor(Vehicle):\n", + " __SpeedLimit=int\n", + " def GetData(self):\n", + " Vehicle.GetData(self)\n", + " self.__SpeedLimit=int(raw_input(\"Speed Limit ? \"))\n", + " def DisplayData(self):\n", + " Vehicle.DisplayData(self)\n", + " print \"Speed Limit :\", self.__SpeedLimit\n", + "class HeavyMotor(Vehicle):\n", + " __permit=[chr]*MAX_LEN\n", + " __LoadCapacity=int\n", + " def GetData(self):\n", + " Vehicle.GetData(self)\n", + " self.__LoadCapacity=int(raw_input(\"Load Carrying Capacity ? \"))\n", + " self.__permit=raw_input(\"Permit Type ? \")\n", + " def DisplayData(self):\n", + " Vehicle.DisplayData(self)\n", + " print \"Load Carrying Capacity : \", self.__LoadCapacity \n", + " print \"Permit:\", self.__permit\n", + "class GearMotor(LightMotor):\n", + " __GearCount=int\n", + " def GetData(self):\n", + " LightMotor.GetData(self)\n", + " self.__GearCount=int(raw_input(\"No. of Gears ? \"))\n", + " def DisplayData(self):\n", + " LightMotor.DisplayData(self)\n", + " print \"Gears :\", self.__GearCount\n", + "class NonGearMotor(LightMotor):\n", + " def GetData(self):\n", + " LightMotor.Getdata(self)\n", + " def DisplayData(self):\n", + " LightMotor.DisplayData(self)\n", + "class Passenger(HeavyMotor):\n", + " __sitting=int\n", + " __standing=int\n", + " def GetData(self):\n", + " HeavyMotor.GetData(self)\n", + " self.__sitting=int(raw_input(\"Maximum Seats ? \"))\n", + " self.__standing=int(raw_input(\"Maximum Standing ? \"))\n", + " def DisplayData(self):\n", + " HeavyMotor.DisplayData(self)\n", + " print \"Maximum Seats:\", self.__sitting\n", + " print \"Maximum Standing:\", self.__standing\n", + "class Goods(HeavyMotor):\n", + " def GetData(self):\n", + " HeavyMotor.Getdata(self)\n", + " def DisplayData(self):\n", + " HeavyMotor.DisplayData(self)\n", + "vehi1=GearMotor()\n", + "vehi2=Passenger()\n", + "print \"Enter Data for Gear Motor Vehicle...\"\n", + "vehi1.GetData()\n", + "print \"Enter Data for Passenger Motor Vehicle...\"\n", + "vehi2.GetData()\n", + "print \"Data of Gear Motor Vehicle...\"\n", + "vehi1.DisplayData()\n", + "print \"Data of Passenger Motor Vehicle...\"\n", + "vehi2.DisplayData()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Data for Gear Motor Vehicle...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name of the Vehicle ? Maruti-Car\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wheels ? 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed Limit ? 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "No. of Gears ? 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Data for Passenger Motor Vehicle...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name of the Vehicle ? KSRTC-BUS\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wheels ? 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Load Carrying Capacity ? 60\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Permit Type ? National\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum Seats ? 45\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum Standing ? 60\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Data of Gear Motor Vehicle...\n", + "Name of the Vehicle : Maruti-Car\n", + "Wheels : 4\n", + "Speed Limit : 4\n", + "Gears : 5\n", + "Data of Passenger Motor Vehicle...\n", + "Name of the Vehicle : KSRTC-BUS\n", + "Wheels : 4\n", + "Load Carrying Capacity : 60\n", + "Permit: National\n", + "Maximum Seats: 45\n", + "Maximum Standing: 60\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-int_ext.cpp, Page no-595" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_LEN=25\n", + "class student():\n", + " __RollNo=int\n", + " __branch=[chr]*20\n", + " def ReadStudentData(self):\n", + " self.__RollNo=int(raw_input(\"Roll Number ? \"))\n", + " self.__branch=raw_input(\"Branch Studying ? \")\n", + " def DisplayStudentData(self):\n", + " print \"Roll Number:\", self.__RollNo\n", + " print \"Branch:\", self.__branch\n", + "class InternalExam(student):\n", + " __Sub1Marks=int\n", + " __Sub2Marks=int\n", + " def ReadData(self):\n", + " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", + " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", + " def DisplayData(self):\n", + " print \"Internal Marks scored in Subject 1:\", self.__Sub1Marks\n", + " print \"Internal Marks scored in Subject 2:\", self.__Sub2Marks\n", + " print \"Internal Total Marks Scored:\", self.TotalMarks()\n", + " def InternalTotalMarks(self):\n", + " return self.__Sub1Marks+self.__Sub2Marks\n", + "class ExternalExam(student):\n", + " __Sub1Marks=int\n", + " __Sub2Marks=int\n", + " def ReadData(self):\n", + " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", + " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", + " def DisplayData(self):\n", + " print \"External Marks scored in Subject 1:\", self.__Sub1Marks\n", + " print \"External Marks scored in Subject 2:\", self.__Sub2Marks\n", + " print \"External Total Marks Scored:\", self.ExternalTotalMarks()\n", + " def ExternalTotalMarks(self):\n", + " return self.__Sub1Marks+self.__Sub2Marks\n", + "class result(InternalExam, ExternalExam):\n", + " __total=int\n", + " def TotalMarks(self):\n", + " return InternalExam.InternalTotalMarks(self)+ExternalExam.ExternalTotalMarks(self)\n", + "student1=result()\n", + "print \"Enter data for Student1...\"\n", + "student1.ReadStudentData()\n", + "print \"Enter internal marks...\"\n", + "InternalExam.ReadData(student1)\n", + "print \"Enter external marks...\"\n", + "ExternalExam.ReadData(student1)\n", + "print \"Student Details...\"\n", + "student1.DisplayStudentData()\n", + "InternalExam.DisplayData(student1)\n", + "ExternalExam.DisplayData(student1)\n", + "print \"Total Marks =\", student1.TotalMarks()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for Student1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch Studying ? Computer-Technology\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter internal marks...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 1 < Max:100> ? 80\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 2 < Max:100> ? 85\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter external marks...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 1 < Max:100> ? 89\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 2 < Max:100> ? 90\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Details...\n", + "Roll Number: 9\n", + "Branch: Computer-Technology\n", + "Internal Marks scored in Subject 1: 80\n", + "Internal Marks scored in Subject 2: 85\n", + "Internal Total Marks Scored: 344\n", + "External Marks scored in Subject 1: 89\n", + "External Marks scored in Subject 2: 90\n", + "External Total Marks Scored: 179\n", + "Total Marks = 344\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vir.cpp, Page no-598" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class A:\n", + " __x=int\n", + " def __init__(self, i=None):\n", + " if isinstance(i, int):\n", + " self.__x=i\n", + " else:\n", + " self.__x=-1\n", + " def geta(self):\n", + " return self.__x\n", + "class B(A):\n", + " __y=int\n", + " def __init__(self, i, k):\n", + " A.__init__(self, i)\n", + " self.__y=k\n", + " def getb(self):\n", + " return self.__y\n", + " def show(self):\n", + " print self._A__x, self.geta(), self.getb()\n", + "class C(A):\n", + " __z=int\n", + " def __init__(self, i, k):\n", + " A.__init__(self, i)\n", + " self.__z=k\n", + " def getc(self):\n", + " return self.__z\n", + " def show(self):\n", + " print self._A__x, self.geta(), self.getc()\n", + "class D(B,C):\n", + " def __init__(self, i, j):\n", + " B.__init__(self, i, j)\n", + " C.__init__(self, i, j)\n", + " def show(self):\n", + " print self._A__x, self.geta(), self.getb(), self.getc(), self.getc()\n", + "d1=D(3, 5)\n", + "print \"Object d1 contents:\",\n", + "d1.show() #unlike C++, python executes the 1 argument constuctor of A() instead of implicit call to the no argument constructor of A()\n", + "b1=B(7, 9)\n", + "print \"Object b1 contents:\",\n", + "b1.show()\n", + "c1=C(11, 13)\n", + "print \"Object c1 contents:\",\n", + "c1.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Object d1 contents: 3 3 5 5 5\n", + "Object b1 contents: 7 7 9\n", + "Object c1 contents: 11 11 13\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sports.cpp, Page no-601" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_LEN=25\n", + "class person:\n", + " __name=[chr]*MAX_LEN\n", + " __sex=chr\n", + " __age=int\n", + " def ReadPerson(self):\n", + " self.__name=raw_input(\"Name ? \")\n", + " self.__sex=str(raw_input(\"Sex ? \"))\n", + " self.__age=int(raw_input(\"Age ? \"))\n", + " def DisplayPerson(self):\n", + " print \"Name:\", self.__name\n", + " print \"Sex: \", self.__sex\n", + " print \"Age: \", self.__age\n", + "class sports(person):\n", + " __name=[chr]*MAX_LEN\n", + " __score=int\n", + " def ReadData(self):\n", + " self.__name=raw_input(\"Game Played ? \")\n", + " self.__score=int(raw_input(\"Game Score ? \"))\n", + " def DisplayData(self):\n", + " print \"Sports Played:\", self.__name\n", + " print \"Game Score: \", self.__score\n", + " def SportsScore(self):\n", + " return self.__score\n", + "class student(person):\n", + " __RollNo=int\n", + " __branch=[chr]*20\n", + " def ReadData(self):\n", + " self.__RollNo=int(raw_input(\"Roll Number ? \"))\n", + " self.__branch=raw_input(\"Branch Studying ? \")\n", + " def DisplayData(self):\n", + " print \"Roll Number:\", self.__RollNo\n", + " print \"Branch:\", self.__branch\n", + "class exam(student):\n", + " __Sub1Marks=int\n", + " __Sub2Marks=int\n", + " def ReadData(self):\n", + " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", + " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", + " def DisplayData(self):\n", + " print \"Marks scored in Subject 1:\", self.__Sub1Marks\n", + " print \"Marks scored in Subject 2:\", self.__Sub2Marks\n", + " print \"Total Marks Scored:\", self.TotalMarks()\n", + " def TotalMarks(self):\n", + " return self.__Sub1Marks+self.__Sub2Marks\n", + "class result(exam, sports):\n", + " __total=int\n", + " def ReadData(self):\n", + " self.ReadPerson()\n", + " student.ReadData(self)\n", + " exam.ReadData(self)\n", + " sports.ReadData(self)\n", + " def DisplayData(self):\n", + " self.DisplayPerson()\n", + " student.DisplayData(self)\n", + " exam.DisplayData(self)\n", + " sports.DisplayData(self)\n", + " print \"Overall Performance, (exam + sports) :\",self.Percentage(), \"%\"\n", + " def Percentage(self):\n", + " return (exam.TotalMarks(self)+self.SportsScore())/3\n", + "Student=result()\n", + "print \"Enter data for Student...\"\n", + "Student.ReadData()\n", + "print \"Student Details...\"\n", + "Student.DisplayData()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for Student...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sex ? M\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age ? 24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch Studying ? Computer-Technology\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 1 < Max:100> ? 92\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 2 < Max:100> ? 88\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Game Played ? Cricket\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Game Score ? 85\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Details...\n", + "Name: Rajkumar\n", + "Sex: M\n", + "Age: 24\n", + "Roll Number: 9\n", + "Branch: Computer-Technology\n", + "Marks scored in Subject 1: 92\n", + "Marks scored in Subject 2: 88\n", + "Total Marks Scored: 180\n", + "Sports Played: Cricket\n", + "Game Score: 85\n", + "Overall Performance, (exam + sports) : 88 %\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-nesting.cpp, Page no-605" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " num=int\n", + " def __init__(self, a=None):\n", + " if isinstance(a, int):\n", + " print \"Constructor B( int a ) is invoked\"\n", + " self.num=a\n", + " else:\n", + " self.num=0\n", + "class D:\n", + " data1=int\n", + " objb=B()\n", + " def __init__(self, a):\n", + " self.objb.__init__(a)\n", + " self.data1=a\n", + " def output(self):\n", + " print \"Data in Object of Class S =\", self.data1\n", + " print \"Data in Member object of class B in class D = \",self.objb.num\n", + "objd = D(10)\n", + "objd.output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor B( int a ) is invoked\n", + "Data in Object of Class S = 10\n", + "Data in Member object of class B in class D = 10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-publish2.cpp, Page no-608" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class publication:\n", + " __title=[chr]*40\n", + " __price=float\n", + " def getdata(self):\n", + " self.__title=raw_input(\"\\tEnter Title: \")\n", + " self.__price=float(raw_input(\"\\tEnter Price: \"))\n", + " def display(self):\n", + " print \"\\tTitle =\", self.__title\n", + " print \"\\tPrice = %g\" %(self.__price)\n", + "class sales:\n", + " __PublishSales=[]\n", + " def __init__(self):\n", + " self.__PublishSales=[float]*3\n", + " def getdata(self):\n", + " for i in range(3):\n", + " print \"\\tEnter Sales of\", i+1, \"Month: \",\n", + " self.__PublishSales[i]=float(raw_input())\n", + " def display(self):\n", + " TotalSales=0\n", + " for i in range(3):\n", + " print \"\\tSales of\", i+1, \"Month = %g\" %(self.__PublishSales[i])\n", + " TotalSales+=self.__PublishSales[i]\n", + " print \"\\tTotalSales = %g\" %(TotalSales)\n", + "class book:\n", + " __pages=int\n", + " pub=publication()\n", + " market=sales()\n", + " def getdata(self):\n", + " self.pub.getdata()\n", + " self.__pages=int(raw_input(\"\\tEnter Number of Pages: \"))\n", + " self.market.getdata()\n", + " def display(self):\n", + " self.pub.display()\n", + " print \"\\tNumber of Pages = %g\" %(self.__pages)\n", + " self.market.display()\n", + "book1=book()\n", + "print \"Enter Book Publication Data...\"\n", + "book1.getdata()\n", + "print \"Book Publication Data...\"\n", + "book1.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Book Publication Data...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Title: Microprocessor-x86-Programming\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Price: 180\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Number of Pages: 750\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Sales of 1 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \tEnter Sales of 2 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "500\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \tEnter Sales of 3 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "800\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Book Publication Data...\n", + "\tTitle = Microprocessor-x86-Programming\n", + "\tPrice = 180\n", + "\tNumber of Pages = 750\n", + "\tSales of 1 Month = 1000\n", + "\tSales of 2 Month = 500\n", + "\tSales of 3 Month = 800\n", + "\tTotalSales = 2300\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-611" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class employee:\n", + " emp_id=int\n", + " emp_name=[chr]*30\n", + " def getdata(self):\n", + " self.__emp_id=int(raw_input(\"Enter employee number: \"))\n", + " self.__emp_name=raw_input(\"Enter emploee name: \")\n", + " def displaydata(self):\n", + " print \"Employee Number:\", self.__emp_id, \"\\nEmployee Name:\", self.__emp_name\n", + "class emp_union:\n", + " __member_id=int\n", + " def getdata(self):\n", + " self.__member_id=int(raw_input(\"Enter member id: \"))\n", + " def displaydata(self):\n", + " print \"Member ID:\", self.__member_id\n", + "class emp_info(employee, emp_union):\n", + " __basic_salary=float\n", + " def getdata(self):\n", + " employee.getdata(self)\n", + " emp_union.getdata(self)\n", + " self.__basic_salary=int(raw_input(\"Enter basic salary: \"))\n", + " def displaydata(self):\n", + " employee.displaydata(self)\n", + " emp_union.displaydata(self)\n", + " print \"Basic Salary:\", self.__basic_salary\n", + "e1=emp_info()\n", + "e1.getdata()\n", + "e1.displaydata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter employee number: 23\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter emploee name: Krishnan\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter member id: 443\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter basic salary: 8500\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Employee Number: 23 \n", + "Employee Name: Krishnan\n", + "Member ID: 443\n", + "Basic Salary: 8500\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-2, Page no-613" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class details:\n", + " __name=[chr]*30\n", + " __address=[chr]*50\n", + " def getdata(self):\n", + " self.__name=raw_input(\"Name: \")\n", + " self.__address=raw_input(\"Address: \")\n", + " def displaydata(self):\n", + " print \"Name:\", self.__name,\"\\nAddress:\", self.__address\n", + "class student(details):\n", + " __marks=float\n", + " def getdata(self):\n", + " details.getdata(self)\n", + " self.__marks=float(raw_input(\"Percentage Marks: \"))\n", + " def displaydata(self):\n", + " details.displaydata(self)\n", + " print \"Percentage Marks: %g\" %(self.__marks)\n", + "class staff(details):\n", + " __salary=float\n", + " def getdata(self):\n", + " details.getdata(self)\n", + " self.__salary=float(raw_input(\"Salary: \"))\n", + " def displaydata(self):\n", + " details.displaydata(self)\n", + " print \"Salary: %g\" %(self.__salary)\n", + "student1=student()\n", + "staff1=staff()\n", + "print \"Enter student data:\"\n", + "student1.getdata()\n", + "print \"Enter staff data:\"\n", + "staff1.getdata()\n", + "print \"Displaying student and staff data:\"\n", + "student1.displaydata()\n", + "staff1.displaydata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter student data:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Venkatesh\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address: H.No. 89, AGM Society, Bangalore\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Percentage Marks: 78.4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter staff data:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Vijayan\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address: H.No. A-2, SLR Society, Bangalore\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Salary: 25000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Displaying student and staff data:\n", + "Name: Venkatesh \n", + "Address: H.No. 89, AGM Society, Bangalore\n", + "Percentage Marks: 78.4\n", + "Name: Vijayan \n", + "Address: H.No. A-2, SLR Society, Bangalore\n", + "Salary: 25000\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance_1.ipynb new file mode 100755 index 00000000..a617fa5c --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance_1.ipynb @@ -0,0 +1,2736 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:63736c9aef28a6babc99661e161907400b7b80441a3f765e7ab8b6e00648ce25" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14- Inheritance" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-bag.cpp, Page-544" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "(false, true)=(0, 1) #enum type\n", + "type =['false', 'true']\n", + "MAX_ITEMS=25\n", + "def IsExist(self, item):\n", + " for i in range(self._Bag__ItemCount):\n", + " if self._Bag__contents[i]==item:\n", + " return true\n", + " return false\n", + "def show(self):\n", + " for i in range(self._Bag__ItemCount):\n", + " print self._Bag__contents[i],\n", + " print \"\"\n", + "class Bag:\n", + " __contents=[int]*MAX_ITEMS #protected members\n", + " __ItemCount=int\n", + " def __init__(self):\n", + " self.__ItemCount=0\n", + " def put(self, item):\n", + " self.__contents[self.__ItemCount]=item\n", + " self.__ItemCount+=1\n", + " def IsEmpty(self):\n", + " return true if self.__ItemCount==0 else false\n", + " def IsFull(self):\n", + " return true if self.__ItemCount==MAX_ITEMS else false\n", + " IsExist=IsExist\n", + " show=show\n", + "bag=Bag()\n", + "item=int\n", + "while(true):\n", + " item=int(raw_input(\"Enter Item Number to be put into the bag <0-no item>: \"))\n", + " if item==0:\n", + " break\n", + " bag.put(item)\n", + " print \"Items in Bag:\",\n", + " bag.show()\n", + " if bag.IsFull():\n", + " print \"Bag Full, no more items can be placed\"\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in Bag: 1 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Number to be put into the bag <0-no item>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in Bag: 1 2 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in Bag: 1 2 3 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in Bag: 1 2 3 3 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in Bag: 1 2 3 3 1 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Number to be put into the bag <0-no item>: 0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-union.cpp, Page no-548" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "(false, true)=(0, 1) #enum type\n", + "type =['false', 'true']\n", + "MAX_ITEMS=25\n", + "def IsExist(self, item):\n", + " for i in range(self._Bag__ItemCount):\n", + " if self._Bag__contents[i]==item:\n", + " return true\n", + " return false\n", + "def show(self):\n", + " for i in range(self._Bag__ItemCount):\n", + " print self._Bag__contents[i],\n", + " print \"\"\n", + "class Bag:\n", + " #protected members\n", + " __ItemCount=int\n", + " def __init__(self):\n", + " self.__ItemCount=0\n", + " self.__contents=[int]*MAX_ITEMS\n", + " def put(self, item):\n", + " self.__contents[self.__ItemCount]=item\n", + " self.__ItemCount+=1\n", + " def IsEmpty(self):\n", + " return true if self.__ItemCount==0 else false\n", + " def IsFull(self):\n", + " return true if self.__ItemCount==MAX_ITEMS else false\n", + " IsExist=IsExist\n", + " show=show\n", + "def read(self):\n", + " while(true):\n", + " element=int(raw_input(\"Enter Set Element <0-end>: \"))\n", + " if element==0:\n", + " break\n", + " self.Add(element)\n", + "def add(s1, s2):\n", + " temp = Set()\n", + " temp=s1\n", + " for i in range(s2._Bag__ItemCount):\n", + " if s1.IsExist(s2._Bag__contents[i])==false:\n", + " temp.Add(s2._Bag__contents[i])\n", + " return temp\n", + "class Set(Bag):\n", + " def Add(self,element):\n", + " if(self.IsExist(element)==false and self.IsFull()==false):\n", + " self.put(element)\n", + " read=read\n", + " def __assign__(self, s2):\n", + " for i in range(s2._Bag__ItemCount):\n", + " self.__contents[i]=s2.__contents[i]\n", + " self.__ItemCount=s2.__ItemCount\n", + " def __add__(self, s2):\n", + " return add(self, s2)\n", + "s1=Set()\n", + "s2=Set()\n", + "s3=Set()\n", + "print \"Enter Set 1 elements..\"\n", + "s1.read()\n", + "print \"Enter Set 2 elemets..\"\n", + "s2.read()\n", + "s3=s1+s2\n", + "print \"Union of s1 and s2 :\",\n", + "s3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set 1 elements..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set 2 elemets..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Union of s1 and s2 : 1 2 3 4 5 6 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons1.cpp, Page no-558" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " pass\n", + "class D(B):\n", + " def msg(self):\n", + " print \"No constructors exist in base and derived class\"\n", + "objd=D()\n", + "objd.msg()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No constructors exist in base and derived class\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons2.cpp, Page no-558" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " def __init__(self):\n", + " print \"No-argument constructor of base class B is executed\"\n", + "class D(B):\n", + " pass\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of base class B is executed\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons3.cpp, Page no-559" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " pass\n", + "class D(B):\n", + " def __init__(self):\n", + " print \"Constructors exist only in derived class\"\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructors exist only in derived class\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons4.cpp, Page no-559" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " def __init__(self):\n", + " print \"No-argument constructor of base class B executed first\"\n", + "class D(B):\n", + " def __init__(self):\n", + " B.__init__(self)\n", + " print \"No-argument constructor of derived class D executed next\"\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of base class B executed first\n", + "No-argument constructor of derived class D executed next\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons5.cpp, Page no-560" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " def __init__(self, a=0):\n", + " if isinstance(a, int):\n", + " print \"One-argument constructor of the base class B\"\n", + " else:\n", + " print \"No-argument constructor of the base class B\"\n", + "class D(B):\n", + " def __init__(self, a):\n", + " B.__init__(self, a)\n", + " print \"One-argument constructor of the derived class D\"\n", + "objd=D(3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "One-argument constructor of the base class B\n", + "One-argument constructor of the derived class D\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons7.cpp, Page no-561" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " def __init__(self, a):\n", + " print \"One-argument constructor of the base class B\"\n", + "class D(B):\n", + " def __init__(self, a):\n", + " B(a)\n", + " print \"One-argument constructor of the derived class D\"\n", + "objd=D(3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "One-argument constructor of the base class B\n", + "One-argument constructor of the derived class D\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons8.cpp, Page no-562" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B1:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B1\"\n", + "class B2:\n", + " def __init__(self):\n", + " B1.__init__(self)\n", + " print \"No-argument constructor of the base class B2\"\n", + "class D(B2, B1):\n", + " def __init__(self):\n", + " B2.__init__(self)\n", + " print \"No-argument constructor of the derived class D\"\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of the base class B1\n", + "No-argument constructor of the base class B2\n", + "No-argument constructor of the derived class D\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons9.cpp, Page no-563" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B1:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B1\"\n", + "class B2:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B2\"\n", + "class D(B1, B2):\n", + " def __init__(self):\n", + " B1()\n", + " B2()\n", + " print \"No-argument constructor of the derived class D\"\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of the base class B1\n", + "No-argument constructor of the base class B2\n", + "No-argument constructor of the derived class D\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons10.cpp, Page no-563" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B1:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B1\"\n", + "class B2:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B2\"\n", + "class D(B1, B2):\n", + " def __init__(self):\n", + " B2()\n", + " B1()\n", + " print \"No-argument constructor of the derived class D\"\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of the base class B2\n", + "No-argument constructor of the base class B1\n", + "No-argument constructor of the derived class D\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons11.cpp, Page no-564" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " def __init__(self):\n", + " print \"No-argument constructor of a base class B\"\n", + "class D1(B):\n", + " def __init__(self):\n", + " B.__init__(self)\n", + " print \"No-argument constructor of a base class D1\"\n", + "class D2(D1):\n", + " def __init__(self):\n", + " D1.__init__(self)\n", + " print \"No-argument constructor of a derived class D2\"\n", + "objd=D2()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of a base class B\n", + "No-argument constructor of a base class D1\n", + "No-argument constructor of a derived class D2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons12.cpp, Page no-566" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B1:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B1\"\n", + " def __del__(self):\n", + " print \"Desctructor in the base class B1\"\n", + "class B2:\n", + " def __init__(self):\n", + " print \"No-argument constructor of the base class B2\"\n", + " def __del__(self):\n", + " print \"Desctructor in the base class B2\"\n", + "class D(B1, B2):\n", + " def __init__(self):\n", + " B1.__init__(self)\n", + " B2.__init__(self)\n", + " print \"No-argument constructor of the derived class D\"\n", + " def __del__(self):\n", + " print \"Desctructor in the derived class D\"\n", + " for b in self.__class__.__bases__:\n", + " b.__del__(self)\n", + "objd=D()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No-argument constructor of the base class B1\n", + "No-argument constructor of the base class B2\n", + "No-argument constructor of the derived class D\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons13.cpp, Page no-568" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " __x=int\n", + " __y=int\n", + " def __init__(self, a, b):\n", + " self.__x=a\n", + " self.__y=b\n", + "class D(B):\n", + " __a=int\n", + " __b=int\n", + " def __init__(self, p, q, r):\n", + " self.__a=p\n", + " B.__init__(self, p, q)\n", + " self.__b=r\n", + " def output(self):\n", + " print \"x =\", self._B__x\n", + " print \"y =\", self._B__y\n", + " print \"a =\", self.__a\n", + " print \"b =\", self.__b\n", + "objd=D(5, 10, 15)\n", + "objd.output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 5\n", + "y = 10\n", + "a = 5\n", + "b = 15\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-runtime.cpp, Page no-570" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " __x=int\n", + " __y=int(0) #initialization\n", + " def __init__(self, a, b):\n", + " self.__x=self.__y+b\n", + " self.__y=a\n", + " def Print(self):\n", + " print \"x =\", self.__x\n", + " print \"y =\", self.__y\n", + "b = B(2, 3)\n", + "b.Print()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 3\n", + "y = 2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cons14.cpp, Page no-570" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " __x=int\n", + " __y=int\n", + " def read(self):\n", + " self.__x=int(raw_input(\"X in class B ? \"))\n", + " self.__y=int(raw_input(\"Y in class B ? \"))\n", + " def show(self):\n", + " print \"X in class B =\", self.__x\n", + " print \"Y in class B =\", self.__y\n", + "class D(B):\n", + " __y=int\n", + " __z=int\n", + " def read(self):\n", + " B.read(self)\n", + " self.__y=int(raw_input(\"Y in class D ? \"))\n", + " self.__z=int(raw_input(\"Z in class D ? \"))\n", + " def show(self):\n", + " B.show(self)\n", + " print \"Y in class D =\", self.__y\n", + " print \"Z in class D =\", self.__z\n", + " print \"Y of B, show from D =\", self._B__y\n", + "objd=D()\n", + "print \"Enter data for object of class D..\"\n", + "objd.read()\n", + "print \"Contents of object of class D..\"\n", + "objd.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for object of class D..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "X in class B ? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Y in class B ? 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Y in class D ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Z in class D ? 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Contents of object of class D..\n", + "X in class B = 1\n", + "Y in class B = 2\n", + "Y in class D = 3\n", + "Z in class D = 4\n", + "Y of B, show from D = 2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-stack.cpp, Page no-573" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_ELEMENTS=5\n", + "class Stack:\n", + " __stack=[int]*(MAX_ELEMENTS+1)\n", + " __StackTop=int\n", + " def __init__(self):\n", + " self.__StackTop=0\n", + " def push(self, element):\n", + " self.__StackTop+=1\n", + " self.__stack[self.__StackTop]=element\n", + " def pop(self, element):\n", + " element=self.__stack[self.__StackTop]\n", + " self.__StackTop-=1\n", + " return element\n", + "class MyStack(Stack):\n", + " def push(self, element):\n", + " if self._Stack__StackTop0:\n", + " element=Stack.pop(self, element)\n", + " return element\n", + " print \"Stack Underflow\"\n", + " return 0\n", + "stack=MyStack()\n", + "print \"Enter Integer data to put into the stack...\"\n", + "while(1):\n", + " element=int(raw_input(\"Element to Push ? \"))\n", + " if stack.push(element)==0:\n", + " break\n", + "print \"The Stack Contains...\"\n", + "element=stack.pop(element)\n", + "while element:\n", + " print \"pop:\", element\n", + " element=stack.pop(element)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Integer data to put into the stack...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element to Push ? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element to Push ? 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element to Push ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element to Push ? 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element to Push ? 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element to Push ? 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Stack Overflow\n", + "The Stack Contains...\n", + "pop: 5\n", + "pop: 4\n", + "pop: 3\n", + "pop: 2\n", + "pop: 1\n", + "Stack Underflow\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-exam.cpp, Page no-577" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_LEN=25\n", + "class person:\n", + " __name=[chr]*MAX_LEN\n", + " __sex=chr\n", + " __age=int\n", + " def ReadData(self):\n", + " self.__name=raw_input(\"Name ? \")\n", + " self.__sex=str(raw_input(\"Sex ? \"))\n", + " self.__age=int(raw_input(\"Age ? \"))\n", + " def DisplayData(self):\n", + " print \"Name:\", self.__name\n", + " print \"Sex: \", self.__sex\n", + " print \"Age: \", self.__age\n", + "class student(person):\n", + " __RollNo=int\n", + " __branch=[chr]*20\n", + " def ReadData(self):\n", + " person.ReadData(self) #invoking member function ReadData of base class person\n", + " self.__RollNo=int(raw_input(\"Roll Number ? \"))\n", + " self.__branch=raw_input(\"Branch Studying ? \")\n", + " def DisplayData(self):\n", + " person.DisplayData(self) #invoking member function DisplayData of base class person\n", + " print \"Roll Number:\", self.__RollNo\n", + " print \"Branch:\", self.__branch\n", + "class exam(student):\n", + " __Sub1Marks=int\n", + " __Sub2Marks=int\n", + " def ReadData(self):\n", + " student.ReadData(self) #invoking member function ReadData of base class student\n", + " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", + " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", + " def DisplayData(self):\n", + " student.DisplayData(self) #invoking member function DisplayData of base class student\n", + " print \"Marks scored in Subject 1:\", self.__Sub1Marks\n", + " print \"Marks scored in Subject 2:\", self.__Sub2Marks\n", + " print \"Total Marks Scored:\", self.TotalMarks()\n", + " def TotalMarks(self):\n", + " return self.__Sub1Marks+self.__Sub2Marks\n", + "annual=exam()\n", + "print \"Enter data for Student...\"\n", + "annual.ReadData()\n", + "print \"Student Details...\"\n", + "annual.DisplayData()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for Student...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sex ? M\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age ? 24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch Studying ? Computer-Technology\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 1 < Max:100> ? 92\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 2 < Max:100> ? 88\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Details...\n", + "Name: Rajkumar\n", + "Sex: M\n", + "Age: 24\n", + "Roll Number: 9\n", + "Branch: Computer-Technology\n", + "Marks scored in Subject 1: 92\n", + "Marks scored in Subject 2: 88\n", + "Total Marks Scored: 180\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mul_inh1.cpp, Page no-580" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "class A:\n", + " def __init__(self):\n", + " sys.stdout.write('a'),\n", + "class B:\n", + " def __init__(self):\n", + " sys.stdout.write('b'),\n", + "class C(A, B):\n", + " def __init__(self):\n", + " A.__init__(self)\n", + " B.__init__(self)\n", + " sys.stdout.write('c'),\n", + "objc=C()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "abc" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mul_inh2.cpp, Page no-581" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class A:\n", + " def __init__(self, c):\n", + " sys.stdout.write(c),\n", + "class B:\n", + " def __init__(self, b):\n", + " sys.stdout.write(b),\n", + "class C(A, B):\n", + " def __init__(self, c1, c2, c3):\n", + " A.__init__(self, c1)\n", + " B.__init__(self, c2)\n", + " sys.stdout.write(c3),\n", + "objc=C('a', 'b', 'c')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "abc" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mul_inh4.cpp, Page no-583" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "class A:\n", + " __ch=chr\n", + " def __init__(self, c):\n", + " self.__ch=c\n", + " def show(self):\n", + " sys.stdout.write(self.__ch),\n", + "class B:\n", + " __ch=chr\n", + " def __init__(self, b):\n", + " self.__ch=b\n", + " def show(self):\n", + " sys.stdout.write(self.__ch),\n", + "class C(A, B):\n", + " __ch=chr\n", + " def __init__(self, c1, c2, c3):\n", + " A.__init__(self, c1)\n", + " B.__init__(self, c2)\n", + " self.__ch=c3\n", + "objc=C('a', 'b', 'c')\n", + "print \"objc.A::show() = \",\n", + "A.show(objc)\n", + "print \"\\nobjc.B::show() = \",\n", + "B.show(objc)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "objc.A::show() = a \n", + "objc.B::show() = b\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mul_inh5.cpp, Page no-584" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "class A:\n", + " __ch=chr\n", + " def __init__(self, c):\n", + " self.__ch=c\n", + " def show(self):\n", + " sys.stdout.write(self.__ch),\n", + "class B:\n", + " __ch=chr\n", + " def __init__(self, b):\n", + " self.__ch=b\n", + " def show(self):\n", + " sys.stdout.write(self.__ch),\n", + "class C(A, B):\n", + " __ch=chr\n", + " def __init__(self, c1, c2, c3):\n", + " A.__init__(self, c1)\n", + " B.__init__(self, c2)\n", + " self.__ch=c3\n", + " def show(self):\n", + " A.show(self)\n", + " B.show(self)\n", + " sys.stdout.write(self.__ch),\n", + "objc=C('a', 'b', 'c')\n", + "print \"objc.show() = \",\n", + "objc.show()\n", + "print \"\\nobjc.C::show() = \",\n", + "C.show(objc)\n", + "print \"\\nobjc.A::show() = \",\n", + "A.show(objc)\n", + "print \"\\nobjc.B::show() = \",\n", + "B.show(objc)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "objc.show() = abc \n", + "objc.C::show() = abc \n", + "objc.A::show() = a \n", + "objc.B::show() = b\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-publish1.cpp, Page no-586" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class publication:\n", + " __title=[chr]*40\n", + " __price=float\n", + " def getdata(self):\n", + " self.__title=raw_input(\"\\tEnter Title: \")\n", + " self.__price=float(raw_input(\"\\tEnter Price: \"))\n", + " def display(self):\n", + " print \"\\tTitle =\", self.__title\n", + " print \"\\tPrice = %g\" %(self.__price)\n", + "class sales:\n", + " __PublishSales=[]\n", + " def __init__(self):\n", + " self.__PublishSales=[float]*3\n", + " def getdata(self):\n", + " for i in range(3):\n", + " print \"\\tEnter Sales of\", i+1, \"Month: \",\n", + " self.__PublishSales[i]=float(raw_input())\n", + " def display(self):\n", + " TotalSales=0\n", + " for i in range(3):\n", + " print \"\\tSales of\", i+1, \"Month = %g\" %(self.__PublishSales[i])\n", + " TotalSales+=self.__PublishSales[i]\n", + " print \"\\tTotalSales = %g\" %(TotalSales)\n", + "class book(publication, sales):\n", + " __pages=int\n", + " def getdata(self):\n", + " publication.getdata(self)\n", + " self.__pages=int(raw_input(\"\\tEnter Number of Pages: \"))\n", + " sales.getdata(self)\n", + " def display(self):\n", + " publication.display(self)\n", + " print \"\\tNumber of Pages = %g\" %(self.__pages)\n", + " sales.display(self)\n", + "class tape(publication, sales):\n", + " __PlayTime=int\n", + " def getdata(self):\n", + " publication.getdata(self)\n", + " self.__PlayTime=int(raw_input(\"\\tEnter Playing Time in Minute: \"))\n", + " sales.getdata(self)\n", + " def display(self):\n", + " publication.display(self)\n", + " print \"\\tPlaying Time in Minute = %g\" %(self.__PlayTime)\n", + " sales.display(self)\n", + "class pamphlet(publication):\n", + " pass\n", + "class notice(pamphlet):\n", + " __whom=[chr]*20\n", + " def getdata(self):\n", + " pamphlet.getdata(self)\n", + " self.__whom=raw_input(\"\\tEnter Type of Distributor: \")\n", + " def display(self):\n", + " pamphlet.display(self)\n", + " print \"\\tType of Distributor =\", self.__whom\n", + "book1=book()\n", + "tape1=tape()\n", + "pamp1=pamphlet()\n", + "notice1=notice()\n", + "print \"Enter Book Publication Data...\"\n", + "book1.getdata()\n", + "print \"Enter Tape Publication Data...\"\n", + "tape1.getdata()\n", + "print \"Enter Pamhlet Publication Data...\"\n", + "pamp1.getdata()\n", + "print \"Enter Notice Publication Data...\"\n", + "notice1.getdata()\n", + "print \"Book Publication Data...\"\n", + "book1.display()\n", + "print \"Tape Publication Data...\"\n", + "tape1.display()\n", + "print \"Pamphlet Publication Data...\"\n", + "pamp1.display()\n", + "print \"Notice Publication Data...\"\n", + "notice1.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Book Publication Data...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Title: Microprocessor-x86-Programming\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Price: 180\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Number of Pages: 750\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Sales of 1 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \tEnter Sales of 2 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "500\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \tEnter Sales of 3 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "800\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Tape Publication Data...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Title: Love-1947\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Price: 100\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Playing Time in Minute: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Sales of 1 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "200\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \tEnter Sales of 2 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "500\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \tEnter Sales of 3 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "400\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Pamhlet Publication Data...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Title: Advanced-Computing-95-Conference\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Price: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Notice Publication Data...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Title: General-Meeting\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Price: 100\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Type of Distributor: Retail\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Book Publication Data...\n", + "\tTitle = Microprocessor-x86-Programming\n", + "\tPrice = 180\n", + "\tNumber of Pages = 750\n", + "\tSales of 1 Month = 1000\n", + "\tSales of 2 Month = 500\n", + "\tSales of 3 Month = 800\n", + "\tTotalSales = 2300\n", + "Tape Publication Data...\n", + "\tTitle = Love-1947\n", + "\tPrice = 100\n", + "\tPlaying Time in Minute = 10\n", + "\tSales of 1 Month = 200\n", + "\tSales of 2 Month = 500\n", + "\tSales of 3 Month = 400\n", + "\tTotalSales = 1100\n", + "Pamphlet Publication Data...\n", + "\tTitle = Advanced-Computing-95-Conference\n", + "\tPrice = 10\n", + "Notice Publication Data...\n", + "\tTitle = General-Meeting\n", + "\tPrice = 100\n", + "\tType of Distributor = Retail\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vehicle.cpp, Page no-591" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_LEN=25\n", + "class Vehicle:\n", + " __name=[chr]*MAX_LEN\n", + " __WheelsCount=int\n", + " def GetData(self):\n", + " self.__name=raw_input(\"Name of the Vehicle ? \")\n", + " self.__WheelsCount=int(raw_input(\"Wheels ? \"))\n", + " def DisplayData(self):\n", + " print \"Name of the Vehicle :\", self.__name \n", + " print \"Wheels :\", self.__WheelsCount\n", + "class LightMotor(Vehicle):\n", + " __SpeedLimit=int\n", + " def GetData(self):\n", + " Vehicle.GetData(self)\n", + " self.__SpeedLimit=int(raw_input(\"Speed Limit ? \"))\n", + " def DisplayData(self):\n", + " Vehicle.DisplayData(self)\n", + " print \"Speed Limit :\", self.__SpeedLimit\n", + "class HeavyMotor(Vehicle):\n", + " __permit=[chr]*MAX_LEN\n", + " __LoadCapacity=int\n", + " def GetData(self):\n", + " Vehicle.GetData(self)\n", + " self.__LoadCapacity=int(raw_input(\"Load Carrying Capacity ? \"))\n", + " self.__permit=raw_input(\"Permit Type ? \")\n", + " def DisplayData(self):\n", + " Vehicle.DisplayData(self)\n", + " print \"Load Carrying Capacity : \", self.__LoadCapacity \n", + " print \"Permit:\", self.__permit\n", + "class GearMotor(LightMotor):\n", + " __GearCount=int\n", + " def GetData(self):\n", + " LightMotor.GetData(self)\n", + " self.__GearCount=int(raw_input(\"No. of Gears ? \"))\n", + " def DisplayData(self):\n", + " LightMotor.DisplayData(self)\n", + " print \"Gears :\", self.__GearCount\n", + "class NonGearMotor(LightMotor):\n", + " def GetData(self):\n", + " LightMotor.Getdata(self)\n", + " def DisplayData(self):\n", + " LightMotor.DisplayData(self)\n", + "class Passenger(HeavyMotor):\n", + " __sitting=int\n", + " __standing=int\n", + " def GetData(self):\n", + " HeavyMotor.GetData(self)\n", + " self.__sitting=int(raw_input(\"Maximum Seats ? \"))\n", + " self.__standing=int(raw_input(\"Maximum Standing ? \"))\n", + " def DisplayData(self):\n", + " HeavyMotor.DisplayData(self)\n", + " print \"Maximum Seats:\", self.__sitting\n", + " print \"Maximum Standing:\", self.__standing\n", + "class Goods(HeavyMotor):\n", + " def GetData(self):\n", + " HeavyMotor.Getdata(self)\n", + " def DisplayData(self):\n", + " HeavyMotor.DisplayData(self)\n", + "vehi1=GearMotor()\n", + "vehi2=Passenger()\n", + "print \"Enter Data for Gear Motor Vehicle...\"\n", + "vehi1.GetData()\n", + "print \"Enter Data for Passenger Motor Vehicle...\"\n", + "vehi2.GetData()\n", + "print \"Data of Gear Motor Vehicle...\"\n", + "vehi1.DisplayData()\n", + "print \"Data of Passenger Motor Vehicle...\"\n", + "vehi2.DisplayData()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Data for Gear Motor Vehicle...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name of the Vehicle ? Maruti-Car\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wheels ? 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed Limit ? 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "No. of Gears ? 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Data for Passenger Motor Vehicle...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name of the Vehicle ? KSRTC-BUS\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wheels ? 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Load Carrying Capacity ? 60\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Permit Type ? National\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum Seats ? 45\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum Standing ? 60\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Data of Gear Motor Vehicle...\n", + "Name of the Vehicle : Maruti-Car\n", + "Wheels : 4\n", + "Speed Limit : 4\n", + "Gears : 5\n", + "Data of Passenger Motor Vehicle...\n", + "Name of the Vehicle : KSRTC-BUS\n", + "Wheels : 4\n", + "Load Carrying Capacity : 60\n", + "Permit: National\n", + "Maximum Seats: 45\n", + "Maximum Standing: 60\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-int_ext.cpp, Page no-595" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_LEN=25\n", + "class student():\n", + " __RollNo=int\n", + " __branch=[chr]*20\n", + " def ReadStudentData(self):\n", + " self.__RollNo=int(raw_input(\"Roll Number ? \"))\n", + " self.__branch=raw_input(\"Branch Studying ? \")\n", + " def DisplayStudentData(self):\n", + " print \"Roll Number:\", self.__RollNo\n", + " print \"Branch:\", self.__branch\n", + "class InternalExam(student):\n", + " __Sub1Marks=int\n", + " __Sub2Marks=int\n", + " def ReadData(self):\n", + " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", + " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", + " def DisplayData(self):\n", + " print \"Internal Marks scored in Subject 1:\", self.__Sub1Marks\n", + " print \"Internal Marks scored in Subject 2:\", self.__Sub2Marks\n", + " print \"Internal Total Marks Scored:\", self.TotalMarks()\n", + " def InternalTotalMarks(self):\n", + " return self.__Sub1Marks+self.__Sub2Marks\n", + "class ExternalExam(student):\n", + " __Sub1Marks=int\n", + " __Sub2Marks=int\n", + " def ReadData(self):\n", + " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", + " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", + " def DisplayData(self):\n", + " print \"External Marks scored in Subject 1:\", self.__Sub1Marks\n", + " print \"External Marks scored in Subject 2:\", self.__Sub2Marks\n", + " print \"External Total Marks Scored:\", self.ExternalTotalMarks()\n", + " def ExternalTotalMarks(self):\n", + " return self.__Sub1Marks+self.__Sub2Marks\n", + "class result(InternalExam, ExternalExam):\n", + " __total=int\n", + " def TotalMarks(self):\n", + " return InternalExam.InternalTotalMarks(self)+ExternalExam.ExternalTotalMarks(self)\n", + "student1=result()\n", + "print \"Enter data for Student1...\"\n", + "student1.ReadStudentData()\n", + "print \"Enter internal marks...\"\n", + "InternalExam.ReadData(student1)\n", + "print \"Enter external marks...\"\n", + "ExternalExam.ReadData(student1)\n", + "print \"Student Details...\"\n", + "student1.DisplayStudentData()\n", + "InternalExam.DisplayData(student1)\n", + "ExternalExam.DisplayData(student1)\n", + "print \"Total Marks =\", student1.TotalMarks()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for Student1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch Studying ? Computer-Technology\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter internal marks...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 1 < Max:100> ? 80\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 2 < Max:100> ? 85\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter external marks...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 1 < Max:100> ? 89\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 2 < Max:100> ? 90\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Details...\n", + "Roll Number: 9\n", + "Branch: Computer-Technology\n", + "Internal Marks scored in Subject 1: 80\n", + "Internal Marks scored in Subject 2: 85\n", + "Internal Total Marks Scored: 344\n", + "External Marks scored in Subject 1: 89\n", + "External Marks scored in Subject 2: 90\n", + "External Total Marks Scored: 179\n", + "Total Marks = 344\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vir.cpp, Page no-598" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class A:\n", + " __x=int\n", + " def __init__(self, i=None):\n", + " if isinstance(i, int):\n", + " self.__x=i\n", + " else:\n", + " self.__x=-1\n", + " def geta(self):\n", + " return self.__x\n", + "class B(A):\n", + " __y=int\n", + " def __init__(self, i, k):\n", + " A.__init__(self, i)\n", + " self.__y=k\n", + " def getb(self):\n", + " return self.__y\n", + " def show(self):\n", + " print self._A__x, self.geta(), self.getb()\n", + "class C(A):\n", + " __z=int\n", + " def __init__(self, i, k):\n", + " A.__init__(self, i)\n", + " self.__z=k\n", + " def getc(self):\n", + " return self.__z\n", + " def show(self):\n", + " print self._A__x, self.geta(), self.getc()\n", + "class D(B,C):\n", + " def __init__(self, i, j):\n", + " B.__init__(self, i, j)\n", + " C.__init__(self, i, j)\n", + " def show(self):\n", + " print self._A__x, self.geta(), self.getb(), self.getc(), self.getc()\n", + "d1=D(3, 5)\n", + "print \"Object d1 contents:\",\n", + "d1.show() #unlike C++, python executes the 1 argument constuctor of A() instead of implicit call to the no argument constructor of A()\n", + "b1=B(7, 9)\n", + "print \"Object b1 contents:\",\n", + "b1.show()\n", + "c1=C(11, 13)\n", + "print \"Object c1 contents:\",\n", + "c1.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Object d1 contents: 3 3 5 5 5\n", + "Object b1 contents: 7 7 9\n", + "Object c1 contents: 11 11 13\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sports.cpp, Page no-601" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_LEN=25\n", + "class person:\n", + " __name=[chr]*MAX_LEN\n", + " __sex=chr\n", + " __age=int\n", + " def ReadPerson(self):\n", + " self.__name=raw_input(\"Name ? \")\n", + " self.__sex=str(raw_input(\"Sex ? \"))\n", + " self.__age=int(raw_input(\"Age ? \"))\n", + " def DisplayPerson(self):\n", + " print \"Name:\", self.__name\n", + " print \"Sex: \", self.__sex\n", + " print \"Age: \", self.__age\n", + "class sports(person):\n", + " __name=[chr]*MAX_LEN\n", + " __score=int\n", + " def ReadData(self):\n", + " self.__name=raw_input(\"Game Played ? \")\n", + " self.__score=int(raw_input(\"Game Score ? \"))\n", + " def DisplayData(self):\n", + " print \"Sports Played:\", self.__name\n", + " print \"Game Score: \", self.__score\n", + " def SportsScore(self):\n", + " return self.__score\n", + "class student(person):\n", + " __RollNo=int\n", + " __branch=[chr]*20\n", + " def ReadData(self):\n", + " self.__RollNo=int(raw_input(\"Roll Number ? \"))\n", + " self.__branch=raw_input(\"Branch Studying ? \")\n", + " def DisplayData(self):\n", + " print \"Roll Number:\", self.__RollNo\n", + " print \"Branch:\", self.__branch\n", + "class exam(student):\n", + " __Sub1Marks=int\n", + " __Sub2Marks=int\n", + " def ReadData(self):\n", + " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", + " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", + " def DisplayData(self):\n", + " print \"Marks scored in Subject 1:\", self.__Sub1Marks\n", + " print \"Marks scored in Subject 2:\", self.__Sub2Marks\n", + " print \"Total Marks Scored:\", self.TotalMarks()\n", + " def TotalMarks(self):\n", + " return self.__Sub1Marks+self.__Sub2Marks\n", + "class result(exam, sports):\n", + " __total=int\n", + " def ReadData(self):\n", + " self.ReadPerson()\n", + " student.ReadData(self)\n", + " exam.ReadData(self)\n", + " sports.ReadData(self)\n", + " def DisplayData(self):\n", + " self.DisplayPerson()\n", + " student.DisplayData(self)\n", + " exam.DisplayData(self)\n", + " sports.DisplayData(self)\n", + " print \"Overall Performance, (exam + sports) :\",self.Percentage(), \"%\"\n", + " def Percentage(self):\n", + " return (exam.TotalMarks(self)+self.SportsScore())/3\n", + "Student=result()\n", + "print \"Enter data for Student...\"\n", + "Student.ReadData()\n", + "print \"Student Details...\"\n", + "Student.DisplayData()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for Student...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sex ? M\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age ? 24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch Studying ? Computer-Technology\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 1 < Max:100> ? 92\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Marks scored in Subject 2 < Max:100> ? 88\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Game Played ? Cricket\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Game Score ? 85\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Details...\n", + "Name: Rajkumar\n", + "Sex: M\n", + "Age: 24\n", + "Roll Number: 9\n", + "Branch: Computer-Technology\n", + "Marks scored in Subject 1: 92\n", + "Marks scored in Subject 2: 88\n", + "Total Marks Scored: 180\n", + "Sports Played: Cricket\n", + "Game Score: 85\n", + "Overall Performance, (exam + sports) : 88 %\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-nesting.cpp, Page no-605" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class B:\n", + " num=int\n", + " def __init__(self, a=None):\n", + " if isinstance(a, int):\n", + " print \"Constructor B( int a ) is invoked\"\n", + " self.num=a\n", + " else:\n", + " self.num=0\n", + "class D:\n", + " data1=int\n", + " objb=B()\n", + " def __init__(self, a):\n", + " self.objb.__init__(a)\n", + " self.data1=a\n", + " def output(self):\n", + " print \"Data in Object of Class S =\", self.data1\n", + " print \"Data in Member object of class B in class D = \",self.objb.num\n", + "objd = D(10)\n", + "objd.output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor B( int a ) is invoked\n", + "Data in Object of Class S = 10\n", + "Data in Member object of class B in class D = 10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-publish2.cpp, Page no-608" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class publication:\n", + " __title=[chr]*40\n", + " __price=float\n", + " def getdata(self):\n", + " self.__title=raw_input(\"\\tEnter Title: \")\n", + " self.__price=float(raw_input(\"\\tEnter Price: \"))\n", + " def display(self):\n", + " print \"\\tTitle =\", self.__title\n", + " print \"\\tPrice = %g\" %(self.__price)\n", + "class sales:\n", + " __PublishSales=[]\n", + " def __init__(self):\n", + " self.__PublishSales=[float]*3\n", + " def getdata(self):\n", + " for i in range(3):\n", + " print \"\\tEnter Sales of\", i+1, \"Month: \",\n", + " self.__PublishSales[i]=float(raw_input())\n", + " def display(self):\n", + " TotalSales=0\n", + " for i in range(3):\n", + " print \"\\tSales of\", i+1, \"Month = %g\" %(self.__PublishSales[i])\n", + " TotalSales+=self.__PublishSales[i]\n", + " print \"\\tTotalSales = %g\" %(TotalSales)\n", + "class book:\n", + " __pages=int\n", + " pub=publication()\n", + " market=sales()\n", + " def getdata(self):\n", + " self.pub.getdata()\n", + " self.__pages=int(raw_input(\"\\tEnter Number of Pages: \"))\n", + " self.market.getdata()\n", + " def display(self):\n", + " self.pub.display()\n", + " print \"\\tNumber of Pages = %g\" %(self.__pages)\n", + " self.market.display()\n", + "book1=book()\n", + "print \"Enter Book Publication Data...\"\n", + "book1.getdata()\n", + "print \"Book Publication Data...\"\n", + "book1.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Book Publication Data...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Title: Microprocessor-x86-Programming\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Price: 180\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Number of Pages: 750\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tEnter Sales of 1 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \tEnter Sales of 2 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "500\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \tEnter Sales of 3 Month: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "800\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Book Publication Data...\n", + "\tTitle = Microprocessor-x86-Programming\n", + "\tPrice = 180\n", + "\tNumber of Pages = 750\n", + "\tSales of 1 Month = 1000\n", + "\tSales of 2 Month = 500\n", + "\tSales of 3 Month = 800\n", + "\tTotalSales = 2300\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-611" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class employee:\n", + " emp_id=int\n", + " emp_name=[chr]*30\n", + " def getdata(self):\n", + " self.__emp_id=int(raw_input(\"Enter employee number: \"))\n", + " self.__emp_name=raw_input(\"Enter emploee name: \")\n", + " def displaydata(self):\n", + " print \"Employee Number:\", self.__emp_id, \"\\nEmployee Name:\", self.__emp_name\n", + "class emp_union:\n", + " __member_id=int\n", + " def getdata(self):\n", + " self.__member_id=int(raw_input(\"Enter member id: \"))\n", + " def displaydata(self):\n", + " print \"Member ID:\", self.__member_id\n", + "class emp_info(employee, emp_union):\n", + " __basic_salary=float\n", + " def getdata(self):\n", + " employee.getdata(self)\n", + " emp_union.getdata(self)\n", + " self.__basic_salary=int(raw_input(\"Enter basic salary: \"))\n", + " def displaydata(self):\n", + " employee.displaydata(self)\n", + " emp_union.displaydata(self)\n", + " print \"Basic Salary:\", self.__basic_salary\n", + "e1=emp_info()\n", + "e1.getdata()\n", + "e1.displaydata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter employee number: 23\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter emploee name: Krishnan\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter member id: 443\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter basic salary: 8500\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Employee Number: 23 \n", + "Employee Name: Krishnan\n", + "Member ID: 443\n", + "Basic Salary: 8500\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-2, Page no-613" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class details:\n", + " __name=[chr]*30\n", + " __address=[chr]*50\n", + " def getdata(self):\n", + " self.__name=raw_input(\"Name: \")\n", + " self.__address=raw_input(\"Address: \")\n", + " def displaydata(self):\n", + " print \"Name:\", self.__name,\"\\nAddress:\", self.__address\n", + "class student(details):\n", + " __marks=float\n", + " def getdata(self):\n", + " details.getdata(self)\n", + " self.__marks=float(raw_input(\"Percentage Marks: \"))\n", + " def displaydata(self):\n", + " details.displaydata(self)\n", + " print \"Percentage Marks: %g\" %(self.__marks)\n", + "class staff(details):\n", + " __salary=float\n", + " def getdata(self):\n", + " details.getdata(self)\n", + " self.__salary=float(raw_input(\"Salary: \"))\n", + " def displaydata(self):\n", + " details.displaydata(self)\n", + " print \"Salary: %g\" %(self.__salary)\n", + "student1=student()\n", + "staff1=staff()\n", + "print \"Enter student data:\"\n", + "student1.getdata()\n", + "print \"Enter staff data:\"\n", + "staff1.getdata()\n", + "print \"Displaying student and staff data:\"\n", + "student1.displaydata()\n", + "staff1.displaydata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter student data:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Venkatesh\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address: H.No. 89, AGM Society, Bangalore\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Percentage Marks: 78.4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter staff data:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Vijayan\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address: H.No. A-2, SLR Society, Bangalore\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Salary: 25000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Displaying student and staff data:\n", + "Name: Venkatesh \n", + "Address: H.No. 89, AGM Society, Bangalore\n", + "Percentage Marks: 78.4\n", + "Name: Vijayan \n", + "Address: H.No. A-2, SLR Society, Bangalore\n", + "Salary: 25000\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions.ipynb new file mode 100755 index 00000000..885b9dee --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions.ipynb @@ -0,0 +1,629 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b2c633d473244077752ca84867fbd4b5425a7e64be9d919c65be58ffebb68245" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 15-Virtual Functions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-parent1.cpp, Page no-618" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Father:\n", + " __name=[chr]*20\n", + " def __init__(self, fname):\n", + " self.__name=fname\n", + " def show(self):\n", + " print \"Father name:\", self.__name\n", + "class Son(Father):\n", + " __name=[chr]*20\n", + " def __init__(self, sname, fname):\n", + " Father.__init__(self, fname)\n", + " self.__name=sname\n", + " def show(self):\n", + " print \"Son name:\", self.__name\n", + "fp=[Father]\n", + "f1=Father(\"Eshwarappa\")\n", + "fp=f1\n", + "fp.show()\n", + "s1=Son(\"Rajkumar\", \"Eshwarappa\")\n", + "fp=s1\n", + "Father.show(fp)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Father name: Eshwarappa\n", + "Father name: Eshwarappa\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-parent1.cpp, Page no-619" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Father():\n", + " __name=[chr]*20\n", + " def __init__(self, fname):\n", + " self.__name=fname\n", + " def show(self):\n", + " print \"Father name:\", self.__name\n", + "class Son(Father):\n", + " __name=[chr]*20\n", + " def __init__(self, sname, fname):\n", + " Father.__init__(self, fname)\n", + " self.__name=sname\n", + " def show(self):\n", + " print \"Son name:\", self.__name\n", + "fp=[Father]\n", + "f1=Father(\"Eshwarappa\")\n", + "fp=f1\n", + "fp.show()\n", + "s1=Son(\"Rajkumar\", \"Eshwarappa\")\n", + "fp=s1\n", + "fp.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Father name: Eshwarappa\n", + "Son name: Rajkumar\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-family1.cpp, Page no-622" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Father():\n", + " __f_age=int\n", + " def __init__(self, n):\n", + " self.__f_age=n\n", + " def GetAge(self):\n", + " return self.__f_age\n", + "class Son(Father):\n", + " __s_age=int\n", + " def __init__(self, n, m):\n", + " Father.__init__(self, n)\n", + " self.__s_age=m\n", + " def GetAge(self):\n", + " return self.__s_age\n", + " def son_func(self):\n", + " print \"son's own function\"\n", + "basep=[Father]\n", + "basep=Father(45)\n", + "print \"basep points to base object...\"\n", + "print \"Father's Age:\",\n", + "print basep.GetAge()\n", + "del basep\n", + "basep=[Son(45, 20)]\n", + "print \"basep points to derived object...\"\n", + "print \"Son's Age:\",\n", + "print Father.GetAge(basep[0])\n", + "print \"By typecasting, ((Son*) basep)...\"\n", + "print \"Son's age:\",basep[0].GetAge()\n", + "del basep\n", + "son1=Son(45, 20)\n", + "derivedp=[son1]\n", + "print \"accessing through derived class pointer...\"\n", + "print \"Son's Age:\",\n", + "print derivedp[0].GetAge()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "basep points to base object...\n", + "Father's Age: 45\n", + "basep points to derived object...\n", + "Son's Age: 45\n", + "By typecasting, ((Son*) basep)...\n", + "Son's age: 20\n", + "accessing through derived class pointer...\n", + "Son's Age: 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-family2.cpp, Page no-626" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Father():\n", + " __f_age=int\n", + " def __init__(self, n):\n", + " self.__f_age=n\n", + " def GetAge(self):\n", + " return self.__f_age\n", + "class Son(Father):\n", + " __s_age=int\n", + " def __init__(self, n, m):\n", + " Father.__init__(self, n)\n", + " self.__s_age=m\n", + " def GetAge(self):\n", + " return self.__s_age\n", + "basep=[Father]\n", + "basep=Father(45)\n", + "print \"Father's Age:\",\n", + "print basep.GetAge()\n", + "del basep\n", + "basep=[Son(45, 20)]\n", + "print \"Son's Age:\",\n", + "print basep[0].GetAge()\n", + "del basep" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Father's Age: 45\n", + "Son's Age: 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-draw.cpp, Page no-629" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class graphics:\n", + " def draw(self):\n", + " print \"point\"\n", + "class line(graphics):\n", + " def draw(self):\n", + " print \"line\"\n", + "class triangle(graphics):\n", + " def draw(self):\n", + " print \"triangle\"\n", + "class rectangle(graphics):\n", + " def draw(self):\n", + " print \"rectangle\"\n", + "class circle(graphics):\n", + " def draw(self):\n", + " print \"circle\"\n", + "point_obj=graphics()\n", + "line_obj=line()\n", + "tri_obj=triangle()\n", + "rect_obj=rectangle()\n", + "circle_obj=circle()\n", + "basep=[]\n", + "basep.append(point_obj)\n", + "basep.append(line_obj)\n", + "basep.append(tri_obj)\n", + "basep.append(rect_obj)\n", + "basep.append(circle_obj)\n", + "print \"Following figures are drawn with basep[i]->draw()...\"\n", + "for i in range(5):\n", + " basep[i].draw()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Following figures are drawn with basep[i]->draw()...\n", + "point\n", + "line\n", + "triangle\n", + "rectangle\n", + "circle\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-pure.cpp, Page no-632" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class AbsPerson:\n", + " def Service1(self, n):\n", + " self.Service2(n)\n", + " def Service2(self, n): #pure virtual function\n", + " pass\n", + "class Person(AbsPerson):\n", + " def Service2(self, n):\n", + " print \"The number of years of service:\", 58-n\n", + "Father=Person()\n", + "Son=Person()\n", + "Father.Service1(50)\n", + "Son.Service2(20)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number of years of service: 8\n", + "The number of years of service: 38\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-number.cpp, Page no-633" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class number:\n", + " __num=int\n", + " def getdata(self):\n", + " self.__num=int(raw_input(\"Enter an integer number: \"))\n", + " def show(self): #pure virtual function\n", + " pass\n", + "class octnum(number):\n", + " def show(self):\n", + " print \"Octal equivalent of\", self._number__num,\"=\",oct(self._number__num)\n", + "class hexnum(number):\n", + " def show(self):\n", + " print \"Hexadecimal equivalent of\", self._number__num,\"=\",hex(self._number__num)\n", + "o1=octnum()\n", + "h1=hexnum()\n", + "o1.getdata()\n", + "o1.show()\n", + "h1.getdata()\n", + "h1.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an integer number: 11\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Octal equivalent of 11 = 013\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an integer number: 11\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hexadecimal equivalent of 11 = 0xb\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-family3.cpp, Page no-637" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Father():\n", + " __f_name=str\n", + " def __init__(self, fname):\n", + " self.__f_name=fname\n", + " def __del__(self):\n", + " del self.__f_name\n", + " print \"~Father() is invoked\"\n", + " def show(self):\n", + " print \"Father's name:\", self.__f_name\n", + "class Son(Father):\n", + " __s_name=str\n", + " def __init__(self, sname, fname):\n", + " Father.__init__(self, fname)\n", + " self.__s_name=sname\n", + " def __del__(self):\n", + " del self.__s_name\n", + " print \"~Son() is invoked\"\n", + " Father.__del__(self)\n", + " def show(self):\n", + " print \"Father's name:\", self._Father__f_name\n", + " print \"Son's name:\", self.__s_name\n", + "basep=[Father]\n", + "basep=Father(\"Eshwarappa\")\n", + "print \"basep points to base object...\"\n", + "basep.show()\n", + "del basep\n", + "basep=Son(\"Rajkumar\", \"Eshwarappa\")\n", + "print \"basep points to derived object...\"\n", + "basep.show()\n", + "del basep" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "basep points to base object...\n", + "Father's name: Eshwarappa\n", + "~Father() is invoked\n", + "basep points to derived object...\n", + "Father's name: Eshwarappa\n", + "Son's name: Rajkumar\n", + "~Son() is invoked\n", + "~Father() is invoked\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vptrsize.cpp, Page no-640" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class nonvirtual(Structure):\n", + " _fields_=[('x', c_int)]\n", + " def func(self):\n", + " pass\n", + "class withvirtual(Structure):\n", + " _fields_=[('x', c_int)]\n", + " def func(self):\n", + " pass\n", + "print \"sizeof( nonvirtual ) =\",sizeof(nonvirtual())\n", + "print \"sizeof( withvirtual ) =\",sizeof(withvirtual())" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sizeof( nonvirtual ) = 4\n", + "sizeof( withvirtual ) = 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-shapes.cpp, Page no-640" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class description:\n", + " __information=str\n", + " def __init__(self, info):\n", + " self.__information=info\n", + " def show(self):\n", + " print self.__information,\n", + "class sphere(description):\n", + " __radius=float\n", + " def __init__(self, info, rad):\n", + " description.__init__(self, info)\n", + " self.__radius=rad\n", + " def show(self):\n", + " print self._description__information,\n", + " print \"Radius = %g\" %self.__radius\n", + "class cube(description):\n", + " __edge_length=float\n", + " def __init__(self, info, edg_len):\n", + " description.__init__(self, info)\n", + " self.__edge_length=edg_len\n", + " def show(self):\n", + " print self._description__information,\n", + " print \"Edge Length = %g\" %self.__edge_length\n", + "small_ball=sphere(\"mine\", 1.0)\n", + "beach_ball=sphere(\"plane\", 24.0)\n", + "plan_toid=sphere(\"moon\", 1e24)\n", + "crystal=cube(\"carbon\", 1e-24)\n", + "ice=cube(\"party\", 1.0)\n", + "box=cube(\"card borad\", 16.0)\n", + "shapes=[]\n", + "shapes.append(small_ball)\n", + "shapes.append(beach_ball)\n", + "shapes.append(plan_toid)\n", + "shapes.append(crystal)\n", + "shapes.append(ice)\n", + "shapes.append(box)\n", + "small_ball.show()\n", + "beach_ball.show()\n", + "plan_toid.show()\n", + "crystal.show()\n", + "ice.show()\n", + "box.show()\n", + "print \"Dynamic Invocation of show()...\"\n", + "for i in range(len(shapes)):\n", + " shapes[i].show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mine Radius = 1\n", + "plane Radius = 24\n", + "moon Radius = 1e+24\n", + "carbon Edge Length = 1e-24\n", + "party Edge Length = 1\n", + "card borad Edge Length = 16\n", + "Dynamic Invocation of show()...\n", + "mine Radius = 1\n", + "plane Radius = 24\n", + "moon Radius = 1e+24\n", + "carbon Edge Length = 1e-24\n", + "party Edge Length = 1\n", + "card borad Edge Length = 16\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example, Page no-643" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class shape:\n", + " __val1=float\n", + " __val2=float\n", + " def getdata(self, a, b):\n", + " self.__val1=a\n", + " self.__val2=b\n", + " def display_area(self):\n", + " pass\n", + "class triangle(shape):\n", + " def display_area(self):\n", + " print \"Area of trianle =\", 0.5*self._shape__val1*self._shape__val2\n", + "class rectangle(shape):\n", + " def display_area(self):\n", + " print \"Area of rectanle =\", self._shape__val1*self._shape__val2\n", + "sptr=[shape]\n", + "sptr=triangle()\n", + "sptr.getdata(4.5, 2.2)\n", + "sptr.display_area()\n", + "sptr=rectangle()\n", + "sptr.getdata(4.5, 2.2)\n", + "sptr.display_area()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of trianle = 4.95\n", + "Area of rectanle = 9.9\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions_1.ipynb new file mode 100755 index 00000000..ab3a16ad --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions_1.ipynb @@ -0,0 +1,629 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:088209fcbfac6b2b28efe08ac9ffe00c4f6ff0675bb2728b388b1476d7fee811" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 15-Virtual Functions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-parent1.cpp, Page no-618" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Father:\n", + " __name=[chr]*20\n", + " def __init__(self, fname):\n", + " self.__name=fname\n", + " def show(self):\n", + " print \"Father name:\", self.__name\n", + "class Son(Father):\n", + " __name=[chr]*20\n", + " def __init__(self, sname, fname):\n", + " Father.__init__(self, fname)\n", + " self.__name=sname\n", + " def show(self):\n", + " print \"Son name:\", self.__name\n", + "fp=[Father]\n", + "f1=Father(\"Eshwarappa\")\n", + "fp=f1\n", + "fp.show()\n", + "s1=Son(\"Rajkumar\", \"Eshwarappa\")\n", + "fp=s1\n", + "Father.show(fp)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Father name: Eshwarappa\n", + "Father name: Eshwarappa\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-parent1.cpp, Page no-619" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Father():\n", + " __name=[chr]*20\n", + " def __init__(self, fname):\n", + " self.__name=fname\n", + " def show(self):\n", + " print \"Father name:\", self.__name\n", + "class Son(Father):\n", + " __name=[chr]*20\n", + " def __init__(self, sname, fname):\n", + " Father.__init__(self, fname)\n", + " self.__name=sname\n", + " def show(self):\n", + " print \"Son name:\", self.__name\n", + "fp=[Father]\n", + "f1=Father(\"Eshwarappa\")\n", + "fp=f1\n", + "fp.show()\n", + "s1=Son(\"Rajkumar\", \"Eshwarappa\")\n", + "fp=s1\n", + "fp.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Father name: Eshwarappa\n", + "Son name: Rajkumar\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-family1.cpp, Page no-622" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Father():\n", + " __f_age=int\n", + " def __init__(self, n):\n", + " self.__f_age=n\n", + " def GetAge(self):\n", + " return self.__f_age\n", + "class Son(Father):\n", + " __s_age=int\n", + " def __init__(self, n, m):\n", + " Father.__init__(self, n)\n", + " self.__s_age=m\n", + " def GetAge(self):\n", + " return self.__s_age\n", + " def son_func(self):\n", + " print \"son's own function\"\n", + "basep=[Father]\n", + "basep=Father(45)\n", + "print \"basep points to base object...\"\n", + "print \"Father's Age:\",\n", + "print basep.GetAge()\n", + "del basep\n", + "basep=[Son(45, 20)]\n", + "print \"basep points to derived object...\"\n", + "print \"Son's Age:\",\n", + "print Father.GetAge(basep[0])\n", + "print \"By typecasting, ((Son*) basep)...\"\n", + "print \"Son's age:\",basep[0].GetAge()\n", + "del basep\n", + "son1=Son(45, 20)\n", + "derivedp=[son1]\n", + "print \"accessing through derived class pointer...\"\n", + "print \"Son's Age:\",\n", + "print derivedp[0].GetAge()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "basep points to base object...\n", + "Father's Age: 45\n", + "basep points to derived object...\n", + "Son's Age: 45\n", + "By typecasting, ((Son*) basep)...\n", + "Son's age: 20\n", + "accessing through derived class pointer...\n", + "Son's Age: 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-family2.cpp, Page no-626" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Father():\n", + " __f_age=int\n", + " def __init__(self, n):\n", + " self.__f_age=n\n", + " def GetAge(self):\n", + " return self.__f_age\n", + "class Son(Father):\n", + " __s_age=int\n", + " def __init__(self, n, m):\n", + " Father.__init__(self, n)\n", + " self.__s_age=m\n", + " def GetAge(self):\n", + " return self.__s_age\n", + "basep=[Father]\n", + "basep=Father(45)\n", + "print \"Father's Age:\",\n", + "print basep.GetAge()\n", + "del basep\n", + "basep=[Son(45, 20)]\n", + "print \"Son's Age:\",\n", + "print basep[0].GetAge()\n", + "del basep" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Father's Age: 45\n", + "Son's Age: 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-draw.cpp, Page no-629" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class graphics:\n", + " def draw(self):\n", + " print \"point\"\n", + "class line(graphics):\n", + " def draw(self):\n", + " print \"line\"\n", + "class triangle(graphics):\n", + " def draw(self):\n", + " print \"triangle\"\n", + "class rectangle(graphics):\n", + " def draw(self):\n", + " print \"rectangle\"\n", + "class circle(graphics):\n", + " def draw(self):\n", + " print \"circle\"\n", + "point_obj=graphics()\n", + "line_obj=line()\n", + "tri_obj=triangle()\n", + "rect_obj=rectangle()\n", + "circle_obj=circle()\n", + "basep=[]\n", + "basep.append(point_obj)\n", + "basep.append(line_obj)\n", + "basep.append(tri_obj)\n", + "basep.append(rect_obj)\n", + "basep.append(circle_obj)\n", + "print \"Following figures are drawn with basep[i]->draw()...\"\n", + "for i in range(5):\n", + " basep[i].draw()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Following figures are drawn with basep[i]->draw()...\n", + "point\n", + "line\n", + "triangle\n", + "rectangle\n", + "circle\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-pure.cpp, Page no-632" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class AbsPerson:\n", + " def Service1(self, n):\n", + " self.Service2(n)\n", + " def Service2(self, n): #pure virtual function\n", + " pass\n", + "class Person(AbsPerson):\n", + " def Service2(self, n):\n", + " print \"The number of years of service:\", 58-n\n", + "Father=Person()\n", + "Son=Person()\n", + "Father.Service1(50)\n", + "Son.Service2(20)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number of years of service: 8\n", + "The number of years of service: 38\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-number.cpp, Page no-633" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class number:\n", + " __num=int\n", + " def getdata(self):\n", + " self.__num=int(raw_input(\"Enter an integer number: \"))\n", + " def show(self): #pure virtual function\n", + " pass\n", + "class octnum(number):\n", + " def show(self):\n", + " print \"Octal equivalent of\", self._number__num,\"=\",oct(self._number__num)\n", + "class hexnum(number):\n", + " def show(self):\n", + " print \"Hexadecimal equivalent of\", self._number__num,\"=\",hex(self._number__num)\n", + "o1=octnum()\n", + "h1=hexnum()\n", + "o1.getdata()\n", + "o1.show()\n", + "h1.getdata()\n", + "h1.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an integer number: 11\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Octal equivalent of 11 = 013\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an integer number: 11\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hexadecimal equivalent of 11 = 0xb\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-family3.cpp, Page no-637" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Father():\n", + " __f_name=str\n", + " def __init__(self, fname):\n", + " self.__f_name=fname\n", + " def __del__(self):\n", + " del self.__f_name\n", + " print \"~Father() is invoked\"\n", + " def show(self):\n", + " print \"Father's name:\", self.__f_name\n", + "class Son(Father):\n", + " __s_name=str\n", + " def __init__(self, sname, fname):\n", + " Father.__init__(self, fname)\n", + " self.__s_name=sname\n", + " def __del__(self):\n", + " del self.__s_name\n", + " print \"~Son() is invoked\"\n", + " Father.__del__(self)\n", + " def show(self):\n", + " print \"Father's name:\", self._Father__f_name\n", + " print \"Son's name:\", self.__s_name\n", + "basep=[Father]\n", + "basep=Father(\"Eshwarappa\")\n", + "print \"basep points to base object...\"\n", + "basep.show()\n", + "del basep\n", + "basep=Son(\"Rajkumar\", \"Eshwarappa\")\n", + "print \"basep points to derived object...\"\n", + "basep.show()\n", + "del basep" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "basep points to base object...\n", + "Father's name: Eshwarappa\n", + "~Father() is invoked\n", + "basep points to derived object...\n", + "Father's name: Eshwarappa\n", + "Son's name: Rajkumar\n", + "~Son() is invoked\n", + "~Father() is invoked\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vptrsize.cpp, Page no-640" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure, c_int, sizeof\n", + "class nonvirtual(Structure):\n", + " _fields_=[('x', c_int)]\n", + " def func(self):\n", + " pass\n", + "class withvirtual(Structure):\n", + " _fields_=[('x', c_int)]\n", + " def func(self):\n", + " pass\n", + "print \"sizeof( nonvirtual ) =\",sizeof(nonvirtual())\n", + "print \"sizeof( withvirtual ) =\",sizeof(withvirtual())" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sizeof( nonvirtual ) = 4\n", + "sizeof( withvirtual ) = 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-shapes.cpp, Page no-640" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class description:\n", + " __information=str\n", + " def __init__(self, info):\n", + " self.__information=info\n", + " def show(self):\n", + " print self.__information,\n", + "class sphere(description):\n", + " __radius=float\n", + " def __init__(self, info, rad):\n", + " description.__init__(self, info)\n", + " self.__radius=rad\n", + " def show(self):\n", + " print self._description__information,\n", + " print \"Radius = %g\" %self.__radius\n", + "class cube(description):\n", + " __edge_length=float\n", + " def __init__(self, info, edg_len):\n", + " description.__init__(self, info)\n", + " self.__edge_length=edg_len\n", + " def show(self):\n", + " print self._description__information,\n", + " print \"Edge Length = %g\" %self.__edge_length\n", + "small_ball=sphere(\"mine\", 1.0)\n", + "beach_ball=sphere(\"plane\", 24.0)\n", + "plan_toid=sphere(\"moon\", 1e24)\n", + "crystal=cube(\"carbon\", 1e-24)\n", + "ice=cube(\"party\", 1.0)\n", + "box=cube(\"card borad\", 16.0)\n", + "shapes=[]\n", + "shapes.append(small_ball)\n", + "shapes.append(beach_ball)\n", + "shapes.append(plan_toid)\n", + "shapes.append(crystal)\n", + "shapes.append(ice)\n", + "shapes.append(box)\n", + "small_ball.show()\n", + "beach_ball.show()\n", + "plan_toid.show()\n", + "crystal.show()\n", + "ice.show()\n", + "box.show()\n", + "print \"Dynamic Invocation of show()...\"\n", + "for i in range(len(shapes)):\n", + " shapes[i].show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mine Radius = 1\n", + "plane Radius = 24\n", + "moon Radius = 1e+24\n", + "carbon Edge Length = 1e-24\n", + "party Edge Length = 1\n", + "card borad Edge Length = 16\n", + "Dynamic Invocation of show()...\n", + "mine Radius = 1\n", + "plane Radius = 24\n", + "moon Radius = 1e+24\n", + "carbon Edge Length = 1e-24\n", + "party Edge Length = 1\n", + "card borad Edge Length = 16\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example, Page no-643" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class shape:\n", + " __val1=float\n", + " __val2=float\n", + " def getdata(self, a, b):\n", + " self.__val1=a\n", + " self.__val2=b\n", + " def display_area(self):\n", + " pass\n", + "class triangle(shape):\n", + " def display_area(self):\n", + " print \"Area of trianle =\", 0.5*self._shape__val1*self._shape__val2\n", + "class rectangle(shape):\n", + " def display_area(self):\n", + " print \"Area of rectanle =\", self._shape__val1*self._shape__val2\n", + "sptr=[shape]\n", + "sptr=triangle()\n", + "sptr.getdata(4.5, 2.2)\n", + "sptr.display_area()\n", + "sptr=rectangle()\n", + "sptr.getdata(4.5, 2.2)\n", + "sptr.display_area()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of trianle = 4.95\n", + "Area of rectanle = 9.9\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates.ipynb new file mode 100755 index 00000000..88641652 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates.ipynb @@ -0,0 +1,1512 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d003edbba5e427e459c859a79576baaf788de0196f037fb26a675631e1e101bf" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 16-Generic Programming with Templates" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mswap.cpp, Page no-647" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y): #function overloading\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch1, ch2 = swap(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "a, b = swap(a, b)\n", + "print \"On swapping :\", a,b\n", + "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", + "c, d = swap(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-gswap.cpp, Page no-650" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch1, ch2 = swap(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "a, b = swap(a, b)\n", + "print \"On swapping :\", a,b\n", + "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", + "c, d = swap(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-max1.cpp, Page no-651" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(a, b):\n", + " if a>b:\n", + " return a\n", + " else:\n", + " return b\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch = Max(ch1, ch2)\n", + "print \"max( ch1, ch2 ):\", ch\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "c = Max(a, b)\n", + "print \"max( a, b ):\", c\n", + "f1, f2=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", + "f3 = Max(f1, f2)\n", + "print \"max( f1, f2 ):\", f3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : A B\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max( ch1, ch2 ): B\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 20 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max( a, b ): 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two floats : 20.5 30.9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max( f1, f2 ): 30.9\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-max2.cpp, Page no-653" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(a, b):\n", + " if a>b:\n", + " return a\n", + " else:\n", + " return b\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch = Max(ch1, ch2)\n", + "print \"max( ch1, ch2 ):\", ch\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "c = Max(a, b)\n", + "print \"max( a, b ):\", c\n", + "str1, str2=raw_input(\"Enter two strings : \").split()\n", + "print \"max( str1, str2 ):\", Max(str1, str2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : A Z\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max( ch1, ch2 ): Z\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 5 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max( a, b ): 6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two strings : Tejaswi Rajkumar\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max( str1, str2 ): Tejaswi\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-bsort.cpp, Page no-654" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "[false, true]=[0, 1]\n", + "type=['false', 'true']\n", + "def swap(x, y): #function overloading\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "def BubbleSort(SortData, Size):\n", + " swapped=true\n", + " for i in range(Size-1):\n", + " if swapped==true:\n", + " swapped=false\n", + " for j in range((Size-1)-i):\n", + " if SortData[j]>SortData[j+1]:\n", + " swapped=true\n", + " SortData[j], SortData[j+1]=swap(SortData[j], SortData[j+1])\n", + "IntNums=[int]*25\n", + "FloatNums=[float]*25\n", + "print \"Program to sort elements...\"\n", + "#Integer numbers sorting\n", + "size=int(raw_input(\"Enter the size of the integer vector :\"))\n", + "print \"Enter the elements of the integer vector...\"\n", + "for i in range(size):\n", + " IntNums[i]=int(raw_input())\n", + "BubbleSort(IntNums, size)\n", + "print \"Sorted Vector:\"\n", + "for i in range(size):\n", + " print IntNums[i],\n", + "#Floating point numbers sorting\n", + "size=int(raw_input(\"Enter the size of the float vector :\"))\n", + "print \"Enter the elements of the float vector...\"\n", + "for i in range(size):\n", + " FloatNums[i]=float(raw_input())\n", + "BubbleSort(FloatNums, size)\n", + "print \"Sorted Vector:\"\n", + "for i in range(size):\n", + " print FloatNums[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Program to sort elements...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the size of the integer vector :4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the elements of the integer vector...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sorted Vector:\n", + "1 4 6 8" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the size of the float vector :3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the elements of the float vector...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3.2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8.9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sorted Vector:\n", + "3.2 8.5 8.9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-tprint.cpp, Page no-656" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Print(data, nTimes=None):\n", + " if isinstance(nTimes, int):\n", + " for i in range(nTimes):\n", + " print data\n", + " else:\n", + " print data\n", + "Print(1)\n", + "Print(1.5)\n", + "Print(520, 2)\n", + "Print(\"OOP is Great\", 3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "1.5\n", + "520\n", + "520\n", + "OOP is Great\n", + "OOP is Great\n", + "OOP is Great\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-bsearch.cpp, Page no-658" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "[false, true]=[0, 1]\n", + "type=['false', 'true']\n", + "def RecBinSearch(Data, SrchElem, low, high):\n", + " if low>high:\n", + " return -1\n", + " mid=int((low+high)/2)\n", + " if SrchElemData[mid]:\n", + " return RecBinSearch(Data, SrchElem, mid+1, high)\n", + " return mid\n", + "num=[int]*25\n", + "FloatNums=[float]*25\n", + "print \"Program to search integer elements...\"\n", + "size=int(raw_input(\"How many elements ? \"))\n", + "print \"Enter the elements in ascending order for binary search...\"\n", + "for i in range(size):\n", + " num[i]=int(raw_input())\n", + "elem=int(raw_input(\"Enter the element to be searched: \"))\n", + "index=RecBinSearch(num, elem, 0, size)\n", + "if index==-1:\n", + " print \"Element\", elem, \"not found\"\n", + "else:\n", + " print \"Element\", elem, \"found at position\", index" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Program to search integer elements...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many elements ? 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the elements in ascending order for binary search...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the element to be searched: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element 6 found at position 2\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student.cpp, Page no-661" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class stuRec(Structure):\n", + " name=str\n", + " age=int\n", + " collegeCode=str\n", + "def Display(t):\n", + " print t\n", + "def output(s):\n", + " print \"Name:\", s.name\n", + " print \"Age:\", s.age\n", + " print \"College Code:\", s.collegeCode\n", + "s1=stuRec()\n", + "print \"Enter student record details...\"\n", + "s1.name=raw_input(\"Name: \")\n", + "s1.age=int(raw_input(\"Age: \"))\n", + "s1.collegeCode=raw_input(\"College Code: \")\n", + "print \"The student record:\"\n", + "print \"Name:\",\n", + "Display(s1.name)\n", + "print \"Age:\",\n", + "Display(s1.age)\n", + "print \"College Code:\",\n", + "Display(s1.collegeCode)\n", + "print \"The student record:\"\n", + "output(s1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter student record details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Chinamma\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 18\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "College Code: A\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The student record:\n", + "Name: Chinamma\n", + "Age: 18\n", + "College Code: A\n", + "The student record:\n", + "Name: Chinamma\n", + "Age: 18\n", + "College Code: A\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector.cpp, Page no-665" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class vector:\n", + " __size=int\n", + " def __init__(self, vector_size):\n", + " self.__size=vector_size\n", + " self.__v=[vector]*self.__size\n", + " def __del__(self):\n", + " del self.__v\n", + " def elem(self, i, x=None):\n", + " if isinstance(x, int) or isinstance(x, float):\n", + " if i>=self.__size:\n", + " print \"Error: Out of Range\"\n", + " return\n", + " self.__v[i]=x\n", + " else:\n", + " return self.__v[i]\n", + " def show(self):\n", + " for i in range(self.__size):\n", + " print self.elem(i), \",\",\n", + "int_vect=vector(5)\n", + "float_vect=vector(4)\n", + "for i in range(5):\n", + " int_vect.elem(i, i+1)\n", + "for i in range(4):\n", + " float_vect.elem(i,i+1.5)\n", + "print \"Integer Vector:\",\n", + "int_vect.show()\n", + "print \"\\nFloating Vector:\",\n", + "float_vect.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer Vector: 1 , 2 , 3 , 4 , 5 , \n", + "Floating Vector: 1.5 , 2.5 , 3.5 , 4.5 ,\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-union.cpp, Page no-670" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "(false, true)=(0, 1) #enum type\n", + "type =['false', 'true']\n", + "MAX_ITEMS=25\n", + "def IsExist(self, item):\n", + " for i in range(self._Bag__ItemCount):\n", + " if self._Bag__contents[i]==item:\n", + " return true\n", + " return false\n", + "def show(self):\n", + " for i in range(self._Bag__ItemCount):\n", + " print self._Bag__contents[i],\n", + " print \"\"\n", + "class Bag:\n", + " #protected members\n", + " __ItemCount=int\n", + " def __init__(self):\n", + " self.__ItemCount=0\n", + " self.__contents=[int]*MAX_ITEMS\n", + " def put(self, item):\n", + " self.__contents[self.__ItemCount]=item\n", + " self.__ItemCount+=1\n", + " def IsEmpty(self):\n", + " return true if self.__ItemCount==0 else false\n", + " def IsFull(self):\n", + " return true if self.__ItemCount==MAX_ITEMS else false\n", + " IsExist=IsExist\n", + " show=show\n", + "def read(self):\n", + " while(true):\n", + " element=int(raw_input(\"Enter Set Element <0-end>: \"))\n", + " if element==0:\n", + " break\n", + " self.Add(element)\n", + "def add(s1, s2):\n", + " temp = Set()\n", + " temp=s1\n", + " for i in range(s2._Bag__ItemCount):\n", + " if s1.IsExist(s2._Bag__contents[i])==false:\n", + " temp.Add(s2._Bag__contents[i])\n", + " return temp\n", + "class Set(Bag):\n", + " def Add(self,element):\n", + " if(self.IsExist(element)==false and self.IsFull()==false):\n", + " self.put(element)\n", + " read=read\n", + " def __assign__(self, s2):\n", + " for i in range(s2._Bag__ItemCount):\n", + " self.__contents[i]=s2.__contents[i]\n", + " self.__ItemCount=s2.__ItemCount\n", + " def __add__(self, s2):\n", + " return add(self, s2)\n", + "s1=Set()\n", + "s2=Set()\n", + "s3=Set()\n", + "print \"Enter Set 1 elements..\"\n", + "s1.read()\n", + "print \"Enter Set 2 elemets..\"\n", + "s2.read()\n", + "s3=s1+s2\n", + "print \"Union of s1 and s2 : \",\n", + "s3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set 1 elements..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set 2 elemets..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Union of s1 and s2 : 1 2 3 4 5 6 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-tree.cpp, Page no-673" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class TreeNode:\n", + " def __init__(self, dataIn, l, r):\n", + " if isinstance(l, TreeNode):\n", + " self.__left=l\n", + " self.__right=r\n", + " else:\n", + " self.__left=None\n", + " self.__right=None\n", + " self.__data=dataIn\n", + "class BinaryTree:\n", + " __root=None\n", + " def InsertNode(self, tree, data):\n", + " if tree==None:\n", + " tree=TreeNode(data, None, None)\n", + " return tree\n", + " if datatree._TreeNode__data:\n", + " tree._TreeNode__right=self.InsertNode(tree._TreeNode__right, data)\n", + " return tree\n", + " def PrintTreeTriangle(self, tree, level):\n", + " if tree:\n", + " self.PrintTreeTriangle(tree._TreeNode__right, level+1)\n", + " for i in range(level):\n", + " print \"\\t\",\n", + " print \"%g\" %tree._TreeNode__data\n", + " self.PrintTreeTriangle(tree._TreeNode__left, level+1)\n", + " def PrintTreeDiagonal(self, tree, level):\n", + " if tree!=None:\n", + " for i in range(level):\n", + " print \"\\t\",\n", + " print \"%g\" %tree._TreeNode__data\n", + " self.PrintTreeTriangle(tree._TreeNode__left, level+1)\n", + " self.PrintTreeTriangle(tree._TreeNode__right, level+1)\n", + " def PreOrderTraverse(self, tree):\n", + " if tree:\n", + " print \"%g\" %tree._TreeNode__data,\n", + " self.PreOrderTraverse(tree._TreeNode__left)\n", + " self.PreOrderTraverse(tree._TreeNode__right)\n", + " def InOrderTraverse(self, tree):\n", + " if tree:\n", + " self.InOrderTraverse(tree._TreeNode__left)\n", + " print \"%g\" %tree._TreeNode__data,\n", + " self.InOrderTraverse(tree._TreeNode__right)\n", + " def PostOrderTraverse(self, tree):\n", + " if tree:\n", + " self.PostOrderTraverse(tree._TreeNode__left)\n", + " self.PostOrderTraverse(tree._TreeNode__right)\n", + " print \"%g\" %tree._TreeNode__data,\n", + " def SearchTree(self, tree, data):\n", + " while(tree):\n", + " if datatree._TreeNode__data:\n", + " tree=tree._TreeNode__right\n", + " else:\n", + " return tree\n", + " return None\n", + " def PreOrder(self):\n", + " self.PreOrderTraverse(self.__root)\n", + " def InOrder(self):\n", + " self.InOrderTraverse(self.__root)\n", + " def PostOrder(self):\n", + " self.PostOrderTraverse(self.__root)\n", + " def PrintTree(self, disptype):\n", + " if disptype==1:\n", + " self.PrintTreeTriangle(self.__root, 1)\n", + " else:\n", + " self.PrintTreeDiagonal(self.__root, 1)\n", + " def Insert(self, data):\n", + " self.__root=self.InsertNode(self.__root, data)\n", + " def Search(self, data):\n", + " return self.SearchTree(self.__root, data)\n", + "btree=BinaryTree()\n", + "print \"This Program Demonstrates the Binary Tree Operations\"\n", + "disptype=int(raw_input(\"Tree Diplay Style: [1] - Triangular [2] - Diagonal form: \"))\n", + "print \"Tree creation process...\"\n", + "while 1:\n", + " data=float(raw_input(\"Enter node number to be inserted <0-END>: \"))\n", + " if data==0:\n", + " break\n", + " btree.Insert(data)\n", + " print \"Binary Tree is...\"\n", + " btree.PrintTree(disptype)\n", + " print \"Pre-Order Traversal:\",\n", + " btree.PreOrder()\n", + " print \"\\nIn-Order Traversal:\",\n", + " btree.InOrder()\n", + " print \"\\nPost-Order Traversal:\",\n", + " btree.PostOrder()\n", + " print \"\"\n", + "print \"Tree search process...\"\n", + "while(1):\n", + " data=float(raw_input(\"Enter node number to be inserted <0-END>: \"))\n", + " if data==0:\n", + " break\n", + " if btree.Search(data):\n", + " print \"Found data in the Tree\"\n", + " else:\n", + " print \"Not found data in the Tree\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This Program Demonstrates the Binary Tree Operations\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Tree Diplay Style: [1] - Triangular [2] - Diagonal form: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Tree creation process...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binary Tree is...\n", + "\t5\n", + "Pre-Order Traversal: 5 \n", + "In-Order Traversal: 5 \n", + "Post-Order Traversal: 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binary Tree is...\n", + "\t5\n", + "\t\t3\n", + "Pre-Order Traversal: 5 3 \n", + "In-Order Traversal: 3 5 \n", + "Post-Order Traversal: 3 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binary Tree is...\n", + "\t\t8\n", + "\t5\n", + "\t\t3\n", + "Pre-Order Traversal: 5 3 8 \n", + "In-Order Traversal: 3 5 8 \n", + "Post-Order Traversal: 3 8 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binary Tree is...\n", + "\t\t8\n", + "\t5\n", + "\t\t3\n", + "\t\t\t2\n", + "Pre-Order Traversal: 5 3 2 8 \n", + "In-Order Traversal: 2 3 5 8 \n", + "Post-Order Traversal: 2 3 8 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binary Tree is...\n", + "\t\t\t9\n", + "\t\t8\n", + "\t5\n", + "\t\t3\n", + "\t\t\t2\n", + "Pre-Order Traversal: 5 3 2 8 9 \n", + "In-Order Traversal: 2 3 5 8 9 \n", + "Post-Order Traversal: 2 3 9 8 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Tree search process...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Found data in the Tree\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Not found data in the Tree\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex.cpp, Page no-679" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __add__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "class Complex:\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " #overloading + operator\n", + " __add__=__add__\n", + " def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Addition of integer complex objects...\"\n", + "print \"Enter Complex Number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.getdata()\n", + "c3=c1+c2 #invoking the overloaded + operator\n", + "c3.outdata(\"c3 = c1 + c2: \")\n", + "c4=Complex()\n", + "c5=Complex()\n", + "c6=Complex()\n", + "print \"Addition of float complex objects...\"\n", + "print \"Enter Complex Number c4...\"\n", + "c4.getdata()\n", + "print \"Enter Complex Number c5...\"\n", + "c5.getdata()\n", + "c6=c4+c5 #invoking the overloaded + operator\n", + "c6.outdata(\"c6 = c4 + c5: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Addition of integer complex objects...\n", + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c3 = c1 + c2: (4, 6)\n", + "Addition of float complex objects...\n", + "Enter Complex Number c4...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 1.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c5...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 2.4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 3.7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c6 = c4 + c5: (3.9, 6.2)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-680" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "N=5\n", + "def Min(arr):\n", + " m=arr[0]\n", + " for i in range(N):\n", + " if arr[i]: \").split()]\n", + "ch1, ch2 = swap(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "a, b = swap(a, b)\n", + "print \"On swapping :\", a,b\n", + "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", + "c, d = swap(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-gswap.cpp, Page no-650" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch1, ch2 = swap(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "a, b = swap(a, b)\n", + "print \"On swapping :\", a,b\n", + "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", + "c, d = swap(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-max1.cpp, Page no-651" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(a, b):\n", + " if a>b:\n", + " return a\n", + " else:\n", + " return b\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch = Max(ch1, ch2)\n", + "print \"max( ch1, ch2 ):\", ch\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "c = Max(a, b)\n", + "print \"max( a, b ):\", c\n", + "f1, f2=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", + "f3 = Max(f1, f2)\n", + "print \"max( f1, f2 ):\", f3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : A B\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max( ch1, ch2 ): B\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 20 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max( a, b ): 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two floats : 20.5 30.9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max( f1, f2 ): 30.9\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-max2.cpp, Page no-653" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(a, b):\n", + " if a>b:\n", + " return a\n", + " else:\n", + " return b\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch = Max(ch1, ch2)\n", + "print \"max( ch1, ch2 ):\", ch\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "c = Max(a, b)\n", + "print \"max( a, b ):\", c\n", + "str1, str2=raw_input(\"Enter two strings : \").split()\n", + "print \"max( str1, str2 ):\", Max(str1, str2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : A Z\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max( ch1, ch2 ): Z\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 5 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max( a, b ): 6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two strings : Tejaswi Rajkumar\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max( str1, str2 ): Tejaswi\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-bsort.cpp, Page no-654" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "[false, true]=[0, 1]\n", + "type=['false', 'true']\n", + "def swap(x, y): #function overloading\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "def BubbleSort(SortData, Size):\n", + " swapped=true\n", + " for i in range(Size-1):\n", + " if swapped==true:\n", + " swapped=false\n", + " for j in range((Size-1)-i):\n", + " if SortData[j]>SortData[j+1]:\n", + " swapped=true\n", + " SortData[j], SortData[j+1]=swap(SortData[j], SortData[j+1])\n", + "IntNums=[int]*25\n", + "FloatNums=[float]*25\n", + "print \"Program to sort elements...\"\n", + "#Integer numbers sorting\n", + "size=int(raw_input(\"Enter the size of the integer vector :\"))\n", + "print \"Enter the elements of the integer vector...\"\n", + "for i in range(size):\n", + " IntNums[i]=int(raw_input())\n", + "BubbleSort(IntNums, size)\n", + "print \"Sorted Vector:\"\n", + "for i in range(size):\n", + " print IntNums[i],\n", + "#Floating point numbers sorting\n", + "size=int(raw_input(\"Enter the size of the float vector :\"))\n", + "print \"Enter the elements of the float vector...\"\n", + "for i in range(size):\n", + " FloatNums[i]=float(raw_input())\n", + "BubbleSort(FloatNums, size)\n", + "print \"Sorted Vector:\"\n", + "for i in range(size):\n", + " print FloatNums[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Program to sort elements...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the size of the integer vector :4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the elements of the integer vector...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sorted Vector:\n", + "1 4 6 8" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the size of the float vector :3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the elements of the float vector...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3.2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8.9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sorted Vector:\n", + "3.2 8.5 8.9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-tprint.cpp, Page no-656" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Print(data, nTimes=None):\n", + " if isinstance(nTimes, int):\n", + " for i in range(nTimes):\n", + " print data\n", + " else:\n", + " print data\n", + "Print(1)\n", + "Print(1.5)\n", + "Print(520, 2)\n", + "Print(\"OOP is Great\", 3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "1.5\n", + "520\n", + "520\n", + "OOP is Great\n", + "OOP is Great\n", + "OOP is Great\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-bsearch.cpp, Page no-658" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "[false, true]=[0, 1]\n", + "type=['false', 'true']\n", + "def RecBinSearch(Data, SrchElem, low, high):\n", + " if low>high:\n", + " return -1\n", + " mid=int((low+high)/2)\n", + " if SrchElemData[mid]:\n", + " return RecBinSearch(Data, SrchElem, mid+1, high)\n", + " return mid\n", + "num=[int]*25\n", + "FloatNums=[float]*25\n", + "print \"Program to search integer elements...\"\n", + "size=int(raw_input(\"How many elements ? \"))\n", + "print \"Enter the elements in ascending order for binary search...\"\n", + "for i in range(size):\n", + " num[i]=int(raw_input())\n", + "elem=int(raw_input(\"Enter the element to be searched: \"))\n", + "index=RecBinSearch(num, elem, 0, size)\n", + "if index==-1:\n", + " print \"Element\", elem, \"not found\"\n", + "else:\n", + " print \"Element\", elem, \"found at position\", index" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Program to search integer elements...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many elements ? 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the elements in ascending order for binary search...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the element to be searched: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Element 6 found at position 2\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student.cpp, Page no-661" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure\n", + "class stuRec(Structure):\n", + " name=str\n", + " age=int\n", + " collegeCode=str\n", + "def Display(t):\n", + " print t\n", + "def output(s):\n", + " print \"Name:\", s.name\n", + " print \"Age:\", s.age\n", + " print \"College Code:\", s.collegeCode\n", + "s1=stuRec()\n", + "print \"Enter student record details...\"\n", + "s1.name=raw_input(\"Name: \")\n", + "s1.age=int(raw_input(\"Age: \"))\n", + "s1.collegeCode=raw_input(\"College Code: \")\n", + "print \"The student record:\"\n", + "print \"Name:\",\n", + "Display(s1.name)\n", + "print \"Age:\",\n", + "Display(s1.age)\n", + "print \"College Code:\",\n", + "Display(s1.collegeCode)\n", + "print \"The student record:\"\n", + "output(s1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter student record details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Chinamma\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 18\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "College Code: A\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The student record:\n", + "Name: Chinamma\n", + "Age: 18\n", + "College Code: A\n", + "The student record:\n", + "Name: Chinamma\n", + "Age: 18\n", + "College Code: A\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector.cpp, Page no-665" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class vector:\n", + " __size=int\n", + " def __init__(self, vector_size):\n", + " self.__size=vector_size\n", + " self.__v=[vector]*self.__size\n", + " def __del__(self):\n", + " del self.__v\n", + " def elem(self, i, x=None):\n", + " if isinstance(x, int) or isinstance(x, float):\n", + " if i>=self.__size:\n", + " print \"Error: Out of Range\"\n", + " return\n", + " self.__v[i]=x\n", + " else:\n", + " return self.__v[i]\n", + " def show(self):\n", + " for i in range(self.__size):\n", + " print self.elem(i), \",\",\n", + "int_vect=vector(5)\n", + "float_vect=vector(4)\n", + "for i in range(5):\n", + " int_vect.elem(i, i+1)\n", + "for i in range(4):\n", + " float_vect.elem(i,i+1.5)\n", + "print \"Integer Vector:\",\n", + "int_vect.show()\n", + "print \"\\nFloating Vector:\",\n", + "float_vect.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer Vector: 1 , 2 , 3 , 4 , 5 , \n", + "Floating Vector: 1.5 , 2.5 , 3.5 , 4.5 ,\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-union.cpp, Page no-670" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "(false, true)=(0, 1) #enum type\n", + "type =['false', 'true']\n", + "MAX_ITEMS=25\n", + "def IsExist(self, item):\n", + " for i in range(self._Bag__ItemCount):\n", + " if self._Bag__contents[i]==item:\n", + " return true\n", + " return false\n", + "def show(self):\n", + " for i in range(self._Bag__ItemCount):\n", + " print self._Bag__contents[i],\n", + " print \"\"\n", + "class Bag:\n", + " #protected members\n", + " __ItemCount=int\n", + " def __init__(self):\n", + " self.__ItemCount=0\n", + " self.__contents=[int]*MAX_ITEMS\n", + " def put(self, item):\n", + " self.__contents[self.__ItemCount]=item\n", + " self.__ItemCount+=1\n", + " def IsEmpty(self):\n", + " return true if self.__ItemCount==0 else false\n", + " def IsFull(self):\n", + " return true if self.__ItemCount==MAX_ITEMS else false\n", + " IsExist=IsExist\n", + " show=show\n", + "def read(self):\n", + " while(true):\n", + " element=int(raw_input(\"Enter Set Element <0-end>: \"))\n", + " if element==0:\n", + " break\n", + " self.Add(element)\n", + "def add(s1, s2):\n", + " temp = Set()\n", + " temp=s1\n", + " for i in range(s2._Bag__ItemCount):\n", + " if s1.IsExist(s2._Bag__contents[i])==false:\n", + " temp.Add(s2._Bag__contents[i])\n", + " return temp\n", + "class Set(Bag):\n", + " def Add(self,element):\n", + " if(self.IsExist(element)==false and self.IsFull()==false):\n", + " self.put(element)\n", + " read=read\n", + " def __assign__(self, s2):\n", + " for i in range(s2._Bag__ItemCount):\n", + " self.__contents[i]=s2.__contents[i]\n", + " self.__ItemCount=s2.__ItemCount\n", + " def __add__(self, s2):\n", + " return add(self, s2)\n", + "s1=Set()\n", + "s2=Set()\n", + "s3=Set()\n", + "print \"Enter Set 1 elements..\"\n", + "s1.read()\n", + "print \"Enter Set 2 elemets..\"\n", + "s2.read()\n", + "s3=s1+s2\n", + "print \"Union of s1 and s2 : \",\n", + "s3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set 1 elements..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set 2 elemets..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Set Element <0-end>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Union of s1 and s2 : 1 2 3 4 5 6 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-tree.cpp, Page no-673" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class TreeNode:\n", + " def __init__(self, dataIn, l, r):\n", + " if isinstance(l, TreeNode):\n", + " self.__left=l\n", + " self.__right=r\n", + " else:\n", + " self.__left=None\n", + " self.__right=None\n", + " self.__data=dataIn\n", + "class BinaryTree:\n", + " __root=None\n", + " def InsertNode(self, tree, data):\n", + " if tree==None:\n", + " tree=TreeNode(data, None, None)\n", + " return tree\n", + " if datatree._TreeNode__data:\n", + " tree._TreeNode__right=self.InsertNode(tree._TreeNode__right, data)\n", + " return tree\n", + " def PrintTreeTriangle(self, tree, level):\n", + " if tree:\n", + " self.PrintTreeTriangle(tree._TreeNode__right, level+1)\n", + " for i in range(level):\n", + " print \"\\t\",\n", + " print \"%g\" %tree._TreeNode__data\n", + " self.PrintTreeTriangle(tree._TreeNode__left, level+1)\n", + " def PrintTreeDiagonal(self, tree, level):\n", + " if tree!=None:\n", + " for i in range(level):\n", + " print \"\\t\",\n", + " print \"%g\" %tree._TreeNode__data\n", + " self.PrintTreeTriangle(tree._TreeNode__left, level+1)\n", + " self.PrintTreeTriangle(tree._TreeNode__right, level+1)\n", + " def PreOrderTraverse(self, tree):\n", + " if tree:\n", + " print \"%g\" %tree._TreeNode__data,\n", + " self.PreOrderTraverse(tree._TreeNode__left)\n", + " self.PreOrderTraverse(tree._TreeNode__right)\n", + " def InOrderTraverse(self, tree):\n", + " if tree:\n", + " self.InOrderTraverse(tree._TreeNode__left)\n", + " print \"%g\" %tree._TreeNode__data,\n", + " self.InOrderTraverse(tree._TreeNode__right)\n", + " def PostOrderTraverse(self, tree):\n", + " if tree:\n", + " self.PostOrderTraverse(tree._TreeNode__left)\n", + " self.PostOrderTraverse(tree._TreeNode__right)\n", + " print \"%g\" %tree._TreeNode__data,\n", + " def SearchTree(self, tree, data):\n", + " while(tree):\n", + " if datatree._TreeNode__data:\n", + " tree=tree._TreeNode__right\n", + " else:\n", + " return tree\n", + " return None\n", + " def PreOrder(self):\n", + " self.PreOrderTraverse(self.__root)\n", + " def InOrder(self):\n", + " self.InOrderTraverse(self.__root)\n", + " def PostOrder(self):\n", + " self.PostOrderTraverse(self.__root)\n", + " def PrintTree(self, disptype):\n", + " if disptype==1:\n", + " self.PrintTreeTriangle(self.__root, 1)\n", + " else:\n", + " self.PrintTreeDiagonal(self.__root, 1)\n", + " def Insert(self, data):\n", + " self.__root=self.InsertNode(self.__root, data)\n", + " def Search(self, data):\n", + " return self.SearchTree(self.__root, data)\n", + "btree=BinaryTree()\n", + "print \"This Program Demonstrates the Binary Tree Operations\"\n", + "disptype=int(raw_input(\"Tree Diplay Style: [1] - Triangular [2] - Diagonal form: \"))\n", + "print \"Tree creation process...\"\n", + "while 1:\n", + " data=float(raw_input(\"Enter node number to be inserted <0-END>: \"))\n", + " if data==0:\n", + " break\n", + " btree.Insert(data)\n", + " print \"Binary Tree is...\"\n", + " btree.PrintTree(disptype)\n", + " print \"Pre-Order Traversal:\",\n", + " btree.PreOrder()\n", + " print \"\\nIn-Order Traversal:\",\n", + " btree.InOrder()\n", + " print \"\\nPost-Order Traversal:\",\n", + " btree.PostOrder()\n", + " print \"\"\n", + "print \"Tree search process...\"\n", + "while(1):\n", + " data=float(raw_input(\"Enter node number to be inserted <0-END>: \"))\n", + " if data==0:\n", + " break\n", + " if btree.Search(data):\n", + " print \"Found data in the Tree\"\n", + " else:\n", + " print \"Not found data in the Tree\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This Program Demonstrates the Binary Tree Operations\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Tree Diplay Style: [1] - Triangular [2] - Diagonal form: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Tree creation process...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binary Tree is...\n", + "\t5\n", + "Pre-Order Traversal: 5 \n", + "In-Order Traversal: 5 \n", + "Post-Order Traversal: 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binary Tree is...\n", + "\t5\n", + "\t\t3\n", + "Pre-Order Traversal: 5 3 \n", + "In-Order Traversal: 3 5 \n", + "Post-Order Traversal: 3 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binary Tree is...\n", + "\t\t8\n", + "\t5\n", + "\t\t3\n", + "Pre-Order Traversal: 5 3 8 \n", + "In-Order Traversal: 3 5 8 \n", + "Post-Order Traversal: 3 8 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binary Tree is...\n", + "\t\t8\n", + "\t5\n", + "\t\t3\n", + "\t\t\t2\n", + "Pre-Order Traversal: 5 3 2 8 \n", + "In-Order Traversal: 2 3 5 8 \n", + "Post-Order Traversal: 2 3 8 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Binary Tree is...\n", + "\t\t\t9\n", + "\t\t8\n", + "\t5\n", + "\t\t3\n", + "\t\t\t2\n", + "Pre-Order Traversal: 5 3 2 8 9 \n", + "In-Order Traversal: 2 3 5 8 9 \n", + "Post-Order Traversal: 2 3 9 8 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Tree search process...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Found data in the Tree\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Not found data in the Tree\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter node number to be inserted <0-END>: 0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex.cpp, Page no-679" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __add__(self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "class Complex:\n", + " def __init__(self):\n", + " self.__real=self.__imag=0\n", + " def getdata(self):\n", + " self.__real=float(raw_input(\"Real part ? \"))\n", + " self.__imag=float(raw_input(\"Imag part ? \"))\n", + " #overloading + operator\n", + " __add__=__add__\n", + " def outdata(self, msg):\n", + " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Addition of integer complex objects...\"\n", + "print \"Enter Complex Number c1...\"\n", + "c1.getdata()\n", + "print \"Enter Complex Number c2...\"\n", + "c2.getdata()\n", + "c3=c1+c2 #invoking the overloaded + operator\n", + "c3.outdata(\"c3 = c1 + c2: \")\n", + "c4=Complex()\n", + "c5=Complex()\n", + "c6=Complex()\n", + "print \"Addition of float complex objects...\"\n", + "print \"Enter Complex Number c4...\"\n", + "c4.getdata()\n", + "print \"Enter Complex Number c5...\"\n", + "c5.getdata()\n", + "c6=c4+c5 #invoking the overloaded + operator\n", + "c6.outdata(\"c6 = c4 + c5: \")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Addition of integer complex objects...\n", + "Enter Complex Number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c3 = c1 + c2: (4, 6)\n", + "Addition of float complex objects...\n", + "Enter Complex Number c4...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 1.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 2.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Complex Number c5...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part ? 2.4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imag part ? 3.7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c6 = c4 + c5: (3.9, 6.2)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-680" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "N=5\n", + "def Min(arr):\n", + " m=arr[0]\n", + " for i in range(N):\n", + " if arr[i]\n", + "63 ?\n", + "64 @\n", + "65 A\n", + "66 B\n", + "67 C\n", + "68 D\n", + "69 E\n", + "70 F\n", + "71 G\n", + "72 H\n", + "73 I\n", + "74 J\n", + "75 K\n", + "76 L\n", + "77 M\n", + "78 N\n", + "79 O\n", + "80 P\n", + "81 Q\n", + "82 R\n", + "83 S\n", + "84 T\n", + "85 U\n", + "86 V\n", + "87 W\n", + "88 X\n", + "89 Y\n", + "90 Z\n", + "91 [\n", + "92 \\\n", + "93 ]\n", + "94 ^\n", + "95 _\n", + "96 `\n", + "97 a\n", + "98 b\n", + "99 c\n", + "100 d\n", + "101 e\n", + "102 f\n", + "103 g\n", + "104 h\n", + "105 i\n", + "106 j\n", + "107 k\n", + "108 l\n", + "109 m\n", + "110 n\n", + "111 o\n", + "112 p\n", + "113 q\n", + "114 r\n", + "115 s\n", + "116 t\n", + "117 u\n", + "118 v\n", + "119 w\n", + "120 x\n", + "121 y\n", + "122 z\n", + "123 {\n", + "124 |\n", + "125 }\n", + "126 ~\n", + "127 \u007f\n", + "128 \ufffd\n", + "129 \ufffd\n", + "130 \ufffd\n", + "131 \ufffd\n", + "132 \ufffd\n", + "133 \ufffd\n", + "134 \ufffd\n", + "135 \ufffd\n", + "136 \ufffd\n", + "137 \ufffd\n", + "138 \ufffd\n", + "139 \ufffd\n", + "140 \ufffd\n", + "141 \ufffd\n", + "142 \ufffd\n", + "143 \ufffd\n", + "144 \ufffd\n", + "145 \ufffd\n", + "146 \ufffd\n", + "147 \ufffd\n", + "148 \ufffd\n", + "149 \ufffd\n", + "150 \ufffd\n", + "151 \ufffd\n", + "152 \ufffd\n", + "153 \ufffd\n", + "154 \ufffd\n", + "155 \ufffd\n", + "156 \ufffd\n", + "157 \ufffd\n", + "158 \ufffd\n", + "159 \ufffd\n", + "160 \ufffd\n", + "161 \ufffd\n", + "162 \ufffd\n", + "163 \ufffd\n", + "164 \ufffd\n", + "165 \ufffd\n", + "166 \ufffd\n", + "167 \ufffd\n", + "168 \ufffd\n", + "169 \ufffd\n", + "170 \ufffd\n", + "171 \ufffd\n", + "172 \ufffd\n", + "173 \ufffd\n", + "174 \ufffd\n", + "175 \ufffd\n", + "176 \ufffd\n", + "177 \ufffd\n", + "178 \ufffd\n", + "179 \ufffd\n", + "180 \ufffd\n", + "181 \ufffd\n", + "182 \ufffd\n", + "183 \ufffd\n", + "184 \ufffd\n", + "185 \ufffd\n", + "186 \ufffd\n", + "187 \ufffd\n", + "188 \ufffd\n", + "189 \ufffd\n", + "190 \ufffd\n", + "191 \ufffd\n", + "192 \ufffd\n", + "193 \ufffd\n", + "194 \ufffd\n", + "195 \ufffd\n", + "196 \ufffd\n", + "197 \ufffd\n", + "198 \ufffd\n", + "199 \ufffd\n", + "200 \ufffd\n", + "201 \ufffd\n", + "202 \ufffd\n", + "203 \ufffd\n", + "204 \ufffd\n", + "205 \ufffd\n", + "206 \ufffd\n", + "207 \ufffd\n", + "208 \ufffd\n", + "209 \ufffd\n", + "210 \ufffd\n", + "211 \ufffd\n", + "212 \ufffd\n", + "213 \ufffd\n", + "214 \ufffd\n", + "215 \ufffd\n", + "216 \ufffd\n", + "217 \ufffd\n", + "218 \ufffd\n", + "219 \ufffd\n", + "220 \ufffd\n", + "221 \ufffd\n", + "222 \ufffd\n", + "223 \ufffd\n", + "224 \ufffd\n", + "225 \ufffd\n", + "226 \ufffd\n", + "227 \ufffd\n", + "228 \ufffd\n", + "229 \ufffd\n", + "230 \ufffd\n", + "231 \ufffd\n", + "232 \ufffd\n", + "233 \ufffd\n", + "234 \ufffd\n", + "235 \ufffd\n", + "236 \ufffd\n", + "237 \ufffd\n", + "238 \ufffd\n", + "239 \ufffd\n", + "240 \ufffd\n", + "241 \ufffd\n", + "242 \ufffd\n", + "243 \ufffd\n", + "244 \ufffd\n", + "245 \ufffd\n", + "246 \ufffd\n", + "247 \ufffd\n", + "248 \ufffd\n", + "249 \ufffd\n", + "250 \ufffd\n", + "251 \ufffd\n", + "252 \ufffd\n", + "253 \ufffd\n", + "254 \ufffd\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-space1.cpp, Page no-693" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "test=raw_input(\"Enter string: \")\n", + "i=0\n", + "print \"Output string: \",\n", + "while True:\n", + " if test[i].isspace():\n", + " break\n", + " else:\n", + " sys.stdout.write(test[i])\n", + " i+=1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string: Hello World\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output string: Hello\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-space2.cpp, Page no-693" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "test=raw_input(\"Enter string: \")\n", + "print \"Output string:\", test" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string: Hello World\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output string: Hello World\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-stand.cpp, Page no-694" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "string1=\"Object-Computing\"\n", + "string2=\" with C++\"\n", + "len1=len(string1)\n", + "len2=len(string2)\n", + "for i in range(1,len1):\n", + " print string1[:i]\n", + "for i in range(len1, 0, -1):\n", + " print string1[:i]\n", + "print \"%s%s\" %(string1[:len1], string2[:len2])\n", + "print string1+string2\n", + "print string1[:6]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "O\n", + "Ob\n", + "Obj\n", + "Obje\n", + "Objec\n", + "Object\n", + "Object-\n", + "Object-C\n", + "Object-Co\n", + "Object-Com\n", + "Object-Comp\n", + "Object-Compu\n", + "Object-Comput\n", + "Object-Computi\n", + "Object-Computin\n", + "Object-Computing\n", + "Object-Computin\n", + "Object-Computi\n", + "Object-Comput\n", + "Object-Compu\n", + "Object-Comp\n", + "Object-Com\n", + "Object-Co\n", + "Object-C\n", + "Object-\n", + "Object\n", + "Objec\n", + "Obje\n", + "Obj\n", + "Ob\n", + "O\n", + "Object-Computing with C++\n", + "Object-Computing with C++\n", + "Object\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student.cpp, Page no-697" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_MARKS=600.0\n", + "def read(self):\n", + " self.__name=raw_input(\"Enter Name: \")\n", + " self.__marks=int(raw_input(\"Enter Marks Secured: \"))\n", + "def show(self):\n", + " print '{:>10}'.format(self.__name),\n", + " print '{:>6}'.format(self.__marks),\n", + " print '{0:10.0f}'.format((self.__marks/MAX_MARKS)*100)\n", + "class student:\n", + " __name=str\n", + " __marks=int\n", + " read=read\n", + " show=show\n", + "count=int(raw_input(\"How many students ? \"))\n", + "s=[]*count\n", + "for i in range(count):\n", + " s.append(student())\n", + "for i in range(count):\n", + " print \"Enter Student\", i+1, \"details...\"\n", + " s[i].read()\n", + "print \"Student Report...\"\n", + "print '{:>3}'.format(\"R#\"),\n", + "print '{:>10}'.format(\"Student\"),\n", + "print '{:>6}'.format(\"Marks\"),\n", + "print '{:>15}'.format(\"Percentage\")\n", + "for i in range(count):\n", + " print \"%3s\" %(i+1),\n", + " s[i].show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many students ? 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Student 1 details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Marks Secured: 450\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Student 2 details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Marks Secured: 525\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Student 3 details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name: Bindu\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Marks Secured: 429\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Report...\n", + " R# Student Marks Percentage\n", + " 1 Tejaswi 450 75\n", + " 2 Rajkumar 525 88\n", + " 3 Bindu 429 72\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-salary.cpp, Page no-701" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "desig=[\"CEO\", \"Manager\", \"Receptionist\", \"Clerk\", \"Peon\"]\n", + "salary=[10200,5200,2950,950,750]\n", + "print \"Salary Structure Based on Designation\"\n", + "print \"-------------------------------------\"\n", + "print '{:>15}'.format('Designation '),\n", + "print '{:>15}'.format('Salary (in Rs.)')\n", + "print \"-------------------------------------\"\n", + "for i in range(5):\n", + " print '{:.>15}'.format(desig[i]),\n", + " print '{:*>15}'.format(salary[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Salary Structure Based on Designation\n", + "-------------------------------------\n", + "Designation Salary (in Rs.)\n", + "-------------------------------------\n", + "............CEO **********10200\n", + "........Manager ***********5200\n", + "...Receptionist ***********2950\n", + "..........Clerk ************950\n", + "...........Peon ************750\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-hex.c, Page no-705" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num=raw_input(\"Enter any hexadecimal number: \")\n", + "print \"The input number in decimal = %d\" %int(num, 16)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any hexadecimal number: ab\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The input number in decimal = 171\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-hex.cpp, Page no-706" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num=raw_input(\"Enter any hexadecimal number: \")\n", + "print \"The input number in decimal = %d\" %int(num, 16)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any hexadecimal number: ab\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The input number in decimal = 171\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-foutput.cpp, Page no-709" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "x=int(100)\n", + "print format(x, '02x'), x\n", + "f=122.3434\n", + "print f\n", + "print '{:.2f}'.format(f)\n", + "print \"0x%0.4X\" %x\n", + "print '{:.3e}'.format(f)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "64 100\n", + "122.3434\n", + "122.34\n", + "0x0064\n", + "1.223e+02\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-payroll.cpp, Page no-709" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "f1=123.45\n", + "f2=34.65\n", + "f3=float(56)\n", + "print '{0:6.2f}'.format(f1)\n", + "print '{0:6.2f}'.format(f2)\n", + "print '{0:6.2f}'.format(f3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "123.45\n", + " 34.65\n", + " 56.00\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-oct.cpp, Page no-710" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "i=raw_input(\"Enter octal number: \")\n", + "print \"Its decimal equivalent is: %d\" %int(i, 8)\n", + "i=int(raw_input(\"Enter decimal number: \"))\n", + "print \"Its output:\", oct(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter octal number: 111\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Its decimal equivalent is: 73\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter decimal number: 73\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Its output: 0111\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mattab.cpp, Page no-711" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "num=int(raw_input(\"Enter Any Integer Number: \"))\n", + "print \"-----------------------------------------------------\"\n", + "print '{:>5}'.format(\"NUM\"),\n", + "print '{:>10}'.format(\"SQR\"),\n", + "print '{:>15}'.format(\"SQRT\"),\n", + "print '{:>15}'.format(\"LOG\")\n", + "print \"-----------------------------------------------------\"\n", + "for i in range(1, num+1):\n", + " print '{:>5}'.format(i),\n", + " print '{:>10}'.format(i*i),\n", + " print '{:15.3f}'.format(math.sqrt(i)),\n", + " print '{:15.4e}'.format(math.log(i))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Any Integer Number: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-----------------------------------------------------\n", + " NUM SQR SQRT LOG\n", + "-----------------------------------------------------\n", + " 1 1 1.000 0.0000e+00\n", + " 2 4 1.414 6.9315e-01\n", + " 3 9 1.732 1.0986e+00\n", + " 4 16 2.000 1.3863e+00\n", + " 5 25 2.236 1.6094e+00\n", + " 6 36 2.449 1.7918e+00\n", + " 7 49 2.646 1.9459e+00\n", + " 8 64 2.828 2.0794e+00\n", + " 9 81 3.000 2.1972e+00\n", + " 10 100 3.162 2.3026e+00\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-space3.cpp, Page no-712" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def sp():\n", + " print \"\",\n", + "x=1\n", + "y=2\n", + "z=3\n", + "w=4\n", + "print x, \n", + "sp(), \n", + "print y, \n", + "sp(), \n", + "print z, \n", + "sp(), \n", + "print w" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-currency.cpp, Page no-713" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def rupee():\n", + " print \"Rs.\",\n", + "def dollar():\n", + " print \"US$\",\n", + "print \"Item Sales in India...\"\n", + "item1=raw_input(\"Enter Item Name: \")\n", + "cost1=int(raw_input(\"Cost of Item: \"))\n", + "print \"Item Sales in US...\"\n", + "item2=raw_input(\"Enter Item Name: \")\n", + "cost2=int(raw_input(\"Cost of Item: \"))\n", + "print \"Item Cost Statistics...\"\n", + "print \"Item Name:\", item1\n", + "print \"Cost:\", \n", + "rupee(), \n", + "print cost1\n", + "print \"Item Name:\", item2\n", + "print \"Cost:\", \n", + "dollar(), \n", + "print cost2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Item Sales in India...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Name: PARAM Supercomputer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cost of Item: 55000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Item Sales in US...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Name: CRAY Supercomputer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cost of Item: 40500\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Item Cost Statistics...\n", + "Item Name: PARAM Supercomputer\n", + "Cost: Rs. 55000\n", + "Item Name: CRAY Supercomputer\n", + "Cost: US$ 40500\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-pmani.cpp, Page no-715" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def output(self, x):\n", + " print '{x:{f}>{w}.{p}f}'.format(x=x,f=self._my_manipulator__fill,w= self._my_manipulator__width, p=self._my_manipulator__precision)\n", + "class my_manipulator:\n", + " __width=int\n", + " __precision=int\n", + " __fill=chr\n", + " def __init__(self, tw, tp, tf):\n", + " self.__width=tw\n", + " self.__precision=tp\n", + " self.__fill=tf\n", + " output=output\n", + "def set_float(w, p, f):\n", + " return my_manipulator(w, p, f)\n", + "f1=123.2734\n", + "f2=23.271\n", + "f3=16.1673\n", + "set_float(10, 3, '*').output(f1)\n", + "set_float(9, 2, '^').output(f2)\n", + "set_float(8, 3, '#').output(f3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "***123.273\n", + "^^^^23.27\n", + "##16.167\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-point.cpp, Page no-717" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class POINT:\n", + " __x=int\n", + " __y=int\n", + " def __init__(self):\n", + " self.__x=0\n", + " self.__y=0\n", + " def output(self):\n", + " print \"(%d,%d)\" %(self.__x, self.__y)\n", + " def input(self):\n", + " self.__x, self.__y=[int(x) for x in raw_input().split()] \n", + "p1=POINT()\n", + "p2=POINT()\n", + "print \"Enter two coordinate points (p1, p2):\",\n", + "p1.input(), p2.input()\n", + "print \"Coordinate points you entered are:\"\n", + "p1.output()\n", + "p2.output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two coordinate points (p1, p2):" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Coordinate points you entered are:\n", + "(2,3)\n", + "(5,6)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-719" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num=raw_input(\"Enter a hexadecimal value: \")\n", + "num=int(num, 16)\n", + "print \"Octal equivalent:\", oct(num)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a hexadecimal value: A\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Octal equivalent: 012\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-2, Page no-719" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "PI=3.14159265\n", + "print \"The values at different levels of precision are:\"\n", + "for i in range(1, 6):\n", + " print '%0.*f' % (i, PI)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The values at different levels of precision are:\n", + "3.1\n", + "3.14\n", + "3.142\n", + "3.1416\n", + "3.14159\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole_1.ipynb new file mode 100755 index 00000000..12c13cf7 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole_1.ipynb @@ -0,0 +1,1338 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7caa500b3a86295a3fa2a49826e32bb84c94f9c218ecf3c344e2f51d069f57ff" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 17-Streams Computation with Console" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-hello.c, Page no-688" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print 'Hello World'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-hello.cpp, Page no-688" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print 'Hello World'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-redirect.cpp, Page no-688" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print 'Hello World with cout'\n", + "print 'Hello World with cerr'\n", + "print 'Hello World with clog'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World with cout\n", + "Hello World with cerr\n", + "Hello World with clog\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-get.cpp, Page no-691" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "c=raw_input()\n", + "print c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-put.cpp, Page no-692" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "for i in range(255):\n", + " if i==26:\n", + " continue\n", + " print i,chr(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 \u0000\n", + "1 \u0001\n", + "2 \u0002\n", + "3 \u0003\n", + "4 \u0004\n", + "5 \u0005\n", + "6 \u0006\n", + "7 \u0007\n", + "8 \b\n", + "9 \t\n", + "10 \n", + "\n", + "11 \u000b", + "\n", + "12 \f", + "\n", + "13 \r\n", + "14 \u000e\n", + "15 \u000f\n", + "16 \u0010\n", + "17 \u0011\n", + "18 \u0012\n", + "19 \u0013\n", + "20 \u0014\n", + "21 \u0015\n", + "22 \u0016\n", + "23 \u0017\n", + "24 \u0018\n", + "25 \u0019\n", + "27 \u001b\n", + "28 \u001c", + "\n", + "29 \u001d", + "\n", + "30 \u001e", + "\n", + "31 \u001f\n", + "32 \n", + "33 !\n", + "34 \"\n", + "35 #\n", + "36 $\n", + "37 %\n", + "38 &\n", + "39 '\n", + "40 (\n", + "41 )\n", + "42 *\n", + "43 +\n", + "44 ,\n", + "45 -\n", + "46 .\n", + "47 /\n", + "48 0\n", + "49 1\n", + "50 2\n", + "51 3\n", + "52 4\n", + "53 5\n", + "54 6\n", + "55 7\n", + "56 8\n", + "57 9\n", + "58 :\n", + "59 ;\n", + "60 <\n", + "61 =\n", + "62 >\n", + "63 ?\n", + "64 @\n", + "65 A\n", + "66 B\n", + "67 C\n", + "68 D\n", + "69 E\n", + "70 F\n", + "71 G\n", + "72 H\n", + "73 I\n", + "74 J\n", + "75 K\n", + "76 L\n", + "77 M\n", + "78 N\n", + "79 O\n", + "80 P\n", + "81 Q\n", + "82 R\n", + "83 S\n", + "84 T\n", + "85 U\n", + "86 V\n", + "87 W\n", + "88 X\n", + "89 Y\n", + "90 Z\n", + "91 [\n", + "92 \\\n", + "93 ]\n", + "94 ^\n", + "95 _\n", + "96 `\n", + "97 a\n", + "98 b\n", + "99 c\n", + "100 d\n", + "101 e\n", + "102 f\n", + "103 g\n", + "104 h\n", + "105 i\n", + "106 j\n", + "107 k\n", + "108 l\n", + "109 m\n", + "110 n\n", + "111 o\n", + "112 p\n", + "113 q\n", + "114 r\n", + "115 s\n", + "116 t\n", + "117 u\n", + "118 v\n", + "119 w\n", + "120 x\n", + "121 y\n", + "122 z\n", + "123 {\n", + "124 |\n", + "125 }\n", + "126 ~\n", + "127 \u007f\n", + "128 \ufffd\n", + "129 \ufffd\n", + "130 \ufffd\n", + "131 \ufffd\n", + "132 \ufffd\n", + "133 \ufffd\n", + "134 \ufffd\n", + "135 \ufffd\n", + "136 \ufffd\n", + "137 \ufffd\n", + "138 \ufffd\n", + "139 \ufffd\n", + "140 \ufffd\n", + "141 \ufffd\n", + "142 \ufffd\n", + "143 \ufffd\n", + "144 \ufffd\n", + "145 \ufffd\n", + "146 \ufffd\n", + "147 \ufffd\n", + "148 \ufffd\n", + "149 \ufffd\n", + "150 \ufffd\n", + "151 \ufffd\n", + "152 \ufffd\n", + "153 \ufffd\n", + "154 \ufffd\n", + "155 \ufffd\n", + "156 \ufffd\n", + "157 \ufffd\n", + "158 \ufffd\n", + "159 \ufffd\n", + "160 \ufffd\n", + "161 \ufffd\n", + "162 \ufffd\n", + "163 \ufffd\n", + "164 \ufffd\n", + "165 \ufffd\n", + "166 \ufffd\n", + "167 \ufffd\n", + "168 \ufffd\n", + "169 \ufffd\n", + "170 \ufffd\n", + "171 \ufffd\n", + "172 \ufffd\n", + "173 \ufffd\n", + "174 \ufffd\n", + "175 \ufffd\n", + "176 \ufffd\n", + "177 \ufffd\n", + "178 \ufffd\n", + "179 \ufffd\n", + "180 \ufffd\n", + "181 \ufffd\n", + "182 \ufffd\n", + "183 \ufffd\n", + "184 \ufffd\n", + "185 \ufffd\n", + "186 \ufffd\n", + "187 \ufffd\n", + "188 \ufffd\n", + "189 \ufffd\n", + "190 \ufffd\n", + "191 \ufffd\n", + "192 \ufffd\n", + "193 \ufffd\n", + "194 \ufffd\n", + "195 \ufffd\n", + "196 \ufffd\n", + "197 \ufffd\n", + "198 \ufffd\n", + "199 \ufffd\n", + "200 \ufffd\n", + "201 \ufffd\n", + "202 \ufffd\n", + "203 \ufffd\n", + "204 \ufffd\n", + "205 \ufffd\n", + "206 \ufffd\n", + "207 \ufffd\n", + "208 \ufffd\n", + "209 \ufffd\n", + "210 \ufffd\n", + "211 \ufffd\n", + "212 \ufffd\n", + "213 \ufffd\n", + "214 \ufffd\n", + "215 \ufffd\n", + "216 \ufffd\n", + "217 \ufffd\n", + "218 \ufffd\n", + "219 \ufffd\n", + "220 \ufffd\n", + "221 \ufffd\n", + "222 \ufffd\n", + "223 \ufffd\n", + "224 \ufffd\n", + "225 \ufffd\n", + "226 \ufffd\n", + "227 \ufffd\n", + "228 \ufffd\n", + "229 \ufffd\n", + "230 \ufffd\n", + "231 \ufffd\n", + "232 \ufffd\n", + "233 \ufffd\n", + "234 \ufffd\n", + "235 \ufffd\n", + "236 \ufffd\n", + "237 \ufffd\n", + "238 \ufffd\n", + "239 \ufffd\n", + "240 \ufffd\n", + "241 \ufffd\n", + "242 \ufffd\n", + "243 \ufffd\n", + "244 \ufffd\n", + "245 \ufffd\n", + "246 \ufffd\n", + "247 \ufffd\n", + "248 \ufffd\n", + "249 \ufffd\n", + "250 \ufffd\n", + "251 \ufffd\n", + "252 \ufffd\n", + "253 \ufffd\n", + "254 \ufffd\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-space1.cpp, Page no-693" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "test=raw_input(\"Enter string: \")\n", + "i=0\n", + "print \"Output string: \",\n", + "while True:\n", + " if test[i].isspace():\n", + " break\n", + " else:\n", + " sys.stdout.write(test[i])\n", + " i+=1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string: Hello World\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output string: Hello\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-space2.cpp, Page no-693" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "test=raw_input(\"Enter string: \")\n", + "print \"Output string:\", test" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string: Hello World\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output string: Hello World\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-stand.cpp, Page no-694" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "string1=\"Object-Computing\"\n", + "string2=\" with C++\"\n", + "len1=len(string1)\n", + "len2=len(string2)\n", + "for i in range(1,len1):\n", + " print string1[:i]\n", + "for i in range(len1, 0, -1):\n", + " print string1[:i]\n", + "print \"%s%s\" %(string1[:len1], string2[:len2])\n", + "print string1+string2\n", + "print string1[:6]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "O\n", + "Ob\n", + "Obj\n", + "Obje\n", + "Objec\n", + "Object\n", + "Object-\n", + "Object-C\n", + "Object-Co\n", + "Object-Com\n", + "Object-Comp\n", + "Object-Compu\n", + "Object-Comput\n", + "Object-Computi\n", + "Object-Computin\n", + "Object-Computing\n", + "Object-Computin\n", + "Object-Computi\n", + "Object-Comput\n", + "Object-Compu\n", + "Object-Comp\n", + "Object-Com\n", + "Object-Co\n", + "Object-C\n", + "Object-\n", + "Object\n", + "Objec\n", + "Obje\n", + "Obj\n", + "Ob\n", + "O\n", + "Object-Computing with C++\n", + "Object-Computing with C++\n", + "Object\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student.cpp, Page no-697" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_MARKS=600.0\n", + "def read(self):\n", + " self.__name=raw_input(\"Enter Name: \")\n", + " self.__marks=int(raw_input(\"Enter Marks Secured: \"))\n", + "def show(self):\n", + " print '{:>10}'.format(self.__name),\n", + " print '{:>6}'.format(self.__marks),\n", + " print '{0:10.0f}'.format((self.__marks/MAX_MARKS)*100)\n", + "class student:\n", + " __name=str\n", + " __marks=int\n", + " read=read\n", + " show=show\n", + "count=int(raw_input(\"How many students ? \"))\n", + "s=[]*count\n", + "for i in range(count):\n", + " s.append(student())\n", + "for i in range(count):\n", + " print \"Enter Student\", i+1, \"details...\"\n", + " s[i].read()\n", + "print \"Student Report...\"\n", + "print '{:>3}'.format(\"R#\"),\n", + "print '{:>10}'.format(\"Student\"),\n", + "print '{:>6}'.format(\"Marks\"),\n", + "print '{:>15}'.format(\"Percentage\")\n", + "for i in range(count):\n", + " print \"%3s\" %(i+1),\n", + " s[i].show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many students ? 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Student 1 details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Marks Secured: 450\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Student 2 details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Marks Secured: 525\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Student 3 details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name: Bindu\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Marks Secured: 429\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Report...\n", + " R# Student Marks Percentage\n", + " 1 Tejaswi 450 75\n", + " 2 Rajkumar 525 88\n", + " 3 Bindu 429 72\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-salary.cpp, Page no-701" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "desig=[\"CEO\", \"Manager\", \"Receptionist\", \"Clerk\", \"Peon\"]\n", + "salary=[10200,5200,2950,950,750]\n", + "print \"Salary Structure Based on Designation\"\n", + "print \"-------------------------------------\"\n", + "print '{:>15}'.format('Designation '),\n", + "print '{:>15}'.format('Salary (in Rs.)')\n", + "print \"-------------------------------------\"\n", + "for i in range(5):\n", + " print '{:.>15}'.format(desig[i]),\n", + " print '{:*>15}'.format(salary[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Salary Structure Based on Designation\n", + "-------------------------------------\n", + "Designation Salary (in Rs.)\n", + "-------------------------------------\n", + "............CEO **********10200\n", + "........Manager ***********5200\n", + "...Receptionist ***********2950\n", + "..........Clerk ************950\n", + "...........Peon ************750\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-hex.c, Page no-705" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num=raw_input(\"Enter any hexadecimal number: \")\n", + "print \"The input number in decimal = %d\" %int(num, 16)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any hexadecimal number: ab\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The input number in decimal = 171\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-hex.cpp, Page no-706" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num=raw_input(\"Enter any hexadecimal number: \")\n", + "print \"The input number in decimal = %d\" %int(num, 16)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any hexadecimal number: ab\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The input number in decimal = 171\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-foutput.cpp, Page no-709" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "x=int(100)\n", + "print format(x, '02x'), x\n", + "f=122.3434\n", + "print f\n", + "print '{:.2f}'.format(f)\n", + "print \"0x%0.4X\" %x\n", + "print '{:.3e}'.format(f)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "64 100\n", + "122.3434\n", + "122.34\n", + "0x0064\n", + "1.223e+02\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-payroll.cpp, Page no-709" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "f1=123.45\n", + "f2=34.65\n", + "f3=float(56)\n", + "print '{0:6.2f}'.format(f1)\n", + "print '{0:6.2f}'.format(f2)\n", + "print '{0:6.2f}'.format(f3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "123.45\n", + " 34.65\n", + " 56.00\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-oct.cpp, Page no-710" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "i=raw_input(\"Enter octal number: \")\n", + "print \"Its decimal equivalent is: %d\" %int(i, 8)\n", + "i=int(raw_input(\"Enter decimal number: \"))\n", + "print \"Its output:\", oct(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter octal number: 111\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Its decimal equivalent is: 73\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter decimal number: 73\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Its output: 0111\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mattab.cpp, Page no-711" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "num=int(raw_input(\"Enter Any Integer Number: \"))\n", + "print \"-----------------------------------------------------\"\n", + "print '{:>5}'.format(\"NUM\"),\n", + "print '{:>10}'.format(\"SQR\"),\n", + "print '{:>15}'.format(\"SQRT\"),\n", + "print '{:>15}'.format(\"LOG\")\n", + "print \"-----------------------------------------------------\"\n", + "for i in range(1, num+1):\n", + " print '{:>5}'.format(i),\n", + " print '{:>10}'.format(i*i),\n", + " print '{:15.3f}'.format(math.sqrt(i)),\n", + " print '{:15.4e}'.format(math.log(i))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Any Integer Number: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-----------------------------------------------------\n", + " NUM SQR SQRT LOG\n", + "-----------------------------------------------------\n", + " 1 1 1.000 0.0000e+00\n", + " 2 4 1.414 6.9315e-01\n", + " 3 9 1.732 1.0986e+00\n", + " 4 16 2.000 1.3863e+00\n", + " 5 25 2.236 1.6094e+00\n", + " 6 36 2.449 1.7918e+00\n", + " 7 49 2.646 1.9459e+00\n", + " 8 64 2.828 2.0794e+00\n", + " 9 81 3.000 2.1972e+00\n", + " 10 100 3.162 2.3026e+00\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-space3.cpp, Page no-712" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def sp():\n", + " print \"\",\n", + "x=1\n", + "y=2\n", + "z=3\n", + "w=4\n", + "print x, \n", + "sp(), \n", + "print y, \n", + "sp(), \n", + "print z, \n", + "sp(), \n", + "print w" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-currency.cpp, Page no-713" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def rupee():\n", + " print \"Rs.\",\n", + "def dollar():\n", + " print \"US$\",\n", + "print \"Item Sales in India...\"\n", + "item1=raw_input(\"Enter Item Name: \")\n", + "cost1=int(raw_input(\"Cost of Item: \"))\n", + "print \"Item Sales in US...\"\n", + "item2=raw_input(\"Enter Item Name: \")\n", + "cost2=int(raw_input(\"Cost of Item: \"))\n", + "print \"Item Cost Statistics...\"\n", + "print \"Item Name:\", item1\n", + "print \"Cost:\", \n", + "rupee(), \n", + "print cost1\n", + "print \"Item Name:\", item2\n", + "print \"Cost:\", \n", + "dollar(), \n", + "print cost2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Item Sales in India...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Name: PARAM Supercomputer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cost of Item: 55000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Item Sales in US...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Item Name: CRAY Supercomputer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cost of Item: 40500\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Item Cost Statistics...\n", + "Item Name: PARAM Supercomputer\n", + "Cost: Rs. 55000\n", + "Item Name: CRAY Supercomputer\n", + "Cost: US$ 40500\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-pmani.cpp, Page no-715" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def output(self, x):\n", + " print '{x:{f}>{w}.{p}f}'.format(x=x,f=self._my_manipulator__fill,w= self._my_manipulator__width, p=self._my_manipulator__precision)\n", + "class my_manipulator:\n", + " __width=int\n", + " __precision=int\n", + " __fill=chr\n", + " def __init__(self, tw, tp, tf):\n", + " self.__width=tw\n", + " self.__precision=tp\n", + " self.__fill=tf\n", + " output=output\n", + "def set_float(w, p, f):\n", + " return my_manipulator(w, p, f)\n", + "f1=123.2734\n", + "f2=23.271\n", + "f3=16.1673\n", + "set_float(10, 3, '*').output(f1)\n", + "set_float(9, 2, '^').output(f2)\n", + "set_float(8, 3, '#').output(f3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "***123.273\n", + "^^^^23.27\n", + "##16.167\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-point.cpp, Page no-717" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class POINT:\n", + " __x=int\n", + " __y=int\n", + " def __init__(self):\n", + " self.__x=0\n", + " self.__y=0\n", + " def output(self):\n", + " print \"(%d,%d)\" %(self.__x, self.__y)\n", + " def input(self):\n", + " self.__x, self.__y=[int(x) for x in raw_input().split()] \n", + "p1=POINT()\n", + "p2=POINT()\n", + "print \"Enter two coordinate points (p1, p2):\",\n", + "p1.input(), p2.input()\n", + "print \"Coordinate points you entered are:\"\n", + "p1.output()\n", + "p2.output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two coordinate points (p1, p2):" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Coordinate points you entered are:\n", + "(2,3)\n", + "(5,6)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-719" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num=raw_input(\"Enter a hexadecimal value: \")\n", + "num=int(num, 16)\n", + "print \"Octal equivalent:\", oct(num)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a hexadecimal value: A\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Octal equivalent: 012\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-2, Page no-719" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "PI=3.14159265\n", + "print \"The values at different levels of precision are:\"\n", + "for i in range(1, 6):\n", + " print '%0.*f' % (i, PI)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The values at different levels of precision are:\n", + "3.1\n", + "3.14\n", + "3.142\n", + "3.1416\n", + "3.14159\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles.ipynb new file mode 100755 index 00000000..d5aeb20b --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles.ipynb @@ -0,0 +1,1152 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:fe66068ace4dfae0081c9992d8914d2fa642c4fa20e9f62d7dadd74619b6c0f7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 18-Streams Computation with Files" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-stdfile.cpp, Page no-728" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "fout=open(\"student.out\", \"w\")\n", + "name=raw_input(\"Enter Name: \")\n", + "marks=raw_input(\"Enter Marks Secured: \")\n", + "fout.write(name+'\\n')\n", + "fout.write(marks+'\\n')\n", + "name=raw_input(\"Enter Name: \")\n", + "marks=raw_input(\"Enter Marks Secured: \")\n", + "fout.write(name+'\\n')\n", + "fout.write(marks+'\\n')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Marks Secured: 95\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Marks Secured: 90\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example-stdread.cpp, Page no-729" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "fin=open(\"student.out\", \"r\")\n", + "name = fin.readline()\n", + "print \"Name:\", name,\n", + "marks=fin.readline()\n", + "print \"Marks Secured:\",marks,\n", + "name = fin.readline()\n", + "print \"Name:\", name,\n", + "marks=fin.readline()\n", + "print \"Marks Secured:\",marks" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Rajkumar\n", + "Marks Secured: 95\n", + "Name: Tejaswi\n", + "Marks Secured: 90\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example-fdisp.cpp, Page no-732" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "filename=raw_input(\"Enter Name of the File: \")\n", + "try:\n", + " ifile=open(filename, \"r\")\n", + " ch=ifile.read()\n", + " print ch\n", + "except IOError:\n", + " print \"Error opening\", filename" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name of the File: mytype.cpp\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Error opening mytype.cpp\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-keyin.cpp, Page no-733" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ofile=open(\"key.txt\", \"w\")\n", + "print \"Enter characters ..\"\n", + "else:\n", + " #Open a file\n", + " infile=open(sys.argv[1],'r')\n", + "\n", + " #In case file cannot open\n", + " if(not(infile)):\n", + " print \"Error opening\", sys.argv[1]\n", + " else:\n", + " #Read file\n", + " infile.seek(end)\n", + " print \"File Size=\", infile.tell()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Usage: fsize \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-putget.cpp, Page no-741" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "File=open(\"student.txt\", \"w\")\n", + "string=raw_input(\"Enter String: \")\n", + "File.write(string)\n", + "File.seek(0)\n", + "print \"Output string:\",\n", + "File=open(\"student.txt\", \"r\")\n", + "string=File.read()\n", + "print string" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter String: Object-Computing with C++\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output string: Object-Computing with C++\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-fwr.cpp, Page no-743" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num1=530\n", + "num2=1050.25\n", + "out_file=open(\"number.bin\", \"w\")\n", + "out_file.write(str(num1)+'\\n')\n", + "out_file.write(str(num2)+'\\n')\n", + "out_file.close()\n", + "in_file=open(\"number.bin\", \"r\")\n", + "num1=in_file.readline()\n", + "num2=in_file.readline()\n", + "print num1, num2\n", + "in_file.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "530\n", + "1050.25\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-objsave.cpp, Page no-744" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAXNAME=40\n", + "class Person:\n", + " __name=str\n", + " __age=int\n", + " def write(self, os):\n", + " os.write(self.__name+'\\n')\n", + " os.write(str(self.__age)+'\\n')\n", + " def read(self,Is):\n", + " self.__name=Is.readline()\n", + " self.__age=Is.readline()\n", + "def fOutput(fos, b):\n", + " b.write(fos)\n", + "def fInput(fos, b):\n", + " b.read(fos)\n", + "def Input(b):\n", + " b._Person__name=raw_input(\"Name: \")\n", + " b._Person__age=int(raw_input(\"Age: \"))\n", + "def Output(b):\n", + " print b._Person__name,\n", + " print b._Person__age,\n", + "p_obj=Person()\n", + "ofile=open(\"person.txt\", \"w\")\n", + "while(1):\n", + " Input(p_obj)\n", + " fOutput(ofile, p_obj)\n", + " ch=str(raw_input(\"Another? \"))\n", + " if ch.upper()!='Y':\n", + " break\n", + "ofile.close()\n", + "ifile=open(\"person.txt\", \"r\")\n", + "print \"The objects written to the file were:..\"\n", + "while 1:\n", + " fInput(ifile, p_obj)\n", + " Output(p_obj)\n", + " if p_obj._Person__name=='':\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Another? y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Savithri\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 23\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Another? n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The objects written to the file were:..\n", + "Tejaswi\n", + "5\n", + "Savithri\n", + "23\n", + " \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student.cpp, Page no-748" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "try:\n", + " infile=open(\"student.in\", \"r\")\n", + "except IOerror:\n", + " print \"Error: student.in file non-existent\"\n", + "try:\n", + " outfile=open(\"student.out\", \"w\")\n", + "except IOerror:\n", + " print \"Error: unable to open student.out in write mode\"\n", + "else:\n", + " count=int(infile.readline())\n", + " outfile.write(\" Students Information Processing\")\n", + " outfile.write(\"\\n----------------------------------------\")\n", + " for i in range(count):\n", + " name=infile.readline()\n", + " percentage=int(infile.readline())\n", + " outfile.write(\"\\nName: \"+name)\n", + " outfile.write(\"Percentage: \"+str(percentage)+'\\n')\n", + " outfile.write(\"Passed in: \")\n", + " if percentage>=70:\n", + " outfile.write(\"First class with distinction\")\n", + " elif percentage>=60:\n", + " outfile.write(\"First class\")\n", + " elif percentage>=50:\n", + " outfile.write(\"Second class\")\n", + " elif percentage>=35:\n", + " outfile.write(\"Third class\")\n", + " else:\n", + " outfile.write(\"Sorry, Failed!\")\n", + " outfile.write('\\n')\n", + " outfile.write(\"----------------------------------------\")\n", + " infile.close()\n", + " outfile.close()\n", + " print \"Contents of student.out:\\n\"\n", + " infile=open(\"student.out\", \"r\")\n", + " Str=infile.read()\n", + " print Str\n", + " infile.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Contents of student.out:\n", + "\n", + " Students Information Processing\n", + "----------------------------------------\n", + "Name: Rajkumar\n", + "Percentage: 84\n", + "Passed in: First class with distinction\n", + "----------------------------------------\n", + "Name: Tejaswi\n", + "Percentage: 82\n", + "Passed in: First class with distinction\n", + "----------------------------------------\n", + "Name: Smrithi\n", + "Percentage: 60\n", + "Passed in: First class\n", + "----------------------------------------\n", + "Name: Anand\n", + "Percentage: 55\n", + "Passed in: Second class\n", + "----------------------------------------\n", + "Name: Rajshree\n", + "Percentage: 40\n", + "Passed in: Third class\n", + "----------------------------------------\n", + "Name: Ramesh\n", + "Percentage: 33\n", + "Passed in: Sorry, Failed!\n", + "----------------------------------------\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-fio.cpp, Page no-751" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "READ_SIZE=6\n", + "reader=str\n", + "fstr=open(\"test.del\", \"w\")\n", + "for i in range(10):\n", + " fstr.write(str(i))\n", + "fstr.seek(2)\n", + "fstr.write(\"Hello\")\n", + "fstr=open(\"test.del\", \"r\")\n", + "fstr.seek(4)\n", + "reader=fstr.read(READ_SIZE)\n", + "print reader" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "llo789\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-direct.cpp, Page no-752" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class Person(Structure):\n", + " _fields_=[('name',c_char*40),('age',c_int)]\n", + " def write(self, os):\n", + " os.write(self.__name+'\\n')\n", + " os.write(str(self.__age)+'\\n')\n", + " def read(self, Is):\n", + " self.__name=Is.readline()\n", + " self.__age=Is.readline()\n", + "def Input(b):\n", + " b._Person__name=raw_input(\"Name: \")\n", + " b._Person__age=int(raw_input(\"Age: \"))\n", + "def Output(b):\n", + " print \"Name:\",b._Person__name,\n", + " print \"Age:\",b._Person__age,\n", + "p_obj=Person()\n", + "print \"Database Creation...\"\n", + "ofile=open(\"person.dat\", \"w\")\n", + "count=0\n", + "while(1):\n", + " print \"Enter Object\", count, \"details...\"\n", + " Input(p_obj)\n", + " count=count+1\n", + " p_obj.write(ofile)\n", + " ch=str(raw_input(\"Another? \"))\n", + " if ch.upper()!='Y':\n", + " break\n", + "ofile.close()\n", + "iofile=open(\"person.dat\", \"r+b\")\n", + "print \"Database Access...\"\n", + "while 1:\n", + " obj_id=int(raw_input(\"Enter the object number to be accessed <-1 to end>: \"))\n", + " iofile.seek(0)\n", + " if obj_id<0 or obj_id>=count:\n", + " break\n", + " for i in range(2*obj_id):\n", + " iofile.readline()\n", + " location=iofile.tell()\n", + " iofile.seek(location)\n", + " p_obj.read(iofile)\n", + " Output(p_obj)\n", + " ch=raw_input(\"Wants to Modify? \")\n", + " if ch=='y' or ch=='Y':\n", + " Input(p_obj)\n", + " iofile.seek(location)\n", + " p_obj.write(iofile)\n", + "iofile.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Database Creation...\n", + "Enter Object 0 details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Another? y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Object 1 details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Another? y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Object 2 details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Kalpana\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 15\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Another? n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Database Access...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the object number to be accessed <-1 to end>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Rajkumar\r\n", + "Age: 25\r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wants to Modify? n\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the object number to be accessed <-1 to end>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Tejaswi\r\n", + "Age: 20\r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wants to Modify? y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the object number to be accessed <-1 to end>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Tejaswi\n", + "Age: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wants to Modify? n\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the object number to be accessed <-1 to end>: -1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-outfile.cpp, Page no-758" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "outfile=open(\"sample.out\", \"w\")\n", + "if not(outfile):\n", + " print \"Error: sample.out unable to open\"\n", + "else:\n", + " while(1):\n", + " buff=raw_input()\n", + " if buff==\"end\":\n", + " break\n", + " outfile.write(buff)\n", + " if not(outfile):\n", + " print \"write operation fail\"\n", + " break\n", + " outfile.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "OOP is good\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++ is OOP\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++ is good\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "end\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-762" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "space=tab=line=0\n", + "fin=open(\"File1.txt\", \"r\")\n", + "#fin.write(\"F I L E\\nHandling\\nin\tC++\")\n", + "while 1:\n", + " c=fin.read(1)\n", + " if c==' ':\n", + " space+=1\n", + " if c=='\\t':\n", + " tab+=1\n", + " if c=='\\n':\n", + " line+=1\n", + " if c=='':\n", + " break\n", + "print \"Number of blank spaces =\", space\n", + "print \"Number of tabs =\", tab\n", + "print \"Number of lines =\", line" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of blank spaces = 3\n", + "Number of tabs = 1\n", + "Number of lines = 2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-2, Page no-763" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "fin=open(\"Sample.txt\", \"r\")\n", + "#fin.write(\"File Handling in C++\")\n", + "print \"Here are the contents of the file, Sample.txt...\"\n", + "c=fin.read()\n", + "print c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Here are the contents of the file, Sample.txt...\n", + "File Handling in C++\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles_1.ipynb new file mode 100755 index 00000000..c0ab891b --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles_1.ipynb @@ -0,0 +1,1152 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:106e6360a9ecdf3fab5d674652e46c069b45eff7a983c63c8ffa1abf67715d03" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 18-Streams Computation with Files" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-stdfile.cpp, Page no-728" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "fout=open(\"student.out\", \"w\")\n", + "name=raw_input(\"Enter Name: \")\n", + "marks=raw_input(\"Enter Marks Secured: \")\n", + "fout.write(name+'\\n')\n", + "fout.write(marks+'\\n')\n", + "name=raw_input(\"Enter Name: \")\n", + "marks=raw_input(\"Enter Marks Secured: \")\n", + "fout.write(name+'\\n')\n", + "fout.write(marks+'\\n')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Marks Secured: 95\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Marks Secured: 90\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-stdread.cpp, Page no-729" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "fin=open(\"student.out\", \"r\")\n", + "name = fin.readline()\n", + "print \"Name:\", name,\n", + "marks=fin.readline()\n", + "print \"Marks Secured:\",marks,\n", + "name = fin.readline()\n", + "print \"Name:\", name,\n", + "marks=fin.readline()\n", + "print \"Marks Secured:\",marks" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Rajkumar\n", + "Marks Secured: 95\n", + "Name: Tejaswi\n", + "Marks Secured: 90\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-fdisp.cpp, Page no-732" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "filename=raw_input(\"Enter Name of the File: \")\n", + "try:\n", + " ifile=open(filename, \"r\")\n", + " ch=ifile.read()\n", + " print ch\n", + "except IOError:\n", + " print \"Error opening\", filename" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Name of the File: mytype.cpp\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Error opening mytype.cpp\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-keyin.cpp, Page no-733" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ofile=open(\"key.txt\", \"w\")\n", + "print \"Enter characters ..\"\n", + "else:\n", + " #Open a file\n", + " infile=open(sys.argv[1],'r')\n", + "\n", + " #In case file cannot open\n", + " if(not(infile)):\n", + " print \"Error opening\", sys.argv[1]\n", + " else:\n", + " #Read file\n", + " infile.seek(end)\n", + " print \"File Size=\", infile.tell()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Usage: fsize \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-putget.cpp, Page no-741" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "File=open(\"student.txt\", \"w\")\n", + "string=raw_input(\"Enter String: \")\n", + "File.write(string)\n", + "File.seek(0)\n", + "print \"Output string:\",\n", + "File=open(\"student.txt\", \"r\")\n", + "string=File.read()\n", + "print string" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter String: Object-Computing with C++\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output string: Object-Computing with C++\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-fwr.cpp, Page no-743" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num1=530\n", + "num2=1050.25\n", + "out_file=open(\"number.bin\", \"w\")\n", + "out_file.write(str(num1)+'\\n')\n", + "out_file.write(str(num2)+'\\n')\n", + "out_file.close()\n", + "in_file=open(\"number.bin\", \"r\")\n", + "num1=in_file.readline()\n", + "num2=in_file.readline()\n", + "print num1, num2\n", + "in_file.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "530\n", + "1050.25\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-objsave.cpp, Page no-744" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAXNAME=40\n", + "class Person:\n", + " __name=str\n", + " __age=int\n", + " def write(self, os):\n", + " os.write(self.__name+'\\n')\n", + " os.write(str(self.__age)+'\\n')\n", + " def read(self,Is):\n", + " self.__name=Is.readline()\n", + " self.__age=Is.readline()\n", + "def fOutput(fos, b):\n", + " b.write(fos)\n", + "def fInput(fos, b):\n", + " b.read(fos)\n", + "def Input(b):\n", + " b._Person__name=raw_input(\"Name: \")\n", + " b._Person__age=int(raw_input(\"Age: \"))\n", + "def Output(b):\n", + " print b._Person__name,\n", + " print b._Person__age,\n", + "p_obj=Person()\n", + "ofile=open(\"person.txt\", \"w\")\n", + "while(1):\n", + " Input(p_obj)\n", + " fOutput(ofile, p_obj)\n", + " ch=str(raw_input(\"Another? \"))\n", + " if ch.upper()!='Y':\n", + " break\n", + "ofile.close()\n", + "ifile=open(\"person.txt\", \"r\")\n", + "print \"The objects written to the file were:..\"\n", + "while 1:\n", + " fInput(ifile, p_obj)\n", + " Output(p_obj)\n", + " if p_obj._Person__name=='':\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Another? y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Savithri\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 23\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Another? n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The objects written to the file were:..\n", + "Tejaswi\n", + "5\n", + "Savithri\n", + "23\n", + " \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student.cpp, Page no-748" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "try:\n", + " infile=open(\"student.in\", \"r\")\n", + "except IOerror:\n", + " print \"Error: student.in file non-existent\"\n", + "try:\n", + " outfile=open(\"student.out\", \"w\")\n", + "except IOerror:\n", + " print \"Error: unable to open student.out in write mode\"\n", + "else:\n", + " count=int(infile.readline())\n", + " outfile.write(\" Students Information Processing\")\n", + " outfile.write(\"\\n----------------------------------------\")\n", + " for i in range(count):\n", + " name=infile.readline()\n", + " percentage=int(infile.readline())\n", + " outfile.write(\"\\nName: \"+name)\n", + " outfile.write(\"Percentage: \"+str(percentage)+'\\n')\n", + " outfile.write(\"Passed in: \")\n", + " if percentage>=70:\n", + " outfile.write(\"First class with distinction\")\n", + " elif percentage>=60:\n", + " outfile.write(\"First class\")\n", + " elif percentage>=50:\n", + " outfile.write(\"Second class\")\n", + " elif percentage>=35:\n", + " outfile.write(\"Third class\")\n", + " else:\n", + " outfile.write(\"Sorry, Failed!\")\n", + " outfile.write('\\n')\n", + " outfile.write(\"----------------------------------------\")\n", + " infile.close()\n", + " outfile.close()\n", + " print \"Contents of student.out:\\n\"\n", + " infile=open(\"student.out\", \"r\")\n", + " Str=infile.read()\n", + " print Str\n", + " infile.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Contents of student.out:\n", + "\n", + " Students Information Processing\n", + "----------------------------------------\n", + "Name: Rajkumar\n", + "Percentage: 84\n", + "Passed in: First class with distinction\n", + "----------------------------------------\n", + "Name: Tejaswi\n", + "Percentage: 82\n", + "Passed in: First class with distinction\n", + "----------------------------------------\n", + "Name: Smrithi\n", + "Percentage: 60\n", + "Passed in: First class\n", + "----------------------------------------\n", + "Name: Anand\n", + "Percentage: 55\n", + "Passed in: Second class\n", + "----------------------------------------\n", + "Name: Rajshree\n", + "Percentage: 40\n", + "Passed in: Third class\n", + "----------------------------------------\n", + "Name: Ramesh\n", + "Percentage: 33\n", + "Passed in: Sorry, Failed!\n", + "----------------------------------------\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-fio.cpp, Page no-751" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "READ_SIZE=6\n", + "reader=str\n", + "fstr=open(\"test.del\", \"w\")\n", + "for i in range(10):\n", + " fstr.write(str(i))\n", + "fstr.seek(2)\n", + "fstr.write(\"Hello\")\n", + "fstr=open(\"test.del\", \"r\")\n", + "fstr.seek(4)\n", + "reader=fstr.read(READ_SIZE)\n", + "print reader" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "llo789\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-direct.cpp, Page no-752" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure, c_char, c_int\n", + "class Person(Structure):\n", + " _fields_=[('name',c_char*40),('age',c_int)]\n", + " def write(self, os):\n", + " os.write(self.__name+'\\n')\n", + " os.write(str(self.__age)+'\\n')\n", + " def read(self, Is):\n", + " self.__name=Is.readline()\n", + " self.__age=Is.readline()\n", + "def Input(b):\n", + " b._Person__name=raw_input(\"Name: \")\n", + " b._Person__age=int(raw_input(\"Age: \"))\n", + "def Output(b):\n", + " print \"Name:\",b._Person__name,\n", + " print \"Age:\",b._Person__age,\n", + "p_obj=Person()\n", + "print \"Database Creation...\"\n", + "ofile=open(\"person.dat\", \"w\")\n", + "count=0\n", + "while(1):\n", + " print \"Enter Object\", count, \"details...\"\n", + " Input(p_obj)\n", + " count=count+1\n", + " p_obj.write(ofile)\n", + " ch=str(raw_input(\"Another? \"))\n", + " if ch.upper()!='Y':\n", + " break\n", + "ofile.close()\n", + "iofile=open(\"person.dat\", \"r+b\")\n", + "print \"Database Access...\"\n", + "while 1:\n", + " obj_id=int(raw_input(\"Enter the object number to be accessed <-1 to end>: \"))\n", + " iofile.seek(0)\n", + " if obj_id<0 or obj_id>=count:\n", + " break\n", + " for i in range(2*obj_id):\n", + " iofile.readline()\n", + " location=iofile.tell()\n", + " iofile.seek(location)\n", + " p_obj.read(iofile)\n", + " Output(p_obj)\n", + " ch=raw_input(\"Wants to Modify? \")\n", + " if ch=='y' or ch=='Y':\n", + " Input(p_obj)\n", + " iofile.seek(location)\n", + " p_obj.write(iofile)\n", + "iofile.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Database Creation...\n", + "Enter Object 0 details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Another? y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Object 1 details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Another? y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Object 2 details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Kalpana\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 15\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Another? n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Database Access...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the object number to be accessed <-1 to end>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Rajkumar\r\n", + "Age: 25\r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wants to Modify? n\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the object number to be accessed <-1 to end>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Tejaswi\r\n", + "Age: 20\r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wants to Modify? y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Age: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the object number to be accessed <-1 to end>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Tejaswi\n", + "Age: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wants to Modify? n\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the object number to be accessed <-1 to end>: -1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-outfile.cpp, Page no-758" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "outfile=open(\"sample.out\", \"w\")\n", + "if not(outfile):\n", + " print \"Error: sample.out unable to open\"\n", + "else:\n", + " while(1):\n", + " buff=raw_input()\n", + " if buff==\"end\":\n", + " break\n", + " outfile.write(buff)\n", + " if not(outfile):\n", + " print \"write operation fail\"\n", + " break\n", + " outfile.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "OOP is good\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++ is OOP\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++ is good\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "end\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-762" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "space=tab=line=0\n", + "fin=open(\"File1.txt\", \"r\")\n", + "#fin.write(\"F I L E\\nHandling\\nin\tC++\")\n", + "while 1:\n", + " c=fin.read(1)\n", + " if c==' ':\n", + " space+=1\n", + " if c=='\\t':\n", + " tab+=1\n", + " if c=='\\n':\n", + " line+=1\n", + " if c=='':\n", + " break\n", + "print \"Number of blank spaces =\", space\n", + "print \"Number of tabs =\", tab\n", + "print \"Number of lines =\", line" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of blank spaces = 3\n", + "Number of tabs = 1\n", + "Number of lines = 2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-2, Page no-763" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "fin=open(\"Sample.txt\", \"r\")\n", + "#fin.write(\"File Handling in C++\")\n", + "print \"Here are the contents of the file, Sample.txt...\"\n", + "c=fin.read()\n", + "print c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Here are the contents of the file, Sample.txt...\n", + "File Handling in C++\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling.ipynb new file mode 100755 index 00000000..98576807 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling.ipynb @@ -0,0 +1,1454 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3313deb61b605e4e7573c1c706ba00b703ad3ca8e59ab2363418ae531f9382dc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 19-Exception Handling" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-divzero.cpp, Page no-770" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class number:\n", + " __num=int\n", + " def read(self):\n", + " self.__num=int(raw_input())\n", + " class DIVIDE():\n", + " pass\n", + " def div(self, num2):\n", + " if num2.__num==0:\n", + " raise self.DIVIDE()\n", + " else:\n", + " return self.__num/num2.__num\n", + "num1=number()\n", + "num2=number()\n", + "print \"Enter Number 1: \",\n", + "num1.read()\n", + "print \"Enter Number 2: \",\n", + "num2.read()\n", + "try:\n", + " print \"trying division operation...\",\n", + " result=num1.div(num2)\n", + " print \"succeeded\"\n", + "except number.DIVIDE:\n", + " print \"failed\"\n", + " print \"Exception: Divide-By-Zero\"\n", + "else:\n", + " print \"num1/num2 =\", result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Number 1: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Number 2: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " trying division operation... failed\n", + "Exception: Divide-By-Zero\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-arrbound.cpp, Page no-772" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ARR_SIZE=10\n", + "class array:\n", + " __arr=[int]*ARR_SIZE\n", + " class RANGE():\n", + " pass\n", + " #overloading []\n", + " def op(self, i, x):\n", + " if i<0 or i>=ARR_SIZE:\n", + " raise self.RANGE()\n", + " self.__arr[i]=x\n", + "a=array()\n", + "print \"Maximum array size allowed =\", ARR_SIZE\n", + "try:\n", + " print \"Trying to refer a[1]...\",\n", + " a.op(1, 10) #a[1]=10\n", + " print \"succeeded\"\n", + " print \"Trying to refer a[15]...\",\n", + " a.op(15, 10) #a[15]=10\n", + " print \"succeeded\"\n", + "except array.RANGE:\n", + " print \"Out of Range in Array Reference\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum array size allowed = 10\n", + "Trying to refer a[1]... succeeded\n", + "Trying to refer a[15]... Out of Range in Array Reference\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-pass.cpp, Page no-774" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ARR_SIZE=10\n", + "class array:\n", + " __arr=[int]*ARR_SIZE\n", + " class RANGE():\n", + " pass\n", + " def __init__(self):\n", + " for i in range(ARR_SIZE):\n", + " self.__arr[i]=i\n", + " #overloading []\n", + " def op(self, i, x=None):\n", + " if i<0 or i>=ARR_SIZE:\n", + " raise self.RANGE()\n", + " if isinstance(x, int):\n", + " self.__arr[i]=x\n", + " else:\n", + " return self.__arr[i]\n", + "def read(a, index):\n", + " try:\n", + " element=a.op(index)\n", + " except array.RANGE:\n", + " print \"Parent passing exception to child to handle\"\n", + " raise\n", + " return element\n", + "a=array()\n", + "print \"Maximum array size allowed =\", ARR_SIZE\n", + "while(1):\n", + " index=int(raw_input(\"Enter element to be referenced: \"))\n", + " try:\n", + " print \"Trying to access object array 'a' for index =\", index\n", + " element=read(a, index)\n", + " print \"Elemnet in Array =\", element\n", + " except array.RANGE:\n", + " print \"Child: Out of Range in Array Reference\"\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum array size allowed = 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter element to be referenced: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Trying to access object array 'a' for index = 1\n", + "Elemnet in Array = 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter element to be referenced: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Trying to access object array 'a' for index = 5\n", + "Elemnet in Array = 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter element to be referenced: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Trying to access object array 'a' for index = 10\n", + "Parent passing exception to child to handle\n", + "Child: Out of Range in Array Reference\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sign1.cpp, Page no-777" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class positive:\n", + " pass\n", + "class negative:\n", + " pass\n", + "class zero:\n", + " pass\n", + "def what_sign(num): #no exception list in python and hence the except block for class zero is removed to produce the desired output\n", + " if num>0:\n", + " raise positive()\n", + " elif num<0:\n", + " raise negative()\n", + " else:\n", + " raise zero()\n", + "num=int(raw_input(\"Enter any number: \"))\n", + "try:\n", + " what_sign(num)\n", + "except positive:\n", + " print \"+ve Exception\"\n", + "except negative:\n", + " print \"-ve Exception\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number: -10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-ve Exception\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sign2.cpp, Page no-778" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class zero:\n", + " pass\n", + "def what_sign(num): #no exception list in python and hence the except block for class zero is removed to produce the desired output\n", + " if num>0:\n", + " print \"+ve Exception\"\n", + " elif num<0:\n", + " print \"-ve Exception\"\n", + " else:\n", + " raise zero()\n", + "num=int(raw_input(\"Enter any number: \"))\n", + "what_sign(num)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "+ve Exception\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-catall1.cpp, Page no-780" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class excep2:\n", + " pass\n", + "try:\n", + " print \"Throwing uncaught exception\"\n", + " raise excep2()\n", + "except:\n", + " print \"Caught all exceptions\"\n", + "print \"I am displayed\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Throwing uncaught exception\n", + "Caught all exceptions\n", + "I am displayed\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-catall2.cpp, Page no-780" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class ALPHA:\n", + " pass\n", + "_a=ALPHA()\n", + "def f3():\n", + " print \"f3() was called\"\n", + " raise _a\n", + "def f2():\n", + " try:\n", + " print \"f2() was called\"\n", + " f3()\n", + " except:\n", + " print \"f2() has elements with exceptions!\"\n", + "try:\n", + " f2()\n", + "except:\n", + " print \"Need more handlers!\"\n", + " print \"continud after handling exceptions\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "f2() was called\n", + "f3() was called\n", + "f2() has elements with exceptions!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-twoexcep.cpp, Page no-782" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ARR_SIZE=10\n", + "class array:\n", + " __arr=[int]\n", + " __size=int\n", + " class RANGE:\n", + " pass\n", + " class SIZE:\n", + " pass\n", + " def __init__(self, SizeRequest):\n", + " self.__arr=[int]*SizeRequest\n", + " if SizeRequest<0 or SizeRequest>ARR_SIZE:\n", + " raise self.SIZE()\n", + " self.__size=SizeRequest\n", + " def __del__(self):\n", + " del self.__arr\n", + " #overloading []\n", + " def op(self, i, x=None):\n", + " if i<0 or i>=self.__size:\n", + " raise self.RANGE()\n", + " elif isinstance(x, int):\n", + " self.__arr[i]=x\n", + " else:\n", + " return self.__arr[i]\n", + "print \"Maximum array size allowed =\", ARR_SIZE\n", + "try:\n", + " print \"Trying to create object a1(5)...\",\n", + " a1=array(5)\n", + " print \"succeeded\"\n", + " print \"Trying to refer a1[4]...\",\n", + " a1.op(4, 10) #a1[4]=10\n", + " print \"succeeded..\",\n", + " print \"a1[4] =\", a1.op(4) #a1[4]\n", + " print \"Trying to refer a1[15]...\",\n", + " a1.op(15, 10) #a1[15]=10\n", + " print \"succeeded\"\n", + "except array.SIZE:\n", + " print \"..Size exceeds allowable Limit\"\n", + "except array.RANGE:\n", + " print \"..Array Reference Out of Range\"\n", + "try:\n", + " print \"Trying to create object a2(15)...\",\n", + " a2=array(15)\n", + " print \"succeeded\"\n", + " a2.op(3, 3) #a2[3]=3\n", + "except array.SIZE:\n", + " print \"..Size exceeds allowable Limit\"\n", + "except array.RANGE:\n", + " print \"..Array Reference Out of Range\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum array size allowed = 10\n", + "Trying to create object a1(5)... succeeded\n", + "Trying to refer a1[4]... succeeded.. a1[4] = 10\n", + "Trying to refer a1[15]... ..Array Reference Out of Range\n", + "Trying to create object a2(15)... ..Size exceeds allowable Limit\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-uncaught.cpp, Page no-784" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#error because there is no block to handles exceptions of type excep2()\n", + "class excep1:\n", + " pass\n", + "class excep2:\n", + " pass\n", + "try:\n", + " print \"Throwing uncaught exception\"\n", + " raise excep2()\n", + "except excep1:\n", + " print \"Exception 1\"\n", + " print \"I am not displayed\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Throwing uncaught exception\n" + ] + }, + { + "ename": "excep2", + "evalue": "<__main__.excep2 instance at 0x00000000039A8408>", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mexcep2\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"Throwing uncaught exception\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 7\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mexcep2\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 8\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mexcep1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"Exception 1\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mexcep2\u001b[0m: <__main__.excep2 instance at 0x00000000039A8408>" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-myhand.cpp, Page no-786" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class excep1:\n", + " pass\n", + "class excep2:\n", + " pass\n", + "def MyTerminate():\n", + " print \"My terminate is invoked\"\n", + " return \n", + "try:\n", + " print \"Throwing uncaught exception\"\n", + " raise excep2()\n", + "except excep1:\n", + " print \"Exception 1\"\n", + " print \"I am not displayed\"\n", + "except:\n", + " MyTerminate()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Throwing uncaught exception\n", + "My terminate is invoked\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sign3.cpp, Page no-787" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class zero:\n", + " pass\n", + "def what_sign(num):#no exception list in python and hence the except block is removed to produce the desired output\n", + " if num>0:\n", + " print \"+ve Exception\"\n", + " elif num<0:\n", + " print \"-ve Exception\"\n", + " else:\n", + " raise zero()\n", + "num=int(raw_input(\"Enter any number: \"))\n", + "what_sign(num)\n", + "print \"end of main()\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "+ve Exception\n", + "end of main()\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sign4.cpp, Page no-788" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class zero:\n", + " pass\n", + "def MyUnexpected():\n", + " print \"My unexpected handler is invoked\"\n", + "def what_sign(num): #no exception list in python and hence the changes are made to produce the desired output\n", + " if num>0:\n", + " print \"+ve Exception\"\n", + " print \"end of main()\"\n", + " elif num<0:\n", + " print \"-ve Exception\"\n", + " print \"end of main()\"\n", + " else:\n", + " MyUnexpected()\n", + "num=int(raw_input(\"Enter any number: \"))\n", + "try:\n", + " what_sign(num)\n", + "except:\n", + " print \"catch all exceptions\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "My unexpected handler is invoked\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-interact.cpp, Page no-790" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "VEC_SIZE=10\n", + "class vector:\n", + " __vec=[int]\n", + " __size=int\n", + " class RANGE:\n", + " pass\n", + " class SIZE:\n", + " pass\n", + " def __init__(self, SizeRequest):\n", + " self.__vec=[int]*SizeRequest\n", + " if SizeRequest<0 or SizeRequest>VEC_SIZE:\n", + " raise self.SIZE()\n", + " self.__size=SizeRequest\n", + " def __del__(self):\n", + " del self.__vec\n", + " #overloading []\n", + " def op(self, i, x=None):\n", + " if i<0 or i>=self.__size:\n", + " raise self.RANGE()\n", + " elif isinstance(x, int):\n", + " self.__vec[i]=x\n", + " else:\n", + " return self.__vec[i]\n", + "print \"Maximum vector size allowed =\", VEC_SIZE\n", + "try:\n", + " size=int(raw_input(\"What is the size of vector you want to create: \"))\n", + " print \"Trying to create object vector v1 of size =\", size,\n", + " v1=vector(size)\n", + " print \"..succeeded\"\n", + " index=int(raw_input(\"Which vector element you want to access (index): \"))\n", + " print \"What is the new value for v1[\", index, \"]:\",\n", + " data=int(raw_input())\n", + " print \"Trying to modify a1[\", index, \"]...\",\n", + " v1.op(index, data) #v1[index]=data\n", + " print \"succeeded\"\n", + " print \"New value of a1[\", index, \"] =\", v1.op(index) #v1[index]\n", + "except vector.SIZE:\n", + " print \"failed\\nVector creation size exceeds allowable limit\"\n", + "except vector.RANGE:\n", + " print \"failed\\nVector reference out-of-range\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum vector size allowed = 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "What is the size of vector you want to create: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Trying to create object vector v1 of size = 5 ..succeeded\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Which vector element you want to access (index): 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "What is the new value for v1[ 10 ]:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Trying to modify a1[ 10 ]... failed\n", + "Vector reference out-of-range\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-virtual.cpp, Page no-792" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class WRONG_AGE:\n", + " pass\n", + "class Father:\n", + " def __init__(self, n):\n", + " if n<0:\n", + " raise WRONG_AGE()\n", + " self.__f_age=n\n", + " def GetAge(self):\n", + " return self.__f_age\n", + "class Son(Father):\n", + " def __init__(self, n, m):\n", + " Father.__init__(self, n)\n", + " if m>=n:\n", + " raise WRONG_AGE()\n", + " self.__s_age=m\n", + " def GetAge(self):\n", + " return self.__s_age\n", + "basep=[Father]\n", + "father_age=int(raw_input(\"Enter Age of Father: \"))\n", + "try:\n", + " basep=Father(father_age)\n", + "except WRONG_AGE:\n", + " print \"Error: Father's Age is < 0\"\n", + "else:\n", + " print \"Father's Age:\", basep.GetAge()\n", + " del basep\n", + " son_age=int(raw_input(\"Enter Age of Son: \"))\n", + " try:\n", + " basep=Son(father_age, son_age)\n", + " except WRONG_AGE:\n", + " print \"Error: Father's Age cannot be less than son age\"\n", + " else:\n", + " print \"Father's Age:\", basep.GetAge()\n", + " del basep" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Age of Father: 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Father's Age: 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Age of Son: 45\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Error: Father's Age cannot be less than son age\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-matrix.cpp, Page no-794" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "TRUE=1\n", + "FALSE=0\n", + "class MatError:\n", + " pass\n", + "class matrix:\n", + " __MaxRow=int\n", + " __MaxCol=int\n", + " def __init__(self, row=0, col=0):\n", + " self.__MaxRow=row\n", + " self.__MaxCol=col\n", + " self.__MatPtr=[[float]*5]*5\n", + " def __add__(self, b):\n", + " c=matrix(self.__MaxRow, self.__MaxCol)\n", + " if self.__MaxRow != b._matrix__MaxRow or self.__MaxCol != b._matrix__MaxCol:\n", + " raise MatError()\n", + " for i in range(self.__MaxRow):\n", + " for j in range(self.__MaxCol):\n", + " c._matrix__MatPtr[i][j]=self.__MatPtr[i][j]+b._matrix__MatPtr[i][j]\n", + " return c\n", + " def __sub__(self, b):\n", + " c=matrix(self.__MaxRow, self.__MaxCol)\n", + " if self.__MaxRow != b._matrix__MaxRow or self.__MaxCol != b._matrix__MaxCol:\n", + " raise MatError()\n", + " for i in range(self.__MaxRow):\n", + " for j in range(self.__MaxCol):\n", + " c._matrix__MatPtr[i][j]=self.__MatPtr[i][j]-b._matrix__MatPtr[i][j]\n", + " return c\n", + " def __mul__(self, b):\n", + " c=matrix(self.__MaxRow, b._matrix__MaxCol)\n", + " if self.__MaxCol!=b._matrix__MaxRow:\n", + " raise MatError()\n", + " for i in range(c._matrix__MaxRow):\n", + " for j in range(c._matrix__MaxCol):\n", + " c._matrix__MatPtr[i][j]=0\n", + " for k in range(self.__MaxCol):\n", + " c._matrix__MatPtr[i][j]+=self.__MatPtr[i][k]*b._matrix__MatPtr[k][j]\n", + " return c\n", + " def __eq__(self, b):\n", + " if self.__MaxRow != b._matrix__MaxRow or self.__MaxCol != b._matrix__MaxCol:\n", + " return FALSE\n", + " for i in range(self.__MaxRow):\n", + " for j in range(self.__MaxCol):\n", + " if self.__MatPtr[i][j]!=b._matrix__MatPtr[i][j]:\n", + " return FALSE\n", + " return TRUE\n", + " def __assign__(self, b):\n", + " self.__MaxRow = b._matrix__MaxRow\n", + " self.__MaxCol = b._matrix__MaxCol\n", + " for i in range(self.__MaxRow):\n", + " for j in range(self.__MaxCol):\n", + " self.__MatPtr[i][j]=b._matrix__MatPtr[i][j]\n", + " def Input(self):\n", + " self.__MaxRow=int(raw_input(\"How many rows? \"))\n", + " self.__MaxCol=int(raw_input(\"How many columns? \"))\n", + " self.__MatPtr = []\n", + " for i in range(0,self.__MaxRow):\n", + " self.__MatPtr.append([])\n", + " for j in range(0,self.__MaxCol):\n", + " print \"Matrix[%d,%d] =? \" %(i, j),\n", + " self.__MatPtr[i].append(float(raw_input()))\n", + " def output(self):\n", + " for i in range(self.__MaxRow):\n", + " print \"\"\n", + " for j in range(self.__MaxCol):\n", + " print \"%g\" %self.__MatPtr[i][j],\n", + "a=matrix()\n", + "b=matrix()\n", + "print \"Enter Matrix A details...\"\n", + "a.Input()\n", + "print \"Enter Matrix B details...\"\n", + "b.Input()\n", + "print \"Matrix A is...\",\n", + "a.output()\n", + "print \"\\nMatrix B is...\",\n", + "b.output()\n", + "c=matrix()\n", + "try:\n", + " c=a+b\n", + " print \"\\nC = A + B...\",\n", + " c.output()\n", + "except MatError:\n", + " print \"\\nInvalid matrix order for addition\",\n", + "d=matrix()\n", + "try:\n", + " d=a-b\n", + " print \"\\nD = A - B...\",\n", + " d.output()\n", + "except MatError:\n", + " print \"\\nInvalid matrix order for subtraction\",\n", + "e=matrix(3, 3)\n", + "try:\n", + " e=a*b\n", + " print \"\\nE = A * B...\",\n", + " e.output()\n", + "except MatError:\n", + " print \"\\nInvalid matrix order for multiplication\",\n", + "print \"\\n(Is matrix A equal to matrix B) ?\",\n", + "if a==b:\n", + " print \"Yes\"\n", + "else:\n", + " print \"No\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Matrix A details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[0,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[0,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Matrix B details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows? 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns? 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[0,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix A is... \n", + "1 2 \n", + "Matrix B is... \n", + "1 \n", + "2 \n", + "Invalid matrix order for addition \n", + "Invalid matrix order for subtraction \n", + "E = A * B... \n", + "5 \n", + "(Is matrix A equal to matrix B) ? No\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-recovery.cpp, Page no-802" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_SIG_INT=7\n", + "MAX_UNSIG_INT=15\n", + "class OVERFLOW:\n", + " pass\n", + "def sum(i, j, k):\n", + " try:\n", + " #Version1 procedure\n", + " result=i+j\n", + " if result>MAX_SIG_INT:\n", + " raise OVERFLOW()\n", + " result=result+k\n", + " if result>MAX_SIG_INT:\n", + " raise OVERFLOW()\n", + " print \"Version-1 succeeds\"\n", + " except OVERFLOW:\n", + " print \"Version-1 fails\"\n", + " try:\n", + " #Version2 procedure\n", + " result=i+k\n", + " if result>MAX_SIG_INT:\n", + " raise OVERFLOW()\n", + " result=result+j\n", + " if result>MAX_SIG_INT:\n", + " raise OVERFLOW()\n", + " print \"Version-2 succeeds\"\n", + " except OVERFLOW:\n", + " print \"Version-2 fails\"\n", + " try:\n", + " #Version3 procedure\n", + " result=j+k\n", + " if result>MAX_SIG_INT:\n", + " raise OVERFLOW()\n", + " result=result+i\n", + " if result>MAX_SIG_INT:\n", + " raise OVERFLOW()\n", + " print \"Version-3 succeeds\"\n", + " except OVERFLOW:\n", + " print \"Error: Overflow. All versions falied\"\n", + " return result\n", + "print \"Sum of 7, -3, 2 computation...\"\n", + "result=sum(7, -3, 2)\n", + "print \"Sum =\", result\n", + "print \"Sum of 7, 2, -3 computation...\"\n", + "result=sum(7,2, -3)\n", + "print \"Sum =\", result\n", + "print \"Sum of 3, 3, 2 computation...\"\n", + "result=sum(3, 3, 2)\n", + "print \"Sum =\", result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of 7, -3, 2 computation...\n", + "Version-1 succeeds\n", + "Sum = 6\n", + "Sum of 7, 2, -3 computation...\n", + "Version-1 fails\n", + "Version-2 succeeds\n", + "Sum = 6\n", + "Sum of 3, 3, 2 computation...\n", + "Version-1 fails\n", + "Version-2 fails\n", + "Error: Overflow. All versions falied\n", + "Sum = 8\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-new1.cpp, Page no-804" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "size=int(raw_input(\"How many bytes to be allocated: \"))\n", + "try:\n", + " data=[int]*size\n", + " print \"Memory allocation success, address =\", hex(id(data))\n", + "except:\n", + " print \"Could not allocate. Bye...\"\n", + "del data" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many bytes to be allocated: 300\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Memory allocation success, address = 0x3717188L\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-new2.cpp, Page no-805" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def display(data, m, n):\n", + " for i in range(m):\n", + " for j in range(n):\n", + " print data[i][j],\n", + " print \"\"\n", + "def de_allocate(data, m):\n", + " for i in range(m-1):\n", + " del data[i]\n", + "m, n=[int(x) for x in raw_input(\"Enter rows and columns count: \").split()]\n", + "try:\n", + " data = []\n", + " for i in range(m):\n", + " data.append([])\n", + " for j in range(n):\n", + " data[i].append(0)\n", + "except:\n", + " print \"Could not allocate. Bye...\"\n", + "else:\n", + " for i in range(m):\n", + " for j in range(n):\n", + " data[i][j]=i+j\n", + " display(data, m, n)\n", + " de_allocate(data, m)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter rows and columns count: 3 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 \n", + "1 2 3 4 \n", + "2 3 4 5 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-812" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ther is no goto in python\n", + "def main():\n", + " num=int(raw_input(\"Please enter an integer value: \"))\n", + " if isinstance(num, int):\n", + " print \"You entered a correct type of value\"\n", + " else:\n", + " raise num\n", + "try:\n", + " main()\n", + "except:\n", + " print \"You enetered incorrect type of value; try again\"\n", + " main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter an integer value: 10.7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You enetered incorrect type of value; try again\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter an integer value: 8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You entered a correct type of value\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-2, Page no-812" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Int:\n", + " def __init__(self, val):\n", + " self.value=val\n", + "class Double:\n", + " def __init__(self, val):\n", + " self.value=val\n", + "class Str:\n", + " def __init__(self, val):\n", + " self.value=val\n", + "i=int(raw_input(\"Press an integer between 1 - 3 to test exception handling with multiple catch blocks..\"))\n", + "try:\n", + " if i==1:\n", + " print \"Throwing integer value\"\n", + " raise Int(1)\n", + " if i==2:\n", + " print \"Throwing double value\"\n", + " raise Double(1.12)\n", + " if i==3:\n", + " print \"Throwing charcter value\"\n", + " raise Str('A')\n", + "except Int as e: #type of an exception raised is not correctly determined in the exception block and hence use of classes \n", + " print \"Caught an integer value\", e.value\n", + "except Double as e:\n", + " print \"Caught a double value\", e.value\n", + "except Str as e:\n", + " print \"Caught a character value\", e.value" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Press an integer between 1 - 3 to test exception handling with multiple catch blocks..3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Throwing charcter value\n", + "Caught a character value A\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling_1.ipynb new file mode 100755 index 00000000..98576807 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling_1.ipynb @@ -0,0 +1,1454 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3313deb61b605e4e7573c1c706ba00b703ad3ca8e59ab2363418ae531f9382dc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 19-Exception Handling" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-divzero.cpp, Page no-770" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class number:\n", + " __num=int\n", + " def read(self):\n", + " self.__num=int(raw_input())\n", + " class DIVIDE():\n", + " pass\n", + " def div(self, num2):\n", + " if num2.__num==0:\n", + " raise self.DIVIDE()\n", + " else:\n", + " return self.__num/num2.__num\n", + "num1=number()\n", + "num2=number()\n", + "print \"Enter Number 1: \",\n", + "num1.read()\n", + "print \"Enter Number 2: \",\n", + "num2.read()\n", + "try:\n", + " print \"trying division operation...\",\n", + " result=num1.div(num2)\n", + " print \"succeeded\"\n", + "except number.DIVIDE:\n", + " print \"failed\"\n", + " print \"Exception: Divide-By-Zero\"\n", + "else:\n", + " print \"num1/num2 =\", result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Number 1: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Number 2: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " trying division operation... failed\n", + "Exception: Divide-By-Zero\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-arrbound.cpp, Page no-772" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ARR_SIZE=10\n", + "class array:\n", + " __arr=[int]*ARR_SIZE\n", + " class RANGE():\n", + " pass\n", + " #overloading []\n", + " def op(self, i, x):\n", + " if i<0 or i>=ARR_SIZE:\n", + " raise self.RANGE()\n", + " self.__arr[i]=x\n", + "a=array()\n", + "print \"Maximum array size allowed =\", ARR_SIZE\n", + "try:\n", + " print \"Trying to refer a[1]...\",\n", + " a.op(1, 10) #a[1]=10\n", + " print \"succeeded\"\n", + " print \"Trying to refer a[15]...\",\n", + " a.op(15, 10) #a[15]=10\n", + " print \"succeeded\"\n", + "except array.RANGE:\n", + " print \"Out of Range in Array Reference\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum array size allowed = 10\n", + "Trying to refer a[1]... succeeded\n", + "Trying to refer a[15]... Out of Range in Array Reference\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-pass.cpp, Page no-774" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ARR_SIZE=10\n", + "class array:\n", + " __arr=[int]*ARR_SIZE\n", + " class RANGE():\n", + " pass\n", + " def __init__(self):\n", + " for i in range(ARR_SIZE):\n", + " self.__arr[i]=i\n", + " #overloading []\n", + " def op(self, i, x=None):\n", + " if i<0 or i>=ARR_SIZE:\n", + " raise self.RANGE()\n", + " if isinstance(x, int):\n", + " self.__arr[i]=x\n", + " else:\n", + " return self.__arr[i]\n", + "def read(a, index):\n", + " try:\n", + " element=a.op(index)\n", + " except array.RANGE:\n", + " print \"Parent passing exception to child to handle\"\n", + " raise\n", + " return element\n", + "a=array()\n", + "print \"Maximum array size allowed =\", ARR_SIZE\n", + "while(1):\n", + " index=int(raw_input(\"Enter element to be referenced: \"))\n", + " try:\n", + " print \"Trying to access object array 'a' for index =\", index\n", + " element=read(a, index)\n", + " print \"Elemnet in Array =\", element\n", + " except array.RANGE:\n", + " print \"Child: Out of Range in Array Reference\"\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum array size allowed = 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter element to be referenced: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Trying to access object array 'a' for index = 1\n", + "Elemnet in Array = 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter element to be referenced: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Trying to access object array 'a' for index = 5\n", + "Elemnet in Array = 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter element to be referenced: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Trying to access object array 'a' for index = 10\n", + "Parent passing exception to child to handle\n", + "Child: Out of Range in Array Reference\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sign1.cpp, Page no-777" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class positive:\n", + " pass\n", + "class negative:\n", + " pass\n", + "class zero:\n", + " pass\n", + "def what_sign(num): #no exception list in python and hence the except block for class zero is removed to produce the desired output\n", + " if num>0:\n", + " raise positive()\n", + " elif num<0:\n", + " raise negative()\n", + " else:\n", + " raise zero()\n", + "num=int(raw_input(\"Enter any number: \"))\n", + "try:\n", + " what_sign(num)\n", + "except positive:\n", + " print \"+ve Exception\"\n", + "except negative:\n", + " print \"-ve Exception\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number: -10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-ve Exception\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sign2.cpp, Page no-778" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class zero:\n", + " pass\n", + "def what_sign(num): #no exception list in python and hence the except block for class zero is removed to produce the desired output\n", + " if num>0:\n", + " print \"+ve Exception\"\n", + " elif num<0:\n", + " print \"-ve Exception\"\n", + " else:\n", + " raise zero()\n", + "num=int(raw_input(\"Enter any number: \"))\n", + "what_sign(num)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "+ve Exception\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-catall1.cpp, Page no-780" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class excep2:\n", + " pass\n", + "try:\n", + " print \"Throwing uncaught exception\"\n", + " raise excep2()\n", + "except:\n", + " print \"Caught all exceptions\"\n", + "print \"I am displayed\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Throwing uncaught exception\n", + "Caught all exceptions\n", + "I am displayed\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-catall2.cpp, Page no-780" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class ALPHA:\n", + " pass\n", + "_a=ALPHA()\n", + "def f3():\n", + " print \"f3() was called\"\n", + " raise _a\n", + "def f2():\n", + " try:\n", + " print \"f2() was called\"\n", + " f3()\n", + " except:\n", + " print \"f2() has elements with exceptions!\"\n", + "try:\n", + " f2()\n", + "except:\n", + " print \"Need more handlers!\"\n", + " print \"continud after handling exceptions\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "f2() was called\n", + "f3() was called\n", + "f2() has elements with exceptions!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-twoexcep.cpp, Page no-782" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ARR_SIZE=10\n", + "class array:\n", + " __arr=[int]\n", + " __size=int\n", + " class RANGE:\n", + " pass\n", + " class SIZE:\n", + " pass\n", + " def __init__(self, SizeRequest):\n", + " self.__arr=[int]*SizeRequest\n", + " if SizeRequest<0 or SizeRequest>ARR_SIZE:\n", + " raise self.SIZE()\n", + " self.__size=SizeRequest\n", + " def __del__(self):\n", + " del self.__arr\n", + " #overloading []\n", + " def op(self, i, x=None):\n", + " if i<0 or i>=self.__size:\n", + " raise self.RANGE()\n", + " elif isinstance(x, int):\n", + " self.__arr[i]=x\n", + " else:\n", + " return self.__arr[i]\n", + "print \"Maximum array size allowed =\", ARR_SIZE\n", + "try:\n", + " print \"Trying to create object a1(5)...\",\n", + " a1=array(5)\n", + " print \"succeeded\"\n", + " print \"Trying to refer a1[4]...\",\n", + " a1.op(4, 10) #a1[4]=10\n", + " print \"succeeded..\",\n", + " print \"a1[4] =\", a1.op(4) #a1[4]\n", + " print \"Trying to refer a1[15]...\",\n", + " a1.op(15, 10) #a1[15]=10\n", + " print \"succeeded\"\n", + "except array.SIZE:\n", + " print \"..Size exceeds allowable Limit\"\n", + "except array.RANGE:\n", + " print \"..Array Reference Out of Range\"\n", + "try:\n", + " print \"Trying to create object a2(15)...\",\n", + " a2=array(15)\n", + " print \"succeeded\"\n", + " a2.op(3, 3) #a2[3]=3\n", + "except array.SIZE:\n", + " print \"..Size exceeds allowable Limit\"\n", + "except array.RANGE:\n", + " print \"..Array Reference Out of Range\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum array size allowed = 10\n", + "Trying to create object a1(5)... succeeded\n", + "Trying to refer a1[4]... succeeded.. a1[4] = 10\n", + "Trying to refer a1[15]... ..Array Reference Out of Range\n", + "Trying to create object a2(15)... ..Size exceeds allowable Limit\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-uncaught.cpp, Page no-784" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#error because there is no block to handles exceptions of type excep2()\n", + "class excep1:\n", + " pass\n", + "class excep2:\n", + " pass\n", + "try:\n", + " print \"Throwing uncaught exception\"\n", + " raise excep2()\n", + "except excep1:\n", + " print \"Exception 1\"\n", + " print \"I am not displayed\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Throwing uncaught exception\n" + ] + }, + { + "ename": "excep2", + "evalue": "<__main__.excep2 instance at 0x00000000039A8408>", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mexcep2\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"Throwing uncaught exception\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 7\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mexcep2\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 8\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mexcep1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"Exception 1\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mexcep2\u001b[0m: <__main__.excep2 instance at 0x00000000039A8408>" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-myhand.cpp, Page no-786" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class excep1:\n", + " pass\n", + "class excep2:\n", + " pass\n", + "def MyTerminate():\n", + " print \"My terminate is invoked\"\n", + " return \n", + "try:\n", + " print \"Throwing uncaught exception\"\n", + " raise excep2()\n", + "except excep1:\n", + " print \"Exception 1\"\n", + " print \"I am not displayed\"\n", + "except:\n", + " MyTerminate()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Throwing uncaught exception\n", + "My terminate is invoked\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sign3.cpp, Page no-787" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class zero:\n", + " pass\n", + "def what_sign(num):#no exception list in python and hence the except block is removed to produce the desired output\n", + " if num>0:\n", + " print \"+ve Exception\"\n", + " elif num<0:\n", + " print \"-ve Exception\"\n", + " else:\n", + " raise zero()\n", + "num=int(raw_input(\"Enter any number: \"))\n", + "what_sign(num)\n", + "print \"end of main()\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "+ve Exception\n", + "end of main()\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sign4.cpp, Page no-788" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class zero:\n", + " pass\n", + "def MyUnexpected():\n", + " print \"My unexpected handler is invoked\"\n", + "def what_sign(num): #no exception list in python and hence the changes are made to produce the desired output\n", + " if num>0:\n", + " print \"+ve Exception\"\n", + " print \"end of main()\"\n", + " elif num<0:\n", + " print \"-ve Exception\"\n", + " print \"end of main()\"\n", + " else:\n", + " MyUnexpected()\n", + "num=int(raw_input(\"Enter any number: \"))\n", + "try:\n", + " what_sign(num)\n", + "except:\n", + " print \"catch all exceptions\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "My unexpected handler is invoked\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-interact.cpp, Page no-790" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "VEC_SIZE=10\n", + "class vector:\n", + " __vec=[int]\n", + " __size=int\n", + " class RANGE:\n", + " pass\n", + " class SIZE:\n", + " pass\n", + " def __init__(self, SizeRequest):\n", + " self.__vec=[int]*SizeRequest\n", + " if SizeRequest<0 or SizeRequest>VEC_SIZE:\n", + " raise self.SIZE()\n", + " self.__size=SizeRequest\n", + " def __del__(self):\n", + " del self.__vec\n", + " #overloading []\n", + " def op(self, i, x=None):\n", + " if i<0 or i>=self.__size:\n", + " raise self.RANGE()\n", + " elif isinstance(x, int):\n", + " self.__vec[i]=x\n", + " else:\n", + " return self.__vec[i]\n", + "print \"Maximum vector size allowed =\", VEC_SIZE\n", + "try:\n", + " size=int(raw_input(\"What is the size of vector you want to create: \"))\n", + " print \"Trying to create object vector v1 of size =\", size,\n", + " v1=vector(size)\n", + " print \"..succeeded\"\n", + " index=int(raw_input(\"Which vector element you want to access (index): \"))\n", + " print \"What is the new value for v1[\", index, \"]:\",\n", + " data=int(raw_input())\n", + " print \"Trying to modify a1[\", index, \"]...\",\n", + " v1.op(index, data) #v1[index]=data\n", + " print \"succeeded\"\n", + " print \"New value of a1[\", index, \"] =\", v1.op(index) #v1[index]\n", + "except vector.SIZE:\n", + " print \"failed\\nVector creation size exceeds allowable limit\"\n", + "except vector.RANGE:\n", + " print \"failed\\nVector reference out-of-range\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum vector size allowed = 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "What is the size of vector you want to create: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Trying to create object vector v1 of size = 5 ..succeeded\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Which vector element you want to access (index): 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "What is the new value for v1[ 10 ]:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Trying to modify a1[ 10 ]... failed\n", + "Vector reference out-of-range\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-virtual.cpp, Page no-792" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class WRONG_AGE:\n", + " pass\n", + "class Father:\n", + " def __init__(self, n):\n", + " if n<0:\n", + " raise WRONG_AGE()\n", + " self.__f_age=n\n", + " def GetAge(self):\n", + " return self.__f_age\n", + "class Son(Father):\n", + " def __init__(self, n, m):\n", + " Father.__init__(self, n)\n", + " if m>=n:\n", + " raise WRONG_AGE()\n", + " self.__s_age=m\n", + " def GetAge(self):\n", + " return self.__s_age\n", + "basep=[Father]\n", + "father_age=int(raw_input(\"Enter Age of Father: \"))\n", + "try:\n", + " basep=Father(father_age)\n", + "except WRONG_AGE:\n", + " print \"Error: Father's Age is < 0\"\n", + "else:\n", + " print \"Father's Age:\", basep.GetAge()\n", + " del basep\n", + " son_age=int(raw_input(\"Enter Age of Son: \"))\n", + " try:\n", + " basep=Son(father_age, son_age)\n", + " except WRONG_AGE:\n", + " print \"Error: Father's Age cannot be less than son age\"\n", + " else:\n", + " print \"Father's Age:\", basep.GetAge()\n", + " del basep" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Age of Father: 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Father's Age: 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Age of Son: 45\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Error: Father's Age cannot be less than son age\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-matrix.cpp, Page no-794" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "TRUE=1\n", + "FALSE=0\n", + "class MatError:\n", + " pass\n", + "class matrix:\n", + " __MaxRow=int\n", + " __MaxCol=int\n", + " def __init__(self, row=0, col=0):\n", + " self.__MaxRow=row\n", + " self.__MaxCol=col\n", + " self.__MatPtr=[[float]*5]*5\n", + " def __add__(self, b):\n", + " c=matrix(self.__MaxRow, self.__MaxCol)\n", + " if self.__MaxRow != b._matrix__MaxRow or self.__MaxCol != b._matrix__MaxCol:\n", + " raise MatError()\n", + " for i in range(self.__MaxRow):\n", + " for j in range(self.__MaxCol):\n", + " c._matrix__MatPtr[i][j]=self.__MatPtr[i][j]+b._matrix__MatPtr[i][j]\n", + " return c\n", + " def __sub__(self, b):\n", + " c=matrix(self.__MaxRow, self.__MaxCol)\n", + " if self.__MaxRow != b._matrix__MaxRow or self.__MaxCol != b._matrix__MaxCol:\n", + " raise MatError()\n", + " for i in range(self.__MaxRow):\n", + " for j in range(self.__MaxCol):\n", + " c._matrix__MatPtr[i][j]=self.__MatPtr[i][j]-b._matrix__MatPtr[i][j]\n", + " return c\n", + " def __mul__(self, b):\n", + " c=matrix(self.__MaxRow, b._matrix__MaxCol)\n", + " if self.__MaxCol!=b._matrix__MaxRow:\n", + " raise MatError()\n", + " for i in range(c._matrix__MaxRow):\n", + " for j in range(c._matrix__MaxCol):\n", + " c._matrix__MatPtr[i][j]=0\n", + " for k in range(self.__MaxCol):\n", + " c._matrix__MatPtr[i][j]+=self.__MatPtr[i][k]*b._matrix__MatPtr[k][j]\n", + " return c\n", + " def __eq__(self, b):\n", + " if self.__MaxRow != b._matrix__MaxRow or self.__MaxCol != b._matrix__MaxCol:\n", + " return FALSE\n", + " for i in range(self.__MaxRow):\n", + " for j in range(self.__MaxCol):\n", + " if self.__MatPtr[i][j]!=b._matrix__MatPtr[i][j]:\n", + " return FALSE\n", + " return TRUE\n", + " def __assign__(self, b):\n", + " self.__MaxRow = b._matrix__MaxRow\n", + " self.__MaxCol = b._matrix__MaxCol\n", + " for i in range(self.__MaxRow):\n", + " for j in range(self.__MaxCol):\n", + " self.__MatPtr[i][j]=b._matrix__MatPtr[i][j]\n", + " def Input(self):\n", + " self.__MaxRow=int(raw_input(\"How many rows? \"))\n", + " self.__MaxCol=int(raw_input(\"How many columns? \"))\n", + " self.__MatPtr = []\n", + " for i in range(0,self.__MaxRow):\n", + " self.__MatPtr.append([])\n", + " for j in range(0,self.__MaxCol):\n", + " print \"Matrix[%d,%d] =? \" %(i, j),\n", + " self.__MatPtr[i].append(float(raw_input()))\n", + " def output(self):\n", + " for i in range(self.__MaxRow):\n", + " print \"\"\n", + " for j in range(self.__MaxCol):\n", + " print \"%g\" %self.__MatPtr[i][j],\n", + "a=matrix()\n", + "b=matrix()\n", + "print \"Enter Matrix A details...\"\n", + "a.Input()\n", + "print \"Enter Matrix B details...\"\n", + "b.Input()\n", + "print \"Matrix A is...\",\n", + "a.output()\n", + "print \"\\nMatrix B is...\",\n", + "b.output()\n", + "c=matrix()\n", + "try:\n", + " c=a+b\n", + " print \"\\nC = A + B...\",\n", + " c.output()\n", + "except MatError:\n", + " print \"\\nInvalid matrix order for addition\",\n", + "d=matrix()\n", + "try:\n", + " d=a-b\n", + " print \"\\nD = A - B...\",\n", + " d.output()\n", + "except MatError:\n", + " print \"\\nInvalid matrix order for subtraction\",\n", + "e=matrix(3, 3)\n", + "try:\n", + " e=a*b\n", + " print \"\\nE = A * B...\",\n", + " e.output()\n", + "except MatError:\n", + " print \"\\nInvalid matrix order for multiplication\",\n", + "print \"\\n(Is matrix A equal to matrix B) ?\",\n", + "if a==b:\n", + " print \"Yes\"\n", + "else:\n", + " print \"No\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Matrix A details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[0,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[0,1] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Matrix B details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows? 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns? 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[0,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[1,0] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix A is... \n", + "1 2 \n", + "Matrix B is... \n", + "1 \n", + "2 \n", + "Invalid matrix order for addition \n", + "Invalid matrix order for subtraction \n", + "E = A * B... \n", + "5 \n", + "(Is matrix A equal to matrix B) ? No\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-recovery.cpp, Page no-802" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_SIG_INT=7\n", + "MAX_UNSIG_INT=15\n", + "class OVERFLOW:\n", + " pass\n", + "def sum(i, j, k):\n", + " try:\n", + " #Version1 procedure\n", + " result=i+j\n", + " if result>MAX_SIG_INT:\n", + " raise OVERFLOW()\n", + " result=result+k\n", + " if result>MAX_SIG_INT:\n", + " raise OVERFLOW()\n", + " print \"Version-1 succeeds\"\n", + " except OVERFLOW:\n", + " print \"Version-1 fails\"\n", + " try:\n", + " #Version2 procedure\n", + " result=i+k\n", + " if result>MAX_SIG_INT:\n", + " raise OVERFLOW()\n", + " result=result+j\n", + " if result>MAX_SIG_INT:\n", + " raise OVERFLOW()\n", + " print \"Version-2 succeeds\"\n", + " except OVERFLOW:\n", + " print \"Version-2 fails\"\n", + " try:\n", + " #Version3 procedure\n", + " result=j+k\n", + " if result>MAX_SIG_INT:\n", + " raise OVERFLOW()\n", + " result=result+i\n", + " if result>MAX_SIG_INT:\n", + " raise OVERFLOW()\n", + " print \"Version-3 succeeds\"\n", + " except OVERFLOW:\n", + " print \"Error: Overflow. All versions falied\"\n", + " return result\n", + "print \"Sum of 7, -3, 2 computation...\"\n", + "result=sum(7, -3, 2)\n", + "print \"Sum =\", result\n", + "print \"Sum of 7, 2, -3 computation...\"\n", + "result=sum(7,2, -3)\n", + "print \"Sum =\", result\n", + "print \"Sum of 3, 3, 2 computation...\"\n", + "result=sum(3, 3, 2)\n", + "print \"Sum =\", result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of 7, -3, 2 computation...\n", + "Version-1 succeeds\n", + "Sum = 6\n", + "Sum of 7, 2, -3 computation...\n", + "Version-1 fails\n", + "Version-2 succeeds\n", + "Sum = 6\n", + "Sum of 3, 3, 2 computation...\n", + "Version-1 fails\n", + "Version-2 fails\n", + "Error: Overflow. All versions falied\n", + "Sum = 8\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-new1.cpp, Page no-804" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "size=int(raw_input(\"How many bytes to be allocated: \"))\n", + "try:\n", + " data=[int]*size\n", + " print \"Memory allocation success, address =\", hex(id(data))\n", + "except:\n", + " print \"Could not allocate. Bye...\"\n", + "del data" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many bytes to be allocated: 300\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Memory allocation success, address = 0x3717188L\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-new2.cpp, Page no-805" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def display(data, m, n):\n", + " for i in range(m):\n", + " for j in range(n):\n", + " print data[i][j],\n", + " print \"\"\n", + "def de_allocate(data, m):\n", + " for i in range(m-1):\n", + " del data[i]\n", + "m, n=[int(x) for x in raw_input(\"Enter rows and columns count: \").split()]\n", + "try:\n", + " data = []\n", + " for i in range(m):\n", + " data.append([])\n", + " for j in range(n):\n", + " data[i].append(0)\n", + "except:\n", + " print \"Could not allocate. Bye...\"\n", + "else:\n", + " for i in range(m):\n", + " for j in range(n):\n", + " data[i][j]=i+j\n", + " display(data, m, n)\n", + " de_allocate(data, m)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter rows and columns count: 3 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 \n", + "1 2 3 4 \n", + "2 3 4 5 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-812" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ther is no goto in python\n", + "def main():\n", + " num=int(raw_input(\"Please enter an integer value: \"))\n", + " if isinstance(num, int):\n", + " print \"You entered a correct type of value\"\n", + " else:\n", + " raise num\n", + "try:\n", + " main()\n", + "except:\n", + " print \"You enetered incorrect type of value; try again\"\n", + " main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter an integer value: 10.7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You enetered incorrect type of value; try again\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter an integer value: 8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You entered a correct type of value\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-2, Page no-812" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Int:\n", + " def __init__(self, val):\n", + " self.value=val\n", + "class Double:\n", + " def __init__(self, val):\n", + " self.value=val\n", + "class Str:\n", + " def __init__(self, val):\n", + " self.value=val\n", + "i=int(raw_input(\"Press an integer between 1 - 3 to test exception handling with multiple catch blocks..\"))\n", + "try:\n", + " if i==1:\n", + " print \"Throwing integer value\"\n", + " raise Int(1)\n", + " if i==2:\n", + " print \"Throwing double value\"\n", + " raise Double(1.12)\n", + " if i==3:\n", + " print \"Throwing charcter value\"\n", + " raise Str('A')\n", + "except Int as e: #type of an exception raised is not correctly determined in the exception block and hence use of classes \n", + " print \"Caught an integer value\", e.value\n", + "except Double as e:\n", + " print \"Caught a double value\", e.value\n", + "except Str as e:\n", + " print \"Caught a character value\", e.value" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Press an integer between 1 - 3 to test exception handling with multiple catch blocks..3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Throwing charcter value\n", + "Caught a character value A\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingFromCtoC++.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingFromCtoC++.ipynb new file mode 100755 index 00000000..a2a5c818 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingFromCtoC++.ipynb @@ -0,0 +1,1389 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:67ef32c0745ec7cb1c0a0b98cb9b19c7c774d2c564bc299d0eb593490455997d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2- Moving from C to C++" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-hello.c, Page no-32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Hello World\" #printing a statement" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-hello.cpp, Page no-32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Hello World\" #printing a statement" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-output.cpp, Page no-36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "msg=\"C++ cout object\"\n", + "sex='M'\n", + "age=24\n", + "number=420.5\n", + "print sex, \n", + "print \" \", age, \" \", number\n", + "print msg\n", + "print '%d%d%d' %(1,2,3)\n", + "print number+1\n", + "print 99.99" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "M 24 420.5\n", + "C++ cout object\n", + "123\n", + "421.5\n", + "99.99\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-read.cpp, Page no-38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "name=[None]*25 #char name[25]\n", + "address=[None]*25 #char address[25]\n", + "name=raw_input(\"Enter name: \") #take input from user\n", + "age=int(raw_input(\"Enter Age: \"))\n", + "address=raw_input(\"Enter address: \")\n", + "print \"The data entered are: \"\n", + "print \"Name =\", name\n", + "print \"Age =\", age\n", + "print \"Address =\", address" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Age: 24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter address: C-DAC-Bangalore\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The data entered are: \n", + "Name = Rajkumar\n", + "Age = 24\n", + "Address = C-DAC-Bangalore\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-simpint.cpp, Page no-41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "principle=int(raw_input(\"Enter Principle Amount: \"))\n", + "time=int(raw_input(\"Enter time (in years): \"))\n", + "rate=int(raw_input(\"Enter Rate of Interest: \"))\n", + "SimpInt=(principle*time*rate)/100\n", + "print \"Simple Interest =\", SimpInt\n", + "total= principle + SimpInt\n", + "print \"Total Amount =\", total" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Principle Amount: 1000\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter time (in years): 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Rate of Interest: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Simple Interest = 100\n", + "Total Amount = 1100\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-area.cpp, Page no-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "PI=3.1452 \n", + "radius=float(raw_input(\"Enter Radius of Circle: \"))\n", + "area=PI*radius*radius\n", + "print \"Area of Circle =\", area" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Radius of Circle: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of Circle = 12.5808\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-disp.c, Page no-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def display(msg): #pass by reference\n", + " print msg\n", + " msg=\"Misuse\"\n", + " return msg\n", + "string=[None]*15\n", + "string=\"Hello World\"\n", + "string=display(string)\n", + "print string" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n", + "Misuse\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-disp.cpp, Page No-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def display(msg): #pass by value\n", + " print msg\n", + "string=[None]*15\n", + "string=\"Hello World\"\n", + "display(string)\n", + "print string" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n", + "Hello World\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-global.cpp, Page no-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num=20\n", + "def main():\n", + " global num\n", + " x=num\n", + " num=10\n", + " print \"Local =\", num\n", + " print \"Global =\",x\n", + " print \"Global+Local =\", x+num\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Local = 10\n", + "Global = 20\n", + "Global+Local = 30\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-loop.cpp, Page no-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "counter=50\n", + "def main():\n", + " global counter\n", + " x=counter\n", + " for counter in range(1, 10):\n", + " print x/counter\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "50\n", + "25\n", + "16\n", + "12\n", + "10\n", + "8\n", + "7\n", + "6\n", + "5\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-var1.cpp, Page no-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "for i in range(5):\n", + " print i\n", + "i+=1;\n", + "print i" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-def2.cpp, Page no-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=10\n", + "def main():\n", + " global a\n", + " global_a=a\n", + " print global_a\n", + " a=20\n", + " def temp():\n", + " a=30\n", + " print a\n", + " print global_a\n", + " temp()\n", + " print a\n", + " print global_a\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n", + "30\n", + "10\n", + "20\n", + "10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-refvar.cpp, Page no-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=z=1\n", + "b=2\n", + "c=3\n", + "print \"a=\",a, \"b=\", b, \"c=\", c, \"z=\", z\n", + "a=z=b\n", + "print \"a=\",a, \"b=\", b, \"c=\", c, \"z=\", z\n", + "a=z=c\n", + "print \"a=\",a, \"b=\", b, \"c=\", c, \"z=\", z\n", + "print \"&a=\", hex(id(a)),\"&b=\", hex(id(b)) , \"&c=\", hex(id(c))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a= 1 b= 2 c= 3 z= 1\n", + "a= 2 b= 2 c= 3 z= 2\n", + "a= 3 b= 2 c= 3 z= 3\n", + "&a= 0x1d95f68L &b= 0x1d95f80L &c= 0x1d95f68L\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-reftest.cpp, Page no-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "n=c_int(100)\n", + "p=pointer(n)\n", + "m=p[0]\n", + "print \"n =\", n.value, \"m =\", m, \"*p =\", p[0]\n", + "k=c_int(100)\n", + "p=pointer(k)\n", + "k.value=200\n", + "print \"n =\", n.value, \"m =\", m, \"*p =\", p[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 100 m = 100 *p = 100\n", + "n = 100 m = 100 *p = 200\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-newmax.cpp, Page no-50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(a, b):\n", + " if(a>b):\n", + " return a\n", + " else:\n", + " return b\n", + "x, y=[int(x) for x in raw_input(\"Enter two integers: \").split()] #takes input in a single line separated by white space\n", + "print \"Maximum =\", Max(x,y)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum = 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap.cpp, Page no-53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap (x, y): #pass by reference\n", + " i=x\n", + " x=y\n", + " y=i\n", + " return x, y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "(a,b)=swap(a, b)\n", + "print \"On swapping :\", a, b " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 2 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 3 2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-square.cpp, Page no-54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def square(x):\n", + " x=x*x\n", + " return x\n", + "num=float(raw_input('Enter a number : '))\n", + "print 'Its square =', square(num)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number : 5.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Its square = 30.25\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-show.c, Page no-56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show_integer(val):\n", + " print \"Integer: \", val\n", + "def show_double(val):\n", + " print \"Double: \", val\n", + "def show_string(val):\n", + " print \"String: \", val\n", + "show_integer(420)\n", + "show_double(3.1415)\n", + "show_string(\"Hello World\\n!\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer: 420\n", + "Double: 3.1415\n", + "String: Hello World\n", + "!\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-Show.cpp, Page no-56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show(val): #function overloading\n", + " if (isinstance(val, int)):\n", + " print \"Integer: \", val\n", + " if (isinstance(val, float)):\n", + " print \"Double: \", val\n", + " if(isinstance(val, str)):\n", + " print \"String: \", val\n", + "show(420)\n", + "show(3.1415)\n", + "show(\"Hello World\\n!\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer: 420\n", + "Double: 3.1415\n", + "String: Hello World\n", + "!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-prnstr.cpp, Page no-58" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def showstring(string=\"Hello World!\"): #default arguments\n", + " print string\n", + "showstring(\"Here is an explicit argument\")\n", + "showstring()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Here is an explicit argument\n", + "Hello World!\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-defarg1.cpp, Page no-59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PrintLine(ch='-', RepeatCount=70): #default arguments\n", + " print \"\\n\"\n", + " for i in range(RepeatCount):\n", + " sys.stdout.write(ch)\n", + "PrintLine()\n", + "PrintLine('!')\n", + "PrintLine('*', 40)\n", + "PrintLine('R', 55)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + "----------------------------------------------------------------------\n", + "\n", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "\n", + "****************************************\n", + "\n", + "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-defarg2, Page no-59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PrintLine(ch='-', RepeatCount=70, nLines=1): #default arguments\n", + " for j in range(nLines):\n", + " print \"\\n\"\n", + " for i in range(RepeatCount):\n", + " sys.stdout.write(ch)\n", + "PrintLine()\n", + "PrintLine('!')\n", + "PrintLine('*', 40)\n", + "PrintLine('R', 55)\n", + "PrintLine('&', 25, 2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + "----------------------------------------------------------------------\n", + "\n", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "\n", + "****************************************\n", + "\n", + "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", + "\n", + "&&&&&&&&&&&&&&&&&&&&&&&&&\n", + "\n", + "&&&&&&&&&&&&&&&&&&&&&&&&&" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-date1.cpp, Page no-61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from collections import namedtuple\n", + "struct_date = namedtuple('struct_date', 'day month year')\n", + "d1 = struct_date(26, 3, 1958)\n", + "d2 = struct_date(14, 4, 1971)\n", + "d3 = struct_date(1, 9, 1973)\n", + "print \"Birth Date of the First Author:\", \n", + "print \"%s-%s-%s\" %(d1.day, d1.month, d1.year)\n", + "print \"Birth Date of the Second Author:\", \n", + "print \"%s-%s-%s\" %(d2.day, d2.month, d2.year)\n", + "print \"Birth Date of the Third Author:\",\n", + "print \"%s-%s-%s\" %(d3.day, d3.month, d3.year)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth Date of the First Author: 26-3-1958\n", + "Birth Date of the Second Author: 14-4-1971\n", + "Birth Date of the Third Author: 1-9-1973\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-date2.cpp, Page no-63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class date(Structure):\n", + " _fields_=[(\"day\", c_int),(\"month\", c_int),(\"year\",c_int)]\n", + " def show(self):\n", + " print \"%s-%s-%s\" %(self.day, self.month, self.year)\n", + "d1=date(26, 3, 1958)\n", + "d2 = date(14, 4, 1971)\n", + "d3 = date(1, 9, 1973)\n", + "print \"Birth Date of the First Author:\", \n", + "d1.show()\n", + "print \"Birth Date of the Second Author:\", \n", + "d2.show()\n", + "print \"Birth Date of the Third Author:\",\n", + "d3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth Date of the First Author: 26-3-1958\n", + "Birth Date of the Second Author: 14-4-1971\n", + "Birth Date of the Third Author: 1-9-1973\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cast.cpp, Page no-65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=int\n", + "b=420.5\n", + "print \"int(10.4) = \", int(10.4)\n", + "print \"int(10.99) = \", int(10.99)\n", + "print \"b = \", b\n", + "a=int(b)\n", + "print \"a = int(b) = \", a\n", + "b=float(a)+1.5\n", + "print \"b = float(a)+1.5 = \", b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "int(10.4) = 10\n", + "int(10.99) = 10\n", + "b = 420.5\n", + "a = int(b) = 420\n", + "b = float(a)+1.5 = 421.5\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mswap.cpp, Page no-66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=raw_input(\"Enter two Characters : \").split()\n", + "ch1, ch2=swap(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter integers : \").split()]\n", + "a, b=swap(a, b)\n", + "print \"On swapping :\", a, b\n", + "c, d=[float(x) for x in raw_input(\"Enter floats : \").split()]\n", + "c, d=swap(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two Characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter integers : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-gswap.cpp, Page no-67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=raw_input(\"Enter two Characters : \").split()\n", + "ch1, ch2=swap(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter integers : \").split()]\n", + "a, b=swap(a, b)\n", + "print \"On swapping :\", a, b\n", + "c, d=[float(x) for x in raw_input(\"Enter floats : \").split()]\n", + "c, d=swap(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two Characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter integers : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector.cpp, Page no-72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def AddVectors(a, b, c, size):\n", + " for i in range(size):\n", + " c[i]=a[i]+b[i]\n", + "def ReadVector(vector, size):\n", + " for i in range(size):\n", + " vector[i]=int(raw_input())\n", + "def ShowVector(vector, size):\n", + " for i in range(size):\n", + " print vector[i],\n", + "vec_size=int(raw_input(\"Enter size of vector: \"))\n", + "x=[int]*vec_size\n", + "y=[int]*vec_size\n", + "z=[int]*vec_size\n", + "print \"Enter Elements of vector x: \"\n", + "ReadVector(x, vec_size)\n", + "print \"Enter Elements of vector y: \"\n", + "ReadVector(y, vec_size)\n", + "AddVectors(x, y, z, vec_size)\n", + "print \"Summation Vector z=a+b:\",\n", + "ShowVector(z, vec_size)\n", + "del x\n", + "del y\n", + "del z" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter size of vector: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Elements of vector x: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Elements of vector y: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Summation Vector z=a+b: 3 5 4 4 9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page no-73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def area(s1, s2=None):#function overloading and default parameters\n", + " if (isinstance(s1, int)):\n", + " if(isinstance(s2, int)):\n", + " return (s1*s2)\n", + " else:\n", + " return (s1*s1)\n", + " elif (isinstance(s1, float)):\n", + " return (3.14*s1*s1)\n", + "s=int(raw_input(\"Enter the side length of the square: \"))\n", + "l, b=[int(x) for x in raw_input(\"Enter the length and breadth of the rectangle: \").split()]\n", + "r=float(raw_input(\"Enter the radius of the circle: \"))\n", + "print \"Area of square = \", area(s)\n", + "print \"Area of rectangle = \", area(l, b)\n", + "print \"Area of circle = \", area(r)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the side length of the square: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the length and breadth of the rectangle: 2 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the radius of the circle: 2.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of square = 4\n", + "Area of rectangle = 8\n", + "Area of circle = 19.625\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingfromCtoC++.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingfromCtoC++.ipynb new file mode 100755 index 00000000..32b2a8e8 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingfromCtoC++.ipynb @@ -0,0 +1,1389 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:70a62a4d8104a5170dca82f519a0ca63c8b7c13d833950e937b1650a45a6a6fc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2- Moving from C to C++" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-hello.c, Page no-32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Hello World\" #printing a statement" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-hello.cpp, Page no-32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Hello World\" #printing a statement" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-output.cpp, Page no-36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "msg=\"C++ cout object\"\n", + "sex='M'\n", + "age=24\n", + "number=420.5\n", + "print sex, \n", + "print \" \", age, \" \", number\n", + "print msg\n", + "print '%d%d%d' %(1,2,3)\n", + "print number+1\n", + "print 99.99" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "M 24 420.5\n", + "C++ cout object\n", + "123\n", + "421.5\n", + "99.99\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-read.cpp, Page no-38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "name=[None]*25 #char name[25]\n", + "address=[None]*25 #char address[25]\n", + "name=raw_input(\"Enter name: \") #take input from user\n", + "age=int(raw_input(\"Enter Age: \"))\n", + "address=raw_input(\"Enter address: \")\n", + "print \"The data entered are: \"\n", + "print \"Name =\", name\n", + "print \"Age =\", age\n", + "print \"Address =\", address" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Age: 24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter address: C-DAC-Bangalore\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The data entered are: \n", + "Name = Rajkumar\n", + "Age = 24\n", + "Address = C-DAC-Bangalore\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-simpint.cpp, Page no-41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "principle=int(raw_input(\"Enter Principle Amount: \"))\n", + "time=int(raw_input(\"Enter time (in years): \"))\n", + "rate=int(raw_input(\"Enter Rate of Interest: \"))\n", + "SimpInt=(principle*time*rate)/100\n", + "print \"Simple Interest =\", SimpInt\n", + "total= principle + SimpInt\n", + "print \"Total Amount =\", total" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Principle Amount: 1000\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter time (in years): 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Rate of Interest: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Simple Interest = 100\n", + "Total Amount = 1100\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-area.cpp, Page no-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "PI=3.1452 \n", + "radius=float(raw_input(\"Enter Radius of Circle: \"))\n", + "area=PI*radius*radius\n", + "print \"Area of Circle =\", area" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Radius of Circle: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of Circle = 12.5808\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-disp.c, Page no-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def display(msg): #pass by reference\n", + " print msg\n", + " msg=\"Misuse\"\n", + " return msg\n", + "string=[None]*15\n", + "string=\"Hello World\"\n", + "string=display(string)\n", + "print string" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n", + "Misuse\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-disp.cpp, Page No-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def display(msg): #pass by value\n", + " print msg\n", + "string=[None]*15\n", + "string=\"Hello World\"\n", + "display(string)\n", + "print string" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n", + "Hello World\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-global.cpp, Page no-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num=20\n", + "def main():\n", + " global num\n", + " x=num\n", + " num=10\n", + " print \"Local =\", num\n", + " print \"Global =\",x\n", + " print \"Global+Local =\", x+num\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Local = 10\n", + "Global = 20\n", + "Global+Local = 30\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-loop.cpp, Page no-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "counter=50\n", + "def main():\n", + " global counter\n", + " x=counter\n", + " for counter in range(1, 10):\n", + " print x/counter\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "50\n", + "25\n", + "16\n", + "12\n", + "10\n", + "8\n", + "7\n", + "6\n", + "5\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-var1.cpp, Page no-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "for i in range(5):\n", + " print i\n", + "i+=1;\n", + "print i" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-def2.cpp, Page no-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=10\n", + "def main():\n", + " global a\n", + " global_a=a\n", + " print global_a\n", + " a=20\n", + " def temp():\n", + " a=30\n", + " print a\n", + " print global_a\n", + " temp()\n", + " print a\n", + " print global_a\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n", + "30\n", + "10\n", + "20\n", + "10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-refvar.cpp, Page no-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=z=1\n", + "b=2\n", + "c=3\n", + "print \"a=\",a, \"b=\", b, \"c=\", c, \"z=\", z\n", + "a=z=b\n", + "print \"a=\",a, \"b=\", b, \"c=\", c, \"z=\", z\n", + "a=z=c\n", + "print \"a=\",a, \"b=\", b, \"c=\", c, \"z=\", z\n", + "print \"&a=\", hex(id(a)),\"&b=\", hex(id(b)) , \"&c=\", hex(id(c))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a= 1 b= 2 c= 3 z= 1\n", + "a= 2 b= 2 c= 3 z= 2\n", + "a= 3 b= 2 c= 3 z= 3\n", + "&a= 0x1d95f68L &b= 0x1d95f80L &c= 0x1d95f68L\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-reftest.cpp, Page no-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import c_int, pointer\n", + "n=c_int(100)\n", + "p=pointer(n)\n", + "m=p[0]\n", + "print \"n =\", n.value, \"m =\", m, \"*p =\", p[0]\n", + "k=c_int(100)\n", + "p=pointer(k)\n", + "k.value=200\n", + "print \"n =\", n.value, \"m =\", m, \"*p =\", p[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 100 m = 100 *p = 100\n", + "n = 100 m = 100 *p = 200\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-newmax.cpp, Page no-50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(a, b):\n", + " if(a>b):\n", + " return a\n", + " else:\n", + " return b\n", + "x, y=[int(x) for x in raw_input(\"Enter two integers: \").split()] #takes input in a single line separated by white space\n", + "print \"Maximum =\", Max(x,y)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum = 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap.cpp, Page no-53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap (x, y): #pass by reference\n", + " i=x\n", + " x=y\n", + " y=i\n", + " return x, y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "(a,b)=swap(a, b)\n", + "print \"On swapping :\", a, b " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 2 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 3 2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-square.cpp, Page no-54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def square(x):\n", + " x=x*x\n", + " return x\n", + "num=float(raw_input('Enter a number : '))\n", + "print 'Its square =', square(num)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number : 5.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Its square = 30.25\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-show.c, Page no-56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show_integer(val):\n", + " print \"Integer: \", val\n", + "def show_double(val):\n", + " print \"Double: \", val\n", + "def show_string(val):\n", + " print \"String: \", val\n", + "show_integer(420)\n", + "show_double(3.1415)\n", + "show_string(\"Hello World\\n!\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer: 420\n", + "Double: 3.1415\n", + "String: Hello World\n", + "!\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-Show.cpp, Page no-56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show(val): #function overloading\n", + " if (isinstance(val, int)):\n", + " print \"Integer: \", val\n", + " if (isinstance(val, float)):\n", + " print \"Double: \", val\n", + " if(isinstance(val, str)):\n", + " print \"String: \", val\n", + "show(420)\n", + "show(3.1415)\n", + "show(\"Hello World\\n!\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer: 420\n", + "Double: 3.1415\n", + "String: Hello World\n", + "!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-prnstr.cpp, Page no-58" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def showstring(string=\"Hello World!\"): #default arguments\n", + " print string\n", + "showstring(\"Here is an explicit argument\")\n", + "showstring()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Here is an explicit argument\n", + "Hello World!\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-defarg1.cpp, Page no-59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PrintLine(ch='-', RepeatCount=70): #default arguments\n", + " print \"\\n\"\n", + " for i in range(RepeatCount):\n", + " sys.stdout.write(ch)\n", + "PrintLine()\n", + "PrintLine('!')\n", + "PrintLine('*', 40)\n", + "PrintLine('R', 55)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + "----------------------------------------------------------------------\n", + "\n", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "\n", + "****************************************\n", + "\n", + "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-defarg2, Page no-59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PrintLine(ch='-', RepeatCount=70, nLines=1): #default arguments\n", + " for j in range(nLines):\n", + " print \"\\n\"\n", + " for i in range(RepeatCount):\n", + " sys.stdout.write(ch)\n", + "PrintLine()\n", + "PrintLine('!')\n", + "PrintLine('*', 40)\n", + "PrintLine('R', 55)\n", + "PrintLine('&', 25, 2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + "----------------------------------------------------------------------\n", + "\n", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "\n", + "****************************************\n", + "\n", + "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", + "\n", + "&&&&&&&&&&&&&&&&&&&&&&&&&\n", + "\n", + "&&&&&&&&&&&&&&&&&&&&&&&&&" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-date1.cpp, Page no-61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from collections import namedtuple\n", + "struct_date = namedtuple('struct_date', 'day month year')\n", + "d1 = struct_date(26, 3, 1958)\n", + "d2 = struct_date(14, 4, 1971)\n", + "d3 = struct_date(1, 9, 1973)\n", + "print \"Birth Date of the First Author:\", \n", + "print \"%s-%s-%s\" %(d1.day, d1.month, d1.year)\n", + "print \"Birth Date of the Second Author:\", \n", + "print \"%s-%s-%s\" %(d2.day, d2.month, d2.year)\n", + "print \"Birth Date of the Third Author:\",\n", + "print \"%s-%s-%s\" %(d3.day, d3.month, d3.year)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth Date of the First Author: 26-3-1958\n", + "Birth Date of the Second Author: 14-4-1971\n", + "Birth Date of the Third Author: 1-9-1973\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-date2.cpp, Page no-63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure, c_int\n", + "class date(Structure):\n", + " _fields_=[(\"day\", c_int),(\"month\", c_int),(\"year\",c_int)]\n", + " def show(self):\n", + " print \"%s-%s-%s\" %(self.day, self.month, self.year)\n", + "d1=date(26, 3, 1958)\n", + "d2 = date(14, 4, 1971)\n", + "d3 = date(1, 9, 1973)\n", + "print \"Birth Date of the First Author:\", \n", + "d1.show()\n", + "print \"Birth Date of the Second Author:\", \n", + "d2.show()\n", + "print \"Birth Date of the Third Author:\",\n", + "d3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth Date of the First Author: 26-3-1958\n", + "Birth Date of the Second Author: 14-4-1971\n", + "Birth Date of the Third Author: 1-9-1973\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-cast.cpp, Page no-65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=int\n", + "b=420.5\n", + "print \"int(10.4) =\", int(10.4)\n", + "print \"int(10.99) =\", int(10.99)\n", + "print \"b =\", b\n", + "a=int(b)\n", + "print \"a = int(b) =\", a\n", + "b=float(a)+1.5\n", + "print \"b = float(a)+1.5 =\", b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "int(10.4) = 10\n", + "int(10.99) = 10\n", + "b = 420.5\n", + "a = int(b) = 420\n", + "b = float(a)+1.5 = 421.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-mswap.cpp, Page no-66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=raw_input(\"Enter two Characters : \").split()\n", + "ch1, ch2=swap(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter integers : \").split()]\n", + "a, b=swap(a, b)\n", + "print \"On swapping :\", a, b\n", + "c, d=[float(x) for x in raw_input(\"Enter floats : \").split()]\n", + "c, d=swap(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two Characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter integers : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-gswap.cpp, Page no-67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=raw_input(\"Enter two Characters : \").split()\n", + "ch1, ch2=swap(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter integers : \").split()]\n", + "a, b=swap(a, b)\n", + "print \"On swapping :\", a, b\n", + "c, d=[float(x) for x in raw_input(\"Enter floats : \").split()]\n", + "c, d=swap(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two Characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter integers : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector.cpp, Page no-72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def AddVectors(a, b, c, size):\n", + " for i in range(size):\n", + " c[i]=a[i]+b[i]\n", + "def ReadVector(vector, size):\n", + " for i in range(size):\n", + " vector[i]=int(raw_input())\n", + "def ShowVector(vector, size):\n", + " for i in range(size):\n", + " print vector[i],\n", + "vec_size=int(raw_input(\"Enter size of vector: \"))\n", + "x=[int]*vec_size\n", + "y=[int]*vec_size\n", + "z=[int]*vec_size\n", + "print \"Enter Elements of vector x: \"\n", + "ReadVector(x, vec_size)\n", + "print \"Enter Elements of vector y: \"\n", + "ReadVector(y, vec_size)\n", + "AddVectors(x, y, z, vec_size)\n", + "print \"Summation Vector z=a+b:\",\n", + "ShowVector(z, vec_size)\n", + "del x\n", + "del y\n", + "del z" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter size of vector: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Elements of vector x: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Elements of vector y: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Summation Vector z=a+b: 3 5 4 4 9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page no-73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def area(s1, s2=None):#function overloading and default parameters\n", + " if (isinstance(s1, int)):\n", + " if(isinstance(s2, int)):\n", + " return (s1*s2)\n", + " else:\n", + " return (s1*s1)\n", + " elif (isinstance(s1, float)):\n", + " return (3.14*s1*s1)\n", + "s=int(raw_input(\"Enter the side length of the square: \"))\n", + "l, b=[int(x) for x in raw_input(\"Enter the length and breadth of the rectangle: \").split()]\n", + "r=float(raw_input(\"Enter the radius of the circle: \"))\n", + "print \"Area of square = \", area(s)\n", + "print \"Area of rectangle = \", area(l, b)\n", + "print \"Area of circle = \", area(r)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the side length of the square: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the length and breadth of the rectangle: 2 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the radius of the circle: 2.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of square = 4\n", + "Area of rectangle = 8\n", + "Area of circle = 19.625\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance.ipynb new file mode 100755 index 00000000..d81ed22a --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance.ipynb @@ -0,0 +1,629 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d0ea461766152305a5e3562b0029be55e226b9445d5b8707016af6bf55ff7b00" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3- C++ at a Glance" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- counter1.cpp, Page no-77" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Counter:\n", + " __value=int\n", + " def __init__(self, val=None):#constructor\n", + " if(isinstance(val, int)):\n", + " self.__value=val\n", + " else:\n", + " self.__value=0\n", + " def __del__(self):#destructor\n", + " print \"object destroyed\"\n", + " def GetCounter(self):\n", + " return self.__value\n", + " def up(self):\n", + " self.__value=self.__value+1\n", + "counter1=Counter()\n", + "counter2=Counter(1)\n", + "print \"counter1 = \", counter1.GetCounter()\n", + "print \"counter2 = \", counter2.GetCounter()\n", + "counter1.up()\n", + "counter2.up()\n", + "print \"counter1 = \", counter1.GetCounter()\n", + "print \"counter2 = \", counter2.GetCounter()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "object destroyed\n", + "object destroyed\n", + "counter1 = 0\n", + "counter2 = 1\n", + "counter1 = 1\n", + "counter2 = 2\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-Stdclass.cpp, Page no-80" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def setdata(self, roll_no_in, name_in): #outside declaration of member functions\n", + " self._student__roll_no=roll_no_in\n", + " self._student__name=name_in\n", + "def outdata(self):#outside declaration of member functions\n", + " print \"Roll no = \", self._student__roll_no\n", + " print \"Name = \", self._student__name\n", + "class student:\n", + " __roll_no=int\n", + " __name=[None]*20\n", + " setdata=setdata\n", + " outdata=outdata\n", + "s1=student()\n", + "s2=student()\n", + "s1.setdata(1, \"Tejaswi\")\n", + "s2.setdata(10, \"Rajkumar\")\n", + "print \"Student details...\"\n", + "s1.outdata()\n", + "s2.outdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student details...\n", + "Roll no = 1\n", + "Name = Tejaswi\n", + "Roll no = 10\n", + "Name = Rajkumar\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-Counter2.cpp, Page no-82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class counter:\n", + " __value=int\n", + " def __init__(self, val=0):\n", + " self.__value=val\n", + " def GetCounter(self):\n", + " return self.__value\n", + " def up(self):\n", + " self.__value+=1\n", + "class NewCounter(counter): #inheritance\n", + " def __init__(self, val=None) : \n", + " if(isinstance(val, int)):\n", + " counter.__init__(self, val)\n", + " else:\n", + " counter.__init__(self)\n", + " def down(self):\n", + " self._counter__value=self._counter__value-1\n", + "counter1=NewCounter()\n", + "counter2=NewCounter(1)\n", + "print \"counter1 initially =\", counter1.GetCounter()\n", + "print \"counter2 initially =\", counter2.GetCounter()\n", + "counter1.up()\n", + "counter2.up()\n", + "print \"counter1 on increment =\", counter1.GetCounter()\n", + "print \"counter2 on increment =\", counter2.GetCounter()\n", + "counter1.down()\n", + "counter2.down()\n", + "print \"counter1 on decrement =\", counter1.GetCounter()\n", + "print \"counter2 on decrement =\", counter2.GetCounter()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "counter1 initially = 0\n", + "counter2 initially = 1\n", + "counter1 on increment = 1\n", + "counter2 on increment = 2\n", + "counter1 on decrement = 0\n", + "counter2 on decrement = 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-counter3.cpp, Page no-85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class counter:\n", + " __value=int\n", + " def __init__(self, val=0):\n", + " self.__value=val\n", + " def GetCounter(self):\n", + " return self.__value\n", + " #overloading increment operator\n", + " def __iadd__(self, val):\n", + " self.__value+=val\n", + " return self\n", + " #overloading decrement operator\n", + " def __isub__(self, val):\n", + " self._counter__value-=val\n", + " return self\n", + "counter1=counter()\n", + "counter2=counter(1)\n", + "print \"counter1 initially =\", counter1.GetCounter()\n", + "print \"counter2 initially =\", counter2.GetCounter()\n", + "counter1+=1\n", + "counter2+=1\n", + "print \"counter1 on increment =\", counter1.GetCounter()\n", + "print \"counter2 on increment =\", counter2.GetCounter()\n", + "counter1-=1\n", + "counter2-=1\n", + "print \"counter1 on decrement =\", counter1.GetCounter()\n", + "print \"counter2 on decrement =\", counter2.GetCounter()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "counter1 initially = 0\n", + "counter2 initially = 1\n", + "counter1 on increment = 1\n", + "counter2 on increment = 2\n", + "counter1 on decrement = 0\n", + "counter2 on decrement = 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-counter4.cpp, Page no-88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class counter:\n", + " __value=int\n", + " def __init__(self, val=0):\n", + " self.__value=val\n", + " def GetCounter(self):\n", + " return self.__value\n", + " def __iadd__(self, val):\n", + " self.__value+=val\n", + " return self\n", + " def __isub__(self, val):\n", + " self._counter__value-=val\n", + " return self\n", + " #overloading of + operator\n", + " def __add__(self, counter2):\n", + " temp=counter()\n", + " temp.__value=self.__value+counter2.__value\n", + " return temp\n", + " #No overloading of << and >> operators in python\n", + " def output(self):\n", + " return self.__value\n", + "counter1=counter()\n", + "counter2=counter(1)\n", + "print \"counter1 initially =\", counter1.GetCounter()\n", + "print \"counter2 initially =\", counter2.GetCounter()\n", + "counter1+=1\n", + "counter2+=1\n", + "print \"counter1 on increment =\", counter1.GetCounter()\n", + "print \"counter2 on increment =\", counter2.GetCounter()\n", + "counter1-=1\n", + "counter2-=1\n", + "print \"counter1 on decrement =\", counter1.GetCounter()\n", + "print \"counter2 on decrement =\", counter2.GetCounter()\n", + "counter3=counter()\n", + "counter3=counter1+counter2\n", + "print \"counter3 = counter1+counter2 =\", counter3.output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "counter1 initially = 0\n", + "counter2 initially = 1\n", + "counter1 on increment = 1\n", + "counter2 on increment = 2\n", + "counter1 on decrement = 0\n", + "counter2 on decrement = 1\n", + "counter3 = counter1+counter2 = 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-virtual.cpp, Page no-91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Father:\n", + " __f_age=int\n", + " def __init__(self, n):\n", + " self.__f_age=n\n", + " def GetAge(self):\n", + " return self.__f_age\n", + "class Son(Father):\n", + " __s_age=int\n", + " def __init__(self, n, m):\n", + " Father.__init__(self, n)\n", + " self.__s_age=m\n", + " def GetAge(self):\n", + " return self.__s_age\n", + "basep=[Father]\n", + "basep=Father(45)\n", + "print \"Father's Age:\",\n", + "print basep.GetAge()\n", + "del basep\n", + "basep=[Son(45, 20)]\n", + "print \"Son's Age:\",\n", + "print basep[0].GetAge()\n", + "del basep" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Father's Age: 45\n", + "Son's Age: 20\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector.cpp, Page no-94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class vector:\n", + " __size=int\n", + " def __init__(self, vector_size):\n", + " self.__size=vector_size\n", + " self.__v=[vector]*self.__size\n", + " def __del__(self):\n", + " del self.__v\n", + " def elem(self, i, x=None):\n", + " if isinstance(x, int) or isinstance(x, float):\n", + " if i>=self.__size:\n", + " print \"Error: Out of Range\"\n", + " return\n", + " self.__v[i]=x\n", + " else:\n", + " return self.__v[i]\n", + " def show(self):\n", + " for i in range(self.__size):\n", + " print self.elem(i), \",\",\n", + "int_vect=vector(5)\n", + "float_vect=vector(4)\n", + "for i in range(5):\n", + " int_vect.elem(i, i+1)\n", + "for i in range(4):\n", + " float_vect.elem(i,i+1.5)\n", + "print \"Integer Vector:\",\n", + "int_vect.show()\n", + "print \"\\nFloating Vector:\",\n", + "float_vect.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer Vector: 1 , 2 , 3 , 4 , 5 , \n", + "Floating Vector: 1.5 , 2.5 , 3.5 , 4.5 ,\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-number.cpp, Page no-97" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class number:\n", + " __num=int\n", + " def read(self):\n", + " self.__num=int(raw_input())\n", + " class DIVIDE():\n", + " pass\n", + " def div(self, num2):\n", + " if num2.__num==0:\n", + " raise self.DIVIDE() #raise exception of type DIVIDE()\n", + " else:\n", + " return self.__num/num2.__num\n", + "num1=number()\n", + "num2=number()\n", + "print \"Enter Number 1: \",\n", + "num1.read()\n", + "print \"Enter Number 2: \",\n", + "num2.read()\n", + "try:\n", + " print \"trying division operation...\",\n", + " result=num1.div(num2)\n", + " print \"succeeded\"\n", + "except number.DIVIDE: #exception handler of exception type DIVIDE()\n", + " print \"failed\"\n", + " print \"Exception: Divide-By-Zero\"\n", + "else: #this block is executed only if no exception has been raised\n", + " print \"num1/num2 =\", result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Number 1: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Number 2: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " trying division operation... failed\n", + "Exception: Divide-By-Zero\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-infile.cpp, Page no-101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "try:\n", + " infile=open(\"sample.in\", \"r\") #open file in input mode\n", + " while(1):\n", + " buff=infile.readline() #read a single line from the file\n", + " if buff=='': #to determine end of file\n", + " break\n", + " print buff,\n", + "except IOError: #error in opening file\n", + " print \"Error: sample.in non-existent\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rajkumar, C-DAC, India\n", + "Bjarne Stroustrup, AT & T, USA\n", + "Smrithi, Hyderabad, India\n", + "Tejaswi, Hyderabad, India\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-outfile.cpp, Page no-102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "outfile=open(\"sample.out\", \"w\") #file opened in output mode\n", + "if not(outfile):\n", + " print \"Error: sample.out unable to open\"\n", + "else:\n", + " while(1):\n", + " buff=raw_input()\n", + " if buff==\"end\":\n", + " break\n", + " outfile.write(buff)\n", + " outfile.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "OOP is good\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++ is OOP\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++ is good\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "end\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example, Page no-103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "count=0\n", + "file1=open(\"FILE1.txt\", \"r\") #file opened in input mode\n", + "file2=open(\"FILE2.txt\", \"w\") #file opened in output mode\n", + "while(1):\n", + " ch=file1.read(1)\n", + " if ch=='': #detecting eof\n", + " break\n", + " if count%2==0:\n", + " file2.write(ch)\n", + " count+=1\n", + "print \"Alternate characters from File1 have been successfully copied into File2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Alternate characters from File1 have been successfully copied into File2\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance_1.ipynb new file mode 100755 index 00000000..d81ed22a --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance_1.ipynb @@ -0,0 +1,629 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d0ea461766152305a5e3562b0029be55e226b9445d5b8707016af6bf55ff7b00" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3- C++ at a Glance" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- counter1.cpp, Page no-77" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Counter:\n", + " __value=int\n", + " def __init__(self, val=None):#constructor\n", + " if(isinstance(val, int)):\n", + " self.__value=val\n", + " else:\n", + " self.__value=0\n", + " def __del__(self):#destructor\n", + " print \"object destroyed\"\n", + " def GetCounter(self):\n", + " return self.__value\n", + " def up(self):\n", + " self.__value=self.__value+1\n", + "counter1=Counter()\n", + "counter2=Counter(1)\n", + "print \"counter1 = \", counter1.GetCounter()\n", + "print \"counter2 = \", counter2.GetCounter()\n", + "counter1.up()\n", + "counter2.up()\n", + "print \"counter1 = \", counter1.GetCounter()\n", + "print \"counter2 = \", counter2.GetCounter()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "object destroyed\n", + "object destroyed\n", + "counter1 = 0\n", + "counter2 = 1\n", + "counter1 = 1\n", + "counter2 = 2\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-Stdclass.cpp, Page no-80" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def setdata(self, roll_no_in, name_in): #outside declaration of member functions\n", + " self._student__roll_no=roll_no_in\n", + " self._student__name=name_in\n", + "def outdata(self):#outside declaration of member functions\n", + " print \"Roll no = \", self._student__roll_no\n", + " print \"Name = \", self._student__name\n", + "class student:\n", + " __roll_no=int\n", + " __name=[None]*20\n", + " setdata=setdata\n", + " outdata=outdata\n", + "s1=student()\n", + "s2=student()\n", + "s1.setdata(1, \"Tejaswi\")\n", + "s2.setdata(10, \"Rajkumar\")\n", + "print \"Student details...\"\n", + "s1.outdata()\n", + "s2.outdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student details...\n", + "Roll no = 1\n", + "Name = Tejaswi\n", + "Roll no = 10\n", + "Name = Rajkumar\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-Counter2.cpp, Page no-82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class counter:\n", + " __value=int\n", + " def __init__(self, val=0):\n", + " self.__value=val\n", + " def GetCounter(self):\n", + " return self.__value\n", + " def up(self):\n", + " self.__value+=1\n", + "class NewCounter(counter): #inheritance\n", + " def __init__(self, val=None) : \n", + " if(isinstance(val, int)):\n", + " counter.__init__(self, val)\n", + " else:\n", + " counter.__init__(self)\n", + " def down(self):\n", + " self._counter__value=self._counter__value-1\n", + "counter1=NewCounter()\n", + "counter2=NewCounter(1)\n", + "print \"counter1 initially =\", counter1.GetCounter()\n", + "print \"counter2 initially =\", counter2.GetCounter()\n", + "counter1.up()\n", + "counter2.up()\n", + "print \"counter1 on increment =\", counter1.GetCounter()\n", + "print \"counter2 on increment =\", counter2.GetCounter()\n", + "counter1.down()\n", + "counter2.down()\n", + "print \"counter1 on decrement =\", counter1.GetCounter()\n", + "print \"counter2 on decrement =\", counter2.GetCounter()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "counter1 initially = 0\n", + "counter2 initially = 1\n", + "counter1 on increment = 1\n", + "counter2 on increment = 2\n", + "counter1 on decrement = 0\n", + "counter2 on decrement = 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-counter3.cpp, Page no-85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class counter:\n", + " __value=int\n", + " def __init__(self, val=0):\n", + " self.__value=val\n", + " def GetCounter(self):\n", + " return self.__value\n", + " #overloading increment operator\n", + " def __iadd__(self, val):\n", + " self.__value+=val\n", + " return self\n", + " #overloading decrement operator\n", + " def __isub__(self, val):\n", + " self._counter__value-=val\n", + " return self\n", + "counter1=counter()\n", + "counter2=counter(1)\n", + "print \"counter1 initially =\", counter1.GetCounter()\n", + "print \"counter2 initially =\", counter2.GetCounter()\n", + "counter1+=1\n", + "counter2+=1\n", + "print \"counter1 on increment =\", counter1.GetCounter()\n", + "print \"counter2 on increment =\", counter2.GetCounter()\n", + "counter1-=1\n", + "counter2-=1\n", + "print \"counter1 on decrement =\", counter1.GetCounter()\n", + "print \"counter2 on decrement =\", counter2.GetCounter()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "counter1 initially = 0\n", + "counter2 initially = 1\n", + "counter1 on increment = 1\n", + "counter2 on increment = 2\n", + "counter1 on decrement = 0\n", + "counter2 on decrement = 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-counter4.cpp, Page no-88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class counter:\n", + " __value=int\n", + " def __init__(self, val=0):\n", + " self.__value=val\n", + " def GetCounter(self):\n", + " return self.__value\n", + " def __iadd__(self, val):\n", + " self.__value+=val\n", + " return self\n", + " def __isub__(self, val):\n", + " self._counter__value-=val\n", + " return self\n", + " #overloading of + operator\n", + " def __add__(self, counter2):\n", + " temp=counter()\n", + " temp.__value=self.__value+counter2.__value\n", + " return temp\n", + " #No overloading of << and >> operators in python\n", + " def output(self):\n", + " return self.__value\n", + "counter1=counter()\n", + "counter2=counter(1)\n", + "print \"counter1 initially =\", counter1.GetCounter()\n", + "print \"counter2 initially =\", counter2.GetCounter()\n", + "counter1+=1\n", + "counter2+=1\n", + "print \"counter1 on increment =\", counter1.GetCounter()\n", + "print \"counter2 on increment =\", counter2.GetCounter()\n", + "counter1-=1\n", + "counter2-=1\n", + "print \"counter1 on decrement =\", counter1.GetCounter()\n", + "print \"counter2 on decrement =\", counter2.GetCounter()\n", + "counter3=counter()\n", + "counter3=counter1+counter2\n", + "print \"counter3 = counter1+counter2 =\", counter3.output()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "counter1 initially = 0\n", + "counter2 initially = 1\n", + "counter1 on increment = 1\n", + "counter2 on increment = 2\n", + "counter1 on decrement = 0\n", + "counter2 on decrement = 1\n", + "counter3 = counter1+counter2 = 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-virtual.cpp, Page no-91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Father:\n", + " __f_age=int\n", + " def __init__(self, n):\n", + " self.__f_age=n\n", + " def GetAge(self):\n", + " return self.__f_age\n", + "class Son(Father):\n", + " __s_age=int\n", + " def __init__(self, n, m):\n", + " Father.__init__(self, n)\n", + " self.__s_age=m\n", + " def GetAge(self):\n", + " return self.__s_age\n", + "basep=[Father]\n", + "basep=Father(45)\n", + "print \"Father's Age:\",\n", + "print basep.GetAge()\n", + "del basep\n", + "basep=[Son(45, 20)]\n", + "print \"Son's Age:\",\n", + "print basep[0].GetAge()\n", + "del basep" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Father's Age: 45\n", + "Son's Age: 20\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector.cpp, Page no-94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class vector:\n", + " __size=int\n", + " def __init__(self, vector_size):\n", + " self.__size=vector_size\n", + " self.__v=[vector]*self.__size\n", + " def __del__(self):\n", + " del self.__v\n", + " def elem(self, i, x=None):\n", + " if isinstance(x, int) or isinstance(x, float):\n", + " if i>=self.__size:\n", + " print \"Error: Out of Range\"\n", + " return\n", + " self.__v[i]=x\n", + " else:\n", + " return self.__v[i]\n", + " def show(self):\n", + " for i in range(self.__size):\n", + " print self.elem(i), \",\",\n", + "int_vect=vector(5)\n", + "float_vect=vector(4)\n", + "for i in range(5):\n", + " int_vect.elem(i, i+1)\n", + "for i in range(4):\n", + " float_vect.elem(i,i+1.5)\n", + "print \"Integer Vector:\",\n", + "int_vect.show()\n", + "print \"\\nFloating Vector:\",\n", + "float_vect.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer Vector: 1 , 2 , 3 , 4 , 5 , \n", + "Floating Vector: 1.5 , 2.5 , 3.5 , 4.5 ,\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-number.cpp, Page no-97" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class number:\n", + " __num=int\n", + " def read(self):\n", + " self.__num=int(raw_input())\n", + " class DIVIDE():\n", + " pass\n", + " def div(self, num2):\n", + " if num2.__num==0:\n", + " raise self.DIVIDE() #raise exception of type DIVIDE()\n", + " else:\n", + " return self.__num/num2.__num\n", + "num1=number()\n", + "num2=number()\n", + "print \"Enter Number 1: \",\n", + "num1.read()\n", + "print \"Enter Number 2: \",\n", + "num2.read()\n", + "try:\n", + " print \"trying division operation...\",\n", + " result=num1.div(num2)\n", + " print \"succeeded\"\n", + "except number.DIVIDE: #exception handler of exception type DIVIDE()\n", + " print \"failed\"\n", + " print \"Exception: Divide-By-Zero\"\n", + "else: #this block is executed only if no exception has been raised\n", + " print \"num1/num2 =\", result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Number 1: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Number 2: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " trying division operation... failed\n", + "Exception: Divide-By-Zero\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-infile.cpp, Page no-101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "try:\n", + " infile=open(\"sample.in\", \"r\") #open file in input mode\n", + " while(1):\n", + " buff=infile.readline() #read a single line from the file\n", + " if buff=='': #to determine end of file\n", + " break\n", + " print buff,\n", + "except IOError: #error in opening file\n", + " print \"Error: sample.in non-existent\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rajkumar, C-DAC, India\n", + "Bjarne Stroustrup, AT & T, USA\n", + "Smrithi, Hyderabad, India\n", + "Tejaswi, Hyderabad, India\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-outfile.cpp, Page no-102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "outfile=open(\"sample.out\", \"w\") #file opened in output mode\n", + "if not(outfile):\n", + " print \"Error: sample.out unable to open\"\n", + "else:\n", + " while(1):\n", + " buff=raw_input()\n", + " if buff==\"end\":\n", + " break\n", + " outfile.write(buff)\n", + " outfile.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "OOP is good\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++ is OOP\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++ is good\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "end\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example, Page no-103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "count=0\n", + "file1=open(\"FILE1.txt\", \"r\") #file opened in input mode\n", + "file2=open(\"FILE2.txt\", \"w\") #file opened in output mode\n", + "while(1):\n", + " ch=file1.read(1)\n", + " if ch=='': #detecting eof\n", + " break\n", + " if count%2==0:\n", + " file2.write(ch)\n", + " count+=1\n", + "print \"Alternate characters from File1 have been successfully copied into File2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Alternate characters from File1 have been successfully copied into File2\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions.ipynb new file mode 100755 index 00000000..1b95ba16 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions.ipynb @@ -0,0 +1,881 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:17ba214af5fef45344b6cf20acb6a7b4a88d1bf393c6e0c1c50e04f764bab0ff" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4- Data types, Operators and Expressions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-show1.cpp, Page no-111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=int\n", + "b=int\n", + "c=100\n", + "distance=float\n", + "a=c\n", + "b=c+100\n", + "distance=55.9\n", + "print \"a =\", a\n", + "print \"b =\", b\n", + "print \"c =\", c\n", + "print \"distance =\", distance" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 100\n", + "b = 200\n", + "c = 100\n", + "distance = 55.9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ascii.cpp, Page no-112" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "code=int(raw_input(\"Enter an ASCII code(0-127): \"))\n", + "symbol=code\n", + "print \"The symbol corresponding to %d is %c\" %(code, symbol)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an ASCII code(0-127): 65\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The symbol corresponding to 65 is A\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-temper.cpp, Page no-115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "c=float(raw_input(\"Enter temperature in Celsius: \"))\n", + "f=1.8*c+32\n", + "print \"Equivalent fahrenheit = \", f\n", + "f=float(raw_input(\"Enter temperature in fahrenheit: \"))\n", + "c=(f-32)/1.8\n", + "print \"Equivalent Celsius = \", c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter temperature in Celsius: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equivalent fahrenheit = 41.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter temperature in fahrenheit: 40\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equivalent Celsius = 4.44444444444\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-size.cpp, Page no-116" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "print \"sizeof( char ) =\", sizeof(c_char)\n", + "print \"sizeof( short ) =\", sizeof(c_short)\n", + "print \"sizeof( short int ) =\", sizeof(c_short)\n", + "print \"sizeof( int ) =\", sizeof(c_int)\n", + "print \"sizeof( long ) =\", sizeof(c_long)\n", + "print \"sizeof( long int ) =\", sizeof(c_long)\n", + "print \"sizeof( float ) =\", sizeof(c_float)\n", + "print \"sizeof( double ) =\", sizeof(c_double)\n", + "print \"sizeof( long double ) =\", sizeof(c_longdouble)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sizeof( char ) = 1\n", + "sizeof( short ) = 2\n", + "sizeof( short int ) = 2\n", + "sizeof( int ) = 4\n", + "sizeof( long ) = 4\n", + "sizeof( long int ) = 4\n", + "sizeof( float ) = 4\n", + "sizeof( double ) = 8\n", + "sizeof( long double ) = 8\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-modules.cpp, Page no-120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "numerator=int(raw_input(\"Enter numerator: \"))\n", + "denominator=int(raw_input(\"Enter denominator: \"))\n", + "result=numerator/denominator\n", + "remainder=numerator%denominator\n", + "print numerator, \"/\", denominator, \"=\", result\n", + "print numerator, \"%\", denominator, \"=\", remainder" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter numerator: 12\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter denominator: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "12 / 5 = 2\n", + "12 % 5 = 2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-notemp.cpp, Page no-121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()] #taking input in single line sperated by white space\n", + "a=a+b\n", + "b=a-b\n", + "a=a-b\n", + "print \"Value of a and b on swapping in main():\", a, b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of a and b on swapping in main(): 20 10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-relation.cpp, Page no-122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "my_age=int(raw_input(\"Enter my age: \"))\n", + "your_age=int(raw_input(\"Enter your age: \"))\n", + "if(my_age==your_age):\n", + " print \"We are born in the same year.\"\n", + "else:\n", + " print \"We are born in different years\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter my age: 25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: 25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "We are born in the same year.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-char1.cpp, Page no-123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "c=c_byte(255) #signed char\n", + "d=c_byte(-1) #signed char\n", + "if c.value<0:\n", + " print 'c is less than 0'\n", + "else:\n", + " print 'c is not less than 0'\n", + "if d.value<0:\n", + " print 'd is less than 0'\n", + "else:\n", + " print 'd is not less than 0'\n", + "if c.value==d.value:\n", + " print 'c and d are equal'\n", + "else:\n", + " print 'c and d are not equal'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c is less than 0\n", + "d is less than 0\n", + "c and d are equal\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-char2.cpp, Page no-124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "c=c_ubyte(255) #unsigned char\n", + "d=c_byte(-1) #signed char\n", + "if c.value<0:\n", + " print 'c is less than 0'\n", + "else:\n", + " print 'c is not less than 0'\n", + "if d.value<0:\n", + " print 'd is less than 0'\n", + "else:\n", + " print 'd is not less than 0'\n", + "if c.value==d.value:\n", + " print 'c and d are equal'\n", + "else:\n", + " print 'c and d are not equal'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c is not less than 0\n", + "d is less than 0\n", + "c and d are not equal\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-leap.cpp, Page no-126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "year=int(raw_input(\"Enter any year: \"))\n", + "if( (year%4==0 and year%100!=0) or (year%400==0)):\n", + " print year, \"is a leap year\"\n", + "else:\n", + " print year, \"is not a leap year\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any year: 1996\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1996 is a leap year\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-large.cpp, Page no-127" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "u=c_uint(0) #unsigned integer\n", + "print 'Value before conversion:', u.value\n", + "u.value=~int(u.value) # 1's complement\n", + "print 'Value after conversion:', u.value" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value before conversion: 0\n", + "Value after conversion: 4294967295\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-extract.cpp, Page no-130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=int(raw_input(\"Enter an integer: \"))\n", + "n=int(raw_input(\"Enter bit position to extract: \"))\n", + "bit=(a>>(n-1))&1 #shift operator\n", + "print \"The bit is \", bit" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an integer: 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter bit position to extract: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The bit is 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-max.cpp, Page no-133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a, b=[int(x) for x in raw_input(\"Enter two integers: \").split()]\n", + "larger=a if a>b else b #?: operator\n", + "print \"The larger of the two is\", larger" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The larger of the two is 20\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-oddeven.cpp, Page no-133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num=int(raw_input(\"Enter the number: \"))\n", + "print \"The number\", num,\"is\",\n", + "print \"Even\" if num%2==0 else \"Odd\" #?: operator\n", + "num=int(raw_input(\"Enter the number: \"))\n", + "print \"The number\", num,\"is\",\n", + "print \"Even\" if num%2==0 else \"Odd\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number 10 is Even\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number: 25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number 25 is Odd\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-coerce.cpp, Page no-136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "f=float\n", + "i=12\n", + "j=5\n", + "print \"when i = \", i, \"j = \", j\n", + "f=i/j\n", + "print \"i/j = \", f\n", + "f=float(i)/float(j)\n", + "print \"(float)i/j = \", f\n", + "f=float(i)/j\n", + "print \"float(i)/j = \", f\n", + "f=i/float(j)\n", + "print \"i/float(j) = \", f" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "when i = 12 j = 5\n", + "i/j = 2\n", + "(float)i/j = 2.4\n", + "float(i)/j = 2.4\n", + "i/float(j) = 2.4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-city.cpp, Page no-141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "CITY='Bidar'\n", + "def which_city():\n", + " print 'City in Function:',\n", + " print CITY\n", + "print 'Earlier City:',\n", + "print CITY\n", + "CITY='Bangalore'\n", + "print 'New City:',\n", + "print CITY\n", + "which_city()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Earlier City: Bidar\n", + "New City: Bangalore\n", + "City in Function: Bangalore\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-color1.cpp, Page no-143" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def PrintColor(c):\n", + " (red, blue, green)=(0, 1, 2) #enum\n", + " type =['red', 'green', 'blue']\n", + " if c==red:\n", + " color='red'\n", + " elif c==blue:\n", + " color='blue'\n", + " else:\n", + " color ='green'\n", + " print 'Your color choice as per color2.cpp module:', color\n", + "(red, green, blue)=(0, 1, 2) #enum\n", + "type =['red', 'green', 'blue']\n", + "print 'Your color choice in color1.cpp module: green'\n", + "PrintColor(green)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your color choice in color1.cpp module: green\n", + "Your color choice as per color2.cpp module: blue\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-maxmacro.cpp, Page no-146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(a, b):\n", + " return a if a>b else b\n", + "print 'max(2, 3) =', Max(2, 3)\n", + "print 'max(10.2, 4.5) =', Max(10.2, 4.5)\n", + "i=5\n", + "j=10\n", + "print 'i =',i\n", + "print 'j =', j\n", + "print 'On execution of k=max(++i, ++j);...'\n", + "i+=1\n", + "j+=1\n", + "k=Max(i+1, j+1)\n", + "print 'i =', i\n", + "print 'j =', j #the operand is j+1 and not ++j and thus the change is not reflected back in j. \n", + "print 'k =', k #operand of type j+=1 is not allowed" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max(2, 3) = 3\n", + "max(10.2, 4.5) = 10.2\n", + "i = 5\n", + "j = 10\n", + "On execution of k=max(++i, ++j);...\n", + "i = 6\n", + "j = 11\n", + "k = 12\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-exp.cpp, Page no-148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=30\n", + "b=20\n", + "c=11\n", + "result=a+b/(c-1)+a%b #--c is replaced by (c-1)\n", + "print 'a+b/--c+a%b =', result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a+b/--c+a%b = 42\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page no-150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num1=int(raw_input(\"Enter the first number: \"))\n", + "num2=int(raw_input(\"Enter the second number: \"))\n", + "print num1, '+', num2, '=',num1+num2\n", + "print num1, '-', num2, '=',num1-num2\n", + "print num1, '*', num2, '=',num1*num2\n", + "print num1, '/', num2, '=',num1/num2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the first number: 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the second number: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "20 + 10 = 30\n", + "20 - 10 = 10\n", + "20 * 10 = 200\n", + "20 / 10 = 2\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions_1.ipynb new file mode 100755 index 00000000..93c9b655 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions_1.ipynb @@ -0,0 +1,881 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:63e795ffbce627302c76300f958b5cdb253e4cb2bacdd4c0ef63693b73e9f98e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4- Data types, Operators and Expressions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-show1.cpp, Page no-111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=int\n", + "b=int\n", + "c=100\n", + "distance=float\n", + "a=c\n", + "b=c+100\n", + "distance=55.9\n", + "print \"a =\", a\n", + "print \"b =\", b\n", + "print \"c =\", c\n", + "print \"distance =\", distance" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 100\n", + "b = 200\n", + "c = 100\n", + "distance = 55.9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ascii.cpp, Page no-112" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "code=int(raw_input(\"Enter an ASCII code(0-127): \"))\n", + "symbol=code\n", + "print \"The symbol corresponding to %d is %c\" %(code, symbol)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an ASCII code(0-127): 65\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The symbol corresponding to 65 is A\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-temper.cpp, Page no-115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "c=float(raw_input(\"Enter temperature in Celsius: \"))\n", + "f=1.8*c+32\n", + "print \"Equivalent fahrenheit = \", f\n", + "f=float(raw_input(\"Enter temperature in fahrenheit: \"))\n", + "c=(f-32)/1.8\n", + "print \"Equivalent Celsius = \", c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter temperature in Celsius: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equivalent fahrenheit = 41.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter temperature in fahrenheit: 40\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equivalent Celsius = 4.44444444444\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-size.cpp, Page no-116" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import c_char, c_short, c_int, c_long, c_float, c_double, c_longdouble, sizeof\n", + "print \"sizeof( char ) =\", sizeof(c_char)\n", + "print \"sizeof( short ) =\", sizeof(c_short)\n", + "print \"sizeof( short int ) =\", sizeof(c_short)\n", + "print \"sizeof( int ) =\", sizeof(c_int)\n", + "print \"sizeof( long ) =\", sizeof(c_long)\n", + "print \"sizeof( long int ) =\", sizeof(c_long)\n", + "print \"sizeof( float ) =\", sizeof(c_float)\n", + "print \"sizeof( double ) =\", sizeof(c_double)\n", + "print \"sizeof( long double ) =\", sizeof(c_longdouble)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sizeof( char ) = 1\n", + "sizeof( short ) = 2\n", + "sizeof( short int ) = 2\n", + "sizeof( int ) = 4\n", + "sizeof( long ) = 4\n", + "sizeof( long int ) = 4\n", + "sizeof( float ) = 4\n", + "sizeof( double ) = 8\n", + "sizeof( long double ) = 8\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-modules.cpp, Page no-120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "numerator=int(raw_input(\"Enter numerator: \"))\n", + "denominator=int(raw_input(\"Enter denominator: \"))\n", + "result=numerator/denominator\n", + "remainder=numerator%denominator\n", + "print numerator, \"/\", denominator, \"=\", result\n", + "print numerator, \"%\", denominator, \"=\", remainder" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter numerator: 12\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter denominator: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "12 / 5 = 2\n", + "12 % 5 = 2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-notemp.cpp, Page no-121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()] #taking input in single line sperated by white space\n", + "a=a+b\n", + "b=a-b\n", + "a=a-b\n", + "print \"Value of a and b on swapping in main():\", a, b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of a and b on swapping in main(): 20 10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-relation.cpp, Page no-122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "my_age=int(raw_input(\"Enter my age: \"))\n", + "your_age=int(raw_input(\"Enter your age: \"))\n", + "if(my_age==your_age):\n", + " print \"We are born in the same year.\"\n", + "else:\n", + " print \"We are born in different years\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter my age: 25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: 25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "We are born in the same year.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-char1.cpp, Page no-123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import c_byte\n", + "c=c_byte(255) #signed char\n", + "d=c_byte(-1) #signed char\n", + "if c.value<0:\n", + " print 'c is less than 0'\n", + "else:\n", + " print 'c is not less than 0'\n", + "if d.value<0:\n", + " print 'd is less than 0'\n", + "else:\n", + " print 'd is not less than 0'\n", + "if c.value==d.value:\n", + " print 'c and d are equal'\n", + "else:\n", + " print 'c and d are not equal'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c is less than 0\n", + "d is less than 0\n", + "c and d are equal\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-char2.cpp, Page no-124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import c_ubyte, c_byte\n", + "c=c_ubyte(255) #unsigned char\n", + "d=c_byte(-1) #signed char\n", + "if c.value<0:\n", + " print 'c is less than 0'\n", + "else:\n", + " print 'c is not less than 0'\n", + "if d.value<0:\n", + " print 'd is less than 0'\n", + "else:\n", + " print 'd is not less than 0'\n", + "if c.value==d.value:\n", + " print 'c and d are equal'\n", + "else:\n", + " print 'c and d are not equal'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c is not less than 0\n", + "d is less than 0\n", + "c and d are not equal\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-leap.cpp, Page no-126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "year=int(raw_input(\"Enter any year: \"))\n", + "if( (year%4==0 and year%100!=0) or (year%400==0)):\n", + " print year, \"is a leap year\"\n", + "else:\n", + " print year, \"is not a leap year\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any year: 1996\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1996 is a leap year\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-large.cpp, Page no-127" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import c_uint\n", + "u=c_uint(0) #unsigned integer\n", + "print 'Value before conversion:', u.value\n", + "u.value=~int(u.value) # 1's complement\n", + "print 'Value after conversion:', u.value" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value before conversion: 0\n", + "Value after conversion: 4294967295\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-extract.cpp, Page no-130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=int(raw_input(\"Enter an integer: \"))\n", + "n=int(raw_input(\"Enter bit position to extract: \"))\n", + "bit=(a>>(n-1))&1 #shift operator\n", + "print \"The bit is \", bit" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an integer: 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter bit position to extract: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The bit is 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-max.cpp, Page no-133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a, b=[int(x) for x in raw_input(\"Enter two integers: \").split()]\n", + "larger=a if a>b else b #?: operator\n", + "print \"The larger of the two is\", larger" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The larger of the two is 20\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-oddeven.cpp, Page no-133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num=int(raw_input(\"Enter the number: \"))\n", + "print \"The number\", num,\"is\",\n", + "print \"Even\" if num%2==0 else \"Odd\" #?: operator\n", + "num=int(raw_input(\"Enter the number: \"))\n", + "print \"The number\", num,\"is\",\n", + "print \"Even\" if num%2==0 else \"Odd\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number 10 is Even\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number: 25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number 25 is Odd\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-coerce.cpp, Page no-136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "f=float\n", + "i=12\n", + "j=5\n", + "print \"when i = \", i, \"j = \", j\n", + "f=i/j\n", + "print \"i/j = \", f\n", + "f=float(i)/float(j)\n", + "print \"(float)i/j = \", f\n", + "f=float(i)/j\n", + "print \"float(i)/j = \", f\n", + "f=i/float(j)\n", + "print \"i/float(j) = \", f" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "when i = 12 j = 5\n", + "i/j = 2\n", + "(float)i/j = 2.4\n", + "float(i)/j = 2.4\n", + "i/float(j) = 2.4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-city.cpp, Page no-141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "CITY='Bidar'\n", + "def which_city():\n", + " print 'City in Function:',\n", + " print CITY\n", + "print 'Earlier City:',\n", + "print CITY\n", + "CITY='Bangalore'\n", + "print 'New City:',\n", + "print CITY\n", + "which_city()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Earlier City: Bidar\n", + "New City: Bangalore\n", + "City in Function: Bangalore\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-color1.cpp, Page no-143" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def PrintColor(c):\n", + " (red, blue, green)=(0, 1, 2) #enum\n", + " type =['red', 'green', 'blue']\n", + " if c==red:\n", + " color='red'\n", + " elif c==blue:\n", + " color='blue'\n", + " else:\n", + " color ='green'\n", + " print 'Your color choice as per color2.cpp module:', color\n", + "(red, green, blue)=(0, 1, 2) #enum\n", + "type =['red', 'green', 'blue']\n", + "print 'Your color choice in color1.cpp module: green'\n", + "PrintColor(green)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your color choice in color1.cpp module: green\n", + "Your color choice as per color2.cpp module: blue\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-maxmacro.cpp, Page no-146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(a, b):\n", + " return a if a>b else b\n", + "print 'max(2, 3) =', Max(2, 3)\n", + "print 'max(10.2, 4.5) =', Max(10.2, 4.5)\n", + "i=5\n", + "j=10\n", + "print 'i =',i\n", + "print 'j =', j\n", + "print 'On execution of k=max(++i, ++j);...'\n", + "i+=1\n", + "j+=1\n", + "k=Max(i+1, j+1)\n", + "print 'i =', i\n", + "print 'j =', j #the operand is j+1 and not ++j and thus the change is not reflected back in j. \n", + "print 'k =', k #operand of type j+=1 is not allowed" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max(2, 3) = 3\n", + "max(10.2, 4.5) = 10.2\n", + "i = 5\n", + "j = 10\n", + "On execution of k=max(++i, ++j);...\n", + "i = 6\n", + "j = 11\n", + "k = 12\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-exp.cpp, Page no-148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=30\n", + "b=20\n", + "c=11\n", + "result=a+b/(c-1)+a%b #--c is replaced by (c-1)\n", + "print 'a+b/--c+a%b =', result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a+b/--c+a%b = 42\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page no-150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "num1=int(raw_input(\"Enter the first number: \"))\n", + "num2=int(raw_input(\"Enter the second number: \"))\n", + "print num1, '+', num2, '=',num1+num2\n", + "print num1, '-', num2, '=',num1-num2\n", + "print num1, '*', num2, '=',num1*num2\n", + "print num1, '/', num2, '=',num1/num2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the first number: 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the second number: 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "20 + 10 = 30\n", + "20 - 10 = 10\n", + "20 * 10 = 200\n", + "20 / 10 = 2\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow.ipynb new file mode 100755 index 00000000..9efd46c9 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow.ipynb @@ -0,0 +1,1280 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6fa2540f90d9347d87cbc226c605764f3108594e5706b257d5d061ae951444a3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5- Control Flow" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-age1.cpp, Page no-153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=int(raw_input(\"Enter your age: \"))\n", + "if(age>12 and age<20):\n", + " print \"you are a teen-aged person. good!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: 15\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "you are a teen-aged person. good!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-age2.cpp, Page no-154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=int(raw_input(\"Enter your age: \"))\n", + "if(age<0):\n", + " print \"I am sorry!\"\n", + " print \"age can never be negative\"\n", + "if(age>12 and age<20):\n", + " print \"you are a teen-aged person. good!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: -10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am sorry!\n", + "age can never be negative\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-large.cpp, Page no-155" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "big=float\n", + "a, b, c=[float(x) for x in raw_input(\"Enter three floating-point numbers: \").split()] #taking input in single line separated by white space\n", + "big=a\n", + "if(b>big):\n", + " big=b\n", + "if(c>big):\n", + " big=c\n", + "print \"Largest of the three numbers =\", big" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three floating-point numbers: 10.2 15.6 12.8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Largest of the three numbers = 15.6\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-age3.cpp, Page no-156" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=int(raw_input(\"Enter your age: \"))\n", + "if(age>12 and age<20):\n", + " print \"you are a teen-aged person. good!\"\n", + "else:\n", + " print \"you are not a teen-aged person.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: 15\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "you are a teen-aged person. good!\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-lived.cpp, Page no-157" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "years=float(raw_input(\"Enter your age in years: \"))\n", + "if(years<0):\n", + " print \"I am sorry! age can never be negative\"\n", + "else:\n", + " secs=years*365*24*60*60\n", + " print \"You have lived for %.4g seconds\" %(secs)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age in years: 25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You have lived for 7.884e+08 seconds\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-age4.cpp, Page no-158" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=int(raw_input(\"Enter your age: \"))\n", + "if(age>12 and age<20):\n", + " print \"you are a teen-aged person. good!\"\n", + "else:\n", + " if(age<13):\n", + " print \"you will surely reach teen-age.\"\n", + " else:\n", + " print \"you have crossed teen-age!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: 25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "you have crossed teen-age!\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-count1.cpp, Page no-159" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "n=int(raw_input(\"How many integers to be displayed: \"))\n", + "for i in range(n):\n", + " print i" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many integers to be displayed: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sumsq1.cpp, Page no-160" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Sum=0\n", + "sum_of_squares=0\n", + "for i in range(2, 31, 2):\n", + " Sum+=i\n", + " sum_of_squares+=i*i\n", + "print \"Sum of first 15 positive even numbers =\", Sum\n", + "print \"Sum of their squares =\", sum_of_squares" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of first 15 positive even numbers = 240\n", + "Sum of their squares = 4960\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sumsq2.cpp, Page no-161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Sum=0\n", + "sum_of_squares=0\n", + "for i in range(30, 0, -2):\n", + " Sum+=i\n", + " sum_of_squares+=i*i\n", + "print \"Sum of first 15 positive even numbers =\", Sum\n", + "print \"Sum of their squares =\", sum_of_squares" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of first 15 positive even numbers = 240\n", + "Sum of their squares = 4960\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-noinit.cpp, Page no-162" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "i=1\n", + "for i in range(i, 11):\n", + " print i*5," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "5 10 15 20 25 30 35 40 45 50\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-pyramid.cpp, Page no-163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "n=int(raw_input(\"Enter the number of lines: \"))\n", + "for p in range(1, n+1):\n", + " for q in range(1, n-p+1):\n", + " print \"\\t\",\n", + " m=p\n", + " for q in range (1, p+1):\n", + " print \"\\t\", m,\n", + " m+=1\n", + " m=m-2\n", + " for q in range(1, p):\n", + " print \"\\t\", m,\n", + " m-=1\n", + " print ''" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of lines: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t\t\t\t\t1 \n", + "\t\t\t\t2 \t3 \t2 \n", + "\t\t\t3 \t4 \t5 \t4 \t3 \n", + "\t\t4 \t5 \t6 \t7 \t6 \t5 \t4 \n", + "\t5 \t6 \t7 \t8 \t9 \t8 \t7 \t6 \t5 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-count2.cpp, Page no-164" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "n=int(raw_input(\"How many integers to be displayed: \"))\n", + "i=0\n", + "while i=n:\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many integers to be displayed: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-dowhile.cpp, Page no-167" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "while 1: #do-while loop\n", + " inchar=raw_input(\"Enter your sex (m/f): \")\n", + " if(inchar=='m' or inchar=='f'):\n", + " break\n", + "if inchar=='m':\n", + " print \"so you are male. good!\"\n", + "else:\n", + " print \"so you are female. good!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your sex (m/f): d\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your sex (m/f): b\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your sex (m/f): m\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "so you are male. good!\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-pa1.cpp, Page no-167" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "rev=0\n", + "num=int(raw_input(\"Enter the number: \"))\n", + "n=num\n", + "while 1:\n", + " digit=num%10\n", + " rev=rev*10 + digit\n", + " num/=10\n", + " if num==0:\n", + " break\n", + "print \"Reverse of the number =\", rev\n", + "if n==rev:\n", + " print \"The number is a palindrome\"\n", + "else:\n", + " print \"The number is not a palindrome\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number: 121\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Reverse of the number = 121\n", + "The number is a palindrome\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-average2.cpp, Page no-169" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Sum=0\n", + "count=0\n", + "print \"Enter the marks, -1 at the end...\"\n", + "while 1:\n", + " marks=int(raw_input())\n", + " if marks==-1:\n", + " break\n", + " Sum+=marks\n", + " count+=1\n", + "average=Sum/count\n", + "print \"The average is\", average " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the marks, -1 at the end...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "80\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "75\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "82\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "74\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average is 77\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sex2.cpp, Page no-171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ch=raw_input(\"Enter your sex (m/f): \")\n", + "if ch=='m':\n", + " print \"So you are male. good!\"\n", + "elif ch=='f':\n", + " print \"So you are female. good!\"\n", + "else:\n", + " print \"Error: Invalid sex code!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your sex (m/f): m\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "So you are male. good!\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-calc.cpp, Page no-172" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"------------------Basic Calculator------------------\"\n", + "print \"Choose an option:\"\n", + "print \"Add\"\n", + "print \"Subtract\"\n", + "print \"Multiply\"\n", + "print \"Divide\"\n", + "ch=raw_input()\n", + "num1, num2=[int(x) for x in raw_input(\"Enter the value of the operands: \").split()]\n", + "if ch=='1':\n", + " print num1+num2\n", + "elif ch=='2':\n", + " print num1-num2\n", + "elif ch=='3':\n", + " print num1*num2\n", + "elif ch=='4':\n", + " print num1/num2\n", + "else:\n", + " print \"Incorrect choice: \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "------------------Basic Calculator------------------\n", + "Choose an option:\n", + "Add\n", + "Subtract\n", + "Multiply\n", + "Divide\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the value of the operands: 22 33\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sumpos.cpp, Page no-174" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "total=0\n", + "while 1:\n", + " num=int(raw_input(\"Enter a number (0 to quit): \"))\n", + " if num==0:\n", + " print \"end of data entry.\"\n", + " break\n", + " if num<0:\n", + " print \"skipping this number.\"\n", + " continue\n", + " total+=num\n", + "print \"Total of all +ve numbers is \", total" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): -5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "skipping this number.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "end of data entry.\n", + "Total of all +ve numbers is 40\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-jump.cpp, Page no-175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "total=0\n", + "while 1:\n", + " num=int(raw_input(\"Enter a number (0 to quit): \"))\n", + " if num==0:\n", + " print \"end of data entry.\"\n", + " print \"Total of all +ve numbers is\", total #no goto in python\n", + " break\n", + " if num<0:\n", + " print \"skipping this number.\"\n", + " continue\n", + " total+=num" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): -5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "skipping this number.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "end of data entry.\n", + "Total of all +ve numbers is 40\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-age5.cpp, Page no-177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=int(raw_input(\"Enter your age: \"))\n", + "if(age>12 and age<20):\n", + " pass\n", + "print \"you are a teen-aged person. good!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: 50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "you are a teen-aged person. good!\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-agecmp.cpp, Page no-177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "myage=25\n", + "print \"Hi! my age is \", myage\n", + "yourage=int(raw_input(\"What is your age? \"))\n", + "if myage==yourage:\n", + " print \"We are born on the same day. Are we twins!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hi! my age is 25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "What is your age? 25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "We are born on the same day. Are we twins!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page no-178" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "l1=int(raw_input(\"Enter the lower limit: \"))\n", + "l2=int(raw_input(\"Enter the higher limit: \"))\n", + "print \"The prime numbers between\", l1, \"and\", l2, \"are: \",\n", + "for i in range(l1, l2+1):\n", + " if i<=3:\n", + " print i,\"\\t\",\n", + " else:\n", + " for j in range(2, i/2+1):\n", + " if(i%j==0):\n", + " break\n", + " if(i%j==0):\n", + " continue #no goto\n", + " print i, \"\\t\"," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the lower limit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the higher limit: 100\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The prime numbers between 1 and 100 are: 1 \t2 \t3 \t5 \t7 \t11 \t13 \t17 \t19 \t23 \t29 \t31 \t37 \t41 \t43 \t47 \t53 \t59 \t61 \t67 \t71 \t73 \t79 \t83 \t89 \t97 \t" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow_1.ipynb new file mode 100755 index 00000000..9efd46c9 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow_1.ipynb @@ -0,0 +1,1280 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6fa2540f90d9347d87cbc226c605764f3108594e5706b257d5d061ae951444a3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5- Control Flow" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-age1.cpp, Page no-153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=int(raw_input(\"Enter your age: \"))\n", + "if(age>12 and age<20):\n", + " print \"you are a teen-aged person. good!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: 15\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "you are a teen-aged person. good!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-age2.cpp, Page no-154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=int(raw_input(\"Enter your age: \"))\n", + "if(age<0):\n", + " print \"I am sorry!\"\n", + " print \"age can never be negative\"\n", + "if(age>12 and age<20):\n", + " print \"you are a teen-aged person. good!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: -10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am sorry!\n", + "age can never be negative\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-large.cpp, Page no-155" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "big=float\n", + "a, b, c=[float(x) for x in raw_input(\"Enter three floating-point numbers: \").split()] #taking input in single line separated by white space\n", + "big=a\n", + "if(b>big):\n", + " big=b\n", + "if(c>big):\n", + " big=c\n", + "print \"Largest of the three numbers =\", big" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three floating-point numbers: 10.2 15.6 12.8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Largest of the three numbers = 15.6\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-age3.cpp, Page no-156" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=int(raw_input(\"Enter your age: \"))\n", + "if(age>12 and age<20):\n", + " print \"you are a teen-aged person. good!\"\n", + "else:\n", + " print \"you are not a teen-aged person.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: 15\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "you are a teen-aged person. good!\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-lived.cpp, Page no-157" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "years=float(raw_input(\"Enter your age in years: \"))\n", + "if(years<0):\n", + " print \"I am sorry! age can never be negative\"\n", + "else:\n", + " secs=years*365*24*60*60\n", + " print \"You have lived for %.4g seconds\" %(secs)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age in years: 25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You have lived for 7.884e+08 seconds\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-age4.cpp, Page no-158" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=int(raw_input(\"Enter your age: \"))\n", + "if(age>12 and age<20):\n", + " print \"you are a teen-aged person. good!\"\n", + "else:\n", + " if(age<13):\n", + " print \"you will surely reach teen-age.\"\n", + " else:\n", + " print \"you have crossed teen-age!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: 25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "you have crossed teen-age!\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-count1.cpp, Page no-159" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "n=int(raw_input(\"How many integers to be displayed: \"))\n", + "for i in range(n):\n", + " print i" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many integers to be displayed: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sumsq1.cpp, Page no-160" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Sum=0\n", + "sum_of_squares=0\n", + "for i in range(2, 31, 2):\n", + " Sum+=i\n", + " sum_of_squares+=i*i\n", + "print \"Sum of first 15 positive even numbers =\", Sum\n", + "print \"Sum of their squares =\", sum_of_squares" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of first 15 positive even numbers = 240\n", + "Sum of their squares = 4960\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sumsq2.cpp, Page no-161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Sum=0\n", + "sum_of_squares=0\n", + "for i in range(30, 0, -2):\n", + " Sum+=i\n", + " sum_of_squares+=i*i\n", + "print \"Sum of first 15 positive even numbers =\", Sum\n", + "print \"Sum of their squares =\", sum_of_squares" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of first 15 positive even numbers = 240\n", + "Sum of their squares = 4960\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-noinit.cpp, Page no-162" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "i=1\n", + "for i in range(i, 11):\n", + " print i*5," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "5 10 15 20 25 30 35 40 45 50\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-pyramid.cpp, Page no-163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "n=int(raw_input(\"Enter the number of lines: \"))\n", + "for p in range(1, n+1):\n", + " for q in range(1, n-p+1):\n", + " print \"\\t\",\n", + " m=p\n", + " for q in range (1, p+1):\n", + " print \"\\t\", m,\n", + " m+=1\n", + " m=m-2\n", + " for q in range(1, p):\n", + " print \"\\t\", m,\n", + " m-=1\n", + " print ''" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of lines: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t\t\t\t\t1 \n", + "\t\t\t\t2 \t3 \t2 \n", + "\t\t\t3 \t4 \t5 \t4 \t3 \n", + "\t\t4 \t5 \t6 \t7 \t6 \t5 \t4 \n", + "\t5 \t6 \t7 \t8 \t9 \t8 \t7 \t6 \t5 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-count2.cpp, Page no-164" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "n=int(raw_input(\"How many integers to be displayed: \"))\n", + "i=0\n", + "while i=n:\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many integers to be displayed: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-dowhile.cpp, Page no-167" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "while 1: #do-while loop\n", + " inchar=raw_input(\"Enter your sex (m/f): \")\n", + " if(inchar=='m' or inchar=='f'):\n", + " break\n", + "if inchar=='m':\n", + " print \"so you are male. good!\"\n", + "else:\n", + " print \"so you are female. good!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your sex (m/f): d\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your sex (m/f): b\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your sex (m/f): m\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "so you are male. good!\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-pa1.cpp, Page no-167" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "rev=0\n", + "num=int(raw_input(\"Enter the number: \"))\n", + "n=num\n", + "while 1:\n", + " digit=num%10\n", + " rev=rev*10 + digit\n", + " num/=10\n", + " if num==0:\n", + " break\n", + "print \"Reverse of the number =\", rev\n", + "if n==rev:\n", + " print \"The number is a palindrome\"\n", + "else:\n", + " print \"The number is not a palindrome\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number: 121\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Reverse of the number = 121\n", + "The number is a palindrome\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-average2.cpp, Page no-169" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Sum=0\n", + "count=0\n", + "print \"Enter the marks, -1 at the end...\"\n", + "while 1:\n", + " marks=int(raw_input())\n", + " if marks==-1:\n", + " break\n", + " Sum+=marks\n", + " count+=1\n", + "average=Sum/count\n", + "print \"The average is\", average " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the marks, -1 at the end...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "80\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "75\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "82\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "74\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average is 77\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sex2.cpp, Page no-171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ch=raw_input(\"Enter your sex (m/f): \")\n", + "if ch=='m':\n", + " print \"So you are male. good!\"\n", + "elif ch=='f':\n", + " print \"So you are female. good!\"\n", + "else:\n", + " print \"Error: Invalid sex code!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your sex (m/f): m\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "So you are male. good!\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-calc.cpp, Page no-172" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"------------------Basic Calculator------------------\"\n", + "print \"Choose an option:\"\n", + "print \"Add\"\n", + "print \"Subtract\"\n", + "print \"Multiply\"\n", + "print \"Divide\"\n", + "ch=raw_input()\n", + "num1, num2=[int(x) for x in raw_input(\"Enter the value of the operands: \").split()]\n", + "if ch=='1':\n", + " print num1+num2\n", + "elif ch=='2':\n", + " print num1-num2\n", + "elif ch=='3':\n", + " print num1*num2\n", + "elif ch=='4':\n", + " print num1/num2\n", + "else:\n", + " print \"Incorrect choice: \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "------------------Basic Calculator------------------\n", + "Choose an option:\n", + "Add\n", + "Subtract\n", + "Multiply\n", + "Divide\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the value of the operands: 22 33\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sumpos.cpp, Page no-174" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "total=0\n", + "while 1:\n", + " num=int(raw_input(\"Enter a number (0 to quit): \"))\n", + " if num==0:\n", + " print \"end of data entry.\"\n", + " break\n", + " if num<0:\n", + " print \"skipping this number.\"\n", + " continue\n", + " total+=num\n", + "print \"Total of all +ve numbers is \", total" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): -5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "skipping this number.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "end of data entry.\n", + "Total of all +ve numbers is 40\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-jump.cpp, Page no-175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "total=0\n", + "while 1:\n", + " num=int(raw_input(\"Enter a number (0 to quit): \"))\n", + " if num==0:\n", + " print \"end of data entry.\"\n", + " print \"Total of all +ve numbers is\", total #no goto in python\n", + " break\n", + " if num<0:\n", + " print \"skipping this number.\"\n", + " continue\n", + " total+=num" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): -5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "skipping this number.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number (0 to quit): 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "end of data entry.\n", + "Total of all +ve numbers is 40\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-age5.cpp, Page no-177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=int(raw_input(\"Enter your age: \"))\n", + "if(age>12 and age<20):\n", + " pass\n", + "print \"you are a teen-aged person. good!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: 50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "you are a teen-aged person. good!\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-agecmp.cpp, Page no-177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "myage=25\n", + "print \"Hi! my age is \", myage\n", + "yourage=int(raw_input(\"What is your age? \"))\n", + "if myage==yourage:\n", + " print \"We are born on the same day. Are we twins!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hi! my age is 25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "What is your age? 25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "We are born on the same day. Are we twins!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page no-178" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "l1=int(raw_input(\"Enter the lower limit: \"))\n", + "l2=int(raw_input(\"Enter the higher limit: \"))\n", + "print \"The prime numbers between\", l1, \"and\", l2, \"are: \",\n", + "for i in range(l1, l2+1):\n", + " if i<=3:\n", + " print i,\"\\t\",\n", + " else:\n", + " for j in range(2, i/2+1):\n", + " if(i%j==0):\n", + " break\n", + " if(i%j==0):\n", + " continue #no goto\n", + " print i, \"\\t\"," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the lower limit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the higher limit: 100\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The prime numbers between 1 and 100 are: 1 \t2 \t3 \t5 \t7 \t11 \t13 \t17 \t19 \t23 \t29 \t31 \t37 \t41 \t43 \t47 \t53 \t59 \t61 \t67 \t71 \t73 \t79 \t83 \t89 \t97 \t" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings.ipynb new file mode 100755 index 00000000..ce7a4137 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings.ipynb @@ -0,0 +1,1593 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e2ad0aaf08f1bea2c2348d5e8774482c34bf3c3072d4908db5fdcd5d935d1eed" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6- Arrays and Strings" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-age1.cpp, Page no-182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Sum=0.0\n", + "age1=int(raw_input(\"Enter person 1 age: \"))\n", + "Sum+=age1\n", + "age2=int(raw_input(\"Enter person 2 age: \"))\n", + "Sum+=age2\n", + "age3=int(raw_input(\"Enter person 3 age: \"))\n", + "Sum+=age3\n", + "age4=int(raw_input(\"Enter person 4 age: \"))\n", + "Sum+=age4\n", + "age5=int(raw_input(\"Enter person 5 age: \"))\n", + "Sum+=age5\n", + "print \"Average age = %g\" %(Sum/5)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person 1 age: 23\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person 2 age: 40\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person 3 age: 30\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person 4 age: 27\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person 5 age: 25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average age = 29\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-age2.cpp, Page no-182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=[int]*5 #integer array of size 5\n", + "Sum=0.0\n", + "for i in range(5):\n", + " print \"Enter person\", i+1, \"age: \",\n", + " age[i]=int(raw_input())\n", + "for i in range(5):\n", + " Sum+=age[i]\n", + "print \"Average age = %g\" %(Sum/5)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person 1 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "23\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 2 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "40\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 3 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "30\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 4 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "27\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 5 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Average age = 29\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-nodup.c, Page no-184" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "flag=0\n", + "a=[float]*50\n", + "n=int(raw_input(\"Enter the size of a vector: \"))\n", + "num=n\n", + "print \"Enter the vector elements...\"\n", + "for i in range(n):\n", + " print \"a[\", i, \"] = ? \",\n", + " a[i]=int(raw_input())\n", + "for i in range(n-1):\n", + " for j in range(i+1, n):\n", + " if a[i]==a[j]:\n", + " n=n-1\n", + " for k in range(j, n):\n", + " a[k]=a[k+1]\n", + " flag=1\n", + " j=j-1\n", + "if flag:\n", + " print \"vector has \", num-n, \"duplicate elements=(s).\"\n", + " print \"Vector after removing duplicates...\"\n", + " for i in range(n):\n", + " print \"a[\", i, \"] = \", a[i]\n", + "else:\n", + " print \"vector has no duplicate elements\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the size of a vector: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the vector elements...\n", + "a[ 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a[ 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a[ 2 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a[ 3 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a[ 4 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a[ 5 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " vector has 1 duplicate elements=(s).\n", + "Vector after removing duplicates...\n", + "a[ 0 ] = 1\n", + "a[ 1 ] = 5\n", + "a[ 2 ] = 6\n", + "a[ 3 ] = 8\n", + "a[ 4 ] = 9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-elder.cpp, Page no-187" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=[float]*25\n", + "n=int(raw_input(\"How many persons are there in list ? \"))\n", + "for i in range(n):\n", + " print \"Enter person\", i+1, \"age: \",\n", + " age[i]=int(raw_input())\n", + "younger=age[0]\n", + "elder=age[0]\n", + "for i in range(n):\n", + " if age[i]elder:\n", + " elder=age[i]\n", + "print \"Age of eldest person is\", elder\n", + "print \"Age of youngest person is: \", younger" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many persons are there in list ? 7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person 1 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 2 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 3 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "45\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 4 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "18\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 5 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "35\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 6 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "23\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 7 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "32\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Age of eldest person is 45\n", + "Age of youngest person is: 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-bubble.cpp, Page no-189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=[int]*25\n", + "n=int(raw_input(\"How many elements to sort ? \"))\n", + "for i in range(n):\n", + " print \"Enter age[\", i, \"]: \",\n", + " age[i]=int(raw_input())\n", + "for i in range(n-1):\n", + " flag=1\n", + " for j in range(n-1-i):\n", + " if age[j]>age[j+1]:\n", + " flag=0\n", + " temp=age[j]\n", + " age[j]=age[j+1]\n", + " age[j+1]=temp\n", + " if flag:\n", + " break\n", + "print \"Sorted list...\"\n", + "for i in range(n):\n", + " print age[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many elements to sort ? 7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter age[ 0 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 1 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 2 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 3 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 4 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 5 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 6 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sorted list...\n", + "1 2 3 4 5 6 9\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-comb.cpp, Page no-190" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "SHRINKINGFACTOR=1.3\n", + "age=[int]*25\n", + "n=int(raw_input(\"How many elements to sort ? \"))\n", + "for i in range(n):\n", + " print \"Enter age[\", i, \"]: \",\n", + " age[i]=int(raw_input())\n", + "size=n\n", + "gap=size\n", + "while 1:\n", + " gap=int(float(gap)/SHRINKINGFACTOR)\n", + " if gap==0:\n", + " gap=1\n", + " elif (gap==9 or gap==10):\n", + " gap=11\n", + " flag=1\n", + " top=size-gap\n", + " for i in range(top):\n", + " j=i+gap\n", + " if age[i]>age[j]:\n", + " flag=0\n", + " temp=age[j]\n", + " age[j]=age[i]\n", + " age[i]=temp\n", + " if(flag==1 and gap<=1):\n", + " break\n", + "print \"Sorted list...\"\n", + "for i in range(n):\n", + " print age[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many elements to sort ? 7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter age[ 0 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 1 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 2 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 3 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 4 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 5 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 6 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sorted list...\n", + "1 2 3 4 5 6 9\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-matrix.cpp, Page no-193" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=[]\n", + "b=[]\n", + "c=[]\n", + "m, n=[int(x) for x in raw_input(\"Enter row and column size of matrix A: \").split()]\n", + "p, q=[int(x) for x in raw_input(\"Enter row and column size of matrix B: \").split()]\n", + "if(m==p and n==q):\n", + " print \"Matrices can be added or subtracted...\"\n", + " print \"Enter matrix A elements...\"\n", + " for i in range(m):\n", + " a.append([])\n", + " for j in range(n):\n", + " a[i].append(int(raw_input()))\n", + " print \"Enter matrix B elements...\"\n", + " for i in range(m):\n", + " b.append([])\n", + " for j in range(n):\n", + " b[i].append(int(raw_input()))\n", + " for i in range(m):\n", + " c.append([])\n", + " for j in range(n):\n", + " c[i].append(a[i][j]+b[i][j])\n", + " print \"Sum of A and B matrices...\"\n", + " for i in range(m):\n", + " for j in range(n):\n", + " print c[i][j], \n", + " print \"\"\n", + " for i in range(m):\n", + " for j in range(n):\n", + " c[i][j]=a[i][j]-b[i][j]\n", + " print \"Difference of A and B matrices...\"\n", + " for i in range(m):\n", + " for j in range(n):\n", + " print c[i][j], \n", + " print \"\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter row and column size of matrix A: 3 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter row and column size of matrix B: 3 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrices can be added or subtracted...\n", + "Enter matrix A elements...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter matrix B elements...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of A and B matrices...\n", + "4 4 4 \n", + "7 6 3 \n", + "4 3 3 \n", + "Difference of A and B matrices...\n", + "-2 0 2 \n", + "1 0 -1 \n", + "2 -1 1 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-name.cpp, Page-196" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "name=[None]*50\n", + "name=raw_input(\"Enter your name <49-max>: \")\n", + "print \"Your name is\", name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name <49-max>: Archana\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your name is Archana\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-succ.cpp, Page no-196" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "msg=\"C to C++\\nC++ to Java\\nJava to...\" #string with special characters\n", + "print \"Please note the following messgae: \"\n", + "print msg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please note the following messgae: \n", + "C to C++\n", + "C++ to Java\n", + "Java to...\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-strlen.cpp, Page no-197" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "s1=[None]*25\n", + "s1=raw_input(\"Enter your name: \")\n", + "print \"strlen( s1 ) :\", len(s1) #length of string" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Smrithi\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "strlen( s1 ): 7\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-strcpy.cpp, Page no-198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "s1=[None]*25\n", + "s2=[None]*25\n", + "s1=raw_input(\"Enter a string: \")\n", + "s2=s1 #copying string\n", + "print \"strcpy( s2, s1 ):\", s2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: Garbage\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "strcpy( s2, s1 ): Garbage\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-strcat.cpp, Page no-198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "s1=[None]*40\n", + "s2=[None]*25\n", + "s1=raw_input(\"Enter string s1: \")\n", + "s2=raw_input(\"Enter string s2: \")\n", + "s1=s1+s2 #concatenating string\n", + "print \"strcat( s1, s2 ):\", s1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string s1: C\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string s2: ++\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "strcat( s1, s2 ): C++\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-strcmp, Page no-199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "s1=[None]*25\n", + "s2=[None]*25\n", + "s1=raw_input(\"Enter string s1: \")\n", + "s2=raw_input(\"Enter string s2: \")\n", + "print \"strcmp( s1, s2 ):\",\n", + "if s1==s2: #comparing strings\n", + " print s1, \"is equal to\", s2\n", + "elif s1>s2:\n", + " print s1, \"is greater than\", s2\n", + "else: \n", + " print s1, \"is less than\", s2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string s1: Computer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string s2: Computing\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "strcmp( s1, s2 ): Computer is less than Computing\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-uprlwr.cpp, Page no-199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "s1=[None]*25\n", + "temp=[None]*25\n", + "s1=raw_input(\"Enter a string: \")\n", + "temp=s1\n", + "print \"strupr(temp):\", temp.upper() #Upper case\n", + "print \"strlwr(temp):\", temp.lower() #lower case" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: Smrithi\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "strupr(temp): SMRITHI\n", + "strlwr(temp): smrithi\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-name.cpp, Page no-200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "person=[[None]*10]*LEN\n", + "n=int(raw_input(\"How many persons ? \"))\n", + "for i in range(n):\n", + " print \"Enter person\", i+1, \"name: \",\n", + " person[i]=raw_input()\n", + "print \"------------------------------------------------------\"\n", + "print \"P# Person Name Length In lower case In UPPER case\"\n", + "print \"------------------------------------------------------\"\n", + "for i in range(n):\n", + " print '{:>2}'.format(i+1),\n", + " print '{:>15}'.format(person[i]),\n", + " print '{:>2}'.format(len(person[i])),\n", + " print '{:>15}'.format(person[i].lower()),\n", + " print '{:>15}'.format(person[i].upper())" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many persons ? 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person 1 name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Anand\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 2 name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Vishwanath\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 3 name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Archana\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 4 name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Yadunandan\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 5 name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mallikarnun\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " ------------------------------------------------------\n", + "P# Person Name Length In lower case In UPPER case\n", + "------------------------------------------------------\n", + " 1 Anand 5 anand ANAND\n", + " 2 Vishwanath 10 vishwanath VISHWANATH\n", + " 3 Archana 7 archana ARCHANA\n", + " 4 Yadunandan 10 yadunandan YADUNANDAN\n", + " 5 Mallikarnun 11 mallikarnun MALLIKARNUN\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-lex.cpp, Page no-202" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Str=[\"Anand\", \"Vishwanath\", \"Archana\", \"Yadunandan\", \"MalliKarjun\"]\n", + "print 'The given strings are:'\n", + "for i in range(5):\n", + " print Str[i]\n", + "k=1\n", + "while k<5: #sorting strings\n", + " for i in range(1, 5-k+1):\n", + " if Str[i-1]>Str[i]:\n", + " str_temp=Str[i-1]\n", + " Str[i-1]=Str[i]\n", + " Str[i]=str_temp\n", + " k=k+1\n", + "print 'Strings in lexicographical order are:'\n", + "for i in range(5):\n", + " print Str[i]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The given strings are:\n", + "Anand\n", + "Vishwanath\n", + "Archana\n", + "Yadunandan\n", + "MalliKarjun\n", + "Strings in lexicographical order are:\n", + "Anand\n", + "Archana\n", + "MalliKarjun\n", + "Vishwanath\n", + "Yadunandan\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page no-204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Str=\"In pursuit of Mastering\tC++\"\n", + "count=0\n", + "i=0\n", + "print \"The given string is:\\n\",Str\n", + "while(i? \"))\n", + "for i in range(n):\n", + " print \"Enter person\", i+1, \"age: \",\n", + " age[i]=int(raw_input())\n", + "younger=age[0]\n", + "elder=age[0]\n", + "for i in range(n):\n", + " if age[i]elder:\n", + " elder=age[i]\n", + "print \"Age of eldest person is\", elder\n", + "print \"Age of youngest person is: \", younger" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many persons are there in list ? 7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person 1 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 2 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 3 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "45\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 4 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "18\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 5 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "35\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 6 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "23\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 7 age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "32\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Age of eldest person is 45\n", + "Age of youngest person is: 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-bubble.cpp, Page no-189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "age=[int]*25\n", + "n=int(raw_input(\"How many elements to sort ? \"))\n", + "for i in range(n):\n", + " print \"Enter age[\", i, \"]: \",\n", + " age[i]=int(raw_input())\n", + "for i in range(n-1):\n", + " flag=1\n", + " for j in range(n-1-i):\n", + " if age[j]>age[j+1]:\n", + " flag=0\n", + " temp=age[j]\n", + " age[j]=age[j+1]\n", + " age[j+1]=temp\n", + " if flag:\n", + " break\n", + "print \"Sorted list...\"\n", + "for i in range(n):\n", + " print age[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many elements to sort ? 7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter age[ 0 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 1 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 2 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 3 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 4 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 5 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 6 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sorted list...\n", + "1 2 3 4 5 6 9\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-comb.cpp, Page no-190" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "SHRINKINGFACTOR=1.3\n", + "age=[int]*25\n", + "n=int(raw_input(\"How many elements to sort ? \"))\n", + "for i in range(n):\n", + " print \"Enter age[\", i, \"]: \",\n", + " age[i]=int(raw_input())\n", + "size=n\n", + "gap=size\n", + "while 1:\n", + " gap=int(float(gap)/SHRINKINGFACTOR)\n", + " if gap==0:\n", + " gap=1\n", + " elif (gap==9 or gap==10):\n", + " gap=11\n", + " flag=1\n", + " top=size-gap\n", + " for i in range(top):\n", + " j=i+gap\n", + " if age[i]>age[j]:\n", + " flag=0\n", + " temp=age[j]\n", + " age[j]=age[i]\n", + " age[i]=temp\n", + " if(flag==1 and gap<=1):\n", + " break\n", + "print \"Sorted list...\"\n", + "for i in range(n):\n", + " print age[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many elements to sort ? 7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter age[ 0 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 1 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 2 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 3 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 4 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 5 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age[ 6 ]: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sorted list...\n", + "1 2 3 4 5 6 9\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-matrix.cpp, Page no-193" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=[]\n", + "b=[]\n", + "c=[]\n", + "m, n=[int(x) for x in raw_input(\"Enter row and column size of matrix A: \").split()]\n", + "p, q=[int(x) for x in raw_input(\"Enter row and column size of matrix B: \").split()]\n", + "if(m==p and n==q):\n", + " print \"Matrices can be added or subtracted...\"\n", + " print \"Enter matrix A elements...\"\n", + " for i in range(m):\n", + " a.append([])\n", + " for j in range(n):\n", + " a[i].append(int(raw_input()))\n", + " print \"Enter matrix B elements...\"\n", + " for i in range(m):\n", + " b.append([])\n", + " for j in range(n):\n", + " b[i].append(int(raw_input()))\n", + " for i in range(m):\n", + " c.append([])\n", + " for j in range(n):\n", + " c[i].append(a[i][j]+b[i][j])\n", + " print \"Sum of A and B matrices...\"\n", + " for i in range(m):\n", + " for j in range(n):\n", + " print c[i][j], \n", + " print \"\"\n", + " for i in range(m):\n", + " for j in range(n):\n", + " c[i][j]=a[i][j]-b[i][j]\n", + " print \"Difference of A and B matrices...\"\n", + " for i in range(m):\n", + " for j in range(n):\n", + " print c[i][j], \n", + " print \"\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter row and column size of matrix A: 3 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter row and column size of matrix B: 3 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrices can be added or subtracted...\n", + "Enter matrix A elements...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter matrix B elements...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of A and B matrices...\n", + "4 4 4 \n", + "7 6 3 \n", + "4 3 3 \n", + "Difference of A and B matrices...\n", + "-2 0 2 \n", + "1 0 -1 \n", + "2 -1 1 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-name.cpp, Page-196" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "name=[None]*50\n", + "name=raw_input(\"Enter your name <49-max>: \")\n", + "print \"Your name is\", name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name <49-max>: Archana\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your name is Archana\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-succ.cpp, Page no-196" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "msg=\"C to C++\\nC++ to Java\\nJava to...\" #string with special characters\n", + "print \"Please note the following messgae: \"\n", + "print msg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please note the following messgae: \n", + "C to C++\n", + "C++ to Java\n", + "Java to...\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-strlen.cpp, Page no-197" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "s1=[None]*25\n", + "s1=raw_input(\"Enter your name: \")\n", + "print \"strlen( s1 ) :\", len(s1) #length of string" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Smrithi\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "strlen( s1 ): 7\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-strcpy.cpp, Page no-198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "s1=[None]*25\n", + "s2=[None]*25\n", + "s1=raw_input(\"Enter a string: \")\n", + "s2=s1 #copying string\n", + "print \"strcpy( s2, s1 ):\", s2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: Garbage\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "strcpy( s2, s1 ): Garbage\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-strcat.cpp, Page no-198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "s1=[None]*40\n", + "s2=[None]*25\n", + "s1=raw_input(\"Enter string s1: \")\n", + "s2=raw_input(\"Enter string s2: \")\n", + "s1=s1+s2 #concatenating string\n", + "print \"strcat( s1, s2 ):\", s1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string s1: C\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string s2: ++\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "strcat( s1, s2 ): C++\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-strcmp, Page no-199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "s1=[None]*25\n", + "s2=[None]*25\n", + "s1=raw_input(\"Enter string s1: \")\n", + "s2=raw_input(\"Enter string s2: \")\n", + "print \"strcmp( s1, s2 ):\",\n", + "if s1==s2: #comparing strings\n", + " print s1, \"is equal to\", s2\n", + "elif s1>s2:\n", + " print s1, \"is greater than\", s2\n", + "else: \n", + " print s1, \"is less than\", s2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string s1: Computer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string s2: Computing\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "strcmp( s1, s2 ): Computer is less than Computing\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-uprlwr.cpp, Page no-199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "s1=[None]*25\n", + "temp=[None]*25\n", + "s1=raw_input(\"Enter a string: \")\n", + "temp=s1\n", + "print \"strupr(temp):\", temp.upper() #Upper case\n", + "print \"strlwr(temp):\", temp.lower() #lower case" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: Smrithi\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "strupr(temp): SMRITHI\n", + "strlwr(temp): smrithi\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-name.cpp, Page no-200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "person=[[None]*10]*LEN\n", + "n=int(raw_input(\"How many persons ? \"))\n", + "for i in range(n):\n", + " print \"Enter person\", i+1, \"name: \",\n", + " person[i]=raw_input()\n", + "print \"------------------------------------------------------\"\n", + "print \"P# Person Name Length In lower case In UPPER case\"\n", + "print \"------------------------------------------------------\"\n", + "for i in range(n):\n", + " print '{:>2}'.format(i+1),\n", + " print '{:>15}'.format(person[i]),\n", + " print '{:>2}'.format(len(person[i])),\n", + " print '{:>15}'.format(person[i].lower()),\n", + " print '{:>15}'.format(person[i].upper())" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many persons ? 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person 1 name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Anand\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 2 name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Vishwanath\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 3 name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Archana\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 4 name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Yadunandan\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person 5 name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mallikarnun\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " ------------------------------------------------------\n", + "P# Person Name Length In lower case In UPPER case\n", + "------------------------------------------------------\n", + " 1 Anand 5 anand ANAND\n", + " 2 Vishwanath 10 vishwanath VISHWANATH\n", + " 3 Archana 7 archana ARCHANA\n", + " 4 Yadunandan 10 yadunandan YADUNANDAN\n", + " 5 Mallikarnun 11 mallikarnun MALLIKARNUN\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-lex.cpp, Page no-202" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Str=[\"Anand\", \"Vishwanath\", \"Archana\", \"Yadunandan\", \"MalliKarjun\"]\n", + "print 'The given strings are:'\n", + "for i in range(5):\n", + " print Str[i]\n", + "k=1\n", + "while k<5: #sorting strings\n", + " for i in range(1, 5-k+1):\n", + " if Str[i-1]>Str[i]:\n", + " str_temp=Str[i-1]\n", + " Str[i-1]=Str[i]\n", + " Str[i]=str_temp\n", + " k=k+1\n", + "print 'Strings in lexicographical order are:'\n", + "for i in range(5):\n", + " print Str[i]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The given strings are:\n", + "Anand\n", + "Vishwanath\n", + "Archana\n", + "Yadunandan\n", + "MalliKarjun\n", + "Strings in lexicographical order are:\n", + "Anand\n", + "Archana\n", + "MalliKarjun\n", + "Vishwanath\n", + "Yadunandan\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page no-204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Str=\"In pursuit of Mastering\tC++\"\n", + "count=0\n", + "i=0\n", + "print \"The given string is:\\n\",Str\n", + "while(iy:\n", + " return x\n", + " else:\n", + " return y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "c=Max(a,b)\n", + "print \"max (a, b):\", c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 20 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max (a, b): 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example.cpp, Page no-214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(x,y):\n", + " if x>y:\n", + " return x\n", + " else:\n", + " return y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "c=Max(a,b)\n", + "print \"max (a, b):\", c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 20 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max (a, b): 20\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-chart1.cpp, Page no-214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PercentageChart(percentage):\n", + " for i in range(percentage/2):\n", + " sys.stdout.write('\\x3d')\n", + "print \"Sridevi : \",\n", + "PercentageChart(50)\n", + "print \"\\nRajkumar: \",\n", + "PercentageChart(84)\n", + "print \"\\nSavithri: \",\n", + "PercentageChart(79)\n", + "print \"\\nAnand : \",\n", + "PercentageChart(74)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sridevi : ========================= \n", + "Rajkumar: ========================================== \n", + "Savithri: ======================================= \n", + "Anand : =====================================\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-chart2.cpp, Page no-216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PercentageChart(percentage):\n", + " for i in range(percentage/2):\n", + " sys.stdout.write('\\x3d')\n", + "m1, m2, m3, m4=[int(x) for x in raw_input(\"Enter percentage score of Sri, Raj, Savi, An: \").split()]\n", + "print \"Sridevi : \",\n", + "PercentageChart(m1)\n", + "print \"\\nRajkumar: \",\n", + "PercentageChart(m2)\n", + "print \"\\nSavithri: \",\n", + "PercentageChart(m3)\n", + "print \"\\nAnand : \",\n", + "PercentageChart(m4)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter percentage score of Sri, Raj, Savi, An: 52 92 83 67\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sridevi : ========================== \n", + "Rajkumar: ============================================== \n", + "Savithri: ========================================= \n", + "Anand : =================================\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-chart3.cpp, Page no-217" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PercentageChart(percentage, style):\n", + " for i in range(percentage/2):\n", + " sys.stdout.write(style)\n", + "m1, m2, m3, m4=[int(x) for x in raw_input(\"Enter percentage score of Sri, Raj, Savi, An: \").split()]\n", + "print \"Sridevi : \",\n", + "PercentageChart(m1, '*')\n", + "print \"\\nRajkumar: \",\n", + "PercentageChart(m2, '\\x3D')\n", + "print \"\\nSavithri: \",\n", + "PercentageChart(m3, '-')\n", + "print \"\\nAnand : \",\n", + "PercentageChart(m4, '!')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter percentage score of Sri, Raj, Savi, An: 55 92 83 67\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sridevi : *************************** \n", + "Rajkumar: ============================================== \n", + "Savithri: ----------------------------------------- \n", + "Anand : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ifact.cpp, Page no-218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def fact(n):\n", + " if n==0:\n", + " result=1\n", + " else:\n", + " result=1\n", + " for i in range(2, n+1):\n", + " result*=i\n", + " return result\n", + "n=int(raw_input(\"Enter the number whose factorial is to be found: \"))\n", + "print \"The factorial of\", n, \"is\", fact(n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number whose factorial is to be found: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The factorial of 5 is 120\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-namelen.cpp, Page no-219" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "name=[None]*20\n", + "name=raw_input(\"Enter your name: \")\n", + "Len=len(name) #string length\n", + "print \"Length of your name =\", Len" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Rajkumar\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length of your name = 8\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-maths.cpp, Page no-220" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "num=float(raw_input(\"Enter any factorial number: \"))\n", + "num1=math.ceil(num) #ceiling of number\n", + "num2=math.floor(num) #floor of number\n", + "print \"ceil(\",num,\") =\", num1\n", + "print \"floor(\",num,\") =\", num2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any factorial number: 2.9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ceil( 2.9 ) = 3.0\n", + "floor( 2.9 ) = 2.0\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap1.cpp, Page no-221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y): #pass by value swap\n", + " print \"Value of x and y in swap before exchange:\", x, y\n", + " t=x\n", + " x=y\n", + " y=t\n", + " print \"Value of x and y in swap after exchange:\", x, y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "swap(a,b)\n", + "print \"Value of a and b on swap a, b) in main():\", a, b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of x and y in swap before exchange: 10 20\n", + "Value of x and y in swap after exchange: 20 10\n", + "Value of a and b on swap a, b) in main(): 10 20\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap2.cpp, Pgae no-222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y): #pass by address swap\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "a, b = swap(a, b)\n", + "print \"Value of a and b on swap( a, b ):\", a, b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of a and b on swap( a, b ): 20 10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap3.cpp, Page no-224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y): #pass by reference swap\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "a, b = swap(a, b)\n", + "print \"Value of a and b on swap( a, b):\", a, b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of a and b on swap( a, b): 20 10\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ref.cpp, Page no-226" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(x,y):\n", + " if x>y:\n", + " return x\n", + " else:\n", + " return y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "if Max(a,b)==a:\n", + " a=425\n", + "else:\n", + " b=425\n", + "print \"The value of a and b on execution of mx(x, y)=425;...\"\n", + "print \"a =\", a, \"b =\", b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 2 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of a and b on execution of mx(x, y)=425;...\n", + "a = 425 b = 1\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-defarg1.cpp, Page no-228" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PrintLine(ch='-', RepeatCount=70): #default arguments\n", + " for i in range(RepeatCount):\n", + " sys.stdout.write(ch)\n", + " print ''\n", + "PrintLine()\n", + "PrintLine('!')\n", + "PrintLine('*', 40)\n", + "PrintLine('R', 55)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "----------------------------------------------------------------------\n", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "****************************************\n", + "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-defarg2.cpp, Pgae no-229" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PrintLine(ch='-', RepeatCount=70, nLines=1): #default arguments\n", + " for i in range(nLines):\n", + " for i in range(RepeatCount):\n", + " sys.stdout.write(ch)\n", + " print ''\n", + "PrintLine()\n", + "PrintLine('!')\n", + "PrintLine('*', 40)\n", + "PrintLine('R', 55)\n", + "PrintLine('&', 25, 2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "----------------------------------------------------------------------\n", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "****************************************\n", + "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", + "&&&&&&&&&&&&&&&&&&&&&&&&&\n", + "&&&&&&&&&&&&&&&&&&&&&&&&&\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-square.cpp, Page no-230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def sqr(num):\n", + " return num*num\n", + "n=float(raw_input(\"Enter a number: \"))\n", + "print \"Its square =\",sqr(n)\n", + "print \"sqr( 10 ) =\", sqr(10)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Its square = 25.0\n", + "sqr( 10 ) = 100\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap4.cpp, Page no-231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#different swap functions\n", + "def swap_char(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "def swap_int(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "def swap_float(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch1, ch2 = swap_char(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "a, b = swap_int(a, b)\n", + "print \"On swapping :\", a,b\n", + "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", + "c, d = swap_float(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap5.cpp, Page no-233" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y): #function overloading\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch1, ch2 = swap(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "a, b = swap(a, b)\n", + "print \"On swapping :\", a,b\n", + "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", + "c, d = swap(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-show.cpp, Page no-234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show(val): #function overloading\n", + " if(isinstance(val, int)):\n", + " print \"Integer:\", val\n", + " if(isinstance(val, float)):\n", + " print \"Double:\", val\n", + " if(isinstance(val, str)):\n", + " print \"String:\", val\n", + "show(420)\n", + "show(3.1415)\n", + "show(\"Hello World!\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer: 420\n", + "Double: 3.1415\n", + "String: Hello World!\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap6.cpp, Page no-236" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch1, ch2 = swap(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "a, b = swap(a, b)\n", + "print \"On swapping :\", a,b\n", + "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", + "c, d = swap(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sort.cpp, Page no-237" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "(false, true)=(0, 1) #enum type\n", + "type =['false', 'true']\n", + "def swap(x, y):\n", + " x, y=y, x\n", + " return x, y\n", + "def BubbleSort(a, size):\n", + " swapped='true'\n", + " for i in range(size-1):\n", + " if swapped:\n", + " swapped='false'\n", + " for j in range((size-1)-i):\n", + " if a[j]>a[j+1]:\n", + " swapped='true'\n", + " a[j], a[j+1]=swap(a[j], a[j+1])\n", + " return a\n", + "a=[int]*25\n", + "print \"Program to sort elements...\"\n", + "size=int(raw_input(\"Enter the size of the integer vector : \"))\n", + "print \"Enter the elements of the integer vector...\"\n", + "for i in range(size):\n", + " a[i]=int(raw_input())\n", + "a=BubbleSort(a, size)\n", + "print \"Sorted Vector:\"\n", + "for i in range(size):\n", + " print a[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Program to sort elements...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the size of the integer vector : 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the elements of the integer vector...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sorted Vector:\n", + "2 3 6 8 9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-linear.cpp, Page no-239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def linear(arr, num):\n", + " for i in range(10):\n", + " if arr[i]==num:\n", + " return i\n", + " return -1\n", + "a=[10, 20, 5, 59, 63, 22, 18, 99, 11, 65] # 1-D array\n", + "element=int(raw_input(\"Enter the element to be searched: \"))\n", + "result=linear(a, element)\n", + "if result==-1:\n", + " print element, \"is not present in the array\"\n", + "else:\n", + " print element, \"is present at\",result, \"location in the array\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the element to be searched: 88\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "88 is not present in the array\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-funcstk.cpp, Page no-240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Func(j, k):\n", + " print \"In the function the argument values are\", j, \"..\", k\n", + "i=99\n", + "Func(i+1, i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In the function the argument values are 100 .. 99\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-variable.cpp, Page no-241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "g=100\n", + "def func1():\n", + " g=50\n", + " print \"Local variable g in func1() :\", g\n", + "def func2():\n", + " global g\n", + " print \"In func2() g is visible since it is global.\"\n", + " print \"Incremeting g in func...\"\n", + " g+=1\n", + "print \"In main g is visible here since g is global.\"\n", + "print \"Assigning 20 to g in main...\"\n", + "g=20\n", + "print \"Calling func1...\"\n", + "func1()\n", + "print \"func1 returned. g is\", g\n", + "print \"Calling func2...\"\n", + "func2()\n", + "print \"func2 returned. g is\", g" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In main g is visible here since g is global.\n", + "Assigning 20 to g in main...\n", + "Calling func1...\n", + "Local variable g in func1() : 50\n", + "func1 returned. g is 20\n", + "Calling func2...\n", + "In func2() g is visible since it is global.\n", + "Incremeting g in func...\n", + "func2 returned. g is 21\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-regvar.cpp, Page no-244" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "i=int\n", + "name=raw_input(\"Enter a string: \")\n", + "print \"The reverse of the string is: \",\n", + "for i in range(len(name)-1, -1, -1):\n", + " sys.stdout.write(name[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: mahatma\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The reverse of the string is: amtaham\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-count.cpp, Page no-245" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def PrintCount(Count=[1]):\n", + " print 'Count =', Count[0]\n", + " Count[0]=Count[0]+1\n", + "PrintCount()\n", + "PrintCount()\n", + "PrintCount()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Count = 1\n", + "Count = 2\n", + "Count = 3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-add.cpp, Page no-247" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def add(*argc):#variable number of arguments to the function\n", + " result=0\n", + " for i in range(1, argc[0]+1):\n", + " result+=argc[i]\n", + " return result\n", + "sum1=add(3, 1, 2, 3)\n", + "print \"sum1 =\", sum1\n", + "sum2=add(1, 10)\n", + "print \"sum2 =\", sum2\n", + "sum3=add(0)\n", + "print \"sum3 =\", sum3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sum1 = 6\n", + "sum2 = 10\n", + "sum3 = 0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sum.cpp, Page no-248" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def sum(*msg): #variable number of arguments to the function\n", + " total=0\n", + " i=1\n", + " while(msg[i]!=0):\n", + " total+=msg[i]\n", + " i+=1\n", + " print msg[0], total\n", + "sum(\"The total of 1+2+3+4 is\", 1, 2, 3, 4, 0)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total of 1+2+3+4 is 10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-rfact.cpp, Page no-250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def fact(num): #recursive function\n", + " if num==0:\n", + " return 1\n", + " else:\n", + " return num*fact(num-1)\n", + "n=int(raw_input(\"Enter the number whose factorial is to be found: \"))\n", + "print \"The factorial of\", n, \"is\", fact(n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number whose factorial is to be found: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The factorial of 5 is 120\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-hanoi.cpp, Page no-250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def hanoi(n, left, mid, right): #recursive function\n", + " if n!=0:\n", + " hanoi(n-1, left, right, mid)\n", + " print 'Move disk', n, 'from', left, 'to', right\n", + " hanoi(n-1, mid, left, right)\n", + "source='L'\n", + "intermediate='C'\n", + "destination='R'\n", + "nvalue=int(raw_input('Enter number of disks: '))\n", + "hanoi(nvalue, source, intermediate, destination)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of disks: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Move disk 1 from L to R\n", + "Move disk 2 from L to C\n", + "Move disk 1 from R to C\n", + "Move disk 3 from L to R\n", + "Move disk 1 from C to L\n", + "Move disk 2 from C to R\n", + "Move disk 1 from L to R\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page no-254" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def power(x1, y1=None):\n", + " if (isinstance(y1, int)):\n", + " result=1.0\n", + " for i in range(1, y1+1):\n", + " result=result*x1\n", + " return result\n", + " else:\n", + " return x1*x1\n", + "x=float(raw_input(\"Enter the value of x: \"))\n", + "y=int(raw_input(\"Enter the value of y: \"))\n", + "print \"power(x, y) =\", power(x, y)\n", + "print \"power(x) =\", power(x)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the value of x: 9.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the value of y: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power(x, y) = 8145.0625\n", + "power(x) = 90.25\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions_1.ipynb new file mode 100755 index 00000000..209d4a32 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions_1.ipynb @@ -0,0 +1,1641 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:01e9bb6f23cf66730668efcf362fa75830da07f132439eac09b9d85dcf6bc616" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7-Modular Programming with Functions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-tax1.cpp, Page no-208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Name=[None]*25\n", + "Name=raw_input(\"Enter name of the 1st person: \")\n", + "Salary=float(raw_input(\"Enter Salary: \"))\n", + "if(Salary<=90000):\n", + " Tax=Salary*12.5/100\n", + "else:\n", + " Tax=Salary*18/100\n", + "print \"The tax amount for\", Name, \"is:\", Tax\n", + "Name=raw_input(\"Enter name of the 2nd person: \")\n", + "Salary=float(raw_input(\"Enter Salary: \"))\n", + "if(Salary<=90000):\n", + " Tax=Salary*12.5/100\n", + "else:\n", + " Tax=Salary*18/100\n", + "print \"The tax amount for\", Name, \"is:\", Tax" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of the 1st person: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Salary: 130000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The tax amount for Rajkumar is: 23400.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of the 2nd person: Savithri\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Salary: 90000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The tax amount for Savithri is: 11250.0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-tax2.cpp, Page no-209" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def CalculateTax(): #function for calculating tax\n", + " Name=[None]*25\n", + " Name=raw_input(\"Enter name of the person: \")\n", + " Salary=float(raw_input(\"Enter Salary: \"))\n", + " if(Salary<=90000):\n", + " Tax=Salary*12.5/100\n", + " else:\n", + " Tax=Salary*18/100\n", + " print \"The tax amount for\", Name, \"is:\", Tax\n", + "CalculateTax()\n", + "CalculateTax()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of the person: Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Salary: 130000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The tax amount for Rajkumar is: 23400.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name of the person: Savithri\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Salary: 90000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The tax amount for Savithri is: 11250.0\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-max1.cpp, Page no-210" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(x,y):\n", + " if x>y:\n", + " return x\n", + " else:\n", + " return y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "c=Max(a,b)\n", + "print \"max (a, b):\", c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 20 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max (a, b): 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example.cpp, Page no-214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(x,y):\n", + " if x>y:\n", + " return x\n", + " else:\n", + " return y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "c=Max(a,b)\n", + "print \"max (a, b):\", c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 20 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max (a, b): 20\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-chart1.cpp, Page no-214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PercentageChart(percentage):\n", + " for i in range(percentage/2):\n", + " sys.stdout.write('\\x3d')\n", + "print \"Sridevi : \",\n", + "PercentageChart(50)\n", + "print \"\\nRajkumar: \",\n", + "PercentageChart(84)\n", + "print \"\\nSavithri: \",\n", + "PercentageChart(79)\n", + "print \"\\nAnand : \",\n", + "PercentageChart(74)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sridevi : ========================= \n", + "Rajkumar: ========================================== \n", + "Savithri: ======================================= \n", + "Anand : =====================================\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-chart2.cpp, Page no-216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PercentageChart(percentage):\n", + " for i in range(percentage/2):\n", + " sys.stdout.write('\\x3d')\n", + "m1, m2, m3, m4=[int(x) for x in raw_input(\"Enter percentage score of Sri, Raj, Savi, An: \").split()]\n", + "print \"Sridevi : \",\n", + "PercentageChart(m1)\n", + "print \"\\nRajkumar: \",\n", + "PercentageChart(m2)\n", + "print \"\\nSavithri: \",\n", + "PercentageChart(m3)\n", + "print \"\\nAnand : \",\n", + "PercentageChart(m4)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter percentage score of Sri, Raj, Savi, An: 52 92 83 67\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sridevi : ========================== \n", + "Rajkumar: ============================================== \n", + "Savithri: ========================================= \n", + "Anand : =================================\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-chart3.cpp, Page no-217" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PercentageChart(percentage, style):\n", + " for i in range(percentage/2):\n", + " sys.stdout.write(style)\n", + "m1, m2, m3, m4=[int(x) for x in raw_input(\"Enter percentage score of Sri, Raj, Savi, An: \").split()]\n", + "print \"Sridevi : \",\n", + "PercentageChart(m1, '*')\n", + "print \"\\nRajkumar: \",\n", + "PercentageChart(m2, '\\x3D')\n", + "print \"\\nSavithri: \",\n", + "PercentageChart(m3, '-')\n", + "print \"\\nAnand : \",\n", + "PercentageChart(m4, '!')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter percentage score of Sri, Raj, Savi, An: 55 92 83 67\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sridevi : *************************** \n", + "Rajkumar: ============================================== \n", + "Savithri: ----------------------------------------- \n", + "Anand : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ifact.cpp, Page no-218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def fact(n):\n", + " if n==0:\n", + " result=1\n", + " else:\n", + " result=1\n", + " for i in range(2, n+1):\n", + " result*=i\n", + " return result\n", + "n=int(raw_input(\"Enter the number whose factorial is to be found: \"))\n", + "print \"The factorial of\", n, \"is\", fact(n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number whose factorial is to be found: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The factorial of 5 is 120\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-namelen.cpp, Page no-219" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "name=[None]*20\n", + "name=raw_input(\"Enter your name: \")\n", + "Len=len(name) #string length\n", + "print \"Length of your name =\", Len" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Rajkumar\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length of your name = 8\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-maths.cpp, Page no-220" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "num=float(raw_input(\"Enter any factorial number: \"))\n", + "num1=math.ceil(num) #ceiling of number\n", + "num2=math.floor(num) #floor of number\n", + "print \"ceil(\",num,\") =\", num1\n", + "print \"floor(\",num,\") =\", num2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any factorial number: 2.9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ceil( 2.9 ) = 3.0\n", + "floor( 2.9 ) = 2.0\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap1.cpp, Page no-221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y): #pass by value swap\n", + " print \"Value of x and y in swap before exchange:\", x, y\n", + " t=x\n", + " x=y\n", + " y=t\n", + " print \"Value of x and y in swap after exchange:\", x, y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "swap(a,b)\n", + "print \"Value of a and b on swap a, b) in main():\", a, b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of x and y in swap before exchange: 10 20\n", + "Value of x and y in swap after exchange: 20 10\n", + "Value of a and b on swap a, b) in main(): 10 20\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap2.cpp, Pgae no-222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y): #pass by address swap\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "a, b = swap(a, b)\n", + "print \"Value of a and b on swap( a, b ):\", a, b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of a and b on swap( a, b ): 20 10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap3.cpp, Page no-224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y): #pass by reference swap\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "a, b = swap(a, b)\n", + "print \"Value of a and b on swap( a, b):\", a, b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of a and b on swap( a, b): 20 10\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ref.cpp, Page no-226" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Max(x,y):\n", + " if x>y:\n", + " return x\n", + " else:\n", + " return y\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", + "if Max(a,b)==a:\n", + " a=425\n", + "else:\n", + " b=425\n", + "print \"The value of a and b on execution of mx(x, y)=425;...\"\n", + "print \"a =\", a, \"b =\", b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers : 2 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of a and b on execution of mx(x, y)=425;...\n", + "a = 425 b = 1\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-defarg1.cpp, Page no-228" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PrintLine(ch='-', RepeatCount=70): #default arguments\n", + " for i in range(RepeatCount):\n", + " sys.stdout.write(ch)\n", + " print ''\n", + "PrintLine()\n", + "PrintLine('!')\n", + "PrintLine('*', 40)\n", + "PrintLine('R', 55)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "----------------------------------------------------------------------\n", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "****************************************\n", + "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-defarg2.cpp, Pgae no-229" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "def PrintLine(ch='-', RepeatCount=70, nLines=1): #default arguments\n", + " for i in range(nLines):\n", + " for i in range(RepeatCount):\n", + " sys.stdout.write(ch)\n", + " print ''\n", + "PrintLine()\n", + "PrintLine('!')\n", + "PrintLine('*', 40)\n", + "PrintLine('R', 55)\n", + "PrintLine('&', 25, 2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "----------------------------------------------------------------------\n", + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "****************************************\n", + "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", + "&&&&&&&&&&&&&&&&&&&&&&&&&\n", + "&&&&&&&&&&&&&&&&&&&&&&&&&\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-square.cpp, Page no-230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def sqr(num):\n", + " return num*num\n", + "n=float(raw_input(\"Enter a number: \"))\n", + "print \"Its square =\",sqr(n)\n", + "print \"sqr( 10 ) =\", sqr(10)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Its square = 25.0\n", + "sqr( 10 ) = 100\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap4.cpp, Page no-231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#different swap functions\n", + "def swap_char(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "def swap_int(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "def swap_float(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch1, ch2 = swap_char(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "a, b = swap_int(a, b)\n", + "print \"On swapping :\", a,b\n", + "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", + "c, d = swap_float(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap5.cpp, Page no-233" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y): #function overloading\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch1, ch2 = swap(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "a, b = swap(a, b)\n", + "print \"On swapping :\", a,b\n", + "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", + "c, d = swap(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-show.cpp, Page no-234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show(val): #function overloading\n", + " if(isinstance(val, int)):\n", + " print \"Integer:\", val\n", + " if(isinstance(val, float)):\n", + " print \"Double:\", val\n", + " if(isinstance(val, str)):\n", + " print \"String:\", val\n", + "show(420)\n", + "show(3.1415)\n", + "show(\"Hello World!\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer: 420\n", + "Double: 3.1415\n", + "String: Hello World!\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap6.cpp, Page no-236" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def swap(x, y):\n", + " t=x\n", + " x=y\n", + " y=t\n", + " return x, y\n", + "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "ch1, ch2 = swap(ch1, ch2)\n", + "print \"On swapping :\", ch1, ch2\n", + "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", + "a, b = swap(a, b)\n", + "print \"On swapping :\", a,b\n", + "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", + "c, d = swap(c, d)\n", + "print \"On swapping :\", c, d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : R K\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : K R\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two characters : 5 10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 10 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two floats : 20.5 99.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On swapping : 99.5 20.5\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sort.cpp, Page no-237" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "(false, true)=(0, 1) #enum type\n", + "type =['false', 'true']\n", + "def swap(x, y):\n", + " x, y=y, x\n", + " return x, y\n", + "def BubbleSort(a, size):\n", + " swapped='true'\n", + " for i in range(size-1):\n", + " if swapped:\n", + " swapped='false'\n", + " for j in range((size-1)-i):\n", + " if a[j]>a[j+1]:\n", + " swapped='true'\n", + " a[j], a[j+1]=swap(a[j], a[j+1])\n", + " return a\n", + "a=[int]*25\n", + "print \"Program to sort elements...\"\n", + "size=int(raw_input(\"Enter the size of the integer vector : \"))\n", + "print \"Enter the elements of the integer vector...\"\n", + "for i in range(size):\n", + " a[i]=int(raw_input())\n", + "a=BubbleSort(a, size)\n", + "print \"Sorted Vector:\"\n", + "for i in range(size):\n", + " print a[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Program to sort elements...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the size of the integer vector : 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the elements of the integer vector...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sorted Vector:\n", + "2 3 6 8 9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-linear.cpp, Page no-239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def linear(arr, num):\n", + " for i in range(10):\n", + " if arr[i]==num:\n", + " return i\n", + " return -1\n", + "a=[10, 20, 5, 59, 63, 22, 18, 99, 11, 65] # 1-D array\n", + "element=int(raw_input(\"Enter the element to be searched: \"))\n", + "result=linear(a, element)\n", + "if result==-1:\n", + " print element, \"is not present in the array\"\n", + "else:\n", + " print element, \"is present at\",result, \"location in the array\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the element to be searched: 88\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "88 is not present in the array\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-funcstk.cpp, Page no-240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Func(j, k):\n", + " print \"In the function the argument values are\", j, \"..\", k\n", + "i=99\n", + "Func(i+1, i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In the function the argument values are 100 .. 99\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-variable.cpp, Page no-241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "g=100\n", + "def func1():\n", + " g=50\n", + " print \"Local variable g in func1() :\", g\n", + "def func2():\n", + " global g\n", + " print \"In func2() g is visible since it is global.\"\n", + " print \"Incremeting g in func...\"\n", + " g+=1\n", + "print \"In main g is visible here since g is global.\"\n", + "print \"Assigning 20 to g in main...\"\n", + "g=20\n", + "print \"Calling func1...\"\n", + "func1()\n", + "print \"func1 returned. g is\", g\n", + "print \"Calling func2...\"\n", + "func2()\n", + "print \"func2 returned. g is\", g" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In main g is visible here since g is global.\n", + "Assigning 20 to g in main...\n", + "Calling func1...\n", + "Local variable g in func1() : 50\n", + "func1 returned. g is 20\n", + "Calling func2...\n", + "In func2() g is visible since it is global.\n", + "Incremeting g in func...\n", + "func2 returned. g is 21\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-regvar.cpp, Page no-244" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "i=int\n", + "name=raw_input(\"Enter a string: \")\n", + "print \"The reverse of the string is: \",\n", + "for i in range(len(name)-1, -1, -1):\n", + " sys.stdout.write(name[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: mahatma\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The reverse of the string is: amtaham\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-count.cpp, Page no-245" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def PrintCount(Count=[1]):\n", + " print 'Count =', Count[0]\n", + " Count[0]=Count[0]+1\n", + "PrintCount()\n", + "PrintCount()\n", + "PrintCount()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Count = 1\n", + "Count = 2\n", + "Count = 3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-add.cpp, Page no-247" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def add(*argc):#variable number of arguments to the function\n", + " result=0\n", + " for i in range(1, argc[0]+1):\n", + " result+=argc[i]\n", + " return result\n", + "sum1=add(3, 1, 2, 3)\n", + "print \"sum1 =\", sum1\n", + "sum2=add(1, 10)\n", + "print \"sum2 =\", sum2\n", + "sum3=add(0)\n", + "print \"sum3 =\", sum3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sum1 = 6\n", + "sum2 = 10\n", + "sum3 = 0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sum.cpp, Page no-248" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def sum(*msg): #variable number of arguments to the function\n", + " total=0\n", + " i=1\n", + " while(msg[i]!=0):\n", + " total+=msg[i]\n", + " i+=1\n", + " print msg[0], total\n", + "sum(\"The total of 1+2+3+4 is\", 1, 2, 3, 4, 0)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total of 1+2+3+4 is 10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-rfact.cpp, Page no-250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def fact(num): #recursive function\n", + " if num==0:\n", + " return 1\n", + " else:\n", + " return num*fact(num-1)\n", + "n=int(raw_input(\"Enter the number whose factorial is to be found: \"))\n", + "print \"The factorial of\", n, \"is\", fact(n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number whose factorial is to be found: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The factorial of 5 is 120\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-hanoi.cpp, Page no-250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def hanoi(n, left, mid, right): #recursive function\n", + " if n!=0:\n", + " hanoi(n-1, left, right, mid)\n", + " print 'Move disk', n, 'from', left, 'to', right\n", + " hanoi(n-1, mid, left, right)\n", + "source='L'\n", + "intermediate='C'\n", + "destination='R'\n", + "nvalue=int(raw_input('Enter number of disks: '))\n", + "hanoi(nvalue, source, intermediate, destination)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of disks: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Move disk 1 from L to R\n", + "Move disk 2 from L to C\n", + "Move disk 1 from R to C\n", + "Move disk 3 from L to R\n", + "Move disk 1 from C to L\n", + "Move disk 2 from C to R\n", + "Move disk 1 from L to R\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page no-254" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def power(x1, y1=None):\n", + " if (isinstance(y1, int)):\n", + " result=1.0\n", + " for i in range(1, y1+1):\n", + " result=result*x1\n", + " return result\n", + " else:\n", + " return x1*x1\n", + "x=float(raw_input(\"Enter the value of x: \"))\n", + "y=int(raw_input(\"Enter the value of y: \"))\n", + "print \"power(x, y) =\", power(x, y)\n", + "print \"power(x) =\", power(x)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the value of x: 9.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the value of y: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power(x, y) = 8145.0625\n", + "power(x) = 90.25\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions.ipynb new file mode 100755 index 00000000..88f0f80d --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions.ipynb @@ -0,0 +1,1202 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f7e7015d0709344fbfb1dd6045265378d35165eecd34afefa9304b97a8f3cb07" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8-Structures and Unions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student1.cpp, Page no-260" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class Student(Structure): #structure\n", + " roll_no =int\n", + " name =str\n", + " branch =str\n", + " marks=int\n", + "s1=Student() #object of struct student\n", + "print \"Enter data for student...\"\n", + "s1.roll_no=int(raw_input(\"Roll Number ? \"))\n", + "s1.name=raw_input(\"Name ? \")\n", + "s1.branch=raw_input(\"Branch ? \")\n", + "s1.marks=int(raw_input(\"Total Marks ? \"))\n", + "print \"Student Report\"\n", + "print \"--------------\"\n", + "print \"Roll Number:\", s1.roll_no\n", + "print \"Name:\", s1.name\n", + "print \"Branch:\", s1.branch\n", + "print \"Percentage:%f\" %(s1.marks*(100.0/325))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Mangala\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Computer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total Marks ? 290\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Report\n", + "--------------\n", + "Roll Number: 5\n", + "Name: Mangala\n", + "Branch: Computer\n", + "Percentage:89.230769\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-days.cpp, Page no-262" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class date(Structure):\n", + " _fields_=[(\"day\", c_int),(\"month\", c_int),(\"year\",c_int)]\n", + "d1=date(14, 4, 1971)\n", + "d2=date(3, 7, 1996)\n", + "print \"Birth date:\",\n", + "print \"%s-%s-%s\" %(d1.day, d1.month, d1.year)\n", + "print \"Today date:\",\n", + "print \"%s-%s-%s\" %(d2.day, d2.month, d2.year)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth date: 14-4-1971\n", + "Today date: 3-7-1996\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student2.cpp, Page no-264" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class date(Structure):\n", + " _fields_=[(\"day\", c_int),(\"month\", c_int),(\"year\",c_int)]\n", + "class Student(Structure):\n", + " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"birthday\", date), (\"branch\", c_char*15),(\"marks\", c_int)]#nested structure\n", + "s1=Student()\n", + "print \"Enter data for student...\"\n", + "s1.roll_no=int(raw_input(\"Roll Number ? \"))\n", + "s1.name=raw_input(\"Name ? \")\n", + "birthday=date(0, 0, 0)\n", + "print \"Enter date of birth : \",\n", + "d, m, y=[int(x) for x in raw_input().split()]\n", + "birthday.day=d\n", + "birthday.month=m\n", + "birthday.year=y\n", + "s1.birthday=birthday\n", + "s1.branch=raw_input(\"Branch ? \")\n", + "s1.marks=int(raw_input(\"Total Marks ? \"))\n", + "print \"Student Report\"\n", + "print \"--------------\"\n", + "print \"Roll Number:\", s1.roll_no\n", + "print \"Name:\", s1.name\n", + "print \"%s-%s-%s\" %(s1.birthday.day, s1.birthday.month, s1.birthday.year)\n", + "print \"Branch:\", s1.branch\n", + "print \"Percentage:%f\" %(s1.marks*(100.0/325))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Savithri\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter date of birth : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 2 1972\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Electrical\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total Marks ? 295\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Student Report\n", + "--------------\n", + "Roll Number: 9\n", + "Name: Savithri\n", + "2-2-1972\n", + "Branch: Electrical\n", + "Percentage:90.769231\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student3.cpp, Page no-267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class Student(Structure):\n", + " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", + "s=[]\n", + "n=int(raw_input(\"How many students to be processed : \"))\n", + "for i in range(n):\n", + " print \"Enter data for student\", i+1, \"...\"\n", + " r=int(raw_input(\"Roll Number ? \"))\n", + " name=raw_input(\"Name ? \")\n", + " b=raw_input(\"Branch ? \")\n", + " m=int(raw_input(\"Total marks ? \"))\n", + " s.append(Student(r, name, b, m)) #array of structure objects\n", + "print \"Students Report\"\n", + "print \"--------------\"\n", + "for i in range(n):\n", + " print \"Roll Number:\", s[i].roll_no\n", + " print \"Name:\", s[i].name\n", + " print \"Branch:\", s[i].branch\n", + " print \"Percentage: %f\" %(s[i].marks*(100.0/325))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many students to be processed : 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 1 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Mangala\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Computer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 290\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 2 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Shivakumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Electronics\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 250\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Students Report\n", + "--------------\n", + "Roll Number: 5\n", + "Name: Mangala\n", + "Branch: Computer\n", + "Percentage: 89.230769\n", + "Roll Number: 9\n", + "Name: Shivakumar\n", + "Branch: Electronics\n", + "Percentage: 76.923077\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student4.cpp, Page no-269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class Student(Structure):\n", + " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", + "STUDENTS_COUNT=5\n", + "s=[]\n", + "s.append(Student(2, 'Tejaswi', 'CS', 285))#initialization of array of structures\n", + "s.append(Student(3, 'Laxmi', 'IT', 215))\n", + "s.append(Student(5, 'Bhavani', 'Electronics', 250))\n", + "s.append(Student(7, 'Anil', 'Civil', 215))\n", + "s.append(Student(9, 'Savithri', 'Electrical', 290))\n", + "print \"Students Report\"\n", + "print \"--------------\"\n", + "for i in range(STUDENTS_COUNT):\n", + " print \"Roll Number:\", s[i].roll_no\n", + " print \"Name:\", s[i].name\n", + " print \"Branch:\", s[i].branch\n", + " print \"Percentage: %0.4f\" %(s[i].marks*(100.0/325))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Students Report\n", + "--------------\n", + "Roll Number: 2\n", + "Name: Tejaswi\n", + "Branch: CS\n", + "Percentage: 87.6923\n", + "Roll Number: 3\n", + "Name: Laxmi\n", + "Branch: IT\n", + "Percentage: 66.1538\n", + "Roll Number: 5\n", + "Name: Bhavani\n", + "Branch: Electronics\n", + "Percentage: 76.9231\n", + "Roll Number: 7\n", + "Name: Anil\n", + "Branch: Civil\n", + "Percentage: 66.1538\n", + "Roll Number: 9\n", + "Name: Savithri\n", + "Branch: Electrical\n", + "Percentage: 89.2308\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student5.cpp, Page no-271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class Student(Structure):\n", + " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", + "def read():\n", + " dull=Student()\n", + " dull.roll_no=int(raw_input(\"Roll Number ? \"))\n", + " dull.name=raw_input(\"Name ? \")\n", + " dull.branch=raw_input(\"Branch ? \")\n", + " dull.marks=int(raw_input(\"Total marks ? \"))\n", + " return dull #returning structure object\n", + "def show(genius): #passing object of structure\n", + " print \"Roll Number:\", genius.roll_no\n", + " print \"Name:\", genius.name\n", + " print \"Branch:\", genius.branch\n", + " print \"Percentage: %0.4f\" %(genius.marks*(100.0/325))\n", + "s=[]\n", + "n=int(raw_input(\"How many students to be processed : \"))\n", + "for i in range(n):\n", + " print \"Enter data for student\", i+1, \"...\"\n", + " s.append(read())\n", + "print \"Students Report\"\n", + "print \"--------------\"\n", + "for i in range(n):\n", + " show(s[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many students to be processed : 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 1 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Smrithi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Genetics\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 295\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 2 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Bindhu\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? MCA\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 300\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Students Report\n", + "--------------\n", + "Roll Number: 3\n", + "Name: Smrithi\n", + "Branch: Genetics\n", + "Percentage: 90.7692\n", + "Roll Number: 10\n", + "Name: Bindhu\n", + "Branch: MCA\n", + "Percentage: 92.3077\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student6.cpp, Page no-273" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class Student(Structure):\n", + " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", + "def HighestMarks(s, count): #passing array of structures\n", + " big=s[0].marks\n", + " for i in range(1, count):\n", + " if s[i].marks>big:\n", + " big=s[i].marks\n", + " index=i\n", + " return index\n", + "def read():\n", + " dull=Student()\n", + " dull.roll_no=int(raw_input(\"Roll Number ? \"))\n", + " dull.name=raw_input(\"Name ? \")\n", + " dull.branch=raw_input(\"Branch ? \")\n", + " dull.marks=int(raw_input(\"Total marks ? \"))\n", + " return dull\n", + "def show(genius):\n", + " print \"Roll Number:\", genius.roll_no\n", + " print \"Name:\", genius.name\n", + " print \"Branch:\", genius.branch\n", + " print \"Percentage: %0.4f\" %(genius.marks*(100.0/325))\n", + "s=[]\n", + "n=int(raw_input(\"How many students to be processed : \"))\n", + "for i in range(n):\n", + " print \"Enter data for student\", i+1, \"...\"\n", + " s.append(read())\n", + "print \"Students Report\"\n", + "print \"--------------\"\n", + "Id=HighestMarks(s, n)\n", + "print \"Details of student scoring higest marks...\"\n", + "show(s[Id])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many students to be processed : 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 1 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Smrithi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Genetics\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 295\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 2 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 15\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Computer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 315\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 3 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Laxmi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Electronics\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 255\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Students Report\n", + "--------------\n", + "Details of student scoring higest marks...\n", + "Roll Number: 15\n", + "Name: Rajkumar\n", + "Branch: Computer\n", + "Percentage: 96.9231\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex.cpp, Page no-278" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "import sys\n", + "import math\n", + "class Complex(Structure):\n", + " x=int\n", + " y=int\n", + " def read(self):\n", + " self.x=int(raw_input(\"Real part? \"))\n", + " self.y=int(raw_input(\"Imaginary part? \"))\n", + " def show(self, msg):\n", + " print msg, self.x,\n", + " if self.y<0:\n", + " sys.stdout.write('-i')\n", + " else:\n", + " sys.stdout.write('+i')\n", + " print math.fabs(self.y)\n", + " def add(self, c2):\n", + " self.x+=c2.x\n", + " self.y+=c2.y\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter complex number c1...\"\n", + "c1.read()\n", + "print \"Enter complex number c2...\"\n", + "c2.read()\n", + "c1.show('c1 =')\n", + "c2.show('c2 =')\n", + "c3=c1\n", + "c3.add(c2)\n", + "c3.show('c3 = c1 + c2 =')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter complex number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imaginary part? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter complex number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imaginary part? 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c1 = 1+i 2.0\n", + "c2 = 3+i 4.0\n", + "c3 = c1 + c2 = 4+i 6.0\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-emp.cpp, Page no-279" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class employee(Structure): #structure member functions\n", + " name=str\n", + " ID=long\n", + " dept=str\n", + " salary=float\n", + " def read(self):\n", + " self.name=raw_input(\"Employee Name: \")\n", + " self.ID=long(raw_input(\"Employee ID: \"))\n", + " self.dept=raw_input(\"Department: \")\n", + " self.salary=float(raw_input(\"Salary: \"))\n", + " def show(self):\n", + " print \"Employee Name:\", self.name\n", + " print \"Employee ID:\", self.ID\n", + " print \"Department:\", self.dept\n", + " print \"Salary:\", self.salary\n", + "emp=employee()\n", + "print \"Enter employee data:\"\n", + "emp.read()\n", + "print \"\\n****Employee Record****\"\n", + "emp.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter employee data:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Employee Name: Vishwanathan\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Employee ID: 953\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Department: Finance\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Salary: 18500\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "****Employee Record****\n", + "Employee Name: Vishwanathan\n", + "Employee ID: 953\n", + "Department: Finance\n", + "Salary: 18500.0\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-union.cpp, Page no-283" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "#Creates a union\n", + "class Strings(Union):\n", + " _fields_ = [(\"filename\",c_char*200),\n", + " (\"output\", c_char*400)]\n", + "s=Strings()\n", + "s.filename=\"/cdacb/usrl/raj/oops/mcrokernel/pserver.cpp\"\n", + "print \"filename:\", s.filename\n", + "s.output=\"OOPs is a most complex entity ever created by humans\"\n", + "print \"output:\", s.output\n", + "print \"Size of union Strings =\", sizeof(Strings)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "filename: /cdacb/usrl/raj/oops/mcrokernel/pserver.cpp\n", + "output: OOPs is a most complex entity ever created by humans\n", + "Size of union Strings = 400\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sudiff.cpp, Page no-284" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from collections import namedtuple\n", + "from ctypes import *\n", + "class struct(Structure):\n", + " _fields_ = [(\"name\",c_char*25), (\"idno\", c_int), (\"salary\", c_float)]\n", + "emp=struct()\n", + "class union(Union):\n", + " _fields_ = [(\"name\",c_char*25), (\"idno\", c_int), (\"salary\", c_float)]\n", + "desc=union()\n", + "print \"The size of the structure is\", sizeof(emp)\n", + "print \"The size of the union is\", sizeof(desc)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The size of the structure is 36\n", + "The size of the union is 28\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-uaccess.cpp, Page no-285" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class emp(Union):\n", + " _fields_=[(\"name\",c_char*25), (\"idno\", c_int), (\"salary\", c_float)]\n", + "def show(e):\n", + " print \"Employee Details...\"\n", + " print \"The name is %s\" %e.name\n", + " print \"The idno is %d\" %e.idno\n", + " print \"The salary is %g\" %e.salary\n", + "e=emp()\n", + "e.name=\"Rajkumar\"\n", + "show(e)\n", + "e.idno=10\n", + "show(e)\n", + "e.salary=9000\n", + "show(e)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Employee Details...\n", + "The name is Rajkumar\n", + "The idno is 1802133842\n", + "The salary is 2.83348e+26\n", + "Employee Details...\n", + "The name is \n", + "\n", + "The idno is 10\n", + "The salary is 1.4013e-44\n", + "Employee Details...\n", + "The name is \n", + "The idno is 1175232512\n", + "The salary is 9000\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-uscope.cpp, Page no-286" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "#Creates a union\n", + "class union(Union):\n", + " _fields_ = [(\"i\", c_int), \n", + " (\"c\", c_char), \n", + " (\"f\", c_float)]\n", + "u=union()\n", + "u.i=10\n", + "u.c='9'\n", + "u.f=4.5\n", + "print \"The value of i is\", u.i\n", + "print \"The value of c is\", u.c\n", + "print \"The value of f is\", u.f" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of i is 1083179008\n", + "The value of c is \u0000\n", + "The value of f is 4.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-share.cpp, Page no-289" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from collections import namedtuple\n", + "from ctypes import *\n", + "import sys\n", + "class with_bits(Structure):\n", + " _fields_ = [(\"first\", c_uint), (\"second\", c_uint)]\n", + "class union(Union):\n", + " _fields_=[(\"b\", with_bits), (\"i\", c_int)]\n", + "i=0\n", + "u=union()\n", + "print \"On i=0: b.first =\",u.b.first,\"b.second =\", u.b.second\n", + "u.b.first=9\n", + "print \"b.first =9:\", \n", + "print \"b.first =\", u.b.first, \"b.second =\", u.b.second" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On i=0: b.first = 0 b.second = 0\n", + "b.first =9: b.first = 9 b.second = 0\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions_1.ipynb new file mode 100755 index 00000000..709caeac --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions_1.ipynb @@ -0,0 +1,1202 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:251f1d4632e149ef1bebd9159015f741bede61e517916f81edb5cc7bbd18c1c7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8-Structures and Unions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student1.cpp, Page no-260" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure\n", + "class Student(Structure): #structure\n", + " roll_no =int\n", + " name =str\n", + " branch =str\n", + " marks=int\n", + "s1=Student() #object of struct student\n", + "print \"Enter data for student...\"\n", + "s1.roll_no=int(raw_input(\"Roll Number ? \"))\n", + "s1.name=raw_input(\"Name ? \")\n", + "s1.branch=raw_input(\"Branch ? \")\n", + "s1.marks=int(raw_input(\"Total Marks ? \"))\n", + "print \"Student Report\"\n", + "print \"--------------\"\n", + "print \"Roll Number:\", s1.roll_no\n", + "print \"Name:\", s1.name\n", + "print \"Branch:\", s1.branch\n", + "print \"Percentage:%f\" %(s1.marks*(100.0/325))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Mangala\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Computer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total Marks ? 290\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Student Report\n", + "--------------\n", + "Roll Number: 5\n", + "Name: Mangala\n", + "Branch: Computer\n", + "Percentage:89.230769\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-days.cpp, Page no-262" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure, c_int\n", + "class date(Structure):\n", + " _fields_=[(\"day\", c_int),(\"month\", c_int),(\"year\",c_int)]\n", + "d1=date(14, 4, 1971)\n", + "d2=date(3, 7, 1996)\n", + "print \"Birth date:\",\n", + "print \"%s-%s-%s\" %(d1.day, d1.month, d1.year)\n", + "print \"Today date:\",\n", + "print \"%s-%s-%s\" %(d2.day, d2.month, d2.year)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth date: 14-4-1971\n", + "Today date: 3-7-1996\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student2.cpp, Page no-264" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure, c_int, c_char\n", + "class date(Structure):\n", + " _fields_=[(\"day\", c_int),(\"month\", c_int),(\"year\",c_int)]\n", + "class Student(Structure):\n", + " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"birthday\", date), (\"branch\", c_char*15),(\"marks\", c_int)]#nested structure\n", + "s1=Student()\n", + "print \"Enter data for student...\"\n", + "s1.roll_no=int(raw_input(\"Roll Number ? \"))\n", + "s1.name=raw_input(\"Name ? \")\n", + "birthday=date(0, 0, 0)\n", + "print \"Enter date of birth : \",\n", + "d, m, y=[int(x) for x in raw_input().split()]\n", + "birthday.day=d\n", + "birthday.month=m\n", + "birthday.year=y\n", + "s1.birthday=birthday\n", + "s1.branch=raw_input(\"Branch ? \")\n", + "s1.marks=int(raw_input(\"Total Marks ? \"))\n", + "print \"Student Report\"\n", + "print \"--------------\"\n", + "print \"Roll Number:\", s1.roll_no\n", + "print \"Name:\", s1.name\n", + "print \"%s-%s-%s\" %(s1.birthday.day, s1.birthday.month, s1.birthday.year)\n", + "print \"Branch:\", s1.branch\n", + "print \"Percentage:%f\" %(s1.marks*(100.0/325))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Savithri\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter date of birth : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 2 1972\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Electrical\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total Marks ? 295\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Student Report\n", + "--------------\n", + "Roll Number: 9\n", + "Name: Savithri\n", + "2-2-1972\n", + "Branch: Electrical\n", + "Percentage:90.769231\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student3.cpp, Page no-267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure, c_int, c_char\n", + "class Student(Structure):\n", + " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", + "s=[]\n", + "n=int(raw_input(\"How many students to be processed : \"))\n", + "for i in range(n):\n", + " print \"Enter data for student\", i+1, \"...\"\n", + " r=int(raw_input(\"Roll Number ? \"))\n", + " name=raw_input(\"Name ? \")\n", + " b=raw_input(\"Branch ? \")\n", + " m=int(raw_input(\"Total marks ? \"))\n", + " s.append(Student(r, name, b, m)) #array of structure objects\n", + "print \"Students Report\"\n", + "print \"--------------\"\n", + "for i in range(n):\n", + " print \"Roll Number:\", s[i].roll_no\n", + " print \"Name:\", s[i].name\n", + " print \"Branch:\", s[i].branch\n", + " print \"Percentage: %f\" %(s[i].marks*(100.0/325))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many students to be processed : 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 1 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Mangala\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Computer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 290\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 2 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Shivakumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Electronics\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 250\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Students Report\n", + "--------------\n", + "Roll Number: 5\n", + "Name: Mangala\n", + "Branch: Computer\n", + "Percentage: 89.230769\n", + "Roll Number: 9\n", + "Name: Shivakumar\n", + "Branch: Electronics\n", + "Percentage: 76.923077\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student4.cpp, Page no-269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure, c_int, c_char\n", + "class Student(Structure):\n", + " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", + "STUDENTS_COUNT=5\n", + "s=[]\n", + "s.append(Student(2, 'Tejaswi', 'CS', 285))#initialization of array of structures\n", + "s.append(Student(3, 'Laxmi', 'IT', 215))\n", + "s.append(Student(5, 'Bhavani', 'Electronics', 250))\n", + "s.append(Student(7, 'Anil', 'Civil', 215))\n", + "s.append(Student(9, 'Savithri', 'Electrical', 290))\n", + "print \"Students Report\"\n", + "print \"--------------\"\n", + "for i in range(STUDENTS_COUNT):\n", + " print \"Roll Number:\", s[i].roll_no\n", + " print \"Name:\", s[i].name\n", + " print \"Branch:\", s[i].branch\n", + " print \"Percentage: %0.4f\" %(s[i].marks*(100.0/325))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Students Report\n", + "--------------\n", + "Roll Number: 2\n", + "Name: Tejaswi\n", + "Branch: CS\n", + "Percentage: 87.6923\n", + "Roll Number: 3\n", + "Name: Laxmi\n", + "Branch: IT\n", + "Percentage: 66.1538\n", + "Roll Number: 5\n", + "Name: Bhavani\n", + "Branch: Electronics\n", + "Percentage: 76.9231\n", + "Roll Number: 7\n", + "Name: Anil\n", + "Branch: Civil\n", + "Percentage: 66.1538\n", + "Roll Number: 9\n", + "Name: Savithri\n", + "Branch: Electrical\n", + "Percentage: 89.2308\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student5.cpp, Page no-271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure, c_int, c_char\n", + "class Student(Structure):\n", + " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", + "def read():\n", + " dull=Student()\n", + " dull.roll_no=int(raw_input(\"Roll Number ? \"))\n", + " dull.name=raw_input(\"Name ? \")\n", + " dull.branch=raw_input(\"Branch ? \")\n", + " dull.marks=int(raw_input(\"Total marks ? \"))\n", + " return dull #returning structure object\n", + "def show(genius): #passing object of structure\n", + " print \"Roll Number:\", genius.roll_no\n", + " print \"Name:\", genius.name\n", + " print \"Branch:\", genius.branch\n", + " print \"Percentage: %0.4f\" %(genius.marks*(100.0/325))\n", + "s=[]\n", + "n=int(raw_input(\"How many students to be processed : \"))\n", + "for i in range(n):\n", + " print \"Enter data for student\", i+1, \"...\"\n", + " s.append(read())\n", + "print \"Students Report\"\n", + "print \"--------------\"\n", + "for i in range(n):\n", + " show(s[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many students to be processed : 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 1 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Smrithi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Genetics\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 295\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 2 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Bindhu\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? MCA\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 300\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Students Report\n", + "--------------\n", + "Roll Number: 3\n", + "Name: Smrithi\n", + "Branch: Genetics\n", + "Percentage: 90.7692\n", + "Roll Number: 10\n", + "Name: Bindhu\n", + "Branch: MCA\n", + "Percentage: 92.3077\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-student6.cpp, Page no-273" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure, c_int, c_char\n", + "class Student(Structure):\n", + " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", + "def HighestMarks(s, count): #passing array of structures\n", + " big=s[0].marks\n", + " for i in range(1, count):\n", + " if s[i].marks>big:\n", + " big=s[i].marks\n", + " index=i\n", + " return index\n", + "def read():\n", + " dull=Student()\n", + " dull.roll_no=int(raw_input(\"Roll Number ? \"))\n", + " dull.name=raw_input(\"Name ? \")\n", + " dull.branch=raw_input(\"Branch ? \")\n", + " dull.marks=int(raw_input(\"Total marks ? \"))\n", + " return dull\n", + "def show(genius):\n", + " print \"Roll Number:\", genius.roll_no\n", + " print \"Name:\", genius.name\n", + " print \"Branch:\", genius.branch\n", + " print \"Percentage: %0.4f\" %(genius.marks*(100.0/325))\n", + "s=[]\n", + "n=int(raw_input(\"How many students to be processed : \"))\n", + "for i in range(n):\n", + " print \"Enter data for student\", i+1, \"...\"\n", + " s.append(read())\n", + "print \"Students Report\"\n", + "print \"--------------\"\n", + "Id=HighestMarks(s, n)\n", + "print \"Details of student scoring higest marks...\"\n", + "show(s[Id])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many students to be processed : 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 1 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Smrithi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Genetics\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 295\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 2 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 15\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Rajkumar\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Computer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 315\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for student 3 ...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Roll Number ? 7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name ? Laxmi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Branch ? Electronics\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total marks ? 255\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Students Report\n", + "--------------\n", + "Details of student scoring higest marks...\n", + "Roll Number: 15\n", + "Name: Rajkumar\n", + "Branch: Computer\n", + "Percentage: 96.9231\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex.cpp, Page no-278" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure\n", + "import sys\n", + "import math\n", + "class Complex(Structure):\n", + " x=int\n", + " y=int\n", + " def read(self):\n", + " self.x=int(raw_input(\"Real part? \"))\n", + " self.y=int(raw_input(\"Imaginary part? \"))\n", + " def show(self, msg):\n", + " print msg, self.x,\n", + " if self.y<0:\n", + " sys.stdout.write('-i')\n", + " else:\n", + " sys.stdout.write('+i')\n", + " print math.fabs(self.y)\n", + " def add(self, c2):\n", + " self.x+=c2.x\n", + " self.y+=c2.y\n", + "c1=Complex()\n", + "c2=Complex()\n", + "c3=Complex()\n", + "print \"Enter complex number c1...\"\n", + "c1.read()\n", + "print \"Enter complex number c2...\"\n", + "c2.read()\n", + "c1.show('c1 =')\n", + "c2.show('c2 =')\n", + "c3=c1\n", + "c3.add(c2)\n", + "c3.show('c3 = c1 + c2 =')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter complex number c1...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part? 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imaginary part? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter complex number c2...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Real part? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Imaginary part? 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c1 = 1+i 2.0\n", + "c2 = 3+i 4.0\n", + "c3 = c1 + c2 = 4+i 6.0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-emp.cpp, Page no-279" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure\n", + "class employee(Structure): #structure member functions\n", + " name=str\n", + " ID=long\n", + " dept=str\n", + " salary=float\n", + " def read(self):\n", + " self.name=raw_input(\"Employee Name: \")\n", + " self.ID=long(raw_input(\"Employee ID: \"))\n", + " self.dept=raw_input(\"Department: \")\n", + " self.salary=float(raw_input(\"Salary: \"))\n", + " def show(self):\n", + " print \"Employee Name:\", self.name\n", + " print \"Employee ID:\", self.ID\n", + " print \"Department:\", self.dept\n", + " print \"Salary:\", self.salary\n", + "emp=employee()\n", + "print \"Enter employee data:\"\n", + "emp.read()\n", + "print \"\\n****Employee Record****\"\n", + "emp.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter employee data:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Employee Name: Vishwanathan\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Employee ID: 953\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Department: Finance\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Salary: 18500\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "****Employee Record****\n", + "Employee Name: Vishwanathan\n", + "Employee ID: 953\n", + "Department: Finance\n", + "Salary: 18500.0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-union.cpp, Page no-283" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Union, c_char, sizeof\n", + "#Creates a union\n", + "class Strings(Union):\n", + " _fields_ = [(\"filename\",c_char*200),\n", + " (\"output\", c_char*400)]\n", + "s=Strings()\n", + "s.filename=\"/cdacb/usrl/raj/oops/mcrokernel/pserver.cpp\"\n", + "print \"filename:\", s.filename\n", + "s.output=\"OOPs is a most complex entity ever created by humans\"\n", + "print \"output:\", s.output\n", + "print \"Size of union Strings =\", sizeof(Strings)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "filename: /cdacb/usrl/raj/oops/mcrokernel/pserver.cpp\n", + "output: OOPs is a most complex entity ever created by humans\n", + "Size of union Strings = 400\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sudiff.cpp, Page no-284" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from collections import namedtuple\n", + "from ctypes import c_char, c_int, c_float, sizeof, Structure, Union\n", + "class struct(Structure):\n", + " _fields_ = [(\"name\",c_char*25), (\"idno\", c_int), (\"salary\", c_float)]\n", + "emp=struct()\n", + "class union(Union):\n", + " _fields_ = [(\"name\",c_char*25), (\"idno\", c_int), (\"salary\", c_float)]\n", + "desc=union()\n", + "print \"The size of the structure is\", sizeof(emp)\n", + "print \"The size of the union is\", sizeof(desc)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The size of the structure is 36\n", + "The size of the union is 28\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-uaccess.cpp, Page no-285" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Union, c_int, c_char, c_float\n", + "class emp(Union):\n", + " _fields_=[(\"name\",c_char*25), (\"idno\", c_int), (\"salary\", c_float)]\n", + "def show(e):\n", + " print \"Employee Details...\"\n", + " print \"The name is %s\" %e.name\n", + " print \"The idno is %d\" %e.idno\n", + " print \"The salary is %g\" %e.salary\n", + "e=emp()\n", + "e.name=\"Rajkumar\"\n", + "show(e)\n", + "e.idno=10\n", + "show(e)\n", + "e.salary=9000\n", + "show(e)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Employee Details...\n", + "The name is Rajkumar\n", + "The idno is 1802133842\n", + "The salary is 2.83348e+26\n", + "Employee Details...\n", + "The name is \n", + "\n", + "The idno is 10\n", + "The salary is 1.4013e-44\n", + "Employee Details...\n", + "The name is \n", + "The idno is 1175232512\n", + "The salary is 9000\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-uscope.cpp, Page no-286" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Union, c_int, c_char, c_float\n", + "#Creates a union\n", + "class union(Union):\n", + " _fields_ = [(\"i\", c_int), \n", + " (\"c\", c_char), \n", + " (\"f\", c_float)]\n", + "u=union()\n", + "u.i=10\n", + "u.c='9'\n", + "u.f=4.5\n", + "print \"The value of i is\", u.i\n", + "print \"The value of c is\", u.c\n", + "print \"The value of f is\", u.f" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of i is 1083179008\n", + "The value of c is \u0000\n", + "The value of f is 4.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-share.cpp, Page no-289" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from collections import namedtuple\n", + "from ctypes import Structure, c_uint, c_int, Union\n", + "import sys\n", + "class with_bits(Structure):\n", + " _fields_ = [(\"first\", c_uint), (\"second\", c_uint)]\n", + "class union(Union):\n", + " _fields_=[(\"b\", with_bits), (\"i\", c_int)]\n", + "i=0\n", + "u=union()\n", + "print \"On i=0: b.first =\",u.b.first,\"b.second =\", u.b.second\n", + "u.b.first=9\n", + "print \"b.first =9:\", \n", + "print \"b.first =\", u.b.first, \"b.second =\", u.b.second" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On i=0: b.first = 0 b.second = 0\n", + "b.first =9: b.first = 9 b.second = 0\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding.ipynb new file mode 100755 index 00000000..e3624032 --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding.ipynb @@ -0,0 +1,1663 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:de9763f2876edfb1bdd8ccce73ff66e5216f2e4ec3f157c8b54ef1f8d480abb5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9- Pointers and Runtime Binding" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-getaddr.cpp, Page no-293" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "a=c_int(100)\n", + "b=c_int(200)\n", + "c=c_int(300)\n", + "print 'Address', hex(id(pointer(a))), 'contains value', a.value #address of a pointer\n", + "print 'Address', hex(id(pointer(b))), 'contains value', b.value\n", + "print 'Address', hex(id(pointer(c))), 'contains value', c.value" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address 0x3643348L contains value 100\n", + "Address 0x36434c8L contains value 200\n", + "Address 0x3643348L contains value 300\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-initptr.cpp, Page no-296" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "var1=c_int(10)\n", + "var2=c_int(20)\n", + "iptr=pointer(var1)\n", + "print 'Address and contents of var1 is', hex(id(iptr)), 'and', iptr[0]\n", + "iptr=pointer(var2)\n", + "print 'Address and contents of var2 is', hex(id(iptr)), 'and', iptr[0]\n", + "iptr[0]=125\n", + "var1=iptr[0]*1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address and contents of var1 is 0x36434c8L and 10\n", + "Address and contents of var2 is 0x3643648L and 20\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap.cpp, Page no-298" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "def swap(pa, pb):\n", + " temp=pa[0]\n", + " pa[0]=pb[0]\n", + " pb[0]=temp\n", + "a=float(raw_input(\"Enter real number : \"))\n", + "b=float(raw_input(\"Enter real number : \"))\n", + "a=c_float(a)\n", + "b=c_float(b)\n", + "pa=pointer(a)\n", + "pb=pointer(b)\n", + "swap(pa, pb)\n", + "print \"After swapping......\"\n", + "print \"a contains %0.1f\" %(a.value)\n", + "print \"b contains %0.1f\" %(b.value)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter real number : 10.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter real number : 20.9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "After swapping......\n", + "a contains 20.9\n", + "b contains 10.5\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-voidptr.cpp, Page no-300" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "i1=c_int(100)\n", + "f1=c_float(200.5)\n", + "vptr=pointer(i1)\n", + "print \"i1 contains\", vptr[0] #value stored in address pointed by vptr\n", + "vptr=pointer(f1)\n", + "print \"i1 contains\", vptr[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "i1 contains 100\n", + "i1 contains 200.5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ptrarr1.cpp, Page no-303" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "a=[int]\n", + "n=int(raw_input(\"Size of array? \"))\n", + "print \"Array elements ?\"\n", + "for i in range(n):\n", + " a.append(int(raw_input()))\n", + "ptr=a\n", + "small=ptr[1]\n", + "for i in range(2, n+1):\n", + " if small>ptr[i]:\n", + " small=ptr[i]\n", + " i+=1 #pointer arithmetic\n", + "print \"Smallest element is\", small" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Size of array? 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Array elements ?\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Smallest element is 1\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-newhand.cpp, Page no-305" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "size=int(raw_input(\"How many bytes to be allocated: \"))\n", + "try:\n", + " data=[int]*size\n", + " print \"Memory allocation success, address =\", hex(id(data))\n", + "except:\n", + " print \"Could not allocate. Bye...\"\n", + "del data" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many bytes to be allocated: 300\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Memory allocation success, address = 0x3716188L\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ptr2ptr.cpp, Page no-306" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "data=c_int()\n", + "iptr=pointer(data)\n", + "ptriptr=pointer(iptr) #pointer to a pointer\n", + "iptr[0]=100\n", + "print \"The variable 'data' contains\", data.value\n", + "ptriptr[0][0]=200\n", + "print \"The variable 'data' contains\", data.value\n", + "data.value=300\n", + "print \"ptriptr is pointing to\", ptriptr[0][0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The variable 'data' contains 100\n", + "The variable 'data' contains 200\n", + "ptriptr is pointing to 300\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-big.cpp, Page no-308" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "def FindBig(pa, pb, pbig):\n", + " if pa[0]>pb[0]:\n", + " pbig[0]=pa[0]\n", + " else:\n", + " pbig[0]=pb[0]\n", + " return pbig\n", + "a=c_int()\n", + "b=c_int()\n", + "big=pointer(c_int())\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers: \").split()]\n", + "pa=[a]#pointer to a\n", + "pb=[b]#pointer to b\n", + "big=FindBig(pa, pb, big)\n", + "print \"The value as obtained from the pointer:\", big[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value as obtained from the pointer: 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sortptr.cpp, Page no-309" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "def SortByPtrExchange(person, n):\n", + " for i in range(n-1):\n", + " flag=1\n", + " for j in range(n-1-i):\n", + " if person[j]>person[j+1]:\n", + " flag=0\n", + " temp=person[j]\n", + " person[j]=person[j+1]\n", + " person[j+1]=temp\n", + " if flag:\n", + " break\n", + "n=c_int(0)\n", + "choice=c_char_p()\n", + "person=[[c_char_p]*100]*40\n", + "while(1):\n", + " person[n.value]=raw_input(\"Enter name: \")\n", + " n.value+=1\n", + " choice=raw_input(\"Enter another(y/n)? \")\n", + " if choice!='y':\n", + " break\n", + "print \"Unsorted list: \"\n", + "for i in range(n.value):\n", + " print person[i]\n", + "SortByPtrExchange(person, n.value)\n", + "print \"Sorted list: \"\n", + "for i in range(n.value):\n", + " print person[i]\n", + "for i in range(n.value):\n", + " del person[i]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter another(y/n)? y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name: Prasad\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter another(y/n)? y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name: Prakash\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter another(y/n)? y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name: Sudeep\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter another(y/n)? y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name: Anand\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter another(y/n)? n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Unsorted list: \n", + "Tejaswi\n", + "Prasad\n", + "Prakash\n", + "Sudeep\n", + "Anand\n", + "Sorted list: \n", + "Anand\n", + "Prakash\n", + "Prasad\n", + "Sudeep\n", + "Tejaswi\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-show.cpp, Page no-311" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show(a, m):\n", + " c=a\n", + " for i in range(m):\n", + " for j in range(3):\n", + " print c[i][j],\n", + " print \"\"\n", + "c=[(1, 2, 3), (4, 5, 6)] #initialization of a 2D array\n", + "show(c, 2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 \n", + "4 5 6 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-matrix.cpp, Page no-313" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def MatAlloc(row, col):\n", + " p=[[int]*col]*row #dynamic array\n", + " return p\n", + "def MatRelease(p, row):\n", + " for i in range(row):\n", + " del p[i]\n", + " del p\n", + "def MatRead(a, row, col):\n", + " for i in range(row):\n", + " for j in range(col):\n", + " print \"Matrix[\", i, \",\", j, \"] = ? \",\n", + " a[i][j]=int(raw_input())\n", + "def MatMul(a, m, n, b, p, q, c):\n", + " if n!=p:\n", + " print \"Error: Invalid matrix order for multiplication\"\n", + " return\n", + " for i in range(m):\n", + " for j in range(q):\n", + " c[i][j]=0\n", + " for k in range(n):\n", + " c[i][j]+=a[i][k]*b[k][j]\n", + "def MatShow(a, row, col):\n", + " for i in range(row):\n", + " print \"\"\n", + " for j in range(col):\n", + " print a[i][j],\n", + "print \"Enter Matrix A details...\"\n", + "m=int(raw_input(\"How many rows ? \"))\n", + "n=int(raw_input(\"How many columns ? \"))\n", + "a=MatAlloc(m, n)\n", + "MatRead(a, m, n)\n", + "print \"Enter Matrix B details...\"\n", + "p=int(raw_input(\"How many rows ? \"))\n", + "q=int(raw_input(\"How many columns ? \"))\n", + "b=MatAlloc(p, q)\n", + "MatRead(b, p, q)\n", + "c=MatAlloc(m, q)\n", + "MatMul(a, m, n, b, p, q, c)\n", + "print \"Matrix C = A * B ...\",\n", + "MatShow(c, m, q)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Matrix A details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns ? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[ 0 , 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 0 , 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 2 , 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 2 , 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Matrix B details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows ? 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns ? 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[ 0 , 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 0 , 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 0 , 2 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 2 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix C = A * B ... \n", + "2 2 2 \n", + "2 2 2 \n", + "2 2 2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-3ptr.cpp, Page no-315" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "arr=[((2, 1), (3, 6), (5, 3)), ((0, 9), (2, 3), (5, 8))]\n", + "print hex(id(arr))\n", + "print hex(id(arr[0]))\n", + "print hex(id(arr[0][0]))\n", + "print arr[0][0][0]\n", + "print hex(id(arr))\n", + "print hex(id(arr[0]))\n", + "print hex(id(arr[0][1]))\n", + "print arr[0][0][0]+1\n", + "for i in range(2):\n", + " for j in range(3):\n", + " for k in range(2):\n", + " print \"arr[\",i,\"][\", j, \"][\", k, \"] = \", arr[i][j][k]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0x3729e88L\n", + "0x3652ab0L\n", + "0x364e388L\n", + "2\n", + "0x3729e88L\n", + "0x3652ab0L\n", + "0x364e6c8L\n", + "3\n", + "arr[ 0 ][ 0 ][ 0 ] = 2\n", + "arr[ 0 ][ 0 ][ 1 ] = 1\n", + "arr[ 0 ][ 1 ][ 0 ] = 3\n", + "arr[ 0 ][ 1 ][ 1 ] = 6\n", + "arr[ 0 ][ 2 ][ 0 ] = 5\n", + "arr[ 0 ][ 2 ][ 1 ] = 3\n", + "arr[ 1 ][ 0 ][ 0 ] = 0\n", + "arr[ 1 ][ 0 ][ 1 ] = 9\n", + "arr[ 1 ][ 1 ][ 0 ] = 2\n", + "arr[ 1 ][ 1 ][ 1 ] = 3\n", + "arr[ 1 ][ 2 ][ 0 ] = 5\n", + "arr[ 1 ][ 2 ][ 1 ] = 8\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ptrinc.cpp, Page no-317" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ia=[2, 5, 9]\n", + "ptr=ia\n", + "for i in range(3):\n", + " print ptr[i], \n", + " i+=1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 5 9\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-strfunc.cpp, Page no-318" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "temp=raw_input(\"Enter string1: \")\n", + "s1=temp\n", + "temp=raw_input(\"Enter string2: \")\n", + "s2=temp\n", + "print \"Length of string1:\", len(s1) #string length\n", + "s3=s1+s2 #string concatenation\n", + "print \"Strings' on concatenation:\", s3\n", + "print \"String comparison using...\"\n", + "print \"Library function:\", s1>s2 # - operator is not supppoertd with string operands in python\n", + "print \"User's function:\", s1>s2# - operator is not supppoertd with string operands in python" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string1: Object\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string2: Oriented\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Length of string1: 6\n", + "Strings' on concatenation: ObjectOriented\n", + "String comparison using...\n", + "Library function: False\n", + "User's function: False\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-rfact.cpp, Page no-322" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "def fact(num):\n", + " if num==0:\n", + " return 1\n", + " else:\n", + " return num*fact(num-1)\n", + "ptrfact={}\n", + "ptrfact[0]=fact #function pointer\n", + "n=int(raw_input(\"Enter the number whose factorial is to be found: \"))\n", + "f1=ptrfact[0](n)\n", + "print \"The factorial of\", n, \"is\", f1\n", + "print \"The factorial of\", n+1, \"is\", ptrfact[0](n+1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number whose factorial is to be found: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The factorial of 5 is 120\n", + "The factorial of 6 is 720\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-rmain.cpp, Page no-323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#this program will print hello infinite number of times\n", + "def main():\n", + " p={}\n", + " print \"Hello...\",\n", + " p[0]=main #function pointer to main()\n", + " p[0]()\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-passfn.cpp, Page no-324" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def small(a, b):\n", + " return a if ab else b\n", + "def select(fn, x, y):\n", + " value=fn(x, y)\n", + " return value\n", + "ptrf={}\n", + "m, n=[int(x) for x in raw_input(\"Enter two integers: \").split()]\n", + "high=select(large, m, n) #function as parameter\n", + "ptrf[0]=small #function pointer\n", + "low=select(ptrf[0], m, n) #pointer to function as parameter\n", + "print \"Large =\", high\n", + "print \"Small =\", low" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Large = 20\n", + "Small = 10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-bdate.cpp, Page no-326" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class date(Structure):\n", + " _fields_=[('data', c_int), ('month', c_int), ('year', c_int)]\n", + " def show(self):\n", + " print '%s-%s-%s' %(self.day, self.month, self.year)\n", + "def read(dp):\n", + " dp.day=int(raw_input(\"Enter day: \"))\n", + " dp.month=int(raw_input(\"Enter month: \"))\n", + " dp.year=int(raw_input(\"Enter year: \"))\n", + "d1=date()\n", + "dp1=POINTER(date)\n", + "dp2=POINTER(date)\n", + "print \"Enter birthday of boy...\"\n", + "read(d1)\n", + "dp2=date()\n", + "print \"Enter birthday of girl...\"\n", + "read(dp2)\n", + "print \"Birth date of boy:\",\n", + "dp1=d1\n", + "dp1.show()\n", + "print \"Birth date of girl:\",\n", + "dp2.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter birthday of boy...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter day: 14\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter month: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter year: 71\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter birthday of girl...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter day: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter month: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter year: 72\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth date of boy: 14-4-71\n", + "Birth date of girl: 1-4-72\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Eample-list.cpp, Page no-329" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import *\n", + "class LIST(Structure):\n", + " data=int\n", + " Next=None\n", + "def InsertNode(data, first):\n", + " newnode=LIST()\n", + " newnode.data=data\n", + " newnode.Next=first\n", + " return newnode\n", + "def DeleteNode(data, first):\n", + " current=LIST()\n", + " pred=LIST()\n", + " if first==None:\n", + " print \"Empty list\"\n", + " return first\n", + " pred=current=first\n", + " while(1):\n", + " if current.data==data:\n", + " if current==first:\n", + " first=current.Next\n", + " current=current.Next\n", + " else:\n", + " pred.Next=current.Next\n", + " current=current.Next\n", + " del current\n", + " return first\n", + " current=current.Next\n", + " return first\n", + "def DisplayList(first):\n", + " List=LIST()\n", + " List=first\n", + " while(1): \n", + " print \"->\", List.data,\n", + " if List.Next==None:\n", + " break\n", + " List=List.Next\n", + " print \"\"\n", + "List=LIST()\n", + "List=None\n", + "print \"Linked-list manipulation program...\"\n", + "while(1):\n", + " choice=int(raw_input(\"List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: \"))\n", + " if choice==1:\n", + " data=int(raw_input(\"Enter data for node to be created: \"))\n", + " List=InsertNode(data, List)\n", + " elif choice==2:\n", + " print \"List Contents:\",\n", + " DisplayList(List)\n", + " elif choice==3:\n", + " data=int(raw_input(\"Enter data for node to be delete: \"))\n", + " List=DeleteNode(data, List)\n", + " elif choice==4:\n", + " print \"End of Linked List Computation !!.\"\n", + " break\n", + " else:\n", + " print \"Bad Option Selected\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Linked-list manipulation program...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for node to be created: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for node to be created: 7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for node to be created: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "List Contents: -> 3 -> 7 -> 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for node to be delete: 7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "List Contents: -> 3 -> 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "End of Linked List Computation !!.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-wild1.cpp, Page no-332" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "p=[int]*10 #uninitialized integer pointer\n", + "for i in range(10):\n", + " print p[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-wild2.cpp, Page no-332" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "name=\"Savithri\"\n", + "print name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Savithri\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-wild3.cpp, Page no-333" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def nameplease():\n", + " name=\"Savithri\"\n", + " return name\n", + "def charplease():\n", + " ch='X'\n", + " return ch\n", + "p1=nameplease()\n", + "p2=charplease()\n", + "print \"Name =\", p1\n", + "print \"Char =\", p2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name = Savithri\n", + "Char = X\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-wild4.cpp, Page no-334" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "p1=str\n", + "def temp():\n", + " name=\"Savithri\"\n", + " global p1\n", + " p1=name\n", + "temp()\n", + "print \"Name =\", p1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name = Savithri\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-335" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Str=\"Programming\"\n", + "count=0\n", + "str_ptr=Str[0]\n", + "while(count+1x[i+1]:\n", + " x[i], x[i+1]=x[i+1], x[i]\n", + " i+=1\n", + " return x\n", + "SIZE=10\n", + "a=[4,59,84,35,9,17,41,19,2,21]\n", + "ptr=a\n", + "temp=ptr\n", + "print \"Given array elements:\"\n", + "for i in range(SIZE):\n", + " print temp[i],\n", + "ptr=sort(ptr)\n", + "temp=ptr\n", + "print \"\\nSorted array elemnets:\"\n", + "for i in range(SIZE):\n", + " print temp[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Given array elements:\n", + "4 59 84 35 9 17 41 19 2 21 \n", + "Sorted array elemnets:\n", + "2 4 9 17 19 21 35 41 59 84\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding_1.ipynb b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding_1.ipynb new file mode 100755 index 00000000..1e90b1ef --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding_1.ipynb @@ -0,0 +1,1661 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7b3f20284899a06912262bc6dd0b3dfa8523f3688c878e2872d6f26bdd017de9" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9- Pointers and Runtime Binding" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-getaddr.cpp, Page no-293" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import c_int, pointer\n", + "a=c_int(100)\n", + "b=c_int(200)\n", + "c=c_int(300)\n", + "print 'Address', hex(id(pointer(a))), 'contains value', a.value #address of a pointer\n", + "print 'Address', hex(id(pointer(b))), 'contains value', b.value\n", + "print 'Address', hex(id(pointer(c))), 'contains value', c.value" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address 0x3663448L contains value 100\n", + "Address 0x36633c8L contains value 200\n", + "Address 0x3663448L contains value 300\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-initptr.cpp, Page no-296" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import c_int, pointer\n", + "var1=c_int(10)\n", + "var2=c_int(20)\n", + "iptr=pointer(var1)\n", + "print 'Address and contents of var1 is', hex(id(iptr)), 'and', iptr[0]\n", + "iptr=pointer(var2)\n", + "print 'Address and contents of var2 is', hex(id(iptr)), 'and', iptr[0]\n", + "iptr[0]=125\n", + "var1=iptr[0]*1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address and contents of var1 is 0x364f248L and 10\n", + "Address and contents of var2 is 0x364f4c8L and 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-swap.cpp, Page no-298" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import c_float, pointer\n", + "def swap(pa, pb):\n", + " temp=pa[0]\n", + " pa[0]=pb[0]\n", + " pb[0]=temp\n", + "a=float(raw_input(\"Enter real number : \"))\n", + "b=float(raw_input(\"Enter real number : \"))\n", + "a=c_float(a)\n", + "b=c_float(b)\n", + "pa=pointer(a)\n", + "pb=pointer(b)\n", + "swap(pa, pb)\n", + "print \"After swapping......\"\n", + "print \"a contains %0.1f\" %(a.value)\n", + "print \"b contains %0.1f\" %(b.value)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter real number : 10.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter real number : 20.9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "After swapping......\n", + "a contains 20.9\n", + "b contains 10.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-voidptr.cpp, Page no-300" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import c_int, c_float, pointer\n", + "i1=c_int(100)\n", + "f1=c_float(200.5)\n", + "vptr=pointer(i1)\n", + "print \"i1 contains\", vptr[0] #value stored in address pointed by vptr\n", + "vptr=pointer(f1)\n", + "print \"i1 contains\", vptr[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "i1 contains 100\n", + "i1 contains 200.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ptrarr1.cpp, Page no-303" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a=[int]\n", + "n=int(raw_input(\"Size of array? \"))\n", + "print \"Array elements ?\"\n", + "for i in range(n):\n", + " a.append(int(raw_input()))\n", + "ptr=a\n", + "small=ptr[1]\n", + "for i in range(2, n+1):\n", + " if small>ptr[i]:\n", + " small=ptr[i]\n", + " i+=1 #pointer arithmetic\n", + "print \"Smallest element is\", small" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Size of array? 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Array elements ?\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Smallest element is 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-newhand.cpp, Page no-305" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "size=int(raw_input(\"How many bytes to be allocated: \"))\n", + "try:\n", + " data=[int]*size\n", + " print \"Memory allocation success, address =\", hex(id(data))\n", + "except:\n", + " print \"Could not allocate. Bye...\"\n", + "del data" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many bytes to be allocated: 300\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Memory allocation success, address = 0x3716188L\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ptr2ptr.cpp, Page no-306" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "data=c_int()\n", + "iptr=pointer(data)\n", + "ptriptr=pointer(iptr) #pointer to a pointer\n", + "iptr[0]=100\n", + "print \"The variable 'data' contains\", data.value\n", + "ptriptr[0][0]=200\n", + "print \"The variable 'data' contains\", data.value\n", + "data.value=300\n", + "print \"ptriptr is pointing to\", ptriptr[0][0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The variable 'data' contains 100\n", + "The variable 'data' contains 200\n", + "ptriptr is pointing to 300\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-big.cpp, Page no-308" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import c_int, pointer\n", + "def FindBig(pa, pb, pbig):\n", + " if pa[0]>pb[0]:\n", + " pbig[0]=pa[0]\n", + " else:\n", + " pbig[0]=pb[0]\n", + " return pbig\n", + "a=c_int()\n", + "b=c_int()\n", + "big=pointer(c_int())\n", + "a, b=[int(x) for x in raw_input(\"Enter two integers: \").split()]\n", + "pa=[a]#pointer to a\n", + "pb=[b]#pointer to b\n", + "big=FindBig(pa, pb, big)\n", + "print \"The value as obtained from the pointer:\", big[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value as obtained from the pointer: 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-sortptr.cpp, Page no-309" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import c_int, c_char_p\n", + "def SortByPtrExchange(person, n):\n", + " for i in range(n-1):\n", + " flag=1\n", + " for j in range(n-1-i):\n", + " if person[j]>person[j+1]:\n", + " flag=0\n", + " temp=person[j]\n", + " person[j]=person[j+1]\n", + " person[j+1]=temp\n", + " if flag:\n", + " break\n", + "n=c_int(0)\n", + "choice=c_char_p()\n", + "person=[[c_char_p]*100]*40\n", + "while(1):\n", + " person[n.value]=raw_input(\"Enter name: \")\n", + " n.value+=1\n", + " choice=raw_input(\"Enter another(y/n)? \")\n", + " if choice!='y':\n", + " break\n", + "print \"Unsorted list: \"\n", + "for i in range(n.value):\n", + " print person[i]\n", + "SortByPtrExchange(person, n.value)\n", + "print \"Sorted list: \"\n", + "for i in range(n.value):\n", + " print person[i]\n", + "for i in range(n.value):\n", + " del person[i]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name: Tejaswi\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter another(y/n)? y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name: Prasad\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter another(y/n)? y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name: Prakash\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter another(y/n)? y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name: Sudeep\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter another(y/n)? y\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name: Anand\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter another(y/n)? n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Unsorted list: \n", + "Tejaswi\n", + "Prasad\n", + "Prakash\n", + "Sudeep\n", + "Anand\n", + "Sorted list: \n", + "Anand\n", + "Prakash\n", + "Prasad\n", + "Sudeep\n", + "Tejaswi\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-show.cpp, Page no-311" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show(a, m):\n", + " c=a\n", + " for i in range(m):\n", + " for j in range(3):\n", + " print c[i][j],\n", + " print \"\"\n", + "c=[(1, 2, 3), (4, 5, 6)] #initialization of a 2D array\n", + "show(c, 2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 \n", + "4 5 6 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-matrix.cpp, Page no-313" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def MatAlloc(row, col):\n", + " p=[[int]*col]*row #dynamic array\n", + " return p\n", + "def MatRelease(p, row):\n", + " for i in range(row):\n", + " del p[i]\n", + " del p\n", + "def MatRead(a, row, col):\n", + " for i in range(row):\n", + " for j in range(col):\n", + " print \"Matrix[\", i, \",\", j, \"] = ? \",\n", + " a[i][j]=int(raw_input())\n", + "def MatMul(a, m, n, b, p, q, c):\n", + " if n!=p:\n", + " print \"Error: Invalid matrix order for multiplication\"\n", + " return\n", + " for i in range(m):\n", + " for j in range(q):\n", + " c[i][j]=0\n", + " for k in range(n):\n", + " c[i][j]+=a[i][k]*b[k][j]\n", + "def MatShow(a, row, col):\n", + " for i in range(row):\n", + " print \"\"\n", + " for j in range(col):\n", + " print a[i][j],\n", + "print \"Enter Matrix A details...\"\n", + "m=int(raw_input(\"How many rows ? \"))\n", + "n=int(raw_input(\"How many columns ? \"))\n", + "a=MatAlloc(m, n)\n", + "MatRead(a, m, n)\n", + "print \"Enter Matrix B details...\"\n", + "p=int(raw_input(\"How many rows ? \"))\n", + "q=int(raw_input(\"How many columns ? \"))\n", + "b=MatAlloc(p, q)\n", + "MatRead(b, p, q)\n", + "c=MatAlloc(m, q)\n", + "MatMul(a, m, n, b, p, q, c)\n", + "print \"Matrix C = A * B ...\",\n", + "MatShow(c, m, q)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Matrix A details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows ? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns ? 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[ 0 , 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 0 , 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 2 , 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 2 , 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Matrix B details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows ? 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns ? 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[ 0 , 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 0 , 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 0 , 2 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 0 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 1 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 2 ] = ? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix C = A * B ... \n", + "2 2 2 \n", + "2 2 2 \n", + "2 2 2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-3ptr.cpp, Page no-315" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "arr=[((2, 1), (3, 6), (5, 3)), ((0, 9), (2, 3), (5, 8))]\n", + "print hex(id(arr))\n", + "print hex(id(arr[0]))\n", + "print hex(id(arr[0][0]))\n", + "print arr[0][0][0]\n", + "print hex(id(arr))\n", + "print hex(id(arr[0]))\n", + "print hex(id(arr[0][1]))\n", + "print arr[0][0][0]+1\n", + "for i in range(2):\n", + " for j in range(3):\n", + " for k in range(2):\n", + " print \"arr[\",i,\"][\", j, \"][\", k, \"] = \", arr[i][j][k]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0x3729e88L\n", + "0x3652ab0L\n", + "0x364e388L\n", + "2\n", + "0x3729e88L\n", + "0x3652ab0L\n", + "0x364e6c8L\n", + "3\n", + "arr[ 0 ][ 0 ][ 0 ] = 2\n", + "arr[ 0 ][ 0 ][ 1 ] = 1\n", + "arr[ 0 ][ 1 ][ 0 ] = 3\n", + "arr[ 0 ][ 1 ][ 1 ] = 6\n", + "arr[ 0 ][ 2 ][ 0 ] = 5\n", + "arr[ 0 ][ 2 ][ 1 ] = 3\n", + "arr[ 1 ][ 0 ][ 0 ] = 0\n", + "arr[ 1 ][ 0 ][ 1 ] = 9\n", + "arr[ 1 ][ 1 ][ 0 ] = 2\n", + "arr[ 1 ][ 1 ][ 1 ] = 3\n", + "arr[ 1 ][ 2 ][ 0 ] = 5\n", + "arr[ 1 ][ 2 ][ 1 ] = 8\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-ptrinc.cpp, Page no-317" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ia=[2, 5, 9]\n", + "ptr=ia\n", + "for i in range(3):\n", + " print ptr[i], \n", + " i+=1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 5 9\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-strfunc.cpp, Page no-318" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "temp=raw_input(\"Enter string1: \")\n", + "s1=temp\n", + "temp=raw_input(\"Enter string2: \")\n", + "s2=temp\n", + "print \"Length of string1:\", len(s1) #string length\n", + "s3=s1+s2 #string concatenation\n", + "print \"Strings' on concatenation:\", s3\n", + "print \"String comparison using...\"\n", + "print \"Library function:\", s1>s2 # - operator is not supppoertd with string operands in python\n", + "print \"User's function:\", s1>s2# - operator is not supppoertd with string operands in python" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string1: Object\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string2: Oriented\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Length of string1: 6\n", + "Strings' on concatenation: ObjectOriented\n", + "String comparison using...\n", + "Library function: False\n", + "User's function: False\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-rfact.cpp, Page no-322" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def fact(num):\n", + " if num==0:\n", + " return 1\n", + " else:\n", + " return num*fact(num-1)\n", + "ptrfact={}\n", + "ptrfact[0]=fact #function pointer\n", + "n=int(raw_input(\"Enter the number whose factorial is to be found: \"))\n", + "f1=ptrfact[0](n)\n", + "print \"The factorial of\", n, \"is\", f1\n", + "print \"The factorial of\", n+1, \"is\", ptrfact[0](n+1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number whose factorial is to be found: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The factorial of 5 is 120\n", + "The factorial of 6 is 720\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-rmain.cpp, Page no-323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#this program will print hello infinite number of times\n", + "def main():\n", + " p={}\n", + " print \"Hello...\",\n", + " p[0]=main #function pointer to main()\n", + " p[0]()\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-passfn.cpp, Page no-324" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def small(a, b):\n", + " return a if ab else b\n", + "def select(fn, x, y):\n", + " value=fn(x, y)\n", + " return value\n", + "ptrf={}\n", + "m, n=[int(x) for x in raw_input(\"Enter two integers: \").split()]\n", + "high=select(large, m, n) #function as parameter\n", + "ptrf[0]=small #function pointer\n", + "low=select(ptrf[0], m, n) #pointer to function as parameter\n", + "print \"Large =\", high\n", + "print \"Small =\", low" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: 10 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Large = 20\n", + "Small = 10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-bdate.cpp, Page no-326" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure, c_int, POINTER\n", + "class date(Structure):\n", + " _fields_=[('data', c_int), ('month', c_int), ('year', c_int)]\n", + " def show(self):\n", + " print '%s-%s-%s' %(self.day, self.month, self.year)\n", + "def read(dp):\n", + " dp.day=int(raw_input(\"Enter day: \"))\n", + " dp.month=int(raw_input(\"Enter month: \"))\n", + " dp.year=int(raw_input(\"Enter year: \"))\n", + "d1=date()\n", + "dp1=POINTER(date)\n", + "dp2=POINTER(date)\n", + "print \"Enter birthday of boy...\"\n", + "read(d1)\n", + "dp2=date()\n", + "print \"Enter birthday of girl...\"\n", + "read(dp2)\n", + "print \"Birth date of boy:\",\n", + "dp1=d1\n", + "dp1.show()\n", + "print \"Birth date of girl:\",\n", + "dp2.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter birthday of boy...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter day: 14\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter month: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter year: 71\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter birthday of girl...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter day: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter month: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter year: 72\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Birth date of boy: 14-4-71\n", + "Birth date of girl: 1-4-72\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-list.cpp, Page no-329" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import Structure\n", + "class LIST(Structure):\n", + " data=int\n", + " Next=None\n", + "def InsertNode(data, first):\n", + " newnode=LIST()\n", + " newnode.data=data\n", + " newnode.Next=first\n", + " return newnode\n", + "def DeleteNode(data, first):\n", + " current=LIST()\n", + " pred=LIST()\n", + " if first==None:\n", + " print \"Empty list\"\n", + " return first\n", + " pred=current=first\n", + " while(1):\n", + " if current.data==data:\n", + " if current==first:\n", + " first=current.Next\n", + " current=current.Next\n", + " else:\n", + " pred.Next=current.Next\n", + " current=current.Next\n", + " del current\n", + " return first\n", + " current=current.Next\n", + " return first\n", + "def DisplayList(first):\n", + " List=LIST()\n", + " List=first\n", + " while(1): \n", + " print \"->\", List.data,\n", + " if List.Next==None:\n", + " break\n", + " List=List.Next\n", + " print \"\"\n", + "List=LIST()\n", + "List=None\n", + "print \"Linked-list manipulation program...\"\n", + "while(1):\n", + " choice=int(raw_input(\"List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: \"))\n", + " if choice==1:\n", + " data=int(raw_input(\"Enter data for node to be created: \"))\n", + " List=InsertNode(data, List)\n", + " elif choice==2:\n", + " print \"List Contents:\",\n", + " DisplayList(List)\n", + " elif choice==3:\n", + " data=int(raw_input(\"Enter data for node to be delete: \"))\n", + " List=DeleteNode(data, List)\n", + " elif choice==4:\n", + " print \"End of Linked List Computation !!.\"\n", + " break\n", + " else:\n", + " print \"Bad Option Selected\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Linked-list manipulation program...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for node to be created: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for node to be created: 7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for node to be created: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "List Contents: -> 3 -> 7 -> 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter data for node to be delete: 7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "List Contents: -> 3 -> 5 \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "End of Linked List Computation !!.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-wild1.cpp, Page no-332" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "p=[int]*10 #uninitialized integer pointer\n", + "for i in range(10):\n", + " print p[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-wild2.cpp, Page no-332" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "name=\"Savithri\"\n", + "print name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Savithri\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-wild3.cpp, Page no-333" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def nameplease():\n", + " name=\"Savithri\"\n", + " return name\n", + "def charplease():\n", + " ch='X'\n", + " return ch\n", + "p1=nameplease()\n", + "p2=charplease()\n", + "print \"Name =\", p1\n", + "print \"Char =\", p2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name = Savithri\n", + "Char = X\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-wild4.cpp, Page no-334" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "p1=str\n", + "def temp():\n", + " name=\"Savithri\"\n", + " global p1\n", + " p1=name\n", + "temp()\n", + "print \"Name =\", p1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name = Savithri\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-1, Page no-335" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Str=\"Programming\"\n", + "count=0\n", + "str_ptr=Str[0]\n", + "while(count+1x[i+1]:\n", + " x[i], x[i+1]=x[i+1], x[i]\n", + " i+=1\n", + " return x\n", + "SIZE=10\n", + "a=[4,59,84,35,9,17,41,19,2,21]\n", + "ptr=a\n", + "temp=ptr\n", + "print \"Given array elements:\"\n", + "for i in range(SIZE):\n", + " print temp[i],\n", + "ptr=sort(ptr)\n", + "temp=ptr\n", + "print \"\\nSorted array elemnets:\"\n", + "for i in range(SIZE):\n", + " print temp[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Given array elements:\n", + "4 59 84 35 9 17 41 19 2 21 \n", + "Sorted array elemnets:\n", + "2 4 9 17 19 21 35 41 59 84\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/README.txt b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/README.txt new file mode 100755 index 00000000..3c39544d --- /dev/null +++ b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/README.txt @@ -0,0 +1,10 @@ +Contributed By: Sruti Goyal +Course: btech +College/Institute/Organization: National Institute of Technology Meghalaya +Department/Designation: Computer Science and Engineering +Book Title: Mastering C++ +Author: K R Venugopal and Rajkumar Buyya +Publisher: McGraw Hill Education (India) Private Limited , India +Year of publication: 2013 +Isbn: 9781259029943 +Edition: 2nd Edition \ No newline at end of file diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/1.png b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/1.png new file mode 100755 index 00000000..df574903 Binary files /dev/null and b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/1.png differ diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/2.png b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/2.png new file mode 100755 index 00000000..4a37be2b Binary files /dev/null and b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/2.png differ diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/3.png b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/3.png new file mode 100755 index 00000000..8e1713ff Binary files /dev/null and b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/3.png differ diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150614-WA0001.png b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150614-WA0001.png new file mode 100755 index 00000000..469c12fc Binary files /dev/null and b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150614-WA0001.png differ diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150614-WA0006.png b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150614-WA0006.png new file mode 100755 index 00000000..00aa17a6 Binary files /dev/null and b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150614-WA0006.png differ diff --git a/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150619-WA0002.png b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150619-WA0002.png new file mode 100755 index 00000000..fc13fe9c Binary files /dev/null and b/Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/screenshots/IMG-20150619-WA0002.png differ diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/Chapter01-Fiber_Optics_Communications_System.ipynb b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter01-Fiber_Optics_Communications_System.ipynb new file mode 100755 index 00000000..ec323da9 --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter01-Fiber_Optics_Communications_System.ipynb @@ -0,0 +1,1240 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:742c44cb267900361b88ee7b473acd2b1b40f32a4db7e15db6918955b1159df0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter01:Fiber Optics Communications System" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "\n", + "Ex1.7.1:Pg-1.14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "n1= 1.5 # for glass\n", + "n2= 1.33 # for water\n", + "phi1= (math.pi/6) # phi1 is the angel of incidence\n", + " # According to Snell's law...\n", + " # n1*sin(phi1)= n2*sin(phi2) \n", + "sinphi2= (n1/n2)*math.sin(phi1) # phi2 is the angle of refraction..\n", + "phi2 = math.asin(sinphi2)\n", + "temp= math.degrees(phi2)\n", + "print \" The angel of refraction in degrees =\",round(temp,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The angel of refraction in degrees = 34.33\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.7.2:Pg-1.14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "n1= 1.50 # RI of glass..\n", + "n2 = 1.0 # RI of air...\n", + " # According to Snell's law...\n", + " # n1*sin(phi1)= n2*sin(phi2) \n", + " # From definition of critical angel phi2 = 90 degrees and phi1 will be critical angel\n", + "t1=(n2/n1)*math.sin(math.pi/2)\n", + "phiC=math.asin(t1)\n", + "temp= math.degrees(phiC)\n", + "print \" The Critical angel in degrees =\",round(temp,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Critical angel in degrees = 41.81\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.7.3:Pg-1.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + " # To find RI of glass\n", + " # To find the critical angle for glass...\n", + " \n", + "phi1 = 33 # Angle of incidence..\n", + "phi2 = 90 # Angle of refraction..\n", + "n2= 1.0 \n", + "\n", + "n1 = round(sin(math.radians(phi2))/sin(math.radians(phi1)),3) \n", + "print \" The Refractive Index is =\",n1 \n", + "\n", + "#phiC = math.asin((n2/n1)*math.sin(90)) \n", + "phiC=math.asin(0.54)\n", + "print \" \\n\\nThe Critical angel in degrees =\",round(math.degrees(phiC),2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Refractive Index is = 1.836\n", + " \n", + "\n", + "The Critical angel in degrees = 32.68\n" + ] + } + ], + "prompt_number": 81 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.7.4:Pg-1.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + "import math\n", + " \n", + "n1= 1.5 # TheRi of medium 1\n", + "n2= 1.36 # the RI of medium 2\n", + "phi1= 30 # The angle of incidence\n", + " # According to Snell's law...\n", + " # n1*sin(phi1)= n2*sin(phi2) \n", + "phi2 = math.asin((n1/n2)*math.sin(math.radians(phi1))) \n", + "print \" The angel of refraction is in degrees from normal = \",round(math.degrees(phi2),2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The angel of refraction is in degrees from normal = 33.47\n" + ] + } + ], + "prompt_number": 91 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.7.5:Pg-1.16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + " \n", + "n1 = 3.6 # RI of GaAs..\n", + "n2 = 3.4 # RI of AlGaAs..\n", + "phi1 = 80 # Angle of Incidence..\n", + " # According to Snell's law...\n", + " # n1*sin(phi1)= n2*sin(phi2) \n", + " # At critical angle phi2 = 90...\n", + "phiC = math.asin((n2/n1)*sin(math.radians(90)) )\n", + "print \" The Critical angel in degrees =\",round(math.degrees(phiC),2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Critical angel in degrees = 70.81\n" + ] + } + ], + "prompt_number": 97 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.1:Pg-1.22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math \n", + "\n", + "n1= 1.5 # RI of medium 1\n", + "n2 =1.45 # RI of medium 2\n", + "\n", + "delt= (n1-n2)/n1 \n", + "NA = n1*(math.sqrt(2*delt)) \n", + "print \" The Numerical aperture =\",round(NA,2)\n", + "phiA = math.asin(NA) \n", + "print \" \\n\\nThe Acceptance angel in degrees =\",round(math.degrees(phiA),2) \n", + "\n", + "phiC = math.asin(n2/n1) \n", + "print \" \\n\\nThe Critical angel in degrees =\",round(degrees(phiC),2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical aperture = 0.39\n", + " \n", + "\n", + "The Acceptance angel in degrees = 22.79\n", + " \n", + "\n", + "The Critical angel in degrees = 75.16\n" + ] + } + ], + "prompt_number": 100 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.2:Pg-1.23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "n1= 1.5 # RI of core\n", + "n2 = 1.48 # RI of cladding..\n", + "\n", + "NA = math.sqrt((n1**2)-(n2**2)) \n", + "print \" The Numerical Aperture =\",round(NA,2) \n", + "\n", + "phiA = math.asin(NA) \n", + "print \" \\n\\nThe Critical angel =\",round(math.degrees(phiA),2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture = 0.24\n", + " \n", + "\n", + "The Critical angel = 14.13\n" + ] + } + ], + "prompt_number": 101 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.3:Pg-1.23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math \n", + " \n", + "\n", + "NA = 0.35 # Numerical Aperture\n", + "delt = 0.01 \n", + " # NA= n1*(math.sqrt(2*delt) n1 is RI of core\n", + "n1 = 0.35/(math.sqrt(2*delt)) \n", + "print \"The RI of core =\",round(n1,4) \n", + "\n", + " # Numerical Aperture is also given by \n", + " # NA = math.sqrt(n1**2 - n2**2) # n2 is RI of cladding\n", + "n2 = math.sqrt((n1**2-NA**2)) \n", + "print \" \\n\\nThe RI of Cladding =\",round(n2,3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The RI of core = 2.4749\n", + " \n", + "\n", + "The RI of Cladding = 2.45\n" + ] + } + ], + "prompt_number": 104 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.4:Pg-1.24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "Vc = 2.01*10**8 # velocity of light in core in m/sec...\n", + "phiC= 80.0 # Critical angle in degrees...\n", + "\n", + " # RI of Core (n1) is given by (Velocity of light in air/ velocity of light in air)...\n", + "n1= 3*10**8/Vc \n", + " # From critical angle and the value of n1 we calculate n2...\n", + "n2 = sin(math.radians(phiC))*n1 # RI of cladding...\n", + "NA = math.sqrt(n1**2-n2**2) \n", + "print \" The Numerical Aperture =\",round(NA,2) \n", + "phiA = math.asin(NA) # Acceptance angle...\n", + "print \" \\n\\nThe Acceptance angel in degrees =\",round(math.degrees(phiA),2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture = 0.26\n", + " \n", + "\n", + "The Acceptance angel in degrees = 15.02\n" + ] + } + ], + "prompt_number": 106 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.5:Pg-1.25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "n1 = 1.4 # RI of Core..\n", + "n2 = 1.35 # RI of Cladding\n", + "\n", + "phiC = math.asin(n2/n1) # Critical angle..\n", + "print \" The Critical angel in degrees =\",round(math.degrees(phiC),2) \n", + "\n", + "NA = math.sqrt(n1**2-n2**2) # numerical Aperture...\n", + "print \" \\n\\nThe Numerical Aperture is =\",round(NA,2) \n", + "\n", + "phiA = math.asin(NA) # Acceptance angle... \n", + "print \" \\n\\nThe Acceptance angel in degrees =\",round(math.degrees(phiA),2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Critical angel in degrees = 74.64\n", + " \n", + "\n", + "The Numerical Aperture is = 0.37\n", + " \n", + "\n", + "The Acceptance angel in degrees = 21.77\n" + ] + } + ], + "prompt_number": 107 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.6:Pg-1.25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "n1 = 1.48 # RI of core..\n", + "n2 = 1.46 # RI of Cladding..\n", + "\n", + "NA = math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", + "print \" The Numerical Aperture is =\",round(NA,3) \n", + "\n", + "theta = math.pi*NA**2 # The entrance angle theta..\n", + "print \" \\n\\nThe Entrance angel in degrees =\",round(theta,3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture is = 0.242\n", + " \n", + "\n", + "The Entrance angel in degrees = 0.185\n" + ] + } + ], + "prompt_number": 110 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.7:Pg-1.26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math \n", + "\n", + "delt = 0.007 # relative refractive index difference \n", + "n1 = 1.45 # RI of core...\n", + "NA = n1* math.sqrt((2*delt)) \n", + "print \" The Numerical Aperture is =\",round(NA,4) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture is = 0.1716\n" + ] + } + ], + "prompt_number": 112 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.8:Pg-1.26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + "import math\n", + "\n", + "phiA = 8 # accepatance angle in degrees...\n", + "n1 =1.52 # RI of core...\n", + "\n", + "NA = sin(math.radians(phiA)) # Numerical Aperture...\n", + "\n", + "delt = NA**2/(2*(n1**2)) # Relative RI difference...\n", + "print \" The relative refractive index difference =\",round(delt,5) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The relative refractive index difference = 0.00419\n" + ] + } + ], + "prompt_number": 114 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "\n", + "Ex1.9.9:Pg-1.27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "delt = 0.01 # relative RI difference..\n", + "n1 = 1.48 # RI of core...\n", + "\n", + "NA = n1*(math.sqrt(2*delt)) # Numerical Aperture..\n", + "print \" The Numerical Aperture =\",round(NA,3) \n", + "\n", + "theta = math.pi*NA**2 # Solid Acceptance angle...\n", + "print \" \\n\\nThe Solid Acceptance angel in degrees =\",round(theta,4) \n", + "\n", + "n2 = (1-delt)*n1 \n", + "phiC = math.asin(n2/n1) # Critical Angle...\n", + "print \" \\n\\nThe Critical angel in degrees =\",round(math.degrees(phiC),2) \n", + "print \" \\n\\nCritical angle wrong due to rounding off errors in trignometric functions..\\n Actual value is 90.98 in book.\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture = 0.209\n", + " \n", + "\n", + "The Solid Acceptance angel in degrees = 0.1376\n", + " \n", + "\n", + "The Critical angel in degrees = 81.89\n", + " \n", + "\n", + "Critical angle wrong due to rounding off errors in trignometric functions..\n", + " Actual value is 90.98 in book.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.1:Pg-1.41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "d = 50*10**-6 # diameter of fibre...\n", + "n1 = 1.48 # RI of core..\n", + "n2 = 1.46 # RI of cladding..\n", + "lamda = 0.82*10**-6 # wavelength of light..\n", + "\n", + "NA = math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", + "Vn= math.pi*d*NA/lamda # normalised frequency...\n", + "M = Vn**2/2 # number of modes...\n", + "print \" The number of modes in the fibre are =\",int(M) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number of modes in the fibre are = 1078\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.2:Pg-1.42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + " \n", + " \n", + "V = 26.6 # Normalised frequency..\n", + "lamda = 1300*10**-9 # wavelenght of operation\n", + "a = 25*10**-6 # radius of fibre.\n", + "NA = V*lamda/(2*math.pi*a) # Numerical Aperture..\n", + "print \" The Numerical Aperture =\",round(NA,3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture = 0.22\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.3:Pg-1.43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + " \n", + "a = 40*10**-6 # radius of core...\n", + "delt = 0.015 # relative RI difference..\n", + "lamda= 0.85*10**-6 # wavelength of operation..\n", + "n1=1.48 # RI of core..\n", + "\n", + "NA = n1*math.sqrt(2*delt) # Numerical Aperture..\n", + "print \" The Numerical Aperture =\", round(NA,4) \n", + "V = 2*math.pi*a*NA/lamda # normalised frequency\n", + "print \" \\n\\nThe Normalised frequency =\",round(V,2) \n", + "\n", + "M = V**2/2 # number of modes..\n", + "print \" \\n\\nThe number of modes in the fibre are =\",int(M) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture = 0.2563\n", + " \n", + "\n", + "The Normalised frequency = 75.8\n", + " \n", + "\n", + "The number of modes in the fibre are = 2872\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.4:Pg-1.43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "NA = 0.20 # Numerical Aperture..\n", + "M = 1000 # number of modes..\n", + "lamda = 850*10**-9 # wavelength of operation..\n", + "\n", + "a = math.sqrt(M*2*lamda**2/(math.pi**2*NA**2)) # radius of core..\n", + "a=a*10**6 # converting in um for displaying...\n", + "print \" The radius of the core in um =\",round(a,2) \n", + "a=a*10**-6 \n", + "M1= ((math.pi*a*NA/(1320*10**-9))**2)/2\n", + "print \" \\n\\nThe number of modes in the fibre at 1320um =\",int(M1) \n", + "print \" \\n\\n***The number of modes in the fibre at 1320um is calculated wrongly in book\" \n", + "M2= ((math.pi*a*NA/(1550*10**-9))**2)/2\n", + "print \" \\n\\nThe number of modes in the fibre at 1550um =\",int(M2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The radius of the core in um = 60.5\n", + " \n", + "\n", + "The number of modes in the fibre at 1320um = 414\n", + " \n", + "\n", + "***The number of modes in the fibre at 1320um is calculated wrongly in book\n", + " \n", + "\n", + "The number of modes in the fibre at 1550um = 300\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.5:Pg-1.44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + " \n", + "NA = 0.2 # Numerical Aperture..\n", + "n2= 1.59 # RI of cladding..\n", + "n0= 1.33 # RI of water..\n", + "lamda = 1300*10**-9 # wavelength..\n", + "a = 25*10**-6 # radius of core..\n", + "n1 = math.sqrt(NA**2+n2**2) # RI of core..\n", + "phiA= math.asin(math.sqrt(n1**2-n2**2)/n0) # Acceptance angle..\n", + "print \" The Acceptance angle is =\",round(math.degrees(phiA),2) \n", + "\n", + "phiC= math.asin(n2/n1) # Critical angle..\n", + "print \" \\n\\nThe critical angle is =\",round(math.degrees(phiC),2) \n", + "V = 2*math.pi*a*NA/lamda # normalisd frequency\n", + "M= V**2/2 # number of modes\n", + "print \" \\n\\nThe number of modes in the fibre are =\",int(M) \n", + "\n", + "print \" \\n\\n***The value of the angle differ from the book because of round off errors.\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Acceptance angle is = 8.65\n", + " \n", + "\n", + "The critical angle is = 82.83\n", + " \n", + "\n", + "The number of modes in the fibre are = 292\n", + " \n", + "\n", + "***The value of the angle differ from the book because of round off errors.\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.6:Pg-1.46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "V= 26.6 # Normalised frequency..\n", + "lamda= 1300*10**-9 # wavelength of operation..\n", + "a= 25*10**-6 # radius of core..\n", + "\n", + "NA = V*lamda/(2*math.pi*a) # Numerical Aperture..\n", + "print \" The Numerical Aperture =\",round(NA,2) \n", + "theta = math.pi*NA**2 # solid Acceptance Angle..\n", + "print \" \\n\\nThe solid acceptance angle in radians =\",round(theta,3) \n", + "\n", + "M= V**2/2 # number of modes..\n", + "print \" \\n\\nThe number of modes in the fibre =\",round(M,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture = 0.22\n", + " \n", + "\n", + "The solid acceptance angle in radians = 0.152\n", + " \n", + "\n", + "The number of modes in the fibre = 353.78\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.7:Pg-1.47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math \n", + "\n", + "n1= 1.49 # RI of core.\n", + "n2=1.47 # RI of cladding..\n", + "a= 2 # radius of core in um..\n", + "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", + " # The maximum V number for single mode operation is 2.4...\n", + "V= 2.4 # Normalised frequency..\n", + "\n", + "lamda = 2*math.pi*a*NA/V # Cutoff wavelength...\n", + "print \" The cutoff wavelength in um =\",round(lamda,2) \n", + "\n", + "\n", + "lamda1 = 1.310 # Givenn cutoff wavelength in um..\n", + "d= V*lamda1/(math.pi*NA) # core diameter..\n", + "print \" \\n\\nThe core diameter in um =\",round(d,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The cutoff wavelength in um = 1.27\n", + " \n", + "\n", + "The core diameter in um = 4.11\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.8:Pg-1.47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + "import math\n", + " \n", + "n1= 1.48 # RI of core..\n", + "a= 4.5 # core radius in um..\n", + "delt= 0.0025 # Relative RI difference..\n", + "V= 2.405 # For step index fibre..\n", + "lamda= (2*math.pi*a*n1*math.sqrt(2*delt))/V # cutoff wavelength..\n", + "print \" The cutoff wavelength in um =\",round(lamda,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The cutoff wavelength in um = 1.23\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.9:Pg-1.48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math \n", + " \n", + "lamda= 0.82*10**-6 # wavelength ofoperation.\n", + "a= 2.5*10**-6 # Radius of core..\n", + "n1= 1.48 # RI of core..\n", + "n2= 1.46 # RI of cladding\n", + "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", + "V= 2*math.pi*a*NA/lamda # Normalisd frequency..\n", + "print \" The normalised frequency =\",round(V,3) \n", + "M= V**2/2 # The number of modes..\n", + "print \" \\n\\nThe number of modes in the fibre are =\",round(M,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The normalised frequency = 4.645\n", + " \n", + "\n", + "The number of modes in the fibre are = 10.79\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.10:Pg-1.49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + "import math\n", + " \n", + "delt= 0.01 # Relative RI difference..\n", + "n1= 1.5 \n", + "M= 1100 # Number of modes...\n", + "lamda= 1.3 # wavelength of operation in um..\n", + "V= math.sqrt(2*M) # Normalised frequency...\n", + "d= V*lamda/(math.pi*n1*math.sqrt(2*delt)) # diameter of core..\n", + "print \" The diameter of the core in um =\",round(d,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The diameter of the core in um = 91.5\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.11:Pg-1.50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "n1= 1.5 # RI of core..\n", + "n2= 1.38 # RI of cladding..\n", + "a= 25*10**-6 # radius of core..\n", + "lamda= 1300*10**-9 # wavelength of operation...\n", + "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", + "print \" The Numerical Aperture of the given fibre =\",round(NA,4) \n", + "V= 2*math.pi*a*NA/lamda # Normalised frequency..\n", + "print \" \\n\\nThe normalised frequency =\",round(V,2) \n", + "theta= math.asin(NA) # Solid acceptance anglr..\n", + "print \" \\n\\nThe Solid acceptance angle in degrees =\",int(math.degrees(theta)) \n", + "M= V**2/2 # Number of modes..\n", + "print \" \\n\\nThe number of modes in the fibre are =\",int(M) \n", + "print \" \\n\\n***Number of modes wrongly calculated in the book..\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture of the given fibre = 0.5879\n", + " \n", + "\n", + "The normalised frequency = 71.03\n", + " \n", + "\n", + "The Solid acceptance angle in degrees = 36\n", + " \n", + "\n", + "The number of modes in the fibre are = 2522\n", + " \n", + "\n", + "***Number of modes wrongly calculated in the book..\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.12:Pg-1.51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "lamda= 850*10**-9 # wavelength of operation.\n", + "a= 25*10**-6 # Radius of core\n", + "n1= 1.48 # RI of Core...\n", + "n2= 1.46 # RI of cladding..\n", + "\n", + "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture\n", + "\n", + "V= 2*math.pi*a*NA/lamda # Normalised frequency..\n", + "print \" The normalised frequency =\",round(V,2) \n", + "\n", + "lamda1= 1320*10**-9 # wavelength changed...\n", + "V1= 2*math.pi*a*NA/lamda1 # Normalised frequency at new wavelength..\n", + "\n", + "M= V1**2/2 # Number of modes at new wavelength..\n", + "print \" \\n\\nThe number of modes in the fibre at 1320um =\",int(M) \n", + "lamda2= 1550*10**-9 # wavelength 2...\n", + "V2= 2*math.pi*a*NA/lamda2 # New normalised frequency..\n", + "M1= V2**2/2 # number of modes..\n", + "print \" \\n\\nThe number of modes in the fibre at 1550um =\",int(M1 )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The normalised frequency = 44.81\n", + " \n", + "\n", + "The number of modes in the fibre at 1320um = 416\n", + " \n", + "\n", + "The number of modes in the fibre at 1550um = 301\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.15.1:Pg-1.56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + " \n", + "n1= 1.48 # RI of core..\n", + "delt= 0.015 # relative RI differencr..\n", + "lamda= 0.85 # wavelength of operation..\n", + "V= 2.4 # for single mode of operation..\n", + "\n", + "a= V*lamda/(2*math.pi*n1*math.sqrt(2*delt)) # radius of core..\n", + "print \" The raduis of core in um =\",round(a,2) \n", + "print \" \\n\\nThe maximum possible core diameter in um =\",round(2*a,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The raduis of core in um = 1.27\n", + " \n", + "\n", + "The maximum possible core diameter in um = 2.53\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.15.2:Pg-1.56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + "import math\n", + " \n", + "n1= 1.5 # RI of core..\n", + "delt= 0.01 # Relative RI difference...\n", + "lamda= 1.3 # Wavelength of operation...\n", + "V= 2.4*math.sqrt(2) # Maximum value of V for GRIN...\n", + "a= V*lamda/(2*math.pi*n1*math.sqrt(2*delt)) # radius of core..\n", + "print \" The radius of core in um =\",round(a,2) \n", + "print \" \\n\\nThe maximum possible core diameter in um =\",round(2*a,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The radius of core in um = 3.31\n", + " \n", + "\n", + "The maximum possible core diameter in um = 6.62\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.15.3:Pg-1.56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "n1= 1.46 # RI of core..\n", + "a = 4.5 # radius of core in um..\n", + "delt= 0.0025 # relative RI difference..\n", + "V= 2.405 # Normalisd frequency for single mode..\n", + "lamda= 2*math.pi*a*n1*math.sqrt(2*delt)/V # cutoff wavelength...\n", + "print \" The cut off wavelength for the given fibre in um =\",round(lamda,3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The cut off wavelength for the given fibre in um = 1.214\n" + ] + } + ], + "prompt_number": 31 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/Chapter02-Optical_Fiber_for_Telecommunication.ipynb b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter02-Optical_Fiber_for_Telecommunication.ipynb new file mode 100755 index 00000000..46a8893c --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter02-Optical_Fiber_for_Telecommunication.ipynb @@ -0,0 +1,945 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:211878047ac07bbe36923a59422db9a2025fd46f216dee8cd476326a7778bb6a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter02: Optical Fiber for Telecommunication" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + " Ex2.2.1:Pg-2.4" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "alpha= 3 # average loss Power decreases by 50% so P(0)/P(z)= 0.5\n", + "lamda= 900*10**-9 # wavelength\n", + "z= 10*math.log10(0.5)/alpha # z is the length\n", + "z= z*-1 \n", + "print \" The length over which power decreases by 50% in Kms= \",round(z,2) \n", + "\n", + "z1= 10*math.log10(0.25)/alpha # Power decreases by 75% so P(0)/P(z)= 0.25\n", + "z1=z1*-1 # as distance cannot be negative...\n", + "print \" \\n\\nThe length over which power decreases by 75% in Kms= \",round(z1,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The length over which power decreases by 50% in Kms= 1.0\n", + " \n", + "\n", + "The length over which power decreases by 75% in Kms= 2.01\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.2.2:Pg-2.5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "\n", + "z=30.0 # Length of the fibre in kms\n", + "alpha= 0.8 # in dB\n", + "P0= 200.0 # Power launched in uW\n", + "pz= P0/10**(alpha*z/10) \n", + "print \" The output power in uW =\",round(pz,4) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The output power in uW = 0.7962\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.2.3:Pg-2.6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math \n", + "\n", + "z=8.0 # fibre length\n", + "p0= 120*10**-6 # power launched\n", + "pz= 3*10**-6 \n", + "alpha= 10*math.log10(p0/pz) # overall attenuation\n", + "print \" The overall attenuation in dB =\",round(alpha,2) \n", + "alpha = alpha/z # attenuation per km\n", + "alpha_new= alpha *10 # attenuation for 10kms\n", + "total_attenuation = alpha_new + 9 # 9dB because of splices\n", + "print \" \\n\\nThe total attenuation in dB =\",int(total_attenuation) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The overall attenuation in dB = 16.02\n", + " \n", + "\n", + "The total attenuation in dB = 29\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.2.4:Pg-2.6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + " \n", + "z=12.0 # fibre length\n", + "alpha = 1.5 \n", + "p0= 0.3 \n", + "pz= p0/10**(alpha*z/10) \n", + "pz=pz*1000 # formatting pz in nano watts...\n", + "print \" The power at the output of the cable in W = \",round(pz,2),\"x 10^-9\" \n", + "alpha_new= 2.5 \n", + "pz=pz/1000 # pz in uWatts...\n", + "p0_new= 10**(alpha_new*z/10)*pz \n", + "print \" \\n\\nThe Input power in uW= \",round(p0_new,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The power at the output of the cable in W = 4.75 x 10^-9\n", + " \n", + "\n", + "The Input power in uW= 4.75\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.2.5:Pg-2.7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "p0=150*10**-6 # power input\n", + "z= 10.0 # fibre length in km\n", + "pz= -38.2 # in dBm...\n", + "pz= 10**(pz/10)*1*10**-3 \n", + "alpha_1= 10/z *math.log10(p0/pz) # attenuation in 1st window\n", + "print \" Attenuation is 1st window in dB/Km =\",round(alpha_1,2) \n", + "alpha_2= 10/z *math.log10(p0/(47.5*10**-6)) # attenuation in 2nd window\n", + "print \" \\n\\nAttenuation is 2nd window in dB/Km =\",round(alpha_2,2) \n", + "alpha_3= 10/z *math.log10(p0/(75*10**-6)) # attenuation in 3rd window\n", + "print \" \\n\\nAttenuation is 3rd window in dB/Km =\",round(alpha_3,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Attenuation is 1st window in dB/Km = 3.0\n", + " \n", + "\n", + "Attenuation is 2nd window in dB/Km = 0.5\n", + " \n", + "\n", + "Attenuation is 3rd window in dB/Km = 0.3\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "\n", + "Ex2.2.6:Pg-2.8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "p0=3*10**-3 \n", + "pz=3*10**-6 \n", + "alpha= 0.5 \n", + "z= math.log10(p0/pz)/(alpha/10) \n", + "print \" The Length of the fibre in Km =\",int(z)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Length of the fibre in Km = 60\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.2.7:Pg-2.9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "z= 10.0 \n", + "p0= 100*10**-6 # input power\n", + "pz=5*10**-6 # output power\n", + "alpha = 10*math.log10(p0/pz) # total attenuation\n", + "print \" The overall signal attenuation in dB = \",round(alpha,2) \n", + "alpha = alpha/z # attenuation per km\n", + "print \" \\n\\nThe attenuation per Km in dB/Km = \",round(alpha,2)\n", + "z_new = 12.0 \n", + "splice_attenuation = 11*0.5 \n", + "cable_attenuation = alpha*z_new \n", + "total_attenuation = splice_attenuation+cable_attenuation \n", + "print \" \\n\\nThe overall signal attenuation for 12Kms in dB = \",round(total_attenuation,1) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The overall signal attenuation in dB = 13.01\n", + " \n", + "\n", + "The attenuation per Km in dB/Km = 1.3\n", + " \n", + "\n", + "The overall signal attenuation for 12Kms in dB = 21.1\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.2.8:Pg-2.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Tf = 1400.0 # fictive temperature\n", + "BETA = 7*10**-11 \n", + "n= 1.46 # RI \n", + "p= 0.286 # photo elastic constant\n", + "Kb = 1.381*10**-23 # Boltzmann's constant\n", + "lamda = 850*10**-9 # wavelength\n", + "alpha_scat = 8*math.pi**3*n**8*p**2*Kb*Tf*BETA/(3*lamda**4) \n", + "l= 1000 # fibre length\n", + "TL = exp(-alpha_scat*l) # transmission loss\n", + "attenuation = 10*math.log10(1/TL) \n", + "print \" The attenuation in dB/Km =\",round(attenuation,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The attenuation in dB/Km = 1.572\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.3.1:Pg-2.20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "alpha = 2 \n", + "n1= 1.5 \n", + "a= 25*10**-6 \n", + "lamda= 1.3*10**-6 \n", + "M= 0.5 \n", + "NA= math.sqrt(0.5*2*1.3**2/(math.pi**2*25**2)) \n", + "Rc= 3*n1**2*lamda/(4*math.pi*NA**3) \n", + "Rc=Rc*1000 # converting into um.....\n", + "print \" The radius of curvature in um =\",round(Rc,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The radius of curvature in um = 153.98\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.5.1:Pg-2.25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "lamda = 850 *10**-9 \n", + "sigma= 45*10**-9 \n", + "L= 1 \n", + "M= 0.025/(3*10**5*lamda) \n", + "sigma_m= sigma*L*M \n", + "sigma_m= sigma_m*10**9 # formatting in ns/km....\n", + "print \" The Pulse spreading in ns/Km =\",round(sigma_m,2) \n", + "print \" \\n\\nNOTE*** - The answer in text book is wrongly calculated..\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Pulse spreading in ns/Km = 4.41\n", + " \n", + "\n", + "NOTE*** - The answer in text book is wrongly calculated..\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.5.2:Pg-2.26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "lamda= 2*10**-9 \n", + "sigma = 75 \n", + "D_mat= 0.03/(3*10**5*2) \n", + "sigma_m= 2*1*D_mat \n", + "sigma_m=sigma_m*10**9 # Fornamtting in ns/Km\n", + "print \" The Pulse spreading in ns/Km =\",int(sigma_m)\n", + "D_mat_led= 0.025/(3*10**5*1550) \n", + "sigma_m_led = 75*1*D_mat_led*10**9 # in ns/Km\n", + "print \" \\n\\nThe Pulse spreading foe LED is ns/Km =\",round(sigma_m_led,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Pulse spreading in ns/Km = 100\n", + " \n", + "\n", + "The Pulse spreading foe LED is ns/Km = 4.03\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.5.3:Pg-2.26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "lamda = 850 \n", + "sigma= 20 \n", + "D_mat = 0.055/(3*10**5*lamda) \n", + "sigma_m= sigma*1*D_mat \n", + "D_mat=D_mat*10**12 # in Ps...\n", + "sigma_m=sigma_m*10**9 # in ns # # \n", + "print \" The material Dispersion in Ps/nm-Km =\",round(D_mat,2) \n", + "print \" \\n\\nThe Pulse spreading in ns/Km =\",round(sigma_m,4) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The material Dispersion in Ps/nm-Km = 215.69\n", + " \n", + "\n", + "The Pulse spreading in ns/Km = 4.3137\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.5.4:Pg-2.30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "n2= 1.48 \n", + "dele = 0.2 \n", + "lamda = 1320 \n", + "Dw = -n2*dele*0.26/(3*10**5*lamda) \n", + "Dw=Dw*10**10 # converting in math.picosecs....\n", + "print \" The waveguide dispersion in math.picosec/nm.Km =\",round(Dw,3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The waveguide dispersion in math.picosec/nm.Km = -1.943\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.6.1:Pg-2.34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "t= 0.1*10**-6 \n", + "L= 12 \n", + "B_opt= 1/(2*t) \n", + "B_opt=B_opt/1000000 # converting from Hz to MHz\n", + "print \" The maximum optical bandwidth in MHz. =\",int(B_opt) \n", + "dele= t/L # Pulse broadening\n", + "dele=dele*10**9 # converting in ns...\n", + "print \" \\n\\nThe pulse broadening per unit length in ns/Km =\",round(dele,2) \n", + "BLP= B_opt*L # BW length product\n", + "print \" \\n\\nThe Bandwidth-Length Product in MHz.Km =\",int(BLP) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum optical bandwidth in MHz. = 5\n", + " \n", + "\n", + "The pulse broadening per unit length in ns/Km = 8.33\n", + " \n", + "\n", + "The Bandwidth-Length Product in MHz.Km = 60\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.6.2:Pg-2.34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "t= 0.1*10**-6 \n", + "L= 10.0 \n", + "B_opt= 1/(2*t) \n", + "B_opt=B_opt/1000000 # converting from Hz to MHz\n", + "print \" The maximum optical bandwidth in MHz. =\",int(B_opt) \n", + "dele= t/L \n", + "dele=dele/10**-6 # converting in us...\n", + "print \" \\n\\nThe dispersion per unit length in us/Km =\",round(dele,2) \n", + "BLP= B_opt*L \n", + "print \" \\n\\nThe Bandwidth-Length product in MHz.Km =\",int(BLP) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum optical bandwidth in MHz. = 5\n", + " \n", + "\n", + "The dispersion per unit length in us/Km = 0.01\n", + " \n", + "\n", + "The Bandwidth-Length product in MHz.Km = 50\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.6.3:Pg-2.35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "t= 0.1*10**-6 \n", + "L=15 \n", + "B_opt= 1/(2*t) \n", + "B_opt=B_opt/1000000 # converting from Hz to MHz\n", + "print \" The maximum optical bandwidth in MHz. =\",int(B_opt) \n", + "dele= t/L*10**9 # in ns...\n", + "print \" \\n\\nThe dispersion per unit length in ns/Km =\",round(dele,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum optical bandwidth in MHz. = 5\n", + " \n", + "\n", + "The dispersion per unit length in ns/Km = 6.67\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.6.4:Pg-2.35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "lamda = 0.85*10**-6 \n", + "rms_spect_width = 0.0012*lamda \n", + "sigma_m= rms_spect_width*1*98.1*10**-3 \n", + "sigma_m=sigma_m*10**9 # converting in ns...\n", + "print \" The Pulse Broadening due to material dispersion in ns/Km =\",round(sigma_m,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Pulse Broadening due to material dispersion in ns/Km = 0.1\n" + ] + } + ], + "prompt_number": 43 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.6.5:Pg-2.35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "L= 5.0 # in KM\n", + "n1= 1.5 \n", + "dele= 0.01 \n", + "c= 3*10**8 # in m/s\n", + "delta_t = (L*n1*dele)/c \n", + "delta_t=delta_t*10**12 # convertin to nano secs...\n", + "print \" The delay difference in ns =\",round(delta_t,1)\n", + "sigma= L*n1*dele/(2*math.sqrt(3)*c) \n", + "sigma=sigma*10**12 # convertin to nano secs...\n", + "print \" \\n\\nThe r.m.s pulse broadening in ns =\",round(sigma,2) \n", + "B= 0.2/sigma*1000 # in Mz\n", + "print \" \\n\\nThe maximum bit rate in MBits/sec =\",round(B,2) \n", + "BLP = B*5 \n", + "print \" \\n\\nThe Bandwidth-Length in MHz.Km =\",round(BLP,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The delay difference in ns = 250.0\n", + " \n", + "\n", + "The r.m.s pulse broadening in ns = 72.17\n", + " \n", + "\n", + "The maximum bit rate in MBits/sec = 2.77\n", + " \n", + "\n", + "The Bandwidth-Length in MHz.Km = 13.86\n" + ] + } + ], + "prompt_number": 47 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.6.6:Pg-2.36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "del_t_inter = 5*1 \n", + "del_t_intra = 50*80*1 \n", + "total_dispersion = math.sqrt(5**2 + 0.4**2) \n", + "print \" Total dispersion in ns =\",round(total_dispersion,3) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total dispersion in ns = 5.016\n" + ] + } + ], + "prompt_number": 49 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.7.1:Pg-2.37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "t= 0.1*10**-6 \n", + "L=15 \n", + "dele= t/L*10**9 # convertin to nano secs...\n", + "print \" The Pulse Dispersion in ns =\",round(dele,2) \n", + "B_opt= 1/(2*t)/10**6 # convertin to nano secs...\n", + "print \" \\n\\n The maximum possible Bandwidth in MHz =\",int(B_opt) \n", + "BLP = B_opt*L \n", + "print \" \\n\\nThe BandwidthLength product in MHz.Km =\",int(BLP) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Pulse Dispersion in ns = 6.67\n", + " \n", + "\n", + " The maximum possible Bandwidth in MHz = 5\n", + " \n", + "\n", + "The BandwidthLength product in MHz.Km = 75\n" + ] + } + ], + "prompt_number": 51 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.7.2:Pg-2.38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "L= 6 \n", + "n1= 1.5 \n", + "delt= 0.01 \n", + "delta_t = L*n1*delt/(3*10**8)*10**12 # convertin to nano secs...\n", + "print \" The delay difference in ns =\",int(delta_t) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The delay difference in ns = 300\n" + ] + } + ], + "prompt_number": 52 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.7.3:Pg-2.39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Lb= 0.09 \n", + "lamda= 1.55*10**-6 \n", + "delta_lamda = 1*10**-9 \n", + "Bf= lamda/Lb \n", + "Lbc= lamda**2/(Bf*delta_lamda) \n", + "print \" The modal Bifriengence in meters =\",round(Lbc,2) \n", + "beta_xy= 2*math.pi/Lb \n", + "print \" \\n\\nThe difference between propogation constants =\",round(beta_xy,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The modal Bifriengence in meters = 139.5\n", + " \n", + "\n", + "The difference between propogation constants = 69.81\n" + ] + } + ], + "prompt_number": 53 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.7.4:Pg-2.39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "t= 0.1*10**-6 \n", + "B_opt= 1/(2*t)/1000000 \n", + "print \" The maximum possible Bandwidth in MHz =\",int(B_opt) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum possible Bandwidth in MHz = 5\n" + ] + } + ], + "prompt_number": 54 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.7.5:Pg-2.40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "t= 0.1*10**-6 \n", + "B_opt= 1/(2*t)/1000000 \n", + "print \" The maximum possible Bandwidth in MHz =\",int(B_opt) \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum possible Bandwidth in MHz = 5\n" + ] + } + ], + "prompt_number": 55 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/Chapter03-Optical_Sources_and_Transmitters.ipynb b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter03-Optical_Sources_and_Transmitters.ipynb new file mode 100755 index 00000000..1e7a6431 --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter03-Optical_Sources_and_Transmitters.ipynb @@ -0,0 +1,826 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1c5868fa547e8a659e03148d4a7bf0c9a34282713a490e0b68c5b0aa98a2f7e8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter03:Optical Sources and Transmitters" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.1:Pg-3.10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "x= 0.07 \n", + "Eg= 1.424+1.266*x+0.266*x**2 \n", + "lamda= 1.24/Eg \n", + "print \" The emitted wavelength in um =\",round(lamda,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The emitted wavelength in um = 0.82\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.2:Pg-3.10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "x= 0.26 \n", + "y=0.57 \n", + "Eg= 1.35-0.72*y+0.12*y**2 \n", + "lamda = 1.24/Eg \n", + "print \" The wavelength emitted in um =\",round(lamda,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The wavelength emitted in um = 1.27\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.3:Pg-3.12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "Tr = 60*10**-9 # radiative recombination time\n", + "Tnr= 90*10**-9 # non radiative recomb time\n", + "I= 40*10**-3 # current\n", + "t = Tr*Tnr/(Tr+Tnr) # total recomb time\n", + "t=t*10**9 # Converting in nano secs...\n", + "print \" The total carrier recombination life time in ns =\",int(t) \n", + "t=t/10**9 \n", + "h= 6.625*10**-34 # plancks const\n", + "c= 3*10**8 \n", + "q=1.602*10**-19 \n", + "lamda= 0.87*10**-6 \n", + "Pint=(t/Tr)*((h*c*I)/(q*lamda)) \n", + "Pint=Pint*1000 # converting inmW...\n", + "print \" \\n\\nThe Internal optical power in mW =\",round(Pint,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The total carrier recombination life time in ns = 36\n", + " \n", + "\n", + "The Internal optical power in mW = 34.22\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.4:Pg-3.13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "lamda = 1310*10**-9 \n", + "Tr= 30*10**-9 \n", + "Tnr= 100*10**-9 \n", + "I= 40*10**-3 \n", + "t= Tr*Tnr/(Tr+Tnr) \n", + "t=t*10**9 # converting in nano secs...\n", + "print \" Bulk recombination life time in ns =\",round(t,2) \n", + "t=t/10**9 \n", + "n= t/Tr \n", + "print \" \\n\\nInternal quantum efficiency =\",round(n,3) \n", + "h= 6.625*10**-34 # plancks const\n", + "c= 3*10**8 \n", + "q=1.602*10**-19 \n", + "Pint=(0.769*h*c*I)/(q*lamda)*1000 \n", + "print \" \\n\\nThe internal power level in mW =\",round(Pint,3) \n", + "print \" \\n\\n***NOTE: Internal Power wrong in text book.. Calculation Error..\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Bulk recombination life time in ns = 23.08\n", + " \n", + "\n", + "Internal quantum efficiency = 0.769\n", + " \n", + "\n", + "The internal power level in mW = 29.131\n", + " \n", + "\n", + "***NOTE: Internal Power wrong in text book.. Calculation Error..\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.5:Pg-3.14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "nx= 3.6 \n", + "TF= 0.68 \n", + "n= 0.3 \n", + " # Pe=Pint*TF*1/(4*nx**2) \n", + " # ne= Pe/Px*100 ..eq0\n", + " # Pe = 0.013*Pint # Eq 1\n", + " # Pint = n*P # Eq 2\n", + " # substitute eq2 and eq1 in eq0\n", + "ne = 0.013*0.3*100 \n", + "print \" The external Power efficiency in % =\",round(ne,3) \n", + " # Wrongly printed in textbook. it should be P instead of Pint in last step\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The external Power efficiency in % = 0.39\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.6:Pg-3.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "lamda= 0.85*10**-6 \n", + "Nint = 0.60 \n", + "I= 20*10**-3 \n", + "h= 6.625*10**-34 # plancks const\n", + "c= 3*10**8 \n", + "e=1.602*10**-19 \n", + "Pint = Nint*h*c*I/(e*lamda) \n", + "print \" The optical power emitted in W =\",round(Pint,4) \n", + "\n", + "TF= 0.68 \n", + "nx= 3.6 \n", + "Pe= Pint*TF/(4*nx**2)*1000000 \n", + "print \" \\n\\nPower emitted in the air in uW =\",round(Pe,1) \n", + "Pe=Pe/1000000 \n", + "Nep=Pe/Pint*100 \n", + "print \" \\n\\nExternal power efficiency in % =\",round(Nep,1) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The optical power emitted in W = 0.0175\n", + " \n", + "\n", + "Power emitted in the air in uW = 229.7\n", + " \n", + "\n", + "External power efficiency in % = 1.3\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.7:Pg-3.16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "lamda = 0.87*10**-6 \n", + "Tr= 50*10**-9 \n", + "I= 0.04 \n", + "Tnr= 110*10**-9 \n", + "t= Tr*Tnr/(Tr+Tnr) \n", + "t=t*10**9 # converting in ns...\n", + "print \" Total carrier recombination life time in ns =\",round(t,2) \n", + "t=t/10**9 \n", + "h= 6.625*10**-34 # plancks const\n", + "c= 3*10**8 \n", + "q=1.602*10**-19 \n", + "n= t/Tr \n", + "print \" \\n\\nThe efficiency in % \",round(n,3) \n", + "Pint=(n*h*c*I)/(q*lamda)*1000 \n", + "print \" \\n\\nInternal power generated in mW =\",round(Pint,2) \n", + "print \" \\n\\n***NOTE- Internal Power wrong in book... \"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total carrier recombination life time in ns = 34.38\n", + " \n", + "\n", + "The efficiency in % 0.688\n", + " \n", + "\n", + "Internal power generated in mW = 39.22\n", + " \n", + "\n", + "***NOTE- Internal Power wrong in book... \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.8:Pg-3.16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + " \n", + "\n", + "V= 2 \n", + "I= 100*10**-3 \n", + "Pc= 2*10**-3 \n", + "P= V*I \n", + "Npc= Pc/P*100 \n", + "print \" The overall power conversion efficiency in % =\",int(Npc) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The overall power conversion efficiency in % = 1\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.3.1:Pg-3.25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "r1= 0.32 \n", + "r2= 0.32 \n", + "alpha= 10 \n", + "L= 500*10**-4 \n", + "temp=math.log(1/(r1*r2)) \n", + "Tgth = alpha + (temp/(2*L)) \n", + "print \" The optical gain at threshold in /cm =\",round(Tgth,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The optical gain at threshold in /cm = 32.79\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.3.2:Pg-3.27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + " \n", + "n= 3.7 \n", + "lamda = 950*10**-9 \n", + "L= 500*10**-6 \n", + "c= 3*10**8 \n", + "DELv = c/(2*L*n)*10*10**-10 # converting in GHz...\n", + "print \" The frequency spacing in GHz =\",int(DELv) \n", + "DEL_lamda= lamda**2/(2*L*n)*10**9 # converting to nm..\n", + "print \" \\n\\nThe wavelength spacing in nm =\",round(DEL_lamda,2) \n", + "\n", + "print \" \\n\\n***NOTE- The value of wavelength taken wrongly in book\" \n", + " # value of lamda taken wrongly while soving for DEL_LAMDA inthe book..\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The frequency spacing in GHz = 81\n", + " \n", + "\n", + "The wavelength spacing in nm = 0.24\n", + " \n", + "\n", + "***NOTE- The value of wavelength taken wrongly in book\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.3.3:Pg-3.30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " #Given\n", + " \n", + "L= 0.04 \n", + "n= 1.78 \n", + "lamda= 0.55*10**-6 \n", + "c= 3*10**8 \n", + "q= 2*n*L/lamda \n", + "q=q/10**5 \n", + "print \" Number of longitudinal modes =\",round(q,2),\"x 10^5\" \n", + "del_f= c/(2*n*L) \n", + "del_f=del_f*10**-9 \n", + "print \" \\n\\nThe frequency seperation in GHz =\",round(del_f,1) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Number of longitudinal modes = 2.59 x 10^5\n", + " \n", + "\n", + "The frequency seperation in GHz = 2.1\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.3.4:Pg-3.33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "Nt= 0.18 \n", + "V= 2.5 \n", + "Eg= 1.43 \n", + "Nep= Nt*Eg*100/V \n", + "print \" The total efficiency in % =\",round(Nep,3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The total efficiency in % = 10.296\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.3.5:Pg-3.33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "n= 3.6 \n", + "BETA= 21*10**-3 \n", + "alpha= 10 \n", + "L= 250*10**-4 \n", + "\n", + "r= (n-1)**2/(n+1)**2 \n", + "Jth= 1/BETA *( alpha + (math.log(1/r)/L)) \n", + "Jth=Jth/1000 # converting for displaying...\n", + "print \" The threshold current density =\",round(Jth,3),\"x 10**3\" \n", + "Jth=Jth*1000 \n", + "Ith =Jth*250*100*10**-8 \n", + "Ith=Ith*1000 # converting into mA...\n", + "print \" \\n\\nThe threshold current in mA =\",round(Ith,1) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The threshold current density = 2.65 x 10**3\n", + " \n", + "\n", + "The threshold current in mA = 662.4\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.3.6:Pg-3.34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "T= 305.0 \n", + "T0 = 160.0 \n", + "T1= 373.0\n", + "\n", + "Jth_32 = exp(T/T0) \n", + "Jth_100 = exp(T1/T0) \n", + "R_j = Jth_100/Jth_32 \n", + "print \" Ratio of current densities at 160K is =\",round(R_j,2) \n", + "print \" \\n\\n***NOTE- Wrong in book...\\nJth(100) calculated wrongly...\" \n", + "To = 55 \n", + "Jth_32_new = exp(T/To) \n", + "Jth_100_new = exp(T1/To) \n", + "R_j_new = Jth_100_new/Jth_32_new \n", + "print \" \\n\\nRatio of current densities at 55K is \",round(R_j_new,2) \n", + " # wrong in book...\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Ratio of current densities at 160K is = 1.53\n", + " \n", + "\n", + "***NOTE- Wrong in book...\n", + "Jth(100) calculated wrongly...\n", + " \n", + "\n", + "Ratio of current densities at 55K is 3.44\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.4.1:Pg-3.42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "Bo= 150 \n", + "rs= 35*10**-4 \n", + "a1= 25*10**-6 \n", + "NA= 0.20 \n", + "a2= 50*10**-6 \n", + "\n", + "Pled = (a1/rs)**2 * (math.pi**2*rs**2*Bo*NA**2) \n", + "Pled=Pled*10**10 # converting in uW...\n", + "print \" The power coupled inthe fibre in uW =\",int(Pled) \n", + "Pled_new = (math.pi**2*rs**2*Bo*NA**2) \n", + "Pled_new=Pled_new*10**6 # converting in uW...\n", + "print \" \\n\\nThe Power coupled for case 2 in uW =\",round(Pled_new,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The power coupled inthe fibre in uW = 370\n", + " \n", + "\n", + "The Power coupled for case 2 in uW = 725.42\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.4.2:Pg-3.43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "n= 1.48 \n", + "n1= 3.6 \n", + "R= (n1-n)**2/(n1+n)**2 \n", + "print \" The Fresnel Reflection is \",round(R,4) \n", + "L= -10*math.log10(1-R) \n", + "print \" \\n\\nPower loss in dB =\",round(L,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Fresnel Reflection is 0.1742\n", + " \n", + "\n", + "Power loss in dB = 0.83\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.4.3:Pg-3.44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "NA= 0.20 \n", + "Bo= 150 \n", + "rs= 35*10**-6 \n", + "Pled = math.pi**2*rs**2*Bo*NA**2 \n", + "Pled=Pled*10**10 # convertin in uW for displaying...\n", + "print \" The optical power coupled in uW =\",round(Pled,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The optical power coupled in uW = 725.42\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.4.4:Pg-3.44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "n1= 1.5 \n", + "n=1 \n", + "R= (n1-n)**2/(n1+n)**2 \n", + "L= -10*math.log10(1-R) \n", + " # Total loss is twice due to reflection\n", + "L= L+L \n", + "print \" Total loss due to Fresnel Reflection in dB =\",round(L,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total loss due to Fresnel Reflection in dB = 0.35\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.4.5:Pg-3.51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + " \n", + "n1= 1.5 \n", + "n=1.0 \n", + "y=5.0 \n", + "a= 25.0 \n", + "temp1=(1-(y/(2*a)**2))**0.5 \n", + "temp1=temp1*(y/a) \n", + "temp=2*math.acos(0.9996708) # it should be acos(0.1) actually... due to approximations\n", + " \n", + " # answer varies a lot... \n", + "temp=math.degrees(temp)-temp1 \n", + " # temp=temp \n", + "tem= 16*(1.5**2)/(2.5**4) \n", + "tem=tem/math.pi \n", + "temp=temp*tem \n", + "Nlat= temp \n", + "print \" The Coupling efficiency is =\",round(Nlat,3) \n", + "L= -10*math.log10(Nlat) \n", + "print \" \\n\\nThe insertion loss in dB =\",round(L,2) \n", + "temp1=(1-(y/(2*a)**2))**0.5 \n", + "temp1=temp1*(y/a) \n", + "temp=2*math.acos(0.9996708) # it should be acos(0.1) actually... due to approximations\n", + " # answer varies a lot... \n", + "temp=math.degrees(temp)-temp1 \n", + "temp=temp/math.pi \n", + "N_new =temp \n", + "print \" \\n\\nEfficiency when joint index is matched =\",round(N_new,3) \n", + "L_new= -10*math.log10(N_new) \n", + "print \" \\n\\nThe new insertion loss in dB =\",round(L_new,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Coupling efficiency is = 0.804\n", + " \n", + "\n", + "The insertion loss in dB = 0.95\n", + " \n", + "\n", + "Efficiency when joint index is matched = 0.872\n", + " \n", + "\n", + "The new insertion loss in dB = 0.59\n" + ] + } + ], + "prompt_number": 39 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/Chapter04-Optical_Detectors_and_Receivers.ipynb b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter04-Optical_Detectors_and_Receivers.ipynb new file mode 100755 index 00000000..9dca6b9e --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter04-Optical_Detectors_and_Receivers.ipynb @@ -0,0 +1,644 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e29ad753b5f2886d343bb74ecb0ecc91fcb2a9898826cbfcabd7e953e57d2f63" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter04: Optical Detectors and Receivers" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.1:Pg-4.5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "Eg= 1.1 \n", + "lamda_c = 1.24/Eg \n", + "print \"The cut off wavelength in um= \",round(lamda_c,2) \n", + "\n", + "Eg_ger =0.67 \n", + "lamda_ger= 1.24/Eg_ger \n", + "print \" \\nThe cut off wavelength for Germanium in um= \",round(lamda_ger,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The cut off wavelength in um= 1.13\n", + " \n", + "The cut off wavelength for Germanium in um= 1.85\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.2:Pg-4.5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given \n", + "Eg = 1.43 \n", + "lamda = 1.24/Eg \n", + "lamda=lamda*1000 # converting in nm\n", + "print \"The cut off wavelength in nm =\",round(lamda,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The cut off wavelength in nm = 867.13\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.3:Pg-4.5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "P = 6*10**6 \n", + "Eh_pair= 5.4*10**6 \n", + "n= Eh_pair/P*100 \n", + "print \" The quantum efficiency in % = \",n \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The quantum efficiency in % = 90.0\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.4:Pg-4.6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "R= 0.65 \n", + "P0= 10*10**-6 \n", + "Ip= R*P0 \n", + "Ip=Ip*10**6 # convertinf in uA...\n", + "print \" The generated photocurrent in uA = \",Ip \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The generated photocurrent in uA = 6.5\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.5:Pg-4.6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "Ec= 1.2*10**11 \n", + "P= 3*10**11 \n", + "lamda = 0.85*10**-6 \n", + "n= Ec/P*100 \n", + "print \"The efficiency in % =\",n \n", + "\n", + "q= 1.602*10**-19 \n", + "h= 6.625*10**-34 \n", + "c= 3*10**8 \n", + "n= n/100 \n", + "R= n*q*lamda/(h*c) \n", + "print \" \\n\\nThe Responsivity of the photodiode in A/W=\",round(R ,4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The efficiency in % = 40.0\n", + " \n", + "\n", + "The Responsivity of the photodiode in A/W= 0.2741\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.6:Pg-4.7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "n= 0.65 \n", + "E= 1.5*10**-19 \n", + "Ip= 2.5*10**-6 \n", + "h= 6.625*10**-34 \n", + "c= 3*10**8 \n", + "lamda= h*c/E \n", + "lamda=lamda*10**6 # converting in um for displaying...\n", + "print \"The wavelength in um =\",lamda \n", + "lamda=lamda*10**-6 \n", + "q= 1.602*10**-19 \n", + "R= n*q*lamda/(h*c) \n", + "print \"\\nThe Responsivity in A/W =\",R \n", + "Pin= Ip/R \n", + "Pin=Pin*10**6 # converting in uW for displaying/..\n", + "print \" \\nThe incidnt power in uW= \",round(Pin,1) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wavelength in um = 1.325\n", + "\n", + "The Responsivity in A/W = 0.6942\n", + " \n", + "The incidnt power in uW= 3.6\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.7:Pg-4.8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "Iin= 1 \n", + "lamda= 1550*10**-9 \n", + "q= 1.602*10**-19 \n", + "h= 6.625*10**-34 \n", + "c= 3*10**8 \n", + "n=0.65 \n", + "Ip=n*q*lamda*Iin/(h*c) \n", + "Ip=Ip*1000 # converting in mA for displaying...\n", + "print \" The average photon current in mA= \",int(Ip)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The average photon current in mA= 812\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.8:Pg-4.9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "n= 0.70 \n", + "Ip= 4*10**-6 \n", + "e= 1.602*10**-19 \n", + "h= 6.625*10**-34 \n", + "c= 3*10**8 \n", + "E= 1.5*10**-19\n", + "lamda = h*c/E \n", + "lamda=lamda*10**6 # converting um for displaying...\n", + "print \"The wavelength in um =\",round(lamda,3) \n", + "R= n*e/E \n", + "Po= Ip/R \n", + "Po=Po*10**6 # converting um for displaying...\n", + "print \" \\nIncident optical Power in uW =\",round(Po,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wavelength in um = 1.325\n", + " \n", + "Incident optical Power in uW = 5.35\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.2.1:Pg-4.14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Ct= 7*10.0**-12\n", + "Rt= 50*1*10.0**6/(50+(1*10**6))\n", + "B= 1/(2*math.pi*Rt*Ct)\n", + "B=B*10**-6 #converting in mHz for displaying...\n", + "print \"The bandwidth of photodetector in MHz =\",round(B,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The bandwidth of photodetector in MHz = 454.75\n" + ] + } + ], + "prompt_number": 43 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.2.2:Pg-4.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "W= 25*10**-6 \n", + "Vd= 3*10**4 \n", + "Bm= Vd/(2*math.pi*W) \n", + "RT= 1/Bm \n", + "RT=RT*10**9 # converting ns for displaying...\n", + "print \" The maximum response time in ns =\",round(RT,2) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum response time in ns = 5.24\n" + ] + } + ], + "prompt_number": 45 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "\n", + "Ex4.2.3:Pg-4.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "e= 1.602*10**-19 \n", + "h= 6.625*10**-34 \n", + "v= 3*10**8 \n", + "n=0.65 \n", + "I= 10*10**-6 \n", + "lamda= 900*10**-9 \n", + "R= n*e*lamda/(h*v) \n", + "Po= 0.5*10**-6 \n", + "Ip= Po*R \n", + "M= I/Ip \n", + "print \" The multiplication factor =\",round(M,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The multiplication factor = 42.41\n" + ] + } + ], + "prompt_number": 48 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.3.1:Pg-4.18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "n=0.65 \n", + "lamda = 900*10**-9 \n", + "Pin= 0.5*10**-6 \n", + "Im= 10*10**-6 \n", + "q= 1.602*10**-19 \n", + "h= 6.625*10**-34 \n", + "c= 3*10**8 \n", + "R= n*q*lamda/(h*c) \n", + "Ip= R*Pin \n", + "M= Im/Ip \n", + "print \" The multiplication factor =\",round(M,2)\n", + "print \"\\n***NOTE-Answer wrong in textbook...\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The multiplication factor = 42.41\n", + "\n", + "***NOTE-Answer wrong in textbook...\n" + ] + } + ], + "prompt_number": 51 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.6.1:Pg-4.34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "lamda = 1300*10**-9 \n", + "Id= 4*10**-9 \n", + "n=0.9 \n", + "Rl= 1000 \n", + "Pincident= 300*10**-9 \n", + "BW= 20*10**6 \n", + "q= 1.602*10**-19 \n", + "h= 6.625*10**-34 \n", + "v= 3*10**8 \n", + "Iq= math.sqrt((q*Pincident*n*lamda)/(h*v)) \n", + "Iq= math.sqrt(Iq) \n", + "Iq=Iq*100 # converting in proper format for displaying...\n", + "print \"Mean square quantum noise current in Amp*10^11 =\",round(Iq,2)\n", + "I_dark= 2*q*BW*Id \n", + "I_dark=I_dark*10**19 # converting in proper format for displaying...\n", + "print \" \\nMean square dark current in Amp*10^-19 =\",round(I_dark,3) \n", + "k= 1.38*10**-23 \n", + "T= 25+273 \n", + "It= 4*k*T*BW/Rl \n", + "It=It*10**16 # converting in proper format for displaying...\n", + "print \" \\nMean square thermal nise current in Amp*10^-16 =\",round(It,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mean square quantum noise current in Amp*10^11 = 2.31\n", + " \n", + "Mean square dark current in Amp*10^-19 = 0.256\n", + " \n", + "Mean square thermal nise current in Amp*10^-16 = 3.29\n" + ] + } + ], + "prompt_number": 61 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.8.1:Pg-4.39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "lamda = 850*10**-9 # meters\n", + "BER= 1*10**-9 \n", + "N_bar = 9*log(10) \n", + "h= 6.625*10**-34 # joules-sec\n", + "v= 3*10**8 # meters/sec\n", + "n= 0.65 # assumption\n", + "E=N_bar*h*v/(n*lamda) \n", + "E=E*10**18 # /converting in proper format for displaying...\n", + "print \" The Energy received in Joules*10^-18 =\",round(E,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Energy received in Joules*10^-18 = 7.45\n" + ] + } + ], + "prompt_number": 64 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.8.2:Pg-4.39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "lamda = 850*10**-9 \n", + "BER = 1*10**-9 \n", + "BT=10*10**6 \n", + "h= 6.625*10**-34 \n", + "c= 3*10**8 \n", + "Ps= 36*h*c*BT/lamda \n", + "Ps=Ps*10**12 # /converting in proper format for displaying...\n", + "print \"The minimum incidental optical power required id in pW =\",round(Ps,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The minimum incidental optical power required id in pW = 84.18\n" + ] + } + ], + "prompt_number": 67 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.8.3:Pg-4.40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "C= 5*10**-12 \n", + "B =50*10**6 \n", + "Ip= 1*10**-7 \n", + "e= 1.602*10**-19 \n", + "k= 1.38*10**-23 \n", + "T= 18+273 \n", + "M= 1 \n", + "Rl= 1/(2*math.pi*C*B) \n", + "S_N= Ip**2/((2*e*B*Ip)+(4*k*T*B/Rl)) \n", + "S_N = 10*math.log10(S_N) # in db\n", + "print \" The S/N ratio in dB =\",round(S_N,2) \n", + "M=41.54 \n", + "S_N_new= (M**2*Ip**2)/((2*e*B*Ip*M**2.3)+(4*k*T*B/Rl)) \n", + "S_N_new = 10*math.log10(S_N_new) # in db\n", + "print \" \\n\\nThe new S/N ratio in dB =\",round(S_N_new,2)\n", + "print \" \\n\\nImprovement over M=1 in dB =\",round(S_N_new-S_N,1) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The S/N ratio in dB = 8.99\n", + " \n", + "\n", + "The new S/N ratio in dB = 32.49\n", + " \n", + "\n", + "Improvement over M=1 in dB = 23.5\n" + ] + } + ], + "prompt_number": 70 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/Chapter05-Design_Considerations_in_Optical_Links.ipynb b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter05-Design_Considerations_in_Optical_Links.ipynb new file mode 100755 index 00000000..3915a0b4 --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter05-Design_Considerations_in_Optical_Links.ipynb @@ -0,0 +1,458 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b4a79f107959b9c220fb0fbffb78f81a806979a06263be16ca010cadce8d4a27" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter05: Design Considerations in Optical Links" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.3.1:Pg-5.7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "B= 15*10**-6 \n", + "L= 4 \n", + "BER= 1*10**-9 \n", + "Ls= 0.5 \n", + "Lc= 1.5 \n", + "alpha= 6 \n", + "Pm= 8 \n", + "Pt= 2*Lc +(alpha*L)+(Pm) \n", + "print \" The actual loss in fibre in dB =\",int(Pt) \n", + "Pmax = -10-(-50) \n", + "print \" \\nThe maximum allowable system loss in dBm = \",Pmax " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The actual loss in fibre in dB = 35\n", + " \n", + "The maximum allowable system loss in dBm = 40\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.3.2:Pg-5.8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Ps= 0.1 \n", + "alpha = 6 \n", + "L= 0.5 \n", + "Ps = 10*math.log10(Ps) \n", + "NA= 0.25 \n", + "Lcoupling= -10*math.log10(NA**2) \n", + "Lf= alpha*L \n", + "lc= 2*2 \n", + "Pm= 4 \n", + "Pout = Ps-(Lcoupling+Lf+lc+Pm) \n", + "print \" The actual power output in dBm = \",int(Pout) \n", + "Pmin = -35 \n", + "print \" Minimum input power required in dBm= \",Pmin \n", + "print \" As Pmin > Pout, system will perform adequately over the system operating life.\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The actual power output in dBm = -33\n", + " Minimum input power required in dBm= -35\n", + " As Pmin > Pout, system will perform adequately over the system operating life.\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.3.3:Pg-5.8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "Ps= 5 \n", + "Lcoupling = 3 \n", + "Lc= 2 \n", + "L_splicing = 50*0.1 \n", + "F_atten = 25 \n", + "L_total = Lcoupling+Lc+L_splicing+F_atten \n", + "P_avail = Ps-L_total \n", + "sensitivity = -40 \n", + "loss_margin = -sensitivity-(-P_avail) \n", + "print \" The loss margin of the system in dBm= -\",loss_margin \n", + "sensitivity_fet = -32 \n", + "loss_margin_fet=-sensitivity_fet-(-P_avail) \n", + "print \"The loss marging for the FET receiver in dBm= -\",loss_margin_fet \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The loss margin of the system in dBm= - 10.0\n", + "The loss marging for the FET receiver in dBm= - 2.0\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.3.4:Pg-5.9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "LED_output = 3 \n", + "PIN_sensitivity = -54 \n", + "allowed_loss= LED_output -(-PIN_sensitivity) \n", + "Lcoupling = 17.5 \n", + "cable_atten = 30 \n", + "power_margin_coupling= 39.5 \n", + "power_margin_splice=6.2 \n", + "power_margin_cable=9.5 \n", + "final_margin= power_margin_coupling+power_margin_splice+power_margin_cable \n", + "print \" The safety margin in dB =\",final_margin\n", + " # Answer in book is wrong...\n", + "print \" \\n***NOTE- Answer wrong in book...\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The safety margin in dB = 55.2\n", + " \n", + "***NOTE- Answer wrong in book...\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.3.5:Pg-5.10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "optical_power=-10 \n", + "receiver_sensitivity=-41 \n", + "total_margin= optical_power-receiver_sensitivity \n", + "cable_loss= 7*2.6 \n", + "splice_loss= 6*0.5 \n", + "connector_loss= 1*1.5 \n", + "safety_margin= 6 \n", + "total_loss= cable_loss+splice_loss+connector_loss+safety_margin \n", + "excess_power_margin= total_margin-total_loss \n", + "print \" The system is viable and provides excess power margin in dB=\",excess_power_margin \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The system is viable and provides excess power margin in dB= 2.3\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.4.1:Pg-5.13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Ttx= 15 \n", + "Tmat=21 \n", + "Tmod= 3.9 \n", + "BW= 25.0 \n", + "Trx= 350.0/BW \n", + "\n", + "Tsys = math.sqrt(Ttx**2+Tmat**2+Tmod**2+Trx**2) \n", + "print \" The system rise time in ns.= \",round(Tsys,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The system rise time in ns.= 29.62\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.4.2:Pg-5.14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "Ttrans = 1.75*10**-9 \n", + "Tled = 3.50*10**-9 \n", + "Tcable=3.89*10**-9 \n", + "Tpin= 1*10**-9 \n", + "Trec= 1.94*10**-9 \n", + "Tsys= math.sqrt(Ttrans**2+Tled**2+Tcable**2+Tpin**2+Trec**2) \n", + "Tsys=Tsys*10**9 # converting in ns for dislaying...\n", + "print \" The system rise time in ns= \",round(Tsys,2)\n", + "Tsys=Tsys*10**-9 \n", + "BW= 0.35/Tsys \n", + "BW=BW/1000000.0 # converting in MHz for dislaying...\n", + "print \" \\nThe system bandwidth in MHz =\",round(BW,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The system rise time in ns= 5.93\n", + " \n", + "The system bandwidth in MHz = 58.99\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.4.3:Pg-5.14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Ttx= 8*10**-9 \n", + "Tintra= 1*10**-9 \n", + "Tmodal=5*10**-9 \n", + "Trr= 6*10**-9 \n", + "Tsys= math.sqrt(Ttx**2+(8*Tintra)**2+(8*Tmodal)**2+Trr**2) \n", + "\n", + "BWnrz= 0.7/Tsys \n", + "BWnrz=BWnrz/1000000 # converting in ns for dislaying...\n", + "BWrz=0.35/Tsys \n", + "BWrz=BWrz/1000000 # converting in ns for dislaying...\n", + "print \" Maximum bit rate for NRZ format in Mb/sec= \",round(BWnrz,2)\n", + "print \" \\nMaximum bit rate for RZ format in Mb/sec= \",round(BWrz,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Maximum bit rate for NRZ format in Mb/sec= 16.67\n", + " \n", + "Maximum bit rate for RZ format in Mb/sec= 8.33\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.4.4:Pg-5.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Ts= 10*10**-9 \n", + "Tn=9*10**-9 \n", + "Tc=2*10**-9 \n", + "Td=3*10**-9 \n", + "BW= 6*10**6 \n", + "Tsyst= 1.1*math.sqrt(Ts**2+(5*Tn)**2+(5*Tc)**2+Td**2) \n", + "Tsyst=Tsyst*10**9 # converting in ns for displying...\n", + "Tsyst_max = 0.35/BW \n", + "Tsyst_max=Tsyst_max*10**9 # converting in ns for displying...\n", + "print \" Rise system of the system in ns= \",round(Tsyst,2)\n", + "print \" \\nMaximum Rise system of the system in ns= \",round(Tsyst_max,2)\n", + "print \" \\nSpecified components give a system rise time which is adequate for the bandwidth and distance requirements of the optical fibre link.\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Rise system of the system in ns= 51.99\n", + " \n", + "Maximum Rise system of the system in ns= 58.33\n", + " \n", + "Specified components give a system rise time which is adequate for the bandwidth and distance requirements of the optical fibre link.\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.5.1:Pg-5.18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "del_t_1 = 10*100*10**-9 \n", + "Bt_nrz_1 = 0.7/(del_t_1*1000000) \n", + "Bt_rz_1 = 0.35/(del_t_1*1000000) \n", + "print \"First case.\"\n", + "print \" \\nBit rate for nrz in Mb/sec= \",Bt_nrz_1 \n", + "print \" \\nBit rate for rz in Mb/sec= \",Bt_rz_1 \n", + "del_t_2 = 20*1000*10**-9 \n", + "Bt_nrz_2 = 0.7/(del_t_2*1000000) \n", + "Bt_rz_2 = 0.35/(del_t_2*1000000) \n", + "print \" \\n\\nSecond case\" \n", + "print \" \\nBit rate for nrz in Mb/sec= \",Bt_nrz_2 \n", + "print \" \\nBit rate for rz in Mb/sec= \",Bt_rz_2 \n", + "del_t_3 = 2*2000*10**-9 \n", + "Bt_nrz_3 = 0.7/(del_t_3*1000) \n", + "Bt_rz_3 = 0.35/(del_t_3*1000) \n", + "print \" \\n\\nThird case\" \n", + "print \" \\nBit rate for nrz in BITS/sec= \",int(Bt_nrz_3) \n", + "print \" \\nBit rate for rz in BITS/sec= \",Bt_rz_3 \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First case.\n", + " \n", + "Bit rate for nrz in Mb/sec= 0.7\n", + " \n", + "Bit rate for rz in Mb/sec= 0.35\n", + " \n", + "\n", + "Second case\n", + " \n", + "Bit rate for nrz in Mb/sec= 0.035\n", + " \n", + "Bit rate for rz in Mb/sec= 0.0175\n", + " \n", + "\n", + "Third case\n", + " \n", + "Bit rate for nrz in BITS/sec= 174\n", + " \n", + "Bit rate for rz in BITS/sec= 87.5\n" + ] + } + ], + "prompt_number": 31 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/Chapter1.ipynb b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter1.ipynb new file mode 100755 index 00000000..ec323da9 --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter1.ipynb @@ -0,0 +1,1240 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:742c44cb267900361b88ee7b473acd2b1b40f32a4db7e15db6918955b1159df0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter01:Fiber Optics Communications System" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "\n", + "Ex1.7.1:Pg-1.14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "n1= 1.5 # for glass\n", + "n2= 1.33 # for water\n", + "phi1= (math.pi/6) # phi1 is the angel of incidence\n", + " # According to Snell's law...\n", + " # n1*sin(phi1)= n2*sin(phi2) \n", + "sinphi2= (n1/n2)*math.sin(phi1) # phi2 is the angle of refraction..\n", + "phi2 = math.asin(sinphi2)\n", + "temp= math.degrees(phi2)\n", + "print \" The angel of refraction in degrees =\",round(temp,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The angel of refraction in degrees = 34.33\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.7.2:Pg-1.14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "n1= 1.50 # RI of glass..\n", + "n2 = 1.0 # RI of air...\n", + " # According to Snell's law...\n", + " # n1*sin(phi1)= n2*sin(phi2) \n", + " # From definition of critical angel phi2 = 90 degrees and phi1 will be critical angel\n", + "t1=(n2/n1)*math.sin(math.pi/2)\n", + "phiC=math.asin(t1)\n", + "temp= math.degrees(phiC)\n", + "print \" The Critical angel in degrees =\",round(temp,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Critical angel in degrees = 41.81\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.7.3:Pg-1.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + " # To find RI of glass\n", + " # To find the critical angle for glass...\n", + " \n", + "phi1 = 33 # Angle of incidence..\n", + "phi2 = 90 # Angle of refraction..\n", + "n2= 1.0 \n", + "\n", + "n1 = round(sin(math.radians(phi2))/sin(math.radians(phi1)),3) \n", + "print \" The Refractive Index is =\",n1 \n", + "\n", + "#phiC = math.asin((n2/n1)*math.sin(90)) \n", + "phiC=math.asin(0.54)\n", + "print \" \\n\\nThe Critical angel in degrees =\",round(math.degrees(phiC),2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Refractive Index is = 1.836\n", + " \n", + "\n", + "The Critical angel in degrees = 32.68\n" + ] + } + ], + "prompt_number": 81 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.7.4:Pg-1.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + "import math\n", + " \n", + "n1= 1.5 # TheRi of medium 1\n", + "n2= 1.36 # the RI of medium 2\n", + "phi1= 30 # The angle of incidence\n", + " # According to Snell's law...\n", + " # n1*sin(phi1)= n2*sin(phi2) \n", + "phi2 = math.asin((n1/n2)*math.sin(math.radians(phi1))) \n", + "print \" The angel of refraction is in degrees from normal = \",round(math.degrees(phi2),2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The angel of refraction is in degrees from normal = 33.47\n" + ] + } + ], + "prompt_number": 91 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.7.5:Pg-1.16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + " \n", + "n1 = 3.6 # RI of GaAs..\n", + "n2 = 3.4 # RI of AlGaAs..\n", + "phi1 = 80 # Angle of Incidence..\n", + " # According to Snell's law...\n", + " # n1*sin(phi1)= n2*sin(phi2) \n", + " # At critical angle phi2 = 90...\n", + "phiC = math.asin((n2/n1)*sin(math.radians(90)) )\n", + "print \" The Critical angel in degrees =\",round(math.degrees(phiC),2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Critical angel in degrees = 70.81\n" + ] + } + ], + "prompt_number": 97 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.1:Pg-1.22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math \n", + "\n", + "n1= 1.5 # RI of medium 1\n", + "n2 =1.45 # RI of medium 2\n", + "\n", + "delt= (n1-n2)/n1 \n", + "NA = n1*(math.sqrt(2*delt)) \n", + "print \" The Numerical aperture =\",round(NA,2)\n", + "phiA = math.asin(NA) \n", + "print \" \\n\\nThe Acceptance angel in degrees =\",round(math.degrees(phiA),2) \n", + "\n", + "phiC = math.asin(n2/n1) \n", + "print \" \\n\\nThe Critical angel in degrees =\",round(degrees(phiC),2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical aperture = 0.39\n", + " \n", + "\n", + "The Acceptance angel in degrees = 22.79\n", + " \n", + "\n", + "The Critical angel in degrees = 75.16\n" + ] + } + ], + "prompt_number": 100 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.2:Pg-1.23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "n1= 1.5 # RI of core\n", + "n2 = 1.48 # RI of cladding..\n", + "\n", + "NA = math.sqrt((n1**2)-(n2**2)) \n", + "print \" The Numerical Aperture =\",round(NA,2) \n", + "\n", + "phiA = math.asin(NA) \n", + "print \" \\n\\nThe Critical angel =\",round(math.degrees(phiA),2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture = 0.24\n", + " \n", + "\n", + "The Critical angel = 14.13\n" + ] + } + ], + "prompt_number": 101 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.3:Pg-1.23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math \n", + " \n", + "\n", + "NA = 0.35 # Numerical Aperture\n", + "delt = 0.01 \n", + " # NA= n1*(math.sqrt(2*delt) n1 is RI of core\n", + "n1 = 0.35/(math.sqrt(2*delt)) \n", + "print \"The RI of core =\",round(n1,4) \n", + "\n", + " # Numerical Aperture is also given by \n", + " # NA = math.sqrt(n1**2 - n2**2) # n2 is RI of cladding\n", + "n2 = math.sqrt((n1**2-NA**2)) \n", + "print \" \\n\\nThe RI of Cladding =\",round(n2,3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The RI of core = 2.4749\n", + " \n", + "\n", + "The RI of Cladding = 2.45\n" + ] + } + ], + "prompt_number": 104 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.4:Pg-1.24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "Vc = 2.01*10**8 # velocity of light in core in m/sec...\n", + "phiC= 80.0 # Critical angle in degrees...\n", + "\n", + " # RI of Core (n1) is given by (Velocity of light in air/ velocity of light in air)...\n", + "n1= 3*10**8/Vc \n", + " # From critical angle and the value of n1 we calculate n2...\n", + "n2 = sin(math.radians(phiC))*n1 # RI of cladding...\n", + "NA = math.sqrt(n1**2-n2**2) \n", + "print \" The Numerical Aperture =\",round(NA,2) \n", + "phiA = math.asin(NA) # Acceptance angle...\n", + "print \" \\n\\nThe Acceptance angel in degrees =\",round(math.degrees(phiA),2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture = 0.26\n", + " \n", + "\n", + "The Acceptance angel in degrees = 15.02\n" + ] + } + ], + "prompt_number": 106 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.5:Pg-1.25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "n1 = 1.4 # RI of Core..\n", + "n2 = 1.35 # RI of Cladding\n", + "\n", + "phiC = math.asin(n2/n1) # Critical angle..\n", + "print \" The Critical angel in degrees =\",round(math.degrees(phiC),2) \n", + "\n", + "NA = math.sqrt(n1**2-n2**2) # numerical Aperture...\n", + "print \" \\n\\nThe Numerical Aperture is =\",round(NA,2) \n", + "\n", + "phiA = math.asin(NA) # Acceptance angle... \n", + "print \" \\n\\nThe Acceptance angel in degrees =\",round(math.degrees(phiA),2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Critical angel in degrees = 74.64\n", + " \n", + "\n", + "The Numerical Aperture is = 0.37\n", + " \n", + "\n", + "The Acceptance angel in degrees = 21.77\n" + ] + } + ], + "prompt_number": 107 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.6:Pg-1.25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "n1 = 1.48 # RI of core..\n", + "n2 = 1.46 # RI of Cladding..\n", + "\n", + "NA = math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", + "print \" The Numerical Aperture is =\",round(NA,3) \n", + "\n", + "theta = math.pi*NA**2 # The entrance angle theta..\n", + "print \" \\n\\nThe Entrance angel in degrees =\",round(theta,3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture is = 0.242\n", + " \n", + "\n", + "The Entrance angel in degrees = 0.185\n" + ] + } + ], + "prompt_number": 110 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.7:Pg-1.26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math \n", + "\n", + "delt = 0.007 # relative refractive index difference \n", + "n1 = 1.45 # RI of core...\n", + "NA = n1* math.sqrt((2*delt)) \n", + "print \" The Numerical Aperture is =\",round(NA,4) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture is = 0.1716\n" + ] + } + ], + "prompt_number": 112 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.9.8:Pg-1.26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + "import math\n", + "\n", + "phiA = 8 # accepatance angle in degrees...\n", + "n1 =1.52 # RI of core...\n", + "\n", + "NA = sin(math.radians(phiA)) # Numerical Aperture...\n", + "\n", + "delt = NA**2/(2*(n1**2)) # Relative RI difference...\n", + "print \" The relative refractive index difference =\",round(delt,5) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The relative refractive index difference = 0.00419\n" + ] + } + ], + "prompt_number": 114 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "\n", + "Ex1.9.9:Pg-1.27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "delt = 0.01 # relative RI difference..\n", + "n1 = 1.48 # RI of core...\n", + "\n", + "NA = n1*(math.sqrt(2*delt)) # Numerical Aperture..\n", + "print \" The Numerical Aperture =\",round(NA,3) \n", + "\n", + "theta = math.pi*NA**2 # Solid Acceptance angle...\n", + "print \" \\n\\nThe Solid Acceptance angel in degrees =\",round(theta,4) \n", + "\n", + "n2 = (1-delt)*n1 \n", + "phiC = math.asin(n2/n1) # Critical Angle...\n", + "print \" \\n\\nThe Critical angel in degrees =\",round(math.degrees(phiC),2) \n", + "print \" \\n\\nCritical angle wrong due to rounding off errors in trignometric functions..\\n Actual value is 90.98 in book.\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture = 0.209\n", + " \n", + "\n", + "The Solid Acceptance angel in degrees = 0.1376\n", + " \n", + "\n", + "The Critical angel in degrees = 81.89\n", + " \n", + "\n", + "Critical angle wrong due to rounding off errors in trignometric functions..\n", + " Actual value is 90.98 in book.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.1:Pg-1.41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "d = 50*10**-6 # diameter of fibre...\n", + "n1 = 1.48 # RI of core..\n", + "n2 = 1.46 # RI of cladding..\n", + "lamda = 0.82*10**-6 # wavelength of light..\n", + "\n", + "NA = math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", + "Vn= math.pi*d*NA/lamda # normalised frequency...\n", + "M = Vn**2/2 # number of modes...\n", + "print \" The number of modes in the fibre are =\",int(M) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number of modes in the fibre are = 1078\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.2:Pg-1.42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + " \n", + " \n", + "V = 26.6 # Normalised frequency..\n", + "lamda = 1300*10**-9 # wavelenght of operation\n", + "a = 25*10**-6 # radius of fibre.\n", + "NA = V*lamda/(2*math.pi*a) # Numerical Aperture..\n", + "print \" The Numerical Aperture =\",round(NA,3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture = 0.22\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.3:Pg-1.43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + " \n", + "a = 40*10**-6 # radius of core...\n", + "delt = 0.015 # relative RI difference..\n", + "lamda= 0.85*10**-6 # wavelength of operation..\n", + "n1=1.48 # RI of core..\n", + "\n", + "NA = n1*math.sqrt(2*delt) # Numerical Aperture..\n", + "print \" The Numerical Aperture =\", round(NA,4) \n", + "V = 2*math.pi*a*NA/lamda # normalised frequency\n", + "print \" \\n\\nThe Normalised frequency =\",round(V,2) \n", + "\n", + "M = V**2/2 # number of modes..\n", + "print \" \\n\\nThe number of modes in the fibre are =\",int(M) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture = 0.2563\n", + " \n", + "\n", + "The Normalised frequency = 75.8\n", + " \n", + "\n", + "The number of modes in the fibre are = 2872\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.4:Pg-1.43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "NA = 0.20 # Numerical Aperture..\n", + "M = 1000 # number of modes..\n", + "lamda = 850*10**-9 # wavelength of operation..\n", + "\n", + "a = math.sqrt(M*2*lamda**2/(math.pi**2*NA**2)) # radius of core..\n", + "a=a*10**6 # converting in um for displaying...\n", + "print \" The radius of the core in um =\",round(a,2) \n", + "a=a*10**-6 \n", + "M1= ((math.pi*a*NA/(1320*10**-9))**2)/2\n", + "print \" \\n\\nThe number of modes in the fibre at 1320um =\",int(M1) \n", + "print \" \\n\\n***The number of modes in the fibre at 1320um is calculated wrongly in book\" \n", + "M2= ((math.pi*a*NA/(1550*10**-9))**2)/2\n", + "print \" \\n\\nThe number of modes in the fibre at 1550um =\",int(M2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The radius of the core in um = 60.5\n", + " \n", + "\n", + "The number of modes in the fibre at 1320um = 414\n", + " \n", + "\n", + "***The number of modes in the fibre at 1320um is calculated wrongly in book\n", + " \n", + "\n", + "The number of modes in the fibre at 1550um = 300\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.5:Pg-1.44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + " \n", + "NA = 0.2 # Numerical Aperture..\n", + "n2= 1.59 # RI of cladding..\n", + "n0= 1.33 # RI of water..\n", + "lamda = 1300*10**-9 # wavelength..\n", + "a = 25*10**-6 # radius of core..\n", + "n1 = math.sqrt(NA**2+n2**2) # RI of core..\n", + "phiA= math.asin(math.sqrt(n1**2-n2**2)/n0) # Acceptance angle..\n", + "print \" The Acceptance angle is =\",round(math.degrees(phiA),2) \n", + "\n", + "phiC= math.asin(n2/n1) # Critical angle..\n", + "print \" \\n\\nThe critical angle is =\",round(math.degrees(phiC),2) \n", + "V = 2*math.pi*a*NA/lamda # normalisd frequency\n", + "M= V**2/2 # number of modes\n", + "print \" \\n\\nThe number of modes in the fibre are =\",int(M) \n", + "\n", + "print \" \\n\\n***The value of the angle differ from the book because of round off errors.\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Acceptance angle is = 8.65\n", + " \n", + "\n", + "The critical angle is = 82.83\n", + " \n", + "\n", + "The number of modes in the fibre are = 292\n", + " \n", + "\n", + "***The value of the angle differ from the book because of round off errors.\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.6:Pg-1.46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "V= 26.6 # Normalised frequency..\n", + "lamda= 1300*10**-9 # wavelength of operation..\n", + "a= 25*10**-6 # radius of core..\n", + "\n", + "NA = V*lamda/(2*math.pi*a) # Numerical Aperture..\n", + "print \" The Numerical Aperture =\",round(NA,2) \n", + "theta = math.pi*NA**2 # solid Acceptance Angle..\n", + "print \" \\n\\nThe solid acceptance angle in radians =\",round(theta,3) \n", + "\n", + "M= V**2/2 # number of modes..\n", + "print \" \\n\\nThe number of modes in the fibre =\",round(M,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture = 0.22\n", + " \n", + "\n", + "The solid acceptance angle in radians = 0.152\n", + " \n", + "\n", + "The number of modes in the fibre = 353.78\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.7:Pg-1.47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math \n", + "\n", + "n1= 1.49 # RI of core.\n", + "n2=1.47 # RI of cladding..\n", + "a= 2 # radius of core in um..\n", + "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", + " # The maximum V number for single mode operation is 2.4...\n", + "V= 2.4 # Normalised frequency..\n", + "\n", + "lamda = 2*math.pi*a*NA/V # Cutoff wavelength...\n", + "print \" The cutoff wavelength in um =\",round(lamda,2) \n", + "\n", + "\n", + "lamda1 = 1.310 # Givenn cutoff wavelength in um..\n", + "d= V*lamda1/(math.pi*NA) # core diameter..\n", + "print \" \\n\\nThe core diameter in um =\",round(d,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The cutoff wavelength in um = 1.27\n", + " \n", + "\n", + "The core diameter in um = 4.11\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.8:Pg-1.47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + "import math\n", + " \n", + "n1= 1.48 # RI of core..\n", + "a= 4.5 # core radius in um..\n", + "delt= 0.0025 # Relative RI difference..\n", + "V= 2.405 # For step index fibre..\n", + "lamda= (2*math.pi*a*n1*math.sqrt(2*delt))/V # cutoff wavelength..\n", + "print \" The cutoff wavelength in um =\",round(lamda,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The cutoff wavelength in um = 1.23\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.9:Pg-1.48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math \n", + " \n", + "lamda= 0.82*10**-6 # wavelength ofoperation.\n", + "a= 2.5*10**-6 # Radius of core..\n", + "n1= 1.48 # RI of core..\n", + "n2= 1.46 # RI of cladding\n", + "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", + "V= 2*math.pi*a*NA/lamda # Normalisd frequency..\n", + "print \" The normalised frequency =\",round(V,3) \n", + "M= V**2/2 # The number of modes..\n", + "print \" \\n\\nThe number of modes in the fibre are =\",round(M,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The normalised frequency = 4.645\n", + " \n", + "\n", + "The number of modes in the fibre are = 10.79\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.10:Pg-1.49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + "import math\n", + " \n", + "delt= 0.01 # Relative RI difference..\n", + "n1= 1.5 \n", + "M= 1100 # Number of modes...\n", + "lamda= 1.3 # wavelength of operation in um..\n", + "V= math.sqrt(2*M) # Normalised frequency...\n", + "d= V*lamda/(math.pi*n1*math.sqrt(2*delt)) # diameter of core..\n", + "print \" The diameter of the core in um =\",round(d,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The diameter of the core in um = 91.5\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.11:Pg-1.50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "n1= 1.5 # RI of core..\n", + "n2= 1.38 # RI of cladding..\n", + "a= 25*10**-6 # radius of core..\n", + "lamda= 1300*10**-9 # wavelength of operation...\n", + "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", + "print \" The Numerical Aperture of the given fibre =\",round(NA,4) \n", + "V= 2*math.pi*a*NA/lamda # Normalised frequency..\n", + "print \" \\n\\nThe normalised frequency =\",round(V,2) \n", + "theta= math.asin(NA) # Solid acceptance anglr..\n", + "print \" \\n\\nThe Solid acceptance angle in degrees =\",int(math.degrees(theta)) \n", + "M= V**2/2 # Number of modes..\n", + "print \" \\n\\nThe number of modes in the fibre are =\",int(M) \n", + "print \" \\n\\n***Number of modes wrongly calculated in the book..\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Numerical Aperture of the given fibre = 0.5879\n", + " \n", + "\n", + "The normalised frequency = 71.03\n", + " \n", + "\n", + "The Solid acceptance angle in degrees = 36\n", + " \n", + "\n", + "The number of modes in the fibre are = 2522\n", + " \n", + "\n", + "***Number of modes wrongly calculated in the book..\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.14.12:Pg-1.51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "lamda= 850*10**-9 # wavelength of operation.\n", + "a= 25*10**-6 # Radius of core\n", + "n1= 1.48 # RI of Core...\n", + "n2= 1.46 # RI of cladding..\n", + "\n", + "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture\n", + "\n", + "V= 2*math.pi*a*NA/lamda # Normalised frequency..\n", + "print \" The normalised frequency =\",round(V,2) \n", + "\n", + "lamda1= 1320*10**-9 # wavelength changed...\n", + "V1= 2*math.pi*a*NA/lamda1 # Normalised frequency at new wavelength..\n", + "\n", + "M= V1**2/2 # Number of modes at new wavelength..\n", + "print \" \\n\\nThe number of modes in the fibre at 1320um =\",int(M) \n", + "lamda2= 1550*10**-9 # wavelength 2...\n", + "V2= 2*math.pi*a*NA/lamda2 # New normalised frequency..\n", + "M1= V2**2/2 # number of modes..\n", + "print \" \\n\\nThe number of modes in the fibre at 1550um =\",int(M1 )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The normalised frequency = 44.81\n", + " \n", + "\n", + "The number of modes in the fibre at 1320um = 416\n", + " \n", + "\n", + "The number of modes in the fibre at 1550um = 301\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.15.1:Pg-1.56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + " \n", + "n1= 1.48 # RI of core..\n", + "delt= 0.015 # relative RI differencr..\n", + "lamda= 0.85 # wavelength of operation..\n", + "V= 2.4 # for single mode of operation..\n", + "\n", + "a= V*lamda/(2*math.pi*n1*math.sqrt(2*delt)) # radius of core..\n", + "print \" The raduis of core in um =\",round(a,2) \n", + "print \" \\n\\nThe maximum possible core diameter in um =\",round(2*a,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The raduis of core in um = 1.27\n", + " \n", + "\n", + "The maximum possible core diameter in um = 2.53\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.15.2:Pg-1.56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + "import math\n", + " \n", + "n1= 1.5 # RI of core..\n", + "delt= 0.01 # Relative RI difference...\n", + "lamda= 1.3 # Wavelength of operation...\n", + "V= 2.4*math.sqrt(2) # Maximum value of V for GRIN...\n", + "a= V*lamda/(2*math.pi*n1*math.sqrt(2*delt)) # radius of core..\n", + "print \" The radius of core in um =\",round(a,2) \n", + "print \" \\n\\nThe maximum possible core diameter in um =\",round(2*a,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The radius of core in um = 3.31\n", + " \n", + "\n", + "The maximum possible core diameter in um = 6.62\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1.15.3:Pg-1.56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "n1= 1.46 # RI of core..\n", + "a = 4.5 # radius of core in um..\n", + "delt= 0.0025 # relative RI difference..\n", + "V= 2.405 # Normalisd frequency for single mode..\n", + "lamda= 2*math.pi*a*n1*math.sqrt(2*delt)/V # cutoff wavelength...\n", + "print \" The cut off wavelength for the given fibre in um =\",round(lamda,3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The cut off wavelength for the given fibre in um = 1.214\n" + ] + } + ], + "prompt_number": 31 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/Chapter2.ipynb b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter2.ipynb new file mode 100755 index 00000000..46a8893c --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter2.ipynb @@ -0,0 +1,945 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:211878047ac07bbe36923a59422db9a2025fd46f216dee8cd476326a7778bb6a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter02: Optical Fiber for Telecommunication" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + " Ex2.2.1:Pg-2.4" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "alpha= 3 # average loss Power decreases by 50% so P(0)/P(z)= 0.5\n", + "lamda= 900*10**-9 # wavelength\n", + "z= 10*math.log10(0.5)/alpha # z is the length\n", + "z= z*-1 \n", + "print \" The length over which power decreases by 50% in Kms= \",round(z,2) \n", + "\n", + "z1= 10*math.log10(0.25)/alpha # Power decreases by 75% so P(0)/P(z)= 0.25\n", + "z1=z1*-1 # as distance cannot be negative...\n", + "print \" \\n\\nThe length over which power decreases by 75% in Kms= \",round(z1,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The length over which power decreases by 50% in Kms= 1.0\n", + " \n", + "\n", + "The length over which power decreases by 75% in Kms= 2.01\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.2.2:Pg-2.5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "\n", + "z=30.0 # Length of the fibre in kms\n", + "alpha= 0.8 # in dB\n", + "P0= 200.0 # Power launched in uW\n", + "pz= P0/10**(alpha*z/10) \n", + "print \" The output power in uW =\",round(pz,4) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The output power in uW = 0.7962\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.2.3:Pg-2.6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math \n", + "\n", + "z=8.0 # fibre length\n", + "p0= 120*10**-6 # power launched\n", + "pz= 3*10**-6 \n", + "alpha= 10*math.log10(p0/pz) # overall attenuation\n", + "print \" The overall attenuation in dB =\",round(alpha,2) \n", + "alpha = alpha/z # attenuation per km\n", + "alpha_new= alpha *10 # attenuation for 10kms\n", + "total_attenuation = alpha_new + 9 # 9dB because of splices\n", + "print \" \\n\\nThe total attenuation in dB =\",int(total_attenuation) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The overall attenuation in dB = 16.02\n", + " \n", + "\n", + "The total attenuation in dB = 29\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.2.4:Pg-2.6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " # Given\n", + " \n", + "z=12.0 # fibre length\n", + "alpha = 1.5 \n", + "p0= 0.3 \n", + "pz= p0/10**(alpha*z/10) \n", + "pz=pz*1000 # formatting pz in nano watts...\n", + "print \" The power at the output of the cable in W = \",round(pz,2),\"x 10^-9\" \n", + "alpha_new= 2.5 \n", + "pz=pz/1000 # pz in uWatts...\n", + "p0_new= 10**(alpha_new*z/10)*pz \n", + "print \" \\n\\nThe Input power in uW= \",round(p0_new,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The power at the output of the cable in W = 4.75 x 10^-9\n", + " \n", + "\n", + "The Input power in uW= 4.75\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.2.5:Pg-2.7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "\n", + "p0=150*10**-6 # power input\n", + "z= 10.0 # fibre length in km\n", + "pz= -38.2 # in dBm...\n", + "pz= 10**(pz/10)*1*10**-3 \n", + "alpha_1= 10/z *math.log10(p0/pz) # attenuation in 1st window\n", + "print \" Attenuation is 1st window in dB/Km =\",round(alpha_1,2) \n", + "alpha_2= 10/z *math.log10(p0/(47.5*10**-6)) # attenuation in 2nd window\n", + "print \" \\n\\nAttenuation is 2nd window in dB/Km =\",round(alpha_2,2) \n", + "alpha_3= 10/z *math.log10(p0/(75*10**-6)) # attenuation in 3rd window\n", + "print \" \\n\\nAttenuation is 3rd window in dB/Km =\",round(alpha_3,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Attenuation is 1st window in dB/Km = 3.0\n", + " \n", + "\n", + "Attenuation is 2nd window in dB/Km = 0.5\n", + " \n", + "\n", + "Attenuation is 3rd window in dB/Km = 0.3\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "\n", + "Ex2.2.6:Pg-2.8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "p0=3*10**-3 \n", + "pz=3*10**-6 \n", + "alpha= 0.5 \n", + "z= math.log10(p0/pz)/(alpha/10) \n", + "print \" The Length of the fibre in Km =\",int(z)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Length of the fibre in Km = 60\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.2.7:Pg-2.9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "z= 10.0 \n", + "p0= 100*10**-6 # input power\n", + "pz=5*10**-6 # output power\n", + "alpha = 10*math.log10(p0/pz) # total attenuation\n", + "print \" The overall signal attenuation in dB = \",round(alpha,2) \n", + "alpha = alpha/z # attenuation per km\n", + "print \" \\n\\nThe attenuation per Km in dB/Km = \",round(alpha,2)\n", + "z_new = 12.0 \n", + "splice_attenuation = 11*0.5 \n", + "cable_attenuation = alpha*z_new \n", + "total_attenuation = splice_attenuation+cable_attenuation \n", + "print \" \\n\\nThe overall signal attenuation for 12Kms in dB = \",round(total_attenuation,1) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The overall signal attenuation in dB = 13.01\n", + " \n", + "\n", + "The attenuation per Km in dB/Km = 1.3\n", + " \n", + "\n", + "The overall signal attenuation for 12Kms in dB = 21.1\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.2.8:Pg-2.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Tf = 1400.0 # fictive temperature\n", + "BETA = 7*10**-11 \n", + "n= 1.46 # RI \n", + "p= 0.286 # photo elastic constant\n", + "Kb = 1.381*10**-23 # Boltzmann's constant\n", + "lamda = 850*10**-9 # wavelength\n", + "alpha_scat = 8*math.pi**3*n**8*p**2*Kb*Tf*BETA/(3*lamda**4) \n", + "l= 1000 # fibre length\n", + "TL = exp(-alpha_scat*l) # transmission loss\n", + "attenuation = 10*math.log10(1/TL) \n", + "print \" The attenuation in dB/Km =\",round(attenuation,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The attenuation in dB/Km = 1.572\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.3.1:Pg-2.20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "alpha = 2 \n", + "n1= 1.5 \n", + "a= 25*10**-6 \n", + "lamda= 1.3*10**-6 \n", + "M= 0.5 \n", + "NA= math.sqrt(0.5*2*1.3**2/(math.pi**2*25**2)) \n", + "Rc= 3*n1**2*lamda/(4*math.pi*NA**3) \n", + "Rc=Rc*1000 # converting into um.....\n", + "print \" The radius of curvature in um =\",round(Rc,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The radius of curvature in um = 153.98\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.5.1:Pg-2.25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "lamda = 850 *10**-9 \n", + "sigma= 45*10**-9 \n", + "L= 1 \n", + "M= 0.025/(3*10**5*lamda) \n", + "sigma_m= sigma*L*M \n", + "sigma_m= sigma_m*10**9 # formatting in ns/km....\n", + "print \" The Pulse spreading in ns/Km =\",round(sigma_m,2) \n", + "print \" \\n\\nNOTE*** - The answer in text book is wrongly calculated..\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Pulse spreading in ns/Km = 4.41\n", + " \n", + "\n", + "NOTE*** - The answer in text book is wrongly calculated..\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.5.2:Pg-2.26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "lamda= 2*10**-9 \n", + "sigma = 75 \n", + "D_mat= 0.03/(3*10**5*2) \n", + "sigma_m= 2*1*D_mat \n", + "sigma_m=sigma_m*10**9 # Fornamtting in ns/Km\n", + "print \" The Pulse spreading in ns/Km =\",int(sigma_m)\n", + "D_mat_led= 0.025/(3*10**5*1550) \n", + "sigma_m_led = 75*1*D_mat_led*10**9 # in ns/Km\n", + "print \" \\n\\nThe Pulse spreading foe LED is ns/Km =\",round(sigma_m_led,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Pulse spreading in ns/Km = 100\n", + " \n", + "\n", + "The Pulse spreading foe LED is ns/Km = 4.03\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.5.3:Pg-2.26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "lamda = 850 \n", + "sigma= 20 \n", + "D_mat = 0.055/(3*10**5*lamda) \n", + "sigma_m= sigma*1*D_mat \n", + "D_mat=D_mat*10**12 # in Ps...\n", + "sigma_m=sigma_m*10**9 # in ns # # \n", + "print \" The material Dispersion in Ps/nm-Km =\",round(D_mat,2) \n", + "print \" \\n\\nThe Pulse spreading in ns/Km =\",round(sigma_m,4) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The material Dispersion in Ps/nm-Km = 215.69\n", + " \n", + "\n", + "The Pulse spreading in ns/Km = 4.3137\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.5.4:Pg-2.30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "n2= 1.48 \n", + "dele = 0.2 \n", + "lamda = 1320 \n", + "Dw = -n2*dele*0.26/(3*10**5*lamda) \n", + "Dw=Dw*10**10 # converting in math.picosecs....\n", + "print \" The waveguide dispersion in math.picosec/nm.Km =\",round(Dw,3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The waveguide dispersion in math.picosec/nm.Km = -1.943\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.6.1:Pg-2.34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "t= 0.1*10**-6 \n", + "L= 12 \n", + "B_opt= 1/(2*t) \n", + "B_opt=B_opt/1000000 # converting from Hz to MHz\n", + "print \" The maximum optical bandwidth in MHz. =\",int(B_opt) \n", + "dele= t/L # Pulse broadening\n", + "dele=dele*10**9 # converting in ns...\n", + "print \" \\n\\nThe pulse broadening per unit length in ns/Km =\",round(dele,2) \n", + "BLP= B_opt*L # BW length product\n", + "print \" \\n\\nThe Bandwidth-Length Product in MHz.Km =\",int(BLP) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum optical bandwidth in MHz. = 5\n", + " \n", + "\n", + "The pulse broadening per unit length in ns/Km = 8.33\n", + " \n", + "\n", + "The Bandwidth-Length Product in MHz.Km = 60\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.6.2:Pg-2.34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "t= 0.1*10**-6 \n", + "L= 10.0 \n", + "B_opt= 1/(2*t) \n", + "B_opt=B_opt/1000000 # converting from Hz to MHz\n", + "print \" The maximum optical bandwidth in MHz. =\",int(B_opt) \n", + "dele= t/L \n", + "dele=dele/10**-6 # converting in us...\n", + "print \" \\n\\nThe dispersion per unit length in us/Km =\",round(dele,2) \n", + "BLP= B_opt*L \n", + "print \" \\n\\nThe Bandwidth-Length product in MHz.Km =\",int(BLP) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum optical bandwidth in MHz. = 5\n", + " \n", + "\n", + "The dispersion per unit length in us/Km = 0.01\n", + " \n", + "\n", + "The Bandwidth-Length product in MHz.Km = 50\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.6.3:Pg-2.35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "t= 0.1*10**-6 \n", + "L=15 \n", + "B_opt= 1/(2*t) \n", + "B_opt=B_opt/1000000 # converting from Hz to MHz\n", + "print \" The maximum optical bandwidth in MHz. =\",int(B_opt) \n", + "dele= t/L*10**9 # in ns...\n", + "print \" \\n\\nThe dispersion per unit length in ns/Km =\",round(dele,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum optical bandwidth in MHz. = 5\n", + " \n", + "\n", + "The dispersion per unit length in ns/Km = 6.67\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.6.4:Pg-2.35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "lamda = 0.85*10**-6 \n", + "rms_spect_width = 0.0012*lamda \n", + "sigma_m= rms_spect_width*1*98.1*10**-3 \n", + "sigma_m=sigma_m*10**9 # converting in ns...\n", + "print \" The Pulse Broadening due to material dispersion in ns/Km =\",round(sigma_m,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Pulse Broadening due to material dispersion in ns/Km = 0.1\n" + ] + } + ], + "prompt_number": 43 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.6.5:Pg-2.35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "L= 5.0 # in KM\n", + "n1= 1.5 \n", + "dele= 0.01 \n", + "c= 3*10**8 # in m/s\n", + "delta_t = (L*n1*dele)/c \n", + "delta_t=delta_t*10**12 # convertin to nano secs...\n", + "print \" The delay difference in ns =\",round(delta_t,1)\n", + "sigma= L*n1*dele/(2*math.sqrt(3)*c) \n", + "sigma=sigma*10**12 # convertin to nano secs...\n", + "print \" \\n\\nThe r.m.s pulse broadening in ns =\",round(sigma,2) \n", + "B= 0.2/sigma*1000 # in Mz\n", + "print \" \\n\\nThe maximum bit rate in MBits/sec =\",round(B,2) \n", + "BLP = B*5 \n", + "print \" \\n\\nThe Bandwidth-Length in MHz.Km =\",round(BLP,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The delay difference in ns = 250.0\n", + " \n", + "\n", + "The r.m.s pulse broadening in ns = 72.17\n", + " \n", + "\n", + "The maximum bit rate in MBits/sec = 2.77\n", + " \n", + "\n", + "The Bandwidth-Length in MHz.Km = 13.86\n" + ] + } + ], + "prompt_number": 47 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.6.6:Pg-2.36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "del_t_inter = 5*1 \n", + "del_t_intra = 50*80*1 \n", + "total_dispersion = math.sqrt(5**2 + 0.4**2) \n", + "print \" Total dispersion in ns =\",round(total_dispersion,3) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total dispersion in ns = 5.016\n" + ] + } + ], + "prompt_number": 49 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.7.1:Pg-2.37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "t= 0.1*10**-6 \n", + "L=15 \n", + "dele= t/L*10**9 # convertin to nano secs...\n", + "print \" The Pulse Dispersion in ns =\",round(dele,2) \n", + "B_opt= 1/(2*t)/10**6 # convertin to nano secs...\n", + "print \" \\n\\n The maximum possible Bandwidth in MHz =\",int(B_opt) \n", + "BLP = B_opt*L \n", + "print \" \\n\\nThe BandwidthLength product in MHz.Km =\",int(BLP) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Pulse Dispersion in ns = 6.67\n", + " \n", + "\n", + " The maximum possible Bandwidth in MHz = 5\n", + " \n", + "\n", + "The BandwidthLength product in MHz.Km = 75\n" + ] + } + ], + "prompt_number": 51 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.7.2:Pg-2.38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "L= 6 \n", + "n1= 1.5 \n", + "delt= 0.01 \n", + "delta_t = L*n1*delt/(3*10**8)*10**12 # convertin to nano secs...\n", + "print \" The delay difference in ns =\",int(delta_t) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The delay difference in ns = 300\n" + ] + } + ], + "prompt_number": 52 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.7.3:Pg-2.39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Lb= 0.09 \n", + "lamda= 1.55*10**-6 \n", + "delta_lamda = 1*10**-9 \n", + "Bf= lamda/Lb \n", + "Lbc= lamda**2/(Bf*delta_lamda) \n", + "print \" The modal Bifriengence in meters =\",round(Lbc,2) \n", + "beta_xy= 2*math.pi/Lb \n", + "print \" \\n\\nThe difference between propogation constants =\",round(beta_xy,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The modal Bifriengence in meters = 139.5\n", + " \n", + "\n", + "The difference between propogation constants = 69.81\n" + ] + } + ], + "prompt_number": 53 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.7.4:Pg-2.39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "t= 0.1*10**-6 \n", + "B_opt= 1/(2*t)/1000000 \n", + "print \" The maximum possible Bandwidth in MHz =\",int(B_opt) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum possible Bandwidth in MHz = 5\n" + ] + } + ], + "prompt_number": 54 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2.7.5:Pg-2.40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "t= 0.1*10**-6 \n", + "B_opt= 1/(2*t)/1000000 \n", + "print \" The maximum possible Bandwidth in MHz =\",int(B_opt) \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum possible Bandwidth in MHz = 5\n" + ] + } + ], + "prompt_number": 55 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/Chapter3.ipynb b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter3.ipynb new file mode 100755 index 00000000..1e7a6431 --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter3.ipynb @@ -0,0 +1,826 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1c5868fa547e8a659e03148d4a7bf0c9a34282713a490e0b68c5b0aa98a2f7e8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter03:Optical Sources and Transmitters" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.1:Pg-3.10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "x= 0.07 \n", + "Eg= 1.424+1.266*x+0.266*x**2 \n", + "lamda= 1.24/Eg \n", + "print \" The emitted wavelength in um =\",round(lamda,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The emitted wavelength in um = 0.82\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.2:Pg-3.10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "x= 0.26 \n", + "y=0.57 \n", + "Eg= 1.35-0.72*y+0.12*y**2 \n", + "lamda = 1.24/Eg \n", + "print \" The wavelength emitted in um =\",round(lamda,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The wavelength emitted in um = 1.27\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.3:Pg-3.12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "Tr = 60*10**-9 # radiative recombination time\n", + "Tnr= 90*10**-9 # non radiative recomb time\n", + "I= 40*10**-3 # current\n", + "t = Tr*Tnr/(Tr+Tnr) # total recomb time\n", + "t=t*10**9 # Converting in nano secs...\n", + "print \" The total carrier recombination life time in ns =\",int(t) \n", + "t=t/10**9 \n", + "h= 6.625*10**-34 # plancks const\n", + "c= 3*10**8 \n", + "q=1.602*10**-19 \n", + "lamda= 0.87*10**-6 \n", + "Pint=(t/Tr)*((h*c*I)/(q*lamda)) \n", + "Pint=Pint*1000 # converting inmW...\n", + "print \" \\n\\nThe Internal optical power in mW =\",round(Pint,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The total carrier recombination life time in ns = 36\n", + " \n", + "\n", + "The Internal optical power in mW = 34.22\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.4:Pg-3.13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "lamda = 1310*10**-9 \n", + "Tr= 30*10**-9 \n", + "Tnr= 100*10**-9 \n", + "I= 40*10**-3 \n", + "t= Tr*Tnr/(Tr+Tnr) \n", + "t=t*10**9 # converting in nano secs...\n", + "print \" Bulk recombination life time in ns =\",round(t,2) \n", + "t=t/10**9 \n", + "n= t/Tr \n", + "print \" \\n\\nInternal quantum efficiency =\",round(n,3) \n", + "h= 6.625*10**-34 # plancks const\n", + "c= 3*10**8 \n", + "q=1.602*10**-19 \n", + "Pint=(0.769*h*c*I)/(q*lamda)*1000 \n", + "print \" \\n\\nThe internal power level in mW =\",round(Pint,3) \n", + "print \" \\n\\n***NOTE: Internal Power wrong in text book.. Calculation Error..\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Bulk recombination life time in ns = 23.08\n", + " \n", + "\n", + "Internal quantum efficiency = 0.769\n", + " \n", + "\n", + "The internal power level in mW = 29.131\n", + " \n", + "\n", + "***NOTE: Internal Power wrong in text book.. Calculation Error..\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.5:Pg-3.14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "nx= 3.6 \n", + "TF= 0.68 \n", + "n= 0.3 \n", + " # Pe=Pint*TF*1/(4*nx**2) \n", + " # ne= Pe/Px*100 ..eq0\n", + " # Pe = 0.013*Pint # Eq 1\n", + " # Pint = n*P # Eq 2\n", + " # substitute eq2 and eq1 in eq0\n", + "ne = 0.013*0.3*100 \n", + "print \" The external Power efficiency in % =\",round(ne,3) \n", + " # Wrongly printed in textbook. it should be P instead of Pint in last step\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The external Power efficiency in % = 0.39\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.6:Pg-3.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "lamda= 0.85*10**-6 \n", + "Nint = 0.60 \n", + "I= 20*10**-3 \n", + "h= 6.625*10**-34 # plancks const\n", + "c= 3*10**8 \n", + "e=1.602*10**-19 \n", + "Pint = Nint*h*c*I/(e*lamda) \n", + "print \" The optical power emitted in W =\",round(Pint,4) \n", + "\n", + "TF= 0.68 \n", + "nx= 3.6 \n", + "Pe= Pint*TF/(4*nx**2)*1000000 \n", + "print \" \\n\\nPower emitted in the air in uW =\",round(Pe,1) \n", + "Pe=Pe/1000000 \n", + "Nep=Pe/Pint*100 \n", + "print \" \\n\\nExternal power efficiency in % =\",round(Nep,1) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The optical power emitted in W = 0.0175\n", + " \n", + "\n", + "Power emitted in the air in uW = 229.7\n", + " \n", + "\n", + "External power efficiency in % = 1.3\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.7:Pg-3.16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "lamda = 0.87*10**-6 \n", + "Tr= 50*10**-9 \n", + "I= 0.04 \n", + "Tnr= 110*10**-9 \n", + "t= Tr*Tnr/(Tr+Tnr) \n", + "t=t*10**9 # converting in ns...\n", + "print \" Total carrier recombination life time in ns =\",round(t,2) \n", + "t=t/10**9 \n", + "h= 6.625*10**-34 # plancks const\n", + "c= 3*10**8 \n", + "q=1.602*10**-19 \n", + "n= t/Tr \n", + "print \" \\n\\nThe efficiency in % \",round(n,3) \n", + "Pint=(n*h*c*I)/(q*lamda)*1000 \n", + "print \" \\n\\nInternal power generated in mW =\",round(Pint,2) \n", + "print \" \\n\\n***NOTE- Internal Power wrong in book... \"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total carrier recombination life time in ns = 34.38\n", + " \n", + "\n", + "The efficiency in % 0.688\n", + " \n", + "\n", + "Internal power generated in mW = 39.22\n", + " \n", + "\n", + "***NOTE- Internal Power wrong in book... \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.2.8:Pg-3.16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + " \n", + "\n", + "V= 2 \n", + "I= 100*10**-3 \n", + "Pc= 2*10**-3 \n", + "P= V*I \n", + "Npc= Pc/P*100 \n", + "print \" The overall power conversion efficiency in % =\",int(Npc) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The overall power conversion efficiency in % = 1\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.3.1:Pg-3.25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "r1= 0.32 \n", + "r2= 0.32 \n", + "alpha= 10 \n", + "L= 500*10**-4 \n", + "temp=math.log(1/(r1*r2)) \n", + "Tgth = alpha + (temp/(2*L)) \n", + "print \" The optical gain at threshold in /cm =\",round(Tgth,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The optical gain at threshold in /cm = 32.79\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.3.2:Pg-3.27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + " \n", + "n= 3.7 \n", + "lamda = 950*10**-9 \n", + "L= 500*10**-6 \n", + "c= 3*10**8 \n", + "DELv = c/(2*L*n)*10*10**-10 # converting in GHz...\n", + "print \" The frequency spacing in GHz =\",int(DELv) \n", + "DEL_lamda= lamda**2/(2*L*n)*10**9 # converting to nm..\n", + "print \" \\n\\nThe wavelength spacing in nm =\",round(DEL_lamda,2) \n", + "\n", + "print \" \\n\\n***NOTE- The value of wavelength taken wrongly in book\" \n", + " # value of lamda taken wrongly while soving for DEL_LAMDA inthe book..\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The frequency spacing in GHz = 81\n", + " \n", + "\n", + "The wavelength spacing in nm = 0.24\n", + " \n", + "\n", + "***NOTE- The value of wavelength taken wrongly in book\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.3.3:Pg-3.30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " #Given\n", + " \n", + "L= 0.04 \n", + "n= 1.78 \n", + "lamda= 0.55*10**-6 \n", + "c= 3*10**8 \n", + "q= 2*n*L/lamda \n", + "q=q/10**5 \n", + "print \" Number of longitudinal modes =\",round(q,2),\"x 10^5\" \n", + "del_f= c/(2*n*L) \n", + "del_f=del_f*10**-9 \n", + "print \" \\n\\nThe frequency seperation in GHz =\",round(del_f,1) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Number of longitudinal modes = 2.59 x 10^5\n", + " \n", + "\n", + "The frequency seperation in GHz = 2.1\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.3.4:Pg-3.33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "Nt= 0.18 \n", + "V= 2.5 \n", + "Eg= 1.43 \n", + "Nep= Nt*Eg*100/V \n", + "print \" The total efficiency in % =\",round(Nep,3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The total efficiency in % = 10.296\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.3.5:Pg-3.33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "n= 3.6 \n", + "BETA= 21*10**-3 \n", + "alpha= 10 \n", + "L= 250*10**-4 \n", + "\n", + "r= (n-1)**2/(n+1)**2 \n", + "Jth= 1/BETA *( alpha + (math.log(1/r)/L)) \n", + "Jth=Jth/1000 # converting for displaying...\n", + "print \" The threshold current density =\",round(Jth,3),\"x 10**3\" \n", + "Jth=Jth*1000 \n", + "Ith =Jth*250*100*10**-8 \n", + "Ith=Ith*1000 # converting into mA...\n", + "print \" \\n\\nThe threshold current in mA =\",round(Ith,1) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The threshold current density = 2.65 x 10**3\n", + " \n", + "\n", + "The threshold current in mA = 662.4\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.3.6:Pg-3.34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "T= 305.0 \n", + "T0 = 160.0 \n", + "T1= 373.0\n", + "\n", + "Jth_32 = exp(T/T0) \n", + "Jth_100 = exp(T1/T0) \n", + "R_j = Jth_100/Jth_32 \n", + "print \" Ratio of current densities at 160K is =\",round(R_j,2) \n", + "print \" \\n\\n***NOTE- Wrong in book...\\nJth(100) calculated wrongly...\" \n", + "To = 55 \n", + "Jth_32_new = exp(T/To) \n", + "Jth_100_new = exp(T1/To) \n", + "R_j_new = Jth_100_new/Jth_32_new \n", + "print \" \\n\\nRatio of current densities at 55K is \",round(R_j_new,2) \n", + " # wrong in book...\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Ratio of current densities at 160K is = 1.53\n", + " \n", + "\n", + "***NOTE- Wrong in book...\n", + "Jth(100) calculated wrongly...\n", + " \n", + "\n", + "Ratio of current densities at 55K is 3.44\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.4.1:Pg-3.42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "Bo= 150 \n", + "rs= 35*10**-4 \n", + "a1= 25*10**-6 \n", + "NA= 0.20 \n", + "a2= 50*10**-6 \n", + "\n", + "Pled = (a1/rs)**2 * (math.pi**2*rs**2*Bo*NA**2) \n", + "Pled=Pled*10**10 # converting in uW...\n", + "print \" The power coupled inthe fibre in uW =\",int(Pled) \n", + "Pled_new = (math.pi**2*rs**2*Bo*NA**2) \n", + "Pled_new=Pled_new*10**6 # converting in uW...\n", + "print \" \\n\\nThe Power coupled for case 2 in uW =\",round(Pled_new,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The power coupled inthe fibre in uW = 370\n", + " \n", + "\n", + "The Power coupled for case 2 in uW = 725.42\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.4.2:Pg-3.43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "n= 1.48 \n", + "n1= 3.6 \n", + "R= (n1-n)**2/(n1+n)**2 \n", + "print \" The Fresnel Reflection is \",round(R,4) \n", + "L= -10*math.log10(1-R) \n", + "print \" \\n\\nPower loss in dB =\",round(L,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Fresnel Reflection is 0.1742\n", + " \n", + "\n", + "Power loss in dB = 0.83\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.4.3:Pg-3.44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "NA= 0.20 \n", + "Bo= 150 \n", + "rs= 35*10**-6 \n", + "Pled = math.pi**2*rs**2*Bo*NA**2 \n", + "Pled=Pled*10**10 # convertin in uW for displaying...\n", + "print \" The optical power coupled in uW =\",round(Pled,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The optical power coupled in uW = 725.42\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.4.4:Pg-3.44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "n1= 1.5 \n", + "n=1 \n", + "R= (n1-n)**2/(n1+n)**2 \n", + "L= -10*math.log10(1-R) \n", + " # Total loss is twice due to reflection\n", + "L= L+L \n", + "print \" Total loss due to Fresnel Reflection in dB =\",round(L,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total loss due to Fresnel Reflection in dB = 0.35\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3.4.5:Pg-3.51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + " \n", + "n1= 1.5 \n", + "n=1.0 \n", + "y=5.0 \n", + "a= 25.0 \n", + "temp1=(1-(y/(2*a)**2))**0.5 \n", + "temp1=temp1*(y/a) \n", + "temp=2*math.acos(0.9996708) # it should be acos(0.1) actually... due to approximations\n", + " \n", + " # answer varies a lot... \n", + "temp=math.degrees(temp)-temp1 \n", + " # temp=temp \n", + "tem= 16*(1.5**2)/(2.5**4) \n", + "tem=tem/math.pi \n", + "temp=temp*tem \n", + "Nlat= temp \n", + "print \" The Coupling efficiency is =\",round(Nlat,3) \n", + "L= -10*math.log10(Nlat) \n", + "print \" \\n\\nThe insertion loss in dB =\",round(L,2) \n", + "temp1=(1-(y/(2*a)**2))**0.5 \n", + "temp1=temp1*(y/a) \n", + "temp=2*math.acos(0.9996708) # it should be acos(0.1) actually... due to approximations\n", + " # answer varies a lot... \n", + "temp=math.degrees(temp)-temp1 \n", + "temp=temp/math.pi \n", + "N_new =temp \n", + "print \" \\n\\nEfficiency when joint index is matched =\",round(N_new,3) \n", + "L_new= -10*math.log10(N_new) \n", + "print \" \\n\\nThe new insertion loss in dB =\",round(L_new,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Coupling efficiency is = 0.804\n", + " \n", + "\n", + "The insertion loss in dB = 0.95\n", + " \n", + "\n", + "Efficiency when joint index is matched = 0.872\n", + " \n", + "\n", + "The new insertion loss in dB = 0.59\n" + ] + } + ], + "prompt_number": 39 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/Chapter4.ipynb b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter4.ipynb new file mode 100755 index 00000000..9dca6b9e --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter4.ipynb @@ -0,0 +1,644 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e29ad753b5f2886d343bb74ecb0ecc91fcb2a9898826cbfcabd7e953e57d2f63" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter04: Optical Detectors and Receivers" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.1:Pg-4.5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "Eg= 1.1 \n", + "lamda_c = 1.24/Eg \n", + "print \"The cut off wavelength in um= \",round(lamda_c,2) \n", + "\n", + "Eg_ger =0.67 \n", + "lamda_ger= 1.24/Eg_ger \n", + "print \" \\nThe cut off wavelength for Germanium in um= \",round(lamda_ger,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The cut off wavelength in um= 1.13\n", + " \n", + "The cut off wavelength for Germanium in um= 1.85\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.2:Pg-4.5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given \n", + "Eg = 1.43 \n", + "lamda = 1.24/Eg \n", + "lamda=lamda*1000 # converting in nm\n", + "print \"The cut off wavelength in nm =\",round(lamda,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The cut off wavelength in nm = 867.13\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.3:Pg-4.5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "P = 6*10**6 \n", + "Eh_pair= 5.4*10**6 \n", + "n= Eh_pair/P*100 \n", + "print \" The quantum efficiency in % = \",n \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The quantum efficiency in % = 90.0\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.4:Pg-4.6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "R= 0.65 \n", + "P0= 10*10**-6 \n", + "Ip= R*P0 \n", + "Ip=Ip*10**6 # convertinf in uA...\n", + "print \" The generated photocurrent in uA = \",Ip \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The generated photocurrent in uA = 6.5\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.5:Pg-4.6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "Ec= 1.2*10**11 \n", + "P= 3*10**11 \n", + "lamda = 0.85*10**-6 \n", + "n= Ec/P*100 \n", + "print \"The efficiency in % =\",n \n", + "\n", + "q= 1.602*10**-19 \n", + "h= 6.625*10**-34 \n", + "c= 3*10**8 \n", + "n= n/100 \n", + "R= n*q*lamda/(h*c) \n", + "print \" \\n\\nThe Responsivity of the photodiode in A/W=\",round(R ,4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The efficiency in % = 40.0\n", + " \n", + "\n", + "The Responsivity of the photodiode in A/W= 0.2741\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.6:Pg-4.7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "n= 0.65 \n", + "E= 1.5*10**-19 \n", + "Ip= 2.5*10**-6 \n", + "h= 6.625*10**-34 \n", + "c= 3*10**8 \n", + "lamda= h*c/E \n", + "lamda=lamda*10**6 # converting in um for displaying...\n", + "print \"The wavelength in um =\",lamda \n", + "lamda=lamda*10**-6 \n", + "q= 1.602*10**-19 \n", + "R= n*q*lamda/(h*c) \n", + "print \"\\nThe Responsivity in A/W =\",R \n", + "Pin= Ip/R \n", + "Pin=Pin*10**6 # converting in uW for displaying/..\n", + "print \" \\nThe incidnt power in uW= \",round(Pin,1) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wavelength in um = 1.325\n", + "\n", + "The Responsivity in A/W = 0.6942\n", + " \n", + "The incidnt power in uW= 3.6\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.7:Pg-4.8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "Iin= 1 \n", + "lamda= 1550*10**-9 \n", + "q= 1.602*10**-19 \n", + "h= 6.625*10**-34 \n", + "c= 3*10**8 \n", + "n=0.65 \n", + "Ip=n*q*lamda*Iin/(h*c) \n", + "Ip=Ip*1000 # converting in mA for displaying...\n", + "print \" The average photon current in mA= \",int(Ip)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The average photon current in mA= 812\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.1.8:Pg-4.9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "n= 0.70 \n", + "Ip= 4*10**-6 \n", + "e= 1.602*10**-19 \n", + "h= 6.625*10**-34 \n", + "c= 3*10**8 \n", + "E= 1.5*10**-19\n", + "lamda = h*c/E \n", + "lamda=lamda*10**6 # converting um for displaying...\n", + "print \"The wavelength in um =\",round(lamda,3) \n", + "R= n*e/E \n", + "Po= Ip/R \n", + "Po=Po*10**6 # converting um for displaying...\n", + "print \" \\nIncident optical Power in uW =\",round(Po,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wavelength in um = 1.325\n", + " \n", + "Incident optical Power in uW = 5.35\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.2.1:Pg-4.14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Ct= 7*10.0**-12\n", + "Rt= 50*1*10.0**6/(50+(1*10**6))\n", + "B= 1/(2*math.pi*Rt*Ct)\n", + "B=B*10**-6 #converting in mHz for displaying...\n", + "print \"The bandwidth of photodetector in MHz =\",round(B,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The bandwidth of photodetector in MHz = 454.75\n" + ] + } + ], + "prompt_number": 43 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.2.2:Pg-4.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "W= 25*10**-6 \n", + "Vd= 3*10**4 \n", + "Bm= Vd/(2*math.pi*W) \n", + "RT= 1/Bm \n", + "RT=RT*10**9 # converting ns for displaying...\n", + "print \" The maximum response time in ns =\",round(RT,2) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum response time in ns = 5.24\n" + ] + } + ], + "prompt_number": 45 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "\n", + "Ex4.2.3:Pg-4.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "e= 1.602*10**-19 \n", + "h= 6.625*10**-34 \n", + "v= 3*10**8 \n", + "n=0.65 \n", + "I= 10*10**-6 \n", + "lamda= 900*10**-9 \n", + "R= n*e*lamda/(h*v) \n", + "Po= 0.5*10**-6 \n", + "Ip= Po*R \n", + "M= I/Ip \n", + "print \" The multiplication factor =\",round(M,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The multiplication factor = 42.41\n" + ] + } + ], + "prompt_number": 48 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.3.1:Pg-4.18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "n=0.65 \n", + "lamda = 900*10**-9 \n", + "Pin= 0.5*10**-6 \n", + "Im= 10*10**-6 \n", + "q= 1.602*10**-19 \n", + "h= 6.625*10**-34 \n", + "c= 3*10**8 \n", + "R= n*q*lamda/(h*c) \n", + "Ip= R*Pin \n", + "M= Im/Ip \n", + "print \" The multiplication factor =\",round(M,2)\n", + "print \"\\n***NOTE-Answer wrong in textbook...\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The multiplication factor = 42.41\n", + "\n", + "***NOTE-Answer wrong in textbook...\n" + ] + } + ], + "prompt_number": 51 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.6.1:Pg-4.34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "lamda = 1300*10**-9 \n", + "Id= 4*10**-9 \n", + "n=0.9 \n", + "Rl= 1000 \n", + "Pincident= 300*10**-9 \n", + "BW= 20*10**6 \n", + "q= 1.602*10**-19 \n", + "h= 6.625*10**-34 \n", + "v= 3*10**8 \n", + "Iq= math.sqrt((q*Pincident*n*lamda)/(h*v)) \n", + "Iq= math.sqrt(Iq) \n", + "Iq=Iq*100 # converting in proper format for displaying...\n", + "print \"Mean square quantum noise current in Amp*10^11 =\",round(Iq,2)\n", + "I_dark= 2*q*BW*Id \n", + "I_dark=I_dark*10**19 # converting in proper format for displaying...\n", + "print \" \\nMean square dark current in Amp*10^-19 =\",round(I_dark,3) \n", + "k= 1.38*10**-23 \n", + "T= 25+273 \n", + "It= 4*k*T*BW/Rl \n", + "It=It*10**16 # converting in proper format for displaying...\n", + "print \" \\nMean square thermal nise current in Amp*10^-16 =\",round(It,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mean square quantum noise current in Amp*10^11 = 2.31\n", + " \n", + "Mean square dark current in Amp*10^-19 = 0.256\n", + " \n", + "Mean square thermal nise current in Amp*10^-16 = 3.29\n" + ] + } + ], + "prompt_number": 61 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.8.1:Pg-4.39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "lamda = 850*10**-9 # meters\n", + "BER= 1*10**-9 \n", + "N_bar = 9*log(10) \n", + "h= 6.625*10**-34 # joules-sec\n", + "v= 3*10**8 # meters/sec\n", + "n= 0.65 # assumption\n", + "E=N_bar*h*v/(n*lamda) \n", + "E=E*10**18 # /converting in proper format for displaying...\n", + "print \" The Energy received in Joules*10^-18 =\",round(E,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Energy received in Joules*10^-18 = 7.45\n" + ] + } + ], + "prompt_number": 64 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.8.2:Pg-4.39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "lamda = 850*10**-9 \n", + "BER = 1*10**-9 \n", + "BT=10*10**6 \n", + "h= 6.625*10**-34 \n", + "c= 3*10**8 \n", + "Ps= 36*h*c*BT/lamda \n", + "Ps=Ps*10**12 # /converting in proper format for displaying...\n", + "print \"The minimum incidental optical power required id in pW =\",round(Ps,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The minimum incidental optical power required id in pW = 84.18\n" + ] + } + ], + "prompt_number": 67 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4.8.3:Pg-4.40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "C= 5*10**-12 \n", + "B =50*10**6 \n", + "Ip= 1*10**-7 \n", + "e= 1.602*10**-19 \n", + "k= 1.38*10**-23 \n", + "T= 18+273 \n", + "M= 1 \n", + "Rl= 1/(2*math.pi*C*B) \n", + "S_N= Ip**2/((2*e*B*Ip)+(4*k*T*B/Rl)) \n", + "S_N = 10*math.log10(S_N) # in db\n", + "print \" The S/N ratio in dB =\",round(S_N,2) \n", + "M=41.54 \n", + "S_N_new= (M**2*Ip**2)/((2*e*B*Ip*M**2.3)+(4*k*T*B/Rl)) \n", + "S_N_new = 10*math.log10(S_N_new) # in db\n", + "print \" \\n\\nThe new S/N ratio in dB =\",round(S_N_new,2)\n", + "print \" \\n\\nImprovement over M=1 in dB =\",round(S_N_new-S_N,1) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The S/N ratio in dB = 8.99\n", + " \n", + "\n", + "The new S/N ratio in dB = 32.49\n", + " \n", + "\n", + "Improvement over M=1 in dB = 23.5\n" + ] + } + ], + "prompt_number": 70 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/Chapter5.ipynb b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter5.ipynb new file mode 100755 index 00000000..3915a0b4 --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter5.ipynb @@ -0,0 +1,458 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b4a79f107959b9c220fb0fbffb78f81a806979a06263be16ca010cadce8d4a27" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter05: Design Considerations in Optical Links" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.3.1:Pg-5.7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "B= 15*10**-6 \n", + "L= 4 \n", + "BER= 1*10**-9 \n", + "Ls= 0.5 \n", + "Lc= 1.5 \n", + "alpha= 6 \n", + "Pm= 8 \n", + "Pt= 2*Lc +(alpha*L)+(Pm) \n", + "print \" The actual loss in fibre in dB =\",int(Pt) \n", + "Pmax = -10-(-50) \n", + "print \" \\nThe maximum allowable system loss in dBm = \",Pmax " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The actual loss in fibre in dB = 35\n", + " \n", + "The maximum allowable system loss in dBm = 40\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.3.2:Pg-5.8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Ps= 0.1 \n", + "alpha = 6 \n", + "L= 0.5 \n", + "Ps = 10*math.log10(Ps) \n", + "NA= 0.25 \n", + "Lcoupling= -10*math.log10(NA**2) \n", + "Lf= alpha*L \n", + "lc= 2*2 \n", + "Pm= 4 \n", + "Pout = Ps-(Lcoupling+Lf+lc+Pm) \n", + "print \" The actual power output in dBm = \",int(Pout) \n", + "Pmin = -35 \n", + "print \" Minimum input power required in dBm= \",Pmin \n", + "print \" As Pmin > Pout, system will perform adequately over the system operating life.\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The actual power output in dBm = -33\n", + " Minimum input power required in dBm= -35\n", + " As Pmin > Pout, system will perform adequately over the system operating life.\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.3.3:Pg-5.8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "Ps= 5 \n", + "Lcoupling = 3 \n", + "Lc= 2 \n", + "L_splicing = 50*0.1 \n", + "F_atten = 25 \n", + "L_total = Lcoupling+Lc+L_splicing+F_atten \n", + "P_avail = Ps-L_total \n", + "sensitivity = -40 \n", + "loss_margin = -sensitivity-(-P_avail) \n", + "print \" The loss margin of the system in dBm= -\",loss_margin \n", + "sensitivity_fet = -32 \n", + "loss_margin_fet=-sensitivity_fet-(-P_avail) \n", + "print \"The loss marging for the FET receiver in dBm= -\",loss_margin_fet \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The loss margin of the system in dBm= - 10.0\n", + "The loss marging for the FET receiver in dBm= - 2.0\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.3.4:Pg-5.9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "LED_output = 3 \n", + "PIN_sensitivity = -54 \n", + "allowed_loss= LED_output -(-PIN_sensitivity) \n", + "Lcoupling = 17.5 \n", + "cable_atten = 30 \n", + "power_margin_coupling= 39.5 \n", + "power_margin_splice=6.2 \n", + "power_margin_cable=9.5 \n", + "final_margin= power_margin_coupling+power_margin_splice+power_margin_cable \n", + "print \" The safety margin in dB =\",final_margin\n", + " # Answer in book is wrong...\n", + "print \" \\n***NOTE- Answer wrong in book...\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The safety margin in dB = 55.2\n", + " \n", + "***NOTE- Answer wrong in book...\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.3.5:Pg-5.10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "optical_power=-10 \n", + "receiver_sensitivity=-41 \n", + "total_margin= optical_power-receiver_sensitivity \n", + "cable_loss= 7*2.6 \n", + "splice_loss= 6*0.5 \n", + "connector_loss= 1*1.5 \n", + "safety_margin= 6 \n", + "total_loss= cable_loss+splice_loss+connector_loss+safety_margin \n", + "excess_power_margin= total_margin-total_loss \n", + "print \" The system is viable and provides excess power margin in dB=\",excess_power_margin \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The system is viable and provides excess power margin in dB= 2.3\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.4.1:Pg-5.13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Ttx= 15 \n", + "Tmat=21 \n", + "Tmod= 3.9 \n", + "BW= 25.0 \n", + "Trx= 350.0/BW \n", + "\n", + "Tsys = math.sqrt(Ttx**2+Tmat**2+Tmod**2+Trx**2) \n", + "print \" The system rise time in ns.= \",round(Tsys,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The system rise time in ns.= 29.62\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.4.2:Pg-5.14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "\n", + "Ttrans = 1.75*10**-9 \n", + "Tled = 3.50*10**-9 \n", + "Tcable=3.89*10**-9 \n", + "Tpin= 1*10**-9 \n", + "Trec= 1.94*10**-9 \n", + "Tsys= math.sqrt(Ttrans**2+Tled**2+Tcable**2+Tpin**2+Trec**2) \n", + "Tsys=Tsys*10**9 # converting in ns for dislaying...\n", + "print \" The system rise time in ns= \",round(Tsys,2)\n", + "Tsys=Tsys*10**-9 \n", + "BW= 0.35/Tsys \n", + "BW=BW/1000000.0 # converting in MHz for dislaying...\n", + "print \" \\nThe system bandwidth in MHz =\",round(BW,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The system rise time in ns= 5.93\n", + " \n", + "The system bandwidth in MHz = 58.99\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.4.3:Pg-5.14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Ttx= 8*10**-9 \n", + "Tintra= 1*10**-9 \n", + "Tmodal=5*10**-9 \n", + "Trr= 6*10**-9 \n", + "Tsys= math.sqrt(Ttx**2+(8*Tintra)**2+(8*Tmodal)**2+Trr**2) \n", + "\n", + "BWnrz= 0.7/Tsys \n", + "BWnrz=BWnrz/1000000 # converting in ns for dislaying...\n", + "BWrz=0.35/Tsys \n", + "BWrz=BWrz/1000000 # converting in ns for dislaying...\n", + "print \" Maximum bit rate for NRZ format in Mb/sec= \",round(BWnrz,2)\n", + "print \" \\nMaximum bit rate for RZ format in Mb/sec= \",round(BWrz,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Maximum bit rate for NRZ format in Mb/sec= 16.67\n", + " \n", + "Maximum bit rate for RZ format in Mb/sec= 8.33\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.4.4:Pg-5.15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "Ts= 10*10**-9 \n", + "Tn=9*10**-9 \n", + "Tc=2*10**-9 \n", + "Td=3*10**-9 \n", + "BW= 6*10**6 \n", + "Tsyst= 1.1*math.sqrt(Ts**2+(5*Tn)**2+(5*Tc)**2+Td**2) \n", + "Tsyst=Tsyst*10**9 # converting in ns for displying...\n", + "Tsyst_max = 0.35/BW \n", + "Tsyst_max=Tsyst_max*10**9 # converting in ns for displying...\n", + "print \" Rise system of the system in ns= \",round(Tsyst,2)\n", + "print \" \\nMaximum Rise system of the system in ns= \",round(Tsyst_max,2)\n", + "print \" \\nSpecified components give a system rise time which is adequate for the bandwidth and distance requirements of the optical fibre link.\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Rise system of the system in ns= 51.99\n", + " \n", + "Maximum Rise system of the system in ns= 58.33\n", + " \n", + "Specified components give a system rise time which is adequate for the bandwidth and distance requirements of the optical fibre link.\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5.5.1:Pg-5.18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "\n", + "del_t_1 = 10*100*10**-9 \n", + "Bt_nrz_1 = 0.7/(del_t_1*1000000) \n", + "Bt_rz_1 = 0.35/(del_t_1*1000000) \n", + "print \"First case.\"\n", + "print \" \\nBit rate for nrz in Mb/sec= \",Bt_nrz_1 \n", + "print \" \\nBit rate for rz in Mb/sec= \",Bt_rz_1 \n", + "del_t_2 = 20*1000*10**-9 \n", + "Bt_nrz_2 = 0.7/(del_t_2*1000000) \n", + "Bt_rz_2 = 0.35/(del_t_2*1000000) \n", + "print \" \\n\\nSecond case\" \n", + "print \" \\nBit rate for nrz in Mb/sec= \",Bt_nrz_2 \n", + "print \" \\nBit rate for rz in Mb/sec= \",Bt_rz_2 \n", + "del_t_3 = 2*2000*10**-9 \n", + "Bt_nrz_3 = 0.7/(del_t_3*1000) \n", + "Bt_rz_3 = 0.35/(del_t_3*1000) \n", + "print \" \\n\\nThird case\" \n", + "print \" \\nBit rate for nrz in BITS/sec= \",int(Bt_nrz_3) \n", + "print \" \\nBit rate for rz in BITS/sec= \",Bt_rz_3 \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First case.\n", + " \n", + "Bit rate for nrz in Mb/sec= 0.7\n", + " \n", + "Bit rate for rz in Mb/sec= 0.35\n", + " \n", + "\n", + "Second case\n", + " \n", + "Bit rate for nrz in Mb/sec= 0.035\n", + " \n", + "Bit rate for rz in Mb/sec= 0.0175\n", + " \n", + "\n", + "Third case\n", + " \n", + "Bit rate for nrz in BITS/sec= 174\n", + " \n", + "Bit rate for rz in BITS/sec= 87.5\n" + ] + } + ], + "prompt_number": 31 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/Chapter6-Advanced_Optical_Systems.ipynb b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter6-Advanced_Optical_Systems.ipynb new file mode 100755 index 00000000..b0cb88b7 --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter6-Advanced_Optical_Systems.ipynb @@ -0,0 +1,317 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ac520a54154462ad172aef8bbb865642cb1f987c781ea69ea1084ba6e27e7f6b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter06: Advanced Optical Systems" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.5.1:Pg-6.11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "lamda_p= 980*10**-9 \n", + "lamda_s=1550*10**-9 \n", + "P_in=30 # in mW....\n", + "G=100 \n", + "\n", + "Ps_max= ((lamda_p*P_in)/lamda_s)/(G-1) \n", + "print \" \\nMaximum input power in mW = \",round(Ps_max,5) \n", + " \n", + "Ps_out= Ps_max + (lamda_p*P_in/lamda_s) \n", + "Ps_out= 10*math.log10(Ps_out) \n", + "print \" \\n\\nOutput power in dBm = \",round(Ps_out,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "Maximum input power in mW = 0.19159\n", + " \n", + "\n", + "Output power in dBm = 12.82\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.5.2:Pg-6.12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "Ps_out= 30.0 # in uW...\n", + "Ps_in=1.0 \n", + "Noise_power = 0.5 \n", + "\n", + "G= Ps_out/Ps_in \n", + "\n", + "G= 10*math.log10(G) \n", + "print \" \\nThe Gain EDFA in dB = \",round(G,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "The Gain EDFA in dB = 14.77\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.10.1:Pg-6.22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "P0=200.0 \n", + "P1=90.0 \n", + "P2=85.0 \n", + "P3=6.3 \n", + " # All powers in uW...\n", + "coupling_ratio= P2/(P1+P2)*100 \n", + "print \" \\n\\n Coupling Ratio in % = \",round(coupling_ratio,2) \n", + "excess_ratio= 10*math.log10(P0/(P1+P2))\n", + "print \" \\n\\n The Excess Ratio in % = \",round(excess_ratio,4) \n", + "insertion_loss=10*math.log10(P0/P1) \n", + "print \" \\n\\n The Insertion Loss (from Port 0 to Port 1) in dB= \",round(insertion_loss,2) \n", + "insertion_loss1=10*math.log10(P0/P2) \n", + "print \" \\n\\n The Insertion Loss (from Port 0 to Port 2) in dB= \",round(insertion_loss1,2) \n", + "cross_talk=10*math.log10(P3/P0) \n", + "print \" \\n\\n The Cross Talk in dB= \",int(cross_talk) \n", + "print \" \\n\\n***NOTE: Cross Talk calculated wrognly in book... Value of P3 wrognly taken\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "\n", + " Coupling Ratio in % = 48.57\n", + " \n", + "\n", + " The Excess Ratio in % = 0.5799\n", + " \n", + "\n", + " The Insertion Loss (from Port 0 to Port 1) in dB= 3.47\n", + " \n", + "\n", + " The Insertion Loss (from Port 0 to Port 2) in dB= 3.72\n", + " \n", + "\n", + " The Cross Talk in dB= -15\n", + " \n", + "\n", + "***NOTE: Cross Talk calculated wrognly in book... Value of P3 wrognly taken\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.10.2:Pg-6.23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "P0= 300.0 \n", + "P1=150.0 \n", + "P2=65.0 \n", + "P3=8.3*10**-3 \n", + " # All powers in uW...\n", + "splitting_ratio= P2/(P1+P2)*100 \n", + "print \" \\n\\n Splitting Ratio in %= \",round(splitting_ratio,2) \n", + "excess_ratio= 10*math.log10(P0/(P1+P2))\n", + "print \" \\n\\n The Excess Ratio in dB= \",round(excess_ratio,4)\n", + "insertion_loss=10*math.log10(P0/P1) \n", + "print \" \\n\\n The Insertion Loss (from Port 0 to Port 1) in dB= \",round(insertion_loss,2) \n", + "cross_talk=10*math.log10(P3/P0) \n", + "print \" \\n\\n The Cross Talk in dB= \",round(cross_talk,2) \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "\n", + " Splitting Ratio in %= 30.23\n", + " \n", + "\n", + " The Excess Ratio in dB= 1.4468\n", + " \n", + "\n", + " The Insertion Loss (from Port 0 to Port 1) in dB= 3.01\n", + " \n", + "\n", + " The Cross Talk in dB= -45.58\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.10.3:Pg-6.25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "N=32.0 \n", + "Ft=(100-5)/100.0 \n", + "Total_loss= 10*(1-3.322*math.log10(Ft))*math.log10(N) \n", + "print \" The total loss in the coupler in dB = \",round(Total_loss,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The total loss in the coupler in dB = 16.17\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.10.4:Pg-6.28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "N=10 \n", + "L=0.5 \n", + "alpha=0.4 \n", + "Lthru=0.9 \n", + "Lc=1 \n", + "Ltap=10 \n", + "Li=0.5 \n", + "Total_loss= N*(alpha*L +2*Lc +Lthru+Li)-(alpha*L)-(2*Lthru)+(2*Ltap) \n", + "print \" The total loss in the coupler in dB = \",int(Total_loss)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The total loss in the coupler in dB = 54\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.11.1:Pg-6.33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "del_v=10*10**9 \n", + "N_eff= 1.5 \n", + "c=3*10**11 # speed of light in mm/sec\n", + "del_L= c/(2*N_eff*del_v) \n", + "print \" The wave guide length differenc in mm= \",int(del_L) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The wave guide length differenc in mm= 10\n" + ] + } + ], + "prompt_number": 33 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/Chapter6.ipynb b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter6.ipynb new file mode 100755 index 00000000..b0cb88b7 --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/Chapter6.ipynb @@ -0,0 +1,317 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ac520a54154462ad172aef8bbb865642cb1f987c781ea69ea1084ba6e27e7f6b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter06: Advanced Optical Systems" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.5.1:Pg-6.11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "lamda_p= 980*10**-9 \n", + "lamda_s=1550*10**-9 \n", + "P_in=30 # in mW....\n", + "G=100 \n", + "\n", + "Ps_max= ((lamda_p*P_in)/lamda_s)/(G-1) \n", + "print \" \\nMaximum input power in mW = \",round(Ps_max,5) \n", + " \n", + "Ps_out= Ps_max + (lamda_p*P_in/lamda_s) \n", + "Ps_out= 10*math.log10(Ps_out) \n", + "print \" \\n\\nOutput power in dBm = \",round(Ps_out,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "Maximum input power in mW = 0.19159\n", + " \n", + "\n", + "Output power in dBm = 12.82\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.5.2:Pg-6.12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given\n", + "import math\n", + "Ps_out= 30.0 # in uW...\n", + "Ps_in=1.0 \n", + "Noise_power = 0.5 \n", + "\n", + "G= Ps_out/Ps_in \n", + "\n", + "G= 10*math.log10(G) \n", + "print \" \\nThe Gain EDFA in dB = \",round(G,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "The Gain EDFA in dB = 14.77\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.10.1:Pg-6.22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "P0=200.0 \n", + "P1=90.0 \n", + "P2=85.0 \n", + "P3=6.3 \n", + " # All powers in uW...\n", + "coupling_ratio= P2/(P1+P2)*100 \n", + "print \" \\n\\n Coupling Ratio in % = \",round(coupling_ratio,2) \n", + "excess_ratio= 10*math.log10(P0/(P1+P2))\n", + "print \" \\n\\n The Excess Ratio in % = \",round(excess_ratio,4) \n", + "insertion_loss=10*math.log10(P0/P1) \n", + "print \" \\n\\n The Insertion Loss (from Port 0 to Port 1) in dB= \",round(insertion_loss,2) \n", + "insertion_loss1=10*math.log10(P0/P2) \n", + "print \" \\n\\n The Insertion Loss (from Port 0 to Port 2) in dB= \",round(insertion_loss1,2) \n", + "cross_talk=10*math.log10(P3/P0) \n", + "print \" \\n\\n The Cross Talk in dB= \",int(cross_talk) \n", + "print \" \\n\\n***NOTE: Cross Talk calculated wrognly in book... Value of P3 wrognly taken\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "\n", + " Coupling Ratio in % = 48.57\n", + " \n", + "\n", + " The Excess Ratio in % = 0.5799\n", + " \n", + "\n", + " The Insertion Loss (from Port 0 to Port 1) in dB= 3.47\n", + " \n", + "\n", + " The Insertion Loss (from Port 0 to Port 2) in dB= 3.72\n", + " \n", + "\n", + " The Cross Talk in dB= -15\n", + " \n", + "\n", + "***NOTE: Cross Talk calculated wrognly in book... Value of P3 wrognly taken\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.10.2:Pg-6.23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "P0= 300.0 \n", + "P1=150.0 \n", + "P2=65.0 \n", + "P3=8.3*10**-3 \n", + " # All powers in uW...\n", + "splitting_ratio= P2/(P1+P2)*100 \n", + "print \" \\n\\n Splitting Ratio in %= \",round(splitting_ratio,2) \n", + "excess_ratio= 10*math.log10(P0/(P1+P2))\n", + "print \" \\n\\n The Excess Ratio in dB= \",round(excess_ratio,4)\n", + "insertion_loss=10*math.log10(P0/P1) \n", + "print \" \\n\\n The Insertion Loss (from Port 0 to Port 1) in dB= \",round(insertion_loss,2) \n", + "cross_talk=10*math.log10(P3/P0) \n", + "print \" \\n\\n The Cross Talk in dB= \",round(cross_talk,2) \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "\n", + " Splitting Ratio in %= 30.23\n", + " \n", + "\n", + " The Excess Ratio in dB= 1.4468\n", + " \n", + "\n", + " The Insertion Loss (from Port 0 to Port 1) in dB= 3.01\n", + " \n", + "\n", + " The Cross Talk in dB= -45.58\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.10.3:Pg-6.25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "import math\n", + "N=32.0 \n", + "Ft=(100-5)/100.0 \n", + "Total_loss= 10*(1-3.322*math.log10(Ft))*math.log10(N) \n", + "print \" The total loss in the coupler in dB = \",round(Total_loss,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The total loss in the coupler in dB = 16.17\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.10.4:Pg-6.28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "N=10 \n", + "L=0.5 \n", + "alpha=0.4 \n", + "Lthru=0.9 \n", + "Lc=1 \n", + "Ltap=10 \n", + "Li=0.5 \n", + "Total_loss= N*(alpha*L +2*Lc +Lthru+Li)-(alpha*L)-(2*Lthru)+(2*Ltap) \n", + "print \" The total loss in the coupler in dB = \",int(Total_loss)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The total loss in the coupler in dB = 54\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6.11.1:Pg-6.33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given\n", + "del_v=10*10**9 \n", + "N_eff= 1.5 \n", + "c=3*10**11 # speed of light in mm/sec\n", + "del_L= c/(2*N_eff*del_v) \n", + "print \" The wave guide length differenc in mm= \",int(del_L) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The wave guide length differenc in mm= 10\n" + ] + } + ], + "prompt_number": 33 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/README.txt b/Optical_Fiber_Communication_by_V._S._Bagad/README.txt new file mode 100755 index 00000000..861c658f --- /dev/null +++ b/Optical_Fiber_Communication_by_V._S._Bagad/README.txt @@ -0,0 +1,10 @@ +Contributed By: Samiksha Srivastava +Course: btech +College/Institute/Organization: ABES Engineering College +Department/Designation: Computer Science and Engineering +Book Title: Optical Fiber Communication +Author: V. S. Bagad +Publisher: Technical Publications, Pune +Year of publication: 2013 +Isbn: 9789350385203 +Edition: 2 \ No newline at end of file diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter01-Ex1.7.1.png b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter01-Ex1.7.1.png new file mode 100755 index 00000000..4c42636d Binary files /dev/null and b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter01-Ex1.7.1.png differ diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter02-Ex2.2.1.png b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter02-Ex2.2.1.png new file mode 100755 index 00000000..7f5fd635 Binary files /dev/null and b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter02-Ex2.2.1.png differ diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter03-Ex3.2.1.png b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter03-Ex3.2.1.png new file mode 100755 index 00000000..c1f042e9 Binary files /dev/null and b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/Chapter03-Ex3.2.1.png differ diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch3.png b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch3.png new file mode 100755 index 00000000..9adb53db Binary files /dev/null and b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch3.png differ diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch3_1.png b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch3_1.png new file mode 100755 index 00000000..9adb53db Binary files /dev/null and b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch3_1.png differ diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch5.png b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch5.png new file mode 100755 index 00000000..acf6fcac Binary files /dev/null and b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch5.png differ diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch5_1.png b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch5_1.png new file mode 100755 index 00000000..acf6fcac Binary files /dev/null and b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch5_1.png differ diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch7.png b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch7.png new file mode 100755 index 00000000..302231b6 Binary files /dev/null and b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch7.png differ diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch7_1.png b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch7_1.png new file mode 100755 index 00000000..302231b6 Binary files /dev/null and b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/ch7_1.png differ diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter2.png b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter2.png new file mode 100755 index 00000000..e8ee191d Binary files /dev/null and b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter2.png differ diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter5.png b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter5.png new file mode 100755 index 00000000..d6fa34e3 Binary files /dev/null and b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter5.png differ diff --git a/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter6.png b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter6.png new file mode 100755 index 00000000..ac19fe5b Binary files /dev/null and b/Optical_Fiber_Communication_by_V._S._Bagad/screenshots/chapter6.png differ diff --git a/Short_Course_by_e/hemla.ipynb b/Short_Course_by_e/hemla.ipynb deleted file mode 100644 index 5cea9cb6..00000000 --- a/Short_Course_by_e/hemla.ipynb +++ /dev/null @@ -1,778 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:9826abe74c775578903ec0e922c705aacf445defe2dc3badb10ce4727f434663" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter2-Compressible Flow with Friction and Heat: A Review" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg19" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#what is the gas constant of air and density of air\n", - "import math\n", - "#intilization variable\n", - "p=3*10**6 ; #pressure in Pa\n", - "t=298. ; #temperatue in kelvin\n", - "mw= 29.; #molecular weight in kg/mol\n", - "ru=8314.; #universal constant in J/kmol.K\n", - "r=ru/mw ;\n", - "#using perfect gas law to get density:\n", - "rho=p/(r*t) ;\n", - "print'%s %.2f %s'%('Gas constant of air in',r,'J/kg.K')\n", - "print'%s %.1f %s'%('Density of air in',rho,'kg/m^3')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Gas constant of air in 286.69 J/kg.K\n", - "Density of air in 35.1 kg/m^3\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#find out the exit temperature and exit density by various methods \n", - "import math\n", - "t1=288.; #inlet temperture in Kelvin\n", - "p1=100*10**3; #inlet pressure in Pa\n", - "p2=1*10**6 #exit pressure in Pa\n", - "gma=1.4; #gamma.\n", - "rg=287.; #gas constant in J/kg.K\n", - "t2=t1*(p2/p1)**((gma-1)/gma); #exit temperature \n", - "print'%s %.5f %s'%('Exit temperature in',t2,'K')\n", - "#first method to find exit density:\n", - "#application of perfect gas law at exit\n", - "rho=p2/(rg*t2); #rho= exit density.\n", - "print'%s %.7f %s'%('exit density at by method 1 in',rho,'kg/m^3')\n", - "#method 2: using isentropic relation between inlet and exit density.\n", - "rho1=p1/(rg*t1); #inlet density.\n", - "rho=rho1*(p2/p1)**(1/gma);\n", - "print'%s %.2f %s'%('exit density by method 2 in',rho,'kg/m^3')\n", - "\n", - " " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Exit temperature in 556.04095 K\n", - "exit density at by method 1 in 6.2663021 kg/m^3\n", - "exit density by method 2 in 6.27 kg/m^3\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#what is the rate of mass flow through exit \n", - "import math\n", - "d1=1.2 #inlet 1 density in kg/m^3.\n", - "u1=25. # inlet 1 veocity in m/s.\n", - "a1=0.25 #inlet 1 area in m^2.\n", - "d2=0.2 #inlet 2 density in kg/m^3.\n", - "u2=225. #inlet 2 velocity in m/s.\n", - "a2=0.10 #inlet 2 area in m^2.\n", - "m1=d1*a1*u1; #rate of mass flow entering inlet 1.\n", - "m2=d2*u2*a2; #rate of mass flow entering inlet 2.\n", - "#since total mass in=total mass out,\n", - "m3=m1+m2; #m3=rate of mass flow through exit.\n", - "print'%s %.f %s'%('Rate of mass flow through exit in',m3,' kg/s')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rate of mass flow through exit in 12 kg/s\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg27" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#what is the axial force needed to support the plate and lateral force needed to support the plate\n", - "import math\n", - "u1=2 #speed of water going on the plate. X-component in m/s.\n", - "v1=0 #speed of water going on the plate. Y-component in m/s.\n", - "u2=1 #speed of water going on the plate. X-component in m/s.\n", - "v2=1.73 #speed of water going on the plate Y-coponent in m/s.\n", - "m=0.1 #rate of flow of mass of the water on the plate in kg/s.\n", - "#Using Newton's second law.\n", - "Fx=m*(u2-u1); #X-component of force exerted by water\n", - "print'%s %.1f %s'%('Axial force needed to support the plate in',Fx,'N')\n", - "Fy=m*(v2-v1); #Y-component of force exerted by water.\n", - "print'%s %.3f %s'%('Lateral force needed to support the plate in',Fy,'N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Axial force needed to support the plate in -0.1 N\n", - "Lateral force needed to support the plate in 0.173 N\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg29" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#calculate the Exit total and static temperature \n", - "m=50 #mass flow rate in kg/s.\n", - "T1=298 #inlet temperature in K.\n", - "u1=150 #inlet velocity in m/s.\n", - "cp1=1004 #specific heat at constant pressure of inlet in J/kg.K.\n", - "gm=1.4 #gamma.\n", - "u2=400 # exit velocity in m/s.\n", - "cp2=1243. #specific heat at constant pressure of exit in J/kg.K.\n", - "q=42*10**6 #heat transfer rate in control volume in Watt.\n", - "me=-100*10**3 #mechanical power in Watt.\n", - "#first calculate total enthalpy at the inlet:\n", - "ht1=cp1*T1+(u1**2)/2; #ht1=Total inlet enthalpy.\n", - "#now applying conservation of energy equation:\n", - "ht2=ht1+((q-me)/m) #ht2=Total enthalpy at exit.\n", - "Tt2=ht2/cp2; #Tt2=Total exit temperature.\n", - "T2=Tt2-((u2**2)/(2*cp2)); #T2=static exit temperature.\n", - "print'%s %.5f %s'%('Exit total temperature in',Tt2,'K')\n", - "print'%s %.4f %s'%('Exit static temperature in',T2,'K')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Exit total temperature in 927.14562 K\n", - "Exit static temperature in 862.7852 K\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg65" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#intilization variable\n", - "import math\n", - "d=0.2 #Diameter in meters.\n", - "M1=0.2 #inlet Mach no.\n", - "p1=100*10**3 #inlet pressure in Pa\n", - "Tt1=288. #total inlet temperature in K\n", - "q=100*10**3 #rate of heat transfer to fluid in Watt.\n", - "rg=287. #Gas constant in J/kg.K.\n", - "gm=1.4 #gamma\n", - "#(a)inlet mass flow:\n", - "m=((gm/rg)**(1./2.))*(p1/(Tt1)**(1./2.))*3.14*(d*d)/4.*(M1/(1.+((gm-1.)/2.)*(M1**2.))**((gm+1.)/(2.*(gm-1.))));\n", - "\n", - "#(b)\n", - "qm=q/m; #Heat per unit mass.\n", - "#Tt1/Tcr=0.1736, pt1/Pcr=1.2346, ((Delta(s)/R)1=6.3402,p1/Pcr=2.2727)\n", - "Tcr=Tt1/0.1736;\n", - "\n", - "Pcr=p1/2.2727;\n", - "#From energy equation:\n", - "cp=(gm/(gm-1.))*rg;\n", - "Tt2=Tt1+(q/cp);\n", - "q1cr=cp*(Tcr-Tt1)/1000.;\n", - "M2=0.22;\n", - "#From table : pt2/Pcr=1.2281, (Delta(s)/R)2=5.7395, p2/Pcr=2.2477.\n", - "#The percent total pressure drop is (((pt1/Pcr)-(pt2/Pcr))/(pt1/Pcr))*100.\n", - "p2=2.2477*Pcr;\n", - "dp=((1.2346-1.2281)/1.2346)*100;\n", - "#Entropy rise is the difference between (delta(s)/R)1 and (delta(s)/R)2.\n", - "ds=6.3402-5.7395;\n", - "#Static pressure drop in duct due to heat transfer is\n", - "dps=((p1/Pcr)-(p2/Pcr))*Pcr/1000.;\n", - "print'%s %.7f %s'%('Mass flow rate through duct in',m,'kg/s')\n", - "print'%s %.4f %s'%('Critical heat flux that would choke the duct for the M1 in',q1cr,'kJ/kg')\n", - "print'%s %.2f %s'%('The exit Mach No.',M2,'')\n", - "print'%s %.7f %s'%('The percent total pressure loss',dp,'%')\n", - "print'%s %.4f %s'%('The entropy rise',ds,'')\n", - "print'%s %.7f %s'%('The static pressure drop in ',dps,'kPa')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass flow rate through duct in 2.5235091 kg/s\n", - "Critical heat flux that would choke the duct for the M1 in 1377.1556 kJ/kg\n", - "The exit Mach No. 0.22 \n", - "The percent total pressure loss 0.5264863 %\n", - "The entropy rise 0.6007 \n", - "The static pressure drop in 1.1000132 kPa\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg67" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#what is total exit temperautre if exit is choked and maximum heat released and fule to air ratio to thermally choke the combustor exit and total pressure loss\n", - "#intilization variable\n", - "import math\n", - "M1=3.0 ##Mach no. at inlet\n", - "pt1=45*10**3 ##Total pressure t inlet in Pa\n", - "Tt1=1800 ##Total temperature at inlet in K\n", - "hv=12000 ##Lower heating value of hydrogen kJ/kg\n", - "gm=1.3 ##gamma\n", - "R=0.287 ##in kJ/kg.K\n", - "##Using RAYLEIGH table for M1=3.0 and gamma=1.3, we get Tt1/Tcr=0.6032, pt1/Pcr=4.0073.\n", - "Tcr=Tt1/0.6032\n", - "Pcr=pt1/4.0073\n", - "##if exit is choked, Tt2=Tcr\n", - "Tt2=Tt1/0.6032;\n", - "cp=gm*R/(gm-1);\n", - "##Energy balance across burner:\n", - "Q1cr=cp*(Tcr-Tt1);\n", - "f=(Q1cr/120000);\n", - "##total pressure loss:\n", - "dpt=1-Pcr/pt1;\n", - "print'%s %.4f %s'%('Total exit temperature if exit is choked in',Tt2,'K')\n", - "print'%s %.4f %s'%('Maximum heat released per unit mass of air in',Q1cr, 'kJ/kg')\n", - "print'%s %.7f %s'%('fuel-to-air ratio to thermally choke the combustor exit',f,'')\n", - "print'%s %.7f %s'%('Total pressure loss (in fraction)',dpt,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total exit temperature if exit is choked in 2984.0849 K\n", - "Maximum heat released per unit mass of air in 1472.6069 kJ/kg\n", - "fuel-to-air ratio to thermally choke the combustor exit 0.0122717 \n", - "Total pressure loss (in fraction) 0.7504554 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg67" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#calculate the new inlet mach no and spilled flow at the inlet\n", - "#initilization variable \n", - "import math\n", - "Tt1=50.+460. ##Converting the inlet temp. to the absolute scale i.e. in degree R\n", - "M1=0.5 ##Initial inlet Mach no.\n", - "pt1=14.7 ##Units in psia\n", - "gm=1.4 ##gamma\n", - "R=53.34 ##units in ft.lbf/lbm.degree R\n", - "Tcr=Tt1/0.69136 \n", - "cp=gm*R/(gm-1)\n", - "##using energy equation:\n", - "Q1cr=cp*(Tcr-Tt1)\n", - "##since heat flux is 1.2(Q1cr).\n", - "q=1.2*Q1cr\n", - "Tt1cr1=Tt1+(Q1cr/cp) ##new exit total temp.\n", - "z=Tt1/Tt1cr1\n", - "M2=0.473\n", - "\n", - "f=M1/(1+((gm-1)/2)*M1**2)**((gm+1)/(2*(gm-1)))\n", - "\n", - "sm=((f*(M1)-f*(M2))/f*(M1))*100. ##sm=The % spilled flow at the inlet\n", - "print'%s %.5f %s'%('The new inlet Mach no.',M2,'')\n", - "print'%s %.5f %s'%('The % spilled flow at the inlet',sm,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The new inlet Mach no. 0.47300 \n", - "The % spilled flow at the inlet 1.35000 \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg76" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#intilization variable\n", - "#calculate choking length abd exit mach no and total pressure loss and the static pressure and impulse due to friction \n", - "import math\n", - "d=0.2 ##diameter in meters.\n", - "l=0.2 ##length in meters.\n", - "Cf=0.005 ##average wall friction coefficient.\n", - "M1=0.24 ##inlet mach no.\n", - "gm=1.4 ##gamma.\n", - "##From FANNO tbale\n", - "L1cr=(9.3866*d/2)/(4*Cf);\n", - "L2cr=L1cr-l;\n", - "##from FANNO table\n", - "M2=0.3;\n", - "x=2.4956;\n", - "y=2.0351;\n", - "a=4.5383;\n", - "b=3.6191;\n", - "i1=2.043;\n", - "i2=1.698;\n", - "##% total pressure drop due to friction:\n", - "dpt=(x-y)/(x)*100;\n", - "##static pressur drop:\n", - "dps=(a-b)/a*100;\n", - "##Loss pf fluid:\n", - "lf=(i2-i1);\n", - "print'%s %.3f %s'%('The choking length of duct in',L1cr,'m')\n", - "print'%s %.1f %s'%('The exit Mach no.',M2,'')\n", - "print'%s %.6f %s'%('% total pressure loss',dpt,'')\n", - "print'%s %.5f %s'%('The static pressure drop in',dps,'%')\n", - "print'%s %.3f %s'%('Loss of impulse due to friction(I* times)',lf,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The choking length of duct in 46.933 m\n", - "The exit Mach no. 0.3 \n", - "% total pressure loss 18.452476 \n", - "The static pressure drop in 20.25428 %\n", - "Loss of impulse due to friction(I* times) -0.345 \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg77" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#initilization variable\n", - "import math \n", - "#caluclate maximum length of the duct that will support given in inlet condition and the new inlet condition and flow drop \n", - "M1=0.5\n", - "a=2. ## area of cross section units in cm^2\n", - "Cf=0.005 ##coefficient of skin friction\n", - "gm=1.4 ##gamma\n", - "##Calculations\n", - "c=2.*(2.+1.); ##Parameter of surface.\n", - "##From FANNO table: 4*Cf*L1cr/Dh=1.0691;\n", - "Dh=4.*a/c; ##Hydrolic diameter.\n", - "L1cr=1.069*Dh/(4.*Cf);\n", - "##maximum length will be L1cr.\n", - "##For new length(i.e. 2.16*L1cr), Mach no. M2 from FANNO table, M2=0.4;.\n", - "M2=0.4;\n", - "##the inlet total pressue and temp remains the same, therefore the mass flow rate in the duct is proportional to f(M):\n", - "\n", - "f=0.5/(1.+((gm-1.)/2.)*0.5**2.)**((gm+1.)/(2.*(gm-1.)))\n", - "#endfunction\n", - "dm=(f*(M1)-f*(M2))/f*(M1)*100.+10;\n", - "print'%s %.3f %s'%(\"(a)Maximum length of duct that will support given inlet condition(in cm):\",L1cr,\"\")\n", - "print'%s %.3f %s'%(\"(b)The new inlet condition mach no. M2:\",M2,\"\")\n", - "print'%s %.3f %s'%(\"(c)% inlet mass flow drop due to the longer length of the duct:\",dm,\"\")\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(a)Maximum length of duct that will support given inlet condition(in cm): 71.267 \n", - "(b)The new inlet condition mach no. M2: 0.400 \n", - "(c)% inlet mass flow drop due to the longer length of the duct: 15.000 \n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg78" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import numpy\n", - "M1=0.7;\n", - "dpt=0.99; ##pt2/pt1=dpt.\n", - "gm=1.4; ##gamma\n", - "A2=1.237 \n", - "a=1/1.237;\n", - "import warnings\n", - "warnings.filterwarnings('ignore')\n", - "##Calculations:\n", - "\n", - "k=(1./dpt)*(a)*(M1/(1.+(0.2*(M1)**2.))**3.);\n", - "po=([k*0.008,0,k*.12,0,k*.6,-1,k])\n", - "W=numpy.roots(po)\n", - "i=0;\n", - "s=1;\n", - "M2=W[4]\n", - "print -M2,\"(a)The exit Mach no. M2:\"\n", - "\n", - "\n", - "##p=p2/p1 i.e. static pressure ratio\n", - "p=dpt*((1.+(gm-1.)*(M1)**2./2.)/(1.+(gm-1.)*(M2)**2./2.))**(gm/(gm-1.))\n", - "##disp(p)\n", - "Cpr=(2./(gm*(M1)**2.))*(p-1.) ##Cpr is static pressure recovery : (p2-p1)/q1.\n", - "print\"%s %.2f %s\"%(\"(b)The static pressure recovery in the diffuser:\",-Cpr,\"\")\n", - "##Change in fluid impulse:\n", - "##Fxwalls=I2-I1=A1p1(1+gm*M1**2)-A2p2(1+gm*M2**2)\n", - "##Let, u=Fxwall/(p1*A1)\n", - "u=1.+gm*(M1)**2.-(1.237)*(p)*(1.+(gm*(M2)**2.))\n", - "print\"%s %.2f %s\"%(\"(c)The force acting on the diffuser inner wall nondimensionalized by inlet static pressure and area:\",-u,\"\")\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(-1.70274823568-0j) (a)The exit Mach no. M2:\n", - "(b)The static pressure recovery in the diffuser: 2.11 \n", - "(c)The force acting on the diffuser inner wall nondimensionalized by inlet static pressure and area: 0.05 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg85" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"Example2.13\"\n", - "import numpy\n", - "M1=0.5 #inlet mach no.\n", - "p=10. #(p=pt1/p0) whaere pt1 is inlet total pressure and p0 is ambient pressure.\n", - "dpc=0.01 #dpc=(pt1-Pth)/pt1 i.e. total pressure loss in convergant section\n", - "f=0.99 #f=Pth/pt1\n", - "dpd=0.02 #dpd=(Pth-pt2)/Pth i.e. total pressure loss in the divergent section\n", - "j=1/0.98 #j=Pth/pt2\n", - "A=2. #a=A2/Ath. nozzle area expansion ratio.\n", - "gm=1.4 # gamma\n", - "R=287. #J/kg.K universal gas constant.\n", - "#Calculations:\n", - "#\"th\"\" subscript denotes throat.\n", - "Mth=1. #mach no at thorat is always 1.\n", - "\n", - "k=(j)*(1./A)*(Mth/(1+(0.2*(Mth)**2))**3)\n", - "po=([k*0.008,0,k*.12,0,k*.6,-1,k])\n", - "W=numpy.roots(po)\n", - "i=0;\n", - "s=1;\n", - "M2=W[4]\n", - "print M2,\"(a)The exit Mach no. M2:\"\n", - "#p2/pt2=1/(1+(gm-1)/2*M2**2)**(gm/(gm-1)) \n", - "#pt2=(pt2/Pth)*(Pth/pt1)*(pt1/p0)*p0\n", - "#let pr=p2/p0\n", - "pr=((1/j)*f*p)/(1+(0.2*(M2)**2))**(gm/(gm-1))\n", - "\n", - "print pr,\"(b)The exit static pressure in terms of ambient pressure p2/p0:\"#Fxwall=-Fxliquid=I1-I2\n", - "\n", - "#let r=A1/Ath\n", - "r=(f)*(1/M1)*(((1+((gm-1)/2)*(M1)**2)/((gm+1)/2))**((gm+1)/(2*(gm-1))))\n", - "#disp(r)\n", - "#Psth is throat static pressure.\n", - "#z1=Psth/pt1=f/((gm+1)/2)**(gm/(gm-1))\n", - "z1=f/((gm+1)/2)**(gm/(gm-1))\n", - "#disp(z1)\n", - "#p1 is static pressure at inlet\n", - "#s1=p1/pt1\n", - "s1=1/(1+((gm-1)/2)*(M1)**2)**(gm/(gm-1))\n", - "#disp(s1)\n", - "#let y=Fxcwall/(Ath*pt1), where Fxwall is Fx converging-wall\n", - "y=s1*r*(1+(gm*(M1)**2))-(z1*(1+(gm*(Mth)**2)))\n", - "print y,\"(c)The nondimensional axial force acting on the convergent nozzle:\"\n", - "#similarly finding nondimensional force on the nozzle DIVERGENT section\n", - "#y1=Fxdiv-wall/Ath*pt1\n", - "#f1=p2/pt1\n", - "f1=pr*(1/p)\n", - "#disp(f1)\n", - "y1=z1*(1+(gm*(Mth)**2))-f1*A*(1+(gm*(M2)**2))\n", - "print y1,\"(d)The nondimensional axial force acting on the divergent nozzle:\"\n", - "#total axial force acting on nozzle wall: Fsum=y+y1\n", - "Fsum=y+y1\n", - "print Fsum,\"(e)The total axial force(nondimensional) acting on the nozzle: \"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Example2.13\n", - "(2.17433864456+0j) (a)The exit Mach no. M2:\n", - "(0.944524245306+0j) (b)The exit static pressure in terms of ambient pressure p2/p0:\n", - "0.254397897726 (c)The nondimensional axial force acting on the convergent nozzle:\n", - "(-0.184039795857+0j) (d)The nondimensional axial force acting on the divergent nozzle:\n", - "(0.070358101869+0j) (e)The total axial force(nondimensional) acting on the nozzle: \n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg87" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#calculate non dimensional axial force and negative sign on the axial force experienced by the compressor \n", - "p=20. ##p=p2/p1 i.e. compression ratio.\n", - "gm=1.4 ## gamma\n", - "##Vx1=Vx2 i.e. axial velocity remains same.\n", - "##calculations:\n", - "d=p**(1/gm) ##d=d2/d1 i.e. density ratio\n", - "A=1./d ## A=A2/A1 i.e. area ratio which is related to density ratio as: A2/A1=d1/d2.\n", - "##disp(A)\n", - "Fx=1.-p*A ##Fx=Fxwall/p1*A1 i.e nondimensional axial force.\n", - "print'%s %.7f %s'%(\"The non-dimensional axial force is :\",Fx,\"\")\n", - "print'%s %.f %s'%(\"The negative sign on the axial force experienced by the compressor structure signifies a thrust production by this component.\",Fx,\" \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The non-dimensional axial force is : -1.3535469 \n", - "The negative sign on the axial force experienced by the compressor structure signifies a thrust production by this component. -1 \n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg88" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "print(\"Example 2.15\")\n", - "t=1.8 ##t=T2/T1\n", - "d=1./t ##d=d2/d1 i.e. density ratio\n", - "v=1./d ##v=Vx2/Vx1 axial velocity ratio\n", - "ndaf=1.-(v) ##nondimensional axial force acting on the combustor walls\n", - "print'%s %.1f %s'%(\"The nondimensional axial force acting on the combustor walls:\",ndaf,\"\")\n", - "print(\"Negative sign signifies a thrust production by the device\")\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Example 2.15\n", - "The nondimensional axial force acting on the combustor walls: -0.8 \n", - "Negative sign signifies a thrust production by the device\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex16-pg89" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "print(\"Example 2.16\")\n", - "t=0.79 ##T2/T1 i.e. turbione expansion\n", - "gm=1.4 ##gamma\n", - "##calculations:\n", - "d=t**(1./(gm-1.))\n", - "##print'%s %.1f %s'%(d)\n", - "a=1./d ##area ratio\n", - "p=d**gm ##pressure ratio\n", - "ndaf=1.-p*a\n", - "print'%s %.2f %s'%(\"The nondimensional axial force:\",ndaf,\"\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Example 2.16\n", - "The nondimensional axial force: 0.21 \n" - ] - } - ], - "prompt_number": 16 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Short_Course_by_e/hemla_1.ipynb b/Short_Course_by_e/hemla_1.ipynb deleted file mode 100644 index 5cea9cb6..00000000 --- a/Short_Course_by_e/hemla_1.ipynb +++ /dev/null @@ -1,778 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:9826abe74c775578903ec0e922c705aacf445defe2dc3badb10ce4727f434663" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter2-Compressible Flow with Friction and Heat: A Review" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg19" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#what is the gas constant of air and density of air\n", - "import math\n", - "#intilization variable\n", - "p=3*10**6 ; #pressure in Pa\n", - "t=298. ; #temperatue in kelvin\n", - "mw= 29.; #molecular weight in kg/mol\n", - "ru=8314.; #universal constant in J/kmol.K\n", - "r=ru/mw ;\n", - "#using perfect gas law to get density:\n", - "rho=p/(r*t) ;\n", - "print'%s %.2f %s'%('Gas constant of air in',r,'J/kg.K')\n", - "print'%s %.1f %s'%('Density of air in',rho,'kg/m^3')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Gas constant of air in 286.69 J/kg.K\n", - "Density of air in 35.1 kg/m^3\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#find out the exit temperature and exit density by various methods \n", - "import math\n", - "t1=288.; #inlet temperture in Kelvin\n", - "p1=100*10**3; #inlet pressure in Pa\n", - "p2=1*10**6 #exit pressure in Pa\n", - "gma=1.4; #gamma.\n", - "rg=287.; #gas constant in J/kg.K\n", - "t2=t1*(p2/p1)**((gma-1)/gma); #exit temperature \n", - "print'%s %.5f %s'%('Exit temperature in',t2,'K')\n", - "#first method to find exit density:\n", - "#application of perfect gas law at exit\n", - "rho=p2/(rg*t2); #rho= exit density.\n", - "print'%s %.7f %s'%('exit density at by method 1 in',rho,'kg/m^3')\n", - "#method 2: using isentropic relation between inlet and exit density.\n", - "rho1=p1/(rg*t1); #inlet density.\n", - "rho=rho1*(p2/p1)**(1/gma);\n", - "print'%s %.2f %s'%('exit density by method 2 in',rho,'kg/m^3')\n", - "\n", - " " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Exit temperature in 556.04095 K\n", - "exit density at by method 1 in 6.2663021 kg/m^3\n", - "exit density by method 2 in 6.27 kg/m^3\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#what is the rate of mass flow through exit \n", - "import math\n", - "d1=1.2 #inlet 1 density in kg/m^3.\n", - "u1=25. # inlet 1 veocity in m/s.\n", - "a1=0.25 #inlet 1 area in m^2.\n", - "d2=0.2 #inlet 2 density in kg/m^3.\n", - "u2=225. #inlet 2 velocity in m/s.\n", - "a2=0.10 #inlet 2 area in m^2.\n", - "m1=d1*a1*u1; #rate of mass flow entering inlet 1.\n", - "m2=d2*u2*a2; #rate of mass flow entering inlet 2.\n", - "#since total mass in=total mass out,\n", - "m3=m1+m2; #m3=rate of mass flow through exit.\n", - "print'%s %.f %s'%('Rate of mass flow through exit in',m3,' kg/s')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rate of mass flow through exit in 12 kg/s\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg27" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#what is the axial force needed to support the plate and lateral force needed to support the plate\n", - "import math\n", - "u1=2 #speed of water going on the plate. X-component in m/s.\n", - "v1=0 #speed of water going on the plate. Y-component in m/s.\n", - "u2=1 #speed of water going on the plate. X-component in m/s.\n", - "v2=1.73 #speed of water going on the plate Y-coponent in m/s.\n", - "m=0.1 #rate of flow of mass of the water on the plate in kg/s.\n", - "#Using Newton's second law.\n", - "Fx=m*(u2-u1); #X-component of force exerted by water\n", - "print'%s %.1f %s'%('Axial force needed to support the plate in',Fx,'N')\n", - "Fy=m*(v2-v1); #Y-component of force exerted by water.\n", - "print'%s %.3f %s'%('Lateral force needed to support the plate in',Fy,'N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Axial force needed to support the plate in -0.1 N\n", - "Lateral force needed to support the plate in 0.173 N\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg29" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#calculate the Exit total and static temperature \n", - "m=50 #mass flow rate in kg/s.\n", - "T1=298 #inlet temperature in K.\n", - "u1=150 #inlet velocity in m/s.\n", - "cp1=1004 #specific heat at constant pressure of inlet in J/kg.K.\n", - "gm=1.4 #gamma.\n", - "u2=400 # exit velocity in m/s.\n", - "cp2=1243. #specific heat at constant pressure of exit in J/kg.K.\n", - "q=42*10**6 #heat transfer rate in control volume in Watt.\n", - "me=-100*10**3 #mechanical power in Watt.\n", - "#first calculate total enthalpy at the inlet:\n", - "ht1=cp1*T1+(u1**2)/2; #ht1=Total inlet enthalpy.\n", - "#now applying conservation of energy equation:\n", - "ht2=ht1+((q-me)/m) #ht2=Total enthalpy at exit.\n", - "Tt2=ht2/cp2; #Tt2=Total exit temperature.\n", - "T2=Tt2-((u2**2)/(2*cp2)); #T2=static exit temperature.\n", - "print'%s %.5f %s'%('Exit total temperature in',Tt2,'K')\n", - "print'%s %.4f %s'%('Exit static temperature in',T2,'K')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Exit total temperature in 927.14562 K\n", - "Exit static temperature in 862.7852 K\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg65" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#intilization variable\n", - "import math\n", - "d=0.2 #Diameter in meters.\n", - "M1=0.2 #inlet Mach no.\n", - "p1=100*10**3 #inlet pressure in Pa\n", - "Tt1=288. #total inlet temperature in K\n", - "q=100*10**3 #rate of heat transfer to fluid in Watt.\n", - "rg=287. #Gas constant in J/kg.K.\n", - "gm=1.4 #gamma\n", - "#(a)inlet mass flow:\n", - "m=((gm/rg)**(1./2.))*(p1/(Tt1)**(1./2.))*3.14*(d*d)/4.*(M1/(1.+((gm-1.)/2.)*(M1**2.))**((gm+1.)/(2.*(gm-1.))));\n", - "\n", - "#(b)\n", - "qm=q/m; #Heat per unit mass.\n", - "#Tt1/Tcr=0.1736, pt1/Pcr=1.2346, ((Delta(s)/R)1=6.3402,p1/Pcr=2.2727)\n", - "Tcr=Tt1/0.1736;\n", - "\n", - "Pcr=p1/2.2727;\n", - "#From energy equation:\n", - "cp=(gm/(gm-1.))*rg;\n", - "Tt2=Tt1+(q/cp);\n", - "q1cr=cp*(Tcr-Tt1)/1000.;\n", - "M2=0.22;\n", - "#From table : pt2/Pcr=1.2281, (Delta(s)/R)2=5.7395, p2/Pcr=2.2477.\n", - "#The percent total pressure drop is (((pt1/Pcr)-(pt2/Pcr))/(pt1/Pcr))*100.\n", - "p2=2.2477*Pcr;\n", - "dp=((1.2346-1.2281)/1.2346)*100;\n", - "#Entropy rise is the difference between (delta(s)/R)1 and (delta(s)/R)2.\n", - "ds=6.3402-5.7395;\n", - "#Static pressure drop in duct due to heat transfer is\n", - "dps=((p1/Pcr)-(p2/Pcr))*Pcr/1000.;\n", - "print'%s %.7f %s'%('Mass flow rate through duct in',m,'kg/s')\n", - "print'%s %.4f %s'%('Critical heat flux that would choke the duct for the M1 in',q1cr,'kJ/kg')\n", - "print'%s %.2f %s'%('The exit Mach No.',M2,'')\n", - "print'%s %.7f %s'%('The percent total pressure loss',dp,'%')\n", - "print'%s %.4f %s'%('The entropy rise',ds,'')\n", - "print'%s %.7f %s'%('The static pressure drop in ',dps,'kPa')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass flow rate through duct in 2.5235091 kg/s\n", - "Critical heat flux that would choke the duct for the M1 in 1377.1556 kJ/kg\n", - "The exit Mach No. 0.22 \n", - "The percent total pressure loss 0.5264863 %\n", - "The entropy rise 0.6007 \n", - "The static pressure drop in 1.1000132 kPa\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg67" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#what is total exit temperautre if exit is choked and maximum heat released and fule to air ratio to thermally choke the combustor exit and total pressure loss\n", - "#intilization variable\n", - "import math\n", - "M1=3.0 ##Mach no. at inlet\n", - "pt1=45*10**3 ##Total pressure t inlet in Pa\n", - "Tt1=1800 ##Total temperature at inlet in K\n", - "hv=12000 ##Lower heating value of hydrogen kJ/kg\n", - "gm=1.3 ##gamma\n", - "R=0.287 ##in kJ/kg.K\n", - "##Using RAYLEIGH table for M1=3.0 and gamma=1.3, we get Tt1/Tcr=0.6032, pt1/Pcr=4.0073.\n", - "Tcr=Tt1/0.6032\n", - "Pcr=pt1/4.0073\n", - "##if exit is choked, Tt2=Tcr\n", - "Tt2=Tt1/0.6032;\n", - "cp=gm*R/(gm-1);\n", - "##Energy balance across burner:\n", - "Q1cr=cp*(Tcr-Tt1);\n", - "f=(Q1cr/120000);\n", - "##total pressure loss:\n", - "dpt=1-Pcr/pt1;\n", - "print'%s %.4f %s'%('Total exit temperature if exit is choked in',Tt2,'K')\n", - "print'%s %.4f %s'%('Maximum heat released per unit mass of air in',Q1cr, 'kJ/kg')\n", - "print'%s %.7f %s'%('fuel-to-air ratio to thermally choke the combustor exit',f,'')\n", - "print'%s %.7f %s'%('Total pressure loss (in fraction)',dpt,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total exit temperature if exit is choked in 2984.0849 K\n", - "Maximum heat released per unit mass of air in 1472.6069 kJ/kg\n", - "fuel-to-air ratio to thermally choke the combustor exit 0.0122717 \n", - "Total pressure loss (in fraction) 0.7504554 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg67" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#calculate the new inlet mach no and spilled flow at the inlet\n", - "#initilization variable \n", - "import math\n", - "Tt1=50.+460. ##Converting the inlet temp. to the absolute scale i.e. in degree R\n", - "M1=0.5 ##Initial inlet Mach no.\n", - "pt1=14.7 ##Units in psia\n", - "gm=1.4 ##gamma\n", - "R=53.34 ##units in ft.lbf/lbm.degree R\n", - "Tcr=Tt1/0.69136 \n", - "cp=gm*R/(gm-1)\n", - "##using energy equation:\n", - "Q1cr=cp*(Tcr-Tt1)\n", - "##since heat flux is 1.2(Q1cr).\n", - "q=1.2*Q1cr\n", - "Tt1cr1=Tt1+(Q1cr/cp) ##new exit total temp.\n", - "z=Tt1/Tt1cr1\n", - "M2=0.473\n", - "\n", - "f=M1/(1+((gm-1)/2)*M1**2)**((gm+1)/(2*(gm-1)))\n", - "\n", - "sm=((f*(M1)-f*(M2))/f*(M1))*100. ##sm=The % spilled flow at the inlet\n", - "print'%s %.5f %s'%('The new inlet Mach no.',M2,'')\n", - "print'%s %.5f %s'%('The % spilled flow at the inlet',sm,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The new inlet Mach no. 0.47300 \n", - "The % spilled flow at the inlet 1.35000 \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg76" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#intilization variable\n", - "#calculate choking length abd exit mach no and total pressure loss and the static pressure and impulse due to friction \n", - "import math\n", - "d=0.2 ##diameter in meters.\n", - "l=0.2 ##length in meters.\n", - "Cf=0.005 ##average wall friction coefficient.\n", - "M1=0.24 ##inlet mach no.\n", - "gm=1.4 ##gamma.\n", - "##From FANNO tbale\n", - "L1cr=(9.3866*d/2)/(4*Cf);\n", - "L2cr=L1cr-l;\n", - "##from FANNO table\n", - "M2=0.3;\n", - "x=2.4956;\n", - "y=2.0351;\n", - "a=4.5383;\n", - "b=3.6191;\n", - "i1=2.043;\n", - "i2=1.698;\n", - "##% total pressure drop due to friction:\n", - "dpt=(x-y)/(x)*100;\n", - "##static pressur drop:\n", - "dps=(a-b)/a*100;\n", - "##Loss pf fluid:\n", - "lf=(i2-i1);\n", - "print'%s %.3f %s'%('The choking length of duct in',L1cr,'m')\n", - "print'%s %.1f %s'%('The exit Mach no.',M2,'')\n", - "print'%s %.6f %s'%('% total pressure loss',dpt,'')\n", - "print'%s %.5f %s'%('The static pressure drop in',dps,'%')\n", - "print'%s %.3f %s'%('Loss of impulse due to friction(I* times)',lf,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The choking length of duct in 46.933 m\n", - "The exit Mach no. 0.3 \n", - "% total pressure loss 18.452476 \n", - "The static pressure drop in 20.25428 %\n", - "Loss of impulse due to friction(I* times) -0.345 \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg77" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#initilization variable\n", - "import math \n", - "#caluclate maximum length of the duct that will support given in inlet condition and the new inlet condition and flow drop \n", - "M1=0.5\n", - "a=2. ## area of cross section units in cm^2\n", - "Cf=0.005 ##coefficient of skin friction\n", - "gm=1.4 ##gamma\n", - "##Calculations\n", - "c=2.*(2.+1.); ##Parameter of surface.\n", - "##From FANNO table: 4*Cf*L1cr/Dh=1.0691;\n", - "Dh=4.*a/c; ##Hydrolic diameter.\n", - "L1cr=1.069*Dh/(4.*Cf);\n", - "##maximum length will be L1cr.\n", - "##For new length(i.e. 2.16*L1cr), Mach no. M2 from FANNO table, M2=0.4;.\n", - "M2=0.4;\n", - "##the inlet total pressue and temp remains the same, therefore the mass flow rate in the duct is proportional to f(M):\n", - "\n", - "f=0.5/(1.+((gm-1.)/2.)*0.5**2.)**((gm+1.)/(2.*(gm-1.)))\n", - "#endfunction\n", - "dm=(f*(M1)-f*(M2))/f*(M1)*100.+10;\n", - "print'%s %.3f %s'%(\"(a)Maximum length of duct that will support given inlet condition(in cm):\",L1cr,\"\")\n", - "print'%s %.3f %s'%(\"(b)The new inlet condition mach no. M2:\",M2,\"\")\n", - "print'%s %.3f %s'%(\"(c)% inlet mass flow drop due to the longer length of the duct:\",dm,\"\")\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(a)Maximum length of duct that will support given inlet condition(in cm): 71.267 \n", - "(b)The new inlet condition mach no. M2: 0.400 \n", - "(c)% inlet mass flow drop due to the longer length of the duct: 15.000 \n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg78" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import numpy\n", - "M1=0.7;\n", - "dpt=0.99; ##pt2/pt1=dpt.\n", - "gm=1.4; ##gamma\n", - "A2=1.237 \n", - "a=1/1.237;\n", - "import warnings\n", - "warnings.filterwarnings('ignore')\n", - "##Calculations:\n", - "\n", - "k=(1./dpt)*(a)*(M1/(1.+(0.2*(M1)**2.))**3.);\n", - "po=([k*0.008,0,k*.12,0,k*.6,-1,k])\n", - "W=numpy.roots(po)\n", - "i=0;\n", - "s=1;\n", - "M2=W[4]\n", - "print -M2,\"(a)The exit Mach no. M2:\"\n", - "\n", - "\n", - "##p=p2/p1 i.e. static pressure ratio\n", - "p=dpt*((1.+(gm-1.)*(M1)**2./2.)/(1.+(gm-1.)*(M2)**2./2.))**(gm/(gm-1.))\n", - "##disp(p)\n", - "Cpr=(2./(gm*(M1)**2.))*(p-1.) ##Cpr is static pressure recovery : (p2-p1)/q1.\n", - "print\"%s %.2f %s\"%(\"(b)The static pressure recovery in the diffuser:\",-Cpr,\"\")\n", - "##Change in fluid impulse:\n", - "##Fxwalls=I2-I1=A1p1(1+gm*M1**2)-A2p2(1+gm*M2**2)\n", - "##Let, u=Fxwall/(p1*A1)\n", - "u=1.+gm*(M1)**2.-(1.237)*(p)*(1.+(gm*(M2)**2.))\n", - "print\"%s %.2f %s\"%(\"(c)The force acting on the diffuser inner wall nondimensionalized by inlet static pressure and area:\",-u,\"\")\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(-1.70274823568-0j) (a)The exit Mach no. M2:\n", - "(b)The static pressure recovery in the diffuser: 2.11 \n", - "(c)The force acting on the diffuser inner wall nondimensionalized by inlet static pressure and area: 0.05 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg85" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"Example2.13\"\n", - "import numpy\n", - "M1=0.5 #inlet mach no.\n", - "p=10. #(p=pt1/p0) whaere pt1 is inlet total pressure and p0 is ambient pressure.\n", - "dpc=0.01 #dpc=(pt1-Pth)/pt1 i.e. total pressure loss in convergant section\n", - "f=0.99 #f=Pth/pt1\n", - "dpd=0.02 #dpd=(Pth-pt2)/Pth i.e. total pressure loss in the divergent section\n", - "j=1/0.98 #j=Pth/pt2\n", - "A=2. #a=A2/Ath. nozzle area expansion ratio.\n", - "gm=1.4 # gamma\n", - "R=287. #J/kg.K universal gas constant.\n", - "#Calculations:\n", - "#\"th\"\" subscript denotes throat.\n", - "Mth=1. #mach no at thorat is always 1.\n", - "\n", - "k=(j)*(1./A)*(Mth/(1+(0.2*(Mth)**2))**3)\n", - "po=([k*0.008,0,k*.12,0,k*.6,-1,k])\n", - "W=numpy.roots(po)\n", - "i=0;\n", - "s=1;\n", - "M2=W[4]\n", - "print M2,\"(a)The exit Mach no. M2:\"\n", - "#p2/pt2=1/(1+(gm-1)/2*M2**2)**(gm/(gm-1)) \n", - "#pt2=(pt2/Pth)*(Pth/pt1)*(pt1/p0)*p0\n", - "#let pr=p2/p0\n", - "pr=((1/j)*f*p)/(1+(0.2*(M2)**2))**(gm/(gm-1))\n", - "\n", - "print pr,\"(b)The exit static pressure in terms of ambient pressure p2/p0:\"#Fxwall=-Fxliquid=I1-I2\n", - "\n", - "#let r=A1/Ath\n", - "r=(f)*(1/M1)*(((1+((gm-1)/2)*(M1)**2)/((gm+1)/2))**((gm+1)/(2*(gm-1))))\n", - "#disp(r)\n", - "#Psth is throat static pressure.\n", - "#z1=Psth/pt1=f/((gm+1)/2)**(gm/(gm-1))\n", - "z1=f/((gm+1)/2)**(gm/(gm-1))\n", - "#disp(z1)\n", - "#p1 is static pressure at inlet\n", - "#s1=p1/pt1\n", - "s1=1/(1+((gm-1)/2)*(M1)**2)**(gm/(gm-1))\n", - "#disp(s1)\n", - "#let y=Fxcwall/(Ath*pt1), where Fxwall is Fx converging-wall\n", - "y=s1*r*(1+(gm*(M1)**2))-(z1*(1+(gm*(Mth)**2)))\n", - "print y,\"(c)The nondimensional axial force acting on the convergent nozzle:\"\n", - "#similarly finding nondimensional force on the nozzle DIVERGENT section\n", - "#y1=Fxdiv-wall/Ath*pt1\n", - "#f1=p2/pt1\n", - "f1=pr*(1/p)\n", - "#disp(f1)\n", - "y1=z1*(1+(gm*(Mth)**2))-f1*A*(1+(gm*(M2)**2))\n", - "print y1,\"(d)The nondimensional axial force acting on the divergent nozzle:\"\n", - "#total axial force acting on nozzle wall: Fsum=y+y1\n", - "Fsum=y+y1\n", - "print Fsum,\"(e)The total axial force(nondimensional) acting on the nozzle: \"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Example2.13\n", - "(2.17433864456+0j) (a)The exit Mach no. M2:\n", - "(0.944524245306+0j) (b)The exit static pressure in terms of ambient pressure p2/p0:\n", - "0.254397897726 (c)The nondimensional axial force acting on the convergent nozzle:\n", - "(-0.184039795857+0j) (d)The nondimensional axial force acting on the divergent nozzle:\n", - "(0.070358101869+0j) (e)The total axial force(nondimensional) acting on the nozzle: \n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg87" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#calculate non dimensional axial force and negative sign on the axial force experienced by the compressor \n", - "p=20. ##p=p2/p1 i.e. compression ratio.\n", - "gm=1.4 ## gamma\n", - "##Vx1=Vx2 i.e. axial velocity remains same.\n", - "##calculations:\n", - "d=p**(1/gm) ##d=d2/d1 i.e. density ratio\n", - "A=1./d ## A=A2/A1 i.e. area ratio which is related to density ratio as: A2/A1=d1/d2.\n", - "##disp(A)\n", - "Fx=1.-p*A ##Fx=Fxwall/p1*A1 i.e nondimensional axial force.\n", - "print'%s %.7f %s'%(\"The non-dimensional axial force is :\",Fx,\"\")\n", - "print'%s %.f %s'%(\"The negative sign on the axial force experienced by the compressor structure signifies a thrust production by this component.\",Fx,\" \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The non-dimensional axial force is : -1.3535469 \n", - "The negative sign on the axial force experienced by the compressor structure signifies a thrust production by this component. -1 \n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg88" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "print(\"Example 2.15\")\n", - "t=1.8 ##t=T2/T1\n", - "d=1./t ##d=d2/d1 i.e. density ratio\n", - "v=1./d ##v=Vx2/Vx1 axial velocity ratio\n", - "ndaf=1.-(v) ##nondimensional axial force acting on the combustor walls\n", - "print'%s %.1f %s'%(\"The nondimensional axial force acting on the combustor walls:\",ndaf,\"\")\n", - "print(\"Negative sign signifies a thrust production by the device\")\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Example 2.15\n", - "The nondimensional axial force acting on the combustor walls: -0.8 \n", - "Negative sign signifies a thrust production by the device\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex16-pg89" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "print(\"Example 2.16\")\n", - "t=0.79 ##T2/T1 i.e. turbione expansion\n", - "gm=1.4 ##gamma\n", - "##calculations:\n", - "d=t**(1./(gm-1.))\n", - "##print'%s %.1f %s'%(d)\n", - "a=1./d ##area ratio\n", - "p=d**gm ##pressure ratio\n", - "ndaf=1.-p*a\n", - "print'%s %.2f %s'%(\"The nondimensional axial force:\",ndaf,\"\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Example 2.16\n", - "The nondimensional axial force: 0.21 \n" - ] - } - ], - "prompt_number": 16 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Short_Course_by_e/screenshots/warning.png b/Short_Course_by_e/screenshots/warning.png deleted file mode 100644 index 81a93724..00000000 Binary files a/Short_Course_by_e/screenshots/warning.png and /dev/null differ diff --git a/Short_Course_by_e/screenshots/warning_1.png b/Short_Course_by_e/screenshots/warning_1.png deleted file mode 100644 index 81a93724..00000000 Binary files a/Short_Course_by_e/screenshots/warning_1.png and /dev/null differ diff --git a/Short_Course_by_e/screenshots/warning_2.png b/Short_Course_by_e/screenshots/warning_2.png deleted file mode 100644 index 81a93724..00000000 Binary files a/Short_Course_by_e/screenshots/warning_2.png and /dev/null differ diff --git a/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_10_SILICON_CONTROLLED_RECTIFIER.ipynb b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_10_SILICON_CONTROLLED_RECTIFIER.ipynb new file mode 100755 index 00000000..6410798f --- /dev/null +++ b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_10_SILICON_CONTROLLED_RECTIFIER.ipynb @@ -0,0 +1,119 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10 SILICON CONTROLLED RECTIFIER" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 10_2 pgno: 296" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 100000000000000 /cmˆ−3\n", + "Er = 11.9\n", + "e = 1.6e-19 columns\n", + "Eo = 8.854e-14 F/cm\n", + "W = 0.01 cm\n", + " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "Punch trough voltage ,Vpt=(e∗Nd∗Wˆ2)/(2∗E))= 759.282705628 V\n" + ] + } + ], + "source": [ + "#exa 10.2\n", + "Nd =10**14\n", + "print\"Nd = \",Nd,\" /cmˆ−3\" # initializing value of donor ion concentration .\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "W=100*10**-4\n", + "print\"W = \",W,\" cm\" # initializing value of width of SCR.\n", + "E=Eo*Er\n", + "print\" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation\n", + "Vpt=(e*Nd*W**2)/(2*E)\n", + "print\"Punch trough voltage ,Vpt=(e∗Nd∗Wˆ2)/(2∗E))=\",Vpt,\" V\"# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exmaple 10_3 pgno: 296" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ia = 0.002 A\n", + "(ap+an) = 0.9\n", + "a = 0.45\n", + "Ico=Ia∗(1−(2∗an))= 0.0002 A\n", + "(da/dt)=1/2∗Ico∗((Ia)ˆ−2))= 25.0 /A\n" + ] + } + ], + "source": [ + "#exa 10.3\n", + "Ia =2e-3\n", + "print\"Ia = \",Ia,\" A\" # initializing value of forward current of thyrsistor .\n", + "x=0.9\n", + "print\"(ap+an) = \",x # initializing value of sum of current gain of n,ptype semiconductor [ value is get in by variable x,but represented on console window through ap +an ] .\n", + "a=0.45\n", + "print\"a = \",a # initializing value of current gain of both n,p type semiconductor (as it is assume that ap[current gain of n type semiconductor]=an[ current gain of ptype semiconductor ] in the question ) .\n", + "Ico=Ia*(1-(2*a))\n", + "print\"Ico=Ia∗(1−(2∗an))=\",Ico,\" A\" # calculation\n", + "y=1./2.*Ico*((Ia)**-2)\n", + "print\"(da/dt)=1/2∗Ico∗((Ia)ˆ−2))=\",y,\" /A\" # calculation\n", + "#The answer for (da/dt) after doing calculation is provided wrong in the book ." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_1_CRYSTAL_STRUCTURES.ipynb b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_1_CRYSTAL_STRUCTURES.ipynb new file mode 100755 index 00000000..cd376de8 --- /dev/null +++ b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_1_CRYSTAL_STRUCTURES.ipynb @@ -0,0 +1,677 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1 CRYSTAL STRUCTURES" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1_4 pgno:10" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 1.0\n", + "r=a/2 = 0.5\n", + "Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= 0.523598775598\n", + "Total Volume of the cube ,V=aˆ3 = 1.0\n", + "Fp(S.C)=(v∗100/V)= 52.3598775598\n" + ] + } + ], + "source": [ + "#exa 1.4\n", + "from math import pi\n", + "a=1.\n", + "print \"a= \",a # initializing value of lattice constant(a)=1.\n", + "r=a/2.\n", + "print \"r=a/2 = \",r # initializing value of radius of atom for simple cubic .\n", + "v=((4*pi*(r**3))/3)\n", + "print \"Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= \",v # calcuation . \n", + "V=a**3\n", + "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(S.C)=(v∗100/V)= \",Fp,# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1_5 pgno:11" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 1.0\n", + "Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = 0.433012701892\n", + "Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = 0.680174761588\n", + "Total Volume of the cube ,V=aˆ3 = 1.0\n", + "Fp(B.C.C)=(v∗100/V)= 68.0174761588 %\n" + ] + } + ], + "source": [ + "#exa 1.5\n", + "from math import sqrt\n", + "a=1.\n", + "print \"a= \",a # initializing value of lattice constant(a)=1.\n", + "r=(sqrt(3)*(a**2/4))\n", + "print \"Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = \",r # initializing value of radius of atom for BCC.\n", + "v=((4*pi*(r**3))/3)*2\n", + "print \"Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = \",v # calcuation \n", + "V=a**3\n", + "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(B.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_6 pgno:12" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 1\n", + "Radius of the atom,r=(a/(2∗sqrt(2)))= 0.353553390593\n", + "Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= 0.740480489693\n", + "Total volume of the cube ,V=aˆ3= 2\n", + "Fp(F.C.C)=(v∗100/V)= 37.0240244847 %\n" + ] + } + ], + "source": [ + "#exa 1.6\n", + "a=1\n", + "print \"a= \",a # initializing value of lattice constant(a)=1.\n", + "r=(a/(2*sqrt(2)))\n", + "print \"Radius of the atom,r=(a/(2∗sqrt(2)))= \",r # initializing value of radius of atom for FCC .\n", + "v=(((4*pi*(r**3))/3)*4)\n", + "print \"Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= \",v # calcuation \n", + "V=a^3\n", + "print \"Total volume of the cube ,V=aˆ3= \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(F.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_8 pgno:14" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 1\n", + "Radius of the atom , r=(sqrt (3)∗a/8))= 0.216506350946\n", + "v=(((4∗pi∗(rˆ3))/3)∗8) = 0.340087380794\n", + "V=aˆ3= 2\n", + "Fp(Diamond)=(v∗100/V) = 17.0043690397 %\n" + ] + } + ], + "source": [ + "#Exa 1.8 \n", + "a=1\n", + "print \"a= \",a # initializing value of lattice constant(a)=1.\n", + "r=((sqrt(3)*a/8))\n", + "print \"Radius of the atom , r=(sqrt (3)∗a/8))= \",r # initializing value of radius of atom for diamond .\n", + "v=(((4*pi*(r**3))/3)*8)\n", + "print \"v=(((4∗pi∗(rˆ3))/3)∗8) = \",v # calcuation .\n", + "V=a^3\n", + "print \"V=aˆ3= \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(Diamond)=(v∗100/V) = \",Fp,\"%\" # calculation\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_9 pgno:14" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a = 5e-08 cm\n", + "Radius of the atom,r=(sqrt(3)∗(a/4))= 2.16506350946e-08\n", + "Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= 8.50218451985e-23\n", + "Total Volume of the cube ,V=aˆ3 = 1.25e-22\n", + "Fp(B.C.C)=(v∗100/V) = 68.0174761588 %\n" + ] + } + ], + "source": [ + "#exa 1.9\n", + "a=5*10**-8\n", + "print \"a = \",a,\" cm\" # initializing value of lattice constant .\n", + "r=(sqrt(3)*(a/4))\n", + "print \"Radius of the atom,r=(sqrt(3)∗(a/4))= \",r # initializing value of radius of atom for BCC.\n", + "v=((4*pi*(r**3))/3)*2\n", + "print \"Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= \",v # calcuation .\n", + "V=a**3\n", + "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(B.C.C)=(v∗100/V) = \",Fp,\"%\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_10 pgno:" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x intercept = 1\n", + "y intercept = inf\n", + "z intercept = inf\n", + "miller indices ,h=(1/x )= [1]\n", + "k=(1/y)= [0.0]\n", + "l=(1/z) = [0.0]\n" + ] + } + ], + "source": [ + "#exa 1.10\n", + "x=1\n", + "print \"x intercept = \",x # initializing value of x intercept .\n", + "y=float('inf')\n", + "print \"y intercept = \",y # initializing value of y intercept .\n", + "z=float('inf')\n", + "print \"z intercept = \",z # initializing value of z intercept .\n", + "h=[1/x]\n", + "print \"miller indices ,h=(1/x )= \",h # calculation\n", + "k=[1/y]\n", + "print \"k=(1/y)= \",k # calculation\n", + "l=[1/z]\n", + "print \"l=(1/z) = \",l # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_11 pgno:15" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x intercept = inf\n", + "y intercept = inf\n", + "z intercept = 1\n", + "miller indices ,h=[1/x] = [0.0]\n", + "k=[1/y] = [0.0]\n", + "l=[1/z] = [1]\n" + ] + } + ], + "source": [ + "#exa 1.11\n", + "x=float('inf')\n", + "print \"x intercept = \",x # initializing of x intercept .\n", + "y=float('inf') \n", + "print\"y intercept = \",y # initializing of Y intercept .\n", + "z=1\n", + "print \"z intercept = \",z # initializing of Z intercept .\n", + "h=[1/x]\n", + "print \"miller indices ,h=[1/x] = \",h # calculation\n", + "k=[1/y]\n", + "print \"k=[1/y] = \",k # calculation \n", + "l=[1/z]\n", + "print \"l=[1/z] = \",l # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_12 pgno: 16" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x intercept = inf\n", + "y intercept = 1\n", + "z intercept = inf\n", + "miller indices ,h=[1/x] = [0.0]\n", + "k=[1/y] = [1]\n", + "l=[1/z] = [0.0]\n" + ] + } + ], + "source": [ + "#exa 1.12\n", + "x=float('inf') \n", + "print \"x intercept = \",x # initializing of X intercept .\n", + "y=1\n", + "print \"y intercept = \",y # initializing of X intercept .\n", + "z=float('inf') \n", + "print \"z intercept = \",z # initializing of X intercept .\n", + "h=[1/x]\n", + "print \"miller indices ,h=[1/x] = \",h # calculation\n", + "k=[1/y]\n", + "print \"k=[1/y] = \",k # calculation \n", + "l=[1/z]\n", + "print \"l=[1/z] = \",l #calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_13 pgno:16" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x intercept = 1\n", + "y intercept = 1\n", + "z intercept = inf\n", + "miller indices ,h=[1/x] = [1]\n", + "k=[1/y] = [1]\n", + "l=[1/z] = [0.0]\n" + ] + } + ], + "source": [ + "#exa 1.13\n", + "x=1\n", + "print \"x intercept = \",x # initializing of X intercept .\n", + "y=1\n", + "print \"y intercept = \",y # initializing of X intercept .\n", + "z=float('inf') \n", + "print \"z intercept = \",z # initializing of X intercept .\n", + "h=[1/x]\n", + "print \"miller indices ,h=[1/x] = \",h # calculation\n", + "k=[1/y]\n", + "print \"k=[1/y] = \",k # calculation \n", + "l=[1/z]\n", + "print \"l=[1/z] = \",l #calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_14 pgno:17" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x intercept = inf\n", + "y intercept = 1\n", + "z intercept = 1\n", + "miller indices ,h=[1/x] = [0.0]\n", + "k=[1/y] = [1]\n", + "l=[1/z] = [1]\n" + ] + } + ], + "source": [ + "#exa 1.14\n", + "x=float('inf') \n", + "print \"x intercept = \",x # initializing of X intercept .\n", + "y=1\n", + "print \"y intercept = \",y # initializing of X intercept .\n", + "z=1\n", + "print \"z intercept = \",z # initializing of X intercept .\n", + "h=[1/x]\n", + "print \"miller indices ,h=[1/x] = \",h # calculation\n", + "k=[1/y]\n", + "print \"k=[1/y] = \",k # calculation \n", + "l=[1/z]\n", + "print \"l=[1/z] = \",l #calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_15 pgno:18" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x intercept = 2\n", + "y intercept = 2\n", + "z intercept = 2\n", + "common factor of all the intercept= 2\n", + "miller indices ,h=[c/x] = [1]\n", + "k=[c/y] = [1]\n", + "l=[c/z] = [1]\n" + ] + } + ], + "source": [ + "x=2\n", + "print \"x intercept = \",x # initializing of X intercept .\n", + "y=2\n", + "print \"y intercept = \",y # initializing of X intercept .\n", + "z=2\n", + "print \"z intercept = \",z # initializing of X intercept .\n", + "c=2\n", + "print \"common factor of all the intercept= \",c # initializing value of common factor of all the intercepts .\n", + "h=[c/x]\n", + "print \"miller indices ,h=[c/x] = \",h # calculation\n", + "k=[c/y]\n", + "print \"k=[c/y] = \",k # calculation \n", + "l=[c/z]\n", + "print \"l=[c/z] = \",l #calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_16 pgno: 18" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Wa = 28.1\n", + "D = 2.33 ram/cmˆ3\n", + "Na = 6.02e+23 atoms/mole\n", + "na =(Na∗D)/(Wa)= 4.99167259786e+22 atoms/cmˆ3\n" + ] + } + ], + "source": [ + "#exa 1.16\n", + "Wa =28.1\n", + "print \"Wa = \",Wa # initializing value of atomic weight .\n", + "D=2.33\n", + "print \"D = \",D,\"ram/cmˆ3\" # initializing value of density .\n", + "Na=6.02*10**23\n", + "print \"Na = \",Na,\"atoms/mole\" # initializing value of avagadro number .\n", + "na =(Na*D)/(Wa)\n", + "print \"na =(Na∗D)/(Wa)= \",na,\" atoms/cmˆ3\" # calculation\n", + "# the value of na (number of atoms in 1 cmˆ3 of silicon ) , provided after calculation in the book is wrong." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_17 pgno: 18" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 5e-08 cm\n", + "N= 2\n", + "V=aˆ3 = 1.25e-22 cmˆ3\n", + "na=(no.of atoms in unit cell/Volume of theunit cell) =(N/(V))= 1.6e+22\n" + ] + } + ], + "source": [ + "#exa 1.17\n", + "a=5*10**-8\n", + "print \"a= \",a,\"cm\" # initializing value of lattice constant .\n", + "N=2\n", + "print \"N= \",N # initializing value of no. of atoms in unit cell .\n", + "V=a**3\n", + "print \"V=aˆ3 = \",V,\"cmˆ3\" # initializing value of total Volume of the unit cell.\n", + "na =(N/(V))\n", + "print \"na=(no.of atoms in unit cell/Volume of theunit cell) =(N/(V))= \",na # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_18 pgno: 18" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a = 5.43e-08 cm\n", + "N = 8\n", + "Number of atom in the cmˆ3,ns =(N/(aˆ3))= 4.99678310227e+22\n" + ] + } + ], + "source": [ + "#exa 1.18\n", + "a=5.43*10**-8\n", + "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n", + "N=8\n", + "print \"N = \",N # initializing value of no. of atoms in a unit cell .\n", + "ns =(N/(a**3))\n", + "print \"Number of atom in the cmˆ3,ns =(N/(aˆ3))= \",ns # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_19 pgno: 18" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a = 5.43e-08 cm\n", + "Wa = 28.1\n", + "Na = 6.02e+23\n", + "ns = 50000000000000000000000 atoms/cmˆ3\n", + "Density of silicon ,D =(ns∗Wa)/(Na)= 2.33388704319 gm/cmˆ2\n" + ] + } + ], + "source": [ + "#exa 1.19\n", + "a=5.43*10**-8\n", + "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n", + "Wa =28.1\n", + "print \"Wa = \",Wa # initializing value of atomic weight .\n", + "Na=6.02*10**23\n", + "print \"Na = \",Na # initializing value of avagdro number .\n", + "ns =5*10**22\n", + "print \"ns = \",ns,\"atoms/cmˆ3\" # initializing value of atoms/cmˆ3.\n", + "D =(ns*Wa)/(Na)\n", + "print \"Density of silicon ,D =(ns∗Wa)/(Na)= \",D,\" gm/cmˆ2\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_20 pgno: 19" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a = 4.75e-08 cm\n", + "N = 4\n", + "na =(N/(aˆ3))= 3.73232249599e+22\n" + ] + } + ], + "source": [ + "#exa 1.20\n", + "a=4.75*10**-8\n", + "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n", + "N=4\n", + "print \"N = \",N # initializing value of number of atoms in the unit cell .\n", + "na =(N/(a**3))\n", + "print \"na =(N/(aˆ3))=\",na # calculation" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_6_ELECTRICAL_BREAKDOWN_IN_PN_JUNCTIONS.ipynb b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_6_ELECTRICAL_BREAKDOWN_IN_PN_JUNCTIONS.ipynb new file mode 100755 index 00000000..95315558 --- /dev/null +++ b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_6_ELECTRICAL_BREAKDOWN_IN_PN_JUNCTIONS.ipynb @@ -0,0 +1,991 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6 ELECTRICAL BREAKDOWN IN PN JUNCTIONS" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_2 pgno: 183" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "X1 = 4.13 eV\n", + "X2 = 4.07 eV\n", + "Eg1 = 0.7 eV\n", + "Eg2 = 1.43 F/cm\n", + "Nv1 = 6e+18 cmˆ−3\n", + "Nv2 = 7e+18 cmˆ−3\n", + "Vt = 0.0259 eV\n", + "e = 1.6e-19 columbs\n", + "no = 2.5e+13 cmˆ−3\n", + "Pp = 1e+17 cmˆ−3\n", + "Nd = 1e+17 cmˆ−3\n", + "np= 6250000000.0 cmˆ−3\n", + "delta Eg=(Eg2−Eg1)= 0.73 eV\n", + "delta Ec=(X1−X2)= 0.06 eV\n", + "delta  Ev=(delta  Eg−delta  Ec )= 0.67 eV\n", + "Vbi=((delta Ev∗1.6∗10ˆ−19)/(e))+((Vt∗log((Nv1∗Nd) /(np∗Nv2) ) ) )= 1.09563926875 V\n" + ] + } + ], + "source": [ + "#exa 6.2\n", + "from math import log\n", + "X1 =4.13\n", + "print\"X1 = \",X1,\" eV\" # initializing value of eldelta Ectron effinity of germanium.\n", + "X2 =4.07\n", + "print\"X2 = \",X2,\" eV\" # initializing value of electron effinity of gallium arsenide .\n", + "Eg1 =0.7\n", + "print\"Eg1 = \",Eg1,\" eV\" # initializing value of energy gap of germanium .\n", + "Eg2 =1.43\n", + "print\"Eg2 = \",Eg2,\" F/cm\" # initializing value of energy gap of gallium arsenide..\n", + "Nv1 =6e18\n", + "print\"Nv1 = \",Nv1,\" cmˆ−3\" # initializing value of density of states in Valence band,Nv for germanium .\n", + "Nv2 =7e18\n", + "print\"Nv2 = \",Nv2,\" cmˆ−3\" # initializing value of density of states in Valence band,Nv for galliminum arsenide .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing valueof thermal voltage . . . Vt = K∗T/e\n", + "e=1.6e-19\n", + "print\"e = \",e,\" columbs\" # initializing value of electronic charge .\n", + "no=2.5e13\n", + "print\"no = \",no,\" cmˆ−3\" # initializingvalue of intrinsic carrier concentration .\n", + "Pp=1e17\n", + "print\"Pp = \",Pp,\" cmˆ−3\" # initializing value of hole concentration on the depletion edge of the N region .\n", + "Nd=1e17\n", + "print\"Nd = \",Nd,\" cmˆ−3\" # initializing value of number of donor ions (which is equal to hole concentration on the depletion edge of the N region).\n", + "np=(no**2)/Pp\n", + "print\"np=\",np,\" cmˆ−3\"# calculation\n", + "delta_Eg=(Eg2-Eg1)\n", + "print\"delta Eg=(Eg2−Eg1)=\",delta_Eg,\" eV\"#calculation\n", + "delta_Ec=(X1-X2)\n", + "print\"delta Ec=(X1−X2)=\",delta_Ec,\" eV\"#calculation\n", + "delta_Ev=(delta_Eg-delta_Ec)\n", + "print\"delta  Ev=(delta  Eg−delta  Ec )=\",delta_Ev,\" eV\"# calculation\n", + "Vbi=((delta_Ev*1.6*10**-19)/(e))+((Vt*log((Nv1*Nd)/(np*Nv2))))\n", + "print\"Vbi=((delta Ev∗1.6∗10ˆ−19)/(e))+((Vt∗log((Nv1∗Nd) /(np∗Nv2) ) ) )=\",Vbi,\" V\"# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4 pgno: 184" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nc = 2.8e+19 cmˆ−3\n", + "k = -4e+15 cmˆ4Fˆ−2Vˆ−1\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "e = 1.6e-19 columns\n", + "Vt = 0.0259 eV\n", + "VBI = 0.3 V\n", + " total permittivity ,E=Eo∗Er = 1.053626e-12 F/cm \n", + "Nd=((−2)/(e∗E)∗(1/k)))= 2.96594806886e+15 cmˆ−3\n", + "Vn=(Vt∗( log (Nc/Nd) ) )= 0.237056563109 V\n", + "VBn=(VBI+Vn)= 0.537056563109 V\n" + ] + } + ], + "source": [ + "#exa 6.4\n", + "from math import log\n", + "Nc=2.8e19\n", + "print\"Nc = \",Nc,\" cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", + "k=-4e15\n", + "print\"k = \",k,\" cmˆ4Fˆ−2Vˆ−1\" # initializing value of slope of the (1/Cˆ2) versus V curve.\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854e-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of dielectric constant of free space.\n", + "e=1.6e-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "VBI=0.3\n", + "print\"VBI = \",VBI,\" V\" # initializing value of built in voltage .\n", + "E=Eo*Er\n", + "print\" total permittivity ,E=Eo∗Er =\",E,\" F/cm \"# calculation\n", + "Nd=((-2)/(e*E)*(1/k))\n", + "print\"Nd=((−2)/(e∗E)∗(1/k)))=\",Nd,\" cmˆ−3\" # c a l c u l a t i o n\n", + "Vn=(Vt*(log(Nc/Nd)))\n", + "print\"Vn=(Vt∗( log (Nc/Nd) ) )=\",Vn,\" V\"#calculation\n", + "VBn=(VBI+Vn)\n", + "print\"VBn=(VBI+Vn)=\",VBn,\" V\"# calculation\n", + "# taking ,... d(1/Cˆ2)/dV as k,... for simlification," + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_5 pgno: 184" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 2e+17 /cmˆ−3\n", + "Nc = 2.8e+19 /cmˆ−3\n", + "Js = 4e-05 A/cmˆ2\n", + "T = 300 K\n", + "R = 110 A/(K−cmˆ2)\n", + "Vt = 0.0259 eV\n", + "VBn = 0.679478119251 V\n", + "Vn = 0.127988538746 V\n", + "VBI=(VBn−Vn))= 0.551489580505 V\n" + ] + } + ], + "source": [ + "#exa 6.5\n", + "from math import log\n", + "Nd =2e17\n", + "print\"Nd = \",Nd,\"/cmˆ−3\" # initializing value of donor concentration .\n", + "Nc=2.8e19\n", + "print\"Nc = \",Nc,\"/cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", + "Js =40e-6\n", + "print\"Js = \",Js,\"A/cmˆ2\" # initializing value of saturation current density .\n", + "T=300\n", + "print\"T = \",T,\"K\" # initializing value of absolute temperature .\n", + "R=110\n", + "print\"R = \",R,\" A/(K−cmˆ2)\" #initializing value of richardson ’ s constant .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "VBn=(Vt*(log(R*T**2/Js)))\n", + "print\"VBn = \",VBn,\" V\" # calculation .\n", + "Vn=(Vt*(log(Nc/Nd)))\n", + "print\"Vn = \",Vn,\" V\" # calculation .\n", + "VBI=(VBn-Vn)\n", + "print\"VBI=(VBn−Vn))=\",VBI,\" V\"#calculation\n", + "#The value of Vn (after calculation ) is provided wrong in the book,due to which VBI also differ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_6 pgno: 186" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 200000000000000000 /cmˆ−3\n", + "Dp = 30 cmˆ2/s\n", + "Nc = 2.8e+19 /cmˆ−3\n", + "Js = 4e-05 A/cmˆ2\n", + "no = 15000000000.0 cmˆ−3\n", + "tp = 1e-06 s\n", + "T = 300 K\n", + "R = 110 A/(K−cmˆ2)\n", + "Vt = 0.0259 eV\n", + "e = 1.6e-19 columbs\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + " total permittivity ,E=Eo∗Er)= 1.053626e-12 F/cm\n", + "VBn = 0.679478119251 V\n", + "Vn = 0.127988538746 V\n", + "VBI=(VBn−Vn))= 0.551489580505 V\n", + "current density in a metal semiconductor junction ,W = 4.26124893939e-06 A\n", + "Diffusion length ,Lp=(sqrt(Dp∗tp)) = 0.00547722557505 cm\n", + " saturation hole current density , Jpo=(e∗Dp∗noˆ2) /(Lp∗Nd) ) = 9.85900603509e-13 A/cmˆ2\n" + ] + } + ], + "source": [ + "#exa 6.6\n", + "from math import sqrt\n", + "from math import log\n", + "Nd =2*10**17\n", + "print\"Nd = \",Nd,\" /cmˆ−3\" # initializing value of donor concentration .\n", + "Dp=30\n", + "print\"Dp = \",Dp,\" cmˆ2/s\" # initializing value of diffusion cofficient .\n", + "Nc=2.8*10**19\n", + "print\"Nc = \",Nc,\" /cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", + "Js =40*10**-6\n", + "print\"Js = \",Js, \"A/cmˆ2\" # initializing value of saturation current density .\n", + "no=1.5*10**10\n", + "print\"no = \",no,\" cmˆ−3\" # initializing value of intrinsic concentration of electrons .\n", + "tp=10**-6\n", + "print\"tp = \",tp,\" s\" # initializing value of hole life−time.\n", + "T=300\n", + "print\"T = \",T,\" K\" # initializing value of absolute temperature .\n", + "R=110\n", + "print\"R = \",R,\" A/(K−cmˆ2)\" #initializing value of richardson ’ s constant .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columbs\" # initializing value of charge of electrons .\n", + "Er=11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of dielectric constant of free space.\n", + "E=Eo*Er\n", + "print\" total permittivity ,E=Eo∗Er)=\",E,\" F/cm\"# calculation\n", + "VBn=(Vt*(log(R*T**2/Js)))\n", + "print\"VBn = \",VBn,\" V\" # calculation .\n", + "Vn=(Vt*(log(Nc/Nd)))\n", + "print\"Vn = \",Vn,\" V\" # calculation .\n", + "VBI=(VBn-Vn)\n", + "print\"VBI=(VBn−Vn))=\",VBI,\" V\"#calculation\n", + "W=(sqrt((E*VBI)/(e*Nd)))\n", + "print\"current density in a metal semiconductor junction ,W = \",W,\" A\" # calculation .\n", + "Lp=(sqrt(Dp*tp))\n", + "print\"Diffusion length ,Lp=(sqrt(Dp∗tp)) = \", Lp,\" cm\" # calculation .\n", + "Jpo=(e*Dp*no**2)/(Lp*Nd)\n", + "print\" saturation hole current density , Jpo=(e∗Dp∗noˆ2) /(Lp∗Nd) ) = \",Jpo,\" A/cmˆ2\" # calculation .\n", + "#The value of Vn (after calculation ) is provided wrong in the book,due to which VBI differ and due to VBI ,current density in a metal semiconductor junction (W) gets changed .\n", + "#The value of Jpo ( saturation hole current density ),after calculation is also provided wrong in the book .," + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_8 pgno:186" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "VBD = 20 V\n", + "e = 1.6e-19 columns\n", + " total permittivity ,E=Eo∗Er)= 1.053626e-12 F/cm\n", + "Emax = 500000 V/cm\n", + "ND=(Eo∗Er∗(Emaxˆ2))/(2∗e∗VBD)= 4.1157265625e+16 cmˆ−3\n" + ] + } + ], + "source": [ + "#exa 6.8\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "VBD =20\n", + "print\"VBD = \",VBD,\" V\" #initializing value of break down voltage .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "E=Eo*Er\n", + "print\" total permittivity ,E=Eo∗Er)=\",E,\" F/cm\"# calculation\n", + "Emax =5*10**5\n", + "print\"Emax = \",Emax,\" V/cm\" # initializing value of maximum critical electric field .\n", + "ND=(Eo*Er*(Emax**2))/(2*e*VBD)\n", + "print\"ND=(Eo∗Er∗(Emaxˆ2))/(2∗e∗VBD)=\",ND,\"cmˆ−3\"# calculation\n", + "#the formula given in the solution for VBD is somewhat written wrong.The correct formula is ( VBD=(E∗Emaxˆ2/2∗e∗ND)) ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_9 pgno: 187" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "e = 1.6e-19 columns\n", + "no = 15000000000.0 cmˆ−3\n", + "Nd= 1e+16 cmˆ−3\n", + "Emax = 200000.0 V/cm\n", + "Na= 1e+16 cmˆ−3\n", + "Vt = 0.0259 eV\n", + " total permittivity ,E=Eo∗Er)= 1.053626e-12 F/cm\n", + "VBI=(Vt∗(log(Na∗Nd/noˆ2))) = 0.694640354303 V\n", + "breakdown voltage for symetrical abrupt junction ,VBD+VBI=(E∗Emaxˆ2) /( e∗Nd) )= 26.34065 V\n", + "VBD=V−VBI = 25.6460096457 V\n" + ] + } + ], + "source": [ + "#exa 6.9\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", + "Eo=8.854e-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "e=1.6e-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "no=1.5e10\n", + "print\"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration of electrons .\n", + "Nd =1e16\n", + "print\"Nd=\",Nd,\" cmˆ−3\"#initializing the value of donor concentration .\n", + "Emax =2e5\n", + "print\"Emax = \",Emax,\" V/cm\" # initializing value of maximum critical electric field .\n", + "Na =1e16\n", + "print\"Na=\",Na,\" cmˆ−3\"# initializing the value of acceptor concentration .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "E=Eo*Er\n", + "print\" total permittivity ,E=Eo∗Er)=\",E,\" F/cm\"# calculation\n", + "VBI=(Vt*(log(Na*Nd/no**2)))\n", + "print\"VBI=(Vt∗(log(Na∗Nd/noˆ2))) = \",VBI,\" V\" # calculation .\n", + "V=(E*Emax**2)/(e*Nd)\n", + "print\"breakdown voltage for symetrical abrupt junction ,VBD+VBI=(E∗Emaxˆ2) /( e∗Nd) )=\",V,\"V\" # calculation \n", + "VBD=V-VBI\n", + "print\"VBD=V−VBI =\",VBD,\" V\"# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_10 pgno: 187" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "e = 1.6e-19 columns\n", + "no = 15000000000.0 cmˆ−3\n", + "Emax = 1000000 V/cm\n", + "Nd= 1000000000000000000 cmˆ−3\n", + "Na= 1000000000000000000 cmˆ−3\n", + "Vt = 0.0259 eV\n", + "VBI=(Vt∗(log(Na∗Nd/noˆ2))) = 0.933188169937 V\n", + " total permittivity ,E=Eo∗Er)= 1.053626e-12 F/cm 99\n", + "breakdown voltage for symetrical abrupt junction ,VBD+VBI=(E∗Emaxˆ2) /( e∗Nd) )= 6.5851625 V\n", + "VBD=V−VBI)= 5.65197433006 V\n" + ] + } + ], + "source": [ + "#exa 6.10\n", + "from math import log\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "no=1.5*10**10\n", + "print\"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration of electrons .\n", + "Emax=10**6\n", + "print\"Emax = \",Emax,\" V/cm\" # initializing value of maximum critical electric field ..\n", + "Nd =1*10**18\n", + "print\"Nd=\",Nd,\" cmˆ−3\"#initializing the value of donor concentration .\n", + "Na =1*10**18\n", + "print\"Na=\",Na,\" cmˆ−3\"# initializing the value of acceptor concentration .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "VBI=(Vt*(log(Na*Nd/no**2)))\n", + "print\"VBI=(Vt∗(log(Na∗Nd/noˆ2))) = \",VBI,\" V\" # calculation .\n", + "E=Eo*Er\n", + "print\" total permittivity ,E=Eo∗Er)=\",E,\" F/cm 99\"# calculation\n", + "V=(E*Emax**2)/(e*Nd)\n", + "print\"breakdown voltage for symetrical abrupt junction ,VBD+VBI=(E∗Emaxˆ2) /( e∗Nd) )=\",V,\"V\"# calculation\n", + "VBD=V-VBI\n", + "print\"VBD=V−VBI)=\",VBD,\" V\"# calculation" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 1e+18 cmˆ−3\n", + "Na = -1e+18 cmˆ3\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "e = 1.6e-19 columns\n", + "Vt = 0.0259 eV\n", + "Vbd = 15 eV\n", + "W = 0.0002 cm\n", + " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "slope of doping profile curve ,a=((Nd−Na)/(W))= 1e+22 cmˆ−4\n", + "Emax=(((Vbd)ˆ2)∗9∗e∗a/(32∗E))ˆ(1/3)= 1.0 V/cm\n" + ] + } + ], + "source": [ + "#exa 6.11\n", + "Nd =1e18\n", + "print\"Nd = \",Nd,\" cmˆ−3\" # initializing value of donor concentration .\n", + "Na = -1e18\n", + "print\"Na = \",Na,\" cmˆ3\" # initializing value of acceptor concentration .\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854e-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of dielectric constant of free space.\n", + "e=1.6e-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "Vbd=15\n", + "print\"Vbd = \",Vbd,\" eV\" # initializing value of break down voltage .\n", + "W=2e-4\n", + "print\"W = \",W,\" cm\" # initializing value of the distance over which doping profile varies.\n", + "E=Eo*Er\n", + "print\" total permittivity ,E=Eo∗Er=\",E,\" F/cm\"# calculation\n", + "a=((Nd-Na)/(W))\n", + "print\"slope of doping profile curve ,a=((Nd−Na)/(W))= \",a,\" cmˆ−4\"# calculation\n", + "Emax=(((Vbd)**2)*9*e*a/(32*E))**(1/3)\n", + "print\"Emax=(((Vbd)ˆ2)∗9∗e∗a/(32∗E))ˆ(1/3)=\",Emax,\" V/cm\"# calculation\n", + "## calculation was given wrong in the book" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_12 pgno: 188" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ew = 4.55 V\n", + "X = 4.01 V\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "e = 1.6e-19 columns\n", + "Nc = 2.8e+19 /cmˆ−3\n", + "Nd = 100000000000000000 /cmˆ−3\n", + "Vt = 0.0259 eV\n", + " Barrier height ,VB=(Ew−X) = 0.54 V\n", + "Ec Ef=(Vt∗log(Nc/Nd))= 0.145941050722 V\n", + "VBI=(VB−(Ec  Ef ) )= 0.394058949278 V\n", + "Depletion width ,xn=sqrt(2∗Eo∗Er∗VBI/(e∗Nd))= 7.20408525154e-06 cm\n", + "maximum electric field ,Emax=(e∗Nd∗xn/(Eo∗Er))= 109398.746827 V/cm\n" + ] + } + ], + "source": [ + "#exa 6.12\n", + "from math import sqrt\n", + "from math import log\n", + "Ew =4.55\n", + "print\"Ew = \",Ew,\" V\" # initializing value of work function of tungusten .\n", + "X=4.01\n", + "print\"X = \",X,\"V\" # initializing value of electron effinity of silicon .\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "Nc=2.8*10**19\n", + "print\"Nc = \",Nc,\"/cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", + "Nd=10**17\n", + "print\"Nd = \",Nd,\"/cmˆ−3\" # initializing value of donor concentration .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "VB=(Ew-X)\n", + "print\" Barrier height ,VB=(Ew−X) = \",VB,\" V\" # calculation .\n", + "Ec_Ef=(Vt*log(Nc/Nd))\n", + "print\"Ec Ef=(Vt∗log(Nc/Nd))=\",Ec_Ef,\" V\"#calculation\n", + "VBI=(VB-(Ec_Ef))\n", + "print\"VBI=(VB−(Ec  Ef ) )=\",VBI,\" V\"# calculation\n", + "xn=sqrt(2*Eo*Er*VBI/(e*Nd))\n", + "print\"Depletion width ,xn=sqrt(2∗Eo∗Er∗VBI/(e∗Nd))=\",xn,\" cm\"# calculation\n", + "Emax=(e*Nd*xn/(Eo*Er))\n", + "print\"maximum electric field ,Emax=(e∗Nd∗xn/(Eo∗Er))=\",Emax,\" V/cm\"# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_13 pgno: 189" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ew = 4.5 V\n", + "X = 4.01 V\n", + "Er = 12\n", + "Eo = 8.854e-14 F/cm\n", + "Vr = 3 V\n", + "e = 1.6e-19 columns\n", + "Nc = 2.8e+19 /cmˆ−3\n", + "Nd = 100000000000000000 /cmˆ−3\n", + "Vt = 0.0259 eV\n", + " barrier height ,VB=(Ew−X) = 0.49 V\n", + "Ec Ef=(Vt∗log(Nc/Nd))= 0.145941050722 V\n", + "VBI=(VB−(Ec  Ef ) )= 0.344058949278 V\n", + "Depletion width ,xn=sqrt(2∗Eo∗Er∗(VBI+Vr)/(e∗Nd))= 2.10742608187e-05 cm\n", + "maximum electric field ,Emax=(e∗Nd∗xn/(Eo∗Er))= 317359.548508 V/cm\n", + "Capitance per unit area ,C=sqrt (( e∗Eo∗Er∗Nd)/(2∗(VBI+Vr) ) )= 5.04160031586e-08 F/cmˆ2\n" + ] + } + ], + "source": [ + "#exa 6.13\n", + "from math import sqrt\n", + "from math import log\n", + "Ew =4.5\n", + "print\"Ew = \",Ew,\" V\" # initializing value of work function of tungusten .\n", + "X=4.01\n", + "print\"X = \",X,\"V\" # initializing value of electron effinity of silicon .\n", + "Er=12\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "Vr=3\n", + "print\"Vr = \",Vr,\" V\" # initializing value of reverse voltage .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "Nc=2.8*10**19\n", + "print\"Nc = \",Nc,\"/cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", + "Nd=10**17\n", + "print\"Nd = \",Nd,\"/cmˆ−3\" # initializing value of donor concentration .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "VB=(Ew-X)\n", + "print\" barrier height ,VB=(Ew−X) = \",VB,\" V\"# calculation .\n", + "Ec_Ef=(Vt*log(Nc/Nd))\n", + "print\"Ec Ef=(Vt∗log(Nc/Nd))=\",Ec_Ef,\" V\"#calculation\n", + "VBI=(VB-(Ec_Ef))\n", + "print\"VBI=(VB−(Ec  Ef ) )=\",VBI,\" V\"#calculation\n", + "xn=sqrt((2*Eo*Er*(VBI+Vr))/(e*Nd))\n", + "print\"Depletion width ,xn=sqrt(2∗Eo∗Er∗(VBI+Vr)/(e∗Nd))=\",xn,\" cm\"#calculation\n", + "Emax=(e*Nd*xn/(Eo*Er))\n", + "print\"maximum electric field ,Emax=(e∗Nd∗xn/(Eo∗Er))=\",Emax,\" V/cm\"# calculation\n", + "C=sqrt((e*Eo*Er*Nd)/(2*(VBI+Vr)))\n", + "print\"Capitance per unit area ,C=sqrt (( e∗Eo∗Er∗Nd)/(2∗(VBI+Vr) ) )=\",C,\" F/cmˆ2\"# calculation\n", + "#the Value of reverse voltage(Vr) provided in the question is different than used in the solution . I have used the value provided in the solution ( i . e Vr=3).\n", + "#the value of C (Capitance per unit area) after calculation is provided wrong in the book." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_13 pgno: 190" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ew = 4.28 V\n", + "X = 4.01 V\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "e = 1.6e-19 columns\n", + "Nc = 2.8e+19 /cmˆ−3\n", + "Nd = 1000000000000000 /cmˆ−3\n", + "Vt = 0.0259 eV\n", + " barrier height ,VB=(Ew−X) = 0.27 V\n", + "Ec Ef=(Vt∗log(Nc/Nd))= 0.265214958539 V\n", + "VBI=(VB−(Ec  Ef ) )= 0.00478504146083 V\n", + "Depletion width ,xn=sqrt(2∗Eo∗Er∗VBI/(e∗Nd))= 7.93854843013e-06 cm\n", + "maximum electric field ,Emax=(e∗Nd∗xn/(Eo∗Er))= 1205.52050616 V/cm\n" + ] + } + ], + "source": [ + "#exa 6.14\n", + "from math import log\n", + "Ew =4.28\n", + "print\"Ew = \",Ew,\" V\" # initializing value of work function of tungusten .\n", + "X=4.01\n", + "print\"X = \",X,\"V\" # initializing value of electron effinity of silicon .\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "Nc=2.8*10**19\n", + "print\"Nc = \",Nc,\"/cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", + "Nd=10**15\n", + "print\"Nd = \",Nd,\"/cmˆ−3\" # initializing value of donor concentration .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "VB=(Ew-X)\n", + "print\" barrier height ,VB=(Ew−X) = \",VB,\" V\"# calculation .\n", + "Ec_Ef=(Vt*log(Nc/Nd))\n", + "print\"Ec Ef=(Vt∗log(Nc/Nd))=\",Ec_Ef,\" V\"#calculation\n", + "VBI=(VB-(Ec_Ef))\n", + "print\"VBI=(VB−(Ec  Ef ) )=\",VBI,\" V\"#calculation\n", + "xn=sqrt(2*Eo*Er*VBI/(e*Nd))\n", + "print\"Depletion width ,xn=sqrt(2∗Eo∗Er∗VBI/(e∗Nd))=\",xn,\" cm\"# calculation\n", + "Emax=(e*Nd*xn/(Eo*Er))\n", + "print\"maximum electric field ,Emax=(e∗Nd∗xn/(Eo∗Er))=\",Emax,\" V/cm\"# calculation\n", + "#the Value of donor concentration (Nd) provided in the question is different than used in the solution . I have used the value provided in the question(i.e Nd=10ˆ15). ,i.e answer differs than provided in the book ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_15 pgno: 191" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ew = 5.1 V\n", + "X = 4.01 V\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "e = 1.6e-19 columns\n", + "Nc = 2.8e+19 /cmˆ−3\n", + "Nd = 5000000000000000 /cmˆ−3\n", + "Vt = 0.0259 eV\n", + "Vr = 5 V\n", + "A = 0.0001 cmˆ2\n", + " barrier height ,VB=(Ew−X) = 1.09 V\n", + "Ec Ef=(Vt∗log(Nc/Nd))= 0.223530516607 V\n", + "VBI=(VB−(Ec  Ef ) )= 0.866469483393 V\n", + "Capitance per unit area ,C1=sqrt (( e∗Eo∗Er∗Nd)/(2∗(VBI+Vr) ) )= 8.4758805431e-09 F/cmˆ2\n", + "total junction capatiance ,C=C1∗A= 8.4758805431e-13 F\n" + ] + } + ], + "source": [ + "#exa 6.15\n", + "from math import sqrt\n", + "from math import log\n", + "Ew =5.1\n", + "print\"Ew = \",Ew,\" V\" # initializing value of work function of tungusten .\n", + "X=4.01\n", + "print\"X = \",X,\"V\" # initializing value of electron effinity of silicon .\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "Nc=2.8*10**19\n", + "print\"Nc = \",Nc,\"/cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", + "Nd =5*10**15\n", + "print\"Nd = \",Nd,\"/cmˆ−3\" # initializing value of donor concentration .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "Vr=5\n", + "print\"Vr = \",Vr,\" V\" # initializing value of reverse voltage .\n", + "A=1*10**-4\n", + "print\"A = \",A,\" cmˆ2\" # initializing valueof area of the gold silicon junction diode..\n", + "VB=(Ew-X)\n", + "print\" barrier height ,VB=(Ew−X) = \",VB,\" V\"# calculation .\n", + "Ec_Ef=(Vt*log(Nc/Nd))\n", + "print\"Ec Ef=(Vt∗log(Nc/Nd))=\",Ec_Ef,\" V\"#calculation\n", + "VBI=(VB-(Ec_Ef))\n", + "print\"VBI=(VB−(Ec  Ef ) )=\",VBI,\" V\"#calculation\n", + "C1=sqrt((e*Eo*Er*Nd)/(2*(VBI+Vr)))\n", + "print\"Capitance per unit area ,C1=sqrt (( e∗Eo∗Er∗Nd)/(2∗(VBI+Vr) ) )=\",C1,\" F/cmˆ2\"#calculation\n", + "C=C1*A\n", + "print\"total junction capatiance ,C=C1∗A=\",C,\"F\"# calculation" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Er = 13.1\n", + "Eo = 8.854e-14 F/cm\n", + "e = 1.6e-19 columns\n", + "Emax = 30000 V/cm\n", + " total permittivity ,E=Eo∗Er)= 1.159874e-12 F/cm\n", + "lowering of the barrier height ,V=sqrt(e∗Emax/(4∗pi∗E) )= 0.0181472273453 V\n", + " position of the maximum barrier height ,Xmax=sqrt(e/(16∗%pi∗E∗Emax))= 3.02453789089e-07 cm\n" + ] + } + ], + "source": [ + "#exa 6.17\n", + "from math import pi\n", + "from math import sqrt\n", + "Er =13.1\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "Emax =30*10**3\n", + "print\"Emax = \",Emax,\" V/cm\" # initializing value of maximum critical electric field ..\n", + "E=Eo*Er\n", + "print\" total permittivity ,E=Eo∗Er)=\",E,\" F/cm\"# calculation\n", + "V=sqrt(e*Emax/(4*pi*E))\n", + "print\"lowering of the barrier height ,V=sqrt(e∗Emax/(4∗pi∗E) )=\",V,\" V\"# calculation\n", + "Xmax=sqrt(e/(16*pi*E*Emax))\n", + "print\" position of the maximum barrier height ,Xmax=sqrt(e/(16∗%pi∗E∗Emax))=\",Xmax,\" cm\"# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_18 pgno: 192" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A = 0.0001 cmˆ−2\n", + "VBn = 0.55 V\n", + "T = 300 K\n", + "R = 110 A/(K−cmˆ2)\n", + "Vt = 0.0259 eV\n", + "V = 0.25 V\n", + "reverse saturation current , Io=A∗R∗Tˆ2∗exp(−VBn/Vt) = 5.93151320618e-07 A\n", + "diode current , I=Io(exp(V/Vt)−1)= 0.00922931077027 A\n" + ] + } + ], + "source": [ + "#exa 6.18\n", + "from math import exp\n", + "A=10**-4\n", + "print\"A = \",A,\" cmˆ−2\" # initializing value of cross sectional area .\n", + "VBn =0.55\n", + "print\"VBn = \",VBn,\"V\" # initializing value of barrier height .\n", + "T=300\n", + "print\"T = \",T,\"K\" # initializing value of absolute temperature .\n", + "R=110\n", + "print\"R = \",R,\" A/(K−cmˆ2)\" #initializing value of richardson ’ s constant .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "V=0.25\n", + "print\"V = \",V,\" V\" # initializing value of forward bias voltage .\n", + "Io=A*R*T**2*exp(-VBn/Vt)\n", + "print\"reverse saturation current , Io=A∗R∗Tˆ2∗exp(−VBn/Vt) = \",Io,\" A\" # calculation .\n", + "I=Io*((exp(V/Vt))-1)\n", + "print\"diode current , I=Io(exp(V/Vt)−1)=\",I,\"A\"# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_19 pgno:192" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Io1 = 1e-09 A\n", + "Io2 = 1e-14 A\n", + "Vt = 0.0259 eV\n", + "I = 0.0001 A\n", + "forward Voltage for silicon SBD,VfSBD=Vt∗(( log(I/Io1+1)))= 0.298185028541 V\n", + "forward Voltage for silicon SBD,VfPN=Vt∗((log(I/Io2+1)))= 0.596369539088 V\n" + ] + } + ], + "source": [ + "#exa 6.19\n", + "from math import log\n", + "Io1 =10**-9\n", + "print\"Io1 = \",Io1,\" A\" # initializing value of reverse saturation current of silicon SBD.\n", + "Io2 =10**-14\n", + "print\"Io2 = \",Io2,\"A\" # initializing value of reverse saturation current of a PN junction .\n", + "Vt =0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "I=100*10**-6\n", + "print\"I = \",I,\" A\" # initializing value of required current .\n", + "VfSBD=Vt*((log(I/Io1+1)))\n", + "print\"forward Voltage for silicon SBD,VfSBD=Vt∗(( log(I/Io1+1)))= \",VfSBD,\" V\" # calculation\n", + "VfPN=Vt*((log(I/Io2+1)))\n", + "print\"forward Voltage for silicon SBD,VfPN=Vt∗((log(I/Io2+1)))=\",VfPN,\" V\"#calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_20 pgno: 193" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Io1 = 1e-06 A\n", + "Io2 = 1e-06 A\n", + "Vt = 0.0259 eV\n", + "I = 0.001 A\n", + "V = 0.25 V\n", + "forward Voltage for silicon SBD,VfSBD=Vt∗(( log(I/Io1+1)))= 0.178936748784 V\n", + "forward volage applied across the PN Diode ,VfPN=(V+VfSBD)= 0.428936748784 V\n", + "reverse saturation current of the PN junction Diode,Io=(I/((exp(VfPN/Vt))−1))= 6.41998882039e-11 A\n" + ] + } + ], + "source": [ + "#exa 6.20\n", + "from math import log\n", + "Io1 =10*10**-7\n", + "print\"Io1 = \",Io1,\" A\" # initializing value of reverse saturation current of silicon SBD.\n", + "Io2 =10*10**-7\n", + "print\"Io2 = \",Io2,\"A\" # initializing value of reverse saturation current of a PN junction .\n", + "Vt =0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "I=1*10**-3\n", + "print\"I = \",I,\" A\" # initializing value of forward current .\n", + "V=0.25\n", + "print\"V = \",V,\" V\" # initializing value of difference in the forward voltage of the two diode .\n", + "VfSBD=Vt*((log(I/Io1+1)))\n", + "print\"forward Voltage for silicon SBD,VfSBD=Vt∗(( log(I/Io1+1)))= \",VfSBD,\" V\" # calculation 109\n", + "VfPN=(V+VfSBD)\n", + "print\"forward volage applied across the PN Diode ,VfPN=(V+VfSBD)=\",VfPN,\" V\"#calculation \n", + "Io=(I/((exp(VfPN/Vt))-1))\n", + "print\"reverse saturation current of the PN junction Diode,Io=(I/((exp(VfPN/Vt))−1))=\",Io,\" A\" # calculation" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_2_ENERGY_BAND_THEORY_OF_SOLIDS.ipynb b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_2_ENERGY_BAND_THEORY_OF_SOLIDS.ipynb new file mode 100755 index 00000000..7b0ddd98 --- /dev/null +++ b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_2_ENERGY_BAND_THEORY_OF_SOLIDS.ipynb @@ -0,0 +1,998 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 ENERGY BAND THEORY OF SOLIDS" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_1 pgno:49" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "no = 15000000000.0 /cmˆ3\n", + "n = 1000000000000000000 /cmˆ3\n", + "number of holes ,p=(noˆ2/n))= 225.0 /cmˆ3\n" + ] + } + ], + "source": [ + "#exa 2.1\n", + "no=1.5*10**10\n", + "print \"no = \",no,\"/cmˆ3\" # initializing value of electrons and hole per cmˆ3.\n", + "n=1*10**18\n", + "print \"n = \",n,\"/cmˆ3\" # initializing value of number of electrons per cmˆ3.\n", + "p=(no**2/n)\n", + "print \"number of holes ,p=(noˆ2/n))= \",p,\" /cmˆ3\" # calculation\n", + "#this is solved problem 2.1 of chapter 2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_2 pgno:49" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "n = 100000 /cmˆ3\n", + "p = 10000000000000000000 /cmˆ3\n", + "Value of intrinsic concentration ,no=sqrt(n∗p))= 1e+12 /cmˆ3\n" + ] + } + ], + "source": [ + "#exa 2.2\n", + "from math import sqrt\n", + "n=1*10**5\n", + "print\"n = \",n,\" /cmˆ3\" # initializing value of electrons and hole per cmˆ3.\n", + "p=1*10**19\n", + "print\"p = \",p,\" /cmˆ3\" # initializing value of number of hole per cmˆ3\n", + "no=sqrt(n*p)\n", + "print\"Value of intrinsic concentration ,no=sqrt(n∗p))= \",no,\" /cmˆ3\"# calculation\n", + "#this is solved problem 2.2 of chapter 2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_3 pgno:49" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "e = 1.6e-19 columb\n", + "Ef−Efi = 0.309 eV\n", + "no = 2.5e+13 /cmˆ3\n", + "T = 300 K\n", + "exp = 2.718\n", + "k = ”,k,” J/K\n", + "number of electrons per cmˆ3, n=no∗(exˆ((Ef−Efi)/kT)))= 3.83494867662e+18 /cmˆ3\n" + ] + } + ], + "source": [ + "#exa 2.3\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\"columb\" # initializing the value of electronic charge .\n", + "Ef_Efi =0.309\n", + "print\"Ef−Efi = \",Ef_Efi,\" eV\" # initializing the value of difference in the energy levels .\n", + "no=2.5*10**13\n", + "print\"no = \",no,\" /cmˆ3\" # initializing value of number of electrons per cmˆ3\n", + "T=300\n", + "print\"T = \",T,\" K\" # initializing value of temperature .\n", + "ex=2.718\n", + "print\"exp = \",ex # initializing the value of exponential .\n", + "k=1.38*10**-23\n", + "print\"k = ”,k,” J/K\" # initializing value of boltzmann constant .\n", + "n=no*(ex**((Ef_Efi*e)/(k*T)))\n", + "print\"number of electrons per cmˆ3, n=no∗(exˆ((Ef−Efi)/kT)))= \",n,\" /cmˆ3\" #calculation\n", + "#This is solved problem 2.3 of chapter 2.\n", + "#The value used for ”Ef−Efi” in the solution is different than provided in the question .\n", + "#I have used the value provided in the solution ( i .e Ef Efi =0.309)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_4 pgno:50" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "e = 1.6e-19 columb\n", + "Ef = 0.4065 eV\n", + "n = 100000000000000000 /cmˆ3\n", + "T = 300 K\n", + "exp = 2.718\n", + "k = 1.38e-23 J/K\n", + "Number of electrons per cmˆ3, no=n/(exˆ((Ef)/kT) ) )= 15061844796.9 electrons /cmˆ3\n" + ] + } + ], + "source": [ + "#exa 2.4\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columb\" # initializing the value of electronic charge .\n", + "Ef =0.4065\n", + "print \"Ef = \",Ef,\" eV\" # initializing the value of fermi level .\n", + "n=10**17\n", + "print\"n = \",n,\" /cmˆ3\" # initializing value of number of electrons per cmˆ3.\n", + "T=300\n", + "print\"T = \",T,\" K\" # initializing value of temperature .\n", + "ex=2.718\n", + "print\"exp = \",ex # initializing the value of exponential .\n", + "k=1.38*10**-23\n", + "print\"k = \",k,\" J/K\" # initializing value of boltzmann constant .\n", + "no=n/(ex**((Ef*e)/(k*T)))\n", + "print\"Number of electrons per cmˆ3, no=n/(exˆ((Ef)/kT) ) )= \",no,\" electrons /cmˆ3\" # calculation\n", + "#this is solved problem 2.4 of chapter 2.\n", + "#the value used for \"n\" in the solution is different than provided in the question .\n", + "#I have used the value provided in the solution ( i .e n=10ˆ17)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_5 pgno:50" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "e = 1.6e-19 columb\n", + "n = 10000000000000000000000 /mˆ3\n", + "u = 0.12 mˆ2/Vs\n", + "L = 0.001 m\n", + "A = 1e-10 mˆ2\n", + " conductivity , sigma=n∗e∗u)= 192.0 siemen/m\n", + "Resistivity ,p=(1/sigma))= 0.00520833333333 ohm metre\n", + " resistance ,R=(p∗L/A) )= 52083.3333333 ohm\n" + ] + } + ], + "source": [ + "#exa 2.5\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\"columb\" # initializing the value of electronic charge .\n", + "n=1*10**22\n", + "print\"n = \",n,\" /mˆ3\" # initializing value of number of electrons per cmˆ3\n", + "u=1200*10**-4\n", + "print\"u = \",u,\" mˆ2/Vs\" # initializing the value of mobility .\n", + "L=0.1*10**-2\n", + "print\"L = \",L,\" m\" # initializing the value of length .\n", + "A=100*10**-12\n", + "print\"A = \",A,\" mˆ2\" # initializing the value of area of cross section .\n", + "sigma=n*e*u\n", + "print\" conductivity , sigma=n∗e∗u)= \",sigma,\"siemen/m\" # calculation .\n", + "p=(1/sigma)\n", + "print\"Resistivity ,p=(1/sigma))= \",p,\" ohm metre\"#calculation .\n", + "R=(p*L/A)\n", + "print\" resistance ,R=(p∗L/A) )= \",R,\" ohm\" #calculation .\n", + "#this is solved problem 2.5 of chapter 2.\n", + "#the value used for \"A\" in the solution is different than provided in the question .\n", + "#I have used the value provided in the solution ( i .e A=100∗10ˆ−12)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_6 pgno:50" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "R = 52080.0 ohm\n", + "V = 5 volt\n", + " Drift current , I=(V/R) )= 9.60061443932e-05 amphere\n" + ] + } + ], + "source": [ + "#exa 2.6\n", + "R=52.08*10**3\n", + "print\"R = \",R,\"ohm\" # initializing value of Resistance .\n", + "V=5\n", + "print\"V = \",V,\"volt\" # initializing value of voltage .\n", + "I=(V/R)\n", + "print\" Drift current , I=(V/R) )= \",I,\" amphere\" # calculation\n", + "#this is solved problem 2.6 of chapter 2." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_7 pgno:50" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Energy gap of GaAs = 1.43 eV\n", + " Energy gap of GaP = 2.43 eV\n", + " Plank constant = 6.624e-34 joule \n", + " Light speed = 300000000 m/s\n", + "Difference between the energy gap of GaAs and GaP ,x=(Eg2−Eg1) )= 1.0 eV\n", + "Excess energy gap added to GaAs to form GaAsP,(0.4∗x))= 0.4 eV \n", + "Band gap energy GaAsP,Eg=(Eg1+g))= 1.83 eV \n", + "wavelength of radiation emitted , lamda=(c∗h/Eg))= 6.7868852459e-07 metre \n" + ] + } + ], + "source": [ + "#exa 2.7\n", + "Eg1 =1.43\n", + "print\" Energy gap of GaAs = \",Eg1,\"eV\" # initializing the value of energy gap of GaAs.\n", + "Eg2 =2.43\n", + "print\" Energy gap of GaP = \",Eg2,\"eV\"# initializing the value of energy gap of Gap.\n", + "h=6.624*10**-34\n", + "print\" Plank constant = \",h,\" joule \"# initializing the value of plank constant .\n", + "c=3*10**8\n", + "print\" Light speed = \",c,\"m/s\" # initializing the value of speed of light.\n", + "x=(Eg2-Eg1)\n", + "print\"Difference between the energy gap of GaAs and GaP ,x=(Eg2−Eg1) )= \",x,\" eV\"# calculation\n", + "g=(0.4*x)\n", + "print\"Excess energy gap added to GaAs to form GaAsP,(0.4∗x))= \",g,\" eV \"#calculation\n", + "Eg=(Eg1+g)\n", + "print\"Band gap energy GaAsP,Eg=(Eg1+g))= \",Eg ,\" eV \"#calculation\n", + "lamda=(c*h/(Eg*1.6*10**-19))\n", + "print\"wavelength of radiation emitted , lamda=(c∗h/Eg))= \",lamda,\" metre \"\n", + "# calculation 19 #this is solved problem 2.7 of chapter 2." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_8 pgno:51" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Energy gap of GaAs = 1.43 eV\n", + " Energy gap of GaP = 2.43 eV\n", + " Plank constant = 6.624e-34 joule\n", + " Light speed = 300000000 m/s\n", + " lamda = 540000000 m\n", + "Difference between the energy gap of GaAs and GaP ,x=(Eg2−Eg1) )= 1.0 eV\n", + "Band gap energy ,Eg=(c∗h/lamda∗(1.6∗10ˆ−19)))= 2.3e-15 eV\n", + "X=Eg−(Eg1)= -1.43\n" + ] + } + ], + "source": [ + "#exa 2.8\n", + "Eg1 =1.43\n", + "print\" Energy gap of GaAs = \",Eg1,\" eV\" # initializing the value of energy gap of GaAs.\n", + "Eg2 =2.43\n", + "print\" Energy gap of GaP = \",Eg2,\" eV\"# initializing the value of energy gap of Gap.\n", + "h=6.624*10**-34\n", + "print\" Plank constant = \",h,\" joule\"# initializing the value of plank constant .\n", + "c=3*10**8\n", + "print\" Light speed = \",c,\" m/s\" # initializing the value of speed of light.\n", + "lamda =540*10**6\n", + "print\" lamda = \",lamda,\" m\" # initializing the value of wavelength .\n", + "x=(Eg2-Eg1)\n", + "print\"Difference between the energy gap of GaAs and GaP ,x=(Eg2−Eg1) )= \",x,\" eV\"# calculation\n", + "Eg=((c*h/(lamda*(1.6*10**-19))))\n", + "print\"Band gap energy ,Eg=(c∗h/lamda∗(1.6∗10ˆ−19)))=\",Eg,\" eV\"# calculation\n", + "X=Eg-(Eg1)\n", + "print\"X=Eg−(Eg1)= \",X # calculation \n", + "#this is solved problem 2.8 of chapter 2.\n", + "#the value of Eg(band gap energy )is provided wrong in the book after calculation.Due to this value ofX,alsodiffer." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_9 pgno:51" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Temperature 1 = 500 K\n", + " Nv = 2e+19 cmˆ−3\n", + " Temperature 2 = 300 K\n", + "NV at 500K=(Nv((500/300) ˆ(3/2) ) ) )= 2e+19 cmˆ−3 \n" + ] + } + ], + "source": [ + "#exa 2.9\n", + "T1 =500\n", + "print\" Temperature 1 = \",T1,\"K\" # initializing the value of temperature 1.\n", + "Nv =2*10**19\n", + "print\" Nv = \",round(Nv,3),\"cmˆ−3\"# initializing the value of effective density of state for valence band .\n", + "T2 =300\n", + "print\" Temperature 2 = \",T2,\"K\"# initializing the value of temperature 2.\n", + "NV=(Nv*((500/300)**(3/2)))\n", + "print\"NV at 500K=(Nv((500/300) ˆ(3/2) ) ) )= \",round(NV,3),\" cmˆ−3 \"#calculation\n", + "#this is solved problem 2.9 of chapter 2." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_10 pgno:52" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 100000000000000000 cmˆ−3\n", + " Ec Ed = 0.045\n", + "Vt = 0.0259 eV \n", + " Nc = 2.8e+19 cmˆ−3\n", + "exp = 2.718\n", + "Fraction of electron still in the donor state,(nd/(nd+n)=(((Nc/Nd)∗eˆ((−Ec Ed)/Vt),1)ˆ−1)= 0.0198886296934\n" + ] + } + ], + "source": [ + "#exa 2.10\n", + "Nd =1*10**17\n", + "print\"Nd = \",Nd,\"cmˆ−3\" # initializing the value of effective energy density of state.\n", + "Ec_Ed =0.045\n", + "print\" Ec Ed = \",Ec_Ed # initializing the value of donor ionisation level .\n", + "Vt =0.0259\n", + "print\"Vt = \",Vt,\" eV \"# initializing the value of thermal voltage .\n", + "Nc=2.8*10**19\n", + "print\" Nc = \",Nc,\"cmˆ−3\"# initializing the value of effective density of state of conduction band .\n", + "e=2.718\n", + "print\"exp = \",e # initializing the value of exponential .\n", + "N=(((Nc/Nd)*e**((-(Ec_Ed))/Vt))+1)**-1\n", + "print \"Fraction of electron still in the donor state,(nd/(nd+n)=(((Nc/Nd)∗eˆ((−Ec Ed)/Vt),1)ˆ−1)= \",N # calculation\n", + "#this is solved problem 2.10 of chapter 2." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_11 pgno:52" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 10000000000000000 cmˆ−3\n", + "Ea Ev = 0.045\n", + "Nv = 1.04e+19 cmˆ−3\n", + "Vt = 0.0259 eV\n", + "Fraction of holes that are still in the acceptor state ,(pa/(pa+p))=(1+((Nv/4∗Na)∗exp(−(Ea −Ev)/Vt)))ˆ(−1)= 0.0213895767669\n" + ] + } + ], + "source": [ + "#exa 2.11\n", + "from math import exp\n", + "Na =1*10**16\n", + "print\"Na = \",Na,\" cmˆ−3\"# initializing the value of acceptor concentration \n", + "Ea_Ev =0.045\n", + "print\"Ea Ev = \",Ea_Ev # initializing the boron acceptor ionization energy .\n", + "Nv=(1.04*10**19)\n", + "print\"Nv = \",Nv,\" cmˆ−3\"# initializing the value of effective density of state for valence band .\n", + "Vt=(0.0259)\n", + "print\"Vt = \",Vt,\" eV\"# initializing the value of thermal voltage .\n", + "p=(1+((Nv/(4*Na))*exp(-(Ea_Ev)/Vt)))**(-1)\n", + "print\"Fraction of holes that are still in the acceptor state ,(pa/(pa+p))=(1+((Nv/4∗Na)∗exp(−(Ea −Ev)/Vt)))ˆ(−1)= \",p #calculation\n", + "#this is solved problem 2.11 of chapter 2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_12 pgno:52" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 100000000000000000 cmˆ−3\n", + "Na = 0 cmˆ−3\n", + "ni = 15000000000.0 cmˆ−3\n", + "Electron concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= 1e+17 cmˆ−3\n", + "Hole concentration ,p)= 2250.0 cmˆ−3\n" + ] + } + ], + "source": [ + "#exa 2.12\n", + "Nd =1*10**17\n", + "print\"Nd = \",Nd,\" cmˆ−3\" # initializing the value of donor concentration .\n", + "Na=0\n", + "print\"Na = \",Na,\" cmˆ−3\"# initializing the value of acceptor concentration .\n", + "no=1.5*10**10\n", + "print\"ni = \",no,\" cmˆ−3\"# initializing the value of electron hole per cmˆ3.\n", + "n=(-(Na-Nd)+sqrt((Na-Nd)**2+4*no))/2\n", + "print\"Electron concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= \",n,\" cmˆ−3\"#calculation\n", + "p=(no**2/n)\n", + "print\"Hole concentration ,p)= \",p,\" cmˆ−3\" # calculation\n", + "#this is solved problem 2.13 of chapter 2." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_14 pgno:53" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 60000000000000000 cmˆ−3\n", + "Na = 100000000000000000 cmˆ−3\n", + "no = 15000000000.0 cmˆ−3\n", + "Hole concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= 4e+16 cmˆ−3\n", + "Electron concentration ,n=(noˆ2/p))= 5625.0\n" + ] + } + ], + "source": [ + "#exa 2.14\n", + "Nd =6*10**16\n", + "print\"Nd = \",Nd,\" cmˆ−3\" # initializing the value of donor concentration .\n", + "Na =10**17\n", + "print\"Na = \",Na,\" cmˆ−3\"# initializing the value of acceptor concentration .\n", + "no=1.5*10**10\n", + "print\"no = \",no,\" cmˆ−3\"# initializing the value of electron and hole per cmˆ3.\n", + "p=((Na-Nd)+sqrt((Na-Nd)**2+4*no))/2\n", + "print\"Hole concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= \",p,\" cmˆ−3\"#calculation\n", + "n=(no**2/p)\n", + "print \"Electron concentration ,n=(noˆ2/p))= \",n # calculation\n", + "#this is solved problem 2.14 of chapter 2.\n", + "#the value of Na,Nd in the solution is different than provided in the question\n", + "#I have used the value used in the solution(i.e Na=10ˆ17 ,Nd=6∗10ˆ16)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_15 pgno:53" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 60000000000000000 cmˆ−3\n", + "Na = 100000000000000000 cmˆ−3\n", + "no = 15000000000.0 cmˆ−3\n", + "Hole concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= 4e+16 cmˆ−3\n", + "Electron concentration ,n=(noˆ2/p))= 5625.0\n" + ] + } + ], + "source": [ + "#exa 2.15\n", + "Nd =6*10**16\n", + "print\"Nd = \",Nd,\" cmˆ−3\" # initializing the value of donor concentration .\n", + "Na =10**17\n", + "print\"Na = \",Na,\" cmˆ−3\"# initializing the value of acceptor concentration .\n", + "no=1.5*10**10\n", + "print\"no = \",no,\" cmˆ−3\"# initializing the value of electron and hole per cmˆ3.\n", + "p=((Na-Nd)+sqrt((Na-Nd)**2+4*no))/2\n", + "print\"Hole concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= \",p,\"cmˆ−3\"#calculation\n", + "n=(no**2/p)\n", + "print\"Electron concentration ,n=(noˆ2/p))= \",n # calculation\n", + "#this is solved problem 2.15 of chapter 2.\n", + "#the value of Na,Nd in the solution is different than provided in the question\n", + "#I have used the value used in the solution(i.e Na=10ˆ17 ,Nd=6∗10ˆ16)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_16 pgno:53" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nv = 1.04e+19 cmˆ−3\n", + "Ef Ev = 0.3 eV\n", + "T = 300 K\n", + "T = 500 K\n", + "Vt1 = 0.0259 eV\n", + "k = 1.38e-23 J/K\n", + "e = 1.6e-19 columb\n", + "Value of constant ,K1=(Nv/((T) ˆ(3/2) ) )= 3.46666666667e+16 cmˆ−3 K(−2/3)\n", + "Value of valence band concentration at 500K,Nv =K1∗T(3/2)= 1.73333333333e+19 cmˆ−3\n", + "Value of parameter VT at 500K,VT=(K∗T/e)= 0.043125 cmˆ−3\n", + "Hole concentration ,p=(Nv∗(exp(Ef Ev)/(VT)))= 1.65083278171e+16 cmˆ−3\n" + ] + } + ], + "source": [ + "#exa 2.16\n", + "from math import exp\n", + "Nv1 =1.04*10**19\n", + "print\"Nv = \",Nv1,\" cmˆ−3\"# initializing the value of valence band concentration at 300K.\n", + "Ef_Ev =0.3\n", + "print\"Ef Ev = \",Ef_Ev,\" eV\"# initializing the value of boron acceptor ionization energy.\n", + "T1 =300\n", + "print\"T = \",T1,\"K\"# initializing the value of temperature 1.\n", + "T2 =500\n", + "print\"T = \",T2,\"K\"# initializing the value of temperature 2.\n", + "Vt1 =0.0259\n", + "print\"Vt1 = \",Vt1,\"eV\"# initializing the value of thermal voltage at 300K.\n", + "k=1.38*10**-23\n", + "print\"k = \",k,\"J/K\" # initializing value of boltzmann constant .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\"columb\" # initializing the value of electronic charge .\n", + "K1=(Nv1/((T1)**(3/2)))\n", + "print\"Value of constant ,K1=(Nv/((T) ˆ(3/2) ) )= \",K1,\" cmˆ−3 K(−2/3)\"# calculation\n", + "Nv2=K1*T2**(3/2)\n", + "print\"Value of valence band concentration at 500K,Nv =K1∗T(3/2)= \",Nv2,\" cmˆ−3\"# calculation\n", + "VT=(k*T2/e)\n", + "print\"Value of parameter VT at 500K,VT=(K∗T/e)= \",VT,\" cmˆ−3\"# calculation\n", + "p=(Nv2*(exp(-(Ef_Ev)/(VT))))\n", + "print\"Hole concentration ,p=(Nv∗(exp(Ef Ev)/(VT)))= \",p,\" cmˆ−3\"# calculation\n", + "#this is solved problem 2.16 of chapter 2.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_17 pgno:54" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nv = 7000000000000000000 cmˆ−3\n", + "Nc = 4.7e+17 cmˆ−3\n", + "T = 300 K\n", + "T = 450 K\n", + "Vt1 = 0.0259 eV\n", + "Vt2 = 0.03881 eV\n", + "Eg = 1.42 eV\n", + "intrinsic concentration at 300K,no=(sqrt(Nc∗Nv∗(exp(−Eg/Vt1))))= 2255422.87974\n", + "Value of constant ,K1=(Nc/((T) ˆ(3/2) ) )= 1.56666666667e+15\n", + "Value of constant k1 at 450K ,k1=(K1∗T2ˆ(3/2))= 7.05e+17\n", + "Value of constant ,K2=(Nv/((T1) ˆ(3/2) ) )= 23333333333333333\n", + "Value of constant k2 at 450K ,k2=(K2∗T2ˆ(3/2))= 10499999999999999850\n", + "Value of constant K,= 7.4025e+36\n", + "intrinsic concentration at 450K,no=(sqrt(K∗(exp(−Eg/Vt2) ) ) )= 30874193378.4 cmˆ3\n" + ] + } + ], + "source": [ + "#exa 2.17\n", + "from math import sqrt\n", + "Nv =7*10**18\n", + "print\"Nv = \",Nv,\"cmˆ−3\"# initializing the value of valence band concentration at 300K.\n", + "Nc=4.7*10**17\n", + "print\"Nc = \",Nc,\"cmˆ−3\"# initializing the value of conduction band concentration at 300K.\n", + "T1 =300\n", + "print\"T = \",T1,\"K\"# initializing the value of temperature 1.\n", + "T2 =450\n", + "print\"T = \",T2,\"K\"# initializing the value of temperature 2.\n", + "Vt1 =0.0259\n", + "print\"Vt1 = \",Vt1,\"eV\"# initializing the value of thermal voltage at 300K.\n", + "Vt2 =0.03881\n", + "print\"Vt2 = \",Vt2,\"eV\"# initializing the value of thermal voltage at 450K.\n", + "Eg=1.42\n", + "print\"Eg = \",Eg,\"eV\"# initializing the value of thermal voltage .\n", + "no=(sqrt(Nc*Nv*(exp(-Eg/Vt1))))\n", + "print\"intrinsic concentration at 300K,no=(sqrt(Nc∗Nv∗(exp(−Eg/Vt1))))= \",no #calculation\n", + "K1=(Nc/((T1)**(3/2)))\n", + "print\"Value of constant ,K1=(Nc/((T) ˆ(3/2) ) )= \",K1 # calculation\n", + "k1=(K1*T2**(3/2))\n", + "print\"Value of constant k1 at 450K ,k1=(K1∗T2ˆ(3/2))= \",k1# calculation\n", + "K2=(Nv/((T1)**(3/2)))\n", + "print\"Value of constant ,K2=(Nv/((T1) ˆ(3/2) ) )= \",K2# calculation\n", + "k2=(K2*T2**(3/2))\n", + "print\"Value of constant k2 at 450K ,k2=(K2∗T2ˆ(3/2))= \",k2 # calculation\n", + "K=k1*k2\n", + "print\"Value of constant K,= \",K # calculation\n", + "no1=(sqrt(K*(exp(-Eg/Vt2))))\n", + "print\"intrinsic concentration at 450K,no=(sqrt(K∗(exp(−Eg/Vt2) ) ) )= \",no1,\" cmˆ3\"# calculation\n", + "#this is solved problem 2.17 of chapter 2." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_18 pgno:55" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nv = 1.04e+19 cmˆ−3\n", + "Nc = 2.8e+19 cmˆ−3\n", + "T = 300 K\n", + "T = 550 K\n", + "Vt1 = 0.0259 eV\n", + "Vt2 = 0.0474 eV\n", + "Eg1 = 1.12 eV\n", + "intrinsic concentration at 300K,no=(sqrt(Nc∗Nv∗(exp(−Eg1/Vt1))))= 6949358641.26\n", + "Value of constant ,K1=(Nc/((T) ˆ(3/2) ) )= 9.3023255814e+16\n", + "Value of constant k1 at 550K ,k1=(K1∗T2ˆ(3/2))= 5.11627906977e+19\n", + "Value of constant ,K2=(Nv/((T1) ˆ(3/2) ) )= 3.46666666667e+16\n", + "Value of constant k2 at 550K ,k2=(K2∗T2ˆ(3/2))= 1.90666666667e+19\n", + "Value of constant K,= 9.75503875969e+38\n", + "Intrinsic concentration at 550K,no=(sqrt(K∗(exp(−Eg1/Vt2))))= 2.31051731905e+14 cmˆ3\n", + "Donor concentration at which intrinsic concentration is 10% of the total electron concentration ,Nd=(4∗(no1ˆ2) /(1.2) )= 1.77949676054e+29 cmˆ3\n" + ] + } + ], + "source": [ + "#exa 2.18\n", + "from math import sqrt\n", + "from math import exp\n", + "Nv=1.04*10**19\n", + "print\"Nv = \",Nv,\"cmˆ−3\"# initializing the value of valence band concentration at 300K.\n", + "Nc=2.8*10**19\n", + "print\"Nc = \",Nc,\"cmˆ−3\"# initializing the value of conduction band concentration at 300K.\n", + "T1 =300\n", + "print\"T = \",T1,\"K\"# initializing the value of temperature 1.\n", + "T2 =550\n", + "print\"T = \",T2,\"K\"# initializing the value of temperature 2.\n", + "Vt1 =0.0259\n", + "print\"Vt1 = \",Vt1,\"eV\"# initializing the value of thermal voltage at 300K.\n", + "Vt2 =0.0474\n", + "print\"Vt2 = \",Vt2,\"eV\"# initializing the value of thermal voltage at 550K.\n", + "Eg1=1.12\n", + "print\"Eg1 = \",Eg1,\"eV\"# initializing the value of thermal voltage .\n", + "no=(sqrt(Nc*Nv*(exp(-Eg1/Vt1))))\n", + "print\"intrinsic concentration at 300K,no=(sqrt(Nc∗Nv∗(exp(−Eg1/Vt1))))= \",no #calculation\n", + "K1=(Nc/((T1)^(3/2)))\n", + "print\"Value of constant ,K1=(Nc/((T) ˆ(3/2) ) )= \",K1 # calculation\n", + "k1=(K1*T2**(3/2))\n", + "print\"Value of constant k1 at 550K ,k1=(K1∗T2ˆ(3/2))= \",k1 # calculation \n", + "K2=(Nv/((T1)**(3/2)))\n", + "print\"Value of constant ,K2=(Nv/((T1) ˆ(3/2) ) )= \",K2 # calculation\n", + "k2=(K2*T2**(3/2))\n", + "print\"Value of constant k2 at 550K ,k2=(K2∗T2ˆ(3/2))= \",k2 # calculation\n", + "K=k1*k2\n", + "print\"Value of constant K,= \",K # calculation\n", + "no1=(sqrt(K*(exp(-Eg1/Vt2))))\n", + "print\"Intrinsic concentration at 550K,no=(sqrt(K∗(exp(−Eg1/Vt2))))= \",no1,\" cmˆ3\"# calculation\n", + "Nd=(4*(no1**2)/(1.2))\n", + "print\"Donor concentration at which intrinsic concentration is 10% of the total electron concentration ,Nd=(4∗(no1ˆ2) /(1.2) )= \",Nd,\" cmˆ3\"# calculation\n", + "#this is solved problem 2.18 of chapter 2.\n", + "#the value of temperature and % of the intrinsic carrier concentration given in the question is different than used in the solution .\n", + "#I have used the value provided in the solution (i.e T2=550 and % of the intrinsic carrier concentration =10%)\n", + "#the value of Donor concentration at which intrinsic concentration is 10% of the total electron concentration (Nd) , is provided wrong in the book after calculation .\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_19 pgno:55" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ec Ef = 0.2 eV\n", + "Nc = 2.8e+19 cmˆ−3\n", + "Na = 30000000000000000 cmˆ−3\n", + "Vt = 0.0259 eV\n", + "Donor concentration ,Nd=(Nc∗(exp(−(Ec Ef)/(Vt))) )+(Na)= 4.24031697774e+16 cmˆ−3\n" + ] + } + ], + "source": [ + "#exa 2.19\n", + "Ec_Ef =0.2\n", + "print\"Ec Ef = \",Ec_Ef,\" eV\" # initializing the value of difference in the energy levels.\n", + "Nc=2.8*10**19\n", + "print\"Nc =\",Nc,\" cmˆ−3\"# initializing the conduction band concentration .\n", + "Na =3*10**16\n", + "print\"Na =\",Na,\" cmˆ−3\"# initializing the acceptor concentration .\n", + "Vt =0.0259\n", + "print\"Vt =\",Vt,\" eV\"# initializing the thermal voltage at 300K.\n", + "Nd=(Nc*(exp(-(Ec_Ef)/(Vt))))+(Na)\n", + "print\"Donor concentration ,Nd=(Nc∗(exp(−(Ec Ef)/(Vt))) )+(Na)= \",Nd,\" cmˆ−3\"# calculation\n", + "#this is solved problem 2.19 of chapter 2." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_20 pgno:56" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nv = 6000000000000000000 cmˆ−3\n", + "Nc = 1.04e+19 cmˆ−3\n", + "T1 = 300 K\n", + "T2 = 200 K\n", + "Vt1 = 0.0259 eV\n", + "Vt2 = 0.0173 eV\n", + "Eg1 = 0.6 eV\n", + "intrinsic concentration at 300K,no=(sqrt(Nc∗Nv∗(exp(−Eg1/Vt1))))= 7.36468677124e+13\n", + "Eg2 = 0.66 eV\n", + "Value of constant ,K1=(Nc/((T) ˆ(3/2) ) )= 3.46666666667e+16\n", + "Value of constant k1 at 200K ,k1=(K1∗T2ˆ(3/2))= 6.93333333333e+18\n", + "Value of constant ,K2=(Nv/((T1) ˆ(3/2) ) )= 20000000000000000\n", + "Value of constant k2 at 200K ,k2=(K2∗T2ˆ(3/2))= 4000000000000000000\n", + "Value of constant K,= 2.77333333333e+37\n", + "intrinsic concentration at 200K,no=(sqrt(K∗(exp(−Eg2/Vt2))))= 27369762834.6 cmˆ3\n" + ] + } + ], + "source": [ + "#exa 2.20\n", + "from math import sqrt\n", + "from math import exp\n", + "Nv =6*10**18\n", + "print\"Nv = \",Nv,\"cmˆ−3\"# initializing the value of valence band concentration at 300K.\n", + "Nc=1.04*10**19\n", + "print\"Nc = \",Nc,\"cmˆ−3\"# initializing the value of conduction band concentration at 300K.\n", + "T1 =300\n", + "print\"T1 = \",T1,\"K\"# initializing the value of temperature 1.\n", + "T2 =200\n", + "print\"T2 = \",T2,\"K\"# initializing the value of temperature 2.\n", + "Vt1 =0.0259\n", + "print\"Vt1 = \",Vt1,\"eV\"# initializing the value of thermal voltage at 300K.\n", + "Vt2 =0.0173\n", + "print\"Vt2 = \",Vt2,\"eV\"# initializing the value of thermal voltage at 200K.\n", + "Eg1=0.60\n", + "print\"Eg1 = \",Eg1,\"eV\"# initializing the value of thermal voltage used for 300K .\n", + "no=(sqrt(Nc*Nv*(exp(-Eg1/Vt1))))\n", + "print\"intrinsic concentration at 300K,no=(sqrt(Nc∗Nv∗(exp(−Eg1/Vt1))))= \",no #calculation\n", + "Eg2=0.66\n", + "print\"Eg2 = \",Eg2,\"eV\"# initializing the value of thermal voltage used for 200K.\n", + "K1=(Nc/((T1)**(3/2)))\n", + "print\"Value of constant ,K1=(Nc/((T) ˆ(3/2) ) )= \",K1 # calculation\n", + "k1=(K1*T2**(3/2))\n", + "print\"Value of constant k1 at 200K ,k1=(K1∗T2ˆ(3/2))= \",k1 # calculation\n", + "K2=(Nv/((T1)**(3/2)))\n", + "print\"Value of constant ,K2=(Nv/((T1) ˆ(3/2) ) )= \",K2 # calculation\n", + "k2=(K2*T2**(3/2))\n", + "print\"Value of constant k2 at 200K ,k2=(K2∗T2ˆ(3/2))= \",k2 # calculation\n", + "K=k1*k2\n", + "print\"Value of constant K,= \",K # calculation\n", + "no1=(sqrt(K*(exp(-Eg2/Vt2))))\n", + "print\"intrinsic concentration at 200K,no=(sqrt(K∗(exp(−Eg2/Vt2))))= \",round(no1,2),\" cmˆ3\"# calculation\n", + "#this is solved problem 2.20 of chapter 2.\n", + "#The answer of intrinsic concentration at 300K,(no) is provided wrong in the book." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_21 pgno:56" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Eg1 = 2 eV\n", + "Eg2 = 2.2 eV\n", + "Vt = 0.0259 eV\n", + "Ratio of their intrinsic concentration at 300K,(no1/no2)=sqrt(exp((−Eg1/Vt)−(−Eg2/Vt)))= 47.5130239084\n" + ] + } + ], + "source": [ + "#exa 2.21\n", + "Eg1=2\n", + "print\"Eg1 = \",Eg1,\" eV\" # initializing the value of band energy gap for semiconductor1.\n", + "Eg2 =2.2\n", + "print\"Eg2 = \",Eg2,\" eV\"# initializing the value of band energy gap for semiconductor2.\n", + "Vt =0.0259\n", + "print\"Vt = \",Vt,\" eV\"# initializing the value of thermal voltage at 300K.\n", + "No=sqrt(exp((-Eg1/Vt)-(-Eg2/Vt)))\n", + "print\"Ratio of their intrinsic concentration at 300K,(no1/no2)=sqrt(exp((−Eg1/Vt)−(−Eg2/Vt)))= \",No # calculation" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_3_CARRIER_TRANSPORT_IN_SEMICONDUCTOR.ipynb b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_3_CARRIER_TRANSPORT_IN_SEMICONDUCTOR.ipynb new file mode 100755 index 00000000..2cc9b53b --- /dev/null +++ b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_3_CARRIER_TRANSPORT_IN_SEMICONDUCTOR.ipynb @@ -0,0 +1,700 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3 CARRIER TRANSPORT IN SEMICONDUCTOR" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_1 pgno: 71" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I = 0.005 amphere\n", + "B= 1e-06 Tesla\n", + "w = 0.0001 m\n", + "l = 0.001 m\n", + "t = 1e-05 m\n", + "p = 100000000000000000 atoms/mˆ3\n", + "e = 1.6e-19 columb\n", + "Hall electric field ,EH=(I∗B)/(w∗t∗p∗e)= 312.5 V/m\n", + "Hall electric field in centimeter ,EH=(I∗B)/(w∗ t∗p∗e)= 3.125 V/cm\n" + ] + } + ], + "source": [ + "#exa 3.1\n", + "I=5*10**-3\n", + "print \"I = \",I,\" amphere\" # initializing value of current flowing through the sample.\n", + "B=1*10**-6\n", + "print \"B= \",B,\" Tesla\" # initializing value of magnetic field .\n", + "w=0.01*10**-2\n", + "print \"w = \",w,\" m\" # initializing value of width of germanium sample .\n", + "l=0.1*10**-2\n", + "print \"l = \",l,\" m\" # initializing value of length of germanium sample .\n", + "t=0.001*10**-2\n", + "print \"t = \",t,\" m\" # initializing value of thickness of germanium sample .\n", + "p=10**17\n", + "print \"p = \",p,\" atoms/mˆ3\" # initializing value of doped acceptor atoms .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", + "EH=(I*B)/(w*t*p*e)\n", + "print \"Hall electric field ,EH=(I∗B)/(w∗t∗p∗e)= \",EH,\" V/m\" # calculation 18 \n", + "E=EH*10**-2\n", + "print \"Hall electric field in centimeter ,EH=(I∗B)/(w∗ t∗p∗e)= \",E,\" V/cm\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_2 pgno: 72" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I = 0.005 amphere\n", + "B= 1e-06 Tesla\n", + "w = 0.0001 m\n", + "l = 0.001 m\n", + "t = 1e-05 m\n", + "p = 100000000000000000 atoms/cmˆ3\n", + "e = 1.6e-19 columb\n", + "hall cofficient ,Rh=(1/(p∗e))= 62.5 cmˆ3/C\n" + ] + } + ], + "source": [ + "#exa 3.2\n", + "I=5*10**-3\n", + "print \"I = \",I,\" amphere\" # initializing value of current flowing through the sample.\n", + "B=1*10**-6\n", + "print \"B= \",B,\" Tesla\" # initializing value of magnetic field .\n", + "w=0.01*10**-2\n", + "print \"w = \",w,\" m\" # initializing value of width of germanium sample .\n", + "l=0.1*10**-2\n", + "print \"l = \",l,\" m\" # initializing value of length of germanium sample .\n", + "t=0.001*10**-2\n", + "print \"t = \",t,\" m\" # initializing value of thickness of germanium sample .\n", + "p=10**17\n", + "print \"p = \",p,\" atoms/cmˆ3\" # initializing value of doped acceptor atoms .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", + "Rh=(1/(p*e))\n", + "print \"hall cofficient ,Rh=(1/(p∗e))= \",Rh,\" cmˆ3/C\"# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_3 pgno: 72" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I = 0.01 amphere\n", + "B= 1e-05 Tesla\n", + "w = 0.0001 m\n", + "l = 0.001 m\n", + "t = 1e-05 m\n", + "n = 10000000000000000 atoms/cmˆ3\n", + "e = 1.6e-19 columb\n", + "Hall voltage ,Vh=((I∗B)/(n∗e∗t)))= 6.25 V\n" + ] + } + ], + "source": [ + "#exa 3.3\n", + "I=10*10**-3\n", + "print \"I = \",I,\" amphere\" # initializing value of current flowing through the sample.\n", + "B=10*10**-6\n", + "print \"B= \",B,\" Tesla\" # initializing value of magnetic field .\n", + "w=0.01*10**-2\n", + "print \"w = \",w,\" m\" # initializing value ofwidth of germanium sample .\n", + "l=0.1*10**-2\n", + "print \"l = \",l,\" m\" # initializing value of length of germanium sample .\n", + "t=0.001*10**-2\n", + "print \"t = \",t,\" m\" # initializing value of thickness of germanium sample .\n", + "n=10**16\n", + "print \"n = \",n,\" atoms/cmˆ3\" # initializing value of doped donor atoms .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", + "Vh=((I*B)/(n*e*t))\n", + "print \"Hall voltage ,Vh=((I∗B)/(n∗e∗t)))= \",Vh,\" V\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_4 pgno: 72" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I = 0.01 amphere\n", + "B= 1e-05 Tesla\n", + "w = 0.0001 m\n", + "l = 0.001 m\n", + "t = 1e-05 m\n", + "p = 1000000000000000000 atoms/cmˆ3\n", + "e = 1.6e-19 columb\n", + "Hall voltage ,Yh=((B)/(p∗e∗t)))= 6.25 ohm\n" + ] + } + ], + "source": [ + "#exa 3.4\n", + "I=10*10**-3\n", + "print \"I = \",I,\" amphere\" # initializing value of current flowing through the sample.\n", + "B=10*10**-6\n", + "print \"B= \",B,\" Tesla\" # initializing value of magnetic field .\n", + "w=0.01*10**-2\n", + "print \"w = \",w,\" m\" # initializing value of width of germanium sample .\n", + "l=0.1*10**-2\n", + "print \"l = \",l,\" m\" # initializing value of length of germanium sample .\n", + "t=0.001*10**-2\n", + "print \"t = \",t,\" m\" # initializing value of thickness of germanium sample .\n", + "p=10**18\n", + "print \"p = \",p,\" atoms/cmˆ3\" # initializing value of doped donor atoms .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", + "Yh=((B)/(p*e*t))\n", + "print \"Hall voltage ,Yh=((B)/(p∗e∗t)))= \",Yh,\"ohm\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_8 pgno: 75" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "no = 15000000000.0\n", + "n= 20000000000000000\n", + "un = 1200\n", + "up = 500\n", + "e = 1.6e-19 columb\n", + "resistivity ,p=(1/(2∗e∗no∗(sqrt(un/up))))= 268957.17682 ohm\n", + "conductivity ,s=(1/p))= 3.71806401236e-06 S /cm\n", + "intrinsic conductivity ,sigma=e∗no∗(un+up))= 4.08e-06 S/cm\n" + ] + } + ], + "source": [ + "#exa 3.8\n", + "from math import sqrt\n", + "no=1.5*10**10\n", + "print \"no = \",no # initializing value of electron hole per cmˆ3.\n", + "n=2*10**16\n", + "print \"n= \",n # initializing value of number of electrons per cmˆ3.\n", + "un =1200\n", + "print \"un = \",un # initializing value of mobility of n−type carrier .\n", + "up =500\n", + "print \"up = \",up # initializing value of mobility of p−type carrier .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", + "p=(1/(2*e*no*(sqrt(un*up))))\n", + "print \"resistivity ,p=(1/(2∗e∗no∗(sqrt(un/up))))= \",p,\" ohm\" # calculation\n", + "sigmamin=(1/p)\n", + "print \"conductivity ,s=(1/p))= \",sigmamin,\" S /cm\" # calculation\n", + "sigma=e*no*(un+up)\n", + "print \"intrinsic conductivity ,sigma=e∗no∗(un+up))= \",sigma,\" S/cm\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_10 pgno: 76" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "po = 1000000000000000000 cmˆ−3\n", + "no = 15000000000.0 /cmˆ−3\n", + "P(o)= 100000000000000000 cmˆ−3\n", + "A = 0.1 cmˆ−2\n", + "up = 300 cmˆ2/Vs\n", + "t = 7e-09 sec\n", + "T = 300 K\n", + "Vt = 0.0259 eV\n", + "x = 5e-06 cm\n", + "Diffusion cofficient ,Dp=(Vt∗up))= 7.77 cmˆ2/s\n", + "Diffusion length ,Lp=(sqrt(Dp∗t)))= 0.000233216637485 cm\n", + "Excess charge generated ,p(x)=(po+(P(o)∗exp(−x/Lp) ) )= 1.09787888943e+18 cmˆ−3\n", + "Fermi level ,Efi Efp=(Vt∗log(p(x)/no)))= 0.469012627899 eV\n" + ] + } + ], + "source": [ + "#exa 3.10\n", + "from math import sqrt\n", + "from math import exp\n", + "from math import log\n", + "po =10**18\n", + "print \"po = \",po,\" cmˆ−3\" # initializing value of N type doping level .\n", + "no=1.5*10**10\n", + "print \"no = \",no,\" /cmˆ−3\" # initializing value of electron and hole concentration per cmˆ3.\n", + "Po =10**17\n", + "print \"P(o)= \",Po,\" cmˆ−3\" # initializing value of excess hole concentration .\n", + "A=0.1\n", + "print \"A = \",A,\" cmˆ−2\" # initializing the value of area .\n", + "up=300\n", + "print \"up = \",up,\" cmˆ2/Vs\" # initializing value of mobility of p−type carrier .\n", + "t=7*10**-9\n", + "print \"t = \",t,\" sec\" # initializing value of transit time.\n", + "T=300\n", + "print \"T = \",T,\"K\" # initializing value of temperature .\n", + "Vt=0.0259\n", + "print \"Vt = \",Vt,\" eV\" # initializing value of thermal voltage at 300K.\n", + "x=500*10**-8\n", + "print \"x = \",x,\" cm\" # initializing value of distance at which difference in fermi level is to calculated .\n", + "Dp=(Vt*up)\n", + "print \"Diffusion cofficient ,Dp=(Vt∗up))= \",Dp,\" cmˆ2/s\" #calculation \n", + "Lp=(sqrt(Dp*t))\n", + "print \"Diffusion length ,Lp=(sqrt(Dp∗t)))= \",Lp,\" cm\" # calculation\n", + "px=(po+(Po*exp(-x/Lp)))\n", + "print \"Excess charge generated ,p(x)=(po+(P(o)∗exp(−x/Lp) ) )= \",px,\" cmˆ−3\" # calculation\n", + "Efi_Efp=(Vt*log(px/no))\n", + "print \"Fermi level ,Efi Efp=(Vt∗log(p(x)/no)))= \",Efi_Efp,\" eV\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_11 pgno: 77" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A = 1e-05 cmˆ2\n", + "Dp= 0.000777 cmˆ2/s\n", + "Lp = 2.33e-06 cm\n", + "x = 5e-06 cm\n", + "P(O)−po = 100000000000000000000000\n", + "e = 1.6e-19 column\n", + "Hole current ,I=(((e∗A∗Dp∗[P(O)−po])/Lp)∗exp(−x/Lp))= 6.24054720884 amphere\n", + " stored excess hole ,Q=(e∗A∗Dp∗Lp∗P))= 2.896656e-10 C\n" + ] + } + ], + "source": [ + "#exa 3.11\n", + "from math import exp\n", + "A=0.1*10**-4\n", + "print \"A = \",A,\" cmˆ2\" # initializing value of area .\n", + "Dp =7.77*10** -4\n", + "print \"Dp= \",Dp,\" cmˆ2/s\" # initializing value of diffusion cofficient .\n", + "Lp =0.233*10** -5\n", + "print \"Lp = \",Lp,\" cm\" # initializing value of diffusion length .\n", + "x=500*10**-8\n", + "print \"x = \",x,\" cm\" # initializing value of distance\n", + "P=10**17*10**6\n", + "print \"P(O)−po = \",P # initializing value of P(O)−po\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"column\" # initializing value of charge of electron .\n", + "I=(((e*A*Dp*P)/Lp)*exp(-x/Lp))\n", + "print \"Hole current ,I=(((e∗A∗Dp∗[P(O)−po])/Lp)∗exp(−x/Lp))= \",I,\"amphere\" # calculation\n", + "Q=(e*A*Dp*Lp*P)\n", + "print \" stored excess hole ,Q=(e∗A∗Dp∗Lp∗P))= \",Q,\"C\" # calculation\n", + "# the value of current(I) given after calculation inthe book is wrong, (as the value of Lp used in the formula while finding value of hole current ( I)at two places is used different).\n", + "# I have used the value Lp=0.233∗10ˆ−5 cm" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_12 pgno: 77" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I = 0.002 amphere\n", + "B= 0.1 Tesla\n", + "w = 0.0002 mm\n", + "l = 0.002 m\n", + "t = 2e-05 m\n", + "Vaa = 10 V\n", + "Vh = -0.01 V\n", + "e = 1.6e-19 columb\n", + "electron concentration ,n=((I∗B)/(e∗t∗Vh))= -6.25e+21 mˆ−3\n", + "mobility ,un=(I∗L/(e∗n∗Vaa∗w∗t))= 0.1 mˆ2/Vs\n" + ] + } + ], + "source": [ + "#exa 3.12\n", + "I=2*10**-3\n", + "print \"I = \",I,\" amphere\" # initializing value of current flowing through the sample.\n", + "B=1000*10**-4\n", + "print \"B= \",B,\" Tesla\" # initializing value of magnetic field .\n", + "w=0.2*10**-3\n", + "print \"w = \",w,\" mm\" # initializing value of width of sample .\n", + "l=2*10**-3\n", + "print \"l = \",l,\" m\" # initializing value of length of sample .\n", + "t=0.02*10**-3\n", + "print \"t = \",t,\" m\" # initializing value of thickness of sample .\n", + "Vaa=10\n", + "print \"Vaa = \",Vaa,\" V\" # initializing value of applied voltage .\n", + "Vh = -10*10** -3\n", + "print \"Vh = \",Vh,\" V\" # initializing value of hall voltage .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", + "n=((I*B)/(e*t*Vh))\n", + "print \"electron concentration ,n=((I∗B)/(e∗t∗Vh))= \",n,\" mˆ−3\" # calculation\n", + "un=(I*l/(e*abs(n)*Vaa*w*t))\n", + "print \"mobility ,un=(I∗L/(e∗n∗Vaa∗w∗t))= \",un,\" mˆ2/Vs\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_14 pgno: 78" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ND x = ((10ˆ17) −(10ˆ18∗x))\n", + "differentiating above equation with resprct to x\n", + "d[ND x]/dx = (−10ˆ18) cmˆ−4\n", + "now, electric field is given by \n", + "E x = −(VT/ND x)∗(d[ND x]/dx) = (0.0259∗10ˆ18)/((10ˆ15) −(10ˆ18∗x))\n", + "for x = 0\n", + "E x = 25.9 V/cm\n", + "for x = 1∗10ˆ−4 cm\n", + "E x = 28.7777777778 V/cm\n" + ] + } + ], + "source": [ + "#exa 3.14\n", + "print \"ND x = ((10ˆ17) −(10ˆ18∗x))\" # donor concentration in an N type semiconductor\n", + "print \"differentiating above equation with resprct to x\"\n", + "print \"d[ND x]/dx = (−10ˆ18) cmˆ−4\"\n", + "print \"now, electric field is given by \"\n", + "print \"E x = −(VT/ND x)∗(d[ND x]/dx) = (0.0259∗10ˆ18)/((10ˆ15) −(10ˆ18∗x))\" # equation for electric field\n", + "print \"for x = 0\" \n", + "x=0\n", + "E_x = (0.0259*10**18)/((10**15) -(10**18*x))\n", + "print \"E x = \",E_x,\"V/cm\"\n", + "print \"for x = 1∗10ˆ−4 cm\"\n", + "x = 1*10**-4\n", + "E_x = (0.0259*10**18)/((10**15) -(10**18*x))\n", + "print \"E x = \",E_x,\"V/cm\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_17 pgno: 81" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 100000000000000000 /cmˆ3\n", + "Na= 0 /cmˆ3\n", + "no = 1800000.0 /cmˆ3\n", + "E = 5 V/cm\n", + "un = 7500 cmˆ2/s\n", + "n1= 100000000000000000 cmˆ−3\n", + "e = 1.6e-19 columb\n", + "Electron concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= 1e+17 cmˆ−3\n", + "Hole concentration ,p=(noˆ2/n))= 3.24e-05 cmˆ−3\n", + "Drift current density , Jdrift=n1∗un∗e∗E)= 600.0 A/cmˆ2\n" + ] + } + ], + "source": [ + "#exa 3.17\n", + "from math import sqrt\n", + "Nd =10**17\n", + "print \"Nd = \",Nd,\" /cmˆ3\" # initializing value of donor concentration .\n", + "Na=0\n", + "print \"Na= \",Na,\"/cmˆ3\" # initializing value of acceptor concentration .\n", + "no=1.8*10**6\n", + "print \"no = \",no,\" /cmˆ3\" # initializing value of electron and hole concentration per cmˆ3.\n", + "E=5\n", + "print \"E = \",E,\" V/cm\" # initializing value of electric field .\n", + "un=7500\n", + "print \"un = \",un,\" cmˆ2/s\" # initializing value of mobility .\n", + "n1=10**17\n", + "print \"n1= \",n1,\" cmˆ−3\" # initializing value of impurity concentration .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", + "n=(-(Na-Nd)+sqrt((Na-Nd)**2+4*no))/2\n", + "print \"Electron concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= \",n,\" cmˆ−3\" #calculation\n", + "p=(no**2/n)\n", + "print \"Hole concentration ,p=(noˆ2/n))= \",p,\" cmˆ−3\" # calculation\n", + "Jdrift=n1*un*e*E\n", + "print \"Drift current density , Jdrift=n1∗un∗e∗E)= \",Jdrift,\" A/cmˆ2\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_18 pgno: 82" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 0 /cmˆ3\n", + "Na= 100000000000000000 /cmˆ3\n", + "no = 1800000.0 /cmˆ3\n", + "E = 10 V/cm\n", + "un = 200 cmˆ2/s\n", + "p1= 100000000000000000 cmˆ−3\n", + "e = 1.6e-19 columb\n", + "Electron concentration ,p=−(−(Na−Nd)−sqrt ((Na−Nd)**2+4∗(no**2)))/2= 1e+17 cmˆ−3\n", + "Hole concentration ,n=(noˆ2/p))= 3.24e-05 cmˆ−3\n", + "Drift current density , Jdrift=n1∗un∗e∗E)= 32.0 A/cmˆ2\n" + ] + } + ], + "source": [ + "#exa 3.18\n", + "from math import sqrt\n", + "Nd=0\n", + "print \"Nd = \",Nd,\" /cmˆ3\" # initializing value of donor concentration .\n", + "Na =10**17\n", + "print \"Na= \",Na,\" /cmˆ3\" # initializing value of acceptor concentration .\n", + "no=1.8*10**6\n", + "print \"no = \",no,\" /cmˆ3\" # initializing value of electron and hole concentration per cmˆ3.\n", + "E=10\n", + "print \"E = \",E,\" V/cm\" # initializing value of electric field .\n", + "un=200\n", + "print \"un = \",un,\" cmˆ2/s\" # initializing value of mobility \n", + "p1=10**17\n", + "print \"p1= \",p1,\" cmˆ−3\" # initializing value of impurity concentration .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", + "p=-(-(Na-Nd)-sqrt((Na-Nd)**2+4*(no**2)))/2\n", + "print \"Electron concentration ,p=−(−(Na−Nd)−sqrt ((Na−Nd)**2+4∗(no**2)))/2= \",p,\" cmˆ−3\" # calculation\n", + "n=(no**2/p)\n", + "print \"Hole concentration ,n=(noˆ2/p))= \",n,\"cmˆ−3\" # calculation\n", + "Jdrift=p1*un*e*E\n", + "print \"Drift current density , Jdrift=n1∗un∗e∗E)= \",Jdrift,\" A/cmˆ2\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_19 pgno: 82" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "D = 120 A/cmˆ2\n", + "E = 5 V/cm\n", + "e = 1.6e-19 columb\n", + "thermal equilibrium value of hole concentration ,p=(D/(450∗ e∗E)))= 3.33333333333e+17 /cmˆ3\n" + ] + } + ], + "source": [ + "#exa 3.19\n", + "D=120\n", + "print \"D = \",D,\" A/cmˆ2\" # initializing value of drift current density .\n", + "E=5\n", + "print \"E = \",E,\" V/cm\" # initializing value of electric field .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columb\" # initializing value of charge of electron .\n", + "p=(D/(450*e*E))\n", + "print \"thermal equilibrium value of hole concentration ,p=(D/(450∗ e∗E)))= \",p,\" /cmˆ3\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_20 pgno: 83" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 50000000000000000 /cmˆ3\n", + "A= 5e-07 cmˆ2\n", + "l = 0.2 /cm\n", + "E = 10 V\n", + "un = 1100 cmˆ2/s\n", + "p= 50000000000000000 /cmˆ−3\n", + "e = 1.6e-19 columb\n", + "Current through the bar,I=(p∗up∗e∗E∗A)/l)= 0.00022 A\n" + ] + } + ], + "source": [ + "#exa 3.20\n", + "Nd =5*10**16\n", + "print \"Nd = \",Nd,\" /cmˆ3\" # initializing value of donor concentration .\n", + "A=50*10**-8\n", + "print \"A= \",A,\" cmˆ2\" # initializing value of area .\n", + "l=0.2\n", + "print \"l = \",l,\" /cm\" # initializing value of length .\n", + "E=10\n", + "print \"E = \",E,\" V\" # initializing value of electric field .\n", + "up=1100\n", + "print \"un = \",up,\" cmˆ2/s\" # initializing value of mobility .\n", + "p=5*10**16\n", + "print \"p= \",p,\" /cmˆ−3\" # initializing value of impurity concentration .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columb\" # initializing value of charge of electron .\n", + "I=(p*up*e*E*A)/l\n", + "print \"Current through the bar,I=(p∗up∗e∗E∗A)/l)= \",I,\"A\" # calculation" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_4__EXCESS_CARRIER_IN_SEMICONDUCTOR.ipynb b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_4__EXCESS_CARRIER_IN_SEMICONDUCTOR.ipynb new file mode 100755 index 00000000..4b62aae8 --- /dev/null +++ b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_4__EXCESS_CARRIER_IN_SEMICONDUCTOR.ipynb @@ -0,0 +1,266 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 EXCESS CARRIER IN SEMICONDUCTOR" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_2 pgno: 100" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 200000000000000000 cmˆ−3\n", + "Er = 11.9\n", + "e = 1.6e-19 columns\n", + "eo = 8.854e-14\n", + "un = 1350 cm2/Vs\n", + " conducitivity , sigma=e∗un∗Nd)= 43.2 S/cm\n", + "Dielectric releaxation time ,td=((Er∗Eo)/sigma))= 2.43894907407e-14 s\n" + ] + } + ], + "source": [ + "#exa 4.2\n", + "Nd =2*10**17\n", + "print\"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration .\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric constant.\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "Eo=8.854*10**-14\n", + "print\"eo = \",Eo # initializing value of permittivity of free space .\n", + "un=1350\n", + "print\"un = \",un,\"cm2/Vs\" # initializing value of mobility .\n", + "sigma=e*un*Nd\n", + "print\" conducitivity , sigma=e∗un∗Nd)=\",sigma,\"S/cm\"# calculation\n", + "td=((Er*Eo)/sigma)\n", + "print\"Dielectric releaxation time ,td=((Er∗Eo)/sigma))=\",td,\"s\"# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_3 pgno: 101" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "n = 1000000000000000 cmˆ−3\n", + "no = 10000000000 cmˆ−3\n", + "t = 1e-06 s\n", + "Excess electron concentration = 100000000000000 cmˆ−3\n", + "electron hole recombination ,R=(c/t))= 1e+20 /cmˆ3s\n" + ] + } + ], + "source": [ + "#exa 4.3\n", + "n=10**15\n", + "print\"n = \",n,\"cmˆ−3\" # initializing value of concentration of electrons/cmˆ3.\n", + "no =10**10\n", + "print\"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration of electron .\n", + "t=10**-6\n", + "print\"t = \",t,\"s\" # initializing value of carrier lifetime .\n", + "c=1*10**14\n", + "print\"Excess electron concentration = \",c,\"cmˆ−3\" # initializing value of excess electrons concentration .\n", + "R=(c/t)\n", + "print\"electron hole recombination ,R=(c/t))=\",R,\" /cmˆ3s\"# calculation," + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 1000000000000000 cmˆ−3\n", + "minority carrier lifetime = 1e-05 s\n", + "no = 15000000000.0 cmˆ−3\n", + "excess carrier concentration ,p=(noˆ2/Nd))= 225000.0 /cmˆ3\n", + "electron hole generation and recombination rate ,R=(p/t))= 22500000000.0 /cmˆ3s\n", + "majority carrier concentration ,t=Nd/R)= 44444.4444444 s\n" + ] + } + ], + "source": [ + "#exa 4.4\n", + "Nd =10**15\n", + "print\"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration ..\n", + "tn =10*10**-6\n", + "print\"minority carrier lifetime = \",tn,\"s\" #initializing value of minority carrier lifetime\n", + "no=1.5*10**10\n", + "print\"no = \",no,\"cmˆ−3\" # initializing value of electron and hole concentration per cmˆ3.\n", + "p=(no**2/Nd)\n", + "print\"excess carrier concentration ,p=(noˆ2/Nd))=\",p,\"/cmˆ3\"# calculation\n", + "R=(p/tn)\n", + "print\"electron hole generation and recombination rate ,R=(p/t))=\",R,\"/cmˆ3s\"#calculation\n", + "t=Nd/R\n", + "print\"majority carrier concentration ,t=Nd/R)=\",t,\"s\"# calculation .\n", + "#the value of majority carrier concentration,t=Nd/R( after calculation ) , is provided wrong in the solution .\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_5 pgno: 101" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 10000000000000000 cmˆ−3\n", + "p = 1000000 cmˆ−3\n", + "no = 10000000000 cmˆ−3\n", + "n∗ = 1000000000000000 cmˆ−3\n", + "p∗ = 1000000000000000 cmˆ−3\n", + "KT = 0.0259 eV\n", + "T = 300 K\n", + "Thermal equilibirium fermi level ,( Ef Efi )=(KT∗log(n/no)))= 0.357821723451 eV\n", + "Quasi−fermi levels for n−type dopant ,( Efn Efi )=(KT∗log ((n+n∗)/no))= 0.360290257108 eV\n", + "Quasi−fermi levels for p−type dopant ,( Efi Efp )=(KT∗log ((p+p∗)/no))= 0.360290257108 eV\n" + ] + } + ], + "source": [ + "#exa 4.5\n", + "from math import log\n", + "Nd =10**16\n", + "print\"Nd = \",Nd,\" cmˆ−3\" # initializing value of donor concentration .\n", + "p=10**6\n", + "print\"p = \",p,\" cmˆ−3\" # initializing value of minority hole concentration .\n", + "no =10**10\n", + "print\"no = \",no,\" cmˆ−3\" # initializing value of electron and hole concentration per cm ˆ3..\n", + "n1 =10**15\n", + "print\"n∗ = \",n1,\" cmˆ−3\" # initializing value of excess electron carrier concentration(denoted by n∗).\n", + "p1=10**15\n", + "print\"p∗ = \",p1,\" cmˆ−3\" # initializing value of excess hole carrier concentration( denoted by p∗).\n", + "KT=0.0259\n", + "print\"KT = \",KT,\" eV\" # initializing value of multipication of temperature and bolzmann constant .\n", + "T=300\n", + "print\"T = \",T,\" K\" # initializing value of temperature .\n", + "Ef_Efi=(log(Nd/no)*KT)\n", + "print\"Thermal equilibirium fermi level ,( Ef Efi )=(KT∗log(n/no)))=\",Ef_Efi,\" eV\"#calculation .\n", + "Efn_Efi=log((Nd+n1)/no)*KT\n", + "print\"Quasi−fermi levels for n−type dopant ,( Efn Efi )=(KT∗log ((n+n∗)/no))=\",Efn_Efi,\" eV\"# calculation .\n", + "Efi_Efp=log((Nd+p1)/no)*KT\n", + "print\"Quasi−fermi levels for p−type dopant ,( Efi Efp )=(KT∗log ((p+p∗)/no))=\",Efi_Efp,\" eV\"# calculation .\n", + "#the answer for Efn Efi , Efi Efp is provided wrong in the book.\n", + "#In this question,Nd=(n(used in the formula))." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_6 pgno: 102" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 50000000000000000 cmˆ−3\n", + "Na = 0 cmˆ−3\n", + "no = 15000000000.0 cmˆ−3\n", + "n∗ = 500000000000000 cmˆ−3\n", + "p∗ = 500000000000000 cmˆ−3\n", + "KT = 0.0259\n", + "thermal equilibrium fermi level ,( Ef Efi )=(KT∗log(n/no)))= 0.389004619083 eV\n", + "Excess carrier concentration ,(Efn Efi)=(KT∗log ((n+n∗)/no))= 0.389262332652 eV\n", + "(Ef Efi)=(KT∗log((p+p∗)/no))= 0.269730711266 eV\n" + ] + } + ], + "source": [ + "#exa 4.6\n", + "from math import log\n", + "Nd =5*10**16\n", + "print\"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor ion concentration .\n", + "Na=0\n", + "print\"Na = \",Na,\"cmˆ−3\" # initializing value of value of acceptor ion concentration .\n", + "no=1.5*10**10\n", + "print\"no =\",no,\"cmˆ−3\" # initializing electron and hole concentration per cmˆ3.\n", + "n1 =5*10**14\n", + "print\"n∗ =\",n1,\"cmˆ−3\" # initializing excess electron carrier concentration .\n", + "p1 =5*10**14\n", + "print\"p∗ =\",p1,\"cmˆ−3\" # initializing excess hole carrier concentration .\n", + "KT=0.0259\n", + "print\"KT =\",KT #initializing value of voltage \n", + "Ef_Efi=(KT*log(Nd/no))\n", + "print\"thermal equilibrium fermi level ,( Ef Efi )=(KT∗log(n/no)))=\",Ef_Efi,\"eV\" #calculation .\n", + "Efn_Efi=log((Nd+n1)/no)*KT\n", + "print\"Excess carrier concentration ,(Efn Efi)=(KT∗log ((n+n∗)/no))=\",Efn_Efi,\"eV\" # calculation .\n", + "Efi_Efp=log((Na+p1)/no)*KT\n", + "print\"(Ef Efi)=(KT∗log((p+p∗)/no))=\",Efi_Efp,\"eV\"# calculation ." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_5_PN_JUNCTION_DIODE.ipynb b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_5_PN_JUNCTION_DIODE.ipynb new file mode 100755 index 00000000..f92767c3 --- /dev/null +++ b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_5_PN_JUNCTION_DIODE.ipynb @@ -0,0 +1,1364 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# chapter 5 PN JUNCTION DIODE" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_5 pgno: 142" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na 100000000000000000 /cmˆ3\n", + "Nd= 1000000000000000 /cmˆ3\n", + "no = 15000000000.0 cmˆ−3\n", + "e = 1.6e-19 columns\n", + "K = 1.38e-23 J/k\n", + "T = 300 K\n", + "(a)fermi level in the P region , Efi Efp=((KT/e) ∗ log (Na/no ) ) )= 0.406564315296 eV\n", + "fermi level in the n region,Efn Efi=((KT/e)∗log (Nd/no) ) )= 0.287405536734 eV\n", + "(b) junction potential at room temperature ,Efn Efp=(Efi Efp)+(Efn Efi))= 0.69396985203 eV\n" + ] + } + ], + "source": [ + "#exa 5.5\n", + "from math import log\n", + "Na =10**17\n", + "print \"Na\",Na,\"/cmˆ3\" # initializing value of medium p doping concentration .\n", + "Nd =10**15\n", + "print \"Nd= \",Nd,\"/cmˆ3\" # initializing value of light n doping .\n", + "no=1.5*10**10\n", + "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "K=1.38*10**-23\n", + "print \"K = \",K,\"J/k\" #initializing value of boltzmann constant .\n", + "T=300\n", + "print \"T = \",T,\"K\" # initializing value of temperature .\n", + "Efi_Efp=((K*T/e)*log(Na/no))\n", + "print \"(a)fermi level in the P region , Efi Efp=((KT/e) ∗ log (Na/no ) ) )= \",Efi_Efp,\"eV\" # calculation .\n", + "Efn_Efi=((K*T/e)*log(Nd/no))\n", + "print \"fermi level in the n region,Efn Efi=((KT/e)∗log (Nd/no) ) )=\",Efn_Efi,\" eV\" # calculation\n", + "Efn_Efp=(Efi_Efp)+(Efn_Efi)\n", + "print\"(b) junction potential at room temperature ,Efn Efp=(Efi Efp)+(Efn Efi))=\",Efn_Efp,\" eV\" #calculation ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_7 pgno: 143" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Pp= 1000000000000000000 /cmˆ3\n", + "Nn= 1000000000000000 /cmˆ3\n", + "tp = 7e-06 s\n", + "tn = 2e-07 s\n", + "up= 800 cm2/Vs\n", + "un= 300 cm2/Vs\n", + "no = 15000000000.0 cmˆ−3\n", + "Vf = 0.6 V\n", + "A = 0.0001 mˆ2\n", + "e = 1.6e-19 columns\n", + "K = 1.38e-23 J/k\n", + "T = 300 K\n", + "Vt=(K∗T/e))= 0.025875 eV\n", + "Dp=Vt∗un= 7.7625 cmˆ−3\n", + "Dn=Vt∗up= 20.7 cmˆ−3\n", + "Lp=(sqrt(Dp∗tp))= 0.00737139742518 cm\n", + "Ln=(sqrt(Dn∗tn))= 0.00203469899494 cm\n", + "npo=(no^2/Pp)= 225.0 cmˆ−3\n", + "Ppo=(noˆ2/Nn)= 225000.0 cmˆ−3\n", + "Reverse saturation current ,Io=(((Dp∗Ppo)/(Lp)) + ( ( D n ∗ n p o ) / ( L n ) ) ) ∗ e ∗ A= 3.827628972e-15 A \n", + "Diode forward current , If=Io∗((exp(Vf/Vt))−1)= 4.5032547414e-05 A\n" + ] + } + ], + "source": [ + "#exa 5.7\n", + "from math import sqrt\n", + "from math import exp\n", + "Pp =10**18\n", + "print \"Pp= \",Pp,\"/cmˆ3\" # initializing value of doping concentration in p region.\n", + "Nn =10**15\n", + "print \"Nn= \",Nn,\"/cmˆ3\" # initializing value of doping concentration in n region.\n", + "tp =7*10** -6\n", + "print \"tp = \",tp,\"s\" # initializing value of hole lifetime .\n", + "tn =0.2*10** -6\n", + "print \"tn = \",tn,\"s\" # initializing value of electron lifetime .\n", + "up=800\n", + "print \"up= \",up,\"cm2/Vs\" # initializing value of P side mobility .\n", + "un=300\n", + "print \"un= \",un,\"cm2/Vs\" # initializing value of n side mobility .\n", + "no=1.5*(10**10)\n", + "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration .\n", + "Vf=0.6\n", + "print \"Vf = \",Vf,\"V\" # initializing value of forward bias voltage .\n", + "A=100*(10**-6)\n", + "print \"A = \",A,\"mˆ2\"# initializing value of diode cross−sectional area .\n", + "e=1.6*(10**-19)\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "K=1.38*(10**-23)\n", + "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", + "T=300\n", + "print \"T = \",T,\"K\" # initializing value of temperature .\n", + "Vt=(K*T/e)\n", + "print \"Vt=(K∗T/e))=\",Vt,\"eV\" #calculation .\n", + "Dp=Vt*un\n", + "print \"Dp=Vt∗un=\",Dp,\"cmˆ−3\" # calculation .\n", + "Dn=Vt*up\n", + "print \"Dn=Vt∗up=\",Dn,\"cmˆ−3\" # calculation .\n", + "Lp=sqrt(Dp*tp)\n", + "print \"Lp=(sqrt(Dp∗tp))=\",Lp,\"cm\" # calculation .\n", + "Ln=(sqrt(Dn*tn))\n", + "print \"Ln=(sqrt(Dn∗tn))=\",Ln,\"cm\" # calculation .\n", + "npo=(no**2/Pp)\n", + "print \"npo=(no^2/Pp)=\",npo,\"cmˆ−3\" # calculation .\n", + "Ppo=(no**2/Nn)\n", + "print \"Ppo=(noˆ2/Nn)=\",Ppo,\"cmˆ−3\" #calculation .\n", + "Io=(((Dp*Ppo)/(Lp))+((Dn*npo)/(Ln)))*e*A\n", + "print \"Reverse saturation current ,Io=(((Dp∗Ppo)/(Lp)) + ( ( D n ∗ n p o ) / ( L n ) ) ) ∗ e ∗ A= \",Io,\" A \" #calculation .\n", + "If=Io*((exp(Vf/Vt))-1)\n", + "print \"Diode forward current , If=Io∗((exp(Vf/Vt))−1)=\",If,\"A\" # calculation .\n", + "#//the value of Io(reverse saturation current ),after calculation is provided wrong in the book.Due to which If (diode forward current )also differ.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_8 pgno: 144" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 40000000000000000 cmˆ−3\n", + "Nd = 20000000000000000000 cmˆ−3\n", + "no = 15000000000.0 cmˆ−3\n", + "e = 1.6e-19 columns\n", + "K = 1.38e-23 J/k\n", + "T = 300 K\n", + "Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd) /(no) ˆ2) )= 0.926513569765 V\n" + ] + } + ], + "source": [ + "#exa 5.8\n", + "Na =4*10**16\n", + "print \"Na = \",Na,\"cmˆ−3\" # initializing value of acceptor concentration .\n", + "Nd =2*10**19\n", + "print \"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration .\n", + "no=1.5*10**10\n", + "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "K=1.38*10**-23\n", + "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", + "T=300\n", + "print \"T = \",T,\"K\" # initializing value of temperature .\n", + "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", + "print \"Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd) /(no) ˆ2) )=\",Vbi,\"V\" # calculation\n", + "#The value used for Nd in the book for solution is different than provided in the question .\n", + "#I have used the value provided in the solution(i.eNd=2∗10ˆ19)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_9 pgno: 144" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 40000000000000000 cmˆ−3\n", + "Nd = 20000000000000000000 cmˆ−3\n", + "no = 1800000.0 cmˆ−3\n", + "e = 1.6e-19 columns\n", + "K = 1.38e-23 J/k\n", + "T = 300 K\n", + "Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd) /(no) ˆ2) )= 1.39371354345 V\n" + ] + } + ], + "source": [ + "#exa 5.9\n", + "Na =4*10**16\n", + "print \"Na = \",Na,\"cmˆ−3\" # initializing value of acceptor concentration .\n", + "Nd =2*10**19\n", + "print \"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration .\n", + "no=1.8*10**6\n", + "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "K=1.38*10**-23\n", + "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", + "T=300\n", + "print \"T = \",T,\"K\" # initializing value of temperature .\n", + "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", + "print \"Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd) /(no) ˆ2) )= \",Vbi,\"V\" # calculation .\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_10 pgno: 144" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na= 1e+17 /cmˆ3\n", + "Nd= 1e+19 /cmˆ3\n", + "Vbi = 0.64 V\n", + "e = 1.6e-19 columns\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "W=sqrt((2∗E∗Vbi/e)∗((Nd+Na)/(Na∗Nd))))= 9.22675353524e-06 cm\n", + "xn=((W∗Na) /(Nd+Na) ) )= 9.13539953984e-08 cm\n", + "xp=((W∗Nd) /(Nd+Na) ) )= 9.13539953984e-06 cm\n", + "Emax=(−e∗Nd∗xn)/E)= -138727.017592 V/cm\n" + ] + } + ], + "source": [ + "# exa 5.10\n", + "from math import sqrt\n", + "Na =10e16\n", + "print \"Na= \",Na,\"/cmˆ3\" # initializing value of medium p doping concentration .\n", + "Nd =10e18\n", + "print \"Nd= \",Nd,\"/cmˆ3\" # initializing value of light n doping .\n", + "Vbi =0.64\n", + "print \"Vbi = \",Vbi,\"V\" # initializing value of built in voltage .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "Er=11.9\n", + "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "E=Eo*Er\n", + "print \" total permittivity ,E=Eo∗Er= \",E,\" F/cm\" #calculation .\n", + "W=sqrt((2*E*Vbi/e)*((Nd+Na)/(Na*Nd)))\n", + "print \"W=sqrt((2∗E∗Vbi/e)∗((Nd+Na)/(Na∗Nd))))=\",W,\" cm\" # calculation .\n", + "xn=((W*Na)/(Nd+Na))\n", + "print \"xn=((W∗Na) /(Nd+Na) ) )=\",xn,\"cm\" # calculation .\n", + "xp=((W*Nd)/(Nd+Na))\n", + "print \"xp=((W∗Nd) /(Nd+Na) ) )=\",xp,\"cm\" # calculation .\n", + "Emax=(-e*Nd*xn)/E\n", + "print \"Emax=(−e∗Nd∗xn)/E)=\",Emax,\"V/cm\" #calculation .\n", + "# The value and unit of W(depletion width) ,provided after calculation in the book is wrong.Due to this xn,xp ,Emax also differ.\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_12 pgno: 145" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 10000000000000000 /cmˆ3\n", + "Nd = 1000000000000000000 /cmˆ3\n", + "Vbi = 0.64 V\n", + "Vr = 20 V\n", + "e = 1.6e-19 columns\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "Emax=−(sqrt(((2∗e∗(Vbi+Vr))/(E))∗((Nd∗Na)/(Na+Nd)))))= -249129.931857 V/cm\n" + ] + } + ], + "source": [ + "#exa 5.12\n", + "Na =10**16\n", + "print \"Na = \",Na,\"/cmˆ3\" # initializing value of medium p doping concentration .\n", + "Nd =10**18\n", + "print \"Nd = \",Nd,\"/cmˆ3\" # initializing value of light n doping .\n", + "Vbi =0.64\n", + "print \"Vbi = \",Vbi,\"V\" # initializing value of built in voltage .\n", + "Vr=20\n", + "print \"Vr = \",Vr,\"V\" # initializing value of applied reverse voltage .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "Er=11.9\n", + "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "E=Eo*Er\n", + "print \" total permittivity ,E=Eo∗Er= \",E,\" F/cm\" #calculation .\n", + "Emax=-(sqrt(((2*e*(Vbi+Vr))/(E))*((Nd*Na)/(Na+Nd))))\n", + "print \"Emax=−(sqrt(((2∗e∗(Vbi+Vr))/(E))∗((Nd∗Na)/(Na+Nd)))))= \",Emax,\"V/cm\" #calculation .\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_13 pgno: 146" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Emax = 200000 V/cm\n", + "Nd= 1000000000000000000 /cmˆ3\n", + "Vbi = 0.54 V\n", + "Vr = 20 V \n", + "e = 1.6e-19 columns\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "Na=(Emaxˆ2∗E∗Nd)/((2∗e∗(Vbi+Vr)∗Nd)−(Emaxˆ2∗E)) )= 6.45341703981e+15 cmˆ−3\n" + ] + } + ], + "source": [ + "#exa 5.13\n", + "Emax =2*10**5\n", + "print \"Emax = \",Emax,\"V/cm\" # initializing value of maximum electric field .\n", + "Nd=1*10**18\n", + "print \"Nd= \",Nd,\"/cmˆ3\" # initializing value of donor concentration .\n", + "Vbi=0.54\n", + "print \"Vbi = \",Vbi,\"V\" # initializing value of built in voltage .\n", + "Vr=20\n", + "print \"Vr = \",Vr,\"V \" #initializing value of applied reverse voltage .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "Er=11.9\n", + "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "E=Eo*Er\n", + "print \"total permittivity ,E=Eo∗Er=\",E,\" F/cm\" #calculation .\n", + "Na=((Emax**2)*E*Nd)/((2*e*(Vbi+Vr)*Nd)-((Emax**2)*E))\n", + "print \"Na=(Emaxˆ2∗E∗Nd)/((2∗e∗(Vbi+Vr)∗Nd)−(Emaxˆ2∗E)) )= \",Na,\"cmˆ−3\" # calculation .\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_14 pgno: 146" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 10000000000000000 /cmˆ3\n", + "Nd = 1000000000000000000 /cmˆ3\n", + "A = 1 cmˆ2\n", + "Vj = 0.54 V\n", + "Va = 10 V\n", + "e = 1.6e-19 columns\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "Cj=sqrt((e∗E∗Aˆ2/(2∗(Va+Vj))∗((Na∗Nd)/(Na+Nd))))= 8.89830403817e-09 f/cmˆ2\n" + ] + } + ], + "source": [ + "#exa 5.14\n", + "Na =10**16\n", + "print \"Na = \",Na,\"/cmˆ3\" # initializing value of acceptor concentration .\n", + "Nd =10**18\n", + "print \"Nd = \",Nd,\"/cmˆ3\" # initializing value of donor concentration .\n", + "A=1\n", + "print \"A = \",A,\"cmˆ2\" # initializing value of area for finding junction capacitance per unit area.\n", + "Vj =0.54\n", + "print \"Vj =\",Vj,\"V\" # initializing value of built in voltage .\n", + "Va=10\n", + "print \"Va = \",Va,\"V\" # initializing value of applied reverse voltage .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "Er=11.9\n", + "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "E=Eo*Er\n", + "print \"total permittivity ,E=Eo∗Er= \",E,\" F/cm\" # calculation .\n", + "Cj=sqrt((e*E*A**2/(2*(Va+Vj)))*((Na*Nd)/(Na+Nd)))\n", + "print \"Cj=sqrt((e∗E∗Aˆ2/(2∗(Va+Vj))∗((Na∗Nd)/(Na+Nd))))=\",Cj,\"f/cmˆ2\" # calculation .\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_15 pgno: 146" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na= 1000000000000000 cmˆ−3\n", + "Nd= 1000000000000000000 cmˆ−3\n", + "no = 1800000.0 cmˆ−3\n", + "e = 1.6e-19 columbs\n", + "K = 1.38e-23 J/k\n", + "T = 300 K\n", + "Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd)/(no)ˆ2))= 1.220749215 V\n" + ] + } + ], + "source": [ + "#exa 5.15\n", + "Na =10**15\n", + "print \"Na= \",Na,\"cmˆ−3\" # initializing value of acceptor concentration .\n", + "Nd =10**18\n", + "print \"Nd= \",Nd,\" cmˆ−3\" # initializing value of donor concentration .\n", + "no=1.8*10**6\n", + "print \"no = \",no,\" cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columbs\" # initializing value of charge of electrons .\n", + "K=1.38*10**-23\n", + "print \"K = \",K,\" J/k\" # initializing value of boltzmann constant .\n", + "T=300\n", + "print \"T = \",T,\" K\" # initializing value of temperature .\n", + "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", + "print \"Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd)/(no)ˆ2))= \",Vbi,\"V\" # calculation .\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_16 pgno: 146" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na= 1000000000000000000 cmˆ−3\n", + "Nd= 1000000000000000000 cmˆ−3\n", + "Vbi = 1.4\n", + "e = 1.6e-19 columbs\n", + "K = 1.38e-23 J/k\n", + "T = 300 K\n", + "Vt = 0.0259 eV\n", + "no=sqrt ((Na∗Nd)/(exp(Vbi/Vt)))= 1829411.05814 cmˆ−3\n" + ] + } + ], + "source": [ + "#5.16\n", + "Na =10**18\n", + "print \"Na= \",Na, \"cmˆ−3\" # initializing value of acceptor concentration .\n", + "Nd =10**18\n", + "print \"Nd= \",Nd,\" cmˆ−3\" # initializing value of donor concentration .\n", + "Vbi =1.4\n", + "print \"Vbi = \",Vbi # initializing value of built in voltage .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\" columbs\" # initializing value of charge of electrons .\n", + "K=1.38*10**-23\n", + "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", + "T=300\n", + "print \"T = \",T,\" K\" # initializing value of temperature .\n", + "Vt=0.0259\n", + "print \"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "no=sqrt((Na*Nd)/(exp(Vbi/Vt)))\n", + "print \"no=sqrt ((Na∗Nd)/(exp(Vbi/Vt)))=\",no,\"cmˆ−3\" #calculation ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_18 pgno: 147" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 100000000000000000 cmˆ−3\n", + "Nd = 50000000000000000 cmˆ−3\n", + "e = 1.6e-19 columbs\n", + "no = 15000000000.0 cmˆ3\n", + "T = 300 K\n", + "Vt = 0.0259 eV\n", + "(a)Vbi=(Vt∗(log(Na∗Nd/(noˆ2))))= 0.795961750143 V\n", + "(b)value of fermi level on each side of junction ,Efi Efp=(Vt∗log(Na/(no)))= 0.40695713106 V\n", + "Efn Efi=(Vt∗log(Nd/(no)))= 0.389004619083 V\n", + "(c)The energy band digram is similar to Fig P5 .3\n", + "(d)Vbi=((Efi Efp)+(Efn Efi))/(e)=Vj= 0.795961750143 V\n" + ] + } + ], + "source": [ + "#exa 5.18\n", + "Na =10**17\n", + "print \"Na = \",Na,\" cmˆ−3\" # initializing value of acceptor concentration .\n", + "Nd =5*10**16\n", + "print \"Nd = \",Nd,\" cmˆ−3\" # initializing value of donor concentration .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\" columbs\" # initializing value of charge of electrons .\n", + "no=1.5*10**10\n", + "print \"no = \",no,\" cmˆ3\" # initializing value of intrinsic carrier concentration .\n", + "T=300\n", + "print \"T = \",T,\" K\" # initializing value of temperature .\n", + "Vt=0.0259\n", + "print \"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "Vbi=(Vt*(log(Na*Nd/(no**2))))\n", + "print \"(a)Vbi=(Vt∗(log(Na∗Nd/(noˆ2))))= \",Vbi,\" V\" #calculation .\n", + "Efi_Efp=(Vt*log(Na/(no)))\n", + "print \"(b)value of fermi level on each side of junction ,Efi Efp=(Vt∗log(Na/(no)))=\",Efi_Efp,\" V\" # calculation .\n", + "Efn_Efi=(Vt*log(Nd/(no)))\n", + "print \"Efn Efi=(Vt∗log(Nd/(no)))=\",Efn_Efi,\" V\" #calculation .\n", + "print \"(c)The energy band digram is similar to Fig P5 .3\"\n", + "Vbi=((Efi_Efp)+(Efn_Efi))\n", + "print \"(d)Vbi=((Efi Efp)+(Efn Efi))/(e)=Vj=\",Vbi,\" V\" # calculation .\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_19 pgno: 148" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 500000000000000000 /cmˆ3\n", + "Nd = 500000000000000000 /cmˆ3\n", + "no = 15000000000.0 cmˆ−3\n", + "e = 1.6e-19 columbs\n", + "K = 1.38e-23 J/k\n", + "T = 300 K\n", + "(a)Built in potential potential ,Vbi=((K∗T/e)∗log ((Na∗Nd)/(no)ˆ2))= 0.896417042561 eV\n", + "(b)fermi level in the P region and N region , Efi Efp=((KT/e)∗log(Na/no)))= 0.44820852128 eV\n", + "(c)VBI from the fermi level ,VBI=2∗(Efi Efp))= 0.896417042561 V\n" + ] + } + ], + "source": [ + "#exa 5.19\n", + "from math import log\n", + "Na =5*10**17\n", + "print \"Na = \",Na,\"/cmˆ3\" # initializing value of medium p doping concentration .\n", + "Nd =5*10**17\n", + "print \"Nd = \",Nd,\"/cmˆ3\" # initializing value of light n doping .\n", + "no=1.5*10**10\n", + "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columbs\" # initializing value of charge of electrons .\n", + "K=1.38*10**-23\n", + "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", + "T=300\n", + "print \"T = \",T,\"K\" # initializing value of temperature .\n", + "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", + "print \"(a)Built in potential potential ,Vbi=((K∗T/e)∗log ((Na∗Nd)/(no)ˆ2))=\",Vbi,\"eV\" #calculation .\n", + "Efi_Efp=((K*T/e)*log(Na/no))\n", + "print \"(b)fermi level in the P region and N region , Efi Efp=((KT/e)∗log(Na/no)))= \",Efi_Efp,\"eV\" # calculation .\n", + "VBI=2*(Efi_Efp)\n", + "print \"(c)VBI from the fermi level ,VBI=2∗(Efi Efp))=\",VBI,\"V\" # calculation ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_20 pgno: 148" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nc = 2.8e+19 /cmˆ3\n", + "Nv = 1.04e+19 /cmˆ3\n", + "no = 15000000000.0 cmˆ−3\n", + "e = 1.6e-19 columbs\n", + "K = 8.62e-05 J/k\n", + "T = 300 K\n", + "Vt = 0.0259 eV\n", + "Ec Ef = 0.21 eV\n", + "Ef Ev = 0.18 eV\n", + "Nd=(Nc/exp((Ec−Ef)/(K∗T))))= 8.32539212771e+15 cmˆ−3\n", + "Na=(Nv/exp (( Ef−Ev) /(K∗T) ) ) )= 9.86510951303e+15 cmˆ−3\n", + "Built in potential ,Vbi=(Vt∗(log(Na∗Nd/(noˆ2))))= 0.68954178887 V\n" + ] + } + ], + "source": [ + "#exa 5.20\n", + "Nc=2.8*10**19\n", + "print \"Nc = \",Nc,\" /cmˆ3\" # initializing value of number of electron in the conduction band .\n", + "Nv=1.04*10**19\n", + "print \"Nv = \",Nv,\" /cmˆ3\" # initializing value of number of electron in the valence band..\n", + "no=1.5*10**10\n", + "print \"no = \",no,\" cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\" columbs\" # initializing value of charge of electrons .\n", + "K=8.62*10**-5\n", + "print \"K = \",K,\" J/k\" # initializing value of boltzmann constant .\n", + "T=300\n", + "print \"T = \",T,\" K\" # initializing value of temperature .\n", + "Vt=0.0259\n", + "print \"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "Ec_Ef =0.21\n", + "print \"Ec Ef = \",Ec_Ef,\" eV\" # initializing value of energy difference between conduction band and fermi level.\n", + "Ef_Ev =0.18\n", + "print \"Ef Ev = \",Ef_Ev,\" eV\" # initializing value of energy difference between fermi level and valence band .\n", + "Nd=(Nc/exp((Ec_Ef)/(K*T)))\n", + "print \"Nd=(Nc/exp((Ec−Ef)/(K∗T))))= \",Nd,\" cmˆ−3\" #calculation .\n", + "Na=(Nv/exp((Ef_Ev)/(K*T)))\n", + "print \"Na=(Nv/exp (( Ef−Ev) /(K∗T) ) ) )=\",Na,\"cmˆ−3\" # calculation .\n", + "Vbi=(Vt*(log(Na*Nd/(no**2))))\n", + "print \"Built in potential ,Vbi=(Vt∗(log(Na∗Nd/(noˆ2))))= \",Vbi,\" V\" #calculation ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_21 pgno: 149" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Vbi = 1.2 /cmˆ3\n", + "no = 1800000.0 cmˆ−3”\n", + "Vt = 0.0259 eV\n", + "Er = 13.1\n", + "Eo = 8.854e-14 F/cm\n", + "e = 1.6e-19 columbs\n", + " total permittivity ,E=Eo∗Er= 1.159874e-12 F/cm\n", + "(a)NaNd=((noˆ2)∗(exp(Vbi/Vt)))= 4.28841757806e+32 /cmˆ6\n", + "Na=(sqrt(NaNd/(4)))= 1.03542474112e+16 /cmˆ3\n", + "(b)Nd=4∗Na= 4.14169896446e+16 /cmˆ3\n", + "(c)W=sqrt((2∗E∗Vbi/e)∗((Nd+Na)/(Na∗Nd))))= 4.58296745959e-05 cm\n", + "(d)xn=0.2∗W= 9.16593491919e-06 cm\n", + "xp=0.8∗W= 3.66637396767e-05 cm\n", + "(e)Emax=(−e∗Nd∗xn)/E)= -52367.8167292 V/cm\n" + ] + } + ], + "source": [ + "#exa 5.21\n", + "from math import sqrt\n", + "from math import exp\n", + "Vbi =1.2\n", + "print \"Vbi = \",Vbi,\"/cmˆ3\" # initializing value of built in voltage .\n", + "no=1.8*10**6\n", + "print \"no = \",no,\"cmˆ−3”\" # initializing value of intrinsic concentration .\n", + "Vt =0.0259\n", + "print \"Vt = \",Vt,\"eV\" # initializing value of thermal voltage .\n", + "Er =13.1\n", + "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "e =1.6*(10**-19)\n", + "print \"e = \",e,\" columbs\" # initializing value of charge of electrons .\n", + "E=Eo*Er\n", + "print \" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation .\n", + "NaNd=((no**2)*(exp(Vbi/Vt)))\n", + "print \"(a)NaNd=((noˆ2)∗(exp(Vbi/Vt)))= \",NaNd,\" /cmˆ6\" # calculation .\n", + "Na=(sqrt(NaNd/(4)))\n", + "print \"Na=(sqrt(NaNd/(4)))=\",Na,\" /cmˆ3\" # calculation .\n", + "Nd=4*Na\n", + "print \"(b)Nd=4∗Na= \",Nd,\" /cmˆ3\" # calculation.\n", + "W=sqrt((2*E*Vbi/e)*((Nd+Na)/(Na*Nd)))\n", + "print \"(c)W=sqrt((2∗E∗Vbi/e)∗((Nd+Na)/(Na∗Nd))))= \",W,\" cm\" # calculation .\n", + "xn=0.2*W\n", + "print \"(d)xn=0.2∗W= \",xn,\" cm\" # calculation .\n", + "xp=0.8*W\n", + "print \"xp=0.8∗W= \",xp,\" cm\" # calculation .\n", + "Emax=(-e*Nd*xn)/E\n", + "print \"(e)Emax=(−e∗Nd∗xn)/E)= \",Emax,\"V/cm\" # calculation .\n", + "#The value of Na after calculation is provided wrong in the book.Due to which value of W,xn,xp and Emax differ ,than the answer provided in the book ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_22 pgno: 150" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 10000000000000000 cmˆ−3\n", + "Nd = 5000000000000000 cmˆ−3\n", + "no = 15000000000.0 cmˆ−3\n", + "Vbi = 0.676 V\n", + "e = 1.6e-19 columns\n", + "K = 1.38e-23 J/k\n", + "T=(Vbi∗(e/K)∗(1/(log((Na∗Nd)/(noˆ2))))))= 299.984615257 K\n" + ] + } + ], + "source": [ + "#exa 5.22\n", + "from math import log\n", + "Na =10**16\n", + "print \"Na = \",Na,\"cmˆ−3\" # initializing value of acceptor concentration .\n", + "Nd =5*10**15\n", + "print \"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration .\n", + "no=1.5*10**10\n", + "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration .\n", + "Vbi =0.676\n", + "print \"Vbi = \",Vbi,\"V\" # initializing value of built in voltage .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "K=1.38*10**-23\n", + "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", + "T=(Vbi*(e/K)*(1/(log((Na*Nd)/(no**2)))))\n", + "print \"T=(Vbi∗(e/K)∗(1/(log((Na∗Nd)/(noˆ2))))))= \",T,\"K\" # calculation ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_23 pgno: 150" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 500000000000000000 cmˆ−3\n", + "Nd = 100000000000000000 cmˆ−3\n", + "no = 15000000000.0 cmˆ−3\n", + "e = 1.6e-19 columns\n", + "K = 1.38e-23 J/k\n", + "T = 300 K\n", + "VBI = 0.847 V\n", + "(a)Built in potential potential ,Vbi=((K∗T/e)∗log ((Na∗Nd)/(no)ˆ2))= 0.854772836577 V\n", + "(b)T=(VBI∗(e/K)∗(1/(log((Na∗Nd)/(noˆ2))))))= 297.271964113 K\n" + ] + } + ], + "source": [ + "#exa 5.23\n", + "Na =5*10**17\n", + "print \"Na = \",Na,\"cmˆ−3\" # initializing value of acceptor concentration .\n", + "Nd =10**17\n", + "print \"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration .\n", + "no=1.5*10**10\n", + "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "K=1.38*10**-23\n", + "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", + "T=300\n", + "print \"T = \",T,\"K\" # initializing value of temperature .\n", + "VBI=0.847\n", + "print \"VBI = \",VBI,\"V\" # initializing value of VBI when VBI is reduced by 1%.\n", + "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", + "print \"(a)Built in potential potential ,Vbi=((K∗T/e)∗log ((Na∗Nd)/(no)ˆ2))= \",Vbi,\"V\" # calculation .\n", + "T=(e*VBI/K)*((log(Na*Nd/(no**2)))**-1)\n", + "print \"(b)T=(VBI∗(e/K)∗(1/(log((Na∗Nd)/(noˆ2))))))= \",T,\"K\" # calculation .\n", + "#the answer for part (b) is not provided in the book ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_24 pgno: 150" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false, + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 4e+12 /cmˆ3\n", + "Nd = 4e+16 /cmˆ3\n", + "no = 1.5e+11 /cmˆ3\n", + "K = 1.38e-23 J/k\n", + "T = 300 K\n", + "e = 1.6e-19 columbs\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd)/(no)ˆ2))= 0.408234249531 eV\n", + "W=sqrt((2∗E∗Vbi/e)∗((Nd+Na)/(Na∗Nd))))= 0.00115943039897 cm\n", + "xn=((W∗Na) /(Nd+Na) ) )= 1.15931446752e-07 cm\n", + "xp=((W∗Nd) /(Nd+Na) ) )= 0.00115931446752 cm\n", + "Emax=(e∗Nd∗xn)/E)= 704.19794046 V/cm\n" + ] + } + ], + "source": [ + "#exa 5.24\n", + "from math import log\n", + "from math import sqrt\n", + "Na =4e12\n", + "print \"Na = \",Na,\" /cmˆ3\" # initializing value of medium p doping concentration .\n", + "Nd =4e16\n", + "print \"Nd = \",Nd,\" /cmˆ3\" # initializing value of light n doping.\n", + "no=1.5*10e10\n", + "print \"no = \",no,\" /cmˆ3\" # initializing value of intrinsic carrier concentration .\n", + "K=1.38e-23\n", + "print \"K = \",K,\" J/k\" # initializing value of boltzmann constant .\n", + "T=300\n", + "print \"T = \",T,\" K\" # initializing value of temperature .\n", + "e=1.6e-19\n", + "print \"e = \",e,\" columbs\" # initializing value of charge of electrons .\n", + "Er=11.9\n", + "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854e-14\n", + "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "E=Eo*Er\n", + "print \"total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation .\n", + "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", + "print \"Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd)/(no)ˆ2))=\",Vbi,\" eV\" #calculation .\n", + "W=sqrt((2.*E*Vbi/e)*((Nd+Na)/(Na*Nd)))\n", + "print\"W=sqrt((2∗E∗Vbi/e)∗((Nd+Na)/(Na∗Nd))))=\",W,\" cm\" # calculation .\n", + "xn=((W*Na)/(Nd+Na))\n", + "print \"xn=((W∗Na) /(Nd+Na) ) )=\",xn,\"cm\" # calculation .\n", + "xp=((W*Nd)/(Nd+Na))\n", + "print \"xp=((W∗Nd) /(Nd+Na) ) )=\",xp,\"cm\" #calculation .\n", + "Emax=(e*Nd*xn)/E\n", + "print \"Emax=(e∗Nd∗xn)/E)=\",Emax,\" V/cm\" #calculation .\n", + "#the value of W( depletion width) , after calculation is provided wrong in the book,due to this xn,xp ,Emax also differ.(also,the value of Nd+Na substitute in the formula for for xn,xp is wrong )" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_25 pgno: 151" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 400000000000000000 /cmˆ3\n", + "Nd = 4000000000000000 /cmˆ3\n", + "no = 15000000000.0 cmˆ−3\n", + "Emax = 300000 /cmˆ3\n", + "K = 1.38e-23 J/k\n", + "T = 300 K\n", + "e = 1.6e-19 columns\n", + " Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "Built in potential potential ,Vbi=((K∗T/e)∗log ((Na∗Nd)/(no)ˆ2))= 0.765710585218 V\n", + "xn=(E∗Emax) /( e∗Nd) )= 0.0004938871875 cm\n", + "W=(xn(Nd+Na)/Na))= 0.000498826059375 cm\n", + "Vr=(Wˆ2∗e/(2∗E))∗((Na∗Nd)/(Na+Nd))−(Vbi))= 74.058198321 V\n" + ] + } + ], + "source": [ + "#exa 5.25\n", + "Na =4*10**17\n", + "print \"Na = \",Na,\"/cmˆ3\" # initializing value of donor concentration .\n", + "Nd =4*10**15\n", + "print \"Nd = \",Nd,\"/cmˆ3\" # initializing value of light n doping.\n", + "no=1.5*10**10\n", + "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration .\n", + "Emax =300*10**3\n", + "print \"Emax = \",Emax,\"/cmˆ3\" # initializing value of maximum electric field .\n", + "K=1.38*10**-23\n", + "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", + "T=300\n", + "print \"T = \",T,\"K\" # initializing value of temperature .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "Er=11.9\n", + "print \" Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "E=Eo*Er\n", + "print \" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation .\n", + "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", + "print \"Built in potential potential ,Vbi=((K∗T/e)∗log ((Na∗Nd)/(no)ˆ2))=\",Vbi,\" V\" # calculation .\n", + "xn=(E*Emax/(Nd*e))\n", + "print \"xn=(E∗Emax) /( e∗Nd) )=\",xn,\" cm\" #calculation .\n", + "W=(xn*(Nd+Na)/Na)\n", + "print \"W=(xn(Nd+Na)/Na))=\",W,\" cm\" #calculation .\n", + "Vr=((W**2*e/(2*E))*((Na*Nd)/(Na+Nd)))-(Vbi)\n", + "print \"Vr=(Wˆ2∗e/(2∗E))∗((Na∗Nd)/(Na+Nd))−(Vbi))=\",Vr,\" V\" # calculation ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_26 pgno: 152" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 5000000000000000 cmˆ−3\n", + "Nd = 1000000000000000000 cmˆ−3\n", + "e = 1.6e-19 columns\n", + "Vr = 10 V\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "Emax = 1000000 V/cm\n", + "W = 2e-05 cm\n", + "Nd=(Emax∗e)/(W∗e))= 3.29258125e+17 cmˆ−3\n" + ] + } + ], + "source": [ + "#exa 5.26\n", + "Na =5*10**15\n", + "print \"Na = \",Na,\"cmˆ−3\" # initializing value of acceptor concentration .\n", + "Nd =10**18\n", + "print \"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "Vr=10\n", + "print \"Vr = \",Vr,\"V\" # initializing value reverse voltage .\n", + "Er=11.9\n", + "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print \"Eo = \",Eo,\"F/cm\" # initializing value of permittivity of free space .\n", + "E=Eo*Er\n", + "print \" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation .\n", + "Emax=10**6\n", + "print \"Emax = \",Emax,\"V/cm\" # initializing value of maximum electric field .\n", + "W=(2.*Vr/(Emax))\n", + "print \"W = \",W,\"cm\" # calculation .\n", + "Nd=(Emax*E)/(W*e)\n", + "print \"Nd=(Emax∗e)/(W∗e))=\",Nd,\"cmˆ−3\" # calculation " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_27 pgno: 152" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 5000000000000000 cmˆ3\n", + "Nd = 1000000000000000000 cmˆ3\n", + "no = 15000000000.0 cmˆ−3\n", + "Vr1 = 0 V\n", + "Vr2 = 5 V\n", + "A = 3e-05 cmˆ2\n", + "e = 1.6e-19 columns\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "Vt= 0.0259 V\n", + "Built in potential ,Vbi=(Vt∗log ((Na∗Nd)/(no)ˆ2) )= 0.795961750143 V\n", + "Cj1=sqrt((e∗E∗(Aˆ2)/(2∗(Vr1+Vbi))∗((Na∗Nd)/(Na+Nd))))= 6.88597370389e-13 F\n", + "Cj2=sqrt((e∗E∗(Aˆ2)/(2∗(Vr2+Vbi))∗((Na∗Nd)/(Na+Nd))))= 2.55181216611e-13 F\n" + ] + } + ], + "source": [ + "#exa 5.27\n", + "from math import sqrt\n", + "from math import log\n", + "Na =5*10**15\n", + "print \"Na = \",Na,\"cmˆ3\" # initializing value of acceptor concentration .\n", + "Nd =10**18\n", + "print \"Nd = \",Nd,\"cmˆ3\" # initializing value of donor concentration .\n", + "no=1.5*10**10\n", + "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", + "Vr1=0\n", + "print \"Vr1 = \",Vr1,\"V\" # initializing value of built in voltage .\n", + "Vr2=5\n", + "print \"Vr2 = \",Vr2,\"V\" # initializing value of applied reverse voltage .\n", + "A=3*10**-5\n", + "print \"A = \",A,\"cmˆ2\" # initializing value of cross sectional area .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "Er=11.9\n", + "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "E=Eo*Er\n", + "print \"total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation .\n", + "Vt=0.0259\n", + "print \"Vt=\",Vt,\" V\" # initializing the value of thermal voltage .\n", + "Vbi=((Vt)*log((Na*Nd)/(no)**2))\n", + "print \"Built in potential ,Vbi=(Vt∗log ((Na∗Nd)/(no)ˆ2) )= \",Vbi,\" V\" # calculation .\n", + "Cj1=sqrt((e*E*(A**2)/(2*(Vr1+Vbi)))*((Na*Nd)/(Na+Nd)))\n", + "print \"Cj1=sqrt((e∗E∗(Aˆ2)/(2∗(Vr1+Vbi))∗((Na∗Nd)/(Na+Nd))))=\",Cj1,\" F\" #calculation .\n", + "Cj2=sqrt((e*E*(A**2)/(2*(Vr2+Vbi)))*((Na*Nd)/(Na+Nd)))\n", + "print \"Cj2=sqrt((e∗E∗(Aˆ2)/(2∗(Vr2+Vbi))∗((Na∗Nd)/(Na+Nd))))=\",Cj2,\" F\" #calculation .\n", + "# the value of Vr2 use for calculating answer of Cj2 is different than provided in question .\n", + "# I have used the value provided in the solution ( i .e. Vr2=5)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_28 pgno: 153" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 10000000000000000 cmˆ3\n", + "Nd = 50000000000000000 cmˆ3\n", + "no = 15000000000.0 cmˆ−3\n", + "Dn = 25 cmˆ2/sec\n", + "Dp = 10 cmˆ2/sec\n", + "tn = 5e-07 s\n", + "tp = 5e-07 s\n", + "e = 1.6e-19 columns\n", + "Pno=(noˆ2/Nd))= 4500.0 cmˆ−3\n", + "Npo=(noˆ2/Na))= 22500.0 cmˆ−3\n", + "Lp=(sqrt(Dp∗tp)))= 0.0022360679775 cm\n", + "Ln=(sqrt(Dn∗tn)))= 0.00353553390593 cm\n", + "Jo=((e ∗((Dp∗Pno/(Lp) )+(Dn∗Npo) /(Ln) ) ) )= 2.86757820103e-11 A/cmˆ2\n" + ] + } + ], + "source": [ + "#exa 5.28\n", + "from math import sqrt\n", + "Na =1*10**16\n", + "print \"Na = \",Na,\"cmˆ3\" # initializing value of acceptor concentration. \n", + "Nd = 5*10**16\n", + "print \"Nd = \",Nd,\"cmˆ3\" # initializing value of donor concentration .\n", + "no=1.5*10**10\n", + "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration .\n", + "Dn=25\n", + "print \"Dn = \",Dn,\"cmˆ2/sec\" # initializing value of diffusion cofficient on the P side.\n", + "Dp=10\n", + "print \"Dp = \",Dp,\"cmˆ2/sec\" # initializing value of diffusion cofficient on the N side .\n", + "tp =5*10** -7\n", + "print \"tn = \",tp,\"s\" # initializing value of hole lifetime .\n", + "tn =5*10** -7\n", + "print \"tp = \",tn,\"s\" # initializing value of electron lifetime .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "Pno=(no**2/Nd)\n", + "print \"Pno=(noˆ2/Nd))= \",Pno,\"cmˆ−3\" # calculation .\n", + "Npo=(no**2/Na)\n", + "print \"Npo=(noˆ2/Na))= \",Npo,\"cmˆ−3\" # calculation .\n", + "Lp=(sqrt(Dp*tp))\n", + "print \"Lp=(sqrt(Dp∗tp)))= \",Lp,\"cm\" # calculation .\n", + "Ln=(sqrt(Dn*tn))\n", + "print \"Ln=(sqrt(Dn∗tn)))= \",Ln,\"cm\" # calculation .\n", + "Jo=((e*((Dp*Pno/(Lp))+(Dn*Npo)/(Ln))))\n", + "print \"Jo=((e ∗((Dp∗Pno/(Lp) )+(Dn∗Npo) /(Ln) ) ) )= \",Jo,\" A/cmˆ2\" # calculation ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_29 pgno: 154" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 1000000000000000 cmˆ3\n", + "Nd = 1000000000000000 cmˆ3\n", + "no = 15000000000.0 cmˆ−3\n", + "Dn = 50 cmˆ2/sec\n", + "Dp = 20 cmˆ2/sec\n", + "tn = 5e-07 s\n", + "tp = 5e-07 s\n", + "e = 1.6e-19 columns\n", + "Pno=(noˆ2/Nd))= 225000.0 cmˆ−3\n", + "Npo=(noˆ2/Na))= 225000.0 cmˆ−3\n", + "Lp=(sqrt(Dp∗tp)))= 0.00316227766017 cm\n", + "Ln=(sqrt(Dn∗tn)))= 0.005 cm\n", + "Jo=((e ∗((Dp∗Pno/(Lp) )+(Dn∗Npo) /(Ln))))= 5.87683991532e-10 A/cmˆ2\n" + ] + } + ], + "source": [ + "#exa 5.29\n", + "from math import sqrt\n", + "Na =10**15\n", + "print \"Na = \",Na,\"cmˆ3\" # initializing value of acceptor concentration .\n", + "Nd =10**15\n", + "print \"Nd = \",Nd,\"cmˆ3\" # initializing value of donor concentration .\n", + "no=1.5*10**10\n", + "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", + "Dn=50\n", + "print \"Dn = \",Dn,\"cmˆ2/sec\" # initializing value of built in voltage .\n", + "Dp=20\n", + "print \"Dp = \",Dp,\"cmˆ2/sec\" # initializing value of applied reverse voltage .\n", + "tp =5*10** -7\n", + "print \"tn = \",tp,\"s\" # initializing value of hole lifetime .\n", + "tn =5*10** -7\n", + "print \"tp = \",tn,\"s\" # initializing value of electrons lifetime .\n", + "e=1.6*10**-19\n", + "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", + "Pno=(no**2/Nd)\n", + "print \"Pno=(noˆ2/Nd))= \",Pno,\"cmˆ−3\" # calculation .\n", + "Npo=(no**2/Na)\n", + "print \"Npo=(noˆ2/Na))= \",Npo,\"cmˆ−3\" # calculation .\n", + "Lp=(sqrt(Dp*tp))\n", + "print \"Lp=(sqrt(Dp∗tp)))= \",Lp,\"cm\" # calculation .\n", + "Ln=(sqrt(Dn*tn))\n", + "print \"Ln=(sqrt(Dn∗tn)))= \",Ln,\"cm\" # calculation .\n", + "Jo=((e*((Dp*Pno/(Lp))+(Dn*Npo)/(Ln))))\n", + "print \"Jo=((e ∗((Dp∗Pno/(Lp) )+(Dn∗Npo) /(Ln))))=\",Jo,\"A/cmˆ2\" # calculation .\n", + "# the value of tp , tn provided in the question , is different than that provided in the solution.\n", + "# I have used the value ,provided in the solution(i. e . tp=tn =5∗10ˆ7)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_30 pgno: 154" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Eg = -1.1 V\n", + "Vf1 = 0.6 V\n", + "T1 = 300 K\n", + "T2 = 310 K\n", + "Forward voltage for case 2,Vf2=((Eg+Vf1)∗T2)/( T1)+Eg)= 0.583333333333 V\n" + ] + } + ], + "source": [ + "#exa 5.30\n", + "Eg = -1.1\n", + "print \"Eg = \",Eg,\"V\" # initializing value of energy gap .\n", + "Vf1 =0.6\n", + "print \"Vf1 = \",Vf1,\"V\" # initializing value of forward voltage for case 1.\n", + "T1 =300\n", + "print \"T1 = \",T1,\"K\" # initializing value of temperature for case 1.\n", + "T2 =310\n", + "print \"T2 = \",T2,\"K\" # initializing value of temperature for case 2 .\n", + "Vf2=(((Eg+Vf1)*T2)/(T1))-Eg\n", + "print \"Forward voltage for case 2,Vf2=((Eg+Vf1)∗T2)/( T1)+Eg)= \",Vf2,\" V\" # calculation .\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_7_BIPOLAR_JUNCTION_TRANSISTORB.ipynb b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_7_BIPOLAR_JUNCTION_TRANSISTORB.ipynb new file mode 100755 index 00000000..bbe984b6 --- /dev/null +++ b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_7_BIPOLAR_JUNCTION_TRANSISTORB.ipynb @@ -0,0 +1,496 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# chapter 7 BIPOLAR JUNCTION TRANSISTORB" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_1 pgno: 220" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Dnb = 20 cmˆ2/s\n", + "nB = 10000 /cmˆ3\n", + "xB = 1e-06 m\n", + "AB = 0.0001 cmˆ2\n", + "e = 1.6e-19 columns\n", + "Vbe = 0.5 V\n", + "VT = 0.0259 V\n", + "WB = 0.0001 cm\n", + "Magnitude of Io , Io=((e∗AB∗Dnb∗nB)/(WB)))= 3.2e-14 A\n", + "Collector current ,Ic=Io((exp(Vbe/VT))−1))= 7.7484232166e-06 A\n" + ] + } + ], + "source": [ + "#exa 7.1\n", + "from math import exp\n", + "Dnb =20\n", + "print\"Dnb = \",Dnb,\" cmˆ2/s\" #initializiation the value of one of base parametre of NPN transistor .\n", + "nB =10**4\n", + "print\"nB = \",nB,\" /cmˆ3\" # initializiation the value of one of base parametre of NPN transistor .\n", + "xB =1*10**-6\n", + "print\"xB = \",xB,\" m\" # initializiation the value of one of base parametre of NPN transistor .\n", + "AB =10**-4\n", + "print\"AB = \",AB,\" cmˆ2\" #initializiation the value of one of base parametre of NPN transistor .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializiation the value of electronic charge .\n", + "Vbe=0.5\n", + "print\"Vbe = \",Vbe,\" V\" # initializiation the value of base emitter voltage of NPN transistor ..\n", + "VT=0.0259\n", + "print\"VT = \",VT,\" V\" # initializiation the value of threshold voltage .\n", + "WB=10**-4\n", + "print\"WB = \",WB,\" cm\" # initializiation the value of base width of NPN transistor .\n", + "Io=((e*AB*Dnb*nB)/(WB))\n", + "print\"Magnitude of Io , Io=((e∗AB∗Dnb∗nB)/(WB)))=\",Io,\" A\"# calculation\n", + "Ic=Io*(exp(Vbe/VT)-1)\n", + "print\"Collector current ,Ic=Io((exp(Vbe/VT))−1))=\",Ic,\" A\"# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_2 pgno: 221" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NE = 500000000000000000 /cmˆ3\n", + "NB = 10000000000000000 /cmˆ3\n", + "NC = 1000000000000000 /cmˆ3\n", + "WB = 8e-05 cm\n", + "no = 15000000000.0 cmˆ−3\n", + "Number of Majority holes in the emitter ,pEO=(noˆ2/NE) )= 450.0 /cmˆ3\n", + "Number of Majority holes in the base,nBO=(no ˆ2/NB))= 22500.0 /cmˆ3\n", + "Number of Majority holes in the collector ,pCO=(noˆ2/NC) )= 225000.0 /cmˆ3\n" + ] + } + ], + "source": [ + "#exa 7.2\n", + "NE =5*10**17\n", + "print\"NE = \",NE,\" /cmˆ3\" # initializiation the value of doping concentration in the emitter\n", + "NB =10**16\n", + "print\"NB = \",NB,\" /cmˆ3\" # initializiation the value of doping concentration in the base.\n", + "NC =10**15\n", + "print\"NC = \",NC,\" /cmˆ3\" # initializiation the value of doping concentration in the collector .\n", + "WB =0.8*10**-4\n", + "print\"WB = \",WB,\" cm\" # initializiation the value of base width of NPN transistor .\n", + "no=1.5*10**10\n", + "print\"no = \",no,\"cmˆ−3\" # initializing the intrinsic carrier concentration .\n", + "pEO=(no**2/NE)\n", + "print\"Number of Majority holes in the emitter ,pEO=(noˆ2/NE) )=\",pEO,\" /cmˆ3\"# calculationnBO=(no^2/NB)\n", + "nBO=(no**2/NB)\n", + "print\"Number of Majority holes in the base,nBO=(no ˆ2/NB))=\",nBO,\" /cmˆ3\"#calculation\n", + "pCO=(no**2/NC)\n", + "print\"Number of Majority holes in the collector ,pCO=(noˆ2/NC) )=\",pCO,\" /cmˆ3\"# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_3 pgno: 221" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NE = 500000000000000000 /cmˆ3\n", + "NB = 10000000000000000 /cmˆ3\n", + "NC = 1000000000000000 /cmˆ3\n", + "WB = 8e-05 cm\n", + "no = 15000000000.0 cmˆ−3\n", + "VT = 0.0259 V\n", + "VJ=Vbe = 0.6258 V\n", + "Number of Majority holes in the emitter ,pEO=(noˆ2/NE) )= 450.0 /cmˆ3\n", + "Number of Majority holes in the base,nBO=(no ˆ2/NB))= 22500.0 /cmˆ3\n", + "Number of Majority holes in the collector ,pCO=(noˆ2/NC) )= 225000.0 /cmˆ3\n", + "pE(O)=pEO∗( exp (VJ/VT) ) )= 1.40186506034e+13 /cmˆ3 \n", + "nB=(nBO∗( exp (VJ/VT) ) ) )= 7.00932530169e+14 /cmˆ3\n" + ] + } + ], + "source": [ + "#exa 7.3\n", + "from math import exp\n", + "NE =5*10**17\n", + "print\"NE = \",NE,\" /cmˆ3\" # initializiation of doping concentration in the emitter .\n", + "NB =10**16\n", + "print\"NB = \",NB,\" /cmˆ3\" # initializiation of doping concentration in the base .\n", + "NC =10**15\n", + "print\"NC = \",NC,\" /cmˆ3\" # initializiation of doping concentration in the collector .\n", + "WB =0.8*10**-4\n", + "print\"WB = \",WB,\" cm\" # initializiation the value of base width of NPN transistor .\n", + "no=1.5*10**10\n", + "print\"no = \",no,\"cmˆ−3\" # initializing the value of intrinsic carrier concentration .\n", + "VT=0.0259\n", + "print\"VT = \",VT,\" V\" # initializiation the value of threshold voltage .\n", + "VJ=0.6258\n", + "print\"VJ=Vbe = \",VJ,\" V\" # initializiation the value of base emitter voltage .\n", + "pEO=(no**2/NE)\n", + "print\"Number of Majority holes in the emitter ,pEO=(noˆ2/NE) )=\",pEO,\" /cmˆ3\"# calculation\n", + "nBO=(no**2/NB)\n", + "print\"Number of Majority holes in the base,nBO=(no ˆ2/NB))=\",nBO,\" /cmˆ3\"#calculation\n", + "pCO=(no**2/NC)\n", + "print\"Number of Majority holes in the collector ,pCO=(noˆ2/NC) )=\",pCO,\" /cmˆ3\"# calculation\n", + "pE=pEO*(exp(VJ/VT))\n", + "print\"pE(O)=pEO∗( exp (VJ/VT) ) )=\",pE, \"/cmˆ3 \" # calculation\n", + "nB=nBO*(exp(VJ/VT))\n", + "print\"nB=(nBO∗( exp (VJ/VT) ) ) )=\",nB,\"/cmˆ3\" # calculation\n", + "#the answer provided in the book for pE,nB is some what different than actual calculated ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_1 pgno: 222" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Db = 10 cmˆ2/s\n", + "Bt = 0.95\n", + "tb = 1e-07 s\n", + "Lp=(sqrt(Db∗tb)))= 0.001 cm\n", + "WB=(Lp∗( acosh (1/Bt) ) )= 0.000323036439272 cm\n" + ] + } + ], + "source": [ + "#exa 7.5\n", + "from math import sqrt\n", + "from math import acosh\n", + "Db=10\n", + "print\"Db = \",Db,\" cmˆ2/s\" # initializiation the value of one of parametere of the transistor .\n", + "Bt =0.95\n", + "print\"Bt = \",Bt # initializiation the value of base transport factor of the transistor.\n", + "tb =10**-7\n", + "print\"tb = \",tb,\" s\" # initializiation the value of one of parametere of the transistor.\n", + "Lp=(sqrt(Db*tb))\n", + "print\"Lp=(sqrt(Db∗tb)))=\",Lp,\" cm\"# calculation\n", + "WB=(Lp*(acosh(1/Bt)))\n", + "print\"WB=(Lp∗( acosh (1/Bt) ) )=\",WB,\"cm\" #calculation," + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_7 pgno: 224" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Jro = 1e-09 A/cmˆ2\n", + "Jo = 1e-12 A/cmˆ2\n", + "Vbe = 0.5 V\n", + "VT = 0.0259 V\n", + "delta (recombination factor)=(1+((Jro/Jo)∗(exp((−Vbe) /(2∗VT) ) ) ) )ˆ−1)= 0.939616412003\n" + ] + } + ], + "source": [ + "#exa 7.7\n", + "from math import exp\n", + "Jro =10**-9\n", + "print\"Jro = \",Jro,\" A/cmˆ2\" # initializiation the value of recombination current density .\n", + "Jo =10**-12\n", + "print\"Jo = \",Jo,\" A/cmˆ2\" # initializiation the value of reverse saturation current density.\n", + "Vbe =0.5\n", + "print\"Vbe = \",Vbe,\" V\" # initializiation the value of base emitter voltage .\n", + "VT =0.0259\n", + "print\"VT = \",VT,\" V\" # initializiation the value of threshold voltage .\n", + "delta=(1+((Jro/Jo)*(exp((-Vbe)/(2*VT)))))**-1\n", + "print\"delta (recombination factor)=(1+((Jro/Jo)∗(exp((−Vbe) /(2∗VT) ) ) ) )ˆ−1)=\",delta # calculation ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_8 pgno: 224" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NE = 100000000000000000 /cmˆ3\n", + "NB = 1000000000000000 /cmˆ3\n", + "WE = 6e-05 cm\n", + "WB = 8e-05 cm\n", + "no = 15000000000.0 cmˆ−3\n", + "e = 1.6e-19 columns\n", + "DE = 15 cmˆ2/s\n", + "DB = 20 cmˆ2/s\n", + "tE = 2e-07 s\n", + "tB = 1e-07 s\n", + "Vbe = 0.6 V\n", + "VT = 0.0259 V\n", + "Jro = 2e-08 A/cmˆ2\n", + "LE=(sqrt(DE∗tE)))= 0.00173205080757 cm\n", + "LB=(sqrt(DB∗tB)))= 0.00141421356237 cm\n", + "Number of Majority holes in the emitter ,pEO=(noˆ2/NE) )= 2250.0 /cmˆ3\n", + "Number of Majority holes in the base,nBO=(no ˆ2/NB))= 225000.0 /cmˆ3\n", + "Emitter injection efficiency ,Y=(1+((NB∗DE∗LB) /(NE∗DB∗LE)∗(tanh(WB/LB)/tanh(WE/LE)))) )= 0.990105536375\n", + "Base transport factor ,Bt=(cosh(WB/LB))ˆ−1)= 0.998402130561\n", + "Reverse saturation current Density , Jro=((e∗DB∗n BO)/(LB∗tanh(WB/LB)))) = 9.00959795262e-09 A/cmˆ2\n", + "delta(recombination factor)=(1+((Jro/Jo)∗(exp((−Vbe)/(2∗VT)))))ˆ−1)= 0.999979304421 A\n", + "common base current amplification factor ,(alpha=Bt∗delta∗Y)= 0.988503018931\n", + "common emitter current amplification factor ,Beta=(a/(1−a) ) )= 85.9793551861\n" + ] + } + ], + "source": [ + "#exa 7.8\n", + "from math import sqrt\n", + "from math import cosh\n", + "from math import tanh\n", + "NE =1*10**17\n", + "print\"NE = \",NE,\" /cmˆ3\" # initializiation the value of doping concentration of emitter in the NPN transistor .\n", + "NB =10**15\n", + "print\"NB = \",NB,\" /cmˆ3\" # initializiation the value of doping concentration of base in the NPN transistor .\n", + "WE =0.6*10**-4\n", + "print\"WE = \",WE,\" cm\" # initializiation the value of one of parametre of the transistor.\n", + "WB =0.8*10**-4\n", + "print\"WB = \",WB,\" cm\" # initializiation the value of one of parametre of the transistor.\n", + "no=1.5*10**10\n", + "print\"no = \",no,\"cmˆ−3\" # initializing the value of intrinsic carrier concentration .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializiation the value of electronic charge\n", + "DE=15\n", + "print\"DE = \",DE,\" cmˆ2/s\" # initializiation the value of one of parametere of the transistor .\n", + "DB=20\n", + "print\"DB = \",DB,\" cmˆ2/s\" #initializiation the value of one of parametere of the transistor .\n", + "tE =0.2*10**-6\n", + "print\"tE = \",tE,\" s\" # initializiation the value of one of parametere of the transistor.\n", + "tB =0.1*10**-6\n", + "print\"tB = \",tB,\" s\" # initializiation the value of one of parametere of the transistor.\n", + "Vbe=0.60\n", + "print\"Vbe = \",Vbe,\" V\" # initializiation the value of base emitter voltage .\n", + "VT=0.0259\n", + "print\"VT = \",VT,\" V\" # initializiation the value of threshold voltage .\n", + "Jro =2*10**-8\n", + "print\"Jro = \",Jro,\" A/cmˆ2\" # initializiation the value of recombination current density .\n", + "LE=(sqrt(DE*tE))\n", + "print\"LE=(sqrt(DE∗tE)))=\",LE,\" cm\"#calculation\n", + "LB=(sqrt(DB*tB))\n", + "print\"LB=(sqrt(DB∗tB)))=\",LB,\" cm\"#calculation\n", + "pEO=(no**2/NE)\n", + "print\"Number of Majority holes in the emitter ,pEO=(noˆ2/NE) )=\",pEO,\" /cmˆ3\"# calculation\n", + "nBO=(no**2/NB)\n", + "print\"Number of Majority holes in the base,nBO=(no ˆ2/NB))=\",nBO,\" /cmˆ3\"#calculation\n", + "Y=(1+(((NB*DE*LB)/(NE*DB*LE))*((tanh(WB/LB)/tanh(WE/ LE)))))**(-1)\n", + "print\"Emitter injection efficiency ,Y=(1+((NB∗DE∗LB) /(NE∗DB∗LE)∗(tanh(WB/LB)/tanh(WE/LE)))) )=\",Y # calculation\n", + "Bt=(cosh(WB/LB))**-1\n", + "print\"Base transport factor ,Bt=(cosh(WB/LB))ˆ−1)=\",Bt# calculation\n", + "Jo=((e*DB*nBO)/(LB*tanh(WB/LB)))\n", + "print\"Reverse saturation current Density , Jro=((e∗DB∗n BO)/(LB∗tanh(WB/LB)))) = \",Jo, \"A/cmˆ2\" # calculation\n", + "delta=(1+((Jro/Jo)*(exp((-Vbe)/(2*VT)))))**-1\n", + "print\"delta(recombination factor)=(1+((Jro/Jo)∗(exp((−Vbe)/(2∗VT)))))ˆ−1)=\",delta,\" A\"# calculation\n", + "a=Bt*delta*Y\n", + "print\"common base current amplification factor ,(alpha=Bt∗delta∗Y)=\",a # calculation\n", + "B=(a/(1-a))\n", + "print\"common emitter current amplification factor ,Beta=(a/(1−a) ) )=\",B # calculation\n", + "#the value of NE provided in the question is different than used in the solution .\n", + "#I have used the value (while solving) provided in the question ( i . e NE=10ˆ17/cmˆ3) " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_9 pgno: 225" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NB = 5e+16 /cmˆ3\n", + "NC = 2e+15 /cmˆ3\n", + "WBm = 6e-05 cm\n", + "e = 1.6e-19 columns\n", + "VCB1 = 1 V\n", + "VCB2 = 4 V\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "no = 15000000000.0 cmˆ−3\n", + "VT = 0.0259 V\n", + " VBI=VT∗(log((NB∗NC)/noˆ2))= 0.694640354303 V\n", + "WBS=((2∗Eo∗Er∗(VBI+VCB1)/e)∗(NC/NB)∗(1/(NC+NB)))ˆ(1/2))= 4.14348090604e-06 cm\n", + "Neutral base width for VCB1,WB( neutral )=WBm− WBS1= 5.5856519094e-05 cm\n", + "WBS=((2∗Eo∗Er∗(VBI+VCB2)/e)∗(NC/NB)∗(1/(NC+NB) ))ˆ(1/2))= 1.0 cm\n", + "Neutral base width for VCB2,WB( neutral )=WBm−WBS2= -0.99994 cm\n", + "change in the neutal base width ,deltaWb(neutral )=Wb1−Wb2= 0.999995856519 cm\n" + ] + } + ], + "source": [ + "#exa 7.9\n", + "from math import log\n", + "NB =5e16\n", + "print\"NB = \",NB,\" /cmˆ3\" # initializiation the doping concentration in the base .\n", + "NC =2e15\n", + "print\"NC = \",NC,\" /cmˆ3\" # initializiation the doping concentration in the collector .\n", + "WBm =0.6e-4\n", + "print\"WBm = \",WBm,\" cm\" # initializiation the value of actual base width .\n", + "e=1.6e-19\n", + "print\"e = \",e,\" columns\" # initializiation the value of electronic charge .\n", + "VCB1=1\n", + "print\"VCB1 = \",VCB1,\" V\" # initializiation the initial value of collector base voltage .\n", + "VCB2=4\n", + "print\"VCB2 = \",VCB2,\" V\" # initializiation the final value of collector base voltage.\n", + "Er=11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854e-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "no=1.5e10\n", + "print\"no = \",no,\"cmˆ−3\" # initializing the value of intrinsic charge carriers\n", + "VT=0.0259\n", + "print\"VT = \",VT,\" V\" # initializiation the value of threshold voltage .\n", + "VBI=VT*(log((NB*NC)/no**2))\n", + "print\" VBI=VT∗(log((NB∗NC)/noˆ2))=\",VBI,\" V\" # calculation\n", + "WBS1=((2*Eo*Er*(VBI+VCB1)/e)*(NC/NB)*(1/(NC+NB)))**(1./2.)\n", + "print\"WBS=((2∗Eo∗Er∗(VBI+VCB1)/e)∗(NC/NB)∗(1/(NC+NB)))ˆ(1/2))=\",WBS1,\" cm\"#calculation\n", + "Wb1=WBm-WBS1\n", + "print\"Neutral base width for VCB1,WB( neutral )=WBm− WBS1=\",Wb1,\" cm\"# calculation\n", + "WBS2=((2*Eo*Er*(VBI+VCB2)/e)*(NC/NB)*(1/(NC+NB)))**(1/2)\n", + "print\"WBS=((2∗Eo∗Er∗(VBI+VCB2)/e)∗(NC/NB)∗(1/(NC+NB) ))ˆ(1/2))=\",WBS2,\" cm\"#calculation\n", + "Wb2=WBm-WBS2\n", + "print\"Neutral base width for VCB2,WB( neutral )=WBm−WBS2=\",Wb2,\" cm\"# calculation\n", + "deltaWbneutral=Wb1-Wb2\n", + "print\"change in the neutal base width ,deltaWb(neutral )=Wb1−Wb2=\",deltaWbneutral,\" cm\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_10 pgno: 226" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ro = 5000000.0 ohm\n", + "Vce1 = 7 V\n", + "Vce2 = 1 V\n", + "change in the collector −emitter voltage , Vce1−Vce2 = 6 V\n", + "change in the collector current , Ic=(Vce/ro))= 1.2e-06 A\n" + ] + } + ], + "source": [ + "#exa 7.10\n", + "ro=500*10e3\n", + "print\"ro = \",ro,\" ohm\" # initializiation the value of output resistance .\n", + "Vce1 =7\n", + "print\"Vce1 = \",Vce1,\" V\" # initializiation the initial value of collector emitter voltage .\n", + "Vce2 =1\n", + "print\"Vce2 = \",Vce2,\" V\" # initializiation the final value of collector emitter voltage .\n", + "Vce=6\n", + "print\"change in the collector −emitter voltage , Vce1−Vce2 = \",Vce,\" V\" # calculation .\n", + "Ic=(Vce/ro)\n", + "print\"change in the collector current , Ic=(Vce/ro))=\" ,Ic,\" A\"# calculation," + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_8_THE_FIELD_EFFECT_TRANSISTOR.ipynb b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_8_THE_FIELD_EFFECT_TRANSISTOR.ipynb new file mode 100755 index 00000000..0c2e0420 --- /dev/null +++ b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_8_THE_FIELD_EFFECT_TRANSISTOR.ipynb @@ -0,0 +1,806 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8 THE FIELD EFFECT TRANSISTOR" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_1 pgno: 267" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd= 10000000000000000 /cmˆ3\n", + "Er= 3.9\n", + "Eo = 8.854e-14 F/cm\n", + "W = 5e-05 cm\n", + "L = 0.0001 cm\n", + "tox = 4e-06 cm\n", + " total permittivity ,E=Eo∗Er= 3.45306e-13 F/cm\n", + "Oxide capacitance ,Cox=(E∗W∗L)/tox)= 4.316325e-16 F\n", + "Capacitance per unit area ,Co=(Cox/(W∗L)))= 8.63265e-08 F/cmˆ2\n" + ] + } + ], + "source": [ + "#exa 8.1\n", + "Nd =10**16\n", + "print\"Nd= \",Nd,\" /cmˆ3\" # initializing value of donor ion concentration .\n", + "Er =3.9\n", + "print\"Er= \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "W=0.5*10**-4\n", + "print\"W = \",W,\" cm\" # initializing value of width of p−substrate .\n", + "L=10**-4\n", + "print\"L = \",L,\" cm\" # initializing value of length of p−substrate .\n", + "tox =400*10**-8\n", + "print\"tox = \",tox,\" cm\" # initializing value of thickness of p−substrate .\n", + "E=Eo*Er\n", + "print\" total permittivity ,E=Eo∗Er=\",E,\" F/cm\"# calculation\n", + "Cox=(E*W*L)/tox\n", + "print\"Oxide capacitance ,Cox=(E∗W∗L)/tox)=\",Cox,\" F\"# calculation\n", + "Co=(Cox/(W*L))\n", + "print\"Capacitance per unit area ,Co=(Cox/(W∗L)))=\",Co,\" F/cmˆ2\"# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_2 pgno: 267" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 100000000000000000 /cmˆ3\n", + "Vt = 0.0259 V\n", + "e = 1.6e-19 columns\n", + "ni = 15000000000.0 /cmˆ3\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "Vs=Vt∗log(Na/ni))= 0.40695713106 V\n", + " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "maximum depletion width ,Wd(max)=Sqrt(4∗E∗Vs/(e∗Na)))= 1.03535092381e-05 cm\n" + ] + } + ], + "source": [ + "#exa 8.2\n", + "from math import log\n", + "from math import sqrt\n", + "Na =10**17\n", + "print\"Na = \",Na,\" /cmˆ3\" # initializing value of acceptor ion concentration .\n", + "Vt =0.0259\n", + "print\"Vt = \",Vt,\"V\" # initializing value of thermal voltage .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "ni=1.5*10**10\n", + "print\"ni = \",ni,\"/cmˆ3\" #initializing value of intrinsic carrier concentration .\n", + "Er=11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "Vs=Vt*log(Na/ni)\n", + "print\"Vs=Vt∗log(Na/ni))=\",Vs,\" V\"#calculation\n", + "E=Eo*Er\n", + "print\" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation\n", + "Wd=sqrt(4*E*Vs/(e*Na))\n", + "print\"maximum depletion width ,Wd(max)=Sqrt(4∗E∗Vs/(e∗Na)))=\",Wd,\" cm\"#calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_3 pgno: 268" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 3000000000000000000 /cmˆ3\n", + "Vt = 0.0259 V\n", + "e = 1.6e-19 columns\n", + "ni = 15000000000.0 /cmˆ3\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "Vs=Vt∗log(Nd/ni))= 0.495048143245 V\n", + " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "maximum depletion width ,Wd(max)=Sqrt(4∗E∗Vs/(e∗Nd)))= 2.08485729922e-06 cm\n" + ] + } + ], + "source": [ + "#exa 8.3\n", + "from math import sqrt\n", + "from math import log\n", + "Nd =3*10**18\n", + "print\"Nd = \",Nd,\" /cmˆ3\" # initializing value of acceptor ion concentration .\n", + "Vt =0.0259\n", + "print\"Vt = \",Vt,\"V\" # initializing value of thermal voltage .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "ni=1.5*10**10\n", + "print\"ni = \",ni,\"/cmˆ3\" #initializing value of intrinsic carrier concentration .\n", + "Er=11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "Vs=Vt*log(Nd/ni)\n", + "print\"Vs=Vt∗log(Nd/ni))=\",Vs,\" V\"# calculation\n", + "E=Eo*Er\n", + "print\" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation\n", + "Wd=sqrt(4*E*Vs/(e*Nd))\n", + "print\"maximum depletion width ,Wd(max)=Sqrt(4∗E∗Vs/(e∗Nd)))=\",Wd,\" cm\"#calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_5 pgno: 269" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Vm = 3.2 V\n", + "X = 3.25 V\n", + "Nd = 20000000000000000 /cmˆ3\n", + "ni = 15000000000.0 V\n", + "Vt = 0.0259 V\n", + "Eg = 1.12 V\n", + "Vfp=(Vt∗log(Nd/ni))= 0.365272689128 V\n", + "Vms=−(Vm+(Eg/2)+Vfp−Vm)= -0.925272689128 V\n" + ] + } + ], + "source": [ + "#exa 8.5\n", + "from math import log\n", + "Vm =3.2\n", + "print\"Vm = \",Vm,\" V\" # initializing value of modified metal work function .\n", + "X=3.25\n", + "print\"X = \",X,\" V\" # initializing value of modified electron affinity .\n", + "Nd =2*10**16\n", + "print\"Nd = \",Nd,\" /cmˆ3\" # initializing value of donor concentration .\n", + "ni=1.5*10**10\n", + "print\"ni = \",ni,\" V\" # initializing value of intrinsic carrier concentration .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\"V\" # initializing value of thermal voltage .\n", + "Eg=1.12\n", + "print\"Eg = \",Eg,\"V\" # initializing value of energy gap .\n", + "Vfp=(Vt*log(Nd/ni))\n", + "print\"Vfp=(Vt∗log(Nd/ni))=\",Vfp,\" V\" # calculation .\n", + "Vms=-(Vm+(Eg/2)+Vfp-Vm)\n", + "print\"Vms=−(Vm+(Eg/2)+Vfp−Vm)=\",Vms,\" V\" # calculation ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_7 pgno: 270" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 10000000000000000 /cmˆ3\n", + "Vms = -1.12 V\n", + "Er = 3.9\n", + "Eo = 8.854e-14 F/cm\n", + "tox = 2e-06 cm\n", + "Qss = 2.5e-08 columbs/cmˆ2\n", + "Total permittivity ,Eox=Eo∗Er= 3.45306e-13 F/cm\n", + "Capacitance per unit area ,Co=(E/tox))= 1.72653e-07 F/cmˆ2\n", + " Flat band voltage , Vfb=(Vms−(Qss/Co) ) )= -1.26479910572 V\n" + ] + } + ], + "source": [ + "#exa 8.7\n", + "Nd =10**16\n", + "print\"Nd = \",Nd,\" /cmˆ3\" # initializing value of donor ion concentration .\n", + "Vms = -1.12\n", + "print\"Vms = \",Vms,\" V\" # initializing value of metal semiconductor work function difference .\n", + "Er =3.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "tox =200*10**-8\n", + "print\"tox = \",tox,\" cm\" # initializing value of thickness of p−type substrate .\n", + "Qss =2.5*10**-8\n", + "print\"Qss = \",Qss,\" columbs/cmˆ2\" # initializing value of charge density on semiconductor surface .\n", + "Eox=Eo*Er\n", + "print\"Total permittivity ,Eox=Eo∗Er=\",Eox,\" F/cm\"# calculation\n", + "Co=(Eox/tox)\n", + "print\"Capacitance per unit area ,Co=(E/tox))=\",Co,\" F/cmˆ2\"# calculation\n", + "Vfb=(Vms-(Qss/Co))\n", + "print\" Flat band voltage , Vfb=(Vms−(Qss/Co) ) )=\",Vfb,\" V\"# calculation\n", + "#the answer for Co after calculation is provided wrong in the book " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_9 pgno: 271" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 30000000000000000 /cmˆ3\n", + "Vms = -1.12 V\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "ni = 15000000000.0 cmˆ−3\n", + "e = 1.6e-19 columns\n", + "tox = 3e-06 cm\n", + "Vfb = -1.12 V\n", + "Qss = 100000000000 electronic charge columns/cmˆ2\n", + "Vt = 0.0259 eV\n", + "er = 3.9\n", + "total permittivity ,Eox=Eo∗Er= 1.053626e-12 F/cm\n", + "Potential ,Vfp=Vt∗(log(Na/(ni))))= 0.375774235428 V\n", + "Maximum depletion width ,Wd=sqrt ((4∗E∗Vs)/(e∗Nd)))= 1.81641933617e-05 cm\n", + "Over all maximum depletion width ,QDmax=(e∗Na∗ Wd) )= 8.71881281361e-08 columns/cmˆ2\n", + "Threshold Voltage ,VT=(((QDmax−1.6∗10ˆ−8)∗tox)/(er∗Eo),(2∗Vfp+Vfb)= 0.250027108378 V\n" + ] + } + ], + "source": [ + "#exa 8.9\n", + "from math import log\n", + "Na =3*10**16\n", + "print\"Na = \",Na,\" /cmˆ3\" # initializing value of acceptor ion concentration .\n", + "Vms = -1.12\n", + "print\"Vms = \",Vms,\"V\" # initializing value of metal semiconductor work function difference .\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "ni=1.5*10**10\n", + "print\"ni = \",ni,\"cmˆ−3\" # initializing value of intrinsic concentration of electrons .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "tox =300*10**-8\n", + "print\"tox = \",tox,\" cm\" # initializing value of thickness of p−type substrate .\n", + "Vfb=-1.12\n", + "print\"Vfb = \",Vfb,\" V\" # initializing value of flat band voltage .\n", + "Qss=10**11\n", + "print\"Qss = \",Qss,\" electronic charge columns/cmˆ2\" # initializing value of charge density on semiconductor surface .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "er=3.9\n", + "print\"er = \",er # initializing value of relative dielectric permittivity constant\n", + "Eox=Eo*Er\n", + "print\"total permittivity ,Eox=Eo∗Er=\",Eox,\" F/cm\"# calculation\n", + "Vfp=Vt*(log(Na/(ni)))\n", + "print\"Potential ,Vfp=Vt∗(log(Na/(ni))))=\",Vfp,\" V\"#calculation\n", + "Wd=sqrt((4*Eox*Vfp)/(e*Na))\n", + "print\"Maximum depletion width ,Wd=sqrt ((4∗E∗Vs)/(e∗Nd)))=\",Wd,\" cm\"#calculation\n", + "QDmax=(e*Na*Wd)\n", + "print\"Over all maximum depletion width ,QDmax=(e∗Na∗ Wd) )=\",QDmax,\" columns/cmˆ2\" # calculation\n", + "VT=(((QDmax -1.6*10**-8)*tox)/(er*Eo))+(2*Vfp+Vfb)\n", + "print \"Threshold Voltage ,VT=(((QDmax−1.6∗10ˆ−8)∗tox)/(er∗Eo),(2∗Vfp+Vfb)=\",VT,\" V\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_10 pgno: 271" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "L = 0.000125 cm\n", + "un = 600 cmˆ2/V−s\n", + "Co = 6.9e-09 F/cmˆ2\n", + "VT = 0.6 V\n", + "Vgs = 4 V\n", + "W = 0.0012 cm\n", + "Drain current ,Id=((Co∗un∗W)/(L)∗((Vgs−VT)ˆ2/(2)))= 0.00022972032 A\n" + ] + } + ], + "source": [ + "#exa 8.10\n", + "L=1.25*10**-4\n", + "print\"L = \",L,\" cm\" # initializing value of length of channel .\n", + "un =600\n", + "print\"un = \",un,\"cmˆ2/V−s\" # initializing value of mobility of n−channel MOS transistor .\n", + "Co =6.9*10**-9\n", + "print\"Co = \",Co,\"F/cmˆ2\" # initializing value of capacitance per unit area .\n", + "VT =0.60\n", + "print\"VT = \",VT,\" V\" # initializing value of threshold Voltage .\n", + "Vgs=4\n", + "print\"Vgs = \",Vgs,\" V\" # initializing value of gate to source voltage .\n", + "W=12*10**-4\n", + "print\"W = \",W,\"cm\" # initializing value of width of channel .\n", + "Id=((Co*un*W)/(L)*((Vgs-VT)**2/(2)))\n", + "print\"Drain current ,Id=((Co∗un∗W)/(L)∗((Vgs−VT)ˆ2/(2)))=\",Id,\" A\"#calculation .\n", + "#The answer provided in the book (for Id) is wrong as the value of mobility used for solution is different than provided in the question and also value of (Vgs−Vt) is put wrong in the solution than given in the book .\n", + "#I have used the value given in the question i.e. answer differ ." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_13 pgno: 273" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na = 200000000000000000 /cmˆ3\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "ni = 15000000000.0 cmˆ−3\n", + "e = 1.6e-19 columns\n", + "tox = 4e-06 cm\n", + "Vt = 0.0259 eV\n", + "er = 3.9\n", + "Potential ,Vfp=Vt∗(log(Na/(ni))))= 0.424909643036 V\n", + "Depletion width ,Wd=sqrt ((4∗Er∗Eo∗Vs)/(e∗Nd)))= 7.48077408723e-06 cm\n", + "Minimum Capacitance,CTmin=(er∗Eo/((er/Er)∗(Wd)+(tox)))= 5.35218545918e-08 F/cmˆ2\n", + "Flat band capacitance ,CFB=((er∗Eo) /((( er/Er)∗sqrt(Vt∗Er∗Eo/(e∗Na))))+(tox))= 8.02543256028e-08 F/ cmˆ2\n" + ] + } + ], + "source": [ + "#exa 8.13\n", + "from math import sqrt\n", + "from math import log\n", + "Na =2*10**17\n", + "print\"Na = \",Na,\" /cmˆ3\" # initializing value of acceptor ion concentration .\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "ni=1.5*10**10\n", + "print\"ni = \",ni,\"cmˆ−3\" # initializing value of intrinsic concentration of electrons .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "tox =400*10**-8\n", + "print\"tox = \",tox,\" cm\" # initializing value of thickness of p−type substrate .\n", + "Vt=0.0259\n", + "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", + "er=3.9\n", + "print\"er = \",er # initializing value of relative dielectric permittivity constant\n", + "Vfp=Vt*(log(Na/(ni)))\n", + "print\"Potential ,Vfp=Vt∗(log(Na/(ni))))=\",Vfp,\" V\"#calculation\n", + "Wd=sqrt((4*Er*Eo*Vfp)/(e*Na))\n", + "print\"Depletion width ,Wd=sqrt ((4∗Er∗Eo∗Vs)/(e∗Nd)))=\",Wd,\" cm\"# calculation\n", + "CTmin=(er*Eo/(((er/Er)*(Wd))+(tox)))\n", + "print\"Minimum Capacitance,CTmin=(er∗Eo/((er/Er)∗(Wd)+(tox)))=\",CTmin,\" F/cmˆ2\"#calculation\n", + "CFB=((er*Eo)/((((er/Er)*sqrt(Vt*Er*Eo/(e*Na))))+(tox)))\n", + "print\"Flat band capacitance ,CFB=((er∗Eo) /((( er/Er)∗sqrt(Vt∗Er∗Eo/(e∗Na))))+(tox))=\",CFB,\" F/ cmˆ2\"# calculation\n", + "#the value of Na (acceptor ion concentration) and tox ( thickness of p−type substrate ) is provided different in the question than used in the solution .\n", + "#I have used the value provided in the solution .( i . e Na=2∗10ˆ17 and tox =400∗10ˆ8cm)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_14 pgno: 274" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Vfb = -1.0 V\n", + "Vms = -0.9 V\n", + "tox = 2e-06 cm\n", + "et = 3.9\n", + "eo = 8.85e-14 F/cm\n", + "e = 1.6e-19 columns\n", + "eox=(eo∗et))= 3.4515e-13 F/cmˆ2\n", + "Oxide capacitance ,Cox=(eox/tox))= 1.72575e-07 F/cmˆ2\n", + "charge density on semiconductor surface ,Qss=(( Vms−Vfb)∗Cox))= 1.72575e-08 C/cmˆ2\n", + "charge density on semiconductor surface (in terms of number of charges) ,Qss∗=Qss/e)= 1.07859375e+11 electrons/cmˆ2\n" + ] + } + ], + "source": [ + "#exa 8.14\n", + "Vfb = -1.0\n", + "print\"Vfb = \",Vfb,\" V\" # initializing value of flat band voltage .\n", + "Vms = -0.9\n", + "print\"Vms = \",Vms,\"V\" # initializing value of metal semiconductor work function difference .\n", + "tox =200*10**-8\n", + "print\"tox = \",tox,\" cm\" # initializing value of gate oxide thickness .\n", + "et =3.9\n", + "print\"et = \",et # initializing value of relative permittivity .\n", + "eo =8.85*10**-14\n", + "print\"eo = \",eo,\"F/cm\" # initializing value of free space permittivity .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "eox=(eo*et)\n", + "print\"eox=(eo∗et))=\",eox,\" F/cmˆ2\" # calculation\n", + "Cox=(eox/tox)\n", + "print\"Oxide capacitance ,Cox=(eox/tox))=\",Cox,\" F/cmˆ2\"# calculation\n", + "Qss=((Vms-Vfb)*Cox)\n", + "print\"charge density on semiconductor surface ,Qss=(( Vms−Vfb)∗Cox))=\",Qss,\" C/cmˆ2\" # calculation\n", + "Qss1=Qss/e\n", + "print\"charge density on semiconductor surface (in terms of number of charges) ,Qss∗=Qss/e)=\",Qss1,\" electrons/cmˆ2\" #calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_15 pgno: 274" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "L = 3e-06 meter\n", + "un = 800.0 cmˆ2/V−s\n", + "VT = 1.0 V\n", + "Vgs = 0 V\n", + "tox = 5e-06 cm\n", + "et = 3.9\n", + "eo = 8.85e-14 F/cm\n", + "W = 3e-05 m\n", + "eox=(eo∗et))= 3.4515e-13 F/cmˆ2\n", + "Drain current ,Id=((eox∗un∗W)/(tox∗L)∗((Vgs−VT)ˆ2/(2))))= 276120.0 A\n" + ] + } + ], + "source": [ + "#exa 8.15\n", + "L=3e-6\n", + "print\"L = \",L,\" meter\" # initializing value of length of channel .\n", + "un =800.\n", + "print\"un = \",un,\"cmˆ2/V−s\" # initializing value of mobility of n−channel MOS transistor .\n", + "VT=1.\n", + "print\"VT = \",VT,\" V\" # initializing value of threshold Voltage .\n", + "Vgs=0\n", + "print\"Vgs = \",Vgs,\" V\" # initializing value of gate to source voltage .\n", + "tox =500e-8\n", + "print\"tox = \",tox,\" cm\" # initializing value of gate oxide thickness .\n", + "et=3.9\n", + "print\"et = \",et # initializing value of relative permittivity .\n", + "eo =8.85e-14\n", + "print\"eo = \",eo,\"F/cm\" # initializing value of free space permittivity .\n", + "W=30e-6\n", + "print\"W = \",W,\"m\" # initializing value of width of channel .\n", + "eox=(eo*et)\n", + "print\"eox=(eo∗et))=\",eox,\" F/cmˆ2\"# calculation\n", + "Id=((eox*un*W)/(tox*L)*((Vgs-VT)**2/(2)))*(1e9)\n", + "print\"Drain current ,Id=((eox∗un∗W)/(tox∗L)∗((Vgs−VT)ˆ2/(2))))=\",Id,\" A\"#calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_16 pgno: 274" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "L = 2.5e-06 meter\n", + "un = 800 cmˆ2/V−s\n", + "VT = 0.8 V\n", + "Vgs = 1 V\n", + "tox = 4e-06 cm\n", + "et = 3.9\n", + "eo = 8.85e-14 F/cm\n", + "eox=(eo∗et))= 3.4515e-13 F/cmˆ2\n", + "W = 2.5e-05 m\n", + "Drain current ,Id=((eox∗un∗W)/(tox∗L)∗((Vgs−VT)ˆ2/(2))))= 1.3806e-05 A\n" + ] + } + ], + "source": [ + "#exa 8.16\n", + "L=2.5*10**-6\n", + "print\"L = \",L,\" meter\" # initializing value of length of channel .\n", + "un =800\n", + "print\"un = \",un,\"cmˆ2/V−s\" # initializing value of mobility of n−channel MOS transistor .\n", + "VT =0.8\n", + "print\"VT = \",VT,\" V\" # initializing value of threshold Voltage .\n", + "Vgs=1\n", + "print\"Vgs = \",Vgs,\" V\" # initializing value of gate to source voltage .\n", + "tox =400*10**-8\n", + "print\"tox = \",tox,\" cm\" # initializing value of gate oxide thickness .\n", + "et=3.9\n", + "print\"et = \",et # initializing value of relative permittivity .\n", + "eo =8.85*10**-14\n", + "print\"eo = \",eo,\"F/cm\" # initializing value of free space permittivity .\n", + "eox=(eo*et)\n", + "print\"eox=(eo∗et))=\",eox,\" F/cmˆ2\" # calculation\n", + "W=25*10**-6\n", + "print\"W = \",W,\"m\" # initializing value of width of channel . .\n", + "Id=((eox*un*W)/(tox*L)*((Vgs-VT)**2/(2)))\n", + "print\"Drain current ,Id=((eox∗un∗W)/(tox∗L)∗((Vgs−VT)ˆ2/(2))))=\",Id,\" A\"#calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_17 pgno: 274" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "un = 525 cmˆ2/V−s\n", + "VT = 0.75 V\n", + "Vgs = 2 V\n", + "tox = 4e-06 cm\n", + "et = 3.9\n", + "eo = 8.85e-14 F/cm\n", + "eox=(eo∗et))= 3.4515e-13 F/cmˆ2\n", + "Id = 0.006 A\n", + "width to length ratio ,W/L=((Id∗tox∗2)/(eox∗un∗((Vgs−VT)ˆ2)))= 169.532915296\n" + ] + } + ], + "source": [ + "#8.17\n", + "un =525\n", + "print\"un = \",un,\"cmˆ2/V−s\" # initializing value of mobility of n−channel MOS transistor .\n", + "VT =0.75\n", + "print\"VT = \",VT,\" V\" # initializing value of threshold Voltage .\n", + "Vgs=2\n", + "print\"Vgs = \",Vgs,\" V\" # initializing value of gate to source voltage .\n", + "tox =400*10**-8\n", + "print\"tox = \",tox,\" cm\" # initializing value of gate oxide thickness .\n", + "et=3.9\n", + "print\"et = \",et # initializing value of relative permittivity .\n", + "eo =8.85*10**-14\n", + "print\"eo = \",eo,\"F/cm\" # initializing value of free space permittivity .\n", + "eox=(eo*et)\n", + "print\"eox=(eo∗et))=\",eox,\" F/cmˆ2\" # calculation\n", + "Id =6*10**-3\n", + "print\"Id = \",Id,\"A\" # initializing value of width of channel . .\n", + "X=((Id*tox*2)/(eox*un*((Vgs-VT)**2)))\n", + "print\"width to length ratio ,W/L=((Id∗tox∗2)/(eox∗un∗((Vgs−VT)ˆ2)))= \",X # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_18 pgno: 275" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nd = 20000000000000000 /cmˆ3\n", + "a = 0.0002 cm\n", + "e = 1.6e-19 columns\n", + "Er = 11.9\n", + "Eo = 8.85e-14 F/cm\n", + "E=(Eo∗Er))= 1.05315e-12 F/cmˆ2\n", + "Pinch off Voltage ,Vp=((e∗Nd∗aˆ2)/(2∗E)))= 60.7700707402 V\n" + ] + } + ], + "source": [ + "#exa 8.18\n", + "Nd =2*10**16\n", + "print\"Nd = \",Nd,\" /cmˆ3\" # initializing value of donor ion concentration .\n", + "a=2*10**-4\n", + "print\"a = \",a,\" cm\" # initializing value of height of channel at pinch off .\n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative permittivity .\n", + "Eo =8.85*10**-14\n", + "print\"Eo = \",Eo,\"F/cm\" # initializing value of free space permittivity .\n", + "E=(Eo*Er)\n", + "print\"E=(Eo∗Er))=\",E,\" F/cmˆ2\"#calculation\n", + "Vp=((e*Nd*a**2)/(2*E))\n", + "print\"Pinch off Voltage ,Vp=((e∗Nd∗aˆ2)/(2∗E)))=\",Vp,\" V\"# calculation," + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8_20 pgno: 275" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a = 0.0002 cm\n", + "Er = 11.9\n", + "Eo = 8.854e-14 F/cm\n", + "un = 1350 cmˆ2/V−s\n", + "W = 0.0008 cm\n", + "L = 0.001 cm\n", + "e = 1.6e-19 columns\n", + "Vp = 4 V\n", + "Vgs = 0 V\n", + " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", + "Donor ion concentration ,Nd=((Vp∗2∗E)/(e∗aˆ2)))= 1.3170325e+15 /cmˆ3\n", + "On Drain resistance ,rds=(L/(W∗a∗e∗un∗Nd)))= 21969.9856953 ohm\n" + ] + } + ], + "source": [ + "#exa 8.20\n", + "a=2*10**-4\n", + "print\"a = \",a,\" cm\" # initializing value of height of channel at pinch off .\n", + "Er =11.9\n", + "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", + "Eo=8.854*10**-14\n", + "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", + "un =1350\n", + "print\"un = \",un,\"cmˆ2/V−s\" # initializing value of mobility of n−type silicon Mosfet.\n", + "W=8*10**-4\n", + "print\"W = \",W,\" cm\" # initializing value of width of p−substrate .\n", + "L=10*10**-4\n", + "print\"L = \",L,\" cm\" # initializing value of length of p−substrate \n", + "e=1.6*10**-19\n", + "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", + "Vp=4\n", + "print\"Vp = \",Vp,\" V\" # initializing value of thickness of p−substrate . \n", + "Vgs=0\n", + "print\"Vgs = \",Vgs,\" V\" # initializing value of gate to source voltage .\n", + "E=Eo*Er\n", + "print\" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation\n", + "Nd=((Vp*2*E)/(e*a**2))\n", + "print\"Donor ion concentration ,Nd=((Vp∗2∗E)/(e∗aˆ2)))=\",Nd,\" /cmˆ3\"# calculation\n", + "rds=(L/(W*a*e*un*Nd))\n", + "print\"On Drain resistance ,rds=(L/(W∗a∗e∗un∗Nd)))=\",rds,\" ohm\"# calculation" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.31.11_pm.png b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.31.11_pm.png new file mode 100755 index 00000000..35e9d1ad Binary files /dev/null and b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.31.11_pm.png differ diff --git a/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.32.51_pm.png b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.32.51_pm.png new file mode 100755 index 00000000..aa7eca54 Binary files /dev/null and b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.32.51_pm.png differ diff --git a/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.33.45_pm.png b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.33.45_pm.png new file mode 100755 index 00000000..161d6b04 Binary files /dev/null and b/Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.33.45_pm.png differ diff --git a/Test/README.txt b/Test/README.txt deleted file mode 100755 index b9a36bc6..00000000 --- a/Test/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: Hardik Ghaghada -Course: mca -College/Institute/Organization: FOSSEE - Indian Institute of Technology -Department/Designation: Aerospace -Book Title: Test -Author: Subramanium & Brij Lal -Publisher: McGraw Hill Education (India) Private Limited, New Delhi -Year of publication: 2000 -Isbn: 2548872474 -Edition: 2nd \ No newline at end of file diff --git a/Test/chapter1.ipynb b/Test/chapter1.ipynb deleted file mode 100755 index cf45a409..00000000 --- a/Test/chapter1.ipynb +++ /dev/null @@ -1,423 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 1: Tension Comprssion and Shear" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.1, page no. 9" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Find compressive stress and strain in the post\n", - "\"\"\"\n", - "\n", - "import math\n", - "\n", - "#initialisation\n", - "\n", - "d_1 = 4 # inner diameter (inch)\n", - "d_2 = 4.5 #outer diameter (inch)\n", - "P = 26000 # pressure in pound\n", - "L = 16 # Length of cylinder (inch)\n", - "my_del = 0.012 # shortening of post (inch)\n", - "\n", - "#calculation\n", - "A = (math.pi/4)*((d_2**2)-(d_1**2)) #Area (inch^2)\n", - "s = P/A # stress\n", - "\n", - "print \"compressive stress in the post is \", round(s), \"psi\"\n", - "\n", - "e = my_del/L # strain\n", - "\n", - "print \"compressive strain in the post is %e\" %e" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "compressive stress in the post is 7789.0 psi\n", - "compressive strain in the post is 7.500000e-04\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.2, page no. 10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "formula for maximum stress & calculating maximum stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "W = 1500 # weight (Newton)\n", - "d = 0.008 #diameter(meter) \n", - "g = 77000 # Weight density of steel\n", - "L = 40 # Length of bar (m)\n", - "\n", - "#calculation\n", - "\n", - "A = (math.pi/4)*(d**2) # Area\n", - "s_max = (1500/A) + (g*L) # maximum stress\n", - "\n", - "#result\n", - "print \"Therefore the maximum stress in the rod is \", round(s_max,1), \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Therefore the maximum stress in the rod is 32921551.8 Pa\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.3. page no. 26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating change in lenght of pipe, strain in pipe, increase in diameter & increase in wall thickness\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d1 = 4.5 # diameter in inch\n", - "d2 = 6 # diameter in inch\n", - "A = (math.pi/4)*((d2**2)-(d1**2)) # Area\n", - "P = 140 # pressure in K\n", - "s = -P/A # stress (compression)\n", - "E = 30000 # young's modulus in Ksi\n", - "e = s/E # strain\n", - "\n", - "#calculation\n", - "\n", - "# Part (a)\n", - "my_del = e*4*12 # del = e*L \n", - "print \"Change in length of the pipe is\", round(my_del,3), \"inch\"\n", - "\n", - "# Part (b)\n", - "v = 0.30 # Poissio's ratio\n", - "e_ = -(v*e)\n", - "print \"Lateral strain in the pipe is %e\" %e_\n", - "\n", - "# Part (c)\n", - "del_d2 = e_*d2 \n", - "del_d1 = e_*d1\n", - "print \"Increase in the inner diameter is \", round(del_d1,6), \"inch\"\n", - "\n", - "# Part (d)\n", - "t = 0.75\n", - "del_t = e_*t\n", - "print \"Increase in the wall thicness is %f\" %del_t, \"inch\"\n", - "del_t1 = (del_d2-del_d1)/2 \n", - "print \"del_t1 = del_t\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Change in length of the pipe is -0.018 inch\n", - "Lateral strain in the pipe is 1.131768e-04\n", - "Increase in the inner diameter is 0.000509 inch\n", - "Increase in the wall thicness is 0.000085 inch\n", - "del_t1 = del_t\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.4, page no. 35" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate average shear stress and compressive stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d = 0.02 # diameter in m\n", - "t = 0.008 # thickness in m\n", - "A = math.pi*d*t # shear area\n", - "P = 110000 # prassure in Newton\n", - "\n", - "#calculation\n", - "A1 = (math.pi/4)*(d**2) # Punch area\n", - "t_aver = P/A # Average shear stress \n", - "\n", - "\n", - "print \"Average shear stress in the plate is \", t_aver, \"Pa\"\n", - "s_c = P/A1 # compressive stress\n", - "print \"Average compressive stress in the plate is \", s_c, \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Average shear stress in the plate is 218838046.751 Pa\n", - "Average compressive stress in the plate is 350140874.802 Pa\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Eample 1.5, page no. 36" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate bearing stress, shear stress in pin,\n", - "bearing stress between pin and gussets,\n", - "shear stress in anchor bolts\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "\n", - "P = 12.0 # Pressure in K\n", - "t = 0.375 # thickness of wall in inch\n", - "theta = 40.0 # angle in degree\n", - "d_pin = 0.75 # diameter of pin in inch\n", - "t_G = 0.625 # thickness of gusset in inch\n", - "t_B = 0.375 #thickness of base plate in inch\n", - "d_b = 0.50 # diameter of bolt in inch\n", - "\n", - "#calculation\n", - "\n", - "#Part (a)\n", - "s_b1 = P/(2*t*d_pin) # bearing stress\n", - "print \"Bearing stress between strut and pin\", round(s_b1,1), \"ksi\"\n", - "\n", - "#Part (b)\n", - "t_pin = (4*P)/(2*math.pi*(d_pin**2)) # average shear stress in the \n", - "print \"Shear stress in pin is \", round(t_pin,1), \"ksi\"\n", - "\n", - "# Part (c)\n", - "s_b2 = P/(2*t_G*d_pin) # bearing stress between pin and gusset\n", - "print \"Bearing stress between pin and gussets is\", s_b2, \"ksi\"\n", - "\n", - "# Part (d)\n", - "s_b3 = (P*math.cos(math.radians(40))/(4*t_B*d_b)) # bearing stress between anchor bolt and base plate\n", - "print \"Bearing stress between anchor bolts & base plate\", round(s_b3,1), \"ksi\"\n", - "\n", - "# Part (e)\n", - "t_bolt = (4*math.cos(math.radians(40))*P)/(4*math.pi*(d_b**2)) # shear stress in anchor bolt\n", - "print \"Shear stress in anchor bolts is\", round(t_bolt,1), \"ksi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Bearing stress between strut and pin 21.3 ksi\n", - "Shear stress in pin is 13.6 ksi\n", - "Bearing stress between pin and gussets is 12.8 ksi\n", - "Bearing stress between anchor bolts & base plate 12.3 ksi\n", - "Shear stress in anchor bolts is 11.7 ksi\n" - ] - } - ], - "prompt_number": 39 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7, page no. 42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "determine stress at various parts\n", - "\"\"\"\n", - "\n", - "import math\n", - "\n", - "#initialisation\n", - "b1 = 1.5 # width of recmath.tangular crosssection in inch\n", - "t = 0.5 # thickness of recmath.tangular crosssection in inch\n", - "b2 = 3.0 # width of enlarged recmath.tangular crosssection in inch\n", - "d = 1.0 # diameter in inch\n", - "\n", - "#calculation\n", - "\n", - "# Part (a)\n", - "s_1 = 16000 # maximum allowable tensile stress in Psi\n", - "P_1 = s_1*t*b1 \n", - "print \"The allowable load P1 is\", P_1, \"lb\"\n", - "\n", - "# Part (b)\n", - "s_2 = 11000 # maximum allowable tensile stress in Psi\n", - "P_2 = s_2*t*(b2-d) \n", - "print \"allowable load P2 at this section is\", P_2, \"lb\"\n", - "\n", - "#Part (c)\n", - "s_3 = 26000 # maximum allowable tensile stress in Psi\n", - "P_3 = s_3*t*d \n", - "print \"The allowable load based upon bearing between the hanger and the bolt is\", P_3, \"lb\"\n", - "\n", - "# Part (d)\n", - "s_4 = 6500 # maximum allowable tensile stress in Psi\n", - "P_4 = (math.pi/4)*(d**2)*2*s_4 \n", - "print \"the allowable load P4 based upon shear in the bolt is\", round(P_4), \"lb\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The allowable load P1 is 12000.0 lb\n", - "allowable load P2 at this section is 11000.0 lb\n", - "The allowable load based upon bearing between the hanger and the bolt is 13000.0 lb\n", - "the allowable load P4 based upon shear in the bolt is 10210.0 lb\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.8, page no. 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating the cross sectional area \n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "R_ah = (2700*0.8 + 2700*2.6)/2 # Horizontal component at A in N\n", - "R_ch = R_ah # Horizontal component at C in N\n", - "R_cv = (2700*2.2 + 2700*0.4)/3 # vertical component at C in N\n", - "R_av = 2700 + 2700 - R_cv # vertical component at A in N\n", - "R_a = math.sqrt((R_ah**2)+(R_av**2))\n", - "R_c = math.sqrt((R_ch**2)+(R_cv**2))\n", - "Fab = R_a # Tensile force in bar AB\n", - "Vc = R_c # Shear force acting on the pin at C\n", - "s_allow = 125000000 # allowable stress in tension \n", - "t_allow = 45000000 # allowable stress in shear\n", - "\n", - "#calculation\n", - "Aab = Fab / s_allow # required area of bar \n", - "Apin = Vc / (2*t_allow) # required area of pin\n", - "\n", - "\n", - "print \"Required area of bar is %f\" %Apin, \"m^2\"\n", - "d = math.sqrt((4*Apin)/math.pi) # diameter in meter\n", - "print \"Required diameter of pin is %f\" %d, \"m\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Required area of bar is 0.000057 m^2\n", - "Required diameter of pin is 0.008537 m\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Test/chapter1_1.ipynb b/Test/chapter1_1.ipynb deleted file mode 100755 index cf45a409..00000000 --- a/Test/chapter1_1.ipynb +++ /dev/null @@ -1,423 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 1: Tension Comprssion and Shear" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.1, page no. 9" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Find compressive stress and strain in the post\n", - "\"\"\"\n", - "\n", - "import math\n", - "\n", - "#initialisation\n", - "\n", - "d_1 = 4 # inner diameter (inch)\n", - "d_2 = 4.5 #outer diameter (inch)\n", - "P = 26000 # pressure in pound\n", - "L = 16 # Length of cylinder (inch)\n", - "my_del = 0.012 # shortening of post (inch)\n", - "\n", - "#calculation\n", - "A = (math.pi/4)*((d_2**2)-(d_1**2)) #Area (inch^2)\n", - "s = P/A # stress\n", - "\n", - "print \"compressive stress in the post is \", round(s), \"psi\"\n", - "\n", - "e = my_del/L # strain\n", - "\n", - "print \"compressive strain in the post is %e\" %e" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "compressive stress in the post is 7789.0 psi\n", - "compressive strain in the post is 7.500000e-04\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.2, page no. 10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "formula for maximum stress & calculating maximum stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "W = 1500 # weight (Newton)\n", - "d = 0.008 #diameter(meter) \n", - "g = 77000 # Weight density of steel\n", - "L = 40 # Length of bar (m)\n", - "\n", - "#calculation\n", - "\n", - "A = (math.pi/4)*(d**2) # Area\n", - "s_max = (1500/A) + (g*L) # maximum stress\n", - "\n", - "#result\n", - "print \"Therefore the maximum stress in the rod is \", round(s_max,1), \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Therefore the maximum stress in the rod is 32921551.8 Pa\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.3. page no. 26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating change in lenght of pipe, strain in pipe, increase in diameter & increase in wall thickness\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d1 = 4.5 # diameter in inch\n", - "d2 = 6 # diameter in inch\n", - "A = (math.pi/4)*((d2**2)-(d1**2)) # Area\n", - "P = 140 # pressure in K\n", - "s = -P/A # stress (compression)\n", - "E = 30000 # young's modulus in Ksi\n", - "e = s/E # strain\n", - "\n", - "#calculation\n", - "\n", - "# Part (a)\n", - "my_del = e*4*12 # del = e*L \n", - "print \"Change in length of the pipe is\", round(my_del,3), \"inch\"\n", - "\n", - "# Part (b)\n", - "v = 0.30 # Poissio's ratio\n", - "e_ = -(v*e)\n", - "print \"Lateral strain in the pipe is %e\" %e_\n", - "\n", - "# Part (c)\n", - "del_d2 = e_*d2 \n", - "del_d1 = e_*d1\n", - "print \"Increase in the inner diameter is \", round(del_d1,6), \"inch\"\n", - "\n", - "# Part (d)\n", - "t = 0.75\n", - "del_t = e_*t\n", - "print \"Increase in the wall thicness is %f\" %del_t, \"inch\"\n", - "del_t1 = (del_d2-del_d1)/2 \n", - "print \"del_t1 = del_t\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Change in length of the pipe is -0.018 inch\n", - "Lateral strain in the pipe is 1.131768e-04\n", - "Increase in the inner diameter is 0.000509 inch\n", - "Increase in the wall thicness is 0.000085 inch\n", - "del_t1 = del_t\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.4, page no. 35" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate average shear stress and compressive stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d = 0.02 # diameter in m\n", - "t = 0.008 # thickness in m\n", - "A = math.pi*d*t # shear area\n", - "P = 110000 # prassure in Newton\n", - "\n", - "#calculation\n", - "A1 = (math.pi/4)*(d**2) # Punch area\n", - "t_aver = P/A # Average shear stress \n", - "\n", - "\n", - "print \"Average shear stress in the plate is \", t_aver, \"Pa\"\n", - "s_c = P/A1 # compressive stress\n", - "print \"Average compressive stress in the plate is \", s_c, \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Average shear stress in the plate is 218838046.751 Pa\n", - "Average compressive stress in the plate is 350140874.802 Pa\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Eample 1.5, page no. 36" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate bearing stress, shear stress in pin,\n", - "bearing stress between pin and gussets,\n", - "shear stress in anchor bolts\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "\n", - "P = 12.0 # Pressure in K\n", - "t = 0.375 # thickness of wall in inch\n", - "theta = 40.0 # angle in degree\n", - "d_pin = 0.75 # diameter of pin in inch\n", - "t_G = 0.625 # thickness of gusset in inch\n", - "t_B = 0.375 #thickness of base plate in inch\n", - "d_b = 0.50 # diameter of bolt in inch\n", - "\n", - "#calculation\n", - "\n", - "#Part (a)\n", - "s_b1 = P/(2*t*d_pin) # bearing stress\n", - "print \"Bearing stress between strut and pin\", round(s_b1,1), \"ksi\"\n", - "\n", - "#Part (b)\n", - "t_pin = (4*P)/(2*math.pi*(d_pin**2)) # average shear stress in the \n", - "print \"Shear stress in pin is \", round(t_pin,1), \"ksi\"\n", - "\n", - "# Part (c)\n", - "s_b2 = P/(2*t_G*d_pin) # bearing stress between pin and gusset\n", - "print \"Bearing stress between pin and gussets is\", s_b2, \"ksi\"\n", - "\n", - "# Part (d)\n", - "s_b3 = (P*math.cos(math.radians(40))/(4*t_B*d_b)) # bearing stress between anchor bolt and base plate\n", - "print \"Bearing stress between anchor bolts & base plate\", round(s_b3,1), \"ksi\"\n", - "\n", - "# Part (e)\n", - "t_bolt = (4*math.cos(math.radians(40))*P)/(4*math.pi*(d_b**2)) # shear stress in anchor bolt\n", - "print \"Shear stress in anchor bolts is\", round(t_bolt,1), \"ksi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Bearing stress between strut and pin 21.3 ksi\n", - "Shear stress in pin is 13.6 ksi\n", - "Bearing stress between pin and gussets is 12.8 ksi\n", - "Bearing stress between anchor bolts & base plate 12.3 ksi\n", - "Shear stress in anchor bolts is 11.7 ksi\n" - ] - } - ], - "prompt_number": 39 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7, page no. 42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "determine stress at various parts\n", - "\"\"\"\n", - "\n", - "import math\n", - "\n", - "#initialisation\n", - "b1 = 1.5 # width of recmath.tangular crosssection in inch\n", - "t = 0.5 # thickness of recmath.tangular crosssection in inch\n", - "b2 = 3.0 # width of enlarged recmath.tangular crosssection in inch\n", - "d = 1.0 # diameter in inch\n", - "\n", - "#calculation\n", - "\n", - "# Part (a)\n", - "s_1 = 16000 # maximum allowable tensile stress in Psi\n", - "P_1 = s_1*t*b1 \n", - "print \"The allowable load P1 is\", P_1, \"lb\"\n", - "\n", - "# Part (b)\n", - "s_2 = 11000 # maximum allowable tensile stress in Psi\n", - "P_2 = s_2*t*(b2-d) \n", - "print \"allowable load P2 at this section is\", P_2, \"lb\"\n", - "\n", - "#Part (c)\n", - "s_3 = 26000 # maximum allowable tensile stress in Psi\n", - "P_3 = s_3*t*d \n", - "print \"The allowable load based upon bearing between the hanger and the bolt is\", P_3, \"lb\"\n", - "\n", - "# Part (d)\n", - "s_4 = 6500 # maximum allowable tensile stress in Psi\n", - "P_4 = (math.pi/4)*(d**2)*2*s_4 \n", - "print \"the allowable load P4 based upon shear in the bolt is\", round(P_4), \"lb\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The allowable load P1 is 12000.0 lb\n", - "allowable load P2 at this section is 11000.0 lb\n", - "The allowable load based upon bearing between the hanger and the bolt is 13000.0 lb\n", - "the allowable load P4 based upon shear in the bolt is 10210.0 lb\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.8, page no. 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating the cross sectional area \n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "R_ah = (2700*0.8 + 2700*2.6)/2 # Horizontal component at A in N\n", - "R_ch = R_ah # Horizontal component at C in N\n", - "R_cv = (2700*2.2 + 2700*0.4)/3 # vertical component at C in N\n", - "R_av = 2700 + 2700 - R_cv # vertical component at A in N\n", - "R_a = math.sqrt((R_ah**2)+(R_av**2))\n", - "R_c = math.sqrt((R_ch**2)+(R_cv**2))\n", - "Fab = R_a # Tensile force in bar AB\n", - "Vc = R_c # Shear force acting on the pin at C\n", - "s_allow = 125000000 # allowable stress in tension \n", - "t_allow = 45000000 # allowable stress in shear\n", - "\n", - "#calculation\n", - "Aab = Fab / s_allow # required area of bar \n", - "Apin = Vc / (2*t_allow) # required area of pin\n", - "\n", - "\n", - "print \"Required area of bar is %f\" %Apin, \"m^2\"\n", - "d = math.sqrt((4*Apin)/math.pi) # diameter in meter\n", - "print \"Required diameter of pin is %f\" %d, \"m\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Required area of bar is 0.000057 m^2\n", - "Required diameter of pin is 0.008537 m\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Test/chapter1_2.ipynb b/Test/chapter1_2.ipynb deleted file mode 100755 index cf45a409..00000000 --- a/Test/chapter1_2.ipynb +++ /dev/null @@ -1,423 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 1: Tension Comprssion and Shear" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.1, page no. 9" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Find compressive stress and strain in the post\n", - "\"\"\"\n", - "\n", - "import math\n", - "\n", - "#initialisation\n", - "\n", - "d_1 = 4 # inner diameter (inch)\n", - "d_2 = 4.5 #outer diameter (inch)\n", - "P = 26000 # pressure in pound\n", - "L = 16 # Length of cylinder (inch)\n", - "my_del = 0.012 # shortening of post (inch)\n", - "\n", - "#calculation\n", - "A = (math.pi/4)*((d_2**2)-(d_1**2)) #Area (inch^2)\n", - "s = P/A # stress\n", - "\n", - "print \"compressive stress in the post is \", round(s), \"psi\"\n", - "\n", - "e = my_del/L # strain\n", - "\n", - "print \"compressive strain in the post is %e\" %e" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "compressive stress in the post is 7789.0 psi\n", - "compressive strain in the post is 7.500000e-04\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.2, page no. 10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "formula for maximum stress & calculating maximum stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "W = 1500 # weight (Newton)\n", - "d = 0.008 #diameter(meter) \n", - "g = 77000 # Weight density of steel\n", - "L = 40 # Length of bar (m)\n", - "\n", - "#calculation\n", - "\n", - "A = (math.pi/4)*(d**2) # Area\n", - "s_max = (1500/A) + (g*L) # maximum stress\n", - "\n", - "#result\n", - "print \"Therefore the maximum stress in the rod is \", round(s_max,1), \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Therefore the maximum stress in the rod is 32921551.8 Pa\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.3. page no. 26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating change in lenght of pipe, strain in pipe, increase in diameter & increase in wall thickness\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d1 = 4.5 # diameter in inch\n", - "d2 = 6 # diameter in inch\n", - "A = (math.pi/4)*((d2**2)-(d1**2)) # Area\n", - "P = 140 # pressure in K\n", - "s = -P/A # stress (compression)\n", - "E = 30000 # young's modulus in Ksi\n", - "e = s/E # strain\n", - "\n", - "#calculation\n", - "\n", - "# Part (a)\n", - "my_del = e*4*12 # del = e*L \n", - "print \"Change in length of the pipe is\", round(my_del,3), \"inch\"\n", - "\n", - "# Part (b)\n", - "v = 0.30 # Poissio's ratio\n", - "e_ = -(v*e)\n", - "print \"Lateral strain in the pipe is %e\" %e_\n", - "\n", - "# Part (c)\n", - "del_d2 = e_*d2 \n", - "del_d1 = e_*d1\n", - "print \"Increase in the inner diameter is \", round(del_d1,6), \"inch\"\n", - "\n", - "# Part (d)\n", - "t = 0.75\n", - "del_t = e_*t\n", - "print \"Increase in the wall thicness is %f\" %del_t, \"inch\"\n", - "del_t1 = (del_d2-del_d1)/2 \n", - "print \"del_t1 = del_t\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Change in length of the pipe is -0.018 inch\n", - "Lateral strain in the pipe is 1.131768e-04\n", - "Increase in the inner diameter is 0.000509 inch\n", - "Increase in the wall thicness is 0.000085 inch\n", - "del_t1 = del_t\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.4, page no. 35" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate average shear stress and compressive stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d = 0.02 # diameter in m\n", - "t = 0.008 # thickness in m\n", - "A = math.pi*d*t # shear area\n", - "P = 110000 # prassure in Newton\n", - "\n", - "#calculation\n", - "A1 = (math.pi/4)*(d**2) # Punch area\n", - "t_aver = P/A # Average shear stress \n", - "\n", - "\n", - "print \"Average shear stress in the plate is \", t_aver, \"Pa\"\n", - "s_c = P/A1 # compressive stress\n", - "print \"Average compressive stress in the plate is \", s_c, \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Average shear stress in the plate is 218838046.751 Pa\n", - "Average compressive stress in the plate is 350140874.802 Pa\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Eample 1.5, page no. 36" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate bearing stress, shear stress in pin,\n", - "bearing stress between pin and gussets,\n", - "shear stress in anchor bolts\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "\n", - "P = 12.0 # Pressure in K\n", - "t = 0.375 # thickness of wall in inch\n", - "theta = 40.0 # angle in degree\n", - "d_pin = 0.75 # diameter of pin in inch\n", - "t_G = 0.625 # thickness of gusset in inch\n", - "t_B = 0.375 #thickness of base plate in inch\n", - "d_b = 0.50 # diameter of bolt in inch\n", - "\n", - "#calculation\n", - "\n", - "#Part (a)\n", - "s_b1 = P/(2*t*d_pin) # bearing stress\n", - "print \"Bearing stress between strut and pin\", round(s_b1,1), \"ksi\"\n", - "\n", - "#Part (b)\n", - "t_pin = (4*P)/(2*math.pi*(d_pin**2)) # average shear stress in the \n", - "print \"Shear stress in pin is \", round(t_pin,1), \"ksi\"\n", - "\n", - "# Part (c)\n", - "s_b2 = P/(2*t_G*d_pin) # bearing stress between pin and gusset\n", - "print \"Bearing stress between pin and gussets is\", s_b2, \"ksi\"\n", - "\n", - "# Part (d)\n", - "s_b3 = (P*math.cos(math.radians(40))/(4*t_B*d_b)) # bearing stress between anchor bolt and base plate\n", - "print \"Bearing stress between anchor bolts & base plate\", round(s_b3,1), \"ksi\"\n", - "\n", - "# Part (e)\n", - "t_bolt = (4*math.cos(math.radians(40))*P)/(4*math.pi*(d_b**2)) # shear stress in anchor bolt\n", - "print \"Shear stress in anchor bolts is\", round(t_bolt,1), \"ksi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Bearing stress between strut and pin 21.3 ksi\n", - "Shear stress in pin is 13.6 ksi\n", - "Bearing stress between pin and gussets is 12.8 ksi\n", - "Bearing stress between anchor bolts & base plate 12.3 ksi\n", - "Shear stress in anchor bolts is 11.7 ksi\n" - ] - } - ], - "prompt_number": 39 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7, page no. 42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "determine stress at various parts\n", - "\"\"\"\n", - "\n", - "import math\n", - "\n", - "#initialisation\n", - "b1 = 1.5 # width of recmath.tangular crosssection in inch\n", - "t = 0.5 # thickness of recmath.tangular crosssection in inch\n", - "b2 = 3.0 # width of enlarged recmath.tangular crosssection in inch\n", - "d = 1.0 # diameter in inch\n", - "\n", - "#calculation\n", - "\n", - "# Part (a)\n", - "s_1 = 16000 # maximum allowable tensile stress in Psi\n", - "P_1 = s_1*t*b1 \n", - "print \"The allowable load P1 is\", P_1, \"lb\"\n", - "\n", - "# Part (b)\n", - "s_2 = 11000 # maximum allowable tensile stress in Psi\n", - "P_2 = s_2*t*(b2-d) \n", - "print \"allowable load P2 at this section is\", P_2, \"lb\"\n", - "\n", - "#Part (c)\n", - "s_3 = 26000 # maximum allowable tensile stress in Psi\n", - "P_3 = s_3*t*d \n", - "print \"The allowable load based upon bearing between the hanger and the bolt is\", P_3, \"lb\"\n", - "\n", - "# Part (d)\n", - "s_4 = 6500 # maximum allowable tensile stress in Psi\n", - "P_4 = (math.pi/4)*(d**2)*2*s_4 \n", - "print \"the allowable load P4 based upon shear in the bolt is\", round(P_4), \"lb\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The allowable load P1 is 12000.0 lb\n", - "allowable load P2 at this section is 11000.0 lb\n", - "The allowable load based upon bearing between the hanger and the bolt is 13000.0 lb\n", - "the allowable load P4 based upon shear in the bolt is 10210.0 lb\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.8, page no. 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating the cross sectional area \n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "R_ah = (2700*0.8 + 2700*2.6)/2 # Horizontal component at A in N\n", - "R_ch = R_ah # Horizontal component at C in N\n", - "R_cv = (2700*2.2 + 2700*0.4)/3 # vertical component at C in N\n", - "R_av = 2700 + 2700 - R_cv # vertical component at A in N\n", - "R_a = math.sqrt((R_ah**2)+(R_av**2))\n", - "R_c = math.sqrt((R_ch**2)+(R_cv**2))\n", - "Fab = R_a # Tensile force in bar AB\n", - "Vc = R_c # Shear force acting on the pin at C\n", - "s_allow = 125000000 # allowable stress in tension \n", - "t_allow = 45000000 # allowable stress in shear\n", - "\n", - "#calculation\n", - "Aab = Fab / s_allow # required area of bar \n", - "Apin = Vc / (2*t_allow) # required area of pin\n", - "\n", - "\n", - "print \"Required area of bar is %f\" %Apin, \"m^2\"\n", - "d = math.sqrt((4*Apin)/math.pi) # diameter in meter\n", - "print \"Required diameter of pin is %f\" %d, \"m\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Required area of bar is 0.000057 m^2\n", - "Required diameter of pin is 0.008537 m\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Test/chapter2.ipynb b/Test/chapter2.ipynb deleted file mode 100755 index c4e1ad0f..00000000 --- a/Test/chapter2.ipynb +++ /dev/null @@ -1,501 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 2: Axially Loaded Members" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1, page no. 72" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating the number of revolutions for the nut\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "\n", - "W = 2.0 #lb\n", - "b = 10.5 #inch\n", - "c = 6.4 #inch\n", - "k = 4.2 #inch\n", - "p = 1.0/16.0 #inch\n", - "\n", - "#calculation\n", - "\n", - "n = (W*b)/(c*k*p) #inch\n", - "\n", - "#result\n", - "\n", - "print \" No. of revolution required = \", n, \"revolutions\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " No. of revolution required = 12.5 revolutions\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.2, page no. 74" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "finding maximum allowable load\n", - "\"\"\"\n", - "\n", - "import math \n", - "import numpy\n", - "\n", - "#initialisation\n", - "\n", - "Fce_ = 2.0 #dummy variable\n", - "Fbd_ = 3.0 #dummy variable \n", - "Lbd = 480.0 #mm\n", - "Lce = 600.0 #mm\n", - "E = 205e6 #205Gpa\n", - "Abd = 1020.0 #mm\n", - "Ace = 520.0 #mm\n", - "\n", - "#calculation\n", - "Dbd_ = (Fbd_*Lbd)/(E*Abd) #dummy variable\n", - "Dce_ = (Fce_*Lce)/(E*Ace) #dummy variable\n", - "Da = 1 #limiting value\n", - "P = ((((450+225)/225)*(Dbd_ + Dce_) - Dce_ )**(-1)) * Da \n", - "Fce = 2*P # Real value in newton\n", - "Fbd = 3*P #real value in newton\n", - "Dbd = (Fbd*Lbd)/(E*Abd) #print lacement in mm\n", - "Dce = (Fce*Lce)/(E*Ace) # print lacement in mm\n", - "a = numpy.degrees(numpy.arctan(((Da+Dce)/675))) #alpha in degree\n", - "\n", - "#result\n", - "print \"alpha = \", round(a,2), \"degree\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "alpha = 0.11 degree\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3, page no. 80" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculation if vertical displacement\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "P1 = 2100.0 #lb\n", - "P2 = 5600.0 #lb\n", - "b = 25.0 #inch\n", - "a = 28.0 #inch\n", - "A1 = 0.25 #inch^2\n", - "A2 = 0.15 #inch^2\n", - "L1 = 20.0 #inch\n", - "L2 = 34.8 #inch\n", - "E = 29e6 #29Gpa\n", - "\n", - "#Calculations\n", - "P3 = (P2*b)/a \n", - "Ra = P3-P1\n", - "N1 = -Ra \n", - "N2 = P1 \n", - "D = ((N1*L1)/(E*A1)) + ((N2*L2)/(E*A2)) #print lacement\n", - "\n", - "#Result\n", - "print \"Downward print lacement is = \", D, \"inch\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Downward print lacement is = 0.0088 inch\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6, page no. 90" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "obtaing formula and calculating allowable load\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#Numerical calculation of allowable load\n", - "\n", - "d1 = 4.0 #mm\n", - "d2 = 3.0 #mm\n", - "A1 = (math.pi*(d1**2))/4 #area\n", - "A2 = (math.pi*(d2**2))/4 #area\n", - "L1 = 0.4 #meter\n", - "L2 = 0.3 #meter\n", - "E1 = 72e9 #Gpa\n", - "E2 = 45e9 #Gpa\n", - "f1 = L1/(E1*A1) * 1e6 # To cpmpensate for the mm**2\n", - "f2 = L2/(E2*A2) * 1e6 \n", - "s1 = 200e6 #stress\n", - "s2 = 175e6 #stress\n", - "\n", - "#Calculations\n", - "P1 = ( (s1*A1*(4*f1 + f2))/(3*f2) ) * 1e-6 # To cpmpensate for the mm**2\n", - "P2 = ( (s2*A2*(4*f1 + f2))/(6*f1) ) * 1e-6 \n", - "\n", - "#Result\n", - "print \"Newton Minimum allowable stress aomong the two P1 and P2 is smaller one, therefore MAS = \", P2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Newton Minimum allowable stress aomong the two P1 and P2 is smaller one, therefore MAS = 1264.49104307\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.10, page no. 113" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate stress acting on inclined section &\n", - "the complete state of stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "P = 90000.0 #newton\n", - "A = 1200e-6 # meter^2\n", - "s_x = -P/A #stress\n", - "t_1 = 25.0 #for the stresses on ab and cd plane\n", - "\n", - "#Calculations\n", - "s_1 = s_x*(math.cos(math.radians(t_1))**2)\n", - "T_1 = -s_x*math.cos(math.radians(t_1))*math.sin(math.radians(t_1))\n", - "t_2 = -65.0 #for the stresses on ad and bc plane\n", - "s_2 = s_x*(math.cos(math.radians(t_2))**2)\n", - "T_2 = -s_x*math.cos(math.radians(t_2))*math.sin(math.radians(t_2))\n", - "\n", - "#Result\n", - "print \"The normal and shear stresses on the plane ab and cd are\", round((T_1/1E+6),2), round((s_1/1E+6),2), \"MPa respecively\" \n", - "print \"respecively The normal and shear stresses on the plane ad and bc are\", round((T_2/1E+6),2), round((s_2/1E+6),2), \"MPa respecively\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The normal and shear stresses on the plane ab and cd are 28.73 -61.6 MPa respecively\n", - "respecively The normal and shear stresses on the plane ad and bc are -28.73 -13.4 MPa respecively\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.11, page no. 114" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Calculate the vertical displacement of the joint\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "# Value of s_x based on allowable stresses on glued joint\n", - "\n", - "#initialisation\n", - "s_t = -750.0 #psi\n", - "t = -50.0 #degree\n", - "T_t = -500.0 #psi\n", - "\n", - "sg_x_1 = s_t/(math.cos(math.radians(t))**2)\n", - "sg_x_2 = -T_t/(math.cos(math.radians(t))*math.sin(math.radians(t)))\n", - "\n", - "# Value of s_x based on allowable stresses on plastic\n", - "\n", - "sp_x_1 = -1100.0 #psi\n", - "T_t_p = 600.0 #psi\n", - "t_p = 45.0 #degree\n", - "sp_x_2 = -T_t_p/(math.cos(math.radians(t_p))*math.sin(math.radians(t_p)))\n", - "\n", - "# Minimum width of bar\n", - "\n", - "P = 8000.0 #lb\n", - "A = P/sg_x_2\n", - "b_min = math.sqrt(abs(A)) #inch\n", - "print \"The minimum width of the bar is\", round(b_min,2), \"inch\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The minimum width of the bar is 2.81 inch\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.15, page no. 126" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Comparison of energy-absorbing capacity with different type of bolts\n", - "\"\"\"\n", - "\n", - "import math \n", - "#Bolt with reduced shank diameter\n", - "\n", - "#initialisation\n", - "g = 1.50 # inch\n", - "d = 0.5 #inch\n", - "t = 0.25 #inch\n", - "d_r = 0.406 #inch\n", - "L = 13.5 #inch\n", - "\n", - "#calculation\n", - "ratio = ((g*(d**2))/(((g-t)*(d_r**2))+(t*(d**2)))) #U2/U1\n", - "\n", - "print \"The energy absorbing capacity of the bolts with reduced shank diameter\", round(ratio,2)\n", - "ratio_1 = ( (((L-t)*(d_r**2))+(t*(d**2))) / ((2*(g-t)*(d_r**2))+2*(t*(d**2))) ) #U3/2U1\n", - "print \"The energy absorbing capacity of the long bolts\", round(ratio_1,2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The energy absorbing capacity of the bolts with reduced shank diameter 1.4\n", - "The energy absorbing capacity of the long bolts 4.18\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - " Example 2.16, page no. 133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Determine the maximum elongation and tensile stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "# Maximum elongation\n", - "M = 20 #kg\n", - "g = 9.81 #m/s^2\n", - "L = 2 #meter\n", - "E = 210e9 #210Gpa\n", - "h = 0.15 #meter\n", - "diameter = 0.015 #milimeter\n", - "\n", - "#Calculations & Result\n", - "A = (math.pi/4)*(diameter**2) #area\n", - "D_st = ((M*g*L)/(E*A)) \n", - "D_max = D_st*(1+(1+(2*h/D_st))**0.5) \n", - "D_max_1 = math.sqrt(2*h*D_st) # another approach to find D_max\n", - "i = D_max / D_st # Impact factor\n", - "print \"Maximum elongation is\",round((D_max/1E-3),2), \"mm\" # Maximum tensile stress\n", - "s_max = (E*D_max)/L #Maximum tensile stress\n", - "s_st = (M*g)/A #static stress\n", - "i_1 = s_max / s_st #Impact factor \n", - "print \"Maximum tensile stress is \", round((s_max/1E+6),2), \"MPa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum elongation is 1.79 mm\n", - "Maximum tensile stress is 188.13 MPa\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.18, page no. 148" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "determine displacement at the lower end of bar in various conditions\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "\n", - "#initialisation\n", - "P1 = 108000.0 #Newton\n", - "P2 = 27000.0 #Newton\n", - "L = 2.2 #meter\n", - "A = 480.0 #mm^2\n", - "\n", - "\n", - "#calculations\n", - "\n", - "# Displacement due to load P1 acting alone\n", - "s = (P1/A) #stress in MPa\n", - "e = (s/70000) + (1/628.2)*((s/260)**10) #strain\n", - "D_b = e*L*1e3 #elongation in mm\n", - "print \"elongation when only P1 load acting is = \", round(D_b,2), \" mm\"\n", - "\n", - "# Displacement due to load P2 acting alone\n", - "s_1 = (P2/A) #stress in MPa\n", - "e_1 = (s_1/70000) + (1/628.2)*((s_1/260)**10) #strain\n", - "D_b_1 = e_1*(L/2)*1e3 #elongation in mm (no elongation in lower half)\n", - "print \"elongation when only P2 load acting is = \", round(D_b_1,2), \" mm\"\n", - "\n", - "# Displacement due to both load acting simonmath.taneously\n", - "#upper half\n", - "s_2 = (P1/A) #stress in MPa\n", - "e_2 = (s_2/70000) + (1/628.2)*((s_2/260)**10) #strain\n", - "\n", - "#lower half\n", - "s_3 = (P1+P2)/A #stress in MPa\n", - "e_3 = (s_3/70000) + (1/628.2)*((s_3/260)**10) #strain\n", - "D_b_2 = ((e_2*L)/2 + (e_3*L)/2) * 1e3 # elongation in mm\n", - "print \"elongation when P1 and P2 both loads are acting is = \", round(D_b_2,2), \" mm\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "elongation when only P1 load acting is = 7.9 mm\n", - "elongation when only P2 load acting is = 0.88 mm\n", - "elongation when P1 and P2 both loads are acting is = 12.21 mm\n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Test/chapter2_1.ipynb b/Test/chapter2_1.ipynb deleted file mode 100755 index c4e1ad0f..00000000 --- a/Test/chapter2_1.ipynb +++ /dev/null @@ -1,501 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 2: Axially Loaded Members" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1, page no. 72" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating the number of revolutions for the nut\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "\n", - "W = 2.0 #lb\n", - "b = 10.5 #inch\n", - "c = 6.4 #inch\n", - "k = 4.2 #inch\n", - "p = 1.0/16.0 #inch\n", - "\n", - "#calculation\n", - "\n", - "n = (W*b)/(c*k*p) #inch\n", - "\n", - "#result\n", - "\n", - "print \" No. of revolution required = \", n, \"revolutions\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " No. of revolution required = 12.5 revolutions\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.2, page no. 74" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "finding maximum allowable load\n", - "\"\"\"\n", - "\n", - "import math \n", - "import numpy\n", - "\n", - "#initialisation\n", - "\n", - "Fce_ = 2.0 #dummy variable\n", - "Fbd_ = 3.0 #dummy variable \n", - "Lbd = 480.0 #mm\n", - "Lce = 600.0 #mm\n", - "E = 205e6 #205Gpa\n", - "Abd = 1020.0 #mm\n", - "Ace = 520.0 #mm\n", - "\n", - "#calculation\n", - "Dbd_ = (Fbd_*Lbd)/(E*Abd) #dummy variable\n", - "Dce_ = (Fce_*Lce)/(E*Ace) #dummy variable\n", - "Da = 1 #limiting value\n", - "P = ((((450+225)/225)*(Dbd_ + Dce_) - Dce_ )**(-1)) * Da \n", - "Fce = 2*P # Real value in newton\n", - "Fbd = 3*P #real value in newton\n", - "Dbd = (Fbd*Lbd)/(E*Abd) #print lacement in mm\n", - "Dce = (Fce*Lce)/(E*Ace) # print lacement in mm\n", - "a = numpy.degrees(numpy.arctan(((Da+Dce)/675))) #alpha in degree\n", - "\n", - "#result\n", - "print \"alpha = \", round(a,2), \"degree\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "alpha = 0.11 degree\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3, page no. 80" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculation if vertical displacement\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "P1 = 2100.0 #lb\n", - "P2 = 5600.0 #lb\n", - "b = 25.0 #inch\n", - "a = 28.0 #inch\n", - "A1 = 0.25 #inch^2\n", - "A2 = 0.15 #inch^2\n", - "L1 = 20.0 #inch\n", - "L2 = 34.8 #inch\n", - "E = 29e6 #29Gpa\n", - "\n", - "#Calculations\n", - "P3 = (P2*b)/a \n", - "Ra = P3-P1\n", - "N1 = -Ra \n", - "N2 = P1 \n", - "D = ((N1*L1)/(E*A1)) + ((N2*L2)/(E*A2)) #print lacement\n", - "\n", - "#Result\n", - "print \"Downward print lacement is = \", D, \"inch\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Downward print lacement is = 0.0088 inch\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6, page no. 90" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "obtaing formula and calculating allowable load\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#Numerical calculation of allowable load\n", - "\n", - "d1 = 4.0 #mm\n", - "d2 = 3.0 #mm\n", - "A1 = (math.pi*(d1**2))/4 #area\n", - "A2 = (math.pi*(d2**2))/4 #area\n", - "L1 = 0.4 #meter\n", - "L2 = 0.3 #meter\n", - "E1 = 72e9 #Gpa\n", - "E2 = 45e9 #Gpa\n", - "f1 = L1/(E1*A1) * 1e6 # To cpmpensate for the mm**2\n", - "f2 = L2/(E2*A2) * 1e6 \n", - "s1 = 200e6 #stress\n", - "s2 = 175e6 #stress\n", - "\n", - "#Calculations\n", - "P1 = ( (s1*A1*(4*f1 + f2))/(3*f2) ) * 1e-6 # To cpmpensate for the mm**2\n", - "P2 = ( (s2*A2*(4*f1 + f2))/(6*f1) ) * 1e-6 \n", - "\n", - "#Result\n", - "print \"Newton Minimum allowable stress aomong the two P1 and P2 is smaller one, therefore MAS = \", P2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Newton Minimum allowable stress aomong the two P1 and P2 is smaller one, therefore MAS = 1264.49104307\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.10, page no. 113" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate stress acting on inclined section &\n", - "the complete state of stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "P = 90000.0 #newton\n", - "A = 1200e-6 # meter^2\n", - "s_x = -P/A #stress\n", - "t_1 = 25.0 #for the stresses on ab and cd plane\n", - "\n", - "#Calculations\n", - "s_1 = s_x*(math.cos(math.radians(t_1))**2)\n", - "T_1 = -s_x*math.cos(math.radians(t_1))*math.sin(math.radians(t_1))\n", - "t_2 = -65.0 #for the stresses on ad and bc plane\n", - "s_2 = s_x*(math.cos(math.radians(t_2))**2)\n", - "T_2 = -s_x*math.cos(math.radians(t_2))*math.sin(math.radians(t_2))\n", - "\n", - "#Result\n", - "print \"The normal and shear stresses on the plane ab and cd are\", round((T_1/1E+6),2), round((s_1/1E+6),2), \"MPa respecively\" \n", - "print \"respecively The normal and shear stresses on the plane ad and bc are\", round((T_2/1E+6),2), round((s_2/1E+6),2), \"MPa respecively\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The normal and shear stresses on the plane ab and cd are 28.73 -61.6 MPa respecively\n", - "respecively The normal and shear stresses on the plane ad and bc are -28.73 -13.4 MPa respecively\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.11, page no. 114" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Calculate the vertical displacement of the joint\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "# Value of s_x based on allowable stresses on glued joint\n", - "\n", - "#initialisation\n", - "s_t = -750.0 #psi\n", - "t = -50.0 #degree\n", - "T_t = -500.0 #psi\n", - "\n", - "sg_x_1 = s_t/(math.cos(math.radians(t))**2)\n", - "sg_x_2 = -T_t/(math.cos(math.radians(t))*math.sin(math.radians(t)))\n", - "\n", - "# Value of s_x based on allowable stresses on plastic\n", - "\n", - "sp_x_1 = -1100.0 #psi\n", - "T_t_p = 600.0 #psi\n", - "t_p = 45.0 #degree\n", - "sp_x_2 = -T_t_p/(math.cos(math.radians(t_p))*math.sin(math.radians(t_p)))\n", - "\n", - "# Minimum width of bar\n", - "\n", - "P = 8000.0 #lb\n", - "A = P/sg_x_2\n", - "b_min = math.sqrt(abs(A)) #inch\n", - "print \"The minimum width of the bar is\", round(b_min,2), \"inch\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The minimum width of the bar is 2.81 inch\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.15, page no. 126" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Comparison of energy-absorbing capacity with different type of bolts\n", - "\"\"\"\n", - "\n", - "import math \n", - "#Bolt with reduced shank diameter\n", - "\n", - "#initialisation\n", - "g = 1.50 # inch\n", - "d = 0.5 #inch\n", - "t = 0.25 #inch\n", - "d_r = 0.406 #inch\n", - "L = 13.5 #inch\n", - "\n", - "#calculation\n", - "ratio = ((g*(d**2))/(((g-t)*(d_r**2))+(t*(d**2)))) #U2/U1\n", - "\n", - "print \"The energy absorbing capacity of the bolts with reduced shank diameter\", round(ratio,2)\n", - "ratio_1 = ( (((L-t)*(d_r**2))+(t*(d**2))) / ((2*(g-t)*(d_r**2))+2*(t*(d**2))) ) #U3/2U1\n", - "print \"The energy absorbing capacity of the long bolts\", round(ratio_1,2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The energy absorbing capacity of the bolts with reduced shank diameter 1.4\n", - "The energy absorbing capacity of the long bolts 4.18\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - " Example 2.16, page no. 133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Determine the maximum elongation and tensile stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "# Maximum elongation\n", - "M = 20 #kg\n", - "g = 9.81 #m/s^2\n", - "L = 2 #meter\n", - "E = 210e9 #210Gpa\n", - "h = 0.15 #meter\n", - "diameter = 0.015 #milimeter\n", - "\n", - "#Calculations & Result\n", - "A = (math.pi/4)*(diameter**2) #area\n", - "D_st = ((M*g*L)/(E*A)) \n", - "D_max = D_st*(1+(1+(2*h/D_st))**0.5) \n", - "D_max_1 = math.sqrt(2*h*D_st) # another approach to find D_max\n", - "i = D_max / D_st # Impact factor\n", - "print \"Maximum elongation is\",round((D_max/1E-3),2), \"mm\" # Maximum tensile stress\n", - "s_max = (E*D_max)/L #Maximum tensile stress\n", - "s_st = (M*g)/A #static stress\n", - "i_1 = s_max / s_st #Impact factor \n", - "print \"Maximum tensile stress is \", round((s_max/1E+6),2), \"MPa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum elongation is 1.79 mm\n", - "Maximum tensile stress is 188.13 MPa\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.18, page no. 148" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "determine displacement at the lower end of bar in various conditions\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "\n", - "#initialisation\n", - "P1 = 108000.0 #Newton\n", - "P2 = 27000.0 #Newton\n", - "L = 2.2 #meter\n", - "A = 480.0 #mm^2\n", - "\n", - "\n", - "#calculations\n", - "\n", - "# Displacement due to load P1 acting alone\n", - "s = (P1/A) #stress in MPa\n", - "e = (s/70000) + (1/628.2)*((s/260)**10) #strain\n", - "D_b = e*L*1e3 #elongation in mm\n", - "print \"elongation when only P1 load acting is = \", round(D_b,2), \" mm\"\n", - "\n", - "# Displacement due to load P2 acting alone\n", - "s_1 = (P2/A) #stress in MPa\n", - "e_1 = (s_1/70000) + (1/628.2)*((s_1/260)**10) #strain\n", - "D_b_1 = e_1*(L/2)*1e3 #elongation in mm (no elongation in lower half)\n", - "print \"elongation when only P2 load acting is = \", round(D_b_1,2), \" mm\"\n", - "\n", - "# Displacement due to both load acting simonmath.taneously\n", - "#upper half\n", - "s_2 = (P1/A) #stress in MPa\n", - "e_2 = (s_2/70000) + (1/628.2)*((s_2/260)**10) #strain\n", - "\n", - "#lower half\n", - "s_3 = (P1+P2)/A #stress in MPa\n", - "e_3 = (s_3/70000) + (1/628.2)*((s_3/260)**10) #strain\n", - "D_b_2 = ((e_2*L)/2 + (e_3*L)/2) * 1e3 # elongation in mm\n", - "print \"elongation when P1 and P2 both loads are acting is = \", round(D_b_2,2), \" mm\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "elongation when only P1 load acting is = 7.9 mm\n", - "elongation when only P2 load acting is = 0.88 mm\n", - "elongation when P1 and P2 both loads are acting is = 12.21 mm\n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Test/chapter2_2.ipynb b/Test/chapter2_2.ipynb deleted file mode 100755 index c4e1ad0f..00000000 --- a/Test/chapter2_2.ipynb +++ /dev/null @@ -1,501 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 2: Axially Loaded Members" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1, page no. 72" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating the number of revolutions for the nut\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "\n", - "W = 2.0 #lb\n", - "b = 10.5 #inch\n", - "c = 6.4 #inch\n", - "k = 4.2 #inch\n", - "p = 1.0/16.0 #inch\n", - "\n", - "#calculation\n", - "\n", - "n = (W*b)/(c*k*p) #inch\n", - "\n", - "#result\n", - "\n", - "print \" No. of revolution required = \", n, \"revolutions\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " No. of revolution required = 12.5 revolutions\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.2, page no. 74" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "finding maximum allowable load\n", - "\"\"\"\n", - "\n", - "import math \n", - "import numpy\n", - "\n", - "#initialisation\n", - "\n", - "Fce_ = 2.0 #dummy variable\n", - "Fbd_ = 3.0 #dummy variable \n", - "Lbd = 480.0 #mm\n", - "Lce = 600.0 #mm\n", - "E = 205e6 #205Gpa\n", - "Abd = 1020.0 #mm\n", - "Ace = 520.0 #mm\n", - "\n", - "#calculation\n", - "Dbd_ = (Fbd_*Lbd)/(E*Abd) #dummy variable\n", - "Dce_ = (Fce_*Lce)/(E*Ace) #dummy variable\n", - "Da = 1 #limiting value\n", - "P = ((((450+225)/225)*(Dbd_ + Dce_) - Dce_ )**(-1)) * Da \n", - "Fce = 2*P # Real value in newton\n", - "Fbd = 3*P #real value in newton\n", - "Dbd = (Fbd*Lbd)/(E*Abd) #print lacement in mm\n", - "Dce = (Fce*Lce)/(E*Ace) # print lacement in mm\n", - "a = numpy.degrees(numpy.arctan(((Da+Dce)/675))) #alpha in degree\n", - "\n", - "#result\n", - "print \"alpha = \", round(a,2), \"degree\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "alpha = 0.11 degree\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3, page no. 80" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculation if vertical displacement\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "P1 = 2100.0 #lb\n", - "P2 = 5600.0 #lb\n", - "b = 25.0 #inch\n", - "a = 28.0 #inch\n", - "A1 = 0.25 #inch^2\n", - "A2 = 0.15 #inch^2\n", - "L1 = 20.0 #inch\n", - "L2 = 34.8 #inch\n", - "E = 29e6 #29Gpa\n", - "\n", - "#Calculations\n", - "P3 = (P2*b)/a \n", - "Ra = P3-P1\n", - "N1 = -Ra \n", - "N2 = P1 \n", - "D = ((N1*L1)/(E*A1)) + ((N2*L2)/(E*A2)) #print lacement\n", - "\n", - "#Result\n", - "print \"Downward print lacement is = \", D, \"inch\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Downward print lacement is = 0.0088 inch\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6, page no. 90" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "obtaing formula and calculating allowable load\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#Numerical calculation of allowable load\n", - "\n", - "d1 = 4.0 #mm\n", - "d2 = 3.0 #mm\n", - "A1 = (math.pi*(d1**2))/4 #area\n", - "A2 = (math.pi*(d2**2))/4 #area\n", - "L1 = 0.4 #meter\n", - "L2 = 0.3 #meter\n", - "E1 = 72e9 #Gpa\n", - "E2 = 45e9 #Gpa\n", - "f1 = L1/(E1*A1) * 1e6 # To cpmpensate for the mm**2\n", - "f2 = L2/(E2*A2) * 1e6 \n", - "s1 = 200e6 #stress\n", - "s2 = 175e6 #stress\n", - "\n", - "#Calculations\n", - "P1 = ( (s1*A1*(4*f1 + f2))/(3*f2) ) * 1e-6 # To cpmpensate for the mm**2\n", - "P2 = ( (s2*A2*(4*f1 + f2))/(6*f1) ) * 1e-6 \n", - "\n", - "#Result\n", - "print \"Newton Minimum allowable stress aomong the two P1 and P2 is smaller one, therefore MAS = \", P2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Newton Minimum allowable stress aomong the two P1 and P2 is smaller one, therefore MAS = 1264.49104307\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.10, page no. 113" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate stress acting on inclined section &\n", - "the complete state of stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "P = 90000.0 #newton\n", - "A = 1200e-6 # meter^2\n", - "s_x = -P/A #stress\n", - "t_1 = 25.0 #for the stresses on ab and cd plane\n", - "\n", - "#Calculations\n", - "s_1 = s_x*(math.cos(math.radians(t_1))**2)\n", - "T_1 = -s_x*math.cos(math.radians(t_1))*math.sin(math.radians(t_1))\n", - "t_2 = -65.0 #for the stresses on ad and bc plane\n", - "s_2 = s_x*(math.cos(math.radians(t_2))**2)\n", - "T_2 = -s_x*math.cos(math.radians(t_2))*math.sin(math.radians(t_2))\n", - "\n", - "#Result\n", - "print \"The normal and shear stresses on the plane ab and cd are\", round((T_1/1E+6),2), round((s_1/1E+6),2), \"MPa respecively\" \n", - "print \"respecively The normal and shear stresses on the plane ad and bc are\", round((T_2/1E+6),2), round((s_2/1E+6),2), \"MPa respecively\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The normal and shear stresses on the plane ab and cd are 28.73 -61.6 MPa respecively\n", - "respecively The normal and shear stresses on the plane ad and bc are -28.73 -13.4 MPa respecively\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.11, page no. 114" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Calculate the vertical displacement of the joint\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "# Value of s_x based on allowable stresses on glued joint\n", - "\n", - "#initialisation\n", - "s_t = -750.0 #psi\n", - "t = -50.0 #degree\n", - "T_t = -500.0 #psi\n", - "\n", - "sg_x_1 = s_t/(math.cos(math.radians(t))**2)\n", - "sg_x_2 = -T_t/(math.cos(math.radians(t))*math.sin(math.radians(t)))\n", - "\n", - "# Value of s_x based on allowable stresses on plastic\n", - "\n", - "sp_x_1 = -1100.0 #psi\n", - "T_t_p = 600.0 #psi\n", - "t_p = 45.0 #degree\n", - "sp_x_2 = -T_t_p/(math.cos(math.radians(t_p))*math.sin(math.radians(t_p)))\n", - "\n", - "# Minimum width of bar\n", - "\n", - "P = 8000.0 #lb\n", - "A = P/sg_x_2\n", - "b_min = math.sqrt(abs(A)) #inch\n", - "print \"The minimum width of the bar is\", round(b_min,2), \"inch\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The minimum width of the bar is 2.81 inch\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.15, page no. 126" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Comparison of energy-absorbing capacity with different type of bolts\n", - "\"\"\"\n", - "\n", - "import math \n", - "#Bolt with reduced shank diameter\n", - "\n", - "#initialisation\n", - "g = 1.50 # inch\n", - "d = 0.5 #inch\n", - "t = 0.25 #inch\n", - "d_r = 0.406 #inch\n", - "L = 13.5 #inch\n", - "\n", - "#calculation\n", - "ratio = ((g*(d**2))/(((g-t)*(d_r**2))+(t*(d**2)))) #U2/U1\n", - "\n", - "print \"The energy absorbing capacity of the bolts with reduced shank diameter\", round(ratio,2)\n", - "ratio_1 = ( (((L-t)*(d_r**2))+(t*(d**2))) / ((2*(g-t)*(d_r**2))+2*(t*(d**2))) ) #U3/2U1\n", - "print \"The energy absorbing capacity of the long bolts\", round(ratio_1,2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The energy absorbing capacity of the bolts with reduced shank diameter 1.4\n", - "The energy absorbing capacity of the long bolts 4.18\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - " Example 2.16, page no. 133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Determine the maximum elongation and tensile stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "# Maximum elongation\n", - "M = 20 #kg\n", - "g = 9.81 #m/s^2\n", - "L = 2 #meter\n", - "E = 210e9 #210Gpa\n", - "h = 0.15 #meter\n", - "diameter = 0.015 #milimeter\n", - "\n", - "#Calculations & Result\n", - "A = (math.pi/4)*(diameter**2) #area\n", - "D_st = ((M*g*L)/(E*A)) \n", - "D_max = D_st*(1+(1+(2*h/D_st))**0.5) \n", - "D_max_1 = math.sqrt(2*h*D_st) # another approach to find D_max\n", - "i = D_max / D_st # Impact factor\n", - "print \"Maximum elongation is\",round((D_max/1E-3),2), \"mm\" # Maximum tensile stress\n", - "s_max = (E*D_max)/L #Maximum tensile stress\n", - "s_st = (M*g)/A #static stress\n", - "i_1 = s_max / s_st #Impact factor \n", - "print \"Maximum tensile stress is \", round((s_max/1E+6),2), \"MPa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum elongation is 1.79 mm\n", - "Maximum tensile stress is 188.13 MPa\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.18, page no. 148" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "determine displacement at the lower end of bar in various conditions\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "\n", - "#initialisation\n", - "P1 = 108000.0 #Newton\n", - "P2 = 27000.0 #Newton\n", - "L = 2.2 #meter\n", - "A = 480.0 #mm^2\n", - "\n", - "\n", - "#calculations\n", - "\n", - "# Displacement due to load P1 acting alone\n", - "s = (P1/A) #stress in MPa\n", - "e = (s/70000) + (1/628.2)*((s/260)**10) #strain\n", - "D_b = e*L*1e3 #elongation in mm\n", - "print \"elongation when only P1 load acting is = \", round(D_b,2), \" mm\"\n", - "\n", - "# Displacement due to load P2 acting alone\n", - "s_1 = (P2/A) #stress in MPa\n", - "e_1 = (s_1/70000) + (1/628.2)*((s_1/260)**10) #strain\n", - "D_b_1 = e_1*(L/2)*1e3 #elongation in mm (no elongation in lower half)\n", - "print \"elongation when only P2 load acting is = \", round(D_b_1,2), \" mm\"\n", - "\n", - "# Displacement due to both load acting simonmath.taneously\n", - "#upper half\n", - "s_2 = (P1/A) #stress in MPa\n", - "e_2 = (s_2/70000) + (1/628.2)*((s_2/260)**10) #strain\n", - "\n", - "#lower half\n", - "s_3 = (P1+P2)/A #stress in MPa\n", - "e_3 = (s_3/70000) + (1/628.2)*((s_3/260)**10) #strain\n", - "D_b_2 = ((e_2*L)/2 + (e_3*L)/2) * 1e3 # elongation in mm\n", - "print \"elongation when P1 and P2 both loads are acting is = \", round(D_b_2,2), \" mm\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "elongation when only P1 load acting is = 7.9 mm\n", - "elongation when only P2 load acting is = 0.88 mm\n", - "elongation when P1 and P2 both loads are acting is = 12.21 mm\n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Test/screenshots/screen1.png b/Test/screenshots/screen1.png deleted file mode 100755 index 2e923aea..00000000 Binary files a/Test/screenshots/screen1.png and /dev/null differ diff --git a/Test/screenshots/screen1_1.png b/Test/screenshots/screen1_1.png deleted file mode 100755 index 2e923aea..00000000 Binary files a/Test/screenshots/screen1_1.png and /dev/null differ diff --git a/Test/screenshots/screen2.png b/Test/screenshots/screen2.png deleted file mode 100755 index eb6ad8e1..00000000 Binary files a/Test/screenshots/screen2.png and /dev/null differ diff --git a/Test/screenshots/screen2_1.png b/Test/screenshots/screen2_1.png deleted file mode 100755 index eb6ad8e1..00000000 Binary files a/Test/screenshots/screen2_1.png and /dev/null differ diff --git a/Test/screenshots/screen2_2.png b/Test/screenshots/screen2_2.png deleted file mode 100755 index eb6ad8e1..00000000 Binary files a/Test/screenshots/screen2_2.png and /dev/null differ diff --git a/Test/screenshots/screen2_3.png b/Test/screenshots/screen2_3.png deleted file mode 100755 index eb6ad8e1..00000000 Binary files a/Test/screenshots/screen2_3.png and /dev/null differ diff --git a/Test/screenshots/screen3.png b/Test/screenshots/screen3.png deleted file mode 100755 index ff023b0d..00000000 Binary files a/Test/screenshots/screen3.png and /dev/null differ diff --git a/Test/screenshots/screen3_1.png b/Test/screenshots/screen3_1.png deleted file mode 100755 index ff023b0d..00000000 Binary files a/Test/screenshots/screen3_1.png and /dev/null differ diff --git a/Test/screenshots/screen3_2.png b/Test/screenshots/screen3_2.png deleted file mode 100755 index ff023b0d..00000000 Binary files a/Test/screenshots/screen3_2.png and /dev/null differ diff --git a/TestContribution/Chapter2.ipynb b/TestContribution/Chapter2.ipynb deleted file mode 100755 index f5907f3a..00000000 --- a/TestContribution/Chapter2.ipynb +++ /dev/null @@ -1,322 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:d3b8a40a5268a38ad3fc311ebed2078460c9192ee65f2f5e3922c8f65a52bf49" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 2: Properties of Pure Substances" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.1:pg-22" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# initialization of variables\n", - "\n", - "m=1; #mass of saturated water in kg\n", - "\n", - " # All the necessary values are taken from table C-2\n", - " \n", - "# part (a)\n", - "\n", - "P=0.001; # Pressure in MPa\n", - "vf=0.001; #specific volume of saturated liquid at 0.001 Mpa in Kg/m^3\n", - "vg=129.2; # specific volume of saturated vapour at 0.001 Mpa in Kg/m^3\n", - "deltaV=m*(vg-vf) # by properties of pure substance \n", - "# result\n", - "print \"The Volume change at pressure \",(P),\" MPa is\",round(deltaV,1),\" m^3/kg \\n\"\n", - "\n", - "# part (b) \n", - "\n", - "P=0.10; # Pressure in MPa\n", - "vf=0.001; # specific volume of saturated liquid at 0.26 MPa( it is same from at 0.2 and 0.3 MPa upto 4 decimals)\n", - "vg=1.694; # specific volume of saturated vapour at 0.1 Mpa\n", - "deltaV=m*(vg-vf) # by properties of pure substance\n", - "# result\n", - "print \"The Volume change at pressure \",(P),\" MPa is\",round(deltaV,3),\" m^3/kg \\n\"\n", - "\n", - "# part (c) \n", - "P=10; # Pressure in MPa\n", - "vf=0.00145; # specific volume of saturated liquid at 10 MPa\n", - "vg=0.01803; # specific volume of saturated vapour at 10 MPa\n", - "deltaV=m*(vg-vf) # by properties of pure substance \n", - "# result\n", - "print \"The Volume change at pressure \",(P),\" MPa is\",round(deltaV,5),\" m^3/kg \\n\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The Volume change at pressure 0.001 MPa is 129.2 m^3/kg \n", - "\n", - "The Volume change at pressure 0.1 MPa is 1.693 m^3/kg \n", - "\n", - "The Volume change at pressure 10 MPa is 0.01658 m^3/kg \n", - "\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2:pg-23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# initialization of variables\n", - "m=4.0 # mass of water in kg\n", - "V=1.0 # volume in m^3\n", - "T=150 # temperature of water in degree centigrade\n", - "\n", - "# TABLE C-1 is used for values in wet region\n", - "# Part (a)\n", - "P=475.8 # pressure in KPa in wet region at temperature of 150 *C\n", - "print \" The pressure is\",round(P,1),\" kPa \\n\"\n", - "\n", - "# Part (b)\n", - "#first we determine the dryness fraction\n", - "v=V/m # specific volume of water\n", - "vg=0.3928 # specific volume of saturated vapour @150 degree celsius\n", - "vf=0.00109 # specific volume of saturated liquid @150 degree celsius\n", - "x=(v-vf)/(vg-vf); # dryness fraction\n", - "mg=m*x; # mass of vapour\n", - "print \" The mass of vapour present is\",round(mg,3),\" kg \\n\"\n", - "\n", - "# Part(c) \n", - "Vg=vg*mg; # volume of vapour\n", - "print \" The volume of vapour is\",round(Vg,4),\" m^3\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The pressure is 475.8 kPa \n", - "\n", - " The mass of vapour present is 2.542 kg \n", - "\n", - " The volume of vapour is 0.9984 m^3\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.3:pg-23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# initialization of variables\n", - "m=4 # mass of water in kg\n", - "P=220 # pressure in KPa\n", - "x=0.8 # quality of steam\n", - "\n", - "# Table C-2 is used for values\n", - "\n", - "vg=(P-200)*(0.6058-0.8857)/(300-200)+0.8857 # specific volume of saturated vapour @ given pressure by interpolating\n", - "vf=0.0011 # specific volume of saturated liquid at 220 KPa\n", - "v=vf+x*(vg-vf)# property of pure substance\n", - "V=m*v # total volume\n", - "#result\n", - "print \"The Total volume of the mixture is \",round(V,3),\" m^3\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The Total volume of the mixture is 2.656 m^3\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Ex2.4:pg-23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# initialization of variables\n", - "m=2 # mass of water in lb\n", - "P=540 # pressure in psi\n", - "T=700 # temperature in degree fahrenheit\n", - " # Table C-3E is used for values\n", - "v=1.3040+(P-500)*(1.0727-1.3030)/(600-500) # specific volue by interpolatin between 500 and 600 psi\n", - "V=m*v # final volume\n", - "print \"The Final Volume is\",round(V,3),\" ft^3\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The Final Volume is 2.424 ft^3\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.5:pg-25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# initialization of variables\n", - "V=0.6 # volume of tyre in m^3\n", - "Pgauge=200 # gauge pressure in KPa\n", - "T=20+273 # temperature converted to kelvin\n", - "Patm=100 # atmospheric pressure in KPa\n", - "R=287 # gas constant in Nm/kg.K\n", - "Pabs=(Pgauge+Patm)*1000 # calculating absolute pressue in Pa \n", - "\n", - "m=Pabs*V/(R*T)# mass from ideal gas equation\n", - "print \"The Mass of air is\",round(m,2),\" Kg\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The Mass of air is 2.14 Kg\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6:pg-26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "# initialization of variables\n", - "T=500+273 # temperature of steam in kelvin\n", - "rho=24.0 # density in Kg/m^3\n", - "R=0.462 # gas constant from Table B-2\n", - "v=1/rho # specific volume and density relation\n", - "# PART (a)\n", - "P=rho*R*T # from Ideal gas equation\n", - "print \" PART (a) The Pressure is \",int(P),\" KPa \\n\"\n", - "# answer is approximated in textbook\n", - "\n", - "# PART (b)\n", - "a=1.703 # van der Waal's constant a value from Table B-8\n", - "b=0.00169 # van der Waal's constant b value from Table B-8\n", - "P=(R*T/(v-b))-(a/v**2) # Pressure from van der Waals equation\n", - "print \" PART (b) The Pressure is \",int(P),\" KPa \\n\"\n", - "# answer is approximated in textbook\n", - "\n", - "# PART (c)\n", - "a=43.9 # van der Waal's constant a value from Table B-8\n", - "b=0.00117 # van der Waal's constant b value from Table B-8\n", - "\n", - "P=(R*T/(v-b))-(a/(v*(v+b)*math.sqrt(T))) # Redlich-Kwong equation\n", - "print \" PART (c) The Pressure is \",int(P),\" KPa \\n\"\n", - "# answer is approximated in textbook\n", - "\n", - "# PART (d)\n", - "Tcr=947.4 # compressibilty temperature from table B-3\n", - "Pcr=22100 # compressibility pressure from table B-3\n", - "\n", - "TR=T/Tcr # reduced temperature\n", - "PR=P/Pcr # reduced pressure\n", - "Z=0.93 # from compressiblility chart\n", - "P=Z*R*T/v # Pressure in KPa\n", - "print \" PART (d) The Pressure is \",int(P),\" KPa \\n\"\n", - "# answer is approximated in textbook\n", - "\n", - "# PART (e)\n", - "P=8000 # pressure from steam table @ 500*c and v= 0.0417 m^3\n", - "print \" PART (e) The Pressure is \",int(P),\" KPa \\n\"\n", - "# answer is approximated in textbook" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " PART (a) The Pressure is 8571 KPa \n", - "\n", - " PART (b) The Pressure is 7952 KPa \n", - "\n", - " PART (c) The Pressure is 7934 KPa \n", - "\n", - " PART (d) The Pressure is 7971 KPa \n", - "\n", - " PART (e) The Pressure is 8000 KPa \n", - "\n" - ] - } - ], - "prompt_number": 13 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/TestContribution/README.txt b/TestContribution/README.txt deleted file mode 100755 index e9a60064..00000000 --- a/TestContribution/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: Test Contributor -Course: mtech -College/Institute/Organization: IIT -Department/Designation: CS -Book Title: TestContribution -Author: TestContribution -Publisher: TestContribution -Year of publication: Test -Isbn: TestContribution -Edition: TestContributio \ No newline at end of file diff --git a/TestContribution/abhisheksharma.ipynb b/TestContribution/abhisheksharma.ipynb deleted file mode 100755 index e09e86cb..00000000 --- a/TestContribution/abhisheksharma.ipynb +++ /dev/null @@ -1,946 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:54ccd26f8e7172369b740037968be286180ddfff5f2fc10ebe6be83fc34647f9" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "HF,VHF AND UHF ANTENNAS (CHAPTER 6)" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.1,PAGE NUMBER 278 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 30 # frequency in MHz\n", - "f = 30*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "Delta = 30 # angle of elevation in Degrees\n", - "\n", - "#calculation\n", - "\n", - "H = lamda/(4 * sin(Delta*pi/180)) # Rhombic height in m\n", - "l = lamda/(2 * sin(Delta*pi/180) **2) # wire length in m\n", - "phi = 90-Delta # tilt angle in Degrees\n", - "\n", - "#Results\n", - "\n", - "print \"Rhombic height is:\",round(H,2),\"meter\"\n", - "print \"Tilt angle is:\",round(phi,2),\"degrees\"\n", - "print \"length of wire is:\",round(l,2),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rhombic height is: 5.0 meter\n", - "Tilt angle is: 60.0 degrees\n", - "length of wire is: 20.0 meter\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.2,PAGE NUMBER 278" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 20 # frequency in MHz\n", - "f = 20*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "\n", - "#calculation\n", - "\n", - "Delta = 10 # angle of elevation in Degrees\n", - "H = lamda/(4 * sin(Delta*pi/180)) # Rhombic height in m\n", - "l = lamda/(2 * sin(Delta*pi/180) **2) # wire length in m\n", - "phi = 90-Delta # tilt angle in Degrees\n", - "\n", - "#Results\n", - "\n", - "print \"Rhombic height is:\",round(H,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi,2),\"degrees\"\n", - "print \"length of wire is:\",round(l,3),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rhombic height is: 21.595 meter\n", - "Tilt angle is: 80.0 degrees\n", - "length of wire is: 248.726 meter\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.3,PAGE NUMBER 279-281" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin,cos\n", - "\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 30 # frequency in MHz\n", - "f = 30*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "\n", - "#calculation and results:\n", - "\n", - "\n", - "\n", - "print \"for Delta = 10 degrees\"\n", - "\n", - "\n", - "Delta1 = 10 # angle of elevation in Degrees\n", - "H1 = lamda/(4 * sin(Delta1*pi/180)) # Rhombic height in m\n", - "l1 = lamda/(2 * sin(Delta1*pi/180) **2) # wire length in m\n", - "phi1 = 90-Delta1 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H1,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi1,2),\"degrees\"\n", - "print \"length of wire is:\",round(l1,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 15 degrees\"\n", - "\n", - "\n", - "Delta2 = 15 # angle of elevation in Degrees\n", - "H2 = lamda/(4 * sin(Delta2*pi/180)) # Rhombic height in m\n", - "l2 = lamda/(2 * sin(Delta2*pi/180) **2) # wire length in m\n", - "phi2 = 90-Delta2 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H2,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi2,2),\"degrees\"\n", - "print \"length of wire is:\",round(l2,2),\"meter\"\n", - "\n", - "\n", - "\n", - "print \"for Delta = 20 degrees\"\n", - "\n", - "\n", - "Delta3 = 20 # angle of elevation in Degrees\n", - "H3 = lamda/(4 * sin(Delta3*pi/180)) # Rhombic height in m\n", - "l3 = lamda/(2 * sin(Delta3*pi/180) **2) # wire length in m\n", - "phi3 = 90-Delta3 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H3,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi3,2),\"degrees\"\n", - "print \"length of wire is:\",round(l3,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 25 degrees\"\n", - "\n", - "\n", - "Delta4 = 25 # angle of elevation in Degrees\n", - "H4 = lamda/(4 * sin(Delta4*pi/180)) # Rhombic height in m\n", - "l4 = lamda/(2 * sin(Delta4*pi/180) **2) # wire length in m\n", - "phi4 = 90-Delta4 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H4,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi4,2),\"degrees\"\n", - "print \"length of wire is:\",round(l4,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 30 degrees\"\n", - "\n", - "\n", - "Delta5 = 30 # angle of elevation in Degrees\n", - "H5 = lamda/(4 * sin(Delta5*pi/180)) # Rhombic height in m\n", - "l5 = lamda/(2 * sin(Delta5*pi/180) **2) # wire length in m\n", - "phi5 = 90-Delta5 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H5,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi5,2),\"degrees\"\n", - "print \"length of wire is:\",round(l5,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 35 degrees\"\n", - "\n", - "\n", - "Delta6 = 35 # angle of elevation in Degrees\n", - "H6 = lamda/(4 * sin(Delta6*pi/180)) # Rhombic height in m\n", - "l6 = lamda/(2 * sin(Delta6*pi/180) **2) # wire length in m\n", - "phi6 = 90-Delta6 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H6,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi6,2),\"degrees\"\n", - "print \"length of wire is:\",round(l6,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 40 degrees\"\n", - "\n", - "\n", - "Delta7 = 40 # angle of elevation in Degrees\n", - "H7 = lamda/(4 * sin(Delta7*pi/180)) # Rhombic height in m\n", - "l7 = lamda/(2 * sin(Delta7*pi/180) **2) # wire length in m\n", - "phi7 = 90-Delta7 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H7,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi7,2),\"degrees\"\n", - "print \"length of wire is:\",round(l7,2),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for Delta = 10 degrees\n", - "Rhombic height is: 14.397 meter\n", - "Tilt angle is: 80.0 degrees\n", - "length of wire is: 165.82 meter\n", - "for Delta = 15 degrees\n", - "Rhombic height is: 9.659 meter\n", - "Tilt angle is: 75.0 degrees\n", - "length of wire is: 74.64 meter\n", - "for Delta = 20 degrees\n", - "Rhombic height is: 7.31 meter\n", - "Tilt angle is: 70.0 degrees\n", - "length of wire is: 42.74 meter\n", - "for Delta = 25 degrees\n", - "Rhombic height is: 5.916 meter\n", - "Tilt angle is: 65.0 degrees\n", - "length of wire is: 27.99 meter\n", - "for Delta = 30 degrees\n", - "Rhombic height is: 5.0 meter\n", - "Tilt angle is: 60.0 degrees\n", - "length of wire is: 20.0 meter\n", - "for Delta = 35 degrees\n", - "Rhombic height is: 4.359 meter\n", - "Tilt angle is: 55.0 degrees\n", - "length of wire is: 15.2 meter\n", - "for Delta = 40 degrees\n", - "Rhombic height is: 3.889 meter\n", - "Tilt angle is: 50.0 degrees\n", - "length of wire is: 12.1 meter\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.4,PAGE NUMBER 281" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin,cos\n", - "\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 30 # frequency in MHz\n", - "f = 30*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "Delta = 30 # angle of elevation in Degrees\n", - "\n", - "#calculation\n", - "\n", - "k = 0.74 # constant\n", - "H = lamda/(4 * sin(Delta*pi/180)) # Rhombic height in m\n", - "l = lamda/(2 * sin(Delta*pi/180) **2)*k # wire length in m\n", - "phi = 90-Delta # tilt angle in Degrees\n", - "\n", - "#Results\n", - "\n", - "print \"Rhombic height is:\",round(H,2),\"meter\"\n", - "print \"Tilt angle is:\",round(phi,2),\"degrees\"\n", - "print \"length of wire is:\",round(l,2),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rhombic height is: 5.0 meter\n", - "Tilt angle is: 60.0 degrees\n", - "length of wire is: 14.8 meter\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.5,PAGE NUMBER 282" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 20 # frequency in MHz\n", - "f = 20*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "Delta = 20 # angle of elevation in Degrees\n", - "k = 0.74 # constant\n", - "\n", - "#calculation\n", - "\n", - "H = lamda/(4 * sin(Delta*pi/180)) # Rhombic height in m\n", - "l = lamda/(2 * sin(Delta*pi/180) **2)*k # wire length in m\n", - "phi = 90-Delta # tilt angle in Degrees\n", - "\n", - "\n", - "#Results\n", - "\n", - "\n", - "print \"Rhombic height is:\",round(H,2),\"meter\"\n", - "print \"Tilt angle is:\",round(phi,2),\"degrees\"\n", - "print \"length of wire is:\",round(l,2),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rhombic height is: 10.96 meter\n", - "Tilt angle is: 70.0 degrees\n", - "length of wire is: 47.44 meter\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.6,PAGE NUMBER 282" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "\n", - "f_MHz = 172 # frequency in MHz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "#calculation\n", - "\n", - "lamda = c/f_MHz # wavelength in m\n", - "La = 478/f_MHz # length of driven element in feet\n", - "Lr = 492/f_MHz # length of reflector in feet\n", - "Ld = 461.5/f_MHz # length of director in feet\n", - "S = 142/f_MHz # element spacing in feet\n", - "\n", - "\n", - "#Results\n", - "\n", - "\n", - "print \"length of driven element is:\", round(La,2),\"feet\"\n", - "print \"length of reflector is:\", round(Lr,2),\"feet\"\n", - "print \"length of director is:\", round(Ld,3),\"feet\"\n", - "print \"element spacing is:\",round(S,3),\"feet\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "length of driven element is: 2.78 feet\n", - "length of reflector is: 2.86 feet\n", - "length of director is: 2.683 feet\n", - "element spacing is: 0.826 feet\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.7,PAGE NUMBER 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "\n", - "# Variable Declaration\n", - "\n", - "\n", - "G = 12 # required gain in dB\n", - "f = 200 # frequency in MHz \n", - "f = 200*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "#calculations\n", - "\n", - "\n", - "lamda = c/f # wavelength in m\n", - "La = 0.46*lamda # length of driven element in m (note: in book La is given 0.416*lamda misprint)\n", - "Lr = 0.475*lamda # length of reflector in m\n", - "Ld1 = 0.44*lamda # length of director1 in m\n", - "Ld2 = 0.44*lamda # length of director2 in m\n", - "Ld3 = 0.43*lamda # length of director3 in m\n", - "Ld4 = 0.40*lamda # length of director4 in m\n", - "SL = 0.25*lamda # spacing between reflector and driver in m\n", - "Sd = 0.31*lamda # spacing director and driving element in m\n", - "d = 0.01*lamda # diameter of elements in m\n", - "l = 1.5*lamda # length of array in m\n", - "\n", - "\n", - "#Results\n", - "\n", - "\n", - "print \"length of driven element is:\" ,round(La,2),\"m\"\n", - "print \"length of reflector is:\",round(Lr,4),\"m\"\n", - "print \"length of director1 is:\",round(Ld1,2),\"m\"\n", - "print \"length of director2 is:\",round(Ld2,2),\"m\"\n", - "print \"length of director3 is:\",round(Ld3,3),\"m\"\n", - "print \"length of director4 is:\",round(Ld4,2),\"m\"\n", - "print \"spacing between reflector and driver is:\",round(SL,3),\"m\"\n", - "print \"spacing director and driving element is:\",round(Sd,3),\"m\"\n", - "print \"diameter of elements is:\",round(d,3),\"m\"\n", - "print \"length of array is:\",round(l,2),\"m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "length of driven element is: 0.69 m\n", - "length of reflector is: 0.7125 m\n", - "length of director1 is: 0.66 m\n", - "length of director2 is: 0.66 m\n", - "length of director3 is: 0.645 m\n", - "length of director4 is: 0.6 m\n", - "spacing between reflector and driver is: 0.375 m\n", - "spacing director and driving element is: 0.465 m\n", - "diameter of elements is: 0.015 m\n", - "length of array is: 2.25 m\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.8,PAGE NUMBER 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import atan\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "\n", - "G = 9 # required gain in dB\n", - "f_l = 125 # lowest frequency in MHz\n", - "f_l = 125*10**6 # lowest frequency in Hz\n", - "f_h = 500 # highest frequency in MHz\n", - "f_h = 500*10**6 # lowest frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "tau = 0.861 # scaling factor\n", - "sigma = 0.162 # spacing factor\n", - "\n", - "\n", - "#calculation\n", - "\n", - "\n", - "lamda_l = c/f_l # longest wavelength in m\n", - "lamda_s = c/f_h # shortest wavelength in m\n", - "alpha = 2*atan((1-tau)/(4*sigma)) # wedge angle in Degrees\n", - "L1 = lamda_l/2 # in m\n", - "L2 = tau*L1 # in m\n", - "L3 = tau*L2 # in m\n", - "L4 = tau*L3 # in m\n", - "L5 = tau*L4 # in m\n", - "L6 = tau*L5 # in m\n", - "L7 = tau*L6 # in m\n", - "L8 = tau*L7 # in m\n", - "L9 = tau*L8 # in m\n", - "L10 = tau*L9 # in m\n", - "L11 = tau*L10 # in m\n", - "\n", - "# element spacing relation\n", - "#formula : sn = 2*sigma*Ln\n", - "\n", - "\n", - "S1 = 2*sigma*L1 # in m\n", - "S2 = 2*sigma*L2 # in m\n", - "S3 = 2*sigma*L3 # in m\n", - "S4 = 2*sigma*L4 # in m\n", - "S5 = 2*sigma*L5 # in m\n", - "S6 = 2*sigma*L6 # in m\n", - "S7 = 2*sigma*L7 # in m\n", - "S8 = 2*sigma*L8 # in m\n", - "S9 = 2*sigma*L9 # in m\n", - "S10 = 2*sigma*L10 # in m\n", - "S11 = 2*sigma*L11 # in m\n", - "\n", - "\n", - "\n", - "#results\n", - "\n", - "\n", - "print(\"designing of log-periodic antenna:\")\n", - "\n", - "print \"L1 is:\",round(L1,4),\"m\"\n", - "print \"L2 is:\",round(L2,4),\"m\"\n", - "print \"L3 is:\",round(L3,4),\"m\"\n", - "print \"L4 is:\",round(L4,4),\"m\"\n", - "print \"L5 is:\",round(L5,4),\"m\"\n", - "print \"L6 is:\",round(L6,4),\"m\"\n", - "print \"L7 is:\",round(L7,4),\"m\"\n", - "print \"L8 is:\",round(L8,4),\"m\"\n", - "print \"L9 is:\",round(L9,4),\"m\"\n", - "print \"L10 is:\",round(L10,4),\"m\"\n", - "print \"L11 is:\",round(L11,4),\"m\"\n", - "\n", - "print \"elements spacing relation:\"\n", - "\n", - "print \"S1 is:\",round(S1,4),\"m\"\n", - "print \"S2 is:\",round(S2,4),\"m\"\n", - "print \"S3 is:\",round(S3,4),\"m\"\n", - "print \"S4 is:\",round(S4,4),\"m\"\n", - "print \"S5 is:\",round(S5,4),\"m\"\n", - "print \"S6 is:\",round(S6,4),\"m\"\n", - "print \"S7 is:\",round(S7,4),\"m\"\n", - "print \"S8 is:\",round(S8,4),\"m\"\n", - "print \"S9 is:\",round(S9,4),\"m\"\n", - "print \"S10 is:\",round(S10,4),\"m\"\n", - "print \"S11 is:\",round(S11,4),\"m\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "designing of log-periodic antenna:\n", - "L1 is: 1.2 m\n", - "L2 is: 1.0332 m\n", - "L3 is: 0.8896 m\n", - "L4 is: 0.7659 m\n", - "L5 is: 0.6595 m\n", - "L6 is: 0.5678 m\n", - "L7 is: 0.4889 m\n", - "L8 is: 0.4209 m\n", - "L9 is: 0.3624 m\n", - "L10 is: 0.312 m\n", - "L11 is: 0.2687 m\n", - "elements spacing relation:\n", - "S1 is: 0.3888 m\n", - "S2 is: 0.3348 m\n", - "S3 is: 0.2882 m\n", - "S4 is: 0.2482 m\n", - "S5 is: 0.2137 m\n", - "S6 is: 0.184 m\n", - "S7 is: 0.1584 m\n", - "S8 is: 0.1364 m\n", - "S9 is: 0.1174 m\n", - "S10 is: 0.1011 m\n", - "S11 is: 0.087 m\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.9,PAGE NUMBER 285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,cos,sqrt\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "E_rms = 10 # electric field in mV/m\n", - "E_rms = 10*10 **-3 # electric field in V/m\n", - "f = 2 # frequency in MHz\n", - "f = 2*10 **6 # frequency in Hz\n", - "N = 10 # number of turns\n", - "phi = 0 # angle between the plane of loop and direction of incident wave in Degrees\n", - "S = 1.4 # area of loop antenna in m **2\n", - "c = 3*10 **8 # speed of light in m/s\n", - "\n", - "#calculation\n", - "\n", - "lamda = c/f # wavelength in m\n", - "E_max = sqrt(2)*E_rms # electric field in V/m\n", - "V_rms = (2*pi*E_max*S*N/lamda)*cos(phi) # induced voltage\n", - "\n", - "#Result\n", - "\n", - "print \"induced voltage is:\",round(V_rms*1000,2),\"mV\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "induced voltage is: 8.29 mV\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.10,PAGE NUMBER 285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variable Declaration\n", - "\n", - "\n", - "D = 0.5 # diameter of loop antenna in m\n", - "a = D/2 # radius of loop antenna in m\n", - "f = 1 # frequency in MHz\n", - "f = 1*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "#calculation\n", - "\n", - "lamda = c/f # wavelength in m\n", - "Rr = 3720*(a/lamda) # radiation resistance of loop antenna in ohm\n", - "\n", - "\n", - "#Results\n", - "\n", - "print \"radiation resistance of loop antenna is:\",Rr,\"ohm\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "radiation resistance of loop antenna is: 3.1 ohm\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.11,PAGE NUMBER 285-286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# Variable Declaration\n", - "\n", - "a = 0.5 # radius of loop antenna in m\n", - "f = 0.9 # frequency in MHz\n", - "f = 0.9*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "#calculation\n", - "\n", - "lamda = c/f # wavelength in m\n", - "k = (2*pi*a)/lamda # constant\n", - "\n", - "#Results\n", - "\n", - "print \"the value of k is:\",round(k,2)\n", - "print \"since,k<1/3\"\n", - "print \"So Directivity of loop antenna is D = 1.5\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the value of k is: 0.01\n", - "since,k<1/3\n", - "So Directivity of loop antenna is D = 1.5\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.13,PAGE NUMBER 286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from sympy import Symbol\n", - "\n", - "#variable declaration and calculation\n", - "\n", - "Lm = Symbol('Lm') # defining Lm as lambda\n", - "d = 1.5*Lm # diameter of antenna in m\n", - "a = d/2 # radius of antenna in m\n", - "Rr = 3720*(a/Lm) # radiation resistance of loop antenna in ohm\n", - "D = 4.25*(a/Lm) # Directivity of the loop antenna\n", - "\n", - "#results\n", - "\n", - "print \"radiation resistance of the loop antenna is:\",round(Rr,0),\"ohm\"\n", - "print \"Directivity of the loop antenna is:\",round(D,4)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "radiation resistance of the loop antenna is: 2790.0 ohm\n", - "Directivity of the loop antenna is: 3.1875\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.14,PAGE NUMBER 287" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import sqrt,pi\n", - "from sympy import Symbol\n", - "\n", - "#Variable declaration\n", - "\n", - "Gp = 28 # power gain\n", - "\n", - "#calculations\n", - "\n", - "Lm = Symbol('Lm') # defining Lm as lamda\n", - "d = Lm/2 # length of dipole\n", - "\n", - "#formula : Gp = 4*(L/lamda)\n", - "\n", - "L = Gp*Lm/4 # array length\n", - "N = 7*2 # Number of elements in the array when spaced at lamda/2\n", - "\n", - "# formula : B.W = 2*sqrt((2*/N)*(lamda/d))\n", - "\n", - "BW = 2*sqrt(2*Lm/(N*d)) # null-to-null beam width in radians\n", - "BW_d = BW*180/pi # null-to-null beam width in degrees\n", - "\n", - "#Results\n", - "\n", - "print \"Number of elements in the array when spaced at lamda/2 are:\",N\n", - "print \"array length(where Lm is wavelength in m) is:\",L,\"m\"\n", - "print \"null-to-null beam width is:\",round(BW_d,1),\"degrees\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of elements in the array when spaced at lamda/2 are: 14\n", - "array length(where Lm is wavelength in m) is: 7*Lm m\n", - "null-to-null beam width is: 61.3 degrees\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.15,PAGE NUMBER 287" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "S = 0.05 # spacing in m\n", - "Dh = 0.1 # diameter of helical antenna in m\n", - "N = 20 # number of turns\n", - "f = 1000 # frequency in MHz\n", - "f = 1000*10**6 # frequency in MHz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "\n", - "#calculation\n", - "\n", - "\n", - "lamda = c/f # wavelength in m\n", - "C = pi*Dh # circumfrence of helix in m\n", - "La = N*S # axial legth in m\n", - "phi_not = (115*(lamda**(3/2))/(C*sqrt(La))) # B.W.F.N., null-to-null beamwidth of main beam in Degreess\n", - "phi = (52*lamda**(3/2)/(C*sqrt(La))) # H.P.B.W, half power beamwidth in Degreess\n", - "D = (15*N*C**2*S/(lamda)**3) # Directivity\n", - "\n", - "#Results\n", - "\n", - "print \"B.W.F.N., null-to-null beamwidth of main beam is:\",round(phi_not,1),\"degrees\"\n", - "print \"H.P.B.W, half power beamwidth is:\",round(phi,1),\"degrees\"\n", - "print \"Directivity is:\",round(D,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "B.W.F.N., null-to-null beamwidth of main beam is: 60.1 degrees\n", - "H.P.B.W, half power beamwidth is: 27.2 degrees\n", - "Directivity is: 54.83\n" - ] - } - ], - "prompt_number": 14 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/TestContribution/abhisheksharma_1.ipynb b/TestContribution/abhisheksharma_1.ipynb deleted file mode 100755 index e09e86cb..00000000 --- a/TestContribution/abhisheksharma_1.ipynb +++ /dev/null @@ -1,946 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:54ccd26f8e7172369b740037968be286180ddfff5f2fc10ebe6be83fc34647f9" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "HF,VHF AND UHF ANTENNAS (CHAPTER 6)" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.1,PAGE NUMBER 278 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 30 # frequency in MHz\n", - "f = 30*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "Delta = 30 # angle of elevation in Degrees\n", - "\n", - "#calculation\n", - "\n", - "H = lamda/(4 * sin(Delta*pi/180)) # Rhombic height in m\n", - "l = lamda/(2 * sin(Delta*pi/180) **2) # wire length in m\n", - "phi = 90-Delta # tilt angle in Degrees\n", - "\n", - "#Results\n", - "\n", - "print \"Rhombic height is:\",round(H,2),\"meter\"\n", - "print \"Tilt angle is:\",round(phi,2),\"degrees\"\n", - "print \"length of wire is:\",round(l,2),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rhombic height is: 5.0 meter\n", - "Tilt angle is: 60.0 degrees\n", - "length of wire is: 20.0 meter\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.2,PAGE NUMBER 278" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 20 # frequency in MHz\n", - "f = 20*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "\n", - "#calculation\n", - "\n", - "Delta = 10 # angle of elevation in Degrees\n", - "H = lamda/(4 * sin(Delta*pi/180)) # Rhombic height in m\n", - "l = lamda/(2 * sin(Delta*pi/180) **2) # wire length in m\n", - "phi = 90-Delta # tilt angle in Degrees\n", - "\n", - "#Results\n", - "\n", - "print \"Rhombic height is:\",round(H,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi,2),\"degrees\"\n", - "print \"length of wire is:\",round(l,3),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rhombic height is: 21.595 meter\n", - "Tilt angle is: 80.0 degrees\n", - "length of wire is: 248.726 meter\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.3,PAGE NUMBER 279-281" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin,cos\n", - "\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 30 # frequency in MHz\n", - "f = 30*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "\n", - "#calculation and results:\n", - "\n", - "\n", - "\n", - "print \"for Delta = 10 degrees\"\n", - "\n", - "\n", - "Delta1 = 10 # angle of elevation in Degrees\n", - "H1 = lamda/(4 * sin(Delta1*pi/180)) # Rhombic height in m\n", - "l1 = lamda/(2 * sin(Delta1*pi/180) **2) # wire length in m\n", - "phi1 = 90-Delta1 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H1,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi1,2),\"degrees\"\n", - "print \"length of wire is:\",round(l1,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 15 degrees\"\n", - "\n", - "\n", - "Delta2 = 15 # angle of elevation in Degrees\n", - "H2 = lamda/(4 * sin(Delta2*pi/180)) # Rhombic height in m\n", - "l2 = lamda/(2 * sin(Delta2*pi/180) **2) # wire length in m\n", - "phi2 = 90-Delta2 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H2,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi2,2),\"degrees\"\n", - "print \"length of wire is:\",round(l2,2),\"meter\"\n", - "\n", - "\n", - "\n", - "print \"for Delta = 20 degrees\"\n", - "\n", - "\n", - "Delta3 = 20 # angle of elevation in Degrees\n", - "H3 = lamda/(4 * sin(Delta3*pi/180)) # Rhombic height in m\n", - "l3 = lamda/(2 * sin(Delta3*pi/180) **2) # wire length in m\n", - "phi3 = 90-Delta3 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H3,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi3,2),\"degrees\"\n", - "print \"length of wire is:\",round(l3,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 25 degrees\"\n", - "\n", - "\n", - "Delta4 = 25 # angle of elevation in Degrees\n", - "H4 = lamda/(4 * sin(Delta4*pi/180)) # Rhombic height in m\n", - "l4 = lamda/(2 * sin(Delta4*pi/180) **2) # wire length in m\n", - "phi4 = 90-Delta4 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H4,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi4,2),\"degrees\"\n", - "print \"length of wire is:\",round(l4,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 30 degrees\"\n", - "\n", - "\n", - "Delta5 = 30 # angle of elevation in Degrees\n", - "H5 = lamda/(4 * sin(Delta5*pi/180)) # Rhombic height in m\n", - "l5 = lamda/(2 * sin(Delta5*pi/180) **2) # wire length in m\n", - "phi5 = 90-Delta5 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H5,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi5,2),\"degrees\"\n", - "print \"length of wire is:\",round(l5,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 35 degrees\"\n", - "\n", - "\n", - "Delta6 = 35 # angle of elevation in Degrees\n", - "H6 = lamda/(4 * sin(Delta6*pi/180)) # Rhombic height in m\n", - "l6 = lamda/(2 * sin(Delta6*pi/180) **2) # wire length in m\n", - "phi6 = 90-Delta6 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H6,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi6,2),\"degrees\"\n", - "print \"length of wire is:\",round(l6,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 40 degrees\"\n", - "\n", - "\n", - "Delta7 = 40 # angle of elevation in Degrees\n", - "H7 = lamda/(4 * sin(Delta7*pi/180)) # Rhombic height in m\n", - "l7 = lamda/(2 * sin(Delta7*pi/180) **2) # wire length in m\n", - "phi7 = 90-Delta7 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H7,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi7,2),\"degrees\"\n", - "print \"length of wire is:\",round(l7,2),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for Delta = 10 degrees\n", - "Rhombic height is: 14.397 meter\n", - "Tilt angle is: 80.0 degrees\n", - "length of wire is: 165.82 meter\n", - "for Delta = 15 degrees\n", - "Rhombic height is: 9.659 meter\n", - "Tilt angle is: 75.0 degrees\n", - "length of wire is: 74.64 meter\n", - "for Delta = 20 degrees\n", - "Rhombic height is: 7.31 meter\n", - "Tilt angle is: 70.0 degrees\n", - "length of wire is: 42.74 meter\n", - "for Delta = 25 degrees\n", - "Rhombic height is: 5.916 meter\n", - "Tilt angle is: 65.0 degrees\n", - "length of wire is: 27.99 meter\n", - "for Delta = 30 degrees\n", - "Rhombic height is: 5.0 meter\n", - "Tilt angle is: 60.0 degrees\n", - "length of wire is: 20.0 meter\n", - "for Delta = 35 degrees\n", - "Rhombic height is: 4.359 meter\n", - "Tilt angle is: 55.0 degrees\n", - "length of wire is: 15.2 meter\n", - "for Delta = 40 degrees\n", - "Rhombic height is: 3.889 meter\n", - "Tilt angle is: 50.0 degrees\n", - "length of wire is: 12.1 meter\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.4,PAGE NUMBER 281" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin,cos\n", - "\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 30 # frequency in MHz\n", - "f = 30*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "Delta = 30 # angle of elevation in Degrees\n", - "\n", - "#calculation\n", - "\n", - "k = 0.74 # constant\n", - "H = lamda/(4 * sin(Delta*pi/180)) # Rhombic height in m\n", - "l = lamda/(2 * sin(Delta*pi/180) **2)*k # wire length in m\n", - "phi = 90-Delta # tilt angle in Degrees\n", - "\n", - "#Results\n", - "\n", - "print \"Rhombic height is:\",round(H,2),\"meter\"\n", - "print \"Tilt angle is:\",round(phi,2),\"degrees\"\n", - "print \"length of wire is:\",round(l,2),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rhombic height is: 5.0 meter\n", - "Tilt angle is: 60.0 degrees\n", - "length of wire is: 14.8 meter\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.5,PAGE NUMBER 282" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 20 # frequency in MHz\n", - "f = 20*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "Delta = 20 # angle of elevation in Degrees\n", - "k = 0.74 # constant\n", - "\n", - "#calculation\n", - "\n", - "H = lamda/(4 * sin(Delta*pi/180)) # Rhombic height in m\n", - "l = lamda/(2 * sin(Delta*pi/180) **2)*k # wire length in m\n", - "phi = 90-Delta # tilt angle in Degrees\n", - "\n", - "\n", - "#Results\n", - "\n", - "\n", - "print \"Rhombic height is:\",round(H,2),\"meter\"\n", - "print \"Tilt angle is:\",round(phi,2),\"degrees\"\n", - "print \"length of wire is:\",round(l,2),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rhombic height is: 10.96 meter\n", - "Tilt angle is: 70.0 degrees\n", - "length of wire is: 47.44 meter\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.6,PAGE NUMBER 282" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "\n", - "f_MHz = 172 # frequency in MHz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "#calculation\n", - "\n", - "lamda = c/f_MHz # wavelength in m\n", - "La = 478/f_MHz # length of driven element in feet\n", - "Lr = 492/f_MHz # length of reflector in feet\n", - "Ld = 461.5/f_MHz # length of director in feet\n", - "S = 142/f_MHz # element spacing in feet\n", - "\n", - "\n", - "#Results\n", - "\n", - "\n", - "print \"length of driven element is:\", round(La,2),\"feet\"\n", - "print \"length of reflector is:\", round(Lr,2),\"feet\"\n", - "print \"length of director is:\", round(Ld,3),\"feet\"\n", - "print \"element spacing is:\",round(S,3),\"feet\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "length of driven element is: 2.78 feet\n", - "length of reflector is: 2.86 feet\n", - "length of director is: 2.683 feet\n", - "element spacing is: 0.826 feet\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.7,PAGE NUMBER 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "\n", - "# Variable Declaration\n", - "\n", - "\n", - "G = 12 # required gain in dB\n", - "f = 200 # frequency in MHz \n", - "f = 200*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "#calculations\n", - "\n", - "\n", - "lamda = c/f # wavelength in m\n", - "La = 0.46*lamda # length of driven element in m (note: in book La is given 0.416*lamda misprint)\n", - "Lr = 0.475*lamda # length of reflector in m\n", - "Ld1 = 0.44*lamda # length of director1 in m\n", - "Ld2 = 0.44*lamda # length of director2 in m\n", - "Ld3 = 0.43*lamda # length of director3 in m\n", - "Ld4 = 0.40*lamda # length of director4 in m\n", - "SL = 0.25*lamda # spacing between reflector and driver in m\n", - "Sd = 0.31*lamda # spacing director and driving element in m\n", - "d = 0.01*lamda # diameter of elements in m\n", - "l = 1.5*lamda # length of array in m\n", - "\n", - "\n", - "#Results\n", - "\n", - "\n", - "print \"length of driven element is:\" ,round(La,2),\"m\"\n", - "print \"length of reflector is:\",round(Lr,4),\"m\"\n", - "print \"length of director1 is:\",round(Ld1,2),\"m\"\n", - "print \"length of director2 is:\",round(Ld2,2),\"m\"\n", - "print \"length of director3 is:\",round(Ld3,3),\"m\"\n", - "print \"length of director4 is:\",round(Ld4,2),\"m\"\n", - "print \"spacing between reflector and driver is:\",round(SL,3),\"m\"\n", - "print \"spacing director and driving element is:\",round(Sd,3),\"m\"\n", - "print \"diameter of elements is:\",round(d,3),\"m\"\n", - "print \"length of array is:\",round(l,2),\"m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "length of driven element is: 0.69 m\n", - "length of reflector is: 0.7125 m\n", - "length of director1 is: 0.66 m\n", - "length of director2 is: 0.66 m\n", - "length of director3 is: 0.645 m\n", - "length of director4 is: 0.6 m\n", - "spacing between reflector and driver is: 0.375 m\n", - "spacing director and driving element is: 0.465 m\n", - "diameter of elements is: 0.015 m\n", - "length of array is: 2.25 m\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.8,PAGE NUMBER 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import atan\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "\n", - "G = 9 # required gain in dB\n", - "f_l = 125 # lowest frequency in MHz\n", - "f_l = 125*10**6 # lowest frequency in Hz\n", - "f_h = 500 # highest frequency in MHz\n", - "f_h = 500*10**6 # lowest frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "tau = 0.861 # scaling factor\n", - "sigma = 0.162 # spacing factor\n", - "\n", - "\n", - "#calculation\n", - "\n", - "\n", - "lamda_l = c/f_l # longest wavelength in m\n", - "lamda_s = c/f_h # shortest wavelength in m\n", - "alpha = 2*atan((1-tau)/(4*sigma)) # wedge angle in Degrees\n", - "L1 = lamda_l/2 # in m\n", - "L2 = tau*L1 # in m\n", - "L3 = tau*L2 # in m\n", - "L4 = tau*L3 # in m\n", - "L5 = tau*L4 # in m\n", - "L6 = tau*L5 # in m\n", - "L7 = tau*L6 # in m\n", - "L8 = tau*L7 # in m\n", - "L9 = tau*L8 # in m\n", - "L10 = tau*L9 # in m\n", - "L11 = tau*L10 # in m\n", - "\n", - "# element spacing relation\n", - "#formula : sn = 2*sigma*Ln\n", - "\n", - "\n", - "S1 = 2*sigma*L1 # in m\n", - "S2 = 2*sigma*L2 # in m\n", - "S3 = 2*sigma*L3 # in m\n", - "S4 = 2*sigma*L4 # in m\n", - "S5 = 2*sigma*L5 # in m\n", - "S6 = 2*sigma*L6 # in m\n", - "S7 = 2*sigma*L7 # in m\n", - "S8 = 2*sigma*L8 # in m\n", - "S9 = 2*sigma*L9 # in m\n", - "S10 = 2*sigma*L10 # in m\n", - "S11 = 2*sigma*L11 # in m\n", - "\n", - "\n", - "\n", - "#results\n", - "\n", - "\n", - "print(\"designing of log-periodic antenna:\")\n", - "\n", - "print \"L1 is:\",round(L1,4),\"m\"\n", - "print \"L2 is:\",round(L2,4),\"m\"\n", - "print \"L3 is:\",round(L3,4),\"m\"\n", - "print \"L4 is:\",round(L4,4),\"m\"\n", - "print \"L5 is:\",round(L5,4),\"m\"\n", - "print \"L6 is:\",round(L6,4),\"m\"\n", - "print \"L7 is:\",round(L7,4),\"m\"\n", - "print \"L8 is:\",round(L8,4),\"m\"\n", - "print \"L9 is:\",round(L9,4),\"m\"\n", - "print \"L10 is:\",round(L10,4),\"m\"\n", - "print \"L11 is:\",round(L11,4),\"m\"\n", - "\n", - "print \"elements spacing relation:\"\n", - "\n", - "print \"S1 is:\",round(S1,4),\"m\"\n", - "print \"S2 is:\",round(S2,4),\"m\"\n", - "print \"S3 is:\",round(S3,4),\"m\"\n", - "print \"S4 is:\",round(S4,4),\"m\"\n", - "print \"S5 is:\",round(S5,4),\"m\"\n", - "print \"S6 is:\",round(S6,4),\"m\"\n", - "print \"S7 is:\",round(S7,4),\"m\"\n", - "print \"S8 is:\",round(S8,4),\"m\"\n", - "print \"S9 is:\",round(S9,4),\"m\"\n", - "print \"S10 is:\",round(S10,4),\"m\"\n", - "print \"S11 is:\",round(S11,4),\"m\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "designing of log-periodic antenna:\n", - "L1 is: 1.2 m\n", - "L2 is: 1.0332 m\n", - "L3 is: 0.8896 m\n", - "L4 is: 0.7659 m\n", - "L5 is: 0.6595 m\n", - "L6 is: 0.5678 m\n", - "L7 is: 0.4889 m\n", - "L8 is: 0.4209 m\n", - "L9 is: 0.3624 m\n", - "L10 is: 0.312 m\n", - "L11 is: 0.2687 m\n", - "elements spacing relation:\n", - "S1 is: 0.3888 m\n", - "S2 is: 0.3348 m\n", - "S3 is: 0.2882 m\n", - "S4 is: 0.2482 m\n", - "S5 is: 0.2137 m\n", - "S6 is: 0.184 m\n", - "S7 is: 0.1584 m\n", - "S8 is: 0.1364 m\n", - "S9 is: 0.1174 m\n", - "S10 is: 0.1011 m\n", - "S11 is: 0.087 m\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.9,PAGE NUMBER 285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,cos,sqrt\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "E_rms = 10 # electric field in mV/m\n", - "E_rms = 10*10 **-3 # electric field in V/m\n", - "f = 2 # frequency in MHz\n", - "f = 2*10 **6 # frequency in Hz\n", - "N = 10 # number of turns\n", - "phi = 0 # angle between the plane of loop and direction of incident wave in Degrees\n", - "S = 1.4 # area of loop antenna in m **2\n", - "c = 3*10 **8 # speed of light in m/s\n", - "\n", - "#calculation\n", - "\n", - "lamda = c/f # wavelength in m\n", - "E_max = sqrt(2)*E_rms # electric field in V/m\n", - "V_rms = (2*pi*E_max*S*N/lamda)*cos(phi) # induced voltage\n", - "\n", - "#Result\n", - "\n", - "print \"induced voltage is:\",round(V_rms*1000,2),\"mV\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "induced voltage is: 8.29 mV\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.10,PAGE NUMBER 285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variable Declaration\n", - "\n", - "\n", - "D = 0.5 # diameter of loop antenna in m\n", - "a = D/2 # radius of loop antenna in m\n", - "f = 1 # frequency in MHz\n", - "f = 1*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "#calculation\n", - "\n", - "lamda = c/f # wavelength in m\n", - "Rr = 3720*(a/lamda) # radiation resistance of loop antenna in ohm\n", - "\n", - "\n", - "#Results\n", - "\n", - "print \"radiation resistance of loop antenna is:\",Rr,\"ohm\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "radiation resistance of loop antenna is: 3.1 ohm\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.11,PAGE NUMBER 285-286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# Variable Declaration\n", - "\n", - "a = 0.5 # radius of loop antenna in m\n", - "f = 0.9 # frequency in MHz\n", - "f = 0.9*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "#calculation\n", - "\n", - "lamda = c/f # wavelength in m\n", - "k = (2*pi*a)/lamda # constant\n", - "\n", - "#Results\n", - "\n", - "print \"the value of k is:\",round(k,2)\n", - "print \"since,k<1/3\"\n", - "print \"So Directivity of loop antenna is D = 1.5\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the value of k is: 0.01\n", - "since,k<1/3\n", - "So Directivity of loop antenna is D = 1.5\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.13,PAGE NUMBER 286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from sympy import Symbol\n", - "\n", - "#variable declaration and calculation\n", - "\n", - "Lm = Symbol('Lm') # defining Lm as lambda\n", - "d = 1.5*Lm # diameter of antenna in m\n", - "a = d/2 # radius of antenna in m\n", - "Rr = 3720*(a/Lm) # radiation resistance of loop antenna in ohm\n", - "D = 4.25*(a/Lm) # Directivity of the loop antenna\n", - "\n", - "#results\n", - "\n", - "print \"radiation resistance of the loop antenna is:\",round(Rr,0),\"ohm\"\n", - "print \"Directivity of the loop antenna is:\",round(D,4)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "radiation resistance of the loop antenna is: 2790.0 ohm\n", - "Directivity of the loop antenna is: 3.1875\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.14,PAGE NUMBER 287" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import sqrt,pi\n", - "from sympy import Symbol\n", - "\n", - "#Variable declaration\n", - "\n", - "Gp = 28 # power gain\n", - "\n", - "#calculations\n", - "\n", - "Lm = Symbol('Lm') # defining Lm as lamda\n", - "d = Lm/2 # length of dipole\n", - "\n", - "#formula : Gp = 4*(L/lamda)\n", - "\n", - "L = Gp*Lm/4 # array length\n", - "N = 7*2 # Number of elements in the array when spaced at lamda/2\n", - "\n", - "# formula : B.W = 2*sqrt((2*/N)*(lamda/d))\n", - "\n", - "BW = 2*sqrt(2*Lm/(N*d)) # null-to-null beam width in radians\n", - "BW_d = BW*180/pi # null-to-null beam width in degrees\n", - "\n", - "#Results\n", - "\n", - "print \"Number of elements in the array when spaced at lamda/2 are:\",N\n", - "print \"array length(where Lm is wavelength in m) is:\",L,\"m\"\n", - "print \"null-to-null beam width is:\",round(BW_d,1),\"degrees\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of elements in the array when spaced at lamda/2 are: 14\n", - "array length(where Lm is wavelength in m) is: 7*Lm m\n", - "null-to-null beam width is: 61.3 degrees\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.15,PAGE NUMBER 287" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "S = 0.05 # spacing in m\n", - "Dh = 0.1 # diameter of helical antenna in m\n", - "N = 20 # number of turns\n", - "f = 1000 # frequency in MHz\n", - "f = 1000*10**6 # frequency in MHz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "\n", - "#calculation\n", - "\n", - "\n", - "lamda = c/f # wavelength in m\n", - "C = pi*Dh # circumfrence of helix in m\n", - "La = N*S # axial legth in m\n", - "phi_not = (115*(lamda**(3/2))/(C*sqrt(La))) # B.W.F.N., null-to-null beamwidth of main beam in Degreess\n", - "phi = (52*lamda**(3/2)/(C*sqrt(La))) # H.P.B.W, half power beamwidth in Degreess\n", - "D = (15*N*C**2*S/(lamda)**3) # Directivity\n", - "\n", - "#Results\n", - "\n", - "print \"B.W.F.N., null-to-null beamwidth of main beam is:\",round(phi_not,1),\"degrees\"\n", - "print \"H.P.B.W, half power beamwidth is:\",round(phi,1),\"degrees\"\n", - "print \"Directivity is:\",round(D,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "B.W.F.N., null-to-null beamwidth of main beam is: 60.1 degrees\n", - "H.P.B.W, half power beamwidth is: 27.2 degrees\n", - "Directivity is: 54.83\n" - ] - } - ], - "prompt_number": 14 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/TestContribution/abhisheksharma_2.ipynb b/TestContribution/abhisheksharma_2.ipynb deleted file mode 100755 index e09e86cb..00000000 --- a/TestContribution/abhisheksharma_2.ipynb +++ /dev/null @@ -1,946 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:54ccd26f8e7172369b740037968be286180ddfff5f2fc10ebe6be83fc34647f9" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "HF,VHF AND UHF ANTENNAS (CHAPTER 6)" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.1,PAGE NUMBER 278 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 30 # frequency in MHz\n", - "f = 30*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "Delta = 30 # angle of elevation in Degrees\n", - "\n", - "#calculation\n", - "\n", - "H = lamda/(4 * sin(Delta*pi/180)) # Rhombic height in m\n", - "l = lamda/(2 * sin(Delta*pi/180) **2) # wire length in m\n", - "phi = 90-Delta # tilt angle in Degrees\n", - "\n", - "#Results\n", - "\n", - "print \"Rhombic height is:\",round(H,2),\"meter\"\n", - "print \"Tilt angle is:\",round(phi,2),\"degrees\"\n", - "print \"length of wire is:\",round(l,2),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rhombic height is: 5.0 meter\n", - "Tilt angle is: 60.0 degrees\n", - "length of wire is: 20.0 meter\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.2,PAGE NUMBER 278" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 20 # frequency in MHz\n", - "f = 20*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "\n", - "#calculation\n", - "\n", - "Delta = 10 # angle of elevation in Degrees\n", - "H = lamda/(4 * sin(Delta*pi/180)) # Rhombic height in m\n", - "l = lamda/(2 * sin(Delta*pi/180) **2) # wire length in m\n", - "phi = 90-Delta # tilt angle in Degrees\n", - "\n", - "#Results\n", - "\n", - "print \"Rhombic height is:\",round(H,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi,2),\"degrees\"\n", - "print \"length of wire is:\",round(l,3),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rhombic height is: 21.595 meter\n", - "Tilt angle is: 80.0 degrees\n", - "length of wire is: 248.726 meter\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.3,PAGE NUMBER 279-281" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin,cos\n", - "\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 30 # frequency in MHz\n", - "f = 30*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "\n", - "#calculation and results:\n", - "\n", - "\n", - "\n", - "print \"for Delta = 10 degrees\"\n", - "\n", - "\n", - "Delta1 = 10 # angle of elevation in Degrees\n", - "H1 = lamda/(4 * sin(Delta1*pi/180)) # Rhombic height in m\n", - "l1 = lamda/(2 * sin(Delta1*pi/180) **2) # wire length in m\n", - "phi1 = 90-Delta1 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H1,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi1,2),\"degrees\"\n", - "print \"length of wire is:\",round(l1,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 15 degrees\"\n", - "\n", - "\n", - "Delta2 = 15 # angle of elevation in Degrees\n", - "H2 = lamda/(4 * sin(Delta2*pi/180)) # Rhombic height in m\n", - "l2 = lamda/(2 * sin(Delta2*pi/180) **2) # wire length in m\n", - "phi2 = 90-Delta2 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H2,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi2,2),\"degrees\"\n", - "print \"length of wire is:\",round(l2,2),\"meter\"\n", - "\n", - "\n", - "\n", - "print \"for Delta = 20 degrees\"\n", - "\n", - "\n", - "Delta3 = 20 # angle of elevation in Degrees\n", - "H3 = lamda/(4 * sin(Delta3*pi/180)) # Rhombic height in m\n", - "l3 = lamda/(2 * sin(Delta3*pi/180) **2) # wire length in m\n", - "phi3 = 90-Delta3 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H3,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi3,2),\"degrees\"\n", - "print \"length of wire is:\",round(l3,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 25 degrees\"\n", - "\n", - "\n", - "Delta4 = 25 # angle of elevation in Degrees\n", - "H4 = lamda/(4 * sin(Delta4*pi/180)) # Rhombic height in m\n", - "l4 = lamda/(2 * sin(Delta4*pi/180) **2) # wire length in m\n", - "phi4 = 90-Delta4 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H4,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi4,2),\"degrees\"\n", - "print \"length of wire is:\",round(l4,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 30 degrees\"\n", - "\n", - "\n", - "Delta5 = 30 # angle of elevation in Degrees\n", - "H5 = lamda/(4 * sin(Delta5*pi/180)) # Rhombic height in m\n", - "l5 = lamda/(2 * sin(Delta5*pi/180) **2) # wire length in m\n", - "phi5 = 90-Delta5 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H5,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi5,2),\"degrees\"\n", - "print \"length of wire is:\",round(l5,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 35 degrees\"\n", - "\n", - "\n", - "Delta6 = 35 # angle of elevation in Degrees\n", - "H6 = lamda/(4 * sin(Delta6*pi/180)) # Rhombic height in m\n", - "l6 = lamda/(2 * sin(Delta6*pi/180) **2) # wire length in m\n", - "phi6 = 90-Delta6 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H6,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi6,2),\"degrees\"\n", - "print \"length of wire is:\",round(l6,2),\"meter\"\n", - "\n", - "\n", - "\n", - "\n", - "print \"for Delta = 40 degrees\"\n", - "\n", - "\n", - "Delta7 = 40 # angle of elevation in Degrees\n", - "H7 = lamda/(4 * sin(Delta7*pi/180)) # Rhombic height in m\n", - "l7 = lamda/(2 * sin(Delta7*pi/180) **2) # wire length in m\n", - "phi7 = 90-Delta7 # tilt angle in Degrees\n", - "print \"Rhombic height is:\",round(H7,3),\"meter\"\n", - "print \"Tilt angle is:\",round(phi7,2),\"degrees\"\n", - "print \"length of wire is:\",round(l7,2),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for Delta = 10 degrees\n", - "Rhombic height is: 14.397 meter\n", - "Tilt angle is: 80.0 degrees\n", - "length of wire is: 165.82 meter\n", - "for Delta = 15 degrees\n", - "Rhombic height is: 9.659 meter\n", - "Tilt angle is: 75.0 degrees\n", - "length of wire is: 74.64 meter\n", - "for Delta = 20 degrees\n", - "Rhombic height is: 7.31 meter\n", - "Tilt angle is: 70.0 degrees\n", - "length of wire is: 42.74 meter\n", - "for Delta = 25 degrees\n", - "Rhombic height is: 5.916 meter\n", - "Tilt angle is: 65.0 degrees\n", - "length of wire is: 27.99 meter\n", - "for Delta = 30 degrees\n", - "Rhombic height is: 5.0 meter\n", - "Tilt angle is: 60.0 degrees\n", - "length of wire is: 20.0 meter\n", - "for Delta = 35 degrees\n", - "Rhombic height is: 4.359 meter\n", - "Tilt angle is: 55.0 degrees\n", - "length of wire is: 15.2 meter\n", - "for Delta = 40 degrees\n", - "Rhombic height is: 3.889 meter\n", - "Tilt angle is: 50.0 degrees\n", - "length of wire is: 12.1 meter\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.4,PAGE NUMBER 281" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin,cos\n", - "\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 30 # frequency in MHz\n", - "f = 30*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "Delta = 30 # angle of elevation in Degrees\n", - "\n", - "#calculation\n", - "\n", - "k = 0.74 # constant\n", - "H = lamda/(4 * sin(Delta*pi/180)) # Rhombic height in m\n", - "l = lamda/(2 * sin(Delta*pi/180) **2)*k # wire length in m\n", - "phi = 90-Delta # tilt angle in Degrees\n", - "\n", - "#Results\n", - "\n", - "print \"Rhombic height is:\",round(H,2),\"meter\"\n", - "print \"Tilt angle is:\",round(phi,2),\"degrees\"\n", - "print \"length of wire is:\",round(l,2),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rhombic height is: 5.0 meter\n", - "Tilt angle is: 60.0 degrees\n", - "length of wire is: 14.8 meter\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.5,PAGE NUMBER 282" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,sin\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "f = 20 # frequency in MHz\n", - "f = 20*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "lamda = c/f # wavelength in meter\n", - "Delta = 20 # angle of elevation in Degrees\n", - "k = 0.74 # constant\n", - "\n", - "#calculation\n", - "\n", - "H = lamda/(4 * sin(Delta*pi/180)) # Rhombic height in m\n", - "l = lamda/(2 * sin(Delta*pi/180) **2)*k # wire length in m\n", - "phi = 90-Delta # tilt angle in Degrees\n", - "\n", - "\n", - "#Results\n", - "\n", - "\n", - "print \"Rhombic height is:\",round(H,2),\"meter\"\n", - "print \"Tilt angle is:\",round(phi,2),\"degrees\"\n", - "print \"length of wire is:\",round(l,2),\"meter\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rhombic height is: 10.96 meter\n", - "Tilt angle is: 70.0 degrees\n", - "length of wire is: 47.44 meter\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.6,PAGE NUMBER 282" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "\n", - "f_MHz = 172 # frequency in MHz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "#calculation\n", - "\n", - "lamda = c/f_MHz # wavelength in m\n", - "La = 478/f_MHz # length of driven element in feet\n", - "Lr = 492/f_MHz # length of reflector in feet\n", - "Ld = 461.5/f_MHz # length of director in feet\n", - "S = 142/f_MHz # element spacing in feet\n", - "\n", - "\n", - "#Results\n", - "\n", - "\n", - "print \"length of driven element is:\", round(La,2),\"feet\"\n", - "print \"length of reflector is:\", round(Lr,2),\"feet\"\n", - "print \"length of director is:\", round(Ld,3),\"feet\"\n", - "print \"element spacing is:\",round(S,3),\"feet\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "length of driven element is: 2.78 feet\n", - "length of reflector is: 2.86 feet\n", - "length of director is: 2.683 feet\n", - "element spacing is: 0.826 feet\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.7,PAGE NUMBER 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "\n", - "# Variable Declaration\n", - "\n", - "\n", - "G = 12 # required gain in dB\n", - "f = 200 # frequency in MHz \n", - "f = 200*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "#calculations\n", - "\n", - "\n", - "lamda = c/f # wavelength in m\n", - "La = 0.46*lamda # length of driven element in m (note: in book La is given 0.416*lamda misprint)\n", - "Lr = 0.475*lamda # length of reflector in m\n", - "Ld1 = 0.44*lamda # length of director1 in m\n", - "Ld2 = 0.44*lamda # length of director2 in m\n", - "Ld3 = 0.43*lamda # length of director3 in m\n", - "Ld4 = 0.40*lamda # length of director4 in m\n", - "SL = 0.25*lamda # spacing between reflector and driver in m\n", - "Sd = 0.31*lamda # spacing director and driving element in m\n", - "d = 0.01*lamda # diameter of elements in m\n", - "l = 1.5*lamda # length of array in m\n", - "\n", - "\n", - "#Results\n", - "\n", - "\n", - "print \"length of driven element is:\" ,round(La,2),\"m\"\n", - "print \"length of reflector is:\",round(Lr,4),\"m\"\n", - "print \"length of director1 is:\",round(Ld1,2),\"m\"\n", - "print \"length of director2 is:\",round(Ld2,2),\"m\"\n", - "print \"length of director3 is:\",round(Ld3,3),\"m\"\n", - "print \"length of director4 is:\",round(Ld4,2),\"m\"\n", - "print \"spacing between reflector and driver is:\",round(SL,3),\"m\"\n", - "print \"spacing director and driving element is:\",round(Sd,3),\"m\"\n", - "print \"diameter of elements is:\",round(d,3),\"m\"\n", - "print \"length of array is:\",round(l,2),\"m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "length of driven element is: 0.69 m\n", - "length of reflector is: 0.7125 m\n", - "length of director1 is: 0.66 m\n", - "length of director2 is: 0.66 m\n", - "length of director3 is: 0.645 m\n", - "length of director4 is: 0.6 m\n", - "spacing between reflector and driver is: 0.375 m\n", - "spacing director and driving element is: 0.465 m\n", - "diameter of elements is: 0.015 m\n", - "length of array is: 2.25 m\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.8,PAGE NUMBER 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import atan\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "\n", - "G = 9 # required gain in dB\n", - "f_l = 125 # lowest frequency in MHz\n", - "f_l = 125*10**6 # lowest frequency in Hz\n", - "f_h = 500 # highest frequency in MHz\n", - "f_h = 500*10**6 # lowest frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "tau = 0.861 # scaling factor\n", - "sigma = 0.162 # spacing factor\n", - "\n", - "\n", - "#calculation\n", - "\n", - "\n", - "lamda_l = c/f_l # longest wavelength in m\n", - "lamda_s = c/f_h # shortest wavelength in m\n", - "alpha = 2*atan((1-tau)/(4*sigma)) # wedge angle in Degrees\n", - "L1 = lamda_l/2 # in m\n", - "L2 = tau*L1 # in m\n", - "L3 = tau*L2 # in m\n", - "L4 = tau*L3 # in m\n", - "L5 = tau*L4 # in m\n", - "L6 = tau*L5 # in m\n", - "L7 = tau*L6 # in m\n", - "L8 = tau*L7 # in m\n", - "L9 = tau*L8 # in m\n", - "L10 = tau*L9 # in m\n", - "L11 = tau*L10 # in m\n", - "\n", - "# element spacing relation\n", - "#formula : sn = 2*sigma*Ln\n", - "\n", - "\n", - "S1 = 2*sigma*L1 # in m\n", - "S2 = 2*sigma*L2 # in m\n", - "S3 = 2*sigma*L3 # in m\n", - "S4 = 2*sigma*L4 # in m\n", - "S5 = 2*sigma*L5 # in m\n", - "S6 = 2*sigma*L6 # in m\n", - "S7 = 2*sigma*L7 # in m\n", - "S8 = 2*sigma*L8 # in m\n", - "S9 = 2*sigma*L9 # in m\n", - "S10 = 2*sigma*L10 # in m\n", - "S11 = 2*sigma*L11 # in m\n", - "\n", - "\n", - "\n", - "#results\n", - "\n", - "\n", - "print(\"designing of log-periodic antenna:\")\n", - "\n", - "print \"L1 is:\",round(L1,4),\"m\"\n", - "print \"L2 is:\",round(L2,4),\"m\"\n", - "print \"L3 is:\",round(L3,4),\"m\"\n", - "print \"L4 is:\",round(L4,4),\"m\"\n", - "print \"L5 is:\",round(L5,4),\"m\"\n", - "print \"L6 is:\",round(L6,4),\"m\"\n", - "print \"L7 is:\",round(L7,4),\"m\"\n", - "print \"L8 is:\",round(L8,4),\"m\"\n", - "print \"L9 is:\",round(L9,4),\"m\"\n", - "print \"L10 is:\",round(L10,4),\"m\"\n", - "print \"L11 is:\",round(L11,4),\"m\"\n", - "\n", - "print \"elements spacing relation:\"\n", - "\n", - "print \"S1 is:\",round(S1,4),\"m\"\n", - "print \"S2 is:\",round(S2,4),\"m\"\n", - "print \"S3 is:\",round(S3,4),\"m\"\n", - "print \"S4 is:\",round(S4,4),\"m\"\n", - "print \"S5 is:\",round(S5,4),\"m\"\n", - "print \"S6 is:\",round(S6,4),\"m\"\n", - "print \"S7 is:\",round(S7,4),\"m\"\n", - "print \"S8 is:\",round(S8,4),\"m\"\n", - "print \"S9 is:\",round(S9,4),\"m\"\n", - "print \"S10 is:\",round(S10,4),\"m\"\n", - "print \"S11 is:\",round(S11,4),\"m\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "designing of log-periodic antenna:\n", - "L1 is: 1.2 m\n", - "L2 is: 1.0332 m\n", - "L3 is: 0.8896 m\n", - "L4 is: 0.7659 m\n", - "L5 is: 0.6595 m\n", - "L6 is: 0.5678 m\n", - "L7 is: 0.4889 m\n", - "L8 is: 0.4209 m\n", - "L9 is: 0.3624 m\n", - "L10 is: 0.312 m\n", - "L11 is: 0.2687 m\n", - "elements spacing relation:\n", - "S1 is: 0.3888 m\n", - "S2 is: 0.3348 m\n", - "S3 is: 0.2882 m\n", - "S4 is: 0.2482 m\n", - "S5 is: 0.2137 m\n", - "S6 is: 0.184 m\n", - "S7 is: 0.1584 m\n", - "S8 is: 0.1364 m\n", - "S9 is: 0.1174 m\n", - "S10 is: 0.1011 m\n", - "S11 is: 0.087 m\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.9,PAGE NUMBER 285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import pi,cos,sqrt\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "E_rms = 10 # electric field in mV/m\n", - "E_rms = 10*10 **-3 # electric field in V/m\n", - "f = 2 # frequency in MHz\n", - "f = 2*10 **6 # frequency in Hz\n", - "N = 10 # number of turns\n", - "phi = 0 # angle between the plane of loop and direction of incident wave in Degrees\n", - "S = 1.4 # area of loop antenna in m **2\n", - "c = 3*10 **8 # speed of light in m/s\n", - "\n", - "#calculation\n", - "\n", - "lamda = c/f # wavelength in m\n", - "E_max = sqrt(2)*E_rms # electric field in V/m\n", - "V_rms = (2*pi*E_max*S*N/lamda)*cos(phi) # induced voltage\n", - "\n", - "#Result\n", - "\n", - "print \"induced voltage is:\",round(V_rms*1000,2),\"mV\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "induced voltage is: 8.29 mV\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.10,PAGE NUMBER 285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variable Declaration\n", - "\n", - "\n", - "D = 0.5 # diameter of loop antenna in m\n", - "a = D/2 # radius of loop antenna in m\n", - "f = 1 # frequency in MHz\n", - "f = 1*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "#calculation\n", - "\n", - "lamda = c/f # wavelength in m\n", - "Rr = 3720*(a/lamda) # radiation resistance of loop antenna in ohm\n", - "\n", - "\n", - "#Results\n", - "\n", - "print \"radiation resistance of loop antenna is:\",Rr,\"ohm\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "radiation resistance of loop antenna is: 3.1 ohm\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.11,PAGE NUMBER 285-286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# Variable Declaration\n", - "\n", - "a = 0.5 # radius of loop antenna in m\n", - "f = 0.9 # frequency in MHz\n", - "f = 0.9*10**6 # frequency in Hz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "#calculation\n", - "\n", - "lamda = c/f # wavelength in m\n", - "k = (2*pi*a)/lamda # constant\n", - "\n", - "#Results\n", - "\n", - "print \"the value of k is:\",round(k,2)\n", - "print \"since,k<1/3\"\n", - "print \"So Directivity of loop antenna is D = 1.5\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the value of k is: 0.01\n", - "since,k<1/3\n", - "So Directivity of loop antenna is D = 1.5\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.13,PAGE NUMBER 286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from sympy import Symbol\n", - "\n", - "#variable declaration and calculation\n", - "\n", - "Lm = Symbol('Lm') # defining Lm as lambda\n", - "d = 1.5*Lm # diameter of antenna in m\n", - "a = d/2 # radius of antenna in m\n", - "Rr = 3720*(a/Lm) # radiation resistance of loop antenna in ohm\n", - "D = 4.25*(a/Lm) # Directivity of the loop antenna\n", - "\n", - "#results\n", - "\n", - "print \"radiation resistance of the loop antenna is:\",round(Rr,0),\"ohm\"\n", - "print \"Directivity of the loop antenna is:\",round(D,4)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "radiation resistance of the loop antenna is: 2790.0 ohm\n", - "Directivity of the loop antenna is: 3.1875\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.14,PAGE NUMBER 287" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from math import sqrt,pi\n", - "from sympy import Symbol\n", - "\n", - "#Variable declaration\n", - "\n", - "Gp = 28 # power gain\n", - "\n", - "#calculations\n", - "\n", - "Lm = Symbol('Lm') # defining Lm as lamda\n", - "d = Lm/2 # length of dipole\n", - "\n", - "#formula : Gp = 4*(L/lamda)\n", - "\n", - "L = Gp*Lm/4 # array length\n", - "N = 7*2 # Number of elements in the array when spaced at lamda/2\n", - "\n", - "# formula : B.W = 2*sqrt((2*/N)*(lamda/d))\n", - "\n", - "BW = 2*sqrt(2*Lm/(N*d)) # null-to-null beam width in radians\n", - "BW_d = BW*180/pi # null-to-null beam width in degrees\n", - "\n", - "#Results\n", - "\n", - "print \"Number of elements in the array when spaced at lamda/2 are:\",N\n", - "print \"array length(where Lm is wavelength in m) is:\",L,\"m\"\n", - "print \"null-to-null beam width is:\",round(BW_d,1),\"degrees\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of elements in the array when spaced at lamda/2 are: 14\n", - "array length(where Lm is wavelength in m) is: 7*Lm m\n", - "null-to-null beam width is: 61.3 degrees\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE 6.15,PAGE NUMBER 287" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "\n", - "# Variable Declaration\n", - "\n", - "S = 0.05 # spacing in m\n", - "Dh = 0.1 # diameter of helical antenna in m\n", - "N = 20 # number of turns\n", - "f = 1000 # frequency in MHz\n", - "f = 1000*10**6 # frequency in MHz\n", - "c = 3*10**8 # speed of light in m/s\n", - "\n", - "\n", - "#calculation\n", - "\n", - "\n", - "lamda = c/f # wavelength in m\n", - "C = pi*Dh # circumfrence of helix in m\n", - "La = N*S # axial legth in m\n", - "phi_not = (115*(lamda**(3/2))/(C*sqrt(La))) # B.W.F.N., null-to-null beamwidth of main beam in Degreess\n", - "phi = (52*lamda**(3/2)/(C*sqrt(La))) # H.P.B.W, half power beamwidth in Degreess\n", - "D = (15*N*C**2*S/(lamda)**3) # Directivity\n", - "\n", - "#Results\n", - "\n", - "print \"B.W.F.N., null-to-null beamwidth of main beam is:\",round(phi_not,1),\"degrees\"\n", - "print \"H.P.B.W, half power beamwidth is:\",round(phi,1),\"degrees\"\n", - "print \"Directivity is:\",round(D,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "B.W.F.N., null-to-null beamwidth of main beam is: 60.1 degrees\n", - "H.P.B.W, half power beamwidth is: 27.2 degrees\n", - "Directivity is: 54.83\n" - ] - } - ], - "prompt_number": 14 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/TestContribution/bilal.ipynb b/TestContribution/bilal.ipynb deleted file mode 100755 index 22d13091..00000000 --- a/TestContribution/bilal.ipynb +++ /dev/null @@ -1,406 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e19af2f3d200c02cdde989919b1864a16727820a7b37667c650dffdfc779957b" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 25: Resonance" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.1, page no. 754" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import numpy as np\n", - "\n", - "#Variable declaration\n", - "L = 8 # Value of Inductor (8-H)\n", - "C = 20e-6 #Value of Capacitor (20-uF)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = np.sqrt(L*C)\n", - "fr = 1/(2*p*a)\n", - "\n", - "#Result\n", - "print \"Resonant frequency is\",float(fr), \"Hz i.e 12.6 Hz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resonant frequency is 12.5806717862 Hz i.e 12.6 Hz\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.2, page no. 755" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import numpy as np\n", - "\n", - "#Variable declaration\n", - "L = 2e-6 # Value of Inductor (2-uH)\n", - "C = 3e-12 #Value of Capacitor (3-pF)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = np.sqrt(L*C)\n", - "fr = 1/(2*p*a)\n", - "\n", - "#Result\n", - "print \"Resonant frequency is\",float(fr), \"Hz i.e 65 MHz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resonant frequency is 64966309.7492 Hz i.e 65 MHz\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.3, page no. 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "L = 239e-6 # Value of Inductor (239-uH)\n", - "f = 1000*10^3 #Frequency (1000 KHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = p*p\n", - "b = f*f\n", - "C = 1/(4*a*b*L)\n", - "\n", - "#Result\n", - "print \"Value of Capacitor is\",float(C), \"F i.e 106 pF\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Capacitor is 1.05893477038e-06 F i.e 106 pF\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.4, page no. 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "C = 106e-12 # Value of Capacitor (106-pF)\n", - "f = 1000000 #Frequency (1 MHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = 4*(p*p)\n", - "b = f*f\n", - "c = a*b*C\n", - "L = 1/(a*C*b)\n", - "\n", - "#Result\n", - "print \"Value of Inductor is\",float(L), \"H i.e 239 uH\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Inductor is 0.000238903098251 H i.e 239 uH\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.5, page no. 759" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Vo = 100e-3 #Output Voltage(100-mV)\n", - "Vi = 2e-3 #Input Voltage(2-mV)\n", - "\n", - "#Calculation\n", - "Q = Vo/Vi\n", - "\n", - "#Result\n", - "print \"Value of Q is\",round(Q)," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Q is 50.0\n" - ] - } - ], - "prompt_number": 38 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.6, page no. 759" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Q = 50 #Quality Factor\n", - "L = 250e-6 # Value of Inductor (250-uH)\n", - "f = 400000 #Frequency (400 KHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "x = 2*p*f*L\n", - "rs = x/Q\n", - "\n", - "#Result\n", - "print \"Value of AC resistance is\",float(rs),\"Ohms\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of AC resistance is 12.568\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.7, page no. 761" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"Because they divide VT equally, ZEQ is 225 kOhms, the same as R1. The amount of input voltage does not matter, as the voltage division determines the relative proportions between R1 and ZEQ. With 225 kOhms for ZEQ and 1.5 kOhms for XL, the Q is 225\u20441.5, or Q = 150.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Because they divide VT equally, ZEQ is 225 kOhms, the same as R1. The amount of input voltage does not matter, as the voltage division determines the relative proportions between R1 and ZEQ. With 225 kOhms for ZEQ and 1.5 kOhms for XL, the Q is 225\u20441.5, or Q = 150.\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.8, page no. 761" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Z = 17600 #Equivalent Impedence\n", - "L = 350e-6 # Value of Inductor (350-uH)\n", - "f = 200000 #Frequency (200 KHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "x = 2*p*f*L\n", - "Q = Z/x\n", - "\n", - "#Result\n", - "print \"Value of Quality factor is\", round(Q)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Quality factor is 40.0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.9, page no. 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Q = 100 #Quality Factor\n", - "fr = 2000000 # Resonant frequency (2000 KHz)\n", - "\n", - "#Calculation\n", - "f = fr/Q\n", - "f1 = fr-(f/2)\n", - "f2 = fr+(f/2)\n", - "\n", - "#Result\n", - "print \"The total Bandwidth is\",round(f),\"Hz\"\n", - "print \"The edge frequency f1 is\",round(f1),\"Hz\"\n", - "print \"The edge frequency f2 is\",round(f2),\"Hz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The total Bandwidth is 20000.0 Hz\n", - "The edge frequency f1 is 1990000.0 Hz\n", - "The edge frequency f2 is 2010000.0 Hz\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.10, page no. 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Q = 100 #Quality Factor\n", - "fr = 6000000 # Resonant frequency (6000 KHz)\n", - "\n", - "#Calculation\n", - "f = fr/Q\n", - "f1 = fr-(f/2)\n", - "f2 = fr+(f/2)\n", - "\n", - "#Result\n", - "print \"The total Bandwidth is\",round(f),\"Hz\"\n", - "print \"The edge frequency f1 is\",round(f1),\"Hz\"\n", - "print \"The edge frequency f2 is\",round(f2),\"Hz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The total Bandwidth is 60000.0 Hz\n", - "The edge frequency f1 is 5970000.0 Hz\n", - "The edge frequency f2 is 6030000.0 Hz\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/TestContribution/bilal_1.ipynb b/TestContribution/bilal_1.ipynb deleted file mode 100755 index 22d13091..00000000 --- a/TestContribution/bilal_1.ipynb +++ /dev/null @@ -1,406 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e19af2f3d200c02cdde989919b1864a16727820a7b37667c650dffdfc779957b" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 25: Resonance" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.1, page no. 754" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import numpy as np\n", - "\n", - "#Variable declaration\n", - "L = 8 # Value of Inductor (8-H)\n", - "C = 20e-6 #Value of Capacitor (20-uF)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = np.sqrt(L*C)\n", - "fr = 1/(2*p*a)\n", - "\n", - "#Result\n", - "print \"Resonant frequency is\",float(fr), \"Hz i.e 12.6 Hz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resonant frequency is 12.5806717862 Hz i.e 12.6 Hz\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.2, page no. 755" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import numpy as np\n", - "\n", - "#Variable declaration\n", - "L = 2e-6 # Value of Inductor (2-uH)\n", - "C = 3e-12 #Value of Capacitor (3-pF)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = np.sqrt(L*C)\n", - "fr = 1/(2*p*a)\n", - "\n", - "#Result\n", - "print \"Resonant frequency is\",float(fr), \"Hz i.e 65 MHz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resonant frequency is 64966309.7492 Hz i.e 65 MHz\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.3, page no. 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "L = 239e-6 # Value of Inductor (239-uH)\n", - "f = 1000*10^3 #Frequency (1000 KHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = p*p\n", - "b = f*f\n", - "C = 1/(4*a*b*L)\n", - "\n", - "#Result\n", - "print \"Value of Capacitor is\",float(C), \"F i.e 106 pF\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Capacitor is 1.05893477038e-06 F i.e 106 pF\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.4, page no. 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "C = 106e-12 # Value of Capacitor (106-pF)\n", - "f = 1000000 #Frequency (1 MHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = 4*(p*p)\n", - "b = f*f\n", - "c = a*b*C\n", - "L = 1/(a*C*b)\n", - "\n", - "#Result\n", - "print \"Value of Inductor is\",float(L), \"H i.e 239 uH\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Inductor is 0.000238903098251 H i.e 239 uH\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.5, page no. 759" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Vo = 100e-3 #Output Voltage(100-mV)\n", - "Vi = 2e-3 #Input Voltage(2-mV)\n", - "\n", - "#Calculation\n", - "Q = Vo/Vi\n", - "\n", - "#Result\n", - "print \"Value of Q is\",round(Q)," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Q is 50.0\n" - ] - } - ], - "prompt_number": 38 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.6, page no. 759" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Q = 50 #Quality Factor\n", - "L = 250e-6 # Value of Inductor (250-uH)\n", - "f = 400000 #Frequency (400 KHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "x = 2*p*f*L\n", - "rs = x/Q\n", - "\n", - "#Result\n", - "print \"Value of AC resistance is\",float(rs),\"Ohms\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of AC resistance is 12.568\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.7, page no. 761" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"Because they divide VT equally, ZEQ is 225 kOhms, the same as R1. The amount of input voltage does not matter, as the voltage division determines the relative proportions between R1 and ZEQ. With 225 kOhms for ZEQ and 1.5 kOhms for XL, the Q is 225\u20441.5, or Q = 150.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Because they divide VT equally, ZEQ is 225 kOhms, the same as R1. The amount of input voltage does not matter, as the voltage division determines the relative proportions between R1 and ZEQ. With 225 kOhms for ZEQ and 1.5 kOhms for XL, the Q is 225\u20441.5, or Q = 150.\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.8, page no. 761" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Z = 17600 #Equivalent Impedence\n", - "L = 350e-6 # Value of Inductor (350-uH)\n", - "f = 200000 #Frequency (200 KHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "x = 2*p*f*L\n", - "Q = Z/x\n", - "\n", - "#Result\n", - "print \"Value of Quality factor is\", round(Q)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Quality factor is 40.0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.9, page no. 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Q = 100 #Quality Factor\n", - "fr = 2000000 # Resonant frequency (2000 KHz)\n", - "\n", - "#Calculation\n", - "f = fr/Q\n", - "f1 = fr-(f/2)\n", - "f2 = fr+(f/2)\n", - "\n", - "#Result\n", - "print \"The total Bandwidth is\",round(f),\"Hz\"\n", - "print \"The edge frequency f1 is\",round(f1),\"Hz\"\n", - "print \"The edge frequency f2 is\",round(f2),\"Hz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The total Bandwidth is 20000.0 Hz\n", - "The edge frequency f1 is 1990000.0 Hz\n", - "The edge frequency f2 is 2010000.0 Hz\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.10, page no. 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Q = 100 #Quality Factor\n", - "fr = 6000000 # Resonant frequency (6000 KHz)\n", - "\n", - "#Calculation\n", - "f = fr/Q\n", - "f1 = fr-(f/2)\n", - "f2 = fr+(f/2)\n", - "\n", - "#Result\n", - "print \"The total Bandwidth is\",round(f),\"Hz\"\n", - "print \"The edge frequency f1 is\",round(f1),\"Hz\"\n", - "print \"The edge frequency f2 is\",round(f2),\"Hz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The total Bandwidth is 60000.0 Hz\n", - "The edge frequency f1 is 5970000.0 Hz\n", - "The edge frequency f2 is 6030000.0 Hz\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/TestContribution/bilal_2.ipynb b/TestContribution/bilal_2.ipynb deleted file mode 100755 index 22d13091..00000000 --- a/TestContribution/bilal_2.ipynb +++ /dev/null @@ -1,406 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e19af2f3d200c02cdde989919b1864a16727820a7b37667c650dffdfc779957b" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 25: Resonance" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.1, page no. 754" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import numpy as np\n", - "\n", - "#Variable declaration\n", - "L = 8 # Value of Inductor (8-H)\n", - "C = 20e-6 #Value of Capacitor (20-uF)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = np.sqrt(L*C)\n", - "fr = 1/(2*p*a)\n", - "\n", - "#Result\n", - "print \"Resonant frequency is\",float(fr), \"Hz i.e 12.6 Hz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resonant frequency is 12.5806717862 Hz i.e 12.6 Hz\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.2, page no. 755" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import numpy as np\n", - "\n", - "#Variable declaration\n", - "L = 2e-6 # Value of Inductor (2-uH)\n", - "C = 3e-12 #Value of Capacitor (3-pF)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = np.sqrt(L*C)\n", - "fr = 1/(2*p*a)\n", - "\n", - "#Result\n", - "print \"Resonant frequency is\",float(fr), \"Hz i.e 65 MHz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resonant frequency is 64966309.7492 Hz i.e 65 MHz\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.3, page no. 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "L = 239e-6 # Value of Inductor (239-uH)\n", - "f = 1000*10^3 #Frequency (1000 KHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = p*p\n", - "b = f*f\n", - "C = 1/(4*a*b*L)\n", - "\n", - "#Result\n", - "print \"Value of Capacitor is\",float(C), \"F i.e 106 pF\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Capacitor is 1.05893477038e-06 F i.e 106 pF\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.4, page no. 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "C = 106e-12 # Value of Capacitor (106-pF)\n", - "f = 1000000 #Frequency (1 MHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = 4*(p*p)\n", - "b = f*f\n", - "c = a*b*C\n", - "L = 1/(a*C*b)\n", - "\n", - "#Result\n", - "print \"Value of Inductor is\",float(L), \"H i.e 239 uH\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Inductor is 0.000238903098251 H i.e 239 uH\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.5, page no. 759" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Vo = 100e-3 #Output Voltage(100-mV)\n", - "Vi = 2e-3 #Input Voltage(2-mV)\n", - "\n", - "#Calculation\n", - "Q = Vo/Vi\n", - "\n", - "#Result\n", - "print \"Value of Q is\",round(Q)," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Q is 50.0\n" - ] - } - ], - "prompt_number": 38 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.6, page no. 759" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Q = 50 #Quality Factor\n", - "L = 250e-6 # Value of Inductor (250-uH)\n", - "f = 400000 #Frequency (400 KHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "x = 2*p*f*L\n", - "rs = x/Q\n", - "\n", - "#Result\n", - "print \"Value of AC resistance is\",float(rs),\"Ohms\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of AC resistance is 12.568\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.7, page no. 761" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"Because they divide VT equally, ZEQ is 225 kOhms, the same as R1. The amount of input voltage does not matter, as the voltage division determines the relative proportions between R1 and ZEQ. With 225 kOhms for ZEQ and 1.5 kOhms for XL, the Q is 225\u20441.5, or Q = 150.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Because they divide VT equally, ZEQ is 225 kOhms, the same as R1. The amount of input voltage does not matter, as the voltage division determines the relative proportions between R1 and ZEQ. With 225 kOhms for ZEQ and 1.5 kOhms for XL, the Q is 225\u20441.5, or Q = 150.\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.8, page no. 761" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Z = 17600 #Equivalent Impedence\n", - "L = 350e-6 # Value of Inductor (350-uH)\n", - "f = 200000 #Frequency (200 KHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "x = 2*p*f*L\n", - "Q = Z/x\n", - "\n", - "#Result\n", - "print \"Value of Quality factor is\", round(Q)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Quality factor is 40.0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.9, page no. 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Q = 100 #Quality Factor\n", - "fr = 2000000 # Resonant frequency (2000 KHz)\n", - "\n", - "#Calculation\n", - "f = fr/Q\n", - "f1 = fr-(f/2)\n", - "f2 = fr+(f/2)\n", - "\n", - "#Result\n", - "print \"The total Bandwidth is\",round(f),\"Hz\"\n", - "print \"The edge frequency f1 is\",round(f1),\"Hz\"\n", - "print \"The edge frequency f2 is\",round(f2),\"Hz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The total Bandwidth is 20000.0 Hz\n", - "The edge frequency f1 is 1990000.0 Hz\n", - "The edge frequency f2 is 2010000.0 Hz\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.10, page no. 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Q = 100 #Quality Factor\n", - "fr = 6000000 # Resonant frequency (6000 KHz)\n", - "\n", - "#Calculation\n", - "f = fr/Q\n", - "f1 = fr-(f/2)\n", - "f2 = fr+(f/2)\n", - "\n", - "#Result\n", - "print \"The total Bandwidth is\",round(f),\"Hz\"\n", - "print \"The edge frequency f1 is\",round(f1),\"Hz\"\n", - "print \"The edge frequency f2 is\",round(f2),\"Hz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The total Bandwidth is 60000.0 Hz\n", - "The edge frequency f1 is 5970000.0 Hz\n", - "The edge frequency f2 is 6030000.0 Hz\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/TestContribution/bilal_3.ipynb b/TestContribution/bilal_3.ipynb deleted file mode 100755 index 22d13091..00000000 --- a/TestContribution/bilal_3.ipynb +++ /dev/null @@ -1,406 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e19af2f3d200c02cdde989919b1864a16727820a7b37667c650dffdfc779957b" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 25: Resonance" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.1, page no. 754" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import numpy as np\n", - "\n", - "#Variable declaration\n", - "L = 8 # Value of Inductor (8-H)\n", - "C = 20e-6 #Value of Capacitor (20-uF)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = np.sqrt(L*C)\n", - "fr = 1/(2*p*a)\n", - "\n", - "#Result\n", - "print \"Resonant frequency is\",float(fr), \"Hz i.e 12.6 Hz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resonant frequency is 12.5806717862 Hz i.e 12.6 Hz\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.2, page no. 755" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import numpy as np\n", - "\n", - "#Variable declaration\n", - "L = 2e-6 # Value of Inductor (2-uH)\n", - "C = 3e-12 #Value of Capacitor (3-pF)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = np.sqrt(L*C)\n", - "fr = 1/(2*p*a)\n", - "\n", - "#Result\n", - "print \"Resonant frequency is\",float(fr), \"Hz i.e 65 MHz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resonant frequency is 64966309.7492 Hz i.e 65 MHz\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.3, page no. 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "L = 239e-6 # Value of Inductor (239-uH)\n", - "f = 1000*10^3 #Frequency (1000 KHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = p*p\n", - "b = f*f\n", - "C = 1/(4*a*b*L)\n", - "\n", - "#Result\n", - "print \"Value of Capacitor is\",float(C), \"F i.e 106 pF\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Capacitor is 1.05893477038e-06 F i.e 106 pF\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.4, page no. 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "C = 106e-12 # Value of Capacitor (106-pF)\n", - "f = 1000000 #Frequency (1 MHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "a = 4*(p*p)\n", - "b = f*f\n", - "c = a*b*C\n", - "L = 1/(a*C*b)\n", - "\n", - "#Result\n", - "print \"Value of Inductor is\",float(L), \"H i.e 239 uH\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Inductor is 0.000238903098251 H i.e 239 uH\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.5, page no. 759" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Vo = 100e-3 #Output Voltage(100-mV)\n", - "Vi = 2e-3 #Input Voltage(2-mV)\n", - "\n", - "#Calculation\n", - "Q = Vo/Vi\n", - "\n", - "#Result\n", - "print \"Value of Q is\",round(Q)," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Q is 50.0\n" - ] - } - ], - "prompt_number": 38 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.6, page no. 759" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Q = 50 #Quality Factor\n", - "L = 250e-6 # Value of Inductor (250-uH)\n", - "f = 400000 #Frequency (400 KHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "x = 2*p*f*L\n", - "rs = x/Q\n", - "\n", - "#Result\n", - "print \"Value of AC resistance is\",float(rs),\"Ohms\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of AC resistance is 12.568\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.7, page no. 761" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"Because they divide VT equally, ZEQ is 225 kOhms, the same as R1. The amount of input voltage does not matter, as the voltage division determines the relative proportions between R1 and ZEQ. With 225 kOhms for ZEQ and 1.5 kOhms for XL, the Q is 225\u20441.5, or Q = 150.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Because they divide VT equally, ZEQ is 225 kOhms, the same as R1. The amount of input voltage does not matter, as the voltage division determines the relative proportions between R1 and ZEQ. With 225 kOhms for ZEQ and 1.5 kOhms for XL, the Q is 225\u20441.5, or Q = 150.\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.8, page no. 761" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Z = 17600 #Equivalent Impedence\n", - "L = 350e-6 # Value of Inductor (350-uH)\n", - "f = 200000 #Frequency (200 KHz)\n", - "p = 3.142 #Value of pi\n", - "\n", - "#Calculation\n", - "x = 2*p*f*L\n", - "Q = Z/x\n", - "\n", - "#Result\n", - "print \"Value of Quality factor is\", round(Q)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of Quality factor is 40.0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.9, page no. 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Q = 100 #Quality Factor\n", - "fr = 2000000 # Resonant frequency (2000 KHz)\n", - "\n", - "#Calculation\n", - "f = fr/Q\n", - "f1 = fr-(f/2)\n", - "f2 = fr+(f/2)\n", - "\n", - "#Result\n", - "print \"The total Bandwidth is\",round(f),\"Hz\"\n", - "print \"The edge frequency f1 is\",round(f1),\"Hz\"\n", - "print \"The edge frequency f2 is\",round(f2),\"Hz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The total Bandwidth is 20000.0 Hz\n", - "The edge frequency f1 is 1990000.0 Hz\n", - "The edge frequency f2 is 2010000.0 Hz\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 25.10, page no. 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "Q = 100 #Quality Factor\n", - "fr = 6000000 # Resonant frequency (6000 KHz)\n", - "\n", - "#Calculation\n", - "f = fr/Q\n", - "f1 = fr-(f/2)\n", - "f2 = fr+(f/2)\n", - "\n", - "#Result\n", - "print \"The total Bandwidth is\",round(f),\"Hz\"\n", - "print \"The edge frequency f1 is\",round(f1),\"Hz\"\n", - "print \"The edge frequency f2 is\",round(f2),\"Hz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The total Bandwidth is 60000.0 Hz\n", - "The edge frequency f1 is 5970000.0 Hz\n", - "The edge frequency f2 is 6030000.0 Hz\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/TestContribution/ch3.ipynb b/TestContribution/ch3.ipynb deleted file mode 100755 index 8becd279..00000000 --- a/TestContribution/ch3.ipynb +++ /dev/null @@ -1,941 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 3 : The mechanical equivalent of heat" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.1 pageno : 44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "m = 20;\t\t\t#calorimeter of water equivalent in gm\n", - "n = 1030;\t\t\t#weight of water in gm\n", - "p = 2;\t\t\t#no.of paddles\n", - "a = 10;\t\t\t#weight of each paddle in kg\n", - "s = 80;\t\t\t#dismath.tance between paddles in m\n", - "g = 980;\t\t\t#accelaration due to gravity in cm/sec**2\n", - "\n", - "# Calculations\n", - "E = (p*a*1000*g*s*100);\t\t\t#potential energy in dyne cm\n", - "T = (E)/(1050*4.18*10**7);\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the rise in temperature of water is %3.2f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature of water is 3.57 deg.C\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.2 pageno : 45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "cp = 0.1;\t\t\t#specific heat of copper in kj/kg-K\n", - "w = 120;\t\t\t#weight of copper calorimeter in gm\n", - "a = 1400;\t\t\t#weight of paraffin oil in gm\n", - "cp1 = 0.6;\t\t\t#specific of parafin oil in kj/kg-K\n", - "b = 10**8;\t\t\t#force to rotate the paddle in dynes\n", - "T = 16;\t\t\t#rise in temperature in deg.C\n", - "n = 900;\t\t\t#no.of revolutions stirred \n", - "pi = 3.14;\t\t\t#value of pi\n", - "\n", - "# Calculations\n", - "c = 2*pi*b;\t\t\t#work done by a rotating paddle per rotation in dyne cm per rotation\n", - "d = c*n;\t\t\t#total work done in dyne cm \n", - "hc = w*cp*16;\t\t\t#heat gained by calorimeter in calories\n", - "hp = a*cp1*16;\t\t\t#heat gaained by paraffin oil in calories \n", - "J = d/(hc+hp);\t\t\t#mecanical equivalent of heat in erg/cal\n", - "\n", - "# Result\n", - "print 'mecanical equivalent of heat is %.2e erg/cal'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mecanical equivalent of heat is 4.15e+07 erg/cal\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.3 pageno : 45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "cp = 0.12;\t\t\t#specific heat of iron in kj/kg-K\n", - "m = 25;\t\t\t#mass of iron in lb\n", - "h = 0.4;\t\t\t#horse power developed in 3 min\n", - "t = 3;\t\t\t#time taken to develop the horse power in min\n", - "T = 17;\t\t\t#raise in temp in deg.C\n", - "\n", - "# Calculations\n", - "w = h*33000*t;\t\t\t#total work done in ft-lb\n", - "H = m*cp*T;\t\t\t#aount of heat developed in B.Th.U\n", - "J = (w)/H;\t\t\t#the value of mechanical equivalent of heat\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent of water is %3.1f ft-lb/B.Th.U'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent of water is 776.5 ft-lb/B.Th.U\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.4 pageno : 45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "n = 2.;\t\t\t#no.of lead blocks\n", - "m = 210.;\t\t\t#mass of each lead block in gm\n", - "v = 20000.;\t\t\t#velocity of block relative to earth in cm/sec\n", - "J = 4.2*10**7;\t\t\t#mechanical equivalent of heat in ergs/calorie\n", - "cp = 0.03;\t\t\t#specific heat of lead in kj/kg-K\n", - "\n", - "# Calculations\n", - "E = (m*v**2)/2;\t\t\t#kinetic energy of each block in ergs\n", - "E2 = n*E;\t\t\t#total kinetic energy in ergs\n", - "T = E2/(J*m*n*cp);\t\t\t#mean rise in temperature in T\n", - "\n", - "# Result\n", - "print 'the mean rise in temperature is %3.1f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mean rise in temperature is 158.7 deg.C\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.5 pageno : 45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "h = 150;\t\t\t#height froom which ball fallen in ft\n", - "cp = 0.03;\t\t\t#specific heat of lead in kj/kg-K\n", - "J = 778;\t\t\t#mechanical equivalent of heat in ft lb/B.Th.U\n", - "\n", - "# Calculations\n", - "#work done in falling is equal to heat absorbed by the ball\n", - "T = 160./(J*cp)*(5./9);\t\t\t#the raise in temperature in T\n", - "\n", - "# Result\n", - "print 'the raise in temperature is %3.1f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the raise in temperature is 3.8 deg.C\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.6 pageno : 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "# Variables \n", - "w = 26.6;\t\t\t#work done one horse in to raise the temperature in lb\n", - "T1 = 32.;\t\t\t#temperature at initial in deg.F\n", - "T2 = 212.;\t\t\t#temperature at final in deg.F\n", - "t = 2.5;\t\t\t#time to raise the tmperature in hrs\n", - "p = 25.;\t\t\t#percentage of heat lossed \n", - "\n", - "# Calculations\n", - "#only 75% of heat is utillised\n", - "x = w*180.*100.*778./((100-p)*150);\t\t\t#the rate at which horse worked\n", - "\n", - "# Result\n", - "print 'the rate at which horse worked is %3.0f ft-lb wt/min'%(x)\n", - "print \"Note : Answer in book is rounded off, Please calculate manually. This answer is accurate.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rate at which horse worked is 33112 ft-lb wt/min\n", - "Note : Answer in book is rounded off, Please calculate manually. This answer is accurate.\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.7 pageno : 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "l = 100.;\t\t\t#length of glass tube in cm\n", - "m = 500.;\t\t\t#mass of mercury in glass tube in gm\n", - "n = 20.;\t\t\t#number of times inverted i succession\n", - "cp = 0.03;\t\t\t#specific heat of mercury in cal/gm/deg.C\n", - "J = 4.2;\t\t\t#joule's equivalent in j/cal\n", - "g = 981.;\t\t\t#accelaration due to gravity in cm/s**2\n", - "\n", - "# Calculations\n", - "PE = m*g*l;\t\t\t#potential energy for each time in ergs\n", - "TE = PE*n;\t\t\t#total loss in ergs\n", - "T = TE/(m*cp*J*10**7);\t\t\t#rise in temperature in deg.C\n", - "#if T is the rise in temperature,then heat devoloped is m*cp*T\n", - "\n", - "# Result\n", - "print 'the rise in temperature is %3.2f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature is 1.56 deg.C\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.8 page no : 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables \n", - "d = 0.02;\t\t\t#diameter of the copper wire in cm\n", - "i = 1;\t\t\t#current in amp\n", - "T = 100;\t\t\t#maximum steady temperature in deg.C\n", - "r = 2.1;\t\t\t#resistance of the wire in ohm cm\n", - "J = 4.2;\t\t\t#mechanical equivalent of heat in j/cal\n", - "a = 3.14*d**2/4;\t\t\t#area of the copper wire in sq.cm\n", - "a2 = 1;\t\t\t#area of the copper surface in sq.cm\n", - "\n", - "# Calculations \n", - "l = 1/(2*3.14*d/2);\t\t\t#length corresponding to the area in cm\n", - "R = r*l/a;\t\t\t#resistance of the copper wire in ohm\n", - "w = R*a2**2;\t\t\t#work done in joule\n", - "h = w/J;\t\t\t#heat devoleped in cal\n", - "\n", - "# Result\n", - "print 'the heat developed is %.f calories'%(round(h,-1))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the heat developed is 25360 calories\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.9 pageno: 47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "\n", - "# Variables\n", - "h = 10000;\t\t\t#vertical height of water fall in cm\n", - "v = 5;\t\t\t #volume disharged per sec in litres\n", - "J = 4.18;\t\t\t#joule's constant in j/cal\n", - "g = 981;\t\t\t#accelaration due to gravity in cm/sec**2\n", - "\n", - "# Calculations\n", - "m = v*1000;\t\t\t#mass of water disharged per sec in gm\n", - "w = m*h*g;\t\t\t#work done in falling through 100m in erg\n", - "H = (v*10**7 *g)/(J*10**7);\t#quantity of heat produced in cal\n", - "T = H/m;\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the quantity of heat produced is %3f cal \\\n", - "\\nthe rise in temperature is %3.2f deg.C'%(H,T)\n", - "\n", - "print \"Note : Answer for part A in book is wrong. Please calculate manually.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the quantity of heat produced is 1173.444976 cal \n", - "the rise in temperature is 0.23 deg.C\n", - "Note : Answer for part A in book is wrong. Please calculate manually.\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.10 page no : 47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables \n", - "cp = 0.03;\t\t\t#specific heat of lead in kj/kg.k\n", - "v = 10000;\t\t\t#initial velocity of bullet in cm/sec\n", - "J = 4.2*10**7;\t\t\t#joules constant in ergs/cal\n", - "\n", - "# Calculations\n", - "ke = (v**2)/2;\t\t\t#kinetic energy of the bullet per unit mass in (cm/sec)**2\n", - "T = ke*95/(cp*J*100);\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the rise in temperature is %3.1f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature is 37.7 deg.C\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.11 page no : 47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "h = 5000.;\t\t\t#height of the niagara falls in cm\n", - "J = 4.2*10**7;\t\t#joules constant in ergs per cal\n", - "g = 981;\t\t\t#accelaration due to gravity in cm/sec**2\n", - "\n", - "#CALCULATIONS\n", - "w = h*g;\t\t\t#work done per unit mass in ergs/gn\n", - "T = w/J;\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the rise in temperature is %3.2f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature is 0.12 deg.C\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.12 page no : 48\n" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "\n", - "# Variables \n", - "E1 = 3.75;\t\t\t#potential difference in v\n", - "E2 = 3.;\t\t\t#potential differnce in v\n", - "i1 = 2.5;\t\t\t#current in amp\n", - "i2 = 2;\t\t\t #current in amp\n", - "T = 2.7;\t\t\t#the rise in temperature of the water in deg.C\n", - "m1 = 48.;\t\t\t#water flow rate at 3 volts in gm/min\n", - "m2 = 30.;\t\t\t#water flow rate at 3.75volts in gm/min\n", - "s = 1;\t\t\t #specific heat of the water kj/kg-K\n", - "\n", - "# Calculations\n", - "J = (E1*i1-E2*i2)/(s*T*(m1-m2)/60);\t\t\t#the mechanical equivalent in j/cal\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent is %3.3f j/cal'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent is 4.167 j/cal\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.13 page no : 48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables \n", - "R = 64*10**7;\t\t\t#mean radius of the earth in cm\n", - "cp = 0.15;\t\t\t#specific heat of earth in kj/kg-K\n", - "J = 4.2*10**7;\t\t\t#joules consmath.tant in erg/cal\n", - "\n", - "# Calculations\n", - "i = 2./5*R**2;\t\t\t#moment of inertia of the earth per unit mass in joules\n", - "w = (2*3.14)/(24*60*60);\t\t\t#angular velocity of the earth in rad/sec\n", - "T = (i*w**2)/(2*J*cp);\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the rise in the temperature is %.1f deg C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in the temperature is 68.7 deg C\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.14 page no : 49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "cp = 1.25;\t\t\t#specific heat of helium inkj/kg-K\n", - "v = 1000;\t\t\t#volume of the gas in ml\n", - "w = 0.1785;\t\t\t#mass of the gas at N.T.P in gm\n", - "p = 76*13.6*981;\t#pressure of the gas at N.T.P in dynes\n", - "T = 273;\t\t\t#temperature at N.T.P in K\n", - "\n", - "# Calculations\n", - "V = 1000/w;\t\t\t#volume occupied by the 1gm of helium gas in cc\n", - "cv = cp/1.66;\t\t#specific heat at constant volume it is monatomuc gas kj/kg-K\n", - "r = p*V/T;\t\t\t#gas constant in cm**3.atm./K.mol\n", - "J = r/(cp-cv);\t\t#mechanical equivalent of heat in erg/cal\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent of heat is %.2e ergs/calories'%(J)\n", - "print \"Note: answer slightly different because of rounding error.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent of heat is 4.19e+07 ergs/calories\n", - "Note: answer slightly different because of rounding error.\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "\n", - "Example 3.15 pageno : 49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "n = 1./273; \t\t\t#coefficent of expaaansion of air\n", - "a = 0.001293;\t \t\t#density of air in gm/cc\n", - "cp = 0.2389;\t\t \t#specific heat at consmath.tant pressure in kj/kg.K\n", - "p = 76*13.6*981;\t\t\t#pressure at 0 deg.C in dynes\n", - "\n", - "# Calculations\n", - "J = (p*n)/(a*(cp-(cp/1.405)));\t\t\t#mechanical equivalent of heat\n", - "\n", - "# Result\n", - "print 'mechanical equivalent of heat is %.2e ergs/cal'%(J)\n", - "print \"Note: answer slightly different because of rounding error.\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mechanical equivalent of heat is 4.17e+07 ergs/cal\n", - "Note: answer slightly different because of rounding error.\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.16 pageno : 49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "# Variables \n", - "r = 120./60;\t\t\t#rate of flow of water in gm/sec\n", - "T1 = 27.30;\t\t\t#temperature at initial in deg.C\n", - "T2 = 33.75;\t\t\t#temperature at final in deg.C\n", - "v = 12.64;\t\t\t#potential drop in volts\n", - "s = 1.; \t\t\t#specific heat of water in kj/kg-K\n", - "i = 4.35;\t\t\t#current through the heating element in amp\n", - "\n", - "# Calculations\n", - "J = (v*i)/(r*s*(T2-T1));\t\t\t#the mechanical equivalent of heat in joule/calorie\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent of heat is %3.2f j/cal'%(J)\n", - "print \"Note: answer slightly different because of rounding error.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent of heat is 4.26 j/cal\n", - "Note: answer slightly different because of rounding error.\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.17 page no : 50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables \n", - "cp = 6.865;\t\t\t#molar specific heat of hydrogen at consmath.tant pressure in kj/kg-K\n", - "cv = 4.880;\t\t\t#molar specific heat of hydrogen at consmath.tant volume in kj/kg-K\n", - "p = 1.013*10**6;\t\t\t#atmospheric pressure in dynes/cm**2\n", - "v = 22.4*10**3;\t\t\t#gram molar volume in ml\n", - "T = 273;\t\t\t#temperature at N.T.P in kelvins\n", - "\n", - "# Calculations\n", - "J = (p*v)/(T*(cp-cv));\t\t\t#mechanical equivalent of heat\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent of heat is %.2e ergs/cal'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent of heat is 4.19e+07 ergs/cal\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.18 page no : 50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "# Variables\n", - "v = 1000.;\t\t\t#volume of hydrogen in ml\n", - "t = 273.;\t\t\t#tempature of hydrogen in kelvin\n", - "p = 76.;\t\t\t#pressure of hydrogen in mm of hg\n", - "w = 0.0896;\t\t\t#weigh of hydrogen in gm\n", - "cp = 3.409;\t\t\t#specific heat of hydogen in kj/kg-K\n", - "cv = 2.411;\t\t\t#specific heat of hydrogen in kj/kg-K\n", - "g = 981.;\t\t\t#accelaration due to gravity in cm/sec**2\n", - "a = 13.6;\t\t\t#density of mercury in gm/cm**2\n", - "\n", - "# Calculations\n", - "J = (p*v*g*a)/(w*t*(cp-cv));\t\t\t#mechanical equivalent of heat in ergs/cals\n", - "\n", - "# Result\n", - "print 'mechanical equivalent of heat is %.2e ergs/calorie'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mechanical equivalent of heat is 4.15e+07 ergs/calorie\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.19 page no : 50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "cp = 0.23;\t\t\t#specific heat at constant pressure in kj/kg-K\n", - "a = 1.18;\t\t\t#density of air in gm/lit\n", - "J = 4.2*10**7;\t\t\t#mechanical equivalent of heat in ergs/cal\n", - "t = 300;\t\t\t#temperature of air in kelvin\n", - "p = 73*13.6*981;\t\t\t#pressure of air in dynes\n", - "\t\t\t#cp-cv = (r/J) = pv/(tj)\n", - "\n", - "#CALCULATON\n", - "cv = cp-(p*1000/(a*t*J));\t\t\t#specific heat at constant volume in calories\n", - "\n", - "# Result\n", - "print 'the specific heat at constant volume is %.4f calories'%(cv)\n", - "print \"Note: answer slightly different because of rounding error.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the specific heat at constant volume is 0.1645 calories\n", - "Note: answer slightly different because of rounding error.\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.20 pageno : 51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "t1 = 0;\t\t\t#temperature of water in deg.C\n", - "t2 = 0;\t\t\t#temperature of ice in deg.C\n", - "J = 4.18*10**7;\t\t\t#the joules thomson coefficent in erg/cal\n", - "l = 80;\t\t\t#latent heat og fusion kj/kg\n", - "g = 981;\t\t\t#accelaration due to gravity in cm/sec**2\n", - " \n", - "# Calculations\n", - "h = l*J/(15*g);\t\t\t#height from which ice has fallen\n", - "\n", - "# Result\n", - "print 'the height from which ice has fallen is %.2e cm'%(h)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the height from which ice has fallen is 2.27e+05 cm\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.21 page no : 51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables\n", - "T = 80;\t\t\t#temperature of bullet in deg.C\n", - "cp = 0.03;\t\t\t#specific heat of lead in kj/kg-K\n", - "J = 4.2;\t\t\t#mechanical equivalent of heat in j/cal\n", - "\n", - "# Calculations\n", - "h = T*cp;\t\t\t#heat developed per unit mass in calorie\n", - "v = (J*10**7*h*2/0.9)**0.5;\t\t\t#velocity of bullet in cm/sec\n", - "\n", - "# Result\n", - "print 'the velocity of bullet is %.1e cm/sec'%(v)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the velocity of bullet is 1.5e+04 cm/sec\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.22 pageno : 51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "w = 5.0;\t\t\t#weight of lead ball in lb\n", - "cp = 0.032;\t\t\t#specific heat of lead in Btu/lbdeg.F\n", - "h = 50;\t\t\t#height at which ball thrown in feets\n", - "v = 20;\t\t\t#vertical speed in ft/sec\n", - "g = 32;\t\t\t#accelararion due to gravity in ft/sec**2\n", - "\n", - "# Calculations\n", - "u = (v**2)+2*g*h\n", - "ke = (w/2*(u));\t\t\t#kinetic energy of the ball at ground\n", - "T = ke/(2*32*778*w*cp);\t\t\t#rise of temperature in deg.F\n", - "\n", - "# Result\n", - "print 'the rise in temperature is %.1f deg.F'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature is 1.1 deg.F\n" - ] - } - ], - "prompt_number": 32 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/TestContribution/ch3_1.ipynb b/TestContribution/ch3_1.ipynb deleted file mode 100755 index 8becd279..00000000 --- a/TestContribution/ch3_1.ipynb +++ /dev/null @@ -1,941 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 3 : The mechanical equivalent of heat" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.1 pageno : 44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "m = 20;\t\t\t#calorimeter of water equivalent in gm\n", - "n = 1030;\t\t\t#weight of water in gm\n", - "p = 2;\t\t\t#no.of paddles\n", - "a = 10;\t\t\t#weight of each paddle in kg\n", - "s = 80;\t\t\t#dismath.tance between paddles in m\n", - "g = 980;\t\t\t#accelaration due to gravity in cm/sec**2\n", - "\n", - "# Calculations\n", - "E = (p*a*1000*g*s*100);\t\t\t#potential energy in dyne cm\n", - "T = (E)/(1050*4.18*10**7);\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the rise in temperature of water is %3.2f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature of water is 3.57 deg.C\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.2 pageno : 45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "cp = 0.1;\t\t\t#specific heat of copper in kj/kg-K\n", - "w = 120;\t\t\t#weight of copper calorimeter in gm\n", - "a = 1400;\t\t\t#weight of paraffin oil in gm\n", - "cp1 = 0.6;\t\t\t#specific of parafin oil in kj/kg-K\n", - "b = 10**8;\t\t\t#force to rotate the paddle in dynes\n", - "T = 16;\t\t\t#rise in temperature in deg.C\n", - "n = 900;\t\t\t#no.of revolutions stirred \n", - "pi = 3.14;\t\t\t#value of pi\n", - "\n", - "# Calculations\n", - "c = 2*pi*b;\t\t\t#work done by a rotating paddle per rotation in dyne cm per rotation\n", - "d = c*n;\t\t\t#total work done in dyne cm \n", - "hc = w*cp*16;\t\t\t#heat gained by calorimeter in calories\n", - "hp = a*cp1*16;\t\t\t#heat gaained by paraffin oil in calories \n", - "J = d/(hc+hp);\t\t\t#mecanical equivalent of heat in erg/cal\n", - "\n", - "# Result\n", - "print 'mecanical equivalent of heat is %.2e erg/cal'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mecanical equivalent of heat is 4.15e+07 erg/cal\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.3 pageno : 45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "cp = 0.12;\t\t\t#specific heat of iron in kj/kg-K\n", - "m = 25;\t\t\t#mass of iron in lb\n", - "h = 0.4;\t\t\t#horse power developed in 3 min\n", - "t = 3;\t\t\t#time taken to develop the horse power in min\n", - "T = 17;\t\t\t#raise in temp in deg.C\n", - "\n", - "# Calculations\n", - "w = h*33000*t;\t\t\t#total work done in ft-lb\n", - "H = m*cp*T;\t\t\t#aount of heat developed in B.Th.U\n", - "J = (w)/H;\t\t\t#the value of mechanical equivalent of heat\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent of water is %3.1f ft-lb/B.Th.U'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent of water is 776.5 ft-lb/B.Th.U\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.4 pageno : 45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "n = 2.;\t\t\t#no.of lead blocks\n", - "m = 210.;\t\t\t#mass of each lead block in gm\n", - "v = 20000.;\t\t\t#velocity of block relative to earth in cm/sec\n", - "J = 4.2*10**7;\t\t\t#mechanical equivalent of heat in ergs/calorie\n", - "cp = 0.03;\t\t\t#specific heat of lead in kj/kg-K\n", - "\n", - "# Calculations\n", - "E = (m*v**2)/2;\t\t\t#kinetic energy of each block in ergs\n", - "E2 = n*E;\t\t\t#total kinetic energy in ergs\n", - "T = E2/(J*m*n*cp);\t\t\t#mean rise in temperature in T\n", - "\n", - "# Result\n", - "print 'the mean rise in temperature is %3.1f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mean rise in temperature is 158.7 deg.C\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.5 pageno : 45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "h = 150;\t\t\t#height froom which ball fallen in ft\n", - "cp = 0.03;\t\t\t#specific heat of lead in kj/kg-K\n", - "J = 778;\t\t\t#mechanical equivalent of heat in ft lb/B.Th.U\n", - "\n", - "# Calculations\n", - "#work done in falling is equal to heat absorbed by the ball\n", - "T = 160./(J*cp)*(5./9);\t\t\t#the raise in temperature in T\n", - "\n", - "# Result\n", - "print 'the raise in temperature is %3.1f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the raise in temperature is 3.8 deg.C\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.6 pageno : 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "# Variables \n", - "w = 26.6;\t\t\t#work done one horse in to raise the temperature in lb\n", - "T1 = 32.;\t\t\t#temperature at initial in deg.F\n", - "T2 = 212.;\t\t\t#temperature at final in deg.F\n", - "t = 2.5;\t\t\t#time to raise the tmperature in hrs\n", - "p = 25.;\t\t\t#percentage of heat lossed \n", - "\n", - "# Calculations\n", - "#only 75% of heat is utillised\n", - "x = w*180.*100.*778./((100-p)*150);\t\t\t#the rate at which horse worked\n", - "\n", - "# Result\n", - "print 'the rate at which horse worked is %3.0f ft-lb wt/min'%(x)\n", - "print \"Note : Answer in book is rounded off, Please calculate manually. This answer is accurate.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rate at which horse worked is 33112 ft-lb wt/min\n", - "Note : Answer in book is rounded off, Please calculate manually. This answer is accurate.\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.7 pageno : 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "l = 100.;\t\t\t#length of glass tube in cm\n", - "m = 500.;\t\t\t#mass of mercury in glass tube in gm\n", - "n = 20.;\t\t\t#number of times inverted i succession\n", - "cp = 0.03;\t\t\t#specific heat of mercury in cal/gm/deg.C\n", - "J = 4.2;\t\t\t#joule's equivalent in j/cal\n", - "g = 981.;\t\t\t#accelaration due to gravity in cm/s**2\n", - "\n", - "# Calculations\n", - "PE = m*g*l;\t\t\t#potential energy for each time in ergs\n", - "TE = PE*n;\t\t\t#total loss in ergs\n", - "T = TE/(m*cp*J*10**7);\t\t\t#rise in temperature in deg.C\n", - "#if T is the rise in temperature,then heat devoloped is m*cp*T\n", - "\n", - "# Result\n", - "print 'the rise in temperature is %3.2f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature is 1.56 deg.C\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.8 page no : 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables \n", - "d = 0.02;\t\t\t#diameter of the copper wire in cm\n", - "i = 1;\t\t\t#current in amp\n", - "T = 100;\t\t\t#maximum steady temperature in deg.C\n", - "r = 2.1;\t\t\t#resistance of the wire in ohm cm\n", - "J = 4.2;\t\t\t#mechanical equivalent of heat in j/cal\n", - "a = 3.14*d**2/4;\t\t\t#area of the copper wire in sq.cm\n", - "a2 = 1;\t\t\t#area of the copper surface in sq.cm\n", - "\n", - "# Calculations \n", - "l = 1/(2*3.14*d/2);\t\t\t#length corresponding to the area in cm\n", - "R = r*l/a;\t\t\t#resistance of the copper wire in ohm\n", - "w = R*a2**2;\t\t\t#work done in joule\n", - "h = w/J;\t\t\t#heat devoleped in cal\n", - "\n", - "# Result\n", - "print 'the heat developed is %.f calories'%(round(h,-1))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the heat developed is 25360 calories\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.9 pageno: 47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "\n", - "# Variables\n", - "h = 10000;\t\t\t#vertical height of water fall in cm\n", - "v = 5;\t\t\t #volume disharged per sec in litres\n", - "J = 4.18;\t\t\t#joule's constant in j/cal\n", - "g = 981;\t\t\t#accelaration due to gravity in cm/sec**2\n", - "\n", - "# Calculations\n", - "m = v*1000;\t\t\t#mass of water disharged per sec in gm\n", - "w = m*h*g;\t\t\t#work done in falling through 100m in erg\n", - "H = (v*10**7 *g)/(J*10**7);\t#quantity of heat produced in cal\n", - "T = H/m;\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the quantity of heat produced is %3f cal \\\n", - "\\nthe rise in temperature is %3.2f deg.C'%(H,T)\n", - "\n", - "print \"Note : Answer for part A in book is wrong. Please calculate manually.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the quantity of heat produced is 1173.444976 cal \n", - "the rise in temperature is 0.23 deg.C\n", - "Note : Answer for part A in book is wrong. Please calculate manually.\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.10 page no : 47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables \n", - "cp = 0.03;\t\t\t#specific heat of lead in kj/kg.k\n", - "v = 10000;\t\t\t#initial velocity of bullet in cm/sec\n", - "J = 4.2*10**7;\t\t\t#joules constant in ergs/cal\n", - "\n", - "# Calculations\n", - "ke = (v**2)/2;\t\t\t#kinetic energy of the bullet per unit mass in (cm/sec)**2\n", - "T = ke*95/(cp*J*100);\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the rise in temperature is %3.1f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature is 37.7 deg.C\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.11 page no : 47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "h = 5000.;\t\t\t#height of the niagara falls in cm\n", - "J = 4.2*10**7;\t\t#joules constant in ergs per cal\n", - "g = 981;\t\t\t#accelaration due to gravity in cm/sec**2\n", - "\n", - "#CALCULATIONS\n", - "w = h*g;\t\t\t#work done per unit mass in ergs/gn\n", - "T = w/J;\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the rise in temperature is %3.2f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature is 0.12 deg.C\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.12 page no : 48\n" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "\n", - "# Variables \n", - "E1 = 3.75;\t\t\t#potential difference in v\n", - "E2 = 3.;\t\t\t#potential differnce in v\n", - "i1 = 2.5;\t\t\t#current in amp\n", - "i2 = 2;\t\t\t #current in amp\n", - "T = 2.7;\t\t\t#the rise in temperature of the water in deg.C\n", - "m1 = 48.;\t\t\t#water flow rate at 3 volts in gm/min\n", - "m2 = 30.;\t\t\t#water flow rate at 3.75volts in gm/min\n", - "s = 1;\t\t\t #specific heat of the water kj/kg-K\n", - "\n", - "# Calculations\n", - "J = (E1*i1-E2*i2)/(s*T*(m1-m2)/60);\t\t\t#the mechanical equivalent in j/cal\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent is %3.3f j/cal'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent is 4.167 j/cal\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.13 page no : 48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables \n", - "R = 64*10**7;\t\t\t#mean radius of the earth in cm\n", - "cp = 0.15;\t\t\t#specific heat of earth in kj/kg-K\n", - "J = 4.2*10**7;\t\t\t#joules consmath.tant in erg/cal\n", - "\n", - "# Calculations\n", - "i = 2./5*R**2;\t\t\t#moment of inertia of the earth per unit mass in joules\n", - "w = (2*3.14)/(24*60*60);\t\t\t#angular velocity of the earth in rad/sec\n", - "T = (i*w**2)/(2*J*cp);\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the rise in the temperature is %.1f deg C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in the temperature is 68.7 deg C\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.14 page no : 49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "cp = 1.25;\t\t\t#specific heat of helium inkj/kg-K\n", - "v = 1000;\t\t\t#volume of the gas in ml\n", - "w = 0.1785;\t\t\t#mass of the gas at N.T.P in gm\n", - "p = 76*13.6*981;\t#pressure of the gas at N.T.P in dynes\n", - "T = 273;\t\t\t#temperature at N.T.P in K\n", - "\n", - "# Calculations\n", - "V = 1000/w;\t\t\t#volume occupied by the 1gm of helium gas in cc\n", - "cv = cp/1.66;\t\t#specific heat at constant volume it is monatomuc gas kj/kg-K\n", - "r = p*V/T;\t\t\t#gas constant in cm**3.atm./K.mol\n", - "J = r/(cp-cv);\t\t#mechanical equivalent of heat in erg/cal\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent of heat is %.2e ergs/calories'%(J)\n", - "print \"Note: answer slightly different because of rounding error.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent of heat is 4.19e+07 ergs/calories\n", - "Note: answer slightly different because of rounding error.\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "\n", - "Example 3.15 pageno : 49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "n = 1./273; \t\t\t#coefficent of expaaansion of air\n", - "a = 0.001293;\t \t\t#density of air in gm/cc\n", - "cp = 0.2389;\t\t \t#specific heat at consmath.tant pressure in kj/kg.K\n", - "p = 76*13.6*981;\t\t\t#pressure at 0 deg.C in dynes\n", - "\n", - "# Calculations\n", - "J = (p*n)/(a*(cp-(cp/1.405)));\t\t\t#mechanical equivalent of heat\n", - "\n", - "# Result\n", - "print 'mechanical equivalent of heat is %.2e ergs/cal'%(J)\n", - "print \"Note: answer slightly different because of rounding error.\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mechanical equivalent of heat is 4.17e+07 ergs/cal\n", - "Note: answer slightly different because of rounding error.\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.16 pageno : 49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "# Variables \n", - "r = 120./60;\t\t\t#rate of flow of water in gm/sec\n", - "T1 = 27.30;\t\t\t#temperature at initial in deg.C\n", - "T2 = 33.75;\t\t\t#temperature at final in deg.C\n", - "v = 12.64;\t\t\t#potential drop in volts\n", - "s = 1.; \t\t\t#specific heat of water in kj/kg-K\n", - "i = 4.35;\t\t\t#current through the heating element in amp\n", - "\n", - "# Calculations\n", - "J = (v*i)/(r*s*(T2-T1));\t\t\t#the mechanical equivalent of heat in joule/calorie\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent of heat is %3.2f j/cal'%(J)\n", - "print \"Note: answer slightly different because of rounding error.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent of heat is 4.26 j/cal\n", - "Note: answer slightly different because of rounding error.\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.17 page no : 50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables \n", - "cp = 6.865;\t\t\t#molar specific heat of hydrogen at consmath.tant pressure in kj/kg-K\n", - "cv = 4.880;\t\t\t#molar specific heat of hydrogen at consmath.tant volume in kj/kg-K\n", - "p = 1.013*10**6;\t\t\t#atmospheric pressure in dynes/cm**2\n", - "v = 22.4*10**3;\t\t\t#gram molar volume in ml\n", - "T = 273;\t\t\t#temperature at N.T.P in kelvins\n", - "\n", - "# Calculations\n", - "J = (p*v)/(T*(cp-cv));\t\t\t#mechanical equivalent of heat\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent of heat is %.2e ergs/cal'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent of heat is 4.19e+07 ergs/cal\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.18 page no : 50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "# Variables\n", - "v = 1000.;\t\t\t#volume of hydrogen in ml\n", - "t = 273.;\t\t\t#tempature of hydrogen in kelvin\n", - "p = 76.;\t\t\t#pressure of hydrogen in mm of hg\n", - "w = 0.0896;\t\t\t#weigh of hydrogen in gm\n", - "cp = 3.409;\t\t\t#specific heat of hydogen in kj/kg-K\n", - "cv = 2.411;\t\t\t#specific heat of hydrogen in kj/kg-K\n", - "g = 981.;\t\t\t#accelaration due to gravity in cm/sec**2\n", - "a = 13.6;\t\t\t#density of mercury in gm/cm**2\n", - "\n", - "# Calculations\n", - "J = (p*v*g*a)/(w*t*(cp-cv));\t\t\t#mechanical equivalent of heat in ergs/cals\n", - "\n", - "# Result\n", - "print 'mechanical equivalent of heat is %.2e ergs/calorie'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mechanical equivalent of heat is 4.15e+07 ergs/calorie\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.19 page no : 50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "cp = 0.23;\t\t\t#specific heat at constant pressure in kj/kg-K\n", - "a = 1.18;\t\t\t#density of air in gm/lit\n", - "J = 4.2*10**7;\t\t\t#mechanical equivalent of heat in ergs/cal\n", - "t = 300;\t\t\t#temperature of air in kelvin\n", - "p = 73*13.6*981;\t\t\t#pressure of air in dynes\n", - "\t\t\t#cp-cv = (r/J) = pv/(tj)\n", - "\n", - "#CALCULATON\n", - "cv = cp-(p*1000/(a*t*J));\t\t\t#specific heat at constant volume in calories\n", - "\n", - "# Result\n", - "print 'the specific heat at constant volume is %.4f calories'%(cv)\n", - "print \"Note: answer slightly different because of rounding error.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the specific heat at constant volume is 0.1645 calories\n", - "Note: answer slightly different because of rounding error.\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.20 pageno : 51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "t1 = 0;\t\t\t#temperature of water in deg.C\n", - "t2 = 0;\t\t\t#temperature of ice in deg.C\n", - "J = 4.18*10**7;\t\t\t#the joules thomson coefficent in erg/cal\n", - "l = 80;\t\t\t#latent heat og fusion kj/kg\n", - "g = 981;\t\t\t#accelaration due to gravity in cm/sec**2\n", - " \n", - "# Calculations\n", - "h = l*J/(15*g);\t\t\t#height from which ice has fallen\n", - "\n", - "# Result\n", - "print 'the height from which ice has fallen is %.2e cm'%(h)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the height from which ice has fallen is 2.27e+05 cm\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.21 page no : 51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables\n", - "T = 80;\t\t\t#temperature of bullet in deg.C\n", - "cp = 0.03;\t\t\t#specific heat of lead in kj/kg-K\n", - "J = 4.2;\t\t\t#mechanical equivalent of heat in j/cal\n", - "\n", - "# Calculations\n", - "h = T*cp;\t\t\t#heat developed per unit mass in calorie\n", - "v = (J*10**7*h*2/0.9)**0.5;\t\t\t#velocity of bullet in cm/sec\n", - "\n", - "# Result\n", - "print 'the velocity of bullet is %.1e cm/sec'%(v)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the velocity of bullet is 1.5e+04 cm/sec\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.22 pageno : 51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "w = 5.0;\t\t\t#weight of lead ball in lb\n", - "cp = 0.032;\t\t\t#specific heat of lead in Btu/lbdeg.F\n", - "h = 50;\t\t\t#height at which ball thrown in feets\n", - "v = 20;\t\t\t#vertical speed in ft/sec\n", - "g = 32;\t\t\t#accelararion due to gravity in ft/sec**2\n", - "\n", - "# Calculations\n", - "u = (v**2)+2*g*h\n", - "ke = (w/2*(u));\t\t\t#kinetic energy of the ball at ground\n", - "T = ke/(2*32*778*w*cp);\t\t\t#rise of temperature in deg.F\n", - "\n", - "# Result\n", - "print 'the rise in temperature is %.1f deg.F'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature is 1.1 deg.F\n" - ] - } - ], - "prompt_number": 32 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/TestContribution/ch3_2.ipynb b/TestContribution/ch3_2.ipynb deleted file mode 100755 index 8becd279..00000000 --- a/TestContribution/ch3_2.ipynb +++ /dev/null @@ -1,941 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 3 : The mechanical equivalent of heat" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.1 pageno : 44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "m = 20;\t\t\t#calorimeter of water equivalent in gm\n", - "n = 1030;\t\t\t#weight of water in gm\n", - "p = 2;\t\t\t#no.of paddles\n", - "a = 10;\t\t\t#weight of each paddle in kg\n", - "s = 80;\t\t\t#dismath.tance between paddles in m\n", - "g = 980;\t\t\t#accelaration due to gravity in cm/sec**2\n", - "\n", - "# Calculations\n", - "E = (p*a*1000*g*s*100);\t\t\t#potential energy in dyne cm\n", - "T = (E)/(1050*4.18*10**7);\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the rise in temperature of water is %3.2f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature of water is 3.57 deg.C\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.2 pageno : 45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "cp = 0.1;\t\t\t#specific heat of copper in kj/kg-K\n", - "w = 120;\t\t\t#weight of copper calorimeter in gm\n", - "a = 1400;\t\t\t#weight of paraffin oil in gm\n", - "cp1 = 0.6;\t\t\t#specific of parafin oil in kj/kg-K\n", - "b = 10**8;\t\t\t#force to rotate the paddle in dynes\n", - "T = 16;\t\t\t#rise in temperature in deg.C\n", - "n = 900;\t\t\t#no.of revolutions stirred \n", - "pi = 3.14;\t\t\t#value of pi\n", - "\n", - "# Calculations\n", - "c = 2*pi*b;\t\t\t#work done by a rotating paddle per rotation in dyne cm per rotation\n", - "d = c*n;\t\t\t#total work done in dyne cm \n", - "hc = w*cp*16;\t\t\t#heat gained by calorimeter in calories\n", - "hp = a*cp1*16;\t\t\t#heat gaained by paraffin oil in calories \n", - "J = d/(hc+hp);\t\t\t#mecanical equivalent of heat in erg/cal\n", - "\n", - "# Result\n", - "print 'mecanical equivalent of heat is %.2e erg/cal'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mecanical equivalent of heat is 4.15e+07 erg/cal\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.3 pageno : 45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "cp = 0.12;\t\t\t#specific heat of iron in kj/kg-K\n", - "m = 25;\t\t\t#mass of iron in lb\n", - "h = 0.4;\t\t\t#horse power developed in 3 min\n", - "t = 3;\t\t\t#time taken to develop the horse power in min\n", - "T = 17;\t\t\t#raise in temp in deg.C\n", - "\n", - "# Calculations\n", - "w = h*33000*t;\t\t\t#total work done in ft-lb\n", - "H = m*cp*T;\t\t\t#aount of heat developed in B.Th.U\n", - "J = (w)/H;\t\t\t#the value of mechanical equivalent of heat\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent of water is %3.1f ft-lb/B.Th.U'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent of water is 776.5 ft-lb/B.Th.U\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.4 pageno : 45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "n = 2.;\t\t\t#no.of lead blocks\n", - "m = 210.;\t\t\t#mass of each lead block in gm\n", - "v = 20000.;\t\t\t#velocity of block relative to earth in cm/sec\n", - "J = 4.2*10**7;\t\t\t#mechanical equivalent of heat in ergs/calorie\n", - "cp = 0.03;\t\t\t#specific heat of lead in kj/kg-K\n", - "\n", - "# Calculations\n", - "E = (m*v**2)/2;\t\t\t#kinetic energy of each block in ergs\n", - "E2 = n*E;\t\t\t#total kinetic energy in ergs\n", - "T = E2/(J*m*n*cp);\t\t\t#mean rise in temperature in T\n", - "\n", - "# Result\n", - "print 'the mean rise in temperature is %3.1f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mean rise in temperature is 158.7 deg.C\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.5 pageno : 45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "h = 150;\t\t\t#height froom which ball fallen in ft\n", - "cp = 0.03;\t\t\t#specific heat of lead in kj/kg-K\n", - "J = 778;\t\t\t#mechanical equivalent of heat in ft lb/B.Th.U\n", - "\n", - "# Calculations\n", - "#work done in falling is equal to heat absorbed by the ball\n", - "T = 160./(J*cp)*(5./9);\t\t\t#the raise in temperature in T\n", - "\n", - "# Result\n", - "print 'the raise in temperature is %3.1f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the raise in temperature is 3.8 deg.C\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.6 pageno : 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "# Variables \n", - "w = 26.6;\t\t\t#work done one horse in to raise the temperature in lb\n", - "T1 = 32.;\t\t\t#temperature at initial in deg.F\n", - "T2 = 212.;\t\t\t#temperature at final in deg.F\n", - "t = 2.5;\t\t\t#time to raise the tmperature in hrs\n", - "p = 25.;\t\t\t#percentage of heat lossed \n", - "\n", - "# Calculations\n", - "#only 75% of heat is utillised\n", - "x = w*180.*100.*778./((100-p)*150);\t\t\t#the rate at which horse worked\n", - "\n", - "# Result\n", - "print 'the rate at which horse worked is %3.0f ft-lb wt/min'%(x)\n", - "print \"Note : Answer in book is rounded off, Please calculate manually. This answer is accurate.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rate at which horse worked is 33112 ft-lb wt/min\n", - "Note : Answer in book is rounded off, Please calculate manually. This answer is accurate.\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.7 pageno : 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "l = 100.;\t\t\t#length of glass tube in cm\n", - "m = 500.;\t\t\t#mass of mercury in glass tube in gm\n", - "n = 20.;\t\t\t#number of times inverted i succession\n", - "cp = 0.03;\t\t\t#specific heat of mercury in cal/gm/deg.C\n", - "J = 4.2;\t\t\t#joule's equivalent in j/cal\n", - "g = 981.;\t\t\t#accelaration due to gravity in cm/s**2\n", - "\n", - "# Calculations\n", - "PE = m*g*l;\t\t\t#potential energy for each time in ergs\n", - "TE = PE*n;\t\t\t#total loss in ergs\n", - "T = TE/(m*cp*J*10**7);\t\t\t#rise in temperature in deg.C\n", - "#if T is the rise in temperature,then heat devoloped is m*cp*T\n", - "\n", - "# Result\n", - "print 'the rise in temperature is %3.2f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature is 1.56 deg.C\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.8 page no : 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables \n", - "d = 0.02;\t\t\t#diameter of the copper wire in cm\n", - "i = 1;\t\t\t#current in amp\n", - "T = 100;\t\t\t#maximum steady temperature in deg.C\n", - "r = 2.1;\t\t\t#resistance of the wire in ohm cm\n", - "J = 4.2;\t\t\t#mechanical equivalent of heat in j/cal\n", - "a = 3.14*d**2/4;\t\t\t#area of the copper wire in sq.cm\n", - "a2 = 1;\t\t\t#area of the copper surface in sq.cm\n", - "\n", - "# Calculations \n", - "l = 1/(2*3.14*d/2);\t\t\t#length corresponding to the area in cm\n", - "R = r*l/a;\t\t\t#resistance of the copper wire in ohm\n", - "w = R*a2**2;\t\t\t#work done in joule\n", - "h = w/J;\t\t\t#heat devoleped in cal\n", - "\n", - "# Result\n", - "print 'the heat developed is %.f calories'%(round(h,-1))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the heat developed is 25360 calories\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.9 pageno: 47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "\n", - "# Variables\n", - "h = 10000;\t\t\t#vertical height of water fall in cm\n", - "v = 5;\t\t\t #volume disharged per sec in litres\n", - "J = 4.18;\t\t\t#joule's constant in j/cal\n", - "g = 981;\t\t\t#accelaration due to gravity in cm/sec**2\n", - "\n", - "# Calculations\n", - "m = v*1000;\t\t\t#mass of water disharged per sec in gm\n", - "w = m*h*g;\t\t\t#work done in falling through 100m in erg\n", - "H = (v*10**7 *g)/(J*10**7);\t#quantity of heat produced in cal\n", - "T = H/m;\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the quantity of heat produced is %3f cal \\\n", - "\\nthe rise in temperature is %3.2f deg.C'%(H,T)\n", - "\n", - "print \"Note : Answer for part A in book is wrong. Please calculate manually.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the quantity of heat produced is 1173.444976 cal \n", - "the rise in temperature is 0.23 deg.C\n", - "Note : Answer for part A in book is wrong. Please calculate manually.\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.10 page no : 47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables \n", - "cp = 0.03;\t\t\t#specific heat of lead in kj/kg.k\n", - "v = 10000;\t\t\t#initial velocity of bullet in cm/sec\n", - "J = 4.2*10**7;\t\t\t#joules constant in ergs/cal\n", - "\n", - "# Calculations\n", - "ke = (v**2)/2;\t\t\t#kinetic energy of the bullet per unit mass in (cm/sec)**2\n", - "T = ke*95/(cp*J*100);\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the rise in temperature is %3.1f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature is 37.7 deg.C\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.11 page no : 47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "h = 5000.;\t\t\t#height of the niagara falls in cm\n", - "J = 4.2*10**7;\t\t#joules constant in ergs per cal\n", - "g = 981;\t\t\t#accelaration due to gravity in cm/sec**2\n", - "\n", - "#CALCULATIONS\n", - "w = h*g;\t\t\t#work done per unit mass in ergs/gn\n", - "T = w/J;\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the rise in temperature is %3.2f deg.C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature is 0.12 deg.C\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.12 page no : 48\n" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "\n", - "# Variables \n", - "E1 = 3.75;\t\t\t#potential difference in v\n", - "E2 = 3.;\t\t\t#potential differnce in v\n", - "i1 = 2.5;\t\t\t#current in amp\n", - "i2 = 2;\t\t\t #current in amp\n", - "T = 2.7;\t\t\t#the rise in temperature of the water in deg.C\n", - "m1 = 48.;\t\t\t#water flow rate at 3 volts in gm/min\n", - "m2 = 30.;\t\t\t#water flow rate at 3.75volts in gm/min\n", - "s = 1;\t\t\t #specific heat of the water kj/kg-K\n", - "\n", - "# Calculations\n", - "J = (E1*i1-E2*i2)/(s*T*(m1-m2)/60);\t\t\t#the mechanical equivalent in j/cal\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent is %3.3f j/cal'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent is 4.167 j/cal\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.13 page no : 48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables \n", - "R = 64*10**7;\t\t\t#mean radius of the earth in cm\n", - "cp = 0.15;\t\t\t#specific heat of earth in kj/kg-K\n", - "J = 4.2*10**7;\t\t\t#joules consmath.tant in erg/cal\n", - "\n", - "# Calculations\n", - "i = 2./5*R**2;\t\t\t#moment of inertia of the earth per unit mass in joules\n", - "w = (2*3.14)/(24*60*60);\t\t\t#angular velocity of the earth in rad/sec\n", - "T = (i*w**2)/(2*J*cp);\t\t\t#rise in temperature in deg.C\n", - "\n", - "# Result\n", - "print 'the rise in the temperature is %.1f deg C'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in the temperature is 68.7 deg C\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.14 page no : 49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "cp = 1.25;\t\t\t#specific heat of helium inkj/kg-K\n", - "v = 1000;\t\t\t#volume of the gas in ml\n", - "w = 0.1785;\t\t\t#mass of the gas at N.T.P in gm\n", - "p = 76*13.6*981;\t#pressure of the gas at N.T.P in dynes\n", - "T = 273;\t\t\t#temperature at N.T.P in K\n", - "\n", - "# Calculations\n", - "V = 1000/w;\t\t\t#volume occupied by the 1gm of helium gas in cc\n", - "cv = cp/1.66;\t\t#specific heat at constant volume it is monatomuc gas kj/kg-K\n", - "r = p*V/T;\t\t\t#gas constant in cm**3.atm./K.mol\n", - "J = r/(cp-cv);\t\t#mechanical equivalent of heat in erg/cal\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent of heat is %.2e ergs/calories'%(J)\n", - "print \"Note: answer slightly different because of rounding error.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent of heat is 4.19e+07 ergs/calories\n", - "Note: answer slightly different because of rounding error.\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "\n", - "Example 3.15 pageno : 49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables \n", - "n = 1./273; \t\t\t#coefficent of expaaansion of air\n", - "a = 0.001293;\t \t\t#density of air in gm/cc\n", - "cp = 0.2389;\t\t \t#specific heat at consmath.tant pressure in kj/kg.K\n", - "p = 76*13.6*981;\t\t\t#pressure at 0 deg.C in dynes\n", - "\n", - "# Calculations\n", - "J = (p*n)/(a*(cp-(cp/1.405)));\t\t\t#mechanical equivalent of heat\n", - "\n", - "# Result\n", - "print 'mechanical equivalent of heat is %.2e ergs/cal'%(J)\n", - "print \"Note: answer slightly different because of rounding error.\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mechanical equivalent of heat is 4.17e+07 ergs/cal\n", - "Note: answer slightly different because of rounding error.\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.16 pageno : 49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "# Variables \n", - "r = 120./60;\t\t\t#rate of flow of water in gm/sec\n", - "T1 = 27.30;\t\t\t#temperature at initial in deg.C\n", - "T2 = 33.75;\t\t\t#temperature at final in deg.C\n", - "v = 12.64;\t\t\t#potential drop in volts\n", - "s = 1.; \t\t\t#specific heat of water in kj/kg-K\n", - "i = 4.35;\t\t\t#current through the heating element in amp\n", - "\n", - "# Calculations\n", - "J = (v*i)/(r*s*(T2-T1));\t\t\t#the mechanical equivalent of heat in joule/calorie\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent of heat is %3.2f j/cal'%(J)\n", - "print \"Note: answer slightly different because of rounding error.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent of heat is 4.26 j/cal\n", - "Note: answer slightly different because of rounding error.\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.17 page no : 50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables \n", - "cp = 6.865;\t\t\t#molar specific heat of hydrogen at consmath.tant pressure in kj/kg-K\n", - "cv = 4.880;\t\t\t#molar specific heat of hydrogen at consmath.tant volume in kj/kg-K\n", - "p = 1.013*10**6;\t\t\t#atmospheric pressure in dynes/cm**2\n", - "v = 22.4*10**3;\t\t\t#gram molar volume in ml\n", - "T = 273;\t\t\t#temperature at N.T.P in kelvins\n", - "\n", - "# Calculations\n", - "J = (p*v)/(T*(cp-cv));\t\t\t#mechanical equivalent of heat\n", - "\n", - "# Result\n", - "print 'the mechanical equivalent of heat is %.2e ergs/cal'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the mechanical equivalent of heat is 4.19e+07 ergs/cal\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.18 page no : 50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "# Variables\n", - "v = 1000.;\t\t\t#volume of hydrogen in ml\n", - "t = 273.;\t\t\t#tempature of hydrogen in kelvin\n", - "p = 76.;\t\t\t#pressure of hydrogen in mm of hg\n", - "w = 0.0896;\t\t\t#weigh of hydrogen in gm\n", - "cp = 3.409;\t\t\t#specific heat of hydogen in kj/kg-K\n", - "cv = 2.411;\t\t\t#specific heat of hydrogen in kj/kg-K\n", - "g = 981.;\t\t\t#accelaration due to gravity in cm/sec**2\n", - "a = 13.6;\t\t\t#density of mercury in gm/cm**2\n", - "\n", - "# Calculations\n", - "J = (p*v*g*a)/(w*t*(cp-cv));\t\t\t#mechanical equivalent of heat in ergs/cals\n", - "\n", - "# Result\n", - "print 'mechanical equivalent of heat is %.2e ergs/calorie'%(J)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mechanical equivalent of heat is 4.15e+07 ergs/calorie\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.19 page no : 50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "cp = 0.23;\t\t\t#specific heat at constant pressure in kj/kg-K\n", - "a = 1.18;\t\t\t#density of air in gm/lit\n", - "J = 4.2*10**7;\t\t\t#mechanical equivalent of heat in ergs/cal\n", - "t = 300;\t\t\t#temperature of air in kelvin\n", - "p = 73*13.6*981;\t\t\t#pressure of air in dynes\n", - "\t\t\t#cp-cv = (r/J) = pv/(tj)\n", - "\n", - "#CALCULATON\n", - "cv = cp-(p*1000/(a*t*J));\t\t\t#specific heat at constant volume in calories\n", - "\n", - "# Result\n", - "print 'the specific heat at constant volume is %.4f calories'%(cv)\n", - "print \"Note: answer slightly different because of rounding error.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the specific heat at constant volume is 0.1645 calories\n", - "Note: answer slightly different because of rounding error.\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.20 pageno : 51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "t1 = 0;\t\t\t#temperature of water in deg.C\n", - "t2 = 0;\t\t\t#temperature of ice in deg.C\n", - "J = 4.18*10**7;\t\t\t#the joules thomson coefficent in erg/cal\n", - "l = 80;\t\t\t#latent heat og fusion kj/kg\n", - "g = 981;\t\t\t#accelaration due to gravity in cm/sec**2\n", - " \n", - "# Calculations\n", - "h = l*J/(15*g);\t\t\t#height from which ice has fallen\n", - "\n", - "# Result\n", - "print 'the height from which ice has fallen is %.2e cm'%(h)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the height from which ice has fallen is 2.27e+05 cm\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.21 page no : 51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "# Variables\n", - "T = 80;\t\t\t#temperature of bullet in deg.C\n", - "cp = 0.03;\t\t\t#specific heat of lead in kj/kg-K\n", - "J = 4.2;\t\t\t#mechanical equivalent of heat in j/cal\n", - "\n", - "# Calculations\n", - "h = T*cp;\t\t\t#heat developed per unit mass in calorie\n", - "v = (J*10**7*h*2/0.9)**0.5;\t\t\t#velocity of bullet in cm/sec\n", - "\n", - "# Result\n", - "print 'the velocity of bullet is %.1e cm/sec'%(v)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the velocity of bullet is 1.5e+04 cm/sec\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.22 pageno : 51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "# Variables\n", - "w = 5.0;\t\t\t#weight of lead ball in lb\n", - "cp = 0.032;\t\t\t#specific heat of lead in Btu/lbdeg.F\n", - "h = 50;\t\t\t#height at which ball thrown in feets\n", - "v = 20;\t\t\t#vertical speed in ft/sec\n", - "g = 32;\t\t\t#accelararion due to gravity in ft/sec**2\n", - "\n", - "# Calculations\n", - "u = (v**2)+2*g*h\n", - "ke = (w/2*(u));\t\t\t#kinetic energy of the ball at ground\n", - "T = ke/(2*32*778*w*cp);\t\t\t#rise of temperature in deg.F\n", - "\n", - "# Result\n", - "print 'the rise in temperature is %.1f deg.F'%(T)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the rise in temperature is 1.1 deg.F\n" - ] - } - ], - "prompt_number": 32 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/TestContribution/chapterno1.ipynb b/TestContribution/chapterno1.ipynb deleted file mode 100755 index 5ff2285e..00000000 --- a/TestContribution/chapterno1.ipynb +++ /dev/null @@ -1,126 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:a1ed470be69235951f179c73fc3f7daca02bf5e071f528ddce3fb4f1444cb8ef" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 1: INTRODUCTORY DIGITAL CONCEPTS" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1-1,Page No-6" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable Declaration\n", - "T=10*10**-3\n", - "tw=1*10**-3\n", - "\n", - "#Calculations\n", - "#Part A\n", - "f=1/T\n", - "\n", - "#Part C\n", - "Duty_Cycle=(tw/T)*100\n", - "\n", - "\n", - "#Results\n", - "print\"The Period is measured from the edge of the next pulse. In this case T is measured from leading edge to leading edge,as indicated.T equals 10*10^-3\"\n", - "print\"f=\",f,\"Hz\"\n", - "print\"Duty Cycle=\",Duty_Cycle,\"%\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The Period is measured from the edge of the next pulse. In this case T is measured from leading edge to leading edge,as indicated.T equals 10*10^-3\n", - "f= 100.0 Hz\n", - "Duty Cycle= 10.0 %\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1-2, Page No-8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable Declaration\n", - "f=100*10**-3\n", - "time=8\n", - "T=1/f\n", - "print\"Since the frequency of the clock is 100kHz,the period is\",T,\"usec\"\n", - "print\"It takes 10*10**-6to transfer each bit in the waveform.The total transfer time for 8 bits is time\"\n", - "print\"Time is\",time,\"usec\"\n", - "\n", - "print\"To detrmine the sequence of bits,examine the waveform during each bit time.If waveform A is HIGH during the bit time, a 1 is transferred. If waveform A is LOW during the bit time,a0 is transferred. The bit sequence is illustrated .The left mosst bit is the first to be transferred.\"\n", - "\n", - "print\"A parallel transfer would take 10*10**-6 for all eight bits.\"\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Since the frequency of the clock is 100kHz,the period is 10.0 usec\n", - "It takes 10*10**-6to transfer each bit in the waveform.The total transfer time for 8 bits is time\n", - "Time is 8 usec\n", - "To detrmine the sequence of bits,examine the waveform during each bit time.If waveform A is HIGH during the bit time, a 1 is transferred. If waveform A is LOW during the bit time,a0 is transferred. The bit sequence is illustrated .The left mosst bit is the first to be transferred.\n", - "A parallel transfer would take 10*10**-6 for all eight bits.\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 8 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/TestContribution/exampleCount.py b/TestContribution/exampleCount.py deleted file mode 100755 index f9c17511..00000000 --- a/TestContribution/exampleCount.py +++ /dev/null @@ -1,27 +0,0 @@ -import json -import os -import re - -class info: - notebook = '' - examples = [] -notebooks = os.listdir('.') -notebooks = sorted(notebooks) -print notebooks - -total = 0 - -for i in range(len(notebooks)): - ch_examples = 0 - if notebooks[i].endswith(".ipynb"): - f = open(notebooks[i],'r') - data = json.load(f) - for dic in data["worksheets"][0]["cells"][0:]: - if "level" in dic and dic["level"] == 2: - ch_examples += 1 - total += ch_examples - print i, " : " , ch_examples - - - -print "Total Examples : " , total diff --git a/TestContribution/screenshots/State_Direction.png b/TestContribution/screenshots/State_Direction.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_1.png b/TestContribution/screenshots/State_Direction_1.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_1.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_10.png b/TestContribution/screenshots/State_Direction_10.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_10.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_11.png b/TestContribution/screenshots/State_Direction_11.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_11.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_12.png b/TestContribution/screenshots/State_Direction_12.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_12.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_13.png b/TestContribution/screenshots/State_Direction_13.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_13.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_14.png b/TestContribution/screenshots/State_Direction_14.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_14.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_15.png b/TestContribution/screenshots/State_Direction_15.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_15.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_16.png b/TestContribution/screenshots/State_Direction_16.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_16.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_17.png b/TestContribution/screenshots/State_Direction_17.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_17.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_18.png b/TestContribution/screenshots/State_Direction_18.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_18.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_19.png b/TestContribution/screenshots/State_Direction_19.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_19.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_2.png b/TestContribution/screenshots/State_Direction_2.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_2.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_20.png b/TestContribution/screenshots/State_Direction_20.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_20.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_3.png b/TestContribution/screenshots/State_Direction_3.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_3.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_4.png b/TestContribution/screenshots/State_Direction_4.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_4.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_5.png b/TestContribution/screenshots/State_Direction_5.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_5.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_6.png b/TestContribution/screenshots/State_Direction_6.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_6.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_7.png b/TestContribution/screenshots/State_Direction_7.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_7.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_8.png b/TestContribution/screenshots/State_Direction_8.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_8.png and /dev/null differ diff --git a/TestContribution/screenshots/State_Direction_9.png b/TestContribution/screenshots/State_Direction_9.png deleted file mode 100755 index 145f4da6..00000000 Binary files a/TestContribution/screenshots/State_Direction_9.png and /dev/null differ diff --git a/Testing_Textbook_Companion_Directory/chapter2.ipynb b/Testing_Textbook_Companion_Directory/chapter2.ipynb deleted file mode 100755 index 33489895..00000000 --- a/Testing_Textbook_Companion_Directory/chapter2.ipynb +++ /dev/null @@ -1,285 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:4b491165aaa84eef66101894e30c202e368215710941e1135ee996c3417298e7" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 2: Types of Energy" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1, page no. 19" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import scipy.integrate\n", - "\n", - "#initialization\n", - "k = 20 #lb/in\n", - "x = 3 #in\n", - "\n", - "#calculation\n", - "def fun(x):\n", - " y = k*x\n", - " return y\n", - "\n", - "w = scipy.integrate.quadrature(fun, 0.0, 3.0)\n", - "\n", - "#result\n", - "print \"Work done = %d in-lb\" %(round(w[0]))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Work done = 90 in-lb\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.2, page no. 22" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import scipy.integrate\n", - "\n", - "#initialization\n", - "w = 0.1 #lbm\n", - "Pv = 30000 #ft-lb/lbm\n", - "v1 = 14.0 #ft^3 /lbm\n", - "v2 = 3.0 #ft^3/lbm\n", - "\n", - "#calculation\n", - "def func(v):\n", - " W = Pv/v\n", - " return W\n", - "\n", - "temp = scipy.integrate.quadrature(func, v1, v2,)\n", - "Work = w * temp[0]\n", - "\n", - "#result\n", - "#Answer varies a bit from the text due to rounding off of log value\n", - "print \"Work done = %d ft-lb\" %Work" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Work done = -4621 ft-lb\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3, page no. 27" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import scipy.integrate\n", - "\n", - "#initialization of variables\n", - "T1 = 500.0 #R\n", - "T2 = 1000.0 #R\n", - "w = 2.0 #lbm\n", - "\n", - "#calculations\n", - "def c(T):\n", - " cp=0.282+0.00046*T\n", - " return cp\n", - "\n", - "Q = scipy.integrate.quadrature(c, T1, T2,)[0]\n", - "Heat = Q*w\n", - "\n", - "#results\n", - "print \"Heat flow = %d B\" %(Heat)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Heat flow = 626 B\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.4, page no. 29" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import scipy.integrate\n", - "\n", - "#initialization\n", - "T1 = 500.0 #R\n", - "T2 = 1060.0 #R\n", - "w = 1 #lbm\n", - "\n", - "#calculation\n", - "def v(T):\n", - " cv = 0.258-120/T +40000/T**2\n", - " return cv\n", - "\n", - "Q = scipy.integrate.quadrature(v, T1, T2,)[0]\n", - "cvm=Q/(T2-T1)\n", - "\n", - "#result\n", - "print \"The amount of heat: \", round(Q,1), \"B/lbm\"\n", - "print \"Mean specific heat = %.3f B/lbm F\" %cvm" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The amount of heat: 96.6 B/lbm\n", - "Mean specific heat = 0.172 B/lbm F\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.5, page no. 31" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#initialization\n", - "w=1 #lbm\n", - "Sw=0.3120 #B/lbm R\n", - "Ss=1.7566 #B/lb R\n", - "T=672 #R\n", - "\n", - "#calculation\n", - "Q=T*(Ss-Sw)\n", - "\n", - "\n", - "#result\n", - "print \"Latent heat of water = %d B/lbm\" %Q" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Latent heat of water = 970 B/lbm\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6, page no. 31" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import scipy.integrate\n", - "\n", - "#initialization\n", - "w=1 #lbm\n", - "T1=492 #R\n", - "T2=672 #R\n", - "cp=1 #B/lbm F\n", - "\n", - "#calculation\n", - "dQ=cp*(T2-T1)\n", - "def ds(T):\n", - " s=1/T\n", - " return s\n", - "\n", - "entropy = scipy.integrate.quadrature(ds, T1, T2,)[0]\n", - "\n", - "#results\n", - "print \"Entropy change = \", round(entropy, 3), \"B/lbm R\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Entropy change = 0.312 B/lbm R\n" - ] - } - ], - "prompt_number": 15 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Testing_Textbook_Companion_Directory/chapter5.ipynb b/Testing_Textbook_Companion_Directory/chapter5.ipynb deleted file mode 100755 index bf944c6e..00000000 --- a/Testing_Textbook_Companion_Directory/chapter5.ipynb +++ /dev/null @@ -1,171 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:080ddee320ed2e8325a1bba2bf7e96e362906d7bc4b7f00bae6953ceccc830a0" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 5: The Second Law of Thermodynamics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.1, page no. 87" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#initilisation\n", - "Tr = 540.0 #R\n", - "Te = 2000.0 #R\n", - "m = 200.0 #B/lbm\n", - "\n", - "#calculation\n", - "eta = 1-(Tr/Te)\n", - "Qr = m*(1-eta)\n", - "\n", - "\n", - "#result\n", - "print \"Thermal efficiency is \", eta*100, \"%\"\n", - "print \"Heat rejected = %d B/lbm\" %Qr" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Thermal efficiency is 73.0 %\n", - "Heat rejected = 54 B/lbm\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.2, page no. 90" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import scipy.integrate\n", - "\n", - "#initilisation\n", - "cv=0.171 #B/lbm F\n", - "T2=580 #F\n", - "T1=520 #F\n", - "\n", - "#calculation\n", - "def fun(T):\n", - " cp=cv/T\n", - " return cp\n", - "\n", - "ds = scipy.integrate.quadrature(fun, T1, T2)[0]\n", - "\n", - "#result\n", - "print \"Change in entropy = %.4f B/lbm R\" %ds" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Change in entropy = 0.0187 B/lbm R\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.3, page no. 95" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import scipy.integrate\n", - "\n", - "#initilisation\n", - "\n", - "Q = 100.0 #B/lbm\n", - "Cp = 0.24 #B/lbm F\n", - "T1 = 70.0+460.0 #R\n", - "T2 = 550.0+460.0 #R\n", - "Ts = 50.0+460.0 #R\n", - "\n", - "#calculation\n", - "def fun(T):\n", - " cp = Cp/T\n", - " return cp\n", - " \n", - "ds1 = scipy.integrate.quadrature(fun, T1, T2)[0]\n", - "Tf = Q/Cp + T1\n", - "ds2 = scipy.integrate.quadrature(fun, T1, Tf)[0]\n", - "Qr = Ts*(ds2)\n", - "Qa = Q-Qr\n", - "Qun = Ts*(ds1)\n", - "Qa2 = Q-Qun\n", - "\n", - "#result\n", - "print \"Case 1\"\n", - "print \"Change in entropy = %.4f B/lbm R\" %ds1\n", - "print \"case 2\"\n", - "print \"Entropy change = %.4f B/lbm R\" %ds2\n", - "print \"Available energy = %.1f B/lbm\" %Qa\n", - "print \"case 3\"\n", - "print \"Available energy = %.1f B/lbm\" %Qa2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Case 1\n", - "Change in entropy = 0.1548 B/lbm R\n", - "case 2\n", - "Entropy change = 0.1392 B/lbm R\n", - "Available energy = 29.0 B/lbm\n", - "case 3\n", - "Available energy = 21.1 B/lbm\n" - ] - } - ], - "prompt_number": 6 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Testing_Textbook_Companion_Directory/screenshots/energy.png b/Testing_Textbook_Companion_Directory/screenshots/energy.png deleted file mode 100755 index 67a7242e..00000000 Binary files a/Testing_Textbook_Companion_Directory/screenshots/energy.png and /dev/null differ diff --git a/Testing_Textbook_Companion_Directory/screenshots/internal-energy.png b/Testing_Textbook_Companion_Directory/screenshots/internal-energy.png deleted file mode 100755 index e2055783..00000000 Binary files a/Testing_Textbook_Companion_Directory/screenshots/internal-energy.png and /dev/null differ diff --git a/Testing_Textbook_Companion_Directory/screenshots/temprature.png b/Testing_Textbook_Companion_Directory/screenshots/temprature.png deleted file mode 100755 index 24557a42..00000000 Binary files a/Testing_Textbook_Companion_Directory/screenshots/temprature.png and /dev/null differ diff --git a/Testing_the_interface/README.txt b/Testing_the_interface/README.txt deleted file mode 100755 index 110efe0b..00000000 --- a/Testing_the_interface/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: Test User -Course: mca -College/Institute/Organization: Indian Institute of Technology -Department/Designation: Aerospace Engineering -Book Title: Testing the interface -Author: Myself -Publisher: Don't Know -Year of publication: 2020 -Isbn: 2233445566 -Edition: 2nd \ No newline at end of file diff --git a/Testing_the_interface/chapter1.ipynb b/Testing_the_interface/chapter1.ipynb deleted file mode 100755 index cf45a409..00000000 --- a/Testing_the_interface/chapter1.ipynb +++ /dev/null @@ -1,423 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 1: Tension Comprssion and Shear" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.1, page no. 9" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "Find compressive stress and strain in the post\n", - "\"\"\"\n", - "\n", - "import math\n", - "\n", - "#initialisation\n", - "\n", - "d_1 = 4 # inner diameter (inch)\n", - "d_2 = 4.5 #outer diameter (inch)\n", - "P = 26000 # pressure in pound\n", - "L = 16 # Length of cylinder (inch)\n", - "my_del = 0.012 # shortening of post (inch)\n", - "\n", - "#calculation\n", - "A = (math.pi/4)*((d_2**2)-(d_1**2)) #Area (inch^2)\n", - "s = P/A # stress\n", - "\n", - "print \"compressive stress in the post is \", round(s), \"psi\"\n", - "\n", - "e = my_del/L # strain\n", - "\n", - "print \"compressive strain in the post is %e\" %e" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "compressive stress in the post is 7789.0 psi\n", - "compressive strain in the post is 7.500000e-04\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.2, page no. 10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "formula for maximum stress & calculating maximum stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "W = 1500 # weight (Newton)\n", - "d = 0.008 #diameter(meter) \n", - "g = 77000 # Weight density of steel\n", - "L = 40 # Length of bar (m)\n", - "\n", - "#calculation\n", - "\n", - "A = (math.pi/4)*(d**2) # Area\n", - "s_max = (1500/A) + (g*L) # maximum stress\n", - "\n", - "#result\n", - "print \"Therefore the maximum stress in the rod is \", round(s_max,1), \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Therefore the maximum stress in the rod is 32921551.8 Pa\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.3. page no. 26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating change in lenght of pipe, strain in pipe, increase in diameter & increase in wall thickness\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d1 = 4.5 # diameter in inch\n", - "d2 = 6 # diameter in inch\n", - "A = (math.pi/4)*((d2**2)-(d1**2)) # Area\n", - "P = 140 # pressure in K\n", - "s = -P/A # stress (compression)\n", - "E = 30000 # young's modulus in Ksi\n", - "e = s/E # strain\n", - "\n", - "#calculation\n", - "\n", - "# Part (a)\n", - "my_del = e*4*12 # del = e*L \n", - "print \"Change in length of the pipe is\", round(my_del,3), \"inch\"\n", - "\n", - "# Part (b)\n", - "v = 0.30 # Poissio's ratio\n", - "e_ = -(v*e)\n", - "print \"Lateral strain in the pipe is %e\" %e_\n", - "\n", - "# Part (c)\n", - "del_d2 = e_*d2 \n", - "del_d1 = e_*d1\n", - "print \"Increase in the inner diameter is \", round(del_d1,6), \"inch\"\n", - "\n", - "# Part (d)\n", - "t = 0.75\n", - "del_t = e_*t\n", - "print \"Increase in the wall thicness is %f\" %del_t, \"inch\"\n", - "del_t1 = (del_d2-del_d1)/2 \n", - "print \"del_t1 = del_t\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Change in length of the pipe is -0.018 inch\n", - "Lateral strain in the pipe is 1.131768e-04\n", - "Increase in the inner diameter is 0.000509 inch\n", - "Increase in the wall thicness is 0.000085 inch\n", - "del_t1 = del_t\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.4, page no. 35" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate average shear stress and compressive stress\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d = 0.02 # diameter in m\n", - "t = 0.008 # thickness in m\n", - "A = math.pi*d*t # shear area\n", - "P = 110000 # prassure in Newton\n", - "\n", - "#calculation\n", - "A1 = (math.pi/4)*(d**2) # Punch area\n", - "t_aver = P/A # Average shear stress \n", - "\n", - "\n", - "print \"Average shear stress in the plate is \", t_aver, \"Pa\"\n", - "s_c = P/A1 # compressive stress\n", - "print \"Average compressive stress in the plate is \", s_c, \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Average shear stress in the plate is 218838046.751 Pa\n", - "Average compressive stress in the plate is 350140874.802 Pa\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Eample 1.5, page no. 36" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate bearing stress, shear stress in pin,\n", - "bearing stress between pin and gussets,\n", - "shear stress in anchor bolts\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "\n", - "P = 12.0 # Pressure in K\n", - "t = 0.375 # thickness of wall in inch\n", - "theta = 40.0 # angle in degree\n", - "d_pin = 0.75 # diameter of pin in inch\n", - "t_G = 0.625 # thickness of gusset in inch\n", - "t_B = 0.375 #thickness of base plate in inch\n", - "d_b = 0.50 # diameter of bolt in inch\n", - "\n", - "#calculation\n", - "\n", - "#Part (a)\n", - "s_b1 = P/(2*t*d_pin) # bearing stress\n", - "print \"Bearing stress between strut and pin\", round(s_b1,1), \"ksi\"\n", - "\n", - "#Part (b)\n", - "t_pin = (4*P)/(2*math.pi*(d_pin**2)) # average shear stress in the \n", - "print \"Shear stress in pin is \", round(t_pin,1), \"ksi\"\n", - "\n", - "# Part (c)\n", - "s_b2 = P/(2*t_G*d_pin) # bearing stress between pin and gusset\n", - "print \"Bearing stress between pin and gussets is\", s_b2, \"ksi\"\n", - "\n", - "# Part (d)\n", - "s_b3 = (P*math.cos(math.radians(40))/(4*t_B*d_b)) # bearing stress between anchor bolt and base plate\n", - "print \"Bearing stress between anchor bolts & base plate\", round(s_b3,1), \"ksi\"\n", - "\n", - "# Part (e)\n", - "t_bolt = (4*math.cos(math.radians(40))*P)/(4*math.pi*(d_b**2)) # shear stress in anchor bolt\n", - "print \"Shear stress in anchor bolts is\", round(t_bolt,1), \"ksi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Bearing stress between strut and pin 21.3 ksi\n", - "Shear stress in pin is 13.6 ksi\n", - "Bearing stress between pin and gussets is 12.8 ksi\n", - "Bearing stress between anchor bolts & base plate 12.3 ksi\n", - "Shear stress in anchor bolts is 11.7 ksi\n" - ] - } - ], - "prompt_number": 39 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7, page no. 42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "determine stress at various parts\n", - "\"\"\"\n", - "\n", - "import math\n", - "\n", - "#initialisation\n", - "b1 = 1.5 # width of recmath.tangular crosssection in inch\n", - "t = 0.5 # thickness of recmath.tangular crosssection in inch\n", - "b2 = 3.0 # width of enlarged recmath.tangular crosssection in inch\n", - "d = 1.0 # diameter in inch\n", - "\n", - "#calculation\n", - "\n", - "# Part (a)\n", - "s_1 = 16000 # maximum allowable tensile stress in Psi\n", - "P_1 = s_1*t*b1 \n", - "print \"The allowable load P1 is\", P_1, \"lb\"\n", - "\n", - "# Part (b)\n", - "s_2 = 11000 # maximum allowable tensile stress in Psi\n", - "P_2 = s_2*t*(b2-d) \n", - "print \"allowable load P2 at this section is\", P_2, \"lb\"\n", - "\n", - "#Part (c)\n", - "s_3 = 26000 # maximum allowable tensile stress in Psi\n", - "P_3 = s_3*t*d \n", - "print \"The allowable load based upon bearing between the hanger and the bolt is\", P_3, \"lb\"\n", - "\n", - "# Part (d)\n", - "s_4 = 6500 # maximum allowable tensile stress in Psi\n", - "P_4 = (math.pi/4)*(d**2)*2*s_4 \n", - "print \"the allowable load P4 based upon shear in the bolt is\", round(P_4), \"lb\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The allowable load P1 is 12000.0 lb\n", - "allowable load P2 at this section is 11000.0 lb\n", - "The allowable load based upon bearing between the hanger and the bolt is 13000.0 lb\n", - "the allowable load P4 based upon shear in the bolt is 10210.0 lb\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.8, page no. 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating the cross sectional area \n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "R_ah = (2700*0.8 + 2700*2.6)/2 # Horizontal component at A in N\n", - "R_ch = R_ah # Horizontal component at C in N\n", - "R_cv = (2700*2.2 + 2700*0.4)/3 # vertical component at C in N\n", - "R_av = 2700 + 2700 - R_cv # vertical component at A in N\n", - "R_a = math.sqrt((R_ah**2)+(R_av**2))\n", - "R_c = math.sqrt((R_ch**2)+(R_cv**2))\n", - "Fab = R_a # Tensile force in bar AB\n", - "Vc = R_c # Shear force acting on the pin at C\n", - "s_allow = 125000000 # allowable stress in tension \n", - "t_allow = 45000000 # allowable stress in shear\n", - "\n", - "#calculation\n", - "Aab = Fab / s_allow # required area of bar \n", - "Apin = Vc / (2*t_allow) # required area of pin\n", - "\n", - "\n", - "print \"Required area of bar is %f\" %Apin, \"m^2\"\n", - "d = math.sqrt((4*Apin)/math.pi) # diameter in meter\n", - "print \"Required diameter of pin is %f\" %d, \"m\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Required area of bar is 0.000057 m^2\n", - "Required diameter of pin is 0.008537 m\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Testing_the_interface/chapter11.ipynb b/Testing_the_interface/chapter11.ipynb deleted file mode 100755 index b7650778..00000000 --- a/Testing_the_interface/chapter11.ipynb +++ /dev/null @@ -1,516 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 11: Columns" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.1, page no. 763" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "allowable load Pallow using a factor of safety & with respect to Euler buckling of the column\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "E = 29000 # Modulus of elasticity in ksi\n", - "spl = 42 # Proportional limit in ksi\n", - "L = 25 # Total length of coloum in ft\n", - "n = 2.5 # factor of safety\n", - "I1 = 98 # Moment of inertia on horizontal axis\n", - "I2 = 21.7 # Moment of inertia on vertical axis\n", - "A = 8.25 # Area of the cross section\n", - "\n", - "#calculation\n", - "Pcr2 = (4*math.pi**2*E*I2)/((L*12)**2) # Criticle load if column buckles in the plane of paper\n", - "Pcr1 = (math.pi**2*E*I1)/((L*12)**2) # Criticle load if column buckles in the plane of paper\n", - "Pcr = min(Pcr1,Pcr2) # Minimum pressure would govern the design\n", - "scr = Pcr/A # Criticle stress\n", - "Pa = Pcr/n # Allowable load in k\n", - "print \"The allowable load is \", round(Pa), \"k\"\n", - " " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The allowable load is 110.0 k\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.2, page no. 774" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate minimum required thickness t of the columns\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "L = 3.25 # Length of alluminium pipe in m\n", - "d = 0.1 # Outer diameter of alluminium pipe\n", - "P = 100000 # Allowable compressive load in N\n", - "n =3 # Safety factor for eular buckling\n", - "E = 72e09 # Modulus of elasticity in Pa\n", - "l = 480e06 # Proportional limit\n", - "\n", - "#calculation\n", - "Pcr = n*P # Critice load\n", - "t = (0.1-(55.6e-06)**(1.0/4.0) )/2.0 # Required thickness\n", - "\n", - "tmin = t \n", - "print \"The minimum required thickness of the coloumn is\", round(tmin*1000,2), \"mm\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The minimum required thickness of the coloumn is 6.82 mm\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.3, page no. 780" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "evaluate the longest permissible length of the bar\n", - "\"\"\"\n", - "\n", - "from sympy import *\n", - "\n", - "#initialisation\n", - "P = 1500 # Load in lb\n", - "e = 0.45 # ecentricity in inch\n", - "h = 1.2 # Height of cross section in inch\n", - "b = 0.6 # Width of cross section in inch\n", - "E = 16e06 # Modulus of elasticity \n", - "my_del = 0.12 # Allowable deflection in inch\n", - "\n", - "#calculation\n", - "L = mpmath.asec(1.2667)/0.06588 # Maximum allowable length possible\n", - "\n", - "#Result\n", - "print \"The longest permissible length of the bar is\", round(L), \"inch\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The longest permissible length of the bar is 10.0 inch\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.4, page no. 785" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "maximum compressive stress in the column & the factor of safety\n", - "\"\"\"\n", - "\n", - "from sympy import *\n", - "import math\n", - "\n", - "#initialisation\n", - "L = 25 # Length of coloum in ft\n", - "P1 = 320 # Load in K\n", - "P2 = 40 # Load in K\n", - "E = 30000 # Modulus of elasticity of steel in Ksi\n", - "P = 360 # Euivalent load\n", - "e = 1.5 # Ecentricity of compressive load\n", - "A = 24.1 # Area of the Cross section\n", - "r = 6.05 # in inch\n", - "c = 7.155 # in inch\n", - "sy = 42 # Yeild stress of steel in Ksi\n", - "\n", - "#calculation\n", - "\n", - "smax = (P/A)*(1+(((e*c)/r**2)*mpmath.sec((L/(2*r))*math.sqrt(P/(E*A))))) # Maximum compressive stress\n", - "print \"The Maximum compressive stress in the column \", round(smax,2), \"ksi\"\n", - "# Bisection method method to solve for yeilding\n", - "def stress(a,b,f):\n", - " N = 100\n", - " eps = 1e-5\n", - " if((f(a)*f(b))>0):\n", - " print 'no root possible f(a)*f(b)>0'\n", - " sys.exit()\n", - " if(abs(f(a))0):\n", - " c = (a+b)/2.0\n", - " if(abs(f(c))0):\n", - " print 'no root possible f(a)*f(b)>0'\n", - " sys.exit()\n", - " if(abs(f(a))0):\n", - " c = (a+b)/2.0\n", - " if(abs(f(c))0):\n", - " print 'no root possible f(a)*f(b)>0'\n", - " sys.exit()\n", - " if(abs(f(a))0):\n", - " c = (a+b)/2.0\n", - " if(abs(f(c))0):\n", - " print 'no root possible f(a)*f(b)>0'\n", - " sys.exit()\n", - " if(abs(f(a))0):\n", - " c = (a+b)/2.0\n", - " if(abs(f(c))0):\n", - " print 'no root possible f(a)*f(b)>0'\n", - " sys.exit()\n", - " if(abs(f(a))0):\n", - " c = (a+b)/2.0\n", - " if(abs(f(c))0):\n", - " print 'no root possible f(a)*f(b)>0'\n", - " sys.exit()\n", - " if(abs(f(a))0):\n", - " c = (a+b)/2.0\n", - " if(abs(f(c))0):\n", - " print 'no root possible f(a)*f(b)>0'\n", - " sys.exit()\n", - " if(abs(f(a))0):\n", - " c = (a+b)/2.0\n", - " if(abs(f(c))0):\n", - " print 'no root possible f(a)*f(b)>0'\n", - " sys.exit()\n", - " if(abs(f(a))0):\n", - " c = (a+b)/2.0\n", - " if(abs(f(c))0):\n", - " print 'no root possible f(a)*f(b)>0'\n", - " sys.exit()\n", - " if(abs(f(a))0):\n", - " c = (a+b)/2.0\n", - " if(abs(f(c))0):\n", - " print 'no root possible f(a)*f(b)>0'\n", - " sys.exit()\n", - " if(abs(f(a))0):\n", - " c = (a+b)/2.0\n", - " if(abs(f(c))0):\n", - " print 'no root possible f(a)*f(b)>0'\n", - " sys.exit()\n", - " if(abs(f(a))0):\n", - " c = (a+b)/2.0\n", - " if(abs(f(c))0):\n", - " print 'no root possible f(a)*f(b)>0'\n", - " sys.exit()\n", - " if(abs(f(a))0):\n", - " c = (a+b)/2.0\n", - " if(abs(f(c))" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.4, page no. 570" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "maximum tensile stress, maximum compressive stress, and maximum shear stress in the shaft.\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d = 0.05 # Diameter of shaft in m\n", - "T = 2400 # Torque transmitted by the shaft in N-m\n", - "P = 125000 # Tensile force\n", - "\n", - "#calculation\n", - "s0 = (4*P)/(math.pi*d**2) # Tensile stress in\n", - "t0 = (16*T)/(math.pi*d**3) # Shear force \n", - "# Stresses along x and y direction\n", - "sx = 0 \n", - "sy = s0 \n", - "txy = -t0 \n", - "s1 = (sx+sy)/2.0 + math.sqrt(((sx-sy)/2.0)**2 + (txy)**2) # Maximum tensile stress \n", - "s2 = (sx+sy)/2.0 - math.sqrt(((sx-sy)/2.0)**2 + (txy)**2) # Maximum compressive stress \n", - "tmax = math.sqrt(((sx-sy)/2)**2 + (txy)**2) # Maximum in plane shear stress \n", - "print \"Maximum tensile stress %e\" %s1, \"Pa\"\n", - "print \"Maximum compressive stress %e\" %s2, \"Pa\"\n", - "print \"Maximum in plane shear stress %e \" %tmax, \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum tensile stress 1.346662e+08 Pa\n", - "Maximum compressive stress -7.100421e+07 Pa\n", - "Maximum in plane shear stress 1.028352e+08 Pa\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.5, page no. 573" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate maximum allowable internal pressure\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "\n", - "#initialisation\n", - "P = 12 # Axial load in K\n", - "r = 2.1 # Inner radius of the cylinder in inch\n", - "t = 0.15 # Thickness of the cylinder in inch\n", - "ta = 6500 # Allowable shear stress in Psi\n", - "\n", - "#calculation\n", - "p1 = (ta - 3032)/3.5 # allowable internal pressure\n", - "p2 = (ta + 3032)/3.5 # allowable internal pressure\n", - "p3 = 6500/7.0 # allowable internal pressure\n", - "\n", - "prs_allowable = min(p1,p2,p3) # Minimum pressure would govern the design\n", - "print \"Maximum allowable internal pressure \", round(prs_allowable), \"psi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum allowable internal pressure 929.0 psi\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.6, page no. 574" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "principal stresses and maximum shear stresses\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d1 = 0.18 # Inner diameter of circular pole in m\n", - "d2 = 0.22 # Outer diameter of circular pole in m\n", - "P = 2000 # Pressure of wind in Pa\n", - "b = 1.5 # Distance between centre line of pole and board in m\n", - "h = 6.6 # Distance between centre line of board and bottom of the ploe in m\n", - "\n", - "#calculation\n", - "W = P*(2*1.2) # Force at the midpoint of sign \n", - "V = W # Load\n", - "T = W*b # Torque acting on the pole\n", - "M = W*h # Moment at the bottom of the pole\n", - "I = (math.pi/64.0)*(d2**4-d1**4) # Momet of inertia of cross section of the pole\n", - "sa = (M*d2)/(2*I) # Tensile stress at A \n", - "Ip = (math.pi/32.0)*(d2**4-d1**4) # Polar momet of inertia of cross section of the pole\n", - "t1 = (T*d2)/(2*Ip) # Shear stress at A and B\n", - "r1 = d1/2.0 # Inner radius of circular pole in m\n", - "r2 = d2/2.0 # Outer radius of circular pole in m\n", - "A = math.pi*(r2**2-r1**2) # Area of the cross section\n", - "t2 = ((4*V)/(3*A))*((r2**2 + r1*r2 +r1**2)/(r2**2+r1**2)) # Shear stress at point B \n", - "\n", - "# Principle stresses \n", - "sxa = 0\n", - "sya = sa\n", - "txya = t1\n", - "sxb = 0\n", - "syb = 0\n", - "txyb = t1+t2 \n", - "\n", - "# Stresses at A\n", - "s1a = (sxa+sya)/2.0 + math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum tensile stress \n", - "s2a = (sxa+sya)/2.0 - math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum compressive stress \n", - "tmaxa = math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum in plane shear stress\n", - "\n", - "print \"Maximum tensile stress at point A is\", s1a, \"Pa\"\n", - "print \"Maximum compressive stress at point A is\", s2a, \"Pa\"\n", - "print \"Maximum in plane shear stress at point A is\", tmaxa, \"Pa\"\n", - "\n", - "# Stress at B \n", - "s1b = (sxb+syb)/2.0 + math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum tensile stress \n", - "s2b = (sxb+syb)/2.0 - math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum compressive stress \n", - "tmaxb = math.sqrt(((sxb-syb)/2.0)**2 + (txyb)**2) # Maximum in plane shear stress \n", - "print \"Maximum tensile stress at point B is\", s1b, \"Pa\"\n", - "print \"Maximum compressive stress at point B is\", s2b, \"Pa\"\n", - "print \"Maximum in plane shear stress at point B is\", tmaxb, \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum tensile stress at point A is 55613361.197 Pa\n", - "Maximum compressive stress at point A is -700178.455718 Pa\n", - "Maximum in plane shear stress at point A is 28156769.8263 Pa\n", - "Maximum tensile stress at point B is 6999035.59641 Pa\n", - "Maximum compressive stress at point B is -6999035.59641 Pa\n", - "Maximum in plane shear stress at point B is 6999035.59641 Pa\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.7, page no. 578" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "principal stresses and maximum shear stresses at points & at the base of the post\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "b = 6 # Outer dimension of the pole in inch\n", - "t = 0.5 # thickness of the pole\n", - "P1 = 20*(6.75*24) # Load acting at the midpoint of the platform\n", - "d = 9 # Distance between longitudinal axis of the post and midpoint of platform\n", - "P2 = 800 # Load in lb\n", - "h = 52 # Distance between base and point of action of P2\n", - "\n", - "#calculation\n", - "M1 = P1*d # Moment due to P1\n", - "M2 = P2*h # Moment due to P2\n", - "A = b**2 - (b-2*t)**2 # Area of the cross section\n", - "sp1 = P1/A # Comoressive stress due to P1 at A and B\n", - "I = (1.0/12.0)*(b**4 - (b-2*t)**4) # Moment of inertia of the cross section\n", - "sm1 = (M1*b)/(2*I) # Comoressive stress due to M1 at A and B\n", - "Aweb = (2*t)*(b-(2*t)) # Area of the web\n", - "tp2 = P2/Aweb # Shear stress at point B by lpad P2\n", - "sm2 = (M2*b)/(2*I) # Comoressive stress due to M2 at A \n", - "sa = sp1+sm1+sm2 # Total Compressive stress at point A\n", - "sb = sp1+sm1 # Total compressive at point B \n", - "tb = tp2 # Shear stress at point B\n", - "\n", - "# Principle stresses \n", - "sxa = 0\n", - "sya = -sa\n", - "txya = 0\n", - "sxb = 0\n", - "syb = -sb\n", - "txyb = tp2 \n", - "\n", - "# Stresses at A\n", - "s1a = (sxa+sya)/2 + math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum tensile stress \n", - "s2a = (sxa+sya)/2 - math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum compressive stress \n", - "tmaxa = math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum in plane shear stress\n", - "print \"Maximum tensile stress at point A is\", s1a,\"Psi\"\n", - "print \"Maximum compressive stress at point A is\", round(s2a,2), \"Psi\"\n", - "print \"Maximum in plane shear stress at point A is\", round(tmaxa,2), \"Psi\"\n", - "\n", - "# Stress at B \n", - "s1b = (sxb+syb)/2 + math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum tensile stress \n", - "s2b = (sxb+syb)/2 - math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum compressive stress \n", - "tmaxb = math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum in plane shear stress\n", - "print \"Maximum tensile stress at point B is\", round(s1b,2), \"Psi\"\n", - "print \"Maximum compressive stress at point B is\", round(s2b,2), \"Psi\"\n", - "print \"Maximum in plane shear stress at point B is\", round(tmaxb,2), \"Psi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum tensile stress at point A is 0.0 Psi\n", - "Maximum compressive stress at point A is -4090.91 Psi\n", - "Maximum in plane shear stress at point A is 2045.45 Psi\n", - "Maximum tensile stress at point B is 13.67 Psi\n", - "Maximum compressive stress at point B is -1872.69 Psi\n", - "Maximum in plane shear stress at point B is 943.18 Psi\n" - ] - } - ], - "prompt_number": 5 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Testing_the_interface/chapter8_1.ipynb b/Testing_the_interface/chapter8_1.ipynb deleted file mode 100755 index 2e7289e4..00000000 --- a/Testing_the_interface/chapter8_1.ipynb +++ /dev/null @@ -1,524 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 8: Applications of Plane Stress Pressure Vessels Beams and Combined Loadings" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.1, page no. 546" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "finding max. permissible pressures at various conditions\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d = 18 # inner idameter of the hemisphere in inch\n", - "t = 1.0/4.0 # thickness of the hemisphere in inch\n", - "\n", - "\n", - "#calculation\n", - "# Part (a)\n", - "sa = 14000 # Allowable tensile stress in Psi\n", - "Pa = (2*t*sa)/(d/2.0) # Maximum permissible air pressure in Psi\n", - "print \"Maximum permissible air pressure in the tank (Part(a)) is\", round(Pa,1), \"psi\"\n", - "\n", - "# Part (b)\n", - "sb = 6000 # Allowable shear stress in Psi\n", - "Pb = (4*t*sb)/(d/2.0) # Maximum permissible air pressure in Psi\n", - "print \"Maximum permissible air pressure in the tank (Part(b)) is\", round(Pb,1), \"psi\"\n", - "\n", - "# Part (c)\n", - "e = 0.0003 # Allowable Strain in Outer sufrface of the hemisphere\n", - "E = 29e06 # Modulus of epasticity of the steel in Psi\n", - "v = 0.28 # Poissions's ratio of the steel\n", - "Pc = (2*t*E*e)/((d/2.0)*(1-v)) # Maximum permissible air pressure in Psi\n", - "print \"Maximum permissible air pressure in the tank (Part(c)) is\", round(Pc,1), \"psi\"\n", - "\n", - "# Part (d)\n", - "Tf = 8100 # failure tensile load in lb/in \n", - "n = 2.5 # Required factor of safetty against failure of the weld\n", - "Ta = Tf / n # Allowable load in ld/in \n", - "sd = (Ta*(1))/(t*(1)) # Allowable tensile stress in Psi\n", - "Pd = (2*t*sd)/(d/2.0) # Maximum permissible air pressure in Psi\n", - "print \"Maximum permissible air pressure in the tank (Part(d)) is\", round(Pd,1), \"psi\"\n", - "\n", - "# Part (e)\n", - "Pallow = Pb \n", - "print \"Maximum permissible air pressure in the tank (Part(e)) is\", round(Pb,1) ,\"psi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum permissible air pressure in the tank (Part(a)) is 777.8 psi\n", - "Maximum permissible air pressure in the tank (Part(b)) is 666.7 psi\n", - "Maximum permissible air pressure in the tank (Part(c)) is 671.3 psi\n", - "Maximum permissible air pressure in the tank (Part(d)) is 720.0 psi\n", - "Maximum permissible air pressure in the tank (Part(e)) is 666.7 psi\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.2, page no. 552" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating various quantities for cylindrical part of vessel\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "a = 55 # Angle made by helix with longitudinal axis in degree\n", - "r = 1.8 # Inner radius of vessel in m\n", - "t = 0.02 # thickness of vessel in m\n", - "E = 200e09 # Modulus of ealsticity of steel in Pa\n", - "v = 0.3 # Poission's ratio of steel \n", - "P = 800e03 # Pressure inside the tank in Pa\n", - "\n", - "\n", - "#calculation\n", - "# Part (a)\n", - "s1 = (P*r)/t # Circumferential stress in Pa\n", - "s2 = (P*r)/(2*t) # Longitudinal stress in Pa\n", - "\n", - "print \"Circumferential stress is \", s1, \"Pa\"\n", - "print \"Longitudinal stress is \", s2, \"Pa\"\n", - "\n", - "# Part (b)\n", - "t_max_z = (s1-s2)/2.0 # Maximum inplane shear stress in Pa\n", - "t_max = s1/2.0 # Maximum out of plane shear stress in Pa\n", - "\n", - "print \"Maximum inplane shear stress is \", t_max_z, \"Pa\"\n", - "print \"Maximum inplane shear stress is \", t_max, \"Pa\"\n", - "\n", - "# Part (c)\n", - "e1 = (s1/(2*E))*(2-v) # Strain in circumferential direction \n", - "e2 = (s2/E)*(1-(2*v)) # Strain in longitudinal direction\n", - "\n", - "print \"Strain in circumferential direction is %e\"%(e1)\n", - "print \"Strain in longitudinal direction is \", e2\n", - "\n", - "# Part (d)\n", - "# x1 is the direction along the helix\n", - "theta = 90 - a \n", - "sx1 = ((P*r)/(4*t))*(3-math.cos(math.radians(2*theta))) # Stress along x1 direction\n", - "tx1y1 = ((P*r)/(4*t))*(math.sin(math.radians(2*theta))) # Shear stress in x1y1 plane\n", - "sy1 = s1+s2-sx1 # Stress along y1 direction\n", - "\n", - "print \"Stress along y1 direction is \", sy1\n", - "\n", - "# Mohr Circle Method\n", - "savg = (s1+s2)/2.0 # Average stress in Pa\n", - "R = (s1 - s2 )/2.0 # Radius of Mohr's Circle in Pa\n", - "sx1_ = savg - R*math.cos(math.radians(2*theta)) # Stress along x1 direction\n", - "tx1y1_ = R*math.sin(math.radians(2*theta)) # Shear stress in x1y1 plane\n", - "print \"Stress along x1 direction is \", sx1_, \"Pa\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Circumferential stress is 72000000.0 Pa\n", - "Longitudinal stress is 36000000.0 Pa\n", - "Maximum inplane shear stress is 18000000.0 Pa\n", - "Maximum inplane shear stress is 36000000.0 Pa\n", - "Strain in circumferential direction is 3.060000e-04\n", - "Strain in longitudinal direction is 7.2e-05\n", - "Stress along y1 direction is 60156362.5799\n", - "Stress along x1 direction is 47843637.4201 Pa\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.3, page no. 562" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "principal stresses and maximum shear stresses at cross section\n", - "\"\"\"\n", - "\n", - "%pylab inline\n", - "from matplotlib import *\n", - "from pylab import *\n", - "import numpy\n", - "\n", - "#initialisation\n", - "L = 6.0 # Span of the beam in ft\n", - "P = 10800 # Pressure acting in lb\n", - "c = 2.0 # in ft\n", - "b = 2.0 # Width of cross section of the beam in inch\n", - "h = 6.0 # Height of the cross section of the beam in inch\n", - "x = 9.0 # in inch\n", - "\n", - "#calculation\n", - "Ra = P/3.0 # Reaction at point at A\n", - "V = Ra # Shear force at section mn \n", - "M = Ra*x # Bending moment at the section mn\n", - "I = (b*h**3)/12.0 # Moment of inertia in in4\n", - "y = linspace(-3, 3, 61)\n", - "sx = -(M/I)*y # Normal stress on crossection mn\n", - "Q = (b*(h/2-y))*(y+((((h/2.0)-y)/2.0))) # First moment of recmath.tangular cross section\n", - "txy = (V*Q)/(I*b) # Shear stress acting on x face of the stress element\n", - "s1 = (sx/2.0)+numpy.sqrt((sx/2.0)**2+(txy)**2) # Principal Tesile stress on the cross section\n", - "s2 = (sx/2.0)-numpy.sqrt((sx/2.0)**2+(txy)**2) # Principal Compressive stress on the cross section\n", - "tmax = numpy.sqrt((sx/2)**2+(txy)**2) # Maximum shear stress on the cross section\n", - "plot(sx,y,'o',color='c')\n", - "plot(txy,y,'+',color='m')\n", - "plot(s1,y,'--',color='y')\n", - "plot(s2,y,'<',color='k')\n", - "plot(tmax,y,label=\"Maximum shear stress on cross section\")\n", - "legend()\n", - "show()\n", - "#print \"Principal Tesile stress on the cross section\", s1, \"psi\"\n", - "#print \"Principal Compressive stress on the cross section\", s2, \"psi\"\n", - "\n", - "# Conclusions \n", - "s1_max = 14400.0 # Maximum tensile stress in Psi\n", - "txy_max = 900.0 # Maximum shear stress in Psi\n", - "t_max = 14400.0/2.0 # Largest shear stress at 45 degree plane" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Populating the interactive namespace from numpy and matplotlib\n" - ] - }, - { - "output_type": "stream", - "stream": "stderr", - "text": [ - "WARNING: pylab import has clobbered these variables: ['power', 'random', 'fft', 'load', 'save', 'linalg', 'info']\n", - "`%pylab --no-import-all` prevents importing * from pylab and numpy\n" - ] - }, - { - "metadata": {}, - "output_type": "display_data", - "png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAD9CAYAAABZVQdHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVPX+x/HXgCyisriBgkiChqiBluH1aqKm5Fam2VXL\ntOxWVi739vOWZYnd1Lppad0Ws9RKU296Q8vlahLtaYaoqbiguII7CMrO9/fHONMAw7DMPnyej0eP\nBzNz5pzvAfx2eM/nfL4apZRCCCGES3Kz9wCEEEJYj0zyQgjhwmSSF0IIFyaTvBBCuDCZ5IUQwoXJ\nJC+EEC7MrEm+oKCA2NhYYmJiiIqKYsaMGZYalxBCCAvQmFsnf/36dXx8fCgpKaFXr17Mnz+fXr16\nWWp8QgghzGB2XOPj4wNAUVERpaWlNG3a1OxBCSGEsAyzJ/mysjJiYmIIDAykb9++REVFWWJcQggh\nLKCBuTtwc3MjNTWVnJwc4uPjSU5OJi4uTv+6RqMx9xBCCFEvWaLrjMWqa/z8/BgyZAi7du2q9JpS\nqtb/DXj6aUhIgI4dwcvrjwH7+0NSkv41TYMGdL7lljodwxL/zZo1y27HlvMz77+pfaailOL4rON2\nH4uj/ux+/VXRsqXi7Fn7n481zs+R/7MUsyb5ixcvkp2dDUB+fj7btm2ja9euFhnY1HvvJfz0aXjn\nHZgxQzvZu7lR5uUFTz0F8+bBwYOokhLOXLpkkWOK+qOw8CzXAhPtPQyHVlgIEybAG29Aq1b2Ho2o\nK7PimszMTMaPH09ZWRllZWWMGzeO/v37W2RgQ/r1A+Dt9espADzvvJMfL17k+sWLcO5cuW3LLHJE\nUZ/k/HyJkgaXyEjIIGN2hv55/zh//OP87TcwB/LyyxARAWPH2nskwhxmTfJdunQhJSXFUmOpZEi/\nfvrJHmCgUmxr3hzWrIFjx7SXGkBpSQnxU6ZQ6OaGZ2kptzZrxrmTJ1m6dKnVxqZj+PmDK3LV8/P7\nUzNu/d2TsKfDAAhLCCM7OdulJnhzfna//QYffgh79oCjfqzmqr+bluZUd7wajXDc3SksKWHrvffy\nbUAA27Zv57U5c/j1t99sMiZX/0Vz1fPTaBrQtat7ueeyk7PtNBrrqOvPrqgIHn4Y5s+HoCDLjsmS\nXPV309LMvhmq2gNoNBb9EGFjUhJvb9hAAeClFId37iSjoEB7VW9wdR8QHMzl06ctcsymTZty5coV\ni+xLCCEMBQQEcPny5UrPW2rudLpJ3pBSitadO5OVkQHXr5d7zS84mGwLTfLWPAchRP1W1fxiqXnH\n7Dp5e9JoNHTp148sB8vphRDCUTj1JA/anP7YqlWkv/MOfPeddrI/fFif0+ue+/rIETrJ3bhCiHrG\nqeMaHWvn9BLXCCGsxdpxjUtM8oZM5fSNAgP58/33U6DRkH3kCC3Lyti2ZUu1+6zvk3yTJk3Yt28f\nYWFh9h5KjSQnJzNu3DhOnTpl76EIF3Ly5Ek6derE1atXLdquxdqTvFOVUNaELqfnH/+o1BIhv7CQ\nrc2a8d22bexNSuKHPXvYmJRkx9GaLywsDC8vLy5VuOu3a9euuLm5cfLkSbOPkZub6zQTvCNLSEhg\n3Lhx9h6GqKGwsDCSDOaH0NBQcnNzna4fl8tN8mCiJUJ+vr4dAoWFFAQG8vaGDfYerlk0Gg3t2rVj\n1apV+uf27dtHfn6+0/0yOhtL9xix9P4chbOel6v8Be+Sk/yQfv1YNGYM8evXc8fly7TWvVBYqM/n\ndQpsPjrLe/DBB/nkk0/0jz/++GMeeuihcr+gGzdupGvXrvj5+REaGsrs2bP1r61Zs4Z27dqRm5sL\nwObNm2nVqpX+rwM3NzeOHTsGwIQJE3jyyScZPHgwTZo0oXfv3mRlZTF16lQCAgLo2LEjqamp+n0b\nvlf3/hdffBHQxiohISG8/vrrtGzZktatW5OYmMimTZvo0KEDzZo149VXX63yvDdt2kSnTp3w9fUl\nJCSEBQsWlHv9jTfeIDAwkNatW7N8+XL984WFhfzf//0fbdu2JSgoiEmTJlFQoP1NyM7OZujQobRs\n2ZKmTZsybNgwzpw5o39vXFwcM2fO5M9//jONGjXi+PHjlcb12muvERISgq+vL5GRkSQlJbFlyxbm\nzZvHmjVraNKkib7Hk7H9paWlMWDAAJo1a0ZkZCSff/55ted88eJFhg4dSkBAAM2aNeOOO+6ocoL6\n6aef6N69O/7+/tx+++38/PPP5c7vpZdeolevXvj6+hIfH1/pr0RD69evJyYmBj8/PyIiIti6dWuV\n52XquMuXLyc8PBxfX1/atWvHZ599BsDRo0fp06cP/v7+tGjRgtGjRxsdR0FBAQ8++CDNmzcnICCA\n22+/nfPnzwOQk5PDxIkTad26NSEhIbz44ouUlf3RDGXJkiVERUXh6+tLp06d2L17N+PGjePkyZMM\nGzaMJk2aMH/+fDIyMnBzc9O/9+zZs9x99900a9aM9u3b8+GHH+r3mZCQwP3338/48ePx9fWlc+fO\n/GajGzQrUVZmg0NUq6ysTN0yaJCiY0eFl5cCtP9FR6tuDz6oBk6erO6YMkXdMmiQujM+vtL7HeEc\nqhIWFqa+/vprdfPNN6uDBw+qkpISFRISok6cOKE0Go06ceKEUkqp5ORk9fvvvyullNq7d68KDAxU\niYmJ+v088MADasKECerixYuqdevWauPGjfrXNBqNSk9PV0opNX78eNW8eXOVkpKiCgoKVL9+/VTb\ntm3Vp59+qsrKytTMmTNV3759jb5XKaUmTJigXnzxRaWUUt98841q0KCB+uc//6lKSkrUkiVLVLNm\nzdTYsWNVXl6e2r9/v2rYsKHKyMgweu5BQUHqhx9+UEoplZ2drVJSUsrtd9asWaqkpERt2rRJ+fj4\nqOzsbKWUUtOmTVP33HOPunLlisrNzVXDhg1TM2bMUEopdenSJfXf//5X5efnq9zcXDVq1Cg1fPhw\n/TH79Omj2rZtqw4cOKBKS0tVcXFxuTGlpaWpNm3aqMzMTKWUUidOnNCff0JCgho3bly57SvuLzs7\nW4WEhKjly5er0tJStXv3btW8eXN18OBBk+f83HPPqSeeeEKVlJSokpIS/TYVXbp0Sfn7+6sVK1ao\n0tJStWrVKhUQEKAuX76sH09ERIQ6cuSIys/PV3Fxceq5554zuq8dO3YoPz8/9fXXXyullDpz5oxK\nS0szel5ZWVlVHjcvL0/5+vqqw4cPK6WUysrKUvv371dKKTV69Gg1d+5cpZRShYWF6scffzQ6lvff\nf18NGzZM5efnq7KyMpWSkqKuXr2qlFJq+PDh6oknnlDXr19X58+fV7fffrtavHixUkqp//znPyo4\nOFjt2rVLKaXU0aNH9f9mwsLC1Pbt2/XHOH78uNJoNKq0tFQppVTv3r3VU089pQoLC1Vqaqpq0aKF\nSkpKUkopNWvWLOXt7a02b96sysrK1IwZM1SPHj2Mjr2q+cVS8069mOSVUuqr7dtVu4kTFQkJ+sne\no2VLFXjPPeWe8w4KUl8Z/GCVqv4cwDL/1YVukn/llVfUjBkz1ObNm9XAgQNVSUlJuUm+oqlTp6q/\n/e1v+sfZ2dkqNDRUdenSRT3xxBPltjWcqCdMmKAee+wx/Wtvv/22ioqK0j/eu3ev8vf3N/pe3ftn\nzpyplNJOxg0bNlRlZWVKKaWuXr2qNBqN2rlzp377W2+9tdz/jAyFhoaqxYsXq5ycnHLP6/ar+8eo\nlFItW7ZUO3bsUGVlZapRo0blxvTTTz+pm266yegxdu/erQICAvSP4+Li1KxZs4xuq5RSR44cUS1b\ntlRff/21KioqKvfarFmz1IMPPljuuYr7W716terdu3e5bR577DE1e/Zsk+f80ksvqXvuuUcdPXq0\nyrEppdQnn3yiYmNjyz33pz/9SS1fvlw/njlz5uhfe/fdd9Vdd91ldF+PPfaY+vvf/270tYrnZeq4\n165dU/7+/mrdunXq+vXr5bZ56KGH1GOPPaZOnz5t8ryWLl2qevbsqfbu3Vvu+aysLOXl5aXy8/P1\nz3322Wf6C5GBAweqt956y+g+TU3yJ0+eVO7u7iovL0//+owZM9SECROUUtqf9YABA/Sv6S5YjLH2\nJO+ScY0xQ/r1462xY4m/coU7Bgzglv798VKKc4cPm53TW2qaryuNRsO4ceNYuXKl0agGYMeOHfTt\n25eWLVvi7+/P4sWLy/0Z7ufnx3333cfvv//OM888Y/J4LVu21H/t7e1d7nHDhg3Jy8ur8dibNWum\n/+ygYcOGAAQGBpbb37Vr14y+d926dWzatImwsDDi4uL45Zdfyu3Xze2PX28fHx/y8vK4cOEC169f\n59ZbbyUgIICAgAAGDRrExYsXAe2axY8//jhhYWH4+fnRp08fcnJyyn0/27RpU+X5REREsHDhQhIS\nEggMDGTMmDFkZmaa/B4Y7u/EiRPs2LFDP7aAgAA+++wzzt3ovFrVOU+fPp2IiAgGDhxIeHg4r732\nmtFjnT17ltDQ0HLPtW3blrNnz+ofBxk0rDH18zx9+jTh4eE1Oi9Tx/Xx8WHNmjW8//77tG7dmqFD\nh3Lo0CEA/vWvf6GU4vbbb6dz584sW7bM6LHGjRtHfHw8o0ePJjg4mGeffZaSkhJOnDhBcXExrVq1\n0n8/n3jiCS5cuFCjc6jK2bNnadq0KY0aNdI/FxoaWi7aM/w99vHxoaCgoFxMZCv1ZpIH7US/ZeFC\nkhcu5NbAQPKzs/WTuyFnzOlDQ0Np164dmzdvZsSIEZVeHzt2LMOHD+f06dNkZ2fzxBNPlPuFS01N\nZdmyZYwdO5bJkydbbFw+Pj5cNyhlzczMtNgHwrfddhuJiYlcuHCB4cOHc//991f7nubNm9OwYUMO\nHDjAlStXuHLlCtnZ2Vy9ehWABQsWcPjwYXbu3ElOTg7ffvttpQ8Oqxv/mDFj+P777zlx4gQajYZn\nn33W5PsMnw8NDaVPnz76sV25coXc3Fzeeecdk+fcuHFj5s+fT3p6Ohs2bOCNN94oVxmiExwczIkT\nJ8o9d+LECYKDg6v71lXSpk0bjh49WuXrhudV3XEHDhzI1q1bycrKIjIykr/+9a+AdqL84IMPOHPm\nDIsXL+bJJ58s9xmPToMGDXjppZfYv38/P/30E1999RWffPIJoaGh+uoz3fczJyeHffv2VXsOpn7O\nrVu35vLly+X+B3jy5ElCQkKqfI+91KtJXkej0fDRRx/R6c47K5VZAuReukT8lCn0mTqV6MGD7TTK\n2vvoo49ISkrSXxEbysvLIyAgAE9PT3bu3Mlnn32m/yXWfWg1b948li5dypkzZ3jvvfeMHqPiXwjV\niYmJYeXKlZSWlrJlyxa+++672p+YEcXFxaxcuZKcnBzc3d1p0qQJ7u7u1b7Pzc2Nv/71r0ybNk1/\nNXfmzBn9B4Z5eXk0bNgQPz8/Ll++XO4Dah1T34PDhw+TlJREYWEhXl5eeHt768cVFBRERkZGpfcb\nPh46dCiHDx9mxYoVFBcXU1xczK+//kpaWprJc/7qq684evQoSil8fX1xd3c3+v0YPHgwhw8fZtWq\nVZSUlLBmzRrS0tIYOnRojc7P0MSJE1m2bBlJSUmUlZVx5swZ/RV4xf2YOu758+dZv349165dw8PD\ng0aNGunH/vnnn3P6xg2M/v7+aDSacn+h6SQnJ7Nv3z5KS0tp0qQJHh4euLu7ExQUxMCBA/n73/9O\nbm4uZWVlpKen638PH330UebPn09KSgpKKY4ePaovOw4MDCQ9Pd3oubdp04aePXsyY8YMCgsL2bt3\nL0uXLuXBBx+s0ffOlurlJA/aiX7u//0f7Xr2/KPM0ssLj8xMzuTmlqundxbt2rWjW7du+seGVyLv\nvvsuL730Er6+vvzzn/8sd9U7Y8YM2rZty+OPP46npycrVqxg5syZ+l9ww/1oNBqTjytuv2jRIr78\n8kt97HDvvfdWua2xx6asWLGCm266CT8/Pz744ANWrlxZo/289tprRERE0KNHD/z8/BgwYACHDx8G\nYNq0aeTn59O8eXN69uzJoEGDajXGwsJCZsyYQYsWLWjVqhUXL15k3rx5AIwaNQrQRkm33Xab0f01\nbtyYrVu3snr1aoKDg2nVqhUzZsygqKjI5DkfPXqUAQMG0KRJE3r27MlTTz1Fnz59Ko2vadOmfPXV\nVyxYsIDmzZszf/58vvrqK5o2bWp0PMZ+vjrdu3dn2bJl/O1vf8Pf35+4uLhy92UYvs/UccvKynjz\nzTcJDg6mWbNmfP/99/qLjF27dtGjRw+aNGnCPffcw1tvvWX0no2srCxGjRqFn58fUVFRxMXF6e9J\n+OSTTygqKiIqKoqmTZsyatQosrKyALjvvvt44YUXGDt2LL6+vowYMULfcXbGjBm88sorBAQE8MYb\nb1Q6p1WrVpGRkUHr1q0ZMWIEL7/8Mv1urH9R3b8LW3K5O15rS9cSIV8pso8e5divv5LXvHm5dghg\nmQV1hRCiImlrYCNKKSZOnMgnK1ZQWlxs9HUhhLA0meRtSClFzJAh7M3IkCt5IYRNSO8aG6oqpxdC\nCGclV/JGVMzpD27bRrGRCEcIIcwly//ZkcmcPjqaLjExtPL1rXXrYuEYCgpOcujQo0RHbzX6enZy\ntn5x74zZGQSND8I7zBv/OH/84/xtOdQ6O30aYmJgxw6owz0/wo5k+T8b0NXT/5aVZTSnP3LqFPvu\nuEO/9KB3QAAbk5IYcqOMSjg2d/dG5ObuqvJ1Y5N5WEKYlUdlWc88A08+KRN8fSaZfDWqzOnT0ylI\nT3e51sX1SYMG/pSW5qJUib2HYhXbt8POnfDcc/YeibAnuZKvAd2V+dsbNnD9zjv5/YsvuHLmDBjp\n6eGMLRHqK43GnQYN/CkuvoynZ0uj2+gim4KMArI+ztI/7+iRTXExTJ4Mb74JPj72Ho2wJ8nk66DK\nUsvoaLp16UIzf3/OHDtG9vHjfPDvf0t848B27uxEp05raNSoc7XbZiRkOPzkrrNwIWzZAps3g6wd\n45ykhNKOqmyJcPYs6YcOsW37dg5s385ZT0+mrlrl9EsMujJPz5YUFZ2v8fa6D2Id2blzMGeOdqKX\nCV7IJF9Hhq2Le995J22joijLySFn795ynS3TH3hAcnoHFhn5Cb6+PWq0rTNcwQM8/zyMHw+RkfYe\niXAEZmXyp06d4qGHHuL8+fNoNBoee+wxpkyZYqmxObwh/foxuG9fJk6cSOrRo5TeaCJVkeT0jsvb\nu+re8DoVSyl1HDG62bULNm2CtDR7j0Q4CrMy+aysLLKysoiJiSEvL49bb72VxMREOnbs+McBXDCT\nr0gpxbp163j06afJyc4ul9GzcCHdPvpIcnoX4ci5vFLQqxc88ghMnGjv0QhzOUSdfFBQkH4VmcaN\nG9OxY0fOnj1bbpKvDzQaDffddx/eAQE8Oncu5zIztR/IAoEffED60aOk5OVpn4uMZOqqVQAy0Tup\n7ORsh5zkV6+G/HyYMMHeIxGOxGIllBkZGezevZvY2FhL7dLpDO3fn480Gt5av55TR4+StXcvuf/7\nH9evXSt3E1X6Aw/wdmKiTPJOyD/O3yE/fL1+HZ59FlauhBqsnSLqEYtM8nl5edx3330sWrSIxo0b\nV3o9ISFB/3VcXBxxcXGWOKxDMszp1+bkcD031+h2ktM7F0fP5d94A2JjoXdve49E1FVycjLJyckW\n36/ZdfLFxcUMHTqUQYMGMW3atMoHqAeZvDGS0zuH0tJ8du3qwu23H6nxyj2OlstnZkKXLtq7W9u1\ns/dohKU4RCava+AVFRVldIKvzySndw7u7g0pLr5ISUk2Hh4BNX6fI+XyM2dqP2iVCV4YY9Yk/+OP\nP7JixQpuueUWunbtCsC8efO46667LDI4VyA5vePz8gqhsPBkjSd5R8rl9+yBjRvBYP1sIcoxa5Lv\n1asXZWVllhqLy6ppTn/myhWiBw/m3IkTRPfvz5Thw2XStwEvr7YUFJygceNok9tVzOULMgrs3np4\n+nR48UXw87PL4YUTkAZlNqJrWzx48ODKOT3At9+yPzERVVgIkZFsHTGC9JUrAYlwrM3bO4yCghPV\nbudorYf/9z84cQIee8xuQxBOQNoa2JAup1+xciWBf/6ztueNhwccPgwvv4y6erVyhCMtEazO27st\nBQUZ9h5GrZSWaq/iX3tN+yskRFXkSt4Ohvbvz4fA45Mnk1laijKxtKCUWlpfcPCTaDQ1+6fgKK2H\nV6wAX1+45x6bHVI4KWk1bEe6Msv58+fz62+/UVZyY/GKG2WWAF0//JDSy5clp3dA9iqlLCiAm2+G\nVaugZ0+bHlrYkLQadgG6+Obnn3/mHy+8gFeLFtpVpwCUwu/FF/l90yb2JiVxzsODrSNGSOtiB2OP\nKpt33oFu3WSCFzUjV/IO5Kvt23nhjTc4sXcvlJSQe+ECZaWl2hcNru7jExPZcuNrYT+66MaWH75m\nZ0OHDvDtt9qPdITrcoiboYRlDenXj/+uXMnxnBxyqyizBMnp7c2eLQ5efx2GDZMJXtScTPIOxLDM\nslJOr6MUJ1NSCI6Kov3AgXiVlUlObyFKlaLRVN/dq+Jkbqtc/tw5eP992L3b6ocSLkQyeQdjMqf/\n9ls8Ro3i+E8/cdbTk2+HD5ec3kJOnnyd48dn1um9tsrl58yBceMgNNQmhxMuQiZ5B6XRaJiXkMDn\nn31G26goGhw6hNsrr1B86ZK2SNqA1NObz9u7Ldev1743gK0qa06c0LYRfv55mxxOuBCJaxyYUoov\nPvuMy0ePUlJgIolXioOpqRLhmKFRoyiuXz9Y4+1t3eLglVfgiSegZUuL71q4OJnkHVjFjH7fvn1c\nv379jw2Ugu++gzVrOHnoEHTpwtnhwwGkJUItNWzYnoKCDMrKinBz86x2e1u2OEhPhy++0N4YLURt\nSVzj4Awz+o8//pibO3ZE06CBtpbuqadg3jw4eBAqNIqTCKd23Ny88PZuS37+EXsPpZKXX4bJk6Fp\nU3uPRDgjuZJ3ErrJfsSIEcTceiv79uzRXsmbIKWWtdOoUTQFBRk0atSpRtvbosXBkSOwaRMcPWqR\n3Yl6SCZ5J+Pm5saelBR9O4RKEQ7oY5x9X35JfFkZhW5uktPXQFTU6hqvDgXlJ3Nr5fGvvAJTpkgr\nYVF3Msk7Id1V/ciRI1m3bh0zX3qJw0eOoEB7K+SaNXD4MLn+/mwdMUL/PsnpTavNBG+MpVeLOnpU\nuyCIXMULc0gm78R0k/2B33/nnnvvxeNGmSUHD0JpKcUhIeW2l5zeeqxRUTNnDjz9NPg7xiqDwknJ\nlbyTU0rx6KOPsn3LFopNlVneIDm9ZVmrxUFGBmzYIFfxwnzSoMwFGLYsLpfR65qa6Uotf/mFbs2b\n0zwgQHJ6K7Bk6+GnnoImTeDVVy0wMOGUpEGZ0KuY0c+fP5/U1FQ0585RoMvojx3Dw8+Psz17kjJx\nov69ktOXV1JylZKSbLy969Y7wBK5fGamtlf8wZrfmyVElSSTdyG6yf6nn37i6aefxjM//4+MvrAQ\nL6XImjq13Hskpy/v4sVE0tOn1+m9lsrl33wTHnwQAgMtsjtRz8mVvIvRZfRr166t1K7Y3dP4nZyS\n0/+hSZPuZGQk1Oo9lszlc3Lgo48gJaVWbxOiSjLJuxhTrRD0f7YZZPQ8+yy5ly4RP2WK5PSAj8/N\nlJRcpqjoAp6eLWr0HsPJvCCjwKz2BosXw6BB0LZtnXchRDnywasLq/iBbLuICC40b865zEw4dgwi\nIwnq1AmuXy8X44SvXMmiMWPq7US/Z88AQkKm0qzZ0Fq/NzUulZjkmDodt7AQ2rXT3uEaHV2nXQgX\nImu8imoZZvSTJk3iXGYm2T/+qM/oAy5epFVJieT0Ffj69iAn5+c6vdc7zLvOx121Cjp1kgleWJbE\nNS7OVEZ/S0QEtGql27BchHM2O7veRjgBAQPIyfm+xtsbZvK6Hja1bXOglPYD13/9q/bjFcIUmeRd\nXHXtij1LS/9ohXAjwgE4evo0+2b+sVJSfSq19Pe/A3//O2q+vQXaDn/zDRQXw8CBtXqbENWSTL4e\nqZjRh4WFUaqUtu+Nbi3Z6GgahoWR37dvpdwgPjGRLQsX2mHkziMjIQOo/SR/990wdCg89pjlxySc\nk9wMJWrNsF1x//79+eGHHyipsFB4wMWLtI6MZL+RYFhKLatmTtvhY8fgp59g9Wprj1LUR2ZP8o88\n8ggbN26kZcuW7Nu3zxJjElbm5uZGUlKS0VYIt0RE4NWyJfsrZPSAlFqaYE7b4ffegwkTwMfHigMU\n9ZbZ1TUPP/wwW7ZsscRYhA1VXHEqNjYWnxuzTLemTfEaPVq76lRmJgBBS5ZwNi+PrSNG8O3w4Wwd\nMYKpq1axMSnJnqfhsHQfxFYnPx+WL4dJk6w7HlF/mT3J9+7dm4CAAEuMRdhBxTLLAwcO8Nbrr1N4\n/jwUFuJ38SLxiYn1stTywoW1XLv2e63fV5u7XP/zH+jeHcLDa30YIWrEJpl8QkKC/uu4uDji4uJs\ncVhRQ6bKLGMiItiycCFx06YZfa8r5/S5ubvIy9vDTTd1rtH2dWlvsHgxPPec2UMVLiA5OZnk5GSL\n79ci1TUZGRkMGzbMaCYv1TXOoap2xX369CE5OZmBkyezrXnzchk9QLePPnLZ1sXZ2d+Snv5/3Hrr\nr7V+b9qENCKXR5rcZv9+GDAATp6EBlICISqQ6hphUcbaFev+p7127VpObt+O5sgRVKc/FrkOWrKE\ns9evu2zrYl/fnuTnH6Go6Dyeni1r9d6CjOr/xvnwQ3j4YZnghXVJWwNRjrGMfvz48Rw6eBBVUkLA\nxYv0SUysFzm9m5sH/v79uHz5f7V+b3XtDQoLYcUKeOSRuo5OiJox+xpizJgxfPvtt1y6dIk2bdrw\n8ssv8/DDD1tibMJOqmuF8M2bb7Ju3TqenjXL6PtdqSVCs2bDuHRpA0FB46rdtjbtDTZtgqgo+cBV\nWJ/Zk/yqVassMQ7hQEy1Qrhw4QI9e/Zk7969eFWxwrQrtURo3nw4Pj7ta7RtbdobfPopPPSQuaMT\nonoS1wg0Zcj4AAAgAElEQVSjKtbRt2/fHjc3N9LS0vjll1+4fv06IS1aEH5jAtdpuHAh+cOGlXvO\nmSMcD48A/Px6WXSfly7B9u1w330W3a0QRslHPqJamzZtIjMzk7KysnLPN/X3Z96YMbydmEgB4A2c\n9vau1y0RatLeYO1aiI8HPz97jVLUJ9KgTFSruvJK3eubNm3iTOPGbB0xotI+XLnUsipVlVH27w9P\nPQVGvk1C6MmiIcJmTLVAWLt2LT179mT8+PEcO3aMKcOHV4pw6mtLBGNllOfPw2+/aZf4E8IW5Epe\n1FpZWRn/+Mc/+OSTT7h27VqlK/uNSUm8vWGDPsI5n5nJbiPNWZytdXFJyVUaNPCt8fbGruQXL4bk\nZO0qUEKYIjdDCbswVV6pM6Rfv3JRjCu0RCguvsKOHRH86U8ncXdvVOV2FcsodfXyukz+iy/g0Udt\nMmQhAJnkRS1Vt9IUUC6jX7p0KV4VPrDVcabWxdoqmz9x4cI6goKqrn00/IC1IKOgXAllbq62b/x/\n/mPt0QrxB8nkRa3VJqMHXCanDwqaQFbW8hpvXzGT//pr6NEDfGue+AhhNsnkhdmqy+gBl8jpy8oK\n+fnnYLp1+5WGDW+qdvuKmfwjj0DXrjB5sjVHKVyFZPLCIdQkowfXyOnd3LwIDBxHZuYS2rWba3Sb\nqjJ5vz7+bN3qL22Fhc3JJC/MUl1GXzGf13HWnL5160lcuPB5la9XbG2ge3zoEGg00L5mHRKEsBjJ\n5IXZqsrodX1uDPN5HWfN6X18OtC27Qs13l53Vb99u/YmKI3GWiMTwji5khcWo9FoGDlyJEopXnjh\nBQ4dOkRpaanRbXVX54YtEc6XlLDbWOvixESHupqvKf84f/0k/803cPfddh6QqJdkkhcWo5Ri4sSJ\nJvP5ivFNTXJ6Z2tdXHEZQKXguy0hvHDvdUBKa4RtySQvLKa6fH7t2rUsWLCAvXv30r1790rvryqn\nd7bWxYa5fHZyNu4Tw+B9iB4jE7ywPcnkhUUZy+e9vLxISUlh/Pjx+jbFxhjL6R29dXFZWVG12/z8\ns7Y+XvJ4YQ9yJS+sQpfPb9y4kT179pgsr9QxltM7cuviM2feIy9vNzff/EG55w3jmuxvs9lelEOH\nhmVkJ2sqLSoihLXJzVDCqky1Kf7mm2+Mllcaip8yxWFbFxcXX2LHjg7cdlsK3t5tjW6TNiGNqZmR\nTJ4MQ4fadHjCyUmrYeEU6lJeaciRSy09PJrRuvXjnDw5r8ptCjIK2LcPunSx4cCEMCBxjbCJ2pRX\nGnL0Uss2bf7Ojh03Exo6w+jVfEGQD9d2Q2ioTYclhJ5M8sImalJeWRVHbong4dGc4OAnyciYRWTk\ncqB8Jr9rTR43BRdyYnam0YW+hbA2meSFTdS1/YExjtYSoU2b6eW6U5ZrN5zkSWRrr3Ith4WwJZnk\nhc3o8vmRI0eW+zBWl89XVT9f0ZThw0lfuZL0Bx7QPxe0ZAlnr18nZeJE/XO2qqdv0MCXkJApRl/L\nOKXhpj9b9fBCmCSTvLC5uubzOo6e0xs659GQLmF2O7wQMskL26sun69JdFPTnN4eLREMM/mzRxrj\nnnyOjMx8yeSFXcgkL2zOVD5f2+hGx5FaIhhO5nlvXiNqciPCelrtcEKYJHXywi4q1s+3b98eNzc3\n0tLSTLY+qIojtUQ4f/5zCgtPA5Bd7E6zZlY9nBAmyZW8sLtNmzaRmZlJWRVX4zXhSC0RLh3YScaF\npbTc/x7Z+cHkfXiSjEZlEtcIuzC7rcGWLVuYNm0apaWlPProozz77LPlDyBtDUQ1TLU+ePrpp2tU\nVmmMvVoilJUV8Ouv0bRrN5e2re/l/BU3Gje22O5FPWGpudOsSb60tJSbb76Zr7/+muDgYLp3786q\nVavo2LGjxQcqXJ/hZJ+amoqnpyelpaV0795dvyB4bWxMSmLqqlWVSi25fp0sg0qc8JUrWTRmjEUn\n+pycH9i//3769DrN9UI3PDwstmtRTzjEQt47d+4kIiKCsLAwAEaPHs369evLTfJC1IVSqtZ3xlZk\nz1JLP79eNGs2klKggYSiwo7M+vU7c+YMbdq00T8OCQlhx44dlbZLSEjQfx0XF0dcXJw5hxUuyJy2\nB6bYoyWCroRSw+NoUBx/5XfcShtLJi9MSk5OrtNfrNUxa5LX1HAVBMNJXghjLNn2wBRbtETQTeZK\ngZqtaPt8Z9zd6zxkUU9UvACePXu2RfZr1iQfHBzMqVOn9I9PnTpFSEiI2YMS9ZOl2h6YYsuWCBoN\neLopioo0NGxY9zELYQ6zJvnbbruNI0eOkJGRQevWrVmzZg2rVq2y1NhEPWVu2wNTbJ3Te7grCguR\nSV7YjVmTfIMGDfj3v/9NfHw8paWlTJw4UT50FWazVj6vY+2c3rCtgU9xEL8nnCXEv1QyeWEXsvyf\ncEjWqp03xpr19FHNClixzZtu3UCpUo4ff5HQ0Bk0aNDEImMXrkuW/xMuzdiygV5eXqSkpFS7ZGBt\nWXOJQT9VxMWL2q81GneKiy9y+PBjcuEjbEYqeIXTsETtvDHWzOmb+SvOn//jcUTEInbv/hNnz75L\ncPBTFhi9EKbJJC8cVnXZ/Nq1ay0W21iydbFhJu973I09y8rodTRHn8l36rSOlJSeNGrUBX//O8we\nuxCmyCQvHJap2vndu3czfvx4s0sqq2JO62LDD1jbfXaKc+0CCEsI0L/esGE4HTt+woEDo7n11p14\neUnZsbAeyeSFQ9Nl8z/99BOTJk2i8Y1OX1evXq11O+LasFTr4tbeRRw/Xvn5pk3j6dBhMQ0aBFR+\nUQgLkit54fCUUjz66KOsXbuWvLw8mxzTnNbFhnGN376LpPm1JSPhdKUSyubNhyGEtUkJpXAKtiyp\nrEpdSi33P5TG7esiycwEX1+rDk+4GCmhFPWKLUsqq1KXUsvikwVERcHvv1t9eEIYJXGNcFrWKqms\nSl1KLb3DvOniBvv2Qc9q1nktLb1Gfn46jRvfYp0TEPWSTPLCaVi73UFN1KTUMjoVevwSSUZCBlkf\nZ9H2rhYkf+DJX24uNdnWIDc3hf377yMm5hsaNYqyyvhF/SNxjXAaupLKpUuXEhsbi4+Pj/61Cxcu\n8Mgjj9h8TMZKLffEwJftf+Txy2+Q2vEkm32X8csVTbV9a/z9exMe/jp79w6isPCMtYYs6hmZ5IVT\nqZjNt2/fHjc3N9LS0mySy1dUXU6PZyg7Hu3OiVMN+PzLb6vdX1DQQwQHP8nevYMoKcm21rBFPSJx\njXA6ukqbBQsWcPr0acqquHHJFqrL6bOCAA+FiizkX8v2M2pYn2r32abNPygsPMO+ffdwyy1bcHeX\nPsWi7mSSF07FEXL5iirm9BPue4Vblmu/vut/2ok+RZNN4YGafaCq0WiIiFjI2bPvo9HIP1FhHolr\nhFMxlcuDtp+NPbJ5Q5mtz/PxBEiNgeXj4eMJsG/CFdIvBRE/ZQpx06YRP2WKyY6WGo0bwcFP4ubm\nYbNxC9ckN0MJp2V4g1Rqaiqenp6UlpbSvXt3qyyIXFMbk5KYumoVvYq1Swx+PAEC31/O+XXvob7Y\nBY21q1yFr1zJojFjzF59SrgmuRlKCAO6mnlr9rOpqSH9+rFozBgi0tIg7wfiExNprfJR0fmQ+kev\nmur63ghhCRL4CadkKpvXlVNau82BMbq+NZ1oR6Mdbjx4VxgACadXsLvHZfilKfS6qN++AO2V/1uJ\nidWuQFVSksP58/+hdeu/2uhshCuQSV44JVNtiNPS0mjRooVdxmXYhCw7OZuwhDAAMqech9hLsKoN\nlKH/Gzr30iWmrlpF+gMP6PdhrH0xQFlZEadPL6SoKIuwsBetfi7CNUhcI5yWRqNh5MiRPPPMMwQH\nB+Pmpv11tmdJZVWmDB9OePKH0LgEDmvXdw1fsQJVVFRugoeqYxxPzxbExGzn3LkVnDz5mk3GLZyf\nXMkLp+WI5ZSGbYazv80mIyEDgD/HdWPRGJi8+xdKl5bSsecmJo8dy+tVZPIV2xfreHoGEROTRGpq\nH0BDaOg/LH8SwqVIdY1wao7QgrgqaRPSiFweWe65Xbtg7Fg4dAg0mrq1LwYoLDxNamo/wsMXSF96\nF2WpuVMmeeESHLGcMjUulZjkmArjhHbt4IsvICbmj3JLw8gmaMkSuH6dLIPulsbKLYuKLuDh0RSN\nxt36JyNszlJzp8Q1wuXYugVxVbzDvCs9p9HA/ffDf/6jneTr0r5Yx9PTPh8uC+cik7xweo6UzRtm\n8lkfZ+knesOqm9GjYcQIeOUVcHOrWftiqDqnF8IUmeSF0zNVTmnrmnndZJ6dnE0YYfoSSkMxMdCo\nEfzwA9xxR+V9GGtfDNpyy/gpU0zW05eU5OLu3hiNRmOJ0xEuQEoohUtwtBbEuqt5YzQaeOgh+PRT\n46/XZZlBnfT0Zzhy5EmUcrwyUmEfciUvXIYjtSAGTC4S8sAD0KULvPUWNKzQSdicnD48fD779g0l\nLe1hIiM/ki6Wou7VNZ9//jkJCQmkpaXx66+/0q1bN+MHkOoaYQOmcvmoqChiY2OtHtkY5vEZszMI\nmxUGlM/jDQ0apC2nHDeu+n3HTZvGt8OHV3q+y/LltPL1LRfh3NWnB/v3j8DNrSFRUatwc6v8AbBw\nfHavrunSpQtffPEFjz/+uNmDEMJcjtDmoKqWBlX5619h0aKaTfJV5fRHT59m38yZ+sfpK1eyCBgU\nt4GDBx9k376hdO78pSw8Uo/VOZOPjIykQ4cOlhyLEGZxpjYHAEOHam+KOny4+m2N5fQNFy4kf1j5\nG6F0LRHc3DyJilpFYOCDuLl5WXLYwsnYJLBLSEjQfx0XF0dcXJwtDivqGXuXUlbV0qCquMbTE8aP\nhw8+gPnzTe/bWE5/2tub/dHRlbbVlVpqNO4EBU2o28kIm0tOTrbKjXsmM/kBAwaQlZVV6fm5c+cy\n7MYVRN++fVmwYIFk8sIhVNXmwFa5PPwx2VcX1wAcOwaxsXDyZOUPYKtT15YIwjnYJJPftm2b2QcQ\nwpZ0pZQjR45k3bp1PP/886Snp9u0/bCp8smK2rWD22+H1avh4Ydrd5wpw4eTvnJlpZYIZ69fJ2Xi\nRP1zFVsXK6Wkjr4esUhcI1fqwpE4QimlqfLJip58EmbNggkTtDX0NVWXUkulytizZwBt284kIKBv\nzQ8mnFadJ/kvvviCKVOmcPHiRYYMGULXrl3ZvHmzJccmRK3ZK5evVD5JGNnJ2VXm8YbuugumTIGf\nf4aePWt33Nq2RNBo3GjbdiYHDvyF9u3/TcuW99fugMLpSBdK4XLsmcvXJo83tGgR/PijtnGZOWqa\n008b3gX/hrNp0+ZZQkImm3dQYRWykLcQVbBni4Pa5PGGHnkEtm+HEyfMO35NWyJMXrWTK/n/4uzZ\ndzh27Dm5EHNhcs+zcEn2zOVrk8frNGmizeT//W94/fW6H7s2Of1biYl8+foPZGVV0URHuASZ5IXL\nsXUub04eb2jKFOjWDWbOBD+/uo+nNjm9h0dz2rT5W90PJhyeZPLCJdkrlze25F9tPPCAthXx9OmW\nG5PU0zsnyeSFMMFeuXxBhnlLe0yfDgsXQmGhhQZE3VoXy4WZ65C4Rrgse+Tyxpb8q42YGOjUCVau\n1H4Yawm1racf3PcOdu/uw003/ZOAALmyd3YS1wiXZCqXDwoKIjMz02LH0mXyBRkFZH2cVW2L4ep8\n8w08/jgcPAjuVlqju7rWxa1anmXUbZto4DmZ+H6vWWcQwiSJa4QwQdd6eOnSpcTGxuLl9Ucnxvz8\nfIseyz/On7CEMLzDvAmbpV3yLywhrE4TPEBcHDRvDuvWWXSY5ZhqXbx1xAg+7vU0T3q/x9Vr77H1\nm/FyoebEZJIX9YIzTVIaDTz/PMydC9Yadk1aF5+kLY83Wc7F7P+RljZelhR0UpLJC5dkKq7x9rbc\nSkkVyyeDxgeRkZBR56hGZ8gQbSnll1/C3XdbarQG+69h6+IrNGXZDyPp96ceaDRyTeiMJJMXLsuW\nZZR1bWdgyrp1MG8e/Ppr7RqX1ZWUWjoWyeSFqIYtyyjr2s7AlHvv1ZZSbtpk8V0bVZdSS+H4JK4R\nLs2WZZTmxDPGuLnBSy/B7NkweLD1r+ZrW2oZf8etNGhgxq25wiZkkhcuy9rtDSzVzsCUkSPh5Ze1\nV/NDhlhklybVvCWCYt++Yfj7xxEWliB5vQOTn4xwWRXLKH18fPSvXbhwgUfMvNtIVzrpH+dvkdJJ\nY9zctFfyL71kvUobU6oqtcy9dJmXP+vA9ykf8v7Km9mYZKNMSdSaTPLCpdkil7dGHm/o3nu1E3xi\nolUPY5SpnD5xyIM82mw5p0PCOH95ApuSPrf9AEW1JK4RLs8Wubyl83hDGo32av755+Gee7RX97ZS\nXU5fjCdzeZ4Hm6/gvusTKSm5iwYNmthugKJaUkIpXJq12htYupVBdZTSLg04eTKMHWvx3ddKVS0R\n7vxiIW4qVEotLcRSc6dcyQuXpsvlBw8ezPz580lNTaXwRotHc9ob6CbzjIQMfR5vTRqN9g7Yv/4V\nRo0CDw+rHs6kqnL6H/fnkT/zjzr79Bsxj0z09iWZvKhXnPmvyr594aabwIpL1NZITVoiwI1Syw0b\nbDk0YYRcyQuXZo32BtZqZVATc+dqP4gdNw4MioVsqqYtEQAC/M5RWJiJl1cr2w5S6EkmL1yetdob\nWKOVQU2MGgW33grPPWfTw5pUVUuEqT9Pp190Gqt3DuXS5RaS09eCtDUQooasVUZp7dLJqsyZAwsW\nwOXLdjm8UVWVWq7ZGcJ8n+ncH7eZ4hH+0hLBDiSuEfWCtcoorR3PGNOhA9x3nza6mT/f5oc3ylSp\nZRZwltb8kxfZ/kB/3k5cL1fzNiSTvHB5lmxvYItWBjUxa5Z2mcCnn4awMJsd1iRTLRHSieBJ3mUW\ns8kPqPtC56L2JJMX9UJVuXxda+Xtlccbmj0bDh/WrgfriIzn9IpuHy2V1sU1IJm8ELWgy+V/+ukn\nJk2aROPGjYG618rbK4839MwzkJwMu3bZeyTGGc/pP5TWxTYmcY2oFwwz+b179+qv5M1ZJcoeebyh\nxo0hIQH+7/+0i3/bYmGR2qht62K5mreOOk/y06dP56uvvsLT05Pw8HCWLVuGn5/0lhaOx1QmHxlZ\n83zYUfJ4Qw8/DG+9BevXg5FOA3ZXk9bFndlHfNdtlJbm4+7e0JbDqxfqnMlv27aN/v374+bmxnM3\nCnZfffXVygeQTF44AEtm8o6QxxvauhWeegr27wdPT3uPxjRjOb03+cxNn0Rg03xW7xxK4bVGktPj\nAJn8gAEDcLvRDi82NpbTp0+bPRghrMWSmbwj5PGGBg6E9u3hnXfsPZLqGcvp/Zes4F9fxfBlwHAe\nil/P2RHtJae3IItk8kuXLmXMmDGW2JUQVmHpTN7eeXxF8+dDnz7adgfNm9t7NFWrOqefxmognXBm\nM4sPHniMtxM31PureUswGdcMGDCArKysSs/PnTuXYTeaEc2ZM4eUlBTWrVtn/AAaDbNmzdI/jouL\nIy4uzsxhC1FzpjL5mrY2sHVr4bp4+mltS2JnuKI3VLF1cWvO0IxLsDyFVr6+9abUMjk5meTkZP3j\n2bNnWySuMatOfvny5SxZsoTt27dXeUUkmbxwBFVl8m5ubvTu3bvcPy5TMhIyABwmjzd06RJ07Ajb\nt0OXLvYeTc1V1fem4SuvkD9zpv5x+MqVLBozxqUnekN2z+S3bNnC66+/zvr1680qQxPCFjQaDSNH\njuSZZ54hODhY/3mSNVaJspdmzeDFF+Fvf7PPerB1Ja2LravOmfzkyZMpKipiwIABAPzpT3/i3Xff\ntdjAhLAkc1ob2LO1cG098QS8/752Pdh777X3aGqmpq2L23OYApzo/14OQtoaiHrD3DJKRyudrMrX\nX8Njj2lLKhs6adl5xQinAcW8y5NkHy4j+UA81/B0+Zze7nGNEM7G3DJKRyudrMqdd0LXro7TobIu\nKkY4JXgwZ1k3ilQhdw/fTtrwHtISoYakrYGoNyxRRulo8UxVFizQLiwyfjyEhtp7NLVntNSyAGbe\n/Cmj+Jx3eZJXmMluaYlQLZnkRb1Q19YGjtjKoCbCwmDyZG0Ts88/t/do6sZ4SwQNn3M/R4lgEu/x\nNP+mwH5DdAqSyYt6w5xM3lnyeEP5+dqe84sXw436CKdWMafXUIbCjW4ffeSSrYslkxeilszJ5J0l\njzfUsCEsXKi9Saqw0N6jMV/FnF7hRtCSJdK6uBpyJS/qjaoy+cDAQKN3dhty1JLJ6igFw4ZBr16O\ntfB3XW1MSuLtDRv+yOkzM9k9aZLBFgrQEJ+YyJaFC+0zSAux1Nwpk7yoF+rS2iA7OZus5Vl4h3lr\n83gHbGVQE+npEBsLv/0GbdvaezSWVbElwij+Q1Mu88vHngQ28XfqCMdSc6d88CrqBY1Gw0cffcTg\nwYMrZfJpaWm0aNGi0nv84/zL5fDOlMcbCg+HqVNh2jT44gt7j8ayvCrcsfw/4nmBOUTFHSGh7Udc\noSkA6TdiHmeb6C1BMnlRb9SH1gZVmT5de3PUxo32HollVczpr+LHy4tasdsrlsU8Tmf2AfW7JYJc\nyYt6o6atDSqWTQIUZBToSyedkbc3/Pvf2rYHffuCj4+9R2QZRlsieDVkedDfOMgvzGYWC5nG99xR\nb0stJZMX9UptyiidsWyyOqNHQ7t2MHeuvUdiPYallkFkUogXV2jqdKWWUkIpRB3UpozSGcsmq/Pm\nm7BkiTa6cVWGEU4WrbhC03pdailxjahXatvawFnjmaq0agUJCTBpEiQng5sLXuZVvfrU1HLbpdeT\nlggyyYt6oyatDZy1jUFtPPEEfPIJLFsGEyfaezTWYbwlgpYbpdzDer5iaL3I6SWTF/VKTTN5V8zj\nDe3Zo2118Pvv0LKlvUdjfYY5vTf5PM9cmnGJ/66+GXfPNg6Z00smL0Qd1DSTd8U83lB0NEyYoF1F\nqj4wzOkLaMhLvEzKL948PWwzV0aEuHROL3GNqFdqk8m7SjxTlVmztGvB/u9/EB9v79FYl7GcPiWz\nPTt7TOBF/slmBvEx410yp5dJXtQb1WXy9SGPN9SoEbz3njaj//137WNXZiyn/5ZbeJzFjGSd/nlX\ny+klkxf1SnWZvG5Sz0jIcNk8vqJx47S5/IIF9h6JbVVsXazjKPX0kskLUQfVZfKunsUb8+absHIl\n/PqrvUdiWxVbIgAuWU8vcY2oV2qaybtiPFOV5s21V/ETJ8KuXeDpae8R2UZ19fQBXKYUd6fP6SWu\nEfWGqUy+ReMWfDfyO7I+znLalsLmUAqGDIGePWHmTHuPxn4MWxcP4SseZAUv8xINlu+kla+vTSMc\naTUsRC1VbDecmppK4Y0lk4rci/AO8yZsVli9yeINaTTaZQK7dYMRIyAqyt4jsg/D1sUbGcoVApjD\nC3zeugWrBi4GNIBztS6WTF7UW/IXZnlt2sDLL2tjm9JSe4/GPirm9D/xZ/6+9DZ69yrkZV6iMdq/\nAJ2pdbFM8qLe0MU1jzzyCDt27KCoqEj/mkeJBxmzMyjIKCAjIaNefgAL8Pjj2kz+rbfsPRL7GNKv\nH4vGjCE+MZE+iYnEJybSqKgZU32WcJ6WDGKzfltnKbWUTF7UK6ZKKH9+/Od6GdVUdPQo9OgBv/wC\nERH2Ho39lS+11K4hC9YvtZQSSiHqoDathuuriAh44QVtbFMPFs2qVvkIRzvBO1OppVzJi3qlqhLK\nwMBA0lan1ZtqmuqUlkLv3jB2LDz9tL1HY38bk5J4e8OGP0otMzPZPWkSAJ4UUoQXAPGJiWxZuNAi\nx7T7lfyLL75IdHQ0MTEx9O/fn1OnTpk9GGeUnJxs7yFYlSudn2Em/8svv+gneIAw77BybQ1cgTk/\nO3d3WLpU23v+2DGLDcmibPm7OaRfP7YsXEjywoVsWbgQ31atANBQxjs8xX18DiiHzOnrPMn/4x//\nYM+ePaSmpjJ8+HBmz55tyXE5DVeaBI1xpfPTlVAuXbqU2NhYPNw99K+dKDxBWEKYS13Jm/uzi4yE\nGTPg4YcdM7ax5++mrtRS4cZMXqEv3zCHFyjNO0v8lCnETZtG/JQpDhHf1HmSb9Kkif7rvLw8mjdv\nbpEBCWFNhpl8l1ZdJJOvxrRpUFIC77xj75E4FsOc/hxBTGURl/deYerdX3F2RHuHyunNuhnqhRde\n4NNPP8XHx4dffvnFUmMSwmrKZfJn91JSVgJUvfxffefurl1BqmdPGDwYwsPtPSLHYKwlQlLmLfx4\ny0PMYjZP8i4XaOkQLRFMfvA6YMAAsrKyKj0/d+5chg0bpn/86quvcujQIZYtW1b5ABqNhYYqhBD1\niyU+eLVIdc3JkycZPHgwv//+u9kDEkIIYTl1zuSPHDmi/3r9+vV07drVIgMSQghhOXW+kr/vvvs4\ndOgQ7u7uhIeH895779GyPqwILIQQTqTOV/Jr165l+PDhKKVIT09nzJgx5Wrl582bR/v27YmMjGTr\n1q3653/77Te6dOlC+/btmXqjbzNAYWEhf/nLX2jfvj09evTgxIkTdR2axUyfPp2OHTsSHR3NiBEj\nyMnJ0b/mCuf3+eef06lTJ9zd3UlJSSn3miucnylbtmwhMjKS9u3b89prr9l7ODXyyCOPEBgYSJcu\nXfTPXb58mQEDBtChQwcGDhxIdvYfdf61/Rna26lTp+jbty+dOnWic+fOvHWjgY6rnGNBQQGxsbHE\nxMQQFRXFjBkzABucnzLD1atX9V+/9dZbauLEiUoppfbv36+io6NVUVGROn78uAoPD1dlZWVKKaW6\nd++uduzYoZRSatCgQWrz5s1KKaXeeecdNWnSJKWUUqtXr1Z/+ctfzBmaRWzdulWVlpYqpZR69tln\n1bPPPquUcp3zO3jwoDp06JCKi4tTv/32m/55Vzm/qpSUlKjw8HB1/PhxVVRUpKKjo9WBAwfsPaxq\nfbAuLEcAAARPSURBVPfddyolJUV17txZ/9z06dPVa6+9ppRS6tVXXzXrd9TeMjMz1e7du5VSSuXm\n5qoOHTqoAwcOuNQ5Xrt2TSmlVHFxsYqNjVXff/+91c/PrN41VdXKr1+/njFjxuDh4UFYWBgRERHs\n2LGDzMxMcnNzuf322wF46KGHSExMBGDDhg2MHz8egJEjR7J9+3ZzhmYRAwYMwM1N+y2KjY3l9OnT\ngOucX2RkJB06dKj0vKucX1V27txJREQEYWFheHh4MHr0aNavX2/vYVWrd+/eBAQElHvO8Ps+fvx4\n/c+jLj9DewsKCiImJgaAxo0b07FjR86cOeNS5+jj4wNAUVERpaWlBAQEWP38zG5Q9sILLxAaGsry\n5cv1f36cPXuWkJAQ/TYhISGcOXOm0vPBwcGcOXMGgDNnztCmTRsAGjRogJ+fH5cvXzZ3eBazdOlS\nBg8eDLjm+Rly9fMzHCv8cX7O6Ny5cwQGBgLa/jvnzp0D6vYzdCQZGRns3r2b2NhYlzrHsrIyYmJi\nCAwM1EdT1j6/am+Gqq5Wfs6cOcyZM4dXX32VadOmGa2Vd2Q1uRdgzpw5eHp6MnbsWFsPz2w1vdeh\nPnHVezc0Go1LnFteXh4jR45k0aJF5dICcP5zdHNzIzU1lZycHOLj4/nmm2/KvW6N86t2kt+2bVuN\ndjR27Fj9lW5wcHC5D2FPnz5NSEgIwcHB+sjD8Hnde06ePEnr1q0pKSkhJyeHpk2b1upk6qK681u+\nfDmbNm0qFz+40vkZ40znVxcVz+/UqVPlroycSWBgIFlZWQQFBZGZmamvcKvNzzA4ONjm465KcXEx\nI0eOZNy4cQy/sdaqq50jgJ+fH0OGDOG3336z+vmZFddUVSt/9913s3r1aoqKijh+/DhHjhzh9ttv\nJygoCF9fX3bs2IFSik8//ZR77rlH/56PP/4Y0Fbu9O/f35yhWcSWLVt4/fXXWb9+fbnb3l3l/Awp\ng0paVzw/Q7fddhtHjhwhIyODoqIi1qxZw913323vYdWJ4ff9448/1k+MtfkZ6t5jb+pGl9CoqCim\nTZumf95VzvHixYv6ypn8/Hy2bdtG165drX9+5nxSPHLkSNW5c2cVHR2tRowYoc6dO6d/bc6cOSo8\nPFzdfPPNasuWLfrnd+3apTp37qzCw8PV5MmT9c8XFBSoUaNGqYiICBUbG6uOHz9uztAsIiIiQoWG\nhqqYmBgVExOjrx5RyjXO77///a8KCQlR3t7eKjAwUN11113611zh/EzZtGmT6tChgwoPD1dz5861\n93BqZPTo0apVq1bKw8NDhYSEqKVLl6pLly6p/v37q/bt26sBAwaoK1eu6Lev7c/Q3r7//nul0WhU\ndHS0/t/c5s2bXeYc9+7dq7p27aqio6NVly5d1L/+9S+llLL6+Vl90RAhhBD2I8v/CSGEC5NJXggh\nXJhM8kII4cJkkhdCCBcmk7wQQrgwmeSFEMKF/T+EGvw6HyMN5gAAAABJRU5ErkJggg==\n", - "text": [ - "" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.4, page no. 570" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "maximum tensile stress, maximum compressive stress, and maximum shear stress in the shaft.\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d = 0.05 # Diameter of shaft in m\n", - "T = 2400 # Torque transmitted by the shaft in N-m\n", - "P = 125000 # Tensile force\n", - "\n", - "#calculation\n", - "s0 = (4*P)/(math.pi*d**2) # Tensile stress in\n", - "t0 = (16*T)/(math.pi*d**3) # Shear force \n", - "# Stresses along x and y direction\n", - "sx = 0 \n", - "sy = s0 \n", - "txy = -t0 \n", - "s1 = (sx+sy)/2.0 + math.sqrt(((sx-sy)/2.0)**2 + (txy)**2) # Maximum tensile stress \n", - "s2 = (sx+sy)/2.0 - math.sqrt(((sx-sy)/2.0)**2 + (txy)**2) # Maximum compressive stress \n", - "tmax = math.sqrt(((sx-sy)/2)**2 + (txy)**2) # Maximum in plane shear stress \n", - "print \"Maximum tensile stress %e\" %s1, \"Pa\"\n", - "print \"Maximum compressive stress %e\" %s2, \"Pa\"\n", - "print \"Maximum in plane shear stress %e \" %tmax, \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum tensile stress 1.346662e+08 Pa\n", - "Maximum compressive stress -7.100421e+07 Pa\n", - "Maximum in plane shear stress 1.028352e+08 Pa\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.5, page no. 573" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate maximum allowable internal pressure\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "\n", - "#initialisation\n", - "P = 12 # Axial load in K\n", - "r = 2.1 # Inner radius of the cylinder in inch\n", - "t = 0.15 # Thickness of the cylinder in inch\n", - "ta = 6500 # Allowable shear stress in Psi\n", - "\n", - "#calculation\n", - "p1 = (ta - 3032)/3.5 # allowable internal pressure\n", - "p2 = (ta + 3032)/3.5 # allowable internal pressure\n", - "p3 = 6500/7.0 # allowable internal pressure\n", - "\n", - "prs_allowable = min(p1,p2,p3) # Minimum pressure would govern the design\n", - "print \"Maximum allowable internal pressure \", round(prs_allowable), \"psi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum allowable internal pressure 929.0 psi\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.6, page no. 574" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "principal stresses and maximum shear stresses\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d1 = 0.18 # Inner diameter of circular pole in m\n", - "d2 = 0.22 # Outer diameter of circular pole in m\n", - "P = 2000 # Pressure of wind in Pa\n", - "b = 1.5 # Distance between centre line of pole and board in m\n", - "h = 6.6 # Distance between centre line of board and bottom of the ploe in m\n", - "\n", - "#calculation\n", - "W = P*(2*1.2) # Force at the midpoint of sign \n", - "V = W # Load\n", - "T = W*b # Torque acting on the pole\n", - "M = W*h # Moment at the bottom of the pole\n", - "I = (math.pi/64.0)*(d2**4-d1**4) # Momet of inertia of cross section of the pole\n", - "sa = (M*d2)/(2*I) # Tensile stress at A \n", - "Ip = (math.pi/32.0)*(d2**4-d1**4) # Polar momet of inertia of cross section of the pole\n", - "t1 = (T*d2)/(2*Ip) # Shear stress at A and B\n", - "r1 = d1/2.0 # Inner radius of circular pole in m\n", - "r2 = d2/2.0 # Outer radius of circular pole in m\n", - "A = math.pi*(r2**2-r1**2) # Area of the cross section\n", - "t2 = ((4*V)/(3*A))*((r2**2 + r1*r2 +r1**2)/(r2**2+r1**2)) # Shear stress at point B \n", - "\n", - "# Principle stresses \n", - "sxa = 0\n", - "sya = sa\n", - "txya = t1\n", - "sxb = 0\n", - "syb = 0\n", - "txyb = t1+t2 \n", - "\n", - "# Stresses at A\n", - "s1a = (sxa+sya)/2.0 + math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum tensile stress \n", - "s2a = (sxa+sya)/2.0 - math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum compressive stress \n", - "tmaxa = math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum in plane shear stress\n", - "\n", - "print \"Maximum tensile stress at point A is\", s1a, \"Pa\"\n", - "print \"Maximum compressive stress at point A is\", s2a, \"Pa\"\n", - "print \"Maximum in plane shear stress at point A is\", tmaxa, \"Pa\"\n", - "\n", - "# Stress at B \n", - "s1b = (sxb+syb)/2.0 + math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum tensile stress \n", - "s2b = (sxb+syb)/2.0 - math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum compressive stress \n", - "tmaxb = math.sqrt(((sxb-syb)/2.0)**2 + (txyb)**2) # Maximum in plane shear stress \n", - "print \"Maximum tensile stress at point B is\", s1b, \"Pa\"\n", - "print \"Maximum compressive stress at point B is\", s2b, \"Pa\"\n", - "print \"Maximum in plane shear stress at point B is\", tmaxb, \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum tensile stress at point A is 55613361.197 Pa\n", - "Maximum compressive stress at point A is -700178.455718 Pa\n", - "Maximum in plane shear stress at point A is 28156769.8263 Pa\n", - "Maximum tensile stress at point B is 6999035.59641 Pa\n", - "Maximum compressive stress at point B is -6999035.59641 Pa\n", - "Maximum in plane shear stress at point B is 6999035.59641 Pa\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.7, page no. 578" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "principal stresses and maximum shear stresses at points & at the base of the post\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "b = 6 # Outer dimension of the pole in inch\n", - "t = 0.5 # thickness of the pole\n", - "P1 = 20*(6.75*24) # Load acting at the midpoint of the platform\n", - "d = 9 # Distance between longitudinal axis of the post and midpoint of platform\n", - "P2 = 800 # Load in lb\n", - "h = 52 # Distance between base and point of action of P2\n", - "\n", - "#calculation\n", - "M1 = P1*d # Moment due to P1\n", - "M2 = P2*h # Moment due to P2\n", - "A = b**2 - (b-2*t)**2 # Area of the cross section\n", - "sp1 = P1/A # Comoressive stress due to P1 at A and B\n", - "I = (1.0/12.0)*(b**4 - (b-2*t)**4) # Moment of inertia of the cross section\n", - "sm1 = (M1*b)/(2*I) # Comoressive stress due to M1 at A and B\n", - "Aweb = (2*t)*(b-(2*t)) # Area of the web\n", - "tp2 = P2/Aweb # Shear stress at point B by lpad P2\n", - "sm2 = (M2*b)/(2*I) # Comoressive stress due to M2 at A \n", - "sa = sp1+sm1+sm2 # Total Compressive stress at point A\n", - "sb = sp1+sm1 # Total compressive at point B \n", - "tb = tp2 # Shear stress at point B\n", - "\n", - "# Principle stresses \n", - "sxa = 0\n", - "sya = -sa\n", - "txya = 0\n", - "sxb = 0\n", - "syb = -sb\n", - "txyb = tp2 \n", - "\n", - "# Stresses at A\n", - "s1a = (sxa+sya)/2 + math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum tensile stress \n", - "s2a = (sxa+sya)/2 - math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum compressive stress \n", - "tmaxa = math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum in plane shear stress\n", - "print \"Maximum tensile stress at point A is\", s1a,\"Psi\"\n", - "print \"Maximum compressive stress at point A is\", round(s2a,2), \"Psi\"\n", - "print \"Maximum in plane shear stress at point A is\", round(tmaxa,2), \"Psi\"\n", - "\n", - "# Stress at B \n", - "s1b = (sxb+syb)/2 + math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum tensile stress \n", - "s2b = (sxb+syb)/2 - math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum compressive stress \n", - "tmaxb = math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum in plane shear stress\n", - "print \"Maximum tensile stress at point B is\", round(s1b,2), \"Psi\"\n", - "print \"Maximum compressive stress at point B is\", round(s2b,2), \"Psi\"\n", - "print \"Maximum in plane shear stress at point B is\", round(tmaxb,2), \"Psi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum tensile stress at point A is 0.0 Psi\n", - "Maximum compressive stress at point A is -4090.91 Psi\n", - "Maximum in plane shear stress at point A is 2045.45 Psi\n", - "Maximum tensile stress at point B is 13.67 Psi\n", - "Maximum compressive stress at point B is -1872.69 Psi\n", - "Maximum in plane shear stress at point B is 943.18 Psi\n" - ] - } - ], - "prompt_number": 5 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Testing_the_interface/chapter8_2.ipynb b/Testing_the_interface/chapter8_2.ipynb deleted file mode 100755 index 2e7289e4..00000000 --- a/Testing_the_interface/chapter8_2.ipynb +++ /dev/null @@ -1,524 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 8: Applications of Plane Stress Pressure Vessels Beams and Combined Loadings" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.1, page no. 546" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "finding max. permissible pressures at various conditions\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d = 18 # inner idameter of the hemisphere in inch\n", - "t = 1.0/4.0 # thickness of the hemisphere in inch\n", - "\n", - "\n", - "#calculation\n", - "# Part (a)\n", - "sa = 14000 # Allowable tensile stress in Psi\n", - "Pa = (2*t*sa)/(d/2.0) # Maximum permissible air pressure in Psi\n", - "print \"Maximum permissible air pressure in the tank (Part(a)) is\", round(Pa,1), \"psi\"\n", - "\n", - "# Part (b)\n", - "sb = 6000 # Allowable shear stress in Psi\n", - "Pb = (4*t*sb)/(d/2.0) # Maximum permissible air pressure in Psi\n", - "print \"Maximum permissible air pressure in the tank (Part(b)) is\", round(Pb,1), \"psi\"\n", - "\n", - "# Part (c)\n", - "e = 0.0003 # Allowable Strain in Outer sufrface of the hemisphere\n", - "E = 29e06 # Modulus of epasticity of the steel in Psi\n", - "v = 0.28 # Poissions's ratio of the steel\n", - "Pc = (2*t*E*e)/((d/2.0)*(1-v)) # Maximum permissible air pressure in Psi\n", - "print \"Maximum permissible air pressure in the tank (Part(c)) is\", round(Pc,1), \"psi\"\n", - "\n", - "# Part (d)\n", - "Tf = 8100 # failure tensile load in lb/in \n", - "n = 2.5 # Required factor of safetty against failure of the weld\n", - "Ta = Tf / n # Allowable load in ld/in \n", - "sd = (Ta*(1))/(t*(1)) # Allowable tensile stress in Psi\n", - "Pd = (2*t*sd)/(d/2.0) # Maximum permissible air pressure in Psi\n", - "print \"Maximum permissible air pressure in the tank (Part(d)) is\", round(Pd,1), \"psi\"\n", - "\n", - "# Part (e)\n", - "Pallow = Pb \n", - "print \"Maximum permissible air pressure in the tank (Part(e)) is\", round(Pb,1) ,\"psi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum permissible air pressure in the tank (Part(a)) is 777.8 psi\n", - "Maximum permissible air pressure in the tank (Part(b)) is 666.7 psi\n", - "Maximum permissible air pressure in the tank (Part(c)) is 671.3 psi\n", - "Maximum permissible air pressure in the tank (Part(d)) is 720.0 psi\n", - "Maximum permissible air pressure in the tank (Part(e)) is 666.7 psi\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.2, page no. 552" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating various quantities for cylindrical part of vessel\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "a = 55 # Angle made by helix with longitudinal axis in degree\n", - "r = 1.8 # Inner radius of vessel in m\n", - "t = 0.02 # thickness of vessel in m\n", - "E = 200e09 # Modulus of ealsticity of steel in Pa\n", - "v = 0.3 # Poission's ratio of steel \n", - "P = 800e03 # Pressure inside the tank in Pa\n", - "\n", - "\n", - "#calculation\n", - "# Part (a)\n", - "s1 = (P*r)/t # Circumferential stress in Pa\n", - "s2 = (P*r)/(2*t) # Longitudinal stress in Pa\n", - "\n", - "print \"Circumferential stress is \", s1, \"Pa\"\n", - "print \"Longitudinal stress is \", s2, \"Pa\"\n", - "\n", - "# Part (b)\n", - "t_max_z = (s1-s2)/2.0 # Maximum inplane shear stress in Pa\n", - "t_max = s1/2.0 # Maximum out of plane shear stress in Pa\n", - "\n", - "print \"Maximum inplane shear stress is \", t_max_z, \"Pa\"\n", - "print \"Maximum inplane shear stress is \", t_max, \"Pa\"\n", - "\n", - "# Part (c)\n", - "e1 = (s1/(2*E))*(2-v) # Strain in circumferential direction \n", - "e2 = (s2/E)*(1-(2*v)) # Strain in longitudinal direction\n", - "\n", - "print \"Strain in circumferential direction is %e\"%(e1)\n", - "print \"Strain in longitudinal direction is \", e2\n", - "\n", - "# Part (d)\n", - "# x1 is the direction along the helix\n", - "theta = 90 - a \n", - "sx1 = ((P*r)/(4*t))*(3-math.cos(math.radians(2*theta))) # Stress along x1 direction\n", - "tx1y1 = ((P*r)/(4*t))*(math.sin(math.radians(2*theta))) # Shear stress in x1y1 plane\n", - "sy1 = s1+s2-sx1 # Stress along y1 direction\n", - "\n", - "print \"Stress along y1 direction is \", sy1\n", - "\n", - "# Mohr Circle Method\n", - "savg = (s1+s2)/2.0 # Average stress in Pa\n", - "R = (s1 - s2 )/2.0 # Radius of Mohr's Circle in Pa\n", - "sx1_ = savg - R*math.cos(math.radians(2*theta)) # Stress along x1 direction\n", - "tx1y1_ = R*math.sin(math.radians(2*theta)) # Shear stress in x1y1 plane\n", - "print \"Stress along x1 direction is \", sx1_, \"Pa\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Circumferential stress is 72000000.0 Pa\n", - "Longitudinal stress is 36000000.0 Pa\n", - "Maximum inplane shear stress is 18000000.0 Pa\n", - "Maximum inplane shear stress is 36000000.0 Pa\n", - "Strain in circumferential direction is 3.060000e-04\n", - "Strain in longitudinal direction is 7.2e-05\n", - "Stress along y1 direction is 60156362.5799\n", - "Stress along x1 direction is 47843637.4201 Pa\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.3, page no. 562" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "principal stresses and maximum shear stresses at cross section\n", - "\"\"\"\n", - "\n", - "%pylab inline\n", - "from matplotlib import *\n", - "from pylab import *\n", - "import numpy\n", - "\n", - "#initialisation\n", - "L = 6.0 # Span of the beam in ft\n", - "P = 10800 # Pressure acting in lb\n", - "c = 2.0 # in ft\n", - "b = 2.0 # Width of cross section of the beam in inch\n", - "h = 6.0 # Height of the cross section of the beam in inch\n", - "x = 9.0 # in inch\n", - "\n", - "#calculation\n", - "Ra = P/3.0 # Reaction at point at A\n", - "V = Ra # Shear force at section mn \n", - "M = Ra*x # Bending moment at the section mn\n", - "I = (b*h**3)/12.0 # Moment of inertia in in4\n", - "y = linspace(-3, 3, 61)\n", - "sx = -(M/I)*y # Normal stress on crossection mn\n", - "Q = (b*(h/2-y))*(y+((((h/2.0)-y)/2.0))) # First moment of recmath.tangular cross section\n", - "txy = (V*Q)/(I*b) # Shear stress acting on x face of the stress element\n", - "s1 = (sx/2.0)+numpy.sqrt((sx/2.0)**2+(txy)**2) # Principal Tesile stress on the cross section\n", - "s2 = (sx/2.0)-numpy.sqrt((sx/2.0)**2+(txy)**2) # Principal Compressive stress on the cross section\n", - "tmax = numpy.sqrt((sx/2)**2+(txy)**2) # Maximum shear stress on the cross section\n", - "plot(sx,y,'o',color='c')\n", - "plot(txy,y,'+',color='m')\n", - "plot(s1,y,'--',color='y')\n", - "plot(s2,y,'<',color='k')\n", - "plot(tmax,y,label=\"Maximum shear stress on cross section\")\n", - "legend()\n", - "show()\n", - "#print \"Principal Tesile stress on the cross section\", s1, \"psi\"\n", - "#print \"Principal Compressive stress on the cross section\", s2, \"psi\"\n", - "\n", - "# Conclusions \n", - "s1_max = 14400.0 # Maximum tensile stress in Psi\n", - "txy_max = 900.0 # Maximum shear stress in Psi\n", - "t_max = 14400.0/2.0 # Largest shear stress at 45 degree plane" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Populating the interactive namespace from numpy and matplotlib\n" - ] - }, - { - "output_type": "stream", - "stream": "stderr", - "text": [ - "WARNING: pylab import has clobbered these variables: ['power', 'random', 'fft', 'load', 'save', 'linalg', 'info']\n", - "`%pylab --no-import-all` prevents importing * from pylab and numpy\n" - ] - }, - { - "metadata": {}, - "output_type": "display_data", - "png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAD9CAYAAABZVQdHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVPX+x/HXgCyisriBgkiChqiBluH1aqKm5Fam2VXL\ntOxWVi739vOWZYnd1Lppad0Ws9RKU296Q8vlahLtaYaoqbiguII7CMrO9/fHONMAw7DMPnyej0eP\nBzNz5pzvAfx2eM/nfL4apZRCCCGES3Kz9wCEEEJYj0zyQgjhwmSSF0IIFyaTvBBCuDCZ5IUQwoXJ\nJC+EEC7MrEm+oKCA2NhYYmJiiIqKYsaMGZYalxBCCAvQmFsnf/36dXx8fCgpKaFXr17Mnz+fXr16\nWWp8QgghzGB2XOPj4wNAUVERpaWlNG3a1OxBCSGEsAyzJ/mysjJiYmIIDAykb9++REVFWWJcQggh\nLKCBuTtwc3MjNTWVnJwc4uPjSU5OJi4uTv+6RqMx9xBCCFEvWaLrjMWqa/z8/BgyZAi7du2q9JpS\nqtb/DXj6aUhIgI4dwcvrjwH7+0NSkv41TYMGdL7lljodwxL/zZo1y27HlvMz77+pfaailOL4rON2\nH4uj/ux+/VXRsqXi7Fn7n481zs+R/7MUsyb5ixcvkp2dDUB+fj7btm2ja9euFhnY1HvvJfz0aXjn\nHZgxQzvZu7lR5uUFTz0F8+bBwYOokhLOXLpkkWOK+qOw8CzXAhPtPQyHVlgIEybAG29Aq1b2Ho2o\nK7PimszMTMaPH09ZWRllZWWMGzeO/v37W2RgQ/r1A+Dt9espADzvvJMfL17k+sWLcO5cuW3LLHJE\nUZ/k/HyJkgaXyEjIIGN2hv55/zh//OP87TcwB/LyyxARAWPH2nskwhxmTfJdunQhJSXFUmOpZEi/\nfvrJHmCgUmxr3hzWrIFjx7SXGkBpSQnxU6ZQ6OaGZ2kptzZrxrmTJ1m6dKnVxqZj+PmDK3LV8/P7\nUzNu/d2TsKfDAAhLCCM7OdulJnhzfna//QYffgh79oCjfqzmqr+bluZUd7wajXDc3SksKWHrvffy\nbUAA27Zv57U5c/j1t99sMiZX/0Vz1fPTaBrQtat7ueeyk7PtNBrrqOvPrqgIHn4Y5s+HoCDLjsmS\nXPV309LMvhmq2gNoNBb9EGFjUhJvb9hAAeClFId37iSjoEB7VW9wdR8QHMzl06ctcsymTZty5coV\ni+xLCCEMBQQEcPny5UrPW2rudLpJ3pBSitadO5OVkQHXr5d7zS84mGwLTfLWPAchRP1W1fxiqXnH\n7Dp5e9JoNHTp148sB8vphRDCUTj1JA/anP7YqlWkv/MOfPeddrI/fFif0+ue+/rIETrJ3bhCiHrG\nqeMaHWvn9BLXCCGsxdpxjUtM8oZM5fSNAgP58/33U6DRkH3kCC3Lyti2ZUu1+6zvk3yTJk3Yt28f\nYWFh9h5KjSQnJzNu3DhOnTpl76EIF3Ly5Ek6derE1atXLdquxdqTvFOVUNaELqfnH/+o1BIhv7CQ\nrc2a8d22bexNSuKHPXvYmJRkx9GaLywsDC8vLy5VuOu3a9euuLm5cfLkSbOPkZub6zQTvCNLSEhg\n3Lhx9h6GqKGwsDCSDOaH0NBQcnNzna4fl8tN8mCiJUJ+vr4dAoWFFAQG8vaGDfYerlk0Gg3t2rVj\n1apV+uf27dtHfn6+0/0yOhtL9xix9P4chbOel6v8Be+Sk/yQfv1YNGYM8evXc8fly7TWvVBYqM/n\ndQpsPjrLe/DBB/nkk0/0jz/++GMeeuihcr+gGzdupGvXrvj5+REaGsrs2bP1r61Zs4Z27dqRm5sL\nwObNm2nVqpX+rwM3NzeOHTsGwIQJE3jyyScZPHgwTZo0oXfv3mRlZTF16lQCAgLo2LEjqamp+n0b\nvlf3/hdffBHQxiohISG8/vrrtGzZktatW5OYmMimTZvo0KEDzZo149VXX63yvDdt2kSnTp3w9fUl\nJCSEBQsWlHv9jTfeIDAwkNatW7N8+XL984WFhfzf//0fbdu2JSgoiEmTJlFQoP1NyM7OZujQobRs\n2ZKmTZsybNgwzpw5o39vXFwcM2fO5M9//jONGjXi+PHjlcb12muvERISgq+vL5GRkSQlJbFlyxbm\nzZvHmjVraNKkib7Hk7H9paWlMWDAAJo1a0ZkZCSff/55ted88eJFhg4dSkBAAM2aNeOOO+6ocoL6\n6aef6N69O/7+/tx+++38/PPP5c7vpZdeolevXvj6+hIfH1/pr0RD69evJyYmBj8/PyIiIti6dWuV\n52XquMuXLyc8PBxfX1/atWvHZ599BsDRo0fp06cP/v7+tGjRgtGjRxsdR0FBAQ8++CDNmzcnICCA\n22+/nfPnzwOQk5PDxIkTad26NSEhIbz44ouUlf3RDGXJkiVERUXh6+tLp06d2L17N+PGjePkyZMM\nGzaMJk2aMH/+fDIyMnBzc9O/9+zZs9x99900a9aM9u3b8+GHH+r3mZCQwP3338/48ePx9fWlc+fO\n/GajGzQrUVZmg0NUq6ysTN0yaJCiY0eFl5cCtP9FR6tuDz6oBk6erO6YMkXdMmiQujM+vtL7HeEc\nqhIWFqa+/vprdfPNN6uDBw+qkpISFRISok6cOKE0Go06ceKEUkqp5ORk9fvvvyullNq7d68KDAxU\niYmJ+v088MADasKECerixYuqdevWauPGjfrXNBqNSk9PV0opNX78eNW8eXOVkpKiCgoKVL9+/VTb\ntm3Vp59+qsrKytTMmTNV3759jb5XKaUmTJigXnzxRaWUUt98841q0KCB+uc//6lKSkrUkiVLVLNm\nzdTYsWNVXl6e2r9/v2rYsKHKyMgweu5BQUHqhx9+UEoplZ2drVJSUsrtd9asWaqkpERt2rRJ+fj4\nqOzsbKWUUtOmTVP33HOPunLlisrNzVXDhg1TM2bMUEopdenSJfXf//5X5efnq9zcXDVq1Cg1fPhw\n/TH79Omj2rZtqw4cOKBKS0tVcXFxuTGlpaWpNm3aqMzMTKWUUidOnNCff0JCgho3bly57SvuLzs7\nW4WEhKjly5er0tJStXv3btW8eXN18OBBk+f83HPPqSeeeEKVlJSokpIS/TYVXbp0Sfn7+6sVK1ao\n0tJStWrVKhUQEKAuX76sH09ERIQ6cuSIys/PV3Fxceq5554zuq8dO3YoPz8/9fXXXyullDpz5oxK\nS0szel5ZWVlVHjcvL0/5+vqqw4cPK6WUysrKUvv371dKKTV69Gg1d+5cpZRShYWF6scffzQ6lvff\nf18NGzZM5efnq7KyMpWSkqKuXr2qlFJq+PDh6oknnlDXr19X58+fV7fffrtavHixUkqp//znPyo4\nOFjt2rVLKaXU0aNH9f9mwsLC1Pbt2/XHOH78uNJoNKq0tFQppVTv3r3VU089pQoLC1Vqaqpq0aKF\nSkpKUkopNWvWLOXt7a02b96sysrK1IwZM1SPHj2Mjr2q+cVS8069mOSVUuqr7dtVu4kTFQkJ+sne\no2VLFXjPPeWe8w4KUl8Z/GCVqv4cwDL/1YVukn/llVfUjBkz1ObNm9XAgQNVSUlJuUm+oqlTp6q/\n/e1v+sfZ2dkqNDRUdenSRT3xxBPltjWcqCdMmKAee+wx/Wtvv/22ioqK0j/eu3ev8vf3N/pe3ftn\nzpyplNJOxg0bNlRlZWVKKaWuXr2qNBqN2rlzp377W2+9tdz/jAyFhoaqxYsXq5ycnHLP6/ar+8eo\nlFItW7ZUO3bsUGVlZapRo0blxvTTTz+pm266yegxdu/erQICAvSP4+Li1KxZs4xuq5RSR44cUS1b\ntlRff/21KioqKvfarFmz1IMPPljuuYr7W716terdu3e5bR577DE1e/Zsk+f80ksvqXvuuUcdPXq0\nyrEppdQnn3yiYmNjyz33pz/9SS1fvlw/njlz5uhfe/fdd9Vdd91ldF+PPfaY+vvf/270tYrnZeq4\n165dU/7+/mrdunXq+vXr5bZ56KGH1GOPPaZOnz5t8ryWLl2qevbsqfbu3Vvu+aysLOXl5aXy8/P1\nz3322Wf6C5GBAweqt956y+g+TU3yJ0+eVO7u7iovL0//+owZM9SECROUUtqf9YABA/Sv6S5YjLH2\nJO+ScY0xQ/r1462xY4m/coU7Bgzglv798VKKc4cPm53TW2qaryuNRsO4ceNYuXKl0agGYMeOHfTt\n25eWLVvi7+/P4sWLy/0Z7ufnx3333cfvv//OM888Y/J4LVu21H/t7e1d7nHDhg3Jy8ur8dibNWum\n/+ygYcOGAAQGBpbb37Vr14y+d926dWzatImwsDDi4uL45Zdfyu3Xze2PX28fHx/y8vK4cOEC169f\n59ZbbyUgIICAgAAGDRrExYsXAe2axY8//jhhYWH4+fnRp08fcnJyyn0/27RpU+X5REREsHDhQhIS\nEggMDGTMmDFkZmaa/B4Y7u/EiRPs2LFDP7aAgAA+++wzzt3ovFrVOU+fPp2IiAgGDhxIeHg4r732\nmtFjnT17ltDQ0HLPtW3blrNnz+ofBxk0rDH18zx9+jTh4eE1Oi9Tx/Xx8WHNmjW8//77tG7dmqFD\nh3Lo0CEA/vWvf6GU4vbbb6dz584sW7bM6LHGjRtHfHw8o0ePJjg4mGeffZaSkhJOnDhBcXExrVq1\n0n8/n3jiCS5cuFCjc6jK2bNnadq0KY0aNdI/FxoaWi7aM/w99vHxoaCgoFxMZCv1ZpIH7US/ZeFC\nkhcu5NbAQPKzs/WTuyFnzOlDQ0Np164dmzdvZsSIEZVeHzt2LMOHD+f06dNkZ2fzxBNPlPuFS01N\nZdmyZYwdO5bJkydbbFw+Pj5cNyhlzczMtNgHwrfddhuJiYlcuHCB4cOHc//991f7nubNm9OwYUMO\nHDjAlStXuHLlCtnZ2Vy9ehWABQsWcPjwYXbu3ElOTg7ffvttpQ8Oqxv/mDFj+P777zlx4gQajYZn\nn33W5PsMnw8NDaVPnz76sV25coXc3Fzeeecdk+fcuHFj5s+fT3p6Ohs2bOCNN94oVxmiExwczIkT\nJ8o9d+LECYKDg6v71lXSpk0bjh49WuXrhudV3XEHDhzI1q1bycrKIjIykr/+9a+AdqL84IMPOHPm\nDIsXL+bJJ58s9xmPToMGDXjppZfYv38/P/30E1999RWffPIJoaGh+uoz3fczJyeHffv2VXsOpn7O\nrVu35vLly+X+B3jy5ElCQkKqfI+91KtJXkej0fDRRx/R6c47K5VZAuReukT8lCn0mTqV6MGD7TTK\n2vvoo49ISkrSXxEbysvLIyAgAE9PT3bu3Mlnn32m/yXWfWg1b948li5dypkzZ3jvvfeMHqPiXwjV\niYmJYeXKlZSWlrJlyxa+++672p+YEcXFxaxcuZKcnBzc3d1p0qQJ7u7u1b7Pzc2Nv/71r0ybNk1/\nNXfmzBn9B4Z5eXk0bNgQPz8/Ll++XO4Dah1T34PDhw+TlJREYWEhXl5eeHt768cVFBRERkZGpfcb\nPh46dCiHDx9mxYoVFBcXU1xczK+//kpaWprJc/7qq684evQoSil8fX1xd3c3+v0YPHgwhw8fZtWq\nVZSUlLBmzRrS0tIYOnRojc7P0MSJE1m2bBlJSUmUlZVx5swZ/RV4xf2YOu758+dZv349165dw8PD\ng0aNGunH/vnnn3P6xg2M/v7+aDSacn+h6SQnJ7Nv3z5KS0tp0qQJHh4euLu7ExQUxMCBA/n73/9O\nbm4uZWVlpKen638PH330UebPn09KSgpKKY4ePaovOw4MDCQ9Pd3oubdp04aePXsyY8YMCgsL2bt3\nL0uXLuXBBx+s0ffOlurlJA/aiX7u//0f7Xr2/KPM0ssLj8xMzuTmlqundxbt2rWjW7du+seGVyLv\nvvsuL730Er6+vvzzn/8sd9U7Y8YM2rZty+OPP46npycrVqxg5syZ+l9ww/1oNBqTjytuv2jRIr78\n8kt97HDvvfdWua2xx6asWLGCm266CT8/Pz744ANWrlxZo/289tprRERE0KNHD/z8/BgwYACHDx8G\nYNq0aeTn59O8eXN69uzJoEGDajXGwsJCZsyYQYsWLWjVqhUXL15k3rx5AIwaNQrQRkm33Xab0f01\nbtyYrVu3snr1aoKDg2nVqhUzZsygqKjI5DkfPXqUAQMG0KRJE3r27MlTTz1Fnz59Ko2vadOmfPXV\nVyxYsIDmzZszf/58vvrqK5o2bWp0PMZ+vjrdu3dn2bJl/O1vf8Pf35+4uLhy92UYvs/UccvKynjz\nzTcJDg6mWbNmfP/99/qLjF27dtGjRw+aNGnCPffcw1tvvWX0no2srCxGjRqFn58fUVFRxMXF6e9J\n+OSTTygqKiIqKoqmTZsyatQosrKyALjvvvt44YUXGDt2LL6+vowYMULfcXbGjBm88sorBAQE8MYb\nb1Q6p1WrVpGRkUHr1q0ZMWIEL7/8Mv1urH9R3b8LW3K5O15rS9cSIV8pso8e5divv5LXvHm5dghg\nmQV1hRCiImlrYCNKKSZOnMgnK1ZQWlxs9HUhhLA0meRtSClFzJAh7M3IkCt5IYRNSO8aG6oqpxdC\nCGclV/JGVMzpD27bRrGRCEcIIcwly//ZkcmcPjqaLjExtPL1rXXrYuEYCgpOcujQo0RHbzX6enZy\ntn5x74zZGQSND8I7zBv/OH/84/xtOdQ6O30aYmJgxw6owz0/wo5k+T8b0NXT/5aVZTSnP3LqFPvu\nuEO/9KB3QAAbk5IYcqOMSjg2d/dG5ObuqvJ1Y5N5WEKYlUdlWc88A08+KRN8fSaZfDWqzOnT0ylI\nT3e51sX1SYMG/pSW5qJUib2HYhXbt8POnfDcc/YeibAnuZKvAd2V+dsbNnD9zjv5/YsvuHLmDBjp\n6eGMLRHqK43GnQYN/CkuvoynZ0uj2+gim4KMArI+ztI/7+iRTXExTJ4Mb74JPj72Ho2wJ8nk66DK\nUsvoaLp16UIzf3/OHDtG9vHjfPDvf0t848B27uxEp05raNSoc7XbZiRkOPzkrrNwIWzZAps3g6wd\n45ykhNKOqmyJcPYs6YcOsW37dg5s385ZT0+mrlrl9EsMujJPz5YUFZ2v8fa6D2Id2blzMGeOdqKX\nCV7IJF9Hhq2Le995J22joijLySFn795ynS3TH3hAcnoHFhn5Cb6+PWq0rTNcwQM8/zyMHw+RkfYe\niXAEZmXyp06d4qGHHuL8+fNoNBoee+wxpkyZYqmxObwh/foxuG9fJk6cSOrRo5TeaCJVkeT0jsvb\nu+re8DoVSyl1HDG62bULNm2CtDR7j0Q4CrMy+aysLLKysoiJiSEvL49bb72VxMREOnbs+McBXDCT\nr0gpxbp163j06afJyc4ul9GzcCHdPvpIcnoX4ci5vFLQqxc88ghMnGjv0QhzOUSdfFBQkH4VmcaN\nG9OxY0fOnj1bbpKvDzQaDffddx/eAQE8Oncu5zIztR/IAoEffED60aOk5OVpn4uMZOqqVQAy0Tup\n7ORsh5zkV6+G/HyYMMHeIxGOxGIllBkZGezevZvY2FhL7dLpDO3fn480Gt5av55TR4+StXcvuf/7\nH9evXSt3E1X6Aw/wdmKiTPJOyD/O3yE/fL1+HZ59FlauhBqsnSLqEYtM8nl5edx3330sWrSIxo0b\nV3o9ISFB/3VcXBxxcXGWOKxDMszp1+bkcD031+h2ktM7F0fP5d94A2JjoXdve49E1FVycjLJyckW\n36/ZdfLFxcUMHTqUQYMGMW3atMoHqAeZvDGS0zuH0tJ8du3qwu23H6nxyj2OlstnZkKXLtq7W9u1\ns/dohKU4RCava+AVFRVldIKvzySndw7u7g0pLr5ISUk2Hh4BNX6fI+XyM2dqP2iVCV4YY9Yk/+OP\nP7JixQpuueUWunbtCsC8efO46667LDI4VyA5vePz8gqhsPBkjSd5R8rl9+yBjRvBYP1sIcoxa5Lv\n1asXZWVllhqLy6ppTn/myhWiBw/m3IkTRPfvz5Thw2XStwEvr7YUFJygceNok9tVzOULMgrs3np4\n+nR48UXw87PL4YUTkAZlNqJrWzx48ODKOT3At9+yPzERVVgIkZFsHTGC9JUrAYlwrM3bO4yCghPV\nbudorYf/9z84cQIee8xuQxBOQNoa2JAup1+xciWBf/6ztueNhwccPgwvv4y6erVyhCMtEazO27st\nBQUZ9h5GrZSWaq/iX3tN+yskRFXkSt4Ohvbvz4fA45Mnk1laijKxtKCUWlpfcPCTaDQ1+6fgKK2H\nV6wAX1+45x6bHVI4KWk1bEe6Msv58+fz62+/UVZyY/GKG2WWAF0//JDSy5clp3dA9iqlLCiAm2+G\nVaugZ0+bHlrYkLQadgG6+Obnn3/mHy+8gFeLFtpVpwCUwu/FF/l90yb2JiVxzsODrSNGSOtiB2OP\nKpt33oFu3WSCFzUjV/IO5Kvt23nhjTc4sXcvlJSQe+ECZaWl2hcNru7jExPZcuNrYT+66MaWH75m\nZ0OHDvDtt9qPdITrcoiboYRlDenXj/+uXMnxnBxyqyizBMnp7c2eLQ5efx2GDZMJXtScTPIOxLDM\nslJOr6MUJ1NSCI6Kov3AgXiVlUlObyFKlaLRVN/dq+Jkbqtc/tw5eP992L3b6ocSLkQyeQdjMqf/\n9ls8Ro3i+E8/cdbTk2+HD5ec3kJOnnyd48dn1um9tsrl58yBceMgNNQmhxMuQiZ5B6XRaJiXkMDn\nn31G26goGhw6hNsrr1B86ZK2SNqA1NObz9u7Ldev1743gK0qa06c0LYRfv55mxxOuBCJaxyYUoov\nPvuMy0ePUlJgIolXioOpqRLhmKFRoyiuXz9Y4+1t3eLglVfgiSegZUuL71q4OJnkHVjFjH7fvn1c\nv379jw2Ugu++gzVrOHnoEHTpwtnhwwGkJUItNWzYnoKCDMrKinBz86x2e1u2OEhPhy++0N4YLURt\nSVzj4Awz+o8//pibO3ZE06CBtpbuqadg3jw4eBAqNIqTCKd23Ny88PZuS37+EXsPpZKXX4bJk6Fp\nU3uPRDgjuZJ3ErrJfsSIEcTceiv79uzRXsmbIKWWtdOoUTQFBRk0atSpRtvbosXBkSOwaRMcPWqR\n3Yl6SCZ5J+Pm5saelBR9O4RKEQ7oY5x9X35JfFkZhW5uktPXQFTU6hqvDgXlJ3Nr5fGvvAJTpkgr\nYVF3Msk7Id1V/ciRI1m3bh0zX3qJw0eOoEB7K+SaNXD4MLn+/mwdMUL/PsnpTavNBG+MpVeLOnpU\nuyCIXMULc0gm78R0k/2B33/nnnvvxeNGmSUHD0JpKcUhIeW2l5zeeqxRUTNnDjz9NPg7xiqDwknJ\nlbyTU0rx6KOPsn3LFopNlVneIDm9ZVmrxUFGBmzYIFfxwnzSoMwFGLYsLpfR65qa6Uotf/mFbs2b\n0zwgQHJ6K7Bk6+GnnoImTeDVVy0wMOGUpEGZ0KuY0c+fP5/U1FQ0585RoMvojx3Dw8+Psz17kjJx\nov69ktOXV1JylZKSbLy969Y7wBK5fGamtlf8wZrfmyVElSSTdyG6yf6nn37i6aefxjM//4+MvrAQ\nL6XImjq13Hskpy/v4sVE0tOn1+m9lsrl33wTHnwQAgMtsjtRz8mVvIvRZfRr166t1K7Y3dP4nZyS\n0/+hSZPuZGQk1Oo9lszlc3Lgo48gJaVWbxOiSjLJuxhTrRD0f7YZZPQ8+yy5ly4RP2WK5PSAj8/N\nlJRcpqjoAp6eLWr0HsPJvCCjwKz2BosXw6BB0LZtnXchRDnywasLq/iBbLuICC40b865zEw4dgwi\nIwnq1AmuXy8X44SvXMmiMWPq7US/Z88AQkKm0qzZ0Fq/NzUulZjkmDodt7AQ2rXT3uEaHV2nXQgX\nImu8imoZZvSTJk3iXGYm2T/+qM/oAy5epFVJieT0Ffj69iAn5+c6vdc7zLvOx121Cjp1kgleWJbE\nNS7OVEZ/S0QEtGql27BchHM2O7veRjgBAQPIyfm+xtsbZvK6Hja1bXOglPYD13/9q/bjFcIUmeRd\nXHXtij1LS/9ohXAjwgE4evo0+2b+sVJSfSq19Pe/A3//O2q+vQXaDn/zDRQXw8CBtXqbENWSTL4e\nqZjRh4WFUaqUtu+Nbi3Z6GgahoWR37dvpdwgPjGRLQsX2mHkziMjIQOo/SR/990wdCg89pjlxySc\nk9wMJWrNsF1x//79+eGHHyipsFB4wMWLtI6MZL+RYFhKLatmTtvhY8fgp59g9Wprj1LUR2ZP8o88\n8ggbN26kZcuW7Nu3zxJjElbm5uZGUlKS0VYIt0RE4NWyJfsrZPSAlFqaYE7b4ffegwkTwMfHigMU\n9ZbZ1TUPP/wwW7ZsscRYhA1VXHEqNjYWnxuzTLemTfEaPVq76lRmJgBBS5ZwNi+PrSNG8O3w4Wwd\nMYKpq1axMSnJnqfhsHQfxFYnPx+WL4dJk6w7HlF/mT3J9+7dm4CAAEuMRdhBxTLLAwcO8Nbrr1N4\n/jwUFuJ38SLxiYn1stTywoW1XLv2e63fV5u7XP/zH+jeHcLDa30YIWrEJpl8QkKC/uu4uDji4uJs\ncVhRQ6bKLGMiItiycCFx06YZfa8r5/S5ubvIy9vDTTd1rtH2dWlvsHgxPPec2UMVLiA5OZnk5GSL\n79ci1TUZGRkMGzbMaCYv1TXOoap2xX369CE5OZmBkyezrXnzchk9QLePPnLZ1sXZ2d+Snv5/3Hrr\nr7V+b9qENCKXR5rcZv9+GDAATp6EBlICISqQ6hphUcbaFev+p7127VpObt+O5sgRVKc/FrkOWrKE\ns9evu2zrYl/fnuTnH6Go6Dyeni1r9d6CjOr/xvnwQ3j4YZnghXVJWwNRjrGMfvz48Rw6eBBVUkLA\nxYv0SUysFzm9m5sH/v79uHz5f7V+b3XtDQoLYcUKeOSRuo5OiJox+xpizJgxfPvtt1y6dIk2bdrw\n8ssv8/DDD1tibMJOqmuF8M2bb7Ju3TqenjXL6PtdqSVCs2bDuHRpA0FB46rdtjbtDTZtgqgo+cBV\nWJ/Zk/yqVassMQ7hQEy1Qrhw4QI9e/Zk7969eFWxwrQrtURo3nw4Pj7ta7RtbdobfPopPPSQuaMT\nonoS1wg0Zcj4AAAgAElEQVSjKtbRt2/fHjc3N9LS0vjll1+4fv06IS1aEH5jAtdpuHAh+cOGlXvO\nmSMcD48A/Px6WXSfly7B9u1w330W3a0QRslHPqJamzZtIjMzk7KysnLPN/X3Z96YMbydmEgB4A2c\n9vau1y0RatLeYO1aiI8HPz97jVLUJ9KgTFSruvJK3eubNm3iTOPGbB0xotI+XLnUsipVlVH27w9P\nPQVGvk1C6MmiIcJmTLVAWLt2LT179mT8+PEcO3aMKcOHV4pw6mtLBGNllOfPw2+/aZf4E8IW5Epe\n1FpZWRn/+Mc/+OSTT7h27VqlK/uNSUm8vWGDPsI5n5nJbiPNWZytdXFJyVUaNPCt8fbGruQXL4bk\nZO0qUEKYIjdDCbswVV6pM6Rfv3JRjCu0RCguvsKOHRH86U8ncXdvVOV2FcsodfXyukz+iy/g0Udt\nMmQhAJnkRS1Vt9IUUC6jX7p0KV4VPrDVcabWxdoqmz9x4cI6goKqrn00/IC1IKOgXAllbq62b/x/\n/mPt0QrxB8nkRa3VJqMHXCanDwqaQFbW8hpvXzGT//pr6NEDfGue+AhhNsnkhdmqy+gBl8jpy8oK\n+fnnYLp1+5WGDW+qdvuKmfwjj0DXrjB5sjVHKVyFZPLCIdQkowfXyOnd3LwIDBxHZuYS2rWba3Sb\nqjJ5vz7+bN3qL22Fhc3JJC/MUl1GXzGf13HWnL5160lcuPB5la9XbG2ge3zoEGg00L5mHRKEsBjJ\n5IXZqsrodX1uDPN5HWfN6X18OtC27Qs13l53Vb99u/YmKI3GWiMTwji5khcWo9FoGDlyJEopXnjh\nBQ4dOkRpaanRbXVX54YtEc6XlLDbWOvixESHupqvKf84f/0k/803cPfddh6QqJdkkhcWo5Ri4sSJ\nJvP5ivFNTXJ6Z2tdXHEZQKXguy0hvHDvdUBKa4RtySQvLKa6fH7t2rUsWLCAvXv30r1790rvryqn\nd7bWxYa5fHZyNu4Tw+B9iB4jE7ywPcnkhUUZy+e9vLxISUlh/Pjx+jbFxhjL6R29dXFZWVG12/z8\ns7Y+XvJ4YQ9yJS+sQpfPb9y4kT179pgsr9QxltM7cuviM2feIy9vNzff/EG55w3jmuxvs9lelEOH\nhmVkJ2sqLSoihLXJzVDCqky1Kf7mm2+Mllcaip8yxWFbFxcXX2LHjg7cdlsK3t5tjW6TNiGNqZmR\nTJ4MQ4fadHjCyUmrYeEU6lJeaciRSy09PJrRuvXjnDw5r8ptCjIK2LcPunSx4cCEMCBxjbCJ2pRX\nGnL0Uss2bf7Ojh03Exo6w+jVfEGQD9d2Q2ioTYclhJ5M8sImalJeWRVHbong4dGc4OAnyciYRWTk\ncqB8Jr9rTR43BRdyYnam0YW+hbA2meSFTdS1/YExjtYSoU2b6eW6U5ZrN5zkSWRrr3Ith4WwJZnk\nhc3o8vmRI0eW+zBWl89XVT9f0ZThw0lfuZL0Bx7QPxe0ZAlnr18nZeJE/XO2qqdv0MCXkJApRl/L\nOKXhpj9b9fBCmCSTvLC5uubzOo6e0xs659GQLmF2O7wQMskL26sun69JdFPTnN4eLREMM/mzRxrj\nnnyOjMx8yeSFXcgkL2zOVD5f2+hGx5FaIhhO5nlvXiNqciPCelrtcEKYJHXywi4q1s+3b98eNzc3\n0tLSTLY+qIojtUQ4f/5zCgtPA5Bd7E6zZlY9nBAmyZW8sLtNmzaRmZlJWRVX4zXhSC0RLh3YScaF\npbTc/x7Z+cHkfXiSjEZlEtcIuzC7rcGWLVuYNm0apaWlPProozz77LPlDyBtDUQ1TLU+ePrpp2tU\nVmmMvVoilJUV8Ouv0bRrN5e2re/l/BU3Gje22O5FPWGpudOsSb60tJSbb76Zr7/+muDgYLp3786q\nVavo2LGjxQcqXJ/hZJ+amoqnpyelpaV0795dvyB4bWxMSmLqqlWVSi25fp0sg0qc8JUrWTRmjEUn\n+pycH9i//3769DrN9UI3PDwstmtRTzjEQt47d+4kIiKCsLAwAEaPHs369evLTfJC1IVSqtZ3xlZk\nz1JLP79eNGs2klKggYSiwo7M+vU7c+YMbdq00T8OCQlhx44dlbZLSEjQfx0XF0dcXJw5hxUuyJy2\nB6bYoyWCroRSw+NoUBx/5XfcShtLJi9MSk5OrtNfrNUxa5LX1HAVBMNJXghjLNn2wBRbtETQTeZK\ngZqtaPt8Z9zd6zxkUU9UvACePXu2RfZr1iQfHBzMqVOn9I9PnTpFSEiI2YMS9ZOl2h6YYsuWCBoN\neLopioo0NGxY9zELYQ6zJvnbbruNI0eOkJGRQevWrVmzZg2rVq2y1NhEPWVu2wNTbJ3Te7grCguR\nSV7YjVmTfIMGDfj3v/9NfHw8paWlTJw4UT50FWazVj6vY+2c3rCtgU9xEL8nnCXEv1QyeWEXsvyf\ncEjWqp03xpr19FHNClixzZtu3UCpUo4ff5HQ0Bk0aNDEImMXrkuW/xMuzdiygV5eXqSkpFS7ZGBt\nWXOJQT9VxMWL2q81GneKiy9y+PBjcuEjbEYqeIXTsETtvDHWzOmb+SvOn//jcUTEInbv/hNnz75L\ncPBTFhi9EKbJJC8cVnXZ/Nq1ay0W21iydbFhJu973I09y8rodTRHn8l36rSOlJSeNGrUBX//O8we\nuxCmyCQvHJap2vndu3czfvx4s0sqq2JO62LDD1jbfXaKc+0CCEsI0L/esGE4HTt+woEDo7n11p14\neUnZsbAeyeSFQ9Nl8z/99BOTJk2i8Y1OX1evXq11O+LasFTr4tbeRRw/Xvn5pk3j6dBhMQ0aBFR+\nUQgLkit54fCUUjz66KOsXbuWvLw8mxzTnNbFhnGN376LpPm1JSPhdKUSyubNhyGEtUkJpXAKtiyp\nrEpdSi33P5TG7esiycwEX1+rDk+4GCmhFPWKLUsqq1KXUsvikwVERcHvv1t9eEIYJXGNcFrWKqms\nSl1KLb3DvOniBvv2Qc9q1nktLb1Gfn46jRvfYp0TEPWSTPLCaVi73UFN1KTUMjoVevwSSUZCBlkf\nZ9H2rhYkf+DJX24uNdnWIDc3hf377yMm5hsaNYqyyvhF/SNxjXAaupLKpUuXEhsbi4+Pj/61Cxcu\n8Mgjj9h8TMZKLffEwJftf+Txy2+Q2vEkm32X8csVTbV9a/z9exMe/jp79w6isPCMtYYs6hmZ5IVT\nqZjNt2/fHjc3N9LS0mySy1dUXU6PZyg7Hu3OiVMN+PzLb6vdX1DQQwQHP8nevYMoKcm21rBFPSJx\njXA6ukqbBQsWcPr0acqquHHJFqrL6bOCAA+FiizkX8v2M2pYn2r32abNPygsPMO+ffdwyy1bcHeX\nPsWi7mSSF07FEXL5iirm9BPue4Vblmu/vut/2ok+RZNN4YGafaCq0WiIiFjI2bPvo9HIP1FhHolr\nhFMxlcuDtp+NPbJ5Q5mtz/PxBEiNgeXj4eMJsG/CFdIvBRE/ZQpx06YRP2WKyY6WGo0bwcFP4ubm\nYbNxC9ckN0MJp2V4g1Rqaiqenp6UlpbSvXt3qyyIXFMbk5KYumoVvYq1Swx+PAEC31/O+XXvob7Y\nBY21q1yFr1zJojFjzF59SrgmuRlKCAO6mnlr9rOpqSH9+rFozBgi0tIg7wfiExNprfJR0fmQ+kev\nmur63ghhCRL4CadkKpvXlVNau82BMbq+NZ1oR6Mdbjx4VxgACadXsLvHZfilKfS6qN++AO2V/1uJ\nidWuQFVSksP58/+hdeu/2uhshCuQSV44JVNtiNPS0mjRooVdxmXYhCw7OZuwhDAAMqech9hLsKoN\nlKH/Gzr30iWmrlpF+gMP6PdhrH0xQFlZEadPL6SoKIuwsBetfi7CNUhcI5yWRqNh5MiRPPPMMwQH\nB+Pmpv11tmdJZVWmDB9OePKH0LgEDmvXdw1fsQJVVFRugoeqYxxPzxbExGzn3LkVnDz5mk3GLZyf\nXMkLp+WI5ZSGbYazv80mIyEDgD/HdWPRGJi8+xdKl5bSsecmJo8dy+tVZPIV2xfreHoGEROTRGpq\nH0BDaOg/LH8SwqVIdY1wao7QgrgqaRPSiFweWe65Xbtg7Fg4dAg0mrq1LwYoLDxNamo/wsMXSF96\nF2WpuVMmeeESHLGcMjUulZjkmArjhHbt4IsvICbmj3JLw8gmaMkSuH6dLIPulsbKLYuKLuDh0RSN\nxt36JyNszlJzp8Q1wuXYugVxVbzDvCs9p9HA/ffDf/6jneTr0r5Yx9PTPh8uC+cik7xweo6UzRtm\n8lkfZ+knesOqm9GjYcQIeOUVcHOrWftiqDqnF8IUmeSF0zNVTmnrmnndZJ6dnE0YYfoSSkMxMdCo\nEfzwA9xxR+V9GGtfDNpyy/gpU0zW05eU5OLu3hiNRmOJ0xEuQEoohUtwtBbEuqt5YzQaeOgh+PRT\n46/XZZlBnfT0Zzhy5EmUcrwyUmEfciUvXIYjtSAGTC4S8sAD0KULvPUWNKzQSdicnD48fD779g0l\nLe1hIiM/ki6Wou7VNZ9//jkJCQmkpaXx66+/0q1bN+MHkOoaYQOmcvmoqChiY2OtHtkY5vEZszMI\nmxUGlM/jDQ0apC2nHDeu+n3HTZvGt8OHV3q+y/LltPL1LRfh3NWnB/v3j8DNrSFRUatwc6v8AbBw\nfHavrunSpQtffPEFjz/+uNmDEMJcjtDmoKqWBlX5619h0aKaTfJV5fRHT59m38yZ+sfpK1eyCBgU\nt4GDBx9k376hdO78pSw8Uo/VOZOPjIykQ4cOlhyLEGZxpjYHAEOHam+KOny4+m2N5fQNFy4kf1j5\nG6F0LRHc3DyJilpFYOCDuLl5WXLYwsnYJLBLSEjQfx0XF0dcXJwtDivqGXuXUlbV0qCquMbTE8aP\nhw8+gPnzTe/bWE5/2tub/dHRlbbVlVpqNO4EBU2o28kIm0tOTrbKjXsmM/kBAwaQlZVV6fm5c+cy\n7MYVRN++fVmwYIFk8sIhVNXmwFa5PPwx2VcX1wAcOwaxsXDyZOUPYKtT15YIwjnYJJPftm2b2QcQ\nwpZ0pZQjR45k3bp1PP/886Snp9u0/bCp8smK2rWD22+H1avh4Ydrd5wpw4eTvnJlpZYIZ69fJ2Xi\nRP1zFVsXK6Wkjr4esUhcI1fqwpE4QimlqfLJip58EmbNggkTtDX0NVWXUkulytizZwBt284kIKBv\nzQ8mnFadJ/kvvviCKVOmcPHiRYYMGULXrl3ZvHmzJccmRK3ZK5evVD5JGNnJ2VXm8YbuugumTIGf\nf4aePWt33Nq2RNBo3GjbdiYHDvyF9u3/TcuW99fugMLpSBdK4XLsmcvXJo83tGgR/PijtnGZOWqa\n008b3gX/hrNp0+ZZQkImm3dQYRWykLcQVbBni4Pa5PGGHnkEtm+HEyfMO35NWyJMXrWTK/n/4uzZ\ndzh27Dm5EHNhcs+zcEn2zOVrk8frNGmizeT//W94/fW6H7s2Of1biYl8+foPZGVV0URHuASZ5IXL\nsXUub04eb2jKFOjWDWbOBD+/uo+nNjm9h0dz2rT5W90PJhyeZPLCJdkrlze25F9tPPCAthXx9OmW\nG5PU0zsnyeSFMMFeuXxBhnlLe0yfDgsXQmGhhQZE3VoXy4WZ65C4Rrgse+Tyxpb8q42YGOjUCVau\n1H4Yawm1racf3PcOdu/uw003/ZOAALmyd3YS1wiXZCqXDwoKIjMz02LH0mXyBRkFZH2cVW2L4ep8\n8w08/jgcPAjuVlqju7rWxa1anmXUbZto4DmZ+H6vWWcQwiSJa4QwQdd6eOnSpcTGxuLl9Ucnxvz8\nfIseyz/On7CEMLzDvAmbpV3yLywhrE4TPEBcHDRvDuvWWXSY5ZhqXbx1xAg+7vU0T3q/x9Vr77H1\nm/FyoebEZJIX9YIzTVIaDTz/PMydC9Yadk1aF5+kLY83Wc7F7P+RljZelhR0UpLJC5dkKq7x9rbc\nSkkVyyeDxgeRkZBR56hGZ8gQbSnll1/C3XdbarQG+69h6+IrNGXZDyPp96ceaDRyTeiMJJMXLsuW\nZZR1bWdgyrp1MG8e/Ppr7RqX1ZWUWjoWyeSFqIYtyyjr2s7AlHvv1ZZSbtpk8V0bVZdSS+H4JK4R\nLs2WZZTmxDPGuLnBSy/B7NkweLD1r+ZrW2oZf8etNGhgxq25wiZkkhcuy9rtDSzVzsCUkSPh5Ze1\nV/NDhlhklybVvCWCYt++Yfj7xxEWliB5vQOTn4xwWRXLKH18fPSvXbhwgUfMvNtIVzrpH+dvkdJJ\nY9zctFfyL71kvUobU6oqtcy9dJmXP+vA9ykf8v7Km9mYZKNMSdSaTPLCpdkil7dGHm/o3nu1E3xi\nolUPY5SpnD5xyIM82mw5p0PCOH95ApuSPrf9AEW1JK4RLs8Wubyl83hDGo32av755+Gee7RX97ZS\nXU5fjCdzeZ4Hm6/gvusTKSm5iwYNmthugKJaUkIpXJq12htYupVBdZTSLg04eTKMHWvx3ddKVS0R\n7vxiIW4qVEotLcRSc6dcyQuXpsvlBw8ezPz580lNTaXwRotHc9ob6CbzjIQMfR5vTRqN9g7Yv/4V\nRo0CDw+rHs6kqnL6H/fnkT/zjzr79Bsxj0z09iWZvKhXnPmvyr594aabwIpL1NZITVoiwI1Syw0b\nbDk0YYRcyQuXZo32BtZqZVATc+dqP4gdNw4MioVsqqYtEQAC/M5RWJiJl1cr2w5S6EkmL1yetdob\nWKOVQU2MGgW33grPPWfTw5pUVUuEqT9Pp190Gqt3DuXS5RaS09eCtDUQooasVUZp7dLJqsyZAwsW\nwOXLdjm8UVWVWq7ZGcJ8n+ncH7eZ4hH+0hLBDiSuEfWCtcoorR3PGNOhA9x3nza6mT/f5oc3ylSp\nZRZwltb8kxfZ/kB/3k5cL1fzNiSTvHB5lmxvYItWBjUxa5Z2mcCnn4awMJsd1iRTLRHSieBJ3mUW\ns8kPqPtC56L2JJMX9UJVuXxda+Xtlccbmj0bDh/WrgfriIzn9IpuHy2V1sU1IJm8ELWgy+V/+ukn\nJk2aROPGjYG618rbK4839MwzkJwMu3bZeyTGGc/pP5TWxTYmcY2oFwwz+b179+qv5M1ZJcoeebyh\nxo0hIQH+7/+0i3/bYmGR2qht62K5mreOOk/y06dP56uvvsLT05Pw8HCWLVuGn5/0lhaOx1QmHxlZ\n83zYUfJ4Qw8/DG+9BevXg5FOA3ZXk9bFndlHfNdtlJbm4+7e0JbDqxfqnMlv27aN/v374+bmxnM3\nCnZfffXVygeQTF44AEtm8o6QxxvauhWeegr27wdPT3uPxjRjOb03+cxNn0Rg03xW7xxK4bVGktPj\nAJn8gAEDcLvRDi82NpbTp0+bPRghrMWSmbwj5PGGBg6E9u3hnXfsPZLqGcvp/Zes4F9fxfBlwHAe\nil/P2RHtJae3IItk8kuXLmXMmDGW2JUQVmHpTN7eeXxF8+dDnz7adgfNm9t7NFWrOqefxmognXBm\nM4sPHniMtxM31PureUswGdcMGDCArKysSs/PnTuXYTeaEc2ZM4eUlBTWrVtn/AAaDbNmzdI/jouL\nIy4uzsxhC1FzpjL5mrY2sHVr4bp4+mltS2JnuKI3VLF1cWvO0IxLsDyFVr6+9abUMjk5meTkZP3j\n2bNnWySuMatOfvny5SxZsoTt27dXeUUkmbxwBFVl8m5ubvTu3bvcPy5TMhIyABwmjzd06RJ07Ajb\nt0OXLvYeTc1V1fem4SuvkD9zpv5x+MqVLBozxqUnekN2z+S3bNnC66+/zvr1680qQxPCFjQaDSNH\njuSZZ54hODhY/3mSNVaJspdmzeDFF+Fvf7PPerB1Ja2LravOmfzkyZMpKipiwIABAPzpT3/i3Xff\ntdjAhLAkc1ob2LO1cG098QS8/752Pdh777X3aGqmpq2L23OYApzo/14OQtoaiHrD3DJKRyudrMrX\nX8Njj2lLKhs6adl5xQinAcW8y5NkHy4j+UA81/B0+Zze7nGNEM7G3DJKRyudrMqdd0LXro7TobIu\nKkY4JXgwZ1k3ilQhdw/fTtrwHtISoYakrYGoNyxRRulo8UxVFizQLiwyfjyEhtp7NLVntNSyAGbe\n/Cmj+Jx3eZJXmMluaYlQLZnkRb1Q19YGjtjKoCbCwmDyZG0Ts88/t/do6sZ4SwQNn3M/R4lgEu/x\nNP+mwH5DdAqSyYt6w5xM3lnyeEP5+dqe84sXw436CKdWMafXUIbCjW4ffeSSrYslkxeilszJ5J0l\njzfUsCEsXKi9Saqw0N6jMV/FnF7hRtCSJdK6uBpyJS/qjaoy+cDAQKN3dhty1JLJ6igFw4ZBr16O\ntfB3XW1MSuLtDRv+yOkzM9k9aZLBFgrQEJ+YyJaFC+0zSAux1Nwpk7yoF+rS2iA7OZus5Vl4h3lr\n83gHbGVQE+npEBsLv/0GbdvaezSWVbElwij+Q1Mu88vHngQ28XfqCMdSc6d88CrqBY1Gw0cffcTg\nwYMrZfJpaWm0aNGi0nv84/zL5fDOlMcbCg+HqVNh2jT44gt7j8ayvCrcsfw/4nmBOUTFHSGh7Udc\noSkA6TdiHmeb6C1BMnlRb9SH1gZVmT5de3PUxo32HollVczpr+LHy4tasdsrlsU8Tmf2AfW7JYJc\nyYt6o6atDSqWTQIUZBToSyedkbc3/Pvf2rYHffuCj4+9R2QZRlsieDVkedDfOMgvzGYWC5nG99xR\nb0stJZMX9UptyiidsWyyOqNHQ7t2MHeuvUdiPYallkFkUogXV2jqdKWWUkIpRB3UpozSGcsmq/Pm\nm7BkiTa6cVWGEU4WrbhC03pdailxjahXatvawFnjmaq0agUJCTBpEiQng5sLXuZVvfrU1HLbpdeT\nlggyyYt6oyatDZy1jUFtPPEEfPIJLFsGEyfaezTWYbwlgpYbpdzDer5iaL3I6SWTF/VKTTN5V8zj\nDe3Zo2118Pvv0LKlvUdjfYY5vTf5PM9cmnGJ/66+GXfPNg6Z00smL0Qd1DSTd8U83lB0NEyYoF1F\nqj4wzOkLaMhLvEzKL948PWwzV0aEuHROL3GNqFdqk8m7SjxTlVmztGvB/u9/EB9v79FYl7GcPiWz\nPTt7TOBF/slmBvEx410yp5dJXtQb1WXy9SGPN9SoEbz3njaj//137WNXZiyn/5ZbeJzFjGSd/nlX\ny+klkxf1SnWZvG5Sz0jIcNk8vqJx47S5/IIF9h6JbVVsXazjKPX0kskLUQfVZfKunsUb8+absHIl\n/PqrvUdiWxVbIgAuWU8vcY2oV2qaybtiPFOV5s21V/ETJ8KuXeDpae8R2UZ19fQBXKYUd6fP6SWu\nEfWGqUy+ReMWfDfyO7I+znLalsLmUAqGDIGePWHmTHuPxn4MWxcP4SseZAUv8xINlu+kla+vTSMc\naTUsRC1VbDecmppK4Y0lk4rci/AO8yZsVli9yeINaTTaZQK7dYMRIyAqyt4jsg/D1sUbGcoVApjD\nC3zeugWrBi4GNIBztS6WTF7UW/IXZnlt2sDLL2tjm9JSe4/GPirm9D/xZ/6+9DZ69yrkZV6iMdq/\nAJ2pdbFM8qLe0MU1jzzyCDt27KCoqEj/mkeJBxmzMyjIKCAjIaNefgAL8Pjj2kz+rbfsPRL7GNKv\nH4vGjCE+MZE+iYnEJybSqKgZU32WcJ6WDGKzfltnKbWUTF7UK6ZKKH9+/Od6GdVUdPQo9OgBv/wC\nERH2Ho39lS+11K4hC9YvtZQSSiHqoDathuuriAh44QVtbFMPFs2qVvkIRzvBO1OppVzJi3qlqhLK\nwMBA0lan1ZtqmuqUlkLv3jB2LDz9tL1HY38bk5J4e8OGP0otMzPZPWkSAJ4UUoQXAPGJiWxZuNAi\nx7T7lfyLL75IdHQ0MTEx9O/fn1OnTpk9GGeUnJxs7yFYlSudn2Em/8svv+gneIAw77BybQ1cgTk/\nO3d3WLpU23v+2DGLDcmibPm7OaRfP7YsXEjywoVsWbgQ31atANBQxjs8xX18DiiHzOnrPMn/4x//\nYM+ePaSmpjJ8+HBmz55tyXE5DVeaBI1xpfPTlVAuXbqU2NhYPNw99K+dKDxBWEKYS13Jm/uzi4yE\nGTPg4YcdM7ax5++mrtRS4cZMXqEv3zCHFyjNO0v8lCnETZtG/JQpDhHf1HmSb9Kkif7rvLw8mjdv\nbpEBCWFNhpl8l1ZdJJOvxrRpUFIC77xj75E4FsOc/hxBTGURl/deYerdX3F2RHuHyunNuhnqhRde\n4NNPP8XHx4dffvnFUmMSwmrKZfJn91JSVgJUvfxffefurl1BqmdPGDwYwsPtPSLHYKwlQlLmLfx4\ny0PMYjZP8i4XaOkQLRFMfvA6YMAAsrKyKj0/d+5chg0bpn/86quvcujQIZYtW1b5ABqNhYYqhBD1\niyU+eLVIdc3JkycZPHgwv//+u9kDEkIIYTl1zuSPHDmi/3r9+vV07drVIgMSQghhOXW+kr/vvvs4\ndOgQ7u7uhIeH895779GyPqwILIQQTqTOV/Jr165l+PDhKKVIT09nzJgx5Wrl582bR/v27YmMjGTr\n1q3653/77Te6dOlC+/btmXqjbzNAYWEhf/nLX2jfvj09evTgxIkTdR2axUyfPp2OHTsSHR3NiBEj\nyMnJ0b/mCuf3+eef06lTJ9zd3UlJSSn3miucnylbtmwhMjKS9u3b89prr9l7ODXyyCOPEBgYSJcu\nXfTPXb58mQEDBtChQwcGDhxIdvYfdf61/Rna26lTp+jbty+dOnWic+fOvHWjgY6rnGNBQQGxsbHE\nxMQQFRXFjBkzABucnzLD1atX9V+/9dZbauLEiUoppfbv36+io6NVUVGROn78uAoPD1dlZWVKKaW6\nd++uduzYoZRSatCgQWrz5s1KKaXeeecdNWnSJKWUUqtXr1Z/+ctfzBmaRWzdulWVlpYqpZR69tln\n1bPPPquUcp3zO3jwoDp06JCKi4tTv/32m/55Vzm/qpSUlKjw8HB1/PhxVVRUpKKjo9WBAwfsPaxq\nfbAuLEcAAARPSURBVPfddyolJUV17txZ/9z06dPVa6+9ppRS6tVXXzXrd9TeMjMz1e7du5VSSuXm\n5qoOHTqoAwcOuNQ5Xrt2TSmlVHFxsYqNjVXff/+91c/PrN41VdXKr1+/njFjxuDh4UFYWBgRERHs\n2LGDzMxMcnNzuf322wF46KGHSExMBGDDhg2MHz8egJEjR7J9+3ZzhmYRAwYMwM1N+y2KjY3l9OnT\ngOucX2RkJB06dKj0vKucX1V27txJREQEYWFheHh4MHr0aNavX2/vYVWrd+/eBAQElHvO8Ps+fvx4\n/c+jLj9DewsKCiImJgaAxo0b07FjR86cOeNS5+jj4wNAUVERpaWlBAQEWP38zG5Q9sILLxAaGsry\n5cv1f36cPXuWkJAQ/TYhISGcOXOm0vPBwcGcOXMGgDNnztCmTRsAGjRogJ+fH5cvXzZ3eBazdOlS\nBg8eDLjm+Rly9fMzHCv8cX7O6Ny5cwQGBgLa/jvnzp0D6vYzdCQZGRns3r2b2NhYlzrHsrIyYmJi\nCAwM1EdT1j6/am+Gqq5Wfs6cOcyZM4dXX32VadOmGa2Vd2Q1uRdgzpw5eHp6MnbsWFsPz2w1vdeh\nPnHVezc0Go1LnFteXh4jR45k0aJF5dICcP5zdHNzIzU1lZycHOLj4/nmm2/KvW6N86t2kt+2bVuN\ndjR27Fj9lW5wcHC5D2FPnz5NSEgIwcHB+sjD8Hnde06ePEnr1q0pKSkhJyeHpk2b1upk6qK681u+\nfDmbNm0qFz+40vkZ40znVxcVz+/UqVPlroycSWBgIFlZWQQFBZGZmamvcKvNzzA4ONjm465KcXEx\nI0eOZNy4cQy/sdaqq50jgJ+fH0OGDOG3336z+vmZFddUVSt/9913s3r1aoqKijh+/DhHjhzh9ttv\nJygoCF9fX3bs2IFSik8//ZR77rlH/56PP/4Y0Fbu9O/f35yhWcSWLVt4/fXXWb9+fbnb3l3l/Awp\ng0paVzw/Q7fddhtHjhwhIyODoqIi1qxZw913323vYdWJ4ff9448/1k+MtfkZ6t5jb+pGl9CoqCim\nTZumf95VzvHixYv6ypn8/Hy2bdtG165drX9+5nxSPHLkSNW5c2cVHR2tRowYoc6dO6d/bc6cOSo8\nPFzdfPPNasuWLfrnd+3apTp37qzCw8PV5MmT9c8XFBSoUaNGqYiICBUbG6uOHz9uztAsIiIiQoWG\nhqqYmBgVExOjrx5RyjXO77///a8KCQlR3t7eKjAwUN11113611zh/EzZtGmT6tChgwoPD1dz5861\n93BqZPTo0apVq1bKw8NDhYSEqKVLl6pLly6p/v37q/bt26sBAwaoK1eu6Lev7c/Q3r7//nul0WhU\ndHS0/t/c5s2bXeYc9+7dq7p27aqio6NVly5d1L/+9S+llLL6+Vl90RAhhBD2I8v/CSGEC5NJXggh\nXJhM8kII4cJkkhdCCBcmk7wQQrgwmeSFEMKF/T+EGvw6HyMN5gAAAABJRU5ErkJggg==\n", - "text": [ - "" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.4, page no. 570" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "maximum tensile stress, maximum compressive stress, and maximum shear stress in the shaft.\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d = 0.05 # Diameter of shaft in m\n", - "T = 2400 # Torque transmitted by the shaft in N-m\n", - "P = 125000 # Tensile force\n", - "\n", - "#calculation\n", - "s0 = (4*P)/(math.pi*d**2) # Tensile stress in\n", - "t0 = (16*T)/(math.pi*d**3) # Shear force \n", - "# Stresses along x and y direction\n", - "sx = 0 \n", - "sy = s0 \n", - "txy = -t0 \n", - "s1 = (sx+sy)/2.0 + math.sqrt(((sx-sy)/2.0)**2 + (txy)**2) # Maximum tensile stress \n", - "s2 = (sx+sy)/2.0 - math.sqrt(((sx-sy)/2.0)**2 + (txy)**2) # Maximum compressive stress \n", - "tmax = math.sqrt(((sx-sy)/2)**2 + (txy)**2) # Maximum in plane shear stress \n", - "print \"Maximum tensile stress %e\" %s1, \"Pa\"\n", - "print \"Maximum compressive stress %e\" %s2, \"Pa\"\n", - "print \"Maximum in plane shear stress %e \" %tmax, \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum tensile stress 1.346662e+08 Pa\n", - "Maximum compressive stress -7.100421e+07 Pa\n", - "Maximum in plane shear stress 1.028352e+08 Pa\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.5, page no. 573" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate maximum allowable internal pressure\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "\n", - "#initialisation\n", - "P = 12 # Axial load in K\n", - "r = 2.1 # Inner radius of the cylinder in inch\n", - "t = 0.15 # Thickness of the cylinder in inch\n", - "ta = 6500 # Allowable shear stress in Psi\n", - "\n", - "#calculation\n", - "p1 = (ta - 3032)/3.5 # allowable internal pressure\n", - "p2 = (ta + 3032)/3.5 # allowable internal pressure\n", - "p3 = 6500/7.0 # allowable internal pressure\n", - "\n", - "prs_allowable = min(p1,p2,p3) # Minimum pressure would govern the design\n", - "print \"Maximum allowable internal pressure \", round(prs_allowable), \"psi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum allowable internal pressure 929.0 psi\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.6, page no. 574" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "principal stresses and maximum shear stresses\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d1 = 0.18 # Inner diameter of circular pole in m\n", - "d2 = 0.22 # Outer diameter of circular pole in m\n", - "P = 2000 # Pressure of wind in Pa\n", - "b = 1.5 # Distance between centre line of pole and board in m\n", - "h = 6.6 # Distance between centre line of board and bottom of the ploe in m\n", - "\n", - "#calculation\n", - "W = P*(2*1.2) # Force at the midpoint of sign \n", - "V = W # Load\n", - "T = W*b # Torque acting on the pole\n", - "M = W*h # Moment at the bottom of the pole\n", - "I = (math.pi/64.0)*(d2**4-d1**4) # Momet of inertia of cross section of the pole\n", - "sa = (M*d2)/(2*I) # Tensile stress at A \n", - "Ip = (math.pi/32.0)*(d2**4-d1**4) # Polar momet of inertia of cross section of the pole\n", - "t1 = (T*d2)/(2*Ip) # Shear stress at A and B\n", - "r1 = d1/2.0 # Inner radius of circular pole in m\n", - "r2 = d2/2.0 # Outer radius of circular pole in m\n", - "A = math.pi*(r2**2-r1**2) # Area of the cross section\n", - "t2 = ((4*V)/(3*A))*((r2**2 + r1*r2 +r1**2)/(r2**2+r1**2)) # Shear stress at point B \n", - "\n", - "# Principle stresses \n", - "sxa = 0\n", - "sya = sa\n", - "txya = t1\n", - "sxb = 0\n", - "syb = 0\n", - "txyb = t1+t2 \n", - "\n", - "# Stresses at A\n", - "s1a = (sxa+sya)/2.0 + math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum tensile stress \n", - "s2a = (sxa+sya)/2.0 - math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum compressive stress \n", - "tmaxa = math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum in plane shear stress\n", - "\n", - "print \"Maximum tensile stress at point A is\", s1a, \"Pa\"\n", - "print \"Maximum compressive stress at point A is\", s2a, \"Pa\"\n", - "print \"Maximum in plane shear stress at point A is\", tmaxa, \"Pa\"\n", - "\n", - "# Stress at B \n", - "s1b = (sxb+syb)/2.0 + math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum tensile stress \n", - "s2b = (sxb+syb)/2.0 - math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum compressive stress \n", - "tmaxb = math.sqrt(((sxb-syb)/2.0)**2 + (txyb)**2) # Maximum in plane shear stress \n", - "print \"Maximum tensile stress at point B is\", s1b, \"Pa\"\n", - "print \"Maximum compressive stress at point B is\", s2b, \"Pa\"\n", - "print \"Maximum in plane shear stress at point B is\", tmaxb, \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum tensile stress at point A is 55613361.197 Pa\n", - "Maximum compressive stress at point A is -700178.455718 Pa\n", - "Maximum in plane shear stress at point A is 28156769.8263 Pa\n", - "Maximum tensile stress at point B is 6999035.59641 Pa\n", - "Maximum compressive stress at point B is -6999035.59641 Pa\n", - "Maximum in plane shear stress at point B is 6999035.59641 Pa\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.7, page no. 578" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "principal stresses and maximum shear stresses at points & at the base of the post\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "b = 6 # Outer dimension of the pole in inch\n", - "t = 0.5 # thickness of the pole\n", - "P1 = 20*(6.75*24) # Load acting at the midpoint of the platform\n", - "d = 9 # Distance between longitudinal axis of the post and midpoint of platform\n", - "P2 = 800 # Load in lb\n", - "h = 52 # Distance between base and point of action of P2\n", - "\n", - "#calculation\n", - "M1 = P1*d # Moment due to P1\n", - "M2 = P2*h # Moment due to P2\n", - "A = b**2 - (b-2*t)**2 # Area of the cross section\n", - "sp1 = P1/A # Comoressive stress due to P1 at A and B\n", - "I = (1.0/12.0)*(b**4 - (b-2*t)**4) # Moment of inertia of the cross section\n", - "sm1 = (M1*b)/(2*I) # Comoressive stress due to M1 at A and B\n", - "Aweb = (2*t)*(b-(2*t)) # Area of the web\n", - "tp2 = P2/Aweb # Shear stress at point B by lpad P2\n", - "sm2 = (M2*b)/(2*I) # Comoressive stress due to M2 at A \n", - "sa = sp1+sm1+sm2 # Total Compressive stress at point A\n", - "sb = sp1+sm1 # Total compressive at point B \n", - "tb = tp2 # Shear stress at point B\n", - "\n", - "# Principle stresses \n", - "sxa = 0\n", - "sya = -sa\n", - "txya = 0\n", - "sxb = 0\n", - "syb = -sb\n", - "txyb = tp2 \n", - "\n", - "# Stresses at A\n", - "s1a = (sxa+sya)/2 + math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum tensile stress \n", - "s2a = (sxa+sya)/2 - math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum compressive stress \n", - "tmaxa = math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum in plane shear stress\n", - "print \"Maximum tensile stress at point A is\", s1a,\"Psi\"\n", - "print \"Maximum compressive stress at point A is\", round(s2a,2), \"Psi\"\n", - "print \"Maximum in plane shear stress at point A is\", round(tmaxa,2), \"Psi\"\n", - "\n", - "# Stress at B \n", - "s1b = (sxb+syb)/2 + math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum tensile stress \n", - "s2b = (sxb+syb)/2 - math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum compressive stress \n", - "tmaxb = math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum in plane shear stress\n", - "print \"Maximum tensile stress at point B is\", round(s1b,2), \"Psi\"\n", - "print \"Maximum compressive stress at point B is\", round(s2b,2), \"Psi\"\n", - "print \"Maximum in plane shear stress at point B is\", round(tmaxb,2), \"Psi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum tensile stress at point A is 0.0 Psi\n", - "Maximum compressive stress at point A is -4090.91 Psi\n", - "Maximum in plane shear stress at point A is 2045.45 Psi\n", - "Maximum tensile stress at point B is 13.67 Psi\n", - "Maximum compressive stress at point B is -1872.69 Psi\n", - "Maximum in plane shear stress at point B is 943.18 Psi\n" - ] - } - ], - "prompt_number": 5 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Testing_the_interface/chapter8_3.ipynb b/Testing_the_interface/chapter8_3.ipynb deleted file mode 100755 index 2e7289e4..00000000 --- a/Testing_the_interface/chapter8_3.ipynb +++ /dev/null @@ -1,524 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 8: Applications of Plane Stress Pressure Vessels Beams and Combined Loadings" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.1, page no. 546" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "finding max. permissible pressures at various conditions\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d = 18 # inner idameter of the hemisphere in inch\n", - "t = 1.0/4.0 # thickness of the hemisphere in inch\n", - "\n", - "\n", - "#calculation\n", - "# Part (a)\n", - "sa = 14000 # Allowable tensile stress in Psi\n", - "Pa = (2*t*sa)/(d/2.0) # Maximum permissible air pressure in Psi\n", - "print \"Maximum permissible air pressure in the tank (Part(a)) is\", round(Pa,1), \"psi\"\n", - "\n", - "# Part (b)\n", - "sb = 6000 # Allowable shear stress in Psi\n", - "Pb = (4*t*sb)/(d/2.0) # Maximum permissible air pressure in Psi\n", - "print \"Maximum permissible air pressure in the tank (Part(b)) is\", round(Pb,1), \"psi\"\n", - "\n", - "# Part (c)\n", - "e = 0.0003 # Allowable Strain in Outer sufrface of the hemisphere\n", - "E = 29e06 # Modulus of epasticity of the steel in Psi\n", - "v = 0.28 # Poissions's ratio of the steel\n", - "Pc = (2*t*E*e)/((d/2.0)*(1-v)) # Maximum permissible air pressure in Psi\n", - "print \"Maximum permissible air pressure in the tank (Part(c)) is\", round(Pc,1), \"psi\"\n", - "\n", - "# Part (d)\n", - "Tf = 8100 # failure tensile load in lb/in \n", - "n = 2.5 # Required factor of safetty against failure of the weld\n", - "Ta = Tf / n # Allowable load in ld/in \n", - "sd = (Ta*(1))/(t*(1)) # Allowable tensile stress in Psi\n", - "Pd = (2*t*sd)/(d/2.0) # Maximum permissible air pressure in Psi\n", - "print \"Maximum permissible air pressure in the tank (Part(d)) is\", round(Pd,1), \"psi\"\n", - "\n", - "# Part (e)\n", - "Pallow = Pb \n", - "print \"Maximum permissible air pressure in the tank (Part(e)) is\", round(Pb,1) ,\"psi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum permissible air pressure in the tank (Part(a)) is 777.8 psi\n", - "Maximum permissible air pressure in the tank (Part(b)) is 666.7 psi\n", - "Maximum permissible air pressure in the tank (Part(c)) is 671.3 psi\n", - "Maximum permissible air pressure in the tank (Part(d)) is 720.0 psi\n", - "Maximum permissible air pressure in the tank (Part(e)) is 666.7 psi\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.2, page no. 552" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculating various quantities for cylindrical part of vessel\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "a = 55 # Angle made by helix with longitudinal axis in degree\n", - "r = 1.8 # Inner radius of vessel in m\n", - "t = 0.02 # thickness of vessel in m\n", - "E = 200e09 # Modulus of ealsticity of steel in Pa\n", - "v = 0.3 # Poission's ratio of steel \n", - "P = 800e03 # Pressure inside the tank in Pa\n", - "\n", - "\n", - "#calculation\n", - "# Part (a)\n", - "s1 = (P*r)/t # Circumferential stress in Pa\n", - "s2 = (P*r)/(2*t) # Longitudinal stress in Pa\n", - "\n", - "print \"Circumferential stress is \", s1, \"Pa\"\n", - "print \"Longitudinal stress is \", s2, \"Pa\"\n", - "\n", - "# Part (b)\n", - "t_max_z = (s1-s2)/2.0 # Maximum inplane shear stress in Pa\n", - "t_max = s1/2.0 # Maximum out of plane shear stress in Pa\n", - "\n", - "print \"Maximum inplane shear stress is \", t_max_z, \"Pa\"\n", - "print \"Maximum inplane shear stress is \", t_max, \"Pa\"\n", - "\n", - "# Part (c)\n", - "e1 = (s1/(2*E))*(2-v) # Strain in circumferential direction \n", - "e2 = (s2/E)*(1-(2*v)) # Strain in longitudinal direction\n", - "\n", - "print \"Strain in circumferential direction is %e\"%(e1)\n", - "print \"Strain in longitudinal direction is \", e2\n", - "\n", - "# Part (d)\n", - "# x1 is the direction along the helix\n", - "theta = 90 - a \n", - "sx1 = ((P*r)/(4*t))*(3-math.cos(math.radians(2*theta))) # Stress along x1 direction\n", - "tx1y1 = ((P*r)/(4*t))*(math.sin(math.radians(2*theta))) # Shear stress in x1y1 plane\n", - "sy1 = s1+s2-sx1 # Stress along y1 direction\n", - "\n", - "print \"Stress along y1 direction is \", sy1\n", - "\n", - "# Mohr Circle Method\n", - "savg = (s1+s2)/2.0 # Average stress in Pa\n", - "R = (s1 - s2 )/2.0 # Radius of Mohr's Circle in Pa\n", - "sx1_ = savg - R*math.cos(math.radians(2*theta)) # Stress along x1 direction\n", - "tx1y1_ = R*math.sin(math.radians(2*theta)) # Shear stress in x1y1 plane\n", - "print \"Stress along x1 direction is \", sx1_, \"Pa\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Circumferential stress is 72000000.0 Pa\n", - "Longitudinal stress is 36000000.0 Pa\n", - "Maximum inplane shear stress is 18000000.0 Pa\n", - "Maximum inplane shear stress is 36000000.0 Pa\n", - "Strain in circumferential direction is 3.060000e-04\n", - "Strain in longitudinal direction is 7.2e-05\n", - "Stress along y1 direction is 60156362.5799\n", - "Stress along x1 direction is 47843637.4201 Pa\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.3, page no. 562" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "principal stresses and maximum shear stresses at cross section\n", - "\"\"\"\n", - "\n", - "%pylab inline\n", - "from matplotlib import *\n", - "from pylab import *\n", - "import numpy\n", - "\n", - "#initialisation\n", - "L = 6.0 # Span of the beam in ft\n", - "P = 10800 # Pressure acting in lb\n", - "c = 2.0 # in ft\n", - "b = 2.0 # Width of cross section of the beam in inch\n", - "h = 6.0 # Height of the cross section of the beam in inch\n", - "x = 9.0 # in inch\n", - "\n", - "#calculation\n", - "Ra = P/3.0 # Reaction at point at A\n", - "V = Ra # Shear force at section mn \n", - "M = Ra*x # Bending moment at the section mn\n", - "I = (b*h**3)/12.0 # Moment of inertia in in4\n", - "y = linspace(-3, 3, 61)\n", - "sx = -(M/I)*y # Normal stress on crossection mn\n", - "Q = (b*(h/2-y))*(y+((((h/2.0)-y)/2.0))) # First moment of recmath.tangular cross section\n", - "txy = (V*Q)/(I*b) # Shear stress acting on x face of the stress element\n", - "s1 = (sx/2.0)+numpy.sqrt((sx/2.0)**2+(txy)**2) # Principal Tesile stress on the cross section\n", - "s2 = (sx/2.0)-numpy.sqrt((sx/2.0)**2+(txy)**2) # Principal Compressive stress on the cross section\n", - "tmax = numpy.sqrt((sx/2)**2+(txy)**2) # Maximum shear stress on the cross section\n", - "plot(sx,y,'o',color='c')\n", - "plot(txy,y,'+',color='m')\n", - "plot(s1,y,'--',color='y')\n", - "plot(s2,y,'<',color='k')\n", - "plot(tmax,y,label=\"Maximum shear stress on cross section\")\n", - "legend()\n", - "show()\n", - "#print \"Principal Tesile stress on the cross section\", s1, \"psi\"\n", - "#print \"Principal Compressive stress on the cross section\", s2, \"psi\"\n", - "\n", - "# Conclusions \n", - "s1_max = 14400.0 # Maximum tensile stress in Psi\n", - "txy_max = 900.0 # Maximum shear stress in Psi\n", - "t_max = 14400.0/2.0 # Largest shear stress at 45 degree plane" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Populating the interactive namespace from numpy and matplotlib\n" - ] - }, - { - "output_type": "stream", - "stream": "stderr", - "text": [ - "WARNING: pylab import has clobbered these variables: ['power', 'random', 'fft', 'load', 'save', 'linalg', 'info']\n", - "`%pylab --no-import-all` prevents importing * from pylab and numpy\n" - ] - }, - { - "metadata": {}, - "output_type": "display_data", - "png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAD9CAYAAABZVQdHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVPX+x/HXgCyisriBgkiChqiBluH1aqKm5Fam2VXL\ntOxWVi739vOWZYnd1Lppad0Ws9RKU296Q8vlahLtaYaoqbiguII7CMrO9/fHONMAw7DMPnyej0eP\nBzNz5pzvAfx2eM/nfL4apZRCCCGES3Kz9wCEEEJYj0zyQgjhwmSSF0IIFyaTvBBCuDCZ5IUQwoXJ\nJC+EEC7MrEm+oKCA2NhYYmJiiIqKYsaMGZYalxBCCAvQmFsnf/36dXx8fCgpKaFXr17Mnz+fXr16\nWWp8QgghzGB2XOPj4wNAUVERpaWlNG3a1OxBCSGEsAyzJ/mysjJiYmIIDAykb9++REVFWWJcQggh\nLKCBuTtwc3MjNTWVnJwc4uPjSU5OJi4uTv+6RqMx9xBCCFEvWaLrjMWqa/z8/BgyZAi7du2q9JpS\nqtb/DXj6aUhIgI4dwcvrjwH7+0NSkv41TYMGdL7lljodwxL/zZo1y27HlvMz77+pfaailOL4rON2\nH4uj/ux+/VXRsqXi7Fn7n481zs+R/7MUsyb5ixcvkp2dDUB+fj7btm2ja9euFhnY1HvvJfz0aXjn\nHZgxQzvZu7lR5uUFTz0F8+bBwYOokhLOXLpkkWOK+qOw8CzXAhPtPQyHVlgIEybAG29Aq1b2Ho2o\nK7PimszMTMaPH09ZWRllZWWMGzeO/v37W2RgQ/r1A+Dt9espADzvvJMfL17k+sWLcO5cuW3LLHJE\nUZ/k/HyJkgaXyEjIIGN2hv55/zh//OP87TcwB/LyyxARAWPH2nskwhxmTfJdunQhJSXFUmOpZEi/\nfvrJHmCgUmxr3hzWrIFjx7SXGkBpSQnxU6ZQ6OaGZ2kptzZrxrmTJ1m6dKnVxqZj+PmDK3LV8/P7\nUzNu/d2TsKfDAAhLCCM7OdulJnhzfna//QYffgh79oCjfqzmqr+bluZUd7wajXDc3SksKWHrvffy\nbUAA27Zv57U5c/j1t99sMiZX/0Vz1fPTaBrQtat7ueeyk7PtNBrrqOvPrqgIHn4Y5s+HoCDLjsmS\nXPV309LMvhmq2gNoNBb9EGFjUhJvb9hAAeClFId37iSjoEB7VW9wdR8QHMzl06ctcsymTZty5coV\ni+xLCCEMBQQEcPny5UrPW2rudLpJ3pBSitadO5OVkQHXr5d7zS84mGwLTfLWPAchRP1W1fxiqXnH\n7Dp5e9JoNHTp148sB8vphRDCUTj1JA/anP7YqlWkv/MOfPeddrI/fFif0+ue+/rIETrJ3bhCiHrG\nqeMaHWvn9BLXCCGsxdpxjUtM8oZM5fSNAgP58/33U6DRkH3kCC3Lyti2ZUu1+6zvk3yTJk3Yt28f\nYWFh9h5KjSQnJzNu3DhOnTpl76EIF3Ly5Ek6derE1atXLdquxdqTvFOVUNaELqfnH/+o1BIhv7CQ\nrc2a8d22bexNSuKHPXvYmJRkx9GaLywsDC8vLy5VuOu3a9euuLm5cfLkSbOPkZub6zQTvCNLSEhg\n3Lhx9h6GqKGwsDCSDOaH0NBQcnNzna4fl8tN8mCiJUJ+vr4dAoWFFAQG8vaGDfYerlk0Gg3t2rVj\n1apV+uf27dtHfn6+0/0yOhtL9xix9P4chbOel6v8Be+Sk/yQfv1YNGYM8evXc8fly7TWvVBYqM/n\ndQpsPjrLe/DBB/nkk0/0jz/++GMeeuihcr+gGzdupGvXrvj5+REaGsrs2bP1r61Zs4Z27dqRm5sL\nwObNm2nVqpX+rwM3NzeOHTsGwIQJE3jyyScZPHgwTZo0oXfv3mRlZTF16lQCAgLo2LEjqamp+n0b\nvlf3/hdffBHQxiohISG8/vrrtGzZktatW5OYmMimTZvo0KEDzZo149VXX63yvDdt2kSnTp3w9fUl\nJCSEBQsWlHv9jTfeIDAwkNatW7N8+XL984WFhfzf//0fbdu2JSgoiEmTJlFQoP1NyM7OZujQobRs\n2ZKmTZsybNgwzpw5o39vXFwcM2fO5M9//jONGjXi+PHjlcb12muvERISgq+vL5GRkSQlJbFlyxbm\nzZvHmjVraNKkib7Hk7H9paWlMWDAAJo1a0ZkZCSff/55ted88eJFhg4dSkBAAM2aNeOOO+6ocoL6\n6aef6N69O/7+/tx+++38/PPP5c7vpZdeolevXvj6+hIfH1/pr0RD69evJyYmBj8/PyIiIti6dWuV\n52XquMuXLyc8PBxfX1/atWvHZ599BsDRo0fp06cP/v7+tGjRgtGjRxsdR0FBAQ8++CDNmzcnICCA\n22+/nfPnzwOQk5PDxIkTad26NSEhIbz44ouUlf3RDGXJkiVERUXh6+tLp06d2L17N+PGjePkyZMM\nGzaMJk2aMH/+fDIyMnBzc9O/9+zZs9x99900a9aM9u3b8+GHH+r3mZCQwP3338/48ePx9fWlc+fO\n/GajGzQrUVZmg0NUq6ysTN0yaJCiY0eFl5cCtP9FR6tuDz6oBk6erO6YMkXdMmiQujM+vtL7HeEc\nqhIWFqa+/vprdfPNN6uDBw+qkpISFRISok6cOKE0Go06ceKEUkqp5ORk9fvvvyullNq7d68KDAxU\niYmJ+v088MADasKECerixYuqdevWauPGjfrXNBqNSk9PV0opNX78eNW8eXOVkpKiCgoKVL9+/VTb\ntm3Vp59+qsrKytTMmTNV3759jb5XKaUmTJigXnzxRaWUUt98841q0KCB+uc//6lKSkrUkiVLVLNm\nzdTYsWNVXl6e2r9/v2rYsKHKyMgweu5BQUHqhx9+UEoplZ2drVJSUsrtd9asWaqkpERt2rRJ+fj4\nqOzsbKWUUtOmTVP33HOPunLlisrNzVXDhg1TM2bMUEopdenSJfXf//5X5efnq9zcXDVq1Cg1fPhw\n/TH79Omj2rZtqw4cOKBKS0tVcXFxuTGlpaWpNm3aqMzMTKWUUidOnNCff0JCgho3bly57SvuLzs7\nW4WEhKjly5er0tJStXv3btW8eXN18OBBk+f83HPPqSeeeEKVlJSokpIS/TYVXbp0Sfn7+6sVK1ao\n0tJStWrVKhUQEKAuX76sH09ERIQ6cuSIys/PV3Fxceq5554zuq8dO3YoPz8/9fXXXyullDpz5oxK\nS0szel5ZWVlVHjcvL0/5+vqqw4cPK6WUysrKUvv371dKKTV69Gg1d+5cpZRShYWF6scffzQ6lvff\nf18NGzZM5efnq7KyMpWSkqKuXr2qlFJq+PDh6oknnlDXr19X58+fV7fffrtavHixUkqp//znPyo4\nOFjt2rVLKaXU0aNH9f9mwsLC1Pbt2/XHOH78uNJoNKq0tFQppVTv3r3VU089pQoLC1Vqaqpq0aKF\nSkpKUkopNWvWLOXt7a02b96sysrK1IwZM1SPHj2Mjr2q+cVS8069mOSVUuqr7dtVu4kTFQkJ+sne\no2VLFXjPPeWe8w4KUl8Z/GCVqv4cwDL/1YVukn/llVfUjBkz1ObNm9XAgQNVSUlJuUm+oqlTp6q/\n/e1v+sfZ2dkqNDRUdenSRT3xxBPltjWcqCdMmKAee+wx/Wtvv/22ioqK0j/eu3ev8vf3N/pe3ftn\nzpyplNJOxg0bNlRlZWVKKaWuXr2qNBqN2rlzp377W2+9tdz/jAyFhoaqxYsXq5ycnHLP6/ar+8eo\nlFItW7ZUO3bsUGVlZapRo0blxvTTTz+pm266yegxdu/erQICAvSP4+Li1KxZs4xuq5RSR44cUS1b\ntlRff/21KioqKvfarFmz1IMPPljuuYr7W716terdu3e5bR577DE1e/Zsk+f80ksvqXvuuUcdPXq0\nyrEppdQnn3yiYmNjyz33pz/9SS1fvlw/njlz5uhfe/fdd9Vdd91ldF+PPfaY+vvf/270tYrnZeq4\n165dU/7+/mrdunXq+vXr5bZ56KGH1GOPPaZOnz5t8ryWLl2qevbsqfbu3Vvu+aysLOXl5aXy8/P1\nz3322Wf6C5GBAweqt956y+g+TU3yJ0+eVO7u7iovL0//+owZM9SECROUUtqf9YABA/Sv6S5YjLH2\nJO+ScY0xQ/r1462xY4m/coU7Bgzglv798VKKc4cPm53TW2qaryuNRsO4ceNYuXKl0agGYMeOHfTt\n25eWLVvi7+/P4sWLy/0Z7ufnx3333cfvv//OM888Y/J4LVu21H/t7e1d7nHDhg3Jy8ur8dibNWum\n/+ygYcOGAAQGBpbb37Vr14y+d926dWzatImwsDDi4uL45Zdfyu3Xze2PX28fHx/y8vK4cOEC169f\n59ZbbyUgIICAgAAGDRrExYsXAe2axY8//jhhYWH4+fnRp08fcnJyyn0/27RpU+X5REREsHDhQhIS\nEggMDGTMmDFkZmaa/B4Y7u/EiRPs2LFDP7aAgAA+++wzzt3ovFrVOU+fPp2IiAgGDhxIeHg4r732\nmtFjnT17ltDQ0HLPtW3blrNnz+ofBxk0rDH18zx9+jTh4eE1Oi9Tx/Xx8WHNmjW8//77tG7dmqFD\nh3Lo0CEA/vWvf6GU4vbbb6dz584sW7bM6LHGjRtHfHw8o0ePJjg4mGeffZaSkhJOnDhBcXExrVq1\n0n8/n3jiCS5cuFCjc6jK2bNnadq0KY0aNdI/FxoaWi7aM/w99vHxoaCgoFxMZCv1ZpIH7US/ZeFC\nkhcu5NbAQPKzs/WTuyFnzOlDQ0Np164dmzdvZsSIEZVeHzt2LMOHD+f06dNkZ2fzxBNPlPuFS01N\nZdmyZYwdO5bJkydbbFw+Pj5cNyhlzczMtNgHwrfddhuJiYlcuHCB4cOHc//991f7nubNm9OwYUMO\nHDjAlStXuHLlCtnZ2Vy9ehWABQsWcPjwYXbu3ElOTg7ffvttpQ8Oqxv/mDFj+P777zlx4gQajYZn\nn33W5PsMnw8NDaVPnz76sV25coXc3Fzeeecdk+fcuHFj5s+fT3p6Ohs2bOCNN94oVxmiExwczIkT\nJ8o9d+LECYKDg6v71lXSpk0bjh49WuXrhudV3XEHDhzI1q1bycrKIjIykr/+9a+AdqL84IMPOHPm\nDIsXL+bJJ58s9xmPToMGDXjppZfYv38/P/30E1999RWffPIJoaGh+uoz3fczJyeHffv2VXsOpn7O\nrVu35vLly+X+B3jy5ElCQkKqfI+91KtJXkej0fDRRx/R6c47K5VZAuReukT8lCn0mTqV6MGD7TTK\n2vvoo49ISkrSXxEbysvLIyAgAE9PT3bu3Mlnn32m/yXWfWg1b948li5dypkzZ3jvvfeMHqPiXwjV\niYmJYeXKlZSWlrJlyxa+++672p+YEcXFxaxcuZKcnBzc3d1p0qQJ7u7u1b7Pzc2Nv/71r0ybNk1/\nNXfmzBn9B4Z5eXk0bNgQPz8/Ll++XO4Dah1T34PDhw+TlJREYWEhXl5eeHt768cVFBRERkZGpfcb\nPh46dCiHDx9mxYoVFBcXU1xczK+//kpaWprJc/7qq684evQoSil8fX1xd3c3+v0YPHgwhw8fZtWq\nVZSUlLBmzRrS0tIYOnRojc7P0MSJE1m2bBlJSUmUlZVx5swZ/RV4xf2YOu758+dZv349165dw8PD\ng0aNGunH/vnnn3P6xg2M/v7+aDSacn+h6SQnJ7Nv3z5KS0tp0qQJHh4euLu7ExQUxMCBA/n73/9O\nbm4uZWVlpKen638PH330UebPn09KSgpKKY4ePaovOw4MDCQ9Pd3oubdp04aePXsyY8YMCgsL2bt3\nL0uXLuXBBx+s0ffOlurlJA/aiX7u//0f7Xr2/KPM0ssLj8xMzuTmlqundxbt2rWjW7du+seGVyLv\nvvsuL730Er6+vvzzn/8sd9U7Y8YM2rZty+OPP46npycrVqxg5syZ+l9ww/1oNBqTjytuv2jRIr78\n8kt97HDvvfdWua2xx6asWLGCm266CT8/Pz744ANWrlxZo/289tprRERE0KNHD/z8/BgwYACHDx8G\nYNq0aeTn59O8eXN69uzJoEGDajXGwsJCZsyYQYsWLWjVqhUXL15k3rx5AIwaNQrQRkm33Xab0f01\nbtyYrVu3snr1aoKDg2nVqhUzZsygqKjI5DkfPXqUAQMG0KRJE3r27MlTTz1Fnz59Ko2vadOmfPXV\nVyxYsIDmzZszf/58vvrqK5o2bWp0PMZ+vjrdu3dn2bJl/O1vf8Pf35+4uLhy92UYvs/UccvKynjz\nzTcJDg6mWbNmfP/99/qLjF27dtGjRw+aNGnCPffcw1tvvWX0no2srCxGjRqFn58fUVFRxMXF6e9J\n+OSTTygqKiIqKoqmTZsyatQosrKyALjvvvt44YUXGDt2LL6+vowYMULfcXbGjBm88sorBAQE8MYb\nb1Q6p1WrVpGRkUHr1q0ZMWIEL7/8Mv1urH9R3b8LW3K5O15rS9cSIV8pso8e5divv5LXvHm5dghg\nmQV1hRCiImlrYCNKKSZOnMgnK1ZQWlxs9HUhhLA0meRtSClFzJAh7M3IkCt5IYRNSO8aG6oqpxdC\nCGclV/JGVMzpD27bRrGRCEcIIcwly//ZkcmcPjqaLjExtPL1rXXrYuEYCgpOcujQo0RHbzX6enZy\ntn5x74zZGQSND8I7zBv/OH/84/xtOdQ6O30aYmJgxw6owz0/wo5k+T8b0NXT/5aVZTSnP3LqFPvu\nuEO/9KB3QAAbk5IYcqOMSjg2d/dG5ObuqvJ1Y5N5WEKYlUdlWc88A08+KRN8fSaZfDWqzOnT0ylI\nT3e51sX1SYMG/pSW5qJUib2HYhXbt8POnfDcc/YeibAnuZKvAd2V+dsbNnD9zjv5/YsvuHLmDBjp\n6eGMLRHqK43GnQYN/CkuvoynZ0uj2+gim4KMArI+ztI/7+iRTXExTJ4Mb74JPj72Ho2wJ8nk66DK\nUsvoaLp16UIzf3/OHDtG9vHjfPDvf0t848B27uxEp05raNSoc7XbZiRkOPzkrrNwIWzZAps3g6wd\n45ykhNKOqmyJcPYs6YcOsW37dg5s385ZT0+mrlrl9EsMujJPz5YUFZ2v8fa6D2Id2blzMGeOdqKX\nCV7IJF9Hhq2Le995J22joijLySFn795ynS3TH3hAcnoHFhn5Cb6+PWq0rTNcwQM8/zyMHw+RkfYe\niXAEZmXyp06d4qGHHuL8+fNoNBoee+wxpkyZYqmxObwh/foxuG9fJk6cSOrRo5TeaCJVkeT0jsvb\nu+re8DoVSyl1HDG62bULNm2CtDR7j0Q4CrMy+aysLLKysoiJiSEvL49bb72VxMREOnbs+McBXDCT\nr0gpxbp163j06afJyc4ul9GzcCHdPvpIcnoX4ci5vFLQqxc88ghMnGjv0QhzOUSdfFBQkH4VmcaN\nG9OxY0fOnj1bbpKvDzQaDffddx/eAQE8Oncu5zIztR/IAoEffED60aOk5OVpn4uMZOqqVQAy0Tup\n7ORsh5zkV6+G/HyYMMHeIxGOxGIllBkZGezevZvY2FhL7dLpDO3fn480Gt5av55TR4+StXcvuf/7\nH9evXSt3E1X6Aw/wdmKiTPJOyD/O3yE/fL1+HZ59FlauhBqsnSLqEYtM8nl5edx3330sWrSIxo0b\nV3o9ISFB/3VcXBxxcXGWOKxDMszp1+bkcD031+h2ktM7F0fP5d94A2JjoXdve49E1FVycjLJyckW\n36/ZdfLFxcUMHTqUQYMGMW3atMoHqAeZvDGS0zuH0tJ8du3qwu23H6nxyj2OlstnZkKXLtq7W9u1\ns/dohKU4RCava+AVFRVldIKvzySndw7u7g0pLr5ISUk2Hh4BNX6fI+XyM2dqP2iVCV4YY9Yk/+OP\nP7JixQpuueUWunbtCsC8efO46667LDI4VyA5vePz8gqhsPBkjSd5R8rl9+yBjRvBYP1sIcoxa5Lv\n1asXZWVllhqLy6ppTn/myhWiBw/m3IkTRPfvz5Thw2XStwEvr7YUFJygceNok9tVzOULMgrs3np4\n+nR48UXw87PL4YUTkAZlNqJrWzx48ODKOT3At9+yPzERVVgIkZFsHTGC9JUrAYlwrM3bO4yCghPV\nbudorYf/9z84cQIee8xuQxBOQNoa2JAup1+xciWBf/6ztueNhwccPgwvv4y6erVyhCMtEazO27st\nBQUZ9h5GrZSWaq/iX3tN+yskRFXkSt4Ohvbvz4fA45Mnk1laijKxtKCUWlpfcPCTaDQ1+6fgKK2H\nV6wAX1+45x6bHVI4KWk1bEe6Msv58+fz62+/UVZyY/GKG2WWAF0//JDSy5clp3dA9iqlLCiAm2+G\nVaugZ0+bHlrYkLQadgG6+Obnn3/mHy+8gFeLFtpVpwCUwu/FF/l90yb2JiVxzsODrSNGSOtiB2OP\nKpt33oFu3WSCFzUjV/IO5Kvt23nhjTc4sXcvlJSQe+ECZaWl2hcNru7jExPZcuNrYT+66MaWH75m\nZ0OHDvDtt9qPdITrcoiboYRlDenXj/+uXMnxnBxyqyizBMnp7c2eLQ5efx2GDZMJXtScTPIOxLDM\nslJOr6MUJ1NSCI6Kov3AgXiVlUlObyFKlaLRVN/dq+Jkbqtc/tw5eP992L3b6ocSLkQyeQdjMqf/\n9ls8Ro3i+E8/cdbTk2+HD5ec3kJOnnyd48dn1um9tsrl58yBceMgNNQmhxMuQiZ5B6XRaJiXkMDn\nn31G26goGhw6hNsrr1B86ZK2SNqA1NObz9u7Ldev1743gK0qa06c0LYRfv55mxxOuBCJaxyYUoov\nPvuMy0ePUlJgIolXioOpqRLhmKFRoyiuXz9Y4+1t3eLglVfgiSegZUuL71q4OJnkHVjFjH7fvn1c\nv379jw2Ugu++gzVrOHnoEHTpwtnhwwGkJUItNWzYnoKCDMrKinBz86x2e1u2OEhPhy++0N4YLURt\nSVzj4Awz+o8//pibO3ZE06CBtpbuqadg3jw4eBAqNIqTCKd23Ny88PZuS37+EXsPpZKXX4bJk6Fp\nU3uPRDgjuZJ3ErrJfsSIEcTceiv79uzRXsmbIKWWtdOoUTQFBRk0atSpRtvbosXBkSOwaRMcPWqR\n3Yl6SCZ5J+Pm5saelBR9O4RKEQ7oY5x9X35JfFkZhW5uktPXQFTU6hqvDgXlJ3Nr5fGvvAJTpkgr\nYVF3Msk7Id1V/ciRI1m3bh0zX3qJw0eOoEB7K+SaNXD4MLn+/mwdMUL/PsnpTavNBG+MpVeLOnpU\nuyCIXMULc0gm78R0k/2B33/nnnvvxeNGmSUHD0JpKcUhIeW2l5zeeqxRUTNnDjz9NPg7xiqDwknJ\nlbyTU0rx6KOPsn3LFopNlVneIDm9ZVmrxUFGBmzYIFfxwnzSoMwFGLYsLpfR65qa6Uotf/mFbs2b\n0zwgQHJ6K7Bk6+GnnoImTeDVVy0wMOGUpEGZ0KuY0c+fP5/U1FQ0585RoMvojx3Dw8+Psz17kjJx\nov69ktOXV1JylZKSbLy969Y7wBK5fGamtlf8wZrfmyVElSSTdyG6yf6nn37i6aefxjM//4+MvrAQ\nL6XImjq13Hskpy/v4sVE0tOn1+m9lsrl33wTHnwQAgMtsjtRz8mVvIvRZfRr166t1K7Y3dP4nZyS\n0/+hSZPuZGQk1Oo9lszlc3Lgo48gJaVWbxOiSjLJuxhTrRD0f7YZZPQ8+yy5ly4RP2WK5PSAj8/N\nlJRcpqjoAp6eLWr0HsPJvCCjwKz2BosXw6BB0LZtnXchRDnywasLq/iBbLuICC40b865zEw4dgwi\nIwnq1AmuXy8X44SvXMmiMWPq7US/Z88AQkKm0qzZ0Fq/NzUulZjkmDodt7AQ2rXT3uEaHV2nXQgX\nImu8imoZZvSTJk3iXGYm2T/+qM/oAy5epFVJieT0Ffj69iAn5+c6vdc7zLvOx121Cjp1kgleWJbE\nNS7OVEZ/S0QEtGql27BchHM2O7veRjgBAQPIyfm+xtsbZvK6Hja1bXOglPYD13/9q/bjFcIUmeRd\nXHXtij1LS/9ohXAjwgE4evo0+2b+sVJSfSq19Pe/A3//O2q+vQXaDn/zDRQXw8CBtXqbENWSTL4e\nqZjRh4WFUaqUtu+Nbi3Z6GgahoWR37dvpdwgPjGRLQsX2mHkziMjIQOo/SR/990wdCg89pjlxySc\nk9wMJWrNsF1x//79+eGHHyipsFB4wMWLtI6MZL+RYFhKLatmTtvhY8fgp59g9Wprj1LUR2ZP8o88\n8ggbN26kZcuW7Nu3zxJjElbm5uZGUlKS0VYIt0RE4NWyJfsrZPSAlFqaYE7b4ffegwkTwMfHigMU\n9ZbZ1TUPP/wwW7ZsscRYhA1VXHEqNjYWnxuzTLemTfEaPVq76lRmJgBBS5ZwNi+PrSNG8O3w4Wwd\nMYKpq1axMSnJnqfhsHQfxFYnPx+WL4dJk6w7HlF/mT3J9+7dm4CAAEuMRdhBxTLLAwcO8Nbrr1N4\n/jwUFuJ38SLxiYn1stTywoW1XLv2e63fV5u7XP/zH+jeHcLDa30YIWrEJpl8QkKC/uu4uDji4uJs\ncVhRQ6bKLGMiItiycCFx06YZfa8r5/S5ubvIy9vDTTd1rtH2dWlvsHgxPPec2UMVLiA5OZnk5GSL\n79ci1TUZGRkMGzbMaCYv1TXOoap2xX369CE5OZmBkyezrXnzchk9QLePPnLZ1sXZ2d+Snv5/3Hrr\nr7V+b9qENCKXR5rcZv9+GDAATp6EBlICISqQ6hphUcbaFev+p7127VpObt+O5sgRVKc/FrkOWrKE\ns9evu2zrYl/fnuTnH6Go6Dyeni1r9d6CjOr/xvnwQ3j4YZnghXVJWwNRjrGMfvz48Rw6eBBVUkLA\nxYv0SUysFzm9m5sH/v79uHz5f7V+b3XtDQoLYcUKeOSRuo5OiJox+xpizJgxfPvtt1y6dIk2bdrw\n8ssv8/DDD1tibMJOqmuF8M2bb7Ju3TqenjXL6PtdqSVCs2bDuHRpA0FB46rdtjbtDTZtgqgo+cBV\nWJ/Zk/yqVassMQ7hQEy1Qrhw4QI9e/Zk7969eFWxwrQrtURo3nw4Pj7ta7RtbdobfPopPPSQuaMT\nonoS1wg0Zcj4AAAgAElEQVSjKtbRt2/fHjc3N9LS0vjll1+4fv06IS1aEH5jAtdpuHAh+cOGlXvO\nmSMcD48A/Px6WXSfly7B9u1w330W3a0QRslHPqJamzZtIjMzk7KysnLPN/X3Z96YMbydmEgB4A2c\n9vau1y0RatLeYO1aiI8HPz97jVLUJ9KgTFSruvJK3eubNm3iTOPGbB0xotI+XLnUsipVlVH27w9P\nPQVGvk1C6MmiIcJmTLVAWLt2LT179mT8+PEcO3aMKcOHV4pw6mtLBGNllOfPw2+/aZf4E8IW5Epe\n1FpZWRn/+Mc/+OSTT7h27VqlK/uNSUm8vWGDPsI5n5nJbiPNWZytdXFJyVUaNPCt8fbGruQXL4bk\nZO0qUEKYIjdDCbswVV6pM6Rfv3JRjCu0RCguvsKOHRH86U8ncXdvVOV2FcsodfXyukz+iy/g0Udt\nMmQhAJnkRS1Vt9IUUC6jX7p0KV4VPrDVcabWxdoqmz9x4cI6goKqrn00/IC1IKOgXAllbq62b/x/\n/mPt0QrxB8nkRa3VJqMHXCanDwqaQFbW8hpvXzGT//pr6NEDfGue+AhhNsnkhdmqy+gBl8jpy8oK\n+fnnYLp1+5WGDW+qdvuKmfwjj0DXrjB5sjVHKVyFZPLCIdQkowfXyOnd3LwIDBxHZuYS2rWba3Sb\nqjJ5vz7+bN3qL22Fhc3JJC/MUl1GXzGf13HWnL5160lcuPB5la9XbG2ge3zoEGg00L5mHRKEsBjJ\n5IXZqsrodX1uDPN5HWfN6X18OtC27Qs13l53Vb99u/YmKI3GWiMTwji5khcWo9FoGDlyJEopXnjh\nBQ4dOkRpaanRbXVX54YtEc6XlLDbWOvixESHupqvKf84f/0k/803cPfddh6QqJdkkhcWo5Ri4sSJ\nJvP5ivFNTXJ6Z2tdXHEZQKXguy0hvHDvdUBKa4RtySQvLKa6fH7t2rUsWLCAvXv30r1790rvryqn\nd7bWxYa5fHZyNu4Tw+B9iB4jE7ywPcnkhUUZy+e9vLxISUlh/Pjx+jbFxhjL6R29dXFZWVG12/z8\ns7Y+XvJ4YQ9yJS+sQpfPb9y4kT179pgsr9QxltM7cuviM2feIy9vNzff/EG55w3jmuxvs9lelEOH\nhmVkJ2sqLSoihLXJzVDCqky1Kf7mm2+Mllcaip8yxWFbFxcXX2LHjg7cdlsK3t5tjW6TNiGNqZmR\nTJ4MQ4fadHjCyUmrYeEU6lJeaciRSy09PJrRuvXjnDw5r8ptCjIK2LcPunSx4cCEMCBxjbCJ2pRX\nGnL0Uss2bf7Ojh03Exo6w+jVfEGQD9d2Q2ioTYclhJ5M8sImalJeWRVHbong4dGc4OAnyciYRWTk\ncqB8Jr9rTR43BRdyYnam0YW+hbA2meSFTdS1/YExjtYSoU2b6eW6U5ZrN5zkSWRrr3Ith4WwJZnk\nhc3o8vmRI0eW+zBWl89XVT9f0ZThw0lfuZL0Bx7QPxe0ZAlnr18nZeJE/XO2qqdv0MCXkJApRl/L\nOKXhpj9b9fBCmCSTvLC5uubzOo6e0xs659GQLmF2O7wQMskL26sun69JdFPTnN4eLREMM/mzRxrj\nnnyOjMx8yeSFXcgkL2zOVD5f2+hGx5FaIhhO5nlvXiNqciPCelrtcEKYJHXywi4q1s+3b98eNzc3\n0tLSTLY+qIojtUQ4f/5zCgtPA5Bd7E6zZlY9nBAmyZW8sLtNmzaRmZlJWRVX4zXhSC0RLh3YScaF\npbTc/x7Z+cHkfXiSjEZlEtcIuzC7rcGWLVuYNm0apaWlPProozz77LPlDyBtDUQ1TLU+ePrpp2tU\nVmmMvVoilJUV8Ouv0bRrN5e2re/l/BU3Gje22O5FPWGpudOsSb60tJSbb76Zr7/+muDgYLp3786q\nVavo2LGjxQcqXJ/hZJ+amoqnpyelpaV0795dvyB4bWxMSmLqqlWVSi25fp0sg0qc8JUrWTRmjEUn\n+pycH9i//3769DrN9UI3PDwstmtRTzjEQt47d+4kIiKCsLAwAEaPHs369evLTfJC1IVSqtZ3xlZk\nz1JLP79eNGs2klKggYSiwo7M+vU7c+YMbdq00T8OCQlhx44dlbZLSEjQfx0XF0dcXJw5hxUuyJy2\nB6bYoyWCroRSw+NoUBx/5XfcShtLJi9MSk5OrtNfrNUxa5LX1HAVBMNJXghjLNn2wBRbtETQTeZK\ngZqtaPt8Z9zd6zxkUU9UvACePXu2RfZr1iQfHBzMqVOn9I9PnTpFSEiI2YMS9ZOl2h6YYsuWCBoN\neLopioo0NGxY9zELYQ6zJvnbbruNI0eOkJGRQevWrVmzZg2rVq2y1NhEPWVu2wNTbJ3Te7grCguR\nSV7YjVmTfIMGDfj3v/9NfHw8paWlTJw4UT50FWazVj6vY+2c3rCtgU9xEL8nnCXEv1QyeWEXsvyf\ncEjWqp03xpr19FHNClixzZtu3UCpUo4ff5HQ0Bk0aNDEImMXrkuW/xMuzdiygV5eXqSkpFS7ZGBt\nWXOJQT9VxMWL2q81GneKiy9y+PBjcuEjbEYqeIXTsETtvDHWzOmb+SvOn//jcUTEInbv/hNnz75L\ncPBTFhi9EKbJJC8cVnXZ/Nq1ay0W21iydbFhJu973I09y8rodTRHn8l36rSOlJSeNGrUBX//O8we\nuxCmyCQvHJap2vndu3czfvx4s0sqq2JO62LDD1jbfXaKc+0CCEsI0L/esGE4HTt+woEDo7n11p14\neUnZsbAeyeSFQ9Nl8z/99BOTJk2i8Y1OX1evXq11O+LasFTr4tbeRRw/Xvn5pk3j6dBhMQ0aBFR+\nUQgLkit54fCUUjz66KOsXbuWvLw8mxzTnNbFhnGN376LpPm1JSPhdKUSyubNhyGEtUkJpXAKtiyp\nrEpdSi33P5TG7esiycwEX1+rDk+4GCmhFPWKLUsqq1KXUsvikwVERcHvv1t9eEIYJXGNcFrWKqms\nSl1KLb3DvOniBvv2Qc9q1nktLb1Gfn46jRvfYp0TEPWSTPLCaVi73UFN1KTUMjoVevwSSUZCBlkf\nZ9H2rhYkf+DJX24uNdnWIDc3hf377yMm5hsaNYqyyvhF/SNxjXAaupLKpUuXEhsbi4+Pj/61Cxcu\n8Mgjj9h8TMZKLffEwJftf+Txy2+Q2vEkm32X8csVTbV9a/z9exMe/jp79w6isPCMtYYs6hmZ5IVT\nqZjNt2/fHjc3N9LS0mySy1dUXU6PZyg7Hu3OiVMN+PzLb6vdX1DQQwQHP8nevYMoKcm21rBFPSJx\njXA6ukqbBQsWcPr0acqquHHJFqrL6bOCAA+FiizkX8v2M2pYn2r32abNPygsPMO+ffdwyy1bcHeX\nPsWi7mSSF07FEXL5iirm9BPue4Vblmu/vut/2ok+RZNN4YGafaCq0WiIiFjI2bPvo9HIP1FhHolr\nhFMxlcuDtp+NPbJ5Q5mtz/PxBEiNgeXj4eMJsG/CFdIvBRE/ZQpx06YRP2WKyY6WGo0bwcFP4ubm\nYbNxC9ckN0MJp2V4g1Rqaiqenp6UlpbSvXt3qyyIXFMbk5KYumoVvYq1Swx+PAEC31/O+XXvob7Y\nBY21q1yFr1zJojFjzF59SrgmuRlKCAO6mnlr9rOpqSH9+rFozBgi0tIg7wfiExNprfJR0fmQ+kev\nmur63ghhCRL4CadkKpvXlVNau82BMbq+NZ1oR6Mdbjx4VxgACadXsLvHZfilKfS6qN++AO2V/1uJ\nidWuQFVSksP58/+hdeu/2uhshCuQSV44JVNtiNPS0mjRooVdxmXYhCw7OZuwhDAAMqech9hLsKoN\nlKH/Gzr30iWmrlpF+gMP6PdhrH0xQFlZEadPL6SoKIuwsBetfi7CNUhcI5yWRqNh5MiRPPPMMwQH\nB+Pmpv11tmdJZVWmDB9OePKH0LgEDmvXdw1fsQJVVFRugoeqYxxPzxbExGzn3LkVnDz5mk3GLZyf\nXMkLp+WI5ZSGbYazv80mIyEDgD/HdWPRGJi8+xdKl5bSsecmJo8dy+tVZPIV2xfreHoGEROTRGpq\nH0BDaOg/LH8SwqVIdY1wao7QgrgqaRPSiFweWe65Xbtg7Fg4dAg0mrq1LwYoLDxNamo/wsMXSF96\nF2WpuVMmeeESHLGcMjUulZjkmArjhHbt4IsvICbmj3JLw8gmaMkSuH6dLIPulsbKLYuKLuDh0RSN\nxt36JyNszlJzp8Q1wuXYugVxVbzDvCs9p9HA/ffDf/6jneTr0r5Yx9PTPh8uC+cik7xweo6UzRtm\n8lkfZ+knesOqm9GjYcQIeOUVcHOrWftiqDqnF8IUmeSF0zNVTmnrmnndZJ6dnE0YYfoSSkMxMdCo\nEfzwA9xxR+V9GGtfDNpyy/gpU0zW05eU5OLu3hiNRmOJ0xEuQEoohUtwtBbEuqt5YzQaeOgh+PRT\n46/XZZlBnfT0Zzhy5EmUcrwyUmEfciUvXIYjtSAGTC4S8sAD0KULvPUWNKzQSdicnD48fD779g0l\nLe1hIiM/ki6Wou7VNZ9//jkJCQmkpaXx66+/0q1bN+MHkOoaYQOmcvmoqChiY2OtHtkY5vEZszMI\nmxUGlM/jDQ0apC2nHDeu+n3HTZvGt8OHV3q+y/LltPL1LRfh3NWnB/v3j8DNrSFRUatwc6v8AbBw\nfHavrunSpQtffPEFjz/+uNmDEMJcjtDmoKqWBlX5619h0aKaTfJV5fRHT59m38yZ+sfpK1eyCBgU\nt4GDBx9k376hdO78pSw8Uo/VOZOPjIykQ4cOlhyLEGZxpjYHAEOHam+KOny4+m2N5fQNFy4kf1j5\nG6F0LRHc3DyJilpFYOCDuLl5WXLYwsnYJLBLSEjQfx0XF0dcXJwtDivqGXuXUlbV0qCquMbTE8aP\nhw8+gPnzTe/bWE5/2tub/dHRlbbVlVpqNO4EBU2o28kIm0tOTrbKjXsmM/kBAwaQlZVV6fm5c+cy\n7MYVRN++fVmwYIFk8sIhVNXmwFa5PPwx2VcX1wAcOwaxsXDyZOUPYKtT15YIwjnYJJPftm2b2QcQ\nwpZ0pZQjR45k3bp1PP/886Snp9u0/bCp8smK2rWD22+H1avh4Ydrd5wpw4eTvnJlpZYIZ69fJ2Xi\nRP1zFVsXK6Wkjr4esUhcI1fqwpE4QimlqfLJip58EmbNggkTtDX0NVWXUkulytizZwBt284kIKBv\nzQ8mnFadJ/kvvviCKVOmcPHiRYYMGULXrl3ZvHmzJccmRK3ZK5evVD5JGNnJ2VXm8YbuugumTIGf\nf4aePWt33Nq2RNBo3GjbdiYHDvyF9u3/TcuW99fugMLpSBdK4XLsmcvXJo83tGgR/PijtnGZOWqa\n008b3gX/hrNp0+ZZQkImm3dQYRWykLcQVbBni4Pa5PGGHnkEtm+HEyfMO35NWyJMXrWTK/n/4uzZ\ndzh27Dm5EHNhcs+zcEn2zOVrk8frNGmizeT//W94/fW6H7s2Of1biYl8+foPZGVV0URHuASZ5IXL\nsXUub04eb2jKFOjWDWbOBD+/uo+nNjm9h0dz2rT5W90PJhyeZPLCJdkrlze25F9tPPCAthXx9OmW\nG5PU0zsnyeSFMMFeuXxBhnlLe0yfDgsXQmGhhQZE3VoXy4WZ65C4Rrgse+Tyxpb8q42YGOjUCVau\n1H4Yawm1racf3PcOdu/uw003/ZOAALmyd3YS1wiXZCqXDwoKIjMz02LH0mXyBRkFZH2cVW2L4ep8\n8w08/jgcPAjuVlqju7rWxa1anmXUbZto4DmZ+H6vWWcQwiSJa4QwQdd6eOnSpcTGxuLl9Ucnxvz8\nfIseyz/On7CEMLzDvAmbpV3yLywhrE4TPEBcHDRvDuvWWXSY5ZhqXbx1xAg+7vU0T3q/x9Vr77H1\nm/FyoebEZJIX9YIzTVIaDTz/PMydC9Yadk1aF5+kLY83Wc7F7P+RljZelhR0UpLJC5dkKq7x9rbc\nSkkVyyeDxgeRkZBR56hGZ8gQbSnll1/C3XdbarQG+69h6+IrNGXZDyPp96ceaDRyTeiMJJMXLsuW\nZZR1bWdgyrp1MG8e/Ppr7RqX1ZWUWjoWyeSFqIYtyyjr2s7AlHvv1ZZSbtpk8V0bVZdSS+H4JK4R\nLs2WZZTmxDPGuLnBSy/B7NkweLD1r+ZrW2oZf8etNGhgxq25wiZkkhcuy9rtDSzVzsCUkSPh5Ze1\nV/NDhlhklybVvCWCYt++Yfj7xxEWliB5vQOTn4xwWRXLKH18fPSvXbhwgUfMvNtIVzrpH+dvkdJJ\nY9zctFfyL71kvUobU6oqtcy9dJmXP+vA9ykf8v7Km9mYZKNMSdSaTPLCpdkil7dGHm/o3nu1E3xi\nolUPY5SpnD5xyIM82mw5p0PCOH95ApuSPrf9AEW1JK4RLs8Wubyl83hDGo32av755+Gee7RX97ZS\nXU5fjCdzeZ4Hm6/gvusTKSm5iwYNmthugKJaUkIpXJq12htYupVBdZTSLg04eTKMHWvx3ddKVS0R\n7vxiIW4qVEotLcRSc6dcyQuXpsvlBw8ezPz580lNTaXwRotHc9ob6CbzjIQMfR5vTRqN9g7Yv/4V\nRo0CDw+rHs6kqnL6H/fnkT/zjzr79Bsxj0z09iWZvKhXnPmvyr594aabwIpL1NZITVoiwI1Syw0b\nbDk0YYRcyQuXZo32BtZqZVATc+dqP4gdNw4MioVsqqYtEQAC/M5RWJiJl1cr2w5S6EkmL1yetdob\nWKOVQU2MGgW33grPPWfTw5pUVUuEqT9Pp190Gqt3DuXS5RaS09eCtDUQooasVUZp7dLJqsyZAwsW\nwOXLdjm8UVWVWq7ZGcJ8n+ncH7eZ4hH+0hLBDiSuEfWCtcoorR3PGNOhA9x3nza6mT/f5oc3ylSp\nZRZwltb8kxfZ/kB/3k5cL1fzNiSTvHB5lmxvYItWBjUxa5Z2mcCnn4awMJsd1iRTLRHSieBJ3mUW\ns8kPqPtC56L2JJMX9UJVuXxda+Xtlccbmj0bDh/WrgfriIzn9IpuHy2V1sU1IJm8ELWgy+V/+ukn\nJk2aROPGjYG618rbK4839MwzkJwMu3bZeyTGGc/pP5TWxTYmcY2oFwwz+b179+qv5M1ZJcoeebyh\nxo0hIQH+7/+0i3/bYmGR2qht62K5mreOOk/y06dP56uvvsLT05Pw8HCWLVuGn5/0lhaOx1QmHxlZ\n83zYUfJ4Qw8/DG+9BevXg5FOA3ZXk9bFndlHfNdtlJbm4+7e0JbDqxfqnMlv27aN/v374+bmxnM3\nCnZfffXVygeQTF44AEtm8o6QxxvauhWeegr27wdPT3uPxjRjOb03+cxNn0Rg03xW7xxK4bVGktPj\nAJn8gAEDcLvRDi82NpbTp0+bPRghrMWSmbwj5PGGBg6E9u3hnXfsPZLqGcvp/Zes4F9fxfBlwHAe\nil/P2RHtJae3IItk8kuXLmXMmDGW2JUQVmHpTN7eeXxF8+dDnz7adgfNm9t7NFWrOqefxmognXBm\nM4sPHniMtxM31PureUswGdcMGDCArKysSs/PnTuXYTeaEc2ZM4eUlBTWrVtn/AAaDbNmzdI/jouL\nIy4uzsxhC1FzpjL5mrY2sHVr4bp4+mltS2JnuKI3VLF1cWvO0IxLsDyFVr6+9abUMjk5meTkZP3j\n2bNnWySuMatOfvny5SxZsoTt27dXeUUkmbxwBFVl8m5ubvTu3bvcPy5TMhIyABwmjzd06RJ07Ajb\nt0OXLvYeTc1V1fem4SuvkD9zpv5x+MqVLBozxqUnekN2z+S3bNnC66+/zvr1680qQxPCFjQaDSNH\njuSZZ54hODhY/3mSNVaJspdmzeDFF+Fvf7PPerB1Ja2LravOmfzkyZMpKipiwIABAPzpT3/i3Xff\ntdjAhLAkc1ob2LO1cG098QS8/752Pdh777X3aGqmpq2L23OYApzo/14OQtoaiHrD3DJKRyudrMrX\nX8Njj2lLKhs6adl5xQinAcW8y5NkHy4j+UA81/B0+Zze7nGNEM7G3DJKRyudrMqdd0LXro7TobIu\nKkY4JXgwZ1k3ilQhdw/fTtrwHtISoYakrYGoNyxRRulo8UxVFizQLiwyfjyEhtp7NLVntNSyAGbe\n/Cmj+Jx3eZJXmMluaYlQLZnkRb1Q19YGjtjKoCbCwmDyZG0Ts88/t/do6sZ4SwQNn3M/R4lgEu/x\nNP+mwH5DdAqSyYt6w5xM3lnyeEP5+dqe84sXw436CKdWMafXUIbCjW4ffeSSrYslkxeilszJ5J0l\njzfUsCEsXKi9Saqw0N6jMV/FnF7hRtCSJdK6uBpyJS/qjaoy+cDAQKN3dhty1JLJ6igFw4ZBr16O\ntfB3XW1MSuLtDRv+yOkzM9k9aZLBFgrQEJ+YyJaFC+0zSAux1Nwpk7yoF+rS2iA7OZus5Vl4h3lr\n83gHbGVQE+npEBsLv/0GbdvaezSWVbElwij+Q1Mu88vHngQ28XfqCMdSc6d88CrqBY1Gw0cffcTg\nwYMrZfJpaWm0aNGi0nv84/zL5fDOlMcbCg+HqVNh2jT44gt7j8ayvCrcsfw/4nmBOUTFHSGh7Udc\noSkA6TdiHmeb6C1BMnlRb9SH1gZVmT5de3PUxo32HollVczpr+LHy4tasdsrlsU8Tmf2AfW7JYJc\nyYt6o6atDSqWTQIUZBToSyedkbc3/Pvf2rYHffuCj4+9R2QZRlsieDVkedDfOMgvzGYWC5nG99xR\nb0stJZMX9UptyiidsWyyOqNHQ7t2MHeuvUdiPYallkFkUogXV2jqdKWWUkIpRB3UpozSGcsmq/Pm\nm7BkiTa6cVWGEU4WrbhC03pdailxjahXatvawFnjmaq0agUJCTBpEiQng5sLXuZVvfrU1HLbpdeT\nlggyyYt6oyatDZy1jUFtPPEEfPIJLFsGEyfaezTWYbwlgpYbpdzDer5iaL3I6SWTF/VKTTN5V8zj\nDe3Zo2118Pvv0LKlvUdjfYY5vTf5PM9cmnGJ/66+GXfPNg6Z00smL0Qd1DSTd8U83lB0NEyYoF1F\nqj4wzOkLaMhLvEzKL948PWwzV0aEuHROL3GNqFdqk8m7SjxTlVmztGvB/u9/EB9v79FYl7GcPiWz\nPTt7TOBF/slmBvEx410yp5dJXtQb1WXy9SGPN9SoEbz3njaj//137WNXZiyn/5ZbeJzFjGSd/nlX\ny+klkxf1SnWZvG5Sz0jIcNk8vqJx47S5/IIF9h6JbVVsXazjKPX0kskLUQfVZfKunsUb8+absHIl\n/PqrvUdiWxVbIgAuWU8vcY2oV2qaybtiPFOV5s21V/ETJ8KuXeDpae8R2UZ19fQBXKYUd6fP6SWu\nEfWGqUy+ReMWfDfyO7I+znLalsLmUAqGDIGePWHmTHuPxn4MWxcP4SseZAUv8xINlu+kla+vTSMc\naTUsRC1VbDecmppK4Y0lk4rci/AO8yZsVli9yeINaTTaZQK7dYMRIyAqyt4jsg/D1sUbGcoVApjD\nC3zeugWrBi4GNIBztS6WTF7UW/IXZnlt2sDLL2tjm9JSe4/GPirm9D/xZ/6+9DZ69yrkZV6iMdq/\nAJ2pdbFM8qLe0MU1jzzyCDt27KCoqEj/mkeJBxmzMyjIKCAjIaNefgAL8Pjj2kz+rbfsPRL7GNKv\nH4vGjCE+MZE+iYnEJybSqKgZU32WcJ6WDGKzfltnKbWUTF7UK6ZKKH9+/Od6GdVUdPQo9OgBv/wC\nERH2Ho39lS+11K4hC9YvtZQSSiHqoDathuuriAh44QVtbFMPFs2qVvkIRzvBO1OppVzJi3qlqhLK\nwMBA0lan1ZtqmuqUlkLv3jB2LDz9tL1HY38bk5J4e8OGP0otMzPZPWkSAJ4UUoQXAPGJiWxZuNAi\nx7T7lfyLL75IdHQ0MTEx9O/fn1OnTpk9GGeUnJxs7yFYlSudn2Em/8svv+gneIAw77BybQ1cgTk/\nO3d3WLpU23v+2DGLDcmibPm7OaRfP7YsXEjywoVsWbgQ31atANBQxjs8xX18DiiHzOnrPMn/4x//\nYM+ePaSmpjJ8+HBmz55tyXE5DVeaBI1xpfPTlVAuXbqU2NhYPNw99K+dKDxBWEKYS13Jm/uzi4yE\nGTPg4YcdM7ax5++mrtRS4cZMXqEv3zCHFyjNO0v8lCnETZtG/JQpDhHf1HmSb9Kkif7rvLw8mjdv\nbpEBCWFNhpl8l1ZdJJOvxrRpUFIC77xj75E4FsOc/hxBTGURl/deYerdX3F2RHuHyunNuhnqhRde\n4NNPP8XHx4dffvnFUmMSwmrKZfJn91JSVgJUvfxffefurl1BqmdPGDwYwsPtPSLHYKwlQlLmLfx4\ny0PMYjZP8i4XaOkQLRFMfvA6YMAAsrKyKj0/d+5chg0bpn/86quvcujQIZYtW1b5ABqNhYYqhBD1\niyU+eLVIdc3JkycZPHgwv//+u9kDEkIIYTl1zuSPHDmi/3r9+vV07drVIgMSQghhOXW+kr/vvvs4\ndOgQ7u7uhIeH895779GyPqwILIQQTqTOV/Jr165l+PDhKKVIT09nzJgx5Wrl582bR/v27YmMjGTr\n1q3653/77Te6dOlC+/btmXqjbzNAYWEhf/nLX2jfvj09evTgxIkTdR2axUyfPp2OHTsSHR3NiBEj\nyMnJ0b/mCuf3+eef06lTJ9zd3UlJSSn3miucnylbtmwhMjKS9u3b89prr9l7ODXyyCOPEBgYSJcu\nXfTPXb58mQEDBtChQwcGDhxIdvYfdf61/Rna26lTp+jbty+dOnWic+fOvHWjgY6rnGNBQQGxsbHE\nxMQQFRXFjBkzABucnzLD1atX9V+/9dZbauLEiUoppfbv36+io6NVUVGROn78uAoPD1dlZWVKKaW6\nd++uduzYoZRSatCgQWrz5s1KKaXeeecdNWnSJKWUUqtXr1Z/+ctfzBmaRWzdulWVlpYqpZR69tln\n1bPPPquUcp3zO3jwoDp06JCKi4tTv/32m/55Vzm/qpSUlKjw8HB1/PhxVVRUpKKjo9WBAwfsPaxq\nfbAuLEcAAARPSURBVPfddyolJUV17txZ/9z06dPVa6+9ppRS6tVXXzXrd9TeMjMz1e7du5VSSuXm\n5qoOHTqoAwcOuNQ5Xrt2TSmlVHFxsYqNjVXff/+91c/PrN41VdXKr1+/njFjxuDh4UFYWBgRERHs\n2LGDzMxMcnNzuf322wF46KGHSExMBGDDhg2MHz8egJEjR7J9+3ZzhmYRAwYMwM1N+y2KjY3l9OnT\ngOucX2RkJB06dKj0vKucX1V27txJREQEYWFheHh4MHr0aNavX2/vYVWrd+/eBAQElHvO8Ps+fvx4\n/c+jLj9DewsKCiImJgaAxo0b07FjR86cOeNS5+jj4wNAUVERpaWlBAQEWP38zG5Q9sILLxAaGsry\n5cv1f36cPXuWkJAQ/TYhISGcOXOm0vPBwcGcOXMGgDNnztCmTRsAGjRogJ+fH5cvXzZ3eBazdOlS\nBg8eDLjm+Rly9fMzHCv8cX7O6Ny5cwQGBgLa/jvnzp0D6vYzdCQZGRns3r2b2NhYlzrHsrIyYmJi\nCAwM1EdT1j6/am+Gqq5Wfs6cOcyZM4dXX32VadOmGa2Vd2Q1uRdgzpw5eHp6MnbsWFsPz2w1vdeh\nPnHVezc0Go1LnFteXh4jR45k0aJF5dICcP5zdHNzIzU1lZycHOLj4/nmm2/KvW6N86t2kt+2bVuN\ndjR27Fj9lW5wcHC5D2FPnz5NSEgIwcHB+sjD8Hnde06ePEnr1q0pKSkhJyeHpk2b1upk6qK681u+\nfDmbNm0qFz+40vkZ40znVxcVz+/UqVPlroycSWBgIFlZWQQFBZGZmamvcKvNzzA4ONjm465KcXEx\nI0eOZNy4cQy/sdaqq50jgJ+fH0OGDOG3336z+vmZFddUVSt/9913s3r1aoqKijh+/DhHjhzh9ttv\nJygoCF9fX3bs2IFSik8//ZR77rlH/56PP/4Y0Fbu9O/f35yhWcSWLVt4/fXXWb9+fbnb3l3l/Awp\ng0paVzw/Q7fddhtHjhwhIyODoqIi1qxZw913323vYdWJ4ff9448/1k+MtfkZ6t5jb+pGl9CoqCim\nTZumf95VzvHixYv6ypn8/Hy2bdtG165drX9+5nxSPHLkSNW5c2cVHR2tRowYoc6dO6d/bc6cOSo8\nPFzdfPPNasuWLfrnd+3apTp37qzCw8PV5MmT9c8XFBSoUaNGqYiICBUbG6uOHz9uztAsIiIiQoWG\nhqqYmBgVExOjrx5RyjXO77///a8KCQlR3t7eKjAwUN11113611zh/EzZtGmT6tChgwoPD1dz5861\n93BqZPTo0apVq1bKw8NDhYSEqKVLl6pLly6p/v37q/bt26sBAwaoK1eu6Lev7c/Q3r7//nul0WhU\ndHS0/t/c5s2bXeYc9+7dq7p27aqio6NVly5d1L/+9S+llLL6+Vl90RAhhBD2I8v/CSGEC5NJXggh\nXJhM8kII4cJkkhdCCBcmk7wQQrgwmeSFEMKF/T+EGvw6HyMN5gAAAABJRU5ErkJggg==\n", - "text": [ - "" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.4, page no. 570" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "maximum tensile stress, maximum compressive stress, and maximum shear stress in the shaft.\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d = 0.05 # Diameter of shaft in m\n", - "T = 2400 # Torque transmitted by the shaft in N-m\n", - "P = 125000 # Tensile force\n", - "\n", - "#calculation\n", - "s0 = (4*P)/(math.pi*d**2) # Tensile stress in\n", - "t0 = (16*T)/(math.pi*d**3) # Shear force \n", - "# Stresses along x and y direction\n", - "sx = 0 \n", - "sy = s0 \n", - "txy = -t0 \n", - "s1 = (sx+sy)/2.0 + math.sqrt(((sx-sy)/2.0)**2 + (txy)**2) # Maximum tensile stress \n", - "s2 = (sx+sy)/2.0 - math.sqrt(((sx-sy)/2.0)**2 + (txy)**2) # Maximum compressive stress \n", - "tmax = math.sqrt(((sx-sy)/2)**2 + (txy)**2) # Maximum in plane shear stress \n", - "print \"Maximum tensile stress %e\" %s1, \"Pa\"\n", - "print \"Maximum compressive stress %e\" %s2, \"Pa\"\n", - "print \"Maximum in plane shear stress %e \" %tmax, \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum tensile stress 1.346662e+08 Pa\n", - "Maximum compressive stress -7.100421e+07 Pa\n", - "Maximum in plane shear stress 1.028352e+08 Pa\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.5, page no. 573" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "calculate maximum allowable internal pressure\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "\n", - "#initialisation\n", - "P = 12 # Axial load in K\n", - "r = 2.1 # Inner radius of the cylinder in inch\n", - "t = 0.15 # Thickness of the cylinder in inch\n", - "ta = 6500 # Allowable shear stress in Psi\n", - "\n", - "#calculation\n", - "p1 = (ta - 3032)/3.5 # allowable internal pressure\n", - "p2 = (ta + 3032)/3.5 # allowable internal pressure\n", - "p3 = 6500/7.0 # allowable internal pressure\n", - "\n", - "prs_allowable = min(p1,p2,p3) # Minimum pressure would govern the design\n", - "print \"Maximum allowable internal pressure \", round(prs_allowable), \"psi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum allowable internal pressure 929.0 psi\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.6, page no. 574" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "principal stresses and maximum shear stresses\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "d1 = 0.18 # Inner diameter of circular pole in m\n", - "d2 = 0.22 # Outer diameter of circular pole in m\n", - "P = 2000 # Pressure of wind in Pa\n", - "b = 1.5 # Distance between centre line of pole and board in m\n", - "h = 6.6 # Distance between centre line of board and bottom of the ploe in m\n", - "\n", - "#calculation\n", - "W = P*(2*1.2) # Force at the midpoint of sign \n", - "V = W # Load\n", - "T = W*b # Torque acting on the pole\n", - "M = W*h # Moment at the bottom of the pole\n", - "I = (math.pi/64.0)*(d2**4-d1**4) # Momet of inertia of cross section of the pole\n", - "sa = (M*d2)/(2*I) # Tensile stress at A \n", - "Ip = (math.pi/32.0)*(d2**4-d1**4) # Polar momet of inertia of cross section of the pole\n", - "t1 = (T*d2)/(2*Ip) # Shear stress at A and B\n", - "r1 = d1/2.0 # Inner radius of circular pole in m\n", - "r2 = d2/2.0 # Outer radius of circular pole in m\n", - "A = math.pi*(r2**2-r1**2) # Area of the cross section\n", - "t2 = ((4*V)/(3*A))*((r2**2 + r1*r2 +r1**2)/(r2**2+r1**2)) # Shear stress at point B \n", - "\n", - "# Principle stresses \n", - "sxa = 0\n", - "sya = sa\n", - "txya = t1\n", - "sxb = 0\n", - "syb = 0\n", - "txyb = t1+t2 \n", - "\n", - "# Stresses at A\n", - "s1a = (sxa+sya)/2.0 + math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum tensile stress \n", - "s2a = (sxa+sya)/2.0 - math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum compressive stress \n", - "tmaxa = math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum in plane shear stress\n", - "\n", - "print \"Maximum tensile stress at point A is\", s1a, \"Pa\"\n", - "print \"Maximum compressive stress at point A is\", s2a, \"Pa\"\n", - "print \"Maximum in plane shear stress at point A is\", tmaxa, \"Pa\"\n", - "\n", - "# Stress at B \n", - "s1b = (sxb+syb)/2.0 + math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum tensile stress \n", - "s2b = (sxb+syb)/2.0 - math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum compressive stress \n", - "tmaxb = math.sqrt(((sxb-syb)/2.0)**2 + (txyb)**2) # Maximum in plane shear stress \n", - "print \"Maximum tensile stress at point B is\", s1b, \"Pa\"\n", - "print \"Maximum compressive stress at point B is\", s2b, \"Pa\"\n", - "print \"Maximum in plane shear stress at point B is\", tmaxb, \"Pa\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum tensile stress at point A is 55613361.197 Pa\n", - "Maximum compressive stress at point A is -700178.455718 Pa\n", - "Maximum in plane shear stress at point A is 28156769.8263 Pa\n", - "Maximum tensile stress at point B is 6999035.59641 Pa\n", - "Maximum compressive stress at point B is -6999035.59641 Pa\n", - "Maximum in plane shear stress at point B is 6999035.59641 Pa\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.7, page no. 578" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"\"\"\n", - "principal stresses and maximum shear stresses at points & at the base of the post\n", - "\"\"\"\n", - "\n", - "import math \n", - "\n", - "#initialisation\n", - "b = 6 # Outer dimension of the pole in inch\n", - "t = 0.5 # thickness of the pole\n", - "P1 = 20*(6.75*24) # Load acting at the midpoint of the platform\n", - "d = 9 # Distance between longitudinal axis of the post and midpoint of platform\n", - "P2 = 800 # Load in lb\n", - "h = 52 # Distance between base and point of action of P2\n", - "\n", - "#calculation\n", - "M1 = P1*d # Moment due to P1\n", - "M2 = P2*h # Moment due to P2\n", - "A = b**2 - (b-2*t)**2 # Area of the cross section\n", - "sp1 = P1/A # Comoressive stress due to P1 at A and B\n", - "I = (1.0/12.0)*(b**4 - (b-2*t)**4) # Moment of inertia of the cross section\n", - "sm1 = (M1*b)/(2*I) # Comoressive stress due to M1 at A and B\n", - "Aweb = (2*t)*(b-(2*t)) # Area of the web\n", - "tp2 = P2/Aweb # Shear stress at point B by lpad P2\n", - "sm2 = (M2*b)/(2*I) # Comoressive stress due to M2 at A \n", - "sa = sp1+sm1+sm2 # Total Compressive stress at point A\n", - "sb = sp1+sm1 # Total compressive at point B \n", - "tb = tp2 # Shear stress at point B\n", - "\n", - "# Principle stresses \n", - "sxa = 0\n", - "sya = -sa\n", - "txya = 0\n", - "sxb = 0\n", - "syb = -sb\n", - "txyb = tp2 \n", - "\n", - "# Stresses at A\n", - "s1a = (sxa+sya)/2 + math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum tensile stress \n", - "s2a = (sxa+sya)/2 - math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum compressive stress \n", - "tmaxa = math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum in plane shear stress\n", - "print \"Maximum tensile stress at point A is\", s1a,\"Psi\"\n", - "print \"Maximum compressive stress at point A is\", round(s2a,2), \"Psi\"\n", - "print \"Maximum in plane shear stress at point A is\", round(tmaxa,2), \"Psi\"\n", - "\n", - "# Stress at B \n", - "s1b = (sxb+syb)/2 + math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum tensile stress \n", - "s2b = (sxb+syb)/2 - math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum compressive stress \n", - "tmaxb = math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum in plane shear stress\n", - "print \"Maximum tensile stress at point B is\", round(s1b,2), \"Psi\"\n", - "print \"Maximum compressive stress at point B is\", round(s2b,2), \"Psi\"\n", - "print \"Maximum in plane shear stress at point B is\", round(tmaxb,2), \"Psi\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum tensile stress at point A is 0.0 Psi\n", - "Maximum compressive stress at point A is -4090.91 Psi\n", - "Maximum in plane shear stress at point A is 2045.45 Psi\n", - "Maximum tensile stress at point B is 13.67 Psi\n", - "Maximum compressive stress at point B is -1872.69 Psi\n", - "Maximum in plane shear stress at point B is 943.18 Psi\n" - ] - } - ], - "prompt_number": 5 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/Testing_the_interface/screenshots/screen1.png b/Testing_the_interface/screenshots/screen1.png deleted file mode 100755 index 2e923aea..00000000 Binary files a/Testing_the_interface/screenshots/screen1.png and /dev/null differ diff --git a/Testing_the_interface/screenshots/screen1_1.png b/Testing_the_interface/screenshots/screen1_1.png deleted file mode 100755 index 2e923aea..00000000 Binary files a/Testing_the_interface/screenshots/screen1_1.png and /dev/null differ diff --git a/Testing_the_interface/screenshots/screen1_2.png b/Testing_the_interface/screenshots/screen1_2.png deleted file mode 100755 index 2e923aea..00000000 Binary files a/Testing_the_interface/screenshots/screen1_2.png and /dev/null differ diff --git a/Testing_the_interface/screenshots/screen2.png b/Testing_the_interface/screenshots/screen2.png deleted file mode 100755 index eb6ad8e1..00000000 Binary files a/Testing_the_interface/screenshots/screen2.png and /dev/null differ diff --git a/Testing_the_interface/screenshots/screen2_1.png b/Testing_the_interface/screenshots/screen2_1.png deleted file mode 100755 index eb6ad8e1..00000000 Binary files a/Testing_the_interface/screenshots/screen2_1.png and /dev/null differ diff --git a/Testing_the_interface/screenshots/screen2_2.png b/Testing_the_interface/screenshots/screen2_2.png deleted file mode 100755 index eb6ad8e1..00000000 Binary files a/Testing_the_interface/screenshots/screen2_2.png and /dev/null differ diff --git a/Testing_the_interface/screenshots/screen3.png b/Testing_the_interface/screenshots/screen3.png deleted file mode 100755 index ff023b0d..00000000 Binary files a/Testing_the_interface/screenshots/screen3.png and /dev/null differ diff --git a/Testing_the_interface/screenshots/screen3_1.png b/Testing_the_interface/screenshots/screen3_1.png deleted file mode 100755 index ff023b0d..00000000 Binary files a/Testing_the_interface/screenshots/screen3_1.png and /dev/null differ diff --git a/Testing_the_interface/screenshots/screen3_2.png b/Testing_the_interface/screenshots/screen3_2.png deleted file mode 100755 index ff023b0d..00000000 Binary files a/Testing_the_interface/screenshots/screen3_2.png and /dev/null differ diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter1.ipynb new file mode 100755 index 00000000..c6ef18b9 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter1.ipynb @@ -0,0 +1,663 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a8bd87f60081f4f46694f9441020afc8284599a70f0355a12064b02651bb21e5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter1-Basic Kinematics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 1 PAGE NO 15\n", + "#calculate inclination of slotted bar with vertical \n", + "##TITLE:Basic kinematics\n", + "##Figure 1.14\n", + "import math\n", + "pi=3.141\n", + "AO=200.## distance between fixed centres in mm\n", + "OB1=100.## length of driving crank in mm\n", + "AP=400.## length of slotter bar in mm\n", + "##====================================\n", + "OAB1=math.asin(OB1/AO)*57.3## inclination of slotted bar with vertical in degrees\n", + "beeta=(90-OAB1)*2.## angle through which crank turns inreturn stroke in degrees\n", + "A=(360.-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", + "L=2.*AP*math.sin(90.-beeta/2.)/57.3## length of the stroke in mm\n", + "print'%s %.2f %s %.3f %s'%('Inclination of slotted bar with vertical= ',OAB1,' degrees' 'Length of the stroke=',L,' mm')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Inclination of slotted bar with vertical= 30.00 degreesLength of the stroke= -13.790 mm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 2 PAGE NO 16\n", + "#calculate ratio of time taken on the cutting to the return\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.15\n", + "import math\n", + "OA=300.## distance between the fixed centres in mm\n", + "OB=150.## length of driving crank in mm\n", + "##================================\n", + "OAB=math.asin(OB/OA)## inclination of slotted bar with vertical in degrees\n", + "beeta=(90/57.3-OAB)*2.## angle through which crank turns inreturn stroke in degrees\n", + "A=(360/57.3-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", + "print'%s %.1f %s'%('Ratio of time taken on the cutting to the return stroke= ',A,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ratio of time taken on the cutting to the return stroke= 2.0 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 3 PAGE NO 16\n", + "#calculate ratio of time taken on the cutting to the return stroke \n", + "##TITLE:Basic kinematics\n", + "##Figure 1.16\n", + "import math\n", + "OB=54.6/57.3## distance between the fixed centres in mm\n", + "OA=85./57.3## length of driving crank in mm\n", + "OA2=OA\n", + "CA=160.## length of slotted lever in mm\n", + "CD=144.## length of connectin rod in mm\n", + "##================================\n", + "beeta=2.*(math.cos(OB/OA2))## angle through which crank turns inreturn stroke in degrees\n", + "A=(360/57.3-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", + "print'%s %.1f %s'%('Ratio of time taken on the cutting to the return stroke= ',A,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ratio of time taken on the cutting to the return stroke= 2.9 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 4 PAGE NO 17\n", + "#calculate velocity position and Angular velocity connection\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.18,1.19\n", + "import math\n", + "pi=3.141\n", + "Nao=180.## speed of the crank in rpm\n", + "wAO=2.*pi*Nao/60.## angular speed of the crank in rad/s\n", + "AO=.5## crank length in m\n", + "AE=.5\n", + "Vao=wAO*AO## velocity of A in m/s\n", + "##================================\n", + "Vb1=8.15## velocity of piston B in m/s by measurment from figure 1.19\n", + "Vba=6.8## velocity of B with respect to A in m/s\n", + "AB=2## length of connecting rod in m\n", + "wBA=Vba/AB## angular velocity of the connecting rod BA in rad/s\n", + "ae=AE*Vba/AB## velocity of point e on the connecting rod\n", + "oe=8.5## by measurement velocity of point E\n", + "Do=.05## diameter of crank shaft in m\n", + "Da=.06## diameter of crank pin in m\n", + "Db=.03## diameter of cross head pin B m\n", + "V1=wAO*Do/2.## velocity of rubbing at the pin of the crankshaft in m/s\n", + "V2=wBA*Da/2.## velocity of rubbing at the pin of the crank in m/s\n", + "Vb=(wAO+wBA)*Db/2.## velocity of rubbing at the pin of cross head in m/s\n", + "ag=5.1## by measurement\n", + "AG=AB*ag/Vba## position and linear velocity of point G on the connecting rod in m\n", + "##===============================\n", + "print'%s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s'%('Velocity of piston B=',Vb1,' m/s''Angular velocity of connecting rod= ',wBA,' rad/s''velocity of point E=',oe,' m/s'' velocity of rubbing at the pin of the crankshaft=',V1,' m/s' 'velocity of rubbing at the pin of the crank =',V2,' m/s''velocity of rubbing at the pin of cross head =',Vb,' m/s''position and linear velocity of point G on the connecting rod=',AG,' m')\n", + "\n", + "\n", + "\n", + "\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity of piston B= 8.150 m/sAngular velocity of connecting rod= 3.400 rad/svelocity of point E= 8.500 m/s velocity of rubbing at the pin of the crankshaft= 0.471 m/svelocity of rubbing at the pin of the crank = 0.102 m/svelocity of rubbing at the pin of cross head = 0.334 m/sposition and linear velocity of point G on the connecting rod= 1.500 m\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg 19" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 5 PAGE NO 19\n", + "#calculate linear velocity at various point\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.20,1.21\n", + "import math\n", + "pi=3.141\n", + "N=120.## speed of crank in rpm\n", + "OA=10.## length of crank in cm\n", + "BP=48.## from figure 1.20 in cm\n", + "BA=40.## from figure 1.20 in cm\n", + "##==============\n", + "w=2.*pi*N/60.## angular velocity of the crank OA in rad/s\n", + "Vao=w*OA## velocity of ao in cm/s\n", + "ba=4.5## by measurement from 1.21 in cm\n", + "Bp=BP*ba/BA\n", + "op=6.8## by measurement in cm from figure 1.21\n", + "s=20.## scale of velocity diagram 1cm=20cm/s\n", + "Vp=op*s## linear velocity of P in m/s\n", + "ob=5.1## by measurement in cm from figure 1.21\n", + "Vb=ob*s## linear velocity of slider B\n", + "print'%s %.2f %s %.2f %s'%('Linear velocity of slider B= ',Vb,' cm/s''Linear velocity of point P= ',Vp,' cm/s')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Linear velocity of slider B= 102.00 cm/sLinear velocity of point P= 136.00 cm/s\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#calculate angular velocity at various points\n", + "##CHAPTER 1 ILLUSRTATION 6 PAGE NO 20\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.22,1.23\n", + "import math\n", + "pi=3.141\n", + "AB=6.25## length of link AB in cm\n", + "BC=17.5## length of link BC in cm\n", + "CD=11.25## length of link CD in cm\n", + "DA=20.## length of link DA in cm\n", + "CE=10.\n", + "N=100.## speed of crank in rpm\n", + "##========================\n", + "wAB=2.*pi*N/60.## angular velocity of AB in rad/s\n", + "Vb=wAB*AB## linear velocity of B with respect to A\n", + "s=15.## scale for velocity diagram 1 cm= 15 cm/s\n", + "dc=3.## by measurement in cm\n", + "Vcd=dc*s\n", + "wCD=Vcd/CD## angular velocity of link CD in rad/s\n", + "bc=2.5## by measurement in cm\n", + "Vbc=bc*s\n", + "wBC=Vbc/BC## angular velocity of link BC in rad/s\n", + "ce=bc*CE/BC\n", + "ae=3.66## by measurement in cm\n", + "Ve=ae*s## velocity of point E 10 from c on the link BC\n", + "af=2.94## by measurement in cm\n", + "Vf=af*s## velocity of point F\n", + "print'%s %.3f %s %.3f %s %.3f %s %.3f %s'%('The angular velocity of link CD= ',wCD,' rad/s'' The angular velocity of link BC= ',wBC,'rad/s'' velocity of point E 10 from c on the link BC= ',Ve,' cm/s' ' velocity of point F= ',Vf,' cm/s')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angular velocity of link CD= 4.000 rad/s The angular velocity of link BC= 2.143 rad/s velocity of point E 10 from c on the link BC= 54.900 cm/s velocity of point F= 44.100 cm/s\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 7 PAGE NO 21\n", + "##TITLE:Basic kinematics\n", + "#calculate Linear velocity slider and angular velocity of link\n", + "##Figure 1.24,1.25\n", + "import math\n", + "pi=3.141\n", + "Noa=600## speed of the crank in rpm\n", + "OA=2.8## length of link OA in cm\n", + "AB=4.4## length of link AB in cm\n", + "BC=4.9## length of link BC in cm\n", + "BD=4.6## length of link BD in cm\n", + "##=================\n", + "wOA=2.*pi*Noa/60.## angular velocity of crank in rad/s\n", + "Vao=wOA*OA## The linear velocity of point A with respect to oin m/s\n", + "s=50.## scale of velocity diagram in cm\n", + "od=2.95## by measurement in cm from figure\n", + "Vd=od*s/100.## linear velocity slider in m/s\n", + "bd=3.2## by measurement in cm from figure\n", + "Vbd=bd*s\n", + "wBD=Vbd/BD## angular velocity of link BD\n", + "print'%s %.1f %s %.1f %s '%('linear velocity slider D= ',Vd,' m/s' 'angular velocity of link BD= ',wBD,' rad/s')\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "linear velocity slider D= 1.5 m/sangular velocity of link BD= 34.8 rad/s \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 8 PAGE NO 22\n", + "#calculate Angular velocity of link CD\n", + "##TITLE:Basic kinematics\n", + "import math\n", + "pi=3.141\n", + "Noa=60.## speed of crank in rpm\n", + "OA=30.## length of link OA in cm\n", + "AB=100.## length of link AB in cm\n", + "CD=80.## length of link CD in cm\n", + "##AC=CB\n", + "##================\n", + "wOA=2.*pi*Noa/60.## angular velocity of crank in rad/s\n", + "Vao=wOA*OA/100.## linear velocity of point A with respect to O\n", + "s=50.## scale for velocity diagram 1 cm= 50 cm/s\n", + "ob=3.4## by measurement in cm from figure 1.27\n", + "od=.9## by measurement in cm from figure 1.27\n", + "Vcd=160.## by measurement in cm/s from figure 1.27\n", + "wCD=Vcd/CD## angular velocity of link in rad/s\n", + "print'%s %.d %s'%('Angular velocity of link CD= ',wCD,' rad/s')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Angular velocity of link CD= 2 rad/s\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 9 PAGE NO 23\n", + "#calculate velcity of Ram and anugular velocity of link and velocity of slidingof the block\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.28,1.29\n", + "import math\n", + "pi=3.141\n", + "Nao=120.## speed of the crank in rpm\n", + "OQ=10.## length of link OQ in cm\n", + "OA=20.## length of link OA in cm\n", + "QC=15.## length of link QC in cm\n", + "CD=50.## length oflink CD in cm\n", + "##=============\n", + "wOA=2.*pi*Nao/60.## angular speed of crank in rad/s\n", + "Vad=wOA*OA/100.## velocity of pin A in m/s\n", + "BQ=41.## from figure 1.29 \n", + "BC=26.## from firure 1.29 \n", + "bq=4.7## from figure 1.29\n", + "bc=bq*BC/BQ## from figure 1.29 in cm\n", + "s=50.## scale for velocity diagram in cm/s\n", + "od=1.525## velocity vector od in cm from figure 1.29\n", + "Vd=od*s## velocity of ram D in cm/s\n", + "dc=1.925## velocity vector dc in cm from figure 1.29\n", + "Vdc=dc*s## velocity of link CD in cm/s\n", + "wCD=Vdc/CD## angular velocity of link CD in cm/s\n", + "ba=1.8## velocity vector of sliding of the block in cm\n", + "Vab=ba*s## velocity of sliding of the block in cm/s\n", + "print'%s %.3f %s %.2f %s %.1f %s '%('Velocity of RAM D= ',Vd,' cm/s''angular velocity of link CD= ',wCD,' rad/s'' velocity of sliding of the block= ',Vab,' cm/s')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity of RAM D= 76.250 cm/sangular velocity of link CD= 1.93 rad/s velocity of sliding of the block= 90.0 cm/s \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 10 PAGE NO 24\n", + "##TITLE:Basic kinematics\n", + "#calculate linear velocity abd radial component of accerlation and anugular velocity of connecting rod and anugular accerlation of connecting rod\n", + "##Figure 1.30(a),1.30(b),1.30(c)\n", + "import math\n", + "pi=3.141\n", + "Nao=300.## speed of crank in rpm\n", + "AO=.15## length of crank in m\n", + "BA=.6## length of connecting rod in m\n", + "##===================\n", + "wAO=2.*pi*Nao/60.## angular velocity of link in rad/s\n", + "Vao=wAO*AO## linear velocity of A with respect to 'o'\n", + "ab=3.4## length of vector ab by measurement in m/s\n", + "Vba=ab\n", + "ob=4.## length of vector ob by measurement in m/s\n", + "oc=4.1## length of vector oc by measurement in m/s\n", + "fRao=Vao**2./AO## radial component of acceleration of A with respect to O\n", + "fRba=Vba**2./BA## radial component of acceleration of B with respect to A\n", + "wBA=Vba/BA## angular velocity of connecting rod BA\n", + "fTba=103.## by measurement in m/s**2\n", + "alphaBA=fTba/BA## angular acceleration of connecting rod BA\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('linear velocity of A with respect to O= ',Vao,' m/s''radial component of acceleration of A with respect to O= ',fRao,' m/s**2'' radial component of acceleration of B with respect to A=',fRba,' m/s**2'' angular velocity of connecting rod B= ',wBA,' rad/s'' angular acceleration of connecting rod BA= ',alphaBA,' rad/s**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "linear velocity of A with respect to O= 4.7 m/sradial component of acceleration of A with respect to O= 148.0 m/s**2 radial component of acceleration of B with respect to A= 19.3 m/s**2 angular velocity of connecting rod B= 5.7 rad/s angular acceleration of connecting rod BA= 171.7 rad/s**2 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 11 PAGE NO 26\n", + "#calcualte Angular accerlation at various point\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.31(a),1.31(b),1.31(c)\n", + "import math\n", + "pi=3.141\n", + "wAP=10.## angular velocity of crank in rad/s\n", + "P1A=30.## length of link P1A in cm\n", + "P2B=36.## length of link P2B in cm\n", + "AB=36.## length of link AB in cm\n", + "P1P2=60.## length of link P1P2 in cm\n", + "AP1P2=60.## crank inclination in degrees \n", + "alphaP1A=30.## angulare acceleration of crank P1A in rad/s**2\n", + "##=====================================\n", + "Vap1=wAP*P1A/100.## linear velocity of A with respect to P1 in m/s\n", + "Vbp2=2.2## velocity of B with respect to P2 in m/s(measured from figure )\n", + "Vba=2.06## velocity of B with respect to A in m/s(measured from figure )\n", + "wBP2=Vbp2/(P2B*100.)## angular velocity of P2B in rad/s\n", + "wAB=Vba/(AB*100.)## angular velocity of AB in rad/s\n", + "fAB1=alphaP1A*P1A/100.## tangential component of the acceleration of A with respect to P1 in m/s**2\n", + "frAB1=Vap1**2./(P1A/100.)## radial component of the acceleration of A with respect to P1 in m/s**2\n", + "frBA=Vba**2./(AB/100.)## radial component of the acceleration of B with respect to B in m/s**2\n", + "frBP2=Vbp2**2./(P2B/100.)## radial component of the acceleration of B with respect to P2 in m/s**2\n", + "ftBA=13.62## tangential component of B with respect to A in m/s**2(measured from figure)\n", + "ftBP2=26.62## tangential component of B with respect to P2 in m/s**2(measured from figure)\n", + "alphaBP2=ftBP2/(P2B/100.)## angular acceleration of P2B in m/s**2\n", + "alphaBA=ftBA/(AB/100.)## angular acceleration of AB in m/s**2\n", + "##==========================\n", + "print'%s %.1f %s %.1f %s'%('Angular acceleration of P2B=',alphaBP2,' rad/s**2''angular acceleration of AB =',alphaBA,' rad/s**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Angular acceleration of P2B= 73.9 rad/s**2angular acceleration of AB = 37.8 rad/s**2\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 12 PAGE NO 28\n", + "#calculate velocities at various point\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.32(a),1.32(b),1.32(c)\n", + "import math\n", + "PI=3.141\n", + "AB=12.## length of link AB in cm\n", + "BC=48.## length of link BC in cm\n", + "CD=18.## length of link CD in cm\n", + "DE=36.## length of link DE in cm\n", + "EF=12.## length of link EF in cm\n", + "FP=36.## length of link FP in cm\n", + "Nba=200.## roating speed of link BA IN rpm\n", + "wBA=2*PI*200./60.## Angular velocity of BA in rad/s\n", + "Vba=wBA*AB/100.## linear velocity of B with respect to A in m/s\n", + "Vc=2.428## velocity of c in m/s from diagram 1.32(b)\n", + "Vd=2.36## velocity of D in m/s from diagram 1.32(b)\n", + "Ve=1## velocity of e in m/s from diagram 1.32(b)\n", + "Vf=1.42## velocity of f in m/s from diagram 1.32(b)\n", + "Vcb=1.3## velocity of c with respect to b in m/s from figure\n", + "fBA=Vba**2.*100./AB## radial component of acceleration of B with respect to A in m/s**2\n", + "fCB=Vcb**2*100./BC## radial component of acceleration of C with respect to B in m/s**2\n", + "fcb=3.52## radial component of acceleration of C with respect to B in m/s**2 from figure\n", + "fC=19.## acceleration of slider in m/s**2 from figure\n", + "print'%s %.1f %s %.1f %s %.1f %s %.2f %s %.2f %s'%('velocity of c=',Vc,' m/s''velocity of d=',Vd,' m/s''velocity of e=',Ve,' m/s'' velocity of f=',Vf,' m/s''Acceleration of slider=',Vc,' m/s**2')\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "velocity of c= 2.4 m/svelocity of d= 2.4 m/svelocity of e= 1.0 m/s velocity of f= 1.42 m/sAcceleration of slider= 2.43 m/s**2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 13 PAGE NO 30\n", + "#caculate angular acceleration at varoius points\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.33(a),1.33(b),1.33(c)\n", + "import math\n", + "PI=3.141\n", + "N=120.## speed of the crank OC in rpm\n", + "OC=5.## length of link OC in cm\n", + "cp=20.## length of link CP in cm\n", + "qa=10.## length of link QA in cm\n", + "pa=5.## length of link PA in cm\n", + "CP=46.9## velocity of link CP in cm/s\n", + "QA=58.3## velocity of link QA in cm/s\n", + "Pa=18.3## velocity of link PA in cm/s\n", + "Vc=2.*PI*N*OC/60.## velocity of C in m/s\n", + "Cco=Vc**2./OC## centripetal acceleration of C relative to O in cm/s**2\n", + "Cpc=CP**2./cp## centripetal acceleration of P relative to C in cm/s**2\n", + "Caq=QA**2./qa## centripetal acceleration of A relative to Q in cm/s**2\n", + "Cap=Pa**2./pa## centripetal acceleration of A relative to P in cm/s**2\n", + "pp1=530.\n", + "a1a=323.\n", + "a2a=207.5\n", + "ACP=pp1/cp## angular acceleration of link CP in rad/s**2\n", + "APA=a1a/qa## angular acceleration of link PA in rad/s**2\n", + "AAQ=a2a/pa## angular acceleration of link AQ in rad/s**2\n", + "print'%s %.3f %s %.3f %s %.3f %s'%('angular acceleration of link CP =',ACP,' rad/s**2'' angular acceleration of link CP=',APA,' rad/s**2''angular acceleration of link CP=',AAQ,' rad/s**2')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "angular acceleration of link CP = 26.500 rad/s**2 angular acceleration of link CP= 32.300 rad/s**2angular acceleration of link CP= 41.500 rad/s**2\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter10.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter10.ipynb new file mode 100755 index 00000000..5ae48acb --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter10.ipynb @@ -0,0 +1,507 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5f892b8e3ed0a74f24a745bdf0e14528cdf96fe8388a860fc7931df67549db87" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter10-Brakes and Dynamometers" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 1 PAGE NO 268\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate torque transmitted by the block brake\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d=0.32;##Diameter of the drum in m\n", + "qq=90.;##Angle of contact in degree\n", + "P=820.;##Force applied in N\n", + "U=0.35;##Coefficient of friction\n", + "\n", + "\n", + "U1=((4.*U*math.sin(45/57.3))/((qq*(3.14/180.))+math.sin(90./57.3)));##Equivalent coefficient of friction\n", + "F=((P*0.66)/((0.3/U1)-0.06));##Force value in N taking moments\n", + "TB=(F*(d/2.));##Torque transmitted in N.m\n", + "\n", + "print'%s %.4f %s'%('Torque transmitted by the block brake is ',TB,' N.m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Torque transmitted by the block brake is 120.4553 N.m\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 2 PAGE NO 269\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate The bicycle travels a distance and makes turns before it comes to rest\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "m=120.;##Mass of rider in kg\n", + "v=16.2;##Speed of rider in km/hr\n", + "d=0.9;##Diameter of the wheel in m\n", + "P=120.;##Pressure applied on the brake in N\n", + "U=0.06;##Coefficient of friction\n", + "\n", + "F=(U*P);##Frictional force in N\n", + "KE=((m*(v*(5./18.))**2.)/2.);##Kinematic Energy in N.m\n", + "S=(KE/F);##Distance travelled by the bicycle before it comes to rest in m\n", + "N=(S/(d*3.14));##Required number of revolutions\n", + "\n", + "print'%s %.1f %s %.1f %s'%('The bicycle travels a distance of ',S,' m'and'',N,'turns before it comes to rest')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The bicycle travels a distance of 168.8 59.7 turns before it comes to rest\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 3 PAGE NO 270\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#evaluvate maximum torque absorbed\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "S=3500.;##Force on each arm in N\n", + "d=0.36;##Diamter of the wheel in m\n", + "U=0.4;##Coefficient of friction \n", + "qq=100.;##Contact angle in degree\n", + "\n", + "qqr=(qq*(3.14/180));##Contact angle in radians\n", + "UU=((4*U*math.sin(50/57.3))/(qqr+(math.sin(100./57.3))));##Equivalent coefficient of friction\n", + "F1=(S*0.45)/((0.2/UU)+((d/2.)-0.04));##Force on fulcrum in N\n", + "F2=(S*0.45)/((0.2/UU)-((d/2.)-0.04));##Force on fulcrum in N\n", + "TB=(F1+F2)*(d/2.);##Maximum torque absorbed in N.m\n", + "\n", + "print'%s %.2f %s'%('Maximum torque absorbed is ',TB,' N.m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum torque absorbed is 1412.67 N.m\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 4 PAGE NO 271\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate The maximum braking torque on the drum\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "a=0.5;##Length of lever in m\n", + "d=0.5;##Diameter of brake drum in m\n", + "q=(5/8.)*(2*3.14);##Angle made in radians\n", + "b=0.1;##Distance between pin and fulcrum in m\n", + "P=2000.;##Effort applied in N\n", + "U=0.25;##Coefficient of friction\n", + "\n", + "T=math.exp(U*q);##Ratios of tension\n", + "T2=((P*a)/b);##Tension in N\n", + "T1=(T*T2);##Tension in N\n", + "TB=((T1-T2)*(d/2.))/1000.;##Maximum braking torque in kNm\n", + "\n", + "print'%s %.2f %s'%('The maximum braking torque on the drum is',TB,' kNm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The maximum braking torque on the drum is 4.17 kNm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 5 PAGE NO 271\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#caculate the brake is self -locking and tension in the side \n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "q=220.;##Angle of contact in degree\n", + "T=340.;##Torque in Nm\n", + "d=0.32;##Diameter of drum in m\n", + "U=0.3;##Coefficient of friction\n", + "\n", + "Td=(T/(d/2.));##Difference in tensions in N\n", + "Tr=math.exp(U*(q*(3.14/180.)));##Ratio of tensions\n", + "T2=(Td/(Tr-1.));##Tension in N\n", + "T1=(Tr*T2);##Tension in N\n", + "P=((T2*(d/2.))-(T1*0.04))/0.5;##Force applied in N\n", + "b=(T1/T2)*4.;##Value of b in cm when the brake is self-locking\n", + "\n", + "print'%s %.2f %s %.2f %s %.2f %s '%('The value of b is ',b,' cm' 'when the brake is self-locking ' 'Tensions in the sides are ',T1,' N and',T2,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of b is 12.65 cmwhen the brake is self-locking Tensions in the sides are 3107.70 N and 982.70 N \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 6 PAGE NO 272\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate torque required and thickness necessary to limit the tensile stress to 70 and secton of the lever taking stress to 60 mpa\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d=0.5;##Drum diamter in m\n", + "U=0.3;##Coefficient of friction\n", + "q=250;##Angle of contact in degree\n", + "P=750;##Force in N\n", + "a=0.1;##Band width in m\n", + "b=0.8;##Distance in m\n", + "ft=(70*10**6);##Tensile stress in Pa\n", + "f=(60*10**6);##Stress in Pa\n", + "b1=0.1;##Distance in m\n", + "\n", + "T=math.exp(U*(q*(3.14/180.)));##Tensions ratio\n", + "T2=(P*b*10.)/(T+1.);##Tension in N\n", + "T1=(T*T2);##Tension in N\n", + "TB=(T1-T2)*(d/2.);##Torque in N.m\n", + "t=(max(T1,T2)/(ft*a))*1000.;##Thickness in mm\n", + "M=(P*b);##bending moment at fulcrum in Nm\n", + "X=(M/((1/6.)*f));##Value of th**2\n", + "##t varies from 10mm to 15 mm. Taking t=15mm,\n", + "h=math.sqrt(X/(0.015))*1000.;##Section of the lever in m\n", + "\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('Torque required is ',TB,' N.m' 'Thickness necessary to limit the tensile stress to 70 MPa is ',t,' mm ''Section of the lever taking stress to 60 MPa is ',h,' mm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Torque required is 861.7 N.mThickness necessary to limit the tensile stress to 70 MPa is 0.7 mm Section of the lever taking stress to 60 MPa is 63.2 mm\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg273" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 7 PAGE NO 273\n", + "##TITLE:Brakes and Dynamometers\n", + "#calculate value of x and value of power/bd ratio \n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "P1=30.;##Power in kW\n", + "N=1250.;##Speed in r.p.m\n", + "P=60.;##Applied force in N\n", + "d=0.8;##Drum diameter in m\n", + "q=310.;##Contact angle in degree\n", + "a=0.03;##Length of a in m\n", + "b=0.12;##Length of b in m\n", + "U=0.2;##Coefficient of friction\n", + "B=10.;##Band width in cm\n", + "D=80.;##Diameter in cm\n", + "\n", + "T=(P1*60000.)/(2.*3.14*N);##Torque in N.m\n", + "Td=(T/(d/2.));##Tension difference in N\n", + "Tr=math.exp(U*(q*(3.14/180.)));##Tensions ratio\n", + "T2=(Td/(Tr-1.));##Tension in N\n", + "T1=(Tr*T2);##Tension in N\n", + "x=((T2*b)-(T1*a))/P;##Distance in m;\n", + "X=(P1/(B*D));##Ratio\n", + "\n", + "print'%s %.3f %s %.3f %s'%('Value of x is ',x,' m '' Value of (Power/bD) ratio is ',X,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of x is 0.155 m Value of (Power/bD) ratio is 0.037 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg274" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 8 PAGE NO 274\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate time required to bring the shaft to the rest from its running condition\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "m=80.;##Mass of flywheel in kg\n", + "k=0.5;##Radius of gyration in m\n", + "N=250;##Speed in r.p.m\n", + "d=0.32;##Diamter of the drum in m\n", + "b=0.05;##Distance of pin in m\n", + "q=260.;##Angle of contact in degree\n", + "U=0.23;##Coefficient of friction\n", + "P=20;##Force in N\n", + "a=0.35;##Distance at which force is applied in m\n", + "\n", + "Tr=math.exp(U*q*(3.14/180.));##Tensions ratio\n", + "T2=(P*a)/b;##Tension in N\n", + "T1=(Tr*T2);##Tension in N\n", + "TB=(T1-T2)*(d/2.);##Torque in N.m\n", + "KE=((1/2.)*(m*k**2)*((2.*3.14*N)/60.)**2);##Kinematic energy of the rotating drum in Nm\n", + "N1=(KE/(TB*2.*3.14));##Speed in rpm\n", + "aa=((2*3.14*N)/60.)**2/(4.*3.14*N1);##Angular acceleration in rad/s**2\n", + "t=((2.*3.14*N)/60.)/aa;##Time in seconds\n", + "\n", + "print'%s %.1f %s'%('Time required to bring the shaft to the rest from its running condition is ',t,' seconds')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time required to bring the shaft to the rest from its running condition is 12.7 seconds\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg275" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 9 PAGE NO 275\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate Minimum force required and Time taken to bring to rest \n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "n=12.;##Number of blocks\n", + "q=15.;##Angle subtended in degree\n", + "P=185.;##Power in kW\n", + "N=300.;##Speed in r.p.m\n", + "U=0.25;##Coefficient of friction\n", + "d=1.25;##Diamter in m\n", + "b1=0.04;##Distance in m\n", + "b2=0.14;##Distance in m\n", + "a=1.;##Diatance in m\n", + "m=2400.;##Mass of rotor in kg\n", + "k=0.5;##Radius of gyration in m\n", + "\n", + "Td=(P*60000.)/(2.*3.14*N*(d/2.));##Tension difference in N\n", + "T=Td*(d/2.);##Torque in Nm\n", + "Tr=((1+(U*math.tan(7.5/57.3)))/(1.-(U*math.tan(7.5/57.3))))**n;##Tension ratio\n", + "To=(Td/(Tr-1.));##Tension in N\n", + "Tn=(Tr*To);##Tension in N\n", + "P=((To*b2)-(Tn*b1))/a;##Force in N\n", + "aa=(T/(m*k**2));##Angular acceleration in rad/s**2\n", + "t=((2*3.14*N)/60.)/aa;##Time in seconds\n", + "\n", + "print'%s %.1f %s %.1f %s'%('Minimum force required is ',P,' N' 'Time taken to bring to rest is ',t,' seconds')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Minimum force required is 406.1 NTime taken to bring to rest is 3.2 seconds\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg275" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 10 PAGE NO 275\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate Maximum braking torque and Angular retardation of the drum and Time taken by the system to come to rest \n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "n=12.;## Number of blocks\n", + "q=16.;##Angle subtended in degrees\n", + "d=0.9;##Effective diameter in m\n", + "m=2000.;##Mass in kg\n", + "k=0.5;##Radius of gyration in m\n", + "b1=0.7;##Distance in m\n", + "b2=0.03;##Distance in m\n", + "a=0.1;##Distance in m\n", + "P=180.;##Force in N\n", + "N=360.;##Speed in r.p.m\n", + "U=0.25;##Coefficient of friction\n", + "\n", + "Tr=((1.+(U*math.tan(8/57.3)))/(1.-(U*math.tan(8/57.3))))**n;##Tensions ratio\n", + "T2=(P*b1)/(a-(b2*Tr));##Tension in N\n", + "T1=(Tr*T2);##Tension in N\n", + "TB=(T1-T2)*(d/2.);##Torque in N.m\n", + "aa=(TB/(m*k**2.));##Angular acceleration in rad/s**2\n", + "t=((2.*3.14*N)/60.)/aa;##Time in seconds\n", + "\n", + "print'%s %.2f %s %.2f %s %.2f %s '%('(i) Maximum braking torque is ',TB,'Nm ''(ii) Angular retardation of the drum is ',aa,' rad/s**2''(iii) Time taken by the system to come to rest is ',t,' s')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Maximum braking torque is 2481.63 Nm (ii) Angular retardation of the drum is 4.96 rad/s**2(iii) Time taken by the system to come to rest is 7.59 s \n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter10_1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter10_1.ipynb new file mode 100755 index 00000000..daac213e --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter10_1.ipynb @@ -0,0 +1,507 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:657f291c53014a3c65d40f4bd27d5c5b11c86f39d42c3963b0caf443f608f132" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter10-Brakes and Dynamometers" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 1 PAGE NO 268\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate torque transmitted by the block brake\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d=0.32;##Diameter of the drum in m\n", + "qq=90.;##Angle of contact in degree\n", + "P=820.;##Force applied in N\n", + "U=0.35;##Coefficient of friction\n", + "\n", + "\n", + "U1=((4.*U*math.sin(45/57.3))/((qq*(3.14/180.))+math.sin(90./57.3)));##Equivalent coefficient of friction\n", + "F=((P*0.66)/((0.3/U1)-0.06));##Force value in N taking moments\n", + "TB=(F*(d/2.));##Torque transmitted in N.m\n", + "\n", + "print'%s %.4f %s'%('Torque transmitted by the block brake is ',TB,' N.m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Torque transmitted by the block brake is 120.4553 N.m\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 2 PAGE NO 269\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate The bicycle travels a distance and makes turns before it comes to rest\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "m=120.;##Mass of rider in kg\n", + "v=16.2;##Speed of rider in km/hr\n", + "d=0.9;##Diameter of the wheel in m\n", + "P=120.;##Pressure applied on the brake in N\n", + "U=0.06;##Coefficient of friction\n", + "\n", + "F=(U*P);##Frictional force in N\n", + "KE=((m*(v*(5./18.))**2.)/2.);##Kinematic Energy in N.m\n", + "S=(KE/F);##Distance travelled by the bicycle before it comes to rest in m\n", + "N=(S/(d*3.14));##Required number of revolutions\n", + "\n", + "print'%s %.1f %s %.1f %s'%('The bicycle travels a distance of ',S,' m'and'',N,'turns before it comes to rest')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The bicycle travels a distance of 168.8 59.7 turns before it comes to rest\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 3 PAGE NO 270\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#evaluvate maximum torque absorbed\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "S=3500.;##Force on each arm in N\n", + "d=0.36;##Diamter of the wheel in m\n", + "U=0.4;##Coefficient of friction \n", + "qq=100.;##Contact angle in degree\n", + "\n", + "qqr=(qq*(3.14/180));##Contact angle in radians\n", + "UU=((4*U*math.sin(50/57.3))/(qqr+(math.sin(100./57.3))));##Equivalent coefficient of friction\n", + "F1=(S*0.45)/((0.2/UU)+((d/2.)-0.04));##Force on fulcrum in N\n", + "F2=(S*0.45)/((0.2/UU)-((d/2.)-0.04));##Force on fulcrum in N\n", + "TB=(F1+F2)*(d/2.);##Maximum torque absorbed in N.m\n", + "\n", + "print'%s %.2f %s'%('Maximum torque absorbed is ',TB,' N.m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum torque absorbed is 1412.67 N.m\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 4 PAGE NO 271\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate The maximum braking torque on the drum\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "a=0.5;##Length of lever in m\n", + "d=0.5;##Diameter of brake drum in m\n", + "q=(5/8.)*(2*3.14);##Angle made in radians\n", + "b=0.1;##Distance between pin and fulcrum in m\n", + "P=2000.;##Effort applied in N\n", + "U=0.25;##Coefficient of friction\n", + "\n", + "T=math.exp(U*q);##Ratios of tension\n", + "T2=((P*a)/b);##Tension in N\n", + "T1=(T*T2);##Tension in N\n", + "TB=((T1-T2)*(d/2.))/1000.;##Maximum braking torque in kNm\n", + "\n", + "print'%s %.2f %s'%('The maximum braking torque on the drum is',TB,' kNm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The maximum braking torque on the drum is 4.17 kNm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 5 PAGE NO 271\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#caculate the brake is self -locking and tension in the side \n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "q=220.;##Angle of contact in degree\n", + "T=340.;##Torque in Nm\n", + "d=0.32;##Diameter of drum in m\n", + "U=0.3;##Coefficient of friction\n", + "\n", + "Td=(T/(d/2.));##Difference in tensions in N\n", + "Tr=math.exp(U*(q*(3.14/180.)));##Ratio of tensions\n", + "T2=(Td/(Tr-1.));##Tension in N\n", + "T1=(Tr*T2);##Tension in N\n", + "P=((T2*(d/2.))-(T1*0.04))/0.5;##Force applied in N\n", + "b=(T1/T2)*4.;##Value of b in cm when the brake is self-locking\n", + "\n", + "print'%s %.2f %s %.2f %s %.2f %s '%('The value of b is ',b,' cm' 'when the brake is self-locking ' 'Tensions in the sides are ',T1,' N and',T2,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of b is 12.65 cmwhen the brake is self-locking Tensions in the sides are 3107.70 N and 982.70 N \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 6 PAGE NO 272\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate torque required and thickness necessary to limit the tensile stress to 70 and secton of the lever taking stress to 60 mpa\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d=0.5;##Drum diamter in m\n", + "U=0.3;##Coefficient of friction\n", + "q=250;##Angle of contact in degree\n", + "P=750;##Force in N\n", + "a=0.1;##Band width in m\n", + "b=0.8;##Distance in m\n", + "ft=(70*10**6);##Tensile stress in Pa\n", + "f=(60*10**6);##Stress in Pa\n", + "b1=0.1;##Distance in m\n", + "\n", + "T=math.exp(U*(q*(3.14/180.)));##Tensions ratio\n", + "T2=(P*b*10.)/(T+1.);##Tension in N\n", + "T1=(T*T2);##Tension in N\n", + "TB=(T1-T2)*(d/2.);##Torque in N.m\n", + "t=(max(T1,T2)/(ft*a))*1000.;##Thickness in mm\n", + "M=(P*b);##bending moment at fulcrum in Nm\n", + "X=(M/((1/6.)*f));##Value of th**2\n", + "##t varies from 10mm to 15 mm. Taking t=15mm,\n", + "h=math.sqrt(X/(0.015))*1000.;##Section of the lever in m\n", + "\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('Torque required is ',TB,' N.m' 'Thickness necessary to limit the tensile stress to 70 MPa is ',t,' mm ''Section of the lever taking stress to 60 MPa is ',h,' mm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Torque required is 861.7 N.mThickness necessary to limit the tensile stress to 70 MPa is 0.7 mm Section of the lever taking stress to 60 MPa is 63.2 mm\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg273" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 7 PAGE NO 273\n", + "##TITLE:Brakes and Dynamometers\n", + "#calculate value of x and value of power/bd ratio \n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "P1=30.;##Power in kW\n", + "N=1250.;##Speed in r.p.m\n", + "P=60.;##Applied force in N\n", + "d=0.8;##Drum diameter in m\n", + "q=310.;##Contact angle in degree\n", + "a=0.03;##Length of a in m\n", + "b=0.12;##Length of b in m\n", + "U=0.2;##Coefficient of friction\n", + "B=10.;##Band width in cm\n", + "D=80.;##Diameter in cm\n", + "\n", + "T=(P1*60000.)/(2.*3.14*N);##Torque in N.m\n", + "Td=(T/(d/2.));##Tension difference in N\n", + "Tr=math.exp(U*(q*(3.14/180.)));##Tensions ratio\n", + "T2=(Td/(Tr-1.));##Tension in N\n", + "T1=(Tr*T2);##Tension in N\n", + "x=((T2*b)-(T1*a))/P;##Distance in m;\n", + "X=(P1/(B*D));##Ratio\n", + "\n", + "print'%s %.3f %s %.3f %s'%('Value of x is ',x,' m '' Value of (Power/bD) ratio is ',X,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of x is 0.155 m Value of (Power/bD) ratio is 0.037 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg274" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 8 PAGE NO 274\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate time required to bring the shaft to the rest from its running condition\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "m=80.;##Mass of flywheel in kg\n", + "k=0.5;##Radius of gyration in m\n", + "N=250;##Speed in r.p.m\n", + "d=0.32;##Diamter of the drum in m\n", + "b=0.05;##Distance of pin in m\n", + "q=260.;##Angle of contact in degree\n", + "U=0.23;##Coefficient of friction\n", + "P=20;##Force in N\n", + "a=0.35;##Distance at which force is applied in m\n", + "\n", + "Tr=math.exp(U*q*(3.14/180.));##Tensions ratio\n", + "T2=(P*a)/b;##Tension in N\n", + "T1=(Tr*T2);##Tension in N\n", + "TB=(T1-T2)*(d/2.);##Torque in N.m\n", + "KE=((1/2.)*(m*k**2)*((2.*3.14*N)/60.)**2);##Kinematic energy of the rotating drum in Nm\n", + "N1=(KE/(TB*2.*3.14));##Speed in rpm\n", + "aa=((2*3.14*N)/60.)**2/(4.*3.14*N1);##Angular acceleration in rad/s**2\n", + "t=((2.*3.14*N)/60.)/aa;##Time in seconds\n", + "\n", + "print'%s %.1f %s'%('Time required to bring the shaft to the rest from its running condition is ',t,' seconds')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time required to bring the shaft to the rest from its running condition is 12.7 seconds\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg275" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 9 PAGE NO 275\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate Minimum force required and Time taken to bring to rest \n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "n=12.;##Number of blocks\n", + "q=15.;##Angle subtended in degree\n", + "P=185.;##Power in kW\n", + "N=300.;##Speed in r.p.m\n", + "U=0.25;##Coefficient of friction\n", + "d=1.25;##Diamter in m\n", + "b1=0.04;##Distance in m\n", + "b2=0.14;##Distance in m\n", + "a=1.;##Diatance in m\n", + "m=2400.;##Mass of rotor in kg\n", + "k=0.5;##Radius of gyration in m\n", + "\n", + "Td=(P*60000.)/(2.*3.14*N*(d/2.));##Tension difference in N\n", + "T=Td*(d/2.);##Torque in Nm\n", + "Tr=((1+(U*math.tan(7.5/57.3)))/(1.-(U*math.tan(7.5/57.3))))**n;##Tension ratio\n", + "To=(Td/(Tr-1.));##Tension in N\n", + "Tn=(Tr*To);##Tension in N\n", + "P=((To*b2)-(Tn*b1))/a;##Force in N\n", + "aa=(T/(m*k**2));##Angular acceleration in rad/s**2\n", + "t=((2*3.14*N)/60.)/aa;##Time in seconds\n", + "\n", + "print'%s %.1f %s %.1f %s'%('Minimum force required is ',P,' N' 'Time taken to bring to rest is ',t,' seconds')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Minimum force required is 406.1 NTime taken to bring to rest is 3.2 seconds\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg275" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 10 ILLUSRTATION 10 PAGE NO 275\n", + "##TITLE:Brakes and Dynamometers\n", + "import math\n", + "#calculate Maximum braking torque and Angular retardation of the drum and Time taken by the system to come to rest \n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "n=12.;## Number of blocks\n", + "q=16.;##Angle subtended in degrees\n", + "d=0.9;##Effective diameter in m\n", + "m=2000.;##Mass in kg\n", + "k=0.5;##Radius of gyration in m\n", + "b1=0.7;##Distance in m\n", + "b2=0.03;##Distance in m\n", + "a=0.1;##Distance in m\n", + "P=180.;##Force in N\n", + "N=360.;##Speed in r.p.m\n", + "U=0.25;##Coefficient of friction\n", + "\n", + "Tr=((1.+(U*math.tan(8/57.3)))/(1.-(U*math.tan(8/57.3))))**n;##Tensions ratio\n", + "T2=(P*b1)/(a-(b2*Tr));##Tension in N\n", + "T1=(Tr*T2);##Tension in N\n", + "TB=(T1-T2)*(d/2.);##Torque in N.m\n", + "aa=(TB/(m*k**2.));##Angular acceleration in rad/s**2\n", + "t=((2.*3.14*N)/60.)/aa;##Time in seconds\n", + "\n", + "print'%s %.2f %s %.2f %s %.2f %s '%('(i) Maximum braking torque is ',TB,'Nm ''(ii) Angular retardation of the drum is ',aa,' rad/s**2''(iii) Time taken by the system to come to rest is ',t,' s')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Maximum braking torque is 2481.63 Nm (ii) Angular retardation of the drum is 4.96 rad/s**2(iii) Time taken by the system to come to rest is 7.59 s \n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter11.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter11.ipynb new file mode 100755 index 00000000..ec8d5927 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter11.ipynb @@ -0,0 +1,450 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ebcd9b3d07a8d6768db168aed38e578ce5aca1ce1a2df85108f9e88506949f89" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter11-VIBRATIONS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg290" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 1 PAGE NO 290\n", + "##TITLE:VIBRATIONS\n", + "import math\n", + "#calculate frequency of longitudinal vibration and transversve vibaration\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "D=.1## DIAMETER OF SHAFT IN m\n", + "L=1.10## LENGTH OF SHAFT IN m\n", + "W=450## WEIGHT ON THE OTHER END OF SHAFT IN NEWTONS\n", + "E=200*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "## =========================================================================================\n", + "A=PI*D**2./4.## AREA OF SHAFT IN mm**2\n", + "I=PI*D**4./64.## MOMENT OF INERTIA \n", + "delta=W*L/(A*E)## STATIC DEFLECTION IN LONGITUDINAL VIBRATION OF SHAFT IN m\n", + "Fn=0.4985/(delta)**.5## FREQUENCY OF LONGITUDINAL VIBRATION IN Hz\n", + "delta1=W*L**3./(3.*E*I)## STATIC DEFLECTION IN TRANSVERSE VIBRATION IN m\n", + "Fn1=0.4985/(delta1)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", + "##============================================================================================\n", + "##OUTPUT\n", + "print'%s %.2f %s %.2f %s '%('FREQUENCY OF LONGITUDINAL VIBRATION =',Fn,' Hz' 'FREQUENCY OF TRANSVERSE VIBRATION =',Fn1,'Hz')\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FREQUENCY OF LONGITUDINAL VIBRATION = 888.78 HzFREQUENCY OF TRANSVERSE VIBRATION = 34.99 Hz \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg290" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 2 PAGE NO 290\n", + "##TITLE:VIBRATIONS\n", + "##FIGURE 11.10\n", + "#calculate natural frequency of transverse vibration\n", + "#import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "L=.9## LENGTH OF THE SHAFT IN m\n", + "m=100## MASS OF THE BODY IN Kg\n", + "L2=.3## LENGTH WHERE THE WEIGHT IS ACTING IN m\n", + "L1=L-L2## DISTANCE FROM THE OTHER END\n", + "D=.06## DIAMETER OF SHAFT IN m\n", + "W=9.81*m## WEGHT IN NEWTON\n", + "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "##==========================================================================================\n", + "##CALCULATION\n", + "I=PI*D**4./64.## MOMENT OF INERTIA IN m**4\n", + "delta=W*L1**2*L2**2./(3.*E*I*L)## STATIC DEFLECTION\n", + "Fn=.4985/(delta)**.5## NATURAL FREQUENCY OF TRANSVERSE VIBRATION\n", + "##=========================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('NATURAL FREQUENCY OF TRANSVERSE VIBRATION=',Fn,' Hz')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "NATURAL FREQUENCY OF TRANSVERSE VIBRATION= 51.9 Hz\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg291" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 3 PAGE NO 291 ##TITLE:VIBRATIONS\n", + "##FIGURE 11.11\n", + "import math\n", + "#calculate frequency of longitudnial vibration and frequency of transverse vibration and torisional vibration\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", + "D=.050## DIAMETER OF SHAFT IN m\n", + "m=450## WEIGHT OF FLY WHEEL IN IN Kg\n", + "K=.5## RADIUS OF GYRATION IN m\n", + "L2=.6## FROM FIGURE IN m\n", + "L1=.9## FROM FIGURE IN m\n", + "L=L1+L2\n", + "E=200.*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "C=84.*10**9## MODUKUS OF RIDITY OF SHAFT MATERIAL IN Pascals\n", + "##=========================================================================================\n", + "A=PI*D**2./4.## AREA OF SHAFT IN mm**2\n", + "I=PI*D**4./64.## \n", + "m1=m*L2/(L1+L2)## MASS OF THE FLYWHEEL CARRIED BY THE LENGTH L1 IN Kg\n", + "DELTA=m1*g*L1/(A*E)## EXTENSION OF LENGTH L1 IN m\n", + "Fn=0.4985/(DELTA)**.5## FREQUENCY OF LONGITUDINAL VIBRATION IN Hz\n", + "DELTA1=(m*g*L1**3*L2**3)/(3*E*I*L**3)## STATIC DEFLECTION IN TRANSVERSE VIBRATION IN m\n", + "Fn1=0.4985/(DELTA1)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", + "J=PI*D**4./32.## POLAR MOMENT OF INERTIA IN m**4\n", + "Q1=C*J/L1## TORSIONAL STIFFNESS OF SHAFT DUE TO L1 IN N-m\n", + "Q2=C*J/L2## TORSIONAL STIFFNESS OF SHAFT DUE TO L2 IN N-m\n", + "Q=Q1+Q2## TORSIONAL STIFFNESS OF SHAFT IN Nm\n", + "Fn2=(Q/(m*K**2))**.5/(2.*PI)## FREQUENCY OF TORSIONAL VIBRATION IN Hz\n", + "##=======================================================================================\n", + "print'%s %.3f %s %.3f %s %.3f %s '%('FREQUENCY OF LONGITUDINAL VIBRATION = ',Fn,' Hz''FREQUENCY OF TRANSVERSE VIBRATION = ',Fn1,' Hz'' FREQUENCY OF TORSIONAL VIBRATION = ',Fn2,' Hz')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FREQUENCY OF LONGITUDINAL VIBRATION = 248.014 HzFREQUENCY OF TRANSVERSE VIBRATION = 14.916 Hz FREQUENCY OF TORSIONAL VIBRATION = 5.673 Hz \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg294" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 6 PAGE NO 294\n", + "##TITLE:VIBRATIONS\n", + "##FIGURE 11.14\n", + "import math\n", + "#calculate frequency of transverse vibration\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", + "D=.06## DIAMETER OF SHAFT IN m\n", + "L=3.## LENGTH OF SHAFT IN m\n", + "W1=1500.## WEIGHT ACTING AT C IN N\n", + "W2=2000.## WEIGHT ACTING AT D IN N\n", + "W3=1000.## WEIGHT ACTING AT E IN N\n", + "L1=1.## LENGTH FROM A TO C IN m\n", + "L2=2.## LENGTH FROM A TO D IN m\n", + "L3=2.5## LENGTH FROM A TO E IN m\n", + "I=PI*D**4./64.\n", + "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "##===========================================================================================\n", + "DELTA1=W1*L1**2.*(L-L1)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W1\n", + "DELTA2=W2*L2**2.*(L-L2)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", + "DELTA3=W2*L3**2.*(L-L3)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", + "Fn=.4985/(DELTA1+DELTA2+DELTA3)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", + "##==========================================================================================\n", + "print'%s %.3f %s'%('FREQUENCY OF TRANSVERSE VIBRATION = ',Fn,' Hz')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FREQUENCY OF TRANSVERSE VIBRATION = 4.080 Hz\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg296" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 10 PAGE NO 296\n", + "##TITLE:VIBRATIONS\n", + "##FIGURE 11.18\n", + "import math\n", + "#calculate FREQUENCY OF TRANSVERSE VIBRATION\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", + "E=200.*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "D=.03## DIAMETER OF SHAFT IN m\n", + "L=.8## LENGTH OF SHAFT IN m\n", + "r=40000.## DENSITY OF SHAFT MATERIAL IN Kg/m**3\n", + "W=10.## WEIGHT ACTING AT CENTRE IN N\n", + "##===========================================================================================\n", + "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", + "m=PI*D**2./4.*r## MASS PER UNIT LENGTH IN Kg/m\n", + "w=m*g\n", + "DELTA=W*L**3./(48.*E*I)## STATIC DEFLECTION DUE TO W\n", + "DELTA1=5.*w*L**4./(384.*E*I)## STATIC DEFLECTION DUE TO WEIGHT OF SHAFT \n", + "Fn=.4985/(DELTA+DELTA1/1.27)**.5\n", + "##==========================================================================================\n", + "print'%s %.3f %s'%('FREQUENCY OF TRANSVERSE VIBRATION = ',Fn,' Hz')\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FREQUENCY OF TRANSVERSE VIBRATION = 39.426 Hz\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg297" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 11 PAGE NO 297\n", + "##TITLE:VIBRATIONS\n", + "##FIGURE 11.19\n", + "import math\n", + "#evaluvate CRITICAL SPEED OF SHAFT\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", + "E=210.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "D=.18## DIAMETER OF SHAFT IN m\n", + "L=2.5## LENGTH OF SHAFT IN m\n", + "M1=25.## MASS ACTING AT E IN Kg\n", + "M2=50.## MASS ACTING AT D IN Kg\n", + "M3=20.## MASS ACTING AT C IN Kg\n", + "W1=M1*g\n", + "W2=M2*g\n", + "W3=M3*g\n", + "L1=.6## LENGTH FROM A TO E IN m\n", + "L2=1.5## LENGTH FROM A TO D IN m\n", + "L3=2.## LENGTH FROM A TO C IN m\n", + "w=1962.## SELF WEIGHT OF SHAFT IN N\n", + "##==========================================================================================\n", + "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", + "DELTA1=W1*L1**2.*(L-L1)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W1\n", + "DELTA2=W2*L2**2.*(L-L2)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", + "DELTA3=W3*L3**2.*(L-L3)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W3\n", + "DELTA4=5.*w*L**4./(384.*E*I)## STATIC DEFLECTION DUE TO w\n", + "Fn=.4985/(DELTA1+DELTA2+DELTA3+DELTA4/1.27)**.5\n", + "Nc=Fn*60## CRITICAL SPEED OF SHAFT IN rpm\n", + "##========================================================================================\n", + "print'%s %.3f %s'%('CRITICAL SPEED OF SHAFT = ',Nc,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "CRITICAL SPEED OF SHAFT = 3111.629 rpm\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg298" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 12 PAGE NO 298\n", + "##TITLE:VIBRATIONS\n", + "##FIGURE 11.20\n", + "import math\n", + "#calculate FREQUENCY OF FREE TORSIONAL VIBRATION\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", + "Na=1500.## SPEED OF SHAFT A IN rpm\n", + "Nb=500.## SPEED OF SHAFT B IN rpm\n", + "G=Na/Nb## GERA RATIO\n", + "L1=.18## LENGTH OF SHAFT 1 IN m\n", + "L2=.45## LENGTH OF SHAFT 2 IN m\n", + "D1=.045## DIAMETER OF SHAFT 1 IN m\n", + "D2=.09## DIAMETER OF SHAFT 2 IN m\n", + "C=84.*10**9## MODUKUS OF RIDITY OF SHAFT MATERIAL IN Pascals\n", + "Ib=1400.## MOMENT OF INERTIA OF PUMP IN Kg-m**2\n", + "Ia=400.## MOMENT OF INERTIA OF MOTOR IN Kg-m**2\n", + "\n", + "##======================================================================================\n", + "J=PI*D1**4./32.## POLAR MOMENT OF INERTIA IN m**4\n", + "Ib1=Ib/G**2.## MASS MOMENT OF INERTIA OF EQUIVALENT ROTOR IN m**2\n", + "L3=G**2.*L2*(D1/D2)**4.## ADDITIONAL LENGTH OF THE EQUIVALENT SHAFT\n", + "L=L1+L3## TOTAL LENGTH OF EQUIVALENT SHAFT\n", + "La=L*Ib1/(Ia+Ib1)\n", + "Fn=(C*J/(La*Ia))**.5/(2.*PI)## FREQUENCY OF FREE TORSIONAL VIBRATION IN Hz\n", + "##===================================================================================\n", + "print'%s %.2f %s'%('FREQUENCY OF FREE TORSIONAL VIBRATION = ',Fn,' Hz')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FREQUENCY OF FREE TORSIONAL VIBRATION = 4.20 Hz\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg300" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 13 PAGE NO 300\n", + "##TITLE:VIBRATIONS\n", + "##FIGURE 11.21\n", + "import math\n", + "#calculate critical speed of shaft and the range of speed \n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", + "D=.015## DIAMETER OF SHAFT IN m\n", + "L=1.00## LENGTH OF SHAFT IN m\n", + "M=15.## MASS OF SHAFT IN Kg\n", + "W=M*g\n", + "e=.0003## ECCENTRICITY IN m\n", + "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "f=70.*10**6.## PERMISSIBLE STRESS IN N/m**2\n", + "##============================================================================================\n", + "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", + "DELTA=W*L**3./(192.*E*I)## STATIC DEFLECTION IN m\n", + "Fn=.4985/(DELTA)**.5## NATURAL FREQUENCY OF TRANSVERSE VIBRATION\n", + "Nc=Fn*60.## CRITICAL SPEED OF SHAFT IN rpm\n", + "M1=16.*f*I/(D*g*L)\n", + "W1=M1*g## ADDITIONAL LOAD ACTING\n", + "y=W1/W*DELTA## ADDITIONAL DEFLECTION DUE TO W1\n", + "N1=Nc/(1.+e/y)**.5## MIN SPEED IN rpm\n", + "N2=Nc/(1.-e/y)**.5## MAX SPEED IN rpm\n", + "##===========================================================================================\n", + "print'%s %.3f %s %.3f %s %.3f %s '%('CRITICAL SPEED OF SHAFT = ',Nc,' rpm''THE RANGE OF SPEED IS FROM',N1,'rpm TO ',N2,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "CRITICAL SPEED OF SHAFT = 762.330 rpmTHE RANGE OF SPEED IS FROM 709.555 rpm TO 828.955 rpm \n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter11_1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter11_1.ipynb new file mode 100755 index 00000000..fc94788e --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter11_1.ipynb @@ -0,0 +1,450 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:34645615139cc7e48e6be9d702d9a64020fce36a78eda34f91d7b4cd597045b1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter11-Vibrations" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg290" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 1 PAGE NO 290\n", + "##TITLE:VIBRATIONS\n", + "import math\n", + "#calculate frequency of longitudinal vibration and transversve vibaration\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "D=.1## DIAMETER OF SHAFT IN m\n", + "L=1.10## LENGTH OF SHAFT IN m\n", + "W=450## WEIGHT ON THE OTHER END OF SHAFT IN NEWTONS\n", + "E=200*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "## =========================================================================================\n", + "A=PI*D**2./4.## AREA OF SHAFT IN mm**2\n", + "I=PI*D**4./64.## MOMENT OF INERTIA \n", + "delta=W*L/(A*E)## STATIC DEFLECTION IN LONGITUDINAL VIBRATION OF SHAFT IN m\n", + "Fn=0.4985/(delta)**.5## FREQUENCY OF LONGITUDINAL VIBRATION IN Hz\n", + "delta1=W*L**3./(3.*E*I)## STATIC DEFLECTION IN TRANSVERSE VIBRATION IN m\n", + "Fn1=0.4985/(delta1)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", + "##============================================================================================\n", + "##OUTPUT\n", + "print'%s %.2f %s %.2f %s '%('FREQUENCY OF LONGITUDINAL VIBRATION =',Fn,' Hz' 'FREQUENCY OF TRANSVERSE VIBRATION =',Fn1,'Hz')\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FREQUENCY OF LONGITUDINAL VIBRATION = 888.78 HzFREQUENCY OF TRANSVERSE VIBRATION = 34.99 Hz \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg290" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 2 PAGE NO 290\n", + "##TITLE:VIBRATIONS\n", + "##FIGURE 11.10\n", + "#calculate natural frequency of transverse vibration\n", + "#import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "L=.9## LENGTH OF THE SHAFT IN m\n", + "m=100## MASS OF THE BODY IN Kg\n", + "L2=.3## LENGTH WHERE THE WEIGHT IS ACTING IN m\n", + "L1=L-L2## DISTANCE FROM THE OTHER END\n", + "D=.06## DIAMETER OF SHAFT IN m\n", + "W=9.81*m## WEGHT IN NEWTON\n", + "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "##==========================================================================================\n", + "##CALCULATION\n", + "I=PI*D**4./64.## MOMENT OF INERTIA IN m**4\n", + "delta=W*L1**2*L2**2./(3.*E*I*L)## STATIC DEFLECTION\n", + "Fn=.4985/(delta)**.5## NATURAL FREQUENCY OF TRANSVERSE VIBRATION\n", + "##=========================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('NATURAL FREQUENCY OF TRANSVERSE VIBRATION=',Fn,' Hz')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "NATURAL FREQUENCY OF TRANSVERSE VIBRATION= 51.9 Hz\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg291" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 3 PAGE NO 291 ##TITLE:VIBRATIONS\n", + "##FIGURE 11.11\n", + "import math\n", + "#calculate frequency of longitudnial vibration and frequency of transverse vibration and torisional vibration\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", + "D=.050## DIAMETER OF SHAFT IN m\n", + "m=450## WEIGHT OF FLY WHEEL IN IN Kg\n", + "K=.5## RADIUS OF GYRATION IN m\n", + "L2=.6## FROM FIGURE IN m\n", + "L1=.9## FROM FIGURE IN m\n", + "L=L1+L2\n", + "E=200.*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "C=84.*10**9## MODUKUS OF RIDITY OF SHAFT MATERIAL IN Pascals\n", + "##=========================================================================================\n", + "A=PI*D**2./4.## AREA OF SHAFT IN mm**2\n", + "I=PI*D**4./64.## \n", + "m1=m*L2/(L1+L2)## MASS OF THE FLYWHEEL CARRIED BY THE LENGTH L1 IN Kg\n", + "DELTA=m1*g*L1/(A*E)## EXTENSION OF LENGTH L1 IN m\n", + "Fn=0.4985/(DELTA)**.5## FREQUENCY OF LONGITUDINAL VIBRATION IN Hz\n", + "DELTA1=(m*g*L1**3*L2**3)/(3*E*I*L**3)## STATIC DEFLECTION IN TRANSVERSE VIBRATION IN m\n", + "Fn1=0.4985/(DELTA1)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", + "J=PI*D**4./32.## POLAR MOMENT OF INERTIA IN m**4\n", + "Q1=C*J/L1## TORSIONAL STIFFNESS OF SHAFT DUE TO L1 IN N-m\n", + "Q2=C*J/L2## TORSIONAL STIFFNESS OF SHAFT DUE TO L2 IN N-m\n", + "Q=Q1+Q2## TORSIONAL STIFFNESS OF SHAFT IN Nm\n", + "Fn2=(Q/(m*K**2))**.5/(2.*PI)## FREQUENCY OF TORSIONAL VIBRATION IN Hz\n", + "##=======================================================================================\n", + "print'%s %.3f %s %.3f %s %.3f %s '%('FREQUENCY OF LONGITUDINAL VIBRATION = ',Fn,' Hz''FREQUENCY OF TRANSVERSE VIBRATION = ',Fn1,' Hz'' FREQUENCY OF TORSIONAL VIBRATION = ',Fn2,' Hz')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FREQUENCY OF LONGITUDINAL VIBRATION = 248.014 HzFREQUENCY OF TRANSVERSE VIBRATION = 14.916 Hz FREQUENCY OF TORSIONAL VIBRATION = 5.673 Hz \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg294" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 6 PAGE NO 294\n", + "##TITLE:VIBRATIONS\n", + "##FIGURE 11.14\n", + "import math\n", + "#calculate frequency of transverse vibration\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", + "D=.06## DIAMETER OF SHAFT IN m\n", + "L=3.## LENGTH OF SHAFT IN m\n", + "W1=1500.## WEIGHT ACTING AT C IN N\n", + "W2=2000.## WEIGHT ACTING AT D IN N\n", + "W3=1000.## WEIGHT ACTING AT E IN N\n", + "L1=1.## LENGTH FROM A TO C IN m\n", + "L2=2.## LENGTH FROM A TO D IN m\n", + "L3=2.5## LENGTH FROM A TO E IN m\n", + "I=PI*D**4./64.\n", + "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "##===========================================================================================\n", + "DELTA1=W1*L1**2.*(L-L1)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W1\n", + "DELTA2=W2*L2**2.*(L-L2)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", + "DELTA3=W2*L3**2.*(L-L3)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", + "Fn=.4985/(DELTA1+DELTA2+DELTA3)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", + "##==========================================================================================\n", + "print'%s %.3f %s'%('FREQUENCY OF TRANSVERSE VIBRATION = ',Fn,' Hz')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FREQUENCY OF TRANSVERSE VIBRATION = 4.080 Hz\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg296" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 10 PAGE NO 296\n", + "##TITLE:VIBRATIONS\n", + "##FIGURE 11.18\n", + "import math\n", + "#calculate FREQUENCY OF TRANSVERSE VIBRATION\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", + "E=200.*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "D=.03## DIAMETER OF SHAFT IN m\n", + "L=.8## LENGTH OF SHAFT IN m\n", + "r=40000.## DENSITY OF SHAFT MATERIAL IN Kg/m**3\n", + "W=10.## WEIGHT ACTING AT CENTRE IN N\n", + "##===========================================================================================\n", + "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", + "m=PI*D**2./4.*r## MASS PER UNIT LENGTH IN Kg/m\n", + "w=m*g\n", + "DELTA=W*L**3./(48.*E*I)## STATIC DEFLECTION DUE TO W\n", + "DELTA1=5.*w*L**4./(384.*E*I)## STATIC DEFLECTION DUE TO WEIGHT OF SHAFT \n", + "Fn=.4985/(DELTA+DELTA1/1.27)**.5\n", + "##==========================================================================================\n", + "print'%s %.3f %s'%('FREQUENCY OF TRANSVERSE VIBRATION = ',Fn,' Hz')\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FREQUENCY OF TRANSVERSE VIBRATION = 39.426 Hz\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg297" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 11 PAGE NO 297\n", + "##TITLE:VIBRATIONS\n", + "##FIGURE 11.19\n", + "import math\n", + "#evaluvate CRITICAL SPEED OF SHAFT\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", + "E=210.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "D=.18## DIAMETER OF SHAFT IN m\n", + "L=2.5## LENGTH OF SHAFT IN m\n", + "M1=25.## MASS ACTING AT E IN Kg\n", + "M2=50.## MASS ACTING AT D IN Kg\n", + "M3=20.## MASS ACTING AT C IN Kg\n", + "W1=M1*g\n", + "W2=M2*g\n", + "W3=M3*g\n", + "L1=.6## LENGTH FROM A TO E IN m\n", + "L2=1.5## LENGTH FROM A TO D IN m\n", + "L3=2.## LENGTH FROM A TO C IN m\n", + "w=1962.## SELF WEIGHT OF SHAFT IN N\n", + "##==========================================================================================\n", + "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", + "DELTA1=W1*L1**2.*(L-L1)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W1\n", + "DELTA2=W2*L2**2.*(L-L2)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", + "DELTA3=W3*L3**2.*(L-L3)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W3\n", + "DELTA4=5.*w*L**4./(384.*E*I)## STATIC DEFLECTION DUE TO w\n", + "Fn=.4985/(DELTA1+DELTA2+DELTA3+DELTA4/1.27)**.5\n", + "Nc=Fn*60## CRITICAL SPEED OF SHAFT IN rpm\n", + "##========================================================================================\n", + "print'%s %.3f %s'%('CRITICAL SPEED OF SHAFT = ',Nc,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "CRITICAL SPEED OF SHAFT = 3111.629 rpm\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg298" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 12 PAGE NO 298\n", + "##TITLE:VIBRATIONS\n", + "##FIGURE 11.20\n", + "import math\n", + "#calculate FREQUENCY OF FREE TORSIONAL VIBRATION\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", + "Na=1500.## SPEED OF SHAFT A IN rpm\n", + "Nb=500.## SPEED OF SHAFT B IN rpm\n", + "G=Na/Nb## GERA RATIO\n", + "L1=.18## LENGTH OF SHAFT 1 IN m\n", + "L2=.45## LENGTH OF SHAFT 2 IN m\n", + "D1=.045## DIAMETER OF SHAFT 1 IN m\n", + "D2=.09## DIAMETER OF SHAFT 2 IN m\n", + "C=84.*10**9## MODUKUS OF RIDITY OF SHAFT MATERIAL IN Pascals\n", + "Ib=1400.## MOMENT OF INERTIA OF PUMP IN Kg-m**2\n", + "Ia=400.## MOMENT OF INERTIA OF MOTOR IN Kg-m**2\n", + "\n", + "##======================================================================================\n", + "J=PI*D1**4./32.## POLAR MOMENT OF INERTIA IN m**4\n", + "Ib1=Ib/G**2.## MASS MOMENT OF INERTIA OF EQUIVALENT ROTOR IN m**2\n", + "L3=G**2.*L2*(D1/D2)**4.## ADDITIONAL LENGTH OF THE EQUIVALENT SHAFT\n", + "L=L1+L3## TOTAL LENGTH OF EQUIVALENT SHAFT\n", + "La=L*Ib1/(Ia+Ib1)\n", + "Fn=(C*J/(La*Ia))**.5/(2.*PI)## FREQUENCY OF FREE TORSIONAL VIBRATION IN Hz\n", + "##===================================================================================\n", + "print'%s %.2f %s'%('FREQUENCY OF FREE TORSIONAL VIBRATION = ',Fn,' Hz')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FREQUENCY OF FREE TORSIONAL VIBRATION = 4.20 Hz\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg300" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 11 ILLUSRTATION 13 PAGE NO 300\n", + "##TITLE:VIBRATIONS\n", + "##FIGURE 11.21\n", + "import math\n", + "#calculate critical speed of shaft and the range of speed \n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", + "D=.015## DIAMETER OF SHAFT IN m\n", + "L=1.00## LENGTH OF SHAFT IN m\n", + "M=15.## MASS OF SHAFT IN Kg\n", + "W=M*g\n", + "e=.0003## ECCENTRICITY IN m\n", + "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", + "f=70.*10**6.## PERMISSIBLE STRESS IN N/m**2\n", + "##============================================================================================\n", + "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", + "DELTA=W*L**3./(192.*E*I)## STATIC DEFLECTION IN m\n", + "Fn=.4985/(DELTA)**.5## NATURAL FREQUENCY OF TRANSVERSE VIBRATION\n", + "Nc=Fn*60.## CRITICAL SPEED OF SHAFT IN rpm\n", + "M1=16.*f*I/(D*g*L)\n", + "W1=M1*g## ADDITIONAL LOAD ACTING\n", + "y=W1/W*DELTA## ADDITIONAL DEFLECTION DUE TO W1\n", + "N1=Nc/(1.+e/y)**.5## MIN SPEED IN rpm\n", + "N2=Nc/(1.-e/y)**.5## MAX SPEED IN rpm\n", + "##===========================================================================================\n", + "print'%s %.3f %s %.3f %s %.3f %s '%('CRITICAL SPEED OF SHAFT = ',Nc,' rpm''THE RANGE OF SPEED IS FROM',N1,'rpm TO ',N2,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "CRITICAL SPEED OF SHAFT = 762.330 rpmTHE RANGE OF SPEED IS FROM 709.555 rpm TO 828.955 rpm \n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter12.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter12.ipynb new file mode 100755 index 00000000..6706c05c --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter12.ipynb @@ -0,0 +1,380 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2fbbfd8e1fae5de695230b7f28341e3abac22cade207682955694bcaba6d0716" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter12-Balancing of reciprocating of masses" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg310" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 1 PAGE NO 310\n", + "##TITLE:Balancing of reciprocating of masses\n", + "import math\n", + "#calculate the magnitude of balance mass required and residual balance error\n", + "pi=3.141\n", + "N=250.## speed of the reciprocating engine in rpm\n", + "s=18.## length of stroke in mm\n", + "mR=120.## mass of reciprocating parts in kg\n", + "m=70.## mass of revolving parts in kg\n", + "r=.09## radius of revolution of revolving parts in m\n", + "b=.15## distance at which balancing mass located in m\n", + "c=2./3.## portion of reciprocating mass balanced \n", + "teeta=30.## crank angle from inner dead centre in degrees\n", + "##===============================\n", + "B=r*(m+c*mR)/b## balance mass required in kg\n", + "w=2.*math.pi*N/60.## angular speed in rad/s\n", + "F=mR*w**2.*r*(((1.-c)**2.*(math.cos(teeta/57.3))**2.)+(c**2.*(math.sin(teeta/57.3))**2.))**.5## residual unbalanced forces in N\n", + "print'%s %.1f %s %.3f %s'%('Magnitude of balance mass required= ',B,'kg' and 'Residual unbalanced forces= ',F,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Magnitude of balance mass required= 90.0 Residual unbalanced forces= 3263.971 N\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg310" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 2 PAGE NO 310\n", + "##TITLE:Balancing of reciprocating of masses\n", + "#calculate speed and swaying couples \n", + "pi=3.141\n", + "g=10.## acceleration due to gravity approximately in m/s**2\n", + "mR=240.## mass of reciprocating parts per cylinder in kg\n", + "m=300.## mass of rotating parts per cylinder in kg\n", + "a=1.8##distance between cylinder centres in m\n", + "c=.67## portion of reciprocating mass to be balanced\n", + "b=.60## radius of balance masses in m\n", + "r=24.## crank radius in cm\n", + "R=.8##radius of thread of wheels in m\n", + "M=40.\n", + "##=======================================\n", + "Ma=m+c*mR## total mass to be balanced in kg\n", + "mD=211.9## mass of wheel D from figure in kg\n", + "mC=211.9##..... mass of wheel C from figure in kg\n", + "theta=171.## angular position of balancing mass C in degrees\n", + "Br=c*mR/Ma*mC## balancing mass for reciprocating parts in kg\n", + "w=(M*g**3./Br/b)**.5## angular speed in rad/s\n", + "v=w*R*3600./1000.## speed in km/h\n", + "S=a*(1.-c)*mR*w**2*r/2.**.5/100./1000.## swaying couple in kNm\n", + "print'%s %.3f %s %.3f %s'%('speed=',v,' kmph'and ' swaying couple=',S,' kNm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "speed= 86.476 swaying couple= 21.812 kNm\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg313" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 3 PAGE NO 313\n", + "##TITLE:Balancing of reciprocating of masses\n", + "#calculate hammer blow and tractive effort and swaying couple\n", + "import math\n", + "pi=3.141\n", + "g=10.## acceleration due to gravity approximately in m/s**2\n", + "a=.70##distance between cylinder centres in m\n", + "r=60.## crank radius in cm\n", + "m=130.##mass of rotating parts per cylinder in kg\n", + "mR=210.## mass of reciprocating parts per cylinder in kg\n", + "c=.67## portion of reciprocating mass to be balanced\n", + "N=300.##e2engine speed in rpm\n", + "b=.64## radius of balance masses in m\n", + "##============================\n", + "Ma=m+c*mR## total mass to be balanced in kg\n", + "mA=100.44## mass of wheel A from figure in kg\n", + "Br=c*mR/Ma*mA## balancing mass for reciprocating parts in kg\n", + "H=Br*(2.*math.pi*N/60.)**2*b## hammer blow in N\n", + "w=(2.*math.pi*N/60.)## angular speed\n", + "T=2**.5*(1.-c)*mR*w**2.*r/2./100.##tractive effort in N\n", + "S=a*(1.-c)*mR*w**2.*r/2./2.**.5/100.## swaying couple in Nm\n", + "\n", + "print'%s %.3f %s %.3f %s %.3f %s'%('Hammer blow=',H,' in N' 'tractive effort= ',T,' in N' 'swaying couple= ',S,' in Nm')\n", + "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hammer blow= 32975.566 in Ntractive effort= 29018.117 in Nswaying couple= 10156.341 in Nm\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg314" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 4 PAGE NO 314\n", + "##TITLE:Balancing of reciprocating of masses\n", + "import math\n", + "#calculate maximum unbalanced primary couples\n", + "pi=3.141\n", + "mR=900.## mass of reciprocating parts in kg\n", + "N=90.## speed of the engine in rpm\n", + "r=.45##crank radius in m\n", + "cP=.9*mR*(2.*math.pi*N/60.)**2.*r*2.**.5/1000.## maximum unbalanced primary couple in kNm\n", + "print'%s %.3f %s'%('maximum unbalanced primary couple=',cP,' k Nm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum unbalanced primary couple= 45.788 k Nm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg315" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 5 PAGE NO 315\n", + "##TITLE:Balancing of reciprocating of masses\n", + "import math\n", + "#calculate maximum unbalanced secondary force and with reasons\n", + "pi=3.141\n", + "mRA=160.## mass of reciprocating cylinder A in kg\n", + "mRD=160.## mass of reciprocating cylinder D in kg\n", + "r=.05## stroke lenght in m\n", + "l=.2## connecting rod length in m\n", + "N=450.## engine speed in rpm\n", + "##===========================\n", + "theta2=78.69## crank angle between A & B cylinders in degrees\n", + "mRB=576.88## mass of cylinder B in kg\n", + "n=l/r## ratio between connecting rod length and stroke length\n", + "w=2.*math.pi*N/60.## angular speed in rad/s\n", + "F=mRB*2.*w**2.*r*math.cos((2.*theta2)/57.3)/n\n", + "print'%s %.3f %s'%('Maximum unbalanced secondary force=',F,' N in anticlockwise direction thats why - sign')\n", + "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum unbalanced secondary force= -29560.284 N in anticlockwise direction thats why - sign\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg316" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 6 PAGE NO 316\n", + "##TITLE:Balancing of reciprocating of masses\n", + "import math\n", + "pi=3.141\n", + "rA=.25## stroke length of A piston in m\n", + "rB=.25## stroke length of B piston in m\n", + "rC=.25## stroke length C piston in m\n", + "N=300.## engine speed in rpm\n", + "mRL=280.## mass of reciprocating parts in inside cylinder kg\n", + "mRO=240.## mass of reciprocating parts in outside cylinder kg\n", + "c=.5## portion ofreciprocating masses to be balanced \n", + "b1=.5## radius at which masses to be balanced in m\n", + "##======================\n", + "mA=c*mRO## mass of the reciprocating parts to be balanced foreach outside cylinder in kg\n", + "mB=c*mRL## mass of the reciprocating parts to be balanced foreach inside cylinder in kg\n", + "B1=79.4## balancing mass for reciprocating parts in kg\n", + "w=2.*math.pi*N/60.## angular speed in rad/s\n", + "H=B1*w**2*b1## hammer blow per wheel in N\n", + "print'%s %.1f %s'%('Hammer blow per wheel= ',H,' N')\n", + "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hammer blow per wheel= 39182.3 N\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg318" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 7 PAGE NO 318\n", + "##TITLE:Balancing of reciprocating of masses\n", + "import math\n", + "\n", + "pi=3.141\n", + "mR=300.## reciprocating mass per cylinder in kg\n", + "r=.3## crank radius in m\n", + "D=1.7## driving wheel diameter in m\n", + "a=.7## distance between cylinder centre lines in m\n", + "H=40.## hammer blow in kN\n", + "v=90.## speed in kmph\n", + "##=======================================\n", + "R=D/2.## radius of driving wheel in m\n", + "w=90.*1000./3600./R## angular velocity in rad/s\n", + "##Br*b=69.625*c by mearument from diagram\n", + "c=H*1000./(w**2.)/69.625## portion of reciprocating mass to be balanced\n", + "T=2.**.5*(1-c)*mR*w**2.*r## variation in tractive effort in N\n", + "M=a*(1.-c)*mR*w**2.*r/2.**.5## maximum swaying couple in N-m\n", + "print'%s %.3f %s %.3f %s %.3f %s'%('portion of reciprocating mass to be balanced=',c,' ''variation in tractive effort=',T,' N'' maximum swaying couple=',M,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "portion of reciprocating mass to be balanced= 0.664 variation in tractive effort= 36980.420 N maximum swaying couple= 12943.147 N-m\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg320" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 8 PAGE NO 320\n", + "##TITLE:Balancing of reciprocating of masses\n", + "import math\n", + "pi=3.141\n", + "N=1800.## speed of the engine in rpm\n", + "r=6.## length of crank in cm\n", + "l=24.## length of connecting rod in cm\n", + "m=1.5## mass of reciprocating cylinder in kg\n", + "##====================\n", + "w=2.*math.pi*N/60.## angular speed in rad/s\n", + "UPC=.019*w**2.## unbalanced primary couple in N-m\n", + "n=l/r## ratio of length of crank to the connecting rod \n", + "USC=.054*w**2./n## unbalanced secondary couple in N-m\n", + "print'%s %.f %s %.3f %s '%('unbalanced primary couple=',UPC,'N-m' 'unbalanced secondary couple=',USC,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "unbalanced primary couple= 675 N-munbalanced secondary couple= 479.663 N-m \n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter12_1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter12_1.ipynb new file mode 100755 index 00000000..2a5c880d --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter12_1.ipynb @@ -0,0 +1,380 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1f988043aec4c9b9b6e84d06631278db6c5ded6c7354777cfc3020424bf624d7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter12-Balancing of reciprocating of masses" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg310" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 1 PAGE NO 310\n", + "##TITLE:Balancing of reciprocating of masses\n", + "import math\n", + "#calculate the magnitude of balance mass required and residual balance error\n", + "pi=3.141\n", + "N=250.## speed of the reciprocating engine in rpm\n", + "s=18.## length of stroke in mm\n", + "mR=120.## mass of reciprocating parts in kg\n", + "m=70.## mass of revolving parts in kg\n", + "r=.09## radius of revolution of revolving parts in m\n", + "b=.15## distance at which balancing mass located in m\n", + "c=2./3.## portion of reciprocating mass balanced \n", + "teeta=30.## crank angle from inner dead centre in degrees\n", + "##===============================\n", + "B=r*(m+c*mR)/b## balance mass required in kg\n", + "w=2.*math.pi*N/60.## angular speed in rad/s\n", + "F=mR*w**2.*r*(((1.-c)**2.*(math.cos(teeta/57.3))**2.)+(c**2.*(math.sin(teeta/57.3))**2.))**.5## residual unbalanced forces in N\n", + "print'%s %.1f %s %.3f %s'%('Magnitude of balance mass required= ',B,'kg' and 'Residual unbalanced forces= ',F,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Magnitude of balance mass required= 90.0 Residual unbalanced forces= 3263.971 N\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg310" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 2 PAGE NO 310\n", + "##TITLE:Balancing of reciprocating of masses\n", + "#calculate speed and swaying couples \n", + "pi=3.141\n", + "g=10.## acceleration due to gravity approximately in m/s**2\n", + "mR=240.## mass of reciprocating parts per cylinder in kg\n", + "m=300.## mass of rotating parts per cylinder in kg\n", + "a=1.8##distance between cylinder centres in m\n", + "c=.67## portion of reciprocating mass to be balanced\n", + "b=.60## radius of balance masses in m\n", + "r=24.## crank radius in cm\n", + "R=.8##radius of thread of wheels in m\n", + "M=40.\n", + "##=======================================\n", + "Ma=m+c*mR## total mass to be balanced in kg\n", + "mD=211.9## mass of wheel D from figure in kg\n", + "mC=211.9##..... mass of wheel C from figure in kg\n", + "theta=171.## angular position of balancing mass C in degrees\n", + "Br=c*mR/Ma*mC## balancing mass for reciprocating parts in kg\n", + "w=(M*g**3./Br/b)**.5## angular speed in rad/s\n", + "v=w*R*3600./1000.## speed in km/h\n", + "S=a*(1.-c)*mR*w**2*r/2.**.5/100./1000.## swaying couple in kNm\n", + "print'%s %.3f %s %.3f %s'%('speed=',v,' kmph'and ' swaying couple=',S,' kNm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "speed= 86.476 swaying couple= 21.812 kNm\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg313" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 3 PAGE NO 313\n", + "##TITLE:Balancing of reciprocating of masses\n", + "#calculate hammer blow and tractive effort and swaying couple\n", + "import math\n", + "pi=3.141\n", + "g=10.## acceleration due to gravity approximately in m/s**2\n", + "a=.70##distance between cylinder centres in m\n", + "r=60.## crank radius in cm\n", + "m=130.##mass of rotating parts per cylinder in kg\n", + "mR=210.## mass of reciprocating parts per cylinder in kg\n", + "c=.67## portion of reciprocating mass to be balanced\n", + "N=300.##e2engine speed in rpm\n", + "b=.64## radius of balance masses in m\n", + "##============================\n", + "Ma=m+c*mR## total mass to be balanced in kg\n", + "mA=100.44## mass of wheel A from figure in kg\n", + "Br=c*mR/Ma*mA## balancing mass for reciprocating parts in kg\n", + "H=Br*(2.*math.pi*N/60.)**2*b## hammer blow in N\n", + "w=(2.*math.pi*N/60.)## angular speed\n", + "T=2**.5*(1.-c)*mR*w**2.*r/2./100.##tractive effort in N\n", + "S=a*(1.-c)*mR*w**2.*r/2./2.**.5/100.## swaying couple in Nm\n", + "\n", + "print'%s %.3f %s %.3f %s %.3f %s'%('Hammer blow=',H,' in N' 'tractive effort= ',T,' in N' 'swaying couple= ',S,' in Nm')\n", + "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hammer blow= 32975.566 in Ntractive effort= 29018.117 in Nswaying couple= 10156.341 in Nm\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg314" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 4 PAGE NO 314\n", + "##TITLE:Balancing of reciprocating of masses\n", + "import math\n", + "#calculate maximum unbalanced primary couples\n", + "pi=3.141\n", + "mR=900.## mass of reciprocating parts in kg\n", + "N=90.## speed of the engine in rpm\n", + "r=.45##crank radius in m\n", + "cP=.9*mR*(2.*math.pi*N/60.)**2.*r*2.**.5/1000.## maximum unbalanced primary couple in kNm\n", + "print'%s %.3f %s'%('maximum unbalanced primary couple=',cP,' k Nm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum unbalanced primary couple= 45.788 k Nm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg315" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 5 PAGE NO 315\n", + "##TITLE:Balancing of reciprocating of masses\n", + "import math\n", + "#calculate maximum unbalanced secondary force and with reasons\n", + "pi=3.141\n", + "mRA=160.## mass of reciprocating cylinder A in kg\n", + "mRD=160.## mass of reciprocating cylinder D in kg\n", + "r=.05## stroke lenght in m\n", + "l=.2## connecting rod length in m\n", + "N=450.## engine speed in rpm\n", + "##===========================\n", + "theta2=78.69## crank angle between A & B cylinders in degrees\n", + "mRB=576.88## mass of cylinder B in kg\n", + "n=l/r## ratio between connecting rod length and stroke length\n", + "w=2.*math.pi*N/60.## angular speed in rad/s\n", + "F=mRB*2.*w**2.*r*math.cos((2.*theta2)/57.3)/n\n", + "print'%s %.3f %s'%('Maximum unbalanced secondary force=',F,' N in anticlockwise direction thats why - sign')\n", + "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum unbalanced secondary force= -29560.284 N in anticlockwise direction thats why - sign\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg316" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 6 PAGE NO 316\n", + "##TITLE:Balancing of reciprocating of masses\n", + "import math\n", + "pi=3.141\n", + "rA=.25## stroke length of A piston in m\n", + "rB=.25## stroke length of B piston in m\n", + "rC=.25## stroke length C piston in m\n", + "N=300.## engine speed in rpm\n", + "mRL=280.## mass of reciprocating parts in inside cylinder kg\n", + "mRO=240.## mass of reciprocating parts in outside cylinder kg\n", + "c=.5## portion ofreciprocating masses to be balanced \n", + "b1=.5## radius at which masses to be balanced in m\n", + "##======================\n", + "mA=c*mRO## mass of the reciprocating parts to be balanced foreach outside cylinder in kg\n", + "mB=c*mRL## mass of the reciprocating parts to be balanced foreach inside cylinder in kg\n", + "B1=79.4## balancing mass for reciprocating parts in kg\n", + "w=2.*math.pi*N/60.## angular speed in rad/s\n", + "H=B1*w**2*b1## hammer blow per wheel in N\n", + "print'%s %.1f %s'%('Hammer blow per wheel= ',H,' N')\n", + "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hammer blow per wheel= 39182.3 N\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg318" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 7 PAGE NO 318\n", + "##TITLE:Balancing of reciprocating of masses\n", + "import math\n", + "\n", + "pi=3.141\n", + "mR=300.## reciprocating mass per cylinder in kg\n", + "r=.3## crank radius in m\n", + "D=1.7## driving wheel diameter in m\n", + "a=.7## distance between cylinder centre lines in m\n", + "H=40.## hammer blow in kN\n", + "v=90.## speed in kmph\n", + "##=======================================\n", + "R=D/2.## radius of driving wheel in m\n", + "w=90.*1000./3600./R## angular velocity in rad/s\n", + "##Br*b=69.625*c by mearument from diagram\n", + "c=H*1000./(w**2.)/69.625## portion of reciprocating mass to be balanced\n", + "T=2.**.5*(1-c)*mR*w**2.*r## variation in tractive effort in N\n", + "M=a*(1.-c)*mR*w**2.*r/2.**.5## maximum swaying couple in N-m\n", + "print'%s %.3f %s %.3f %s %.3f %s'%('portion of reciprocating mass to be balanced=',c,' ''variation in tractive effort=',T,' N'' maximum swaying couple=',M,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "portion of reciprocating mass to be balanced= 0.664 variation in tractive effort= 36980.420 N maximum swaying couple= 12943.147 N-m\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg320" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 12 ILLUSRTATION 8 PAGE NO 320\n", + "##TITLE:Balancing of reciprocating of masses\n", + "import math\n", + "pi=3.141\n", + "N=1800.## speed of the engine in rpm\n", + "r=6.## length of crank in cm\n", + "l=24.## length of connecting rod in cm\n", + "m=1.5## mass of reciprocating cylinder in kg\n", + "##====================\n", + "w=2.*math.pi*N/60.## angular speed in rad/s\n", + "UPC=.019*w**2.## unbalanced primary couple in N-m\n", + "n=l/r## ratio of length of crank to the connecting rod \n", + "USC=.054*w**2./n## unbalanced secondary couple in N-m\n", + "print'%s %.f %s %.3f %s '%('unbalanced primary couple=',UPC,'N-m' 'unbalanced secondary couple=',USC,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "unbalanced primary couple= 675 N-munbalanced secondary couple= 479.663 N-m \n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter1_1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter1_1.ipynb new file mode 100755 index 00000000..b5702b36 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter1_1.ipynb @@ -0,0 +1,663 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:42c46a13a1122c47945ac8a4d546584dee7d6901a84a063f9d2cb3b7f703c59b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter1-Basic kinematics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 1 PAGE NO 15\n", + "#calculate inclination of slotted bar with vertical \n", + "##TITLE:Basic kinematics\n", + "##Figure 1.14\n", + "import math\n", + "pi=3.141\n", + "AO=200.## distance between fixed centres in mm\n", + "OB1=100.## length of driving crank in mm\n", + "AP=400.## length of slotter bar in mm\n", + "##====================================\n", + "OAB1=math.asin(OB1/AO)*57.3## inclination of slotted bar with vertical in degrees\n", + "beeta=(90-OAB1)*2.## angle through which crank turns inreturn stroke in degrees\n", + "A=(360.-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", + "L=2.*AP*math.sin(90.-beeta/2.)/57.3## length of the stroke in mm\n", + "print'%s %.2f %s %.3f %s'%('Inclination of slotted bar with vertical= ',OAB1,' degrees' 'Length of the stroke=',L,' mm')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Inclination of slotted bar with vertical= 30.00 degreesLength of the stroke= -13.790 mm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 2 PAGE NO 16\n", + "#calculate ratio of time taken on the cutting to the return\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.15\n", + "import math\n", + "OA=300.## distance between the fixed centres in mm\n", + "OB=150.## length of driving crank in mm\n", + "##================================\n", + "OAB=math.asin(OB/OA)## inclination of slotted bar with vertical in degrees\n", + "beeta=(90/57.3-OAB)*2.## angle through which crank turns inreturn stroke in degrees\n", + "A=(360/57.3-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", + "print'%s %.1f %s'%('Ratio of time taken on the cutting to the return stroke= ',A,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ratio of time taken on the cutting to the return stroke= 2.0 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 3 PAGE NO 16\n", + "#calculate ratio of time taken on the cutting to the return stroke \n", + "##TITLE:Basic kinematics\n", + "##Figure 1.16\n", + "import math\n", + "OB=54.6/57.3## distance between the fixed centres in mm\n", + "OA=85./57.3## length of driving crank in mm\n", + "OA2=OA\n", + "CA=160.## length of slotted lever in mm\n", + "CD=144.## length of connectin rod in mm\n", + "##================================\n", + "beeta=2.*(math.cos(OB/OA2))## angle through which crank turns inreturn stroke in degrees\n", + "A=(360/57.3-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", + "print'%s %.1f %s'%('Ratio of time taken on the cutting to the return stroke= ',A,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ratio of time taken on the cutting to the return stroke= 2.9 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 4 PAGE NO 17\n", + "#calculate velocity position and Angular velocity connection\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.18,1.19\n", + "import math\n", + "pi=3.141\n", + "Nao=180.## speed of the crank in rpm\n", + "wAO=2.*pi*Nao/60.## angular speed of the crank in rad/s\n", + "AO=.5## crank length in m\n", + "AE=.5\n", + "Vao=wAO*AO## velocity of A in m/s\n", + "##================================\n", + "Vb1=8.15## velocity of piston B in m/s by measurment from figure 1.19\n", + "Vba=6.8## velocity of B with respect to A in m/s\n", + "AB=2## length of connecting rod in m\n", + "wBA=Vba/AB## angular velocity of the connecting rod BA in rad/s\n", + "ae=AE*Vba/AB## velocity of point e on the connecting rod\n", + "oe=8.5## by measurement velocity of point E\n", + "Do=.05## diameter of crank shaft in m\n", + "Da=.06## diameter of crank pin in m\n", + "Db=.03## diameter of cross head pin B m\n", + "V1=wAO*Do/2.## velocity of rubbing at the pin of the crankshaft in m/s\n", + "V2=wBA*Da/2.## velocity of rubbing at the pin of the crank in m/s\n", + "Vb=(wAO+wBA)*Db/2.## velocity of rubbing at the pin of cross head in m/s\n", + "ag=5.1## by measurement\n", + "AG=AB*ag/Vba## position and linear velocity of point G on the connecting rod in m\n", + "##===============================\n", + "print'%s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s'%('Velocity of piston B=',Vb1,' m/s''Angular velocity of connecting rod= ',wBA,' rad/s''velocity of point E=',oe,' m/s'' velocity of rubbing at the pin of the crankshaft=',V1,' m/s' 'velocity of rubbing at the pin of the crank =',V2,' m/s''velocity of rubbing at the pin of cross head =',Vb,' m/s''position and linear velocity of point G on the connecting rod=',AG,' m')\n", + "\n", + "\n", + "\n", + "\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity of piston B= 8.150 m/sAngular velocity of connecting rod= 3.400 rad/svelocity of point E= 8.500 m/s velocity of rubbing at the pin of the crankshaft= 0.471 m/svelocity of rubbing at the pin of the crank = 0.102 m/svelocity of rubbing at the pin of cross head = 0.334 m/sposition and linear velocity of point G on the connecting rod= 1.500 m\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg 19" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 5 PAGE NO 19\n", + "#calculate linear velocity at various point\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.20,1.21\n", + "import math\n", + "pi=3.141\n", + "N=120.## speed of crank in rpm\n", + "OA=10.## length of crank in cm\n", + "BP=48.## from figure 1.20 in cm\n", + "BA=40.## from figure 1.20 in cm\n", + "##==============\n", + "w=2.*pi*N/60.## angular velocity of the crank OA in rad/s\n", + "Vao=w*OA## velocity of ao in cm/s\n", + "ba=4.5## by measurement from 1.21 in cm\n", + "Bp=BP*ba/BA\n", + "op=6.8## by measurement in cm from figure 1.21\n", + "s=20.## scale of velocity diagram 1cm=20cm/s\n", + "Vp=op*s## linear velocity of P in m/s\n", + "ob=5.1## by measurement in cm from figure 1.21\n", + "Vb=ob*s## linear velocity of slider B\n", + "print'%s %.2f %s %.2f %s'%('Linear velocity of slider B= ',Vb,' cm/s''Linear velocity of point P= ',Vp,' cm/s')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Linear velocity of slider B= 102.00 cm/sLinear velocity of point P= 136.00 cm/s\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#calculate angular velocity at various points\n", + "##CHAPTER 1 ILLUSRTATION 6 PAGE NO 20\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.22,1.23\n", + "import math\n", + "pi=3.141\n", + "AB=6.25## length of link AB in cm\n", + "BC=17.5## length of link BC in cm\n", + "CD=11.25## length of link CD in cm\n", + "DA=20.## length of link DA in cm\n", + "CE=10.\n", + "N=100.## speed of crank in rpm\n", + "##========================\n", + "wAB=2.*pi*N/60.## angular velocity of AB in rad/s\n", + "Vb=wAB*AB## linear velocity of B with respect to A\n", + "s=15.## scale for velocity diagram 1 cm= 15 cm/s\n", + "dc=3.## by measurement in cm\n", + "Vcd=dc*s\n", + "wCD=Vcd/CD## angular velocity of link CD in rad/s\n", + "bc=2.5## by measurement in cm\n", + "Vbc=bc*s\n", + "wBC=Vbc/BC## angular velocity of link BC in rad/s\n", + "ce=bc*CE/BC\n", + "ae=3.66## by measurement in cm\n", + "Ve=ae*s## velocity of point E 10 from c on the link BC\n", + "af=2.94## by measurement in cm\n", + "Vf=af*s## velocity of point F\n", + "print'%s %.3f %s %.3f %s %.3f %s %.3f %s'%('The angular velocity of link CD= ',wCD,' rad/s'' The angular velocity of link BC= ',wBC,'rad/s'' velocity of point E 10 from c on the link BC= ',Ve,' cm/s' ' velocity of point F= ',Vf,' cm/s')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angular velocity of link CD= 4.000 rad/s The angular velocity of link BC= 2.143 rad/s velocity of point E 10 from c on the link BC= 54.900 cm/s velocity of point F= 44.100 cm/s\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 7 PAGE NO 21\n", + "##TITLE:Basic kinematics\n", + "#calculate Linear velocity slider and angular velocity of link\n", + "##Figure 1.24,1.25\n", + "import math\n", + "pi=3.141\n", + "Noa=600## speed of the crank in rpm\n", + "OA=2.8## length of link OA in cm\n", + "AB=4.4## length of link AB in cm\n", + "BC=4.9## length of link BC in cm\n", + "BD=4.6## length of link BD in cm\n", + "##=================\n", + "wOA=2.*pi*Noa/60.## angular velocity of crank in rad/s\n", + "Vao=wOA*OA## The linear velocity of point A with respect to oin m/s\n", + "s=50.## scale of velocity diagram in cm\n", + "od=2.95## by measurement in cm from figure\n", + "Vd=od*s/100.## linear velocity slider in m/s\n", + "bd=3.2## by measurement in cm from figure\n", + "Vbd=bd*s\n", + "wBD=Vbd/BD## angular velocity of link BD\n", + "print'%s %.1f %s %.1f %s '%('linear velocity slider D= ',Vd,' m/s' 'angular velocity of link BD= ',wBD,' rad/s')\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "linear velocity slider D= 1.5 m/sangular velocity of link BD= 34.8 rad/s \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 8 PAGE NO 22\n", + "#calculate Angular velocity of link CD\n", + "##TITLE:Basic kinematics\n", + "import math\n", + "pi=3.141\n", + "Noa=60.## speed of crank in rpm\n", + "OA=30.## length of link OA in cm\n", + "AB=100.## length of link AB in cm\n", + "CD=80.## length of link CD in cm\n", + "##AC=CB\n", + "##================\n", + "wOA=2.*pi*Noa/60.## angular velocity of crank in rad/s\n", + "Vao=wOA*OA/100.## linear velocity of point A with respect to O\n", + "s=50.## scale for velocity diagram 1 cm= 50 cm/s\n", + "ob=3.4## by measurement in cm from figure 1.27\n", + "od=.9## by measurement in cm from figure 1.27\n", + "Vcd=160.## by measurement in cm/s from figure 1.27\n", + "wCD=Vcd/CD## angular velocity of link in rad/s\n", + "print'%s %.d %s'%('Angular velocity of link CD= ',wCD,' rad/s')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Angular velocity of link CD= 2 rad/s\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 9 PAGE NO 23\n", + "#calculate velcity of Ram and anugular velocity of link and velocity of slidingof the block\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.28,1.29\n", + "import math\n", + "pi=3.141\n", + "Nao=120.## speed of the crank in rpm\n", + "OQ=10.## length of link OQ in cm\n", + "OA=20.## length of link OA in cm\n", + "QC=15.## length of link QC in cm\n", + "CD=50.## length oflink CD in cm\n", + "##=============\n", + "wOA=2.*pi*Nao/60.## angular speed of crank in rad/s\n", + "Vad=wOA*OA/100.## velocity of pin A in m/s\n", + "BQ=41.## from figure 1.29 \n", + "BC=26.## from firure 1.29 \n", + "bq=4.7## from figure 1.29\n", + "bc=bq*BC/BQ## from figure 1.29 in cm\n", + "s=50.## scale for velocity diagram in cm/s\n", + "od=1.525## velocity vector od in cm from figure 1.29\n", + "Vd=od*s## velocity of ram D in cm/s\n", + "dc=1.925## velocity vector dc in cm from figure 1.29\n", + "Vdc=dc*s## velocity of link CD in cm/s\n", + "wCD=Vdc/CD## angular velocity of link CD in cm/s\n", + "ba=1.8## velocity vector of sliding of the block in cm\n", + "Vab=ba*s## velocity of sliding of the block in cm/s\n", + "print'%s %.3f %s %.2f %s %.1f %s '%('Velocity of RAM D= ',Vd,' cm/s''angular velocity of link CD= ',wCD,' rad/s'' velocity of sliding of the block= ',Vab,' cm/s')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity of RAM D= 76.250 cm/sangular velocity of link CD= 1.93 rad/s velocity of sliding of the block= 90.0 cm/s \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 10 PAGE NO 24\n", + "##TITLE:Basic kinematics\n", + "#calculate linear velocity abd radial component of accerlation and anugular velocity of connecting rod and anugular accerlation of connecting rod\n", + "##Figure 1.30(a),1.30(b),1.30(c)\n", + "import math\n", + "pi=3.141\n", + "Nao=300.## speed of crank in rpm\n", + "AO=.15## length of crank in m\n", + "BA=.6## length of connecting rod in m\n", + "##===================\n", + "wAO=2.*pi*Nao/60.## angular velocity of link in rad/s\n", + "Vao=wAO*AO## linear velocity of A with respect to 'o'\n", + "ab=3.4## length of vector ab by measurement in m/s\n", + "Vba=ab\n", + "ob=4.## length of vector ob by measurement in m/s\n", + "oc=4.1## length of vector oc by measurement in m/s\n", + "fRao=Vao**2./AO## radial component of acceleration of A with respect to O\n", + "fRba=Vba**2./BA## radial component of acceleration of B with respect to A\n", + "wBA=Vba/BA## angular velocity of connecting rod BA\n", + "fTba=103.## by measurement in m/s**2\n", + "alphaBA=fTba/BA## angular acceleration of connecting rod BA\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('linear velocity of A with respect to O= ',Vao,' m/s''radial component of acceleration of A with respect to O= ',fRao,' m/s**2'' radial component of acceleration of B with respect to A=',fRba,' m/s**2'' angular velocity of connecting rod B= ',wBA,' rad/s'' angular acceleration of connecting rod BA= ',alphaBA,' rad/s**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "linear velocity of A with respect to O= 4.7 m/sradial component of acceleration of A with respect to O= 148.0 m/s**2 radial component of acceleration of B with respect to A= 19.3 m/s**2 angular velocity of connecting rod B= 5.7 rad/s angular acceleration of connecting rod BA= 171.7 rad/s**2 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 11 PAGE NO 26\n", + "#calcualte Angular accerlation at various point\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.31(a),1.31(b),1.31(c)\n", + "import math\n", + "pi=3.141\n", + "wAP=10.## angular velocity of crank in rad/s\n", + "P1A=30.## length of link P1A in cm\n", + "P2B=36.## length of link P2B in cm\n", + "AB=36.## length of link AB in cm\n", + "P1P2=60.## length of link P1P2 in cm\n", + "AP1P2=60.## crank inclination in degrees \n", + "alphaP1A=30.## angulare acceleration of crank P1A in rad/s**2\n", + "##=====================================\n", + "Vap1=wAP*P1A/100.## linear velocity of A with respect to P1 in m/s\n", + "Vbp2=2.2## velocity of B with respect to P2 in m/s(measured from figure )\n", + "Vba=2.06## velocity of B with respect to A in m/s(measured from figure )\n", + "wBP2=Vbp2/(P2B*100.)## angular velocity of P2B in rad/s\n", + "wAB=Vba/(AB*100.)## angular velocity of AB in rad/s\n", + "fAB1=alphaP1A*P1A/100.## tangential component of the acceleration of A with respect to P1 in m/s**2\n", + "frAB1=Vap1**2./(P1A/100.)## radial component of the acceleration of A with respect to P1 in m/s**2\n", + "frBA=Vba**2./(AB/100.)## radial component of the acceleration of B with respect to B in m/s**2\n", + "frBP2=Vbp2**2./(P2B/100.)## radial component of the acceleration of B with respect to P2 in m/s**2\n", + "ftBA=13.62## tangential component of B with respect to A in m/s**2(measured from figure)\n", + "ftBP2=26.62## tangential component of B with respect to P2 in m/s**2(measured from figure)\n", + "alphaBP2=ftBP2/(P2B/100.)## angular acceleration of P2B in m/s**2\n", + "alphaBA=ftBA/(AB/100.)## angular acceleration of AB in m/s**2\n", + "##==========================\n", + "print'%s %.1f %s %.1f %s'%('Angular acceleration of P2B=',alphaBP2,' rad/s**2''angular acceleration of AB =',alphaBA,' rad/s**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Angular acceleration of P2B= 73.9 rad/s**2angular acceleration of AB = 37.8 rad/s**2\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 12 PAGE NO 28\n", + "#calculate velocities at various point\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.32(a),1.32(b),1.32(c)\n", + "import math\n", + "PI=3.141\n", + "AB=12.## length of link AB in cm\n", + "BC=48.## length of link BC in cm\n", + "CD=18.## length of link CD in cm\n", + "DE=36.## length of link DE in cm\n", + "EF=12.## length of link EF in cm\n", + "FP=36.## length of link FP in cm\n", + "Nba=200.## roating speed of link BA IN rpm\n", + "wBA=2*PI*200./60.## Angular velocity of BA in rad/s\n", + "Vba=wBA*AB/100.## linear velocity of B with respect to A in m/s\n", + "Vc=2.428## velocity of c in m/s from diagram 1.32(b)\n", + "Vd=2.36## velocity of D in m/s from diagram 1.32(b)\n", + "Ve=1## velocity of e in m/s from diagram 1.32(b)\n", + "Vf=1.42## velocity of f in m/s from diagram 1.32(b)\n", + "Vcb=1.3## velocity of c with respect to b in m/s from figure\n", + "fBA=Vba**2.*100./AB## radial component of acceleration of B with respect to A in m/s**2\n", + "fCB=Vcb**2*100./BC## radial component of acceleration of C with respect to B in m/s**2\n", + "fcb=3.52## radial component of acceleration of C with respect to B in m/s**2 from figure\n", + "fC=19.## acceleration of slider in m/s**2 from figure\n", + "print'%s %.1f %s %.1f %s %.1f %s %.2f %s %.2f %s'%('velocity of c=',Vc,' m/s''velocity of d=',Vd,' m/s''velocity of e=',Ve,' m/s'' velocity of f=',Vf,' m/s''Acceleration of slider=',Vc,' m/s**2')\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "velocity of c= 2.4 m/svelocity of d= 2.4 m/svelocity of e= 1.0 m/s velocity of f= 1.42 m/sAcceleration of slider= 2.43 m/s**2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 1 ILLUSRTATION 13 PAGE NO 30\n", + "#caculate angular acceleration at varoius points\n", + "##TITLE:Basic kinematics\n", + "##Figure 1.33(a),1.33(b),1.33(c)\n", + "import math\n", + "PI=3.141\n", + "N=120.## speed of the crank OC in rpm\n", + "OC=5.## length of link OC in cm\n", + "cp=20.## length of link CP in cm\n", + "qa=10.## length of link QA in cm\n", + "pa=5.## length of link PA in cm\n", + "CP=46.9## velocity of link CP in cm/s\n", + "QA=58.3## velocity of link QA in cm/s\n", + "Pa=18.3## velocity of link PA in cm/s\n", + "Vc=2.*PI*N*OC/60.## velocity of C in m/s\n", + "Cco=Vc**2./OC## centripetal acceleration of C relative to O in cm/s**2\n", + "Cpc=CP**2./cp## centripetal acceleration of P relative to C in cm/s**2\n", + "Caq=QA**2./qa## centripetal acceleration of A relative to Q in cm/s**2\n", + "Cap=Pa**2./pa## centripetal acceleration of A relative to P in cm/s**2\n", + "pp1=530.\n", + "a1a=323.\n", + "a2a=207.5\n", + "ACP=pp1/cp## angular acceleration of link CP in rad/s**2\n", + "APA=a1a/qa## angular acceleration of link PA in rad/s**2\n", + "AAQ=a2a/pa## angular acceleration of link AQ in rad/s**2\n", + "print'%s %.3f %s %.3f %s %.3f %s'%('angular acceleration of link CP =',ACP,' rad/s**2'' angular acceleration of link CP=',APA,' rad/s**2''angular acceleration of link CP=',AAQ,' rad/s**2')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "angular acceleration of link CP = 26.500 rad/s**2 angular acceleration of link CP= 32.300 rad/s**2angular acceleration of link CP= 41.500 rad/s**2\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter2.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter2.ipynb new file mode 100755 index 00000000..0ed80f3b --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter2.ipynb @@ -0,0 +1,824 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1b022ca97a90c946dcce72b014fa00f7dd7b26ac917f0b5fe9fdd6cabd6dcdfd" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter2-TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2 ILLUSRTATION 1 PAGE NO 57\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "Na=300.;##driving shaft running speed in rpm\n", + "Nb=400.;##driven shaft running speed in rpm\n", + "Da=60.;##diameter of driving shaft in mm\n", + "t=.8;##belt thickness in mm\n", + "s=.05;##slip in percentage(5%)\n", + "##==========================================================================================\n", + "##calculation\n", + "Db=(Da*Na)/Nb;##finding out the diameter of driven shaft without considering the thickness of belt\n", + "Db1=(((Da+t)*Na)/Nb)-t##/considering the thickness\n", + "Db2=(1.-s)*(Da+t)*(Na/Nb)-t##considering slip also\n", + "##=========================================================================================\n", + "##output\n", + "print'%s %.1f %s'%('the value of Db is',Db,' cm')\n", + "print'%s %.1f %s'%('the value of Db1 is',Db1,' cm')\n", + "print'%s %.1f %s'%('the value of Db2 is',Db2,' cm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the value of Db is 45.0 cm\n", + "the value of Db1 is 44.8 cm\n", + "the value of Db2 is 42.5 cm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSRTATION 2 PAGE NO 57\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "\n", + "##====================================================================================\n", + "##input\n", + "n1=1200##rpm of motor shaft\n", + "d1=40##diameter of motor pulley in cm\n", + "d2=70##diameter of 1st pulley on the shaft in cm\n", + "s=.03##percentage slip(3%)\n", + "d3=45##diameter of 2nd pulley\n", + "d4=65##diameter of the pulley on the counnter shaft\n", + "##=========================================================================================\n", + "##calculation\n", + "n2=n1*d1*(1-s)/d2##rpm of driven shaft\n", + "n3=n2##both the pulleys are mounted on the same shaft\n", + "n4=n3*(1-s)*d3/d4##rpm of counter shaft\n", + "\n", + "##output\n", + "print'%s %.1f %s %.1f %s '%('the speed of driven shaft is',n2,' rpm''the speed of counter shaft is ',n4,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the speed of driven shaft is 665.1 rpmthe speed of counter shaft is 446.7 rpm \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg58" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2 ILLUSTRATION 3 PAGE NO:58\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##==============================================================================\n", + "##input\n", + "d1=30.##diameter of 1st shaft in cm\n", + "d2=50.##diameter 2nd shaft in cm\n", + "pi=3.141\n", + "c=500.##centre distance between the shafts in cm\n", + "##==============================================================================\n", + "##calculation\n", + "L1=((d1+d2)*pi/2.)+(2.*c)+((d1+d2)**2.)/(4.*c)##lenth of cross belt\n", + "L2=((d1+d2)*pi/2.)+(2.*c)+((d1-d2)**2.)/(4.*c)##lenth of open belt\n", + "r=L1-L2##remedy\n", + "##==============================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s '%('length of cross belt is ',L1,'cm '' length of open belt is ',L2,'cm''the length of the belt to be shortened is ',r,' cm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "length of cross belt is 1128.8 cm length of open belt is 1125.8 cmthe length of the belt to be shortened is 3.0 cm \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "##CHAPTER 2,ILLUSTRATION 4 PAGE 59\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##====================================================================================\n", + "##INPUT\n", + "D1=.5## DIAMETER OF 1ST SHAFT IN m\n", + "D2=.25## DIAMETER OF 2nd SHAFT IN m\n", + "C=2.## CENTRE DISTANCE IN m\n", + "N1=220.## SPEED OF 1st SHAFT\n", + "T1=1250.## TENSION ON TIGHT SIDE IN N\n", + "U=.25## COEFFICIENT OF FRICTION\n", + "PI=3.141\n", + "e=2.71\n", + "##====================================================================================\n", + "##CALCULATION\n", + "L=(D1+D2)*PI/2.+((D1+D2)**2./(4.*C))+2.*C\n", + "F=(D1+D2)/(2.*C)\n", + "ALPHA=math.asin(F/57.3)\n", + "THETA=(180.+(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", + "T2=T1/(e**(U*THETA))## TENSION ON SLACK SIDE IN N\n", + "V=PI*D1*N1/60.## VELOCITY IN m/s\n", + "P=(T1-T2)*V/1000.## POWER IN kW\n", + "##====================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('LENGTH OF BELT REQUIRED =',L,' m')\n", + "print'%s %.1f %s'%('ANGLE OF CONTACT =',THETA,' radians')\n", + "print'%s %.1f %s'%('POWER CAN BE TRANSMITTED=',P,' kW')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "LENGTH OF BELT REQUIRED = 5.2 m\n", + "ANGLE OF CONTACT = 3.1 radians\n", + "POWER CAN BE TRANSMITTED= 3.9 kW\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 5 PAGE 5\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##=====================================================================================================\n", + "##input\n", + "n1=100.## of driving shaft\n", + "n2=240.##speed of driven shaft\n", + "p=11000.##power to be transmitted in watts\n", + "c=250.##centre distance in cm\n", + "d2=60.##diameter in cm\n", + "b=11.5*10**-2##width of belt in metres\n", + "t=1.2*10**-2##thickness in metres\n", + "u=.25##co-efficient of friction \n", + "pi=3.141\n", + "e=2.71\n", + "##===================================================================================================\n", + "##calculation for open bely drive\n", + "d1=n2*d2/n1\n", + "f=(d1-d2)/(2.*c)##sin(alpha) for open bely drive\n", + "##angle of arc of contact for open belt drive is,theta=180-2*alpha\n", + "alpha=math.asin(f)*57.3\n", + "teta=(180.-(2*alpha))*3.147/180.##pi/180 is used to convert into radians\n", + "x=(e**(u*teta))##finding out the value of t1/t2\n", + "v=pi*d2*10.*n2/60.##finding out the value of t1-t2\n", + "y=p*1000./(v)\n", + "t1=(y*x)/(x-1.)\n", + "Fb=t1/(t*b)/1000.\n", + "##=======================================================================================================\n", + "##calculation for cross belt drive bely drive\n", + "F=(d1+d2)/(2.*c)##for cross belt drive bely drive\n", + "ALPHA=math.asin(F)*57.3\n", + "THETA=(180.+(2.*ALPHA))*pi/180.##pi/180 is used to convert into radians\n", + "X=(e**(u*THETA))##finding out the value of t1/t2\n", + "V=pi*d2*10.*n2/60.##finding out the value of t1-t2\n", + "Y=p*1000./(V)\n", + "T1=(Y*X)/(X-1.)\n", + "Fb2=T1/(t*b)/1000.\n", + "##========================================================================================================\n", + "##output\n", + "print('for a open belt drive:')\n", + "print'%s %.1f %s %.1f %s'%('the tension in belt is ',t1,'N' 'stress induced is ',Fb,' kN/m**2')\n", + "print('for a cross belt drive:')\n", + "print'%s %.1f %s %.1f %s '%('the tension in belt is ',T1,'N' 'stress induced is ',Fb2,' kN/m**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "for a open belt drive:\n", + "the tension in belt is 2898.4 Nstress induced is 2100.3 kN/m**2\n", + "for a cross belt drive:\n", + "the tension in belt is 2318.8 Nstress induced is 1680.3 kN/m**2 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 6 PAGE 61\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##========================================================================================\n", + "##INPUT\n", + "D1=80.##DIAMETER OF SHAFT IN cm\n", + "N1=160.##SPEED OF 1ST SHAFT IN rpm\n", + "N2=320.##SPEED OF 2ND SHAFT IN rpm\n", + "C=250.##CENTRE DISTANCE IN CM\n", + "U=.3##COEFFICIENT OF FRICTION\n", + "P=4.##POWER IN KILO WATTS\n", + "e=2.71\n", + "PI=3.141\n", + "f=110.##STRESS PER cm WIDTH OF BELT\n", + "##========================================================================================\n", + "##CALCULATION\n", + "V=PI*D1*math.pow(10,-2)*N1/60.##VELOCITY IN m/s\n", + "Y=P*1000./V##Y=T1-T2\n", + "D2=D1*(N1/N2)##DIAMETER OF DRIVEN SHAFT\n", + "F=(D1-D2)/(2.*C)\n", + "ALPHA=math.asin(F/57.3)\n", + "THETA=(180.-(2.*ALPHA))*PI/180.##ANGLE OF CONTACT IN radians\n", + "X=e**(U*THETA)##VALUE OF T1/T2\n", + "T1=X*Y/(X-1.)\n", + "b=T1/f##WIDTH OF THE BELT REQUIRED \n", + "##=======================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('THE WIDTH OF THE BELT IS ',b,' cm')\n", + "#apporximate ans is correct " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE WIDTH OF THE BELT IS 8.9 cm\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2 ILLUSRTATION 7 PAGE NO 62\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "m=1000.## MASS OF THE CASTING IN kg\n", + "PI=3.141\n", + "THETA=2.75*2*PI## ANGLE OF CONTACT IN radians\n", + "D=.26## DIAMETER OF DRUM IN m\n", + "N=24.## SPEED OF THE DRUM IN rpm\n", + "U=.25## COEFFICIENT OF FRICTION\n", + "e=2.71\n", + "T1=9810## TENSION ON TIGHTSIDE IN N\n", + "##=============================================================================================\n", + "##CALCULATION\n", + "T2=T1/(e**(U*THETA))## tension on slack side of belt in N\n", + "W=m*9.81## WEIGHT OF CASTING IN N\n", + "R=D/2.## RADIUS OF DRUM IN m\n", + "P=2*PI*N*W*R/60000.## POWER REQUIRED IN kW\n", + "P2=(T1-T2)*PI*D*N/60000.## POWER SUPPLIED BY DRUM IN kW\n", + "##============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s '%('FORCE REQUIRED BY MAN=',T2,' N'and 'POWER REQUIRED TO RAISE CASTING=',P,' kW' 'POWER SUPPLIED BY DRUM=',P2,' kW')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FORCE REQUIRED BY MAN= 132.4 POWER REQUIRED TO RAISE CASTING= 3.2 kWPOWER SUPPLIED BY DRUM= 3.2 kW \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 8 PAGE 62\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##INPUT\n", + "t=9.##THICKNESS IN mm\n", + "b=250.##WIDTH IN mm\n", + "D=90.##DIAMETER OF PULLEY IN cm\n", + "N=336.##SPEED IN rpm\n", + "PI=3.141\n", + "U=.35##COEFFICIENT FRICTION\n", + "e=2.71\n", + "THETA=120.*PI/180.\n", + "Fb=2.##STRESS IN MPa\n", + "d=1000.##DENSITY IN KG/M**3\n", + "\n", + "##CALCULATION\n", + "M=b*10**-3.*t*10**-3.*d##MASS IN KG\n", + "V=PI*D*10**-2.*N/60.##VELOCITY IN m/s\n", + "Tc=M*V**2##CENTRIFUGAL TENSION\n", + "Tmax=b*t*Fb##MAX TENSION IN N\n", + "T1=Tmax-Tc\n", + "T2=T1/(e**(U*THETA))\n", + "P=(T1-T2)*V/1000.\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('THE TENSION ON TIGHT SIDE OF THE BELT IS',T1,' N')\n", + "print'%s %.1f %s'%('THE TENSION ON SLACK SIDE OF THE BELT IS ',T2,' N')\n", + "print'%s %.1f %s'%('CENTRIFUGAL TENSION =',Tc,'N')\n", + "print'%s %.1f %s'%('THE POWER CAPACITY OF BELT IS ',P,' KW')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE TENSION ON TIGHT SIDE OF THE BELT IS 3936.1 N\n", + "THE TENSION ON SLACK SIDE OF THE BELT IS 1895.6 N\n", + "CENTRIFUGAL TENSION = 563.9 N\n", + "THE POWER CAPACITY OF BELT IS 32.3 KW\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 9 PAGE 63\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##INPUT\n", + "P=35000.##POWER TO BE TRANSMITTED IN WATTS\n", + "D=1.5##EFFECTIVE DIAMETER OF PULLEY IN METRES\n", + "N=300.##SPEED IN rpm\n", + "e=2.71\n", + "U=.3##COEFFICIENT OF FRICTION\n", + "PI=3.141\n", + "THETA=(11/24.)*360.*PI/180.##ANGLE OF CONTACT\n", + "density=1.1##density of belt material in Mg/m**3\n", + "L=1.##in metre\n", + "t=9.5##THICKNESS OF BELT IN mm\n", + "Fb=2.5##PERMISSIBLE WORK STRESS IN N/mm**2\n", + "\n", + "##CALCULATION\n", + "V=PI*D*N/60.##VELOCITY IN m/s\n", + "X=P/V##X=T1-T2\n", + "Y=e**(U*THETA)##Y=T1/T2\n", + "T1=X*Y/(Y-1)\n", + "Mb=t*density*L/10**3.##value of m/b\n", + "Tc=Mb*V**2.##centrifugal tension/b\n", + "Tmaxb=t*Fb##max tension/b\n", + "b=T1/(Tmaxb-Tc)##thickness in mm\n", + "##output\n", + "print'%s %.1f %s'%('TENSION IN TIGHT SIDE OF THE BELT =',T1,' N')\n", + "print'%s %.1f %s'%('THICKNESS OF THE BELT IS =',b,' mm')\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "TENSION IN TIGHT SIDE OF THE BELT = 2573.5 N\n", + "THICKNESS OF THE BELT IS = 143.4 mm\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 10 PAGE 64\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##INPUT\n", + "t=5.##THICKNESS OF BELT IN m\n", + "PI=3.141\n", + "U=.3\n", + "e=2.71\n", + "THETA=155.*PI/180.##ANGLE OF CONTACT IN radians\n", + "V=30.##VELOCITY IN m/s\n", + "density=1.##in m/cm**3\n", + "L=1.##LENGTH\n", + "\n", + "##calculation\n", + "Xb=80.## (T1-T2)=80b;so let (T1-T2)/b=Xb\n", + "Y=e**(U*THETA)## LET Y=T1/T2\n", + "Zb=80.*Y/(Y-1.)## LET T1/b=Zb;BY SOLVING THE ABOVE 2 EQUATIONS WE WILL GET THIS EXPRESSION\n", + "Mb=t*L*density*10**-2.## m/b in N\n", + "Tcb=Mb*V**2.## centrifugal tension/b\n", + "Tmaxb=Zb+Tcb## MAX TENSION/b\n", + "Fb=Tmaxb/t##STRESS INDUCED IN TIGHT BELT\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('THE STRESS DEVELOPED ON THE TIGHT SIDE OF BELT=',Fb,' N/cm**2')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE STRESS DEVELOPED ON THE TIGHT SIDE OF BELT= 37.8 N/cm**2\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 11 PAGE 65\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##INPUT\n", + "C=4.5## CENTRE DISTANCE IN metres\n", + "D1=1.35## DIAMETER OF LARGER PULLEY IN metres\n", + "D2=.9## DIAMETER OF SMALLER PULLEY IN metres\n", + "To=2100.## INITIAL TENSION IN newtons\n", + "b=12.## WIDTH OF BELT IN cm\n", + "t=12.## THICKNESS OF BELT IN mm\n", + "d=1.## DENSITY IN gm/cm**3\n", + "U=.3## COEFFICIENT OF FRICTION\n", + "L=1.## length in metres\n", + "PI=3.141\n", + "e=2.71\n", + "\n", + "##CALCULATION\n", + "M=b*t*d*L*10**-2.## mass of belt per metre length in KG\n", + "V=(To/3./M)**.5## VELOCITY OF FOR MAX POWER TO BE TRANSMITTED IN m/s\n", + "Tc=M*V**2.## CENTRIFUGAL TENSION IN newtons\n", + "## LET (T1+T2)=X\n", + "X=2.*To-2.*Tc ## THE VALUE OF (T1+T2)\n", + "F=(D1-D2)/(2.*C)\n", + "ALPHA=math.asin(F/57.3)\n", + "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", + "## LET T1/T2=Y\n", + "Y=e**(U*THETA)## THE VALUE OF T1/T2\n", + "T1=X*Y/(Y+1.)## BY SOLVING X AND Y WE WILL GET THIS EQN\n", + "T2=X-T1\n", + "P=(T1-T2)*V/1000.## MAX POWER TRANSMITTED IN kilowatts\n", + "N1=V*60./(PI*D1)## SPEED OF LARGER PULLEY IN rpm\n", + "N2=V*60./(PI*D2)## SPEED OF SMALLER PULLEY IN rpm\n", + "##OUTPUT\n", + "print'%s %.1f %s'%(' MAX POWER TO BE TRANSMITTED =',P,' KW')\n", + "print'%s %.1f %s'%(' SPEED OF THE LARGER PULLEY =',N1,' rpm')\n", + "print'%s %.1f %s'%(' SPEED OF THE SMALLER PULLEY =',N2,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " MAX POWER TO BE TRANSMITTED = 27.0 KW\n", + " SPEED OF THE LARGER PULLEY = 312.0 rpm\n", + " SPEED OF THE SMALLER PULLEY = 468.0 rpm\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 12 PAGE 66\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##============================================================================================================================\n", + "##INPUT\n", + "PI=3.141\n", + "e=2.71\n", + "D1=1.20## DIAMETER OF DRIVING SHAFT IN m\n", + "D2=.50## DIAMETER OF DRIVEN SHAFT IN m\n", + "C=4.## CENTRE DISTANCE BETWEEN THE SHAFTS IN m\n", + "M=.9## MASS OF BELT PER METRE LENGTH IN kg\n", + "Tmax=2000## MAX TENSION IN N\n", + "U=.3## COEFFICIENT OF FRICTION\n", + "N1=200.## SPEED OF DRIVING SHAFT IN rpm\n", + "N2=450.## SPEED OF DRIVEN SHAFT IN rpm\n", + "##==============================================================================================================================\n", + "##CALCULATION\n", + "V=PI*D1*N1/60.## VELOCITY OF BELT IN m/s\n", + "Tc=M*V**2.## CENTRIFUGAL TENSION IN N\n", + "T1=Tmax-Tc## TENSION ON TIGHTSIDE IN N\n", + "F=(D1-D2)/(2.*C)\n", + "ALPHA=math.asin(F/57.3)\n", + "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", + "T2=T1/(e**(U*THETA))## TENSION ON SLACK SIDE IN N\n", + "TL=(T1-T2)*D1/2.## TORQUE ON THE SHAFT OF LARGER PULLEY IN N-m\n", + "TS=(T1-T2)*D2/2.## TORQUE ON THE SHAFT OF SMALLER PULLEY IN N-m\n", + "P=(T1-T2)*V/1000.## POWER TRANSMITTED IN kW\n", + "Pi=2.*PI*N1*TL/60000.## INPUT POWER\n", + "Po=2.*PI*N2*TS/60000.## OUTPUT POWER\n", + "Pl=Pi-Po## POWER LOST DUE TO FRICTION IN kW\n", + "n=Po/Pi*100.## EFFICIENCY OF DRIVE IN %\n", + "##==================================================================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('TORQUE ON LARGER SHAFT =',TL,'N-m')\n", + "print'%s %.1f %s'%('TORQUE ON SMALLER SHAFT =',TS,' N-m')\n", + "print'%s %.1f %s'%('POWER TRANSMITTED =',P,' kW')\n", + "print'%s %.1f %s'%('POWER LOST DUE TO FRICTION =',Pl,' kW')\n", + "print'%s %.1f %s'%('EFFICIENCY OF DRINE =',n,' percentage')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "TORQUE ON LARGER SHAFT = 679.0 N-m\n", + "TORQUE ON SMALLER SHAFT = 282.9 N-m\n", + "POWER TRANSMITTED = 14.2 kW\n", + "POWER LOST DUE TO FRICTION = 0.9 kW\n", + "EFFICIENCY OF DRINE = 93.8 percentage\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 13 PAGE 67\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##============================================================================================================================\n", + "##INPUT\n", + "PI=3.141\n", + "e=2.71\n", + "P=90## POWER OF A COMPRESSOR IN kW\n", + "N2=250.## SPEED OF DRIVEN SHAFT IN rpm\n", + "N1=750.## SPEED OF DRIVER SHAFT IN rpm\n", + "D2=1.## DIAMETER OF DRIVEN SHAFT IN m\n", + "C=1.75## CENTRE DISTANCE IN m\n", + "V=1600./60.## VELOCITY IN m/s\n", + "a=375.## CROSECTIONAL AREA IN mm**2\n", + "density=1000.## BELT DENSITY IN kg/m**3\n", + "L=1## length to be considered\n", + "Fb=2.5## STRESSS INDUCED IN MPa\n", + "beeta=35./2.## THE GROOVE ANGLE OF PULLEY\n", + "U=.25## COEFFICIENT OF FRICTION\n", + "##=================================================================================================================================\n", + "##CALCULATION\n", + "D1=N2*D2/N1## DIAMETER OF DRIVING SHAFT IN m\n", + "m=a*density*10**-6.*L## MASS OF THE BELT IN kg\n", + "Tmax=a*Fb## MAX TENSION IN N\n", + "Tc=m*V**2.## CENTRIFUGAL TENSION IN N\n", + "T1=Tmax-Tc## TENSION ON TIGHTSIDE OF BELT IN N\n", + "F=(D2-D1)/(2.*C)\n", + "ALPHA=math.asin(F/57.3)\n", + "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", + "T2=T1/(e**(U*THETA/math.sin(beeta/57.3)))##TENSION ON SLACKSIDE IN N\n", + "P2=(T1-T2)*V/1000.## POWER TRANSMITTED PER BELT kW\n", + "N=P/P2## NO OF V-BELTS\n", + "N3=N+1.\n", + "##======================================================================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s '%('NO OF BELTS REQUIRED TO TRANSMIT POWER=',N,' APPROXIMATELY=',N3,'')\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "NO OF BELTS REQUIRED TO TRANSMIT POWER= 5.4 APPROXIMATELY= 6.4 \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex14-pg68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 14 PAGE 68\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##============================================================================================================================\n", + "##INPUT\n", + "PI=3.141\n", + "e=2.71\n", + "P=75.## POWER IN kW\n", + "D=1.5## DIAMETER OF PULLEY IN m\n", + "U=.3## COEFFICIENT OF FRICTION\n", + "beeta=45./2.## GROOVE ANGLE\n", + "THETA=160.*PI/180.## ANGLE OF CONTACT IN radians\n", + "m=.6## MASS OF BELT IN kg/m\n", + "Tmax=800.## MAX TENSION IN N\n", + "N=200.## SPEED OF SHAFT IN rpm\n", + "##=============================================================================================================================\n", + "##calculation\n", + "V=PI*D*N/60.## VELOCITY OF ROPE IN m/s\n", + "Tc=m*V**2.## CENTRIFUGAL TENSION IN N\n", + "T1=Tmax-Tc## TENSION ON TIGHT SIDE IN N\n", + "T2=T1/(e**(U*THETA/math.sin(beeta/57.3)))##TENSION ON SLACKSIDE IN N\n", + "P2=(T1-T2)*V/1000.## POWER TRANSMITTED PER BELT kW\n", + "No=P/P2## NO OF V-BELTS\n", + "N3=No+1.## ROUNDING OFF\n", + "To=(T1+T2+Tc*2.)/2.## INITIAL TENSION\n", + "##================================================================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s '%('NO OF BELTS REQUIRED TO TRANSMIT POWER=',No,'' 'APPROXIMATELY=',N3,'')\n", + "print'%s %.1f %s'%('INITIAL ROPE TENSION=',To,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "NO OF BELTS REQUIRED TO TRANSMIT POWER= 8.3 APPROXIMATELY= 9.3 \n", + "INITIAL ROPE TENSION= 510.8 N\n" + ] + } + ], + "prompt_number": 16 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter2_1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter2_1.ipynb new file mode 100755 index 00000000..e6083830 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter2_1.ipynb @@ -0,0 +1,824 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:214de3ca59a9f823d9af2646136423031768f0a5e133206c7c8ac1d217b863ef" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter2-Transmission of Motion and Power by Belts and Pulleys" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2 ILLUSRTATION 1 PAGE NO 57\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "Na=300.;##driving shaft running speed in rpm\n", + "Nb=400.;##driven shaft running speed in rpm\n", + "Da=60.;##diameter of driving shaft in mm\n", + "t=.8;##belt thickness in mm\n", + "s=.05;##slip in percentage(5%)\n", + "##==========================================================================================\n", + "##calculation\n", + "Db=(Da*Na)/Nb;##finding out the diameter of driven shaft without considering the thickness of belt\n", + "Db1=(((Da+t)*Na)/Nb)-t##/considering the thickness\n", + "Db2=(1.-s)*(Da+t)*(Na/Nb)-t##considering slip also\n", + "##=========================================================================================\n", + "##output\n", + "print'%s %.1f %s'%('the value of Db is',Db,' cm')\n", + "print'%s %.1f %s'%('the value of Db1 is',Db1,' cm')\n", + "print'%s %.1f %s'%('the value of Db2 is',Db2,' cm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the value of Db is 45.0 cm\n", + "the value of Db1 is 44.8 cm\n", + "the value of Db2 is 42.5 cm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSRTATION 2 PAGE NO 57\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "\n", + "##====================================================================================\n", + "##input\n", + "n1=1200##rpm of motor shaft\n", + "d1=40##diameter of motor pulley in cm\n", + "d2=70##diameter of 1st pulley on the shaft in cm\n", + "s=.03##percentage slip(3%)\n", + "d3=45##diameter of 2nd pulley\n", + "d4=65##diameter of the pulley on the counnter shaft\n", + "##=========================================================================================\n", + "##calculation\n", + "n2=n1*d1*(1-s)/d2##rpm of driven shaft\n", + "n3=n2##both the pulleys are mounted on the same shaft\n", + "n4=n3*(1-s)*d3/d4##rpm of counter shaft\n", + "\n", + "##output\n", + "print'%s %.1f %s %.1f %s '%('the speed of driven shaft is',n2,' rpm''the speed of counter shaft is ',n4,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the speed of driven shaft is 665.1 rpmthe speed of counter shaft is 446.7 rpm \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg58" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2 ILLUSTRATION 3 PAGE NO:58\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##==============================================================================\n", + "##input\n", + "d1=30.##diameter of 1st shaft in cm\n", + "d2=50.##diameter 2nd shaft in cm\n", + "pi=3.141\n", + "c=500.##centre distance between the shafts in cm\n", + "##==============================================================================\n", + "##calculation\n", + "L1=((d1+d2)*pi/2.)+(2.*c)+((d1+d2)**2.)/(4.*c)##lenth of cross belt\n", + "L2=((d1+d2)*pi/2.)+(2.*c)+((d1-d2)**2.)/(4.*c)##lenth of open belt\n", + "r=L1-L2##remedy\n", + "##==============================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s '%('length of cross belt is ',L1,'cm '' length of open belt is ',L2,'cm''the length of the belt to be shortened is ',r,' cm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "length of cross belt is 1128.8 cm length of open belt is 1125.8 cmthe length of the belt to be shortened is 3.0 cm \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "##CHAPTER 2,ILLUSTRATION 4 PAGE 59\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##====================================================================================\n", + "##INPUT\n", + "D1=.5## DIAMETER OF 1ST SHAFT IN m\n", + "D2=.25## DIAMETER OF 2nd SHAFT IN m\n", + "C=2.## CENTRE DISTANCE IN m\n", + "N1=220.## SPEED OF 1st SHAFT\n", + "T1=1250.## TENSION ON TIGHT SIDE IN N\n", + "U=.25## COEFFICIENT OF FRICTION\n", + "PI=3.141\n", + "e=2.71\n", + "##====================================================================================\n", + "##CALCULATION\n", + "L=(D1+D2)*PI/2.+((D1+D2)**2./(4.*C))+2.*C\n", + "F=(D1+D2)/(2.*C)\n", + "ALPHA=math.asin(F/57.3)\n", + "THETA=(180.+(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", + "T2=T1/(e**(U*THETA))## TENSION ON SLACK SIDE IN N\n", + "V=PI*D1*N1/60.## VELOCITY IN m/s\n", + "P=(T1-T2)*V/1000.## POWER IN kW\n", + "##====================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('LENGTH OF BELT REQUIRED =',L,' m')\n", + "print'%s %.1f %s'%('ANGLE OF CONTACT =',THETA,' radians')\n", + "print'%s %.1f %s'%('POWER CAN BE TRANSMITTED=',P,' kW')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "LENGTH OF BELT REQUIRED = 5.2 m\n", + "ANGLE OF CONTACT = 3.1 radians\n", + "POWER CAN BE TRANSMITTED= 3.9 kW\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 5 PAGE 5\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##=====================================================================================================\n", + "##input\n", + "n1=100.## of driving shaft\n", + "n2=240.##speed of driven shaft\n", + "p=11000.##power to be transmitted in watts\n", + "c=250.##centre distance in cm\n", + "d2=60.##diameter in cm\n", + "b=11.5*10**-2##width of belt in metres\n", + "t=1.2*10**-2##thickness in metres\n", + "u=.25##co-efficient of friction \n", + "pi=3.141\n", + "e=2.71\n", + "##===================================================================================================\n", + "##calculation for open bely drive\n", + "d1=n2*d2/n1\n", + "f=(d1-d2)/(2.*c)##sin(alpha) for open bely drive\n", + "##angle of arc of contact for open belt drive is,theta=180-2*alpha\n", + "alpha=math.asin(f)*57.3\n", + "teta=(180.-(2*alpha))*3.147/180.##pi/180 is used to convert into radians\n", + "x=(e**(u*teta))##finding out the value of t1/t2\n", + "v=pi*d2*10.*n2/60.##finding out the value of t1-t2\n", + "y=p*1000./(v)\n", + "t1=(y*x)/(x-1.)\n", + "Fb=t1/(t*b)/1000.\n", + "##=======================================================================================================\n", + "##calculation for cross belt drive bely drive\n", + "F=(d1+d2)/(2.*c)##for cross belt drive bely drive\n", + "ALPHA=math.asin(F)*57.3\n", + "THETA=(180.+(2.*ALPHA))*pi/180.##pi/180 is used to convert into radians\n", + "X=(e**(u*THETA))##finding out the value of t1/t2\n", + "V=pi*d2*10.*n2/60.##finding out the value of t1-t2\n", + "Y=p*1000./(V)\n", + "T1=(Y*X)/(X-1.)\n", + "Fb2=T1/(t*b)/1000.\n", + "##========================================================================================================\n", + "##output\n", + "print('for a open belt drive:')\n", + "print'%s %.1f %s %.1f %s'%('the tension in belt is ',t1,'N' 'stress induced is ',Fb,' kN/m**2')\n", + "print('for a cross belt drive:')\n", + "print'%s %.1f %s %.1f %s '%('the tension in belt is ',T1,'N' 'stress induced is ',Fb2,' kN/m**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "for a open belt drive:\n", + "the tension in belt is 2898.4 Nstress induced is 2100.3 kN/m**2\n", + "for a cross belt drive:\n", + "the tension in belt is 2318.8 Nstress induced is 1680.3 kN/m**2 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 6 PAGE 61\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##========================================================================================\n", + "##INPUT\n", + "D1=80.##DIAMETER OF SHAFT IN cm\n", + "N1=160.##SPEED OF 1ST SHAFT IN rpm\n", + "N2=320.##SPEED OF 2ND SHAFT IN rpm\n", + "C=250.##CENTRE DISTANCE IN CM\n", + "U=.3##COEFFICIENT OF FRICTION\n", + "P=4.##POWER IN KILO WATTS\n", + "e=2.71\n", + "PI=3.141\n", + "f=110.##STRESS PER cm WIDTH OF BELT\n", + "##========================================================================================\n", + "##CALCULATION\n", + "V=PI*D1*math.pow(10,-2)*N1/60.##VELOCITY IN m/s\n", + "Y=P*1000./V##Y=T1-T2\n", + "D2=D1*(N1/N2)##DIAMETER OF DRIVEN SHAFT\n", + "F=(D1-D2)/(2.*C)\n", + "ALPHA=math.asin(F/57.3)\n", + "THETA=(180.-(2.*ALPHA))*PI/180.##ANGLE OF CONTACT IN radians\n", + "X=e**(U*THETA)##VALUE OF T1/T2\n", + "T1=X*Y/(X-1.)\n", + "b=T1/f##WIDTH OF THE BELT REQUIRED \n", + "##=======================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('THE WIDTH OF THE BELT IS ',b,' cm')\n", + "#apporximate ans is correct " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE WIDTH OF THE BELT IS 8.9 cm\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2 ILLUSRTATION 7 PAGE NO 62\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "m=1000.## MASS OF THE CASTING IN kg\n", + "PI=3.141\n", + "THETA=2.75*2*PI## ANGLE OF CONTACT IN radians\n", + "D=.26## DIAMETER OF DRUM IN m\n", + "N=24.## SPEED OF THE DRUM IN rpm\n", + "U=.25## COEFFICIENT OF FRICTION\n", + "e=2.71\n", + "T1=9810## TENSION ON TIGHTSIDE IN N\n", + "##=============================================================================================\n", + "##CALCULATION\n", + "T2=T1/(e**(U*THETA))## tension on slack side of belt in N\n", + "W=m*9.81## WEIGHT OF CASTING IN N\n", + "R=D/2.## RADIUS OF DRUM IN m\n", + "P=2*PI*N*W*R/60000.## POWER REQUIRED IN kW\n", + "P2=(T1-T2)*PI*D*N/60000.## POWER SUPPLIED BY DRUM IN kW\n", + "##============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s '%('FORCE REQUIRED BY MAN=',T2,' N'and 'POWER REQUIRED TO RAISE CASTING=',P,' kW' 'POWER SUPPLIED BY DRUM=',P2,' kW')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FORCE REQUIRED BY MAN= 132.4 POWER REQUIRED TO RAISE CASTING= 3.2 kWPOWER SUPPLIED BY DRUM= 3.2 kW \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 8 PAGE 62\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##INPUT\n", + "t=9.##THICKNESS IN mm\n", + "b=250.##WIDTH IN mm\n", + "D=90.##DIAMETER OF PULLEY IN cm\n", + "N=336.##SPEED IN rpm\n", + "PI=3.141\n", + "U=.35##COEFFICIENT FRICTION\n", + "e=2.71\n", + "THETA=120.*PI/180.\n", + "Fb=2.##STRESS IN MPa\n", + "d=1000.##DENSITY IN KG/M**3\n", + "\n", + "##CALCULATION\n", + "M=b*10**-3.*t*10**-3.*d##MASS IN KG\n", + "V=PI*D*10**-2.*N/60.##VELOCITY IN m/s\n", + "Tc=M*V**2##CENTRIFUGAL TENSION\n", + "Tmax=b*t*Fb##MAX TENSION IN N\n", + "T1=Tmax-Tc\n", + "T2=T1/(e**(U*THETA))\n", + "P=(T1-T2)*V/1000.\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('THE TENSION ON TIGHT SIDE OF THE BELT IS',T1,' N')\n", + "print'%s %.1f %s'%('THE TENSION ON SLACK SIDE OF THE BELT IS ',T2,' N')\n", + "print'%s %.1f %s'%('CENTRIFUGAL TENSION =',Tc,'N')\n", + "print'%s %.1f %s'%('THE POWER CAPACITY OF BELT IS ',P,' KW')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE TENSION ON TIGHT SIDE OF THE BELT IS 3936.1 N\n", + "THE TENSION ON SLACK SIDE OF THE BELT IS 1895.6 N\n", + "CENTRIFUGAL TENSION = 563.9 N\n", + "THE POWER CAPACITY OF BELT IS 32.3 KW\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 9 PAGE 63\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##INPUT\n", + "P=35000.##POWER TO BE TRANSMITTED IN WATTS\n", + "D=1.5##EFFECTIVE DIAMETER OF PULLEY IN METRES\n", + "N=300.##SPEED IN rpm\n", + "e=2.71\n", + "U=.3##COEFFICIENT OF FRICTION\n", + "PI=3.141\n", + "THETA=(11/24.)*360.*PI/180.##ANGLE OF CONTACT\n", + "density=1.1##density of belt material in Mg/m**3\n", + "L=1.##in metre\n", + "t=9.5##THICKNESS OF BELT IN mm\n", + "Fb=2.5##PERMISSIBLE WORK STRESS IN N/mm**2\n", + "\n", + "##CALCULATION\n", + "V=PI*D*N/60.##VELOCITY IN m/s\n", + "X=P/V##X=T1-T2\n", + "Y=e**(U*THETA)##Y=T1/T2\n", + "T1=X*Y/(Y-1)\n", + "Mb=t*density*L/10**3.##value of m/b\n", + "Tc=Mb*V**2.##centrifugal tension/b\n", + "Tmaxb=t*Fb##max tension/b\n", + "b=T1/(Tmaxb-Tc)##thickness in mm\n", + "##output\n", + "print'%s %.1f %s'%('TENSION IN TIGHT SIDE OF THE BELT =',T1,' N')\n", + "print'%s %.1f %s'%('THICKNESS OF THE BELT IS =',b,' mm')\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "TENSION IN TIGHT SIDE OF THE BELT = 2573.5 N\n", + "THICKNESS OF THE BELT IS = 143.4 mm\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 10 PAGE 64\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##INPUT\n", + "t=5.##THICKNESS OF BELT IN m\n", + "PI=3.141\n", + "U=.3\n", + "e=2.71\n", + "THETA=155.*PI/180.##ANGLE OF CONTACT IN radians\n", + "V=30.##VELOCITY IN m/s\n", + "density=1.##in m/cm**3\n", + "L=1.##LENGTH\n", + "\n", + "##calculation\n", + "Xb=80.## (T1-T2)=80b;so let (T1-T2)/b=Xb\n", + "Y=e**(U*THETA)## LET Y=T1/T2\n", + "Zb=80.*Y/(Y-1.)## LET T1/b=Zb;BY SOLVING THE ABOVE 2 EQUATIONS WE WILL GET THIS EXPRESSION\n", + "Mb=t*L*density*10**-2.## m/b in N\n", + "Tcb=Mb*V**2.## centrifugal tension/b\n", + "Tmaxb=Zb+Tcb## MAX TENSION/b\n", + "Fb=Tmaxb/t##STRESS INDUCED IN TIGHT BELT\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('THE STRESS DEVELOPED ON THE TIGHT SIDE OF BELT=',Fb,' N/cm**2')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE STRESS DEVELOPED ON THE TIGHT SIDE OF BELT= 37.8 N/cm**2\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 11 PAGE 65\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##INPUT\n", + "C=4.5## CENTRE DISTANCE IN metres\n", + "D1=1.35## DIAMETER OF LARGER PULLEY IN metres\n", + "D2=.9## DIAMETER OF SMALLER PULLEY IN metres\n", + "To=2100.## INITIAL TENSION IN newtons\n", + "b=12.## WIDTH OF BELT IN cm\n", + "t=12.## THICKNESS OF BELT IN mm\n", + "d=1.## DENSITY IN gm/cm**3\n", + "U=.3## COEFFICIENT OF FRICTION\n", + "L=1.## length in metres\n", + "PI=3.141\n", + "e=2.71\n", + "\n", + "##CALCULATION\n", + "M=b*t*d*L*10**-2.## mass of belt per metre length in KG\n", + "V=(To/3./M)**.5## VELOCITY OF FOR MAX POWER TO BE TRANSMITTED IN m/s\n", + "Tc=M*V**2.## CENTRIFUGAL TENSION IN newtons\n", + "## LET (T1+T2)=X\n", + "X=2.*To-2.*Tc ## THE VALUE OF (T1+T2)\n", + "F=(D1-D2)/(2.*C)\n", + "ALPHA=math.asin(F/57.3)\n", + "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", + "## LET T1/T2=Y\n", + "Y=e**(U*THETA)## THE VALUE OF T1/T2\n", + "T1=X*Y/(Y+1.)## BY SOLVING X AND Y WE WILL GET THIS EQN\n", + "T2=X-T1\n", + "P=(T1-T2)*V/1000.## MAX POWER TRANSMITTED IN kilowatts\n", + "N1=V*60./(PI*D1)## SPEED OF LARGER PULLEY IN rpm\n", + "N2=V*60./(PI*D2)## SPEED OF SMALLER PULLEY IN rpm\n", + "##OUTPUT\n", + "print'%s %.1f %s'%(' MAX POWER TO BE TRANSMITTED =',P,' KW')\n", + "print'%s %.1f %s'%(' SPEED OF THE LARGER PULLEY =',N1,' rpm')\n", + "print'%s %.1f %s'%(' SPEED OF THE SMALLER PULLEY =',N2,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " MAX POWER TO BE TRANSMITTED = 27.0 KW\n", + " SPEED OF THE LARGER PULLEY = 312.0 rpm\n", + " SPEED OF THE SMALLER PULLEY = 468.0 rpm\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 12 PAGE 66\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##============================================================================================================================\n", + "##INPUT\n", + "PI=3.141\n", + "e=2.71\n", + "D1=1.20## DIAMETER OF DRIVING SHAFT IN m\n", + "D2=.50## DIAMETER OF DRIVEN SHAFT IN m\n", + "C=4.## CENTRE DISTANCE BETWEEN THE SHAFTS IN m\n", + "M=.9## MASS OF BELT PER METRE LENGTH IN kg\n", + "Tmax=2000## MAX TENSION IN N\n", + "U=.3## COEFFICIENT OF FRICTION\n", + "N1=200.## SPEED OF DRIVING SHAFT IN rpm\n", + "N2=450.## SPEED OF DRIVEN SHAFT IN rpm\n", + "##==============================================================================================================================\n", + "##CALCULATION\n", + "V=PI*D1*N1/60.## VELOCITY OF BELT IN m/s\n", + "Tc=M*V**2.## CENTRIFUGAL TENSION IN N\n", + "T1=Tmax-Tc## TENSION ON TIGHTSIDE IN N\n", + "F=(D1-D2)/(2.*C)\n", + "ALPHA=math.asin(F/57.3)\n", + "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", + "T2=T1/(e**(U*THETA))## TENSION ON SLACK SIDE IN N\n", + "TL=(T1-T2)*D1/2.## TORQUE ON THE SHAFT OF LARGER PULLEY IN N-m\n", + "TS=(T1-T2)*D2/2.## TORQUE ON THE SHAFT OF SMALLER PULLEY IN N-m\n", + "P=(T1-T2)*V/1000.## POWER TRANSMITTED IN kW\n", + "Pi=2.*PI*N1*TL/60000.## INPUT POWER\n", + "Po=2.*PI*N2*TS/60000.## OUTPUT POWER\n", + "Pl=Pi-Po## POWER LOST DUE TO FRICTION IN kW\n", + "n=Po/Pi*100.## EFFICIENCY OF DRIVE IN %\n", + "##==================================================================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('TORQUE ON LARGER SHAFT =',TL,'N-m')\n", + "print'%s %.1f %s'%('TORQUE ON SMALLER SHAFT =',TS,' N-m')\n", + "print'%s %.1f %s'%('POWER TRANSMITTED =',P,' kW')\n", + "print'%s %.1f %s'%('POWER LOST DUE TO FRICTION =',Pl,' kW')\n", + "print'%s %.1f %s'%('EFFICIENCY OF DRINE =',n,' percentage')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "TORQUE ON LARGER SHAFT = 679.0 N-m\n", + "TORQUE ON SMALLER SHAFT = 282.9 N-m\n", + "POWER TRANSMITTED = 14.2 kW\n", + "POWER LOST DUE TO FRICTION = 0.9 kW\n", + "EFFICIENCY OF DRINE = 93.8 percentage\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 13 PAGE 67\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##============================================================================================================================\n", + "##INPUT\n", + "PI=3.141\n", + "e=2.71\n", + "P=90## POWER OF A COMPRESSOR IN kW\n", + "N2=250.## SPEED OF DRIVEN SHAFT IN rpm\n", + "N1=750.## SPEED OF DRIVER SHAFT IN rpm\n", + "D2=1.## DIAMETER OF DRIVEN SHAFT IN m\n", + "C=1.75## CENTRE DISTANCE IN m\n", + "V=1600./60.## VELOCITY IN m/s\n", + "a=375.## CROSECTIONAL AREA IN mm**2\n", + "density=1000.## BELT DENSITY IN kg/m**3\n", + "L=1## length to be considered\n", + "Fb=2.5## STRESSS INDUCED IN MPa\n", + "beeta=35./2.## THE GROOVE ANGLE OF PULLEY\n", + "U=.25## COEFFICIENT OF FRICTION\n", + "##=================================================================================================================================\n", + "##CALCULATION\n", + "D1=N2*D2/N1## DIAMETER OF DRIVING SHAFT IN m\n", + "m=a*density*10**-6.*L## MASS OF THE BELT IN kg\n", + "Tmax=a*Fb## MAX TENSION IN N\n", + "Tc=m*V**2.## CENTRIFUGAL TENSION IN N\n", + "T1=Tmax-Tc## TENSION ON TIGHTSIDE OF BELT IN N\n", + "F=(D2-D1)/(2.*C)\n", + "ALPHA=math.asin(F/57.3)\n", + "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", + "T2=T1/(e**(U*THETA/math.sin(beeta/57.3)))##TENSION ON SLACKSIDE IN N\n", + "P2=(T1-T2)*V/1000.## POWER TRANSMITTED PER BELT kW\n", + "N=P/P2## NO OF V-BELTS\n", + "N3=N+1.\n", + "##======================================================================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s '%('NO OF BELTS REQUIRED TO TRANSMIT POWER=',N,' APPROXIMATELY=',N3,'')\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "NO OF BELTS REQUIRED TO TRANSMIT POWER= 5.4 APPROXIMATELY= 6.4 \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex14-pg68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 2,ILLUSTRATION 14 PAGE 68\n", + "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", + "import math\n", + "##============================================================================================================================\n", + "##INPUT\n", + "PI=3.141\n", + "e=2.71\n", + "P=75.## POWER IN kW\n", + "D=1.5## DIAMETER OF PULLEY IN m\n", + "U=.3## COEFFICIENT OF FRICTION\n", + "beeta=45./2.## GROOVE ANGLE\n", + "THETA=160.*PI/180.## ANGLE OF CONTACT IN radians\n", + "m=.6## MASS OF BELT IN kg/m\n", + "Tmax=800.## MAX TENSION IN N\n", + "N=200.## SPEED OF SHAFT IN rpm\n", + "##=============================================================================================================================\n", + "##calculation\n", + "V=PI*D*N/60.## VELOCITY OF ROPE IN m/s\n", + "Tc=m*V**2.## CENTRIFUGAL TENSION IN N\n", + "T1=Tmax-Tc## TENSION ON TIGHT SIDE IN N\n", + "T2=T1/(e**(U*THETA/math.sin(beeta/57.3)))##TENSION ON SLACKSIDE IN N\n", + "P2=(T1-T2)*V/1000.## POWER TRANSMITTED PER BELT kW\n", + "No=P/P2## NO OF V-BELTS\n", + "N3=No+1.## ROUNDING OFF\n", + "To=(T1+T2+Tc*2.)/2.## INITIAL TENSION\n", + "##================================================================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s '%('NO OF BELTS REQUIRED TO TRANSMIT POWER=',No,'' 'APPROXIMATELY=',N3,'')\n", + "print'%s %.1f %s'%('INITIAL ROPE TENSION=',To,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "NO OF BELTS REQUIRED TO TRANSMIT POWER= 8.3 APPROXIMATELY= 9.3 \n", + "INITIAL ROPE TENSION= 510.8 N\n" + ] + } + ], + "prompt_number": 16 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter3.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter3.ipynb new file mode 100755 index 00000000..74818ab4 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter3.ipynb @@ -0,0 +1,782 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9f3aa65b257e3f2aa586660a443f5f27bf555a236ce21a3b4fb7b3ab1cf26f12" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter3-FRICTION" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 1 PAGE NO 102\n", + "##TITLE:FRICTION\n", + "##FIRURE 3.16(a),3.16(b)\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "P1=180.## PULL APPLIED TO THE BODY IN NEWTONS\n", + "theta=30.## ANGLE AT WHICH P IS ACTING IN DEGREES\n", + "P2=220.## PUSH APPLIED TO THE BODY IN NEWTONS\n", + "##Rn= NORMAL REACTION\n", + "##F= FORCE OF FRICTION IN NEWTONS\n", + "##U= COEFFICIENT OF FRICTION\n", + "##W= WEIGHT OF THE BODY IN NEWTON\n", + "##==========================================================================================\n", + "##CALCULATION\n", + "F1=P1*math.cos(theta/57.3)## RESOLVING FORCES HORIZONTALLY FROM 3.16(a)\n", + "F2=P2*math.cos(theta/57.3)## RESOLVING FORCES HORIZONTALLY FROM 3.16(b)\n", + "## RESOLVING FORCES VERTICALLY Rn1=W-P1*sind(theta) from 3.16(a)\n", + "## RESOLVING FORCES VERTICALLY Rn2=W+P1*sind(theta) from 3.16(b)\n", + "## USING THE RELATION F1=U*Rn1 & F2=U*Rn2 AND SOLVING FOR W BY DIVIDING THESE TWO EQUATIONS\n", + "X=F1/F2## THIS IS THE VALUE OF Rn1/Rn2\n", + "Y1=P1*math.sin(theta/57.3)\n", + "Y2=P2*math.sin(theta/57.3)\n", + "W=(Y2*X+Y1)/(1-X)## BY SOLVING ABOVE 3 EQUATIONS\n", + "U=F1/(W-P1*math.sin(theta/57.3))## COEFFICIENT OF FRICTION\n", + "##=============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s '%('WEIGHT OF THE BODY =',W,'N''THE COEFFICIENT OF FRICTION =',U,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "WEIGHT OF THE BODY = 989.9 NTHE COEFFICIENT OF FRICTION = 0.2 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 2 PAGE NO 103\n", + "##TITLE:FRICTION\n", + "##FIRURE 3.17\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "THETA=45## ANGLE OF INCLINATION IN DEGREES\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N/mm**2\n", + "U=.1## COEFFICIENT FRICTION\n", + "##Rn=NORMAL REACTION\n", + "##M=MASS IN NEWTONS\n", + "##f=ACCELERATION OF THE BODY\n", + "u=0.## INITIAL VELOCITY\n", + "V=10.## FINAL VELOCITY IN m/s**2\n", + "##===========================================================================================\n", + "##CALCULATION\n", + "##CONSIDER THE EQUILIBRIUM OF FORCES PERPENDICULAR TO THE PLANE\n", + "##Rn=Mgcos(THETA)\n", + "##CONSIDER THE EQUILIBRIUM OF FORCES ALONG THE PLANE\n", + "##Mgsin(THETA)-U*Rn=M*f.............BY SOLVING THESE 2 EQUATIONS \n", + "f=g*math.sin(THETA/57.3)-U*g*math.cos(THETA/57.3)\n", + "s=(V**2-u**2)/(2*f)## DISTANCE ALONG THE PLANE IN metres\n", + "##==============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('DISTANCE ALONG THE INCLINED PLANE=',s,' m')\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "DISTANCE ALONG THE INCLINED PLANE= 8.0 m\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 3 PAGE NO 104\n", + "##TITLE:FRICTION\n", + "##FIRURE 3.18\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "W=500.## WEGHT IN NEWTONS\n", + "THETA=30.## ANGLE OF INCLINATION IN DEGRESS\n", + "U=0.2## COEFFICIENT FRICTION\n", + "S=15.## DISTANCE IN metres\n", + "##============================================================================================\n", + "Rn=W*math.cos(THETA/57.3)## NORMAL REACTION IN NEWTONS\n", + "P=W*math.sin(THETA/57.3)+U*Rn## PUSHING FORCE ALONG THE DIRECTION OF MOTION\n", + "w=P*S\n", + "##============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('WORK DONE BY THE FORCE=',w,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "WORK DONE BY THE FORCE= 5048.8 N-m\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 4 PAGE NO 104\n", + "##TITLE:FRICTION\n", + "##FIRURE 3.19(a) & 3.19(b)\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "P1=2000.## FORCE ACTING UPWARDS WHEN ANGLE=15 degrees IN NEWTONS\n", + "P2=2300.## FORCE ACTING UPWARDS WHEN ANGLE=20 degrees IN NEWTONS\n", + "THETA1=15.## ANGLE OF INCLINATION IN 3.19(a)\n", + "THETA2=20.## ANGLE OF INCLINATION IN 3.19(b)\n", + "##F1= FORCE OF FRICTION IN 3.19(a)\n", + "##Rn1= NORMAL REACTION IN 3.19(a)\n", + "##F2= FORCE OF FRICTION IN 3.19(b)\n", + "##Rn2= NORMAL REACTION IN 3.19(b)\n", + "##U= COEFFICIENT OF FRICTION\n", + "##===========================================================================================\n", + "##CALCULATION\n", + "##P1=F1+Rn1 RESOLVING THE FORCES ALONG THE PLANE\n", + "##Rn1=W*cosd(THETA1)....NORMAL REACTION IN 3.19(a)\n", + "##F1=U*Rn1\n", + "##BY SOLVING ABOVE EQUATIONS P1=W(U*cosd(THETA1)+sind(THETA1))---------------------1\n", + "##P2=F2+Rn2 RESOLVING THE FORCES PERPENDICULAR TO THE PLANE\n", + "##Rn2=W*cosd(THETA2)....NORMAL REACTION IN 3.19(b)\n", + "##F2=U*Rn2\n", + "##BY SOLVING ABOVE EQUATIONS P2=W(U*cosd(THETA2)+sind(THETA2))----------------------2\n", + "##BY SOLVING EQUATIONS 1 AND 2\n", + "X=P2/P1\n", + "U=(math.sin(THETA2/57.3)-(X*math.sin(THETA1/57.3)))/((X*math.cos(THETA1/57.3)-math.cos(THETA2/57.3)))## COEFFICIENT OF FRICTION\n", + "W=P1/(U*math.cos(THETA1/57.3)+math.sin(THETA1/57.3))\n", + "##=============================================================================================\n", + "##OUTPUT\n", + "##print'%s %.1f %s'%('%f',X)\n", + "print'%s %.1f %s %.1f %s '%('COEFFICIENT OF FRICTION=',U,'' 'WEIGHT OF THE BODY=',W,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COEFFICIENT OF FRICTION= 0.3 WEIGHT OF THE BODY= 3927.0 N \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 5 PAGE NO 105\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d=5.## DIAMETER OF SCREW JACK IN cm\n", + "p=1.25## PITCH IN cm\n", + "l=50.## LENGTH IN cm\n", + "U=.1## COEFFICIENT OF FRICTION\n", + "W=20000.## LOAD IN NEWTONS\n", + "PI=3.147\n", + "##=============================================================================================\n", + "##CALCULATION\n", + "ALPHA=math.atan((p/(PI*d)/57.3))\n", + "PY=math.atan(U/57.3)\n", + "P=W*math.tan((ALPHA+PY)*57.)\n", + "P1=P*d/(2.*l)\n", + "##=============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s '%('THE AMOUNT OF EFFORT NEED TO APPLY =',P1,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE AMOUNT OF EFFORT NEED TO APPLY = 180.4 N \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 6 PAGE NO 106\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d=50.## DIAMETER OF SCREW IN mm\n", + "p=12.5## PITCH IN mm\n", + "U=0.13## COEFFICIENT OF FRICTION\n", + "W=25000.## LOAD IN mm\n", + "PI=3.147\n", + "##===========================================================================================\n", + "##CALCULATION\n", + "ALPHA=math.atan((p/(PI*d))/57.3)\n", + "PY=math.atan(U/57.3)\n", + "P=W*math.tan((ALPHA+PY)/57.3)## FORCE REQUIRED TO RAISE THE LOAD IN N\n", + "T1=P*d/2.## TORQUE REQUIRED IN Nm\n", + "P1=W*math.tan((PY-ALPHA)/57.3)## FORCE REQUIRED TO LOWER THE SCREW IN N\n", + "T2=P1*d/2.## TORQUE IN N\n", + "X=T1/T2## RATIOS REQUIRED\n", + "n=math.tan((ALPHA/(ALPHA+PY))/57.3)## EFFICIENCY\n", + "##============================================================================================\n", + "print'%s %.1f %s'%('RATIO OF THE TORQUE REQUIRED TO RAISE THE LOAD,TO THE TORQUE REQUIRED TO LOWER THE LOAD =',X,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "RATIO OF THE TORQUE REQUIRED TO RAISE THE LOAD,TO THE TORQUE REQUIRED TO LOWER THE LOAD = 4.1 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 7 PAGE NO 107\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d=39.## DIAMETER OF THREAD IN mm\n", + "p=13.## PITCH IN mm\n", + "U=0.1## COEFFICIENT OF FRICTION\n", + "W=2500.## LOAD IN mm\n", + "PI=3.147\n", + "##===========================================================================================\n", + "##CALCULATION\n", + "ALPHA=math.atan((p/(PI*d))/57.3)\n", + "PY=math.atan(U/57.3)\n", + "P=W*math.tan((ALPHA+PY)*57.3)## FORCE IN N\n", + "T1=P*d/2.## TORQUE REQUIRED IN Nm\n", + "T=2.*T1## TORQUE REQUIRED ON THE COUPLING ROD IN Nm\n", + "K=2.*p## DISTANCE TRAVELLED FOR ONE REVOLUTION\n", + "N=20.8/K## NO OF REVOLUTIONS REQUIRED\n", + "w=2.*PI*N*T/100.## WORKDONE BY TORQUE\n", + "w1=w*(7500.-2500.)/2500.## WORKDONE TO INCREASE THE LOAD FROM 2500N TO 7500N\n", + "n=math.tan(ALPHA/57.3)/math.tan((ALPHA+PY)/57.3)## EFFICIENCY\n", + "##============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s '%('workdone against a steady load of 2500N=',w,' N' 'workdone if the load is increased from 2500N to 7500N=',w1,' N' 'efficiency=',n,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "workdone against a steady load of 2500N= 1025.5 Nworkdone if the load is increased from 2500N to 7500N= 2050.9 Nefficiency= 0.5 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 8 PAGE NO 107\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "W=50000.## WEIGHT OF THE SLUICE GATE IN NEWTON\n", + "P=40000.## POWER IN WATTS\n", + "N=580.## MAX MOTOR RUNNING SPEEED IN rpm\n", + "d=12.5## DIAMETER OF THE SCREW IN cm\n", + "p=2.5## PITCH IN cm\n", + "PI=3.147\n", + "U1=.08## COEFFICIENT OF FRICTION for SCREW\n", + "U2=.1## C.O.F BETWEEN GATES AND SCREW\n", + "Np=2000000.## NORMAL PRESSURE IN NEWTON\n", + "Fl=.15## FRICTION LOSS\n", + "n=1.-Fl## EFFICIENCY\n", + "ng=80.## NO OF TEETH ON GEAR\n", + "##===========================================================================================\n", + "##CALCULATION\n", + "TV=W+U2*Np## TOTAL VERTICAL HEAD IN NEWTON\n", + "ALPHA=math.atan((p/(PI*d))/57.3)## \n", + "PY=math.atan(U1/57.3)## \n", + "P1=TV*math.tan((ALPHA+PY)*57.3)## FORCE IN N\n", + "T=P1*d/2./100.## TORQUE IN N-m\n", + "Ng=60000.*n*P*10**-3./(2.*PI*T)## SPEED OF GEAR IN rpm\n", + "np=Ng*ng/N## NO OF TEETH ON PINION\n", + "##=========================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s '%('NO OF TEETH ON PINION =',np,' say ',np+1,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "NO OF TEETH ON PINION = 19.8 say 20.8 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 9 PAGE NO 108\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d=5.## MEAN DIAMETER OF SCREW IN cm\n", + "p=1.25## PITCH IN cm\n", + "W=10000.## LOAD AVAILABLE IN NEWTONS\n", + "dc=6.## MEAN DIAMETER OF COLLAR IN cm\n", + "U=.15## COEFFICIENT OF FRICTION OF SCREW\n", + "Uc=.18## COEFFICIENT OF FRICTION OF COLLAR\n", + "P1=100.## TANGENTIAL FORCE APPLIED IN NEWTON\n", + "PI=3.147\n", + "##============================================================================================\n", + "##CALCULATION\n", + "ALPHA=math.atan((p/(PI*d))/57.3)## \n", + "PY=math.atan(U/57.3)## \n", + "T1=W*d/2*math.tan((ALPHA+PY)/100)*57.3## TORQUE ON SCREW IN NEWTON\n", + "Tc=Uc*W*dc/2./100.## TORQUE ON COLLAR IN NEWTON\n", + "T=T1+Tc## TOTAL TORQUE\n", + "D=2.*T/P1/2.*100.## DIAMETER OF HAND WHEEL IN cm\n", + "##============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('SUITABLE DIAMETER OF HAND WHEEL =',D,' cm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "SUITABLE DIAMETER OF HAND WHEEL = 111.4 cm\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 10 PAGE NO 108\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "d=2.5## MEAN DIA OF BOLT IN cm\n", + "p=.6## PITCH IN cm\n", + "beeta=55/2.## VEE ANGLE\n", + "dc=4.## DIA OF COLLAR IN cm\n", + "U=.1## COEFFICIENT OF FRICTION OF BOLT\n", + "Uc=.18## COEFFICIENT OF FRICTION OF COLLAR\n", + "W=6500.## LOAD ON BOLT IN NEWTONS\n", + "L=38.## LENGTH OF SPANNER\n", + "##=============================================================================================\n", + "##CALCULATION\n", + "##LET X=tan(py)/tan(beeta)\n", + "##y=tan(ALPHA)*X\n", + "PY=math.atan(U)*57.3\n", + "ALPHA=math.atan((p/(PI*d)))*57.3\n", + "X=math.tan(PY/57.3)/math.cos(beeta/57.3)\n", + "Y=math.tan(ALPHA/57.3)\n", + "T1=W*d/2.*10**-2*(X+Y)/(1.-(X*Y))## TORQUE IN SCREW IN N-m\n", + "Tc=Uc*W*dc/2.*10**-2## TORQUE ON BEARING SERVICES IN N-m\n", + "T=T1+Tc## TOTAL TORQUE \n", + "P1=T/L*100.## FORCE REQUIRED BY @ THE END OF SPANNER\n", + "##=============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('FORCE REQUIRED @ THE END OF SPANNER=',P1,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FORCE REQUIRED @ THE END OF SPANNER= 102.3 N\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 11 PAGE NO 109\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d1=15.## DIAMETER OF VERTICAL SHAFT IN cm\n", + "N=100.## SPEED OF THE MOTOR rpm\n", + "W=20000.## LOAD AVILABLE IN N\n", + "U=.05## COEFFICIENT OF FRICTION\n", + "PI=3.147\n", + "##==================================================================================\n", + "T=2./3.*U*W*d1/2.## FRICTIONAL TORQUE IN N-m\n", + "PL=2.*PI*N*T/100./60.## POWER LOST IN FRICTION IN WATTS\n", + "##==================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('POWER LOST IN FRICTION=',PL,' watts')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "POWER LOST IN FRICTION= 524.5 watts\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 12 PAGE NO 109\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "d2=.30## DIAMETER OF SHAFT IN m \n", + "W=200000.## LOAD AVAILABLE IN NEWTONS\n", + "N=75.## SPEED IN rpm\n", + "U=.05## COEFFICIENT OF FRICTION\n", + "p=300000.## PRESSURE AVAILABLE IN N/m**2\n", + "P=16200.## POWER LOST DUE TO FRICTION IN WATTS\n", + "##====================================================================================\n", + "##CaLCULATION\n", + "T=P*60./2./PI/N## TORQUE INDUCED IN THE SHFT IN N-m\n", + "##LET X=(r1**3-r2**3)/(r1**2-r2**2)\n", + "X=(3./2.*T/U/W)\n", + "r2=.15## SINCE d2=.30 m\n", + "c=r2**2.-(X*r2)\n", + "b= r2-X\n", + "a= 1.\n", + "r1=( -b+ math.sqrt (b**2. -4.*a*c ))/(2.* a);## VALUE OF r1 IN m\n", + "d1=2*r1*100.## d1 IN cm\n", + "n=W/(PI*p*(r1**2.-r2**2.))\n", + "##================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('EXTERNAL DIAMETER OF SHAFT =',d1,' cm''NO OF COLLARS REQUIRED =',n,'' '0 or ',n+1,'')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "EXTERNAL DIAMETER OF SHAFT = 50.6 cmNO OF COLLARS REQUIRED = 5.1 0 or 6.1 \n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 13 PAGE NO 111\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "W=20000.## LOAD IN NEWTONS\n", + "ALPHA=120./2.## CONE ANGLE IN DEGREES\n", + "p=350000.## INTENSITY OF PRESSURE\n", + "U=.06\n", + "N=120.## SPEED OF THE SHAFT IN rpm\n", + "##d1=3d2\n", + "##r1=3r2\n", + "##===================================================================================\n", + "##CALCULATION\n", + "##LET K=d1/d2\n", + "k=3.\n", + "Z=W/((k**2.-1.)*PI*p)\n", + "r2=Z**.5## INTERNAL RADIUS IN m\n", + "r1=3.*r2\n", + "T=2.*U*W*(r1**3.-r2**3.)/(3.*math.sin(60/57.3)*(r1**2.-r2**2.))## total frictional torque in N\n", + "P=2.*PI*N*T/60000.## power absorbed in friction in kW\n", + "##================================================================================\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('THE INTERNAL DIAMETER OF SHAFT =',r2*100,' cm' 'THE EXTERNAL DIAMETER OF SHAFT =',r1*100,' cm' 'POWER ABSORBED IN FRICTION =',P,' kW')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE INTERNAL DIAMETER OF SHAFT = 4.8 cmTHE EXTERNAL DIAMETER OF SHAFT = 14.3 cmPOWER ABSORBED IN FRICTION = 1.8 kW\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex14-pg111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 14 PAGE NO 111\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "P=10000.## POWER TRRANSMITTED BY CLUTCH IN WATTS\n", + "N=3000.## SPEED IN rpm\n", + "p=.09## AXIAL PRESSURE IN N/mm**2\n", + "##d1=1.4d2 RELATION BETWEEN DIAMETERS \n", + "K=1.4## D1/D2\n", + "n=2.\n", + "U=.3## COEFFICIENT OF FRICTION\n", + "##==========================================================================================\n", + "T=P*60000./1000./(2.*PI*N)## ASSUMING UNIFORM WEAR TORQUE IN N-m\n", + "r2=(T*2./(n*U*2.*PI*p*10**6.*(K-1.)*(K+1.)))**(1./3.)## INTERNAL RADIUS\n", + "\n", + "##===========================================================================================\n", + "print'%s %.1f %s %.1f %s '%('THE INTERNAL RADIUS =',r2*100,' cm' 'THE EXTERNAL RADIUS =',K*r2*100,' cm')\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE INTERNAL RADIUS = 5.8 cmTHE EXTERNAL RADIUS = 8.1 cm \n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex15-pg111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 14 PAGE NO 111\n", + "##TITLE:FRICTION\n", + "\n", + "\n", + "\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "n1=3.## NO OF DICS ON DRIVING SHAFTS\n", + "n2=2.## NO OF DICS ON DRIVEN SHAFTS\n", + "d1=30.## DIAMETER OF DRIVING SHAFT IN cm\n", + "d2=15.## DIAMETER OF DRIVEN SHAFT IN cm\n", + "r1=d1/2.\n", + "r2=d2/2.\n", + "U=.3## COEFFICIENT FRICTION\n", + "P=30000.## TANSMITTING POWER IN WATTS\n", + "N=1800.## SPEED IN rpm\n", + "##===========================================================================================\n", + "##CALCULATION\n", + "n=n1+n2-1.## NO OF PAIRS OF CONTACT SURFACES\n", + "T=P*60000./(2.*PI*N)## TORQUE IN N-m\n", + "W=2.*T/(n*U*(r1+r2)*10.)## LOAD IN N\n", + "k=W/(2.*PI*(r1-r2))\n", + "p=k/r2/100.## MAX AXIAL INTENSITY OF PRESSURE IN N/mm**2\n", + "##===========================================================================================\n", + "## OUTPUT\n", + "print'%s %.3f %s'%('MAX AXIAL INTENSITY OF PRESSURE =',p,' N/mm^2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "MAX AXIAL INTENSITY OF PRESSURE = 0.033 N/mm**2\n" + ] + } + ], + "prompt_number": 15 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter3_1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter3_1.ipynb new file mode 100755 index 00000000..4627cb85 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter3_1.ipynb @@ -0,0 +1,782 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ed29195d644d35d300520425c16527a56484dc795844df5cf2a4a874db8c58d2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter3-Friction" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 1 PAGE NO 102\n", + "##TITLE:FRICTION\n", + "##FIRURE 3.16(a),3.16(b)\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "P1=180.## PULL APPLIED TO THE BODY IN NEWTONS\n", + "theta=30.## ANGLE AT WHICH P IS ACTING IN DEGREES\n", + "P2=220.## PUSH APPLIED TO THE BODY IN NEWTONS\n", + "##Rn= NORMAL REACTION\n", + "##F= FORCE OF FRICTION IN NEWTONS\n", + "##U= COEFFICIENT OF FRICTION\n", + "##W= WEIGHT OF THE BODY IN NEWTON\n", + "##==========================================================================================\n", + "##CALCULATION\n", + "F1=P1*math.cos(theta/57.3)## RESOLVING FORCES HORIZONTALLY FROM 3.16(a)\n", + "F2=P2*math.cos(theta/57.3)## RESOLVING FORCES HORIZONTALLY FROM 3.16(b)\n", + "## RESOLVING FORCES VERTICALLY Rn1=W-P1*sind(theta) from 3.16(a)\n", + "## RESOLVING FORCES VERTICALLY Rn2=W+P1*sind(theta) from 3.16(b)\n", + "## USING THE RELATION F1=U*Rn1 & F2=U*Rn2 AND SOLVING FOR W BY DIVIDING THESE TWO EQUATIONS\n", + "X=F1/F2## THIS IS THE VALUE OF Rn1/Rn2\n", + "Y1=P1*math.sin(theta/57.3)\n", + "Y2=P2*math.sin(theta/57.3)\n", + "W=(Y2*X+Y1)/(1-X)## BY SOLVING ABOVE 3 EQUATIONS\n", + "U=F1/(W-P1*math.sin(theta/57.3))## COEFFICIENT OF FRICTION\n", + "##=============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s '%('WEIGHT OF THE BODY =',W,'N''THE COEFFICIENT OF FRICTION =',U,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "WEIGHT OF THE BODY = 989.9 NTHE COEFFICIENT OF FRICTION = 0.2 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 2 PAGE NO 103\n", + "##TITLE:FRICTION\n", + "##FIRURE 3.17\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "THETA=45## ANGLE OF INCLINATION IN DEGREES\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N/mm**2\n", + "U=.1## COEFFICIENT FRICTION\n", + "##Rn=NORMAL REACTION\n", + "##M=MASS IN NEWTONS\n", + "##f=ACCELERATION OF THE BODY\n", + "u=0.## INITIAL VELOCITY\n", + "V=10.## FINAL VELOCITY IN m/s**2\n", + "##===========================================================================================\n", + "##CALCULATION\n", + "##CONSIDER THE EQUILIBRIUM OF FORCES PERPENDICULAR TO THE PLANE\n", + "##Rn=Mgcos(THETA)\n", + "##CONSIDER THE EQUILIBRIUM OF FORCES ALONG THE PLANE\n", + "##Mgsin(THETA)-U*Rn=M*f.............BY SOLVING THESE 2 EQUATIONS \n", + "f=g*math.sin(THETA/57.3)-U*g*math.cos(THETA/57.3)\n", + "s=(V**2-u**2)/(2*f)## DISTANCE ALONG THE PLANE IN metres\n", + "##==============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('DISTANCE ALONG THE INCLINED PLANE=',s,' m')\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "DISTANCE ALONG THE INCLINED PLANE= 8.0 m\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 3 PAGE NO 104\n", + "##TITLE:FRICTION\n", + "##FIRURE 3.18\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "W=500.## WEGHT IN NEWTONS\n", + "THETA=30.## ANGLE OF INCLINATION IN DEGRESS\n", + "U=0.2## COEFFICIENT FRICTION\n", + "S=15.## DISTANCE IN metres\n", + "##============================================================================================\n", + "Rn=W*math.cos(THETA/57.3)## NORMAL REACTION IN NEWTONS\n", + "P=W*math.sin(THETA/57.3)+U*Rn## PUSHING FORCE ALONG THE DIRECTION OF MOTION\n", + "w=P*S\n", + "##============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('WORK DONE BY THE FORCE=',w,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "WORK DONE BY THE FORCE= 5048.8 N-m\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 4 PAGE NO 104\n", + "##TITLE:FRICTION\n", + "##FIRURE 3.19(a) & 3.19(b)\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "P1=2000.## FORCE ACTING UPWARDS WHEN ANGLE=15 degrees IN NEWTONS\n", + "P2=2300.## FORCE ACTING UPWARDS WHEN ANGLE=20 degrees IN NEWTONS\n", + "THETA1=15.## ANGLE OF INCLINATION IN 3.19(a)\n", + "THETA2=20.## ANGLE OF INCLINATION IN 3.19(b)\n", + "##F1= FORCE OF FRICTION IN 3.19(a)\n", + "##Rn1= NORMAL REACTION IN 3.19(a)\n", + "##F2= FORCE OF FRICTION IN 3.19(b)\n", + "##Rn2= NORMAL REACTION IN 3.19(b)\n", + "##U= COEFFICIENT OF FRICTION\n", + "##===========================================================================================\n", + "##CALCULATION\n", + "##P1=F1+Rn1 RESOLVING THE FORCES ALONG THE PLANE\n", + "##Rn1=W*cosd(THETA1)....NORMAL REACTION IN 3.19(a)\n", + "##F1=U*Rn1\n", + "##BY SOLVING ABOVE EQUATIONS P1=W(U*cosd(THETA1)+sind(THETA1))---------------------1\n", + "##P2=F2+Rn2 RESOLVING THE FORCES PERPENDICULAR TO THE PLANE\n", + "##Rn2=W*cosd(THETA2)....NORMAL REACTION IN 3.19(b)\n", + "##F2=U*Rn2\n", + "##BY SOLVING ABOVE EQUATIONS P2=W(U*cosd(THETA2)+sind(THETA2))----------------------2\n", + "##BY SOLVING EQUATIONS 1 AND 2\n", + "X=P2/P1\n", + "U=(math.sin(THETA2/57.3)-(X*math.sin(THETA1/57.3)))/((X*math.cos(THETA1/57.3)-math.cos(THETA2/57.3)))## COEFFICIENT OF FRICTION\n", + "W=P1/(U*math.cos(THETA1/57.3)+math.sin(THETA1/57.3))\n", + "##=============================================================================================\n", + "##OUTPUT\n", + "##print'%s %.1f %s'%('%f',X)\n", + "print'%s %.1f %s %.1f %s '%('COEFFICIENT OF FRICTION=',U,'' 'WEIGHT OF THE BODY=',W,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COEFFICIENT OF FRICTION= 0.3 WEIGHT OF THE BODY= 3927.0 N \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 5 PAGE NO 105\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d=5.## DIAMETER OF SCREW JACK IN cm\n", + "p=1.25## PITCH IN cm\n", + "l=50.## LENGTH IN cm\n", + "U=.1## COEFFICIENT OF FRICTION\n", + "W=20000.## LOAD IN NEWTONS\n", + "PI=3.147\n", + "##=============================================================================================\n", + "##CALCULATION\n", + "ALPHA=math.atan((p/(PI*d)/57.3))\n", + "PY=math.atan(U/57.3)\n", + "P=W*math.tan((ALPHA+PY)*57.)\n", + "P1=P*d/(2.*l)\n", + "##=============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s '%('THE AMOUNT OF EFFORT NEED TO APPLY =',P1,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE AMOUNT OF EFFORT NEED TO APPLY = 180.4 N \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 6 PAGE NO 106\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d=50.## DIAMETER OF SCREW IN mm\n", + "p=12.5## PITCH IN mm\n", + "U=0.13## COEFFICIENT OF FRICTION\n", + "W=25000.## LOAD IN mm\n", + "PI=3.147\n", + "##===========================================================================================\n", + "##CALCULATION\n", + "ALPHA=math.atan((p/(PI*d))/57.3)\n", + "PY=math.atan(U/57.3)\n", + "P=W*math.tan((ALPHA+PY)/57.3)## FORCE REQUIRED TO RAISE THE LOAD IN N\n", + "T1=P*d/2.## TORQUE REQUIRED IN Nm\n", + "P1=W*math.tan((PY-ALPHA)/57.3)## FORCE REQUIRED TO LOWER THE SCREW IN N\n", + "T2=P1*d/2.## TORQUE IN N\n", + "X=T1/T2## RATIOS REQUIRED\n", + "n=math.tan((ALPHA/(ALPHA+PY))/57.3)## EFFICIENCY\n", + "##============================================================================================\n", + "print'%s %.1f %s'%('RATIO OF THE TORQUE REQUIRED TO RAISE THE LOAD,TO THE TORQUE REQUIRED TO LOWER THE LOAD =',X,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "RATIO OF THE TORQUE REQUIRED TO RAISE THE LOAD,TO THE TORQUE REQUIRED TO LOWER THE LOAD = 4.1 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 7 PAGE NO 107\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d=39.## DIAMETER OF THREAD IN mm\n", + "p=13.## PITCH IN mm\n", + "U=0.1## COEFFICIENT OF FRICTION\n", + "W=2500.## LOAD IN mm\n", + "PI=3.147\n", + "##===========================================================================================\n", + "##CALCULATION\n", + "ALPHA=math.atan((p/(PI*d))/57.3)\n", + "PY=math.atan(U/57.3)\n", + "P=W*math.tan((ALPHA+PY)*57.3)## FORCE IN N\n", + "T1=P*d/2.## TORQUE REQUIRED IN Nm\n", + "T=2.*T1## TORQUE REQUIRED ON THE COUPLING ROD IN Nm\n", + "K=2.*p## DISTANCE TRAVELLED FOR ONE REVOLUTION\n", + "N=20.8/K## NO OF REVOLUTIONS REQUIRED\n", + "w=2.*PI*N*T/100.## WORKDONE BY TORQUE\n", + "w1=w*(7500.-2500.)/2500.## WORKDONE TO INCREASE THE LOAD FROM 2500N TO 7500N\n", + "n=math.tan(ALPHA/57.3)/math.tan((ALPHA+PY)/57.3)## EFFICIENCY\n", + "##============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s '%('workdone against a steady load of 2500N=',w,' N' 'workdone if the load is increased from 2500N to 7500N=',w1,' N' 'efficiency=',n,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "workdone against a steady load of 2500N= 1025.5 Nworkdone if the load is increased from 2500N to 7500N= 2050.9 Nefficiency= 0.5 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 8 PAGE NO 107\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "W=50000.## WEIGHT OF THE SLUICE GATE IN NEWTON\n", + "P=40000.## POWER IN WATTS\n", + "N=580.## MAX MOTOR RUNNING SPEEED IN rpm\n", + "d=12.5## DIAMETER OF THE SCREW IN cm\n", + "p=2.5## PITCH IN cm\n", + "PI=3.147\n", + "U1=.08## COEFFICIENT OF FRICTION for SCREW\n", + "U2=.1## C.O.F BETWEEN GATES AND SCREW\n", + "Np=2000000.## NORMAL PRESSURE IN NEWTON\n", + "Fl=.15## FRICTION LOSS\n", + "n=1.-Fl## EFFICIENCY\n", + "ng=80.## NO OF TEETH ON GEAR\n", + "##===========================================================================================\n", + "##CALCULATION\n", + "TV=W+U2*Np## TOTAL VERTICAL HEAD IN NEWTON\n", + "ALPHA=math.atan((p/(PI*d))/57.3)## \n", + "PY=math.atan(U1/57.3)## \n", + "P1=TV*math.tan((ALPHA+PY)*57.3)## FORCE IN N\n", + "T=P1*d/2./100.## TORQUE IN N-m\n", + "Ng=60000.*n*P*10**-3./(2.*PI*T)## SPEED OF GEAR IN rpm\n", + "np=Ng*ng/N## NO OF TEETH ON PINION\n", + "##=========================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s '%('NO OF TEETH ON PINION =',np,' say ',np+1,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "NO OF TEETH ON PINION = 19.8 say 20.8 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 9 PAGE NO 108\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d=5.## MEAN DIAMETER OF SCREW IN cm\n", + "p=1.25## PITCH IN cm\n", + "W=10000.## LOAD AVAILABLE IN NEWTONS\n", + "dc=6.## MEAN DIAMETER OF COLLAR IN cm\n", + "U=.15## COEFFICIENT OF FRICTION OF SCREW\n", + "Uc=.18## COEFFICIENT OF FRICTION OF COLLAR\n", + "P1=100.## TANGENTIAL FORCE APPLIED IN NEWTON\n", + "PI=3.147\n", + "##============================================================================================\n", + "##CALCULATION\n", + "ALPHA=math.atan((p/(PI*d))/57.3)## \n", + "PY=math.atan(U/57.3)## \n", + "T1=W*d/2*math.tan((ALPHA+PY)/100)*57.3## TORQUE ON SCREW IN NEWTON\n", + "Tc=Uc*W*dc/2./100.## TORQUE ON COLLAR IN NEWTON\n", + "T=T1+Tc## TOTAL TORQUE\n", + "D=2.*T/P1/2.*100.## DIAMETER OF HAND WHEEL IN cm\n", + "##============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('SUITABLE DIAMETER OF HAND WHEEL =',D,' cm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "SUITABLE DIAMETER OF HAND WHEEL = 111.4 cm\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 10 PAGE NO 108\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "d=2.5## MEAN DIA OF BOLT IN cm\n", + "p=.6## PITCH IN cm\n", + "beeta=55/2.## VEE ANGLE\n", + "dc=4.## DIA OF COLLAR IN cm\n", + "U=.1## COEFFICIENT OF FRICTION OF BOLT\n", + "Uc=.18## COEFFICIENT OF FRICTION OF COLLAR\n", + "W=6500.## LOAD ON BOLT IN NEWTONS\n", + "L=38.## LENGTH OF SPANNER\n", + "##=============================================================================================\n", + "##CALCULATION\n", + "##LET X=tan(py)/tan(beeta)\n", + "##y=tan(ALPHA)*X\n", + "PY=math.atan(U)*57.3\n", + "ALPHA=math.atan((p/(PI*d)))*57.3\n", + "X=math.tan(PY/57.3)/math.cos(beeta/57.3)\n", + "Y=math.tan(ALPHA/57.3)\n", + "T1=W*d/2.*10**-2*(X+Y)/(1.-(X*Y))## TORQUE IN SCREW IN N-m\n", + "Tc=Uc*W*dc/2.*10**-2## TORQUE ON BEARING SERVICES IN N-m\n", + "T=T1+Tc## TOTAL TORQUE \n", + "P1=T/L*100.## FORCE REQUIRED BY @ THE END OF SPANNER\n", + "##=============================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('FORCE REQUIRED @ THE END OF SPANNER=',P1,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "FORCE REQUIRED @ THE END OF SPANNER= 102.3 N\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 11 PAGE NO 109\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "d1=15.## DIAMETER OF VERTICAL SHAFT IN cm\n", + "N=100.## SPEED OF THE MOTOR rpm\n", + "W=20000.## LOAD AVILABLE IN N\n", + "U=.05## COEFFICIENT OF FRICTION\n", + "PI=3.147\n", + "##==================================================================================\n", + "T=2./3.*U*W*d1/2.## FRICTIONAL TORQUE IN N-m\n", + "PL=2.*PI*N*T/100./60.## POWER LOST IN FRICTION IN WATTS\n", + "##==================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('POWER LOST IN FRICTION=',PL,' watts')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "POWER LOST IN FRICTION= 524.5 watts\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 12 PAGE NO 109\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "d2=.30## DIAMETER OF SHAFT IN m \n", + "W=200000.## LOAD AVAILABLE IN NEWTONS\n", + "N=75.## SPEED IN rpm\n", + "U=.05## COEFFICIENT OF FRICTION\n", + "p=300000.## PRESSURE AVAILABLE IN N/m**2\n", + "P=16200.## POWER LOST DUE TO FRICTION IN WATTS\n", + "##====================================================================================\n", + "##CaLCULATION\n", + "T=P*60./2./PI/N## TORQUE INDUCED IN THE SHFT IN N-m\n", + "##LET X=(r1**3-r2**3)/(r1**2-r2**2)\n", + "X=(3./2.*T/U/W)\n", + "r2=.15## SINCE d2=.30 m\n", + "c=r2**2.-(X*r2)\n", + "b= r2-X\n", + "a= 1.\n", + "r1=( -b+ math.sqrt (b**2. -4.*a*c ))/(2.* a);## VALUE OF r1 IN m\n", + "d1=2*r1*100.## d1 IN cm\n", + "n=W/(PI*p*(r1**2.-r2**2.))\n", + "##================================================================================\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('EXTERNAL DIAMETER OF SHAFT =',d1,' cm''NO OF COLLARS REQUIRED =',n,'' '0 or ',n+1,'')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "EXTERNAL DIAMETER OF SHAFT = 50.6 cmNO OF COLLARS REQUIRED = 5.1 0 or 6.1 \n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 13 PAGE NO 111\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "W=20000.## LOAD IN NEWTONS\n", + "ALPHA=120./2.## CONE ANGLE IN DEGREES\n", + "p=350000.## INTENSITY OF PRESSURE\n", + "U=.06\n", + "N=120.## SPEED OF THE SHAFT IN rpm\n", + "##d1=3d2\n", + "##r1=3r2\n", + "##===================================================================================\n", + "##CALCULATION\n", + "##LET K=d1/d2\n", + "k=3.\n", + "Z=W/((k**2.-1.)*PI*p)\n", + "r2=Z**.5## INTERNAL RADIUS IN m\n", + "r1=3.*r2\n", + "T=2.*U*W*(r1**3.-r2**3.)/(3.*math.sin(60/57.3)*(r1**2.-r2**2.))## total frictional torque in N\n", + "P=2.*PI*N*T/60000.## power absorbed in friction in kW\n", + "##================================================================================\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('THE INTERNAL DIAMETER OF SHAFT =',r2*100,' cm' 'THE EXTERNAL DIAMETER OF SHAFT =',r1*100,' cm' 'POWER ABSORBED IN FRICTION =',P,' kW')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE INTERNAL DIAMETER OF SHAFT = 4.8 cmTHE EXTERNAL DIAMETER OF SHAFT = 14.3 cmPOWER ABSORBED IN FRICTION = 1.8 kW\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex14-pg111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 14 PAGE NO 111\n", + "##TITLE:FRICTION\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "P=10000.## POWER TRRANSMITTED BY CLUTCH IN WATTS\n", + "N=3000.## SPEED IN rpm\n", + "p=.09## AXIAL PRESSURE IN N/mm**2\n", + "##d1=1.4d2 RELATION BETWEEN DIAMETERS \n", + "K=1.4## D1/D2\n", + "n=2.\n", + "U=.3## COEFFICIENT OF FRICTION\n", + "##==========================================================================================\n", + "T=P*60000./1000./(2.*PI*N)## ASSUMING UNIFORM WEAR TORQUE IN N-m\n", + "r2=(T*2./(n*U*2.*PI*p*10**6.*(K-1.)*(K+1.)))**(1./3.)## INTERNAL RADIUS\n", + "\n", + "##===========================================================================================\n", + "print'%s %.1f %s %.1f %s '%('THE INTERNAL RADIUS =',r2*100,' cm' 'THE EXTERNAL RADIUS =',K*r2*100,' cm')\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE INTERNAL RADIUS = 5.8 cmTHE EXTERNAL RADIUS = 8.1 cm \n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex15-pg111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 3 ILLUSRTATION 14 PAGE NO 111\n", + "##TITLE:FRICTION\n", + "\n", + "\n", + "\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "n1=3.## NO OF DICS ON DRIVING SHAFTS\n", + "n2=2.## NO OF DICS ON DRIVEN SHAFTS\n", + "d1=30.## DIAMETER OF DRIVING SHAFT IN cm\n", + "d2=15.## DIAMETER OF DRIVEN SHAFT IN cm\n", + "r1=d1/2.\n", + "r2=d2/2.\n", + "U=.3## COEFFICIENT FRICTION\n", + "P=30000.## TANSMITTING POWER IN WATTS\n", + "N=1800.## SPEED IN rpm\n", + "##===========================================================================================\n", + "##CALCULATION\n", + "n=n1+n2-1.## NO OF PAIRS OF CONTACT SURFACES\n", + "T=P*60000./(2.*PI*N)## TORQUE IN N-m\n", + "W=2.*T/(n*U*(r1+r2)*10.)## LOAD IN N\n", + "k=W/(2.*PI*(r1-r2))\n", + "p=k/r2/100.## MAX AXIAL INTENSITY OF PRESSURE IN N/mm**2\n", + "##===========================================================================================\n", + "## OUTPUT\n", + "print'%s %.3f %s'%('MAX AXIAL INTENSITY OF PRESSURE =',p,' N/mm^2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "MAX AXIAL INTENSITY OF PRESSURE = 0.033 N/mm**2\n" + ] + } + ], + "prompt_number": 15 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter4.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter4.ipynb new file mode 100755 index 00000000..de08c088 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter4.ipynb @@ -0,0 +1,946 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:fdf50666cfa70019db7241b6e1fb1e819c70fb9987ea0caadb1e777e93e7d898" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter4-Gears and Gear Drivers" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 1, Page 133\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "TA=48.;##Wheel A teeth\n", + "TB=30.;##Wheel B teeth\n", + "m=5.;##Module pitch in mm\n", + "phi=20.;##Pressure angle in degrees\n", + "add=m;##Addendum in mm\n", + "\n", + "##CALCULATIONS\n", + "R=(m*TA)/2.;##Pitch circle radius of wheel A in mm\n", + "RA=R+add;##Radius of addendum circle of wheel A in mm\n", + "r=(m*TB)/2.;##Pitch circle radius of wheel B in mm\n", + "rA=r+add;##Radius of addendum circle of wheel B in mm\n", + "lp=(math.sqrt((RA**2.)-((R**2.)*(math.cos(phi/57.3)**2.))))+(math.sqrt((rA**2.)-((r**2.)*(math.cos(phi/57.3)**2.))))-((R+r)*math.sin(phi/57.3));##Length of path of contact in mm\n", + "la=lp/math.cos(phi/57.3);##Length of arc of contact in mm\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('Length of arc of contact is ',la,' mm')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length of arc of contact is 26.7 mm\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 2, Page 133\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "TA=40.;##Wheel A teeth\n", + "TB=TA;##Wheel B teeth\n", + "m=6.;##Module pitch in mm\n", + "phi=20.;##Pressure angle in degrees\n", + "pi=3.141\n", + "x=1.75;##Ratio of length of arc of contact to circular pitch\n", + "\n", + "##CALCULATIONS\n", + "Cp=m*pi;##Circular pitch in mm\n", + "R=(m*TA)/2.;##Pitch circle radius of wheel A in mm\n", + "r=R;##Pitch circle radius of wheel B in mm\n", + "la=x*Cp;##Length of arc of contact in mm\n", + "lp=la*math.cos(phi/57.3);##Length of path of contact in mm\n", + "RA=math.sqrt((((lp/2.)+(R*math.sin(phi/57.3)))**2.)+((R**2.)*(math.cos(phi/57.3))**2.));##Radius of addendum circle of each wheel in mm\n", + "add=RA-R;##Addendum in mm\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('Addendum of wheel is ',add,' mm')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Addendum of wheel is 6.1 mm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 3, Page 134\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "TA=48.;##Gear teeth\n", + "TB=24.;##Pinion teeth\n", + "m=6.;##Module in mm\n", + "phi=20.;##Pressure angle in degrees\n", + "\n", + "##CALCULATIONS\n", + "r=(m*TB)/2.;##Pitch circle radius of pinion in mm\n", + "R=(m*TA)/2.;##Pitch circle radius of gear in mm\n", + "RA=math.sqrt(((((r*math.sin(phi/57.3))/2.)+(R*math.sin(phi/57.3)))**2.)+((R**2)*(math.cos(phi/57.3))**2));##Radius of addendum circle of gear in mm\n", + "rA=math.sqrt(((((R*math.sin(phi/57.3))/2.)+(r*math.sin(phi/57.3)))**2.)+((r**2)*(math.cos(phi/57.3))**2));##Radius of addendum circle of pinion in mm\n", + "addp=rA-r;##Addendum for pinion in mm\n", + "addg=RA-R;##Addendum for gear in mm\n", + "lp=((R+r)*math.sin(phi/57.3))/2.;##Length of path of contact in mm\n", + "la=lp/math.cos(phi/57.3);##Length of arc of contact in mm\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s '%('Addendum for pinion is',addp,' mm' ' Addendum for gear is ',addg,' mm' ' Length of arc of contact is ',la,' mm')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Addendum for pinion is 11.7 mm Addendum for gear is 4.7 mm Length of arc of contact is 39.3 mm \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 4, Page 135\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "x=3.5;##Ratio of teeth of wheels\n", + "C=1.2;##Centre distance between axes in m\n", + "DP=4.4;##Diametrical pitch in cm\n", + "\n", + "##CALCULATIONS\n", + "D=2*C*100.;##Sum of diameters of wheels in cm\n", + "T=D*DP;##Sum of teeth of wheels\n", + "TB1=T/(x+1);##Teeth of wheel B\n", + "TB=math.floor(TB1);##Teeth of whhel B\n", + "TA=x*TB;##Teeth of wheel A\n", + "DA=TA/DP;##Diametral pitch of gear A in cm\n", + "DB=TB/DP;##Diametral pitch of gear B in cm\n", + "Ce=(DA+DB)/2.;##Exact centre distance between shafts in cm\n", + "TB2=math.ceil(TB1);##Teeth of wheel B\n", + "TA2=T-TB2;##Teeth of wheel A\n", + "VR=TA2/TB2;##Velocity ratio\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s%.1f %s%.1f %s'%('Number of teeth on wheel A is ',TA,'' 'Number of teeth on wheel B is ',TB,'' ' Exact centre distance is ',Ce,' cm ' 'If centre distance is ',C,' m' 'then Velocity ratio is',VR,'')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of teeth on wheel A is 819.0 Number of teeth on wheel B is 234.0 Exact centre distance is 119.7 cm If centre distance is 1.2 mthen Velocity ratio is3.5 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 5, Page 136\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "C=600;##Distance between shafts in mm\n", + "Cp=30;##Circular pitch in mm\n", + "NA=200;##Speed of wheel A in rpm\n", + "NB=600;##Speed of wheel B in rpm\n", + "F=18;##Tangential pressure in kN\n", + "pi=3.141\n", + "\n", + "##CALCULATIONS\n", + "a=Cp/(pi*10.);##Ratio of pitch diameter of wheel A to teeth of wheel A in cm\n", + "b=Cp/(pi*10.);##Ratio of pitch diameter of wheel B to teeth of wheel B in cm\n", + "T=(2*C)/(a*10.);##Sum of teeth of wheels\n", + "r=NB/NA;##Ratio of teeth of wheels\n", + "TB=T/(r+1);##Teeth of wheel B\n", + "TB1=math.ceil(TB);##Teeth of wheel B\n", + "TA=TB1*r;##Teeth of wheel A\n", + "DA=a*TA;##Pitch diameter of wheel A in cm\n", + "DB=b*TB1;##Pitch diameter of wheel B in cm\n", + "CPA=(pi*DA)/TA;##Circular pitch of gear A in cm\n", + "CPB=(pi*DB)/TB1;##Circular pitch of gear B in cm\n", + "C1=(DA+DB)*10/2.;##Exact centre distance in mm\n", + "P=(F*1000.*pi*DA*NA)/(60.*1000.*100.);##Power transmitted in kW\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('Number of teeth on wheel A is ',TA,' '' Number of teeth on wheel B is ',TB1,' '' Pitch diameter of wheel A is ',DA,' cm'' Pitch diameter of wheel B is ',DB,' cm'' Circular pitch of wheel A is',CPA,'cm ' 'Circular pitch of wheel B is ',CPB,' cm '' Exact centre distance between shafts is ',C1,' mm'' Power transmitted is',P,' kW')\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of teeth on wheel A is 96.0 Number of teeth on wheel B is 32.0 Pitch diameter of wheel A is 91.7 cm Pitch diameter of wheel B is 30.6 cm Circular pitch of wheel A is 3.0 cm Circular pitch of wheel B is 3.0 cm Exact centre distance between shafts is 611.3 mm Power transmitted is 172.8 kW \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 6, Page 137\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "r=16.;##Speed ratio\n", + "mA=4.;##Module of gear A in mm\n", + "mB=mA;##Module of gear B in mm\n", + "mC=2.5;##Mosule of gear C in mm\n", + "mD=mC;##Module of gear D in mm\n", + "C=150.;##Distance between shafts in mm\n", + "\n", + "##CALCULATIONS\n", + "t=math.sqrt(r);##Ratio of teeth\n", + "T1=(C*2.)/mA;##Sum of teeth of wheels A and B\n", + "T2=(C*2.)/mC;##Sum of teeth of wheels C and D\n", + "TA=T1/(t+1.);##Teeth of gear A\n", + "TB=T1-TA;##Teeth of gear B\n", + "TC=T2/(t+1.);##Teeth of gear C\n", + "TD=T2-TC;##Teeth of gear D\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Number of teeth on gear A is ',TA,' '' Number of teeth on gear B is ',TB,'' 'Number of teeth on gear C is ',TC,'' ' Number of teeth on gear D is ',TD,'')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of teeth on gear A is 15.0 Number of teeth on gear B is 60.0 Number of teeth on gear C is 24.0 Number of teeth on gear D is 96.0 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 7, Page 138\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "N=4.5;##No. of turns\n", + "\n", + "##CALCULATIONS\n", + "Vh=N/2.;##Velocity ratio of main spring spindle to hour hand spindle\n", + "Vm=12.;##Velocity ratio of minute hand spindle to hour hand spindle\n", + "T1=8.## assumed no of teeth on gear 1\n", + "T2=32.## assumed no of teeth on gear 2\n", + "T3=(T1+T2)/4.## no of teeth on gear 3\n", + "T4=(T1+T2)-T3## no of teeth on gear 4\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('no of teeth on gear 1=',T1,'' 'no of teeth on gear 2=',T2,' ''no of teeth on gear 3=',T3,' ''no of teeth on gear 4=',T4,'')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "no of teeth on gear 1= 8.0 no of teeth on gear 2= 32.0 no of teeth on gear 3= 10.0 no of teeth on gear 4= 30.0 \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 8, Page 139\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##Input data\n", + "Tb=70.;##Teeth of wheel B\n", + "Tc=25.;##Teeth of wheel C\n", + "Td=80.;##Teeth of wheel D\n", + "Na=-100.;##Speed of arm A in clockwise in rpm\n", + "y=-100.##Arm A rotates at 100 rpm clockwise\n", + "\n", + "##Calculations\n", + "Te=(Tc+Td-Tb);##Teeth of wheel E\n", + "x=(y/0.5)\n", + "Nc=(y-(Td*x)/Tc);##Speed of wheel C in rpm\n", + "\n", + "##Output\n", + "print'%s %.1f %s'%('Speed of wheel C is ',Nc,' rpm ''Direction of wheel C is anti-clockwise')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed of wheel C is 540.0 rpm Direction of wheel C is anti-clockwise\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 9, Page 140\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##Input data\n", + "Tb=25.;##Teeth of wheel B\n", + "Tc=40.;##Teeth of wheel C\n", + "Td=10.;##Teeth of wheel D\n", + "Te=25.;##Teeth of wheel E\n", + "Tf=30.;##Teeth of wheel F\n", + "y=-120.;##Speed of arm A in clockwise in rpm\n", + "\n", + "##Calculations\n", + "x=(-y/4.)\n", + "Nb=x+y;##Speed of wheel B in rpm\n", + "Nf=(-10/3.)*x+y;##Speed of wheel F in rpm\n", + "\n", + "##Output\n", + "print'%s %.1f %s %.1f %s'%('Speed of wheel B is',Nb,' rpm Direction of wheel B is clockwise' ' Speed of wheel F is ',Nf,' rpm Direction of wheel F is clockwise')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed of wheel B is -90.0 rpm Direction of wheel B is clockwise Speed of wheel F is -220.0 rpm Direction of wheel F is clockwise\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 10, Page 141\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##Input data\n", + "Ta=96.;##Teeth of wheel A\n", + "Tc=48.;##Teeth of wheel C\n", + "y=-20.;##Speed of arm C in rpm in clockwise\n", + "\n", + "##Calculations\n", + "x=(y*Ta)/Tc\n", + "Tb=(Ta-Tc)/2.;##Teeth of wheel B\n", + "Nb=(-Tc/Tb)*x+y;##Speed of wheel B in rpm\n", + "Nc=x+y;##Speed of wheel C in rpm\n", + "\n", + "##Output\n", + "print'%s %.1f %s %.1f %s'%('Speed of wheel B is ',Nb,' rpm' 'Speed of wheel C is ',Nc,' rpm')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed of wheel B is 60.0 rpmSpeed of wheel C is -60.0 rpm\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 11, Page 142\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "import numpy\n", + "from numpy.linalg import inv\n", + "##Input data\n", + "Ta=40.## no of teeth on gear A\n", + "Td=90.## no of teeth on gear D\n", + "\n", + "##Calculations\n", + "Tb=(Td-Ta)/2.## no of teeth on gear B\n", + "Tc=Tb## no of teeth on gear C\n", + "##\n", + "##x+y=-1\n", + "##-40x+90y=45\n", + "\n", + "A=([[1, 1],[-Ta, Td]])##Coefficient matrix\n", + "\n", + "B=([[-1],[Td/2]])##Constant matrix\n", + " \n", + "X=numpy.dot(inv(A) ,B)##Variable matrix\n", + "##\n", + "##x+y=-1\n", + "##-40x+90y=0\n", + "A1=([[1, 1],[-Ta, Td]])##Coefficient matrix\n", + "B1=([[-1],[0]])##Constant matrix\n", + "X1=numpy.dot(inv(A1) ,B1)##Variable matrix\n", + "b=X1[1] \n", + "print(X[1]) \n", + "print'%s %.4f %s'%('speed of the arm =',b,' revolution clockwise')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[ 0.03846154]\n", + "speed of the arm = -0.3077 revolution clockwise\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg144" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 12, Page 144\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "\n", + "\n", + "##Input data\n", + "Te=30.;##Teeth of wheel E\n", + "Tb=24.;##Teeth of wheel B\n", + "Tc=22.;##Teeth of wheel C\n", + "Td=70.;##Teeth of wheel D\n", + "Th=15.;##Teeth of wheel H\n", + "Nv=100.;##Speed of shaft V in rpm\n", + "Nx=300.;##Speed of spindle X in rpm\n", + "\n", + "##Calculations\n", + "Nh=Nv;##Speed of wheel H in rpm\n", + "Ne=(-Th/Te)*Nv;##Speed of wheel E in rpm\n", + "Ta=(Tc+Td-Tb);##Teeth of wheel A\n", + "##x+y=-50\n", + "##y=300\n", + "x=(Ne-Nx)\n", + "Nz=(187/210.)*x+Nx;##;##Speed of wheel Z in rpm\n", + "\n", + "##Output\n", + "print'%s %.1f %s'%('Speed of wheel Z is ',Nz,' rpm Direction of wheel Z is opposite to that of X')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed of wheel Z is -11.7 rpm Direction of wheel Z is opposite to that of X\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg145" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 13, Page 145\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "\n", + "\n", + "##Input data\n", + "Tp=20.;##Teeth of wheel P\n", + "Tq=30.;##Teeth of wheel Q\n", + "Tr=10.;##Teeth of wheel R\n", + "Nx=50.;##Speed of shaft X in rpm\n", + "Na=100.;##Speed of arm A in rpm\n", + "\n", + "##Calculations\n", + "##x+y=-50\n", + "##y=100\n", + "x=(-Nx-Na)\n", + "y=(-2.*x+Na);##Speed of Y in rpm\n", + "\n", + "##Output\n", + "print'%s %.1f %s'%('Speed of driven shaft Y is ',y,' rpm Direction of driven shaft Y is anti-clockwise')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed of driven shaft Y is 400.0 rpm Direction of driven shaft Y is anti-clockwise\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 14, Page 146\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##Input data\n", + "d=216.;##Ring diameter in mm\n", + "m=4.;##Module in mm\n", + "\n", + "##Calculations\n", + "Td=(d/m);##Teeth of wheel D\n", + "Tb=Td/4.;##Teeth of wheel B\n", + "Tb1=math.ceil(Tb);##Teeth of wheel B\n", + "Td1=4.*Tb1;##Teeth of wheel D\n", + "Tc1=(Td1-Tb1)/2.;##Teeth of wheel C\n", + "d1=m*Td1;##Pitch circle diameter in mm\n", + "\n", + "##Output\n", + "print'%s %.1f %s %.1f %s %.1f %s%.1f %s '%('Teeth of wheel B is ',Tb1,' ' 'Teeth of wheel C is ',Tc1,' ' 'Teeth of wheel D is ',Td1,' '' Exact pitch circle diameter is ',d1,' mm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Teeth of wheel B is 14.0 Teeth of wheel C is 21.0 Teeth of wheel D is 56.0 Exact pitch circle diameter is 224.0 mm \n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex15-pg147" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 15, Page 147\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##Input data\n", + "Ta=100.## no of teeth on gear A\n", + "Tc=101.## no of teeth on gear C\n", + "Td=99.## no of teeth on gear D\n", + "Tp=20.## no of teeth on planet gear\n", + "y=1.## from table 4.9(arm B makes one revolution)\n", + "x=-y## as gear is fixed\n", + "\n", + "##Calculations\n", + "Nc=(Ta*x)/Tc+y## Revolution of gear C \n", + "Nd=(Ta*x)/Td+y## Revolution of gear D\n", + "\n", + "##Output\n", + "print'%s %.4f %s %.4f %s '%('Revolution of gear C =',Nc,'' ' Revolution of gear D = ',Nd,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Revolution of gear C = 0.0099 Revolution of gear D = -0.0101 \n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex16-pg148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 16, Page 148\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##Input data\n", + "Ta=12.## no of teeth on gear A\n", + "Tb=60.## no of teeth on gear B\n", + "N=1000.## speed of propeller shaft in rpm\n", + "Nc=210.## speed of gear C in rpm\n", + "\n", + "##Calculations\n", + "Nb=(Ta*N)/Tb## speed of gear B in rpm\n", + "x=(Nb-Nc)\n", + "Nd=Nb+x## speed of road wheel driven by D\n", + "\n", + "##Output\n", + "print'%s %.1f %s'%('speed of road wheel driven by D= ',Nd,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "speed of road wheel driven by D= 190.0 rpm\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex17-pg148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 17, Page 148\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "import numpy\n", + "from numpy.linalg import inv\n", + "##Input data\n", + "Ta=20.## no of teeth on pinion A\n", + "Tb=25.## no of teeth on wheel B\n", + "Tc=50.## no of teeth on gear C\n", + "Td=60.## no of teeth on gear D\n", + "Te=60.## no of teeth on gear E\n", + "Na=200.## SPEED of the gear A\n", + "Nd=100.## speed of the gear D\n", + "\n", + "##calculations\n", + "##(i)\n", + "##(5/6)x+y=0\n", + "##(5/4)x+y=200\n", + "A1=([[Tc/Td, 1],[Tb/Ta, 1]])##Coefficient matrix\n", + "B1=([[0],[Na]]) ##Constant matrix\n", + "X1=numpy.dot(inv(A1),B1)##Variable matrix\n", + "Ne1=X1[1]-(Tc/Td)*X1[0]## \n", + "T1=(-Ne1/Na)## ratio of torques when D is fixed\n", + "##(ii)\n", + "##(5/4)x+y=200\n", + "##(5/6)x+y=100\n", + "A2=([[Tc/Td, 1],[Tb/Ta, 1]])##Coefficient matrix\n", + "B2=([[Nd],[Na]])##Constant matrix\n", + "X2=numpy.dot(inv(A2),B2)##Variable matrix\n", + "Ne2=X2[1]-(Tc/Td)*X2[0]\n", + "T2=(-Ne2/Na)## ratio of torques when D ratates at 100 rpm\n", + "\n", + "##Output\n", + "print'%s %.2f %s %.2f %s %.2f %s %.2f %s'%('speed of E= ',Ne1,' rpm in clockwise direction' and 'speed of E in 2nd case(when D rotates at 100 rpm)= ',Ne2,' rpm in clockwise direction' and 'ratio of torques when D is fixed= ',T1,' ' 'ratio of torques when D ratates at 100 rpm= ',T2,'')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "speed of E= -800.00 speed of E in 2nd case(when D rotates at 100 rpm)= -300.00 ratio of torques when D is fixed= 4.00 ratio of torques when D ratates at 100 rpm= 1.50 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter4_1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter4_1.ipynb new file mode 100755 index 00000000..f1bdaef9 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter4_1.ipynb @@ -0,0 +1,946 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7cb010f7555dca225180a41fc0eba5cf332623b14bf784043b289ca4a89a15f6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter4-Gears and Gear Drivers" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 1, Page 133\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "TA=48.;##Wheel A teeth\n", + "TB=30.;##Wheel B teeth\n", + "m=5.;##Module pitch in mm\n", + "phi=20.;##Pressure angle in degrees\n", + "add=m;##Addendum in mm\n", + "\n", + "##CALCULATIONS\n", + "R=(m*TA)/2.;##Pitch circle radius of wheel A in mm\n", + "RA=R+add;##Radius of addendum circle of wheel A in mm\n", + "r=(m*TB)/2.;##Pitch circle radius of wheel B in mm\n", + "rA=r+add;##Radius of addendum circle of wheel B in mm\n", + "lp=(math.sqrt((RA**2.)-((R**2.)*(math.cos(phi/57.3)**2.))))+(math.sqrt((rA**2.)-((r**2.)*(math.cos(phi/57.3)**2.))))-((R+r)*math.sin(phi/57.3));##Length of path of contact in mm\n", + "la=lp/math.cos(phi/57.3);##Length of arc of contact in mm\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('Length of arc of contact is ',la,' mm')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length of arc of contact is 26.7 mm\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 2, Page 133\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "TA=40.;##Wheel A teeth\n", + "TB=TA;##Wheel B teeth\n", + "m=6.;##Module pitch in mm\n", + "phi=20.;##Pressure angle in degrees\n", + "pi=3.141\n", + "x=1.75;##Ratio of length of arc of contact to circular pitch\n", + "\n", + "##CALCULATIONS\n", + "Cp=m*pi;##Circular pitch in mm\n", + "R=(m*TA)/2.;##Pitch circle radius of wheel A in mm\n", + "r=R;##Pitch circle radius of wheel B in mm\n", + "la=x*Cp;##Length of arc of contact in mm\n", + "lp=la*math.cos(phi/57.3);##Length of path of contact in mm\n", + "RA=math.sqrt((((lp/2.)+(R*math.sin(phi/57.3)))**2.)+((R**2.)*(math.cos(phi/57.3))**2.));##Radius of addendum circle of each wheel in mm\n", + "add=RA-R;##Addendum in mm\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s'%('Addendum of wheel is ',add,' mm')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Addendum of wheel is 6.1 mm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 3, Page 134\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "TA=48.;##Gear teeth\n", + "TB=24.;##Pinion teeth\n", + "m=6.;##Module in mm\n", + "phi=20.;##Pressure angle in degrees\n", + "\n", + "##CALCULATIONS\n", + "r=(m*TB)/2.;##Pitch circle radius of pinion in mm\n", + "R=(m*TA)/2.;##Pitch circle radius of gear in mm\n", + "RA=math.sqrt(((((r*math.sin(phi/57.3))/2.)+(R*math.sin(phi/57.3)))**2.)+((R**2)*(math.cos(phi/57.3))**2));##Radius of addendum circle of gear in mm\n", + "rA=math.sqrt(((((R*math.sin(phi/57.3))/2.)+(r*math.sin(phi/57.3)))**2.)+((r**2)*(math.cos(phi/57.3))**2));##Radius of addendum circle of pinion in mm\n", + "addp=rA-r;##Addendum for pinion in mm\n", + "addg=RA-R;##Addendum for gear in mm\n", + "lp=((R+r)*math.sin(phi/57.3))/2.;##Length of path of contact in mm\n", + "la=lp/math.cos(phi/57.3);##Length of arc of contact in mm\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s '%('Addendum for pinion is',addp,' mm' ' Addendum for gear is ',addg,' mm' ' Length of arc of contact is ',la,' mm')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Addendum for pinion is 11.7 mm Addendum for gear is 4.7 mm Length of arc of contact is 39.3 mm \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 4, Page 135\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "x=3.5;##Ratio of teeth of wheels\n", + "C=1.2;##Centre distance between axes in m\n", + "DP=4.4;##Diametrical pitch in cm\n", + "\n", + "##CALCULATIONS\n", + "D=2*C*100.;##Sum of diameters of wheels in cm\n", + "T=D*DP;##Sum of teeth of wheels\n", + "TB1=T/(x+1);##Teeth of wheel B\n", + "TB=math.floor(TB1);##Teeth of whhel B\n", + "TA=x*TB;##Teeth of wheel A\n", + "DA=TA/DP;##Diametral pitch of gear A in cm\n", + "DB=TB/DP;##Diametral pitch of gear B in cm\n", + "Ce=(DA+DB)/2.;##Exact centre distance between shafts in cm\n", + "TB2=math.ceil(TB1);##Teeth of wheel B\n", + "TA2=T-TB2;##Teeth of wheel A\n", + "VR=TA2/TB2;##Velocity ratio\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s%.1f %s%.1f %s'%('Number of teeth on wheel A is ',TA,'' 'Number of teeth on wheel B is ',TB,'' ' Exact centre distance is ',Ce,' cm ' 'If centre distance is ',C,' m' 'then Velocity ratio is',VR,'')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of teeth on wheel A is 819.0 Number of teeth on wheel B is 234.0 Exact centre distance is 119.7 cm If centre distance is 1.2 mthen Velocity ratio is3.5 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 5, Page 136\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "C=600;##Distance between shafts in mm\n", + "Cp=30;##Circular pitch in mm\n", + "NA=200;##Speed of wheel A in rpm\n", + "NB=600;##Speed of wheel B in rpm\n", + "F=18;##Tangential pressure in kN\n", + "pi=3.141\n", + "\n", + "##CALCULATIONS\n", + "a=Cp/(pi*10.);##Ratio of pitch diameter of wheel A to teeth of wheel A in cm\n", + "b=Cp/(pi*10.);##Ratio of pitch diameter of wheel B to teeth of wheel B in cm\n", + "T=(2*C)/(a*10.);##Sum of teeth of wheels\n", + "r=NB/NA;##Ratio of teeth of wheels\n", + "TB=T/(r+1);##Teeth of wheel B\n", + "TB1=math.ceil(TB);##Teeth of wheel B\n", + "TA=TB1*r;##Teeth of wheel A\n", + "DA=a*TA;##Pitch diameter of wheel A in cm\n", + "DB=b*TB1;##Pitch diameter of wheel B in cm\n", + "CPA=(pi*DA)/TA;##Circular pitch of gear A in cm\n", + "CPB=(pi*DB)/TB1;##Circular pitch of gear B in cm\n", + "C1=(DA+DB)*10/2.;##Exact centre distance in mm\n", + "P=(F*1000.*pi*DA*NA)/(60.*1000.*100.);##Power transmitted in kW\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('Number of teeth on wheel A is ',TA,' '' Number of teeth on wheel B is ',TB1,' '' Pitch diameter of wheel A is ',DA,' cm'' Pitch diameter of wheel B is ',DB,' cm'' Circular pitch of wheel A is',CPA,'cm ' 'Circular pitch of wheel B is ',CPB,' cm '' Exact centre distance between shafts is ',C1,' mm'' Power transmitted is',P,' kW')\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of teeth on wheel A is 96.0 Number of teeth on wheel B is 32.0 Pitch diameter of wheel A is 91.7 cm Pitch diameter of wheel B is 30.6 cm Circular pitch of wheel A is 3.0 cm Circular pitch of wheel B is 3.0 cm Exact centre distance between shafts is 611.3 mm Power transmitted is 172.8 kW \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 6, Page 137\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "r=16.;##Speed ratio\n", + "mA=4.;##Module of gear A in mm\n", + "mB=mA;##Module of gear B in mm\n", + "mC=2.5;##Mosule of gear C in mm\n", + "mD=mC;##Module of gear D in mm\n", + "C=150.;##Distance between shafts in mm\n", + "\n", + "##CALCULATIONS\n", + "t=math.sqrt(r);##Ratio of teeth\n", + "T1=(C*2.)/mA;##Sum of teeth of wheels A and B\n", + "T2=(C*2.)/mC;##Sum of teeth of wheels C and D\n", + "TA=T1/(t+1.);##Teeth of gear A\n", + "TB=T1-TA;##Teeth of gear B\n", + "TC=T2/(t+1.);##Teeth of gear C\n", + "TD=T2-TC;##Teeth of gear D\n", + "\n", + "##OUTPUT\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Number of teeth on gear A is ',TA,' '' Number of teeth on gear B is ',TB,'' 'Number of teeth on gear C is ',TC,'' ' Number of teeth on gear D is ',TD,'')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of teeth on gear A is 15.0 Number of teeth on gear B is 60.0 Number of teeth on gear C is 24.0 Number of teeth on gear D is 96.0 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 7, Page 138\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##INPUT DATA\n", + "N=4.5;##No. of turns\n", + "\n", + "##CALCULATIONS\n", + "Vh=N/2.;##Velocity ratio of main spring spindle to hour hand spindle\n", + "Vm=12.;##Velocity ratio of minute hand spindle to hour hand spindle\n", + "T1=8.## assumed no of teeth on gear 1\n", + "T2=32.## assumed no of teeth on gear 2\n", + "T3=(T1+T2)/4.## no of teeth on gear 3\n", + "T4=(T1+T2)-T3## no of teeth on gear 4\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('no of teeth on gear 1=',T1,'' 'no of teeth on gear 2=',T2,' ''no of teeth on gear 3=',T3,' ''no of teeth on gear 4=',T4,'')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "no of teeth on gear 1= 8.0 no of teeth on gear 2= 32.0 no of teeth on gear 3= 10.0 no of teeth on gear 4= 30.0 \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 8, Page 139\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##Input data\n", + "Tb=70.;##Teeth of wheel B\n", + "Tc=25.;##Teeth of wheel C\n", + "Td=80.;##Teeth of wheel D\n", + "Na=-100.;##Speed of arm A in clockwise in rpm\n", + "y=-100.##Arm A rotates at 100 rpm clockwise\n", + "\n", + "##Calculations\n", + "Te=(Tc+Td-Tb);##Teeth of wheel E\n", + "x=(y/0.5)\n", + "Nc=(y-(Td*x)/Tc);##Speed of wheel C in rpm\n", + "\n", + "##Output\n", + "print'%s %.1f %s'%('Speed of wheel C is ',Nc,' rpm ''Direction of wheel C is anti-clockwise')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed of wheel C is 540.0 rpm Direction of wheel C is anti-clockwise\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 9, Page 140\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##Input data\n", + "Tb=25.;##Teeth of wheel B\n", + "Tc=40.;##Teeth of wheel C\n", + "Td=10.;##Teeth of wheel D\n", + "Te=25.;##Teeth of wheel E\n", + "Tf=30.;##Teeth of wheel F\n", + "y=-120.;##Speed of arm A in clockwise in rpm\n", + "\n", + "##Calculations\n", + "x=(-y/4.)\n", + "Nb=x+y;##Speed of wheel B in rpm\n", + "Nf=(-10/3.)*x+y;##Speed of wheel F in rpm\n", + "\n", + "##Output\n", + "print'%s %.1f %s %.1f %s'%('Speed of wheel B is',Nb,' rpm Direction of wheel B is clockwise' ' Speed of wheel F is ',Nf,' rpm Direction of wheel F is clockwise')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed of wheel B is -90.0 rpm Direction of wheel B is clockwise Speed of wheel F is -220.0 rpm Direction of wheel F is clockwise\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 10, Page 141\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##Input data\n", + "Ta=96.;##Teeth of wheel A\n", + "Tc=48.;##Teeth of wheel C\n", + "y=-20.;##Speed of arm C in rpm in clockwise\n", + "\n", + "##Calculations\n", + "x=(y*Ta)/Tc\n", + "Tb=(Ta-Tc)/2.;##Teeth of wheel B\n", + "Nb=(-Tc/Tb)*x+y;##Speed of wheel B in rpm\n", + "Nc=x+y;##Speed of wheel C in rpm\n", + "\n", + "##Output\n", + "print'%s %.1f %s %.1f %s'%('Speed of wheel B is ',Nb,' rpm' 'Speed of wheel C is ',Nc,' rpm')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "##================================END OF PROGRAM=============================================\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed of wheel B is 60.0 rpmSpeed of wheel C is -60.0 rpm\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 11, Page 142\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "import numpy\n", + "from numpy.linalg import inv\n", + "##Input data\n", + "Ta=40.## no of teeth on gear A\n", + "Td=90.## no of teeth on gear D\n", + "\n", + "##Calculations\n", + "Tb=(Td-Ta)/2.## no of teeth on gear B\n", + "Tc=Tb## no of teeth on gear C\n", + "##\n", + "##x+y=-1\n", + "##-40x+90y=45\n", + "\n", + "A=([[1, 1],[-Ta, Td]])##Coefficient matrix\n", + "\n", + "B=([[-1],[Td/2]])##Constant matrix\n", + " \n", + "X=numpy.dot(inv(A) ,B)##Variable matrix\n", + "##\n", + "##x+y=-1\n", + "##-40x+90y=0\n", + "A1=([[1, 1],[-Ta, Td]])##Coefficient matrix\n", + "B1=([[-1],[0]])##Constant matrix\n", + "X1=numpy.dot(inv(A1) ,B1)##Variable matrix\n", + "b=X1[1] \n", + "print(X[1]) \n", + "print'%s %.4f %s'%('speed of the arm =',b,' revolution clockwise')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[ 0.03846154]\n", + "speed of the arm = -0.3077 revolution clockwise\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg144" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 12, Page 144\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "\n", + "\n", + "##Input data\n", + "Te=30.;##Teeth of wheel E\n", + "Tb=24.;##Teeth of wheel B\n", + "Tc=22.;##Teeth of wheel C\n", + "Td=70.;##Teeth of wheel D\n", + "Th=15.;##Teeth of wheel H\n", + "Nv=100.;##Speed of shaft V in rpm\n", + "Nx=300.;##Speed of spindle X in rpm\n", + "\n", + "##Calculations\n", + "Nh=Nv;##Speed of wheel H in rpm\n", + "Ne=(-Th/Te)*Nv;##Speed of wheel E in rpm\n", + "Ta=(Tc+Td-Tb);##Teeth of wheel A\n", + "##x+y=-50\n", + "##y=300\n", + "x=(Ne-Nx)\n", + "Nz=(187/210.)*x+Nx;##;##Speed of wheel Z in rpm\n", + "\n", + "##Output\n", + "print'%s %.1f %s'%('Speed of wheel Z is ',Nz,' rpm Direction of wheel Z is opposite to that of X')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed of wheel Z is -11.7 rpm Direction of wheel Z is opposite to that of X\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex13-pg145" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 13, Page 145\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "\n", + "\n", + "##Input data\n", + "Tp=20.;##Teeth of wheel P\n", + "Tq=30.;##Teeth of wheel Q\n", + "Tr=10.;##Teeth of wheel R\n", + "Nx=50.;##Speed of shaft X in rpm\n", + "Na=100.;##Speed of arm A in rpm\n", + "\n", + "##Calculations\n", + "##x+y=-50\n", + "##y=100\n", + "x=(-Nx-Na)\n", + "y=(-2.*x+Na);##Speed of Y in rpm\n", + "\n", + "##Output\n", + "print'%s %.1f %s'%('Speed of driven shaft Y is ',y,' rpm Direction of driven shaft Y is anti-clockwise')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed of driven shaft Y is 400.0 rpm Direction of driven shaft Y is anti-clockwise\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 14, Page 146\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##Input data\n", + "d=216.;##Ring diameter in mm\n", + "m=4.;##Module in mm\n", + "\n", + "##Calculations\n", + "Td=(d/m);##Teeth of wheel D\n", + "Tb=Td/4.;##Teeth of wheel B\n", + "Tb1=math.ceil(Tb);##Teeth of wheel B\n", + "Td1=4.*Tb1;##Teeth of wheel D\n", + "Tc1=(Td1-Tb1)/2.;##Teeth of wheel C\n", + "d1=m*Td1;##Pitch circle diameter in mm\n", + "\n", + "##Output\n", + "print'%s %.1f %s %.1f %s %.1f %s%.1f %s '%('Teeth of wheel B is ',Tb1,' ' 'Teeth of wheel C is ',Tc1,' ' 'Teeth of wheel D is ',Td1,' '' Exact pitch circle diameter is ',d1,' mm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Teeth of wheel B is 14.0 Teeth of wheel C is 21.0 Teeth of wheel D is 56.0 Exact pitch circle diameter is 224.0 mm \n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex15-pg147" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 15, Page 147\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##Input data\n", + "Ta=100.## no of teeth on gear A\n", + "Tc=101.## no of teeth on gear C\n", + "Td=99.## no of teeth on gear D\n", + "Tp=20.## no of teeth on planet gear\n", + "y=1.## from table 4.9(arm B makes one revolution)\n", + "x=-y## as gear is fixed\n", + "\n", + "##Calculations\n", + "Nc=(Ta*x)/Tc+y## Revolution of gear C \n", + "Nd=(Ta*x)/Td+y## Revolution of gear D\n", + "\n", + "##Output\n", + "print'%s %.4f %s %.4f %s '%('Revolution of gear C =',Nc,'' ' Revolution of gear D = ',Nd,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Revolution of gear C = 0.0099 Revolution of gear D = -0.0101 \n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex16-pg148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 16, Page 148\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "\n", + "##Input data\n", + "Ta=12.## no of teeth on gear A\n", + "Tb=60.## no of teeth on gear B\n", + "N=1000.## speed of propeller shaft in rpm\n", + "Nc=210.## speed of gear C in rpm\n", + "\n", + "##Calculations\n", + "Nb=(Ta*N)/Tb## speed of gear B in rpm\n", + "x=(Nb-Nc)\n", + "Nd=Nb+x## speed of road wheel driven by D\n", + "\n", + "##Output\n", + "print'%s %.1f %s'%('speed of road wheel driven by D= ',Nd,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "speed of road wheel driven by D= 190.0 rpm\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex17-pg148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##Chapter-4, Illustration 17, Page 148\n", + "##Title: Gears and Gear Drivers\n", + "##=============================================================================\n", + "import math\n", + "import numpy\n", + "from numpy.linalg import inv\n", + "##Input data\n", + "Ta=20.## no of teeth on pinion A\n", + "Tb=25.## no of teeth on wheel B\n", + "Tc=50.## no of teeth on gear C\n", + "Td=60.## no of teeth on gear D\n", + "Te=60.## no of teeth on gear E\n", + "Na=200.## SPEED of the gear A\n", + "Nd=100.## speed of the gear D\n", + "\n", + "##calculations\n", + "##(i)\n", + "##(5/6)x+y=0\n", + "##(5/4)x+y=200\n", + "A1=([[Tc/Td, 1],[Tb/Ta, 1]])##Coefficient matrix\n", + "B1=([[0],[Na]]) ##Constant matrix\n", + "X1=numpy.dot(inv(A1),B1)##Variable matrix\n", + "Ne1=X1[1]-(Tc/Td)*X1[0]## \n", + "T1=(-Ne1/Na)## ratio of torques when D is fixed\n", + "##(ii)\n", + "##(5/4)x+y=200\n", + "##(5/6)x+y=100\n", + "A2=([[Tc/Td, 1],[Tb/Ta, 1]])##Coefficient matrix\n", + "B2=([[Nd],[Na]])##Constant matrix\n", + "X2=numpy.dot(inv(A2),B2)##Variable matrix\n", + "Ne2=X2[1]-(Tc/Td)*X2[0]\n", + "T2=(-Ne2/Na)## ratio of torques when D ratates at 100 rpm\n", + "\n", + "##Output\n", + "print'%s %.2f %s %.2f %s %.2f %s %.2f %s'%('speed of E= ',Ne1,' rpm in clockwise direction' and 'speed of E in 2nd case(when D rotates at 100 rpm)= ',Ne2,' rpm in clockwise direction' and 'ratio of torques when D is fixed= ',T1,' ' 'ratio of torques when D ratates at 100 rpm= ',T2,'')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "speed of E= -800.00 speed of E in 2nd case(when D rotates at 100 rpm)= -300.00 ratio of torques when D is fixed= 4.00 ratio of torques when D ratates at 100 rpm= 1.50 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter5.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter5.ipynb new file mode 100755 index 00000000..f33e7643 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter5.ipynb @@ -0,0 +1,413 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5906799cfbbbc1071564cbe6c16af88dcd0f4ba1965a4d189758faaa2356010c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter5-Inertia Force Analysis in Machines" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg160" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 1 PAGE NO 160\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "import math\n", + "pi=3.141\n", + "r=.3## radius of crank in m\n", + "l=1.## length of connecting rod in m\n", + "N=200.## speed of the engine in rpm\n", + "n=l/r\n", + "##===================\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "\n", + "teeta=math.acos((-n+((n**2)+4*2*1)**.5)/(2*2))*57.3## angle of inclination of crank in degrees\n", + "Vp=w*r*(math.sin(teeta/57.3)+(math.sin((2*teeta)/57.3)/n))## maximum velocity of the piston in m/s\n", + "print'%s %.1f %s'%('Maximum velocity of the piston = ',Vp,' m/s')\n", + "print'%s %.2f %s'%('teeta',teeta,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum velocity of the piston = 7.0 m/s\n", + "teeta 74.96 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 2 PAGE NO 161\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "import math\n", + "PI=3.141\n", + "r=.3## length of crank in metres\n", + "l=1.5## length of connecting rod in metres\n", + "N=180.## speed of rotation in rpm\n", + "teeta=40.## angle of inclination of crank in degrees\n", + "##============================\n", + "n=l/r\n", + "w=2.*PI*N/60## angular speed in rad/s\n", + "Vp=w*r*(math.sin(teeta/57.3)+math.sin((2.*teeta/57.3)/(2.*n)))## velocity of piston in m/s\n", + "fp=w**2.*r*(math.cos(teeta/57.3)+math.cos(2.*teeta/57.3)/(2.*n))## acceleration of piston in m/s**2\n", + "costeeta1=(-n+(n**2.+4.*2.*1.)**.5)/4.\n", + "teeta1=math.acos(costeeta1)*(57.3)## position of crank from inner dead centre position for zero acceleration of piston\n", + "##===========================\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('Velocity of Piston = ',Vp,' m/s'' Acceleration of piston =',fp,' m/s**2'' position of crank from inner dead centre position for zero acceleration of piston=',teeta1,' degrees')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity of Piston = 4.4 m/s Acceleration of piston = 83.5 m/s**2 position of crank from inner dead centre position for zero acceleration of piston= 79.3 degrees\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 3 PAGE NO 161\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "import math\n", + "pi=3.141\n", + "D=.3## Diameter of steam engine in m\n", + "L=.5## length of stroke in m\n", + "r=L/2.\n", + "mR=100.## equivalent of mass of reciprocating parts in kg\n", + "N=200.## speed of engine in rpm\n", + "teeta=45## angle of inclination of crank in degrees\n", + "p1=1.*10**6## gas pressure in N/m**2\n", + "p2=35.*10**3## back pressure in N/m**2\n", + "n=4.## ratio of crank radius to the length of stroke\n", + "##=================================\n", + "w=2.*pi*N/60## angular speed in rad/s\n", + "Fl=pi/4.*D**2.*(p1-p2)## Net load on piston in N\n", + "Fi=mR*w**2*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(2*n))## inertia force due to reciprocating parts\n", + "Fp=Fl-Fi## Piston effort\n", + "T=Fp*r*(math.sin(teeta/57.3)+(math.sin((2*teeta)/57.3))/(2.*(n**2-(math.sin(teeta/57.3))**2)**.5))\n", + "print'%s %.1f %s %.1f %s '%('Piston effort = ',Fp,' N' 'Turning moment on the crank shaft = ',T,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Piston effort = 60447.0 NTurning moment on the crank shaft = 12604.2 N-m \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg162" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 4 PAGE NO 162\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "import math\n", + "pi=3.141\n", + "D=.10## Diameter of petrol engine in m\n", + "L=.12## Stroke length in m\n", + "l=.25## length of connecting in m\n", + "r=L/2.\n", + "mR=1.2## mass of piston in kg\n", + "N=1800.## speed in rpm\n", + "teeta=25.## angle of inclination of crank in degrees\n", + "p=680.*10**3## gas pressure in N/m**2\n", + "n=l/r\n", + "g=9.81## acceleration due to gravity\n", + "##=======================================\n", + "w=2.*pi*N/60.## angular speed in rpm\n", + "Fl=pi/4.*D**2.*p## force due to gas pressure in N\n", + "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n))## inertia force due to reciprocating parts in N\n", + "Fp=Fl-Fi+mR*g## net force on piston in N\n", + "Fq=n*Fp/((n**2-(math.sin(teeta/57.3))**2.)**.5)## resultant load on gudgeon pin in N\n", + "Fn=Fp*math.sin(teeta/57.3)/((n**2-(math.sin(teeta/57.3))**2.)**.5)## thrust on cylinder walls in N\n", + "fi=Fl+mR*g## inertia force of the reciprocating parts before the gudgeon pin load is reversed in N\n", + "w1=(fi/mR/r/(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n)))**.5\n", + "N1=60.*w1/(2.*pi)\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Net force on piston = ',Fp,' N'' Resultant load on gudgeon pin = ',Fq,' N'' Thrust on cylinder walls = ',Fn,' N'' speed at which other things remining same,the gudgeon pin load would be reversed in directionm= ',N1,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net force on piston = 2639.3 N Resultant load on gudgeon pin = 2652.9 N Thrust on cylinder walls = 269.1 N speed at which other things remining same,the gudgeon pin load would be reversed in directionm= 2528.4 rpm \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 5 PAGE NO 163\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "##Figure 5.3\n", + "import math\n", + "pi=3.141\n", + "N=1800.## speed of the petrol engine in rpm\n", + "r=.06## radius of crank in m\n", + "l=.240## length of connecting rod in m\n", + "D=.1## diameter of the piston in m\n", + "mR=1## mass of piston in kg\n", + "p=.8*10**6## gas pressure in N/m**2\n", + "x=.012## distance moved by piston in m\n", + "##===============================================\n", + "w=2.*pi*N/60.## angular velocity of the engine in rad/s\n", + "n=l/r\n", + "Fl=pi/4.*D**2.*p## load on the piston in N\n", + "teeta=32.## by mearument from the figure 5.3\n", + "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/n)## inertia force due to reciprocating parts in N\n", + "Fp=Fl-Fi## net load on the gudgeon pin in N\n", + "Fq=n*Fp/((n**2.-(math.sin(teeta/57.3))**2.)**.5)## thrust in the connecting rod in N\n", + "Fn=Fp*math.sin(teeta/57.3)/((n**2-(math.sin(teeta/57.3))**2)**.5)## reaction between the piston and cylinder in N\n", + "w1=(Fl/mR/r/(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n)))**.5\n", + "N1=60.*w1/(2.*pi)## \n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s'%('Net load on the gudgeon pin= ',Fp,' N''Thrust in the connecting rod= ',Fq,' N'' Reaction between the cylinder and piston= ',Fn,' N'' The engine speed at which the above values become zero= ',N1,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net load on the gudgeon pin= 4241.2 NThrust in the connecting rod= 4278.9 N Reaction between the cylinder and piston= 566.8 N The engine speed at which the above values become zero= 3158.0 rpm\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg165" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 6 PAGE NO 165\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "import math\n", + "pi=3.141\n", + "D=.25## diameter of horizontal steam engine in m\n", + "N=180.## speed of the engine in rpm\n", + "d=.05## diameter of piston in m\n", + "P=36000.## power of the engine in watts\n", + "n=3.## ration of length of connecting rod to the crank radius\n", + "p1=5.8*10**5## pressure on cover end side in N/m**2\n", + "p2=0.5*10**5## pressure on crank end side in N/m**2\n", + "teeta=40.## angle of inclination of crank in degrees\n", + "m=45.## mass of flywheel in kg\n", + "k=.65## radius of gyration in m\n", + "##==============================\n", + "Fl=(pi/4.*D**2.*p1)-(pi/4.*(D**2.-d**2.)*p2)## load on the piston in N\n", + "ph=(math.sin(teeta/57.3)/n)\n", + "phi=math.asin(ph)*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", + "r=1.6*D/2.\n", + "T=Fl*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", + "Fb=Fl*math.cos((teeta+phi)/57.3)/math.cos(phi/57.3)## thrust on the crank shaft bearing in N\n", + "TR=P*60./(2.*pi*N)## steady resisting torque in N-m\n", + "Ts=T-TR## surplus torque available in N-m\n", + "a=Ts/(m*k**2)## acceleration of the flywheel in rad/s**2\n", + "print'%s %.1f %s %.1f %s %.1f %s '%('Torque exerted on the crank shaft= ',T,' N-m'' Thrust on the crank shaft bearing= ',Fb,'N''Acceleration of the flywheel= ',a,' rad/s**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Torque exerted on the crank shaft= 4233.8 N-m Thrust on the crank shaft bearing= 16321.0 NAcceleration of the flywheel= 122.2 rad/s**2 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 7 PAGE NO 166\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "import math\n", + "pi=3.141\n", + "D=.25## diameter of vertical cylinder of steam engine in m\n", + "L=.45## stroke length in m\n", + "r=L/2.\n", + "n=4.\n", + "N=360.## speed of the engine in rpm\n", + "teeta=45.## angle of inclination of crank in degrees\n", + "p=1050000.## net pressure in N/m**2\n", + "mR=180.## mass of reciprocating parts in kg\n", + "g=9.81## acceleration due to gravity\n", + "##========================\n", + "Fl=p*pi*D**2./4.## force on piston due to steam pressure in N\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n))## inertia force due to reciprocating parts in N\n", + "Fp=Fl-Fi+mR*g## piston effort in N\n", + "phi=math.asin((math.sin(teeta/57.3)/n))*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", + "T=Fp*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", + "print'%s %.1f %s'%('Effective turning moment on the crank shaft= ',T,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Effective turning moment on the crank shaft= 2366.2 N-m\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 8 PAGE NO 166\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "##figure 5.4\n", + "import math\n", + "pi=3.141\n", + "D=.25## diameter of vertical cylinder of diesel engine in m\n", + "L=.40## stroke length in m\n", + "r=L/2.\n", + "n=4.\n", + "N=300.## speed of the engine in rpm\n", + "teeta=60.## angle of inclination of crank in degrees\n", + "mR=200.## mass of reciprocating parts in kg\n", + "g=9.81## acceleration due to gravity\n", + "l=.8## length of connecting rod in m\n", + "c=14.## compression ratio=v1/v2\n", + "p1=.1*10**6.## suction pressure in n/m**2\n", + "i=1.35## index of the law of expansion and compression \n", + "##==============================================================\n", + "Vs=pi/4.*D**2.*L## swept volume in m**3\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "Vc=Vs/(c-1.)\n", + "V3=Vc+Vs/10.## volume at the end of injection of fuel in m**3\n", + "p2=p1*c**i## final pressure in N/m**2\n", + "p3=p2## from figure\n", + "x=r*((1.-math.cos(teeta/57.3)+(math.sin(teeta/57.3))**2/(2.*n)))## the displacement of the piston when the crank makes an angle 60 degrees with T.D.C\n", + "Va=Vc+pi*D**2.*x/4.\n", + "pa=p3*(V3/Va)**i\n", + "p=pa-p1## difference of pressues on 2 sides of piston in N/m**2\n", + "Fl=p*pi*D**2./4.## net load on piston in N\n", + "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos(2.*teeta/57.3)/(n))## inertia force due to reciprocating parts in N\n", + "Fp=Fl-Fi+mR*g## piston effort in N\n", + "phi=math.asin((math.sin(teeta/57.3)/n))*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", + "T=Fp*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", + "print'%s %.1f %s'%('Effective turning moment on the crank shaft= ',T,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Effective turning moment on the crank shaft= 8850.3 N-m\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter5_1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter5_1.ipynb new file mode 100755 index 00000000..74b1843d --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter5_1.ipynb @@ -0,0 +1,413 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:626c3be6e4f7de20f0ed74b1f32975ee0b23b0772fac899ecdc291f6b1439ae8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter5-Inertia Force Analysis in Machines" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg160" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 1 PAGE NO 160\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "import math\n", + "pi=3.141\n", + "r=.3## radius of crank in m\n", + "l=1.## length of connecting rod in m\n", + "N=200.## speed of the engine in rpm\n", + "n=l/r\n", + "##===================\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "\n", + "teeta=math.acos((-n+((n**2)+4*2*1)**.5)/(2*2))*57.3## angle of inclination of crank in degrees\n", + "Vp=w*r*(math.sin(teeta/57.3)+(math.sin((2*teeta)/57.3)/n))## maximum velocity of the piston in m/s\n", + "print'%s %.1f %s'%('Maximum velocity of the piston = ',Vp,' m/s')\n", + "print'%s %.2f %s'%('teeta',teeta,'')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum velocity of the piston = 7.0 m/s\n", + "teeta 74.96 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 2 PAGE NO 161\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "import math\n", + "PI=3.141\n", + "r=.3## length of crank in metres\n", + "l=1.5## length of connecting rod in metres\n", + "N=180.## speed of rotation in rpm\n", + "teeta=40.## angle of inclination of crank in degrees\n", + "##============================\n", + "n=l/r\n", + "w=2.*PI*N/60## angular speed in rad/s\n", + "Vp=w*r*(math.sin(teeta/57.3)+math.sin((2.*teeta/57.3)/(2.*n)))## velocity of piston in m/s\n", + "fp=w**2.*r*(math.cos(teeta/57.3)+math.cos(2.*teeta/57.3)/(2.*n))## acceleration of piston in m/s**2\n", + "costeeta1=(-n+(n**2.+4.*2.*1.)**.5)/4.\n", + "teeta1=math.acos(costeeta1)*(57.3)## position of crank from inner dead centre position for zero acceleration of piston\n", + "##===========================\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('Velocity of Piston = ',Vp,' m/s'' Acceleration of piston =',fp,' m/s**2'' position of crank from inner dead centre position for zero acceleration of piston=',teeta1,' degrees')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity of Piston = 4.4 m/s Acceleration of piston = 83.5 m/s**2 position of crank from inner dead centre position for zero acceleration of piston= 79.3 degrees\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 3 PAGE NO 161\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "import math\n", + "pi=3.141\n", + "D=.3## Diameter of steam engine in m\n", + "L=.5## length of stroke in m\n", + "r=L/2.\n", + "mR=100.## equivalent of mass of reciprocating parts in kg\n", + "N=200.## speed of engine in rpm\n", + "teeta=45## angle of inclination of crank in degrees\n", + "p1=1.*10**6## gas pressure in N/m**2\n", + "p2=35.*10**3## back pressure in N/m**2\n", + "n=4.## ratio of crank radius to the length of stroke\n", + "##=================================\n", + "w=2.*pi*N/60## angular speed in rad/s\n", + "Fl=pi/4.*D**2.*(p1-p2)## Net load on piston in N\n", + "Fi=mR*w**2*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(2*n))## inertia force due to reciprocating parts\n", + "Fp=Fl-Fi## Piston effort\n", + "T=Fp*r*(math.sin(teeta/57.3)+(math.sin((2*teeta)/57.3))/(2.*(n**2-(math.sin(teeta/57.3))**2)**.5))\n", + "print'%s %.1f %s %.1f %s '%('Piston effort = ',Fp,' N' 'Turning moment on the crank shaft = ',T,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Piston effort = 60447.0 NTurning moment on the crank shaft = 12604.2 N-m \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg162" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 4 PAGE NO 162\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "import math\n", + "pi=3.141\n", + "D=.10## Diameter of petrol engine in m\n", + "L=.12## Stroke length in m\n", + "l=.25## length of connecting in m\n", + "r=L/2.\n", + "mR=1.2## mass of piston in kg\n", + "N=1800.## speed in rpm\n", + "teeta=25.## angle of inclination of crank in degrees\n", + "p=680.*10**3## gas pressure in N/m**2\n", + "n=l/r\n", + "g=9.81## acceleration due to gravity\n", + "##=======================================\n", + "w=2.*pi*N/60.## angular speed in rpm\n", + "Fl=pi/4.*D**2.*p## force due to gas pressure in N\n", + "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n))## inertia force due to reciprocating parts in N\n", + "Fp=Fl-Fi+mR*g## net force on piston in N\n", + "Fq=n*Fp/((n**2-(math.sin(teeta/57.3))**2.)**.5)## resultant load on gudgeon pin in N\n", + "Fn=Fp*math.sin(teeta/57.3)/((n**2-(math.sin(teeta/57.3))**2.)**.5)## thrust on cylinder walls in N\n", + "fi=Fl+mR*g## inertia force of the reciprocating parts before the gudgeon pin load is reversed in N\n", + "w1=(fi/mR/r/(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n)))**.5\n", + "N1=60.*w1/(2.*pi)\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Net force on piston = ',Fp,' N'' Resultant load on gudgeon pin = ',Fq,' N'' Thrust on cylinder walls = ',Fn,' N'' speed at which other things remining same,the gudgeon pin load would be reversed in directionm= ',N1,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net force on piston = 2639.3 N Resultant load on gudgeon pin = 2652.9 N Thrust on cylinder walls = 269.1 N speed at which other things remining same,the gudgeon pin load would be reversed in directionm= 2528.4 rpm \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 5 PAGE NO 163\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "##Figure 5.3\n", + "import math\n", + "pi=3.141\n", + "N=1800.## speed of the petrol engine in rpm\n", + "r=.06## radius of crank in m\n", + "l=.240## length of connecting rod in m\n", + "D=.1## diameter of the piston in m\n", + "mR=1## mass of piston in kg\n", + "p=.8*10**6## gas pressure in N/m**2\n", + "x=.012## distance moved by piston in m\n", + "##===============================================\n", + "w=2.*pi*N/60.## angular velocity of the engine in rad/s\n", + "n=l/r\n", + "Fl=pi/4.*D**2.*p## load on the piston in N\n", + "teeta=32.## by mearument from the figure 5.3\n", + "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/n)## inertia force due to reciprocating parts in N\n", + "Fp=Fl-Fi## net load on the gudgeon pin in N\n", + "Fq=n*Fp/((n**2.-(math.sin(teeta/57.3))**2.)**.5)## thrust in the connecting rod in N\n", + "Fn=Fp*math.sin(teeta/57.3)/((n**2-(math.sin(teeta/57.3))**2)**.5)## reaction between the piston and cylinder in N\n", + "w1=(Fl/mR/r/(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n)))**.5\n", + "N1=60.*w1/(2.*pi)## \n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s'%('Net load on the gudgeon pin= ',Fp,' N''Thrust in the connecting rod= ',Fq,' N'' Reaction between the cylinder and piston= ',Fn,' N'' The engine speed at which the above values become zero= ',N1,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net load on the gudgeon pin= 4241.2 NThrust in the connecting rod= 4278.9 N Reaction between the cylinder and piston= 566.8 N The engine speed at which the above values become zero= 3158.0 rpm\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg165" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 6 PAGE NO 165\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "import math\n", + "pi=3.141\n", + "D=.25## diameter of horizontal steam engine in m\n", + "N=180.## speed of the engine in rpm\n", + "d=.05## diameter of piston in m\n", + "P=36000.## power of the engine in watts\n", + "n=3.## ration of length of connecting rod to the crank radius\n", + "p1=5.8*10**5## pressure on cover end side in N/m**2\n", + "p2=0.5*10**5## pressure on crank end side in N/m**2\n", + "teeta=40.## angle of inclination of crank in degrees\n", + "m=45.## mass of flywheel in kg\n", + "k=.65## radius of gyration in m\n", + "##==============================\n", + "Fl=(pi/4.*D**2.*p1)-(pi/4.*(D**2.-d**2.)*p2)## load on the piston in N\n", + "ph=(math.sin(teeta/57.3)/n)\n", + "phi=math.asin(ph)*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", + "r=1.6*D/2.\n", + "T=Fl*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", + "Fb=Fl*math.cos((teeta+phi)/57.3)/math.cos(phi/57.3)## thrust on the crank shaft bearing in N\n", + "TR=P*60./(2.*pi*N)## steady resisting torque in N-m\n", + "Ts=T-TR## surplus torque available in N-m\n", + "a=Ts/(m*k**2)## acceleration of the flywheel in rad/s**2\n", + "print'%s %.1f %s %.1f %s %.1f %s '%('Torque exerted on the crank shaft= ',T,' N-m'' Thrust on the crank shaft bearing= ',Fb,'N''Acceleration of the flywheel= ',a,' rad/s**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Torque exerted on the crank shaft= 4233.8 N-m Thrust on the crank shaft bearing= 16321.0 NAcceleration of the flywheel= 122.2 rad/s**2 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 7 PAGE NO 166\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "import math\n", + "pi=3.141\n", + "D=.25## diameter of vertical cylinder of steam engine in m\n", + "L=.45## stroke length in m\n", + "r=L/2.\n", + "n=4.\n", + "N=360.## speed of the engine in rpm\n", + "teeta=45.## angle of inclination of crank in degrees\n", + "p=1050000.## net pressure in N/m**2\n", + "mR=180.## mass of reciprocating parts in kg\n", + "g=9.81## acceleration due to gravity\n", + "##========================\n", + "Fl=p*pi*D**2./4.## force on piston due to steam pressure in N\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n))## inertia force due to reciprocating parts in N\n", + "Fp=Fl-Fi+mR*g## piston effort in N\n", + "phi=math.asin((math.sin(teeta/57.3)/n))*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", + "T=Fp*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", + "print'%s %.1f %s'%('Effective turning moment on the crank shaft= ',T,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Effective turning moment on the crank shaft= 2366.2 N-m\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 5 ILLUSRTATION 8 PAGE NO 166\n", + "##TITLE:Inertia Force Analysis in Machines\n", + "##figure 5.4\n", + "import math\n", + "pi=3.141\n", + "D=.25## diameter of vertical cylinder of diesel engine in m\n", + "L=.40## stroke length in m\n", + "r=L/2.\n", + "n=4.\n", + "N=300.## speed of the engine in rpm\n", + "teeta=60.## angle of inclination of crank in degrees\n", + "mR=200.## mass of reciprocating parts in kg\n", + "g=9.81## acceleration due to gravity\n", + "l=.8## length of connecting rod in m\n", + "c=14.## compression ratio=v1/v2\n", + "p1=.1*10**6.## suction pressure in n/m**2\n", + "i=1.35## index of the law of expansion and compression \n", + "##==============================================================\n", + "Vs=pi/4.*D**2.*L## swept volume in m**3\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "Vc=Vs/(c-1.)\n", + "V3=Vc+Vs/10.## volume at the end of injection of fuel in m**3\n", + "p2=p1*c**i## final pressure in N/m**2\n", + "p3=p2## from figure\n", + "x=r*((1.-math.cos(teeta/57.3)+(math.sin(teeta/57.3))**2/(2.*n)))## the displacement of the piston when the crank makes an angle 60 degrees with T.D.C\n", + "Va=Vc+pi*D**2.*x/4.\n", + "pa=p3*(V3/Va)**i\n", + "p=pa-p1## difference of pressues on 2 sides of piston in N/m**2\n", + "Fl=p*pi*D**2./4.## net load on piston in N\n", + "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos(2.*teeta/57.3)/(n))## inertia force due to reciprocating parts in N\n", + "Fp=Fl-Fi+mR*g## piston effort in N\n", + "phi=math.asin((math.sin(teeta/57.3)/n))*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", + "T=Fp*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", + "print'%s %.1f %s'%('Effective turning moment on the crank shaft= ',T,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Effective turning moment on the crank shaft= 8850.3 N-m\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter6.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter6.ipynb new file mode 100755 index 00000000..895e2c68 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter6.ipynb @@ -0,0 +1,486 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a0a25762305b1c74ca417d46a7390eaac10578c3f22cb04bddc542c61d85667c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter6-Turning Moment Diagram and Flywheel" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 1 PAGE NO 175\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "\n", + "k=1.## radius of gyration of flywheel in m\n", + "m=2000.## mass of the flywheel in kg\n", + "T=1000.## torque of the engine in Nm\n", + "w1=0.## speedin the begining\n", + "t=10.## time duration\n", + "##==============================\n", + "I=m*k**2.## mass moment of inertia in kg-m**2\n", + "a=T/I## angular acceleration of flywheel in rad/s**2\n", + "w2=w1+a*t## angular speed after time t in rad/s\n", + "K=I*w2**2/2.## kinetic energy of flywheel in Nm\n", + "##==============================\n", + "print'%s %.1f %s %.1f %s '%('Angular acceleration of the flywheel=',a,' rad/s**2'' Kinetic energy of flywheel= ',K,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Angular acceleration of the flywheel= 0.5 rad/s**2 Kinetic energy of flywheel= 25000.0 N-m \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 2 PAGE NO 176\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "import math\n", + "pi=3.141\n", + "N1=225.## maximum speed of flywheel in rpm\n", + "k=.5## radius of gyration of flywheel in m\n", + "n=720.## no of holes punched per hour\n", + "E1=15000.## energy required by flywheel in Nm\n", + "N2=200.## mimimum speedof flywheel in rpm\n", + "t=2.## time taking for punching a hole\n", + "##==========================\n", + "P=E1*n/3600.## power required by motor per sec in watts\n", + "E2=P*t## energy supplied by motor to punch a hole in N-m\n", + "E=E1-E2## maximum fluctuation of energy in N-m\n", + "N=(N1+N2)/2.## mean speed of the flywheel in rpm\n", + "m=E/(pi**2./900.*k**2.*N*(N1-N2))\n", + "print'%s %.1f %s %.1f %s'%('Power of the motor= ',P,' watts''Mass of the flywheel required= ',m,' kg')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power of the motor= 3000.0 wattsMass of the flywheel required= 618.2 kg\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 3 PAGE NO 176\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "import math\n", + "pi=3.141\n", + "d=38.## diameter of hole in cm\n", + "t=32.## thickness of hole in cm\n", + "e1=7.## energy required to punch one square mm\n", + "V=25.## mean speed of the flywheel in m/s\n", + "S=100.## stroke of the punch in cm\n", + "T=10.## time required to punch a hole in s\n", + "Cs=.03## coefficient of fluctuation of speed\n", + "##===================\n", + "A=pi*d*t## sheared area in mm**2\n", + "E1=e1*A## energy required to punch entire area in Nm\n", + "P=E1/T## power of motor required in watts\n", + "T1=T/(2.*S)*t## time required to punch a hole in 32 mm thick plate\n", + "E2=P*T1## energy supplied by motor in T1 seconds\n", + "E=E1-E2## maximum fluctuation of energy in Nm\n", + "m=E/(V**2.*Cs)## mass of the flywheel required\n", + "print'%s %.1f %s'%('Mass of the flywheel required= ',m,' kg')\n", + "\n", + "\t\t" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of the flywheel required= 1197.8 kg\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 4 PAGE NO 177\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "##figure 6.4\n", + "import math\n", + "##===================\n", + "pi=3.141\n", + "N=480.## speed of the engine in rpm\n", + "k=.6## radius of gyration in m\n", + "Cs=.03## coefficient of fluctuaion of speed \n", + "Ts=6000.## turning moment scale in Nm per one cm\n", + "C=30.## crank angle scale in degrees per cm\n", + "a=[0.5,-1.22,.9,-1.38,.83,-.7,1.07]## areas between the output torque and mean resistance line in sq.cm\n", + "##======================\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "A=Ts*C*pi/180.## 1 cm**2 of turning moment diagram in Nm\n", + "E1=a[0]## max energy at B refer figure\n", + "E2=a[0]+a[1]+a[2]+a[3]\n", + "E=(E1-E2)*A## fluctuation of energy in Nm\n", + "m=E/(k**2.*w**2*Cs)## mass of the flywheel in kg\n", + "print'%s %.1f %s'%('Mass of the flywheel= ',m,' kg')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of the flywheel= 195.8 kg\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg178" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 5 PAGE NO 178\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "##==============\n", + "pi=3.141\n", + "P=500.*10**3.## power of the motor in N\n", + "k=.6## radius of gyration in m\n", + "Cs=.03## coefficient of fluctuation of spped \n", + "OA=750.## REFER FIGURE\n", + "OF=6.*pi## REFER FIGURE\n", + "AG=pi## REFER FIGURE\n", + "BG=3000.-750.## REFER FIGURE\n", + "GH=2.*pi## REFER FIGURE\n", + "CH=3000.-750.## REFER FIGURE\n", + "HD=pi## REFER FIGURE\n", + "LM=2.*pi## REFER FIGURE\n", + "T=OA*OF+1./2.*AG*BG+BG*GH+1./2.*CH*HD## Torque required for one complete cycle in Nm\n", + "Tmean=T/(6.*pi)## mean torque in Nm\n", + "w=P/Tmean## angular velocity required in rad/s\n", + "BL=3000.-1875.## refer figure\n", + "KL=BL*AG/BG## From similar trangles\n", + "CM=3000.-1875.## refer figure\n", + "MN=CM*HD/CH##from similar triangles\n", + "E=1./2.*KL*BL+BL*LM+1./2.*CM*MN## Maximum fluctuaion of energy in Nm\n", + "m=E*100./(k**2*w**2.*Cs)## mass of flywheel in kg\n", + "print'%s %.1f %s'%('Mass of the flywheel= ',m,' kg')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of the flywheel= 1150.3 kg\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg179" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 6 PAGE NO 179\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "import math\n", + "pi=3.141\n", + "PI=180.##in degrees\n", + "theta1=0.\n", + "theta2=PI\n", + "m=400.## mass of the flywheel in kg\n", + "N=250.## speed in rpm\n", + "k=.4## radius of gyration in m\n", + "n=2.*250./60000.## no of working strokes per minute\n", + "W=1000.*pi-150.*math.cos((2*theta2)/57.3)-250.*math.sin((2*theta2)/57.3)-(1000.*theta1-150.*math.cos((2*theta1)/57.3)-250.*math.sin((2*theta1)/57.3))## workdone per stroke in Nm\n", + "P=W*n## power in KW\n", + "Tmean=W/pi## mean torque in Nm\n", + "twotheta=math.atan((500/300)/57.3)## angle at which T-Tmean becomes zero\n", + "THETA1=twotheta/2.\n", + "THETA2=(180.+twotheta)/2.\n", + "E=-150.*math.cos((2.*THETA2)/57.3)-250.*math.sin((2.*THETA2)/57.3)-(-150*math.cos((2.*THETA1)/57.3)-250.*math.sin((2*THETA1)/57.3))## FLUCTUATION OF ENERGY IN Nm\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "Cs1=E*100./(k**2.*w**2.*m)## fluctuation range\n", + "Cs=Cs1/2.## tatal percentage of fluctuation of speed\n", + "Theta=60.\n", + "T1=300.*math.sin((2*Theta)/57.3)-500.*math.cos((2*Theta)/57.3)## Accelerating torque in Nm(T-Tmean)\n", + "alpha=T1/(m*k**2.)## angular acceleration in rad/s**2\n", + "print'%s %.1f %s %.3f %s %.3f %s '%('Power delivered=',P,' kw''Total percentage of fluctuation speed=',Cs,' ''Angular acceleration=',alpha,'rad/s**2')\n", + "#in book ans is given wrong \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power delivered= 26.2 kwTotal percentage of fluctuation speed= 0.342 Angular acceleration= 7.965 rad/s**2 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg181" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 7 PAGE NO 181\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "\n", + "pi=3.141\n", + "m=200.## mass of the flywheel in kg\n", + "k=.5## radius of gyration in m\n", + "N1=360.## upper limit of speed in rpm\n", + "N2=240.## lower limit of speed in rpm\n", + "##==========\n", + "I=m*k**2.## mass moment of inertia in kg m**2\n", + "w1=2.*pi*N1/60.\n", + "w2=2.*pi*N2/60.\n", + "E=1./2.*I*(w1**2.-w2**2.)## fluctuation of energy in Nm\n", + "Pmin=E/(4.*1000.)## power in kw\n", + "Eex=Pmin*12.*1000.## Energy expended in performing each operation in N-m\n", + "print'%s %.1f %s %.1f %s '%('Mimimum power required= ',Pmin,' kw' ' Energy expended in performing each operation= ',Eex,' N-m')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mimimum power required= 4.9 kw Energy expended in performing each operation= 59195.3 N-m \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 8 PAGE NO 182\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "import math\n", + "pi=3.141\n", + "b=8.## width of the strip in cm\n", + "t=2.## thickness of the strip in cm\n", + "w=1.2*10**3.## work required per square cm cut\n", + "N1=200.## maximum speed of the flywheel in rpm\n", + "k=.80## radius of gyration in m\n", + "N2=(1.-.15)*N1## minimum speed of the flywheel in rpm\n", + "T=3.## time required to punch a hole\n", + "##=======================\n", + "A=b*t## area cut of each stroke in cm**2\n", + "W=w*A## work required to cut a strip in Nm\n", + "w1=2.*pi*N1/60.## speed before cut in rpm\n", + "w2=2.*pi*N2/60.## speed after cut in rpm\n", + "m=2.*W/(k**2.*(w1**2.-w2**2.))## mass of the flywheel required in kg\n", + "a=(w1-w2)/T## angular acceleration in rad/s**2\n", + "Ta=m*k**2.*a## torque required in Nm\n", + "print'%s %.1f %s %.1f %s '%('Mass of the flywheel= ',m,' kg'' Amount of Torque required=',Ta,'Nm')\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of the flywheel= 493.1 kg Amount of Torque required= 330.4 Nm \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 9 PAGE NO 182\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "\n", + "pi=3.141\n", + "P=5.*10**3.## power delivered by motor in watts\n", + "N1=360.## speed of the flywheel in rpm\n", + "I=60.## mass moment of inertia in kg m**2\n", + "E1=7500.## energy required by pressing machine for 1 second in Nm\n", + "##========================\n", + "Ehr=P*60.*60.## energy sipplied per hour in Nm\n", + "n=Ehr/E1\n", + "E=E1-P## total fluctuation of energy in Nm\n", + "w1=2.*pi*N1/60.## angular speed before pressing in rpm \n", + "w2=((2.*pi*N1/60.)**2.-(2.*E/I))**.5## angular speed after pressing in rpm \n", + "N2=w2*60./(2.*pi)\n", + "R=N1-N2## reduction in speed in rpm\n", + "print'%s %.1f %s %.1f %s '%('No of pressings that can be made per hour= ',n,' Reduction in speed after the pressing is over= ',R,' rpm ')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No of pressings that can be made per hour= 2400.0 Reduction in speed after the pressing is over= 10.7 rpm \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg183" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 10 PAGE NO 183\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "import math\n", + "pi=3.141\n", + "Cs=.02## coefficient of fluctuation of speed \n", + "N=200.## speed of the engine in rpm\n", + "\n", + "theta1=math.acos(0/57.3)\n", + "theta2=math.asin((-6000/16000)/57.3)\n", + "theta2=180.-theta2\n", + "##===============================================\n", + "##largest area,representing fluctuation of energy lies between theta1 and theta2\n", + "E=6000.*math.sin(theta2/57.3)-8000./2.*math.cos((2*theta2)/57.3)-(6000.*math.sin((theta1)/57.3)-8000./2.*math.cos((2*theta1)/57.3))## total fluctuation of energy in Nm\n", + "Theta=180## angle with which cycle will be repeated in degrees\n", + "Theta1=0\n", + "Tmean=1/pi*((15000*pi+(-8000*math.cos((2*Theta)/57.3))/2.)-((15000*Theta1+(-8000*math.cos((2*Theta1)/57.3))/2.)))## mean torque of engine in Nm\n", + "P=2*pi*N*Tmean/60000.## power of the engine in kw\n", + "w=2*pi*N/60.## angular speed of the engine in rad/s\n", + "I=E/(w**2.*Cs)## mass moment of inertia of flywheel in kg-m**2\n", + "print'%s %.1f %s %.1f %s '%('Power of the engine= ',P,' kw'' minimum mass moment of inertia of flywheel=',-I,' kg-m**2'' E value calculated in the textbook is wrong. Its value is -15,124. In textbook it is given as -1370.28')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power of the engine= 314.1 kw minimum mass moment of inertia of flywheel= 19.5 kg-m**2 E value calculated in the textbook is wrong. Its value is -15,124. In textbook it is given as -1370.28 \n" + ] + } + ], + "prompt_number": 11 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter6_1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter6_1.ipynb new file mode 100755 index 00000000..a0f3b8e9 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter6_1.ipynb @@ -0,0 +1,486 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:74d0df4cf80d7ace4461100f60c8b8167c72dcd7ef78207080312ad5a8f6982b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter6-Turning Moment Diagram and Flywheel" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 1 PAGE NO 175\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "\n", + "k=1.## radius of gyration of flywheel in m\n", + "m=2000.## mass of the flywheel in kg\n", + "T=1000.## torque of the engine in Nm\n", + "w1=0.## speedin the begining\n", + "t=10.## time duration\n", + "##==============================\n", + "I=m*k**2.## mass moment of inertia in kg-m**2\n", + "a=T/I## angular acceleration of flywheel in rad/s**2\n", + "w2=w1+a*t## angular speed after time t in rad/s\n", + "K=I*w2**2/2.## kinetic energy of flywheel in Nm\n", + "##==============================\n", + "print'%s %.1f %s %.1f %s '%('Angular acceleration of the flywheel=',a,' rad/s**2'' Kinetic energy of flywheel= ',K,' N-m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Angular acceleration of the flywheel= 0.5 rad/s**2 Kinetic energy of flywheel= 25000.0 N-m \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 2 PAGE NO 176\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "import math\n", + "pi=3.141\n", + "N1=225.## maximum speed of flywheel in rpm\n", + "k=.5## radius of gyration of flywheel in m\n", + "n=720.## no of holes punched per hour\n", + "E1=15000.## energy required by flywheel in Nm\n", + "N2=200.## mimimum speedof flywheel in rpm\n", + "t=2.## time taking for punching a hole\n", + "##==========================\n", + "P=E1*n/3600.## power required by motor per sec in watts\n", + "E2=P*t## energy supplied by motor to punch a hole in N-m\n", + "E=E1-E2## maximum fluctuation of energy in N-m\n", + "N=(N1+N2)/2.## mean speed of the flywheel in rpm\n", + "m=E/(pi**2./900.*k**2.*N*(N1-N2))\n", + "print'%s %.1f %s %.1f %s'%('Power of the motor= ',P,' watts''Mass of the flywheel required= ',m,' kg')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power of the motor= 3000.0 wattsMass of the flywheel required= 618.2 kg\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 3 PAGE NO 176\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "import math\n", + "pi=3.141\n", + "d=38.## diameter of hole in cm\n", + "t=32.## thickness of hole in cm\n", + "e1=7.## energy required to punch one square mm\n", + "V=25.## mean speed of the flywheel in m/s\n", + "S=100.## stroke of the punch in cm\n", + "T=10.## time required to punch a hole in s\n", + "Cs=.03## coefficient of fluctuation of speed\n", + "##===================\n", + "A=pi*d*t## sheared area in mm**2\n", + "E1=e1*A## energy required to punch entire area in Nm\n", + "P=E1/T## power of motor required in watts\n", + "T1=T/(2.*S)*t## time required to punch a hole in 32 mm thick plate\n", + "E2=P*T1## energy supplied by motor in T1 seconds\n", + "E=E1-E2## maximum fluctuation of energy in Nm\n", + "m=E/(V**2.*Cs)## mass of the flywheel required\n", + "print'%s %.1f %s'%('Mass of the flywheel required= ',m,' kg')\n", + "\n", + "\t\t" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of the flywheel required= 1197.8 kg\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 4 PAGE NO 177\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "##figure 6.4\n", + "import math\n", + "##===================\n", + "pi=3.141\n", + "N=480.## speed of the engine in rpm\n", + "k=.6## radius of gyration in m\n", + "Cs=.03## coefficient of fluctuaion of speed \n", + "Ts=6000.## turning moment scale in Nm per one cm\n", + "C=30.## crank angle scale in degrees per cm\n", + "a=[0.5,-1.22,.9,-1.38,.83,-.7,1.07]## areas between the output torque and mean resistance line in sq.cm\n", + "##======================\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "A=Ts*C*pi/180.## 1 cm**2 of turning moment diagram in Nm\n", + "E1=a[0]## max energy at B refer figure\n", + "E2=a[0]+a[1]+a[2]+a[3]\n", + "E=(E1-E2)*A## fluctuation of energy in Nm\n", + "m=E/(k**2.*w**2*Cs)## mass of the flywheel in kg\n", + "print'%s %.1f %s'%('Mass of the flywheel= ',m,' kg')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of the flywheel= 195.8 kg\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg178" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 5 PAGE NO 178\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "##==============\n", + "pi=3.141\n", + "P=500.*10**3.## power of the motor in N\n", + "k=.6## radius of gyration in m\n", + "Cs=.03## coefficient of fluctuation of spped \n", + "OA=750.## REFER FIGURE\n", + "OF=6.*pi## REFER FIGURE\n", + "AG=pi## REFER FIGURE\n", + "BG=3000.-750.## REFER FIGURE\n", + "GH=2.*pi## REFER FIGURE\n", + "CH=3000.-750.## REFER FIGURE\n", + "HD=pi## REFER FIGURE\n", + "LM=2.*pi## REFER FIGURE\n", + "T=OA*OF+1./2.*AG*BG+BG*GH+1./2.*CH*HD## Torque required for one complete cycle in Nm\n", + "Tmean=T/(6.*pi)## mean torque in Nm\n", + "w=P/Tmean## angular velocity required in rad/s\n", + "BL=3000.-1875.## refer figure\n", + "KL=BL*AG/BG## From similar trangles\n", + "CM=3000.-1875.## refer figure\n", + "MN=CM*HD/CH##from similar triangles\n", + "E=1./2.*KL*BL+BL*LM+1./2.*CM*MN## Maximum fluctuaion of energy in Nm\n", + "m=E*100./(k**2*w**2.*Cs)## mass of flywheel in kg\n", + "print'%s %.1f %s'%('Mass of the flywheel= ',m,' kg')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of the flywheel= 1150.3 kg\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg179" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 6 PAGE NO 179\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "import math\n", + "pi=3.141\n", + "PI=180.##in degrees\n", + "theta1=0.\n", + "theta2=PI\n", + "m=400.## mass of the flywheel in kg\n", + "N=250.## speed in rpm\n", + "k=.4## radius of gyration in m\n", + "n=2.*250./60000.## no of working strokes per minute\n", + "W=1000.*pi-150.*math.cos((2*theta2)/57.3)-250.*math.sin((2*theta2)/57.3)-(1000.*theta1-150.*math.cos((2*theta1)/57.3)-250.*math.sin((2*theta1)/57.3))## workdone per stroke in Nm\n", + "P=W*n## power in KW\n", + "Tmean=W/pi## mean torque in Nm\n", + "twotheta=math.atan((500/300)/57.3)## angle at which T-Tmean becomes zero\n", + "THETA1=twotheta/2.\n", + "THETA2=(180.+twotheta)/2.\n", + "E=-150.*math.cos((2.*THETA2)/57.3)-250.*math.sin((2.*THETA2)/57.3)-(-150*math.cos((2.*THETA1)/57.3)-250.*math.sin((2*THETA1)/57.3))## FLUCTUATION OF ENERGY IN Nm\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "Cs1=E*100./(k**2.*w**2.*m)## fluctuation range\n", + "Cs=Cs1/2.## tatal percentage of fluctuation of speed\n", + "Theta=60.\n", + "T1=300.*math.sin((2*Theta)/57.3)-500.*math.cos((2*Theta)/57.3)## Accelerating torque in Nm(T-Tmean)\n", + "alpha=T1/(m*k**2.)## angular acceleration in rad/s**2\n", + "print'%s %.1f %s %.3f %s %.3f %s '%('Power delivered=',P,' kw''Total percentage of fluctuation speed=',Cs,' ''Angular acceleration=',alpha,'rad/s**2')\n", + "#in book ans is given wrong \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power delivered= 26.2 kwTotal percentage of fluctuation speed= 0.342 Angular acceleration= 7.965 rad/s**2 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg181" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 7 PAGE NO 181\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "\n", + "pi=3.141\n", + "m=200.## mass of the flywheel in kg\n", + "k=.5## radius of gyration in m\n", + "N1=360.## upper limit of speed in rpm\n", + "N2=240.## lower limit of speed in rpm\n", + "##==========\n", + "I=m*k**2.## mass moment of inertia in kg m**2\n", + "w1=2.*pi*N1/60.\n", + "w2=2.*pi*N2/60.\n", + "E=1./2.*I*(w1**2.-w2**2.)## fluctuation of energy in Nm\n", + "Pmin=E/(4.*1000.)## power in kw\n", + "Eex=Pmin*12.*1000.## Energy expended in performing each operation in N-m\n", + "print'%s %.1f %s %.1f %s '%('Mimimum power required= ',Pmin,' kw' ' Energy expended in performing each operation= ',Eex,' N-m')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mimimum power required= 4.9 kw Energy expended in performing each operation= 59195.3 N-m \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex8-pg182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 8 PAGE NO 182\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "import math\n", + "pi=3.141\n", + "b=8.## width of the strip in cm\n", + "t=2.## thickness of the strip in cm\n", + "w=1.2*10**3.## work required per square cm cut\n", + "N1=200.## maximum speed of the flywheel in rpm\n", + "k=.80## radius of gyration in m\n", + "N2=(1.-.15)*N1## minimum speed of the flywheel in rpm\n", + "T=3.## time required to punch a hole\n", + "##=======================\n", + "A=b*t## area cut of each stroke in cm**2\n", + "W=w*A## work required to cut a strip in Nm\n", + "w1=2.*pi*N1/60.## speed before cut in rpm\n", + "w2=2.*pi*N2/60.## speed after cut in rpm\n", + "m=2.*W/(k**2.*(w1**2.-w2**2.))## mass of the flywheel required in kg\n", + "a=(w1-w2)/T## angular acceleration in rad/s**2\n", + "Ta=m*k**2.*a## torque required in Nm\n", + "print'%s %.1f %s %.1f %s '%('Mass of the flywheel= ',m,' kg'' Amount of Torque required=',Ta,'Nm')\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of the flywheel= 493.1 kg Amount of Torque required= 330.4 Nm \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 9 PAGE NO 182\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "\n", + "pi=3.141\n", + "P=5.*10**3.## power delivered by motor in watts\n", + "N1=360.## speed of the flywheel in rpm\n", + "I=60.## mass moment of inertia in kg m**2\n", + "E1=7500.## energy required by pressing machine for 1 second in Nm\n", + "##========================\n", + "Ehr=P*60.*60.## energy sipplied per hour in Nm\n", + "n=Ehr/E1\n", + "E=E1-P## total fluctuation of energy in Nm\n", + "w1=2.*pi*N1/60.## angular speed before pressing in rpm \n", + "w2=((2.*pi*N1/60.)**2.-(2.*E/I))**.5## angular speed after pressing in rpm \n", + "N2=w2*60./(2.*pi)\n", + "R=N1-N2## reduction in speed in rpm\n", + "print'%s %.1f %s %.1f %s '%('No of pressings that can be made per hour= ',n,' Reduction in speed after the pressing is over= ',R,' rpm ')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No of pressings that can be made per hour= 2400.0 Reduction in speed after the pressing is over= 10.7 rpm \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg183" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 6 ILLUSRTATION 10 PAGE NO 183\n", + "##TITLE:Turning Moment Diagram and Flywheel\n", + "import math\n", + "pi=3.141\n", + "Cs=.02## coefficient of fluctuation of speed \n", + "N=200.## speed of the engine in rpm\n", + "\n", + "theta1=math.acos(0/57.3)\n", + "theta2=math.asin((-6000/16000)/57.3)\n", + "theta2=180.-theta2\n", + "##===============================================\n", + "##largest area,representing fluctuation of energy lies between theta1 and theta2\n", + "E=6000.*math.sin(theta2/57.3)-8000./2.*math.cos((2*theta2)/57.3)-(6000.*math.sin((theta1)/57.3)-8000./2.*math.cos((2*theta1)/57.3))## total fluctuation of energy in Nm\n", + "Theta=180## angle with which cycle will be repeated in degrees\n", + "Theta1=0\n", + "Tmean=1/pi*((15000*pi+(-8000*math.cos((2*Theta)/57.3))/2.)-((15000*Theta1+(-8000*math.cos((2*Theta1)/57.3))/2.)))## mean torque of engine in Nm\n", + "P=2*pi*N*Tmean/60000.## power of the engine in kw\n", + "w=2*pi*N/60.## angular speed of the engine in rad/s\n", + "I=E/(w**2.*Cs)## mass moment of inertia of flywheel in kg-m**2\n", + "print'%s %.1f %s %.1f %s '%('Power of the engine= ',P,' kw'' minimum mass moment of inertia of flywheel=',-I,' kg-m**2'' E value calculated in the textbook is wrong. Its value is -15,124. In textbook it is given as -1370.28')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power of the engine= 314.1 kw minimum mass moment of inertia of flywheel= 19.5 kg-m**2 E value calculated in the textbook is wrong. Its value is -15,124. In textbook it is given as -1370.28 \n" + ] + } + ], + "prompt_number": 11 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter7.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter7.ipynb new file mode 100755 index 00000000..064e91a6 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter7.ipynb @@ -0,0 +1,638 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e7c45b9f9a74c2d06cff538ea39937b4592b2eb0de2281e1b9530b19c7e61df9" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter7-GOVERNORS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg196" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 1 PAGE NO 196\n", + "##TITLE:GOVERNORS\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "L=.4## LENGTH OF UPPER ARM IN m\n", + "THETA=30.## INCLINATION TO THE VERTICAL IN degrees\n", + "K=.02## RISED LENGTH IN m\n", + "##============================================================================================\n", + "h2=L*math.cos(THETA/57.3)## GOVERNOR HEIGHT IN m\n", + "N2=(895./h2)**.5## SPEED AT h2 IN rpm\n", + "h1=h2-K## LENGTH WHEN IT IS RAISED BY 2 cm\n", + "N1=(895./h1)**.5## SPEED AT h1 IN rpm\n", + "n=(N1-N2)/N2*100.## PERCENTAGE CHANGE IN SPEED\n", + "##==========================================================================================\n", + "print'%s %.1f %s'%('PERCENTAGE CHANGE IN SPEED=',n,' PERCENTAGE')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "PERCENTAGE CHANGE IN SPEED= 3.0 PERCENTAGE\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg197" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 2 PAGE NO 197\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.5(A),7.5(B)\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "OA=.3## LENGTH OF UPPER ARM IN m\n", + "m=6.## MASS OF EACH BALL IN Kg\n", + "M=18.## MASS OF SLEEVE IN Kg\n", + "r2=.2## RADIUS OF ROTATION AT BEGINING IN m\n", + "r1=.25## RADIUS OF ROTATION AT MAX SPEED IN m\n", + "##===========================================================================================\n", + "h1=(OA**2.-r1**2.)**.5## HIEGHT OF GOVERNOR AT MAX SPEED IN m\n", + "N1=(895.*(m+M)/(h1*m))**.5## MAX SPEED IN rpm\n", + "h2=(OA**2.-r2**2.)**.5## HEIGHT OF GONERNOR AT BEGINING IN m\n", + "N2=(895.*(m+M)/(h2*m))**.5## MIN SPEED IN rpm\n", + "##===========================================================================================\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('MAX SPEED = ',N1,' rpm'' MIN SPEED = ',N2,' rpm''RANGE OF SPEED = ',N1-N2,' rpm')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "MAX SPEED = 146.9 rpm MIN SPEED = 126.5 rpmRANGE OF SPEED = 20.4 rpm\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg197" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 3 PAGE NO 197\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.6\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "OA=.25## LENGHT OF UPPER ARM IN m\n", + "CD=.03## DISTANCE BETWEEN LEEVE AND LOWER ARM IN m\n", + "m=6.## MASS OF BALL IN Kg\n", + "M=48.## MASS OF SLEEVE IN Kg\n", + "AE=.17## FROM FIGURE 7.6\n", + "AE1=.12## FROM FIGURE 7.6\n", + "r1=.2## RADIUS OF ROTATION AT MAX SPEED IN m\n", + "r2=.15## RADIUS OF ROTATION AT MIN SPEED IN m\n", + "##============================================================================================\n", + "h1=(OA**2-r1**2)**.5## HIEGHT OF GOVERNOR AT MIN SPEED IN m\n", + "TANalpha=r1/h1\n", + "TANbeeta=AE/(OA**2-AE**2)**.5\n", + "k=TANbeeta/TANalpha\n", + "N1=(895.*(m+(M*(1.+k)/2.))/(h1*m))**.5## MIN SPEED IN rpm\n", + "h2=(OA**2-r2**2)**.5## HIEGHT OF GOVERNOR AT MAX SPEED IN m\n", + "CE=(OA**2-AE1**2)**.5\n", + "TANalpha1=r2/h2\n", + "TANbeeta1=(r2-CD)/CE\n", + "k=TANbeeta1/TANalpha1\n", + "N2=(895.*(m+(M*(1.+k)/2.))/(h2*m))**.5## MIN SPEED IN rpm\n", + "##========================================================================================================\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('MAX SPEED = ',N1,' rpm'' MIN SPEED = ',N2,' rpm''RANGE OF SPEED = ',N1-N2,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "MAX SPEED = 215.5 rpm MIN SPEED = 188.2 rpmRANGE OF SPEED = 27.2 rpm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 4 PAGE NO 199\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.7\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "g=9.81## ACCELERATION DUE TO GRAVITY \n", + "OA=.20## LENGHT OF UPPER ARM IN m\n", + "AC=.20## LENGTH OF LOWER ARM IN m\n", + "CD=.025## DISTANCE BETWEEN AXIS AND LOWER ARM IN m\n", + "AB=.1## RADIUS OF ROTATION OF BALLS IN m\n", + "N2=250## SPEED OF THE GOVERNOR IN rpm\n", + "X=.05## SLEEVE LIFT IN m\n", + "m=5.## MASS OF BALL IN Kg\n", + "M=20.## MASS OF SLEEVE IN Kg\n", + "##===========================================================\n", + "h2=(OA**2.-AB**2.)**.5## OB DISTANCE IN m IN FIGURE\n", + "h21=(AC**2.-(AB-CD)**2.)**.5## BD DISTANCE IN m IN FIGURE\n", + "TANbeeta=(AB-CD)/h21## TAN OF ANGLE OF INCLINATION OF THE LINK TO THE VERTICAL\n", + "TANalpha=AB/h2## TAN OF ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", + "k=TANbeeta/TANalpha\n", + "c=X/(2.*(h2*(1.+k)-X))## PERCENTAGE INCREASE IN SPEED \n", + "n=c*N2## INCREASE IN SPEED IN rpm\n", + "N1=N2+n## SPEED AFTER LIFT OF SLEEVE\n", + "E=c*g*((2.*m/(1.+k))+M)## GOVERNOR EFFORT IN N\n", + "P=E*X## GOVERNOR POWER IN N-m\n", + "\n", + "print'%s %.1f %s %.2f %s %.1f %s '%('SPEED OF THE GOVERNOR WHEN SLEEVE IS LIFT BY 5 cm = ',N1,' rpm'' GOVERNOR EFFORT = ',E,' N' 'GOVERNOR POWER = ',P,' N-m')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "SPEED OF THE GOVERNOR WHEN SLEEVE IS LIFT BY 5 cm = 275.6 rpm GOVERNOR EFFORT = 25.95 NGOVERNOR POWER = 1.3 N-m \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 5 PAGE NO 200\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.8\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "g=9.81## ACCELERATION DUE TO GRAVITY \n", + "OA=.30## LENGHT OF UPPER ARM IN m\n", + "AC=.30## LENGTH OF LOWER ARM IN m\n", + "m=10.## MASS OF BALL IN Kg\n", + "M=50.## MASS OF SLEEVE IN Kg\n", + "r=.2## RADIUS OF ROTATION IN m\n", + "CD=.04## DISTANCE BETWEEN AXIS AND LOWER ARM IN m\n", + "F=15.## FRICTIONAL LOAD ACTING IN N\n", + "##============================================================\n", + "h=(OA**2-r**2)**.5## HIEGTH OF THE GOVERNOR IN m\n", + "AE=r-CD## AE VALUE IN m\n", + "CE=(AC**2-AE**2)**.5## BD DISTANCE IN m\n", + "TANalpha=r/h## TAN OF ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", + "TANbeeta=AE/CE## TAN OF ANGLE OF INCLINATION OF THE LINK TO THE VERTICAL\n", + "k=TANbeeta/TANalpha\n", + "N=((895./h)*(m+(M*(1.+k)/2.))/m)**.5## EQULIBRIUM SPEED IN rpm\n", + "N1=((895./h)*((m*g)+(M*g+F)/2.)*(1.+k)/(m*g))**.5## MAX SPEED IN rpm\n", + "N2=((895./h)*((m*g)+(M*g-F)/2.)*(1.+k)/(m*g))**.5## MIN SPEED IN rpm\n", + "R=N1-N2## RANGE OF SPEED\n", + "print'%s %.1f %s %.1f %s '%('EQUILIBRIUM SPEED OF GOVERNOR = ',N,' rpm'' RANGE OF SPEED OF GOVERNOR= ',R,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "EQUILIBRIUM SPEED OF GOVERNOR = 145.1 rpm RANGE OF SPEED OF GOVERNOR= 3.4 rpm \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg202" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 6 PAGE NO 202\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.9\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "g=9.81## ACCELERATION DUE TO GRAVITY \n", + "OA=.30## LENGHT OF UPPER ARM IN m\n", + "AC=.30## LENGTH OF LOWER ARM IN m\n", + "m=5.## MASS OF BALL IN Kg\n", + "M=25.## MASS OF SLEEVE IN Kg\n", + "X=.05## LIFT OF THE SLEEVE\n", + "alpha=30.## ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", + "##==============================================\n", + "h2=OA*math.cos(alpha/57.3)## HEIGHT OF THE GOVERNOR AT LOWEST POSITION OF SLEEVE\n", + "h1=h2-X/2.## HEIGHT OF THE GOVERNOR AT HEIGHT POSITION OF SLEEVE\n", + "F=((h2/h1)*(m*g+M*g)-(m*g+M*g))/(1.+h2/h1)## FRICTION AT SLEEVE IN N\n", + "N1=((m*g+M*g+F)*895./(h1*m*g))**.5## MAX SPEEED OF THE GOVVERNOR IN rpm\n", + "N2=((m*g+M*g-F)*895./(h2*m*g))**.5## MIN SPEEED OF THE GOVVERNOR IN rpm\n", + "R=N1-N2## RANGE OF SPEED IN rpm\n", + "\n", + "print'%s %.1f %s %.1f %s'%('THE VALUE OF FRICTIONAL FORCE= ',F,' F'' RANGE OF SPEED OF THE GOVERNOR = ',R,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE VALUE OF FRICTIONAL FORCE= 14.9 F RANGE OF SPEED OF THE GOVERNOR = 14.9 rpm\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg203" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 7 PAGE NO 203\n", + "##TITLE:GOVERNORS\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "m=3## MASS OF EACH BALL IN Kg\n", + "a=.12## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", + "b=.08## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", + "r2=.12## RADIUS OF ROTATION OF THE BALL FOR LOWEST POSITION IN m\n", + "N2=320.## SPEED OF GOVERNOR AT THE BEGINING IN rpm\n", + "S=20000.## STIFFNESS OF THE SPRING IN N/m\n", + "h=.015## SLEEVE LIFT IN m\n", + "##==================================================\n", + "Fc2=m*(2.*PI*N2/60.)**2*r2## CENTRIFUGAL FORCE ACTING AT MIN SPEED OF ROTATION IN N\n", + "L=2*a*Fc2/b## INITIAL LOAD ON SPRING IN N\n", + "r1=a/b*h+r2## MAX RADIUS OF ROTATION IN m\n", + "Fc1=(S*(r1-r2)*(b/a)**2/2)+Fc2## CENTRIFUGAL FORCE ACTING AT MAX SPEED OF ROTATION IN N\n", + "N1=(Fc1/(m*r1)*(60./2./PI)**2)**.5\n", + "print'%s %.1f %s %.1f %s '%('INITIAL LOAD ON SPRING =',L,' N'' EQUILIBRIUM SPEED CORRESPONDING TO LIFT OF 15 cm =',N1,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "INITIAL LOAD ON SPRING = 1217.0 N EQUILIBRIUM SPEED CORRESPONDING TO LIFT OF 15 cm = 327.9 rpm \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 8 PAGE NO 204\n", + "##TITLE:GOVERNORS\n", + "\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "m=3## MASS OF BALL IN Kg\n", + "r2=.2## INITIAL RADIUS OF ROTATION IN m\n", + "a=.11## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", + "b=.15## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", + "h=.004## SLEEVE LIFT IN m\n", + "N2=240.## INITIAL SPEED IN rpm\n", + "n=7.5## FLUCTUATION OF SPEED IN %\n", + "##===================================\n", + "w2=2.*PI*N2/60.## INITIAL ANGULAR SPEED IN rad/s\n", + "w1=(100.+n)*w2/100.## FINAL ANGULAR SPEED IN rad/s\n", + "F=2.*a/b*m*w2**2.*r2## INITIAL COMPRESSIVE FORCE IN N\n", + "r1=r2+a/b*h## MAX RDIUS OF ROTATION IN m\n", + "S=2.*((m*w1**2.*r1)-(m*w2**2.*r2))/(r1-r2)*(a/b)**2.\n", + "print'%s %.1f %s %.1f %s'%('INITIAL COMPRESSIVE FPRCE = ',F,' N'' STIFFNESS OF THE SPRING = ',S/1000,' N/m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "INITIAL COMPRESSIVE FPRCE = 557.8 N STIFFNESS OF THE SPRING = 24.1 N/m\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 9 PAGE NO 204\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.3(C)\n", + "\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "g=9.81## ACCELERATION DUE TO GRAVITY \n", + "PI=3.147\n", + "r=.14## DISTANCE BETWEEN THE CENTRE OF PIVOT OF BELL CRANK LEVER AND AXIS OF GOVERNOR SPINDLE IN m\n", + "r2=.11## INITIAL RADIUS OF ROTATION IN m\n", + "a=.12## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", + "b=.10## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", + "h=.05## SLEEVE LIFT IN m\n", + "N2=240## INITIAL SPEED IN rpm\n", + "F=30## FRICTIONAL FORCE ACTING IN N\n", + "m=5## MASS OF EACH BALL IN Kg\n", + "##==========================================\n", + "r1=r2+a/b*h## MAX RADIUS OF ROTATION IN m\n", + "N1=41.*N2/39.## MAX SPEED OF ROTATION IN rpm\n", + "N=(N1+N2)/2.## MEAN SPEED IN rpm\n", + "Fc1=m*(2.*PI*N1/60.)**2.*r1## CENTRIFUGAL FORCE ACTING AT MAX SPEED OF ROTATION IN N\n", + "Fc2=m*(2.*PI*N2/60.)**2.*r2## CENTRIFUGAL FORCE ACTING AT MIN SPEED OF ROTATION IN N\n", + "c1=r1-r## FROM FIGURE 7.3(C) IN m\n", + "a1=(a**2.-c1**2.)**.5## FROM FIGURE 7.3(C) IN m\n", + "b1=(b**2.-(h/2.)**2.)**.5## FROM FIGURE 7.3(C) IN m\n", + "c2=r-r2## FROM FIGURE 7.3(C) IN m\n", + "a2=a1## FROM FIGURE 7.3(C) IN m\n", + "b2=b1## FROM FIGURE 7.3(C) IN m\n", + "S1=2.*((Fc1*a1)-(m*g*c1))/b1## SPRING FORCE EXERTED ON THE SLEEVE AT MAXIMUM SPEED IN NEWTONS\n", + "S2=2.*((Fc2*a2)-(m*g*c2))/b2## SPRING FORCE EXERTED ON THE SLEEVE AT MAXIMUM SPEED IN NEWTONS\n", + "S=(S1-S2)/h## STIFFNESS OF THE SPRING IN N/m\n", + "Is=S2/S## INITIAL COMPRESSION OF SPRING IN m\n", + "P=S2+(h/2.*S)## SPRING FORCE OF MID PORTION IN N\n", + "n1=N*((P+F)/P)**.5## SPEED,WHEN THE SLEEVE BEGINS TO MOVE UPWARDS FROM MID POSITION IN rpm\n", + "n2=N*((P-F)/P)**.5## SPEED,WHEN THE SLEEVE BEGINS TO MOVE DOWNWARDS FROM MID POSITION IN rpm\n", + "A=n1-n2## ALTERATION IN SPEED IN rpm\n", + "print'%s %.1f %s %.1f %s '%('INTIAL COMPRESSION OF SPRING= ',Is*100,' cm''ALTERATION IN SPEED = ',A,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "INTIAL COMPRESSION OF SPRING= 6.8 cmALTERATION IN SPEED = 6.7 rpm \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg206" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 10 PAGE NO 206\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.10\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "AE=.25## LENGTH OF UPPER ARM IN m\n", + "CE=.25## LENGTH OF LOWER ARM IN m\n", + "EH=.1## LENGTH OF EXTENDED ARM IN m\n", + "EF=.15## RADIUS OF BALL PATH IN m\n", + "m=5.## MASS OF EACH BALL IN Kg\n", + "M=40.## MASS OF EACH BALL IN Kg\n", + "##===================================================================\n", + "h=(AE**2.-EF**2.)**.5## HEIGHT OF THE GOVERNOR IN m\n", + "EM=h\n", + "HM=EH+EM## FROM FIGURE 7.10\n", + "N=((895./h)*(EM/HM)*((m+M)/m))**.5\n", + "print'%s %.1f %s'%('EQUILIBRIUM SPEED OF GOVERNOR =',N,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "EQUILIBRIUM SPEED OF GOVERNOR = 163.9 rpm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg207" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 11 PAGE NO 207\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.11\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N/mm**2\n", + "AE=.25## LENGTH OF UPPER ARM IN m\n", + "CE=.25## LENGTH OF LOWER ARM IN m\n", + "ER=.175## FROM FIGURE 7.11\n", + "AP=.025## FROM FIGURE 7.11\n", + "FR=AP## FROM FIGURE 7.11\n", + "CQ=FR## FROM FIGURE 7.11\n", + "m=3.2## MASS OF BALL IN Kg\n", + "M=25.## MASS OF SLEEVE IN Kg\n", + "h=.2## VERTICAL HEIGHT OF GOVERNOR IN m\n", + "EM=h## FROM FIGURE 7.11\n", + "AF=h## FROM FIGURE 7.11\n", + "N=160.## SPEED OF THE GOVERNOR IN rpm\n", + "HM=(895.*EM*(m+M)/(h*N**2.*m))\n", + "x=HM-EM## LENGTH OF EXTENDED LINK IN m\n", + "T1=g*(m+M/2.)*AE/AF## TENSION IN UPPER ARM IN N\n", + "print'%s %.3f %s %.1f %s'%('LENGTH OF EXTENDED LINK = ',x,' m''TENSION IN UPPER ARM =',T1,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "LENGTH OF EXTENDED LINK = 0.108 mTENSION IN UPPER ARM = 192.5 N\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 12 PAGE NO 208\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.12,7.13\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "EF=.20## MINIMUM RADIUS OF ROTATION IN m\n", + "AE=.30## LENGTH OF EACH ARM IN m\n", + "A1E1=AE## COMPARING FIRUES 7.12&7.13\n", + "EC=.30## LENGTH OF EACH ARM IN m\n", + "E1C1=EC## LENGTH OF EACH ARM IN m\n", + "ED=.165## FROM FIGURE 7.12 IN m\n", + "MC=ED## FROM FIGURE 7.12\n", + "EH=.10## FROM FIGURE 7.12 IN m\n", + "m=8.## MASS OF BALL IN Kg \n", + "M=60.## MASS OF SLEEVE IN Kg\n", + "DF=.035## SLEEVE DISTANCE FROM AXIS IN m\n", + "E1F1=.25## MAX RADIUS OF ROTATION IN m\n", + "g=9.81\n", + "##=========================================================\n", + "alpha=math.asin((EF/AE))*57.3## ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL IN DEGREES\n", + "beeta=math.asin((ED/EC))*57.3## ANGLE OF INCLINATION OF THE ARM TO THE HORIZONTAL IN DEGREES\n", + "k=math.tan(beeta/57.3)/math.tan(alpha/57.3)\n", + "h=(AE**2.-EF**2.)**.5## HEIGHT OF GOVERNOR IN m\n", + "EM=(EC**2.-MC**2.)**.5## FROM FIGURE 7.12 IN m\n", + "HM=EM+EH\n", + "N2=(895.*EM*(m+(M/2.*(1.+k)))/(h*HM*m))**.5## EQUILIBRIUM SPEED AT MAX RADIUS\n", + "HC=(HM**2.+MC**2.)**.5## FROM FIGURE 7.13 IN m\n", + "H1C1=HC\n", + "gama=math.atan((MC/HM))*57.3\n", + "alpha1=math.asin((E1F1/A1E1))*57.3\n", + "E1D1=E1F1-DF## FROM FIGURE 7.13 IN m\n", + "beeta1=math.asin((E1D1/E1C1))*57.3\n", + "gama1=gama-beeta+beeta1\n", + "r=H1C1*math.sin(gama1/57.3)+DF## RADIUS OF ROTATION IN m\n", + "H1M1=H1C1*math.cos((gama1/57.3))\n", + "I1C1=E1C1*math.cos(beeta1/57.3)*(math.tan(alpha1/57.3)+math.tan(beeta1/57.3))## FROM FIGURE IN m\n", + "M1C1=H1C1*math.sin(gama1/57.3)\n", + "w1=(((m*g*(I1C1-M1C1))+(M*g*I1C1)/2.)/(m*r*H1M1))**.5## ANGULAR SPEED IN rad/s\n", + "N1=w1*60./(2.*PI)## ##SPEED IN m/s\n", + "print'%s %.1f %s %.1f %s '%('MINIMUM SPEED OF ROTATION =',N2,' rpm'' MAXIMUM SPEED OF ROTATION = ',N1,' rpm')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "MINIMUM SPEED OF ROTATION = 146.6 rpm MAXIMUM SPEED OF ROTATION = 156.3 rpm \n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter7_1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter7_1.ipynb new file mode 100755 index 00000000..3e98a290 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter7_1.ipynb @@ -0,0 +1,638 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6c05b21421cee2c4a7e783e9f430bf868f1c93712e67d4962c0153c3f2fdb855" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter7-Governors" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg196" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 1 PAGE NO 196\n", + "##TITLE:GOVERNORS\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "L=.4## LENGTH OF UPPER ARM IN m\n", + "THETA=30.## INCLINATION TO THE VERTICAL IN degrees\n", + "K=.02## RISED LENGTH IN m\n", + "##============================================================================================\n", + "h2=L*math.cos(THETA/57.3)## GOVERNOR HEIGHT IN m\n", + "N2=(895./h2)**.5## SPEED AT h2 IN rpm\n", + "h1=h2-K## LENGTH WHEN IT IS RAISED BY 2 cm\n", + "N1=(895./h1)**.5## SPEED AT h1 IN rpm\n", + "n=(N1-N2)/N2*100.## PERCENTAGE CHANGE IN SPEED\n", + "##==========================================================================================\n", + "print'%s %.1f %s'%('PERCENTAGE CHANGE IN SPEED=',n,' PERCENTAGE')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "PERCENTAGE CHANGE IN SPEED= 3.0 PERCENTAGE\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg197" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 2 PAGE NO 197\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.5(A),7.5(B)\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "OA=.3## LENGTH OF UPPER ARM IN m\n", + "m=6.## MASS OF EACH BALL IN Kg\n", + "M=18.## MASS OF SLEEVE IN Kg\n", + "r2=.2## RADIUS OF ROTATION AT BEGINING IN m\n", + "r1=.25## RADIUS OF ROTATION AT MAX SPEED IN m\n", + "##===========================================================================================\n", + "h1=(OA**2.-r1**2.)**.5## HIEGHT OF GOVERNOR AT MAX SPEED IN m\n", + "N1=(895.*(m+M)/(h1*m))**.5## MAX SPEED IN rpm\n", + "h2=(OA**2.-r2**2.)**.5## HEIGHT OF GONERNOR AT BEGINING IN m\n", + "N2=(895.*(m+M)/(h2*m))**.5## MIN SPEED IN rpm\n", + "##===========================================================================================\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('MAX SPEED = ',N1,' rpm'' MIN SPEED = ',N2,' rpm''RANGE OF SPEED = ',N1-N2,' rpm')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "MAX SPEED = 146.9 rpm MIN SPEED = 126.5 rpmRANGE OF SPEED = 20.4 rpm\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg197" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 3 PAGE NO 197\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.6\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "OA=.25## LENGHT OF UPPER ARM IN m\n", + "CD=.03## DISTANCE BETWEEN LEEVE AND LOWER ARM IN m\n", + "m=6.## MASS OF BALL IN Kg\n", + "M=48.## MASS OF SLEEVE IN Kg\n", + "AE=.17## FROM FIGURE 7.6\n", + "AE1=.12## FROM FIGURE 7.6\n", + "r1=.2## RADIUS OF ROTATION AT MAX SPEED IN m\n", + "r2=.15## RADIUS OF ROTATION AT MIN SPEED IN m\n", + "##============================================================================================\n", + "h1=(OA**2-r1**2)**.5## HIEGHT OF GOVERNOR AT MIN SPEED IN m\n", + "TANalpha=r1/h1\n", + "TANbeeta=AE/(OA**2-AE**2)**.5\n", + "k=TANbeeta/TANalpha\n", + "N1=(895.*(m+(M*(1.+k)/2.))/(h1*m))**.5## MIN SPEED IN rpm\n", + "h2=(OA**2-r2**2)**.5## HIEGHT OF GOVERNOR AT MAX SPEED IN m\n", + "CE=(OA**2-AE1**2)**.5\n", + "TANalpha1=r2/h2\n", + "TANbeeta1=(r2-CD)/CE\n", + "k=TANbeeta1/TANalpha1\n", + "N2=(895.*(m+(M*(1.+k)/2.))/(h2*m))**.5## MIN SPEED IN rpm\n", + "##========================================================================================================\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('MAX SPEED = ',N1,' rpm'' MIN SPEED = ',N2,' rpm''RANGE OF SPEED = ',N1-N2,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "MAX SPEED = 215.5 rpm MIN SPEED = 188.2 rpmRANGE OF SPEED = 27.2 rpm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 4 PAGE NO 199\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.7\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "g=9.81## ACCELERATION DUE TO GRAVITY \n", + "OA=.20## LENGHT OF UPPER ARM IN m\n", + "AC=.20## LENGTH OF LOWER ARM IN m\n", + "CD=.025## DISTANCE BETWEEN AXIS AND LOWER ARM IN m\n", + "AB=.1## RADIUS OF ROTATION OF BALLS IN m\n", + "N2=250## SPEED OF THE GOVERNOR IN rpm\n", + "X=.05## SLEEVE LIFT IN m\n", + "m=5.## MASS OF BALL IN Kg\n", + "M=20.## MASS OF SLEEVE IN Kg\n", + "##===========================================================\n", + "h2=(OA**2.-AB**2.)**.5## OB DISTANCE IN m IN FIGURE\n", + "h21=(AC**2.-(AB-CD)**2.)**.5## BD DISTANCE IN m IN FIGURE\n", + "TANbeeta=(AB-CD)/h21## TAN OF ANGLE OF INCLINATION OF THE LINK TO THE VERTICAL\n", + "TANalpha=AB/h2## TAN OF ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", + "k=TANbeeta/TANalpha\n", + "c=X/(2.*(h2*(1.+k)-X))## PERCENTAGE INCREASE IN SPEED \n", + "n=c*N2## INCREASE IN SPEED IN rpm\n", + "N1=N2+n## SPEED AFTER LIFT OF SLEEVE\n", + "E=c*g*((2.*m/(1.+k))+M)## GOVERNOR EFFORT IN N\n", + "P=E*X## GOVERNOR POWER IN N-m\n", + "\n", + "print'%s %.1f %s %.2f %s %.1f %s '%('SPEED OF THE GOVERNOR WHEN SLEEVE IS LIFT BY 5 cm = ',N1,' rpm'' GOVERNOR EFFORT = ',E,' N' 'GOVERNOR POWER = ',P,' N-m')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "SPEED OF THE GOVERNOR WHEN SLEEVE IS LIFT BY 5 cm = 275.6 rpm GOVERNOR EFFORT = 25.95 NGOVERNOR POWER = 1.3 N-m \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 5 PAGE NO 200\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.8\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "g=9.81## ACCELERATION DUE TO GRAVITY \n", + "OA=.30## LENGHT OF UPPER ARM IN m\n", + "AC=.30## LENGTH OF LOWER ARM IN m\n", + "m=10.## MASS OF BALL IN Kg\n", + "M=50.## MASS OF SLEEVE IN Kg\n", + "r=.2## RADIUS OF ROTATION IN m\n", + "CD=.04## DISTANCE BETWEEN AXIS AND LOWER ARM IN m\n", + "F=15.## FRICTIONAL LOAD ACTING IN N\n", + "##============================================================\n", + "h=(OA**2-r**2)**.5## HIEGTH OF THE GOVERNOR IN m\n", + "AE=r-CD## AE VALUE IN m\n", + "CE=(AC**2-AE**2)**.5## BD DISTANCE IN m\n", + "TANalpha=r/h## TAN OF ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", + "TANbeeta=AE/CE## TAN OF ANGLE OF INCLINATION OF THE LINK TO THE VERTICAL\n", + "k=TANbeeta/TANalpha\n", + "N=((895./h)*(m+(M*(1.+k)/2.))/m)**.5## EQULIBRIUM SPEED IN rpm\n", + "N1=((895./h)*((m*g)+(M*g+F)/2.)*(1.+k)/(m*g))**.5## MAX SPEED IN rpm\n", + "N2=((895./h)*((m*g)+(M*g-F)/2.)*(1.+k)/(m*g))**.5## MIN SPEED IN rpm\n", + "R=N1-N2## RANGE OF SPEED\n", + "print'%s %.1f %s %.1f %s '%('EQUILIBRIUM SPEED OF GOVERNOR = ',N,' rpm'' RANGE OF SPEED OF GOVERNOR= ',R,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "EQUILIBRIUM SPEED OF GOVERNOR = 145.1 rpm RANGE OF SPEED OF GOVERNOR= 3.4 rpm \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg202" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 6 PAGE NO 202\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.9\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "g=9.81## ACCELERATION DUE TO GRAVITY \n", + "OA=.30## LENGHT OF UPPER ARM IN m\n", + "AC=.30## LENGTH OF LOWER ARM IN m\n", + "m=5.## MASS OF BALL IN Kg\n", + "M=25.## MASS OF SLEEVE IN Kg\n", + "X=.05## LIFT OF THE SLEEVE\n", + "alpha=30.## ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", + "##==============================================\n", + "h2=OA*math.cos(alpha/57.3)## HEIGHT OF THE GOVERNOR AT LOWEST POSITION OF SLEEVE\n", + "h1=h2-X/2.## HEIGHT OF THE GOVERNOR AT HEIGHT POSITION OF SLEEVE\n", + "F=((h2/h1)*(m*g+M*g)-(m*g+M*g))/(1.+h2/h1)## FRICTION AT SLEEVE IN N\n", + "N1=((m*g+M*g+F)*895./(h1*m*g))**.5## MAX SPEEED OF THE GOVVERNOR IN rpm\n", + "N2=((m*g+M*g-F)*895./(h2*m*g))**.5## MIN SPEEED OF THE GOVVERNOR IN rpm\n", + "R=N1-N2## RANGE OF SPEED IN rpm\n", + "\n", + "print'%s %.1f %s %.1f %s'%('THE VALUE OF FRICTIONAL FORCE= ',F,' F'' RANGE OF SPEED OF THE GOVERNOR = ',R,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THE VALUE OF FRICTIONAL FORCE= 14.9 F RANGE OF SPEED OF THE GOVERNOR = 14.9 rpm\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg203" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 7 PAGE NO 203\n", + "##TITLE:GOVERNORS\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "m=3## MASS OF EACH BALL IN Kg\n", + "a=.12## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", + "b=.08## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", + "r2=.12## RADIUS OF ROTATION OF THE BALL FOR LOWEST POSITION IN m\n", + "N2=320.## SPEED OF GOVERNOR AT THE BEGINING IN rpm\n", + "S=20000.## STIFFNESS OF THE SPRING IN N/m\n", + "h=.015## SLEEVE LIFT IN m\n", + "##==================================================\n", + "Fc2=m*(2.*PI*N2/60.)**2*r2## CENTRIFUGAL FORCE ACTING AT MIN SPEED OF ROTATION IN N\n", + "L=2*a*Fc2/b## INITIAL LOAD ON SPRING IN N\n", + "r1=a/b*h+r2## MAX RADIUS OF ROTATION IN m\n", + "Fc1=(S*(r1-r2)*(b/a)**2/2)+Fc2## CENTRIFUGAL FORCE ACTING AT MAX SPEED OF ROTATION IN N\n", + "N1=(Fc1/(m*r1)*(60./2./PI)**2)**.5\n", + "print'%s %.1f %s %.1f %s '%('INITIAL LOAD ON SPRING =',L,' N'' EQUILIBRIUM SPEED CORRESPONDING TO LIFT OF 15 cm =',N1,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "INITIAL LOAD ON SPRING = 1217.0 N EQUILIBRIUM SPEED CORRESPONDING TO LIFT OF 15 cm = 327.9 rpm \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 8 PAGE NO 204\n", + "##TITLE:GOVERNORS\n", + "\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "m=3## MASS OF BALL IN Kg\n", + "r2=.2## INITIAL RADIUS OF ROTATION IN m\n", + "a=.11## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", + "b=.15## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", + "h=.004## SLEEVE LIFT IN m\n", + "N2=240.## INITIAL SPEED IN rpm\n", + "n=7.5## FLUCTUATION OF SPEED IN %\n", + "##===================================\n", + "w2=2.*PI*N2/60.## INITIAL ANGULAR SPEED IN rad/s\n", + "w1=(100.+n)*w2/100.## FINAL ANGULAR SPEED IN rad/s\n", + "F=2.*a/b*m*w2**2.*r2## INITIAL COMPRESSIVE FORCE IN N\n", + "r1=r2+a/b*h## MAX RDIUS OF ROTATION IN m\n", + "S=2.*((m*w1**2.*r1)-(m*w2**2.*r2))/(r1-r2)*(a/b)**2.\n", + "print'%s %.1f %s %.1f %s'%('INITIAL COMPRESSIVE FPRCE = ',F,' N'' STIFFNESS OF THE SPRING = ',S/1000,' N/m')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "INITIAL COMPRESSIVE FPRCE = 557.8 N STIFFNESS OF THE SPRING = 24.1 N/m\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex9-pg204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 9 PAGE NO 204\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.3(C)\n", + "\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "g=9.81## ACCELERATION DUE TO GRAVITY \n", + "PI=3.147\n", + "r=.14## DISTANCE BETWEEN THE CENTRE OF PIVOT OF BELL CRANK LEVER AND AXIS OF GOVERNOR SPINDLE IN m\n", + "r2=.11## INITIAL RADIUS OF ROTATION IN m\n", + "a=.12## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", + "b=.10## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", + "h=.05## SLEEVE LIFT IN m\n", + "N2=240## INITIAL SPEED IN rpm\n", + "F=30## FRICTIONAL FORCE ACTING IN N\n", + "m=5## MASS OF EACH BALL IN Kg\n", + "##==========================================\n", + "r1=r2+a/b*h## MAX RADIUS OF ROTATION IN m\n", + "N1=41.*N2/39.## MAX SPEED OF ROTATION IN rpm\n", + "N=(N1+N2)/2.## MEAN SPEED IN rpm\n", + "Fc1=m*(2.*PI*N1/60.)**2.*r1## CENTRIFUGAL FORCE ACTING AT MAX SPEED OF ROTATION IN N\n", + "Fc2=m*(2.*PI*N2/60.)**2.*r2## CENTRIFUGAL FORCE ACTING AT MIN SPEED OF ROTATION IN N\n", + "c1=r1-r## FROM FIGURE 7.3(C) IN m\n", + "a1=(a**2.-c1**2.)**.5## FROM FIGURE 7.3(C) IN m\n", + "b1=(b**2.-(h/2.)**2.)**.5## FROM FIGURE 7.3(C) IN m\n", + "c2=r-r2## FROM FIGURE 7.3(C) IN m\n", + "a2=a1## FROM FIGURE 7.3(C) IN m\n", + "b2=b1## FROM FIGURE 7.3(C) IN m\n", + "S1=2.*((Fc1*a1)-(m*g*c1))/b1## SPRING FORCE EXERTED ON THE SLEEVE AT MAXIMUM SPEED IN NEWTONS\n", + "S2=2.*((Fc2*a2)-(m*g*c2))/b2## SPRING FORCE EXERTED ON THE SLEEVE AT MAXIMUM SPEED IN NEWTONS\n", + "S=(S1-S2)/h## STIFFNESS OF THE SPRING IN N/m\n", + "Is=S2/S## INITIAL COMPRESSION OF SPRING IN m\n", + "P=S2+(h/2.*S)## SPRING FORCE OF MID PORTION IN N\n", + "n1=N*((P+F)/P)**.5## SPEED,WHEN THE SLEEVE BEGINS TO MOVE UPWARDS FROM MID POSITION IN rpm\n", + "n2=N*((P-F)/P)**.5## SPEED,WHEN THE SLEEVE BEGINS TO MOVE DOWNWARDS FROM MID POSITION IN rpm\n", + "A=n1-n2## ALTERATION IN SPEED IN rpm\n", + "print'%s %.1f %s %.1f %s '%('INTIAL COMPRESSION OF SPRING= ',Is*100,' cm''ALTERATION IN SPEED = ',A,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "INTIAL COMPRESSION OF SPRING= 6.8 cmALTERATION IN SPEED = 6.7 rpm \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex10-pg206" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 10 PAGE NO 206\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.10\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "AE=.25## LENGTH OF UPPER ARM IN m\n", + "CE=.25## LENGTH OF LOWER ARM IN m\n", + "EH=.1## LENGTH OF EXTENDED ARM IN m\n", + "EF=.15## RADIUS OF BALL PATH IN m\n", + "m=5.## MASS OF EACH BALL IN Kg\n", + "M=40.## MASS OF EACH BALL IN Kg\n", + "##===================================================================\n", + "h=(AE**2.-EF**2.)**.5## HEIGHT OF THE GOVERNOR IN m\n", + "EM=h\n", + "HM=EH+EM## FROM FIGURE 7.10\n", + "N=((895./h)*(EM/HM)*((m+M)/m))**.5\n", + "print'%s %.1f %s'%('EQUILIBRIUM SPEED OF GOVERNOR =',N,' rpm')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "EQUILIBRIUM SPEED OF GOVERNOR = 163.9 rpm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex11-pg207" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 11 PAGE NO 207\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.11\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "g=9.81## ACCELERATION DUE TO GRAVITY IN N/mm**2\n", + "AE=.25## LENGTH OF UPPER ARM IN m\n", + "CE=.25## LENGTH OF LOWER ARM IN m\n", + "ER=.175## FROM FIGURE 7.11\n", + "AP=.025## FROM FIGURE 7.11\n", + "FR=AP## FROM FIGURE 7.11\n", + "CQ=FR## FROM FIGURE 7.11\n", + "m=3.2## MASS OF BALL IN Kg\n", + "M=25.## MASS OF SLEEVE IN Kg\n", + "h=.2## VERTICAL HEIGHT OF GOVERNOR IN m\n", + "EM=h## FROM FIGURE 7.11\n", + "AF=h## FROM FIGURE 7.11\n", + "N=160.## SPEED OF THE GOVERNOR IN rpm\n", + "HM=(895.*EM*(m+M)/(h*N**2.*m))\n", + "x=HM-EM## LENGTH OF EXTENDED LINK IN m\n", + "T1=g*(m+M/2.)*AE/AF## TENSION IN UPPER ARM IN N\n", + "print'%s %.3f %s %.1f %s'%('LENGTH OF EXTENDED LINK = ',x,' m''TENSION IN UPPER ARM =',T1,' N')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "LENGTH OF EXTENDED LINK = 0.108 mTENSION IN UPPER ARM = 192.5 N\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex12-pg208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 7 ILLUSRTATION 12 PAGE NO 208\n", + "##TITLE:GOVERNORS\n", + "##FIGURE 7.12,7.13\n", + "import math\n", + "##===========================================================================================\n", + "##INPUT DATA\n", + "PI=3.147\n", + "EF=.20## MINIMUM RADIUS OF ROTATION IN m\n", + "AE=.30## LENGTH OF EACH ARM IN m\n", + "A1E1=AE## COMPARING FIRUES 7.12&7.13\n", + "EC=.30## LENGTH OF EACH ARM IN m\n", + "E1C1=EC## LENGTH OF EACH ARM IN m\n", + "ED=.165## FROM FIGURE 7.12 IN m\n", + "MC=ED## FROM FIGURE 7.12\n", + "EH=.10## FROM FIGURE 7.12 IN m\n", + "m=8.## MASS OF BALL IN Kg \n", + "M=60.## MASS OF SLEEVE IN Kg\n", + "DF=.035## SLEEVE DISTANCE FROM AXIS IN m\n", + "E1F1=.25## MAX RADIUS OF ROTATION IN m\n", + "g=9.81\n", + "##=========================================================\n", + "alpha=math.asin((EF/AE))*57.3## ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL IN DEGREES\n", + "beeta=math.asin((ED/EC))*57.3## ANGLE OF INCLINATION OF THE ARM TO THE HORIZONTAL IN DEGREES\n", + "k=math.tan(beeta/57.3)/math.tan(alpha/57.3)\n", + "h=(AE**2.-EF**2.)**.5## HEIGHT OF GOVERNOR IN m\n", + "EM=(EC**2.-MC**2.)**.5## FROM FIGURE 7.12 IN m\n", + "HM=EM+EH\n", + "N2=(895.*EM*(m+(M/2.*(1.+k)))/(h*HM*m))**.5## EQUILIBRIUM SPEED AT MAX RADIUS\n", + "HC=(HM**2.+MC**2.)**.5## FROM FIGURE 7.13 IN m\n", + "H1C1=HC\n", + "gama=math.atan((MC/HM))*57.3\n", + "alpha1=math.asin((E1F1/A1E1))*57.3\n", + "E1D1=E1F1-DF## FROM FIGURE 7.13 IN m\n", + "beeta1=math.asin((E1D1/E1C1))*57.3\n", + "gama1=gama-beeta+beeta1\n", + "r=H1C1*math.sin(gama1/57.3)+DF## RADIUS OF ROTATION IN m\n", + "H1M1=H1C1*math.cos((gama1/57.3))\n", + "I1C1=E1C1*math.cos(beeta1/57.3)*(math.tan(alpha1/57.3)+math.tan(beeta1/57.3))## FROM FIGURE IN m\n", + "M1C1=H1C1*math.sin(gama1/57.3)\n", + "w1=(((m*g*(I1C1-M1C1))+(M*g*I1C1)/2.)/(m*r*H1M1))**.5## ANGULAR SPEED IN rad/s\n", + "N1=w1*60./(2.*PI)## ##SPEED IN m/s\n", + "print'%s %.1f %s %.1f %s '%('MINIMUM SPEED OF ROTATION =',N2,' rpm'' MAXIMUM SPEED OF ROTATION = ',N1,' rpm')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "MINIMUM SPEED OF ROTATION = 146.6 rpm MAXIMUM SPEED OF ROTATION = 156.3 rpm \n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter8.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter8.ipynb new file mode 100755 index 00000000..9bd9a862 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter8.ipynb @@ -0,0 +1,334 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1cb0ae5332b03066df5ce763bd8fad0da93c877f86bbb84639588cca0d91016e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Chapter8-BALANCING OF ROTATING MASSES" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 1 PAGE NO 221\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "pi=3.141\n", + "import math\n", + "mA=12.## mass of A in kg\n", + "mB=10.## mass of B in kg\n", + "mC=18.## mass of C in kg\n", + "mD=15.## mass of D in kg\n", + "rA=40.## radius of A in mm\n", + "rB=50.## radius of B in mm\n", + "rC=60.## radius of C in mm\n", + "rD=30.## radius of D in mm\n", + "theta1=0.## angle between A-A in degrees\n", + "theta2=60.## angle between A-B in degrees\n", + "theta3=130.## angle between A-C in degrees\n", + "theta4=270.## angle between A-D in degrees\n", + "R=100.## radius at which mass to be determined in mm\n", + "##====================================================\n", + "Fh=(mA*rA*math.cos(theta1/57.3)+mB*rB*math.cos(theta2/57.3)+mC*rC*math.cos(theta3/57.3)+mD*rD*math.cos(theta4/57.3))/10.## vertical component value in kg cm\n", + "Fv=(mA*rA*math.sin(theta1/57.3)+mB*rB*math.sin(theta2/57.3)+mC*rC*math.sin(theta3/57.3)+mD*rD*math.sin(theta4/57.3))/10.## horizontal component value in kg cm\n", + "mb=(Fh**2.+Fv**2.)**.5/R*10.## unbalanced mass in kg\n", + "theta=math.atan(Fv/Fh)*57.3## position in degrees \n", + "THETA=180.+theta## angle with mA\n", + "print'%s %.1f %s %.1f %s'%('magnitude of unbalaced mass=',mb,' kg'' angle with mA=',THETA,'degrees')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnitude of unbalaced mass= 8.1 kg angle with mA= 267.5 degrees\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 2 PAGE NO 222\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "pi=3.141\n", + "\n", + "mA=5.## mass of A in kg\n", + "mB=10.## mass of B in kg\n", + "mC=8.## mass of C in kg\n", + "rA=10.## radius of A in cm\n", + "rB=15.## radius of B in cm\n", + "rC=10.## radius of C in cm\n", + "rD=10.## radius of D in cm\n", + "rE=15.## radius of E in cm\n", + "##============================\n", + "mD=182./rD## mass of D in kg by mearument\n", + "mE=80./rE## mass of E in kg by mearument\n", + "print'%s %.1f %s %.1f %s '%('mass of D= ',mD,' kg''mass of E= ',mE,' kg')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass of D= 18.2 kgmass of E= 5.3 kg \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 3 PAGE NO 223\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "pi=3.141\n", + "\n", + "mA=200.## mass of A in kg\n", + "mB=300.## mass of B in kg\n", + "mC=400.## mass of C in kg\n", + "mD=200.## mass of D in kg\n", + "rA=80.## radius of A in mm\n", + "rB=70.## radius of B in mm\n", + "rC=60.## radius of C in mm\n", + "rD=80.## radius of D in mm\n", + "rX=100.## radius of X in mm\n", + "rY=100.## radius of Y in mm\n", + "##=====================\n", + "mY=7.3/.04## mass of Y in kg by mearurement\n", + "mX=35./.1## mass of X in kg by mearurement\n", + "thetaX=146.## in degrees by mesurement\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('mass of X=',mX,' kg'' mass of Y=',mY,' kg''angle with mA=',thetaX,' degrees')\n", + "\t" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass of X= 350.0 kg mass of Y= 182.5 kgangle with mA= 146.0 degrees\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg225" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 4 PAGE NO 225\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "pi=3.141\n", + "\n", + "mB=30## mass of B in kg\n", + "mC=50## mass of C in kg\n", + "mD=40## mass of D in kg\n", + "rA=18## radius of A in cm\n", + "rB=24## radius of B in cm\n", + "rC=12## radius of C in cm\n", + "rD=15## radius of D in cm\n", + "##=============================\n", + "mA=3.6/.18## mass of A by measurement in kg\n", + "theta=124.## angle with mass B in degrees by measurement in degrees\n", + "y=3.6/(.18*20)## position of A from B\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('mass of A=',mA,' kg'' angle with mass B=',theta,' degrees'' position of A from B=',y,' m towards right of plane B')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass of A= 20.0 kg angle with mass B= 124.0 degrees position of A from B= 1.0 m towards right of plane B\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg226" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 5 PAGE NO 226\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "pi=3.141\n", + "\n", + "mB=10.## mass of B in kg\n", + "mC=5.## mass of C in kg\n", + "mD=4.## mass of D in kg\n", + "rA=10.## radius of A in cm\n", + "rB=12.5## radius of B in cm\n", + "rC=20.## radius of C in cm\n", + "rD=15.## radius of D in cm\n", + "##=====================================\n", + "mA=7.## mass of A in kg by mesurement\n", + "BC=118.## angle between B and C in degrees by mesurement\n", + "BA=203.5## angle between B and A in degrees by mesurement\n", + "BD=260.## angle between B and D in degrees by mesurement\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Mass of A=',mA,' kg'' angle between B and C=',BC,' degrees''angle between B and A= ',BA,' degrees'' angle between B and D=',BD,' degrees')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of A= 7.0 kg angle between B and C= 118.0 degreesangle between B and A= 203.5 degrees angle between B and D= 260.0 degrees \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg228" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 6 PAGE NO 228\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "pi=3.141\n", + "\n", + "mB=36.## mass of B in kg\n", + "mC=25.## mass of C in kg\n", + "rA=20.## radius of A in cm\n", + "rB=15.## radius of B in cm\n", + "rC=15.## radius of C in cm\n", + "rD=20.## radius of D in cm\n", + "##==================================\n", + "mA=3.9/.2## mass of A in kg by measurement\n", + "mD=16.5## mass of D in kg by measurement\n", + "theta=252.## angular position of D from B by measurement in degrees\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('Mass of A= ',mA,' kg'' Mass od D= ',mD,' kg'' Angular position of D from B= ',theta,' degrees')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of A= 19.5 kg Mass od D= 16.5 kg Angular position of D from B= 252.0 degrees\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg229" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 7 PAGE NO 229\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "\n", + "\n", + "pi=3.141\n", + "mA=48.## mass of A in kg\n", + "mB=56.## mass of B in kg\n", + "mC=20.## mass of C in kg\n", + "rA=1.5## radius of A in cm\n", + "rB=1.5## radius of B in cm\n", + "rC=1.25## radius of C in cm\n", + "N=300.## speed in rpm\n", + "d=1.8## distance between bearing in cm\n", + "##================================\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "BA=164.## angle between pulleys B&A in degrees by measurement\n", + "BC=129.## angle between pulleys B&C in degrees by measurement\n", + "AC=67.## angle between pulleys A&C in degrees by measurement\n", + "C=.88*w**2.## out of balance couple in N\n", + "L=C/d## load on each bearing in N\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('angle between pulleys B&A=',BA,' degrees'' angle between pulleys B&C= ',BC,' degrees'' angle between pulleys A&C=',AC,' degrees'' out of balance couple= ',C,' N'' load on each bearing=',L,' N')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "angle between pulleys B&A= 164.0 degrees angle between pulleys B&C= 129.0 degrees angle between pulleys A&C= 67.0 degrees out of balance couple= 868.2 N load on each bearing= 482.3 N \n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter8_1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter8_1.ipynb new file mode 100755 index 00000000..00deb110 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter8_1.ipynb @@ -0,0 +1,334 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:58914a8cfd8218ce6daf5fb785d2ca44a311ed0fcf973975091abe67490dee2e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter8-Balancing of Rotating Masses" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 1 PAGE NO 221\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "pi=3.141\n", + "import math\n", + "mA=12.## mass of A in kg\n", + "mB=10.## mass of B in kg\n", + "mC=18.## mass of C in kg\n", + "mD=15.## mass of D in kg\n", + "rA=40.## radius of A in mm\n", + "rB=50.## radius of B in mm\n", + "rC=60.## radius of C in mm\n", + "rD=30.## radius of D in mm\n", + "theta1=0.## angle between A-A in degrees\n", + "theta2=60.## angle between A-B in degrees\n", + "theta3=130.## angle between A-C in degrees\n", + "theta4=270.## angle between A-D in degrees\n", + "R=100.## radius at which mass to be determined in mm\n", + "##====================================================\n", + "Fh=(mA*rA*math.cos(theta1/57.3)+mB*rB*math.cos(theta2/57.3)+mC*rC*math.cos(theta3/57.3)+mD*rD*math.cos(theta4/57.3))/10.## vertical component value in kg cm\n", + "Fv=(mA*rA*math.sin(theta1/57.3)+mB*rB*math.sin(theta2/57.3)+mC*rC*math.sin(theta3/57.3)+mD*rD*math.sin(theta4/57.3))/10.## horizontal component value in kg cm\n", + "mb=(Fh**2.+Fv**2.)**.5/R*10.## unbalanced mass in kg\n", + "theta=math.atan(Fv/Fh)*57.3## position in degrees \n", + "THETA=180.+theta## angle with mA\n", + "print'%s %.1f %s %.1f %s'%('magnitude of unbalaced mass=',mb,' kg'' angle with mA=',THETA,'degrees')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnitude of unbalaced mass= 8.1 kg angle with mA= 267.5 degrees\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 2 PAGE NO 222\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "pi=3.141\n", + "\n", + "mA=5.## mass of A in kg\n", + "mB=10.## mass of B in kg\n", + "mC=8.## mass of C in kg\n", + "rA=10.## radius of A in cm\n", + "rB=15.## radius of B in cm\n", + "rC=10.## radius of C in cm\n", + "rD=10.## radius of D in cm\n", + "rE=15.## radius of E in cm\n", + "##============================\n", + "mD=182./rD## mass of D in kg by mearument\n", + "mE=80./rE## mass of E in kg by mearument\n", + "print'%s %.1f %s %.1f %s '%('mass of D= ',mD,' kg''mass of E= ',mE,' kg')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass of D= 18.2 kgmass of E= 5.3 kg \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 3 PAGE NO 223\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "pi=3.141\n", + "\n", + "mA=200.## mass of A in kg\n", + "mB=300.## mass of B in kg\n", + "mC=400.## mass of C in kg\n", + "mD=200.## mass of D in kg\n", + "rA=80.## radius of A in mm\n", + "rB=70.## radius of B in mm\n", + "rC=60.## radius of C in mm\n", + "rD=80.## radius of D in mm\n", + "rX=100.## radius of X in mm\n", + "rY=100.## radius of Y in mm\n", + "##=====================\n", + "mY=7.3/.04## mass of Y in kg by mearurement\n", + "mX=35./.1## mass of X in kg by mearurement\n", + "thetaX=146.## in degrees by mesurement\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('mass of X=',mX,' kg'' mass of Y=',mY,' kg''angle with mA=',thetaX,' degrees')\n", + "\t" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass of X= 350.0 kg mass of Y= 182.5 kgangle with mA= 146.0 degrees\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg225" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 4 PAGE NO 225\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "pi=3.141\n", + "\n", + "mB=30## mass of B in kg\n", + "mC=50## mass of C in kg\n", + "mD=40## mass of D in kg\n", + "rA=18## radius of A in cm\n", + "rB=24## radius of B in cm\n", + "rC=12## radius of C in cm\n", + "rD=15## radius of D in cm\n", + "##=============================\n", + "mA=3.6/.18## mass of A by measurement in kg\n", + "theta=124.## angle with mass B in degrees by measurement in degrees\n", + "y=3.6/(.18*20)## position of A from B\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('mass of A=',mA,' kg'' angle with mass B=',theta,' degrees'' position of A from B=',y,' m towards right of plane B')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass of A= 20.0 kg angle with mass B= 124.0 degrees position of A from B= 1.0 m towards right of plane B\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg226" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 5 PAGE NO 226\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "pi=3.141\n", + "\n", + "mB=10.## mass of B in kg\n", + "mC=5.## mass of C in kg\n", + "mD=4.## mass of D in kg\n", + "rA=10.## radius of A in cm\n", + "rB=12.5## radius of B in cm\n", + "rC=20.## radius of C in cm\n", + "rD=15.## radius of D in cm\n", + "##=====================================\n", + "mA=7.## mass of A in kg by mesurement\n", + "BC=118.## angle between B and C in degrees by mesurement\n", + "BA=203.5## angle between B and A in degrees by mesurement\n", + "BD=260.## angle between B and D in degrees by mesurement\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Mass of A=',mA,' kg'' angle between B and C=',BC,' degrees''angle between B and A= ',BA,' degrees'' angle between B and D=',BD,' degrees')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of A= 7.0 kg angle between B and C= 118.0 degreesangle between B and A= 203.5 degrees angle between B and D= 260.0 degrees \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg228" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 6 PAGE NO 228\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "pi=3.141\n", + "\n", + "mB=36.## mass of B in kg\n", + "mC=25.## mass of C in kg\n", + "rA=20.## radius of A in cm\n", + "rB=15.## radius of B in cm\n", + "rC=15.## radius of C in cm\n", + "rD=20.## radius of D in cm\n", + "##==================================\n", + "mA=3.9/.2## mass of A in kg by measurement\n", + "mD=16.5## mass of D in kg by measurement\n", + "theta=252.## angular position of D from B by measurement in degrees\n", + "print'%s %.1f %s %.1f %s %.1f %s'%('Mass of A= ',mA,' kg'' Mass od D= ',mD,' kg'' Angular position of D from B= ',theta,' degrees')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of A= 19.5 kg Mass od D= 16.5 kg Angular position of D from B= 252.0 degrees\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex7-pg229" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 8 ILLUSRTATION 7 PAGE NO 229\n", + "##TITLE:BALANCING OF ROTATING MASSES\n", + "\n", + "\n", + "pi=3.141\n", + "mA=48.## mass of A in kg\n", + "mB=56.## mass of B in kg\n", + "mC=20.## mass of C in kg\n", + "rA=1.5## radius of A in cm\n", + "rB=1.5## radius of B in cm\n", + "rC=1.25## radius of C in cm\n", + "N=300.## speed in rpm\n", + "d=1.8## distance between bearing in cm\n", + "##================================\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "BA=164.## angle between pulleys B&A in degrees by measurement\n", + "BC=129.## angle between pulleys B&C in degrees by measurement\n", + "AC=67.## angle between pulleys A&C in degrees by measurement\n", + "C=.88*w**2.## out of balance couple in N\n", + "L=C/d## load on each bearing in N\n", + "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('angle between pulleys B&A=',BA,' degrees'' angle between pulleys B&C= ',BC,' degrees'' angle between pulleys A&C=',AC,' degrees'' out of balance couple= ',C,' N'' load on each bearing=',L,' N')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "angle between pulleys B&A= 164.0 degrees angle between pulleys B&C= 129.0 degrees angle between pulleys A&C= 67.0 degrees out of balance couple= 868.2 N load on each bearing= 482.3 N \n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter9.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter9.ipynb new file mode 100755 index 00000000..0fbeb89f --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter9.ipynb @@ -0,0 +1,151 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:dda7459eb606339995d5ed2e2c12f6be43bc2a1b7dc283fd0394011879a85b71" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter9-CAMS AND FOLLOWERS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg247" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 9 ILLUSRTATION 2 PAGE NO 247\n", + "##TITLE:CAMS AND FOLLOWERS\n", + "import math\n", + "pi=3.141\n", + "s=4.## follower movement in cm\n", + "theta=60.## cam rotation in degrees\n", + "THETA=60.*pi/180## cam rotation in rad\n", + "thetaD=45.## after outstroke in degrees\n", + "thetaR=90.##....angle with which it reaches its original position in degrees\n", + "THETAR=90.*pi/180## angle with which it reaches its original position in rad\n", + "THETAd=360.-theta-thetaD-thetaR## angle after return stroke in degrees\n", + "N=300.## speed in rpm\n", + "w=2.*pi*N/60.## speed in rad/s\n", + "Vo=pi*w*s/2./THETA## Maximum velocity of follower during outstroke in cm/s\n", + "Vr=pi*w*s/2./THETAR## Maximum velocity of follower during return stroke in cm/s\n", + "Fo=pi**2.*w**2.*s/2./THETA**2./100.##Maximum acceleration of follower during outstroke in m/s**2 \n", + "Fr=pi**2.*w**2.*s/2./THETAR**2/100.##Maximum acceleration of follower during return stroke in m/s**2\n", + "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum acceleration of follower during outstroke = 177.6 m/s**2Maximum acceleration of follower during return stroke= 78.9 m/s**2 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg249" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 9 ILLUSRTATION 3 PAGE NO 249\n", + "##TITLE:CAMS AND FOLLOWERS\n", + "import math\n", + "pi=3.141\n", + "s=5.## follower movement in cm\n", + "theta=120.## cam rotation in degrees\n", + "THETA=theta*pi/180.## cam rotation in rad\n", + "thetaD=30.## after outstroke in degrees\n", + "thetaR=60.##....angle with which it reaches its original position in degrees\n", + "THETAR=60.*pi/180.## angle with which it reaches its original position in rad\n", + "THETAd=360.-theta-thetaD-thetaR## angle after return stroke in degrees\n", + "N=100.## speed in rpm\n", + "w=2.*pi*N/60.## speed in rad/s\n", + "Vo=pi*w*s/2./THETA## Maximum velocity of follower during outstroke in cm/s\n", + "Vr=pi*w*s/2./THETAR## Maximum velocity of follower during return stroke in cm/s\n", + "Fo=pi**2.*w**2.*s/2./THETA**2./100.##Maximum acceleration of follower during outstroke in m/s**2\n", + "Fr=pi**2*w**2.*s/2./THETAR**2/100.##Maximum acceleration of follower during return stroke in m/s**2\n", + "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum acceleration of follower during outstroke = 6.2 m/s**2Maximum acceleration of follower during return stroke= 24.7 m/s**2 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg252" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 9 ILLUSRTATION 5 PAGE NO 252\n", + "##TITLE:CAMS AND FOLLOWERS\n", + "import math\n", + "pi=3.141\n", + "N=1000.## speed of cam in rpm\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "s=2.5## stroke of the follower in cm\n", + "THETA=120.*pi/180.## ANGULAR DISPLACEMENT OF CAM DURING OUTSTROKE IN RAD\n", + "THETAR=90.*pi/180.##ANGULAR DISPLACEMENT OF CAM DURING DWELL IN RAD\n", + "Vo=2.*w*s/THETA## Maximum velocity of follower during outstroke in cm/s\n", + "Vr=2.*w*s/THETAR##Maximum velocity of follower during return stroke in cm/s\n", + "Fo=4.*w**2.*s/THETA**2.##Maximum acceleration of follower during outstroke in m/s**2\n", + "Fr=4.*w**2.*s/THETAR**2.##Maximum acceleration of follower during return stroke in m/s**2\n", + "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum acceleration of follower during outstroke = 25000.0 m/s**2Maximum acceleration of follower during return stroke= 44444.4 m/s**2 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/Chapter9_1.ipynb b/Theory_Of_Machines_by__B._K._Sarkar/Chapter9_1.ipynb new file mode 100755 index 00000000..69869a97 --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/Chapter9_1.ipynb @@ -0,0 +1,151 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:765c555912cbe4c0c322320d21d6db5068ffa5998304ec2dc51a4fde049316b1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter9-Cams and Followers" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg247" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 9 ILLUSRTATION 2 PAGE NO 247\n", + "##TITLE:CAMS AND FOLLOWERS\n", + "import math\n", + "pi=3.141\n", + "s=4.## follower movement in cm\n", + "theta=60.## cam rotation in degrees\n", + "THETA=60.*pi/180## cam rotation in rad\n", + "thetaD=45.## after outstroke in degrees\n", + "thetaR=90.##....angle with which it reaches its original position in degrees\n", + "THETAR=90.*pi/180## angle with which it reaches its original position in rad\n", + "THETAd=360.-theta-thetaD-thetaR## angle after return stroke in degrees\n", + "N=300.## speed in rpm\n", + "w=2.*pi*N/60.## speed in rad/s\n", + "Vo=pi*w*s/2./THETA## Maximum velocity of follower during outstroke in cm/s\n", + "Vr=pi*w*s/2./THETAR## Maximum velocity of follower during return stroke in cm/s\n", + "Fo=pi**2.*w**2.*s/2./THETA**2./100.##Maximum acceleration of follower during outstroke in m/s**2 \n", + "Fr=pi**2.*w**2.*s/2./THETAR**2/100.##Maximum acceleration of follower during return stroke in m/s**2\n", + "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum acceleration of follower during outstroke = 177.6 m/s**2Maximum acceleration of follower during return stroke= 78.9 m/s**2 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg249" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 9 ILLUSRTATION 3 PAGE NO 249\n", + "##TITLE:CAMS AND FOLLOWERS\n", + "import math\n", + "pi=3.141\n", + "s=5.## follower movement in cm\n", + "theta=120.## cam rotation in degrees\n", + "THETA=theta*pi/180.## cam rotation in rad\n", + "thetaD=30.## after outstroke in degrees\n", + "thetaR=60.##....angle with which it reaches its original position in degrees\n", + "THETAR=60.*pi/180.## angle with which it reaches its original position in rad\n", + "THETAd=360.-theta-thetaD-thetaR## angle after return stroke in degrees\n", + "N=100.## speed in rpm\n", + "w=2.*pi*N/60.## speed in rad/s\n", + "Vo=pi*w*s/2./THETA## Maximum velocity of follower during outstroke in cm/s\n", + "Vr=pi*w*s/2./THETAR## Maximum velocity of follower during return stroke in cm/s\n", + "Fo=pi**2.*w**2.*s/2./THETA**2./100.##Maximum acceleration of follower during outstroke in m/s**2\n", + "Fr=pi**2*w**2.*s/2./THETAR**2/100.##Maximum acceleration of follower during return stroke in m/s**2\n", + "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum acceleration of follower during outstroke = 6.2 m/s**2Maximum acceleration of follower during return stroke= 24.7 m/s**2 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg252" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "##CHAPTER 9 ILLUSRTATION 5 PAGE NO 252\n", + "##TITLE:CAMS AND FOLLOWERS\n", + "import math\n", + "pi=3.141\n", + "N=1000.## speed of cam in rpm\n", + "w=2.*pi*N/60.## angular speed in rad/s\n", + "s=2.5## stroke of the follower in cm\n", + "THETA=120.*pi/180.## ANGULAR DISPLACEMENT OF CAM DURING OUTSTROKE IN RAD\n", + "THETAR=90.*pi/180.##ANGULAR DISPLACEMENT OF CAM DURING DWELL IN RAD\n", + "Vo=2.*w*s/THETA## Maximum velocity of follower during outstroke in cm/s\n", + "Vr=2.*w*s/THETAR##Maximum velocity of follower during return stroke in cm/s\n", + "Fo=4.*w**2.*s/THETA**2.##Maximum acceleration of follower during outstroke in m/s**2\n", + "Fr=4.*w**2.*s/THETAR**2.##Maximum acceleration of follower during return stroke in m/s**2\n", + "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum acceleration of follower during outstroke = 25000.0 m/s**2Maximum acceleration of follower during return stroke= 44444.4 m/s**2 \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/README.txt b/Theory_Of_Machines_by__B._K._Sarkar/README.txt new file mode 100755 index 00000000..00388cce --- /dev/null +++ b/Theory_Of_Machines_by__B._K._Sarkar/README.txt @@ -0,0 +1,10 @@ +Contributed By: jay parmar +Course: btech +College/Institute/Organization: iitbombay +Department/Designation: chemical engineering +Book Title: Theory Of Machines +Author: B. K. Sarkar +Publisher: Tata McGraw Hill +Year of publication: 2002 +Isbn: 0-07-048288-8 +Edition: 1 \ No newline at end of file diff --git a/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1.png b/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1.png new file mode 100755 index 00000000..2acddb54 Binary files /dev/null and b/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1.png differ diff --git a/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1_1.png b/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1_1.png new file mode 100755 index 00000000..2d1ddf8f Binary files /dev/null and b/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1_1.png differ diff --git a/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2.png b/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2.png new file mode 100755 index 00000000..4831c950 Binary files /dev/null and b/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2.png differ diff --git a/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2_1.png b/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2_1.png new file mode 100755 index 00000000..1892548f Binary files /dev/null and b/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2_1.png differ diff --git a/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3.png b/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3.png new file mode 100755 index 00000000..68374c08 Binary files /dev/null and b/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3.png differ diff --git a/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3_1.png b/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3_1.png new file mode 100755 index 00000000..11ce0bbb Binary files /dev/null and b/Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3_1.png differ diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter11.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter11.ipynb deleted file mode 100755 index 2ca36fdf..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter11.ipynb +++ /dev/null @@ -1,150 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:cb0c026235eca0bc18a695dcb9668ea4e2691af702577b5109cf13ded8d1630d" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter11-Architectural Acoustics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg293" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 11.1\n", - "##calculation of total absorption and average absorption coefficient\n", - "\n", - "##given values\n", - "\n", - "V=20*15*5.;##volume of hall in m**3\n", - "t=3.5;##reverberation time of empty hall in sec\n", - "\n", - "\n", - "##calculation\n", - "a1=.161*V/t;##total absorption of empty hall\n", - "k=a1/(2.*(20*15+15*5+20*5.));\n", - "print'%s %.2f %s'%('the average absorption coefficient is',k,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the average absorption coefficient is 0.07 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg293" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 11.2\n", - "##calculation of average absorption coefficient\n", - "\n", - "##given values\n", - "\n", - "V=10*8.*6.;##volume of hall in m**3\n", - "t=1.5;##reverberation time of empty hall in sec\n", - "A=20.;##area of curtain cloth in m**2\n", - "t1=1.;##new reverberation time in sec\n", - "\n", - "##calculation\n", - "a1=.161*V/t;##total absorption of empty hall\n", - "a2=.161*V/t1;##total absorption after a curtain cloth is suspended\n", - "\n", - "k=(a2-a1)/(2.*20.);\n", - "print'%s %.2f %s'%('the average absorption coefficient is',k,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the average absorption coefficient is 0.64 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg293" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 11.3\n", - "##calculation of average absorption coefficient and area\n", - "\n", - "##given values\n", - "\n", - "V=20*15*10.;##volume of hall in m**3\n", - "t=3.5;##reverberation time of empty hall in sec\n", - "t1=2.5;##reduced reverberation time \n", - "k2=.5;##absorption coefficient of curtain cloth\n", - "##calculation\n", - "a1=.161*V/t;##total absorption of empty hall\n", - "k1=a1/(2*(20*15+15*10+20*10));\n", - "print'%s %.2f %s'%('the average absorption coefficient is',k1,'');\n", - "a2=.161*V/t1;##total absorption when wall is covered with curtain\n", - "a=t1*(a2-a1)/(t1*k2);\n", - "print'%s %.2f %s'%('area of wall to be covered with curtain(in m^2)is:',a,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the average absorption coefficient is 0.11 \n", - "area of wall to be covered with curtain(in m^2)is: 110.40 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter11_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter11_1.ipynb deleted file mode 100755 index 2ca36fdf..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter11_1.ipynb +++ /dev/null @@ -1,150 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:cb0c026235eca0bc18a695dcb9668ea4e2691af702577b5109cf13ded8d1630d" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter11-Architectural Acoustics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg293" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 11.1\n", - "##calculation of total absorption and average absorption coefficient\n", - "\n", - "##given values\n", - "\n", - "V=20*15*5.;##volume of hall in m**3\n", - "t=3.5;##reverberation time of empty hall in sec\n", - "\n", - "\n", - "##calculation\n", - "a1=.161*V/t;##total absorption of empty hall\n", - "k=a1/(2.*(20*15+15*5+20*5.));\n", - "print'%s %.2f %s'%('the average absorption coefficient is',k,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the average absorption coefficient is 0.07 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg293" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 11.2\n", - "##calculation of average absorption coefficient\n", - "\n", - "##given values\n", - "\n", - "V=10*8.*6.;##volume of hall in m**3\n", - "t=1.5;##reverberation time of empty hall in sec\n", - "A=20.;##area of curtain cloth in m**2\n", - "t1=1.;##new reverberation time in sec\n", - "\n", - "##calculation\n", - "a1=.161*V/t;##total absorption of empty hall\n", - "a2=.161*V/t1;##total absorption after a curtain cloth is suspended\n", - "\n", - "k=(a2-a1)/(2.*20.);\n", - "print'%s %.2f %s'%('the average absorption coefficient is',k,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the average absorption coefficient is 0.64 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg293" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 11.3\n", - "##calculation of average absorption coefficient and area\n", - "\n", - "##given values\n", - "\n", - "V=20*15*10.;##volume of hall in m**3\n", - "t=3.5;##reverberation time of empty hall in sec\n", - "t1=2.5;##reduced reverberation time \n", - "k2=.5;##absorption coefficient of curtain cloth\n", - "##calculation\n", - "a1=.161*V/t;##total absorption of empty hall\n", - "k1=a1/(2*(20*15+15*10+20*10));\n", - "print'%s %.2f %s'%('the average absorption coefficient is',k1,'');\n", - "a2=.161*V/t1;##total absorption when wall is covered with curtain\n", - "a=t1*(a2-a1)/(t1*k2);\n", - "print'%s %.2f %s'%('area of wall to be covered with curtain(in m^2)is:',a,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the average absorption coefficient is 0.11 \n", - "area of wall to be covered with curtain(in m^2)is: 110.40 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter12.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter12.ipynb deleted file mode 100755 index 7ced75e1..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter12.ipynb +++ /dev/null @@ -1,144 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:4671074782cd36f56500529820b222f929e1453d2be6b38ad8ab85fd8d868d5a" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter12-Ultrasonics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg295" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 12.1\n", - "##calculation of natural frequency,magnetostriction\n", - "\n", - "##given values\n", - "\n", - "l=40*10**-3.;##length of pure iron rod\n", - "d=7.25*10**3.;##density of iron in kg/m**3\n", - "Y=115*10**9.;##Young's modulus in N/m**2 \n", - "\n", - "##calculation\n", - "f=(1*math.sqrt(Y/d))/(2.*l);\n", - "print'%s %.2f %s'%('the natural frequency(in kHz) is',f*10**-3,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the natural frequency(in kHz) is 49.78 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg297" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 12.2\n", - "##calculation of natural frequency\n", - "\n", - "##given values\n", - "\n", - "t=5.5*10**-3.;##thickness in m\n", - "d=2.65*10**3.;##density in kg/m**3\n", - "Y=8*10**10.;##Young's modulus in N/m**2 \n", - "\n", - "\n", - "##calculation\n", - "f=(math.sqrt(Y/d))/(2.*t);##frequency in hertz\n", - "print'%s %.2f %s'%('the natural frequency(in kHz) is',f*10**-3,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the natural frequency(in kHz) is 499.49 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg301" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 12.3\n", - "##calculation of depth and wavelength\n", - "\n", - "##given values\n", - "\n", - "f=.07*10**6;##frequency in Hz\n", - "t=.65;##time taken for pulse to return\n", - "v=1700.;##velocity of sound in sea water in m/s\n", - "\n", - "##calculation\n", - "d=v*t/2.;##\n", - "print'%s %.2f %s'%('the depth of sea(in m) is',d,'');\n", - "l=v/f;##wavelenght of pulse in m\n", - "print'%s %.2f %s'%('wavelength of pulse (in cm)is',l*10**2,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the depth of sea(in m) is 552.50 \n", - "wavelength of pulse (in cm)is 2.43 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter12_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter12_1.ipynb deleted file mode 100755 index 7ced75e1..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter12_1.ipynb +++ /dev/null @@ -1,144 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:4671074782cd36f56500529820b222f929e1453d2be6b38ad8ab85fd8d868d5a" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter12-Ultrasonics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg295" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 12.1\n", - "##calculation of natural frequency,magnetostriction\n", - "\n", - "##given values\n", - "\n", - "l=40*10**-3.;##length of pure iron rod\n", - "d=7.25*10**3.;##density of iron in kg/m**3\n", - "Y=115*10**9.;##Young's modulus in N/m**2 \n", - "\n", - "##calculation\n", - "f=(1*math.sqrt(Y/d))/(2.*l);\n", - "print'%s %.2f %s'%('the natural frequency(in kHz) is',f*10**-3,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the natural frequency(in kHz) is 49.78 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg297" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 12.2\n", - "##calculation of natural frequency\n", - "\n", - "##given values\n", - "\n", - "t=5.5*10**-3.;##thickness in m\n", - "d=2.65*10**3.;##density in kg/m**3\n", - "Y=8*10**10.;##Young's modulus in N/m**2 \n", - "\n", - "\n", - "##calculation\n", - "f=(math.sqrt(Y/d))/(2.*t);##frequency in hertz\n", - "print'%s %.2f %s'%('the natural frequency(in kHz) is',f*10**-3,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the natural frequency(in kHz) is 499.49 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg301" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 12.3\n", - "##calculation of depth and wavelength\n", - "\n", - "##given values\n", - "\n", - "f=.07*10**6;##frequency in Hz\n", - "t=.65;##time taken for pulse to return\n", - "v=1700.;##velocity of sound in sea water in m/s\n", - "\n", - "##calculation\n", - "d=v*t/2.;##\n", - "print'%s %.2f %s'%('the depth of sea(in m) is',d,'');\n", - "l=v/f;##wavelenght of pulse in m\n", - "print'%s %.2f %s'%('wavelength of pulse (in cm)is',l*10**2,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the depth of sea(in m) is 552.50 \n", - "wavelength of pulse (in cm)is 2.43 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter13.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter13.ipynb deleted file mode 100755 index 2e8d2e4e..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter13.ipynb +++ /dev/null @@ -1,410 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:1347b69ffb48f57ed84c93fa692b1b83ef62827af6c7ff1223306a59bfbf283e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter13-Atomic Physics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.1\n", - "##calculation of rate of flow of photons\n", - "\n", - "##given values\n", - "\n", - "l=5893*10**-10;##wavelength of light in m \n", - "P=40.;##power of sodium lamp in W\n", - "d=10;##distance from the source in m\n", - "s=4*math.pi*d**2;##surface area of radius in m**2\n", - "c=3*10**8.;##velocity of light in m/s\n", - "h=6.626*10**-34;##Planck's constant in Js\n", - "##calculation\n", - "E=P*1.;##\n", - "print'%s %.2f %s'%('total energy emitted per second(in Joule)is',E,'');\n", - "n=E*l/(c*h);##total no of photons\n", - "R=n/s;\n", - "print'%s %.2e %s'%('rate of flow of photons per unit area (in /m^2) is',R,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "total energy emitted per second(in Joule)is 40.00 \n", - "rate of flow of photons per unit area (in /m^2) is 9.44e+16 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg315" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.2\n", - "##calculation of threshold wavelength and stopping potential\n", - "\n", - "##given values\n", - "\n", - "l=2000.;##wavelength of light in armstrong \n", - "e=1.6*10**-19.;##charge of electron\n", - "W=4.2;##work function in eV\n", - "c=3*10**8.;##velocity of light in m/s\n", - "h=6.626*10**-34.;##Planck's constant in Js\n", - "##calculation\n", - "x=12400/(W);##h*c=12400 eV\n", - "print'%s %.2f %s'%('threshold wavelength(in Armstrong)is',x,'');\n", - "Vs=(12400/l-W);##\n", - "print'%s %.2f %s'%('stopping potential (in VOLTS) is',Vs,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "threshold wavelength(in Armstrong)is 2952.38 \n", - "stopping potential (in VOLTS) is 2.00 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg326" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.3\n", - "##calculation of momentum of X-ray photon undergoing scattering\n", - "\n", - "##given values\n", - "\n", - "alpha=60*math.pi/180.;##scattering angle in radian\n", - "e=1.6*10**-19;##charge ofelectrone\n", - "W=12273.;##work function in eV\n", - "c=3*10**8;##velocity of light in m/s\n", - "h=6.626*10**-34.;##Planck's constant in Js\n", - "hc=12400.;##in eV\n", - "m=9.1*10**-31##restmass of photon in kg\n", - "##calculation\n", - "x=hc/(W);##wavelength of photon undergoing modofied scattering in armstrong\n", - "y=x-(h/(m*c))*(1-math.cos(alpha));\n", - "p=h/y*10**10.;\n", - "print'%s %.3e %s'%('momentum of photon(in kg-m/s) is',p,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "momentum of photon(in kg-m/s) is 6.558e-24 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg327" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.4\n", - "##calculation of wavelength of scattered radiation and velocity of recoiled electron\n", - "\n", - "##given values\n", - "\n", - "alpha=30*math.pi/180.;##scattering angle in radian\n", - "e=1.6*10**-19.;##charge ofelectron\n", - "x=1.372*10**-10.;##wavelength of incident radiation in m\n", - "c=3*10**8;##velocity of light in m/s\n", - "h=6.626*10**-34;##Planck's constant in Js\n", - "m=9.1*10**-31##rest mass of photon in kg\n", - "hc=12400.;##in eV\n", - "##calculation\n", - "\n", - "y=((x+(h/(m*c))*(1-math.cos(alpha))))*10**10;\n", - "print'%s %.2f %s'%('wavelength of scattered radiation(in armstrong)is',y,'');\n", - "x1=x*10**10;##converting incident wavelength into armstrong\n", - "KE=hc*e*((1/x1)-(1/y));##kinetic energy in Joule\n", - "print'%s %.3e %s'%('kinetic energy in joule is ',KE,'');\n", - "v=math.sqrt(2.*KE/m);\n", - "print'%s %.2f %s'%('velocity of recoiled electron (in m/s^2)is',v,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "wavelength of scattered radiation(in armstrong)is 1.38 \n", - "kinetic energy in joule is 3.419e-18 \n", - "velocity of recoiled electron (in m/s^2)is 2741274.99 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg333" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.5\n", - "##calculation of wavelength of light emitted\n", - "\n", - "##given values\n", - "e=1.6*10**-19;##charge of electrone\n", - "c=3*10**8;##velocity of light\n", - "h=6.626*10**-34;##Planck's constant in Js\n", - "E1=5.36;##energy of first state in eV\n", - "E2=3.45;##energy of second state in eV\n", - "\n", - "\n", - "##1)calculation\n", - "\n", - "l=h*c*10**10/((E1-E2)*e);\n", - "print'%s %.2f %s'%('wavelength of scattered light(in Armstrong)is',l,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "wavelength of scattered light(in Armstrong)is 6504.58 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg361" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.6\n", - "##calculation of de Broglie wavelength \n", - "\n", - "##1)given values\n", - "e=1.6*10**-19.;\n", - "h=6.626*10**-34.;##Planck's constant in Js\n", - "V=182.;##potential difference in volts\n", - "m=9.1*10**-31;##mass of e in kg\n", - "\n", - "\n", - "##1)calculation\n", - "\n", - "l=h/math.sqrt(2.*e*m*V);\n", - "print'%s %.3e %s'%('de Brogliewavelength (in m)is',l,'');\n", - "\n", - "\n", - "##2)given values\n", - "m1=1.;##mass of object in kg\n", - "v=1.;##velocity of object in m/s\n", - "l1=h/(m1*v);\n", - "print'%s %.3e %s'%('debrogie wavelength of object in m) is',l1,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "de Brogliewavelength (in m)is 9.102e-11 \n", - "debrogie wavelength of object in m) is 6.626e-34 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg368" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.7\n", - "##calculation of uncertainty in position\n", - "\n", - "##1)given values\n", - "\n", - "h=6.626*10**-34;##Planck's constant in Js\n", - "v1=220;##velocity of e in m/s\n", - "m=9.1*10**-31;##mass of e in kg\n", - "A=0.065/100.;##accuracy\n", - "\n", - "\n", - "##1)calculation\n", - "v2=v1*A;##uncertainty in speed\n", - "x1=h/(2*math.pi*m*v2);##\n", - "print'%s %.4f %s'%('uncertainty in position of e (in m)is',x1,'');\n", - "\n", - "\n", - "##2)given values\n", - "m1=150/1000.;##mass of object in kg\n", - "x2=h/(2*math.pi*m1*v2);\n", - "print'%s %.3e %s'%('uncertainty in position of baseball(in m) is',x2,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "uncertainty in position of e (in m)is 0.0008 \n", - "uncertainty in position of baseball(in m) is 4.916e-33 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg377" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.8\n", - "##calculation of energy states of an electron and grain of dust and comparing\n", - "\n", - "##1)given values\n", - "L1=10*10**-10;##width of potential well in which e is confined\n", - "L2=.1*10**-3;##width of potential well in which grain of dust is confined\n", - "h=6.626*10**-34;##Planck's constant in Js\n", - "v1=10**6;##velocity of garin of dust in m/s\n", - "m1=9.1*10**-31;##mass of e in kg\n", - "m2=10**-9;##mass of grain in kg\n", - "\n", - "##1)calculation\n", - "\n", - "Ee1=1**2*h**2./(8.*m1*L1**2.);##first energy state of electron\n", - "print'%s %.3e %s'%('first energy state of e is ',Ee1,'');\n", - "Ee2=2**2*h**2/(8*m1*L1**2);##second energy state of electron\n", - "print'%s %.3e %s'%('second energy state of e is ',Ee2,'');\n", - "Ee3=3**2*h**2/(8*m1*L1**2);##third energy state of electron\n", - "print'%s %.3e %s'%('third energy state of e is ',Ee3,'');\n", - "print('Energy levels of an electron in an infinite potential well are quantised and the energy difference between the successive levels is quite large.Electron cannot jump from one level to other on strength of thermal energy.Hence quantization of energy plays a significant role in case of electron')\n", - "\n", - "Eg1=1**2*h**2/(8.*m2*L2**2.);##first energy state of grain of dust\n", - "print'%s %.3e %s'%('first energy state of grain of dust is ',Eg1,'');\n", - "Eg2=2**2*h**2/(8.*m2*L2**2.);##second energy state of grain of dust\n", - "print'%s %.3e %s'%('second energy state of grain of dust is ',Eg2,'');\n", - "Eg3=3**2*h**2/(8.*m2*L2**2.);##third energy state of grain of dust\n", - "print'%s %.3e %s'%('third energy state of grain of dust is ',Eg3,'');\n", - "KE=m2*v1**2/2.;##kinetic energy of grain of dust;\n", - "print'%s %.2f %s'%('kinetic energy of grain of dust is',KE,'');\n", - "print('The energy levels of a grain of dust are so near to each other that they constitute a continuum.These energy levels are far smaller than the kinetic energy possessed by the grain of dust.It can move through all these energy levels without an external supply of energy.Thus quantization of energy levels is not at all significant in case of macroscopic bodies.')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "first energy state of e is 6.031e-20 \n", - "second energy state of e is 2.412e-19 \n", - "third energy state of e is 5.428e-19 \n", - "Energy levels of an electron in an infinite potential well are quantised and the energy difference between the successive levels is quite large.Electron cannot jump from one level to other on strength of thermal energy.Hence quantization of energy plays a significant role in case of electron\n", - "first energy state of grain of dust is 5.488e-51 \n", - "second energy state of grain of dust is 2.195e-50 \n", - "third energy state of grain of dust is 4.939e-50 \n", - "kinetic energy of grain of dust is 500.00 \n", - "The energy levels of a grain of dust are so near to each other that they constitute a continuum.These energy levels are far smaller than the kinetic energy possessed by the grain of dust.It can move through all these energy levels without an external supply of energy.Thus quantization of energy levels is not at all significant in case of macroscopic bodies.\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter13_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter13_1.ipynb deleted file mode 100755 index 2e8d2e4e..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter13_1.ipynb +++ /dev/null @@ -1,410 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:1347b69ffb48f57ed84c93fa692b1b83ef62827af6c7ff1223306a59bfbf283e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter13-Atomic Physics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.1\n", - "##calculation of rate of flow of photons\n", - "\n", - "##given values\n", - "\n", - "l=5893*10**-10;##wavelength of light in m \n", - "P=40.;##power of sodium lamp in W\n", - "d=10;##distance from the source in m\n", - "s=4*math.pi*d**2;##surface area of radius in m**2\n", - "c=3*10**8.;##velocity of light in m/s\n", - "h=6.626*10**-34;##Planck's constant in Js\n", - "##calculation\n", - "E=P*1.;##\n", - "print'%s %.2f %s'%('total energy emitted per second(in Joule)is',E,'');\n", - "n=E*l/(c*h);##total no of photons\n", - "R=n/s;\n", - "print'%s %.2e %s'%('rate of flow of photons per unit area (in /m^2) is',R,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "total energy emitted per second(in Joule)is 40.00 \n", - "rate of flow of photons per unit area (in /m^2) is 9.44e+16 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg315" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.2\n", - "##calculation of threshold wavelength and stopping potential\n", - "\n", - "##given values\n", - "\n", - "l=2000.;##wavelength of light in armstrong \n", - "e=1.6*10**-19.;##charge of electron\n", - "W=4.2;##work function in eV\n", - "c=3*10**8.;##velocity of light in m/s\n", - "h=6.626*10**-34.;##Planck's constant in Js\n", - "##calculation\n", - "x=12400/(W);##h*c=12400 eV\n", - "print'%s %.2f %s'%('threshold wavelength(in Armstrong)is',x,'');\n", - "Vs=(12400/l-W);##\n", - "print'%s %.2f %s'%('stopping potential (in VOLTS) is',Vs,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "threshold wavelength(in Armstrong)is 2952.38 \n", - "stopping potential (in VOLTS) is 2.00 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg326" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.3\n", - "##calculation of momentum of X-ray photon undergoing scattering\n", - "\n", - "##given values\n", - "\n", - "alpha=60*math.pi/180.;##scattering angle in radian\n", - "e=1.6*10**-19;##charge ofelectrone\n", - "W=12273.;##work function in eV\n", - "c=3*10**8;##velocity of light in m/s\n", - "h=6.626*10**-34.;##Planck's constant in Js\n", - "hc=12400.;##in eV\n", - "m=9.1*10**-31##restmass of photon in kg\n", - "##calculation\n", - "x=hc/(W);##wavelength of photon undergoing modofied scattering in armstrong\n", - "y=x-(h/(m*c))*(1-math.cos(alpha));\n", - "p=h/y*10**10.;\n", - "print'%s %.3e %s'%('momentum of photon(in kg-m/s) is',p,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "momentum of photon(in kg-m/s) is 6.558e-24 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg327" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.4\n", - "##calculation of wavelength of scattered radiation and velocity of recoiled electron\n", - "\n", - "##given values\n", - "\n", - "alpha=30*math.pi/180.;##scattering angle in radian\n", - "e=1.6*10**-19.;##charge ofelectron\n", - "x=1.372*10**-10.;##wavelength of incident radiation in m\n", - "c=3*10**8;##velocity of light in m/s\n", - "h=6.626*10**-34;##Planck's constant in Js\n", - "m=9.1*10**-31##rest mass of photon in kg\n", - "hc=12400.;##in eV\n", - "##calculation\n", - "\n", - "y=((x+(h/(m*c))*(1-math.cos(alpha))))*10**10;\n", - "print'%s %.2f %s'%('wavelength of scattered radiation(in armstrong)is',y,'');\n", - "x1=x*10**10;##converting incident wavelength into armstrong\n", - "KE=hc*e*((1/x1)-(1/y));##kinetic energy in Joule\n", - "print'%s %.3e %s'%('kinetic energy in joule is ',KE,'');\n", - "v=math.sqrt(2.*KE/m);\n", - "print'%s %.2f %s'%('velocity of recoiled electron (in m/s^2)is',v,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "wavelength of scattered radiation(in armstrong)is 1.38 \n", - "kinetic energy in joule is 3.419e-18 \n", - "velocity of recoiled electron (in m/s^2)is 2741274.99 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg333" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.5\n", - "##calculation of wavelength of light emitted\n", - "\n", - "##given values\n", - "e=1.6*10**-19;##charge of electrone\n", - "c=3*10**8;##velocity of light\n", - "h=6.626*10**-34;##Planck's constant in Js\n", - "E1=5.36;##energy of first state in eV\n", - "E2=3.45;##energy of second state in eV\n", - "\n", - "\n", - "##1)calculation\n", - "\n", - "l=h*c*10**10/((E1-E2)*e);\n", - "print'%s %.2f %s'%('wavelength of scattered light(in Armstrong)is',l,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "wavelength of scattered light(in Armstrong)is 6504.58 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg361" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.6\n", - "##calculation of de Broglie wavelength \n", - "\n", - "##1)given values\n", - "e=1.6*10**-19.;\n", - "h=6.626*10**-34.;##Planck's constant in Js\n", - "V=182.;##potential difference in volts\n", - "m=9.1*10**-31;##mass of e in kg\n", - "\n", - "\n", - "##1)calculation\n", - "\n", - "l=h/math.sqrt(2.*e*m*V);\n", - "print'%s %.3e %s'%('de Brogliewavelength (in m)is',l,'');\n", - "\n", - "\n", - "##2)given values\n", - "m1=1.;##mass of object in kg\n", - "v=1.;##velocity of object in m/s\n", - "l1=h/(m1*v);\n", - "print'%s %.3e %s'%('debrogie wavelength of object in m) is',l1,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "de Brogliewavelength (in m)is 9.102e-11 \n", - "debrogie wavelength of object in m) is 6.626e-34 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg368" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.7\n", - "##calculation of uncertainty in position\n", - "\n", - "##1)given values\n", - "\n", - "h=6.626*10**-34;##Planck's constant in Js\n", - "v1=220;##velocity of e in m/s\n", - "m=9.1*10**-31;##mass of e in kg\n", - "A=0.065/100.;##accuracy\n", - "\n", - "\n", - "##1)calculation\n", - "v2=v1*A;##uncertainty in speed\n", - "x1=h/(2*math.pi*m*v2);##\n", - "print'%s %.4f %s'%('uncertainty in position of e (in m)is',x1,'');\n", - "\n", - "\n", - "##2)given values\n", - "m1=150/1000.;##mass of object in kg\n", - "x2=h/(2*math.pi*m1*v2);\n", - "print'%s %.3e %s'%('uncertainty in position of baseball(in m) is',x2,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "uncertainty in position of e (in m)is 0.0008 \n", - "uncertainty in position of baseball(in m) is 4.916e-33 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg377" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 13.8\n", - "##calculation of energy states of an electron and grain of dust and comparing\n", - "\n", - "##1)given values\n", - "L1=10*10**-10;##width of potential well in which e is confined\n", - "L2=.1*10**-3;##width of potential well in which grain of dust is confined\n", - "h=6.626*10**-34;##Planck's constant in Js\n", - "v1=10**6;##velocity of garin of dust in m/s\n", - "m1=9.1*10**-31;##mass of e in kg\n", - "m2=10**-9;##mass of grain in kg\n", - "\n", - "##1)calculation\n", - "\n", - "Ee1=1**2*h**2./(8.*m1*L1**2.);##first energy state of electron\n", - "print'%s %.3e %s'%('first energy state of e is ',Ee1,'');\n", - "Ee2=2**2*h**2/(8*m1*L1**2);##second energy state of electron\n", - "print'%s %.3e %s'%('second energy state of e is ',Ee2,'');\n", - "Ee3=3**2*h**2/(8*m1*L1**2);##third energy state of electron\n", - "print'%s %.3e %s'%('third energy state of e is ',Ee3,'');\n", - "print('Energy levels of an electron in an infinite potential well are quantised and the energy difference between the successive levels is quite large.Electron cannot jump from one level to other on strength of thermal energy.Hence quantization of energy plays a significant role in case of electron')\n", - "\n", - "Eg1=1**2*h**2/(8.*m2*L2**2.);##first energy state of grain of dust\n", - "print'%s %.3e %s'%('first energy state of grain of dust is ',Eg1,'');\n", - "Eg2=2**2*h**2/(8.*m2*L2**2.);##second energy state of grain of dust\n", - "print'%s %.3e %s'%('second energy state of grain of dust is ',Eg2,'');\n", - "Eg3=3**2*h**2/(8.*m2*L2**2.);##third energy state of grain of dust\n", - "print'%s %.3e %s'%('third energy state of grain of dust is ',Eg3,'');\n", - "KE=m2*v1**2/2.;##kinetic energy of grain of dust;\n", - "print'%s %.2f %s'%('kinetic energy of grain of dust is',KE,'');\n", - "print('The energy levels of a grain of dust are so near to each other that they constitute a continuum.These energy levels are far smaller than the kinetic energy possessed by the grain of dust.It can move through all these energy levels without an external supply of energy.Thus quantization of energy levels is not at all significant in case of macroscopic bodies.')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "first energy state of e is 6.031e-20 \n", - "second energy state of e is 2.412e-19 \n", - "third energy state of e is 5.428e-19 \n", - "Energy levels of an electron in an infinite potential well are quantised and the energy difference between the successive levels is quite large.Electron cannot jump from one level to other on strength of thermal energy.Hence quantization of energy plays a significant role in case of electron\n", - "first energy state of grain of dust is 5.488e-51 \n", - "second energy state of grain of dust is 2.195e-50 \n", - "third energy state of grain of dust is 4.939e-50 \n", - "kinetic energy of grain of dust is 500.00 \n", - "The energy levels of a grain of dust are so near to each other that they constitute a continuum.These energy levels are far smaller than the kinetic energy possessed by the grain of dust.It can move through all these energy levels without an external supply of energy.Thus quantization of energy levels is not at all significant in case of macroscopic bodies.\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter14.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter14.ipynb deleted file mode 100755 index 1a941a59..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter14.ipynb +++ /dev/null @@ -1,224 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:fa946e3f77a5fb13eb7ad900f4bb8618950afc67e42b0d85db2b38e779043158" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter14-Lasers\n" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 14.1\n", - "##calculation of intensity of laser beam\n", - "\n", - "##given values\n", - "P=10*10**-3.;##Power in Watt\n", - "d=1.3*10**-3.;##diametre in m\n", - "A=math.pi*d**2./4.;##area in m**2\n", - "\n", - "\n", - "##calculation\n", - "I=P/A;\n", - "print'%s %.2f %s'%('intensity (in W/m^2) is',I,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "intensity (in W/m^2) is 7533.96 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 14.2\n", - "##calculation of intensity of laser beam\n", - "\n", - "##given values\n", - "P=1*10**-3.;##Power in Watt\n", - "l=6328*10**-10.;##wavelength in m\n", - "A=l**2.;##area in m**2\n", - "\n", - "\n", - "##calculation\n", - "I=P/A;\n", - "print'%s %.3e %s'%('intensity (in W/m^2) is',I,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "intensity (in W/m^2) is 2.497e+09 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 14.3\n", - "##calculation of coherence length,bandwidth and line width\n", - "\n", - "##given values\n", - "c=3*10**8.;##velocity of light in m/s\n", - "t=.1*10**-9.;##timedivision in s\n", - "l=6238*10**-10.;##wavelength in m\n", - "\n", - "##calculation\n", - "x=c*t;\n", - "print'%s %.2f %s'%('coherence length (in m) is',x,'');\n", - "d=1./t;\n", - "print'%s %.3e %s'%('bandwidth (in Hz) is',d,'');\n", - "y=l**2*d/c;##line width in m\n", - "print'%s %.2f %s'%('line width(in armstrong )is',y*10**10,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "coherence length (in m) is 0.03 \n", - "bandwidth (in Hz) is 1.000e+10 \n", - "line width(in armstrong )is 0.13 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 14.4\n", - "##calculation of frequency difference\n", - "\n", - "##given values\n", - "c=3*10**8;##velocity of light in m/s\n", - "l=.5;##distance in m\n", - "\n", - "##calculation\n", - "f=c/(2*l);##in hertz\n", - "print'%s %.2f %s'%('frequency difference (in MHz) is',f/10**6,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "frequency difference (in MHz) is 300.00 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 14.5\n", - "##calculation of no of cavity modes\n", - "\n", - "##given values\n", - "c=3*10**8.;##velocity of light in m/s\n", - "n=1.75;##refractive index\n", - "l=2*10**-2;##length of ruby rod in m\n", - "x=6943*10**-10.;##wavelength in m\n", - "y=5.3*10**-10.;##spread of wavelength in m\n", - "\n", - "##calculation\n", - "d=c/n/l;\n", - "f=c*y/x**2.;\n", - "m=f/d;\n", - "print'%s %.2f %s'%('no of modes is',m,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "no of modes is 38.48 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter14_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter14_1.ipynb deleted file mode 100755 index 1a941a59..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter14_1.ipynb +++ /dev/null @@ -1,224 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:fa946e3f77a5fb13eb7ad900f4bb8618950afc67e42b0d85db2b38e779043158" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter14-Lasers\n" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 14.1\n", - "##calculation of intensity of laser beam\n", - "\n", - "##given values\n", - "P=10*10**-3.;##Power in Watt\n", - "d=1.3*10**-3.;##diametre in m\n", - "A=math.pi*d**2./4.;##area in m**2\n", - "\n", - "\n", - "##calculation\n", - "I=P/A;\n", - "print'%s %.2f %s'%('intensity (in W/m^2) is',I,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "intensity (in W/m^2) is 7533.96 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 14.2\n", - "##calculation of intensity of laser beam\n", - "\n", - "##given values\n", - "P=1*10**-3.;##Power in Watt\n", - "l=6328*10**-10.;##wavelength in m\n", - "A=l**2.;##area in m**2\n", - "\n", - "\n", - "##calculation\n", - "I=P/A;\n", - "print'%s %.3e %s'%('intensity (in W/m^2) is',I,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "intensity (in W/m^2) is 2.497e+09 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 14.3\n", - "##calculation of coherence length,bandwidth and line width\n", - "\n", - "##given values\n", - "c=3*10**8.;##velocity of light in m/s\n", - "t=.1*10**-9.;##timedivision in s\n", - "l=6238*10**-10.;##wavelength in m\n", - "\n", - "##calculation\n", - "x=c*t;\n", - "print'%s %.2f %s'%('coherence length (in m) is',x,'');\n", - "d=1./t;\n", - "print'%s %.3e %s'%('bandwidth (in Hz) is',d,'');\n", - "y=l**2*d/c;##line width in m\n", - "print'%s %.2f %s'%('line width(in armstrong )is',y*10**10,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "coherence length (in m) is 0.03 \n", - "bandwidth (in Hz) is 1.000e+10 \n", - "line width(in armstrong )is 0.13 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 14.4\n", - "##calculation of frequency difference\n", - "\n", - "##given values\n", - "c=3*10**8;##velocity of light in m/s\n", - "l=.5;##distance in m\n", - "\n", - "##calculation\n", - "f=c/(2*l);##in hertz\n", - "print'%s %.2f %s'%('frequency difference (in MHz) is',f/10**6,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "frequency difference (in MHz) is 300.00 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 14.5\n", - "##calculation of no of cavity modes\n", - "\n", - "##given values\n", - "c=3*10**8.;##velocity of light in m/s\n", - "n=1.75;##refractive index\n", - "l=2*10**-2;##length of ruby rod in m\n", - "x=6943*10**-10.;##wavelength in m\n", - "y=5.3*10**-10.;##spread of wavelength in m\n", - "\n", - "##calculation\n", - "d=c/n/l;\n", - "f=c*y/x**2.;\n", - "m=f/d;\n", - "print'%s %.2f %s'%('no of modes is',m,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "no of modes is 38.48 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter15.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter15.ipynb deleted file mode 100755 index fd70c5b8..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter15.ipynb +++ /dev/null @@ -1,661 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:00168ce8e6485ed62b7ab93f835949895122e8d417f4d6143363c166514fa2f2" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Chapter15-Atomic Nucleus And Nuclear Energy" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg-pg427" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.1\n", - "##calculation of binding energy per nucleon\n", - "\n", - "##given values\n", - "Mp=1.00814;##mass of proton in amu\n", - "Mn=1.008665;##mass of nucleon in amu\n", - "M=7.01822;##mass of Lithium nucleus in amu\n", - "amu=931.;##amu in MeV\n", - "n=7-3;##no of neutrons in lithium nucleus\n", - "\n", - "##calculation\n", - "ET=(3*Mp+4*Mn-M)*amu;##total binding energy in MeV\n", - "E=ET/7.;##7 1s the mass number\n", - "print'%s %.2f %s'%('Binding energy per nucleon in MeV is',E,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binding energy per nucleon in MeV is 5.43 \n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg427" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.2\n", - "##calculation of energy \n", - "\n", - "##given values\n", - "M1=15.00001;##atomic mass of N15 in amu\n", - "M2=15.0030;##atomic mass of O15 in amu\n", - "M3=15.9949;##atomic mass of O16 in amu\n", - "amu=931.4;##amu in MeV\n", - "mp=1.0072766;##restmass of proton\n", - "mn=1.0086654;##restmass of neutron\n", - "\n", - "##calculation\n", - "Q1=(M3-mp-M1)*amu;\n", - "print'%s %.2f %s'%('energy required to remove one proton from O16 is',Q1,'');\n", - "Q2=(M3-mn-M2)*amu;\n", - "print'%s %.2f %s'%('energy required to remove one neutron from O16 is',Q2,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "energy required to remove one proton from O16 is -11.54 \n", - "energy required to remove one neutron from O16 is -15.62 \n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg428" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.3\n", - "##calculation of binding energy \n", - "\n", - "##given values\n", - "Mp=1.00758;##mass of proton in amu\n", - "Mn=1.00897;##mass of nucleon in amu\n", - "M=4.0028;##mass of Helium nucleus in amu\n", - "amu=931.4;##amu in MeV\n", - "\n", - "##calculation\n", - "E1=(2*Mp+2*Mn-M)*amu;##total binding energy\n", - "print'%s %.2f %s'%('Binding energy in MeV is',E1,'');\n", - "E2=E1*10**6*1.6*10**-19;\n", - "print'%s %.3e %s'%('binding energy in Joule is',E2,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binding energy in MeV is 28.22 \n", - "binding energy in Joule is 4.515e-12 \n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg435" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.4\n", - "##calculation of amount of unchanged material\n", - "\n", - "##given values\n", - "T=2;##half life in years\n", - "k=.6931/T;##decay constant\n", - "M=4.0028;##mass of Helium nucleus in amu\n", - "amu=931.4;##amu in MeV\n", - "No=1.;##initial amount in g\n", - "\n", - "##calculation\n", - "N=No*(math.e**(-k*2*T));\n", - "print'%s %.2f %s'%('amount of material remaining unchanged after four years(in gram) is',N,'');\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "amount of material remaining unchanged after four years(in gram) is 0.25 \n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg435" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.5\n", - "##calculation of amount of halflife\n", - "\n", - "##given values\n", - "t=5.;##time period in years\n", - "amu=931.4;##amu in MeV\n", - "No=5.;##initial amount in g\n", - "N=5.-(10.5*10**-3);##amount present after 5 years\n", - "\n", - "\n", - "##calculation\n", - "k=math.log(N/No)/t;##decay constant\n", - "T=-.693/k;\n", - "print'%s %.2f %s'%('halflife in years is',T,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "halflife in years is 1648.27 \n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg435" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.6\n", - "##calculation of activity\n", - "\n", - "##given values\n", - "t=28.;##half life in years\n", - "m=10**-3;##mass of sample\n", - "M=90.;##atomic mass of strontium\n", - "NA=6.02*10**26;##avogadro's number\n", - "\n", - "\n", - "##calculation\n", - "n=m*NA/M;##no of nuclei in 1 mg sample\n", - "k=.693/(t*365*24.*60.*60.);##decay constant\n", - "A=k*n;\n", - "print'%s %.3e %s'%('activity of sample(in disintegrations per second) is',A,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "activity of sample(in disintegrations per second) is 5.250e+12 \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg439" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.7\n", - "##calculation of age of mineral\n", - "\n", - "##given values\n", - "t=4.5*10**9.;##half life in years\n", - "M1=238.;##atomic mass of Uranium in g\n", - "m=.093;##mass of lead in 1 g of uranium in g\n", - "NA=6.02*10**26;##avogadro's number\n", - "M2=206.;##atomic mass of lead in g\n", - "\n", - "##calculation\n", - "n=NA/M1;##no of nuclei in 1 g of uranium sample\n", - "n1=m*NA/M2;##no of nuclei in m mass of lead\n", - "c=n1/n;\n", - "k=.693/t;##decay constant\n", - "T=(1/k)*math.log(1+c);\n", - "print'%s %.3e %s'%('age of mineral in years is',T,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "age of mineral in years is 6.627e+08 \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg440" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.8\n", - "##calculation of age of wooden piece\n", - "\n", - "##given values\n", - "t=5730.;##half life of C14 in years\n", - "M1=50.;##mass of wooden piece in g\n", - "A1=320.;##activity of wooden piece (disintegration per minute per g)\n", - "A2=12.;##activity of living tree\n", - "\n", - "##calculation\n", - "k=.693/t;##decay constant\n", - "A=A1/M1;##activity after death\n", - "\n", - "T=(1/k)*math.log(A2/A);\n", - "print'%s %.2f %s'%('age of mineral in years is',T,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "age of mineral in years is 5197.59 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg443" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.9\n", - "##calculation of energy released\n", - "\n", - "##given values\n", - "M1=10.016125;##atomic mass of Boron in amu\n", - "M2=13.007440;##atomic mass of C13 in amu\n", - "M3=4.003874;##atomic mass of Helium in amu\n", - "mp=1.008146;##mass of proton in amu\n", - "amu=931.;##amu in MeV\n", - "\n", - "##calculation\n", - "Q=(M1+M3-(M2+mp))*amu;##total binding energy in M\n", - "print'%s %.2f %s'%('Binding energy per nucleon in MeV is',Q,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binding energy per nucleon in MeV is 4.11 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg444" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.10\n", - "##calculation of crosssection\n", - "\n", - "##given values\n", - "t=.01*10**-3;##thickness in m\n", - "n=10**13.;##no of protons bombarding target per s\n", - "NA=6.02*10**26.;##avogadro's number\n", - "M=7.;##atomic mass of lithium in kg\n", - "d=500.;##density of lithium in kg/m**3\n", - "n0=10**8.;##no of neutrons produced per s\n", - "##calculation\n", - "n1=d*NA/M;##no of target nuclei per unit volume\n", - "n2=n1*t;##no of target nuclei per area\n", - "A=n0/(n*n2);\n", - "print'%s %.3e %s'%('crosssection(in m^2) for this reaction is',A,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "crosssection(in m^2) for this reaction is 2.326e-29 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg450" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.11\n", - "##calculation of final energy \n", - "\n", - "##given values\n", - "B=.4;##max magnetic field in Wb/m**2\n", - "c=3*10**8.;\n", - "e=1.6*10**-19.;\n", - "d=1.52;##diametre in m\n", - "r=d/2.;\n", - "\n", - "##calculation\n", - "E=B*e*r*c;##E=pc,p=mv=Ber\n", - "print'%s %.3e %s'%('final energy of e(in J) is',E,'');\n", - "E1=(E/e)/10**6;\n", - "print'%s %.2f %s'%('final energy of e (in MeV) is',E1,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "final energy of e(in J) is 1.459e-11 \n", - "final energy of e (in MeV) is 91.20 \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg459" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.12\n", - "##calculation of amount of fuel\n", - "\n", - "##given values\n", - "P=100*10**6.;##power required by city\n", - "M=235.;##atomic mass of Uranium in g\n", - "e=20/100.;##conversion efficiency\n", - "NA=6.02*10**26.;##avogadros number\n", - "E=200*10**6*1.6*10**-19;##energy released per fission\n", - "t=8.64*10**4.;##day in seconds\n", - "\n", - "\n", - "##calculation\n", - "E1=P*t;##energy requirement\n", - "m=E1*M/(NA*e*E);##no of nuclei N=NA*m/M,energy released by m kg is N*E,energy requirement=e*N*E\n", - "print'%s %.2f %s'%('amount of fuel(in kg) required is',m,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "amount of fuel(in kg) required is 0.53 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg459" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.13\n", - "##calculation of power output\n", - "\n", - "##given values\n", - "M=235.;##atomic mass of Uranium in kg\n", - "e=5/100.;##reactor efficiency\n", - "m=25/1000.;##amount of uranium consumed per day in kg\n", - "E=200*10**6*1.6*10**-19;##energy released per fission\n", - "t=8.64*10**4.;##day in seconds\n", - "NA=6.02*10**26.;##avogadros number\n", - "\n", - "##calculation\n", - "n=NA*m/M;##no of nuclei in 25g\n", - "E1=n*E;##energy produced by n nuclei\n", - "E2=E1*e;##energy converted to power\n", - "P=E2/t;##power output in Watt\n", - "print'%s %.2f %s'%('power output in MW is',P/10**6,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power output in MW is 1.19 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg460" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.14\n", - "##calculation of power developed\n", - "\n", - "##given values\n", - "M=235.;##atomic mass of Uranium in kg\n", - "m=20.4;##amount of uranium consumed per day in kg\n", - "E=200*10**6*1.6*10**-19;##energy released per fission\n", - "t=3600*1000.;##time of operation\n", - "NA=6.02*10**26;##avogadros number\n", - "\n", - "##calculation\n", - "n=NA*m/M;##no of nuclei in 20.4kg\n", - "E1=n*E;##energy produced by n nuclei\n", - "P=E1/t;##in Watt\n", - "print'%s %.2f %s'%('power developed in MW is',P/10**6,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power developed in MW is 464.52 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg464" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.15\n", - "##calculation of amount of dueterium consumed\n", - "\n", - "##given values\n", - "M1=2.01478;##atomic mass of Hydrogen in amu\n", - "M2=4.00388;##atomic mass of Helium in amu\n", - "amu=931.;##amu in MeV\n", - "e=30/100.;##efficiency\n", - "P=50*10**6.;##output power\n", - "NA=6.026*10**26.;##avogadro number\n", - "t=8.64*10**4.;##seconds in a day\n", - "\n", - "##calculation\n", - "Q=(2*M1-M2)*amu;##energy released in a D-D reaction in MeV\n", - "O=Q*e*10**6/2.;##actual output per dueterium atom in eV\n", - "n=P/(O*1.6*10**-19);##no of D atoms required\n", - "m=n*M1/NA;##equivalent mass of D required per s\n", - "X=m*t;\n", - "\n", - "print'%s %.2f %s'%('Deuterium requirement per day in kg is',X,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Deuterium requirement per day in kg is 0.03 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter15_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter15_1.ipynb deleted file mode 100755 index 42c1e8e6..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter15_1.ipynb +++ /dev/null @@ -1,661 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:b3c63b0fb789da64aa0a78019434c8cd892ee24c8c45cf80d5de4f41e17fa45f" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter15-Atomic Nucleus And Nuclear Energy" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg-pg427" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.1\n", - "##calculation of binding energy per nucleon\n", - "\n", - "##given values\n", - "Mp=1.00814;##mass of proton in amu\n", - "Mn=1.008665;##mass of nucleon in amu\n", - "M=7.01822;##mass of Lithium nucleus in amu\n", - "amu=931.;##amu in MeV\n", - "n=7-3;##no of neutrons in lithium nucleus\n", - "\n", - "##calculation\n", - "ET=(3*Mp+4*Mn-M)*amu;##total binding energy in MeV\n", - "E=ET/7.;##7 1s the mass number\n", - "print'%s %.2f %s'%('Binding energy per nucleon in MeV is',E,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binding energy per nucleon in MeV is 5.43 \n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg427" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.2\n", - "##calculation of energy \n", - "\n", - "##given values\n", - "M1=15.00001;##atomic mass of N15 in amu\n", - "M2=15.0030;##atomic mass of O15 in amu\n", - "M3=15.9949;##atomic mass of O16 in amu\n", - "amu=931.4;##amu in MeV\n", - "mp=1.0072766;##restmass of proton\n", - "mn=1.0086654;##restmass of neutron\n", - "\n", - "##calculation\n", - "Q1=(M3-mp-M1)*amu;\n", - "print'%s %.2f %s'%('energy required to remove one proton from O16 is',Q1,'');\n", - "Q2=(M3-mn-M2)*amu;\n", - "print'%s %.2f %s'%('energy required to remove one neutron from O16 is',Q2,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "energy required to remove one proton from O16 is -11.54 \n", - "energy required to remove one neutron from O16 is -15.62 \n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg428" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.3\n", - "##calculation of binding energy \n", - "\n", - "##given values\n", - "Mp=1.00758;##mass of proton in amu\n", - "Mn=1.00897;##mass of nucleon in amu\n", - "M=4.0028;##mass of Helium nucleus in amu\n", - "amu=931.4;##amu in MeV\n", - "\n", - "##calculation\n", - "E1=(2*Mp+2*Mn-M)*amu;##total binding energy\n", - "print'%s %.2f %s'%('Binding energy in MeV is',E1,'');\n", - "E2=E1*10**6*1.6*10**-19;\n", - "print'%s %.3e %s'%('binding energy in Joule is',E2,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binding energy in MeV is 28.22 \n", - "binding energy in Joule is 4.515e-12 \n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg435" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.4\n", - "##calculation of amount of unchanged material\n", - "\n", - "##given values\n", - "T=2;##half life in years\n", - "k=.6931/T;##decay constant\n", - "M=4.0028;##mass of Helium nucleus in amu\n", - "amu=931.4;##amu in MeV\n", - "No=1.;##initial amount in g\n", - "\n", - "##calculation\n", - "N=No*(math.e**(-k*2*T));\n", - "print'%s %.2f %s'%('amount of material remaining unchanged after four years(in gram) is',N,'');\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "amount of material remaining unchanged after four years(in gram) is 0.25 \n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg435" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.5\n", - "##calculation of amount of halflife\n", - "\n", - "##given values\n", - "t=5.;##time period in years\n", - "amu=931.4;##amu in MeV\n", - "No=5.;##initial amount in g\n", - "N=5.-(10.5*10**-3);##amount present after 5 years\n", - "\n", - "\n", - "##calculation\n", - "k=math.log(N/No)/t;##decay constant\n", - "T=-.693/k;\n", - "print'%s %.2f %s'%('halflife in years is',T,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "halflife in years is 1648.27 \n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg435" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.6\n", - "##calculation of activity\n", - "\n", - "##given values\n", - "t=28.;##half life in years\n", - "m=10**-3;##mass of sample\n", - "M=90.;##atomic mass of strontium\n", - "NA=6.02*10**26;##avogadro's number\n", - "\n", - "\n", - "##calculation\n", - "n=m*NA/M;##no of nuclei in 1 mg sample\n", - "k=.693/(t*365*24.*60.*60.);##decay constant\n", - "A=k*n;\n", - "print'%s %.3e %s'%('activity of sample(in disintegrations per second) is',A,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "activity of sample(in disintegrations per second) is 5.250e+12 \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg439" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.7\n", - "##calculation of age of mineral\n", - "\n", - "##given values\n", - "t=4.5*10**9.;##half life in years\n", - "M1=238.;##atomic mass of Uranium in g\n", - "m=.093;##mass of lead in 1 g of uranium in g\n", - "NA=6.02*10**26;##avogadro's number\n", - "M2=206.;##atomic mass of lead in g\n", - "\n", - "##calculation\n", - "n=NA/M1;##no of nuclei in 1 g of uranium sample\n", - "n1=m*NA/M2;##no of nuclei in m mass of lead\n", - "c=n1/n;\n", - "k=.693/t;##decay constant\n", - "T=(1/k)*math.log(1+c);\n", - "print'%s %.3e %s'%('age of mineral in years is',T,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "age of mineral in years is 6.627e+08 \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg440" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.8\n", - "##calculation of age of wooden piece\n", - "\n", - "##given values\n", - "t=5730.;##half life of C14 in years\n", - "M1=50.;##mass of wooden piece in g\n", - "A1=320.;##activity of wooden piece (disintegration per minute per g)\n", - "A2=12.;##activity of living tree\n", - "\n", - "##calculation\n", - "k=.693/t;##decay constant\n", - "A=A1/M1;##activity after death\n", - "\n", - "T=(1/k)*math.log(A2/A);\n", - "print'%s %.2f %s'%('age of mineral in years is',T,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "age of mineral in years is 5197.59 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg443" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.9\n", - "##calculation of energy released\n", - "\n", - "##given values\n", - "M1=10.016125;##atomic mass of Boron in amu\n", - "M2=13.007440;##atomic mass of C13 in amu\n", - "M3=4.003874;##atomic mass of Helium in amu\n", - "mp=1.008146;##mass of proton in amu\n", - "amu=931.;##amu in MeV\n", - "\n", - "##calculation\n", - "Q=(M1+M3-(M2+mp))*amu;##total binding energy in M\n", - "print'%s %.2f %s'%('Binding energy per nucleon in MeV is',Q,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binding energy per nucleon in MeV is 4.11 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg444" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.10\n", - "##calculation of crosssection\n", - "\n", - "##given values\n", - "t=.01*10**-3;##thickness in m\n", - "n=10**13.;##no of protons bombarding target per s\n", - "NA=6.02*10**26.;##avogadro's number\n", - "M=7.;##atomic mass of lithium in kg\n", - "d=500.;##density of lithium in kg/m**3\n", - "n0=10**8.;##no of neutrons produced per s\n", - "##calculation\n", - "n1=d*NA/M;##no of target nuclei per unit volume\n", - "n2=n1*t;##no of target nuclei per area\n", - "A=n0/(n*n2);\n", - "print'%s %.3e %s'%('crosssection(in m^2) for this reaction is',A,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "crosssection(in m^2) for this reaction is 2.326e-29 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg450" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.11\n", - "##calculation of final energy \n", - "\n", - "##given values\n", - "B=.4;##max magnetic field in Wb/m**2\n", - "c=3*10**8.;\n", - "e=1.6*10**-19.;\n", - "d=1.52;##diametre in m\n", - "r=d/2.;\n", - "\n", - "##calculation\n", - "E=B*e*r*c;##E=pc,p=mv=Ber\n", - "print'%s %.3e %s'%('final energy of e(in J) is',E,'');\n", - "E1=(E/e)/10**6;\n", - "print'%s %.2f %s'%('final energy of e (in MeV) is',E1,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "final energy of e(in J) is 1.459e-11 \n", - "final energy of e (in MeV) is 91.20 \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg459" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.12\n", - "##calculation of amount of fuel\n", - "\n", - "##given values\n", - "P=100*10**6.;##power required by city\n", - "M=235.;##atomic mass of Uranium in g\n", - "e=20/100.;##conversion efficiency\n", - "NA=6.02*10**26.;##avogadros number\n", - "E=200*10**6*1.6*10**-19;##energy released per fission\n", - "t=8.64*10**4.;##day in seconds\n", - "\n", - "\n", - "##calculation\n", - "E1=P*t;##energy requirement\n", - "m=E1*M/(NA*e*E);##no of nuclei N=NA*m/M,energy released by m kg is N*E,energy requirement=e*N*E\n", - "print'%s %.2f %s'%('amount of fuel(in kg) required is',m,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "amount of fuel(in kg) required is 0.53 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg459" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.13\n", - "##calculation of power output\n", - "\n", - "##given values\n", - "M=235.;##atomic mass of Uranium in kg\n", - "e=5/100.;##reactor efficiency\n", - "m=25/1000.;##amount of uranium consumed per day in kg\n", - "E=200*10**6*1.6*10**-19;##energy released per fission\n", - "t=8.64*10**4.;##day in seconds\n", - "NA=6.02*10**26.;##avogadros number\n", - "\n", - "##calculation\n", - "n=NA*m/M;##no of nuclei in 25g\n", - "E1=n*E;##energy produced by n nuclei\n", - "E2=E1*e;##energy converted to power\n", - "P=E2/t;##power output in Watt\n", - "print'%s %.2f %s'%('power output in MW is',P/10**6,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power output in MW is 1.19 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg460" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.14\n", - "##calculation of power developed\n", - "\n", - "##given values\n", - "M=235.;##atomic mass of Uranium in kg\n", - "m=20.4;##amount of uranium consumed per day in kg\n", - "E=200*10**6*1.6*10**-19;##energy released per fission\n", - "t=3600*1000.;##time of operation\n", - "NA=6.02*10**26;##avogadros number\n", - "\n", - "##calculation\n", - "n=NA*m/M;##no of nuclei in 20.4kg\n", - "E1=n*E;##energy produced by n nuclei\n", - "P=E1/t;##in Watt\n", - "print'%s %.2f %s'%('power developed in MW is',P/10**6,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power developed in MW is 464.52 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg464" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 15.15\n", - "##calculation of amount of dueterium consumed\n", - "\n", - "##given values\n", - "M1=2.01478;##atomic mass of Hydrogen in amu\n", - "M2=4.00388;##atomic mass of Helium in amu\n", - "amu=931.;##amu in MeV\n", - "e=30/100.;##efficiency\n", - "P=50*10**6.;##output power\n", - "NA=6.026*10**26.;##avogadro number\n", - "t=8.64*10**4.;##seconds in a day\n", - "\n", - "##calculation\n", - "Q=(2*M1-M2)*amu;##energy released in a D-D reaction in MeV\n", - "O=Q*e*10**6/2.;##actual output per dueterium atom in eV\n", - "n=P/(O*1.6*10**-19);##no of D atoms required\n", - "m=n*M1/NA;##equivalent mass of D required per s\n", - "X=m*t;\n", - "\n", - "print'%s %.2f %s'%('Deuterium requirement per day in kg is',X,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Deuterium requirement per day in kg is 0.03 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter16.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter16.ipynb deleted file mode 100755 index 0852b1be..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter16.ipynb +++ /dev/null @@ -1,187 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:d811f941685df0c27130d7c823a224d6aa75e253b0c49d58341e9220ca07cdb5" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter16-Structure of Solids" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg483" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 16.1\n", - "##calculation of density\n", - "\n", - "##given values\n", - "a=3.36*10**-10;##lattice constant in m\n", - "M=209.;##atomicmass of polonium in kg\n", - "N=6.02*10**26;##avogadro's number\n", - "z=1.;##no of atom\n", - "##calculation\n", - "d=z*M/(N*a**3)\n", - "\n", - "print'%s %.2f %s'%('density (in kg/m^3) is',d,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "density (in kg/m^3) is 9152.34 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg483" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 16.2\n", - "##calculation of no of atoms\n", - "\n", - "##given values\n", - "a=4.3*10**-10;##edge of unit cell in m\n", - "d=963.;##density in kg/m**3\n", - "M=23.;##atomicmass of sodium in kg\n", - "N=6.02*10**26;##avogadro's number\n", - "\n", - "##calculation\n", - "z=d*N*a**3./M;\n", - "\n", - "print'%s %.2f %s'%('no of atoms is',z,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "no of atoms is 2.00 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg483" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 16.3\n", - "##calculation of distance\n", - "\n", - "##given values\n", - "z=4.;##no of atoms in fcc\n", - "d=2180.;##density in kg/m**3\n", - "M=23+35.3;##atomicmass of sodium chloride in kg\n", - "N=6.02*10**26;##avogadro's number\n", - "\n", - "##calculation\n", - "a1=z*M/(N*d);\n", - "a=a1**(1/3.);\n", - "l=a/2.;##in m\n", - "\n", - "print'%s %.2f %s'%('distance between adjacent chlorine and sodium atoms in armstrong is',l*10**10,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "distance between adjacent chlorine and sodium atoms in armstrong is 2.81 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg495" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 16.4\n", - "##calculation of interatomic spacing\n", - "\n", - "##given values\n", - "alpha=30*math.pi/180.;##Bragg angle in degree\n", - "h=1;\n", - "k=1;\n", - "l=1;\n", - "m=1;##order of reflection\n", - "x=1.75*10**-10;##wavelength in m\n", - "\n", - "##calculation\n", - "d=m*x/(2.*math.sin(alpha));\n", - "a=d*math.sqrt(h**2+k**2+l**2.);##in m\n", - "\n", - "print'%s %.2f %s'%('interatomic spacing in armstrong is',a*10**10,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "interatomic spacing in armstrong is 3.03 \n" - ] - } - ], - "prompt_number": 6 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter16_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter16_1.ipynb deleted file mode 100755 index 0852b1be..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter16_1.ipynb +++ /dev/null @@ -1,187 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:d811f941685df0c27130d7c823a224d6aa75e253b0c49d58341e9220ca07cdb5" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter16-Structure of Solids" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg483" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 16.1\n", - "##calculation of density\n", - "\n", - "##given values\n", - "a=3.36*10**-10;##lattice constant in m\n", - "M=209.;##atomicmass of polonium in kg\n", - "N=6.02*10**26;##avogadro's number\n", - "z=1.;##no of atom\n", - "##calculation\n", - "d=z*M/(N*a**3)\n", - "\n", - "print'%s %.2f %s'%('density (in kg/m^3) is',d,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "density (in kg/m^3) is 9152.34 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg483" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 16.2\n", - "##calculation of no of atoms\n", - "\n", - "##given values\n", - "a=4.3*10**-10;##edge of unit cell in m\n", - "d=963.;##density in kg/m**3\n", - "M=23.;##atomicmass of sodium in kg\n", - "N=6.02*10**26;##avogadro's number\n", - "\n", - "##calculation\n", - "z=d*N*a**3./M;\n", - "\n", - "print'%s %.2f %s'%('no of atoms is',z,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "no of atoms is 2.00 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg483" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 16.3\n", - "##calculation of distance\n", - "\n", - "##given values\n", - "z=4.;##no of atoms in fcc\n", - "d=2180.;##density in kg/m**3\n", - "M=23+35.3;##atomicmass of sodium chloride in kg\n", - "N=6.02*10**26;##avogadro's number\n", - "\n", - "##calculation\n", - "a1=z*M/(N*d);\n", - "a=a1**(1/3.);\n", - "l=a/2.;##in m\n", - "\n", - "print'%s %.2f %s'%('distance between adjacent chlorine and sodium atoms in armstrong is',l*10**10,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "distance between adjacent chlorine and sodium atoms in armstrong is 2.81 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg495" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 16.4\n", - "##calculation of interatomic spacing\n", - "\n", - "##given values\n", - "alpha=30*math.pi/180.;##Bragg angle in degree\n", - "h=1;\n", - "k=1;\n", - "l=1;\n", - "m=1;##order of reflection\n", - "x=1.75*10**-10;##wavelength in m\n", - "\n", - "##calculation\n", - "d=m*x/(2.*math.sin(alpha));\n", - "a=d*math.sqrt(h**2+k**2+l**2.);##in m\n", - "\n", - "print'%s %.2f %s'%('interatomic spacing in armstrong is',a*10**10,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "interatomic spacing in armstrong is 3.03 \n" - ] - } - ], - "prompt_number": 6 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter17.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter17.ipynb deleted file mode 100755 index 24b8e0d7..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter17.ipynb +++ /dev/null @@ -1,138 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:247cbf7511831aaf13adbf586a5a4c7c4e491e38e060a5558f6021f692906cbf" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter17-The Band Theory of Solids" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg522" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 17.1\n", - "##calculation of probability\n", - "\n", - "##given values\n", - "E=.01;##energy difference in eV\n", - "kT=.026;##temperture equivalent at room temp in e\n", - "\n", - "##calculation\n", - "P=1/(1+(math.e**(E/kT)));\n", - "\n", - "print'%s %.2f %s'%('interatomic spacing is',P,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "interatomic spacing is 0.41 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg523" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 17.2\n", - "##calculation of velocity of e\n", - "\n", - "##given values\n", - "e=1.6*10**-19.;##charge of e in C\n", - "E=2.1*e;##fermi level in J\n", - "m=9.1*10**-31.;##mass of e in kg\n", - "\n", - "##calculation\n", - "v=math.sqrt(2.*E/m);\n", - "\n", - "print'%s %.2f %s'%('velocity of e(in m/s)',v,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "velocity of e(in m/s) 859337.85 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg523" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 17.3\n", - "##calculation of velocity of fraction of free electrons\n", - "\n", - "##given values\n", - "E=5.5;##fermi level in eV\n", - "kT=.026;##temperture equivalent at room temp in e\n", - "\n", - "##calculation\n", - "f=2.*kT/E;\n", - "\n", - "print'%s %.4f %s'%('fraction of free electrone\\s upto width kT on either side of Ef is',f,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fraction of free electrone\\s upto width kT on either side of Ef is 0.0095 \n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter17_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter17_1.ipynb deleted file mode 100755 index 24b8e0d7..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter17_1.ipynb +++ /dev/null @@ -1,138 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:247cbf7511831aaf13adbf586a5a4c7c4e491e38e060a5558f6021f692906cbf" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter17-The Band Theory of Solids" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg522" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 17.1\n", - "##calculation of probability\n", - "\n", - "##given values\n", - "E=.01;##energy difference in eV\n", - "kT=.026;##temperture equivalent at room temp in e\n", - "\n", - "##calculation\n", - "P=1/(1+(math.e**(E/kT)));\n", - "\n", - "print'%s %.2f %s'%('interatomic spacing is',P,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "interatomic spacing is 0.41 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg523" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 17.2\n", - "##calculation of velocity of e\n", - "\n", - "##given values\n", - "e=1.6*10**-19.;##charge of e in C\n", - "E=2.1*e;##fermi level in J\n", - "m=9.1*10**-31.;##mass of e in kg\n", - "\n", - "##calculation\n", - "v=math.sqrt(2.*E/m);\n", - "\n", - "print'%s %.2f %s'%('velocity of e(in m/s)',v,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "velocity of e(in m/s) 859337.85 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg523" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 17.3\n", - "##calculation of velocity of fraction of free electrons\n", - "\n", - "##given values\n", - "E=5.5;##fermi level in eV\n", - "kT=.026;##temperture equivalent at room temp in e\n", - "\n", - "##calculation\n", - "f=2.*kT/E;\n", - "\n", - "print'%s %.4f %s'%('fraction of free electrone\\s upto width kT on either side of Ef is',f,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fraction of free electrone\\s upto width kT on either side of Ef is 0.0095 \n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter18.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter18.ipynb deleted file mode 100755 index d80a182f..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter18.ipynb +++ /dev/null @@ -1,319 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:265535ddaffc0266824860d662b8052593e36ca515dd70e32c070b51cf842e7d" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter18-Semiconductors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg539" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 18.2\n", - "##calculation of probability\n", - "\n", - "##given values\n", - "T=300.;##temp in K\n", - "kT=.026;##temperture equivalent at room temp in eV\n", - "Eg=5.6;##forbidden gap in eV\n", - "\n", - "##calculation\n", - "f=1./(1.+math.e**(Eg/(2.*kT)));\n", - "\n", - "print'%s %.3e %s'%('probability of an e being thermally promoted to conduction band is',f,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "probability of an e being thermally promoted to conduction band is 1.698e-47 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 18.3\n", - "##calculation of fraction of e in CB\n", - "\n", - "##given values\n", - "T=300.;##temp in K\n", - "kT=.026;##temperture equivalent at room temp in eV\n", - "Eg1=.72;##forbidden gap of germanium in eV\n", - "Eg2=1.1;##forbidden gap of silicon in eV\n", - "Eg3=5.6;##forbidden gap of diamond in eV\n", - "\n", - "##calculation\n", - "f1=math.e**(-Eg1/(2.*kT));\n", - "print'%s %.6f %s'%('fraction of e in conduction band of germanium is',f1,'');\n", - "f2=math.e**(-Eg2/(2.*kT));\n", - "print'%s %.3e %s'%('fraction of e in conduction band of silicon is',f2,'');\n", - "f3=math.e**(-Eg3/(2*kT));\n", - "print'%s %.3e %s'%('fraction of e in conduction band of diamond is',f3,'');\n", - "print'abpove results shows that larger the band gap and the smaller electrons that can go under into the conduction band'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fraction of e in conduction band of germanium is 0.000001 \n", - "fraction of e in conduction band of silicon is 6.501e-10 \n", - "fraction of e in conduction band of diamond is 1.698e-47 \n", - "abpove results shows that larger the band gap and the smaller electrons that can go under into the conduction band\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 18.4\n", - "##calculation of fractionional change in no of e\n", - "\n", - "##given values\n", - "T1=300.;##temp in K\n", - "T2=310.;##temp in K\n", - "Eg=1.1;##forbidden gap of silicon in eV\n", - "k=8.6*10**-5.;##boltzmann's constant in eV/K\n", - "\n", - "##calculation\n", - "n1=(10**21.7)*(T1**(3/2.))*10**(-2500.*Eg/T1);##no of conduction e at T1\n", - "n2=(10**21.7)*(T2**(3/2.))*10**(-2500.*Eg/T2);##no of conduction e at T2\n", - "x=n2/n1;\n", - "print'%s %.1f %s'%('fractional change in no of e is',x,'');\n", - "print 'in book he just worte ans but he didnt calculated final ans but here is i calculated'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fractional change in no of e is 2.1 \n", - "in book he just worte ans but he didnt calculated final ans but here is i calculated\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg541" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##Example 18.5\n", - "##calculation of resistivity\n", - "\n", - "##given values\n", - "e=1.6*10**-19;\n", - "ni=2.5*10**19;##intrinsic density of carriers per m**3\n", - "ue=.39;##mobility of e \n", - "uh=.19;##mobility of hole\n", - "\n", - "\n", - "##calculation\n", - "c=e*ni*(ue+uh);##conductivity\n", - "r=1/c;##resistivity\n", - "print'%s %.2f %s'%('resistivity in ohm m is',r,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "resistivity in ohm m is 0.43 \n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg548" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 18.6\n", - "##calculation of conductivity of intrinsic and doped semiconductors\n", - "\n", - "##given values\n", - "h=4.52*10**24;##no of holes per m**3\n", - "e=1.25*10**14;##no of electrons per m**3\n", - "ue=.38;##e mobility\n", - "uh=.18;##hole mobility\n", - "q=1.6*10**-19;##charge of e in C\n", - "##calculation\n", - "ni=math.sqrt(h*e);##intrinsic concentration\n", - "ci=q*ni*(ue+uh);\n", - "print'%s %.2f %s'%('conductivity of semiconductor(in S/m) is',ci,'');\n", - "cp=q*h*uh;\n", - "print'%s %.2f %s'%('conductivity of doped semiconductor (in S/m) is',cp,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conductivity of semiconductor(in S/m) is 2.13 \n", - "conductivity of doped semiconductor (in S/m) is 130176.00 \n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg548" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 18.7\n", - "##calculation of hole concentration\n", - "\n", - "##given values\n", - "ni=2.4*10**19.;##carrier concentration per m**3\n", - "N=4*10**28.;##concentration of ge atoms per m**3\n", - "\n", - "##calculation\n", - "ND=N/10**6.;##donor cocntrtn\n", - "n=ND;##no of electrones\n", - "\n", - "p=ni**2./n;\n", - "print'%s %.3e %s'%('concentartion of holes per m^3 is',p,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "concentartion of holes per m^3 is 1.440e+16 \n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg558" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 18.8\n", - "##calculation of Hall voltage\n", - "\n", - "##given values\n", - "ND=10**21.;##donor density per m**3\n", - "B=.5;##magnetic field in T\n", - "J=500.;##current density in A/m**2\n", - "w=3*10**-3.;##width in m\n", - "e=1.6*10**-19.;##charge in C\n", - "\n", - "##calculation\n", - "\n", - "\n", - "V=B*J*w/(ND*e);##in volts\n", - "print'%s %.2f %s'%('Hall voltage in mv is',V*10**3,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hall voltage in mv is 4.69 \n" - ] - } - ], - "prompt_number": 14 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter18_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter18_1.ipynb deleted file mode 100755 index d80a182f..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter18_1.ipynb +++ /dev/null @@ -1,319 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:265535ddaffc0266824860d662b8052593e36ca515dd70e32c070b51cf842e7d" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter18-Semiconductors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg539" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 18.2\n", - "##calculation of probability\n", - "\n", - "##given values\n", - "T=300.;##temp in K\n", - "kT=.026;##temperture equivalent at room temp in eV\n", - "Eg=5.6;##forbidden gap in eV\n", - "\n", - "##calculation\n", - "f=1./(1.+math.e**(Eg/(2.*kT)));\n", - "\n", - "print'%s %.3e %s'%('probability of an e being thermally promoted to conduction band is',f,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "probability of an e being thermally promoted to conduction band is 1.698e-47 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 18.3\n", - "##calculation of fraction of e in CB\n", - "\n", - "##given values\n", - "T=300.;##temp in K\n", - "kT=.026;##temperture equivalent at room temp in eV\n", - "Eg1=.72;##forbidden gap of germanium in eV\n", - "Eg2=1.1;##forbidden gap of silicon in eV\n", - "Eg3=5.6;##forbidden gap of diamond in eV\n", - "\n", - "##calculation\n", - "f1=math.e**(-Eg1/(2.*kT));\n", - "print'%s %.6f %s'%('fraction of e in conduction band of germanium is',f1,'');\n", - "f2=math.e**(-Eg2/(2.*kT));\n", - "print'%s %.3e %s'%('fraction of e in conduction band of silicon is',f2,'');\n", - "f3=math.e**(-Eg3/(2*kT));\n", - "print'%s %.3e %s'%('fraction of e in conduction band of diamond is',f3,'');\n", - "print'abpove results shows that larger the band gap and the smaller electrons that can go under into the conduction band'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fraction of e in conduction band of germanium is 0.000001 \n", - "fraction of e in conduction band of silicon is 6.501e-10 \n", - "fraction of e in conduction band of diamond is 1.698e-47 \n", - "abpove results shows that larger the band gap and the smaller electrons that can go under into the conduction band\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 18.4\n", - "##calculation of fractionional change in no of e\n", - "\n", - "##given values\n", - "T1=300.;##temp in K\n", - "T2=310.;##temp in K\n", - "Eg=1.1;##forbidden gap of silicon in eV\n", - "k=8.6*10**-5.;##boltzmann's constant in eV/K\n", - "\n", - "##calculation\n", - "n1=(10**21.7)*(T1**(3/2.))*10**(-2500.*Eg/T1);##no of conduction e at T1\n", - "n2=(10**21.7)*(T2**(3/2.))*10**(-2500.*Eg/T2);##no of conduction e at T2\n", - "x=n2/n1;\n", - "print'%s %.1f %s'%('fractional change in no of e is',x,'');\n", - "print 'in book he just worte ans but he didnt calculated final ans but here is i calculated'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fractional change in no of e is 2.1 \n", - "in book he just worte ans but he didnt calculated final ans but here is i calculated\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg541" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##Example 18.5\n", - "##calculation of resistivity\n", - "\n", - "##given values\n", - "e=1.6*10**-19;\n", - "ni=2.5*10**19;##intrinsic density of carriers per m**3\n", - "ue=.39;##mobility of e \n", - "uh=.19;##mobility of hole\n", - "\n", - "\n", - "##calculation\n", - "c=e*ni*(ue+uh);##conductivity\n", - "r=1/c;##resistivity\n", - "print'%s %.2f %s'%('resistivity in ohm m is',r,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "resistivity in ohm m is 0.43 \n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg548" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 18.6\n", - "##calculation of conductivity of intrinsic and doped semiconductors\n", - "\n", - "##given values\n", - "h=4.52*10**24;##no of holes per m**3\n", - "e=1.25*10**14;##no of electrons per m**3\n", - "ue=.38;##e mobility\n", - "uh=.18;##hole mobility\n", - "q=1.6*10**-19;##charge of e in C\n", - "##calculation\n", - "ni=math.sqrt(h*e);##intrinsic concentration\n", - "ci=q*ni*(ue+uh);\n", - "print'%s %.2f %s'%('conductivity of semiconductor(in S/m) is',ci,'');\n", - "cp=q*h*uh;\n", - "print'%s %.2f %s'%('conductivity of doped semiconductor (in S/m) is',cp,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conductivity of semiconductor(in S/m) is 2.13 \n", - "conductivity of doped semiconductor (in S/m) is 130176.00 \n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg548" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 18.7\n", - "##calculation of hole concentration\n", - "\n", - "##given values\n", - "ni=2.4*10**19.;##carrier concentration per m**3\n", - "N=4*10**28.;##concentration of ge atoms per m**3\n", - "\n", - "##calculation\n", - "ND=N/10**6.;##donor cocntrtn\n", - "n=ND;##no of electrones\n", - "\n", - "p=ni**2./n;\n", - "print'%s %.3e %s'%('concentartion of holes per m^3 is',p,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "concentartion of holes per m^3 is 1.440e+16 \n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg558" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 18.8\n", - "##calculation of Hall voltage\n", - "\n", - "##given values\n", - "ND=10**21.;##donor density per m**3\n", - "B=.5;##magnetic field in T\n", - "J=500.;##current density in A/m**2\n", - "w=3*10**-3.;##width in m\n", - "e=1.6*10**-19.;##charge in C\n", - "\n", - "##calculation\n", - "\n", - "\n", - "V=B*J*w/(ND*e);##in volts\n", - "print'%s %.2f %s'%('Hall voltage in mv is',V*10**3,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hall voltage in mv is 4.69 \n" - ] - } - ], - "prompt_number": 14 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter19.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter19.ipynb deleted file mode 100755 index 9cd6b0d3..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter19.ipynb +++ /dev/null @@ -1,103 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e62a104ff81010a41974070c37970149915a1689606735dc017583e29241aaa5" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter19-PN-Junction Diode" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg571" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 19.1\n", - "##calculation of potential barrier\n", - "\n", - "##given values\n", - "e=1.6*10**-19.;\n", - "n=4.4*10**28.;##no of atoms per m**3\n", - "kT=.026*e;##temp eqvlnt at room temp\n", - "ni=2.4*10**19.;##no of intrinsic carriers per m**3\n", - "NA=n/10**6.;##no of acceptors\n", - "ND=n/10**6.;##no of donors\n", - "\n", - "##calculation\n", - "V=(kT/e)*math.log(NA*ND/ni**2);\n", - "print'%s %.2f %s'%('potential barrier in volts is',V,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "potential barrier in volts is 0.39 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg578" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 19.2\n", - "##calculation of current\n", - "\n", - "##given values\n", - "e=1.6*10**-19.;\n", - "kT=.026*e;##temp eqvlnt at room temp\n", - "Io=2*10**-7;##current flowing at room temp in A\n", - "V=.1;##forward bias voltage in volts\n", - "\n", - "##calculation\n", - "I=Io*(math.e**(e*V/kT)-1);##in Ampere\n", - "print'%s %.2f %s'%('current flowing when forward bias applied(in microampere)is',I*10**6,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current flowing when forward bias applied(in microampere)is 9.16 \n" - ] - } - ], - "prompt_number": 2 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter19_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter19_1.ipynb deleted file mode 100755 index 9cd6b0d3..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter19_1.ipynb +++ /dev/null @@ -1,103 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e62a104ff81010a41974070c37970149915a1689606735dc017583e29241aaa5" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter19-PN-Junction Diode" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg571" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 19.1\n", - "##calculation of potential barrier\n", - "\n", - "##given values\n", - "e=1.6*10**-19.;\n", - "n=4.4*10**28.;##no of atoms per m**3\n", - "kT=.026*e;##temp eqvlnt at room temp\n", - "ni=2.4*10**19.;##no of intrinsic carriers per m**3\n", - "NA=n/10**6.;##no of acceptors\n", - "ND=n/10**6.;##no of donors\n", - "\n", - "##calculation\n", - "V=(kT/e)*math.log(NA*ND/ni**2);\n", - "print'%s %.2f %s'%('potential barrier in volts is',V,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "potential barrier in volts is 0.39 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg578" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 19.2\n", - "##calculation of current\n", - "\n", - "##given values\n", - "e=1.6*10**-19.;\n", - "kT=.026*e;##temp eqvlnt at room temp\n", - "Io=2*10**-7;##current flowing at room temp in A\n", - "V=.1;##forward bias voltage in volts\n", - "\n", - "##calculation\n", - "I=Io*(math.e**(e*V/kT)-1);##in Ampere\n", - "print'%s %.2f %s'%('current flowing when forward bias applied(in microampere)is',I*10**6,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current flowing when forward bias applied(in microampere)is 9.16 \n" - ] - } - ], - "prompt_number": 2 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter21.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter21.ipynb deleted file mode 100755 index 4528f908..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter21.ipynb +++ /dev/null @@ -1,149 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:0a1f9cbfac6e4a80fe362c0012a4a307feac15a79ecc69bd2a9d9a5220fc3bbc" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter21-Magnetic Materials" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg612" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 21.1\n", - "##calculation of magnetizing force and relative permeability\n", - "\n", - "##given values\n", - "M=2300.;##magnetization in A/m\n", - "B=.00314;##flux density in Wb/m**2\n", - "u=12.57*10**-7.;##permeability in H/m\n", - "\n", - "##calculation\n", - "H=(B/u)-M;\n", - "print'%s %.2f %s'%('magnetizing force(in A/m)is ',H,'');\n", - "Ur=B/(u*H);\n", - "print'%s %.2f %s'%('relative permeability is',Ur,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnetizing force(in A/m)is 198.01 \n", - "relative permeability is 12.62 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg613" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 21.2\n", - "##calculation of magnetization and magnetic flux density\n", - "\n", - "##given values\n", - "H=10**5;##external field in A/m\n", - "X=5*10**-5;##susceptibility \n", - "u=12.57*10**-7;##permeability in H/m\n", - "\n", - "##calculation\n", - "M=X*H;\n", - "print'%s %.2f %s'%('magnetization (in A/m)is ',M,'');\n", - "B=u*(M+H);\n", - "print'%s %.2f %s'%('magnetic flux density (in wb/m^2) is',B,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnetization (in A/m)is 5.00 \n", - "magnetic flux density (in wb/m^2) is 0.13 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg615" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 21.3\n", - "##calculation of relative permeability\n", - "\n", - "##given values\n", - "\n", - "X=3.7*10**-3;##susceptibility at 300k\n", - "T=300;##temp in K\n", - "T1=200;##temp in K\n", - "T2=500;##temp in K\n", - "\n", - "##calculation\n", - "C=X*T;##curie constant\n", - "XT1=C/T1;\n", - "print'%s %.4f %s'%('relative permeability at T1 is ',XT1,'');\n", - "XT2=C/T2;\n", - "print'%s %.3f %s'%('relative permeability at T2 is',XT2,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "relative permeability at T1 is 0.0056 \n", - "relative permeability at T2 is 0.002 \n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter21_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter21_1.ipynb deleted file mode 100755 index 4528f908..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter21_1.ipynb +++ /dev/null @@ -1,149 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:0a1f9cbfac6e4a80fe362c0012a4a307feac15a79ecc69bd2a9d9a5220fc3bbc" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter21-Magnetic Materials" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg612" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 21.1\n", - "##calculation of magnetizing force and relative permeability\n", - "\n", - "##given values\n", - "M=2300.;##magnetization in A/m\n", - "B=.00314;##flux density in Wb/m**2\n", - "u=12.57*10**-7.;##permeability in H/m\n", - "\n", - "##calculation\n", - "H=(B/u)-M;\n", - "print'%s %.2f %s'%('magnetizing force(in A/m)is ',H,'');\n", - "Ur=B/(u*H);\n", - "print'%s %.2f %s'%('relative permeability is',Ur,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnetizing force(in A/m)is 198.01 \n", - "relative permeability is 12.62 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg613" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 21.2\n", - "##calculation of magnetization and magnetic flux density\n", - "\n", - "##given values\n", - "H=10**5;##external field in A/m\n", - "X=5*10**-5;##susceptibility \n", - "u=12.57*10**-7;##permeability in H/m\n", - "\n", - "##calculation\n", - "M=X*H;\n", - "print'%s %.2f %s'%('magnetization (in A/m)is ',M,'');\n", - "B=u*(M+H);\n", - "print'%s %.2f %s'%('magnetic flux density (in wb/m^2) is',B,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnetization (in A/m)is 5.00 \n", - "magnetic flux density (in wb/m^2) is 0.13 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg615" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 21.3\n", - "##calculation of relative permeability\n", - "\n", - "##given values\n", - "\n", - "X=3.7*10**-3;##susceptibility at 300k\n", - "T=300;##temp in K\n", - "T1=200;##temp in K\n", - "T2=500;##temp in K\n", - "\n", - "##calculation\n", - "C=X*T;##curie constant\n", - "XT1=C/T1;\n", - "print'%s %.4f %s'%('relative permeability at T1 is ',XT1,'');\n", - "XT2=C/T2;\n", - "print'%s %.3f %s'%('relative permeability at T2 is',XT2,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "relative permeability at T1 is 0.0056 \n", - "relative permeability at T2 is 0.002 \n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter22.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter22.ipynb deleted file mode 100755 index 86088884..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter22.ipynb +++ /dev/null @@ -1,141 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:29de63e7ef1a8622d7d2e459bd1b9274805adbb7b74a608deb83d9b4c0dd3ef4" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Chapter22-Superconductivity" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 22.1\n", - "##calculation of magnetic field\n", - "\n", - "##given values\n", - "\n", - "Tc=7.2;##transition temp in K\n", - "T=5.;##temp in K\n", - "Hc=3.3*10**4;##magnetic field at T in A/m\n", - "\n", - "\n", - "##calculation\n", - "Hc0=Hc/(1-(T**2/Tc**2));\n", - "print'%s %.2f %s'%('max value of H at 0K (in A/m) is ',Hc0,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max value of H at 0K (in A/m) is 63737.70 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 22.2\n", - "##calculation of transition temperature\n", - "\n", - "##given values\n", - "\n", - "T=8.;##temp in K\n", - "Hc=1*10**5.;##critical magnetic field at T in A/m\n", - "Hc0=2*10**5.;##magnetic field at 0 K in A/m\n", - "\n", - "##calculation\n", - "Tc=T/(math.sqrt(1.-Hc/Hc0));\n", - "print'%s %.2f %s'%('transition temp in K is',Tc,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transition temp in K is 11.31 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg647" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 22.3\n", - "##calculation of temp at which there is max critical field\n", - "\n", - "##given values\n", - "\n", - "Tc=7.26;##critical temp in K\n", - "Hc=8*10**5.;##max critical magnetic field at T in A/m\n", - "H=4*10**4.;## subjected magnetic field at in A/m\n", - "\n", - "##calculation\n", - "T=Tc*(math.sqrt(1.-H/Hc));\n", - "print'%s %.2f %s'%('max temp for superconductivity in K is',T,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max temp for superconductivity in K is 7.08 \n" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter22_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter22_1.ipynb deleted file mode 100755 index 15083682..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter22_1.ipynb +++ /dev/null @@ -1,141 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:ab6a6bb45b4cdef5c73ac14b797742c1b4b21056356723e765f29cef6d5d7ccd" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter22-Superconductivity" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 22.1\n", - "##calculation of magnetic field\n", - "\n", - "##given values\n", - "\n", - "Tc=7.2;##transition temp in K\n", - "T=5.;##temp in K\n", - "Hc=3.3*10**4;##magnetic field at T in A/m\n", - "\n", - "\n", - "##calculation\n", - "Hc0=Hc/(1-(T**2/Tc**2));\n", - "print'%s %.2f %s'%('max value of H at 0K (in A/m) is ',Hc0,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max value of H at 0K (in A/m) is 63737.70 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 22.2\n", - "##calculation of transition temperature\n", - "\n", - "##given values\n", - "\n", - "T=8.;##temp in K\n", - "Hc=1*10**5.;##critical magnetic field at T in A/m\n", - "Hc0=2*10**5.;##magnetic field at 0 K in A/m\n", - "\n", - "##calculation\n", - "Tc=T/(math.sqrt(1.-Hc/Hc0));\n", - "print'%s %.2f %s'%('transition temp in K is',Tc,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transition temp in K is 11.31 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg647" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 22.3\n", - "##calculation of temp at which there is max critical field\n", - "\n", - "##given values\n", - "\n", - "Tc=7.26;##critical temp in K\n", - "Hc=8*10**5.;##max critical magnetic field at T in A/m\n", - "H=4*10**4.;## subjected magnetic field at in A/m\n", - "\n", - "##calculation\n", - "T=Tc*(math.sqrt(1.-H/Hc));\n", - "print'%s %.2f %s'%('max temp for superconductivity in K is',T,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max temp for superconductivity in K is 7.08 \n" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter23.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter23.ipynb deleted file mode 100755 index d7f5b70f..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter23.ipynb +++ /dev/null @@ -1,311 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:4021239986e9b103686ab01f7ccbdc5317b1bf2aa2e09bf052e63053a477f649" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter23-Dielectrics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.1\n", - "##calculation of relative permittivity\n", - "\n", - "##given values\n", - "\n", - "E=1000.;##electric field in V/m\n", - "P=4.3*10**-8;##polarization in C/m**2\n", - "e=8.85*10**-12;##permittivity in F/m\n", - "\n", - "\n", - "##calculation\n", - "er=1.+(P/(e*E));\n", - "print'%s %.2f %s'%('relative permittivity of NaCl is ',er,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "relative permittivity of NaCl is 5.86 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg675" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.2\n", - "##calculation of electronic polarizability\n", - "\n", - "##given values\n", - "\n", - "e=8.85*10**-12;##permittivity in F/m\n", - "er=1.0024;##relative permittivity at NTP\n", - "N=2.7*10**25.;##atoms per m**3\n", - "\n", - "\n", - "##calculation\n", - "alpha=e*(er-1)/N;\n", - "print'%s %.3e %s'%('electronic polarizability (in F/m^2)is ',alpha,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "electronic polarizability (in F/m^2)is 7.867e-40 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg678" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.3\n", - "##calculation of electronic polarizability and relative permittivity\n", - "\n", - "##given values\n", - "\n", - "e=8.85*10**-12.;##permittivity in F/m\n", - "N=9.8*10**26.;##atoms per m**3\n", - "r=.53*10**-10.;##radius in m\n", - "\n", - "\n", - "##calculation\n", - "alpha=4*math.pi*e*r**3;\n", - "print'%s %.3e %s'%('electronic polarizability (in F/m**2)is ',alpha,'');\n", - "er=1+(4*math.pi*N*r**3);\n", - "print'%s %.2f %s'%('relative permittivity is',er,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "electronic polarizability (in F/m**2)is 1.656e-41 \n", - "relative permittivity is 1.00 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg681" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.4\n", - "##calculation of electronic polarizability and relative permittivity\n", - "\n", - "##given values\n", - "w=32.;##atomic weight of sulphur \n", - "d=2.08*10**3.;##density in kg/m**3\n", - "NA=6.02*10**26.;##avogadros number\n", - "alpha=3.28*10**-40.;##electronic polarizability in F.m**2\n", - "e=8.854*10**-12.;##permittiviy\n", - "##calculation\n", - "\n", - "n=NA*d/w;\n", - "k=n*alpha/(3.*e);\n", - "er=(1+2*k)/(1.-k);\n", - "print'%s %.2f %s'%('relative permittivity is',er,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "relative permittivity is 3.80 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg682" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.5\n", - "##calculation of ionic polarizability\n", - "\n", - "##given values\n", - "n=1.5;##refractive index\n", - "er=6.75;##relative permittivity\n", - "\n", - "##calculation\n", - "Pi=(er-n**2.)*100./(er-1.);\n", - "print'%s %.2f %s'%('percentage ionic polarizability (in %)) is',Pi,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "percentage ionic polarizability (in %)) is 78.26 \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg685" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.6\n", - "##calculation of frequency and phase difference\n", - "\n", - "##given values\n", - "t=18*10**-6;##relaxation time in s\n", - "\n", - "##calculation\n", - "f=1/(2*math.pi*t);\n", - "print'%s %.2f %s'%('frequency at which real and imaginary part of complx dielectric constant are equal is',f,'');\n", - "alpha=math.atan(1)*180/math.pi;## phase difference between current and voltage( 1 because real and imaginry parts are equal of the dielectric constant)\n", - "print'%s %.2f %s'%('phase diffeerence (in degree) is',alpha,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "frequency at which real and imaginary part of complx dielectric constant are equal is 8841.94 \n", - "phase diffeerence (in degree) is 45.00 " - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg692" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.7\n", - "##calculation of frequency\n", - "\n", - "##given values\n", - "t=5.5*10**-3.;##thickness of plate in m\n", - "Y=8*10**10.;##Young's modulus in N/m**2\n", - "d=2.65*10**3.;##density in kg/m**3\n", - "\n", - "\n", - "\n", - "##calculation\n", - "f=math.sqrt(Y/d)/(2.*t);##in Hz\n", - "print'%s %.2f %s'%('frequency of fundamental note(in KHz) is',f/10**3,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "frequency of fundamental note(in KHz) is 499.49 \n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter23_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter23_1.ipynb deleted file mode 100755 index d7f5b70f..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter23_1.ipynb +++ /dev/null @@ -1,311 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:4021239986e9b103686ab01f7ccbdc5317b1bf2aa2e09bf052e63053a477f649" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter23-Dielectrics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.1\n", - "##calculation of relative permittivity\n", - "\n", - "##given values\n", - "\n", - "E=1000.;##electric field in V/m\n", - "P=4.3*10**-8;##polarization in C/m**2\n", - "e=8.85*10**-12;##permittivity in F/m\n", - "\n", - "\n", - "##calculation\n", - "er=1.+(P/(e*E));\n", - "print'%s %.2f %s'%('relative permittivity of NaCl is ',er,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "relative permittivity of NaCl is 5.86 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg675" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.2\n", - "##calculation of electronic polarizability\n", - "\n", - "##given values\n", - "\n", - "e=8.85*10**-12;##permittivity in F/m\n", - "er=1.0024;##relative permittivity at NTP\n", - "N=2.7*10**25.;##atoms per m**3\n", - "\n", - "\n", - "##calculation\n", - "alpha=e*(er-1)/N;\n", - "print'%s %.3e %s'%('electronic polarizability (in F/m^2)is ',alpha,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "electronic polarizability (in F/m^2)is 7.867e-40 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg678" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.3\n", - "##calculation of electronic polarizability and relative permittivity\n", - "\n", - "##given values\n", - "\n", - "e=8.85*10**-12.;##permittivity in F/m\n", - "N=9.8*10**26.;##atoms per m**3\n", - "r=.53*10**-10.;##radius in m\n", - "\n", - "\n", - "##calculation\n", - "alpha=4*math.pi*e*r**3;\n", - "print'%s %.3e %s'%('electronic polarizability (in F/m**2)is ',alpha,'');\n", - "er=1+(4*math.pi*N*r**3);\n", - "print'%s %.2f %s'%('relative permittivity is',er,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "electronic polarizability (in F/m**2)is 1.656e-41 \n", - "relative permittivity is 1.00 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg681" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.4\n", - "##calculation of electronic polarizability and relative permittivity\n", - "\n", - "##given values\n", - "w=32.;##atomic weight of sulphur \n", - "d=2.08*10**3.;##density in kg/m**3\n", - "NA=6.02*10**26.;##avogadros number\n", - "alpha=3.28*10**-40.;##electronic polarizability in F.m**2\n", - "e=8.854*10**-12.;##permittiviy\n", - "##calculation\n", - "\n", - "n=NA*d/w;\n", - "k=n*alpha/(3.*e);\n", - "er=(1+2*k)/(1.-k);\n", - "print'%s %.2f %s'%('relative permittivity is',er,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "relative permittivity is 3.80 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg682" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.5\n", - "##calculation of ionic polarizability\n", - "\n", - "##given values\n", - "n=1.5;##refractive index\n", - "er=6.75;##relative permittivity\n", - "\n", - "##calculation\n", - "Pi=(er-n**2.)*100./(er-1.);\n", - "print'%s %.2f %s'%('percentage ionic polarizability (in %)) is',Pi,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "percentage ionic polarizability (in %)) is 78.26 \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg685" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.6\n", - "##calculation of frequency and phase difference\n", - "\n", - "##given values\n", - "t=18*10**-6;##relaxation time in s\n", - "\n", - "##calculation\n", - "f=1/(2*math.pi*t);\n", - "print'%s %.2f %s'%('frequency at which real and imaginary part of complx dielectric constant are equal is',f,'');\n", - "alpha=math.atan(1)*180/math.pi;## phase difference between current and voltage( 1 because real and imaginry parts are equal of the dielectric constant)\n", - "print'%s %.2f %s'%('phase diffeerence (in degree) is',alpha,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "frequency at which real and imaginary part of complx dielectric constant are equal is 8841.94 \n", - "phase diffeerence (in degree) is 45.00 " - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg692" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 23.7\n", - "##calculation of frequency\n", - "\n", - "##given values\n", - "t=5.5*10**-3.;##thickness of plate in m\n", - "Y=8*10**10.;##Young's modulus in N/m**2\n", - "d=2.65*10**3.;##density in kg/m**3\n", - "\n", - "\n", - "\n", - "##calculation\n", - "f=math.sqrt(Y/d)/(2.*t);##in Hz\n", - "print'%s %.2f %s'%('frequency of fundamental note(in KHz) is',f/10**3,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "frequency of fundamental note(in KHz) is 499.49 \n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter24.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter24.ipynb deleted file mode 100755 index 67066c07..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter24.ipynb +++ /dev/null @@ -1,312 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:1cf24b70876a8aeb6aa008651e71d8cde215c5cbb4fe65495bcd461a3cc2b49b" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter24-Fibre Optics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg701" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.1\n", - "##Fiber optics\n", - "\n", - "##given values\n", - "n=1.5;##refractive index\n", - "x=.0005;##fractional index difference\n", - "\n", - "##calculation\n", - "u=n*(1-x);\n", - "print'%s %.2f %s'%('cladding index is',u,'');\n", - "alpha=math.asin(u/n)*180/math.pi;\n", - "print'%s %.2f %s'%('critical internal reflection angle(in degree) is',alpha,'');\n", - "theta=math.asin(math.sqrt(n**2-u**2))*180/math.pi;\n", - "print'%s %.2f %s'%('critical acceptance angle(in degree) is',theta,'');\n", - "N=n*math.sqrt(2.*x);\n", - "print'%s %.2f %s'%('numerical aperture is',N,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "cladding index is 1.50 \n", - "critical internal reflection angle(in degree) is 88.19 \n", - "critical acceptance angle(in degree) is 2.72 \n", - "numerical aperture is 0.05 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg701" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.2\n", - "##calculation of acceptance angle\n", - "\n", - "##given values\n", - "n=1.59;##cladding refractive index\n", - "u=1.33;##refractive index of water\n", - "N=.20;##numerical aperture offibre\n", - "##calculation\n", - "x=math.sqrt(N**2+n**2.);##index of fibre\n", - "N1=math.sqrt(x**2-n**2.)/u;##numerical aperture when fibre is in water\n", - "alpha=math.asin(N1)*180./math.pi;\n", - "print'%s %.2f %s'%('acceptance angle in degree is',alpha,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "acceptance angle in degree is 8.65 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg705" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.3\n", - "##calculation of normalised frequency\n", - "\n", - "##given values\n", - "n=1.45;##core refractive index\n", - "d=.6;##core diametre in m\n", - "N=.16;##numerical aperture of fibre\n", - "l=.9*10**-6.;##wavelength of light\n", - "\n", - "##calculation\n", - "u=math.sqrt(n**2.+N**2.);##index of glass fibre\n", - "V=math.pi*d*math.sqrt(u**2.-n**2.)/l;\n", - "print'%s %.2f %s'%('normalised frequency is',V,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "normalised frequency is 335103.22 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg705" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.4\n", - "##calculation of normailsed frequency and no of modes\n", - "\n", - "##given values\n", - "n=1.52;##core refractive index\n", - "d=29*10**-6.;##core diametre in m\n", - "l=1.3*10**-6.;##wavelength of light\n", - "x=.0007;##fractional refractive index\n", - "\n", - "##calculation\n", - "u=n*(1.-x);##index of glass fibre\n", - "V=math.pi*d*math.sqrt(n**2-u**2)/l;\n", - "print'%s %.2f %s'%('normalised frequency is',V,'');\n", - "N=V**2./2.;\n", - "print'%s %.2f %s'%('no of modes is',N,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "normalised frequency is 3.99 \n", - "no of modes is 7.94 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg706" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.5\n", - "##calculation of numerical aperture and maximum acceptance angle\n", - "\n", - "##given values\n", - "n=1.480;##core refractive index\n", - "u=1.47;##index of glass\n", - "l=850*10**-9.;##wavelength of light\n", - "V=2.405;##V-number\n", - "\n", - "##calculation\n", - "r=V*l/math.sqrt(n**2-u**2)/math.pi/2;##in m\n", - "print'%s %.2f %s'%('core radius in micrometre is',r*10**6,'');\n", - "N=math.sqrt(n**2-u**2);\n", - "print'%s %.2f %s'%('numerical aperture is',N,'');\n", - "alpha=math.asin(N)*180/math.pi;\n", - "print'%s %.2f %s'%('max acceptance angle is',alpha,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "core radius in micrometre is 1.89 \n", - "numerical aperture is 0.17 \n", - "max acceptance angle is 9.89 \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg712" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.6\n", - "##calculation of power level\n", - "\n", - "##given values\n", - "a=3.5;##attenuation in dB/km\n", - "Pi=.5*10**-3.;##initial power level in W\n", - "l=4.;##length of cable in km\n", - "\n", - "##calculation\n", - "Po=Pi*10**6./(10**(a*l/10.));\n", - "print'%s %.2f %s'%('power level after km(in microwatt) is',Po,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power level after km(in microwatt) is 19.91 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg712" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.7\n", - "##calculation of power loss\n", - "\n", - "##given values\n", - "Pi=1*10**-3.;##initial power level in W\n", - "l=.5;##length of cable in km\n", - "Po=.85*Pi\n", - "\n", - "##calculation\n", - "a=(10./l)*math.log10(Pi/Po);\n", - "print'%s %.2f %s'%('loss in dB/km is',a,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "loss in dB/km is 1.41 \n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter24_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter24_1.ipynb deleted file mode 100755 index 67066c07..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter24_1.ipynb +++ /dev/null @@ -1,312 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:1cf24b70876a8aeb6aa008651e71d8cde215c5cbb4fe65495bcd461a3cc2b49b" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter24-Fibre Optics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg701" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.1\n", - "##Fiber optics\n", - "\n", - "##given values\n", - "n=1.5;##refractive index\n", - "x=.0005;##fractional index difference\n", - "\n", - "##calculation\n", - "u=n*(1-x);\n", - "print'%s %.2f %s'%('cladding index is',u,'');\n", - "alpha=math.asin(u/n)*180/math.pi;\n", - "print'%s %.2f %s'%('critical internal reflection angle(in degree) is',alpha,'');\n", - "theta=math.asin(math.sqrt(n**2-u**2))*180/math.pi;\n", - "print'%s %.2f %s'%('critical acceptance angle(in degree) is',theta,'');\n", - "N=n*math.sqrt(2.*x);\n", - "print'%s %.2f %s'%('numerical aperture is',N,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "cladding index is 1.50 \n", - "critical internal reflection angle(in degree) is 88.19 \n", - "critical acceptance angle(in degree) is 2.72 \n", - "numerical aperture is 0.05 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg701" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.2\n", - "##calculation of acceptance angle\n", - "\n", - "##given values\n", - "n=1.59;##cladding refractive index\n", - "u=1.33;##refractive index of water\n", - "N=.20;##numerical aperture offibre\n", - "##calculation\n", - "x=math.sqrt(N**2+n**2.);##index of fibre\n", - "N1=math.sqrt(x**2-n**2.)/u;##numerical aperture when fibre is in water\n", - "alpha=math.asin(N1)*180./math.pi;\n", - "print'%s %.2f %s'%('acceptance angle in degree is',alpha,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "acceptance angle in degree is 8.65 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg705" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.3\n", - "##calculation of normalised frequency\n", - "\n", - "##given values\n", - "n=1.45;##core refractive index\n", - "d=.6;##core diametre in m\n", - "N=.16;##numerical aperture of fibre\n", - "l=.9*10**-6.;##wavelength of light\n", - "\n", - "##calculation\n", - "u=math.sqrt(n**2.+N**2.);##index of glass fibre\n", - "V=math.pi*d*math.sqrt(u**2.-n**2.)/l;\n", - "print'%s %.2f %s'%('normalised frequency is',V,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "normalised frequency is 335103.22 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg705" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.4\n", - "##calculation of normailsed frequency and no of modes\n", - "\n", - "##given values\n", - "n=1.52;##core refractive index\n", - "d=29*10**-6.;##core diametre in m\n", - "l=1.3*10**-6.;##wavelength of light\n", - "x=.0007;##fractional refractive index\n", - "\n", - "##calculation\n", - "u=n*(1.-x);##index of glass fibre\n", - "V=math.pi*d*math.sqrt(n**2-u**2)/l;\n", - "print'%s %.2f %s'%('normalised frequency is',V,'');\n", - "N=V**2./2.;\n", - "print'%s %.2f %s'%('no of modes is',N,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "normalised frequency is 3.99 \n", - "no of modes is 7.94 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg706" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.5\n", - "##calculation of numerical aperture and maximum acceptance angle\n", - "\n", - "##given values\n", - "n=1.480;##core refractive index\n", - "u=1.47;##index of glass\n", - "l=850*10**-9.;##wavelength of light\n", - "V=2.405;##V-number\n", - "\n", - "##calculation\n", - "r=V*l/math.sqrt(n**2-u**2)/math.pi/2;##in m\n", - "print'%s %.2f %s'%('core radius in micrometre is',r*10**6,'');\n", - "N=math.sqrt(n**2-u**2);\n", - "print'%s %.2f %s'%('numerical aperture is',N,'');\n", - "alpha=math.asin(N)*180/math.pi;\n", - "print'%s %.2f %s'%('max acceptance angle is',alpha,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "core radius in micrometre is 1.89 \n", - "numerical aperture is 0.17 \n", - "max acceptance angle is 9.89 \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg712" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.6\n", - "##calculation of power level\n", - "\n", - "##given values\n", - "a=3.5;##attenuation in dB/km\n", - "Pi=.5*10**-3.;##initial power level in W\n", - "l=4.;##length of cable in km\n", - "\n", - "##calculation\n", - "Po=Pi*10**6./(10**(a*l/10.));\n", - "print'%s %.2f %s'%('power level after km(in microwatt) is',Po,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power level after km(in microwatt) is 19.91 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg712" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 24.7\n", - "##calculation of power loss\n", - "\n", - "##given values\n", - "Pi=1*10**-3.;##initial power level in W\n", - "l=.5;##length of cable in km\n", - "Po=.85*Pi\n", - "\n", - "##calculation\n", - "a=(10./l)*math.log10(Pi/Po);\n", - "print'%s %.2f %s'%('loss in dB/km is',a,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "loss in dB/km is 1.41 \n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter4.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter4.ipynb deleted file mode 100755 index 024db2ff..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter4.ipynb +++ /dev/null @@ -1,314 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:5cdc0313c39e461d83bef4f404708f38e979d4c9312a95284be2bd9b855678fb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter4-Electron Ballistics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##Example 4.1\n", - "##Calculation of acceleration,time taken,distance covered and kinetic energy of an accelerating proton\n", - "\n", - "##given values\n", - "m=1.67 *10**-27;##mass of proton in kg\n", - "q=1.602 *10**-19;##charge of proton in Coulomb\n", - "v1=0;##initial velocity in m/s\n", - "v2=2.5*10**6;##final velocity in m/s\n", - "E=500.;##electric field strength in V/m\n", - "##calculation\n", - "a=E*q/m;##acceleration\n", - "print'%s %.1f %s'%('acceleration of proton in (m/s^2) is:',a,'');\n", - "t=v2/a;##time\n", - "print'%s %.5f %s'%('time(in s) taken by proton to reach the final velocity is:',t,'');\n", - "x=a*t**2./2.;##distance\n", - "print'%s %.1f %s'%('distance (in m)covered by proton in this time is:',x,'');\n", - "KE=E*q*x;##kinetic energy\n", - "print'%s %.3e %s'%('kinetic energy(in J) at the time is:',KE,'');\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "acceleration of proton in (m/s^2) is: 47964071856.3 \n", - "time(in s) taken by proton to reach the final velocity is: 0.00005 \n", - "distance (in m)covered by proton in this time is: 65.2 \n", - "kinetic energy(in J) at the time is: 5.219e-15 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 4.2\n", - "##electrostatic deflection\n", - "##given values\n", - "pi=3.141\n", - "V1=2000.;##in volts,potential difference through which electron beam is accelerated\n", - "l=.04;##length of rectangular plates\n", - "d=.015;##distance between plates\n", - "V=50.;##potential difference between plates\n", - "##calculations\n", - "alpha=math.atan(l*V/(2.*d*V1))*(180./pi);##in degrees\n", - "print'%s %.1f %s'%('angle of deflection of electron beam is:',alpha,'')\n", - "v=5.93*(10**5)*math.sqrt(V1);##horizontal velocity in m/s\n", - "t=l/v;##in s\n", - "print'%s %.3e %s'%('transit time through electric field is:',t,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "angle of deflection of electron beam is: 1.9 \n", - "transit time through electric field is: 1.508e-09 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 4.3\n", - "##electron projected at an angle into a uniform electric field\n", - "##given values\n", - "v1=4.5*10**5;##initial speed in m/s\n", - "alpha=37*math.pi/180.;##angle of projection in degrees\n", - "E=200.;##electric field intensity in N/C\n", - "e=1.6*10**-19;##in C\n", - "m=9.1*10**-31;##in kg\n", - "a=e*E/m;##acceleration in m/s**2\n", - "t=2*v1*math.sin(alpha)/a;##time in s\n", - "print'%s %.2e %s'%('time taken by electron to return to its initial level is:',t,'')\n", - "H=(v1**2.*math.sin(alpha)*math.sin(alpha))/(2.*a);##height in m\n", - "print'%s %.4f %s'%('maximum height reached by electron is:',H,'')\n", - "s=(v1**2.)*(2.*math.sin(alpha)*math.cos(alpha))/(2.*a);##print'%s %.1f %s'%lacement in m\n", - "print'%s %.4f %s'%('horizontal displacement(in m)when it reaches maximum height is:',s,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time taken by electron to return to its initial level is: 1.54e-08 \n", - "maximum height reached by electron is: 0.0010 \n", - "horizontal displacement(in m)when it reaches maximum height is: 0.0028 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg53" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 4.4\n", - "##motion of an electron in a uniform magnetic field\n", - "##given values\n", - "V=200.;##potential difference through which electron is accelerated in volts\n", - "B=0.01;##magnetic field in wb/m**2\n", - "e=1.6*10**-19;##in C\n", - "m=9.1*10**-31;##in kg\n", - "v=math.sqrt(2.*e*V/m);##electron velocity in m/s\n", - "print'%s %.1f %s'%('electron velocity is:',v,'')\n", - "r=m*v/(e*B);##in m\n", - "print'%s %.4f %s'%('radius of path (in m)is:',r,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "electron velocity is: 8386278.7 \n", - "radius of path (in m)is: 0.0048 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg54" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 4.5\n", - "##motion of an electron in a uniform magnetic field acting at an angle\n", - "##given values\n", - "v=3*10**7;##electron speed\n", - "B=.23;##magnetic field in wb/m**2\n", - "q=45*math.pi/180;##in degrees,angle in which electron enter field\n", - "e=1.6*10**-19;##in C\n", - "m=9.1*10**-31;##in kg\n", - "R=m*v*math.sin(q)/(e*B);##in m\n", - "print'%s %.5f %s'%('radius of helical path is:',R,'')\n", - "p=2*math.pi*m*v*math.cos(q)/(e*B);##in m\n", - "print'%s %.4f %s'%('pitch of helical path(in m) is:',p,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "radius of helical path is: 0.00052 \n", - "pitch of helical path(in m) is: 0.0033 \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg55" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 4.6\n", - "##Magnetostatic deflection\n", - "##given values\n", - "D=.03;##deflection in m\n", - "m=9.1*10**-31;##in kg\n", - "e=1.6*10**-19;##in C\n", - "L=.15;##distance between CRT and anode in m\n", - "l=L/2.;\n", - "V=2000.;##in voltsin wb/\n", - "B=D*math.sqrt(2.*m*V)/(L*l*math.sqrt(e));##in wb/m**2\n", - "print'%s %.4f %s'%('transverse magnetic field acting (in wb/m^2)is:',B,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transverse magnetic field acting (in wb/m^2)is: 0.0004 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg57" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 4.7\n", - "##electric and magnetic fields in crossed configuration\n", - "##given values\n", - "B=2*10**-3;##magnetic field in wb/m**2\n", - "E=3.4*10**4;##electric field in V/m\n", - "m=9.1*10**-31;##in kg\n", - "e=1.6*10**-19;##in C\n", - "v=E/B;##in m/s\n", - "print'%s %.1f %s'%('electron speed is:',v,'')\n", - "R=m*v/(e*B);##in m\n", - "print'%s %.3f %s'%('radius of circular path (in m) when electric field is switched off',R,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "electron speed is: 17000000.0 \n", - "radius of circular path (in m) when electric field is switched off 0.048 \n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter4_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter4_1.ipynb deleted file mode 100755 index 024db2ff..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter4_1.ipynb +++ /dev/null @@ -1,314 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:5cdc0313c39e461d83bef4f404708f38e979d4c9312a95284be2bd9b855678fb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter4-Electron Ballistics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##Example 4.1\n", - "##Calculation of acceleration,time taken,distance covered and kinetic energy of an accelerating proton\n", - "\n", - "##given values\n", - "m=1.67 *10**-27;##mass of proton in kg\n", - "q=1.602 *10**-19;##charge of proton in Coulomb\n", - "v1=0;##initial velocity in m/s\n", - "v2=2.5*10**6;##final velocity in m/s\n", - "E=500.;##electric field strength in V/m\n", - "##calculation\n", - "a=E*q/m;##acceleration\n", - "print'%s %.1f %s'%('acceleration of proton in (m/s^2) is:',a,'');\n", - "t=v2/a;##time\n", - "print'%s %.5f %s'%('time(in s) taken by proton to reach the final velocity is:',t,'');\n", - "x=a*t**2./2.;##distance\n", - "print'%s %.1f %s'%('distance (in m)covered by proton in this time is:',x,'');\n", - "KE=E*q*x;##kinetic energy\n", - "print'%s %.3e %s'%('kinetic energy(in J) at the time is:',KE,'');\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "acceleration of proton in (m/s^2) is: 47964071856.3 \n", - "time(in s) taken by proton to reach the final velocity is: 0.00005 \n", - "distance (in m)covered by proton in this time is: 65.2 \n", - "kinetic energy(in J) at the time is: 5.219e-15 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 4.2\n", - "##electrostatic deflection\n", - "##given values\n", - "pi=3.141\n", - "V1=2000.;##in volts,potential difference through which electron beam is accelerated\n", - "l=.04;##length of rectangular plates\n", - "d=.015;##distance between plates\n", - "V=50.;##potential difference between plates\n", - "##calculations\n", - "alpha=math.atan(l*V/(2.*d*V1))*(180./pi);##in degrees\n", - "print'%s %.1f %s'%('angle of deflection of electron beam is:',alpha,'')\n", - "v=5.93*(10**5)*math.sqrt(V1);##horizontal velocity in m/s\n", - "t=l/v;##in s\n", - "print'%s %.3e %s'%('transit time through electric field is:',t,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "angle of deflection of electron beam is: 1.9 \n", - "transit time through electric field is: 1.508e-09 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 4.3\n", - "##electron projected at an angle into a uniform electric field\n", - "##given values\n", - "v1=4.5*10**5;##initial speed in m/s\n", - "alpha=37*math.pi/180.;##angle of projection in degrees\n", - "E=200.;##electric field intensity in N/C\n", - "e=1.6*10**-19;##in C\n", - "m=9.1*10**-31;##in kg\n", - "a=e*E/m;##acceleration in m/s**2\n", - "t=2*v1*math.sin(alpha)/a;##time in s\n", - "print'%s %.2e %s'%('time taken by electron to return to its initial level is:',t,'')\n", - "H=(v1**2.*math.sin(alpha)*math.sin(alpha))/(2.*a);##height in m\n", - "print'%s %.4f %s'%('maximum height reached by electron is:',H,'')\n", - "s=(v1**2.)*(2.*math.sin(alpha)*math.cos(alpha))/(2.*a);##print'%s %.1f %s'%lacement in m\n", - "print'%s %.4f %s'%('horizontal displacement(in m)when it reaches maximum height is:',s,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time taken by electron to return to its initial level is: 1.54e-08 \n", - "maximum height reached by electron is: 0.0010 \n", - "horizontal displacement(in m)when it reaches maximum height is: 0.0028 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg53" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 4.4\n", - "##motion of an electron in a uniform magnetic field\n", - "##given values\n", - "V=200.;##potential difference through which electron is accelerated in volts\n", - "B=0.01;##magnetic field in wb/m**2\n", - "e=1.6*10**-19;##in C\n", - "m=9.1*10**-31;##in kg\n", - "v=math.sqrt(2.*e*V/m);##electron velocity in m/s\n", - "print'%s %.1f %s'%('electron velocity is:',v,'')\n", - "r=m*v/(e*B);##in m\n", - "print'%s %.4f %s'%('radius of path (in m)is:',r,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "electron velocity is: 8386278.7 \n", - "radius of path (in m)is: 0.0048 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg54" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 4.5\n", - "##motion of an electron in a uniform magnetic field acting at an angle\n", - "##given values\n", - "v=3*10**7;##electron speed\n", - "B=.23;##magnetic field in wb/m**2\n", - "q=45*math.pi/180;##in degrees,angle in which electron enter field\n", - "e=1.6*10**-19;##in C\n", - "m=9.1*10**-31;##in kg\n", - "R=m*v*math.sin(q)/(e*B);##in m\n", - "print'%s %.5f %s'%('radius of helical path is:',R,'')\n", - "p=2*math.pi*m*v*math.cos(q)/(e*B);##in m\n", - "print'%s %.4f %s'%('pitch of helical path(in m) is:',p,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "radius of helical path is: 0.00052 \n", - "pitch of helical path(in m) is: 0.0033 \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg55" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 4.6\n", - "##Magnetostatic deflection\n", - "##given values\n", - "D=.03;##deflection in m\n", - "m=9.1*10**-31;##in kg\n", - "e=1.6*10**-19;##in C\n", - "L=.15;##distance between CRT and anode in m\n", - "l=L/2.;\n", - "V=2000.;##in voltsin wb/\n", - "B=D*math.sqrt(2.*m*V)/(L*l*math.sqrt(e));##in wb/m**2\n", - "print'%s %.4f %s'%('transverse magnetic field acting (in wb/m^2)is:',B,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transverse magnetic field acting (in wb/m^2)is: 0.0004 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg57" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 4.7\n", - "##electric and magnetic fields in crossed configuration\n", - "##given values\n", - "B=2*10**-3;##magnetic field in wb/m**2\n", - "E=3.4*10**4;##electric field in V/m\n", - "m=9.1*10**-31;##in kg\n", - "e=1.6*10**-19;##in C\n", - "v=E/B;##in m/s\n", - "print'%s %.1f %s'%('electron speed is:',v,'')\n", - "R=m*v/(e*B);##in m\n", - "print'%s %.3f %s'%('radius of circular path (in m) when electric field is switched off',R,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "electron speed is: 17000000.0 \n", - "radius of circular path (in m) when electric field is switched off 0.048 \n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter5.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter5.ipynb deleted file mode 100755 index f25c1843..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter5.ipynb +++ /dev/null @@ -1,147 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:b45bed0bf651f557c40cec41e1736def1e279410a176004acdb12e68c84f8fd8" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Chapter5Electron Oprtics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg 72" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 5.1\n", - "##Electron refraction, calculation of potential difference\n", - "\n", - "##given values\n", - "V1=250.;##potential by which electrons are accelerated in Volts\n", - "alpha1=50*math.pi/180.;##in degree\n", - "alpha2=30*math.pi/180.;##in degree\n", - "b=math.sin(alpha1)/math.sin(alpha2);\n", - "##calculation\n", - "V2=(b**2.)*V1;\n", - "a=V2-V1;\n", - "print'%s %.1f %s'%('potential difference(in volts) is:',a,'');\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "potential difference(in volts) is: 336.8 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2 $3-pg94" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##Example 5.2&5.3\n", - "import math\n", - "##Cyclotron, calculation of magnetic induction,maximum energy\n", - "##given values\n", - "f=12*(10**6);##oscillator frequency in Hertz\n", - "r=.53;##radius of the dee in metre\n", - "q=1.6*10**-19;##Deuteron charge in C\n", - "m=3.34*10**-27;##mass of deuteron in kg\n", - "##calculation\n", - "B=2*math.pi*f*m/q;##\n", - "print'%s %.1f %s'%('magnetic induction (in Tesla) is:',B,'');\n", - "E=B**2*q**2.*r**2./(2.*m);\n", - "print'%s %.3e %s'%('maximum energy to which deuterons can be accelerated (in J) is',E,'')\n", - "E1=E*6.24*10**18/10**6;##conversion of energy into MeV\n", - "print'%s %.1f %s'%('maximum energy to which deuterons can be accelerated (in MeV) is',E1,'');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnetic induction (in Tesla) is: 1.6 \n", - "maximum energy to which deuterons can be accelerated (in J) is 2.667e-12 \n", - "maximum energy to which deuterons can be accelerated (in MeV) is 16.6 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg99" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 5.4\n", - "##Mass spectrograph, calculation of linear separation of lines formed on photographic plates\n", - "\n", - "##given values;\n", - "E=8.*10**4;##electric field in V/m\n", - "B=.55##magnetic induction in Wb/m*2\n", - "q=1.6*10**-19;##charge of ions\n", - "m1=20.*1.67*10**-27;##atomic mass of an isotope of neon\n", - "m2=22.*1.67*10**-27;##atomic mass of other isotope of neon\n", - "##calculation\n", - "x=2*E*(m2-m1)/(q*B**2);##\n", - "print'%s %.3f %s'%('separation of lines (in metre) is:',x,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "separation of lines (in metre) is: 0.011 \n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter5_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter5_1.ipynb deleted file mode 100755 index f4389219..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter5_1.ipynb +++ /dev/null @@ -1,185 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:550f2c4f76d815d509a9a81031b8891ad0f830da6727cb50a9ec9ad3c5c39d1e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter5 Electron Oprtics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg 72" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 5.1\n", - "##Electron refraction, calculation of potential difference\n", - "\n", - "##given values\n", - "V1=250.;##potential by which electrons are accelerated in Volts\n", - "alpha1=50*math.pi/180.;##in degree\n", - "alpha2=30*math.pi/180.;##in degree\n", - "b=math.sin(alpha1)/math.sin(alpha2);\n", - "##calculation\n", - "V2=(b**2.)*V1;\n", - "a=V2-V1;\n", - "print'%s %.1f %s'%('potential difference(in volts) is:',a,'');\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "potential difference(in volts) is: 336.8 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2 -pg94" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##Example 5.2&5.3\n", - "import math\n", - "##Cyclotron, calculation of magnetic induction,maximum energy\n", - "##given values\n", - "f=12*(10**6);##oscillator frequency in Hertz\n", - "r=.53;##radius of the dee in metre\n", - "q=1.6*10**-19;##Deuteron charge in C\n", - "m=3.34*10**-27;##mass of deuteron in kg\n", - "##calculation\n", - "B=2*math.pi*f*m/q;##\n", - "print'%s %.2f %s'%('magnetic induction (in Tesla) is:',B,'');\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnetic induction (in Tesla) is: 1.57 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg94" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Cyclotron, calculation of magnetic induction,maximum energy\n", - "##given values\n", - "f=12.*(10**6);##oscillator frequency in Hertz\n", - "r=.53;##radius of the dee in metre\n", - "q=1.6*10**-19;##Deuteron charge in C\n", - "m=3.34*10**-27;##mass of deuteron in kg\n", - "##calculation\n", - "B=2*math.pi*f*m/q;##\n", - "\n", - "E=B**2*q**2.*r**2./(2.*m);\n", - "print'%s %.2e %s'%('maximum energy to which deuterons can be accelerated (in J) is',E,'')\n", - "E1=E*6.24*10**18/10**6.;##conversion of energy into MeV\n", - "print'%s %.1f %s'%('maximum energy to which deuterons can be accelerated (in MeV) is',E1,'');\n", - "print('in text book ans is given wrong')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "maximum energy to which deuterons can be accelerated (in J) is 2.67e-12 \n", - "maximum energy to which deuterons can be accelerated (in MeV) is 16.6 \n", - "in text book ans is given wrong\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg99" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 5.4\n", - "##Mass spectrograph, calculation of linear separation of lines formed on photographic plates\n", - "\n", - "##given values;\n", - "E=8.*10**4;##electric field in V/m\n", - "B=.55##magnetic induction in Wb/m*2\n", - "q=1.6*10**-19;##charge of ions\n", - "m1=20.*1.67*10**-27;##atomic mass of an isotope of neon\n", - "m2=22.*1.67*10**-27;##atomic mass of other isotope of neon\n", - "##calculation\n", - "x=2*E*(m2-m1)/(q*B**2);##\n", - "print'%s %.3f %s'%('separation of lines (in metre) is:',x,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "separation of lines (in metre) is: 0.011 \n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter6.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter6.ipynb deleted file mode 100755 index 5992fd39..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter6.ipynb +++ /dev/null @@ -1,95 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:2c7fa5f48e2180e437af8892520159f12789c250e22a9e424719ad83f83b7fff" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter6-Properties of Light" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg124" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##Example 6.1\n", - "##Optical path calculation \n", - "\n", - "##given values\n", - "n=1.33;##refractive index of medium\n", - "x=.75;##geometrical path in micrometre\n", - " ##calculation\n", - "y=x*n;##\n", - "print'%s %.3f %s'%('optical path (in micrometre) is:',y,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "optical path (in micrometre) is: 0.998 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg137" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##Example 6.2\n", - "##Coherence length calculation \n", - "\n", - "##given values\n", - "l=1*10**-14.;##line width in metre\n", - "x=10.6*10**-6.;##IR emission wavelength in metre\n", - " ##calculation\n", - "y=x**2./l;##\n", - "print'%s %.1f %s'%('coherence length(in metre) is:',y,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "coherence length(in metre) is: 11236.0 \n" - ] - } - ], - "prompt_number": 2 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter6_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter6_1.ipynb deleted file mode 100755 index 5992fd39..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter6_1.ipynb +++ /dev/null @@ -1,95 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:2c7fa5f48e2180e437af8892520159f12789c250e22a9e424719ad83f83b7fff" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter6-Properties of Light" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg124" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##Example 6.1\n", - "##Optical path calculation \n", - "\n", - "##given values\n", - "n=1.33;##refractive index of medium\n", - "x=.75;##geometrical path in micrometre\n", - " ##calculation\n", - "y=x*n;##\n", - "print'%s %.3f %s'%('optical path (in micrometre) is:',y,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "optical path (in micrometre) is: 0.998 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg137" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##Example 6.2\n", - "##Coherence length calculation \n", - "\n", - "##given values\n", - "l=1*10**-14.;##line width in metre\n", - "x=10.6*10**-6.;##IR emission wavelength in metre\n", - " ##calculation\n", - "y=x**2./l;##\n", - "print'%s %.1f %s'%('coherence length(in metre) is:',y,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "coherence length(in metre) is: 11236.0 \n" - ] - } - ], - "prompt_number": 2 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter7.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter7.ipynb deleted file mode 100755 index 1db562d5..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter7.ipynb +++ /dev/null @@ -1,175 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:dc1d02c818142fc43f1bb36bcc3b4789ed6aba6b82727804f7035772e1b68c40" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter7-Interface and Diffraction" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg146" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 7.1\n", - "##plane parallel thin film\n", - "\n", - "##given values\n", - "x=5890*10**-10;##wavelength of light in metre\n", - "n=1.5;##refractive index\n", - "r=60*math.pi/180.;##angle of refraction in degree\n", - " ##calculation\n", - "t=x/(2*n*math.cos(r));\n", - "print'%s %.2f %s'%('thickness of plate (in micrometre) is:',t*10**6,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "thickness of plate (in micrometre) is: 0.39 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg151" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 7.2\n", - "##wedge shaped thin film\n", - "\n", - "##given values\n", - "x=5893*10**-10.;##wavelength of light in metre\n", - "n=1.5;##refractive index\n", - "y=.1*10**-3.;##fringe spacing\n", - " ##calculation\n", - "z=x/(2.*n*y);##angle of wedge\n", - "alpha=z*180./math.pi;##conversion of radian into degree\n", - "print'%s %.2f %s'%('angle of wedge (in degree) is:',alpha,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "angle of wedge (in degree) is: 0.11 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg156" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 7.3\n", - "##Newton's ring experiment- calculation of refractive index\n", - "\n", - "##given values\n", - "D1=1.5;##diametre (in cm)of tenth dark ring in air\n", - "D2=1.27;##diametre (in cm)of tenth dark ring in liquid\n", - "\n", - "\n", - " ##calculation\n", - "n=D1**2./D2**2.;\n", - "print'%s %.2f %s'%('refractive index of liquid is',n,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "refractive index of liquid is 1.40 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-160" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 7.4\n", - "##nonreflecting film\n", - "\n", - "##given values\n", - "l=5500*10**-10.;##wavelength of light\n", - "n1=1.33;##refractive index of water\n", - "n2=1.52;##refractive index of glass window pane\n", - "x=math.sqrt(n1);##to check if it is nonreflecting\n", - "\n", - " ##calculation\n", - "t=l/(4.*n1);##thickness of water film required\n", - "print'%s %.2f %s'%('minimum thickness of film (in metre) is',t*10**6,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "minimum thickness of film (in metre) is 0.10 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter7_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter7_1.ipynb deleted file mode 100755 index 1db562d5..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter7_1.ipynb +++ /dev/null @@ -1,175 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:dc1d02c818142fc43f1bb36bcc3b4789ed6aba6b82727804f7035772e1b68c40" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter7-Interface and Diffraction" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg146" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 7.1\n", - "##plane parallel thin film\n", - "\n", - "##given values\n", - "x=5890*10**-10;##wavelength of light in metre\n", - "n=1.5;##refractive index\n", - "r=60*math.pi/180.;##angle of refraction in degree\n", - " ##calculation\n", - "t=x/(2*n*math.cos(r));\n", - "print'%s %.2f %s'%('thickness of plate (in micrometre) is:',t*10**6,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "thickness of plate (in micrometre) is: 0.39 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg151" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 7.2\n", - "##wedge shaped thin film\n", - "\n", - "##given values\n", - "x=5893*10**-10.;##wavelength of light in metre\n", - "n=1.5;##refractive index\n", - "y=.1*10**-3.;##fringe spacing\n", - " ##calculation\n", - "z=x/(2.*n*y);##angle of wedge\n", - "alpha=z*180./math.pi;##conversion of radian into degree\n", - "print'%s %.2f %s'%('angle of wedge (in degree) is:',alpha,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "angle of wedge (in degree) is: 0.11 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg156" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 7.3\n", - "##Newton's ring experiment- calculation of refractive index\n", - "\n", - "##given values\n", - "D1=1.5;##diametre (in cm)of tenth dark ring in air\n", - "D2=1.27;##diametre (in cm)of tenth dark ring in liquid\n", - "\n", - "\n", - " ##calculation\n", - "n=D1**2./D2**2.;\n", - "print'%s %.2f %s'%('refractive index of liquid is',n,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "refractive index of liquid is 1.40 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-160" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 7.4\n", - "##nonreflecting film\n", - "\n", - "##given values\n", - "l=5500*10**-10.;##wavelength of light\n", - "n1=1.33;##refractive index of water\n", - "n2=1.52;##refractive index of glass window pane\n", - "x=math.sqrt(n1);##to check if it is nonreflecting\n", - "\n", - " ##calculation\n", - "t=l/(4.*n1);##thickness of water film required\n", - "print'%s %.2f %s'%('minimum thickness of film (in metre) is',t*10**6,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "minimum thickness of film (in metre) is 0.10 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter8.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter8.ipynb deleted file mode 100755 index ff6879b2..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter8.ipynb +++ /dev/null @@ -1,102 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:960fd108c21eb5121a849117765bbc8e0d88eb94076f3988470cabfdb760bcc0" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter8-Polarization" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg200" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 8.2\n", - "##Polarizer,calculation of angle\n", - "\n", - "##given values\n", - "Io=1.;##intensity of polarised light\n", - "I1=Io/2.;##intensity of beam polarised by first by first polariser\n", - "I2=Io/3.;##intensity of light polarised by second polariser\n", - "\n", - "\n", - " ##calculation\n", - "a=math.acos(math.sqrt(I2/I1));\n", - "alpha=a*180./math.pi;##conversion of angle into degree\n", - "print'%s %.1f %s'%('angle between characteristic directions (in degree) is',alpha,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "angle between characteristic directions (in degree) is 35.3 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg209" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 8.3\n", - "##calculation of birefringence\n", - "\n", - "##given values\n", - "\n", - "l=6*10**-7.;##wavelength of light in metre\n", - "d=3*10**-5.;##thickness of crystal\n", - "\n", - "\n", - " ##calculation\n", - "x=l/(4.*d);\n", - "print'%s %.3f %s'%('the birefringance of the crystal is',x,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the birefringance of the crystal is 0.005 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/Chapter8_1.ipynb b/_A_Textbook_Of_Engineering_Physics/Chapter8_1.ipynb deleted file mode 100755 index ff6879b2..00000000 --- a/_A_Textbook_Of_Engineering_Physics/Chapter8_1.ipynb +++ /dev/null @@ -1,102 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:960fd108c21eb5121a849117765bbc8e0d88eb94076f3988470cabfdb760bcc0" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter8-Polarization" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg200" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 8.2\n", - "##Polarizer,calculation of angle\n", - "\n", - "##given values\n", - "Io=1.;##intensity of polarised light\n", - "I1=Io/2.;##intensity of beam polarised by first by first polariser\n", - "I2=Io/3.;##intensity of light polarised by second polariser\n", - "\n", - "\n", - " ##calculation\n", - "a=math.acos(math.sqrt(I2/I1));\n", - "alpha=a*180./math.pi;##conversion of angle into degree\n", - "print'%s %.1f %s'%('angle between characteristic directions (in degree) is',alpha,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "angle between characteristic directions (in degree) is 35.3 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg209" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "##Example 8.3\n", - "##calculation of birefringence\n", - "\n", - "##given values\n", - "\n", - "l=6*10**-7.;##wavelength of light in metre\n", - "d=3*10**-5.;##thickness of crystal\n", - "\n", - "\n", - " ##calculation\n", - "x=l/(4.*d);\n", - "print'%s %.3f %s'%('the birefringance of the crystal is',x,'');" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the birefringance of the crystal is 0.005 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/README.txt b/_A_Textbook_Of_Engineering_Physics/README.txt deleted file mode 100755 index e156a531..00000000 --- a/_A_Textbook_Of_Engineering_Physics/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: kartik sankhla -Course: btech -College/Institute/Organization: iitbombay -Department/Designation: aerospace engnieering -Book Title: A Textbook Of Engineering Physics -Author: M. N. Avadhanulu, And P. G. Kshirsagar -Publisher: S. Chand And Company, New Delhi -Year of publication: 2011 -Isbn: 81-219-0817-5 -Edition: 9 \ No newline at end of file diff --git a/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter11.png b/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter11.png deleted file mode 100755 index d60291ea..00000000 Binary files a/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter11.png and /dev/null differ diff --git a/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter11_1.png b/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter11_1.png deleted file mode 100755 index 50e4571c..00000000 Binary files a/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter11_1.png and /dev/null differ diff --git a/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter12.png b/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter12.png deleted file mode 100755 index e6fcb374..00000000 Binary files a/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter12.png and /dev/null differ diff --git a/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter12_1.png b/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter12_1.png deleted file mode 100755 index bab9d24a..00000000 Binary files a/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter12_1.png and /dev/null differ diff --git a/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter13.png b/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter13.png deleted file mode 100755 index 2560bf69..00000000 Binary files a/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter13.png and /dev/null differ diff --git a/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter13_1.png b/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter13_1.png deleted file mode 100755 index e45c80b4..00000000 Binary files a/_A_Textbook_Of_Engineering_Physics/screenshots/Chapter13_1.png and /dev/null differ diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH19.png b/_Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH19.png deleted file mode 100755 index 742b4078..00000000 Binary files a/_Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH19.png and /dev/null differ diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH3.png b/_Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH3.png deleted file mode 100755 index 168ddb9f..00000000 Binary files a/_Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH3.png and /dev/null differ diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH5.png b/_Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH5.png deleted file mode 100755 index cb655050..00000000 Binary files a/_Diffusion:_Mass_Transfer_In_Fluid_Systems/screenshots/CH5.png and /dev/null differ diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions.ipynb deleted file mode 100755 index fc89b13e..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions.ipynb +++ /dev/null @@ -1,280 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 17 Homogeneous Chemical Reactions" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_1_1 pgno:485" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion co efficient of methyl iodide in benzene is x10**-5 cm/sec 1.70880074906\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "K = 1.46*10**-4 # lit/mol-sec (rate constant)\n", - "cpyridine = 0.1 # mol/lit\n", - "K1 = 2.0*10**-5 # cm**2/sec\n", - "#Calculations\n", - "D = K*cpyridine # sec**-1\n", - "k0 = ((D*K1)**0.5)*10**5#in x*10**-5 cm/sec\n", - "#Results\n", - "print\"The diffusion co efficient of methyl iodide in benzene is x10**-5 cm/sec\",round(k0,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_1_2 pgno:486" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of reduction in reaction rate due to diffusion is 0.385022761125333\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "R = 0.3 # cm\n", - "K1 = 18.6 # sec**-1\n", - "D = 0.027 # cm**2/sec\n", - "from sympy import coth\n", - "#Calculations\n", - "l = R/3 # cm\n", - "n = ((D/(K1*(l**2)))**0.5)*coth((K1*(l**2)/D)**0.5)\n", - "#Results\n", - "print\"The value of reduction in reaction rate due to diffusion is \",n\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_1_3 pgno:486" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The rate constant is sec**-1 20.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "k = 16*10**-3 # m.t.c in cm/sec\n", - "D = 1.25*10**-5 # Diffusion co efficient in cm**2/sec\n", - "#Calculations \n", - "K1 = (k**2)/D\n", - "#Results\n", - "print\"The rate constant is sec**-1\",round(K1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_2_1 pgno:490" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "There is about a fold increase in rate 13.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D2 = 5*10**-6 # The diffusion co efficient of the new compound in cm**2/sec\n", - "Nu = 3 # The factor\n", - "D1 = 0.7*10**-5 # The diffusion co efficient of the original compound in cm**2/sec\n", - "c2l = 1.5*10**-5 # the new solubility in mol/cc\n", - "c1l = 3*10**-7 # The old solubility in mol/cc\n", - "#Calculations\n", - "k = 1 + ((D2*c2l)/(Nu*D1*c1l))# The number of times the rate has increased to the previous rate\n", - "#Results\n", - "print\"There is about a fold increase in rate\",round(k)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_4_1 pgno:503" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The rate constant for this reaction is litre/mol-sec 3.0\n", - "This reaction is diffusion controlled\n", - "The rate constant for this reaction is 10**10 litre/mol-sec 2.0\n", - "The reaction is diffusion controlled\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "from math import pi\n", - "#For first reaction\n", - "D1 = 9.3*10**-5 # cm**2/sec\n", - "D2 = 5.3*10**-5 # cm**2/sec\n", - "K1exp = 1.4*10**11 # litre/mol-sec\n", - "sigma12 = 2.8*10**-8 # cm\n", - "N = (6.02*10**23)/10**3# liter/cc-mol\n", - "K1 = 4*pi*(D1+D2)*sigma12*N/10**10 # Rate constant for first reaction in litre/mol-sec\n", - "print\"The rate constant for this reaction is litre/mol-sec\",round(K1)\n", - "if K1>K1exp:\n", - " \t print\"This reaction is controlled more by chemical factors\"\n", - "else:\n", - " print\"This reaction is diffusion controlled\"\n", - "\n", - "#Second reaction\n", - "D1 = 5.3*10**-5 # cm**2/sec\n", - "D2 = 0.8*10**-5 # cm**2/sec\n", - "sigma12 = 5*10**-8 # cm\n", - "K1exp = 3.8*10**7 # litre/mol-sec\n", - "K1 = 4*pi*(D1+D2)*sigma12*N/10**10 # Rate constant for second reaction in litre/mol-sec\n", - "print\"The rate constant for this reaction is 10**10 litre/mol-sec\",round(K1)\n", - "if K1>K1exp: \n", - " print\"This reaction is controlled more by chemical factors\"\n", - "else: \n", - " print\"The reaction is diffusion controlled\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_5_1 pgno:506" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The relaxation time is sec 0.07\n" - ] - } - ], - "source": [ - "#intitialization of variables\n", - "d = 5# cm\n", - "v = 200 # cm/sec\n", - "nu = 0.01 # cm**2/sec\n", - "D = 3.2*10**-5 # cm**2/sec\n", - "l = 30*10**-4 # cm\n", - "#Calculations\n", - "Re = d*v/nu # Flow is turbulent\n", - "E = d*v/2 # cm**2/sec\n", - "tou1 = (d**2)/(4*E)# sec\n", - "tou2 = (l**2)/(4*D)\n", - "tou = tou1 + tou2 # sec\n", - "#Results\n", - "print\"The relaxation time is sec\",round(tou,3)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions_1.ipynb deleted file mode 100755 index f1d1cc5f..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/CHapter_17_Homogeneous_Chemical_Reactions_1.ipynb +++ /dev/null @@ -1,262 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 17 Homogeneous Chemical Reactions" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_1_1 pgno:485" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion co efficient of methyl iodide in benzene is x10**-5 cm/sec 1.7\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "K = 1.46*10**-4 # lit/mol-sec (rate constant)\n", - "cpyridine = 0.1 # mol/lit\n", - "K1 = 2.0*10**-5 # cm**2/sec\n", - "#Calculations\n", - "D = K*cpyridine # sec**-1\n", - "k0 = ((D*K1)**0.5)*10**5#in x*10**-5 cm/sec\n", - "#Results\n", - "print\"The diffusion co efficient of methyl iodide in benzene is x10**-5 cm/sec\",round(k0,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_1_2 pgno:486" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of reduction in reaction rate due to diffusion is 0.385\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "R = 0.3 # cm\n", - "K1 = 18.6 # sec**-1\n", - "D = 0.027 # cm**2/sec\n", - "from sympy import coth\n", - "#Calculations\n", - "l = R/3 # cm\n", - "n = ((D/(K1*(l**2)))**0.5)*coth((K1*(l**2)/D)**0.5)\n", - "#Results\n", - "print\"The value of reduction in reaction rate due to diffusion is \",round(n,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_1_3 pgno:486" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The rate constant is sec**-1 20.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "k = 16*10**-3 # m.t.c in cm/sec\n", - "D = 1.25*10**-5 # Diffusion co efficient in cm**2/sec\n", - "#Calculations \n", - "K1 = (k**2)/D\n", - "#Results\n", - "print\"The rate constant is sec**-1\",round(K1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_2_1 pgno:490" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "There is about a fold increase in rate 13.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D2 = 5*10**-6 # The diffusion co efficient of the new compound in cm**2/sec\n", - "Nu = 3 # The factor\n", - "D1 = 0.7*10**-5 # The diffusion co efficient of the original compound in cm**2/sec\n", - "c2l = 1.5*10**-5 # the new solubility in mol/cc\n", - "c1l = 3*10**-7 # The old solubility in mol/cc\n", - "#Calculations\n", - "k = 1 + ((D2*c2l)/(Nu*D1*c1l))# The number of times the rate has increased to the previous rate\n", - "#Results\n", - "print\"There is about a fold increase in rate\",round(k)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_4_1 pgno:503" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The rate constant for this reaction is litre/mol-sec 3.0\n", - "This reaction is diffusion controlled\n", - "The rate constant for this reaction is 10**10 litre/mol-sec 2.0\n", - "The reaction is diffusion controlled\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "from math import pi\n", - "#For first reaction\n", - "D1 = 9.3*10**-5 # cm**2/sec\n", - "D2 = 5.3*10**-5 # cm**2/sec\n", - "K1exp = 1.4*10**11 # litre/mol-sec\n", - "sigma12 = 2.8*10**-8 # cm\n", - "N = (6.02*10**23)/10**3# liter/cc-mol\n", - "K1 = 4*pi*(D1+D2)*sigma12*N/10**10 # Rate constant for first reaction in litre/mol-sec\n", - "print\"The rate constant for this reaction is litre/mol-sec\",round(K1)\n", - "if K1>K1exp:\n", - " \t print\"This reaction is controlled more by chemical factors\"\n", - "else:\n", - " print\"This reaction is diffusion controlled\"\n", - "\n", - "#Second reaction\n", - "D1 = 5.3*10**-5 # cm**2/sec\n", - "D2 = 0.8*10**-5 # cm**2/sec\n", - "sigma12 = 5*10**-8 # cm\n", - "K1exp = 3.8*10**7 # litre/mol-sec\n", - "K1 = 4*pi*(D1+D2)*sigma12*N/10**10 # Rate constant for second reaction in litre/mol-sec\n", - "print\"The rate constant for this reaction is 10**10 litre/mol-sec\",round(K1)\n", - "if K1>K1exp: \n", - " print\"This reaction is controlled more by chemical factors\"\n", - "else: \n", - " print\"The reaction is diffusion controlled\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_5_1 pgno:506" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The relaxation time is sec 0.07\n" - ] - } - ], - "source": [ - "#intitialization of variables\n", - "d = 5# cm\n", - "v = 200 # cm/sec\n", - "nu = 0.01 # cm**2/sec\n", - "D = 3.2*10**-5 # cm**2/sec\n", - "l = 30*10**-4 # cm\n", - "#Calculations\n", - "Re = d*v/nu # Flow is turbulent\n", - "E = d*v/2 # cm**2/sec\n", - "tou1 = (d**2)/(4*E)# sec\n", - "tou2 = (l**2)/(4*D)\n", - "tou = tou1 + tou2 # sec\n", - "#Results\n", - "print\"The relaxation time is sec\",round(tou,3)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorbption.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorbption.ipynb deleted file mode 100755 index b131e247..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorbption.ipynb +++ /dev/null @@ -1,255 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 10 Absorbption" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_2_1 pgno:313" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diameter of the tower is ft 6.4\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "c = 0.92\n", - "F = 93. # ft**-1\n", - "nu = 2. # cs\n", - "dl = 63. # lb/ft**3\n", - "dg = 2.8 # lb/ft**3\n", - "G = 23. #lb/sex\n", - "from math import pi\n", - "#Calculations\n", - "G11 = c*((dl-dg)**0.5)/(((F)**0.5)*(nu**0.05))# lb/ft**2-sec\n", - "A = G/G11# ft**2\n", - "d = (4*A/pi)**0.5#ft\n", - "#Results\n", - "print\"The diameter of the tower is ft\",round(d,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_3_1 pgno:318" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The length of the tower is m 3.2\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "G = 2.3 # Gas flow in gmol/sec\n", - "L = 4.8 # Liquid flow in gmol/sec\n", - "y0 = 0.0126 # entering gas Mole fraction of CO2\n", - "yl = 0.0004 # Exiting gas mole fraction of CO2 \n", - "xl = 0 # Exiting liquid mole fraction of CO2\n", - "d = 40. # Diameter of the tower in cm\n", - "x0star = 0.0080# if the amine left in equilibrium with the entering gas would contain 0.80 percent C02\n", - "Kya = 5*10**-5 # Overall M.T.C and the product times the area per volume in gmol/cm**3-sec\n", - "from math import pi\n", - "from math import log\n", - "#Calculations\n", - "A =pi*(d**2)/4\n", - "x0 = ((G*(y0-yl))/(L)) + xl # Entering liquid mole fraction of CO2\n", - "m = y0/x0star # Equilibirum constant\n", - "c1 = G/(A*Kya)\n", - "c2 = 1/(1-(m*G/L))\n", - "c3 = log((y0-m*x0)/(yl-m*xl))\n", - "l = (G/(A*Kya))*(1/(1-((m*G)/L)))*(log((y0-m*x0)/(yl-m*xl)))/100 #length of the tower in metres\n", - "#Results\n", - "print\"The length of the tower is m\",round(l,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_3_2 pgno:319" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the percentage of oxygen we can remove is 98.4\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "l = 200. # Length of the tower in cm\n", - "d = 60. # diameter of the tower\n", - "Lf = 300. # Liquid flow in cc/sec\n", - "Kx = 2.2*10**-3 # dominant transfer co efficient in liquid in cm/sec\n", - "from math import pi\n", - "from math import exp\n", - "#Calculations\n", - "A = pi*60*60/4 # Area of the cross section in sq cm\n", - "L = Lf/A # Liquid flux in cm**2/sec\n", - "ratio = 1/(exp((l*Kx)/L))\n", - "percentage = (1-ratio)*100 # Percentage removal of Oxygen\n", - "#Results\n", - "print\"the percentage of oxygen we can remove is\",round(percentage,1)\n", - "\n", - "\n", - "\n", - "# Rounding of error in textbook" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_4_1 pgno:324" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The flow of pure water into the top of the tower kgmol/sec 0.0652\n", - "\n", - " The diameter of the tower is m 3.5\n", - "\n", - " The length of the tower is m 1232.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "y1in = 0.37 # mole fraction of Ammonia in gas mixture entering\n", - "y2in =0.16 # mole fraction of nitrogen in gas mixture entering\n", - "y3in = 0.47 # mole fraction of hydrogen in gas mixture entering\n", - "x1out = 0.23 # mole fraction of Ammonia in liquid coming out\n", - "y1out = 0.01 # mole fraction of ammonia in gas coming out\n", - "G0 = 1.20 # Gas glow entering in m**3/sec\n", - "Mu = 1.787*0.01*0.3048/2.23 # liquid viscousity in american units\n", - "dl = 62.4 # Density of liquid in lb/ft**3\n", - "KG = 0.032 # Overall m.t.c in gas phase in gas side m/sec\n", - "a = 105 # surface area in m**2/m**3\n", - "gc = 32.2 # acceleration due to gravity in ft/sec**2\n", - "dg = 0.0326 # Density of gas in lb/ft**3\n", - "#Molecular weights of Ammonia , N2 , H2\n", - "M1 = 17\n", - "M2 = 28\n", - "M3 = 2\n", - "Nu = 1 # Viscousity\n", - "from math import pi \n", - "#Calculations\n", - "AG0 = (y2in+y3in)*G0/22.4 # Total flow of non absorbed gases in kgmol/sec\n", - "ANH3 = y1in*G0/22.4- (y1out*AG0)/(1-y1out) # Ammonia absorbed kgmol/sec\n", - "AL0 = ((1-x1out)/x1out)*ANH3 # the desired water flow in kgmol/sec\n", - "avg1 = 11.7 # Average mol wt of gas\n", - "avg2 = 17.8 # avg mol wt of liquid\n", - "TFG = avg1*AG0/(y2in+y3in)#Total flow of gas in kg/sec\n", - "TFL = avg2*AL0/(1-x1out)#total flow of liquid in kg/sec\n", - "F = 45 # Packing factor\n", - "GFF = 1.3*((dl-dg)**0.5)/((F**0.5)*(Nu**0.05))# Flux we require in lb/ft**2-sec\n", - "GFF1 = GFF*0.45/(0.3**2) # in kg/m**2-sec (answer wrong in textbook)\n", - "Area = TFG/GFF1 # Area of the cross section of tower\n", - "dia = ((4*Area/pi)**0.5)*10.9# diameter in metres\n", - "HTU = (22.4*AG0/pi*dia**2)/(KG*a*4)\n", - "NTU = 5555\n", - "l = HTU*NTU # Length of the tower\n", - "#Results\n", - "print\"The flow of pure water into the top of the tower kgmol/sec\",round(AL0,4)\n", - "print\"\\n The diameter of the tower is m\",round(dia,1)\n", - "print\"\\n The length of the tower is m\",round(l)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorption.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorption.ipynb deleted file mode 100755 index f8eab018..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_10_Absorption.ipynb +++ /dev/null @@ -1,228 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 10 Absorption" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_2_1 pgno:313" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diameter of the tower is ft 6.4\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "c = 0.92\n", - "F = 93. # ft**-1\n", - "nu = 2. # cs\n", - "dl = 63. # lb/ft**3\n", - "dg = 2.8 # lb/ft**3\n", - "G = 23. #lb/sex\n", - "from math import pi\n", - "#Calculations\n", - "G11 = c*((dl-dg)**0.5)/(((F)**0.5)*(nu**0.05))# lb/ft**2-sec\n", - "A = G/G11# ft**2\n", - "d = (4*A/pi)**0.5#ft\n", - "#Results\n", - "print\"The diameter of the tower is ft\",round(d,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_3_1 pgno:318" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The length of the tower is m 3.2\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "G = 2.3 # Gas flow in gmol/sec\n", - "L = 4.8 # Liquid flow in gmol/sec\n", - "y0 = 0.0126 # entering gas Mole fraction of CO2\n", - "yl = 0.0004 # Exiting gas mole fraction of CO2 \n", - "xl = 0 # Exiting liquid mole fraction of CO2\n", - "d = 40. # Diameter of the tower in cm\n", - "x0star = 0.0080# if the amine left in equilibrium with the entering gas would contain 0.80 percent C02\n", - "Kya = 5*10**-5 # Overall M.T.C and the product times the area per volume in gmol/cm**3-sec\n", - "from math import pi\n", - "from math import log\n", - "#Calculations\n", - "A =pi*(d**2)/4\n", - "x0 = ((G*(y0-yl))/(L)) + xl # Entering liquid mole fraction of CO2\n", - "m = y0/x0star # Equilibirum constant\n", - "c1 = G/(A*Kya)\n", - "c2 = 1/(1-(m*G/L))\n", - "c3 = log((y0-m*x0)/(yl-m*xl))\n", - "l = (G/(A*Kya))*(1/(1-((m*G)/L)))*(log((y0-m*x0)/(yl-m*xl)))/100 #length of the tower in metres\n", - "#Results\n", - "print\"The length of the tower is m\",round(l,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_3_2 pgno:319" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the percentage of oxygen we can remove is 98.4\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "l = 200. # Length of the tower in cm\n", - "d = 60. # diameter of the tower\n", - "Lf = 300. # Liquid flow in cc/sec\n", - "Kx = 2.2*10**-3 # dominant transfer co efficient in liquid in cm/sec\n", - "from math import pi\n", - "from math import exp\n", - "#Calculations\n", - "A = pi*60*60/4 # Area of the cross section in sq cm\n", - "L = Lf/A # Liquid flux in cm**2/sec\n", - "ratio = 1/(exp((l*Kx)/L))\n", - "percentage = (1-ratio)*100 # Percentage removal of Oxygen\n", - "#Results\n", - "print\"the percentage of oxygen we can remove is\",round(percentage,1)\n", - "\n", - "\n", - "\n", - "# Rounding of error in textbook" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_4_1 pgno:324" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The flow of pure water into the top of the tower kgmol/sec 0.0652\n", - "\n", - " The diameter of the tower is m 3.5\n", - "\n", - " The length of the tower is m 1232.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "y1in = 0.37 # mole fraction of Ammonia in gas mixture entering\n", - "y2in =0.16 # mole fraction of nitrogen in gas mixture entering\n", - "y3in = 0.47 # mole fraction of hydrogen in gas mixture entering\n", - "x1out = 0.23 # mole fraction of Ammonia in liquid coming out\n", - "y1out = 0.01 # mole fraction of ammonia in gas coming out\n", - "G0 = 1.20 # Gas glow entering in m**3/sec\n", - "Mu = 1.787*0.01*0.3048/2.23 # liquid viscousity in american units\n", - "dl = 62.4 # Density of liquid in lb/ft**3\n", - "KG = 0.032 # Overall m.t.c in gas phase in gas side m/sec\n", - "a = 105 # surface area in m**2/m**3\n", - "gc = 32.2 # acceleration due to gravity in ft/sec**2\n", - "dg = 0.0326 # Density of gas in lb/ft**3\n", - "#Molecular weights of Ammonia , N2 , H2\n", - "M1 = 17\n", - "M2 = 28\n", - "M3 = 2\n", - "Nu = 1 # Viscousity\n", - "from math import pi \n", - "#Calculations\n", - "AG0 = (y2in+y3in)*G0/22.4 # Total flow of non absorbed gases in kgmol/sec\n", - "ANH3 = y1in*G0/22.4- (y1out*AG0)/(1-y1out) # Ammonia absorbed kgmol/sec\n", - "AL0 = ((1-x1out)/x1out)*ANH3 # the desired water flow in kgmol/sec\n", - "avg1 = 11.7 # Average mol wt of gas\n", - "avg2 = 17.8 # avg mol wt of liquid\n", - "TFG = avg1*AG0/(y2in+y3in)#Total flow of gas in kg/sec\n", - "TFL = avg2*AL0/(1-x1out)#total flow of liquid in kg/sec\n", - "F = 45 # Packing factor\n", - "GFF = 1.3*((dl-dg)**0.5)/((F**0.5)*(Nu**0.05))# Flux we require in lb/ft**2-sec\n", - "GFF1 = GFF*0.45/(0.3**2) # in kg/m**2-sec (answer wrong in textbook)\n", - "Area = TFG/GFF1 # Area of the cross section of tower\n", - "dia = ((4*Area/pi)**0.5)*10.9# diameter in metres\n", - "HTU = (22.4*AG0/pi*dia**2)/(KG*a*4)\n", - "NTU = 5555\n", - "l = HTU*NTU # Length of the tower\n", - "#Results\n", - "print\"The flow of pure water into the top of the tower kgmol/sec\",round(AL0,4)\n", - "print\"\\n The diameter of the tower is m\",round(dia,1)\n", - "print\"\\n The length of the tower is m\",round(l)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine.ipynb deleted file mode 100755 index e0bd3fa9..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine.ipynb +++ /dev/null @@ -1,174 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 11 Mass Transfer in Biology and Medicine" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_1_1 pgno:334" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The mass transfer co efficient is cm/sec 0.0006\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "N1 = 1.6*10**-10 # mol/cm**2-sec\n", - "c1star = 0 # mol/cc\n", - "c1 = 2.7*10**-4/1000 # mol/cc\n", - "#Calculations\n", - "K = N1/(c1-c1star)# cm/sec\n", - "#Results\n", - "print\"The mass transfer co efficient is cm/sec\",round(K,4)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_2_1 pgno:335" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Mass transfer co efficient inside the hollow fibers cm/sec 0.0\n", - "\n", - "Mass transfer co efficient outside the hollow fibers cm/sec 0.00038\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "d = 400*10**-4 # cm\n", - "D = 10**-5 # cm**2/sec\n", - "v = 1. # cm/sec\n", - "l = 30. # cm\n", - "nu = 0.01 # cm**2/sec\n", - "#Calculations \n", - "k1 = (D/d)*1.62*(((d**2)*v/D*l)**(1/3))+0.0003# Mass transfer co efficient inside the hollow fibers in cm/sec\n", - "k2 = (D/d)*0.8*((d*v/nu)**0.47)*((nu/D)**(1/3))#Mass transfer co efficient outside the hollow fibers in cm/sec\n", - "#Results\n", - "print\"Mass transfer co efficient inside the hollow fibers cm/sec\",round(k1,2)\n", - "print\"\\nMass transfer co efficient outside the hollow fibers cm/sec\",round(k2,5)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_2_2 pgno:336" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The percentage of toxins removed when dialystate flow equals blood flow is 54.0\n", - "\n", - "The percentage of toxins removed when dialystate flow is twice the blood flow is 62.0\n", - "\n", - "The percentage of toxins removed when dialystate flow is very large is 70.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "phi = 0.2\n", - "d = 200*10**-4 # cm\n", - "dia = 3.8 # cm\n", - "Q = 4.1 # blood flow in cc/sec\n", - "k = 3.6*10**-4 # cm/sec\n", - "l = 30 # cm\n", - "from math import pi\n", - "from math import exp\n", - "#Calculations\n", - "a = 4*phi/d # cm**2/cm**3\n", - "B = Q/((pi*dia**2)/4) # cm/sec\n", - "ratio1 = 1/(1+(k*a*l/B))# D equals B\n", - "percent1 = (1-ratio1)*100 # percentage of toxins removed when dialystate flow equals blood flow\n", - "D = 2*B # in second case\n", - "ratio2 =1/(((1/(exp(-k*a*l/D)))-0.5)*2) # when D =2B\n", - "percent2 = (1-ratio2)*100 # percentage of toxins removed when dialystate flow is twice the blood flow\n", - "ratio3 = exp(-k*a*l/B)# when dialystate flow is very large\n", - "percent3 = (1-ratio3)*100 # percentage of toxins removed when dialystate flow is very large\n", - "#Results\n", - "print\"The percentage of toxins removed when dialystate flow equals blood flow is \",round(percent1)\n", - "print\"\\nThe percentage of toxins removed when dialystate flow is twice the blood flow is \",round(percent2)\n", - "print\"\\nThe percentage of toxins removed when dialystate flow is very large is \",round(percent3)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine_1.ipynb deleted file mode 100755 index 48265c60..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_11_Mass_Transfer_in_Biology_and_Medicine_1.ipynb +++ /dev/null @@ -1,156 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 11 Mass Transfer in Biology and Medicine" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_1_1 pgno:334" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The mass transfer co efficient is cm/sec 0.0006\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "N1 = 1.6*10**-10 # mol/cm**2-sec\n", - "c1star = 0 # mol/cc\n", - "c1 = 2.7*10**-4/1000 # mol/cc\n", - "#Calculations\n", - "K = N1/(c1-c1star)# cm/sec\n", - "#Results\n", - "print\"The mass transfer co efficient is cm/sec\",round(K,4)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_2_1 pgno:335" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Mass transfer co efficient inside the hollow fibers cm/sec 0.0\n", - "\n", - "Mass transfer co efficient outside the hollow fibers cm/sec 0.00038\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "d = 400*10**-4 # cm\n", - "D = 10**-5 # cm**2/sec\n", - "v = 1. # cm/sec\n", - "l = 30. # cm\n", - "nu = 0.01 # cm**2/sec\n", - "#Calculations \n", - "k1 = (D/d)*1.62*(((d**2)*v/D*l)**(1/3))+0.0003# Mass transfer co efficient inside the hollow fibers in cm/sec\n", - "k2 = (D/d)*0.8*((d*v/nu)**0.47)*((nu/D)**(1/3))#Mass transfer co efficient outside the hollow fibers in cm/sec\n", - "#Results\n", - "print\"Mass transfer co efficient inside the hollow fibers cm/sec\",round(k1,2)\n", - "print\"\\nMass transfer co efficient outside the hollow fibers cm/sec\",round(k2,5)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_2_2 pgno:336" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The percentage of toxins removed when dialystate flow equals blood flow is 54.0\n", - "\n", - "The percentage of toxins removed when dialystate flow is twice the blood flow is 62.0\n", - "\n", - "The percentage of toxins removed when dialystate flow is very large is 70.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "phi = 0.2\n", - "d = 200*10**-4 # cm\n", - "dia = 3.8 # cm\n", - "Q = 4.1 # blood flow in cc/sec\n", - "k = 3.6*10**-4 # cm/sec\n", - "l = 30 # cm\n", - "from math import pi\n", - "from math import exp\n", - "#Calculations\n", - "a = 4*phi/d # cm**2/cm**3\n", - "B = Q/((pi*dia**2)/4) # cm/sec\n", - "ratio1 = 1/(1+(k*a*l/B))# D equals B\n", - "percent1 = (1-ratio1)*100 # percentage of toxins removed when dialystate flow equals blood flow\n", - "D = 2*B # in second case\n", - "ratio2 =1/(((1/(exp(-k*a*l/D)))-0.5)*2) # when D =2B\n", - "percent2 = (1-ratio2)*100 # percentage of toxins removed when dialystate flow is twice the blood flow\n", - "ratio3 = exp(-k*a*l/B)# when dialystate flow is very large\n", - "percent3 = (1-ratio3)*100 # percentage of toxins removed when dialystate flow is very large\n", - "#Results\n", - "print\"The percentage of toxins removed when dialystate flow equals blood flow is \",round(percent1)\n", - "print\"\\nThe percentage of toxins removed when dialystate flow is twice the blood flow is \",round(percent2)\n", - "print\"\\nThe percentage of toxins removed when dialystate flow is very large is \",round(percent3)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation.ipynb deleted file mode 100755 index 24a8b3c9..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation.ipynb +++ /dev/null @@ -1,196 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 12 Diffrential Distillation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_2_1 pgno:359" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The mass transfer per volume is mol/m**3-sec 12.5\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "l = 1.22 # length of tower\n", - "Gflow = 0.026 # mol/sec\n", - "GbyL = 0.07\n", - "dia = 0.088 # m\n", - "pl = 1.1/100.# pl = 1-yl\n", - "p0 = 0.04/100. # p0 = 1-y0\n", - "from math import pi,log\n", - "#Calculations\n", - "A = pi*(dia**2)/4 # cross sectional of tower in m**2\n", - "G = Gflow/A # Gas flux in mol/m**2-sec\n", - "Kya = (G/l)*(1/(1-GbyL))*(log(pl/p0))# Mass transfer per volume in mol/m**3-sec\n", - "#Results\n", - "print\"The mass transfer per volume is mol/m**3-sec\",round(Kya,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_2_2 pgno:360" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "In case 1, NTU = 5.3\n", - "\n", - " In case 2, xd = 0.99835085281\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "x1=0.99\n", - "x2=0.99\n", - "y1=0.95\n", - "y2=0.95\n", - "alpha=1.5\n", - "m=0.42\n", - "l=2.\n", - "HTU=0.34\n", - "from math import log,e\n", - "#calculations\n", - "y1s= (y1-0.58)/m\n", - "xrd= (x2-y2)/(x1-y1s)\n", - "Rd=xrd/(1-xrd)\n", - "Rds=alpha*Rd\n", - "xl= ((Rds+1)*y1 - x1)/(Rds)\n", - "#def fun1(y):\n", - "\t#z=0.58+0.42*y\n", - "#\treturn z\n", - "zx1=0.9958;\n", - "zy1=0.979;\n", - "zxl=0.903968253;\n", - "NTU = 5.28#(log((zxl -y1)/(zx1-x1))) /(1- m*(Rds+1)/Rds)\n", - "NTU2=l/HTU\n", - "xd2=(zy1-y1)/e**(NTU2*(1-m))\n", - "xd=(0.58-xd2)/(1-m)\n", - "#results\n", - "print\"In case 1, NTU = \",round(NTU,1)\n", - "print\"\\n In case 2, xd = \",xd\n", - "\n", - " " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_4_1 pgno:368" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "length of the tower = m 2.8\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "F=3500 #mol/hr\n", - "xf=0.4\n", - "x1=0.98\n", - "y1=0.97\n", - "y2=0.625\n", - "x1=0.97\n", - "x2=0.4\n", - "ratio=1.5\n", - "HTU=0.2\n", - "import numpy\n", - "#calculations\n", - "#A=numpy.array[[1, 1],[x1, 1-x1]]\n", - "#B=numpy.array[[F],[xf*F]]\n", - "#C=B/A\n", - "DA=1400\n", - "BA=2100\n", - "Rds=(y1-y2)/(x1-x2)\n", - "Rd=Rds/(1-Rds)\n", - "Rdreq=ratio*Rd\n", - "NTU=13.9\n", - "l=HTU*NTU\n", - "#results\n", - "print\"length of the tower = m\",round(l,1)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation_1.ipynb deleted file mode 100755 index 8751d41e..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_12_Diffrential_Distillation_1.ipynb +++ /dev/null @@ -1,178 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 12 Diffrential Distillation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_2_1 pgno:359" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The mass transfer per volume is mol/m**3-sec 12.5\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "l = 1.22 # length of tower\n", - "Gflow = 0.026 # mol/sec\n", - "GbyL = 0.07\n", - "dia = 0.088 # m\n", - "pl = 1.1/100.# pl = 1-yl\n", - "p0 = 0.04/100. # p0 = 1-y0\n", - "from math import pi,log\n", - "#Calculations\n", - "A = pi*(dia**2)/4 # cross sectional of tower in m**2\n", - "G = Gflow/A # Gas flux in mol/m**2-sec\n", - "Kya = (G/l)*(1/(1-GbyL))*(log(pl/p0))# Mass transfer per volume in mol/m**3-sec\n", - "#Results\n", - "print\"The mass transfer per volume is mol/m**3-sec\",round(Kya,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_2_2 pgno:360" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "In case 1, NTU = 5.3\n", - "\n", - " In case 2, xd = 0.998\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "x1=0.99\n", - "x2=0.99\n", - "y1=0.95\n", - "y2=0.95\n", - "alpha=1.5\n", - "m=0.42\n", - "l=2.\n", - "HTU=0.34\n", - "from math import log,e\n", - "#calculations\n", - "y1s= (y1-0.58)/m\n", - "xrd= (x2-y2)/(x1-y1s)\n", - "Rd=xrd/(1-xrd)\n", - "Rds=alpha*Rd\n", - "xl= ((Rds+1)*y1 - x1)/(Rds)\n", - "#def fun1(y):\n", - "\t#z=0.58+0.42*y\n", - "#\treturn z\n", - "zx1=0.9958;\n", - "zy1=0.979;\n", - "zxl=0.903968253;\n", - "NTU = 5.28#(log((zxl -y1)/(zx1-x1))) /(1- m*(Rds+1)/Rds)\n", - "NTU2=l/HTU\n", - "xd2=(zy1-y1)/e**(NTU2*(1-m))\n", - "xd=(0.58-xd2)/(1-m)\n", - "#results\n", - "print\"In case 1, NTU = \",round(NTU,1)\n", - "print\"\\n In case 2, xd = \",round(xd,3)\n", - "\n", - " " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_4_1 pgno:368" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "length of the tower = m 2.8\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "F=3500 #mol/hr\n", - "xf=0.4\n", - "x1=0.98\n", - "y1=0.97\n", - "y2=0.625\n", - "x1=0.97\n", - "x2=0.4\n", - "ratio=1.5\n", - "HTU=0.2\n", - "import numpy\n", - "#calculations\n", - "#A=numpy.array[[1, 1],[x1, 1-x1]]\n", - "#B=numpy.array[[F],[xf*F]]\n", - "#C=B/A\n", - "DA=1400\n", - "BA=2100\n", - "Rds=(y1-y2)/(x1-x2)\n", - "Rd=Rds/(1-Rds)\n", - "Rdreq=ratio*Rd\n", - "NTU=13.9\n", - "l=HTU*NTU\n", - "#results\n", - "print\"length of the tower = m\",round(l,1)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation.ipynb deleted file mode 100755 index 3d3edb09..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation.ipynb +++ /dev/null @@ -1,272 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 13 Staged Distillation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_1_1 pgno:379" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The column diameter is m 0.6\n" - ] - } - ], - "source": [ - "#Intialization of variables\n", - "xD = 0.90 # Distillate mole fraction\n", - "xB = 0.15# Reboiler mole fraction\n", - "xF = 0.50 #Feed mole fraction\n", - "F = 10. # mol/sec\n", - "dg = 3.1*10**-3 # g/cc\n", - "dl = 0.65 # g/cc\n", - "C = 0.11 # m/sec\n", - "from math import pi\n", - "#Calculations\n", - "D = ((xF*F)-(xB*F))/(xD-xB)\n", - "B = ((xF*F)-(xD*F))/(xB-xD)\n", - "L = 3.5*D\n", - "G = L+D\n", - "L1 = L+F\n", - "G1 = G\n", - "f = (L1/G1)*((dg/dl)**0.5) # flow parameter\n", - "vG = C*(((dl-dg)/dg)**0.5)#vapor velocity in m/sec\n", - "c = (22.4*10**-3)*340/373\n", - "d = (4*G1*c/(vG*pi))**0.5#m\n", - "#Results\n", - "print\"The column diameter is m\",round(d,1)\n", - "\n", - "#Calculation mistake in textbook\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_2_1 pgno:" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the number of stages approximately is 8.47146497005\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "y1 = 0.9999\n", - "x0 = y1 # For a total condenser\n", - "y0 =0.58 + 0.42*x0 # The equilbirum line\n", - "LbyG = 0.75\n", - "yNplus1 = 0.99\n", - "A = LbyG/0.42\n", - "n= 1\n", - "from math import log\n", - "#Calculations\n", - "xN = (yNplus1-((1-LbyG)*y1))/LbyG\n", - "yN = 0.58 + 0.42*xN\n", - "N = (log((yNplus1-yN)/(y1-y0))/log(A))+n#, number of stages\n", - "#Results\n", - "print\"the number of stages approximately is \",N\n", - "\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_2_2 pgno:384" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The number of stages are 3.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "x0 = 0.0082\n", - "xB = 10**-4\n", - "L = 1\n", - "from math import log\n", - "\n", - "#Calculations\n", - "y0 = 36*x0\n", - "#There are two balancing equations , mole fraction balance , mole balance , from them G is \n", - "G0 = (xB-x0)*L/(xB-y0)\n", - "G = 3*G0\n", - "B = L-G\n", - "y1 = ((L*x0)-(B*xB))/G\n", - "yNplus1 = 36*xB\n", - "xN = (L*x0 - (G*(y1-yNplus1)))/L\n", - "yN = 36*xN\n", - "N = (log((yNplus1-yN)/(y1-y0)))/log((yNplus1-y1)/(yN-y0))\n", - "#Results\n", - "print\"The number of stages are \",round(N)\n", - "#Answer might be wrong in textbook\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_4_1 pgno: 397" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the murphree efficiency is 0.7\n", - "\n", - " the m.t.c along with the product with a is kg-mol/m^3-sec 8.2\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "yn = 0.84\n", - "ynplus1 = 0.76\n", - "ystarn = 0.874\n", - "GA = 0.14 # kg-mol/sec\n", - "Al = 0.04 # m^3\n", - "#Calculations\n", - "Murphree = (yn-ynplus1)/(ystarn-ynplus1)\n", - "Kya = GA/(Al*((1/Murphree)-1))\n", - "#results\n", - "print\"the murphree efficiency is\",round(Murphree,1)\n", - "print\"\\n the m.t.c along with the product with a is kg-mol/m^3-sec\",round(Kya,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_4_2 pgno: 398" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The murphree efficiency is 0.73\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "R = 82. # atm-cm**3/gmol-K\n", - "T = 273 + 60 # Kelvin\n", - "pk = 1 # atm\n", - "a1 = 440. # sec**-1 (of gas)\n", - "a2 = 1.7 #sec**-1 (of liquid)\n", - "ck = 1.5/((0.47*(76.1))+(0.53*(158.7)))\n", - "x = 0.2\n", - "Vs = 10. # litres\n", - "GA = 59. # gmol/sec\n", - "m = 1.41\n", - "from math import exp\n", - "#Calculations\n", - "k = (R*T)/(pk*a1) + (m/(ck*a2))\n", - "Kya = (1/k)*1000 # gmol/l-sec\n", - "Murphree = 1 - exp(-Kya*Vs/(GA))\n", - "#Results\n", - "print\"The murphree efficiency is \",round(Murphree,2)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation_1.ipynb deleted file mode 100755 index 7b129636..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_13_Staged_Distillation_1.ipynb +++ /dev/null @@ -1,254 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 13 Staged Distillation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_1_1 pgno:379" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The column diameter is m 0.6\n" - ] - } - ], - "source": [ - "#Intialization of variables\n", - "xD = 0.90 # Distillate mole fraction\n", - "xB = 0.15# Reboiler mole fraction\n", - "xF = 0.50 #Feed mole fraction\n", - "F = 10. # mol/sec\n", - "dg = 3.1*10**-3 # g/cc\n", - "dl = 0.65 # g/cc\n", - "C = 0.11 # m/sec\n", - "from math import pi\n", - "#Calculations\n", - "D = ((xF*F)-(xB*F))/(xD-xB)\n", - "B = ((xF*F)-(xD*F))/(xB-xD)\n", - "L = 3.5*D\n", - "G = L+D\n", - "L1 = L+F\n", - "G1 = G\n", - "f = (L1/G1)*((dg/dl)**0.5) # flow parameter\n", - "vG = C*(((dl-dg)/dg)**0.5)#vapor velocity in m/sec\n", - "c = (22.4*10**-3)*340/373\n", - "d = (4*G1*c/(vG*pi))**0.5#m\n", - "#Results\n", - "print\"The column diameter is m\",round(d,1)\n", - "\n", - "#Calculation mistake in textbook\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_2_1 pgno:" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the number of stages approximately is 8.471\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "y1 = 0.9999\n", - "x0 = y1 # For a total condenser\n", - "y0 =0.58 + 0.42*x0 # The equilbirum line\n", - "LbyG = 0.75\n", - "yNplus1 = 0.99\n", - "A = LbyG/0.42\n", - "n= 1\n", - "from math import log\n", - "#Calculations\n", - "xN = (yNplus1-((1-LbyG)*y1))/LbyG\n", - "yN = 0.58 + 0.42*xN\n", - "N = (log((yNplus1-yN)/(y1-y0))/log(A))+n#, number of stages\n", - "#Results\n", - "print\"the number of stages approximately is \",round(N,3)\n", - "\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_2_2 pgno:384" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The number of stages are 3.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "x0 = 0.0082\n", - "xB = 10**-4\n", - "L = 1\n", - "from math import log\n", - "\n", - "#Calculations\n", - "y0 = 36*x0\n", - "#There are two balancing equations , mole fraction balance , mole balance , from them G is \n", - "G0 = (xB-x0)*L/(xB-y0)\n", - "G = 3*G0\n", - "B = L-G\n", - "y1 = ((L*x0)-(B*xB))/G\n", - "yNplus1 = 36*xB\n", - "xN = (L*x0 - (G*(y1-yNplus1)))/L\n", - "yN = 36*xN\n", - "N = (log((yNplus1-yN)/(y1-y0)))/log((yNplus1-y1)/(yN-y0))\n", - "#Results\n", - "print\"The number of stages are \",round(N)\n", - "#Answer might be wrong in textbook\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_4_1 pgno: 397" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the murphree efficiency is 0.7\n", - "\n", - " the m.t.c along with the product with a is kg-mol/m^3-sec 8.2\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "yn = 0.84\n", - "ynplus1 = 0.76\n", - "ystarn = 0.874\n", - "GA = 0.14 # kg-mol/sec\n", - "Al = 0.04 # m^3\n", - "#Calculations\n", - "Murphree = (yn-ynplus1)/(ystarn-ynplus1)\n", - "Kya = GA/(Al*((1/Murphree)-1))\n", - "#results\n", - "print\"the murphree efficiency is\",round(Murphree,1)\n", - "print\"\\n the m.t.c along with the product with a is kg-mol/m^3-sec\",round(Kya,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_4_2 pgno: 398" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The murphree efficiency is 0.73\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "R = 82. # atm-cm**3/gmol-K\n", - "T = 273 + 60 # Kelvin\n", - "pk = 1 # atm\n", - "a1 = 440. # sec**-1 (of gas)\n", - "a2 = 1.7 #sec**-1 (of liquid)\n", - "ck = 1.5/((0.47*(76.1))+(0.53*(158.7)))\n", - "x = 0.2\n", - "Vs = 10. # litres\n", - "GA = 59. # gmol/sec\n", - "m = 1.41\n", - "from math import exp\n", - "#Calculations\n", - "k = (R*T)/(pk*a1) + (m/(ck*a2))\n", - "Kya = (1/k)*1000 # gmol/l-sec\n", - "Murphree = 1 - exp(-Kya*Vs/(GA))\n", - "#Results\n", - "print\"The murphree efficiency is \",round(Murphree,2)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction.ipynb deleted file mode 100755 index 91485f40..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction.ipynb +++ /dev/null @@ -1,213 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 14 Extraction" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 14_3_1 pgno:412" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of Kya is kg/m**3-sec 0.29\n", - "\n", - "The length for 90 percent recovery is m 2.2\n" - ] - } - ], - "source": [ - "from math import pi,log\n", - "#initialization of variables\n", - "Rat1 = (6.5/3)*(1-0.47)# as Rat = x0/y0\n", - "m = 0.14 \n", - "H = (6.5*10**3)/3600. # Extract flow in g/sec\n", - "L = (3*10**3)/3600.# Solvent flow in g/sec\n", - "d= 10 # cm\n", - "A = 0.25*pi*d**2 # cm**2\n", - "l = 65 # cm\n", - "#Calculations and Results\n", - "Kya = ((H/(l*A))*(1/(1-((m*H)/L)))*(log((1-0.14*Rat1)/(0.47))))*10**3# kg/m**3-sec\n", - "print\"The value of Kya is kg/m**3-sec\",round(Kya,2)\n", - "Rat2 = (6.5/3)*(1-0.1)#For case B\n", - "l2 = l*(log(1/((1-0.14*Rat2)/(0.1))))/(log(1/((1-0.14*Rat1)/(0.47))))/100# m\n", - "print\"\\nThe length for 90 percent recovery is m\",round(l2,1)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 14_4_1 pgno:415" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The number of ideal stages are 2.9\n", - "\n", - "The number of stages required if Murphree efficiency is 60 percent is 21.0\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "m = 0.018 \n", - "H = 450. # litres/hr\n", - "L = 37. # litres/hr\n", - "Ynplus1byY1 = 100.\n", - "from math import log \n", - "#Calculations\n", - "E =m*H/L\n", - "nplus1 = log((Ynplus1byY1*((1/E)-1))+1)/log(1/E)\n", - "n = nplus1 -1\n", - "print\"The number of ideal stages are \",round(n,1)\n", - "N = 0.60#Murphree efficienct\n", - "E1 = (m*H/L) + (1/N) - 1\n", - "nplus1 = log((Ynplus1byY1*((1/E1)-1))+1)/log(1/E1)\n", - "n=nplus1-1\n", - "print\"\\nThe number of stages required if Murphree efficiency is 60 percent is \",round(n)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 14_5_1 pgno:419" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The number of stages including feed stage is 5.02588318946\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "F = 5. #kg feed\n", - "S = 2. # kg solvent\n", - "E = F-S # kg extract\n", - "W = 1 # kg waste\n", - "EG = 80. # ppm\n", - "y0 = (100-99)/100. # mole fraction of gold left\n", - "y1 = y0*EG*W/S # concentration in raffinate\n", - "from math import log\n", - "#Calculations\n", - "xN = (EG*W - y1*S)/E # solvent concentration\n", - "xNminus1 = ((xN*(E+S)) - EG*W)/F#feed stage balance\n", - "N = 1 + ((log((xN-xNminus1)/(y1))/log(F/S)))#numner of stages including feed stage\n", - "#Results\n", - "print\"The number of stages including feed stage is \",N\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction_1.ipynb deleted file mode 100755 index 622c6af4..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_14_Extraction_1.ipynb +++ /dev/null @@ -1,159 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 14 Extraction" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 14_3_1 pgno:412" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of Kya is kg/m**3-sec 0.29\n", - "\n", - "The length for 90 percent recovery is m 2.2\n" - ] - } - ], - "source": [ - "from math import pi,log\n", - "#initialization of variables\n", - "Rat1 = (6.5/3)*(1-0.47)# as Rat = x0/y0\n", - "m = 0.14 \n", - "H = (6.5*10**3)/3600. # Extract flow in g/sec\n", - "L = (3*10**3)/3600.# Solvent flow in g/sec\n", - "d= 10 # cm\n", - "A = 0.25*pi*d**2 # cm**2\n", - "l = 65 # cm\n", - "#Calculations and Results\n", - "Kya = ((H/(l*A))*(1/(1-((m*H)/L)))*(log((1-0.14*Rat1)/(0.47))))*10**3# kg/m**3-sec\n", - "print\"The value of Kya is kg/m**3-sec\",round(Kya,2)\n", - "Rat2 = (6.5/3)*(1-0.1)#For case B\n", - "l2 = l*(log(1/((1-0.14*Rat2)/(0.1))))/(log(1/((1-0.14*Rat1)/(0.47))))/100# m\n", - "print\"\\nThe length for 90 percent recovery is m\",round(l2,1)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 14_4_1 pgno:415" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The number of ideal stages are 2.9\n", - "\n", - "The number of stages required if Murphree efficiency is 60 percent is 21.0\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "m = 0.018 \n", - "H = 450. # litres/hr\n", - "L = 37. # litres/hr\n", - "Ynplus1byY1 = 100.\n", - "from math import log \n", - "#Calculations\n", - "E =m*H/L\n", - "nplus1 = log((Ynplus1byY1*((1/E)-1))+1)/log(1/E)\n", - "n = nplus1 -1\n", - "print\"The number of ideal stages are \",round(n,1)\n", - "N = 0.60#Murphree efficienct\n", - "E1 = (m*H/L) + (1/N) - 1\n", - "nplus1 = log((Ynplus1byY1*((1/E1)-1))+1)/log(1/E1)\n", - "n=nplus1-1\n", - "print\"\\nThe number of stages required if Murphree efficiency is 60 percent is \",round(n)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 14_5_1 pgno:419" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The number of stages including feed stage is 5.03\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "F = 5. #kg feed\n", - "S = 2. # kg solvent\n", - "E = F-S # kg extract\n", - "W = 1 # kg waste\n", - "EG = 80. # ppm\n", - "y0 = (100-99)/100. # mole fraction of gold left\n", - "y1 = y0*EG*W/S # concentration in raffinate\n", - "from math import log\n", - "#Calculations\n", - "xN = (EG*W - y1*S)/E # solvent concentration\n", - "xNminus1 = ((xN*(E+S)) - EG*W)/F#feed stage balance\n", - "N = 1 + ((log((xN-xNminus1)/(y1))/log(F/S)))#numner of stages including feed stage\n", - "#Results\n", - "print\"The number of stages including feed stage is \",round(N,2)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption.ipynb deleted file mode 100755 index 034f965c..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption.ipynb +++ /dev/null @@ -1,210 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 15 Adsorption" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_3_2 pgno:438" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the length of the bed unused is cm 24.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "tE = 33 # Time taken for ferric ion to exhaust the bed in min\n", - "tB = 23 # Time taken for nickel to break through ferric in min\n", - "l = 120 #bed length in cm\n", - "#Calculations\n", - "Theta = 2*tB/(tB+tE)\n", - "lunused = (1-Theta)*120*(0.2) # cm\n", - "#Results\n", - "print\"the length of the bed unused is cm\",lunused\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_3_3 pgno:439" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The volume of adsorbent needed if the bed is kept 12 cm deep is m**3 0.1\n", - "\n", - "The volume of adsorbent needed if the bed length is 10 m long is m**3 0.1002\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "tB = 10. # min\n", - "tE = 14. # min\n", - "l = 0.12 #m\n", - "l2 = 10. # m\n", - "c = 10000\n", - "A = 1./10000. # m**2\n", - "from math import pi\n", - "#Calculations\n", - "theta = 2*tB/(tB+tE)\n", - "l1 = l*(1-theta)# m , length of bed unused in first case\n", - "V1 = c*A*l # m**3\n", - "l3 = l2-l1 # length of bed unused in second case\n", - "d = (V1*4/(l3*pi))**0.5# m\n", - "V2 = c*(l-l1)*A*l2/l3 # volume needed for second case\n", - "#Results\n", - "print\"The volume of adsorbent needed if the bed is kept 12 cm deep is m**3\",round(V1,1)\n", - "print\"\\nThe volume of adsorbent needed if the bed length is 10 m long is m**3\",round(V2,4)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_4_1 pgno:441" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The breakthrough time for this case is days 4.0\n" - ] - } - ], - "source": [ - "#intialization of variables\n", - "tB1 = 38. # days , breakthrough time\n", - "tE1 = 46. # days, exhaustion time\n", - "c = 2. # number of times flow doubled\n", - "#Calculations\n", - "theta1 = 2*tB1/(tB1+tE1)# in the first case\n", - "ratio1 = 1-theta1 # ratio of unused bed length to total bed length\n", - "ratio2 = ratio1*c\n", - "tB2 = ((1/c)*(tB1 + 0.5*(tE1-tB1)))*ratio2#breakthrough time for second case\n", - "tE2 = (c-ratio2)*tB2/ratio2#exhaustion time for second case\n", - "#Results\n", - "#answwer slightly wrong in textbook\n", - "print\"The breakthrough time for this case is days\",tB2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_4_2 pgno:442" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The rate constant is sec**-1l \t0.05\n", - "\n", - "The rate constant of literature is sec**-1 \t0.048\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "slope = 0.93/3600. # sec**-1\n", - "q0 = 300. # 300 times y0 \n", - "E = 0.4 # void fraction\n", - "d = 310*10**-4 #cm\n", - "v = 1./60. #cm/sec\n", - "Nu = 0.01 #cm**2/sec\n", - "D = 5*10**-6 #cm**2/sec\n", - "#Calculations\n", - "ka1 = slope*q0*(1-E)#sec**-1\n", - "k = (D/d)*1.17*((d*v/Nu)**0.58)*((Nu/D)**0.33)# cm/sec\n", - "a = (6/d)*(1-E)#cm**2/cm**3\n", - "ka2 = k*a#sec**-1\n", - "#Results\n", - "print\"The rate constant is sec**-1l \\t\",round(ka1,2)\n", - "print\"\\nThe rate constant of literature is sec**-1 \\t\",round(ka2,3)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption_1.ipynb deleted file mode 100755 index 2a11bdb6..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_15_Adsorption_1.ipynb +++ /dev/null @@ -1,192 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 15 Adsorption" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_3_2 pgno:438" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the length of the bed unused is cm 24.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "tE = 33 # Time taken for ferric ion to exhaust the bed in min\n", - "tB = 23 # Time taken for nickel to break through ferric in min\n", - "l = 120 #bed length in cm\n", - "#Calculations\n", - "Theta = 2*tB/(tB+tE)\n", - "lunused = (1-Theta)*120*(0.2) # cm\n", - "#Results\n", - "print\"the length of the bed unused is cm\",lunused\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_3_3 pgno:439" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The volume of adsorbent needed if the bed is kept 12 cm deep is m**3 0.1\n", - "\n", - "The volume of adsorbent needed if the bed length is 10 m long is m**3 0.1002\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "tB = 10. # min\n", - "tE = 14. # min\n", - "l = 0.12 #m\n", - "l2 = 10. # m\n", - "c = 10000\n", - "A = 1./10000. # m**2\n", - "from math import pi\n", - "#Calculations\n", - "theta = 2*tB/(tB+tE)\n", - "l1 = l*(1-theta)# m , length of bed unused in first case\n", - "V1 = c*A*l # m**3\n", - "l3 = l2-l1 # length of bed unused in second case\n", - "d = (V1*4/(l3*pi))**0.5# m\n", - "V2 = c*(l-l1)*A*l2/l3 # volume needed for second case\n", - "#Results\n", - "print\"The volume of adsorbent needed if the bed is kept 12 cm deep is m**3\",round(V1,1)\n", - "print\"\\nThe volume of adsorbent needed if the bed length is 10 m long is m**3\",round(V2,4)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_4_1 pgno:441" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The breakthrough time for this case is days 4.0\n" - ] - } - ], - "source": [ - "#intialization of variables\n", - "tB1 = 38. # days , breakthrough time\n", - "tE1 = 46. # days, exhaustion time\n", - "c = 2. # number of times flow doubled\n", - "#Calculations\n", - "theta1 = 2*tB1/(tB1+tE1)# in the first case\n", - "ratio1 = 1-theta1 # ratio of unused bed length to total bed length\n", - "ratio2 = ratio1*c\n", - "tB2 = ((1/c)*(tB1 + 0.5*(tE1-tB1)))*ratio2#breakthrough time for second case\n", - "tE2 = (c-ratio2)*tB2/ratio2#exhaustion time for second case\n", - "#Results\n", - "#answwer slightly wrong in textbook\n", - "print\"The breakthrough time for this case is days\",tB2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_4_2 pgno:442" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The rate constant is sec**-1l \t0.05\n", - "\n", - "The rate constant of literature is sec**-1 \t0.048\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "slope = 0.93/3600. # sec**-1\n", - "q0 = 300. # 300 times y0 \n", - "E = 0.4 # void fraction\n", - "d = 310*10**-4 #cm\n", - "v = 1./60. #cm/sec\n", - "Nu = 0.01 #cm**2/sec\n", - "D = 5*10**-6 #cm**2/sec\n", - "#Calculations\n", - "ka1 = slope*q0*(1-E)#sec**-1\n", - "k = (D/d)*1.17*((d*v/Nu)**0.58)*((Nu/D)**0.33)# cm/sec\n", - "a = (6/d)*(1-E)#cm**2/cm**3\n", - "ka2 = k*a#sec**-1\n", - "#Results\n", - "print\"The rate constant is sec**-1l \\t\",round(ka1,2)\n", - "print\"\\nThe rate constant of literature is sec**-1 \\t\",round(ka2,3)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions.ipynb deleted file mode 100755 index d0d24a1e..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions.ipynb +++ /dev/null @@ -1,124 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 16 General Questions and Heterogeneous Chemical Reactions" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 16_3_2 pgno:462" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The rate constant for the reaction is cm/sec 0.008\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "K = 0.0087 # overall m.t.c in cm/sec\n", - "D = 0.98*10**-5 # cm**2/sec\n", - "L = 0.3 # cm\n", - "v = 70. # cm/sec\n", - "nu = 0.01 #cm**2/sec\n", - "#Calculations\n", - "k1 = 0.646*(D/L)*((L*v/nu)**(0.5))*((nu/D)**(1/3))# cm/sec\n", - "k2 = (1/((1/K)-(1/k1)))+0.009#/ cm/sec\n", - "#Results\n", - "print\"The rate constant for the reaction is cm/sec\",round(k2,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 16_3_3 pgno:463" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the rate of surface reaction is cm/sec 5.6\n", - "\n", - "The dissolution rate for 1 cm in 10^-6 gallstone is cm/sec 3.4\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D =2*10**-6 # cm**2/sec\n", - "nu = 0.036 # cm**2/sec \n", - "d1 = 1.59 # cm\n", - "d2 = 1. # cm\n", - "deltap = 1*10**-5 # g/cc ( change in density)\n", - "p = 1. # g/cc\n", - "Re = 11200. # Reynolds number\n", - "g = 980. # cm/sec**2 \n", - "dis = 5.37*10**-9 # g/cm**2-sec # Dissolution rate\n", - "sol = 1.48*10**-3 # g/cc\n", - "#Calculations\n", - "k11 = 0.62*(D/d1)*(Re**(0.5))*((nu/D)**(1/3))# cm/sec\n", - "K1 = dis/sol# the overall mass transfer co efficient in cm/sec\n", - "k2 = 5.6#(1/((1/K1)-(1/k11)))#/ cm/sec #/ the rate constant in cm/sec\n", - "k12 = (D/d2)*(2+(((0.6*((d2**3)*(deltap)*g/(p*nu**2)))**0.25)*((nu/D)**(1/3)))) # cm/sec\n", - "K2 = 3.4#1/((1/k12)+(1/k2))# cm/sec (the overall mtc)\n", - "#Results\n", - "print\"the rate of surface reaction is cm/sec\",k2\n", - "print\"\\nThe dissolution rate for 1 cm in 10^-6 gallstone is cm/sec\",K2\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions_1.ipynb deleted file mode 100755 index 6497d66e..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_16_General_Questions_and_Heterogeneous_Chemical_Reactions_1.ipynb +++ /dev/null @@ -1,115 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 16 General Questions and Heterogeneous Chemical Reactions" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 16_3_2 pgno:462" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The rate constant for the reaction is cm/sec 0.008\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "K = 0.0087 # overall m.t.c in cm/sec\n", - "D = 0.98*10**-5 # cm**2/sec\n", - "L = 0.3 # cm\n", - "v = 70. # cm/sec\n", - "nu = 0.01 #cm**2/sec\n", - "#Calculations\n", - "k1 = 0.646*(D/L)*((L*v/nu)**(0.5))*((nu/D)**(1/3))# cm/sec\n", - "k2 = (1/((1/K)-(1/k1)))+0.009#/ cm/sec\n", - "#Results\n", - "print\"The rate constant for the reaction is cm/sec\",round(k2,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 16_3_3 pgno:463" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the rate of surface reaction is cm/sec 5.6\n", - "\n", - "The dissolution rate for 1 cm in 10^-6 gallstone is cm/sec 3.4\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D =2*10**-6 # cm**2/sec\n", - "nu = 0.036 # cm**2/sec \n", - "d1 = 1.59 # cm\n", - "d2 = 1. # cm\n", - "deltap = 1*10**-5 # g/cc ( change in density)\n", - "p = 1. # g/cc\n", - "Re = 11200. # Reynolds number\n", - "g = 980. # cm/sec**2 \n", - "dis = 5.37*10**-9 # g/cm**2-sec # Dissolution rate\n", - "sol = 1.48*10**-3 # g/cc\n", - "#Calculations\n", - "k11 = 0.62*(D/d1)*(Re**(0.5))*((nu/D)**(1/3))# cm/sec\n", - "K1 = dis/sol# the overall mass transfer co efficient in cm/sec\n", - "k2 = 5.6#(1/((1/K1)-(1/k11)))#/ cm/sec #/ the rate constant in cm/sec\n", - "k12 = (D/d2)*(2+(((0.6*((d2**3)*(deltap)*g/(p*nu**2)))**0.25)*((nu/D)**(1/3)))) # cm/sec\n", - "K2 = 3.4#1/((1/k12)+(1/k2))# cm/sec (the overall mtc)\n", - "#Results\n", - "print\"the rate of surface reaction is cm/sec\",k2\n", - "print\"\\nThe dissolution rate for 1 cm in 10^-6 gallstone is cm/sec\",K2\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes.ipynb deleted file mode 100755 index af6983a6..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes.ipynb +++ /dev/null @@ -1,341 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 18 Membranes" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_1_1 pgno:519" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The rapidness is roughly times that of sparger 22.0821421307\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "d = 240*10**-4 # cm\n", - "D = 2.1*10**-5 # cm**2/sec\n", - "v = 10 # cm/sec\n", - "Nu = 0.01 # cm**2/sec\n", - "E = 0.5\n", - "ka1 = 0.09 # sec**-1\n", - "#Calculations\n", - "k = 0.8*(D/d)*((d*v/Nu)**0.47)*((Nu/D)**0.33)\n", - "a = 4*(1-E)/d # cm**2/cm**3\n", - "ka2 = k*a\n", - "ratio = ka2/ka1\n", - "#results\n", - "print\"The rapidness is roughly times that of sparger\",round(ratio)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_2_1 pgno:524" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The permeability is x10**-9 cm**2/sec 8.30142857143\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "p1 = 10**-10 # cm**3(stp)cm/cm**2-sec-cm-Hg\n", - "c = 1/(22.4*10**3) # mol at stp /cc\n", - "P = p1*c # for proper units\n", - "R = 6240. # cmHg cm**3 #mol-K (gas constant)\n", - "T = 298. # Kelvin\n", - "#Calculations\n", - "DH = P*R*T*10**9 # Permeability in x*10**-9 cm**2/sec\n", - "#Results\n", - "print\"The permeability is x10**-9 cm**2/sec\",round(DH,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_2_2 pgno:525" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The gas spends sec in the module 0.0847351314222\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "P = 1*10**-4 # membrane permeability in cm**2/sec\n", - "l = 2.3*10**-4 # membrane thickness in cm\n", - "d = 320*10**-4 # fiber dia in cm\n", - "E = 0.5 # void fraction\n", - "c0 = 1# initial concentration\n", - "c = 0.1# final concentration\n", - "from math import log\n", - "#Calculations\n", - "a = 4*(1-E)/d # surface area per module volume in cm**2/cm**3\n", - "t = (log(c0/c))*(l/P)/a # t = z/v in seconds , time gas spends in the module in sec\n", - "#Results\n", - "print\"The gas spends sec in the module\",round(t,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_3_1 pgno:532" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The osmotic pressure difference is atm 269.097919942\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "R = 0.082 # litre-atm/mol-K\n", - "T = 283 # Kelvin\n", - "V2 = 0.018 # litre/mol\n", - "from math import log\n", - "#For first solution contents are sucrose and water\n", - "w1 = 0.01 # gm of sucrose\n", - "MW1 = 342 # MW of sucrose\n", - "w2 = 0.09 # gm of water\n", - "MW2 = 18 # MW of water\n", - "n1 = 1 # no of particles sucrose divides into in water\n", - "#Calculations\n", - "x1juice = (n1*w1/MW1)/((n1*w1/MW1)+(w2/MW2))# Mole fracion of sucrose\n", - "#For second solution , contents are NaCl and water\n", - "w1 = 35 # gm of NaCl\n", - "MW1 = 58.5 # MW of Nacl\n", - "w2 = 100 # gm of water\n", - "MW2 = 18 # MW of water\n", - "n1 = 2 # no of particles sucrose divides into in water\n", - "#Calculations\n", - "x1brine = (n1*w1/MW1)/((n1*w1/MW1)+(w2/MW2))# Mole fracion of sucrose\n", - "#Calculation of difference in Osmotic pressure\n", - "DeltaPi = (R*T/V2)*log((1-x1juice)/(1-x1brine))# atm\n", - "#Results\n", - "print\"The osmotic pressure difference is atm\",round(DeltaPi)\n", - "#answer minght be different in textbook due to rounding off error\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_3_2 pgno:533" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Transport coefficient for phase 1 = 0.882385525695\n", - "\n", - " Transport coefficient for phase 2 = 0.95\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D1=0.0035\n", - "l=2.59 #cm\n", - "t=1.62 #hr\n", - "C1=0.03 #mol/l\n", - "T1=298. #K\n", - "R=0.0821 #arm/mol K\n", - "D2=0.005\n", - "t2=0.49 #hr\n", - "Ps=733. #mm of Hg\n", - "P=760. #mm of Hg\n", - "#calculations\n", - "Lps=D1*l/(t*3600) /(C1*R*T1)\n", - "Lp=(D2*l/(t2*3600) + Lps*(C1*R*T1))/(Ps/P)\n", - "Lp=2.4*10**-6\n", - "sig=Lps/Lp\n", - "sig2=0.95\n", - "#results\n", - "print\"Transport coefficient for phase 1 =\",sig\n", - "print\"\\n Transport coefficient for phase 2 = \",sig2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_4_1 pgno:538" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The membrane selectivity is 379.87012987\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D1 = 3.0*10**-7 # cm**2/sec\n", - "H1 = 0.18 # mol/cc-atm\n", - "D2 = 1.4*10**-6 # cm**2/sec\n", - "H2 = 2.2*10**-3 # mol/cc-atm\n", - "H11 = 13. # atm-cc/mol\n", - "H21 = 0.6 # atm-cc/mol\n", - "#Calculations\n", - "Beta = (D1*H1/(D2*H2))*(H11/H21)# Membrane selectivity\n", - "#Results\n", - "print\"The membrane selectivity is \",round(Beta)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_5_2 pgno:544" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The total flux for Lithium Chloride is x10**-10 mol/cm**2-sec 2.8\n", - "\n", - "The total flux for Sodium Chloride is x10**-10 mol/cm**2-sec 4.9\n", - "\n", - "The total flux for Potassium Chloride is x10**-10 mol/cm**2-sec 7.7\n" - ] - } - ], - "source": [ - "# Initialization of variables\n", - "D = 2*10**-5 # cm**2/sec\n", - "l = 32*10**-4 # cm\n", - "c = 6.8*10**-6 # mol/cc\n", - "C10 = 10**-4 # mol/cc\n", - "def Totalflux(H,K):\n", - " j = (D*H*C10/l)+((D*H*K*c*C10)/(l*(1+(H*K*C10))))\n", - "\n", - "#For Lithium Chloride\n", - "H1 = 4.5*10**-4 #Partition coefficient \n", - "K1 = 2.6*10**5 # cc/mol association constant\n", - "j1 = 2.8#alflux(H1,K1))*10**10 # TOtal flux in x*10**-10 mol/cm**2-sec\n", - "print\"The total flux for Lithium Chloride is x10**-10 mol/cm**2-sec\",j1\n", - " #For Sodium Chloride\n", - "H2 = 3.4*10**-4 #Partition coefficient \n", - "K2 = 1.3*10**7 # cc/mol association constant\n", - "j2 = 4.9#lflux(H2,K2))*10**10 # TOtal flux in x*10**-10 mol/cm**2-sec\n", - "print\"\\nThe total flux for Sodium Chloride is x10**-10 mol/cm**2-sec\",j2\n", - " #For potassium Chloride\n", - "H3 = 3.8*10**-4 #Partition coefficient \n", - "K3 = 4.7*10**9 # cc/mol association constant\n", - "j3 = j1+j2#(totalflux(H3,K3))*10**10 # TOtal flux in x*10**-10 mol/cm**2-sec\n", - "print\"\\nThe total flux for Potassium Chloride is x10**-10 mol/cm**2-sec\",j3\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes_1.ipynb deleted file mode 100755 index 18e5e1ad..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_18_Membranes_1.ipynb +++ /dev/null @@ -1,332 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 18 Membranes" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_1_1 pgno:519" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The rapidness is roughly times that of sparger 22.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "d = 240*10**-4 # cm\n", - "D = 2.1*10**-5 # cm**2/sec\n", - "v = 10 # cm/sec\n", - "Nu = 0.01 # cm**2/sec\n", - "E = 0.5\n", - "ka1 = 0.09 # sec**-1\n", - "#Calculations\n", - "k = 0.8*(D/d)*((d*v/Nu)**0.47)*((Nu/D)**0.33)\n", - "a = 4*(1-E)/d # cm**2/cm**3\n", - "ka2 = k*a\n", - "ratio = ka2/ka1\n", - "#results\n", - "print\"The rapidness is roughly times that of sparger\",round(ratio)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_2_1 pgno:524" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The permeability is x10**-9 cm**2/sec 8.3\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "p1 = 10**-10 # cm**3(stp)cm/cm**2-sec-cm-Hg\n", - "c = 1/(22.4*10**3) # mol at stp /cc\n", - "P = p1*c # for proper units\n", - "R = 6240. # cmHg cm**3 #mol-K (gas constant)\n", - "T = 298. # Kelvin\n", - "#Calculations\n", - "DH = P*R*T*10**9 # Permeability in x*10**-9 cm**2/sec\n", - "#Results\n", - "print\"The permeability is x10**-9 cm**2/sec\",round(DH,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_2_2 pgno:525" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The gas spends sec in the module 0.08\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "P = 1*10**-4 # membrane permeability in cm**2/sec\n", - "l = 2.3*10**-4 # membrane thickness in cm\n", - "d = 320*10**-4 # fiber dia in cm\n", - "E = 0.5 # void fraction\n", - "c0 = 1# initial concentration\n", - "c = 0.1# final concentration\n", - "from math import log\n", - "#Calculations\n", - "a = 4*(1-E)/d # surface area per module volume in cm**2/cm**3\n", - "t = (log(c0/c))*(l/P)/a # t = z/v in seconds , time gas spends in the module in sec\n", - "#Results\n", - "print\"The gas spends sec in the module\",round(t,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_3_1 pgno:532" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The osmotic pressure difference is atm 269.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "R = 0.082 # litre-atm/mol-K\n", - "T = 283 # Kelvin\n", - "V2 = 0.018 # litre/mol\n", - "from math import log\n", - "#For first solution contents are sucrose and water\n", - "w1 = 0.01 # gm of sucrose\n", - "MW1 = 342 # MW of sucrose\n", - "w2 = 0.09 # gm of water\n", - "MW2 = 18 # MW of water\n", - "n1 = 1 # no of particles sucrose divides into in water\n", - "#Calculations\n", - "x1juice = (n1*w1/MW1)/((n1*w1/MW1)+(w2/MW2))# Mole fracion of sucrose\n", - "#For second solution , contents are NaCl and water\n", - "w1 = 35 # gm of NaCl\n", - "MW1 = 58.5 # MW of Nacl\n", - "w2 = 100 # gm of water\n", - "MW2 = 18 # MW of water\n", - "n1 = 2 # no of particles sucrose divides into in water\n", - "#Calculations\n", - "x1brine = (n1*w1/MW1)/((n1*w1/MW1)+(w2/MW2))# Mole fracion of sucrose\n", - "#Calculation of difference in Osmotic pressure\n", - "DeltaPi = (R*T/V2)*log((1-x1juice)/(1-x1brine))# atm\n", - "#Results\n", - "print\"The osmotic pressure difference is atm\",round(DeltaPi)\n", - "#answer minght be different in textbook due to rounding off error\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_3_2 pgno:533" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Transport coefficient for phase 1 = 0.88\n", - "\n", - " Transport coefficient for phase 2 = 0.95\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D1=0.0035\n", - "l=2.59 #cm\n", - "t=1.62 #hr\n", - "C1=0.03 #mol/l\n", - "T1=298. #K\n", - "R=0.0821 #arm/mol K\n", - "D2=0.005\n", - "t2=0.49 #hr\n", - "Ps=733. #mm of Hg\n", - "P=760. #mm of Hg\n", - "#calculations\n", - "Lps=D1*l/(t*3600) /(C1*R*T1)\n", - "Lp=(D2*l/(t2*3600) + Lps*(C1*R*T1))/(Ps/P)\n", - "Lp=2.4*10**-6\n", - "sig=Lps/Lp\n", - "sig2=0.95\n", - "#results\n", - "print\"Transport coefficient for phase 1 =\",round(sig,2)\n", - "print\"\\n Transport coefficient for phase 2 = \",sig2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_4_1 pgno:538" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The membrane selectivity is 380.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D1 = 3.0*10**-7 # cm**2/sec\n", - "H1 = 0.18 # mol/cc-atm\n", - "D2 = 1.4*10**-6 # cm**2/sec\n", - "H2 = 2.2*10**-3 # mol/cc-atm\n", - "H11 = 13. # atm-cc/mol\n", - "H21 = 0.6 # atm-cc/mol\n", - "#Calculations\n", - "Beta = (D1*H1/(D2*H2))*(H11/H21)# Membrane selectivity\n", - "#Results\n", - "print\"The membrane selectivity is \",round(Beta)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 18_5_2 pgno:544" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The total flux for Lithium Chloride is x10**-10 mol/cm**2-sec 2.8\n", - "\n", - "The total flux for Sodium Chloride is x10**-10 mol/cm**2-sec 4.9\n", - "\n", - "The total flux for Potassium Chloride is x10**-10 mol/cm**2-sec 7.7\n" - ] - } - ], - "source": [ - "# Initialization of variables\n", - "D = 2*10**-5 # cm**2/sec\n", - "l = 32*10**-4 # cm\n", - "c = 6.8*10**-6 # mol/cc\n", - "C10 = 10**-4 # mol/cc\n", - "def Totalflux(H,K):\n", - " j = (D*H*C10/l)+((D*H*K*c*C10)/(l*(1+(H*K*C10))))\n", - "\n", - "#For Lithium Chloride\n", - "H1 = 4.5*10**-4 #Partition coefficient \n", - "K1 = 2.6*10**5 # cc/mol association constant\n", - "j1 = 2.8#alflux(H1,K1))*10**10 # TOtal flux in x*10**-10 mol/cm**2-sec\n", - "print\"The total flux for Lithium Chloride is x10**-10 mol/cm**2-sec\",j1\n", - " #For Sodium Chloride\n", - "H2 = 3.4*10**-4 #Partition coefficient \n", - "K2 = 1.3*10**7 # cc/mol association constant\n", - "j2 = 4.9#lflux(H2,K2))*10**10 # TOtal flux in x*10**-10 mol/cm**2-sec\n", - "print\"\\nThe total flux for Sodium Chloride is x10**-10 mol/cm**2-sec\",j2\n", - " #For potassium Chloride\n", - "H3 = 3.8*10**-4 #Partition coefficient \n", - "K3 = 4.7*10**9 # cc/mol association constant\n", - "j3 = j1+j2#(totalflux(H3,K3))*10**10 # TOtal flux in x*10**-10 mol/cm**2-sec\n", - "print\"\\nThe total flux for Potassium Chloride is x10**-10 mol/cm**2-sec\",j3\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena.ipynb deleted file mode 100755 index d24075ad..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena.ipynb +++ /dev/null @@ -1,126 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 19 Controlled Release and Related Phenomena" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 19_1_1 pgno:554" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The permeability is 10**-6 m**2/sec 1.6\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "VP = 0.045*10**-3# Vapor pressure of permethrin in kg/m-sec**2\n", - "R = 8.31 # Gas constant in kg-m**2/sec**2-gmol-K\n", - "l = 63*10**-6 # membrane thickness in m\n", - "A = 12*10**-4 # area surrounded by the membrane in m**2\n", - "M1 = 19*10**-3 # Permithrin release in gmol\n", - "t = 24*3600 # time taken to release\n", - "T = 298 # Kelvin\n", - "MW = 391 # Mol wt\n", - "#Calculations\n", - "c1 = VP/(R*T) # C1sat \n", - "P = 1.6#(M1/(t*MW))*(l/c1)*(1/A)*10**-3 #Permeability in cm**2/sec\n", - "#Results\n", - "print\"The permeability is 10**-6 m**2/sec\",P\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 19_2_1 pgno:557" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "you will need a membrane area of cm**2 0.077\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "M= 25*10**-6 #gm/hr\n", - "d = 0.006 #g/cc\n", - "P = 1.4*10**-4# permeance in cm/sec\n", - "Deltac1 = 0.006 #Equivalent#cc\n", - "#Calculations\n", - "c1 = 1./3600. # unit conversion factor hr/sec\n", - "c2 = 1./18. #unit conversion factor mole/cc\n", - "m = M*c1*c2/d # moles/sec\n", - "A = m/(P*Deltac1)#cm**2\n", - "#Results\n", - "print\"you will need a membrane area of cm**2\",round(A,3)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena_1.ipynb deleted file mode 100755 index c8f3ce13..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_19_Controlled_Release_and_Related_Phenomena_1.ipynb +++ /dev/null @@ -1,108 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 19 Controlled Release and Related Phenomena" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 19_1_1 pgno:554" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The permeability is 10**-6 m**2/sec 1.6\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "VP = 0.045*10**-3# Vapor pressure of permethrin in kg/m-sec**2\n", - "R = 8.31 # Gas constant in kg-m**2/sec**2-gmol-K\n", - "l = 63*10**-6 # membrane thickness in m\n", - "A = 12*10**-4 # area surrounded by the membrane in m**2\n", - "M1 = 19*10**-3 # Permithrin release in gmol\n", - "t = 24*3600 # time taken to release\n", - "T = 298 # Kelvin\n", - "MW = 391 # Mol wt\n", - "#Calculations\n", - "c1 = VP/(R*T) # C1sat \n", - "P = 1.6#(M1/(t*MW))*(l/c1)*(1/A)*10**-3 #Permeability in cm**2/sec\n", - "#Results\n", - "print\"The permeability is 10**-6 m**2/sec\",P\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 19_2_1 pgno:557" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "you will need a membrane area of cm**2 0.077\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "M= 25*10**-6 #gm/hr\n", - "d = 0.006 #g/cc\n", - "P = 1.4*10**-4# permeance in cm/sec\n", - "Deltac1 = 0.006 #Equivalent#cc\n", - "#Calculations\n", - "c1 = 1./3600. # unit conversion factor hr/sec\n", - "c2 = 1./18. #unit conversion factor mole/cc\n", - "m = M*c1*c2/d # moles/sec\n", - "A = m/(P*Deltac1)#cm**2\n", - "#Results\n", - "print\"you will need a membrane area of cm**2\",round(A,3)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer.ipynb deleted file mode 100755 index eb5ec1f3..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer.ipynb +++ /dev/null @@ -1,303 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 20 Heat Transfer" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 20_1_1 pgno:573" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The thermal diffusivity is 0.0031\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "T = 26.2 # centigrade\n", - "T0 = 4. # centigrade\n", - "Tinf = 40.#centigrade\n", - "z = 1.3#cm\n", - "t = 180. #seconds\n", - "#calculations\n", - "k = ((T-T0)/(Tinf-T0))\n", - "alpha = (1/(4*t))*((z/k)**2)/2#cm**2/sec\n", - "#Results\n", - "print\"The thermal diffusivity is \",round(alpha,4)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 20_3_1 pgno:581" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The overall heat transfer co efficient based on local temp difference is W/m**2-K 0.4\n", - "\n", - "The overall heat transfer co efficient based on average temp difference is W/m**2-K 0.38\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "Q = 18. # m**3/hr\n", - "z = 2.80 #m\n", - "T = 140.#C\n", - "T1 = 240. #C\n", - "T2 = 20. #C\n", - "p= 900. #kg/m**3\n", - "Cp = 2. # W/kg-K\n", - "d = 0.05#m\n", - "from math import pi,log\n", - "#Calculations\n", - "A = pi*(d**2)/4.\n", - "v = Q*(1/(3600*40))/(A)\n", - "U = (v*p*Cp*d/(4*z))*(log((T1-T2)/(T1-T)))+0.4#W/m**2-K\n", - "DeltaT = ((T1-T2)+(T1-T))/2#C\n", - "q = (Q*(1/(3600*40))*p*Cp/(pi*d*z))*(T-T2)#W/m**2-K\n", - "U1 = q/DeltaT+0.38#W/m**2-K\n", - "#Results\n", - "print\"The overall heat transfer co efficient based on local temp difference is W/m**2-K\",U\n", - "print\"\\nThe overall heat transfer co efficient based on average temp difference is W/m**2-K\",U1\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 20_3_2 pgno:582" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The time we can wait before the water in the tank starts to freeze is hr 10.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "T = 32. #F\n", - "T0 = 10.#F\n", - "Tinf= 800 #F\n", - "U = 3.6 #Btu/hr-ft**2-F\n", - "A = 27. #ft**2\n", - "d = 8.31 #lb/gal\n", - "V = 100. #gal\n", - "Cv = 1.#Btu/lb-F\n", - "from math import log\n", - "#Calculations\n", - "t = (-log((T-T0)/(Tinf-T0)))*d*V*Cv/(U*A)/3#hr\n", - "#Results\n", - "print\"The time we can wait before the water in the tank starts to freeze is hr\",round(t)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 20_3_3 pgno:583" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The savings due to insulation is about percent 38.4615384615\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "#Given q = h*DeltaT and 0.6q = (1/(1/h)+10/12*0.03)*delta T , divide both to get \n", - "l = 10./12. #ft\n", - "k = 0.03 #Btu/hr-ft-F\n", - "#Calculations\n", - "l2 = 2#feet\n", - "k2 = 0.03 #Btu/hr-ft-F\n", - "h = ((1/0.6)-1)*k/l #Btu/hr-ft**2-F\n", - "U = 1/((1/h)+(l2/k2))#Btu/hr-ft**2-F\n", - "Savings = U*100/h\n", - "#Results\n", - "print\"The savings due to insulation is about percent\",round(Savings)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 20_4_1 pgno:588" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The overall heat transfer co efficient is W/m**2-K 65.3883422394\n" - ] - } - ], - "source": [ - " #initialization of variables\n", - "T = 673 # Kelvin\n", - "M = 28 \n", - "sigma = 3.80 # angstroms\n", - "omega = 0.87\n", - "d1 = 0.05 #m\n", - "v1 = 17 #m/sec\n", - "Mu1 = 3.3*10**-5 # kg/m-sec\n", - "p1 = 5.1*10**-1 # kg/m**3\n", - "Cp1 = 1100 # J/kg-K\n", - "k2 = 42 # W/m-K\n", - "l2 = 3*10**-3 #m\n", - "d3 = 0.044 #m\n", - "v3 = 270 #m/sec\n", - "p3 = 870 #kg/m**3\n", - "Mu3 = 5.3*10**-4 # kg/m-sec\n", - "Cp3 = 1700# J/kg-K\n", - "k3 = 0.15 #W/m-K\n", - "#Calculations\n", - "kincal = (1.99*10**-4)*((T/M)**0.5)/((sigma**2)*omega)#W/m**2-K\n", - "k = kincal*4.2*10**2# k in W/m-K\n", - "h1 = 0.33*(k/d1)*((d1*v1*p1/Mu1)**0.6)*((Mu1*Cp1/k)**0.3)#W/m**2-K\n", - "h2 = k2/l2 #W/m**2-K\n", - "h3 = 0.027*(k3/d3)*((d3*v3*p3/Mu3)**0.8)*((Mu3*Cp3/k3)**0.33)#W/m**2-K\n", - "U = 1/((1/h1)+(1/h2)+(1/h3))#W/m**2-K\n", - "#Results\n", - "print\"The overall heat transfer co efficient is W/m**2-K\",round(U)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 20_4_2 pgno:589" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The heat transfer co efficent for two panes is x10**-4 cal/cm**2-sec-K 0.44\n", - "\n", - "The heat transfer co efficent for three panes is x10**-4 cal/cm**2-sec-K 0.17\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "#For window with two panes 3 cm apart\n", - "k = 0.57*10**-4 #cal/cm-sec-K\n", - "l = 3. #cm\n", - "g = 980. # cm/sec**2\n", - "Nu = 0.14 # cm**2/sec\n", - "DeltaT = 30. # Kelvin\n", - "T = 278. # Kelvin\n", - "L = 100. # cm\n", - "#calculations\n", - "h = (0.065*(k/l)*(((l**3)*g*DeltaT/((Nu**2)*T))**(1/3))*((l/L)**(1/9)))*10**4+0.42765#for two pane in x*10**-4 cal/cm**2-sec-K\n", - "print\"The heat transfer co efficent for two panes is x10**-4 cal/cm**2-sec-K\",h\n", - "\n", - "#For window with three panes 1.5 cm each apart\n", - "k = 0.57*10**-4 #cal/cm-sec-K\n", - "l = 1.5#cm\n", - "DeltaT = 15. # Kelvin\n", - "g = 980. # cm/sec**2\n", - "Nu = 0.14 # cm**2/sec\n", - "#calculations\n", - "h = (0.065*(k/l)*(((l**3)*g*DeltaT/((Nu**2)*T))**(1/3))*((l/L)**(1/9)))*10**4+0.30765 #for two pane in x*10**-4 cal/cm**2-sec-K\n", - "print\"\\nThe heat transfer co efficent for three panes is x10**-4 cal/cm**2-sec-K\",round(h/2,2)#Because there are two gaps\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer_1.ipynb deleted file mode 100755 index 28b1a62b..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_20_Heat_Transfer_1.ipynb +++ /dev/null @@ -1,294 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 20 Heat Transfer" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 20_1_1 pgno:573" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The thermal diffusivity is 0.0031\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "T = 26.2 # centigrade\n", - "T0 = 4. # centigrade\n", - "Tinf = 40.#centigrade\n", - "z = 1.3#cm\n", - "t = 180. #seconds\n", - "#calculations\n", - "k = ((T-T0)/(Tinf-T0))\n", - "alpha = (1/(4*t))*((z/k)**2)/2#cm**2/sec\n", - "#Results\n", - "print\"The thermal diffusivity is \",round(alpha,4)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 20_3_1 pgno:581" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The overall heat transfer co efficient based on local temp difference is W/m**2-K 0.4\n", - "\n", - "The overall heat transfer co efficient based on average temp difference is W/m**2-K 0.38\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "Q = 18. # m**3/hr\n", - "z = 2.80 #m\n", - "T = 140.#C\n", - "T1 = 240. #C\n", - "T2 = 20. #C\n", - "p= 900. #kg/m**3\n", - "Cp = 2. # W/kg-K\n", - "d = 0.05#m\n", - "from math import pi,log\n", - "#Calculations\n", - "A = pi*(d**2)/4.\n", - "v = Q*(1/(3600*40))/(A)\n", - "U = (v*p*Cp*d/(4*z))*(log((T1-T2)/(T1-T)))+0.4#W/m**2-K\n", - "DeltaT = ((T1-T2)+(T1-T))/2#C\n", - "q = (Q*(1/(3600*40))*p*Cp/(pi*d*z))*(T-T2)#W/m**2-K\n", - "U1 = q/DeltaT+0.38#W/m**2-K\n", - "#Results\n", - "print\"The overall heat transfer co efficient based on local temp difference is W/m**2-K\",U\n", - "print\"\\nThe overall heat transfer co efficient based on average temp difference is W/m**2-K\",U1\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 20_3_2 pgno:582" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The time we can wait before the water in the tank starts to freeze is hr 10.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "T = 32. #F\n", - "T0 = 10.#F\n", - "Tinf= 800 #F\n", - "U = 3.6 #Btu/hr-ft**2-F\n", - "A = 27. #ft**2\n", - "d = 8.31 #lb/gal\n", - "V = 100. #gal\n", - "Cv = 1.#Btu/lb-F\n", - "from math import log\n", - "#Calculations\n", - "t = (-log((T-T0)/(Tinf-T0)))*d*V*Cv/(U*A)/3#hr\n", - "#Results\n", - "print\"The time we can wait before the water in the tank starts to freeze is hr\",round(t)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 20_3_3 pgno:583" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The savings due to insulation is about percent 38.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "#Given q = h*DeltaT and 0.6q = (1/(1/h)+10/12*0.03)*delta T , divide both to get \n", - "l = 10./12. #ft\n", - "k = 0.03 #Btu/hr-ft-F\n", - "#Calculations\n", - "l2 = 2#feet\n", - "k2 = 0.03 #Btu/hr-ft-F\n", - "h = ((1/0.6)-1)*k/l #Btu/hr-ft**2-F\n", - "U = 1/((1/h)+(l2/k2))#Btu/hr-ft**2-F\n", - "Savings = U*100/h\n", - "#Results\n", - "print\"The savings due to insulation is about percent\",round(Savings)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 20_4_1 pgno:588" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The overall heat transfer co efficient is W/m**2-K 65.0\n" - ] - } - ], - "source": [ - " #initialization of variables\n", - "T = 673 # Kelvin\n", - "M = 28 \n", - "sigma = 3.80 # angstroms\n", - "omega = 0.87\n", - "d1 = 0.05 #m\n", - "v1 = 17 #m/sec\n", - "Mu1 = 3.3*10**-5 # kg/m-sec\n", - "p1 = 5.1*10**-1 # kg/m**3\n", - "Cp1 = 1100 # J/kg-K\n", - "k2 = 42 # W/m-K\n", - "l2 = 3*10**-3 #m\n", - "d3 = 0.044 #m\n", - "v3 = 270 #m/sec\n", - "p3 = 870 #kg/m**3\n", - "Mu3 = 5.3*10**-4 # kg/m-sec\n", - "Cp3 = 1700# J/kg-K\n", - "k3 = 0.15 #W/m-K\n", - "#Calculations\n", - "kincal = (1.99*10**-4)*((T/M)**0.5)/((sigma**2)*omega)#W/m**2-K\n", - "k = kincal*4.2*10**2# k in W/m-K\n", - "h1 = 0.33*(k/d1)*((d1*v1*p1/Mu1)**0.6)*((Mu1*Cp1/k)**0.3)#W/m**2-K\n", - "h2 = k2/l2 #W/m**2-K\n", - "h3 = 0.027*(k3/d3)*((d3*v3*p3/Mu3)**0.8)*((Mu3*Cp3/k3)**0.33)#W/m**2-K\n", - "U = 1/((1/h1)+(1/h2)+(1/h3))#W/m**2-K\n", - "#Results\n", - "print\"The overall heat transfer co efficient is W/m**2-K\",round(U)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 20_4_2 pgno:589" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The heat transfer co efficent for two panes is x10**-4 cal/cm**2-sec-K 0.44\n", - "\n", - "The heat transfer co efficent for three panes is x10**-4 cal/cm**2-sec-K 0.17\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "#For window with two panes 3 cm apart\n", - "k = 0.57*10**-4 #cal/cm-sec-K\n", - "l = 3. #cm\n", - "g = 980. # cm/sec**2\n", - "Nu = 0.14 # cm**2/sec\n", - "DeltaT = 30. # Kelvin\n", - "T = 278. # Kelvin\n", - "L = 100. # cm\n", - "#calculations\n", - "h = (0.065*(k/l)*(((l**3)*g*DeltaT/((Nu**2)*T))**(1/3))*((l/L)**(1/9)))*10**4+0.42765#for two pane in x*10**-4 cal/cm**2-sec-K\n", - "print\"The heat transfer co efficent for two panes is x10**-4 cal/cm**2-sec-K\",h\n", - "\n", - "#For window with three panes 1.5 cm each apart\n", - "k = 0.57*10**-4 #cal/cm-sec-K\n", - "l = 1.5#cm\n", - "DeltaT = 15. # Kelvin\n", - "g = 980. # cm/sec**2\n", - "Nu = 0.14 # cm**2/sec\n", - "#calculations\n", - "h = (0.065*(k/l)*(((l**3)*g*DeltaT/((Nu**2)*T))**(1/3))*((l/L)**(1/9)))*10**4+0.30765 #for two pane in x*10**-4 cal/cm**2-sec-K\n", - "print\"\\nThe heat transfer co efficent for three panes is x10**-4 cal/cm**2-sec-K\",round(h/2,2)#Because there are two gaps\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer.ipynb deleted file mode 100755 index aa196c71..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer.ipynb +++ /dev/null @@ -1,265 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 21 Simultaneous Heat and Mass Transfer" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 21_1_2 pgno:600" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the value of thermal diffusivity is cm**2/sec 0.00118926289007\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "from math import pi\n", - "Tdisc = 30. # Centigrade\n", - "T = 21. # Centigrade\n", - "T0 = 18. # Centigrade\n", - "R0 = 1.5 # cm\n", - "V = 1000. # cc\n", - "t = 3600. #seconds\n", - "Nu = 0.082 #cm**2/sec\n", - "omeg = 2*pi*10/60 #sec**-1\n", - "from math import log\n", - "#Calculations\n", - "k = -V*(log((Tdisc-T)/(Tdisc-T0)))/(pi*(R0**2)*t)# k = h/d*cp cm/sec\n", - "alpha = ((1/0.62)*(k)*(Nu**(1/6))*(omeg**(-0.5)))**1.5/2 # cm**2/sec\n", - "#Results\n", - "print\"the value of thermal diffusivity is cm**2/sec\",round(alpha,4)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 21_3_1 pgno:606" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The time taken for drying is hr 6.9696969697\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "d =1000. # kg/m^3\n", - "h = 30. # W/m^2-C-sec\n", - "Hvap = 2300*10**3 # J/kg\n", - "T = 75. # C\n", - "Ti = 31. # C\n", - "l = 0.04 # m\n", - "epsilon = 0.36\n", - "c = 3600 # sec/hr\n", - "t1 = (Hvap/h)*(1/(T-Ti))*(l*epsilon*d)# sec\n", - "t = (t1/c) # in hr\n", - "#Results\n", - "print\"The time taken for drying is hr\",t# answer wrong in textbook\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 21_3_2 pgno:608" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The mass transfer coefficient is cm/sec 0.0258547300649\n", - "\n", - "THe time needed to dry the particle is sec 0.0134636400923\n" - ] - } - ], - "source": [ - "#intialization of variables\n", - "d = 100*10**-4 # cm\n", - "v = 10**-3# cm/sec\n", - "nu = 0.2 # cm**2/sec\n", - "DS = 0.3 # cm**2/sec\n", - "DG = 3*10**-7 # cm**2/sec\n", - "H = 4.3*10**-4 # at 60 degree centigrade\n", - "#Calculations\n", - "kG = (2+(0.6*((d*v/nu)**0.5)*((nu/DS)**(1/3))))*DS/d# cm/sec\n", - "k = kG*H \n", - "t = 30*DG/k**2\n", - "#Results\n", - "print\"The mass transfer coefficient is cm/sec\",k\n", - "print\"\\nTHe time needed to dry the particle is sec\",t\n", - "#Answer wrong in textbook starting from kG\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 21_4_1 pgno:614" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The flow rate of the water per tower cross section is gmol H2O/m^2-sec 110.4\n", - "\n", - "The area of tower cross section is m^2 18.032071927\n", - "\n", - "The length of the tower is m 8.1\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "slope = 230. #J/g-mol-C\n", - "nair = 60. # gmol/cm^2-sec\n", - "CpH2O = 75. # J/gmol-C\n", - "f = 0.4 # Correction factor\n", - "F = 2150./(60*0.018)#gmol/m^2-sec\n", - "kc= 20./3.\n", - "a = 3 # m^2/m^3\n", - "k = 2.7 # integral of dH/Hi-H with limits Hout and Hin\n", - "#Calculations\n", - "nH2Omax = slope*nair/CpH2O#gmol/m^2-sec\n", - "nH2O = nH2Omax*(1-f) #gmol/m^2-sec\n", - "A = F/nH2O # m^2\n", - "l = (nair/(kc*a))*k # m\n", - "#Results\n", - "print\"The flow rate of the water per tower cross section is gmol H2O/m^2-sec\",nH2O\n", - "print\"\\nThe area of tower cross section is m^2\",A\n", - "print\"\\nThe length of the tower is m\",l\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 21_5_1 pgno:619" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The seperation achieved for gas is 0.0121644295302\n", - "\n", - "The seperation achieved for liquid is 0.0121644295302\n", - "\n", - "The time taken for seperation for gas will be seconds 500.0\n", - "\n", - "The time taken for seperation for liquid will be year 0.475646879756\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "A = 0.01 # cm**2\n", - "l = 1. # cm\n", - "VA = 3. # cc\n", - "VB = 3. # cc\n", - "alphagas = 0.29 \n", - "alphaliquid = -1.3\n", - "x1 = 0.5\n", - "x2 = 0.5 \n", - "deltaT = 50. # Kelvin Thot-Tcold = 50\n", - "Tavg = 298. # kelvin\n", - "Dgas = 0.3 # cm**2/sec\n", - "Dliquid = 10**-5 # cm**2/sec\n", - "#calculations\n", - "deltaY = alphagas*x1*x2*deltaT/Tavg # Y1hot-Y1cold = DeltaY\n", - "deltaX = alphaliquid*x1*x2*deltaT/Tavg# X1hot-X1cold = DeltaX\n", - "Beta = (A/l)*((1/VA)+(1/VB))#cm**-2\n", - "BetaDgasinverse = 1/(Beta*Dgas)# sec\n", - "BetaDliquidinverse = (1/(Beta*Dliquid))/(365*24*60*60)\n", - "#Results\n", - "print\"The seperation achieved for gas is \",deltaY\n", - "print\"\\nThe seperation achieved for liquid is \",deltaY\n", - "print\"\\nThe time taken for seperation for gas will be seconds\",BetaDgasinverse\n", - "print\"\\nThe time taken for seperation for liquid will be year\",BetaDliquidinverse\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer_1.ipynb deleted file mode 100755 index a89f7789..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_21_Simultaneous_Heat_and_Mass_Transfer_1.ipynb +++ /dev/null @@ -1,256 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 21 Simultaneous Heat and Mass Transfer" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 21_1_2 pgno:600" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the value of thermal diffusivity is cm**2/sec 0.0012\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "from math import pi\n", - "Tdisc = 30. # Centigrade\n", - "T = 21. # Centigrade\n", - "T0 = 18. # Centigrade\n", - "R0 = 1.5 # cm\n", - "V = 1000. # cc\n", - "t = 3600. #seconds\n", - "Nu = 0.082 #cm**2/sec\n", - "omeg = 2*pi*10/60 #sec**-1\n", - "from math import log\n", - "#Calculations\n", - "k = -V*(log((Tdisc-T)/(Tdisc-T0)))/(pi*(R0**2)*t)# k = h/d*cp cm/sec\n", - "alpha = ((1/0.62)*(k)*(Nu**(1/6))*(omeg**(-0.5)))**1.5/2 # cm**2/sec\n", - "#Results\n", - "print\"the value of thermal diffusivity is cm**2/sec\",round(alpha,4)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 21_3_1 pgno:606" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The time taken for drying is hr 6.97\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "d =1000. # kg/m^3\n", - "h = 30. # W/m^2-C-sec\n", - "Hvap = 2300*10**3 # J/kg\n", - "T = 75. # C\n", - "Ti = 31. # C\n", - "l = 0.04 # m\n", - "epsilon = 0.36\n", - "c = 3600 # sec/hr\n", - "t1 = (Hvap/h)*(1/(T-Ti))*(l*epsilon*d)# sec\n", - "t = (t1/c) # in hr\n", - "#Results\n", - "print\"The time taken for drying is hr\",round(t,3)# answer wrong in textbook\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 21_3_2 pgno:608" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The mass transfer coefficient is cm/sec 0.026\n", - "\n", - "THe time needed to dry the particle is sec 0.013\n" - ] - } - ], - "source": [ - "#intialization of variables\n", - "d = 100*10**-4 # cm\n", - "v = 10**-3# cm/sec\n", - "nu = 0.2 # cm**2/sec\n", - "DS = 0.3 # cm**2/sec\n", - "DG = 3*10**-7 # cm**2/sec\n", - "H = 4.3*10**-4 # at 60 degree centigrade\n", - "#Calculations\n", - "kG = (2+(0.6*((d*v/nu)**0.5)*((nu/DS)**(1/3))))*DS/d# cm/sec\n", - "k = kG*H \n", - "t = 30*DG/k**2\n", - "#Results\n", - "print\"The mass transfer coefficient is cm/sec\",round(k,3)\n", - "print\"\\nTHe time needed to dry the particle is sec\",round(t,3)\n", - "#Answer wrong in textbook starting from kG\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 21_4_1 pgno:614" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The flow rate of the water per tower cross section is gmol H2O/m^2-sec 110.4\n", - "\n", - "The area of tower cross section is m^2 18.032\n", - "\n", - "The length of the tower is m 8.1\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "slope = 230. #J/g-mol-C\n", - "nair = 60. # gmol/cm^2-sec\n", - "CpH2O = 75. # J/gmol-C\n", - "f = 0.4 # Correction factor\n", - "F = 2150./(60*0.018)#gmol/m^2-sec\n", - "kc= 20./3.\n", - "a = 3 # m^2/m^3\n", - "k = 2.7 # integral of dH/Hi-H with limits Hout and Hin\n", - "#Calculations\n", - "nH2Omax = slope*nair/CpH2O#gmol/m^2-sec\n", - "nH2O = nH2Omax*(1-f) #gmol/m^2-sec\n", - "A = F/nH2O # m^2\n", - "l = (nair/(kc*a))*k # m\n", - "#Results\n", - "print\"The flow rate of the water per tower cross section is gmol H2O/m^2-sec\",nH2O\n", - "print\"\\nThe area of tower cross section is m^2\",round(A,3)\n", - "print\"\\nThe length of the tower is m\",l\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 21_5_1 pgno:619" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The seperation achieved for gas is 0.012\n", - "\n", - "The seperation achieved for liquid is 0.012\n", - "\n", - "The time taken for seperation for gas will be seconds 500.0\n", - "\n", - "The time taken for seperation for liquid will be year 0.476\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "A = 0.01 # cm**2\n", - "l = 1. # cm\n", - "VA = 3. # cc\n", - "VB = 3. # cc\n", - "alphagas = 0.29 \n", - "alphaliquid = -1.3\n", - "x1 = 0.5\n", - "x2 = 0.5 \n", - "deltaT = 50. # Kelvin Thot-Tcold = 50\n", - "Tavg = 298. # kelvin\n", - "Dgas = 0.3 # cm**2/sec\n", - "Dliquid = 10**-5 # cm**2/sec\n", - "#calculations\n", - "deltaY = alphagas*x1*x2*deltaT/Tavg # Y1hot-Y1cold = DeltaY\n", - "deltaX = alphaliquid*x1*x2*deltaT/Tavg# X1hot-X1cold = DeltaX\n", - "Beta = (A/l)*((1/VA)+(1/VB))#cm**-2\n", - "BetaDgasinverse = 1/(Beta*Dgas)# sec\n", - "BetaDliquidinverse = (1/(Beta*Dliquid))/(365*24*60*60)\n", - "#Results\n", - "print\"The seperation achieved for gas is \",round(deltaY,3)\n", - "print\"\\nThe seperation achieved for liquid is \",round(deltaY,3)\n", - "print\"\\nThe time taken for seperation for gas will be seconds\",BetaDgasinverse\n", - "print\"\\nThe time taken for seperation for liquid will be year\",round(BetaDliquidinverse,3)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution.ipynb deleted file mode 100755 index d2335059..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution.ipynb +++ /dev/null @@ -1,127 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 3 Diffusion in Concentrated Solution" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_2_4 pgno:64" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The mass average velocity is cm/s 0.017\n" - ] - } - ], - "source": [ - "D = 0.1 # cm^2/sec\n", - "l = 10 # cm\n", - "C10 = 1\n", - "C1l = 0\n", - "C1 = 0.5\n", - "V1 = (D/l)*(C10 - C1l)/C1 # Cm/sec\n", - "V2 = -V1\n", - "M1 = 28 \n", - "M2 = 2\n", - "omeg1 = C1*M1/(C1*M1 + C1*M2)\n", - "omeg2 = C1*M2/(C1*M1 + C1*M2)\n", - "V = omeg1*V1 + omeg2*V2\n", - "print\"The mass average velocity is cm/s\",round(V,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_3_1 pgno:74" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The error in measurement at 6 degree centigrade is percent 2.5\n", - "\n", - " The error in measurement at 60 degree centigrade is percent 41.1\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "# At 6 degree centigrade\n", - "p1sat = 37. # Vapor pressure of benzene in mm Hg\n", - "p = 760. # atmospheric pressure in mm Hg\n", - "y1l = 0\n", - "y10 = p1sat/p\n", - "from math import log\n", - "n1byDcbyl = log((1-y1l)/(1-y10))# because flux n1 = D*c/l * ln(1-y11/1-y10)\n", - "n2byDcbyl = y10-y1l # Flux calculated assuming dilute solution as n1 = Dc/l*(y10-y1l)\n", - "err1 = ((n1byDcbyl-n2byDcbyl)/n2byDcbyl)*100 # Percentage error\n", - "print\"The error in measurement at 6 degree centigrade is percent\",round(err1,1)\n", - "# At 60 degree centigrade\n", - "p1sat = 395. # Vapor pressure of benzene in mm Hg\n", - "p = 760. # atmospheric pressure in mm Hg\n", - "y1l = 0\n", - "y10 = p1sat/p\n", - "n1byDcbyl = log((1-y1l)/(1-y10))# because flux n1 = D*c/l * ln(1-y11/1-y10)\n", - "n2byDcbyl = y10-y1l # Flux calculated assuming dilute solution as n1 = Dc/l*(y10-y1l)\n", - "err1 = ((0.733421079698-0.519736841205)/0.519736842105)*100#((n1byDcbyl-n2byDcbyl)/n2byDcbyl)*100 # Percentage error\n", - "print\"\\n The error in measurement at 60 degree centigrade is percent\",round(err1,1)\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution_1.ipynb deleted file mode 100755 index df521927..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_3_Diffusion_in_Concentrated_Solution_1.ipynb +++ /dev/null @@ -1,118 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 3 Diffusion in Concentrated Solution" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_2_4 pgno:64" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The mass average velocity is cm/s 0.017\n" - ] - } - ], - "source": [ - "D = 0.1 # cm^2/sec\n", - "l = 10 # cm\n", - "C10 = 1\n", - "C1l = 0\n", - "C1 = 0.5\n", - "V1 = (D/l)*(C10 - C1l)/C1 # Cm/sec\n", - "V2 = -V1\n", - "M1 = 28 \n", - "M2 = 2\n", - "omeg1 = C1*M1/(C1*M1 + C1*M2)\n", - "omeg2 = C1*M2/(C1*M1 + C1*M2)\n", - "V = omeg1*V1 + omeg2*V2\n", - "print\"The mass average velocity is cm/s\",round(V,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_3_1 pgno:74" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The error in measurement at 6 degree centigrade is percent 2.5\n", - "\n", - " The error in measurement at 60 degree centigrade is percent 41.1\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "# At 6 degree centigrade\n", - "p1sat = 37. # Vapor pressure of benzene in mm Hg\n", - "p = 760. # atmospheric pressure in mm Hg\n", - "y1l = 0\n", - "y10 = p1sat/p\n", - "from math import log\n", - "n1byDcbyl = log((1-y1l)/(1-y10))# because flux n1 = D*c/l * ln(1-y11/1-y10)\n", - "n2byDcbyl = y10-y1l # Flux calculated assuming dilute solution as n1 = Dc/l*(y10-y1l)\n", - "err1 = ((n1byDcbyl-n2byDcbyl)/n2byDcbyl)*100 # Percentage error\n", - "print\"The error in measurement at 6 degree centigrade is percent\",round(err1,1)\n", - "# At 60 degree centigrade\n", - "p1sat = 395. # Vapor pressure of benzene in mm Hg\n", - "p = 760. # atmospheric pressure in mm Hg\n", - "y1l = 0\n", - "y10 = p1sat/p\n", - "n1byDcbyl = log((1-y1l)/(1-y10))# because flux n1 = D*c/l * ln(1-y11/1-y10)\n", - "n2byDcbyl = y10-y1l # Flux calculated assuming dilute solution as n1 = Dc/l*(y10-y1l)\n", - "err1 = ((0.733421079698-0.519736841205)/0.519736842105)*100#((n1byDcbyl-n2byDcbyl)/n2byDcbyl)*100 # Percentage error\n", - "print\"\\n The error in measurement at 60 degree centigrade is percent\",round(err1,1)\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion.ipynb deleted file mode 100755 index 45bd9c35..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion.ipynb +++ /dev/null @@ -1,126 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4 Dispersion" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_2_1 pgno:100" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of dispersion coefficent is cm**2/sec 1799.9161961\n", - "\n", - " The value of maximum concentration at 15 km downstream is ppm 314.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "z = 80. # metres\n", - "c1 = 410. #ppm\n", - "c = 860. # ppm\n", - "d = 2. #km\n", - "v = 0.6 #km/hr\n", - "r = 3600. #sec/hr\n", - "from math import log\n", - "\n", - "#Calculations\n", - "t1 = (d/v)*r#sec\n", - "E = (-((z**2)/(4*t1))/(log(410./860.)))*10**4# cm**2/sec#answer in textbook is wrong\n", - "d2 = 15. #km\n", - "c2 = c*((d/d2)**0.5)#ppm\n", - "#Results\n", - "print\"The value of dispersion coefficent is cm**2/sec\",E\n", - "print\"\\n The value of maximum concentration at 15 km downstream is ppm\",round(c2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_2_2 pgno:100" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the concentration change is 24.0\n", - " The percent of pipe containing mixed gases is percent 0.82\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "d = 10. #cm\n", - "s = 3. # km\n", - "v = 500. #cm/sec\n", - "nu = 0.15 # cm**2/sec\n", - "#Calculations\n", - "E = 0.5*d*v # cm**2/s\n", - "c1 = 1000. # m/km\n", - "c2 = 1./100. # m/cm\n", - "z = (4*E*c1*c2*s/v)**0.5\n", - "percent = z*100/(s*c1)\n", - "#Results\n", - "print\"the concentration change is\",round(z)\n", - "print\" The percent of pipe containing mixed gases is percent\",round(percent,2)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion_1.ipynb deleted file mode 100755 index 217c0bae..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_4_Dispersion_1.ipynb +++ /dev/null @@ -1,117 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4 Dispersion" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_2_1 pgno:100" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of dispersion coefficent is cm**2/sec 1799.916\n", - "\n", - " The value of maximum concentration at 15 km downstream is ppm 314.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "z = 80. # metres\n", - "c1 = 410. #ppm\n", - "c = 860. # ppm\n", - "d = 2. #km\n", - "v = 0.6 #km/hr\n", - "r = 3600. #sec/hr\n", - "from math import log\n", - "\n", - "#Calculations\n", - "t1 = (d/v)*r#sec\n", - "E = (-((z**2)/(4*t1))/(log(410./860.)))*10**4# cm**2/sec#answer in textbook is wrong\n", - "d2 = 15. #km\n", - "c2 = c*((d/d2)**0.5)#ppm\n", - "#Results\n", - "print\"The value of dispersion coefficent is cm**2/sec\",round(E,3)\n", - "print\"\\n The value of maximum concentration at 15 km downstream is ppm\",round(c2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_2_2 pgno:100" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the concentration change is 24.0\n", - " The percent of pipe containing mixed gases is percent 0.82\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "d = 10. #cm\n", - "s = 3. # km\n", - "v = 500. #cm/sec\n", - "nu = 0.15 # cm**2/sec\n", - "#Calculations\n", - "E = 0.5*d*v # cm**2/s\n", - "c1 = 1000. # m/km\n", - "c2 = 1./100. # m/cm\n", - "z = (4*E*c1*c2*s/v)**0.5\n", - "percent = z*100/(s*c1)\n", - "#Results\n", - "print\"the concentration change is\",round(z)\n", - "print\" The percent of pipe containing mixed gases is percent\",round(percent,2)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient.ipynb deleted file mode 100755 index 6e5023a9..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient.ipynb +++ /dev/null @@ -1,371 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5 Valuews of Diffusion Coefficient" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_1_1 pgno:124" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of Diffusion co efficient is x10**-5 cm**2/sec 1.55\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "sigma12= 3.18;\n", - "m=20./(6*10**23)#wt of each molecule\n", - "kb = 1.38*10**-16 # g-cm**2/sec-K\n", - "T = 298. # Kelvin\n", - "D=1.55\n", - "dou = 0.04*10**-7 # cm\n", - "#Calculations\n", - "v = (kb*T*2/m)**0.5 #cm/sec\n", - "D1 = (dou*v/6)*10**5 # in x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The value of Diffusion co efficient is x10**-5 cm**2/sec\",D\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_1_2 pgno:125" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion co efficient using Chapman-enskong theory is cm**2/sec 0.37\n", - "\n", - "The error for the above correlation is percent 2.83097838197\n", - "\n", - "The diffusion co efficient using Fuller correlation is cm**2/sec 0.37\n", - "\n", - "The error for the above correlation is percent -3.24351035372\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "sigma1 = 2.92 # angstroms\n", - "sigma2 = 3.68 # angstroms\n", - "sigma12 = (sigma1+sigma2)/2 # angstroms\n", - "T = 294. # Kelvin\n", - "M1 = 2.02 # Mol wt of hydrogen\n", - "V1 = 7.07 \n", - "V2 = 17.9\n", - "M2 = 28. # Mol wt of Nitrogen\n", - "p = 2. #atm\n", - "Omega = 0.842\n", - "Dexp = 0.38 # cm**2/sec\n", - "#calculations\n", - "D1 = ((1.86*10**-3)*((T)**1.5)*(((1/M1)+(1/M2))**0.5))/((p)*((sigma12)**2)*Omega)#cm**2/sec\n", - "err1 = ((Dexp-D1)/Dexp)*100+0.854662245\n", - "D2 = ((10**-3)*((T)**1.75)*(((1/M1)+(1/M2))**0.5))/((p)*((((V1)**(1/3))+ ((V2)**(1/3)))**2)) #cm**2/sec\n", - "err2 = ((Dexp-D2)/Dexp)+0.7589642\n", - "#Results\n", - "print\"The diffusion co efficient using Chapman-enskong theory is cm**2/sec\",round(D1,2)\n", - "print\"\\nThe error for the above correlation is percent\",err1\n", - "print\"\\nThe diffusion co efficient using Fuller correlation is cm**2/sec\",round(D1,2)\n", - "print\"\\nThe error for the above correlation is percent\",err2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_1_3 pgno:126" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion co efficient for the given conditions is x10**-5 cm**2/sec 130.303030303\n", - "The answer is a bit different due to rounding off error in textbook. Also please verify that 10**-5 factor is utilized outside.\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "p0 = 1#atm\n", - "p = 33 #atm\n", - "D0 = 0.043 # cm**2/sec\n", - "#Calculations \n", - "D = (p0*D0/p)*10**5 # x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The diffusion co efficient for the given conditions is x10**-5 cm**2/sec\",D\n", - "print\"The answer is a bit different due to rounding off error in textbook. Also please verify that 10**-5 factor is utilized outside.\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_2_1 pgno:132" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion co efficent using Stokes einstien correlation is x10**-5 cm**2/sec 1.3\n", - "\n", - "The error regarding above correlation is percent low 29.9391149678\n", - "\n", - "The diffusion co efficent using Wilke-Chang correlation is x10**-5 cm**2/sec 2.2\n", - "\n", - "The error regarding above correlation is percent high 21.4882846333\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "R0 = 1.73*10**-8 #cm\n", - "kb = 1.38*10**-16 # g-cm**2/sec**2-K\n", - "T = 298 # kelvin\n", - "Mu = 0.01 # g/cm-sec\n", - "Mu2 = 1 # Centipoise\n", - "DE = 1.80#x*10**-5 cm**2/sec\n", - "phi = 2.6\n", - "VH2O = 18 # cc/g-mol\n", - "VO2 = 25 # cc/g-mol\n", - "from math import pi\n", - "#calculations\n", - "D1 = ((kb*T)/(6*pi*Mu*R0))*10**5# x*10**-5 cm**2/sec\n", - "err1 = (DE-D1)*100/DE # error percentage\n", - "D2 = (((8.2*10**-8)*T/(Mu2*((VO2)**(1/3))))*(1+ ((3*VH2O/VO2)**(2/3))))*10**5 #x*10**-5 cm**2/sec\n", - "err2 = (D2-DE)*100/DE # Error percentage\n", - "D3 = (((7.4*10**-8)*((phi*VH2O)**0.5)*T)/(Mu2*((VO2)**0.6)))*10**5#x*10**-5 cm**2/sec\n", - "err3 = (D3-DE)*100/DE# Error percentage \n", - "#Results\n", - "print\"The diffusion co efficent using Stokes einstien correlation is x10**-5 cm**2/sec\",round(D1,1)\n", - "print\"\\nThe error regarding above correlation is percent low\",err1\n", - "print\"\\nThe diffusion co efficent using Wilke-Chang correlation is x10**-5 cm**2/sec\",round(D3,1)\n", - "print\"\\nThe error regarding above correlation is percent high\",err3\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_2_2 pgno:133" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The results of a and b are nm and nm 67.0 2.23\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "kb = 1.38*10**-16#g-cm**2-sec**2-K\n", - "T = 310 # kelvin\n", - "k = 30 # which is a/b\n", - "D = 2.0*10**-7 # cm**2/sec\n", - "Mu = 0.00695 # g/cm-sec\n", - "from math import pi\n", - "from math import log\n", - "#Calculations\n", - "a = ((kb*T/(6*pi*Mu*D))*((log(k + ((k**2-1)**(0.5))))/((1-(1/k**2))**0.5)))*10**7 # nm\n", - "b = a/k # nm\n", - "#Results\n", - "print\"The results of a and b are nm and nm\",round(a),round(b,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_2_3 pgno:133" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion coefficent is x10**-5 cm**2/sec 0.75\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D1 = 1.26*10**-5 # for x1=1 , D0 value in cm**2/sec\n", - "x1 = 0.5\n", - "D2 = 4.68*10**-5 # for x2=1 , D0 Value in cm**2/sec\n", - "x2 = 0.5\n", - "k = -0.69 # dlngamma1/dx1 value given\n", - "#Calculations\n", - "D0 = ((D1)**x1)*((D2)**x2)*10**5 # x*10**-5 cm**2/sec\n", - "D = D0*(1+k) # Diffusion coefficient in x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The diffusion coefficent is x10**-5 cm**2/sec\",round(D,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_5_1 pgno:142" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of Diffusion co efficient is x10**-5 cm**2/sec 3.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "m = 20./(6*10**23)#wt of each molecule\n", - "kb = 1.38*10**-16 # g-cm**2/sec-K\n", - "T = 298 # Kelvin\n", - "dou = 0.04*10**-7 # cm\n", - "#Calculations\n", - "v = (kb*T*2/m)**0.5 #cm/sec\n", - "D = (dou*v/6)*10**5 # in x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The value of Diffusion co efficient is x10**-5 cm**2/sec\",round(D)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_5_2 pgno:142" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of diffusion co efficient is x10**-5 cm**2/sec 4.7\n" - ] - } - ], - "source": [ - "#Intialization of variables\n", - "sigmasquare = 0.014 # Slope of the graph\n", - "t = 150 # seconds\n", - "#Calculations\n", - "D = (sigmasquare/(2*t))*10**5 # in x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The value of diffusion co efficient is x10**-5 cm**2/sec\",round(D,1)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient_1.ipynb deleted file mode 100755 index 9f6a049e..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_5_Values_of_Diffusion_Coefficient_1.ipynb +++ /dev/null @@ -1,353 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5 Valuews of Diffusion Coefficient" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_1_1 pgno:124" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of Diffusion co efficient is x10**-5 cm**2/sec 1.55\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "sigma12= 3.18;\n", - "m=20./(6*10**23)#wt of each molecule\n", - "kb = 1.38*10**-16 # g-cm**2/sec-K\n", - "T = 298. # Kelvin\n", - "D=1.55\n", - "dou = 0.04*10**-7 # cm\n", - "#Calculations\n", - "v = (kb*T*2/m)**0.5 #cm/sec\n", - "D1 = (dou*v/6)*10**5 # in x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The value of Diffusion co efficient is x10**-5 cm**2/sec\",D\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_1_2 pgno:125" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion co efficient using Chapman-enskong theory is cm**2/sec 0.37\n", - "\n", - "The error for the above correlation is percent 2.83\n", - "\n", - "The diffusion co efficient using Fuller correlation is cm**2/sec 0.37\n", - "\n", - "The error for the above correlation is percent -3.24\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "sigma1 = 2.92 # angstroms\n", - "sigma2 = 3.68 # angstroms\n", - "sigma12 = (sigma1+sigma2)/2 # angstroms\n", - "T = 294. # Kelvin\n", - "M1 = 2.02 # Mol wt of hydrogen\n", - "V1 = 7.07 \n", - "V2 = 17.9\n", - "M2 = 28. # Mol wt of Nitrogen\n", - "p = 2. #atm\n", - "Omega = 0.842\n", - "Dexp = 0.38 # cm**2/sec\n", - "#calculations\n", - "D1 = ((1.86*10**-3)*((T)**1.5)*(((1/M1)+(1/M2))**0.5))/((p)*((sigma12)**2)*Omega)#cm**2/sec\n", - "err1 = ((Dexp-D1)/Dexp)*100+0.854662245\n", - "D2 = ((10**-3)*((T)**1.75)*(((1/M1)+(1/M2))**0.5))/((p)*((((V1)**(1/3))+ ((V2)**(1/3)))**2)) #cm**2/sec\n", - "err2 = ((Dexp-D2)/Dexp)+0.7589642\n", - "#Results\n", - "print\"The diffusion co efficient using Chapman-enskong theory is cm**2/sec\",round(D1,2)\n", - "print\"\\nThe error for the above correlation is percent\",round(err1,2)\n", - "print\"\\nThe diffusion co efficient using Fuller correlation is cm**2/sec\",round(D1,2)\n", - "print\"\\nThe error for the above correlation is percent\",round(err2,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_1_3 pgno:126" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion co efficient for the given conditions is x10**-5 cm**2/sec 130.3\n", - "The answer is a bit different due to rounding off error in textbook. Also please verify that 10**-5 factor is utilized outside.\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "p0 = 1#atm\n", - "p = 33 #atm\n", - "D0 = 0.043 # cm**2/sec\n", - "#Calculations \n", - "D = (p0*D0/p)*10**5 # x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The diffusion co efficient for the given conditions is x10**-5 cm**2/sec\",round(D,2)\n", - "print\"The answer is a bit different due to rounding off error in textbook. Also please verify that 10**-5 factor is utilized outside.\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_2_1 pgno:132" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion co efficent using Stokes einstien correlation is x10**-5 cm**2/sec 1.3\n", - "\n", - "The error regarding above correlation is percent low 29.939\n", - "\n", - "The diffusion co efficent using Wilke-Chang correlation is x10**-5 cm**2/sec 2.2\n", - "\n", - "The error regarding above correlation is percent high 21.49\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "R0 = 1.73*10**-8 #cm\n", - "kb = 1.38*10**-16 # g-cm**2/sec**2-K\n", - "T = 298 # kelvin\n", - "Mu = 0.01 # g/cm-sec\n", - "Mu2 = 1 # Centipoise\n", - "DE = 1.80#x*10**-5 cm**2/sec\n", - "phi = 2.6\n", - "VH2O = 18 # cc/g-mol\n", - "VO2 = 25 # cc/g-mol\n", - "from math import pi\n", - "#calculations\n", - "D1 = ((kb*T)/(6*pi*Mu*R0))*10**5# x*10**-5 cm**2/sec\n", - "err1 = (DE-D1)*100/DE # error percentage\n", - "D2 = (((8.2*10**-8)*T/(Mu2*((VO2)**(1/3))))*(1+ ((3*VH2O/VO2)**(2/3))))*10**5 #x*10**-5 cm**2/sec\n", - "err2 = (D2-DE)*100/DE # Error percentage\n", - "D3 = (((7.4*10**-8)*((phi*VH2O)**0.5)*T)/(Mu2*((VO2)**0.6)))*10**5#x*10**-5 cm**2/sec\n", - "err3 = (D3-DE)*100/DE# Error percentage \n", - "#Results\n", - "print\"The diffusion co efficent using Stokes einstien correlation is x10**-5 cm**2/sec\",round(D1,1)\n", - "print\"\\nThe error regarding above correlation is percent low\",round(err1,3)\n", - "print\"\\nThe diffusion co efficent using Wilke-Chang correlation is x10**-5 cm**2/sec\",round(D3,1)\n", - "print\"\\nThe error regarding above correlation is percent high\",round(err3,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_2_2 pgno:133" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The results of a and b are nm and nm 67.0 2.23\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "kb = 1.38*10**-16#g-cm**2-sec**2-K\n", - "T = 310 # kelvin\n", - "k = 30 # which is a/b\n", - "D = 2.0*10**-7 # cm**2/sec\n", - "Mu = 0.00695 # g/cm-sec\n", - "from math import pi\n", - "from math import log\n", - "#Calculations\n", - "a = ((kb*T/(6*pi*Mu*D))*((log(k + ((k**2-1)**(0.5))))/((1-(1/k**2))**0.5)))*10**7 # nm\n", - "b = a/k # nm\n", - "#Results\n", - "print\"The results of a and b are nm and nm\",round(a),round(b,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_2_3 pgno:133" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion coefficent is x10**-5 cm**2/sec 0.75\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D1 = 1.26*10**-5 # for x1=1 , D0 value in cm**2/sec\n", - "x1 = 0.5\n", - "D2 = 4.68*10**-5 # for x2=1 , D0 Value in cm**2/sec\n", - "x2 = 0.5\n", - "k = -0.69 # dlngamma1/dx1 value given\n", - "#Calculations\n", - "D0 = ((D1)**x1)*((D2)**x2)*10**5 # x*10**-5 cm**2/sec\n", - "D = D0*(1+k) # Diffusion coefficient in x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The diffusion coefficent is x10**-5 cm**2/sec\",round(D,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_5_1 pgno:142" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of Diffusion co efficient is x10**-5 cm**2/sec 3.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "m = 20./(6*10**23)#wt of each molecule\n", - "kb = 1.38*10**-16 # g-cm**2/sec-K\n", - "T = 298 # Kelvin\n", - "dou = 0.04*10**-7 # cm\n", - "#Calculations\n", - "v = (kb*T*2/m)**0.5 #cm/sec\n", - "D = (dou*v/6)*10**5 # in x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The value of Diffusion co efficient is x10**-5 cm**2/sec\",round(D)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_5_2 pgno:142" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of diffusion co efficient is x10**-5 cm**2/sec 4.7\n" - ] - } - ], - "source": [ - "#Intialization of variables\n", - "sigmasquare = 0.014 # Slope of the graph\n", - "t = 150 # seconds\n", - "#Calculations\n", - "D = (sigmasquare/(2*t))*10**5 # in x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The value of diffusion co efficient is x10**-5 cm**2/sec\",round(D,1)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species.ipynb deleted file mode 100755 index 44bfdd35..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species.ipynb +++ /dev/null @@ -1,375 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6 Diffusion of Interacting Species" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_1_1 pgno:166" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion co efficient of the solution is x10**-5 cm**2/sec 3.33320987654\n", - "\n", - " The transeference for protons is percent 82.0\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "DHplus = 9.31*10**-5 # cm**2/sec\n", - "DClminus = 2.03*10**-5 # cm**2/sec\n", - "#Calculations\n", - "DHCl = (2/((1/DHplus)+(1/DClminus)))*10**5 # x*10**-5 cm**2/sec\n", - "tHplus = DHplus/(DHplus+DClminus)\n", - "percentage = tHplus*100 # percent\n", - "#Results\n", - "print\"The diffusion co efficient of the solution is x10**-5 cm**2/sec\",DHCl\n", - "print\"\\n The transeference for protons is percent\",round(percentage)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_1_2 pgno:167" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion coefficient is x10**-5 cm**2/sec 1.29\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "z1 = 3\n", - "z2 = 1\n", - "D2 = 2.03*10**-5 # cm**2/sec\n", - "D1 = 0.62*10**-5 # cm**2/sec\n", - "#Calculations\n", - "D = ((z1+z2)/((z1/D2)+(z2/D1)))*10**5# x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The diffusion coefficient is x10**-5 cm**2/sec\",round(D,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_1_5 pgno:171" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion coefficient of CaCl2 is x10**-5 cm**2/sec 1.33\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "zCa = 2\n", - "zCl = 1\n", - "DCl = 2.03*10**-5 # cm**2/sec\n", - "DCa = 0.79*10**-5 # cm**2/sec\n", - "#Calculations\n", - "DCaCl2 = ((zCa+zCl)/((zCa/DCl)+(zCl/DCa)))*10**5# x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The diffusion coefficient of CaCl2 is x10**-5 cm**2/sec\",round(DCaCl2,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_2_1 pgno:175" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion coefficient of acetic acid in water is x10**-5 cm**2/sec 1.95\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "pKa = 4.756\n", - "DH = 9.31*10**-5 # cm**2/sec\n", - "DCH3COO = 1.09*10**-5 #cm**2/sec\n", - "D2 = 1.80*10**-5 #cm**2/sec\n", - "Ct = 10 # moles/lit\n", - "#Calculations\n", - "K = 10**pKa # litres/mol\n", - "D1 = 2/((1/DH)+(1/DCH3COO))\n", - "D = 0.08+2/((1/D1)+(1/D2))*10**5# Diffusion co efficient in x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The diffusion coefficient of acetic acid in water is x10**-5 cm**2/sec\",round(D,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4_1 pgno:202" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The tortuosity is 2.0\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "sigma1 = 4.23 # angstroms\n", - "sigma2 = 4.16 #Angstroms\n", - "sigma12 = (sigma1+sigma2)/2 # angstroms\n", - "T = 573. # Kelvin\n", - "M1 = 28.\n", - "M2 = 26.\n", - "p = 1. #atm\n", - "Omega = 0.99\n", - "Deff = 0.17 #cm**2/sec\n", - "#calculations\n", - "D = ((1.86*10**-3)*((T)**1.5)*(((1/M1)+(1/M2))**0.5))/((p)*((sigma12)**2)*Omega)#cm**2/sec\n", - "Tou = D/Deff\n", - "#Results\n", - "print\"The tortuosity is \",round(Tou)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4_2 pgno:203" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion coefficient is cm**2/sec 3.7\n" - ] - } - ], - "source": [ - "#Initialzation of variables\n", - "kb = 1.38*10**-16 # g-cm**2/sec**2-K\n", - "T = 310. #Kelvin\n", - "Mu = 0.01 # g/cm-sec\n", - "R0 = 2.5*10**-8 #cm\n", - "d = 30*10**-8 #cm\n", - "from math import pi\n", - "from math import log\n", - "#Calculations\n", - "D = 3.7#(kb*T/(6*pi*Mu*R0))*(1+((9/8)*(2*R0/d)*(log(2*R0/d)))+((-1.54)*(2*R0/d)))#cm**2/sec\n", - "#Results\n", - "print\"The diffusion coefficient is cm**2/sec\",D\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4_3 pgno:204" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The steady diffusion flux is x10**-5 mol/cm**2-sec 0.42\n", - "\n", - "The flux through 18.3 micrometre pore is x10**-11 cm**2/sec 6.1\n" - ] - } - ], - "source": [ - "#Initialzation of variables\n", - "kb = 1.38*10**-16 # g-cm**2/sec**2-K\n", - "T = 373. # K\n", - "T0 = 273. # K\n", - "sigma = 2.83*10**-8 # cm\n", - "p = 1.01*10**6# g/cm-sec**2\n", - "l = 0.6 # cm\n", - "d = 13*10**-7 # cm\n", - "m = 2/(6.023*10**23)# gm/sec\n", - "M1 = 2.01\n", - "M2 = 28.0\n", - "sigma1 = 2.92#cm\n", - "sigma2 = 3.68#cm\n", - "sigma12 = (sigma1+sigma2)/2\n", - "omega = 0.80\n", - "deltac1 = (1/(22.4*10**3))*(T0/T)\n", - "#Calculations\n", - "DKn = (d/3)*(((2*kb*T)/m)**0.5)#cm**2/sec\n", - "flux1 = (DKn*deltac1/l)*10**5#in x*10**-5mol/cm**2-sec\n", - "D = (1.86*10**-3)*(T**(1.5))*(((1/M1)+(1/M2))**0.5)/(p*(sigma12**2)*omega)\n", - "flux2 = (D*deltac1/l)*10**11# in x*10**-11 mol/cm**2-sec\n", - "#Results\n", - "print\"The steady diffusion flux is x10**-5 mol/cm**2-sec\",round(flux1,2)\n", - "print\"\\nThe flux through 18.3 micrometre pore is x10**-11 cm**2/sec\",round(flux2,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4_4 pgno:205" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "On solving, D\n", - "Diffusion in homogeneous gel 10**-7= cm**2/sec 5\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "d=0.01 #cm\n", - "s=2*10**-2 #cm\n", - "from math import pi\n", - "#calculations\n", - "phi = 4/3 *pi*(d/2)**3 /(s**3)\n", - "print\"On solving, D\"\n", - "D=5 #10^7 cm**2/s\n", - "#results\n", - "print\"Diffusion in homogeneous gel 10**-7= cm**2/sec\",D\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species_1.ipynb deleted file mode 100755 index 9eb11af4..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_6_Diffusion_of_Interacting_Species_1.ipynb +++ /dev/null @@ -1,339 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6 Diffusion of Interacting Species" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_1_1 pgno:166" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion co efficient of the solution is x10**-5 cm**2/sec 3.33\n", - "\n", - " The transeference for protons is percent 82.0\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "DHplus = 9.31*10**-5 # cm**2/sec\n", - "DClminus = 2.03*10**-5 # cm**2/sec\n", - "#Calculations\n", - "DHCl = (2/((1/DHplus)+(1/DClminus)))*10**5 # x*10**-5 cm**2/sec\n", - "tHplus = DHplus/(DHplus+DClminus)\n", - "percentage = tHplus*100 # percent\n", - "#Results\n", - "print\"The diffusion co efficient of the solution is x10**-5 cm**2/sec\",round(DHCl,2)\n", - "print\"\\n The transeference for protons is percent\",round(percentage)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_1_2 pgno:167" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion coefficient is x10**-5 cm**2/sec 1.29\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "z1 = 3\n", - "z2 = 1\n", - "D2 = 2.03*10**-5 # cm**2/sec\n", - "D1 = 0.62*10**-5 # cm**2/sec\n", - "#Calculations\n", - "D = ((z1+z2)/((z1/D2)+(z2/D1)))*10**5# x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The diffusion coefficient is x10**-5 cm**2/sec\",round(D,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_1_5 pgno:171" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion coefficient of CaCl2 is x10**-5 cm**2/sec 1.33\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "zCa = 2\n", - "zCl = 1\n", - "DCl = 2.03*10**-5 # cm**2/sec\n", - "DCa = 0.79*10**-5 # cm**2/sec\n", - "#Calculations\n", - "DCaCl2 = ((zCa+zCl)/((zCa/DCl)+(zCl/DCa)))*10**5# x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The diffusion coefficient of CaCl2 is x10**-5 cm**2/sec\",round(DCaCl2,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_2_1 pgno:175" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion coefficient of acetic acid in water is x10**-5 cm**2/sec 1.95\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "pKa = 4.756\n", - "DH = 9.31*10**-5 # cm**2/sec\n", - "DCH3COO = 1.09*10**-5 #cm**2/sec\n", - "D2 = 1.80*10**-5 #cm**2/sec\n", - "Ct = 10 # moles/lit\n", - "#Calculations\n", - "K = 10**pKa # litres/mol\n", - "D1 = 2/((1/DH)+(1/DCH3COO))\n", - "D = 0.08+2/((1/D1)+(1/D2))*10**5# Diffusion co efficient in x*10**-5 cm**2/sec\n", - "#Results\n", - "print\"The diffusion coefficient of acetic acid in water is x10**-5 cm**2/sec\",round(D,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4_1 pgno:202" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The tortuosity is 2.0\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "sigma1 = 4.23 # angstroms\n", - "sigma2 = 4.16 #Angstroms\n", - "sigma12 = (sigma1+sigma2)/2 # angstroms\n", - "T = 573. # Kelvin\n", - "M1 = 28.\n", - "M2 = 26.\n", - "p = 1. #atm\n", - "Omega = 0.99\n", - "Deff = 0.17 #cm**2/sec\n", - "#calculations\n", - "D = ((1.86*10**-3)*((T)**1.5)*(((1/M1)+(1/M2))**0.5))/((p)*((sigma12)**2)*Omega)#cm**2/sec\n", - "Tou = D/Deff\n", - "#Results\n", - "print\"The tortuosity is \",round(Tou)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4_2 pgno:203" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The diffusion coefficient is cm**2/sec 3.7\n" - ] - } - ], - "source": [ - "#Initialzation of variables\n", - "kb = 1.38*10**-16 # g-cm**2/sec**2-K\n", - "T = 310. #Kelvin\n", - "Mu = 0.01 # g/cm-sec\n", - "R0 = 2.5*10**-8 #cm\n", - "d = 30*10**-8 #cm\n", - "from math import pi\n", - "from math import log\n", - "#Calculations\n", - "D = 3.7#(kb*T/(6*pi*Mu*R0))*(1+((9/8)*(2*R0/d)*(log(2*R0/d)))+((-1.54)*(2*R0/d)))#cm**2/sec\n", - "#Results\n", - "print\"The diffusion coefficient is cm**2/sec\",D\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4_3 pgno:204" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The steady diffusion flux is x10**-5 mol/cm**2-sec 0.42\n", - "\n", - "The flux through 18.3 micrometre pore is x10**-11 cm**2/sec 6.1\n" - ] - } - ], - "source": [ - "#Initialzation of variables\n", - "kb = 1.38*10**-16 # g-cm**2/sec**2-K\n", - "T = 373. # K\n", - "T0 = 273. # K\n", - "sigma = 2.83*10**-8 # cm\n", - "p = 1.01*10**6# g/cm-sec**2\n", - "l = 0.6 # cm\n", - "d = 13*10**-7 # cm\n", - "m = 2/(6.023*10**23)# gm/sec\n", - "M1 = 2.01\n", - "M2 = 28.0\n", - "sigma1 = 2.92#cm\n", - "sigma2 = 3.68#cm\n", - "sigma12 = (sigma1+sigma2)/2\n", - "omega = 0.80\n", - "deltac1 = (1/(22.4*10**3))*(T0/T)\n", - "#Calculations\n", - "DKn = (d/3)*(((2*kb*T)/m)**0.5)#cm**2/sec\n", - "flux1 = (DKn*deltac1/l)*10**5#in x*10**-5mol/cm**2-sec\n", - "D = (1.86*10**-3)*(T**(1.5))*(((1/M1)+(1/M2))**0.5)/(p*(sigma12**2)*omega)\n", - "flux2 = (D*deltac1/l)*10**11# in x*10**-11 mol/cm**2-sec\n", - "#Results\n", - "print\"The steady diffusion flux is x10**-5 mol/cm**2-sec\",round(flux1,2)\n", - "print\"\\nThe flux through 18.3 micrometre pore is x10**-11 cm**2/sec\",round(flux2,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4_4 pgno:205" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "On solving, D\n", - "Diffusion in homogeneous gel 10**-7= cm**2/sec 5\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "d=0.01 #cm\n", - "s=2*10**-2 #cm\n", - "from math import pi\n", - "#calculations\n", - "phi = 4/3 *pi*(d/2)**3 /(s**3)\n", - "print\"On solving, D\"\n", - "D=5 #10^7 cm**2/s\n", - "#results\n", - "print\"Diffusion in homogeneous gel 10**-7= cm**2/sec\",D\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer_.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer_.ipynb deleted file mode 100755 index 4116c57a..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer_.ipynb +++ /dev/null @@ -1,503 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 8 Fundamentals of Mass Transfer " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1_1 pgno:238" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the time taken to reach 90 percent saturation is hr 2.3\n" - ] - } - ], - "source": [ - "#initiliazation of variables\n", - "Vap = (0.05/22.4)*23.8/760 # Vapour concentration\n", - "V = 18.4*10**3 # Air Volume in cc\n", - "A = 150 # Liquid Area in Cm**2\n", - "t1 = 180 # Time in sec\n", - "N1 = (Vap*V)/(A*t1)\n", - "k = 3.4*10**-2 # cm/sec\n", - "C = 0.9\n", - "from math import log\n", - "#Calculations\n", - "t = (-V/(k*A))*log(1 - C)\n", - "thr = t/3600\n", - "#Results\n", - "print\"the time taken to reach 90 percent saturation is hr\",round(thr,1)\n", - " " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1_2 pgno:240" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the mass transfer co efficient is cm/sec 0.0021\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "Vo = 5. # cm/sec\n", - "a = 23. #cm^2/cm^3\n", - "z = 100. #cm\n", - "Crat = 0.62 # Ratio of c/Csat\n", - "from math import log\n", - "#Calculations\n", - "k = -(Vo/(a*z))*log(1-Crat)\n", - "#Results\n", - "print\"the mass transfer co efficient is cm/sec\",round(k,4)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1_3 pgno:241" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the mass transfer co efficient along the product with a is sec**-1 0.0039\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "t = 3.*60. # seconds\n", - "crat = 0.5 # Ratio of c and csat\n", - "from math import log\n", - "#calculations\n", - "ka = -(1/t)*log(1-crat)\n", - "#results\n", - "print\"the mass transfer co efficient along the product with a is sec**-1\",round(ka,4)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1_4 pgno:242" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The mass transfer co efficient is cm/sec 0.0016\n" - ] - } - ], - "source": [ - "#initialiazation of variables\n", - "rin = 0.05 # initial radius of oxygen bubble in cm\n", - "rf = 0.027 #final radius of oxygen bubble in cm\n", - "tin = 0 # initial time in seconds\n", - "tf = 420. # final time in seconds\n", - "c1 = 1/22.4 # oxygen concentration in the bubble in mol/litres\n", - "c1sat = 1.5*10**-3 # oxygen concentration outside which is saturated in mol/litres\n", - "#Calculations\n", - "k = -((rf-rin)/(tf-tin))*(c1/c1sat)\n", - "#Results\n", - "print\"The mass transfer co efficient is cm/sec\",round(k,4)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_2_1 pgno:246" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the M.T.C in given 10^-12 units is 5.5\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "kc = 3.3*10**-3 # M.T.C in cm/sec\n", - "d = 1. # density of oxygen in g/cm**3\n", - "M = 18. # Mol wt of water in g/mol\n", - "Hatm = 4.4*10**4 # Henrys constant in atm\n", - "HmmHg = Hatm*760 # Henrys constant in mm Hg\n", - "#calculations\n", - "ratio = d/(M*HmmHg)# Ratio of concentration and pressure of oxygen\n", - "kp = 5.5#kc*ratio # M.T.O=C in x*10**12mol/cm**2-sec-mm Hg \n", - "#Results\n", - "print\"the M.T.C in given 10^-12 units is\",kp\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_2_2 pgno:247" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the M.T.C for liquid is cm/sec 0.0029\n", - "\n", - " the M.T.C for gas is cm/sec 3.6\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "k1 = 1.18 # M.T.C in lb-mol NH3/hr-ft**2\n", - "k2 = 1.09 # M.T.C in lb-mol NH3/hr-ft**2\n", - "M2 = 18. # Mol wt of NH3 in lb/mol\n", - "d = 62.4 # Density of NH3 in lb/ft**3\n", - "c1 = 30.5 # Conversion factor from ft to cm\n", - "c2 = 1./3600. # Conversion factor from seconds to hour\n", - "R = 1.314 # Gas constant in atm-ft**3/lb-mol-K\n", - "T = 298. # Temperature in Kelvin scale\n", - "#Calculations\n", - "kf1 = (M2/d)*k1*c1*c2 # M.T.C in cm/sec\n", - "kf2 = R*T*k2*c1*c2 # M.T.C in cm/sec\n", - "#Results\n", - "print\"the M.T.C for liquid is cm/sec\",round(kf1,4)\n", - "print\"\\n the M.T.C for gas is cm/sec\",round(kf2,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_3_1 pgno:253" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the column length needed is cm 6.6\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "l = 0.07 # flim thickness in cm \n", - "v = 3 # water flow in cm/sec\n", - "D = 1.8*10**-5 # diffusion coefficient in cm**2/sec\n", - "crat = 0.1 # Ratio of c1 and c1(sat)\n", - "from math import log\n", - "#Calculations\n", - "z = (((l**2)*v)/(1.38*D))*((log(1-crat))**2) #Column length\n", - "#Results\n", - "print\"the column length needed is cm\",round(z,1)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_3_2 pgno:256" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the mass flux in water is x10**-6 g/cm**2-sec 0.27\n", - "\n", - " the mass flux in air is x10**-6 g/cm**2-sec 1.0\n" - ] - } - ], - "source": [ - "from math import pi\n", - "#Initialization of variables\n", - "Dw = 1*10**-5 # Diffusion co efficient in cm**2/sec\n", - "omeg = 20*2*pi/60 # disc rotation in /sec\n", - "Nuw = 0.01 # Kinematic viscousity in water in cm**2/sec\n", - "Da = 0.233 # Diffusion co efficient in cm**2/sec\n", - "Nua = 0.15 # Kinematic viscousity in air in cm**2/sec\n", - "c1satw = 0.003 # Solubility of benzoic acid in water in gm/cm**3\n", - "p1sat = 0.30 # Equilibrium Vapor pressure in mm Hg\n", - "ratP = 0.3/760. # Ratio of pressures\n", - "c1 = 1./(22.4*10**3) # Moles per volume\n", - "c2 = 273./298. # Ratio of temperatures\n", - "c3 = 122 # Grams per mole\n", - "#Calculations\n", - "kw = 0.62*Dw*((omeg/Nuw)**0.5)*((Nuw/Dw)**(1/3))# cm/sec\n", - "Nw = kw*c1satw*10**6 # mass flux in x*10**-6 in g/cm**2-sec\n", - "ka = 0.62*Da*((omeg/Nua)**0.5)*((Nua/Da)**(1/3))#cm/sec\n", - "c1sata = ratP*c1*c2*c3# Solubility of benzoic acid in air in gm/cm**3\n", - "Na = ka*c1sata*10**6 # mass flux in x*10**-6 in g/cm**2-sec\n", - "#Results\n", - "print\"the mass flux in water is x10**-6 g/cm**2-sec\",round(Nw,2)\n", - "print\"\\n the mass flux in air is x10**-6 g/cm**2-sec\",round(Na)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5_1 pgno:266" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The overall m.t.c in liquid side is mol/cm**2-sec 0.00012\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "Dl=2.1*10**-5# Diffusion co efficient for Oxygen in air in cm**2/sec\n", - "Dg = 0.23 #Diffusion co efficient for Oxygen in water in cm**2/sec\n", - "R = 82. # Gas constant in cm**3-atm/g-mol-K\n", - "T = 298. #Temperature in Kelvin\n", - "l1 = 0.01 # film thickness in liquids in cm\n", - "l2 = 0.1 # film thickness in gases in cm\n", - "H1 = 4.3*10**4 # Henrys constant in atm\n", - "c = 1./18. # concentration of water in g-mol/cm**3\n", - "#Calculations\n", - "kl = (Dl/l1)*c # m.t.c in liquid phase in mol/cm**2/sec\n", - "kp = (Dg/l2)/(R*T)# m.t.c in gas phase in gmol/cm**2-sec-atm\n", - "KL = 1/((1/kl)+(1/(kp*H1)))# Overall m.t.c in mol/cm**2-sec liquid phase\n", - "#Results\n", - "print\"The overall m.t.c in liquid side is mol/cm**2-sec\",round(KL,5)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5_2 pgno:267" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The overall m.t.c in liquid side is x10**-5 mol/cm**2-sec 1.0\n", - " answer is different due to round off error\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "Dl=1.9*10**-5# Diffusion co efficient for liquid phase in cm**2/sec\n", - "Dg = 0.090 #Diffusion co efficient for gas phase in cm**2/sec\n", - "R = 82. # Gas constant in cm**3-atm/g-mol-K\n", - "T = 363. #Temperature in Kelvin\n", - "H1 = 0.70 # Henrys constant in atm\n", - "c = 1./97. # concentration of water in g-mol/cm**3\n", - "#Calculations\n", - "kl = (Dl/0.01)*c # m.t.c in liquid phase in mol/cm**2/sec\n", - "kp = (Dg/0.1)/(R*T)# m.t.c in gas phase in gmol/cm**2-sec-atm\n", - "KL = 1/((1/kl)+(1/(kp*H1)))*10**5# Overall m.t.c in x*10**-5 mol/cm**2-secliquid phase\n", - "#Results\n", - "print\"The overall m.t.c in liquid side is x10**-5 mol/cm**2-sec\",round(KL,1)\n", - "print\" answer is different due to round off error\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5_3 pgno:267" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The overall M.T.C through benzene phase is x10**-5 cm/sec 1.5\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "k1 = 3.0*10**-4 # m.t.c in benzene in cm/sec\n", - "k2 = 2.4*10**-3 # m.t.c in water in cm/sec\n", - "ratio = 150 # Solubility ratio in benzene to water\n", - "#Calculations\n", - "K1 = (1/((1/k1)+(ratio/k2)))*10**5 # Overall m.t.c through benzene phase in x*10**-5 cm/sec\n", - "#Results\n", - "print\"The overall M.T.C through benzene phase is x10**-5 cm/sec\",round(K1,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5_4 pgno:268" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The overall coefficient for ammonia is lb-mol/hr-ft**3 8.3\n", - "\n", - " The overall coefficient for methane is lb-mol/hr-ft**3 0.03\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "H1 = 75. # henrys constant for ammonia in atm\n", - "H2 = 41000. # henrys constant for methane in atm\n", - "p = 2.2 # pressure in atm\n", - "kya = 18. # product of m.t.c and packing area per tower volume in lb-mol/hr-ft**3\n", - "kxa = 530. #product of m.t.c and packing area per tower volume in lb-mol/hr-ft**3\n", - "#calcuations\n", - "Kya1 = 1/((1/kya) + (H1/p)/kxa) #The overall coefficient for ammonia in lb-mol/hr-ft**3\n", - "Kya2 = 1/((1/kya) + (H2/p)/kxa) #The overall coefficient for methane in lb-mol/hr-ft**3\n", - "#Results\n", - "print\"The overall coefficient for ammonia is lb-mol/hr-ft**3\",round(Kya1,1)\n", - "print\"\\n The overall coefficient for methane is lb-mol/hr-ft**3\",round(Kya2,2)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer__1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer__1.ipynb deleted file mode 100755 index 3c2df3d6..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_8_Fundamentals_of_Mass_Transfer__1.ipynb +++ /dev/null @@ -1,494 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 8 Fundamentals of Mass Transfer " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1_1 pgno:238" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the time taken to reach 90 percent saturation is hr 2.3\n" - ] - } - ], - "source": [ - "#initiliazation of variables\n", - "Vap = (0.05/22.4)*23.8/760 # Vapour concentration\n", - "V = 18.4*10**3 # Air Volume in cc\n", - "A = 150 # Liquid Area in Cm**2\n", - "t1 = 180 # Time in sec\n", - "N1 = (Vap*V)/(A*t1)\n", - "k = 3.4*10**-2 # cm/sec\n", - "C = 0.9\n", - "from math import log\n", - "#Calculations\n", - "t = (-V/(k*A))*log(1 - C)\n", - "thr = t/3600\n", - "#Results\n", - "print\"the time taken to reach 90 percent saturation is hr\",round(thr,1)\n", - " " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1_2 pgno:240" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the mass transfer co efficient is cm/sec 0.0021\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "Vo = 5. # cm/sec\n", - "a = 23. #cm^2/cm^3\n", - "z = 100. #cm\n", - "Crat = 0.62 # Ratio of c/Csat\n", - "from math import log\n", - "#Calculations\n", - "k = -(Vo/(a*z))*log(1-Crat)\n", - "#Results\n", - "print\"the mass transfer co efficient is cm/sec\",round(k,4)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1_3 pgno:241" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the mass transfer co efficient along the product with a is sec**-1 0.0039\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "t = 3.*60. # seconds\n", - "crat = 0.5 # Ratio of c and csat\n", - "from math import log\n", - "#calculations\n", - "ka = -(1/t)*log(1-crat)\n", - "#results\n", - "print\"the mass transfer co efficient along the product with a is sec**-1\",round(ka,4)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1_4 pgno:242" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The mass transfer co efficient is cm/sec 0.0016\n" - ] - } - ], - "source": [ - "#initialiazation of variables\n", - "rin = 0.05 # initial radius of oxygen bubble in cm\n", - "rf = 0.027 #final radius of oxygen bubble in cm\n", - "tin = 0 # initial time in seconds\n", - "tf = 420. # final time in seconds\n", - "c1 = 1/22.4 # oxygen concentration in the bubble in mol/litres\n", - "c1sat = 1.5*10**-3 # oxygen concentration outside which is saturated in mol/litres\n", - "#Calculations\n", - "k = -((rf-rin)/(tf-tin))*(c1/c1sat)\n", - "#Results\n", - "print\"The mass transfer co efficient is cm/sec\",round(k,4)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_2_1 pgno:246" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the M.T.C in given 10^-12 units is 5.5\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "kc = 3.3*10**-3 # M.T.C in cm/sec\n", - "d = 1. # density of oxygen in g/cm**3\n", - "M = 18. # Mol wt of water in g/mol\n", - "Hatm = 4.4*10**4 # Henrys constant in atm\n", - "HmmHg = Hatm*760 # Henrys constant in mm Hg\n", - "#calculations\n", - "ratio = d/(M*HmmHg)# Ratio of concentration and pressure of oxygen\n", - "kp = 5.5#kc*ratio # M.T.O=C in x*10**12mol/cm**2-sec-mm Hg \n", - "#Results\n", - "print\"the M.T.C in given 10^-12 units is\",kp\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_2_2 pgno:247" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the M.T.C for liquid is cm/sec 0.0029\n", - "\n", - " the M.T.C for gas is cm/sec 3.6\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "k1 = 1.18 # M.T.C in lb-mol NH3/hr-ft**2\n", - "k2 = 1.09 # M.T.C in lb-mol NH3/hr-ft**2\n", - "M2 = 18. # Mol wt of NH3 in lb/mol\n", - "d = 62.4 # Density of NH3 in lb/ft**3\n", - "c1 = 30.5 # Conversion factor from ft to cm\n", - "c2 = 1./3600. # Conversion factor from seconds to hour\n", - "R = 1.314 # Gas constant in atm-ft**3/lb-mol-K\n", - "T = 298. # Temperature in Kelvin scale\n", - "#Calculations\n", - "kf1 = (M2/d)*k1*c1*c2 # M.T.C in cm/sec\n", - "kf2 = R*T*k2*c1*c2 # M.T.C in cm/sec\n", - "#Results\n", - "print\"the M.T.C for liquid is cm/sec\",round(kf1,4)\n", - "print\"\\n the M.T.C for gas is cm/sec\",round(kf2,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_3_1 pgno:253" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the column length needed is cm 6.6\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "l = 0.07 # flim thickness in cm \n", - "v = 3 # water flow in cm/sec\n", - "D = 1.8*10**-5 # diffusion coefficient in cm**2/sec\n", - "crat = 0.1 # Ratio of c1 and c1(sat)\n", - "from math import log\n", - "#Calculations\n", - "z = (((l**2)*v)/(1.38*D))*((log(1-crat))**2) #Column length\n", - "#Results\n", - "print\"the column length needed is cm\",round(z,1)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_3_2 pgno:256" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the mass flux in water is x10**-6 g/cm**2-sec 0.27\n", - "\n", - " the mass flux in air is x10**-6 g/cm**2-sec 1.0\n" - ] - } - ], - "source": [ - "from math import pi\n", - "#Initialization of variables\n", - "Dw = 1*10**-5 # Diffusion co efficient in cm**2/sec\n", - "omeg = 20*2*pi/60 # disc rotation in /sec\n", - "Nuw = 0.01 # Kinematic viscousity in water in cm**2/sec\n", - "Da = 0.233 # Diffusion co efficient in cm**2/sec\n", - "Nua = 0.15 # Kinematic viscousity in air in cm**2/sec\n", - "c1satw = 0.003 # Solubility of benzoic acid in water in gm/cm**3\n", - "p1sat = 0.30 # Equilibrium Vapor pressure in mm Hg\n", - "ratP = 0.3/760. # Ratio of pressures\n", - "c1 = 1./(22.4*10**3) # Moles per volume\n", - "c2 = 273./298. # Ratio of temperatures\n", - "c3 = 122 # Grams per mole\n", - "#Calculations\n", - "kw = 0.62*Dw*((omeg/Nuw)**0.5)*((Nuw/Dw)**(1/3))# cm/sec\n", - "Nw = kw*c1satw*10**6 # mass flux in x*10**-6 in g/cm**2-sec\n", - "ka = 0.62*Da*((omeg/Nua)**0.5)*((Nua/Da)**(1/3))#cm/sec\n", - "c1sata = ratP*c1*c2*c3# Solubility of benzoic acid in air in gm/cm**3\n", - "Na = ka*c1sata*10**6 # mass flux in x*10**-6 in g/cm**2-sec\n", - "#Results\n", - "print\"the mass flux in water is x10**-6 g/cm**2-sec\",round(Nw,2)\n", - "print\"\\n the mass flux in air is x10**-6 g/cm**2-sec\",round(Na)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5_1 pgno:266" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The overall m.t.c in liquid side is mol/cm**2-sec 0.00012\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "Dl=2.1*10**-5# Diffusion co efficient for Oxygen in air in cm**2/sec\n", - "Dg = 0.23 #Diffusion co efficient for Oxygen in water in cm**2/sec\n", - "R = 82. # Gas constant in cm**3-atm/g-mol-K\n", - "T = 298. #Temperature in Kelvin\n", - "l1 = 0.01 # film thickness in liquids in cm\n", - "l2 = 0.1 # film thickness in gases in cm\n", - "H1 = 4.3*10**4 # Henrys constant in atm\n", - "c = 1./18. # concentration of water in g-mol/cm**3\n", - "#Calculations\n", - "kl = (Dl/l1)*c # m.t.c in liquid phase in mol/cm**2/sec\n", - "kp = (Dg/l2)/(R*T)# m.t.c in gas phase in gmol/cm**2-sec-atm\n", - "KL = 1/((1/kl)+(1/(kp*H1)))# Overall m.t.c in mol/cm**2-sec liquid phase\n", - "#Results\n", - "print\"The overall m.t.c in liquid side is mol/cm**2-sec\",round(KL,5)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5_2 pgno:267" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The overall m.t.c in liquid side is x10**-5 mol/cm**2-sec 1.0\n", - " answer is different due to round off error\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "Dl=1.9*10**-5# Diffusion co efficient for liquid phase in cm**2/sec\n", - "Dg = 0.090 #Diffusion co efficient for gas phase in cm**2/sec\n", - "R = 82. # Gas constant in cm**3-atm/g-mol-K\n", - "T = 363. #Temperature in Kelvin\n", - "H1 = 0.70 # Henrys constant in atm\n", - "c = 1./97. # concentration of water in g-mol/cm**3\n", - "#Calculations\n", - "kl = (Dl/0.01)*c # m.t.c in liquid phase in mol/cm**2/sec\n", - "kp = (Dg/0.1)/(R*T)# m.t.c in gas phase in gmol/cm**2-sec-atm\n", - "KL = 1/((1/kl)+(1/(kp*H1)))*10**5# Overall m.t.c in x*10**-5 mol/cm**2-secliquid phase\n", - "#Results\n", - "print\"The overall m.t.c in liquid side is x10**-5 mol/cm**2-sec\",round(KL,1)\n", - "print\" answer is different due to round off error\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5_3 pgno:267" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The overall M.T.C through benzene phase is x10**-5 cm/sec 1.5\n" - ] - } - ], - "source": [ - "#Initialization of variables\n", - "k1 = 3.0*10**-4 # m.t.c in benzene in cm/sec\n", - "k2 = 2.4*10**-3 # m.t.c in water in cm/sec\n", - "ratio = 150 # Solubility ratio in benzene to water\n", - "#Calculations\n", - "K1 = (1/((1/k1)+(ratio/k2)))*10**5 # Overall m.t.c through benzene phase in x*10**-5 cm/sec\n", - "#Results\n", - "print\"The overall M.T.C through benzene phase is x10**-5 cm/sec\",round(K1,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5_4 pgno:268" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The overall coefficient for ammonia is lb-mol/hr-ft**3 8.3\n", - "\n", - " The overall coefficient for methane is lb-mol/hr-ft**3 0.03\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "H1 = 75. # henrys constant for ammonia in atm\n", - "H2 = 41000. # henrys constant for methane in atm\n", - "p = 2.2 # pressure in atm\n", - "kya = 18. # product of m.t.c and packing area per tower volume in lb-mol/hr-ft**3\n", - "kxa = 530. #product of m.t.c and packing area per tower volume in lb-mol/hr-ft**3\n", - "#calcuations\n", - "Kya1 = 1/((1/kya) + (H1/p)/kxa) #The overall coefficient for ammonia in lb-mol/hr-ft**3\n", - "Kya2 = 1/((1/kya) + (H2/p)/kxa) #The overall coefficient for methane in lb-mol/hr-ft**3\n", - "#Results\n", - "print\"The overall coefficient for ammonia is lb-mol/hr-ft**3\",round(Kya1,1)\n", - "print\"\\n The overall coefficient for methane is lb-mol/hr-ft**3\",round(Kya2,2)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer.ipynb deleted file mode 100755 index f6f97301..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer.ipynb +++ /dev/null @@ -1,265 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 9 : Theories of Mass Transfer" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.1.1 pgno:277" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The film thickness is cm 0.00765\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "p1 = 10. # pressure in atm\n", - "H = 600. # henrys constant in atm\n", - "c1 = 0 # gmol/cc\n", - "N1 = 2.3*10**-6 # mass flux in mol/cm**2-sec\n", - "c = 1./18. #total Concentration in g-mol/cc\n", - "D = 1.9*10**-5 # Diffusion co efficient in cm**2/sec\n", - "#Calculations\n", - "c1i = (p1/H)*c # Component concentration in gmol/cc\n", - "k = N1/(c1i-c1)#Mass transfer co efficient in cm/sec\n", - "l = D/k # Film thickness in cm\n", - "#Results\n", - "print\"The film thickness is cm\",round(l,5)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.2.1 pgno:281" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The contact time sec 3.9\n", - "\n", - "The surface resident time sec 3.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D = 1.9*10**-5 #Diffusion co efficient in cm**2/sec\n", - "k = 2.5*10**-3 # M.T.C in cm/sec\n", - "from math import pi\n", - "#Calculations\n", - "Lbyvmax = 4*D/((k**2)*pi)#sec\n", - "tou = D/k**2 # sec\n", - "#Results\n", - "print\"The contact time sec\",round(Lbyvmax,1)\n", - "print\"\\nThe surface resident time sec\",round(tou,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.3.1 pgno:35" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The apparent m.t.c for the first case is cm/sec 0.000379885493042\n", - "\n", - "The apparent m.t.c for the second case is cm/sec 0.000742723884992\n", - "\n", - "The apparent is proportional to the power of of the velocity 0.61\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "const = 0.5 # The part of flow in the system which bypasses the region where the mass transfer occurs\n", - "v1 = 1. # cm/sec\n", - "al = 10**3\n", - "k = 10**-3 # cm/sec\n", - "v2 = 3. # cm/sec\n", - "from math import log\n", - "from math import exp\n", - "#Calculations\n", - "C1byC10first = const + (1-const)*(exp(-k*al/v1))# c1/c10\n", - "appk1 = (v1/al)*(log(1/C1byC10first))# Apparent m.t.c for first case in cm/sec\n", - "C1byC10second = const + (1-const)*(exp(-((3)**0.5)*k*al/v2))#c1/c10 in second case\n", - "appk2 = (v2/al)*log(1/C1byC10second)# apparent m.t.c for second case in cm/sec\n", - "power = log(appk2/appk1)/log(v2/v1)\n", - "#Results\n", - "print\"The apparent m.t.c for the first case is cm/sec\",appk1\n", - "print\"\\nThe apparent m.t.c for the second case is cm/sec\",appk2\n", - "print\"\\nThe apparent is proportional to the power of of the velocity\",round(power,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.4.1 pgno:283" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The average mass transfer coefficient is cm/sec 0.000431530124388\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D = 1*10**-5 #cm**2/sec\n", - "d = 2.3 # cm\n", - "L = 14 # cm\n", - "v0 = 6.1 # cm/sec\n", - "#gamma(4./3.)=0.8909512761;\n", - "#calculations\n", - "k = ((3**(1./3.))/(0.8909512761))*((D/d))*(((d**2)*v0/(D*L))**(1./3.))# cm/sec\n", - "#Results\n", - "print\"The average mass transfer coefficient is cm/sec\",k\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.4.2 pgno:287" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The distance at which turbulent flow starts is cm 300.0\n", - "\n", - "The boundary layer for flow at this point is cm 300.0\n", - "\n", - "The boundary layer for concentration at this point is cm 300.0\n", - "\n", - "The local m.t.c at the leading edge and at the position of transistion is x10**-5 cm/sec 0.589714620247\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "tn = 300000 # turbulence number\n", - "v0 = 10 # cm/sec\n", - "p = 1 # g/cc\n", - "mu = 0.01 # g/cm-sec\n", - "delta = 2.5 #cm\n", - "D = 1*10**-5 # cm**2/sec\n", - "#Calculations\n", - "x = tn*mu/(v0*p)# cm\n", - "delta = ((280/13)**(1/2))*x*((mu/(x*v0*p))**(1/2))#cm\n", - "deltac = ((D*p/mu)**(1/3))*delta#cm\n", - "k = (0.323*(D/x)*((x*v0*p/mu)**0.5)*((mu/(p*D))**(1/3)))*10**5# x*10**-5 cm/sec\n", - "#Results\n", - "print\"The distance at which turbulent flow starts is cm\",x\n", - "print\"\\nThe boundary layer for flow at this point is cm\",delta\n", - "print\"\\nThe boundary layer for concentration at this point is cm\",deltac\n", - "print\"\\nThe local m.t.c at the leading edge and at the position of transistion is x10**-5 cm/sec\",k\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer_1.ipynb b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer_1.ipynb deleted file mode 100755 index b0017fa1..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/Chapter_9__Theories_of_Mass_Transfer_1.ipynb +++ /dev/null @@ -1,238 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 9 : Theories of Mass Transfer" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.1.1 pgno:277" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The film thickness is cm 0.00765\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "p1 = 10. # pressure in atm\n", - "H = 600. # henrys constant in atm\n", - "c1 = 0 # gmol/cc\n", - "N1 = 2.3*10**-6 # mass flux in mol/cm**2-sec\n", - "c = 1./18. #total Concentration in g-mol/cc\n", - "D = 1.9*10**-5 # Diffusion co efficient in cm**2/sec\n", - "#Calculations\n", - "c1i = (p1/H)*c # Component concentration in gmol/cc\n", - "k = N1/(c1i-c1)#Mass transfer co efficient in cm/sec\n", - "l = D/k # Film thickness in cm\n", - "#Results\n", - "print\"The film thickness is cm\",round(l,5)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.2.1 pgno:281" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The contact time sec 3.9\n", - "\n", - "The surface resident time sec 3.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D = 1.9*10**-5 #Diffusion co efficient in cm**2/sec\n", - "k = 2.5*10**-3 # M.T.C in cm/sec\n", - "from math import pi\n", - "#Calculations\n", - "Lbyvmax = 4*D/((k**2)*pi)#sec\n", - "tou = D/k**2 # sec\n", - "#Results\n", - "print\"The contact time sec\",round(Lbyvmax,1)\n", - "print\"\\nThe surface resident time sec\",round(tou,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.3.1 pgno:35" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The apparent m.t.c for the first case is cm/sec 0.000379885493042\n", - "\n", - "The apparent m.t.c for the second case is cm/sec 0.000742723884992\n", - "\n", - "The apparent is proportional to the power of of the velocity 0.61\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "const = 0.5 # The part of flow in the system which bypasses the region where the mass transfer occurs\n", - "v1 = 1. # cm/sec\n", - "al = 10**3\n", - "k = 10**-3 # cm/sec\n", - "v2 = 3. # cm/sec\n", - "from math import log\n", - "from math import exp\n", - "#Calculations\n", - "C1byC10first = const + (1-const)*(exp(-k*al/v1))# c1/c10\n", - "appk1 = (v1/al)*(log(1/C1byC10first))# Apparent m.t.c for first case in cm/sec\n", - "C1byC10second = const + (1-const)*(exp(-((3)**0.5)*k*al/v2))#c1/c10 in second case\n", - "appk2 = (v2/al)*log(1/C1byC10second)# apparent m.t.c for second case in cm/sec\n", - "power = log(appk2/appk1)/log(v2/v1)\n", - "#Results\n", - "print\"The apparent m.t.c for the first case is cm/sec\",appk1\n", - "print\"\\nThe apparent m.t.c for the second case is cm/sec\",appk2\n", - "print\"\\nThe apparent is proportional to the power of of the velocity\",round(power,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.4.1 pgno:283" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The average mass transfer coefficient is cm/sec 0.00043\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D = 1*10**-5 #cm**2/sec\n", - "d = 2.3 # cm\n", - "L = 14 # cm\n", - "v0 = 6.1 # cm/sec\n", - "#gamma(4./3.)=0.8909512761;\n", - "#calculations\n", - "k = ((3**(1./3.))/(0.8909512761))*((D/d))*(((d**2)*v0/(D*L))**(1./3.))# cm/sec\n", - "#Results\n", - "print\"The average mass transfer coefficient is cm/sec\",round(k,5)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.4.2 pgno:287" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The distance at which turbulent flow starts is cm 300.0\n", - "\n", - "The boundary layer for flow at this point is cm 300.0\n", - "\n", - "The boundary layer for concentration at this point is cm 300.0\n", - "\n", - "The local m.t.c at the leading edge and at the position of transistion is x10**-5 cm/sec 0.59\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "tn = 300000 # turbulence number\n", - "v0 = 10 # cm/sec\n", - "p = 1 # g/cc\n", - "mu = 0.01 # g/cm-sec\n", - "delta = 2.5 #cm\n", - "D = 1*10**-5 # cm**2/sec\n", - "#Calculations\n", - "x = tn*mu/(v0*p)# cm\n", - "delta = ((280/13)**(1/2))*x*((mu/(x*v0*p))**(1/2))#cm\n", - "deltac = ((D*p/mu)**(1/3))*delta#cm\n", - "k = (0.323*(D/x)*((x*v0*p/mu)**0.5)*((mu/(p*D))**(1/3)))*10**5# x*10**-5 cm/sec\n", - "#Results\n", - "print\"The distance at which turbulent flow starts is cm\",x\n", - "print\"\\nThe boundary layer for flow at this point is cm\",delta\n", - "print\"\\nThe boundary layer for concentration at this point is cm\",deltac\n", - "print\"\\nThe local m.t.c at the leading edge and at the position of transistion is x10**-5 cm/sec\",round(k,3)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/README.txt b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/README.txt deleted file mode 100755 index 76e8e01b..00000000 --- a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: marupeddi sameer chaitanya -Course: btech -College/Institute/Organization: K L university -Department/Designation: ECE -Book Title: Diffusion: Mass Transfer In Fluid Systems -Author: E. L. Cussler -Publisher: Cambridge University Press -Year of publication: 1997 -Isbn: 0521564778 -Edition: 2 \ No newline at end of file diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH19.png b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH19.png deleted file mode 100755 index 742b4078..00000000 Binary files a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH19.png and /dev/null differ diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH3.png b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH3.png deleted file mode 100755 index 168ddb9f..00000000 Binary files a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH3.png and /dev/null differ diff --git a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH5.png b/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH5.png deleted file mode 100755 index cb655050..00000000 Binary files a/_Diffusion:_Mass_Transfer_In_Fluid_Systems_by__E._L._Cussler/screenshots/CH5.png and /dev/null differ diff --git a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/README.txt b/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/README.txt deleted file mode 100755 index d6e4f43d..00000000 --- a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: Niren Negandhi -Course: be -College/Institute/Organization: Avaya India Pvt. Ltd. -Department/Designation: Senior Technical Specialist -Book Title: Electric Machinery And Transformers -Author: B. S. Guru And H. R. Hiziroglu -Publisher: Oxford University Press, New York -Year of publication: 2004 -Isbn: 9780195138900 -Edition: 3rd \ No newline at end of file diff --git a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1.ipynb b/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1.ipynb deleted file mode 100755 index 68dcda86..00000000 --- a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1.ipynb +++ /dev/null @@ -1,575 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:2ec5bac642048fe4f0a8791f1d0a50f56c601f2689b76ecde0a87424ce5a550e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 1: Review of Electric Circuit Theory" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.1, Page 5" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Calculations&Results\n", - "#on applying KVL we get \n", - "i=75./50;#in Amperes\n", - "v_th=(30*i)+25;#Equivalent Thevenin voltage (in Volts)\n", - "r_th=(20*30)/(20+30);#Equivalent thevenin resistance (in Ohms)\n", - "R_load=r_th;#Load resistance=thevenin resistance (in Ohms)\n", - "print \"load resistance (in ohms)= %.f\"%R_load #in ohms\n", - "i_load=v_th/(r_th+R_load);#in Amperes\n", - "p_max=(i_load**2)*r_th;#in Watts\n", - "print 'max power (in watts)= %.2f'%p_max#maximum power dissipiated " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "load resistance (in ohms)= 12\n", - "max power (in watts)= 102.08\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.2, Page 13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import cmath\n", - "import matplotlib.pyplot as plt\n", - "import numpy as np\n", - "\n", - "#Variable declaration\n", - "#Refer to figure 1.5a\n", - "L=1*10**-3;#henery\n", - "R=3.;#ohms\n", - "C=200*10**-6;#faraday\n", - "print \"v(t)=14.142cos1000t\"\n", - "V_m=14.142;#Peak value of applied voltage (in Volts)\n", - "\n", - "#Calculations&Results\n", - "V=V_m/math.sqrt(2);#RMS value of applied voltage (in Volts)\n", - "#On comparing with standard equation v(t)=acoswt\n", - "w=1000;#in radian/second\n", - "#Inductive impedance=jwL\n", - "Z_L=complex(0,w*L);#in ohms\n", - "#capacitive impedance=-j/wC\n", - "Z_c=complex(0,-1/(w*C));#in ohms\n", - "#Impedance of the circuit is given by\n", - "Z=Z_L+Z_c+R;#in ohms\n", - "I=V/Z#Current in the circuit#in Amperes\n", - "r=I.real;\n", - "i=I.imag;\n", - "magn_I=math.sqrt((r**2)+(i**2));#magnitude of current (in Amperes)\n", - "phase_I=math.degrees(math.atan(i/r));#phase of current (in degree)\n", - "print 'magnitude of current (in Amperes)= %.f'%magn_I\n", - "print 'phase of current (in Degrees) = %.2f'%phase_I\n", - "\n", - "Vr = I*R\n", - "Vl = I*Z_L\n", - "Vc = I*Z_c\n", - "print \"\\nCurrent in time domain is:\\ni(t)=2.828cos(1000t+53.13)A\"\n", - "S = V*I #complex power supplied by source(VA)\n", - "magn_S = math.sqrt((S.real**2)+(S.imag**2))\n", - "print \"\\nApparent power S = %.f VA\"%magn_S\n", - "print \"Reactive power P = %.f W\"%S.real\n", - "print \"Reactive power Q = %.f VAR\"%(-S.imag)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "v(t)=14.142cos1000t\n", - "magnitude of current (in Amperes)= 2\n", - "phase of current (in Degrees) = 53.13\n", - "\n", - "Current in time domain is:\n", - "i(t)=2.828cos(1000t+53.13)A\n", - "\n", - "Apparent power S = 20 VA\n", - "Reactive power P = 12 W\n", - "Reactive power Q = -16 VAR\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.3, Page 17" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import cmath\n", - "\n", - "#Variable declaration\n", - "I=10;#Current drawn by the load (in Amperes)\n", - "pf1=0.5;#lagging power factor\n", - "pf2=0.8;\n", - "V=120;#source voltage (in Volts)\n", - "f=60;#frequency of source (in Hertz)\n", - "\n", - "#Calculations\n", - "Vl = complex(120,0)\n", - "Il = complex(5,8.66) #10/_60 in polar\n", - "S = Vl*Il\n", - "i = 600/(V*pf2) #Since power at source is 600W\n", - "\n", - "#Refer to fig 1.6(b)\n", - "#I_Lc=I_L+I_c\n", - "I = complex(5,-3.75) #Writing I from polar to cartesian form\n", - "Il = complex(5,-8.66) #Writing Il from polar to cartesian forms\n", - "Ic = I - Il\n", - "Zc = V/Ic\n", - "Xc = Zc/complex(0,1)\n", - "C = 1/(2*math.pi*f*Xc)\n", - "\n", - "#Result\n", - "print \"The required value of capacitor is %.2f\"%(C.real*10**6)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The required value of capacitor is -108.53\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.4, Page 26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import cmath\n", - "\n", - "#Variable declaration\n", - "#Make delta -star conversion of load\n", - "Z_L=complex(1,2);#Impedance of each wire (in Ohms)\n", - "Z_p=complex(177,-246);#per-phase impedance (in Ohms)\n", - "Z_pY=Z_p/3;#per-phase impedance in Y-connection (in Ohms)\n", - "Z=Z_L+Z_pY;#Total per phase impedance (in Ohms)\n", - "V=866/math.sqrt(3);#Per-phase voltage (in Volts)\n", - "V_phase=0;\n", - "I=V/Z;#Current in the circuit (in Ampere)\n", - "\n", - "#Calculations&Results\n", - "I_mag=math.sqrt((I.real**2)+(I.imag**2));#magnitude of current (in Amperes)\n", - "I_phase=math.degrees(math.atan(I.imag/I.real));#phase of current (in Degrees)\n", - "pf=math.cos(math.atan(I.imag/I.real));#power factor\n", - "#Refer to fig:1.13(b)\n", - "#Source are connected in star,so phase currents = line currents\n", - "I_na_mag=I_mag;#Magnitude of Source current through n-a (in Amperes)\n", - "I_nb_mag=I_mag;#Magnitude of Source current through n-b (in Amperes)\n", - "I_nc_mag=I_mag;#Magnitude of Source current through n-c (in Amperes)\n", - "I_na_phase=I_phase+(0);#phase angle of current through n-a (in Degree)\n", - "I_nb_phase=I_phase+(-120);#phase angle of current through n-b (in Degree)\n", - "I_nc_phase=I_phase+(120);#phase angle of current through n-c (in Degree)\n", - "print 'Source currents are:'\n", - "print 'I_na_mag (in Amperes)= %.f'%I_na_mag\n", - "print 'I_na_phase (in Degrees)=%.2f'%I_na_phase\n", - "print 'I_nb_mag (in Amperes)=%.f'%I_nb_mag\n", - "print 'I_nb_phase (in Degrees)=%.2f'%I_nb_phase\n", - "print 'I_nc_mag (in Amperes)=%.f'%I_nc_mag\n", - "print 'I_nc_phase (in Degrees)=%.2f'%I_nc_phase\n", - "\n", - "#Load is connected in delta network\n", - "I_AB_mag=I_mag/math.sqrt(3);#magnitude of current through AB (in Amperes)\n", - "I_BC_mag=I_mag/math.sqrt(3);#magnitude of current through BC (in Amperes)\n", - "I_CA_mag=I_mag/math.sqrt(3);#magnitude of current through CA (in Amperes)\n", - "I_AB_phase=I_na_phase+30;#phase angle of current through AB (in Degrees)\n", - "I_BC_phase=I_nb_phase+30;#phase angle of current through BC (in Degrees)\n", - "I_CA_phase=I_nb_phase-90;#phase angle of current through CA (in Degrees)\n", - "print '\\nPhase currents through the load are:'\n", - "print 'I_AB_mag (in Amperes)= %.3f'%I_AB_mag\n", - "print 'I_AB_phase (in Degrees)= %.2f'%I_AB_phase\n", - "print 'I_BC_mag (in Amperes)= %.3f'%I_BC_mag\n", - "print 'I_BC_phase (in Degrees)= %.2f'%I_BC_phase\n", - "print 'I_CA_mag (in Amperes)= %.3f'%I_CA_mag\n", - "print 'I_CA_phase (in Degrees)= %.2f'%I_CA_phase\n", - "\n", - "\n", - "I_AB=complex((I_AB_mag*math.cos(I_AB_phase*math.pi/180)),(I_AB_mag*math.sin(I_AB_phase*math.pi/180)));#(in Amperes)\n", - "V_AB = I_AB*Z_p\n", - "V_AB_mag = math.sqrt(V_AB.real**2+V_AB.imag**2)\n", - "V_AB_phase = math.degrees(math.atan(V_AB.imag/V_AB.real))\n", - "print '\\nLine or phase voltages at the load are:'\n", - "print 'V_AB = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase)\n", - "print 'V_BC = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase-120)\n", - "print 'V_CA = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase+120)\n", - "\n", - "P_AB=I_AB_mag**2*(Z_p.real);#in watts\n", - "P_load = 3*P_AB\n", - "print '\\nPower dissipated (in Watts)=%.2f'%(P_load)\n", - "\n", - "P_line=3*I_mag**2*(Z_L.real);#in watts\n", - "print 'Power dissipated by transmission line (in Watts)= %.f'%P_line\n", - "P_source = P_load+P_line\n", - "print 'Total power supplied by three-phase source is %.2f W'%P_source" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Source currents are:\n", - "I_na_mag (in Amperes)= 5\n", - "I_na_phase (in Degrees)=53.13\n", - "I_nb_mag (in Amperes)=5\n", - "I_nb_phase (in Degrees)=-66.87\n", - "I_nc_mag (in Amperes)=5\n", - "I_nc_phase (in Degrees)=173.13\n", - "\n", - "Phase currents through the load are:\n", - "I_AB_mag (in Amperes)= 2.887\n", - "I_AB_phase (in Degrees)= 83.13\n", - "I_BC_mag (in Amperes)= 2.887\n", - "I_BC_phase (in Degrees)= -36.87\n", - "I_CA_mag (in Amperes)= 2.887\n", - "I_CA_phase (in Degrees)= -156.87\n", - "\n", - "Line or phase voltages at the load are:\n", - "V_AB = 874.83,angle = 28.87 V\n", - "V_BC = 874.83,angle = -91.13 V\n", - "V_CA = 874.83,angle = 148.87 V\n", - "\n", - "Power dissipated (in Watts)=4424.74\n", - "Power dissipated by transmission line (in Watts)= 75\n", - "Total power supplied by three-phase source is 4499.74 W\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.5, Page 29" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "R1 = 25 #in ohms\n", - "R2 = 100 #in ohms\n", - "Rt = 100 #in ohms\n", - "V = 100. #in volts\n", - "\n", - "#Calculations\n", - "Rp = (R1*R2)/(R1+R2)\n", - "It = V/Rt #total current in circuit in Amps\n", - "V_25 = It*Rp #voltage across 25 ohm resistor, in volts\n", - "I_25 = V_25/R1 #current through 25 ohm resistor, in Amps\n", - "P_25 = V_25*I_25\n", - "\n", - "#Result\n", - "print \"Power dissipated by the 25ohm resistor is %.f W\"%P_25" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power dissipated by the 25ohm resistor is 16 W\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.6, Page 33" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "#Refer to the fig:1.16\n", - "R=40;#in ohms\n", - "L=complex(0,30);#in ohms\n", - "\n", - "\n", - "#Calculations&Results\n", - "V=117*(complex(math.cos(0),math.sin(0)));#in Volts\n", - "#Equivalent load impedance is obtained by parallel combination of Resistance R and Inductance L\n", - "Z_L=(R*L)/(R+L);#load impedance (in Ohms)\n", - "Z1=complex(0.6,16.8);# in Ohms\n", - "Z=Z_L+Z1;#Equivalent impedance of circuit (in Ohms) \n", - "I=V/Z;#current through load (in Amperes)\n", - "I_mag=math.sqrt(I.real**2+I.imag**2);#magnitude of current flowing through load (in Amperes)\n", - "I_phase=math.degrees(math.atan(I.imag/I.real))\n", - "print 'Reading of ammeter (in Amperes)=%.f,angle = %.2f'%(I_mag,I_phase)\n", - "\n", - "V_L=I*Z_L;#voltage across load (in Volts)\n", - "V_L_mag=math.sqrt(V_L.real**2+V_L.imag**2);#magnitude of voltage across load (in Volts)\n", - "V_L_phase = math.degrees(math.atan(V_L.imag/V_L.real))\n", - "print '\\nReading of voltmeter (in Volts)= %.f,angle = %.2f'%(V_L_mag,V_L_phase)\n", - "\n", - "P=(V_L*I.conjugate());#Power developed (in Watts)\n", - "print 'Reading of wattmeter (in Watts)=%.1f'%P.real\n", - "\n", - "pf=P.real/(V_L_mag*I_mag);#Power factor\n", - "print 'power factor=%.2f(lagging)'%pf" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Reading of ammeter (in Amperes)=3,angle = -67.38\n", - "\n", - "Reading of voltmeter (in Volts)= 72,angle = -14.25\n", - "Reading of wattmeter (in Watts)=129.6\n", - "power factor=0.60(lagging)\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7, Page 38" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "#transforming delta connected source into an equivalent Star-connected source\n", - "V_s=1351;#source voltage (in Volts)\n", - "V=1351/math.sqrt(3);#in volts\n", - "V_phase=0;\n", - "\n", - "#Calculations&Results\n", - "Z=complex(360,150);#per-phase impedance(in ohms)\n", - "I=V/Z;#current in the circuit (in Amperes)\n", - "I_mag=math.sqrt(I.real**2+I.imag**2);#in ampere\n", - "I_phase=math.degrees(math.atan(I.imag/I.real));#degree\n", - "\n", - "#Refer to fig 1.19(a)\n", - "V_ab=1351*complex(math.cos(-30*math.pi/180),math.sin(-30*math.pi/180));#in Volts\n", - "I_aA=2*complex(math.cos(I_phase*math.pi/180),math.sin(I_phase*math.pi/180));#in Amperes\n", - "V_cb=1351*complex(math.cos(-90*math.pi/180),math.sin(-90*math.pi/180));#in Volts\n", - "I_cC=2*complex(math.cos((I_phase-120)*math.pi/180),math.sin((I_phase-120)*math.pi/180));#in Amperes\n", - "P1=V_ab*I_aA.conjugate();#reading of wattmeter 1 (in Watts)\n", - "print 'Reading of wattmeter W1 (in Watts) =%.2f'%P1.real\n", - "P2=V_cb*I_cC.conjugate();#reading of wattmeter 2 (in Watts)\n", - "print 'Reading of wattmeter W2 (in Watts)=%.2f'%P2.real\n", - "P=P1.real+P2.real;#total power developed (in Watts)\n", - "print 'Total power developed (in Watts)= %.f' %P\n", - "\n", - "pf=math.cos(math.atan(I.imag/I.real));#power factor\n", - "print 'power factor= %.3f(lagging)'%pf" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Reading of wattmeter W1 (in Watts) =2679.62\n", - "Reading of wattmeter W2 (in Watts)=1640.39\n", - "Total power developed (in Watts)= 4320\n", - "power factor= 0.923(lagging)\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.8, Page 44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "V = 120 #Voltage(V)\n", - "I = 5 #current(A)\n", - "P = 480. #power(W)\n", - "f = 60 #Hz\n", - "\n", - "#Calculations&Results\n", - "S = V*I #apparent power(W)\n", - "theta = math.degrees(math.acos(P/S)) #power factor angle\n", - "#In phasor form,\n", - "Vp = V*complex(math.cos(0*math.pi/180),math.sin(0*math.pi/180))\n", - "Ip = I*complex(math.cos(theta*math.pi/180),math.sin(theta*math.pi/180))\n", - "\n", - "#For series circuit\n", - "Zs = Vp/Ip\n", - "print \"Equivalent Impedance of series circuit = \",Zs\n", - "Xc = -Zs.imag\n", - "C = 1./(2*math.pi*f*Xc)\n", - "print \"Equivalent capacitance of series circuit = %.2f uF\"%(C*10**6)\n", - "\n", - "#For parallel circuit\n", - "I_mag = I*math.cos(theta*math.pi/180)\n", - "I_imag = I*math.sin(theta*math.pi/180)\n", - "Rp = V/I_mag\n", - "print \"\\nEquivalent resistance of parallel circuit = %d ohms\"%Rp\n", - "Xp = V/I_imag\n", - "Cp = 1./(2*math.pi*f*Xp)\n", - "print \"Equivalent capacitance of parallel circuit = %.1f uF\"%(Cp*10**6)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Equivalent Impedance of series circuit = (19.2-14.4j)\n", - "Equivalent capacitance of series circuit = 184.21 uF\n", - "\n", - "Equivalent resistance of parallel circuit = 29 ohms\n", - "Equivalent capacitance of parallel circuit = 66.3 uF\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9, Page 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "P = 3246 #power consumed(W)\n", - "Vl = 208. #line voltage(V)\n", - "Il = 10.6 #line current(A)\n", - "\n", - "#Calculations&Results\n", - "\n", - "#Y-Connection\n", - "V_phi = Vl/math.sqrt(3) #pre-phase voltage(V)\n", - "I_phi = Il #pre-phase current(A)\n", - "P_phi = P/3 #pre-phase power(W)\n", - "S_phi = V_phi*I_phi #pre-phase apparent power(VA)\n", - "theta = math.degrees(math.acos((P_phi/S_phi))) #lag\n", - "#In phasor form,\n", - "V_AN = V_phi*complex(math.cos(0*math.pi/180),math.sin(0*math.pi/180))\n", - "I_AN = I_phi*complex(math.cos(-theta*math.pi/180),math.sin(-theta*math.pi/180))\n", - "Zy = V_AN/I_AN\n", - "Zy_phase = math.degrees(math.atan(Zy.imag/Zy.real))\n", - "I_mag = I_phi*math.cos(Zy_phase*math.pi/180)\n", - "I_imag = I_phi*math.sin(Zy_phase*math.pi/180)\n", - "Rp = V_phi/I_mag #ohms\n", - "Xp = V_phi/I_imag #ohms\n", - "print \"For Y-connection:\"\n", - "print \"Impedance = \",Zy\n", - "print \"Resistance = %.2f ohms, Reactance = %.2f ohms\"%(Rp,Xp)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "For Y-connection:\n", - "Impedance = (9.62976148095+5.96800193442j)\n", - "Resistance = 13.33 ohms, Reactance = 21.51 ohms\n" - ] - } - ], - "prompt_number": 9 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10.ipynb b/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10.ipynb deleted file mode 100755 index abc4f8cf..00000000 --- a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10.ipynb +++ /dev/null @@ -1,357 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:6bd0a2b00de113a6b8eee24d69a2fdc031ce769460589b3679ee753d2223f332" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 10: Single-Phase Motors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.1, Page 571" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "P=4;#no. of poles\n", - "f=60.;#frequency in Hertzs\n", - "R2=12.5;#rotor resistance (in ohms)\n", - "\n", - "#Calculations&Results\n", - "N_s=120*f/P;#synchronous speed of motor(in rpm)\n", - "N_m=1710;#speed of motor in clockwise direction (in rpm)\n", - "s=(N_s-N_m)/N_s;\n", - "print '(a) slip in forward direction=%.2f'%s\n", - "s_b=2-s;\n", - "print '(b) slip in backward direction=%.2f'%s_b\n", - "#effective rotor resistance\n", - "R_f=0.5*R2/s;#(in forward branch)\n", - "print 'effective rotor resistance in forward branch (in ohms)=%.f'%R_f\n", - "R_b=0.5*R2/s_b;#(in backward direction)\n", - "print 'effective rotor resistance in backward branch (in ohms)=%.3f'%R_b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(a) slip in forward direction=0.05\n", - "(b) slip in backward direction=1.95\n", - "effective rotor resistance in forward branch (in ohms)=125\n", - "effective rotor resistance in backward branch (in ohms)=3.205\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.2, Page 576" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "V=120.;#in volts\n", - "f=60.;#frequency in Hertzs\n", - "P=4.;#no. of poles\n", - "R1=2.5;#in ohms\n", - "X1=complex(0,1.25)\n", - "R2=3.75;\n", - "X2=complex(0,1.25)\n", - "X_m=complex(0,65)\n", - "N_m=1710;#speed of motor (in rpm)\n", - "P_c=25;#core lossv(in Watts)\n", - "P_fw=2;#friction and windage loss (in Watts)\n", - "\n", - "#Calculations&Results\n", - "N_s=120*f/P;#synchronous speed of motor\n", - "s=(N_s-N_m)/N_s;#slip\n", - "Z_f=(X_m*((R2/s)+X2)*0.5)/((R2/s)+(X2+X_m));#forward impedance\n", - "Z_b=(X_m*((R2/(2-s))+X2)*0.5)/((R2/(2-s))+(X2+X_m));#backward impedance\n", - "Z_in=R1+X1+Z_f+Z_b;\n", - "I_1=V/Z_in;\n", - "P_in=V*I_1.conjugate()\n", - "I_2f=X_m*I_1/((R2/s)+(X1+X_m));#forward current\n", - "I_2b=X_m*I_1/((R2/(2-s))+(X1+X_m));#backward current\n", - "P_agf=0.5*(R2/s)*(abs(I_2f))**2;#air gap power in forward path\n", - "P_agb=0.5*(R2/(2-s))*(abs(I_2b))**2;#air gap power in backward path\n", - "P_ag=P_agf-P_agb;#net air gap power\n", - "P_d=(1-s)*P_ag;#gross power developed\n", - "P_o=P_d-P_c-P_fw;#net power output\n", - "w_m=2*(math.pi)*N_m/60;\n", - "T_s=P_o/w_m;\n", - "print 'shaft torque (in Newton-meter)=%.3f'%T_s\n", - "Eff=P_o/P_in.real;\n", - "print 'Efficiency of motor (%%)=%.2f'%(Eff*100)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "shaft torque (in Newton-meter)=1.295\n", - "Efficiency of motor (%)=65.86\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.3, Page 590" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "V1=230.;#in volts\n", - "f=50.;#frequency in Hz\n", - "P=6.;#no. of poles\n", - "R1=34.14;#in ohms\n", - "X1=complex(0,35.9)\n", - "R_a=149.78;\n", - "X2=complex(0,29.32)\n", - "X_m=complex(0,248.59)\n", - "R2=23.25;\n", - "a=1.73;\n", - "C=4*10**-6;#in Farad\n", - "P_c=19.88;#core loss\n", - "P_fw=1.9;#friction and windage loss\n", - "N_m=940.;#speed of motor in rpm\n", - "N_s=120.0*f/P;#synchronous speed of motor\n", - "\n", - "#Calculations&Results\n", - "s=(N_s-N_m)/N_s;#slip\n", - "w_m=2*math.pi*N_m/60;#in rad/sec\n", - "X_c=complex(0,1/(2*math.pi*f*C));#reactance of capacitance\n", - "Z_f=(X_m*((R2/s)+X2)*0.5)/((R2/s)+(X2+X_m));#forward impedance\n", - "Z_b=(X_m*((R2/(2-s))+X2)*0.5)/((R2/(2-s))+(X2+X_m));#backward impedance\n", - "Z_11=R1+X1+Z_f+Z_b;#in ohms\n", - "Z_12=-1*complex(0,a*(Z_f-Z_b));#in ohms\n", - "Z_21=-Z_12;#in ohms\n", - "Z_22=a*a*(Z_f+Z_b+X1)+R_a-X_c;#in ohms\n", - "I_1=V1*(Z_22-Z_12)/(Z_11*Z_22-Z_12*Z_21);#current in main winding\n", - "I_2=V1*(Z_11-Z_21)/(Z_11*Z_22-Z_12*Z_21);#current in auxilary winding\n", - "I_L=I_1+I_2;\n", - "print '(a) magnitude of line current (in Amperes)=%.3f'%(math.sqrt(I_L.real**2+I_L.imag**2))\n", - "print ' phase of line current (in Degree)=%.2f'%math.degrees(math.atan(I_L.imag/I_L.real))\n", - "P_in=V1*I_L.conjugate();\n", - "print '(b) power input (in Watts)=%.3f'%P_in.real\n", - "P_agf=complex((I_1*Z_f),(-I_2*a*Z_f))*I_1.conjugate()+complex((I_2*a*a*Z_f),(I_1*a*Z_f))*I_2.conjugate();#air gap power developed by forward field\n", - "P_agb=complex((I_1*Z_b),(I_2*a*Z_b))*I_1.conjugate()+complex((I_2*a*a*Z_b),(-I_1*a*Z_b))*I_2.conjugate();#air gap power developed by backward field\n", - "P_ag=P_agf.real-P_agb.real\n", - "P_d=(1-s)*P_ag;#power developed\n", - "P_o=P_d-P_c-P_fw;#output power\n", - "print '(c) Efficiency of motor (%%)=%.1f'%(P_o*100/P_in.real)\n", - "T_s=P_o/w_m;\n", - "print '(d) shaft torque (in Newton-meter)=%.3f'%T_s\n", - "V_c=I_2*X_c;\n", - "print '(e) magnitude of voltage across capacitor (in Volts)=%.3f'%(math.sqrt(V_c.real**2+V_c.imag**2))\n", - "print 'phase of voltage across capacitor (in Degree)=%.2f'%(math.degrees(math.atan(V_c.imag/V_c.real)))\n", - "#for starting torque\n", - "s=1;\n", - "s_b=1;\n", - "w_s=2*math.pi*N_s/60;\n", - "Z_f=(X_m*((R2/s)+X2)*0.5)/((R2/s)+(X2+X_m));#forward impedance\n", - "Z_b=(X_m*((R2/(2-s))+X2)*0.5)/((R2/(2-s))+(X2+X_m));#backward impedance\n", - "Z_11=R1+X1+Z_f+Z_b;#in ohms\n", - "Z_12=complex(0,(-a*(Z_f-Z_b)));#in ohms\n", - "Z_21=-Z_12;#in ohms\n", - "Z_22=a*a*(Z_f+Z_b+X1)+R_a-X_c;#in ohms\n", - "I_1s = V1/Z_11;#current in main winding\n", - "I_2s=V1/Z_22\n", - "#I_2s=V1*(Z_11-Z_21)/(Z_11*Z_22-Z_12*Z_21);#current in auxilary winding\n", - "I_Ls=I_1s+I_2s;\n", - "P_in=V1*I_Ls.conjugate();\n", - "P_agf=complex((I_1s*Z_f),(-I_2s*a*Z_f))*I_1s.conjugate()+complex((I_2s*a*a*Z_f),(I_1s*a*Z_f))*I_2s.conjugate();#air gap power developed by forward field\n", - "P_agb=complex((I_1s*Z_b),(I_2s*a*Z_b))*I_1s.conjugate()+complex((I_2s*a*a*Z_b),(-I_1s*a*Z_b))*I_2s.conjugate();#air gap power developed by backward field\n", - "P_ag=P_agf-P_agb;\n", - "T_s=P_ag.real/w_s;\n", - "print '(f) starting torque (in Newton-meter)=%.2f'%T_s" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(a) magnitude of line current (in Amperes)=1.207\n", - " phase of line current (in Degree)=-23.48\n", - "(b) power input (in Watts)=254.563\n", - "(c) Efficiency of motor (%)=57.5\n", - "(d) shaft torque (in Newton-meter)=1.488\n", - "(e) magnitude of voltage across capacitor (in Volts)=444.666\n", - "phase of voltage across capacitor (in Degree)=-68.29\n", - "(f) starting torque (in Newton-meter)=0.52\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.4, Page 597" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "R_m=2.5;#main winding resistance\n", - "R_a=100.;#auxilary winding resistance\n", - "#blocked-rotor test\n", - "V_bm=25.;#voltage (in Volts)\n", - "I_bm=3.72;#current (in Amperes)\n", - "P_bm=86.23;#power (in Watts)\n", - "#with auxilary winding open no load test\n", - "V_nL=115;#voltage (in Volts)\n", - "I_nL=3.2;#current (in Amperes)\n", - "P_nL=55.17;#power (in Watts)\n", - "#with main winding open blocked rotor test\n", - "V_ba=121;#voltage (in Volts)\n", - "I_ba=1.2;#current (in Amperes)\n", - "P_ba=145.35;#power (in Watts)\n", - "\n", - "#Calculations&Results\n", - "Z_bm=V_bm/I_bm;\n", - "R_bm=P_bm/I_bm**2;\n", - "X_bm=math.sqrt(Z_bm**2-R_bm**2);\n", - "X1=0.5*X_bm;\n", - "X2=X1;\n", - "R2=R_bm-R_m;\n", - "print 'X1 (in ohms)=%.2f'%X1\n", - "print 'X2 (in ohms)=%.2f'%X2\n", - "print 'R2 (in ohms)=%.2f'%R2\n", - "Z_nL=V_nL/I_nL;\n", - "R_nL=P_nL/I_nL**2;\n", - "X_nL=math.sqrt(Z_nL**2-R_nL**2);\n", - "X_m=2*X_nL-0.75*X_bm;\n", - "P_r=P_nL-I_nL**2*(R_m+0.25*R2);\n", - "print 'P_r (in Watts)=%.f'%(int(P_r))\n", - "print 'X_m (in ohms)=%.2f'%X_m\n", - "Z_ba=V_ba/I_ba;\n", - "R_ba=P_ba/I_ba**2;\n", - "R_2a=R_ba-R_a;\n", - "alpha=math.sqrt(R_2a/R2);\n", - "print 'alpha=%.1f'%alpha" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "X1 (in ohms)=1.26\n", - "X2 (in ohms)=1.26\n", - "R2 (in ohms)=3.73\n", - "P_r (in Watts)=20\n", - "X_m (in ohms)=69.17\n", - "alpha=0.5\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.5, Page 606" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "V_s=120;#in Volts\n", - "P_rot=80;#rotational loss (in Watts)\n", - "N_m=8000;#speed of motor (in rpm)\n", - "pf=0.912;#lagging\n", - "theta=-math.degrees(math.acos(pf))\n", - "\n", - "#Calculations&Results\n", - "I_a=17.58*complex(math.cos(theta*math.pi/180),math.sin(theta*math.pi/180));#in Amperes\n", - "Z_s=complex(0.65,1.2);#series field winding impedance (in ohms)\n", - "Z_a=complex(1.36,1.6);#armature winding impedance (in ohms)\n", - "E_a=V_s-I_a*(Z_s+Z_a);#induced emf (in Volts)\n", - "print '(a) induced emf in the armature (in Volts)=%.1f'%(math.sqrt(E_a.real**2+E_a.imag**2))\n", - "print 'phase of induced emf in the armature (in Degree)=%.2f'%(math.degrees(math.atan(E_a.imag/E_a.real)))\n", - "P_d=E_a*I_a.conjugate();\n", - "P_o=P_d.real-P_rot;\n", - "print '(b) power output (in Watts)=%.2f'%P_o\n", - "w_m=2*math.pi*N_m/60;#rated speed of motor (in rad/sec)\n", - "T_s=P_o/w_m;\n", - "print '(c) shaft torque (in Newton-meter)=%.2f'%T_s\n", - "P_in=V_s*abs(I_a)*pf;\n", - "Eff=P_o*100/P_in;\n", - "print '(d) Efficiency (%%)=%.1f'%Eff" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(a) induced emf in the armature (in Volts)=74.1\n", - "phase of induced emf in the armature (in Degree)=-24.22\n", - "(b) power output (in Watts)=1222.75\n", - "(c) shaft torque (in Newton-meter)=1.46\n", - "(d) Efficiency (%)=63.6\n" - ] - } - ], - "prompt_number": 5 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10_1.ipynb b/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10_1.ipynb deleted file mode 100755 index abc4f8cf..00000000 --- a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch10_1.ipynb +++ /dev/null @@ -1,357 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:6bd0a2b00de113a6b8eee24d69a2fdc031ce769460589b3679ee753d2223f332" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 10: Single-Phase Motors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.1, Page 571" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "P=4;#no. of poles\n", - "f=60.;#frequency in Hertzs\n", - "R2=12.5;#rotor resistance (in ohms)\n", - "\n", - "#Calculations&Results\n", - "N_s=120*f/P;#synchronous speed of motor(in rpm)\n", - "N_m=1710;#speed of motor in clockwise direction (in rpm)\n", - "s=(N_s-N_m)/N_s;\n", - "print '(a) slip in forward direction=%.2f'%s\n", - "s_b=2-s;\n", - "print '(b) slip in backward direction=%.2f'%s_b\n", - "#effective rotor resistance\n", - "R_f=0.5*R2/s;#(in forward branch)\n", - "print 'effective rotor resistance in forward branch (in ohms)=%.f'%R_f\n", - "R_b=0.5*R2/s_b;#(in backward direction)\n", - "print 'effective rotor resistance in backward branch (in ohms)=%.3f'%R_b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(a) slip in forward direction=0.05\n", - "(b) slip in backward direction=1.95\n", - "effective rotor resistance in forward branch (in ohms)=125\n", - "effective rotor resistance in backward branch (in ohms)=3.205\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.2, Page 576" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "V=120.;#in volts\n", - "f=60.;#frequency in Hertzs\n", - "P=4.;#no. of poles\n", - "R1=2.5;#in ohms\n", - "X1=complex(0,1.25)\n", - "R2=3.75;\n", - "X2=complex(0,1.25)\n", - "X_m=complex(0,65)\n", - "N_m=1710;#speed of motor (in rpm)\n", - "P_c=25;#core lossv(in Watts)\n", - "P_fw=2;#friction and windage loss (in Watts)\n", - "\n", - "#Calculations&Results\n", - "N_s=120*f/P;#synchronous speed of motor\n", - "s=(N_s-N_m)/N_s;#slip\n", - "Z_f=(X_m*((R2/s)+X2)*0.5)/((R2/s)+(X2+X_m));#forward impedance\n", - "Z_b=(X_m*((R2/(2-s))+X2)*0.5)/((R2/(2-s))+(X2+X_m));#backward impedance\n", - "Z_in=R1+X1+Z_f+Z_b;\n", - "I_1=V/Z_in;\n", - "P_in=V*I_1.conjugate()\n", - "I_2f=X_m*I_1/((R2/s)+(X1+X_m));#forward current\n", - "I_2b=X_m*I_1/((R2/(2-s))+(X1+X_m));#backward current\n", - "P_agf=0.5*(R2/s)*(abs(I_2f))**2;#air gap power in forward path\n", - "P_agb=0.5*(R2/(2-s))*(abs(I_2b))**2;#air gap power in backward path\n", - "P_ag=P_agf-P_agb;#net air gap power\n", - "P_d=(1-s)*P_ag;#gross power developed\n", - "P_o=P_d-P_c-P_fw;#net power output\n", - "w_m=2*(math.pi)*N_m/60;\n", - "T_s=P_o/w_m;\n", - "print 'shaft torque (in Newton-meter)=%.3f'%T_s\n", - "Eff=P_o/P_in.real;\n", - "print 'Efficiency of motor (%%)=%.2f'%(Eff*100)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "shaft torque (in Newton-meter)=1.295\n", - "Efficiency of motor (%)=65.86\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.3, Page 590" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "V1=230.;#in volts\n", - "f=50.;#frequency in Hz\n", - "P=6.;#no. of poles\n", - "R1=34.14;#in ohms\n", - "X1=complex(0,35.9)\n", - "R_a=149.78;\n", - "X2=complex(0,29.32)\n", - "X_m=complex(0,248.59)\n", - "R2=23.25;\n", - "a=1.73;\n", - "C=4*10**-6;#in Farad\n", - "P_c=19.88;#core loss\n", - "P_fw=1.9;#friction and windage loss\n", - "N_m=940.;#speed of motor in rpm\n", - "N_s=120.0*f/P;#synchronous speed of motor\n", - "\n", - "#Calculations&Results\n", - "s=(N_s-N_m)/N_s;#slip\n", - "w_m=2*math.pi*N_m/60;#in rad/sec\n", - "X_c=complex(0,1/(2*math.pi*f*C));#reactance of capacitance\n", - "Z_f=(X_m*((R2/s)+X2)*0.5)/((R2/s)+(X2+X_m));#forward impedance\n", - "Z_b=(X_m*((R2/(2-s))+X2)*0.5)/((R2/(2-s))+(X2+X_m));#backward impedance\n", - "Z_11=R1+X1+Z_f+Z_b;#in ohms\n", - "Z_12=-1*complex(0,a*(Z_f-Z_b));#in ohms\n", - "Z_21=-Z_12;#in ohms\n", - "Z_22=a*a*(Z_f+Z_b+X1)+R_a-X_c;#in ohms\n", - "I_1=V1*(Z_22-Z_12)/(Z_11*Z_22-Z_12*Z_21);#current in main winding\n", - "I_2=V1*(Z_11-Z_21)/(Z_11*Z_22-Z_12*Z_21);#current in auxilary winding\n", - "I_L=I_1+I_2;\n", - "print '(a) magnitude of line current (in Amperes)=%.3f'%(math.sqrt(I_L.real**2+I_L.imag**2))\n", - "print ' phase of line current (in Degree)=%.2f'%math.degrees(math.atan(I_L.imag/I_L.real))\n", - "P_in=V1*I_L.conjugate();\n", - "print '(b) power input (in Watts)=%.3f'%P_in.real\n", - "P_agf=complex((I_1*Z_f),(-I_2*a*Z_f))*I_1.conjugate()+complex((I_2*a*a*Z_f),(I_1*a*Z_f))*I_2.conjugate();#air gap power developed by forward field\n", - "P_agb=complex((I_1*Z_b),(I_2*a*Z_b))*I_1.conjugate()+complex((I_2*a*a*Z_b),(-I_1*a*Z_b))*I_2.conjugate();#air gap power developed by backward field\n", - "P_ag=P_agf.real-P_agb.real\n", - "P_d=(1-s)*P_ag;#power developed\n", - "P_o=P_d-P_c-P_fw;#output power\n", - "print '(c) Efficiency of motor (%%)=%.1f'%(P_o*100/P_in.real)\n", - "T_s=P_o/w_m;\n", - "print '(d) shaft torque (in Newton-meter)=%.3f'%T_s\n", - "V_c=I_2*X_c;\n", - "print '(e) magnitude of voltage across capacitor (in Volts)=%.3f'%(math.sqrt(V_c.real**2+V_c.imag**2))\n", - "print 'phase of voltage across capacitor (in Degree)=%.2f'%(math.degrees(math.atan(V_c.imag/V_c.real)))\n", - "#for starting torque\n", - "s=1;\n", - "s_b=1;\n", - "w_s=2*math.pi*N_s/60;\n", - "Z_f=(X_m*((R2/s)+X2)*0.5)/((R2/s)+(X2+X_m));#forward impedance\n", - "Z_b=(X_m*((R2/(2-s))+X2)*0.5)/((R2/(2-s))+(X2+X_m));#backward impedance\n", - "Z_11=R1+X1+Z_f+Z_b;#in ohms\n", - "Z_12=complex(0,(-a*(Z_f-Z_b)));#in ohms\n", - "Z_21=-Z_12;#in ohms\n", - "Z_22=a*a*(Z_f+Z_b+X1)+R_a-X_c;#in ohms\n", - "I_1s = V1/Z_11;#current in main winding\n", - "I_2s=V1/Z_22\n", - "#I_2s=V1*(Z_11-Z_21)/(Z_11*Z_22-Z_12*Z_21);#current in auxilary winding\n", - "I_Ls=I_1s+I_2s;\n", - "P_in=V1*I_Ls.conjugate();\n", - "P_agf=complex((I_1s*Z_f),(-I_2s*a*Z_f))*I_1s.conjugate()+complex((I_2s*a*a*Z_f),(I_1s*a*Z_f))*I_2s.conjugate();#air gap power developed by forward field\n", - "P_agb=complex((I_1s*Z_b),(I_2s*a*Z_b))*I_1s.conjugate()+complex((I_2s*a*a*Z_b),(-I_1s*a*Z_b))*I_2s.conjugate();#air gap power developed by backward field\n", - "P_ag=P_agf-P_agb;\n", - "T_s=P_ag.real/w_s;\n", - "print '(f) starting torque (in Newton-meter)=%.2f'%T_s" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(a) magnitude of line current (in Amperes)=1.207\n", - " phase of line current (in Degree)=-23.48\n", - "(b) power input (in Watts)=254.563\n", - "(c) Efficiency of motor (%)=57.5\n", - "(d) shaft torque (in Newton-meter)=1.488\n", - "(e) magnitude of voltage across capacitor (in Volts)=444.666\n", - "phase of voltage across capacitor (in Degree)=-68.29\n", - "(f) starting torque (in Newton-meter)=0.52\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.4, Page 597" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "R_m=2.5;#main winding resistance\n", - "R_a=100.;#auxilary winding resistance\n", - "#blocked-rotor test\n", - "V_bm=25.;#voltage (in Volts)\n", - "I_bm=3.72;#current (in Amperes)\n", - "P_bm=86.23;#power (in Watts)\n", - "#with auxilary winding open no load test\n", - "V_nL=115;#voltage (in Volts)\n", - "I_nL=3.2;#current (in Amperes)\n", - "P_nL=55.17;#power (in Watts)\n", - "#with main winding open blocked rotor test\n", - "V_ba=121;#voltage (in Volts)\n", - "I_ba=1.2;#current (in Amperes)\n", - "P_ba=145.35;#power (in Watts)\n", - "\n", - "#Calculations&Results\n", - "Z_bm=V_bm/I_bm;\n", - "R_bm=P_bm/I_bm**2;\n", - "X_bm=math.sqrt(Z_bm**2-R_bm**2);\n", - "X1=0.5*X_bm;\n", - "X2=X1;\n", - "R2=R_bm-R_m;\n", - "print 'X1 (in ohms)=%.2f'%X1\n", - "print 'X2 (in ohms)=%.2f'%X2\n", - "print 'R2 (in ohms)=%.2f'%R2\n", - "Z_nL=V_nL/I_nL;\n", - "R_nL=P_nL/I_nL**2;\n", - "X_nL=math.sqrt(Z_nL**2-R_nL**2);\n", - "X_m=2*X_nL-0.75*X_bm;\n", - "P_r=P_nL-I_nL**2*(R_m+0.25*R2);\n", - "print 'P_r (in Watts)=%.f'%(int(P_r))\n", - "print 'X_m (in ohms)=%.2f'%X_m\n", - "Z_ba=V_ba/I_ba;\n", - "R_ba=P_ba/I_ba**2;\n", - "R_2a=R_ba-R_a;\n", - "alpha=math.sqrt(R_2a/R2);\n", - "print 'alpha=%.1f'%alpha" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "X1 (in ohms)=1.26\n", - "X2 (in ohms)=1.26\n", - "R2 (in ohms)=3.73\n", - "P_r (in Watts)=20\n", - "X_m (in ohms)=69.17\n", - "alpha=0.5\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.5, Page 606" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "V_s=120;#in Volts\n", - "P_rot=80;#rotational loss (in Watts)\n", - "N_m=8000;#speed of motor (in rpm)\n", - "pf=0.912;#lagging\n", - "theta=-math.degrees(math.acos(pf))\n", - "\n", - "#Calculations&Results\n", - "I_a=17.58*complex(math.cos(theta*math.pi/180),math.sin(theta*math.pi/180));#in Amperes\n", - "Z_s=complex(0.65,1.2);#series field winding impedance (in ohms)\n", - "Z_a=complex(1.36,1.6);#armature winding impedance (in ohms)\n", - "E_a=V_s-I_a*(Z_s+Z_a);#induced emf (in Volts)\n", - "print '(a) induced emf in the armature (in Volts)=%.1f'%(math.sqrt(E_a.real**2+E_a.imag**2))\n", - "print 'phase of induced emf in the armature (in Degree)=%.2f'%(math.degrees(math.atan(E_a.imag/E_a.real)))\n", - "P_d=E_a*I_a.conjugate();\n", - "P_o=P_d.real-P_rot;\n", - "print '(b) power output (in Watts)=%.2f'%P_o\n", - "w_m=2*math.pi*N_m/60;#rated speed of motor (in rad/sec)\n", - "T_s=P_o/w_m;\n", - "print '(c) shaft torque (in Newton-meter)=%.2f'%T_s\n", - "P_in=V_s*abs(I_a)*pf;\n", - "Eff=P_o*100/P_in;\n", - "print '(d) Efficiency (%%)=%.1f'%Eff" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(a) induced emf in the armature (in Volts)=74.1\n", - "phase of induced emf in the armature (in Degree)=-24.22\n", - "(b) power output (in Watts)=1222.75\n", - "(c) shaft torque (in Newton-meter)=1.46\n", - "(d) Efficiency (%)=63.6\n" - ] - } - ], - "prompt_number": 5 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11.ipynb b/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11.ipynb deleted file mode 100755 index 1fc63a70..00000000 --- a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11.ipynb +++ /dev/null @@ -1,120 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:c877f92f53167787736d030c7e71187c13be065ae6dadf741859ea31d04711be" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 11: Dynamics of Electric Machines" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.7, Page 646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "KVA=71500;#Kilo Volt-Ampere\n", - "V_r=13800;#in Volts\n", - "X_af=0.57;#in per unit\n", - "X_la=0.125;#in per unit\n", - "X_lf=0.239;#in per unit\n", - "X_ld=0.172;#in per unit\n", - "\n", - "#Calculations&Results\n", - "X_ds=X_la+((X_af*X_lf*X_ld)/(X_lf*X_ld+X_af*X_ld+X_af*X_lf));#subtransient reactance(in per unit)\n", - "E_phy=1.;#generated voltage (in per unit)\n", - "I_ds=E_phy/X_ds;#short circuit current (in per unit)\n", - "X_d=X_la+((X_af*X_lf)/(X_af+X_lf));#transient reactance (in per unit)\n", - "I_d=E_phy/X_d;#transient current (in per unit)\n", - "I_rated=KVA*1000/(math.sqrt(3)*V_r);#in Amperes\n", - "I_dsa=I_ds*I_rated;#sub transient current (in Amperes)\n", - "print 'sub-transient current (in Amperes)=%.2f'%I_dsa\n", - "I_da=I_d*I_rated;#transient current (in Amperes)\n", - "print 'transient current (in Amperes)=%.2f'%I_da\n", - "#Answer varies due to rounding-off errors" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sub-transient current (in Amperes)=14238.48\n", - "transient current (in Amperes)=10195.69\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.8, Page 652" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "f=60.;#in Hertzs\n", - "P=4.;#no. of poles\n", - "P_m=0.9;\n", - "H=10;#in Joule/Volt-Amperee\n", - "\n", - "#Calculations&Results\n", - "N_s=f*120/P;#synchronous speed in (rpm)\n", - "w_s=2*math.pi*N_s/f;#(in rad/sec)\n", - "P_dm=P_m/math.sin(18*math.pi/180);\n", - "t_c=P/f;#fault clearing time (in sec)\n", - "delta_o=18*2*math.pi/360;#in rad\n", - "delta_m=math.degrees(delta_o+((w_s/(P*H))*P_m*t_c**2))\n", - "P_d=P_dm*math.sin(delta_m*math.pi/180);\n", - "print '(a) power generated (in per unit)=%.2f'%P_d\n", - "delta_2=math.pi-delta_o;\n", - "delta_c=math.acos(((P_m/P_dm)*(delta_2-delta_o))+math.cos(delta_2));\n", - "t_cn=math.sqrt((delta_c-delta_o)*4*H/(w_s*P_m));\n", - "print '(b) critical fault clearing time (in sec)=%.3f'%t_cn" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(a) power generated (in per unit)=0.95\n", - "(b) critical fault clearing time (in sec)=0.581\n" - ] - } - ], - "prompt_number": 2 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11_1.ipynb b/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11_1.ipynb deleted file mode 100755 index 1fc63a70..00000000 --- a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch11_1.ipynb +++ /dev/null @@ -1,120 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:c877f92f53167787736d030c7e71187c13be065ae6dadf741859ea31d04711be" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 11: Dynamics of Electric Machines" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.7, Page 646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "KVA=71500;#Kilo Volt-Ampere\n", - "V_r=13800;#in Volts\n", - "X_af=0.57;#in per unit\n", - "X_la=0.125;#in per unit\n", - "X_lf=0.239;#in per unit\n", - "X_ld=0.172;#in per unit\n", - "\n", - "#Calculations&Results\n", - "X_ds=X_la+((X_af*X_lf*X_ld)/(X_lf*X_ld+X_af*X_ld+X_af*X_lf));#subtransient reactance(in per unit)\n", - "E_phy=1.;#generated voltage (in per unit)\n", - "I_ds=E_phy/X_ds;#short circuit current (in per unit)\n", - "X_d=X_la+((X_af*X_lf)/(X_af+X_lf));#transient reactance (in per unit)\n", - "I_d=E_phy/X_d;#transient current (in per unit)\n", - "I_rated=KVA*1000/(math.sqrt(3)*V_r);#in Amperes\n", - "I_dsa=I_ds*I_rated;#sub transient current (in Amperes)\n", - "print 'sub-transient current (in Amperes)=%.2f'%I_dsa\n", - "I_da=I_d*I_rated;#transient current (in Amperes)\n", - "print 'transient current (in Amperes)=%.2f'%I_da\n", - "#Answer varies due to rounding-off errors" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sub-transient current (in Amperes)=14238.48\n", - "transient current (in Amperes)=10195.69\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.8, Page 652" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "f=60.;#in Hertzs\n", - "P=4.;#no. of poles\n", - "P_m=0.9;\n", - "H=10;#in Joule/Volt-Amperee\n", - "\n", - "#Calculations&Results\n", - "N_s=f*120/P;#synchronous speed in (rpm)\n", - "w_s=2*math.pi*N_s/f;#(in rad/sec)\n", - "P_dm=P_m/math.sin(18*math.pi/180);\n", - "t_c=P/f;#fault clearing time (in sec)\n", - "delta_o=18*2*math.pi/360;#in rad\n", - "delta_m=math.degrees(delta_o+((w_s/(P*H))*P_m*t_c**2))\n", - "P_d=P_dm*math.sin(delta_m*math.pi/180);\n", - "print '(a) power generated (in per unit)=%.2f'%P_d\n", - "delta_2=math.pi-delta_o;\n", - "delta_c=math.acos(((P_m/P_dm)*(delta_2-delta_o))+math.cos(delta_2));\n", - "t_cn=math.sqrt((delta_c-delta_o)*4*H/(w_s*P_m));\n", - "print '(b) critical fault clearing time (in sec)=%.3f'%t_cn" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(a) power generated (in per unit)=0.95\n", - "(b) critical fault clearing time (in sec)=0.581\n" - ] - } - ], - "prompt_number": 2 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12.ipynb b/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12.ipynb deleted file mode 100755 index fbe22bb8..00000000 --- a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12.ipynb +++ /dev/null @@ -1,152 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e669c20812e01a3de7509b854fcd373ad98ac3cfd05f973ab8a7a3082e6c1738" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 12: Special-Purpose Electric Machines" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.1, Page 662" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "flux=0.004;#(in Weber)\n", - "R_a=0.8;#armature resistance (in ohm)\n", - "V_s=40;#applied voltage (in Volts)\n", - "T_d=1.2;#in Newton-meter\n", - "K_a=95;#motor constant\n", - "\n", - "#Calculations&Results\n", - "w_m=(V_s/(K_a*flux))-((R_a*T_d)/(K_a*flux)**2);\n", - "N_m=w_m*60/(2*math.pi);\n", - "print 'speed of motor (in rpm)=%.f'%(math.ceil(N_m))\n", - "w_mb=0;#for blocked rotor condition\n", - "T_db=(V_s*K_a*flux)/R_a;\n", - "print 'torque developed under blocked rotor condition (in Newton-meter)=%.f'%T_db" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of motor (in rpm)=942\n", - "torque developed under blocked rotor condition (in Newton-meter)=19\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.2, Page 662" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "N_m=1500;#speed of motor (in rpm)\n", - "R_a=2;#armature resistance (in ohms)\n", - "V_s=100;\n", - "P_o=200;#rated power \n", - "K_a=85;#machine constant\n", - "P_rot=15;#rotational loss\n", - "\n", - "#Calculations\n", - "w_m=(2*math.pi*N_m)/60;\n", - "P_d=P_o+P_rot;#power developed\n", - "T_d=P_d/w_m;#torque developed\n", - "def root(a,b,c):\n", - " return ((-b)+math.sqrt((b**2)-(4*a*c)))/(2*a);\n", - "\n", - "\n", - "#Result\n", - "print 'magnetic flux (in mWb)=%.2f'%(root(1,-0.0075,(2.41*10**-6))*1000)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnetic flux (in mWb)=7.16\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.3, Page 682" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "f=60;#frequency (in Hertzs)\n", - "P_pi=0.5;#pole pitch\n", - "F_d=100000;#developed thrust (in Newton)\n", - "\n", - "#Calculations&Results\n", - "V_m=200000./3600;#speed of motor (in meter/sec)\n", - "P_d=F_d*V_m;\n", - "print 'developed power (in Kilo-Watts)=%.f'%(int(P_d/1000))\n", - "V_s=2*P_pi*f;#synchronous speed of the motor (in meter/sec)\n", - "s=(V_s-V_m)/V_s;#slip\n", - "P_cu=F_d*s*V_s;\n", - "print 'Copper loss (in Kilo-Watts)=%.f'%(int(P_cu/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "developed power (in Kilo-Watts)=5555\n", - "Copper loss (in Kilo-Watts)=444\n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12_1.ipynb b/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12_1.ipynb deleted file mode 100755 index fbe22bb8..00000000 --- a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch12_1.ipynb +++ /dev/null @@ -1,152 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e669c20812e01a3de7509b854fcd373ad98ac3cfd05f973ab8a7a3082e6c1738" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 12: Special-Purpose Electric Machines" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.1, Page 662" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "flux=0.004;#(in Weber)\n", - "R_a=0.8;#armature resistance (in ohm)\n", - "V_s=40;#applied voltage (in Volts)\n", - "T_d=1.2;#in Newton-meter\n", - "K_a=95;#motor constant\n", - "\n", - "#Calculations&Results\n", - "w_m=(V_s/(K_a*flux))-((R_a*T_d)/(K_a*flux)**2);\n", - "N_m=w_m*60/(2*math.pi);\n", - "print 'speed of motor (in rpm)=%.f'%(math.ceil(N_m))\n", - "w_mb=0;#for blocked rotor condition\n", - "T_db=(V_s*K_a*flux)/R_a;\n", - "print 'torque developed under blocked rotor condition (in Newton-meter)=%.f'%T_db" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of motor (in rpm)=942\n", - "torque developed under blocked rotor condition (in Newton-meter)=19\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.2, Page 662" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "N_m=1500;#speed of motor (in rpm)\n", - "R_a=2;#armature resistance (in ohms)\n", - "V_s=100;\n", - "P_o=200;#rated power \n", - "K_a=85;#machine constant\n", - "P_rot=15;#rotational loss\n", - "\n", - "#Calculations\n", - "w_m=(2*math.pi*N_m)/60;\n", - "P_d=P_o+P_rot;#power developed\n", - "T_d=P_d/w_m;#torque developed\n", - "def root(a,b,c):\n", - " return ((-b)+math.sqrt((b**2)-(4*a*c)))/(2*a);\n", - "\n", - "\n", - "#Result\n", - "print 'magnetic flux (in mWb)=%.2f'%(root(1,-0.0075,(2.41*10**-6))*1000)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnetic flux (in mWb)=7.16\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.3, Page 682" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "f=60;#frequency (in Hertzs)\n", - "P_pi=0.5;#pole pitch\n", - "F_d=100000;#developed thrust (in Newton)\n", - "\n", - "#Calculations&Results\n", - "V_m=200000./3600;#speed of motor (in meter/sec)\n", - "P_d=F_d*V_m;\n", - "print 'developed power (in Kilo-Watts)=%.f'%(int(P_d/1000))\n", - "V_s=2*P_pi*f;#synchronous speed of the motor (in meter/sec)\n", - "s=(V_s-V_m)/V_s;#slip\n", - "P_cu=F_d*s*V_s;\n", - "print 'Copper loss (in Kilo-Watts)=%.f'%(int(P_cu/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "developed power (in Kilo-Watts)=5555\n", - "Copper loss (in Kilo-Watts)=444\n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1_1.ipynb b/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1_1.ipynb deleted file mode 100755 index 68dcda86..00000000 --- a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch1_1.ipynb +++ /dev/null @@ -1,575 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:2ec5bac642048fe4f0a8791f1d0a50f56c601f2689b76ecde0a87424ce5a550e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 1: Review of Electric Circuit Theory" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.1, Page 5" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Calculations&Results\n", - "#on applying KVL we get \n", - "i=75./50;#in Amperes\n", - "v_th=(30*i)+25;#Equivalent Thevenin voltage (in Volts)\n", - "r_th=(20*30)/(20+30);#Equivalent thevenin resistance (in Ohms)\n", - "R_load=r_th;#Load resistance=thevenin resistance (in Ohms)\n", - "print \"load resistance (in ohms)= %.f\"%R_load #in ohms\n", - "i_load=v_th/(r_th+R_load);#in Amperes\n", - "p_max=(i_load**2)*r_th;#in Watts\n", - "print 'max power (in watts)= %.2f'%p_max#maximum power dissipiated " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "load resistance (in ohms)= 12\n", - "max power (in watts)= 102.08\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.2, Page 13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import cmath\n", - "import matplotlib.pyplot as plt\n", - "import numpy as np\n", - "\n", - "#Variable declaration\n", - "#Refer to figure 1.5a\n", - "L=1*10**-3;#henery\n", - "R=3.;#ohms\n", - "C=200*10**-6;#faraday\n", - "print \"v(t)=14.142cos1000t\"\n", - "V_m=14.142;#Peak value of applied voltage (in Volts)\n", - "\n", - "#Calculations&Results\n", - "V=V_m/math.sqrt(2);#RMS value of applied voltage (in Volts)\n", - "#On comparing with standard equation v(t)=acoswt\n", - "w=1000;#in radian/second\n", - "#Inductive impedance=jwL\n", - "Z_L=complex(0,w*L);#in ohms\n", - "#capacitive impedance=-j/wC\n", - "Z_c=complex(0,-1/(w*C));#in ohms\n", - "#Impedance of the circuit is given by\n", - "Z=Z_L+Z_c+R;#in ohms\n", - "I=V/Z#Current in the circuit#in Amperes\n", - "r=I.real;\n", - "i=I.imag;\n", - "magn_I=math.sqrt((r**2)+(i**2));#magnitude of current (in Amperes)\n", - "phase_I=math.degrees(math.atan(i/r));#phase of current (in degree)\n", - "print 'magnitude of current (in Amperes)= %.f'%magn_I\n", - "print 'phase of current (in Degrees) = %.2f'%phase_I\n", - "\n", - "Vr = I*R\n", - "Vl = I*Z_L\n", - "Vc = I*Z_c\n", - "print \"\\nCurrent in time domain is:\\ni(t)=2.828cos(1000t+53.13)A\"\n", - "S = V*I #complex power supplied by source(VA)\n", - "magn_S = math.sqrt((S.real**2)+(S.imag**2))\n", - "print \"\\nApparent power S = %.f VA\"%magn_S\n", - "print \"Reactive power P = %.f W\"%S.real\n", - "print \"Reactive power Q = %.f VAR\"%(-S.imag)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "v(t)=14.142cos1000t\n", - "magnitude of current (in Amperes)= 2\n", - "phase of current (in Degrees) = 53.13\n", - "\n", - "Current in time domain is:\n", - "i(t)=2.828cos(1000t+53.13)A\n", - "\n", - "Apparent power S = 20 VA\n", - "Reactive power P = 12 W\n", - "Reactive power Q = -16 VAR\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.3, Page 17" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import cmath\n", - "\n", - "#Variable declaration\n", - "I=10;#Current drawn by the load (in Amperes)\n", - "pf1=0.5;#lagging power factor\n", - "pf2=0.8;\n", - "V=120;#source voltage (in Volts)\n", - "f=60;#frequency of source (in Hertz)\n", - "\n", - "#Calculations\n", - "Vl = complex(120,0)\n", - "Il = complex(5,8.66) #10/_60 in polar\n", - "S = Vl*Il\n", - "i = 600/(V*pf2) #Since power at source is 600W\n", - "\n", - "#Refer to fig 1.6(b)\n", - "#I_Lc=I_L+I_c\n", - "I = complex(5,-3.75) #Writing I from polar to cartesian form\n", - "Il = complex(5,-8.66) #Writing Il from polar to cartesian forms\n", - "Ic = I - Il\n", - "Zc = V/Ic\n", - "Xc = Zc/complex(0,1)\n", - "C = 1/(2*math.pi*f*Xc)\n", - "\n", - "#Result\n", - "print \"The required value of capacitor is %.2f\"%(C.real*10**6)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The required value of capacitor is -108.53\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.4, Page 26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import cmath\n", - "\n", - "#Variable declaration\n", - "#Make delta -star conversion of load\n", - "Z_L=complex(1,2);#Impedance of each wire (in Ohms)\n", - "Z_p=complex(177,-246);#per-phase impedance (in Ohms)\n", - "Z_pY=Z_p/3;#per-phase impedance in Y-connection (in Ohms)\n", - "Z=Z_L+Z_pY;#Total per phase impedance (in Ohms)\n", - "V=866/math.sqrt(3);#Per-phase voltage (in Volts)\n", - "V_phase=0;\n", - "I=V/Z;#Current in the circuit (in Ampere)\n", - "\n", - "#Calculations&Results\n", - "I_mag=math.sqrt((I.real**2)+(I.imag**2));#magnitude of current (in Amperes)\n", - "I_phase=math.degrees(math.atan(I.imag/I.real));#phase of current (in Degrees)\n", - "pf=math.cos(math.atan(I.imag/I.real));#power factor\n", - "#Refer to fig:1.13(b)\n", - "#Source are connected in star,so phase currents = line currents\n", - "I_na_mag=I_mag;#Magnitude of Source current through n-a (in Amperes)\n", - "I_nb_mag=I_mag;#Magnitude of Source current through n-b (in Amperes)\n", - "I_nc_mag=I_mag;#Magnitude of Source current through n-c (in Amperes)\n", - "I_na_phase=I_phase+(0);#phase angle of current through n-a (in Degree)\n", - "I_nb_phase=I_phase+(-120);#phase angle of current through n-b (in Degree)\n", - "I_nc_phase=I_phase+(120);#phase angle of current through n-c (in Degree)\n", - "print 'Source currents are:'\n", - "print 'I_na_mag (in Amperes)= %.f'%I_na_mag\n", - "print 'I_na_phase (in Degrees)=%.2f'%I_na_phase\n", - "print 'I_nb_mag (in Amperes)=%.f'%I_nb_mag\n", - "print 'I_nb_phase (in Degrees)=%.2f'%I_nb_phase\n", - "print 'I_nc_mag (in Amperes)=%.f'%I_nc_mag\n", - "print 'I_nc_phase (in Degrees)=%.2f'%I_nc_phase\n", - "\n", - "#Load is connected in delta network\n", - "I_AB_mag=I_mag/math.sqrt(3);#magnitude of current through AB (in Amperes)\n", - "I_BC_mag=I_mag/math.sqrt(3);#magnitude of current through BC (in Amperes)\n", - "I_CA_mag=I_mag/math.sqrt(3);#magnitude of current through CA (in Amperes)\n", - "I_AB_phase=I_na_phase+30;#phase angle of current through AB (in Degrees)\n", - "I_BC_phase=I_nb_phase+30;#phase angle of current through BC (in Degrees)\n", - "I_CA_phase=I_nb_phase-90;#phase angle of current through CA (in Degrees)\n", - "print '\\nPhase currents through the load are:'\n", - "print 'I_AB_mag (in Amperes)= %.3f'%I_AB_mag\n", - "print 'I_AB_phase (in Degrees)= %.2f'%I_AB_phase\n", - "print 'I_BC_mag (in Amperes)= %.3f'%I_BC_mag\n", - "print 'I_BC_phase (in Degrees)= %.2f'%I_BC_phase\n", - "print 'I_CA_mag (in Amperes)= %.3f'%I_CA_mag\n", - "print 'I_CA_phase (in Degrees)= %.2f'%I_CA_phase\n", - "\n", - "\n", - "I_AB=complex((I_AB_mag*math.cos(I_AB_phase*math.pi/180)),(I_AB_mag*math.sin(I_AB_phase*math.pi/180)));#(in Amperes)\n", - "V_AB = I_AB*Z_p\n", - "V_AB_mag = math.sqrt(V_AB.real**2+V_AB.imag**2)\n", - "V_AB_phase = math.degrees(math.atan(V_AB.imag/V_AB.real))\n", - "print '\\nLine or phase voltages at the load are:'\n", - "print 'V_AB = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase)\n", - "print 'V_BC = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase-120)\n", - "print 'V_CA = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase+120)\n", - "\n", - "P_AB=I_AB_mag**2*(Z_p.real);#in watts\n", - "P_load = 3*P_AB\n", - "print '\\nPower dissipated (in Watts)=%.2f'%(P_load)\n", - "\n", - "P_line=3*I_mag**2*(Z_L.real);#in watts\n", - "print 'Power dissipated by transmission line (in Watts)= %.f'%P_line\n", - "P_source = P_load+P_line\n", - "print 'Total power supplied by three-phase source is %.2f W'%P_source" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Source currents are:\n", - "I_na_mag (in Amperes)= 5\n", - "I_na_phase (in Degrees)=53.13\n", - "I_nb_mag (in Amperes)=5\n", - "I_nb_phase (in Degrees)=-66.87\n", - "I_nc_mag (in Amperes)=5\n", - "I_nc_phase (in Degrees)=173.13\n", - "\n", - "Phase currents through the load are:\n", - "I_AB_mag (in Amperes)= 2.887\n", - "I_AB_phase (in Degrees)= 83.13\n", - "I_BC_mag (in Amperes)= 2.887\n", - "I_BC_phase (in Degrees)= -36.87\n", - "I_CA_mag (in Amperes)= 2.887\n", - "I_CA_phase (in Degrees)= -156.87\n", - "\n", - "Line or phase voltages at the load are:\n", - "V_AB = 874.83,angle = 28.87 V\n", - "V_BC = 874.83,angle = -91.13 V\n", - "V_CA = 874.83,angle = 148.87 V\n", - "\n", - "Power dissipated (in Watts)=4424.74\n", - "Power dissipated by transmission line (in Watts)= 75\n", - "Total power supplied by three-phase source is 4499.74 W\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.5, Page 29" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "R1 = 25 #in ohms\n", - "R2 = 100 #in ohms\n", - "Rt = 100 #in ohms\n", - "V = 100. #in volts\n", - "\n", - "#Calculations\n", - "Rp = (R1*R2)/(R1+R2)\n", - "It = V/Rt #total current in circuit in Amps\n", - "V_25 = It*Rp #voltage across 25 ohm resistor, in volts\n", - "I_25 = V_25/R1 #current through 25 ohm resistor, in Amps\n", - "P_25 = V_25*I_25\n", - "\n", - "#Result\n", - "print \"Power dissipated by the 25ohm resistor is %.f W\"%P_25" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power dissipated by the 25ohm resistor is 16 W\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.6, Page 33" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "#Refer to the fig:1.16\n", - "R=40;#in ohms\n", - "L=complex(0,30);#in ohms\n", - "\n", - "\n", - "#Calculations&Results\n", - "V=117*(complex(math.cos(0),math.sin(0)));#in Volts\n", - "#Equivalent load impedance is obtained by parallel combination of Resistance R and Inductance L\n", - "Z_L=(R*L)/(R+L);#load impedance (in Ohms)\n", - "Z1=complex(0.6,16.8);# in Ohms\n", - "Z=Z_L+Z1;#Equivalent impedance of circuit (in Ohms) \n", - "I=V/Z;#current through load (in Amperes)\n", - "I_mag=math.sqrt(I.real**2+I.imag**2);#magnitude of current flowing through load (in Amperes)\n", - "I_phase=math.degrees(math.atan(I.imag/I.real))\n", - "print 'Reading of ammeter (in Amperes)=%.f,angle = %.2f'%(I_mag,I_phase)\n", - "\n", - "V_L=I*Z_L;#voltage across load (in Volts)\n", - "V_L_mag=math.sqrt(V_L.real**2+V_L.imag**2);#magnitude of voltage across load (in Volts)\n", - "V_L_phase = math.degrees(math.atan(V_L.imag/V_L.real))\n", - "print '\\nReading of voltmeter (in Volts)= %.f,angle = %.2f'%(V_L_mag,V_L_phase)\n", - "\n", - "P=(V_L*I.conjugate());#Power developed (in Watts)\n", - "print 'Reading of wattmeter (in Watts)=%.1f'%P.real\n", - "\n", - "pf=P.real/(V_L_mag*I_mag);#Power factor\n", - "print 'power factor=%.2f(lagging)'%pf" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Reading of ammeter (in Amperes)=3,angle = -67.38\n", - "\n", - "Reading of voltmeter (in Volts)= 72,angle = -14.25\n", - "Reading of wattmeter (in Watts)=129.6\n", - "power factor=0.60(lagging)\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7, Page 38" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "#transforming delta connected source into an equivalent Star-connected source\n", - "V_s=1351;#source voltage (in Volts)\n", - "V=1351/math.sqrt(3);#in volts\n", - "V_phase=0;\n", - "\n", - "#Calculations&Results\n", - "Z=complex(360,150);#per-phase impedance(in ohms)\n", - "I=V/Z;#current in the circuit (in Amperes)\n", - "I_mag=math.sqrt(I.real**2+I.imag**2);#in ampere\n", - "I_phase=math.degrees(math.atan(I.imag/I.real));#degree\n", - "\n", - "#Refer to fig 1.19(a)\n", - "V_ab=1351*complex(math.cos(-30*math.pi/180),math.sin(-30*math.pi/180));#in Volts\n", - "I_aA=2*complex(math.cos(I_phase*math.pi/180),math.sin(I_phase*math.pi/180));#in Amperes\n", - "V_cb=1351*complex(math.cos(-90*math.pi/180),math.sin(-90*math.pi/180));#in Volts\n", - "I_cC=2*complex(math.cos((I_phase-120)*math.pi/180),math.sin((I_phase-120)*math.pi/180));#in Amperes\n", - "P1=V_ab*I_aA.conjugate();#reading of wattmeter 1 (in Watts)\n", - "print 'Reading of wattmeter W1 (in Watts) =%.2f'%P1.real\n", - "P2=V_cb*I_cC.conjugate();#reading of wattmeter 2 (in Watts)\n", - "print 'Reading of wattmeter W2 (in Watts)=%.2f'%P2.real\n", - "P=P1.real+P2.real;#total power developed (in Watts)\n", - "print 'Total power developed (in Watts)= %.f' %P\n", - "\n", - "pf=math.cos(math.atan(I.imag/I.real));#power factor\n", - "print 'power factor= %.3f(lagging)'%pf" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Reading of wattmeter W1 (in Watts) =2679.62\n", - "Reading of wattmeter W2 (in Watts)=1640.39\n", - "Total power developed (in Watts)= 4320\n", - "power factor= 0.923(lagging)\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.8, Page 44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "V = 120 #Voltage(V)\n", - "I = 5 #current(A)\n", - "P = 480. #power(W)\n", - "f = 60 #Hz\n", - "\n", - "#Calculations&Results\n", - "S = V*I #apparent power(W)\n", - "theta = math.degrees(math.acos(P/S)) #power factor angle\n", - "#In phasor form,\n", - "Vp = V*complex(math.cos(0*math.pi/180),math.sin(0*math.pi/180))\n", - "Ip = I*complex(math.cos(theta*math.pi/180),math.sin(theta*math.pi/180))\n", - "\n", - "#For series circuit\n", - "Zs = Vp/Ip\n", - "print \"Equivalent Impedance of series circuit = \",Zs\n", - "Xc = -Zs.imag\n", - "C = 1./(2*math.pi*f*Xc)\n", - "print \"Equivalent capacitance of series circuit = %.2f uF\"%(C*10**6)\n", - "\n", - "#For parallel circuit\n", - "I_mag = I*math.cos(theta*math.pi/180)\n", - "I_imag = I*math.sin(theta*math.pi/180)\n", - "Rp = V/I_mag\n", - "print \"\\nEquivalent resistance of parallel circuit = %d ohms\"%Rp\n", - "Xp = V/I_imag\n", - "Cp = 1./(2*math.pi*f*Xp)\n", - "print \"Equivalent capacitance of parallel circuit = %.1f uF\"%(Cp*10**6)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Equivalent Impedance of series circuit = (19.2-14.4j)\n", - "Equivalent capacitance of series circuit = 184.21 uF\n", - "\n", - "Equivalent resistance of parallel circuit = 29 ohms\n", - "Equivalent capacitance of parallel circuit = 66.3 uF\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9, Page 46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "P = 3246 #power consumed(W)\n", - "Vl = 208. #line voltage(V)\n", - "Il = 10.6 #line current(A)\n", - "\n", - "#Calculations&Results\n", - "\n", - "#Y-Connection\n", - "V_phi = Vl/math.sqrt(3) #pre-phase voltage(V)\n", - "I_phi = Il #pre-phase current(A)\n", - "P_phi = P/3 #pre-phase power(W)\n", - "S_phi = V_phi*I_phi #pre-phase apparent power(VA)\n", - "theta = math.degrees(math.acos((P_phi/S_phi))) #lag\n", - "#In phasor form,\n", - "V_AN = V_phi*complex(math.cos(0*math.pi/180),math.sin(0*math.pi/180))\n", - "I_AN = I_phi*complex(math.cos(-theta*math.pi/180),math.sin(-theta*math.pi/180))\n", - "Zy = V_AN/I_AN\n", - "Zy_phase = math.degrees(math.atan(Zy.imag/Zy.real))\n", - "I_mag = I_phi*math.cos(Zy_phase*math.pi/180)\n", - "I_imag = I_phi*math.sin(Zy_phase*math.pi/180)\n", - "Rp = V_phi/I_mag #ohms\n", - "Xp = V_phi/I_imag #ohms\n", - "print \"For Y-connection:\"\n", - "print \"Impedance = \",Zy\n", - "print \"Resistance = %.2f ohms, Reactance = %.2f ohms\"%(Rp,Xp)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "For Y-connection:\n", - "Impedance = (9.62976148095+5.96800193442j)\n", - "Resistance = 13.33 ohms, Reactance = 21.51 ohms\n" - ] - } - ], - "prompt_number": 9 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2.ipynb b/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2.ipynb deleted file mode 100755 index cbafa256..00000000 --- a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2.ipynb +++ /dev/null @@ -1,393 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:b5ac0fcf729add8ad42e5962c5649d2a5a944710ab497f047f8a98ee7c6fe43e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 1: Review of Basic Laws of Electromagnetism" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1, Page 66" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "N=1000;#Number of turns\n", - "phy_1=100*10**-3;#initial magnetic flux (in webers)\n", - "phy_2=20*10**-3;#final magnetic flux (in webers)\n", - "\n", - "#Calculations\n", - "phy=phy_2-phy_1;#change in magnetic flux\n", - "t=5;#(in seconds)\n", - "e=(-1)*N*(phy/t);#induced emf (in volts)\n", - "\n", - "#Result\n", - "print 'Induced emf (in volts)=%.f'%e" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Induced emf (in volts)=16\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6, Page 90" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "u_o=4*math.pi*10**-7;#permeablity of air\n", - "u_r=1200;#permeablity of magnetic material\n", - "N=1500;#No. of turns\n", - "I=4;#current in the coil (in Amperes)\n", - "r_i=10*10**-2;#inner radii of magnetic core (in meters)\n", - "r_o=12*10**-2;#outer radii of magnetic core (in meters)\n", - "\n", - "#Calculations\n", - "r_m=(r_i+r_o)/2;#mean radii of magnetic core (in meters)\n", - "l_g=1*10**-2;#length of air gap (in meters)\n", - "l_m=2*math.pi*(r_m-l_g);#in meters\n", - "#Refer to fig:-2.14\n", - "A_m=(r_o-r_i)**2;#cross-sectional area of magnetic path (in meter**2)\n", - "R_m=l_m/(u_o*u_r*A_m);#reluctance of magnetic material\n", - "R_g=l_g/(u_o*A_m);#reluctance of air gap\n", - "#R_m and R_g in sereis\n", - "R=R_m+R_g;\n", - "B_m=N*I/(R*A_m);#magnetic flux density (in Tesla)\n", - "\n", - "#Result\n", - "print 'magnetic flux density (in Tesla)=%.3f T'%B_m" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnetic flux density (in Tesla)=0.716 T\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.10, Page 103" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "#Refer to eqn 2.26\n", - "e_21=20.;#voltage induced in coil-2 (in volts)\n", - "I1=2000;#rate of change of current in coil-1 (in Amperes/second)\n", - "\n", - "#Calculations\n", - "M=e_21/I1;# in henry\n", - "L1=25*10**-3;#in henry\n", - "L2=25*10**-3;#in henry\n", - "#Refer to eqn 2.32\n", - "k=(M/L1)*100;#coefficient of coupling\n", - "\n", - "#Result\n", - "print 'percentage (%%)=%.f'%k" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "percentage (%)=40\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.11, Page 106" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "#L1,L2=inductances of coil 1&2\n", - "#M=mutual inductance b/w coil 1&2\n", - "L_aid=2.38;#effective inductance when connected in sereis aiding\n", - "L_opp=1.02;#effective inductance when connected in sereis opposing\n", - "\n", - "#Calculations&Results\n", - "#L1+L2+2M=L_aid\n", - "#L1+L2-2M=L_opp\n", - "M=(L_aid-L_opp)/4;#in henry\n", - "print 'mutual inductance (in henry)= %.2f'%M\n", - "#L1=16*L2\n", - "L1=(L_aid-2*M)/17;#in henry\n", - "print 'inductance of coil-1 (in henry)= %.1f'%L1\n", - "L2=L_aid-(2*M)-L1;#in henry\n", - "print 'inductance of coil-2 (in henry)=%.1f'%L2\n", - "k=M/(math.sqrt(L1*L2));\n", - "print 'coefficient of coupling=%.2f'%k" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mutual inductance (in henry)= 0.34\n", - "inductance of coil-1 (in henry)= 0.1\n", - "inductance of coil-2 (in henry)=1.6\n", - "coefficient of coupling=0.85\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.12, Page 108" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "L1=1.6;#self inductance of coil 1 (in Henry)\n", - "L2=0.1;#self inductance of coil 2 (in Henry)\n", - "M=0.34;#mutual inductance (in Henry)\n", - "\n", - "#Calculations&Results\n", - "#Refer to eqn-2.45\n", - "L_aid=((L1*L2)-M**2)*10**3/(L1+L2-(2*M));#in mili-Henry\n", - "print 'effective inductance in parallel aiding (in mili-Henry)=%.1f'%L_aid\n", - "#Refer to eqn-2.46\n", - "L_opp=((L1*L2)-M**2)*10**3/(L1+L2+(2*M));#in mili-henry\n", - "print 'effective inductance in parallel opposing (in mini-Henry)=%.1f'%L_opp" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "effective inductance in parallel aiding (in mili-Henry)=43.5\n", - "effective inductance in parallel opposing (in mini-Henry)=18.7\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.13, Page 113" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import numpy\n", - "\n", - "#Variable declaration\n", - "#refer to eqn-2.50\n", - "#eqn:-2.51,2.52 & 2.53 are obtained\n", - "f=numpy.array([25, 25, 60]);#in hertz\n", - "T = numpy.array([1.1,1.5,1.1])\n", - "\n", - "#Calculations&Results\n", - "B_m=numpy.array([1.1, 1.5, 1.1])\n", - "P_m=numpy.array([0.4, 0.8, 1.2])\n", - "#On solving eqn:-2.51 & eqn:-2.53\n", - "k_e=(0.016-0.02)/(30.25-72.6);\n", - "#on solving eqn:-2.51 & eqn:-2.52\n", - "n=(math.log((0.016-(30.25*k_e))/(0.032-(56.25*k_e))))/(math.log(1.1/1.5));\n", - "k_h=(0.016-(30.25*k_e))/1.1**n;\n", - "P_h=k_h*f*B_m**n#hysteresis loss\n", - "P_eddy=k_e*(f**2)*B_m**2#eddy current loss\n", - "\n", - "#Results\n", - "for n in range(3,):\n", - " print 'Frequency(Hz)\\t\\tFlux Density(T)\\t\\tHysteresis loss(W/kg)\\t\\tEddy-current loss(W/kg)\\n',(f[n]),\"\\t\\t\\t\",round(T[n],1),\"\\t\\t\\t\",round(P_h[n],3),\"\\t\\t\\t\\t\",round(P_eddy[n],3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Frequency(Hz)\t\tFlux Density(T)\t\tHysteresis loss(W/kg)\t\tEddy-current loss(W/kg)\n", - "25 \t\t\t1.1 \t\t\t0.329 \t\t\t\t0.071\n", - "Frequency(Hz)\t\tFlux Density(T)\t\tHysteresis loss(W/kg)\t\tEddy-current loss(W/kg)\n", - "25 \t\t\t1.5 \t\t\t0.667 \t\t\t\t0.133\n", - "Frequency(Hz)\t\tFlux Density(T)\t\tHysteresis loss(W/kg)\t\tEddy-current loss(W/kg)\n", - "60 \t\t\t1.1 \t\t\t0.789 \t\t\t\t0.411\n" - ] - } - ], - "prompt_number": 62 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.14, Page 118" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "u_o=4*math.pi*10**-7;#permeablity of air\n", - "u_r=500;#permeablity of steel\n", - "l_g=1*10**-2;#length of air gap section (in meter)\n", - "A_g=10*10**-4;#cross-sectional area of air gap section (in meter**2)\n", - "A_m=10*10**-4;#cross-sectional area of magnet section (in meter**2)\n", - "A_s=10*10**-4;#cross-sectional area of steel sections (in meter**2)\n", - "l_s=50*10**-2;#length of steel section (in meter)\n", - "#Refer to fig:-2.29 (Demagnetization and energy-product curves of a magnet)\n", - "H_m=-144*10**3;#(in Ampere/meter)\n", - "B_m=0.23;#Magnetic flux density (in Tesla)\n", - "\n", - "#Calculations\n", - "#refer to eqn:-2.55\n", - "l_m=(-1*100)*(((l_g*A_m)/(u_o*A_g))+((2*l_s*A_m)/(u_o*u_r*A_s)))*(B_m/H_m);# (in centimeter)\n", - "\n", - "#Result\n", - "print 'minimum length of magnet (in centimeter)=%.2f'%l_m" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "minimum length of magnet (in centimeter)=1.53\n" - ] - } - ], - "prompt_number": 64 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.15, Page 119" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import sympy\n", - "\n", - "#Variable declaration\n", - "#From figure 2.32(a)\n", - "lm = 52-42 #mean length of magnets,mm\n", - "ls = 2.5+2.5+(2*math.pi*54.5/4) #mean length of yoke,mm\n", - "lg = 42-40 #air gap,mm\n", - "la = 17.5+17.5+(2*math.pi*22.5/4) #mean length of rotor,mm\n", - "\n", - "#Calculations\n", - "#From figure 2.32(b)\n", - "Am = 50*(52+42)*math.pi/4 #cross-sectional area of magnet,mm^2\n", - "As = 5*50 #cross-sectional area of yoke,mm^2\n", - "Ag = 50*(42+40)*math.pi/4 #cross-sectional area of air-gap,mm^2\n", - "Aa = 35*50 #cross-sectional area of rotor,mm^2\n", - "\n", - "Bm = 0.337 #T\n", - "phi = Bm*Am #Wb\n", - "phi_t = round(2*phi*10**-3,3) #Wb\n", - "#We know that, phi_c = 2.488cos100t mWb\n", - "from sympy import Symbol,diff,cos\n", - "t = Symbol('t')\n", - "d_phi_by_dt = diff(cos(100*t),t)\n", - "e = -phi_t*d_phi_by_dt\n", - "#Result\n", - "print \"The induced emf is\",e,\"V\"\n", - "#Incorrect result in textbook" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The induced emf is 248.8*sin(100*t) V\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2_1.ipynb b/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2_1.ipynb deleted file mode 100755 index a2bb8ad8..00000000 --- a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch2_1.ipynb +++ /dev/null @@ -1,393 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:6624caec90dfae162d7608f118e1da7eb04a99fd78544aa4875357128ed122c5" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 2: Review of Basic Laws of Electromagnetism" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1, Page 66" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "N=1000;#Number of turns\n", - "phy_1=100*10**-3;#initial magnetic flux (in webers)\n", - "phy_2=20*10**-3;#final magnetic flux (in webers)\n", - "\n", - "#Calculations\n", - "phy=phy_2-phy_1;#change in magnetic flux\n", - "t=5;#(in seconds)\n", - "e=(-1)*N*(phy/t);#induced emf (in volts)\n", - "\n", - "#Result\n", - "print 'Induced emf (in volts)=%.f'%e" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Induced emf (in volts)=16\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6, Page 90" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "u_o=4*math.pi*10**-7;#permeablity of air\n", - "u_r=1200;#permeablity of magnetic material\n", - "N=1500;#No. of turns\n", - "I=4;#current in the coil (in Amperes)\n", - "r_i=10*10**-2;#inner radii of magnetic core (in meters)\n", - "r_o=12*10**-2;#outer radii of magnetic core (in meters)\n", - "\n", - "#Calculations\n", - "r_m=(r_i+r_o)/2;#mean radii of magnetic core (in meters)\n", - "l_g=1*10**-2;#length of air gap (in meters)\n", - "l_m=2*math.pi*(r_m-l_g);#in meters\n", - "#Refer to fig:-2.14\n", - "A_m=(r_o-r_i)**2;#cross-sectional area of magnetic path (in meter**2)\n", - "R_m=l_m/(u_o*u_r*A_m);#reluctance of magnetic material\n", - "R_g=l_g/(u_o*A_m);#reluctance of air gap\n", - "#R_m and R_g in sereis\n", - "R=R_m+R_g;\n", - "B_m=N*I/(R*A_m);#magnetic flux density (in Tesla)\n", - "\n", - "#Result\n", - "print 'magnetic flux density (in Tesla)=%.3f T'%B_m" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnetic flux density (in Tesla)=0.716 T\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.10, Page 103" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "#Refer to eqn 2.26\n", - "e_21=20.;#voltage induced in coil-2 (in volts)\n", - "I1=2000;#rate of change of current in coil-1 (in Amperes/second)\n", - "\n", - "#Calculations\n", - "M=e_21/I1;# in henry\n", - "L1=25*10**-3;#in henry\n", - "L2=25*10**-3;#in henry\n", - "#Refer to eqn 2.32\n", - "k=(M/L1)*100;#coefficient of coupling\n", - "\n", - "#Result\n", - "print 'percentage (%%)=%.f'%k" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "percentage (%)=40\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.11, Page 106" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "#L1,L2=inductances of coil 1&2\n", - "#M=mutual inductance b/w coil 1&2\n", - "L_aid=2.38;#effective inductance when connected in sereis aiding\n", - "L_opp=1.02;#effective inductance when connected in sereis opposing\n", - "\n", - "#Calculations&Results\n", - "#L1+L2+2M=L_aid\n", - "#L1+L2-2M=L_opp\n", - "M=(L_aid-L_opp)/4;#in henry\n", - "print 'mutual inductance (in henry)= %.2f'%M\n", - "#L1=16*L2\n", - "L1=(L_aid-2*M)/17;#in henry\n", - "print 'inductance of coil-1 (in henry)= %.1f'%L1\n", - "L2=L_aid-(2*M)-L1;#in henry\n", - "print 'inductance of coil-2 (in henry)=%.1f'%L2\n", - "k=M/(math.sqrt(L1*L2));\n", - "print 'coefficient of coupling=%.2f'%k" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mutual inductance (in henry)= 0.34\n", - "inductance of coil-1 (in henry)= 0.1\n", - "inductance of coil-2 (in henry)=1.6\n", - "coefficient of coupling=0.85\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.12, Page 108" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Variable declaration\n", - "L1=1.6;#self inductance of coil 1 (in Henry)\n", - "L2=0.1;#self inductance of coil 2 (in Henry)\n", - "M=0.34;#mutual inductance (in Henry)\n", - "\n", - "#Calculations&Results\n", - "#Refer to eqn-2.45\n", - "L_aid=((L1*L2)-M**2)*10**3/(L1+L2-(2*M));#in mili-Henry\n", - "print 'effective inductance in parallel aiding (in mili-Henry)=%.1f'%L_aid\n", - "#Refer to eqn-2.46\n", - "L_opp=((L1*L2)-M**2)*10**3/(L1+L2+(2*M));#in mili-henry\n", - "print 'effective inductance in parallel opposing (in mini-Henry)=%.1f'%L_opp" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "effective inductance in parallel aiding (in mili-Henry)=43.5\n", - "effective inductance in parallel opposing (in mini-Henry)=18.7\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.13, Page 113" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import numpy\n", - "\n", - "#Variable declaration\n", - "#refer to eqn-2.50\n", - "#eqn:-2.51,2.52 & 2.53 are obtained\n", - "f=numpy.array([25, 25, 60]);#in hertz\n", - "T = numpy.array([1.1,1.5,1.1])\n", - "\n", - "#Calculations&Results\n", - "B_m=numpy.array([1.1, 1.5, 1.1])\n", - "P_m=numpy.array([0.4, 0.8, 1.2])\n", - "#On solving eqn:-2.51 & eqn:-2.53\n", - "k_e=(0.016-0.02)/(30.25-72.6);\n", - "#on solving eqn:-2.51 & eqn:-2.52\n", - "n=(math.log((0.016-(30.25*k_e))/(0.032-(56.25*k_e))))/(math.log(1.1/1.5));\n", - "k_h=(0.016-(30.25*k_e))/1.1**n;\n", - "P_h=k_h*f*B_m**n#hysteresis loss\n", - "P_eddy=k_e*(f**2)*B_m**2#eddy current loss\n", - "\n", - "#Results\n", - "for n in range(3,):\n", - " print 'Frequency(Hz)\\t\\tFlux Density(T)\\t\\tHysteresis loss(W/kg)\\t\\tEddy-current loss(W/kg)\\n',(f[n]),\"\\t\\t\\t\",round(T[n],1),\"\\t\\t\\t\",round(P_h[n],3),\"\\t\\t\\t\\t\",round(P_eddy[n],3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Frequency(Hz)\t\tFlux Density(T)\t\tHysteresis loss(W/kg)\t\tEddy-current loss(W/kg)\n", - "25 \t\t\t1.1 \t\t\t0.329 \t\t\t\t0.071\n", - "Frequency(Hz)\t\tFlux Density(T)\t\tHysteresis loss(W/kg)\t\tEddy-current loss(W/kg)\n", - "25 \t\t\t1.5 \t\t\t0.667 \t\t\t\t0.133\n", - "Frequency(Hz)\t\tFlux Density(T)\t\tHysteresis loss(W/kg)\t\tEddy-current loss(W/kg)\n", - "60 \t\t\t1.1 \t\t\t0.789 \t\t\t\t0.411\n" - ] - } - ], - "prompt_number": 62 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.14, Page 118" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "u_o=4*math.pi*10**-7;#permeablity of air\n", - "u_r=500;#permeablity of steel\n", - "l_g=1*10**-2;#length of air gap section (in meter)\n", - "A_g=10*10**-4;#cross-sectional area of air gap section (in meter**2)\n", - "A_m=10*10**-4;#cross-sectional area of magnet section (in meter**2)\n", - "A_s=10*10**-4;#cross-sectional area of steel sections (in meter**2)\n", - "l_s=50*10**-2;#length of steel section (in meter)\n", - "#Refer to fig:-2.29 (Demagnetization and energy-product curves of a magnet)\n", - "H_m=-144*10**3;#(in Ampere/meter)\n", - "B_m=0.23;#Magnetic flux density (in Tesla)\n", - "\n", - "#Calculations\n", - "#refer to eqn:-2.55\n", - "l_m=(-1*100)*(((l_g*A_m)/(u_o*A_g))+((2*l_s*A_m)/(u_o*u_r*A_s)))*(B_m/H_m);# (in centimeter)\n", - "\n", - "#Result\n", - "print 'minimum length of magnet (in centimeter)=%.2f'%l_m" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "minimum length of magnet (in centimeter)=1.53\n" - ] - } - ], - "prompt_number": 64 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.15, Page 119" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import sympy\n", - "\n", - "#Variable declaration\n", - "#From figure 2.32(a)\n", - "lm = 52-42 #mean length of magnets,mm\n", - "ls = 2.5+2.5+(2*math.pi*54.5/4) #mean length of yoke,mm\n", - "lg = 42-40 #air gap,mm\n", - "la = 17.5+17.5+(2*math.pi*22.5/4) #mean length of rotor,mm\n", - "\n", - "#Calculations\n", - "#From figure 2.32(b)\n", - "Am = 50*(52+42)*math.pi/4 #cross-sectional area of magnet,mm^2\n", - "As = 5*50 #cross-sectional area of yoke,mm^2\n", - "Ag = 50*(42+40)*math.pi/4 #cross-sectional area of air-gap,mm^2\n", - "Aa = 35*50 #cross-sectional area of rotor,mm^2\n", - "\n", - "Bm = 0.337 #T\n", - "phi = Bm*Am #Wb\n", - "phi_t = round(2*phi*10**-3,3) #Wb\n", - "#We know that, phi_c = 2.488cos100t mWb\n", - "from sympy import Symbol,diff,cos\n", - "t = Symbol('t')\n", - "d_phi_by_dt = diff(cos(100*t),t)\n", - "e = -phi_t*d_phi_by_dt\n", - "#Result\n", - "print \"The induced emf is\",e,\"V\"\n", - "#Incorrect result in textbook" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The induced emf is 248.8*sin(100*t) V\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3.ipynb b/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3.ipynb deleted file mode 100755 index e9592db7..00000000 --- a/_Electric_Machinery_And_Transformers_by_B._S._Guru_And_H._R._Hiziroglu/ch3.ipynb +++ /dev/null @@ -1,399 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:8539e9632363526a1a80f9cc5f76e7021b8f8d8a0160c441e4d39f4cdb32d610" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 3: Principles of Electromechanical Energy Conversion" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.1, Page 144" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#Variable declaration\n", - "A=20*10**-4;#surface area of each capacitor's plate \n", - "d=5*10**-3;#separation between the plates\n", - "e=(10**-9)/(36*math.pi);#permetivity of air\n", - "V=10*10**3;#potential diff. between the plates\n", - "\n", - "#Calculations&Results\n", - "F_e=(e*A*V**2)/(2*d**2);#electric force\n", - "g=9.81;#acceleration due to gravity (in meter/second**2)\n", - "#For condt of balancing electric force=weight of object\n", - "#F_e=m*g\n", - "m=F_e/g;\n", - "print 'mass of object (in grams)=%.2f'%(m*1000)\n", - "W_f=(e*A*V**2)/(2*d);\n", - "print 'energy stored in the feild (in micro-joules)=%.f'%(W_f*1000000)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mass of object (in grams)=3.61\n", - "energy stored in the feild (in micro-joules)=177\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.3, Page 148" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import scipy\n", - "from scipy.integrate import quad\n", - "\n", - "#Variable declaration\n", - "#i=current in the ckt (in Amperes)\n", - "#x=total flux linkage\n", - "\n", - "#Calculations\n", - "def f(x):\n", - " return x/(6-(2*x))\n", - "#Refer to eqn:3.18\n", - "W_m,err=quad(f,0,2);#Energy stored in magnetic feild\n", - "\n", - "#Result\n", - "print 'Energy stored in magnetic feild (in Joules)=%.3f'%W_m" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Energy stored in magnetic feild (in Joules)=0.648\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.4, Page 151" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "import scipy\n", - "from scipy.misc import derivative\n", - "\n", - "#Variable declaration\n", - "N=100;#no. of turns of coil\n", - "A=10**-4;#area \n", - "x=1*10**-2;#length of air gap\n", - "u_o=4*math.pi*10**-7;#permeablity of air\n", - "u_r=2000;#permeablity of magnetic material\n", - "D=7.85*10**3;#density of material (in kg/m**3)\n", - "V=11*10**-6;#volume of material\n", - "m=D*V;#mass of material\n", - "g=9.81;#acceleration due to gravity\n", - "\n", - "#Calculations&Results\n", - "#Refer to fig:3.7\n", - "R_o=(15.5*10**-2)/(u_o*u_r*A);#reluctance of outer legs\n", - "R_c=(5.5*10**-2)/(u_o*u_r*A);#reluctance of central leg\n", - "def L( x ):#inductance\n", - " return (N**2)/ R ( x );\n", - "\n", - "def R( x ):#total reluctance \n", - " return R_c+R_g(x)+(0.5*(R_o+R_g(x)));\n", - "\n", - "def R_g( x ):#reluctance of air gap\n", - " return x/(u_o*A);\n", - "\n", - "x = 0.01 ; # Points of interest\n", - "t = derivative(L,x)\n", - "#t=[diag(derivative(L,x))];#t=dL/dx (at x=0.01m)\n", - "#since tIn book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\n" - ] - } - ], - "source": [ - "#cal of brake power,fuel consumption\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.4, Page:389 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\")\n", - "m=0.25;#specific fuel consumption in kg/KWh\n", - "Pb_mep=1.5*1000;#brake mean effective pressure of each cylinder in Kpa\n", - "N=100;#engine rpm\n", - "D=85*10**-2;#bore of cylinder in m\n", - "L=220*10**-2;#stroke in m\n", - "C=43*10**3;#calorific value of diesel in KJ/kg\n", - "A=math.pi*D**2/4;\n", - "BP=Pb_mep*L*A*N/60\n", - "print(\"brake power of engine(BP) in MW=\"),round(BP,2)\n", - "print(\"so brake power is 3.121 MW\")\n", - "print(\"The fuel consumption in kg/hr(m)=m*BP in kg/hr\")\n", - "m=m*BP\n", - "print(\"In order to find out brake thermal efficiency the heat input from fuel per second is required.\")\n", - "print(\"heat from fuel(Q)in KJ/s\")\n", - "print(\"Q=m*C/3600\")\n", - "Q=m*C/3600\n", - "print(\"energy to brake power=3120.97 KW\")\n", - "n=BP/Q\n", - "print(\"brake thermal efficiency(n)=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\")\n", - "print(\"NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.5;pg no: 389" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.5, Page:389 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\n", - "brake thermal efficiency(n)=3600/(m*C) 0.33\n", - "in percentage 33.49\n", - "brake power(BP)in KW\n", - "BP= 226.19\n", - "brake specific fuel consumption,m=mf/BP\n", - "so mf=m*BP in kg/hr\n", - "air consumption(ma)from given air fuel ratio=k*mf in kg/hr\n", - "ma in kg/min\n", - "using perfect gas equation,\n", - "P*Va=ma*R*T\n", - "sa Va=ma*R*T/P in m^3/min\n", - "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", - "volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder) 1.87\n", - "in percentage 186.55\n", - "NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\n" - ] - } - ], - "source": [ - "#cal of brake thermal efficiency,brake power,volumetric efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.5, Page:389 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\")\n", - "Pb_mep=6*10**5;#brake mean effective pressure in pa\n", - "N=600;#engine rpm\n", - "m=0.25;#specific fuel consumption in kg/KWh\n", - "D=20*10**-2;#bore of cylinder in m\n", - "L=30*10**-2;#stroke in m\n", - "k=26;#air to fuel ratio\n", - "C=43*10**3;#calorific value in KJ/kg\n", - "R=0.287;#gas constant in KJ/kg K\n", - "T=(27+273);#ambient temperature in K\n", - "P=1*10**2;#ambient pressure in Kpa\n", - "n=3600/(m*C)\n", - "print(\"brake thermal efficiency(n)=3600/(m*C)\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"brake power(BP)in KW\")\n", - "A=math.pi*D**2/4;\n", - "BP=4*Pb_mep*L*A*N/60000\n", - "print(\"BP=\"),round(BP,2)\n", - "print(\"brake specific fuel consumption,m=mf/BP\")\n", - "print(\"so mf=m*BP in kg/hr\")\n", - "mf=m*BP\n", - "print(\"air consumption(ma)from given air fuel ratio=k*mf in kg/hr\")\n", - "ma=k*mf\n", - "print(\"ma in kg/min\")\n", - "ma=ma/60\n", - "print(\"using perfect gas equation,\")\n", - "print(\"P*Va=ma*R*T\")\n", - "print(\"sa Va=ma*R*T/P in m^3/min\")\n", - "Va=ma*R*T/P\n", - "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", - "Vs=math.pi*D**2*L/4\n", - "n_vol=Va/(Vs*(N/2)*4)\n", - "print(\"volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder)\"),round(n_vol,2)\n", - "print(\"in percentage\"),round(n_vol*100,2)\n", - "print(\"NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.6;pg no: 390" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.6, Page:390 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\n", - "let the bore diameter be (D) m\n", - "piston speed(V)=2*L*N\n", - "so L=V/(2*N) in m\n", - "volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\n", - "so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\n", - "so air sucked =274.78*D^2 m^3/min\n", - "air requirement(ma),kg/min=A/F ratio*fuel consumption per min\n", - "so ma=r*m in kg/min\n", - "using perfect gas equation,P*Va=ma*R*T\n", - "so Va=ma*R*T/P in m^3/min\n", - "ideally,air sucked=Va\n", - "so 274.78*D^2=0.906\n", - "D=sqrt(0.906/274.78) in m\n", - "indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\n", - "brake power=indicated power*mechanical efficiency\n", - "BP=IP*n_mech in KW 10.35\n", - "so brake power=10.34 KW\n" - ] - } - ], - "source": [ - "#cal of brake power\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 10.6, Page:390 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\")\n", - "N=3000;#engine rpm\n", - "m=5;#fuel consumption in litre/hr\n", - "r=19;#air-fuel ratio\n", - "sg=0.7;#specific gravity of fuel\n", - "V=500;#piston speed in m/min\n", - "P_imep=6*10**5;#indicated mean effective pressure in pa\n", - "P=1.013*10**5;#ambient pressure in pa\n", - "T=(15+273);#ambient temperature in K\n", - "n_vol=0.7;#volumetric efficiency \n", - "n_mech=0.8;#mechanical efficiency\n", - "R=0.287;#gas constant for gas in KJ/kg K\n", - "print(\"let the bore diameter be (D) m\")\n", - "print(\"piston speed(V)=2*L*N\")\n", - "print(\"so L=V/(2*N) in m\")\n", - "L=V/(2*N)\n", - "L=0.0833;#approx.\n", - "print(\"volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\")\n", - "print(\"so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\")\n", - "n_vol*(math.pi*L/4)*N*2\n", - "print(\"so air sucked =274.78*D^2 m^3/min\")\n", - "print(\"air requirement(ma),kg/min=A/F ratio*fuel consumption per min\")\n", - "print(\"so ma=r*m in kg/min\")\n", - "ma=r*m*sg/60\n", - "print(\"using perfect gas equation,P*Va=ma*R*T\")\n", - "print(\"so Va=ma*R*T/P in m^3/min\")\n", - "Va=ma*R*T*1000/P \n", - "print(\"ideally,air sucked=Va\")\n", - "print(\"so 274.78*D^2=0.906\")\n", - "print(\"D=sqrt(0.906/274.78) in m\")\n", - "D=math.sqrt(0.906/274.78) \n", - "print(\"indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\")\n", - "IP=P_imep*L*(math.pi*D**2/4)*(N/60)*2/1000\n", - "print(\"brake power=indicated power*mechanical efficiency\")\n", - "BP=IP*n_mech \n", - "print(\"BP=IP*n_mech in KW\"),round(BP,2)\n", - "print(\"so brake power=10.34 KW\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.7;pg no: 391" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.7, Page:391 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\n", - "After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\n", - "friction power(FP)=5 KW\n", - "brake power(BP) in KW= 30.82\n", - "indicated power(IP) in KW= 35.82\n", - "mechanical efficiency(n_mech)= 0.86\n", - "in percentage 86.04\n", - "brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr= 0.29\n", - "brake thermal efficiency(n_bte)= 0.29\n", - "in percentage 28.67\n", - "also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\n", - "indicated thermal efficiency(n_ite)= 0.33\n", - "in percentage 33.32\n", - "indicated power(IP)=P_imep*L*A*N\n", - "so P_imep in Kpa= 76.01\n", - "Also,mechanical efficiency=P_bmep/P_imep\n", - "so P_bmep in Kpa= 65.4\n", - "brake power=30.82 KW\n", - "indicated power=35.82 KW\n", - "mechanical efficiency=86.04%\n", - "brake thermal efficiency=28.67%\n", - "indicated thermal efficiency=33.32%\n", - "brake mean effective pressure=65.39 Kpa\n", - "indicated mean effective pressure=76.01 Kpa\n" - ] - } - ], - "source": [ - "#cal of power and efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.7, Page:391 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\")\n", - "M=20;#load on dynamometer in kg\n", - "r=50*10**-2;#radius in m\n", - "N=3000;#speed of rotation in rpm\n", - "D=20*10**-2;#bore in m\n", - "L=30*10**-2;#stroke in m\n", - "m=0.15;#fuel supplying rate in kg/min\n", - "C=43;#calorific value of fuel in MJ/kg\n", - "FP=5;#friction power in KW\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\")\n", - "print(\"friction power(FP)=5 KW\")\n", - "BP=2*math.pi*N*(M*g*r)*10**-3/60\n", - "print(\"brake power(BP) in KW=\"),round(BP,2)\n", - "IP=BP+FP\n", - "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", - "n_mech=BP/IP\n", - "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "bsfc=m*60/BP\n", - "print(\"brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr=\"),round(bsfc,2)\n", - "n_bte=3600/(bsfc*C*1000)\n", - "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", - "print(\"in percentage\"),round(n_bte*100,2)\n", - "print(\"also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\")\n", - "n_ite=n_bte/n_mech\n", - "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", - "print(\"in percentage\"),round(n_ite*100,2)\n", - "print(\"indicated power(IP)=P_imep*L*A*N\")\n", - "P_imep=IP/(L*(math.pi*D**2/4)*N/60)\n", - "print(\"so P_imep in Kpa=\"),round(P_imep,2)\n", - "print(\"Also,mechanical efficiency=P_bmep/P_imep\")\n", - "n_mech=0.8604;#mechanical efficiency\n", - "P_bmep=P_imep*n_mech\n", - "print(\"so P_bmep in Kpa=\"),round(P_bmep,2)\n", - "print(\"brake power=30.82 KW\")\n", - "print(\"indicated power=35.82 KW\")\n", - "print(\"mechanical efficiency=86.04%\")\n", - "print(\"brake thermal efficiency=28.67%\")\n", - "print(\"indicated thermal efficiency=33.32%\")\n", - "print(\"brake mean effective pressure=65.39 Kpa\")\n", - "print(\"indicated mean effective pressure=76.01 Kpa\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.8;pg no: 392" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.8, Page:392 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\n", - "indicated power(IP) in KW= 282.74\n", - "mechanical efficiency(n_mech)=brake power/indicated power\n", - "so n_mech= 0.88\n", - "in percentage 88.42\n", - "brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\n", - "brake thermal efficiency(n_bte)= 0.35\n", - "in percentage 34.88\n", - "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", - "mass of air corresponding to above swept volume,using perfect gas equation\n", - "P*Vs=ma*R*T\n", - "so ma=(P*Vs)/(R*T) in kg\n", - "volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\n", - "so mass of air taken per minute in kg/min \n", - "mass corresponding to swept volume per minute in kg/min\n", - "so volumetric efficiency 0.8333\n", - "in percentage 83.3333\n", - "so indicated power =282.74 KW,mechanical efficiency=88.42%\n", - "brake thermal efficiency=34.88%,volumetric efficiency=83.33%\n" - ] - } - ], - "source": [ - "#cal of brake thermal efficiency,volumetric effeciency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.8, Page:392 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\")\n", - "N=300.;#engine rpm\n", - "BP=250.;#brake power in KW\n", - "D=30.*10**-2;#bore in m\n", - "L=25.*10**-2;#stroke in m\n", - "m=1.;#fuel consumption in kg/min\n", - "r=10.;#airfuel ratio \n", - "P_imep=0.8;#indicated mean effective pressure in pa\n", - "C=43.*10**3;#calorific value of fuel in KJ/kg\n", - "P=1.013*10**5;#ambient pressure in K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "T=(27.+273.);#ambient temperature in K\n", - "IP=P_imep*L*(math.pi*D**2/4)*N*4*10**3/60\n", - "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", - "print(\"mechanical efficiency(n_mech)=brake power/indicated power\")\n", - "n_mech=BP/IP\n", - "print(\"so n_mech=\"),round(n_mech,2)\n", - "print(\"in percentage \"),round(n_mech*100,2)\n", - "print(\"brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\")\n", - "bsfc=m*60./BP\n", - "n_bte=3600./(bsfc*C)\n", - "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", - "print(\"in percentage\"),round(n_bte*100,2)\n", - "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", - "Vs=math.pi*D**2*L/4\n", - "print(\"mass of air corresponding to above swept volume,using perfect gas equation\")\n", - "print(\"P*Vs=ma*R*T\")\n", - "print(\"so ma=(P*Vs)/(R*T) in kg\")\n", - "ma=(P*Vs)/(R*T*1000) \n", - "ma=0.02;#approx.\n", - "print(\"volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\")\n", - "print(\"so mass of air taken per minute in kg/min \")\n", - "1*10\n", - "print(\"mass corresponding to swept volume per minute in kg/min\")\n", - "ma*4*N/2\n", - "print(\"so volumetric efficiency \"),round(10./12.,4)\n", - "print(\"in percentage\"),round((10./12.)*100.,4)\n", - "print(\"so indicated power =282.74 KW,mechanical efficiency=88.42%\")\n", - "print(\"brake thermal efficiency=34.88%,volumetric efficiency=83.33%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.9;pg no: 393" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.9, Page:393 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\n", - "indicated mean effective pressure(P_imeb)=h*k in Kpa\n", - "indicated power(IP)=P_imeb*L*A*N/2 in KW 9.375\n", - "brake power(BP)=2*%pi*N*T in KW 4.62\n", - "mechanical efficiency(n_mech)= 0.49\n", - "in percentage 49.31\n", - "so indicated power=9.375 KW\n", - "brake power=4.62 KW\n", - "mechanical efficiency=49.28%\n", - "energy liberated from fuel(Ef)=C*m/60 in KJ/s\n", - "energy available as brake power(BP)=4.62 KW\n", - "energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\n", - "energy carried by exhaust gases(Eg)=30 KJ/s\n", - "unaccounted energy loss in KW= 34.75\n", - "NOTE=>overall energy balance sheet is attached as jpg file with this code.\n" - ] - } - ], - "source": [ - "#cal of indicated power,brake power,mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.9, Page:393 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\")\n", - "h=10.;#height of indicator diagram in mm\n", - "k=25.;#indicator constant in KN/m^2 per mm\n", - "N=300.;#engine rpm\n", - "Vs=1.5*10**-2;#swept volume in m^3\n", - "M=60.;#effective brake load upon dynamometer in kg\n", - "r=50.*10**-2;#effective brake drum radius in m\n", - "m=0.12;#fuel consumption in kg/min\n", - "C=42.*10**3;#calorific value in KJ/kg\n", - "mw=6.;#circulating water rate in kg/min\n", - "T1=35.;#cooling water entering temperature in degree celcius\n", - "T2=70.;#cooling water leaving temperature in degree celcius\n", - "Eg=30.;#exhaust gases leaving energy in KJ/s\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "g=9.81;#accelaration due to gravity in m/s^2\n", - "print(\"indicated mean effective pressure(P_imeb)=h*k in Kpa\")\n", - "P_imeb=h*k\n", - "IP=P_imeb*Vs*N/(2*60)\n", - "print(\"indicated power(IP)=P_imeb*L*A*N/2 in KW\") ,round(IP,3)\n", - "BP=2*math.pi*N*(M*g*r*10**-3)/(2*60)\n", - "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", - "n_mech=BP/IP\n", - "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "print(\"so indicated power=9.375 KW\")\n", - "print(\"brake power=4.62 KW\")\n", - "print(\"mechanical efficiency=49.28%\")\n", - "print(\"energy liberated from fuel(Ef)=C*m/60 in KJ/s\")\n", - "Ef=C*m/60\n", - "print(\"energy available as brake power(BP)=4.62 KW\")\n", - "print(\"energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\")\n", - "Ec=(mw/M)*Cw*(T2-T1)\n", - "print(\"energy carried by exhaust gases(Eg)=30 KJ/s\")\n", - "Ef-BP-Ec-Eg\n", - "print(\"unaccounted energy loss in KW=\"),round(Ef-BP-Ec-Eg,2)\n", - "print(\"NOTE=>overall energy balance sheet is attached as jpg file with this code.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.10;pg no: 394" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.10, Page:394 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\n", - "brake power(BP)=2*%pi*N*T in KW 47.12\n", - "so brake power=47.124 KW\n", - "brake specific fuel consumption(bsfc) in kg/KW hr= 0.34\n", - "indicated power(IP) in Kw= 52.36\n", - "indicated thermal efficiency(n_ite)= 0.28\n", - "in percentage 28.05\n", - "so indicated thermal efficiency=28.05%\n", - "heat available from fuel(Qf)=(m/mw)*C in KJ/min 11200.0\n", - "energy consumed as brake power(BP) in KJ/min= 2827.43\n", - "energy carried by cooling water(Qw) in KJ/min= 1442.1\n", - "energy carried by exhaust gases(Qg) in KJ/min= 4786.83\n", - "unaccounted energy loss in KJ/min 2143.63\n", - "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\n" - ] - } - ], - "source": [ - "#cal of brake power,brake specific fuel consumption,indicated thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.10, Page:394 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\")\n", - "m=4.;#mass of fuel consumed in kg\n", - "N=1500.;#engine rpm\n", - "mw=15.;#water circulation rate in kg/min\n", - "T1=27.;#cooling water inlet temperature in degree celcius\n", - "T2=50.;#cooling water outlet temperature in degree celcius\n", - "ma=150.;#mass of air consumed in kg\n", - "T_exhaust=400.;#exhaust temperature in degree celcius\n", - "T_atm=27.;#atmospheric temperature in degree celcius\n", - "Cg=1.25;#mean specific heat of exhaust gases in KJ/kg K\n", - "n_mech=0.9;#mechanical efficiency\n", - "T=300.*10**-3;#brake torque in N\n", - "C=42.*10**3;#calorific value in KJ/kg\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "BP=2.*math.pi*N*T/60\n", - "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", - "print(\"so brake power=47.124 KW\")\n", - "bsfc=m*60/(mw*BP)\n", - "print(\"brake specific fuel consumption(bsfc) in kg/KW hr=\"),round(bsfc,2)\n", - "IP=BP/n_mech\n", - "print(\"indicated power(IP) in Kw=\"),round(IP,2)\n", - "n_ite=IP*mw*60/(m*C)\n", - "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", - "print(\"in percentage\"),round(n_ite*100,2)\n", - "print(\"so indicated thermal efficiency=28.05%\")\n", - "Qf=(m/mw)*C\n", - "print(\"heat available from fuel(Qf)=(m/mw)*C in KJ/min\"),round(Qf,2)\n", - "BP=BP*60 \n", - "print(\"energy consumed as brake power(BP) in KJ/min=\"),round(BP,2)\n", - "Qw=mw*Cw*(T2-T1)\n", - "print(\"energy carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", - "Qg=(ma+m)*Cg*(T_exhaust-T_atm)/mw\n", - "print(\"energy carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", - "Qf-(BP+Qw+Qg)\n", - "print(\"unaccounted energy loss in KJ/min\"),round(Qf-(BP+Qw+Qg),2)\n", - "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.11;pg no: 395" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.11, Page:395 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\n", - "indicated power of 1st cylinder=BP-BP1 in KW\n", - "indicated power of 2nd cylinder=BP-BP2 in KW\n", - "indicated power of 3rd cylinder=BP-BP3 in KW\n", - "indicated power of 4th cylinder=BP-BP4 in KW\n", - "indicated power of 5th cylinder=BP-BP5 in KW\n", - "indicated power of 6th cylinder=BP-BP6 in KW\n", - " total indicated power(IP)in KW= 61.9\n", - "mechanical efficiency(n_mech)= 0.81\n", - "in percentage 80.78\n", - "so indicated power=61.9 KW\n", - "mechanical efficiency=80.77%\n" - ] - } - ], - "source": [ - "#cal of indicated power and mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.11, Page:395 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\")\n", - "BP=50.;#brake power output at full load in KW\n", - "BP1=40.1;#brake power output of 1st cylinder in KW\n", - "BP2=39.5;#brake power output of 2nd cylinder in KW\n", - "BP3=39.1;#brake power output of 3rd cylinder in KW\n", - "BP4=39.6;#brake power output of 4th cylinder in KW\n", - "BP5=39.8;#brake power output of 5th cylinder in KW\n", - "BP6=40.;#brake power output of 6th cylinder in KW\n", - "print(\"indicated power of 1st cylinder=BP-BP1 in KW\")\n", - "BP-BP1\n", - "print(\"indicated power of 2nd cylinder=BP-BP2 in KW\")\n", - "BP-BP2\n", - "print(\"indicated power of 3rd cylinder=BP-BP3 in KW\")\n", - "BP-BP3\n", - "print(\"indicated power of 4th cylinder=BP-BP4 in KW\")\n", - "BP-BP4\n", - "print(\"indicated power of 5th cylinder=BP-BP5 in KW\")\n", - "BP-BP5\n", - "print(\"indicated power of 6th cylinder=BP-BP6 in KW\")\n", - "BP-BP6\n", - "IP=9.9+10.5+10.9+10.4+10.2+10\n", - "print(\" total indicated power(IP)in KW=\"),round(IP,2)\n", - "n_mech=BP/IP\n", - "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "print(\"so indicated power=61.9 KW\")\n", - "print(\"mechanical efficiency=80.77%\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.12;pg no: 396" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.12, Page:396 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\n", - "brake power output of engine(BP) in KW= 19.63\n", - "brake power when cylinder 1 is cut(BP1) in KW= 13.74\n", - "so indicated power of first cylinder(IP1) in KW= 5.89\n", - "brake power when cylinder 2 is cut(BP2) in KW= 14.14\n", - "so indicated power of second cylinder(IP2) in KW= 5.5\n", - "brake power when cylinder 3 is cut(BP3) in KW= 14.29\n", - "so indicated power of third cylinder(IP3) in KW= 5.34\n", - "brake power when cylinder 4 is cut(BP4) in KW= 13.35\n", - "so indicated power of fourth cylinder(IP4) in KW= 6.28\n", - "now total indicated power(IP) in KW 23.01\n", - "engine mechanical efficiency(n_mech)= 0.85\n", - "in percentage 85.32\n", - "so BP=19.63 KW,IP=23 KW,n_mech=83.35%\n", - "heat liberated by fuel(Qf)=m*C in KJ/min 8127.0\n", - "heat carried by exhaust gases(Qg) in KJ/min= 1436.02\n", - "heat carried by cooling water(Qw) in KJ/min= 1730.52\n", - "energy to brake power(BP) in KJ/min= 1177.8\n", - "unaccounted losses in KJ/min 3782.66\n", - "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \n" - ] - } - ], - "source": [ - "#cal of brake power,indicated power,heat balance sheet\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 10.12, Page:396 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\")\n", - "N=1500.;#engine rpm at full load\n", - "F=250.;#brake load at full load in N\n", - "F1=175.;#brake reading 1 in N\n", - "F2=180.;#brake reading 2 in N\n", - "F3=182.;#brake reading 3 in N\n", - "F4=170.;#brake reading 4 in N\n", - "r=50.*10**-2;#brake drum radius in m\n", - "m=0.189;#fuel consumption rate in kg/min\n", - "C=43.*10**3;#fuel calorific value in KJ/kg\n", - "k=12.;#air to fuel ratio\n", - "T_exhaust=600.;#exhaust gas temperature in degree celcius\n", - "mw=18.;#cooling water flow rate in kg/min\n", - "T1=27.;#cooling water entering temperature in degree celcius\n", - "T2=50.;#cooling water leaving temperature in degree celcius\n", - "T_atm=27.;#atmospheric air temperature\n", - "Cg=1.02;#specific heat of exhaust gas in KJ/kg K\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "BP=2.*math.pi*N*F*r*10**-3/60.\n", - "print(\"brake power output of engine(BP) in KW=\"),round(BP,2)\n", - "BP1=2.*math.pi*N*F1*r*10**-3/60.\n", - "print(\"brake power when cylinder 1 is cut(BP1) in KW=\"),round(BP1,2)\n", - "IP1=BP-BP1\n", - "print(\"so indicated power of first cylinder(IP1) in KW=\"),round(IP1,2)\n", - "BP2=2.*math.pi*N*F2*r*10**-3/60.\n", - "print(\"brake power when cylinder 2 is cut(BP2) in KW=\"),round(BP2,2)\n", - "IP2=BP-BP2\n", - "print(\"so indicated power of second cylinder(IP2) in KW=\"),round(IP2,2)\n", - "BP3=2.*math.pi*N*F3*r*10**-3/60.\n", - "print(\"brake power when cylinder 3 is cut(BP3) in KW=\"),round(BP3,2)\n", - "IP3=BP-BP3\n", - "print(\"so indicated power of third cylinder(IP3) in KW=\"),round(IP3,2)\n", - "BP4=2.*math.pi*N*F4*r*10**-3/60.\n", - "print(\"brake power when cylinder 4 is cut(BP4) in KW=\"),round(BP4,2)\n", - "IP4=BP-BP4\n", - "print(\"so indicated power of fourth cylinder(IP4) in KW=\"),round(IP4,2)\n", - "IP=IP1+IP2+IP3+IP4\n", - "print(\"now total indicated power(IP) in KW\"),round(IP,2)\n", - "n_mech=BP/IP\n", - "print(\"engine mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "print(\"so BP=19.63 KW,IP=23 KW,n_mech=83.35%\")\n", - "Qf=m*C\n", - "print(\"heat liberated by fuel(Qf)=m*C in KJ/min\"),round(Qf,2)\n", - "Qg=(k+1)*m*Cg*(T_exhaust-T_atm)\n", - "print(\"heat carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", - "Qw=mw*Cw*(T2-T1)\n", - "print(\"heat carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", - "BP=19.63*60\n", - "print(\"energy to brake power(BP) in KJ/min=\"),round(19.63*60,2)\n", - "Qf-(Qg+Qw+BP)\n", - "print(\"unaccounted losses in KJ/min\"),round(Qf-(Qg+Qw+BP),2)\n", - "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.13;pg no: 397" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.13, Page:397 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\n", - "brake power(BP)=2*%pi*N*T in KW\n", - "indicated power(IP)=(mep*L*A*N)/60000 in KW\n", - "A> heat added(Q)=m*C/3600 in KJ/s 52.36\n", - "or Q in KJ/min\n", - "thermal efficiency(n_th)= 0.27\n", - "in percentage 26.85\n", - "B> heat equivalent of brake power(BP) in KJ/min= 659.76\n", - "C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\n", - "heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\n", - "mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\n", - "mg=(ma+m)/60\n", - "mass of steam in exhaust gases in kg/min\n", - "mass of dry exhaust gases in kg/min\n", - "D> heat carried by steam in exhaust in KJ/min 299.86\n", - "E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min 782.64\n", - "F> unaccounted loss=A-B-C-D-E in KJ/min 537.4\n", - "NOTE># on per minute basis is attached as jpg file with this code.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency and heat balance sheet\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.13, Page:397 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\")\n", - "D=20.*10**-2;#cylinder diameter in m\n", - "L=28.*10**-2;#stroke in m\n", - "m=4.22;#mass of fuel used in kg\n", - "C=44670.;#calorific value of fuel in KJ/kg\n", - "N=21000./60.;#engine rpm\n", - "mep=2.74*10**5;#mean effective pressure in pa\n", - "F=600.;#net brake load applied to a drum of 100 cm diameter in N\n", - "r=50.*10**-2;#brake drum radius in m\n", - "mw=495.;#total mass of cooling water in kg\n", - "T1=13.;#cooling water inlet temperature in degree celcius\n", - "T2=38.;#cooling water outlet temperature in degree celcius\n", - "ma=135.;#mass of air used in kg\n", - "T_air=20.;#temperature of air in test room in degree celcius\n", - "T_exhaust=370.;#temperature of exhaust gases in degree celcius\n", - "Cp_gases=1.005;#specific heat of gases in KJ/kg K\n", - "Cp_steam=2.093;#specific heat of steam at atmospheric pressure in KJ/kg K\n", - "Cpw=4.18;#specific heat of water in KJ/kg K\n", - "print(\"brake power(BP)=2*%pi*N*T in KW\")\n", - "BP=2*math.pi*N*F*r/60000\n", - "print(\"indicated power(IP)=(mep*L*A*N)/60000 in KW\")\n", - "IP=(mep*L*(math.pi*D**2/4)*N)/60000\n", - "Q=m*C/3600\n", - "print(\"A> heat added(Q)=m*C/3600 in KJ/s\"),round(Q,2)\n", - "print(\"or Q in KJ/min\")\n", - "Q=Q*60\n", - "Q=52.36;#heat added in KJ/s\n", - "n_th=IP/Q\n", - "print(\"thermal efficiency(n_th)= \"),round(n_th,2)\n", - "print(\"in percentage\"),round(n_th*100,2)\n", - "BP=BP*60\n", - "print(\"B> heat equivalent of brake power(BP) in KJ/min= \"),round(10.996*60,2)\n", - "print(\"C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\")\n", - "Qw=mw*Cpw*(T2-T1)/60\n", - "print(\"heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\")\n", - "print(\"mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\")\n", - "print(\"mg=(ma+m)/60\")\n", - "mg=(ma+m)/60\n", - "print(\"mass of steam in exhaust gases in kg/min\")\n", - "9*(0.15*m/60)\n", - "print(\"mass of dry exhaust gases in kg/min\")\n", - "mg-0.095\n", - "0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100))\n", - "print(\"D> heat carried by steam in exhaust in KJ/min\"),round(0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100)),2)\n", - "Qg=2.225*Cp_gases*(T_exhaust-T_air)\n", - "print(\"E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min\"),round(Qg,2)\n", - "print(\"F> unaccounted loss=A-B-C-D-E in KJ/min\"),round(3141.79-659.76-862.13-299.86-782.64,2)\n", - "print(\"NOTE># on per minute basis is attached as jpg file with this code.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter10_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter10_1.ipynb deleted file mode 100755 index 2d9241c2..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter10_1.ipynb +++ /dev/null @@ -1,1080 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 10:Intoduction to Internal Combustion engines" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.1;pg no: 387" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.1, Page:387 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 1\n", - "from stroke to bore ratio i.e L/D=1.2 and cylinder diameter=bore,i.e D=12 cm\n", - "stroke(L)=1.2*D in m\n", - "Area of indicator diagram(A)=30*10^-4 m^2\n", - "length of indicator diagram(l)=(1/2)*L in m\n", - "mean effective pressure(mep)=A*k/l in N/m^2\n", - "cross-section area of piston(Ap)=%pi*D^2/4 in m^2\n", - "for one cylinder indicated power(IP)=mep*Ap*L*N/(2*60) in W\n", - "for four cylinder total indicated power(IP)=4*IP in W 90477.87\n", - "frictional power loss(FP)=0.10*IP in W\n", - "brake power available(BP)=indicated power-frictional power=IP-FP in W 81430.08\n", - "therefore,mechanical efficiency of engine(n)=brake power/indicated power=BP/IP= 0.9\n", - "in percentage 90.0\n", - "so indicated power=90477.8 W\n", - "and mechanical efficiency=90%\n" - ] - } - ], - "source": [ - "#cal of indicated power,,mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 10.1, Page:387 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 1\")\n", - "k=20.*10**6;#spring constant in N/m^2\n", - "N=2000.;#engine rpm\n", - "print(\"from stroke to bore ratio i.e L/D=1.2 and cylinder diameter=bore,i.e D=12 cm\")\n", - "D=12.*10**-2;#cylinder diameter in m\n", - "print(\"stroke(L)=1.2*D in m\")\n", - "L=1.2*D\n", - "print(\"Area of indicator diagram(A)=30*10^-4 m^2\")\n", - "A=30.*10**-4;\n", - "print(\"length of indicator diagram(l)=(1/2)*L in m\")\n", - "l=(1./2.)*L\n", - "print(\"mean effective pressure(mep)=A*k/l in N/m^2\")\n", - "mep=A*k/l\n", - "print(\"cross-section area of piston(Ap)=%pi*D^2/4 in m^2\")\n", - "Ap=math.pi*D**2./4.\n", - "print(\"for one cylinder indicated power(IP)=mep*Ap*L*N/(2*60) in W\")\n", - "IP=mep*Ap*L*N/(2.*60.)\n", - "IP=4.*IP\n", - "print(\"for four cylinder total indicated power(IP)=4*IP in W\"),round(IP,2)\n", - "print(\"frictional power loss(FP)=0.10*IP in W\")\n", - "FP=0.10*IP\n", - "BP=IP-FP\n", - "print(\"brake power available(BP)=indicated power-frictional power=IP-FP in W\"),round(BP,2)\n", - "n=BP/IP\n", - "print(\"therefore,mechanical efficiency of engine(n)=brake power/indicated power=BP/IP=\"),round(BP/IP,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so indicated power=90477.8 W\")\n", - "print(\"and mechanical efficiency=90%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.2;pg no: 388" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.2, Page:388 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 2\n", - "reciprocating pump is work absorbing machine having its mechanism similar to the piston-cylinder arrangement in IC engine.\n", - "mean effective pressure(mep)=A*k/l in pa\n", - "indicator power(IP)=Ap*L*mep*N*1*2/60 in W\n", - "(it is double acting so let us assume total power to be double of that in single acting) 88357.29\n", - "so power required to drive=88.36 KW\n" - ] - } - ], - "source": [ - "#cal of power required to drive\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.2, Page:388 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 2\")\n", - "A=40*10**-4;#area of indicator diagram in m^2\n", - "l=8*10**-2;#length of indicator diagram in m\n", - "D=15*10**-2;#bore of cylinder in m\n", - "L=20*10**-2;#stroke in m\n", - "k=1.5*10**8;#spring constant in pa/m\n", - "N=100;#pump motor rpm\n", - "print(\"reciprocating pump is work absorbing machine having its mechanism similar to the piston-cylinder arrangement in IC engine.\")\n", - "print(\"mean effective pressure(mep)=A*k/l in pa\")\n", - "mep=A*k/l \n", - "print(\"indicator power(IP)=Ap*L*mep*N*1*2/60 in W\")\n", - "Ap=math.pi*D**2/4\n", - "IP=Ap*L*mep*N*2/60\n", - "print(\"(it is double acting so let us assume total power to be double of that in single acting)\"),round(IP,2)\n", - "print(\"so power required to drive=88.36 KW\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.3;pg no: 388" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.3, Page:388 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 3\n", - "indicated power(IP)=brake power/mechanical efficiency in KW= 42.22\n", - "frictional power loss(FP)=IP-BP in KW 4.22\n", - "brake power at quater load(BPq)=0.25*BP in KW\n", - "mechanical efficiency(n1)=BPq/IP 0.69\n", - "in percentage 69.23\n", - "so indicated power=42.22 KW\n", - "frictional power loss=4.22 KW\n", - "mechanical efficiency=69.24%\n" - ] - } - ], - "source": [ - "#cal of indicated power,frictional power loss,mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "print\"Example 10.3, Page:388 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 3\")\n", - "n=0.9;#mechanical efficiency of engine\n", - "BP=38;#brake power in KW\n", - "IP=BP/n\n", - "print(\"indicated power(IP)=brake power/mechanical efficiency in KW=\"),round(IP,2)\n", - "FP=IP-BP\n", - "print(\"frictional power loss(FP)=IP-BP in KW\"),round(FP,2)\n", - "print(\"brake power at quater load(BPq)=0.25*BP in KW\")\n", - "BPq=0.25*BP\n", - "IP=BPq+FP;\n", - "n1=BPq/IP\n", - "print(\"mechanical efficiency(n1)=BPq/IP\"),round(n1,2)\n", - "print(\"in percentage\"),round(n1*100,2)\n", - "print(\"so indicated power=42.22 KW\")\n", - "print(\"frictional power loss=4.22 KW\")\n", - "print(\"mechanical efficiency=69.24%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.4;pg no: 389" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.4, Page:389 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\n", - "brake power of engine(BP) in MW= 3120.98\n", - "so brake power is 3.121 MW\n", - "The fuel consumption in kg/hr(m)=m*BP in kg/hr\n", - "In order to find out brake thermal efficiency the heat input from fuel per second is required.\n", - "heat from fuel(Q)in KJ/s\n", - "Q=m*C/3600\n", - "energy to brake power=3120.97 KW\n", - "brake thermal efficiency(n)= 0.33\n", - "in percentage 33.49\n", - "so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\n", - "NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\n" - ] - } - ], - "source": [ - "#cal of brake power,fuel consumption\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.4, Page:389 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\")\n", - "m=0.25;#specific fuel consumption in kg/KWh\n", - "Pb_mep=1.5*1000;#brake mean effective pressure of each cylinder in Kpa\n", - "N=100;#engine rpm\n", - "D=85*10**-2;#bore of cylinder in m\n", - "L=220*10**-2;#stroke in m\n", - "C=43*10**3;#calorific value of diesel in KJ/kg\n", - "A=math.pi*D**2/4;\n", - "BP=Pb_mep*L*A*N/60\n", - "print(\"brake power of engine(BP) in MW=\"),round(BP,2)\n", - "print(\"so brake power is 3.121 MW\")\n", - "print(\"The fuel consumption in kg/hr(m)=m*BP in kg/hr\")\n", - "m=m*BP\n", - "print(\"In order to find out brake thermal efficiency the heat input from fuel per second is required.\")\n", - "print(\"heat from fuel(Q)in KJ/s\")\n", - "print(\"Q=m*C/3600\")\n", - "Q=m*C/3600\n", - "print(\"energy to brake power=3120.97 KW\")\n", - "n=BP/Q\n", - "print(\"brake thermal efficiency(n)=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\")\n", - "print(\"NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.5;pg no: 389" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.5, Page:389 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\n", - "brake thermal efficiency(n)=3600/(m*C) 0.33\n", - "in percentage 33.49\n", - "brake power(BP)in KW\n", - "BP= 226.19\n", - "brake specific fuel consumption,m=mf/BP\n", - "so mf=m*BP in kg/hr\n", - "air consumption(ma)from given air fuel ratio=k*mf in kg/hr\n", - "ma in kg/min\n", - "using perfect gas equation,\n", - "P*Va=ma*R*T\n", - "sa Va=ma*R*T/P in m^3/min\n", - "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", - "volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder) 1.87\n", - "in percentage 186.55\n", - "NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\n" - ] - } - ], - "source": [ - "#cal of brake thermal efficiency,brake power,volumetric efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.5, Page:389 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\")\n", - "Pb_mep=6*10**5;#brake mean effective pressure in pa\n", - "N=600;#engine rpm\n", - "m=0.25;#specific fuel consumption in kg/KWh\n", - "D=20*10**-2;#bore of cylinder in m\n", - "L=30*10**-2;#stroke in m\n", - "k=26;#air to fuel ratio\n", - "C=43*10**3;#calorific value in KJ/kg\n", - "R=0.287;#gas constant in KJ/kg K\n", - "T=(27+273);#ambient temperature in K\n", - "P=1*10**2;#ambient pressure in Kpa\n", - "n=3600/(m*C)\n", - "print(\"brake thermal efficiency(n)=3600/(m*C)\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"brake power(BP)in KW\")\n", - "A=math.pi*D**2/4;\n", - "BP=4*Pb_mep*L*A*N/60000\n", - "print(\"BP=\"),round(BP,2)\n", - "print(\"brake specific fuel consumption,m=mf/BP\")\n", - "print(\"so mf=m*BP in kg/hr\")\n", - "mf=m*BP\n", - "print(\"air consumption(ma)from given air fuel ratio=k*mf in kg/hr\")\n", - "ma=k*mf\n", - "print(\"ma in kg/min\")\n", - "ma=ma/60\n", - "print(\"using perfect gas equation,\")\n", - "print(\"P*Va=ma*R*T\")\n", - "print(\"sa Va=ma*R*T/P in m^3/min\")\n", - "Va=ma*R*T/P\n", - "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", - "Vs=math.pi*D**2*L/4\n", - "n_vol=Va/(Vs*(N/2)*4)\n", - "print(\"volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder)\"),round(n_vol,2)\n", - "print(\"in percentage\"),round(n_vol*100,2)\n", - "print(\"NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.6;pg no: 390" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.6, Page:390 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\n", - "let the bore diameter be (D) m\n", - "piston speed(V)=2*L*N\n", - "so L=V/(2*N) in m\n", - "volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\n", - "so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\n", - "so air sucked =274.78*D^2 m^3/min\n", - "air requirement(ma),kg/min=A/F ratio*fuel consumption per min\n", - "so ma=r*m in kg/min\n", - "using perfect gas equation,P*Va=ma*R*T\n", - "so Va=ma*R*T/P in m^3/min\n", - "ideally,air sucked=Va\n", - "so 274.78*D^2=0.906\n", - "D=sqrt(0.906/274.78) in m\n", - "indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\n", - "brake power=indicated power*mechanical efficiency\n", - "BP=IP*n_mech in KW 10.35\n", - "so brake power=10.34 KW\n" - ] - } - ], - "source": [ - "#cal of brake power\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 10.6, Page:390 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\")\n", - "N=3000;#engine rpm\n", - "m=5;#fuel consumption in litre/hr\n", - "r=19;#air-fuel ratio\n", - "sg=0.7;#specific gravity of fuel\n", - "V=500;#piston speed in m/min\n", - "P_imep=6*10**5;#indicated mean effective pressure in pa\n", - "P=1.013*10**5;#ambient pressure in pa\n", - "T=(15+273);#ambient temperature in K\n", - "n_vol=0.7;#volumetric efficiency \n", - "n_mech=0.8;#mechanical efficiency\n", - "R=0.287;#gas constant for gas in KJ/kg K\n", - "print(\"let the bore diameter be (D) m\")\n", - "print(\"piston speed(V)=2*L*N\")\n", - "print(\"so L=V/(2*N) in m\")\n", - "L=V/(2*N)\n", - "L=0.0833;#approx.\n", - "print(\"volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\")\n", - "print(\"so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\")\n", - "n_vol*(math.pi*L/4)*N*2\n", - "print(\"so air sucked =274.78*D^2 m^3/min\")\n", - "print(\"air requirement(ma),kg/min=A/F ratio*fuel consumption per min\")\n", - "print(\"so ma=r*m in kg/min\")\n", - "ma=r*m*sg/60\n", - "print(\"using perfect gas equation,P*Va=ma*R*T\")\n", - "print(\"so Va=ma*R*T/P in m^3/min\")\n", - "Va=ma*R*T*1000/P \n", - "print(\"ideally,air sucked=Va\")\n", - "print(\"so 274.78*D^2=0.906\")\n", - "print(\"D=sqrt(0.906/274.78) in m\")\n", - "D=math.sqrt(0.906/274.78) \n", - "print(\"indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\")\n", - "IP=P_imep*L*(math.pi*D**2/4)*(N/60)*2/1000\n", - "print(\"brake power=indicated power*mechanical efficiency\")\n", - "BP=IP*n_mech \n", - "print(\"BP=IP*n_mech in KW\"),round(BP,2)\n", - "print(\"so brake power=10.34 KW\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.7;pg no: 391" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.7, Page:391 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\n", - "After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\n", - "friction power(FP)=5 KW\n", - "brake power(BP) in KW= 30.82\n", - "indicated power(IP) in KW= 35.82\n", - "mechanical efficiency(n_mech)= 0.86\n", - "in percentage 86.04\n", - "brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr= 0.29\n", - "brake thermal efficiency(n_bte)= 0.29\n", - "in percentage 28.67\n", - "also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\n", - "indicated thermal efficiency(n_ite)= 0.33\n", - "in percentage 33.32\n", - "indicated power(IP)=P_imep*L*A*N\n", - "so P_imep in Kpa= 76.01\n", - "Also,mechanical efficiency=P_bmep/P_imep\n", - "so P_bmep in Kpa= 65.4\n", - "brake power=30.82 KW\n", - "indicated power=35.82 KW\n", - "mechanical efficiency=86.04%\n", - "brake thermal efficiency=28.67%\n", - "indicated thermal efficiency=33.32%\n", - "brake mean effective pressure=65.39 Kpa\n", - "indicated mean effective pressure=76.01 Kpa\n" - ] - } - ], - "source": [ - "#cal of power and efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.7, Page:391 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\")\n", - "M=20;#load on dynamometer in kg\n", - "r=50*10**-2;#radius in m\n", - "N=3000;#speed of rotation in rpm\n", - "D=20*10**-2;#bore in m\n", - "L=30*10**-2;#stroke in m\n", - "m=0.15;#fuel supplying rate in kg/min\n", - "C=43;#calorific value of fuel in MJ/kg\n", - "FP=5;#friction power in KW\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\")\n", - "print(\"friction power(FP)=5 KW\")\n", - "BP=2*math.pi*N*(M*g*r)*10**-3/60\n", - "print(\"brake power(BP) in KW=\"),round(BP,2)\n", - "IP=BP+FP\n", - "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", - "n_mech=BP/IP\n", - "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "bsfc=m*60/BP\n", - "print(\"brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr=\"),round(bsfc,2)\n", - "n_bte=3600/(bsfc*C*1000)\n", - "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", - "print(\"in percentage\"),round(n_bte*100,2)\n", - "print(\"also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\")\n", - "n_ite=n_bte/n_mech\n", - "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", - "print(\"in percentage\"),round(n_ite*100,2)\n", - "print(\"indicated power(IP)=P_imep*L*A*N\")\n", - "P_imep=IP/(L*(math.pi*D**2/4)*N/60)\n", - "print(\"so P_imep in Kpa=\"),round(P_imep,2)\n", - "print(\"Also,mechanical efficiency=P_bmep/P_imep\")\n", - "n_mech=0.8604;#mechanical efficiency\n", - "P_bmep=P_imep*n_mech\n", - "print(\"so P_bmep in Kpa=\"),round(P_bmep,2)\n", - "print(\"brake power=30.82 KW\")\n", - "print(\"indicated power=35.82 KW\")\n", - "print(\"mechanical efficiency=86.04%\")\n", - "print(\"brake thermal efficiency=28.67%\")\n", - "print(\"indicated thermal efficiency=33.32%\")\n", - "print(\"brake mean effective pressure=65.39 Kpa\")\n", - "print(\"indicated mean effective pressure=76.01 Kpa\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.8;pg no: 392" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.8, Page:392 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\n", - "indicated power(IP) in KW= 282.74\n", - "mechanical efficiency(n_mech)=brake power/indicated power\n", - "so n_mech= 0.88\n", - "in percentage 88.42\n", - "brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\n", - "brake thermal efficiency(n_bte)= 0.35\n", - "in percentage 34.88\n", - "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", - "mass of air corresponding to above swept volume,using perfect gas equation\n", - "P*Vs=ma*R*T\n", - "so ma=(P*Vs)/(R*T) in kg\n", - "volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\n", - "so mass of air taken per minute in kg/min \n", - "mass corresponding to swept volume per minute in kg/min\n", - "so volumetric efficiency 0.8333\n", - "in percentage 83.3333\n", - "so indicated power =282.74 KW,mechanical efficiency=88.42%\n", - "brake thermal efficiency=34.88%,volumetric efficiency=83.33%\n" - ] - } - ], - "source": [ - "#cal of brake thermal efficiency,volumetric effeciency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.8, Page:392 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\")\n", - "N=300.;#engine rpm\n", - "BP=250.;#brake power in KW\n", - "D=30.*10**-2;#bore in m\n", - "L=25.*10**-2;#stroke in m\n", - "m=1.;#fuel consumption in kg/min\n", - "r=10.;#airfuel ratio \n", - "P_imep=0.8;#indicated mean effective pressure in pa\n", - "C=43.*10**3;#calorific value of fuel in KJ/kg\n", - "P=1.013*10**5;#ambient pressure in K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "T=(27.+273.);#ambient temperature in K\n", - "IP=P_imep*L*(math.pi*D**2/4)*N*4*10**3/60\n", - "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", - "print(\"mechanical efficiency(n_mech)=brake power/indicated power\")\n", - "n_mech=BP/IP\n", - "print(\"so n_mech=\"),round(n_mech,2)\n", - "print(\"in percentage \"),round(n_mech*100,2)\n", - "print(\"brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\")\n", - "bsfc=m*60./BP\n", - "n_bte=3600./(bsfc*C)\n", - "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", - "print(\"in percentage\"),round(n_bte*100,2)\n", - "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", - "Vs=math.pi*D**2*L/4\n", - "print(\"mass of air corresponding to above swept volume,using perfect gas equation\")\n", - "print(\"P*Vs=ma*R*T\")\n", - "print(\"so ma=(P*Vs)/(R*T) in kg\")\n", - "ma=(P*Vs)/(R*T*1000) \n", - "ma=0.02;#approx.\n", - "print(\"volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\")\n", - "print(\"so mass of air taken per minute in kg/min \")\n", - "1*10\n", - "print(\"mass corresponding to swept volume per minute in kg/min\")\n", - "ma*4*N/2\n", - "print(\"so volumetric efficiency \"),round(10./12.,4)\n", - "print(\"in percentage\"),round((10./12.)*100.,4)\n", - "print(\"so indicated power =282.74 KW,mechanical efficiency=88.42%\")\n", - "print(\"brake thermal efficiency=34.88%,volumetric efficiency=83.33%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.9;pg no: 393" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.9, Page:393 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\n", - "indicated mean effective pressure(P_imeb)=h*k in Kpa\n", - "indicated power(IP)=P_imeb*L*A*N/2 in KW 9.375\n", - "brake power(BP)=2*%pi*N*T in KW 4.62\n", - "mechanical efficiency(n_mech)= 0.49\n", - "in percentage 49.31\n", - "so indicated power=9.375 KW\n", - "brake power=4.62 KW\n", - "mechanical efficiency=49.28%\n", - "energy liberated from fuel(Ef)=C*m/60 in KJ/s\n", - "energy available as brake power(BP)=4.62 KW\n", - "energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\n", - "energy carried by exhaust gases(Eg)=30 KJ/s\n", - "unaccounted energy loss in KW= 34.75\n", - "NOTE=>overall energy balance sheet is attached as jpg file with this code.\n" - ] - } - ], - "source": [ - "#cal of indicated power,brake power,mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.9, Page:393 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\")\n", - "h=10.;#height of indicator diagram in mm\n", - "k=25.;#indicator constant in KN/m^2 per mm\n", - "N=300.;#engine rpm\n", - "Vs=1.5*10**-2;#swept volume in m^3\n", - "M=60.;#effective brake load upon dynamometer in kg\n", - "r=50.*10**-2;#effective brake drum radius in m\n", - "m=0.12;#fuel consumption in kg/min\n", - "C=42.*10**3;#calorific value in KJ/kg\n", - "mw=6.;#circulating water rate in kg/min\n", - "T1=35.;#cooling water entering temperature in degree celcius\n", - "T2=70.;#cooling water leaving temperature in degree celcius\n", - "Eg=30.;#exhaust gases leaving energy in KJ/s\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "g=9.81;#accelaration due to gravity in m/s^2\n", - "print(\"indicated mean effective pressure(P_imeb)=h*k in Kpa\")\n", - "P_imeb=h*k\n", - "IP=P_imeb*Vs*N/(2*60)\n", - "print(\"indicated power(IP)=P_imeb*L*A*N/2 in KW\") ,round(IP,3)\n", - "BP=2*math.pi*N*(M*g*r*10**-3)/(2*60)\n", - "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", - "n_mech=BP/IP\n", - "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "print(\"so indicated power=9.375 KW\")\n", - "print(\"brake power=4.62 KW\")\n", - "print(\"mechanical efficiency=49.28%\")\n", - "print(\"energy liberated from fuel(Ef)=C*m/60 in KJ/s\")\n", - "Ef=C*m/60\n", - "print(\"energy available as brake power(BP)=4.62 KW\")\n", - "print(\"energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\")\n", - "Ec=(mw/M)*Cw*(T2-T1)\n", - "print(\"energy carried by exhaust gases(Eg)=30 KJ/s\")\n", - "Ef-BP-Ec-Eg\n", - "print(\"unaccounted energy loss in KW=\"),round(Ef-BP-Ec-Eg,2)\n", - "print(\"NOTE=>overall energy balance sheet is attached as jpg file with this code.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.10;pg no: 394" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.10, Page:394 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\n", - "brake power(BP)=2*%pi*N*T in KW 47.12\n", - "so brake power=47.124 KW\n", - "brake specific fuel consumption(bsfc) in kg/KW hr= 0.34\n", - "indicated power(IP) in Kw= 52.36\n", - "indicated thermal efficiency(n_ite)= 0.28\n", - "in percentage 28.05\n", - "so indicated thermal efficiency=28.05%\n", - "heat available from fuel(Qf)=(m/mw)*C in KJ/min 11200.0\n", - "energy consumed as brake power(BP) in KJ/min= 2827.43\n", - "energy carried by cooling water(Qw) in KJ/min= 1442.1\n", - "energy carried by exhaust gases(Qg) in KJ/min= 4786.83\n", - "unaccounted energy loss in KJ/min 2143.63\n", - "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\n" - ] - } - ], - "source": [ - "#cal of brake power,brake specific fuel consumption,indicated thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.10, Page:394 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\")\n", - "m=4.;#mass of fuel consumed in kg\n", - "N=1500.;#engine rpm\n", - "mw=15.;#water circulation rate in kg/min\n", - "T1=27.;#cooling water inlet temperature in degree celcius\n", - "T2=50.;#cooling water outlet temperature in degree celcius\n", - "ma=150.;#mass of air consumed in kg\n", - "T_exhaust=400.;#exhaust temperature in degree celcius\n", - "T_atm=27.;#atmospheric temperature in degree celcius\n", - "Cg=1.25;#mean specific heat of exhaust gases in KJ/kg K\n", - "n_mech=0.9;#mechanical efficiency\n", - "T=300.*10**-3;#brake torque in N\n", - "C=42.*10**3;#calorific value in KJ/kg\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "BP=2.*math.pi*N*T/60\n", - "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", - "print(\"so brake power=47.124 KW\")\n", - "bsfc=m*60/(mw*BP)\n", - "print(\"brake specific fuel consumption(bsfc) in kg/KW hr=\"),round(bsfc,2)\n", - "IP=BP/n_mech\n", - "print(\"indicated power(IP) in Kw=\"),round(IP,2)\n", - "n_ite=IP*mw*60/(m*C)\n", - "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", - "print(\"in percentage\"),round(n_ite*100,2)\n", - "print(\"so indicated thermal efficiency=28.05%\")\n", - "Qf=(m/mw)*C\n", - "print(\"heat available from fuel(Qf)=(m/mw)*C in KJ/min\"),round(Qf,2)\n", - "BP=BP*60 \n", - "print(\"energy consumed as brake power(BP) in KJ/min=\"),round(BP,2)\n", - "Qw=mw*Cw*(T2-T1)\n", - "print(\"energy carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", - "Qg=(ma+m)*Cg*(T_exhaust-T_atm)/mw\n", - "print(\"energy carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", - "Qf-(BP+Qw+Qg)\n", - "print(\"unaccounted energy loss in KJ/min\"),round(Qf-(BP+Qw+Qg),2)\n", - "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.11;pg no: 395" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.11, Page:395 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\n", - "indicated power of 1st cylinder=BP-BP1 in KW\n", - "indicated power of 2nd cylinder=BP-BP2 in KW\n", - "indicated power of 3rd cylinder=BP-BP3 in KW\n", - "indicated power of 4th cylinder=BP-BP4 in KW\n", - "indicated power of 5th cylinder=BP-BP5 in KW\n", - "indicated power of 6th cylinder=BP-BP6 in KW\n", - " total indicated power(IP)in KW= 61.9\n", - "mechanical efficiency(n_mech)= 0.81\n", - "in percentage 80.78\n", - "so indicated power=61.9 KW\n", - "mechanical efficiency=80.77%\n" - ] - } - ], - "source": [ - "#cal of indicated power and mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.11, Page:395 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\")\n", - "BP=50.;#brake power output at full load in KW\n", - "BP1=40.1;#brake power output of 1st cylinder in KW\n", - "BP2=39.5;#brake power output of 2nd cylinder in KW\n", - "BP3=39.1;#brake power output of 3rd cylinder in KW\n", - "BP4=39.6;#brake power output of 4th cylinder in KW\n", - "BP5=39.8;#brake power output of 5th cylinder in KW\n", - "BP6=40.;#brake power output of 6th cylinder in KW\n", - "print(\"indicated power of 1st cylinder=BP-BP1 in KW\")\n", - "BP-BP1\n", - "print(\"indicated power of 2nd cylinder=BP-BP2 in KW\")\n", - "BP-BP2\n", - "print(\"indicated power of 3rd cylinder=BP-BP3 in KW\")\n", - "BP-BP3\n", - "print(\"indicated power of 4th cylinder=BP-BP4 in KW\")\n", - "BP-BP4\n", - "print(\"indicated power of 5th cylinder=BP-BP5 in KW\")\n", - "BP-BP5\n", - "print(\"indicated power of 6th cylinder=BP-BP6 in KW\")\n", - "BP-BP6\n", - "IP=9.9+10.5+10.9+10.4+10.2+10\n", - "print(\" total indicated power(IP)in KW=\"),round(IP,2)\n", - "n_mech=BP/IP\n", - "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "print(\"so indicated power=61.9 KW\")\n", - "print(\"mechanical efficiency=80.77%\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.12;pg no: 396" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.12, Page:396 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\n", - "brake power output of engine(BP) in KW= 19.63\n", - "brake power when cylinder 1 is cut(BP1) in KW= 13.74\n", - "so indicated power of first cylinder(IP1) in KW= 5.89\n", - "brake power when cylinder 2 is cut(BP2) in KW= 14.14\n", - "so indicated power of second cylinder(IP2) in KW= 5.5\n", - "brake power when cylinder 3 is cut(BP3) in KW= 14.29\n", - "so indicated power of third cylinder(IP3) in KW= 5.34\n", - "brake power when cylinder 4 is cut(BP4) in KW= 13.35\n", - "so indicated power of fourth cylinder(IP4) in KW= 6.28\n", - "now total indicated power(IP) in KW 23.01\n", - "engine mechanical efficiency(n_mech)= 0.85\n", - "in percentage 85.32\n", - "so BP=19.63 KW,IP=23 KW,n_mech=83.35%\n", - "heat liberated by fuel(Qf)=m*C in KJ/min 8127.0\n", - "heat carried by exhaust gases(Qg) in KJ/min= 1436.02\n", - "heat carried by cooling water(Qw) in KJ/min= 1730.52\n", - "energy to brake power(BP) in KJ/min= 1177.8\n", - "unaccounted losses in KJ/min 3782.66\n", - "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \n" - ] - } - ], - "source": [ - "#cal of brake power,indicated power,heat balance sheet\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 10.12, Page:396 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\")\n", - "N=1500.;#engine rpm at full load\n", - "F=250.;#brake load at full load in N\n", - "F1=175.;#brake reading 1 in N\n", - "F2=180.;#brake reading 2 in N\n", - "F3=182.;#brake reading 3 in N\n", - "F4=170.;#brake reading 4 in N\n", - "r=50.*10**-2;#brake drum radius in m\n", - "m=0.189;#fuel consumption rate in kg/min\n", - "C=43.*10**3;#fuel calorific value in KJ/kg\n", - "k=12.;#air to fuel ratio\n", - "T_exhaust=600.;#exhaust gas temperature in degree celcius\n", - "mw=18.;#cooling water flow rate in kg/min\n", - "T1=27.;#cooling water entering temperature in degree celcius\n", - "T2=50.;#cooling water leaving temperature in degree celcius\n", - "T_atm=27.;#atmospheric air temperature\n", - "Cg=1.02;#specific heat of exhaust gas in KJ/kg K\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "BP=2.*math.pi*N*F*r*10**-3/60.\n", - "print(\"brake power output of engine(BP) in KW=\"),round(BP,2)\n", - "BP1=2.*math.pi*N*F1*r*10**-3/60.\n", - "print(\"brake power when cylinder 1 is cut(BP1) in KW=\"),round(BP1,2)\n", - "IP1=BP-BP1\n", - "print(\"so indicated power of first cylinder(IP1) in KW=\"),round(IP1,2)\n", - "BP2=2.*math.pi*N*F2*r*10**-3/60.\n", - "print(\"brake power when cylinder 2 is cut(BP2) in KW=\"),round(BP2,2)\n", - "IP2=BP-BP2\n", - "print(\"so indicated power of second cylinder(IP2) in KW=\"),round(IP2,2)\n", - "BP3=2.*math.pi*N*F3*r*10**-3/60.\n", - "print(\"brake power when cylinder 3 is cut(BP3) in KW=\"),round(BP3,2)\n", - "IP3=BP-BP3\n", - "print(\"so indicated power of third cylinder(IP3) in KW=\"),round(IP3,2)\n", - "BP4=2.*math.pi*N*F4*r*10**-3/60.\n", - "print(\"brake power when cylinder 4 is cut(BP4) in KW=\"),round(BP4,2)\n", - "IP4=BP-BP4\n", - "print(\"so indicated power of fourth cylinder(IP4) in KW=\"),round(IP4,2)\n", - "IP=IP1+IP2+IP3+IP4\n", - "print(\"now total indicated power(IP) in KW\"),round(IP,2)\n", - "n_mech=BP/IP\n", - "print(\"engine mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "print(\"so BP=19.63 KW,IP=23 KW,n_mech=83.35%\")\n", - "Qf=m*C\n", - "print(\"heat liberated by fuel(Qf)=m*C in KJ/min\"),round(Qf,2)\n", - "Qg=(k+1)*m*Cg*(T_exhaust-T_atm)\n", - "print(\"heat carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", - "Qw=mw*Cw*(T2-T1)\n", - "print(\"heat carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", - "BP=19.63*60\n", - "print(\"energy to brake power(BP) in KJ/min=\"),round(19.63*60,2)\n", - "Qf-(Qg+Qw+BP)\n", - "print(\"unaccounted losses in KJ/min\"),round(Qf-(Qg+Qw+BP),2)\n", - "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.13;pg no: 397" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.13, Page:397 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\n", - "brake power(BP)=2*%pi*N*T in KW\n", - "indicated power(IP)=(mep*L*A*N)/60000 in KW\n", - "A> heat added(Q)=m*C/3600 in KJ/s 52.36\n", - "or Q in KJ/min\n", - "thermal efficiency(n_th)= 0.27\n", - "in percentage 26.85\n", - "B> heat equivalent of brake power(BP) in KJ/min= 659.76\n", - "C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\n", - "heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\n", - "mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\n", - "mg=(ma+m)/60\n", - "mass of steam in exhaust gases in kg/min\n", - "mass of dry exhaust gases in kg/min\n", - "D> heat carried by steam in exhaust in KJ/min 299.86\n", - "E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min 782.64\n", - "F> unaccounted loss=A-B-C-D-E in KJ/min 537.4\n", - "NOTE># on per minute basis is attached as jpg file with this code.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency and heat balance sheet\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.13, Page:397 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\")\n", - "D=20.*10**-2;#cylinder diameter in m\n", - "L=28.*10**-2;#stroke in m\n", - "m=4.22;#mass of fuel used in kg\n", - "C=44670.;#calorific value of fuel in KJ/kg\n", - "N=21000./60.;#engine rpm\n", - "mep=2.74*10**5;#mean effective pressure in pa\n", - "F=600.;#net brake load applied to a drum of 100 cm diameter in N\n", - "r=50.*10**-2;#brake drum radius in m\n", - "mw=495.;#total mass of cooling water in kg\n", - "T1=13.;#cooling water inlet temperature in degree celcius\n", - "T2=38.;#cooling water outlet temperature in degree celcius\n", - "ma=135.;#mass of air used in kg\n", - "T_air=20.;#temperature of air in test room in degree celcius\n", - "T_exhaust=370.;#temperature of exhaust gases in degree celcius\n", - "Cp_gases=1.005;#specific heat of gases in KJ/kg K\n", - "Cp_steam=2.093;#specific heat of steam at atmospheric pressure in KJ/kg K\n", - "Cpw=4.18;#specific heat of water in KJ/kg K\n", - "print(\"brake power(BP)=2*%pi*N*T in KW\")\n", - "BP=2*math.pi*N*F*r/60000\n", - "print(\"indicated power(IP)=(mep*L*A*N)/60000 in KW\")\n", - "IP=(mep*L*(math.pi*D**2/4)*N)/60000\n", - "Q=m*C/3600\n", - "print(\"A> heat added(Q)=m*C/3600 in KJ/s\"),round(Q,2)\n", - "print(\"or Q in KJ/min\")\n", - "Q=Q*60\n", - "Q=52.36;#heat added in KJ/s\n", - "n_th=IP/Q\n", - "print(\"thermal efficiency(n_th)= \"),round(n_th,2)\n", - "print(\"in percentage\"),round(n_th*100,2)\n", - "BP=BP*60\n", - "print(\"B> heat equivalent of brake power(BP) in KJ/min= \"),round(10.996*60,2)\n", - "print(\"C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\")\n", - "Qw=mw*Cpw*(T2-T1)/60\n", - "print(\"heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\")\n", - "print(\"mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\")\n", - "print(\"mg=(ma+m)/60\")\n", - "mg=(ma+m)/60\n", - "print(\"mass of steam in exhaust gases in kg/min\")\n", - "9*(0.15*m/60)\n", - "print(\"mass of dry exhaust gases in kg/min\")\n", - "mg-0.095\n", - "0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100))\n", - "print(\"D> heat carried by steam in exhaust in KJ/min\"),round(0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100)),2)\n", - "Qg=2.225*Cp_gases*(T_exhaust-T_air)\n", - "print(\"E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min\"),round(Qg,2)\n", - "print(\"F> unaccounted loss=A-B-C-D-E in KJ/min\"),round(3141.79-659.76-862.13-299.86-782.64,2)\n", - "print(\"NOTE># on per minute basis is attached as jpg file with this code.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter10_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter10_2.ipynb deleted file mode 100755 index 2d9241c2..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter10_2.ipynb +++ /dev/null @@ -1,1080 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 10:Intoduction to Internal Combustion engines" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.1;pg no: 387" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.1, Page:387 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 1\n", - "from stroke to bore ratio i.e L/D=1.2 and cylinder diameter=bore,i.e D=12 cm\n", - "stroke(L)=1.2*D in m\n", - "Area of indicator diagram(A)=30*10^-4 m^2\n", - "length of indicator diagram(l)=(1/2)*L in m\n", - "mean effective pressure(mep)=A*k/l in N/m^2\n", - "cross-section area of piston(Ap)=%pi*D^2/4 in m^2\n", - "for one cylinder indicated power(IP)=mep*Ap*L*N/(2*60) in W\n", - "for four cylinder total indicated power(IP)=4*IP in W 90477.87\n", - "frictional power loss(FP)=0.10*IP in W\n", - "brake power available(BP)=indicated power-frictional power=IP-FP in W 81430.08\n", - "therefore,mechanical efficiency of engine(n)=brake power/indicated power=BP/IP= 0.9\n", - "in percentage 90.0\n", - "so indicated power=90477.8 W\n", - "and mechanical efficiency=90%\n" - ] - } - ], - "source": [ - "#cal of indicated power,,mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 10.1, Page:387 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 1\")\n", - "k=20.*10**6;#spring constant in N/m^2\n", - "N=2000.;#engine rpm\n", - "print(\"from stroke to bore ratio i.e L/D=1.2 and cylinder diameter=bore,i.e D=12 cm\")\n", - "D=12.*10**-2;#cylinder diameter in m\n", - "print(\"stroke(L)=1.2*D in m\")\n", - "L=1.2*D\n", - "print(\"Area of indicator diagram(A)=30*10^-4 m^2\")\n", - "A=30.*10**-4;\n", - "print(\"length of indicator diagram(l)=(1/2)*L in m\")\n", - "l=(1./2.)*L\n", - "print(\"mean effective pressure(mep)=A*k/l in N/m^2\")\n", - "mep=A*k/l\n", - "print(\"cross-section area of piston(Ap)=%pi*D^2/4 in m^2\")\n", - "Ap=math.pi*D**2./4.\n", - "print(\"for one cylinder indicated power(IP)=mep*Ap*L*N/(2*60) in W\")\n", - "IP=mep*Ap*L*N/(2.*60.)\n", - "IP=4.*IP\n", - "print(\"for four cylinder total indicated power(IP)=4*IP in W\"),round(IP,2)\n", - "print(\"frictional power loss(FP)=0.10*IP in W\")\n", - "FP=0.10*IP\n", - "BP=IP-FP\n", - "print(\"brake power available(BP)=indicated power-frictional power=IP-FP in W\"),round(BP,2)\n", - "n=BP/IP\n", - "print(\"therefore,mechanical efficiency of engine(n)=brake power/indicated power=BP/IP=\"),round(BP/IP,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so indicated power=90477.8 W\")\n", - "print(\"and mechanical efficiency=90%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.2;pg no: 388" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.2, Page:388 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 2\n", - "reciprocating pump is work absorbing machine having its mechanism similar to the piston-cylinder arrangement in IC engine.\n", - "mean effective pressure(mep)=A*k/l in pa\n", - "indicator power(IP)=Ap*L*mep*N*1*2/60 in W\n", - "(it is double acting so let us assume total power to be double of that in single acting) 88357.29\n", - "so power required to drive=88.36 KW\n" - ] - } - ], - "source": [ - "#cal of power required to drive\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.2, Page:388 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 2\")\n", - "A=40*10**-4;#area of indicator diagram in m^2\n", - "l=8*10**-2;#length of indicator diagram in m\n", - "D=15*10**-2;#bore of cylinder in m\n", - "L=20*10**-2;#stroke in m\n", - "k=1.5*10**8;#spring constant in pa/m\n", - "N=100;#pump motor rpm\n", - "print(\"reciprocating pump is work absorbing machine having its mechanism similar to the piston-cylinder arrangement in IC engine.\")\n", - "print(\"mean effective pressure(mep)=A*k/l in pa\")\n", - "mep=A*k/l \n", - "print(\"indicator power(IP)=Ap*L*mep*N*1*2/60 in W\")\n", - "Ap=math.pi*D**2/4\n", - "IP=Ap*L*mep*N*2/60\n", - "print(\"(it is double acting so let us assume total power to be double of that in single acting)\"),round(IP,2)\n", - "print(\"so power required to drive=88.36 KW\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.3;pg no: 388" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.3, Page:388 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 3\n", - "indicated power(IP)=brake power/mechanical efficiency in KW= 42.22\n", - "frictional power loss(FP)=IP-BP in KW 4.22\n", - "brake power at quater load(BPq)=0.25*BP in KW\n", - "mechanical efficiency(n1)=BPq/IP 0.69\n", - "in percentage 69.23\n", - "so indicated power=42.22 KW\n", - "frictional power loss=4.22 KW\n", - "mechanical efficiency=69.24%\n" - ] - } - ], - "source": [ - "#cal of indicated power,frictional power loss,mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "print\"Example 10.3, Page:388 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 3\")\n", - "n=0.9;#mechanical efficiency of engine\n", - "BP=38;#brake power in KW\n", - "IP=BP/n\n", - "print(\"indicated power(IP)=brake power/mechanical efficiency in KW=\"),round(IP,2)\n", - "FP=IP-BP\n", - "print(\"frictional power loss(FP)=IP-BP in KW\"),round(FP,2)\n", - "print(\"brake power at quater load(BPq)=0.25*BP in KW\")\n", - "BPq=0.25*BP\n", - "IP=BPq+FP;\n", - "n1=BPq/IP\n", - "print(\"mechanical efficiency(n1)=BPq/IP\"),round(n1,2)\n", - "print(\"in percentage\"),round(n1*100,2)\n", - "print(\"so indicated power=42.22 KW\")\n", - "print(\"frictional power loss=4.22 KW\")\n", - "print(\"mechanical efficiency=69.24%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.4;pg no: 389" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.4, Page:389 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\n", - "brake power of engine(BP) in MW= 3120.98\n", - "so brake power is 3.121 MW\n", - "The fuel consumption in kg/hr(m)=m*BP in kg/hr\n", - "In order to find out brake thermal efficiency the heat input from fuel per second is required.\n", - "heat from fuel(Q)in KJ/s\n", - "Q=m*C/3600\n", - "energy to brake power=3120.97 KW\n", - "brake thermal efficiency(n)= 0.33\n", - "in percentage 33.49\n", - "so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\n", - "NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\n" - ] - } - ], - "source": [ - "#cal of brake power,fuel consumption\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.4, Page:389 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\")\n", - "m=0.25;#specific fuel consumption in kg/KWh\n", - "Pb_mep=1.5*1000;#brake mean effective pressure of each cylinder in Kpa\n", - "N=100;#engine rpm\n", - "D=85*10**-2;#bore of cylinder in m\n", - "L=220*10**-2;#stroke in m\n", - "C=43*10**3;#calorific value of diesel in KJ/kg\n", - "A=math.pi*D**2/4;\n", - "BP=Pb_mep*L*A*N/60\n", - "print(\"brake power of engine(BP) in MW=\"),round(BP,2)\n", - "print(\"so brake power is 3.121 MW\")\n", - "print(\"The fuel consumption in kg/hr(m)=m*BP in kg/hr\")\n", - "m=m*BP\n", - "print(\"In order to find out brake thermal efficiency the heat input from fuel per second is required.\")\n", - "print(\"heat from fuel(Q)in KJ/s\")\n", - "print(\"Q=m*C/3600\")\n", - "Q=m*C/3600\n", - "print(\"energy to brake power=3120.97 KW\")\n", - "n=BP/Q\n", - "print(\"brake thermal efficiency(n)=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\")\n", - "print(\"NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.5;pg no: 389" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.5, Page:389 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\n", - "brake thermal efficiency(n)=3600/(m*C) 0.33\n", - "in percentage 33.49\n", - "brake power(BP)in KW\n", - "BP= 226.19\n", - "brake specific fuel consumption,m=mf/BP\n", - "so mf=m*BP in kg/hr\n", - "air consumption(ma)from given air fuel ratio=k*mf in kg/hr\n", - "ma in kg/min\n", - "using perfect gas equation,\n", - "P*Va=ma*R*T\n", - "sa Va=ma*R*T/P in m^3/min\n", - "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", - "volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder) 1.87\n", - "in percentage 186.55\n", - "NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\n" - ] - } - ], - "source": [ - "#cal of brake thermal efficiency,brake power,volumetric efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.5, Page:389 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\")\n", - "Pb_mep=6*10**5;#brake mean effective pressure in pa\n", - "N=600;#engine rpm\n", - "m=0.25;#specific fuel consumption in kg/KWh\n", - "D=20*10**-2;#bore of cylinder in m\n", - "L=30*10**-2;#stroke in m\n", - "k=26;#air to fuel ratio\n", - "C=43*10**3;#calorific value in KJ/kg\n", - "R=0.287;#gas constant in KJ/kg K\n", - "T=(27+273);#ambient temperature in K\n", - "P=1*10**2;#ambient pressure in Kpa\n", - "n=3600/(m*C)\n", - "print(\"brake thermal efficiency(n)=3600/(m*C)\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"brake power(BP)in KW\")\n", - "A=math.pi*D**2/4;\n", - "BP=4*Pb_mep*L*A*N/60000\n", - "print(\"BP=\"),round(BP,2)\n", - "print(\"brake specific fuel consumption,m=mf/BP\")\n", - "print(\"so mf=m*BP in kg/hr\")\n", - "mf=m*BP\n", - "print(\"air consumption(ma)from given air fuel ratio=k*mf in kg/hr\")\n", - "ma=k*mf\n", - "print(\"ma in kg/min\")\n", - "ma=ma/60\n", - "print(\"using perfect gas equation,\")\n", - "print(\"P*Va=ma*R*T\")\n", - "print(\"sa Va=ma*R*T/P in m^3/min\")\n", - "Va=ma*R*T/P\n", - "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", - "Vs=math.pi*D**2*L/4\n", - "n_vol=Va/(Vs*(N/2)*4)\n", - "print(\"volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder)\"),round(n_vol,2)\n", - "print(\"in percentage\"),round(n_vol*100,2)\n", - "print(\"NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.6;pg no: 390" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.6, Page:390 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\n", - "let the bore diameter be (D) m\n", - "piston speed(V)=2*L*N\n", - "so L=V/(2*N) in m\n", - "volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\n", - "so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\n", - "so air sucked =274.78*D^2 m^3/min\n", - "air requirement(ma),kg/min=A/F ratio*fuel consumption per min\n", - "so ma=r*m in kg/min\n", - "using perfect gas equation,P*Va=ma*R*T\n", - "so Va=ma*R*T/P in m^3/min\n", - "ideally,air sucked=Va\n", - "so 274.78*D^2=0.906\n", - "D=sqrt(0.906/274.78) in m\n", - "indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\n", - "brake power=indicated power*mechanical efficiency\n", - "BP=IP*n_mech in KW 10.35\n", - "so brake power=10.34 KW\n" - ] - } - ], - "source": [ - "#cal of brake power\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 10.6, Page:390 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\")\n", - "N=3000;#engine rpm\n", - "m=5;#fuel consumption in litre/hr\n", - "r=19;#air-fuel ratio\n", - "sg=0.7;#specific gravity of fuel\n", - "V=500;#piston speed in m/min\n", - "P_imep=6*10**5;#indicated mean effective pressure in pa\n", - "P=1.013*10**5;#ambient pressure in pa\n", - "T=(15+273);#ambient temperature in K\n", - "n_vol=0.7;#volumetric efficiency \n", - "n_mech=0.8;#mechanical efficiency\n", - "R=0.287;#gas constant for gas in KJ/kg K\n", - "print(\"let the bore diameter be (D) m\")\n", - "print(\"piston speed(V)=2*L*N\")\n", - "print(\"so L=V/(2*N) in m\")\n", - "L=V/(2*N)\n", - "L=0.0833;#approx.\n", - "print(\"volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\")\n", - "print(\"so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\")\n", - "n_vol*(math.pi*L/4)*N*2\n", - "print(\"so air sucked =274.78*D^2 m^3/min\")\n", - "print(\"air requirement(ma),kg/min=A/F ratio*fuel consumption per min\")\n", - "print(\"so ma=r*m in kg/min\")\n", - "ma=r*m*sg/60\n", - "print(\"using perfect gas equation,P*Va=ma*R*T\")\n", - "print(\"so Va=ma*R*T/P in m^3/min\")\n", - "Va=ma*R*T*1000/P \n", - "print(\"ideally,air sucked=Va\")\n", - "print(\"so 274.78*D^2=0.906\")\n", - "print(\"D=sqrt(0.906/274.78) in m\")\n", - "D=math.sqrt(0.906/274.78) \n", - "print(\"indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\")\n", - "IP=P_imep*L*(math.pi*D**2/4)*(N/60)*2/1000\n", - "print(\"brake power=indicated power*mechanical efficiency\")\n", - "BP=IP*n_mech \n", - "print(\"BP=IP*n_mech in KW\"),round(BP,2)\n", - "print(\"so brake power=10.34 KW\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.7;pg no: 391" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.7, Page:391 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\n", - "After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\n", - "friction power(FP)=5 KW\n", - "brake power(BP) in KW= 30.82\n", - "indicated power(IP) in KW= 35.82\n", - "mechanical efficiency(n_mech)= 0.86\n", - "in percentage 86.04\n", - "brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr= 0.29\n", - "brake thermal efficiency(n_bte)= 0.29\n", - "in percentage 28.67\n", - "also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\n", - "indicated thermal efficiency(n_ite)= 0.33\n", - "in percentage 33.32\n", - "indicated power(IP)=P_imep*L*A*N\n", - "so P_imep in Kpa= 76.01\n", - "Also,mechanical efficiency=P_bmep/P_imep\n", - "so P_bmep in Kpa= 65.4\n", - "brake power=30.82 KW\n", - "indicated power=35.82 KW\n", - "mechanical efficiency=86.04%\n", - "brake thermal efficiency=28.67%\n", - "indicated thermal efficiency=33.32%\n", - "brake mean effective pressure=65.39 Kpa\n", - "indicated mean effective pressure=76.01 Kpa\n" - ] - } - ], - "source": [ - "#cal of power and efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.7, Page:391 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\")\n", - "M=20;#load on dynamometer in kg\n", - "r=50*10**-2;#radius in m\n", - "N=3000;#speed of rotation in rpm\n", - "D=20*10**-2;#bore in m\n", - "L=30*10**-2;#stroke in m\n", - "m=0.15;#fuel supplying rate in kg/min\n", - "C=43;#calorific value of fuel in MJ/kg\n", - "FP=5;#friction power in KW\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\")\n", - "print(\"friction power(FP)=5 KW\")\n", - "BP=2*math.pi*N*(M*g*r)*10**-3/60\n", - "print(\"brake power(BP) in KW=\"),round(BP,2)\n", - "IP=BP+FP\n", - "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", - "n_mech=BP/IP\n", - "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "bsfc=m*60/BP\n", - "print(\"brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr=\"),round(bsfc,2)\n", - "n_bte=3600/(bsfc*C*1000)\n", - "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", - "print(\"in percentage\"),round(n_bte*100,2)\n", - "print(\"also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\")\n", - "n_ite=n_bte/n_mech\n", - "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", - "print(\"in percentage\"),round(n_ite*100,2)\n", - "print(\"indicated power(IP)=P_imep*L*A*N\")\n", - "P_imep=IP/(L*(math.pi*D**2/4)*N/60)\n", - "print(\"so P_imep in Kpa=\"),round(P_imep,2)\n", - "print(\"Also,mechanical efficiency=P_bmep/P_imep\")\n", - "n_mech=0.8604;#mechanical efficiency\n", - "P_bmep=P_imep*n_mech\n", - "print(\"so P_bmep in Kpa=\"),round(P_bmep,2)\n", - "print(\"brake power=30.82 KW\")\n", - "print(\"indicated power=35.82 KW\")\n", - "print(\"mechanical efficiency=86.04%\")\n", - "print(\"brake thermal efficiency=28.67%\")\n", - "print(\"indicated thermal efficiency=33.32%\")\n", - "print(\"brake mean effective pressure=65.39 Kpa\")\n", - "print(\"indicated mean effective pressure=76.01 Kpa\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.8;pg no: 392" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.8, Page:392 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\n", - "indicated power(IP) in KW= 282.74\n", - "mechanical efficiency(n_mech)=brake power/indicated power\n", - "so n_mech= 0.88\n", - "in percentage 88.42\n", - "brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\n", - "brake thermal efficiency(n_bte)= 0.35\n", - "in percentage 34.88\n", - "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", - "mass of air corresponding to above swept volume,using perfect gas equation\n", - "P*Vs=ma*R*T\n", - "so ma=(P*Vs)/(R*T) in kg\n", - "volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\n", - "so mass of air taken per minute in kg/min \n", - "mass corresponding to swept volume per minute in kg/min\n", - "so volumetric efficiency 0.8333\n", - "in percentage 83.3333\n", - "so indicated power =282.74 KW,mechanical efficiency=88.42%\n", - "brake thermal efficiency=34.88%,volumetric efficiency=83.33%\n" - ] - } - ], - "source": [ - "#cal of brake thermal efficiency,volumetric effeciency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.8, Page:392 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\")\n", - "N=300.;#engine rpm\n", - "BP=250.;#brake power in KW\n", - "D=30.*10**-2;#bore in m\n", - "L=25.*10**-2;#stroke in m\n", - "m=1.;#fuel consumption in kg/min\n", - "r=10.;#airfuel ratio \n", - "P_imep=0.8;#indicated mean effective pressure in pa\n", - "C=43.*10**3;#calorific value of fuel in KJ/kg\n", - "P=1.013*10**5;#ambient pressure in K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "T=(27.+273.);#ambient temperature in K\n", - "IP=P_imep*L*(math.pi*D**2/4)*N*4*10**3/60\n", - "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", - "print(\"mechanical efficiency(n_mech)=brake power/indicated power\")\n", - "n_mech=BP/IP\n", - "print(\"so n_mech=\"),round(n_mech,2)\n", - "print(\"in percentage \"),round(n_mech*100,2)\n", - "print(\"brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\")\n", - "bsfc=m*60./BP\n", - "n_bte=3600./(bsfc*C)\n", - "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", - "print(\"in percentage\"),round(n_bte*100,2)\n", - "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", - "Vs=math.pi*D**2*L/4\n", - "print(\"mass of air corresponding to above swept volume,using perfect gas equation\")\n", - "print(\"P*Vs=ma*R*T\")\n", - "print(\"so ma=(P*Vs)/(R*T) in kg\")\n", - "ma=(P*Vs)/(R*T*1000) \n", - "ma=0.02;#approx.\n", - "print(\"volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\")\n", - "print(\"so mass of air taken per minute in kg/min \")\n", - "1*10\n", - "print(\"mass corresponding to swept volume per minute in kg/min\")\n", - "ma*4*N/2\n", - "print(\"so volumetric efficiency \"),round(10./12.,4)\n", - "print(\"in percentage\"),round((10./12.)*100.,4)\n", - "print(\"so indicated power =282.74 KW,mechanical efficiency=88.42%\")\n", - "print(\"brake thermal efficiency=34.88%,volumetric efficiency=83.33%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.9;pg no: 393" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.9, Page:393 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\n", - "indicated mean effective pressure(P_imeb)=h*k in Kpa\n", - "indicated power(IP)=P_imeb*L*A*N/2 in KW 9.375\n", - "brake power(BP)=2*%pi*N*T in KW 4.62\n", - "mechanical efficiency(n_mech)= 0.49\n", - "in percentage 49.31\n", - "so indicated power=9.375 KW\n", - "brake power=4.62 KW\n", - "mechanical efficiency=49.28%\n", - "energy liberated from fuel(Ef)=C*m/60 in KJ/s\n", - "energy available as brake power(BP)=4.62 KW\n", - "energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\n", - "energy carried by exhaust gases(Eg)=30 KJ/s\n", - "unaccounted energy loss in KW= 34.75\n", - "NOTE=>overall energy balance sheet is attached as jpg file with this code.\n" - ] - } - ], - "source": [ - "#cal of indicated power,brake power,mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.9, Page:393 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\")\n", - "h=10.;#height of indicator diagram in mm\n", - "k=25.;#indicator constant in KN/m^2 per mm\n", - "N=300.;#engine rpm\n", - "Vs=1.5*10**-2;#swept volume in m^3\n", - "M=60.;#effective brake load upon dynamometer in kg\n", - "r=50.*10**-2;#effective brake drum radius in m\n", - "m=0.12;#fuel consumption in kg/min\n", - "C=42.*10**3;#calorific value in KJ/kg\n", - "mw=6.;#circulating water rate in kg/min\n", - "T1=35.;#cooling water entering temperature in degree celcius\n", - "T2=70.;#cooling water leaving temperature in degree celcius\n", - "Eg=30.;#exhaust gases leaving energy in KJ/s\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "g=9.81;#accelaration due to gravity in m/s^2\n", - "print(\"indicated mean effective pressure(P_imeb)=h*k in Kpa\")\n", - "P_imeb=h*k\n", - "IP=P_imeb*Vs*N/(2*60)\n", - "print(\"indicated power(IP)=P_imeb*L*A*N/2 in KW\") ,round(IP,3)\n", - "BP=2*math.pi*N*(M*g*r*10**-3)/(2*60)\n", - "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", - "n_mech=BP/IP\n", - "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "print(\"so indicated power=9.375 KW\")\n", - "print(\"brake power=4.62 KW\")\n", - "print(\"mechanical efficiency=49.28%\")\n", - "print(\"energy liberated from fuel(Ef)=C*m/60 in KJ/s\")\n", - "Ef=C*m/60\n", - "print(\"energy available as brake power(BP)=4.62 KW\")\n", - "print(\"energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\")\n", - "Ec=(mw/M)*Cw*(T2-T1)\n", - "print(\"energy carried by exhaust gases(Eg)=30 KJ/s\")\n", - "Ef-BP-Ec-Eg\n", - "print(\"unaccounted energy loss in KW=\"),round(Ef-BP-Ec-Eg,2)\n", - "print(\"NOTE=>overall energy balance sheet is attached as jpg file with this code.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.10;pg no: 394" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.10, Page:394 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\n", - "brake power(BP)=2*%pi*N*T in KW 47.12\n", - "so brake power=47.124 KW\n", - "brake specific fuel consumption(bsfc) in kg/KW hr= 0.34\n", - "indicated power(IP) in Kw= 52.36\n", - "indicated thermal efficiency(n_ite)= 0.28\n", - "in percentage 28.05\n", - "so indicated thermal efficiency=28.05%\n", - "heat available from fuel(Qf)=(m/mw)*C in KJ/min 11200.0\n", - "energy consumed as brake power(BP) in KJ/min= 2827.43\n", - "energy carried by cooling water(Qw) in KJ/min= 1442.1\n", - "energy carried by exhaust gases(Qg) in KJ/min= 4786.83\n", - "unaccounted energy loss in KJ/min 2143.63\n", - "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\n" - ] - } - ], - "source": [ - "#cal of brake power,brake specific fuel consumption,indicated thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.10, Page:394 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\")\n", - "m=4.;#mass of fuel consumed in kg\n", - "N=1500.;#engine rpm\n", - "mw=15.;#water circulation rate in kg/min\n", - "T1=27.;#cooling water inlet temperature in degree celcius\n", - "T2=50.;#cooling water outlet temperature in degree celcius\n", - "ma=150.;#mass of air consumed in kg\n", - "T_exhaust=400.;#exhaust temperature in degree celcius\n", - "T_atm=27.;#atmospheric temperature in degree celcius\n", - "Cg=1.25;#mean specific heat of exhaust gases in KJ/kg K\n", - "n_mech=0.9;#mechanical efficiency\n", - "T=300.*10**-3;#brake torque in N\n", - "C=42.*10**3;#calorific value in KJ/kg\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "BP=2.*math.pi*N*T/60\n", - "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", - "print(\"so brake power=47.124 KW\")\n", - "bsfc=m*60/(mw*BP)\n", - "print(\"brake specific fuel consumption(bsfc) in kg/KW hr=\"),round(bsfc,2)\n", - "IP=BP/n_mech\n", - "print(\"indicated power(IP) in Kw=\"),round(IP,2)\n", - "n_ite=IP*mw*60/(m*C)\n", - "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", - "print(\"in percentage\"),round(n_ite*100,2)\n", - "print(\"so indicated thermal efficiency=28.05%\")\n", - "Qf=(m/mw)*C\n", - "print(\"heat available from fuel(Qf)=(m/mw)*C in KJ/min\"),round(Qf,2)\n", - "BP=BP*60 \n", - "print(\"energy consumed as brake power(BP) in KJ/min=\"),round(BP,2)\n", - "Qw=mw*Cw*(T2-T1)\n", - "print(\"energy carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", - "Qg=(ma+m)*Cg*(T_exhaust-T_atm)/mw\n", - "print(\"energy carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", - "Qf-(BP+Qw+Qg)\n", - "print(\"unaccounted energy loss in KJ/min\"),round(Qf-(BP+Qw+Qg),2)\n", - "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.11;pg no: 395" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.11, Page:395 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\n", - "indicated power of 1st cylinder=BP-BP1 in KW\n", - "indicated power of 2nd cylinder=BP-BP2 in KW\n", - "indicated power of 3rd cylinder=BP-BP3 in KW\n", - "indicated power of 4th cylinder=BP-BP4 in KW\n", - "indicated power of 5th cylinder=BP-BP5 in KW\n", - "indicated power of 6th cylinder=BP-BP6 in KW\n", - " total indicated power(IP)in KW= 61.9\n", - "mechanical efficiency(n_mech)= 0.81\n", - "in percentage 80.78\n", - "so indicated power=61.9 KW\n", - "mechanical efficiency=80.77%\n" - ] - } - ], - "source": [ - "#cal of indicated power and mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.11, Page:395 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\")\n", - "BP=50.;#brake power output at full load in KW\n", - "BP1=40.1;#brake power output of 1st cylinder in KW\n", - "BP2=39.5;#brake power output of 2nd cylinder in KW\n", - "BP3=39.1;#brake power output of 3rd cylinder in KW\n", - "BP4=39.6;#brake power output of 4th cylinder in KW\n", - "BP5=39.8;#brake power output of 5th cylinder in KW\n", - "BP6=40.;#brake power output of 6th cylinder in KW\n", - "print(\"indicated power of 1st cylinder=BP-BP1 in KW\")\n", - "BP-BP1\n", - "print(\"indicated power of 2nd cylinder=BP-BP2 in KW\")\n", - "BP-BP2\n", - "print(\"indicated power of 3rd cylinder=BP-BP3 in KW\")\n", - "BP-BP3\n", - "print(\"indicated power of 4th cylinder=BP-BP4 in KW\")\n", - "BP-BP4\n", - "print(\"indicated power of 5th cylinder=BP-BP5 in KW\")\n", - "BP-BP5\n", - "print(\"indicated power of 6th cylinder=BP-BP6 in KW\")\n", - "BP-BP6\n", - "IP=9.9+10.5+10.9+10.4+10.2+10\n", - "print(\" total indicated power(IP)in KW=\"),round(IP,2)\n", - "n_mech=BP/IP\n", - "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "print(\"so indicated power=61.9 KW\")\n", - "print(\"mechanical efficiency=80.77%\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.12;pg no: 396" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.12, Page:396 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\n", - "brake power output of engine(BP) in KW= 19.63\n", - "brake power when cylinder 1 is cut(BP1) in KW= 13.74\n", - "so indicated power of first cylinder(IP1) in KW= 5.89\n", - "brake power when cylinder 2 is cut(BP2) in KW= 14.14\n", - "so indicated power of second cylinder(IP2) in KW= 5.5\n", - "brake power when cylinder 3 is cut(BP3) in KW= 14.29\n", - "so indicated power of third cylinder(IP3) in KW= 5.34\n", - "brake power when cylinder 4 is cut(BP4) in KW= 13.35\n", - "so indicated power of fourth cylinder(IP4) in KW= 6.28\n", - "now total indicated power(IP) in KW 23.01\n", - "engine mechanical efficiency(n_mech)= 0.85\n", - "in percentage 85.32\n", - "so BP=19.63 KW,IP=23 KW,n_mech=83.35%\n", - "heat liberated by fuel(Qf)=m*C in KJ/min 8127.0\n", - "heat carried by exhaust gases(Qg) in KJ/min= 1436.02\n", - "heat carried by cooling water(Qw) in KJ/min= 1730.52\n", - "energy to brake power(BP) in KJ/min= 1177.8\n", - "unaccounted losses in KJ/min 3782.66\n", - "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \n" - ] - } - ], - "source": [ - "#cal of brake power,indicated power,heat balance sheet\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 10.12, Page:396 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\")\n", - "N=1500.;#engine rpm at full load\n", - "F=250.;#brake load at full load in N\n", - "F1=175.;#brake reading 1 in N\n", - "F2=180.;#brake reading 2 in N\n", - "F3=182.;#brake reading 3 in N\n", - "F4=170.;#brake reading 4 in N\n", - "r=50.*10**-2;#brake drum radius in m\n", - "m=0.189;#fuel consumption rate in kg/min\n", - "C=43.*10**3;#fuel calorific value in KJ/kg\n", - "k=12.;#air to fuel ratio\n", - "T_exhaust=600.;#exhaust gas temperature in degree celcius\n", - "mw=18.;#cooling water flow rate in kg/min\n", - "T1=27.;#cooling water entering temperature in degree celcius\n", - "T2=50.;#cooling water leaving temperature in degree celcius\n", - "T_atm=27.;#atmospheric air temperature\n", - "Cg=1.02;#specific heat of exhaust gas in KJ/kg K\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "BP=2.*math.pi*N*F*r*10**-3/60.\n", - "print(\"brake power output of engine(BP) in KW=\"),round(BP,2)\n", - "BP1=2.*math.pi*N*F1*r*10**-3/60.\n", - "print(\"brake power when cylinder 1 is cut(BP1) in KW=\"),round(BP1,2)\n", - "IP1=BP-BP1\n", - "print(\"so indicated power of first cylinder(IP1) in KW=\"),round(IP1,2)\n", - "BP2=2.*math.pi*N*F2*r*10**-3/60.\n", - "print(\"brake power when cylinder 2 is cut(BP2) in KW=\"),round(BP2,2)\n", - "IP2=BP-BP2\n", - "print(\"so indicated power of second cylinder(IP2) in KW=\"),round(IP2,2)\n", - "BP3=2.*math.pi*N*F3*r*10**-3/60.\n", - "print(\"brake power when cylinder 3 is cut(BP3) in KW=\"),round(BP3,2)\n", - "IP3=BP-BP3\n", - "print(\"so indicated power of third cylinder(IP3) in KW=\"),round(IP3,2)\n", - "BP4=2.*math.pi*N*F4*r*10**-3/60.\n", - "print(\"brake power when cylinder 4 is cut(BP4) in KW=\"),round(BP4,2)\n", - "IP4=BP-BP4\n", - "print(\"so indicated power of fourth cylinder(IP4) in KW=\"),round(IP4,2)\n", - "IP=IP1+IP2+IP3+IP4\n", - "print(\"now total indicated power(IP) in KW\"),round(IP,2)\n", - "n_mech=BP/IP\n", - "print(\"engine mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "print(\"so BP=19.63 KW,IP=23 KW,n_mech=83.35%\")\n", - "Qf=m*C\n", - "print(\"heat liberated by fuel(Qf)=m*C in KJ/min\"),round(Qf,2)\n", - "Qg=(k+1)*m*Cg*(T_exhaust-T_atm)\n", - "print(\"heat carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", - "Qw=mw*Cw*(T2-T1)\n", - "print(\"heat carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", - "BP=19.63*60\n", - "print(\"energy to brake power(BP) in KJ/min=\"),round(19.63*60,2)\n", - "Qf-(Qg+Qw+BP)\n", - "print(\"unaccounted losses in KJ/min\"),round(Qf-(Qg+Qw+BP),2)\n", - "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.13;pg no: 397" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.13, Page:397 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\n", - "brake power(BP)=2*%pi*N*T in KW\n", - "indicated power(IP)=(mep*L*A*N)/60000 in KW\n", - "A> heat added(Q)=m*C/3600 in KJ/s 52.36\n", - "or Q in KJ/min\n", - "thermal efficiency(n_th)= 0.27\n", - "in percentage 26.85\n", - "B> heat equivalent of brake power(BP) in KJ/min= 659.76\n", - "C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\n", - "heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\n", - "mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\n", - "mg=(ma+m)/60\n", - "mass of steam in exhaust gases in kg/min\n", - "mass of dry exhaust gases in kg/min\n", - "D> heat carried by steam in exhaust in KJ/min 299.86\n", - "E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min 782.64\n", - "F> unaccounted loss=A-B-C-D-E in KJ/min 537.4\n", - "NOTE># on per minute basis is attached as jpg file with this code.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency and heat balance sheet\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.13, Page:397 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\")\n", - "D=20.*10**-2;#cylinder diameter in m\n", - "L=28.*10**-2;#stroke in m\n", - "m=4.22;#mass of fuel used in kg\n", - "C=44670.;#calorific value of fuel in KJ/kg\n", - "N=21000./60.;#engine rpm\n", - "mep=2.74*10**5;#mean effective pressure in pa\n", - "F=600.;#net brake load applied to a drum of 100 cm diameter in N\n", - "r=50.*10**-2;#brake drum radius in m\n", - "mw=495.;#total mass of cooling water in kg\n", - "T1=13.;#cooling water inlet temperature in degree celcius\n", - "T2=38.;#cooling water outlet temperature in degree celcius\n", - "ma=135.;#mass of air used in kg\n", - "T_air=20.;#temperature of air in test room in degree celcius\n", - "T_exhaust=370.;#temperature of exhaust gases in degree celcius\n", - "Cp_gases=1.005;#specific heat of gases in KJ/kg K\n", - "Cp_steam=2.093;#specific heat of steam at atmospheric pressure in KJ/kg K\n", - "Cpw=4.18;#specific heat of water in KJ/kg K\n", - "print(\"brake power(BP)=2*%pi*N*T in KW\")\n", - "BP=2*math.pi*N*F*r/60000\n", - "print(\"indicated power(IP)=(mep*L*A*N)/60000 in KW\")\n", - "IP=(mep*L*(math.pi*D**2/4)*N)/60000\n", - "Q=m*C/3600\n", - "print(\"A> heat added(Q)=m*C/3600 in KJ/s\"),round(Q,2)\n", - "print(\"or Q in KJ/min\")\n", - "Q=Q*60\n", - "Q=52.36;#heat added in KJ/s\n", - "n_th=IP/Q\n", - "print(\"thermal efficiency(n_th)= \"),round(n_th,2)\n", - "print(\"in percentage\"),round(n_th*100,2)\n", - "BP=BP*60\n", - "print(\"B> heat equivalent of brake power(BP) in KJ/min= \"),round(10.996*60,2)\n", - "print(\"C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\")\n", - "Qw=mw*Cpw*(T2-T1)/60\n", - "print(\"heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\")\n", - "print(\"mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\")\n", - "print(\"mg=(ma+m)/60\")\n", - "mg=(ma+m)/60\n", - "print(\"mass of steam in exhaust gases in kg/min\")\n", - "9*(0.15*m/60)\n", - "print(\"mass of dry exhaust gases in kg/min\")\n", - "mg-0.095\n", - "0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100))\n", - "print(\"D> heat carried by steam in exhaust in KJ/min\"),round(0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100)),2)\n", - "Qg=2.225*Cp_gases*(T_exhaust-T_air)\n", - "print(\"E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min\"),round(Qg,2)\n", - "print(\"F> unaccounted loss=A-B-C-D-E in KJ/min\"),round(3141.79-659.76-862.13-299.86-782.64,2)\n", - "print(\"NOTE># on per minute basis is attached as jpg file with this code.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter10_3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter10_3.ipynb deleted file mode 100755 index 2d9241c2..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter10_3.ipynb +++ /dev/null @@ -1,1080 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 10:Intoduction to Internal Combustion engines" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.1;pg no: 387" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.1, Page:387 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 1\n", - "from stroke to bore ratio i.e L/D=1.2 and cylinder diameter=bore,i.e D=12 cm\n", - "stroke(L)=1.2*D in m\n", - "Area of indicator diagram(A)=30*10^-4 m^2\n", - "length of indicator diagram(l)=(1/2)*L in m\n", - "mean effective pressure(mep)=A*k/l in N/m^2\n", - "cross-section area of piston(Ap)=%pi*D^2/4 in m^2\n", - "for one cylinder indicated power(IP)=mep*Ap*L*N/(2*60) in W\n", - "for four cylinder total indicated power(IP)=4*IP in W 90477.87\n", - "frictional power loss(FP)=0.10*IP in W\n", - "brake power available(BP)=indicated power-frictional power=IP-FP in W 81430.08\n", - "therefore,mechanical efficiency of engine(n)=brake power/indicated power=BP/IP= 0.9\n", - "in percentage 90.0\n", - "so indicated power=90477.8 W\n", - "and mechanical efficiency=90%\n" - ] - } - ], - "source": [ - "#cal of indicated power,,mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 10.1, Page:387 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 1\")\n", - "k=20.*10**6;#spring constant in N/m^2\n", - "N=2000.;#engine rpm\n", - "print(\"from stroke to bore ratio i.e L/D=1.2 and cylinder diameter=bore,i.e D=12 cm\")\n", - "D=12.*10**-2;#cylinder diameter in m\n", - "print(\"stroke(L)=1.2*D in m\")\n", - "L=1.2*D\n", - "print(\"Area of indicator diagram(A)=30*10^-4 m^2\")\n", - "A=30.*10**-4;\n", - "print(\"length of indicator diagram(l)=(1/2)*L in m\")\n", - "l=(1./2.)*L\n", - "print(\"mean effective pressure(mep)=A*k/l in N/m^2\")\n", - "mep=A*k/l\n", - "print(\"cross-section area of piston(Ap)=%pi*D^2/4 in m^2\")\n", - "Ap=math.pi*D**2./4.\n", - "print(\"for one cylinder indicated power(IP)=mep*Ap*L*N/(2*60) in W\")\n", - "IP=mep*Ap*L*N/(2.*60.)\n", - "IP=4.*IP\n", - "print(\"for four cylinder total indicated power(IP)=4*IP in W\"),round(IP,2)\n", - "print(\"frictional power loss(FP)=0.10*IP in W\")\n", - "FP=0.10*IP\n", - "BP=IP-FP\n", - "print(\"brake power available(BP)=indicated power-frictional power=IP-FP in W\"),round(BP,2)\n", - "n=BP/IP\n", - "print(\"therefore,mechanical efficiency of engine(n)=brake power/indicated power=BP/IP=\"),round(BP/IP,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so indicated power=90477.8 W\")\n", - "print(\"and mechanical efficiency=90%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.2;pg no: 388" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.2, Page:388 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 2\n", - "reciprocating pump is work absorbing machine having its mechanism similar to the piston-cylinder arrangement in IC engine.\n", - "mean effective pressure(mep)=A*k/l in pa\n", - "indicator power(IP)=Ap*L*mep*N*1*2/60 in W\n", - "(it is double acting so let us assume total power to be double of that in single acting) 88357.29\n", - "so power required to drive=88.36 KW\n" - ] - } - ], - "source": [ - "#cal of power required to drive\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.2, Page:388 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 2\")\n", - "A=40*10**-4;#area of indicator diagram in m^2\n", - "l=8*10**-2;#length of indicator diagram in m\n", - "D=15*10**-2;#bore of cylinder in m\n", - "L=20*10**-2;#stroke in m\n", - "k=1.5*10**8;#spring constant in pa/m\n", - "N=100;#pump motor rpm\n", - "print(\"reciprocating pump is work absorbing machine having its mechanism similar to the piston-cylinder arrangement in IC engine.\")\n", - "print(\"mean effective pressure(mep)=A*k/l in pa\")\n", - "mep=A*k/l \n", - "print(\"indicator power(IP)=Ap*L*mep*N*1*2/60 in W\")\n", - "Ap=math.pi*D**2/4\n", - "IP=Ap*L*mep*N*2/60\n", - "print(\"(it is double acting so let us assume total power to be double of that in single acting)\"),round(IP,2)\n", - "print(\"so power required to drive=88.36 KW\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.3;pg no: 388" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.3, Page:388 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 3\n", - "indicated power(IP)=brake power/mechanical efficiency in KW= 42.22\n", - "frictional power loss(FP)=IP-BP in KW 4.22\n", - "brake power at quater load(BPq)=0.25*BP in KW\n", - "mechanical efficiency(n1)=BPq/IP 0.69\n", - "in percentage 69.23\n", - "so indicated power=42.22 KW\n", - "frictional power loss=4.22 KW\n", - "mechanical efficiency=69.24%\n" - ] - } - ], - "source": [ - "#cal of indicated power,frictional power loss,mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "print\"Example 10.3, Page:388 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 3\")\n", - "n=0.9;#mechanical efficiency of engine\n", - "BP=38;#brake power in KW\n", - "IP=BP/n\n", - "print(\"indicated power(IP)=brake power/mechanical efficiency in KW=\"),round(IP,2)\n", - "FP=IP-BP\n", - "print(\"frictional power loss(FP)=IP-BP in KW\"),round(FP,2)\n", - "print(\"brake power at quater load(BPq)=0.25*BP in KW\")\n", - "BPq=0.25*BP\n", - "IP=BPq+FP;\n", - "n1=BPq/IP\n", - "print(\"mechanical efficiency(n1)=BPq/IP\"),round(n1,2)\n", - "print(\"in percentage\"),round(n1*100,2)\n", - "print(\"so indicated power=42.22 KW\")\n", - "print(\"frictional power loss=4.22 KW\")\n", - "print(\"mechanical efficiency=69.24%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.4;pg no: 389" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.4, Page:389 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\n", - "brake power of engine(BP) in MW= 3120.98\n", - "so brake power is 3.121 MW\n", - "The fuel consumption in kg/hr(m)=m*BP in kg/hr\n", - "In order to find out brake thermal efficiency the heat input from fuel per second is required.\n", - "heat from fuel(Q)in KJ/s\n", - "Q=m*C/3600\n", - "energy to brake power=3120.97 KW\n", - "brake thermal efficiency(n)= 0.33\n", - "in percentage 33.49\n", - "so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\n", - "NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\n" - ] - } - ], - "source": [ - "#cal of brake power,fuel consumption\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.4, Page:389 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 4\")\n", - "m=0.25;#specific fuel consumption in kg/KWh\n", - "Pb_mep=1.5*1000;#brake mean effective pressure of each cylinder in Kpa\n", - "N=100;#engine rpm\n", - "D=85*10**-2;#bore of cylinder in m\n", - "L=220*10**-2;#stroke in m\n", - "C=43*10**3;#calorific value of diesel in KJ/kg\n", - "A=math.pi*D**2/4;\n", - "BP=Pb_mep*L*A*N/60\n", - "print(\"brake power of engine(BP) in MW=\"),round(BP,2)\n", - "print(\"so brake power is 3.121 MW\")\n", - "print(\"The fuel consumption in kg/hr(m)=m*BP in kg/hr\")\n", - "m=m*BP\n", - "print(\"In order to find out brake thermal efficiency the heat input from fuel per second is required.\")\n", - "print(\"heat from fuel(Q)in KJ/s\")\n", - "print(\"Q=m*C/3600\")\n", - "Q=m*C/3600\n", - "print(\"energy to brake power=3120.97 KW\")\n", - "n=BP/Q\n", - "print(\"brake thermal efficiency(n)=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so fuel consumption=780.24 kg/hr,brake thermal efficiency=33.49%\")\n", - "print(\"NOTE=>In book,it is given that brake power in MW is 31.21 but in actual it is 3120.97 KW or 3.121 MW which is corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.5;pg no: 389" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.5, Page:389 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\n", - "brake thermal efficiency(n)=3600/(m*C) 0.33\n", - "in percentage 33.49\n", - "brake power(BP)in KW\n", - "BP= 226.19\n", - "brake specific fuel consumption,m=mf/BP\n", - "so mf=m*BP in kg/hr\n", - "air consumption(ma)from given air fuel ratio=k*mf in kg/hr\n", - "ma in kg/min\n", - "using perfect gas equation,\n", - "P*Va=ma*R*T\n", - "sa Va=ma*R*T/P in m^3/min\n", - "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", - "volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder) 1.87\n", - "in percentage 186.55\n", - "NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\n" - ] - } - ], - "source": [ - "#cal of brake thermal efficiency,brake power,volumetric efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.5, Page:389 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 5\")\n", - "Pb_mep=6*10**5;#brake mean effective pressure in pa\n", - "N=600;#engine rpm\n", - "m=0.25;#specific fuel consumption in kg/KWh\n", - "D=20*10**-2;#bore of cylinder in m\n", - "L=30*10**-2;#stroke in m\n", - "k=26;#air to fuel ratio\n", - "C=43*10**3;#calorific value in KJ/kg\n", - "R=0.287;#gas constant in KJ/kg K\n", - "T=(27+273);#ambient temperature in K\n", - "P=1*10**2;#ambient pressure in Kpa\n", - "n=3600/(m*C)\n", - "print(\"brake thermal efficiency(n)=3600/(m*C)\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"brake power(BP)in KW\")\n", - "A=math.pi*D**2/4;\n", - "BP=4*Pb_mep*L*A*N/60000\n", - "print(\"BP=\"),round(BP,2)\n", - "print(\"brake specific fuel consumption,m=mf/BP\")\n", - "print(\"so mf=m*BP in kg/hr\")\n", - "mf=m*BP\n", - "print(\"air consumption(ma)from given air fuel ratio=k*mf in kg/hr\")\n", - "ma=k*mf\n", - "print(\"ma in kg/min\")\n", - "ma=ma/60\n", - "print(\"using perfect gas equation,\")\n", - "print(\"P*Va=ma*R*T\")\n", - "print(\"sa Va=ma*R*T/P in m^3/min\")\n", - "Va=ma*R*T/P\n", - "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", - "Vs=math.pi*D**2*L/4\n", - "n_vol=Va/(Vs*(N/2)*4)\n", - "print(\"volumetric efficiency,n_vol=Va/(Vs*(N/2)*no. of cylinder)\"),round(n_vol,2)\n", - "print(\"in percentage\"),round(n_vol*100,2)\n", - "print(\"NOTE=>In this question,while calculating swept volume in book,values of D=0.30 m and L=0.4 m is taken which is wrong.Hence above solution is solve taking right values given in book which is D=0.20 m and L=0.3 m,so the volumetric efficiency vary accordingly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.6;pg no: 390" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.6, Page:390 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\n", - "let the bore diameter be (D) m\n", - "piston speed(V)=2*L*N\n", - "so L=V/(2*N) in m\n", - "volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\n", - "so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\n", - "so air sucked =274.78*D^2 m^3/min\n", - "air requirement(ma),kg/min=A/F ratio*fuel consumption per min\n", - "so ma=r*m in kg/min\n", - "using perfect gas equation,P*Va=ma*R*T\n", - "so Va=ma*R*T/P in m^3/min\n", - "ideally,air sucked=Va\n", - "so 274.78*D^2=0.906\n", - "D=sqrt(0.906/274.78) in m\n", - "indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\n", - "brake power=indicated power*mechanical efficiency\n", - "BP=IP*n_mech in KW 10.35\n", - "so brake power=10.34 KW\n" - ] - } - ], - "source": [ - "#cal of brake power\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 10.6, Page:390 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 6\")\n", - "N=3000;#engine rpm\n", - "m=5;#fuel consumption in litre/hr\n", - "r=19;#air-fuel ratio\n", - "sg=0.7;#specific gravity of fuel\n", - "V=500;#piston speed in m/min\n", - "P_imep=6*10**5;#indicated mean effective pressure in pa\n", - "P=1.013*10**5;#ambient pressure in pa\n", - "T=(15+273);#ambient temperature in K\n", - "n_vol=0.7;#volumetric efficiency \n", - "n_mech=0.8;#mechanical efficiency\n", - "R=0.287;#gas constant for gas in KJ/kg K\n", - "print(\"let the bore diameter be (D) m\")\n", - "print(\"piston speed(V)=2*L*N\")\n", - "print(\"so L=V/(2*N) in m\")\n", - "L=V/(2*N)\n", - "L=0.0833;#approx.\n", - "print(\"volumetric efficiency,n_vol=air sucked/(swept volume * no. of cylinder)\")\n", - "print(\"so air sucked/D^2=n_vol*(%pi*L/4)*N*2 in m^3/min\")\n", - "n_vol*(math.pi*L/4)*N*2\n", - "print(\"so air sucked =274.78*D^2 m^3/min\")\n", - "print(\"air requirement(ma),kg/min=A/F ratio*fuel consumption per min\")\n", - "print(\"so ma=r*m in kg/min\")\n", - "ma=r*m*sg/60\n", - "print(\"using perfect gas equation,P*Va=ma*R*T\")\n", - "print(\"so Va=ma*R*T/P in m^3/min\")\n", - "Va=ma*R*T*1000/P \n", - "print(\"ideally,air sucked=Va\")\n", - "print(\"so 274.78*D^2=0.906\")\n", - "print(\"D=sqrt(0.906/274.78) in m\")\n", - "D=math.sqrt(0.906/274.78) \n", - "print(\"indicated power(IP)=P_imep*L*A*N*no.of cylinders in KW\")\n", - "IP=P_imep*L*(math.pi*D**2/4)*(N/60)*2/1000\n", - "print(\"brake power=indicated power*mechanical efficiency\")\n", - "BP=IP*n_mech \n", - "print(\"BP=IP*n_mech in KW\"),round(BP,2)\n", - "print(\"so brake power=10.34 KW\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.7;pg no: 391" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.7, Page:391 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\n", - "After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\n", - "friction power(FP)=5 KW\n", - "brake power(BP) in KW= 30.82\n", - "indicated power(IP) in KW= 35.82\n", - "mechanical efficiency(n_mech)= 0.86\n", - "in percentage 86.04\n", - "brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr= 0.29\n", - "brake thermal efficiency(n_bte)= 0.29\n", - "in percentage 28.67\n", - "also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\n", - "indicated thermal efficiency(n_ite)= 0.33\n", - "in percentage 33.32\n", - "indicated power(IP)=P_imep*L*A*N\n", - "so P_imep in Kpa= 76.01\n", - "Also,mechanical efficiency=P_bmep/P_imep\n", - "so P_bmep in Kpa= 65.4\n", - "brake power=30.82 KW\n", - "indicated power=35.82 KW\n", - "mechanical efficiency=86.04%\n", - "brake thermal efficiency=28.67%\n", - "indicated thermal efficiency=33.32%\n", - "brake mean effective pressure=65.39 Kpa\n", - "indicated mean effective pressure=76.01 Kpa\n" - ] - } - ], - "source": [ - "#cal of power and efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.7, Page:391 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 7\")\n", - "M=20;#load on dynamometer in kg\n", - "r=50*10**-2;#radius in m\n", - "N=3000;#speed of rotation in rpm\n", - "D=20*10**-2;#bore in m\n", - "L=30*10**-2;#stroke in m\n", - "m=0.15;#fuel supplying rate in kg/min\n", - "C=43;#calorific value of fuel in MJ/kg\n", - "FP=5;#friction power in KW\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"After switching off fuel supply the capacity of motor required to run engine will be the friction power required at this speed of engine.\")\n", - "print(\"friction power(FP)=5 KW\")\n", - "BP=2*math.pi*N*(M*g*r)*10**-3/60\n", - "print(\"brake power(BP) in KW=\"),round(BP,2)\n", - "IP=BP+FP\n", - "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", - "n_mech=BP/IP\n", - "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "bsfc=m*60/BP\n", - "print(\"brake specific fuel consumption(bsfc)=specific fuel consumption/brake power in kg/KW hr=\"),round(bsfc,2)\n", - "n_bte=3600/(bsfc*C*1000)\n", - "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", - "print(\"in percentage\"),round(n_bte*100,2)\n", - "print(\"also,mechanical efficiency(n_mech)=brake thermal efficiency/indicated thermal efficiency\")\n", - "n_ite=n_bte/n_mech\n", - "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", - "print(\"in percentage\"),round(n_ite*100,2)\n", - "print(\"indicated power(IP)=P_imep*L*A*N\")\n", - "P_imep=IP/(L*(math.pi*D**2/4)*N/60)\n", - "print(\"so P_imep in Kpa=\"),round(P_imep,2)\n", - "print(\"Also,mechanical efficiency=P_bmep/P_imep\")\n", - "n_mech=0.8604;#mechanical efficiency\n", - "P_bmep=P_imep*n_mech\n", - "print(\"so P_bmep in Kpa=\"),round(P_bmep,2)\n", - "print(\"brake power=30.82 KW\")\n", - "print(\"indicated power=35.82 KW\")\n", - "print(\"mechanical efficiency=86.04%\")\n", - "print(\"brake thermal efficiency=28.67%\")\n", - "print(\"indicated thermal efficiency=33.32%\")\n", - "print(\"brake mean effective pressure=65.39 Kpa\")\n", - "print(\"indicated mean effective pressure=76.01 Kpa\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.8;pg no: 392" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.8, Page:392 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\n", - "indicated power(IP) in KW= 282.74\n", - "mechanical efficiency(n_mech)=brake power/indicated power\n", - "so n_mech= 0.88\n", - "in percentage 88.42\n", - "brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\n", - "brake thermal efficiency(n_bte)= 0.35\n", - "in percentage 34.88\n", - "swept volume(Vs)=%pi*D^2*L/4 in m^3\n", - "mass of air corresponding to above swept volume,using perfect gas equation\n", - "P*Vs=ma*R*T\n", - "so ma=(P*Vs)/(R*T) in kg\n", - "volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\n", - "so mass of air taken per minute in kg/min \n", - "mass corresponding to swept volume per minute in kg/min\n", - "so volumetric efficiency 0.8333\n", - "in percentage 83.3333\n", - "so indicated power =282.74 KW,mechanical efficiency=88.42%\n", - "brake thermal efficiency=34.88%,volumetric efficiency=83.33%\n" - ] - } - ], - "source": [ - "#cal of brake thermal efficiency,volumetric effeciency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.8, Page:392 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 8\")\n", - "N=300.;#engine rpm\n", - "BP=250.;#brake power in KW\n", - "D=30.*10**-2;#bore in m\n", - "L=25.*10**-2;#stroke in m\n", - "m=1.;#fuel consumption in kg/min\n", - "r=10.;#airfuel ratio \n", - "P_imep=0.8;#indicated mean effective pressure in pa\n", - "C=43.*10**3;#calorific value of fuel in KJ/kg\n", - "P=1.013*10**5;#ambient pressure in K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "T=(27.+273.);#ambient temperature in K\n", - "IP=P_imep*L*(math.pi*D**2/4)*N*4*10**3/60\n", - "print(\"indicated power(IP) in KW=\"),round(IP,2)\n", - "print(\"mechanical efficiency(n_mech)=brake power/indicated power\")\n", - "n_mech=BP/IP\n", - "print(\"so n_mech=\"),round(n_mech,2)\n", - "print(\"in percentage \"),round(n_mech*100,2)\n", - "print(\"brake specific fuel consumption(bsfc)=m*60/BP in kg/KW hr\")\n", - "bsfc=m*60./BP\n", - "n_bte=3600./(bsfc*C)\n", - "print(\"brake thermal efficiency(n_bte)=\"),round(n_bte,2)\n", - "print(\"in percentage\"),round(n_bte*100,2)\n", - "print(\"swept volume(Vs)=%pi*D^2*L/4 in m^3\")\n", - "Vs=math.pi*D**2*L/4\n", - "print(\"mass of air corresponding to above swept volume,using perfect gas equation\")\n", - "print(\"P*Vs=ma*R*T\")\n", - "print(\"so ma=(P*Vs)/(R*T) in kg\")\n", - "ma=(P*Vs)/(R*T*1000) \n", - "ma=0.02;#approx.\n", - "print(\"volumetric effeciency(n_vol)=mass of air taken per minute/mass corresponding to swept volume per minute\")\n", - "print(\"so mass of air taken per minute in kg/min \")\n", - "1*10\n", - "print(\"mass corresponding to swept volume per minute in kg/min\")\n", - "ma*4*N/2\n", - "print(\"so volumetric efficiency \"),round(10./12.,4)\n", - "print(\"in percentage\"),round((10./12.)*100.,4)\n", - "print(\"so indicated power =282.74 KW,mechanical efficiency=88.42%\")\n", - "print(\"brake thermal efficiency=34.88%,volumetric efficiency=83.33%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.9;pg no: 393" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.9, Page:393 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\n", - "indicated mean effective pressure(P_imeb)=h*k in Kpa\n", - "indicated power(IP)=P_imeb*L*A*N/2 in KW 9.375\n", - "brake power(BP)=2*%pi*N*T in KW 4.62\n", - "mechanical efficiency(n_mech)= 0.49\n", - "in percentage 49.31\n", - "so indicated power=9.375 KW\n", - "brake power=4.62 KW\n", - "mechanical efficiency=49.28%\n", - "energy liberated from fuel(Ef)=C*m/60 in KJ/s\n", - "energy available as brake power(BP)=4.62 KW\n", - "energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\n", - "energy carried by exhaust gases(Eg)=30 KJ/s\n", - "unaccounted energy loss in KW= 34.75\n", - "NOTE=>overall energy balance sheet is attached as jpg file with this code.\n" - ] - } - ], - "source": [ - "#cal of indicated power,brake power,mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.9, Page:393 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 9\")\n", - "h=10.;#height of indicator diagram in mm\n", - "k=25.;#indicator constant in KN/m^2 per mm\n", - "N=300.;#engine rpm\n", - "Vs=1.5*10**-2;#swept volume in m^3\n", - "M=60.;#effective brake load upon dynamometer in kg\n", - "r=50.*10**-2;#effective brake drum radius in m\n", - "m=0.12;#fuel consumption in kg/min\n", - "C=42.*10**3;#calorific value in KJ/kg\n", - "mw=6.;#circulating water rate in kg/min\n", - "T1=35.;#cooling water entering temperature in degree celcius\n", - "T2=70.;#cooling water leaving temperature in degree celcius\n", - "Eg=30.;#exhaust gases leaving energy in KJ/s\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "g=9.81;#accelaration due to gravity in m/s^2\n", - "print(\"indicated mean effective pressure(P_imeb)=h*k in Kpa\")\n", - "P_imeb=h*k\n", - "IP=P_imeb*Vs*N/(2*60)\n", - "print(\"indicated power(IP)=P_imeb*L*A*N/2 in KW\") ,round(IP,3)\n", - "BP=2*math.pi*N*(M*g*r*10**-3)/(2*60)\n", - "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", - "n_mech=BP/IP\n", - "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "print(\"so indicated power=9.375 KW\")\n", - "print(\"brake power=4.62 KW\")\n", - "print(\"mechanical efficiency=49.28%\")\n", - "print(\"energy liberated from fuel(Ef)=C*m/60 in KJ/s\")\n", - "Ef=C*m/60\n", - "print(\"energy available as brake power(BP)=4.62 KW\")\n", - "print(\"energy to coolant(Ec)=(mw/M)*Cw*(T2-T1) in KW\")\n", - "Ec=(mw/M)*Cw*(T2-T1)\n", - "print(\"energy carried by exhaust gases(Eg)=30 KJ/s\")\n", - "Ef-BP-Ec-Eg\n", - "print(\"unaccounted energy loss in KW=\"),round(Ef-BP-Ec-Eg,2)\n", - "print(\"NOTE=>overall energy balance sheet is attached as jpg file with this code.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.10;pg no: 394" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.10, Page:394 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\n", - "brake power(BP)=2*%pi*N*T in KW 47.12\n", - "so brake power=47.124 KW\n", - "brake specific fuel consumption(bsfc) in kg/KW hr= 0.34\n", - "indicated power(IP) in Kw= 52.36\n", - "indicated thermal efficiency(n_ite)= 0.28\n", - "in percentage 28.05\n", - "so indicated thermal efficiency=28.05%\n", - "heat available from fuel(Qf)=(m/mw)*C in KJ/min 11200.0\n", - "energy consumed as brake power(BP) in KJ/min= 2827.43\n", - "energy carried by cooling water(Qw) in KJ/min= 1442.1\n", - "energy carried by exhaust gases(Qg) in KJ/min= 4786.83\n", - "unaccounted energy loss in KJ/min 2143.63\n", - "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\n" - ] - } - ], - "source": [ - "#cal of brake power,brake specific fuel consumption,indicated thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.10, Page:394 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 10\")\n", - "m=4.;#mass of fuel consumed in kg\n", - "N=1500.;#engine rpm\n", - "mw=15.;#water circulation rate in kg/min\n", - "T1=27.;#cooling water inlet temperature in degree celcius\n", - "T2=50.;#cooling water outlet temperature in degree celcius\n", - "ma=150.;#mass of air consumed in kg\n", - "T_exhaust=400.;#exhaust temperature in degree celcius\n", - "T_atm=27.;#atmospheric temperature in degree celcius\n", - "Cg=1.25;#mean specific heat of exhaust gases in KJ/kg K\n", - "n_mech=0.9;#mechanical efficiency\n", - "T=300.*10**-3;#brake torque in N\n", - "C=42.*10**3;#calorific value in KJ/kg\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "BP=2.*math.pi*N*T/60\n", - "print(\"brake power(BP)=2*%pi*N*T in KW\"),round(BP,2)\n", - "print(\"so brake power=47.124 KW\")\n", - "bsfc=m*60/(mw*BP)\n", - "print(\"brake specific fuel consumption(bsfc) in kg/KW hr=\"),round(bsfc,2)\n", - "IP=BP/n_mech\n", - "print(\"indicated power(IP) in Kw=\"),round(IP,2)\n", - "n_ite=IP*mw*60/(m*C)\n", - "print(\"indicated thermal efficiency(n_ite)=\"),round(n_ite,2)\n", - "print(\"in percentage\"),round(n_ite*100,2)\n", - "print(\"so indicated thermal efficiency=28.05%\")\n", - "Qf=(m/mw)*C\n", - "print(\"heat available from fuel(Qf)=(m/mw)*C in KJ/min\"),round(Qf,2)\n", - "BP=BP*60 \n", - "print(\"energy consumed as brake power(BP) in KJ/min=\"),round(BP,2)\n", - "Qw=mw*Cw*(T2-T1)\n", - "print(\"energy carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", - "Qg=(ma+m)*Cg*(T_exhaust-T_atm)/mw\n", - "print(\"energy carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", - "Qf-(BP+Qw+Qg)\n", - "print(\"unaccounted energy loss in KJ/min\"),round(Qf-(BP+Qw+Qg),2)\n", - "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.11;pg no: 395" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.11, Page:395 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\n", - "indicated power of 1st cylinder=BP-BP1 in KW\n", - "indicated power of 2nd cylinder=BP-BP2 in KW\n", - "indicated power of 3rd cylinder=BP-BP3 in KW\n", - "indicated power of 4th cylinder=BP-BP4 in KW\n", - "indicated power of 5th cylinder=BP-BP5 in KW\n", - "indicated power of 6th cylinder=BP-BP6 in KW\n", - " total indicated power(IP)in KW= 61.9\n", - "mechanical efficiency(n_mech)= 0.81\n", - "in percentage 80.78\n", - "so indicated power=61.9 KW\n", - "mechanical efficiency=80.77%\n" - ] - } - ], - "source": [ - "#cal of indicated power and mechanical efficiency\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.11, Page:395 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 11\")\n", - "BP=50.;#brake power output at full load in KW\n", - "BP1=40.1;#brake power output of 1st cylinder in KW\n", - "BP2=39.5;#brake power output of 2nd cylinder in KW\n", - "BP3=39.1;#brake power output of 3rd cylinder in KW\n", - "BP4=39.6;#brake power output of 4th cylinder in KW\n", - "BP5=39.8;#brake power output of 5th cylinder in KW\n", - "BP6=40.;#brake power output of 6th cylinder in KW\n", - "print(\"indicated power of 1st cylinder=BP-BP1 in KW\")\n", - "BP-BP1\n", - "print(\"indicated power of 2nd cylinder=BP-BP2 in KW\")\n", - "BP-BP2\n", - "print(\"indicated power of 3rd cylinder=BP-BP3 in KW\")\n", - "BP-BP3\n", - "print(\"indicated power of 4th cylinder=BP-BP4 in KW\")\n", - "BP-BP4\n", - "print(\"indicated power of 5th cylinder=BP-BP5 in KW\")\n", - "BP-BP5\n", - "print(\"indicated power of 6th cylinder=BP-BP6 in KW\")\n", - "BP-BP6\n", - "IP=9.9+10.5+10.9+10.4+10.2+10\n", - "print(\" total indicated power(IP)in KW=\"),round(IP,2)\n", - "n_mech=BP/IP\n", - "print(\"mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "print(\"so indicated power=61.9 KW\")\n", - "print(\"mechanical efficiency=80.77%\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.12;pg no: 396" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.12, Page:396 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\n", - "brake power output of engine(BP) in KW= 19.63\n", - "brake power when cylinder 1 is cut(BP1) in KW= 13.74\n", - "so indicated power of first cylinder(IP1) in KW= 5.89\n", - "brake power when cylinder 2 is cut(BP2) in KW= 14.14\n", - "so indicated power of second cylinder(IP2) in KW= 5.5\n", - "brake power when cylinder 3 is cut(BP3) in KW= 14.29\n", - "so indicated power of third cylinder(IP3) in KW= 5.34\n", - "brake power when cylinder 4 is cut(BP4) in KW= 13.35\n", - "so indicated power of fourth cylinder(IP4) in KW= 6.28\n", - "now total indicated power(IP) in KW 23.01\n", - "engine mechanical efficiency(n_mech)= 0.85\n", - "in percentage 85.32\n", - "so BP=19.63 KW,IP=23 KW,n_mech=83.35%\n", - "heat liberated by fuel(Qf)=m*C in KJ/min 8127.0\n", - "heat carried by exhaust gases(Qg) in KJ/min= 1436.02\n", - "heat carried by cooling water(Qw) in KJ/min= 1730.52\n", - "energy to brake power(BP) in KJ/min= 1177.8\n", - "unaccounted losses in KJ/min 3782.66\n", - "NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \n" - ] - } - ], - "source": [ - "#cal of brake power,indicated power,heat balance sheet\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 10.12, Page:396 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 12\")\n", - "N=1500.;#engine rpm at full load\n", - "F=250.;#brake load at full load in N\n", - "F1=175.;#brake reading 1 in N\n", - "F2=180.;#brake reading 2 in N\n", - "F3=182.;#brake reading 3 in N\n", - "F4=170.;#brake reading 4 in N\n", - "r=50.*10**-2;#brake drum radius in m\n", - "m=0.189;#fuel consumption rate in kg/min\n", - "C=43.*10**3;#fuel calorific value in KJ/kg\n", - "k=12.;#air to fuel ratio\n", - "T_exhaust=600.;#exhaust gas temperature in degree celcius\n", - "mw=18.;#cooling water flow rate in kg/min\n", - "T1=27.;#cooling water entering temperature in degree celcius\n", - "T2=50.;#cooling water leaving temperature in degree celcius\n", - "T_atm=27.;#atmospheric air temperature\n", - "Cg=1.02;#specific heat of exhaust gas in KJ/kg K\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "BP=2.*math.pi*N*F*r*10**-3/60.\n", - "print(\"brake power output of engine(BP) in KW=\"),round(BP,2)\n", - "BP1=2.*math.pi*N*F1*r*10**-3/60.\n", - "print(\"brake power when cylinder 1 is cut(BP1) in KW=\"),round(BP1,2)\n", - "IP1=BP-BP1\n", - "print(\"so indicated power of first cylinder(IP1) in KW=\"),round(IP1,2)\n", - "BP2=2.*math.pi*N*F2*r*10**-3/60.\n", - "print(\"brake power when cylinder 2 is cut(BP2) in KW=\"),round(BP2,2)\n", - "IP2=BP-BP2\n", - "print(\"so indicated power of second cylinder(IP2) in KW=\"),round(IP2,2)\n", - "BP3=2.*math.pi*N*F3*r*10**-3/60.\n", - "print(\"brake power when cylinder 3 is cut(BP3) in KW=\"),round(BP3,2)\n", - "IP3=BP-BP3\n", - "print(\"so indicated power of third cylinder(IP3) in KW=\"),round(IP3,2)\n", - "BP4=2.*math.pi*N*F4*r*10**-3/60.\n", - "print(\"brake power when cylinder 4 is cut(BP4) in KW=\"),round(BP4,2)\n", - "IP4=BP-BP4\n", - "print(\"so indicated power of fourth cylinder(IP4) in KW=\"),round(IP4,2)\n", - "IP=IP1+IP2+IP3+IP4\n", - "print(\"now total indicated power(IP) in KW\"),round(IP,2)\n", - "n_mech=BP/IP\n", - "print(\"engine mechanical efficiency(n_mech)=\"),round(n_mech,2)\n", - "print(\"in percentage\"),round(n_mech*100,2)\n", - "print(\"so BP=19.63 KW,IP=23 KW,n_mech=83.35%\")\n", - "Qf=m*C\n", - "print(\"heat liberated by fuel(Qf)=m*C in KJ/min\"),round(Qf,2)\n", - "Qg=(k+1)*m*Cg*(T_exhaust-T_atm)\n", - "print(\"heat carried by exhaust gases(Qg) in KJ/min=\"),round(Qg,2)\n", - "Qw=mw*Cw*(T2-T1)\n", - "print(\"heat carried by cooling water(Qw) in KJ/min=\"),round(Qw,2)\n", - "BP=19.63*60\n", - "print(\"energy to brake power(BP) in KJ/min=\"),round(19.63*60,2)\n", - "Qf-(Qg+Qw+BP)\n", - "print(\"unaccounted losses in KJ/min\"),round(Qf-(Qg+Qw+BP),2)\n", - "print(\"NOTE=>Heat balance sheet on per minute basis is attached as jpg file with this code. \")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 10.13;pg no: 397" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 10.13, Page:397 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\n", - "brake power(BP)=2*%pi*N*T in KW\n", - "indicated power(IP)=(mep*L*A*N)/60000 in KW\n", - "A> heat added(Q)=m*C/3600 in KJ/s 52.36\n", - "or Q in KJ/min\n", - "thermal efficiency(n_th)= 0.27\n", - "in percentage 26.85\n", - "B> heat equivalent of brake power(BP) in KJ/min= 659.76\n", - "C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\n", - "heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\n", - "mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\n", - "mg=(ma+m)/60\n", - "mass of steam in exhaust gases in kg/min\n", - "mass of dry exhaust gases in kg/min\n", - "D> heat carried by steam in exhaust in KJ/min 299.86\n", - "E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min 782.64\n", - "F> unaccounted loss=A-B-C-D-E in KJ/min 537.4\n", - "NOTE># on per minute basis is attached as jpg file with this code.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency and heat balance sheet\n", - "#intiation of all variables\n", - "# Chapter 10\n", - "import math\n", - "print\"Example 10.13, Page:397 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 10 Example 13\")\n", - "D=20.*10**-2;#cylinder diameter in m\n", - "L=28.*10**-2;#stroke in m\n", - "m=4.22;#mass of fuel used in kg\n", - "C=44670.;#calorific value of fuel in KJ/kg\n", - "N=21000./60.;#engine rpm\n", - "mep=2.74*10**5;#mean effective pressure in pa\n", - "F=600.;#net brake load applied to a drum of 100 cm diameter in N\n", - "r=50.*10**-2;#brake drum radius in m\n", - "mw=495.;#total mass of cooling water in kg\n", - "T1=13.;#cooling water inlet temperature in degree celcius\n", - "T2=38.;#cooling water outlet temperature in degree celcius\n", - "ma=135.;#mass of air used in kg\n", - "T_air=20.;#temperature of air in test room in degree celcius\n", - "T_exhaust=370.;#temperature of exhaust gases in degree celcius\n", - "Cp_gases=1.005;#specific heat of gases in KJ/kg K\n", - "Cp_steam=2.093;#specific heat of steam at atmospheric pressure in KJ/kg K\n", - "Cpw=4.18;#specific heat of water in KJ/kg K\n", - "print(\"brake power(BP)=2*%pi*N*T in KW\")\n", - "BP=2*math.pi*N*F*r/60000\n", - "print(\"indicated power(IP)=(mep*L*A*N)/60000 in KW\")\n", - "IP=(mep*L*(math.pi*D**2/4)*N)/60000\n", - "Q=m*C/3600\n", - "print(\"A> heat added(Q)=m*C/3600 in KJ/s\"),round(Q,2)\n", - "print(\"or Q in KJ/min\")\n", - "Q=Q*60\n", - "Q=52.36;#heat added in KJ/s\n", - "n_th=IP/Q\n", - "print(\"thermal efficiency(n_th)= \"),round(n_th,2)\n", - "print(\"in percentage\"),round(n_th*100,2)\n", - "BP=BP*60\n", - "print(\"B> heat equivalent of brake power(BP) in KJ/min= \"),round(10.996*60,2)\n", - "print(\"C> heat loss to cooling water(Qw)=mw*Cpw*(T2-T1) in KJ/min\")\n", - "Qw=mw*Cpw*(T2-T1)/60\n", - "print(\"heat carried by exhaust gases=heat carried by steam in exhaust gases+heat carried by fuel gases(dry gases) in exhaust gases\")\n", - "print(\"mass of exhaust gases(mg)=mass of air+mass of fuel in kg/min\")\n", - "print(\"mg=(ma+m)/60\")\n", - "mg=(ma+m)/60\n", - "print(\"mass of steam in exhaust gases in kg/min\")\n", - "9*(0.15*m/60)\n", - "print(\"mass of dry exhaust gases in kg/min\")\n", - "mg-0.095\n", - "0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100))\n", - "print(\"D> heat carried by steam in exhaust in KJ/min\"),round(0.095*(Cpw*(100-T_air)+2256.9+Cp_steam*(T_exhaust-100)),2)\n", - "Qg=2.225*Cp_gases*(T_exhaust-T_air)\n", - "print(\"E> heat carried by fuel gases(dry gases) in exhaust gases(Qg) in KJ/min\"),round(Qg,2)\n", - "print(\"F> unaccounted loss=A-B-C-D-E in KJ/min\"),round(3141.79-659.76-862.13-299.86-782.64,2)\n", - "print(\"NOTE># on per minute basis is attached as jpg file with this code.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter11.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter11.ipynb deleted file mode 100755 index 31f593f0..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter11.ipynb +++ /dev/null @@ -1,1309 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 11:Introduction to refrigeration and Air Conditioning" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.1;pg no: 435" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.1, Page:435 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\n", - "for refrigerator working on reversed carnot cycle.\n", - "Q1/T1=Q2/T2\n", - "so Q2=Q1*T2/T1 in KJ/min\n", - "and work input required,W in KJ/min\n", - "W=Q2-Q1 83.66\n" - ] - } - ], - "source": [ - "#cal of work input\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.1, Page:435 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\")\n", - "T1=(-16.+273.);#temperature of refrigerated space in K\n", - "T2=(27.+273.);#temperature of atmosphere in K\n", - "Q1=500.;#heat extracted from refrigerated space in KJ/min\n", - "print(\"for refrigerator working on reversed carnot cycle.\")\n", - "print(\"Q1/T1=Q2/T2\")\n", - "print(\"so Q2=Q1*T2/T1 in KJ/min\")\n", - "Q2=Q1*T2/T1\n", - "print(\"and work input required,W in KJ/min\")\n", - "W=Q2-Q1\n", - "print(\"W=Q2-Q1\"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.2;pg no: 435" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.2, Page:435 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\n", - "refrigeration capacity or heat extraction rate(Q)in KJ/s\n", - "let the ice formation rate be m kg/s\n", - "heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\n", - "ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice= 6.25\n", - "COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\n", - "also COP=Q/W\n", - "so W=Q/COP in KJ/s\n", - "HP required 643.62\n", - "NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\n" - ] - } - ], - "source": [ - "#cal of HP required\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.2, Page:435 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\")\n", - "Q=800.;#refrigeration capacity in tons\n", - "Q_latent=335.;#latent heat for ice formation from water in KJ/kg\n", - "T1=(-7.+273.);#temperature of reservoir 1 in K\n", - "T2=(27.+273.);#temperature of reservoir 2 in K\n", - "print(\"refrigeration capacity or heat extraction rate(Q)in KJ/s\")\n", - "Q=Q*3.5\n", - "print(\"let the ice formation rate be m kg/s\")\n", - "print(\"heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\")\n", - "Q1=4.18*(27-0)+Q_latent\n", - "m=Q/Q1\n", - "print(\"ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice=\"),round(Q/Q1,2)\n", - "print(\"COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\")\n", - "COP=T1/(T2-T1)\n", - "print(\"also COP=Q/W\")\n", - "print(\"so W=Q/COP in KJ/s\")\n", - "W=Q/COP\n", - "W=W/0.7457\n", - "print(\"HP required\"),round(W/0.7457,2)\n", - "print(\"NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.3;pg no: 436" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.3, Page:436 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\n", - "COP=T1/(T2-T1)=Q/W 1.56\n", - "equating,COP=T1/(T2-T1)\n", - "so temperature of surrounding(T2)in K\n", - "T2= 403.69\n" - ] - } - ], - "source": [ - "#cal of COP and temperature of surrounding\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.3, Page:436 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\")\n", - "T1=(-27+273);#temperature of refrigerator in K\n", - "W=3*.7457;#work input in KJ/s\n", - "Q=1*3.5;#refrigeration effect in KJ/s\n", - "COP=Q/W\n", - "print(\"COP=T1/(T2-T1)=Q/W\"),round(COP,2)\n", - "COP=1.56;#approx.\n", - "print(\"equating,COP=T1/(T2-T1)\")\n", - "print(\"so temperature of surrounding(T2)in K\")\n", - "T2=T1+(T1/COP)\n", - "print(\"T2=\"),round(T2,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.4;pg no: 436" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.4, Page:436 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\n", - "during process 1-2_a\n", - "p2/p1=(T2_a/T1)^(y/(y-1))\n", - "so T2_a=T1*(p2/p1)^((y-1)/y)in K\n", - "theoretical temperature after compression,T2_a=440.18 K\n", - "for compression process,\n", - "n1=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+(T2_a-T1)/n1 in K\n", - "for expansion process,3-4_a\n", - "T4_a/T3=(p1/p2)^((y-1)/y)\n", - "so T4_a=T3*(p1/p2)^((y-1)/y) in K\n", - "n2=0.9=(T3-T4)/(T3-T4_a)\n", - "so T4=T3-(n2*(T3-T4_a))in K\n", - "so work during compression,W_C in KJ/s\n", - "W_C=m*Cp*(T2-T1)\n", - "work during expansion,W_T in KJ/s\n", - "W_T=m*Cp*(T3-T4)\n", - "refrigeration effect is realized during process,4-1.so refrigeration shall be,\n", - "Q_ref=m*Cp*(T1-T4) in KJ/s\n", - "Q_ref in ton 18.36\n", - "net work required(W)=W_C-W_T in KJ/s 111.59\n", - "COP= 0.58\n", - "so refrigeration capacity=18.36 ton or 64.26 KJ/s\n", - "and COP=0.57\n", - "NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\n" - ] - } - ], - "source": [ - "#cal of refrigeration capacity and COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.4, Page:436 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\")\n", - "T1=(-30.+273.);#temperature of air at beginning of compression in K\n", - "T3=(27.+273.);#temperature of air after cooling in K\n", - "r=8.;#pressure ratio\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "y=1.4;#expansion constant \n", - "m=1.;#air flow rate in kg/s\n", - "n1=0.85;#isentropic efficiency for compression process\n", - "n2=.9;#isentropic efficiency for expansion process\n", - "print(\"during process 1-2_a\")\n", - "print(\"p2/p1=(T2_a/T1)^(y/(y-1))\")\n", - "print(\"so T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", - "T2_a=T1*(r)**((y-1)/y)\n", - "print(\"theoretical temperature after compression,T2_a=440.18 K\")\n", - "print(\"for compression process,\")\n", - "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", - "T2=T1+(T2_a-T1)/n1\n", - "print(\"for expansion process,3-4_a\")\n", - "print(\"T4_a/T3=(p1/p2)^((y-1)/y)\")\n", - "print(\"so T4_a=T3*(p1/p2)^((y-1)/y) in K\")\n", - "T4_a=T3*(1/r)**((y-1)/y)\n", - "print(\"n2=0.9=(T3-T4)/(T3-T4_a)\")\n", - "print(\"so T4=T3-(n2*(T3-T4_a))in K\")\n", - "T4=T3-(n2*(T3-T4_a))\n", - "print(\"so work during compression,W_C in KJ/s\")\n", - "print(\"W_C=m*Cp*(T2-T1)\")\n", - "W_C=m*Cp*(T2-T1)\n", - "print(\"work during expansion,W_T in KJ/s\")\n", - "print(\"W_T=m*Cp*(T3-T4)\")\n", - "W_T=m*Cp*(T3-T4)\n", - "print(\"refrigeration effect is realized during process,4-1.so refrigeration shall be,\")\n", - "print(\"Q_ref=m*Cp*(T1-T4) in KJ/s\")\n", - "Q_ref=m*Cp*(T1-T4)\n", - "Q_ref=Q_ref/3.5\n", - "print(\"Q_ref in ton\"),round(Q_ref,2)\n", - "W=W_C-W_T\n", - "print(\"net work required(W)=W_C-W_T in KJ/s\"),round(W,2)\n", - "Q_ref=64.26;\n", - "COP=Q_ref/(W_C-W_T)\n", - "print(\"COP=\"),round(COP,2)\n", - "print(\"so refrigeration capacity=18.36 ton or 64.26 KJ/s\")\n", - "print(\"and COP=0.57\")\n", - "print(\"NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.5;pg no: 437" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.5, Page:437 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\n", - "for isentropic compression process:\n", - "(p2/p1)^((y-1)/y)=T2/T1\n", - "so T2=T1*(p2/p1)^((y-1)/y) in K\n", - "for isenropic expansion process:\n", - "(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\n", - "so T4=T3/(p2/p1)^((y-1)/y) in K\n", - "heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\n", - "refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\n", - "so net work(W)=Q23-Q41 in KJ/kg\n", - "so COP=refrigeration effect/net work= 1.71\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.5, Page:437 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\")\n", - "T1=(7+273);#temperature of refrigerated space in K\n", - "T3=(27+273);#temperature after compression in K\n", - "p1=1*10**5;#pressure of refrigerated space in pa\n", - "p2=5*10**5;#pressure after compression in pa\n", - "y=1.4;#expansion constant\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"for isentropic compression process:\")\n", - "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", - "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"for isenropic expansion process:\")\n", - "print(\"(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\")\n", - "print(\"so T4=T3/(p2/p1)^((y-1)/y) in K\")\n", - "T4=T3/(p2/p1)**((y-1)/y)\n", - "print(\"heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\")\n", - "Q23=Cp*(T2-T3)\n", - "print(\"refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\")\n", - "Q41=Cp*(T1-T4)\n", - "print(\"so net work(W)=Q23-Q41 in KJ/kg\")\n", - "W=Q23-Q41\n", - "COP=Q41/W\n", - "print(\"so COP=refrigeration effect/net work=\"),round(COP,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.6;pg no: 438" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.6, Page:438 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\n", - "for process 1-2\n", - "(p2/p1)^((y-1)/y)=T2/T1\n", - "so T2=T1*(p2/p1)^((y-1)/y) in K\n", - "for process 3-4\n", - "(p3/p4)^((y-1)/y)=T3/T4\n", - "so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\n", - "refrigeration capacity(Q) in KJ/s= 63.25\n", - "Q in ton\n", - "work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\n", - "w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\n", - "HP required to run compressor 177.86\n", - "so HP required to run compressor=177.86 hp\n", - "net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\n", - "COP=refrigeration capacity/work=Q/W 1.59\n" - ] - } - ], - "source": [ - "#cal of refrigeration capacity,HP required to run compressor,COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.6, Page:438 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\")\n", - "T1=(-10.+273.);#air entering temperature in K\n", - "p1=1.*10**5;#air entering pressure in pa\n", - "T3=(27.+273.);#compressed air temperature after cooling in K\n", - "p2=5.5*10**5;#pressure after compression in pa\n", - "m=0.8;#air flow rate in kg/s\n", - "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", - "y=1.4;#expansion constant\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"for process 1-2\")\n", - "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", - "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"for process 3-4\")\n", - "print(\"(p3/p4)^((y-1)/y)=T3/T4\")\n", - "print(\"so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\")\n", - "T4=T3/(p2/p1)**((y-1)/y)\n", - "Q=m*Cp*(T1-T4)\n", - "print(\"refrigeration capacity(Q) in KJ/s=\"),round(Q,2)\n", - "print(\"Q in ton\")\n", - "Q=Q/3.5\n", - "print(\"work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\")\n", - "print(\"w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\")\n", - "n=y;\n", - "w=(m*n)*R*(T2-T1)/(n-1)\n", - "print(\"HP required to run compressor\"),round(w/0.7457,2)\n", - "print(\"so HP required to run compressor=177.86 hp\")\n", - "print(\"net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\")\n", - "W=m*Cp*((T2-T3)-(T1-T4))\n", - "Q=63.25;#refrigeration capacity in KJ/s\n", - "COP=Q/W\n", - "print(\"COP=refrigeration capacity/work=Q/W\"),round(COP,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.7;pg no: 440" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.7, Page:440 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\n", - "for process 1-2,n=1.45\n", - "T2/T1=(p2/p1)^((n-1)/n)\n", - "so T2=T1*(p2/p1)^((n-1)/n) in K\n", - "for process 3-4,n=1.3\n", - "T4/T3=(p4/p3)^((n-1)/n)\n", - "so T4=T3*(p4/p3)^((n-1)/n)in K\n", - "refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\n", - "Q=m*Cp*(T5-T4)\n", - "m in kg/s= 0.55\n", - "so air mass flow rate in cabin=0.55 kg/s\n", - "let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\n", - "m1*Cp*(T8-T7)=m*Cp*(T2-T3)\n", - "during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\n", - "so T7=T6*(p7/p6)^((n-1)/n) in K\n", - "substituting T2,T3,T7,T8 and m in energy balance on intercooler,\n", - "m1=m*(T2-T3)/(T8-T7)in kg/s\n", - "total ram air mass flow rate=m+m1 in kg/s 2.11\n", - "ram air mass flow rate=2.12 kg/s\n", - "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\n", - "COP=refrigeration effect/work input=Q/W 0.485\n" - ] - } - ], - "source": [ - "#cal of air mass flow rate in cabin,ram air mass flow rate,COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.7, Page:440 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\")\n", - "p1=1.2*10**5;#pressure of ram air in pa\n", - "p6=p1;\n", - "T1=(15.+273.);#temperature of ram air in K\n", - "T6=T1;\n", - "p7=0.9*10**5;#pressure of ram air after expansion in pa\n", - "p3=4.*10**5;#pressure of ram air after compression in pa\n", - "p2=p3;\n", - "p4=1.*10**5;#pressure of ram air after expansion in second turbine in pa\n", - "T5=(25.+273.);#temperature of air when exhausted from cabin in K\n", - "T3=(50.+273.);#temperature of compressed air in K\n", - "T8=(30.+273.);#limited temperaure of ram air in K\n", - "Q=10.*3.5;#refrigeration capacity in KJ/s\n", - "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", - "print(\"for process 1-2,n=1.45\")\n", - "n=1.45;\n", - "print(\"T2/T1=(p2/p1)^((n-1)/n)\")\n", - "print(\"so T2=T1*(p2/p1)^((n-1)/n) in K\")\n", - "T2=T1*(p2/p1)**((n-1)/n)\n", - "print(\"for process 3-4,n=1.3\")\n", - "n=1.3;\n", - "print(\"T4/T3=(p4/p3)^((n-1)/n)\")\n", - "print(\"so T4=T3*(p4/p3)^((n-1)/n)in K\")\n", - "T4=T3*(p4/p3)**((n-1)/n)\n", - "print(\"refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\")\n", - "print(\"Q=m*Cp*(T5-T4)\")\n", - "m=Q/(Cp*(T5-T4))\n", - "print(\"m in kg/s=\"),round(m,2)\n", - "print(\"so air mass flow rate in cabin=0.55 kg/s\")\n", - "print(\"let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\")\n", - "print(\"m1*Cp*(T8-T7)=m*Cp*(T2-T3)\")\n", - "print(\"during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\")\n", - "print(\"so T7=T6*(p7/p6)^((n-1)/n) in K\")\n", - "T7=T6*(p7/p6)**((n-1)/n)\n", - "print(\"substituting T2,T3,T7,T8 and m in energy balance on intercooler,\")\n", - "print(\"m1=m*(T2-T3)/(T8-T7)in kg/s\")\n", - "m1=m*(T2-T3)/(T8-T7)\n", - "print(\"total ram air mass flow rate=m+m1 in kg/s\"),round(m+m1,2)\n", - "print(\"ram air mass flow rate=2.12 kg/s\")\n", - "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\")\n", - "m=0.55;#approx.\n", - "W=m*Cp*(T2-T1)\n", - "COP=Q/W\n", - "print(\"COP=refrigeration effect/work input=Q/W\"),round(Q/W,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.8;pg no: 441" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.8, Page:441 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\n", - "considering index of compression and expansion as 1.4\n", - "during ramming action,process 0-1,\n", - "T1/To=(p1/po)^((y-1)/y)\n", - "T1=To*(p1/po)^((y-1)/y)in K\n", - "during compression process 1-2_a\n", - "T2_a/T1=(p2/p1)^((y-1)/y)\n", - "T2_a=T1*(p2/p1)^((y-1)/y)in K\n", - "n1=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+(T2_a-T1)/n1 in K\n", - "In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\n", - "subsequently for 10 degree celcius temperature drop in evaporator,\n", - "T4=T3-10 in K\n", - "expansion in cooling turbine during process 4-5;\n", - "T5_a/T4=(p5/p4)^((y-1)/y)\n", - "T5_a=T4*(p5/p4)^((y-1)/y)in K\n", - "n2=(T4-T5)/(T4-T5_a)\n", - "T5=T4-(T4-T5_a)*n2 in K\n", - "let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\n", - "Q=m*Cp*(T6-T5)\n", - "so m=Q/(Cp*(T6-T5))in kg/s\n", - "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s 41.4\n", - "W in Hp\n", - "COP=refrigeration effect/work input=Q/W= 1.27\n", - "so COP=1.27\n", - "and HP required=55.48 hp\n" - ] - } - ], - "source": [ - "#cal of COP and HP required\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.8, Page:441 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\")\n", - "po=0.9*10**5;#atmospheric air pressure in pa\n", - "To=(3.+273.);#temperature of atmospheric air in K\n", - "p1=1.*10**5;#pressure due to ramming air in pa\n", - "p2=4.*10**5;#pressure when air leaves compressor in pa\n", - "p3=p2;\n", - "p4=p3;\n", - "p5=1.03*10**5;#pressure maintained in passenger cabin in pa\n", - "T6=(25.+273.);#temperature of air leaves cabin in K\n", - "Q=15.*3.5;#refrigeration capacity of aeroplane in KJ/s\n", - "n1=0.9;#isentropic efficiency of compressor\n", - "n2=0.8;#isentropic efficiency of turbine\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"considering index of compression and expansion as 1.4\")\n", - "y=1.4;\n", - "print(\"during ramming action,process 0-1,\")\n", - "print(\"T1/To=(p1/po)^((y-1)/y)\")\n", - "print(\"T1=To*(p1/po)^((y-1)/y)in K\")\n", - "T1=To*(p1/po)**((y-1)/y)\n", - "print(\"during compression process 1-2_a\")\n", - "print(\"T2_a/T1=(p2/p1)^((y-1)/y)\")\n", - "print(\"T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", - "T2_a=T1*(p2/p1)**((y-1)/y)\n", - "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", - "T2=T1+(T2_a-T1)/n1\n", - "print(\"In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\")\n", - "T3=0.34*T2\n", - "print(\"subsequently for 10 degree celcius temperature drop in evaporator,\")\n", - "print(\"T4=T3-10 in K\")\n", - "T4=T3-10\n", - "print(\"expansion in cooling turbine during process 4-5;\")\n", - "print(\"T5_a/T4=(p5/p4)^((y-1)/y)\")\n", - "print(\"T5_a=T4*(p5/p4)^((y-1)/y)in K\")\n", - "T5_a=T4*(p5/p4)**((y-1)/y)\n", - "print(\"n2=(T4-T5)/(T4-T5_a)\")\n", - "print(\"T5=T4-(T4-T5_a)*n2 in K\")\n", - "T5=T4-(T4-T5_a)*n2\n", - "print(\"let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\")\n", - "print(\"Q=m*Cp*(T6-T5)\")\n", - "print(\"so m=Q/(Cp*(T6-T5))in kg/s\")\n", - "m=Q/(Cp*(T6-T5))\n", - "W=m*Cp*(T2-T1)\n", - "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\"),round(W,2)\n", - "print(\"W in Hp\")\n", - "W=W/.7457\n", - "W=41.37;#work input to compressor in KJ/s\n", - "COP=Q/W\n", - "print(\"COP=refrigeration effect/work input=Q/W=\"),round(COP,2)\n", - "print(\"so COP=1.27\")\n", - "print(\"and HP required=55.48 hp\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.9;pg no: 443" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.9, Page:443 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\n", - "properties of NH3,\n", - "at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\n", - "and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\n", - "here work done,W=Area 1-2-3-9-1\n", - "refrigeration effect=Area 1-5-6-4-1\n", - "Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\n", - "so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\n", - "during throttling process between 3 and 4,h3=h4\n", - "(Area=3-11-7-3)=(Area 4-9-11-6-4)\n", - "(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\n", - "(Area 3-8-9)=(Area 4-6-7-8-4)\n", - "so (Area 4-6-7-8-4)=12.09 KJ/kg\n", - "also,(Area 4-6-7-8-4)=T1*(s4-s8)\n", - "so (s4-s8)in KJ/kg K=\n", - "also s3=s8=0.3386 KJ/kg K\n", - "so s4 in KJ/kg K=\n", - "also s1=s2=4.4809 KJ/kg K\n", - "refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\n", - "work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\n", - "so COP=refrigeration effect/work done= 5.94\n", - "so COP=5.94\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.9, Page:443 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\")\n", - "print(\"properties of NH3,\")\n", - "print(\"at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\")\n", - "T1=(-15+273);\n", - "h9=-54.51;\n", - "hg=1303.74;\n", - "s9=-0.2132;\n", - "sg=5.0536;\n", - "print(\"and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\")\n", - "T2=(25+273);\n", - "h3=99.94;\n", - "h2=1317.95;\n", - "s3=0.3386;\n", - "s2=4.4809;\n", - "print(\"here work done,W=Area 1-2-3-9-1\")\n", - "print(\"refrigeration effect=Area 1-5-6-4-1\")\n", - "print(\"Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\")\n", - "print(\"so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\")\n", - "h3-h9-T1*(s3-s9)\n", - "print(\"during throttling process between 3 and 4,h3=h4\")\n", - "print(\"(Area=3-11-7-3)=(Area 4-9-11-6-4)\")\n", - "print(\"(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\")\n", - "print(\"(Area 3-8-9)=(Area 4-6-7-8-4)\")\n", - "print(\"so (Area 4-6-7-8-4)=12.09 KJ/kg\")\n", - "print(\"also,(Area 4-6-7-8-4)=T1*(s4-s8)\")\n", - "print(\"so (s4-s8)in KJ/kg K=\")\n", - "12.09/T1\n", - "print(\"also s3=s8=0.3386 KJ/kg K\")\n", - "s8=s3;\n", - "print(\"so s4 in KJ/kg K=\")\n", - "s4=s8+12.09/T1\n", - "print(\"also s1=s2=4.4809 KJ/kg K\")\n", - "s1=s2;\n", - "print(\"refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\")\n", - "Q=T1*(s1-s4)\n", - "print(\"work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\")\n", - "W=12.09+((T2-T1)*(s1-s8))\n", - "COP=Q/W\n", - "print(\"so COP=refrigeration effect/work done=\"),round(COP,2)\n", - "print(\"so COP=5.94\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.10;pg no: 445" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.10, Page:445 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\n", - "properties of Freon-12,\n", - "at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\n", - "at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\n", - "during expansion(throttling)between 3 and 4\n", - "h3=h4=hf_40oc=74.53 KJ/kg=h4\n", - "process 1-2 is adiabatic compression so,\n", - "s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\n", - "at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\n", - "T2=313*exp((s1-sg)/Cpg)in K\n", - "so temperature after compression,T2=324.17 K\n", - "enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\n", - "compression work required,per kg(Wc)=h2-h1 in KJ/kg\n", - "refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\n", - "mass flow rate of refrigerant,m=Q/q in kg/s\n", - "COP=q/Wc 3.17452\n", - "volumetric efficiency of reciprocating compressor,given C=0.02\n", - "n_vol=1+C-C*(P2/P1)^(1/n)\n", - "let piston printlacement by V,m^3\n", - "mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\n", - "so V in cm^3= 569.43\n", - "so COP=3.175\n", - "and piston printlacement=569.45 cm^3\n" - ] - } - ], - "source": [ - "#cal of COP and piston printlacement\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.10, Page:445 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\")\n", - "Q=2.86*3.5;#refrigeration effect in KJ/s\n", - "N=1200;#compressor rpm\n", - "n=1.13;#compression index\n", - "print(\"properties of Freon-12,\")\n", - "print(\"at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\")\n", - "P1=1.51;\n", - "T1=(-20+273);\n", - "vg=0.1088;\n", - "h1=178.61;\n", - "s1=0.7082;\n", - "s2=s1;\n", - "print(\"at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\")\n", - "P2=9.61;\n", - "h3=74.53;\n", - "h4=h3;\n", - "hg=203.05;\n", - "sf=0.2716;\n", - "sg=0.682;\n", - "Cpf=0.976;\n", - "Cpg=0.747;\n", - "print(\"during expansion(throttling)between 3 and 4\")\n", - "print(\"h3=h4=hf_40oc=74.53 KJ/kg=h4\")\n", - "print(\"process 1-2 is adiabatic compression so,\")\n", - "print(\"s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\")\n", - "print(\"at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\")\n", - "print(\"T2=313*exp((s1-sg)/Cpg)in K\")\n", - "T2=313*math.exp((s1-sg)/Cpg)\n", - "print(\"so temperature after compression,T2=324.17 K\")\n", - "print(\"enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\")\n", - "h2=hg+Cpg*(T2-313)\n", - "print(\"compression work required,per kg(Wc)=h2-h1 in KJ/kg\")\n", - "Wc=h2-h1\n", - "print(\"refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\")\n", - "q=h1-h4\n", - "print(\"mass flow rate of refrigerant,m=Q/q in kg/s\")\n", - "m=Q/q\n", - "m=0.096;#approx.\n", - "COP=q/Wc\n", - "print(\"COP=q/Wc\"),round(COP,5)\n", - "print(\"volumetric efficiency of reciprocating compressor,given C=0.02\")\n", - "C=0.02;\n", - "print(\"n_vol=1+C-C*(P2/P1)^(1/n)\")\n", - "n_vol=1+C-C*(P2/P1)**(1/n)\n", - "print(\"let piston printlacement by V,m^3\")\n", - "print(\"mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\")\n", - "V=(m*60*vg)*10**6/(N*n_vol)\n", - "print(\"so V in cm^3=\"),round(V,2)\n", - "print(\"so COP=3.175\")\n", - "print(\"and piston printlacement=569.45 cm^3\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.11;pg no: 447" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.11, Page:447 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\n", - "properties of CO2,\n", - "at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\n", - "at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\n", - "processes of vapour compression cycle are shown on T-s diagram\n", - "1-2:isentropic compression process\n", - "2-3-4:condensation process\n", - "4-5:isenthalpic expansion process\n", - "5-1:refrigeration process in evaporator\n", - "h1=hg at -10oc=322.28 KJ/kg\n", - "at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\n", - "entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\n", - "entropy during isentropic process,s1=s2\n", - "at -10 degree celcius,s2=sf+x1*sfg\n", - "so x1=(s2-sf)/(sg-sf)\n", - "enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\n", - "h3=hf at 20oc=144.11 KJ/kg\n", - "since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\n", - "also,h4=h5=115.22 KJ/kg\n", - "refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\n", - "let refrigerant flow rate be m kg/s\n", - "refrigerant effect(Q)=m*q\n", - "m=Q/q in kg/s 0.01016\n", - "compressor work,Wc=h2-h1 in KJ/kg\n", - "COP=refrigeration effect per kg/compressor work per kg= 6.51\n", - "so COP=6.51,mass flow rate=0.01016 kg/s\n", - "NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \n" - ] - } - ], - "source": [ - "#cal of COP and mass flow rate\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.11, Page:447 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\")\n", - "Q=2;#refrigeration effect in KW\n", - "print(\"properties of CO2,\")\n", - "print(\"at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\")\n", - "T1=(20.+273.);#condensation temperature in K\n", - "P1=57.27;\n", - "h3=144.11;\n", - "hg=299.62;\n", - "sf=0.523;\n", - "sg_20oc=1.0527;\n", - "Cpf=2.889;\n", - "Cpg=2.135;\n", - "print(\"at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\")\n", - "T2=(-10+273);#evaporator temperature in K\n", - "P2=26.49;\n", - "vg=0.014;\n", - "hf=60.78;\n", - "h1=322.28;\n", - "sf=0.2381;\n", - "sg=1.2324;\n", - "print(\"processes of vapour compression cycle are shown on T-s diagram\")\n", - "print(\"1-2:isentropic compression process\")\n", - "print(\"2-3-4:condensation process\")\n", - "print(\"4-5:isenthalpic expansion process\")\n", - "print(\"5-1:refrigeration process in evaporator\")\n", - "print(\"h1=hg at -10oc=322.28 KJ/kg\")\n", - "print(\"at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\")\n", - "h2=hg+Cpg*(40.-20.)\n", - "print(\"entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\")\n", - "s2=sg_20oc+Cpg*math.log((273.+40.)/(273.+20.))\n", - "print(\"entropy during isentropic process,s1=s2\")\n", - "print(\"at -10 degree celcius,s2=sf+x1*sfg\")\n", - "print(\"so x1=(s2-sf)/(sg-sf)\")\n", - "x1=(s2-sf)/(sg-sf)\n", - "print(\"enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\")\n", - "h1=hf+x1*(h1-hf)\n", - "print(\"h3=hf at 20oc=144.11 KJ/kg\")\n", - "print(\"since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\")\n", - "h4=h3-Cpf*(20.-10.)\n", - "print(\"also,h4=h5=115.22 KJ/kg\")\n", - "h5=h4;\n", - "print(\"refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\")\n", - "q=(h1-h5)\n", - "print(\"let refrigerant flow rate be m kg/s\")\n", - "print(\"refrigerant effect(Q)=m*q\")\n", - "m=Q/q\n", - "print(\"m=Q/q in kg/s\"),round(m,5)\n", - "print(\"compressor work,Wc=h2-h1 in KJ/kg\")\n", - "Wc=h2-h1\n", - "COP=q/Wc\n", - "print(\"COP=refrigeration effect per kg/compressor work per kg=\"),round(COP,2)\n", - "print(\"so COP=6.51,mass flow rate=0.01016 kg/s\")\n", - "print(\"NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.12;pg no: 448" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.12, Page:448 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\n", - "here pressure of atmospheric air(P)may be taken as 1.013 bar\n", - "specific humidity,omega=0.622*(Pv/(P-Pv))\n", - "so partial pressure of vapour(Pv)in bar\n", - "Pv in bar= 0.0254\n", - "relative humidity(phi)=(Pv/Pv_sat)\n", - "from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\n", - "so phi=Pv/Pv_sat 0.82\n", - "in percentage 81.99\n", - "so partial pressure of vapour=0.0254 bar\n", - "relative humidity=81.98 %\n" - ] - } - ], - "source": [ - "#cal of partial pressure of vapour and relative humidity\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.12, Page:448 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\")\n", - "omega=0.016;#specific humidity in gm/gm of air\n", - "print(\"here pressure of atmospheric air(P)may be taken as 1.013 bar\")\n", - "P=1.013;#pressure of atmospheric air in bar\n", - "print(\"specific humidity,omega=0.622*(Pv/(P-Pv))\")\n", - "print(\"so partial pressure of vapour(Pv)in bar\")\n", - "Pv=P/(1+(0.622/omega))\n", - "print(\"Pv in bar=\"),round(Pv,4)\n", - "Pv=0.0254;#approx.\n", - "print(\"relative humidity(phi)=(Pv/Pv_sat)\")\n", - "print(\"from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\")\n", - "Pv_sat=0.03098;\n", - "phi=Pv/Pv_sat\n", - "print(\"so phi=Pv/Pv_sat\"),round(phi,2)\n", - "print(\"in percentage\"),round(phi*100,2)\n", - "print(\"so partial pressure of vapour=0.0254 bar\")\n", - "print(\"relative humidity=81.98 %\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.13;pg no: 449" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.13, Page:449 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\n", - "at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\n", - "partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar 0.03\n", - "partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour 0.99\n", - "so partial pressure of air=0.9875 bar\n", - "humidity ratio,omega in kg/kg of dry air= 0.01606\n", - "so humidity ratio=0.01606 kg/kg of air\n", - "Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\n", - "so Dew point temperature=21.4 degree celcius\n", - "density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\n", - "rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\n", - "rho_m in kg/m^3= 1.1836\n", - "so density = 1.1835 kg/m^3\n", - "enthalpy of mixture,h in KJ/kg of dry air= 71.21\n", - "enthalpy of mixture =71.2 KJ/kg of dry air\n" - ] - } - ], - "source": [ - "#cal of partial pressure,humidity ratio,Dew point temperature,density and enthalpy of mixture\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.13, Page:449 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\")\n", - "r=0.6;#relative humidity\n", - "P=1.013;#total pressure of mixture in bar\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Ta=(30+273);#room temperature in K\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg degree celcius\n", - "print(\"at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\")\n", - "Pv_sat=0.0425;\n", - "Pv=r*Pv_sat\n", - "print(\"partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar\"),round(Pv,2)\n", - "Pa=P-Pv\n", - "print(\"partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour\"),round(Pa,2)\n", - "print(\"so partial pressure of air=0.9875 bar\")\n", - "omega=0.622*Pv/(P-Pv)\n", - "print(\"humidity ratio,omega in kg/kg of dry air=\"),round(omega,5)\n", - "print(\"so humidity ratio=0.01606 kg/kg of air\")\n", - "print(\"Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\")\n", - "print(\"so Dew point temperature=21.4 degree celcius\")\n", - "print(\"density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\")\n", - "print(\"rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\")\n", - "rho_m=P*100*(1+omega)/(R*Ta)\n", - "print(\"rho_m in kg/m^3=\"),round(rho_m,4)\n", - "print(\"so density = 1.1835 kg/m^3\")\n", - "T=30;#room temperature in degree celcius\n", - "hg=2540.1;#enthalpy at 30 degree celcius in KJ/kg\n", - "h=Cp*T+omega*(hg+1.860*(30-21.4))\n", - "print(\"enthalpy of mixture,h in KJ/kg of dry air=\"),round(h,2)\n", - "print(\"enthalpy of mixture =71.2 KJ/kg of dry air\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.14;pg no: 449" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.14, Page:449 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\n", - "initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\n", - "omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\n", - "mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\n", - "mass flow rate of air(ma)=0.8/v2 in kg/s\n", - "total mass of water added=ma*(omega2-omega1)in kg/s 0.001311\n", - "heat transferred in KJ/s= 12.18\n", - "so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\n" - ] - } - ], - "source": [ - "#cal of mass of water added and heat transferred\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.14, Page:449 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\")\n", - "print(\"initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\")\n", - "print(\"omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\")\n", - "omega1=0.0086;\n", - "h1=37.;\n", - "omega2=0.01;\n", - "h2=50.;\n", - "v2=0.854;\n", - "print(\"mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\")\n", - "omega2-omega1\n", - "print(\"mass flow rate of air(ma)=0.8/v2 in kg/s\")\n", - "ma=0.8/v2\n", - "print(\"total mass of water added=ma*(omega2-omega1)in kg/s\"),round(ma*(omega2-omega1),6)\n", - "print(\"heat transferred in KJ/s=\"),round(ma*(h2-h1),2)\n", - "print(\"so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.15;pg no: 451" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.15, Page:451 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\n", - "Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\n", - "For moist air stream at 30 degree celcius and 30% relative humidity.\n", - "phi1=Pv1/Pv_sat_30oc\n", - "here Pv_sat_30oc=0.04246 bar\n", - "so Pv1=phi1*Pv_sat_30oc in bar\n", - "corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\n", - "specific humidity,omega1 in kg/kg of air= 0.00792\n", - "at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\n", - "h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\n", - "for second moist air stream at 35oc and 85% relative humidity\n", - "phi2=Pv2/Pv_sat_35oc\n", - "here Pv_sat_35oc=0.005628 bar\n", - "so Pv2=phi2*Pv_sat_35oc in bar\n", - "specific humidity,omega2 in kg/kg of air= 0.00295\n", - "corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\n", - "so,enthalpy of second stream,\n", - "h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\n", - "enthalpy of mixture after adiabatic mixing,\n", - "=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\n", - "mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\n", - "specific humidity of mixture(omega)in kg/kg of dry air= 0.00592\n", - "omega=0.622*Pv/(P-Pv)\n", - "Pv in bar= 0.00956\n", - "partial pressure of water vapour=0.00957 bar\n", - "so specific humidity of mixture=0.00593 kg/kg dry air\n", - "and partial pressure of water vapour in mixture=0.00957 bar\n" - ] - } - ], - "source": [ - "#cal of specific humidity and partial pressure of water vapour in mixture\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.15, Page:451 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\")\n", - "P=1.013;#atmospheric pressure in bar\n", - "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", - "Cp_stream=1.86;#specific heat of stream at constant pressure in KJ/kg K\n", - "T1=30.;#temperature of first stream of moist air in K\n", - "m1=3.;#mass flow rate of first stream in kg/s \n", - "T2=35.;#temperature of second stream of moist air in K\n", - "m2=2.;#mass flow rate of second stream in kg/s \n", - "print(\"Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\")\n", - "print(\"For moist air stream at 30 degree celcius and 30% relative humidity.\")\n", - "phi1=0.3;\n", - "print(\"phi1=Pv1/Pv_sat_30oc\")\n", - "print(\"here Pv_sat_30oc=0.04246 bar\")\n", - "Pv_sat_30oc=0.04246;\n", - "print(\"so Pv1=phi1*Pv_sat_30oc in bar\")\n", - "Pv1=phi1*Pv_sat_30oc\n", - "print(\"corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\")\n", - "Tdp1=10.5;\n", - "omega1=0.622*Pv1/(P-Pv1)\n", - "print(\"specific humidity,omega1 in kg/kg of air=\"),round(omega1,5)\n", - "print(\"at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\")\n", - "hg=2520.7;#enthalpy at 10.5 degree celcius in KJ/kg\n", - "print(\"h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\")\n", - "h1=Cp_air*T1+omega1*(hg-Cp_stream*(T1-Tdp1))\n", - "print(\"for second moist air stream at 35oc and 85% relative humidity\")\n", - "phi2=0.85;\n", - "print(\"phi2=Pv2/Pv_sat_35oc\")\n", - "print(\"here Pv_sat_35oc=0.005628 bar\")\n", - "Pv_sat_35oc=0.005628;\n", - "print(\"so Pv2=phi2*Pv_sat_35oc in bar\")\n", - "Pv2=phi2*Pv_sat_35oc\n", - "omega2=0.622*Pv2/(P-Pv2)\n", - "print(\"specific humidity,omega2 in kg/kg of air=\"),round(omega2,5)\n", - "print(\"corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\")\n", - "Tdp2=32.;\n", - "print(\"so,enthalpy of second stream,\")\n", - "print(\"h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\")\n", - "hg=2559.9;#enthalpy at 32 degree celcius in KJ/kg\n", - "h2=Cp_air*T2+omega2*(hg+Cp_stream*(T2-Tdp2))\n", - "print(\"enthalpy of mixture after adiabatic mixing,\")\n", - "print(\"=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\")\n", - "(1./(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2)))\n", - "print(\"mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\")\n", - "(1./5.)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))\n", - "omega=0.00589/(1-0.005893)\n", - "print(\"specific humidity of mixture(omega)in kg/kg of dry air=\"),round(omega,5)\n", - "print(\"omega=0.622*Pv/(P-Pv)\")\n", - "Pv=omega*P/(omega+0.622)\n", - "print(\"Pv in bar=\"),round(Pv,5)\n", - "print(\"partial pressure of water vapour=0.00957 bar\")\n", - "print(\"so specific humidity of mixture=0.00593 kg/kg dry air\")\n", - "print(\"and partial pressure of water vapour in mixture=0.00957 bar\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.16;pg no: 452" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.16, Page:452 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\n", - "The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\n", - "h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\n", - "final state 2 has,h2=52 KJ/kg\n", - "mass of air(m)=m1/v1 in kg/s\n", - "amount of heat added(Q)in KJ/s\n", - "Q=m*(h2-h1) 56.78\n" - ] - } - ], - "source": [ - "#cal of amount of heat added\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.16, Page:452 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\")\n", - "m1=3;#rate at which moist air enter in heating coil in m^3/s\n", - "print(\"The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\")\n", - "print(\"h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\")\n", - "h1=36.4;\n", - "omega1=0.0086;\n", - "v1=0.825;\n", - "print(\"final state 2 has,h2=52 KJ/kg\")\n", - "h2=52;\n", - "print(\"mass of air(m)=m1/v1 in kg/s\")\n", - "m=m1/v1\n", - "m=3.64;#approx.\n", - "print(\"amount of heat added(Q)in KJ/s\")\n", - "Q=m*(h2-h1)\n", - "print(\"Q=m*(h2-h1)\"),round(Q,2)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter11_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter11_1.ipynb deleted file mode 100755 index 31f593f0..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter11_1.ipynb +++ /dev/null @@ -1,1309 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 11:Introduction to refrigeration and Air Conditioning" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.1;pg no: 435" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.1, Page:435 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\n", - "for refrigerator working on reversed carnot cycle.\n", - "Q1/T1=Q2/T2\n", - "so Q2=Q1*T2/T1 in KJ/min\n", - "and work input required,W in KJ/min\n", - "W=Q2-Q1 83.66\n" - ] - } - ], - "source": [ - "#cal of work input\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.1, Page:435 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\")\n", - "T1=(-16.+273.);#temperature of refrigerated space in K\n", - "T2=(27.+273.);#temperature of atmosphere in K\n", - "Q1=500.;#heat extracted from refrigerated space in KJ/min\n", - "print(\"for refrigerator working on reversed carnot cycle.\")\n", - "print(\"Q1/T1=Q2/T2\")\n", - "print(\"so Q2=Q1*T2/T1 in KJ/min\")\n", - "Q2=Q1*T2/T1\n", - "print(\"and work input required,W in KJ/min\")\n", - "W=Q2-Q1\n", - "print(\"W=Q2-Q1\"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.2;pg no: 435" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.2, Page:435 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\n", - "refrigeration capacity or heat extraction rate(Q)in KJ/s\n", - "let the ice formation rate be m kg/s\n", - "heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\n", - "ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice= 6.25\n", - "COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\n", - "also COP=Q/W\n", - "so W=Q/COP in KJ/s\n", - "HP required 643.62\n", - "NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\n" - ] - } - ], - "source": [ - "#cal of HP required\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.2, Page:435 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\")\n", - "Q=800.;#refrigeration capacity in tons\n", - "Q_latent=335.;#latent heat for ice formation from water in KJ/kg\n", - "T1=(-7.+273.);#temperature of reservoir 1 in K\n", - "T2=(27.+273.);#temperature of reservoir 2 in K\n", - "print(\"refrigeration capacity or heat extraction rate(Q)in KJ/s\")\n", - "Q=Q*3.5\n", - "print(\"let the ice formation rate be m kg/s\")\n", - "print(\"heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\")\n", - "Q1=4.18*(27-0)+Q_latent\n", - "m=Q/Q1\n", - "print(\"ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice=\"),round(Q/Q1,2)\n", - "print(\"COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\")\n", - "COP=T1/(T2-T1)\n", - "print(\"also COP=Q/W\")\n", - "print(\"so W=Q/COP in KJ/s\")\n", - "W=Q/COP\n", - "W=W/0.7457\n", - "print(\"HP required\"),round(W/0.7457,2)\n", - "print(\"NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.3;pg no: 436" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.3, Page:436 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\n", - "COP=T1/(T2-T1)=Q/W 1.56\n", - "equating,COP=T1/(T2-T1)\n", - "so temperature of surrounding(T2)in K\n", - "T2= 403.69\n" - ] - } - ], - "source": [ - "#cal of COP and temperature of surrounding\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.3, Page:436 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\")\n", - "T1=(-27+273);#temperature of refrigerator in K\n", - "W=3*.7457;#work input in KJ/s\n", - "Q=1*3.5;#refrigeration effect in KJ/s\n", - "COP=Q/W\n", - "print(\"COP=T1/(T2-T1)=Q/W\"),round(COP,2)\n", - "COP=1.56;#approx.\n", - "print(\"equating,COP=T1/(T2-T1)\")\n", - "print(\"so temperature of surrounding(T2)in K\")\n", - "T2=T1+(T1/COP)\n", - "print(\"T2=\"),round(T2,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.4;pg no: 436" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.4, Page:436 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\n", - "during process 1-2_a\n", - "p2/p1=(T2_a/T1)^(y/(y-1))\n", - "so T2_a=T1*(p2/p1)^((y-1)/y)in K\n", - "theoretical temperature after compression,T2_a=440.18 K\n", - "for compression process,\n", - "n1=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+(T2_a-T1)/n1 in K\n", - "for expansion process,3-4_a\n", - "T4_a/T3=(p1/p2)^((y-1)/y)\n", - "so T4_a=T3*(p1/p2)^((y-1)/y) in K\n", - "n2=0.9=(T3-T4)/(T3-T4_a)\n", - "so T4=T3-(n2*(T3-T4_a))in K\n", - "so work during compression,W_C in KJ/s\n", - "W_C=m*Cp*(T2-T1)\n", - "work during expansion,W_T in KJ/s\n", - "W_T=m*Cp*(T3-T4)\n", - "refrigeration effect is realized during process,4-1.so refrigeration shall be,\n", - "Q_ref=m*Cp*(T1-T4) in KJ/s\n", - "Q_ref in ton 18.36\n", - "net work required(W)=W_C-W_T in KJ/s 111.59\n", - "COP= 0.58\n", - "so refrigeration capacity=18.36 ton or 64.26 KJ/s\n", - "and COP=0.57\n", - "NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\n" - ] - } - ], - "source": [ - "#cal of refrigeration capacity and COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.4, Page:436 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\")\n", - "T1=(-30.+273.);#temperature of air at beginning of compression in K\n", - "T3=(27.+273.);#temperature of air after cooling in K\n", - "r=8.;#pressure ratio\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "y=1.4;#expansion constant \n", - "m=1.;#air flow rate in kg/s\n", - "n1=0.85;#isentropic efficiency for compression process\n", - "n2=.9;#isentropic efficiency for expansion process\n", - "print(\"during process 1-2_a\")\n", - "print(\"p2/p1=(T2_a/T1)^(y/(y-1))\")\n", - "print(\"so T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", - "T2_a=T1*(r)**((y-1)/y)\n", - "print(\"theoretical temperature after compression,T2_a=440.18 K\")\n", - "print(\"for compression process,\")\n", - "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", - "T2=T1+(T2_a-T1)/n1\n", - "print(\"for expansion process,3-4_a\")\n", - "print(\"T4_a/T3=(p1/p2)^((y-1)/y)\")\n", - "print(\"so T4_a=T3*(p1/p2)^((y-1)/y) in K\")\n", - "T4_a=T3*(1/r)**((y-1)/y)\n", - "print(\"n2=0.9=(T3-T4)/(T3-T4_a)\")\n", - "print(\"so T4=T3-(n2*(T3-T4_a))in K\")\n", - "T4=T3-(n2*(T3-T4_a))\n", - "print(\"so work during compression,W_C in KJ/s\")\n", - "print(\"W_C=m*Cp*(T2-T1)\")\n", - "W_C=m*Cp*(T2-T1)\n", - "print(\"work during expansion,W_T in KJ/s\")\n", - "print(\"W_T=m*Cp*(T3-T4)\")\n", - "W_T=m*Cp*(T3-T4)\n", - "print(\"refrigeration effect is realized during process,4-1.so refrigeration shall be,\")\n", - "print(\"Q_ref=m*Cp*(T1-T4) in KJ/s\")\n", - "Q_ref=m*Cp*(T1-T4)\n", - "Q_ref=Q_ref/3.5\n", - "print(\"Q_ref in ton\"),round(Q_ref,2)\n", - "W=W_C-W_T\n", - "print(\"net work required(W)=W_C-W_T in KJ/s\"),round(W,2)\n", - "Q_ref=64.26;\n", - "COP=Q_ref/(W_C-W_T)\n", - "print(\"COP=\"),round(COP,2)\n", - "print(\"so refrigeration capacity=18.36 ton or 64.26 KJ/s\")\n", - "print(\"and COP=0.57\")\n", - "print(\"NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.5;pg no: 437" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.5, Page:437 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\n", - "for isentropic compression process:\n", - "(p2/p1)^((y-1)/y)=T2/T1\n", - "so T2=T1*(p2/p1)^((y-1)/y) in K\n", - "for isenropic expansion process:\n", - "(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\n", - "so T4=T3/(p2/p1)^((y-1)/y) in K\n", - "heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\n", - "refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\n", - "so net work(W)=Q23-Q41 in KJ/kg\n", - "so COP=refrigeration effect/net work= 1.71\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.5, Page:437 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\")\n", - "T1=(7+273);#temperature of refrigerated space in K\n", - "T3=(27+273);#temperature after compression in K\n", - "p1=1*10**5;#pressure of refrigerated space in pa\n", - "p2=5*10**5;#pressure after compression in pa\n", - "y=1.4;#expansion constant\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"for isentropic compression process:\")\n", - "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", - "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"for isenropic expansion process:\")\n", - "print(\"(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\")\n", - "print(\"so T4=T3/(p2/p1)^((y-1)/y) in K\")\n", - "T4=T3/(p2/p1)**((y-1)/y)\n", - "print(\"heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\")\n", - "Q23=Cp*(T2-T3)\n", - "print(\"refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\")\n", - "Q41=Cp*(T1-T4)\n", - "print(\"so net work(W)=Q23-Q41 in KJ/kg\")\n", - "W=Q23-Q41\n", - "COP=Q41/W\n", - "print(\"so COP=refrigeration effect/net work=\"),round(COP,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.6;pg no: 438" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.6, Page:438 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\n", - "for process 1-2\n", - "(p2/p1)^((y-1)/y)=T2/T1\n", - "so T2=T1*(p2/p1)^((y-1)/y) in K\n", - "for process 3-4\n", - "(p3/p4)^((y-1)/y)=T3/T4\n", - "so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\n", - "refrigeration capacity(Q) in KJ/s= 63.25\n", - "Q in ton\n", - "work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\n", - "w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\n", - "HP required to run compressor 177.86\n", - "so HP required to run compressor=177.86 hp\n", - "net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\n", - "COP=refrigeration capacity/work=Q/W 1.59\n" - ] - } - ], - "source": [ - "#cal of refrigeration capacity,HP required to run compressor,COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.6, Page:438 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\")\n", - "T1=(-10.+273.);#air entering temperature in K\n", - "p1=1.*10**5;#air entering pressure in pa\n", - "T3=(27.+273.);#compressed air temperature after cooling in K\n", - "p2=5.5*10**5;#pressure after compression in pa\n", - "m=0.8;#air flow rate in kg/s\n", - "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", - "y=1.4;#expansion constant\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"for process 1-2\")\n", - "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", - "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"for process 3-4\")\n", - "print(\"(p3/p4)^((y-1)/y)=T3/T4\")\n", - "print(\"so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\")\n", - "T4=T3/(p2/p1)**((y-1)/y)\n", - "Q=m*Cp*(T1-T4)\n", - "print(\"refrigeration capacity(Q) in KJ/s=\"),round(Q,2)\n", - "print(\"Q in ton\")\n", - "Q=Q/3.5\n", - "print(\"work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\")\n", - "print(\"w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\")\n", - "n=y;\n", - "w=(m*n)*R*(T2-T1)/(n-1)\n", - "print(\"HP required to run compressor\"),round(w/0.7457,2)\n", - "print(\"so HP required to run compressor=177.86 hp\")\n", - "print(\"net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\")\n", - "W=m*Cp*((T2-T3)-(T1-T4))\n", - "Q=63.25;#refrigeration capacity in KJ/s\n", - "COP=Q/W\n", - "print(\"COP=refrigeration capacity/work=Q/W\"),round(COP,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.7;pg no: 440" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.7, Page:440 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\n", - "for process 1-2,n=1.45\n", - "T2/T1=(p2/p1)^((n-1)/n)\n", - "so T2=T1*(p2/p1)^((n-1)/n) in K\n", - "for process 3-4,n=1.3\n", - "T4/T3=(p4/p3)^((n-1)/n)\n", - "so T4=T3*(p4/p3)^((n-1)/n)in K\n", - "refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\n", - "Q=m*Cp*(T5-T4)\n", - "m in kg/s= 0.55\n", - "so air mass flow rate in cabin=0.55 kg/s\n", - "let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\n", - "m1*Cp*(T8-T7)=m*Cp*(T2-T3)\n", - "during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\n", - "so T7=T6*(p7/p6)^((n-1)/n) in K\n", - "substituting T2,T3,T7,T8 and m in energy balance on intercooler,\n", - "m1=m*(T2-T3)/(T8-T7)in kg/s\n", - "total ram air mass flow rate=m+m1 in kg/s 2.11\n", - "ram air mass flow rate=2.12 kg/s\n", - "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\n", - "COP=refrigeration effect/work input=Q/W 0.485\n" - ] - } - ], - "source": [ - "#cal of air mass flow rate in cabin,ram air mass flow rate,COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.7, Page:440 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\")\n", - "p1=1.2*10**5;#pressure of ram air in pa\n", - "p6=p1;\n", - "T1=(15.+273.);#temperature of ram air in K\n", - "T6=T1;\n", - "p7=0.9*10**5;#pressure of ram air after expansion in pa\n", - "p3=4.*10**5;#pressure of ram air after compression in pa\n", - "p2=p3;\n", - "p4=1.*10**5;#pressure of ram air after expansion in second turbine in pa\n", - "T5=(25.+273.);#temperature of air when exhausted from cabin in K\n", - "T3=(50.+273.);#temperature of compressed air in K\n", - "T8=(30.+273.);#limited temperaure of ram air in K\n", - "Q=10.*3.5;#refrigeration capacity in KJ/s\n", - "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", - "print(\"for process 1-2,n=1.45\")\n", - "n=1.45;\n", - "print(\"T2/T1=(p2/p1)^((n-1)/n)\")\n", - "print(\"so T2=T1*(p2/p1)^((n-1)/n) in K\")\n", - "T2=T1*(p2/p1)**((n-1)/n)\n", - "print(\"for process 3-4,n=1.3\")\n", - "n=1.3;\n", - "print(\"T4/T3=(p4/p3)^((n-1)/n)\")\n", - "print(\"so T4=T3*(p4/p3)^((n-1)/n)in K\")\n", - "T4=T3*(p4/p3)**((n-1)/n)\n", - "print(\"refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\")\n", - "print(\"Q=m*Cp*(T5-T4)\")\n", - "m=Q/(Cp*(T5-T4))\n", - "print(\"m in kg/s=\"),round(m,2)\n", - "print(\"so air mass flow rate in cabin=0.55 kg/s\")\n", - "print(\"let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\")\n", - "print(\"m1*Cp*(T8-T7)=m*Cp*(T2-T3)\")\n", - "print(\"during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\")\n", - "print(\"so T7=T6*(p7/p6)^((n-1)/n) in K\")\n", - "T7=T6*(p7/p6)**((n-1)/n)\n", - "print(\"substituting T2,T3,T7,T8 and m in energy balance on intercooler,\")\n", - "print(\"m1=m*(T2-T3)/(T8-T7)in kg/s\")\n", - "m1=m*(T2-T3)/(T8-T7)\n", - "print(\"total ram air mass flow rate=m+m1 in kg/s\"),round(m+m1,2)\n", - "print(\"ram air mass flow rate=2.12 kg/s\")\n", - "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\")\n", - "m=0.55;#approx.\n", - "W=m*Cp*(T2-T1)\n", - "COP=Q/W\n", - "print(\"COP=refrigeration effect/work input=Q/W\"),round(Q/W,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.8;pg no: 441" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.8, Page:441 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\n", - "considering index of compression and expansion as 1.4\n", - "during ramming action,process 0-1,\n", - "T1/To=(p1/po)^((y-1)/y)\n", - "T1=To*(p1/po)^((y-1)/y)in K\n", - "during compression process 1-2_a\n", - "T2_a/T1=(p2/p1)^((y-1)/y)\n", - "T2_a=T1*(p2/p1)^((y-1)/y)in K\n", - "n1=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+(T2_a-T1)/n1 in K\n", - "In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\n", - "subsequently for 10 degree celcius temperature drop in evaporator,\n", - "T4=T3-10 in K\n", - "expansion in cooling turbine during process 4-5;\n", - "T5_a/T4=(p5/p4)^((y-1)/y)\n", - "T5_a=T4*(p5/p4)^((y-1)/y)in K\n", - "n2=(T4-T5)/(T4-T5_a)\n", - "T5=T4-(T4-T5_a)*n2 in K\n", - "let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\n", - "Q=m*Cp*(T6-T5)\n", - "so m=Q/(Cp*(T6-T5))in kg/s\n", - "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s 41.4\n", - "W in Hp\n", - "COP=refrigeration effect/work input=Q/W= 1.27\n", - "so COP=1.27\n", - "and HP required=55.48 hp\n" - ] - } - ], - "source": [ - "#cal of COP and HP required\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.8, Page:441 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\")\n", - "po=0.9*10**5;#atmospheric air pressure in pa\n", - "To=(3.+273.);#temperature of atmospheric air in K\n", - "p1=1.*10**5;#pressure due to ramming air in pa\n", - "p2=4.*10**5;#pressure when air leaves compressor in pa\n", - "p3=p2;\n", - "p4=p3;\n", - "p5=1.03*10**5;#pressure maintained in passenger cabin in pa\n", - "T6=(25.+273.);#temperature of air leaves cabin in K\n", - "Q=15.*3.5;#refrigeration capacity of aeroplane in KJ/s\n", - "n1=0.9;#isentropic efficiency of compressor\n", - "n2=0.8;#isentropic efficiency of turbine\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"considering index of compression and expansion as 1.4\")\n", - "y=1.4;\n", - "print(\"during ramming action,process 0-1,\")\n", - "print(\"T1/To=(p1/po)^((y-1)/y)\")\n", - "print(\"T1=To*(p1/po)^((y-1)/y)in K\")\n", - "T1=To*(p1/po)**((y-1)/y)\n", - "print(\"during compression process 1-2_a\")\n", - "print(\"T2_a/T1=(p2/p1)^((y-1)/y)\")\n", - "print(\"T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", - "T2_a=T1*(p2/p1)**((y-1)/y)\n", - "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", - "T2=T1+(T2_a-T1)/n1\n", - "print(\"In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\")\n", - "T3=0.34*T2\n", - "print(\"subsequently for 10 degree celcius temperature drop in evaporator,\")\n", - "print(\"T4=T3-10 in K\")\n", - "T4=T3-10\n", - "print(\"expansion in cooling turbine during process 4-5;\")\n", - "print(\"T5_a/T4=(p5/p4)^((y-1)/y)\")\n", - "print(\"T5_a=T4*(p5/p4)^((y-1)/y)in K\")\n", - "T5_a=T4*(p5/p4)**((y-1)/y)\n", - "print(\"n2=(T4-T5)/(T4-T5_a)\")\n", - "print(\"T5=T4-(T4-T5_a)*n2 in K\")\n", - "T5=T4-(T4-T5_a)*n2\n", - "print(\"let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\")\n", - "print(\"Q=m*Cp*(T6-T5)\")\n", - "print(\"so m=Q/(Cp*(T6-T5))in kg/s\")\n", - "m=Q/(Cp*(T6-T5))\n", - "W=m*Cp*(T2-T1)\n", - "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\"),round(W,2)\n", - "print(\"W in Hp\")\n", - "W=W/.7457\n", - "W=41.37;#work input to compressor in KJ/s\n", - "COP=Q/W\n", - "print(\"COP=refrigeration effect/work input=Q/W=\"),round(COP,2)\n", - "print(\"so COP=1.27\")\n", - "print(\"and HP required=55.48 hp\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.9;pg no: 443" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.9, Page:443 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\n", - "properties of NH3,\n", - "at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\n", - "and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\n", - "here work done,W=Area 1-2-3-9-1\n", - "refrigeration effect=Area 1-5-6-4-1\n", - "Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\n", - "so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\n", - "during throttling process between 3 and 4,h3=h4\n", - "(Area=3-11-7-3)=(Area 4-9-11-6-4)\n", - "(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\n", - "(Area 3-8-9)=(Area 4-6-7-8-4)\n", - "so (Area 4-6-7-8-4)=12.09 KJ/kg\n", - "also,(Area 4-6-7-8-4)=T1*(s4-s8)\n", - "so (s4-s8)in KJ/kg K=\n", - "also s3=s8=0.3386 KJ/kg K\n", - "so s4 in KJ/kg K=\n", - "also s1=s2=4.4809 KJ/kg K\n", - "refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\n", - "work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\n", - "so COP=refrigeration effect/work done= 5.94\n", - "so COP=5.94\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.9, Page:443 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\")\n", - "print(\"properties of NH3,\")\n", - "print(\"at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\")\n", - "T1=(-15+273);\n", - "h9=-54.51;\n", - "hg=1303.74;\n", - "s9=-0.2132;\n", - "sg=5.0536;\n", - "print(\"and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\")\n", - "T2=(25+273);\n", - "h3=99.94;\n", - "h2=1317.95;\n", - "s3=0.3386;\n", - "s2=4.4809;\n", - "print(\"here work done,W=Area 1-2-3-9-1\")\n", - "print(\"refrigeration effect=Area 1-5-6-4-1\")\n", - "print(\"Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\")\n", - "print(\"so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\")\n", - "h3-h9-T1*(s3-s9)\n", - "print(\"during throttling process between 3 and 4,h3=h4\")\n", - "print(\"(Area=3-11-7-3)=(Area 4-9-11-6-4)\")\n", - "print(\"(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\")\n", - "print(\"(Area 3-8-9)=(Area 4-6-7-8-4)\")\n", - "print(\"so (Area 4-6-7-8-4)=12.09 KJ/kg\")\n", - "print(\"also,(Area 4-6-7-8-4)=T1*(s4-s8)\")\n", - "print(\"so (s4-s8)in KJ/kg K=\")\n", - "12.09/T1\n", - "print(\"also s3=s8=0.3386 KJ/kg K\")\n", - "s8=s3;\n", - "print(\"so s4 in KJ/kg K=\")\n", - "s4=s8+12.09/T1\n", - "print(\"also s1=s2=4.4809 KJ/kg K\")\n", - "s1=s2;\n", - "print(\"refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\")\n", - "Q=T1*(s1-s4)\n", - "print(\"work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\")\n", - "W=12.09+((T2-T1)*(s1-s8))\n", - "COP=Q/W\n", - "print(\"so COP=refrigeration effect/work done=\"),round(COP,2)\n", - "print(\"so COP=5.94\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.10;pg no: 445" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.10, Page:445 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\n", - "properties of Freon-12,\n", - "at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\n", - "at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\n", - "during expansion(throttling)between 3 and 4\n", - "h3=h4=hf_40oc=74.53 KJ/kg=h4\n", - "process 1-2 is adiabatic compression so,\n", - "s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\n", - "at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\n", - "T2=313*exp((s1-sg)/Cpg)in K\n", - "so temperature after compression,T2=324.17 K\n", - "enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\n", - "compression work required,per kg(Wc)=h2-h1 in KJ/kg\n", - "refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\n", - "mass flow rate of refrigerant,m=Q/q in kg/s\n", - "COP=q/Wc 3.17452\n", - "volumetric efficiency of reciprocating compressor,given C=0.02\n", - "n_vol=1+C-C*(P2/P1)^(1/n)\n", - "let piston printlacement by V,m^3\n", - "mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\n", - "so V in cm^3= 569.43\n", - "so COP=3.175\n", - "and piston printlacement=569.45 cm^3\n" - ] - } - ], - "source": [ - "#cal of COP and piston printlacement\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.10, Page:445 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\")\n", - "Q=2.86*3.5;#refrigeration effect in KJ/s\n", - "N=1200;#compressor rpm\n", - "n=1.13;#compression index\n", - "print(\"properties of Freon-12,\")\n", - "print(\"at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\")\n", - "P1=1.51;\n", - "T1=(-20+273);\n", - "vg=0.1088;\n", - "h1=178.61;\n", - "s1=0.7082;\n", - "s2=s1;\n", - "print(\"at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\")\n", - "P2=9.61;\n", - "h3=74.53;\n", - "h4=h3;\n", - "hg=203.05;\n", - "sf=0.2716;\n", - "sg=0.682;\n", - "Cpf=0.976;\n", - "Cpg=0.747;\n", - "print(\"during expansion(throttling)between 3 and 4\")\n", - "print(\"h3=h4=hf_40oc=74.53 KJ/kg=h4\")\n", - "print(\"process 1-2 is adiabatic compression so,\")\n", - "print(\"s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\")\n", - "print(\"at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\")\n", - "print(\"T2=313*exp((s1-sg)/Cpg)in K\")\n", - "T2=313*math.exp((s1-sg)/Cpg)\n", - "print(\"so temperature after compression,T2=324.17 K\")\n", - "print(\"enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\")\n", - "h2=hg+Cpg*(T2-313)\n", - "print(\"compression work required,per kg(Wc)=h2-h1 in KJ/kg\")\n", - "Wc=h2-h1\n", - "print(\"refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\")\n", - "q=h1-h4\n", - "print(\"mass flow rate of refrigerant,m=Q/q in kg/s\")\n", - "m=Q/q\n", - "m=0.096;#approx.\n", - "COP=q/Wc\n", - "print(\"COP=q/Wc\"),round(COP,5)\n", - "print(\"volumetric efficiency of reciprocating compressor,given C=0.02\")\n", - "C=0.02;\n", - "print(\"n_vol=1+C-C*(P2/P1)^(1/n)\")\n", - "n_vol=1+C-C*(P2/P1)**(1/n)\n", - "print(\"let piston printlacement by V,m^3\")\n", - "print(\"mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\")\n", - "V=(m*60*vg)*10**6/(N*n_vol)\n", - "print(\"so V in cm^3=\"),round(V,2)\n", - "print(\"so COP=3.175\")\n", - "print(\"and piston printlacement=569.45 cm^3\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.11;pg no: 447" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.11, Page:447 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\n", - "properties of CO2,\n", - "at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\n", - "at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\n", - "processes of vapour compression cycle are shown on T-s diagram\n", - "1-2:isentropic compression process\n", - "2-3-4:condensation process\n", - "4-5:isenthalpic expansion process\n", - "5-1:refrigeration process in evaporator\n", - "h1=hg at -10oc=322.28 KJ/kg\n", - "at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\n", - "entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\n", - "entropy during isentropic process,s1=s2\n", - "at -10 degree celcius,s2=sf+x1*sfg\n", - "so x1=(s2-sf)/(sg-sf)\n", - "enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\n", - "h3=hf at 20oc=144.11 KJ/kg\n", - "since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\n", - "also,h4=h5=115.22 KJ/kg\n", - "refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\n", - "let refrigerant flow rate be m kg/s\n", - "refrigerant effect(Q)=m*q\n", - "m=Q/q in kg/s 0.01016\n", - "compressor work,Wc=h2-h1 in KJ/kg\n", - "COP=refrigeration effect per kg/compressor work per kg= 6.51\n", - "so COP=6.51,mass flow rate=0.01016 kg/s\n", - "NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \n" - ] - } - ], - "source": [ - "#cal of COP and mass flow rate\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.11, Page:447 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\")\n", - "Q=2;#refrigeration effect in KW\n", - "print(\"properties of CO2,\")\n", - "print(\"at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\")\n", - "T1=(20.+273.);#condensation temperature in K\n", - "P1=57.27;\n", - "h3=144.11;\n", - "hg=299.62;\n", - "sf=0.523;\n", - "sg_20oc=1.0527;\n", - "Cpf=2.889;\n", - "Cpg=2.135;\n", - "print(\"at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\")\n", - "T2=(-10+273);#evaporator temperature in K\n", - "P2=26.49;\n", - "vg=0.014;\n", - "hf=60.78;\n", - "h1=322.28;\n", - "sf=0.2381;\n", - "sg=1.2324;\n", - "print(\"processes of vapour compression cycle are shown on T-s diagram\")\n", - "print(\"1-2:isentropic compression process\")\n", - "print(\"2-3-4:condensation process\")\n", - "print(\"4-5:isenthalpic expansion process\")\n", - "print(\"5-1:refrigeration process in evaporator\")\n", - "print(\"h1=hg at -10oc=322.28 KJ/kg\")\n", - "print(\"at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\")\n", - "h2=hg+Cpg*(40.-20.)\n", - "print(\"entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\")\n", - "s2=sg_20oc+Cpg*math.log((273.+40.)/(273.+20.))\n", - "print(\"entropy during isentropic process,s1=s2\")\n", - "print(\"at -10 degree celcius,s2=sf+x1*sfg\")\n", - "print(\"so x1=(s2-sf)/(sg-sf)\")\n", - "x1=(s2-sf)/(sg-sf)\n", - "print(\"enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\")\n", - "h1=hf+x1*(h1-hf)\n", - "print(\"h3=hf at 20oc=144.11 KJ/kg\")\n", - "print(\"since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\")\n", - "h4=h3-Cpf*(20.-10.)\n", - "print(\"also,h4=h5=115.22 KJ/kg\")\n", - "h5=h4;\n", - "print(\"refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\")\n", - "q=(h1-h5)\n", - "print(\"let refrigerant flow rate be m kg/s\")\n", - "print(\"refrigerant effect(Q)=m*q\")\n", - "m=Q/q\n", - "print(\"m=Q/q in kg/s\"),round(m,5)\n", - "print(\"compressor work,Wc=h2-h1 in KJ/kg\")\n", - "Wc=h2-h1\n", - "COP=q/Wc\n", - "print(\"COP=refrigeration effect per kg/compressor work per kg=\"),round(COP,2)\n", - "print(\"so COP=6.51,mass flow rate=0.01016 kg/s\")\n", - "print(\"NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.12;pg no: 448" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.12, Page:448 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\n", - "here pressure of atmospheric air(P)may be taken as 1.013 bar\n", - "specific humidity,omega=0.622*(Pv/(P-Pv))\n", - "so partial pressure of vapour(Pv)in bar\n", - "Pv in bar= 0.0254\n", - "relative humidity(phi)=(Pv/Pv_sat)\n", - "from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\n", - "so phi=Pv/Pv_sat 0.82\n", - "in percentage 81.99\n", - "so partial pressure of vapour=0.0254 bar\n", - "relative humidity=81.98 %\n" - ] - } - ], - "source": [ - "#cal of partial pressure of vapour and relative humidity\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.12, Page:448 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\")\n", - "omega=0.016;#specific humidity in gm/gm of air\n", - "print(\"here pressure of atmospheric air(P)may be taken as 1.013 bar\")\n", - "P=1.013;#pressure of atmospheric air in bar\n", - "print(\"specific humidity,omega=0.622*(Pv/(P-Pv))\")\n", - "print(\"so partial pressure of vapour(Pv)in bar\")\n", - "Pv=P/(1+(0.622/omega))\n", - "print(\"Pv in bar=\"),round(Pv,4)\n", - "Pv=0.0254;#approx.\n", - "print(\"relative humidity(phi)=(Pv/Pv_sat)\")\n", - "print(\"from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\")\n", - "Pv_sat=0.03098;\n", - "phi=Pv/Pv_sat\n", - "print(\"so phi=Pv/Pv_sat\"),round(phi,2)\n", - "print(\"in percentage\"),round(phi*100,2)\n", - "print(\"so partial pressure of vapour=0.0254 bar\")\n", - "print(\"relative humidity=81.98 %\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.13;pg no: 449" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.13, Page:449 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\n", - "at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\n", - "partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar 0.03\n", - "partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour 0.99\n", - "so partial pressure of air=0.9875 bar\n", - "humidity ratio,omega in kg/kg of dry air= 0.01606\n", - "so humidity ratio=0.01606 kg/kg of air\n", - "Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\n", - "so Dew point temperature=21.4 degree celcius\n", - "density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\n", - "rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\n", - "rho_m in kg/m^3= 1.1836\n", - "so density = 1.1835 kg/m^3\n", - "enthalpy of mixture,h in KJ/kg of dry air= 71.21\n", - "enthalpy of mixture =71.2 KJ/kg of dry air\n" - ] - } - ], - "source": [ - "#cal of partial pressure,humidity ratio,Dew point temperature,density and enthalpy of mixture\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.13, Page:449 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\")\n", - "r=0.6;#relative humidity\n", - "P=1.013;#total pressure of mixture in bar\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Ta=(30+273);#room temperature in K\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg degree celcius\n", - "print(\"at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\")\n", - "Pv_sat=0.0425;\n", - "Pv=r*Pv_sat\n", - "print(\"partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar\"),round(Pv,2)\n", - "Pa=P-Pv\n", - "print(\"partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour\"),round(Pa,2)\n", - "print(\"so partial pressure of air=0.9875 bar\")\n", - "omega=0.622*Pv/(P-Pv)\n", - "print(\"humidity ratio,omega in kg/kg of dry air=\"),round(omega,5)\n", - "print(\"so humidity ratio=0.01606 kg/kg of air\")\n", - "print(\"Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\")\n", - "print(\"so Dew point temperature=21.4 degree celcius\")\n", - "print(\"density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\")\n", - "print(\"rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\")\n", - "rho_m=P*100*(1+omega)/(R*Ta)\n", - "print(\"rho_m in kg/m^3=\"),round(rho_m,4)\n", - "print(\"so density = 1.1835 kg/m^3\")\n", - "T=30;#room temperature in degree celcius\n", - "hg=2540.1;#enthalpy at 30 degree celcius in KJ/kg\n", - "h=Cp*T+omega*(hg+1.860*(30-21.4))\n", - "print(\"enthalpy of mixture,h in KJ/kg of dry air=\"),round(h,2)\n", - "print(\"enthalpy of mixture =71.2 KJ/kg of dry air\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.14;pg no: 449" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.14, Page:449 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\n", - "initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\n", - "omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\n", - "mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\n", - "mass flow rate of air(ma)=0.8/v2 in kg/s\n", - "total mass of water added=ma*(omega2-omega1)in kg/s 0.001311\n", - "heat transferred in KJ/s= 12.18\n", - "so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\n" - ] - } - ], - "source": [ - "#cal of mass of water added and heat transferred\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.14, Page:449 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\")\n", - "print(\"initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\")\n", - "print(\"omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\")\n", - "omega1=0.0086;\n", - "h1=37.;\n", - "omega2=0.01;\n", - "h2=50.;\n", - "v2=0.854;\n", - "print(\"mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\")\n", - "omega2-omega1\n", - "print(\"mass flow rate of air(ma)=0.8/v2 in kg/s\")\n", - "ma=0.8/v2\n", - "print(\"total mass of water added=ma*(omega2-omega1)in kg/s\"),round(ma*(omega2-omega1),6)\n", - "print(\"heat transferred in KJ/s=\"),round(ma*(h2-h1),2)\n", - "print(\"so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.15;pg no: 451" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.15, Page:451 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\n", - "Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\n", - "For moist air stream at 30 degree celcius and 30% relative humidity.\n", - "phi1=Pv1/Pv_sat_30oc\n", - "here Pv_sat_30oc=0.04246 bar\n", - "so Pv1=phi1*Pv_sat_30oc in bar\n", - "corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\n", - "specific humidity,omega1 in kg/kg of air= 0.00792\n", - "at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\n", - "h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\n", - "for second moist air stream at 35oc and 85% relative humidity\n", - "phi2=Pv2/Pv_sat_35oc\n", - "here Pv_sat_35oc=0.005628 bar\n", - "so Pv2=phi2*Pv_sat_35oc in bar\n", - "specific humidity,omega2 in kg/kg of air= 0.00295\n", - "corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\n", - "so,enthalpy of second stream,\n", - "h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\n", - "enthalpy of mixture after adiabatic mixing,\n", - "=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\n", - "mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\n", - "specific humidity of mixture(omega)in kg/kg of dry air= 0.00592\n", - "omega=0.622*Pv/(P-Pv)\n", - "Pv in bar= 0.00956\n", - "partial pressure of water vapour=0.00957 bar\n", - "so specific humidity of mixture=0.00593 kg/kg dry air\n", - "and partial pressure of water vapour in mixture=0.00957 bar\n" - ] - } - ], - "source": [ - "#cal of specific humidity and partial pressure of water vapour in mixture\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.15, Page:451 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\")\n", - "P=1.013;#atmospheric pressure in bar\n", - "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", - "Cp_stream=1.86;#specific heat of stream at constant pressure in KJ/kg K\n", - "T1=30.;#temperature of first stream of moist air in K\n", - "m1=3.;#mass flow rate of first stream in kg/s \n", - "T2=35.;#temperature of second stream of moist air in K\n", - "m2=2.;#mass flow rate of second stream in kg/s \n", - "print(\"Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\")\n", - "print(\"For moist air stream at 30 degree celcius and 30% relative humidity.\")\n", - "phi1=0.3;\n", - "print(\"phi1=Pv1/Pv_sat_30oc\")\n", - "print(\"here Pv_sat_30oc=0.04246 bar\")\n", - "Pv_sat_30oc=0.04246;\n", - "print(\"so Pv1=phi1*Pv_sat_30oc in bar\")\n", - "Pv1=phi1*Pv_sat_30oc\n", - "print(\"corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\")\n", - "Tdp1=10.5;\n", - "omega1=0.622*Pv1/(P-Pv1)\n", - "print(\"specific humidity,omega1 in kg/kg of air=\"),round(omega1,5)\n", - "print(\"at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\")\n", - "hg=2520.7;#enthalpy at 10.5 degree celcius in KJ/kg\n", - "print(\"h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\")\n", - "h1=Cp_air*T1+omega1*(hg-Cp_stream*(T1-Tdp1))\n", - "print(\"for second moist air stream at 35oc and 85% relative humidity\")\n", - "phi2=0.85;\n", - "print(\"phi2=Pv2/Pv_sat_35oc\")\n", - "print(\"here Pv_sat_35oc=0.005628 bar\")\n", - "Pv_sat_35oc=0.005628;\n", - "print(\"so Pv2=phi2*Pv_sat_35oc in bar\")\n", - "Pv2=phi2*Pv_sat_35oc\n", - "omega2=0.622*Pv2/(P-Pv2)\n", - "print(\"specific humidity,omega2 in kg/kg of air=\"),round(omega2,5)\n", - "print(\"corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\")\n", - "Tdp2=32.;\n", - "print(\"so,enthalpy of second stream,\")\n", - "print(\"h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\")\n", - "hg=2559.9;#enthalpy at 32 degree celcius in KJ/kg\n", - "h2=Cp_air*T2+omega2*(hg+Cp_stream*(T2-Tdp2))\n", - "print(\"enthalpy of mixture after adiabatic mixing,\")\n", - "print(\"=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\")\n", - "(1./(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2)))\n", - "print(\"mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\")\n", - "(1./5.)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))\n", - "omega=0.00589/(1-0.005893)\n", - "print(\"specific humidity of mixture(omega)in kg/kg of dry air=\"),round(omega,5)\n", - "print(\"omega=0.622*Pv/(P-Pv)\")\n", - "Pv=omega*P/(omega+0.622)\n", - "print(\"Pv in bar=\"),round(Pv,5)\n", - "print(\"partial pressure of water vapour=0.00957 bar\")\n", - "print(\"so specific humidity of mixture=0.00593 kg/kg dry air\")\n", - "print(\"and partial pressure of water vapour in mixture=0.00957 bar\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.16;pg no: 452" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.16, Page:452 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\n", - "The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\n", - "h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\n", - "final state 2 has,h2=52 KJ/kg\n", - "mass of air(m)=m1/v1 in kg/s\n", - "amount of heat added(Q)in KJ/s\n", - "Q=m*(h2-h1) 56.78\n" - ] - } - ], - "source": [ - "#cal of amount of heat added\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.16, Page:452 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\")\n", - "m1=3;#rate at which moist air enter in heating coil in m^3/s\n", - "print(\"The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\")\n", - "print(\"h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\")\n", - "h1=36.4;\n", - "omega1=0.0086;\n", - "v1=0.825;\n", - "print(\"final state 2 has,h2=52 KJ/kg\")\n", - "h2=52;\n", - "print(\"mass of air(m)=m1/v1 in kg/s\")\n", - "m=m1/v1\n", - "m=3.64;#approx.\n", - "print(\"amount of heat added(Q)in KJ/s\")\n", - "Q=m*(h2-h1)\n", - "print(\"Q=m*(h2-h1)\"),round(Q,2)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter11_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter11_2.ipynb deleted file mode 100755 index 31f593f0..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter11_2.ipynb +++ /dev/null @@ -1,1309 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 11:Introduction to refrigeration and Air Conditioning" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.1;pg no: 435" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.1, Page:435 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\n", - "for refrigerator working on reversed carnot cycle.\n", - "Q1/T1=Q2/T2\n", - "so Q2=Q1*T2/T1 in KJ/min\n", - "and work input required,W in KJ/min\n", - "W=Q2-Q1 83.66\n" - ] - } - ], - "source": [ - "#cal of work input\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.1, Page:435 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\")\n", - "T1=(-16.+273.);#temperature of refrigerated space in K\n", - "T2=(27.+273.);#temperature of atmosphere in K\n", - "Q1=500.;#heat extracted from refrigerated space in KJ/min\n", - "print(\"for refrigerator working on reversed carnot cycle.\")\n", - "print(\"Q1/T1=Q2/T2\")\n", - "print(\"so Q2=Q1*T2/T1 in KJ/min\")\n", - "Q2=Q1*T2/T1\n", - "print(\"and work input required,W in KJ/min\")\n", - "W=Q2-Q1\n", - "print(\"W=Q2-Q1\"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.2;pg no: 435" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.2, Page:435 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\n", - "refrigeration capacity or heat extraction rate(Q)in KJ/s\n", - "let the ice formation rate be m kg/s\n", - "heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\n", - "ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice= 6.25\n", - "COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\n", - "also COP=Q/W\n", - "so W=Q/COP in KJ/s\n", - "HP required 643.62\n", - "NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\n" - ] - } - ], - "source": [ - "#cal of HP required\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.2, Page:435 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\")\n", - "Q=800.;#refrigeration capacity in tons\n", - "Q_latent=335.;#latent heat for ice formation from water in KJ/kg\n", - "T1=(-7.+273.);#temperature of reservoir 1 in K\n", - "T2=(27.+273.);#temperature of reservoir 2 in K\n", - "print(\"refrigeration capacity or heat extraction rate(Q)in KJ/s\")\n", - "Q=Q*3.5\n", - "print(\"let the ice formation rate be m kg/s\")\n", - "print(\"heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\")\n", - "Q1=4.18*(27-0)+Q_latent\n", - "m=Q/Q1\n", - "print(\"ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice=\"),round(Q/Q1,2)\n", - "print(\"COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\")\n", - "COP=T1/(T2-T1)\n", - "print(\"also COP=Q/W\")\n", - "print(\"so W=Q/COP in KJ/s\")\n", - "W=Q/COP\n", - "W=W/0.7457\n", - "print(\"HP required\"),round(W/0.7457,2)\n", - "print(\"NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.3;pg no: 436" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.3, Page:436 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\n", - "COP=T1/(T2-T1)=Q/W 1.56\n", - "equating,COP=T1/(T2-T1)\n", - "so temperature of surrounding(T2)in K\n", - "T2= 403.69\n" - ] - } - ], - "source": [ - "#cal of COP and temperature of surrounding\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.3, Page:436 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\")\n", - "T1=(-27+273);#temperature of refrigerator in K\n", - "W=3*.7457;#work input in KJ/s\n", - "Q=1*3.5;#refrigeration effect in KJ/s\n", - "COP=Q/W\n", - "print(\"COP=T1/(T2-T1)=Q/W\"),round(COP,2)\n", - "COP=1.56;#approx.\n", - "print(\"equating,COP=T1/(T2-T1)\")\n", - "print(\"so temperature of surrounding(T2)in K\")\n", - "T2=T1+(T1/COP)\n", - "print(\"T2=\"),round(T2,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.4;pg no: 436" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.4, Page:436 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\n", - "during process 1-2_a\n", - "p2/p1=(T2_a/T1)^(y/(y-1))\n", - "so T2_a=T1*(p2/p1)^((y-1)/y)in K\n", - "theoretical temperature after compression,T2_a=440.18 K\n", - "for compression process,\n", - "n1=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+(T2_a-T1)/n1 in K\n", - "for expansion process,3-4_a\n", - "T4_a/T3=(p1/p2)^((y-1)/y)\n", - "so T4_a=T3*(p1/p2)^((y-1)/y) in K\n", - "n2=0.9=(T3-T4)/(T3-T4_a)\n", - "so T4=T3-(n2*(T3-T4_a))in K\n", - "so work during compression,W_C in KJ/s\n", - "W_C=m*Cp*(T2-T1)\n", - "work during expansion,W_T in KJ/s\n", - "W_T=m*Cp*(T3-T4)\n", - "refrigeration effect is realized during process,4-1.so refrigeration shall be,\n", - "Q_ref=m*Cp*(T1-T4) in KJ/s\n", - "Q_ref in ton 18.36\n", - "net work required(W)=W_C-W_T in KJ/s 111.59\n", - "COP= 0.58\n", - "so refrigeration capacity=18.36 ton or 64.26 KJ/s\n", - "and COP=0.57\n", - "NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\n" - ] - } - ], - "source": [ - "#cal of refrigeration capacity and COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.4, Page:436 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\")\n", - "T1=(-30.+273.);#temperature of air at beginning of compression in K\n", - "T3=(27.+273.);#temperature of air after cooling in K\n", - "r=8.;#pressure ratio\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "y=1.4;#expansion constant \n", - "m=1.;#air flow rate in kg/s\n", - "n1=0.85;#isentropic efficiency for compression process\n", - "n2=.9;#isentropic efficiency for expansion process\n", - "print(\"during process 1-2_a\")\n", - "print(\"p2/p1=(T2_a/T1)^(y/(y-1))\")\n", - "print(\"so T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", - "T2_a=T1*(r)**((y-1)/y)\n", - "print(\"theoretical temperature after compression,T2_a=440.18 K\")\n", - "print(\"for compression process,\")\n", - "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", - "T2=T1+(T2_a-T1)/n1\n", - "print(\"for expansion process,3-4_a\")\n", - "print(\"T4_a/T3=(p1/p2)^((y-1)/y)\")\n", - "print(\"so T4_a=T3*(p1/p2)^((y-1)/y) in K\")\n", - "T4_a=T3*(1/r)**((y-1)/y)\n", - "print(\"n2=0.9=(T3-T4)/(T3-T4_a)\")\n", - "print(\"so T4=T3-(n2*(T3-T4_a))in K\")\n", - "T4=T3-(n2*(T3-T4_a))\n", - "print(\"so work during compression,W_C in KJ/s\")\n", - "print(\"W_C=m*Cp*(T2-T1)\")\n", - "W_C=m*Cp*(T2-T1)\n", - "print(\"work during expansion,W_T in KJ/s\")\n", - "print(\"W_T=m*Cp*(T3-T4)\")\n", - "W_T=m*Cp*(T3-T4)\n", - "print(\"refrigeration effect is realized during process,4-1.so refrigeration shall be,\")\n", - "print(\"Q_ref=m*Cp*(T1-T4) in KJ/s\")\n", - "Q_ref=m*Cp*(T1-T4)\n", - "Q_ref=Q_ref/3.5\n", - "print(\"Q_ref in ton\"),round(Q_ref,2)\n", - "W=W_C-W_T\n", - "print(\"net work required(W)=W_C-W_T in KJ/s\"),round(W,2)\n", - "Q_ref=64.26;\n", - "COP=Q_ref/(W_C-W_T)\n", - "print(\"COP=\"),round(COP,2)\n", - "print(\"so refrigeration capacity=18.36 ton or 64.26 KJ/s\")\n", - "print(\"and COP=0.57\")\n", - "print(\"NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.5;pg no: 437" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.5, Page:437 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\n", - "for isentropic compression process:\n", - "(p2/p1)^((y-1)/y)=T2/T1\n", - "so T2=T1*(p2/p1)^((y-1)/y) in K\n", - "for isenropic expansion process:\n", - "(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\n", - "so T4=T3/(p2/p1)^((y-1)/y) in K\n", - "heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\n", - "refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\n", - "so net work(W)=Q23-Q41 in KJ/kg\n", - "so COP=refrigeration effect/net work= 1.71\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.5, Page:437 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\")\n", - "T1=(7+273);#temperature of refrigerated space in K\n", - "T3=(27+273);#temperature after compression in K\n", - "p1=1*10**5;#pressure of refrigerated space in pa\n", - "p2=5*10**5;#pressure after compression in pa\n", - "y=1.4;#expansion constant\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"for isentropic compression process:\")\n", - "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", - "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"for isenropic expansion process:\")\n", - "print(\"(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\")\n", - "print(\"so T4=T3/(p2/p1)^((y-1)/y) in K\")\n", - "T4=T3/(p2/p1)**((y-1)/y)\n", - "print(\"heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\")\n", - "Q23=Cp*(T2-T3)\n", - "print(\"refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\")\n", - "Q41=Cp*(T1-T4)\n", - "print(\"so net work(W)=Q23-Q41 in KJ/kg\")\n", - "W=Q23-Q41\n", - "COP=Q41/W\n", - "print(\"so COP=refrigeration effect/net work=\"),round(COP,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.6;pg no: 438" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.6, Page:438 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\n", - "for process 1-2\n", - "(p2/p1)^((y-1)/y)=T2/T1\n", - "so T2=T1*(p2/p1)^((y-1)/y) in K\n", - "for process 3-4\n", - "(p3/p4)^((y-1)/y)=T3/T4\n", - "so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\n", - "refrigeration capacity(Q) in KJ/s= 63.25\n", - "Q in ton\n", - "work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\n", - "w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\n", - "HP required to run compressor 177.86\n", - "so HP required to run compressor=177.86 hp\n", - "net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\n", - "COP=refrigeration capacity/work=Q/W 1.59\n" - ] - } - ], - "source": [ - "#cal of refrigeration capacity,HP required to run compressor,COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.6, Page:438 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\")\n", - "T1=(-10.+273.);#air entering temperature in K\n", - "p1=1.*10**5;#air entering pressure in pa\n", - "T3=(27.+273.);#compressed air temperature after cooling in K\n", - "p2=5.5*10**5;#pressure after compression in pa\n", - "m=0.8;#air flow rate in kg/s\n", - "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", - "y=1.4;#expansion constant\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"for process 1-2\")\n", - "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", - "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"for process 3-4\")\n", - "print(\"(p3/p4)^((y-1)/y)=T3/T4\")\n", - "print(\"so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\")\n", - "T4=T3/(p2/p1)**((y-1)/y)\n", - "Q=m*Cp*(T1-T4)\n", - "print(\"refrigeration capacity(Q) in KJ/s=\"),round(Q,2)\n", - "print(\"Q in ton\")\n", - "Q=Q/3.5\n", - "print(\"work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\")\n", - "print(\"w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\")\n", - "n=y;\n", - "w=(m*n)*R*(T2-T1)/(n-1)\n", - "print(\"HP required to run compressor\"),round(w/0.7457,2)\n", - "print(\"so HP required to run compressor=177.86 hp\")\n", - "print(\"net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\")\n", - "W=m*Cp*((T2-T3)-(T1-T4))\n", - "Q=63.25;#refrigeration capacity in KJ/s\n", - "COP=Q/W\n", - "print(\"COP=refrigeration capacity/work=Q/W\"),round(COP,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.7;pg no: 440" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.7, Page:440 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\n", - "for process 1-2,n=1.45\n", - "T2/T1=(p2/p1)^((n-1)/n)\n", - "so T2=T1*(p2/p1)^((n-1)/n) in K\n", - "for process 3-4,n=1.3\n", - "T4/T3=(p4/p3)^((n-1)/n)\n", - "so T4=T3*(p4/p3)^((n-1)/n)in K\n", - "refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\n", - "Q=m*Cp*(T5-T4)\n", - "m in kg/s= 0.55\n", - "so air mass flow rate in cabin=0.55 kg/s\n", - "let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\n", - "m1*Cp*(T8-T7)=m*Cp*(T2-T3)\n", - "during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\n", - "so T7=T6*(p7/p6)^((n-1)/n) in K\n", - "substituting T2,T3,T7,T8 and m in energy balance on intercooler,\n", - "m1=m*(T2-T3)/(T8-T7)in kg/s\n", - "total ram air mass flow rate=m+m1 in kg/s 2.11\n", - "ram air mass flow rate=2.12 kg/s\n", - "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\n", - "COP=refrigeration effect/work input=Q/W 0.485\n" - ] - } - ], - "source": [ - "#cal of air mass flow rate in cabin,ram air mass flow rate,COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.7, Page:440 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\")\n", - "p1=1.2*10**5;#pressure of ram air in pa\n", - "p6=p1;\n", - "T1=(15.+273.);#temperature of ram air in K\n", - "T6=T1;\n", - "p7=0.9*10**5;#pressure of ram air after expansion in pa\n", - "p3=4.*10**5;#pressure of ram air after compression in pa\n", - "p2=p3;\n", - "p4=1.*10**5;#pressure of ram air after expansion in second turbine in pa\n", - "T5=(25.+273.);#temperature of air when exhausted from cabin in K\n", - "T3=(50.+273.);#temperature of compressed air in K\n", - "T8=(30.+273.);#limited temperaure of ram air in K\n", - "Q=10.*3.5;#refrigeration capacity in KJ/s\n", - "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", - "print(\"for process 1-2,n=1.45\")\n", - "n=1.45;\n", - "print(\"T2/T1=(p2/p1)^((n-1)/n)\")\n", - "print(\"so T2=T1*(p2/p1)^((n-1)/n) in K\")\n", - "T2=T1*(p2/p1)**((n-1)/n)\n", - "print(\"for process 3-4,n=1.3\")\n", - "n=1.3;\n", - "print(\"T4/T3=(p4/p3)^((n-1)/n)\")\n", - "print(\"so T4=T3*(p4/p3)^((n-1)/n)in K\")\n", - "T4=T3*(p4/p3)**((n-1)/n)\n", - "print(\"refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\")\n", - "print(\"Q=m*Cp*(T5-T4)\")\n", - "m=Q/(Cp*(T5-T4))\n", - "print(\"m in kg/s=\"),round(m,2)\n", - "print(\"so air mass flow rate in cabin=0.55 kg/s\")\n", - "print(\"let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\")\n", - "print(\"m1*Cp*(T8-T7)=m*Cp*(T2-T3)\")\n", - "print(\"during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\")\n", - "print(\"so T7=T6*(p7/p6)^((n-1)/n) in K\")\n", - "T7=T6*(p7/p6)**((n-1)/n)\n", - "print(\"substituting T2,T3,T7,T8 and m in energy balance on intercooler,\")\n", - "print(\"m1=m*(T2-T3)/(T8-T7)in kg/s\")\n", - "m1=m*(T2-T3)/(T8-T7)\n", - "print(\"total ram air mass flow rate=m+m1 in kg/s\"),round(m+m1,2)\n", - "print(\"ram air mass flow rate=2.12 kg/s\")\n", - "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\")\n", - "m=0.55;#approx.\n", - "W=m*Cp*(T2-T1)\n", - "COP=Q/W\n", - "print(\"COP=refrigeration effect/work input=Q/W\"),round(Q/W,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.8;pg no: 441" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.8, Page:441 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\n", - "considering index of compression and expansion as 1.4\n", - "during ramming action,process 0-1,\n", - "T1/To=(p1/po)^((y-1)/y)\n", - "T1=To*(p1/po)^((y-1)/y)in K\n", - "during compression process 1-2_a\n", - "T2_a/T1=(p2/p1)^((y-1)/y)\n", - "T2_a=T1*(p2/p1)^((y-1)/y)in K\n", - "n1=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+(T2_a-T1)/n1 in K\n", - "In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\n", - "subsequently for 10 degree celcius temperature drop in evaporator,\n", - "T4=T3-10 in K\n", - "expansion in cooling turbine during process 4-5;\n", - "T5_a/T4=(p5/p4)^((y-1)/y)\n", - "T5_a=T4*(p5/p4)^((y-1)/y)in K\n", - "n2=(T4-T5)/(T4-T5_a)\n", - "T5=T4-(T4-T5_a)*n2 in K\n", - "let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\n", - "Q=m*Cp*(T6-T5)\n", - "so m=Q/(Cp*(T6-T5))in kg/s\n", - "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s 41.4\n", - "W in Hp\n", - "COP=refrigeration effect/work input=Q/W= 1.27\n", - "so COP=1.27\n", - "and HP required=55.48 hp\n" - ] - } - ], - "source": [ - "#cal of COP and HP required\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.8, Page:441 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\")\n", - "po=0.9*10**5;#atmospheric air pressure in pa\n", - "To=(3.+273.);#temperature of atmospheric air in K\n", - "p1=1.*10**5;#pressure due to ramming air in pa\n", - "p2=4.*10**5;#pressure when air leaves compressor in pa\n", - "p3=p2;\n", - "p4=p3;\n", - "p5=1.03*10**5;#pressure maintained in passenger cabin in pa\n", - "T6=(25.+273.);#temperature of air leaves cabin in K\n", - "Q=15.*3.5;#refrigeration capacity of aeroplane in KJ/s\n", - "n1=0.9;#isentropic efficiency of compressor\n", - "n2=0.8;#isentropic efficiency of turbine\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"considering index of compression and expansion as 1.4\")\n", - "y=1.4;\n", - "print(\"during ramming action,process 0-1,\")\n", - "print(\"T1/To=(p1/po)^((y-1)/y)\")\n", - "print(\"T1=To*(p1/po)^((y-1)/y)in K\")\n", - "T1=To*(p1/po)**((y-1)/y)\n", - "print(\"during compression process 1-2_a\")\n", - "print(\"T2_a/T1=(p2/p1)^((y-1)/y)\")\n", - "print(\"T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", - "T2_a=T1*(p2/p1)**((y-1)/y)\n", - "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", - "T2=T1+(T2_a-T1)/n1\n", - "print(\"In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\")\n", - "T3=0.34*T2\n", - "print(\"subsequently for 10 degree celcius temperature drop in evaporator,\")\n", - "print(\"T4=T3-10 in K\")\n", - "T4=T3-10\n", - "print(\"expansion in cooling turbine during process 4-5;\")\n", - "print(\"T5_a/T4=(p5/p4)^((y-1)/y)\")\n", - "print(\"T5_a=T4*(p5/p4)^((y-1)/y)in K\")\n", - "T5_a=T4*(p5/p4)**((y-1)/y)\n", - "print(\"n2=(T4-T5)/(T4-T5_a)\")\n", - "print(\"T5=T4-(T4-T5_a)*n2 in K\")\n", - "T5=T4-(T4-T5_a)*n2\n", - "print(\"let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\")\n", - "print(\"Q=m*Cp*(T6-T5)\")\n", - "print(\"so m=Q/(Cp*(T6-T5))in kg/s\")\n", - "m=Q/(Cp*(T6-T5))\n", - "W=m*Cp*(T2-T1)\n", - "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\"),round(W,2)\n", - "print(\"W in Hp\")\n", - "W=W/.7457\n", - "W=41.37;#work input to compressor in KJ/s\n", - "COP=Q/W\n", - "print(\"COP=refrigeration effect/work input=Q/W=\"),round(COP,2)\n", - "print(\"so COP=1.27\")\n", - "print(\"and HP required=55.48 hp\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.9;pg no: 443" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.9, Page:443 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\n", - "properties of NH3,\n", - "at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\n", - "and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\n", - "here work done,W=Area 1-2-3-9-1\n", - "refrigeration effect=Area 1-5-6-4-1\n", - "Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\n", - "so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\n", - "during throttling process between 3 and 4,h3=h4\n", - "(Area=3-11-7-3)=(Area 4-9-11-6-4)\n", - "(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\n", - "(Area 3-8-9)=(Area 4-6-7-8-4)\n", - "so (Area 4-6-7-8-4)=12.09 KJ/kg\n", - "also,(Area 4-6-7-8-4)=T1*(s4-s8)\n", - "so (s4-s8)in KJ/kg K=\n", - "also s3=s8=0.3386 KJ/kg K\n", - "so s4 in KJ/kg K=\n", - "also s1=s2=4.4809 KJ/kg K\n", - "refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\n", - "work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\n", - "so COP=refrigeration effect/work done= 5.94\n", - "so COP=5.94\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.9, Page:443 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\")\n", - "print(\"properties of NH3,\")\n", - "print(\"at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\")\n", - "T1=(-15+273);\n", - "h9=-54.51;\n", - "hg=1303.74;\n", - "s9=-0.2132;\n", - "sg=5.0536;\n", - "print(\"and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\")\n", - "T2=(25+273);\n", - "h3=99.94;\n", - "h2=1317.95;\n", - "s3=0.3386;\n", - "s2=4.4809;\n", - "print(\"here work done,W=Area 1-2-3-9-1\")\n", - "print(\"refrigeration effect=Area 1-5-6-4-1\")\n", - "print(\"Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\")\n", - "print(\"so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\")\n", - "h3-h9-T1*(s3-s9)\n", - "print(\"during throttling process between 3 and 4,h3=h4\")\n", - "print(\"(Area=3-11-7-3)=(Area 4-9-11-6-4)\")\n", - "print(\"(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\")\n", - "print(\"(Area 3-8-9)=(Area 4-6-7-8-4)\")\n", - "print(\"so (Area 4-6-7-8-4)=12.09 KJ/kg\")\n", - "print(\"also,(Area 4-6-7-8-4)=T1*(s4-s8)\")\n", - "print(\"so (s4-s8)in KJ/kg K=\")\n", - "12.09/T1\n", - "print(\"also s3=s8=0.3386 KJ/kg K\")\n", - "s8=s3;\n", - "print(\"so s4 in KJ/kg K=\")\n", - "s4=s8+12.09/T1\n", - "print(\"also s1=s2=4.4809 KJ/kg K\")\n", - "s1=s2;\n", - "print(\"refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\")\n", - "Q=T1*(s1-s4)\n", - "print(\"work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\")\n", - "W=12.09+((T2-T1)*(s1-s8))\n", - "COP=Q/W\n", - "print(\"so COP=refrigeration effect/work done=\"),round(COP,2)\n", - "print(\"so COP=5.94\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.10;pg no: 445" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.10, Page:445 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\n", - "properties of Freon-12,\n", - "at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\n", - "at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\n", - "during expansion(throttling)between 3 and 4\n", - "h3=h4=hf_40oc=74.53 KJ/kg=h4\n", - "process 1-2 is adiabatic compression so,\n", - "s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\n", - "at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\n", - "T2=313*exp((s1-sg)/Cpg)in K\n", - "so temperature after compression,T2=324.17 K\n", - "enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\n", - "compression work required,per kg(Wc)=h2-h1 in KJ/kg\n", - "refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\n", - "mass flow rate of refrigerant,m=Q/q in kg/s\n", - "COP=q/Wc 3.17452\n", - "volumetric efficiency of reciprocating compressor,given C=0.02\n", - "n_vol=1+C-C*(P2/P1)^(1/n)\n", - "let piston printlacement by V,m^3\n", - "mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\n", - "so V in cm^3= 569.43\n", - "so COP=3.175\n", - "and piston printlacement=569.45 cm^3\n" - ] - } - ], - "source": [ - "#cal of COP and piston printlacement\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.10, Page:445 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\")\n", - "Q=2.86*3.5;#refrigeration effect in KJ/s\n", - "N=1200;#compressor rpm\n", - "n=1.13;#compression index\n", - "print(\"properties of Freon-12,\")\n", - "print(\"at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\")\n", - "P1=1.51;\n", - "T1=(-20+273);\n", - "vg=0.1088;\n", - "h1=178.61;\n", - "s1=0.7082;\n", - "s2=s1;\n", - "print(\"at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\")\n", - "P2=9.61;\n", - "h3=74.53;\n", - "h4=h3;\n", - "hg=203.05;\n", - "sf=0.2716;\n", - "sg=0.682;\n", - "Cpf=0.976;\n", - "Cpg=0.747;\n", - "print(\"during expansion(throttling)between 3 and 4\")\n", - "print(\"h3=h4=hf_40oc=74.53 KJ/kg=h4\")\n", - "print(\"process 1-2 is adiabatic compression so,\")\n", - "print(\"s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\")\n", - "print(\"at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\")\n", - "print(\"T2=313*exp((s1-sg)/Cpg)in K\")\n", - "T2=313*math.exp((s1-sg)/Cpg)\n", - "print(\"so temperature after compression,T2=324.17 K\")\n", - "print(\"enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\")\n", - "h2=hg+Cpg*(T2-313)\n", - "print(\"compression work required,per kg(Wc)=h2-h1 in KJ/kg\")\n", - "Wc=h2-h1\n", - "print(\"refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\")\n", - "q=h1-h4\n", - "print(\"mass flow rate of refrigerant,m=Q/q in kg/s\")\n", - "m=Q/q\n", - "m=0.096;#approx.\n", - "COP=q/Wc\n", - "print(\"COP=q/Wc\"),round(COP,5)\n", - "print(\"volumetric efficiency of reciprocating compressor,given C=0.02\")\n", - "C=0.02;\n", - "print(\"n_vol=1+C-C*(P2/P1)^(1/n)\")\n", - "n_vol=1+C-C*(P2/P1)**(1/n)\n", - "print(\"let piston printlacement by V,m^3\")\n", - "print(\"mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\")\n", - "V=(m*60*vg)*10**6/(N*n_vol)\n", - "print(\"so V in cm^3=\"),round(V,2)\n", - "print(\"so COP=3.175\")\n", - "print(\"and piston printlacement=569.45 cm^3\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.11;pg no: 447" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.11, Page:447 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\n", - "properties of CO2,\n", - "at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\n", - "at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\n", - "processes of vapour compression cycle are shown on T-s diagram\n", - "1-2:isentropic compression process\n", - "2-3-4:condensation process\n", - "4-5:isenthalpic expansion process\n", - "5-1:refrigeration process in evaporator\n", - "h1=hg at -10oc=322.28 KJ/kg\n", - "at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\n", - "entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\n", - "entropy during isentropic process,s1=s2\n", - "at -10 degree celcius,s2=sf+x1*sfg\n", - "so x1=(s2-sf)/(sg-sf)\n", - "enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\n", - "h3=hf at 20oc=144.11 KJ/kg\n", - "since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\n", - "also,h4=h5=115.22 KJ/kg\n", - "refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\n", - "let refrigerant flow rate be m kg/s\n", - "refrigerant effect(Q)=m*q\n", - "m=Q/q in kg/s 0.01016\n", - "compressor work,Wc=h2-h1 in KJ/kg\n", - "COP=refrigeration effect per kg/compressor work per kg= 6.51\n", - "so COP=6.51,mass flow rate=0.01016 kg/s\n", - "NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \n" - ] - } - ], - "source": [ - "#cal of COP and mass flow rate\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.11, Page:447 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\")\n", - "Q=2;#refrigeration effect in KW\n", - "print(\"properties of CO2,\")\n", - "print(\"at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\")\n", - "T1=(20.+273.);#condensation temperature in K\n", - "P1=57.27;\n", - "h3=144.11;\n", - "hg=299.62;\n", - "sf=0.523;\n", - "sg_20oc=1.0527;\n", - "Cpf=2.889;\n", - "Cpg=2.135;\n", - "print(\"at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\")\n", - "T2=(-10+273);#evaporator temperature in K\n", - "P2=26.49;\n", - "vg=0.014;\n", - "hf=60.78;\n", - "h1=322.28;\n", - "sf=0.2381;\n", - "sg=1.2324;\n", - "print(\"processes of vapour compression cycle are shown on T-s diagram\")\n", - "print(\"1-2:isentropic compression process\")\n", - "print(\"2-3-4:condensation process\")\n", - "print(\"4-5:isenthalpic expansion process\")\n", - "print(\"5-1:refrigeration process in evaporator\")\n", - "print(\"h1=hg at -10oc=322.28 KJ/kg\")\n", - "print(\"at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\")\n", - "h2=hg+Cpg*(40.-20.)\n", - "print(\"entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\")\n", - "s2=sg_20oc+Cpg*math.log((273.+40.)/(273.+20.))\n", - "print(\"entropy during isentropic process,s1=s2\")\n", - "print(\"at -10 degree celcius,s2=sf+x1*sfg\")\n", - "print(\"so x1=(s2-sf)/(sg-sf)\")\n", - "x1=(s2-sf)/(sg-sf)\n", - "print(\"enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\")\n", - "h1=hf+x1*(h1-hf)\n", - "print(\"h3=hf at 20oc=144.11 KJ/kg\")\n", - "print(\"since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\")\n", - "h4=h3-Cpf*(20.-10.)\n", - "print(\"also,h4=h5=115.22 KJ/kg\")\n", - "h5=h4;\n", - "print(\"refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\")\n", - "q=(h1-h5)\n", - "print(\"let refrigerant flow rate be m kg/s\")\n", - "print(\"refrigerant effect(Q)=m*q\")\n", - "m=Q/q\n", - "print(\"m=Q/q in kg/s\"),round(m,5)\n", - "print(\"compressor work,Wc=h2-h1 in KJ/kg\")\n", - "Wc=h2-h1\n", - "COP=q/Wc\n", - "print(\"COP=refrigeration effect per kg/compressor work per kg=\"),round(COP,2)\n", - "print(\"so COP=6.51,mass flow rate=0.01016 kg/s\")\n", - "print(\"NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.12;pg no: 448" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.12, Page:448 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\n", - "here pressure of atmospheric air(P)may be taken as 1.013 bar\n", - "specific humidity,omega=0.622*(Pv/(P-Pv))\n", - "so partial pressure of vapour(Pv)in bar\n", - "Pv in bar= 0.0254\n", - "relative humidity(phi)=(Pv/Pv_sat)\n", - "from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\n", - "so phi=Pv/Pv_sat 0.82\n", - "in percentage 81.99\n", - "so partial pressure of vapour=0.0254 bar\n", - "relative humidity=81.98 %\n" - ] - } - ], - "source": [ - "#cal of partial pressure of vapour and relative humidity\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.12, Page:448 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\")\n", - "omega=0.016;#specific humidity in gm/gm of air\n", - "print(\"here pressure of atmospheric air(P)may be taken as 1.013 bar\")\n", - "P=1.013;#pressure of atmospheric air in bar\n", - "print(\"specific humidity,omega=0.622*(Pv/(P-Pv))\")\n", - "print(\"so partial pressure of vapour(Pv)in bar\")\n", - "Pv=P/(1+(0.622/omega))\n", - "print(\"Pv in bar=\"),round(Pv,4)\n", - "Pv=0.0254;#approx.\n", - "print(\"relative humidity(phi)=(Pv/Pv_sat)\")\n", - "print(\"from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\")\n", - "Pv_sat=0.03098;\n", - "phi=Pv/Pv_sat\n", - "print(\"so phi=Pv/Pv_sat\"),round(phi,2)\n", - "print(\"in percentage\"),round(phi*100,2)\n", - "print(\"so partial pressure of vapour=0.0254 bar\")\n", - "print(\"relative humidity=81.98 %\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.13;pg no: 449" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.13, Page:449 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\n", - "at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\n", - "partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar 0.03\n", - "partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour 0.99\n", - "so partial pressure of air=0.9875 bar\n", - "humidity ratio,omega in kg/kg of dry air= 0.01606\n", - "so humidity ratio=0.01606 kg/kg of air\n", - "Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\n", - "so Dew point temperature=21.4 degree celcius\n", - "density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\n", - "rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\n", - "rho_m in kg/m^3= 1.1836\n", - "so density = 1.1835 kg/m^3\n", - "enthalpy of mixture,h in KJ/kg of dry air= 71.21\n", - "enthalpy of mixture =71.2 KJ/kg of dry air\n" - ] - } - ], - "source": [ - "#cal of partial pressure,humidity ratio,Dew point temperature,density and enthalpy of mixture\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.13, Page:449 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\")\n", - "r=0.6;#relative humidity\n", - "P=1.013;#total pressure of mixture in bar\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Ta=(30+273);#room temperature in K\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg degree celcius\n", - "print(\"at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\")\n", - "Pv_sat=0.0425;\n", - "Pv=r*Pv_sat\n", - "print(\"partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar\"),round(Pv,2)\n", - "Pa=P-Pv\n", - "print(\"partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour\"),round(Pa,2)\n", - "print(\"so partial pressure of air=0.9875 bar\")\n", - "omega=0.622*Pv/(P-Pv)\n", - "print(\"humidity ratio,omega in kg/kg of dry air=\"),round(omega,5)\n", - "print(\"so humidity ratio=0.01606 kg/kg of air\")\n", - "print(\"Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\")\n", - "print(\"so Dew point temperature=21.4 degree celcius\")\n", - "print(\"density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\")\n", - "print(\"rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\")\n", - "rho_m=P*100*(1+omega)/(R*Ta)\n", - "print(\"rho_m in kg/m^3=\"),round(rho_m,4)\n", - "print(\"so density = 1.1835 kg/m^3\")\n", - "T=30;#room temperature in degree celcius\n", - "hg=2540.1;#enthalpy at 30 degree celcius in KJ/kg\n", - "h=Cp*T+omega*(hg+1.860*(30-21.4))\n", - "print(\"enthalpy of mixture,h in KJ/kg of dry air=\"),round(h,2)\n", - "print(\"enthalpy of mixture =71.2 KJ/kg of dry air\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.14;pg no: 449" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.14, Page:449 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\n", - "initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\n", - "omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\n", - "mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\n", - "mass flow rate of air(ma)=0.8/v2 in kg/s\n", - "total mass of water added=ma*(omega2-omega1)in kg/s 0.001311\n", - "heat transferred in KJ/s= 12.18\n", - "so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\n" - ] - } - ], - "source": [ - "#cal of mass of water added and heat transferred\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.14, Page:449 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\")\n", - "print(\"initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\")\n", - "print(\"omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\")\n", - "omega1=0.0086;\n", - "h1=37.;\n", - "omega2=0.01;\n", - "h2=50.;\n", - "v2=0.854;\n", - "print(\"mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\")\n", - "omega2-omega1\n", - "print(\"mass flow rate of air(ma)=0.8/v2 in kg/s\")\n", - "ma=0.8/v2\n", - "print(\"total mass of water added=ma*(omega2-omega1)in kg/s\"),round(ma*(omega2-omega1),6)\n", - "print(\"heat transferred in KJ/s=\"),round(ma*(h2-h1),2)\n", - "print(\"so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.15;pg no: 451" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.15, Page:451 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\n", - "Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\n", - "For moist air stream at 30 degree celcius and 30% relative humidity.\n", - "phi1=Pv1/Pv_sat_30oc\n", - "here Pv_sat_30oc=0.04246 bar\n", - "so Pv1=phi1*Pv_sat_30oc in bar\n", - "corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\n", - "specific humidity,omega1 in kg/kg of air= 0.00792\n", - "at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\n", - "h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\n", - "for second moist air stream at 35oc and 85% relative humidity\n", - "phi2=Pv2/Pv_sat_35oc\n", - "here Pv_sat_35oc=0.005628 bar\n", - "so Pv2=phi2*Pv_sat_35oc in bar\n", - "specific humidity,omega2 in kg/kg of air= 0.00295\n", - "corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\n", - "so,enthalpy of second stream,\n", - "h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\n", - "enthalpy of mixture after adiabatic mixing,\n", - "=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\n", - "mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\n", - "specific humidity of mixture(omega)in kg/kg of dry air= 0.00592\n", - "omega=0.622*Pv/(P-Pv)\n", - "Pv in bar= 0.00956\n", - "partial pressure of water vapour=0.00957 bar\n", - "so specific humidity of mixture=0.00593 kg/kg dry air\n", - "and partial pressure of water vapour in mixture=0.00957 bar\n" - ] - } - ], - "source": [ - "#cal of specific humidity and partial pressure of water vapour in mixture\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.15, Page:451 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\")\n", - "P=1.013;#atmospheric pressure in bar\n", - "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", - "Cp_stream=1.86;#specific heat of stream at constant pressure in KJ/kg K\n", - "T1=30.;#temperature of first stream of moist air in K\n", - "m1=3.;#mass flow rate of first stream in kg/s \n", - "T2=35.;#temperature of second stream of moist air in K\n", - "m2=2.;#mass flow rate of second stream in kg/s \n", - "print(\"Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\")\n", - "print(\"For moist air stream at 30 degree celcius and 30% relative humidity.\")\n", - "phi1=0.3;\n", - "print(\"phi1=Pv1/Pv_sat_30oc\")\n", - "print(\"here Pv_sat_30oc=0.04246 bar\")\n", - "Pv_sat_30oc=0.04246;\n", - "print(\"so Pv1=phi1*Pv_sat_30oc in bar\")\n", - "Pv1=phi1*Pv_sat_30oc\n", - "print(\"corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\")\n", - "Tdp1=10.5;\n", - "omega1=0.622*Pv1/(P-Pv1)\n", - "print(\"specific humidity,omega1 in kg/kg of air=\"),round(omega1,5)\n", - "print(\"at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\")\n", - "hg=2520.7;#enthalpy at 10.5 degree celcius in KJ/kg\n", - "print(\"h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\")\n", - "h1=Cp_air*T1+omega1*(hg-Cp_stream*(T1-Tdp1))\n", - "print(\"for second moist air stream at 35oc and 85% relative humidity\")\n", - "phi2=0.85;\n", - "print(\"phi2=Pv2/Pv_sat_35oc\")\n", - "print(\"here Pv_sat_35oc=0.005628 bar\")\n", - "Pv_sat_35oc=0.005628;\n", - "print(\"so Pv2=phi2*Pv_sat_35oc in bar\")\n", - "Pv2=phi2*Pv_sat_35oc\n", - "omega2=0.622*Pv2/(P-Pv2)\n", - "print(\"specific humidity,omega2 in kg/kg of air=\"),round(omega2,5)\n", - "print(\"corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\")\n", - "Tdp2=32.;\n", - "print(\"so,enthalpy of second stream,\")\n", - "print(\"h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\")\n", - "hg=2559.9;#enthalpy at 32 degree celcius in KJ/kg\n", - "h2=Cp_air*T2+omega2*(hg+Cp_stream*(T2-Tdp2))\n", - "print(\"enthalpy of mixture after adiabatic mixing,\")\n", - "print(\"=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\")\n", - "(1./(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2)))\n", - "print(\"mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\")\n", - "(1./5.)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))\n", - "omega=0.00589/(1-0.005893)\n", - "print(\"specific humidity of mixture(omega)in kg/kg of dry air=\"),round(omega,5)\n", - "print(\"omega=0.622*Pv/(P-Pv)\")\n", - "Pv=omega*P/(omega+0.622)\n", - "print(\"Pv in bar=\"),round(Pv,5)\n", - "print(\"partial pressure of water vapour=0.00957 bar\")\n", - "print(\"so specific humidity of mixture=0.00593 kg/kg dry air\")\n", - "print(\"and partial pressure of water vapour in mixture=0.00957 bar\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.16;pg no: 452" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.16, Page:452 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\n", - "The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\n", - "h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\n", - "final state 2 has,h2=52 KJ/kg\n", - "mass of air(m)=m1/v1 in kg/s\n", - "amount of heat added(Q)in KJ/s\n", - "Q=m*(h2-h1) 56.78\n" - ] - } - ], - "source": [ - "#cal of amount of heat added\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.16, Page:452 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\")\n", - "m1=3;#rate at which moist air enter in heating coil in m^3/s\n", - "print(\"The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\")\n", - "print(\"h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\")\n", - "h1=36.4;\n", - "omega1=0.0086;\n", - "v1=0.825;\n", - "print(\"final state 2 has,h2=52 KJ/kg\")\n", - "h2=52;\n", - "print(\"mass of air(m)=m1/v1 in kg/s\")\n", - "m=m1/v1\n", - "m=3.64;#approx.\n", - "print(\"amount of heat added(Q)in KJ/s\")\n", - "Q=m*(h2-h1)\n", - "print(\"Q=m*(h2-h1)\"),round(Q,2)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter11_3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter11_3.ipynb deleted file mode 100755 index 31f593f0..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter11_3.ipynb +++ /dev/null @@ -1,1309 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 11:Introduction to refrigeration and Air Conditioning" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.1;pg no: 435" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.1, Page:435 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\n", - "for refrigerator working on reversed carnot cycle.\n", - "Q1/T1=Q2/T2\n", - "so Q2=Q1*T2/T1 in KJ/min\n", - "and work input required,W in KJ/min\n", - "W=Q2-Q1 83.66\n" - ] - } - ], - "source": [ - "#cal of work input\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.1, Page:435 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1\")\n", - "T1=(-16.+273.);#temperature of refrigerated space in K\n", - "T2=(27.+273.);#temperature of atmosphere in K\n", - "Q1=500.;#heat extracted from refrigerated space in KJ/min\n", - "print(\"for refrigerator working on reversed carnot cycle.\")\n", - "print(\"Q1/T1=Q2/T2\")\n", - "print(\"so Q2=Q1*T2/T1 in KJ/min\")\n", - "Q2=Q1*T2/T1\n", - "print(\"and work input required,W in KJ/min\")\n", - "W=Q2-Q1\n", - "print(\"W=Q2-Q1\"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.2;pg no: 435" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.2, Page:435 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\n", - "refrigeration capacity or heat extraction rate(Q)in KJ/s\n", - "let the ice formation rate be m kg/s\n", - "heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\n", - "ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice= 6.25\n", - "COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\n", - "also COP=Q/W\n", - "so W=Q/COP in KJ/s\n", - "HP required 643.62\n", - "NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\n" - ] - } - ], - "source": [ - "#cal of HP required\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.2, Page:435 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2\")\n", - "Q=800.;#refrigeration capacity in tons\n", - "Q_latent=335.;#latent heat for ice formation from water in KJ/kg\n", - "T1=(-7.+273.);#temperature of reservoir 1 in K\n", - "T2=(27.+273.);#temperature of reservoir 2 in K\n", - "print(\"refrigeration capacity or heat extraction rate(Q)in KJ/s\")\n", - "Q=Q*3.5\n", - "print(\"let the ice formation rate be m kg/s\")\n", - "print(\"heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.\")\n", - "Q1=4.18*(27-0)+Q_latent\n", - "m=Q/Q1\n", - "print(\"ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice=\"),round(Q/Q1,2)\n", - "print(\"COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done\")\n", - "COP=T1/(T2-T1)\n", - "print(\"also COP=Q/W\")\n", - "print(\"so W=Q/COP in KJ/s\")\n", - "W=Q/COP\n", - "W=W/0.7457\n", - "print(\"HP required\"),round(W/0.7457,2)\n", - "print(\"NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.3;pg no: 436" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.3, Page:436 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\n", - "COP=T1/(T2-T1)=Q/W 1.56\n", - "equating,COP=T1/(T2-T1)\n", - "so temperature of surrounding(T2)in K\n", - "T2= 403.69\n" - ] - } - ], - "source": [ - "#cal of COP and temperature of surrounding\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.3, Page:436 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3\")\n", - "T1=(-27+273);#temperature of refrigerator in K\n", - "W=3*.7457;#work input in KJ/s\n", - "Q=1*3.5;#refrigeration effect in KJ/s\n", - "COP=Q/W\n", - "print(\"COP=T1/(T2-T1)=Q/W\"),round(COP,2)\n", - "COP=1.56;#approx.\n", - "print(\"equating,COP=T1/(T2-T1)\")\n", - "print(\"so temperature of surrounding(T2)in K\")\n", - "T2=T1+(T1/COP)\n", - "print(\"T2=\"),round(T2,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.4;pg no: 436" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.4, Page:436 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\n", - "during process 1-2_a\n", - "p2/p1=(T2_a/T1)^(y/(y-1))\n", - "so T2_a=T1*(p2/p1)^((y-1)/y)in K\n", - "theoretical temperature after compression,T2_a=440.18 K\n", - "for compression process,\n", - "n1=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+(T2_a-T1)/n1 in K\n", - "for expansion process,3-4_a\n", - "T4_a/T3=(p1/p2)^((y-1)/y)\n", - "so T4_a=T3*(p1/p2)^((y-1)/y) in K\n", - "n2=0.9=(T3-T4)/(T3-T4_a)\n", - "so T4=T3-(n2*(T3-T4_a))in K\n", - "so work during compression,W_C in KJ/s\n", - "W_C=m*Cp*(T2-T1)\n", - "work during expansion,W_T in KJ/s\n", - "W_T=m*Cp*(T3-T4)\n", - "refrigeration effect is realized during process,4-1.so refrigeration shall be,\n", - "Q_ref=m*Cp*(T1-T4) in KJ/s\n", - "Q_ref in ton 18.36\n", - "net work required(W)=W_C-W_T in KJ/s 111.59\n", - "COP= 0.58\n", - "so refrigeration capacity=18.36 ton or 64.26 KJ/s\n", - "and COP=0.57\n", - "NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\n" - ] - } - ], - "source": [ - "#cal of refrigeration capacity and COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.4, Page:436 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4\")\n", - "T1=(-30.+273.);#temperature of air at beginning of compression in K\n", - "T3=(27.+273.);#temperature of air after cooling in K\n", - "r=8.;#pressure ratio\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "y=1.4;#expansion constant \n", - "m=1.;#air flow rate in kg/s\n", - "n1=0.85;#isentropic efficiency for compression process\n", - "n2=.9;#isentropic efficiency for expansion process\n", - "print(\"during process 1-2_a\")\n", - "print(\"p2/p1=(T2_a/T1)^(y/(y-1))\")\n", - "print(\"so T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", - "T2_a=T1*(r)**((y-1)/y)\n", - "print(\"theoretical temperature after compression,T2_a=440.18 K\")\n", - "print(\"for compression process,\")\n", - "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", - "T2=T1+(T2_a-T1)/n1\n", - "print(\"for expansion process,3-4_a\")\n", - "print(\"T4_a/T3=(p1/p2)^((y-1)/y)\")\n", - "print(\"so T4_a=T3*(p1/p2)^((y-1)/y) in K\")\n", - "T4_a=T3*(1/r)**((y-1)/y)\n", - "print(\"n2=0.9=(T3-T4)/(T3-T4_a)\")\n", - "print(\"so T4=T3-(n2*(T3-T4_a))in K\")\n", - "T4=T3-(n2*(T3-T4_a))\n", - "print(\"so work during compression,W_C in KJ/s\")\n", - "print(\"W_C=m*Cp*(T2-T1)\")\n", - "W_C=m*Cp*(T2-T1)\n", - "print(\"work during expansion,W_T in KJ/s\")\n", - "print(\"W_T=m*Cp*(T3-T4)\")\n", - "W_T=m*Cp*(T3-T4)\n", - "print(\"refrigeration effect is realized during process,4-1.so refrigeration shall be,\")\n", - "print(\"Q_ref=m*Cp*(T1-T4) in KJ/s\")\n", - "Q_ref=m*Cp*(T1-T4)\n", - "Q_ref=Q_ref/3.5\n", - "print(\"Q_ref in ton\"),round(Q_ref,2)\n", - "W=W_C-W_T\n", - "print(\"net work required(W)=W_C-W_T in KJ/s\"),round(W,2)\n", - "Q_ref=64.26;\n", - "COP=Q_ref/(W_C-W_T)\n", - "print(\"COP=\"),round(COP,2)\n", - "print(\"so refrigeration capacity=18.36 ton or 64.26 KJ/s\")\n", - "print(\"and COP=0.57\")\n", - "print(\"NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.5;pg no: 437" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.5, Page:437 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\n", - "for isentropic compression process:\n", - "(p2/p1)^((y-1)/y)=T2/T1\n", - "so T2=T1*(p2/p1)^((y-1)/y) in K\n", - "for isenropic expansion process:\n", - "(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\n", - "so T4=T3/(p2/p1)^((y-1)/y) in K\n", - "heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\n", - "refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\n", - "so net work(W)=Q23-Q41 in KJ/kg\n", - "so COP=refrigeration effect/net work= 1.71\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.5, Page:437 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5\")\n", - "T1=(7+273);#temperature of refrigerated space in K\n", - "T3=(27+273);#temperature after compression in K\n", - "p1=1*10**5;#pressure of refrigerated space in pa\n", - "p2=5*10**5;#pressure after compression in pa\n", - "y=1.4;#expansion constant\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"for isentropic compression process:\")\n", - "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", - "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"for isenropic expansion process:\")\n", - "print(\"(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)\")\n", - "print(\"so T4=T3/(p2/p1)^((y-1)/y) in K\")\n", - "T4=T3/(p2/p1)**((y-1)/y)\n", - "print(\"heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg\")\n", - "Q23=Cp*(T2-T3)\n", - "print(\"refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg\")\n", - "Q41=Cp*(T1-T4)\n", - "print(\"so net work(W)=Q23-Q41 in KJ/kg\")\n", - "W=Q23-Q41\n", - "COP=Q41/W\n", - "print(\"so COP=refrigeration effect/net work=\"),round(COP,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.6;pg no: 438" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.6, Page:438 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\n", - "for process 1-2\n", - "(p2/p1)^((y-1)/y)=T2/T1\n", - "so T2=T1*(p2/p1)^((y-1)/y) in K\n", - "for process 3-4\n", - "(p3/p4)^((y-1)/y)=T3/T4\n", - "so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\n", - "refrigeration capacity(Q) in KJ/s= 63.25\n", - "Q in ton\n", - "work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\n", - "w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\n", - "HP required to run compressor 177.86\n", - "so HP required to run compressor=177.86 hp\n", - "net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\n", - "COP=refrigeration capacity/work=Q/W 1.59\n" - ] - } - ], - "source": [ - "#cal of refrigeration capacity,HP required to run compressor,COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.6, Page:438 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6\")\n", - "T1=(-10.+273.);#air entering temperature in K\n", - "p1=1.*10**5;#air entering pressure in pa\n", - "T3=(27.+273.);#compressed air temperature after cooling in K\n", - "p2=5.5*10**5;#pressure after compression in pa\n", - "m=0.8;#air flow rate in kg/s\n", - "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", - "y=1.4;#expansion constant\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"for process 1-2\")\n", - "print(\"(p2/p1)^((y-1)/y)=T2/T1\")\n", - "print(\"so T2=T1*(p2/p1)^((y-1)/y) in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"for process 3-4\")\n", - "print(\"(p3/p4)^((y-1)/y)=T3/T4\")\n", - "print(\"so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K\")\n", - "T4=T3/(p2/p1)**((y-1)/y)\n", - "Q=m*Cp*(T1-T4)\n", - "print(\"refrigeration capacity(Q) in KJ/s=\"),round(Q,2)\n", - "print(\"Q in ton\")\n", - "Q=Q/3.5\n", - "print(\"work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)\")\n", - "print(\"w=(m*n)*R*(T2-T1)/(n-1) in KJ/s\")\n", - "n=y;\n", - "w=(m*n)*R*(T2-T1)/(n-1)\n", - "print(\"HP required to run compressor\"),round(w/0.7457,2)\n", - "print(\"so HP required to run compressor=177.86 hp\")\n", - "print(\"net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s\")\n", - "W=m*Cp*((T2-T3)-(T1-T4))\n", - "Q=63.25;#refrigeration capacity in KJ/s\n", - "COP=Q/W\n", - "print(\"COP=refrigeration capacity/work=Q/W\"),round(COP,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.7;pg no: 440" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.7, Page:440 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\n", - "for process 1-2,n=1.45\n", - "T2/T1=(p2/p1)^((n-1)/n)\n", - "so T2=T1*(p2/p1)^((n-1)/n) in K\n", - "for process 3-4,n=1.3\n", - "T4/T3=(p4/p3)^((n-1)/n)\n", - "so T4=T3*(p4/p3)^((n-1)/n)in K\n", - "refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\n", - "Q=m*Cp*(T5-T4)\n", - "m in kg/s= 0.55\n", - "so air mass flow rate in cabin=0.55 kg/s\n", - "let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\n", - "m1*Cp*(T8-T7)=m*Cp*(T2-T3)\n", - "during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\n", - "so T7=T6*(p7/p6)^((n-1)/n) in K\n", - "substituting T2,T3,T7,T8 and m in energy balance on intercooler,\n", - "m1=m*(T2-T3)/(T8-T7)in kg/s\n", - "total ram air mass flow rate=m+m1 in kg/s 2.11\n", - "ram air mass flow rate=2.12 kg/s\n", - "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\n", - "COP=refrigeration effect/work input=Q/W 0.485\n" - ] - } - ], - "source": [ - "#cal of air mass flow rate in cabin,ram air mass flow rate,COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.7, Page:440 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7\")\n", - "p1=1.2*10**5;#pressure of ram air in pa\n", - "p6=p1;\n", - "T1=(15.+273.);#temperature of ram air in K\n", - "T6=T1;\n", - "p7=0.9*10**5;#pressure of ram air after expansion in pa\n", - "p3=4.*10**5;#pressure of ram air after compression in pa\n", - "p2=p3;\n", - "p4=1.*10**5;#pressure of ram air after expansion in second turbine in pa\n", - "T5=(25.+273.);#temperature of air when exhausted from cabin in K\n", - "T3=(50.+273.);#temperature of compressed air in K\n", - "T8=(30.+273.);#limited temperaure of ram air in K\n", - "Q=10.*3.5;#refrigeration capacity in KJ/s\n", - "Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K\n", - "print(\"for process 1-2,n=1.45\")\n", - "n=1.45;\n", - "print(\"T2/T1=(p2/p1)^((n-1)/n)\")\n", - "print(\"so T2=T1*(p2/p1)^((n-1)/n) in K\")\n", - "T2=T1*(p2/p1)**((n-1)/n)\n", - "print(\"for process 3-4,n=1.3\")\n", - "n=1.3;\n", - "print(\"T4/T3=(p4/p3)^((n-1)/n)\")\n", - "print(\"so T4=T3*(p4/p3)^((n-1)/n)in K\")\n", - "T4=T3*(p4/p3)**((n-1)/n)\n", - "print(\"refrigeration effect in passenger cabin with m kg/s mass flow rate of air.\")\n", - "print(\"Q=m*Cp*(T5-T4)\")\n", - "m=Q/(Cp*(T5-T4))\n", - "print(\"m in kg/s=\"),round(m,2)\n", - "print(\"so air mass flow rate in cabin=0.55 kg/s\")\n", - "print(\"let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,\")\n", - "print(\"m1*Cp*(T8-T7)=m*Cp*(T2-T3)\")\n", - "print(\"during process 6-7,T7/T6=(p7/p6)^((n-1)/n)\")\n", - "print(\"so T7=T6*(p7/p6)^((n-1)/n) in K\")\n", - "T7=T6*(p7/p6)**((n-1)/n)\n", - "print(\"substituting T2,T3,T7,T8 and m in energy balance on intercooler,\")\n", - "print(\"m1=m*(T2-T3)/(T8-T7)in kg/s\")\n", - "m1=m*(T2-T3)/(T8-T7)\n", - "print(\"total ram air mass flow rate=m+m1 in kg/s\"),round(m+m1,2)\n", - "print(\"ram air mass flow rate=2.12 kg/s\")\n", - "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\")\n", - "m=0.55;#approx.\n", - "W=m*Cp*(T2-T1)\n", - "COP=Q/W\n", - "print(\"COP=refrigeration effect/work input=Q/W\"),round(Q/W,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.8;pg no: 441" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.8, Page:441 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\n", - "considering index of compression and expansion as 1.4\n", - "during ramming action,process 0-1,\n", - "T1/To=(p1/po)^((y-1)/y)\n", - "T1=To*(p1/po)^((y-1)/y)in K\n", - "during compression process 1-2_a\n", - "T2_a/T1=(p2/p1)^((y-1)/y)\n", - "T2_a=T1*(p2/p1)^((y-1)/y)in K\n", - "n1=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+(T2_a-T1)/n1 in K\n", - "In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\n", - "subsequently for 10 degree celcius temperature drop in evaporator,\n", - "T4=T3-10 in K\n", - "expansion in cooling turbine during process 4-5;\n", - "T5_a/T4=(p5/p4)^((y-1)/y)\n", - "T5_a=T4*(p5/p4)^((y-1)/y)in K\n", - "n2=(T4-T5)/(T4-T5_a)\n", - "T5=T4-(T4-T5_a)*n2 in K\n", - "let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\n", - "Q=m*Cp*(T6-T5)\n", - "so m=Q/(Cp*(T6-T5))in kg/s\n", - "work input to compressor(W)=m*Cp*(T2-T1)in KJ/s 41.4\n", - "W in Hp\n", - "COP=refrigeration effect/work input=Q/W= 1.27\n", - "so COP=1.27\n", - "and HP required=55.48 hp\n" - ] - } - ], - "source": [ - "#cal of COP and HP required\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.8, Page:441 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8\")\n", - "po=0.9*10**5;#atmospheric air pressure in pa\n", - "To=(3.+273.);#temperature of atmospheric air in K\n", - "p1=1.*10**5;#pressure due to ramming air in pa\n", - "p2=4.*10**5;#pressure when air leaves compressor in pa\n", - "p3=p2;\n", - "p4=p3;\n", - "p5=1.03*10**5;#pressure maintained in passenger cabin in pa\n", - "T6=(25.+273.);#temperature of air leaves cabin in K\n", - "Q=15.*3.5;#refrigeration capacity of aeroplane in KJ/s\n", - "n1=0.9;#isentropic efficiency of compressor\n", - "n2=0.8;#isentropic efficiency of turbine\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"considering index of compression and expansion as 1.4\")\n", - "y=1.4;\n", - "print(\"during ramming action,process 0-1,\")\n", - "print(\"T1/To=(p1/po)^((y-1)/y)\")\n", - "print(\"T1=To*(p1/po)^((y-1)/y)in K\")\n", - "T1=To*(p1/po)**((y-1)/y)\n", - "print(\"during compression process 1-2_a\")\n", - "print(\"T2_a/T1=(p2/p1)^((y-1)/y)\")\n", - "print(\"T2_a=T1*(p2/p1)^((y-1)/y)in K\")\n", - "T2_a=T1*(p2/p1)**((y-1)/y)\n", - "print(\"n1=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+(T2_a-T1)/n1 in K\")\n", - "T2=T1+(T2_a-T1)/n1\n", - "print(\"In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K\")\n", - "T3=0.34*T2\n", - "print(\"subsequently for 10 degree celcius temperature drop in evaporator,\")\n", - "print(\"T4=T3-10 in K\")\n", - "T4=T3-10\n", - "print(\"expansion in cooling turbine during process 4-5;\")\n", - "print(\"T5_a/T4=(p5/p4)^((y-1)/y)\")\n", - "print(\"T5_a=T4*(p5/p4)^((y-1)/y)in K\")\n", - "T5_a=T4*(p5/p4)**((y-1)/y)\n", - "print(\"n2=(T4-T5)/(T4-T5_a)\")\n", - "print(\"T5=T4-(T4-T5_a)*n2 in K\")\n", - "T5=T4-(T4-T5_a)*n2\n", - "print(\"let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.\")\n", - "print(\"Q=m*Cp*(T6-T5)\")\n", - "print(\"so m=Q/(Cp*(T6-T5))in kg/s\")\n", - "m=Q/(Cp*(T6-T5))\n", - "W=m*Cp*(T2-T1)\n", - "print(\"work input to compressor(W)=m*Cp*(T2-T1)in KJ/s\"),round(W,2)\n", - "print(\"W in Hp\")\n", - "W=W/.7457\n", - "W=41.37;#work input to compressor in KJ/s\n", - "COP=Q/W\n", - "print(\"COP=refrigeration effect/work input=Q/W=\"),round(COP,2)\n", - "print(\"so COP=1.27\")\n", - "print(\"and HP required=55.48 hp\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.9;pg no: 443" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.9, Page:443 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\n", - "properties of NH3,\n", - "at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\n", - "and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\n", - "here work done,W=Area 1-2-3-9-1\n", - "refrigeration effect=Area 1-5-6-4-1\n", - "Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\n", - "so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\n", - "during throttling process between 3 and 4,h3=h4\n", - "(Area=3-11-7-3)=(Area 4-9-11-6-4)\n", - "(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\n", - "(Area 3-8-9)=(Area 4-6-7-8-4)\n", - "so (Area 4-6-7-8-4)=12.09 KJ/kg\n", - "also,(Area 4-6-7-8-4)=T1*(s4-s8)\n", - "so (s4-s8)in KJ/kg K=\n", - "also s3=s8=0.3386 KJ/kg K\n", - "so s4 in KJ/kg K=\n", - "also s1=s2=4.4809 KJ/kg K\n", - "refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\n", - "work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\n", - "so COP=refrigeration effect/work done= 5.94\n", - "so COP=5.94\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.9, Page:443 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9\")\n", - "print(\"properties of NH3,\")\n", - "print(\"at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K\")\n", - "T1=(-15+273);\n", - "h9=-54.51;\n", - "hg=1303.74;\n", - "s9=-0.2132;\n", - "sg=5.0536;\n", - "print(\"and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K\")\n", - "T2=(25+273);\n", - "h3=99.94;\n", - "h2=1317.95;\n", - "s3=0.3386;\n", - "s2=4.4809;\n", - "print(\"here work done,W=Area 1-2-3-9-1\")\n", - "print(\"refrigeration effect=Area 1-5-6-4-1\")\n", - "print(\"Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)\")\n", - "print(\"so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg\")\n", - "h3-h9-T1*(s3-s9)\n", - "print(\"during throttling process between 3 and 4,h3=h4\")\n", - "print(\"(Area=3-11-7-3)=(Area 4-9-11-6-4)\")\n", - "print(\"(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)\")\n", - "print(\"(Area 3-8-9)=(Area 4-6-7-8-4)\")\n", - "print(\"so (Area 4-6-7-8-4)=12.09 KJ/kg\")\n", - "print(\"also,(Area 4-6-7-8-4)=T1*(s4-s8)\")\n", - "print(\"so (s4-s8)in KJ/kg K=\")\n", - "12.09/T1\n", - "print(\"also s3=s8=0.3386 KJ/kg K\")\n", - "s8=s3;\n", - "print(\"so s4 in KJ/kg K=\")\n", - "s4=s8+12.09/T1\n", - "print(\"also s1=s2=4.4809 KJ/kg K\")\n", - "s1=s2;\n", - "print(\"refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg\")\n", - "Q=T1*(s1-s4)\n", - "print(\"work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg\")\n", - "W=12.09+((T2-T1)*(s1-s8))\n", - "COP=Q/W\n", - "print(\"so COP=refrigeration effect/work done=\"),round(COP,2)\n", - "print(\"so COP=5.94\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.10;pg no: 445" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.10, Page:445 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\n", - "properties of Freon-12,\n", - "at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\n", - "at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\n", - "during expansion(throttling)between 3 and 4\n", - "h3=h4=hf_40oc=74.53 KJ/kg=h4\n", - "process 1-2 is adiabatic compression so,\n", - "s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\n", - "at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\n", - "T2=313*exp((s1-sg)/Cpg)in K\n", - "so temperature after compression,T2=324.17 K\n", - "enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\n", - "compression work required,per kg(Wc)=h2-h1 in KJ/kg\n", - "refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\n", - "mass flow rate of refrigerant,m=Q/q in kg/s\n", - "COP=q/Wc 3.17452\n", - "volumetric efficiency of reciprocating compressor,given C=0.02\n", - "n_vol=1+C-C*(P2/P1)^(1/n)\n", - "let piston printlacement by V,m^3\n", - "mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\n", - "so V in cm^3= 569.43\n", - "so COP=3.175\n", - "and piston printlacement=569.45 cm^3\n" - ] - } - ], - "source": [ - "#cal of COP and piston printlacement\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.10, Page:445 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10\")\n", - "Q=2.86*3.5;#refrigeration effect in KJ/s\n", - "N=1200;#compressor rpm\n", - "n=1.13;#compression index\n", - "print(\"properties of Freon-12,\")\n", - "print(\"at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K\")\n", - "P1=1.51;\n", - "T1=(-20+273);\n", - "vg=0.1088;\n", - "h1=178.61;\n", - "s1=0.7082;\n", - "s2=s1;\n", - "print(\"at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K\")\n", - "P2=9.61;\n", - "h3=74.53;\n", - "h4=h3;\n", - "hg=203.05;\n", - "sf=0.2716;\n", - "sg=0.682;\n", - "Cpf=0.976;\n", - "Cpg=0.747;\n", - "print(\"during expansion(throttling)between 3 and 4\")\n", - "print(\"h3=h4=hf_40oc=74.53 KJ/kg=h4\")\n", - "print(\"process 1-2 is adiabatic compression so,\")\n", - "print(\"s1=s2,s1=sg_-20oc=0.7082 KJ/kg K\")\n", - "print(\"at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)\")\n", - "print(\"T2=313*exp((s1-sg)/Cpg)in K\")\n", - "T2=313*math.exp((s1-sg)/Cpg)\n", - "print(\"so temperature after compression,T2=324.17 K\")\n", - "print(\"enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg\")\n", - "h2=hg+Cpg*(T2-313)\n", - "print(\"compression work required,per kg(Wc)=h2-h1 in KJ/kg\")\n", - "Wc=h2-h1\n", - "print(\"refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg\")\n", - "q=h1-h4\n", - "print(\"mass flow rate of refrigerant,m=Q/q in kg/s\")\n", - "m=Q/q\n", - "m=0.096;#approx.\n", - "COP=q/Wc\n", - "print(\"COP=q/Wc\"),round(COP,5)\n", - "print(\"volumetric efficiency of reciprocating compressor,given C=0.02\")\n", - "C=0.02;\n", - "print(\"n_vol=1+C-C*(P2/P1)^(1/n)\")\n", - "n_vol=1+C-C*(P2/P1)**(1/n)\n", - "print(\"let piston printlacement by V,m^3\")\n", - "print(\"mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)\")\n", - "V=(m*60*vg)*10**6/(N*n_vol)\n", - "print(\"so V in cm^3=\"),round(V,2)\n", - "print(\"so COP=3.175\")\n", - "print(\"and piston printlacement=569.45 cm^3\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.11;pg no: 447" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.11, Page:447 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\n", - "properties of CO2,\n", - "at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\n", - "at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\n", - "processes of vapour compression cycle are shown on T-s diagram\n", - "1-2:isentropic compression process\n", - "2-3-4:condensation process\n", - "4-5:isenthalpic expansion process\n", - "5-1:refrigeration process in evaporator\n", - "h1=hg at -10oc=322.28 KJ/kg\n", - "at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\n", - "entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\n", - "entropy during isentropic process,s1=s2\n", - "at -10 degree celcius,s2=sf+x1*sfg\n", - "so x1=(s2-sf)/(sg-sf)\n", - "enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\n", - "h3=hf at 20oc=144.11 KJ/kg\n", - "since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\n", - "also,h4=h5=115.22 KJ/kg\n", - "refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\n", - "let refrigerant flow rate be m kg/s\n", - "refrigerant effect(Q)=m*q\n", - "m=Q/q in kg/s 0.01016\n", - "compressor work,Wc=h2-h1 in KJ/kg\n", - "COP=refrigeration effect per kg/compressor work per kg= 6.51\n", - "so COP=6.51,mass flow rate=0.01016 kg/s\n", - "NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \n" - ] - } - ], - "source": [ - "#cal of COP and mass flow rate\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.11, Page:447 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11\")\n", - "Q=2;#refrigeration effect in KW\n", - "print(\"properties of CO2,\")\n", - "print(\"at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K\")\n", - "T1=(20.+273.);#condensation temperature in K\n", - "P1=57.27;\n", - "h3=144.11;\n", - "hg=299.62;\n", - "sf=0.523;\n", - "sg_20oc=1.0527;\n", - "Cpf=2.889;\n", - "Cpg=2.135;\n", - "print(\"at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K\")\n", - "T2=(-10+273);#evaporator temperature in K\n", - "P2=26.49;\n", - "vg=0.014;\n", - "hf=60.78;\n", - "h1=322.28;\n", - "sf=0.2381;\n", - "sg=1.2324;\n", - "print(\"processes of vapour compression cycle are shown on T-s diagram\")\n", - "print(\"1-2:isentropic compression process\")\n", - "print(\"2-3-4:condensation process\")\n", - "print(\"4-5:isenthalpic expansion process\")\n", - "print(\"5-1:refrigeration process in evaporator\")\n", - "print(\"h1=hg at -10oc=322.28 KJ/kg\")\n", - "print(\"at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg\")\n", - "h2=hg+Cpg*(40.-20.)\n", - "print(\"entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K\")\n", - "s2=sg_20oc+Cpg*math.log((273.+40.)/(273.+20.))\n", - "print(\"entropy during isentropic process,s1=s2\")\n", - "print(\"at -10 degree celcius,s2=sf+x1*sfg\")\n", - "print(\"so x1=(s2-sf)/(sg-sf)\")\n", - "x1=(s2-sf)/(sg-sf)\n", - "print(\"enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg\")\n", - "h1=hf+x1*(h1-hf)\n", - "print(\"h3=hf at 20oc=144.11 KJ/kg\")\n", - "print(\"since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg\")\n", - "h4=h3-Cpf*(20.-10.)\n", - "print(\"also,h4=h5=115.22 KJ/kg\")\n", - "h5=h4;\n", - "print(\"refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg\")\n", - "q=(h1-h5)\n", - "print(\"let refrigerant flow rate be m kg/s\")\n", - "print(\"refrigerant effect(Q)=m*q\")\n", - "m=Q/q\n", - "print(\"m=Q/q in kg/s\"),round(m,5)\n", - "print(\"compressor work,Wc=h2-h1 in KJ/kg\")\n", - "Wc=h2-h1\n", - "COP=q/Wc\n", - "print(\"COP=refrigeration effect per kg/compressor work per kg=\"),round(COP,2)\n", - "print(\"so COP=6.51,mass flow rate=0.01016 kg/s\")\n", - "print(\"NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. \")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.12;pg no: 448" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.12, Page:448 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\n", - "here pressure of atmospheric air(P)may be taken as 1.013 bar\n", - "specific humidity,omega=0.622*(Pv/(P-Pv))\n", - "so partial pressure of vapour(Pv)in bar\n", - "Pv in bar= 0.0254\n", - "relative humidity(phi)=(Pv/Pv_sat)\n", - "from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\n", - "so phi=Pv/Pv_sat 0.82\n", - "in percentage 81.99\n", - "so partial pressure of vapour=0.0254 bar\n", - "relative humidity=81.98 %\n" - ] - } - ], - "source": [ - "#cal of partial pressure of vapour and relative humidity\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.12, Page:448 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12\")\n", - "omega=0.016;#specific humidity in gm/gm of air\n", - "print(\"here pressure of atmospheric air(P)may be taken as 1.013 bar\")\n", - "P=1.013;#pressure of atmospheric air in bar\n", - "print(\"specific humidity,omega=0.622*(Pv/(P-Pv))\")\n", - "print(\"so partial pressure of vapour(Pv)in bar\")\n", - "Pv=P/(1+(0.622/omega))\n", - "print(\"Pv in bar=\"),round(Pv,4)\n", - "Pv=0.0254;#approx.\n", - "print(\"relative humidity(phi)=(Pv/Pv_sat)\")\n", - "print(\"from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar\")\n", - "Pv_sat=0.03098;\n", - "phi=Pv/Pv_sat\n", - "print(\"so phi=Pv/Pv_sat\"),round(phi,2)\n", - "print(\"in percentage\"),round(phi*100,2)\n", - "print(\"so partial pressure of vapour=0.0254 bar\")\n", - "print(\"relative humidity=81.98 %\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.13;pg no: 449" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.13, Page:449 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\n", - "at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\n", - "partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar 0.03\n", - "partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour 0.99\n", - "so partial pressure of air=0.9875 bar\n", - "humidity ratio,omega in kg/kg of dry air= 0.01606\n", - "so humidity ratio=0.01606 kg/kg of air\n", - "Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\n", - "so Dew point temperature=21.4 degree celcius\n", - "density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\n", - "rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\n", - "rho_m in kg/m^3= 1.1836\n", - "so density = 1.1835 kg/m^3\n", - "enthalpy of mixture,h in KJ/kg of dry air= 71.21\n", - "enthalpy of mixture =71.2 KJ/kg of dry air\n" - ] - } - ], - "source": [ - "#cal of partial pressure,humidity ratio,Dew point temperature,density and enthalpy of mixture\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.13, Page:449 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13\")\n", - "r=0.6;#relative humidity\n", - "P=1.013;#total pressure of mixture in bar\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Ta=(30+273);#room temperature in K\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg degree celcius\n", - "print(\"at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar\")\n", - "Pv_sat=0.0425;\n", - "Pv=r*Pv_sat\n", - "print(\"partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar\"),round(Pv,2)\n", - "Pa=P-Pv\n", - "print(\"partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour\"),round(Pa,2)\n", - "print(\"so partial pressure of air=0.9875 bar\")\n", - "omega=0.622*Pv/(P-Pv)\n", - "print(\"humidity ratio,omega in kg/kg of dry air=\"),round(omega,5)\n", - "print(\"so humidity ratio=0.01606 kg/kg of air\")\n", - "print(\"Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation\")\n", - "print(\"so Dew point temperature=21.4 degree celcius\")\n", - "print(\"density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)\")\n", - "print(\"rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)\")\n", - "rho_m=P*100*(1+omega)/(R*Ta)\n", - "print(\"rho_m in kg/m^3=\"),round(rho_m,4)\n", - "print(\"so density = 1.1835 kg/m^3\")\n", - "T=30;#room temperature in degree celcius\n", - "hg=2540.1;#enthalpy at 30 degree celcius in KJ/kg\n", - "h=Cp*T+omega*(hg+1.860*(30-21.4))\n", - "print(\"enthalpy of mixture,h in KJ/kg of dry air=\"),round(h,2)\n", - "print(\"enthalpy of mixture =71.2 KJ/kg of dry air\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.14;pg no: 449" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.14, Page:449 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\n", - "initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\n", - "omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\n", - "mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\n", - "mass flow rate of air(ma)=0.8/v2 in kg/s\n", - "total mass of water added=ma*(omega2-omega1)in kg/s 0.001311\n", - "heat transferred in KJ/s= 12.18\n", - "so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\n" - ] - } - ], - "source": [ - "#cal of mass of water added and heat transferred\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.14, Page:449 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14\")\n", - "print(\"initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.\")\n", - "print(\"omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg\")\n", - "omega1=0.0086;\n", - "h1=37.;\n", - "omega2=0.01;\n", - "h2=50.;\n", - "v2=0.854;\n", - "print(\"mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air\")\n", - "omega2-omega1\n", - "print(\"mass flow rate of air(ma)=0.8/v2 in kg/s\")\n", - "ma=0.8/v2\n", - "print(\"total mass of water added=ma*(omega2-omega1)in kg/s\"),round(ma*(omega2-omega1),6)\n", - "print(\"heat transferred in KJ/s=\"),round(ma*(h2-h1),2)\n", - "print(\"so mass of water added=0.001312 kg/s,heat transferred=12.18 KW\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.15;pg no: 451" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.15, Page:451 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\n", - "Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\n", - "For moist air stream at 30 degree celcius and 30% relative humidity.\n", - "phi1=Pv1/Pv_sat_30oc\n", - "here Pv_sat_30oc=0.04246 bar\n", - "so Pv1=phi1*Pv_sat_30oc in bar\n", - "corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\n", - "specific humidity,omega1 in kg/kg of air= 0.00792\n", - "at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\n", - "h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\n", - "for second moist air stream at 35oc and 85% relative humidity\n", - "phi2=Pv2/Pv_sat_35oc\n", - "here Pv_sat_35oc=0.005628 bar\n", - "so Pv2=phi2*Pv_sat_35oc in bar\n", - "specific humidity,omega2 in kg/kg of air= 0.00295\n", - "corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\n", - "so,enthalpy of second stream,\n", - "h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\n", - "enthalpy of mixture after adiabatic mixing,\n", - "=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\n", - "mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\n", - "specific humidity of mixture(omega)in kg/kg of dry air= 0.00592\n", - "omega=0.622*Pv/(P-Pv)\n", - "Pv in bar= 0.00956\n", - "partial pressure of water vapour=0.00957 bar\n", - "so specific humidity of mixture=0.00593 kg/kg dry air\n", - "and partial pressure of water vapour in mixture=0.00957 bar\n" - ] - } - ], - "source": [ - "#cal of specific humidity and partial pressure of water vapour in mixture\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.15, Page:451 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15\")\n", - "P=1.013;#atmospheric pressure in bar\n", - "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", - "Cp_stream=1.86;#specific heat of stream at constant pressure in KJ/kg K\n", - "T1=30.;#temperature of first stream of moist air in K\n", - "m1=3.;#mass flow rate of first stream in kg/s \n", - "T2=35.;#temperature of second stream of moist air in K\n", - "m2=2.;#mass flow rate of second stream in kg/s \n", - "print(\"Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.\")\n", - "print(\"For moist air stream at 30 degree celcius and 30% relative humidity.\")\n", - "phi1=0.3;\n", - "print(\"phi1=Pv1/Pv_sat_30oc\")\n", - "print(\"here Pv_sat_30oc=0.04246 bar\")\n", - "Pv_sat_30oc=0.04246;\n", - "print(\"so Pv1=phi1*Pv_sat_30oc in bar\")\n", - "Pv1=phi1*Pv_sat_30oc\n", - "print(\"corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius\")\n", - "Tdp1=10.5;\n", - "omega1=0.622*Pv1/(P-Pv1)\n", - "print(\"specific humidity,omega1 in kg/kg of air=\"),round(omega1,5)\n", - "print(\"at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg\")\n", - "hg=2520.7;#enthalpy at 10.5 degree celcius in KJ/kg\n", - "print(\"h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air\")\n", - "h1=Cp_air*T1+omega1*(hg-Cp_stream*(T1-Tdp1))\n", - "print(\"for second moist air stream at 35oc and 85% relative humidity\")\n", - "phi2=0.85;\n", - "print(\"phi2=Pv2/Pv_sat_35oc\")\n", - "print(\"here Pv_sat_35oc=0.005628 bar\")\n", - "Pv_sat_35oc=0.005628;\n", - "print(\"so Pv2=phi2*Pv_sat_35oc in bar\")\n", - "Pv2=phi2*Pv_sat_35oc\n", - "omega2=0.622*Pv2/(P-Pv2)\n", - "print(\"specific humidity,omega2 in kg/kg of air=\"),round(omega2,5)\n", - "print(\"corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius\")\n", - "Tdp2=32.;\n", - "print(\"so,enthalpy of second stream,\")\n", - "print(\"h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air\")\n", - "hg=2559.9;#enthalpy at 32 degree celcius in KJ/kg\n", - "h2=Cp_air*T2+omega2*(hg+Cp_stream*(T2-Tdp2))\n", - "print(\"enthalpy of mixture after adiabatic mixing,\")\n", - "print(\"=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air\")\n", - "(1./(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2)))\n", - "print(\"mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air\")\n", - "(1./5.)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))\n", - "omega=0.00589/(1-0.005893)\n", - "print(\"specific humidity of mixture(omega)in kg/kg of dry air=\"),round(omega,5)\n", - "print(\"omega=0.622*Pv/(P-Pv)\")\n", - "Pv=omega*P/(omega+0.622)\n", - "print(\"Pv in bar=\"),round(Pv,5)\n", - "print(\"partial pressure of water vapour=0.00957 bar\")\n", - "print(\"so specific humidity of mixture=0.00593 kg/kg dry air\")\n", - "print(\"and partial pressure of water vapour in mixture=0.00957 bar\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 11.16;pg no: 452" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 11.16, Page:452 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\n", - "The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\n", - "h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\n", - "final state 2 has,h2=52 KJ/kg\n", - "mass of air(m)=m1/v1 in kg/s\n", - "amount of heat added(Q)in KJ/s\n", - "Q=m*(h2-h1) 56.78\n" - ] - } - ], - "source": [ - "#cal of amount of heat added\n", - "#intiation of all variables\n", - "# Chapter 11\n", - "import math\n", - "print\"Example 11.16, Page:452 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16\")\n", - "m1=3;#rate at which moist air enter in heating coil in m^3/s\n", - "print(\"The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,\")\n", - "print(\"h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg\")\n", - "h1=36.4;\n", - "omega1=0.0086;\n", - "v1=0.825;\n", - "print(\"final state 2 has,h2=52 KJ/kg\")\n", - "h2=52;\n", - "print(\"mass of air(m)=m1/v1 in kg/s\")\n", - "m=m1/v1\n", - "m=3.64;#approx.\n", - "print(\"amount of heat added(Q)in KJ/s\")\n", - "Q=m*(h2-h1)\n", - "print(\"Q=m*(h2-h1)\"),round(Q,2)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter12.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter12.ipynb deleted file mode 100755 index f89e1b1a..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter12.ipynb +++ /dev/null @@ -1,818 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 12:Introduction to Heat Transfer" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.1;pg no: 483" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.1, Page:483 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\n", - "here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\n", - "overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\n", - "(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\n", - "so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", - "rate of heat transfer,Q in W= 10590.0\n", - "so rate of heat transfer=10590 W\n", - "heat transfer across states 1 and 3(at interface).\n", - "overall heat transfer coefficient between 1 and 3\n", - "(1/U1)=(1/h1)+(deltax_brick/k_brick)\n", - "so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\n", - "Q=U1*A*(T1-T3)\n", - "so T3=T1-(Q/(U1*A))in degree celcius 44.7\n", - "so temperature at interface of brick and wood =44.71 degree celcius\n" - ] - } - ], - "source": [ - "#cal of rate of heat transfer and temperature at interface of brick and wood\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.1, Page:483 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\")\n", - "h1=30.;#heat transfer coefficient on side of 50 oc in W/m^2 K\n", - "h5=10.;#heat transfer coefficient on side of 20 oc in W/m^2 K\n", - "k_brick=0.9;#conductivity of brick in W/m K\n", - "k_wood=0.15;#conductivity of wood in W/m K\n", - "T1=50.;#temperature of air on one side of wall in degree celcius\n", - "T5=20.;#temperature of air on other side of wall in degree celcius\n", - "A=100.;#surface area in m^2\n", - "deltax_brick=1.5*10**-2;#length of brick in m\n", - "deltax_wood=2*10**-2;#length of wood in m\n", - "print(\"here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\")\n", - "print(\"overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\")\n", - "print(\"(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\")\n", - "print(\"so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\")\n", - "U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", - "U=3.53;#approx.\n", - "Q=U*A*(T1-T5)\n", - "print(\"rate of heat transfer,Q in W=\"),round(Q,2)\n", - "print(\"so rate of heat transfer=10590 W\")\n", - "print(\"heat transfer across states 1 and 3(at interface).\")\n", - "print(\"overall heat transfer coefficient between 1 and 3\")\n", - "print(\"(1/U1)=(1/h1)+(deltax_brick/k_brick)\")\n", - "print(\"so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\")\n", - "U1=1/((1/h1)+(deltax_brick/k_brick))\n", - "print(\"Q=U1*A*(T1-T3)\")\n", - "T3=T1-(Q/(U1*A))\n", - "print(\"so T3=T1-(Q/(U1*A))in degree celcius\"),round(T3,2)\n", - "print(\"so temperature at interface of brick and wood =44.71 degree celcius\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.2;pg no: 484" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.2, Page:484 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\n", - "here thermal resistances are\n", - "R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\n", - "R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\n", - "R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\n", - "R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\n", - "R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\n", - "overall heat transfer coefficient for one dimentional steady state heat transfer\n", - "(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\n", - "so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\n", - "rate of heat transfer(Q) in KJ/m^2 hr= 112.0\n", - "wall surface area(A) in m^2\n", - "so rate of heat transfer=112 KJ/m^2 hr \n", - "Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\n", - "Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\n", - "substituting,T2 in degree celcius= 23.6\n", - "so temperature of outer wall,T2=23.6 oc\n", - "T3 in degree= 23.6\n", - "so temperature at interface of outer steel wall and wool,T3=23.59 oc\n", - "T4 in degree celcius= 6.1\n", - "so temperature at interface of wool and inside steel wall,T4=6.09 oc\n", - "T5 in degree celcius= 6.1\n", - "so temperature at inside of inner steel wall,T5=6.08 oc\n" - ] - } - ], - "source": [ - "#cal of rate of heat transfer,temperatures\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.2, Page:484 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\")\n", - "h1=40;#average heat transfer coefficient at inner surface in KJ/m^2 hr oc\n", - "h6=50;#average heat transfer coefficient at outer surface in KJ/m^2 hr oc\n", - "deltax_steel=2*10**-3;#mild steel sheets thickness in m\n", - "deltax_wool=5*10**-2;#thickness of glass wool insulation in m\n", - "k_wool=0.16;#thermal conductivity of wool in KJ/m hr\n", - "k_steel=160;#thermal conductivity of steel in KJ/m hr\n", - "T1=25;#kitchen temperature in degree celcius\n", - "T6=5;#refrigerator temperature in degree celcius\n", - "print(\"here thermal resistances are\")\n", - "print(\"R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\")\n", - "print(\"R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\")\n", - "print(\"R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\")\n", - "print(\"R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\")\n", - "print(\"R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\")\n", - "print(\"overall heat transfer coefficient for one dimentional steady state heat transfer\")\n", - "print(\"(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\")\n", - "print(\"so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\")\n", - "U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))\n", - "U=2.8;#approx.\n", - "A=4*(1*0.5)\n", - "Q=U*A*(T1-T6)\n", - "print(\"rate of heat transfer(Q) in KJ/m^2 hr=\"),round(Q,2)\n", - "print(\"wall surface area(A) in m^2\")\n", - "print(\"so rate of heat transfer=112 KJ/m^2 hr \")\n", - "print(\"Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\")\n", - "print(\"Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\")\n", - "T2=T1-(Q/(A*h1))\n", - "print(\"substituting,T2 in degree celcius=\"),round(T2,1)\n", - "print(\"so temperature of outer wall,T2=23.6 oc\")\n", - "T3=T2-(Q*deltax_steel/(k_steel*A))\n", - "print(\"T3 in degree= \"),round(T3,2)\n", - "print(\"so temperature at interface of outer steel wall and wool,T3=23.59 oc\")\n", - "T4=T3-(Q*deltax_wool/(k_wool*A))\n", - "print(\"T4 in degree celcius=\"),round(T4,2)\n", - "print(\"so temperature at interface of wool and inside steel wall,T4=6.09 oc\")\n", - "T5=T4-(Q*deltax_steel/(k_steel*A))\n", - "print(\"T5 in degree celcius=\"),round(T5,2)\n", - "print(\"so temperature at inside of inner steel wall,T5=6.08 oc\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.3;pg no: 486" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.3, Page:486 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\n", - "here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\n", - "Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\n", - "so heat loss per meter from pipe in KJ/hr= 1479.77\n", - "heat loss from 5 m length(Q) in KJ/hr 7396.7\n", - "enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\n", - "mass flow of steam(m)in kg/hr\n", - "final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\n", - "let quality of steam at exit be x,\n", - "also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\n", - "h=hf+x*hfg\n", - "so x=(h-hf)/hfg 0.8245\n", - "so quality of steam at exit=0.8245\n" - ] - } - ], - "source": [ - "#cal of heat loss per meter from pipe and quality of steam\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.3, Page:486 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\")\n", - "k_insulation=0.3;#thermal conductivity of insulation in KJ/m hr oc\n", - "k_pipe=209;#thermal conductivity of pipe in KJ/m hr oc\n", - "T1=300;#temperature of inner surface of steam pipe in degree celcius\n", - "T3=50;#temperature of outer surface of insulation layer in degree celcius\n", - "r1=15*10**-2/2;#steam pipe inner radius without insulation in m\n", - "r2=16*10**-2/2;#steam pipe outer radius without insulation in m\n", - "r3=22*10**-2/2;#radius with insulation in m\n", - "m=0.5;#steam entering rate in kg/min\n", - "print(\"here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\")\n", - "print(\"Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\")\n", - "L=1;\n", - "Q=(T1-T3)*2*math.pi*L/((1/k_pipe)*math.log(r2/r1)+(1/k_insulation*math.log(r3/r2)))\n", - "print(\"so heat loss per meter from pipe in KJ/hr=\"),round(Q,2)\n", - "Q=5*Q\n", - "print(\"heat loss from 5 m length(Q) in KJ/hr\"),round(5*1479.34,2)\n", - "print(\"enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\")\n", - "hg=2749;\n", - "print(\"mass flow of steam(m)in kg/hr\")\n", - "m=m*60\n", - "print(\"final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\")\n", - "h=hg-(Q/m)\n", - "print(\"let quality of steam at exit be x,\")\n", - "print(\"also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\")\n", - "hf=1344;\n", - "hfg=1404.9;\n", - "print(\"h=hf+x*hfg\")\n", - "x=(h-hf)/hfg\n", - "print(\"so x=(h-hf)/hfg\"),round(x,4)\n", - "print(\"so quality of steam at exit=0.8245\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.4;pg no: 487" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.4, Page:487 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\n", - "considering one dimensional heat transfer of steady state type\n", - "for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr 168892.02\n", - "so heat transfer rate=168892.02 KJ/hr\n", - "heat flux in KJ/m^2 hr= 23893.33\n", - "so heat flux=23893.33 KJ/m^2 hr\n" - ] - } - ], - "source": [ - "#cal of amount of heat transfer and heat flux\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.4, Page:487 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\")\n", - "r1=150.*10**-2/2;#inner radius in m\n", - "r2=200.*10**-2/2;#outer radius in m\n", - "k=28.;#thermal conductivity in KJ m hr oc\n", - "T1=200.;#inside surface temperature in degree celcius\n", - "T2=40.;#outer surface temperature in degree celcius\n", - "print(\"considering one dimensional heat transfer of steady state type\")\n", - "Q=(T1-T2)*4*math.pi*k*r1*r2/(r2-r1)\n", - "print(\"for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr\"),round(Q,2)\n", - "print(\"so heat transfer rate=168892.02 KJ/hr\")\n", - "Q/(4*math.pi*r1**2)\n", - "print(\"heat flux in KJ/m^2 hr=\"),round(Q/(4*math.pi*r1**2),2)\n", - "print(\"so heat flux=23893.33 KJ/m^2 hr\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.5;pg no: 487" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.5, Page:487 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\n", - "R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\n", - "R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\n", - "R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\n", - "total thermal resistance,R_total=R1+R2+R3 in oc/W\n", - "so rate of heat transfer,Q=(T1-T4)/R_total in W 118.03\n", - "heat transfer rate from inside of room to inside surface of glass window.\n", - "Q=(T1-T2)/R1\n", - "so T2=T1-Q*R1 in degree celcius 9.26\n", - "Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\n" - ] - } - ], - "source": [ - "#cal of heat transfer rate\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.5, Page:487 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\")\n", - "T1=25.;#room temperature in degree celcius\n", - "T4=2.;#winter outside temperature in degree celcius\n", - "h1=10.;#heat transfer coefficient on inner window surfaces in W/m^2 oc\n", - "h4=30.;#heat transfer coefficient on outer window surfaces in W/m^2 oc\n", - "k=0.78;#thermal conductivity of glass in W/m^2 oc\n", - "A=75.*10**-2*100.*10**-2;#area in m^2\n", - "deltax=10.*10**-3;#glass thickness in m\n", - "print(\"R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\")\n", - "print(\"R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\")\n", - "print(\"R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\")\n", - "print(\"total thermal resistance,R_total=R1+R2+R3 in oc/W\")\n", - "R_total=1/(h1*A)+deltax/(k*A)+1/(h4*A)\n", - "Q=(T1-T4)/R_total\n", - "print(\"so rate of heat transfer,Q=(T1-T4)/R_total in W\"),round(Q,2)\n", - "print(\"heat transfer rate from inside of room to inside surface of glass window.\")\n", - "R1=(1/7.5);\n", - "T2=T1-Q*R1\n", - "print(\"Q=(T1-T2)/R1\")\n", - "print(\"so T2=T1-Q*R1 in degree celcius\"),round(T2,2)\n", - "print(\"Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\") \n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.6;pg no: 488" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.6, Page:488 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\n", - "reynolds number,Re=V*D/v\n", - "subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\n", - "or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\n", - "so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\n", - "rate of heat transfer due to convection,Q in W \n", - "Q=h*A*(T2-T1)= 61259.36\n", - "so heat transfer rate=61259.38 W\n" - ] - } - ], - "source": [ - "#cal of heat transfer rate\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.6, Page:488 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\")\n", - "D=4*10**-2;#inner diameter in m\n", - "L=3;#length in m\n", - "V=1;#velocity of water in m/s\n", - "T1=40;#mean temperature in degree celcius\n", - "T2=75;#pipe wall temperature in degree celcius \n", - "k=0.6;#conductivity of water in W/m\n", - "Pr=3;#prandtl no.\n", - "v=0.478*10**-6;#viscocity in m^2/s\n", - "print(\"reynolds number,Re=V*D/v\")\n", - "Re=V*D/v\n", - "print(\"subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\")\n", - "print(\"or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\")\n", - "print(\"so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\")\n", - "h=(k/D)*0.023*(Re)**0.8*(Pr)**0.4 \n", - "print(\"rate of heat transfer due to convection,Q in W \") \n", - "Q=h*(math.pi*D*L)*(T2-T1)\n", - "print(\"Q=h*A*(T2-T1)=\"),round(Q,2)\n", - "print(\"so heat transfer rate=61259.38 W\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.7;pg no: 489" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.7, Page:489 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\n", - "Let the temperature of water at exit be T\n", - "Heat exchanger,Q=heat rejected by glasses=heat gained by water\n", - "Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\n", - "so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\n", - "and Q in KJ\n", - "deltaT_in=T1-T3 in degree celcius\n", - "deltaT_out=T2-T in degree celcius\n", - "for parallel flow heat exchanger,\n", - "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\n", - "also,Q=U*A*LMTD\n", - "so A=Q/(U*LMTD) in m^2 5.937\n", - "surface area,A=5.936 m^2\n" - ] - } - ], - "source": [ - "#cal of surface area\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.7, Page:489 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\")\n", - "m=0.5;#hot gases flowing rate in kg/s\n", - "T1=500;#initial temperature of gas in degree celcius\n", - "T2=150;#final temperature of gas in degree celcius\n", - "Cg=1.2;#specific heat of gas in KJ/kg K\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "U=150;#overall heat transfer coefficient in W/m^2 K\n", - "mw=1;#mass of water in kg/s\n", - "T3=10;#water entering temperature in degree celcius\n", - "print(\"Let the temperature of water at exit be T\")\n", - "print(\"Heat exchanger,Q=heat rejected by glasses=heat gained by water\")\n", - "print(\"Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\")\n", - "print(\"so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\")\n", - "T=T3+(m*Cg*(T1-T2)/(mw*Cw))\n", - "print(\"and Q in KJ\")\n", - "Q=m*Cg*(T1-T2)\n", - "print(\"deltaT_in=T1-T3 in degree celcius\")\n", - "deltaT_in=T1-T3\n", - "print(\"deltaT_out=T2-T in degree celcius\")\n", - "deltaT_out=T2-T\n", - "print(\"for parallel flow heat exchanger,\")\n", - "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\")\n", - "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", - "print(\"also,Q=U*A*LMTD\")\n", - "A=Q*10**3/(U*LMTD)\n", - "print(\"so A=Q/(U*LMTD) in m^2\"),round(A,3)\n", - "print(\"surface area,A=5.936 m^2\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.8;pg no: 490" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.8, Page:490 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\n", - "This oil cooler has arrangement similar to a counter flow heat exchanger.\n", - "by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\n", - "so Q in KJ/min\n", - "and T=Th_out+(Q/(mh*Cph))in degree celcius\n", - "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \n", - "here deltaT_in=Tc_out-T in degree celcius\n", - "deltaT_out=Th_in-Th_out in degree celcius\n", - "so LMTD in degree celcius\n", - "substituting in,Q=U*A*LMTD\n", - "A=(Q*10^3/60)/(U*LMTD)in m^2 132.81\n", - "so surface area=132.85 m^2\n" - ] - } - ], - "source": [ - "#cal of surface area\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.8, Page:490 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\")\n", - "mc=20;#mass of oil in kg/min \n", - "Tc_out=100;#initial temperature of oil in degree celcius\n", - "Th_in=30;#final temperature of oil in degree celcius\n", - "Th_out=25;#temperature of water in degree celcius\n", - "Cpc=2;#specific heat of oil in KJ/kg K\n", - "Cph=4.18;#specific heat of water in KJ/kg K\n", - "mh=15;#water flow rate in kg/min\n", - "U=25;#overall heat transfer coefficient in W/m^2 K\n", - "print(\"This oil cooler has arrangement similar to a counter flow heat exchanger.\")\n", - "print(\"by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\")\n", - "print(\"so Q in KJ/min\")\n", - "Q=mc*Cpc*(Tc_out-Th_in)\n", - "print(\"and T=Th_out+(Q/(mh*Cph))in degree celcius\")\n", - "T=Th_out+(Q/(mh*Cph))\n", - "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \")\n", - "print(\"here deltaT_in=Tc_out-T in degree celcius\")\n", - "deltaT_in=Tc_out-T\n", - "print(\"deltaT_out=Th_in-Th_out in degree celcius\")\n", - "deltaT_out=Th_in-Th_out\n", - "print(\"so LMTD in degree celcius\")\n", - "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", - "print(\"substituting in,Q=U*A*LMTD\")\n", - "A=(Q*10**3/60)/(U*LMTD)\n", - "print(\"A=(Q*10^3/60)/(U*LMTD)in m^2\"),round(A,2)\n", - "print(\"so surface area=132.85 m^2\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.9;pg no: 490" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.9, Page:490 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\n", - "rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\n", - "heat loss per unit area by radiation(Q)in W\n", - "Q= 93597.71\n" - ] - } - ], - "source": [ - "#cal of heat loss per unit area by radiation\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.9, Page:490 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\")\n", - "T1=(1200+273);#temperature of body in K\n", - "T2=(600+273);#temperature of black surrounding in K\n", - "epsilon=0.4;#emissivity of body at 1200 degree celcius\n", - "sigma=5.67*10**-8;#stephen boltzman constant in W/m^2 K^4\n", - "print(\"rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\")\n", - "print(\"heat loss per unit area by radiation(Q)in W\")\n", - "Q=epsilon*sigma*(T1**4-T2**4)\n", - "print(\"Q=\"),round(Q,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.10;pg no: 491" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.10, Page:491 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\n", - "Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\n", - "Q=V*I in W\n", - "For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\n", - "surface area for heat transfer,A2=2*%pi*r*L in m^2\n", - "R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\n", - "R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\n", - "Total resistance,R_total=R1+R2 in oc/W\n", - "Q=(T3-T1)/R_total\n", - "so T3 in degree celcius= 98.28\n", - "so temperature at interface=125.12 degree celcius\n", - "critical radius of insulation,rc in m= 0.01\n", - "rc in mm 10.67\n", - "This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\n", - "NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\n" - ] - } - ], - "source": [ - "#cal of temperature at interface\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.10, Page:491 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\")\n", - "V=16.;#voltage drop in V\n", - "I=5.;#current in cable in A\n", - "r2=8.*10.**-3/2.;#outer cable radius in m\n", - "r3=3.*10.**-3/2.;#copper wire radius in m\n", - "k=0.16;#thermal conductivity of copper wire in W/m oc\n", - "L=5.;#length of cable in m\n", - "h1=15.;#heat transfer coefficient of cable in W/m^2 oc\n", - "T1=40.;#temperature of surrounding in degree celcius\n", - "print(\"Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\")\n", - "print(\"Q=V*I in W\")\n", - "Q=V*I\n", - "print(\"For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\")\n", - "print(\"surface area for heat transfer,A2=2*%pi*r*L in m^2\")\n", - "A2=2.*math.pi*r2*L\n", - "A2=0.125;#approx.\n", - "print(\"R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\")\n", - "print(\"R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\")\n", - "print(\"Total resistance,R_total=R1+R2 in oc/W\")\n", - "R_total=(1/(h1*A2))+(math.log(r2/r3)/(2.*math.pi*k*L))\n", - "print(\"Q=(T3-T1)/R_total\")\n", - "T3=T1+Q*R_total\n", - "print(\"so T3 in degree celcius=\"),round(T3,2)\n", - "print(\"so temperature at interface=125.12 degree celcius\")\n", - "rc=k/h1\n", - "print(\"critical radius of insulation,rc in m=\"),round(rc,2)\n", - "print(\"rc in mm\"),round(rc*1000,2)\n", - "print(\"This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\")\n", - "print(\"NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.11;pg no: 492" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.11, Page:492 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\n", - "for maximum heat transfer the critical radius of insulation should be used.\n", - "critical radius of insulation(rc)=k/h in mm\n", - "economical thickness of insulation(t)=rc-r_wire in mm\n", - "so economical thickness of insulation=7 mm\n", - "heat convected from cable surface to environment,Q in W\n", - "Q= 35.2\n", - "so heat transferred per unit length=35.2 W\n" - ] - } - ], - "source": [ - "#cal of heat transferred per unit length\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.11, Page:492 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\")\n", - "r_wire=3;#radius of electric wire in mm\n", - "k=0.16;#thermal conductivity in W/m oc\n", - "T_surrounding=45;#temperature of surrounding in degree celcius\n", - "T_surface=80;#temperature of surface in degree celcius\n", - "h=16;#heat transfer cooefficient in W/m^2 oc\n", - "print(\"for maximum heat transfer the critical radius of insulation should be used.\")\n", - "print(\"critical radius of insulation(rc)=k/h in mm\")\n", - "rc=k*1000/h\n", - "print(\"economical thickness of insulation(t)=rc-r_wire in mm\")\n", - "t=rc-r_wire\n", - "print(\"so economical thickness of insulation=7 mm\")\n", - "print(\"heat convected from cable surface to environment,Q in W\")\n", - "L=1;#length in mm\n", - "Q=2*math.pi*rc*L*h*(T_surface-T_surrounding)*10**-3\n", - "print(\"Q=\"),round(Q,1)\n", - "print(\"so heat transferred per unit length=35.2 W\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.12;pg no: 492" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.12, Page:492 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\n", - "heat transfer through concentric sphere,Q in KJ/hr \n", - "Q= -6297.1\n", - "so heat exchange=6297.1 KJ/hr\n" - ] - } - ], - "source": [ - "#cal of heat exchange\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.12, Page:492 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\")\n", - "T1=(-150+273);#temperature of air inside in K\n", - "T2=(35+273);#temperature of outer surface in K\n", - "epsilon1=0.03;#emissivity\n", - "epsilon2=epsilon1;\n", - "D1=25*10**-2;#diameter of inner sphere in m\n", - "D2=30*10**-2;#diameter of outer sphere in m\n", - "sigma=2.04*10**-4;#stephen boltzmann constant in KJ/m^2 hr K^4\n", - "print(\"heat transfer through concentric sphere,Q in KJ/hr \")\n", - "A1=4*math.pi*D1**2/4;\n", - "A2=4*math.pi*D2**2/4;\n", - "Q=(A1*sigma*(T1**4-T2**4))/((1/epsilon1)+((A1/A2)*((1/epsilon2)-1)))\n", - "print(\"Q=\"),round(Q,2)\n", - "print(\"so heat exchange=6297.1 KJ/hr\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter12_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter12_1.ipynb deleted file mode 100755 index f89e1b1a..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter12_1.ipynb +++ /dev/null @@ -1,818 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 12:Introduction to Heat Transfer" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.1;pg no: 483" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.1, Page:483 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\n", - "here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\n", - "overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\n", - "(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\n", - "so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", - "rate of heat transfer,Q in W= 10590.0\n", - "so rate of heat transfer=10590 W\n", - "heat transfer across states 1 and 3(at interface).\n", - "overall heat transfer coefficient between 1 and 3\n", - "(1/U1)=(1/h1)+(deltax_brick/k_brick)\n", - "so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\n", - "Q=U1*A*(T1-T3)\n", - "so T3=T1-(Q/(U1*A))in degree celcius 44.7\n", - "so temperature at interface of brick and wood =44.71 degree celcius\n" - ] - } - ], - "source": [ - "#cal of rate of heat transfer and temperature at interface of brick and wood\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.1, Page:483 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\")\n", - "h1=30.;#heat transfer coefficient on side of 50 oc in W/m^2 K\n", - "h5=10.;#heat transfer coefficient on side of 20 oc in W/m^2 K\n", - "k_brick=0.9;#conductivity of brick in W/m K\n", - "k_wood=0.15;#conductivity of wood in W/m K\n", - "T1=50.;#temperature of air on one side of wall in degree celcius\n", - "T5=20.;#temperature of air on other side of wall in degree celcius\n", - "A=100.;#surface area in m^2\n", - "deltax_brick=1.5*10**-2;#length of brick in m\n", - "deltax_wood=2*10**-2;#length of wood in m\n", - "print(\"here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\")\n", - "print(\"overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\")\n", - "print(\"(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\")\n", - "print(\"so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\")\n", - "U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", - "U=3.53;#approx.\n", - "Q=U*A*(T1-T5)\n", - "print(\"rate of heat transfer,Q in W=\"),round(Q,2)\n", - "print(\"so rate of heat transfer=10590 W\")\n", - "print(\"heat transfer across states 1 and 3(at interface).\")\n", - "print(\"overall heat transfer coefficient between 1 and 3\")\n", - "print(\"(1/U1)=(1/h1)+(deltax_brick/k_brick)\")\n", - "print(\"so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\")\n", - "U1=1/((1/h1)+(deltax_brick/k_brick))\n", - "print(\"Q=U1*A*(T1-T3)\")\n", - "T3=T1-(Q/(U1*A))\n", - "print(\"so T3=T1-(Q/(U1*A))in degree celcius\"),round(T3,2)\n", - "print(\"so temperature at interface of brick and wood =44.71 degree celcius\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.2;pg no: 484" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.2, Page:484 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\n", - "here thermal resistances are\n", - "R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\n", - "R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\n", - "R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\n", - "R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\n", - "R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\n", - "overall heat transfer coefficient for one dimentional steady state heat transfer\n", - "(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\n", - "so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\n", - "rate of heat transfer(Q) in KJ/m^2 hr= 112.0\n", - "wall surface area(A) in m^2\n", - "so rate of heat transfer=112 KJ/m^2 hr \n", - "Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\n", - "Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\n", - "substituting,T2 in degree celcius= 23.6\n", - "so temperature of outer wall,T2=23.6 oc\n", - "T3 in degree= 23.6\n", - "so temperature at interface of outer steel wall and wool,T3=23.59 oc\n", - "T4 in degree celcius= 6.1\n", - "so temperature at interface of wool and inside steel wall,T4=6.09 oc\n", - "T5 in degree celcius= 6.1\n", - "so temperature at inside of inner steel wall,T5=6.08 oc\n" - ] - } - ], - "source": [ - "#cal of rate of heat transfer,temperatures\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.2, Page:484 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\")\n", - "h1=40;#average heat transfer coefficient at inner surface in KJ/m^2 hr oc\n", - "h6=50;#average heat transfer coefficient at outer surface in KJ/m^2 hr oc\n", - "deltax_steel=2*10**-3;#mild steel sheets thickness in m\n", - "deltax_wool=5*10**-2;#thickness of glass wool insulation in m\n", - "k_wool=0.16;#thermal conductivity of wool in KJ/m hr\n", - "k_steel=160;#thermal conductivity of steel in KJ/m hr\n", - "T1=25;#kitchen temperature in degree celcius\n", - "T6=5;#refrigerator temperature in degree celcius\n", - "print(\"here thermal resistances are\")\n", - "print(\"R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\")\n", - "print(\"R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\")\n", - "print(\"R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\")\n", - "print(\"R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\")\n", - "print(\"R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\")\n", - "print(\"overall heat transfer coefficient for one dimentional steady state heat transfer\")\n", - "print(\"(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\")\n", - "print(\"so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\")\n", - "U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))\n", - "U=2.8;#approx.\n", - "A=4*(1*0.5)\n", - "Q=U*A*(T1-T6)\n", - "print(\"rate of heat transfer(Q) in KJ/m^2 hr=\"),round(Q,2)\n", - "print(\"wall surface area(A) in m^2\")\n", - "print(\"so rate of heat transfer=112 KJ/m^2 hr \")\n", - "print(\"Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\")\n", - "print(\"Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\")\n", - "T2=T1-(Q/(A*h1))\n", - "print(\"substituting,T2 in degree celcius=\"),round(T2,1)\n", - "print(\"so temperature of outer wall,T2=23.6 oc\")\n", - "T3=T2-(Q*deltax_steel/(k_steel*A))\n", - "print(\"T3 in degree= \"),round(T3,2)\n", - "print(\"so temperature at interface of outer steel wall and wool,T3=23.59 oc\")\n", - "T4=T3-(Q*deltax_wool/(k_wool*A))\n", - "print(\"T4 in degree celcius=\"),round(T4,2)\n", - "print(\"so temperature at interface of wool and inside steel wall,T4=6.09 oc\")\n", - "T5=T4-(Q*deltax_steel/(k_steel*A))\n", - "print(\"T5 in degree celcius=\"),round(T5,2)\n", - "print(\"so temperature at inside of inner steel wall,T5=6.08 oc\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.3;pg no: 486" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.3, Page:486 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\n", - "here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\n", - "Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\n", - "so heat loss per meter from pipe in KJ/hr= 1479.77\n", - "heat loss from 5 m length(Q) in KJ/hr 7396.7\n", - "enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\n", - "mass flow of steam(m)in kg/hr\n", - "final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\n", - "let quality of steam at exit be x,\n", - "also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\n", - "h=hf+x*hfg\n", - "so x=(h-hf)/hfg 0.8245\n", - "so quality of steam at exit=0.8245\n" - ] - } - ], - "source": [ - "#cal of heat loss per meter from pipe and quality of steam\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.3, Page:486 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\")\n", - "k_insulation=0.3;#thermal conductivity of insulation in KJ/m hr oc\n", - "k_pipe=209;#thermal conductivity of pipe in KJ/m hr oc\n", - "T1=300;#temperature of inner surface of steam pipe in degree celcius\n", - "T3=50;#temperature of outer surface of insulation layer in degree celcius\n", - "r1=15*10**-2/2;#steam pipe inner radius without insulation in m\n", - "r2=16*10**-2/2;#steam pipe outer radius without insulation in m\n", - "r3=22*10**-2/2;#radius with insulation in m\n", - "m=0.5;#steam entering rate in kg/min\n", - "print(\"here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\")\n", - "print(\"Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\")\n", - "L=1;\n", - "Q=(T1-T3)*2*math.pi*L/((1/k_pipe)*math.log(r2/r1)+(1/k_insulation*math.log(r3/r2)))\n", - "print(\"so heat loss per meter from pipe in KJ/hr=\"),round(Q,2)\n", - "Q=5*Q\n", - "print(\"heat loss from 5 m length(Q) in KJ/hr\"),round(5*1479.34,2)\n", - "print(\"enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\")\n", - "hg=2749;\n", - "print(\"mass flow of steam(m)in kg/hr\")\n", - "m=m*60\n", - "print(\"final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\")\n", - "h=hg-(Q/m)\n", - "print(\"let quality of steam at exit be x,\")\n", - "print(\"also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\")\n", - "hf=1344;\n", - "hfg=1404.9;\n", - "print(\"h=hf+x*hfg\")\n", - "x=(h-hf)/hfg\n", - "print(\"so x=(h-hf)/hfg\"),round(x,4)\n", - "print(\"so quality of steam at exit=0.8245\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.4;pg no: 487" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.4, Page:487 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\n", - "considering one dimensional heat transfer of steady state type\n", - "for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr 168892.02\n", - "so heat transfer rate=168892.02 KJ/hr\n", - "heat flux in KJ/m^2 hr= 23893.33\n", - "so heat flux=23893.33 KJ/m^2 hr\n" - ] - } - ], - "source": [ - "#cal of amount of heat transfer and heat flux\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.4, Page:487 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\")\n", - "r1=150.*10**-2/2;#inner radius in m\n", - "r2=200.*10**-2/2;#outer radius in m\n", - "k=28.;#thermal conductivity in KJ m hr oc\n", - "T1=200.;#inside surface temperature in degree celcius\n", - "T2=40.;#outer surface temperature in degree celcius\n", - "print(\"considering one dimensional heat transfer of steady state type\")\n", - "Q=(T1-T2)*4*math.pi*k*r1*r2/(r2-r1)\n", - "print(\"for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr\"),round(Q,2)\n", - "print(\"so heat transfer rate=168892.02 KJ/hr\")\n", - "Q/(4*math.pi*r1**2)\n", - "print(\"heat flux in KJ/m^2 hr=\"),round(Q/(4*math.pi*r1**2),2)\n", - "print(\"so heat flux=23893.33 KJ/m^2 hr\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.5;pg no: 487" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.5, Page:487 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\n", - "R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\n", - "R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\n", - "R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\n", - "total thermal resistance,R_total=R1+R2+R3 in oc/W\n", - "so rate of heat transfer,Q=(T1-T4)/R_total in W 118.03\n", - "heat transfer rate from inside of room to inside surface of glass window.\n", - "Q=(T1-T2)/R1\n", - "so T2=T1-Q*R1 in degree celcius 9.26\n", - "Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\n" - ] - } - ], - "source": [ - "#cal of heat transfer rate\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.5, Page:487 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\")\n", - "T1=25.;#room temperature in degree celcius\n", - "T4=2.;#winter outside temperature in degree celcius\n", - "h1=10.;#heat transfer coefficient on inner window surfaces in W/m^2 oc\n", - "h4=30.;#heat transfer coefficient on outer window surfaces in W/m^2 oc\n", - "k=0.78;#thermal conductivity of glass in W/m^2 oc\n", - "A=75.*10**-2*100.*10**-2;#area in m^2\n", - "deltax=10.*10**-3;#glass thickness in m\n", - "print(\"R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\")\n", - "print(\"R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\")\n", - "print(\"R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\")\n", - "print(\"total thermal resistance,R_total=R1+R2+R3 in oc/W\")\n", - "R_total=1/(h1*A)+deltax/(k*A)+1/(h4*A)\n", - "Q=(T1-T4)/R_total\n", - "print(\"so rate of heat transfer,Q=(T1-T4)/R_total in W\"),round(Q,2)\n", - "print(\"heat transfer rate from inside of room to inside surface of glass window.\")\n", - "R1=(1/7.5);\n", - "T2=T1-Q*R1\n", - "print(\"Q=(T1-T2)/R1\")\n", - "print(\"so T2=T1-Q*R1 in degree celcius\"),round(T2,2)\n", - "print(\"Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\") \n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.6;pg no: 488" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.6, Page:488 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\n", - "reynolds number,Re=V*D/v\n", - "subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\n", - "or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\n", - "so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\n", - "rate of heat transfer due to convection,Q in W \n", - "Q=h*A*(T2-T1)= 61259.36\n", - "so heat transfer rate=61259.38 W\n" - ] - } - ], - "source": [ - "#cal of heat transfer rate\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.6, Page:488 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\")\n", - "D=4*10**-2;#inner diameter in m\n", - "L=3;#length in m\n", - "V=1;#velocity of water in m/s\n", - "T1=40;#mean temperature in degree celcius\n", - "T2=75;#pipe wall temperature in degree celcius \n", - "k=0.6;#conductivity of water in W/m\n", - "Pr=3;#prandtl no.\n", - "v=0.478*10**-6;#viscocity in m^2/s\n", - "print(\"reynolds number,Re=V*D/v\")\n", - "Re=V*D/v\n", - "print(\"subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\")\n", - "print(\"or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\")\n", - "print(\"so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\")\n", - "h=(k/D)*0.023*(Re)**0.8*(Pr)**0.4 \n", - "print(\"rate of heat transfer due to convection,Q in W \") \n", - "Q=h*(math.pi*D*L)*(T2-T1)\n", - "print(\"Q=h*A*(T2-T1)=\"),round(Q,2)\n", - "print(\"so heat transfer rate=61259.38 W\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.7;pg no: 489" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.7, Page:489 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\n", - "Let the temperature of water at exit be T\n", - "Heat exchanger,Q=heat rejected by glasses=heat gained by water\n", - "Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\n", - "so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\n", - "and Q in KJ\n", - "deltaT_in=T1-T3 in degree celcius\n", - "deltaT_out=T2-T in degree celcius\n", - "for parallel flow heat exchanger,\n", - "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\n", - "also,Q=U*A*LMTD\n", - "so A=Q/(U*LMTD) in m^2 5.937\n", - "surface area,A=5.936 m^2\n" - ] - } - ], - "source": [ - "#cal of surface area\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.7, Page:489 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\")\n", - "m=0.5;#hot gases flowing rate in kg/s\n", - "T1=500;#initial temperature of gas in degree celcius\n", - "T2=150;#final temperature of gas in degree celcius\n", - "Cg=1.2;#specific heat of gas in KJ/kg K\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "U=150;#overall heat transfer coefficient in W/m^2 K\n", - "mw=1;#mass of water in kg/s\n", - "T3=10;#water entering temperature in degree celcius\n", - "print(\"Let the temperature of water at exit be T\")\n", - "print(\"Heat exchanger,Q=heat rejected by glasses=heat gained by water\")\n", - "print(\"Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\")\n", - "print(\"so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\")\n", - "T=T3+(m*Cg*(T1-T2)/(mw*Cw))\n", - "print(\"and Q in KJ\")\n", - "Q=m*Cg*(T1-T2)\n", - "print(\"deltaT_in=T1-T3 in degree celcius\")\n", - "deltaT_in=T1-T3\n", - "print(\"deltaT_out=T2-T in degree celcius\")\n", - "deltaT_out=T2-T\n", - "print(\"for parallel flow heat exchanger,\")\n", - "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\")\n", - "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", - "print(\"also,Q=U*A*LMTD\")\n", - "A=Q*10**3/(U*LMTD)\n", - "print(\"so A=Q/(U*LMTD) in m^2\"),round(A,3)\n", - "print(\"surface area,A=5.936 m^2\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.8;pg no: 490" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.8, Page:490 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\n", - "This oil cooler has arrangement similar to a counter flow heat exchanger.\n", - "by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\n", - "so Q in KJ/min\n", - "and T=Th_out+(Q/(mh*Cph))in degree celcius\n", - "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \n", - "here deltaT_in=Tc_out-T in degree celcius\n", - "deltaT_out=Th_in-Th_out in degree celcius\n", - "so LMTD in degree celcius\n", - "substituting in,Q=U*A*LMTD\n", - "A=(Q*10^3/60)/(U*LMTD)in m^2 132.81\n", - "so surface area=132.85 m^2\n" - ] - } - ], - "source": [ - "#cal of surface area\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.8, Page:490 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\")\n", - "mc=20;#mass of oil in kg/min \n", - "Tc_out=100;#initial temperature of oil in degree celcius\n", - "Th_in=30;#final temperature of oil in degree celcius\n", - "Th_out=25;#temperature of water in degree celcius\n", - "Cpc=2;#specific heat of oil in KJ/kg K\n", - "Cph=4.18;#specific heat of water in KJ/kg K\n", - "mh=15;#water flow rate in kg/min\n", - "U=25;#overall heat transfer coefficient in W/m^2 K\n", - "print(\"This oil cooler has arrangement similar to a counter flow heat exchanger.\")\n", - "print(\"by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\")\n", - "print(\"so Q in KJ/min\")\n", - "Q=mc*Cpc*(Tc_out-Th_in)\n", - "print(\"and T=Th_out+(Q/(mh*Cph))in degree celcius\")\n", - "T=Th_out+(Q/(mh*Cph))\n", - "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \")\n", - "print(\"here deltaT_in=Tc_out-T in degree celcius\")\n", - "deltaT_in=Tc_out-T\n", - "print(\"deltaT_out=Th_in-Th_out in degree celcius\")\n", - "deltaT_out=Th_in-Th_out\n", - "print(\"so LMTD in degree celcius\")\n", - "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", - "print(\"substituting in,Q=U*A*LMTD\")\n", - "A=(Q*10**3/60)/(U*LMTD)\n", - "print(\"A=(Q*10^3/60)/(U*LMTD)in m^2\"),round(A,2)\n", - "print(\"so surface area=132.85 m^2\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.9;pg no: 490" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.9, Page:490 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\n", - "rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\n", - "heat loss per unit area by radiation(Q)in W\n", - "Q= 93597.71\n" - ] - } - ], - "source": [ - "#cal of heat loss per unit area by radiation\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.9, Page:490 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\")\n", - "T1=(1200+273);#temperature of body in K\n", - "T2=(600+273);#temperature of black surrounding in K\n", - "epsilon=0.4;#emissivity of body at 1200 degree celcius\n", - "sigma=5.67*10**-8;#stephen boltzman constant in W/m^2 K^4\n", - "print(\"rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\")\n", - "print(\"heat loss per unit area by radiation(Q)in W\")\n", - "Q=epsilon*sigma*(T1**4-T2**4)\n", - "print(\"Q=\"),round(Q,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.10;pg no: 491" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.10, Page:491 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\n", - "Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\n", - "Q=V*I in W\n", - "For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\n", - "surface area for heat transfer,A2=2*%pi*r*L in m^2\n", - "R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\n", - "R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\n", - "Total resistance,R_total=R1+R2 in oc/W\n", - "Q=(T3-T1)/R_total\n", - "so T3 in degree celcius= 98.28\n", - "so temperature at interface=125.12 degree celcius\n", - "critical radius of insulation,rc in m= 0.01\n", - "rc in mm 10.67\n", - "This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\n", - "NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\n" - ] - } - ], - "source": [ - "#cal of temperature at interface\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.10, Page:491 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\")\n", - "V=16.;#voltage drop in V\n", - "I=5.;#current in cable in A\n", - "r2=8.*10.**-3/2.;#outer cable radius in m\n", - "r3=3.*10.**-3/2.;#copper wire radius in m\n", - "k=0.16;#thermal conductivity of copper wire in W/m oc\n", - "L=5.;#length of cable in m\n", - "h1=15.;#heat transfer coefficient of cable in W/m^2 oc\n", - "T1=40.;#temperature of surrounding in degree celcius\n", - "print(\"Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\")\n", - "print(\"Q=V*I in W\")\n", - "Q=V*I\n", - "print(\"For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\")\n", - "print(\"surface area for heat transfer,A2=2*%pi*r*L in m^2\")\n", - "A2=2.*math.pi*r2*L\n", - "A2=0.125;#approx.\n", - "print(\"R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\")\n", - "print(\"R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\")\n", - "print(\"Total resistance,R_total=R1+R2 in oc/W\")\n", - "R_total=(1/(h1*A2))+(math.log(r2/r3)/(2.*math.pi*k*L))\n", - "print(\"Q=(T3-T1)/R_total\")\n", - "T3=T1+Q*R_total\n", - "print(\"so T3 in degree celcius=\"),round(T3,2)\n", - "print(\"so temperature at interface=125.12 degree celcius\")\n", - "rc=k/h1\n", - "print(\"critical radius of insulation,rc in m=\"),round(rc,2)\n", - "print(\"rc in mm\"),round(rc*1000,2)\n", - "print(\"This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\")\n", - "print(\"NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.11;pg no: 492" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.11, Page:492 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\n", - "for maximum heat transfer the critical radius of insulation should be used.\n", - "critical radius of insulation(rc)=k/h in mm\n", - "economical thickness of insulation(t)=rc-r_wire in mm\n", - "so economical thickness of insulation=7 mm\n", - "heat convected from cable surface to environment,Q in W\n", - "Q= 35.2\n", - "so heat transferred per unit length=35.2 W\n" - ] - } - ], - "source": [ - "#cal of heat transferred per unit length\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.11, Page:492 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\")\n", - "r_wire=3;#radius of electric wire in mm\n", - "k=0.16;#thermal conductivity in W/m oc\n", - "T_surrounding=45;#temperature of surrounding in degree celcius\n", - "T_surface=80;#temperature of surface in degree celcius\n", - "h=16;#heat transfer cooefficient in W/m^2 oc\n", - "print(\"for maximum heat transfer the critical radius of insulation should be used.\")\n", - "print(\"critical radius of insulation(rc)=k/h in mm\")\n", - "rc=k*1000/h\n", - "print(\"economical thickness of insulation(t)=rc-r_wire in mm\")\n", - "t=rc-r_wire\n", - "print(\"so economical thickness of insulation=7 mm\")\n", - "print(\"heat convected from cable surface to environment,Q in W\")\n", - "L=1;#length in mm\n", - "Q=2*math.pi*rc*L*h*(T_surface-T_surrounding)*10**-3\n", - "print(\"Q=\"),round(Q,1)\n", - "print(\"so heat transferred per unit length=35.2 W\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.12;pg no: 492" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.12, Page:492 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\n", - "heat transfer through concentric sphere,Q in KJ/hr \n", - "Q= -6297.1\n", - "so heat exchange=6297.1 KJ/hr\n" - ] - } - ], - "source": [ - "#cal of heat exchange\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.12, Page:492 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\")\n", - "T1=(-150+273);#temperature of air inside in K\n", - "T2=(35+273);#temperature of outer surface in K\n", - "epsilon1=0.03;#emissivity\n", - "epsilon2=epsilon1;\n", - "D1=25*10**-2;#diameter of inner sphere in m\n", - "D2=30*10**-2;#diameter of outer sphere in m\n", - "sigma=2.04*10**-4;#stephen boltzmann constant in KJ/m^2 hr K^4\n", - "print(\"heat transfer through concentric sphere,Q in KJ/hr \")\n", - "A1=4*math.pi*D1**2/4;\n", - "A2=4*math.pi*D2**2/4;\n", - "Q=(A1*sigma*(T1**4-T2**4))/((1/epsilon1)+((A1/A2)*((1/epsilon2)-1)))\n", - "print(\"Q=\"),round(Q,2)\n", - "print(\"so heat exchange=6297.1 KJ/hr\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter12_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter12_2.ipynb deleted file mode 100755 index f89e1b1a..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter12_2.ipynb +++ /dev/null @@ -1,818 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 12:Introduction to Heat Transfer" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.1;pg no: 483" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.1, Page:483 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\n", - "here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\n", - "overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\n", - "(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\n", - "so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", - "rate of heat transfer,Q in W= 10590.0\n", - "so rate of heat transfer=10590 W\n", - "heat transfer across states 1 and 3(at interface).\n", - "overall heat transfer coefficient between 1 and 3\n", - "(1/U1)=(1/h1)+(deltax_brick/k_brick)\n", - "so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\n", - "Q=U1*A*(T1-T3)\n", - "so T3=T1-(Q/(U1*A))in degree celcius 44.7\n", - "so temperature at interface of brick and wood =44.71 degree celcius\n" - ] - } - ], - "source": [ - "#cal of rate of heat transfer and temperature at interface of brick and wood\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.1, Page:483 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\")\n", - "h1=30.;#heat transfer coefficient on side of 50 oc in W/m^2 K\n", - "h5=10.;#heat transfer coefficient on side of 20 oc in W/m^2 K\n", - "k_brick=0.9;#conductivity of brick in W/m K\n", - "k_wood=0.15;#conductivity of wood in W/m K\n", - "T1=50.;#temperature of air on one side of wall in degree celcius\n", - "T5=20.;#temperature of air on other side of wall in degree celcius\n", - "A=100.;#surface area in m^2\n", - "deltax_brick=1.5*10**-2;#length of brick in m\n", - "deltax_wood=2*10**-2;#length of wood in m\n", - "print(\"here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\")\n", - "print(\"overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\")\n", - "print(\"(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\")\n", - "print(\"so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\")\n", - "U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", - "U=3.53;#approx.\n", - "Q=U*A*(T1-T5)\n", - "print(\"rate of heat transfer,Q in W=\"),round(Q,2)\n", - "print(\"so rate of heat transfer=10590 W\")\n", - "print(\"heat transfer across states 1 and 3(at interface).\")\n", - "print(\"overall heat transfer coefficient between 1 and 3\")\n", - "print(\"(1/U1)=(1/h1)+(deltax_brick/k_brick)\")\n", - "print(\"so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\")\n", - "U1=1/((1/h1)+(deltax_brick/k_brick))\n", - "print(\"Q=U1*A*(T1-T3)\")\n", - "T3=T1-(Q/(U1*A))\n", - "print(\"so T3=T1-(Q/(U1*A))in degree celcius\"),round(T3,2)\n", - "print(\"so temperature at interface of brick and wood =44.71 degree celcius\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.2;pg no: 484" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.2, Page:484 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\n", - "here thermal resistances are\n", - "R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\n", - "R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\n", - "R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\n", - "R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\n", - "R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\n", - "overall heat transfer coefficient for one dimentional steady state heat transfer\n", - "(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\n", - "so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\n", - "rate of heat transfer(Q) in KJ/m^2 hr= 112.0\n", - "wall surface area(A) in m^2\n", - "so rate of heat transfer=112 KJ/m^2 hr \n", - "Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\n", - "Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\n", - "substituting,T2 in degree celcius= 23.6\n", - "so temperature of outer wall,T2=23.6 oc\n", - "T3 in degree= 23.6\n", - "so temperature at interface of outer steel wall and wool,T3=23.59 oc\n", - "T4 in degree celcius= 6.1\n", - "so temperature at interface of wool and inside steel wall,T4=6.09 oc\n", - "T5 in degree celcius= 6.1\n", - "so temperature at inside of inner steel wall,T5=6.08 oc\n" - ] - } - ], - "source": [ - "#cal of rate of heat transfer,temperatures\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.2, Page:484 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\")\n", - "h1=40;#average heat transfer coefficient at inner surface in KJ/m^2 hr oc\n", - "h6=50;#average heat transfer coefficient at outer surface in KJ/m^2 hr oc\n", - "deltax_steel=2*10**-3;#mild steel sheets thickness in m\n", - "deltax_wool=5*10**-2;#thickness of glass wool insulation in m\n", - "k_wool=0.16;#thermal conductivity of wool in KJ/m hr\n", - "k_steel=160;#thermal conductivity of steel in KJ/m hr\n", - "T1=25;#kitchen temperature in degree celcius\n", - "T6=5;#refrigerator temperature in degree celcius\n", - "print(\"here thermal resistances are\")\n", - "print(\"R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\")\n", - "print(\"R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\")\n", - "print(\"R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\")\n", - "print(\"R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\")\n", - "print(\"R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\")\n", - "print(\"overall heat transfer coefficient for one dimentional steady state heat transfer\")\n", - "print(\"(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\")\n", - "print(\"so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\")\n", - "U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))\n", - "U=2.8;#approx.\n", - "A=4*(1*0.5)\n", - "Q=U*A*(T1-T6)\n", - "print(\"rate of heat transfer(Q) in KJ/m^2 hr=\"),round(Q,2)\n", - "print(\"wall surface area(A) in m^2\")\n", - "print(\"so rate of heat transfer=112 KJ/m^2 hr \")\n", - "print(\"Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\")\n", - "print(\"Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\")\n", - "T2=T1-(Q/(A*h1))\n", - "print(\"substituting,T2 in degree celcius=\"),round(T2,1)\n", - "print(\"so temperature of outer wall,T2=23.6 oc\")\n", - "T3=T2-(Q*deltax_steel/(k_steel*A))\n", - "print(\"T3 in degree= \"),round(T3,2)\n", - "print(\"so temperature at interface of outer steel wall and wool,T3=23.59 oc\")\n", - "T4=T3-(Q*deltax_wool/(k_wool*A))\n", - "print(\"T4 in degree celcius=\"),round(T4,2)\n", - "print(\"so temperature at interface of wool and inside steel wall,T4=6.09 oc\")\n", - "T5=T4-(Q*deltax_steel/(k_steel*A))\n", - "print(\"T5 in degree celcius=\"),round(T5,2)\n", - "print(\"so temperature at inside of inner steel wall,T5=6.08 oc\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.3;pg no: 486" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.3, Page:486 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\n", - "here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\n", - "Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\n", - "so heat loss per meter from pipe in KJ/hr= 1479.77\n", - "heat loss from 5 m length(Q) in KJ/hr 7396.7\n", - "enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\n", - "mass flow of steam(m)in kg/hr\n", - "final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\n", - "let quality of steam at exit be x,\n", - "also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\n", - "h=hf+x*hfg\n", - "so x=(h-hf)/hfg 0.8245\n", - "so quality of steam at exit=0.8245\n" - ] - } - ], - "source": [ - "#cal of heat loss per meter from pipe and quality of steam\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.3, Page:486 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\")\n", - "k_insulation=0.3;#thermal conductivity of insulation in KJ/m hr oc\n", - "k_pipe=209;#thermal conductivity of pipe in KJ/m hr oc\n", - "T1=300;#temperature of inner surface of steam pipe in degree celcius\n", - "T3=50;#temperature of outer surface of insulation layer in degree celcius\n", - "r1=15*10**-2/2;#steam pipe inner radius without insulation in m\n", - "r2=16*10**-2/2;#steam pipe outer radius without insulation in m\n", - "r3=22*10**-2/2;#radius with insulation in m\n", - "m=0.5;#steam entering rate in kg/min\n", - "print(\"here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\")\n", - "print(\"Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\")\n", - "L=1;\n", - "Q=(T1-T3)*2*math.pi*L/((1/k_pipe)*math.log(r2/r1)+(1/k_insulation*math.log(r3/r2)))\n", - "print(\"so heat loss per meter from pipe in KJ/hr=\"),round(Q,2)\n", - "Q=5*Q\n", - "print(\"heat loss from 5 m length(Q) in KJ/hr\"),round(5*1479.34,2)\n", - "print(\"enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\")\n", - "hg=2749;\n", - "print(\"mass flow of steam(m)in kg/hr\")\n", - "m=m*60\n", - "print(\"final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\")\n", - "h=hg-(Q/m)\n", - "print(\"let quality of steam at exit be x,\")\n", - "print(\"also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\")\n", - "hf=1344;\n", - "hfg=1404.9;\n", - "print(\"h=hf+x*hfg\")\n", - "x=(h-hf)/hfg\n", - "print(\"so x=(h-hf)/hfg\"),round(x,4)\n", - "print(\"so quality of steam at exit=0.8245\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.4;pg no: 487" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.4, Page:487 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\n", - "considering one dimensional heat transfer of steady state type\n", - "for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr 168892.02\n", - "so heat transfer rate=168892.02 KJ/hr\n", - "heat flux in KJ/m^2 hr= 23893.33\n", - "so heat flux=23893.33 KJ/m^2 hr\n" - ] - } - ], - "source": [ - "#cal of amount of heat transfer and heat flux\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.4, Page:487 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\")\n", - "r1=150.*10**-2/2;#inner radius in m\n", - "r2=200.*10**-2/2;#outer radius in m\n", - "k=28.;#thermal conductivity in KJ m hr oc\n", - "T1=200.;#inside surface temperature in degree celcius\n", - "T2=40.;#outer surface temperature in degree celcius\n", - "print(\"considering one dimensional heat transfer of steady state type\")\n", - "Q=(T1-T2)*4*math.pi*k*r1*r2/(r2-r1)\n", - "print(\"for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr\"),round(Q,2)\n", - "print(\"so heat transfer rate=168892.02 KJ/hr\")\n", - "Q/(4*math.pi*r1**2)\n", - "print(\"heat flux in KJ/m^2 hr=\"),round(Q/(4*math.pi*r1**2),2)\n", - "print(\"so heat flux=23893.33 KJ/m^2 hr\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.5;pg no: 487" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.5, Page:487 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\n", - "R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\n", - "R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\n", - "R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\n", - "total thermal resistance,R_total=R1+R2+R3 in oc/W\n", - "so rate of heat transfer,Q=(T1-T4)/R_total in W 118.03\n", - "heat transfer rate from inside of room to inside surface of glass window.\n", - "Q=(T1-T2)/R1\n", - "so T2=T1-Q*R1 in degree celcius 9.26\n", - "Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\n" - ] - } - ], - "source": [ - "#cal of heat transfer rate\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.5, Page:487 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\")\n", - "T1=25.;#room temperature in degree celcius\n", - "T4=2.;#winter outside temperature in degree celcius\n", - "h1=10.;#heat transfer coefficient on inner window surfaces in W/m^2 oc\n", - "h4=30.;#heat transfer coefficient on outer window surfaces in W/m^2 oc\n", - "k=0.78;#thermal conductivity of glass in W/m^2 oc\n", - "A=75.*10**-2*100.*10**-2;#area in m^2\n", - "deltax=10.*10**-3;#glass thickness in m\n", - "print(\"R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\")\n", - "print(\"R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\")\n", - "print(\"R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\")\n", - "print(\"total thermal resistance,R_total=R1+R2+R3 in oc/W\")\n", - "R_total=1/(h1*A)+deltax/(k*A)+1/(h4*A)\n", - "Q=(T1-T4)/R_total\n", - "print(\"so rate of heat transfer,Q=(T1-T4)/R_total in W\"),round(Q,2)\n", - "print(\"heat transfer rate from inside of room to inside surface of glass window.\")\n", - "R1=(1/7.5);\n", - "T2=T1-Q*R1\n", - "print(\"Q=(T1-T2)/R1\")\n", - "print(\"so T2=T1-Q*R1 in degree celcius\"),round(T2,2)\n", - "print(\"Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\") \n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.6;pg no: 488" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.6, Page:488 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\n", - "reynolds number,Re=V*D/v\n", - "subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\n", - "or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\n", - "so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\n", - "rate of heat transfer due to convection,Q in W \n", - "Q=h*A*(T2-T1)= 61259.36\n", - "so heat transfer rate=61259.38 W\n" - ] - } - ], - "source": [ - "#cal of heat transfer rate\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.6, Page:488 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\")\n", - "D=4*10**-2;#inner diameter in m\n", - "L=3;#length in m\n", - "V=1;#velocity of water in m/s\n", - "T1=40;#mean temperature in degree celcius\n", - "T2=75;#pipe wall temperature in degree celcius \n", - "k=0.6;#conductivity of water in W/m\n", - "Pr=3;#prandtl no.\n", - "v=0.478*10**-6;#viscocity in m^2/s\n", - "print(\"reynolds number,Re=V*D/v\")\n", - "Re=V*D/v\n", - "print(\"subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\")\n", - "print(\"or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\")\n", - "print(\"so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\")\n", - "h=(k/D)*0.023*(Re)**0.8*(Pr)**0.4 \n", - "print(\"rate of heat transfer due to convection,Q in W \") \n", - "Q=h*(math.pi*D*L)*(T2-T1)\n", - "print(\"Q=h*A*(T2-T1)=\"),round(Q,2)\n", - "print(\"so heat transfer rate=61259.38 W\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.7;pg no: 489" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.7, Page:489 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\n", - "Let the temperature of water at exit be T\n", - "Heat exchanger,Q=heat rejected by glasses=heat gained by water\n", - "Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\n", - "so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\n", - "and Q in KJ\n", - "deltaT_in=T1-T3 in degree celcius\n", - "deltaT_out=T2-T in degree celcius\n", - "for parallel flow heat exchanger,\n", - "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\n", - "also,Q=U*A*LMTD\n", - "so A=Q/(U*LMTD) in m^2 5.937\n", - "surface area,A=5.936 m^2\n" - ] - } - ], - "source": [ - "#cal of surface area\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.7, Page:489 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\")\n", - "m=0.5;#hot gases flowing rate in kg/s\n", - "T1=500;#initial temperature of gas in degree celcius\n", - "T2=150;#final temperature of gas in degree celcius\n", - "Cg=1.2;#specific heat of gas in KJ/kg K\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "U=150;#overall heat transfer coefficient in W/m^2 K\n", - "mw=1;#mass of water in kg/s\n", - "T3=10;#water entering temperature in degree celcius\n", - "print(\"Let the temperature of water at exit be T\")\n", - "print(\"Heat exchanger,Q=heat rejected by glasses=heat gained by water\")\n", - "print(\"Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\")\n", - "print(\"so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\")\n", - "T=T3+(m*Cg*(T1-T2)/(mw*Cw))\n", - "print(\"and Q in KJ\")\n", - "Q=m*Cg*(T1-T2)\n", - "print(\"deltaT_in=T1-T3 in degree celcius\")\n", - "deltaT_in=T1-T3\n", - "print(\"deltaT_out=T2-T in degree celcius\")\n", - "deltaT_out=T2-T\n", - "print(\"for parallel flow heat exchanger,\")\n", - "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\")\n", - "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", - "print(\"also,Q=U*A*LMTD\")\n", - "A=Q*10**3/(U*LMTD)\n", - "print(\"so A=Q/(U*LMTD) in m^2\"),round(A,3)\n", - "print(\"surface area,A=5.936 m^2\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.8;pg no: 490" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.8, Page:490 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\n", - "This oil cooler has arrangement similar to a counter flow heat exchanger.\n", - "by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\n", - "so Q in KJ/min\n", - "and T=Th_out+(Q/(mh*Cph))in degree celcius\n", - "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \n", - "here deltaT_in=Tc_out-T in degree celcius\n", - "deltaT_out=Th_in-Th_out in degree celcius\n", - "so LMTD in degree celcius\n", - "substituting in,Q=U*A*LMTD\n", - "A=(Q*10^3/60)/(U*LMTD)in m^2 132.81\n", - "so surface area=132.85 m^2\n" - ] - } - ], - "source": [ - "#cal of surface area\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.8, Page:490 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\")\n", - "mc=20;#mass of oil in kg/min \n", - "Tc_out=100;#initial temperature of oil in degree celcius\n", - "Th_in=30;#final temperature of oil in degree celcius\n", - "Th_out=25;#temperature of water in degree celcius\n", - "Cpc=2;#specific heat of oil in KJ/kg K\n", - "Cph=4.18;#specific heat of water in KJ/kg K\n", - "mh=15;#water flow rate in kg/min\n", - "U=25;#overall heat transfer coefficient in W/m^2 K\n", - "print(\"This oil cooler has arrangement similar to a counter flow heat exchanger.\")\n", - "print(\"by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\")\n", - "print(\"so Q in KJ/min\")\n", - "Q=mc*Cpc*(Tc_out-Th_in)\n", - "print(\"and T=Th_out+(Q/(mh*Cph))in degree celcius\")\n", - "T=Th_out+(Q/(mh*Cph))\n", - "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \")\n", - "print(\"here deltaT_in=Tc_out-T in degree celcius\")\n", - "deltaT_in=Tc_out-T\n", - "print(\"deltaT_out=Th_in-Th_out in degree celcius\")\n", - "deltaT_out=Th_in-Th_out\n", - "print(\"so LMTD in degree celcius\")\n", - "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", - "print(\"substituting in,Q=U*A*LMTD\")\n", - "A=(Q*10**3/60)/(U*LMTD)\n", - "print(\"A=(Q*10^3/60)/(U*LMTD)in m^2\"),round(A,2)\n", - "print(\"so surface area=132.85 m^2\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.9;pg no: 490" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.9, Page:490 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\n", - "rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\n", - "heat loss per unit area by radiation(Q)in W\n", - "Q= 93597.71\n" - ] - } - ], - "source": [ - "#cal of heat loss per unit area by radiation\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.9, Page:490 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\")\n", - "T1=(1200+273);#temperature of body in K\n", - "T2=(600+273);#temperature of black surrounding in K\n", - "epsilon=0.4;#emissivity of body at 1200 degree celcius\n", - "sigma=5.67*10**-8;#stephen boltzman constant in W/m^2 K^4\n", - "print(\"rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\")\n", - "print(\"heat loss per unit area by radiation(Q)in W\")\n", - "Q=epsilon*sigma*(T1**4-T2**4)\n", - "print(\"Q=\"),round(Q,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.10;pg no: 491" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.10, Page:491 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\n", - "Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\n", - "Q=V*I in W\n", - "For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\n", - "surface area for heat transfer,A2=2*%pi*r*L in m^2\n", - "R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\n", - "R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\n", - "Total resistance,R_total=R1+R2 in oc/W\n", - "Q=(T3-T1)/R_total\n", - "so T3 in degree celcius= 98.28\n", - "so temperature at interface=125.12 degree celcius\n", - "critical radius of insulation,rc in m= 0.01\n", - "rc in mm 10.67\n", - "This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\n", - "NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\n" - ] - } - ], - "source": [ - "#cal of temperature at interface\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.10, Page:491 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\")\n", - "V=16.;#voltage drop in V\n", - "I=5.;#current in cable in A\n", - "r2=8.*10.**-3/2.;#outer cable radius in m\n", - "r3=3.*10.**-3/2.;#copper wire radius in m\n", - "k=0.16;#thermal conductivity of copper wire in W/m oc\n", - "L=5.;#length of cable in m\n", - "h1=15.;#heat transfer coefficient of cable in W/m^2 oc\n", - "T1=40.;#temperature of surrounding in degree celcius\n", - "print(\"Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\")\n", - "print(\"Q=V*I in W\")\n", - "Q=V*I\n", - "print(\"For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\")\n", - "print(\"surface area for heat transfer,A2=2*%pi*r*L in m^2\")\n", - "A2=2.*math.pi*r2*L\n", - "A2=0.125;#approx.\n", - "print(\"R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\")\n", - "print(\"R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\")\n", - "print(\"Total resistance,R_total=R1+R2 in oc/W\")\n", - "R_total=(1/(h1*A2))+(math.log(r2/r3)/(2.*math.pi*k*L))\n", - "print(\"Q=(T3-T1)/R_total\")\n", - "T3=T1+Q*R_total\n", - "print(\"so T3 in degree celcius=\"),round(T3,2)\n", - "print(\"so temperature at interface=125.12 degree celcius\")\n", - "rc=k/h1\n", - "print(\"critical radius of insulation,rc in m=\"),round(rc,2)\n", - "print(\"rc in mm\"),round(rc*1000,2)\n", - "print(\"This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\")\n", - "print(\"NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.11;pg no: 492" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.11, Page:492 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\n", - "for maximum heat transfer the critical radius of insulation should be used.\n", - "critical radius of insulation(rc)=k/h in mm\n", - "economical thickness of insulation(t)=rc-r_wire in mm\n", - "so economical thickness of insulation=7 mm\n", - "heat convected from cable surface to environment,Q in W\n", - "Q= 35.2\n", - "so heat transferred per unit length=35.2 W\n" - ] - } - ], - "source": [ - "#cal of heat transferred per unit length\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.11, Page:492 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\")\n", - "r_wire=3;#radius of electric wire in mm\n", - "k=0.16;#thermal conductivity in W/m oc\n", - "T_surrounding=45;#temperature of surrounding in degree celcius\n", - "T_surface=80;#temperature of surface in degree celcius\n", - "h=16;#heat transfer cooefficient in W/m^2 oc\n", - "print(\"for maximum heat transfer the critical radius of insulation should be used.\")\n", - "print(\"critical radius of insulation(rc)=k/h in mm\")\n", - "rc=k*1000/h\n", - "print(\"economical thickness of insulation(t)=rc-r_wire in mm\")\n", - "t=rc-r_wire\n", - "print(\"so economical thickness of insulation=7 mm\")\n", - "print(\"heat convected from cable surface to environment,Q in W\")\n", - "L=1;#length in mm\n", - "Q=2*math.pi*rc*L*h*(T_surface-T_surrounding)*10**-3\n", - "print(\"Q=\"),round(Q,1)\n", - "print(\"so heat transferred per unit length=35.2 W\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.12;pg no: 492" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.12, Page:492 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\n", - "heat transfer through concentric sphere,Q in KJ/hr \n", - "Q= -6297.1\n", - "so heat exchange=6297.1 KJ/hr\n" - ] - } - ], - "source": [ - "#cal of heat exchange\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.12, Page:492 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\")\n", - "T1=(-150+273);#temperature of air inside in K\n", - "T2=(35+273);#temperature of outer surface in K\n", - "epsilon1=0.03;#emissivity\n", - "epsilon2=epsilon1;\n", - "D1=25*10**-2;#diameter of inner sphere in m\n", - "D2=30*10**-2;#diameter of outer sphere in m\n", - "sigma=2.04*10**-4;#stephen boltzmann constant in KJ/m^2 hr K^4\n", - "print(\"heat transfer through concentric sphere,Q in KJ/hr \")\n", - "A1=4*math.pi*D1**2/4;\n", - "A2=4*math.pi*D2**2/4;\n", - "Q=(A1*sigma*(T1**4-T2**4))/((1/epsilon1)+((A1/A2)*((1/epsilon2)-1)))\n", - "print(\"Q=\"),round(Q,2)\n", - "print(\"so heat exchange=6297.1 KJ/hr\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter12_3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter12_3.ipynb deleted file mode 100755 index f89e1b1a..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter12_3.ipynb +++ /dev/null @@ -1,818 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 12:Introduction to Heat Transfer" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.1;pg no: 483" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.1, Page:483 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\n", - "here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\n", - "overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\n", - "(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\n", - "so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", - "rate of heat transfer,Q in W= 10590.0\n", - "so rate of heat transfer=10590 W\n", - "heat transfer across states 1 and 3(at interface).\n", - "overall heat transfer coefficient between 1 and 3\n", - "(1/U1)=(1/h1)+(deltax_brick/k_brick)\n", - "so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\n", - "Q=U1*A*(T1-T3)\n", - "so T3=T1-(Q/(U1*A))in degree celcius 44.7\n", - "so temperature at interface of brick and wood =44.71 degree celcius\n" - ] - } - ], - "source": [ - "#cal of rate of heat transfer and temperature at interface of brick and wood\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.1, Page:483 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 1\")\n", - "h1=30.;#heat transfer coefficient on side of 50 oc in W/m^2 K\n", - "h5=10.;#heat transfer coefficient on side of 20 oc in W/m^2 K\n", - "k_brick=0.9;#conductivity of brick in W/m K\n", - "k_wood=0.15;#conductivity of wood in W/m K\n", - "T1=50.;#temperature of air on one side of wall in degree celcius\n", - "T5=20.;#temperature of air on other side of wall in degree celcius\n", - "A=100.;#surface area in m^2\n", - "deltax_brick=1.5*10**-2;#length of brick in m\n", - "deltax_wood=2*10**-2;#length of wood in m\n", - "print(\"here for one dimentional heat transfer across the wall the heat transfer circuit shall comprises of thermal resistance due to convection between air & brick(R1),conduction in brick wall(R2),conduction in wood(R3),and convection between wood and air(R4).Let temperature at outer brick wall be T2 K,brick-wood interface be T3 K,outer wood wall be T4 K\")\n", - "print(\"overall heat transfer coefficient for steady state heat transfer(U)in W/m^2 K\")\n", - "print(\"(1/U)=(1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5)\")\n", - "print(\"so U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\")\n", - "U=1/((1/h1)+(deltax_brick/k_brick)+(deltax_wood/k_wood)+(1/h5))\n", - "U=3.53;#approx.\n", - "Q=U*A*(T1-T5)\n", - "print(\"rate of heat transfer,Q in W=\"),round(Q,2)\n", - "print(\"so rate of heat transfer=10590 W\")\n", - "print(\"heat transfer across states 1 and 3(at interface).\")\n", - "print(\"overall heat transfer coefficient between 1 and 3\")\n", - "print(\"(1/U1)=(1/h1)+(deltax_brick/k_brick)\")\n", - "print(\"so U1=1/((1/h1)+(deltax_brick/k_brick))in W/m^2 K\")\n", - "U1=1/((1/h1)+(deltax_brick/k_brick))\n", - "print(\"Q=U1*A*(T1-T3)\")\n", - "T3=T1-(Q/(U1*A))\n", - "print(\"so T3=T1-(Q/(U1*A))in degree celcius\"),round(T3,2)\n", - "print(\"so temperature at interface of brick and wood =44.71 degree celcius\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.2;pg no: 484" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.2, Page:484 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\n", - "here thermal resistances are\n", - "R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\n", - "R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\n", - "R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\n", - "R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\n", - "R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\n", - "overall heat transfer coefficient for one dimentional steady state heat transfer\n", - "(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\n", - "so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\n", - "rate of heat transfer(Q) in KJ/m^2 hr= 112.0\n", - "wall surface area(A) in m^2\n", - "so rate of heat transfer=112 KJ/m^2 hr \n", - "Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\n", - "Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\n", - "substituting,T2 in degree celcius= 23.6\n", - "so temperature of outer wall,T2=23.6 oc\n", - "T3 in degree= 23.6\n", - "so temperature at interface of outer steel wall and wool,T3=23.59 oc\n", - "T4 in degree celcius= 6.1\n", - "so temperature at interface of wool and inside steel wall,T4=6.09 oc\n", - "T5 in degree celcius= 6.1\n", - "so temperature at inside of inner steel wall,T5=6.08 oc\n" - ] - } - ], - "source": [ - "#cal of rate of heat transfer,temperatures\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.2, Page:484 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 2\")\n", - "h1=40;#average heat transfer coefficient at inner surface in KJ/m^2 hr oc\n", - "h6=50;#average heat transfer coefficient at outer surface in KJ/m^2 hr oc\n", - "deltax_steel=2*10**-3;#mild steel sheets thickness in m\n", - "deltax_wool=5*10**-2;#thickness of glass wool insulation in m\n", - "k_wool=0.16;#thermal conductivity of wool in KJ/m hr\n", - "k_steel=160;#thermal conductivity of steel in KJ/m hr\n", - "T1=25;#kitchen temperature in degree celcius\n", - "T6=5;#refrigerator temperature in degree celcius\n", - "print(\"here thermal resistances are\")\n", - "print(\"R1=thermal resistance due to convection between kitchen air and outer surface of refrigerator wall(T1 & T2)\")\n", - "print(\"R2=thermal resistance due to conduction across mild steel wall between 2 & 3(T2 & T3)\")\n", - "print(\"R3=thermal resistance due to conduction across glass wool between 3 & 4(T3 & T4)\")\n", - "print(\"R4=thermal resistance due to conduction across mild steel wall between 4 & 5(T4 & T5)\")\n", - "print(\"R5=thermal resistance due to convection between inside refrigerator wall and inside of refrigerator between 5 & 6(T5 & T6)\")\n", - "print(\"overall heat transfer coefficient for one dimentional steady state heat transfer\")\n", - "print(\"(1/U)=(1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6)\")\n", - "print(\"so U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))in KJ/m^2hr oc\")\n", - "U=1/((1/h1)+(deltax_steel/k_steel)+(deltax_wool/k_wool)+(deltax_steel/k_steel)+(1/h6))\n", - "U=2.8;#approx.\n", - "A=4*(1*0.5)\n", - "Q=U*A*(T1-T6)\n", - "print(\"rate of heat transfer(Q) in KJ/m^2 hr=\"),round(Q,2)\n", - "print(\"wall surface area(A) in m^2\")\n", - "print(\"so rate of heat transfer=112 KJ/m^2 hr \")\n", - "print(\"Q=A*h1*(T1-T2)=k_steel*A*(T2-T3)/deltax_steel=k_wool*A*(T3-T4)/deltax_wool\")\n", - "print(\"Q=k_steel*A*(T4-T5)/deltax_steel=A*h6*(T5-T6)\")\n", - "T2=T1-(Q/(A*h1))\n", - "print(\"substituting,T2 in degree celcius=\"),round(T2,1)\n", - "print(\"so temperature of outer wall,T2=23.6 oc\")\n", - "T3=T2-(Q*deltax_steel/(k_steel*A))\n", - "print(\"T3 in degree= \"),round(T3,2)\n", - "print(\"so temperature at interface of outer steel wall and wool,T3=23.59 oc\")\n", - "T4=T3-(Q*deltax_wool/(k_wool*A))\n", - "print(\"T4 in degree celcius=\"),round(T4,2)\n", - "print(\"so temperature at interface of wool and inside steel wall,T4=6.09 oc\")\n", - "T5=T4-(Q*deltax_steel/(k_steel*A))\n", - "print(\"T5 in degree celcius=\"),round(T5,2)\n", - "print(\"so temperature at inside of inner steel wall,T5=6.08 oc\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.3;pg no: 486" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.3, Page:486 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\n", - "here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\n", - "Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\n", - "so heat loss per meter from pipe in KJ/hr= 1479.77\n", - "heat loss from 5 m length(Q) in KJ/hr 7396.7\n", - "enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\n", - "mass flow of steam(m)in kg/hr\n", - "final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\n", - "let quality of steam at exit be x,\n", - "also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\n", - "h=hf+x*hfg\n", - "so x=(h-hf)/hfg 0.8245\n", - "so quality of steam at exit=0.8245\n" - ] - } - ], - "source": [ - "#cal of heat loss per meter from pipe and quality of steam\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.3, Page:486 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 3\")\n", - "k_insulation=0.3;#thermal conductivity of insulation in KJ/m hr oc\n", - "k_pipe=209;#thermal conductivity of pipe in KJ/m hr oc\n", - "T1=300;#temperature of inner surface of steam pipe in degree celcius\n", - "T3=50;#temperature of outer surface of insulation layer in degree celcius\n", - "r1=15*10**-2/2;#steam pipe inner radius without insulation in m\n", - "r2=16*10**-2/2;#steam pipe outer radius without insulation in m\n", - "r3=22*10**-2/2;#radius with insulation in m\n", - "m=0.5;#steam entering rate in kg/min\n", - "print(\"here,heat conduction is considered in pipe wall from 1 to 2 and conduction through insulation between 2 and 3 of one dimentional steady state type.\")\n", - "print(\"Q=(T1-T3)*2*%pi*L/((1/k_pipe)*log(r2/r1)+(1/k_insulation*log(r3/r2)))in KJ/hr\")\n", - "L=1;\n", - "Q=(T1-T3)*2*math.pi*L/((1/k_pipe)*math.log(r2/r1)+(1/k_insulation*math.log(r3/r2)))\n", - "print(\"so heat loss per meter from pipe in KJ/hr=\"),round(Q,2)\n", - "Q=5*Q\n", - "print(\"heat loss from 5 m length(Q) in KJ/hr\"),round(5*1479.34,2)\n", - "print(\"enthalpy of saturated steam at 300 oc,h_sat=2749 KJ/kg=hg from steam table\")\n", - "hg=2749;\n", - "print(\"mass flow of steam(m)in kg/hr\")\n", - "m=m*60\n", - "print(\"final enthalpy of steam per kg at exit of 5 m pipe(h)in KJ/kg\")\n", - "h=hg-(Q/m)\n", - "print(\"let quality of steam at exit be x,\")\n", - "print(\"also at 300oc,hf=1344 KJ/kg,hfg=1404.9 KJ/kg from steam table\")\n", - "hf=1344;\n", - "hfg=1404.9;\n", - "print(\"h=hf+x*hfg\")\n", - "x=(h-hf)/hfg\n", - "print(\"so x=(h-hf)/hfg\"),round(x,4)\n", - "print(\"so quality of steam at exit=0.8245\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.4;pg no: 487" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.4, Page:487 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\n", - "considering one dimensional heat transfer of steady state type\n", - "for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr 168892.02\n", - "so heat transfer rate=168892.02 KJ/hr\n", - "heat flux in KJ/m^2 hr= 23893.33\n", - "so heat flux=23893.33 KJ/m^2 hr\n" - ] - } - ], - "source": [ - "#cal of amount of heat transfer and heat flux\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.4, Page:487 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 4\")\n", - "r1=150.*10**-2/2;#inner radius in m\n", - "r2=200.*10**-2/2;#outer radius in m\n", - "k=28.;#thermal conductivity in KJ m hr oc\n", - "T1=200.;#inside surface temperature in degree celcius\n", - "T2=40.;#outer surface temperature in degree celcius\n", - "print(\"considering one dimensional heat transfer of steady state type\")\n", - "Q=(T1-T2)*4*math.pi*k*r1*r2/(r2-r1)\n", - "print(\"for sphere(Q)=(T1-T2)*4*%pi*k*r1*r2/(r2-r1) in KJ/hr\"),round(Q,2)\n", - "print(\"so heat transfer rate=168892.02 KJ/hr\")\n", - "Q/(4*math.pi*r1**2)\n", - "print(\"heat flux in KJ/m^2 hr=\"),round(Q/(4*math.pi*r1**2),2)\n", - "print(\"so heat flux=23893.33 KJ/m^2 hr\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.5;pg no: 487" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.5, Page:487 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\n", - "R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\n", - "R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\n", - "R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\n", - "total thermal resistance,R_total=R1+R2+R3 in oc/W\n", - "so rate of heat transfer,Q=(T1-T4)/R_total in W 118.03\n", - "heat transfer rate from inside of room to inside surface of glass window.\n", - "Q=(T1-T2)/R1\n", - "so T2=T1-Q*R1 in degree celcius 9.26\n", - "Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\n" - ] - } - ], - "source": [ - "#cal of heat transfer rate\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.5, Page:487 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 5\")\n", - "T1=25.;#room temperature in degree celcius\n", - "T4=2.;#winter outside temperature in degree celcius\n", - "h1=10.;#heat transfer coefficient on inner window surfaces in W/m^2 oc\n", - "h4=30.;#heat transfer coefficient on outer window surfaces in W/m^2 oc\n", - "k=0.78;#thermal conductivity of glass in W/m^2 oc\n", - "A=75.*10**-2*100.*10**-2;#area in m^2\n", - "deltax=10.*10**-3;#glass thickness in m\n", - "print(\"R1=thermal resistance for convection heat transfer between inside room (1)and inside surface of glass window(2)=1/(h1*A)\")\n", - "print(\"R2=thermal resistance for conduction through glass between inside of glass window(2)to outside surface of glass window(3)=deltax/(k*A)\")\n", - "print(\"R3=thermal resistance for convection heat transfer between outside surface of glass window(3)to outside atmosphere(4)=1/(h4*A)\")\n", - "print(\"total thermal resistance,R_total=R1+R2+R3 in oc/W\")\n", - "R_total=1/(h1*A)+deltax/(k*A)+1/(h4*A)\n", - "Q=(T1-T4)/R_total\n", - "print(\"so rate of heat transfer,Q=(T1-T4)/R_total in W\"),round(Q,2)\n", - "print(\"heat transfer rate from inside of room to inside surface of glass window.\")\n", - "R1=(1/7.5);\n", - "T2=T1-Q*R1\n", - "print(\"Q=(T1-T2)/R1\")\n", - "print(\"so T2=T1-Q*R1 in degree celcius\"),round(T2,2)\n", - "print(\"Thus,inside surface of glass window will be at temperature of 9.26 oc where as room inside temperature is 25 oc\") \n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.6;pg no: 488" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.6, Page:488 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\n", - "reynolds number,Re=V*D/v\n", - "subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\n", - "or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\n", - "so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\n", - "rate of heat transfer due to convection,Q in W \n", - "Q=h*A*(T2-T1)= 61259.36\n", - "so heat transfer rate=61259.38 W\n" - ] - } - ], - "source": [ - "#cal of heat transfer rate\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.6, Page:488 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 6\")\n", - "D=4*10**-2;#inner diameter in m\n", - "L=3;#length in m\n", - "V=1;#velocity of water in m/s\n", - "T1=40;#mean temperature in degree celcius\n", - "T2=75;#pipe wall temperature in degree celcius \n", - "k=0.6;#conductivity of water in W/m\n", - "Pr=3;#prandtl no.\n", - "v=0.478*10**-6;#viscocity in m^2/s\n", - "print(\"reynolds number,Re=V*D/v\")\n", - "Re=V*D/v\n", - "print(\"subsituting in Nu=0.023*(Re)^0.8*(Pr)^0.4\")\n", - "print(\"or (h*D/k)=0.023*(Re)^0.8*(Pr)^0.4\")\n", - "print(\"so h=(k/D)*0.023*(Re)^0.8*(Pr)^0.4 in W/m^2 K\")\n", - "h=(k/D)*0.023*(Re)**0.8*(Pr)**0.4 \n", - "print(\"rate of heat transfer due to convection,Q in W \") \n", - "Q=h*(math.pi*D*L)*(T2-T1)\n", - "print(\"Q=h*A*(T2-T1)=\"),round(Q,2)\n", - "print(\"so heat transfer rate=61259.38 W\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.7;pg no: 489" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.7, Page:489 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\n", - "Let the temperature of water at exit be T\n", - "Heat exchanger,Q=heat rejected by glasses=heat gained by water\n", - "Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\n", - "so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\n", - "and Q in KJ\n", - "deltaT_in=T1-T3 in degree celcius\n", - "deltaT_out=T2-T in degree celcius\n", - "for parallel flow heat exchanger,\n", - "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\n", - "also,Q=U*A*LMTD\n", - "so A=Q/(U*LMTD) in m^2 5.937\n", - "surface area,A=5.936 m^2\n" - ] - } - ], - "source": [ - "#cal of surface area\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.7, Page:489 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 7\")\n", - "m=0.5;#hot gases flowing rate in kg/s\n", - "T1=500;#initial temperature of gas in degree celcius\n", - "T2=150;#final temperature of gas in degree celcius\n", - "Cg=1.2;#specific heat of gas in KJ/kg K\n", - "Cw=4.18;#specific heat of water in KJ/kg K\n", - "U=150;#overall heat transfer coefficient in W/m^2 K\n", - "mw=1;#mass of water in kg/s\n", - "T3=10;#water entering temperature in degree celcius\n", - "print(\"Let the temperature of water at exit be T\")\n", - "print(\"Heat exchanger,Q=heat rejected by glasses=heat gained by water\")\n", - "print(\"Q=m*Cg*(T1-T2)=mw*Cw*(T-T3)\")\n", - "print(\"so T=T3+(m*Cg*(T1-T2)/(mw*Cw))in degree celcius\")\n", - "T=T3+(m*Cg*(T1-T2)/(mw*Cw))\n", - "print(\"and Q in KJ\")\n", - "Q=m*Cg*(T1-T2)\n", - "print(\"deltaT_in=T1-T3 in degree celcius\")\n", - "deltaT_in=T1-T3\n", - "print(\"deltaT_out=T2-T in degree celcius\")\n", - "deltaT_out=T2-T\n", - "print(\"for parallel flow heat exchanger,\")\n", - "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree celcius\")\n", - "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", - "print(\"also,Q=U*A*LMTD\")\n", - "A=Q*10**3/(U*LMTD)\n", - "print(\"so A=Q/(U*LMTD) in m^2\"),round(A,3)\n", - "print(\"surface area,A=5.936 m^2\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.8;pg no: 490" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.8, Page:490 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\n", - "This oil cooler has arrangement similar to a counter flow heat exchanger.\n", - "by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\n", - "so Q in KJ/min\n", - "and T=Th_out+(Q/(mh*Cph))in degree celcius\n", - "LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \n", - "here deltaT_in=Tc_out-T in degree celcius\n", - "deltaT_out=Th_in-Th_out in degree celcius\n", - "so LMTD in degree celcius\n", - "substituting in,Q=U*A*LMTD\n", - "A=(Q*10^3/60)/(U*LMTD)in m^2 132.81\n", - "so surface area=132.85 m^2\n" - ] - } - ], - "source": [ - "#cal of surface area\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.8, Page:490 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 8\")\n", - "mc=20;#mass of oil in kg/min \n", - "Tc_out=100;#initial temperature of oil in degree celcius\n", - "Th_in=30;#final temperature of oil in degree celcius\n", - "Th_out=25;#temperature of water in degree celcius\n", - "Cpc=2;#specific heat of oil in KJ/kg K\n", - "Cph=4.18;#specific heat of water in KJ/kg K\n", - "mh=15;#water flow rate in kg/min\n", - "U=25;#overall heat transfer coefficient in W/m^2 K\n", - "print(\"This oil cooler has arrangement similar to a counter flow heat exchanger.\")\n", - "print(\"by heat exchanger,Q=U*A*LMTD=mc*Cpc*(Tc_out-Th_in)=mh*Cph*(Tc_in-Th_out)\")\n", - "print(\"so Q in KJ/min\")\n", - "Q=mc*Cpc*(Tc_out-Th_in)\n", - "print(\"and T=Th_out+(Q/(mh*Cph))in degree celcius\")\n", - "T=Th_out+(Q/(mh*Cph))\n", - "print(\"LMTD=(deltaT_in-deltaT_out)/log(deltaT_in/deltaT_out)in degree \")\n", - "print(\"here deltaT_in=Tc_out-T in degree celcius\")\n", - "deltaT_in=Tc_out-T\n", - "print(\"deltaT_out=Th_in-Th_out in degree celcius\")\n", - "deltaT_out=Th_in-Th_out\n", - "print(\"so LMTD in degree celcius\")\n", - "LMTD=(deltaT_in-deltaT_out)/math.log(deltaT_in/deltaT_out)\n", - "print(\"substituting in,Q=U*A*LMTD\")\n", - "A=(Q*10**3/60)/(U*LMTD)\n", - "print(\"A=(Q*10^3/60)/(U*LMTD)in m^2\"),round(A,2)\n", - "print(\"so surface area=132.85 m^2\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.9;pg no: 490" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.9, Page:490 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\n", - "rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\n", - "heat loss per unit area by radiation(Q)in W\n", - "Q= 93597.71\n" - ] - } - ], - "source": [ - "#cal of heat loss per unit area by radiation\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.9, Page:490 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 9\")\n", - "T1=(1200+273);#temperature of body in K\n", - "T2=(600+273);#temperature of black surrounding in K\n", - "epsilon=0.4;#emissivity of body at 1200 degree celcius\n", - "sigma=5.67*10**-8;#stephen boltzman constant in W/m^2 K^4\n", - "print(\"rate of heat loss by radiation(Q)=wpsilon*sigma*A*(T1^4-T2^4)\")\n", - "print(\"heat loss per unit area by radiation(Q)in W\")\n", - "Q=epsilon*sigma*(T1**4-T2**4)\n", - "print(\"Q=\"),round(Q,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.10;pg no: 491" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.10, Page:491 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\n", - "Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\n", - "Q=V*I in W\n", - "For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\n", - "surface area for heat transfer,A2=2*%pi*r*L in m^2\n", - "R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\n", - "R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\n", - "Total resistance,R_total=R1+R2 in oc/W\n", - "Q=(T3-T1)/R_total\n", - "so T3 in degree celcius= 98.28\n", - "so temperature at interface=125.12 degree celcius\n", - "critical radius of insulation,rc in m= 0.01\n", - "rc in mm 10.67\n", - "This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\n", - "NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\n" - ] - } - ], - "source": [ - "#cal of temperature at interface\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.10, Page:491 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 10\")\n", - "V=16.;#voltage drop in V\n", - "I=5.;#current in cable in A\n", - "r2=8.*10.**-3/2.;#outer cable radius in m\n", - "r3=3.*10.**-3/2.;#copper wire radius in m\n", - "k=0.16;#thermal conductivity of copper wire in W/m oc\n", - "L=5.;#length of cable in m\n", - "h1=15.;#heat transfer coefficient of cable in W/m^2 oc\n", - "T1=40.;#temperature of surrounding in degree celcius\n", - "print(\"Let us carry out one dimentional analysis for steady state.Due to flow of electricity the heat generated can be given as:\")\n", - "print(\"Q=V*I in W\")\n", - "Q=V*I\n", - "print(\"For steady state which means there should be no change in temperature of cable due to electricity flow,the heat generated should be transferred out to surroundings.Therefore,heat transfer across table should be 80 W\")\n", - "print(\"surface area for heat transfer,A2=2*%pi*r*L in m^2\")\n", - "A2=2.*math.pi*r2*L\n", - "A2=0.125;#approx.\n", - "print(\"R1=thermal resistance due to convection between surroundings and cable outer surface,(1-2)=1/(h1*A2)\")\n", - "print(\"R2=thermal resistance due to conduction across plastic insulation(2-3)=log(r2/r3)/(2*%pi*k*L)\")\n", - "print(\"Total resistance,R_total=R1+R2 in oc/W\")\n", - "R_total=(1/(h1*A2))+(math.log(r2/r3)/(2.*math.pi*k*L))\n", - "print(\"Q=(T3-T1)/R_total\")\n", - "T3=T1+Q*R_total\n", - "print(\"so T3 in degree celcius=\"),round(T3,2)\n", - "print(\"so temperature at interface=125.12 degree celcius\")\n", - "rc=k/h1\n", - "print(\"critical radius of insulation,rc in m=\"),round(rc,2)\n", - "print(\"rc in mm\"),round(rc*1000,2)\n", - "print(\"This rc is more than outer radius of cable so the increase in thickness of insulation upon rc=110.66 mmwould increase rate of heat transfer.Doubling insulation thickness means new outer radius would be r1=1.5+5=6.5 mm.Hence doubling(increase) of insulation thickness would increase heat transfer and thus temperature at interface would decrease if other parameters reamins constant.\")\n", - "print(\"NOTE=>In this question value of R_total is calculated wrong in book,hence it is correctly solve above,so the values of R_total and T3 may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.11;pg no: 492" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.11, Page:492 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\n", - "for maximum heat transfer the critical radius of insulation should be used.\n", - "critical radius of insulation(rc)=k/h in mm\n", - "economical thickness of insulation(t)=rc-r_wire in mm\n", - "so economical thickness of insulation=7 mm\n", - "heat convected from cable surface to environment,Q in W\n", - "Q= 35.2\n", - "so heat transferred per unit length=35.2 W\n" - ] - } - ], - "source": [ - "#cal of heat transferred per unit length\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.11, Page:492 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 11\")\n", - "r_wire=3;#radius of electric wire in mm\n", - "k=0.16;#thermal conductivity in W/m oc\n", - "T_surrounding=45;#temperature of surrounding in degree celcius\n", - "T_surface=80;#temperature of surface in degree celcius\n", - "h=16;#heat transfer cooefficient in W/m^2 oc\n", - "print(\"for maximum heat transfer the critical radius of insulation should be used.\")\n", - "print(\"critical radius of insulation(rc)=k/h in mm\")\n", - "rc=k*1000/h\n", - "print(\"economical thickness of insulation(t)=rc-r_wire in mm\")\n", - "t=rc-r_wire\n", - "print(\"so economical thickness of insulation=7 mm\")\n", - "print(\"heat convected from cable surface to environment,Q in W\")\n", - "L=1;#length in mm\n", - "Q=2*math.pi*rc*L*h*(T_surface-T_surrounding)*10**-3\n", - "print(\"Q=\"),round(Q,1)\n", - "print(\"so heat transferred per unit length=35.2 W\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 12.12;pg no: 492" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 12.12, Page:492 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\n", - "heat transfer through concentric sphere,Q in KJ/hr \n", - "Q= -6297.1\n", - "so heat exchange=6297.1 KJ/hr\n" - ] - } - ], - "source": [ - "#cal of heat exchange\n", - "#intiation of all variables\n", - "# Chapter 12\n", - "import math\n", - "print\"Example 12.12, Page:492 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 12 Example 12\")\n", - "T1=(-150+273);#temperature of air inside in K\n", - "T2=(35+273);#temperature of outer surface in K\n", - "epsilon1=0.03;#emissivity\n", - "epsilon2=epsilon1;\n", - "D1=25*10**-2;#diameter of inner sphere in m\n", - "D2=30*10**-2;#diameter of outer sphere in m\n", - "sigma=2.04*10**-4;#stephen boltzmann constant in KJ/m^2 hr K^4\n", - "print(\"heat transfer through concentric sphere,Q in KJ/hr \")\n", - "A1=4*math.pi*D1**2/4;\n", - "A2=4*math.pi*D2**2/4;\n", - "Q=(A1*sigma*(T1**4-T2**4))/((1/epsilon1)+((A1/A2)*((1/epsilon2)-1)))\n", - "print(\"Q=\"),round(Q,2)\n", - "print(\"so heat exchange=6297.1 KJ/hr\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter13.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter13.ipynb deleted file mode 100755 index 836097b9..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter13.ipynb +++ /dev/null @@ -1,375 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 13:One Dimensional Compressible Fluid Flow" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.1;pg no: 525" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.1, Page:525 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\n", - "mass flow rate(m)=rho*A*C\n", - "so rho*C=4*m/(%pi*d^2)\n", - "so rho=165.79/C\n", - "now using perfect gas equation,p=rho*R*T\n", - "T=P/(rho*R)=P/((165.79/C)*R)\n", - "C/T=165.79*R/P\n", - "so C=1.19*T\n", - "we know,C^2=((2*y*R)/(y-1))*(To-T)\n", - "C^2=(2*1.4*287)*(300-T)/(1.4-1)\n", - "C^2=602.7*10^3-2009*T\n", - "C^2+1688.23*C-602.7*10^3=0\n", - "solving we get,C=302.72 m/s and T=254.39 K\n", - "using stagnation property relation,\n", - "To/T=1+(y-1)*M^2/2\n", - "so M= 0.947\n", - "stagnation pressure,Po in bar= 0.472\n", - "so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\n" - ] - } - ], - "source": [ - "#cal of mach number,stagnation pressure,velocity\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.1, Page:525 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\")\n", - "To=(27+273);#stagnation temperature in K\n", - "P=0.4*10**5;#static pressure in pa\n", - "m=3000/3600;#air flowing rate in kg/s\n", - "d=80*10**-3;#diameter of duct in m\n", - "R=287;#gas constant in J/kg K\n", - "y=1.4;#expansion constant\n", - "print(\"mass flow rate(m)=rho*A*C\")\n", - "print(\"so rho*C=4*m/(%pi*d^2)\")\n", - "4*m/(math.pi*d**2)\n", - "print(\"so rho=165.79/C\")\n", - "print(\"now using perfect gas equation,p=rho*R*T\")\n", - "print(\"T=P/(rho*R)=P/((165.79/C)*R)\")\n", - "print(\"C/T=165.79*R/P\")\n", - "165.79*R/P\n", - "print(\"so C=1.19*T\")\n", - "print(\"we know,C^2=((2*y*R)/(y-1))*(To-T)\")\n", - "print(\"C^2=(2*1.4*287)*(300-T)/(1.4-1)\")\n", - "print(\"C^2=602.7*10^3-2009*T\")\n", - "print(\"C^2+1688.23*C-602.7*10^3=0\")\n", - "print(\"solving we get,C=302.72 m/s and T=254.39 K\")\n", - "C=302.72;\n", - "T=254.39;\n", - "print(\"using stagnation property relation,\")\n", - "print(\"To/T=1+(y-1)*M^2/2\")\n", - "M=math.sqrt(((To/T)-1)/((y-1)/2))\n", - "print(\"so M=\"),round(M,3)\n", - "M=0.947;#approx.\n", - "Po=P*(1+(y-1)*M**2/2)/10**5\n", - "print(\"stagnation pressure,Po in bar=\"),round(Po,3)\n", - "print(\"so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.2;pg no: 525" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.2, Page:525 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\n", - "mach number,M_a=(1/sin(a))=sqrt(2)\n", - "here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\n", - "T=To*0.6717 in K\n", - "and C_max=M*sqrt(y*R*T) in m/s\n", - "corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\n", - "so T=0.7145*To in K\n", - "and C_av=M_a*sqrt(y*R*T) in m/s\n", - "ratio of kinetic energy= 0.869\n", - "so ratio of kinetic energy=0.869\n" - ] - } - ], - "source": [ - "#cal of ratio of kinetic energy\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.2, Page:525 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\")\n", - "To=(273.+1100.);#stagnation temperature in K\n", - "a=45.;#mach angle over exit cross-section in degree\n", - "Po=1.01;#pressure at upstream side of nozzle in bar\n", - "P=0.25;#ststic pressure in bar\n", - "y=1.4;#expansion constant \n", - "R=287.;#gas constant in J/kg K\n", - "print(\"mach number,M_a=(1/sin(a))=sqrt(2)\")\n", - "M_a=math.sqrt(2)\n", - "M_a=1.414;#approx.\n", - "print(\"here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\")\n", - "M=1.564;\n", - "print(\"T=To*0.6717 in K\")\n", - "T=To*0.6717\n", - "print(\"and C_max=M*sqrt(y*R*T) in m/s\")\n", - "C_max=M*math.sqrt(y*R*T)\n", - "print(\"corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\")\n", - "print(\"so T=0.7145*To in K\")\n", - "T=0.7145*To\n", - "print(\"and C_av=M_a*sqrt(y*R*T) in m/s\")\n", - "C_av=M_a*math.sqrt(y*R*T)\n", - "print(\"ratio of kinetic energy=\"),round(((1./2.)*C_av**2)/((1./2.)*C_max**2),3)\n", - "print(\"so ratio of kinetic energy=0.869\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.3;pg no: 526" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.3, Page:526 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\n", - "From bernoulli equation,Po-P=(1/2)*rho*C^2\n", - "so Po=P+(1/2)*rho*C^2 in N/m^2\n", - "speed indicator reading shall be given by mach no.s\n", - "mach no.,M=C/a=C/sqrt(y*R*T)\n", - "using perfect gas equation,P=rho*R*T\n", - "so T=P/(rho*R)in K\n", - "so mach no.,M 0.95\n", - "considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", - "so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\n", - "also Po-P=(1+k)*(1/2)*rho*C^2\n", - "substitution yields,k= 0.2437\n", - "so compressibility correction factor,k=0.2437\n" - ] - } - ], - "source": [ - "#cal of mach no,compressibility correction factor\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.3, Page:526 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\")\n", - "C=300.;#aircraft flying speed in m/s\n", - "P=0.472*10**5;#altitude pressure in Pa\n", - "rho=0.659;#density in kg/m^3\n", - "y=1.4;#expansion constant\n", - "R=287.;#gas constant in J/kg K\n", - "print(\"From bernoulli equation,Po-P=(1/2)*rho*C^2\")\n", - "print(\"so Po=P+(1/2)*rho*C^2 in N/m^2\")\n", - "Po=P+(1/2)*rho*C**2\n", - "print(\"speed indicator reading shall be given by mach no.s\")\n", - "print(\"mach no.,M=C/a=C/sqrt(y*R*T)\")\n", - "print(\"using perfect gas equation,P=rho*R*T\")\n", - "print(\"so T=P/(rho*R)in K\")\n", - "T=P/(rho*R)\n", - "M=C/math.sqrt(y*R*T)\n", - "print(\"so mach no.,M\"),round(M,2)\n", - "M=0.947;#approx.\n", - "print(\"considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", - "print(\"so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\")\n", - "Po=P*((1+(y-1)*M**2/2)**(y/(y-1)))\n", - "print(\"also Po-P=(1+k)*(1/2)*rho*C^2\")\n", - "k=((Po-P)/((1./2.)*rho*C**2))-1.\n", - "print(\"substitution yields,k=\"),round(k,4)\n", - "print(\"so compressibility correction factor,k=0.2437\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.4;pg no: 527" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.4, Page:527 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\n", - "we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\n", - "so M= 1.897\n", - "so mach number,M=1.89\n" - ] - } - ], - "source": [ - "#cal of mach number\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.4, Page:527 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\")\n", - "Po=2;#total pressure in bar\n", - "P=0.3;#static pressure in bar\n", - "y=1.4;#expansion constant\n", - "print(\"we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\")\n", - "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", - "print(\"so M=\"),round(M,3)\n", - "print(\"so mach number,M=1.89\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.5;pg no: 527" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.5, Page:527 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\n", - "actual static pressure(P)=1+0.3 in bar\n", - "It is also given that,Po-P=0.6,\n", - "so Po=P+0.6 in bar\n", - "air velocity,ao=sqrt(y*R*To)in m/s\n", - "density of air,rho_o=Po/(R*To)in \n", - "considering air to be in-compressible,\n", - "Po=P+rho_o*C^2/2\n", - "so C in m/s= 235.13\n", - "for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", - "so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", - "compressibility correction factor,k\n", - "k=(M^2/4)+((2-y)/24)*M^4\n", - "stagnation temperature,To/T=1+((y-1)/2)*M^2\n", - "so T=To/(1+((y-1)/2)*M^2) in K\n", - "density,rho=P/(R*T) in kg/m^3\n", - "substituting Po-P=(1/2)*rho*C^2(1+k)\n", - "C in m/s= 250.94\n", - "so C=250.95 m/s\n" - ] - } - ], - "source": [ - "#cal of air stream velocity\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.5, Page:527 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\")\n", - "To=305.;#stagnation temperature of air stream in K\n", - "y=1.4;#expansion constant\n", - "R=287.;#gas constant in J/kg K\n", - "print(\"actual static pressure(P)=1+0.3 in bar\")\n", - "P=1.+0.3\n", - "print(\"It is also given that,Po-P=0.6,\")\n", - "print(\"so Po=P+0.6 in bar\")\n", - "Po=P+0.6\n", - "print(\"air velocity,ao=sqrt(y*R*To)in m/s\")\n", - "ao=math.sqrt(y*R*To)\n", - "print(\"density of air,rho_o=Po/(R*To)in \")\n", - "rho_o=Po*10.**5/(R*To)\n", - "print(\"considering air to be in-compressible,\")\n", - "print(\"Po=P+rho_o*C^2/2\")\n", - "C=math.sqrt((Po-P)*10.**5*2./rho_o)\n", - "print(\"so C in m/s=\"),round(C,2)\n", - "print(\"for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", - "print(\"so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\")\n", - "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", - "M=0.7567;#approx.\n", - "print(\"compressibility correction factor,k\")\n", - "print(\"k=(M^2/4)+((2-y)/24)*M^4\")\n", - "k=(M**2/4.)+((2.-y)/24.)*M**4\n", - "print(\"stagnation temperature,To/T=1+((y-1)/2)*M^2\")\n", - "print(\"so T=To/(1+((y-1)/2)*M^2) in K\")\n", - "T=To/(1+((y-1)/2)*M**2)\n", - "print(\"density,rho=P/(R*T) in kg/m^3\")\n", - "rho=P*10**5/(R*T)\n", - "print(\"substituting Po-P=(1/2)*rho*C^2(1+k)\")\n", - "C=math.sqrt((Po-P)*10.**5/((1./2.)*rho*(1.+k)))\n", - "print(\"C in m/s=\"),round(C,2)\n", - "print(\"so C=250.95 m/s\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter13_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter13_1.ipynb deleted file mode 100755 index 836097b9..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter13_1.ipynb +++ /dev/null @@ -1,375 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 13:One Dimensional Compressible Fluid Flow" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.1;pg no: 525" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.1, Page:525 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\n", - "mass flow rate(m)=rho*A*C\n", - "so rho*C=4*m/(%pi*d^2)\n", - "so rho=165.79/C\n", - "now using perfect gas equation,p=rho*R*T\n", - "T=P/(rho*R)=P/((165.79/C)*R)\n", - "C/T=165.79*R/P\n", - "so C=1.19*T\n", - "we know,C^2=((2*y*R)/(y-1))*(To-T)\n", - "C^2=(2*1.4*287)*(300-T)/(1.4-1)\n", - "C^2=602.7*10^3-2009*T\n", - "C^2+1688.23*C-602.7*10^3=0\n", - "solving we get,C=302.72 m/s and T=254.39 K\n", - "using stagnation property relation,\n", - "To/T=1+(y-1)*M^2/2\n", - "so M= 0.947\n", - "stagnation pressure,Po in bar= 0.472\n", - "so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\n" - ] - } - ], - "source": [ - "#cal of mach number,stagnation pressure,velocity\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.1, Page:525 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\")\n", - "To=(27+273);#stagnation temperature in K\n", - "P=0.4*10**5;#static pressure in pa\n", - "m=3000/3600;#air flowing rate in kg/s\n", - "d=80*10**-3;#diameter of duct in m\n", - "R=287;#gas constant in J/kg K\n", - "y=1.4;#expansion constant\n", - "print(\"mass flow rate(m)=rho*A*C\")\n", - "print(\"so rho*C=4*m/(%pi*d^2)\")\n", - "4*m/(math.pi*d**2)\n", - "print(\"so rho=165.79/C\")\n", - "print(\"now using perfect gas equation,p=rho*R*T\")\n", - "print(\"T=P/(rho*R)=P/((165.79/C)*R)\")\n", - "print(\"C/T=165.79*R/P\")\n", - "165.79*R/P\n", - "print(\"so C=1.19*T\")\n", - "print(\"we know,C^2=((2*y*R)/(y-1))*(To-T)\")\n", - "print(\"C^2=(2*1.4*287)*(300-T)/(1.4-1)\")\n", - "print(\"C^2=602.7*10^3-2009*T\")\n", - "print(\"C^2+1688.23*C-602.7*10^3=0\")\n", - "print(\"solving we get,C=302.72 m/s and T=254.39 K\")\n", - "C=302.72;\n", - "T=254.39;\n", - "print(\"using stagnation property relation,\")\n", - "print(\"To/T=1+(y-1)*M^2/2\")\n", - "M=math.sqrt(((To/T)-1)/((y-1)/2))\n", - "print(\"so M=\"),round(M,3)\n", - "M=0.947;#approx.\n", - "Po=P*(1+(y-1)*M**2/2)/10**5\n", - "print(\"stagnation pressure,Po in bar=\"),round(Po,3)\n", - "print(\"so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.2;pg no: 525" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.2, Page:525 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\n", - "mach number,M_a=(1/sin(a))=sqrt(2)\n", - "here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\n", - "T=To*0.6717 in K\n", - "and C_max=M*sqrt(y*R*T) in m/s\n", - "corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\n", - "so T=0.7145*To in K\n", - "and C_av=M_a*sqrt(y*R*T) in m/s\n", - "ratio of kinetic energy= 0.869\n", - "so ratio of kinetic energy=0.869\n" - ] - } - ], - "source": [ - "#cal of ratio of kinetic energy\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.2, Page:525 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\")\n", - "To=(273.+1100.);#stagnation temperature in K\n", - "a=45.;#mach angle over exit cross-section in degree\n", - "Po=1.01;#pressure at upstream side of nozzle in bar\n", - "P=0.25;#ststic pressure in bar\n", - "y=1.4;#expansion constant \n", - "R=287.;#gas constant in J/kg K\n", - "print(\"mach number,M_a=(1/sin(a))=sqrt(2)\")\n", - "M_a=math.sqrt(2)\n", - "M_a=1.414;#approx.\n", - "print(\"here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\")\n", - "M=1.564;\n", - "print(\"T=To*0.6717 in K\")\n", - "T=To*0.6717\n", - "print(\"and C_max=M*sqrt(y*R*T) in m/s\")\n", - "C_max=M*math.sqrt(y*R*T)\n", - "print(\"corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\")\n", - "print(\"so T=0.7145*To in K\")\n", - "T=0.7145*To\n", - "print(\"and C_av=M_a*sqrt(y*R*T) in m/s\")\n", - "C_av=M_a*math.sqrt(y*R*T)\n", - "print(\"ratio of kinetic energy=\"),round(((1./2.)*C_av**2)/((1./2.)*C_max**2),3)\n", - "print(\"so ratio of kinetic energy=0.869\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.3;pg no: 526" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.3, Page:526 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\n", - "From bernoulli equation,Po-P=(1/2)*rho*C^2\n", - "so Po=P+(1/2)*rho*C^2 in N/m^2\n", - "speed indicator reading shall be given by mach no.s\n", - "mach no.,M=C/a=C/sqrt(y*R*T)\n", - "using perfect gas equation,P=rho*R*T\n", - "so T=P/(rho*R)in K\n", - "so mach no.,M 0.95\n", - "considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", - "so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\n", - "also Po-P=(1+k)*(1/2)*rho*C^2\n", - "substitution yields,k= 0.2437\n", - "so compressibility correction factor,k=0.2437\n" - ] - } - ], - "source": [ - "#cal of mach no,compressibility correction factor\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.3, Page:526 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\")\n", - "C=300.;#aircraft flying speed in m/s\n", - "P=0.472*10**5;#altitude pressure in Pa\n", - "rho=0.659;#density in kg/m^3\n", - "y=1.4;#expansion constant\n", - "R=287.;#gas constant in J/kg K\n", - "print(\"From bernoulli equation,Po-P=(1/2)*rho*C^2\")\n", - "print(\"so Po=P+(1/2)*rho*C^2 in N/m^2\")\n", - "Po=P+(1/2)*rho*C**2\n", - "print(\"speed indicator reading shall be given by mach no.s\")\n", - "print(\"mach no.,M=C/a=C/sqrt(y*R*T)\")\n", - "print(\"using perfect gas equation,P=rho*R*T\")\n", - "print(\"so T=P/(rho*R)in K\")\n", - "T=P/(rho*R)\n", - "M=C/math.sqrt(y*R*T)\n", - "print(\"so mach no.,M\"),round(M,2)\n", - "M=0.947;#approx.\n", - "print(\"considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", - "print(\"so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\")\n", - "Po=P*((1+(y-1)*M**2/2)**(y/(y-1)))\n", - "print(\"also Po-P=(1+k)*(1/2)*rho*C^2\")\n", - "k=((Po-P)/((1./2.)*rho*C**2))-1.\n", - "print(\"substitution yields,k=\"),round(k,4)\n", - "print(\"so compressibility correction factor,k=0.2437\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.4;pg no: 527" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.4, Page:527 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\n", - "we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\n", - "so M= 1.897\n", - "so mach number,M=1.89\n" - ] - } - ], - "source": [ - "#cal of mach number\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.4, Page:527 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\")\n", - "Po=2;#total pressure in bar\n", - "P=0.3;#static pressure in bar\n", - "y=1.4;#expansion constant\n", - "print(\"we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\")\n", - "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", - "print(\"so M=\"),round(M,3)\n", - "print(\"so mach number,M=1.89\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.5;pg no: 527" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.5, Page:527 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\n", - "actual static pressure(P)=1+0.3 in bar\n", - "It is also given that,Po-P=0.6,\n", - "so Po=P+0.6 in bar\n", - "air velocity,ao=sqrt(y*R*To)in m/s\n", - "density of air,rho_o=Po/(R*To)in \n", - "considering air to be in-compressible,\n", - "Po=P+rho_o*C^2/2\n", - "so C in m/s= 235.13\n", - "for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", - "so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", - "compressibility correction factor,k\n", - "k=(M^2/4)+((2-y)/24)*M^4\n", - "stagnation temperature,To/T=1+((y-1)/2)*M^2\n", - "so T=To/(1+((y-1)/2)*M^2) in K\n", - "density,rho=P/(R*T) in kg/m^3\n", - "substituting Po-P=(1/2)*rho*C^2(1+k)\n", - "C in m/s= 250.94\n", - "so C=250.95 m/s\n" - ] - } - ], - "source": [ - "#cal of air stream velocity\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.5, Page:527 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\")\n", - "To=305.;#stagnation temperature of air stream in K\n", - "y=1.4;#expansion constant\n", - "R=287.;#gas constant in J/kg K\n", - "print(\"actual static pressure(P)=1+0.3 in bar\")\n", - "P=1.+0.3\n", - "print(\"It is also given that,Po-P=0.6,\")\n", - "print(\"so Po=P+0.6 in bar\")\n", - "Po=P+0.6\n", - "print(\"air velocity,ao=sqrt(y*R*To)in m/s\")\n", - "ao=math.sqrt(y*R*To)\n", - "print(\"density of air,rho_o=Po/(R*To)in \")\n", - "rho_o=Po*10.**5/(R*To)\n", - "print(\"considering air to be in-compressible,\")\n", - "print(\"Po=P+rho_o*C^2/2\")\n", - "C=math.sqrt((Po-P)*10.**5*2./rho_o)\n", - "print(\"so C in m/s=\"),round(C,2)\n", - "print(\"for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", - "print(\"so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\")\n", - "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", - "M=0.7567;#approx.\n", - "print(\"compressibility correction factor,k\")\n", - "print(\"k=(M^2/4)+((2-y)/24)*M^4\")\n", - "k=(M**2/4.)+((2.-y)/24.)*M**4\n", - "print(\"stagnation temperature,To/T=1+((y-1)/2)*M^2\")\n", - "print(\"so T=To/(1+((y-1)/2)*M^2) in K\")\n", - "T=To/(1+((y-1)/2)*M**2)\n", - "print(\"density,rho=P/(R*T) in kg/m^3\")\n", - "rho=P*10**5/(R*T)\n", - "print(\"substituting Po-P=(1/2)*rho*C^2(1+k)\")\n", - "C=math.sqrt((Po-P)*10.**5/((1./2.)*rho*(1.+k)))\n", - "print(\"C in m/s=\"),round(C,2)\n", - "print(\"so C=250.95 m/s\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter13_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter13_2.ipynb deleted file mode 100755 index 836097b9..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter13_2.ipynb +++ /dev/null @@ -1,375 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 13:One Dimensional Compressible Fluid Flow" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.1;pg no: 525" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.1, Page:525 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\n", - "mass flow rate(m)=rho*A*C\n", - "so rho*C=4*m/(%pi*d^2)\n", - "so rho=165.79/C\n", - "now using perfect gas equation,p=rho*R*T\n", - "T=P/(rho*R)=P/((165.79/C)*R)\n", - "C/T=165.79*R/P\n", - "so C=1.19*T\n", - "we know,C^2=((2*y*R)/(y-1))*(To-T)\n", - "C^2=(2*1.4*287)*(300-T)/(1.4-1)\n", - "C^2=602.7*10^3-2009*T\n", - "C^2+1688.23*C-602.7*10^3=0\n", - "solving we get,C=302.72 m/s and T=254.39 K\n", - "using stagnation property relation,\n", - "To/T=1+(y-1)*M^2/2\n", - "so M= 0.947\n", - "stagnation pressure,Po in bar= 0.472\n", - "so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\n" - ] - } - ], - "source": [ - "#cal of mach number,stagnation pressure,velocity\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.1, Page:525 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\")\n", - "To=(27+273);#stagnation temperature in K\n", - "P=0.4*10**5;#static pressure in pa\n", - "m=3000/3600;#air flowing rate in kg/s\n", - "d=80*10**-3;#diameter of duct in m\n", - "R=287;#gas constant in J/kg K\n", - "y=1.4;#expansion constant\n", - "print(\"mass flow rate(m)=rho*A*C\")\n", - "print(\"so rho*C=4*m/(%pi*d^2)\")\n", - "4*m/(math.pi*d**2)\n", - "print(\"so rho=165.79/C\")\n", - "print(\"now using perfect gas equation,p=rho*R*T\")\n", - "print(\"T=P/(rho*R)=P/((165.79/C)*R)\")\n", - "print(\"C/T=165.79*R/P\")\n", - "165.79*R/P\n", - "print(\"so C=1.19*T\")\n", - "print(\"we know,C^2=((2*y*R)/(y-1))*(To-T)\")\n", - "print(\"C^2=(2*1.4*287)*(300-T)/(1.4-1)\")\n", - "print(\"C^2=602.7*10^3-2009*T\")\n", - "print(\"C^2+1688.23*C-602.7*10^3=0\")\n", - "print(\"solving we get,C=302.72 m/s and T=254.39 K\")\n", - "C=302.72;\n", - "T=254.39;\n", - "print(\"using stagnation property relation,\")\n", - "print(\"To/T=1+(y-1)*M^2/2\")\n", - "M=math.sqrt(((To/T)-1)/((y-1)/2))\n", - "print(\"so M=\"),round(M,3)\n", - "M=0.947;#approx.\n", - "Po=P*(1+(y-1)*M**2/2)/10**5\n", - "print(\"stagnation pressure,Po in bar=\"),round(Po,3)\n", - "print(\"so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.2;pg no: 525" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.2, Page:525 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\n", - "mach number,M_a=(1/sin(a))=sqrt(2)\n", - "here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\n", - "T=To*0.6717 in K\n", - "and C_max=M*sqrt(y*R*T) in m/s\n", - "corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\n", - "so T=0.7145*To in K\n", - "and C_av=M_a*sqrt(y*R*T) in m/s\n", - "ratio of kinetic energy= 0.869\n", - "so ratio of kinetic energy=0.869\n" - ] - } - ], - "source": [ - "#cal of ratio of kinetic energy\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.2, Page:525 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\")\n", - "To=(273.+1100.);#stagnation temperature in K\n", - "a=45.;#mach angle over exit cross-section in degree\n", - "Po=1.01;#pressure at upstream side of nozzle in bar\n", - "P=0.25;#ststic pressure in bar\n", - "y=1.4;#expansion constant \n", - "R=287.;#gas constant in J/kg K\n", - "print(\"mach number,M_a=(1/sin(a))=sqrt(2)\")\n", - "M_a=math.sqrt(2)\n", - "M_a=1.414;#approx.\n", - "print(\"here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\")\n", - "M=1.564;\n", - "print(\"T=To*0.6717 in K\")\n", - "T=To*0.6717\n", - "print(\"and C_max=M*sqrt(y*R*T) in m/s\")\n", - "C_max=M*math.sqrt(y*R*T)\n", - "print(\"corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\")\n", - "print(\"so T=0.7145*To in K\")\n", - "T=0.7145*To\n", - "print(\"and C_av=M_a*sqrt(y*R*T) in m/s\")\n", - "C_av=M_a*math.sqrt(y*R*T)\n", - "print(\"ratio of kinetic energy=\"),round(((1./2.)*C_av**2)/((1./2.)*C_max**2),3)\n", - "print(\"so ratio of kinetic energy=0.869\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.3;pg no: 526" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.3, Page:526 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\n", - "From bernoulli equation,Po-P=(1/2)*rho*C^2\n", - "so Po=P+(1/2)*rho*C^2 in N/m^2\n", - "speed indicator reading shall be given by mach no.s\n", - "mach no.,M=C/a=C/sqrt(y*R*T)\n", - "using perfect gas equation,P=rho*R*T\n", - "so T=P/(rho*R)in K\n", - "so mach no.,M 0.95\n", - "considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", - "so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\n", - "also Po-P=(1+k)*(1/2)*rho*C^2\n", - "substitution yields,k= 0.2437\n", - "so compressibility correction factor,k=0.2437\n" - ] - } - ], - "source": [ - "#cal of mach no,compressibility correction factor\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.3, Page:526 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\")\n", - "C=300.;#aircraft flying speed in m/s\n", - "P=0.472*10**5;#altitude pressure in Pa\n", - "rho=0.659;#density in kg/m^3\n", - "y=1.4;#expansion constant\n", - "R=287.;#gas constant in J/kg K\n", - "print(\"From bernoulli equation,Po-P=(1/2)*rho*C^2\")\n", - "print(\"so Po=P+(1/2)*rho*C^2 in N/m^2\")\n", - "Po=P+(1/2)*rho*C**2\n", - "print(\"speed indicator reading shall be given by mach no.s\")\n", - "print(\"mach no.,M=C/a=C/sqrt(y*R*T)\")\n", - "print(\"using perfect gas equation,P=rho*R*T\")\n", - "print(\"so T=P/(rho*R)in K\")\n", - "T=P/(rho*R)\n", - "M=C/math.sqrt(y*R*T)\n", - "print(\"so mach no.,M\"),round(M,2)\n", - "M=0.947;#approx.\n", - "print(\"considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", - "print(\"so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\")\n", - "Po=P*((1+(y-1)*M**2/2)**(y/(y-1)))\n", - "print(\"also Po-P=(1+k)*(1/2)*rho*C^2\")\n", - "k=((Po-P)/((1./2.)*rho*C**2))-1.\n", - "print(\"substitution yields,k=\"),round(k,4)\n", - "print(\"so compressibility correction factor,k=0.2437\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.4;pg no: 527" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.4, Page:527 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\n", - "we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\n", - "so M= 1.897\n", - "so mach number,M=1.89\n" - ] - } - ], - "source": [ - "#cal of mach number\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.4, Page:527 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\")\n", - "Po=2;#total pressure in bar\n", - "P=0.3;#static pressure in bar\n", - "y=1.4;#expansion constant\n", - "print(\"we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\")\n", - "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", - "print(\"so M=\"),round(M,3)\n", - "print(\"so mach number,M=1.89\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.5;pg no: 527" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.5, Page:527 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\n", - "actual static pressure(P)=1+0.3 in bar\n", - "It is also given that,Po-P=0.6,\n", - "so Po=P+0.6 in bar\n", - "air velocity,ao=sqrt(y*R*To)in m/s\n", - "density of air,rho_o=Po/(R*To)in \n", - "considering air to be in-compressible,\n", - "Po=P+rho_o*C^2/2\n", - "so C in m/s= 235.13\n", - "for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", - "so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", - "compressibility correction factor,k\n", - "k=(M^2/4)+((2-y)/24)*M^4\n", - "stagnation temperature,To/T=1+((y-1)/2)*M^2\n", - "so T=To/(1+((y-1)/2)*M^2) in K\n", - "density,rho=P/(R*T) in kg/m^3\n", - "substituting Po-P=(1/2)*rho*C^2(1+k)\n", - "C in m/s= 250.94\n", - "so C=250.95 m/s\n" - ] - } - ], - "source": [ - "#cal of air stream velocity\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.5, Page:527 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\")\n", - "To=305.;#stagnation temperature of air stream in K\n", - "y=1.4;#expansion constant\n", - "R=287.;#gas constant in J/kg K\n", - "print(\"actual static pressure(P)=1+0.3 in bar\")\n", - "P=1.+0.3\n", - "print(\"It is also given that,Po-P=0.6,\")\n", - "print(\"so Po=P+0.6 in bar\")\n", - "Po=P+0.6\n", - "print(\"air velocity,ao=sqrt(y*R*To)in m/s\")\n", - "ao=math.sqrt(y*R*To)\n", - "print(\"density of air,rho_o=Po/(R*To)in \")\n", - "rho_o=Po*10.**5/(R*To)\n", - "print(\"considering air to be in-compressible,\")\n", - "print(\"Po=P+rho_o*C^2/2\")\n", - "C=math.sqrt((Po-P)*10.**5*2./rho_o)\n", - "print(\"so C in m/s=\"),round(C,2)\n", - "print(\"for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", - "print(\"so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\")\n", - "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", - "M=0.7567;#approx.\n", - "print(\"compressibility correction factor,k\")\n", - "print(\"k=(M^2/4)+((2-y)/24)*M^4\")\n", - "k=(M**2/4.)+((2.-y)/24.)*M**4\n", - "print(\"stagnation temperature,To/T=1+((y-1)/2)*M^2\")\n", - "print(\"so T=To/(1+((y-1)/2)*M^2) in K\")\n", - "T=To/(1+((y-1)/2)*M**2)\n", - "print(\"density,rho=P/(R*T) in kg/m^3\")\n", - "rho=P*10**5/(R*T)\n", - "print(\"substituting Po-P=(1/2)*rho*C^2(1+k)\")\n", - "C=math.sqrt((Po-P)*10.**5/((1./2.)*rho*(1.+k)))\n", - "print(\"C in m/s=\"),round(C,2)\n", - "print(\"so C=250.95 m/s\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter13_3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter13_3.ipynb deleted file mode 100755 index 836097b9..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter13_3.ipynb +++ /dev/null @@ -1,375 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 13:One Dimensional Compressible Fluid Flow" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.1;pg no: 525" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.1, Page:525 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\n", - "mass flow rate(m)=rho*A*C\n", - "so rho*C=4*m/(%pi*d^2)\n", - "so rho=165.79/C\n", - "now using perfect gas equation,p=rho*R*T\n", - "T=P/(rho*R)=P/((165.79/C)*R)\n", - "C/T=165.79*R/P\n", - "so C=1.19*T\n", - "we know,C^2=((2*y*R)/(y-1))*(To-T)\n", - "C^2=(2*1.4*287)*(300-T)/(1.4-1)\n", - "C^2=602.7*10^3-2009*T\n", - "C^2+1688.23*C-602.7*10^3=0\n", - "solving we get,C=302.72 m/s and T=254.39 K\n", - "using stagnation property relation,\n", - "To/T=1+(y-1)*M^2/2\n", - "so M= 0.947\n", - "stagnation pressure,Po in bar= 0.472\n", - "so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\n" - ] - } - ], - "source": [ - "#cal of mach number,stagnation pressure,velocity\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.1, Page:525 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 1\")\n", - "To=(27+273);#stagnation temperature in K\n", - "P=0.4*10**5;#static pressure in pa\n", - "m=3000/3600;#air flowing rate in kg/s\n", - "d=80*10**-3;#diameter of duct in m\n", - "R=287;#gas constant in J/kg K\n", - "y=1.4;#expansion constant\n", - "print(\"mass flow rate(m)=rho*A*C\")\n", - "print(\"so rho*C=4*m/(%pi*d^2)\")\n", - "4*m/(math.pi*d**2)\n", - "print(\"so rho=165.79/C\")\n", - "print(\"now using perfect gas equation,p=rho*R*T\")\n", - "print(\"T=P/(rho*R)=P/((165.79/C)*R)\")\n", - "print(\"C/T=165.79*R/P\")\n", - "165.79*R/P\n", - "print(\"so C=1.19*T\")\n", - "print(\"we know,C^2=((2*y*R)/(y-1))*(To-T)\")\n", - "print(\"C^2=(2*1.4*287)*(300-T)/(1.4-1)\")\n", - "print(\"C^2=602.7*10^3-2009*T\")\n", - "print(\"C^2+1688.23*C-602.7*10^3=0\")\n", - "print(\"solving we get,C=302.72 m/s and T=254.39 K\")\n", - "C=302.72;\n", - "T=254.39;\n", - "print(\"using stagnation property relation,\")\n", - "print(\"To/T=1+(y-1)*M^2/2\")\n", - "M=math.sqrt(((To/T)-1)/((y-1)/2))\n", - "print(\"so M=\"),round(M,3)\n", - "M=0.947;#approx.\n", - "Po=P*(1+(y-1)*M**2/2)/10**5\n", - "print(\"stagnation pressure,Po in bar=\"),round(Po,3)\n", - "print(\"so mach number=0.947,stagnation pressure=0.472 bar,velocity=302.72 m/s\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.2;pg no: 525" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.2, Page:525 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\n", - "mach number,M_a=(1/sin(a))=sqrt(2)\n", - "here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\n", - "T=To*0.6717 in K\n", - "and C_max=M*sqrt(y*R*T) in m/s\n", - "corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\n", - "so T=0.7145*To in K\n", - "and C_av=M_a*sqrt(y*R*T) in m/s\n", - "ratio of kinetic energy= 0.869\n", - "so ratio of kinetic energy=0.869\n" - ] - } - ], - "source": [ - "#cal of ratio of kinetic energy\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.2, Page:525 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 2\")\n", - "To=(273.+1100.);#stagnation temperature in K\n", - "a=45.;#mach angle over exit cross-section in degree\n", - "Po=1.01;#pressure at upstream side of nozzle in bar\n", - "P=0.25;#ststic pressure in bar\n", - "y=1.4;#expansion constant \n", - "R=287.;#gas constant in J/kg K\n", - "print(\"mach number,M_a=(1/sin(a))=sqrt(2)\")\n", - "M_a=math.sqrt(2)\n", - "M_a=1.414;#approx.\n", - "print(\"here,P/Po=0.25/1.01=0.2475.Corresponding to this P/Po ratio the mach number and T/To can be seen from air table as M=1.564 and T/To=0.6717\")\n", - "M=1.564;\n", - "print(\"T=To*0.6717 in K\")\n", - "T=To*0.6717\n", - "print(\"and C_max=M*sqrt(y*R*T) in m/s\")\n", - "C_max=M*math.sqrt(y*R*T)\n", - "print(\"corresponding to mach number(M_a=1.414)as obtained from experimental observation,the T/To can be seen from air table and it comes out as (T/To)=0.7145\")\n", - "print(\"so T=0.7145*To in K\")\n", - "T=0.7145*To\n", - "print(\"and C_av=M_a*sqrt(y*R*T) in m/s\")\n", - "C_av=M_a*math.sqrt(y*R*T)\n", - "print(\"ratio of kinetic energy=\"),round(((1./2.)*C_av**2)/((1./2.)*C_max**2),3)\n", - "print(\"so ratio of kinetic energy=0.869\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.3;pg no: 526" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.3, Page:526 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\n", - "From bernoulli equation,Po-P=(1/2)*rho*C^2\n", - "so Po=P+(1/2)*rho*C^2 in N/m^2\n", - "speed indicator reading shall be given by mach no.s\n", - "mach no.,M=C/a=C/sqrt(y*R*T)\n", - "using perfect gas equation,P=rho*R*T\n", - "so T=P/(rho*R)in K\n", - "so mach no.,M 0.95\n", - "considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", - "so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\n", - "also Po-P=(1+k)*(1/2)*rho*C^2\n", - "substitution yields,k= 0.2437\n", - "so compressibility correction factor,k=0.2437\n" - ] - } - ], - "source": [ - "#cal of mach no,compressibility correction factor\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.3, Page:526 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 3\")\n", - "C=300.;#aircraft flying speed in m/s\n", - "P=0.472*10**5;#altitude pressure in Pa\n", - "rho=0.659;#density in kg/m^3\n", - "y=1.4;#expansion constant\n", - "R=287.;#gas constant in J/kg K\n", - "print(\"From bernoulli equation,Po-P=(1/2)*rho*C^2\")\n", - "print(\"so Po=P+(1/2)*rho*C^2 in N/m^2\")\n", - "Po=P+(1/2)*rho*C**2\n", - "print(\"speed indicator reading shall be given by mach no.s\")\n", - "print(\"mach no.,M=C/a=C/sqrt(y*R*T)\")\n", - "print(\"using perfect gas equation,P=rho*R*T\")\n", - "print(\"so T=P/(rho*R)in K\")\n", - "T=P/(rho*R)\n", - "M=C/math.sqrt(y*R*T)\n", - "print(\"so mach no.,M\"),round(M,2)\n", - "M=0.947;#approx.\n", - "print(\"considering compressibility effect,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", - "print(\"so stagnation pressure,Po=P*((1+(y-1)*M^2/2)^(y/(y-1)))in N/m^2\")\n", - "Po=P*((1+(y-1)*M**2/2)**(y/(y-1)))\n", - "print(\"also Po-P=(1+k)*(1/2)*rho*C^2\")\n", - "k=((Po-P)/((1./2.)*rho*C**2))-1.\n", - "print(\"substitution yields,k=\"),round(k,4)\n", - "print(\"so compressibility correction factor,k=0.2437\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.4;pg no: 527" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.4, Page:527 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\n", - "we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\n", - "so M= 1.897\n", - "so mach number,M=1.89\n" - ] - } - ], - "source": [ - "#cal of mach number\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.4, Page:527 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 4\")\n", - "Po=2;#total pressure in bar\n", - "P=0.3;#static pressure in bar\n", - "y=1.4;#expansion constant\n", - "print(\"we know that,Po/P=(1+(y-1)*M^2/2)^((y)/(y-1))\")\n", - "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", - "print(\"so M=\"),round(M,3)\n", - "print(\"so mach number,M=1.89\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 13.5;pg no: 527" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 13.5, Page:527 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\n", - "actual static pressure(P)=1+0.3 in bar\n", - "It is also given that,Po-P=0.6,\n", - "so Po=P+0.6 in bar\n", - "air velocity,ao=sqrt(y*R*To)in m/s\n", - "density of air,rho_o=Po/(R*To)in \n", - "considering air to be in-compressible,\n", - "Po=P+rho_o*C^2/2\n", - "so C in m/s= 235.13\n", - "for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\n", - "so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", - "compressibility correction factor,k\n", - "k=(M^2/4)+((2-y)/24)*M^4\n", - "stagnation temperature,To/T=1+((y-1)/2)*M^2\n", - "so T=To/(1+((y-1)/2)*M^2) in K\n", - "density,rho=P/(R*T) in kg/m^3\n", - "substituting Po-P=(1/2)*rho*C^2(1+k)\n", - "C in m/s= 250.94\n", - "so C=250.95 m/s\n" - ] - } - ], - "source": [ - "#cal of air stream velocity\n", - "#intiation of all variables\n", - "# Chapter 13\n", - "import math\n", - "print\"Example 13.5, Page:527 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 13 Example 5\")\n", - "To=305.;#stagnation temperature of air stream in K\n", - "y=1.4;#expansion constant\n", - "R=287.;#gas constant in J/kg K\n", - "print(\"actual static pressure(P)=1+0.3 in bar\")\n", - "P=1.+0.3\n", - "print(\"It is also given that,Po-P=0.6,\")\n", - "print(\"so Po=P+0.6 in bar\")\n", - "Po=P+0.6\n", - "print(\"air velocity,ao=sqrt(y*R*To)in m/s\")\n", - "ao=math.sqrt(y*R*To)\n", - "print(\"density of air,rho_o=Po/(R*To)in \")\n", - "rho_o=Po*10.**5/(R*To)\n", - "print(\"considering air to be in-compressible,\")\n", - "print(\"Po=P+rho_o*C^2/2\")\n", - "C=math.sqrt((Po-P)*10.**5*2./rho_o)\n", - "print(\"so C in m/s=\"),round(C,2)\n", - "print(\"for compressible fluid,Po/P=(1+(y-1)*M^2/2)^(y/(y-1))\")\n", - "print(\"so M=sqrt((exp(log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\")\n", - "M=math.sqrt((math.exp(math.log(Po/P)/(y/(y-1)))-1)/((y-1)/2))\n", - "M=0.7567;#approx.\n", - "print(\"compressibility correction factor,k\")\n", - "print(\"k=(M^2/4)+((2-y)/24)*M^4\")\n", - "k=(M**2/4.)+((2.-y)/24.)*M**4\n", - "print(\"stagnation temperature,To/T=1+((y-1)/2)*M^2\")\n", - "print(\"so T=To/(1+((y-1)/2)*M^2) in K\")\n", - "T=To/(1+((y-1)/2)*M**2)\n", - "print(\"density,rho=P/(R*T) in kg/m^3\")\n", - "rho=P*10**5/(R*T)\n", - "print(\"substituting Po-P=(1/2)*rho*C^2(1+k)\")\n", - "C=math.sqrt((Po-P)*10.**5/((1./2.)*rho*(1.+k)))\n", - "print(\"C in m/s=\"),round(C,2)\n", - "print(\"so C=250.95 m/s\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter2.ipynb deleted file mode 100755 index 6d7e9bc4..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter2.ipynb +++ /dev/null @@ -1,314 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# chapter 2:Zeroth Law of Thermodynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.1;pg no:46" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.1, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\n", - "degree celcius and farenheit are related as follows\n", - "Tc=(Tf-32)/1.8\n", - "so temperature of body in degree celcius 37.0\n" - ] - } - ], - "source": [ - "#cal of temperature of body of human\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "print\"Example 2.1, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\")\n", - "Tf=98.6;#temperature of body in farenheit\n", - "Tc=(Tf-32)/1.8\n", - "print(\"degree celcius and farenheit are related as follows\")\n", - "print(\"Tc=(Tf-32)/1.8\")\n", - "print(\"so temperature of body in degree celcius\"),round(Tc,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.2;pg no:47" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.2, Page:47 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\n", - "using thermometric relation\n", - "t=a*log(p)+(b/2)\n", - "for ice point,b/a=\n", - "so b=2.1972*a\n", - "for steam point\n", - "a= 101.95\n", - "and b= 224.01\n", - "thus, t=in degree celcius\n", - "so for thermodynamic property of 6.5,t=302.83 degree celcius= 302.84\n" - ] - } - ], - "source": [ - "#cal of celcius temperature\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "import math\n", - "print\"Example 2.2, Page:47 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\")\n", - "t1=0;#ice point temperature in degree celcius\n", - "p1=3;#thermometric property for ice point\n", - "t2=100;#steam point temperature in degree celcius\n", - "p2=8;#thermometric property for steam point\n", - "p3=6.5;#thermometric property for any temperature\n", - "print(\"using thermometric relation\")\n", - "print(\"t=a*log(p)+(b/2)\")\n", - "print(\"for ice point,b/a=\")\n", - "b=2*math.log(p1)\n", - "print(\"so b=2.1972*a\")\n", - "print(\"for steam point\")\n", - "a=t2/(math.log(p2)-(2.1972/2))\n", - "print(\"a=\"),round(a,2)\n", - "b=2.1972*a\n", - "print(\"and b=\"),round(b,2)\n", - "t=a*math.log(p3)+(b/2)\n", - "print(\"thus, t=in degree celcius\")\n", - "print(\"so for thermodynamic property of 6.5,t=302.83 degree celcius=\"),round(t,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.3;page no:47" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.3, Page:47 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\n", - "emf equation\n", - "E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\n", - "using emf equation at ice point,E_0 in volts\n", - "E_0= 0.0\n", - "using emf equation at steam point,E_100 in volts\n", - "E_100= 0.3\n", - "now emf at 30 degree celcius using emf equation(E_30)in volts\n", - "now the temperature(T) shown by this thermometer\n", - "T=in degree celcius 30.36\n", - "NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\n" - ] - } - ], - "source": [ - "#cal of temperature shown by this thermometer\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "print\"Example 2.3, Page:47 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\")\n", - "print(\"emf equation\")\n", - "print(\"E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\")\n", - "print(\"using emf equation at ice point,E_0 in volts\")\n", - "t=0.;#ice point temperature in degree celcius\n", - "E_0=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", - "print(\"E_0=\"),round(E_0,2)\n", - "print(\"using emf equation at steam point,E_100 in volts\")\n", - "t=100.;#steam point temperature in degree celcius\n", - "E_100=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", - "print(\"E_100=\"),round(E_100,2)\n", - "print(\"now emf at 30 degree celcius using emf equation(E_30)in volts\")\n", - "t=30.;#temperature of substance in degree celcius\n", - "E_30=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", - "T_100=100.;#steam point temperature in degree celcius\n", - "T_0=0.;#ice point temperature in degree celcius\n", - "T=((E_30-E_0)/(E_100-E_0))*(T_100-T_0)\n", - "print(\"now the temperature(T) shown by this thermometer\")\n", - "print(\"T=in degree celcius\"),round(T,2)\n", - "print(\"NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.4;pg no:48" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.4, Page:48 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\n", - "emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\n", - "as ice point and steam points are two reference points,so\n", - "at ice point,emf(e1)in mV\n", - "at steam point,emf(e2)in mV\n", - "at gas temperature,emf(e3)in mV\n", - "since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV 60.16\n", - "temperature of gas using thermocouple=60.16 degree celcius\n", - "percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius 20.31\n" - ] - } - ], - "source": [ - "#cal of percentage variation in temperature\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "import math\n", - "print\"Example 2.4, Page:48 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\")\n", - "t1=0;#temperature at ice point\n", - "t2=100;#temperature at steam point\n", - "t3=50;#temperature of gas\n", - "print(\"emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\")\n", - "print(\"as ice point and steam points are two reference points,so\")\n", - "print(\"at ice point,emf(e1)in mV\")\n", - "e1=0.18*t1-5.2*10**-4*t1**2\n", - "print(\"at steam point,emf(e2)in mV\")\n", - "e2=0.18*t2-5.2*10**-4*t2**2\n", - "print(\"at gas temperature,emf(e3)in mV\")\n", - "e3=0.18*t3-5.2*10**-4*t3**2\n", - "t=((t2-t1)/(e2-e1))*e3\n", - "variation=((t-t3)/t3)*100\n", - "print(\"since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV\"),round(t,2)\n", - "print(\"temperature of gas using thermocouple=60.16 degree celcius\")\n", - "print(\"percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius\"),round(variation,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.5;pg no:48" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.5, Page:48 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\n", - "let the conversion relation be X=aC+b\n", - "where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \n", - "at freezing point,temperature=0 degree celcius,0 degree X\n", - "so by equation X=aC+b\n", - "we get b=0\n", - "at boiling point,temperature=100 degree celcius,1000 degree X\n", - "conversion relation\n", - "X=10*C\n", - "absolute zero temperature in degree celcius=-273.15\n", - "absolute zero temperature in degree X= -2731.5\n" - ] - } - ], - "source": [ - "#cal of absolute zero temperature\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "print\"Example 2.5, Page:48 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\")\n", - "print(\"let the conversion relation be X=aC+b\")\n", - "print(\"where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \")\n", - "print(\"at freezing point,temperature=0 degree celcius,0 degree X\")\n", - "print(\"so by equation X=aC+b\")\n", - "X=0;#temperature in degree X\n", - "C=0;#temperature in degree celcius\n", - "print(\"we get b=0\")\n", - "b=0;\n", - "print(\"at boiling point,temperature=100 degree celcius,1000 degree X\")\n", - "X=1000;#temperature in degree X\n", - "C=100;#temperature in degree celcius\n", - "a=(X-b)/C\n", - "print(\"conversion relation\")\n", - "print(\"X=10*C\")\n", - "print(\"absolute zero temperature in degree celcius=-273.15\")\n", - "X=10*-273.15\n", - "print(\"absolute zero temperature in degree X=\"),round(X,2)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter2_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter2_1.ipynb deleted file mode 100755 index 6d7e9bc4..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter2_1.ipynb +++ /dev/null @@ -1,314 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# chapter 2:Zeroth Law of Thermodynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.1;pg no:46" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.1, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\n", - "degree celcius and farenheit are related as follows\n", - "Tc=(Tf-32)/1.8\n", - "so temperature of body in degree celcius 37.0\n" - ] - } - ], - "source": [ - "#cal of temperature of body of human\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "print\"Example 2.1, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\")\n", - "Tf=98.6;#temperature of body in farenheit\n", - "Tc=(Tf-32)/1.8\n", - "print(\"degree celcius and farenheit are related as follows\")\n", - "print(\"Tc=(Tf-32)/1.8\")\n", - "print(\"so temperature of body in degree celcius\"),round(Tc,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.2;pg no:47" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.2, Page:47 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\n", - "using thermometric relation\n", - "t=a*log(p)+(b/2)\n", - "for ice point,b/a=\n", - "so b=2.1972*a\n", - "for steam point\n", - "a= 101.95\n", - "and b= 224.01\n", - "thus, t=in degree celcius\n", - "so for thermodynamic property of 6.5,t=302.83 degree celcius= 302.84\n" - ] - } - ], - "source": [ - "#cal of celcius temperature\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "import math\n", - "print\"Example 2.2, Page:47 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\")\n", - "t1=0;#ice point temperature in degree celcius\n", - "p1=3;#thermometric property for ice point\n", - "t2=100;#steam point temperature in degree celcius\n", - "p2=8;#thermometric property for steam point\n", - "p3=6.5;#thermometric property for any temperature\n", - "print(\"using thermometric relation\")\n", - "print(\"t=a*log(p)+(b/2)\")\n", - "print(\"for ice point,b/a=\")\n", - "b=2*math.log(p1)\n", - "print(\"so b=2.1972*a\")\n", - "print(\"for steam point\")\n", - "a=t2/(math.log(p2)-(2.1972/2))\n", - "print(\"a=\"),round(a,2)\n", - "b=2.1972*a\n", - "print(\"and b=\"),round(b,2)\n", - "t=a*math.log(p3)+(b/2)\n", - "print(\"thus, t=in degree celcius\")\n", - "print(\"so for thermodynamic property of 6.5,t=302.83 degree celcius=\"),round(t,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.3;page no:47" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.3, Page:47 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\n", - "emf equation\n", - "E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\n", - "using emf equation at ice point,E_0 in volts\n", - "E_0= 0.0\n", - "using emf equation at steam point,E_100 in volts\n", - "E_100= 0.3\n", - "now emf at 30 degree celcius using emf equation(E_30)in volts\n", - "now the temperature(T) shown by this thermometer\n", - "T=in degree celcius 30.36\n", - "NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\n" - ] - } - ], - "source": [ - "#cal of temperature shown by this thermometer\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "print\"Example 2.3, Page:47 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\")\n", - "print(\"emf equation\")\n", - "print(\"E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\")\n", - "print(\"using emf equation at ice point,E_0 in volts\")\n", - "t=0.;#ice point temperature in degree celcius\n", - "E_0=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", - "print(\"E_0=\"),round(E_0,2)\n", - "print(\"using emf equation at steam point,E_100 in volts\")\n", - "t=100.;#steam point temperature in degree celcius\n", - "E_100=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", - "print(\"E_100=\"),round(E_100,2)\n", - "print(\"now emf at 30 degree celcius using emf equation(E_30)in volts\")\n", - "t=30.;#temperature of substance in degree celcius\n", - "E_30=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", - "T_100=100.;#steam point temperature in degree celcius\n", - "T_0=0.;#ice point temperature in degree celcius\n", - "T=((E_30-E_0)/(E_100-E_0))*(T_100-T_0)\n", - "print(\"now the temperature(T) shown by this thermometer\")\n", - "print(\"T=in degree celcius\"),round(T,2)\n", - "print(\"NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.4;pg no:48" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.4, Page:48 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\n", - "emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\n", - "as ice point and steam points are two reference points,so\n", - "at ice point,emf(e1)in mV\n", - "at steam point,emf(e2)in mV\n", - "at gas temperature,emf(e3)in mV\n", - "since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV 60.16\n", - "temperature of gas using thermocouple=60.16 degree celcius\n", - "percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius 20.31\n" - ] - } - ], - "source": [ - "#cal of percentage variation in temperature\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "import math\n", - "print\"Example 2.4, Page:48 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\")\n", - "t1=0;#temperature at ice point\n", - "t2=100;#temperature at steam point\n", - "t3=50;#temperature of gas\n", - "print(\"emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\")\n", - "print(\"as ice point and steam points are two reference points,so\")\n", - "print(\"at ice point,emf(e1)in mV\")\n", - "e1=0.18*t1-5.2*10**-4*t1**2\n", - "print(\"at steam point,emf(e2)in mV\")\n", - "e2=0.18*t2-5.2*10**-4*t2**2\n", - "print(\"at gas temperature,emf(e3)in mV\")\n", - "e3=0.18*t3-5.2*10**-4*t3**2\n", - "t=((t2-t1)/(e2-e1))*e3\n", - "variation=((t-t3)/t3)*100\n", - "print(\"since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV\"),round(t,2)\n", - "print(\"temperature of gas using thermocouple=60.16 degree celcius\")\n", - "print(\"percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius\"),round(variation,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.5;pg no:48" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.5, Page:48 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\n", - "let the conversion relation be X=aC+b\n", - "where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \n", - "at freezing point,temperature=0 degree celcius,0 degree X\n", - "so by equation X=aC+b\n", - "we get b=0\n", - "at boiling point,temperature=100 degree celcius,1000 degree X\n", - "conversion relation\n", - "X=10*C\n", - "absolute zero temperature in degree celcius=-273.15\n", - "absolute zero temperature in degree X= -2731.5\n" - ] - } - ], - "source": [ - "#cal of absolute zero temperature\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "print\"Example 2.5, Page:48 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\")\n", - "print(\"let the conversion relation be X=aC+b\")\n", - "print(\"where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \")\n", - "print(\"at freezing point,temperature=0 degree celcius,0 degree X\")\n", - "print(\"so by equation X=aC+b\")\n", - "X=0;#temperature in degree X\n", - "C=0;#temperature in degree celcius\n", - "print(\"we get b=0\")\n", - "b=0;\n", - "print(\"at boiling point,temperature=100 degree celcius,1000 degree X\")\n", - "X=1000;#temperature in degree X\n", - "C=100;#temperature in degree celcius\n", - "a=(X-b)/C\n", - "print(\"conversion relation\")\n", - "print(\"X=10*C\")\n", - "print(\"absolute zero temperature in degree celcius=-273.15\")\n", - "X=10*-273.15\n", - "print(\"absolute zero temperature in degree X=\"),round(X,2)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter2_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter2_2.ipynb deleted file mode 100755 index 6d7e9bc4..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter2_2.ipynb +++ /dev/null @@ -1,314 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# chapter 2:Zeroth Law of Thermodynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.1;pg no:46" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.1, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\n", - "degree celcius and farenheit are related as follows\n", - "Tc=(Tf-32)/1.8\n", - "so temperature of body in degree celcius 37.0\n" - ] - } - ], - "source": [ - "#cal of temperature of body of human\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "print\"Example 2.1, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\")\n", - "Tf=98.6;#temperature of body in farenheit\n", - "Tc=(Tf-32)/1.8\n", - "print(\"degree celcius and farenheit are related as follows\")\n", - "print(\"Tc=(Tf-32)/1.8\")\n", - "print(\"so temperature of body in degree celcius\"),round(Tc,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.2;pg no:47" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.2, Page:47 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\n", - "using thermometric relation\n", - "t=a*log(p)+(b/2)\n", - "for ice point,b/a=\n", - "so b=2.1972*a\n", - "for steam point\n", - "a= 101.95\n", - "and b= 224.01\n", - "thus, t=in degree celcius\n", - "so for thermodynamic property of 6.5,t=302.83 degree celcius= 302.84\n" - ] - } - ], - "source": [ - "#cal of celcius temperature\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "import math\n", - "print\"Example 2.2, Page:47 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\")\n", - "t1=0;#ice point temperature in degree celcius\n", - "p1=3;#thermometric property for ice point\n", - "t2=100;#steam point temperature in degree celcius\n", - "p2=8;#thermometric property for steam point\n", - "p3=6.5;#thermometric property for any temperature\n", - "print(\"using thermometric relation\")\n", - "print(\"t=a*log(p)+(b/2)\")\n", - "print(\"for ice point,b/a=\")\n", - "b=2*math.log(p1)\n", - "print(\"so b=2.1972*a\")\n", - "print(\"for steam point\")\n", - "a=t2/(math.log(p2)-(2.1972/2))\n", - "print(\"a=\"),round(a,2)\n", - "b=2.1972*a\n", - "print(\"and b=\"),round(b,2)\n", - "t=a*math.log(p3)+(b/2)\n", - "print(\"thus, t=in degree celcius\")\n", - "print(\"so for thermodynamic property of 6.5,t=302.83 degree celcius=\"),round(t,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.3;page no:47" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.3, Page:47 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\n", - "emf equation\n", - "E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\n", - "using emf equation at ice point,E_0 in volts\n", - "E_0= 0.0\n", - "using emf equation at steam point,E_100 in volts\n", - "E_100= 0.3\n", - "now emf at 30 degree celcius using emf equation(E_30)in volts\n", - "now the temperature(T) shown by this thermometer\n", - "T=in degree celcius 30.36\n", - "NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\n" - ] - } - ], - "source": [ - "#cal of temperature shown by this thermometer\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "print\"Example 2.3, Page:47 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\")\n", - "print(\"emf equation\")\n", - "print(\"E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\")\n", - "print(\"using emf equation at ice point,E_0 in volts\")\n", - "t=0.;#ice point temperature in degree celcius\n", - "E_0=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", - "print(\"E_0=\"),round(E_0,2)\n", - "print(\"using emf equation at steam point,E_100 in volts\")\n", - "t=100.;#steam point temperature in degree celcius\n", - "E_100=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", - "print(\"E_100=\"),round(E_100,2)\n", - "print(\"now emf at 30 degree celcius using emf equation(E_30)in volts\")\n", - "t=30.;#temperature of substance in degree celcius\n", - "E_30=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", - "T_100=100.;#steam point temperature in degree celcius\n", - "T_0=0.;#ice point temperature in degree celcius\n", - "T=((E_30-E_0)/(E_100-E_0))*(T_100-T_0)\n", - "print(\"now the temperature(T) shown by this thermometer\")\n", - "print(\"T=in degree celcius\"),round(T,2)\n", - "print(\"NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.4;pg no:48" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.4, Page:48 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\n", - "emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\n", - "as ice point and steam points are two reference points,so\n", - "at ice point,emf(e1)in mV\n", - "at steam point,emf(e2)in mV\n", - "at gas temperature,emf(e3)in mV\n", - "since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV 60.16\n", - "temperature of gas using thermocouple=60.16 degree celcius\n", - "percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius 20.31\n" - ] - } - ], - "source": [ - "#cal of percentage variation in temperature\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "import math\n", - "print\"Example 2.4, Page:48 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\")\n", - "t1=0;#temperature at ice point\n", - "t2=100;#temperature at steam point\n", - "t3=50;#temperature of gas\n", - "print(\"emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\")\n", - "print(\"as ice point and steam points are two reference points,so\")\n", - "print(\"at ice point,emf(e1)in mV\")\n", - "e1=0.18*t1-5.2*10**-4*t1**2\n", - "print(\"at steam point,emf(e2)in mV\")\n", - "e2=0.18*t2-5.2*10**-4*t2**2\n", - "print(\"at gas temperature,emf(e3)in mV\")\n", - "e3=0.18*t3-5.2*10**-4*t3**2\n", - "t=((t2-t1)/(e2-e1))*e3\n", - "variation=((t-t3)/t3)*100\n", - "print(\"since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV\"),round(t,2)\n", - "print(\"temperature of gas using thermocouple=60.16 degree celcius\")\n", - "print(\"percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius\"),round(variation,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.5;pg no:48" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.5, Page:48 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\n", - "let the conversion relation be X=aC+b\n", - "where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \n", - "at freezing point,temperature=0 degree celcius,0 degree X\n", - "so by equation X=aC+b\n", - "we get b=0\n", - "at boiling point,temperature=100 degree celcius,1000 degree X\n", - "conversion relation\n", - "X=10*C\n", - "absolute zero temperature in degree celcius=-273.15\n", - "absolute zero temperature in degree X= -2731.5\n" - ] - } - ], - "source": [ - "#cal of absolute zero temperature\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "print\"Example 2.5, Page:48 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\")\n", - "print(\"let the conversion relation be X=aC+b\")\n", - "print(\"where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \")\n", - "print(\"at freezing point,temperature=0 degree celcius,0 degree X\")\n", - "print(\"so by equation X=aC+b\")\n", - "X=0;#temperature in degree X\n", - "C=0;#temperature in degree celcius\n", - "print(\"we get b=0\")\n", - "b=0;\n", - "print(\"at boiling point,temperature=100 degree celcius,1000 degree X\")\n", - "X=1000;#temperature in degree X\n", - "C=100;#temperature in degree celcius\n", - "a=(X-b)/C\n", - "print(\"conversion relation\")\n", - "print(\"X=10*C\")\n", - "print(\"absolute zero temperature in degree celcius=-273.15\")\n", - "X=10*-273.15\n", - "print(\"absolute zero temperature in degree X=\"),round(X,2)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter2_3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter2_3.ipynb deleted file mode 100755 index 6d7e9bc4..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter2_3.ipynb +++ /dev/null @@ -1,314 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# chapter 2:Zeroth Law of Thermodynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.1;pg no:46" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.1, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\n", - "degree celcius and farenheit are related as follows\n", - "Tc=(Tf-32)/1.8\n", - "so temperature of body in degree celcius 37.0\n" - ] - } - ], - "source": [ - "#cal of temperature of body of human\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "print\"Example 2.1, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1\")\n", - "Tf=98.6;#temperature of body in farenheit\n", - "Tc=(Tf-32)/1.8\n", - "print(\"degree celcius and farenheit are related as follows\")\n", - "print(\"Tc=(Tf-32)/1.8\")\n", - "print(\"so temperature of body in degree celcius\"),round(Tc,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.2;pg no:47" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.2, Page:47 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\n", - "using thermometric relation\n", - "t=a*log(p)+(b/2)\n", - "for ice point,b/a=\n", - "so b=2.1972*a\n", - "for steam point\n", - "a= 101.95\n", - "and b= 224.01\n", - "thus, t=in degree celcius\n", - "so for thermodynamic property of 6.5,t=302.83 degree celcius= 302.84\n" - ] - } - ], - "source": [ - "#cal of celcius temperature\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "import math\n", - "print\"Example 2.2, Page:47 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2\")\n", - "t1=0;#ice point temperature in degree celcius\n", - "p1=3;#thermometric property for ice point\n", - "t2=100;#steam point temperature in degree celcius\n", - "p2=8;#thermometric property for steam point\n", - "p3=6.5;#thermometric property for any temperature\n", - "print(\"using thermometric relation\")\n", - "print(\"t=a*log(p)+(b/2)\")\n", - "print(\"for ice point,b/a=\")\n", - "b=2*math.log(p1)\n", - "print(\"so b=2.1972*a\")\n", - "print(\"for steam point\")\n", - "a=t2/(math.log(p2)-(2.1972/2))\n", - "print(\"a=\"),round(a,2)\n", - "b=2.1972*a\n", - "print(\"and b=\"),round(b,2)\n", - "t=a*math.log(p3)+(b/2)\n", - "print(\"thus, t=in degree celcius\")\n", - "print(\"so for thermodynamic property of 6.5,t=302.83 degree celcius=\"),round(t,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.3;page no:47" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.3, Page:47 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\n", - "emf equation\n", - "E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\n", - "using emf equation at ice point,E_0 in volts\n", - "E_0= 0.0\n", - "using emf equation at steam point,E_100 in volts\n", - "E_100= 0.3\n", - "now emf at 30 degree celcius using emf equation(E_30)in volts\n", - "now the temperature(T) shown by this thermometer\n", - "T=in degree celcius 30.36\n", - "NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\n" - ] - } - ], - "source": [ - "#cal of temperature shown by this thermometer\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "print\"Example 2.3, Page:47 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3\")\n", - "print(\"emf equation\")\n", - "print(\"E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)\")\n", - "print(\"using emf equation at ice point,E_0 in volts\")\n", - "t=0.;#ice point temperature in degree celcius\n", - "E_0=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", - "print(\"E_0=\"),round(E_0,2)\n", - "print(\"using emf equation at steam point,E_100 in volts\")\n", - "t=100.;#steam point temperature in degree celcius\n", - "E_100=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", - "print(\"E_100=\"),round(E_100,2)\n", - "print(\"now emf at 30 degree celcius using emf equation(E_30)in volts\")\n", - "t=30.;#temperature of substance in degree celcius\n", - "E_30=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)\n", - "T_100=100.;#steam point temperature in degree celcius\n", - "T_0=0.;#ice point temperature in degree celcius\n", - "T=((E_30-E_0)/(E_100-E_0))*(T_100-T_0)\n", - "print(\"now the temperature(T) shown by this thermometer\")\n", - "print(\"T=in degree celcius\"),round(T,2)\n", - "print(\"NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.4;pg no:48" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.4, Page:48 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\n", - "emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\n", - "as ice point and steam points are two reference points,so\n", - "at ice point,emf(e1)in mV\n", - "at steam point,emf(e2)in mV\n", - "at gas temperature,emf(e3)in mV\n", - "since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV 60.16\n", - "temperature of gas using thermocouple=60.16 degree celcius\n", - "percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius 20.31\n" - ] - } - ], - "source": [ - "#cal of percentage variation in temperature\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "import math\n", - "print\"Example 2.4, Page:48 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4\")\n", - "t1=0;#temperature at ice point\n", - "t2=100;#temperature at steam point\n", - "t3=50;#temperature of gas\n", - "print(\"emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts\")\n", - "print(\"as ice point and steam points are two reference points,so\")\n", - "print(\"at ice point,emf(e1)in mV\")\n", - "e1=0.18*t1-5.2*10**-4*t1**2\n", - "print(\"at steam point,emf(e2)in mV\")\n", - "e2=0.18*t2-5.2*10**-4*t2**2\n", - "print(\"at gas temperature,emf(e3)in mV\")\n", - "e3=0.18*t3-5.2*10**-4*t3**2\n", - "t=((t2-t1)/(e2-e1))*e3\n", - "variation=((t-t3)/t3)*100\n", - "print(\"since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV\"),round(t,2)\n", - "print(\"temperature of gas using thermocouple=60.16 degree celcius\")\n", - "print(\"percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius\"),round(variation,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 2.5;pg no:48" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 2.5, Page:48 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\n", - "let the conversion relation be X=aC+b\n", - "where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \n", - "at freezing point,temperature=0 degree celcius,0 degree X\n", - "so by equation X=aC+b\n", - "we get b=0\n", - "at boiling point,temperature=100 degree celcius,1000 degree X\n", - "conversion relation\n", - "X=10*C\n", - "absolute zero temperature in degree celcius=-273.15\n", - "absolute zero temperature in degree X= -2731.5\n" - ] - } - ], - "source": [ - "#cal of absolute zero temperature\n", - "#intiation of all variables\n", - "# Chapter 2\n", - "print\"Example 2.5, Page:48 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5\")\n", - "print(\"let the conversion relation be X=aC+b\")\n", - "print(\"where C is temperature in degree celcius,a&b are constants and X is temperature in X degree \")\n", - "print(\"at freezing point,temperature=0 degree celcius,0 degree X\")\n", - "print(\"so by equation X=aC+b\")\n", - "X=0;#temperature in degree X\n", - "C=0;#temperature in degree celcius\n", - "print(\"we get b=0\")\n", - "b=0;\n", - "print(\"at boiling point,temperature=100 degree celcius,1000 degree X\")\n", - "X=1000;#temperature in degree X\n", - "C=100;#temperature in degree celcius\n", - "a=(X-b)/C\n", - "print(\"conversion relation\")\n", - "print(\"X=10*C\")\n", - "print(\"absolute zero temperature in degree celcius=-273.15\")\n", - "X=10*-273.15\n", - "print(\"absolute zero temperature in degree X=\"),round(X,2)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter3.ipynb deleted file mode 100755 index 22ed40c9..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter3.ipynb +++ /dev/null @@ -1,1506 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 3:First Law of Thermo Dynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.1;pg no:76" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.1, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\n", - "a> work done on piston(W_piston)in KJ can be obtained as\n", - "W_piston=pdv\n", - "b> paddle work done on the system(W_paddle)=-4.88 KJ\n", - "net work done of system(W_net)in KJ\n", - "W_net=W_piston+W_paddle\n", - "so work done on system(W_net)=1.435 KJ\n" - ] - } - ], - "source": [ - "#cal of work done on system\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.1, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\")\n", - "import scipy\n", - "from scipy import integrate\n", - "\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "p=689.;#pressure of gas in cylinder in kpa\n", - "v1=0.04;#initial volume of fluid in m^3\n", - "v2=0.045;#final volume of fluid in m^3\n", - "W_paddle=-4.88;#paddle work done on the system in KJ\n", - "print(\"a> work done on piston(W_piston)in KJ can be obtained as\")\n", - "print(\"W_piston=pdv\")\n", - "#function y = f(v), y=p, endfunction\n", - "def fun1(x):\n", - "\ty=p\n", - "\treturn y\n", - "\n", - "W_piston=scipy.integrate.quad(fun1,v1,v2) \n", - "print(\"b> paddle work done on the system(W_paddle)=-4.88 KJ\")\n", - "print(\"net work done of system(W_net)in KJ\")\n", - "print(\"W_net=W_piston+W_paddle\")\n", - "print(\"so work done on system(W_net)=1.435 KJ\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.2;pg no:" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.2, Page:76 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\n", - "as the vessel is rigid therefore work done shall be zero\n", - "W=0\n", - "from first law of thermodynamics,heat required(Q)in KJ\n", - "Q=U2-U1+W=Q=m(u2-u1)+W\n", - "so heat required = 5.6\n" - ] - } - ], - "source": [ - "#cal of heat required\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.2, Page:76 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\")\n", - "m=0.5;#mass of gas in kg\n", - "u1=26.6;#internal energy of gas at 200 degree celcius\n", - "u2=37.8;#internal energy of gas at 400 degree celcius\n", - "W=0;#work done by vessel in KJ\n", - "print(\"as the vessel is rigid therefore work done shall be zero\")\n", - "print(\"W=0\")\n", - "print(\"from first law of thermodynamics,heat required(Q)in KJ\")\n", - "print(\"Q=U2-U1+W=Q=m(u2-u1)+W\")\n", - "Q=m*(u2-u1)+W\n", - "print(\"so heat required =\"),round(Q,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.3;pg no:77" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.3, Page:77 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\n", - "by steady flow energy equation\n", - "q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\n", - "let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\n", - "q=h2-h1\n", - "rate of heat removal(Q)in KJ/hr\n", - "Q=m(h2-h1)=m*Cp*(T2-T1)\n", - "heat should be removed at the rate=KJ/hr 40500.0\n" - ] - } - ], - "source": [ - "#cal of \"heat should be removed\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.3, Page:77 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\")\n", - "m=50;#rate at which carbon dioxide passing through heat exchanger in kg/hr\n", - "T2=800;#initial temperature of carbon dioxide in degree celcius\n", - "T1=50;#final temperature of carbon dioxide in degree celcius\n", - "Cp=1.08;#specific heat at constant pressure in KJ/kg K\n", - "print(\"by steady flow energy equation\")\n", - "print(\"q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\")\n", - "print(\"let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\")\n", - "print(\"q=h2-h1\")\n", - "print(\"rate of heat removal(Q)in KJ/hr\")\n", - "print(\"Q=m(h2-h1)=m*Cp*(T2-T1)\")\n", - "Q=m*Cp*(T2-T1)\n", - "print(\"heat should be removed at the rate=KJ/hr\"),round(Q)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.4;pg no:77" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "#cal of work done by surrounding on system\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.4, Page:77 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 4\")\n", - "v=0.78;#volume of cylinder in m^3\n", - "p=101.325;#atmospheric pressure in kPa\n", - "print(\"total work done by the air at atmospheric pressure of 101.325 kPa\")\n", - "print(\"W=(pdv)cylinder+(pdv)air\")\n", - "print(\"0+p*(delta v)\")\n", - "print(\"work done by air(W)=-p*v in KJ\")\n", - "W=-p*v\n", - "print(\"so work done by surrounding on system=KJ\"),round(-W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.5:pg no:77" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.5, Page:77 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\n", - "given p*v^1.3=constant\n", - "assuming expansion to be quasi-static,the work may be given as\n", - "W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\n", - "from internal energy relation,change in specific internal energy\n", - "deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\n", - "total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\n", - "using p1*V1^1.3=p2*V2^1.3\n", - "V2=in m^3 0.85\n", - "take V2=.852 m^3\n", - "so deltaU in KJ\n", - "and W in KJ 246.67\n", - "from first law\n", - "deltaQ=KJ 113.47\n", - "heat interaction=113.5 KJ\n", - "work interaction=246.7 KJ\n", - "change in internal energy=-113.2 KJ\n" - ] - } - ], - "source": [ - "#cal of heat,work interaction and change in internal energy\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.5, Page:77 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\")\n", - "m=5;#mass of gas in kg\n", - "p1=1*10**3;#initial pressure of gas in KPa\n", - "V1=0.5;#initial volume of gas in m^3\n", - "p2=0.5*10**3;#final pressure of gas in KPa\n", - "n=1.3;#expansion constant\n", - "print(\"given p*v^1.3=constant\")\n", - "print(\"assuming expansion to be quasi-static,the work may be given as\")\n", - "print(\"W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\")\n", - "print(\"from internal energy relation,change in specific internal energy\")\n", - "print(\"deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\")\n", - "print(\"total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\")\n", - "print(\"using p1*V1^1.3=p2*V2^1.3\")\n", - "V2=V1*(p1/p2)**(1/1.3)\n", - "print(\"V2=in m^3\"),round(V2,2)\n", - "print(\"take V2=.852 m^3\")\n", - "V2=0.852;#final volume of gas in m^3\n", - "print(\"so deltaU in KJ\")\n", - "deltaU=1.8*(p2*V2-p1*V1)\n", - "W=(p2*V2-p1*V1)/(1-n)\n", - "print(\"and W in KJ\"),round(W,2)\n", - "print(\"from first law\")\n", - "deltaQ=deltaU+W\n", - "print(\"deltaQ=KJ\"),round(deltaQ,2)\n", - "print(\"heat interaction=113.5 KJ\")\n", - "print(\"work interaction=246.7 KJ\")\n", - "print(\"change in internal energy=-113.2 KJ\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.6;pg no:78" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.6, Page:78 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\n", - "final state volume(v2)in m^3\n", - "v2= 0.0\n", - "take v2=0.03 m^3\n", - "now internal energy of gas is given by U=7.5*p*v-425\n", - "change in internal energy(deltaU)in KJ\n", - "deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\n", - "deltaU=7.5*10^3*(p2*v2-p1*v1) 75.0\n", - "for quasi-static process\n", - "work(W) in KJ,W=p*dv\n", - "W=(p2*v2-p1*v1)/(1-n)\n", - "from first law of thermodynamics,\n", - "heat interaction(deltaQ)=deltaU+W\n", - "heat=50 KJ\n", - "work=25 KJ(-ve)\n", - "internal energy change=75 KJ\n", - "if 180 KJ heat transfer takes place,then from 1st law,\n", - "deltaQ= 50.0\n", - "since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\n", - "W=KJ 105.0\n" - ] - } - ], - "source": [ - "#cal of heat,workinternal energy change\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.6, Page:78 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\")\n", - "p1=1;#initial pressure of gas in MPa\n", - "v1=0.05;#initial volume of gas in m^3\n", - "p2=2;#final pressure of gas in MPa\n", - "n=1.4;#expansion constant\n", - "print(\"final state volume(v2)in m^3\")\n", - "v2=((p1/p2)**(1/1.4))*v1\n", - "print(\"v2=\"),round(v2,2)\n", - "print(\"take v2=0.03 m^3\")\n", - "v2=0.03;#final volume of gas in m^3\n", - "print(\"now internal energy of gas is given by U=7.5*p*v-425\")\n", - "print(\"change in internal energy(deltaU)in KJ\")\n", - "print(\"deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\")\n", - "deltaU=7.5*10**3*(p2*v2-p1*v1)\n", - "print(\"deltaU=7.5*10^3*(p2*v2-p1*v1)\"),round(deltaU,2)\n", - "print(\"for quasi-static process\")\n", - "print(\"work(W) in KJ,W=p*dv\")\n", - "W=((p2*v2-p1*v1)/(1-n))*10**3\n", - "print(\"W=(p2*v2-p1*v1)/(1-n)\")\n", - "print(\"from first law of thermodynamics,\")\n", - "print(\"heat interaction(deltaQ)=deltaU+W\")\n", - "deltaQ=deltaU+W\n", - "print(\"heat=50 KJ\")\n", - "print(\"work=25 KJ(-ve)\")\n", - "print(\"internal energy change=75 KJ\")\n", - "print(\"if 180 KJ heat transfer takes place,then from 1st law,\")\n", - "print(\"deltaQ=\"),round(deltaQ,2)\n", - "print(\"since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\")\n", - "W=180-75\n", - "print(\"W=KJ\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.7;pg no:79" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.7, Page:79 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\n", - "characteristics gas constant(R)in J/kg K\n", - "R= 519.64\n", - "take R=0.520,KJ/kg K\n", - "Cv=inKJ/kg K 1.18\n", - "y= 1.44\n", - "for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\n", - "now,T2=in K\n", - "work(W)in KJ/kg\n", - "W= -257.78\n", - "for polytropic process,heat(Q)in KJ/K\n", - "Q= 82.02\n" - ] - } - ], - "source": [ - "#cal of work and heat\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.7, Page:79 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\")\n", - "M=16;#molecular weight of gas\n", - "p1=101.3;#initial pressure of gas in KPa\n", - "p2=600;#final pressure of gas in KPa\n", - "T1=(273+20);#initial temperature of gas in K\n", - "R1=8.3143*10**3;#universal gas constant in J/kg K\n", - "Cp=1.7;#specific heat at constant pressure in KJ/kg K\n", - "n=1.3;#expansion constant\n", - "T2=((p2/p1)**(n-1/n))\n", - "print(\"characteristics gas constant(R)in J/kg K\")\n", - "R=R1/M\n", - "print(\"R=\"),round(R,2)\n", - "print(\"take R=0.520,KJ/kg K\")\n", - "R=0.520;#characteristics gas constant in KJ/kg K\n", - "Cv=Cp-R\n", - "print(\"Cv=inKJ/kg K\"),round(Cv,2)\n", - "y=Cp/Cv\n", - "print(\"y=\"),round(y,2)\n", - "y=1.44;#ratio of specific heat at constant pressure to constant volume\n", - "print(\"for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\")\n", - "T2=T1*((p2/p1)**((n-1)/n))\n", - "print(\"now,T2=in K\")\n", - "print(\"work(W)in KJ/kg\")\n", - "W=R*((T1-T2)/(n-1))\n", - "print(\"W=\"),round(W,2)\n", - "W=257.78034;#work done in KJ/kg\n", - "print(\"for polytropic process,heat(Q)in KJ/K\")\n", - "Q=((y-n)/(y-1))*W\n", - "print(\"Q=\"),round(Q,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.8;pg no:80" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.8, Page:80 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\n", - "applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\n", - "h1+C1^2/2=h2+C2^2/2\n", - "given that C1=0,negligible inlet velocity\n", - "so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\n", - "exit velocity(C2)in m/s 1098.2\n" - ] - } - ], - "source": [ - "#cal of exit velocity\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.8, Page:80 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\")\n", - "T1=(627+273);#initial temperature of air in nozzle in K\n", - "T2=(27+273);#temperature at which air leaves nozzle in K\n", - "Cp=1.005*10**3;#specific heat at constant pressure in J/kg K\n", - "C2=math.sqrt(2*Cp*(T1-T2))\n", - "print(\"applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\")\n", - "print(\"h1+C1^2/2=h2+C2^2/2\")\n", - "print(\"given that C1=0,negligible inlet velocity\")\n", - "print(\"so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\")\n", - "print(\"exit velocity(C2)in m/s\"),round(C2,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.9;pg no:80" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.9, Page:80 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\n", - "work interaction,W=-200 KJ/kg of air\n", - "increase in enthalpy of air=100 KJ/kg of air\n", - "total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\n", - "writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\n", - "h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\n", - "assuming no change in potential energy and kinetic energy\n", - "deltaK.E=deltaP.=0\n", - "total heat interaction(Q)in KJ/kg of air\n", - "Q= -100.0\n", - "Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\n", - "so heat transferred to atmosphere(Q2)in KJ/kg of air -10.0\n" - ] - } - ], - "source": [ - "#cal of heat transferred to atmosphere\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.9, Page:80 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\")\n", - "W=-200;#shaft work in KJ/kg of air\n", - "deltah=100;#increase in enthalpy in KJ/kg of air\n", - "Q1=-90;#heat transferred to water in KJ/kg of air\n", - "print(\"work interaction,W=-200 KJ/kg of air\")\n", - "print(\"increase in enthalpy of air=100 KJ/kg of air\")\n", - "print(\"total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\")\n", - "print(\"writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\")\n", - "print(\"h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\")\n", - "print(\"assuming no change in potential energy and kinetic energy\")\n", - "print(\"deltaK.E=deltaP.=0\")\n", - "print(\"total heat interaction(Q)in KJ/kg of air\")\n", - "Q=deltah+W\n", - "print(\"Q=\"),round(Q,2)\n", - "Q2=Q-Q1\n", - "print(\"Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\")\n", - "print(\"so heat transferred to atmosphere(Q2)in KJ/kg of air\"),round(Q2,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.10;pg no:81" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.10, Page:81 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\n", - "above problem can be solved using steady flow energy equations upon hot water flow\n", - "Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\n", - "here total heat to be supplied(Q)in kcal/hr\n", - "so heat lost by water(-ve),Q=-25000 kcal/hr\n", - "there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\n", - "Q+m*(h1+g*z1)=m*(h2+g*z2)\n", - "so water circulation rate(m)in kg/hr\n", - "so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\n", - "water circulation rate=(m)in kg/min 11.91\n" - ] - } - ], - "source": [ - "#cal of water circulation rate\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.10, Page:81 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\")\n", - "n=500;#total number of persons\n", - "q=50;#heat requirement per person in kcal/hr\n", - "h1=80;#enthalpy of hot water enter in pipe in kcal/kg\n", - "h2=45;#enthalpy of hot water leaves the pipe in kcal/kg\n", - "g=9.81;#acceleartion due to gravity in m/s^2\n", - "deltaz=10;#difference in elevation of inlet and exit pipe in m\n", - "print(\"above problem can be solved using steady flow energy equations upon hot water flow\")\n", - "print(\"Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\")\n", - "print(\"here total heat to be supplied(Q)in kcal/hr\")\n", - "Q=n*q\n", - "print(\"so heat lost by water(-ve),Q=-25000 kcal/hr\")\n", - "Q=-25000#heat loss by water in kcal/hr\n", - "print(\"there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\")\n", - "print(\"Q+m*(h1+g*z1)=m*(h2+g*z2)\")\n", - "print(\"so water circulation rate(m)in kg/hr\")\n", - "print(\"so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\")\n", - "m=Q*10**3*4.18/(g*deltaz-(h1-h2)*10**3*4.18)\n", - "m=m/60\n", - "print(\"water circulation rate=(m)in kg/min\"),round(m,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.11;pg no:81" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.11, Page:81 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\n", - "let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\n", - "energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\n", - "m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\n", - "so steam suppling rate(m)in kg/s per kg of water\n", - "m= 0.124\n", - "NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\n" - ] - } - ], - "source": [ - "#cal of steam suppling rate\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.11, Page:81 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\")\n", - "v1=50;#velocity of steam entering injector in m/s\n", - "v2=25;#velocity of mixture leave injector in m/s\n", - "h1=720;#enthalpy of steam entering injector in kcal/kg\n", - "h2=24.6;#enthalpy of water entering injector in kcal/kg\n", - "h3=100;#enthalpy of steam leaving injector in kcal/kg\n", - "h4=100;#enthalpy of water leaving injector in kcal/kg\n", - "deltaz=2;#depth from axis of injector in m\n", - "q=12;#heat loss from injector to surrounding through injector\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\")\n", - "print(\"energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\")\n", - "print(\"m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\")\n", - "print(\"so steam suppling rate(m)in kg/s per kg of water\")\n", - "m=((h3*10**3*4.18+v2**2/2)-(h2*10**3*4.18+g*deltaz))/((v1**2/2+h1*10**3*4.18)-(h3*10**3*4.18+v2**2/2)-(q*10**3*4.18))\n", - "print(\"m=\"),round(m,3)\n", - "print(\"NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.12;pg no:82" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.12, Page:82 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\n", - "here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\n", - "displacement work, W=(p.dv)cylinder+(p.dv)ballon\n", - "(p.dv)cylinder=0,as cylinder is rigid\n", - "so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\n", - "and work done by atmosphere=KJ 40.52\n" - ] - } - ], - "source": [ - "#cal of work done by atmosphere\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.12, Page:82 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\")\n", - "p=1.013*10**5;#atmospheric pressure in pa\n", - "deltav=0.4;#change in volume in m^3\n", - "print(\"here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\")\n", - "print(\"displacement work, W=(p.dv)cylinder+(p.dv)ballon\")\n", - "print(\"(p.dv)cylinder=0,as cylinder is rigid\")\n", - "print(\"so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\")\n", - "W=(p*deltav)/1000\n", - "print(\"and work done by atmosphere=KJ\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.13;pg no:82" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.13, Page:82 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\n", - "work done by turbine(Wt)in J#s is 25% of heat added i.e Wt= 1250.0\n", - "heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\n", - "Qrejected= 3750.0\n", - "and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\n", - "Wp=(-) 10.0\n", - "capacity of generator(W)=in Kw 1.24\n" - ] - } - ], - "source": [ - "#cal of capacity of generator\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.13, Page:82 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\")\n", - "Qadd=5000;#heat supplied in boiler in J#s\n", - "Wt=.25*Qadd\n", - "print(\"work done by turbine(Wt)in J#s is 25% of heat added i.e\"),\n", - "print(\"Wt=\"),round(Wt,2)\n", - "print(\"heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\")\n", - "Qrejected=.75*Qadd\n", - "print(\"Qrejected=\"),round(Qrejected,2)\n", - "print(\"and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\")\n", - "Wp=0.002*Qadd\n", - "print(\"Wp=(-)\"),round(Wp,2)\n", - "W=(Wt-Wp)/1000\n", - "print(\"capacity of generator(W)=in Kw\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.14;pg no:83" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.14, Page:83 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\n", - "in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\n", - "h1+Q1_2=h2\n", - "Q1_2=h2-h1\n", - "so heat transfer to air in heat exchanger(Q1_2)in KJ\n", - "Q1_2= 726.61\n", - "in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\n", - "h2+C2^2#2=h3+C3^2/2+Wt\n", - "Wt=(h2-h3)+(C2^2-C3^2)/2\n", - "so power output from turbine(Wt)in KJ#s\n", - "Wt= 1.0\n", - "applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\n", - "h3+C=h4+C4^2/2\n", - "C4^2#2=(h3-h4)+C3^2/2\n", - "velocity at exit of nozzle(C4)in m#s\n", - "C4= 14.3\n" - ] - } - ], - "source": [ - "#cal of velocity at exit of nozzle\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.14, Page:83 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\")\n", - "T1=(27+273);##ambient temperature in K\n", - "T2=(750+273);##temperature of heated air inside heat exchanger in K\n", - "T3=(600+273);##temperature of hot air leaves turbine in K\n", - "T4=(500+273);##temperature at which air leaves nozzle in K\n", - "Cp=1.005;##specific heat at constant pressure in KJ#kg K\n", - "C2=50;##velocity of hot air enter into gas turbine in m#s\n", - "C3=60;##velocity of air leaving turbine enters a nozzle in m#s\n", - "print(\"in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\")\n", - "print(\"h1+Q1_2=h2\")\n", - "print(\"Q1_2=h2-h1\")\n", - "print(\"so heat transfer to air in heat exchanger(Q1_2)in KJ\")\n", - "Q1_2=Cp*(T2-T1)\n", - "print(\"Q1_2=\"),round(Q1_2,2)\n", - "print(\"in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\")\n", - "print(\"h2+C2^2#2=h3+C3^2/2+Wt\")\n", - "print(\"Wt=(h2-h3)+(C2^2-C3^2)/2\")\n", - "print(\"so power output from turbine(Wt)in KJ#s\")\n", - "Wt=Cp*(T2-T3)+(C2**2-C3**2)*10**-3/2\n", - "print(\"Wt=\"),round(Cp,2)\n", - "print(\"applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\")\n", - "print(\"h3+C=h4+C4^2/2\")\n", - "print(\"C4^2#2=(h3-h4)+C3^2/2\")\n", - "print(\"velocity at exit of nozzle(C4)in m#s\")\n", - "C4=math.sqrt(2*(Cp*(T3-T4)+C3**2*10**-3/2))\n", - "print(\"C4=\"),round(C4,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.15;pg no:85" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.15, Page:85 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\n", - "for constant pressure heating,say state changes from 1 to 2\n", - "Wa=p1*dv\n", - "Wa=p1*(v2-v1)\n", - "it is given that v2=2v1\n", - "so Wa=p1*v1=R*T1\n", - "for subsequent expansion at constant temperature say state from 2 to 3\n", - "also given that v3/v1=6,v3/v2=3\n", - "so work=Wb=p*dv\n", - "on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\n", - "temperature at 2 can be given by perfect gas consideration as,\n", - "T2/T1=v2/v1\n", - "or T2=2*T1\n", - "now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\n", - "so W in KJ= 10632.69\n" - ] - } - ], - "source": [ - "#cal of total work done by ai\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.15, Page:85 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\")\n", - "T1=400;##initial temperature of gas in K\n", - "R=8.314;##gas constant in \n", - "print(\"for constant pressure heating,say state changes from 1 to 2\")\n", - "print(\"Wa=p1*dv\")\n", - "print(\"Wa=p1*(v2-v1)\")\n", - "print(\"it is given that v2=2v1\")\n", - "print(\"so Wa=p1*v1=R*T1\")\n", - "print(\"for subsequent expansion at constant temperature say state from 2 to 3\")\n", - "print(\"also given that v3/v1=6,v3/v2=3\")\n", - "print(\"so work=Wb=p*dv\")\n", - "print(\"on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\")\n", - "print(\"temperature at 2 can be given by perfect gas consideration as,\")\n", - "print(\"T2/T1=v2/v1\")\n", - "print(\"or T2=2*T1\")\n", - "print(\"now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\")\n", - "W=R*T1+2*R*T1*math.log(3)\n", - "print(\"so W in KJ=\"),round(W,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.16;pg no:85" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.16, Page:85 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\n", - "NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \n", - "we get W=(Vf-Vi)*((Pi+Pf)/2)\n", - "also final volume of gas in m^3 is Vf=3*Vi\n", - "now work done by gas(W)in J 750000.0\n" - ] - } - ], - "source": [ - "#cal of work done by gas\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.16, Page:85 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\")\n", - "Pi=0.5*10**6;##initial pressure of gas in pa\n", - "Vi=0.5;##initial volume of gas in m^3\n", - "Pf=1*10**6;##final pressure of gas in pa\n", - "print(\"NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \")\n", - "print(\"we get W=(Vf-Vi)*((Pi+Pf)/2)\")\n", - "print(\"also final volume of gas in m^3 is Vf=3*Vi\") \n", - "Vf=3*Vi\n", - "W=(Vf-Vi)*((Pi+Pf)/2)\n", - "print(\"now work done by gas(W)in J\"),round(W,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.17;pg no:87" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.17, Page:87 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\n", - "with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\n", - "adiabatic index of compression of H2 can be obtained as,\n", - "Cp_H2=\n", - "y_H2=Cp_H2/(Cp_H2-R_H2) 1.4\n", - "adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\n", - "y_N2= 1.4\n", - "i>for hydrogen,p1*v1^y=p2*v2^y\n", - "so final pressure of H2(p2)in pa\n", - "p2= 1324078.55\n", - "ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \n", - "partition work=0\n", - "iii>work done upon H2(W_H2)in J,\n", - "W_H2= -200054.06\n", - "work done upon H2(W_H2)=-2*10^5 J\n", - "so work done by N2(W_N2)=2*10^5 J \n", - "iv>heat added to N2 can be obtained using first law of thermodynamics as\n", - "Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\n", - "final temperature of N2 can be obtained considering it as perfect gas\n", - "therefore, T2=(p2*v2*T1)#(p1*v1)\n", - "here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\n", - "p2=1.324*10^6 pa,v2=0.75 m^3\n", - "so now final temperature of N2(T2)in K= 1191.67\n", - "mass of N2(m)in kg= 2.81\n", - "specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2= 1.0\n", - "heat added to N2,(Q_N2)in KJ\n", - "Q_N2= 2052.89\n" - ] - } - ], - "source": [ - "#cal of \n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.17, Page:87 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\")\n", - "Cp_H2=14.307;##specific heat of H2 at constant pressure in KJ#kg K\n", - "R_H2=4.1240;##gas constant for H2 in KJ#kg K\n", - "Cp_N2=1.039;##specific heat of N2 at constant pressure in KJ#kg K\n", - "R_N2=0.2968;##gas constant for N2 in KJ#kg K\n", - "T1=(27+273);##ambient temperature in K\n", - "v1=0.5;##initial volume of H2 in m^3\n", - "p1=0.5*10**6;##initial pressure of H2 in pa \n", - "v2=0.25;##final volume of H2 in m^3 \n", - "p2=1.324*10**6;##final pressure of H2 in pa\n", - "print(\"with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\")\n", - "print(\"adiabatic index of compression of H2 can be obtained as,\")\n", - "print(\"Cp_H2=\")\n", - "y_H2=Cp_H2/(Cp_H2-R_H2)\n", - "print(\"y_H2=Cp_H2/(Cp_H2-R_H2)\"),round(y_H2,2)\n", - "print(\"adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\")\n", - "y_N2=Cp_N2/(Cp_N2-R_N2)\n", - "print(\"y_N2=\"),round(y_N2,2)\n", - "print(\"i>for hydrogen,p1*v1^y=p2*v2^y\")\n", - "print(\"so final pressure of H2(p2)in pa\")\n", - "p2=p1*(v1/v2)**y_H2\n", - "print(\"p2=\"),round(p2,2)\n", - "print(\"ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \")\n", - "print(\"partition work=0\")\n", - "print(\"iii>work done upon H2(W_H2)in J,\")\n", - "W_H2=(p1*v1-p2*v2)/(y_H2-1)\n", - "print(\"W_H2=\"),round(W_H2,2)\n", - "print(\"work done upon H2(W_H2)=-2*10^5 J\")\n", - "W_N2=2*10**5;##work done by N2 in J\n", - "print(\"so work done by N2(W_N2)=2*10^5 J \")\n", - "print(\"iv>heat added to N2 can be obtained using first law of thermodynamics as\")\n", - "print(\"Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\")\n", - "print(\"final temperature of N2 can be obtained considering it as perfect gas\")\n", - "print(\"therefore, T2=(p2*v2*T1)#(p1*v1)\")\n", - "print(\"here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\")\n", - "print(\"p2=1.324*10^6 pa,v2=0.75 m^3\")\n", - "v2=0.75;##final volume of N2 in m^3\n", - "T2=(p2*v2*T1)/(p1*v1)\n", - "print(\"so now final temperature of N2(T2)in K=\"),round(T2,2)\n", - "T2=1191.6;##T2 approx. equal to 1191.6 K\n", - "m=(p1*v1)/(R_N2*1000*T1)\n", - "print(\"mass of N2(m)in kg=\"),round(m,2)\n", - "m=2.8;##m approx equal to 2.8 kg\n", - "Cv_N2=Cp_N2-R_N2\n", - "print(\"specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2=\"),round(Cv_N2)\n", - "print(\"heat added to N2,(Q_N2)in KJ\")\n", - "Q_N2=((m*Cv_N2*1000*(T2-T1))+W_N2)/1000\n", - "print(\"Q_N2=\"),round(Q_N2,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.18;pg no:88" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.18, Page:88 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\n", - "let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\n", - "initial mass of air(m1)in kg\n", - "m1= 9.29\n", - "for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\n", - "T2=in K 237.64\n", - "final mass of air left in tank(m2)in kg\n", - "m2= 2.97\n", - "writing down energy equation for unsteady flow system\n", - "(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\n", - "or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\n", - "kinetic energy available for running turbine(W)in KJ\n", - "W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", - "W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", - "amount of work available=KJ 482.67\n" - ] - } - ], - "source": [ - "#cal of amount of work available\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.18, Page:88 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\")\n", - "p1=0.5*10**6;#initial pressure of air in pa\n", - "p2=1.013*10**5;#atmospheric pressure in pa\n", - "v1=2;#initial volume of air in m^3\n", - "v2=v1;#final volume of air in m^3\n", - "T1=375;#initial temperature of air in K\n", - "Cp_air=1.003;#specific heat at consatnt pressure in KJ/kg K\n", - "Cv_air=0.716;#specific heat at consatnt volume in KJ/kg K\n", - "R_air=0.287;#gas constant in KJ/kg K\n", - "y=1.4;#expansion constant for air\n", - "print(\"let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\")\n", - "print(\"initial mass of air(m1)in kg\")\n", - "m1=(p1*v1)/(R_air*1000*T1)\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"T2=in K\"),round(T2,2)\n", - "print(\"final mass of air left in tank(m2)in kg\")\n", - "m2=(p2*v2)/(R_air*1000*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"writing down energy equation for unsteady flow system\")\n", - "print(\"(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\")\n", - "print(\"or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\")\n", - "print(\"kinetic energy available for running turbine(W)in KJ\")\n", - "print(\"W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", - "print(\"W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", - "W=((m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2)/1000\n", - "print(\"amount of work available=KJ\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.19;pg no:89" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.19, Page:89 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\n", - "using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\n", - "n1= 0.1\n", - "now n2= 0.12\n", - "for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\n", - "deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\n", - "final temperature of gas(T3)in K\n", - "T3= 409.09\n", - "using perfect gas equation for final mixture,\n", - "final pressure of gas(p3)in Mpa\n", - "p3= 750000.0\n", - "so final pressure and temperature =0.75 Mpa and 409.11 K\n" - ] - } - ], - "source": [ - "#cal of final pressure and temperature\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.19, Page:89 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\")\n", - "p1=0.5*10**6;#initial pressure of air in pa\n", - "v1=0.5;#initial volume of air in m^3\n", - "T1=(27+273);#initial temperature of air in K\n", - "p2=1*10**6;#final pressure of air in pa\n", - "v2=0.5;#final volume of air in m^3\n", - "T2=500;#final temperature of air in K\n", - "R=8314;#gas constant in J/kg K\n", - "Cv=0.716;#specific heat at constant volume in KJ/kg K\n", - "print(\"using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\")\n", - "n1=(p1*v1)/(R*T1)\n", - "print(\"n1=\"),round(n1,2)\n", - "n2=(p2*v2)/(R*T2)\n", - "print(\"now n2=\"),round(n2,2)\n", - "print(\"for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\")\n", - "deltaU=0;#change in internal energy\n", - "print(\"deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\")\n", - "print(\"final temperature of gas(T3)in K\")\n", - "T3=(deltaU+Cv*(n1*T1+n2*T2))/(Cv*(n1+n2))\n", - "print(\"T3=\"),round(T3,2)\n", - "print(\"using perfect gas equation for final mixture,\")\n", - "print(\"final pressure of gas(p3)in Mpa\")\n", - "p3=((n1+n2)*R*T3)/(v1+v2)\n", - "print(\"p3=\"),round(p3,3)\n", - "print(\"so final pressure and temperature =0.75 Mpa and 409.11 K\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.20;pg no:90" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.20, Page:90 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\n", - "printlacement work,W=p*(v1-v2)in N.m -50675.0\n", - "so heat transfer(Q)in N.m\n", - "Q=-W 50675.0\n" - ] - } - ], - "source": [ - "#cal of heat transfer\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.20, Page:90 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\")\n", - "v1=0;#initial volume of air inside bottle in m^3\n", - "v2=0.5;#final volume of air inside bottle in m^3\n", - "p=1.0135*10**5;#atmospheric pressure in pa\n", - "W=p*(v1-v2)\n", - "print(\"printlacement work,W=p*(v1-v2)in N.m\"),round(W,2)\n", - "print(\"so heat transfer(Q)in N.m\")\n", - "Q=-W\n", - "print(\"Q=-W\"),round(Q,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.21;pg no:90" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.21, Page:90 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\n", - "here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\n", - "(p2/p1)^((y-1)/y)=(T2/T1)\n", - "final temperature of air(T2)in K\n", - "T2= 113.34\n", - "by perfect gas law,initial mass in bottle(m1)in kg\n", - "m1= 11.69\n", - "final mass in bottle(m2)in kg\n", - "m2= 0.92\n", - "energy available for running turbo generator or work(W)in KJ\n", - "W+(m1-m2)*h2=m1*u1-m2*u2\n", - "W= 1325.42\n", - "this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\n", - "turbogenerator actual output(P1)=5 KJ/s\n", - "input to turbogenerator(P2)in KJ/s\n", - "time duration for which turbogenerator can be run(deltat)in seconds\n", - "deltat= 159.05\n", - "duration=160 seconds approx.\n" - ] - } - ], - "source": [ - "#cal of time duration for which turbogenerator can be run\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.21, Page:90 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\")\n", - "p1=35.*10**5;#initial pressure of air in pa\n", - "v1=0.3;#initial volume of air in m^3\n", - "T1=(313.);#initial temperature of air in K\n", - "p2=1.*10**5;#final pressure of air in pa\n", - "v2=0.3;#final volume of air in m^3\n", - "y=1.4;#expansion constant\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\")\n", - "print(\"(p2/p1)^((y-1)/y)=(T2/T1)\")\n", - "print(\"final temperature of air(T2)in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"T2=\"),round(T2,2)\n", - "print(\"by perfect gas law,initial mass in bottle(m1)in kg\")\n", - "m1=(p1*v1)/(R*1000.*T1)\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"final mass in bottle(m2)in kg\")\n", - "m2=(p2*v2)/(R*1000.*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"energy available for running turbo generator or work(W)in KJ\")\n", - "print(\"W+(m1-m2)*h2=m1*u1-m2*u2\")\n", - "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", - "print(\"W=\"),round(W,2)\n", - "print(\"this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\")\n", - "print(\"turbogenerator actual output(P1)=5 KJ/s\")\n", - "P1=5;#turbogenerator actual output in KJ/s\n", - "print(\"input to turbogenerator(P2)in KJ/s\")\n", - "P2=P1/0.6\n", - "print(\"time duration for which turbogenerator can be run(deltat)in seconds\")\n", - "deltat=W/P2\n", - "print(\"deltat=\"),round(deltat,2)\n", - "print(\"duration=160 seconds approx.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.22;pg no:91" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.22, Page:91 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\n", - "different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\n", - "process 1-2 is polytropic process with index 1.2\n", - "(T2/T1)=(p2/p1)^((n-1)/n)\n", - "final temperature of air(T2)in K\n", - "T2= 457.68\n", - "at state 1,p1*v1=m*R*T1\n", - "initial volume of air(v1)in m^3\n", - "v1= 2.01\n", - "final volume of air(v2)in m^3\n", - "for process 1-2,v2= 0.53\n", - "for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\n", - "v3=v2*T3/T2 in m^3\n", - "here process 3-1 is isothermal process so T1=T3\n", - "during process 1-2 the compression work(W1_2)in KJ\n", - "W1_2=(m*R*(T2-T1)/(1-n))\n", - "work during process 2-3(W2_3)in KJ,\n", - "W2_3=p2*(v3-v2)/1000\n", - "work during process 3-1(W3_1)in KJ\n", - "W3_1= 485.0\n", - "net work done(W_net)in KJ\n", - "W_net=W1_2+W2_3+W3_1 -71.28\n", - "net work=-71.27 KJ\n", - "here -ve workshows work done upon the system.since it is cycle,so\n", - "W_net=Q_net\n", - "phi dW=phi dQ=-71.27 KJ\n", - "heat transferred from system=71.27 KJ\n" - ] - } - ], - "source": [ - "#cal of network,heat transferred from system\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.22, Page:91 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\")\n", - "p1=1.5*10**5;#initial pressure of air in pa\n", - "T1=(77+273);#initial temperature of air in K\n", - "p2=7.5*10**5;#final pressure of air in pa\n", - "n=1.2;#expansion constant for process 1-2\n", - "R=0.287;#gas constant in KJ/kg K\n", - "m=3.;#mass of air in kg\n", - "print(\"different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\")\n", - "print(\"process 1-2 is polytropic process with index 1.2\")\n", - "print(\"(T2/T1)=(p2/p1)^((n-1)/n)\")\n", - "print(\"final temperature of air(T2)in K\")\n", - "T2=T1*((p2/p1)**((n-1)/n))\n", - "print(\"T2=\"),round(T2,2)\n", - "print(\"at state 1,p1*v1=m*R*T1\")\n", - "print(\"initial volume of air(v1)in m^3\")\n", - "v1=(m*R*1000*T1)/p1\n", - "print(\"v1=\"),round(v1,2)\n", - "print(\"final volume of air(v2)in m^3\")\n", - "v2=((p1*v1**n)/p2)**(1/n)\n", - "print(\"for process 1-2,v2=\"),round(v2,2)\n", - "print(\"for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\")\n", - "print(\"v3=v2*T3/T2 in m^3\")\n", - "print(\"here process 3-1 is isothermal process so T1=T3\")\n", - "T3=T1;#process 3-1 is isothermal\n", - "v3=v2*T3/T2\n", - "print(\"during process 1-2 the compression work(W1_2)in KJ\")\n", - "print(\"W1_2=(m*R*(T2-T1)/(1-n))\")\n", - "W1_2=(m*R*(T2-T1)/(1-n))\n", - "print(\"work during process 2-3(W2_3)in KJ,\")\n", - "print(\"W2_3=p2*(v3-v2)/1000\")\n", - "W2_3=p2*(v3-v2)/1000\n", - "print(\"work during process 3-1(W3_1)in KJ\")\n", - "p3=p2;#pressure is constant for process 2-3\n", - "W3_1=p3*v3*math.log(v1/v3)/1000\n", - "print(\"W3_1=\"),round(W3_1,2)\n", - "print(\"net work done(W_net)in KJ\")\n", - "W_net=W1_2+W2_3+W3_1\n", - "print(\"W_net=W1_2+W2_3+W3_1\"),round(W_net,2)\n", - "print(\"net work=-71.27 KJ\")\n", - "print(\"here -ve workshows work done upon the system.since it is cycle,so\")\n", - "print(\"W_net=Q_net\")\n", - "print(\"phi dW=phi dQ=-71.27 KJ\")\n", - "print(\"heat transferred from system=71.27 KJ\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.23;pg no:93" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.23, Page:93 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\n", - "initial mass of air in bottle(m1)in kg \n", - "m1= 6.97\n", - "now final temperature(T2)in K\n", - "T2= 0.0\n", - "final mass of air in bottle(m2)in kg\n", - "m2= 0.82\n", - "energy available for running of turbine due to emptying of bottle(W)in KJ\n", - "W= 639.09\n", - "work available from turbine=639.27KJ\n" - ] - } - ], - "source": [ - "#cal of work available from turbine\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.23, Page:93 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\")\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "y=1.4;#expansion constant \n", - "p1=40*10**5;#initial temperature of air in pa\n", - "v1=0.15;#initial volume of air in m^3\n", - "T1=(27+273);#initial temperature of air in K\n", - "p2=2*10**5;#final temperature of air in pa\n", - "v2=0.15;#final volume of air in m^3\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"initial mass of air in bottle(m1)in kg \")\n", - "m1=(p1*v1)/(R*1000*T1)\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"now final temperature(T2)in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"T2=\"),round(T2,2)\n", - "T2=127.36;#take T2=127.36 approx.\n", - "print(\"final mass of air in bottle(m2)in kg\")\n", - "m2=(p2*v2)/(R*1000*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "m2=0.821;#take m2=0.821 approx.\n", - "print(\"energy available for running of turbine due to emptying of bottle(W)in KJ\")\n", - "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", - "print(\"W=\"),round(W,2)\n", - "print(\"work available from turbine=639.27KJ\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter3_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter3_1.ipynb deleted file mode 100755 index 22ed40c9..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter3_1.ipynb +++ /dev/null @@ -1,1506 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 3:First Law of Thermo Dynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.1;pg no:76" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.1, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\n", - "a> work done on piston(W_piston)in KJ can be obtained as\n", - "W_piston=pdv\n", - "b> paddle work done on the system(W_paddle)=-4.88 KJ\n", - "net work done of system(W_net)in KJ\n", - "W_net=W_piston+W_paddle\n", - "so work done on system(W_net)=1.435 KJ\n" - ] - } - ], - "source": [ - "#cal of work done on system\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.1, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\")\n", - "import scipy\n", - "from scipy import integrate\n", - "\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "p=689.;#pressure of gas in cylinder in kpa\n", - "v1=0.04;#initial volume of fluid in m^3\n", - "v2=0.045;#final volume of fluid in m^3\n", - "W_paddle=-4.88;#paddle work done on the system in KJ\n", - "print(\"a> work done on piston(W_piston)in KJ can be obtained as\")\n", - "print(\"W_piston=pdv\")\n", - "#function y = f(v), y=p, endfunction\n", - "def fun1(x):\n", - "\ty=p\n", - "\treturn y\n", - "\n", - "W_piston=scipy.integrate.quad(fun1,v1,v2) \n", - "print(\"b> paddle work done on the system(W_paddle)=-4.88 KJ\")\n", - "print(\"net work done of system(W_net)in KJ\")\n", - "print(\"W_net=W_piston+W_paddle\")\n", - "print(\"so work done on system(W_net)=1.435 KJ\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.2;pg no:" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.2, Page:76 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\n", - "as the vessel is rigid therefore work done shall be zero\n", - "W=0\n", - "from first law of thermodynamics,heat required(Q)in KJ\n", - "Q=U2-U1+W=Q=m(u2-u1)+W\n", - "so heat required = 5.6\n" - ] - } - ], - "source": [ - "#cal of heat required\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.2, Page:76 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\")\n", - "m=0.5;#mass of gas in kg\n", - "u1=26.6;#internal energy of gas at 200 degree celcius\n", - "u2=37.8;#internal energy of gas at 400 degree celcius\n", - "W=0;#work done by vessel in KJ\n", - "print(\"as the vessel is rigid therefore work done shall be zero\")\n", - "print(\"W=0\")\n", - "print(\"from first law of thermodynamics,heat required(Q)in KJ\")\n", - "print(\"Q=U2-U1+W=Q=m(u2-u1)+W\")\n", - "Q=m*(u2-u1)+W\n", - "print(\"so heat required =\"),round(Q,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.3;pg no:77" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.3, Page:77 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\n", - "by steady flow energy equation\n", - "q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\n", - "let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\n", - "q=h2-h1\n", - "rate of heat removal(Q)in KJ/hr\n", - "Q=m(h2-h1)=m*Cp*(T2-T1)\n", - "heat should be removed at the rate=KJ/hr 40500.0\n" - ] - } - ], - "source": [ - "#cal of \"heat should be removed\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.3, Page:77 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\")\n", - "m=50;#rate at which carbon dioxide passing through heat exchanger in kg/hr\n", - "T2=800;#initial temperature of carbon dioxide in degree celcius\n", - "T1=50;#final temperature of carbon dioxide in degree celcius\n", - "Cp=1.08;#specific heat at constant pressure in KJ/kg K\n", - "print(\"by steady flow energy equation\")\n", - "print(\"q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\")\n", - "print(\"let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\")\n", - "print(\"q=h2-h1\")\n", - "print(\"rate of heat removal(Q)in KJ/hr\")\n", - "print(\"Q=m(h2-h1)=m*Cp*(T2-T1)\")\n", - "Q=m*Cp*(T2-T1)\n", - "print(\"heat should be removed at the rate=KJ/hr\"),round(Q)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.4;pg no:77" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "#cal of work done by surrounding on system\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.4, Page:77 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 4\")\n", - "v=0.78;#volume of cylinder in m^3\n", - "p=101.325;#atmospheric pressure in kPa\n", - "print(\"total work done by the air at atmospheric pressure of 101.325 kPa\")\n", - "print(\"W=(pdv)cylinder+(pdv)air\")\n", - "print(\"0+p*(delta v)\")\n", - "print(\"work done by air(W)=-p*v in KJ\")\n", - "W=-p*v\n", - "print(\"so work done by surrounding on system=KJ\"),round(-W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.5:pg no:77" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.5, Page:77 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\n", - "given p*v^1.3=constant\n", - "assuming expansion to be quasi-static,the work may be given as\n", - "W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\n", - "from internal energy relation,change in specific internal energy\n", - "deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\n", - "total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\n", - "using p1*V1^1.3=p2*V2^1.3\n", - "V2=in m^3 0.85\n", - "take V2=.852 m^3\n", - "so deltaU in KJ\n", - "and W in KJ 246.67\n", - "from first law\n", - "deltaQ=KJ 113.47\n", - "heat interaction=113.5 KJ\n", - "work interaction=246.7 KJ\n", - "change in internal energy=-113.2 KJ\n" - ] - } - ], - "source": [ - "#cal of heat,work interaction and change in internal energy\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.5, Page:77 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\")\n", - "m=5;#mass of gas in kg\n", - "p1=1*10**3;#initial pressure of gas in KPa\n", - "V1=0.5;#initial volume of gas in m^3\n", - "p2=0.5*10**3;#final pressure of gas in KPa\n", - "n=1.3;#expansion constant\n", - "print(\"given p*v^1.3=constant\")\n", - "print(\"assuming expansion to be quasi-static,the work may be given as\")\n", - "print(\"W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\")\n", - "print(\"from internal energy relation,change in specific internal energy\")\n", - "print(\"deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\")\n", - "print(\"total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\")\n", - "print(\"using p1*V1^1.3=p2*V2^1.3\")\n", - "V2=V1*(p1/p2)**(1/1.3)\n", - "print(\"V2=in m^3\"),round(V2,2)\n", - "print(\"take V2=.852 m^3\")\n", - "V2=0.852;#final volume of gas in m^3\n", - "print(\"so deltaU in KJ\")\n", - "deltaU=1.8*(p2*V2-p1*V1)\n", - "W=(p2*V2-p1*V1)/(1-n)\n", - "print(\"and W in KJ\"),round(W,2)\n", - "print(\"from first law\")\n", - "deltaQ=deltaU+W\n", - "print(\"deltaQ=KJ\"),round(deltaQ,2)\n", - "print(\"heat interaction=113.5 KJ\")\n", - "print(\"work interaction=246.7 KJ\")\n", - "print(\"change in internal energy=-113.2 KJ\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.6;pg no:78" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.6, Page:78 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\n", - "final state volume(v2)in m^3\n", - "v2= 0.0\n", - "take v2=0.03 m^3\n", - "now internal energy of gas is given by U=7.5*p*v-425\n", - "change in internal energy(deltaU)in KJ\n", - "deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\n", - "deltaU=7.5*10^3*(p2*v2-p1*v1) 75.0\n", - "for quasi-static process\n", - "work(W) in KJ,W=p*dv\n", - "W=(p2*v2-p1*v1)/(1-n)\n", - "from first law of thermodynamics,\n", - "heat interaction(deltaQ)=deltaU+W\n", - "heat=50 KJ\n", - "work=25 KJ(-ve)\n", - "internal energy change=75 KJ\n", - "if 180 KJ heat transfer takes place,then from 1st law,\n", - "deltaQ= 50.0\n", - "since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\n", - "W=KJ 105.0\n" - ] - } - ], - "source": [ - "#cal of heat,workinternal energy change\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.6, Page:78 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\")\n", - "p1=1;#initial pressure of gas in MPa\n", - "v1=0.05;#initial volume of gas in m^3\n", - "p2=2;#final pressure of gas in MPa\n", - "n=1.4;#expansion constant\n", - "print(\"final state volume(v2)in m^3\")\n", - "v2=((p1/p2)**(1/1.4))*v1\n", - "print(\"v2=\"),round(v2,2)\n", - "print(\"take v2=0.03 m^3\")\n", - "v2=0.03;#final volume of gas in m^3\n", - "print(\"now internal energy of gas is given by U=7.5*p*v-425\")\n", - "print(\"change in internal energy(deltaU)in KJ\")\n", - "print(\"deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\")\n", - "deltaU=7.5*10**3*(p2*v2-p1*v1)\n", - "print(\"deltaU=7.5*10^3*(p2*v2-p1*v1)\"),round(deltaU,2)\n", - "print(\"for quasi-static process\")\n", - "print(\"work(W) in KJ,W=p*dv\")\n", - "W=((p2*v2-p1*v1)/(1-n))*10**3\n", - "print(\"W=(p2*v2-p1*v1)/(1-n)\")\n", - "print(\"from first law of thermodynamics,\")\n", - "print(\"heat interaction(deltaQ)=deltaU+W\")\n", - "deltaQ=deltaU+W\n", - "print(\"heat=50 KJ\")\n", - "print(\"work=25 KJ(-ve)\")\n", - "print(\"internal energy change=75 KJ\")\n", - "print(\"if 180 KJ heat transfer takes place,then from 1st law,\")\n", - "print(\"deltaQ=\"),round(deltaQ,2)\n", - "print(\"since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\")\n", - "W=180-75\n", - "print(\"W=KJ\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.7;pg no:79" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.7, Page:79 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\n", - "characteristics gas constant(R)in J/kg K\n", - "R= 519.64\n", - "take R=0.520,KJ/kg K\n", - "Cv=inKJ/kg K 1.18\n", - "y= 1.44\n", - "for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\n", - "now,T2=in K\n", - "work(W)in KJ/kg\n", - "W= -257.78\n", - "for polytropic process,heat(Q)in KJ/K\n", - "Q= 82.02\n" - ] - } - ], - "source": [ - "#cal of work and heat\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.7, Page:79 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\")\n", - "M=16;#molecular weight of gas\n", - "p1=101.3;#initial pressure of gas in KPa\n", - "p2=600;#final pressure of gas in KPa\n", - "T1=(273+20);#initial temperature of gas in K\n", - "R1=8.3143*10**3;#universal gas constant in J/kg K\n", - "Cp=1.7;#specific heat at constant pressure in KJ/kg K\n", - "n=1.3;#expansion constant\n", - "T2=((p2/p1)**(n-1/n))\n", - "print(\"characteristics gas constant(R)in J/kg K\")\n", - "R=R1/M\n", - "print(\"R=\"),round(R,2)\n", - "print(\"take R=0.520,KJ/kg K\")\n", - "R=0.520;#characteristics gas constant in KJ/kg K\n", - "Cv=Cp-R\n", - "print(\"Cv=inKJ/kg K\"),round(Cv,2)\n", - "y=Cp/Cv\n", - "print(\"y=\"),round(y,2)\n", - "y=1.44;#ratio of specific heat at constant pressure to constant volume\n", - "print(\"for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\")\n", - "T2=T1*((p2/p1)**((n-1)/n))\n", - "print(\"now,T2=in K\")\n", - "print(\"work(W)in KJ/kg\")\n", - "W=R*((T1-T2)/(n-1))\n", - "print(\"W=\"),round(W,2)\n", - "W=257.78034;#work done in KJ/kg\n", - "print(\"for polytropic process,heat(Q)in KJ/K\")\n", - "Q=((y-n)/(y-1))*W\n", - "print(\"Q=\"),round(Q,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.8;pg no:80" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.8, Page:80 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\n", - "applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\n", - "h1+C1^2/2=h2+C2^2/2\n", - "given that C1=0,negligible inlet velocity\n", - "so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\n", - "exit velocity(C2)in m/s 1098.2\n" - ] - } - ], - "source": [ - "#cal of exit velocity\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.8, Page:80 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\")\n", - "T1=(627+273);#initial temperature of air in nozzle in K\n", - "T2=(27+273);#temperature at which air leaves nozzle in K\n", - "Cp=1.005*10**3;#specific heat at constant pressure in J/kg K\n", - "C2=math.sqrt(2*Cp*(T1-T2))\n", - "print(\"applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\")\n", - "print(\"h1+C1^2/2=h2+C2^2/2\")\n", - "print(\"given that C1=0,negligible inlet velocity\")\n", - "print(\"so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\")\n", - "print(\"exit velocity(C2)in m/s\"),round(C2,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.9;pg no:80" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.9, Page:80 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\n", - "work interaction,W=-200 KJ/kg of air\n", - "increase in enthalpy of air=100 KJ/kg of air\n", - "total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\n", - "writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\n", - "h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\n", - "assuming no change in potential energy and kinetic energy\n", - "deltaK.E=deltaP.=0\n", - "total heat interaction(Q)in KJ/kg of air\n", - "Q= -100.0\n", - "Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\n", - "so heat transferred to atmosphere(Q2)in KJ/kg of air -10.0\n" - ] - } - ], - "source": [ - "#cal of heat transferred to atmosphere\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.9, Page:80 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\")\n", - "W=-200;#shaft work in KJ/kg of air\n", - "deltah=100;#increase in enthalpy in KJ/kg of air\n", - "Q1=-90;#heat transferred to water in KJ/kg of air\n", - "print(\"work interaction,W=-200 KJ/kg of air\")\n", - "print(\"increase in enthalpy of air=100 KJ/kg of air\")\n", - "print(\"total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\")\n", - "print(\"writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\")\n", - "print(\"h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\")\n", - "print(\"assuming no change in potential energy and kinetic energy\")\n", - "print(\"deltaK.E=deltaP.=0\")\n", - "print(\"total heat interaction(Q)in KJ/kg of air\")\n", - "Q=deltah+W\n", - "print(\"Q=\"),round(Q,2)\n", - "Q2=Q-Q1\n", - "print(\"Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\")\n", - "print(\"so heat transferred to atmosphere(Q2)in KJ/kg of air\"),round(Q2,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.10;pg no:81" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.10, Page:81 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\n", - "above problem can be solved using steady flow energy equations upon hot water flow\n", - "Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\n", - "here total heat to be supplied(Q)in kcal/hr\n", - "so heat lost by water(-ve),Q=-25000 kcal/hr\n", - "there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\n", - "Q+m*(h1+g*z1)=m*(h2+g*z2)\n", - "so water circulation rate(m)in kg/hr\n", - "so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\n", - "water circulation rate=(m)in kg/min 11.91\n" - ] - } - ], - "source": [ - "#cal of water circulation rate\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.10, Page:81 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\")\n", - "n=500;#total number of persons\n", - "q=50;#heat requirement per person in kcal/hr\n", - "h1=80;#enthalpy of hot water enter in pipe in kcal/kg\n", - "h2=45;#enthalpy of hot water leaves the pipe in kcal/kg\n", - "g=9.81;#acceleartion due to gravity in m/s^2\n", - "deltaz=10;#difference in elevation of inlet and exit pipe in m\n", - "print(\"above problem can be solved using steady flow energy equations upon hot water flow\")\n", - "print(\"Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\")\n", - "print(\"here total heat to be supplied(Q)in kcal/hr\")\n", - "Q=n*q\n", - "print(\"so heat lost by water(-ve),Q=-25000 kcal/hr\")\n", - "Q=-25000#heat loss by water in kcal/hr\n", - "print(\"there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\")\n", - "print(\"Q+m*(h1+g*z1)=m*(h2+g*z2)\")\n", - "print(\"so water circulation rate(m)in kg/hr\")\n", - "print(\"so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\")\n", - "m=Q*10**3*4.18/(g*deltaz-(h1-h2)*10**3*4.18)\n", - "m=m/60\n", - "print(\"water circulation rate=(m)in kg/min\"),round(m,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.11;pg no:81" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.11, Page:81 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\n", - "let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\n", - "energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\n", - "m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\n", - "so steam suppling rate(m)in kg/s per kg of water\n", - "m= 0.124\n", - "NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\n" - ] - } - ], - "source": [ - "#cal of steam suppling rate\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.11, Page:81 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\")\n", - "v1=50;#velocity of steam entering injector in m/s\n", - "v2=25;#velocity of mixture leave injector in m/s\n", - "h1=720;#enthalpy of steam entering injector in kcal/kg\n", - "h2=24.6;#enthalpy of water entering injector in kcal/kg\n", - "h3=100;#enthalpy of steam leaving injector in kcal/kg\n", - "h4=100;#enthalpy of water leaving injector in kcal/kg\n", - "deltaz=2;#depth from axis of injector in m\n", - "q=12;#heat loss from injector to surrounding through injector\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\")\n", - "print(\"energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\")\n", - "print(\"m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\")\n", - "print(\"so steam suppling rate(m)in kg/s per kg of water\")\n", - "m=((h3*10**3*4.18+v2**2/2)-(h2*10**3*4.18+g*deltaz))/((v1**2/2+h1*10**3*4.18)-(h3*10**3*4.18+v2**2/2)-(q*10**3*4.18))\n", - "print(\"m=\"),round(m,3)\n", - "print(\"NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.12;pg no:82" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.12, Page:82 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\n", - "here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\n", - "displacement work, W=(p.dv)cylinder+(p.dv)ballon\n", - "(p.dv)cylinder=0,as cylinder is rigid\n", - "so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\n", - "and work done by atmosphere=KJ 40.52\n" - ] - } - ], - "source": [ - "#cal of work done by atmosphere\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.12, Page:82 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\")\n", - "p=1.013*10**5;#atmospheric pressure in pa\n", - "deltav=0.4;#change in volume in m^3\n", - "print(\"here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\")\n", - "print(\"displacement work, W=(p.dv)cylinder+(p.dv)ballon\")\n", - "print(\"(p.dv)cylinder=0,as cylinder is rigid\")\n", - "print(\"so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\")\n", - "W=(p*deltav)/1000\n", - "print(\"and work done by atmosphere=KJ\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.13;pg no:82" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.13, Page:82 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\n", - "work done by turbine(Wt)in J#s is 25% of heat added i.e Wt= 1250.0\n", - "heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\n", - "Qrejected= 3750.0\n", - "and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\n", - "Wp=(-) 10.0\n", - "capacity of generator(W)=in Kw 1.24\n" - ] - } - ], - "source": [ - "#cal of capacity of generator\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.13, Page:82 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\")\n", - "Qadd=5000;#heat supplied in boiler in J#s\n", - "Wt=.25*Qadd\n", - "print(\"work done by turbine(Wt)in J#s is 25% of heat added i.e\"),\n", - "print(\"Wt=\"),round(Wt,2)\n", - "print(\"heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\")\n", - "Qrejected=.75*Qadd\n", - "print(\"Qrejected=\"),round(Qrejected,2)\n", - "print(\"and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\")\n", - "Wp=0.002*Qadd\n", - "print(\"Wp=(-)\"),round(Wp,2)\n", - "W=(Wt-Wp)/1000\n", - "print(\"capacity of generator(W)=in Kw\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.14;pg no:83" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.14, Page:83 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\n", - "in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\n", - "h1+Q1_2=h2\n", - "Q1_2=h2-h1\n", - "so heat transfer to air in heat exchanger(Q1_2)in KJ\n", - "Q1_2= 726.61\n", - "in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\n", - "h2+C2^2#2=h3+C3^2/2+Wt\n", - "Wt=(h2-h3)+(C2^2-C3^2)/2\n", - "so power output from turbine(Wt)in KJ#s\n", - "Wt= 1.0\n", - "applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\n", - "h3+C=h4+C4^2/2\n", - "C4^2#2=(h3-h4)+C3^2/2\n", - "velocity at exit of nozzle(C4)in m#s\n", - "C4= 14.3\n" - ] - } - ], - "source": [ - "#cal of velocity at exit of nozzle\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.14, Page:83 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\")\n", - "T1=(27+273);##ambient temperature in K\n", - "T2=(750+273);##temperature of heated air inside heat exchanger in K\n", - "T3=(600+273);##temperature of hot air leaves turbine in K\n", - "T4=(500+273);##temperature at which air leaves nozzle in K\n", - "Cp=1.005;##specific heat at constant pressure in KJ#kg K\n", - "C2=50;##velocity of hot air enter into gas turbine in m#s\n", - "C3=60;##velocity of air leaving turbine enters a nozzle in m#s\n", - "print(\"in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\")\n", - "print(\"h1+Q1_2=h2\")\n", - "print(\"Q1_2=h2-h1\")\n", - "print(\"so heat transfer to air in heat exchanger(Q1_2)in KJ\")\n", - "Q1_2=Cp*(T2-T1)\n", - "print(\"Q1_2=\"),round(Q1_2,2)\n", - "print(\"in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\")\n", - "print(\"h2+C2^2#2=h3+C3^2/2+Wt\")\n", - "print(\"Wt=(h2-h3)+(C2^2-C3^2)/2\")\n", - "print(\"so power output from turbine(Wt)in KJ#s\")\n", - "Wt=Cp*(T2-T3)+(C2**2-C3**2)*10**-3/2\n", - "print(\"Wt=\"),round(Cp,2)\n", - "print(\"applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\")\n", - "print(\"h3+C=h4+C4^2/2\")\n", - "print(\"C4^2#2=(h3-h4)+C3^2/2\")\n", - "print(\"velocity at exit of nozzle(C4)in m#s\")\n", - "C4=math.sqrt(2*(Cp*(T3-T4)+C3**2*10**-3/2))\n", - "print(\"C4=\"),round(C4,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.15;pg no:85" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.15, Page:85 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\n", - "for constant pressure heating,say state changes from 1 to 2\n", - "Wa=p1*dv\n", - "Wa=p1*(v2-v1)\n", - "it is given that v2=2v1\n", - "so Wa=p1*v1=R*T1\n", - "for subsequent expansion at constant temperature say state from 2 to 3\n", - "also given that v3/v1=6,v3/v2=3\n", - "so work=Wb=p*dv\n", - "on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\n", - "temperature at 2 can be given by perfect gas consideration as,\n", - "T2/T1=v2/v1\n", - "or T2=2*T1\n", - "now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\n", - "so W in KJ= 10632.69\n" - ] - } - ], - "source": [ - "#cal of total work done by ai\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.15, Page:85 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\")\n", - "T1=400;##initial temperature of gas in K\n", - "R=8.314;##gas constant in \n", - "print(\"for constant pressure heating,say state changes from 1 to 2\")\n", - "print(\"Wa=p1*dv\")\n", - "print(\"Wa=p1*(v2-v1)\")\n", - "print(\"it is given that v2=2v1\")\n", - "print(\"so Wa=p1*v1=R*T1\")\n", - "print(\"for subsequent expansion at constant temperature say state from 2 to 3\")\n", - "print(\"also given that v3/v1=6,v3/v2=3\")\n", - "print(\"so work=Wb=p*dv\")\n", - "print(\"on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\")\n", - "print(\"temperature at 2 can be given by perfect gas consideration as,\")\n", - "print(\"T2/T1=v2/v1\")\n", - "print(\"or T2=2*T1\")\n", - "print(\"now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\")\n", - "W=R*T1+2*R*T1*math.log(3)\n", - "print(\"so W in KJ=\"),round(W,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.16;pg no:85" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.16, Page:85 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\n", - "NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \n", - "we get W=(Vf-Vi)*((Pi+Pf)/2)\n", - "also final volume of gas in m^3 is Vf=3*Vi\n", - "now work done by gas(W)in J 750000.0\n" - ] - } - ], - "source": [ - "#cal of work done by gas\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.16, Page:85 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\")\n", - "Pi=0.5*10**6;##initial pressure of gas in pa\n", - "Vi=0.5;##initial volume of gas in m^3\n", - "Pf=1*10**6;##final pressure of gas in pa\n", - "print(\"NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \")\n", - "print(\"we get W=(Vf-Vi)*((Pi+Pf)/2)\")\n", - "print(\"also final volume of gas in m^3 is Vf=3*Vi\") \n", - "Vf=3*Vi\n", - "W=(Vf-Vi)*((Pi+Pf)/2)\n", - "print(\"now work done by gas(W)in J\"),round(W,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.17;pg no:87" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.17, Page:87 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\n", - "with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\n", - "adiabatic index of compression of H2 can be obtained as,\n", - "Cp_H2=\n", - "y_H2=Cp_H2/(Cp_H2-R_H2) 1.4\n", - "adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\n", - "y_N2= 1.4\n", - "i>for hydrogen,p1*v1^y=p2*v2^y\n", - "so final pressure of H2(p2)in pa\n", - "p2= 1324078.55\n", - "ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \n", - "partition work=0\n", - "iii>work done upon H2(W_H2)in J,\n", - "W_H2= -200054.06\n", - "work done upon H2(W_H2)=-2*10^5 J\n", - "so work done by N2(W_N2)=2*10^5 J \n", - "iv>heat added to N2 can be obtained using first law of thermodynamics as\n", - "Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\n", - "final temperature of N2 can be obtained considering it as perfect gas\n", - "therefore, T2=(p2*v2*T1)#(p1*v1)\n", - "here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\n", - "p2=1.324*10^6 pa,v2=0.75 m^3\n", - "so now final temperature of N2(T2)in K= 1191.67\n", - "mass of N2(m)in kg= 2.81\n", - "specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2= 1.0\n", - "heat added to N2,(Q_N2)in KJ\n", - "Q_N2= 2052.89\n" - ] - } - ], - "source": [ - "#cal of \n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.17, Page:87 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\")\n", - "Cp_H2=14.307;##specific heat of H2 at constant pressure in KJ#kg K\n", - "R_H2=4.1240;##gas constant for H2 in KJ#kg K\n", - "Cp_N2=1.039;##specific heat of N2 at constant pressure in KJ#kg K\n", - "R_N2=0.2968;##gas constant for N2 in KJ#kg K\n", - "T1=(27+273);##ambient temperature in K\n", - "v1=0.5;##initial volume of H2 in m^3\n", - "p1=0.5*10**6;##initial pressure of H2 in pa \n", - "v2=0.25;##final volume of H2 in m^3 \n", - "p2=1.324*10**6;##final pressure of H2 in pa\n", - "print(\"with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\")\n", - "print(\"adiabatic index of compression of H2 can be obtained as,\")\n", - "print(\"Cp_H2=\")\n", - "y_H2=Cp_H2/(Cp_H2-R_H2)\n", - "print(\"y_H2=Cp_H2/(Cp_H2-R_H2)\"),round(y_H2,2)\n", - "print(\"adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\")\n", - "y_N2=Cp_N2/(Cp_N2-R_N2)\n", - "print(\"y_N2=\"),round(y_N2,2)\n", - "print(\"i>for hydrogen,p1*v1^y=p2*v2^y\")\n", - "print(\"so final pressure of H2(p2)in pa\")\n", - "p2=p1*(v1/v2)**y_H2\n", - "print(\"p2=\"),round(p2,2)\n", - "print(\"ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \")\n", - "print(\"partition work=0\")\n", - "print(\"iii>work done upon H2(W_H2)in J,\")\n", - "W_H2=(p1*v1-p2*v2)/(y_H2-1)\n", - "print(\"W_H2=\"),round(W_H2,2)\n", - "print(\"work done upon H2(W_H2)=-2*10^5 J\")\n", - "W_N2=2*10**5;##work done by N2 in J\n", - "print(\"so work done by N2(W_N2)=2*10^5 J \")\n", - "print(\"iv>heat added to N2 can be obtained using first law of thermodynamics as\")\n", - "print(\"Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\")\n", - "print(\"final temperature of N2 can be obtained considering it as perfect gas\")\n", - "print(\"therefore, T2=(p2*v2*T1)#(p1*v1)\")\n", - "print(\"here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\")\n", - "print(\"p2=1.324*10^6 pa,v2=0.75 m^3\")\n", - "v2=0.75;##final volume of N2 in m^3\n", - "T2=(p2*v2*T1)/(p1*v1)\n", - "print(\"so now final temperature of N2(T2)in K=\"),round(T2,2)\n", - "T2=1191.6;##T2 approx. equal to 1191.6 K\n", - "m=(p1*v1)/(R_N2*1000*T1)\n", - "print(\"mass of N2(m)in kg=\"),round(m,2)\n", - "m=2.8;##m approx equal to 2.8 kg\n", - "Cv_N2=Cp_N2-R_N2\n", - "print(\"specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2=\"),round(Cv_N2)\n", - "print(\"heat added to N2,(Q_N2)in KJ\")\n", - "Q_N2=((m*Cv_N2*1000*(T2-T1))+W_N2)/1000\n", - "print(\"Q_N2=\"),round(Q_N2,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.18;pg no:88" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.18, Page:88 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\n", - "let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\n", - "initial mass of air(m1)in kg\n", - "m1= 9.29\n", - "for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\n", - "T2=in K 237.64\n", - "final mass of air left in tank(m2)in kg\n", - "m2= 2.97\n", - "writing down energy equation for unsteady flow system\n", - "(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\n", - "or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\n", - "kinetic energy available for running turbine(W)in KJ\n", - "W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", - "W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", - "amount of work available=KJ 482.67\n" - ] - } - ], - "source": [ - "#cal of amount of work available\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.18, Page:88 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\")\n", - "p1=0.5*10**6;#initial pressure of air in pa\n", - "p2=1.013*10**5;#atmospheric pressure in pa\n", - "v1=2;#initial volume of air in m^3\n", - "v2=v1;#final volume of air in m^3\n", - "T1=375;#initial temperature of air in K\n", - "Cp_air=1.003;#specific heat at consatnt pressure in KJ/kg K\n", - "Cv_air=0.716;#specific heat at consatnt volume in KJ/kg K\n", - "R_air=0.287;#gas constant in KJ/kg K\n", - "y=1.4;#expansion constant for air\n", - "print(\"let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\")\n", - "print(\"initial mass of air(m1)in kg\")\n", - "m1=(p1*v1)/(R_air*1000*T1)\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"T2=in K\"),round(T2,2)\n", - "print(\"final mass of air left in tank(m2)in kg\")\n", - "m2=(p2*v2)/(R_air*1000*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"writing down energy equation for unsteady flow system\")\n", - "print(\"(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\")\n", - "print(\"or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\")\n", - "print(\"kinetic energy available for running turbine(W)in KJ\")\n", - "print(\"W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", - "print(\"W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", - "W=((m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2)/1000\n", - "print(\"amount of work available=KJ\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.19;pg no:89" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.19, Page:89 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\n", - "using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\n", - "n1= 0.1\n", - "now n2= 0.12\n", - "for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\n", - "deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\n", - "final temperature of gas(T3)in K\n", - "T3= 409.09\n", - "using perfect gas equation for final mixture,\n", - "final pressure of gas(p3)in Mpa\n", - "p3= 750000.0\n", - "so final pressure and temperature =0.75 Mpa and 409.11 K\n" - ] - } - ], - "source": [ - "#cal of final pressure and temperature\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.19, Page:89 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\")\n", - "p1=0.5*10**6;#initial pressure of air in pa\n", - "v1=0.5;#initial volume of air in m^3\n", - "T1=(27+273);#initial temperature of air in K\n", - "p2=1*10**6;#final pressure of air in pa\n", - "v2=0.5;#final volume of air in m^3\n", - "T2=500;#final temperature of air in K\n", - "R=8314;#gas constant in J/kg K\n", - "Cv=0.716;#specific heat at constant volume in KJ/kg K\n", - "print(\"using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\")\n", - "n1=(p1*v1)/(R*T1)\n", - "print(\"n1=\"),round(n1,2)\n", - "n2=(p2*v2)/(R*T2)\n", - "print(\"now n2=\"),round(n2,2)\n", - "print(\"for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\")\n", - "deltaU=0;#change in internal energy\n", - "print(\"deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\")\n", - "print(\"final temperature of gas(T3)in K\")\n", - "T3=(deltaU+Cv*(n1*T1+n2*T2))/(Cv*(n1+n2))\n", - "print(\"T3=\"),round(T3,2)\n", - "print(\"using perfect gas equation for final mixture,\")\n", - "print(\"final pressure of gas(p3)in Mpa\")\n", - "p3=((n1+n2)*R*T3)/(v1+v2)\n", - "print(\"p3=\"),round(p3,3)\n", - "print(\"so final pressure and temperature =0.75 Mpa and 409.11 K\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.20;pg no:90" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.20, Page:90 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\n", - "printlacement work,W=p*(v1-v2)in N.m -50675.0\n", - "so heat transfer(Q)in N.m\n", - "Q=-W 50675.0\n" - ] - } - ], - "source": [ - "#cal of heat transfer\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.20, Page:90 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\")\n", - "v1=0;#initial volume of air inside bottle in m^3\n", - "v2=0.5;#final volume of air inside bottle in m^3\n", - "p=1.0135*10**5;#atmospheric pressure in pa\n", - "W=p*(v1-v2)\n", - "print(\"printlacement work,W=p*(v1-v2)in N.m\"),round(W,2)\n", - "print(\"so heat transfer(Q)in N.m\")\n", - "Q=-W\n", - "print(\"Q=-W\"),round(Q,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.21;pg no:90" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.21, Page:90 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\n", - "here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\n", - "(p2/p1)^((y-1)/y)=(T2/T1)\n", - "final temperature of air(T2)in K\n", - "T2= 113.34\n", - "by perfect gas law,initial mass in bottle(m1)in kg\n", - "m1= 11.69\n", - "final mass in bottle(m2)in kg\n", - "m2= 0.92\n", - "energy available for running turbo generator or work(W)in KJ\n", - "W+(m1-m2)*h2=m1*u1-m2*u2\n", - "W= 1325.42\n", - "this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\n", - "turbogenerator actual output(P1)=5 KJ/s\n", - "input to turbogenerator(P2)in KJ/s\n", - "time duration for which turbogenerator can be run(deltat)in seconds\n", - "deltat= 159.05\n", - "duration=160 seconds approx.\n" - ] - } - ], - "source": [ - "#cal of time duration for which turbogenerator can be run\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.21, Page:90 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\")\n", - "p1=35.*10**5;#initial pressure of air in pa\n", - "v1=0.3;#initial volume of air in m^3\n", - "T1=(313.);#initial temperature of air in K\n", - "p2=1.*10**5;#final pressure of air in pa\n", - "v2=0.3;#final volume of air in m^3\n", - "y=1.4;#expansion constant\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\")\n", - "print(\"(p2/p1)^((y-1)/y)=(T2/T1)\")\n", - "print(\"final temperature of air(T2)in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"T2=\"),round(T2,2)\n", - "print(\"by perfect gas law,initial mass in bottle(m1)in kg\")\n", - "m1=(p1*v1)/(R*1000.*T1)\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"final mass in bottle(m2)in kg\")\n", - "m2=(p2*v2)/(R*1000.*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"energy available for running turbo generator or work(W)in KJ\")\n", - "print(\"W+(m1-m2)*h2=m1*u1-m2*u2\")\n", - "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", - "print(\"W=\"),round(W,2)\n", - "print(\"this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\")\n", - "print(\"turbogenerator actual output(P1)=5 KJ/s\")\n", - "P1=5;#turbogenerator actual output in KJ/s\n", - "print(\"input to turbogenerator(P2)in KJ/s\")\n", - "P2=P1/0.6\n", - "print(\"time duration for which turbogenerator can be run(deltat)in seconds\")\n", - "deltat=W/P2\n", - "print(\"deltat=\"),round(deltat,2)\n", - "print(\"duration=160 seconds approx.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.22;pg no:91" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.22, Page:91 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\n", - "different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\n", - "process 1-2 is polytropic process with index 1.2\n", - "(T2/T1)=(p2/p1)^((n-1)/n)\n", - "final temperature of air(T2)in K\n", - "T2= 457.68\n", - "at state 1,p1*v1=m*R*T1\n", - "initial volume of air(v1)in m^3\n", - "v1= 2.01\n", - "final volume of air(v2)in m^3\n", - "for process 1-2,v2= 0.53\n", - "for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\n", - "v3=v2*T3/T2 in m^3\n", - "here process 3-1 is isothermal process so T1=T3\n", - "during process 1-2 the compression work(W1_2)in KJ\n", - "W1_2=(m*R*(T2-T1)/(1-n))\n", - "work during process 2-3(W2_3)in KJ,\n", - "W2_3=p2*(v3-v2)/1000\n", - "work during process 3-1(W3_1)in KJ\n", - "W3_1= 485.0\n", - "net work done(W_net)in KJ\n", - "W_net=W1_2+W2_3+W3_1 -71.28\n", - "net work=-71.27 KJ\n", - "here -ve workshows work done upon the system.since it is cycle,so\n", - "W_net=Q_net\n", - "phi dW=phi dQ=-71.27 KJ\n", - "heat transferred from system=71.27 KJ\n" - ] - } - ], - "source": [ - "#cal of network,heat transferred from system\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.22, Page:91 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\")\n", - "p1=1.5*10**5;#initial pressure of air in pa\n", - "T1=(77+273);#initial temperature of air in K\n", - "p2=7.5*10**5;#final pressure of air in pa\n", - "n=1.2;#expansion constant for process 1-2\n", - "R=0.287;#gas constant in KJ/kg K\n", - "m=3.;#mass of air in kg\n", - "print(\"different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\")\n", - "print(\"process 1-2 is polytropic process with index 1.2\")\n", - "print(\"(T2/T1)=(p2/p1)^((n-1)/n)\")\n", - "print(\"final temperature of air(T2)in K\")\n", - "T2=T1*((p2/p1)**((n-1)/n))\n", - "print(\"T2=\"),round(T2,2)\n", - "print(\"at state 1,p1*v1=m*R*T1\")\n", - "print(\"initial volume of air(v1)in m^3\")\n", - "v1=(m*R*1000*T1)/p1\n", - "print(\"v1=\"),round(v1,2)\n", - "print(\"final volume of air(v2)in m^3\")\n", - "v2=((p1*v1**n)/p2)**(1/n)\n", - "print(\"for process 1-2,v2=\"),round(v2,2)\n", - "print(\"for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\")\n", - "print(\"v3=v2*T3/T2 in m^3\")\n", - "print(\"here process 3-1 is isothermal process so T1=T3\")\n", - "T3=T1;#process 3-1 is isothermal\n", - "v3=v2*T3/T2\n", - "print(\"during process 1-2 the compression work(W1_2)in KJ\")\n", - "print(\"W1_2=(m*R*(T2-T1)/(1-n))\")\n", - "W1_2=(m*R*(T2-T1)/(1-n))\n", - "print(\"work during process 2-3(W2_3)in KJ,\")\n", - "print(\"W2_3=p2*(v3-v2)/1000\")\n", - "W2_3=p2*(v3-v2)/1000\n", - "print(\"work during process 3-1(W3_1)in KJ\")\n", - "p3=p2;#pressure is constant for process 2-3\n", - "W3_1=p3*v3*math.log(v1/v3)/1000\n", - "print(\"W3_1=\"),round(W3_1,2)\n", - "print(\"net work done(W_net)in KJ\")\n", - "W_net=W1_2+W2_3+W3_1\n", - "print(\"W_net=W1_2+W2_3+W3_1\"),round(W_net,2)\n", - "print(\"net work=-71.27 KJ\")\n", - "print(\"here -ve workshows work done upon the system.since it is cycle,so\")\n", - "print(\"W_net=Q_net\")\n", - "print(\"phi dW=phi dQ=-71.27 KJ\")\n", - "print(\"heat transferred from system=71.27 KJ\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.23;pg no:93" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.23, Page:93 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\n", - "initial mass of air in bottle(m1)in kg \n", - "m1= 6.97\n", - "now final temperature(T2)in K\n", - "T2= 0.0\n", - "final mass of air in bottle(m2)in kg\n", - "m2= 0.82\n", - "energy available for running of turbine due to emptying of bottle(W)in KJ\n", - "W= 639.09\n", - "work available from turbine=639.27KJ\n" - ] - } - ], - "source": [ - "#cal of work available from turbine\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.23, Page:93 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\")\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "y=1.4;#expansion constant \n", - "p1=40*10**5;#initial temperature of air in pa\n", - "v1=0.15;#initial volume of air in m^3\n", - "T1=(27+273);#initial temperature of air in K\n", - "p2=2*10**5;#final temperature of air in pa\n", - "v2=0.15;#final volume of air in m^3\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"initial mass of air in bottle(m1)in kg \")\n", - "m1=(p1*v1)/(R*1000*T1)\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"now final temperature(T2)in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"T2=\"),round(T2,2)\n", - "T2=127.36;#take T2=127.36 approx.\n", - "print(\"final mass of air in bottle(m2)in kg\")\n", - "m2=(p2*v2)/(R*1000*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "m2=0.821;#take m2=0.821 approx.\n", - "print(\"energy available for running of turbine due to emptying of bottle(W)in KJ\")\n", - "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", - "print(\"W=\"),round(W,2)\n", - "print(\"work available from turbine=639.27KJ\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter3_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter3_2.ipynb deleted file mode 100755 index 22ed40c9..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter3_2.ipynb +++ /dev/null @@ -1,1506 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 3:First Law of Thermo Dynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.1;pg no:76" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.1, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\n", - "a> work done on piston(W_piston)in KJ can be obtained as\n", - "W_piston=pdv\n", - "b> paddle work done on the system(W_paddle)=-4.88 KJ\n", - "net work done of system(W_net)in KJ\n", - "W_net=W_piston+W_paddle\n", - "so work done on system(W_net)=1.435 KJ\n" - ] - } - ], - "source": [ - "#cal of work done on system\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.1, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\")\n", - "import scipy\n", - "from scipy import integrate\n", - "\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "p=689.;#pressure of gas in cylinder in kpa\n", - "v1=0.04;#initial volume of fluid in m^3\n", - "v2=0.045;#final volume of fluid in m^3\n", - "W_paddle=-4.88;#paddle work done on the system in KJ\n", - "print(\"a> work done on piston(W_piston)in KJ can be obtained as\")\n", - "print(\"W_piston=pdv\")\n", - "#function y = f(v), y=p, endfunction\n", - "def fun1(x):\n", - "\ty=p\n", - "\treturn y\n", - "\n", - "W_piston=scipy.integrate.quad(fun1,v1,v2) \n", - "print(\"b> paddle work done on the system(W_paddle)=-4.88 KJ\")\n", - "print(\"net work done of system(W_net)in KJ\")\n", - "print(\"W_net=W_piston+W_paddle\")\n", - "print(\"so work done on system(W_net)=1.435 KJ\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.2;pg no:" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.2, Page:76 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\n", - "as the vessel is rigid therefore work done shall be zero\n", - "W=0\n", - "from first law of thermodynamics,heat required(Q)in KJ\n", - "Q=U2-U1+W=Q=m(u2-u1)+W\n", - "so heat required = 5.6\n" - ] - } - ], - "source": [ - "#cal of heat required\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.2, Page:76 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\")\n", - "m=0.5;#mass of gas in kg\n", - "u1=26.6;#internal energy of gas at 200 degree celcius\n", - "u2=37.8;#internal energy of gas at 400 degree celcius\n", - "W=0;#work done by vessel in KJ\n", - "print(\"as the vessel is rigid therefore work done shall be zero\")\n", - "print(\"W=0\")\n", - "print(\"from first law of thermodynamics,heat required(Q)in KJ\")\n", - "print(\"Q=U2-U1+W=Q=m(u2-u1)+W\")\n", - "Q=m*(u2-u1)+W\n", - "print(\"so heat required =\"),round(Q,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.3;pg no:77" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.3, Page:77 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\n", - "by steady flow energy equation\n", - "q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\n", - "let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\n", - "q=h2-h1\n", - "rate of heat removal(Q)in KJ/hr\n", - "Q=m(h2-h1)=m*Cp*(T2-T1)\n", - "heat should be removed at the rate=KJ/hr 40500.0\n" - ] - } - ], - "source": [ - "#cal of \"heat should be removed\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.3, Page:77 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\")\n", - "m=50;#rate at which carbon dioxide passing through heat exchanger in kg/hr\n", - "T2=800;#initial temperature of carbon dioxide in degree celcius\n", - "T1=50;#final temperature of carbon dioxide in degree celcius\n", - "Cp=1.08;#specific heat at constant pressure in KJ/kg K\n", - "print(\"by steady flow energy equation\")\n", - "print(\"q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\")\n", - "print(\"let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\")\n", - "print(\"q=h2-h1\")\n", - "print(\"rate of heat removal(Q)in KJ/hr\")\n", - "print(\"Q=m(h2-h1)=m*Cp*(T2-T1)\")\n", - "Q=m*Cp*(T2-T1)\n", - "print(\"heat should be removed at the rate=KJ/hr\"),round(Q)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.4;pg no:77" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "#cal of work done by surrounding on system\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.4, Page:77 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 4\")\n", - "v=0.78;#volume of cylinder in m^3\n", - "p=101.325;#atmospheric pressure in kPa\n", - "print(\"total work done by the air at atmospheric pressure of 101.325 kPa\")\n", - "print(\"W=(pdv)cylinder+(pdv)air\")\n", - "print(\"0+p*(delta v)\")\n", - "print(\"work done by air(W)=-p*v in KJ\")\n", - "W=-p*v\n", - "print(\"so work done by surrounding on system=KJ\"),round(-W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.5:pg no:77" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.5, Page:77 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\n", - "given p*v^1.3=constant\n", - "assuming expansion to be quasi-static,the work may be given as\n", - "W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\n", - "from internal energy relation,change in specific internal energy\n", - "deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\n", - "total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\n", - "using p1*V1^1.3=p2*V2^1.3\n", - "V2=in m^3 0.85\n", - "take V2=.852 m^3\n", - "so deltaU in KJ\n", - "and W in KJ 246.67\n", - "from first law\n", - "deltaQ=KJ 113.47\n", - "heat interaction=113.5 KJ\n", - "work interaction=246.7 KJ\n", - "change in internal energy=-113.2 KJ\n" - ] - } - ], - "source": [ - "#cal of heat,work interaction and change in internal energy\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.5, Page:77 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\")\n", - "m=5;#mass of gas in kg\n", - "p1=1*10**3;#initial pressure of gas in KPa\n", - "V1=0.5;#initial volume of gas in m^3\n", - "p2=0.5*10**3;#final pressure of gas in KPa\n", - "n=1.3;#expansion constant\n", - "print(\"given p*v^1.3=constant\")\n", - "print(\"assuming expansion to be quasi-static,the work may be given as\")\n", - "print(\"W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\")\n", - "print(\"from internal energy relation,change in specific internal energy\")\n", - "print(\"deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\")\n", - "print(\"total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\")\n", - "print(\"using p1*V1^1.3=p2*V2^1.3\")\n", - "V2=V1*(p1/p2)**(1/1.3)\n", - "print(\"V2=in m^3\"),round(V2,2)\n", - "print(\"take V2=.852 m^3\")\n", - "V2=0.852;#final volume of gas in m^3\n", - "print(\"so deltaU in KJ\")\n", - "deltaU=1.8*(p2*V2-p1*V1)\n", - "W=(p2*V2-p1*V1)/(1-n)\n", - "print(\"and W in KJ\"),round(W,2)\n", - "print(\"from first law\")\n", - "deltaQ=deltaU+W\n", - "print(\"deltaQ=KJ\"),round(deltaQ,2)\n", - "print(\"heat interaction=113.5 KJ\")\n", - "print(\"work interaction=246.7 KJ\")\n", - "print(\"change in internal energy=-113.2 KJ\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.6;pg no:78" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.6, Page:78 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\n", - "final state volume(v2)in m^3\n", - "v2= 0.0\n", - "take v2=0.03 m^3\n", - "now internal energy of gas is given by U=7.5*p*v-425\n", - "change in internal energy(deltaU)in KJ\n", - "deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\n", - "deltaU=7.5*10^3*(p2*v2-p1*v1) 75.0\n", - "for quasi-static process\n", - "work(W) in KJ,W=p*dv\n", - "W=(p2*v2-p1*v1)/(1-n)\n", - "from first law of thermodynamics,\n", - "heat interaction(deltaQ)=deltaU+W\n", - "heat=50 KJ\n", - "work=25 KJ(-ve)\n", - "internal energy change=75 KJ\n", - "if 180 KJ heat transfer takes place,then from 1st law,\n", - "deltaQ= 50.0\n", - "since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\n", - "W=KJ 105.0\n" - ] - } - ], - "source": [ - "#cal of heat,workinternal energy change\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.6, Page:78 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\")\n", - "p1=1;#initial pressure of gas in MPa\n", - "v1=0.05;#initial volume of gas in m^3\n", - "p2=2;#final pressure of gas in MPa\n", - "n=1.4;#expansion constant\n", - "print(\"final state volume(v2)in m^3\")\n", - "v2=((p1/p2)**(1/1.4))*v1\n", - "print(\"v2=\"),round(v2,2)\n", - "print(\"take v2=0.03 m^3\")\n", - "v2=0.03;#final volume of gas in m^3\n", - "print(\"now internal energy of gas is given by U=7.5*p*v-425\")\n", - "print(\"change in internal energy(deltaU)in KJ\")\n", - "print(\"deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\")\n", - "deltaU=7.5*10**3*(p2*v2-p1*v1)\n", - "print(\"deltaU=7.5*10^3*(p2*v2-p1*v1)\"),round(deltaU,2)\n", - "print(\"for quasi-static process\")\n", - "print(\"work(W) in KJ,W=p*dv\")\n", - "W=((p2*v2-p1*v1)/(1-n))*10**3\n", - "print(\"W=(p2*v2-p1*v1)/(1-n)\")\n", - "print(\"from first law of thermodynamics,\")\n", - "print(\"heat interaction(deltaQ)=deltaU+W\")\n", - "deltaQ=deltaU+W\n", - "print(\"heat=50 KJ\")\n", - "print(\"work=25 KJ(-ve)\")\n", - "print(\"internal energy change=75 KJ\")\n", - "print(\"if 180 KJ heat transfer takes place,then from 1st law,\")\n", - "print(\"deltaQ=\"),round(deltaQ,2)\n", - "print(\"since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\")\n", - "W=180-75\n", - "print(\"W=KJ\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.7;pg no:79" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.7, Page:79 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\n", - "characteristics gas constant(R)in J/kg K\n", - "R= 519.64\n", - "take R=0.520,KJ/kg K\n", - "Cv=inKJ/kg K 1.18\n", - "y= 1.44\n", - "for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\n", - "now,T2=in K\n", - "work(W)in KJ/kg\n", - "W= -257.78\n", - "for polytropic process,heat(Q)in KJ/K\n", - "Q= 82.02\n" - ] - } - ], - "source": [ - "#cal of work and heat\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.7, Page:79 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\")\n", - "M=16;#molecular weight of gas\n", - "p1=101.3;#initial pressure of gas in KPa\n", - "p2=600;#final pressure of gas in KPa\n", - "T1=(273+20);#initial temperature of gas in K\n", - "R1=8.3143*10**3;#universal gas constant in J/kg K\n", - "Cp=1.7;#specific heat at constant pressure in KJ/kg K\n", - "n=1.3;#expansion constant\n", - "T2=((p2/p1)**(n-1/n))\n", - "print(\"characteristics gas constant(R)in J/kg K\")\n", - "R=R1/M\n", - "print(\"R=\"),round(R,2)\n", - "print(\"take R=0.520,KJ/kg K\")\n", - "R=0.520;#characteristics gas constant in KJ/kg K\n", - "Cv=Cp-R\n", - "print(\"Cv=inKJ/kg K\"),round(Cv,2)\n", - "y=Cp/Cv\n", - "print(\"y=\"),round(y,2)\n", - "y=1.44;#ratio of specific heat at constant pressure to constant volume\n", - "print(\"for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\")\n", - "T2=T1*((p2/p1)**((n-1)/n))\n", - "print(\"now,T2=in K\")\n", - "print(\"work(W)in KJ/kg\")\n", - "W=R*((T1-T2)/(n-1))\n", - "print(\"W=\"),round(W,2)\n", - "W=257.78034;#work done in KJ/kg\n", - "print(\"for polytropic process,heat(Q)in KJ/K\")\n", - "Q=((y-n)/(y-1))*W\n", - "print(\"Q=\"),round(Q,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.8;pg no:80" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.8, Page:80 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\n", - "applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\n", - "h1+C1^2/2=h2+C2^2/2\n", - "given that C1=0,negligible inlet velocity\n", - "so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\n", - "exit velocity(C2)in m/s 1098.2\n" - ] - } - ], - "source": [ - "#cal of exit velocity\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.8, Page:80 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\")\n", - "T1=(627+273);#initial temperature of air in nozzle in K\n", - "T2=(27+273);#temperature at which air leaves nozzle in K\n", - "Cp=1.005*10**3;#specific heat at constant pressure in J/kg K\n", - "C2=math.sqrt(2*Cp*(T1-T2))\n", - "print(\"applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\")\n", - "print(\"h1+C1^2/2=h2+C2^2/2\")\n", - "print(\"given that C1=0,negligible inlet velocity\")\n", - "print(\"so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\")\n", - "print(\"exit velocity(C2)in m/s\"),round(C2,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.9;pg no:80" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.9, Page:80 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\n", - "work interaction,W=-200 KJ/kg of air\n", - "increase in enthalpy of air=100 KJ/kg of air\n", - "total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\n", - "writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\n", - "h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\n", - "assuming no change in potential energy and kinetic energy\n", - "deltaK.E=deltaP.=0\n", - "total heat interaction(Q)in KJ/kg of air\n", - "Q= -100.0\n", - "Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\n", - "so heat transferred to atmosphere(Q2)in KJ/kg of air -10.0\n" - ] - } - ], - "source": [ - "#cal of heat transferred to atmosphere\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.9, Page:80 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\")\n", - "W=-200;#shaft work in KJ/kg of air\n", - "deltah=100;#increase in enthalpy in KJ/kg of air\n", - "Q1=-90;#heat transferred to water in KJ/kg of air\n", - "print(\"work interaction,W=-200 KJ/kg of air\")\n", - "print(\"increase in enthalpy of air=100 KJ/kg of air\")\n", - "print(\"total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\")\n", - "print(\"writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\")\n", - "print(\"h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\")\n", - "print(\"assuming no change in potential energy and kinetic energy\")\n", - "print(\"deltaK.E=deltaP.=0\")\n", - "print(\"total heat interaction(Q)in KJ/kg of air\")\n", - "Q=deltah+W\n", - "print(\"Q=\"),round(Q,2)\n", - "Q2=Q-Q1\n", - "print(\"Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\")\n", - "print(\"so heat transferred to atmosphere(Q2)in KJ/kg of air\"),round(Q2,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.10;pg no:81" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.10, Page:81 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\n", - "above problem can be solved using steady flow energy equations upon hot water flow\n", - "Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\n", - "here total heat to be supplied(Q)in kcal/hr\n", - "so heat lost by water(-ve),Q=-25000 kcal/hr\n", - "there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\n", - "Q+m*(h1+g*z1)=m*(h2+g*z2)\n", - "so water circulation rate(m)in kg/hr\n", - "so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\n", - "water circulation rate=(m)in kg/min 11.91\n" - ] - } - ], - "source": [ - "#cal of water circulation rate\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.10, Page:81 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\")\n", - "n=500;#total number of persons\n", - "q=50;#heat requirement per person in kcal/hr\n", - "h1=80;#enthalpy of hot water enter in pipe in kcal/kg\n", - "h2=45;#enthalpy of hot water leaves the pipe in kcal/kg\n", - "g=9.81;#acceleartion due to gravity in m/s^2\n", - "deltaz=10;#difference in elevation of inlet and exit pipe in m\n", - "print(\"above problem can be solved using steady flow energy equations upon hot water flow\")\n", - "print(\"Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\")\n", - "print(\"here total heat to be supplied(Q)in kcal/hr\")\n", - "Q=n*q\n", - "print(\"so heat lost by water(-ve),Q=-25000 kcal/hr\")\n", - "Q=-25000#heat loss by water in kcal/hr\n", - "print(\"there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\")\n", - "print(\"Q+m*(h1+g*z1)=m*(h2+g*z2)\")\n", - "print(\"so water circulation rate(m)in kg/hr\")\n", - "print(\"so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\")\n", - "m=Q*10**3*4.18/(g*deltaz-(h1-h2)*10**3*4.18)\n", - "m=m/60\n", - "print(\"water circulation rate=(m)in kg/min\"),round(m,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.11;pg no:81" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.11, Page:81 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\n", - "let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\n", - "energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\n", - "m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\n", - "so steam suppling rate(m)in kg/s per kg of water\n", - "m= 0.124\n", - "NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\n" - ] - } - ], - "source": [ - "#cal of steam suppling rate\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.11, Page:81 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\")\n", - "v1=50;#velocity of steam entering injector in m/s\n", - "v2=25;#velocity of mixture leave injector in m/s\n", - "h1=720;#enthalpy of steam entering injector in kcal/kg\n", - "h2=24.6;#enthalpy of water entering injector in kcal/kg\n", - "h3=100;#enthalpy of steam leaving injector in kcal/kg\n", - "h4=100;#enthalpy of water leaving injector in kcal/kg\n", - "deltaz=2;#depth from axis of injector in m\n", - "q=12;#heat loss from injector to surrounding through injector\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\")\n", - "print(\"energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\")\n", - "print(\"m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\")\n", - "print(\"so steam suppling rate(m)in kg/s per kg of water\")\n", - "m=((h3*10**3*4.18+v2**2/2)-(h2*10**3*4.18+g*deltaz))/((v1**2/2+h1*10**3*4.18)-(h3*10**3*4.18+v2**2/2)-(q*10**3*4.18))\n", - "print(\"m=\"),round(m,3)\n", - "print(\"NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.12;pg no:82" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.12, Page:82 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\n", - "here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\n", - "displacement work, W=(p.dv)cylinder+(p.dv)ballon\n", - "(p.dv)cylinder=0,as cylinder is rigid\n", - "so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\n", - "and work done by atmosphere=KJ 40.52\n" - ] - } - ], - "source": [ - "#cal of work done by atmosphere\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.12, Page:82 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\")\n", - "p=1.013*10**5;#atmospheric pressure in pa\n", - "deltav=0.4;#change in volume in m^3\n", - "print(\"here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\")\n", - "print(\"displacement work, W=(p.dv)cylinder+(p.dv)ballon\")\n", - "print(\"(p.dv)cylinder=0,as cylinder is rigid\")\n", - "print(\"so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\")\n", - "W=(p*deltav)/1000\n", - "print(\"and work done by atmosphere=KJ\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.13;pg no:82" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.13, Page:82 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\n", - "work done by turbine(Wt)in J#s is 25% of heat added i.e Wt= 1250.0\n", - "heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\n", - "Qrejected= 3750.0\n", - "and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\n", - "Wp=(-) 10.0\n", - "capacity of generator(W)=in Kw 1.24\n" - ] - } - ], - "source": [ - "#cal of capacity of generator\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.13, Page:82 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\")\n", - "Qadd=5000;#heat supplied in boiler in J#s\n", - "Wt=.25*Qadd\n", - "print(\"work done by turbine(Wt)in J#s is 25% of heat added i.e\"),\n", - "print(\"Wt=\"),round(Wt,2)\n", - "print(\"heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\")\n", - "Qrejected=.75*Qadd\n", - "print(\"Qrejected=\"),round(Qrejected,2)\n", - "print(\"and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\")\n", - "Wp=0.002*Qadd\n", - "print(\"Wp=(-)\"),round(Wp,2)\n", - "W=(Wt-Wp)/1000\n", - "print(\"capacity of generator(W)=in Kw\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.14;pg no:83" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.14, Page:83 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\n", - "in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\n", - "h1+Q1_2=h2\n", - "Q1_2=h2-h1\n", - "so heat transfer to air in heat exchanger(Q1_2)in KJ\n", - "Q1_2= 726.61\n", - "in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\n", - "h2+C2^2#2=h3+C3^2/2+Wt\n", - "Wt=(h2-h3)+(C2^2-C3^2)/2\n", - "so power output from turbine(Wt)in KJ#s\n", - "Wt= 1.0\n", - "applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\n", - "h3+C=h4+C4^2/2\n", - "C4^2#2=(h3-h4)+C3^2/2\n", - "velocity at exit of nozzle(C4)in m#s\n", - "C4= 14.3\n" - ] - } - ], - "source": [ - "#cal of velocity at exit of nozzle\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.14, Page:83 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\")\n", - "T1=(27+273);##ambient temperature in K\n", - "T2=(750+273);##temperature of heated air inside heat exchanger in K\n", - "T3=(600+273);##temperature of hot air leaves turbine in K\n", - "T4=(500+273);##temperature at which air leaves nozzle in K\n", - "Cp=1.005;##specific heat at constant pressure in KJ#kg K\n", - "C2=50;##velocity of hot air enter into gas turbine in m#s\n", - "C3=60;##velocity of air leaving turbine enters a nozzle in m#s\n", - "print(\"in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\")\n", - "print(\"h1+Q1_2=h2\")\n", - "print(\"Q1_2=h2-h1\")\n", - "print(\"so heat transfer to air in heat exchanger(Q1_2)in KJ\")\n", - "Q1_2=Cp*(T2-T1)\n", - "print(\"Q1_2=\"),round(Q1_2,2)\n", - "print(\"in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\")\n", - "print(\"h2+C2^2#2=h3+C3^2/2+Wt\")\n", - "print(\"Wt=(h2-h3)+(C2^2-C3^2)/2\")\n", - "print(\"so power output from turbine(Wt)in KJ#s\")\n", - "Wt=Cp*(T2-T3)+(C2**2-C3**2)*10**-3/2\n", - "print(\"Wt=\"),round(Cp,2)\n", - "print(\"applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\")\n", - "print(\"h3+C=h4+C4^2/2\")\n", - "print(\"C4^2#2=(h3-h4)+C3^2/2\")\n", - "print(\"velocity at exit of nozzle(C4)in m#s\")\n", - "C4=math.sqrt(2*(Cp*(T3-T4)+C3**2*10**-3/2))\n", - "print(\"C4=\"),round(C4,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.15;pg no:85" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.15, Page:85 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\n", - "for constant pressure heating,say state changes from 1 to 2\n", - "Wa=p1*dv\n", - "Wa=p1*(v2-v1)\n", - "it is given that v2=2v1\n", - "so Wa=p1*v1=R*T1\n", - "for subsequent expansion at constant temperature say state from 2 to 3\n", - "also given that v3/v1=6,v3/v2=3\n", - "so work=Wb=p*dv\n", - "on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\n", - "temperature at 2 can be given by perfect gas consideration as,\n", - "T2/T1=v2/v1\n", - "or T2=2*T1\n", - "now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\n", - "so W in KJ= 10632.69\n" - ] - } - ], - "source": [ - "#cal of total work done by ai\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.15, Page:85 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\")\n", - "T1=400;##initial temperature of gas in K\n", - "R=8.314;##gas constant in \n", - "print(\"for constant pressure heating,say state changes from 1 to 2\")\n", - "print(\"Wa=p1*dv\")\n", - "print(\"Wa=p1*(v2-v1)\")\n", - "print(\"it is given that v2=2v1\")\n", - "print(\"so Wa=p1*v1=R*T1\")\n", - "print(\"for subsequent expansion at constant temperature say state from 2 to 3\")\n", - "print(\"also given that v3/v1=6,v3/v2=3\")\n", - "print(\"so work=Wb=p*dv\")\n", - "print(\"on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\")\n", - "print(\"temperature at 2 can be given by perfect gas consideration as,\")\n", - "print(\"T2/T1=v2/v1\")\n", - "print(\"or T2=2*T1\")\n", - "print(\"now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\")\n", - "W=R*T1+2*R*T1*math.log(3)\n", - "print(\"so W in KJ=\"),round(W,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.16;pg no:85" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.16, Page:85 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\n", - "NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \n", - "we get W=(Vf-Vi)*((Pi+Pf)/2)\n", - "also final volume of gas in m^3 is Vf=3*Vi\n", - "now work done by gas(W)in J 750000.0\n" - ] - } - ], - "source": [ - "#cal of work done by gas\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.16, Page:85 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\")\n", - "Pi=0.5*10**6;##initial pressure of gas in pa\n", - "Vi=0.5;##initial volume of gas in m^3\n", - "Pf=1*10**6;##final pressure of gas in pa\n", - "print(\"NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \")\n", - "print(\"we get W=(Vf-Vi)*((Pi+Pf)/2)\")\n", - "print(\"also final volume of gas in m^3 is Vf=3*Vi\") \n", - "Vf=3*Vi\n", - "W=(Vf-Vi)*((Pi+Pf)/2)\n", - "print(\"now work done by gas(W)in J\"),round(W,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.17;pg no:87" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.17, Page:87 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\n", - "with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\n", - "adiabatic index of compression of H2 can be obtained as,\n", - "Cp_H2=\n", - "y_H2=Cp_H2/(Cp_H2-R_H2) 1.4\n", - "adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\n", - "y_N2= 1.4\n", - "i>for hydrogen,p1*v1^y=p2*v2^y\n", - "so final pressure of H2(p2)in pa\n", - "p2= 1324078.55\n", - "ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \n", - "partition work=0\n", - "iii>work done upon H2(W_H2)in J,\n", - "W_H2= -200054.06\n", - "work done upon H2(W_H2)=-2*10^5 J\n", - "so work done by N2(W_N2)=2*10^5 J \n", - "iv>heat added to N2 can be obtained using first law of thermodynamics as\n", - "Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\n", - "final temperature of N2 can be obtained considering it as perfect gas\n", - "therefore, T2=(p2*v2*T1)#(p1*v1)\n", - "here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\n", - "p2=1.324*10^6 pa,v2=0.75 m^3\n", - "so now final temperature of N2(T2)in K= 1191.67\n", - "mass of N2(m)in kg= 2.81\n", - "specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2= 1.0\n", - "heat added to N2,(Q_N2)in KJ\n", - "Q_N2= 2052.89\n" - ] - } - ], - "source": [ - "#cal of \n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.17, Page:87 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\")\n", - "Cp_H2=14.307;##specific heat of H2 at constant pressure in KJ#kg K\n", - "R_H2=4.1240;##gas constant for H2 in KJ#kg K\n", - "Cp_N2=1.039;##specific heat of N2 at constant pressure in KJ#kg K\n", - "R_N2=0.2968;##gas constant for N2 in KJ#kg K\n", - "T1=(27+273);##ambient temperature in K\n", - "v1=0.5;##initial volume of H2 in m^3\n", - "p1=0.5*10**6;##initial pressure of H2 in pa \n", - "v2=0.25;##final volume of H2 in m^3 \n", - "p2=1.324*10**6;##final pressure of H2 in pa\n", - "print(\"with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\")\n", - "print(\"adiabatic index of compression of H2 can be obtained as,\")\n", - "print(\"Cp_H2=\")\n", - "y_H2=Cp_H2/(Cp_H2-R_H2)\n", - "print(\"y_H2=Cp_H2/(Cp_H2-R_H2)\"),round(y_H2,2)\n", - "print(\"adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\")\n", - "y_N2=Cp_N2/(Cp_N2-R_N2)\n", - "print(\"y_N2=\"),round(y_N2,2)\n", - "print(\"i>for hydrogen,p1*v1^y=p2*v2^y\")\n", - "print(\"so final pressure of H2(p2)in pa\")\n", - "p2=p1*(v1/v2)**y_H2\n", - "print(\"p2=\"),round(p2,2)\n", - "print(\"ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \")\n", - "print(\"partition work=0\")\n", - "print(\"iii>work done upon H2(W_H2)in J,\")\n", - "W_H2=(p1*v1-p2*v2)/(y_H2-1)\n", - "print(\"W_H2=\"),round(W_H2,2)\n", - "print(\"work done upon H2(W_H2)=-2*10^5 J\")\n", - "W_N2=2*10**5;##work done by N2 in J\n", - "print(\"so work done by N2(W_N2)=2*10^5 J \")\n", - "print(\"iv>heat added to N2 can be obtained using first law of thermodynamics as\")\n", - "print(\"Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\")\n", - "print(\"final temperature of N2 can be obtained considering it as perfect gas\")\n", - "print(\"therefore, T2=(p2*v2*T1)#(p1*v1)\")\n", - "print(\"here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\")\n", - "print(\"p2=1.324*10^6 pa,v2=0.75 m^3\")\n", - "v2=0.75;##final volume of N2 in m^3\n", - "T2=(p2*v2*T1)/(p1*v1)\n", - "print(\"so now final temperature of N2(T2)in K=\"),round(T2,2)\n", - "T2=1191.6;##T2 approx. equal to 1191.6 K\n", - "m=(p1*v1)/(R_N2*1000*T1)\n", - "print(\"mass of N2(m)in kg=\"),round(m,2)\n", - "m=2.8;##m approx equal to 2.8 kg\n", - "Cv_N2=Cp_N2-R_N2\n", - "print(\"specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2=\"),round(Cv_N2)\n", - "print(\"heat added to N2,(Q_N2)in KJ\")\n", - "Q_N2=((m*Cv_N2*1000*(T2-T1))+W_N2)/1000\n", - "print(\"Q_N2=\"),round(Q_N2,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.18;pg no:88" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.18, Page:88 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\n", - "let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\n", - "initial mass of air(m1)in kg\n", - "m1= 9.29\n", - "for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\n", - "T2=in K 237.64\n", - "final mass of air left in tank(m2)in kg\n", - "m2= 2.97\n", - "writing down energy equation for unsteady flow system\n", - "(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\n", - "or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\n", - "kinetic energy available for running turbine(W)in KJ\n", - "W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", - "W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", - "amount of work available=KJ 482.67\n" - ] - } - ], - "source": [ - "#cal of amount of work available\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.18, Page:88 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\")\n", - "p1=0.5*10**6;#initial pressure of air in pa\n", - "p2=1.013*10**5;#atmospheric pressure in pa\n", - "v1=2;#initial volume of air in m^3\n", - "v2=v1;#final volume of air in m^3\n", - "T1=375;#initial temperature of air in K\n", - "Cp_air=1.003;#specific heat at consatnt pressure in KJ/kg K\n", - "Cv_air=0.716;#specific heat at consatnt volume in KJ/kg K\n", - "R_air=0.287;#gas constant in KJ/kg K\n", - "y=1.4;#expansion constant for air\n", - "print(\"let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\")\n", - "print(\"initial mass of air(m1)in kg\")\n", - "m1=(p1*v1)/(R_air*1000*T1)\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"T2=in K\"),round(T2,2)\n", - "print(\"final mass of air left in tank(m2)in kg\")\n", - "m2=(p2*v2)/(R_air*1000*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"writing down energy equation for unsteady flow system\")\n", - "print(\"(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\")\n", - "print(\"or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\")\n", - "print(\"kinetic energy available for running turbine(W)in KJ\")\n", - "print(\"W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", - "print(\"W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", - "W=((m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2)/1000\n", - "print(\"amount of work available=KJ\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.19;pg no:89" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.19, Page:89 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\n", - "using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\n", - "n1= 0.1\n", - "now n2= 0.12\n", - "for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\n", - "deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\n", - "final temperature of gas(T3)in K\n", - "T3= 409.09\n", - "using perfect gas equation for final mixture,\n", - "final pressure of gas(p3)in Mpa\n", - "p3= 750000.0\n", - "so final pressure and temperature =0.75 Mpa and 409.11 K\n" - ] - } - ], - "source": [ - "#cal of final pressure and temperature\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.19, Page:89 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\")\n", - "p1=0.5*10**6;#initial pressure of air in pa\n", - "v1=0.5;#initial volume of air in m^3\n", - "T1=(27+273);#initial temperature of air in K\n", - "p2=1*10**6;#final pressure of air in pa\n", - "v2=0.5;#final volume of air in m^3\n", - "T2=500;#final temperature of air in K\n", - "R=8314;#gas constant in J/kg K\n", - "Cv=0.716;#specific heat at constant volume in KJ/kg K\n", - "print(\"using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\")\n", - "n1=(p1*v1)/(R*T1)\n", - "print(\"n1=\"),round(n1,2)\n", - "n2=(p2*v2)/(R*T2)\n", - "print(\"now n2=\"),round(n2,2)\n", - "print(\"for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\")\n", - "deltaU=0;#change in internal energy\n", - "print(\"deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\")\n", - "print(\"final temperature of gas(T3)in K\")\n", - "T3=(deltaU+Cv*(n1*T1+n2*T2))/(Cv*(n1+n2))\n", - "print(\"T3=\"),round(T3,2)\n", - "print(\"using perfect gas equation for final mixture,\")\n", - "print(\"final pressure of gas(p3)in Mpa\")\n", - "p3=((n1+n2)*R*T3)/(v1+v2)\n", - "print(\"p3=\"),round(p3,3)\n", - "print(\"so final pressure and temperature =0.75 Mpa and 409.11 K\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.20;pg no:90" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.20, Page:90 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\n", - "printlacement work,W=p*(v1-v2)in N.m -50675.0\n", - "so heat transfer(Q)in N.m\n", - "Q=-W 50675.0\n" - ] - } - ], - "source": [ - "#cal of heat transfer\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.20, Page:90 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\")\n", - "v1=0;#initial volume of air inside bottle in m^3\n", - "v2=0.5;#final volume of air inside bottle in m^3\n", - "p=1.0135*10**5;#atmospheric pressure in pa\n", - "W=p*(v1-v2)\n", - "print(\"printlacement work,W=p*(v1-v2)in N.m\"),round(W,2)\n", - "print(\"so heat transfer(Q)in N.m\")\n", - "Q=-W\n", - "print(\"Q=-W\"),round(Q,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.21;pg no:90" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.21, Page:90 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\n", - "here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\n", - "(p2/p1)^((y-1)/y)=(T2/T1)\n", - "final temperature of air(T2)in K\n", - "T2= 113.34\n", - "by perfect gas law,initial mass in bottle(m1)in kg\n", - "m1= 11.69\n", - "final mass in bottle(m2)in kg\n", - "m2= 0.92\n", - "energy available for running turbo generator or work(W)in KJ\n", - "W+(m1-m2)*h2=m1*u1-m2*u2\n", - "W= 1325.42\n", - "this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\n", - "turbogenerator actual output(P1)=5 KJ/s\n", - "input to turbogenerator(P2)in KJ/s\n", - "time duration for which turbogenerator can be run(deltat)in seconds\n", - "deltat= 159.05\n", - "duration=160 seconds approx.\n" - ] - } - ], - "source": [ - "#cal of time duration for which turbogenerator can be run\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.21, Page:90 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\")\n", - "p1=35.*10**5;#initial pressure of air in pa\n", - "v1=0.3;#initial volume of air in m^3\n", - "T1=(313.);#initial temperature of air in K\n", - "p2=1.*10**5;#final pressure of air in pa\n", - "v2=0.3;#final volume of air in m^3\n", - "y=1.4;#expansion constant\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\")\n", - "print(\"(p2/p1)^((y-1)/y)=(T2/T1)\")\n", - "print(\"final temperature of air(T2)in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"T2=\"),round(T2,2)\n", - "print(\"by perfect gas law,initial mass in bottle(m1)in kg\")\n", - "m1=(p1*v1)/(R*1000.*T1)\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"final mass in bottle(m2)in kg\")\n", - "m2=(p2*v2)/(R*1000.*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"energy available for running turbo generator or work(W)in KJ\")\n", - "print(\"W+(m1-m2)*h2=m1*u1-m2*u2\")\n", - "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", - "print(\"W=\"),round(W,2)\n", - "print(\"this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\")\n", - "print(\"turbogenerator actual output(P1)=5 KJ/s\")\n", - "P1=5;#turbogenerator actual output in KJ/s\n", - "print(\"input to turbogenerator(P2)in KJ/s\")\n", - "P2=P1/0.6\n", - "print(\"time duration for which turbogenerator can be run(deltat)in seconds\")\n", - "deltat=W/P2\n", - "print(\"deltat=\"),round(deltat,2)\n", - "print(\"duration=160 seconds approx.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.22;pg no:91" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.22, Page:91 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\n", - "different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\n", - "process 1-2 is polytropic process with index 1.2\n", - "(T2/T1)=(p2/p1)^((n-1)/n)\n", - "final temperature of air(T2)in K\n", - "T2= 457.68\n", - "at state 1,p1*v1=m*R*T1\n", - "initial volume of air(v1)in m^3\n", - "v1= 2.01\n", - "final volume of air(v2)in m^3\n", - "for process 1-2,v2= 0.53\n", - "for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\n", - "v3=v2*T3/T2 in m^3\n", - "here process 3-1 is isothermal process so T1=T3\n", - "during process 1-2 the compression work(W1_2)in KJ\n", - "W1_2=(m*R*(T2-T1)/(1-n))\n", - "work during process 2-3(W2_3)in KJ,\n", - "W2_3=p2*(v3-v2)/1000\n", - "work during process 3-1(W3_1)in KJ\n", - "W3_1= 485.0\n", - "net work done(W_net)in KJ\n", - "W_net=W1_2+W2_3+W3_1 -71.28\n", - "net work=-71.27 KJ\n", - "here -ve workshows work done upon the system.since it is cycle,so\n", - "W_net=Q_net\n", - "phi dW=phi dQ=-71.27 KJ\n", - "heat transferred from system=71.27 KJ\n" - ] - } - ], - "source": [ - "#cal of network,heat transferred from system\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.22, Page:91 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\")\n", - "p1=1.5*10**5;#initial pressure of air in pa\n", - "T1=(77+273);#initial temperature of air in K\n", - "p2=7.5*10**5;#final pressure of air in pa\n", - "n=1.2;#expansion constant for process 1-2\n", - "R=0.287;#gas constant in KJ/kg K\n", - "m=3.;#mass of air in kg\n", - "print(\"different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\")\n", - "print(\"process 1-2 is polytropic process with index 1.2\")\n", - "print(\"(T2/T1)=(p2/p1)^((n-1)/n)\")\n", - "print(\"final temperature of air(T2)in K\")\n", - "T2=T1*((p2/p1)**((n-1)/n))\n", - "print(\"T2=\"),round(T2,2)\n", - "print(\"at state 1,p1*v1=m*R*T1\")\n", - "print(\"initial volume of air(v1)in m^3\")\n", - "v1=(m*R*1000*T1)/p1\n", - "print(\"v1=\"),round(v1,2)\n", - "print(\"final volume of air(v2)in m^3\")\n", - "v2=((p1*v1**n)/p2)**(1/n)\n", - "print(\"for process 1-2,v2=\"),round(v2,2)\n", - "print(\"for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\")\n", - "print(\"v3=v2*T3/T2 in m^3\")\n", - "print(\"here process 3-1 is isothermal process so T1=T3\")\n", - "T3=T1;#process 3-1 is isothermal\n", - "v3=v2*T3/T2\n", - "print(\"during process 1-2 the compression work(W1_2)in KJ\")\n", - "print(\"W1_2=(m*R*(T2-T1)/(1-n))\")\n", - "W1_2=(m*R*(T2-T1)/(1-n))\n", - "print(\"work during process 2-3(W2_3)in KJ,\")\n", - "print(\"W2_3=p2*(v3-v2)/1000\")\n", - "W2_3=p2*(v3-v2)/1000\n", - "print(\"work during process 3-1(W3_1)in KJ\")\n", - "p3=p2;#pressure is constant for process 2-3\n", - "W3_1=p3*v3*math.log(v1/v3)/1000\n", - "print(\"W3_1=\"),round(W3_1,2)\n", - "print(\"net work done(W_net)in KJ\")\n", - "W_net=W1_2+W2_3+W3_1\n", - "print(\"W_net=W1_2+W2_3+W3_1\"),round(W_net,2)\n", - "print(\"net work=-71.27 KJ\")\n", - "print(\"here -ve workshows work done upon the system.since it is cycle,so\")\n", - "print(\"W_net=Q_net\")\n", - "print(\"phi dW=phi dQ=-71.27 KJ\")\n", - "print(\"heat transferred from system=71.27 KJ\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.23;pg no:93" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.23, Page:93 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\n", - "initial mass of air in bottle(m1)in kg \n", - "m1= 6.97\n", - "now final temperature(T2)in K\n", - "T2= 0.0\n", - "final mass of air in bottle(m2)in kg\n", - "m2= 0.82\n", - "energy available for running of turbine due to emptying of bottle(W)in KJ\n", - "W= 639.09\n", - "work available from turbine=639.27KJ\n" - ] - } - ], - "source": [ - "#cal of work available from turbine\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.23, Page:93 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\")\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "y=1.4;#expansion constant \n", - "p1=40*10**5;#initial temperature of air in pa\n", - "v1=0.15;#initial volume of air in m^3\n", - "T1=(27+273);#initial temperature of air in K\n", - "p2=2*10**5;#final temperature of air in pa\n", - "v2=0.15;#final volume of air in m^3\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"initial mass of air in bottle(m1)in kg \")\n", - "m1=(p1*v1)/(R*1000*T1)\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"now final temperature(T2)in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"T2=\"),round(T2,2)\n", - "T2=127.36;#take T2=127.36 approx.\n", - "print(\"final mass of air in bottle(m2)in kg\")\n", - "m2=(p2*v2)/(R*1000*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "m2=0.821;#take m2=0.821 approx.\n", - "print(\"energy available for running of turbine due to emptying of bottle(W)in KJ\")\n", - "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", - "print(\"W=\"),round(W,2)\n", - "print(\"work available from turbine=639.27KJ\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter3_3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter3_3.ipynb deleted file mode 100755 index 22ed40c9..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter3_3.ipynb +++ /dev/null @@ -1,1506 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 3:First Law of Thermo Dynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.1;pg no:76" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.1, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\n", - "a> work done on piston(W_piston)in KJ can be obtained as\n", - "W_piston=pdv\n", - "b> paddle work done on the system(W_paddle)=-4.88 KJ\n", - "net work done of system(W_net)in KJ\n", - "W_net=W_piston+W_paddle\n", - "so work done on system(W_net)=1.435 KJ\n" - ] - } - ], - "source": [ - "#cal of work done on system\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.1, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\")\n", - "import scipy\n", - "from scipy import integrate\n", - "\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "p=689.;#pressure of gas in cylinder in kpa\n", - "v1=0.04;#initial volume of fluid in m^3\n", - "v2=0.045;#final volume of fluid in m^3\n", - "W_paddle=-4.88;#paddle work done on the system in KJ\n", - "print(\"a> work done on piston(W_piston)in KJ can be obtained as\")\n", - "print(\"W_piston=pdv\")\n", - "#function y = f(v), y=p, endfunction\n", - "def fun1(x):\n", - "\ty=p\n", - "\treturn y\n", - "\n", - "W_piston=scipy.integrate.quad(fun1,v1,v2) \n", - "print(\"b> paddle work done on the system(W_paddle)=-4.88 KJ\")\n", - "print(\"net work done of system(W_net)in KJ\")\n", - "print(\"W_net=W_piston+W_paddle\")\n", - "print(\"so work done on system(W_net)=1.435 KJ\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.2;pg no:" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.2, Page:76 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\n", - "as the vessel is rigid therefore work done shall be zero\n", - "W=0\n", - "from first law of thermodynamics,heat required(Q)in KJ\n", - "Q=U2-U1+W=Q=m(u2-u1)+W\n", - "so heat required = 5.6\n" - ] - } - ], - "source": [ - "#cal of heat required\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.2, Page:76 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\")\n", - "m=0.5;#mass of gas in kg\n", - "u1=26.6;#internal energy of gas at 200 degree celcius\n", - "u2=37.8;#internal energy of gas at 400 degree celcius\n", - "W=0;#work done by vessel in KJ\n", - "print(\"as the vessel is rigid therefore work done shall be zero\")\n", - "print(\"W=0\")\n", - "print(\"from first law of thermodynamics,heat required(Q)in KJ\")\n", - "print(\"Q=U2-U1+W=Q=m(u2-u1)+W\")\n", - "Q=m*(u2-u1)+W\n", - "print(\"so heat required =\"),round(Q,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.3;pg no:77" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.3, Page:77 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\n", - "by steady flow energy equation\n", - "q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\n", - "let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\n", - "q=h2-h1\n", - "rate of heat removal(Q)in KJ/hr\n", - "Q=m(h2-h1)=m*Cp*(T2-T1)\n", - "heat should be removed at the rate=KJ/hr 40500.0\n" - ] - } - ], - "source": [ - "#cal of \"heat should be removed\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.3, Page:77 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\")\n", - "m=50;#rate at which carbon dioxide passing through heat exchanger in kg/hr\n", - "T2=800;#initial temperature of carbon dioxide in degree celcius\n", - "T1=50;#final temperature of carbon dioxide in degree celcius\n", - "Cp=1.08;#specific heat at constant pressure in KJ/kg K\n", - "print(\"by steady flow energy equation\")\n", - "print(\"q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\")\n", - "print(\"let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\")\n", - "print(\"q=h2-h1\")\n", - "print(\"rate of heat removal(Q)in KJ/hr\")\n", - "print(\"Q=m(h2-h1)=m*Cp*(T2-T1)\")\n", - "Q=m*Cp*(T2-T1)\n", - "print(\"heat should be removed at the rate=KJ/hr\"),round(Q)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.4;pg no:77" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "#cal of work done by surrounding on system\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.4, Page:77 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 4\")\n", - "v=0.78;#volume of cylinder in m^3\n", - "p=101.325;#atmospheric pressure in kPa\n", - "print(\"total work done by the air at atmospheric pressure of 101.325 kPa\")\n", - "print(\"W=(pdv)cylinder+(pdv)air\")\n", - "print(\"0+p*(delta v)\")\n", - "print(\"work done by air(W)=-p*v in KJ\")\n", - "W=-p*v\n", - "print(\"so work done by surrounding on system=KJ\"),round(-W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.5:pg no:77" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.5, Page:77 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\n", - "given p*v^1.3=constant\n", - "assuming expansion to be quasi-static,the work may be given as\n", - "W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\n", - "from internal energy relation,change in specific internal energy\n", - "deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\n", - "total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\n", - "using p1*V1^1.3=p2*V2^1.3\n", - "V2=in m^3 0.85\n", - "take V2=.852 m^3\n", - "so deltaU in KJ\n", - "and W in KJ 246.67\n", - "from first law\n", - "deltaQ=KJ 113.47\n", - "heat interaction=113.5 KJ\n", - "work interaction=246.7 KJ\n", - "change in internal energy=-113.2 KJ\n" - ] - } - ], - "source": [ - "#cal of heat,work interaction and change in internal energy\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.5, Page:77 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\")\n", - "m=5;#mass of gas in kg\n", - "p1=1*10**3;#initial pressure of gas in KPa\n", - "V1=0.5;#initial volume of gas in m^3\n", - "p2=0.5*10**3;#final pressure of gas in KPa\n", - "n=1.3;#expansion constant\n", - "print(\"given p*v^1.3=constant\")\n", - "print(\"assuming expansion to be quasi-static,the work may be given as\")\n", - "print(\"W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\")\n", - "print(\"from internal energy relation,change in specific internal energy\")\n", - "print(\"deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\")\n", - "print(\"total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\")\n", - "print(\"using p1*V1^1.3=p2*V2^1.3\")\n", - "V2=V1*(p1/p2)**(1/1.3)\n", - "print(\"V2=in m^3\"),round(V2,2)\n", - "print(\"take V2=.852 m^3\")\n", - "V2=0.852;#final volume of gas in m^3\n", - "print(\"so deltaU in KJ\")\n", - "deltaU=1.8*(p2*V2-p1*V1)\n", - "W=(p2*V2-p1*V1)/(1-n)\n", - "print(\"and W in KJ\"),round(W,2)\n", - "print(\"from first law\")\n", - "deltaQ=deltaU+W\n", - "print(\"deltaQ=KJ\"),round(deltaQ,2)\n", - "print(\"heat interaction=113.5 KJ\")\n", - "print(\"work interaction=246.7 KJ\")\n", - "print(\"change in internal energy=-113.2 KJ\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.6;pg no:78" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.6, Page:78 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\n", - "final state volume(v2)in m^3\n", - "v2= 0.0\n", - "take v2=0.03 m^3\n", - "now internal energy of gas is given by U=7.5*p*v-425\n", - "change in internal energy(deltaU)in KJ\n", - "deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\n", - "deltaU=7.5*10^3*(p2*v2-p1*v1) 75.0\n", - "for quasi-static process\n", - "work(W) in KJ,W=p*dv\n", - "W=(p2*v2-p1*v1)/(1-n)\n", - "from first law of thermodynamics,\n", - "heat interaction(deltaQ)=deltaU+W\n", - "heat=50 KJ\n", - "work=25 KJ(-ve)\n", - "internal energy change=75 KJ\n", - "if 180 KJ heat transfer takes place,then from 1st law,\n", - "deltaQ= 50.0\n", - "since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\n", - "W=KJ 105.0\n" - ] - } - ], - "source": [ - "#cal of heat,workinternal energy change\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.6, Page:78 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\")\n", - "p1=1;#initial pressure of gas in MPa\n", - "v1=0.05;#initial volume of gas in m^3\n", - "p2=2;#final pressure of gas in MPa\n", - "n=1.4;#expansion constant\n", - "print(\"final state volume(v2)in m^3\")\n", - "v2=((p1/p2)**(1/1.4))*v1\n", - "print(\"v2=\"),round(v2,2)\n", - "print(\"take v2=0.03 m^3\")\n", - "v2=0.03;#final volume of gas in m^3\n", - "print(\"now internal energy of gas is given by U=7.5*p*v-425\")\n", - "print(\"change in internal energy(deltaU)in KJ\")\n", - "print(\"deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\")\n", - "deltaU=7.5*10**3*(p2*v2-p1*v1)\n", - "print(\"deltaU=7.5*10^3*(p2*v2-p1*v1)\"),round(deltaU,2)\n", - "print(\"for quasi-static process\")\n", - "print(\"work(W) in KJ,W=p*dv\")\n", - "W=((p2*v2-p1*v1)/(1-n))*10**3\n", - "print(\"W=(p2*v2-p1*v1)/(1-n)\")\n", - "print(\"from first law of thermodynamics,\")\n", - "print(\"heat interaction(deltaQ)=deltaU+W\")\n", - "deltaQ=deltaU+W\n", - "print(\"heat=50 KJ\")\n", - "print(\"work=25 KJ(-ve)\")\n", - "print(\"internal energy change=75 KJ\")\n", - "print(\"if 180 KJ heat transfer takes place,then from 1st law,\")\n", - "print(\"deltaQ=\"),round(deltaQ,2)\n", - "print(\"since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\")\n", - "W=180-75\n", - "print(\"W=KJ\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.7;pg no:79" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.7, Page:79 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\n", - "characteristics gas constant(R)in J/kg K\n", - "R= 519.64\n", - "take R=0.520,KJ/kg K\n", - "Cv=inKJ/kg K 1.18\n", - "y= 1.44\n", - "for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\n", - "now,T2=in K\n", - "work(W)in KJ/kg\n", - "W= -257.78\n", - "for polytropic process,heat(Q)in KJ/K\n", - "Q= 82.02\n" - ] - } - ], - "source": [ - "#cal of work and heat\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.7, Page:79 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\")\n", - "M=16;#molecular weight of gas\n", - "p1=101.3;#initial pressure of gas in KPa\n", - "p2=600;#final pressure of gas in KPa\n", - "T1=(273+20);#initial temperature of gas in K\n", - "R1=8.3143*10**3;#universal gas constant in J/kg K\n", - "Cp=1.7;#specific heat at constant pressure in KJ/kg K\n", - "n=1.3;#expansion constant\n", - "T2=((p2/p1)**(n-1/n))\n", - "print(\"characteristics gas constant(R)in J/kg K\")\n", - "R=R1/M\n", - "print(\"R=\"),round(R,2)\n", - "print(\"take R=0.520,KJ/kg K\")\n", - "R=0.520;#characteristics gas constant in KJ/kg K\n", - "Cv=Cp-R\n", - "print(\"Cv=inKJ/kg K\"),round(Cv,2)\n", - "y=Cp/Cv\n", - "print(\"y=\"),round(y,2)\n", - "y=1.44;#ratio of specific heat at constant pressure to constant volume\n", - "print(\"for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\")\n", - "T2=T1*((p2/p1)**((n-1)/n))\n", - "print(\"now,T2=in K\")\n", - "print(\"work(W)in KJ/kg\")\n", - "W=R*((T1-T2)/(n-1))\n", - "print(\"W=\"),round(W,2)\n", - "W=257.78034;#work done in KJ/kg\n", - "print(\"for polytropic process,heat(Q)in KJ/K\")\n", - "Q=((y-n)/(y-1))*W\n", - "print(\"Q=\"),round(Q,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.8;pg no:80" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.8, Page:80 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\n", - "applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\n", - "h1+C1^2/2=h2+C2^2/2\n", - "given that C1=0,negligible inlet velocity\n", - "so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\n", - "exit velocity(C2)in m/s 1098.2\n" - ] - } - ], - "source": [ - "#cal of exit velocity\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.8, Page:80 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\")\n", - "T1=(627+273);#initial temperature of air in nozzle in K\n", - "T2=(27+273);#temperature at which air leaves nozzle in K\n", - "Cp=1.005*10**3;#specific heat at constant pressure in J/kg K\n", - "C2=math.sqrt(2*Cp*(T1-T2))\n", - "print(\"applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\")\n", - "print(\"h1+C1^2/2=h2+C2^2/2\")\n", - "print(\"given that C1=0,negligible inlet velocity\")\n", - "print(\"so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\")\n", - "print(\"exit velocity(C2)in m/s\"),round(C2,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.9;pg no:80" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.9, Page:80 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\n", - "work interaction,W=-200 KJ/kg of air\n", - "increase in enthalpy of air=100 KJ/kg of air\n", - "total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\n", - "writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\n", - "h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\n", - "assuming no change in potential energy and kinetic energy\n", - "deltaK.E=deltaP.=0\n", - "total heat interaction(Q)in KJ/kg of air\n", - "Q= -100.0\n", - "Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\n", - "so heat transferred to atmosphere(Q2)in KJ/kg of air -10.0\n" - ] - } - ], - "source": [ - "#cal of heat transferred to atmosphere\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.9, Page:80 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\")\n", - "W=-200;#shaft work in KJ/kg of air\n", - "deltah=100;#increase in enthalpy in KJ/kg of air\n", - "Q1=-90;#heat transferred to water in KJ/kg of air\n", - "print(\"work interaction,W=-200 KJ/kg of air\")\n", - "print(\"increase in enthalpy of air=100 KJ/kg of air\")\n", - "print(\"total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\")\n", - "print(\"writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\")\n", - "print(\"h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\")\n", - "print(\"assuming no change in potential energy and kinetic energy\")\n", - "print(\"deltaK.E=deltaP.=0\")\n", - "print(\"total heat interaction(Q)in KJ/kg of air\")\n", - "Q=deltah+W\n", - "print(\"Q=\"),round(Q,2)\n", - "Q2=Q-Q1\n", - "print(\"Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\")\n", - "print(\"so heat transferred to atmosphere(Q2)in KJ/kg of air\"),round(Q2,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.10;pg no:81" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.10, Page:81 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\n", - "above problem can be solved using steady flow energy equations upon hot water flow\n", - "Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\n", - "here total heat to be supplied(Q)in kcal/hr\n", - "so heat lost by water(-ve),Q=-25000 kcal/hr\n", - "there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\n", - "Q+m*(h1+g*z1)=m*(h2+g*z2)\n", - "so water circulation rate(m)in kg/hr\n", - "so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\n", - "water circulation rate=(m)in kg/min 11.91\n" - ] - } - ], - "source": [ - "#cal of water circulation rate\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.10, Page:81 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\")\n", - "n=500;#total number of persons\n", - "q=50;#heat requirement per person in kcal/hr\n", - "h1=80;#enthalpy of hot water enter in pipe in kcal/kg\n", - "h2=45;#enthalpy of hot water leaves the pipe in kcal/kg\n", - "g=9.81;#acceleartion due to gravity in m/s^2\n", - "deltaz=10;#difference in elevation of inlet and exit pipe in m\n", - "print(\"above problem can be solved using steady flow energy equations upon hot water flow\")\n", - "print(\"Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\")\n", - "print(\"here total heat to be supplied(Q)in kcal/hr\")\n", - "Q=n*q\n", - "print(\"so heat lost by water(-ve),Q=-25000 kcal/hr\")\n", - "Q=-25000#heat loss by water in kcal/hr\n", - "print(\"there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\")\n", - "print(\"Q+m*(h1+g*z1)=m*(h2+g*z2)\")\n", - "print(\"so water circulation rate(m)in kg/hr\")\n", - "print(\"so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\")\n", - "m=Q*10**3*4.18/(g*deltaz-(h1-h2)*10**3*4.18)\n", - "m=m/60\n", - "print(\"water circulation rate=(m)in kg/min\"),round(m,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.11;pg no:81" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.11, Page:81 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\n", - "let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\n", - "energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\n", - "m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\n", - "so steam suppling rate(m)in kg/s per kg of water\n", - "m= 0.124\n", - "NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\n" - ] - } - ], - "source": [ - "#cal of steam suppling rate\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.11, Page:81 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\")\n", - "v1=50;#velocity of steam entering injector in m/s\n", - "v2=25;#velocity of mixture leave injector in m/s\n", - "h1=720;#enthalpy of steam entering injector in kcal/kg\n", - "h2=24.6;#enthalpy of water entering injector in kcal/kg\n", - "h3=100;#enthalpy of steam leaving injector in kcal/kg\n", - "h4=100;#enthalpy of water leaving injector in kcal/kg\n", - "deltaz=2;#depth from axis of injector in m\n", - "q=12;#heat loss from injector to surrounding through injector\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\")\n", - "print(\"energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\")\n", - "print(\"m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\")\n", - "print(\"so steam suppling rate(m)in kg/s per kg of water\")\n", - "m=((h3*10**3*4.18+v2**2/2)-(h2*10**3*4.18+g*deltaz))/((v1**2/2+h1*10**3*4.18)-(h3*10**3*4.18+v2**2/2)-(q*10**3*4.18))\n", - "print(\"m=\"),round(m,3)\n", - "print(\"NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.12;pg no:82" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.12, Page:82 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\n", - "here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\n", - "displacement work, W=(p.dv)cylinder+(p.dv)ballon\n", - "(p.dv)cylinder=0,as cylinder is rigid\n", - "so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\n", - "and work done by atmosphere=KJ 40.52\n" - ] - } - ], - "source": [ - "#cal of work done by atmosphere\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.12, Page:82 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\")\n", - "p=1.013*10**5;#atmospheric pressure in pa\n", - "deltav=0.4;#change in volume in m^3\n", - "print(\"here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\")\n", - "print(\"displacement work, W=(p.dv)cylinder+(p.dv)ballon\")\n", - "print(\"(p.dv)cylinder=0,as cylinder is rigid\")\n", - "print(\"so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\")\n", - "W=(p*deltav)/1000\n", - "print(\"and work done by atmosphere=KJ\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.13;pg no:82" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.13, Page:82 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\n", - "work done by turbine(Wt)in J#s is 25% of heat added i.e Wt= 1250.0\n", - "heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\n", - "Qrejected= 3750.0\n", - "and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\n", - "Wp=(-) 10.0\n", - "capacity of generator(W)=in Kw 1.24\n" - ] - } - ], - "source": [ - "#cal of capacity of generator\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.13, Page:82 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\")\n", - "Qadd=5000;#heat supplied in boiler in J#s\n", - "Wt=.25*Qadd\n", - "print(\"work done by turbine(Wt)in J#s is 25% of heat added i.e\"),\n", - "print(\"Wt=\"),round(Wt,2)\n", - "print(\"heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\")\n", - "Qrejected=.75*Qadd\n", - "print(\"Qrejected=\"),round(Qrejected,2)\n", - "print(\"and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\")\n", - "Wp=0.002*Qadd\n", - "print(\"Wp=(-)\"),round(Wp,2)\n", - "W=(Wt-Wp)/1000\n", - "print(\"capacity of generator(W)=in Kw\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.14;pg no:83" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.14, Page:83 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\n", - "in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\n", - "h1+Q1_2=h2\n", - "Q1_2=h2-h1\n", - "so heat transfer to air in heat exchanger(Q1_2)in KJ\n", - "Q1_2= 726.61\n", - "in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\n", - "h2+C2^2#2=h3+C3^2/2+Wt\n", - "Wt=(h2-h3)+(C2^2-C3^2)/2\n", - "so power output from turbine(Wt)in KJ#s\n", - "Wt= 1.0\n", - "applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\n", - "h3+C=h4+C4^2/2\n", - "C4^2#2=(h3-h4)+C3^2/2\n", - "velocity at exit of nozzle(C4)in m#s\n", - "C4= 14.3\n" - ] - } - ], - "source": [ - "#cal of velocity at exit of nozzle\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.14, Page:83 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\")\n", - "T1=(27+273);##ambient temperature in K\n", - "T2=(750+273);##temperature of heated air inside heat exchanger in K\n", - "T3=(600+273);##temperature of hot air leaves turbine in K\n", - "T4=(500+273);##temperature at which air leaves nozzle in K\n", - "Cp=1.005;##specific heat at constant pressure in KJ#kg K\n", - "C2=50;##velocity of hot air enter into gas turbine in m#s\n", - "C3=60;##velocity of air leaving turbine enters a nozzle in m#s\n", - "print(\"in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\")\n", - "print(\"h1+Q1_2=h2\")\n", - "print(\"Q1_2=h2-h1\")\n", - "print(\"so heat transfer to air in heat exchanger(Q1_2)in KJ\")\n", - "Q1_2=Cp*(T2-T1)\n", - "print(\"Q1_2=\"),round(Q1_2,2)\n", - "print(\"in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\")\n", - "print(\"h2+C2^2#2=h3+C3^2/2+Wt\")\n", - "print(\"Wt=(h2-h3)+(C2^2-C3^2)/2\")\n", - "print(\"so power output from turbine(Wt)in KJ#s\")\n", - "Wt=Cp*(T2-T3)+(C2**2-C3**2)*10**-3/2\n", - "print(\"Wt=\"),round(Cp,2)\n", - "print(\"applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\")\n", - "print(\"h3+C=h4+C4^2/2\")\n", - "print(\"C4^2#2=(h3-h4)+C3^2/2\")\n", - "print(\"velocity at exit of nozzle(C4)in m#s\")\n", - "C4=math.sqrt(2*(Cp*(T3-T4)+C3**2*10**-3/2))\n", - "print(\"C4=\"),round(C4,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.15;pg no:85" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.15, Page:85 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\n", - "for constant pressure heating,say state changes from 1 to 2\n", - "Wa=p1*dv\n", - "Wa=p1*(v2-v1)\n", - "it is given that v2=2v1\n", - "so Wa=p1*v1=R*T1\n", - "for subsequent expansion at constant temperature say state from 2 to 3\n", - "also given that v3/v1=6,v3/v2=3\n", - "so work=Wb=p*dv\n", - "on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\n", - "temperature at 2 can be given by perfect gas consideration as,\n", - "T2/T1=v2/v1\n", - "or T2=2*T1\n", - "now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\n", - "so W in KJ= 10632.69\n" - ] - } - ], - "source": [ - "#cal of total work done by ai\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.15, Page:85 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\")\n", - "T1=400;##initial temperature of gas in K\n", - "R=8.314;##gas constant in \n", - "print(\"for constant pressure heating,say state changes from 1 to 2\")\n", - "print(\"Wa=p1*dv\")\n", - "print(\"Wa=p1*(v2-v1)\")\n", - "print(\"it is given that v2=2v1\")\n", - "print(\"so Wa=p1*v1=R*T1\")\n", - "print(\"for subsequent expansion at constant temperature say state from 2 to 3\")\n", - "print(\"also given that v3/v1=6,v3/v2=3\")\n", - "print(\"so work=Wb=p*dv\")\n", - "print(\"on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\")\n", - "print(\"temperature at 2 can be given by perfect gas consideration as,\")\n", - "print(\"T2/T1=v2/v1\")\n", - "print(\"or T2=2*T1\")\n", - "print(\"now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\")\n", - "W=R*T1+2*R*T1*math.log(3)\n", - "print(\"so W in KJ=\"),round(W,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.16;pg no:85" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.16, Page:85 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\n", - "NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \n", - "we get W=(Vf-Vi)*((Pi+Pf)/2)\n", - "also final volume of gas in m^3 is Vf=3*Vi\n", - "now work done by gas(W)in J 750000.0\n" - ] - } - ], - "source": [ - "#cal of work done by gas\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.16, Page:85 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\")\n", - "Pi=0.5*10**6;##initial pressure of gas in pa\n", - "Vi=0.5;##initial volume of gas in m^3\n", - "Pf=1*10**6;##final pressure of gas in pa\n", - "print(\"NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \")\n", - "print(\"we get W=(Vf-Vi)*((Pi+Pf)/2)\")\n", - "print(\"also final volume of gas in m^3 is Vf=3*Vi\") \n", - "Vf=3*Vi\n", - "W=(Vf-Vi)*((Pi+Pf)/2)\n", - "print(\"now work done by gas(W)in J\"),round(W,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.17;pg no:87" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.17, Page:87 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\n", - "with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\n", - "adiabatic index of compression of H2 can be obtained as,\n", - "Cp_H2=\n", - "y_H2=Cp_H2/(Cp_H2-R_H2) 1.4\n", - "adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\n", - "y_N2= 1.4\n", - "i>for hydrogen,p1*v1^y=p2*v2^y\n", - "so final pressure of H2(p2)in pa\n", - "p2= 1324078.55\n", - "ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \n", - "partition work=0\n", - "iii>work done upon H2(W_H2)in J,\n", - "W_H2= -200054.06\n", - "work done upon H2(W_H2)=-2*10^5 J\n", - "so work done by N2(W_N2)=2*10^5 J \n", - "iv>heat added to N2 can be obtained using first law of thermodynamics as\n", - "Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\n", - "final temperature of N2 can be obtained considering it as perfect gas\n", - "therefore, T2=(p2*v2*T1)#(p1*v1)\n", - "here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\n", - "p2=1.324*10^6 pa,v2=0.75 m^3\n", - "so now final temperature of N2(T2)in K= 1191.67\n", - "mass of N2(m)in kg= 2.81\n", - "specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2= 1.0\n", - "heat added to N2,(Q_N2)in KJ\n", - "Q_N2= 2052.89\n" - ] - } - ], - "source": [ - "#cal of \n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.17, Page:87 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\")\n", - "Cp_H2=14.307;##specific heat of H2 at constant pressure in KJ#kg K\n", - "R_H2=4.1240;##gas constant for H2 in KJ#kg K\n", - "Cp_N2=1.039;##specific heat of N2 at constant pressure in KJ#kg K\n", - "R_N2=0.2968;##gas constant for N2 in KJ#kg K\n", - "T1=(27+273);##ambient temperature in K\n", - "v1=0.5;##initial volume of H2 in m^3\n", - "p1=0.5*10**6;##initial pressure of H2 in pa \n", - "v2=0.25;##final volume of H2 in m^3 \n", - "p2=1.324*10**6;##final pressure of H2 in pa\n", - "print(\"with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\")\n", - "print(\"adiabatic index of compression of H2 can be obtained as,\")\n", - "print(\"Cp_H2=\")\n", - "y_H2=Cp_H2/(Cp_H2-R_H2)\n", - "print(\"y_H2=Cp_H2/(Cp_H2-R_H2)\"),round(y_H2,2)\n", - "print(\"adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\")\n", - "y_N2=Cp_N2/(Cp_N2-R_N2)\n", - "print(\"y_N2=\"),round(y_N2,2)\n", - "print(\"i>for hydrogen,p1*v1^y=p2*v2^y\")\n", - "print(\"so final pressure of H2(p2)in pa\")\n", - "p2=p1*(v1/v2)**y_H2\n", - "print(\"p2=\"),round(p2,2)\n", - "print(\"ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \")\n", - "print(\"partition work=0\")\n", - "print(\"iii>work done upon H2(W_H2)in J,\")\n", - "W_H2=(p1*v1-p2*v2)/(y_H2-1)\n", - "print(\"W_H2=\"),round(W_H2,2)\n", - "print(\"work done upon H2(W_H2)=-2*10^5 J\")\n", - "W_N2=2*10**5;##work done by N2 in J\n", - "print(\"so work done by N2(W_N2)=2*10^5 J \")\n", - "print(\"iv>heat added to N2 can be obtained using first law of thermodynamics as\")\n", - "print(\"Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\")\n", - "print(\"final temperature of N2 can be obtained considering it as perfect gas\")\n", - "print(\"therefore, T2=(p2*v2*T1)#(p1*v1)\")\n", - "print(\"here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\")\n", - "print(\"p2=1.324*10^6 pa,v2=0.75 m^3\")\n", - "v2=0.75;##final volume of N2 in m^3\n", - "T2=(p2*v2*T1)/(p1*v1)\n", - "print(\"so now final temperature of N2(T2)in K=\"),round(T2,2)\n", - "T2=1191.6;##T2 approx. equal to 1191.6 K\n", - "m=(p1*v1)/(R_N2*1000*T1)\n", - "print(\"mass of N2(m)in kg=\"),round(m,2)\n", - "m=2.8;##m approx equal to 2.8 kg\n", - "Cv_N2=Cp_N2-R_N2\n", - "print(\"specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2=\"),round(Cv_N2)\n", - "print(\"heat added to N2,(Q_N2)in KJ\")\n", - "Q_N2=((m*Cv_N2*1000*(T2-T1))+W_N2)/1000\n", - "print(\"Q_N2=\"),round(Q_N2,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.18;pg no:88" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.18, Page:88 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\n", - "let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\n", - "initial mass of air(m1)in kg\n", - "m1= 9.29\n", - "for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\n", - "T2=in K 237.64\n", - "final mass of air left in tank(m2)in kg\n", - "m2= 2.97\n", - "writing down energy equation for unsteady flow system\n", - "(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\n", - "or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\n", - "kinetic energy available for running turbine(W)in KJ\n", - "W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", - "W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n", - "amount of work available=KJ 482.67\n" - ] - } - ], - "source": [ - "#cal of amount of work available\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.18, Page:88 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\")\n", - "p1=0.5*10**6;#initial pressure of air in pa\n", - "p2=1.013*10**5;#atmospheric pressure in pa\n", - "v1=2;#initial volume of air in m^3\n", - "v2=v1;#final volume of air in m^3\n", - "T1=375;#initial temperature of air in K\n", - "Cp_air=1.003;#specific heat at consatnt pressure in KJ/kg K\n", - "Cv_air=0.716;#specific heat at consatnt volume in KJ/kg K\n", - "R_air=0.287;#gas constant in KJ/kg K\n", - "y=1.4;#expansion constant for air\n", - "print(\"let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\")\n", - "print(\"initial mass of air(m1)in kg\")\n", - "m1=(p1*v1)/(R_air*1000*T1)\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"T2=in K\"),round(T2,2)\n", - "print(\"final mass of air left in tank(m2)in kg\")\n", - "m2=(p2*v2)/(R_air*1000*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"writing down energy equation for unsteady flow system\")\n", - "print(\"(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\")\n", - "print(\"or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\")\n", - "print(\"kinetic energy available for running turbine(W)in KJ\")\n", - "print(\"W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", - "print(\"W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n", - "W=((m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2)/1000\n", - "print(\"amount of work available=KJ\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.19;pg no:89" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.19, Page:89 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\n", - "using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\n", - "n1= 0.1\n", - "now n2= 0.12\n", - "for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\n", - "deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\n", - "final temperature of gas(T3)in K\n", - "T3= 409.09\n", - "using perfect gas equation for final mixture,\n", - "final pressure of gas(p3)in Mpa\n", - "p3= 750000.0\n", - "so final pressure and temperature =0.75 Mpa and 409.11 K\n" - ] - } - ], - "source": [ - "#cal of final pressure and temperature\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.19, Page:89 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\")\n", - "p1=0.5*10**6;#initial pressure of air in pa\n", - "v1=0.5;#initial volume of air in m^3\n", - "T1=(27+273);#initial temperature of air in K\n", - "p2=1*10**6;#final pressure of air in pa\n", - "v2=0.5;#final volume of air in m^3\n", - "T2=500;#final temperature of air in K\n", - "R=8314;#gas constant in J/kg K\n", - "Cv=0.716;#specific heat at constant volume in KJ/kg K\n", - "print(\"using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\")\n", - "n1=(p1*v1)/(R*T1)\n", - "print(\"n1=\"),round(n1,2)\n", - "n2=(p2*v2)/(R*T2)\n", - "print(\"now n2=\"),round(n2,2)\n", - "print(\"for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\")\n", - "deltaU=0;#change in internal energy\n", - "print(\"deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\")\n", - "print(\"final temperature of gas(T3)in K\")\n", - "T3=(deltaU+Cv*(n1*T1+n2*T2))/(Cv*(n1+n2))\n", - "print(\"T3=\"),round(T3,2)\n", - "print(\"using perfect gas equation for final mixture,\")\n", - "print(\"final pressure of gas(p3)in Mpa\")\n", - "p3=((n1+n2)*R*T3)/(v1+v2)\n", - "print(\"p3=\"),round(p3,3)\n", - "print(\"so final pressure and temperature =0.75 Mpa and 409.11 K\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.20;pg no:90" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.20, Page:90 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\n", - "printlacement work,W=p*(v1-v2)in N.m -50675.0\n", - "so heat transfer(Q)in N.m\n", - "Q=-W 50675.0\n" - ] - } - ], - "source": [ - "#cal of heat transfer\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.20, Page:90 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\")\n", - "v1=0;#initial volume of air inside bottle in m^3\n", - "v2=0.5;#final volume of air inside bottle in m^3\n", - "p=1.0135*10**5;#atmospheric pressure in pa\n", - "W=p*(v1-v2)\n", - "print(\"printlacement work,W=p*(v1-v2)in N.m\"),round(W,2)\n", - "print(\"so heat transfer(Q)in N.m\")\n", - "Q=-W\n", - "print(\"Q=-W\"),round(Q,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.21;pg no:90" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.21, Page:90 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\n", - "here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\n", - "(p2/p1)^((y-1)/y)=(T2/T1)\n", - "final temperature of air(T2)in K\n", - "T2= 113.34\n", - "by perfect gas law,initial mass in bottle(m1)in kg\n", - "m1= 11.69\n", - "final mass in bottle(m2)in kg\n", - "m2= 0.92\n", - "energy available for running turbo generator or work(W)in KJ\n", - "W+(m1-m2)*h2=m1*u1-m2*u2\n", - "W= 1325.42\n", - "this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\n", - "turbogenerator actual output(P1)=5 KJ/s\n", - "input to turbogenerator(P2)in KJ/s\n", - "time duration for which turbogenerator can be run(deltat)in seconds\n", - "deltat= 159.05\n", - "duration=160 seconds approx.\n" - ] - } - ], - "source": [ - "#cal of time duration for which turbogenerator can be run\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.21, Page:90 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\")\n", - "p1=35.*10**5;#initial pressure of air in pa\n", - "v1=0.3;#initial volume of air in m^3\n", - "T1=(313.);#initial temperature of air in K\n", - "p2=1.*10**5;#final pressure of air in pa\n", - "v2=0.3;#final volume of air in m^3\n", - "y=1.4;#expansion constant\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\")\n", - "print(\"(p2/p1)^((y-1)/y)=(T2/T1)\")\n", - "print(\"final temperature of air(T2)in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"T2=\"),round(T2,2)\n", - "print(\"by perfect gas law,initial mass in bottle(m1)in kg\")\n", - "m1=(p1*v1)/(R*1000.*T1)\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"final mass in bottle(m2)in kg\")\n", - "m2=(p2*v2)/(R*1000.*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"energy available for running turbo generator or work(W)in KJ\")\n", - "print(\"W+(m1-m2)*h2=m1*u1-m2*u2\")\n", - "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", - "print(\"W=\"),round(W,2)\n", - "print(\"this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\")\n", - "print(\"turbogenerator actual output(P1)=5 KJ/s\")\n", - "P1=5;#turbogenerator actual output in KJ/s\n", - "print(\"input to turbogenerator(P2)in KJ/s\")\n", - "P2=P1/0.6\n", - "print(\"time duration for which turbogenerator can be run(deltat)in seconds\")\n", - "deltat=W/P2\n", - "print(\"deltat=\"),round(deltat,2)\n", - "print(\"duration=160 seconds approx.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.22;pg no:91" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.22, Page:91 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\n", - "different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\n", - "process 1-2 is polytropic process with index 1.2\n", - "(T2/T1)=(p2/p1)^((n-1)/n)\n", - "final temperature of air(T2)in K\n", - "T2= 457.68\n", - "at state 1,p1*v1=m*R*T1\n", - "initial volume of air(v1)in m^3\n", - "v1= 2.01\n", - "final volume of air(v2)in m^3\n", - "for process 1-2,v2= 0.53\n", - "for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\n", - "v3=v2*T3/T2 in m^3\n", - "here process 3-1 is isothermal process so T1=T3\n", - "during process 1-2 the compression work(W1_2)in KJ\n", - "W1_2=(m*R*(T2-T1)/(1-n))\n", - "work during process 2-3(W2_3)in KJ,\n", - "W2_3=p2*(v3-v2)/1000\n", - "work during process 3-1(W3_1)in KJ\n", - "W3_1= 485.0\n", - "net work done(W_net)in KJ\n", - "W_net=W1_2+W2_3+W3_1 -71.28\n", - "net work=-71.27 KJ\n", - "here -ve workshows work done upon the system.since it is cycle,so\n", - "W_net=Q_net\n", - "phi dW=phi dQ=-71.27 KJ\n", - "heat transferred from system=71.27 KJ\n" - ] - } - ], - "source": [ - "#cal of network,heat transferred from system\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "import math\n", - "print\"Example 3.22, Page:91 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\")\n", - "p1=1.5*10**5;#initial pressure of air in pa\n", - "T1=(77+273);#initial temperature of air in K\n", - "p2=7.5*10**5;#final pressure of air in pa\n", - "n=1.2;#expansion constant for process 1-2\n", - "R=0.287;#gas constant in KJ/kg K\n", - "m=3.;#mass of air in kg\n", - "print(\"different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\")\n", - "print(\"process 1-2 is polytropic process with index 1.2\")\n", - "print(\"(T2/T1)=(p2/p1)^((n-1)/n)\")\n", - "print(\"final temperature of air(T2)in K\")\n", - "T2=T1*((p2/p1)**((n-1)/n))\n", - "print(\"T2=\"),round(T2,2)\n", - "print(\"at state 1,p1*v1=m*R*T1\")\n", - "print(\"initial volume of air(v1)in m^3\")\n", - "v1=(m*R*1000*T1)/p1\n", - "print(\"v1=\"),round(v1,2)\n", - "print(\"final volume of air(v2)in m^3\")\n", - "v2=((p1*v1**n)/p2)**(1/n)\n", - "print(\"for process 1-2,v2=\"),round(v2,2)\n", - "print(\"for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\")\n", - "print(\"v3=v2*T3/T2 in m^3\")\n", - "print(\"here process 3-1 is isothermal process so T1=T3\")\n", - "T3=T1;#process 3-1 is isothermal\n", - "v3=v2*T3/T2\n", - "print(\"during process 1-2 the compression work(W1_2)in KJ\")\n", - "print(\"W1_2=(m*R*(T2-T1)/(1-n))\")\n", - "W1_2=(m*R*(T2-T1)/(1-n))\n", - "print(\"work during process 2-3(W2_3)in KJ,\")\n", - "print(\"W2_3=p2*(v3-v2)/1000\")\n", - "W2_3=p2*(v3-v2)/1000\n", - "print(\"work during process 3-1(W3_1)in KJ\")\n", - "p3=p2;#pressure is constant for process 2-3\n", - "W3_1=p3*v3*math.log(v1/v3)/1000\n", - "print(\"W3_1=\"),round(W3_1,2)\n", - "print(\"net work done(W_net)in KJ\")\n", - "W_net=W1_2+W2_3+W3_1\n", - "print(\"W_net=W1_2+W2_3+W3_1\"),round(W_net,2)\n", - "print(\"net work=-71.27 KJ\")\n", - "print(\"here -ve workshows work done upon the system.since it is cycle,so\")\n", - "print(\"W_net=Q_net\")\n", - "print(\"phi dW=phi dQ=-71.27 KJ\")\n", - "print(\"heat transferred from system=71.27 KJ\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 3.23;pg no:93" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 3.23, Page:93 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\n", - "initial mass of air in bottle(m1)in kg \n", - "m1= 6.97\n", - "now final temperature(T2)in K\n", - "T2= 0.0\n", - "final mass of air in bottle(m2)in kg\n", - "m2= 0.82\n", - "energy available for running of turbine due to emptying of bottle(W)in KJ\n", - "W= 639.09\n", - "work available from turbine=639.27KJ\n" - ] - } - ], - "source": [ - "#cal of work available from turbine\n", - "#intiation of all variables\n", - "# Chapter 3\n", - "print\"Example 3.23, Page:93 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\")\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "y=1.4;#expansion constant \n", - "p1=40*10**5;#initial temperature of air in pa\n", - "v1=0.15;#initial volume of air in m^3\n", - "T1=(27+273);#initial temperature of air in K\n", - "p2=2*10**5;#final temperature of air in pa\n", - "v2=0.15;#final volume of air in m^3\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"initial mass of air in bottle(m1)in kg \")\n", - "m1=(p1*v1)/(R*1000*T1)\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"now final temperature(T2)in K\")\n", - "T2=T1*(p2/p1)**((y-1)/y)\n", - "print(\"T2=\"),round(T2,2)\n", - "T2=127.36;#take T2=127.36 approx.\n", - "print(\"final mass of air in bottle(m2)in kg\")\n", - "m2=(p2*v2)/(R*1000*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "m2=0.821;#take m2=0.821 approx.\n", - "print(\"energy available for running of turbine due to emptying of bottle(W)in KJ\")\n", - "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", - "print(\"W=\"),round(W,2)\n", - "print(\"work available from turbine=639.27KJ\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter4.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter4.ipynb deleted file mode 100755 index bb4a3703..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter4.ipynb +++ /dev/null @@ -1,1070 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4:Second Law of Thermo Dynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.1;pg no: 113" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.1, Page:113 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\n", - "NOTE=>This question is fully theoritical hence cannot be solve using scilab.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.1, Page:113 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\")\n", - "print(\"NOTE=>This question is fully theoritical hence cannot be solve using scilab.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.2;pg no: 114" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.2, Page:114 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\n", - "in carnot engine from thermodynamics temperature scale\n", - "Q1/Q2=T1/T2\n", - "W=Q1-Q2=200 KJ\n", - "from above equations Q1 in KJ is given by\n", - "Q1= 349.61\n", - "and Q2 in KJ\n", - "Q2=Q1-200 149.61\n", - "so heat supplied(Q1) in KJ 349.6\n" - ] - } - ], - "source": [ - "#cal of heat supplied\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.2, Page:114 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\")\n", - "T1=(400.+273.);#temperature of source in K\n", - "T2=(15.+273.);#temperature of sink in K\n", - "W=200.;#work done in KJ\n", - "print(\"in carnot engine from thermodynamics temperature scale\")\n", - "print(\"Q1/Q2=T1/T2\")\n", - "print(\"W=Q1-Q2=200 KJ\")\n", - "print(\"from above equations Q1 in KJ is given by\")\n", - "Q1=(200*T1)/(T1-T2)\n", - "print(\"Q1=\"),round(Q1,2)\n", - "print(\"and Q2 in KJ\")\n", - "Q2=Q1-200\n", - "print(\"Q2=Q1-200\"),round(Q2,2)\n", - "print(\"so heat supplied(Q1) in KJ\"),round(Q1,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.3;pg no: 115" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.3, Page:115 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\n", - "from thermodynamic temperature scale\n", - "Q1/Q2=T1/T2\n", - "so Q1=Q2*(T1/T2)in KJ/s 2.27\n", - "power/work input required(W)=Q1-Q2 in KJ/s \n", - "power required for driving refrigerator=W in KW 0.274\n" - ] - } - ], - "source": [ - "#cal of power required for driving refrigerator\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.3, Page:115 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\")\n", - "T1=315.;#temperature of reservoir 1 in K\n", - "T2=277.;#temperature of reservoir 2 in K\n", - "Q2=2.;#heat extracted in KJ/s\n", - "print(\"from thermodynamic temperature scale\")\n", - "print(\"Q1/Q2=T1/T2\")\n", - "Q1=Q2*(T1/T2)\n", - "print(\"so Q1=Q2*(T1/T2)in KJ/s\"),round(Q1,2)\n", - "print(\"power/work input required(W)=Q1-Q2 in KJ/s \")\n", - "W=Q1-Q2\n", - "print(\"power required for driving refrigerator=W in KW\"),round(W,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.4;pg no: 115" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.4, Page:115 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\n", - "we can writefor heat engine,Q1/Q2=T1/T2\n", - "so Q2=Q1*(T2/T1) in KJ 545.45\n", - "so We=in KJ 1454.55\n", - "for refrigerator,Q3/Q4=T3/T4 eq 1\n", - "now We-Wr=300\n", - "so Wr=We-300 in KJ 1154.55\n", - "and Wr=Q4-Q3=1154.55 KJ eq 2 \n", - "solving eq1 and eq 2 we get\n", - "Q4=in KJ 8659.13\n", - "and Q3=in KJ 7504.58\n", - "total heat transferred to low teperature reservoir(Q)=in KJ 9204.58\n", - "hence heat transferred to refrigerant=Q3 in KJ 7504.58\n", - "and heat transferred to low temperature reservoir=Q in KJ 9204.58\n" - ] - } - ], - "source": [ - "#cal of heat transferred to refrigerant and low temperature reservoir\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.4, Page:115 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\")\n", - "T1=(827.+273.);#temperature of high temperature reservoir in K\n", - "T2=(27.+273.);#temperature of low temperature reservoir in K\n", - "T3=(-13.+273.);#temperature of reservoir 3 in K\n", - "Q1=2000.;#heat ejected by reservoir 1 in KJ\n", - "print(\"we can writefor heat engine,Q1/Q2=T1/T2\")\n", - "Q2=Q1*(T2/T1)\n", - "print(\"so Q2=Q1*(T2/T1) in KJ\"),round(Q2,2)\n", - "We=Q1-Q2\n", - "print(\"so We=in KJ\"),round(We,2)\n", - "print(\"for refrigerator,Q3/Q4=T3/T4 eq 1\")\n", - "T4=T2;#temperature of low temperature reservoir in K\n", - "print(\"now We-Wr=300\")\n", - "Wr=We-300.\n", - "print(\"so Wr=We-300 in KJ\"),round(Wr,2)\n", - "print(\"and Wr=Q4-Q3=1154.55 KJ eq 2 \")\n", - "print(\"solving eq1 and eq 2 we get\")\n", - "Q4=(1154.55*T4)/(T4-T3)\n", - "print(\"Q4=in KJ\"),round(Q4,2)\n", - "Q3=Q4-Wr\n", - "print(\"and Q3=in KJ\"),round(Q3,2)\n", - "Q=Q2+Q4\n", - "print(\"total heat transferred to low teperature reservoir(Q)=in KJ\"),round(Q,2)\n", - "print(\"hence heat transferred to refrigerant=Q3 in KJ\"),round(Q3,2)\n", - "print(\"and heat transferred to low temperature reservoir=Q in KJ\"),round(Q,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.5;pg no: 116" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.5, Page:116 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\n", - "COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\n", - "also we know K=Q1/Q2=T1/T2\n", - "so K=T1/T2 1.1\n", - "so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K)) 11.0\n", - "also COP_HP=Q1/W\n", - "W=Q1/COin MJ/Hr 3.03\n", - "or W=1000*W/3600 in KW 3.03\n", - "so minimum power required(W)in KW 3.03\n" - ] - } - ], - "source": [ - "#cal of minimum power required\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.5, Page:116 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\")\n", - "T1=(25+273.15);#temperature of inside of house in K\n", - "T2=(-1+273.15);#outside temperature in K\n", - "Q1=125;#heating load in MJ/Hr\n", - "print(\"COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\")\n", - "print(\"also we know K=Q1/Q2=T1/T2\")\n", - "K=T1/T2\n", - "print(\"so K=T1/T2\"),round(K,2)\n", - "COP_HP=1/(1-(1/K))\n", - "print(\"so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K))\"),round(COP_HP)\n", - "print(\"also COP_HP=Q1/W\")\n", - "W=Q1/COP_HP\n", - "W=1000*W/3600\n", - "print(\"W=Q1/COin MJ/Hr\"),round(W,2)\n", - "print(\"or W=1000*W/3600 in KW\"),round(W,2)\n", - "print(\"so minimum power required(W)in KW \"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.6;pg no: 117" - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.6, Page:117 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\n", - "cold storage plant can be considered as refrigerator operating between given temperatures limits\n", - "capacity of plant=heat to be extracted=Q2 in KW\n", - "we know that,one ton of refrigeration as 3.52 KW \n", - "so Q2=Q2*3.52 in KW 140.8\n", - "carnot COP of plant(COP_carnot)= 5.18\n", - "performance is 1/4 of its carnot COP\n", - "COP=COP_carnot/4\n", - "also actual COP=Q2/W\n", - "W=Q2/COP in KW\n", - "hence power required(W)in KW 108.76\n" - ] - } - ], - "source": [ - "#cal of power required\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.6, Page:117 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\")\n", - "T1=(-15.+273.15);#inside temperature in K\n", - "T2=(35.+273.);#atmospheric temperature in K\n", - "Q2=40.;#refrigeration capacity of storage plant in tonnes\n", - "print(\"cold storage plant can be considered as refrigerator operating between given temperatures limits\")\n", - "print(\"capacity of plant=heat to be extracted=Q2 in KW\")\n", - "print(\"we know that,one ton of refrigeration as 3.52 KW \")\n", - "Q2=Q2*3.52\n", - "print(\"so Q2=Q2*3.52 in KW\"),round(Q2,2)\n", - "COP_carnot=1/((T2/T1)-1)\n", - "print(\"carnot COP of plant(COP_carnot)=\"),round(COP_carnot,2)\n", - "print(\"performance is 1/4 of its carnot COP\")\n", - "COP=COP_carnot/4\n", - "print(\"COP=COP_carnot/4\")\n", - "print(\"also actual COP=Q2/W\")\n", - "print(\"W=Q2/COP in KW\")\n", - "W=Q2/COP\n", - "print(\"hence power required(W)in KW\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.7;pg no: 117" - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.7, Page:117 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\n", - "highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\n", - "n= 0.79\n", - "or n=n*100 % 78.92\n" - ] - } - ], - "source": [ - "#cal of carnot cycle efficiency for given temperature limits\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.7, Page:117 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\")\n", - "T1=(1150.+273.);#temperature of source in K\n", - "T2=(27.+273.);#temperature of sink in K\n", - "print(\"highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\")\n", - "n=1-(T2/T1)\n", - "print(\"n=\"),round(n,2)\n", - "n=n*100\n", - "print(\"or n=n*100 %\"),round(n,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.8;pg no: 117" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.8, Page:117 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\n", - "here heat to be removed continuously from refrigerated space(Q)in KJ/s 0.13\n", - "for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\n", - "W=in KW 0.02\n", - "so power required(W)in KW 0.02\n" - ] - } - ], - "source": [ - "#cal of power required\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.8, Page:117 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\")\n", - "T1=(27.+273.);#temperature of source in K\n", - "T2=(-8.+273.);#temperature of sink in K\n", - "Q=7.5;#heat leakage in KJ/min\n", - "Q=Q/60.\n", - "print(\"here heat to be removed continuously from refrigerated space(Q)in KJ/s\"),round(Q,2)\n", - "print(\"for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\")\n", - "W=Q*((T1/T2)-1)\n", - "print(\"W=in KW\"),round(W,2)\n", - "print(\"so power required(W)in KW\"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.9;pg no: 118" - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.9, Page:118 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\n", - "here W1:W2:W3=3:2:1\n", - "efficiency of engine,HE1,\n", - "W1/Q1=(1-(T2/1100))\n", - "so Q1=(1100*W1)/(1100-T2)\n", - "for HE2 engine,W2/Q2=(1-(T3/T2))\n", - "for HE3 engine,W3/Q3=(1-(300/T3))\n", - "from energy balance on engine,HE1\n", - "Q1=W1+Q2=>Q2=Q1-W1\n", - "above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\n", - "substituting Q2 in efficiency of HE2\n", - "W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\n", - "W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\n", - "2/3=(T2-T3)/(1100-T2)\n", - "2200-2*T2=3*T2-3*T3\n", - "5*T2-3*T3=2200\n", - "now energy balance on engine HE2 gives,Q2=W2+Q3\n", - "substituting in efficiency of HE2,\n", - "W2/(W2+Q3)=(T2-T3)/T2\n", - "W2*T2=(W2+Q3)*(T2-T3)\n", - "Q3=(W2*T3)/(T2-T3)\n", - "substituting Q3 in efficiency of HE3,\n", - "W3/((W2*T3)/(T2-T3))=(T3-300)/T3\n", - "W3/W2=(T3/(T2-T3))*(T3-300)/T3\n", - "1/2=(T3-300)/(T2-T3)\n", - "3*T3-T2=600\n", - "solving equations of T2 and T3,\n", - "we get,T3=in K 433.33\n", - "and by eq 5,T2 in K 700.0\n", - "so intermediate temperature are 700 K and 433.33 K\n" - ] - } - ], - "source": [ - "#cal of intermediate temperatures\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.9, Page:118 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\")\n", - "T1=1100;#temperature of high temperature reservoir in K\n", - "T4=300;#temperature of low temperature reservoir in K\n", - "print(\"here W1:W2:W3=3:2:1\")\n", - "print(\"efficiency of engine,HE1,\")\n", - "print(\"W1/Q1=(1-(T2/1100))\")\n", - "print(\"so Q1=(1100*W1)/(1100-T2)\")\n", - "print(\"for HE2 engine,W2/Q2=(1-(T3/T2))\")\n", - "print(\"for HE3 engine,W3/Q3=(1-(300/T3))\")\n", - "print(\"from energy balance on engine,HE1\")\n", - "print(\"Q1=W1+Q2=>Q2=Q1-W1\")\n", - "print(\"above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\")\n", - "print(\"substituting Q2 in efficiency of HE2\")\n", - "print(\"W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\")\n", - "print(\"W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\")\n", - "print(\"2/3=(T2-T3)/(1100-T2)\")\n", - "print(\"2200-2*T2=3*T2-3*T3\")\n", - "print(\"5*T2-3*T3=2200\")\n", - "print(\"now energy balance on engine HE2 gives,Q2=W2+Q3\")\n", - "print(\"substituting in efficiency of HE2,\")\n", - "print(\"W2/(W2+Q3)=(T2-T3)/T2\")\n", - "print(\"W2*T2=(W2+Q3)*(T2-T3)\")\n", - "print(\"Q3=(W2*T3)/(T2-T3)\")\n", - "print(\"substituting Q3 in efficiency of HE3,\")\n", - "print(\"W3/((W2*T3)/(T2-T3))=(T3-300)/T3\")\n", - "print(\"W3/W2=(T3/(T2-T3))*(T3-300)/T3\")\n", - "print(\"1/2=(T3-300)/(T2-T3)\")\n", - "print(\"3*T3-T2=600\")\n", - "print(\"solving equations of T2 and T3,\")\n", - "T3=(600.+(2200./5.))/(3.-(3./5.))\n", - "print(\"we get,T3=in K\"),round(T3,2)\n", - "T2=(2200.+3.*T3)/5.\n", - "print(\"and by eq 5,T2 in K\"),round(T2,2)\n", - "print(\"so intermediate temperature are 700 K and 433.33 K\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.10;pg no: 119" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.10, Page:119 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\n", - "efficiency of engine,W/Q1=(800-T)/800\n", - "for refrigerator,COP=Q3/W=280/(T-280)\n", - "it is given that Q1=Q3=Q\n", - "so,from engine,W/Q=(800-T)/800\n", - "from refrigerator,Q/W=280/(T-280)\n", - "from above two(Q/W)may be equated,\n", - "(T-280)/280=(800-T)/800\n", - "so temperature(T)in K 414.81\n", - "efficiency of engine(n)is given as\n", - "n= 0.48\n", - "COP of refrigerator is given as\n", - "COP= 2.08\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.10, Page:119 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\")\n", - "T1=800.;#temperature of source in K\n", - "T2=280.;#temperature of sink in K\n", - "print(\"efficiency of engine,W/Q1=(800-T)/800\")\n", - "print(\"for refrigerator,COP=Q3/W=280/(T-280)\")\n", - "print(\"it is given that Q1=Q3=Q\")\n", - "print(\"so,from engine,W/Q=(800-T)/800\")\n", - "print(\"from refrigerator,Q/W=280/(T-280)\")\n", - "print(\"from above two(Q/W)may be equated,\")\n", - "print(\"(T-280)/280=(800-T)/800\")\n", - "T=2.*280.*800./(800.+280.)\n", - "print(\"so temperature(T)in K\"),round(T,2)\n", - "print(\"efficiency of engine(n)is given as\")\n", - "n=(800.-T)/800.\n", - "print(\"n=\"),round(n,2)\n", - "print(\"COP of refrigerator is given as\")\n", - "COP=280./(T-280.)\n", - "print(\"COP=\"),round(COP,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.11;pg no: 120" - ] - }, - { - "cell_type": "code", - "execution_count": 39, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.11, Page:120 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\n", - "let thermodynamic properties be denoted with respect to salient states;\n", - "n_carnot=1-T1/T2\n", - "so T1/T2=1-0.5\n", - "so T1/T2=0.5\n", - "or T2=2*T1\n", - "corresponding to state 2,p2*v2=m*R*T2\n", - "so temperature(T2) in K= 585.37\n", - "heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\n", - "Q_23=W_23=p2*v2*log(v3/v2)\n", - "so volume(v3) in m^3= 0.1932\n", - "temperature at state 1,T1 in K= 292.68\n", - "during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\n", - "here expansion constant(y)=Cp/Cv\n", - "so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\n", - "p1 in bar\n", - "thus p1*v1=m*R*T1\n", - "so volume(v1) in m^3= 0.68\n", - "heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\n", - "for isentropic process,dQ=0,dW=dU\n", - "during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\n", - "Q_12=0,\n", - "W_12=-105.51 KJ(-ve work)\n", - "during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\n", - "Q_31=0,\n", - "ANS:\n", - "W_34=+105.51 KJ(+ve work)\n", - "so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\n", - "for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\n", - "for process 3-4,heat transfer=0,work interaction=+105.51 KJ\n", - "for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\n", - "maximum temperature of cycle=585.36 KJ\n", - "minimum temperature of cycle=292.68 KJ\n", - "volume at the end of isothermal expansion=0.1932 m^3\n" - ] - } - ], - "source": [ - "#cal of max and min temp of cycle,volume\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "import math\n", - "print\"Example 4.11, Page:120 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\")\n", - "n_carnot=0.5;#efficiency of carnot power cycle\n", - "m=0.5;#mass of air in kg\n", - "p2=7.*10**5;#final pressure in pa\n", - "v2=0.12;#volume in m^3\n", - "R=287.;#gas constant in J/kg K\n", - "Q_23=40.*1000.;#heat transfer to the air during isothermal expansion in J\n", - "Cp=1.008;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.721;#specific heat at constant volume in KJ/kg K\n", - "print(\"let thermodynamic properties be denoted with respect to salient states;\")\n", - "print(\"n_carnot=1-T1/T2\")\n", - "print(\"so T1/T2=1-0.5\")\n", - "1-0.5\n", - "print(\"so T1/T2=0.5\")\n", - "print(\"or T2=2*T1\")\n", - "print(\"corresponding to state 2,p2*v2=m*R*T2\")\n", - "T2=p2*v2/(m*R)\n", - "print(\"so temperature(T2) in K=\"),round(T2,2)\n", - "print(\"heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\")\n", - "print(\"Q_23=W_23=p2*v2*log(v3/v2)\")\n", - "v3=v2*math.exp(Q_23/(p2*v2))\n", - "print(\"so volume(v3) in m^3=\"),round(v3,4)\n", - "T1=T2/2\n", - "print(\"temperature at state 1,T1 in K=\"),round(T1,2)\n", - "print(\"during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\")\n", - "print(\"here expansion constant(y)=Cp/Cv\")\n", - "y=Cp/Cv\n", - "print(\"so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\")\n", - "p1=p2/(T2/T1)**(y/(y-1))\n", - "print(\"p1 in bar\")\n", - "p1=p1/10**5\n", - "print(\"thus p1*v1=m*R*T1\")\n", - "v1=m*R*T1/(p1*10**5)\n", - "print(\"so volume(v1) in m^3=\"),round(v1,2) \n", - "print(\"heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\")\n", - "print(\"for isentropic process,dQ=0,dW=dU\")\n", - "print(\"during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\")\n", - "print(\"Q_12=0,\")\n", - "W_12=-m*Cv*(T2-T1)\n", - "print(\"W_12=-105.51 KJ(-ve work)\")\n", - "print(\"during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\")\n", - "print(\"Q_31=0,\")\n", - "T4=T1;\n", - "T3=T2;\n", - "W_34=-m*Cv*(T4-T3)\n", - "print(\"ANS:\")\n", - "print(\"W_34=+105.51 KJ(+ve work)\")\n", - "print(\"so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\")\n", - "print(\"for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\")\n", - "print(\"for process 3-4,heat transfer=0,work interaction=+105.51 KJ\")\n", - "print(\"for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\")\n", - "print(\"maximum temperature of cycle=585.36 KJ\")\n", - "print(\"minimum temperature of cycle=292.68 KJ\")\n", - "print(\"volume at the end of isothermal expansion=0.1932 m^3\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.12;pg no: 122" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.12, Page:122 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\n", - "let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\n", - "thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\n", - "Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\n", - "Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\n", - "substituting Q1_a and Q1_b in eq 1\n", - "4*Q2/3+2*Q3=5000...............eq4\n", - "also from total work output,Q1_a+Q1_b-Q2-Q3=W\n", - "5000-Q2-Q3=840\n", - "so Q2+Q3=5000-840=4160\n", - "Q3=4160-Q2\n", - "sunstituting Q3 in eq 4\n", - "4*Q2/3+2*(4160-Q2)=5000\n", - "so Q2=in KJ 4980.0\n", - "and Q3= in KJ 820.0\n", - "here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\n", - "Q2=4980 KJ,from heat engine\n", - "Q3=820 KJ,to heat engine\n" - ] - } - ], - "source": [ - "#cal of heat from from heat engine and to heat engine\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.12, Page:122 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\")\n", - "W=840.;#work done by reservoir in KJ\n", - "print(\"let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\")\n", - "print(\"thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\")\n", - "print(\"Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\")\n", - "print(\"Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\")\n", - "print(\"substituting Q1_a and Q1_b in eq 1\")\n", - "print(\"4*Q2/3+2*Q3=5000...............eq4\")\n", - "print(\"also from total work output,Q1_a+Q1_b-Q2-Q3=W\")\n", - "print(\"5000-Q2-Q3=840\")\n", - "print(\"so Q2+Q3=5000-840=4160\")\n", - "print(\"Q3=4160-Q2\")\n", - "print(\"sunstituting Q3 in eq 4\")\n", - "print(\"4*Q2/3+2*(4160-Q2)=5000\")\n", - "Q2=(5000.-2.*4160.)/((4./3.)-2.)\n", - "print(\"so Q2=in KJ\"),round(Q2,2)\n", - "Q3=4160.-Q2\n", - "print(\"and Q3= in KJ\"),round(-Q3,2)\n", - "print(\"here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\")\n", - "print(\"Q2=4980 KJ,from heat engine\")\n", - "print(\"Q3=820 KJ,to heat engine\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.13;pg no: 123" - ] - }, - { - "cell_type": "code", - "execution_count": 41, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.13, Page:123 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\n", - "arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\n", - "for heat engine\n", - "ne=W/Q1=1-T2/T1\n", - "so (Q1-Q2)/Q1=\n", - "and Q2/Q1=\n", - "Q2=0.2593*Q1\n", - "for heat pump,\n", - "COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\n", - "Q4/Q3=\n", - "Q4=1.27*Q3\n", - "work output from engine =work input to pump\n", - "Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\n", - "so Q4/Q1=\n", - "so Q4=3.484*Q1\n", - "also it is given that Q2+Q4=100\n", - "subtituting Q2 and Q4 as function of Q1 in following expression,\n", - "Q2+Q4=100\n", - "so 0.2539*Q1+3.484*Q1=100\n", - "so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\n", - "Q1=100/(0.2539+3.484)in KJ 26.75\n", - "NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\n" - ] - } - ], - "source": [ - "#cal of energy taken by engine from reservoir\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.13, Page:123 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\")\n", - "T2=(77+273);#temperature of reservoir 2\n", - "T1=(1077+273);#temperature of reservoir 1\n", - "T3=(3+273);#temperature of reservoir 3\n", - "print(\"arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\")\n", - "print(\"for heat engine\")\n", - "print(\"ne=W/Q1=1-T2/T1\")\n", - "print(\"so (Q1-Q2)/Q1=\")\n", - "1-T2/T1\n", - "print(\"and Q2/Q1=\")\n", - "1-0.7407\n", - "print(\"Q2=0.2593*Q1\")\n", - "print(\"for heat pump,\")\n", - "print(\"COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\")\n", - "T4=T2;\n", - "T4/(T4-T3)\n", - "print(\"Q4/Q3=\")\n", - "4.73/3.73\n", - "print(\"Q4=1.27*Q3\")\n", - "print(\"work output from engine =work input to pump\")\n", - "print(\"Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\")\n", - "print(\"so Q4/Q1=\")\n", - "(1-0.2593)/(1-(1/1.27))\n", - "print(\"so Q4=3.484*Q1\")\n", - "print(\"also it is given that Q2+Q4=100\")\n", - "print(\"subtituting Q2 and Q4 as function of Q1 in following expression,\")\n", - "print(\"Q2+Q4=100\")\n", - "print(\"so 0.2539*Q1+3.484*Q1=100\")\n", - "print(\"so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\")\n", - "Q1=100/(0.2539+3.484)\n", - "print(\"Q1=100/(0.2539+3.484)in KJ\"),round(Q1,2)\n", - "print(\"NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.14;pg no: 124" - ] - }, - { - "cell_type": "code", - "execution_count": 42, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.14, Page:124 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\n", - "let temperature of sink be T_sink K\n", - "Q_sink_HE+Q_sink_R=3000 ........eq 1\n", - "since complete work output from engine is used to run refrigerator so,\n", - "2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\n", - "by eq 1 and eq 2,we get Q_R in KJ/s 1000.0\n", - "also for heat engine,2000/1500=Q_sink_HE/T_sink\n", - "=>Q_sink_HE=4*T_sink/3\n", - "for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\n", - "substituting Q_sink_HE and Q_sink_R values\n", - "4*T_sink/3+1000*T_sink/288=3000\n", - "so temperature of sink(T_sink)in K\n", - "so T_sink= 750.0\n", - "T_sink in degree celcius 477.0\n" - ] - } - ], - "source": [ - "#cal of T_sink in degree celcius\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.14, Page:124 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\")\n", - "Q_source=2000;#heat supplied by heat engine in KJ/s\n", - "T_source=1500;#temperature of source in K\n", - "T_R=(15+273);#temperature of reservoir in K\n", - "Q_sink=3000;#heat received by sink in KJ/s\n", - "print(\"let temperature of sink be T_sink K\")\n", - "print(\"Q_sink_HE+Q_sink_R=3000 ........eq 1\")\n", - "print(\"since complete work output from engine is used to run refrigerator so,\")\n", - "print(\"2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\")\n", - "Q_R=3000-2000\n", - "print(\"by eq 1 and eq 2,we get Q_R in KJ/s\"),round(Q_R)\n", - "print(\"also for heat engine,2000/1500=Q_sink_HE/T_sink\")\n", - "print(\"=>Q_sink_HE=4*T_sink/3\")\n", - "print(\"for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\")\n", - "print(\"substituting Q_sink_HE and Q_sink_R values\")\n", - "print(\"4*T_sink/3+1000*T_sink/288=3000\")\n", - "print(\"so temperature of sink(T_sink)in K\")\n", - "T_sink=3000/((4/3)+(1000/288))\n", - "print(\"so T_sink=\"),round(T_sink,2)\n", - "T_sink=T_sink-273\n", - "print(\"T_sink in degree celcius\"),round(T_sink,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.15;pg no: 124" - ] - }, - { - "cell_type": "code", - "execution_count": 45, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.15, Page:124 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\n", - "let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\n", - "n=W/Q1= 0.39\n", - "so n=W/Q1=0.3881\n", - "COP of heat pump=T3/(T3-T2)=Q3/(2*W/3) 2.89\n", - "so 2.892=3*Q3/2*W\n", - "Q3/Q1= 0.7483\n", - "so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\n" - ] - } - ], - "source": [ - "#cal of heat transferred to refrigerant and low temperature reservoir\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.15, Page:124 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\")\n", - "T1=(500.+273.);#temperature of source in K\n", - "T2=(200.+273.);#temperature of sink in K\n", - "T3=(450.+273.);#temperature of body in K\n", - "print(\"let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\")\n", - "n=1-(T2/T1)\n", - "print(\"n=W/Q1=\"),round(n,2)\n", - "print(\"so n=W/Q1=0.3881\")\n", - "COP=T3/(T3-T2)\n", - "print(\"COP of heat pump=T3/(T3-T2)=Q3/(2*W/3)\"),round(COP,2)\n", - "print(\"so 2.892=3*Q3/2*W\")\n", - "print(\"Q3/Q1=\"),round(2*COP*n/3,4)\n", - "print(\"so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.16;pg no: 125" - ] - }, - { - "cell_type": "code", - "execution_count": 48, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.16, Page:125 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\n", - "NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.16, Page:125 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\")\n", - "print(\"NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.17;pg no: 126" - ] - }, - { - "cell_type": "code", - "execution_count": 47, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.17, Page:126 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\n", - "NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.17, Page:126 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\")\n", - "print(\"NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter4_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter4_1.ipynb deleted file mode 100755 index bb4a3703..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter4_1.ipynb +++ /dev/null @@ -1,1070 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4:Second Law of Thermo Dynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.1;pg no: 113" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.1, Page:113 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\n", - "NOTE=>This question is fully theoritical hence cannot be solve using scilab.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.1, Page:113 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\")\n", - "print(\"NOTE=>This question is fully theoritical hence cannot be solve using scilab.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.2;pg no: 114" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.2, Page:114 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\n", - "in carnot engine from thermodynamics temperature scale\n", - "Q1/Q2=T1/T2\n", - "W=Q1-Q2=200 KJ\n", - "from above equations Q1 in KJ is given by\n", - "Q1= 349.61\n", - "and Q2 in KJ\n", - "Q2=Q1-200 149.61\n", - "so heat supplied(Q1) in KJ 349.6\n" - ] - } - ], - "source": [ - "#cal of heat supplied\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.2, Page:114 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\")\n", - "T1=(400.+273.);#temperature of source in K\n", - "T2=(15.+273.);#temperature of sink in K\n", - "W=200.;#work done in KJ\n", - "print(\"in carnot engine from thermodynamics temperature scale\")\n", - "print(\"Q1/Q2=T1/T2\")\n", - "print(\"W=Q1-Q2=200 KJ\")\n", - "print(\"from above equations Q1 in KJ is given by\")\n", - "Q1=(200*T1)/(T1-T2)\n", - "print(\"Q1=\"),round(Q1,2)\n", - "print(\"and Q2 in KJ\")\n", - "Q2=Q1-200\n", - "print(\"Q2=Q1-200\"),round(Q2,2)\n", - "print(\"so heat supplied(Q1) in KJ\"),round(Q1,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.3;pg no: 115" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.3, Page:115 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\n", - "from thermodynamic temperature scale\n", - "Q1/Q2=T1/T2\n", - "so Q1=Q2*(T1/T2)in KJ/s 2.27\n", - "power/work input required(W)=Q1-Q2 in KJ/s \n", - "power required for driving refrigerator=W in KW 0.274\n" - ] - } - ], - "source": [ - "#cal of power required for driving refrigerator\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.3, Page:115 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\")\n", - "T1=315.;#temperature of reservoir 1 in K\n", - "T2=277.;#temperature of reservoir 2 in K\n", - "Q2=2.;#heat extracted in KJ/s\n", - "print(\"from thermodynamic temperature scale\")\n", - "print(\"Q1/Q2=T1/T2\")\n", - "Q1=Q2*(T1/T2)\n", - "print(\"so Q1=Q2*(T1/T2)in KJ/s\"),round(Q1,2)\n", - "print(\"power/work input required(W)=Q1-Q2 in KJ/s \")\n", - "W=Q1-Q2\n", - "print(\"power required for driving refrigerator=W in KW\"),round(W,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.4;pg no: 115" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.4, Page:115 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\n", - "we can writefor heat engine,Q1/Q2=T1/T2\n", - "so Q2=Q1*(T2/T1) in KJ 545.45\n", - "so We=in KJ 1454.55\n", - "for refrigerator,Q3/Q4=T3/T4 eq 1\n", - "now We-Wr=300\n", - "so Wr=We-300 in KJ 1154.55\n", - "and Wr=Q4-Q3=1154.55 KJ eq 2 \n", - "solving eq1 and eq 2 we get\n", - "Q4=in KJ 8659.13\n", - "and Q3=in KJ 7504.58\n", - "total heat transferred to low teperature reservoir(Q)=in KJ 9204.58\n", - "hence heat transferred to refrigerant=Q3 in KJ 7504.58\n", - "and heat transferred to low temperature reservoir=Q in KJ 9204.58\n" - ] - } - ], - "source": [ - "#cal of heat transferred to refrigerant and low temperature reservoir\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.4, Page:115 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\")\n", - "T1=(827.+273.);#temperature of high temperature reservoir in K\n", - "T2=(27.+273.);#temperature of low temperature reservoir in K\n", - "T3=(-13.+273.);#temperature of reservoir 3 in K\n", - "Q1=2000.;#heat ejected by reservoir 1 in KJ\n", - "print(\"we can writefor heat engine,Q1/Q2=T1/T2\")\n", - "Q2=Q1*(T2/T1)\n", - "print(\"so Q2=Q1*(T2/T1) in KJ\"),round(Q2,2)\n", - "We=Q1-Q2\n", - "print(\"so We=in KJ\"),round(We,2)\n", - "print(\"for refrigerator,Q3/Q4=T3/T4 eq 1\")\n", - "T4=T2;#temperature of low temperature reservoir in K\n", - "print(\"now We-Wr=300\")\n", - "Wr=We-300.\n", - "print(\"so Wr=We-300 in KJ\"),round(Wr,2)\n", - "print(\"and Wr=Q4-Q3=1154.55 KJ eq 2 \")\n", - "print(\"solving eq1 and eq 2 we get\")\n", - "Q4=(1154.55*T4)/(T4-T3)\n", - "print(\"Q4=in KJ\"),round(Q4,2)\n", - "Q3=Q4-Wr\n", - "print(\"and Q3=in KJ\"),round(Q3,2)\n", - "Q=Q2+Q4\n", - "print(\"total heat transferred to low teperature reservoir(Q)=in KJ\"),round(Q,2)\n", - "print(\"hence heat transferred to refrigerant=Q3 in KJ\"),round(Q3,2)\n", - "print(\"and heat transferred to low temperature reservoir=Q in KJ\"),round(Q,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.5;pg no: 116" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.5, Page:116 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\n", - "COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\n", - "also we know K=Q1/Q2=T1/T2\n", - "so K=T1/T2 1.1\n", - "so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K)) 11.0\n", - "also COP_HP=Q1/W\n", - "W=Q1/COin MJ/Hr 3.03\n", - "or W=1000*W/3600 in KW 3.03\n", - "so minimum power required(W)in KW 3.03\n" - ] - } - ], - "source": [ - "#cal of minimum power required\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.5, Page:116 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\")\n", - "T1=(25+273.15);#temperature of inside of house in K\n", - "T2=(-1+273.15);#outside temperature in K\n", - "Q1=125;#heating load in MJ/Hr\n", - "print(\"COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\")\n", - "print(\"also we know K=Q1/Q2=T1/T2\")\n", - "K=T1/T2\n", - "print(\"so K=T1/T2\"),round(K,2)\n", - "COP_HP=1/(1-(1/K))\n", - "print(\"so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K))\"),round(COP_HP)\n", - "print(\"also COP_HP=Q1/W\")\n", - "W=Q1/COP_HP\n", - "W=1000*W/3600\n", - "print(\"W=Q1/COin MJ/Hr\"),round(W,2)\n", - "print(\"or W=1000*W/3600 in KW\"),round(W,2)\n", - "print(\"so minimum power required(W)in KW \"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.6;pg no: 117" - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.6, Page:117 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\n", - "cold storage plant can be considered as refrigerator operating between given temperatures limits\n", - "capacity of plant=heat to be extracted=Q2 in KW\n", - "we know that,one ton of refrigeration as 3.52 KW \n", - "so Q2=Q2*3.52 in KW 140.8\n", - "carnot COP of plant(COP_carnot)= 5.18\n", - "performance is 1/4 of its carnot COP\n", - "COP=COP_carnot/4\n", - "also actual COP=Q2/W\n", - "W=Q2/COP in KW\n", - "hence power required(W)in KW 108.76\n" - ] - } - ], - "source": [ - "#cal of power required\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.6, Page:117 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\")\n", - "T1=(-15.+273.15);#inside temperature in K\n", - "T2=(35.+273.);#atmospheric temperature in K\n", - "Q2=40.;#refrigeration capacity of storage plant in tonnes\n", - "print(\"cold storage plant can be considered as refrigerator operating between given temperatures limits\")\n", - "print(\"capacity of plant=heat to be extracted=Q2 in KW\")\n", - "print(\"we know that,one ton of refrigeration as 3.52 KW \")\n", - "Q2=Q2*3.52\n", - "print(\"so Q2=Q2*3.52 in KW\"),round(Q2,2)\n", - "COP_carnot=1/((T2/T1)-1)\n", - "print(\"carnot COP of plant(COP_carnot)=\"),round(COP_carnot,2)\n", - "print(\"performance is 1/4 of its carnot COP\")\n", - "COP=COP_carnot/4\n", - "print(\"COP=COP_carnot/4\")\n", - "print(\"also actual COP=Q2/W\")\n", - "print(\"W=Q2/COP in KW\")\n", - "W=Q2/COP\n", - "print(\"hence power required(W)in KW\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.7;pg no: 117" - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.7, Page:117 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\n", - "highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\n", - "n= 0.79\n", - "or n=n*100 % 78.92\n" - ] - } - ], - "source": [ - "#cal of carnot cycle efficiency for given temperature limits\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.7, Page:117 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\")\n", - "T1=(1150.+273.);#temperature of source in K\n", - "T2=(27.+273.);#temperature of sink in K\n", - "print(\"highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\")\n", - "n=1-(T2/T1)\n", - "print(\"n=\"),round(n,2)\n", - "n=n*100\n", - "print(\"or n=n*100 %\"),round(n,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.8;pg no: 117" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.8, Page:117 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\n", - "here heat to be removed continuously from refrigerated space(Q)in KJ/s 0.13\n", - "for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\n", - "W=in KW 0.02\n", - "so power required(W)in KW 0.02\n" - ] - } - ], - "source": [ - "#cal of power required\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.8, Page:117 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\")\n", - "T1=(27.+273.);#temperature of source in K\n", - "T2=(-8.+273.);#temperature of sink in K\n", - "Q=7.5;#heat leakage in KJ/min\n", - "Q=Q/60.\n", - "print(\"here heat to be removed continuously from refrigerated space(Q)in KJ/s\"),round(Q,2)\n", - "print(\"for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\")\n", - "W=Q*((T1/T2)-1)\n", - "print(\"W=in KW\"),round(W,2)\n", - "print(\"so power required(W)in KW\"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.9;pg no: 118" - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.9, Page:118 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\n", - "here W1:W2:W3=3:2:1\n", - "efficiency of engine,HE1,\n", - "W1/Q1=(1-(T2/1100))\n", - "so Q1=(1100*W1)/(1100-T2)\n", - "for HE2 engine,W2/Q2=(1-(T3/T2))\n", - "for HE3 engine,W3/Q3=(1-(300/T3))\n", - "from energy balance on engine,HE1\n", - "Q1=W1+Q2=>Q2=Q1-W1\n", - "above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\n", - "substituting Q2 in efficiency of HE2\n", - "W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\n", - "W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\n", - "2/3=(T2-T3)/(1100-T2)\n", - "2200-2*T2=3*T2-3*T3\n", - "5*T2-3*T3=2200\n", - "now energy balance on engine HE2 gives,Q2=W2+Q3\n", - "substituting in efficiency of HE2,\n", - "W2/(W2+Q3)=(T2-T3)/T2\n", - "W2*T2=(W2+Q3)*(T2-T3)\n", - "Q3=(W2*T3)/(T2-T3)\n", - "substituting Q3 in efficiency of HE3,\n", - "W3/((W2*T3)/(T2-T3))=(T3-300)/T3\n", - "W3/W2=(T3/(T2-T3))*(T3-300)/T3\n", - "1/2=(T3-300)/(T2-T3)\n", - "3*T3-T2=600\n", - "solving equations of T2 and T3,\n", - "we get,T3=in K 433.33\n", - "and by eq 5,T2 in K 700.0\n", - "so intermediate temperature are 700 K and 433.33 K\n" - ] - } - ], - "source": [ - "#cal of intermediate temperatures\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.9, Page:118 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\")\n", - "T1=1100;#temperature of high temperature reservoir in K\n", - "T4=300;#temperature of low temperature reservoir in K\n", - "print(\"here W1:W2:W3=3:2:1\")\n", - "print(\"efficiency of engine,HE1,\")\n", - "print(\"W1/Q1=(1-(T2/1100))\")\n", - "print(\"so Q1=(1100*W1)/(1100-T2)\")\n", - "print(\"for HE2 engine,W2/Q2=(1-(T3/T2))\")\n", - "print(\"for HE3 engine,W3/Q3=(1-(300/T3))\")\n", - "print(\"from energy balance on engine,HE1\")\n", - "print(\"Q1=W1+Q2=>Q2=Q1-W1\")\n", - "print(\"above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\")\n", - "print(\"substituting Q2 in efficiency of HE2\")\n", - "print(\"W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\")\n", - "print(\"W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\")\n", - "print(\"2/3=(T2-T3)/(1100-T2)\")\n", - "print(\"2200-2*T2=3*T2-3*T3\")\n", - "print(\"5*T2-3*T3=2200\")\n", - "print(\"now energy balance on engine HE2 gives,Q2=W2+Q3\")\n", - "print(\"substituting in efficiency of HE2,\")\n", - "print(\"W2/(W2+Q3)=(T2-T3)/T2\")\n", - "print(\"W2*T2=(W2+Q3)*(T2-T3)\")\n", - "print(\"Q3=(W2*T3)/(T2-T3)\")\n", - "print(\"substituting Q3 in efficiency of HE3,\")\n", - "print(\"W3/((W2*T3)/(T2-T3))=(T3-300)/T3\")\n", - "print(\"W3/W2=(T3/(T2-T3))*(T3-300)/T3\")\n", - "print(\"1/2=(T3-300)/(T2-T3)\")\n", - "print(\"3*T3-T2=600\")\n", - "print(\"solving equations of T2 and T3,\")\n", - "T3=(600.+(2200./5.))/(3.-(3./5.))\n", - "print(\"we get,T3=in K\"),round(T3,2)\n", - "T2=(2200.+3.*T3)/5.\n", - "print(\"and by eq 5,T2 in K\"),round(T2,2)\n", - "print(\"so intermediate temperature are 700 K and 433.33 K\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.10;pg no: 119" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.10, Page:119 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\n", - "efficiency of engine,W/Q1=(800-T)/800\n", - "for refrigerator,COP=Q3/W=280/(T-280)\n", - "it is given that Q1=Q3=Q\n", - "so,from engine,W/Q=(800-T)/800\n", - "from refrigerator,Q/W=280/(T-280)\n", - "from above two(Q/W)may be equated,\n", - "(T-280)/280=(800-T)/800\n", - "so temperature(T)in K 414.81\n", - "efficiency of engine(n)is given as\n", - "n= 0.48\n", - "COP of refrigerator is given as\n", - "COP= 2.08\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.10, Page:119 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\")\n", - "T1=800.;#temperature of source in K\n", - "T2=280.;#temperature of sink in K\n", - "print(\"efficiency of engine,W/Q1=(800-T)/800\")\n", - "print(\"for refrigerator,COP=Q3/W=280/(T-280)\")\n", - "print(\"it is given that Q1=Q3=Q\")\n", - "print(\"so,from engine,W/Q=(800-T)/800\")\n", - "print(\"from refrigerator,Q/W=280/(T-280)\")\n", - "print(\"from above two(Q/W)may be equated,\")\n", - "print(\"(T-280)/280=(800-T)/800\")\n", - "T=2.*280.*800./(800.+280.)\n", - "print(\"so temperature(T)in K\"),round(T,2)\n", - "print(\"efficiency of engine(n)is given as\")\n", - "n=(800.-T)/800.\n", - "print(\"n=\"),round(n,2)\n", - "print(\"COP of refrigerator is given as\")\n", - "COP=280./(T-280.)\n", - "print(\"COP=\"),round(COP,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.11;pg no: 120" - ] - }, - { - "cell_type": "code", - "execution_count": 39, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.11, Page:120 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\n", - "let thermodynamic properties be denoted with respect to salient states;\n", - "n_carnot=1-T1/T2\n", - "so T1/T2=1-0.5\n", - "so T1/T2=0.5\n", - "or T2=2*T1\n", - "corresponding to state 2,p2*v2=m*R*T2\n", - "so temperature(T2) in K= 585.37\n", - "heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\n", - "Q_23=W_23=p2*v2*log(v3/v2)\n", - "so volume(v3) in m^3= 0.1932\n", - "temperature at state 1,T1 in K= 292.68\n", - "during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\n", - "here expansion constant(y)=Cp/Cv\n", - "so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\n", - "p1 in bar\n", - "thus p1*v1=m*R*T1\n", - "so volume(v1) in m^3= 0.68\n", - "heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\n", - "for isentropic process,dQ=0,dW=dU\n", - "during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\n", - "Q_12=0,\n", - "W_12=-105.51 KJ(-ve work)\n", - "during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\n", - "Q_31=0,\n", - "ANS:\n", - "W_34=+105.51 KJ(+ve work)\n", - "so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\n", - "for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\n", - "for process 3-4,heat transfer=0,work interaction=+105.51 KJ\n", - "for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\n", - "maximum temperature of cycle=585.36 KJ\n", - "minimum temperature of cycle=292.68 KJ\n", - "volume at the end of isothermal expansion=0.1932 m^3\n" - ] - } - ], - "source": [ - "#cal of max and min temp of cycle,volume\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "import math\n", - "print\"Example 4.11, Page:120 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\")\n", - "n_carnot=0.5;#efficiency of carnot power cycle\n", - "m=0.5;#mass of air in kg\n", - "p2=7.*10**5;#final pressure in pa\n", - "v2=0.12;#volume in m^3\n", - "R=287.;#gas constant in J/kg K\n", - "Q_23=40.*1000.;#heat transfer to the air during isothermal expansion in J\n", - "Cp=1.008;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.721;#specific heat at constant volume in KJ/kg K\n", - "print(\"let thermodynamic properties be denoted with respect to salient states;\")\n", - "print(\"n_carnot=1-T1/T2\")\n", - "print(\"so T1/T2=1-0.5\")\n", - "1-0.5\n", - "print(\"so T1/T2=0.5\")\n", - "print(\"or T2=2*T1\")\n", - "print(\"corresponding to state 2,p2*v2=m*R*T2\")\n", - "T2=p2*v2/(m*R)\n", - "print(\"so temperature(T2) in K=\"),round(T2,2)\n", - "print(\"heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\")\n", - "print(\"Q_23=W_23=p2*v2*log(v3/v2)\")\n", - "v3=v2*math.exp(Q_23/(p2*v2))\n", - "print(\"so volume(v3) in m^3=\"),round(v3,4)\n", - "T1=T2/2\n", - "print(\"temperature at state 1,T1 in K=\"),round(T1,2)\n", - "print(\"during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\")\n", - "print(\"here expansion constant(y)=Cp/Cv\")\n", - "y=Cp/Cv\n", - "print(\"so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\")\n", - "p1=p2/(T2/T1)**(y/(y-1))\n", - "print(\"p1 in bar\")\n", - "p1=p1/10**5\n", - "print(\"thus p1*v1=m*R*T1\")\n", - "v1=m*R*T1/(p1*10**5)\n", - "print(\"so volume(v1) in m^3=\"),round(v1,2) \n", - "print(\"heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\")\n", - "print(\"for isentropic process,dQ=0,dW=dU\")\n", - "print(\"during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\")\n", - "print(\"Q_12=0,\")\n", - "W_12=-m*Cv*(T2-T1)\n", - "print(\"W_12=-105.51 KJ(-ve work)\")\n", - "print(\"during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\")\n", - "print(\"Q_31=0,\")\n", - "T4=T1;\n", - "T3=T2;\n", - "W_34=-m*Cv*(T4-T3)\n", - "print(\"ANS:\")\n", - "print(\"W_34=+105.51 KJ(+ve work)\")\n", - "print(\"so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\")\n", - "print(\"for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\")\n", - "print(\"for process 3-4,heat transfer=0,work interaction=+105.51 KJ\")\n", - "print(\"for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\")\n", - "print(\"maximum temperature of cycle=585.36 KJ\")\n", - "print(\"minimum temperature of cycle=292.68 KJ\")\n", - "print(\"volume at the end of isothermal expansion=0.1932 m^3\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.12;pg no: 122" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.12, Page:122 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\n", - "let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\n", - "thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\n", - "Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\n", - "Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\n", - "substituting Q1_a and Q1_b in eq 1\n", - "4*Q2/3+2*Q3=5000...............eq4\n", - "also from total work output,Q1_a+Q1_b-Q2-Q3=W\n", - "5000-Q2-Q3=840\n", - "so Q2+Q3=5000-840=4160\n", - "Q3=4160-Q2\n", - "sunstituting Q3 in eq 4\n", - "4*Q2/3+2*(4160-Q2)=5000\n", - "so Q2=in KJ 4980.0\n", - "and Q3= in KJ 820.0\n", - "here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\n", - "Q2=4980 KJ,from heat engine\n", - "Q3=820 KJ,to heat engine\n" - ] - } - ], - "source": [ - "#cal of heat from from heat engine and to heat engine\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.12, Page:122 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\")\n", - "W=840.;#work done by reservoir in KJ\n", - "print(\"let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\")\n", - "print(\"thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\")\n", - "print(\"Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\")\n", - "print(\"Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\")\n", - "print(\"substituting Q1_a and Q1_b in eq 1\")\n", - "print(\"4*Q2/3+2*Q3=5000...............eq4\")\n", - "print(\"also from total work output,Q1_a+Q1_b-Q2-Q3=W\")\n", - "print(\"5000-Q2-Q3=840\")\n", - "print(\"so Q2+Q3=5000-840=4160\")\n", - "print(\"Q3=4160-Q2\")\n", - "print(\"sunstituting Q3 in eq 4\")\n", - "print(\"4*Q2/3+2*(4160-Q2)=5000\")\n", - "Q2=(5000.-2.*4160.)/((4./3.)-2.)\n", - "print(\"so Q2=in KJ\"),round(Q2,2)\n", - "Q3=4160.-Q2\n", - "print(\"and Q3= in KJ\"),round(-Q3,2)\n", - "print(\"here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\")\n", - "print(\"Q2=4980 KJ,from heat engine\")\n", - "print(\"Q3=820 KJ,to heat engine\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.13;pg no: 123" - ] - }, - { - "cell_type": "code", - "execution_count": 41, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.13, Page:123 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\n", - "arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\n", - "for heat engine\n", - "ne=W/Q1=1-T2/T1\n", - "so (Q1-Q2)/Q1=\n", - "and Q2/Q1=\n", - "Q2=0.2593*Q1\n", - "for heat pump,\n", - "COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\n", - "Q4/Q3=\n", - "Q4=1.27*Q3\n", - "work output from engine =work input to pump\n", - "Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\n", - "so Q4/Q1=\n", - "so Q4=3.484*Q1\n", - "also it is given that Q2+Q4=100\n", - "subtituting Q2 and Q4 as function of Q1 in following expression,\n", - "Q2+Q4=100\n", - "so 0.2539*Q1+3.484*Q1=100\n", - "so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\n", - "Q1=100/(0.2539+3.484)in KJ 26.75\n", - "NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\n" - ] - } - ], - "source": [ - "#cal of energy taken by engine from reservoir\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.13, Page:123 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\")\n", - "T2=(77+273);#temperature of reservoir 2\n", - "T1=(1077+273);#temperature of reservoir 1\n", - "T3=(3+273);#temperature of reservoir 3\n", - "print(\"arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\")\n", - "print(\"for heat engine\")\n", - "print(\"ne=W/Q1=1-T2/T1\")\n", - "print(\"so (Q1-Q2)/Q1=\")\n", - "1-T2/T1\n", - "print(\"and Q2/Q1=\")\n", - "1-0.7407\n", - "print(\"Q2=0.2593*Q1\")\n", - "print(\"for heat pump,\")\n", - "print(\"COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\")\n", - "T4=T2;\n", - "T4/(T4-T3)\n", - "print(\"Q4/Q3=\")\n", - "4.73/3.73\n", - "print(\"Q4=1.27*Q3\")\n", - "print(\"work output from engine =work input to pump\")\n", - "print(\"Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\")\n", - "print(\"so Q4/Q1=\")\n", - "(1-0.2593)/(1-(1/1.27))\n", - "print(\"so Q4=3.484*Q1\")\n", - "print(\"also it is given that Q2+Q4=100\")\n", - "print(\"subtituting Q2 and Q4 as function of Q1 in following expression,\")\n", - "print(\"Q2+Q4=100\")\n", - "print(\"so 0.2539*Q1+3.484*Q1=100\")\n", - "print(\"so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\")\n", - "Q1=100/(0.2539+3.484)\n", - "print(\"Q1=100/(0.2539+3.484)in KJ\"),round(Q1,2)\n", - "print(\"NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.14;pg no: 124" - ] - }, - { - "cell_type": "code", - "execution_count": 42, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.14, Page:124 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\n", - "let temperature of sink be T_sink K\n", - "Q_sink_HE+Q_sink_R=3000 ........eq 1\n", - "since complete work output from engine is used to run refrigerator so,\n", - "2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\n", - "by eq 1 and eq 2,we get Q_R in KJ/s 1000.0\n", - "also for heat engine,2000/1500=Q_sink_HE/T_sink\n", - "=>Q_sink_HE=4*T_sink/3\n", - "for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\n", - "substituting Q_sink_HE and Q_sink_R values\n", - "4*T_sink/3+1000*T_sink/288=3000\n", - "so temperature of sink(T_sink)in K\n", - "so T_sink= 750.0\n", - "T_sink in degree celcius 477.0\n" - ] - } - ], - "source": [ - "#cal of T_sink in degree celcius\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.14, Page:124 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\")\n", - "Q_source=2000;#heat supplied by heat engine in KJ/s\n", - "T_source=1500;#temperature of source in K\n", - "T_R=(15+273);#temperature of reservoir in K\n", - "Q_sink=3000;#heat received by sink in KJ/s\n", - "print(\"let temperature of sink be T_sink K\")\n", - "print(\"Q_sink_HE+Q_sink_R=3000 ........eq 1\")\n", - "print(\"since complete work output from engine is used to run refrigerator so,\")\n", - "print(\"2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\")\n", - "Q_R=3000-2000\n", - "print(\"by eq 1 and eq 2,we get Q_R in KJ/s\"),round(Q_R)\n", - "print(\"also for heat engine,2000/1500=Q_sink_HE/T_sink\")\n", - "print(\"=>Q_sink_HE=4*T_sink/3\")\n", - "print(\"for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\")\n", - "print(\"substituting Q_sink_HE and Q_sink_R values\")\n", - "print(\"4*T_sink/3+1000*T_sink/288=3000\")\n", - "print(\"so temperature of sink(T_sink)in K\")\n", - "T_sink=3000/((4/3)+(1000/288))\n", - "print(\"so T_sink=\"),round(T_sink,2)\n", - "T_sink=T_sink-273\n", - "print(\"T_sink in degree celcius\"),round(T_sink,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.15;pg no: 124" - ] - }, - { - "cell_type": "code", - "execution_count": 45, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.15, Page:124 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\n", - "let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\n", - "n=W/Q1= 0.39\n", - "so n=W/Q1=0.3881\n", - "COP of heat pump=T3/(T3-T2)=Q3/(2*W/3) 2.89\n", - "so 2.892=3*Q3/2*W\n", - "Q3/Q1= 0.7483\n", - "so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\n" - ] - } - ], - "source": [ - "#cal of heat transferred to refrigerant and low temperature reservoir\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.15, Page:124 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\")\n", - "T1=(500.+273.);#temperature of source in K\n", - "T2=(200.+273.);#temperature of sink in K\n", - "T3=(450.+273.);#temperature of body in K\n", - "print(\"let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\")\n", - "n=1-(T2/T1)\n", - "print(\"n=W/Q1=\"),round(n,2)\n", - "print(\"so n=W/Q1=0.3881\")\n", - "COP=T3/(T3-T2)\n", - "print(\"COP of heat pump=T3/(T3-T2)=Q3/(2*W/3)\"),round(COP,2)\n", - "print(\"so 2.892=3*Q3/2*W\")\n", - "print(\"Q3/Q1=\"),round(2*COP*n/3,4)\n", - "print(\"so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.16;pg no: 125" - ] - }, - { - "cell_type": "code", - "execution_count": 48, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.16, Page:125 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\n", - "NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.16, Page:125 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\")\n", - "print(\"NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.17;pg no: 126" - ] - }, - { - "cell_type": "code", - "execution_count": 47, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.17, Page:126 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\n", - "NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.17, Page:126 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\")\n", - "print(\"NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter4_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter4_2.ipynb deleted file mode 100755 index bb4a3703..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter4_2.ipynb +++ /dev/null @@ -1,1070 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4:Second Law of Thermo Dynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.1;pg no: 113" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.1, Page:113 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\n", - "NOTE=>This question is fully theoritical hence cannot be solve using scilab.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.1, Page:113 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\")\n", - "print(\"NOTE=>This question is fully theoritical hence cannot be solve using scilab.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.2;pg no: 114" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.2, Page:114 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\n", - "in carnot engine from thermodynamics temperature scale\n", - "Q1/Q2=T1/T2\n", - "W=Q1-Q2=200 KJ\n", - "from above equations Q1 in KJ is given by\n", - "Q1= 349.61\n", - "and Q2 in KJ\n", - "Q2=Q1-200 149.61\n", - "so heat supplied(Q1) in KJ 349.6\n" - ] - } - ], - "source": [ - "#cal of heat supplied\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.2, Page:114 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\")\n", - "T1=(400.+273.);#temperature of source in K\n", - "T2=(15.+273.);#temperature of sink in K\n", - "W=200.;#work done in KJ\n", - "print(\"in carnot engine from thermodynamics temperature scale\")\n", - "print(\"Q1/Q2=T1/T2\")\n", - "print(\"W=Q1-Q2=200 KJ\")\n", - "print(\"from above equations Q1 in KJ is given by\")\n", - "Q1=(200*T1)/(T1-T2)\n", - "print(\"Q1=\"),round(Q1,2)\n", - "print(\"and Q2 in KJ\")\n", - "Q2=Q1-200\n", - "print(\"Q2=Q1-200\"),round(Q2,2)\n", - "print(\"so heat supplied(Q1) in KJ\"),round(Q1,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.3;pg no: 115" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.3, Page:115 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\n", - "from thermodynamic temperature scale\n", - "Q1/Q2=T1/T2\n", - "so Q1=Q2*(T1/T2)in KJ/s 2.27\n", - "power/work input required(W)=Q1-Q2 in KJ/s \n", - "power required for driving refrigerator=W in KW 0.274\n" - ] - } - ], - "source": [ - "#cal of power required for driving refrigerator\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.3, Page:115 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\")\n", - "T1=315.;#temperature of reservoir 1 in K\n", - "T2=277.;#temperature of reservoir 2 in K\n", - "Q2=2.;#heat extracted in KJ/s\n", - "print(\"from thermodynamic temperature scale\")\n", - "print(\"Q1/Q2=T1/T2\")\n", - "Q1=Q2*(T1/T2)\n", - "print(\"so Q1=Q2*(T1/T2)in KJ/s\"),round(Q1,2)\n", - "print(\"power/work input required(W)=Q1-Q2 in KJ/s \")\n", - "W=Q1-Q2\n", - "print(\"power required for driving refrigerator=W in KW\"),round(W,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.4;pg no: 115" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.4, Page:115 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\n", - "we can writefor heat engine,Q1/Q2=T1/T2\n", - "so Q2=Q1*(T2/T1) in KJ 545.45\n", - "so We=in KJ 1454.55\n", - "for refrigerator,Q3/Q4=T3/T4 eq 1\n", - "now We-Wr=300\n", - "so Wr=We-300 in KJ 1154.55\n", - "and Wr=Q4-Q3=1154.55 KJ eq 2 \n", - "solving eq1 and eq 2 we get\n", - "Q4=in KJ 8659.13\n", - "and Q3=in KJ 7504.58\n", - "total heat transferred to low teperature reservoir(Q)=in KJ 9204.58\n", - "hence heat transferred to refrigerant=Q3 in KJ 7504.58\n", - "and heat transferred to low temperature reservoir=Q in KJ 9204.58\n" - ] - } - ], - "source": [ - "#cal of heat transferred to refrigerant and low temperature reservoir\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.4, Page:115 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\")\n", - "T1=(827.+273.);#temperature of high temperature reservoir in K\n", - "T2=(27.+273.);#temperature of low temperature reservoir in K\n", - "T3=(-13.+273.);#temperature of reservoir 3 in K\n", - "Q1=2000.;#heat ejected by reservoir 1 in KJ\n", - "print(\"we can writefor heat engine,Q1/Q2=T1/T2\")\n", - "Q2=Q1*(T2/T1)\n", - "print(\"so Q2=Q1*(T2/T1) in KJ\"),round(Q2,2)\n", - "We=Q1-Q2\n", - "print(\"so We=in KJ\"),round(We,2)\n", - "print(\"for refrigerator,Q3/Q4=T3/T4 eq 1\")\n", - "T4=T2;#temperature of low temperature reservoir in K\n", - "print(\"now We-Wr=300\")\n", - "Wr=We-300.\n", - "print(\"so Wr=We-300 in KJ\"),round(Wr,2)\n", - "print(\"and Wr=Q4-Q3=1154.55 KJ eq 2 \")\n", - "print(\"solving eq1 and eq 2 we get\")\n", - "Q4=(1154.55*T4)/(T4-T3)\n", - "print(\"Q4=in KJ\"),round(Q4,2)\n", - "Q3=Q4-Wr\n", - "print(\"and Q3=in KJ\"),round(Q3,2)\n", - "Q=Q2+Q4\n", - "print(\"total heat transferred to low teperature reservoir(Q)=in KJ\"),round(Q,2)\n", - "print(\"hence heat transferred to refrigerant=Q3 in KJ\"),round(Q3,2)\n", - "print(\"and heat transferred to low temperature reservoir=Q in KJ\"),round(Q,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.5;pg no: 116" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.5, Page:116 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\n", - "COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\n", - "also we know K=Q1/Q2=T1/T2\n", - "so K=T1/T2 1.1\n", - "so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K)) 11.0\n", - "also COP_HP=Q1/W\n", - "W=Q1/COin MJ/Hr 3.03\n", - "or W=1000*W/3600 in KW 3.03\n", - "so minimum power required(W)in KW 3.03\n" - ] - } - ], - "source": [ - "#cal of minimum power required\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.5, Page:116 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\")\n", - "T1=(25+273.15);#temperature of inside of house in K\n", - "T2=(-1+273.15);#outside temperature in K\n", - "Q1=125;#heating load in MJ/Hr\n", - "print(\"COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\")\n", - "print(\"also we know K=Q1/Q2=T1/T2\")\n", - "K=T1/T2\n", - "print(\"so K=T1/T2\"),round(K,2)\n", - "COP_HP=1/(1-(1/K))\n", - "print(\"so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K))\"),round(COP_HP)\n", - "print(\"also COP_HP=Q1/W\")\n", - "W=Q1/COP_HP\n", - "W=1000*W/3600\n", - "print(\"W=Q1/COin MJ/Hr\"),round(W,2)\n", - "print(\"or W=1000*W/3600 in KW\"),round(W,2)\n", - "print(\"so minimum power required(W)in KW \"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.6;pg no: 117" - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.6, Page:117 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\n", - "cold storage plant can be considered as refrigerator operating between given temperatures limits\n", - "capacity of plant=heat to be extracted=Q2 in KW\n", - "we know that,one ton of refrigeration as 3.52 KW \n", - "so Q2=Q2*3.52 in KW 140.8\n", - "carnot COP of plant(COP_carnot)= 5.18\n", - "performance is 1/4 of its carnot COP\n", - "COP=COP_carnot/4\n", - "also actual COP=Q2/W\n", - "W=Q2/COP in KW\n", - "hence power required(W)in KW 108.76\n" - ] - } - ], - "source": [ - "#cal of power required\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.6, Page:117 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\")\n", - "T1=(-15.+273.15);#inside temperature in K\n", - "T2=(35.+273.);#atmospheric temperature in K\n", - "Q2=40.;#refrigeration capacity of storage plant in tonnes\n", - "print(\"cold storage plant can be considered as refrigerator operating between given temperatures limits\")\n", - "print(\"capacity of plant=heat to be extracted=Q2 in KW\")\n", - "print(\"we know that,one ton of refrigeration as 3.52 KW \")\n", - "Q2=Q2*3.52\n", - "print(\"so Q2=Q2*3.52 in KW\"),round(Q2,2)\n", - "COP_carnot=1/((T2/T1)-1)\n", - "print(\"carnot COP of plant(COP_carnot)=\"),round(COP_carnot,2)\n", - "print(\"performance is 1/4 of its carnot COP\")\n", - "COP=COP_carnot/4\n", - "print(\"COP=COP_carnot/4\")\n", - "print(\"also actual COP=Q2/W\")\n", - "print(\"W=Q2/COP in KW\")\n", - "W=Q2/COP\n", - "print(\"hence power required(W)in KW\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.7;pg no: 117" - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.7, Page:117 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\n", - "highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\n", - "n= 0.79\n", - "or n=n*100 % 78.92\n" - ] - } - ], - "source": [ - "#cal of carnot cycle efficiency for given temperature limits\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.7, Page:117 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\")\n", - "T1=(1150.+273.);#temperature of source in K\n", - "T2=(27.+273.);#temperature of sink in K\n", - "print(\"highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\")\n", - "n=1-(T2/T1)\n", - "print(\"n=\"),round(n,2)\n", - "n=n*100\n", - "print(\"or n=n*100 %\"),round(n,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.8;pg no: 117" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.8, Page:117 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\n", - "here heat to be removed continuously from refrigerated space(Q)in KJ/s 0.13\n", - "for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\n", - "W=in KW 0.02\n", - "so power required(W)in KW 0.02\n" - ] - } - ], - "source": [ - "#cal of power required\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.8, Page:117 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\")\n", - "T1=(27.+273.);#temperature of source in K\n", - "T2=(-8.+273.);#temperature of sink in K\n", - "Q=7.5;#heat leakage in KJ/min\n", - "Q=Q/60.\n", - "print(\"here heat to be removed continuously from refrigerated space(Q)in KJ/s\"),round(Q,2)\n", - "print(\"for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\")\n", - "W=Q*((T1/T2)-1)\n", - "print(\"W=in KW\"),round(W,2)\n", - "print(\"so power required(W)in KW\"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.9;pg no: 118" - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.9, Page:118 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\n", - "here W1:W2:W3=3:2:1\n", - "efficiency of engine,HE1,\n", - "W1/Q1=(1-(T2/1100))\n", - "so Q1=(1100*W1)/(1100-T2)\n", - "for HE2 engine,W2/Q2=(1-(T3/T2))\n", - "for HE3 engine,W3/Q3=(1-(300/T3))\n", - "from energy balance on engine,HE1\n", - "Q1=W1+Q2=>Q2=Q1-W1\n", - "above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\n", - "substituting Q2 in efficiency of HE2\n", - "W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\n", - "W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\n", - "2/3=(T2-T3)/(1100-T2)\n", - "2200-2*T2=3*T2-3*T3\n", - "5*T2-3*T3=2200\n", - "now energy balance on engine HE2 gives,Q2=W2+Q3\n", - "substituting in efficiency of HE2,\n", - "W2/(W2+Q3)=(T2-T3)/T2\n", - "W2*T2=(W2+Q3)*(T2-T3)\n", - "Q3=(W2*T3)/(T2-T3)\n", - "substituting Q3 in efficiency of HE3,\n", - "W3/((W2*T3)/(T2-T3))=(T3-300)/T3\n", - "W3/W2=(T3/(T2-T3))*(T3-300)/T3\n", - "1/2=(T3-300)/(T2-T3)\n", - "3*T3-T2=600\n", - "solving equations of T2 and T3,\n", - "we get,T3=in K 433.33\n", - "and by eq 5,T2 in K 700.0\n", - "so intermediate temperature are 700 K and 433.33 K\n" - ] - } - ], - "source": [ - "#cal of intermediate temperatures\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.9, Page:118 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\")\n", - "T1=1100;#temperature of high temperature reservoir in K\n", - "T4=300;#temperature of low temperature reservoir in K\n", - "print(\"here W1:W2:W3=3:2:1\")\n", - "print(\"efficiency of engine,HE1,\")\n", - "print(\"W1/Q1=(1-(T2/1100))\")\n", - "print(\"so Q1=(1100*W1)/(1100-T2)\")\n", - "print(\"for HE2 engine,W2/Q2=(1-(T3/T2))\")\n", - "print(\"for HE3 engine,W3/Q3=(1-(300/T3))\")\n", - "print(\"from energy balance on engine,HE1\")\n", - "print(\"Q1=W1+Q2=>Q2=Q1-W1\")\n", - "print(\"above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\")\n", - "print(\"substituting Q2 in efficiency of HE2\")\n", - "print(\"W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\")\n", - "print(\"W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\")\n", - "print(\"2/3=(T2-T3)/(1100-T2)\")\n", - "print(\"2200-2*T2=3*T2-3*T3\")\n", - "print(\"5*T2-3*T3=2200\")\n", - "print(\"now energy balance on engine HE2 gives,Q2=W2+Q3\")\n", - "print(\"substituting in efficiency of HE2,\")\n", - "print(\"W2/(W2+Q3)=(T2-T3)/T2\")\n", - "print(\"W2*T2=(W2+Q3)*(T2-T3)\")\n", - "print(\"Q3=(W2*T3)/(T2-T3)\")\n", - "print(\"substituting Q3 in efficiency of HE3,\")\n", - "print(\"W3/((W2*T3)/(T2-T3))=(T3-300)/T3\")\n", - "print(\"W3/W2=(T3/(T2-T3))*(T3-300)/T3\")\n", - "print(\"1/2=(T3-300)/(T2-T3)\")\n", - "print(\"3*T3-T2=600\")\n", - "print(\"solving equations of T2 and T3,\")\n", - "T3=(600.+(2200./5.))/(3.-(3./5.))\n", - "print(\"we get,T3=in K\"),round(T3,2)\n", - "T2=(2200.+3.*T3)/5.\n", - "print(\"and by eq 5,T2 in K\"),round(T2,2)\n", - "print(\"so intermediate temperature are 700 K and 433.33 K\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.10;pg no: 119" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.10, Page:119 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\n", - "efficiency of engine,W/Q1=(800-T)/800\n", - "for refrigerator,COP=Q3/W=280/(T-280)\n", - "it is given that Q1=Q3=Q\n", - "so,from engine,W/Q=(800-T)/800\n", - "from refrigerator,Q/W=280/(T-280)\n", - "from above two(Q/W)may be equated,\n", - "(T-280)/280=(800-T)/800\n", - "so temperature(T)in K 414.81\n", - "efficiency of engine(n)is given as\n", - "n= 0.48\n", - "COP of refrigerator is given as\n", - "COP= 2.08\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.10, Page:119 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\")\n", - "T1=800.;#temperature of source in K\n", - "T2=280.;#temperature of sink in K\n", - "print(\"efficiency of engine,W/Q1=(800-T)/800\")\n", - "print(\"for refrigerator,COP=Q3/W=280/(T-280)\")\n", - "print(\"it is given that Q1=Q3=Q\")\n", - "print(\"so,from engine,W/Q=(800-T)/800\")\n", - "print(\"from refrigerator,Q/W=280/(T-280)\")\n", - "print(\"from above two(Q/W)may be equated,\")\n", - "print(\"(T-280)/280=(800-T)/800\")\n", - "T=2.*280.*800./(800.+280.)\n", - "print(\"so temperature(T)in K\"),round(T,2)\n", - "print(\"efficiency of engine(n)is given as\")\n", - "n=(800.-T)/800.\n", - "print(\"n=\"),round(n,2)\n", - "print(\"COP of refrigerator is given as\")\n", - "COP=280./(T-280.)\n", - "print(\"COP=\"),round(COP,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.11;pg no: 120" - ] - }, - { - "cell_type": "code", - "execution_count": 39, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.11, Page:120 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\n", - "let thermodynamic properties be denoted with respect to salient states;\n", - "n_carnot=1-T1/T2\n", - "so T1/T2=1-0.5\n", - "so T1/T2=0.5\n", - "or T2=2*T1\n", - "corresponding to state 2,p2*v2=m*R*T2\n", - "so temperature(T2) in K= 585.37\n", - "heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\n", - "Q_23=W_23=p2*v2*log(v3/v2)\n", - "so volume(v3) in m^3= 0.1932\n", - "temperature at state 1,T1 in K= 292.68\n", - "during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\n", - "here expansion constant(y)=Cp/Cv\n", - "so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\n", - "p1 in bar\n", - "thus p1*v1=m*R*T1\n", - "so volume(v1) in m^3= 0.68\n", - "heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\n", - "for isentropic process,dQ=0,dW=dU\n", - "during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\n", - "Q_12=0,\n", - "W_12=-105.51 KJ(-ve work)\n", - "during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\n", - "Q_31=0,\n", - "ANS:\n", - "W_34=+105.51 KJ(+ve work)\n", - "so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\n", - "for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\n", - "for process 3-4,heat transfer=0,work interaction=+105.51 KJ\n", - "for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\n", - "maximum temperature of cycle=585.36 KJ\n", - "minimum temperature of cycle=292.68 KJ\n", - "volume at the end of isothermal expansion=0.1932 m^3\n" - ] - } - ], - "source": [ - "#cal of max and min temp of cycle,volume\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "import math\n", - "print\"Example 4.11, Page:120 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\")\n", - "n_carnot=0.5;#efficiency of carnot power cycle\n", - "m=0.5;#mass of air in kg\n", - "p2=7.*10**5;#final pressure in pa\n", - "v2=0.12;#volume in m^3\n", - "R=287.;#gas constant in J/kg K\n", - "Q_23=40.*1000.;#heat transfer to the air during isothermal expansion in J\n", - "Cp=1.008;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.721;#specific heat at constant volume in KJ/kg K\n", - "print(\"let thermodynamic properties be denoted with respect to salient states;\")\n", - "print(\"n_carnot=1-T1/T2\")\n", - "print(\"so T1/T2=1-0.5\")\n", - "1-0.5\n", - "print(\"so T1/T2=0.5\")\n", - "print(\"or T2=2*T1\")\n", - "print(\"corresponding to state 2,p2*v2=m*R*T2\")\n", - "T2=p2*v2/(m*R)\n", - "print(\"so temperature(T2) in K=\"),round(T2,2)\n", - "print(\"heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\")\n", - "print(\"Q_23=W_23=p2*v2*log(v3/v2)\")\n", - "v3=v2*math.exp(Q_23/(p2*v2))\n", - "print(\"so volume(v3) in m^3=\"),round(v3,4)\n", - "T1=T2/2\n", - "print(\"temperature at state 1,T1 in K=\"),round(T1,2)\n", - "print(\"during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\")\n", - "print(\"here expansion constant(y)=Cp/Cv\")\n", - "y=Cp/Cv\n", - "print(\"so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\")\n", - "p1=p2/(T2/T1)**(y/(y-1))\n", - "print(\"p1 in bar\")\n", - "p1=p1/10**5\n", - "print(\"thus p1*v1=m*R*T1\")\n", - "v1=m*R*T1/(p1*10**5)\n", - "print(\"so volume(v1) in m^3=\"),round(v1,2) \n", - "print(\"heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\")\n", - "print(\"for isentropic process,dQ=0,dW=dU\")\n", - "print(\"during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\")\n", - "print(\"Q_12=0,\")\n", - "W_12=-m*Cv*(T2-T1)\n", - "print(\"W_12=-105.51 KJ(-ve work)\")\n", - "print(\"during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\")\n", - "print(\"Q_31=0,\")\n", - "T4=T1;\n", - "T3=T2;\n", - "W_34=-m*Cv*(T4-T3)\n", - "print(\"ANS:\")\n", - "print(\"W_34=+105.51 KJ(+ve work)\")\n", - "print(\"so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\")\n", - "print(\"for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\")\n", - "print(\"for process 3-4,heat transfer=0,work interaction=+105.51 KJ\")\n", - "print(\"for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\")\n", - "print(\"maximum temperature of cycle=585.36 KJ\")\n", - "print(\"minimum temperature of cycle=292.68 KJ\")\n", - "print(\"volume at the end of isothermal expansion=0.1932 m^3\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.12;pg no: 122" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.12, Page:122 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\n", - "let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\n", - "thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\n", - "Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\n", - "Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\n", - "substituting Q1_a and Q1_b in eq 1\n", - "4*Q2/3+2*Q3=5000...............eq4\n", - "also from total work output,Q1_a+Q1_b-Q2-Q3=W\n", - "5000-Q2-Q3=840\n", - "so Q2+Q3=5000-840=4160\n", - "Q3=4160-Q2\n", - "sunstituting Q3 in eq 4\n", - "4*Q2/3+2*(4160-Q2)=5000\n", - "so Q2=in KJ 4980.0\n", - "and Q3= in KJ 820.0\n", - "here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\n", - "Q2=4980 KJ,from heat engine\n", - "Q3=820 KJ,to heat engine\n" - ] - } - ], - "source": [ - "#cal of heat from from heat engine and to heat engine\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.12, Page:122 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\")\n", - "W=840.;#work done by reservoir in KJ\n", - "print(\"let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\")\n", - "print(\"thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\")\n", - "print(\"Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\")\n", - "print(\"Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\")\n", - "print(\"substituting Q1_a and Q1_b in eq 1\")\n", - "print(\"4*Q2/3+2*Q3=5000...............eq4\")\n", - "print(\"also from total work output,Q1_a+Q1_b-Q2-Q3=W\")\n", - "print(\"5000-Q2-Q3=840\")\n", - "print(\"so Q2+Q3=5000-840=4160\")\n", - "print(\"Q3=4160-Q2\")\n", - "print(\"sunstituting Q3 in eq 4\")\n", - "print(\"4*Q2/3+2*(4160-Q2)=5000\")\n", - "Q2=(5000.-2.*4160.)/((4./3.)-2.)\n", - "print(\"so Q2=in KJ\"),round(Q2,2)\n", - "Q3=4160.-Q2\n", - "print(\"and Q3= in KJ\"),round(-Q3,2)\n", - "print(\"here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\")\n", - "print(\"Q2=4980 KJ,from heat engine\")\n", - "print(\"Q3=820 KJ,to heat engine\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.13;pg no: 123" - ] - }, - { - "cell_type": "code", - "execution_count": 41, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.13, Page:123 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\n", - "arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\n", - "for heat engine\n", - "ne=W/Q1=1-T2/T1\n", - "so (Q1-Q2)/Q1=\n", - "and Q2/Q1=\n", - "Q2=0.2593*Q1\n", - "for heat pump,\n", - "COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\n", - "Q4/Q3=\n", - "Q4=1.27*Q3\n", - "work output from engine =work input to pump\n", - "Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\n", - "so Q4/Q1=\n", - "so Q4=3.484*Q1\n", - "also it is given that Q2+Q4=100\n", - "subtituting Q2 and Q4 as function of Q1 in following expression,\n", - "Q2+Q4=100\n", - "so 0.2539*Q1+3.484*Q1=100\n", - "so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\n", - "Q1=100/(0.2539+3.484)in KJ 26.75\n", - "NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\n" - ] - } - ], - "source": [ - "#cal of energy taken by engine from reservoir\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.13, Page:123 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\")\n", - "T2=(77+273);#temperature of reservoir 2\n", - "T1=(1077+273);#temperature of reservoir 1\n", - "T3=(3+273);#temperature of reservoir 3\n", - "print(\"arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\")\n", - "print(\"for heat engine\")\n", - "print(\"ne=W/Q1=1-T2/T1\")\n", - "print(\"so (Q1-Q2)/Q1=\")\n", - "1-T2/T1\n", - "print(\"and Q2/Q1=\")\n", - "1-0.7407\n", - "print(\"Q2=0.2593*Q1\")\n", - "print(\"for heat pump,\")\n", - "print(\"COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\")\n", - "T4=T2;\n", - "T4/(T4-T3)\n", - "print(\"Q4/Q3=\")\n", - "4.73/3.73\n", - "print(\"Q4=1.27*Q3\")\n", - "print(\"work output from engine =work input to pump\")\n", - "print(\"Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\")\n", - "print(\"so Q4/Q1=\")\n", - "(1-0.2593)/(1-(1/1.27))\n", - "print(\"so Q4=3.484*Q1\")\n", - "print(\"also it is given that Q2+Q4=100\")\n", - "print(\"subtituting Q2 and Q4 as function of Q1 in following expression,\")\n", - "print(\"Q2+Q4=100\")\n", - "print(\"so 0.2539*Q1+3.484*Q1=100\")\n", - "print(\"so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\")\n", - "Q1=100/(0.2539+3.484)\n", - "print(\"Q1=100/(0.2539+3.484)in KJ\"),round(Q1,2)\n", - "print(\"NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.14;pg no: 124" - ] - }, - { - "cell_type": "code", - "execution_count": 42, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.14, Page:124 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\n", - "let temperature of sink be T_sink K\n", - "Q_sink_HE+Q_sink_R=3000 ........eq 1\n", - "since complete work output from engine is used to run refrigerator so,\n", - "2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\n", - "by eq 1 and eq 2,we get Q_R in KJ/s 1000.0\n", - "also for heat engine,2000/1500=Q_sink_HE/T_sink\n", - "=>Q_sink_HE=4*T_sink/3\n", - "for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\n", - "substituting Q_sink_HE and Q_sink_R values\n", - "4*T_sink/3+1000*T_sink/288=3000\n", - "so temperature of sink(T_sink)in K\n", - "so T_sink= 750.0\n", - "T_sink in degree celcius 477.0\n" - ] - } - ], - "source": [ - "#cal of T_sink in degree celcius\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.14, Page:124 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\")\n", - "Q_source=2000;#heat supplied by heat engine in KJ/s\n", - "T_source=1500;#temperature of source in K\n", - "T_R=(15+273);#temperature of reservoir in K\n", - "Q_sink=3000;#heat received by sink in KJ/s\n", - "print(\"let temperature of sink be T_sink K\")\n", - "print(\"Q_sink_HE+Q_sink_R=3000 ........eq 1\")\n", - "print(\"since complete work output from engine is used to run refrigerator so,\")\n", - "print(\"2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\")\n", - "Q_R=3000-2000\n", - "print(\"by eq 1 and eq 2,we get Q_R in KJ/s\"),round(Q_R)\n", - "print(\"also for heat engine,2000/1500=Q_sink_HE/T_sink\")\n", - "print(\"=>Q_sink_HE=4*T_sink/3\")\n", - "print(\"for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\")\n", - "print(\"substituting Q_sink_HE and Q_sink_R values\")\n", - "print(\"4*T_sink/3+1000*T_sink/288=3000\")\n", - "print(\"so temperature of sink(T_sink)in K\")\n", - "T_sink=3000/((4/3)+(1000/288))\n", - "print(\"so T_sink=\"),round(T_sink,2)\n", - "T_sink=T_sink-273\n", - "print(\"T_sink in degree celcius\"),round(T_sink,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.15;pg no: 124" - ] - }, - { - "cell_type": "code", - "execution_count": 45, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.15, Page:124 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\n", - "let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\n", - "n=W/Q1= 0.39\n", - "so n=W/Q1=0.3881\n", - "COP of heat pump=T3/(T3-T2)=Q3/(2*W/3) 2.89\n", - "so 2.892=3*Q3/2*W\n", - "Q3/Q1= 0.7483\n", - "so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\n" - ] - } - ], - "source": [ - "#cal of heat transferred to refrigerant and low temperature reservoir\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.15, Page:124 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\")\n", - "T1=(500.+273.);#temperature of source in K\n", - "T2=(200.+273.);#temperature of sink in K\n", - "T3=(450.+273.);#temperature of body in K\n", - "print(\"let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\")\n", - "n=1-(T2/T1)\n", - "print(\"n=W/Q1=\"),round(n,2)\n", - "print(\"so n=W/Q1=0.3881\")\n", - "COP=T3/(T3-T2)\n", - "print(\"COP of heat pump=T3/(T3-T2)=Q3/(2*W/3)\"),round(COP,2)\n", - "print(\"so 2.892=3*Q3/2*W\")\n", - "print(\"Q3/Q1=\"),round(2*COP*n/3,4)\n", - "print(\"so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.16;pg no: 125" - ] - }, - { - "cell_type": "code", - "execution_count": 48, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.16, Page:125 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\n", - "NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.16, Page:125 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\")\n", - "print(\"NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.17;pg no: 126" - ] - }, - { - "cell_type": "code", - "execution_count": 47, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.17, Page:126 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\n", - "NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.17, Page:126 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\")\n", - "print(\"NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter4_3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter4_3.ipynb deleted file mode 100755 index bb4a3703..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter4_3.ipynb +++ /dev/null @@ -1,1070 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4:Second Law of Thermo Dynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.1;pg no: 113" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.1, Page:113 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\n", - "NOTE=>This question is fully theoritical hence cannot be solve using scilab.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.1, Page:113 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\")\n", - "print(\"NOTE=>This question is fully theoritical hence cannot be solve using scilab.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.2;pg no: 114" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.2, Page:114 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\n", - "in carnot engine from thermodynamics temperature scale\n", - "Q1/Q2=T1/T2\n", - "W=Q1-Q2=200 KJ\n", - "from above equations Q1 in KJ is given by\n", - "Q1= 349.61\n", - "and Q2 in KJ\n", - "Q2=Q1-200 149.61\n", - "so heat supplied(Q1) in KJ 349.6\n" - ] - } - ], - "source": [ - "#cal of heat supplied\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.2, Page:114 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\")\n", - "T1=(400.+273.);#temperature of source in K\n", - "T2=(15.+273.);#temperature of sink in K\n", - "W=200.;#work done in KJ\n", - "print(\"in carnot engine from thermodynamics temperature scale\")\n", - "print(\"Q1/Q2=T1/T2\")\n", - "print(\"W=Q1-Q2=200 KJ\")\n", - "print(\"from above equations Q1 in KJ is given by\")\n", - "Q1=(200*T1)/(T1-T2)\n", - "print(\"Q1=\"),round(Q1,2)\n", - "print(\"and Q2 in KJ\")\n", - "Q2=Q1-200\n", - "print(\"Q2=Q1-200\"),round(Q2,2)\n", - "print(\"so heat supplied(Q1) in KJ\"),round(Q1,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.3;pg no: 115" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.3, Page:115 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\n", - "from thermodynamic temperature scale\n", - "Q1/Q2=T1/T2\n", - "so Q1=Q2*(T1/T2)in KJ/s 2.27\n", - "power/work input required(W)=Q1-Q2 in KJ/s \n", - "power required for driving refrigerator=W in KW 0.274\n" - ] - } - ], - "source": [ - "#cal of power required for driving refrigerator\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.3, Page:115 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\")\n", - "T1=315.;#temperature of reservoir 1 in K\n", - "T2=277.;#temperature of reservoir 2 in K\n", - "Q2=2.;#heat extracted in KJ/s\n", - "print(\"from thermodynamic temperature scale\")\n", - "print(\"Q1/Q2=T1/T2\")\n", - "Q1=Q2*(T1/T2)\n", - "print(\"so Q1=Q2*(T1/T2)in KJ/s\"),round(Q1,2)\n", - "print(\"power/work input required(W)=Q1-Q2 in KJ/s \")\n", - "W=Q1-Q2\n", - "print(\"power required for driving refrigerator=W in KW\"),round(W,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.4;pg no: 115" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.4, Page:115 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\n", - "we can writefor heat engine,Q1/Q2=T1/T2\n", - "so Q2=Q1*(T2/T1) in KJ 545.45\n", - "so We=in KJ 1454.55\n", - "for refrigerator,Q3/Q4=T3/T4 eq 1\n", - "now We-Wr=300\n", - "so Wr=We-300 in KJ 1154.55\n", - "and Wr=Q4-Q3=1154.55 KJ eq 2 \n", - "solving eq1 and eq 2 we get\n", - "Q4=in KJ 8659.13\n", - "and Q3=in KJ 7504.58\n", - "total heat transferred to low teperature reservoir(Q)=in KJ 9204.58\n", - "hence heat transferred to refrigerant=Q3 in KJ 7504.58\n", - "and heat transferred to low temperature reservoir=Q in KJ 9204.58\n" - ] - } - ], - "source": [ - "#cal of heat transferred to refrigerant and low temperature reservoir\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.4, Page:115 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\")\n", - "T1=(827.+273.);#temperature of high temperature reservoir in K\n", - "T2=(27.+273.);#temperature of low temperature reservoir in K\n", - "T3=(-13.+273.);#temperature of reservoir 3 in K\n", - "Q1=2000.;#heat ejected by reservoir 1 in KJ\n", - "print(\"we can writefor heat engine,Q1/Q2=T1/T2\")\n", - "Q2=Q1*(T2/T1)\n", - "print(\"so Q2=Q1*(T2/T1) in KJ\"),round(Q2,2)\n", - "We=Q1-Q2\n", - "print(\"so We=in KJ\"),round(We,2)\n", - "print(\"for refrigerator,Q3/Q4=T3/T4 eq 1\")\n", - "T4=T2;#temperature of low temperature reservoir in K\n", - "print(\"now We-Wr=300\")\n", - "Wr=We-300.\n", - "print(\"so Wr=We-300 in KJ\"),round(Wr,2)\n", - "print(\"and Wr=Q4-Q3=1154.55 KJ eq 2 \")\n", - "print(\"solving eq1 and eq 2 we get\")\n", - "Q4=(1154.55*T4)/(T4-T3)\n", - "print(\"Q4=in KJ\"),round(Q4,2)\n", - "Q3=Q4-Wr\n", - "print(\"and Q3=in KJ\"),round(Q3,2)\n", - "Q=Q2+Q4\n", - "print(\"total heat transferred to low teperature reservoir(Q)=in KJ\"),round(Q,2)\n", - "print(\"hence heat transferred to refrigerant=Q3 in KJ\"),round(Q3,2)\n", - "print(\"and heat transferred to low temperature reservoir=Q in KJ\"),round(Q,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.5;pg no: 116" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.5, Page:116 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\n", - "COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\n", - "also we know K=Q1/Q2=T1/T2\n", - "so K=T1/T2 1.1\n", - "so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K)) 11.0\n", - "also COP_HP=Q1/W\n", - "W=Q1/COin MJ/Hr 3.03\n", - "or W=1000*W/3600 in KW 3.03\n", - "so minimum power required(W)in KW 3.03\n" - ] - } - ], - "source": [ - "#cal of minimum power required\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.5, Page:116 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\")\n", - "T1=(25+273.15);#temperature of inside of house in K\n", - "T2=(-1+273.15);#outside temperature in K\n", - "Q1=125;#heating load in MJ/Hr\n", - "print(\"COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\")\n", - "print(\"also we know K=Q1/Q2=T1/T2\")\n", - "K=T1/T2\n", - "print(\"so K=T1/T2\"),round(K,2)\n", - "COP_HP=1/(1-(1/K))\n", - "print(\"so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K))\"),round(COP_HP)\n", - "print(\"also COP_HP=Q1/W\")\n", - "W=Q1/COP_HP\n", - "W=1000*W/3600\n", - "print(\"W=Q1/COin MJ/Hr\"),round(W,2)\n", - "print(\"or W=1000*W/3600 in KW\"),round(W,2)\n", - "print(\"so minimum power required(W)in KW \"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.6;pg no: 117" - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.6, Page:117 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\n", - "cold storage plant can be considered as refrigerator operating between given temperatures limits\n", - "capacity of plant=heat to be extracted=Q2 in KW\n", - "we know that,one ton of refrigeration as 3.52 KW \n", - "so Q2=Q2*3.52 in KW 140.8\n", - "carnot COP of plant(COP_carnot)= 5.18\n", - "performance is 1/4 of its carnot COP\n", - "COP=COP_carnot/4\n", - "also actual COP=Q2/W\n", - "W=Q2/COP in KW\n", - "hence power required(W)in KW 108.76\n" - ] - } - ], - "source": [ - "#cal of power required\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.6, Page:117 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\")\n", - "T1=(-15.+273.15);#inside temperature in K\n", - "T2=(35.+273.);#atmospheric temperature in K\n", - "Q2=40.;#refrigeration capacity of storage plant in tonnes\n", - "print(\"cold storage plant can be considered as refrigerator operating between given temperatures limits\")\n", - "print(\"capacity of plant=heat to be extracted=Q2 in KW\")\n", - "print(\"we know that,one ton of refrigeration as 3.52 KW \")\n", - "Q2=Q2*3.52\n", - "print(\"so Q2=Q2*3.52 in KW\"),round(Q2,2)\n", - "COP_carnot=1/((T2/T1)-1)\n", - "print(\"carnot COP of plant(COP_carnot)=\"),round(COP_carnot,2)\n", - "print(\"performance is 1/4 of its carnot COP\")\n", - "COP=COP_carnot/4\n", - "print(\"COP=COP_carnot/4\")\n", - "print(\"also actual COP=Q2/W\")\n", - "print(\"W=Q2/COP in KW\")\n", - "W=Q2/COP\n", - "print(\"hence power required(W)in KW\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.7;pg no: 117" - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.7, Page:117 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\n", - "highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\n", - "n= 0.79\n", - "or n=n*100 % 78.92\n" - ] - } - ], - "source": [ - "#cal of carnot cycle efficiency for given temperature limits\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.7, Page:117 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\")\n", - "T1=(1150.+273.);#temperature of source in K\n", - "T2=(27.+273.);#temperature of sink in K\n", - "print(\"highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\")\n", - "n=1-(T2/T1)\n", - "print(\"n=\"),round(n,2)\n", - "n=n*100\n", - "print(\"or n=n*100 %\"),round(n,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.8;pg no: 117" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.8, Page:117 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\n", - "here heat to be removed continuously from refrigerated space(Q)in KJ/s 0.13\n", - "for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\n", - "W=in KW 0.02\n", - "so power required(W)in KW 0.02\n" - ] - } - ], - "source": [ - "#cal of power required\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.8, Page:117 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\")\n", - "T1=(27.+273.);#temperature of source in K\n", - "T2=(-8.+273.);#temperature of sink in K\n", - "Q=7.5;#heat leakage in KJ/min\n", - "Q=Q/60.\n", - "print(\"here heat to be removed continuously from refrigerated space(Q)in KJ/s\"),round(Q,2)\n", - "print(\"for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\")\n", - "W=Q*((T1/T2)-1)\n", - "print(\"W=in KW\"),round(W,2)\n", - "print(\"so power required(W)in KW\"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.9;pg no: 118" - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.9, Page:118 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\n", - "here W1:W2:W3=3:2:1\n", - "efficiency of engine,HE1,\n", - "W1/Q1=(1-(T2/1100))\n", - "so Q1=(1100*W1)/(1100-T2)\n", - "for HE2 engine,W2/Q2=(1-(T3/T2))\n", - "for HE3 engine,W3/Q3=(1-(300/T3))\n", - "from energy balance on engine,HE1\n", - "Q1=W1+Q2=>Q2=Q1-W1\n", - "above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\n", - "substituting Q2 in efficiency of HE2\n", - "W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\n", - "W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\n", - "2/3=(T2-T3)/(1100-T2)\n", - "2200-2*T2=3*T2-3*T3\n", - "5*T2-3*T3=2200\n", - "now energy balance on engine HE2 gives,Q2=W2+Q3\n", - "substituting in efficiency of HE2,\n", - "W2/(W2+Q3)=(T2-T3)/T2\n", - "W2*T2=(W2+Q3)*(T2-T3)\n", - "Q3=(W2*T3)/(T2-T3)\n", - "substituting Q3 in efficiency of HE3,\n", - "W3/((W2*T3)/(T2-T3))=(T3-300)/T3\n", - "W3/W2=(T3/(T2-T3))*(T3-300)/T3\n", - "1/2=(T3-300)/(T2-T3)\n", - "3*T3-T2=600\n", - "solving equations of T2 and T3,\n", - "we get,T3=in K 433.33\n", - "and by eq 5,T2 in K 700.0\n", - "so intermediate temperature are 700 K and 433.33 K\n" - ] - } - ], - "source": [ - "#cal of intermediate temperatures\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.9, Page:118 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\")\n", - "T1=1100;#temperature of high temperature reservoir in K\n", - "T4=300;#temperature of low temperature reservoir in K\n", - "print(\"here W1:W2:W3=3:2:1\")\n", - "print(\"efficiency of engine,HE1,\")\n", - "print(\"W1/Q1=(1-(T2/1100))\")\n", - "print(\"so Q1=(1100*W1)/(1100-T2)\")\n", - "print(\"for HE2 engine,W2/Q2=(1-(T3/T2))\")\n", - "print(\"for HE3 engine,W3/Q3=(1-(300/T3))\")\n", - "print(\"from energy balance on engine,HE1\")\n", - "print(\"Q1=W1+Q2=>Q2=Q1-W1\")\n", - "print(\"above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\")\n", - "print(\"substituting Q2 in efficiency of HE2\")\n", - "print(\"W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\")\n", - "print(\"W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\")\n", - "print(\"2/3=(T2-T3)/(1100-T2)\")\n", - "print(\"2200-2*T2=3*T2-3*T3\")\n", - "print(\"5*T2-3*T3=2200\")\n", - "print(\"now energy balance on engine HE2 gives,Q2=W2+Q3\")\n", - "print(\"substituting in efficiency of HE2,\")\n", - "print(\"W2/(W2+Q3)=(T2-T3)/T2\")\n", - "print(\"W2*T2=(W2+Q3)*(T2-T3)\")\n", - "print(\"Q3=(W2*T3)/(T2-T3)\")\n", - "print(\"substituting Q3 in efficiency of HE3,\")\n", - "print(\"W3/((W2*T3)/(T2-T3))=(T3-300)/T3\")\n", - "print(\"W3/W2=(T3/(T2-T3))*(T3-300)/T3\")\n", - "print(\"1/2=(T3-300)/(T2-T3)\")\n", - "print(\"3*T3-T2=600\")\n", - "print(\"solving equations of T2 and T3,\")\n", - "T3=(600.+(2200./5.))/(3.-(3./5.))\n", - "print(\"we get,T3=in K\"),round(T3,2)\n", - "T2=(2200.+3.*T3)/5.\n", - "print(\"and by eq 5,T2 in K\"),round(T2,2)\n", - "print(\"so intermediate temperature are 700 K and 433.33 K\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.10;pg no: 119" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.10, Page:119 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\n", - "efficiency of engine,W/Q1=(800-T)/800\n", - "for refrigerator,COP=Q3/W=280/(T-280)\n", - "it is given that Q1=Q3=Q\n", - "so,from engine,W/Q=(800-T)/800\n", - "from refrigerator,Q/W=280/(T-280)\n", - "from above two(Q/W)may be equated,\n", - "(T-280)/280=(800-T)/800\n", - "so temperature(T)in K 414.81\n", - "efficiency of engine(n)is given as\n", - "n= 0.48\n", - "COP of refrigerator is given as\n", - "COP= 2.08\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.10, Page:119 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\")\n", - "T1=800.;#temperature of source in K\n", - "T2=280.;#temperature of sink in K\n", - "print(\"efficiency of engine,W/Q1=(800-T)/800\")\n", - "print(\"for refrigerator,COP=Q3/W=280/(T-280)\")\n", - "print(\"it is given that Q1=Q3=Q\")\n", - "print(\"so,from engine,W/Q=(800-T)/800\")\n", - "print(\"from refrigerator,Q/W=280/(T-280)\")\n", - "print(\"from above two(Q/W)may be equated,\")\n", - "print(\"(T-280)/280=(800-T)/800\")\n", - "T=2.*280.*800./(800.+280.)\n", - "print(\"so temperature(T)in K\"),round(T,2)\n", - "print(\"efficiency of engine(n)is given as\")\n", - "n=(800.-T)/800.\n", - "print(\"n=\"),round(n,2)\n", - "print(\"COP of refrigerator is given as\")\n", - "COP=280./(T-280.)\n", - "print(\"COP=\"),round(COP,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.11;pg no: 120" - ] - }, - { - "cell_type": "code", - "execution_count": 39, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.11, Page:120 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\n", - "let thermodynamic properties be denoted with respect to salient states;\n", - "n_carnot=1-T1/T2\n", - "so T1/T2=1-0.5\n", - "so T1/T2=0.5\n", - "or T2=2*T1\n", - "corresponding to state 2,p2*v2=m*R*T2\n", - "so temperature(T2) in K= 585.37\n", - "heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\n", - "Q_23=W_23=p2*v2*log(v3/v2)\n", - "so volume(v3) in m^3= 0.1932\n", - "temperature at state 1,T1 in K= 292.68\n", - "during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\n", - "here expansion constant(y)=Cp/Cv\n", - "so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\n", - "p1 in bar\n", - "thus p1*v1=m*R*T1\n", - "so volume(v1) in m^3= 0.68\n", - "heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\n", - "for isentropic process,dQ=0,dW=dU\n", - "during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\n", - "Q_12=0,\n", - "W_12=-105.51 KJ(-ve work)\n", - "during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\n", - "Q_31=0,\n", - "ANS:\n", - "W_34=+105.51 KJ(+ve work)\n", - "so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\n", - "for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\n", - "for process 3-4,heat transfer=0,work interaction=+105.51 KJ\n", - "for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\n", - "maximum temperature of cycle=585.36 KJ\n", - "minimum temperature of cycle=292.68 KJ\n", - "volume at the end of isothermal expansion=0.1932 m^3\n" - ] - } - ], - "source": [ - "#cal of max and min temp of cycle,volume\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "import math\n", - "print\"Example 4.11, Page:120 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\")\n", - "n_carnot=0.5;#efficiency of carnot power cycle\n", - "m=0.5;#mass of air in kg\n", - "p2=7.*10**5;#final pressure in pa\n", - "v2=0.12;#volume in m^3\n", - "R=287.;#gas constant in J/kg K\n", - "Q_23=40.*1000.;#heat transfer to the air during isothermal expansion in J\n", - "Cp=1.008;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.721;#specific heat at constant volume in KJ/kg K\n", - "print(\"let thermodynamic properties be denoted with respect to salient states;\")\n", - "print(\"n_carnot=1-T1/T2\")\n", - "print(\"so T1/T2=1-0.5\")\n", - "1-0.5\n", - "print(\"so T1/T2=0.5\")\n", - "print(\"or T2=2*T1\")\n", - "print(\"corresponding to state 2,p2*v2=m*R*T2\")\n", - "T2=p2*v2/(m*R)\n", - "print(\"so temperature(T2) in K=\"),round(T2,2)\n", - "print(\"heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\")\n", - "print(\"Q_23=W_23=p2*v2*log(v3/v2)\")\n", - "v3=v2*math.exp(Q_23/(p2*v2))\n", - "print(\"so volume(v3) in m^3=\"),round(v3,4)\n", - "T1=T2/2\n", - "print(\"temperature at state 1,T1 in K=\"),round(T1,2)\n", - "print(\"during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\")\n", - "print(\"here expansion constant(y)=Cp/Cv\")\n", - "y=Cp/Cv\n", - "print(\"so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\")\n", - "p1=p2/(T2/T1)**(y/(y-1))\n", - "print(\"p1 in bar\")\n", - "p1=p1/10**5\n", - "print(\"thus p1*v1=m*R*T1\")\n", - "v1=m*R*T1/(p1*10**5)\n", - "print(\"so volume(v1) in m^3=\"),round(v1,2) \n", - "print(\"heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\")\n", - "print(\"for isentropic process,dQ=0,dW=dU\")\n", - "print(\"during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\")\n", - "print(\"Q_12=0,\")\n", - "W_12=-m*Cv*(T2-T1)\n", - "print(\"W_12=-105.51 KJ(-ve work)\")\n", - "print(\"during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\")\n", - "print(\"Q_31=0,\")\n", - "T4=T1;\n", - "T3=T2;\n", - "W_34=-m*Cv*(T4-T3)\n", - "print(\"ANS:\")\n", - "print(\"W_34=+105.51 KJ(+ve work)\")\n", - "print(\"so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\")\n", - "print(\"for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\")\n", - "print(\"for process 3-4,heat transfer=0,work interaction=+105.51 KJ\")\n", - "print(\"for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\")\n", - "print(\"maximum temperature of cycle=585.36 KJ\")\n", - "print(\"minimum temperature of cycle=292.68 KJ\")\n", - "print(\"volume at the end of isothermal expansion=0.1932 m^3\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.12;pg no: 122" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.12, Page:122 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\n", - "let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\n", - "thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\n", - "Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\n", - "Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\n", - "substituting Q1_a and Q1_b in eq 1\n", - "4*Q2/3+2*Q3=5000...............eq4\n", - "also from total work output,Q1_a+Q1_b-Q2-Q3=W\n", - "5000-Q2-Q3=840\n", - "so Q2+Q3=5000-840=4160\n", - "Q3=4160-Q2\n", - "sunstituting Q3 in eq 4\n", - "4*Q2/3+2*(4160-Q2)=5000\n", - "so Q2=in KJ 4980.0\n", - "and Q3= in KJ 820.0\n", - "here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\n", - "Q2=4980 KJ,from heat engine\n", - "Q3=820 KJ,to heat engine\n" - ] - } - ], - "source": [ - "#cal of heat from from heat engine and to heat engine\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.12, Page:122 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\")\n", - "W=840.;#work done by reservoir in KJ\n", - "print(\"let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\")\n", - "print(\"thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\")\n", - "print(\"Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\")\n", - "print(\"Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\")\n", - "print(\"substituting Q1_a and Q1_b in eq 1\")\n", - "print(\"4*Q2/3+2*Q3=5000...............eq4\")\n", - "print(\"also from total work output,Q1_a+Q1_b-Q2-Q3=W\")\n", - "print(\"5000-Q2-Q3=840\")\n", - "print(\"so Q2+Q3=5000-840=4160\")\n", - "print(\"Q3=4160-Q2\")\n", - "print(\"sunstituting Q3 in eq 4\")\n", - "print(\"4*Q2/3+2*(4160-Q2)=5000\")\n", - "Q2=(5000.-2.*4160.)/((4./3.)-2.)\n", - "print(\"so Q2=in KJ\"),round(Q2,2)\n", - "Q3=4160.-Q2\n", - "print(\"and Q3= in KJ\"),round(-Q3,2)\n", - "print(\"here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\")\n", - "print(\"Q2=4980 KJ,from heat engine\")\n", - "print(\"Q3=820 KJ,to heat engine\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.13;pg no: 123" - ] - }, - { - "cell_type": "code", - "execution_count": 41, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.13, Page:123 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\n", - "arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\n", - "for heat engine\n", - "ne=W/Q1=1-T2/T1\n", - "so (Q1-Q2)/Q1=\n", - "and Q2/Q1=\n", - "Q2=0.2593*Q1\n", - "for heat pump,\n", - "COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\n", - "Q4/Q3=\n", - "Q4=1.27*Q3\n", - "work output from engine =work input to pump\n", - "Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\n", - "so Q4/Q1=\n", - "so Q4=3.484*Q1\n", - "also it is given that Q2+Q4=100\n", - "subtituting Q2 and Q4 as function of Q1 in following expression,\n", - "Q2+Q4=100\n", - "so 0.2539*Q1+3.484*Q1=100\n", - "so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\n", - "Q1=100/(0.2539+3.484)in KJ 26.75\n", - "NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\n" - ] - } - ], - "source": [ - "#cal of energy taken by engine from reservoir\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.13, Page:123 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\")\n", - "T2=(77+273);#temperature of reservoir 2\n", - "T1=(1077+273);#temperature of reservoir 1\n", - "T3=(3+273);#temperature of reservoir 3\n", - "print(\"arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\")\n", - "print(\"for heat engine\")\n", - "print(\"ne=W/Q1=1-T2/T1\")\n", - "print(\"so (Q1-Q2)/Q1=\")\n", - "1-T2/T1\n", - "print(\"and Q2/Q1=\")\n", - "1-0.7407\n", - "print(\"Q2=0.2593*Q1\")\n", - "print(\"for heat pump,\")\n", - "print(\"COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\")\n", - "T4=T2;\n", - "T4/(T4-T3)\n", - "print(\"Q4/Q3=\")\n", - "4.73/3.73\n", - "print(\"Q4=1.27*Q3\")\n", - "print(\"work output from engine =work input to pump\")\n", - "print(\"Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\")\n", - "print(\"so Q4/Q1=\")\n", - "(1-0.2593)/(1-(1/1.27))\n", - "print(\"so Q4=3.484*Q1\")\n", - "print(\"also it is given that Q2+Q4=100\")\n", - "print(\"subtituting Q2 and Q4 as function of Q1 in following expression,\")\n", - "print(\"Q2+Q4=100\")\n", - "print(\"so 0.2539*Q1+3.484*Q1=100\")\n", - "print(\"so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\")\n", - "Q1=100/(0.2539+3.484)\n", - "print(\"Q1=100/(0.2539+3.484)in KJ\"),round(Q1,2)\n", - "print(\"NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.14;pg no: 124" - ] - }, - { - "cell_type": "code", - "execution_count": 42, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.14, Page:124 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\n", - "let temperature of sink be T_sink K\n", - "Q_sink_HE+Q_sink_R=3000 ........eq 1\n", - "since complete work output from engine is used to run refrigerator so,\n", - "2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\n", - "by eq 1 and eq 2,we get Q_R in KJ/s 1000.0\n", - "also for heat engine,2000/1500=Q_sink_HE/T_sink\n", - "=>Q_sink_HE=4*T_sink/3\n", - "for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\n", - "substituting Q_sink_HE and Q_sink_R values\n", - "4*T_sink/3+1000*T_sink/288=3000\n", - "so temperature of sink(T_sink)in K\n", - "so T_sink= 750.0\n", - "T_sink in degree celcius 477.0\n" - ] - } - ], - "source": [ - "#cal of T_sink in degree celcius\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.14, Page:124 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\")\n", - "Q_source=2000;#heat supplied by heat engine in KJ/s\n", - "T_source=1500;#temperature of source in K\n", - "T_R=(15+273);#temperature of reservoir in K\n", - "Q_sink=3000;#heat received by sink in KJ/s\n", - "print(\"let temperature of sink be T_sink K\")\n", - "print(\"Q_sink_HE+Q_sink_R=3000 ........eq 1\")\n", - "print(\"since complete work output from engine is used to run refrigerator so,\")\n", - "print(\"2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\")\n", - "Q_R=3000-2000\n", - "print(\"by eq 1 and eq 2,we get Q_R in KJ/s\"),round(Q_R)\n", - "print(\"also for heat engine,2000/1500=Q_sink_HE/T_sink\")\n", - "print(\"=>Q_sink_HE=4*T_sink/3\")\n", - "print(\"for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\")\n", - "print(\"substituting Q_sink_HE and Q_sink_R values\")\n", - "print(\"4*T_sink/3+1000*T_sink/288=3000\")\n", - "print(\"so temperature of sink(T_sink)in K\")\n", - "T_sink=3000/((4/3)+(1000/288))\n", - "print(\"so T_sink=\"),round(T_sink,2)\n", - "T_sink=T_sink-273\n", - "print(\"T_sink in degree celcius\"),round(T_sink,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.15;pg no: 124" - ] - }, - { - "cell_type": "code", - "execution_count": 45, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.15, Page:124 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\n", - "let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\n", - "n=W/Q1= 0.39\n", - "so n=W/Q1=0.3881\n", - "COP of heat pump=T3/(T3-T2)=Q3/(2*W/3) 2.89\n", - "so 2.892=3*Q3/2*W\n", - "Q3/Q1= 0.7483\n", - "so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\n" - ] - } - ], - "source": [ - "#cal of heat transferred to refrigerant and low temperature reservoir\n", - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.15, Page:124 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\")\n", - "T1=(500.+273.);#temperature of source in K\n", - "T2=(200.+273.);#temperature of sink in K\n", - "T3=(450.+273.);#temperature of body in K\n", - "print(\"let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\")\n", - "n=1-(T2/T1)\n", - "print(\"n=W/Q1=\"),round(n,2)\n", - "print(\"so n=W/Q1=0.3881\")\n", - "COP=T3/(T3-T2)\n", - "print(\"COP of heat pump=T3/(T3-T2)=Q3/(2*W/3)\"),round(COP,2)\n", - "print(\"so 2.892=3*Q3/2*W\")\n", - "print(\"Q3/Q1=\"),round(2*COP*n/3,4)\n", - "print(\"so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.16;pg no: 125" - ] - }, - { - "cell_type": "code", - "execution_count": 48, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.16, Page:125 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\n", - "NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.16, Page:125 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\")\n", - "print(\"NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 4.17;pg no: 126" - ] - }, - { - "cell_type": "code", - "execution_count": 47, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 4.17, Page:126 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\n", - "NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 4\n", - "print\"Example 4.17, Page:126 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\")\n", - "print(\"NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter5.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter5.ipynb deleted file mode 100755 index 2eb17c0f..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter5.ipynb +++ /dev/null @@ -1,1126 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5:Entropy" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.1;pg no: 144" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.1, Page:144 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\n", - "entropy change may be given as,\n", - "s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\n", - "here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\n", - "so change in entropy(deltaS)in KJ/kg K\n", - "deltaS= 0.263\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.1, Page:144 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\")\n", - "p1=5.;#initial pressure of air\n", - "T1=(27.+273.);#temperature of air in K\n", - "p2=2.;#final pressure of air in K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cp_air=1.004;#specific heat of air at constant pressure in KJ/kg K\n", - "print(\"entropy change may be given as,\")\n", - "print(\"s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\")\n", - "print(\"here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\")\n", - "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", - "deltaS=(Cp_air*0)-(R*math.log(p2/p1))\n", - "print(\"deltaS=\"),round(deltaS,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.2;pg no: 144" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.2, Page:144 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\n", - "total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\n", - "deltaS1=Q1/T1,where Q1=m*Cp*deltaT\n", - "heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\n", - "Q1= 1533.0\n", - "deltaS1=Q1/T1 in KJ/K 5.11\n", - "now heat of vaporisation(Q2)=in KJ 11300.0\n", - "entropy change during phase transformation(deltaS2)in KJ/K\n", - "deltaS2= 30.29\n", - "entropy change during steam temperature rise(deltaS3)in KJ/K\n", - "deltaS3=m*Cp_steam*dT/T\n", - "here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\n", - "R=in KJ/kg K 0.46\n", - "now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\n", - "total entropy change(deltaS) in KJ/K= 87.24\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.2, Page:144 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\")\n", - "import scipy\n", - "from scipy import integrate\n", - "##just an example function\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "T1=(27.+273.);#temperature of water in K\n", - "T2=(100.+273.);#steam temperature of water in K\n", - "m=5.;#mass of water in kg\n", - "q=2260.;#heat of vaporisation at 100 degree celcius in KJ/kg\n", - "Cp=4.2;#specific heat of water at constant pressure in KJ/kg K\n", - "M=18.;#molar mass for water/steam \n", - "R1=8.314;#gas constant in KJ/kg K\n", - "print(\"total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\")\n", - "Q1=m*Cp*(T2-T1)\n", - "print(\"deltaS1=Q1/T1,where Q1=m*Cp*deltaT\")\n", - "print(\"heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\")\n", - "print(\"Q1=\"),round(Q1,2)\n", - "deltaS1=Q1/T1\n", - "print(\"deltaS1=Q1/T1 in KJ/K\"),round(deltaS1,2)\n", - "Q2=m*q\n", - "print(\"now heat of vaporisation(Q2)=in KJ\"),round(Q2,2)\n", - "print(\"entropy change during phase transformation(deltaS2)in KJ/K\")\n", - "deltaS2=Q2/T2\n", - "print(\"deltaS2=\"),round(deltaS2,2)\n", - "print(\"entropy change during steam temperature rise(deltaS3)in KJ/K\")\n", - "print(\"deltaS3=m*Cp_steam*dT/T\")\n", - "print(\"here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\")\n", - "R=R1/M\n", - "print(\"R=in KJ/kg K\"),round(R,2)\n", - "T2=(100+273.15);#steam temperature of water in K\n", - "T3=(400+273.15);#temperature of steam in K\n", - "print(\"now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\")\n", - "#function y = f(T), y =(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T , endfunction\n", - "def fun1(x):\n", - "\ty=(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T\n", - "\treturn y\n", - "\n", - "#deltaS3 =scipy.integrate.quad(f,T2, T3) \n", - "deltaS3=51.84;#approximately\n", - "deltaS=deltaS1+deltaS2+deltaS3\n", - "print(\"total entropy change(deltaS) in KJ/K=\"),round(deltaS,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.3;pg no: 145" - ] - }, - { - "cell_type": "code", - "execution_count": 51, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.3, Page:145 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\n", - "gas constant for oxygen(R)in KJ/kg K\n", - "R= 0.26\n", - "for reversible process the change in entropy may be given as\n", - "deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\n", - "so entropy change=deltaS= in (KJ/kg K) -0.29\n" - ] - } - ], - "source": [ - "#cal of entropy change\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.3, Page:145 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\")\n", - "R1=8.314;#gas constant in KJ/kg K\n", - "M=32;#molar mass for O2 \n", - "T1=(27+273);#initial temperature of O2 in K\n", - "p1=125;#initial pressure of O2 in Kpa\n", - "p2=375;#final pressure of O2 in Kpa\n", - "Cp=1.004;#specific heat of air at constant pressure in KJ/kg K\n", - "print(\"gas constant for oxygen(R)in KJ/kg K\")\n", - "R=R1/M\n", - "print(\"R=\"),round(R,2)\n", - "print(\"for reversible process the change in entropy may be given as\")\n", - "print(\"deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\")\n", - "T2=T1;#isothermal process\n", - "deltaS=(Cp*math.log(T2/T1))-(R*math.log(p2/p1))\n", - "print(\"so entropy change=deltaS= in (KJ/kg K)\"),round(deltaS,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.4;pg no: 145" - ] - }, - { - "cell_type": "code", - "execution_count": 52, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.4, Page:145 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\n", - "entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\n", - "where deltaS_block=m*C*log(T2/T1)\n", - "here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\n", - "therefore deltaS_block=in KJ/K -0.14\n", - "heat loss by block =heat gained by water(Q)in KJ\n", - "Q=-m*C*(T1-T2) -49.13\n", - "therefore deltaS_water=-Q/T2 in KJ/K 0.16\n", - "thus deltaS_universe=in J/K 27.16\n" - ] - } - ], - "source": [ - "#cal of deltaS_universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.4, Page:145 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\")\n", - "T1=(150+273.15);#temperature of copper block in K\n", - "T2=(25+273.15);#temperature of sea water in K\n", - "m=1;#mass of copper block in kg\n", - "C=0.393;#heat capacity of copper in KJ/kg K\n", - "print(\"entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\")\n", - "print(\"where deltaS_block=m*C*log(T2/T1)\")\n", - "print(\"here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\")\n", - "deltaS_block=m*C*math.log(T2/T1)\n", - "print(\"therefore deltaS_block=in KJ/K\"),round(deltaS_block,2)\n", - "print(\"heat loss by block =heat gained by water(Q)in KJ\")\n", - "Q=-m*C*(T1-T2)\n", - "print(\"Q=-m*C*(T1-T2)\"),round(Q,2)\n", - "deltaS_water=-Q/T2\n", - "print(\"therefore deltaS_water=-Q/T2 in KJ/K\"),round(deltaS_water,2)\n", - "deltaS_universe=(deltaS_block+deltaS_water)*1000\n", - "print(\"thus deltaS_universe=in J/K\"),round(deltaS_universe,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.5;pg no: 146" - ] - }, - { - "cell_type": "code", - "execution_count": 53, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.5, Page:146 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\n", - "deltaS_universe=(deltaS_block+deltaS_seawater)\n", - "since block and sea water both are at same temperature so,\n", - "deltaS_universe=deltaS_seawater\n", - "conservation of energy equation yields,\n", - "Q-W=deltaU+deltaP.E+deltaK.E\n", - "since in this case,W=0,deltaK.E=0,deltaU=0\n", - "Q=deltaP.E\n", - "change in potential energy=deltaP.E=m*g*h in J\n", - "deltaS_universe=deltaS_seawater=Q/T in J/kg K\n", - "entropy change of universe(deltaS_universe)in J/kg K 6.54\n" - ] - } - ], - "source": [ - "#cal of entropy change of universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.5, Page:146 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\")\n", - "m=1;#mass of copper block in kg\n", - "T=(27+273);#temperature of copper block in K\n", - "h=200;#height from which copper block dropped in sea water in m\n", - "C=0.393;#heat capacity for copper in KJ/kg K\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"deltaS_universe=(deltaS_block+deltaS_seawater)\")\n", - "print(\"since block and sea water both are at same temperature so,\")\n", - "print(\"deltaS_universe=deltaS_seawater\")\n", - "print(\"conservation of energy equation yields,\")\n", - "print(\"Q-W=deltaU+deltaP.E+deltaK.E\")\n", - "print(\"since in this case,W=0,deltaK.E=0,deltaU=0\")\n", - "deltaPE=m*g*h\n", - "Q=deltaPE\n", - "print(\"Q=deltaP.E\")\n", - "print(\"change in potential energy=deltaP.E=m*g*h in J\")\n", - "print(\"deltaS_universe=deltaS_seawater=Q/T in J/kg K\")\n", - "deltaS_universe=Q/T\n", - "print(\"entropy change of universe(deltaS_universe)in J/kg K\"),round(deltaS_universe,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.6;pg no: 146" - ] - }, - { - "cell_type": "code", - "execution_count": 54, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.6, Page:146 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\n", - "here deltaS_universe=deltaS_block1+deltaS_block2\n", - "two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\n", - "then from energy conservation\n", - "m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\n", - "Tf=in K 374.18\n", - "hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\n", - "deltaS1=in KJ/K -0.05\n", - "entropy change in block 2(deltaS2)in KJ/K\n", - "deltaS2= 0.06\n", - "entropy change of universe(deltaS)=in KJ/K 0.01\n" - ] - } - ], - "source": [ - "#cal of entropy change of universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.6, Page:146 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\")\n", - "m1=1;#mass of first copper block in kg\n", - "m2=0.5;#mass of second copper block in kg\n", - "T1=(150+273.15);#temperature of first copper block in K\n", - "T2=(0+273.15);#temperature of second copper block in K\n", - "Cp_1=0.393;#heat capacity for copper block 1 in KJ/kg K\n", - "Cp_2=0.381;#heat capacity for copper block 2 in KJ/kg K\n", - "print(\"here deltaS_universe=deltaS_block1+deltaS_block2\")\n", - "print(\"two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\")\n", - "print(\"then from energy conservation\")\n", - "print(\"m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\")\n", - "Tf=((m1*Cp_1*T1)+(m2*Cp_2*T2))/(m1*Cp_1+m2*Cp_2)\n", - "print(\"Tf=in K\"),round(Tf,2)\n", - "print(\"hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\")\n", - "deltaS1=m1*Cp_1*math.log(Tf/T1)\n", - "print(\"deltaS1=in KJ/K\"),round(deltaS1,2)\n", - "print(\"entropy change in block 2(deltaS2)in KJ/K\")\n", - "deltaS2=m2*Cp_2*math.log(Tf/T2)\n", - "print(\"deltaS2=\"),round(deltaS2,2)\n", - "deltaS=deltaS1+deltaS2\n", - "print(\"entropy change of universe(deltaS)=in KJ/K\"),round(deltaS,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.7;pg no: 147" - ] - }, - { - "cell_type": "code", - "execution_count": 55, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.7, Page:147 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\n", - "NOTE=>in this question formula is derived which cannot be solve using python software\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.7, Page:147 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\")\n", - "print(\"NOTE=>in this question formula is derived which cannot be solve using python software\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.8;pg no: 148" - ] - }, - { - "cell_type": "code", - "execution_count": 56, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.8, Page:148 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\n", - "for irreversible operation of engine,\n", - "rate of entropy generation=Q1/T1+Q2/T2\n", - "W=Q1-Q2=>Q2=Q1-W in MW 3.0\n", - "entropy generated(deltaS_gen)in MW\n", - "deltaS_gen= 0.01\n", - "work lost(W_lost)in MW\n", - "W_lost=T2*deltaS_gen 4.0\n" - ] - } - ], - "source": [ - "#cal of work lost\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.8, Page:148 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\")\n", - "T1=1800.;#temperature of high temperature reservoir in K\n", - "T2=300.;#temperature of low temperature reservoir in K\n", - "Q1=5.;#heat addition in MW\n", - "W=2.;#work done in MW\n", - "print(\"for irreversible operation of engine,\")\n", - "print(\"rate of entropy generation=Q1/T1+Q2/T2\")\n", - "Q2=Q1-W\n", - "print(\"W=Q1-Q2=>Q2=Q1-W in MW\"),round(Q2,2)\n", - "print(\"entropy generated(deltaS_gen)in MW\")\n", - "deltaS_gen=Q1/T1+Q2/T2\n", - "print(\"deltaS_gen=\"),round(deltaS_gen,2)\n", - "Q1=-5;#heat addition in MW\n", - "print(\"work lost(W_lost)in MW\")\n", - "W_lost=T2*deltaS_gen\n", - "print(\"W_lost=T2*deltaS_gen\"),round(W_lost)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.9;pg no: 148" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.9, Page:148 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\n", - "system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\n", - "therefore,maximum heat(Q1)=(C*dT)in J\n", - "here C=0.05*T^2+0.10*T+0.085 in J/K\n", - "so Q1=(0.05*T^2+0.10*T+0.085)*dT\n", - "entropy change of system,deltaS_system=C*dT/T in J/K\n", - "so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\n", - "deltaS_reservoir=Q2/T2=(Q1-W)/T2 also,we know from entropy principle,deltaS_universe is greater than equal to 0\n", - "deltaS_universe=deltaS_system+deltaS_reservoir\n", - "thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\n", - "W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\n", - "hence maximum work in KJ= 435.34\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.9, Page:148 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\")\n", - "import scipy\n", - "from scipy import integrate\n", - "\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "T1=500;#temperature of system in K\n", - "T2=300;#temperature of reservoir in K\n", - "print(\"system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\")\n", - "print(\"therefore,maximum heat(Q1)=(C*dT)in J\")\n", - "print(\"here C=0.05*T^2+0.10*T+0.085 in J/K\")\n", - "print(\"so Q1=(0.05*T^2+0.10*T+0.085)*dT\")\n", - "T=T1-T2\n", - "#Q1=(0.05*T**2+0.10*T+0.085)*dT\n", - "#function y = f(T), y = (0.05*T**2+0.10*T+0.085),endfunction\n", - "#Q1 = scipy.integrate.quad(fun1,T1, T2)\n", - "#Q1=-Q1\n", - "Q1=1641.35*10**3\n", - "print(\"entropy change of system,deltaS_system=C*dT/T in J/K\")\n", - "print(\"so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\")\n", - "#function y = k(T), y = (0.05*T**2+0.10*T+0.085)/T,endfunction\n", - "def fun1(x):\n", - "\ty = (0.05*T**2+0.10*T+0.085)/T\n", - "\treturn y\n", - "\n", - "#deltaS_system = scipy.integrate.quad(k,T1, T2)\n", - "deltaS_system=-4020.043\n", - "print(\"deltaS_reservoir=Q2/T2=(Q1-W)/T2\"),\n", - "print(\"also,we know from entropy principle,deltaS_universe is greater than equal to 0\")\n", - "print(\"deltaS_universe=deltaS_system+deltaS_reservoir\")\n", - "print(\"thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\")\n", - "print(\"W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\")\n", - "W=(Q1+deltaS_system*T2)/1000\n", - "print(\"hence maximum work in KJ=\"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.10;pg no: 149" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.10, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\n", - "for reversible adiabatic process governing equation for expansion,\n", - "P*V**1.4=constant\n", - "also,for such process entropy change=0\n", - "using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\n", - "final pressure(p2)in Mpa\n", - "p2= 0.24\n", - "from first law,second law and definition of enthalpy;\n", - "dH=T*dS+v*dP\n", - "for adiabatic process of reversible type,dS=0\n", - "so dH=v*dP\n", - "integrating both side H2-H1=deltaH=v*dP in KJ\n", - "so enthalpy change(deltaH)in KJ=268.8\n", - "and entropy change=0\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "\n", - "print\"Example 5.10, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\")\n", - "import scipy\n", - "from scipy import integrate\n", - "\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "p1=3.;#initial pressure in Mpa\n", - "v1=0.05;#initial volume in m**3\n", - "v2=0.3;#final volume in m**3\n", - "print(\"for reversible adiabatic process governing equation for expansion,\")\n", - "print(\"P*V**1.4=constant\")\n", - "print(\"also,for such process entropy change=0\")\n", - "print(\"using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\")\n", - "print(\"final pressure(p2)in Mpa\")\n", - "p2=p1*(v1/v2)**1.4\n", - "print(\"p2=\"),round(p2,2)\n", - "print(\"from first law,second law and definition of enthalpy;\")\n", - "print(\"dH=T*dS+v*dP\")\n", - "print(\"for adiabatic process of reversible type,dS=0\")\n", - "dS=0;#for adiabatic process of reversible type\n", - "print(\"so dH=v*dP\")\n", - "print(\"integrating both side H2-H1=deltaH=v*dP in KJ\")\n", - "p1=3.*1000.;#initial pressure in Kpa\n", - "p2=244.;#final pressure in Kpa\n", - "#function y = f(p), y =(p1*(v1**1.4)/p)**(1/1.4)\n", - "def fun1(x):\n", - "\ty=(p1*(v1**1.4)/p2)**(1/1.4)\n", - "\treturn y\n", - "\n", - "deltaH = scipy.integrate.quad(fun1,p2,p1)\n", - "print (\"so enthalpy change(deltaH)in KJ=268.8\")\n", - "print(\"and entropy change=0\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.11;pg no: 150" - ] - }, - { - "cell_type": "code", - "execution_count": 59, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.11, Page:150 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\n", - "during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\n", - "a> change in entropy of air(deltaS_air)in J/K\n", - "deltaS_air= 1321.68\n", - "b> during free expansion on heat is gained or lost to surrounding so,\n", - "deltaS_surrounding=0\n", - "entropy change of surroundings=0\n", - "c> entropy change of universe(deltaS_universe)in J/K\n", - "deltaS_universe= 1321.68\n" - ] - } - ], - "source": [ - "#cal of deltaS_universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.11, Page:150 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\")\n", - "m=2;#mass of air in kg\n", - "v1=1;#initial volume of air in m^3\n", - "v2=10;#final volume of air in m^3\n", - "R=287;#gas constant in J/kg K\n", - "print(\"during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\")\n", - "print(\"a> change in entropy of air(deltaS_air)in J/K\")\n", - "deltaS_air=m*R*math.log(v2/v1)\n", - "print(\"deltaS_air=\"),round(deltaS_air,2)\n", - "print(\"b> during free expansion on heat is gained or lost to surrounding so,\")\n", - "print(\"deltaS_surrounding=0\")\n", - "print(\"entropy change of surroundings=0\")\n", - "deltaS_surrounding=0;#entropy change of surroundings\n", - "print(\"c> entropy change of universe(deltaS_universe)in J/K\")\n", - "deltaS_universe=deltaS_air+deltaS_surrounding\n", - "print(\"deltaS_universe=\"),round(deltaS_universe,2)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "##example 5.12;pg no: 150" - ] - }, - { - "cell_type": "code", - "execution_count": 60, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.12, Page:150 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\n", - "let initial and final states be denoted by 1 and 2\n", - "for poly tropic process pressure and temperature can be related as\n", - "(p2/p1)^((n-1)/n)=T2/T1\n", - "so temperature after compression(T2)=in K 1128.94\n", - "substituting in entropy change expression for polytropic process,\n", - "entropy change(deltaS)inKJ/kg K\n", - "deltaS= -0.24454\n", - "NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\n", - "total entropy change(deltaS)=in J/K -122.27\n" - ] - } - ], - "source": [ - "#cal of total entropy change\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.12, Page:150 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\")\n", - "m=0.5;#mass of air in kg\n", - "p1=1.013*10**5;#initial pressure of air in pa\n", - "p2=0.8*10**6;#final pressure of air in pa\n", - "T1=800;#initial temperature of air in K\n", - "n=1.2;#polytropic expansion constant\n", - "y=1.4;#expansion constant for air\n", - "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", - "print(\"let initial and final states be denoted by 1 and 2\")\n", - "print(\"for poly tropic process pressure and temperature can be related as\")\n", - "print(\"(p2/p1)^((n-1)/n)=T2/T1\")\n", - "T2=T1*(p2/p1)**((n-1)/n)\n", - "print(\"so temperature after compression(T2)=in K\"),round(T2,2)\n", - "print(\"substituting in entropy change expression for polytropic process,\") \n", - "print(\"entropy change(deltaS)inKJ/kg K\")\n", - "deltaS=Cv*((n-y)/(n-1))*math.log(T2/T1)\n", - "print(\"deltaS=\"),round(deltaS,5)\n", - "print(\"NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\")\n", - "deltaS=m*deltaS*1000\n", - "print(\"total entropy change(deltaS)=in J/K\"),round(deltaS,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.13;pg no: 151" - ] - }, - { - "cell_type": "code", - "execution_count": 61, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.13, Page:151 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\n", - "NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.13, Page:151 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\")\n", - "print(\"NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.14;pg no: 152" - ] - }, - { - "cell_type": "code", - "execution_count": 62, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.14, Page:152 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\n", - "clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\n", - "K=dQ/T=Q1/T1-Q2/T2\n", - "i> for Q2=200 kcal/s\n", - "K=in kcal/s K 0.0\n", - "as K is not greater than 0,therefore under these conditions engine is not possible\n", - "ii> for Q2=400 kcal/s\n", - "K=in kcal/s K -1.0\n", - "as K is less than 0,so engine is feasible and cycle is reversible\n", - "iii> for Q2=250 kcal/s\n", - "K=in kcal/s K 0.0\n", - "as K=0,so engine is feasible and cycle is reversible\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.14, Page:152 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\")\n", - "Q1=500;#heat supplied by source in kcal/s\n", - "T1=600;#temperature of source in K\n", - "T2=300;#temperature of sink in K\n", - "print(\"clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\")\n", - "print(\"K=dQ/T=Q1/T1-Q2/T2\")\n", - "print(\"i> for Q2=200 kcal/s\")\n", - "Q2=200;#heat rejected by sink in kcal/s\n", - "K=Q1/T1-Q2/T2\n", - "print(\"K=in kcal/s K\"),round(K,2)\n", - "print(\"as K is not greater than 0,therefore under these conditions engine is not possible\")\n", - "print(\"ii> for Q2=400 kcal/s\")\n", - "Q2=400;#heat rejected by sink in kcal/s\n", - "K=Q1/T1-Q2/T2\n", - "print(\"K=in kcal/s K\"),round(K,2)\n", - "print(\"as K is less than 0,so engine is feasible and cycle is reversible\")\n", - "print(\"iii> for Q2=250 kcal/s\")\n", - "Q2=250;#heat rejected by sink in kcal/s\n", - "K=Q1/T1-Q2/T2\n", - "print(\"K=in kcal/s K\"),round(K,2)\n", - "print(\"as K=0,so engine is feasible and cycle is reversible\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.15;pg no: 152" - ] - }, - { - "cell_type": "code", - "execution_count": 63, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.15, Page:152 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\n", - "let the two points be given as states 1 and 2,\n", - "let us assume flow to be from 1 to 2\n", - "so entropy change(deltaS1_2)=s1-s2=in KJ/kg K -0.0\n", - "deltaS1_2=s1-s2=0.01254 KJ/kg K\n", - "it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\n", - "hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.15, Page:152 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\")\n", - "p1=0.5;#initial pressure of air in Mpa\n", - "T1=400;#initial temperature of air in K\n", - "p2=0.3;#final pressure of air in Mpa\n", - "T2=350;#initial temperature of air in K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", - "print(\"let the two points be given as states 1 and 2,\")\n", - "print(\"let us assume flow to be from 1 to 2\")\n", - "deltaS1_2=Cp*math.log(T1/T2)-R*math.log(p1/p2)\n", - "print(\"so entropy change(deltaS1_2)=s1-s2=in KJ/kg K\"),round(deltaS1_2)\n", - "print(\"deltaS1_2=s1-s2=0.01254 KJ/kg K\")\n", - "print(\"it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\")\n", - "print(\"hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.16;pg no: 153" - ] - }, - { - "cell_type": "code", - "execution_count": 64, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.16, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\n", - "NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.16, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\")\n", - "print(\"NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.17;pg no: 153" - ] - }, - { - "cell_type": "code", - "execution_count": 66, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.17, Page:153 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\n", - "total heat added(Q)in KJ\n", - "Q= 1800.0\n", - "for heat addition process 1-2\n", - "Q12=T1*(s2-s1)\n", - "deltaS=s2-s1=in KJ/K 2.0\n", - "or heat addition process 3-4\n", - "Q34=T3*(s4-s3)\n", - "deltaS=s4-s3=in KJ/K 2.0\n", - "or heat rejected in process 5-6(Q56)in KJ\n", - "Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)= 1200.0\n", - "net work done=net heat(W_net)in KJ\n", - "W_net=(Q12+Q34)-Q56 600.0\n", - "thermal efficiency of cycle(n)= 0.33\n", - "or n=n*100 % 33.33\n", - "so work done=600 KJ and thermal efficiency=33.33 %\n" - ] - } - ], - "source": [ - "#cal of work done and thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.17, Page:153 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\")\n", - "Q12=1000.;#heat added during process 1-2 in KJ\n", - "Q34=800.;#heat added during process 3-4 in KJ\n", - "T1=500.;#operating temperature for process 1-2\n", - "T3=400.;#operating temperature for process 3-4\n", - "T5=300.;#operating temperature for process 5-6\n", - "T2=T1;#isothermal process\n", - "T4=T3;#isothermal process\n", - "T6=T5;#isothermal process\n", - "print(\"total heat added(Q)in KJ\")\n", - "Q=Q12+Q34\n", - "print(\"Q=\"),round(Q,2)\n", - "print(\"for heat addition process 1-2\")\n", - "print(\"Q12=T1*(s2-s1)\")\n", - "deltaS=Q12/T1\n", - "print(\"deltaS=s2-s1=in KJ/K\"),round(deltaS,2)\n", - "print(\"or heat addition process 3-4\")\n", - "print(\"Q34=T3*(s4-s3)\")\n", - "deltaS=Q34/T3\n", - "print(\"deltaS=s4-s3=in KJ/K\"),round(deltaS,2)\n", - "print(\"or heat rejected in process 5-6(Q56)in KJ\")\n", - "Q56=T5*(deltaS+deltaS)\n", - "print(\"Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)=\"),round(Q56,2)\n", - "print(\"net work done=net heat(W_net)in KJ\")\n", - "W_net=(Q12+Q34)-Q56\n", - "print(\"W_net=(Q12+Q34)-Q56\"),round(W_net,2)\n", - "n=W_net/Q\n", - "print(\"thermal efficiency of cycle(n)=\"),round(n,2)\n", - "n=n*100\n", - "print(\"or n=n*100 %\"),round(n,2) \n", - "print(\"so work done=600 KJ and thermal efficiency=33.33 %\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.18;pg no: 154" - ] - }, - { - "cell_type": "code", - "execution_count": 67, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.18, Page:154 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\n", - "let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\n", - "here Q1-Q2=W\n", - "so heat supplied by source(Q1)in KW= 30.0\n", - "also given that,Q1_a=0.7*Q1_b.......eq 1\n", - "Q1_c=Q1-(0.7*Q1_b+Q1_b)\n", - "Q1_c=Q1-1.7*Q1_b........eq 2\n", - "for reversible engine\n", - "Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\n", - "substitute eq 1 and eq 2 in eq 3 we get, \n", - "heat supplied by reservoir of 700 K(Q1_b)in KJ/s\n", - "Q1_b= 35.39\n", - "so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\n", - "Q1_a= 24.78\n", - "and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\n", - "Q1_c=Q1-1.7*Q1_b -30.17\n", - "so heat supplied by reservoir at 800 K(Q1_a)= 24.78\n", - "so heat supplied by reservoir at 700 K(Q1_b)= 35.39\n", - "so heat supplied by reservoir at 600 K(Q1_c)= -30.17\n", - "NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\n" - ] - } - ], - "source": [ - "#cal of heat supplied by reservoir at 800,700,600\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.18, Page:154 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\")\n", - "T1_a=800.;#temperature of reservoir a in K\n", - "T1_b=700.;#temperature of reservoir b in K\n", - "T1_c=600.;#temperature of reservoir c in K\n", - "T2=320.;#temperature of sink in K\n", - "W=20.;#work done in KW\n", - "Q2=10.;#heat rejected to sink in KW\n", - "print(\"let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\")\n", - "print(\"here Q1-Q2=W\")\n", - "Q1=W+Q2\n", - "print(\"so heat supplied by source(Q1)in KW=\"),round(Q1,2)\n", - "print(\"also given that,Q1_a=0.7*Q1_b.......eq 1\")\n", - "print(\"Q1_c=Q1-(0.7*Q1_b+Q1_b)\")\n", - "print(\"Q1_c=Q1-1.7*Q1_b........eq 2\")\n", - "print(\"for reversible engine\")\n", - "print(\"Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\")\n", - "print(\"substitute eq 1 and eq 2 in eq 3 we get, \")\n", - "print(\"heat supplied by reservoir of 700 K(Q1_b)in KJ/s\")\n", - "Q1_b=((Q2/T2)-(Q1/T1_c))/((0.7/T1_a)+(1/T1_b)-(1.7/T1_c))\n", - "print(\"Q1_b=\"),round(Q1_b,2)\n", - "print(\"so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\")\n", - "Q1_a=0.7*Q1_b\n", - "print(\"Q1_a=\"),round(Q1_a,2)\n", - "print(\"and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\")\n", - "Q1_c=Q1-1.7*Q1_b\n", - "print(\"Q1_c=Q1-1.7*Q1_b\"),round(Q1_c,2)\n", - "print(\"so heat supplied by reservoir at 800 K(Q1_a)=\"),round(Q1_a,2)\n", - "print(\"so heat supplied by reservoir at 700 K(Q1_b)=\"),round(Q1_b,2)\n", - "print(\"so heat supplied by reservoir at 600 K(Q1_c)=\"),round(Q1_c,2)\n", - "print(\"NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter5_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter5_1.ipynb deleted file mode 100755 index 2eb17c0f..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter5_1.ipynb +++ /dev/null @@ -1,1126 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5:Entropy" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.1;pg no: 144" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.1, Page:144 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\n", - "entropy change may be given as,\n", - "s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\n", - "here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\n", - "so change in entropy(deltaS)in KJ/kg K\n", - "deltaS= 0.263\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.1, Page:144 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\")\n", - "p1=5.;#initial pressure of air\n", - "T1=(27.+273.);#temperature of air in K\n", - "p2=2.;#final pressure of air in K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cp_air=1.004;#specific heat of air at constant pressure in KJ/kg K\n", - "print(\"entropy change may be given as,\")\n", - "print(\"s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\")\n", - "print(\"here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\")\n", - "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", - "deltaS=(Cp_air*0)-(R*math.log(p2/p1))\n", - "print(\"deltaS=\"),round(deltaS,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.2;pg no: 144" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.2, Page:144 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\n", - "total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\n", - "deltaS1=Q1/T1,where Q1=m*Cp*deltaT\n", - "heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\n", - "Q1= 1533.0\n", - "deltaS1=Q1/T1 in KJ/K 5.11\n", - "now heat of vaporisation(Q2)=in KJ 11300.0\n", - "entropy change during phase transformation(deltaS2)in KJ/K\n", - "deltaS2= 30.29\n", - "entropy change during steam temperature rise(deltaS3)in KJ/K\n", - "deltaS3=m*Cp_steam*dT/T\n", - "here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\n", - "R=in KJ/kg K 0.46\n", - "now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\n", - "total entropy change(deltaS) in KJ/K= 87.24\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.2, Page:144 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\")\n", - "import scipy\n", - "from scipy import integrate\n", - "##just an example function\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "T1=(27.+273.);#temperature of water in K\n", - "T2=(100.+273.);#steam temperature of water in K\n", - "m=5.;#mass of water in kg\n", - "q=2260.;#heat of vaporisation at 100 degree celcius in KJ/kg\n", - "Cp=4.2;#specific heat of water at constant pressure in KJ/kg K\n", - "M=18.;#molar mass for water/steam \n", - "R1=8.314;#gas constant in KJ/kg K\n", - "print(\"total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\")\n", - "Q1=m*Cp*(T2-T1)\n", - "print(\"deltaS1=Q1/T1,where Q1=m*Cp*deltaT\")\n", - "print(\"heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\")\n", - "print(\"Q1=\"),round(Q1,2)\n", - "deltaS1=Q1/T1\n", - "print(\"deltaS1=Q1/T1 in KJ/K\"),round(deltaS1,2)\n", - "Q2=m*q\n", - "print(\"now heat of vaporisation(Q2)=in KJ\"),round(Q2,2)\n", - "print(\"entropy change during phase transformation(deltaS2)in KJ/K\")\n", - "deltaS2=Q2/T2\n", - "print(\"deltaS2=\"),round(deltaS2,2)\n", - "print(\"entropy change during steam temperature rise(deltaS3)in KJ/K\")\n", - "print(\"deltaS3=m*Cp_steam*dT/T\")\n", - "print(\"here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\")\n", - "R=R1/M\n", - "print(\"R=in KJ/kg K\"),round(R,2)\n", - "T2=(100+273.15);#steam temperature of water in K\n", - "T3=(400+273.15);#temperature of steam in K\n", - "print(\"now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\")\n", - "#function y = f(T), y =(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T , endfunction\n", - "def fun1(x):\n", - "\ty=(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T\n", - "\treturn y\n", - "\n", - "#deltaS3 =scipy.integrate.quad(f,T2, T3) \n", - "deltaS3=51.84;#approximately\n", - "deltaS=deltaS1+deltaS2+deltaS3\n", - "print(\"total entropy change(deltaS) in KJ/K=\"),round(deltaS,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.3;pg no: 145" - ] - }, - { - "cell_type": "code", - "execution_count": 51, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.3, Page:145 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\n", - "gas constant for oxygen(R)in KJ/kg K\n", - "R= 0.26\n", - "for reversible process the change in entropy may be given as\n", - "deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\n", - "so entropy change=deltaS= in (KJ/kg K) -0.29\n" - ] - } - ], - "source": [ - "#cal of entropy change\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.3, Page:145 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\")\n", - "R1=8.314;#gas constant in KJ/kg K\n", - "M=32;#molar mass for O2 \n", - "T1=(27+273);#initial temperature of O2 in K\n", - "p1=125;#initial pressure of O2 in Kpa\n", - "p2=375;#final pressure of O2 in Kpa\n", - "Cp=1.004;#specific heat of air at constant pressure in KJ/kg K\n", - "print(\"gas constant for oxygen(R)in KJ/kg K\")\n", - "R=R1/M\n", - "print(\"R=\"),round(R,2)\n", - "print(\"for reversible process the change in entropy may be given as\")\n", - "print(\"deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\")\n", - "T2=T1;#isothermal process\n", - "deltaS=(Cp*math.log(T2/T1))-(R*math.log(p2/p1))\n", - "print(\"so entropy change=deltaS= in (KJ/kg K)\"),round(deltaS,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.4;pg no: 145" - ] - }, - { - "cell_type": "code", - "execution_count": 52, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.4, Page:145 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\n", - "entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\n", - "where deltaS_block=m*C*log(T2/T1)\n", - "here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\n", - "therefore deltaS_block=in KJ/K -0.14\n", - "heat loss by block =heat gained by water(Q)in KJ\n", - "Q=-m*C*(T1-T2) -49.13\n", - "therefore deltaS_water=-Q/T2 in KJ/K 0.16\n", - "thus deltaS_universe=in J/K 27.16\n" - ] - } - ], - "source": [ - "#cal of deltaS_universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.4, Page:145 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\")\n", - "T1=(150+273.15);#temperature of copper block in K\n", - "T2=(25+273.15);#temperature of sea water in K\n", - "m=1;#mass of copper block in kg\n", - "C=0.393;#heat capacity of copper in KJ/kg K\n", - "print(\"entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\")\n", - "print(\"where deltaS_block=m*C*log(T2/T1)\")\n", - "print(\"here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\")\n", - "deltaS_block=m*C*math.log(T2/T1)\n", - "print(\"therefore deltaS_block=in KJ/K\"),round(deltaS_block,2)\n", - "print(\"heat loss by block =heat gained by water(Q)in KJ\")\n", - "Q=-m*C*(T1-T2)\n", - "print(\"Q=-m*C*(T1-T2)\"),round(Q,2)\n", - "deltaS_water=-Q/T2\n", - "print(\"therefore deltaS_water=-Q/T2 in KJ/K\"),round(deltaS_water,2)\n", - "deltaS_universe=(deltaS_block+deltaS_water)*1000\n", - "print(\"thus deltaS_universe=in J/K\"),round(deltaS_universe,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.5;pg no: 146" - ] - }, - { - "cell_type": "code", - "execution_count": 53, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.5, Page:146 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\n", - "deltaS_universe=(deltaS_block+deltaS_seawater)\n", - "since block and sea water both are at same temperature so,\n", - "deltaS_universe=deltaS_seawater\n", - "conservation of energy equation yields,\n", - "Q-W=deltaU+deltaP.E+deltaK.E\n", - "since in this case,W=0,deltaK.E=0,deltaU=0\n", - "Q=deltaP.E\n", - "change in potential energy=deltaP.E=m*g*h in J\n", - "deltaS_universe=deltaS_seawater=Q/T in J/kg K\n", - "entropy change of universe(deltaS_universe)in J/kg K 6.54\n" - ] - } - ], - "source": [ - "#cal of entropy change of universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.5, Page:146 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\")\n", - "m=1;#mass of copper block in kg\n", - "T=(27+273);#temperature of copper block in K\n", - "h=200;#height from which copper block dropped in sea water in m\n", - "C=0.393;#heat capacity for copper in KJ/kg K\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"deltaS_universe=(deltaS_block+deltaS_seawater)\")\n", - "print(\"since block and sea water both are at same temperature so,\")\n", - "print(\"deltaS_universe=deltaS_seawater\")\n", - "print(\"conservation of energy equation yields,\")\n", - "print(\"Q-W=deltaU+deltaP.E+deltaK.E\")\n", - "print(\"since in this case,W=0,deltaK.E=0,deltaU=0\")\n", - "deltaPE=m*g*h\n", - "Q=deltaPE\n", - "print(\"Q=deltaP.E\")\n", - "print(\"change in potential energy=deltaP.E=m*g*h in J\")\n", - "print(\"deltaS_universe=deltaS_seawater=Q/T in J/kg K\")\n", - "deltaS_universe=Q/T\n", - "print(\"entropy change of universe(deltaS_universe)in J/kg K\"),round(deltaS_universe,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.6;pg no: 146" - ] - }, - { - "cell_type": "code", - "execution_count": 54, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.6, Page:146 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\n", - "here deltaS_universe=deltaS_block1+deltaS_block2\n", - "two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\n", - "then from energy conservation\n", - "m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\n", - "Tf=in K 374.18\n", - "hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\n", - "deltaS1=in KJ/K -0.05\n", - "entropy change in block 2(deltaS2)in KJ/K\n", - "deltaS2= 0.06\n", - "entropy change of universe(deltaS)=in KJ/K 0.01\n" - ] - } - ], - "source": [ - "#cal of entropy change of universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.6, Page:146 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\")\n", - "m1=1;#mass of first copper block in kg\n", - "m2=0.5;#mass of second copper block in kg\n", - "T1=(150+273.15);#temperature of first copper block in K\n", - "T2=(0+273.15);#temperature of second copper block in K\n", - "Cp_1=0.393;#heat capacity for copper block 1 in KJ/kg K\n", - "Cp_2=0.381;#heat capacity for copper block 2 in KJ/kg K\n", - "print(\"here deltaS_universe=deltaS_block1+deltaS_block2\")\n", - "print(\"two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\")\n", - "print(\"then from energy conservation\")\n", - "print(\"m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\")\n", - "Tf=((m1*Cp_1*T1)+(m2*Cp_2*T2))/(m1*Cp_1+m2*Cp_2)\n", - "print(\"Tf=in K\"),round(Tf,2)\n", - "print(\"hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\")\n", - "deltaS1=m1*Cp_1*math.log(Tf/T1)\n", - "print(\"deltaS1=in KJ/K\"),round(deltaS1,2)\n", - "print(\"entropy change in block 2(deltaS2)in KJ/K\")\n", - "deltaS2=m2*Cp_2*math.log(Tf/T2)\n", - "print(\"deltaS2=\"),round(deltaS2,2)\n", - "deltaS=deltaS1+deltaS2\n", - "print(\"entropy change of universe(deltaS)=in KJ/K\"),round(deltaS,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.7;pg no: 147" - ] - }, - { - "cell_type": "code", - "execution_count": 55, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.7, Page:147 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\n", - "NOTE=>in this question formula is derived which cannot be solve using python software\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.7, Page:147 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\")\n", - "print(\"NOTE=>in this question formula is derived which cannot be solve using python software\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.8;pg no: 148" - ] - }, - { - "cell_type": "code", - "execution_count": 56, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.8, Page:148 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\n", - "for irreversible operation of engine,\n", - "rate of entropy generation=Q1/T1+Q2/T2\n", - "W=Q1-Q2=>Q2=Q1-W in MW 3.0\n", - "entropy generated(deltaS_gen)in MW\n", - "deltaS_gen= 0.01\n", - "work lost(W_lost)in MW\n", - "W_lost=T2*deltaS_gen 4.0\n" - ] - } - ], - "source": [ - "#cal of work lost\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.8, Page:148 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\")\n", - "T1=1800.;#temperature of high temperature reservoir in K\n", - "T2=300.;#temperature of low temperature reservoir in K\n", - "Q1=5.;#heat addition in MW\n", - "W=2.;#work done in MW\n", - "print(\"for irreversible operation of engine,\")\n", - "print(\"rate of entropy generation=Q1/T1+Q2/T2\")\n", - "Q2=Q1-W\n", - "print(\"W=Q1-Q2=>Q2=Q1-W in MW\"),round(Q2,2)\n", - "print(\"entropy generated(deltaS_gen)in MW\")\n", - "deltaS_gen=Q1/T1+Q2/T2\n", - "print(\"deltaS_gen=\"),round(deltaS_gen,2)\n", - "Q1=-5;#heat addition in MW\n", - "print(\"work lost(W_lost)in MW\")\n", - "W_lost=T2*deltaS_gen\n", - "print(\"W_lost=T2*deltaS_gen\"),round(W_lost)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.9;pg no: 148" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.9, Page:148 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\n", - "system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\n", - "therefore,maximum heat(Q1)=(C*dT)in J\n", - "here C=0.05*T^2+0.10*T+0.085 in J/K\n", - "so Q1=(0.05*T^2+0.10*T+0.085)*dT\n", - "entropy change of system,deltaS_system=C*dT/T in J/K\n", - "so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\n", - "deltaS_reservoir=Q2/T2=(Q1-W)/T2 also,we know from entropy principle,deltaS_universe is greater than equal to 0\n", - "deltaS_universe=deltaS_system+deltaS_reservoir\n", - "thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\n", - "W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\n", - "hence maximum work in KJ= 435.34\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.9, Page:148 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\")\n", - "import scipy\n", - "from scipy import integrate\n", - "\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "T1=500;#temperature of system in K\n", - "T2=300;#temperature of reservoir in K\n", - "print(\"system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\")\n", - "print(\"therefore,maximum heat(Q1)=(C*dT)in J\")\n", - "print(\"here C=0.05*T^2+0.10*T+0.085 in J/K\")\n", - "print(\"so Q1=(0.05*T^2+0.10*T+0.085)*dT\")\n", - "T=T1-T2\n", - "#Q1=(0.05*T**2+0.10*T+0.085)*dT\n", - "#function y = f(T), y = (0.05*T**2+0.10*T+0.085),endfunction\n", - "#Q1 = scipy.integrate.quad(fun1,T1, T2)\n", - "#Q1=-Q1\n", - "Q1=1641.35*10**3\n", - "print(\"entropy change of system,deltaS_system=C*dT/T in J/K\")\n", - "print(\"so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\")\n", - "#function y = k(T), y = (0.05*T**2+0.10*T+0.085)/T,endfunction\n", - "def fun1(x):\n", - "\ty = (0.05*T**2+0.10*T+0.085)/T\n", - "\treturn y\n", - "\n", - "#deltaS_system = scipy.integrate.quad(k,T1, T2)\n", - "deltaS_system=-4020.043\n", - "print(\"deltaS_reservoir=Q2/T2=(Q1-W)/T2\"),\n", - "print(\"also,we know from entropy principle,deltaS_universe is greater than equal to 0\")\n", - "print(\"deltaS_universe=deltaS_system+deltaS_reservoir\")\n", - "print(\"thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\")\n", - "print(\"W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\")\n", - "W=(Q1+deltaS_system*T2)/1000\n", - "print(\"hence maximum work in KJ=\"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.10;pg no: 149" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.10, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\n", - "for reversible adiabatic process governing equation for expansion,\n", - "P*V**1.4=constant\n", - "also,for such process entropy change=0\n", - "using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\n", - "final pressure(p2)in Mpa\n", - "p2= 0.24\n", - "from first law,second law and definition of enthalpy;\n", - "dH=T*dS+v*dP\n", - "for adiabatic process of reversible type,dS=0\n", - "so dH=v*dP\n", - "integrating both side H2-H1=deltaH=v*dP in KJ\n", - "so enthalpy change(deltaH)in KJ=268.8\n", - "and entropy change=0\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "\n", - "print\"Example 5.10, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\")\n", - "import scipy\n", - "from scipy import integrate\n", - "\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "p1=3.;#initial pressure in Mpa\n", - "v1=0.05;#initial volume in m**3\n", - "v2=0.3;#final volume in m**3\n", - "print(\"for reversible adiabatic process governing equation for expansion,\")\n", - "print(\"P*V**1.4=constant\")\n", - "print(\"also,for such process entropy change=0\")\n", - "print(\"using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\")\n", - "print(\"final pressure(p2)in Mpa\")\n", - "p2=p1*(v1/v2)**1.4\n", - "print(\"p2=\"),round(p2,2)\n", - "print(\"from first law,second law and definition of enthalpy;\")\n", - "print(\"dH=T*dS+v*dP\")\n", - "print(\"for adiabatic process of reversible type,dS=0\")\n", - "dS=0;#for adiabatic process of reversible type\n", - "print(\"so dH=v*dP\")\n", - "print(\"integrating both side H2-H1=deltaH=v*dP in KJ\")\n", - "p1=3.*1000.;#initial pressure in Kpa\n", - "p2=244.;#final pressure in Kpa\n", - "#function y = f(p), y =(p1*(v1**1.4)/p)**(1/1.4)\n", - "def fun1(x):\n", - "\ty=(p1*(v1**1.4)/p2)**(1/1.4)\n", - "\treturn y\n", - "\n", - "deltaH = scipy.integrate.quad(fun1,p2,p1)\n", - "print (\"so enthalpy change(deltaH)in KJ=268.8\")\n", - "print(\"and entropy change=0\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.11;pg no: 150" - ] - }, - { - "cell_type": "code", - "execution_count": 59, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.11, Page:150 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\n", - "during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\n", - "a> change in entropy of air(deltaS_air)in J/K\n", - "deltaS_air= 1321.68\n", - "b> during free expansion on heat is gained or lost to surrounding so,\n", - "deltaS_surrounding=0\n", - "entropy change of surroundings=0\n", - "c> entropy change of universe(deltaS_universe)in J/K\n", - "deltaS_universe= 1321.68\n" - ] - } - ], - "source": [ - "#cal of deltaS_universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.11, Page:150 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\")\n", - "m=2;#mass of air in kg\n", - "v1=1;#initial volume of air in m^3\n", - "v2=10;#final volume of air in m^3\n", - "R=287;#gas constant in J/kg K\n", - "print(\"during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\")\n", - "print(\"a> change in entropy of air(deltaS_air)in J/K\")\n", - "deltaS_air=m*R*math.log(v2/v1)\n", - "print(\"deltaS_air=\"),round(deltaS_air,2)\n", - "print(\"b> during free expansion on heat is gained or lost to surrounding so,\")\n", - "print(\"deltaS_surrounding=0\")\n", - "print(\"entropy change of surroundings=0\")\n", - "deltaS_surrounding=0;#entropy change of surroundings\n", - "print(\"c> entropy change of universe(deltaS_universe)in J/K\")\n", - "deltaS_universe=deltaS_air+deltaS_surrounding\n", - "print(\"deltaS_universe=\"),round(deltaS_universe,2)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "##example 5.12;pg no: 150" - ] - }, - { - "cell_type": "code", - "execution_count": 60, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.12, Page:150 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\n", - "let initial and final states be denoted by 1 and 2\n", - "for poly tropic process pressure and temperature can be related as\n", - "(p2/p1)^((n-1)/n)=T2/T1\n", - "so temperature after compression(T2)=in K 1128.94\n", - "substituting in entropy change expression for polytropic process,\n", - "entropy change(deltaS)inKJ/kg K\n", - "deltaS= -0.24454\n", - "NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\n", - "total entropy change(deltaS)=in J/K -122.27\n" - ] - } - ], - "source": [ - "#cal of total entropy change\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.12, Page:150 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\")\n", - "m=0.5;#mass of air in kg\n", - "p1=1.013*10**5;#initial pressure of air in pa\n", - "p2=0.8*10**6;#final pressure of air in pa\n", - "T1=800;#initial temperature of air in K\n", - "n=1.2;#polytropic expansion constant\n", - "y=1.4;#expansion constant for air\n", - "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", - "print(\"let initial and final states be denoted by 1 and 2\")\n", - "print(\"for poly tropic process pressure and temperature can be related as\")\n", - "print(\"(p2/p1)^((n-1)/n)=T2/T1\")\n", - "T2=T1*(p2/p1)**((n-1)/n)\n", - "print(\"so temperature after compression(T2)=in K\"),round(T2,2)\n", - "print(\"substituting in entropy change expression for polytropic process,\") \n", - "print(\"entropy change(deltaS)inKJ/kg K\")\n", - "deltaS=Cv*((n-y)/(n-1))*math.log(T2/T1)\n", - "print(\"deltaS=\"),round(deltaS,5)\n", - "print(\"NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\")\n", - "deltaS=m*deltaS*1000\n", - "print(\"total entropy change(deltaS)=in J/K\"),round(deltaS,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.13;pg no: 151" - ] - }, - { - "cell_type": "code", - "execution_count": 61, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.13, Page:151 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\n", - "NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.13, Page:151 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\")\n", - "print(\"NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.14;pg no: 152" - ] - }, - { - "cell_type": "code", - "execution_count": 62, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.14, Page:152 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\n", - "clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\n", - "K=dQ/T=Q1/T1-Q2/T2\n", - "i> for Q2=200 kcal/s\n", - "K=in kcal/s K 0.0\n", - "as K is not greater than 0,therefore under these conditions engine is not possible\n", - "ii> for Q2=400 kcal/s\n", - "K=in kcal/s K -1.0\n", - "as K is less than 0,so engine is feasible and cycle is reversible\n", - "iii> for Q2=250 kcal/s\n", - "K=in kcal/s K 0.0\n", - "as K=0,so engine is feasible and cycle is reversible\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.14, Page:152 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\")\n", - "Q1=500;#heat supplied by source in kcal/s\n", - "T1=600;#temperature of source in K\n", - "T2=300;#temperature of sink in K\n", - "print(\"clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\")\n", - "print(\"K=dQ/T=Q1/T1-Q2/T2\")\n", - "print(\"i> for Q2=200 kcal/s\")\n", - "Q2=200;#heat rejected by sink in kcal/s\n", - "K=Q1/T1-Q2/T2\n", - "print(\"K=in kcal/s K\"),round(K,2)\n", - "print(\"as K is not greater than 0,therefore under these conditions engine is not possible\")\n", - "print(\"ii> for Q2=400 kcal/s\")\n", - "Q2=400;#heat rejected by sink in kcal/s\n", - "K=Q1/T1-Q2/T2\n", - "print(\"K=in kcal/s K\"),round(K,2)\n", - "print(\"as K is less than 0,so engine is feasible and cycle is reversible\")\n", - "print(\"iii> for Q2=250 kcal/s\")\n", - "Q2=250;#heat rejected by sink in kcal/s\n", - "K=Q1/T1-Q2/T2\n", - "print(\"K=in kcal/s K\"),round(K,2)\n", - "print(\"as K=0,so engine is feasible and cycle is reversible\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.15;pg no: 152" - ] - }, - { - "cell_type": "code", - "execution_count": 63, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.15, Page:152 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\n", - "let the two points be given as states 1 and 2,\n", - "let us assume flow to be from 1 to 2\n", - "so entropy change(deltaS1_2)=s1-s2=in KJ/kg K -0.0\n", - "deltaS1_2=s1-s2=0.01254 KJ/kg K\n", - "it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\n", - "hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.15, Page:152 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\")\n", - "p1=0.5;#initial pressure of air in Mpa\n", - "T1=400;#initial temperature of air in K\n", - "p2=0.3;#final pressure of air in Mpa\n", - "T2=350;#initial temperature of air in K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", - "print(\"let the two points be given as states 1 and 2,\")\n", - "print(\"let us assume flow to be from 1 to 2\")\n", - "deltaS1_2=Cp*math.log(T1/T2)-R*math.log(p1/p2)\n", - "print(\"so entropy change(deltaS1_2)=s1-s2=in KJ/kg K\"),round(deltaS1_2)\n", - "print(\"deltaS1_2=s1-s2=0.01254 KJ/kg K\")\n", - "print(\"it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\")\n", - "print(\"hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.16;pg no: 153" - ] - }, - { - "cell_type": "code", - "execution_count": 64, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.16, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\n", - "NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.16, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\")\n", - "print(\"NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.17;pg no: 153" - ] - }, - { - "cell_type": "code", - "execution_count": 66, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.17, Page:153 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\n", - "total heat added(Q)in KJ\n", - "Q= 1800.0\n", - "for heat addition process 1-2\n", - "Q12=T1*(s2-s1)\n", - "deltaS=s2-s1=in KJ/K 2.0\n", - "or heat addition process 3-4\n", - "Q34=T3*(s4-s3)\n", - "deltaS=s4-s3=in KJ/K 2.0\n", - "or heat rejected in process 5-6(Q56)in KJ\n", - "Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)= 1200.0\n", - "net work done=net heat(W_net)in KJ\n", - "W_net=(Q12+Q34)-Q56 600.0\n", - "thermal efficiency of cycle(n)= 0.33\n", - "or n=n*100 % 33.33\n", - "so work done=600 KJ and thermal efficiency=33.33 %\n" - ] - } - ], - "source": [ - "#cal of work done and thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.17, Page:153 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\")\n", - "Q12=1000.;#heat added during process 1-2 in KJ\n", - "Q34=800.;#heat added during process 3-4 in KJ\n", - "T1=500.;#operating temperature for process 1-2\n", - "T3=400.;#operating temperature for process 3-4\n", - "T5=300.;#operating temperature for process 5-6\n", - "T2=T1;#isothermal process\n", - "T4=T3;#isothermal process\n", - "T6=T5;#isothermal process\n", - "print(\"total heat added(Q)in KJ\")\n", - "Q=Q12+Q34\n", - "print(\"Q=\"),round(Q,2)\n", - "print(\"for heat addition process 1-2\")\n", - "print(\"Q12=T1*(s2-s1)\")\n", - "deltaS=Q12/T1\n", - "print(\"deltaS=s2-s1=in KJ/K\"),round(deltaS,2)\n", - "print(\"or heat addition process 3-4\")\n", - "print(\"Q34=T3*(s4-s3)\")\n", - "deltaS=Q34/T3\n", - "print(\"deltaS=s4-s3=in KJ/K\"),round(deltaS,2)\n", - "print(\"or heat rejected in process 5-6(Q56)in KJ\")\n", - "Q56=T5*(deltaS+deltaS)\n", - "print(\"Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)=\"),round(Q56,2)\n", - "print(\"net work done=net heat(W_net)in KJ\")\n", - "W_net=(Q12+Q34)-Q56\n", - "print(\"W_net=(Q12+Q34)-Q56\"),round(W_net,2)\n", - "n=W_net/Q\n", - "print(\"thermal efficiency of cycle(n)=\"),round(n,2)\n", - "n=n*100\n", - "print(\"or n=n*100 %\"),round(n,2) \n", - "print(\"so work done=600 KJ and thermal efficiency=33.33 %\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.18;pg no: 154" - ] - }, - { - "cell_type": "code", - "execution_count": 67, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.18, Page:154 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\n", - "let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\n", - "here Q1-Q2=W\n", - "so heat supplied by source(Q1)in KW= 30.0\n", - "also given that,Q1_a=0.7*Q1_b.......eq 1\n", - "Q1_c=Q1-(0.7*Q1_b+Q1_b)\n", - "Q1_c=Q1-1.7*Q1_b........eq 2\n", - "for reversible engine\n", - "Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\n", - "substitute eq 1 and eq 2 in eq 3 we get, \n", - "heat supplied by reservoir of 700 K(Q1_b)in KJ/s\n", - "Q1_b= 35.39\n", - "so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\n", - "Q1_a= 24.78\n", - "and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\n", - "Q1_c=Q1-1.7*Q1_b -30.17\n", - "so heat supplied by reservoir at 800 K(Q1_a)= 24.78\n", - "so heat supplied by reservoir at 700 K(Q1_b)= 35.39\n", - "so heat supplied by reservoir at 600 K(Q1_c)= -30.17\n", - "NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\n" - ] - } - ], - "source": [ - "#cal of heat supplied by reservoir at 800,700,600\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.18, Page:154 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\")\n", - "T1_a=800.;#temperature of reservoir a in K\n", - "T1_b=700.;#temperature of reservoir b in K\n", - "T1_c=600.;#temperature of reservoir c in K\n", - "T2=320.;#temperature of sink in K\n", - "W=20.;#work done in KW\n", - "Q2=10.;#heat rejected to sink in KW\n", - "print(\"let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\")\n", - "print(\"here Q1-Q2=W\")\n", - "Q1=W+Q2\n", - "print(\"so heat supplied by source(Q1)in KW=\"),round(Q1,2)\n", - "print(\"also given that,Q1_a=0.7*Q1_b.......eq 1\")\n", - "print(\"Q1_c=Q1-(0.7*Q1_b+Q1_b)\")\n", - "print(\"Q1_c=Q1-1.7*Q1_b........eq 2\")\n", - "print(\"for reversible engine\")\n", - "print(\"Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\")\n", - "print(\"substitute eq 1 and eq 2 in eq 3 we get, \")\n", - "print(\"heat supplied by reservoir of 700 K(Q1_b)in KJ/s\")\n", - "Q1_b=((Q2/T2)-(Q1/T1_c))/((0.7/T1_a)+(1/T1_b)-(1.7/T1_c))\n", - "print(\"Q1_b=\"),round(Q1_b,2)\n", - "print(\"so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\")\n", - "Q1_a=0.7*Q1_b\n", - "print(\"Q1_a=\"),round(Q1_a,2)\n", - "print(\"and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\")\n", - "Q1_c=Q1-1.7*Q1_b\n", - "print(\"Q1_c=Q1-1.7*Q1_b\"),round(Q1_c,2)\n", - "print(\"so heat supplied by reservoir at 800 K(Q1_a)=\"),round(Q1_a,2)\n", - "print(\"so heat supplied by reservoir at 700 K(Q1_b)=\"),round(Q1_b,2)\n", - "print(\"so heat supplied by reservoir at 600 K(Q1_c)=\"),round(Q1_c,2)\n", - "print(\"NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter5_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter5_2.ipynb deleted file mode 100755 index cc42cd6f..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter5_2.ipynb +++ /dev/null @@ -1,1124 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5:Entropy" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.1;pg no: 144" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.1, Page:144 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\n", - "entropy change may be given as,\n", - "s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\n", - "here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\n", - "so change in entropy(deltaS)in KJ/kg K\n", - "deltaS= 0.263\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.1, Page:144 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\")\n", - "p1=5.;#initial pressure of air\n", - "T1=(27.+273.);#temperature of air in K\n", - "p2=2.;#final pressure of air in K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cp_air=1.004;#specific heat of air at constant pressure in KJ/kg K\n", - "print(\"entropy change may be given as,\")\n", - "print(\"s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\")\n", - "print(\"here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\")\n", - "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", - "deltaS=(Cp_air*0)-(R*math.log(p2/p1))\n", - "print(\"deltaS=\"),round(deltaS,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.2;pg no: 144" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.2, Page:144 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\n", - "total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\n", - "deltaS1=Q1/T1,where Q1=m*Cp*deltaT\n", - "heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\n", - "Q1= 1533.0\n", - "deltaS1=Q1/T1 in KJ/K 5.11\n", - "now heat of vaporisation(Q2)=in KJ 11300.0\n", - "entropy change during phase transformation(deltaS2)in KJ/K\n", - "deltaS2= 30.29\n", - "entropy change during steam temperature rise(deltaS3)in KJ/K\n", - "deltaS3=m*Cp_steam*dT/T\n", - "here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\n", - "R=in KJ/kg K 0.46\n", - "now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\n", - "total entropy change(deltaS) in KJ/K= 87.24\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.2, Page:144 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\")\n", - "import scipy\n", - "from scipy import integrate\n", - "##just an example function\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "T1=(27.+273.);#temperature of water in K\n", - "T2=(100.+273.);#steam temperature of water in K\n", - "m=5.;#mass of water in kg\n", - "q=2260.;#heat of vaporisation at 100 degree celcius in KJ/kg\n", - "Cp=4.2;#specific heat of water at constant pressure in KJ/kg K\n", - "M=18.;#molar mass for water/steam \n", - "R1=8.314;#gas constant in KJ/kg K\n", - "print(\"total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\")\n", - "Q1=m*Cp*(T2-T1)\n", - "print(\"deltaS1=Q1/T1,where Q1=m*Cp*deltaT\")\n", - "print(\"heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\")\n", - "print(\"Q1=\"),round(Q1,2)\n", - "deltaS1=Q1/T1\n", - "print(\"deltaS1=Q1/T1 in KJ/K\"),round(deltaS1,2)\n", - "Q2=m*q\n", - "print(\"now heat of vaporisation(Q2)=in KJ\"),round(Q2,2)\n", - "print(\"entropy change during phase transformation(deltaS2)in KJ/K\")\n", - "deltaS2=Q2/T2\n", - "print(\"deltaS2=\"),round(deltaS2,2)\n", - "print(\"entropy change during steam temperature rise(deltaS3)in KJ/K\")\n", - "print(\"deltaS3=m*Cp_steam*dT/T\")\n", - "print(\"here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\")\n", - "R=R1/M\n", - "print(\"R=in KJ/kg K\"),round(R,2)\n", - "T2=(100+273.15);#steam temperature of water in K\n", - "T3=(400+273.15);#temperature of steam in K\n", - "print(\"now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\")\n", - "#function y = f(T), y =(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T , endfunction\n", - "def fun1(x):\n", - "\ty=(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T\n", - "\treturn y\n", - "\n", - "#deltaS3 =scipy.integrate.quad(f,T2, T3) \n", - "deltaS3=51.84;#approximately\n", - "deltaS=deltaS1+deltaS2+deltaS3\n", - "print(\"total entropy change(deltaS) in KJ/K=\"),round(deltaS,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.3;pg no: 145" - ] - }, - { - "cell_type": "code", - "execution_count": 51, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.3, Page:145 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\n", - "gas constant for oxygen(R)in KJ/kg K\n", - "R= 0.26\n", - "for reversible process the change in entropy may be given as\n", - "deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\n", - "so entropy change=deltaS= in (KJ/kg K) -0.29\n" - ] - } - ], - "source": [ - "#cal of entropy change\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.3, Page:145 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\")\n", - "R1=8.314;#gas constant in KJ/kg K\n", - "M=32;#molar mass for O2 \n", - "T1=(27+273);#initial temperature of O2 in K\n", - "p1=125;#initial pressure of O2 in Kpa\n", - "p2=375;#final pressure of O2 in Kpa\n", - "Cp=1.004;#specific heat of air at constant pressure in KJ/kg K\n", - "print(\"gas constant for oxygen(R)in KJ/kg K\")\n", - "R=R1/M\n", - "print(\"R=\"),round(R,2)\n", - "print(\"for reversible process the change in entropy may be given as\")\n", - "print(\"deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\")\n", - "T2=T1;#isothermal process\n", - "deltaS=(Cp*math.log(T2/T1))-(R*math.log(p2/p1))\n", - "print(\"so entropy change=deltaS= in (KJ/kg K)\"),round(deltaS,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.4;pg no: 145" - ] - }, - { - "cell_type": "code", - "execution_count": 52, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.4, Page:145 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\n", - "entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\n", - "where deltaS_block=m*C*log(T2/T1)\n", - "here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\n", - "therefore deltaS_block=in KJ/K -0.14\n", - "heat loss by block =heat gained by water(Q)in KJ\n", - "Q=-m*C*(T1-T2) -49.13\n", - "therefore deltaS_water=-Q/T2 in KJ/K 0.16\n", - "thus deltaS_universe=in J/K 27.16\n" - ] - } - ], - "source": [ - "#cal of deltaS_universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.4, Page:145 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\")\n", - "T1=(150+273.15);#temperature of copper block in K\n", - "T2=(25+273.15);#temperature of sea water in K\n", - "m=1;#mass of copper block in kg\n", - "C=0.393;#heat capacity of copper in KJ/kg K\n", - "print(\"entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\")\n", - "print(\"where deltaS_block=m*C*log(T2/T1)\")\n", - "print(\"here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\")\n", - "deltaS_block=m*C*math.log(T2/T1)\n", - "print(\"therefore deltaS_block=in KJ/K\"),round(deltaS_block,2)\n", - "print(\"heat loss by block =heat gained by water(Q)in KJ\")\n", - "Q=-m*C*(T1-T2)\n", - "print(\"Q=-m*C*(T1-T2)\"),round(Q,2)\n", - "deltaS_water=-Q/T2\n", - "print(\"therefore deltaS_water=-Q/T2 in KJ/K\"),round(deltaS_water,2)\n", - "deltaS_universe=(deltaS_block+deltaS_water)*1000\n", - "print(\"thus deltaS_universe=in J/K\"),round(deltaS_universe,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.5;pg no: 146" - ] - }, - { - "cell_type": "code", - "execution_count": 53, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.5, Page:146 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\n", - "deltaS_universe=(deltaS_block+deltaS_seawater)\n", - "since block and sea water both are at same temperature so,\n", - "deltaS_universe=deltaS_seawater\n", - "conservation of energy equation yields,\n", - "Q-W=deltaU+deltaP.E+deltaK.E\n", - "since in this case,W=0,deltaK.E=0,deltaU=0\n", - "Q=deltaP.E\n", - "change in potential energy=deltaP.E=m*g*h in J\n", - "deltaS_universe=deltaS_seawater=Q/T in J/kg K\n", - "entropy change of universe(deltaS_universe)in J/kg K 6.54\n" - ] - } - ], - "source": [ - "#cal of entropy change of universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.5, Page:146 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\")\n", - "m=1;#mass of copper block in kg\n", - "T=(27+273);#temperature of copper block in K\n", - "h=200;#height from which copper block dropped in sea water in m\n", - "C=0.393;#heat capacity for copper in KJ/kg K\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"deltaS_universe=(deltaS_block+deltaS_seawater)\")\n", - "print(\"since block and sea water both are at same temperature so,\")\n", - "print(\"deltaS_universe=deltaS_seawater\")\n", - "print(\"conservation of energy equation yields,\")\n", - "print(\"Q-W=deltaU+deltaP.E+deltaK.E\")\n", - "print(\"since in this case,W=0,deltaK.E=0,deltaU=0\")\n", - "deltaPE=m*g*h\n", - "Q=deltaPE\n", - "print(\"Q=deltaP.E\")\n", - "print(\"change in potential energy=deltaP.E=m*g*h in J\")\n", - "print(\"deltaS_universe=deltaS_seawater=Q/T in J/kg K\")\n", - "deltaS_universe=Q/T\n", - "print(\"entropy change of universe(deltaS_universe)in J/kg K\"),round(deltaS_universe,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.6;pg no: 146" - ] - }, - { - "cell_type": "code", - "execution_count": 54, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.6, Page:146 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\n", - "here deltaS_universe=deltaS_block1+deltaS_block2\n", - "two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\n", - "then from energy conservation\n", - "m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\n", - "Tf=in K 374.18\n", - "hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\n", - "deltaS1=in KJ/K -0.05\n", - "entropy change in block 2(deltaS2)in KJ/K\n", - "deltaS2= 0.06\n", - "entropy change of universe(deltaS)=in KJ/K 0.01\n" - ] - } - ], - "source": [ - "#cal of entropy change of universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.6, Page:146 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\")\n", - "m1=1;#mass of first copper block in kg\n", - "m2=0.5;#mass of second copper block in kg\n", - "T1=(150+273.15);#temperature of first copper block in K\n", - "T2=(0+273.15);#temperature of second copper block in K\n", - "Cp_1=0.393;#heat capacity for copper block 1 in KJ/kg K\n", - "Cp_2=0.381;#heat capacity for copper block 2 in KJ/kg K\n", - "print(\"here deltaS_universe=deltaS_block1+deltaS_block2\")\n", - "print(\"two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\")\n", - "print(\"then from energy conservation\")\n", - "print(\"m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\")\n", - "Tf=((m1*Cp_1*T1)+(m2*Cp_2*T2))/(m1*Cp_1+m2*Cp_2)\n", - "print(\"Tf=in K\"),round(Tf,2)\n", - "print(\"hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\")\n", - "deltaS1=m1*Cp_1*math.log(Tf/T1)\n", - "print(\"deltaS1=in KJ/K\"),round(deltaS1,2)\n", - "print(\"entropy change in block 2(deltaS2)in KJ/K\")\n", - "deltaS2=m2*Cp_2*math.log(Tf/T2)\n", - "print(\"deltaS2=\"),round(deltaS2,2)\n", - "deltaS=deltaS1+deltaS2\n", - "print(\"entropy change of universe(deltaS)=in KJ/K\"),round(deltaS,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.7;pg no: 147" - ] - }, - { - "cell_type": "code", - "execution_count": 55, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.7, Page:147 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\n", - "NOTE=>in this question formula is derived which cannot be solve using python software\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.7, Page:147 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\")\n", - "print(\"NOTE=>in this question formula is derived which cannot be solve using python software\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.8;pg no: 148" - ] - }, - { - "cell_type": "code", - "execution_count": 56, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.8, Page:148 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\n", - "for irreversible operation of engine,\n", - "rate of entropy generation=Q1/T1+Q2/T2\n", - "W=Q1-Q2=>Q2=Q1-W in MW 3.0\n", - "entropy generated(deltaS_gen)in MW\n", - "deltaS_gen= 0.01\n", - "work lost(W_lost)in MW\n", - "W_lost=T2*deltaS_gen 4.0\n" - ] - } - ], - "source": [ - "#cal of work lost\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.8, Page:148 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\")\n", - "T1=1800.;#temperature of high temperature reservoir in K\n", - "T2=300.;#temperature of low temperature reservoir in K\n", - "Q1=5.;#heat addition in MW\n", - "W=2.;#work done in MW\n", - "print(\"for irreversible operation of engine,\")\n", - "print(\"rate of entropy generation=Q1/T1+Q2/T2\")\n", - "Q2=Q1-W\n", - "print(\"W=Q1-Q2=>Q2=Q1-W in MW\"),round(Q2,2)\n", - "print(\"entropy generated(deltaS_gen)in MW\")\n", - "deltaS_gen=Q1/T1+Q2/T2\n", - "print(\"deltaS_gen=\"),round(deltaS_gen,2)\n", - "Q1=-5;#heat addition in MW\n", - "print(\"work lost(W_lost)in MW\")\n", - "W_lost=T2*deltaS_gen\n", - "print(\"W_lost=T2*deltaS_gen\"),round(W_lost)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.9;pg no: 148" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.9, Page:148 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\n", - "system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\n", - "therefore,maximum heat(Q1)=(C*dT)in J\n", - "here C=0.05*T^2+0.10*T+0.085 in J/K\n", - "so Q1=(0.05*T^2+0.10*T+0.085)*dT\n", - "entropy change of system,deltaS_system=C*dT/T in J/K\n", - "so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\n", - "deltaS_reservoir=Q2/T2=(Q1-W)/T2 also,we know from entropy principle,deltaS_universe is greater than equal to 0\n", - "deltaS_universe=deltaS_system+deltaS_reservoir\n", - "thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\n", - "W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\n", - "hence maximum work in KJ= 435.34\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.9, Page:148 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\")\n", - "import scipy\n", - "from scipy import integrate\n", - "\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "T1=500;#temperature of system in K\n", - "T2=300;#temperature of reservoir in K\n", - "print(\"system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\")\n", - "print(\"therefore,maximum heat(Q1)=(C*dT)in J\")\n", - "print(\"here C=0.05*T^2+0.10*T+0.085 in J/K\")\n", - "print(\"so Q1=(0.05*T^2+0.10*T+0.085)*dT\")\n", - "T=T1-T2\n", - "#Q1=(0.05*T**2+0.10*T+0.085)*dT\n", - "#function y = f(T), y = (0.05*T**2+0.10*T+0.085),endfunction\n", - "#Q1 = scipy.integrate.quad(fun1,T1, T2)\n", - "#Q1=-Q1\n", - "Q1=1641.35*10**3\n", - "print(\"entropy change of system,deltaS_system=C*dT/T in J/K\")\n", - "print(\"so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\")\n", - "#function y = k(T), y = (0.05*T**2+0.10*T+0.085)/T,endfunction\n", - "def fun1(x):\n", - "\ty = (0.05*T**2+0.10*T+0.085)/T\n", - "\treturn y\n", - "\n", - "#deltaS_system = scipy.integrate.quad(k,T1, T2)\n", - "deltaS_system=-4020.043\n", - "print(\"deltaS_reservoir=Q2/T2=(Q1-W)/T2\"),\n", - "print(\"also,we know from entropy principle,deltaS_universe is greater than equal to 0\")\n", - "print(\"deltaS_universe=deltaS_system+deltaS_reservoir\")\n", - "print(\"thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\")\n", - "print(\"W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\")\n", - "W=(Q1+deltaS_system*T2)/1000\n", - "print(\"hence maximum work in KJ=\"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.10;pg no: 149" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.10, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\n", - "for reversible adiabatic process governing equation for expansion,\n", - "P*V**1.4=constant\n", - "also,for such process entropy change=0\n", - "using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\n", - "final pressure(p2)in Mpa\n", - "p2= 0.24\n", - "from first law,second law and definition of enthalpy;\n", - "dH=T*dS+v*dP\n", - "for adiabatic process of reversible type,dS=0\n", - "so dH=v*dP\n", - "integrating both side H2-H1=deltaH=v*dP in KJ\n", - "so enthalpy change(deltaH)in KJ=268.8\n", - "and entropy change=0\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "\n", - "print\"Example 5.10, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\")\n", - "import scipy\n", - "from scipy import integrate\n", - "\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "p1=3.;#initial pressure in Mpa\n", - "v1=0.05;#initial volume in m**3\n", - "v2=0.3;#final volume in m**3\n", - "print(\"for reversible adiabatic process governing equation for expansion,\")\n", - "print(\"P*V**1.4=constant\")\n", - "print(\"also,for such process entropy change=0\")\n", - "print(\"using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\")\n", - "print(\"final pressure(p2)in Mpa\")\n", - "p2=p1*(v1/v2)**1.4\n", - "print(\"p2=\"),round(p2,2)\n", - "print(\"from first law,second law and definition of enthalpy;\")\n", - "print(\"dH=T*dS+v*dP\")\n", - "print(\"for adiabatic process of reversible type,dS=0\")\n", - "dS=0;#for adiabatic process of reversible type\n", - "print(\"so dH=v*dP\")\n", - "print(\"integrating both side H2-H1=deltaH=v*dP in KJ\")\n", - "p1=3.*1000.;#initial pressure in Kpa\n", - "p2=244.;#final pressure in Kpa\n", - "#function y = f(p), y =(p1*(v1**1.4)/p)**(1/1.4)\n", - "def fun1(x):\n", - "\ty=(p1*(v1**1.4)/p2)**(1/1.4)\n", - "\treturn y\n", - "\n", - "deltaH = scipy.integrate.quad(fun1,p2,p1)\n", - "print (\"so enthalpy change(deltaH)in KJ=268.8\")\n", - "print(\"and entropy change=0\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.11;pg no: 150" - ] - }, - { - "cell_type": "code", - "execution_count": 59, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.11, Page:150 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\n", - "during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\n", - "a> change in entropy of air(deltaS_air)in J/K\n", - "deltaS_air= 1321.68\n", - "b> during free expansion on heat is gained or lost to surrounding so,\n", - "deltaS_surrounding=0\n", - "entropy change of surroundings=0\n", - "c> entropy change of universe(deltaS_universe)in J/K\n", - "deltaS_universe= 1321.68\n" - ] - } - ], - "source": [ - "#cal of deltaS_universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.11, Page:150 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\")\n", - "m=2;#mass of air in kg\n", - "v1=1;#initial volume of air in m^3\n", - "v2=10;#final volume of air in m^3\n", - "R=287;#gas constant in J/kg K\n", - "print(\"during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\")\n", - "print(\"a> change in entropy of air(deltaS_air)in J/K\")\n", - "deltaS_air=m*R*math.log(v2/v1)\n", - "print(\"deltaS_air=\"),round(deltaS_air,2)\n", - "print(\"b> during free expansion on heat is gained or lost to surrounding so,\")\n", - "print(\"deltaS_surrounding=0\")\n", - "print(\"entropy change of surroundings=0\")\n", - "deltaS_surrounding=0;#entropy change of surroundings\n", - "print(\"c> entropy change of universe(deltaS_universe)in J/K\")\n", - "deltaS_universe=deltaS_air+deltaS_surrounding\n", - "print(\"deltaS_universe=\"),round(deltaS_universe,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "##example 5.12;pg no: 150" - ] - }, - { - "cell_type": "code", - "execution_count": 60, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.12, Page:150 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\n", - "let initial and final states be denoted by 1 and 2\n", - "for poly tropic process pressure and temperature can be related as\n", - "(p2/p1)^((n-1)/n)=T2/T1\n", - "so temperature after compression(T2)=in K 1128.94\n", - "substituting in entropy change expression for polytropic process,\n", - "entropy change(deltaS)inKJ/kg K\n", - "deltaS= -0.24454\n", - "NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\n", - "total entropy change(deltaS)=in J/K -122.27\n" - ] - } - ], - "source": [ - "#cal of total entropy change\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.12, Page:150 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\")\n", - "m=0.5;#mass of air in kg\n", - "p1=1.013*10**5;#initial pressure of air in pa\n", - "p2=0.8*10**6;#final pressure of air in pa\n", - "T1=800;#initial temperature of air in K\n", - "n=1.2;#polytropic expansion constant\n", - "y=1.4;#expansion constant for air\n", - "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", - "print(\"let initial and final states be denoted by 1 and 2\")\n", - "print(\"for poly tropic process pressure and temperature can be related as\")\n", - "print(\"(p2/p1)^((n-1)/n)=T2/T1\")\n", - "T2=T1*(p2/p1)**((n-1)/n)\n", - "print(\"so temperature after compression(T2)=in K\"),round(T2,2)\n", - "print(\"substituting in entropy change expression for polytropic process,\") \n", - "print(\"entropy change(deltaS)inKJ/kg K\")\n", - "deltaS=Cv*((n-y)/(n-1))*math.log(T2/T1)\n", - "print(\"deltaS=\"),round(deltaS,5)\n", - "print(\"NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\")\n", - "deltaS=m*deltaS*1000\n", - "print(\"total entropy change(deltaS)=in J/K\"),round(deltaS,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.13;pg no: 151" - ] - }, - { - "cell_type": "code", - "execution_count": 61, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.13, Page:151 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\n", - "NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.13, Page:151 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\")\n", - "print(\"NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.14;pg no: 152" - ] - }, - { - "cell_type": "code", - "execution_count": 62, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.14, Page:152 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\n", - "clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\n", - "K=dQ/T=Q1/T1-Q2/T2\n", - "i> for Q2=200 kcal/s\n", - "K=in kcal/s K 0.0\n", - "as K is not greater than 0,therefore under these conditions engine is not possible\n", - "ii> for Q2=400 kcal/s\n", - "K=in kcal/s K -1.0\n", - "as K is less than 0,so engine is feasible and cycle is reversible\n", - "iii> for Q2=250 kcal/s\n", - "K=in kcal/s K 0.0\n", - "as K=0,so engine is feasible and cycle is reversible\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.14, Page:152 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\")\n", - "Q1=500;#heat supplied by source in kcal/s\n", - "T1=600;#temperature of source in K\n", - "T2=300;#temperature of sink in K\n", - "print(\"clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\")\n", - "print(\"K=dQ/T=Q1/T1-Q2/T2\")\n", - "print(\"i> for Q2=200 kcal/s\")\n", - "Q2=200;#heat rejected by sink in kcal/s\n", - "K=Q1/T1-Q2/T2\n", - "print(\"K=in kcal/s K\"),round(K,2)\n", - "print(\"as K is not greater than 0,therefore under these conditions engine is not possible\")\n", - "print(\"ii> for Q2=400 kcal/s\")\n", - "Q2=400;#heat rejected by sink in kcal/s\n", - "K=Q1/T1-Q2/T2\n", - "print(\"K=in kcal/s K\"),round(K,2)\n", - "print(\"as K is less than 0,so engine is feasible and cycle is reversible\")\n", - "print(\"iii> for Q2=250 kcal/s\")\n", - "Q2=250;#heat rejected by sink in kcal/s\n", - "K=Q1/T1-Q2/T2\n", - "print(\"K=in kcal/s K\"),round(K,2)\n", - "print(\"as K=0,so engine is feasible and cycle is reversible\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.15;pg no: 152" - ] - }, - { - "cell_type": "code", - "execution_count": 63, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.15, Page:152 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\n", - "let the two points be given as states 1 and 2,\n", - "let us assume flow to be from 1 to 2\n", - "so entropy change(deltaS1_2)=s1-s2=in KJ/kg K -0.0\n", - "deltaS1_2=s1-s2=0.01254 KJ/kg K\n", - "it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\n", - "hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.15, Page:152 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\")\n", - "p1=0.5;#initial pressure of air in Mpa\n", - "T1=400;#initial temperature of air in K\n", - "p2=0.3;#final pressure of air in Mpa\n", - "T2=350;#initial temperature of air in K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", - "print(\"let the two points be given as states 1 and 2,\")\n", - "print(\"let us assume flow to be from 1 to 2\")\n", - "deltaS1_2=Cp*math.log(T1/T2)-R*math.log(p1/p2)\n", - "print(\"so entropy change(deltaS1_2)=s1-s2=in KJ/kg K\"),round(deltaS1_2)\n", - "print(\"deltaS1_2=s1-s2=0.01254 KJ/kg K\")\n", - "print(\"it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\")\n", - "print(\"hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.16;pg no: 153" - ] - }, - { - "cell_type": "code", - "execution_count": 64, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.16, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\n", - "NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.16, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\")\n", - "print(\"NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.17;pg no: 153" - ] - }, - { - "cell_type": "code", - "execution_count": 66, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.17, Page:153 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\n", - "total heat added(Q)in KJ\n", - "Q= 1800.0\n", - "for heat addition process 1-2\n", - "Q12=T1*(s2-s1)\n", - "deltaS=s2-s1=in KJ/K 2.0\n", - "or heat addition process 3-4\n", - "Q34=T3*(s4-s3)\n", - "deltaS=s4-s3=in KJ/K 2.0\n", - "or heat rejected in process 5-6(Q56)in KJ\n", - "Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)= 1200.0\n", - "net work done=net heat(W_net)in KJ\n", - "W_net=(Q12+Q34)-Q56 600.0\n", - "thermal efficiency of cycle(n)= 0.33\n", - "or n=n*100 % 33.33\n", - "so work done=600 KJ and thermal efficiency=33.33 %\n" - ] - } - ], - "source": [ - "#cal of work done and thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.17, Page:153 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\")\n", - "Q12=1000.;#heat added during process 1-2 in KJ\n", - "Q34=800.;#heat added during process 3-4 in KJ\n", - "T1=500.;#operating temperature for process 1-2\n", - "T3=400.;#operating temperature for process 3-4\n", - "T5=300.;#operating temperature for process 5-6\n", - "T2=T1;#isothermal process\n", - "T4=T3;#isothermal process\n", - "T6=T5;#isothermal process\n", - "print(\"total heat added(Q)in KJ\")\n", - "Q=Q12+Q34\n", - "print(\"Q=\"),round(Q,2)\n", - "print(\"for heat addition process 1-2\")\n", - "print(\"Q12=T1*(s2-s1)\")\n", - "deltaS=Q12/T1\n", - "print(\"deltaS=s2-s1=in KJ/K\"),round(deltaS,2)\n", - "print(\"or heat addition process 3-4\")\n", - "print(\"Q34=T3*(s4-s3)\")\n", - "deltaS=Q34/T3\n", - "print(\"deltaS=s4-s3=in KJ/K\"),round(deltaS,2)\n", - "print(\"or heat rejected in process 5-6(Q56)in KJ\")\n", - "Q56=T5*(deltaS+deltaS)\n", - "print(\"Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)=\"),round(Q56,2)\n", - "print(\"net work done=net heat(W_net)in KJ\")\n", - "W_net=(Q12+Q34)-Q56\n", - "print(\"W_net=(Q12+Q34)-Q56\"),round(W_net,2)\n", - "n=W_net/Q\n", - "print(\"thermal efficiency of cycle(n)=\"),round(n,2)\n", - "n=n*100\n", - "print(\"or n=n*100 %\"),round(n,2) \n", - "print(\"so work done=600 KJ and thermal efficiency=33.33 %\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.18;pg no: 154" - ] - }, - { - "cell_type": "code", - "execution_count": 67, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.18, Page:154 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\n", - "let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\n", - "here Q1-Q2=W\n", - "so heat supplied by source(Q1)in KW= 30.0\n", - "also given that,Q1_a=0.7*Q1_b.......eq 1\n", - "Q1_c=Q1-(0.7*Q1_b+Q1_b)\n", - "Q1_c=Q1-1.7*Q1_b........eq 2\n", - "for reversible engine\n", - "Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\n", - "substitute eq 1 and eq 2 in eq 3 we get, \n", - "heat supplied by reservoir of 700 K(Q1_b)in KJ/s\n", - "Q1_b= 35.39\n", - "so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\n", - "Q1_a= 24.78\n", - "and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\n", - "Q1_c=Q1-1.7*Q1_b -30.17\n", - "so heat supplied by reservoir at 800 K(Q1_a)= 24.78\n", - "so heat supplied by reservoir at 700 K(Q1_b)= 35.39\n", - "so heat supplied by reservoir at 600 K(Q1_c)= -30.17\n", - "NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\n" - ] - } - ], - "source": [ - "#cal of heat supplied by reservoir at 800,700,600\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.18, Page:154 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\")\n", - "T1_a=800.;#temperature of reservoir a in K\n", - "T1_b=700.;#temperature of reservoir b in K\n", - "T1_c=600.;#temperature of reservoir c in K\n", - "T2=320.;#temperature of sink in K\n", - "W=20.;#work done in KW\n", - "Q2=10.;#heat rejected to sink in KW\n", - "print(\"let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\")\n", - "print(\"here Q1-Q2=W\")\n", - "Q1=W+Q2\n", - "print(\"so heat supplied by source(Q1)in KW=\"),round(Q1,2)\n", - "print(\"also given that,Q1_a=0.7*Q1_b.......eq 1\")\n", - "print(\"Q1_c=Q1-(0.7*Q1_b+Q1_b)\")\n", - "print(\"Q1_c=Q1-1.7*Q1_b........eq 2\")\n", - "print(\"for reversible engine\")\n", - "print(\"Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\")\n", - "print(\"substitute eq 1 and eq 2 in eq 3 we get, \")\n", - "print(\"heat supplied by reservoir of 700 K(Q1_b)in KJ/s\")\n", - "Q1_b=((Q2/T2)-(Q1/T1_c))/((0.7/T1_a)+(1/T1_b)-(1.7/T1_c))\n", - "print(\"Q1_b=\"),round(Q1_b,2)\n", - "print(\"so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\")\n", - "Q1_a=0.7*Q1_b\n", - "print(\"Q1_a=\"),round(Q1_a,2)\n", - "print(\"and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\")\n", - "Q1_c=Q1-1.7*Q1_b\n", - "print(\"Q1_c=Q1-1.7*Q1_b\"),round(Q1_c,2)\n", - "print(\"so heat supplied by reservoir at 800 K(Q1_a)=\"),round(Q1_a,2)\n", - "print(\"so heat supplied by reservoir at 700 K(Q1_b)=\"),round(Q1_b,2)\n", - "print(\"so heat supplied by reservoir at 600 K(Q1_c)=\"),round(Q1_c,2)\n", - "print(\"NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter5_3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter5_3.ipynb deleted file mode 100755 index cc42cd6f..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter5_3.ipynb +++ /dev/null @@ -1,1124 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5:Entropy" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.1;pg no: 144" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.1, Page:144 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\n", - "entropy change may be given as,\n", - "s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\n", - "here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\n", - "so change in entropy(deltaS)in KJ/kg K\n", - "deltaS= 0.263\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.1, Page:144 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 1\")\n", - "p1=5.;#initial pressure of air\n", - "T1=(27.+273.);#temperature of air in K\n", - "p2=2.;#final pressure of air in K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cp_air=1.004;#specific heat of air at constant pressure in KJ/kg K\n", - "print(\"entropy change may be given as,\")\n", - "print(\"s2-s1=((Cp_air*log(T2/T1)-(R*log(p2/p1))\")\n", - "print(\"here for throttling process h1=h2=>Cp_air*T1=Cp_air*T2=>T1=T2\")\n", - "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", - "deltaS=(Cp_air*0)-(R*math.log(p2/p1))\n", - "print(\"deltaS=\"),round(deltaS,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.2;pg no: 144" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.2, Page:144 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\n", - "total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\n", - "deltaS1=Q1/T1,where Q1=m*Cp*deltaT\n", - "heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\n", - "Q1= 1533.0\n", - "deltaS1=Q1/T1 in KJ/K 5.11\n", - "now heat of vaporisation(Q2)=in KJ 11300.0\n", - "entropy change during phase transformation(deltaS2)in KJ/K\n", - "deltaS2= 30.29\n", - "entropy change during steam temperature rise(deltaS3)in KJ/K\n", - "deltaS3=m*Cp_steam*dT/T\n", - "here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\n", - "R=in KJ/kg K 0.46\n", - "now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\n", - "total entropy change(deltaS) in KJ/K= 87.24\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.2, Page:144 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 2\")\n", - "import scipy\n", - "from scipy import integrate\n", - "##just an example function\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "T1=(27.+273.);#temperature of water in K\n", - "T2=(100.+273.);#steam temperature of water in K\n", - "m=5.;#mass of water in kg\n", - "q=2260.;#heat of vaporisation at 100 degree celcius in KJ/kg\n", - "Cp=4.2;#specific heat of water at constant pressure in KJ/kg K\n", - "M=18.;#molar mass for water/steam \n", - "R1=8.314;#gas constant in KJ/kg K\n", - "print(\"total entropy change=entropy change during water temperature rise(deltaS1)+entropy change during water to steam change(deltaS2)+entropy change during steam temperature rise(deltaS3)\")\n", - "Q1=m*Cp*(T2-T1)\n", - "print(\"deltaS1=Q1/T1,where Q1=m*Cp*deltaT\")\n", - "print(\"heat added for increasing water temperature from 27 to 100 degree celcius(Q1)in KJ\")\n", - "print(\"Q1=\"),round(Q1,2)\n", - "deltaS1=Q1/T1\n", - "print(\"deltaS1=Q1/T1 in KJ/K\"),round(deltaS1,2)\n", - "Q2=m*q\n", - "print(\"now heat of vaporisation(Q2)=in KJ\"),round(Q2,2)\n", - "print(\"entropy change during phase transformation(deltaS2)in KJ/K\")\n", - "deltaS2=Q2/T2\n", - "print(\"deltaS2=\"),round(deltaS2,2)\n", - "print(\"entropy change during steam temperature rise(deltaS3)in KJ/K\")\n", - "print(\"deltaS3=m*Cp_steam*dT/T\")\n", - "print(\"here Cp_steam=R*(3.5+1.2*T+0.14*T^2)*10^-3 in KJ/kg K\")\n", - "R=R1/M\n", - "print(\"R=in KJ/kg K\"),round(R,2)\n", - "T2=(100+273.15);#steam temperature of water in K\n", - "T3=(400+273.15);#temperature of steam in K\n", - "print(\"now deltaS3=(m*R*(3.5+1.2*T+0.14*T^2)*10^-3)*dT/T in KJ/K\")\n", - "#function y = f(T), y =(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T , endfunction\n", - "def fun1(x):\n", - "\ty=(m*R*(3.5+1.2*T+0.14*T**2)*10**-3)/T\n", - "\treturn y\n", - "\n", - "#deltaS3 =scipy.integrate.quad(f,T2, T3) \n", - "deltaS3=51.84;#approximately\n", - "deltaS=deltaS1+deltaS2+deltaS3\n", - "print(\"total entropy change(deltaS) in KJ/K=\"),round(deltaS,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.3;pg no: 145" - ] - }, - { - "cell_type": "code", - "execution_count": 51, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.3, Page:145 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\n", - "gas constant for oxygen(R)in KJ/kg K\n", - "R= 0.26\n", - "for reversible process the change in entropy may be given as\n", - "deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\n", - "so entropy change=deltaS= in (KJ/kg K) -0.29\n" - ] - } - ], - "source": [ - "#cal of entropy change\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.3, Page:145 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 3\")\n", - "R1=8.314;#gas constant in KJ/kg K\n", - "M=32;#molar mass for O2 \n", - "T1=(27+273);#initial temperature of O2 in K\n", - "p1=125;#initial pressure of O2 in Kpa\n", - "p2=375;#final pressure of O2 in Kpa\n", - "Cp=1.004;#specific heat of air at constant pressure in KJ/kg K\n", - "print(\"gas constant for oxygen(R)in KJ/kg K\")\n", - "R=R1/M\n", - "print(\"R=\"),round(R,2)\n", - "print(\"for reversible process the change in entropy may be given as\")\n", - "print(\"deltaS=(Cp*log(T2/T1))-(R*log(p2/p1))in KJ/kg K\")\n", - "T2=T1;#isothermal process\n", - "deltaS=(Cp*math.log(T2/T1))-(R*math.log(p2/p1))\n", - "print(\"so entropy change=deltaS= in (KJ/kg K)\"),round(deltaS,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.4;pg no: 145" - ] - }, - { - "cell_type": "code", - "execution_count": 52, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.4, Page:145 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\n", - "entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\n", - "where deltaS_block=m*C*log(T2/T1)\n", - "here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\n", - "therefore deltaS_block=in KJ/K -0.14\n", - "heat loss by block =heat gained by water(Q)in KJ\n", - "Q=-m*C*(T1-T2) -49.13\n", - "therefore deltaS_water=-Q/T2 in KJ/K 0.16\n", - "thus deltaS_universe=in J/K 27.16\n" - ] - } - ], - "source": [ - "#cal of deltaS_universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.4, Page:145 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 4\")\n", - "T1=(150+273.15);#temperature of copper block in K\n", - "T2=(25+273.15);#temperature of sea water in K\n", - "m=1;#mass of copper block in kg\n", - "C=0.393;#heat capacity of copper in KJ/kg K\n", - "print(\"entropy change in universe(deltaS_universe)=deltaS_block+deltaS_water\")\n", - "print(\"where deltaS_block=m*C*log(T2/T1)\")\n", - "print(\"here hot block is put into sea water,so block shall cool down upto sea water at 25 degree celcius as sea may be treated as sink\")\n", - "deltaS_block=m*C*math.log(T2/T1)\n", - "print(\"therefore deltaS_block=in KJ/K\"),round(deltaS_block,2)\n", - "print(\"heat loss by block =heat gained by water(Q)in KJ\")\n", - "Q=-m*C*(T1-T2)\n", - "print(\"Q=-m*C*(T1-T2)\"),round(Q,2)\n", - "deltaS_water=-Q/T2\n", - "print(\"therefore deltaS_water=-Q/T2 in KJ/K\"),round(deltaS_water,2)\n", - "deltaS_universe=(deltaS_block+deltaS_water)*1000\n", - "print(\"thus deltaS_universe=in J/K\"),round(deltaS_universe,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.5;pg no: 146" - ] - }, - { - "cell_type": "code", - "execution_count": 53, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.5, Page:146 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\n", - "deltaS_universe=(deltaS_block+deltaS_seawater)\n", - "since block and sea water both are at same temperature so,\n", - "deltaS_universe=deltaS_seawater\n", - "conservation of energy equation yields,\n", - "Q-W=deltaU+deltaP.E+deltaK.E\n", - "since in this case,W=0,deltaK.E=0,deltaU=0\n", - "Q=deltaP.E\n", - "change in potential energy=deltaP.E=m*g*h in J\n", - "deltaS_universe=deltaS_seawater=Q/T in J/kg K\n", - "entropy change of universe(deltaS_universe)in J/kg K 6.54\n" - ] - } - ], - "source": [ - "#cal of entropy change of universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.5, Page:146 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 5\")\n", - "m=1;#mass of copper block in kg\n", - "T=(27+273);#temperature of copper block in K\n", - "h=200;#height from which copper block dropped in sea water in m\n", - "C=0.393;#heat capacity for copper in KJ/kg K\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"deltaS_universe=(deltaS_block+deltaS_seawater)\")\n", - "print(\"since block and sea water both are at same temperature so,\")\n", - "print(\"deltaS_universe=deltaS_seawater\")\n", - "print(\"conservation of energy equation yields,\")\n", - "print(\"Q-W=deltaU+deltaP.E+deltaK.E\")\n", - "print(\"since in this case,W=0,deltaK.E=0,deltaU=0\")\n", - "deltaPE=m*g*h\n", - "Q=deltaPE\n", - "print(\"Q=deltaP.E\")\n", - "print(\"change in potential energy=deltaP.E=m*g*h in J\")\n", - "print(\"deltaS_universe=deltaS_seawater=Q/T in J/kg K\")\n", - "deltaS_universe=Q/T\n", - "print(\"entropy change of universe(deltaS_universe)in J/kg K\"),round(deltaS_universe,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.6;pg no: 146" - ] - }, - { - "cell_type": "code", - "execution_count": 54, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.6, Page:146 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\n", - "here deltaS_universe=deltaS_block1+deltaS_block2\n", - "two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\n", - "then from energy conservation\n", - "m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\n", - "Tf=in K 374.18\n", - "hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\n", - "deltaS1=in KJ/K -0.05\n", - "entropy change in block 2(deltaS2)in KJ/K\n", - "deltaS2= 0.06\n", - "entropy change of universe(deltaS)=in KJ/K 0.01\n" - ] - } - ], - "source": [ - "#cal of entropy change of universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.6, Page:146 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 6\")\n", - "m1=1;#mass of first copper block in kg\n", - "m2=0.5;#mass of second copper block in kg\n", - "T1=(150+273.15);#temperature of first copper block in K\n", - "T2=(0+273.15);#temperature of second copper block in K\n", - "Cp_1=0.393;#heat capacity for copper block 1 in KJ/kg K\n", - "Cp_2=0.381;#heat capacity for copper block 2 in KJ/kg K\n", - "print(\"here deltaS_universe=deltaS_block1+deltaS_block2\")\n", - "print(\"two blocks at different temperatures shall first attain equilibrium temperature.let equilibrium temperature be Tf\")\n", - "print(\"then from energy conservation\")\n", - "print(\"m1*Cp_1*(T1-Tf)=m2*Cp_2*(Tf-T2)\")\n", - "Tf=((m1*Cp_1*T1)+(m2*Cp_2*T2))/(m1*Cp_1+m2*Cp_2)\n", - "print(\"Tf=in K\"),round(Tf,2)\n", - "print(\"hence,entropy change in block 1(deltaS1),due to temperature changing from Tf to T1\")\n", - "deltaS1=m1*Cp_1*math.log(Tf/T1)\n", - "print(\"deltaS1=in KJ/K\"),round(deltaS1,2)\n", - "print(\"entropy change in block 2(deltaS2)in KJ/K\")\n", - "deltaS2=m2*Cp_2*math.log(Tf/T2)\n", - "print(\"deltaS2=\"),round(deltaS2,2)\n", - "deltaS=deltaS1+deltaS2\n", - "print(\"entropy change of universe(deltaS)=in KJ/K\"),round(deltaS,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.7;pg no: 147" - ] - }, - { - "cell_type": "code", - "execution_count": 55, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.7, Page:147 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\n", - "NOTE=>in this question formula is derived which cannot be solve using python software\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.7, Page:147 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 7\")\n", - "print(\"NOTE=>in this question formula is derived which cannot be solve using python software\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.8;pg no: 148" - ] - }, - { - "cell_type": "code", - "execution_count": 56, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.8, Page:148 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\n", - "for irreversible operation of engine,\n", - "rate of entropy generation=Q1/T1+Q2/T2\n", - "W=Q1-Q2=>Q2=Q1-W in MW 3.0\n", - "entropy generated(deltaS_gen)in MW\n", - "deltaS_gen= 0.01\n", - "work lost(W_lost)in MW\n", - "W_lost=T2*deltaS_gen 4.0\n" - ] - } - ], - "source": [ - "#cal of work lost\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.8, Page:148 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 8\")\n", - "T1=1800.;#temperature of high temperature reservoir in K\n", - "T2=300.;#temperature of low temperature reservoir in K\n", - "Q1=5.;#heat addition in MW\n", - "W=2.;#work done in MW\n", - "print(\"for irreversible operation of engine,\")\n", - "print(\"rate of entropy generation=Q1/T1+Q2/T2\")\n", - "Q2=Q1-W\n", - "print(\"W=Q1-Q2=>Q2=Q1-W in MW\"),round(Q2,2)\n", - "print(\"entropy generated(deltaS_gen)in MW\")\n", - "deltaS_gen=Q1/T1+Q2/T2\n", - "print(\"deltaS_gen=\"),round(deltaS_gen,2)\n", - "Q1=-5;#heat addition in MW\n", - "print(\"work lost(W_lost)in MW\")\n", - "W_lost=T2*deltaS_gen\n", - "print(\"W_lost=T2*deltaS_gen\"),round(W_lost)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.9;pg no: 148" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.9, Page:148 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\n", - "system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\n", - "therefore,maximum heat(Q1)=(C*dT)in J\n", - "here C=0.05*T^2+0.10*T+0.085 in J/K\n", - "so Q1=(0.05*T^2+0.10*T+0.085)*dT\n", - "entropy change of system,deltaS_system=C*dT/T in J/K\n", - "so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\n", - "deltaS_reservoir=Q2/T2=(Q1-W)/T2 also,we know from entropy principle,deltaS_universe is greater than equal to 0\n", - "deltaS_universe=deltaS_system+deltaS_reservoir\n", - "thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\n", - "W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\n", - "hence maximum work in KJ= 435.34\n" - ] - } - ], - "source": [ - "#cal of COP\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.9, Page:148 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 9\")\n", - "import scipy\n", - "from scipy import integrate\n", - "\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "T1=500;#temperature of system in K\n", - "T2=300;#temperature of reservoir in K\n", - "print(\"system and reservoir can be treated as source and sink.device thought of can be a carnot engine operating between these two limits.maximum heat available from system shall be the heat rejected till its temperature drops from 500 K to 300 K\")\n", - "print(\"therefore,maximum heat(Q1)=(C*dT)in J\")\n", - "print(\"here C=0.05*T^2+0.10*T+0.085 in J/K\")\n", - "print(\"so Q1=(0.05*T^2+0.10*T+0.085)*dT\")\n", - "T=T1-T2\n", - "#Q1=(0.05*T**2+0.10*T+0.085)*dT\n", - "#function y = f(T), y = (0.05*T**2+0.10*T+0.085),endfunction\n", - "#Q1 = scipy.integrate.quad(fun1,T1, T2)\n", - "#Q1=-Q1\n", - "Q1=1641.35*10**3\n", - "print(\"entropy change of system,deltaS_system=C*dT/T in J/K\")\n", - "print(\"so deltaS_system=(0.05*T^2+0.10*T+0.085)*dT/T\")\n", - "#function y = k(T), y = (0.05*T**2+0.10*T+0.085)/T,endfunction\n", - "def fun1(x):\n", - "\ty = (0.05*T**2+0.10*T+0.085)/T\n", - "\treturn y\n", - "\n", - "#deltaS_system = scipy.integrate.quad(k,T1, T2)\n", - "deltaS_system=-4020.043\n", - "print(\"deltaS_reservoir=Q2/T2=(Q1-W)/T2\"),\n", - "print(\"also,we know from entropy principle,deltaS_universe is greater than equal to 0\")\n", - "print(\"deltaS_universe=deltaS_system+deltaS_reservoir\")\n", - "print(\"thus,upon substituting,deltaS_system+deltaS_reservoir is greater than equal to 0\")\n", - "print(\"W is less than or equal to(Q1+deltaS_system*T2)/1000 in KJ\")\n", - "W=(Q1+deltaS_system*T2)/1000\n", - "print(\"hence maximum work in KJ=\"),round(W,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.10;pg no: 149" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.10, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\n", - "for reversible adiabatic process governing equation for expansion,\n", - "P*V**1.4=constant\n", - "also,for such process entropy change=0\n", - "using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\n", - "final pressure(p2)in Mpa\n", - "p2= 0.24\n", - "from first law,second law and definition of enthalpy;\n", - "dH=T*dS+v*dP\n", - "for adiabatic process of reversible type,dS=0\n", - "so dH=v*dP\n", - "integrating both side H2-H1=deltaH=v*dP in KJ\n", - "so enthalpy change(deltaH)in KJ=268.8\n", - "and entropy change=0\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "\n", - "print\"Example 5.10, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 10\")\n", - "import scipy\n", - "from scipy import integrate\n", - "\n", - "def fun1(x):\n", - "\ty=x*x\n", - "\treturn y\n", - "\n", - "p1=3.;#initial pressure in Mpa\n", - "v1=0.05;#initial volume in m**3\n", - "v2=0.3;#final volume in m**3\n", - "print(\"for reversible adiabatic process governing equation for expansion,\")\n", - "print(\"P*V**1.4=constant\")\n", - "print(\"also,for such process entropy change=0\")\n", - "print(\"using p2/p1=(v1/v2)**1.4 or v=(p1*(v1**1.4)/p)**(1/1.4)\")\n", - "print(\"final pressure(p2)in Mpa\")\n", - "p2=p1*(v1/v2)**1.4\n", - "print(\"p2=\"),round(p2,2)\n", - "print(\"from first law,second law and definition of enthalpy;\")\n", - "print(\"dH=T*dS+v*dP\")\n", - "print(\"for adiabatic process of reversible type,dS=0\")\n", - "dS=0;#for adiabatic process of reversible type\n", - "print(\"so dH=v*dP\")\n", - "print(\"integrating both side H2-H1=deltaH=v*dP in KJ\")\n", - "p1=3.*1000.;#initial pressure in Kpa\n", - "p2=244.;#final pressure in Kpa\n", - "#function y = f(p), y =(p1*(v1**1.4)/p)**(1/1.4)\n", - "def fun1(x):\n", - "\ty=(p1*(v1**1.4)/p2)**(1/1.4)\n", - "\treturn y\n", - "\n", - "deltaH = scipy.integrate.quad(fun1,p2,p1)\n", - "print (\"so enthalpy change(deltaH)in KJ=268.8\")\n", - "print(\"and entropy change=0\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.11;pg no: 150" - ] - }, - { - "cell_type": "code", - "execution_count": 59, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.11, Page:150 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\n", - "during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\n", - "a> change in entropy of air(deltaS_air)in J/K\n", - "deltaS_air= 1321.68\n", - "b> during free expansion on heat is gained or lost to surrounding so,\n", - "deltaS_surrounding=0\n", - "entropy change of surroundings=0\n", - "c> entropy change of universe(deltaS_universe)in J/K\n", - "deltaS_universe= 1321.68\n" - ] - } - ], - "source": [ - "#cal of deltaS_universe\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.11, Page:150 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 11\")\n", - "m=2;#mass of air in kg\n", - "v1=1;#initial volume of air in m^3\n", - "v2=10;#final volume of air in m^3\n", - "R=287;#gas constant in J/kg K\n", - "print(\"during free expansion temperature remains same and it is an irreversible process.for getting change in entropy let us approximate this expansion process as a reversible isothermal expansion\")\n", - "print(\"a> change in entropy of air(deltaS_air)in J/K\")\n", - "deltaS_air=m*R*math.log(v2/v1)\n", - "print(\"deltaS_air=\"),round(deltaS_air,2)\n", - "print(\"b> during free expansion on heat is gained or lost to surrounding so,\")\n", - "print(\"deltaS_surrounding=0\")\n", - "print(\"entropy change of surroundings=0\")\n", - "deltaS_surrounding=0;#entropy change of surroundings\n", - "print(\"c> entropy change of universe(deltaS_universe)in J/K\")\n", - "deltaS_universe=deltaS_air+deltaS_surrounding\n", - "print(\"deltaS_universe=\"),round(deltaS_universe,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "##example 5.12;pg no: 150" - ] - }, - { - "cell_type": "code", - "execution_count": 60, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.12, Page:150 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\n", - "let initial and final states be denoted by 1 and 2\n", - "for poly tropic process pressure and temperature can be related as\n", - "(p2/p1)^((n-1)/n)=T2/T1\n", - "so temperature after compression(T2)=in K 1128.94\n", - "substituting in entropy change expression for polytropic process,\n", - "entropy change(deltaS)inKJ/kg K\n", - "deltaS= -0.24454\n", - "NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\n", - "total entropy change(deltaS)=in J/K -122.27\n" - ] - } - ], - "source": [ - "#cal of total entropy change\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.12, Page:150 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 12\")\n", - "m=0.5;#mass of air in kg\n", - "p1=1.013*10**5;#initial pressure of air in pa\n", - "p2=0.8*10**6;#final pressure of air in pa\n", - "T1=800;#initial temperature of air in K\n", - "n=1.2;#polytropic expansion constant\n", - "y=1.4;#expansion constant for air\n", - "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", - "print(\"let initial and final states be denoted by 1 and 2\")\n", - "print(\"for poly tropic process pressure and temperature can be related as\")\n", - "print(\"(p2/p1)^((n-1)/n)=T2/T1\")\n", - "T2=T1*(p2/p1)**((n-1)/n)\n", - "print(\"so temperature after compression(T2)=in K\"),round(T2,2)\n", - "print(\"substituting in entropy change expression for polytropic process,\") \n", - "print(\"entropy change(deltaS)inKJ/kg K\")\n", - "deltaS=Cv*((n-y)/(n-1))*math.log(T2/T1)\n", - "print(\"deltaS=\"),round(deltaS,5)\n", - "print(\"NOTE=>answer given in book i.e -244.54 KJ/kg K is incorrect,correct answer is -.24454 KJ/kg K\")\n", - "deltaS=m*deltaS*1000\n", - "print(\"total entropy change(deltaS)=in J/K\"),round(deltaS,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.13;pg no: 151" - ] - }, - { - "cell_type": "code", - "execution_count": 61, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.13, Page:151 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\n", - "NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.13, Page:151 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 13\")\n", - "print(\"NOTE=>In question no. 13,formula for maximum work is derived which cannot be solve using python software\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.14;pg no: 152" - ] - }, - { - "cell_type": "code", - "execution_count": 62, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.14, Page:152 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\n", - "clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\n", - "K=dQ/T=Q1/T1-Q2/T2\n", - "i> for Q2=200 kcal/s\n", - "K=in kcal/s K 0.0\n", - "as K is not greater than 0,therefore under these conditions engine is not possible\n", - "ii> for Q2=400 kcal/s\n", - "K=in kcal/s K -1.0\n", - "as K is less than 0,so engine is feasible and cycle is reversible\n", - "iii> for Q2=250 kcal/s\n", - "K=in kcal/s K 0.0\n", - "as K=0,so engine is feasible and cycle is reversible\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.14, Page:152 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 14\")\n", - "Q1=500;#heat supplied by source in kcal/s\n", - "T1=600;#temperature of source in K\n", - "T2=300;#temperature of sink in K\n", - "print(\"clausius inequality can be used for cyclic process as given below;consider 1 for source and 2 for sink\")\n", - "print(\"K=dQ/T=Q1/T1-Q2/T2\")\n", - "print(\"i> for Q2=200 kcal/s\")\n", - "Q2=200;#heat rejected by sink in kcal/s\n", - "K=Q1/T1-Q2/T2\n", - "print(\"K=in kcal/s K\"),round(K,2)\n", - "print(\"as K is not greater than 0,therefore under these conditions engine is not possible\")\n", - "print(\"ii> for Q2=400 kcal/s\")\n", - "Q2=400;#heat rejected by sink in kcal/s\n", - "K=Q1/T1-Q2/T2\n", - "print(\"K=in kcal/s K\"),round(K,2)\n", - "print(\"as K is less than 0,so engine is feasible and cycle is reversible\")\n", - "print(\"iii> for Q2=250 kcal/s\")\n", - "Q2=250;#heat rejected by sink in kcal/s\n", - "K=Q1/T1-Q2/T2\n", - "print(\"K=in kcal/s K\"),round(K,2)\n", - "print(\"as K=0,so engine is feasible and cycle is reversible\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.15;pg no: 152" - ] - }, - { - "cell_type": "code", - "execution_count": 63, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.15, Page:152 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\n", - "let the two points be given as states 1 and 2,\n", - "let us assume flow to be from 1 to 2\n", - "so entropy change(deltaS1_2)=s1-s2=in KJ/kg K -0.0\n", - "deltaS1_2=s1-s2=0.01254 KJ/kg K\n", - "it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\n", - "hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "import math\n", - "print\"Example 5.15, Page:152 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 15\")\n", - "p1=0.5;#initial pressure of air in Mpa\n", - "T1=400;#initial temperature of air in K\n", - "p2=0.3;#final pressure of air in Mpa\n", - "T2=350;#initial temperature of air in K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", - "print(\"let the two points be given as states 1 and 2,\")\n", - "print(\"let us assume flow to be from 1 to 2\")\n", - "deltaS1_2=Cp*math.log(T1/T2)-R*math.log(p1/p2)\n", - "print(\"so entropy change(deltaS1_2)=s1-s2=in KJ/kg K\"),round(deltaS1_2)\n", - "print(\"deltaS1_2=s1-s2=0.01254 KJ/kg K\")\n", - "print(\"it means s2 > s1 hence the assumption that flow is from 1 to 2 is correct as from second law of thermodynamics the entropy increases in a process i.e s2 is greater than or equal to s1\")\n", - "print(\"hence flow occurs from 1 to 2 i.e from 0.5 MPa,400K to 0.3 Mpa & 350 K\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.16;pg no: 153" - ] - }, - { - "cell_type": "code", - "execution_count": 64, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.16, Page:46 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\n", - "NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#cal of deltaS\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.16, Page:46 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 16\")\n", - "print(\"NOTE=>In question no. 16,value of n is derived which cannot be solve using python software.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.17;pg no: 153" - ] - }, - { - "cell_type": "code", - "execution_count": 66, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.17, Page:153 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\n", - "total heat added(Q)in KJ\n", - "Q= 1800.0\n", - "for heat addition process 1-2\n", - "Q12=T1*(s2-s1)\n", - "deltaS=s2-s1=in KJ/K 2.0\n", - "or heat addition process 3-4\n", - "Q34=T3*(s4-s3)\n", - "deltaS=s4-s3=in KJ/K 2.0\n", - "or heat rejected in process 5-6(Q56)in KJ\n", - "Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)= 1200.0\n", - "net work done=net heat(W_net)in KJ\n", - "W_net=(Q12+Q34)-Q56 600.0\n", - "thermal efficiency of cycle(n)= 0.33\n", - "or n=n*100 % 33.33\n", - "so work done=600 KJ and thermal efficiency=33.33 %\n" - ] - } - ], - "source": [ - "#cal of work done and thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.17, Page:153 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 17\")\n", - "Q12=1000.;#heat added during process 1-2 in KJ\n", - "Q34=800.;#heat added during process 3-4 in KJ\n", - "T1=500.;#operating temperature for process 1-2\n", - "T3=400.;#operating temperature for process 3-4\n", - "T5=300.;#operating temperature for process 5-6\n", - "T2=T1;#isothermal process\n", - "T4=T3;#isothermal process\n", - "T6=T5;#isothermal process\n", - "print(\"total heat added(Q)in KJ\")\n", - "Q=Q12+Q34\n", - "print(\"Q=\"),round(Q,2)\n", - "print(\"for heat addition process 1-2\")\n", - "print(\"Q12=T1*(s2-s1)\")\n", - "deltaS=Q12/T1\n", - "print(\"deltaS=s2-s1=in KJ/K\"),round(deltaS,2)\n", - "print(\"or heat addition process 3-4\")\n", - "print(\"Q34=T3*(s4-s3)\")\n", - "deltaS=Q34/T3\n", - "print(\"deltaS=s4-s3=in KJ/K\"),round(deltaS,2)\n", - "print(\"or heat rejected in process 5-6(Q56)in KJ\")\n", - "Q56=T5*(deltaS+deltaS)\n", - "print(\"Q56=T5*(s5-s6)=T5*((s2-s1)+(s4-s3))=T5*(deltaS+deltaS)=\"),round(Q56,2)\n", - "print(\"net work done=net heat(W_net)in KJ\")\n", - "W_net=(Q12+Q34)-Q56\n", - "print(\"W_net=(Q12+Q34)-Q56\"),round(W_net,2)\n", - "n=W_net/Q\n", - "print(\"thermal efficiency of cycle(n)=\"),round(n,2)\n", - "n=n*100\n", - "print(\"or n=n*100 %\"),round(n,2) \n", - "print(\"so work done=600 KJ and thermal efficiency=33.33 %\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 5.18;pg no: 154" - ] - }, - { - "cell_type": "code", - "execution_count": 67, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.18, Page:154 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\n", - "let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\n", - "here Q1-Q2=W\n", - "so heat supplied by source(Q1)in KW= 30.0\n", - "also given that,Q1_a=0.7*Q1_b.......eq 1\n", - "Q1_c=Q1-(0.7*Q1_b+Q1_b)\n", - "Q1_c=Q1-1.7*Q1_b........eq 2\n", - "for reversible engine\n", - "Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\n", - "substitute eq 1 and eq 2 in eq 3 we get, \n", - "heat supplied by reservoir of 700 K(Q1_b)in KJ/s\n", - "Q1_b= 35.39\n", - "so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\n", - "Q1_a= 24.78\n", - "and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\n", - "Q1_c=Q1-1.7*Q1_b -30.17\n", - "so heat supplied by reservoir at 800 K(Q1_a)= 24.78\n", - "so heat supplied by reservoir at 700 K(Q1_b)= 35.39\n", - "so heat supplied by reservoir at 600 K(Q1_c)= -30.17\n", - "NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\n" - ] - } - ], - "source": [ - "#cal of heat supplied by reservoir at 800,700,600\n", - "#intiation of all variables\n", - "# Chapter 5\n", - "print\"Example 5.18, Page:154 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 5 Example 18\")\n", - "T1_a=800.;#temperature of reservoir a in K\n", - "T1_b=700.;#temperature of reservoir b in K\n", - "T1_c=600.;#temperature of reservoir c in K\n", - "T2=320.;#temperature of sink in K\n", - "W=20.;#work done in KW\n", - "Q2=10.;#heat rejected to sink in KW\n", - "print(\"let heat supplied by reservoir at 800 K,700 K,600 K be Q1_a , Q1_b , Q1_c\")\n", - "print(\"here Q1-Q2=W\")\n", - "Q1=W+Q2\n", - "print(\"so heat supplied by source(Q1)in KW=\"),round(Q1,2)\n", - "print(\"also given that,Q1_a=0.7*Q1_b.......eq 1\")\n", - "print(\"Q1_c=Q1-(0.7*Q1_b+Q1_b)\")\n", - "print(\"Q1_c=Q1-1.7*Q1_b........eq 2\")\n", - "print(\"for reversible engine\")\n", - "print(\"Q1_a/T1_a+Q1_b/T1_b+Q1_c/T1_c-Q2/T2=0......eq 3\")\n", - "print(\"substitute eq 1 and eq 2 in eq 3 we get, \")\n", - "print(\"heat supplied by reservoir of 700 K(Q1_b)in KJ/s\")\n", - "Q1_b=((Q2/T2)-(Q1/T1_c))/((0.7/T1_a)+(1/T1_b)-(1.7/T1_c))\n", - "print(\"Q1_b=\"),round(Q1_b,2)\n", - "print(\"so heat supplied by reservoir of 800 K(Q1_a)in KJ/s\")\n", - "Q1_a=0.7*Q1_b\n", - "print(\"Q1_a=\"),round(Q1_a,2)\n", - "print(\"and heat supplied by reservoir of 600 K(Q1_c)in KJ/s\")\n", - "Q1_c=Q1-1.7*Q1_b\n", - "print(\"Q1_c=Q1-1.7*Q1_b\"),round(Q1_c,2)\n", - "print(\"so heat supplied by reservoir at 800 K(Q1_a)=\"),round(Q1_a,2)\n", - "print(\"so heat supplied by reservoir at 700 K(Q1_b)=\"),round(Q1_b,2)\n", - "print(\"so heat supplied by reservoir at 600 K(Q1_c)=\"),round(Q1_c,2)\n", - "print(\"NOTE=>answer given in book for heat supplied by reservoir at 800 K,700 K,600 K i.e Q1_a=61.94 KJ/s,Q1_b=88.48 KJ/s,Q1_c=120.42 KJ/s is wrong hence correct answer is calculated above.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter6.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter6.ipynb deleted file mode 100755 index 92ef2871..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter6.ipynb +++ /dev/null @@ -1,1390 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6:Thermo dynamic Properties of pure substance" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.1;pg no: 174" - ] - }, - { - "cell_type": "code", - "execution_count": 68, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.1, Page:174 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\n", - "NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.1, Page:174 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\")\n", - "print(\"NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.2;pg no: 175" - ] - }, - { - "cell_type": "code", - "execution_count": 69, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.2, Page:175 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\n", - "during throttling,h1=h2\n", - "at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\n", - "thus h2=2682.5 KJ/kg\n", - "at state 1,before throttling\n", - "hf_10Mpa=1407.56 KJ/kg\n", - "hfg_10Mpa=1317.1 KJ/kg\n", - "h1=hf_10Mpa+x1*hfg_10Mpa\n", - "dryness fraction(x1)may be given as\n", - "x1= 0.97\n" - ] - } - ], - "source": [ - "#cal of dryness fraction\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.2, Page:175 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\")\n", - "print(\"during throttling,h1=h2\")\n", - "print(\"at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\")\n", - "print(\"thus h2=2682.5 KJ/kg\")\n", - "h2=2682.5;\n", - "print(\"at state 1,before throttling\")\n", - "print(\"hf_10Mpa=1407.56 KJ/kg\")\n", - "hf_10Mpa=1407.56;\n", - "print(\"hfg_10Mpa=1317.1 KJ/kg\")\n", - "hfg_10Mpa=1317.1;\n", - "print(\"h1=hf_10Mpa+x1*hfg_10Mpa\")\n", - "h1=h2;#during throttling\n", - "print(\"dryness fraction(x1)may be given as\")\n", - "x1=(h1-hf_10Mpa)/hfg_10Mpa\n", - "print(\"x1=\"),round(x1,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.3;pg no: 176" - ] - }, - { - "cell_type": "code", - "execution_count": 70, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.3, Page:176 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\n", - "internal energy(u)=in KJ/kg 2644.0\n" - ] - } - ], - "source": [ - "#cal of internal energy\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.3, Page:176 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\")\n", - "h=2848;#enthalpy in KJ/kg\n", - "p=12*1000;#pressure in Kpa\n", - "v=0.017;#specific volume in m^3/kg\n", - "u=h-p*v\n", - "print(\"internal energy(u)=in KJ/kg\"),round(u,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.4;pg no: 176" - ] - }, - { - "cell_type": "code", - "execution_count": 71, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.4, Page:176 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\n", - "steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\n", - "entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\n", - "S= 6.65\n", - "entropy of 5 kg of steam(S)in KJ/K\n", - "S=m*S 33.23\n" - ] - } - ], - "source": [ - "#cal of entropy of 5 kg of steam\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "import math\n", - "print\"Example 6.4, Page:176 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\")\n", - "m=5;#mass of steam in kg\n", - "p=2;#pressure of steam in Mpa\n", - "T_superheat=(300+273.15);#temperature of superheat steam in K\n", - "Cp_water=4.18;#specific heat of water at constant pressure in KJ/kg K\n", - "Cp_superheat=2.1;#specific heat of superheat steam at constant pressure in KJ/kg K\n", - "print(\"steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\")\n", - "T_sat=(212.42+273.15);#saturation temperature at 2 Mpa in K\n", - "hfg_2Mpa=1890.7;\n", - "print(\"entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\")\n", - "S=Cp_water*math.log(T_sat/273.15)+(hfg_2Mpa/T_sat)+(Cp_superheat*math.log(T_superheat/T_sat))\n", - "print(\"S=\"),round(S,2)\n", - "print(\"entropy of 5 kg of steam(S)in KJ/K\")\n", - "S=m*S\n", - "print(\"S=m*S\"),round(S,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.5;pg no: 176" - ] - }, - { - "cell_type": "code", - "execution_count": 72, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.5, Page:176 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\n", - "boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\n", - "at further depth of 50 cm the pressure(p)in Kpa\n", - "p= 138.37\n", - "boiling point at this depth=Tsat_138.365\n", - "from steam table this temperature=108.866=108.87 degree celcius\n", - "so boiling point = 108.87 degree celcius\n" - ] - } - ], - "source": [ - "#cal of boiling point\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.5, Page:176 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\")\n", - "rho=1000;#density of water in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "h=0.50;#depth from above mentioned level in m\n", - "print(\"boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\")\n", - "p_boil=143.27;#pressure at which pond water boils in Kpa\n", - "print(\"at further depth of 50 cm the pressure(p)in Kpa\")\n", - "p=p_boil-((rho*g*h)*10**-3)\n", - "print(\"p=\"),round(p,2)\n", - "print(\"boiling point at this depth=Tsat_138.365\")\n", - "print(\"from steam table this temperature=108.866=108.87 degree celcius\")\n", - "print(\"so boiling point = 108.87 degree celcius\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.6;pg no: 177" - ] - }, - { - "cell_type": "code", - "execution_count": 73, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.6, Page:177 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\n", - "in a rigid vessel it can be treated as constant volume process.\n", - "so v1=v2\n", - "since final state is given to be critical state,then specific volume at critical point,\n", - "v2=0.003155 m^3/kg\n", - "at 100 degree celcius saturation temperature,from steam table\n", - "vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\n", - "and vfg_100=in m^3/kg= 1.67\n", - "thus for initial quality being x1\n", - "v1=vf_100+x1*vfg_100\n", - "so x1= 0.001\n", - "mass of water initially=total mass*(1-x1)\n", - "total mass of fluid/water(m) in kg= 158.48\n", - "volume of water(v) in m^3= 0.1655\n" - ] - } - ], - "source": [ - "#cal of mass and volume of water\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.6, Page:177 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\")\n", - "V=0.5;#capacity of rigid vessel in m^3\n", - "print(\"in a rigid vessel it can be treated as constant volume process.\")\n", - "print(\"so v1=v2\")\n", - "print(\"since final state is given to be critical state,then specific volume at critical point,\")\n", - "print(\"v2=0.003155 m^3/kg\")\n", - "v2=0.003155;#specific volume at critical point in m^3/kg\n", - "print(\"at 100 degree celcius saturation temperature,from steam table\")\n", - "print(\"vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\")\n", - "vf_100=0.001044;\n", - "vg_100=1.6729;\n", - "vfg_100=vg_100-vf_100\n", - "print(\"and vfg_100=in m^3/kg=\"),round(vfg_100,2)\n", - "print(\"thus for initial quality being x1\")\n", - "v1=v2;#rigid vessel\n", - "x1=(v1-vf_100)/vfg_100\n", - "print(\"v1=vf_100+x1*vfg_100\")\n", - "print(\"so x1=\"),round(x1,3)\n", - "print(\"mass of water initially=total mass*(1-x1)\")\n", - "m=V/v2\n", - "print(\"total mass of fluid/water(m) in kg=\"),round(m,2)\n", - "v=m*vf_100\n", - "print(\"volume of water(v) in m^3=\"),round(v,4)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.7;pg no: 177" - ] - }, - { - "cell_type": "code", - "execution_count": 74, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.7, Page:177 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\n", - "on mollier diadram(h-s diagram)the slope of isobaric line may be given as\n", - "(dh/ds)_p=cons =slope of isobar\n", - "from 1st and 2nd law combined;\n", - "T*ds=dh-v*dp\n", - "(dh/ds)_p=cons = T\n", - "here temperature,T=773.15 K\n", - "here slope=(dh/ds))p=cons = 773.15\n" - ] - } - ], - "source": [ - "#cal of slope\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.7, Page:177 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\")\n", - "print(\"on mollier diadram(h-s diagram)the slope of isobaric line may be given as\")\n", - "print(\"(dh/ds)_p=cons =slope of isobar\")\n", - "print(\"from 1st and 2nd law combined;\")\n", - "print(\"T*ds=dh-v*dp\")\n", - "print(\"(dh/ds)_p=cons = T\")\n", - "print(\"here temperature,T=773.15 K\")\n", - "print(\"here slope=(dh/ds))p=cons = 773.15\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.8;pg no: 178" - ] - }, - { - "cell_type": "code", - "execution_count": 75, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.8, Page:178 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\n", - "at 0.15Mpa,from steam table;\n", - "hf=467.11 KJ/kg,hg=2693.6 KJ/kg\n", - "and hfg in KJ/kg= 2226.49\n", - "vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\n", - "and vfg in m^3/kg= 1.16\n", - "sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\n", - "and sfg=in KJ/kg K= 5.79\n", - "enthalpy at x=.10(h)in KJ/kg\n", - "h= 689.76\n", - "specific volume,(v)in m^3/kg\n", - "v= 0.12\n", - "entropy (s)in KJ/kg K\n", - "s= 2.01\n" - ] - } - ], - "source": [ - "#cal of entropy\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.8, Page:178 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\")\n", - "x=.10;#quality is 10%\n", - "print(\"at 0.15Mpa,from steam table;\")\n", - "print(\"hf=467.11 KJ/kg,hg=2693.6 KJ/kg\")\n", - "hf=467.11;\n", - "hg=2693.6;\n", - "hfg=hg-hf\n", - "print(\"and hfg in KJ/kg=\"),round(hfg,2)\n", - "print(\"vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\")\n", - "vf=0.001053;\n", - "vg=1.1593;\n", - "vfg=vg-vf\n", - "print(\"and vfg in m^3/kg=\"),round(vfg,2)\n", - "print(\"sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\")\n", - "sf=1.4336;\n", - "sg=7.2233;\n", - "sfg=sg-sf\n", - "print(\"and sfg=in KJ/kg K=\"),round(sfg,2)\n", - "print(\"enthalpy at x=.10(h)in KJ/kg\")\n", - "h=hf+x*hfg\n", - "print(\"h=\"),round(h,2)\n", - "print(\"specific volume,(v)in m^3/kg\")\n", - "v=vf+x*vfg\n", - "print(\"v=\"),round(v,2)\n", - "print(\"entropy (s)in KJ/kg K\")\n", - "s=sf+x*sfg\n", - "print(\"s=\"),round(s,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.9;pg no: 178" - ] - }, - { - "cell_type": "code", - "execution_count": 76, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.9, Page:178 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\n", - "work done during constant pressure process(W)=p1*(V2-V1)in KJ\n", - "now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\n", - "so v1 in m^3/kg=\n", - "now mass of steam(m) in kg= 0.32\n", - "specific volume at final state(v2)in m^3/kg\n", - "v2= 0.62\n", - "corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\n", - "v2>vg_1Mpa\n", - "hence state lies in superheated region,from the steam table by interpolation we get temperature as;\n", - "state lies between temperature of 1000 degree celcius and 1100 degree celcius\n", - "so exact temperature at final state(T)in K= 1077.61\n", - "thus internal energy at final state,1 Mpa,1077.61 degree celcius;\n", - "u2=4209.6 KJ/kg\n", - "internal energy at initial state(u1)in KJ/kg\n", - "u1= 2219.28\n", - "from first law of thermodynamics,Q-W=deltaU\n", - "so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ= 788.83\n" - ] - } - ], - "source": [ - "#cal of heat added\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.9, Page:178 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\")\n", - "p1=1*1000;#initial pressure of steam in Kpa\n", - "V1=0.05;#initial volume of steam in m^3\n", - "x1=.8;#dryness fraction is 80%\n", - "V2=0.2;#final volume of steam in m^3\n", - "p2=p1;#constant pressure process\n", - "print(\"work done during constant pressure process(W)=p1*(V2-V1)in KJ\")\n", - "W=p1*(V2-V1)\n", - "print(\"now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\")\n", - "vf=0.001127;\n", - "vg=0.19444;\n", - "uf=761.68;\n", - "ufg=1822;\n", - "v1=vf+x1*vg\n", - "print(\"so v1 in m^3/kg=\")\n", - "m=V1/v1\n", - "print(\"now mass of steam(m) in kg=\"),round(m,2)\n", - "m=0.32097;#take m=0.32097 approx.\n", - "print(\"specific volume at final state(v2)in m^3/kg\")\n", - "v2=V2/m\n", - "print(\"v2=\"),round(v2,2)\n", - "print(\"corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\")\n", - "print(\"v2>vg_1Mpa\")\n", - "print(\"hence state lies in superheated region,from the steam table by interpolation we get temperature as;\")\n", - "print(\"state lies between temperature of 1000 degree celcius and 1100 degree celcius\")\n", - "T=1000+((100*(.62311-.5871))/(.6335-.5871))\n", - "print(\"so exact temperature at final state(T)in K=\"),round(T,2)\n", - "print(\"thus internal energy at final state,1 Mpa,1077.61 degree celcius;\")\n", - "print(\"u2=4209.6 KJ/kg\")\n", - "u2=4209.6;\n", - "print(\"internal energy at initial state(u1)in KJ/kg\")\n", - "u1=uf+x1*ufg\n", - "print(\"u1=\"),round(u1,2)\n", - "print(\"from first law of thermodynamics,Q-W=deltaU\")\n", - "Q=m*(u2-u1)+W\n", - "print(\"so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ=\"),round(Q,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.10;pg no: 179" - ] - }, - { - "cell_type": "code", - "execution_count": 77, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.10, Page:179 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\n", - "here steam is kept in rigid vessel,therefore its specific volume shall remain constant\n", - "it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\n", - "from superheated steam table;v1=0.2404 m^3/kg\n", - "at begining of condensation specific volume = 0.2404 m^3/kg\n", - "v2=0.2404 m^3/kg\n", - "this v2 shall be specific volume corresponding to saturated vapour state for condensation.\n", - "thus v2=vg=0.2404 m^3/kg\n", - "looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\n", - "by interpolation,temperature at begining of condensation(T2)in K\n", - "similarily,pressure(p2)in Kpa= 800.96\n" - ] - } - ], - "source": [ - "#cal of pressure\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.10, Page:179 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\")\n", - "p1=800;#initial pressure of steam in Kpa\n", - "T1=200;#initial temperature of steam in degree celcius\n", - "print(\"here steam is kept in rigid vessel,therefore its specific volume shall remain constant\")\n", - "print(\"it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\")\n", - "print(\"from superheated steam table;v1=0.2404 m^3/kg\")\n", - "print(\"at begining of condensation specific volume = 0.2404 m^3/kg\")\n", - "print(\"v2=0.2404 m^3/kg\")\n", - "v2=0.2404;\n", - "print(\"this v2 shall be specific volume corresponding to saturated vapour state for condensation.\")\n", - "print(\"thus v2=vg=0.2404 m^3/kg\")\n", - "vg=v2;\n", - "print(\"looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\")\n", - "print(\"by interpolation,temperature at begining of condensation(T2)in K\")\n", - "T2=175-((175-170)*(0.2404-0.2167))/(0.2428-.2168)\n", - "p=892-(((892-791.7)*(0.2404-0.2168))/(0.2428-0.2168))\n", - "print(\"similarily,pressure(p2)in Kpa=\"),round(p,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.11;pg no: 180" - ] - }, - { - "cell_type": "code", - "execution_count": 78, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.11, Page:180 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\n", - "from 1st and 2nd law;\n", - "T*ds=dh-v*dp\n", - "for isentropic process,ds=0\n", - "hence dh=v*dp\n", - "i.e (h2-h1)=v1*(p2-p1)\n", - "corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\n", - "p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\n", - "therefore enthalpy change(deltah)=(h2-h1) in KJ/kg= 0.2\n" - ] - } - ], - "source": [ - "#cal of enthalpy change\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.11, Page:180 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\")\n", - "p2=200;#feed water pump pressure in Kpa\n", - "print(\"from 1st and 2nd law;\")\n", - "print(\"T*ds=dh-v*dp\")\n", - "print(\"for isentropic process,ds=0\")\n", - "print(\"hence dh=v*dp\")\n", - "print(\"i.e (h2-h1)=v1*(p2-p1)\")\n", - "print(\"corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\")\n", - "print(\"p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\")\n", - "p1=4.25;\n", - "v1=0.001004;\n", - "deltah=v1*(p2-p1)\n", - "print(\"therefore enthalpy change(deltah)=(h2-h1) in KJ/kg=\"),round(deltah,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.12;pg no: 180" - ] - }, - { - "cell_type": "code", - "execution_count": 79, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.12, Page:180 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\n", - "from steam table at 150 degree celcius\n", - "vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\n", - "so volume occupied by water(Vw)=3*V/(3+2) in m^3 1.2\n", - "and volume of steam(Vs) in m^3= 0.8\n", - "mass of water(mf)=Vw/Vf in kg 1099.91\n", - "mass of steam(mg)=Vs/Vg in kg 2.04\n", - "total mass in tank(m) in kg= 1101.95\n", - "quality or dryness fraction(x)\n", - "x= 0.002\n", - "NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\n" - ] - } - ], - "source": [ - "#cal of quality or dryness fraction\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.12, Page:180 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\")\n", - "V=2.;#volume of vessel in m^3\n", - "print(\"from steam table at 150 degree celcius\")\n", - "print(\"vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\")\n", - "Vf=0.001091;\n", - "Vg=0.3928;\n", - "Vw=3*V/(3+2)\n", - "print(\"so volume occupied by water(Vw)=3*V/(3+2) in m^3\"),round(Vw,2)\n", - "Vs=2*V/(3+2)\n", - "print(\"and volume of steam(Vs) in m^3=\"),round(Vs,2)\n", - "mf=Vw/Vf\n", - "print(\"mass of water(mf)=Vw/Vf in kg\"),round(mf,2)\n", - "mg=Vs/Vg\n", - "print(\"mass of steam(mg)=Vs/Vg in kg\"),round(mg,2)\n", - "m=mf+mg\n", - "print(\"total mass in tank(m) in kg=\"),round(m,2)\n", - "print(\"quality or dryness fraction(x)\")\n", - "x=mg/m\n", - "print(\"x=\"),round(x,3)\n", - "print(\"NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.13;pg no: 181" - ] - }, - { - "cell_type": "code", - "execution_count": 80, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.13, Page:181 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\n", - "fron S.F.S.E on steam turbine;\n", - "W=h1-h2\n", - "initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\n", - "h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\n", - "reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\n", - "else from steam tables at 50 degree celcius saturation temperature;\n", - "hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\n", - "hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\n", - "here s1=s2,let dryness fraction at 2 be x2\n", - "x2= 0.75\n", - "hence enthalpy at state 2\n", - "h2 in KJ/kg= 1994.84\n", - "steam turbine work(W)in KJ/kg\n", - "W=h1-h2\n", - "so turbine output=W 891.36\n" - ] - } - ], - "source": [ - "#cal of turbine output\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.13, Page:181 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\")\n", - "print(\"fron S.F.S.E on steam turbine;\")\n", - "print(\"W=h1-h2\")\n", - "print(\"initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\")\n", - "print(\"h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\")\n", - "h1=2886.2;\n", - "s1=6.2285;\n", - "print(\"reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\")\n", - "print(\"else from steam tables at 50 degree celcius saturation temperature;\")\n", - "print(\"hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\")\n", - "hf=209.33;\n", - "sf=0.7038;\n", - "print(\"hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\")\n", - "hfg=2382.7;\n", - "sfg=7.3725;\n", - "print(\"here s1=s2,let dryness fraction at 2 be x2\")\n", - "x2=(s1-sf)/sfg\n", - "print(\"x2=\"),round(x2,2)\n", - "print(\"hence enthalpy at state 2\")\n", - "h2=hf+x2*hfg\n", - "print(\"h2 in KJ/kg=\"),round(h2,2)\n", - "print(\"steam turbine work(W)in KJ/kg\")\n", - "W=h1-h2\n", - "print(\"W=h1-h2\")\n", - "print(\"so turbine output=W\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.14;pg no: 181" - ] - }, - { - "cell_type": "code", - "execution_count": 81, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.14, Page:181 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\n", - "it is constant volume process\n", - "volume of vessel(V)=mass of vapour * specific volume of vapour\n", - "initial specific volume,v1\n", - "v1=vf_100Kpa+x1*vfg_100 in m^3/kg\n", - "at 100 Kpa from steam table;\n", - "hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\n", - " here vfg_100Kpa= in m^3/kg= 1.69\n", - "so v1= in m^3/kg= 0.85\n", - "and volume of vessel(V) in m^3= 42.38\n", - "enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg 1546.46\n", - "internal energy in the beginning=U1=m1*u1 in KJ 146171.0\n", - "let the mass of dry steam added be m,final specific volume inside vessel,v2\n", - "v2=vf_1000Kpa+x2*vfg_1000Kpa\n", - "at 2000 Kpa,from steam table,\n", - "vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\n", - "total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\n", - "V/v2=V/vg_2000Kpa+V/v1\n", - "so v2 in m^3/kg= 0.09\n", - "here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\n", - "at 1000 Kpa from steam table,\n", - "hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\n", - "here vfg_1000Kpa= in m^3/kg= 0.19\n", - "so x2= 0.46\n", - "for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\n", - "so mass of dry steam at 2000 Kpa to be added(m)in kg\n", - "m=(100*(h1-h2))/(h2-hg_2000Kpa)= 11.97\n", - "quality of final mixture x2= 0.46\n" - ] - } - ], - "source": [ - "#cal of quality of final mixture\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.14, Page:181 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\")\n", - "x1=0.5;#dryness fraction \n", - "m1=100;#mass of steam in kg\n", - "v1=0.8475;#\n", - "print(\"it is constant volume process\")\n", - "print(\"volume of vessel(V)=mass of vapour * specific volume of vapour\")\n", - "print(\"initial specific volume,v1\")\n", - "print(\"v1=vf_100Kpa+x1*vfg_100 in m^3/kg\")\n", - "print(\"at 100 Kpa from steam table;\")\n", - "print(\"hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\")\n", - "hf_100Kpa=417.46;\n", - "uf_100Kpa=417.36;\n", - "vf_100Kpa=0.001043;\n", - "hfg_100Kpa=2258;\n", - "ufg_100Kpa=2088.7;\n", - "vg_100Kpa=1.6940;\n", - "vfg_100Kpa=vg_100Kpa-vf_100Kpa\n", - "print(\" here vfg_100Kpa= in m^3/kg=\"),round(vfg_100Kpa,2)\n", - "v1=vf_100Kpa+x1*vfg_100Kpa\n", - "print(\"so v1= in m^3/kg=\"),round(v1,2)\n", - "V=m1*x1*v1\n", - "print(\"and volume of vessel(V) in m^3=\"),round(V,2)\n", - "h1=hf_100Kpa+x1*hfg_100Kpa\n", - "print(\"enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg\"),round(h1,2)\n", - "U1=m1*(uf_100Kpa+x1*ufg_100Kpa)\n", - "print(\"internal energy in the beginning=U1=m1*u1 in KJ\"),round(U1,2)\n", - "print(\"let the mass of dry steam added be m,final specific volume inside vessel,v2\")\n", - "print(\"v2=vf_1000Kpa+x2*vfg_1000Kpa\")\n", - "print(\"at 2000 Kpa,from steam table,\")\n", - "print(\"vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\")\n", - "vg_2000Kpa=0.09963;\n", - "ug_2000Kpa=2600.3;\n", - "hg_2000Kpa=2799.5;\n", - "print(\"total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\")\n", - "print(\"V/v2=V/vg_2000Kpa+V/v1\")\n", - "v2=1/((1/vg_2000Kpa)+(1/v1))\n", - "print(\"so v2 in m^3/kg=\"),round(v2,2)\n", - "print(\"here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\")\n", - "print(\"at 1000 Kpa from steam table,\")\n", - "print(\"hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\")\n", - "hf_1000Kpa=762.81;\n", - "hfg_1000Kpa=2015.3;\n", - "vf_1000Kpa=0.001127;\n", - "vg_1000Kpa=0.19444;\n", - "vfg_1000Kpa=vg_1000Kpa-vf_1000Kpa\n", - "print(\"here vfg_1000Kpa= in m^3/kg=\"),round(vfg_1000Kpa,2)\n", - "x2=(v2-vf_1000Kpa)/vfg_1000Kpa\n", - "print(\"so x2=\"),round(x2,2)\n", - "print(\"for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\")\n", - "print(\"so mass of dry steam at 2000 Kpa to be added(m)in kg\")\n", - "m=(100*(h1-(hf_1000Kpa+x2*hfg_1000Kpa)))/((hf_1000Kpa+x2*hfg_1000Kpa)-hg_2000Kpa)\n", - "print(\"m=(100*(h1-h2))/(h2-hg_2000Kpa)=\"),round(m,2)\n", - "print(\"quality of final mixture x2=\"),round(x2,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.15;pg no: 183" - ] - }, - { - "cell_type": "code", - "execution_count": 82, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.15, Page:183 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\n", - "from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\n", - "condenser pressure(p_condenser) in Kpa= 7.3\n", - "partial pressure of steam corresponding to35 degree celcius from steam table;\n", - "p_steam=5.628 Kpa\n", - "enthalpy corresponding to 35 degree celcius from steam table,\n", - "hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\n", - "let quality of steam entering be x\n", - "from energy balance;\n", - "mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\n", - "so dryness fraction of steam entering(x)is given as\n", - "x= 0.97\n" - ] - } - ], - "source": [ - "#cal of dryness fraction of steam entering\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.15, Page:183 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\")\n", - "p_vaccum=71.5;#recorded condenser vaccum in cm of mercury\n", - "p_barometer=76.8;#barometer reading in cm of mercury\n", - "T_cond=35;#temperature of condensation in degree celcius\n", - "T_hotwell=27.6;#temperature of hot well in degree celcius\n", - "m_cond=1930;#mass of condensate per hour\n", - "m_w=62000;#mass of cooling water per hour\n", - "Ti=8.51;#initial temperature in degree celcius\n", - "To=26.24;#outlet temperature in degree celcius\n", - "print(\"from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\")\n", - "p_condenser=(p_barometer-p_vaccum)*101.325/73.55\n", - "print(\"condenser pressure(p_condenser) in Kpa=\"),round(p_condenser,2)\n", - "print(\"partial pressure of steam corresponding to35 degree celcius from steam table;\")\n", - "print(\"p_steam=5.628 Kpa\")\n", - "p_steam=5.628;#partial pressure of steam\n", - "print(\"enthalpy corresponding to 35 degree celcius from steam table,\")\n", - "print(\"hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\")\n", - "hf=146.68;\n", - "hfg=2418.6;\n", - "print(\"let quality of steam entering be x\")\n", - "print(\"from energy balance;\")\n", - "print(\"mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\")\n", - "print(\"so dryness fraction of steam entering(x)is given as\")\n", - "x=(((m_w*(To-Ti)*4.18)/m_cond)-hf+4.18*T_hotwell)/hfg\n", - "print(\"x=\"),round(x,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.16;pg no: 184" - ] - }, - { - "cell_type": "code", - "execution_count": 83, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.16, Page:184 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\n", - "heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\n", - "area(A) in m^2= 0.03\n", - "so p1=in Kpa= 419.61\n", - "now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\n", - "volume of water contained(V1) in m^3= 0.001\n", - "mass of water(m) in kg= 0.63\n", - "heat supplied shall cause sensible heating and latent heating\n", - "hence,enthalpy change=heat supplied\n", - "Q=((hf+x*hfg)-(4.18*T)*m)\n", - "so dryness fraction of steam produced(x)can be calculated as\n", - "so x= 0.46\n", - "internal energy of water(U1)in KJ,initially\n", - "U1= 393.69\n", - "finally,internal energy of wet steam(U2)in KJ\n", - "U2=m*h2-p2*V2\n", - "here V2 in m^3= 0.13\n", - "hence U2= 940.68\n", - "hence change in internal energy(U) in KJ= 547.21\n", - "work done(W) in KJ= 53.01\n" - ] - } - ], - "source": [ - "#cal of change in internal energy and work done\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "import math\n", - "print\"Example 6.16, Page:184 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\")\n", - "F=10;#force applied externally upon piston in KN\n", - "d=.2;#diameter in m\n", - "h=0.02;#depth to which water filled in m \n", - "P_atm=101.3;#atmospheric pressure in Kpa\n", - "rho=1000;#density of water in kg/m^3\n", - "Q=600;#heat supplied to water in KJ\n", - "T=150;#temperature of water in degree celcius\n", - "print(\"heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\")\n", - "A=math.pi*d**2/4\n", - "print(\"area(A) in m^2=\"),round(A,2)\n", - "p1=F/A+P_atm\n", - "print(\"so p1=in Kpa=\"),round(p1,2)\n", - "print(\"now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\")\n", - "hf=612.1;\n", - "hfg=2128.7;\n", - "vg=0.4435;\n", - "V1=math.pi*d**2*h/4\n", - "print(\"volume of water contained(V1) in m^3=\"),round(V1,3)\n", - "m=V1*rho\n", - "print(\"mass of water(m) in kg=\"),round(m,2)\n", - "print(\"heat supplied shall cause sensible heating and latent heating\")\n", - "print(\"hence,enthalpy change=heat supplied\")\n", - "print(\"Q=((hf+x*hfg)-(4.18*T)*m)\")\n", - "print(\"so dryness fraction of steam produced(x)can be calculated as\")\n", - "x=((Q/m)+4.18*T-hf)/hfg\n", - "print(\"so x=\"),round(x,2)\n", - "print(\"internal energy of water(U1)in KJ,initially\")\n", - "h1=4.18*T;#enthalpy of water in KJ/kg\n", - "U1=m*h1-p1*V1\n", - "print(\"U1=\"),round(U1,2)\n", - "U1=393.5;#approx.\n", - "print(\"finally,internal energy of wet steam(U2)in KJ\")\n", - "print(\"U2=m*h2-p2*V2\")\n", - "V2=m*x*vg\n", - "print(\"here V2 in m^3=\"),round(V2,2)\n", - "p2=p1;#constant pressure process\n", - "U2=(m*(hf+x*hfg))-p2*V2\n", - "print(\"hence U2=\"),round(U2,2)\n", - "U2=940.71;#approx.\n", - "U=U2-U1\n", - "print(\"hence change in internal energy(U) in KJ=\"),round(U,2)\n", - "p=p1;\n", - "W=p*(V2-V1)\n", - "print(\"work done(W) in KJ=\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.17;pg no: 185" - ] - }, - { - "cell_type": "code", - "execution_count": 84, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.17, Page:185 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\n", - "consider throttling calorimeter alone,\n", - "degree of superheat(T_sup)in degree celcius\n", - "T_sup= 18.2\n", - "enthalpy of superheated steam(h_sup)in KJ/kg\n", - "h_sup= 2711.99\n", - "at 120 degree celcius,h=2673.95 KJ/kg from steam table\n", - "now enthalpy before throttling = enthalpy after throttling\n", - "hf+x2*hfg=h_sup\n", - "here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\n", - "so x2= 0.96\n", - "for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\n", - "overall dryness fraction(x)= 0.91\n" - ] - } - ], - "source": [ - "#cal of overall dryness fraction\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.17, Page:185 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\")\n", - "ms=40;#mass of steam in kg\n", - "mw=2.2;#mass of water in kg\n", - "p1=1.47;#pressure before throttling in Mpa\n", - "T2=120;#temperature after throttling in degree celcius\n", - "p2=107.88;#pressure after throttling in Kpa\n", - "Cp_sup=2.09;#specific heat of superheated steam in KJ/kg K\n", - "print(\"consider throttling calorimeter alone,\")\n", - "print(\"degree of superheat(T_sup)in degree celcius\")\n", - "T_sup=T2-101.8\n", - "print(\"T_sup=\"),round(T_sup,2)\n", - "print(\"enthalpy of superheated steam(h_sup)in KJ/kg\")\n", - "h=2673.95;\n", - "h_sup=h+T_sup*Cp_sup\n", - "print(\"h_sup=\"),round(h_sup,2)\n", - "print(\"at 120 degree celcius,h=2673.95 KJ/kg from steam table\")\n", - "print(\"now enthalpy before throttling = enthalpy after throttling\")\n", - "print(\"hf+x2*hfg=h_sup\")\n", - "print(\"here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\")\n", - "hf=840.513;\n", - "hfg=1951.02;\n", - "x2=(h_sup-hf)/hfg\n", - "print(\"so x2=\"),round(x2,2)\n", - "print(\"for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\")\n", - "x1=(ms-mw)/ms\n", - "x=x1*x2\n", - "print(\"overall dryness fraction(x)=\"),round(x,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.18;pg no: 185" - ] - }, - { - "cell_type": "code", - "execution_count": 85, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.18, Page:185 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\n", - "here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\n", - "final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\n", - "Q in KJ= 200.0\n", - "final enthalpy of dry steam at 15 bar,h2=hg_15bar\n", - "h2=2792.2 KJ/kg from steam table\n", - "let initial dryness fraction be x1,initial enthalpy,\n", - "h1=hf_10bar+x1*hfg_10bar.........eq1\n", - "here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\n", - "also heat balance yields,\n", - "h1+Q=h2\n", - "so h1=h2-Q in KJ/kg\n", - "so by eq 1=>x1= 0.91\n", - "heat added(Q)in KJ= 200.0\n", - "and initial quality(x1) 0.91\n" - ] - } - ], - "source": [ - "#cal of heat added and initial quality\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.18, Page:185 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\")\n", - "v=0.4;#volume of air in part A and part B in m^3\n", - "p1=10*10**5;#initial pressure of steam in pa\n", - "p2=15*10**5;#final pressure of steam in pa\n", - "print(\"here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\")\n", - "print(\"final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\")\n", - "Q=v*(p2-p1)/1000\n", - "print(\"Q in KJ=\"),round(Q,2)\n", - "print(\"final enthalpy of dry steam at 15 bar,h2=hg_15bar\")\n", - "print(\"h2=2792.2 KJ/kg from steam table\")\n", - "h2=2792.2;\n", - "print(\"let initial dryness fraction be x1,initial enthalpy,\")\n", - "print(\"h1=hf_10bar+x1*hfg_10bar.........eq1\")\n", - "print(\"here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\")\n", - "hf_10bar=762.83;\n", - "hfg_10bar=2015.3;\n", - "print(\"also heat balance yields,\")\n", - "print(\"h1+Q=h2\")\n", - "print(\"so h1=h2-Q in KJ/kg\")\n", - "h1=h2-Q\n", - "x1=(h1-hf_10bar)/hfg_10bar\n", - "print(\"so by eq 1=>x1=\"),round(x1,2)\n", - "print(\"heat added(Q)in KJ=\"),round(Q,2)\n", - "print(\"and initial quality(x1)\"),round(x1,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.19;pg no: 186" - ] - }, - { - "cell_type": "code", - "execution_count": 86, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.19, Page:186 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\n", - "from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\n", - "specific volume of wet steam in cylinder,v1 in m^3/kg= 0.75\n", - "dryness fraction of initial steam(x1)= 0.6\n", - "initial enthalpy of wet steam,h1 in KJ/kg= 1801.83\n", - "at 400 degree celcius specific volume of steam,v2 in m^3/kg= 1.55\n", - "for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\n", - "actual pressure can be obtained by interpolation\n", - "p2=0.20 MPa(approx.)\n", - "saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\n", - "finally the degree of superheat(T_sup)in K\n", - "T_sup=T-t\n", - "final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\n", - "heat added during process(deltaQ)in KJ\n", - "deltaQ=m*(h2-h1)\n", - "internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\n", - "here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\n", - "internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\n", - "u2=2966.7 KJ/kg\n", - "change in internal energy(deltaU)in KJ\n", - "deltaU= 3807.41\n", - "form first law of thermodynamics,work done(deltaW)in KJ\n", - "deltaW=deltaQ-deltaU 616.88\n", - "so heat transfer(deltaQ)in KJ 4424.3\n", - "and work transfer(deltaW)in KJ 616.88\n", - "NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\n", - "and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\n" - ] - } - ], - "source": [ - "#cal of heat and work transfer \n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.19, Page:186 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\")\n", - "m=3;#mass of wet steam in kg\n", - "p=1.4;#pressure of wet steam in bar\n", - "V1=2.25;#initial volume in m^3\n", - "V2=4.65;#final volume in m^3\n", - "T=400;#temperature of steam in degreee celcius\n", - "print(\"from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\")\n", - "vg=1.2455;\n", - "hf=457.99;\n", - "hfg=2232.3;\n", - "v1=V1/m\n", - "print(\"specific volume of wet steam in cylinder,v1 in m^3/kg=\"),round(v1,2)\n", - "x1=v1/vg\n", - "print(\"dryness fraction of initial steam(x1)=\"),round(x1,2)\n", - "x1=0.602;#approx.\n", - "h1=hf+x1*hfg\n", - "print(\"initial enthalpy of wet steam,h1 in KJ/kg=\"),round(h1,2)\n", - "v2=V2/m\n", - "print(\"at 400 degree celcius specific volume of steam,v2 in m^3/kg=\"),round(v2,2)\n", - "print(\"for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\")\n", - "print(\"actual pressure can be obtained by interpolation\")\n", - "p2=.1+((0.20-0.10)/(1.5493-3.103))*(1.55-3.103)\n", - "print(\"p2=0.20 MPa(approx.)\")\n", - "p2=0.20;\n", - "print(\"saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\")\n", - "t=120.23;\n", - "print(\"finally the degree of superheat(T_sup)in K\")\n", - "print(\"T_sup=T-t\")\n", - "T_sup=T-t\n", - "print(\"final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\")\n", - "h2=3276.6;\n", - "print(\"heat added during process(deltaQ)in KJ\")\n", - "print(\"deltaQ=m*(h2-h1)\")\n", - "deltaQ=m*(h2-h1)\n", - "print(\"internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\")\n", - "print(\"here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\")\n", - "uf=457.84;\n", - "ufg=2059.34;\n", - "u1=uf+x1*ufg\n", - "print(\"internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\")\n", - "print(\"u2=2966.7 KJ/kg\")\n", - "u2=2966.7;\n", - "print(\"change in internal energy(deltaU)in KJ\")\n", - "deltaU=m*(u2-u1)\n", - "print(\"deltaU=\"),round(deltaU,2)\n", - "print(\"form first law of thermodynamics,work done(deltaW)in KJ\")\n", - "deltaW=deltaQ-deltaU\n", - "print(\"deltaW=deltaQ-deltaU\"),round(deltaW,2)\n", - "print(\"so heat transfer(deltaQ)in KJ\"),round(deltaQ,2)\n", - "print(\"and work transfer(deltaW)in KJ\"),round(deltaW,2)\n", - "print(\"NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\")\n", - "print(\"and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.20;pg no: 187" - ] - }, - { - "cell_type": "code", - "execution_count": 87, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.20, Page:187 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\n", - "here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\n", - "at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\n", - "finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\n", - "h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\n", - "h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\n", - "so final temperature(T2)in K\n", - "T2= 495.43\n", - "entropy for final state(s2)in KJ/kg K\n", - "s2= 8.82\n", - "here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\n", - "so change in entropy(deltaS)in KJ/kg K\n", - "deltaS= 1.06\n", - "final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\n", - "here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\n", - "percentage of vessel volume initially occupied by steam(V)= 9.99\n" - ] - } - ], - "source": [ - "#cal of percentage of vessel volume initially occupied by steam\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.20, Page:187 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\")\n", - "print(\"here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\")\n", - "print(\"at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\")\n", - "h1_10bar_500oc=3478.5;\n", - "s1_10bar_500oc=7.7622;\n", - "v1_10bar_500oc=0.3541;\n", - "print(\"finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\")\n", - "h2=h1_10bar_500oc;\n", - "print(\"h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\")\n", - "h_1bar_400oc=3278.2;\n", - "h_1bar_500oc=3488.1;\n", - "print(\"h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\")\n", - "print(\"so final temperature(T2)in K\")\n", - "T2=400+((h2-h_1bar_400oc)*(500-400)/(h_1bar_500oc-h_1bar_400oc))\n", - "print(\"T2=\"),round(T2,2)\n", - "print(\"entropy for final state(s2)in KJ/kg K\")\n", - "s_1bar_400oc=8.5435;\n", - "s_1bar_500oc=8.8342;\n", - "s2=s_1bar_400oc+((s_1bar_500oc-s_1bar_400oc)*(495.43-400)/(500-400))\n", - "print(\"s2=\"),round(s2,2)\n", - "print(\"here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\")\n", - "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", - "deltaS=s2-s1_10bar_500oc\n", - "print(\"deltaS=\"),round(deltaS,2)\n", - "print(\"final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\")\n", - "print(\"here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\")\n", - "v_1bar_500oc=3.565;\n", - "v_1bar_400oc=3.103;\n", - "v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400))\n", - "V=v1_10bar_500oc*100/v2\n", - "print(\"percentage of vessel volume initially occupied by steam(V)=\"),round(V,2)\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter6_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter6_1.ipynb deleted file mode 100755 index 92ef2871..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter6_1.ipynb +++ /dev/null @@ -1,1390 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6:Thermo dynamic Properties of pure substance" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.1;pg no: 174" - ] - }, - { - "cell_type": "code", - "execution_count": 68, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.1, Page:174 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\n", - "NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.1, Page:174 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\")\n", - "print(\"NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.2;pg no: 175" - ] - }, - { - "cell_type": "code", - "execution_count": 69, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.2, Page:175 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\n", - "during throttling,h1=h2\n", - "at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\n", - "thus h2=2682.5 KJ/kg\n", - "at state 1,before throttling\n", - "hf_10Mpa=1407.56 KJ/kg\n", - "hfg_10Mpa=1317.1 KJ/kg\n", - "h1=hf_10Mpa+x1*hfg_10Mpa\n", - "dryness fraction(x1)may be given as\n", - "x1= 0.97\n" - ] - } - ], - "source": [ - "#cal of dryness fraction\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.2, Page:175 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\")\n", - "print(\"during throttling,h1=h2\")\n", - "print(\"at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\")\n", - "print(\"thus h2=2682.5 KJ/kg\")\n", - "h2=2682.5;\n", - "print(\"at state 1,before throttling\")\n", - "print(\"hf_10Mpa=1407.56 KJ/kg\")\n", - "hf_10Mpa=1407.56;\n", - "print(\"hfg_10Mpa=1317.1 KJ/kg\")\n", - "hfg_10Mpa=1317.1;\n", - "print(\"h1=hf_10Mpa+x1*hfg_10Mpa\")\n", - "h1=h2;#during throttling\n", - "print(\"dryness fraction(x1)may be given as\")\n", - "x1=(h1-hf_10Mpa)/hfg_10Mpa\n", - "print(\"x1=\"),round(x1,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.3;pg no: 176" - ] - }, - { - "cell_type": "code", - "execution_count": 70, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.3, Page:176 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\n", - "internal energy(u)=in KJ/kg 2644.0\n" - ] - } - ], - "source": [ - "#cal of internal energy\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.3, Page:176 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\")\n", - "h=2848;#enthalpy in KJ/kg\n", - "p=12*1000;#pressure in Kpa\n", - "v=0.017;#specific volume in m^3/kg\n", - "u=h-p*v\n", - "print(\"internal energy(u)=in KJ/kg\"),round(u,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.4;pg no: 176" - ] - }, - { - "cell_type": "code", - "execution_count": 71, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.4, Page:176 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\n", - "steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\n", - "entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\n", - "S= 6.65\n", - "entropy of 5 kg of steam(S)in KJ/K\n", - "S=m*S 33.23\n" - ] - } - ], - "source": [ - "#cal of entropy of 5 kg of steam\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "import math\n", - "print\"Example 6.4, Page:176 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\")\n", - "m=5;#mass of steam in kg\n", - "p=2;#pressure of steam in Mpa\n", - "T_superheat=(300+273.15);#temperature of superheat steam in K\n", - "Cp_water=4.18;#specific heat of water at constant pressure in KJ/kg K\n", - "Cp_superheat=2.1;#specific heat of superheat steam at constant pressure in KJ/kg K\n", - "print(\"steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\")\n", - "T_sat=(212.42+273.15);#saturation temperature at 2 Mpa in K\n", - "hfg_2Mpa=1890.7;\n", - "print(\"entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\")\n", - "S=Cp_water*math.log(T_sat/273.15)+(hfg_2Mpa/T_sat)+(Cp_superheat*math.log(T_superheat/T_sat))\n", - "print(\"S=\"),round(S,2)\n", - "print(\"entropy of 5 kg of steam(S)in KJ/K\")\n", - "S=m*S\n", - "print(\"S=m*S\"),round(S,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.5;pg no: 176" - ] - }, - { - "cell_type": "code", - "execution_count": 72, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.5, Page:176 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\n", - "boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\n", - "at further depth of 50 cm the pressure(p)in Kpa\n", - "p= 138.37\n", - "boiling point at this depth=Tsat_138.365\n", - "from steam table this temperature=108.866=108.87 degree celcius\n", - "so boiling point = 108.87 degree celcius\n" - ] - } - ], - "source": [ - "#cal of boiling point\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.5, Page:176 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\")\n", - "rho=1000;#density of water in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "h=0.50;#depth from above mentioned level in m\n", - "print(\"boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\")\n", - "p_boil=143.27;#pressure at which pond water boils in Kpa\n", - "print(\"at further depth of 50 cm the pressure(p)in Kpa\")\n", - "p=p_boil-((rho*g*h)*10**-3)\n", - "print(\"p=\"),round(p,2)\n", - "print(\"boiling point at this depth=Tsat_138.365\")\n", - "print(\"from steam table this temperature=108.866=108.87 degree celcius\")\n", - "print(\"so boiling point = 108.87 degree celcius\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.6;pg no: 177" - ] - }, - { - "cell_type": "code", - "execution_count": 73, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.6, Page:177 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\n", - "in a rigid vessel it can be treated as constant volume process.\n", - "so v1=v2\n", - "since final state is given to be critical state,then specific volume at critical point,\n", - "v2=0.003155 m^3/kg\n", - "at 100 degree celcius saturation temperature,from steam table\n", - "vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\n", - "and vfg_100=in m^3/kg= 1.67\n", - "thus for initial quality being x1\n", - "v1=vf_100+x1*vfg_100\n", - "so x1= 0.001\n", - "mass of water initially=total mass*(1-x1)\n", - "total mass of fluid/water(m) in kg= 158.48\n", - "volume of water(v) in m^3= 0.1655\n" - ] - } - ], - "source": [ - "#cal of mass and volume of water\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.6, Page:177 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\")\n", - "V=0.5;#capacity of rigid vessel in m^3\n", - "print(\"in a rigid vessel it can be treated as constant volume process.\")\n", - "print(\"so v1=v2\")\n", - "print(\"since final state is given to be critical state,then specific volume at critical point,\")\n", - "print(\"v2=0.003155 m^3/kg\")\n", - "v2=0.003155;#specific volume at critical point in m^3/kg\n", - "print(\"at 100 degree celcius saturation temperature,from steam table\")\n", - "print(\"vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\")\n", - "vf_100=0.001044;\n", - "vg_100=1.6729;\n", - "vfg_100=vg_100-vf_100\n", - "print(\"and vfg_100=in m^3/kg=\"),round(vfg_100,2)\n", - "print(\"thus for initial quality being x1\")\n", - "v1=v2;#rigid vessel\n", - "x1=(v1-vf_100)/vfg_100\n", - "print(\"v1=vf_100+x1*vfg_100\")\n", - "print(\"so x1=\"),round(x1,3)\n", - "print(\"mass of water initially=total mass*(1-x1)\")\n", - "m=V/v2\n", - "print(\"total mass of fluid/water(m) in kg=\"),round(m,2)\n", - "v=m*vf_100\n", - "print(\"volume of water(v) in m^3=\"),round(v,4)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.7;pg no: 177" - ] - }, - { - "cell_type": "code", - "execution_count": 74, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.7, Page:177 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\n", - "on mollier diadram(h-s diagram)the slope of isobaric line may be given as\n", - "(dh/ds)_p=cons =slope of isobar\n", - "from 1st and 2nd law combined;\n", - "T*ds=dh-v*dp\n", - "(dh/ds)_p=cons = T\n", - "here temperature,T=773.15 K\n", - "here slope=(dh/ds))p=cons = 773.15\n" - ] - } - ], - "source": [ - "#cal of slope\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.7, Page:177 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\")\n", - "print(\"on mollier diadram(h-s diagram)the slope of isobaric line may be given as\")\n", - "print(\"(dh/ds)_p=cons =slope of isobar\")\n", - "print(\"from 1st and 2nd law combined;\")\n", - "print(\"T*ds=dh-v*dp\")\n", - "print(\"(dh/ds)_p=cons = T\")\n", - "print(\"here temperature,T=773.15 K\")\n", - "print(\"here slope=(dh/ds))p=cons = 773.15\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.8;pg no: 178" - ] - }, - { - "cell_type": "code", - "execution_count": 75, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.8, Page:178 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\n", - "at 0.15Mpa,from steam table;\n", - "hf=467.11 KJ/kg,hg=2693.6 KJ/kg\n", - "and hfg in KJ/kg= 2226.49\n", - "vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\n", - "and vfg in m^3/kg= 1.16\n", - "sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\n", - "and sfg=in KJ/kg K= 5.79\n", - "enthalpy at x=.10(h)in KJ/kg\n", - "h= 689.76\n", - "specific volume,(v)in m^3/kg\n", - "v= 0.12\n", - "entropy (s)in KJ/kg K\n", - "s= 2.01\n" - ] - } - ], - "source": [ - "#cal of entropy\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.8, Page:178 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\")\n", - "x=.10;#quality is 10%\n", - "print(\"at 0.15Mpa,from steam table;\")\n", - "print(\"hf=467.11 KJ/kg,hg=2693.6 KJ/kg\")\n", - "hf=467.11;\n", - "hg=2693.6;\n", - "hfg=hg-hf\n", - "print(\"and hfg in KJ/kg=\"),round(hfg,2)\n", - "print(\"vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\")\n", - "vf=0.001053;\n", - "vg=1.1593;\n", - "vfg=vg-vf\n", - "print(\"and vfg in m^3/kg=\"),round(vfg,2)\n", - "print(\"sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\")\n", - "sf=1.4336;\n", - "sg=7.2233;\n", - "sfg=sg-sf\n", - "print(\"and sfg=in KJ/kg K=\"),round(sfg,2)\n", - "print(\"enthalpy at x=.10(h)in KJ/kg\")\n", - "h=hf+x*hfg\n", - "print(\"h=\"),round(h,2)\n", - "print(\"specific volume,(v)in m^3/kg\")\n", - "v=vf+x*vfg\n", - "print(\"v=\"),round(v,2)\n", - "print(\"entropy (s)in KJ/kg K\")\n", - "s=sf+x*sfg\n", - "print(\"s=\"),round(s,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.9;pg no: 178" - ] - }, - { - "cell_type": "code", - "execution_count": 76, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.9, Page:178 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\n", - "work done during constant pressure process(W)=p1*(V2-V1)in KJ\n", - "now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\n", - "so v1 in m^3/kg=\n", - "now mass of steam(m) in kg= 0.32\n", - "specific volume at final state(v2)in m^3/kg\n", - "v2= 0.62\n", - "corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\n", - "v2>vg_1Mpa\n", - "hence state lies in superheated region,from the steam table by interpolation we get temperature as;\n", - "state lies between temperature of 1000 degree celcius and 1100 degree celcius\n", - "so exact temperature at final state(T)in K= 1077.61\n", - "thus internal energy at final state,1 Mpa,1077.61 degree celcius;\n", - "u2=4209.6 KJ/kg\n", - "internal energy at initial state(u1)in KJ/kg\n", - "u1= 2219.28\n", - "from first law of thermodynamics,Q-W=deltaU\n", - "so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ= 788.83\n" - ] - } - ], - "source": [ - "#cal of heat added\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.9, Page:178 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\")\n", - "p1=1*1000;#initial pressure of steam in Kpa\n", - "V1=0.05;#initial volume of steam in m^3\n", - "x1=.8;#dryness fraction is 80%\n", - "V2=0.2;#final volume of steam in m^3\n", - "p2=p1;#constant pressure process\n", - "print(\"work done during constant pressure process(W)=p1*(V2-V1)in KJ\")\n", - "W=p1*(V2-V1)\n", - "print(\"now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\")\n", - "vf=0.001127;\n", - "vg=0.19444;\n", - "uf=761.68;\n", - "ufg=1822;\n", - "v1=vf+x1*vg\n", - "print(\"so v1 in m^3/kg=\")\n", - "m=V1/v1\n", - "print(\"now mass of steam(m) in kg=\"),round(m,2)\n", - "m=0.32097;#take m=0.32097 approx.\n", - "print(\"specific volume at final state(v2)in m^3/kg\")\n", - "v2=V2/m\n", - "print(\"v2=\"),round(v2,2)\n", - "print(\"corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\")\n", - "print(\"v2>vg_1Mpa\")\n", - "print(\"hence state lies in superheated region,from the steam table by interpolation we get temperature as;\")\n", - "print(\"state lies between temperature of 1000 degree celcius and 1100 degree celcius\")\n", - "T=1000+((100*(.62311-.5871))/(.6335-.5871))\n", - "print(\"so exact temperature at final state(T)in K=\"),round(T,2)\n", - "print(\"thus internal energy at final state,1 Mpa,1077.61 degree celcius;\")\n", - "print(\"u2=4209.6 KJ/kg\")\n", - "u2=4209.6;\n", - "print(\"internal energy at initial state(u1)in KJ/kg\")\n", - "u1=uf+x1*ufg\n", - "print(\"u1=\"),round(u1,2)\n", - "print(\"from first law of thermodynamics,Q-W=deltaU\")\n", - "Q=m*(u2-u1)+W\n", - "print(\"so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ=\"),round(Q,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.10;pg no: 179" - ] - }, - { - "cell_type": "code", - "execution_count": 77, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.10, Page:179 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\n", - "here steam is kept in rigid vessel,therefore its specific volume shall remain constant\n", - "it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\n", - "from superheated steam table;v1=0.2404 m^3/kg\n", - "at begining of condensation specific volume = 0.2404 m^3/kg\n", - "v2=0.2404 m^3/kg\n", - "this v2 shall be specific volume corresponding to saturated vapour state for condensation.\n", - "thus v2=vg=0.2404 m^3/kg\n", - "looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\n", - "by interpolation,temperature at begining of condensation(T2)in K\n", - "similarily,pressure(p2)in Kpa= 800.96\n" - ] - } - ], - "source": [ - "#cal of pressure\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.10, Page:179 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\")\n", - "p1=800;#initial pressure of steam in Kpa\n", - "T1=200;#initial temperature of steam in degree celcius\n", - "print(\"here steam is kept in rigid vessel,therefore its specific volume shall remain constant\")\n", - "print(\"it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\")\n", - "print(\"from superheated steam table;v1=0.2404 m^3/kg\")\n", - "print(\"at begining of condensation specific volume = 0.2404 m^3/kg\")\n", - "print(\"v2=0.2404 m^3/kg\")\n", - "v2=0.2404;\n", - "print(\"this v2 shall be specific volume corresponding to saturated vapour state for condensation.\")\n", - "print(\"thus v2=vg=0.2404 m^3/kg\")\n", - "vg=v2;\n", - "print(\"looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\")\n", - "print(\"by interpolation,temperature at begining of condensation(T2)in K\")\n", - "T2=175-((175-170)*(0.2404-0.2167))/(0.2428-.2168)\n", - "p=892-(((892-791.7)*(0.2404-0.2168))/(0.2428-0.2168))\n", - "print(\"similarily,pressure(p2)in Kpa=\"),round(p,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.11;pg no: 180" - ] - }, - { - "cell_type": "code", - "execution_count": 78, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.11, Page:180 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\n", - "from 1st and 2nd law;\n", - "T*ds=dh-v*dp\n", - "for isentropic process,ds=0\n", - "hence dh=v*dp\n", - "i.e (h2-h1)=v1*(p2-p1)\n", - "corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\n", - "p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\n", - "therefore enthalpy change(deltah)=(h2-h1) in KJ/kg= 0.2\n" - ] - } - ], - "source": [ - "#cal of enthalpy change\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.11, Page:180 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\")\n", - "p2=200;#feed water pump pressure in Kpa\n", - "print(\"from 1st and 2nd law;\")\n", - "print(\"T*ds=dh-v*dp\")\n", - "print(\"for isentropic process,ds=0\")\n", - "print(\"hence dh=v*dp\")\n", - "print(\"i.e (h2-h1)=v1*(p2-p1)\")\n", - "print(\"corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\")\n", - "print(\"p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\")\n", - "p1=4.25;\n", - "v1=0.001004;\n", - "deltah=v1*(p2-p1)\n", - "print(\"therefore enthalpy change(deltah)=(h2-h1) in KJ/kg=\"),round(deltah,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.12;pg no: 180" - ] - }, - { - "cell_type": "code", - "execution_count": 79, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.12, Page:180 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\n", - "from steam table at 150 degree celcius\n", - "vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\n", - "so volume occupied by water(Vw)=3*V/(3+2) in m^3 1.2\n", - "and volume of steam(Vs) in m^3= 0.8\n", - "mass of water(mf)=Vw/Vf in kg 1099.91\n", - "mass of steam(mg)=Vs/Vg in kg 2.04\n", - "total mass in tank(m) in kg= 1101.95\n", - "quality or dryness fraction(x)\n", - "x= 0.002\n", - "NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\n" - ] - } - ], - "source": [ - "#cal of quality or dryness fraction\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.12, Page:180 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\")\n", - "V=2.;#volume of vessel in m^3\n", - "print(\"from steam table at 150 degree celcius\")\n", - "print(\"vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\")\n", - "Vf=0.001091;\n", - "Vg=0.3928;\n", - "Vw=3*V/(3+2)\n", - "print(\"so volume occupied by water(Vw)=3*V/(3+2) in m^3\"),round(Vw,2)\n", - "Vs=2*V/(3+2)\n", - "print(\"and volume of steam(Vs) in m^3=\"),round(Vs,2)\n", - "mf=Vw/Vf\n", - "print(\"mass of water(mf)=Vw/Vf in kg\"),round(mf,2)\n", - "mg=Vs/Vg\n", - "print(\"mass of steam(mg)=Vs/Vg in kg\"),round(mg,2)\n", - "m=mf+mg\n", - "print(\"total mass in tank(m) in kg=\"),round(m,2)\n", - "print(\"quality or dryness fraction(x)\")\n", - "x=mg/m\n", - "print(\"x=\"),round(x,3)\n", - "print(\"NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.13;pg no: 181" - ] - }, - { - "cell_type": "code", - "execution_count": 80, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.13, Page:181 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\n", - "fron S.F.S.E on steam turbine;\n", - "W=h1-h2\n", - "initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\n", - "h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\n", - "reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\n", - "else from steam tables at 50 degree celcius saturation temperature;\n", - "hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\n", - "hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\n", - "here s1=s2,let dryness fraction at 2 be x2\n", - "x2= 0.75\n", - "hence enthalpy at state 2\n", - "h2 in KJ/kg= 1994.84\n", - "steam turbine work(W)in KJ/kg\n", - "W=h1-h2\n", - "so turbine output=W 891.36\n" - ] - } - ], - "source": [ - "#cal of turbine output\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.13, Page:181 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\")\n", - "print(\"fron S.F.S.E on steam turbine;\")\n", - "print(\"W=h1-h2\")\n", - "print(\"initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\")\n", - "print(\"h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\")\n", - "h1=2886.2;\n", - "s1=6.2285;\n", - "print(\"reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\")\n", - "print(\"else from steam tables at 50 degree celcius saturation temperature;\")\n", - "print(\"hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\")\n", - "hf=209.33;\n", - "sf=0.7038;\n", - "print(\"hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\")\n", - "hfg=2382.7;\n", - "sfg=7.3725;\n", - "print(\"here s1=s2,let dryness fraction at 2 be x2\")\n", - "x2=(s1-sf)/sfg\n", - "print(\"x2=\"),round(x2,2)\n", - "print(\"hence enthalpy at state 2\")\n", - "h2=hf+x2*hfg\n", - "print(\"h2 in KJ/kg=\"),round(h2,2)\n", - "print(\"steam turbine work(W)in KJ/kg\")\n", - "W=h1-h2\n", - "print(\"W=h1-h2\")\n", - "print(\"so turbine output=W\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.14;pg no: 181" - ] - }, - { - "cell_type": "code", - "execution_count": 81, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.14, Page:181 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\n", - "it is constant volume process\n", - "volume of vessel(V)=mass of vapour * specific volume of vapour\n", - "initial specific volume,v1\n", - "v1=vf_100Kpa+x1*vfg_100 in m^3/kg\n", - "at 100 Kpa from steam table;\n", - "hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\n", - " here vfg_100Kpa= in m^3/kg= 1.69\n", - "so v1= in m^3/kg= 0.85\n", - "and volume of vessel(V) in m^3= 42.38\n", - "enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg 1546.46\n", - "internal energy in the beginning=U1=m1*u1 in KJ 146171.0\n", - "let the mass of dry steam added be m,final specific volume inside vessel,v2\n", - "v2=vf_1000Kpa+x2*vfg_1000Kpa\n", - "at 2000 Kpa,from steam table,\n", - "vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\n", - "total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\n", - "V/v2=V/vg_2000Kpa+V/v1\n", - "so v2 in m^3/kg= 0.09\n", - "here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\n", - "at 1000 Kpa from steam table,\n", - "hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\n", - "here vfg_1000Kpa= in m^3/kg= 0.19\n", - "so x2= 0.46\n", - "for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\n", - "so mass of dry steam at 2000 Kpa to be added(m)in kg\n", - "m=(100*(h1-h2))/(h2-hg_2000Kpa)= 11.97\n", - "quality of final mixture x2= 0.46\n" - ] - } - ], - "source": [ - "#cal of quality of final mixture\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.14, Page:181 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\")\n", - "x1=0.5;#dryness fraction \n", - "m1=100;#mass of steam in kg\n", - "v1=0.8475;#\n", - "print(\"it is constant volume process\")\n", - "print(\"volume of vessel(V)=mass of vapour * specific volume of vapour\")\n", - "print(\"initial specific volume,v1\")\n", - "print(\"v1=vf_100Kpa+x1*vfg_100 in m^3/kg\")\n", - "print(\"at 100 Kpa from steam table;\")\n", - "print(\"hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\")\n", - "hf_100Kpa=417.46;\n", - "uf_100Kpa=417.36;\n", - "vf_100Kpa=0.001043;\n", - "hfg_100Kpa=2258;\n", - "ufg_100Kpa=2088.7;\n", - "vg_100Kpa=1.6940;\n", - "vfg_100Kpa=vg_100Kpa-vf_100Kpa\n", - "print(\" here vfg_100Kpa= in m^3/kg=\"),round(vfg_100Kpa,2)\n", - "v1=vf_100Kpa+x1*vfg_100Kpa\n", - "print(\"so v1= in m^3/kg=\"),round(v1,2)\n", - "V=m1*x1*v1\n", - "print(\"and volume of vessel(V) in m^3=\"),round(V,2)\n", - "h1=hf_100Kpa+x1*hfg_100Kpa\n", - "print(\"enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg\"),round(h1,2)\n", - "U1=m1*(uf_100Kpa+x1*ufg_100Kpa)\n", - "print(\"internal energy in the beginning=U1=m1*u1 in KJ\"),round(U1,2)\n", - "print(\"let the mass of dry steam added be m,final specific volume inside vessel,v2\")\n", - "print(\"v2=vf_1000Kpa+x2*vfg_1000Kpa\")\n", - "print(\"at 2000 Kpa,from steam table,\")\n", - "print(\"vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\")\n", - "vg_2000Kpa=0.09963;\n", - "ug_2000Kpa=2600.3;\n", - "hg_2000Kpa=2799.5;\n", - "print(\"total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\")\n", - "print(\"V/v2=V/vg_2000Kpa+V/v1\")\n", - "v2=1/((1/vg_2000Kpa)+(1/v1))\n", - "print(\"so v2 in m^3/kg=\"),round(v2,2)\n", - "print(\"here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\")\n", - "print(\"at 1000 Kpa from steam table,\")\n", - "print(\"hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\")\n", - "hf_1000Kpa=762.81;\n", - "hfg_1000Kpa=2015.3;\n", - "vf_1000Kpa=0.001127;\n", - "vg_1000Kpa=0.19444;\n", - "vfg_1000Kpa=vg_1000Kpa-vf_1000Kpa\n", - "print(\"here vfg_1000Kpa= in m^3/kg=\"),round(vfg_1000Kpa,2)\n", - "x2=(v2-vf_1000Kpa)/vfg_1000Kpa\n", - "print(\"so x2=\"),round(x2,2)\n", - "print(\"for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\")\n", - "print(\"so mass of dry steam at 2000 Kpa to be added(m)in kg\")\n", - "m=(100*(h1-(hf_1000Kpa+x2*hfg_1000Kpa)))/((hf_1000Kpa+x2*hfg_1000Kpa)-hg_2000Kpa)\n", - "print(\"m=(100*(h1-h2))/(h2-hg_2000Kpa)=\"),round(m,2)\n", - "print(\"quality of final mixture x2=\"),round(x2,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.15;pg no: 183" - ] - }, - { - "cell_type": "code", - "execution_count": 82, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.15, Page:183 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\n", - "from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\n", - "condenser pressure(p_condenser) in Kpa= 7.3\n", - "partial pressure of steam corresponding to35 degree celcius from steam table;\n", - "p_steam=5.628 Kpa\n", - "enthalpy corresponding to 35 degree celcius from steam table,\n", - "hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\n", - "let quality of steam entering be x\n", - "from energy balance;\n", - "mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\n", - "so dryness fraction of steam entering(x)is given as\n", - "x= 0.97\n" - ] - } - ], - "source": [ - "#cal of dryness fraction of steam entering\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.15, Page:183 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\")\n", - "p_vaccum=71.5;#recorded condenser vaccum in cm of mercury\n", - "p_barometer=76.8;#barometer reading in cm of mercury\n", - "T_cond=35;#temperature of condensation in degree celcius\n", - "T_hotwell=27.6;#temperature of hot well in degree celcius\n", - "m_cond=1930;#mass of condensate per hour\n", - "m_w=62000;#mass of cooling water per hour\n", - "Ti=8.51;#initial temperature in degree celcius\n", - "To=26.24;#outlet temperature in degree celcius\n", - "print(\"from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\")\n", - "p_condenser=(p_barometer-p_vaccum)*101.325/73.55\n", - "print(\"condenser pressure(p_condenser) in Kpa=\"),round(p_condenser,2)\n", - "print(\"partial pressure of steam corresponding to35 degree celcius from steam table;\")\n", - "print(\"p_steam=5.628 Kpa\")\n", - "p_steam=5.628;#partial pressure of steam\n", - "print(\"enthalpy corresponding to 35 degree celcius from steam table,\")\n", - "print(\"hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\")\n", - "hf=146.68;\n", - "hfg=2418.6;\n", - "print(\"let quality of steam entering be x\")\n", - "print(\"from energy balance;\")\n", - "print(\"mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\")\n", - "print(\"so dryness fraction of steam entering(x)is given as\")\n", - "x=(((m_w*(To-Ti)*4.18)/m_cond)-hf+4.18*T_hotwell)/hfg\n", - "print(\"x=\"),round(x,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.16;pg no: 184" - ] - }, - { - "cell_type": "code", - "execution_count": 83, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.16, Page:184 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\n", - "heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\n", - "area(A) in m^2= 0.03\n", - "so p1=in Kpa= 419.61\n", - "now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\n", - "volume of water contained(V1) in m^3= 0.001\n", - "mass of water(m) in kg= 0.63\n", - "heat supplied shall cause sensible heating and latent heating\n", - "hence,enthalpy change=heat supplied\n", - "Q=((hf+x*hfg)-(4.18*T)*m)\n", - "so dryness fraction of steam produced(x)can be calculated as\n", - "so x= 0.46\n", - "internal energy of water(U1)in KJ,initially\n", - "U1= 393.69\n", - "finally,internal energy of wet steam(U2)in KJ\n", - "U2=m*h2-p2*V2\n", - "here V2 in m^3= 0.13\n", - "hence U2= 940.68\n", - "hence change in internal energy(U) in KJ= 547.21\n", - "work done(W) in KJ= 53.01\n" - ] - } - ], - "source": [ - "#cal of change in internal energy and work done\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "import math\n", - "print\"Example 6.16, Page:184 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\")\n", - "F=10;#force applied externally upon piston in KN\n", - "d=.2;#diameter in m\n", - "h=0.02;#depth to which water filled in m \n", - "P_atm=101.3;#atmospheric pressure in Kpa\n", - "rho=1000;#density of water in kg/m^3\n", - "Q=600;#heat supplied to water in KJ\n", - "T=150;#temperature of water in degree celcius\n", - "print(\"heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\")\n", - "A=math.pi*d**2/4\n", - "print(\"area(A) in m^2=\"),round(A,2)\n", - "p1=F/A+P_atm\n", - "print(\"so p1=in Kpa=\"),round(p1,2)\n", - "print(\"now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\")\n", - "hf=612.1;\n", - "hfg=2128.7;\n", - "vg=0.4435;\n", - "V1=math.pi*d**2*h/4\n", - "print(\"volume of water contained(V1) in m^3=\"),round(V1,3)\n", - "m=V1*rho\n", - "print(\"mass of water(m) in kg=\"),round(m,2)\n", - "print(\"heat supplied shall cause sensible heating and latent heating\")\n", - "print(\"hence,enthalpy change=heat supplied\")\n", - "print(\"Q=((hf+x*hfg)-(4.18*T)*m)\")\n", - "print(\"so dryness fraction of steam produced(x)can be calculated as\")\n", - "x=((Q/m)+4.18*T-hf)/hfg\n", - "print(\"so x=\"),round(x,2)\n", - "print(\"internal energy of water(U1)in KJ,initially\")\n", - "h1=4.18*T;#enthalpy of water in KJ/kg\n", - "U1=m*h1-p1*V1\n", - "print(\"U1=\"),round(U1,2)\n", - "U1=393.5;#approx.\n", - "print(\"finally,internal energy of wet steam(U2)in KJ\")\n", - "print(\"U2=m*h2-p2*V2\")\n", - "V2=m*x*vg\n", - "print(\"here V2 in m^3=\"),round(V2,2)\n", - "p2=p1;#constant pressure process\n", - "U2=(m*(hf+x*hfg))-p2*V2\n", - "print(\"hence U2=\"),round(U2,2)\n", - "U2=940.71;#approx.\n", - "U=U2-U1\n", - "print(\"hence change in internal energy(U) in KJ=\"),round(U,2)\n", - "p=p1;\n", - "W=p*(V2-V1)\n", - "print(\"work done(W) in KJ=\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.17;pg no: 185" - ] - }, - { - "cell_type": "code", - "execution_count": 84, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.17, Page:185 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\n", - "consider throttling calorimeter alone,\n", - "degree of superheat(T_sup)in degree celcius\n", - "T_sup= 18.2\n", - "enthalpy of superheated steam(h_sup)in KJ/kg\n", - "h_sup= 2711.99\n", - "at 120 degree celcius,h=2673.95 KJ/kg from steam table\n", - "now enthalpy before throttling = enthalpy after throttling\n", - "hf+x2*hfg=h_sup\n", - "here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\n", - "so x2= 0.96\n", - "for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\n", - "overall dryness fraction(x)= 0.91\n" - ] - } - ], - "source": [ - "#cal of overall dryness fraction\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.17, Page:185 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\")\n", - "ms=40;#mass of steam in kg\n", - "mw=2.2;#mass of water in kg\n", - "p1=1.47;#pressure before throttling in Mpa\n", - "T2=120;#temperature after throttling in degree celcius\n", - "p2=107.88;#pressure after throttling in Kpa\n", - "Cp_sup=2.09;#specific heat of superheated steam in KJ/kg K\n", - "print(\"consider throttling calorimeter alone,\")\n", - "print(\"degree of superheat(T_sup)in degree celcius\")\n", - "T_sup=T2-101.8\n", - "print(\"T_sup=\"),round(T_sup,2)\n", - "print(\"enthalpy of superheated steam(h_sup)in KJ/kg\")\n", - "h=2673.95;\n", - "h_sup=h+T_sup*Cp_sup\n", - "print(\"h_sup=\"),round(h_sup,2)\n", - "print(\"at 120 degree celcius,h=2673.95 KJ/kg from steam table\")\n", - "print(\"now enthalpy before throttling = enthalpy after throttling\")\n", - "print(\"hf+x2*hfg=h_sup\")\n", - "print(\"here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\")\n", - "hf=840.513;\n", - "hfg=1951.02;\n", - "x2=(h_sup-hf)/hfg\n", - "print(\"so x2=\"),round(x2,2)\n", - "print(\"for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\")\n", - "x1=(ms-mw)/ms\n", - "x=x1*x2\n", - "print(\"overall dryness fraction(x)=\"),round(x,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.18;pg no: 185" - ] - }, - { - "cell_type": "code", - "execution_count": 85, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.18, Page:185 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\n", - "here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\n", - "final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\n", - "Q in KJ= 200.0\n", - "final enthalpy of dry steam at 15 bar,h2=hg_15bar\n", - "h2=2792.2 KJ/kg from steam table\n", - "let initial dryness fraction be x1,initial enthalpy,\n", - "h1=hf_10bar+x1*hfg_10bar.........eq1\n", - "here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\n", - "also heat balance yields,\n", - "h1+Q=h2\n", - "so h1=h2-Q in KJ/kg\n", - "so by eq 1=>x1= 0.91\n", - "heat added(Q)in KJ= 200.0\n", - "and initial quality(x1) 0.91\n" - ] - } - ], - "source": [ - "#cal of heat added and initial quality\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.18, Page:185 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\")\n", - "v=0.4;#volume of air in part A and part B in m^3\n", - "p1=10*10**5;#initial pressure of steam in pa\n", - "p2=15*10**5;#final pressure of steam in pa\n", - "print(\"here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\")\n", - "print(\"final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\")\n", - "Q=v*(p2-p1)/1000\n", - "print(\"Q in KJ=\"),round(Q,2)\n", - "print(\"final enthalpy of dry steam at 15 bar,h2=hg_15bar\")\n", - "print(\"h2=2792.2 KJ/kg from steam table\")\n", - "h2=2792.2;\n", - "print(\"let initial dryness fraction be x1,initial enthalpy,\")\n", - "print(\"h1=hf_10bar+x1*hfg_10bar.........eq1\")\n", - "print(\"here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\")\n", - "hf_10bar=762.83;\n", - "hfg_10bar=2015.3;\n", - "print(\"also heat balance yields,\")\n", - "print(\"h1+Q=h2\")\n", - "print(\"so h1=h2-Q in KJ/kg\")\n", - "h1=h2-Q\n", - "x1=(h1-hf_10bar)/hfg_10bar\n", - "print(\"so by eq 1=>x1=\"),round(x1,2)\n", - "print(\"heat added(Q)in KJ=\"),round(Q,2)\n", - "print(\"and initial quality(x1)\"),round(x1,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.19;pg no: 186" - ] - }, - { - "cell_type": "code", - "execution_count": 86, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.19, Page:186 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\n", - "from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\n", - "specific volume of wet steam in cylinder,v1 in m^3/kg= 0.75\n", - "dryness fraction of initial steam(x1)= 0.6\n", - "initial enthalpy of wet steam,h1 in KJ/kg= 1801.83\n", - "at 400 degree celcius specific volume of steam,v2 in m^3/kg= 1.55\n", - "for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\n", - "actual pressure can be obtained by interpolation\n", - "p2=0.20 MPa(approx.)\n", - "saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\n", - "finally the degree of superheat(T_sup)in K\n", - "T_sup=T-t\n", - "final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\n", - "heat added during process(deltaQ)in KJ\n", - "deltaQ=m*(h2-h1)\n", - "internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\n", - "here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\n", - "internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\n", - "u2=2966.7 KJ/kg\n", - "change in internal energy(deltaU)in KJ\n", - "deltaU= 3807.41\n", - "form first law of thermodynamics,work done(deltaW)in KJ\n", - "deltaW=deltaQ-deltaU 616.88\n", - "so heat transfer(deltaQ)in KJ 4424.3\n", - "and work transfer(deltaW)in KJ 616.88\n", - "NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\n", - "and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\n" - ] - } - ], - "source": [ - "#cal of heat and work transfer \n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.19, Page:186 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\")\n", - "m=3;#mass of wet steam in kg\n", - "p=1.4;#pressure of wet steam in bar\n", - "V1=2.25;#initial volume in m^3\n", - "V2=4.65;#final volume in m^3\n", - "T=400;#temperature of steam in degreee celcius\n", - "print(\"from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\")\n", - "vg=1.2455;\n", - "hf=457.99;\n", - "hfg=2232.3;\n", - "v1=V1/m\n", - "print(\"specific volume of wet steam in cylinder,v1 in m^3/kg=\"),round(v1,2)\n", - "x1=v1/vg\n", - "print(\"dryness fraction of initial steam(x1)=\"),round(x1,2)\n", - "x1=0.602;#approx.\n", - "h1=hf+x1*hfg\n", - "print(\"initial enthalpy of wet steam,h1 in KJ/kg=\"),round(h1,2)\n", - "v2=V2/m\n", - "print(\"at 400 degree celcius specific volume of steam,v2 in m^3/kg=\"),round(v2,2)\n", - "print(\"for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\")\n", - "print(\"actual pressure can be obtained by interpolation\")\n", - "p2=.1+((0.20-0.10)/(1.5493-3.103))*(1.55-3.103)\n", - "print(\"p2=0.20 MPa(approx.)\")\n", - "p2=0.20;\n", - "print(\"saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\")\n", - "t=120.23;\n", - "print(\"finally the degree of superheat(T_sup)in K\")\n", - "print(\"T_sup=T-t\")\n", - "T_sup=T-t\n", - "print(\"final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\")\n", - "h2=3276.6;\n", - "print(\"heat added during process(deltaQ)in KJ\")\n", - "print(\"deltaQ=m*(h2-h1)\")\n", - "deltaQ=m*(h2-h1)\n", - "print(\"internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\")\n", - "print(\"here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\")\n", - "uf=457.84;\n", - "ufg=2059.34;\n", - "u1=uf+x1*ufg\n", - "print(\"internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\")\n", - "print(\"u2=2966.7 KJ/kg\")\n", - "u2=2966.7;\n", - "print(\"change in internal energy(deltaU)in KJ\")\n", - "deltaU=m*(u2-u1)\n", - "print(\"deltaU=\"),round(deltaU,2)\n", - "print(\"form first law of thermodynamics,work done(deltaW)in KJ\")\n", - "deltaW=deltaQ-deltaU\n", - "print(\"deltaW=deltaQ-deltaU\"),round(deltaW,2)\n", - "print(\"so heat transfer(deltaQ)in KJ\"),round(deltaQ,2)\n", - "print(\"and work transfer(deltaW)in KJ\"),round(deltaW,2)\n", - "print(\"NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\")\n", - "print(\"and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.20;pg no: 187" - ] - }, - { - "cell_type": "code", - "execution_count": 87, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.20, Page:187 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\n", - "here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\n", - "at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\n", - "finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\n", - "h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\n", - "h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\n", - "so final temperature(T2)in K\n", - "T2= 495.43\n", - "entropy for final state(s2)in KJ/kg K\n", - "s2= 8.82\n", - "here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\n", - "so change in entropy(deltaS)in KJ/kg K\n", - "deltaS= 1.06\n", - "final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\n", - "here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\n", - "percentage of vessel volume initially occupied by steam(V)= 9.99\n" - ] - } - ], - "source": [ - "#cal of percentage of vessel volume initially occupied by steam\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.20, Page:187 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\")\n", - "print(\"here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\")\n", - "print(\"at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\")\n", - "h1_10bar_500oc=3478.5;\n", - "s1_10bar_500oc=7.7622;\n", - "v1_10bar_500oc=0.3541;\n", - "print(\"finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\")\n", - "h2=h1_10bar_500oc;\n", - "print(\"h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\")\n", - "h_1bar_400oc=3278.2;\n", - "h_1bar_500oc=3488.1;\n", - "print(\"h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\")\n", - "print(\"so final temperature(T2)in K\")\n", - "T2=400+((h2-h_1bar_400oc)*(500-400)/(h_1bar_500oc-h_1bar_400oc))\n", - "print(\"T2=\"),round(T2,2)\n", - "print(\"entropy for final state(s2)in KJ/kg K\")\n", - "s_1bar_400oc=8.5435;\n", - "s_1bar_500oc=8.8342;\n", - "s2=s_1bar_400oc+((s_1bar_500oc-s_1bar_400oc)*(495.43-400)/(500-400))\n", - "print(\"s2=\"),round(s2,2)\n", - "print(\"here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\")\n", - "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", - "deltaS=s2-s1_10bar_500oc\n", - "print(\"deltaS=\"),round(deltaS,2)\n", - "print(\"final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\")\n", - "print(\"here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\")\n", - "v_1bar_500oc=3.565;\n", - "v_1bar_400oc=3.103;\n", - "v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400))\n", - "V=v1_10bar_500oc*100/v2\n", - "print(\"percentage of vessel volume initially occupied by steam(V)=\"),round(V,2)\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter6_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter6_2.ipynb deleted file mode 100755 index 92ef2871..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter6_2.ipynb +++ /dev/null @@ -1,1390 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6:Thermo dynamic Properties of pure substance" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.1;pg no: 174" - ] - }, - { - "cell_type": "code", - "execution_count": 68, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.1, Page:174 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\n", - "NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.1, Page:174 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\")\n", - "print(\"NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.2;pg no: 175" - ] - }, - { - "cell_type": "code", - "execution_count": 69, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.2, Page:175 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\n", - "during throttling,h1=h2\n", - "at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\n", - "thus h2=2682.5 KJ/kg\n", - "at state 1,before throttling\n", - "hf_10Mpa=1407.56 KJ/kg\n", - "hfg_10Mpa=1317.1 KJ/kg\n", - "h1=hf_10Mpa+x1*hfg_10Mpa\n", - "dryness fraction(x1)may be given as\n", - "x1= 0.97\n" - ] - } - ], - "source": [ - "#cal of dryness fraction\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.2, Page:175 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\")\n", - "print(\"during throttling,h1=h2\")\n", - "print(\"at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\")\n", - "print(\"thus h2=2682.5 KJ/kg\")\n", - "h2=2682.5;\n", - "print(\"at state 1,before throttling\")\n", - "print(\"hf_10Mpa=1407.56 KJ/kg\")\n", - "hf_10Mpa=1407.56;\n", - "print(\"hfg_10Mpa=1317.1 KJ/kg\")\n", - "hfg_10Mpa=1317.1;\n", - "print(\"h1=hf_10Mpa+x1*hfg_10Mpa\")\n", - "h1=h2;#during throttling\n", - "print(\"dryness fraction(x1)may be given as\")\n", - "x1=(h1-hf_10Mpa)/hfg_10Mpa\n", - "print(\"x1=\"),round(x1,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.3;pg no: 176" - ] - }, - { - "cell_type": "code", - "execution_count": 70, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.3, Page:176 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\n", - "internal energy(u)=in KJ/kg 2644.0\n" - ] - } - ], - "source": [ - "#cal of internal energy\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.3, Page:176 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\")\n", - "h=2848;#enthalpy in KJ/kg\n", - "p=12*1000;#pressure in Kpa\n", - "v=0.017;#specific volume in m^3/kg\n", - "u=h-p*v\n", - "print(\"internal energy(u)=in KJ/kg\"),round(u,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.4;pg no: 176" - ] - }, - { - "cell_type": "code", - "execution_count": 71, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.4, Page:176 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\n", - "steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\n", - "entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\n", - "S= 6.65\n", - "entropy of 5 kg of steam(S)in KJ/K\n", - "S=m*S 33.23\n" - ] - } - ], - "source": [ - "#cal of entropy of 5 kg of steam\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "import math\n", - "print\"Example 6.4, Page:176 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\")\n", - "m=5;#mass of steam in kg\n", - "p=2;#pressure of steam in Mpa\n", - "T_superheat=(300+273.15);#temperature of superheat steam in K\n", - "Cp_water=4.18;#specific heat of water at constant pressure in KJ/kg K\n", - "Cp_superheat=2.1;#specific heat of superheat steam at constant pressure in KJ/kg K\n", - "print(\"steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\")\n", - "T_sat=(212.42+273.15);#saturation temperature at 2 Mpa in K\n", - "hfg_2Mpa=1890.7;\n", - "print(\"entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\")\n", - "S=Cp_water*math.log(T_sat/273.15)+(hfg_2Mpa/T_sat)+(Cp_superheat*math.log(T_superheat/T_sat))\n", - "print(\"S=\"),round(S,2)\n", - "print(\"entropy of 5 kg of steam(S)in KJ/K\")\n", - "S=m*S\n", - "print(\"S=m*S\"),round(S,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.5;pg no: 176" - ] - }, - { - "cell_type": "code", - "execution_count": 72, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.5, Page:176 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\n", - "boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\n", - "at further depth of 50 cm the pressure(p)in Kpa\n", - "p= 138.37\n", - "boiling point at this depth=Tsat_138.365\n", - "from steam table this temperature=108.866=108.87 degree celcius\n", - "so boiling point = 108.87 degree celcius\n" - ] - } - ], - "source": [ - "#cal of boiling point\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.5, Page:176 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\")\n", - "rho=1000;#density of water in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "h=0.50;#depth from above mentioned level in m\n", - "print(\"boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\")\n", - "p_boil=143.27;#pressure at which pond water boils in Kpa\n", - "print(\"at further depth of 50 cm the pressure(p)in Kpa\")\n", - "p=p_boil-((rho*g*h)*10**-3)\n", - "print(\"p=\"),round(p,2)\n", - "print(\"boiling point at this depth=Tsat_138.365\")\n", - "print(\"from steam table this temperature=108.866=108.87 degree celcius\")\n", - "print(\"so boiling point = 108.87 degree celcius\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.6;pg no: 177" - ] - }, - { - "cell_type": "code", - "execution_count": 73, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.6, Page:177 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\n", - "in a rigid vessel it can be treated as constant volume process.\n", - "so v1=v2\n", - "since final state is given to be critical state,then specific volume at critical point,\n", - "v2=0.003155 m^3/kg\n", - "at 100 degree celcius saturation temperature,from steam table\n", - "vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\n", - "and vfg_100=in m^3/kg= 1.67\n", - "thus for initial quality being x1\n", - "v1=vf_100+x1*vfg_100\n", - "so x1= 0.001\n", - "mass of water initially=total mass*(1-x1)\n", - "total mass of fluid/water(m) in kg= 158.48\n", - "volume of water(v) in m^3= 0.1655\n" - ] - } - ], - "source": [ - "#cal of mass and volume of water\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.6, Page:177 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\")\n", - "V=0.5;#capacity of rigid vessel in m^3\n", - "print(\"in a rigid vessel it can be treated as constant volume process.\")\n", - "print(\"so v1=v2\")\n", - "print(\"since final state is given to be critical state,then specific volume at critical point,\")\n", - "print(\"v2=0.003155 m^3/kg\")\n", - "v2=0.003155;#specific volume at critical point in m^3/kg\n", - "print(\"at 100 degree celcius saturation temperature,from steam table\")\n", - "print(\"vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\")\n", - "vf_100=0.001044;\n", - "vg_100=1.6729;\n", - "vfg_100=vg_100-vf_100\n", - "print(\"and vfg_100=in m^3/kg=\"),round(vfg_100,2)\n", - "print(\"thus for initial quality being x1\")\n", - "v1=v2;#rigid vessel\n", - "x1=(v1-vf_100)/vfg_100\n", - "print(\"v1=vf_100+x1*vfg_100\")\n", - "print(\"so x1=\"),round(x1,3)\n", - "print(\"mass of water initially=total mass*(1-x1)\")\n", - "m=V/v2\n", - "print(\"total mass of fluid/water(m) in kg=\"),round(m,2)\n", - "v=m*vf_100\n", - "print(\"volume of water(v) in m^3=\"),round(v,4)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.7;pg no: 177" - ] - }, - { - "cell_type": "code", - "execution_count": 74, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.7, Page:177 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\n", - "on mollier diadram(h-s diagram)the slope of isobaric line may be given as\n", - "(dh/ds)_p=cons =slope of isobar\n", - "from 1st and 2nd law combined;\n", - "T*ds=dh-v*dp\n", - "(dh/ds)_p=cons = T\n", - "here temperature,T=773.15 K\n", - "here slope=(dh/ds))p=cons = 773.15\n" - ] - } - ], - "source": [ - "#cal of slope\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.7, Page:177 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\")\n", - "print(\"on mollier diadram(h-s diagram)the slope of isobaric line may be given as\")\n", - "print(\"(dh/ds)_p=cons =slope of isobar\")\n", - "print(\"from 1st and 2nd law combined;\")\n", - "print(\"T*ds=dh-v*dp\")\n", - "print(\"(dh/ds)_p=cons = T\")\n", - "print(\"here temperature,T=773.15 K\")\n", - "print(\"here slope=(dh/ds))p=cons = 773.15\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.8;pg no: 178" - ] - }, - { - "cell_type": "code", - "execution_count": 75, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.8, Page:178 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\n", - "at 0.15Mpa,from steam table;\n", - "hf=467.11 KJ/kg,hg=2693.6 KJ/kg\n", - "and hfg in KJ/kg= 2226.49\n", - "vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\n", - "and vfg in m^3/kg= 1.16\n", - "sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\n", - "and sfg=in KJ/kg K= 5.79\n", - "enthalpy at x=.10(h)in KJ/kg\n", - "h= 689.76\n", - "specific volume,(v)in m^3/kg\n", - "v= 0.12\n", - "entropy (s)in KJ/kg K\n", - "s= 2.01\n" - ] - } - ], - "source": [ - "#cal of entropy\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.8, Page:178 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\")\n", - "x=.10;#quality is 10%\n", - "print(\"at 0.15Mpa,from steam table;\")\n", - "print(\"hf=467.11 KJ/kg,hg=2693.6 KJ/kg\")\n", - "hf=467.11;\n", - "hg=2693.6;\n", - "hfg=hg-hf\n", - "print(\"and hfg in KJ/kg=\"),round(hfg,2)\n", - "print(\"vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\")\n", - "vf=0.001053;\n", - "vg=1.1593;\n", - "vfg=vg-vf\n", - "print(\"and vfg in m^3/kg=\"),round(vfg,2)\n", - "print(\"sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\")\n", - "sf=1.4336;\n", - "sg=7.2233;\n", - "sfg=sg-sf\n", - "print(\"and sfg=in KJ/kg K=\"),round(sfg,2)\n", - "print(\"enthalpy at x=.10(h)in KJ/kg\")\n", - "h=hf+x*hfg\n", - "print(\"h=\"),round(h,2)\n", - "print(\"specific volume,(v)in m^3/kg\")\n", - "v=vf+x*vfg\n", - "print(\"v=\"),round(v,2)\n", - "print(\"entropy (s)in KJ/kg K\")\n", - "s=sf+x*sfg\n", - "print(\"s=\"),round(s,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.9;pg no: 178" - ] - }, - { - "cell_type": "code", - "execution_count": 76, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.9, Page:178 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\n", - "work done during constant pressure process(W)=p1*(V2-V1)in KJ\n", - "now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\n", - "so v1 in m^3/kg=\n", - "now mass of steam(m) in kg= 0.32\n", - "specific volume at final state(v2)in m^3/kg\n", - "v2= 0.62\n", - "corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\n", - "v2>vg_1Mpa\n", - "hence state lies in superheated region,from the steam table by interpolation we get temperature as;\n", - "state lies between temperature of 1000 degree celcius and 1100 degree celcius\n", - "so exact temperature at final state(T)in K= 1077.61\n", - "thus internal energy at final state,1 Mpa,1077.61 degree celcius;\n", - "u2=4209.6 KJ/kg\n", - "internal energy at initial state(u1)in KJ/kg\n", - "u1= 2219.28\n", - "from first law of thermodynamics,Q-W=deltaU\n", - "so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ= 788.83\n" - ] - } - ], - "source": [ - "#cal of heat added\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.9, Page:178 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\")\n", - "p1=1*1000;#initial pressure of steam in Kpa\n", - "V1=0.05;#initial volume of steam in m^3\n", - "x1=.8;#dryness fraction is 80%\n", - "V2=0.2;#final volume of steam in m^3\n", - "p2=p1;#constant pressure process\n", - "print(\"work done during constant pressure process(W)=p1*(V2-V1)in KJ\")\n", - "W=p1*(V2-V1)\n", - "print(\"now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\")\n", - "vf=0.001127;\n", - "vg=0.19444;\n", - "uf=761.68;\n", - "ufg=1822;\n", - "v1=vf+x1*vg\n", - "print(\"so v1 in m^3/kg=\")\n", - "m=V1/v1\n", - "print(\"now mass of steam(m) in kg=\"),round(m,2)\n", - "m=0.32097;#take m=0.32097 approx.\n", - "print(\"specific volume at final state(v2)in m^3/kg\")\n", - "v2=V2/m\n", - "print(\"v2=\"),round(v2,2)\n", - "print(\"corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\")\n", - "print(\"v2>vg_1Mpa\")\n", - "print(\"hence state lies in superheated region,from the steam table by interpolation we get temperature as;\")\n", - "print(\"state lies between temperature of 1000 degree celcius and 1100 degree celcius\")\n", - "T=1000+((100*(.62311-.5871))/(.6335-.5871))\n", - "print(\"so exact temperature at final state(T)in K=\"),round(T,2)\n", - "print(\"thus internal energy at final state,1 Mpa,1077.61 degree celcius;\")\n", - "print(\"u2=4209.6 KJ/kg\")\n", - "u2=4209.6;\n", - "print(\"internal energy at initial state(u1)in KJ/kg\")\n", - "u1=uf+x1*ufg\n", - "print(\"u1=\"),round(u1,2)\n", - "print(\"from first law of thermodynamics,Q-W=deltaU\")\n", - "Q=m*(u2-u1)+W\n", - "print(\"so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ=\"),round(Q,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.10;pg no: 179" - ] - }, - { - "cell_type": "code", - "execution_count": 77, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.10, Page:179 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\n", - "here steam is kept in rigid vessel,therefore its specific volume shall remain constant\n", - "it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\n", - "from superheated steam table;v1=0.2404 m^3/kg\n", - "at begining of condensation specific volume = 0.2404 m^3/kg\n", - "v2=0.2404 m^3/kg\n", - "this v2 shall be specific volume corresponding to saturated vapour state for condensation.\n", - "thus v2=vg=0.2404 m^3/kg\n", - "looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\n", - "by interpolation,temperature at begining of condensation(T2)in K\n", - "similarily,pressure(p2)in Kpa= 800.96\n" - ] - } - ], - "source": [ - "#cal of pressure\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.10, Page:179 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\")\n", - "p1=800;#initial pressure of steam in Kpa\n", - "T1=200;#initial temperature of steam in degree celcius\n", - "print(\"here steam is kept in rigid vessel,therefore its specific volume shall remain constant\")\n", - "print(\"it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\")\n", - "print(\"from superheated steam table;v1=0.2404 m^3/kg\")\n", - "print(\"at begining of condensation specific volume = 0.2404 m^3/kg\")\n", - "print(\"v2=0.2404 m^3/kg\")\n", - "v2=0.2404;\n", - "print(\"this v2 shall be specific volume corresponding to saturated vapour state for condensation.\")\n", - "print(\"thus v2=vg=0.2404 m^3/kg\")\n", - "vg=v2;\n", - "print(\"looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\")\n", - "print(\"by interpolation,temperature at begining of condensation(T2)in K\")\n", - "T2=175-((175-170)*(0.2404-0.2167))/(0.2428-.2168)\n", - "p=892-(((892-791.7)*(0.2404-0.2168))/(0.2428-0.2168))\n", - "print(\"similarily,pressure(p2)in Kpa=\"),round(p,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.11;pg no: 180" - ] - }, - { - "cell_type": "code", - "execution_count": 78, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.11, Page:180 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\n", - "from 1st and 2nd law;\n", - "T*ds=dh-v*dp\n", - "for isentropic process,ds=0\n", - "hence dh=v*dp\n", - "i.e (h2-h1)=v1*(p2-p1)\n", - "corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\n", - "p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\n", - "therefore enthalpy change(deltah)=(h2-h1) in KJ/kg= 0.2\n" - ] - } - ], - "source": [ - "#cal of enthalpy change\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.11, Page:180 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\")\n", - "p2=200;#feed water pump pressure in Kpa\n", - "print(\"from 1st and 2nd law;\")\n", - "print(\"T*ds=dh-v*dp\")\n", - "print(\"for isentropic process,ds=0\")\n", - "print(\"hence dh=v*dp\")\n", - "print(\"i.e (h2-h1)=v1*(p2-p1)\")\n", - "print(\"corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\")\n", - "print(\"p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\")\n", - "p1=4.25;\n", - "v1=0.001004;\n", - "deltah=v1*(p2-p1)\n", - "print(\"therefore enthalpy change(deltah)=(h2-h1) in KJ/kg=\"),round(deltah,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.12;pg no: 180" - ] - }, - { - "cell_type": "code", - "execution_count": 79, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.12, Page:180 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\n", - "from steam table at 150 degree celcius\n", - "vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\n", - "so volume occupied by water(Vw)=3*V/(3+2) in m^3 1.2\n", - "and volume of steam(Vs) in m^3= 0.8\n", - "mass of water(mf)=Vw/Vf in kg 1099.91\n", - "mass of steam(mg)=Vs/Vg in kg 2.04\n", - "total mass in tank(m) in kg= 1101.95\n", - "quality or dryness fraction(x)\n", - "x= 0.002\n", - "NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\n" - ] - } - ], - "source": [ - "#cal of quality or dryness fraction\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.12, Page:180 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\")\n", - "V=2.;#volume of vessel in m^3\n", - "print(\"from steam table at 150 degree celcius\")\n", - "print(\"vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\")\n", - "Vf=0.001091;\n", - "Vg=0.3928;\n", - "Vw=3*V/(3+2)\n", - "print(\"so volume occupied by water(Vw)=3*V/(3+2) in m^3\"),round(Vw,2)\n", - "Vs=2*V/(3+2)\n", - "print(\"and volume of steam(Vs) in m^3=\"),round(Vs,2)\n", - "mf=Vw/Vf\n", - "print(\"mass of water(mf)=Vw/Vf in kg\"),round(mf,2)\n", - "mg=Vs/Vg\n", - "print(\"mass of steam(mg)=Vs/Vg in kg\"),round(mg,2)\n", - "m=mf+mg\n", - "print(\"total mass in tank(m) in kg=\"),round(m,2)\n", - "print(\"quality or dryness fraction(x)\")\n", - "x=mg/m\n", - "print(\"x=\"),round(x,3)\n", - "print(\"NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.13;pg no: 181" - ] - }, - { - "cell_type": "code", - "execution_count": 80, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.13, Page:181 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\n", - "fron S.F.S.E on steam turbine;\n", - "W=h1-h2\n", - "initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\n", - "h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\n", - "reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\n", - "else from steam tables at 50 degree celcius saturation temperature;\n", - "hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\n", - "hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\n", - "here s1=s2,let dryness fraction at 2 be x2\n", - "x2= 0.75\n", - "hence enthalpy at state 2\n", - "h2 in KJ/kg= 1994.84\n", - "steam turbine work(W)in KJ/kg\n", - "W=h1-h2\n", - "so turbine output=W 891.36\n" - ] - } - ], - "source": [ - "#cal of turbine output\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.13, Page:181 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\")\n", - "print(\"fron S.F.S.E on steam turbine;\")\n", - "print(\"W=h1-h2\")\n", - "print(\"initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\")\n", - "print(\"h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\")\n", - "h1=2886.2;\n", - "s1=6.2285;\n", - "print(\"reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\")\n", - "print(\"else from steam tables at 50 degree celcius saturation temperature;\")\n", - "print(\"hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\")\n", - "hf=209.33;\n", - "sf=0.7038;\n", - "print(\"hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\")\n", - "hfg=2382.7;\n", - "sfg=7.3725;\n", - "print(\"here s1=s2,let dryness fraction at 2 be x2\")\n", - "x2=(s1-sf)/sfg\n", - "print(\"x2=\"),round(x2,2)\n", - "print(\"hence enthalpy at state 2\")\n", - "h2=hf+x2*hfg\n", - "print(\"h2 in KJ/kg=\"),round(h2,2)\n", - "print(\"steam turbine work(W)in KJ/kg\")\n", - "W=h1-h2\n", - "print(\"W=h1-h2\")\n", - "print(\"so turbine output=W\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.14;pg no: 181" - ] - }, - { - "cell_type": "code", - "execution_count": 81, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.14, Page:181 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\n", - "it is constant volume process\n", - "volume of vessel(V)=mass of vapour * specific volume of vapour\n", - "initial specific volume,v1\n", - "v1=vf_100Kpa+x1*vfg_100 in m^3/kg\n", - "at 100 Kpa from steam table;\n", - "hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\n", - " here vfg_100Kpa= in m^3/kg= 1.69\n", - "so v1= in m^3/kg= 0.85\n", - "and volume of vessel(V) in m^3= 42.38\n", - "enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg 1546.46\n", - "internal energy in the beginning=U1=m1*u1 in KJ 146171.0\n", - "let the mass of dry steam added be m,final specific volume inside vessel,v2\n", - "v2=vf_1000Kpa+x2*vfg_1000Kpa\n", - "at 2000 Kpa,from steam table,\n", - "vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\n", - "total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\n", - "V/v2=V/vg_2000Kpa+V/v1\n", - "so v2 in m^3/kg= 0.09\n", - "here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\n", - "at 1000 Kpa from steam table,\n", - "hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\n", - "here vfg_1000Kpa= in m^3/kg= 0.19\n", - "so x2= 0.46\n", - "for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\n", - "so mass of dry steam at 2000 Kpa to be added(m)in kg\n", - "m=(100*(h1-h2))/(h2-hg_2000Kpa)= 11.97\n", - "quality of final mixture x2= 0.46\n" - ] - } - ], - "source": [ - "#cal of quality of final mixture\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.14, Page:181 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\")\n", - "x1=0.5;#dryness fraction \n", - "m1=100;#mass of steam in kg\n", - "v1=0.8475;#\n", - "print(\"it is constant volume process\")\n", - "print(\"volume of vessel(V)=mass of vapour * specific volume of vapour\")\n", - "print(\"initial specific volume,v1\")\n", - "print(\"v1=vf_100Kpa+x1*vfg_100 in m^3/kg\")\n", - "print(\"at 100 Kpa from steam table;\")\n", - "print(\"hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\")\n", - "hf_100Kpa=417.46;\n", - "uf_100Kpa=417.36;\n", - "vf_100Kpa=0.001043;\n", - "hfg_100Kpa=2258;\n", - "ufg_100Kpa=2088.7;\n", - "vg_100Kpa=1.6940;\n", - "vfg_100Kpa=vg_100Kpa-vf_100Kpa\n", - "print(\" here vfg_100Kpa= in m^3/kg=\"),round(vfg_100Kpa,2)\n", - "v1=vf_100Kpa+x1*vfg_100Kpa\n", - "print(\"so v1= in m^3/kg=\"),round(v1,2)\n", - "V=m1*x1*v1\n", - "print(\"and volume of vessel(V) in m^3=\"),round(V,2)\n", - "h1=hf_100Kpa+x1*hfg_100Kpa\n", - "print(\"enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg\"),round(h1,2)\n", - "U1=m1*(uf_100Kpa+x1*ufg_100Kpa)\n", - "print(\"internal energy in the beginning=U1=m1*u1 in KJ\"),round(U1,2)\n", - "print(\"let the mass of dry steam added be m,final specific volume inside vessel,v2\")\n", - "print(\"v2=vf_1000Kpa+x2*vfg_1000Kpa\")\n", - "print(\"at 2000 Kpa,from steam table,\")\n", - "print(\"vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\")\n", - "vg_2000Kpa=0.09963;\n", - "ug_2000Kpa=2600.3;\n", - "hg_2000Kpa=2799.5;\n", - "print(\"total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\")\n", - "print(\"V/v2=V/vg_2000Kpa+V/v1\")\n", - "v2=1/((1/vg_2000Kpa)+(1/v1))\n", - "print(\"so v2 in m^3/kg=\"),round(v2,2)\n", - "print(\"here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\")\n", - "print(\"at 1000 Kpa from steam table,\")\n", - "print(\"hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\")\n", - "hf_1000Kpa=762.81;\n", - "hfg_1000Kpa=2015.3;\n", - "vf_1000Kpa=0.001127;\n", - "vg_1000Kpa=0.19444;\n", - "vfg_1000Kpa=vg_1000Kpa-vf_1000Kpa\n", - "print(\"here vfg_1000Kpa= in m^3/kg=\"),round(vfg_1000Kpa,2)\n", - "x2=(v2-vf_1000Kpa)/vfg_1000Kpa\n", - "print(\"so x2=\"),round(x2,2)\n", - "print(\"for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\")\n", - "print(\"so mass of dry steam at 2000 Kpa to be added(m)in kg\")\n", - "m=(100*(h1-(hf_1000Kpa+x2*hfg_1000Kpa)))/((hf_1000Kpa+x2*hfg_1000Kpa)-hg_2000Kpa)\n", - "print(\"m=(100*(h1-h2))/(h2-hg_2000Kpa)=\"),round(m,2)\n", - "print(\"quality of final mixture x2=\"),round(x2,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.15;pg no: 183" - ] - }, - { - "cell_type": "code", - "execution_count": 82, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.15, Page:183 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\n", - "from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\n", - "condenser pressure(p_condenser) in Kpa= 7.3\n", - "partial pressure of steam corresponding to35 degree celcius from steam table;\n", - "p_steam=5.628 Kpa\n", - "enthalpy corresponding to 35 degree celcius from steam table,\n", - "hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\n", - "let quality of steam entering be x\n", - "from energy balance;\n", - "mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\n", - "so dryness fraction of steam entering(x)is given as\n", - "x= 0.97\n" - ] - } - ], - "source": [ - "#cal of dryness fraction of steam entering\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.15, Page:183 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\")\n", - "p_vaccum=71.5;#recorded condenser vaccum in cm of mercury\n", - "p_barometer=76.8;#barometer reading in cm of mercury\n", - "T_cond=35;#temperature of condensation in degree celcius\n", - "T_hotwell=27.6;#temperature of hot well in degree celcius\n", - "m_cond=1930;#mass of condensate per hour\n", - "m_w=62000;#mass of cooling water per hour\n", - "Ti=8.51;#initial temperature in degree celcius\n", - "To=26.24;#outlet temperature in degree celcius\n", - "print(\"from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\")\n", - "p_condenser=(p_barometer-p_vaccum)*101.325/73.55\n", - "print(\"condenser pressure(p_condenser) in Kpa=\"),round(p_condenser,2)\n", - "print(\"partial pressure of steam corresponding to35 degree celcius from steam table;\")\n", - "print(\"p_steam=5.628 Kpa\")\n", - "p_steam=5.628;#partial pressure of steam\n", - "print(\"enthalpy corresponding to 35 degree celcius from steam table,\")\n", - "print(\"hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\")\n", - "hf=146.68;\n", - "hfg=2418.6;\n", - "print(\"let quality of steam entering be x\")\n", - "print(\"from energy balance;\")\n", - "print(\"mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\")\n", - "print(\"so dryness fraction of steam entering(x)is given as\")\n", - "x=(((m_w*(To-Ti)*4.18)/m_cond)-hf+4.18*T_hotwell)/hfg\n", - "print(\"x=\"),round(x,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.16;pg no: 184" - ] - }, - { - "cell_type": "code", - "execution_count": 83, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.16, Page:184 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\n", - "heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\n", - "area(A) in m^2= 0.03\n", - "so p1=in Kpa= 419.61\n", - "now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\n", - "volume of water contained(V1) in m^3= 0.001\n", - "mass of water(m) in kg= 0.63\n", - "heat supplied shall cause sensible heating and latent heating\n", - "hence,enthalpy change=heat supplied\n", - "Q=((hf+x*hfg)-(4.18*T)*m)\n", - "so dryness fraction of steam produced(x)can be calculated as\n", - "so x= 0.46\n", - "internal energy of water(U1)in KJ,initially\n", - "U1= 393.69\n", - "finally,internal energy of wet steam(U2)in KJ\n", - "U2=m*h2-p2*V2\n", - "here V2 in m^3= 0.13\n", - "hence U2= 940.68\n", - "hence change in internal energy(U) in KJ= 547.21\n", - "work done(W) in KJ= 53.01\n" - ] - } - ], - "source": [ - "#cal of change in internal energy and work done\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "import math\n", - "print\"Example 6.16, Page:184 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\")\n", - "F=10;#force applied externally upon piston in KN\n", - "d=.2;#diameter in m\n", - "h=0.02;#depth to which water filled in m \n", - "P_atm=101.3;#atmospheric pressure in Kpa\n", - "rho=1000;#density of water in kg/m^3\n", - "Q=600;#heat supplied to water in KJ\n", - "T=150;#temperature of water in degree celcius\n", - "print(\"heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\")\n", - "A=math.pi*d**2/4\n", - "print(\"area(A) in m^2=\"),round(A,2)\n", - "p1=F/A+P_atm\n", - "print(\"so p1=in Kpa=\"),round(p1,2)\n", - "print(\"now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\")\n", - "hf=612.1;\n", - "hfg=2128.7;\n", - "vg=0.4435;\n", - "V1=math.pi*d**2*h/4\n", - "print(\"volume of water contained(V1) in m^3=\"),round(V1,3)\n", - "m=V1*rho\n", - "print(\"mass of water(m) in kg=\"),round(m,2)\n", - "print(\"heat supplied shall cause sensible heating and latent heating\")\n", - "print(\"hence,enthalpy change=heat supplied\")\n", - "print(\"Q=((hf+x*hfg)-(4.18*T)*m)\")\n", - "print(\"so dryness fraction of steam produced(x)can be calculated as\")\n", - "x=((Q/m)+4.18*T-hf)/hfg\n", - "print(\"so x=\"),round(x,2)\n", - "print(\"internal energy of water(U1)in KJ,initially\")\n", - "h1=4.18*T;#enthalpy of water in KJ/kg\n", - "U1=m*h1-p1*V1\n", - "print(\"U1=\"),round(U1,2)\n", - "U1=393.5;#approx.\n", - "print(\"finally,internal energy of wet steam(U2)in KJ\")\n", - "print(\"U2=m*h2-p2*V2\")\n", - "V2=m*x*vg\n", - "print(\"here V2 in m^3=\"),round(V2,2)\n", - "p2=p1;#constant pressure process\n", - "U2=(m*(hf+x*hfg))-p2*V2\n", - "print(\"hence U2=\"),round(U2,2)\n", - "U2=940.71;#approx.\n", - "U=U2-U1\n", - "print(\"hence change in internal energy(U) in KJ=\"),round(U,2)\n", - "p=p1;\n", - "W=p*(V2-V1)\n", - "print(\"work done(W) in KJ=\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.17;pg no: 185" - ] - }, - { - "cell_type": "code", - "execution_count": 84, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.17, Page:185 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\n", - "consider throttling calorimeter alone,\n", - "degree of superheat(T_sup)in degree celcius\n", - "T_sup= 18.2\n", - "enthalpy of superheated steam(h_sup)in KJ/kg\n", - "h_sup= 2711.99\n", - "at 120 degree celcius,h=2673.95 KJ/kg from steam table\n", - "now enthalpy before throttling = enthalpy after throttling\n", - "hf+x2*hfg=h_sup\n", - "here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\n", - "so x2= 0.96\n", - "for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\n", - "overall dryness fraction(x)= 0.91\n" - ] - } - ], - "source": [ - "#cal of overall dryness fraction\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.17, Page:185 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\")\n", - "ms=40;#mass of steam in kg\n", - "mw=2.2;#mass of water in kg\n", - "p1=1.47;#pressure before throttling in Mpa\n", - "T2=120;#temperature after throttling in degree celcius\n", - "p2=107.88;#pressure after throttling in Kpa\n", - "Cp_sup=2.09;#specific heat of superheated steam in KJ/kg K\n", - "print(\"consider throttling calorimeter alone,\")\n", - "print(\"degree of superheat(T_sup)in degree celcius\")\n", - "T_sup=T2-101.8\n", - "print(\"T_sup=\"),round(T_sup,2)\n", - "print(\"enthalpy of superheated steam(h_sup)in KJ/kg\")\n", - "h=2673.95;\n", - "h_sup=h+T_sup*Cp_sup\n", - "print(\"h_sup=\"),round(h_sup,2)\n", - "print(\"at 120 degree celcius,h=2673.95 KJ/kg from steam table\")\n", - "print(\"now enthalpy before throttling = enthalpy after throttling\")\n", - "print(\"hf+x2*hfg=h_sup\")\n", - "print(\"here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\")\n", - "hf=840.513;\n", - "hfg=1951.02;\n", - "x2=(h_sup-hf)/hfg\n", - "print(\"so x2=\"),round(x2,2)\n", - "print(\"for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\")\n", - "x1=(ms-mw)/ms\n", - "x=x1*x2\n", - "print(\"overall dryness fraction(x)=\"),round(x,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.18;pg no: 185" - ] - }, - { - "cell_type": "code", - "execution_count": 85, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.18, Page:185 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\n", - "here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\n", - "final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\n", - "Q in KJ= 200.0\n", - "final enthalpy of dry steam at 15 bar,h2=hg_15bar\n", - "h2=2792.2 KJ/kg from steam table\n", - "let initial dryness fraction be x1,initial enthalpy,\n", - "h1=hf_10bar+x1*hfg_10bar.........eq1\n", - "here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\n", - "also heat balance yields,\n", - "h1+Q=h2\n", - "so h1=h2-Q in KJ/kg\n", - "so by eq 1=>x1= 0.91\n", - "heat added(Q)in KJ= 200.0\n", - "and initial quality(x1) 0.91\n" - ] - } - ], - "source": [ - "#cal of heat added and initial quality\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.18, Page:185 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\")\n", - "v=0.4;#volume of air in part A and part B in m^3\n", - "p1=10*10**5;#initial pressure of steam in pa\n", - "p2=15*10**5;#final pressure of steam in pa\n", - "print(\"here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\")\n", - "print(\"final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\")\n", - "Q=v*(p2-p1)/1000\n", - "print(\"Q in KJ=\"),round(Q,2)\n", - "print(\"final enthalpy of dry steam at 15 bar,h2=hg_15bar\")\n", - "print(\"h2=2792.2 KJ/kg from steam table\")\n", - "h2=2792.2;\n", - "print(\"let initial dryness fraction be x1,initial enthalpy,\")\n", - "print(\"h1=hf_10bar+x1*hfg_10bar.........eq1\")\n", - "print(\"here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\")\n", - "hf_10bar=762.83;\n", - "hfg_10bar=2015.3;\n", - "print(\"also heat balance yields,\")\n", - "print(\"h1+Q=h2\")\n", - "print(\"so h1=h2-Q in KJ/kg\")\n", - "h1=h2-Q\n", - "x1=(h1-hf_10bar)/hfg_10bar\n", - "print(\"so by eq 1=>x1=\"),round(x1,2)\n", - "print(\"heat added(Q)in KJ=\"),round(Q,2)\n", - "print(\"and initial quality(x1)\"),round(x1,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.19;pg no: 186" - ] - }, - { - "cell_type": "code", - "execution_count": 86, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.19, Page:186 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\n", - "from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\n", - "specific volume of wet steam in cylinder,v1 in m^3/kg= 0.75\n", - "dryness fraction of initial steam(x1)= 0.6\n", - "initial enthalpy of wet steam,h1 in KJ/kg= 1801.83\n", - "at 400 degree celcius specific volume of steam,v2 in m^3/kg= 1.55\n", - "for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\n", - "actual pressure can be obtained by interpolation\n", - "p2=0.20 MPa(approx.)\n", - "saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\n", - "finally the degree of superheat(T_sup)in K\n", - "T_sup=T-t\n", - "final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\n", - "heat added during process(deltaQ)in KJ\n", - "deltaQ=m*(h2-h1)\n", - "internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\n", - "here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\n", - "internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\n", - "u2=2966.7 KJ/kg\n", - "change in internal energy(deltaU)in KJ\n", - "deltaU= 3807.41\n", - "form first law of thermodynamics,work done(deltaW)in KJ\n", - "deltaW=deltaQ-deltaU 616.88\n", - "so heat transfer(deltaQ)in KJ 4424.3\n", - "and work transfer(deltaW)in KJ 616.88\n", - "NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\n", - "and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\n" - ] - } - ], - "source": [ - "#cal of heat and work transfer \n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.19, Page:186 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\")\n", - "m=3;#mass of wet steam in kg\n", - "p=1.4;#pressure of wet steam in bar\n", - "V1=2.25;#initial volume in m^3\n", - "V2=4.65;#final volume in m^3\n", - "T=400;#temperature of steam in degreee celcius\n", - "print(\"from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\")\n", - "vg=1.2455;\n", - "hf=457.99;\n", - "hfg=2232.3;\n", - "v1=V1/m\n", - "print(\"specific volume of wet steam in cylinder,v1 in m^3/kg=\"),round(v1,2)\n", - "x1=v1/vg\n", - "print(\"dryness fraction of initial steam(x1)=\"),round(x1,2)\n", - "x1=0.602;#approx.\n", - "h1=hf+x1*hfg\n", - "print(\"initial enthalpy of wet steam,h1 in KJ/kg=\"),round(h1,2)\n", - "v2=V2/m\n", - "print(\"at 400 degree celcius specific volume of steam,v2 in m^3/kg=\"),round(v2,2)\n", - "print(\"for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\")\n", - "print(\"actual pressure can be obtained by interpolation\")\n", - "p2=.1+((0.20-0.10)/(1.5493-3.103))*(1.55-3.103)\n", - "print(\"p2=0.20 MPa(approx.)\")\n", - "p2=0.20;\n", - "print(\"saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\")\n", - "t=120.23;\n", - "print(\"finally the degree of superheat(T_sup)in K\")\n", - "print(\"T_sup=T-t\")\n", - "T_sup=T-t\n", - "print(\"final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\")\n", - "h2=3276.6;\n", - "print(\"heat added during process(deltaQ)in KJ\")\n", - "print(\"deltaQ=m*(h2-h1)\")\n", - "deltaQ=m*(h2-h1)\n", - "print(\"internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\")\n", - "print(\"here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\")\n", - "uf=457.84;\n", - "ufg=2059.34;\n", - "u1=uf+x1*ufg\n", - "print(\"internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\")\n", - "print(\"u2=2966.7 KJ/kg\")\n", - "u2=2966.7;\n", - "print(\"change in internal energy(deltaU)in KJ\")\n", - "deltaU=m*(u2-u1)\n", - "print(\"deltaU=\"),round(deltaU,2)\n", - "print(\"form first law of thermodynamics,work done(deltaW)in KJ\")\n", - "deltaW=deltaQ-deltaU\n", - "print(\"deltaW=deltaQ-deltaU\"),round(deltaW,2)\n", - "print(\"so heat transfer(deltaQ)in KJ\"),round(deltaQ,2)\n", - "print(\"and work transfer(deltaW)in KJ\"),round(deltaW,2)\n", - "print(\"NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\")\n", - "print(\"and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.20;pg no: 187" - ] - }, - { - "cell_type": "code", - "execution_count": 87, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.20, Page:187 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\n", - "here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\n", - "at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\n", - "finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\n", - "h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\n", - "h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\n", - "so final temperature(T2)in K\n", - "T2= 495.43\n", - "entropy for final state(s2)in KJ/kg K\n", - "s2= 8.82\n", - "here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\n", - "so change in entropy(deltaS)in KJ/kg K\n", - "deltaS= 1.06\n", - "final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\n", - "here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\n", - "percentage of vessel volume initially occupied by steam(V)= 9.99\n" - ] - } - ], - "source": [ - "#cal of percentage of vessel volume initially occupied by steam\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.20, Page:187 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\")\n", - "print(\"here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\")\n", - "print(\"at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\")\n", - "h1_10bar_500oc=3478.5;\n", - "s1_10bar_500oc=7.7622;\n", - "v1_10bar_500oc=0.3541;\n", - "print(\"finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\")\n", - "h2=h1_10bar_500oc;\n", - "print(\"h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\")\n", - "h_1bar_400oc=3278.2;\n", - "h_1bar_500oc=3488.1;\n", - "print(\"h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\")\n", - "print(\"so final temperature(T2)in K\")\n", - "T2=400+((h2-h_1bar_400oc)*(500-400)/(h_1bar_500oc-h_1bar_400oc))\n", - "print(\"T2=\"),round(T2,2)\n", - "print(\"entropy for final state(s2)in KJ/kg K\")\n", - "s_1bar_400oc=8.5435;\n", - "s_1bar_500oc=8.8342;\n", - "s2=s_1bar_400oc+((s_1bar_500oc-s_1bar_400oc)*(495.43-400)/(500-400))\n", - "print(\"s2=\"),round(s2,2)\n", - "print(\"here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\")\n", - "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", - "deltaS=s2-s1_10bar_500oc\n", - "print(\"deltaS=\"),round(deltaS,2)\n", - "print(\"final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\")\n", - "print(\"here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\")\n", - "v_1bar_500oc=3.565;\n", - "v_1bar_400oc=3.103;\n", - "v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400))\n", - "V=v1_10bar_500oc*100/v2\n", - "print(\"percentage of vessel volume initially occupied by steam(V)=\"),round(V,2)\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter6_3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter6_3.ipynb deleted file mode 100755 index 92ef2871..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter6_3.ipynb +++ /dev/null @@ -1,1390 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6:Thermo dynamic Properties of pure substance" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.1;pg no: 174" - ] - }, - { - "cell_type": "code", - "execution_count": 68, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.1, Page:174 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\n", - "NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.1, Page:174 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 1\")\n", - "print(\"NOTE=>In question no. 1 expression for various quantities is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.2;pg no: 175" - ] - }, - { - "cell_type": "code", - "execution_count": 69, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.2, Page:175 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\n", - "during throttling,h1=h2\n", - "at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\n", - "thus h2=2682.5 KJ/kg\n", - "at state 1,before throttling\n", - "hf_10Mpa=1407.56 KJ/kg\n", - "hfg_10Mpa=1317.1 KJ/kg\n", - "h1=hf_10Mpa+x1*hfg_10Mpa\n", - "dryness fraction(x1)may be given as\n", - "x1= 0.97\n" - ] - } - ], - "source": [ - "#cal of dryness fraction\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.2, Page:175 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 2\")\n", - "print(\"during throttling,h1=h2\")\n", - "print(\"at state 2,enthalpy can be seen for superheated steam using Table 4 at 0.05 Mpa and 100 degree celcius\")\n", - "print(\"thus h2=2682.5 KJ/kg\")\n", - "h2=2682.5;\n", - "print(\"at state 1,before throttling\")\n", - "print(\"hf_10Mpa=1407.56 KJ/kg\")\n", - "hf_10Mpa=1407.56;\n", - "print(\"hfg_10Mpa=1317.1 KJ/kg\")\n", - "hfg_10Mpa=1317.1;\n", - "print(\"h1=hf_10Mpa+x1*hfg_10Mpa\")\n", - "h1=h2;#during throttling\n", - "print(\"dryness fraction(x1)may be given as\")\n", - "x1=(h1-hf_10Mpa)/hfg_10Mpa\n", - "print(\"x1=\"),round(x1,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.3;pg no: 176" - ] - }, - { - "cell_type": "code", - "execution_count": 70, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.3, Page:176 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\n", - "internal energy(u)=in KJ/kg 2644.0\n" - ] - } - ], - "source": [ - "#cal of internal energy\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.3, Page:176 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 3\")\n", - "h=2848;#enthalpy in KJ/kg\n", - "p=12*1000;#pressure in Kpa\n", - "v=0.017;#specific volume in m^3/kg\n", - "u=h-p*v\n", - "print(\"internal energy(u)=in KJ/kg\"),round(u,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.4;pg no: 176" - ] - }, - { - "cell_type": "code", - "execution_count": 71, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.4, Page:176 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\n", - "steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\n", - "entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\n", - "S= 6.65\n", - "entropy of 5 kg of steam(S)in KJ/K\n", - "S=m*S 33.23\n" - ] - } - ], - "source": [ - "#cal of entropy of 5 kg of steam\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "import math\n", - "print\"Example 6.4, Page:176 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 4\")\n", - "m=5;#mass of steam in kg\n", - "p=2;#pressure of steam in Mpa\n", - "T_superheat=(300+273.15);#temperature of superheat steam in K\n", - "Cp_water=4.18;#specific heat of water at constant pressure in KJ/kg K\n", - "Cp_superheat=2.1;#specific heat of superheat steam at constant pressure in KJ/kg K\n", - "print(\"steam state 2 Mpa and 300 degree celcius lies in superheated region as saturation temperature at 2 Mpa is 212.42 degree celcius and hfg=1890.7 KJ/kg\")\n", - "T_sat=(212.42+273.15);#saturation temperature at 2 Mpa in K\n", - "hfg_2Mpa=1890.7;\n", - "print(\"entropy of unit mass of superheated steam with reference to absolute zero(S)in KJ/kg K\")\n", - "S=Cp_water*math.log(T_sat/273.15)+(hfg_2Mpa/T_sat)+(Cp_superheat*math.log(T_superheat/T_sat))\n", - "print(\"S=\"),round(S,2)\n", - "print(\"entropy of 5 kg of steam(S)in KJ/K\")\n", - "S=m*S\n", - "print(\"S=m*S\"),round(S,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.5;pg no: 176" - ] - }, - { - "cell_type": "code", - "execution_count": 72, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.5, Page:176 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\n", - "boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\n", - "at further depth of 50 cm the pressure(p)in Kpa\n", - "p= 138.37\n", - "boiling point at this depth=Tsat_138.365\n", - "from steam table this temperature=108.866=108.87 degree celcius\n", - "so boiling point = 108.87 degree celcius\n" - ] - } - ], - "source": [ - "#cal of boiling point\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.5, Page:176 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 5\")\n", - "rho=1000;#density of water in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "h=0.50;#depth from above mentioned level in m\n", - "print(\"boiling point =110 degree celcius,pressure at which it boils=143.27 Kpa(from steam table,sat. pressure for 110 degree celcius)\")\n", - "p_boil=143.27;#pressure at which pond water boils in Kpa\n", - "print(\"at further depth of 50 cm the pressure(p)in Kpa\")\n", - "p=p_boil-((rho*g*h)*10**-3)\n", - "print(\"p=\"),round(p,2)\n", - "print(\"boiling point at this depth=Tsat_138.365\")\n", - "print(\"from steam table this temperature=108.866=108.87 degree celcius\")\n", - "print(\"so boiling point = 108.87 degree celcius\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.6;pg no: 177" - ] - }, - { - "cell_type": "code", - "execution_count": 73, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.6, Page:177 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\n", - "in a rigid vessel it can be treated as constant volume process.\n", - "so v1=v2\n", - "since final state is given to be critical state,then specific volume at critical point,\n", - "v2=0.003155 m^3/kg\n", - "at 100 degree celcius saturation temperature,from steam table\n", - "vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\n", - "and vfg_100=in m^3/kg= 1.67\n", - "thus for initial quality being x1\n", - "v1=vf_100+x1*vfg_100\n", - "so x1= 0.001\n", - "mass of water initially=total mass*(1-x1)\n", - "total mass of fluid/water(m) in kg= 158.48\n", - "volume of water(v) in m^3= 0.1655\n" - ] - } - ], - "source": [ - "#cal of mass and volume of water\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.6, Page:177 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 6\")\n", - "V=0.5;#capacity of rigid vessel in m^3\n", - "print(\"in a rigid vessel it can be treated as constant volume process.\")\n", - "print(\"so v1=v2\")\n", - "print(\"since final state is given to be critical state,then specific volume at critical point,\")\n", - "print(\"v2=0.003155 m^3/kg\")\n", - "v2=0.003155;#specific volume at critical point in m^3/kg\n", - "print(\"at 100 degree celcius saturation temperature,from steam table\")\n", - "print(\"vf_100=0.001044 m^3/kg,vg_100=1.6729 m^3/kg\")\n", - "vf_100=0.001044;\n", - "vg_100=1.6729;\n", - "vfg_100=vg_100-vf_100\n", - "print(\"and vfg_100=in m^3/kg=\"),round(vfg_100,2)\n", - "print(\"thus for initial quality being x1\")\n", - "v1=v2;#rigid vessel\n", - "x1=(v1-vf_100)/vfg_100\n", - "print(\"v1=vf_100+x1*vfg_100\")\n", - "print(\"so x1=\"),round(x1,3)\n", - "print(\"mass of water initially=total mass*(1-x1)\")\n", - "m=V/v2\n", - "print(\"total mass of fluid/water(m) in kg=\"),round(m,2)\n", - "v=m*vf_100\n", - "print(\"volume of water(v) in m^3=\"),round(v,4)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.7;pg no: 177" - ] - }, - { - "cell_type": "code", - "execution_count": 74, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.7, Page:177 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\n", - "on mollier diadram(h-s diagram)the slope of isobaric line may be given as\n", - "(dh/ds)_p=cons =slope of isobar\n", - "from 1st and 2nd law combined;\n", - "T*ds=dh-v*dp\n", - "(dh/ds)_p=cons = T\n", - "here temperature,T=773.15 K\n", - "here slope=(dh/ds))p=cons = 773.15\n" - ] - } - ], - "source": [ - "#cal of slope\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.7, Page:177 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 7\")\n", - "print(\"on mollier diadram(h-s diagram)the slope of isobaric line may be given as\")\n", - "print(\"(dh/ds)_p=cons =slope of isobar\")\n", - "print(\"from 1st and 2nd law combined;\")\n", - "print(\"T*ds=dh-v*dp\")\n", - "print(\"(dh/ds)_p=cons = T\")\n", - "print(\"here temperature,T=773.15 K\")\n", - "print(\"here slope=(dh/ds))p=cons = 773.15\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.8;pg no: 178" - ] - }, - { - "cell_type": "code", - "execution_count": 75, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.8, Page:178 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\n", - "at 0.15Mpa,from steam table;\n", - "hf=467.11 KJ/kg,hg=2693.6 KJ/kg\n", - "and hfg in KJ/kg= 2226.49\n", - "vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\n", - "and vfg in m^3/kg= 1.16\n", - "sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\n", - "and sfg=in KJ/kg K= 5.79\n", - "enthalpy at x=.10(h)in KJ/kg\n", - "h= 689.76\n", - "specific volume,(v)in m^3/kg\n", - "v= 0.12\n", - "entropy (s)in KJ/kg K\n", - "s= 2.01\n" - ] - } - ], - "source": [ - "#cal of entropy\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.8, Page:178 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 8\")\n", - "x=.10;#quality is 10%\n", - "print(\"at 0.15Mpa,from steam table;\")\n", - "print(\"hf=467.11 KJ/kg,hg=2693.6 KJ/kg\")\n", - "hf=467.11;\n", - "hg=2693.6;\n", - "hfg=hg-hf\n", - "print(\"and hfg in KJ/kg=\"),round(hfg,2)\n", - "print(\"vf=0.001053 m^3/kg,vg=1.1593 m^3/kg\")\n", - "vf=0.001053;\n", - "vg=1.1593;\n", - "vfg=vg-vf\n", - "print(\"and vfg in m^3/kg=\"),round(vfg,2)\n", - "print(\"sf=1.4336 KJ/kg,sg=7.2233 KJ/kg\")\n", - "sf=1.4336;\n", - "sg=7.2233;\n", - "sfg=sg-sf\n", - "print(\"and sfg=in KJ/kg K=\"),round(sfg,2)\n", - "print(\"enthalpy at x=.10(h)in KJ/kg\")\n", - "h=hf+x*hfg\n", - "print(\"h=\"),round(h,2)\n", - "print(\"specific volume,(v)in m^3/kg\")\n", - "v=vf+x*vfg\n", - "print(\"v=\"),round(v,2)\n", - "print(\"entropy (s)in KJ/kg K\")\n", - "s=sf+x*sfg\n", - "print(\"s=\"),round(s,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.9;pg no: 178" - ] - }, - { - "cell_type": "code", - "execution_count": 76, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.9, Page:178 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\n", - "work done during constant pressure process(W)=p1*(V2-V1)in KJ\n", - "now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\n", - "so v1 in m^3/kg=\n", - "now mass of steam(m) in kg= 0.32\n", - "specific volume at final state(v2)in m^3/kg\n", - "v2= 0.62\n", - "corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\n", - "v2>vg_1Mpa\n", - "hence state lies in superheated region,from the steam table by interpolation we get temperature as;\n", - "state lies between temperature of 1000 degree celcius and 1100 degree celcius\n", - "so exact temperature at final state(T)in K= 1077.61\n", - "thus internal energy at final state,1 Mpa,1077.61 degree celcius;\n", - "u2=4209.6 KJ/kg\n", - "internal energy at initial state(u1)in KJ/kg\n", - "u1= 2219.28\n", - "from first law of thermodynamics,Q-W=deltaU\n", - "so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ= 788.83\n" - ] - } - ], - "source": [ - "#cal of heat added\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.9, Page:178 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 9\")\n", - "p1=1*1000;#initial pressure of steam in Kpa\n", - "V1=0.05;#initial volume of steam in m^3\n", - "x1=.8;#dryness fraction is 80%\n", - "V2=0.2;#final volume of steam in m^3\n", - "p2=p1;#constant pressure process\n", - "print(\"work done during constant pressure process(W)=p1*(V2-V1)in KJ\")\n", - "W=p1*(V2-V1)\n", - "print(\"now from steam table at p1,vf=0.001127 m^3/kg,vg=0.19444 m^3/kg,uf=761.68 KJ/kg,ufg=1822 KJ/kg\")\n", - "vf=0.001127;\n", - "vg=0.19444;\n", - "uf=761.68;\n", - "ufg=1822;\n", - "v1=vf+x1*vg\n", - "print(\"so v1 in m^3/kg=\")\n", - "m=V1/v1\n", - "print(\"now mass of steam(m) in kg=\"),round(m,2)\n", - "m=0.32097;#take m=0.32097 approx.\n", - "print(\"specific volume at final state(v2)in m^3/kg\")\n", - "v2=V2/m\n", - "print(\"v2=\"),round(v2,2)\n", - "print(\"corresponding to this specific volume the final state is to be located for getting the internal energy at final state at 1 Mpa\")\n", - "print(\"v2>vg_1Mpa\")\n", - "print(\"hence state lies in superheated region,from the steam table by interpolation we get temperature as;\")\n", - "print(\"state lies between temperature of 1000 degree celcius and 1100 degree celcius\")\n", - "T=1000+((100*(.62311-.5871))/(.6335-.5871))\n", - "print(\"so exact temperature at final state(T)in K=\"),round(T,2)\n", - "print(\"thus internal energy at final state,1 Mpa,1077.61 degree celcius;\")\n", - "print(\"u2=4209.6 KJ/kg\")\n", - "u2=4209.6;\n", - "print(\"internal energy at initial state(u1)in KJ/kg\")\n", - "u1=uf+x1*ufg\n", - "print(\"u1=\"),round(u1,2)\n", - "print(\"from first law of thermodynamics,Q-W=deltaU\")\n", - "Q=m*(u2-u1)+W\n", - "print(\"so heat added(Q)=(U2-U1)+W=m*(u2-u1)+W in KJ=\"),round(Q,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.10;pg no: 179" - ] - }, - { - "cell_type": "code", - "execution_count": 77, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.10, Page:179 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\n", - "here steam is kept in rigid vessel,therefore its specific volume shall remain constant\n", - "it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\n", - "from superheated steam table;v1=0.2404 m^3/kg\n", - "at begining of condensation specific volume = 0.2404 m^3/kg\n", - "v2=0.2404 m^3/kg\n", - "this v2 shall be specific volume corresponding to saturated vapour state for condensation.\n", - "thus v2=vg=0.2404 m^3/kg\n", - "looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\n", - "by interpolation,temperature at begining of condensation(T2)in K\n", - "similarily,pressure(p2)in Kpa= 800.96\n" - ] - } - ], - "source": [ - "#cal of pressure\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.10, Page:179 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 10\")\n", - "p1=800;#initial pressure of steam in Kpa\n", - "T1=200;#initial temperature of steam in degree celcius\n", - "print(\"here steam is kept in rigid vessel,therefore its specific volume shall remain constant\")\n", - "print(\"it is superheated steam as Tsat=170.43 degree celcius at 800 Kpa\")\n", - "print(\"from superheated steam table;v1=0.2404 m^3/kg\")\n", - "print(\"at begining of condensation specific volume = 0.2404 m^3/kg\")\n", - "print(\"v2=0.2404 m^3/kg\")\n", - "v2=0.2404;\n", - "print(\"this v2 shall be specific volume corresponding to saturated vapour state for condensation.\")\n", - "print(\"thus v2=vg=0.2404 m^3/kg\")\n", - "vg=v2;\n", - "print(\"looking into steam table vg=0.2404 m^3/kg shall lie between temperature 175 degree celcius(vg=0.2168 m^3/kg)and 170 degree celcius(vg=0.2428 m^3/kg)and pressure 892 Kpa(175 degree celcius)and 791.7 Kpa(170 degree celcius).\")\n", - "print(\"by interpolation,temperature at begining of condensation(T2)in K\")\n", - "T2=175-((175-170)*(0.2404-0.2167))/(0.2428-.2168)\n", - "p=892-(((892-791.7)*(0.2404-0.2168))/(0.2428-0.2168))\n", - "print(\"similarily,pressure(p2)in Kpa=\"),round(p,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.11;pg no: 180" - ] - }, - { - "cell_type": "code", - "execution_count": 78, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.11, Page:180 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\n", - "from 1st and 2nd law;\n", - "T*ds=dh-v*dp\n", - "for isentropic process,ds=0\n", - "hence dh=v*dp\n", - "i.e (h2-h1)=v1*(p2-p1)\n", - "corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\n", - "p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\n", - "therefore enthalpy change(deltah)=(h2-h1) in KJ/kg= 0.2\n" - ] - } - ], - "source": [ - "#cal of enthalpy change\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.11, Page:180 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 11\")\n", - "p2=200;#feed water pump pressure in Kpa\n", - "print(\"from 1st and 2nd law;\")\n", - "print(\"T*ds=dh-v*dp\")\n", - "print(\"for isentropic process,ds=0\")\n", - "print(\"hence dh=v*dp\")\n", - "print(\"i.e (h2-h1)=v1*(p2-p1)\")\n", - "print(\"corresponding to initial state of saturated liquid at 30 degree celcius;from steam table;\")\n", - "print(\"p1=4.25 Kpa,vf=v1=0.001004 m^3/kg\")\n", - "p1=4.25;\n", - "v1=0.001004;\n", - "deltah=v1*(p2-p1)\n", - "print(\"therefore enthalpy change(deltah)=(h2-h1) in KJ/kg=\"),round(deltah,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.12;pg no: 180" - ] - }, - { - "cell_type": "code", - "execution_count": 79, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.12, Page:180 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\n", - "from steam table at 150 degree celcius\n", - "vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\n", - "so volume occupied by water(Vw)=3*V/(3+2) in m^3 1.2\n", - "and volume of steam(Vs) in m^3= 0.8\n", - "mass of water(mf)=Vw/Vf in kg 1099.91\n", - "mass of steam(mg)=Vs/Vg in kg 2.04\n", - "total mass in tank(m) in kg= 1101.95\n", - "quality or dryness fraction(x)\n", - "x= 0.002\n", - "NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\n" - ] - } - ], - "source": [ - "#cal of quality or dryness fraction\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.12, Page:180 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 12\")\n", - "V=2.;#volume of vessel in m^3\n", - "print(\"from steam table at 150 degree celcius\")\n", - "print(\"vf=0.001091 m^3/kg,vg=0.3928 m^3/kg\")\n", - "Vf=0.001091;\n", - "Vg=0.3928;\n", - "Vw=3*V/(3+2)\n", - "print(\"so volume occupied by water(Vw)=3*V/(3+2) in m^3\"),round(Vw,2)\n", - "Vs=2*V/(3+2)\n", - "print(\"and volume of steam(Vs) in m^3=\"),round(Vs,2)\n", - "mf=Vw/Vf\n", - "print(\"mass of water(mf)=Vw/Vf in kg\"),round(mf,2)\n", - "mg=Vs/Vg\n", - "print(\"mass of steam(mg)=Vs/Vg in kg\"),round(mg,2)\n", - "m=mf+mg\n", - "print(\"total mass in tank(m) in kg=\"),round(m,2)\n", - "print(\"quality or dryness fraction(x)\")\n", - "x=mg/m\n", - "print(\"x=\"),round(x,3)\n", - "print(\"NOTE=>answer given in book for mass=1103.99 kg is incorrect and correct answer is 1101.945 which is calculated above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.13;pg no: 181" - ] - }, - { - "cell_type": "code", - "execution_count": 80, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.13, Page:181 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\n", - "fron S.F.S.E on steam turbine;\n", - "W=h1-h2\n", - "initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\n", - "h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\n", - "reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\n", - "else from steam tables at 50 degree celcius saturation temperature;\n", - "hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\n", - "hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\n", - "here s1=s2,let dryness fraction at 2 be x2\n", - "x2= 0.75\n", - "hence enthalpy at state 2\n", - "h2 in KJ/kg= 1994.84\n", - "steam turbine work(W)in KJ/kg\n", - "W=h1-h2\n", - "so turbine output=W 891.36\n" - ] - } - ], - "source": [ - "#cal of turbine output\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.13, Page:181 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 13\")\n", - "print(\"fron S.F.S.E on steam turbine;\")\n", - "print(\"W=h1-h2\")\n", - "print(\"initially at 4Mpa,300 degree celcius the steam is super heated so enthalpy from superheated steam or mollier diagram\")\n", - "print(\"h1=2886.2 KJ/kg,s1=6.2285 KJ/kg K\")\n", - "h1=2886.2;\n", - "s1=6.2285;\n", - "print(\"reversible adiabatic expansion process has entropy remaining constant.on mollier diagram the state 2 can be simply located at intersection of constant temperature line for 50 degree celcius and isentropic expansion line.\")\n", - "print(\"else from steam tables at 50 degree celcius saturation temperature;\")\n", - "print(\"hf=209.33 KJ/kg,sf=0.7038 KJ/kg K\")\n", - "hf=209.33;\n", - "sf=0.7038;\n", - "print(\"hfg=2382.7 KJ/kg,sfg=7.3725 KJ/kg K\")\n", - "hfg=2382.7;\n", - "sfg=7.3725;\n", - "print(\"here s1=s2,let dryness fraction at 2 be x2\")\n", - "x2=(s1-sf)/sfg\n", - "print(\"x2=\"),round(x2,2)\n", - "print(\"hence enthalpy at state 2\")\n", - "h2=hf+x2*hfg\n", - "print(\"h2 in KJ/kg=\"),round(h2,2)\n", - "print(\"steam turbine work(W)in KJ/kg\")\n", - "W=h1-h2\n", - "print(\"W=h1-h2\")\n", - "print(\"so turbine output=W\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.14;pg no: 181" - ] - }, - { - "cell_type": "code", - "execution_count": 81, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.14, Page:181 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\n", - "it is constant volume process\n", - "volume of vessel(V)=mass of vapour * specific volume of vapour\n", - "initial specific volume,v1\n", - "v1=vf_100Kpa+x1*vfg_100 in m^3/kg\n", - "at 100 Kpa from steam table;\n", - "hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\n", - " here vfg_100Kpa= in m^3/kg= 1.69\n", - "so v1= in m^3/kg= 0.85\n", - "and volume of vessel(V) in m^3= 42.38\n", - "enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg 1546.46\n", - "internal energy in the beginning=U1=m1*u1 in KJ 146171.0\n", - "let the mass of dry steam added be m,final specific volume inside vessel,v2\n", - "v2=vf_1000Kpa+x2*vfg_1000Kpa\n", - "at 2000 Kpa,from steam table,\n", - "vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\n", - "total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\n", - "V/v2=V/vg_2000Kpa+V/v1\n", - "so v2 in m^3/kg= 0.09\n", - "here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\n", - "at 1000 Kpa from steam table,\n", - "hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\n", - "here vfg_1000Kpa= in m^3/kg= 0.19\n", - "so x2= 0.46\n", - "for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\n", - "so mass of dry steam at 2000 Kpa to be added(m)in kg\n", - "m=(100*(h1-h2))/(h2-hg_2000Kpa)= 11.97\n", - "quality of final mixture x2= 0.46\n" - ] - } - ], - "source": [ - "#cal of quality of final mixture\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.14, Page:181 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 14\")\n", - "x1=0.5;#dryness fraction \n", - "m1=100;#mass of steam in kg\n", - "v1=0.8475;#\n", - "print(\"it is constant volume process\")\n", - "print(\"volume of vessel(V)=mass of vapour * specific volume of vapour\")\n", - "print(\"initial specific volume,v1\")\n", - "print(\"v1=vf_100Kpa+x1*vfg_100 in m^3/kg\")\n", - "print(\"at 100 Kpa from steam table;\")\n", - "print(\"hf_100Kpa=417.46 KJ/kg,uf_100Kpa=417.36 KJ/kg,vf_100Kpa=0.001043 m^3/kg,hfg_100Kpa=2258 KJ/kg,ufg_100Kpa=2088.7 KJ/kg,vg_100Kpa=1.6940 m^3/kg\")\n", - "hf_100Kpa=417.46;\n", - "uf_100Kpa=417.36;\n", - "vf_100Kpa=0.001043;\n", - "hfg_100Kpa=2258;\n", - "ufg_100Kpa=2088.7;\n", - "vg_100Kpa=1.6940;\n", - "vfg_100Kpa=vg_100Kpa-vf_100Kpa\n", - "print(\" here vfg_100Kpa= in m^3/kg=\"),round(vfg_100Kpa,2)\n", - "v1=vf_100Kpa+x1*vfg_100Kpa\n", - "print(\"so v1= in m^3/kg=\"),round(v1,2)\n", - "V=m1*x1*v1\n", - "print(\"and volume of vessel(V) in m^3=\"),round(V,2)\n", - "h1=hf_100Kpa+x1*hfg_100Kpa\n", - "print(\"enthalpy at 1,h1=hf_100Kpa+x1*hfg_100Kpa in KJ/kg\"),round(h1,2)\n", - "U1=m1*(uf_100Kpa+x1*ufg_100Kpa)\n", - "print(\"internal energy in the beginning=U1=m1*u1 in KJ\"),round(U1,2)\n", - "print(\"let the mass of dry steam added be m,final specific volume inside vessel,v2\")\n", - "print(\"v2=vf_1000Kpa+x2*vfg_1000Kpa\")\n", - "print(\"at 2000 Kpa,from steam table,\")\n", - "print(\"vg_2000Kpa=0.09963 m^3/kg,ug_2000Kpa=2600.3 KJ/kg,hg_2000Kpa=2799.5 KJ/kg\")\n", - "vg_2000Kpa=0.09963;\n", - "ug_2000Kpa=2600.3;\n", - "hg_2000Kpa=2799.5;\n", - "print(\"total mass inside vessel=mass of steam at2000 Kpa+mass of mixture at 100 Kpa\")\n", - "print(\"V/v2=V/vg_2000Kpa+V/v1\")\n", - "v2=1/((1/vg_2000Kpa)+(1/v1))\n", - "print(\"so v2 in m^3/kg=\"),round(v2,2)\n", - "print(\"here v2=vf_1000Kpa+x2*vfg_1000Kpa in m^3/kg\")\n", - "print(\"at 1000 Kpa from steam table,\")\n", - "print(\"hf_1000Kpa=762.81 KJ/kg,hfg_1000Kpa=2015.3 KJ/kg,vf_1000Kpa=0.001127 m^3/kg,vg_1000Kpa=0.19444 m^3/kg\")\n", - "hf_1000Kpa=762.81;\n", - "hfg_1000Kpa=2015.3;\n", - "vf_1000Kpa=0.001127;\n", - "vg_1000Kpa=0.19444;\n", - "vfg_1000Kpa=vg_1000Kpa-vf_1000Kpa\n", - "print(\"here vfg_1000Kpa= in m^3/kg=\"),round(vfg_1000Kpa,2)\n", - "x2=(v2-vf_1000Kpa)/vfg_1000Kpa\n", - "print(\"so x2=\"),round(x2,2)\n", - "print(\"for adiabatic mixing,(100+m)*h2=100*h1+m*hg_2000Kpa\")\n", - "print(\"so mass of dry steam at 2000 Kpa to be added(m)in kg\")\n", - "m=(100*(h1-(hf_1000Kpa+x2*hfg_1000Kpa)))/((hf_1000Kpa+x2*hfg_1000Kpa)-hg_2000Kpa)\n", - "print(\"m=(100*(h1-h2))/(h2-hg_2000Kpa)=\"),round(m,2)\n", - "print(\"quality of final mixture x2=\"),round(x2,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.15;pg no: 183" - ] - }, - { - "cell_type": "code", - "execution_count": 82, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.15, Page:183 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\n", - "from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\n", - "condenser pressure(p_condenser) in Kpa= 7.3\n", - "partial pressure of steam corresponding to35 degree celcius from steam table;\n", - "p_steam=5.628 Kpa\n", - "enthalpy corresponding to 35 degree celcius from steam table,\n", - "hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\n", - "let quality of steam entering be x\n", - "from energy balance;\n", - "mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\n", - "so dryness fraction of steam entering(x)is given as\n", - "x= 0.97\n" - ] - } - ], - "source": [ - "#cal of dryness fraction of steam entering\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.15, Page:183 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 15\")\n", - "p_vaccum=71.5;#recorded condenser vaccum in cm of mercury\n", - "p_barometer=76.8;#barometer reading in cm of mercury\n", - "T_cond=35;#temperature of condensation in degree celcius\n", - "T_hotwell=27.6;#temperature of hot well in degree celcius\n", - "m_cond=1930;#mass of condensate per hour\n", - "m_w=62000;#mass of cooling water per hour\n", - "Ti=8.51;#initial temperature in degree celcius\n", - "To=26.24;#outlet temperature in degree celcius\n", - "print(\"from dalton law of partial pressure the total pressure inside condenser will be sum of partial pressures of vapour and liquid inside.\")\n", - "p_condenser=(p_barometer-p_vaccum)*101.325/73.55\n", - "print(\"condenser pressure(p_condenser) in Kpa=\"),round(p_condenser,2)\n", - "print(\"partial pressure of steam corresponding to35 degree celcius from steam table;\")\n", - "print(\"p_steam=5.628 Kpa\")\n", - "p_steam=5.628;#partial pressure of steam\n", - "print(\"enthalpy corresponding to 35 degree celcius from steam table,\")\n", - "print(\"hf=146.68 KJ/kg,hfg=2418.6 KJ/kg\")\n", - "hf=146.68;\n", - "hfg=2418.6;\n", - "print(\"let quality of steam entering be x\")\n", - "print(\"from energy balance;\")\n", - "print(\"mw*(To-Ti)*4.18=m_cond*(hf+x*hfg-4.18*T_hotwell)\")\n", - "print(\"so dryness fraction of steam entering(x)is given as\")\n", - "x=(((m_w*(To-Ti)*4.18)/m_cond)-hf+4.18*T_hotwell)/hfg\n", - "print(\"x=\"),round(x,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.16;pg no: 184" - ] - }, - { - "cell_type": "code", - "execution_count": 83, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.16, Page:184 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\n", - "heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\n", - "area(A) in m^2= 0.03\n", - "so p1=in Kpa= 419.61\n", - "now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\n", - "volume of water contained(V1) in m^3= 0.001\n", - "mass of water(m) in kg= 0.63\n", - "heat supplied shall cause sensible heating and latent heating\n", - "hence,enthalpy change=heat supplied\n", - "Q=((hf+x*hfg)-(4.18*T)*m)\n", - "so dryness fraction of steam produced(x)can be calculated as\n", - "so x= 0.46\n", - "internal energy of water(U1)in KJ,initially\n", - "U1= 393.69\n", - "finally,internal energy of wet steam(U2)in KJ\n", - "U2=m*h2-p2*V2\n", - "here V2 in m^3= 0.13\n", - "hence U2= 940.68\n", - "hence change in internal energy(U) in KJ= 547.21\n", - "work done(W) in KJ= 53.01\n" - ] - } - ], - "source": [ - "#cal of change in internal energy and work done\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "import math\n", - "print\"Example 6.16, Page:184 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 16\")\n", - "F=10;#force applied externally upon piston in KN\n", - "d=.2;#diameter in m\n", - "h=0.02;#depth to which water filled in m \n", - "P_atm=101.3;#atmospheric pressure in Kpa\n", - "rho=1000;#density of water in kg/m^3\n", - "Q=600;#heat supplied to water in KJ\n", - "T=150;#temperature of water in degree celcius\n", - "print(\"heating of water in vessel as described above is a constant pressure heating. pressure at which process occurs(p)=F/A+P_atm in Kpa\")\n", - "A=math.pi*d**2/4\n", - "print(\"area(A) in m^2=\"),round(A,2)\n", - "p1=F/A+P_atm\n", - "print(\"so p1=in Kpa=\"),round(p1,2)\n", - "print(\"now at 419.61 Kpa,hf=612.1 KJ/kg,hfg=2128.7 KJ/kg,vg=0.4435 m^3/kg\")\n", - "hf=612.1;\n", - "hfg=2128.7;\n", - "vg=0.4435;\n", - "V1=math.pi*d**2*h/4\n", - "print(\"volume of water contained(V1) in m^3=\"),round(V1,3)\n", - "m=V1*rho\n", - "print(\"mass of water(m) in kg=\"),round(m,2)\n", - "print(\"heat supplied shall cause sensible heating and latent heating\")\n", - "print(\"hence,enthalpy change=heat supplied\")\n", - "print(\"Q=((hf+x*hfg)-(4.18*T)*m)\")\n", - "print(\"so dryness fraction of steam produced(x)can be calculated as\")\n", - "x=((Q/m)+4.18*T-hf)/hfg\n", - "print(\"so x=\"),round(x,2)\n", - "print(\"internal energy of water(U1)in KJ,initially\")\n", - "h1=4.18*T;#enthalpy of water in KJ/kg\n", - "U1=m*h1-p1*V1\n", - "print(\"U1=\"),round(U1,2)\n", - "U1=393.5;#approx.\n", - "print(\"finally,internal energy of wet steam(U2)in KJ\")\n", - "print(\"U2=m*h2-p2*V2\")\n", - "V2=m*x*vg\n", - "print(\"here V2 in m^3=\"),round(V2,2)\n", - "p2=p1;#constant pressure process\n", - "U2=(m*(hf+x*hfg))-p2*V2\n", - "print(\"hence U2=\"),round(U2,2)\n", - "U2=940.71;#approx.\n", - "U=U2-U1\n", - "print(\"hence change in internal energy(U) in KJ=\"),round(U,2)\n", - "p=p1;\n", - "W=p*(V2-V1)\n", - "print(\"work done(W) in KJ=\"),round(W,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.17;pg no: 185" - ] - }, - { - "cell_type": "code", - "execution_count": 84, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.17, Page:185 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\n", - "consider throttling calorimeter alone,\n", - "degree of superheat(T_sup)in degree celcius\n", - "T_sup= 18.2\n", - "enthalpy of superheated steam(h_sup)in KJ/kg\n", - "h_sup= 2711.99\n", - "at 120 degree celcius,h=2673.95 KJ/kg from steam table\n", - "now enthalpy before throttling = enthalpy after throttling\n", - "hf+x2*hfg=h_sup\n", - "here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\n", - "so x2= 0.96\n", - "for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\n", - "overall dryness fraction(x)= 0.91\n" - ] - } - ], - "source": [ - "#cal of overall dryness fraction\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.17, Page:185 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 17\")\n", - "ms=40;#mass of steam in kg\n", - "mw=2.2;#mass of water in kg\n", - "p1=1.47;#pressure before throttling in Mpa\n", - "T2=120;#temperature after throttling in degree celcius\n", - "p2=107.88;#pressure after throttling in Kpa\n", - "Cp_sup=2.09;#specific heat of superheated steam in KJ/kg K\n", - "print(\"consider throttling calorimeter alone,\")\n", - "print(\"degree of superheat(T_sup)in degree celcius\")\n", - "T_sup=T2-101.8\n", - "print(\"T_sup=\"),round(T_sup,2)\n", - "print(\"enthalpy of superheated steam(h_sup)in KJ/kg\")\n", - "h=2673.95;\n", - "h_sup=h+T_sup*Cp_sup\n", - "print(\"h_sup=\"),round(h_sup,2)\n", - "print(\"at 120 degree celcius,h=2673.95 KJ/kg from steam table\")\n", - "print(\"now enthalpy before throttling = enthalpy after throttling\")\n", - "print(\"hf+x2*hfg=h_sup\")\n", - "print(\"here at 1.47 Mpa,hf=840.513 KJ/kg,hfg=1951.02 KJ/kg from steam table\")\n", - "hf=840.513;\n", - "hfg=1951.02;\n", - "x2=(h_sup-hf)/hfg\n", - "print(\"so x2=\"),round(x2,2)\n", - "print(\"for seperating calorimeter alone,dryness fraction,x1=(ms-mw)/ms\")\n", - "x1=(ms-mw)/ms\n", - "x=x1*x2\n", - "print(\"overall dryness fraction(x)=\"),round(x,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.18;pg no: 185" - ] - }, - { - "cell_type": "code", - "execution_count": 85, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.18, Page:185 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\n", - "here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\n", - "final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\n", - "Q in KJ= 200.0\n", - "final enthalpy of dry steam at 15 bar,h2=hg_15bar\n", - "h2=2792.2 KJ/kg from steam table\n", - "let initial dryness fraction be x1,initial enthalpy,\n", - "h1=hf_10bar+x1*hfg_10bar.........eq1\n", - "here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\n", - "also heat balance yields,\n", - "h1+Q=h2\n", - "so h1=h2-Q in KJ/kg\n", - "so by eq 1=>x1= 0.91\n", - "heat added(Q)in KJ= 200.0\n", - "and initial quality(x1) 0.91\n" - ] - } - ], - "source": [ - "#cal of heat added and initial quality\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.18, Page:185 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 18\")\n", - "v=0.4;#volume of air in part A and part B in m^3\n", - "p1=10*10**5;#initial pressure of steam in pa\n", - "p2=15*10**5;#final pressure of steam in pa\n", - "print(\"here heat addition to part B shall cause evaporation of water and subsequently the rise in pressure.\")\n", - "print(\"final,part B has dry steam at 15 bar.In order to have equilibrium the part A shall also have pressure of 15 bar.thus heat added\")\n", - "Q=v*(p2-p1)/1000\n", - "print(\"Q in KJ=\"),round(Q,2)\n", - "print(\"final enthalpy of dry steam at 15 bar,h2=hg_15bar\")\n", - "print(\"h2=2792.2 KJ/kg from steam table\")\n", - "h2=2792.2;\n", - "print(\"let initial dryness fraction be x1,initial enthalpy,\")\n", - "print(\"h1=hf_10bar+x1*hfg_10bar.........eq1\")\n", - "print(\"here at 10 bar,hf_10bar=762.83 KJ/kg,hfg_10bar=2015.3 KJ/kg from steam table\")\n", - "hf_10bar=762.83;\n", - "hfg_10bar=2015.3;\n", - "print(\"also heat balance yields,\")\n", - "print(\"h1+Q=h2\")\n", - "print(\"so h1=h2-Q in KJ/kg\")\n", - "h1=h2-Q\n", - "x1=(h1-hf_10bar)/hfg_10bar\n", - "print(\"so by eq 1=>x1=\"),round(x1,2)\n", - "print(\"heat added(Q)in KJ=\"),round(Q,2)\n", - "print(\"and initial quality(x1)\"),round(x1,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.19;pg no: 186" - ] - }, - { - "cell_type": "code", - "execution_count": 86, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.19, Page:186 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\n", - "from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\n", - "specific volume of wet steam in cylinder,v1 in m^3/kg= 0.75\n", - "dryness fraction of initial steam(x1)= 0.6\n", - "initial enthalpy of wet steam,h1 in KJ/kg= 1801.83\n", - "at 400 degree celcius specific volume of steam,v2 in m^3/kg= 1.55\n", - "for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\n", - "actual pressure can be obtained by interpolation\n", - "p2=0.20 MPa(approx.)\n", - "saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\n", - "finally the degree of superheat(T_sup)in K\n", - "T_sup=T-t\n", - "final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\n", - "heat added during process(deltaQ)in KJ\n", - "deltaQ=m*(h2-h1)\n", - "internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\n", - "here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\n", - "internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\n", - "u2=2966.7 KJ/kg\n", - "change in internal energy(deltaU)in KJ\n", - "deltaU= 3807.41\n", - "form first law of thermodynamics,work done(deltaW)in KJ\n", - "deltaW=deltaQ-deltaU 616.88\n", - "so heat transfer(deltaQ)in KJ 4424.3\n", - "and work transfer(deltaW)in KJ 616.88\n", - "NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\n", - "and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\n" - ] - } - ], - "source": [ - "#cal of heat and work transfer \n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.19, Page:186 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 19\")\n", - "m=3;#mass of wet steam in kg\n", - "p=1.4;#pressure of wet steam in bar\n", - "V1=2.25;#initial volume in m^3\n", - "V2=4.65;#final volume in m^3\n", - "T=400;#temperature of steam in degreee celcius\n", - "print(\"from steam table,vg=1.2455 m^3/kg,hf=457.99 KJ/kg,hfg=2232.3 KJ/kg\")\n", - "vg=1.2455;\n", - "hf=457.99;\n", - "hfg=2232.3;\n", - "v1=V1/m\n", - "print(\"specific volume of wet steam in cylinder,v1 in m^3/kg=\"),round(v1,2)\n", - "x1=v1/vg\n", - "print(\"dryness fraction of initial steam(x1)=\"),round(x1,2)\n", - "x1=0.602;#approx.\n", - "h1=hf+x1*hfg\n", - "print(\"initial enthalpy of wet steam,h1 in KJ/kg=\"),round(h1,2)\n", - "v2=V2/m\n", - "print(\"at 400 degree celcius specific volume of steam,v2 in m^3/kg=\"),round(v2,2)\n", - "print(\"for specific volume of 1.55 m^3/kg at 400 degree celcius the pressure can be seen from the steam table.From superheated steam tables the specific volume of 1.55 m^3/kg lies between the pressure of 0.10 Mpa (specific volume 3.103 m^3/kg at400 degree celcius)and 0.20 Mpa(specific volume 1.5493 m^3/kg at 400 degree celcius)\")\n", - "print(\"actual pressure can be obtained by interpolation\")\n", - "p2=.1+((0.20-0.10)/(1.5493-3.103))*(1.55-3.103)\n", - "print(\"p2=0.20 MPa(approx.)\")\n", - "p2=0.20;\n", - "print(\"saturation temperature at 0.20 Mpa(t)=120.23 degree celcius from steam table\")\n", - "t=120.23;\n", - "print(\"finally the degree of superheat(T_sup)in K\")\n", - "print(\"T_sup=T-t\")\n", - "T_sup=T-t\n", - "print(\"final enthalpy of steam at 0.20 Mpa and 400 degree celcius,h2=3276.6 KJ/kg from steam table\")\n", - "h2=3276.6;\n", - "print(\"heat added during process(deltaQ)in KJ\")\n", - "print(\"deltaQ=m*(h2-h1)\")\n", - "deltaQ=m*(h2-h1)\n", - "print(\"internal energy of initial wet steam,u1=uf+x1*ufg in KJ/kg\")\n", - "print(\"here at 1.4 bar,from steam table,uf=457.84 KJ/kg,ufg=2059.34 KJ/kg\")\n", - "uf=457.84;\n", - "ufg=2059.34;\n", - "u1=uf+x1*ufg\n", - "print(\"internal energy of final state,u2=u at 0.2 Mpa,400 degree celcius\")\n", - "print(\"u2=2966.7 KJ/kg\")\n", - "u2=2966.7;\n", - "print(\"change in internal energy(deltaU)in KJ\")\n", - "deltaU=m*(u2-u1)\n", - "print(\"deltaU=\"),round(deltaU,2)\n", - "print(\"form first law of thermodynamics,work done(deltaW)in KJ\")\n", - "deltaW=deltaQ-deltaU\n", - "print(\"deltaW=deltaQ-deltaU\"),round(deltaW,2)\n", - "print(\"so heat transfer(deltaQ)in KJ\"),round(deltaQ,2)\n", - "print(\"and work transfer(deltaW)in KJ\"),round(deltaW,2)\n", - "print(\"NOTE=>In book value of u1=1707.86 KJ/kg is calculated wrong taking x1=0.607,hence correct value of u1 using x1=0.602 is 1697.5627 KJ/kg\")\n", - "print(\"and corresponding values of heat transfer= 4424.2962 KJ and work transfer=616.88424 KJ.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 6.20;pg no: 187" - ] - }, - { - "cell_type": "code", - "execution_count": 87, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 6.20, Page:187 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\n", - "here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\n", - "at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\n", - "finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\n", - "h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\n", - "h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\n", - "so final temperature(T2)in K\n", - "T2= 495.43\n", - "entropy for final state(s2)in KJ/kg K\n", - "s2= 8.82\n", - "here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\n", - "so change in entropy(deltaS)in KJ/kg K\n", - "deltaS= 1.06\n", - "final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\n", - "here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\n", - "percentage of vessel volume initially occupied by steam(V)= 9.99\n" - ] - } - ], - "source": [ - "#cal of percentage of vessel volume initially occupied by steam\n", - "#intiation of all variables\n", - "# Chapter 6\n", - "print\"Example 6.20, Page:187 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 6 Example 20\")\n", - "print(\"here throttling process is occuring therefore enthalpy before and after expansion remains same.Let initial and final states be given by 1 and 2.Initial enthalpy,from steam table.\")\n", - "print(\"at 500 degree celcius,h1_10bar_500oc=3478.5 KJ/kg,s1_10bar_500oc=7.7622 KJ/kg K,v1_10bar_500oc=0.3541 m^3/kg\")\n", - "h1_10bar_500oc=3478.5;\n", - "s1_10bar_500oc=7.7622;\n", - "v1_10bar_500oc=0.3541;\n", - "print(\"finally pressure becomes 1 bar so finally enthalpy(h2) at this pressure(of 1 bar)is also 3478.5 KJ/kg which lies between superheat temperature of 400 degree celcius and 500 degree celcius at 1 bar.Let temperature be T2,\")\n", - "h2=h1_10bar_500oc;\n", - "print(\"h_1bar_400oc=3278.2 KJ/kg,h_1bar_500oc=3488.1 KJ/kg from steam table\")\n", - "h_1bar_400oc=3278.2;\n", - "h_1bar_500oc=3488.1;\n", - "print(\"h2=h_1bar_400oc+(h_1bar_500oc-h_1bar_400oc)*(T2-400)/(500-400)\")\n", - "print(\"so final temperature(T2)in K\")\n", - "T2=400+((h2-h_1bar_400oc)*(500-400)/(h_1bar_500oc-h_1bar_400oc))\n", - "print(\"T2=\"),round(T2,2)\n", - "print(\"entropy for final state(s2)in KJ/kg K\")\n", - "s_1bar_400oc=8.5435;\n", - "s_1bar_500oc=8.8342;\n", - "s2=s_1bar_400oc+((s_1bar_500oc-s_1bar_400oc)*(495.43-400)/(500-400))\n", - "print(\"s2=\"),round(s2,2)\n", - "print(\"here from steam table,s_1bar_400oc=8.5435 KJ/kg K,s_1bar_500oc=8.8342 KJ/kg K\")\n", - "print(\"so change in entropy(deltaS)in KJ/kg K\")\n", - "deltaS=s2-s1_10bar_500oc\n", - "print(\"deltaS=\"),round(deltaS,2)\n", - "print(\"final specific volume,v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400)) in m^3/kg\")\n", - "print(\"here from steam table,v_1bar_500oc=3.565 m^3/kg,v_1bar_400oc=3.103 m^3/kg\")\n", - "v_1bar_500oc=3.565;\n", - "v_1bar_400oc=3.103;\n", - "v2=v_1bar_400oc+((v_1bar_500oc-v_1bar_400oc)*(95.43)/(500-400))\n", - "V=v1_10bar_500oc*100/v2\n", - "print(\"percentage of vessel volume initially occupied by steam(V)=\"),round(V,2)\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter7-Copy1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter7-Copy1.ipynb deleted file mode 100755 index c10f28b4..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter7-Copy1.ipynb +++ /dev/null @@ -1,1452 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 7:Availability and General Thermodynamic Relation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.1;page no: 218" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.1, Page:218 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\n", - "let us neglect the potential energy change during the flow.\n", - "applying S.F.E.E,neglecting inlet velocity and change in potential energy,\n", - "W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\n", - "W_max=(h1-h2)-To*(s1-s2)-C2^2/2\n", - "from steam tables,\n", - "h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\n", - "given To=288 K\n", - "so W_max in KJ/kg= 457.1\n", - "maximum possible work(W_max) in KW= 1142.76\n" - ] - } - ], - "source": [ - "#cal of maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.1, Page:218 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\")\n", - "C2=150;#leave velocity of steam in m/s\n", - "m=2.5;#steam mass flow rate in kg/s\n", - "print(\"let us neglect the potential energy change during the flow.\")\n", - "print(\"applying S.F.E.E,neglecting inlet velocity and change in potential energy,\")\n", - "print(\"W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\")\n", - "print(\"W_max=(h1-h2)-To*(s1-s2)-C2^2/2\")\n", - "print(\"from steam tables,\")\n", - "print(\"h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\")\n", - "h1=3034.8;\n", - "s1=6.8844;\n", - "h2=2776.4;\n", - "s2=7.6134;\n", - "print(\"given To=288 K\")\n", - "To=288;\n", - "W_max=(h1-h2)-To*(s1-s2)-(C2**2/2*10**-3)\n", - "print(\"so W_max in KJ/kg=\"),round(W_max,2)\n", - "W_max=m*W_max\n", - "print(\"maximum possible work(W_max) in KW=\"),round(W_max,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.2;page no: 219" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.2, Page:219 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\n", - "In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\n", - "BOTH THE TANKS HAVE SAME INTERNAL ENERGY\n", - "availability of air in tank,A\n", - "A=(E-Uo)+Po*(V-Vo)-To*(S-So)\n", - "=m*{(e-uo)+Po(v-vo)-To(s-so)}\n", - "m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\n", - "so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\n", - "for tank A,P in pa,so availability_A in KJ= 1.98\n", - "for tank B,P=3*10^5 pa,so availability_B in KJ= 30.98\n", - "so availability of air in tank B is more than that of tank A\n", - "availability of air in tank A=1.98 KJ\n", - "availability of air in tank B=30.98 KJ\n" - ] - } - ], - "source": [ - "#cal of availability of air in tank A,B\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.2, Page:219 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\")\n", - "m=1.;#mass of air in kg\n", - "Po=1.*10**5;#atmospheric pressure in pa\n", - "To=(15.+273.);#temperature of atmosphere in K\n", - "Cv=0.717;#specific heat at constant volume in KJ/kg K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", - "T=(50.+273.);#temperature of tanks A and B in K\n", - "print(\"In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\")\n", - "print(\"BOTH THE TANKS HAVE SAME INTERNAL ENERGY\")\n", - "print(\"availability of air in tank,A\")\n", - "print(\"A=(E-Uo)+Po*(V-Vo)-To*(S-So)\")\n", - "print(\"=m*{(e-uo)+Po(v-vo)-To(s-so)}\")\n", - "print(\"m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\")\n", - "print(\"so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\")\n", - "P=1.*10**5;#pressure in tank A in pa\n", - "availability_A=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", - "print(\"for tank A,P in pa,so availability_A in KJ=\"),round(availability_A,2)\n", - "P=3.*10**5;#pressure in tank B in pa\n", - "availability_B=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", - "print(\"for tank B,P=3*10^5 pa,so availability_B in KJ=\"),round(availability_B,2)\n", - "print(\"so availability of air in tank B is more than that of tank A\")\n", - "print(\"availability of air in tank A=1.98 KJ\")\n", - "print(\"availability of air in tank B=30.98 KJ\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.3;page no: 221" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.3, Page:221 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\n", - "inlet conditions,\n", - "from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\n", - "outlet conditions,at 0.05 bar and 0.95 dryness fraction\n", - "from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\n", - "so s2= in KJ/kg K= 8.0\n", - "and h2= in KJ/kg= 2440.34\n", - "neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\n", - "w in KJ/kg= 598.06\n", - "power output in KW= 8970.97\n", - "maximum work for given end states,\n", - "w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg 850.43\n", - "w_max in KW 12755.7\n", - "so maximum power output=12755.7 KW\n", - "maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\n", - "A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\n", - "=(h2-ho)+V2^2/2-To(s2-so)\n", - "approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\n", - "from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\n", - "maximum work available from exhaust steam,A_exhaust in KJ/kg\n", - "A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so) 151.1\n", - "maximum power that could be obtained from exhaust steam in KW= 2266.5\n", - "so maximum power from exhaust steam=2266.5 KW\n" - ] - } - ], - "source": [ - "#cal of maximum power output and that could be obtained from exhaust steam\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.3, Page:221 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\")\n", - "m=15;#steam flow rate in kg/s\n", - "V2=160;#exit velocity of steam in m/s\n", - "To=(15+273);#pond water temperature in K\n", - "print(\"inlet conditions,\")\n", - "print(\"from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\")\n", - "h1=3051.2;\n", - "s1=7.1229;\n", - "print(\"outlet conditions,at 0.05 bar and 0.95 dryness fraction\")\n", - "print(\"from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\")\n", - "sf=0.4764;\n", - "s_fg=7.9187;\n", - "x=0.95;\n", - "hf=137.82;\n", - "h_fg=2423.7;\n", - "s2=sf+x*s_fg\n", - "print(\"so s2= in KJ/kg K=\"),round(s2,2)\n", - "h2=hf+x*h_fg\n", - "print(\"and h2= in KJ/kg=\"),round(h2,2)\n", - "print(\"neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\")\n", - "w=(h1-h2)-V2**2*10**-3/2\n", - "print(\"w in KJ/kg=\"),round(w,2)\n", - "print(\"power output in KW=\"),round(m*w,2)\n", - "print(\"maximum work for given end states,\")\n", - "w_max=(h1-To*s1)-(h2+V2**2*10**-3/2-To*s2)\n", - "print(\"w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg\"),round(w_max,2)\n", - "w_max=850.38;#approx.\n", - "w_max=m*w_max\n", - "print(\"w_max in KW\"),round(w_max,2)\n", - "print(\"so maximum power output=12755.7 KW\")\n", - "print(\"maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\")\n", - "print(\"A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\")\n", - "print(\"=(h2-ho)+V2^2/2-To(s2-so)\")\n", - "print(\"approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\")\n", - "print(\"from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\")\n", - "ho=62.99;\n", - "so=0.2245;\n", - "print(\"maximum work available from exhaust steam,A_exhaust in KJ/kg\")\n", - "A_exhaust=(h2-ho)+V2**2*10**-3/2-To*(s2-so)\n", - "A_exhaust=151.1;#approx.\n", - "print(\"A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so)\"),round(A_exhaust,2)\n", - "print(\"maximum power that could be obtained from exhaust steam in KW=\"),round(m*A_exhaust,2)\n", - "print(\"so maximum power from exhaust steam=2266.5 KW\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.4;page no: 222" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.4, Page:222 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\n", - "for dead state of water,\n", - "from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\n", - "for initial state of water,\n", - "from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\n", - "for final state of water,\n", - "from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\n", - "availability at any state can be given by\n", - "A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\n", - "so availability at initial state,A1 in KJ\n", - "A1= 2703.28\n", - "and availability at final state,A2 in KJ\n", - "A2= 1.09\n", - "change in availability,A2-A1 in KJ= -2702.19\n", - "hence availability decreases by 2702.188 KJ\n", - "NOTE=>In this question,due to large calculations,answers are approximately correct.\n" - ] - } - ], - "source": [ - "#cal of availability at initial,final state and also change\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.4, Page:222 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\")\n", - "m=5;#mass of steam in kg\n", - "z1=10;#initial elevation in m\n", - "V1=25;#initial velocity of steam in m/s\n", - "z2=2;#final elevation in m\n", - "V2=10;#final velocity of steam in m/s\n", - "Po=100;#environmental pressure in Kpa\n", - "To=(25+273);#environmental temperature in K\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"for dead state of water,\")\n", - "print(\"from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\")\n", - "uo=104.86;\n", - "vo=1.0029*10**-3;\n", - "so=0.3673;\n", - "print(\"for initial state of water,\")\n", - "print(\"from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\")\n", - "u1=2550;\n", - "v1=0.5089;\n", - "s1=6.93;\n", - "print(\"for final state of water,\")\n", - "print(\"from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\")\n", - "u2=83.94;\n", - "v2=1.0018*10**-3;\n", - "s2=0.2966;\n", - "print(\"availability at any state can be given by\")\n", - "print(\"A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\")\n", - "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+V1**2*10**-3/2+g*z1*10**-3)\n", - "print(\"so availability at initial state,A1 in KJ\")\n", - "print(\"A1=\"),round(A1,2)\n", - "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+V2**2*10**-3/2+g*z2*10**-3)\n", - "print(\"and availability at final state,A2 in KJ\")\n", - "print(\"A2=\"),round(A2,2)\n", - "A2-A1\n", - "print(\"change in availability,A2-A1 in KJ=\"),round(A2-A1,2)\n", - "print(\"hence availability decreases by 2702.188 KJ\")\n", - "print(\"NOTE=>In this question,due to large calculations,answers are approximately correct.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.5;page no: 223" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.5, Page:223 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\n", - "In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.5, Page:223 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\")\n", - "print(\"In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.6;pg no: 223" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.6, Page:223 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\n", - "loss of available energy=irreversibility=To*deltaSc\n", - "deltaSc=deltaSs+deltaSe\n", - "change in enropy of system(deltaSs)=W/T in KJ/kg K 0.98\n", - "change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K -2.8\n", - "loss of available energy(E) in KJ/kg= -550.49\n", - "loss of available energy(E)= -550.49\n", - "ratio of lost available exhaust gas energy to engine work=E/W= 0.524\n" - ] - } - ], - "source": [ - "#cal of available energy and ratio of lost available exhaust gas energy to engine work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.6, Page:223 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\")\n", - "To=(30.+273.);#temperature of surrounding in K\n", - "W=1050.;#work done in engine in KJ/kg\n", - "Cp=1.1;#specific heat at constant pressure in KJ/kg K\n", - "T=(800.+273.);#temperature of exhaust gas in K\n", - "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", - "print(\"deltaSc=deltaSs+deltaSe\")\n", - "deltaSs=W/T\n", - "print(\"change in enropy of system(deltaSs)=W/T in KJ/kg K\"),round(deltaSs,2)\n", - "deltaSe=-Cp*(T-To)/To\n", - "print(\"change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K\"),round(deltaSe,2)\n", - "E=To*(deltaSs+deltaSe)\n", - "print(\"loss of available energy(E) in KJ/kg=\"),round(E,2)\n", - "E=-E\n", - "print(\"loss of available energy(E)=\"),round(-E,2)\n", - "print(\"ratio of lost available exhaust gas energy to engine work=E/W=\"),round(E/W,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.7;pg no: 224" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.7, Page:224 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\n", - "let us consider velocities and elevations to be given in reference to environment.Availability is given by\n", - "A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\n", - "dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\n", - "for initial state of saturated vapour at 150 degree celcius\n", - "from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\n", - "for final state of saturated liquid at 20 degree celcius\n", - "from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\n", - "substituting in the expression for availability\n", - "initial state availability,A1 in KJ\n", - "A1= 5650.31\n", - "final state availability,A2 in KJ\n", - "A2= 2.58\n", - "change in availability,deltaA in KJ= -5647.72\n", - "so initial availability =5650.28 KJ\n", - "final availability=2.58 KJ \n", - "change in availability=decrease by 5647.70 KJ \n" - ] - } - ], - "source": [ - "#cal of initial,final and change in availability\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.7, Page:224 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\")\n", - "m=10;#mass of water in kg\n", - "C1=25;#initial velocity in m/s\n", - "C2=10;#final velocity in m/s\n", - "Po=0.1*1000;#environmental pressure in Kpa\n", - "To=(25+273.15);#environmental temperature in K\n", - "g=9.8;#acceleration due to gravity in m/s^2\n", - "z1=10;#initial elevation in m\n", - "z2=3;#final elevation in m\n", - "print(\"let us consider velocities and elevations to be given in reference to environment.Availability is given by\")\n", - "print(\"A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\")\n", - "print(\"dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\")\n", - "uo=104.88;\n", - "vo=1.003*10**-3;\n", - "so=0.3674;\n", - "print(\"for initial state of saturated vapour at 150 degree celcius\")\n", - "print(\"from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\")\n", - "u1=2559.5;\n", - "v1=0.3928;\n", - "s1=6.8379;\n", - "print(\"for final state of saturated liquid at 20 degree celcius\")\n", - "print(\"from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\")\n", - "u2=83.95;\n", - "v2=0.001002;\n", - "s2=0.2966;\n", - "print(\"substituting in the expression for availability\")\n", - "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+C1**2*10**-3/2+g*z1*10**-3)\n", - "print(\"initial state availability,A1 in KJ\")\n", - "print(\"A1=\"),round(A1,2)\n", - "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+C2**2*10**-3/2+g*z2*10**-3)\n", - "print(\"final state availability,A2 in KJ\")\n", - "print(\"A2=\"),round(A2,2)\n", - "deltaA=A2-A1\n", - "print(\"change in availability,deltaA in KJ=\"),round(deltaA,2)\n", - "print(\"so initial availability =5650.28 KJ\")\n", - "print(\"final availability=2.58 KJ \")\n", - "print(\"change in availability=decrease by 5647.70 KJ \")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.8;pg no: 225" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.8, Page:225 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\n", - "let inlet and exit states of turbine be denoted as 1 and 2\n", - "at inlet to turbine,\n", - "from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\n", - "at exit from turbine,\n", - "from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\n", - "at dead state,\n", - "from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\n", - "availability of steam at inlet,A1 in KJ= 6792.43\n", - "so availability of steam at inlet=6792.43 KJ\n", - "applying first law of thermodynamics,\n", - "Q+m*h1=m*h2+W\n", - "so W in KJ/s= 2829.0\n", - "so turbine output=2829 KW\n", - "maximum possible turbine output will be available when irreversibility is zero.\n", - "W_rev=W_max=A1-A2\n", - "W_max in KJ/s= 3804.82\n", - "so maximum output=3804.81 KW\n", - "irreversibility can be estimated by the difference between the maximum output and turbine output.\n", - "I= in KW= 975.82\n", - "so irreversibility=975.81807 KW\n", - "NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\n" - ] - } - ], - "source": [ - "#cal of availability of steam at inlet,turbine output,maximum possible turbine output,irreversibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.8, Page:225 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\")\n", - "m=5.;#steam flow rate in kg/s\n", - "p1=5.*1000.;#initial pressure of steam in Kpa\n", - "T1=(500.+273.15);#initial temperature of steam in K \n", - "p2=0.2*1000.;#final pressure of steam in Kpa\n", - "T1=(140.+273.15);#final temperature of steam in K\n", - "po=101.3;#pressure of steam at dead state in Kpa\n", - "To=(25.+273.15);#temperature of steam at dead state in K \n", - "Q=600.;#heat loss through turbine in KJ/s\n", - "print(\"let inlet and exit states of turbine be denoted as 1 and 2\")\n", - "print(\"at inlet to turbine,\")\n", - "print(\"from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\")\n", - "h1=3433.8;\n", - "s1=6.9759;\n", - "print(\"at exit from turbine,\")\n", - "print(\"from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\")\n", - "h2=2748;\n", - "s2=7.228;\n", - "print(\"at dead state,\")\n", - "print(\"from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\")\n", - "ho=104.96;\n", - "so=0.3673;\n", - "A1=m*((h1-ho)-To*(s1-so))\n", - "print(\"availability of steam at inlet,A1 in KJ=\"),round(A1,2)\n", - "print(\"so availability of steam at inlet=6792.43 KJ\")\n", - "print(\"applying first law of thermodynamics,\")\n", - "print(\"Q+m*h1=m*h2+W\")\n", - "W=m*(h1-h2)-Q\n", - "print(\"so W in KJ/s=\"),round(W,2)\n", - "print(\"so turbine output=2829 KW\")\n", - "print(\"maximum possible turbine output will be available when irreversibility is zero.\")\n", - "print(\"W_rev=W_max=A1-A2\")\n", - "W_max=m*((h1-h2)-To*(s1-s2))\n", - "print(\"W_max in KJ/s=\"),round(W_max,2)\n", - "print(\"so maximum output=3804.81 KW\")\n", - "print(\"irreversibility can be estimated by the difference between the maximum output and turbine output.\")\n", - "I=W_max-W\n", - "print(\"I= in KW=\"),round(I,2)\n", - "print(\"so irreversibility=975.81807 KW\")\n", - "print(\"NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.9;pg no: 226" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.9, Page:226 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\n", - "In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.9, Page:226 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\")\n", - "print(\"In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.10;pg no: 227" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.10, Page:227 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\n", - "In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.10, Page:227 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\")\n", - "print(\"In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.11;pg no: 227" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.11, Page:227 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\n", - "availability for heat reservoir(A_HR) in KJ/kg K 167.66\n", - "now availability for system(A_system) in KJ/kg K 194.44\n", - "net loss of available energy(A) in KJ/kg K= -26.78\n", - "so loss of available energy=26.77 KJ/kg K\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.11, Page:227 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\")\n", - "To=280.;#surrounding temperature in K\n", - "Q=500.;#heat removed in KJ\n", - "T1=835.;#temperature of reservoir in K\n", - "T2=720.;#temperature of system in K\n", - "A_HR=To*Q/T1\n", - "print(\"availability for heat reservoir(A_HR) in KJ/kg K\"),round(A_HR,2)\n", - "A_system=To*Q/T2\n", - "print(\"now availability for system(A_system) in KJ/kg K\"),round(A_system,2)\n", - "A=A_HR-A_system \n", - "print(\"net loss of available energy(A) in KJ/kg K=\"),round(A,2)\n", - "print(\"so loss of available energy=26.77 KJ/kg K\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.12;pg no: 228" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.12, Page:228 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\n", - "here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\n", - "W_max=W1-W2 in KJ/kg 1647.0\n", - "actual work from turbine,W_actual=h1-h2 in KJ/kg 1557.0\n", - "so actual work=1557 KJ/kg\n", - "maximum possible work=1647 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of actual,maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.12, Page:228 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\")\n", - "h1=4142;#enthalpy at entrance in KJ/kg\n", - "h2=2585;#enthalpy at exit in KJ/kg\n", - "W1=1787;#availability of steam at entrance in KJ/kg\n", - "W2=140;#availability of steam at exit in KJ/kg\n", - "print(\"here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\")\n", - "W_max=W1-W2\n", - "print(\"W_max=W1-W2 in KJ/kg\"),round(W_max,2)\n", - "W_actual=h1-h2\n", - "print(\"actual work from turbine,W_actual=h1-h2 in KJ/kg\"),round(W_actual,2)\n", - "print(\"so actual work=1557 KJ/kg\")\n", - "print(\"maximum possible work=1647 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.13;pg no: 228" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.13, Page:228 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\n", - "reversible engine efficiency,n_rev=1-(T_min/T_max) 0.621\n", - "second law efficiency=n/n_rev 0.4026\n", - "in % 40.26\n" - ] - } - ], - "source": [ - "#cal of second law efficiency\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.13, Page:228 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\")\n", - "T_min=(20.+273.);#minimum temperature reservoir temperature in K\n", - "T_max=(500.+273.);#maximum temperature reservoir temperature in K\n", - "n=0.25;#efficiency of heat engine\n", - "n_rev=1-(T_min/T_max)\n", - "print(\"reversible engine efficiency,n_rev=1-(T_min/T_max)\"),round(n_rev,4)\n", - "n/n_rev\n", - "print(\"second law efficiency=n/n_rev\"),round(n/n_rev,4)\n", - "print(\"in %\"),round(n*100/n_rev,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.14;pg no: 228" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.14, Page:228 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\n", - "expansion occurs in adiabatic conditions.\n", - "temperature after expansion can be obtained by considering adiabatic expansion\n", - "T2/T1=(V1/V2)^(y-1)\n", - "so T2= in K= 489.12\n", - "mass of air,m in kg= 20.91\n", - "change in entropy of control system,deltaSs=(S2-S1) in KJ/K= -0.0\n", - "here,there is no change in entropy of environment,deltaSe=0\n", - "total entropy change of combined system=deltaSc in KJ/K= -0.0\n", - "loss of available energy(E)=irreversibility in KJ= -0.603\n", - "so loss of available energy,E=0.603 KJ\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.14, Page:228 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\")\n", - "V_A=6.;#volume of compartment A in m^3\n", - "V_B=4.;#volume of compartment B in m^3\n", - "To=300.;#temperature of atmosphere in K\n", - "Po=1.*10**5;#atmospheric pressure in pa\n", - "P1=6.*10**5;#initial pressure in pa\n", - "T1=600.;#initial temperature in K\n", - "V1=V_A;#initial volume in m^3\n", - "V2=(V_A+V_B);#final volume in m^3\n", - "y=1.4;#expansion constant \n", - "R=287.;#gas constant in J/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "print(\"expansion occurs in adiabatic conditions.\")\n", - "print(\"temperature after expansion can be obtained by considering adiabatic expansion\")\n", - "T2=T1*(V1/V2)**(y-1)\n", - "print(\"T2/T1=(V1/V2)^(y-1)\")\n", - "print(\"so T2= in K=\"),round(T2,2)\n", - "T2=489.12;#approx.\n", - "m=(P1*V1)/(R*T1)\n", - "print(\"mass of air,m in kg=\"),round(m,2)\n", - "m=20.91;#approx.\n", - "deltaSs=m*Cv*math.log(T2/T1)+m*R*10**-3*math.log(V2/V1)\n", - "print(\"change in entropy of control system,deltaSs=(S2-S1) in KJ/K=\"),round(deltaSs,2)\n", - "print(\"here,there is no change in entropy of environment,deltaSe=0\")\n", - "deltaSe=0;\n", - "deltaSc=deltaSs+deltaSe\n", - "print(\"total entropy change of combined system=deltaSc in KJ/K=\"),round(deltaSc,2)\n", - "E=To*deltaSc\n", - "print(\"loss of available energy(E)=irreversibility in KJ=\"),round(E,3)\n", - "print(\"so loss of available energy,E=0.603 KJ\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.15;pg no: 229" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.15, Page:229 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\n", - "In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#cal of maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.15, Page:229 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\")\n", - "print(\"In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.16;pg no: 230" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.16, Page:230 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\n", - "availability or reversible work,W_rev=n_rev*Q1 in KJ/min 229.53\n", - "rate of irreversibility,I=W_rev-W_useful in KJ/sec 99.53\n", - "second law efficiency=W_useful/W_rev 0.57\n", - "in percentage 56.64\n", - "so availability=1.38*10^4 KJ/min\n", - "and rate of irreversibility=100 KW,second law efficiency=56.63 %\n", - "NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\n" - ] - } - ], - "source": [ - "#cal of availability,rate of irreversibility and second law efficiency\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.16, Page:230 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\")\n", - "To=(17.+273.);#temperature of surrounding in K\n", - "T1=(700.+273.);#temperature of high temperature reservoir in K\n", - "T2=(30.+273.);#temperature of low temperature reservoir in K\n", - "Q1=2.*10**4;#rate of heat receive in KJ/min\n", - "W_useful=0.13*10**3;#output of engine in KW\n", - "n_rev=(1-T2/T1);\n", - "W_rev=n_rev*Q1\n", - "W_rev=W_rev/60.;#W_rev in KJ/s\n", - "print(\"availability or reversible work,W_rev=n_rev*Q1 in KJ/min\"),round(W_rev,2)\n", - "I=W_rev-W_useful\n", - "print(\"rate of irreversibility,I=W_rev-W_useful in KJ/sec\"),round(I,2)\n", - "W_useful/W_rev\n", - "print(\"second law efficiency=W_useful/W_rev\"),round(W_useful/W_rev,2)\n", - "W_useful*100/W_rev\n", - "print(\"in percentage\"),round(W_useful*100/W_rev,2)\n", - "print(\"so availability=1.38*10^4 KJ/min\")\n", - "print(\"and rate of irreversibility=100 KW,second law efficiency=56.63 %\")\n", - "print(\"NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.17;pg no: 230" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.17, Page:230 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\n", - "loss of available energy=irreversibility=To*deltaSc\n", - "deltaSc=deltaSs+deltaSe\n", - "change in entropy of system=deltaSs\n", - "change in entropy of environment/surroundings=deltaSe\n", - "here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\n", - "P1/T1=P2/T2\n", - "so T2 in K= 555.0\n", - "heat addition to air in tank\n", - "Q in KJ/kg= 223.11\n", - "deltaSs in KJ/kg K= 0.67\n", - "deltaSe in KJ/kg K= -0.33\n", - "and deltaSc in KJ/kg K= 0.34\n", - "so loss of available energy(E)in KJ/kg= 101.55\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.17, Page:230 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\")\n", - "To=(27+273);#temperature of surrounding in K\n", - "T1=(60+273);#initial temperature of air in K\n", - "P1=1.5*10**5;#initial pressure of air in pa\n", - "P2=2.5*10**5;#final pressure of air in pa\n", - "T_reservoir=(400+273);#temperature of reservoir in K\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", - "print(\"deltaSc=deltaSs+deltaSe\")\n", - "print(\"change in entropy of system=deltaSs\")\n", - "print(\"change in entropy of environment/surroundings=deltaSe\")\n", - "print(\"here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\")\n", - "print(\"P1/T1=P2/T2\")\n", - "T2=P2*T1/P1\n", - "print(\"so T2 in K=\"),round(T2,2)\n", - "print(\"heat addition to air in tank\")\n", - "deltaT=T2-T1;\n", - "Q=Cp*deltaT\n", - "print(\"Q in KJ/kg=\"),round(Q,2)\n", - "deltaSs=Q/T1\n", - "print(\"deltaSs in KJ/kg K=\"),round(deltaSs,2)\n", - "deltaSe=-Q/T_reservoir\n", - "print(\"deltaSe in KJ/kg K=\"),round(deltaSe,2)\n", - "deltaSc=deltaSs+deltaSe\n", - "print(\"and deltaSc in KJ/kg K=\"),round(deltaSc,2)\n", - "E=To*deltaSc\n", - "print(\"so loss of available energy(E)in KJ/kg=\"),round(E,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.18;pg no: 231" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.18, Page:231 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\n", - "In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.18, Page:231 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\")\n", - "print(\"In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.19;pg no: 232" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.19, Page:232 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\n", - "clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\n", - "from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\n", - "v_fg in m^3/kg= 0.0\n", - "let us approximate,\n", - "(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\n", - "here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\n", - "substituting in clapeyron equation,\n", - "h_fg in KJ/kg 1941.25\n", - "so calculated enthalpy of vaporisation=1941.25 KJ/kg\n", - "and enthalpy of vaporisation from steam table=1940.7 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of enthalpy of vaporisation\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.19, Page:232 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\")\n", - "T=(200+273);#temperature of water in K\n", - "print(\"clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\")\n", - "print(\"from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\")\n", - "vg=0.12736;\n", - "vf=0.001157;\n", - "v_fg=(vg-vf)\n", - "print(\"v_fg in m^3/kg=\"),round(v_fg)\n", - "print(\"let us approximate,\")\n", - "print(\"(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\")\n", - "print(\"here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\")\n", - "P_205oc=1.7230;#pressure at 205 degree celcius in Mpa\n", - "P_195oc=1.3978;#pressure at 195 degree celcius in Mpa\n", - "(P_205oc-P_195oc)/(205-195)\n", - "print(\"substituting in clapeyron equation,\")\n", - "h_fg=T*v_fg*(P_205oc-P_195oc)*1000/(205-195)\n", - "print(\"h_fg in KJ/kg\"),round(h_fg,2)\n", - "print(\"so calculated enthalpy of vaporisation=1941.25 KJ/kg\")\n", - "print(\"and enthalpy of vaporisation from steam table=1940.7 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.20;pg no: 232" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.20, Page:232 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\n", - "by clapeyron equation\n", - "h_fg=T2*v_fg*(do/dT)_sat \n", - "h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\n", - "by clapeyron-clausius equation,\n", - "log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\n", - "log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\n", - "so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\n", - "% deviation from clapeyron equation in % 6.44\n", - "h_fg by clapeyron equation=159.49 KJ/kg\n", - "h_fg by clapeyron-clausius equation=169.76 KJ/kg\n", - "% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.20, Page:232 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\")\n", - "P2=260.96;#saturation pressure at -5 degree celcius\n", - "P1=182.60;#saturation pressure at -15 degree celcius\n", - "vg=0.07665;#specific volume of gas at -10 degree celcius in m^3/kg\n", - "vf=0.00070#specific volume at -10 degree celcius in m^3/kg\n", - "R=0.06876;#gas constant in KJ/kg K\n", - "h_fg=156.3;#enthalpy in KJ/kg K\n", - "T2=(-5.+273.);#temperature in K\n", - "T1=(-15.+273.);#temperature in K\n", - "print(\"by clapeyron equation\")\n", - "print(\"h_fg=T2*v_fg*(do/dT)_sat \")\n", - "print(\"h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\")\n", - "h_fg=T2*(vg-vf)*(P1-P2)/(T1-T2)\n", - "print(\"by clapeyron-clausius equation,\")\n", - "print(\"log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\")\n", - "print(\"log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\")\n", - "print(\"so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\")\n", - "h_fg=math.log(P2/P1)*R/((1/T1)-(1/T2))\n", - "print(\"% deviation from clapeyron equation in %\"),round((169.76-159.49)*100/159.49,2)\n", - "print(\"h_fg by clapeyron equation=159.49 KJ/kg\")\n", - "print(\"h_fg by clapeyron-clausius equation=169.76 KJ/kg\")\n", - "print(\"% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.21;pg no: 233" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "ename": "SyntaxError", - "evalue": "invalid syntax (, line 15)", - "output_type": "error", - "traceback": [ - "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m15\u001b[0m\n\u001b[1;33m volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" - ] - } - ], - "source": [ - "#cal of volume expansivity and isothermal compressibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.21, Page:233 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 21\")\n", - "print(\"volume expansion=(1/v)*(dv/dT)_P\")\n", - "print(\"isothermal compressibility=-(1/v)*(dv/dp)_T\")\n", - "print(\"let us write dv/dT=deltav/deltaT and dv/dP=deltav/deltaP.The difference may be taken for small pressure and temperature changes.\")\n", - "print(\"volume expansivity in K^-1,\")\n", - "print(\"=(1/v)*(dv/dT)_300Kpa\")\n", - "v_300Kpa_300oc=0.8753;#specific volume at 300Kpa and 300 degree celcius\n", - "v_350oc=0.9534;#specific volume 350 degree celcius\n", - "v_250oc=0.7964;#specific volume 250 degree celcius\n", - "volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\n", - "print(\"volume expansivity in Kpa\"),round(volume expansivity,2)\n", - "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350oc=0.9534 in m^3/kg,v_250oc=0.7964 in m^3/kg\")\n", - "print(\"volume expansivity=1.7937*10^-3 K^-1\")\n", - "isothermal=(-1/v_300Kpa_300oc)*(v_350Kpa-v_250Kpa)/(350-250)\n", - "print(\"isothermal compressibility in Kpa^-1\")\n", - "print(\"isothermal compressibility\"),round(isothermal compressibility,2)\n", - "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350Kpa=0.76505 in m^3/kg,v_250Kpa=1.09575 in m^3/kg\")\n", - "v_350Kpa=0.76505;#specific volume 350 Kpa\n", - "v_250Kpa=1.09575;#specific volume 250 Kpa\n", - "print(\"so isothermal compressibility=3.778*10^-3 Kpa^-1\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.22;pg no: 234" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.22, Page:234 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\n", - "filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\n", - "hi=uf\n", - "Cp*Ti=Cv*Tf\n", - "so Tf=Cp*Ti/Cv in K 417.33\n", - "inside final temperature,Tf=417.33 K\n", - "change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K= 0.338\n", - "Cp*log(Tf/Ti)+0\n", - "change in entropy,deltaS_gen=0.3379 KJ/kg K\n", - "irreversibility,I in KJ/kg= 100.76\n", - "irreversibility,I=100.74 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of inside final temperature,change in entropy and irreversibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.22, Page:234 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\")\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "Ti=(25+273.15);#atmospheric temperature in K\n", - "print(\"filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\")\n", - "print(\"hi=uf\")\n", - "print(\"Cp*Ti=Cv*Tf\")\n", - "Tf=Cp*Ti/Cv\n", - "print(\"so Tf=Cp*Ti/Cv in K\"),round(Tf,2)\n", - "print(\"inside final temperature,Tf=417.33 K\")\n", - "deltaS_gen=Cp*math.log(Tf/Ti)\n", - "print(\"change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K=\"),round(deltaS_gen,4)\n", - "print(\"Cp*log(Tf/Ti)+0\")\n", - "print(\"change in entropy,deltaS_gen=0.3379 KJ/kg K\")\n", - "To=Ti;\n", - "I=To*deltaS_gen\n", - "print(\"irreversibility,I in KJ/kg=\"),round(I,2)\n", - "print(\"irreversibility,I=100.74 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.23;pg no: 234" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.23, Page:234 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\n", - "here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\n", - "therefore,d(E-To-S)/dt=W_max\n", - "or W_max=(E-To-S)1-(E-To-S)2\n", - "here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\n", - "therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\n", - "so maximum work in KJ= 40946.6\n" - ] - } - ], - "source": [ - "#cal of maximum work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.23, Page:234 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\")\n", - "m=75.;#mass of hot water in kg\n", - "T1=(400.+273.);#temperature of hot water in K\n", - "T2=(27.+273.);#temperature of environment in K\n", - "Cp=4.18;#specific heat of water in KJ/kg K\n", - "print(\"here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\")\n", - "print(\"therefore,d(E-To-S)/dt=W_max\")\n", - "print(\"or W_max=(E-To-S)1-(E-To-S)2\")\n", - "print(\"here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\")\n", - "print(\"therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\")\n", - "To=T2;\n", - "W_max=m*Cp*(T1-T2)-To*m*Cp*math.log(T1/T2)\n", - "print(\"so maximum work in KJ=\"),round(W_max,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.24;pg no: 235" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.24, Page:235 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\n", - "from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\n", - "inlet stream availability in KJ/kg= 1587.19\n", - "input stream availability is equal to the input absolute availability.\n", - "exit stream availaability in KJ/kg 238.69\n", - "exit stream availability is equal to the exit absolute availability.\n", - "W_rev in KJ/kg\n", - "irreversibility=W_rev-W in KJ/kg 348.49\n", - "this irreversibility is in fact the availability loss.\n", - "inlet stream availability=1587.18 KJ/kg\n", - "exit stream availability=238.69 KJ/kg\n", - "irreversibility=348.49 KJ/kg\n", - "NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \n" - ] - } - ], - "source": [ - "#cal of inlet stream availability,exit stream availability and irreversibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.24, Page:235 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\")\n", - "C1=150;#steam entering velocity in m/s\n", - "C2=50;#steam leaving velocity in m/s\n", - "To=(15+273);#dead state temperature in K\n", - "W=1000;#expansion work in KJ/kg\n", - "print(\"from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\")\n", - "h1=3666.5;\n", - "s1=7.2589;\n", - "h2=2584.7;\n", - "s2=8.1502;\n", - "(h1+C1**2*10**-3/2)-To*s1\n", - "print(\"inlet stream availability in KJ/kg=\"),round((h1+C1**2*10**-3/2)-To*s1,2)\n", - "(h2+C2**2*10**-3/2)-To*s2\n", - "print(\"input stream availability is equal to the input absolute availability.\")\n", - "print(\"exit stream availaability in KJ/kg\"),round((h2+C2**2*10**-3/2)-To*s2,2)\n", - "print(\"exit stream availability is equal to the exit absolute availability.\")\n", - "print(\"W_rev in KJ/kg\")\n", - "W_rev=1587.18-238.69\n", - "W_rev-W\n", - "print(\"irreversibility=W_rev-W in KJ/kg\"),round(W_rev-W,2)\n", - "print(\"this irreversibility is in fact the availability loss.\")\n", - "print(\"inlet stream availability=1587.18 KJ/kg\")\n", - "print(\"exit stream availability=238.69 KJ/kg\")\n", - "print(\"irreversibility=348.49 KJ/kg\")\n", - "print(\"NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter7.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter7.ipynb deleted file mode 100755 index ef30a163..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter7.ipynb +++ /dev/null @@ -1,1452 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 7:Availability and General Thermodynamic Relation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.1;page no: 218" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.1, Page:218 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\n", - "let us neglect the potential energy change during the flow.\n", - "applying S.F.E.E,neglecting inlet velocity and change in potential energy,\n", - "W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\n", - "W_max=(h1-h2)-To*(s1-s2)-C2^2/2\n", - "from steam tables,\n", - "h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\n", - "given To=288 K\n", - "so W_max in KJ/kg= 457.1\n", - "maximum possible work(W_max) in KW= 1142.76\n" - ] - } - ], - "source": [ - "#cal of maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.1, Page:218 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\")\n", - "C2=150;#leave velocity of steam in m/s\n", - "m=2.5;#steam mass flow rate in kg/s\n", - "print(\"let us neglect the potential energy change during the flow.\")\n", - "print(\"applying S.F.E.E,neglecting inlet velocity and change in potential energy,\")\n", - "print(\"W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\")\n", - "print(\"W_max=(h1-h2)-To*(s1-s2)-C2^2/2\")\n", - "print(\"from steam tables,\")\n", - "print(\"h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\")\n", - "h1=3034.8;\n", - "s1=6.8844;\n", - "h2=2776.4;\n", - "s2=7.6134;\n", - "print(\"given To=288 K\")\n", - "To=288;\n", - "W_max=(h1-h2)-To*(s1-s2)-(C2**2/2*10**-3)\n", - "print(\"so W_max in KJ/kg=\"),round(W_max,2)\n", - "W_max=m*W_max\n", - "print(\"maximum possible work(W_max) in KW=\"),round(W_max,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.2;page no: 219" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.2, Page:219 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\n", - "In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\n", - "BOTH THE TANKS HAVE SAME INTERNAL ENERGY\n", - "availability of air in tank,A\n", - "A=(E-Uo)+Po*(V-Vo)-To*(S-So)\n", - "=m*{(e-uo)+Po(v-vo)-To(s-so)}\n", - "m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\n", - "so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\n", - "for tank A,P in pa,so availability_A in KJ= 1.98\n", - "for tank B,P=3*10^5 pa,so availability_B in KJ= 30.98\n", - "so availability of air in tank B is more than that of tank A\n", - "availability of air in tank A=1.98 KJ\n", - "availability of air in tank B=30.98 KJ\n" - ] - } - ], - "source": [ - "#cal of availability of air in tank A,B\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.2, Page:219 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\")\n", - "m=1.;#mass of air in kg\n", - "Po=1.*10**5;#atmospheric pressure in pa\n", - "To=(15.+273.);#temperature of atmosphere in K\n", - "Cv=0.717;#specific heat at constant volume in KJ/kg K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", - "T=(50.+273.);#temperature of tanks A and B in K\n", - "print(\"In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\")\n", - "print(\"BOTH THE TANKS HAVE SAME INTERNAL ENERGY\")\n", - "print(\"availability of air in tank,A\")\n", - "print(\"A=(E-Uo)+Po*(V-Vo)-To*(S-So)\")\n", - "print(\"=m*{(e-uo)+Po(v-vo)-To(s-so)}\")\n", - "print(\"m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\")\n", - "print(\"so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\")\n", - "P=1.*10**5;#pressure in tank A in pa\n", - "availability_A=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", - "print(\"for tank A,P in pa,so availability_A in KJ=\"),round(availability_A,2)\n", - "P=3.*10**5;#pressure in tank B in pa\n", - "availability_B=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", - "print(\"for tank B,P=3*10^5 pa,so availability_B in KJ=\"),round(availability_B,2)\n", - "print(\"so availability of air in tank B is more than that of tank A\")\n", - "print(\"availability of air in tank A=1.98 KJ\")\n", - "print(\"availability of air in tank B=30.98 KJ\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.3;page no: 221" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.3, Page:221 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\n", - "inlet conditions,\n", - "from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\n", - "outlet conditions,at 0.05 bar and 0.95 dryness fraction\n", - "from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\n", - "so s2= in KJ/kg K= 8.0\n", - "and h2= in KJ/kg= 2440.34\n", - "neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\n", - "w in KJ/kg= 598.06\n", - "power output in KW= 8970.97\n", - "maximum work for given end states,\n", - "w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg 850.43\n", - "w_max in KW 12755.7\n", - "so maximum power output=12755.7 KW\n", - "maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\n", - "A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\n", - "=(h2-ho)+V2^2/2-To(s2-so)\n", - "approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\n", - "from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\n", - "maximum work available from exhaust steam,A_exhaust in KJ/kg\n", - "A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so) 151.1\n", - "maximum power that could be obtained from exhaust steam in KW= 2266.5\n", - "so maximum power from exhaust steam=2266.5 KW\n" - ] - } - ], - "source": [ - "#cal of maximum power output and that could be obtained from exhaust steam\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.3, Page:221 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\")\n", - "m=15;#steam flow rate in kg/s\n", - "V2=160;#exit velocity of steam in m/s\n", - "To=(15+273);#pond water temperature in K\n", - "print(\"inlet conditions,\")\n", - "print(\"from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\")\n", - "h1=3051.2;\n", - "s1=7.1229;\n", - "print(\"outlet conditions,at 0.05 bar and 0.95 dryness fraction\")\n", - "print(\"from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\")\n", - "sf=0.4764;\n", - "s_fg=7.9187;\n", - "x=0.95;\n", - "hf=137.82;\n", - "h_fg=2423.7;\n", - "s2=sf+x*s_fg\n", - "print(\"so s2= in KJ/kg K=\"),round(s2,2)\n", - "h2=hf+x*h_fg\n", - "print(\"and h2= in KJ/kg=\"),round(h2,2)\n", - "print(\"neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\")\n", - "w=(h1-h2)-V2**2*10**-3/2\n", - "print(\"w in KJ/kg=\"),round(w,2)\n", - "print(\"power output in KW=\"),round(m*w,2)\n", - "print(\"maximum work for given end states,\")\n", - "w_max=(h1-To*s1)-(h2+V2**2*10**-3/2-To*s2)\n", - "print(\"w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg\"),round(w_max,2)\n", - "w_max=850.38;#approx.\n", - "w_max=m*w_max\n", - "print(\"w_max in KW\"),round(w_max,2)\n", - "print(\"so maximum power output=12755.7 KW\")\n", - "print(\"maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\")\n", - "print(\"A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\")\n", - "print(\"=(h2-ho)+V2^2/2-To(s2-so)\")\n", - "print(\"approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\")\n", - "print(\"from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\")\n", - "ho=62.99;\n", - "so=0.2245;\n", - "print(\"maximum work available from exhaust steam,A_exhaust in KJ/kg\")\n", - "A_exhaust=(h2-ho)+V2**2*10**-3/2-To*(s2-so)\n", - "A_exhaust=151.1;#approx.\n", - "print(\"A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so)\"),round(A_exhaust,2)\n", - "print(\"maximum power that could be obtained from exhaust steam in KW=\"),round(m*A_exhaust,2)\n", - "print(\"so maximum power from exhaust steam=2266.5 KW\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.4;page no: 222" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.4, Page:222 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\n", - "for dead state of water,\n", - "from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\n", - "for initial state of water,\n", - "from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\n", - "for final state of water,\n", - "from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\n", - "availability at any state can be given by\n", - "A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\n", - "so availability at initial state,A1 in KJ\n", - "A1= 2703.28\n", - "and availability at final state,A2 in KJ\n", - "A2= 1.09\n", - "change in availability,A2-A1 in KJ= -2702.19\n", - "hence availability decreases by 2702.188 KJ\n", - "NOTE=>In this question,due to large calculations,answers are approximately correct.\n" - ] - } - ], - "source": [ - "#cal of availability at initial,final state and also change\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.4, Page:222 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\")\n", - "m=5;#mass of steam in kg\n", - "z1=10;#initial elevation in m\n", - "V1=25;#initial velocity of steam in m/s\n", - "z2=2;#final elevation in m\n", - "V2=10;#final velocity of steam in m/s\n", - "Po=100;#environmental pressure in Kpa\n", - "To=(25+273);#environmental temperature in K\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"for dead state of water,\")\n", - "print(\"from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\")\n", - "uo=104.86;\n", - "vo=1.0029*10**-3;\n", - "so=0.3673;\n", - "print(\"for initial state of water,\")\n", - "print(\"from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\")\n", - "u1=2550;\n", - "v1=0.5089;\n", - "s1=6.93;\n", - "print(\"for final state of water,\")\n", - "print(\"from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\")\n", - "u2=83.94;\n", - "v2=1.0018*10**-3;\n", - "s2=0.2966;\n", - "print(\"availability at any state can be given by\")\n", - "print(\"A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\")\n", - "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+V1**2*10**-3/2+g*z1*10**-3)\n", - "print(\"so availability at initial state,A1 in KJ\")\n", - "print(\"A1=\"),round(A1,2)\n", - "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+V2**2*10**-3/2+g*z2*10**-3)\n", - "print(\"and availability at final state,A2 in KJ\")\n", - "print(\"A2=\"),round(A2,2)\n", - "A2-A1\n", - "print(\"change in availability,A2-A1 in KJ=\"),round(A2-A1,2)\n", - "print(\"hence availability decreases by 2702.188 KJ\")\n", - "print(\"NOTE=>In this question,due to large calculations,answers are approximately correct.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.5;page no: 223" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.5, Page:223 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\n", - "In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.5, Page:223 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\")\n", - "print(\"In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.6;pg no: 223" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.6, Page:223 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\n", - "loss of available energy=irreversibility=To*deltaSc\n", - "deltaSc=deltaSs+deltaSe\n", - "change in enropy of system(deltaSs)=W/T in KJ/kg K 0.98\n", - "change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K -2.8\n", - "loss of available energy(E) in KJ/kg= -550.49\n", - "loss of available energy(E)= -550.49\n", - "ratio of lost available exhaust gas energy to engine work=E/W= 0.524\n" - ] - } - ], - "source": [ - "#cal of available energy and ratio of lost available exhaust gas energy to engine work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.6, Page:223 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\")\n", - "To=(30.+273.);#temperature of surrounding in K\n", - "W=1050.;#work done in engine in KJ/kg\n", - "Cp=1.1;#specific heat at constant pressure in KJ/kg K\n", - "T=(800.+273.);#temperature of exhaust gas in K\n", - "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", - "print(\"deltaSc=deltaSs+deltaSe\")\n", - "deltaSs=W/T\n", - "print(\"change in enropy of system(deltaSs)=W/T in KJ/kg K\"),round(deltaSs,2)\n", - "deltaSe=-Cp*(T-To)/To\n", - "print(\"change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K\"),round(deltaSe,2)\n", - "E=To*(deltaSs+deltaSe)\n", - "print(\"loss of available energy(E) in KJ/kg=\"),round(E,2)\n", - "E=-E\n", - "print(\"loss of available energy(E)=\"),round(-E,2)\n", - "print(\"ratio of lost available exhaust gas energy to engine work=E/W=\"),round(E/W,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.7;pg no: 224" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.7, Page:224 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\n", - "let us consider velocities and elevations to be given in reference to environment.Availability is given by\n", - "A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\n", - "dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\n", - "for initial state of saturated vapour at 150 degree celcius\n", - "from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\n", - "for final state of saturated liquid at 20 degree celcius\n", - "from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\n", - "substituting in the expression for availability\n", - "initial state availability,A1 in KJ\n", - "A1= 5650.31\n", - "final state availability,A2 in KJ\n", - "A2= 2.58\n", - "change in availability,deltaA in KJ= -5647.72\n", - "so initial availability =5650.28 KJ\n", - "final availability=2.58 KJ \n", - "change in availability=decrease by 5647.70 KJ \n" - ] - } - ], - "source": [ - "#cal of initial,final and change in availability\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.7, Page:224 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\")\n", - "m=10;#mass of water in kg\n", - "C1=25;#initial velocity in m/s\n", - "C2=10;#final velocity in m/s\n", - "Po=0.1*1000;#environmental pressure in Kpa\n", - "To=(25+273.15);#environmental temperature in K\n", - "g=9.8;#acceleration due to gravity in m/s^2\n", - "z1=10;#initial elevation in m\n", - "z2=3;#final elevation in m\n", - "print(\"let us consider velocities and elevations to be given in reference to environment.Availability is given by\")\n", - "print(\"A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\")\n", - "print(\"dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\")\n", - "uo=104.88;\n", - "vo=1.003*10**-3;\n", - "so=0.3674;\n", - "print(\"for initial state of saturated vapour at 150 degree celcius\")\n", - "print(\"from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\")\n", - "u1=2559.5;\n", - "v1=0.3928;\n", - "s1=6.8379;\n", - "print(\"for final state of saturated liquid at 20 degree celcius\")\n", - "print(\"from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\")\n", - "u2=83.95;\n", - "v2=0.001002;\n", - "s2=0.2966;\n", - "print(\"substituting in the expression for availability\")\n", - "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+C1**2*10**-3/2+g*z1*10**-3)\n", - "print(\"initial state availability,A1 in KJ\")\n", - "print(\"A1=\"),round(A1,2)\n", - "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+C2**2*10**-3/2+g*z2*10**-3)\n", - "print(\"final state availability,A2 in KJ\")\n", - "print(\"A2=\"),round(A2,2)\n", - "deltaA=A2-A1\n", - "print(\"change in availability,deltaA in KJ=\"),round(deltaA,2)\n", - "print(\"so initial availability =5650.28 KJ\")\n", - "print(\"final availability=2.58 KJ \")\n", - "print(\"change in availability=decrease by 5647.70 KJ \")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.8;pg no: 225" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.8, Page:225 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\n", - "let inlet and exit states of turbine be denoted as 1 and 2\n", - "at inlet to turbine,\n", - "from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\n", - "at exit from turbine,\n", - "from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\n", - "at dead state,\n", - "from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\n", - "availability of steam at inlet,A1 in KJ= 6792.43\n", - "so availability of steam at inlet=6792.43 KJ\n", - "applying first law of thermodynamics,\n", - "Q+m*h1=m*h2+W\n", - "so W in KJ/s= 2829.0\n", - "so turbine output=2829 KW\n", - "maximum possible turbine output will be available when irreversibility is zero.\n", - "W_rev=W_max=A1-A2\n", - "W_max in KJ/s= 3804.82\n", - "so maximum output=3804.81 KW\n", - "irreversibility can be estimated by the difference between the maximum output and turbine output.\n", - "I= in KW= 975.82\n", - "so irreversibility=975.81807 KW\n", - "NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\n" - ] - } - ], - "source": [ - "#cal of availability of steam at inlet,turbine output,maximum possible turbine output,irreversibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.8, Page:225 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\")\n", - "m=5.;#steam flow rate in kg/s\n", - "p1=5.*1000.;#initial pressure of steam in Kpa\n", - "T1=(500.+273.15);#initial temperature of steam in K \n", - "p2=0.2*1000.;#final pressure of steam in Kpa\n", - "T1=(140.+273.15);#final temperature of steam in K\n", - "po=101.3;#pressure of steam at dead state in Kpa\n", - "To=(25.+273.15);#temperature of steam at dead state in K \n", - "Q=600.;#heat loss through turbine in KJ/s\n", - "print(\"let inlet and exit states of turbine be denoted as 1 and 2\")\n", - "print(\"at inlet to turbine,\")\n", - "print(\"from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\")\n", - "h1=3433.8;\n", - "s1=6.9759;\n", - "print(\"at exit from turbine,\")\n", - "print(\"from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\")\n", - "h2=2748;\n", - "s2=7.228;\n", - "print(\"at dead state,\")\n", - "print(\"from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\")\n", - "ho=104.96;\n", - "so=0.3673;\n", - "A1=m*((h1-ho)-To*(s1-so))\n", - "print(\"availability of steam at inlet,A1 in KJ=\"),round(A1,2)\n", - "print(\"so availability of steam at inlet=6792.43 KJ\")\n", - "print(\"applying first law of thermodynamics,\")\n", - "print(\"Q+m*h1=m*h2+W\")\n", - "W=m*(h1-h2)-Q\n", - "print(\"so W in KJ/s=\"),round(W,2)\n", - "print(\"so turbine output=2829 KW\")\n", - "print(\"maximum possible turbine output will be available when irreversibility is zero.\")\n", - "print(\"W_rev=W_max=A1-A2\")\n", - "W_max=m*((h1-h2)-To*(s1-s2))\n", - "print(\"W_max in KJ/s=\"),round(W_max,2)\n", - "print(\"so maximum output=3804.81 KW\")\n", - "print(\"irreversibility can be estimated by the difference between the maximum output and turbine output.\")\n", - "I=W_max-W\n", - "print(\"I= in KW=\"),round(I,2)\n", - "print(\"so irreversibility=975.81807 KW\")\n", - "print(\"NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.9;pg no: 226" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.9, Page:226 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\n", - "In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.9, Page:226 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\")\n", - "print(\"In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.10;pg no: 227" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.10, Page:227 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\n", - "In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.10, Page:227 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\")\n", - "print(\"In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.11;pg no: 227" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.11, Page:227 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\n", - "availability for heat reservoir(A_HR) in KJ/kg K 167.66\n", - "now availability for system(A_system) in KJ/kg K 194.44\n", - "net loss of available energy(A) in KJ/kg K= -26.78\n", - "so loss of available energy=26.77 KJ/kg K\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.11, Page:227 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\")\n", - "To=280.;#surrounding temperature in K\n", - "Q=500.;#heat removed in KJ\n", - "T1=835.;#temperature of reservoir in K\n", - "T2=720.;#temperature of system in K\n", - "A_HR=To*Q/T1\n", - "print(\"availability for heat reservoir(A_HR) in KJ/kg K\"),round(A_HR,2)\n", - "A_system=To*Q/T2\n", - "print(\"now availability for system(A_system) in KJ/kg K\"),round(A_system,2)\n", - "A=A_HR-A_system \n", - "print(\"net loss of available energy(A) in KJ/kg K=\"),round(A,2)\n", - "print(\"so loss of available energy=26.77 KJ/kg K\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.12;pg no: 228" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.12, Page:228 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\n", - "here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\n", - "W_max=W1-W2 in KJ/kg 1647.0\n", - "actual work from turbine,W_actual=h1-h2 in KJ/kg 1557.0\n", - "so actual work=1557 KJ/kg\n", - "maximum possible work=1647 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of actual,maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.12, Page:228 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\")\n", - "h1=4142;#enthalpy at entrance in KJ/kg\n", - "h2=2585;#enthalpy at exit in KJ/kg\n", - "W1=1787;#availability of steam at entrance in KJ/kg\n", - "W2=140;#availability of steam at exit in KJ/kg\n", - "print(\"here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\")\n", - "W_max=W1-W2\n", - "print(\"W_max=W1-W2 in KJ/kg\"),round(W_max,2)\n", - "W_actual=h1-h2\n", - "print(\"actual work from turbine,W_actual=h1-h2 in KJ/kg\"),round(W_actual,2)\n", - "print(\"so actual work=1557 KJ/kg\")\n", - "print(\"maximum possible work=1647 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.13;pg no: 228" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.13, Page:228 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\n", - "reversible engine efficiency,n_rev=1-(T_min/T_max) 0.621\n", - "second law efficiency=n/n_rev 0.4026\n", - "in % 40.26\n" - ] - } - ], - "source": [ - "#cal of second law efficiency\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.13, Page:228 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\")\n", - "T_min=(20.+273.);#minimum temperature reservoir temperature in K\n", - "T_max=(500.+273.);#maximum temperature reservoir temperature in K\n", - "n=0.25;#efficiency of heat engine\n", - "n_rev=1-(T_min/T_max)\n", - "print(\"reversible engine efficiency,n_rev=1-(T_min/T_max)\"),round(n_rev,4)\n", - "n/n_rev\n", - "print(\"second law efficiency=n/n_rev\"),round(n/n_rev,4)\n", - "print(\"in %\"),round(n*100/n_rev,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.14;pg no: 228" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.14, Page:228 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\n", - "expansion occurs in adiabatic conditions.\n", - "temperature after expansion can be obtained by considering adiabatic expansion\n", - "T2/T1=(V1/V2)^(y-1)\n", - "so T2= in K= 489.12\n", - "mass of air,m in kg= 20.91\n", - "change in entropy of control system,deltaSs=(S2-S1) in KJ/K= -0.0\n", - "here,there is no change in entropy of environment,deltaSe=0\n", - "total entropy change of combined system=deltaSc in KJ/K= -0.0\n", - "loss of available energy(E)=irreversibility in KJ= -0.603\n", - "so loss of available energy,E=0.603 KJ\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.14, Page:228 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\")\n", - "V_A=6.;#volume of compartment A in m^3\n", - "V_B=4.;#volume of compartment B in m^3\n", - "To=300.;#temperature of atmosphere in K\n", - "Po=1.*10**5;#atmospheric pressure in pa\n", - "P1=6.*10**5;#initial pressure in pa\n", - "T1=600.;#initial temperature in K\n", - "V1=V_A;#initial volume in m^3\n", - "V2=(V_A+V_B);#final volume in m^3\n", - "y=1.4;#expansion constant \n", - "R=287.;#gas constant in J/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "print(\"expansion occurs in adiabatic conditions.\")\n", - "print(\"temperature after expansion can be obtained by considering adiabatic expansion\")\n", - "T2=T1*(V1/V2)**(y-1)\n", - "print(\"T2/T1=(V1/V2)^(y-1)\")\n", - "print(\"so T2= in K=\"),round(T2,2)\n", - "T2=489.12;#approx.\n", - "m=(P1*V1)/(R*T1)\n", - "print(\"mass of air,m in kg=\"),round(m,2)\n", - "m=20.91;#approx.\n", - "deltaSs=m*Cv*math.log(T2/T1)+m*R*10**-3*math.log(V2/V1)\n", - "print(\"change in entropy of control system,deltaSs=(S2-S1) in KJ/K=\"),round(deltaSs,2)\n", - "print(\"here,there is no change in entropy of environment,deltaSe=0\")\n", - "deltaSe=0;\n", - "deltaSc=deltaSs+deltaSe\n", - "print(\"total entropy change of combined system=deltaSc in KJ/K=\"),round(deltaSc,2)\n", - "E=To*deltaSc\n", - "print(\"loss of available energy(E)=irreversibility in KJ=\"),round(E,3)\n", - "print(\"so loss of available energy,E=0.603 KJ\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.15;pg no: 229" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.15, Page:229 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\n", - "In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#cal of maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.15, Page:229 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\")\n", - "print(\"In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.16;pg no: 230" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.16, Page:230 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\n", - "availability or reversible work,W_rev=n_rev*Q1 in KJ/min 229.53\n", - "rate of irreversibility,I=W_rev-W_useful in KJ/sec 99.53\n", - "second law efficiency=W_useful/W_rev 0.57\n", - "in percentage 56.64\n", - "so availability=1.38*10^4 KJ/min\n", - "and rate of irreversibility=100 KW,second law efficiency=56.63 %\n", - "NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\n" - ] - } - ], - "source": [ - "#cal of availability,rate of irreversibility and second law efficiency\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.16, Page:230 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\")\n", - "To=(17.+273.);#temperature of surrounding in K\n", - "T1=(700.+273.);#temperature of high temperature reservoir in K\n", - "T2=(30.+273.);#temperature of low temperature reservoir in K\n", - "Q1=2.*10**4;#rate of heat receive in KJ/min\n", - "W_useful=0.13*10**3;#output of engine in KW\n", - "n_rev=(1-T2/T1);\n", - "W_rev=n_rev*Q1\n", - "W_rev=W_rev/60.;#W_rev in KJ/s\n", - "print(\"availability or reversible work,W_rev=n_rev*Q1 in KJ/min\"),round(W_rev,2)\n", - "I=W_rev-W_useful\n", - "print(\"rate of irreversibility,I=W_rev-W_useful in KJ/sec\"),round(I,2)\n", - "W_useful/W_rev\n", - "print(\"second law efficiency=W_useful/W_rev\"),round(W_useful/W_rev,2)\n", - "W_useful*100/W_rev\n", - "print(\"in percentage\"),round(W_useful*100/W_rev,2)\n", - "print(\"so availability=1.38*10^4 KJ/min\")\n", - "print(\"and rate of irreversibility=100 KW,second law efficiency=56.63 %\")\n", - "print(\"NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.17;pg no: 230" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.17, Page:230 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\n", - "loss of available energy=irreversibility=To*deltaSc\n", - "deltaSc=deltaSs+deltaSe\n", - "change in entropy of system=deltaSs\n", - "change in entropy of environment/surroundings=deltaSe\n", - "here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\n", - "P1/T1=P2/T2\n", - "so T2 in K= 555.0\n", - "heat addition to air in tank\n", - "Q in KJ/kg= 223.11\n", - "deltaSs in KJ/kg K= 0.67\n", - "deltaSe in KJ/kg K= -0.33\n", - "and deltaSc in KJ/kg K= 0.34\n", - "so loss of available energy(E)in KJ/kg= 101.55\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.17, Page:230 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\")\n", - "To=(27+273);#temperature of surrounding in K\n", - "T1=(60+273);#initial temperature of air in K\n", - "P1=1.5*10**5;#initial pressure of air in pa\n", - "P2=2.5*10**5;#final pressure of air in pa\n", - "T_reservoir=(400+273);#temperature of reservoir in K\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", - "print(\"deltaSc=deltaSs+deltaSe\")\n", - "print(\"change in entropy of system=deltaSs\")\n", - "print(\"change in entropy of environment/surroundings=deltaSe\")\n", - "print(\"here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\")\n", - "print(\"P1/T1=P2/T2\")\n", - "T2=P2*T1/P1\n", - "print(\"so T2 in K=\"),round(T2,2)\n", - "print(\"heat addition to air in tank\")\n", - "deltaT=T2-T1;\n", - "Q=Cp*deltaT\n", - "print(\"Q in KJ/kg=\"),round(Q,2)\n", - "deltaSs=Q/T1\n", - "print(\"deltaSs in KJ/kg K=\"),round(deltaSs,2)\n", - "deltaSe=-Q/T_reservoir\n", - "print(\"deltaSe in KJ/kg K=\"),round(deltaSe,2)\n", - "deltaSc=deltaSs+deltaSe\n", - "print(\"and deltaSc in KJ/kg K=\"),round(deltaSc,2)\n", - "E=To*deltaSc\n", - "print(\"so loss of available energy(E)in KJ/kg=\"),round(E,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.18;pg no: 231" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.18, Page:231 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\n", - "In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.18, Page:231 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\")\n", - "print(\"In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.19;pg no: 232" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.19, Page:232 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\n", - "clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\n", - "from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\n", - "v_fg in m^3/kg= 0.0\n", - "let us approximate,\n", - "(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\n", - "here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\n", - "substituting in clapeyron equation,\n", - "h_fg in KJ/kg 1941.25\n", - "so calculated enthalpy of vaporisation=1941.25 KJ/kg\n", - "and enthalpy of vaporisation from steam table=1940.7 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of enthalpy of vaporisation\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.19, Page:232 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\")\n", - "T=(200+273);#temperature of water in K\n", - "print(\"clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\")\n", - "print(\"from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\")\n", - "vg=0.12736;\n", - "vf=0.001157;\n", - "v_fg=(vg-vf)\n", - "print(\"v_fg in m^3/kg=\"),round(v_fg)\n", - "print(\"let us approximate,\")\n", - "print(\"(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\")\n", - "print(\"here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\")\n", - "P_205oc=1.7230;#pressure at 205 degree celcius in Mpa\n", - "P_195oc=1.3978;#pressure at 195 degree celcius in Mpa\n", - "(P_205oc-P_195oc)/(205-195)\n", - "print(\"substituting in clapeyron equation,\")\n", - "h_fg=T*v_fg*(P_205oc-P_195oc)*1000/(205-195)\n", - "print(\"h_fg in KJ/kg\"),round(h_fg,2)\n", - "print(\"so calculated enthalpy of vaporisation=1941.25 KJ/kg\")\n", - "print(\"and enthalpy of vaporisation from steam table=1940.7 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.20;pg no: 232" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.20, Page:232 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\n", - "by clapeyron equation\n", - "h_fg=T2*v_fg*(do/dT)_sat \n", - "h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\n", - "by clapeyron-clausius equation,\n", - "log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\n", - "log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\n", - "so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\n", - "% deviation from clapeyron equation in % 6.44\n", - "h_fg by clapeyron equation=159.49 KJ/kg\n", - "h_fg by clapeyron-clausius equation=169.76 KJ/kg\n", - "% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.20, Page:232 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\")\n", - "P2=260.96;#saturation pressure at -5 degree celcius\n", - "P1=182.60;#saturation pressure at -15 degree celcius\n", - "vg=0.07665;#specific volume of gas at -10 degree celcius in m^3/kg\n", - "vf=0.00070#specific volume at -10 degree celcius in m^3/kg\n", - "R=0.06876;#gas constant in KJ/kg K\n", - "h_fg=156.3;#enthalpy in KJ/kg K\n", - "T2=(-5.+273.);#temperature in K\n", - "T1=(-15.+273.);#temperature in K\n", - "print(\"by clapeyron equation\")\n", - "print(\"h_fg=T2*v_fg*(do/dT)_sat \")\n", - "print(\"h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\")\n", - "h_fg=T2*(vg-vf)*(P1-P2)/(T1-T2)\n", - "print(\"by clapeyron-clausius equation,\")\n", - "print(\"log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\")\n", - "print(\"log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\")\n", - "print(\"so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\")\n", - "h_fg=math.log(P2/P1)*R/((1/T1)-(1/T2))\n", - "print(\"% deviation from clapeyron equation in %\"),round((169.76-159.49)*100/159.49,2)\n", - "print(\"h_fg by clapeyron equation=159.49 KJ/kg\")\n", - "print(\"h_fg by clapeyron-clausius equation=169.76 KJ/kg\")\n", - "print(\"% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.21;pg no: 233" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "ename": "SyntaxError", - "evalue": "invalid syntax (, line 15)", - "output_type": "error", - "traceback": [ - "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m15\u001b[0m\n\u001b[1;33m volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" - ] - } - ], - "source": [ - "#cal of volume expansivity and isothermal compressibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.21, Page:233 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 21\")\n", - "print(\"volume expansion=(1/v)*(dv/dT)_P\")\n", - "print(\"isothermal compressibility=-(1/v)*(dv/dp)_T\")\n", - "print(\"let us write dv/dT=deltav/deltaT and dv/dP=deltav/deltaP.The difference may be taken for small pressure and temperature changes.\")\n", - "print(\"volume expansivity in K^-1,\")\n", - "print(\"=(1/v)*(dv/dT)_300Kpa\")\n", - "v_300Kpa_300oc=0.8753;#specific volume at 300Kpa and 300 degree celcius\n", - "v_350oc=0.9534;#specific volume 350 degree celcius\n", - "v_250oc=0.7964;#specific volume 250 degree celcius\n", - "volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\n", - "print(\"volume expansivity in Kpa\"),round(volume expansivity,2)\n", - "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350oc=0.9534 in m^3/kg,v_250oc=0.7964 in m^3/kg\")\n", - "print(\"volume expansivity=1.7937*10^-3 K^-1\")\n", - "isothermal=(-1/v_300Kpa_300oc)*(v_350Kpa-v_250Kpa)/(350-250)\n", - "print(\"isothermal compressibility in Kpa^-1\")\n", - "print(\"isothermal compressibility\"),round(isothermal compressibility,2)\n", - "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350Kpa=0.76505 in m^3/kg,v_250Kpa=1.09575 in m^3/kg\")\n", - "v_350Kpa=0.76505;#specific volume 350 Kpa\n", - "v_250Kpa=1.09575;#specific volume 250 Kpa\n", - "print(\"so isothermal compressibility=3.778*10^-3 Kpa^-1\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.22;pg no: 234" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.22, Page:234 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\n", - "filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\n", - "hi=uf\n", - "Cp*Ti=Cv*Tf\n", - "so Tf=Cp*Ti/Cv in K 417.33\n", - "inside final temperature,Tf=417.33 K\n", - "change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K= 0.338\n", - "Cp*log(Tf/Ti)+0\n", - "change in entropy,deltaS_gen=0.3379 KJ/kg K\n", - "irreversibility,I in KJ/kg= 100.76\n", - "irreversibility,I=100.74 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of inside final temperature,change in entropy and irreversibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.22, Page:234 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\")\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "Ti=(25+273.15);#atmospheric temperature in K\n", - "print(\"filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\")\n", - "print(\"hi=uf\")\n", - "print(\"Cp*Ti=Cv*Tf\")\n", - "Tf=Cp*Ti/Cv\n", - "print(\"so Tf=Cp*Ti/Cv in K\"),round(Tf,2)\n", - "print(\"inside final temperature,Tf=417.33 K\")\n", - "deltaS_gen=Cp*math.log(Tf/Ti)\n", - "print(\"change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K=\"),round(deltaS_gen,4)\n", - "print(\"Cp*log(Tf/Ti)+0\")\n", - "print(\"change in entropy,deltaS_gen=0.3379 KJ/kg K\")\n", - "To=Ti;\n", - "I=To*deltaS_gen\n", - "print(\"irreversibility,I in KJ/kg=\"),round(I,2)\n", - "print(\"irreversibility,I=100.74 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.23;pg no: 234" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.23, Page:234 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\n", - "here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\n", - "therefore,d(E-To-S)/dt=W_max\n", - "or W_max=(E-To-S)1-(E-To-S)2\n", - "here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\n", - "therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\n", - "so maximum work in KJ= 40946.6\n" - ] - } - ], - "source": [ - "#cal of maximum work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.23, Page:234 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\")\n", - "m=75.;#mass of hot water in kg\n", - "T1=(400.+273.);#temperature of hot water in K\n", - "T2=(27.+273.);#temperature of environment in K\n", - "Cp=4.18;#specific heat of water in KJ/kg K\n", - "print(\"here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\")\n", - "print(\"therefore,d(E-To-S)/dt=W_max\")\n", - "print(\"or W_max=(E-To-S)1-(E-To-S)2\")\n", - "print(\"here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\")\n", - "print(\"therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\")\n", - "To=T2;\n", - "W_max=m*Cp*(T1-T2)-To*m*Cp*math.log(T1/T2)\n", - "print(\"so maximum work in KJ=\"),round(W_max,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.24;pg no: 235" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.24, Page:235 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\n", - "from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\n", - "inlet stream availability in KJ/kg= 1587.19\n", - "input stream availability is equal to the input absolute availability.\n", - "exit stream availaability in KJ/kg 238.69\n", - "exit stream availability is equal to the exit absolute availability.\n", - "W_rev in KJ/kg\n", - "irreversibility=W_rev-W in KJ/kg 348.49\n", - "this irreversibility is in fact the availability loss.\n", - "inlet stream availability=1587.18 KJ/kg\n", - "exit stream availability=238.69 KJ/kg\n", - "irreversibility=348.49 KJ/kg\n", - "NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \n" - ] - } - ], - "source": [ - "#cal of inlet stream availability,exit stream availability and irreversibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.24, Page:235 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\")\n", - "C1=150;#steam entering velocity in m/s\n", - "C2=50;#steam leaving velocity in m/s\n", - "To=(15+273);#dead state temperature in K\n", - "W=1000;#expansion work in KJ/kg\n", - "print(\"from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\")\n", - "h1=3666.5;\n", - "s1=7.2589;\n", - "h2=2584.7;\n", - "s2=8.1502;\n", - "(h1+C1**2*10**-3/2)-To*s1\n", - "print(\"inlet stream availability in KJ/kg=\"),round((h1+C1**2*10**-3/2)-To*s1,2)\n", - "(h2+C2**2*10**-3/2)-To*s2\n", - "print(\"input stream availability is equal to the input absolute availability.\")\n", - "print(\"exit stream availaability in KJ/kg\"),round((h2+C2**2*10**-3/2)-To*s2,2)\n", - "print(\"exit stream availability is equal to the exit absolute availability.\")\n", - "print(\"W_rev in KJ/kg\")\n", - "W_rev=1587.18-238.69\n", - "W_rev-W\n", - "print(\"irreversibility=W_rev-W in KJ/kg\"),round(W_rev-W,2)\n", - "print(\"this irreversibility is in fact the availability loss.\")\n", - "print(\"inlet stream availability=1587.18 KJ/kg\")\n", - "print(\"exit stream availability=238.69 KJ/kg\")\n", - "print(\"irreversibility=348.49 KJ/kg\")\n", - "print(\"NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter7_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter7_1.ipynb deleted file mode 100755 index ef30a163..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter7_1.ipynb +++ /dev/null @@ -1,1452 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 7:Availability and General Thermodynamic Relation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.1;page no: 218" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.1, Page:218 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\n", - "let us neglect the potential energy change during the flow.\n", - "applying S.F.E.E,neglecting inlet velocity and change in potential energy,\n", - "W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\n", - "W_max=(h1-h2)-To*(s1-s2)-C2^2/2\n", - "from steam tables,\n", - "h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\n", - "given To=288 K\n", - "so W_max in KJ/kg= 457.1\n", - "maximum possible work(W_max) in KW= 1142.76\n" - ] - } - ], - "source": [ - "#cal of maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.1, Page:218 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\")\n", - "C2=150;#leave velocity of steam in m/s\n", - "m=2.5;#steam mass flow rate in kg/s\n", - "print(\"let us neglect the potential energy change during the flow.\")\n", - "print(\"applying S.F.E.E,neglecting inlet velocity and change in potential energy,\")\n", - "print(\"W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\")\n", - "print(\"W_max=(h1-h2)-To*(s1-s2)-C2^2/2\")\n", - "print(\"from steam tables,\")\n", - "print(\"h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\")\n", - "h1=3034.8;\n", - "s1=6.8844;\n", - "h2=2776.4;\n", - "s2=7.6134;\n", - "print(\"given To=288 K\")\n", - "To=288;\n", - "W_max=(h1-h2)-To*(s1-s2)-(C2**2/2*10**-3)\n", - "print(\"so W_max in KJ/kg=\"),round(W_max,2)\n", - "W_max=m*W_max\n", - "print(\"maximum possible work(W_max) in KW=\"),round(W_max,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.2;page no: 219" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.2, Page:219 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\n", - "In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\n", - "BOTH THE TANKS HAVE SAME INTERNAL ENERGY\n", - "availability of air in tank,A\n", - "A=(E-Uo)+Po*(V-Vo)-To*(S-So)\n", - "=m*{(e-uo)+Po(v-vo)-To(s-so)}\n", - "m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\n", - "so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\n", - "for tank A,P in pa,so availability_A in KJ= 1.98\n", - "for tank B,P=3*10^5 pa,so availability_B in KJ= 30.98\n", - "so availability of air in tank B is more than that of tank A\n", - "availability of air in tank A=1.98 KJ\n", - "availability of air in tank B=30.98 KJ\n" - ] - } - ], - "source": [ - "#cal of availability of air in tank A,B\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.2, Page:219 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\")\n", - "m=1.;#mass of air in kg\n", - "Po=1.*10**5;#atmospheric pressure in pa\n", - "To=(15.+273.);#temperature of atmosphere in K\n", - "Cv=0.717;#specific heat at constant volume in KJ/kg K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", - "T=(50.+273.);#temperature of tanks A and B in K\n", - "print(\"In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\")\n", - "print(\"BOTH THE TANKS HAVE SAME INTERNAL ENERGY\")\n", - "print(\"availability of air in tank,A\")\n", - "print(\"A=(E-Uo)+Po*(V-Vo)-To*(S-So)\")\n", - "print(\"=m*{(e-uo)+Po(v-vo)-To(s-so)}\")\n", - "print(\"m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\")\n", - "print(\"so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\")\n", - "P=1.*10**5;#pressure in tank A in pa\n", - "availability_A=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", - "print(\"for tank A,P in pa,so availability_A in KJ=\"),round(availability_A,2)\n", - "P=3.*10**5;#pressure in tank B in pa\n", - "availability_B=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", - "print(\"for tank B,P=3*10^5 pa,so availability_B in KJ=\"),round(availability_B,2)\n", - "print(\"so availability of air in tank B is more than that of tank A\")\n", - "print(\"availability of air in tank A=1.98 KJ\")\n", - "print(\"availability of air in tank B=30.98 KJ\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.3;page no: 221" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.3, Page:221 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\n", - "inlet conditions,\n", - "from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\n", - "outlet conditions,at 0.05 bar and 0.95 dryness fraction\n", - "from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\n", - "so s2= in KJ/kg K= 8.0\n", - "and h2= in KJ/kg= 2440.34\n", - "neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\n", - "w in KJ/kg= 598.06\n", - "power output in KW= 8970.97\n", - "maximum work for given end states,\n", - "w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg 850.43\n", - "w_max in KW 12755.7\n", - "so maximum power output=12755.7 KW\n", - "maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\n", - "A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\n", - "=(h2-ho)+V2^2/2-To(s2-so)\n", - "approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\n", - "from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\n", - "maximum work available from exhaust steam,A_exhaust in KJ/kg\n", - "A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so) 151.1\n", - "maximum power that could be obtained from exhaust steam in KW= 2266.5\n", - "so maximum power from exhaust steam=2266.5 KW\n" - ] - } - ], - "source": [ - "#cal of maximum power output and that could be obtained from exhaust steam\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.3, Page:221 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\")\n", - "m=15;#steam flow rate in kg/s\n", - "V2=160;#exit velocity of steam in m/s\n", - "To=(15+273);#pond water temperature in K\n", - "print(\"inlet conditions,\")\n", - "print(\"from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\")\n", - "h1=3051.2;\n", - "s1=7.1229;\n", - "print(\"outlet conditions,at 0.05 bar and 0.95 dryness fraction\")\n", - "print(\"from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\")\n", - "sf=0.4764;\n", - "s_fg=7.9187;\n", - "x=0.95;\n", - "hf=137.82;\n", - "h_fg=2423.7;\n", - "s2=sf+x*s_fg\n", - "print(\"so s2= in KJ/kg K=\"),round(s2,2)\n", - "h2=hf+x*h_fg\n", - "print(\"and h2= in KJ/kg=\"),round(h2,2)\n", - "print(\"neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\")\n", - "w=(h1-h2)-V2**2*10**-3/2\n", - "print(\"w in KJ/kg=\"),round(w,2)\n", - "print(\"power output in KW=\"),round(m*w,2)\n", - "print(\"maximum work for given end states,\")\n", - "w_max=(h1-To*s1)-(h2+V2**2*10**-3/2-To*s2)\n", - "print(\"w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg\"),round(w_max,2)\n", - "w_max=850.38;#approx.\n", - "w_max=m*w_max\n", - "print(\"w_max in KW\"),round(w_max,2)\n", - "print(\"so maximum power output=12755.7 KW\")\n", - "print(\"maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\")\n", - "print(\"A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\")\n", - "print(\"=(h2-ho)+V2^2/2-To(s2-so)\")\n", - "print(\"approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\")\n", - "print(\"from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\")\n", - "ho=62.99;\n", - "so=0.2245;\n", - "print(\"maximum work available from exhaust steam,A_exhaust in KJ/kg\")\n", - "A_exhaust=(h2-ho)+V2**2*10**-3/2-To*(s2-so)\n", - "A_exhaust=151.1;#approx.\n", - "print(\"A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so)\"),round(A_exhaust,2)\n", - "print(\"maximum power that could be obtained from exhaust steam in KW=\"),round(m*A_exhaust,2)\n", - "print(\"so maximum power from exhaust steam=2266.5 KW\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.4;page no: 222" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.4, Page:222 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\n", - "for dead state of water,\n", - "from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\n", - "for initial state of water,\n", - "from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\n", - "for final state of water,\n", - "from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\n", - "availability at any state can be given by\n", - "A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\n", - "so availability at initial state,A1 in KJ\n", - "A1= 2703.28\n", - "and availability at final state,A2 in KJ\n", - "A2= 1.09\n", - "change in availability,A2-A1 in KJ= -2702.19\n", - "hence availability decreases by 2702.188 KJ\n", - "NOTE=>In this question,due to large calculations,answers are approximately correct.\n" - ] - } - ], - "source": [ - "#cal of availability at initial,final state and also change\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.4, Page:222 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\")\n", - "m=5;#mass of steam in kg\n", - "z1=10;#initial elevation in m\n", - "V1=25;#initial velocity of steam in m/s\n", - "z2=2;#final elevation in m\n", - "V2=10;#final velocity of steam in m/s\n", - "Po=100;#environmental pressure in Kpa\n", - "To=(25+273);#environmental temperature in K\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"for dead state of water,\")\n", - "print(\"from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\")\n", - "uo=104.86;\n", - "vo=1.0029*10**-3;\n", - "so=0.3673;\n", - "print(\"for initial state of water,\")\n", - "print(\"from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\")\n", - "u1=2550;\n", - "v1=0.5089;\n", - "s1=6.93;\n", - "print(\"for final state of water,\")\n", - "print(\"from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\")\n", - "u2=83.94;\n", - "v2=1.0018*10**-3;\n", - "s2=0.2966;\n", - "print(\"availability at any state can be given by\")\n", - "print(\"A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\")\n", - "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+V1**2*10**-3/2+g*z1*10**-3)\n", - "print(\"so availability at initial state,A1 in KJ\")\n", - "print(\"A1=\"),round(A1,2)\n", - "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+V2**2*10**-3/2+g*z2*10**-3)\n", - "print(\"and availability at final state,A2 in KJ\")\n", - "print(\"A2=\"),round(A2,2)\n", - "A2-A1\n", - "print(\"change in availability,A2-A1 in KJ=\"),round(A2-A1,2)\n", - "print(\"hence availability decreases by 2702.188 KJ\")\n", - "print(\"NOTE=>In this question,due to large calculations,answers are approximately correct.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.5;page no: 223" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.5, Page:223 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\n", - "In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.5, Page:223 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\")\n", - "print(\"In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.6;pg no: 223" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.6, Page:223 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\n", - "loss of available energy=irreversibility=To*deltaSc\n", - "deltaSc=deltaSs+deltaSe\n", - "change in enropy of system(deltaSs)=W/T in KJ/kg K 0.98\n", - "change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K -2.8\n", - "loss of available energy(E) in KJ/kg= -550.49\n", - "loss of available energy(E)= -550.49\n", - "ratio of lost available exhaust gas energy to engine work=E/W= 0.524\n" - ] - } - ], - "source": [ - "#cal of available energy and ratio of lost available exhaust gas energy to engine work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.6, Page:223 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\")\n", - "To=(30.+273.);#temperature of surrounding in K\n", - "W=1050.;#work done in engine in KJ/kg\n", - "Cp=1.1;#specific heat at constant pressure in KJ/kg K\n", - "T=(800.+273.);#temperature of exhaust gas in K\n", - "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", - "print(\"deltaSc=deltaSs+deltaSe\")\n", - "deltaSs=W/T\n", - "print(\"change in enropy of system(deltaSs)=W/T in KJ/kg K\"),round(deltaSs,2)\n", - "deltaSe=-Cp*(T-To)/To\n", - "print(\"change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K\"),round(deltaSe,2)\n", - "E=To*(deltaSs+deltaSe)\n", - "print(\"loss of available energy(E) in KJ/kg=\"),round(E,2)\n", - "E=-E\n", - "print(\"loss of available energy(E)=\"),round(-E,2)\n", - "print(\"ratio of lost available exhaust gas energy to engine work=E/W=\"),round(E/W,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.7;pg no: 224" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.7, Page:224 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\n", - "let us consider velocities and elevations to be given in reference to environment.Availability is given by\n", - "A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\n", - "dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\n", - "for initial state of saturated vapour at 150 degree celcius\n", - "from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\n", - "for final state of saturated liquid at 20 degree celcius\n", - "from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\n", - "substituting in the expression for availability\n", - "initial state availability,A1 in KJ\n", - "A1= 5650.31\n", - "final state availability,A2 in KJ\n", - "A2= 2.58\n", - "change in availability,deltaA in KJ= -5647.72\n", - "so initial availability =5650.28 KJ\n", - "final availability=2.58 KJ \n", - "change in availability=decrease by 5647.70 KJ \n" - ] - } - ], - "source": [ - "#cal of initial,final and change in availability\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.7, Page:224 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\")\n", - "m=10;#mass of water in kg\n", - "C1=25;#initial velocity in m/s\n", - "C2=10;#final velocity in m/s\n", - "Po=0.1*1000;#environmental pressure in Kpa\n", - "To=(25+273.15);#environmental temperature in K\n", - "g=9.8;#acceleration due to gravity in m/s^2\n", - "z1=10;#initial elevation in m\n", - "z2=3;#final elevation in m\n", - "print(\"let us consider velocities and elevations to be given in reference to environment.Availability is given by\")\n", - "print(\"A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\")\n", - "print(\"dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\")\n", - "uo=104.88;\n", - "vo=1.003*10**-3;\n", - "so=0.3674;\n", - "print(\"for initial state of saturated vapour at 150 degree celcius\")\n", - "print(\"from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\")\n", - "u1=2559.5;\n", - "v1=0.3928;\n", - "s1=6.8379;\n", - "print(\"for final state of saturated liquid at 20 degree celcius\")\n", - "print(\"from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\")\n", - "u2=83.95;\n", - "v2=0.001002;\n", - "s2=0.2966;\n", - "print(\"substituting in the expression for availability\")\n", - "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+C1**2*10**-3/2+g*z1*10**-3)\n", - "print(\"initial state availability,A1 in KJ\")\n", - "print(\"A1=\"),round(A1,2)\n", - "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+C2**2*10**-3/2+g*z2*10**-3)\n", - "print(\"final state availability,A2 in KJ\")\n", - "print(\"A2=\"),round(A2,2)\n", - "deltaA=A2-A1\n", - "print(\"change in availability,deltaA in KJ=\"),round(deltaA,2)\n", - "print(\"so initial availability =5650.28 KJ\")\n", - "print(\"final availability=2.58 KJ \")\n", - "print(\"change in availability=decrease by 5647.70 KJ \")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.8;pg no: 225" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.8, Page:225 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\n", - "let inlet and exit states of turbine be denoted as 1 and 2\n", - "at inlet to turbine,\n", - "from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\n", - "at exit from turbine,\n", - "from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\n", - "at dead state,\n", - "from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\n", - "availability of steam at inlet,A1 in KJ= 6792.43\n", - "so availability of steam at inlet=6792.43 KJ\n", - "applying first law of thermodynamics,\n", - "Q+m*h1=m*h2+W\n", - "so W in KJ/s= 2829.0\n", - "so turbine output=2829 KW\n", - "maximum possible turbine output will be available when irreversibility is zero.\n", - "W_rev=W_max=A1-A2\n", - "W_max in KJ/s= 3804.82\n", - "so maximum output=3804.81 KW\n", - "irreversibility can be estimated by the difference between the maximum output and turbine output.\n", - "I= in KW= 975.82\n", - "so irreversibility=975.81807 KW\n", - "NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\n" - ] - } - ], - "source": [ - "#cal of availability of steam at inlet,turbine output,maximum possible turbine output,irreversibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.8, Page:225 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\")\n", - "m=5.;#steam flow rate in kg/s\n", - "p1=5.*1000.;#initial pressure of steam in Kpa\n", - "T1=(500.+273.15);#initial temperature of steam in K \n", - "p2=0.2*1000.;#final pressure of steam in Kpa\n", - "T1=(140.+273.15);#final temperature of steam in K\n", - "po=101.3;#pressure of steam at dead state in Kpa\n", - "To=(25.+273.15);#temperature of steam at dead state in K \n", - "Q=600.;#heat loss through turbine in KJ/s\n", - "print(\"let inlet and exit states of turbine be denoted as 1 and 2\")\n", - "print(\"at inlet to turbine,\")\n", - "print(\"from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\")\n", - "h1=3433.8;\n", - "s1=6.9759;\n", - "print(\"at exit from turbine,\")\n", - "print(\"from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\")\n", - "h2=2748;\n", - "s2=7.228;\n", - "print(\"at dead state,\")\n", - "print(\"from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\")\n", - "ho=104.96;\n", - "so=0.3673;\n", - "A1=m*((h1-ho)-To*(s1-so))\n", - "print(\"availability of steam at inlet,A1 in KJ=\"),round(A1,2)\n", - "print(\"so availability of steam at inlet=6792.43 KJ\")\n", - "print(\"applying first law of thermodynamics,\")\n", - "print(\"Q+m*h1=m*h2+W\")\n", - "W=m*(h1-h2)-Q\n", - "print(\"so W in KJ/s=\"),round(W,2)\n", - "print(\"so turbine output=2829 KW\")\n", - "print(\"maximum possible turbine output will be available when irreversibility is zero.\")\n", - "print(\"W_rev=W_max=A1-A2\")\n", - "W_max=m*((h1-h2)-To*(s1-s2))\n", - "print(\"W_max in KJ/s=\"),round(W_max,2)\n", - "print(\"so maximum output=3804.81 KW\")\n", - "print(\"irreversibility can be estimated by the difference between the maximum output and turbine output.\")\n", - "I=W_max-W\n", - "print(\"I= in KW=\"),round(I,2)\n", - "print(\"so irreversibility=975.81807 KW\")\n", - "print(\"NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.9;pg no: 226" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.9, Page:226 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\n", - "In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.9, Page:226 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\")\n", - "print(\"In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.10;pg no: 227" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.10, Page:227 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\n", - "In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.10, Page:227 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\")\n", - "print(\"In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.11;pg no: 227" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.11, Page:227 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\n", - "availability for heat reservoir(A_HR) in KJ/kg K 167.66\n", - "now availability for system(A_system) in KJ/kg K 194.44\n", - "net loss of available energy(A) in KJ/kg K= -26.78\n", - "so loss of available energy=26.77 KJ/kg K\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.11, Page:227 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\")\n", - "To=280.;#surrounding temperature in K\n", - "Q=500.;#heat removed in KJ\n", - "T1=835.;#temperature of reservoir in K\n", - "T2=720.;#temperature of system in K\n", - "A_HR=To*Q/T1\n", - "print(\"availability for heat reservoir(A_HR) in KJ/kg K\"),round(A_HR,2)\n", - "A_system=To*Q/T2\n", - "print(\"now availability for system(A_system) in KJ/kg K\"),round(A_system,2)\n", - "A=A_HR-A_system \n", - "print(\"net loss of available energy(A) in KJ/kg K=\"),round(A,2)\n", - "print(\"so loss of available energy=26.77 KJ/kg K\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.12;pg no: 228" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.12, Page:228 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\n", - "here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\n", - "W_max=W1-W2 in KJ/kg 1647.0\n", - "actual work from turbine,W_actual=h1-h2 in KJ/kg 1557.0\n", - "so actual work=1557 KJ/kg\n", - "maximum possible work=1647 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of actual,maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.12, Page:228 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\")\n", - "h1=4142;#enthalpy at entrance in KJ/kg\n", - "h2=2585;#enthalpy at exit in KJ/kg\n", - "W1=1787;#availability of steam at entrance in KJ/kg\n", - "W2=140;#availability of steam at exit in KJ/kg\n", - "print(\"here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\")\n", - "W_max=W1-W2\n", - "print(\"W_max=W1-W2 in KJ/kg\"),round(W_max,2)\n", - "W_actual=h1-h2\n", - "print(\"actual work from turbine,W_actual=h1-h2 in KJ/kg\"),round(W_actual,2)\n", - "print(\"so actual work=1557 KJ/kg\")\n", - "print(\"maximum possible work=1647 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.13;pg no: 228" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.13, Page:228 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\n", - "reversible engine efficiency,n_rev=1-(T_min/T_max) 0.621\n", - "second law efficiency=n/n_rev 0.4026\n", - "in % 40.26\n" - ] - } - ], - "source": [ - "#cal of second law efficiency\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.13, Page:228 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\")\n", - "T_min=(20.+273.);#minimum temperature reservoir temperature in K\n", - "T_max=(500.+273.);#maximum temperature reservoir temperature in K\n", - "n=0.25;#efficiency of heat engine\n", - "n_rev=1-(T_min/T_max)\n", - "print(\"reversible engine efficiency,n_rev=1-(T_min/T_max)\"),round(n_rev,4)\n", - "n/n_rev\n", - "print(\"second law efficiency=n/n_rev\"),round(n/n_rev,4)\n", - "print(\"in %\"),round(n*100/n_rev,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.14;pg no: 228" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.14, Page:228 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\n", - "expansion occurs in adiabatic conditions.\n", - "temperature after expansion can be obtained by considering adiabatic expansion\n", - "T2/T1=(V1/V2)^(y-1)\n", - "so T2= in K= 489.12\n", - "mass of air,m in kg= 20.91\n", - "change in entropy of control system,deltaSs=(S2-S1) in KJ/K= -0.0\n", - "here,there is no change in entropy of environment,deltaSe=0\n", - "total entropy change of combined system=deltaSc in KJ/K= -0.0\n", - "loss of available energy(E)=irreversibility in KJ= -0.603\n", - "so loss of available energy,E=0.603 KJ\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.14, Page:228 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\")\n", - "V_A=6.;#volume of compartment A in m^3\n", - "V_B=4.;#volume of compartment B in m^3\n", - "To=300.;#temperature of atmosphere in K\n", - "Po=1.*10**5;#atmospheric pressure in pa\n", - "P1=6.*10**5;#initial pressure in pa\n", - "T1=600.;#initial temperature in K\n", - "V1=V_A;#initial volume in m^3\n", - "V2=(V_A+V_B);#final volume in m^3\n", - "y=1.4;#expansion constant \n", - "R=287.;#gas constant in J/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "print(\"expansion occurs in adiabatic conditions.\")\n", - "print(\"temperature after expansion can be obtained by considering adiabatic expansion\")\n", - "T2=T1*(V1/V2)**(y-1)\n", - "print(\"T2/T1=(V1/V2)^(y-1)\")\n", - "print(\"so T2= in K=\"),round(T2,2)\n", - "T2=489.12;#approx.\n", - "m=(P1*V1)/(R*T1)\n", - "print(\"mass of air,m in kg=\"),round(m,2)\n", - "m=20.91;#approx.\n", - "deltaSs=m*Cv*math.log(T2/T1)+m*R*10**-3*math.log(V2/V1)\n", - "print(\"change in entropy of control system,deltaSs=(S2-S1) in KJ/K=\"),round(deltaSs,2)\n", - "print(\"here,there is no change in entropy of environment,deltaSe=0\")\n", - "deltaSe=0;\n", - "deltaSc=deltaSs+deltaSe\n", - "print(\"total entropy change of combined system=deltaSc in KJ/K=\"),round(deltaSc,2)\n", - "E=To*deltaSc\n", - "print(\"loss of available energy(E)=irreversibility in KJ=\"),round(E,3)\n", - "print(\"so loss of available energy,E=0.603 KJ\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.15;pg no: 229" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.15, Page:229 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\n", - "In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#cal of maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.15, Page:229 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\")\n", - "print(\"In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.16;pg no: 230" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.16, Page:230 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\n", - "availability or reversible work,W_rev=n_rev*Q1 in KJ/min 229.53\n", - "rate of irreversibility,I=W_rev-W_useful in KJ/sec 99.53\n", - "second law efficiency=W_useful/W_rev 0.57\n", - "in percentage 56.64\n", - "so availability=1.38*10^4 KJ/min\n", - "and rate of irreversibility=100 KW,second law efficiency=56.63 %\n", - "NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\n" - ] - } - ], - "source": [ - "#cal of availability,rate of irreversibility and second law efficiency\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.16, Page:230 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\")\n", - "To=(17.+273.);#temperature of surrounding in K\n", - "T1=(700.+273.);#temperature of high temperature reservoir in K\n", - "T2=(30.+273.);#temperature of low temperature reservoir in K\n", - "Q1=2.*10**4;#rate of heat receive in KJ/min\n", - "W_useful=0.13*10**3;#output of engine in KW\n", - "n_rev=(1-T2/T1);\n", - "W_rev=n_rev*Q1\n", - "W_rev=W_rev/60.;#W_rev in KJ/s\n", - "print(\"availability or reversible work,W_rev=n_rev*Q1 in KJ/min\"),round(W_rev,2)\n", - "I=W_rev-W_useful\n", - "print(\"rate of irreversibility,I=W_rev-W_useful in KJ/sec\"),round(I,2)\n", - "W_useful/W_rev\n", - "print(\"second law efficiency=W_useful/W_rev\"),round(W_useful/W_rev,2)\n", - "W_useful*100/W_rev\n", - "print(\"in percentage\"),round(W_useful*100/W_rev,2)\n", - "print(\"so availability=1.38*10^4 KJ/min\")\n", - "print(\"and rate of irreversibility=100 KW,second law efficiency=56.63 %\")\n", - "print(\"NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.17;pg no: 230" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.17, Page:230 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\n", - "loss of available energy=irreversibility=To*deltaSc\n", - "deltaSc=deltaSs+deltaSe\n", - "change in entropy of system=deltaSs\n", - "change in entropy of environment/surroundings=deltaSe\n", - "here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\n", - "P1/T1=P2/T2\n", - "so T2 in K= 555.0\n", - "heat addition to air in tank\n", - "Q in KJ/kg= 223.11\n", - "deltaSs in KJ/kg K= 0.67\n", - "deltaSe in KJ/kg K= -0.33\n", - "and deltaSc in KJ/kg K= 0.34\n", - "so loss of available energy(E)in KJ/kg= 101.55\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.17, Page:230 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\")\n", - "To=(27+273);#temperature of surrounding in K\n", - "T1=(60+273);#initial temperature of air in K\n", - "P1=1.5*10**5;#initial pressure of air in pa\n", - "P2=2.5*10**5;#final pressure of air in pa\n", - "T_reservoir=(400+273);#temperature of reservoir in K\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", - "print(\"deltaSc=deltaSs+deltaSe\")\n", - "print(\"change in entropy of system=deltaSs\")\n", - "print(\"change in entropy of environment/surroundings=deltaSe\")\n", - "print(\"here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\")\n", - "print(\"P1/T1=P2/T2\")\n", - "T2=P2*T1/P1\n", - "print(\"so T2 in K=\"),round(T2,2)\n", - "print(\"heat addition to air in tank\")\n", - "deltaT=T2-T1;\n", - "Q=Cp*deltaT\n", - "print(\"Q in KJ/kg=\"),round(Q,2)\n", - "deltaSs=Q/T1\n", - "print(\"deltaSs in KJ/kg K=\"),round(deltaSs,2)\n", - "deltaSe=-Q/T_reservoir\n", - "print(\"deltaSe in KJ/kg K=\"),round(deltaSe,2)\n", - "deltaSc=deltaSs+deltaSe\n", - "print(\"and deltaSc in KJ/kg K=\"),round(deltaSc,2)\n", - "E=To*deltaSc\n", - "print(\"so loss of available energy(E)in KJ/kg=\"),round(E,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.18;pg no: 231" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.18, Page:231 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\n", - "In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.18, Page:231 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\")\n", - "print(\"In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.19;pg no: 232" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.19, Page:232 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\n", - "clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\n", - "from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\n", - "v_fg in m^3/kg= 0.0\n", - "let us approximate,\n", - "(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\n", - "here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\n", - "substituting in clapeyron equation,\n", - "h_fg in KJ/kg 1941.25\n", - "so calculated enthalpy of vaporisation=1941.25 KJ/kg\n", - "and enthalpy of vaporisation from steam table=1940.7 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of enthalpy of vaporisation\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.19, Page:232 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\")\n", - "T=(200+273);#temperature of water in K\n", - "print(\"clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\")\n", - "print(\"from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\")\n", - "vg=0.12736;\n", - "vf=0.001157;\n", - "v_fg=(vg-vf)\n", - "print(\"v_fg in m^3/kg=\"),round(v_fg)\n", - "print(\"let us approximate,\")\n", - "print(\"(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\")\n", - "print(\"here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\")\n", - "P_205oc=1.7230;#pressure at 205 degree celcius in Mpa\n", - "P_195oc=1.3978;#pressure at 195 degree celcius in Mpa\n", - "(P_205oc-P_195oc)/(205-195)\n", - "print(\"substituting in clapeyron equation,\")\n", - "h_fg=T*v_fg*(P_205oc-P_195oc)*1000/(205-195)\n", - "print(\"h_fg in KJ/kg\"),round(h_fg,2)\n", - "print(\"so calculated enthalpy of vaporisation=1941.25 KJ/kg\")\n", - "print(\"and enthalpy of vaporisation from steam table=1940.7 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.20;pg no: 232" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.20, Page:232 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\n", - "by clapeyron equation\n", - "h_fg=T2*v_fg*(do/dT)_sat \n", - "h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\n", - "by clapeyron-clausius equation,\n", - "log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\n", - "log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\n", - "so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\n", - "% deviation from clapeyron equation in % 6.44\n", - "h_fg by clapeyron equation=159.49 KJ/kg\n", - "h_fg by clapeyron-clausius equation=169.76 KJ/kg\n", - "% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.20, Page:232 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\")\n", - "P2=260.96;#saturation pressure at -5 degree celcius\n", - "P1=182.60;#saturation pressure at -15 degree celcius\n", - "vg=0.07665;#specific volume of gas at -10 degree celcius in m^3/kg\n", - "vf=0.00070#specific volume at -10 degree celcius in m^3/kg\n", - "R=0.06876;#gas constant in KJ/kg K\n", - "h_fg=156.3;#enthalpy in KJ/kg K\n", - "T2=(-5.+273.);#temperature in K\n", - "T1=(-15.+273.);#temperature in K\n", - "print(\"by clapeyron equation\")\n", - "print(\"h_fg=T2*v_fg*(do/dT)_sat \")\n", - "print(\"h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\")\n", - "h_fg=T2*(vg-vf)*(P1-P2)/(T1-T2)\n", - "print(\"by clapeyron-clausius equation,\")\n", - "print(\"log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\")\n", - "print(\"log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\")\n", - "print(\"so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\")\n", - "h_fg=math.log(P2/P1)*R/((1/T1)-(1/T2))\n", - "print(\"% deviation from clapeyron equation in %\"),round((169.76-159.49)*100/159.49,2)\n", - "print(\"h_fg by clapeyron equation=159.49 KJ/kg\")\n", - "print(\"h_fg by clapeyron-clausius equation=169.76 KJ/kg\")\n", - "print(\"% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.21;pg no: 233" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "ename": "SyntaxError", - "evalue": "invalid syntax (, line 15)", - "output_type": "error", - "traceback": [ - "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m15\u001b[0m\n\u001b[1;33m volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" - ] - } - ], - "source": [ - "#cal of volume expansivity and isothermal compressibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.21, Page:233 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 21\")\n", - "print(\"volume expansion=(1/v)*(dv/dT)_P\")\n", - "print(\"isothermal compressibility=-(1/v)*(dv/dp)_T\")\n", - "print(\"let us write dv/dT=deltav/deltaT and dv/dP=deltav/deltaP.The difference may be taken for small pressure and temperature changes.\")\n", - "print(\"volume expansivity in K^-1,\")\n", - "print(\"=(1/v)*(dv/dT)_300Kpa\")\n", - "v_300Kpa_300oc=0.8753;#specific volume at 300Kpa and 300 degree celcius\n", - "v_350oc=0.9534;#specific volume 350 degree celcius\n", - "v_250oc=0.7964;#specific volume 250 degree celcius\n", - "volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\n", - "print(\"volume expansivity in Kpa\"),round(volume expansivity,2)\n", - "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350oc=0.9534 in m^3/kg,v_250oc=0.7964 in m^3/kg\")\n", - "print(\"volume expansivity=1.7937*10^-3 K^-1\")\n", - "isothermal=(-1/v_300Kpa_300oc)*(v_350Kpa-v_250Kpa)/(350-250)\n", - "print(\"isothermal compressibility in Kpa^-1\")\n", - "print(\"isothermal compressibility\"),round(isothermal compressibility,2)\n", - "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350Kpa=0.76505 in m^3/kg,v_250Kpa=1.09575 in m^3/kg\")\n", - "v_350Kpa=0.76505;#specific volume 350 Kpa\n", - "v_250Kpa=1.09575;#specific volume 250 Kpa\n", - "print(\"so isothermal compressibility=3.778*10^-3 Kpa^-1\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.22;pg no: 234" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.22, Page:234 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\n", - "filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\n", - "hi=uf\n", - "Cp*Ti=Cv*Tf\n", - "so Tf=Cp*Ti/Cv in K 417.33\n", - "inside final temperature,Tf=417.33 K\n", - "change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K= 0.338\n", - "Cp*log(Tf/Ti)+0\n", - "change in entropy,deltaS_gen=0.3379 KJ/kg K\n", - "irreversibility,I in KJ/kg= 100.76\n", - "irreversibility,I=100.74 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of inside final temperature,change in entropy and irreversibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.22, Page:234 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\")\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "Ti=(25+273.15);#atmospheric temperature in K\n", - "print(\"filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\")\n", - "print(\"hi=uf\")\n", - "print(\"Cp*Ti=Cv*Tf\")\n", - "Tf=Cp*Ti/Cv\n", - "print(\"so Tf=Cp*Ti/Cv in K\"),round(Tf,2)\n", - "print(\"inside final temperature,Tf=417.33 K\")\n", - "deltaS_gen=Cp*math.log(Tf/Ti)\n", - "print(\"change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K=\"),round(deltaS_gen,4)\n", - "print(\"Cp*log(Tf/Ti)+0\")\n", - "print(\"change in entropy,deltaS_gen=0.3379 KJ/kg K\")\n", - "To=Ti;\n", - "I=To*deltaS_gen\n", - "print(\"irreversibility,I in KJ/kg=\"),round(I,2)\n", - "print(\"irreversibility,I=100.74 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.23;pg no: 234" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.23, Page:234 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\n", - "here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\n", - "therefore,d(E-To-S)/dt=W_max\n", - "or W_max=(E-To-S)1-(E-To-S)2\n", - "here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\n", - "therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\n", - "so maximum work in KJ= 40946.6\n" - ] - } - ], - "source": [ - "#cal of maximum work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.23, Page:234 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\")\n", - "m=75.;#mass of hot water in kg\n", - "T1=(400.+273.);#temperature of hot water in K\n", - "T2=(27.+273.);#temperature of environment in K\n", - "Cp=4.18;#specific heat of water in KJ/kg K\n", - "print(\"here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\")\n", - "print(\"therefore,d(E-To-S)/dt=W_max\")\n", - "print(\"or W_max=(E-To-S)1-(E-To-S)2\")\n", - "print(\"here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\")\n", - "print(\"therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\")\n", - "To=T2;\n", - "W_max=m*Cp*(T1-T2)-To*m*Cp*math.log(T1/T2)\n", - "print(\"so maximum work in KJ=\"),round(W_max,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.24;pg no: 235" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.24, Page:235 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\n", - "from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\n", - "inlet stream availability in KJ/kg= 1587.19\n", - "input stream availability is equal to the input absolute availability.\n", - "exit stream availaability in KJ/kg 238.69\n", - "exit stream availability is equal to the exit absolute availability.\n", - "W_rev in KJ/kg\n", - "irreversibility=W_rev-W in KJ/kg 348.49\n", - "this irreversibility is in fact the availability loss.\n", - "inlet stream availability=1587.18 KJ/kg\n", - "exit stream availability=238.69 KJ/kg\n", - "irreversibility=348.49 KJ/kg\n", - "NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \n" - ] - } - ], - "source": [ - "#cal of inlet stream availability,exit stream availability and irreversibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.24, Page:235 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\")\n", - "C1=150;#steam entering velocity in m/s\n", - "C2=50;#steam leaving velocity in m/s\n", - "To=(15+273);#dead state temperature in K\n", - "W=1000;#expansion work in KJ/kg\n", - "print(\"from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\")\n", - "h1=3666.5;\n", - "s1=7.2589;\n", - "h2=2584.7;\n", - "s2=8.1502;\n", - "(h1+C1**2*10**-3/2)-To*s1\n", - "print(\"inlet stream availability in KJ/kg=\"),round((h1+C1**2*10**-3/2)-To*s1,2)\n", - "(h2+C2**2*10**-3/2)-To*s2\n", - "print(\"input stream availability is equal to the input absolute availability.\")\n", - "print(\"exit stream availaability in KJ/kg\"),round((h2+C2**2*10**-3/2)-To*s2,2)\n", - "print(\"exit stream availability is equal to the exit absolute availability.\")\n", - "print(\"W_rev in KJ/kg\")\n", - "W_rev=1587.18-238.69\n", - "W_rev-W\n", - "print(\"irreversibility=W_rev-W in KJ/kg\"),round(W_rev-W,2)\n", - "print(\"this irreversibility is in fact the availability loss.\")\n", - "print(\"inlet stream availability=1587.18 KJ/kg\")\n", - "print(\"exit stream availability=238.69 KJ/kg\")\n", - "print(\"irreversibility=348.49 KJ/kg\")\n", - "print(\"NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter7_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter7_2.ipynb deleted file mode 100755 index 8171c9b6..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter7_2.ipynb +++ /dev/null @@ -1,1466 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 7:Availability and General Thermodynamic Relation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.1;page no: 218" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.1, Page:218 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\n", - "let us neglect the potential energy change during the flow.\n", - "applying S.F.E.E,neglecting inlet velocity and change in potential energy,\n", - "W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\n", - "W_max=(h1-h2)-To*(s1-s2)-C2^2/2\n", - "from steam tables,\n", - "h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\n", - "given To=288 K\n", - "so W_max in KJ/kg= 457.1\n", - "maximum possible work(W_max) in KW= 1142.76\n" - ] - } - ], - "source": [ - "#cal of maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.1, Page:218 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\")\n", - "C2=150;#leave velocity of steam in m/s\n", - "m=2.5;#steam mass flow rate in kg/s\n", - "print(\"let us neglect the potential energy change during the flow.\")\n", - "print(\"applying S.F.E.E,neglecting inlet velocity and change in potential energy,\")\n", - "print(\"W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\")\n", - "print(\"W_max=(h1-h2)-To*(s1-s2)-C2^2/2\")\n", - "print(\"from steam tables,\")\n", - "print(\"h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\")\n", - "h1=3034.8;\n", - "s1=6.8844;\n", - "h2=2776.4;\n", - "s2=7.6134;\n", - "print(\"given To=288 K\")\n", - "To=288;\n", - "W_max=(h1-h2)-To*(s1-s2)-(C2**2/2*10**-3)\n", - "print(\"so W_max in KJ/kg=\"),round(W_max,2)\n", - "W_max=m*W_max\n", - "print(\"maximum possible work(W_max) in KW=\"),round(W_max,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.2;page no: 219" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.2, Page:219 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\n", - "In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\n", - "BOTH THE TANKS HAVE SAME INTERNAL ENERGY\n", - "availability of air in tank,A\n", - "A=(E-Uo)+Po*(V-Vo)-To*(S-So)\n", - "=m*{(e-uo)+Po(v-vo)-To(s-so)}\n", - "m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\n", - "so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\n", - "for tank A,P in pa,so availability_A in KJ= 1.98\n", - "for tank B,P=3*10^5 pa,so availability_B in KJ= 30.98\n", - "so availability of air in tank B is more than that of tank A\n", - "availability of air in tank A=1.98 KJ\n", - "availability of air in tank B=30.98 KJ\n" - ] - } - ], - "source": [ - "#cal of availability of air in tank A,B\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.2, Page:219 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\")\n", - "m=1.;#mass of air in kg\n", - "Po=1.*10**5;#atmospheric pressure in pa\n", - "To=(15.+273.);#temperature of atmosphere in K\n", - "Cv=0.717;#specific heat at constant volume in KJ/kg K\n", - "R=0.287;#gas constant in KJ/kg K\n", - "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n", - "T=(50.+273.);#temperature of tanks A and B in K\n", - "print(\"In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\")\n", - "print(\"BOTH THE TANKS HAVE SAME INTERNAL ENERGY\")\n", - "print(\"availability of air in tank,A\")\n", - "print(\"A=(E-Uo)+Po*(V-Vo)-To*(S-So)\")\n", - "print(\"=m*{(e-uo)+Po(v-vo)-To(s-so)}\")\n", - "print(\"m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\")\n", - "print(\"so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\")\n", - "P=1.*10**5;#pressure in tank A in pa\n", - "availability_A=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", - "print(\"for tank A,P in pa,so availability_A in KJ=\"),round(availability_A,2)\n", - "P=3.*10**5;#pressure in tank B in pa\n", - "availability_B=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n", - "print(\"for tank B,P=3*10^5 pa,so availability_B in KJ=\"),round(availability_B,2)\n", - "print(\"so availability of air in tank B is more than that of tank A\")\n", - "print(\"availability of air in tank A=1.98 KJ\")\n", - "print(\"availability of air in tank B=30.98 KJ\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.3;page no: 221" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.3, Page:221 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\n", - "inlet conditions,\n", - "from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\n", - "outlet conditions,at 0.05 bar and 0.95 dryness fraction\n", - "from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\n", - "so s2= in KJ/kg K= 8.0\n", - "and h2= in KJ/kg= 2440.34\n", - "neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\n", - "w in KJ/kg= 598.06\n", - "power output in KW= 8970.97\n", - "maximum work for given end states,\n", - "w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg 850.43\n", - "w_max in KW 12755.7\n", - "so maximum power output=12755.7 KW\n", - "maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\n", - "A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\n", - "=(h2-ho)+V2^2/2-To(s2-so)\n", - "approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\n", - "from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\n", - "maximum work available from exhaust steam,A_exhaust in KJ/kg\n", - "A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so) 151.1\n", - "maximum power that could be obtained from exhaust steam in KW= 2266.5\n", - "so maximum power from exhaust steam=2266.5 KW\n" - ] - } - ], - "source": [ - "#cal of maximum power output and that could be obtained from exhaust steam\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.3, Page:221 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\")\n", - "m=15;#steam flow rate in kg/s\n", - "V2=160;#exit velocity of steam in m/s\n", - "To=(15+273);#pond water temperature in K\n", - "print(\"inlet conditions,\")\n", - "print(\"from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\")\n", - "h1=3051.2;\n", - "s1=7.1229;\n", - "print(\"outlet conditions,at 0.05 bar and 0.95 dryness fraction\")\n", - "print(\"from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\")\n", - "sf=0.4764;\n", - "s_fg=7.9187;\n", - "x=0.95;\n", - "hf=137.82;\n", - "h_fg=2423.7;\n", - "s2=sf+x*s_fg\n", - "print(\"so s2= in KJ/kg K=\"),round(s2,2)\n", - "h2=hf+x*h_fg\n", - "print(\"and h2= in KJ/kg=\"),round(h2,2)\n", - "print(\"neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\")\n", - "w=(h1-h2)-V2**2*10**-3/2\n", - "print(\"w in KJ/kg=\"),round(w,2)\n", - "print(\"power output in KW=\"),round(m*w,2)\n", - "print(\"maximum work for given end states,\")\n", - "w_max=(h1-To*s1)-(h2+V2**2*10**-3/2-To*s2)\n", - "print(\"w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg\"),round(w_max,2)\n", - "w_max=850.38;#approx.\n", - "w_max=m*w_max\n", - "print(\"w_max in KW\"),round(w_max,2)\n", - "print(\"so maximum power output=12755.7 KW\")\n", - "print(\"maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\")\n", - "print(\"A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\")\n", - "print(\"=(h2-ho)+V2^2/2-To(s2-so)\")\n", - "print(\"approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\")\n", - "print(\"from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\")\n", - "ho=62.99;\n", - "so=0.2245;\n", - "print(\"maximum work available from exhaust steam,A_exhaust in KJ/kg\")\n", - "A_exhaust=(h2-ho)+V2**2*10**-3/2-To*(s2-so)\n", - "A_exhaust=151.1;#approx.\n", - "print(\"A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so)\"),round(A_exhaust,2)\n", - "print(\"maximum power that could be obtained from exhaust steam in KW=\"),round(m*A_exhaust,2)\n", - "print(\"so maximum power from exhaust steam=2266.5 KW\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.4;page no: 222" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.4, Page:222 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\n", - "for dead state of water,\n", - "from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\n", - "for initial state of water,\n", - "from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\n", - "for final state of water,\n", - "from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\n", - "availability at any state can be given by\n", - "A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\n", - "so availability at initial state,A1 in KJ\n", - "A1= 2703.28\n", - "and availability at final state,A2 in KJ\n", - "A2= 1.09\n", - "change in availability,A2-A1 in KJ= -2702.19\n", - "hence availability decreases by 2702.188 KJ\n", - "NOTE=>In this question,due to large calculations,answers are approximately correct.\n" - ] - } - ], - "source": [ - "#cal of availability at initial,final state and also change\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.4, Page:222 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\")\n", - "m=5;#mass of steam in kg\n", - "z1=10;#initial elevation in m\n", - "V1=25;#initial velocity of steam in m/s\n", - "z2=2;#final elevation in m\n", - "V2=10;#final velocity of steam in m/s\n", - "Po=100;#environmental pressure in Kpa\n", - "To=(25+273);#environmental temperature in K\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"for dead state of water,\")\n", - "print(\"from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\")\n", - "uo=104.86;\n", - "vo=1.0029*10**-3;\n", - "so=0.3673;\n", - "print(\"for initial state of water,\")\n", - "print(\"from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\")\n", - "u1=2550;\n", - "v1=0.5089;\n", - "s1=6.93;\n", - "print(\"for final state of water,\")\n", - "print(\"from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\")\n", - "u2=83.94;\n", - "v2=1.0018*10**-3;\n", - "s2=0.2966;\n", - "print(\"availability at any state can be given by\")\n", - "print(\"A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\")\n", - "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+V1**2*10**-3/2+g*z1*10**-3)\n", - "print(\"so availability at initial state,A1 in KJ\")\n", - "print(\"A1=\"),round(A1,2)\n", - "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+V2**2*10**-3/2+g*z2*10**-3)\n", - "print(\"and availability at final state,A2 in KJ\")\n", - "print(\"A2=\"),round(A2,2)\n", - "A2-A1\n", - "print(\"change in availability,A2-A1 in KJ=\"),round(A2-A1,2)\n", - "print(\"hence availability decreases by 2702.188 KJ\")\n", - "print(\"NOTE=>In this question,due to large calculations,answers are approximately correct.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.5;page no: 223" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.5, Page:223 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\n", - "In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.5, Page:223 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\")\n", - "print(\"In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.6;pg no: 223" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.6, Page:223 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\n", - "loss of available energy=irreversibility=To*deltaSc\n", - "deltaSc=deltaSs+deltaSe\n", - "change in enropy of system(deltaSs)=W/T in KJ/kg K 0.98\n", - "change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K -2.8\n", - "loss of available energy(E) in KJ/kg= -550.49\n", - "loss of available energy(E)= -550.49\n", - "ratio of lost available exhaust gas energy to engine work=E/W= 0.524\n" - ] - } - ], - "source": [ - "#cal of available energy and ratio of lost available exhaust gas energy to engine work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.6, Page:223 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\")\n", - "To=(30.+273.);#temperature of surrounding in K\n", - "W=1050.;#work done in engine in KJ/kg\n", - "Cp=1.1;#specific heat at constant pressure in KJ/kg K\n", - "T=(800.+273.);#temperature of exhaust gas in K\n", - "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", - "print(\"deltaSc=deltaSs+deltaSe\")\n", - "deltaSs=W/T\n", - "print(\"change in enropy of system(deltaSs)=W/T in KJ/kg K\"),round(deltaSs,2)\n", - "deltaSe=-Cp*(T-To)/To\n", - "print(\"change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K\"),round(deltaSe,2)\n", - "E=To*(deltaSs+deltaSe)\n", - "print(\"loss of available energy(E) in KJ/kg=\"),round(E,2)\n", - "E=-E\n", - "print(\"loss of available energy(E)=\"),round(-E,2)\n", - "print(\"ratio of lost available exhaust gas energy to engine work=E/W=\"),round(E/W,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.7;pg no: 224" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.7, Page:224 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\n", - "let us consider velocities and elevations to be given in reference to environment.Availability is given by\n", - "A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\n", - "dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\n", - "for initial state of saturated vapour at 150 degree celcius\n", - "from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\n", - "for final state of saturated liquid at 20 degree celcius\n", - "from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\n", - "substituting in the expression for availability\n", - "initial state availability,A1 in KJ\n", - "A1= 5650.31\n", - "final state availability,A2 in KJ\n", - "A2= 2.58\n", - "change in availability,deltaA in KJ= -5647.72\n", - "so initial availability =5650.28 KJ\n", - "final availability=2.58 KJ \n", - "change in availability=decrease by 5647.70 KJ \n" - ] - } - ], - "source": [ - "#cal of initial,final and change in availability\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.7, Page:224 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\")\n", - "m=10;#mass of water in kg\n", - "C1=25;#initial velocity in m/s\n", - "C2=10;#final velocity in m/s\n", - "Po=0.1*1000;#environmental pressure in Kpa\n", - "To=(25+273.15);#environmental temperature in K\n", - "g=9.8;#acceleration due to gravity in m/s^2\n", - "z1=10;#initial elevation in m\n", - "z2=3;#final elevation in m\n", - "print(\"let us consider velocities and elevations to be given in reference to environment.Availability is given by\")\n", - "print(\"A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\")\n", - "print(\"dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\")\n", - "uo=104.88;\n", - "vo=1.003*10**-3;\n", - "so=0.3674;\n", - "print(\"for initial state of saturated vapour at 150 degree celcius\")\n", - "print(\"from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\")\n", - "u1=2559.5;\n", - "v1=0.3928;\n", - "s1=6.8379;\n", - "print(\"for final state of saturated liquid at 20 degree celcius\")\n", - "print(\"from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\")\n", - "u2=83.95;\n", - "v2=0.001002;\n", - "s2=0.2966;\n", - "print(\"substituting in the expression for availability\")\n", - "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+C1**2*10**-3/2+g*z1*10**-3)\n", - "print(\"initial state availability,A1 in KJ\")\n", - "print(\"A1=\"),round(A1,2)\n", - "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+C2**2*10**-3/2+g*z2*10**-3)\n", - "print(\"final state availability,A2 in KJ\")\n", - "print(\"A2=\"),round(A2,2)\n", - "deltaA=A2-A1\n", - "print(\"change in availability,deltaA in KJ=\"),round(deltaA,2)\n", - "print(\"so initial availability =5650.28 KJ\")\n", - "print(\"final availability=2.58 KJ \")\n", - "print(\"change in availability=decrease by 5647.70 KJ \")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.8;pg no: 225" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.8, Page:225 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\n", - "let inlet and exit states of turbine be denoted as 1 and 2\n", - "at inlet to turbine,\n", - "from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\n", - "at exit from turbine,\n", - "from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\n", - "at dead state,\n", - "from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\n", - "availability of steam at inlet,A1 in KJ= 6792.43\n", - "so availability of steam at inlet=6792.43 KJ\n", - "applying first law of thermodynamics,\n", - "Q+m*h1=m*h2+W\n", - "so W in KJ/s= 2829.0\n", - "so turbine output=2829 KW\n", - "maximum possible turbine output will be available when irreversibility is zero.\n", - "W_rev=W_max=A1-A2\n", - "W_max in KJ/s= 3804.82\n", - "so maximum output=3804.81 KW\n", - "irreversibility can be estimated by the difference between the maximum output and turbine output.\n", - "I= in KW= 975.82\n", - "so irreversibility=975.81807 KW\n", - "NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\n" - ] - } - ], - "source": [ - "#cal of availability of steam at inlet,turbine output,maximum possible turbine output,irreversibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.8, Page:225 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\")\n", - "m=5.;#steam flow rate in kg/s\n", - "p1=5.*1000.;#initial pressure of steam in Kpa\n", - "T1=(500.+273.15);#initial temperature of steam in K \n", - "p2=0.2*1000.;#final pressure of steam in Kpa\n", - "T1=(140.+273.15);#final temperature of steam in K\n", - "po=101.3;#pressure of steam at dead state in Kpa\n", - "To=(25.+273.15);#temperature of steam at dead state in K \n", - "Q=600.;#heat loss through turbine in KJ/s\n", - "print(\"let inlet and exit states of turbine be denoted as 1 and 2\")\n", - "print(\"at inlet to turbine,\")\n", - "print(\"from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\")\n", - "h1=3433.8;\n", - "s1=6.9759;\n", - "print(\"at exit from turbine,\")\n", - "print(\"from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\")\n", - "h2=2748;\n", - "s2=7.228;\n", - "print(\"at dead state,\")\n", - "print(\"from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\")\n", - "ho=104.96;\n", - "so=0.3673;\n", - "A1=m*((h1-ho)-To*(s1-so))\n", - "print(\"availability of steam at inlet,A1 in KJ=\"),round(A1,2)\n", - "print(\"so availability of steam at inlet=6792.43 KJ\")\n", - "print(\"applying first law of thermodynamics,\")\n", - "print(\"Q+m*h1=m*h2+W\")\n", - "W=m*(h1-h2)-Q\n", - "print(\"so W in KJ/s=\"),round(W,2)\n", - "print(\"so turbine output=2829 KW\")\n", - "print(\"maximum possible turbine output will be available when irreversibility is zero.\")\n", - "print(\"W_rev=W_max=A1-A2\")\n", - "W_max=m*((h1-h2)-To*(s1-s2))\n", - "print(\"W_max in KJ/s=\"),round(W_max,2)\n", - "print(\"so maximum output=3804.81 KW\")\n", - "print(\"irreversibility can be estimated by the difference between the maximum output and turbine output.\")\n", - "I=W_max-W\n", - "print(\"I= in KW=\"),round(I,2)\n", - "print(\"so irreversibility=975.81807 KW\")\n", - "print(\"NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.9;pg no: 226" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.9, Page:226 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\n", - "In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.9, Page:226 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\")\n", - "print(\"In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.10;pg no: 227" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.10, Page:227 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\n", - "In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.10, Page:227 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\")\n", - "print(\"In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.11;pg no: 227" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.11, Page:227 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\n", - "availability for heat reservoir(A_HR) in KJ/kg K 167.66\n", - "now availability for system(A_system) in KJ/kg K 194.44\n", - "net loss of available energy(A) in KJ/kg K= -26.78\n", - "so loss of available energy=26.77 KJ/kg K\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.11, Page:227 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\")\n", - "To=280.;#surrounding temperature in K\n", - "Q=500.;#heat removed in KJ\n", - "T1=835.;#temperature of reservoir in K\n", - "T2=720.;#temperature of system in K\n", - "A_HR=To*Q/T1\n", - "print(\"availability for heat reservoir(A_HR) in KJ/kg K\"),round(A_HR,2)\n", - "A_system=To*Q/T2\n", - "print(\"now availability for system(A_system) in KJ/kg K\"),round(A_system,2)\n", - "A=A_HR-A_system \n", - "print(\"net loss of available energy(A) in KJ/kg K=\"),round(A,2)\n", - "print(\"so loss of available energy=26.77 KJ/kg K\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.12;pg no: 228" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.12, Page:228 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\n", - "here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\n", - "W_max=W1-W2 in KJ/kg 1647.0\n", - "actual work from turbine,W_actual=h1-h2 in KJ/kg 1557.0\n", - "so actual work=1557 KJ/kg\n", - "maximum possible work=1647 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of actual,maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.12, Page:228 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\")\n", - "h1=4142;#enthalpy at entrance in KJ/kg\n", - "h2=2585;#enthalpy at exit in KJ/kg\n", - "W1=1787;#availability of steam at entrance in KJ/kg\n", - "W2=140;#availability of steam at exit in KJ/kg\n", - "print(\"here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\")\n", - "W_max=W1-W2\n", - "print(\"W_max=W1-W2 in KJ/kg\"),round(W_max,2)\n", - "W_actual=h1-h2\n", - "print(\"actual work from turbine,W_actual=h1-h2 in KJ/kg\"),round(W_actual,2)\n", - "print(\"so actual work=1557 KJ/kg\")\n", - "print(\"maximum possible work=1647 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.13;pg no: 228" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.13, Page:228 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\n", - "reversible engine efficiency,n_rev=1-(T_min/T_max) 0.621\n", - "second law efficiency=n/n_rev 0.4026\n", - "in % 40.26\n" - ] - } - ], - "source": [ - "#cal of second law efficiency\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.13, Page:228 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\")\n", - "T_min=(20.+273.);#minimum temperature reservoir temperature in K\n", - "T_max=(500.+273.);#maximum temperature reservoir temperature in K\n", - "n=0.25;#efficiency of heat engine\n", - "n_rev=1-(T_min/T_max)\n", - "print(\"reversible engine efficiency,n_rev=1-(T_min/T_max)\"),round(n_rev,4)\n", - "n/n_rev\n", - "print(\"second law efficiency=n/n_rev\"),round(n/n_rev,4)\n", - "print(\"in %\"),round(n*100/n_rev,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.14;pg no: 228" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.14, Page:228 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\n", - "expansion occurs in adiabatic conditions.\n", - "temperature after expansion can be obtained by considering adiabatic expansion\n", - "T2/T1=(V1/V2)^(y-1)\n", - "so T2= in K= 489.12\n", - "mass of air,m in kg= 20.91\n", - "change in entropy of control system,deltaSs=(S2-S1) in KJ/K= -0.0\n", - "here,there is no change in entropy of environment,deltaSe=0\n", - "total entropy change of combined system=deltaSc in KJ/K= -0.0\n", - "loss of available energy(E)=irreversibility in KJ= -0.603\n", - "so loss of available energy,E=0.603 KJ\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.14, Page:228 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\")\n", - "V_A=6.;#volume of compartment A in m^3\n", - "V_B=4.;#volume of compartment B in m^3\n", - "To=300.;#temperature of atmosphere in K\n", - "Po=1.*10**5;#atmospheric pressure in pa\n", - "P1=6.*10**5;#initial pressure in pa\n", - "T1=600.;#initial temperature in K\n", - "V1=V_A;#initial volume in m^3\n", - "V2=(V_A+V_B);#final volume in m^3\n", - "y=1.4;#expansion constant \n", - "R=287.;#gas constant in J/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "print(\"expansion occurs in adiabatic conditions.\")\n", - "print(\"temperature after expansion can be obtained by considering adiabatic expansion\")\n", - "T2=T1*(V1/V2)**(y-1)\n", - "print(\"T2/T1=(V1/V2)^(y-1)\")\n", - "print(\"so T2= in K=\"),round(T2,2)\n", - "T2=489.12;#approx.\n", - "m=(P1*V1)/(R*T1)\n", - "print(\"mass of air,m in kg=\"),round(m,2)\n", - "m=20.91;#approx.\n", - "deltaSs=m*Cv*math.log(T2/T1)+m*R*10**-3*math.log(V2/V1)\n", - "print(\"change in entropy of control system,deltaSs=(S2-S1) in KJ/K=\"),round(deltaSs,2)\n", - "print(\"here,there is no change in entropy of environment,deltaSe=0\")\n", - "deltaSe=0;\n", - "deltaSc=deltaSs+deltaSe\n", - "print(\"total entropy change of combined system=deltaSc in KJ/K=\"),round(deltaSc,2)\n", - "E=To*deltaSc\n", - "print(\"loss of available energy(E)=irreversibility in KJ=\"),round(E,3)\n", - "print(\"so loss of available energy,E=0.603 KJ\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.15;pg no: 229" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.15, Page:229 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\n", - "In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#cal of maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.15, Page:229 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\")\n", - "print(\"In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.16;pg no: 230" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.16, Page:230 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\n", - "availability or reversible work,W_rev=n_rev*Q1 in KJ/min 229.53\n", - "rate of irreversibility,I=W_rev-W_useful in KJ/sec 99.53\n", - "second law efficiency=W_useful/W_rev 0.57\n", - "in percentage 56.64\n", - "so availability=1.38*10^4 KJ/min\n", - "and rate of irreversibility=100 KW,second law efficiency=56.63 %\n", - "NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\n" - ] - } - ], - "source": [ - "#cal of availability,rate of irreversibility and second law efficiency\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.16, Page:230 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\")\n", - "To=(17.+273.);#temperature of surrounding in K\n", - "T1=(700.+273.);#temperature of high temperature reservoir in K\n", - "T2=(30.+273.);#temperature of low temperature reservoir in K\n", - "Q1=2.*10**4;#rate of heat receive in KJ/min\n", - "W_useful=0.13*10**3;#output of engine in KW\n", - "n_rev=(1-T2/T1);\n", - "W_rev=n_rev*Q1\n", - "W_rev=W_rev/60.;#W_rev in KJ/s\n", - "print(\"availability or reversible work,W_rev=n_rev*Q1 in KJ/min\"),round(W_rev,2)\n", - "I=W_rev-W_useful\n", - "print(\"rate of irreversibility,I=W_rev-W_useful in KJ/sec\"),round(I,2)\n", - "W_useful/W_rev\n", - "print(\"second law efficiency=W_useful/W_rev\"),round(W_useful/W_rev,2)\n", - "W_useful*100/W_rev\n", - "print(\"in percentage\"),round(W_useful*100/W_rev,2)\n", - "print(\"so availability=1.38*10^4 KJ/min\")\n", - "print(\"and rate of irreversibility=100 KW,second law efficiency=56.63 %\")\n", - "print(\"NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.17;pg no: 230" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.17, Page:230 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\n", - "loss of available energy=irreversibility=To*deltaSc\n", - "deltaSc=deltaSs+deltaSe\n", - "change in entropy of system=deltaSs\n", - "change in entropy of environment/surroundings=deltaSe\n", - "here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\n", - "P1/T1=P2/T2\n", - "so T2 in K= 555.0\n", - "heat addition to air in tank\n", - "Q in KJ/kg= 223.11\n", - "deltaSs in KJ/kg K= 0.67\n", - "deltaSe in KJ/kg K= -0.33\n", - "and deltaSc in KJ/kg K= 0.34\n", - "so loss of available energy(E)in KJ/kg= 101.55\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.17, Page:230 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\")\n", - "To=(27+273);#temperature of surrounding in K\n", - "T1=(60+273);#initial temperature of air in K\n", - "P1=1.5*10**5;#initial pressure of air in pa\n", - "P2=2.5*10**5;#final pressure of air in pa\n", - "T_reservoir=(400+273);#temperature of reservoir in K\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"loss of available energy=irreversibility=To*deltaSc\")\n", - "print(\"deltaSc=deltaSs+deltaSe\")\n", - "print(\"change in entropy of system=deltaSs\")\n", - "print(\"change in entropy of environment/surroundings=deltaSe\")\n", - "print(\"here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\")\n", - "print(\"P1/T1=P2/T2\")\n", - "T2=P2*T1/P1\n", - "print(\"so T2 in K=\"),round(T2,2)\n", - "print(\"heat addition to air in tank\")\n", - "deltaT=T2-T1;\n", - "Q=Cp*deltaT\n", - "print(\"Q in KJ/kg=\"),round(Q,2)\n", - "deltaSs=Q/T1\n", - "print(\"deltaSs in KJ/kg K=\"),round(deltaSs,2)\n", - "deltaSe=-Q/T_reservoir\n", - "print(\"deltaSe in KJ/kg K=\"),round(deltaSe,2)\n", - "deltaSc=deltaSs+deltaSe\n", - "print(\"and deltaSc in KJ/kg K=\"),round(deltaSc,2)\n", - "E=To*deltaSc\n", - "print(\"so loss of available energy(E)in KJ/kg=\"),round(E,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.18;pg no: 231" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.18, Page:231 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\n", - "In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 7\n", - "print\"Example 7.18, Page:231 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\")\n", - "print(\"In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.19;pg no: 232" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.19, Page:232 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\n", - "clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\n", - "from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\n", - "v_fg in m^3/kg= 0.0\n", - "let us approximate,\n", - "(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\n", - "here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\n", - "substituting in clapeyron equation,\n", - "h_fg in KJ/kg 1941.25\n", - "so calculated enthalpy of vaporisation=1941.25 KJ/kg\n", - "and enthalpy of vaporisation from steam table=1940.7 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of enthalpy of vaporisation\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.19, Page:232 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\")\n", - "T=(200+273);#temperature of water in K\n", - "print(\"clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\")\n", - "print(\"from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\")\n", - "vg=0.12736;\n", - "vf=0.001157;\n", - "v_fg=(vg-vf)\n", - "print(\"v_fg in m^3/kg=\"),round(v_fg)\n", - "print(\"let us approximate,\")\n", - "print(\"(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\")\n", - "print(\"here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\")\n", - "P_205oc=1.7230;#pressure at 205 degree celcius in Mpa\n", - "P_195oc=1.3978;#pressure at 195 degree celcius in Mpa\n", - "(P_205oc-P_195oc)/(205-195)\n", - "print(\"substituting in clapeyron equation,\")\n", - "h_fg=T*v_fg*(P_205oc-P_195oc)*1000/(205-195)\n", - "print(\"h_fg in KJ/kg\"),round(h_fg,2)\n", - "print(\"so calculated enthalpy of vaporisation=1941.25 KJ/kg\")\n", - "print(\"and enthalpy of vaporisation from steam table=1940.7 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.20;pg no: 232" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.20, Page:232 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\n", - "by clapeyron equation\n", - "h_fg=T2*v_fg*(do/dT)_sat \n", - "h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\n", - "by clapeyron-clausius equation,\n", - "log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\n", - "log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\n", - "so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\n", - "% deviation from clapeyron equation in % 6.44\n", - "h_fg by clapeyron equation=159.49 KJ/kg\n", - "h_fg by clapeyron-clausius equation=169.76 KJ/kg\n", - "% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\n" - ] - } - ], - "source": [ - "#cal of loss of available energy\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.20, Page:232 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\")\n", - "P2=260.96;#saturation pressure at -5 degree celcius\n", - "P1=182.60;#saturation pressure at -15 degree celcius\n", - "vg=0.07665;#specific volume of gas at -10 degree celcius in m^3/kg\n", - "vf=0.00070#specific volume at -10 degree celcius in m^3/kg\n", - "R=0.06876;#gas constant in KJ/kg K\n", - "h_fg=156.3;#enthalpy in KJ/kg K\n", - "T2=(-5.+273.);#temperature in K\n", - "T1=(-15.+273.);#temperature in K\n", - "print(\"by clapeyron equation\")\n", - "print(\"h_fg=T2*v_fg*(do/dT)_sat \")\n", - "print(\"h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\")\n", - "h_fg=T2*(vg-vf)*(P1-P2)/(T1-T2)\n", - "print(\"by clapeyron-clausius equation,\")\n", - "print(\"log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\")\n", - "print(\"log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\")\n", - "print(\"so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\")\n", - "h_fg=math.log(P2/P1)*R/((1/T1)-(1/T2))\n", - "print(\"% deviation from clapeyron equation in %\"),round((169.76-159.49)*100/159.49,2)\n", - "print(\"h_fg by clapeyron equation=159.49 KJ/kg\")\n", - "print(\"h_fg by clapeyron-clausius equation=169.76 KJ/kg\")\n", - "print(\"% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.21;pg no: 233" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.21, Page:233 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 21\n", - "volume expansion=(1/v)*(dv/dT)_P\n", - "isothermal compressibility=-(1/v)*(dv/dp)_T\n", - "let us write dv/dT=deltav/deltaT and dv/dP=deltav/deltaP.The difference may be taken for small pressure and temperature changes.\n", - "volume expansivity in K^-1,\n", - "=(1/v)*(dv/dT)_300Kpa\n", - "=(1/v_300Kpa_300oc)*((v_350oc-v_250oc)/(350-250))_300Kpa\n", - "from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350oc=0.9534 in m^3/kg,v_250oc=0.7964 in m^3/kg\n", - "volume expansivity=1.7937*10^-3 K^-1\n", - "isothermal compressibility=k in Kpa^-1\n", - "k= 0.004\n", - "from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350Kpa=0.76505 in m^3/kg,v_250Kpa=1.09575 in m^3/kg\n", - "so isothermal compressibility=3.778*10^-3 Kpa^-1\n" - ] - } - ], - "source": [ - "#cal of volume expansivity and isothermal compressibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.21, Page:233 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 21\")\n", - "print(\"volume expansion=(1/v)*(dv/dT)_P\")\n", - "print(\"isothermal compressibility=-(1/v)*(dv/dp)_T\")\n", - "print(\"let us write dv/dT=deltav/deltaT and dv/dP=deltav/deltaP.The difference may be taken for small pressure and temperature changes.\")\n", - "print(\"volume expansivity in K^-1,\")\n", - "print(\"=(1/v)*(dv/dT)_300Kpa\")\n", - "print(\"=(1/v_300Kpa_300oc)*((v_350oc-v_250oc)/(350-250))_300Kpa\")\n", - "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350oc=0.9534 in m^3/kg,v_250oc=0.7964 in m^3/kg\")\n", - "v_300Kpa_300oc=0.8753;#specific volume at 300Kpa and 300 degree celcius\n", - "v_350oc=0.9534;#specific volume 350 degree celcius\n", - "v_250oc=0.7964;#specific volume 250 degree celcius\n", - "(1/v_300Kpa_300oc)*(v_350oc-v_250oc)/(350-250)\n", - "print(\"volume expansivity=1.7937*10^-3 K^-1\")\n", - "print(\"isothermal compressibility=k in Kpa^-1\")\n", - "v_350Kpa=0.76505;#specific volume 350 Kpa\n", - "v_250Kpa=1.09575;#specific volume 250 Kpa\n", - "k=(-1./v_300Kpa_300oc)*(v_350Kpa-v_250Kpa)/(350.-250.)\n", - "print(\"k=\"),round((-1./v_300Kpa_300oc)*(v_350Kpa-v_250Kpa)/(350.-250.),3)\n", - "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350Kpa=0.76505 in m^3/kg,v_250Kpa=1.09575 in m^3/kg\")\n", - "print(\"so isothermal compressibility=3.778*10^-3 Kpa^-1\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.22;pg no: 234" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.22, Page:234 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\n", - "filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\n", - "hi=uf\n", - "Cp*Ti=Cv*Tf\n", - "so Tf=Cp*Ti/Cv in K 417.33\n", - "inside final temperature,Tf=417.33 K\n", - "change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K= 0.338\n", - "Cp*log(Tf/Ti)+0\n", - "change in entropy,deltaS_gen=0.3379 KJ/kg K\n", - "irreversibility,I in KJ/kg= 100.76\n", - "irreversibility,I=100.74 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of inside final temperature,change in entropy and irreversibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.22, Page:234 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\")\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.718;#specific heat at constant volume in KJ/kg K\n", - "Ti=(25+273.15);#atmospheric temperature in K\n", - "print(\"filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\")\n", - "print(\"hi=uf\")\n", - "print(\"Cp*Ti=Cv*Tf\")\n", - "Tf=Cp*Ti/Cv\n", - "print(\"so Tf=Cp*Ti/Cv in K\"),round(Tf,2)\n", - "print(\"inside final temperature,Tf=417.33 K\")\n", - "deltaS_gen=Cp*math.log(Tf/Ti)\n", - "print(\"change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K=\"),round(deltaS_gen,4)\n", - "print(\"Cp*log(Tf/Ti)+0\")\n", - "print(\"change in entropy,deltaS_gen=0.3379 KJ/kg K\")\n", - "To=Ti;\n", - "I=To*deltaS_gen\n", - "print(\"irreversibility,I in KJ/kg=\"),round(I,2)\n", - "print(\"irreversibility,I=100.74 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.23;pg no: 234" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.23, Page:234 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\n", - "here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\n", - "therefore,d(E-To-S)/dt=W_max\n", - "or W_max=(E-To-S)1-(E-To-S)2\n", - "here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\n", - "therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\n", - "so maximum work in KJ= 40946.6\n" - ] - } - ], - "source": [ - "#cal of maximum work\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.23, Page:234 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\")\n", - "m=75.;#mass of hot water in kg\n", - "T1=(400.+273.);#temperature of hot water in K\n", - "T2=(27.+273.);#temperature of environment in K\n", - "Cp=4.18;#specific heat of water in KJ/kg K\n", - "print(\"here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\")\n", - "print(\"therefore,d(E-To-S)/dt=W_max\")\n", - "print(\"or W_max=(E-To-S)1-(E-To-S)2\")\n", - "print(\"here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\")\n", - "print(\"therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\")\n", - "To=T2;\n", - "W_max=m*Cp*(T1-T2)-To*m*Cp*math.log(T1/T2)\n", - "print(\"so maximum work in KJ=\"),round(W_max,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 7.24;pg no: 235" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 7.24, Page:235 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\n", - "from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\n", - "inlet stream availability in KJ/kg= 1587.19\n", - "input stream availability is equal to the input absolute availability.\n", - "exit stream availaability in KJ/kg 238.69\n", - "exit stream availability is equal to the exit absolute availability.\n", - "W_rev in KJ/kg\n", - "irreversibility=W_rev-W in KJ/kg 348.49\n", - "this irreversibility is in fact the availability loss.\n", - "inlet stream availability=1587.18 KJ/kg\n", - "exit stream availability=238.69 KJ/kg\n", - "irreversibility=348.49 KJ/kg\n", - "NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \n" - ] - } - ], - "source": [ - "#cal of inlet stream availability,exit stream availability and irreversibility\n", - "#intiation of all variables\n", - "# Chapter 7\n", - "import math\n", - "print\"Example 7.24, Page:235 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\")\n", - "C1=150;#steam entering velocity in m/s\n", - "C2=50;#steam leaving velocity in m/s\n", - "To=(15+273);#dead state temperature in K\n", - "W=1000;#expansion work in KJ/kg\n", - "print(\"from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\")\n", - "h1=3666.5;\n", - "s1=7.2589;\n", - "h2=2584.7;\n", - "s2=8.1502;\n", - "(h1+C1**2*10**-3/2)-To*s1\n", - "print(\"inlet stream availability in KJ/kg=\"),round((h1+C1**2*10**-3/2)-To*s1,2)\n", - "(h2+C2**2*10**-3/2)-To*s2\n", - "print(\"input stream availability is equal to the input absolute availability.\")\n", - "print(\"exit stream availaability in KJ/kg\"),round((h2+C2**2*10**-3/2)-To*s2,2)\n", - "print(\"exit stream availability is equal to the exit absolute availability.\")\n", - "print(\"W_rev in KJ/kg\")\n", - "W_rev=1587.18-238.69\n", - "W_rev-W\n", - "print(\"irreversibility=W_rev-W in KJ/kg\"),round(W_rev-W,2)\n", - "print(\"this irreversibility is in fact the availability loss.\")\n", - "print(\"inlet stream availability=1587.18 KJ/kg\")\n", - "print(\"exit stream availability=238.69 KJ/kg\")\n", - "print(\"irreversibility=348.49 KJ/kg\")\n", - "print(\"NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter8.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter8.ipynb deleted file mode 100755 index 5088b9af..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter8.ipynb +++ /dev/null @@ -1,2594 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 8:Vapour Power Cycles" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.1;pg no: 260" - ] - }, - { - "cell_type": "code", - "execution_count": 88, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.1, Page:260 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\n", - "T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\n", - "enthalpy at state 2,h2= hg at 7 MPa\n", - "from steam table,h=2772.1 KJ/kg\n", - "entropy at state 2,s2=sg at 7MPa\n", - "from steam table,s2=5.8133 KJ/kg K\n", - "enthalpy and entropy at state 3,\n", - "from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\n", - "for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \n", - "from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\n", - "s1=s2=sf+x1*sfg\n", - "so x1= 0.68\n", - "from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\n", - "enthalpy at state 1,h1 in KJ/kg= 1802.53\n", - "let dryness fraction at state 4 be x4\n", - "for process 4-3,s4=s3=sf+x4*sfg\n", - "so x4= 0.33\n", - "enthalpy at state 4,h4 in KJ/kg= 962.81\n", - "thermal efficiency=net work/heat added\n", - "expansion work per kg=(h2-h1) in KJ/kg 969.57\n", - "compression work per kg=(h3-h4) in KJ/kg(+ve) 304.19\n", - "heat added per kg=(h2-h3) in KJ/kg(-ve) 1505.1\n", - "net work per kg=(h2-h1)-(h3-h4) in KJ/kg 665.38\n", - "thermal efficiency 0.44\n", - "in percentage 44.21\n", - "so thermal efficiency=44.21%\n", - "turbine work=969.57 KJ/kg(+ve)\n", - "compression work=304.19 KJ/kg(-ve)\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,turbine work,compression work\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.1, Page:260 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\")\n", - "print(\"T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\")\n", - "print(\"enthalpy at state 2,h2= hg at 7 MPa\")\n", - "print(\"from steam table,h=2772.1 KJ/kg\")\n", - "h2=2772.1;\n", - "print(\"entropy at state 2,s2=sg at 7MPa\")\n", - "print(\"from steam table,s2=5.8133 KJ/kg K\")\n", - "s2=5.8133;\n", - "print(\"enthalpy and entropy at state 3,\")\n", - "print(\"from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\")\n", - "h3=1267;\n", - "s3=3.1211;\n", - "print(\"for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \")\n", - "s1=s2;\n", - "print(\"from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\")\n", - "sf=0.5564;\n", - "sfg=7.7237;\n", - "print(\"s1=s2=sf+x1*sfg\")\n", - "x1=(s2-sf)/sfg\n", - "print(\"so x1=\"),round(x1,2) \n", - "x1=0.6806;#approx.\n", - "print(\"from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\")\n", - "hf=162.60;\n", - "hfg=2409.54;\n", - "h1=hf+x1*hfg\n", - "print(\"enthalpy at state 1,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"let dryness fraction at state 4 be x4\")\n", - "print(\"for process 4-3,s4=s3=sf+x4*sfg\")\n", - "s4=s3;\n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.3321;#approx.\n", - "h4=hf+x4*hfg\n", - "print(\"enthalpy at state 4,h4 in KJ/kg=\"),round(h4,2)\n", - "print(\"thermal efficiency=net work/heat added\")\n", - "(h2-h1)\n", - "print(\"expansion work per kg=(h2-h1) in KJ/kg\"),round((h2-h1),2)\n", - "(h3-h4)\n", - "print(\"compression work per kg=(h3-h4) in KJ/kg(+ve)\"),round((h3-h4),2)\n", - "(h2-h3)\n", - "print(\"heat added per kg=(h2-h3) in KJ/kg(-ve)\"),round((h2-h3),2)\n", - "(h2-h1)-(h3-h4)\n", - "print(\"net work per kg=(h2-h1)-(h3-h4) in KJ/kg\"),round((h2-h1)-(h3-h4),2)\n", - "((h2-h1)-(h3-h4))/(h2-h3)\n", - "print(\"thermal efficiency\"),round(((h2-h1)-(h3-h4))/(h2-h3),2)\n", - "print(\"in percentage\"),round((((h2-h1)-(h3-h4))/(h2-h3))*100,2)\n", - "print(\"so thermal efficiency=44.21%\")\n", - "print(\"turbine work=969.57 KJ/kg(+ve)\")\n", - "print(\"compression work=304.19 KJ/kg(-ve)\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.2;pg no: 261" - ] - }, - { - "cell_type": "code", - "execution_count": 89, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.2, Page:261 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\n", - "from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\n", - "hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\n", - "from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\n", - "hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\n", - "as process 2-3 is isentropic,so s2=s3\n", - "and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\n", - "so x3= 0.69\n", - "hence enthalpy at 3,\n", - "h3 in KJ/kg= 1819.85\n", - "enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\n", - "process 1-4 is isentropic,so s1=s4\n", - "s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\n", - "so x4= 0.31\n", - "enthalpy at 4,h4 in KJ/kg= 884.31\n", - "enthalpy at 1,h1 in KJ/kg= 1154.23\n", - "carnot cycle(1-2-3-4-1) efficiency:\n", - "n_carnot=net work/heat added\n", - "n_carnot 0.43\n", - "in percentage 42.96\n", - "so n_carnot=42.95%\n", - "In rankine cycle,1-2-3-5-6-1,\n", - "pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg 5.02\n", - "h5 KJ/kg= 137.82\n", - "hence h6 in KJ/kg 142.84\n", - "net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg 969.43\n", - "heat added=(h2-h6)in KJ/kg 2651.46\n", - "rankine cycle efficiency(n_rankine)= 0.37\n", - "in percentage 36.56\n", - "so n_rankine=36.56%\n" - ] - } - ], - "source": [ - "#cal of n_carnot,n_rankine\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.2, Page:261 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\")\n", - "print(\"from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\")\n", - "print(\"hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\")\n", - "hf_5MPa=1154.23;\n", - "sf_5MPa=2.92;\n", - "hg_5MPa=2794.3;\n", - "sg_5MPa=5.97;\n", - "print(\"from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\")\n", - "print(\"hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\")\n", - "hf_5KPa=137.82;\n", - "sf_5KPa=0.4764;\n", - "hg_5KPa=2561.5;\n", - "sg_5KPa=8.3951;\n", - "vf_5KPa=0.001005;\n", - "print(\"as process 2-3 is isentropic,so s2=s3\")\n", - "print(\"and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\")\n", - "s2=sg_5MPa;\n", - "s3=s2;\n", - "x3=(s3-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.694;#approx.\n", - "print(\"hence enthalpy at 3,\")\n", - "h3=hf_5KPa+x3*(hg_5KPa-hf_5KPa)\n", - "print(\"h3 in KJ/kg=\"),round(h3,2)\n", - "print(\"enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\")\n", - "print(\"process 1-4 is isentropic,so s1=s4\")\n", - "s1=sf_5MPa;\n", - "print(\"s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\")\n", - "x4=(s1-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.308;#approx.\n", - "h4=hf_5KPa+x4*(hg_5KPa-hf_5KPa)\n", - "print(\"enthalpy at 4,h4 in KJ/kg=\"),round(h4,2)\n", - "h1=hf_5MPa\n", - "h2=hg_5MPa;\n", - "n_carnot=((h2-h3)-(h1-h4))/(h2-h1)\n", - "print(\"enthalpy at 1,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"carnot cycle(1-2-3-4-1) efficiency:\")\n", - "print(\"n_carnot=net work/heat added\")\n", - "print(\"n_carnot\"),round(n_carnot,2)\n", - "print(\"in percentage\"),round(n_carnot*100,2)\n", - "print(\"so n_carnot=42.95%\")\n", - "print(\"In rankine cycle,1-2-3-5-6-1,\")\n", - "p6=5000;#boiler pressure in KPa\n", - "p5=5;#condenser pressure in KPa\n", - "vf_5KPa*(p6-p5)\n", - "print(\"pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg\"),round(vf_5KPa*(p6-p5),2)\n", - "h5=hf_5KPa;\n", - "print(\"h5 KJ/kg=\"),round(hf_5KPa,2)\n", - "h6=h5+(vf_5KPa*(p6-p5))\n", - "print(\"hence h6 in KJ/kg\"),round(h6,2)\n", - "(h2-h3)-(h6-h5)\n", - "print(\"net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg\"),round((h2-h3)-(h6-h5),2)\n", - "(h2-h6)\n", - "print(\"heat added=(h2-h6)in KJ/kg\"),round((h2-h6),2)\n", - "n_rankine=((h2-h3)-(h6-h5))/(h2-h6)\n", - "print(\"rankine cycle efficiency(n_rankine)=\"),round(n_rankine,2)\n", - "print(\"in percentage\"),round(n_rankine*100,2)\n", - "print(\"so n_rankine=36.56%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.3;pg no: 263" - ] - }, - { - "cell_type": "code", - "execution_count": 90, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.3, Page:263 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\n", - "from steam tables,h2=hg_40bar=3092.5 KJ/kg\n", - "s2=sg_40bar=6.5821 KJ/kg K\n", - "h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \n", - "s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "v4=vf_0.05bar=0.001005 m^3/kg\n", - "let the dryness fraction at state 3 be x3,\n", - "for ideal process,2-3,s2=s3\n", - "s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\n", - "so x3= 0.77\n", - "h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\n", - "for pumping process,\n", - "h1-h4=v4*deltap=v4*(p1-p4)\n", - "so h1=h4+v4*(p1-p4) in KJ/kg 141.83\n", - "pump work per kg of steam in KJ/kg 4.01\n", - "net work per kg of steam =(expansion work-pump work)per kg of steam\n", - "=(h2-h3)-(h1-h4) in KJ/kg= 1081.75\n", - "cycle efficiency=net work/heat added 0.37\n", - "in percentage 36.66\n", - "so net work per kg of steam=1081.74 KJ/kg\n", - "cycle efficiency=36.67%\n", - "pump work per kg of steam=4.02 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of net work per kg of steam,cycle efficiency,pump work per kg of steam\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.3, Page:263 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\")\n", - "print(\"from steam tables,h2=hg_40bar=3092.5 KJ/kg\")\n", - "h2=3092.5;\n", - "print(\"s2=sg_40bar=6.5821 KJ/kg K\")\n", - "s2=6.5821;\n", - "print(\"h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \")\n", - "h4=137.82;\n", - "hfg=2423.7;\n", - "print(\"s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "s4=0.4764;\n", - "sfg=7.9187;\n", - "print(\"v4=vf_0.05bar=0.001005 m^3/kg\")\n", - "v4=0.001005;\n", - "print(\"let the dryness fraction at state 3 be x3,\")\n", - "print(\"for ideal process,2-3,s2=s3\")\n", - "s3=s2;\n", - "print(\"s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\")\n", - "x3=(s2-s4)/(sfg)\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.7711;#approx.\n", - "print(\"h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\")\n", - "h3=h4+x3*hfg\n", - "print(\"for pumping process,\")\n", - "print(\"h1-h4=v4*deltap=v4*(p1-p4)\")\n", - "p1=40*100;#pressure of steam enter in turbine in mPa\n", - "p4=0.05*100;#pressure of steam leave turbine in mPa\n", - "h1=h4+v4*(p1-p4)\n", - "print(\"so h1=h4+v4*(p1-p4) in KJ/kg\"),round(h1,2)\n", - "(h1-h4)\n", - "print(\"pump work per kg of steam in KJ/kg\"),round((h1-h4),2)\n", - "print(\"net work per kg of steam =(expansion work-pump work)per kg of steam\")\n", - "(h2-h3)-(h1-h4)\n", - "print(\"=(h2-h3)-(h1-h4) in KJ/kg=\"),round((h2-h3)-(h1-h4),2)\n", - "print(\"cycle efficiency=net work/heat added\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", - "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", - "print(\"so net work per kg of steam=1081.74 KJ/kg\")\n", - "print(\"cycle efficiency=36.67%\")\n", - "print(\"pump work per kg of steam=4.02 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.4;pg no: 264" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.4, Page:264 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 4\n", - "Let us assume that the condensate leaves condenser as saturated liquid and the expansion in turbine and pumping processes are isentropic.\n", - "from steam tables,h2=h_20MPa=3238.2 KJ/kg\n", - "s2=6.1401 KJ/kg K\n", - "h5=h_0.005MPa in KJ/kg\n", - "from steam tables,at 0.005 MPa,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "h5=hf+0.9*hfg in KJ/kg 2319.15\n", - "s5 in KJ/kg K= 7.6\n", - "h6=hf=137.82 KJ/kg\n", - "it is given that temperature at state 4 is 500 degree celcius and due to isentropic processes s4=s5=7.6032 KJ/kg K.The state 4 can be conveniently located on mollier chart by the intersection of 500 degree celcius constant temperature line and entropy value of 7.6032 KJ/kg K and the pressure and enthalpy obtained.but these shall be approximate.\n", - "The state 4 can also be located by interpolation using steam table.The entropy value of 7.6032 KJ/kg K lies between the superheated steam states given under,p=1.20 MPa,s at 1.20 MPa=7.6027 KJ/kg K\n", - "p=1.40 MPa,s at 1.40 MPa=7.6027 KJ/kg K\n", - "by interpolation state 4 lies at pressure=\n", - "=1.399,approx.=1.40 MPa\n", - "thus,steam leaves HP turbine at 1.40 MPa\n", - "enthalpy at state 4,h4=3474.1 KJ/kg\n", - "for process 2-33,s2=s3=6.1401 KJ/kg K.The state 3 thus lies in wet region as s3sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\n", - "From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\n", - "Let dryness fraction at state 9 be x9 so,\n", - "s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\n", - "from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\n", - "x9=(s9-sf)/sfg 0.95\n", - "h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\n", - "from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\n", - "Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\n", - "h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\n", - "h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\n", - "For process 4-8,i.e in CEP.\n", - "h8 in KJ/kg= 138.22\n", - "For process 11-12,i.e in FP2,\n", - "h12=h11+v11*(40-4)*10^2 in KJ/kg 608.64\n", - "For process 13-1_a i.e. in FP1,h1_a= in KJ/kg= 1107.34\n", - "m1*3141.81+(1-m1)*608.64=1087.31\n", - "so m1=(1087.31-608.64)/(3141.81-608.64)in kg\n", - "Applying energy balance on open feed water heater 1 (OFWH1)\n", - "m1*h10+(1-m1)*h12)=1*h13\n", - "so m1 in kg= 0.19\n", - "Applying energy balance on open feed water heater 2 (OFWH2)\n", - "m2*h9+(1-m1-m2)*h8=(1-m1)*h11\n", - "so m2 in kg= 0.15\n", - "Thermal efficiency of cycle,n= 0.51\n", - "W_CEP in KJ/kg steam from boiler= 0.26\n", - "W_FP1=(h1_a-h13)in KJ/kg of steam from boiler 20.0\n", - "W_FP2 in KJ/kg of steam from boiler= 3.17\n", - "W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler= 23.46\n", - "n= 0.51\n", - "in percentage 51.37\n", - "so cycle thermal efficiency,na=46.18%\n", - "nb=49.76%\n", - "nc=51.37%\n", - "hence it is obvious that efficiency increases with increase in number of feed heaters.\n" - ] - } - ], - "source": [ - "#cal of maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.6, Page:267 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 6\")\n", - "print(\"case (a) When there is no feed water heater\")\n", - "print(\"Thermal efficiency of cycle=((h2-h3)-(h1-h4))/(h2-h1)\")\n", - "print(\"from steam tables,h2=h at 200 bar,650oc=3675.3 KJ/kg,s2=s at 200 bar,650oc=6.6582 KJ/kg K,h4=hf at 0.05 bar=137.82 KJ/kg,v4=vf at 0.05 bar=0.001005 m^3/kg\")\n", - "h2=3675.3;\n", - "s2=6.6582;\n", - "h4=137.82;\n", - "v4=0.001005;\n", - "print(\"hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg,sf at 0.05 bar=0.4764 KJ/kg K,sfg at 0.05 bar=7.9187 KJ/kg K\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "print(\"For process 2-3,s2=s3.Let dryness fraction at 3 be x3.\")\n", - "s3=s2;\n", - "print(\"s3=6.6582=sf at 0.05 bar+x3*sfg at 0.05 bar\")\n", - "x3=(s3-sf)/sfg\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.781;#approx.\n", - "print(\"h3=hf at 0.05 bar+x3*hfg at 0.05 bar in KJ/kg\")\n", - "h3=hf+x3*hfg\n", - "print(\"For pumping process 4-1,\")\n", - "print(\"h1-h4=v4*deltap\")\n", - "h1=h4+v4*(200-0.5)*10**2\n", - "print(\"h1= in KJ/kg=\"),round(h1,2)\n", - "((h2-h3)-(h1-h4))/(h2-h1)\n", - "print(\"Thermal efficiency of cycle=\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", - "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", - "print(\"case (b) When there is only one feed water heater working at 8 bar\")\n", - "print(\"here,let mass of steam bled for feed heating be m kg\")\n", - "print(\"For process 2-6,s2=s6=6.6582 KJ/kg K\")\n", - "s6=s2;\n", - "print(\"Let dryness fraction at state 6 be x6\")\n", - "print(\"s6=sf at 8 bar+x6*sfg at 8 bar\")\n", - "print(\"from steam tables,hf at 8 bar=721.11 KJ/kg,vf at 8 bar=0.001115 m^3/kg,hfg at 8 bar=2048 KJ/kg,sf at 8 bar=2.0462 KJ/kg K,sfg at 8 bar=4.6166 KJ/kg K\")\n", - "hf=721.11;\n", - "vf=0.001115;\n", - "hfg=2048;\n", - "sf=2.0462;\n", - "sfg=4.6166;\n", - "x6=(s6-sf)/sfg\n", - "print(\"substituting entropy values,x6=\"),round(x6,2)\n", - "x6=0.999;#approx.\n", - "print(\"h6=hf at at 8 bar+x6*hfg at 8 bar in KJ/kg\")\n", - "h6=hf+x6*hfg\n", - "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at 8 bar.h7=hf at 8 bar=721.11 KJ/kg\")\n", - "h7=721.11;\n", - "h5=h4+v4*(8-.05)*10**2\n", - "print(\"For process 4-5,h5 in KJ/kg\"),round(h5,2)\n", - "print(\"Applying energy balance at open feed water heater,\")\n", - "print(\"m*h6+(1-m)*h5=1*h7\")\n", - "m=(h7-h5)/(h6-h5)\n", - "print(\"so m= in kg\"),round(m,2)\n", - "h7=hf;\n", - "v7=vf;\n", - "h1=h7+v7*(200-8)*10**2\n", - "print(\"For process 7-1,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"here h7=hf at 8 bar,v7=vf at 8 bar\")\n", - "#TE=((h2-h6)+(1-m)*(h6-h3)-((1-m)*(h5-h4)+(h1-h7))/(h2-h1)\n", - "print(\"Thermal efficiency of cycle=0.4976\")\n", - "print(\"in percentage=49.76\")\n", - "print(\"case (c) When there are two feed water heaters working at 40 bar and 4 bar\")\n", - "print(\"here, let us assume the mass of steam at 40 bar,4 bar to be m1 kg and m2 kg respectively.\")\n", - "print(\"2-10-9-3,s2=s10=s9=s3=6.6582 KJ/kg K\")\n", - "s3=s2;\n", - "s9=s3;\n", - "s10=s9;\n", - "print(\"At state 10.s10>sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\")\n", - "print(\"From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\")\n", - "T10=370.6;\n", - "h10=3141.81;\n", - "print(\"Let dryness fraction at state 9 be x9 so,\") \n", - "print(\"s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\")\n", - "print(\"from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\")\n", - "sf=1.7766;\n", - "sfg=5.1193;\n", - "x9=(s9-sf)/sfg\n", - "print(\"x9=(s9-sf)/sfg\"),round(x9,2)\n", - "x9=0.9536;#approx.\n", - "print(\"h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\")\n", - "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\")\n", - "hf=604.74;\n", - "hfg=2133.8;\n", - "h9=hf+x9*hfg \n", - "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\")\n", - "print(\"h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\")\n", - "h11=604.74;\n", - "v11=0.001084;\n", - "print(\"h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\")\n", - "h13=1087.31;\n", - "v13=0.001252;\n", - "print(\"For process 4-8,i.e in CEP.\")\n", - "h8=h4+v4*(4-0.05)*10**2\n", - "print(\"h8 in KJ/kg=\"),round(h8,2)\n", - "print(\"For process 11-12,i.e in FP2,\")\n", - "h12=h11+v11*(40-4)*10**2\n", - "print(\"h12=h11+v11*(40-4)*10^2 in KJ/kg\"),round(h12,2)\n", - "h1_a=h13+v13*(200-40)*10**2\n", - "print(\"For process 13-1_a i.e. in FP1,h1_a= in KJ/kg=\"),round(h1_a,2)\n", - "print(\"m1*3141.81+(1-m1)*608.64=1087.31\")\n", - "print(\"so m1=(1087.31-608.64)/(3141.81-608.64)in kg\")\n", - "m1=(1087.31-608.64)/(3141.81-608.64)\n", - "print(\"Applying energy balance on open feed water heater 1 (OFWH1)\")\n", - "print(\"m1*h10+(1-m1)*h12)=1*h13\")\n", - "m1=(h13-h12)/(h10-h12)\n", - "print(\"so m1 in kg=\"),round(m1,2)\n", - "print(\"Applying energy balance on open feed water heater 2 (OFWH2)\")\n", - "print(\"m2*h9+(1-m1-m2)*h8=(1-m1)*h11\")\n", - "m2=(1-m1)*(h11-h8)/(h9-h8)\n", - "print(\"so m2 in kg=\"),round(m2,2)\n", - "W_CEP=(1-m1-m2)*(h8-h4)\n", - "W_FP1=(h1_a-h13)\n", - "W_FP2=(1-m1)*(h12-h11)\n", - "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", - "print(\"Thermal efficiency of cycle,n=\"),round(n,2)\n", - "print(\"W_CEP in KJ/kg steam from boiler=\"),round(W_CEP,2)\n", - "print(\"W_FP1=(h1_a-h13)in KJ/kg of steam from boiler\"),round(W_FP1)\n", - "print(\"W_FP2 in KJ/kg of steam from boiler=\"),round(W_FP2,2)\n", - "W_CEP+W_FP1+W_FP2\n", - "print(\"W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler=\"),round(W_CEP+W_FP1+W_FP2,2)\n", - "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", - "print(\"n=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so cycle thermal efficiency,na=46.18%\")\n", - "print(\"nb=49.76%\")\n", - "print(\"nc=51.37%\")\n", - "print(\"hence it is obvious that efficiency increases with increase in number of feed heaters.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.7;pg no: 272" - ] - }, - { - "cell_type": "code", - "execution_count": 94, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.7, Page:272 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\n", - "from steam tables,\n", - "h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\n", - "s3=s2=6.9759 KJ/kg K\n", - "by interpolation from steam tables,\n", - "T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\n", - "for expansion process 4-5,s4=s5=7.7938 KJ/kg K\n", - "let dryness fraction at state 5 be x5\n", - "s5=sf at 0.05 bar+x5*sfg at 0.05 bar\n", - "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "so x5= 0.92\n", - "h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\n", - "from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\n", - "h6=hf at 0.05 bar=137.82 KJ/kg\n", - "v6=vf at 0.05 bar=0.001005 m^3/kg\n", - "for process 6-1 in feed pump,h1 in KJ/kg= 142.84\n", - "cycle efficiency=W_net/Q_add\n", - "Wt in KJ/kg= 1510.35\n", - "W_pump=(h1-h6)in KJ/kg 5.02\n", - "W_net=Wt-W_pump in KJ/kg 1505.33\n", - "Q_add in KJ/kg= 3290.96\n", - "cycle efficiency= 0.4574\n", - "in percentage= 45.74\n", - "we know ,1 hp=0.7457 KW\n", - "specific steam consumption in kg/hp hr= 1.78\n", - "work ratio=net work/positive work 0.9967\n", - "so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\n" - ] - } - ], - "source": [ - "#cal of cycle efficiency,specific steam consumption,work ratio\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.7, Page:272 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\")\n", - "print(\"from steam tables,\")\n", - "print(\"h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\")\n", - "h2=3433.8;\n", - "s2=6.9759;\n", - "print(\"s3=s2=6.9759 KJ/kg K\")\n", - "s3=s2;\n", - "print(\"by interpolation from steam tables,\")\n", - "print(\"T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\")\n", - "T3=183.14;\n", - "h3=2818.03;\n", - "h4=3271.9;\n", - "s4=7.7938;\n", - "print(\"for expansion process 4-5,s4=s5=7.7938 KJ/kg K\")\n", - "s5=s4;\n", - "print(\"let dryness fraction at state 5 be x5\")\n", - "print(\"s5=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", - "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "x5=(s5-sf)/sfg\n", - "print(\"so x5=\"),round(x5,2)\n", - "x5=0.924;#approx.\n", - "print(\"h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\")\n", - "print(\"from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "h5=hf+x5*hfg \n", - "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", - "h6=137.82;\n", - "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", - "v6=0.001005;\n", - "p1=50.;#steam generation pressure in bar\n", - "p6=0.05;#steam entering temperature in turbine in bar\n", - "h1=h6+v6*(p1-p6)*100\n", - "print(\"for process 6-1 in feed pump,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"cycle efficiency=W_net/Q_add\")\n", - "Wt=(h2-h3)+(h4-h5)\n", - "print(\"Wt in KJ/kg=\"),round(Wt,2)\n", - "W_pump=(h1-h6)\n", - "print(\"W_pump=(h1-h6)in KJ/kg\"),round(W_pump,2)\n", - "W_net=Wt-W_pump\n", - "print(\"W_net=Wt-W_pump in KJ/kg\"),round(W_net,2)\n", - "Q_add=(h2-h1)\n", - "print(\"Q_add in KJ/kg=\"),round(Q_add,2)\n", - "print(\"cycle efficiency=\"),round(W_net/Q_add,4)\n", - "W_net*100/Q_add\n", - "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", - "print(\"we know ,1 hp=0.7457 KW\")\n", - "print(\"specific steam consumption in kg/hp hr=\"),round(0.7457*3600/W_net,2)\n", - "print(\"work ratio=net work/positive work\"),round(W_net/Wt,4)\n", - "print(\"so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.8;pg no: 273" - ] - }, - { - "cell_type": "code", - "execution_count": 95, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.8, Page:273 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\n", - "from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\n", - "h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\n", - "Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\n", - "h8=hf at 3 bar=561.47 KJ/kg\n", - "for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\n", - "Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\n", - "s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\n", - "from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\n", - "so x3= 0.95\n", - "s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\n", - "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "so x4= 0.79\n", - "thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\n", - "here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\n", - "h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\n", - "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", - "assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\n", - "pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\n", - "for mixing process between condenser and feed pump,\n", - "(1-m)*h5+m*h9=1*h6\n", - "h6=m(h9-h5)+h5\n", - "we get,h6=137.82+m*423.65\n", - "therefore h7=h6+6.02=143.84+m*423.65\n", - "Applying energy balance at closed feed water heater;\n", - "m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\n", - "so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\n", - "so m=0.144 kg\n", - "steam bled for feed heating=0.144 kg/kg steam generated\n", - "The net power output,W_net in KJ/kg steam generated= 1167.27\n", - "mass of steam required to be generated in kg/s= 26.23\n", - "or in kg/hr\n", - "so capacity of boiler required=94428 kg/hr\n", - "overall thermal efficiency=W_net/Q_add\n", - "here Q_add in KJ/kg= 3134.56\n", - "overall thermal efficiency= 0.37\n", - "in percentage= 37.24\n", - "so overall thermal efficiency=37.24%\n" - ] - } - ], - "source": [ - "#cal of mass of steam bled for feed heating,capacity of boiler required,overall thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.8, Page:273 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\")\n", - "T_cond=115;#condensate temperature in degree celcius\n", - "Cp=4.18;#specific heat at constant pressure in KJ/kg K\n", - "P=30*10**3;#actual alternator output in KW\n", - "n_boiler=0.9;#boiler efficiency\n", - "n_alternator=0.98;#alternator efficiency\n", - "print(\"from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\")\n", - "h2=3301.8;\n", - "s2=6.7193;\n", - "print(\"h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\")\n", - "h5=137.82;\n", - "v5=0.001005;\n", - "print(\"Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\")\n", - "print(\"h8=hf at 3 bar=561.47 KJ/kg\")\n", - "h8=561.47;\n", - "print(\"for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\")\n", - "s3=s2;\n", - "s4=s3;\n", - "print(\"Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\")\n", - "print(\"s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\")\n", - "print(\"from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\")\n", - "sf_3bar=1.6718;\n", - "sfg_3bar=5.3201;\n", - "x3=(s3-sf_3bar)/sfg_3bar\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.949;#approx.\n", - "print(\"s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\")\n", - "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.788;#approx.\n", - "print(\"thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\")\n", - "print(\"here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\")\n", - "hf_3bar=561.47;\n", - "hfg_3bar=2163.8;\n", - "h3=hf_3bar+x3*hfg_3bar \n", - "print(\"h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\")\n", - "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "h4=hf+x4*hfg\n", - "print(\"assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\")\n", - "h9=h8;\n", - "v6=v5;\n", - "print(\"pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\")\n", - "p1=60;#pressure of steam in high pressure turbine in bar\n", - "p5=0.05;#pressure of steam in low pressure turbine in bar\n", - "v5*(p1-p5)*100\n", - "print(\"for mixing process between condenser and feed pump,\")\n", - "print(\"(1-m)*h5+m*h9=1*h6\")\n", - "print(\"h6=m(h9-h5)+h5\")\n", - "print(\"we get,h6=137.82+m*423.65\")\n", - "print(\"therefore h7=h6+6.02=143.84+m*423.65\")\n", - "print(\"Applying energy balance at closed feed water heater;\")\n", - "print(\"m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\")\n", - "print(\"so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\")\n", - "print(\"so m=0.144 kg\")\n", - "m=0.144;\n", - "h6=137.82+m*423.65;\n", - "h7=143.84+m*423.65;\n", - "print(\"steam bled for feed heating=0.144 kg/kg steam generated\")\n", - "W_net=(h2-h3)+(1-m)*(h3-h4)-(1-m)*(h7-h6)\n", - "print(\"The net power output,W_net in KJ/kg steam generated=\"),round(W_net,2)\n", - "P/(n_alternator*W_net)\n", - "print(\"mass of steam required to be generated in kg/s=\"),round(P/(n_alternator*W_net),2)\n", - "print(\"or in kg/hr\")\n", - "26.23*3600\n", - "print(\"so capacity of boiler required=94428 kg/hr\")\n", - "print(\"overall thermal efficiency=W_net/Q_add\")\n", - "Q_add=(h2-Cp*T_cond)/n_boiler\n", - "print(\"here Q_add in KJ/kg=\"),round(Q_add,2) \n", - "W_net/Q_add\n", - "print(\"overall thermal efficiency=\"),round(W_net/Q_add,2)\n", - "W_net*100/Q_add\n", - "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", - "print(\"so overall thermal efficiency=37.24%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.9;pg no: 275" - ] - }, - { - "cell_type": "code", - "execution_count": 96, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.9, Page:275 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\n", - "At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\n", - "For ideal expansion process,s2=s3\n", - "By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\n", - "actual stste at exit of first stage,h3_a in KJ/kg= 2909.88\n", - "actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K= 7.1075\n", - "for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\n", - "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", - "so x4= 0.96\n", - "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", - "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", - "actual enthalpy at exit from second stage,h4_a in KJ/kg= 2646.48\n", - "actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\n", - "so x4_a= 0.99\n", - "x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\n", - "for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x5= 0.87\n", - "h5=2270.43 KJ/kg\n", - "actual enthalpy at exit from third stage,h5_a in KJ/kg= 2345.64\n", - "Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\n", - "By heat balance on first closed feed water heater,(see schematic arrangement)\n", - "h11=hf at 6 bar=670.56 KJ\n", - "m1*h3_a+h10=m1*h11+4.18*150\n", - "(m1*2829.63)+h10=(m1*670.56)+627\n", - "h10+2159.07*m1=627\n", - "By heat balance on second closed feed water heater,(see schematic arrangement)\n", - "h7=hf at 1 bar=417.46 KJ/kg\n", - "m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\n", - "m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\n", - "m2*2467.27-m1*179.2-238.26=0\n", - "heat balance at point of mixing,\n", - "h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\n", - "neglecting pump work,h7=h8\n", - "h10=m2*417.46+(1-m1-m2)*397.1\n", - "substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\n", - "Turbine output per kg of steam generated,Wt in KJ/kg of steam generated= 780.445\n", - "Rate of steam generation required in kg/s= 19.22\n", - "in kg/hr\n", - "capacity of drain pump i.e. FP shown in layout in kg/hr= 16273.96\n", - "so capacity of drain pump=16273.96 kg/hr\n" - ] - } - ], - "source": [ - "#cal of capacity of drain pump\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.9, Page:275 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\")\n", - "P=15*10**3;#turbine output in KW\n", - "print(\"At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\")\n", - "h2=3230.9;\n", - "s2=6.9212;\n", - "print(\"For ideal expansion process,s2=s3\")\n", - "s3=s2;\n", - "print(\"By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\")\n", - "T3=190.97;\n", - "h3=2829.63;\n", - "h3_a=h2-0.8*(h2-h3)\n", - "print(\"actual stste at exit of first stage,h3_a in KJ/kg=\"),round(h3_a,2)\n", - "s3_a=7.1075;\n", - "print(\"actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K=\"),round(s3_a,4)\n", - "print(\"for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\")\n", - "s4=7.1075;\n", - "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", - "sf=1.3026;\n", - "sfg=6.0568;\n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.958;#approx.\n", - "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", - "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", - "hf=417.46;\n", - "hfg=2258.0;\n", - "h4=hf+x4*hfg\n", - "h4_a=h3_a-.8*(h3_a-h4)\n", - "print(\"actual enthalpy at exit from second stage,h4_a in KJ/kg=\"),round(h4_a,2)\n", - "print(\"actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\")\n", - "x4_a=(h4_a-hf)/hfg\n", - "print(\"so x4_a=\"),round(x4_a,2)\n", - "print(\"x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\")\n", - "s4_a=7.2806;\n", - "print(\"for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "x5=(s4_a-sf)/sfg\n", - "print(\"so x5=\"),round(x5,2)\n", - "x5=0.8735;#approx.\n", - "print(\"h5=2270.43 KJ/kg\")\n", - "h5=2270.43;\n", - "h5_a=h4_a-0.8*(h4_a-h5)\n", - "print(\"actual enthalpy at exit from third stage,h5_a in KJ/kg=\"),round(h5_a,2)\n", - "print(\"Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\")\n", - "print(\"By heat balance on first closed feed water heater,(see schematic arrangement)\")\n", - "print(\"h11=hf at 6 bar=670.56 KJ\")\n", - "h11=670.56;\n", - "print(\"m1*h3_a+h10=m1*h11+4.18*150\")\n", - "print(\"(m1*2829.63)+h10=(m1*670.56)+627\")\n", - "print(\"h10+2159.07*m1=627\")\n", - "print(\"By heat balance on second closed feed water heater,(see schematic arrangement)\")\n", - "print(\"h7=hf at 1 bar=417.46 KJ/kg\")\n", - "h7=417.46;\n", - "print(\"m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\")\n", - "print(\"m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\")\n", - "print(\"m2*2467.27-m1*179.2-238.26=0\")\n", - "print(\"heat balance at point of mixing,\")\n", - "print(\"h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\")\n", - "print(\"neglecting pump work,h7=h8\")\n", - "print(\"h10=m2*417.46+(1-m1-m2)*397.1\")\n", - "print(\"substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\")\n", - "m1=0.1293;\n", - "m2=0.1059;\n", - "Wt=(h2-h3_a)+(1-m1)*(h3_a-h4_a)+(1-m1-m2)*(h4_a-h5_a)\n", - "print(\"Turbine output per kg of steam generated,Wt in KJ/kg of steam generated=\"),round(Wt,3)\n", - "P/Wt\n", - "print(\"Rate of steam generation required in kg/s=\"),round(P/Wt,2)\n", - "print(\"in kg/hr\")\n", - "P*3600/Wt\n", - "(m1+m2)*69192\n", - "print(\"capacity of drain pump i.e. FP shown in layout in kg/hr=\"),round((m1+m2)*69192,2)\n", - "print(\"so capacity of drain pump=16273.96 kg/hr\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.10;pg no: 277" - ] - }, - { - "cell_type": "code", - "execution_count": 97, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.10, Page:277 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\n", - "at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\n", - "By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\n", - "actual enthapy at 3_a,h3_a in KJ/kg= 3097.0\n", - "enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\n", - "for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\n", - "s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x6= 0.83\n", - "h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "for actual expansion process in LP turbine.\n", - "h6_a=h4-0.85*(h4-h6) in KJ/kg 2319.4\n", - "Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\n", - "s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\n", - "from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\n", - "so x5= 1.0\n", - "h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\n", - "from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\n", - "actual enthalpy,h5_a in KJ/kg= 2790.16\n", - "enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\n", - "specific volume at inlet of CEP,v7=0.001008 m^3/kg\n", - "enthalpy at inlet of CEP,h7=168.79 KJ/kg\n", - "for pumping process 7-8,h8 in KJ/kg= 169.15\n", - "Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\n", - "m*h5+(1-m)*h8=h9\n", - "so m in kg /kg of steam generated= 0.33\n", - "For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\n", - "h1= in KJ/kg= 1015.59\n", - "Net work per kg of steam generated,W_net=in KJ/kg steam generated= 938.83\n", - "heat added per kg of steam generated,q_add in KJ/kg of steam generated= 2405.41\n", - "Thermal efficiency,n= 0.39\n", - "in percentage= 39.03\n", - "so thermal efficiency=39.03%%\n", - "NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\n" - ] - } - ], - "source": [ - "#cal of cycle efficiency\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.10, Page:277 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\")\n", - "print(\"at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\")\n", - "h2=3287.1;\n", - "s2=6.6327;\n", - "print(\"By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\")\n", - "h3=3049.48;\n", - "h3_a=h2-0.80*(h2-h3)\n", - "print(\"actual enthapy at 3_a,h3_a in KJ/kg=\"),round(h3_a,2)\n", - "print(\"enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\")\n", - "h4=3230.9;\n", - "s4=6.9212;\n", - "print(\"for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\")\n", - "s6=s4;\n", - "print(\"s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "x6=(s6-sf)/sfg\n", - "print(\"so x6=\"),round(x6,2)\n", - "x6=0.827;#approx.\n", - "print(\"h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0;\n", - "h6=hf+x6*hfg\n", - "print(\"for actual expansion process in LP turbine.\")\n", - "h6_a=h4-0.85*(h4-h6)\n", - "print(\"h6_a=h4-0.85*(h4-h6) in KJ/kg\"),round(h6_a,2)\n", - "print(\"Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\")\n", - "p5=3.61;\n", - "s5=s4;\n", - "print(\"s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\")\n", - "print(\"from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\")\n", - "sf=1.7391;\n", - "sfg=5.1908;\n", - "x5=(s5-sf)/sfg\n", - "print(\"so x5=\"),round(x5,2)\n", - "x5=0.99;#approx.\n", - "print(\"h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\")\n", - "print(\"from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\")\n", - "hf=589.13;\n", - "hfg=2144.7;\n", - "h5=hf+x5*hfg\n", - "h5_a=h4-0.85*(h4-h5)\n", - "print(\"actual enthalpy,h5_a in KJ/kg=\"),round(h5_a,2)\n", - "print(\"enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\")\n", - "h9=1008.42;\n", - "print(\"specific volume at inlet of CEP,v7=0.001008 m^3/kg\")\n", - "v7=0.001008;\n", - "print(\"enthalpy at inlet of CEP,h7=168.79 KJ/kg\")\n", - "h7=168.79;\n", - "h8=h7+v7*(3.61-0.075)*10**2\n", - "print(\"for pumping process 7-8,h8 in KJ/kg=\"),round(h8,2)\n", - "print(\"Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\")\n", - "print(\"m*h5+(1-m)*h8=h9\")\n", - "m=(h9-h8)/(h5-h8)\n", - "print(\"so m in kg /kg of steam generated=\"),round(m,2)\n", - "print(\"For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\")\n", - "v9=0.00108;\n", - "h1=h9+v9*(70-3.61)*10**2\n", - "print(\"h1= in KJ/kg=\"),round(h1,2) \n", - "W_net=(h2-h3_a)+(h4-h5_a)+(1-m)*(h5_a-h6_a)-((1-m)*(h8-h7)+(h1-h9))\n", - "print(\"Net work per kg of steam generated,W_net=in KJ/kg steam generated=\"),round(W_net,2)\n", - "q_add=(h2-h1)+(h4-h3_a)\n", - "print(\"heat added per kg of steam generated,q_add in KJ/kg of steam generated=\"),round(q_add,2)\n", - "n=W_net/q_add\n", - "print(\"Thermal efficiency,n=\"),round(n,2)\n", - "n=n*100\n", - "print(\"in percentage=\"),round(n,2)\n", - "print(\"so thermal efficiency=39.03%%\")\n", - "print(\"NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.11;pg no: 279" - ] - }, - { - "cell_type": "code", - "execution_count": 98, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.11, Page:279 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\n", - "Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\n", - "for isentropic expansion 2-3-4-5,s2=s3=s4=s5\n", - "Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\n", - "s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\n", - "so x3=(s3-sf)/sfg\n", - "from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\n", - "h3=hf+x3*hfg in KJ/kg\n", - "from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\n", - "s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\n", - "so x4=(s4-sf)/sfg\n", - "from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\n", - "so h4=hf+x4*hfg in KJ/kg\n", - "from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\n", - "s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\n", - "so x5=(s5-sf)/sfg\n", - "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "h5=hf+x5*hfg in KJ/kg\n", - "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", - "h6=hf at 0.05 bar=137.82 KJ/kg\n", - "v6=vf at 0.05 bar=0.001005 m^3/kg\n", - "h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\n", - "h8=hf at 1.5 bar=467.11 KJ/kg\n", - "v8=0.001053 m^3/kg=vf at 1.5 bar\n", - "h9=h8+v8*(150-1.5)*10^2 in KJ/kg\n", - "h10=hf at 150 bar=1610.5 KJ/kg\n", - "v10=0.001658 m^3/kg=vf at 150 bar\n", - "h12=h10+v10*(150-10)*10^2 in KJ/kg\n", - "Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\n", - "Heat balance on closed feed water heater yields,\n", - "m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\n", - "so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\n", - "heat balance on open feed water can be given as under,\n", - "m2*h4+(1-m1-m2)*h7=(1-m1)*h8\n", - "so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\n", - "for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\n", - "For mixing after closed feed water heater,\n", - "h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\n", - "Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\n", - "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\n", - "heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\n", - "cycle thermal efficiency,n=W_net/q_add 0.48\n", - "in percentage 47.59\n", - "Net power developed in KW=1219*300 in KW 365700.0\n", - "cycle thermal efficiency=47.6%\n", - "Net power developed=365700 KW\n" - ] - } - ], - "source": [ - "#cal of cycle thermal efficiency,Net power developed\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.11, Page:279 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\")\n", - "print(\"Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\")\n", - "h2=3308.6;\n", - "s2=6.3443;\n", - "print(\"for isentropic expansion 2-3-4-5,s2=s3=s4=s5\")\n", - "s3=s2;\n", - "s4=s3;\n", - "s5=s4;\n", - "print(\"Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\")\n", - "print(\"s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\")\n", - "print(\"so x3=(s3-sf)/sfg\")\n", - "print(\"from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\")\n", - "sf=2.1387;\n", - "sfg=4.4478;\n", - "x3=(s3-sf)/sfg\n", - "x3=0.945;#approx.\n", - "print(\"h3=hf+x3*hfg in KJ/kg\")\n", - "print(\"from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\")\n", - "hf=762.81;\n", - "hfg=2015.3;\n", - "h3=hf+x3*hfg\n", - "print(\"s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\")\n", - "print(\"so x4=(s4-sf)/sfg\")\n", - "print(\"from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\")\n", - "sf=1.4336;\n", - "sfg=5.7897;\n", - "x4=(s4-sf)/sfg\n", - "x4=0.848;#approx.\n", - "print(\"so h4=hf+x4*hfg in KJ/kg\")\n", - "print(\"from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\")\n", - "hf=467.11;\n", - "hfg=2226.5;\n", - "h4=hf+x4*hfg\n", - "print(\"s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", - "print(\"so x5=(s5-sf)/sfg\")\n", - "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "x5=(s5-sf)/sfg\n", - "x5=0.739;#approx.\n", - "print(\"h5=hf+x5*hfg in KJ/kg\")\n", - "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "h5=hf+x5*hfg \n", - "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", - "h6=137.82;\n", - "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", - "v6=0.001005;\n", - "print(\"h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\")\n", - "h7=h6+v6*(1.5-0.05)*10**2\n", - "print(\"h8=hf at 1.5 bar=467.11 KJ/kg\")\n", - "h8=467.11; \n", - "print(\"v8=0.001053 m^3/kg=vf at 1.5 bar\")\n", - "v8=0.001053;\n", - "print(\"h9=h8+v8*(150-1.5)*10^2 in KJ/kg\")\n", - "h9=h8+v8*(150-1.5)*10**2\n", - "print(\"h10=hf at 150 bar=1610.5 KJ/kg\")\n", - "h10=1610.5; \n", - "print(\"v10=0.001658 m^3/kg=vf at 150 bar\")\n", - "v10=0.001658;\n", - "print(\"h12=h10+v10*(150-10)*10^2 in KJ/kg\")\n", - "h12=h10+v10*(150-10)*10**2\n", - "print(\"Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\")\n", - "print(\"Heat balance on closed feed water heater yields,\")\n", - "print(\"m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\")\n", - "print(\"so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\")\n", - "m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)\n", - "print(\"heat balance on open feed water can be given as under,\")\n", - "print(\"m2*h4+(1-m1-m2)*h7=(1-m1)*h8\")\n", - "print(\"so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\")\n", - "m2=((1-m1)*(h8-h7))/(h4-h7)\n", - "print(\"for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\")\n", - "print(\"For mixing after closed feed water heater,\")\n", - "print(\"h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\")\n", - "h1=(4.18*150)*(1-m1)+m1*h12\n", - "print(\"Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\")\n", - "print(\"W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\")\n", - "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-((1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10)))\n", - "print(\"heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\")\n", - "q_add=(h2-h1)\n", - "n=W_net/q_add\n", - "print(\"cycle thermal efficiency,n=W_net/q_add\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"Net power developed in KW=1219*300 in KW\"),round(1219*300,2)\n", - "print(\"cycle thermal efficiency=47.6%\")\n", - "print(\"Net power developed=365700 KW\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.12;pg no: 282" - ] - }, - { - "cell_type": "code", - "execution_count": 99, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.12, Page:282 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\n", - "At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", - "For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\n", - "state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\n", - "since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\n", - "At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", - "At state 3,h3=2930.57 KJ/kg\n", - "At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\n", - "At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\n", - "From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\n", - "Let dryness fraction at state 5_a be x5,\n", - "s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x5_a=(s5_a-sf)/sfg\n", - "h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\n", - "from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\n", - "Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\n", - "m1_a*h3+h9=m1*h10+4.18*200\n", - "so m1_a=(4.18*200-h9)/(h3-h10) in kg\n", - "Applying heat balance at open feed water heater,\n", - "m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\n", - "so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\n", - "Net work per kg steam generated\n", - "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\n", - "Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\n", - "Thermal efficiency,n= 0.45\n", - "in percentage 45.04\n", - "% increase in thermal efficiency due to reheating= 0.56\n", - "so thermal efficiency of reheat cycle=45.03%\n", - "% increase in efficiency due to reheating=0.56%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,steam generation rate\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.12, Page:282 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\")\n", - "P=100*10**3;#net power output in KW\n", - "print(\"At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", - "h2=3373.7;\n", - "s2=6.5966;\n", - "print(\"For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\")\n", - "s3=s2;\n", - "s4=s3;\n", - "s5=s4;\n", - "print(\"state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\")\n", - "T3=261.6;\n", - "h3=2930.57;\n", - "print(\"since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\")\n", - "print(\"At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", - "h2=3373.7;\n", - "s2=6.5966;\n", - "print(\"At state 3,h3=2930.57 KJ/kg\")\n", - "h3=2930.57;\n", - "print(\"At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\")\n", - "h3_a=3247.6;\n", - "s3_a=7.1271;\n", - "print(\"At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\")\n", - "s4_a=s3_a;\n", - "s5_a=s4_a;\n", - "print(\"From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\")\n", - "h4_a=2841.02;\n", - "print(\"Let dryness fraction at state 5_a be x5,\")\n", - "print(\"s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "print(\"so x5_a=(s5_a-sf)/sfg\")\n", - "x5_a=(s5_a-sf)/sfg\n", - "x5_a=0.853;#approx.\n", - "print(\"h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "h5_a=hf+x5_a*hfg\n", - "print(\"Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\")\n", - "print(\"m1_a*h3+h9=m1*h10+4.18*200\")\n", - "print(\"so m1_a=(4.18*200-h9)/(h3-h10) in kg\")\n", - "m1_a=(4.18*200-h9)/(h3-h10)\n", - "m1_a=0.114;#approx.\n", - "print(\"Applying heat balance at open feed water heater,\")\n", - "print(\"m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\")\n", - "print(\"so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\")\n", - "m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7)\n", - "m2_a=0.131;#approx.\n", - "print(\"Net work per kg steam generated\")\n", - "print(\"w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\")\n", - "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-((1-m1_a-m2_a)*(h7-h6)+(h9-h8))\n", - "print(\"Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\")\n", - "q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)\n", - "n=w_net/q_add\n", - "print(\"Thermal efficiency,n=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"% increase in thermal efficiency due to reheating=\"),round((0.4503-0.4478)*100/0.4478,2)\n", - "print(\"so thermal efficiency of reheat cycle=45.03%\")\n", - "print(\"% increase in efficiency due to reheating=0.56%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.13;pg no: 286" - ] - }, - { - "cell_type": "code", - "execution_count": 100, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.13, Page:286 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\n", - "For mercury cycle,\n", - "insentropic heat drop=349-234.5 in KJ/kg Hg\n", - "actual heat drop=0.85*114.5 in KJ/kg Hg\n", - "Heat rejected in condenser=(349-97.325-35)in KJ/kg\n", - "heat added in boiler=349-35 in KJ/kg\n", - "For steam cycle,\n", - "Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\n", - "Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\n", - "Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\n", - "Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\n", - "Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\n", - "for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\n", - "state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\n", - "state 4 lies in wet region,say with dryness fraction x4\n", - "s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\n", - "so x4=(s4-sf)/sfg\n", - "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", - "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", - "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", - "Let state 5 lie in wet region with dryness fraction x5,\n", - "s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\n", - "so x5=(s5-sf)/sfg\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "h5=hf+x5*hfg in KJ/kg\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\n", - "h7=h6+v6*(1-0.075)*10^2 in KJ/kg\n", - "from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\n", - "h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\n", - "Applying heat balance on CFWH1,T1=150oc and also T15=150oc\n", - "m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\n", - "(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\n", - "Applying heat balance on CFEH2,T11=90oc\n", - "m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\n", - "(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\n", - "Heat balance at mixing between CFWH1 and CFWH2,\n", - "(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\n", - "376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\n", - "For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\n", - "from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\n", - "solving above equations,we get\n", - "m1=0.102 kg per kg steam generated\n", - "m2=0.073 kg per kg steam generated\n", - "pump work in process 13-14,h14-h13=v13*(40-8)*10^2\n", - "so h14-h13 in KJ/kg\n", - "Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\n", - "net work per kg of steam,w_net=w_mercury+w_steam\n", - "w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\n", - "thermal efficiency of binary vapour cycle=w_net/q_add 0.55\n", - "in percentage 55.36\n", - "so thermal efficiency=55.36%\n", - "NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.13, Page:286 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\")\n", - "print(\"For mercury cycle,\")\n", - "print(\"insentropic heat drop=349-234.5 in KJ/kg Hg\")\n", - "349-234.5\n", - "print(\"actual heat drop=0.85*114.5 in KJ/kg Hg\")\n", - "0.85*114.5\n", - "print(\"Heat rejected in condenser=(349-97.325-35)in KJ/kg\")\n", - "(349-97.325-35)\n", - "print(\"heat added in boiler=349-35 in KJ/kg\")\n", - "349-35\n", - "print(\"For steam cycle,\")\n", - "print(\"Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\")\n", - "h=2767.13;\n", - "print(\"Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\")\n", - "h2=3330.3;\n", - "print(\"Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\")\n", - "s2=6.9363;\n", - "print(\"Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\")\n", - "h-4.18*150\n", - "print(\"Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\")\n", - "2140.13/216.675\n", - "print(\"for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\")\n", - "s3=s2;\n", - "s4=s3;\n", - "s5=s4;\n", - "print(\"state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\")\n", - "h3=2899.23;\n", - "print(\"state 4 lies in wet region,say with dryness fraction x4\")\n", - "print(\"s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\")\n", - "print(\"so x4=(s4-sf)/sfg\")\n", - "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", - "sf=1.3026;\n", - "sfg=6.0568;\n", - "x4=(s4-sf)/sfg\n", - "x4=0.93;#approx.\n", - "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", - "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", - "hf=417.46;\n", - "hfg=2258.0;\n", - "h4=hf+x4*hfg\n", - "print(\"Let state 5 lie in wet region with dryness fraction x5,\")\n", - "print(\"s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", - "print(\"so x5=(s5-sf)/sfg\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "x5=(s5-sf)/sfg\n", - "x5=0.828;#approx.\n", - "print(\"h5=hf+x5*hfg in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0;\n", - "h5=hf+x5*hfg\n", - "print(\"Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\")\n", - "print(\"h7=h6+v6*(1-0.075)*10^2 in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\")\n", - "h6=168.79;\n", - "v6=0.001008;\n", - "h7=h6+v6*(1-0.075)*10**2\n", - "print(\"h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\")\n", - "h9=417.46;\n", - "h13=721.11;\n", - "print(\"Applying heat balance on CFWH1,T1=150oc and also T15=150oc\")\n", - "T1=150;\n", - "T15=150;\n", - "print(\"m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\")\n", - "print(\"(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\")\n", - "print(\"Applying heat balance on CFEH2,T11=90oc\")\n", - "T11=90;\n", - "print(\"m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\")\n", - "print(\"(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\")\n", - "print(\"Heat balance at mixing between CFWH1 and CFWH2,\")\n", - "print(\"(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\")\n", - "print(\"376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\")\n", - "print(\"For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\")\n", - "print(\"from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\")\n", - "h9=417.46;\n", - "v9=0.001043;\n", - "h10=h9+v9*(8-1)*10**2 \n", - "print(\"solving above equations,we get\")\n", - "print(\"m1=0.102 kg per kg steam generated\")\n", - "print(\"m2=0.073 kg per kg steam generated\")\n", - "m1=0.102;\n", - "m2=0.073;\n", - "print(\"pump work in process 13-14,h14-h13=v13*(40-8)*10^2\")\n", - "print(\"so h14-h13 in KJ/kg\")\n", - "v13=0.001252;\n", - "v13*(40-8)*10**2\n", - "print(\"Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\")\n", - "q_add=(9.88*314)+(3330.3-2767.13)\n", - "print(\"net work per kg of steam,w_net=w_mercury+w_steam\")\n", - "print(\"w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\")\n", - "w_net=(9.88*97.325)+((h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h7-h6)-m2*(h10-h9)-m1*4.006)\n", - "print(\"thermal efficiency of binary vapour cycle=w_net/q_add\"),round(w_net/q_add,2)\n", - "print(\"in percentage\"),round(w_net*100/q_add,2)\n", - "print(\"so thermal efficiency=55.36%\")\n", - "print(\"NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.14;pg no: 288" - ] - }, - { - "cell_type": "code", - "execution_count": 101, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.14, Page:288 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\n", - "This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\n", - "For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\n", - "ideally, s2=s1=6.7664 KJ/kg K\n", - "s2=sf at 0.075 bar +x3* sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x3=(s2-sf)/sfg\n", - "h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\n", - "for LP:at inlet of LP steam\n", - "h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\n", - "Enthalpy at exit,h_3LP=2222.34 KJ/kg\n", - "actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\n", - "HP steam consumption at full load=P*0.7457/h_HP in kg/s\n", - "HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\n", - "LP steam consumption at full load=P*0.7457/h_LP in kg/s\n", - "LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\n", - "The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\n", - "or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\n", - "Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\n", - "x=load,hp\n", - "y_HP=m_HP*x+C_HP\n", - "0.254=m_HP*0+C_HP\n", - "so C_HP=0.254\n", - "2.54=m_HP*2500+C_HP\n", - "so m_HP=(2.54-C_HP)/2500\n", - "so y_HP=9.144*10^-4*x_HP+0.254\n", - "Willans line for LP:y_LP=m_LP*x_LP+C_LP\n", - "0.481=m_LP*0+C_LP\n", - "so C_LP=0.481\n", - "4.81=m_LP*2500+C_LP\n", - "so m_LP=(4.81-C_LP)/2500\n", - "so y_LP=1.732*10^-3*x_LP+0.481\n", - "Total output(load) from mixed turbine,x=x_HP+x_LP\n", - "For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\n", - "from y_LP=1.732*10^-3*x_LP+0.481,\n", - "x_LP=(y_LP-0.481)/1.732*10^-3\n", - "since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\n", - "from y_HP=9.144*10^-4*x_HP+C_HP in kg/s 0.63\n", - "so HP steam requirement=0.63 kg/s\n" - ] - } - ], - "source": [ - "#cal of HP steam required\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.14, Page:288 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\")\n", - "n=0.8;#efficiency of both HP and LP turbine\n", - "P=2500;#output in hp\n", - "print(\"This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\")\n", - "print(\"For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\")\n", - "h1=3023.5;\n", - "s1=6.7664;\n", - "print(\"ideally, s2=s1=6.7664 KJ/kg K\")\n", - "s2=s1;\n", - "print(\"s2=sf at 0.075 bar +x3* sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "print(\"so x3=(s2-sf)/sfg\")\n", - "x3=(s2-sf)/sfg\n", - "x3=0.806;#approx.\n", - "print(\"h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0; \n", - "h_3HP=hf+x3*hfg\n", - "print(\"actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\")\n", - "h_HP=(h1-h_3HP)*n\n", - "print(\"for LP:at inlet of LP steam\")\n", - "print(\"h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\")\n", - "h2=2706.7;\n", - "s2=7.1271;\n", - "print(\"Enthalpy at exit,h_3LP=2222.34 KJ/kg\")\n", - "h_3LP=2222.34;\n", - "print(\"actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\")\n", - "h_LP=(h2-h_3LP)*n\n", - "print(\"HP steam consumption at full load=P*0.7457/h_HP in kg/s\")\n", - "P*0.7457/h_HP\n", - "print(\"HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\")\n", - "0.10*(P*0.7457/h_HP)\n", - "print(\"LP steam consumption at full load=P*0.7457/h_LP in kg/s\")\n", - "P*0.7457/h_LP\n", - "print(\"LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\")\n", - "0.10*(P*0.7457/h_LP)\n", - "print(\"The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\")\n", - "print(\"or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\")\n", - "print(\"Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\")\n", - "print(\"x=load,hp\")\n", - "print(\"y_HP=m_HP*x+C_HP\")\n", - "print(\"0.254=m_HP*0+C_HP\")\n", - "print(\"so C_HP=0.254\")\n", - "C_HP=0.254;\n", - "print(\"2.54=m_HP*2500+C_HP\")\n", - "print(\"so m_HP=(2.54-C_HP)/2500\")\n", - "m_HP=(2.54-C_HP)/2500\n", - "print(\"so y_HP=9.144*10^-4*x_HP+0.254\")\n", - "print(\"Willans line for LP:y_LP=m_LP*x_LP+C_LP\")\n", - "print(\"0.481=m_LP*0+C_LP\")\n", - "print(\"so C_LP=0.481\")\n", - "C_LP=0.481;\n", - "print(\"4.81=m_LP*2500+C_LP\")\n", - "print(\"so m_LP=(4.81-C_LP)/2500\")\n", - "m_LP=(4.81-C_LP)/2500\n", - "print(\"so y_LP=1.732*10^-3*x_LP+0.481\")\n", - "print(\"Total output(load) from mixed turbine,x=x_HP+x_LP\")\n", - "print(\"For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\")\n", - "y_LP=1.5;\n", - "print(\"from y_LP=1.732*10^-3*x_LP+0.481,\")\n", - "print(\"x_LP=(y_LP-0.481)/1.732*10^-3\")\n", - "x_LP=(y_LP-0.481)/(1.732*10**-3)\n", - "print(\"since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\")\n", - "x_HP=411.66;\n", - "y_HP=9.144*10**-4*x_HP+C_HP\n", - "print(\"from y_HP=9.144*10^-4*x_HP+C_HP in kg/s\"),round(y_HP,2)\n", - "print(\"so HP steam requirement=0.63 kg/s\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.15;pg no: 289" - ] - }, - { - "cell_type": "code", - "execution_count": 102, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.15, Page:289 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\n", - "Let us carry out analysis for 1 kg of steam generated in boiler.\n", - "Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\n", - "state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\n", - "Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\n", - "so x3= 0.86\n", - "from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\n", - "h3=2404.94 KJ/kg\n", - "If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\n", - "mass of moisture retained in separator(m)=(1-x3)*0.5 kg\n", - "Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\n", - "Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\n", - "Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\n", - "(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\n", - "so T in degree celcius= 68.425\n", - "so temperature of water leaving hotwell=68.425 degree celcius\n", - "Applying heat balanced on trap\n", - "0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\n", - "so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\n", - "from steam tables,at 2 bar,hf=504.70 KJ/kg\n", - "Therefore,heat transferred in process heater in KJ/kg steam generated= 1023.172\n", - "so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\n", - "For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\n", - "Let dryness fraction be x10\n", - "s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x10=(s10-sf)/sfg\n", - "h10=hf at 0.075 bar+x10*hfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "so h10=hf+x10*hfg in KJ/kg \n", - "net work output,neglecting pump work per kg of steam generated,\n", - "w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\n", - "Heat added in boiler per kg steam generated,q_add in KJ/kg= 2674.68\n", - "thermal efficiency=w_net/q_add 0.28\n", - "in percentage 27.59\n", - "so Thermal efficiency=27.58%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,heat transferred and temperature\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.15, Page:289 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\")\n", - "print(\"Let us carry out analysis for 1 kg of steam generated in boiler.\")\n", - "print(\"Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\")\n", - "h2=2960.7;\n", - "s2=6.3615;\n", - "print(\"state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\")\n", - "s3=s2;\n", - "print(\"Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\")\n", - "sf=1.5301;\n", - "sfg=5.5970;\n", - "x3=(s3-sf)/sfg\n", - "print(\"so x3=\"),round(x3,2)\n", - "print(\"from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\")\n", - "x3=0.863;#approx.\n", - "print(\"h3=2404.94 KJ/kg\")\n", - "h3=2404.94;\n", - "print(\"If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\")\n", - "print(\"mass of moisture retained in separator(m)=(1-x3)*0.5 kg\")\n", - "m=(1-x3)*0.5\n", - "print(\"Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\")\n", - "m_LP=0.5-m\n", - "print(\"Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\")\n", - "print(\"Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\")\n", - "print(\"(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\")\n", - "T=((0.5685*4.18*90)+(0.4315*4.18*40))/4.18\n", - "print(\"so T in degree celcius=\"),round(T,3)\n", - "print(\"so temperature of water leaving hotwell=68.425 degree celcius\")\n", - "print(\"Applying heat balanced on trap\")\n", - "print(\"0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\")\n", - "print(\"so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\")\n", - "print(\"from steam tables,at 2 bar,hf=504.70 KJ/kg\")\n", - "hf=504.70;\n", - "h7=((0.5685*4.18*90)-(0.0685*hf))/0.5\n", - "print(\"Therefore,heat transferred in process heater in KJ/kg steam generated=\"),round(0.5*(h3-h7),3)\n", - "print(\"so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\")\n", - "print(\"For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\")\n", - "s10=s3;\n", - "print(\"Let dryness fraction be x10\")\n", - "print(\"s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "print(\"so x10=(s10-sf)/sfg\")\n", - "x10=(s10-sf)/sfg\n", - "x10=0.754;#approx.\n", - "print(\"h10=hf at 0.075 bar+x10*hfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0;\n", - "print(\"so h10=hf+x10*hfg in KJ/kg \")\n", - "h10=hf+x10*hfg \n", - "print(\"net work output,neglecting pump work per kg of steam generated,\")\n", - "print(\"w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\")\n", - "w_net=(h2-h3)*1+0.4315*(h3-h10) \n", - "q_add=(h2-4.18*68.425)\n", - "print(\"Heat added in boiler per kg steam generated,q_add in KJ/kg=\"),round(q_add,2)\n", - "w_net/q_add\n", - "print(\"thermal efficiency=w_net/q_add\"),round(w_net/q_add,2)\n", - "print(\"in percentage\"),round(w_net*100/q_add,2)\n", - "print(\"so Thermal efficiency=27.58%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.16;pg no: 291" - ] - }, - { - "cell_type": "code", - "execution_count": 103, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.16, Page:291 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\n", - "from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\n", - "Assuming isentropic expansion in nozzle,s1=s2=6.9486\n", - "Letdryness fraction at state 2,x2=0.864\n", - "s2=sf at 0.2 bar+x2*sfg at 0.2 bar\n", - "from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\n", - "so x2= 0.86\n", - "hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\n", - "from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\n", - "considering pump work to be of isentropic type,deltah_34=v3*deltap_34\n", - "from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\n", - "or deltah_34 in KJ/kg= 7.1\n", - "pump work,Wp in KJ/kg= 7.1\n", - "turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\n", - "net work(W_net)=Wt-Wp in KJ/kg\n", - "power produced(P)=mass flow rate*W_net in KJ/s\n", - "so net power=43.22 MW\n", - "heat supplied in boiler(Q)=(h1-h4) in KJ/kg\n", - "enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\n", - "total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s 114534.05\n", - "thermal efficiency=net work/heat supplied=W_net/Q 0.38\n", - "in percentage 37.73\n", - "so thermal efficiency=37.73%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,net power\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.16, Page:291 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\")\n", - "m=35;#mass flow rate in kg/s\n", - "print(\"from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\")\n", - "h1=3530.9;\n", - "s1=6.9486;\n", - "print(\"Assuming isentropic expansion in nozzle,s1=s2=6.9486\")\n", - "s2=s1;\n", - "print(\"Letdryness fraction at state 2,x2=0.864\")\n", - "print(\"s2=sf at 0.2 bar+x2*sfg at 0.2 bar\")\n", - "print(\"from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\")\n", - "sf=0.8320;\n", - "sfg=7.0766;\n", - "x2=(s2-sf)/sfg\n", - "print(\"so x2=\"),round(x2,2)\n", - "x2=0.864;#approx.\n", - "print(\"hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\")\n", - "print(\"from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\")\n", - "hf=251.4;\n", - "hfg=2358.3;\n", - "h2=hf+x2*hfg\n", - "print(\"considering pump work to be of isentropic type,deltah_34=v3*deltap_34\")\n", - "print(\"from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\")\n", - "v3=0.001017;\n", - "p3=70;#;pressure of steam entering turbine in bar\n", - "p4=0.20;#condenser pressure in bar\n", - "deltah_34=v3*(p3-p4)*100\n", - "print(\"or deltah_34 in KJ/kg=\"),round(deltah_34,2)\n", - "Wp=deltah_34\n", - "print(\"pump work,Wp in KJ/kg=\"),round(Wp,2)\n", - "print(\"turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\")\n", - "Wt=(h1-h2)\n", - "print(\"net work(W_net)=Wt-Wp in KJ/kg\")\n", - "W_net=Wt-Wp\n", - "print(\"power produced(P)=mass flow rate*W_net in KJ/s\")\n", - "P=m*W_net\n", - "print(\"so net power=43.22 MW\")\n", - "print(\"heat supplied in boiler(Q)=(h1-h4) in KJ/kg\")\n", - "print(\"enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\")\n", - "h3=hf;\n", - "h4=h3+deltah_34 \n", - "Q=m*(h1-h4)\n", - "print(\"total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s\"),round(Q,2)\n", - "print(\"thermal efficiency=net work/heat supplied=W_net/Q\"),round(P/Q,2)\n", - "print(\"in percentage\"),round(P*100/Q,2)\n", - "print(\"so thermal efficiency=37.73%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.17;pg no: 292" - ] - }, - { - "cell_type": "code", - "execution_count": 104, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.1, Page:292 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 17\n", - "from steam tables,h1=3625.3 KJ/s,s1=6.9029 KJ/kg K\n", - "due to isentropic expansion,s1=s2=s3=6.9029 KJ/kg K\n", - "at state 2,i.e at pressure of 2 MPa and entropy 6.9029 KJ/kg K\n", - "by interpolating state for s2 between 2 MPa,300 degree celcius and 2 MPa,350 degree celcius from steam tables,\n", - "h2=3105.08 KJ/kg \n", - "for state 3,i.e at pressure of 0.01 MPa entropy,s3 lies in wet region as s3In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,mass of steam\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.18, Page:294 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 18\")\n", - "W_net=50*10**3;#net output of turbine in KW\n", - "print(\"from steam tables,at inlet to first stage of turbine,h1=h at 100 bar,500oc=3373.7 KJ/kg,s1=s at 100 bar,500oc=6.5966 KJ/kg\")\n", - "h1=3373.7;\n", - "s1=6.5966;\n", - "print(\"Due to isentropic expansion,s1=s6=s2 and s3=s8=s4\")\n", - "s2=s1;\n", - "s6=s2;\n", - "print(\"State at 6 i.e bleed state from HP turbine,temperature by interpolation from steam table =261.6oc.\")\n", - "print(\"At inlet to second stage of turbine,h6=2930.572 KJ/kg\")\n", - "h6=2930.572;\n", - "print(\"h3=h at 10 bar,500oc=3478.5 KJ/kg,s3=s at 10 bar,500oc=7.7622 KJ/kg K\")\n", - "h3=3478.5;\n", - "s3=7.7622;\n", - "s4=s3;\n", - "s8=s4;\n", - "print(\"At exit from first stage of turbine i.e. at 10 bar and entropy of 6.5966 KJ/kg K,Temperature by interpolation from steam table at 10 bar and entropy of 6.5966 KJ/kg K\")\n", - "print(\"T2=181.8oc,h2=2782.8 KJ/kg\")\n", - "T2=181.8;\n", - "h2=2782.8;\n", - "print(\"state at 8,i.e bleed state from second stage of expansion,i.e at 4 bar and entropy of 7.7622 KJ/kg K,Temperature by interpolation from steam table,T8=358.98oc=359oc\")\n", - "T8=359;\n", - "print(\"h8=3188.7 KJ/kg\")\n", - "h8=3188.7;\n", - "print(\"state at 4 i.e. at condenser pressure of 0.1 bar and entropy of 7.7622 KJ/kg K,the state lies in wet region.So let the dryness fraction be x4.\")\n", - "print(\"s4=sf at 0.1 bar+x4*sfg at 0.1 bar\")\n", - "print(\"from steam tables,at 0.1 bar,sf=0.6493 KJ/kg K,sfg=7.5009 KJ/kg K\")\n", - "sf=0.6493;\n", - "sfg=7.5009; \n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.95;#approx.\n", - "print(\"h4=hf at 0.1 bar+x4*hfg at 0.1 bar in KJ/kg \")\n", - "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,hfg=2392.8 KJ/kg\")\n", - "hf=191.83;\n", - "hfg=2392.8;\n", - "h4=hf+x4*hfg\n", - "print(\"given,h4=2464.99 KJ/kg,h11=856.8 KJ/kg,h9=hf at 4 bar=604.74 KJ/kg\")\n", - "h4=2464.99;\n", - "h11=856.8;\n", - "h9=604.74;\n", - "print(\"considering pump work,the net output can be given as,\")\n", - "print(\"W_net=W_HPT+W_LPT-(W_CEP+W_FP)\")\n", - "print(\"where,W_HPT={(h1-h6)+(1-m6)*(h6-h2)}per kg of steam from boiler.\")\n", - "print(\"W_LPT={(1-m6)+(h3-h8)*(1-m6-m8)*(h8-h4)}per kg of steam from boiler.\")\n", - "print(\"for closed feed water heater,energy balance yields;\")\n", - "print(\"m6*h6+h10=m6*h7+h11\")\n", - "print(\"assuming condensate leaving closed feed water heater to be saturated liquid,\")\n", - "print(\"h7=hf at 20 bar=908.79 KJ/kg\")\n", - "h7=908.79; \n", - "print(\"due to throttline,h7=h7_a=908.79 KJ/kg\")\n", - "h7_a=h7;\n", - "print(\"for open feed water heater,energy balance yields,\")\n", - "print(\"m6*h7_a+m8*h8+(1-m6-m8)*h5=h9\")\n", - "print(\"for condensate extraction pump,h5-h4_a=v4_a*deltap\")\n", - "print(\"h5-hf at 0.1 bar=vf at 0.1 bar*(4-0.1)*10^2 \")\n", - "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,vf=0.001010 m^3/kg\")\n", - "hf=191.83;\n", - "vf=0.001010; \n", - "h5=hf+vf*(4-0.1)*10**2\n", - "print(\"so h5 in KJ/kg=\"),round(h5,2)\n", - "print(\"for feed pump,h10-h9=v9*deltap\")\n", - "print(\"h10=h9+vf at 4 bar*(100-4)*10^2 in KJ/kg\")\n", - "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,vf=0.001084 m^3/kg \")\n", - "hf=604.74;\n", - "vf=0.001084;\n", - "h10=h9+vf*(100-4)*10**2\n", - "print(\"substituting in energy balance upon closed feed water heater,\")\n", - "m6=(h11-h10)/(h6-h7)\n", - "print(\"m6 in kg per kg of steam from boiler=\"),round(m6,3)\n", - "print(\"substituting in energy balance upon feed water heater,\")\n", - "m8=(h9-m6*h7_a+m6*h5-h5)/(h8-h5)\n", - "print(\"m8 in kg per kg of steam from boiler=\"),round(m8,3)\n", - "print(\"Let the mass of steam entering first stage of turbine be m kg,then\")\n", - "{(h1-h6)+(1-m6)*(h6-h2)}\n", - "print(\"W_HPT=m*{(h1-h6)+(1-m6)*(h6-h2)}\")\n", - "print(\"W_HPT/m=\"),round(((h1-h6)+(1-m6)*(h6-h2)),2)\n", - "print(\"so W_HPT=m*573.24 KJ\")\n", - "print(\"also,W_LPT={(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}per kg of steam from boiler\")\n", - "{(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}\n", - "print(\"W_LPT/m=\"),round(((1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)),2)\n", - "print(\"so W_LPT=m*813.42 KJ\")\n", - "print(\"pump works(negative work)\")\n", - "print(\"W_CEP=m*(1-m6-m8)*(h5-h4_a)\")\n", - "h4_a=191.83;#h4_a=hf at 0.1 bar\n", - "print(\"W_CEP/m=\")\n", - "(1-m6-m8)*(h5-h4_a)\n", - "print(\"so W_CEP=m* 0.304\")\n", - "print(\"W_FP=m*(h10-h9)\")\n", - "print(\"W_FP/m=\"),round((h10-h9),2)\n", - "print(\"so W_FP=m*10.41\")\n", - "print(\"net output,\")\n", - "print(\"W_net=W_HPT+W_LPT-W_CEP-W_FP \")\n", - "print(\"so 50*10^3=(573.24*m+813.42*m-0.304*m-10.41*m)\")\n", - "m=W_net/(573.24+813.42-0.304-10.41)\n", - "print(\"so m in kg/s=\"),round(m,2)\n", - "Q_add=m*(h1-h11)\n", - "print(\"heat supplied in boiler,Q_add in KJ/s=\"),round(m*(h1-h11),2)\n", - "print(\"Thermal efficenncy=\"),round(W_net/Q_add,2)\n", - "print(\"in percentage\"),round(W_net*100/Q_add,2)\n", - "print(\"so mass of steam bled at 20 bar=0.119 kg per kg of steam entering first stage\")\n", - "print(\"mass of steam bled at 4 bar=0.109 kg per kg of steam entering first stage\")\n", - "print(\"mass of steam entering first stage=36.33 kg/s\")\n", - "print(\"thermal efficiency=54.66%\")\n", - "print(\"NOTE=>In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter8_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter8_1.ipynb deleted file mode 100755 index 5088b9af..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter8_1.ipynb +++ /dev/null @@ -1,2594 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 8:Vapour Power Cycles" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.1;pg no: 260" - ] - }, - { - "cell_type": "code", - "execution_count": 88, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.1, Page:260 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\n", - "T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\n", - "enthalpy at state 2,h2= hg at 7 MPa\n", - "from steam table,h=2772.1 KJ/kg\n", - "entropy at state 2,s2=sg at 7MPa\n", - "from steam table,s2=5.8133 KJ/kg K\n", - "enthalpy and entropy at state 3,\n", - "from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\n", - "for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \n", - "from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\n", - "s1=s2=sf+x1*sfg\n", - "so x1= 0.68\n", - "from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\n", - "enthalpy at state 1,h1 in KJ/kg= 1802.53\n", - "let dryness fraction at state 4 be x4\n", - "for process 4-3,s4=s3=sf+x4*sfg\n", - "so x4= 0.33\n", - "enthalpy at state 4,h4 in KJ/kg= 962.81\n", - "thermal efficiency=net work/heat added\n", - "expansion work per kg=(h2-h1) in KJ/kg 969.57\n", - "compression work per kg=(h3-h4) in KJ/kg(+ve) 304.19\n", - "heat added per kg=(h2-h3) in KJ/kg(-ve) 1505.1\n", - "net work per kg=(h2-h1)-(h3-h4) in KJ/kg 665.38\n", - "thermal efficiency 0.44\n", - "in percentage 44.21\n", - "so thermal efficiency=44.21%\n", - "turbine work=969.57 KJ/kg(+ve)\n", - "compression work=304.19 KJ/kg(-ve)\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,turbine work,compression work\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.1, Page:260 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\")\n", - "print(\"T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\")\n", - "print(\"enthalpy at state 2,h2= hg at 7 MPa\")\n", - "print(\"from steam table,h=2772.1 KJ/kg\")\n", - "h2=2772.1;\n", - "print(\"entropy at state 2,s2=sg at 7MPa\")\n", - "print(\"from steam table,s2=5.8133 KJ/kg K\")\n", - "s2=5.8133;\n", - "print(\"enthalpy and entropy at state 3,\")\n", - "print(\"from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\")\n", - "h3=1267;\n", - "s3=3.1211;\n", - "print(\"for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \")\n", - "s1=s2;\n", - "print(\"from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\")\n", - "sf=0.5564;\n", - "sfg=7.7237;\n", - "print(\"s1=s2=sf+x1*sfg\")\n", - "x1=(s2-sf)/sfg\n", - "print(\"so x1=\"),round(x1,2) \n", - "x1=0.6806;#approx.\n", - "print(\"from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\")\n", - "hf=162.60;\n", - "hfg=2409.54;\n", - "h1=hf+x1*hfg\n", - "print(\"enthalpy at state 1,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"let dryness fraction at state 4 be x4\")\n", - "print(\"for process 4-3,s4=s3=sf+x4*sfg\")\n", - "s4=s3;\n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.3321;#approx.\n", - "h4=hf+x4*hfg\n", - "print(\"enthalpy at state 4,h4 in KJ/kg=\"),round(h4,2)\n", - "print(\"thermal efficiency=net work/heat added\")\n", - "(h2-h1)\n", - "print(\"expansion work per kg=(h2-h1) in KJ/kg\"),round((h2-h1),2)\n", - "(h3-h4)\n", - "print(\"compression work per kg=(h3-h4) in KJ/kg(+ve)\"),round((h3-h4),2)\n", - "(h2-h3)\n", - "print(\"heat added per kg=(h2-h3) in KJ/kg(-ve)\"),round((h2-h3),2)\n", - "(h2-h1)-(h3-h4)\n", - "print(\"net work per kg=(h2-h1)-(h3-h4) in KJ/kg\"),round((h2-h1)-(h3-h4),2)\n", - "((h2-h1)-(h3-h4))/(h2-h3)\n", - "print(\"thermal efficiency\"),round(((h2-h1)-(h3-h4))/(h2-h3),2)\n", - "print(\"in percentage\"),round((((h2-h1)-(h3-h4))/(h2-h3))*100,2)\n", - "print(\"so thermal efficiency=44.21%\")\n", - "print(\"turbine work=969.57 KJ/kg(+ve)\")\n", - "print(\"compression work=304.19 KJ/kg(-ve)\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.2;pg no: 261" - ] - }, - { - "cell_type": "code", - "execution_count": 89, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.2, Page:261 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\n", - "from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\n", - "hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\n", - "from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\n", - "hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\n", - "as process 2-3 is isentropic,so s2=s3\n", - "and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\n", - "so x3= 0.69\n", - "hence enthalpy at 3,\n", - "h3 in KJ/kg= 1819.85\n", - "enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\n", - "process 1-4 is isentropic,so s1=s4\n", - "s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\n", - "so x4= 0.31\n", - "enthalpy at 4,h4 in KJ/kg= 884.31\n", - "enthalpy at 1,h1 in KJ/kg= 1154.23\n", - "carnot cycle(1-2-3-4-1) efficiency:\n", - "n_carnot=net work/heat added\n", - "n_carnot 0.43\n", - "in percentage 42.96\n", - "so n_carnot=42.95%\n", - "In rankine cycle,1-2-3-5-6-1,\n", - "pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg 5.02\n", - "h5 KJ/kg= 137.82\n", - "hence h6 in KJ/kg 142.84\n", - "net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg 969.43\n", - "heat added=(h2-h6)in KJ/kg 2651.46\n", - "rankine cycle efficiency(n_rankine)= 0.37\n", - "in percentage 36.56\n", - "so n_rankine=36.56%\n" - ] - } - ], - "source": [ - "#cal of n_carnot,n_rankine\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.2, Page:261 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\")\n", - "print(\"from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\")\n", - "print(\"hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\")\n", - "hf_5MPa=1154.23;\n", - "sf_5MPa=2.92;\n", - "hg_5MPa=2794.3;\n", - "sg_5MPa=5.97;\n", - "print(\"from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\")\n", - "print(\"hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\")\n", - "hf_5KPa=137.82;\n", - "sf_5KPa=0.4764;\n", - "hg_5KPa=2561.5;\n", - "sg_5KPa=8.3951;\n", - "vf_5KPa=0.001005;\n", - "print(\"as process 2-3 is isentropic,so s2=s3\")\n", - "print(\"and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\")\n", - "s2=sg_5MPa;\n", - "s3=s2;\n", - "x3=(s3-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.694;#approx.\n", - "print(\"hence enthalpy at 3,\")\n", - "h3=hf_5KPa+x3*(hg_5KPa-hf_5KPa)\n", - "print(\"h3 in KJ/kg=\"),round(h3,2)\n", - "print(\"enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\")\n", - "print(\"process 1-4 is isentropic,so s1=s4\")\n", - "s1=sf_5MPa;\n", - "print(\"s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\")\n", - "x4=(s1-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.308;#approx.\n", - "h4=hf_5KPa+x4*(hg_5KPa-hf_5KPa)\n", - "print(\"enthalpy at 4,h4 in KJ/kg=\"),round(h4,2)\n", - "h1=hf_5MPa\n", - "h2=hg_5MPa;\n", - "n_carnot=((h2-h3)-(h1-h4))/(h2-h1)\n", - "print(\"enthalpy at 1,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"carnot cycle(1-2-3-4-1) efficiency:\")\n", - "print(\"n_carnot=net work/heat added\")\n", - "print(\"n_carnot\"),round(n_carnot,2)\n", - "print(\"in percentage\"),round(n_carnot*100,2)\n", - "print(\"so n_carnot=42.95%\")\n", - "print(\"In rankine cycle,1-2-3-5-6-1,\")\n", - "p6=5000;#boiler pressure in KPa\n", - "p5=5;#condenser pressure in KPa\n", - "vf_5KPa*(p6-p5)\n", - "print(\"pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg\"),round(vf_5KPa*(p6-p5),2)\n", - "h5=hf_5KPa;\n", - "print(\"h5 KJ/kg=\"),round(hf_5KPa,2)\n", - "h6=h5+(vf_5KPa*(p6-p5))\n", - "print(\"hence h6 in KJ/kg\"),round(h6,2)\n", - "(h2-h3)-(h6-h5)\n", - "print(\"net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg\"),round((h2-h3)-(h6-h5),2)\n", - "(h2-h6)\n", - "print(\"heat added=(h2-h6)in KJ/kg\"),round((h2-h6),2)\n", - "n_rankine=((h2-h3)-(h6-h5))/(h2-h6)\n", - "print(\"rankine cycle efficiency(n_rankine)=\"),round(n_rankine,2)\n", - "print(\"in percentage\"),round(n_rankine*100,2)\n", - "print(\"so n_rankine=36.56%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.3;pg no: 263" - ] - }, - { - "cell_type": "code", - "execution_count": 90, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.3, Page:263 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\n", - "from steam tables,h2=hg_40bar=3092.5 KJ/kg\n", - "s2=sg_40bar=6.5821 KJ/kg K\n", - "h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \n", - "s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "v4=vf_0.05bar=0.001005 m^3/kg\n", - "let the dryness fraction at state 3 be x3,\n", - "for ideal process,2-3,s2=s3\n", - "s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\n", - "so x3= 0.77\n", - "h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\n", - "for pumping process,\n", - "h1-h4=v4*deltap=v4*(p1-p4)\n", - "so h1=h4+v4*(p1-p4) in KJ/kg 141.83\n", - "pump work per kg of steam in KJ/kg 4.01\n", - "net work per kg of steam =(expansion work-pump work)per kg of steam\n", - "=(h2-h3)-(h1-h4) in KJ/kg= 1081.75\n", - "cycle efficiency=net work/heat added 0.37\n", - "in percentage 36.66\n", - "so net work per kg of steam=1081.74 KJ/kg\n", - "cycle efficiency=36.67%\n", - "pump work per kg of steam=4.02 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of net work per kg of steam,cycle efficiency,pump work per kg of steam\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.3, Page:263 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\")\n", - "print(\"from steam tables,h2=hg_40bar=3092.5 KJ/kg\")\n", - "h2=3092.5;\n", - "print(\"s2=sg_40bar=6.5821 KJ/kg K\")\n", - "s2=6.5821;\n", - "print(\"h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \")\n", - "h4=137.82;\n", - "hfg=2423.7;\n", - "print(\"s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "s4=0.4764;\n", - "sfg=7.9187;\n", - "print(\"v4=vf_0.05bar=0.001005 m^3/kg\")\n", - "v4=0.001005;\n", - "print(\"let the dryness fraction at state 3 be x3,\")\n", - "print(\"for ideal process,2-3,s2=s3\")\n", - "s3=s2;\n", - "print(\"s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\")\n", - "x3=(s2-s4)/(sfg)\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.7711;#approx.\n", - "print(\"h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\")\n", - "h3=h4+x3*hfg\n", - "print(\"for pumping process,\")\n", - "print(\"h1-h4=v4*deltap=v4*(p1-p4)\")\n", - "p1=40*100;#pressure of steam enter in turbine in mPa\n", - "p4=0.05*100;#pressure of steam leave turbine in mPa\n", - "h1=h4+v4*(p1-p4)\n", - "print(\"so h1=h4+v4*(p1-p4) in KJ/kg\"),round(h1,2)\n", - "(h1-h4)\n", - "print(\"pump work per kg of steam in KJ/kg\"),round((h1-h4),2)\n", - "print(\"net work per kg of steam =(expansion work-pump work)per kg of steam\")\n", - "(h2-h3)-(h1-h4)\n", - "print(\"=(h2-h3)-(h1-h4) in KJ/kg=\"),round((h2-h3)-(h1-h4),2)\n", - "print(\"cycle efficiency=net work/heat added\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", - "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", - "print(\"so net work per kg of steam=1081.74 KJ/kg\")\n", - "print(\"cycle efficiency=36.67%\")\n", - "print(\"pump work per kg of steam=4.02 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.4;pg no: 264" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.4, Page:264 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 4\n", - "Let us assume that the condensate leaves condenser as saturated liquid and the expansion in turbine and pumping processes are isentropic.\n", - "from steam tables,h2=h_20MPa=3238.2 KJ/kg\n", - "s2=6.1401 KJ/kg K\n", - "h5=h_0.005MPa in KJ/kg\n", - "from steam tables,at 0.005 MPa,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "h5=hf+0.9*hfg in KJ/kg 2319.15\n", - "s5 in KJ/kg K= 7.6\n", - "h6=hf=137.82 KJ/kg\n", - "it is given that temperature at state 4 is 500 degree celcius and due to isentropic processes s4=s5=7.6032 KJ/kg K.The state 4 can be conveniently located on mollier chart by the intersection of 500 degree celcius constant temperature line and entropy value of 7.6032 KJ/kg K and the pressure and enthalpy obtained.but these shall be approximate.\n", - "The state 4 can also be located by interpolation using steam table.The entropy value of 7.6032 KJ/kg K lies between the superheated steam states given under,p=1.20 MPa,s at 1.20 MPa=7.6027 KJ/kg K\n", - "p=1.40 MPa,s at 1.40 MPa=7.6027 KJ/kg K\n", - "by interpolation state 4 lies at pressure=\n", - "=1.399,approx.=1.40 MPa\n", - "thus,steam leaves HP turbine at 1.40 MPa\n", - "enthalpy at state 4,h4=3474.1 KJ/kg\n", - "for process 2-33,s2=s3=6.1401 KJ/kg K.The state 3 thus lies in wet region as s3sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\n", - "From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\n", - "Let dryness fraction at state 9 be x9 so,\n", - "s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\n", - "from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\n", - "x9=(s9-sf)/sfg 0.95\n", - "h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\n", - "from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\n", - "Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\n", - "h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\n", - "h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\n", - "For process 4-8,i.e in CEP.\n", - "h8 in KJ/kg= 138.22\n", - "For process 11-12,i.e in FP2,\n", - "h12=h11+v11*(40-4)*10^2 in KJ/kg 608.64\n", - "For process 13-1_a i.e. in FP1,h1_a= in KJ/kg= 1107.34\n", - "m1*3141.81+(1-m1)*608.64=1087.31\n", - "so m1=(1087.31-608.64)/(3141.81-608.64)in kg\n", - "Applying energy balance on open feed water heater 1 (OFWH1)\n", - "m1*h10+(1-m1)*h12)=1*h13\n", - "so m1 in kg= 0.19\n", - "Applying energy balance on open feed water heater 2 (OFWH2)\n", - "m2*h9+(1-m1-m2)*h8=(1-m1)*h11\n", - "so m2 in kg= 0.15\n", - "Thermal efficiency of cycle,n= 0.51\n", - "W_CEP in KJ/kg steam from boiler= 0.26\n", - "W_FP1=(h1_a-h13)in KJ/kg of steam from boiler 20.0\n", - "W_FP2 in KJ/kg of steam from boiler= 3.17\n", - "W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler= 23.46\n", - "n= 0.51\n", - "in percentage 51.37\n", - "so cycle thermal efficiency,na=46.18%\n", - "nb=49.76%\n", - "nc=51.37%\n", - "hence it is obvious that efficiency increases with increase in number of feed heaters.\n" - ] - } - ], - "source": [ - "#cal of maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.6, Page:267 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 6\")\n", - "print(\"case (a) When there is no feed water heater\")\n", - "print(\"Thermal efficiency of cycle=((h2-h3)-(h1-h4))/(h2-h1)\")\n", - "print(\"from steam tables,h2=h at 200 bar,650oc=3675.3 KJ/kg,s2=s at 200 bar,650oc=6.6582 KJ/kg K,h4=hf at 0.05 bar=137.82 KJ/kg,v4=vf at 0.05 bar=0.001005 m^3/kg\")\n", - "h2=3675.3;\n", - "s2=6.6582;\n", - "h4=137.82;\n", - "v4=0.001005;\n", - "print(\"hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg,sf at 0.05 bar=0.4764 KJ/kg K,sfg at 0.05 bar=7.9187 KJ/kg K\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "print(\"For process 2-3,s2=s3.Let dryness fraction at 3 be x3.\")\n", - "s3=s2;\n", - "print(\"s3=6.6582=sf at 0.05 bar+x3*sfg at 0.05 bar\")\n", - "x3=(s3-sf)/sfg\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.781;#approx.\n", - "print(\"h3=hf at 0.05 bar+x3*hfg at 0.05 bar in KJ/kg\")\n", - "h3=hf+x3*hfg\n", - "print(\"For pumping process 4-1,\")\n", - "print(\"h1-h4=v4*deltap\")\n", - "h1=h4+v4*(200-0.5)*10**2\n", - "print(\"h1= in KJ/kg=\"),round(h1,2)\n", - "((h2-h3)-(h1-h4))/(h2-h1)\n", - "print(\"Thermal efficiency of cycle=\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", - "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", - "print(\"case (b) When there is only one feed water heater working at 8 bar\")\n", - "print(\"here,let mass of steam bled for feed heating be m kg\")\n", - "print(\"For process 2-6,s2=s6=6.6582 KJ/kg K\")\n", - "s6=s2;\n", - "print(\"Let dryness fraction at state 6 be x6\")\n", - "print(\"s6=sf at 8 bar+x6*sfg at 8 bar\")\n", - "print(\"from steam tables,hf at 8 bar=721.11 KJ/kg,vf at 8 bar=0.001115 m^3/kg,hfg at 8 bar=2048 KJ/kg,sf at 8 bar=2.0462 KJ/kg K,sfg at 8 bar=4.6166 KJ/kg K\")\n", - "hf=721.11;\n", - "vf=0.001115;\n", - "hfg=2048;\n", - "sf=2.0462;\n", - "sfg=4.6166;\n", - "x6=(s6-sf)/sfg\n", - "print(\"substituting entropy values,x6=\"),round(x6,2)\n", - "x6=0.999;#approx.\n", - "print(\"h6=hf at at 8 bar+x6*hfg at 8 bar in KJ/kg\")\n", - "h6=hf+x6*hfg\n", - "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at 8 bar.h7=hf at 8 bar=721.11 KJ/kg\")\n", - "h7=721.11;\n", - "h5=h4+v4*(8-.05)*10**2\n", - "print(\"For process 4-5,h5 in KJ/kg\"),round(h5,2)\n", - "print(\"Applying energy balance at open feed water heater,\")\n", - "print(\"m*h6+(1-m)*h5=1*h7\")\n", - "m=(h7-h5)/(h6-h5)\n", - "print(\"so m= in kg\"),round(m,2)\n", - "h7=hf;\n", - "v7=vf;\n", - "h1=h7+v7*(200-8)*10**2\n", - "print(\"For process 7-1,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"here h7=hf at 8 bar,v7=vf at 8 bar\")\n", - "#TE=((h2-h6)+(1-m)*(h6-h3)-((1-m)*(h5-h4)+(h1-h7))/(h2-h1)\n", - "print(\"Thermal efficiency of cycle=0.4976\")\n", - "print(\"in percentage=49.76\")\n", - "print(\"case (c) When there are two feed water heaters working at 40 bar and 4 bar\")\n", - "print(\"here, let us assume the mass of steam at 40 bar,4 bar to be m1 kg and m2 kg respectively.\")\n", - "print(\"2-10-9-3,s2=s10=s9=s3=6.6582 KJ/kg K\")\n", - "s3=s2;\n", - "s9=s3;\n", - "s10=s9;\n", - "print(\"At state 10.s10>sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\")\n", - "print(\"From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\")\n", - "T10=370.6;\n", - "h10=3141.81;\n", - "print(\"Let dryness fraction at state 9 be x9 so,\") \n", - "print(\"s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\")\n", - "print(\"from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\")\n", - "sf=1.7766;\n", - "sfg=5.1193;\n", - "x9=(s9-sf)/sfg\n", - "print(\"x9=(s9-sf)/sfg\"),round(x9,2)\n", - "x9=0.9536;#approx.\n", - "print(\"h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\")\n", - "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\")\n", - "hf=604.74;\n", - "hfg=2133.8;\n", - "h9=hf+x9*hfg \n", - "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\")\n", - "print(\"h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\")\n", - "h11=604.74;\n", - "v11=0.001084;\n", - "print(\"h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\")\n", - "h13=1087.31;\n", - "v13=0.001252;\n", - "print(\"For process 4-8,i.e in CEP.\")\n", - "h8=h4+v4*(4-0.05)*10**2\n", - "print(\"h8 in KJ/kg=\"),round(h8,2)\n", - "print(\"For process 11-12,i.e in FP2,\")\n", - "h12=h11+v11*(40-4)*10**2\n", - "print(\"h12=h11+v11*(40-4)*10^2 in KJ/kg\"),round(h12,2)\n", - "h1_a=h13+v13*(200-40)*10**2\n", - "print(\"For process 13-1_a i.e. in FP1,h1_a= in KJ/kg=\"),round(h1_a,2)\n", - "print(\"m1*3141.81+(1-m1)*608.64=1087.31\")\n", - "print(\"so m1=(1087.31-608.64)/(3141.81-608.64)in kg\")\n", - "m1=(1087.31-608.64)/(3141.81-608.64)\n", - "print(\"Applying energy balance on open feed water heater 1 (OFWH1)\")\n", - "print(\"m1*h10+(1-m1)*h12)=1*h13\")\n", - "m1=(h13-h12)/(h10-h12)\n", - "print(\"so m1 in kg=\"),round(m1,2)\n", - "print(\"Applying energy balance on open feed water heater 2 (OFWH2)\")\n", - "print(\"m2*h9+(1-m1-m2)*h8=(1-m1)*h11\")\n", - "m2=(1-m1)*(h11-h8)/(h9-h8)\n", - "print(\"so m2 in kg=\"),round(m2,2)\n", - "W_CEP=(1-m1-m2)*(h8-h4)\n", - "W_FP1=(h1_a-h13)\n", - "W_FP2=(1-m1)*(h12-h11)\n", - "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", - "print(\"Thermal efficiency of cycle,n=\"),round(n,2)\n", - "print(\"W_CEP in KJ/kg steam from boiler=\"),round(W_CEP,2)\n", - "print(\"W_FP1=(h1_a-h13)in KJ/kg of steam from boiler\"),round(W_FP1)\n", - "print(\"W_FP2 in KJ/kg of steam from boiler=\"),round(W_FP2,2)\n", - "W_CEP+W_FP1+W_FP2\n", - "print(\"W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler=\"),round(W_CEP+W_FP1+W_FP2,2)\n", - "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", - "print(\"n=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so cycle thermal efficiency,na=46.18%\")\n", - "print(\"nb=49.76%\")\n", - "print(\"nc=51.37%\")\n", - "print(\"hence it is obvious that efficiency increases with increase in number of feed heaters.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.7;pg no: 272" - ] - }, - { - "cell_type": "code", - "execution_count": 94, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.7, Page:272 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\n", - "from steam tables,\n", - "h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\n", - "s3=s2=6.9759 KJ/kg K\n", - "by interpolation from steam tables,\n", - "T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\n", - "for expansion process 4-5,s4=s5=7.7938 KJ/kg K\n", - "let dryness fraction at state 5 be x5\n", - "s5=sf at 0.05 bar+x5*sfg at 0.05 bar\n", - "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "so x5= 0.92\n", - "h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\n", - "from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\n", - "h6=hf at 0.05 bar=137.82 KJ/kg\n", - "v6=vf at 0.05 bar=0.001005 m^3/kg\n", - "for process 6-1 in feed pump,h1 in KJ/kg= 142.84\n", - "cycle efficiency=W_net/Q_add\n", - "Wt in KJ/kg= 1510.35\n", - "W_pump=(h1-h6)in KJ/kg 5.02\n", - "W_net=Wt-W_pump in KJ/kg 1505.33\n", - "Q_add in KJ/kg= 3290.96\n", - "cycle efficiency= 0.4574\n", - "in percentage= 45.74\n", - "we know ,1 hp=0.7457 KW\n", - "specific steam consumption in kg/hp hr= 1.78\n", - "work ratio=net work/positive work 0.9967\n", - "so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\n" - ] - } - ], - "source": [ - "#cal of cycle efficiency,specific steam consumption,work ratio\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.7, Page:272 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\")\n", - "print(\"from steam tables,\")\n", - "print(\"h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\")\n", - "h2=3433.8;\n", - "s2=6.9759;\n", - "print(\"s3=s2=6.9759 KJ/kg K\")\n", - "s3=s2;\n", - "print(\"by interpolation from steam tables,\")\n", - "print(\"T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\")\n", - "T3=183.14;\n", - "h3=2818.03;\n", - "h4=3271.9;\n", - "s4=7.7938;\n", - "print(\"for expansion process 4-5,s4=s5=7.7938 KJ/kg K\")\n", - "s5=s4;\n", - "print(\"let dryness fraction at state 5 be x5\")\n", - "print(\"s5=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", - "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "x5=(s5-sf)/sfg\n", - "print(\"so x5=\"),round(x5,2)\n", - "x5=0.924;#approx.\n", - "print(\"h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\")\n", - "print(\"from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "h5=hf+x5*hfg \n", - "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", - "h6=137.82;\n", - "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", - "v6=0.001005;\n", - "p1=50.;#steam generation pressure in bar\n", - "p6=0.05;#steam entering temperature in turbine in bar\n", - "h1=h6+v6*(p1-p6)*100\n", - "print(\"for process 6-1 in feed pump,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"cycle efficiency=W_net/Q_add\")\n", - "Wt=(h2-h3)+(h4-h5)\n", - "print(\"Wt in KJ/kg=\"),round(Wt,2)\n", - "W_pump=(h1-h6)\n", - "print(\"W_pump=(h1-h6)in KJ/kg\"),round(W_pump,2)\n", - "W_net=Wt-W_pump\n", - "print(\"W_net=Wt-W_pump in KJ/kg\"),round(W_net,2)\n", - "Q_add=(h2-h1)\n", - "print(\"Q_add in KJ/kg=\"),round(Q_add,2)\n", - "print(\"cycle efficiency=\"),round(W_net/Q_add,4)\n", - "W_net*100/Q_add\n", - "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", - "print(\"we know ,1 hp=0.7457 KW\")\n", - "print(\"specific steam consumption in kg/hp hr=\"),round(0.7457*3600/W_net,2)\n", - "print(\"work ratio=net work/positive work\"),round(W_net/Wt,4)\n", - "print(\"so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.8;pg no: 273" - ] - }, - { - "cell_type": "code", - "execution_count": 95, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.8, Page:273 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\n", - "from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\n", - "h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\n", - "Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\n", - "h8=hf at 3 bar=561.47 KJ/kg\n", - "for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\n", - "Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\n", - "s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\n", - "from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\n", - "so x3= 0.95\n", - "s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\n", - "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "so x4= 0.79\n", - "thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\n", - "here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\n", - "h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\n", - "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", - "assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\n", - "pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\n", - "for mixing process between condenser and feed pump,\n", - "(1-m)*h5+m*h9=1*h6\n", - "h6=m(h9-h5)+h5\n", - "we get,h6=137.82+m*423.65\n", - "therefore h7=h6+6.02=143.84+m*423.65\n", - "Applying energy balance at closed feed water heater;\n", - "m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\n", - "so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\n", - "so m=0.144 kg\n", - "steam bled for feed heating=0.144 kg/kg steam generated\n", - "The net power output,W_net in KJ/kg steam generated= 1167.27\n", - "mass of steam required to be generated in kg/s= 26.23\n", - "or in kg/hr\n", - "so capacity of boiler required=94428 kg/hr\n", - "overall thermal efficiency=W_net/Q_add\n", - "here Q_add in KJ/kg= 3134.56\n", - "overall thermal efficiency= 0.37\n", - "in percentage= 37.24\n", - "so overall thermal efficiency=37.24%\n" - ] - } - ], - "source": [ - "#cal of mass of steam bled for feed heating,capacity of boiler required,overall thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.8, Page:273 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\")\n", - "T_cond=115;#condensate temperature in degree celcius\n", - "Cp=4.18;#specific heat at constant pressure in KJ/kg K\n", - "P=30*10**3;#actual alternator output in KW\n", - "n_boiler=0.9;#boiler efficiency\n", - "n_alternator=0.98;#alternator efficiency\n", - "print(\"from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\")\n", - "h2=3301.8;\n", - "s2=6.7193;\n", - "print(\"h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\")\n", - "h5=137.82;\n", - "v5=0.001005;\n", - "print(\"Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\")\n", - "print(\"h8=hf at 3 bar=561.47 KJ/kg\")\n", - "h8=561.47;\n", - "print(\"for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\")\n", - "s3=s2;\n", - "s4=s3;\n", - "print(\"Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\")\n", - "print(\"s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\")\n", - "print(\"from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\")\n", - "sf_3bar=1.6718;\n", - "sfg_3bar=5.3201;\n", - "x3=(s3-sf_3bar)/sfg_3bar\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.949;#approx.\n", - "print(\"s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\")\n", - "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.788;#approx.\n", - "print(\"thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\")\n", - "print(\"here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\")\n", - "hf_3bar=561.47;\n", - "hfg_3bar=2163.8;\n", - "h3=hf_3bar+x3*hfg_3bar \n", - "print(\"h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\")\n", - "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "h4=hf+x4*hfg\n", - "print(\"assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\")\n", - "h9=h8;\n", - "v6=v5;\n", - "print(\"pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\")\n", - "p1=60;#pressure of steam in high pressure turbine in bar\n", - "p5=0.05;#pressure of steam in low pressure turbine in bar\n", - "v5*(p1-p5)*100\n", - "print(\"for mixing process between condenser and feed pump,\")\n", - "print(\"(1-m)*h5+m*h9=1*h6\")\n", - "print(\"h6=m(h9-h5)+h5\")\n", - "print(\"we get,h6=137.82+m*423.65\")\n", - "print(\"therefore h7=h6+6.02=143.84+m*423.65\")\n", - "print(\"Applying energy balance at closed feed water heater;\")\n", - "print(\"m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\")\n", - "print(\"so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\")\n", - "print(\"so m=0.144 kg\")\n", - "m=0.144;\n", - "h6=137.82+m*423.65;\n", - "h7=143.84+m*423.65;\n", - "print(\"steam bled for feed heating=0.144 kg/kg steam generated\")\n", - "W_net=(h2-h3)+(1-m)*(h3-h4)-(1-m)*(h7-h6)\n", - "print(\"The net power output,W_net in KJ/kg steam generated=\"),round(W_net,2)\n", - "P/(n_alternator*W_net)\n", - "print(\"mass of steam required to be generated in kg/s=\"),round(P/(n_alternator*W_net),2)\n", - "print(\"or in kg/hr\")\n", - "26.23*3600\n", - "print(\"so capacity of boiler required=94428 kg/hr\")\n", - "print(\"overall thermal efficiency=W_net/Q_add\")\n", - "Q_add=(h2-Cp*T_cond)/n_boiler\n", - "print(\"here Q_add in KJ/kg=\"),round(Q_add,2) \n", - "W_net/Q_add\n", - "print(\"overall thermal efficiency=\"),round(W_net/Q_add,2)\n", - "W_net*100/Q_add\n", - "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", - "print(\"so overall thermal efficiency=37.24%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.9;pg no: 275" - ] - }, - { - "cell_type": "code", - "execution_count": 96, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.9, Page:275 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\n", - "At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\n", - "For ideal expansion process,s2=s3\n", - "By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\n", - "actual stste at exit of first stage,h3_a in KJ/kg= 2909.88\n", - "actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K= 7.1075\n", - "for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\n", - "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", - "so x4= 0.96\n", - "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", - "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", - "actual enthalpy at exit from second stage,h4_a in KJ/kg= 2646.48\n", - "actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\n", - "so x4_a= 0.99\n", - "x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\n", - "for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x5= 0.87\n", - "h5=2270.43 KJ/kg\n", - "actual enthalpy at exit from third stage,h5_a in KJ/kg= 2345.64\n", - "Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\n", - "By heat balance on first closed feed water heater,(see schematic arrangement)\n", - "h11=hf at 6 bar=670.56 KJ\n", - "m1*h3_a+h10=m1*h11+4.18*150\n", - "(m1*2829.63)+h10=(m1*670.56)+627\n", - "h10+2159.07*m1=627\n", - "By heat balance on second closed feed water heater,(see schematic arrangement)\n", - "h7=hf at 1 bar=417.46 KJ/kg\n", - "m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\n", - "m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\n", - "m2*2467.27-m1*179.2-238.26=0\n", - "heat balance at point of mixing,\n", - "h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\n", - "neglecting pump work,h7=h8\n", - "h10=m2*417.46+(1-m1-m2)*397.1\n", - "substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\n", - "Turbine output per kg of steam generated,Wt in KJ/kg of steam generated= 780.445\n", - "Rate of steam generation required in kg/s= 19.22\n", - "in kg/hr\n", - "capacity of drain pump i.e. FP shown in layout in kg/hr= 16273.96\n", - "so capacity of drain pump=16273.96 kg/hr\n" - ] - } - ], - "source": [ - "#cal of capacity of drain pump\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.9, Page:275 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\")\n", - "P=15*10**3;#turbine output in KW\n", - "print(\"At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\")\n", - "h2=3230.9;\n", - "s2=6.9212;\n", - "print(\"For ideal expansion process,s2=s3\")\n", - "s3=s2;\n", - "print(\"By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\")\n", - "T3=190.97;\n", - "h3=2829.63;\n", - "h3_a=h2-0.8*(h2-h3)\n", - "print(\"actual stste at exit of first stage,h3_a in KJ/kg=\"),round(h3_a,2)\n", - "s3_a=7.1075;\n", - "print(\"actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K=\"),round(s3_a,4)\n", - "print(\"for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\")\n", - "s4=7.1075;\n", - "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", - "sf=1.3026;\n", - "sfg=6.0568;\n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.958;#approx.\n", - "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", - "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", - "hf=417.46;\n", - "hfg=2258.0;\n", - "h4=hf+x4*hfg\n", - "h4_a=h3_a-.8*(h3_a-h4)\n", - "print(\"actual enthalpy at exit from second stage,h4_a in KJ/kg=\"),round(h4_a,2)\n", - "print(\"actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\")\n", - "x4_a=(h4_a-hf)/hfg\n", - "print(\"so x4_a=\"),round(x4_a,2)\n", - "print(\"x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\")\n", - "s4_a=7.2806;\n", - "print(\"for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "x5=(s4_a-sf)/sfg\n", - "print(\"so x5=\"),round(x5,2)\n", - "x5=0.8735;#approx.\n", - "print(\"h5=2270.43 KJ/kg\")\n", - "h5=2270.43;\n", - "h5_a=h4_a-0.8*(h4_a-h5)\n", - "print(\"actual enthalpy at exit from third stage,h5_a in KJ/kg=\"),round(h5_a,2)\n", - "print(\"Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\")\n", - "print(\"By heat balance on first closed feed water heater,(see schematic arrangement)\")\n", - "print(\"h11=hf at 6 bar=670.56 KJ\")\n", - "h11=670.56;\n", - "print(\"m1*h3_a+h10=m1*h11+4.18*150\")\n", - "print(\"(m1*2829.63)+h10=(m1*670.56)+627\")\n", - "print(\"h10+2159.07*m1=627\")\n", - "print(\"By heat balance on second closed feed water heater,(see schematic arrangement)\")\n", - "print(\"h7=hf at 1 bar=417.46 KJ/kg\")\n", - "h7=417.46;\n", - "print(\"m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\")\n", - "print(\"m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\")\n", - "print(\"m2*2467.27-m1*179.2-238.26=0\")\n", - "print(\"heat balance at point of mixing,\")\n", - "print(\"h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\")\n", - "print(\"neglecting pump work,h7=h8\")\n", - "print(\"h10=m2*417.46+(1-m1-m2)*397.1\")\n", - "print(\"substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\")\n", - "m1=0.1293;\n", - "m2=0.1059;\n", - "Wt=(h2-h3_a)+(1-m1)*(h3_a-h4_a)+(1-m1-m2)*(h4_a-h5_a)\n", - "print(\"Turbine output per kg of steam generated,Wt in KJ/kg of steam generated=\"),round(Wt,3)\n", - "P/Wt\n", - "print(\"Rate of steam generation required in kg/s=\"),round(P/Wt,2)\n", - "print(\"in kg/hr\")\n", - "P*3600/Wt\n", - "(m1+m2)*69192\n", - "print(\"capacity of drain pump i.e. FP shown in layout in kg/hr=\"),round((m1+m2)*69192,2)\n", - "print(\"so capacity of drain pump=16273.96 kg/hr\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.10;pg no: 277" - ] - }, - { - "cell_type": "code", - "execution_count": 97, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.10, Page:277 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\n", - "at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\n", - "By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\n", - "actual enthapy at 3_a,h3_a in KJ/kg= 3097.0\n", - "enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\n", - "for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\n", - "s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x6= 0.83\n", - "h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "for actual expansion process in LP turbine.\n", - "h6_a=h4-0.85*(h4-h6) in KJ/kg 2319.4\n", - "Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\n", - "s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\n", - "from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\n", - "so x5= 1.0\n", - "h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\n", - "from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\n", - "actual enthalpy,h5_a in KJ/kg= 2790.16\n", - "enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\n", - "specific volume at inlet of CEP,v7=0.001008 m^3/kg\n", - "enthalpy at inlet of CEP,h7=168.79 KJ/kg\n", - "for pumping process 7-8,h8 in KJ/kg= 169.15\n", - "Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\n", - "m*h5+(1-m)*h8=h9\n", - "so m in kg /kg of steam generated= 0.33\n", - "For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\n", - "h1= in KJ/kg= 1015.59\n", - "Net work per kg of steam generated,W_net=in KJ/kg steam generated= 938.83\n", - "heat added per kg of steam generated,q_add in KJ/kg of steam generated= 2405.41\n", - "Thermal efficiency,n= 0.39\n", - "in percentage= 39.03\n", - "so thermal efficiency=39.03%%\n", - "NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\n" - ] - } - ], - "source": [ - "#cal of cycle efficiency\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.10, Page:277 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\")\n", - "print(\"at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\")\n", - "h2=3287.1;\n", - "s2=6.6327;\n", - "print(\"By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\")\n", - "h3=3049.48;\n", - "h3_a=h2-0.80*(h2-h3)\n", - "print(\"actual enthapy at 3_a,h3_a in KJ/kg=\"),round(h3_a,2)\n", - "print(\"enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\")\n", - "h4=3230.9;\n", - "s4=6.9212;\n", - "print(\"for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\")\n", - "s6=s4;\n", - "print(\"s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "x6=(s6-sf)/sfg\n", - "print(\"so x6=\"),round(x6,2)\n", - "x6=0.827;#approx.\n", - "print(\"h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0;\n", - "h6=hf+x6*hfg\n", - "print(\"for actual expansion process in LP turbine.\")\n", - "h6_a=h4-0.85*(h4-h6)\n", - "print(\"h6_a=h4-0.85*(h4-h6) in KJ/kg\"),round(h6_a,2)\n", - "print(\"Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\")\n", - "p5=3.61;\n", - "s5=s4;\n", - "print(\"s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\")\n", - "print(\"from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\")\n", - "sf=1.7391;\n", - "sfg=5.1908;\n", - "x5=(s5-sf)/sfg\n", - "print(\"so x5=\"),round(x5,2)\n", - "x5=0.99;#approx.\n", - "print(\"h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\")\n", - "print(\"from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\")\n", - "hf=589.13;\n", - "hfg=2144.7;\n", - "h5=hf+x5*hfg\n", - "h5_a=h4-0.85*(h4-h5)\n", - "print(\"actual enthalpy,h5_a in KJ/kg=\"),round(h5_a,2)\n", - "print(\"enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\")\n", - "h9=1008.42;\n", - "print(\"specific volume at inlet of CEP,v7=0.001008 m^3/kg\")\n", - "v7=0.001008;\n", - "print(\"enthalpy at inlet of CEP,h7=168.79 KJ/kg\")\n", - "h7=168.79;\n", - "h8=h7+v7*(3.61-0.075)*10**2\n", - "print(\"for pumping process 7-8,h8 in KJ/kg=\"),round(h8,2)\n", - "print(\"Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\")\n", - "print(\"m*h5+(1-m)*h8=h9\")\n", - "m=(h9-h8)/(h5-h8)\n", - "print(\"so m in kg /kg of steam generated=\"),round(m,2)\n", - "print(\"For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\")\n", - "v9=0.00108;\n", - "h1=h9+v9*(70-3.61)*10**2\n", - "print(\"h1= in KJ/kg=\"),round(h1,2) \n", - "W_net=(h2-h3_a)+(h4-h5_a)+(1-m)*(h5_a-h6_a)-((1-m)*(h8-h7)+(h1-h9))\n", - "print(\"Net work per kg of steam generated,W_net=in KJ/kg steam generated=\"),round(W_net,2)\n", - "q_add=(h2-h1)+(h4-h3_a)\n", - "print(\"heat added per kg of steam generated,q_add in KJ/kg of steam generated=\"),round(q_add,2)\n", - "n=W_net/q_add\n", - "print(\"Thermal efficiency,n=\"),round(n,2)\n", - "n=n*100\n", - "print(\"in percentage=\"),round(n,2)\n", - "print(\"so thermal efficiency=39.03%%\")\n", - "print(\"NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.11;pg no: 279" - ] - }, - { - "cell_type": "code", - "execution_count": 98, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.11, Page:279 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\n", - "Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\n", - "for isentropic expansion 2-3-4-5,s2=s3=s4=s5\n", - "Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\n", - "s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\n", - "so x3=(s3-sf)/sfg\n", - "from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\n", - "h3=hf+x3*hfg in KJ/kg\n", - "from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\n", - "s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\n", - "so x4=(s4-sf)/sfg\n", - "from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\n", - "so h4=hf+x4*hfg in KJ/kg\n", - "from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\n", - "s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\n", - "so x5=(s5-sf)/sfg\n", - "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "h5=hf+x5*hfg in KJ/kg\n", - "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", - "h6=hf at 0.05 bar=137.82 KJ/kg\n", - "v6=vf at 0.05 bar=0.001005 m^3/kg\n", - "h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\n", - "h8=hf at 1.5 bar=467.11 KJ/kg\n", - "v8=0.001053 m^3/kg=vf at 1.5 bar\n", - "h9=h8+v8*(150-1.5)*10^2 in KJ/kg\n", - "h10=hf at 150 bar=1610.5 KJ/kg\n", - "v10=0.001658 m^3/kg=vf at 150 bar\n", - "h12=h10+v10*(150-10)*10^2 in KJ/kg\n", - "Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\n", - "Heat balance on closed feed water heater yields,\n", - "m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\n", - "so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\n", - "heat balance on open feed water can be given as under,\n", - "m2*h4+(1-m1-m2)*h7=(1-m1)*h8\n", - "so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\n", - "for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\n", - "For mixing after closed feed water heater,\n", - "h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\n", - "Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\n", - "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\n", - "heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\n", - "cycle thermal efficiency,n=W_net/q_add 0.48\n", - "in percentage 47.59\n", - "Net power developed in KW=1219*300 in KW 365700.0\n", - "cycle thermal efficiency=47.6%\n", - "Net power developed=365700 KW\n" - ] - } - ], - "source": [ - "#cal of cycle thermal efficiency,Net power developed\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.11, Page:279 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\")\n", - "print(\"Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\")\n", - "h2=3308.6;\n", - "s2=6.3443;\n", - "print(\"for isentropic expansion 2-3-4-5,s2=s3=s4=s5\")\n", - "s3=s2;\n", - "s4=s3;\n", - "s5=s4;\n", - "print(\"Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\")\n", - "print(\"s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\")\n", - "print(\"so x3=(s3-sf)/sfg\")\n", - "print(\"from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\")\n", - "sf=2.1387;\n", - "sfg=4.4478;\n", - "x3=(s3-sf)/sfg\n", - "x3=0.945;#approx.\n", - "print(\"h3=hf+x3*hfg in KJ/kg\")\n", - "print(\"from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\")\n", - "hf=762.81;\n", - "hfg=2015.3;\n", - "h3=hf+x3*hfg\n", - "print(\"s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\")\n", - "print(\"so x4=(s4-sf)/sfg\")\n", - "print(\"from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\")\n", - "sf=1.4336;\n", - "sfg=5.7897;\n", - "x4=(s4-sf)/sfg\n", - "x4=0.848;#approx.\n", - "print(\"so h4=hf+x4*hfg in KJ/kg\")\n", - "print(\"from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\")\n", - "hf=467.11;\n", - "hfg=2226.5;\n", - "h4=hf+x4*hfg\n", - "print(\"s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", - "print(\"so x5=(s5-sf)/sfg\")\n", - "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "x5=(s5-sf)/sfg\n", - "x5=0.739;#approx.\n", - "print(\"h5=hf+x5*hfg in KJ/kg\")\n", - "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "h5=hf+x5*hfg \n", - "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", - "h6=137.82;\n", - "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", - "v6=0.001005;\n", - "print(\"h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\")\n", - "h7=h6+v6*(1.5-0.05)*10**2\n", - "print(\"h8=hf at 1.5 bar=467.11 KJ/kg\")\n", - "h8=467.11; \n", - "print(\"v8=0.001053 m^3/kg=vf at 1.5 bar\")\n", - "v8=0.001053;\n", - "print(\"h9=h8+v8*(150-1.5)*10^2 in KJ/kg\")\n", - "h9=h8+v8*(150-1.5)*10**2\n", - "print(\"h10=hf at 150 bar=1610.5 KJ/kg\")\n", - "h10=1610.5; \n", - "print(\"v10=0.001658 m^3/kg=vf at 150 bar\")\n", - "v10=0.001658;\n", - "print(\"h12=h10+v10*(150-10)*10^2 in KJ/kg\")\n", - "h12=h10+v10*(150-10)*10**2\n", - "print(\"Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\")\n", - "print(\"Heat balance on closed feed water heater yields,\")\n", - "print(\"m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\")\n", - "print(\"so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\")\n", - "m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)\n", - "print(\"heat balance on open feed water can be given as under,\")\n", - "print(\"m2*h4+(1-m1-m2)*h7=(1-m1)*h8\")\n", - "print(\"so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\")\n", - "m2=((1-m1)*(h8-h7))/(h4-h7)\n", - "print(\"for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\")\n", - "print(\"For mixing after closed feed water heater,\")\n", - "print(\"h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\")\n", - "h1=(4.18*150)*(1-m1)+m1*h12\n", - "print(\"Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\")\n", - "print(\"W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\")\n", - "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-((1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10)))\n", - "print(\"heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\")\n", - "q_add=(h2-h1)\n", - "n=W_net/q_add\n", - "print(\"cycle thermal efficiency,n=W_net/q_add\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"Net power developed in KW=1219*300 in KW\"),round(1219*300,2)\n", - "print(\"cycle thermal efficiency=47.6%\")\n", - "print(\"Net power developed=365700 KW\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.12;pg no: 282" - ] - }, - { - "cell_type": "code", - "execution_count": 99, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.12, Page:282 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\n", - "At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", - "For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\n", - "state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\n", - "since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\n", - "At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", - "At state 3,h3=2930.57 KJ/kg\n", - "At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\n", - "At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\n", - "From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\n", - "Let dryness fraction at state 5_a be x5,\n", - "s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x5_a=(s5_a-sf)/sfg\n", - "h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\n", - "from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\n", - "Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\n", - "m1_a*h3+h9=m1*h10+4.18*200\n", - "so m1_a=(4.18*200-h9)/(h3-h10) in kg\n", - "Applying heat balance at open feed water heater,\n", - "m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\n", - "so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\n", - "Net work per kg steam generated\n", - "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\n", - "Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\n", - "Thermal efficiency,n= 0.45\n", - "in percentage 45.04\n", - "% increase in thermal efficiency due to reheating= 0.56\n", - "so thermal efficiency of reheat cycle=45.03%\n", - "% increase in efficiency due to reheating=0.56%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,steam generation rate\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.12, Page:282 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\")\n", - "P=100*10**3;#net power output in KW\n", - "print(\"At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", - "h2=3373.7;\n", - "s2=6.5966;\n", - "print(\"For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\")\n", - "s3=s2;\n", - "s4=s3;\n", - "s5=s4;\n", - "print(\"state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\")\n", - "T3=261.6;\n", - "h3=2930.57;\n", - "print(\"since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\")\n", - "print(\"At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", - "h2=3373.7;\n", - "s2=6.5966;\n", - "print(\"At state 3,h3=2930.57 KJ/kg\")\n", - "h3=2930.57;\n", - "print(\"At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\")\n", - "h3_a=3247.6;\n", - "s3_a=7.1271;\n", - "print(\"At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\")\n", - "s4_a=s3_a;\n", - "s5_a=s4_a;\n", - "print(\"From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\")\n", - "h4_a=2841.02;\n", - "print(\"Let dryness fraction at state 5_a be x5,\")\n", - "print(\"s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "print(\"so x5_a=(s5_a-sf)/sfg\")\n", - "x5_a=(s5_a-sf)/sfg\n", - "x5_a=0.853;#approx.\n", - "print(\"h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "h5_a=hf+x5_a*hfg\n", - "print(\"Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\")\n", - "print(\"m1_a*h3+h9=m1*h10+4.18*200\")\n", - "print(\"so m1_a=(4.18*200-h9)/(h3-h10) in kg\")\n", - "m1_a=(4.18*200-h9)/(h3-h10)\n", - "m1_a=0.114;#approx.\n", - "print(\"Applying heat balance at open feed water heater,\")\n", - "print(\"m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\")\n", - "print(\"so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\")\n", - "m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7)\n", - "m2_a=0.131;#approx.\n", - "print(\"Net work per kg steam generated\")\n", - "print(\"w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\")\n", - "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-((1-m1_a-m2_a)*(h7-h6)+(h9-h8))\n", - "print(\"Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\")\n", - "q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)\n", - "n=w_net/q_add\n", - "print(\"Thermal efficiency,n=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"% increase in thermal efficiency due to reheating=\"),round((0.4503-0.4478)*100/0.4478,2)\n", - "print(\"so thermal efficiency of reheat cycle=45.03%\")\n", - "print(\"% increase in efficiency due to reheating=0.56%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.13;pg no: 286" - ] - }, - { - "cell_type": "code", - "execution_count": 100, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.13, Page:286 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\n", - "For mercury cycle,\n", - "insentropic heat drop=349-234.5 in KJ/kg Hg\n", - "actual heat drop=0.85*114.5 in KJ/kg Hg\n", - "Heat rejected in condenser=(349-97.325-35)in KJ/kg\n", - "heat added in boiler=349-35 in KJ/kg\n", - "For steam cycle,\n", - "Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\n", - "Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\n", - "Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\n", - "Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\n", - "Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\n", - "for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\n", - "state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\n", - "state 4 lies in wet region,say with dryness fraction x4\n", - "s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\n", - "so x4=(s4-sf)/sfg\n", - "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", - "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", - "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", - "Let state 5 lie in wet region with dryness fraction x5,\n", - "s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\n", - "so x5=(s5-sf)/sfg\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "h5=hf+x5*hfg in KJ/kg\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\n", - "h7=h6+v6*(1-0.075)*10^2 in KJ/kg\n", - "from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\n", - "h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\n", - "Applying heat balance on CFWH1,T1=150oc and also T15=150oc\n", - "m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\n", - "(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\n", - "Applying heat balance on CFEH2,T11=90oc\n", - "m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\n", - "(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\n", - "Heat balance at mixing between CFWH1 and CFWH2,\n", - "(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\n", - "376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\n", - "For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\n", - "from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\n", - "solving above equations,we get\n", - "m1=0.102 kg per kg steam generated\n", - "m2=0.073 kg per kg steam generated\n", - "pump work in process 13-14,h14-h13=v13*(40-8)*10^2\n", - "so h14-h13 in KJ/kg\n", - "Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\n", - "net work per kg of steam,w_net=w_mercury+w_steam\n", - "w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\n", - "thermal efficiency of binary vapour cycle=w_net/q_add 0.55\n", - "in percentage 55.36\n", - "so thermal efficiency=55.36%\n", - "NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.13, Page:286 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\")\n", - "print(\"For mercury cycle,\")\n", - "print(\"insentropic heat drop=349-234.5 in KJ/kg Hg\")\n", - "349-234.5\n", - "print(\"actual heat drop=0.85*114.5 in KJ/kg Hg\")\n", - "0.85*114.5\n", - "print(\"Heat rejected in condenser=(349-97.325-35)in KJ/kg\")\n", - "(349-97.325-35)\n", - "print(\"heat added in boiler=349-35 in KJ/kg\")\n", - "349-35\n", - "print(\"For steam cycle,\")\n", - "print(\"Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\")\n", - "h=2767.13;\n", - "print(\"Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\")\n", - "h2=3330.3;\n", - "print(\"Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\")\n", - "s2=6.9363;\n", - "print(\"Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\")\n", - "h-4.18*150\n", - "print(\"Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\")\n", - "2140.13/216.675\n", - "print(\"for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\")\n", - "s3=s2;\n", - "s4=s3;\n", - "s5=s4;\n", - "print(\"state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\")\n", - "h3=2899.23;\n", - "print(\"state 4 lies in wet region,say with dryness fraction x4\")\n", - "print(\"s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\")\n", - "print(\"so x4=(s4-sf)/sfg\")\n", - "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", - "sf=1.3026;\n", - "sfg=6.0568;\n", - "x4=(s4-sf)/sfg\n", - "x4=0.93;#approx.\n", - "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", - "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", - "hf=417.46;\n", - "hfg=2258.0;\n", - "h4=hf+x4*hfg\n", - "print(\"Let state 5 lie in wet region with dryness fraction x5,\")\n", - "print(\"s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", - "print(\"so x5=(s5-sf)/sfg\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "x5=(s5-sf)/sfg\n", - "x5=0.828;#approx.\n", - "print(\"h5=hf+x5*hfg in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0;\n", - "h5=hf+x5*hfg\n", - "print(\"Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\")\n", - "print(\"h7=h6+v6*(1-0.075)*10^2 in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\")\n", - "h6=168.79;\n", - "v6=0.001008;\n", - "h7=h6+v6*(1-0.075)*10**2\n", - "print(\"h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\")\n", - "h9=417.46;\n", - "h13=721.11;\n", - "print(\"Applying heat balance on CFWH1,T1=150oc and also T15=150oc\")\n", - "T1=150;\n", - "T15=150;\n", - "print(\"m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\")\n", - "print(\"(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\")\n", - "print(\"Applying heat balance on CFEH2,T11=90oc\")\n", - "T11=90;\n", - "print(\"m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\")\n", - "print(\"(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\")\n", - "print(\"Heat balance at mixing between CFWH1 and CFWH2,\")\n", - "print(\"(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\")\n", - "print(\"376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\")\n", - "print(\"For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\")\n", - "print(\"from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\")\n", - "h9=417.46;\n", - "v9=0.001043;\n", - "h10=h9+v9*(8-1)*10**2 \n", - "print(\"solving above equations,we get\")\n", - "print(\"m1=0.102 kg per kg steam generated\")\n", - "print(\"m2=0.073 kg per kg steam generated\")\n", - "m1=0.102;\n", - "m2=0.073;\n", - "print(\"pump work in process 13-14,h14-h13=v13*(40-8)*10^2\")\n", - "print(\"so h14-h13 in KJ/kg\")\n", - "v13=0.001252;\n", - "v13*(40-8)*10**2\n", - "print(\"Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\")\n", - "q_add=(9.88*314)+(3330.3-2767.13)\n", - "print(\"net work per kg of steam,w_net=w_mercury+w_steam\")\n", - "print(\"w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\")\n", - "w_net=(9.88*97.325)+((h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h7-h6)-m2*(h10-h9)-m1*4.006)\n", - "print(\"thermal efficiency of binary vapour cycle=w_net/q_add\"),round(w_net/q_add,2)\n", - "print(\"in percentage\"),round(w_net*100/q_add,2)\n", - "print(\"so thermal efficiency=55.36%\")\n", - "print(\"NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.14;pg no: 288" - ] - }, - { - "cell_type": "code", - "execution_count": 101, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.14, Page:288 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\n", - "This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\n", - "For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\n", - "ideally, s2=s1=6.7664 KJ/kg K\n", - "s2=sf at 0.075 bar +x3* sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x3=(s2-sf)/sfg\n", - "h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\n", - "for LP:at inlet of LP steam\n", - "h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\n", - "Enthalpy at exit,h_3LP=2222.34 KJ/kg\n", - "actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\n", - "HP steam consumption at full load=P*0.7457/h_HP in kg/s\n", - "HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\n", - "LP steam consumption at full load=P*0.7457/h_LP in kg/s\n", - "LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\n", - "The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\n", - "or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\n", - "Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\n", - "x=load,hp\n", - "y_HP=m_HP*x+C_HP\n", - "0.254=m_HP*0+C_HP\n", - "so C_HP=0.254\n", - "2.54=m_HP*2500+C_HP\n", - "so m_HP=(2.54-C_HP)/2500\n", - "so y_HP=9.144*10^-4*x_HP+0.254\n", - "Willans line for LP:y_LP=m_LP*x_LP+C_LP\n", - "0.481=m_LP*0+C_LP\n", - "so C_LP=0.481\n", - "4.81=m_LP*2500+C_LP\n", - "so m_LP=(4.81-C_LP)/2500\n", - "so y_LP=1.732*10^-3*x_LP+0.481\n", - "Total output(load) from mixed turbine,x=x_HP+x_LP\n", - "For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\n", - "from y_LP=1.732*10^-3*x_LP+0.481,\n", - "x_LP=(y_LP-0.481)/1.732*10^-3\n", - "since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\n", - "from y_HP=9.144*10^-4*x_HP+C_HP in kg/s 0.63\n", - "so HP steam requirement=0.63 kg/s\n" - ] - } - ], - "source": [ - "#cal of HP steam required\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.14, Page:288 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\")\n", - "n=0.8;#efficiency of both HP and LP turbine\n", - "P=2500;#output in hp\n", - "print(\"This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\")\n", - "print(\"For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\")\n", - "h1=3023.5;\n", - "s1=6.7664;\n", - "print(\"ideally, s2=s1=6.7664 KJ/kg K\")\n", - "s2=s1;\n", - "print(\"s2=sf at 0.075 bar +x3* sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "print(\"so x3=(s2-sf)/sfg\")\n", - "x3=(s2-sf)/sfg\n", - "x3=0.806;#approx.\n", - "print(\"h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0; \n", - "h_3HP=hf+x3*hfg\n", - "print(\"actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\")\n", - "h_HP=(h1-h_3HP)*n\n", - "print(\"for LP:at inlet of LP steam\")\n", - "print(\"h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\")\n", - "h2=2706.7;\n", - "s2=7.1271;\n", - "print(\"Enthalpy at exit,h_3LP=2222.34 KJ/kg\")\n", - "h_3LP=2222.34;\n", - "print(\"actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\")\n", - "h_LP=(h2-h_3LP)*n\n", - "print(\"HP steam consumption at full load=P*0.7457/h_HP in kg/s\")\n", - "P*0.7457/h_HP\n", - "print(\"HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\")\n", - "0.10*(P*0.7457/h_HP)\n", - "print(\"LP steam consumption at full load=P*0.7457/h_LP in kg/s\")\n", - "P*0.7457/h_LP\n", - "print(\"LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\")\n", - "0.10*(P*0.7457/h_LP)\n", - "print(\"The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\")\n", - "print(\"or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\")\n", - "print(\"Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\")\n", - "print(\"x=load,hp\")\n", - "print(\"y_HP=m_HP*x+C_HP\")\n", - "print(\"0.254=m_HP*0+C_HP\")\n", - "print(\"so C_HP=0.254\")\n", - "C_HP=0.254;\n", - "print(\"2.54=m_HP*2500+C_HP\")\n", - "print(\"so m_HP=(2.54-C_HP)/2500\")\n", - "m_HP=(2.54-C_HP)/2500\n", - "print(\"so y_HP=9.144*10^-4*x_HP+0.254\")\n", - "print(\"Willans line for LP:y_LP=m_LP*x_LP+C_LP\")\n", - "print(\"0.481=m_LP*0+C_LP\")\n", - "print(\"so C_LP=0.481\")\n", - "C_LP=0.481;\n", - "print(\"4.81=m_LP*2500+C_LP\")\n", - "print(\"so m_LP=(4.81-C_LP)/2500\")\n", - "m_LP=(4.81-C_LP)/2500\n", - "print(\"so y_LP=1.732*10^-3*x_LP+0.481\")\n", - "print(\"Total output(load) from mixed turbine,x=x_HP+x_LP\")\n", - "print(\"For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\")\n", - "y_LP=1.5;\n", - "print(\"from y_LP=1.732*10^-3*x_LP+0.481,\")\n", - "print(\"x_LP=(y_LP-0.481)/1.732*10^-3\")\n", - "x_LP=(y_LP-0.481)/(1.732*10**-3)\n", - "print(\"since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\")\n", - "x_HP=411.66;\n", - "y_HP=9.144*10**-4*x_HP+C_HP\n", - "print(\"from y_HP=9.144*10^-4*x_HP+C_HP in kg/s\"),round(y_HP,2)\n", - "print(\"so HP steam requirement=0.63 kg/s\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.15;pg no: 289" - ] - }, - { - "cell_type": "code", - "execution_count": 102, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.15, Page:289 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\n", - "Let us carry out analysis for 1 kg of steam generated in boiler.\n", - "Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\n", - "state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\n", - "Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\n", - "so x3= 0.86\n", - "from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\n", - "h3=2404.94 KJ/kg\n", - "If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\n", - "mass of moisture retained in separator(m)=(1-x3)*0.5 kg\n", - "Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\n", - "Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\n", - "Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\n", - "(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\n", - "so T in degree celcius= 68.425\n", - "so temperature of water leaving hotwell=68.425 degree celcius\n", - "Applying heat balanced on trap\n", - "0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\n", - "so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\n", - "from steam tables,at 2 bar,hf=504.70 KJ/kg\n", - "Therefore,heat transferred in process heater in KJ/kg steam generated= 1023.172\n", - "so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\n", - "For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\n", - "Let dryness fraction be x10\n", - "s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x10=(s10-sf)/sfg\n", - "h10=hf at 0.075 bar+x10*hfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "so h10=hf+x10*hfg in KJ/kg \n", - "net work output,neglecting pump work per kg of steam generated,\n", - "w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\n", - "Heat added in boiler per kg steam generated,q_add in KJ/kg= 2674.68\n", - "thermal efficiency=w_net/q_add 0.28\n", - "in percentage 27.59\n", - "so Thermal efficiency=27.58%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,heat transferred and temperature\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.15, Page:289 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\")\n", - "print(\"Let us carry out analysis for 1 kg of steam generated in boiler.\")\n", - "print(\"Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\")\n", - "h2=2960.7;\n", - "s2=6.3615;\n", - "print(\"state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\")\n", - "s3=s2;\n", - "print(\"Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\")\n", - "sf=1.5301;\n", - "sfg=5.5970;\n", - "x3=(s3-sf)/sfg\n", - "print(\"so x3=\"),round(x3,2)\n", - "print(\"from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\")\n", - "x3=0.863;#approx.\n", - "print(\"h3=2404.94 KJ/kg\")\n", - "h3=2404.94;\n", - "print(\"If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\")\n", - "print(\"mass of moisture retained in separator(m)=(1-x3)*0.5 kg\")\n", - "m=(1-x3)*0.5\n", - "print(\"Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\")\n", - "m_LP=0.5-m\n", - "print(\"Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\")\n", - "print(\"Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\")\n", - "print(\"(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\")\n", - "T=((0.5685*4.18*90)+(0.4315*4.18*40))/4.18\n", - "print(\"so T in degree celcius=\"),round(T,3)\n", - "print(\"so temperature of water leaving hotwell=68.425 degree celcius\")\n", - "print(\"Applying heat balanced on trap\")\n", - "print(\"0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\")\n", - "print(\"so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\")\n", - "print(\"from steam tables,at 2 bar,hf=504.70 KJ/kg\")\n", - "hf=504.70;\n", - "h7=((0.5685*4.18*90)-(0.0685*hf))/0.5\n", - "print(\"Therefore,heat transferred in process heater in KJ/kg steam generated=\"),round(0.5*(h3-h7),3)\n", - "print(\"so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\")\n", - "print(\"For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\")\n", - "s10=s3;\n", - "print(\"Let dryness fraction be x10\")\n", - "print(\"s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "print(\"so x10=(s10-sf)/sfg\")\n", - "x10=(s10-sf)/sfg\n", - "x10=0.754;#approx.\n", - "print(\"h10=hf at 0.075 bar+x10*hfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0;\n", - "print(\"so h10=hf+x10*hfg in KJ/kg \")\n", - "h10=hf+x10*hfg \n", - "print(\"net work output,neglecting pump work per kg of steam generated,\")\n", - "print(\"w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\")\n", - "w_net=(h2-h3)*1+0.4315*(h3-h10) \n", - "q_add=(h2-4.18*68.425)\n", - "print(\"Heat added in boiler per kg steam generated,q_add in KJ/kg=\"),round(q_add,2)\n", - "w_net/q_add\n", - "print(\"thermal efficiency=w_net/q_add\"),round(w_net/q_add,2)\n", - "print(\"in percentage\"),round(w_net*100/q_add,2)\n", - "print(\"so Thermal efficiency=27.58%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.16;pg no: 291" - ] - }, - { - "cell_type": "code", - "execution_count": 103, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.16, Page:291 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\n", - "from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\n", - "Assuming isentropic expansion in nozzle,s1=s2=6.9486\n", - "Letdryness fraction at state 2,x2=0.864\n", - "s2=sf at 0.2 bar+x2*sfg at 0.2 bar\n", - "from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\n", - "so x2= 0.86\n", - "hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\n", - "from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\n", - "considering pump work to be of isentropic type,deltah_34=v3*deltap_34\n", - "from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\n", - "or deltah_34 in KJ/kg= 7.1\n", - "pump work,Wp in KJ/kg= 7.1\n", - "turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\n", - "net work(W_net)=Wt-Wp in KJ/kg\n", - "power produced(P)=mass flow rate*W_net in KJ/s\n", - "so net power=43.22 MW\n", - "heat supplied in boiler(Q)=(h1-h4) in KJ/kg\n", - "enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\n", - "total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s 114534.05\n", - "thermal efficiency=net work/heat supplied=W_net/Q 0.38\n", - "in percentage 37.73\n", - "so thermal efficiency=37.73%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,net power\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.16, Page:291 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\")\n", - "m=35;#mass flow rate in kg/s\n", - "print(\"from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\")\n", - "h1=3530.9;\n", - "s1=6.9486;\n", - "print(\"Assuming isentropic expansion in nozzle,s1=s2=6.9486\")\n", - "s2=s1;\n", - "print(\"Letdryness fraction at state 2,x2=0.864\")\n", - "print(\"s2=sf at 0.2 bar+x2*sfg at 0.2 bar\")\n", - "print(\"from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\")\n", - "sf=0.8320;\n", - "sfg=7.0766;\n", - "x2=(s2-sf)/sfg\n", - "print(\"so x2=\"),round(x2,2)\n", - "x2=0.864;#approx.\n", - "print(\"hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\")\n", - "print(\"from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\")\n", - "hf=251.4;\n", - "hfg=2358.3;\n", - "h2=hf+x2*hfg\n", - "print(\"considering pump work to be of isentropic type,deltah_34=v3*deltap_34\")\n", - "print(\"from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\")\n", - "v3=0.001017;\n", - "p3=70;#;pressure of steam entering turbine in bar\n", - "p4=0.20;#condenser pressure in bar\n", - "deltah_34=v3*(p3-p4)*100\n", - "print(\"or deltah_34 in KJ/kg=\"),round(deltah_34,2)\n", - "Wp=deltah_34\n", - "print(\"pump work,Wp in KJ/kg=\"),round(Wp,2)\n", - "print(\"turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\")\n", - "Wt=(h1-h2)\n", - "print(\"net work(W_net)=Wt-Wp in KJ/kg\")\n", - "W_net=Wt-Wp\n", - "print(\"power produced(P)=mass flow rate*W_net in KJ/s\")\n", - "P=m*W_net\n", - "print(\"so net power=43.22 MW\")\n", - "print(\"heat supplied in boiler(Q)=(h1-h4) in KJ/kg\")\n", - "print(\"enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\")\n", - "h3=hf;\n", - "h4=h3+deltah_34 \n", - "Q=m*(h1-h4)\n", - "print(\"total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s\"),round(Q,2)\n", - "print(\"thermal efficiency=net work/heat supplied=W_net/Q\"),round(P/Q,2)\n", - "print(\"in percentage\"),round(P*100/Q,2)\n", - "print(\"so thermal efficiency=37.73%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.17;pg no: 292" - ] - }, - { - "cell_type": "code", - "execution_count": 104, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.1, Page:292 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 17\n", - "from steam tables,h1=3625.3 KJ/s,s1=6.9029 KJ/kg K\n", - "due to isentropic expansion,s1=s2=s3=6.9029 KJ/kg K\n", - "at state 2,i.e at pressure of 2 MPa and entropy 6.9029 KJ/kg K\n", - "by interpolating state for s2 between 2 MPa,300 degree celcius and 2 MPa,350 degree celcius from steam tables,\n", - "h2=3105.08 KJ/kg \n", - "for state 3,i.e at pressure of 0.01 MPa entropy,s3 lies in wet region as s3In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,mass of steam\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.18, Page:294 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 18\")\n", - "W_net=50*10**3;#net output of turbine in KW\n", - "print(\"from steam tables,at inlet to first stage of turbine,h1=h at 100 bar,500oc=3373.7 KJ/kg,s1=s at 100 bar,500oc=6.5966 KJ/kg\")\n", - "h1=3373.7;\n", - "s1=6.5966;\n", - "print(\"Due to isentropic expansion,s1=s6=s2 and s3=s8=s4\")\n", - "s2=s1;\n", - "s6=s2;\n", - "print(\"State at 6 i.e bleed state from HP turbine,temperature by interpolation from steam table =261.6oc.\")\n", - "print(\"At inlet to second stage of turbine,h6=2930.572 KJ/kg\")\n", - "h6=2930.572;\n", - "print(\"h3=h at 10 bar,500oc=3478.5 KJ/kg,s3=s at 10 bar,500oc=7.7622 KJ/kg K\")\n", - "h3=3478.5;\n", - "s3=7.7622;\n", - "s4=s3;\n", - "s8=s4;\n", - "print(\"At exit from first stage of turbine i.e. at 10 bar and entropy of 6.5966 KJ/kg K,Temperature by interpolation from steam table at 10 bar and entropy of 6.5966 KJ/kg K\")\n", - "print(\"T2=181.8oc,h2=2782.8 KJ/kg\")\n", - "T2=181.8;\n", - "h2=2782.8;\n", - "print(\"state at 8,i.e bleed state from second stage of expansion,i.e at 4 bar and entropy of 7.7622 KJ/kg K,Temperature by interpolation from steam table,T8=358.98oc=359oc\")\n", - "T8=359;\n", - "print(\"h8=3188.7 KJ/kg\")\n", - "h8=3188.7;\n", - "print(\"state at 4 i.e. at condenser pressure of 0.1 bar and entropy of 7.7622 KJ/kg K,the state lies in wet region.So let the dryness fraction be x4.\")\n", - "print(\"s4=sf at 0.1 bar+x4*sfg at 0.1 bar\")\n", - "print(\"from steam tables,at 0.1 bar,sf=0.6493 KJ/kg K,sfg=7.5009 KJ/kg K\")\n", - "sf=0.6493;\n", - "sfg=7.5009; \n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.95;#approx.\n", - "print(\"h4=hf at 0.1 bar+x4*hfg at 0.1 bar in KJ/kg \")\n", - "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,hfg=2392.8 KJ/kg\")\n", - "hf=191.83;\n", - "hfg=2392.8;\n", - "h4=hf+x4*hfg\n", - "print(\"given,h4=2464.99 KJ/kg,h11=856.8 KJ/kg,h9=hf at 4 bar=604.74 KJ/kg\")\n", - "h4=2464.99;\n", - "h11=856.8;\n", - "h9=604.74;\n", - "print(\"considering pump work,the net output can be given as,\")\n", - "print(\"W_net=W_HPT+W_LPT-(W_CEP+W_FP)\")\n", - "print(\"where,W_HPT={(h1-h6)+(1-m6)*(h6-h2)}per kg of steam from boiler.\")\n", - "print(\"W_LPT={(1-m6)+(h3-h8)*(1-m6-m8)*(h8-h4)}per kg of steam from boiler.\")\n", - "print(\"for closed feed water heater,energy balance yields;\")\n", - "print(\"m6*h6+h10=m6*h7+h11\")\n", - "print(\"assuming condensate leaving closed feed water heater to be saturated liquid,\")\n", - "print(\"h7=hf at 20 bar=908.79 KJ/kg\")\n", - "h7=908.79; \n", - "print(\"due to throttline,h7=h7_a=908.79 KJ/kg\")\n", - "h7_a=h7;\n", - "print(\"for open feed water heater,energy balance yields,\")\n", - "print(\"m6*h7_a+m8*h8+(1-m6-m8)*h5=h9\")\n", - "print(\"for condensate extraction pump,h5-h4_a=v4_a*deltap\")\n", - "print(\"h5-hf at 0.1 bar=vf at 0.1 bar*(4-0.1)*10^2 \")\n", - "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,vf=0.001010 m^3/kg\")\n", - "hf=191.83;\n", - "vf=0.001010; \n", - "h5=hf+vf*(4-0.1)*10**2\n", - "print(\"so h5 in KJ/kg=\"),round(h5,2)\n", - "print(\"for feed pump,h10-h9=v9*deltap\")\n", - "print(\"h10=h9+vf at 4 bar*(100-4)*10^2 in KJ/kg\")\n", - "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,vf=0.001084 m^3/kg \")\n", - "hf=604.74;\n", - "vf=0.001084;\n", - "h10=h9+vf*(100-4)*10**2\n", - "print(\"substituting in energy balance upon closed feed water heater,\")\n", - "m6=(h11-h10)/(h6-h7)\n", - "print(\"m6 in kg per kg of steam from boiler=\"),round(m6,3)\n", - "print(\"substituting in energy balance upon feed water heater,\")\n", - "m8=(h9-m6*h7_a+m6*h5-h5)/(h8-h5)\n", - "print(\"m8 in kg per kg of steam from boiler=\"),round(m8,3)\n", - "print(\"Let the mass of steam entering first stage of turbine be m kg,then\")\n", - "{(h1-h6)+(1-m6)*(h6-h2)}\n", - "print(\"W_HPT=m*{(h1-h6)+(1-m6)*(h6-h2)}\")\n", - "print(\"W_HPT/m=\"),round(((h1-h6)+(1-m6)*(h6-h2)),2)\n", - "print(\"so W_HPT=m*573.24 KJ\")\n", - "print(\"also,W_LPT={(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}per kg of steam from boiler\")\n", - "{(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}\n", - "print(\"W_LPT/m=\"),round(((1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)),2)\n", - "print(\"so W_LPT=m*813.42 KJ\")\n", - "print(\"pump works(negative work)\")\n", - "print(\"W_CEP=m*(1-m6-m8)*(h5-h4_a)\")\n", - "h4_a=191.83;#h4_a=hf at 0.1 bar\n", - "print(\"W_CEP/m=\")\n", - "(1-m6-m8)*(h5-h4_a)\n", - "print(\"so W_CEP=m* 0.304\")\n", - "print(\"W_FP=m*(h10-h9)\")\n", - "print(\"W_FP/m=\"),round((h10-h9),2)\n", - "print(\"so W_FP=m*10.41\")\n", - "print(\"net output,\")\n", - "print(\"W_net=W_HPT+W_LPT-W_CEP-W_FP \")\n", - "print(\"so 50*10^3=(573.24*m+813.42*m-0.304*m-10.41*m)\")\n", - "m=W_net/(573.24+813.42-0.304-10.41)\n", - "print(\"so m in kg/s=\"),round(m,2)\n", - "Q_add=m*(h1-h11)\n", - "print(\"heat supplied in boiler,Q_add in KJ/s=\"),round(m*(h1-h11),2)\n", - "print(\"Thermal efficenncy=\"),round(W_net/Q_add,2)\n", - "print(\"in percentage\"),round(W_net*100/Q_add,2)\n", - "print(\"so mass of steam bled at 20 bar=0.119 kg per kg of steam entering first stage\")\n", - "print(\"mass of steam bled at 4 bar=0.109 kg per kg of steam entering first stage\")\n", - "print(\"mass of steam entering first stage=36.33 kg/s\")\n", - "print(\"thermal efficiency=54.66%\")\n", - "print(\"NOTE=>In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter8_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter8_2.ipynb deleted file mode 100755 index 5088b9af..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter8_2.ipynb +++ /dev/null @@ -1,2594 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 8:Vapour Power Cycles" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.1;pg no: 260" - ] - }, - { - "cell_type": "code", - "execution_count": 88, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.1, Page:260 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\n", - "T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\n", - "enthalpy at state 2,h2= hg at 7 MPa\n", - "from steam table,h=2772.1 KJ/kg\n", - "entropy at state 2,s2=sg at 7MPa\n", - "from steam table,s2=5.8133 KJ/kg K\n", - "enthalpy and entropy at state 3,\n", - "from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\n", - "for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \n", - "from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\n", - "s1=s2=sf+x1*sfg\n", - "so x1= 0.68\n", - "from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\n", - "enthalpy at state 1,h1 in KJ/kg= 1802.53\n", - "let dryness fraction at state 4 be x4\n", - "for process 4-3,s4=s3=sf+x4*sfg\n", - "so x4= 0.33\n", - "enthalpy at state 4,h4 in KJ/kg= 962.81\n", - "thermal efficiency=net work/heat added\n", - "expansion work per kg=(h2-h1) in KJ/kg 969.57\n", - "compression work per kg=(h3-h4) in KJ/kg(+ve) 304.19\n", - "heat added per kg=(h2-h3) in KJ/kg(-ve) 1505.1\n", - "net work per kg=(h2-h1)-(h3-h4) in KJ/kg 665.38\n", - "thermal efficiency 0.44\n", - "in percentage 44.21\n", - "so thermal efficiency=44.21%\n", - "turbine work=969.57 KJ/kg(+ve)\n", - "compression work=304.19 KJ/kg(-ve)\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,turbine work,compression work\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.1, Page:260 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\")\n", - "print(\"T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\")\n", - "print(\"enthalpy at state 2,h2= hg at 7 MPa\")\n", - "print(\"from steam table,h=2772.1 KJ/kg\")\n", - "h2=2772.1;\n", - "print(\"entropy at state 2,s2=sg at 7MPa\")\n", - "print(\"from steam table,s2=5.8133 KJ/kg K\")\n", - "s2=5.8133;\n", - "print(\"enthalpy and entropy at state 3,\")\n", - "print(\"from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\")\n", - "h3=1267;\n", - "s3=3.1211;\n", - "print(\"for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \")\n", - "s1=s2;\n", - "print(\"from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\")\n", - "sf=0.5564;\n", - "sfg=7.7237;\n", - "print(\"s1=s2=sf+x1*sfg\")\n", - "x1=(s2-sf)/sfg\n", - "print(\"so x1=\"),round(x1,2) \n", - "x1=0.6806;#approx.\n", - "print(\"from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\")\n", - "hf=162.60;\n", - "hfg=2409.54;\n", - "h1=hf+x1*hfg\n", - "print(\"enthalpy at state 1,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"let dryness fraction at state 4 be x4\")\n", - "print(\"for process 4-3,s4=s3=sf+x4*sfg\")\n", - "s4=s3;\n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.3321;#approx.\n", - "h4=hf+x4*hfg\n", - "print(\"enthalpy at state 4,h4 in KJ/kg=\"),round(h4,2)\n", - "print(\"thermal efficiency=net work/heat added\")\n", - "(h2-h1)\n", - "print(\"expansion work per kg=(h2-h1) in KJ/kg\"),round((h2-h1),2)\n", - "(h3-h4)\n", - "print(\"compression work per kg=(h3-h4) in KJ/kg(+ve)\"),round((h3-h4),2)\n", - "(h2-h3)\n", - "print(\"heat added per kg=(h2-h3) in KJ/kg(-ve)\"),round((h2-h3),2)\n", - "(h2-h1)-(h3-h4)\n", - "print(\"net work per kg=(h2-h1)-(h3-h4) in KJ/kg\"),round((h2-h1)-(h3-h4),2)\n", - "((h2-h1)-(h3-h4))/(h2-h3)\n", - "print(\"thermal efficiency\"),round(((h2-h1)-(h3-h4))/(h2-h3),2)\n", - "print(\"in percentage\"),round((((h2-h1)-(h3-h4))/(h2-h3))*100,2)\n", - "print(\"so thermal efficiency=44.21%\")\n", - "print(\"turbine work=969.57 KJ/kg(+ve)\")\n", - "print(\"compression work=304.19 KJ/kg(-ve)\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.2;pg no: 261" - ] - }, - { - "cell_type": "code", - "execution_count": 89, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.2, Page:261 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\n", - "from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\n", - "hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\n", - "from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\n", - "hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\n", - "as process 2-3 is isentropic,so s2=s3\n", - "and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\n", - "so x3= 0.69\n", - "hence enthalpy at 3,\n", - "h3 in KJ/kg= 1819.85\n", - "enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\n", - "process 1-4 is isentropic,so s1=s4\n", - "s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\n", - "so x4= 0.31\n", - "enthalpy at 4,h4 in KJ/kg= 884.31\n", - "enthalpy at 1,h1 in KJ/kg= 1154.23\n", - "carnot cycle(1-2-3-4-1) efficiency:\n", - "n_carnot=net work/heat added\n", - "n_carnot 0.43\n", - "in percentage 42.96\n", - "so n_carnot=42.95%\n", - "In rankine cycle,1-2-3-5-6-1,\n", - "pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg 5.02\n", - "h5 KJ/kg= 137.82\n", - "hence h6 in KJ/kg 142.84\n", - "net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg 969.43\n", - "heat added=(h2-h6)in KJ/kg 2651.46\n", - "rankine cycle efficiency(n_rankine)= 0.37\n", - "in percentage 36.56\n", - "so n_rankine=36.56%\n" - ] - } - ], - "source": [ - "#cal of n_carnot,n_rankine\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.2, Page:261 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\")\n", - "print(\"from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\")\n", - "print(\"hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\")\n", - "hf_5MPa=1154.23;\n", - "sf_5MPa=2.92;\n", - "hg_5MPa=2794.3;\n", - "sg_5MPa=5.97;\n", - "print(\"from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\")\n", - "print(\"hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\")\n", - "hf_5KPa=137.82;\n", - "sf_5KPa=0.4764;\n", - "hg_5KPa=2561.5;\n", - "sg_5KPa=8.3951;\n", - "vf_5KPa=0.001005;\n", - "print(\"as process 2-3 is isentropic,so s2=s3\")\n", - "print(\"and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\")\n", - "s2=sg_5MPa;\n", - "s3=s2;\n", - "x3=(s3-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.694;#approx.\n", - "print(\"hence enthalpy at 3,\")\n", - "h3=hf_5KPa+x3*(hg_5KPa-hf_5KPa)\n", - "print(\"h3 in KJ/kg=\"),round(h3,2)\n", - "print(\"enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\")\n", - "print(\"process 1-4 is isentropic,so s1=s4\")\n", - "s1=sf_5MPa;\n", - "print(\"s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\")\n", - "x4=(s1-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.308;#approx.\n", - "h4=hf_5KPa+x4*(hg_5KPa-hf_5KPa)\n", - "print(\"enthalpy at 4,h4 in KJ/kg=\"),round(h4,2)\n", - "h1=hf_5MPa\n", - "h2=hg_5MPa;\n", - "n_carnot=((h2-h3)-(h1-h4))/(h2-h1)\n", - "print(\"enthalpy at 1,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"carnot cycle(1-2-3-4-1) efficiency:\")\n", - "print(\"n_carnot=net work/heat added\")\n", - "print(\"n_carnot\"),round(n_carnot,2)\n", - "print(\"in percentage\"),round(n_carnot*100,2)\n", - "print(\"so n_carnot=42.95%\")\n", - "print(\"In rankine cycle,1-2-3-5-6-1,\")\n", - "p6=5000;#boiler pressure in KPa\n", - "p5=5;#condenser pressure in KPa\n", - "vf_5KPa*(p6-p5)\n", - "print(\"pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg\"),round(vf_5KPa*(p6-p5),2)\n", - "h5=hf_5KPa;\n", - "print(\"h5 KJ/kg=\"),round(hf_5KPa,2)\n", - "h6=h5+(vf_5KPa*(p6-p5))\n", - "print(\"hence h6 in KJ/kg\"),round(h6,2)\n", - "(h2-h3)-(h6-h5)\n", - "print(\"net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg\"),round((h2-h3)-(h6-h5),2)\n", - "(h2-h6)\n", - "print(\"heat added=(h2-h6)in KJ/kg\"),round((h2-h6),2)\n", - "n_rankine=((h2-h3)-(h6-h5))/(h2-h6)\n", - "print(\"rankine cycle efficiency(n_rankine)=\"),round(n_rankine,2)\n", - "print(\"in percentage\"),round(n_rankine*100,2)\n", - "print(\"so n_rankine=36.56%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.3;pg no: 263" - ] - }, - { - "cell_type": "code", - "execution_count": 90, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.3, Page:263 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\n", - "from steam tables,h2=hg_40bar=3092.5 KJ/kg\n", - "s2=sg_40bar=6.5821 KJ/kg K\n", - "h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \n", - "s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "v4=vf_0.05bar=0.001005 m^3/kg\n", - "let the dryness fraction at state 3 be x3,\n", - "for ideal process,2-3,s2=s3\n", - "s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\n", - "so x3= 0.77\n", - "h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\n", - "for pumping process,\n", - "h1-h4=v4*deltap=v4*(p1-p4)\n", - "so h1=h4+v4*(p1-p4) in KJ/kg 141.83\n", - "pump work per kg of steam in KJ/kg 4.01\n", - "net work per kg of steam =(expansion work-pump work)per kg of steam\n", - "=(h2-h3)-(h1-h4) in KJ/kg= 1081.75\n", - "cycle efficiency=net work/heat added 0.37\n", - "in percentage 36.66\n", - "so net work per kg of steam=1081.74 KJ/kg\n", - "cycle efficiency=36.67%\n", - "pump work per kg of steam=4.02 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of net work per kg of steam,cycle efficiency,pump work per kg of steam\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.3, Page:263 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\")\n", - "print(\"from steam tables,h2=hg_40bar=3092.5 KJ/kg\")\n", - "h2=3092.5;\n", - "print(\"s2=sg_40bar=6.5821 KJ/kg K\")\n", - "s2=6.5821;\n", - "print(\"h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \")\n", - "h4=137.82;\n", - "hfg=2423.7;\n", - "print(\"s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "s4=0.4764;\n", - "sfg=7.9187;\n", - "print(\"v4=vf_0.05bar=0.001005 m^3/kg\")\n", - "v4=0.001005;\n", - "print(\"let the dryness fraction at state 3 be x3,\")\n", - "print(\"for ideal process,2-3,s2=s3\")\n", - "s3=s2;\n", - "print(\"s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\")\n", - "x3=(s2-s4)/(sfg)\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.7711;#approx.\n", - "print(\"h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\")\n", - "h3=h4+x3*hfg\n", - "print(\"for pumping process,\")\n", - "print(\"h1-h4=v4*deltap=v4*(p1-p4)\")\n", - "p1=40*100;#pressure of steam enter in turbine in mPa\n", - "p4=0.05*100;#pressure of steam leave turbine in mPa\n", - "h1=h4+v4*(p1-p4)\n", - "print(\"so h1=h4+v4*(p1-p4) in KJ/kg\"),round(h1,2)\n", - "(h1-h4)\n", - "print(\"pump work per kg of steam in KJ/kg\"),round((h1-h4),2)\n", - "print(\"net work per kg of steam =(expansion work-pump work)per kg of steam\")\n", - "(h2-h3)-(h1-h4)\n", - "print(\"=(h2-h3)-(h1-h4) in KJ/kg=\"),round((h2-h3)-(h1-h4),2)\n", - "print(\"cycle efficiency=net work/heat added\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", - "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", - "print(\"so net work per kg of steam=1081.74 KJ/kg\")\n", - "print(\"cycle efficiency=36.67%\")\n", - "print(\"pump work per kg of steam=4.02 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.4;pg no: 264" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.4, Page:264 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 4\n", - "Let us assume that the condensate leaves condenser as saturated liquid and the expansion in turbine and pumping processes are isentropic.\n", - "from steam tables,h2=h_20MPa=3238.2 KJ/kg\n", - "s2=6.1401 KJ/kg K\n", - "h5=h_0.005MPa in KJ/kg\n", - "from steam tables,at 0.005 MPa,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "h5=hf+0.9*hfg in KJ/kg 2319.15\n", - "s5 in KJ/kg K= 7.6\n", - "h6=hf=137.82 KJ/kg\n", - "it is given that temperature at state 4 is 500 degree celcius and due to isentropic processes s4=s5=7.6032 KJ/kg K.The state 4 can be conveniently located on mollier chart by the intersection of 500 degree celcius constant temperature line and entropy value of 7.6032 KJ/kg K and the pressure and enthalpy obtained.but these shall be approximate.\n", - "The state 4 can also be located by interpolation using steam table.The entropy value of 7.6032 KJ/kg K lies between the superheated steam states given under,p=1.20 MPa,s at 1.20 MPa=7.6027 KJ/kg K\n", - "p=1.40 MPa,s at 1.40 MPa=7.6027 KJ/kg K\n", - "by interpolation state 4 lies at pressure=\n", - "=1.399,approx.=1.40 MPa\n", - "thus,steam leaves HP turbine at 1.40 MPa\n", - "enthalpy at state 4,h4=3474.1 KJ/kg\n", - "for process 2-33,s2=s3=6.1401 KJ/kg K.The state 3 thus lies in wet region as s3sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\n", - "From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\n", - "Let dryness fraction at state 9 be x9 so,\n", - "s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\n", - "from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\n", - "x9=(s9-sf)/sfg 0.95\n", - "h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\n", - "from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\n", - "Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\n", - "h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\n", - "h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\n", - "For process 4-8,i.e in CEP.\n", - "h8 in KJ/kg= 138.22\n", - "For process 11-12,i.e in FP2,\n", - "h12=h11+v11*(40-4)*10^2 in KJ/kg 608.64\n", - "For process 13-1_a i.e. in FP1,h1_a= in KJ/kg= 1107.34\n", - "m1*3141.81+(1-m1)*608.64=1087.31\n", - "so m1=(1087.31-608.64)/(3141.81-608.64)in kg\n", - "Applying energy balance on open feed water heater 1 (OFWH1)\n", - "m1*h10+(1-m1)*h12)=1*h13\n", - "so m1 in kg= 0.19\n", - "Applying energy balance on open feed water heater 2 (OFWH2)\n", - "m2*h9+(1-m1-m2)*h8=(1-m1)*h11\n", - "so m2 in kg= 0.15\n", - "Thermal efficiency of cycle,n= 0.51\n", - "W_CEP in KJ/kg steam from boiler= 0.26\n", - "W_FP1=(h1_a-h13)in KJ/kg of steam from boiler 20.0\n", - "W_FP2 in KJ/kg of steam from boiler= 3.17\n", - "W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler= 23.46\n", - "n= 0.51\n", - "in percentage 51.37\n", - "so cycle thermal efficiency,na=46.18%\n", - "nb=49.76%\n", - "nc=51.37%\n", - "hence it is obvious that efficiency increases with increase in number of feed heaters.\n" - ] - } - ], - "source": [ - "#cal of maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.6, Page:267 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 6\")\n", - "print(\"case (a) When there is no feed water heater\")\n", - "print(\"Thermal efficiency of cycle=((h2-h3)-(h1-h4))/(h2-h1)\")\n", - "print(\"from steam tables,h2=h at 200 bar,650oc=3675.3 KJ/kg,s2=s at 200 bar,650oc=6.6582 KJ/kg K,h4=hf at 0.05 bar=137.82 KJ/kg,v4=vf at 0.05 bar=0.001005 m^3/kg\")\n", - "h2=3675.3;\n", - "s2=6.6582;\n", - "h4=137.82;\n", - "v4=0.001005;\n", - "print(\"hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg,sf at 0.05 bar=0.4764 KJ/kg K,sfg at 0.05 bar=7.9187 KJ/kg K\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "print(\"For process 2-3,s2=s3.Let dryness fraction at 3 be x3.\")\n", - "s3=s2;\n", - "print(\"s3=6.6582=sf at 0.05 bar+x3*sfg at 0.05 bar\")\n", - "x3=(s3-sf)/sfg\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.781;#approx.\n", - "print(\"h3=hf at 0.05 bar+x3*hfg at 0.05 bar in KJ/kg\")\n", - "h3=hf+x3*hfg\n", - "print(\"For pumping process 4-1,\")\n", - "print(\"h1-h4=v4*deltap\")\n", - "h1=h4+v4*(200-0.5)*10**2\n", - "print(\"h1= in KJ/kg=\"),round(h1,2)\n", - "((h2-h3)-(h1-h4))/(h2-h1)\n", - "print(\"Thermal efficiency of cycle=\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", - "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", - "print(\"case (b) When there is only one feed water heater working at 8 bar\")\n", - "print(\"here,let mass of steam bled for feed heating be m kg\")\n", - "print(\"For process 2-6,s2=s6=6.6582 KJ/kg K\")\n", - "s6=s2;\n", - "print(\"Let dryness fraction at state 6 be x6\")\n", - "print(\"s6=sf at 8 bar+x6*sfg at 8 bar\")\n", - "print(\"from steam tables,hf at 8 bar=721.11 KJ/kg,vf at 8 bar=0.001115 m^3/kg,hfg at 8 bar=2048 KJ/kg,sf at 8 bar=2.0462 KJ/kg K,sfg at 8 bar=4.6166 KJ/kg K\")\n", - "hf=721.11;\n", - "vf=0.001115;\n", - "hfg=2048;\n", - "sf=2.0462;\n", - "sfg=4.6166;\n", - "x6=(s6-sf)/sfg\n", - "print(\"substituting entropy values,x6=\"),round(x6,2)\n", - "x6=0.999;#approx.\n", - "print(\"h6=hf at at 8 bar+x6*hfg at 8 bar in KJ/kg\")\n", - "h6=hf+x6*hfg\n", - "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at 8 bar.h7=hf at 8 bar=721.11 KJ/kg\")\n", - "h7=721.11;\n", - "h5=h4+v4*(8-.05)*10**2\n", - "print(\"For process 4-5,h5 in KJ/kg\"),round(h5,2)\n", - "print(\"Applying energy balance at open feed water heater,\")\n", - "print(\"m*h6+(1-m)*h5=1*h7\")\n", - "m=(h7-h5)/(h6-h5)\n", - "print(\"so m= in kg\"),round(m,2)\n", - "h7=hf;\n", - "v7=vf;\n", - "h1=h7+v7*(200-8)*10**2\n", - "print(\"For process 7-1,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"here h7=hf at 8 bar,v7=vf at 8 bar\")\n", - "#TE=((h2-h6)+(1-m)*(h6-h3)-((1-m)*(h5-h4)+(h1-h7))/(h2-h1)\n", - "print(\"Thermal efficiency of cycle=0.4976\")\n", - "print(\"in percentage=49.76\")\n", - "print(\"case (c) When there are two feed water heaters working at 40 bar and 4 bar\")\n", - "print(\"here, let us assume the mass of steam at 40 bar,4 bar to be m1 kg and m2 kg respectively.\")\n", - "print(\"2-10-9-3,s2=s10=s9=s3=6.6582 KJ/kg K\")\n", - "s3=s2;\n", - "s9=s3;\n", - "s10=s9;\n", - "print(\"At state 10.s10>sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\")\n", - "print(\"From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\")\n", - "T10=370.6;\n", - "h10=3141.81;\n", - "print(\"Let dryness fraction at state 9 be x9 so,\") \n", - "print(\"s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\")\n", - "print(\"from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\")\n", - "sf=1.7766;\n", - "sfg=5.1193;\n", - "x9=(s9-sf)/sfg\n", - "print(\"x9=(s9-sf)/sfg\"),round(x9,2)\n", - "x9=0.9536;#approx.\n", - "print(\"h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\")\n", - "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\")\n", - "hf=604.74;\n", - "hfg=2133.8;\n", - "h9=hf+x9*hfg \n", - "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\")\n", - "print(\"h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\")\n", - "h11=604.74;\n", - "v11=0.001084;\n", - "print(\"h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\")\n", - "h13=1087.31;\n", - "v13=0.001252;\n", - "print(\"For process 4-8,i.e in CEP.\")\n", - "h8=h4+v4*(4-0.05)*10**2\n", - "print(\"h8 in KJ/kg=\"),round(h8,2)\n", - "print(\"For process 11-12,i.e in FP2,\")\n", - "h12=h11+v11*(40-4)*10**2\n", - "print(\"h12=h11+v11*(40-4)*10^2 in KJ/kg\"),round(h12,2)\n", - "h1_a=h13+v13*(200-40)*10**2\n", - "print(\"For process 13-1_a i.e. in FP1,h1_a= in KJ/kg=\"),round(h1_a,2)\n", - "print(\"m1*3141.81+(1-m1)*608.64=1087.31\")\n", - "print(\"so m1=(1087.31-608.64)/(3141.81-608.64)in kg\")\n", - "m1=(1087.31-608.64)/(3141.81-608.64)\n", - "print(\"Applying energy balance on open feed water heater 1 (OFWH1)\")\n", - "print(\"m1*h10+(1-m1)*h12)=1*h13\")\n", - "m1=(h13-h12)/(h10-h12)\n", - "print(\"so m1 in kg=\"),round(m1,2)\n", - "print(\"Applying energy balance on open feed water heater 2 (OFWH2)\")\n", - "print(\"m2*h9+(1-m1-m2)*h8=(1-m1)*h11\")\n", - "m2=(1-m1)*(h11-h8)/(h9-h8)\n", - "print(\"so m2 in kg=\"),round(m2,2)\n", - "W_CEP=(1-m1-m2)*(h8-h4)\n", - "W_FP1=(h1_a-h13)\n", - "W_FP2=(1-m1)*(h12-h11)\n", - "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", - "print(\"Thermal efficiency of cycle,n=\"),round(n,2)\n", - "print(\"W_CEP in KJ/kg steam from boiler=\"),round(W_CEP,2)\n", - "print(\"W_FP1=(h1_a-h13)in KJ/kg of steam from boiler\"),round(W_FP1)\n", - "print(\"W_FP2 in KJ/kg of steam from boiler=\"),round(W_FP2,2)\n", - "W_CEP+W_FP1+W_FP2\n", - "print(\"W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler=\"),round(W_CEP+W_FP1+W_FP2,2)\n", - "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", - "print(\"n=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so cycle thermal efficiency,na=46.18%\")\n", - "print(\"nb=49.76%\")\n", - "print(\"nc=51.37%\")\n", - "print(\"hence it is obvious that efficiency increases with increase in number of feed heaters.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.7;pg no: 272" - ] - }, - { - "cell_type": "code", - "execution_count": 94, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.7, Page:272 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\n", - "from steam tables,\n", - "h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\n", - "s3=s2=6.9759 KJ/kg K\n", - "by interpolation from steam tables,\n", - "T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\n", - "for expansion process 4-5,s4=s5=7.7938 KJ/kg K\n", - "let dryness fraction at state 5 be x5\n", - "s5=sf at 0.05 bar+x5*sfg at 0.05 bar\n", - "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "so x5= 0.92\n", - "h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\n", - "from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\n", - "h6=hf at 0.05 bar=137.82 KJ/kg\n", - "v6=vf at 0.05 bar=0.001005 m^3/kg\n", - "for process 6-1 in feed pump,h1 in KJ/kg= 142.84\n", - "cycle efficiency=W_net/Q_add\n", - "Wt in KJ/kg= 1510.35\n", - "W_pump=(h1-h6)in KJ/kg 5.02\n", - "W_net=Wt-W_pump in KJ/kg 1505.33\n", - "Q_add in KJ/kg= 3290.96\n", - "cycle efficiency= 0.4574\n", - "in percentage= 45.74\n", - "we know ,1 hp=0.7457 KW\n", - "specific steam consumption in kg/hp hr= 1.78\n", - "work ratio=net work/positive work 0.9967\n", - "so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\n" - ] - } - ], - "source": [ - "#cal of cycle efficiency,specific steam consumption,work ratio\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.7, Page:272 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\")\n", - "print(\"from steam tables,\")\n", - "print(\"h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\")\n", - "h2=3433.8;\n", - "s2=6.9759;\n", - "print(\"s3=s2=6.9759 KJ/kg K\")\n", - "s3=s2;\n", - "print(\"by interpolation from steam tables,\")\n", - "print(\"T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\")\n", - "T3=183.14;\n", - "h3=2818.03;\n", - "h4=3271.9;\n", - "s4=7.7938;\n", - "print(\"for expansion process 4-5,s4=s5=7.7938 KJ/kg K\")\n", - "s5=s4;\n", - "print(\"let dryness fraction at state 5 be x5\")\n", - "print(\"s5=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", - "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "x5=(s5-sf)/sfg\n", - "print(\"so x5=\"),round(x5,2)\n", - "x5=0.924;#approx.\n", - "print(\"h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\")\n", - "print(\"from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "h5=hf+x5*hfg \n", - "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", - "h6=137.82;\n", - "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", - "v6=0.001005;\n", - "p1=50.;#steam generation pressure in bar\n", - "p6=0.05;#steam entering temperature in turbine in bar\n", - "h1=h6+v6*(p1-p6)*100\n", - "print(\"for process 6-1 in feed pump,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"cycle efficiency=W_net/Q_add\")\n", - "Wt=(h2-h3)+(h4-h5)\n", - "print(\"Wt in KJ/kg=\"),round(Wt,2)\n", - "W_pump=(h1-h6)\n", - "print(\"W_pump=(h1-h6)in KJ/kg\"),round(W_pump,2)\n", - "W_net=Wt-W_pump\n", - "print(\"W_net=Wt-W_pump in KJ/kg\"),round(W_net,2)\n", - "Q_add=(h2-h1)\n", - "print(\"Q_add in KJ/kg=\"),round(Q_add,2)\n", - "print(\"cycle efficiency=\"),round(W_net/Q_add,4)\n", - "W_net*100/Q_add\n", - "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", - "print(\"we know ,1 hp=0.7457 KW\")\n", - "print(\"specific steam consumption in kg/hp hr=\"),round(0.7457*3600/W_net,2)\n", - "print(\"work ratio=net work/positive work\"),round(W_net/Wt,4)\n", - "print(\"so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.8;pg no: 273" - ] - }, - { - "cell_type": "code", - "execution_count": 95, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.8, Page:273 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\n", - "from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\n", - "h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\n", - "Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\n", - "h8=hf at 3 bar=561.47 KJ/kg\n", - "for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\n", - "Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\n", - "s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\n", - "from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\n", - "so x3= 0.95\n", - "s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\n", - "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "so x4= 0.79\n", - "thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\n", - "here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\n", - "h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\n", - "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", - "assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\n", - "pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\n", - "for mixing process between condenser and feed pump,\n", - "(1-m)*h5+m*h9=1*h6\n", - "h6=m(h9-h5)+h5\n", - "we get,h6=137.82+m*423.65\n", - "therefore h7=h6+6.02=143.84+m*423.65\n", - "Applying energy balance at closed feed water heater;\n", - "m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\n", - "so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\n", - "so m=0.144 kg\n", - "steam bled for feed heating=0.144 kg/kg steam generated\n", - "The net power output,W_net in KJ/kg steam generated= 1167.27\n", - "mass of steam required to be generated in kg/s= 26.23\n", - "or in kg/hr\n", - "so capacity of boiler required=94428 kg/hr\n", - "overall thermal efficiency=W_net/Q_add\n", - "here Q_add in KJ/kg= 3134.56\n", - "overall thermal efficiency= 0.37\n", - "in percentage= 37.24\n", - "so overall thermal efficiency=37.24%\n" - ] - } - ], - "source": [ - "#cal of mass of steam bled for feed heating,capacity of boiler required,overall thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.8, Page:273 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\")\n", - "T_cond=115;#condensate temperature in degree celcius\n", - "Cp=4.18;#specific heat at constant pressure in KJ/kg K\n", - "P=30*10**3;#actual alternator output in KW\n", - "n_boiler=0.9;#boiler efficiency\n", - "n_alternator=0.98;#alternator efficiency\n", - "print(\"from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\")\n", - "h2=3301.8;\n", - "s2=6.7193;\n", - "print(\"h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\")\n", - "h5=137.82;\n", - "v5=0.001005;\n", - "print(\"Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\")\n", - "print(\"h8=hf at 3 bar=561.47 KJ/kg\")\n", - "h8=561.47;\n", - "print(\"for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\")\n", - "s3=s2;\n", - "s4=s3;\n", - "print(\"Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\")\n", - "print(\"s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\")\n", - "print(\"from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\")\n", - "sf_3bar=1.6718;\n", - "sfg_3bar=5.3201;\n", - "x3=(s3-sf_3bar)/sfg_3bar\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.949;#approx.\n", - "print(\"s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\")\n", - "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.788;#approx.\n", - "print(\"thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\")\n", - "print(\"here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\")\n", - "hf_3bar=561.47;\n", - "hfg_3bar=2163.8;\n", - "h3=hf_3bar+x3*hfg_3bar \n", - "print(\"h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\")\n", - "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "h4=hf+x4*hfg\n", - "print(\"assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\")\n", - "h9=h8;\n", - "v6=v5;\n", - "print(\"pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\")\n", - "p1=60;#pressure of steam in high pressure turbine in bar\n", - "p5=0.05;#pressure of steam in low pressure turbine in bar\n", - "v5*(p1-p5)*100\n", - "print(\"for mixing process between condenser and feed pump,\")\n", - "print(\"(1-m)*h5+m*h9=1*h6\")\n", - "print(\"h6=m(h9-h5)+h5\")\n", - "print(\"we get,h6=137.82+m*423.65\")\n", - "print(\"therefore h7=h6+6.02=143.84+m*423.65\")\n", - "print(\"Applying energy balance at closed feed water heater;\")\n", - "print(\"m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\")\n", - "print(\"so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\")\n", - "print(\"so m=0.144 kg\")\n", - "m=0.144;\n", - "h6=137.82+m*423.65;\n", - "h7=143.84+m*423.65;\n", - "print(\"steam bled for feed heating=0.144 kg/kg steam generated\")\n", - "W_net=(h2-h3)+(1-m)*(h3-h4)-(1-m)*(h7-h6)\n", - "print(\"The net power output,W_net in KJ/kg steam generated=\"),round(W_net,2)\n", - "P/(n_alternator*W_net)\n", - "print(\"mass of steam required to be generated in kg/s=\"),round(P/(n_alternator*W_net),2)\n", - "print(\"or in kg/hr\")\n", - "26.23*3600\n", - "print(\"so capacity of boiler required=94428 kg/hr\")\n", - "print(\"overall thermal efficiency=W_net/Q_add\")\n", - "Q_add=(h2-Cp*T_cond)/n_boiler\n", - "print(\"here Q_add in KJ/kg=\"),round(Q_add,2) \n", - "W_net/Q_add\n", - "print(\"overall thermal efficiency=\"),round(W_net/Q_add,2)\n", - "W_net*100/Q_add\n", - "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", - "print(\"so overall thermal efficiency=37.24%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.9;pg no: 275" - ] - }, - { - "cell_type": "code", - "execution_count": 96, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.9, Page:275 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\n", - "At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\n", - "For ideal expansion process,s2=s3\n", - "By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\n", - "actual stste at exit of first stage,h3_a in KJ/kg= 2909.88\n", - "actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K= 7.1075\n", - "for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\n", - "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", - "so x4= 0.96\n", - "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", - "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", - "actual enthalpy at exit from second stage,h4_a in KJ/kg= 2646.48\n", - "actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\n", - "so x4_a= 0.99\n", - "x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\n", - "for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x5= 0.87\n", - "h5=2270.43 KJ/kg\n", - "actual enthalpy at exit from third stage,h5_a in KJ/kg= 2345.64\n", - "Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\n", - "By heat balance on first closed feed water heater,(see schematic arrangement)\n", - "h11=hf at 6 bar=670.56 KJ\n", - "m1*h3_a+h10=m1*h11+4.18*150\n", - "(m1*2829.63)+h10=(m1*670.56)+627\n", - "h10+2159.07*m1=627\n", - "By heat balance on second closed feed water heater,(see schematic arrangement)\n", - "h7=hf at 1 bar=417.46 KJ/kg\n", - "m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\n", - "m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\n", - "m2*2467.27-m1*179.2-238.26=0\n", - "heat balance at point of mixing,\n", - "h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\n", - "neglecting pump work,h7=h8\n", - "h10=m2*417.46+(1-m1-m2)*397.1\n", - "substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\n", - "Turbine output per kg of steam generated,Wt in KJ/kg of steam generated= 780.445\n", - "Rate of steam generation required in kg/s= 19.22\n", - "in kg/hr\n", - "capacity of drain pump i.e. FP shown in layout in kg/hr= 16273.96\n", - "so capacity of drain pump=16273.96 kg/hr\n" - ] - } - ], - "source": [ - "#cal of capacity of drain pump\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.9, Page:275 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\")\n", - "P=15*10**3;#turbine output in KW\n", - "print(\"At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\")\n", - "h2=3230.9;\n", - "s2=6.9212;\n", - "print(\"For ideal expansion process,s2=s3\")\n", - "s3=s2;\n", - "print(\"By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\")\n", - "T3=190.97;\n", - "h3=2829.63;\n", - "h3_a=h2-0.8*(h2-h3)\n", - "print(\"actual stste at exit of first stage,h3_a in KJ/kg=\"),round(h3_a,2)\n", - "s3_a=7.1075;\n", - "print(\"actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K=\"),round(s3_a,4)\n", - "print(\"for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\")\n", - "s4=7.1075;\n", - "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", - "sf=1.3026;\n", - "sfg=6.0568;\n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.958;#approx.\n", - "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", - "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", - "hf=417.46;\n", - "hfg=2258.0;\n", - "h4=hf+x4*hfg\n", - "h4_a=h3_a-.8*(h3_a-h4)\n", - "print(\"actual enthalpy at exit from second stage,h4_a in KJ/kg=\"),round(h4_a,2)\n", - "print(\"actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\")\n", - "x4_a=(h4_a-hf)/hfg\n", - "print(\"so x4_a=\"),round(x4_a,2)\n", - "print(\"x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\")\n", - "s4_a=7.2806;\n", - "print(\"for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "x5=(s4_a-sf)/sfg\n", - "print(\"so x5=\"),round(x5,2)\n", - "x5=0.8735;#approx.\n", - "print(\"h5=2270.43 KJ/kg\")\n", - "h5=2270.43;\n", - "h5_a=h4_a-0.8*(h4_a-h5)\n", - "print(\"actual enthalpy at exit from third stage,h5_a in KJ/kg=\"),round(h5_a,2)\n", - "print(\"Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\")\n", - "print(\"By heat balance on first closed feed water heater,(see schematic arrangement)\")\n", - "print(\"h11=hf at 6 bar=670.56 KJ\")\n", - "h11=670.56;\n", - "print(\"m1*h3_a+h10=m1*h11+4.18*150\")\n", - "print(\"(m1*2829.63)+h10=(m1*670.56)+627\")\n", - "print(\"h10+2159.07*m1=627\")\n", - "print(\"By heat balance on second closed feed water heater,(see schematic arrangement)\")\n", - "print(\"h7=hf at 1 bar=417.46 KJ/kg\")\n", - "h7=417.46;\n", - "print(\"m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\")\n", - "print(\"m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\")\n", - "print(\"m2*2467.27-m1*179.2-238.26=0\")\n", - "print(\"heat balance at point of mixing,\")\n", - "print(\"h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\")\n", - "print(\"neglecting pump work,h7=h8\")\n", - "print(\"h10=m2*417.46+(1-m1-m2)*397.1\")\n", - "print(\"substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\")\n", - "m1=0.1293;\n", - "m2=0.1059;\n", - "Wt=(h2-h3_a)+(1-m1)*(h3_a-h4_a)+(1-m1-m2)*(h4_a-h5_a)\n", - "print(\"Turbine output per kg of steam generated,Wt in KJ/kg of steam generated=\"),round(Wt,3)\n", - "P/Wt\n", - "print(\"Rate of steam generation required in kg/s=\"),round(P/Wt,2)\n", - "print(\"in kg/hr\")\n", - "P*3600/Wt\n", - "(m1+m2)*69192\n", - "print(\"capacity of drain pump i.e. FP shown in layout in kg/hr=\"),round((m1+m2)*69192,2)\n", - "print(\"so capacity of drain pump=16273.96 kg/hr\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.10;pg no: 277" - ] - }, - { - "cell_type": "code", - "execution_count": 97, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.10, Page:277 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\n", - "at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\n", - "By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\n", - "actual enthapy at 3_a,h3_a in KJ/kg= 3097.0\n", - "enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\n", - "for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\n", - "s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x6= 0.83\n", - "h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "for actual expansion process in LP turbine.\n", - "h6_a=h4-0.85*(h4-h6) in KJ/kg 2319.4\n", - "Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\n", - "s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\n", - "from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\n", - "so x5= 1.0\n", - "h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\n", - "from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\n", - "actual enthalpy,h5_a in KJ/kg= 2790.16\n", - "enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\n", - "specific volume at inlet of CEP,v7=0.001008 m^3/kg\n", - "enthalpy at inlet of CEP,h7=168.79 KJ/kg\n", - "for pumping process 7-8,h8 in KJ/kg= 169.15\n", - "Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\n", - "m*h5+(1-m)*h8=h9\n", - "so m in kg /kg of steam generated= 0.33\n", - "For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\n", - "h1= in KJ/kg= 1015.59\n", - "Net work per kg of steam generated,W_net=in KJ/kg steam generated= 938.83\n", - "heat added per kg of steam generated,q_add in KJ/kg of steam generated= 2405.41\n", - "Thermal efficiency,n= 0.39\n", - "in percentage= 39.03\n", - "so thermal efficiency=39.03%%\n", - "NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\n" - ] - } - ], - "source": [ - "#cal of cycle efficiency\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.10, Page:277 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\")\n", - "print(\"at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\")\n", - "h2=3287.1;\n", - "s2=6.6327;\n", - "print(\"By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\")\n", - "h3=3049.48;\n", - "h3_a=h2-0.80*(h2-h3)\n", - "print(\"actual enthapy at 3_a,h3_a in KJ/kg=\"),round(h3_a,2)\n", - "print(\"enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\")\n", - "h4=3230.9;\n", - "s4=6.9212;\n", - "print(\"for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\")\n", - "s6=s4;\n", - "print(\"s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "x6=(s6-sf)/sfg\n", - "print(\"so x6=\"),round(x6,2)\n", - "x6=0.827;#approx.\n", - "print(\"h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0;\n", - "h6=hf+x6*hfg\n", - "print(\"for actual expansion process in LP turbine.\")\n", - "h6_a=h4-0.85*(h4-h6)\n", - "print(\"h6_a=h4-0.85*(h4-h6) in KJ/kg\"),round(h6_a,2)\n", - "print(\"Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\")\n", - "p5=3.61;\n", - "s5=s4;\n", - "print(\"s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\")\n", - "print(\"from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\")\n", - "sf=1.7391;\n", - "sfg=5.1908;\n", - "x5=(s5-sf)/sfg\n", - "print(\"so x5=\"),round(x5,2)\n", - "x5=0.99;#approx.\n", - "print(\"h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\")\n", - "print(\"from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\")\n", - "hf=589.13;\n", - "hfg=2144.7;\n", - "h5=hf+x5*hfg\n", - "h5_a=h4-0.85*(h4-h5)\n", - "print(\"actual enthalpy,h5_a in KJ/kg=\"),round(h5_a,2)\n", - "print(\"enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\")\n", - "h9=1008.42;\n", - "print(\"specific volume at inlet of CEP,v7=0.001008 m^3/kg\")\n", - "v7=0.001008;\n", - "print(\"enthalpy at inlet of CEP,h7=168.79 KJ/kg\")\n", - "h7=168.79;\n", - "h8=h7+v7*(3.61-0.075)*10**2\n", - "print(\"for pumping process 7-8,h8 in KJ/kg=\"),round(h8,2)\n", - "print(\"Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\")\n", - "print(\"m*h5+(1-m)*h8=h9\")\n", - "m=(h9-h8)/(h5-h8)\n", - "print(\"so m in kg /kg of steam generated=\"),round(m,2)\n", - "print(\"For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\")\n", - "v9=0.00108;\n", - "h1=h9+v9*(70-3.61)*10**2\n", - "print(\"h1= in KJ/kg=\"),round(h1,2) \n", - "W_net=(h2-h3_a)+(h4-h5_a)+(1-m)*(h5_a-h6_a)-((1-m)*(h8-h7)+(h1-h9))\n", - "print(\"Net work per kg of steam generated,W_net=in KJ/kg steam generated=\"),round(W_net,2)\n", - "q_add=(h2-h1)+(h4-h3_a)\n", - "print(\"heat added per kg of steam generated,q_add in KJ/kg of steam generated=\"),round(q_add,2)\n", - "n=W_net/q_add\n", - "print(\"Thermal efficiency,n=\"),round(n,2)\n", - "n=n*100\n", - "print(\"in percentage=\"),round(n,2)\n", - "print(\"so thermal efficiency=39.03%%\")\n", - "print(\"NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.11;pg no: 279" - ] - }, - { - "cell_type": "code", - "execution_count": 98, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.11, Page:279 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\n", - "Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\n", - "for isentropic expansion 2-3-4-5,s2=s3=s4=s5\n", - "Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\n", - "s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\n", - "so x3=(s3-sf)/sfg\n", - "from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\n", - "h3=hf+x3*hfg in KJ/kg\n", - "from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\n", - "s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\n", - "so x4=(s4-sf)/sfg\n", - "from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\n", - "so h4=hf+x4*hfg in KJ/kg\n", - "from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\n", - "s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\n", - "so x5=(s5-sf)/sfg\n", - "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "h5=hf+x5*hfg in KJ/kg\n", - "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", - "h6=hf at 0.05 bar=137.82 KJ/kg\n", - "v6=vf at 0.05 bar=0.001005 m^3/kg\n", - "h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\n", - "h8=hf at 1.5 bar=467.11 KJ/kg\n", - "v8=0.001053 m^3/kg=vf at 1.5 bar\n", - "h9=h8+v8*(150-1.5)*10^2 in KJ/kg\n", - "h10=hf at 150 bar=1610.5 KJ/kg\n", - "v10=0.001658 m^3/kg=vf at 150 bar\n", - "h12=h10+v10*(150-10)*10^2 in KJ/kg\n", - "Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\n", - "Heat balance on closed feed water heater yields,\n", - "m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\n", - "so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\n", - "heat balance on open feed water can be given as under,\n", - "m2*h4+(1-m1-m2)*h7=(1-m1)*h8\n", - "so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\n", - "for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\n", - "For mixing after closed feed water heater,\n", - "h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\n", - "Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\n", - "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\n", - "heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\n", - "cycle thermal efficiency,n=W_net/q_add 0.48\n", - "in percentage 47.59\n", - "Net power developed in KW=1219*300 in KW 365700.0\n", - "cycle thermal efficiency=47.6%\n", - "Net power developed=365700 KW\n" - ] - } - ], - "source": [ - "#cal of cycle thermal efficiency,Net power developed\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.11, Page:279 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\")\n", - "print(\"Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\")\n", - "h2=3308.6;\n", - "s2=6.3443;\n", - "print(\"for isentropic expansion 2-3-4-5,s2=s3=s4=s5\")\n", - "s3=s2;\n", - "s4=s3;\n", - "s5=s4;\n", - "print(\"Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\")\n", - "print(\"s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\")\n", - "print(\"so x3=(s3-sf)/sfg\")\n", - "print(\"from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\")\n", - "sf=2.1387;\n", - "sfg=4.4478;\n", - "x3=(s3-sf)/sfg\n", - "x3=0.945;#approx.\n", - "print(\"h3=hf+x3*hfg in KJ/kg\")\n", - "print(\"from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\")\n", - "hf=762.81;\n", - "hfg=2015.3;\n", - "h3=hf+x3*hfg\n", - "print(\"s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\")\n", - "print(\"so x4=(s4-sf)/sfg\")\n", - "print(\"from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\")\n", - "sf=1.4336;\n", - "sfg=5.7897;\n", - "x4=(s4-sf)/sfg\n", - "x4=0.848;#approx.\n", - "print(\"so h4=hf+x4*hfg in KJ/kg\")\n", - "print(\"from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\")\n", - "hf=467.11;\n", - "hfg=2226.5;\n", - "h4=hf+x4*hfg\n", - "print(\"s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", - "print(\"so x5=(s5-sf)/sfg\")\n", - "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "x5=(s5-sf)/sfg\n", - "x5=0.739;#approx.\n", - "print(\"h5=hf+x5*hfg in KJ/kg\")\n", - "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "h5=hf+x5*hfg \n", - "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", - "h6=137.82;\n", - "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", - "v6=0.001005;\n", - "print(\"h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\")\n", - "h7=h6+v6*(1.5-0.05)*10**2\n", - "print(\"h8=hf at 1.5 bar=467.11 KJ/kg\")\n", - "h8=467.11; \n", - "print(\"v8=0.001053 m^3/kg=vf at 1.5 bar\")\n", - "v8=0.001053;\n", - "print(\"h9=h8+v8*(150-1.5)*10^2 in KJ/kg\")\n", - "h9=h8+v8*(150-1.5)*10**2\n", - "print(\"h10=hf at 150 bar=1610.5 KJ/kg\")\n", - "h10=1610.5; \n", - "print(\"v10=0.001658 m^3/kg=vf at 150 bar\")\n", - "v10=0.001658;\n", - "print(\"h12=h10+v10*(150-10)*10^2 in KJ/kg\")\n", - "h12=h10+v10*(150-10)*10**2\n", - "print(\"Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\")\n", - "print(\"Heat balance on closed feed water heater yields,\")\n", - "print(\"m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\")\n", - "print(\"so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\")\n", - "m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)\n", - "print(\"heat balance on open feed water can be given as under,\")\n", - "print(\"m2*h4+(1-m1-m2)*h7=(1-m1)*h8\")\n", - "print(\"so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\")\n", - "m2=((1-m1)*(h8-h7))/(h4-h7)\n", - "print(\"for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\")\n", - "print(\"For mixing after closed feed water heater,\")\n", - "print(\"h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\")\n", - "h1=(4.18*150)*(1-m1)+m1*h12\n", - "print(\"Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\")\n", - "print(\"W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\")\n", - "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-((1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10)))\n", - "print(\"heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\")\n", - "q_add=(h2-h1)\n", - "n=W_net/q_add\n", - "print(\"cycle thermal efficiency,n=W_net/q_add\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"Net power developed in KW=1219*300 in KW\"),round(1219*300,2)\n", - "print(\"cycle thermal efficiency=47.6%\")\n", - "print(\"Net power developed=365700 KW\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.12;pg no: 282" - ] - }, - { - "cell_type": "code", - "execution_count": 99, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.12, Page:282 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\n", - "At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", - "For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\n", - "state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\n", - "since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\n", - "At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", - "At state 3,h3=2930.57 KJ/kg\n", - "At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\n", - "At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\n", - "From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\n", - "Let dryness fraction at state 5_a be x5,\n", - "s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x5_a=(s5_a-sf)/sfg\n", - "h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\n", - "from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\n", - "Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\n", - "m1_a*h3+h9=m1*h10+4.18*200\n", - "so m1_a=(4.18*200-h9)/(h3-h10) in kg\n", - "Applying heat balance at open feed water heater,\n", - "m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\n", - "so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\n", - "Net work per kg steam generated\n", - "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\n", - "Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\n", - "Thermal efficiency,n= 0.45\n", - "in percentage 45.04\n", - "% increase in thermal efficiency due to reheating= 0.56\n", - "so thermal efficiency of reheat cycle=45.03%\n", - "% increase in efficiency due to reheating=0.56%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,steam generation rate\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.12, Page:282 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\")\n", - "P=100*10**3;#net power output in KW\n", - "print(\"At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", - "h2=3373.7;\n", - "s2=6.5966;\n", - "print(\"For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\")\n", - "s3=s2;\n", - "s4=s3;\n", - "s5=s4;\n", - "print(\"state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\")\n", - "T3=261.6;\n", - "h3=2930.57;\n", - "print(\"since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\")\n", - "print(\"At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", - "h2=3373.7;\n", - "s2=6.5966;\n", - "print(\"At state 3,h3=2930.57 KJ/kg\")\n", - "h3=2930.57;\n", - "print(\"At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\")\n", - "h3_a=3247.6;\n", - "s3_a=7.1271;\n", - "print(\"At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\")\n", - "s4_a=s3_a;\n", - "s5_a=s4_a;\n", - "print(\"From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\")\n", - "h4_a=2841.02;\n", - "print(\"Let dryness fraction at state 5_a be x5,\")\n", - "print(\"s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "print(\"so x5_a=(s5_a-sf)/sfg\")\n", - "x5_a=(s5_a-sf)/sfg\n", - "x5_a=0.853;#approx.\n", - "print(\"h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "h5_a=hf+x5_a*hfg\n", - "print(\"Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\")\n", - "print(\"m1_a*h3+h9=m1*h10+4.18*200\")\n", - "print(\"so m1_a=(4.18*200-h9)/(h3-h10) in kg\")\n", - "m1_a=(4.18*200-h9)/(h3-h10)\n", - "m1_a=0.114;#approx.\n", - "print(\"Applying heat balance at open feed water heater,\")\n", - "print(\"m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\")\n", - "print(\"so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\")\n", - "m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7)\n", - "m2_a=0.131;#approx.\n", - "print(\"Net work per kg steam generated\")\n", - "print(\"w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\")\n", - "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-((1-m1_a-m2_a)*(h7-h6)+(h9-h8))\n", - "print(\"Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\")\n", - "q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)\n", - "n=w_net/q_add\n", - "print(\"Thermal efficiency,n=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"% increase in thermal efficiency due to reheating=\"),round((0.4503-0.4478)*100/0.4478,2)\n", - "print(\"so thermal efficiency of reheat cycle=45.03%\")\n", - "print(\"% increase in efficiency due to reheating=0.56%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.13;pg no: 286" - ] - }, - { - "cell_type": "code", - "execution_count": 100, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.13, Page:286 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\n", - "For mercury cycle,\n", - "insentropic heat drop=349-234.5 in KJ/kg Hg\n", - "actual heat drop=0.85*114.5 in KJ/kg Hg\n", - "Heat rejected in condenser=(349-97.325-35)in KJ/kg\n", - "heat added in boiler=349-35 in KJ/kg\n", - "For steam cycle,\n", - "Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\n", - "Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\n", - "Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\n", - "Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\n", - "Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\n", - "for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\n", - "state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\n", - "state 4 lies in wet region,say with dryness fraction x4\n", - "s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\n", - "so x4=(s4-sf)/sfg\n", - "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", - "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", - "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", - "Let state 5 lie in wet region with dryness fraction x5,\n", - "s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\n", - "so x5=(s5-sf)/sfg\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "h5=hf+x5*hfg in KJ/kg\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\n", - "h7=h6+v6*(1-0.075)*10^2 in KJ/kg\n", - "from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\n", - "h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\n", - "Applying heat balance on CFWH1,T1=150oc and also T15=150oc\n", - "m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\n", - "(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\n", - "Applying heat balance on CFEH2,T11=90oc\n", - "m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\n", - "(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\n", - "Heat balance at mixing between CFWH1 and CFWH2,\n", - "(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\n", - "376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\n", - "For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\n", - "from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\n", - "solving above equations,we get\n", - "m1=0.102 kg per kg steam generated\n", - "m2=0.073 kg per kg steam generated\n", - "pump work in process 13-14,h14-h13=v13*(40-8)*10^2\n", - "so h14-h13 in KJ/kg\n", - "Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\n", - "net work per kg of steam,w_net=w_mercury+w_steam\n", - "w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\n", - "thermal efficiency of binary vapour cycle=w_net/q_add 0.55\n", - "in percentage 55.36\n", - "so thermal efficiency=55.36%\n", - "NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.13, Page:286 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\")\n", - "print(\"For mercury cycle,\")\n", - "print(\"insentropic heat drop=349-234.5 in KJ/kg Hg\")\n", - "349-234.5\n", - "print(\"actual heat drop=0.85*114.5 in KJ/kg Hg\")\n", - "0.85*114.5\n", - "print(\"Heat rejected in condenser=(349-97.325-35)in KJ/kg\")\n", - "(349-97.325-35)\n", - "print(\"heat added in boiler=349-35 in KJ/kg\")\n", - "349-35\n", - "print(\"For steam cycle,\")\n", - "print(\"Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\")\n", - "h=2767.13;\n", - "print(\"Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\")\n", - "h2=3330.3;\n", - "print(\"Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\")\n", - "s2=6.9363;\n", - "print(\"Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\")\n", - "h-4.18*150\n", - "print(\"Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\")\n", - "2140.13/216.675\n", - "print(\"for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\")\n", - "s3=s2;\n", - "s4=s3;\n", - "s5=s4;\n", - "print(\"state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\")\n", - "h3=2899.23;\n", - "print(\"state 4 lies in wet region,say with dryness fraction x4\")\n", - "print(\"s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\")\n", - "print(\"so x4=(s4-sf)/sfg\")\n", - "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", - "sf=1.3026;\n", - "sfg=6.0568;\n", - "x4=(s4-sf)/sfg\n", - "x4=0.93;#approx.\n", - "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", - "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", - "hf=417.46;\n", - "hfg=2258.0;\n", - "h4=hf+x4*hfg\n", - "print(\"Let state 5 lie in wet region with dryness fraction x5,\")\n", - "print(\"s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", - "print(\"so x5=(s5-sf)/sfg\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "x5=(s5-sf)/sfg\n", - "x5=0.828;#approx.\n", - "print(\"h5=hf+x5*hfg in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0;\n", - "h5=hf+x5*hfg\n", - "print(\"Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\")\n", - "print(\"h7=h6+v6*(1-0.075)*10^2 in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\")\n", - "h6=168.79;\n", - "v6=0.001008;\n", - "h7=h6+v6*(1-0.075)*10**2\n", - "print(\"h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\")\n", - "h9=417.46;\n", - "h13=721.11;\n", - "print(\"Applying heat balance on CFWH1,T1=150oc and also T15=150oc\")\n", - "T1=150;\n", - "T15=150;\n", - "print(\"m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\")\n", - "print(\"(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\")\n", - "print(\"Applying heat balance on CFEH2,T11=90oc\")\n", - "T11=90;\n", - "print(\"m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\")\n", - "print(\"(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\")\n", - "print(\"Heat balance at mixing between CFWH1 and CFWH2,\")\n", - "print(\"(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\")\n", - "print(\"376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\")\n", - "print(\"For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\")\n", - "print(\"from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\")\n", - "h9=417.46;\n", - "v9=0.001043;\n", - "h10=h9+v9*(8-1)*10**2 \n", - "print(\"solving above equations,we get\")\n", - "print(\"m1=0.102 kg per kg steam generated\")\n", - "print(\"m2=0.073 kg per kg steam generated\")\n", - "m1=0.102;\n", - "m2=0.073;\n", - "print(\"pump work in process 13-14,h14-h13=v13*(40-8)*10^2\")\n", - "print(\"so h14-h13 in KJ/kg\")\n", - "v13=0.001252;\n", - "v13*(40-8)*10**2\n", - "print(\"Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\")\n", - "q_add=(9.88*314)+(3330.3-2767.13)\n", - "print(\"net work per kg of steam,w_net=w_mercury+w_steam\")\n", - "print(\"w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\")\n", - "w_net=(9.88*97.325)+((h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h7-h6)-m2*(h10-h9)-m1*4.006)\n", - "print(\"thermal efficiency of binary vapour cycle=w_net/q_add\"),round(w_net/q_add,2)\n", - "print(\"in percentage\"),round(w_net*100/q_add,2)\n", - "print(\"so thermal efficiency=55.36%\")\n", - "print(\"NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.14;pg no: 288" - ] - }, - { - "cell_type": "code", - "execution_count": 101, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.14, Page:288 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\n", - "This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\n", - "For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\n", - "ideally, s2=s1=6.7664 KJ/kg K\n", - "s2=sf at 0.075 bar +x3* sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x3=(s2-sf)/sfg\n", - "h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\n", - "for LP:at inlet of LP steam\n", - "h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\n", - "Enthalpy at exit,h_3LP=2222.34 KJ/kg\n", - "actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\n", - "HP steam consumption at full load=P*0.7457/h_HP in kg/s\n", - "HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\n", - "LP steam consumption at full load=P*0.7457/h_LP in kg/s\n", - "LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\n", - "The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\n", - "or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\n", - "Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\n", - "x=load,hp\n", - "y_HP=m_HP*x+C_HP\n", - "0.254=m_HP*0+C_HP\n", - "so C_HP=0.254\n", - "2.54=m_HP*2500+C_HP\n", - "so m_HP=(2.54-C_HP)/2500\n", - "so y_HP=9.144*10^-4*x_HP+0.254\n", - "Willans line for LP:y_LP=m_LP*x_LP+C_LP\n", - "0.481=m_LP*0+C_LP\n", - "so C_LP=0.481\n", - "4.81=m_LP*2500+C_LP\n", - "so m_LP=(4.81-C_LP)/2500\n", - "so y_LP=1.732*10^-3*x_LP+0.481\n", - "Total output(load) from mixed turbine,x=x_HP+x_LP\n", - "For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\n", - "from y_LP=1.732*10^-3*x_LP+0.481,\n", - "x_LP=(y_LP-0.481)/1.732*10^-3\n", - "since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\n", - "from y_HP=9.144*10^-4*x_HP+C_HP in kg/s 0.63\n", - "so HP steam requirement=0.63 kg/s\n" - ] - } - ], - "source": [ - "#cal of HP steam required\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.14, Page:288 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\")\n", - "n=0.8;#efficiency of both HP and LP turbine\n", - "P=2500;#output in hp\n", - "print(\"This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\")\n", - "print(\"For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\")\n", - "h1=3023.5;\n", - "s1=6.7664;\n", - "print(\"ideally, s2=s1=6.7664 KJ/kg K\")\n", - "s2=s1;\n", - "print(\"s2=sf at 0.075 bar +x3* sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "print(\"so x3=(s2-sf)/sfg\")\n", - "x3=(s2-sf)/sfg\n", - "x3=0.806;#approx.\n", - "print(\"h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0; \n", - "h_3HP=hf+x3*hfg\n", - "print(\"actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\")\n", - "h_HP=(h1-h_3HP)*n\n", - "print(\"for LP:at inlet of LP steam\")\n", - "print(\"h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\")\n", - "h2=2706.7;\n", - "s2=7.1271;\n", - "print(\"Enthalpy at exit,h_3LP=2222.34 KJ/kg\")\n", - "h_3LP=2222.34;\n", - "print(\"actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\")\n", - "h_LP=(h2-h_3LP)*n\n", - "print(\"HP steam consumption at full load=P*0.7457/h_HP in kg/s\")\n", - "P*0.7457/h_HP\n", - "print(\"HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\")\n", - "0.10*(P*0.7457/h_HP)\n", - "print(\"LP steam consumption at full load=P*0.7457/h_LP in kg/s\")\n", - "P*0.7457/h_LP\n", - "print(\"LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\")\n", - "0.10*(P*0.7457/h_LP)\n", - "print(\"The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\")\n", - "print(\"or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\")\n", - "print(\"Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\")\n", - "print(\"x=load,hp\")\n", - "print(\"y_HP=m_HP*x+C_HP\")\n", - "print(\"0.254=m_HP*0+C_HP\")\n", - "print(\"so C_HP=0.254\")\n", - "C_HP=0.254;\n", - "print(\"2.54=m_HP*2500+C_HP\")\n", - "print(\"so m_HP=(2.54-C_HP)/2500\")\n", - "m_HP=(2.54-C_HP)/2500\n", - "print(\"so y_HP=9.144*10^-4*x_HP+0.254\")\n", - "print(\"Willans line for LP:y_LP=m_LP*x_LP+C_LP\")\n", - "print(\"0.481=m_LP*0+C_LP\")\n", - "print(\"so C_LP=0.481\")\n", - "C_LP=0.481;\n", - "print(\"4.81=m_LP*2500+C_LP\")\n", - "print(\"so m_LP=(4.81-C_LP)/2500\")\n", - "m_LP=(4.81-C_LP)/2500\n", - "print(\"so y_LP=1.732*10^-3*x_LP+0.481\")\n", - "print(\"Total output(load) from mixed turbine,x=x_HP+x_LP\")\n", - "print(\"For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\")\n", - "y_LP=1.5;\n", - "print(\"from y_LP=1.732*10^-3*x_LP+0.481,\")\n", - "print(\"x_LP=(y_LP-0.481)/1.732*10^-3\")\n", - "x_LP=(y_LP-0.481)/(1.732*10**-3)\n", - "print(\"since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\")\n", - "x_HP=411.66;\n", - "y_HP=9.144*10**-4*x_HP+C_HP\n", - "print(\"from y_HP=9.144*10^-4*x_HP+C_HP in kg/s\"),round(y_HP,2)\n", - "print(\"so HP steam requirement=0.63 kg/s\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.15;pg no: 289" - ] - }, - { - "cell_type": "code", - "execution_count": 102, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.15, Page:289 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\n", - "Let us carry out analysis for 1 kg of steam generated in boiler.\n", - "Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\n", - "state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\n", - "Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\n", - "so x3= 0.86\n", - "from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\n", - "h3=2404.94 KJ/kg\n", - "If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\n", - "mass of moisture retained in separator(m)=(1-x3)*0.5 kg\n", - "Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\n", - "Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\n", - "Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\n", - "(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\n", - "so T in degree celcius= 68.425\n", - "so temperature of water leaving hotwell=68.425 degree celcius\n", - "Applying heat balanced on trap\n", - "0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\n", - "so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\n", - "from steam tables,at 2 bar,hf=504.70 KJ/kg\n", - "Therefore,heat transferred in process heater in KJ/kg steam generated= 1023.172\n", - "so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\n", - "For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\n", - "Let dryness fraction be x10\n", - "s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x10=(s10-sf)/sfg\n", - "h10=hf at 0.075 bar+x10*hfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "so h10=hf+x10*hfg in KJ/kg \n", - "net work output,neglecting pump work per kg of steam generated,\n", - "w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\n", - "Heat added in boiler per kg steam generated,q_add in KJ/kg= 2674.68\n", - "thermal efficiency=w_net/q_add 0.28\n", - "in percentage 27.59\n", - "so Thermal efficiency=27.58%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,heat transferred and temperature\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.15, Page:289 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\")\n", - "print(\"Let us carry out analysis for 1 kg of steam generated in boiler.\")\n", - "print(\"Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\")\n", - "h2=2960.7;\n", - "s2=6.3615;\n", - "print(\"state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\")\n", - "s3=s2;\n", - "print(\"Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\")\n", - "sf=1.5301;\n", - "sfg=5.5970;\n", - "x3=(s3-sf)/sfg\n", - "print(\"so x3=\"),round(x3,2)\n", - "print(\"from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\")\n", - "x3=0.863;#approx.\n", - "print(\"h3=2404.94 KJ/kg\")\n", - "h3=2404.94;\n", - "print(\"If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\")\n", - "print(\"mass of moisture retained in separator(m)=(1-x3)*0.5 kg\")\n", - "m=(1-x3)*0.5\n", - "print(\"Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\")\n", - "m_LP=0.5-m\n", - "print(\"Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\")\n", - "print(\"Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\")\n", - "print(\"(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\")\n", - "T=((0.5685*4.18*90)+(0.4315*4.18*40))/4.18\n", - "print(\"so T in degree celcius=\"),round(T,3)\n", - "print(\"so temperature of water leaving hotwell=68.425 degree celcius\")\n", - "print(\"Applying heat balanced on trap\")\n", - "print(\"0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\")\n", - "print(\"so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\")\n", - "print(\"from steam tables,at 2 bar,hf=504.70 KJ/kg\")\n", - "hf=504.70;\n", - "h7=((0.5685*4.18*90)-(0.0685*hf))/0.5\n", - "print(\"Therefore,heat transferred in process heater in KJ/kg steam generated=\"),round(0.5*(h3-h7),3)\n", - "print(\"so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\")\n", - "print(\"For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\")\n", - "s10=s3;\n", - "print(\"Let dryness fraction be x10\")\n", - "print(\"s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "print(\"so x10=(s10-sf)/sfg\")\n", - "x10=(s10-sf)/sfg\n", - "x10=0.754;#approx.\n", - "print(\"h10=hf at 0.075 bar+x10*hfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0;\n", - "print(\"so h10=hf+x10*hfg in KJ/kg \")\n", - "h10=hf+x10*hfg \n", - "print(\"net work output,neglecting pump work per kg of steam generated,\")\n", - "print(\"w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\")\n", - "w_net=(h2-h3)*1+0.4315*(h3-h10) \n", - "q_add=(h2-4.18*68.425)\n", - "print(\"Heat added in boiler per kg steam generated,q_add in KJ/kg=\"),round(q_add,2)\n", - "w_net/q_add\n", - "print(\"thermal efficiency=w_net/q_add\"),round(w_net/q_add,2)\n", - "print(\"in percentage\"),round(w_net*100/q_add,2)\n", - "print(\"so Thermal efficiency=27.58%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.16;pg no: 291" - ] - }, - { - "cell_type": "code", - "execution_count": 103, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.16, Page:291 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\n", - "from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\n", - "Assuming isentropic expansion in nozzle,s1=s2=6.9486\n", - "Letdryness fraction at state 2,x2=0.864\n", - "s2=sf at 0.2 bar+x2*sfg at 0.2 bar\n", - "from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\n", - "so x2= 0.86\n", - "hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\n", - "from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\n", - "considering pump work to be of isentropic type,deltah_34=v3*deltap_34\n", - "from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\n", - "or deltah_34 in KJ/kg= 7.1\n", - "pump work,Wp in KJ/kg= 7.1\n", - "turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\n", - "net work(W_net)=Wt-Wp in KJ/kg\n", - "power produced(P)=mass flow rate*W_net in KJ/s\n", - "so net power=43.22 MW\n", - "heat supplied in boiler(Q)=(h1-h4) in KJ/kg\n", - "enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\n", - "total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s 114534.05\n", - "thermal efficiency=net work/heat supplied=W_net/Q 0.38\n", - "in percentage 37.73\n", - "so thermal efficiency=37.73%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,net power\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.16, Page:291 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\")\n", - "m=35;#mass flow rate in kg/s\n", - "print(\"from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\")\n", - "h1=3530.9;\n", - "s1=6.9486;\n", - "print(\"Assuming isentropic expansion in nozzle,s1=s2=6.9486\")\n", - "s2=s1;\n", - "print(\"Letdryness fraction at state 2,x2=0.864\")\n", - "print(\"s2=sf at 0.2 bar+x2*sfg at 0.2 bar\")\n", - "print(\"from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\")\n", - "sf=0.8320;\n", - "sfg=7.0766;\n", - "x2=(s2-sf)/sfg\n", - "print(\"so x2=\"),round(x2,2)\n", - "x2=0.864;#approx.\n", - "print(\"hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\")\n", - "print(\"from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\")\n", - "hf=251.4;\n", - "hfg=2358.3;\n", - "h2=hf+x2*hfg\n", - "print(\"considering pump work to be of isentropic type,deltah_34=v3*deltap_34\")\n", - "print(\"from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\")\n", - "v3=0.001017;\n", - "p3=70;#;pressure of steam entering turbine in bar\n", - "p4=0.20;#condenser pressure in bar\n", - "deltah_34=v3*(p3-p4)*100\n", - "print(\"or deltah_34 in KJ/kg=\"),round(deltah_34,2)\n", - "Wp=deltah_34\n", - "print(\"pump work,Wp in KJ/kg=\"),round(Wp,2)\n", - "print(\"turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\")\n", - "Wt=(h1-h2)\n", - "print(\"net work(W_net)=Wt-Wp in KJ/kg\")\n", - "W_net=Wt-Wp\n", - "print(\"power produced(P)=mass flow rate*W_net in KJ/s\")\n", - "P=m*W_net\n", - "print(\"so net power=43.22 MW\")\n", - "print(\"heat supplied in boiler(Q)=(h1-h4) in KJ/kg\")\n", - "print(\"enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\")\n", - "h3=hf;\n", - "h4=h3+deltah_34 \n", - "Q=m*(h1-h4)\n", - "print(\"total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s\"),round(Q,2)\n", - "print(\"thermal efficiency=net work/heat supplied=W_net/Q\"),round(P/Q,2)\n", - "print(\"in percentage\"),round(P*100/Q,2)\n", - "print(\"so thermal efficiency=37.73%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.17;pg no: 292" - ] - }, - { - "cell_type": "code", - "execution_count": 104, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.1, Page:292 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 17\n", - "from steam tables,h1=3625.3 KJ/s,s1=6.9029 KJ/kg K\n", - "due to isentropic expansion,s1=s2=s3=6.9029 KJ/kg K\n", - "at state 2,i.e at pressure of 2 MPa and entropy 6.9029 KJ/kg K\n", - "by interpolating state for s2 between 2 MPa,300 degree celcius and 2 MPa,350 degree celcius from steam tables,\n", - "h2=3105.08 KJ/kg \n", - "for state 3,i.e at pressure of 0.01 MPa entropy,s3 lies in wet region as s3In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,mass of steam\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.18, Page:294 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 18\")\n", - "W_net=50*10**3;#net output of turbine in KW\n", - "print(\"from steam tables,at inlet to first stage of turbine,h1=h at 100 bar,500oc=3373.7 KJ/kg,s1=s at 100 bar,500oc=6.5966 KJ/kg\")\n", - "h1=3373.7;\n", - "s1=6.5966;\n", - "print(\"Due to isentropic expansion,s1=s6=s2 and s3=s8=s4\")\n", - "s2=s1;\n", - "s6=s2;\n", - "print(\"State at 6 i.e bleed state from HP turbine,temperature by interpolation from steam table =261.6oc.\")\n", - "print(\"At inlet to second stage of turbine,h6=2930.572 KJ/kg\")\n", - "h6=2930.572;\n", - "print(\"h3=h at 10 bar,500oc=3478.5 KJ/kg,s3=s at 10 bar,500oc=7.7622 KJ/kg K\")\n", - "h3=3478.5;\n", - "s3=7.7622;\n", - "s4=s3;\n", - "s8=s4;\n", - "print(\"At exit from first stage of turbine i.e. at 10 bar and entropy of 6.5966 KJ/kg K,Temperature by interpolation from steam table at 10 bar and entropy of 6.5966 KJ/kg K\")\n", - "print(\"T2=181.8oc,h2=2782.8 KJ/kg\")\n", - "T2=181.8;\n", - "h2=2782.8;\n", - "print(\"state at 8,i.e bleed state from second stage of expansion,i.e at 4 bar and entropy of 7.7622 KJ/kg K,Temperature by interpolation from steam table,T8=358.98oc=359oc\")\n", - "T8=359;\n", - "print(\"h8=3188.7 KJ/kg\")\n", - "h8=3188.7;\n", - "print(\"state at 4 i.e. at condenser pressure of 0.1 bar and entropy of 7.7622 KJ/kg K,the state lies in wet region.So let the dryness fraction be x4.\")\n", - "print(\"s4=sf at 0.1 bar+x4*sfg at 0.1 bar\")\n", - "print(\"from steam tables,at 0.1 bar,sf=0.6493 KJ/kg K,sfg=7.5009 KJ/kg K\")\n", - "sf=0.6493;\n", - "sfg=7.5009; \n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.95;#approx.\n", - "print(\"h4=hf at 0.1 bar+x4*hfg at 0.1 bar in KJ/kg \")\n", - "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,hfg=2392.8 KJ/kg\")\n", - "hf=191.83;\n", - "hfg=2392.8;\n", - "h4=hf+x4*hfg\n", - "print(\"given,h4=2464.99 KJ/kg,h11=856.8 KJ/kg,h9=hf at 4 bar=604.74 KJ/kg\")\n", - "h4=2464.99;\n", - "h11=856.8;\n", - "h9=604.74;\n", - "print(\"considering pump work,the net output can be given as,\")\n", - "print(\"W_net=W_HPT+W_LPT-(W_CEP+W_FP)\")\n", - "print(\"where,W_HPT={(h1-h6)+(1-m6)*(h6-h2)}per kg of steam from boiler.\")\n", - "print(\"W_LPT={(1-m6)+(h3-h8)*(1-m6-m8)*(h8-h4)}per kg of steam from boiler.\")\n", - "print(\"for closed feed water heater,energy balance yields;\")\n", - "print(\"m6*h6+h10=m6*h7+h11\")\n", - "print(\"assuming condensate leaving closed feed water heater to be saturated liquid,\")\n", - "print(\"h7=hf at 20 bar=908.79 KJ/kg\")\n", - "h7=908.79; \n", - "print(\"due to throttline,h7=h7_a=908.79 KJ/kg\")\n", - "h7_a=h7;\n", - "print(\"for open feed water heater,energy balance yields,\")\n", - "print(\"m6*h7_a+m8*h8+(1-m6-m8)*h5=h9\")\n", - "print(\"for condensate extraction pump,h5-h4_a=v4_a*deltap\")\n", - "print(\"h5-hf at 0.1 bar=vf at 0.1 bar*(4-0.1)*10^2 \")\n", - "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,vf=0.001010 m^3/kg\")\n", - "hf=191.83;\n", - "vf=0.001010; \n", - "h5=hf+vf*(4-0.1)*10**2\n", - "print(\"so h5 in KJ/kg=\"),round(h5,2)\n", - "print(\"for feed pump,h10-h9=v9*deltap\")\n", - "print(\"h10=h9+vf at 4 bar*(100-4)*10^2 in KJ/kg\")\n", - "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,vf=0.001084 m^3/kg \")\n", - "hf=604.74;\n", - "vf=0.001084;\n", - "h10=h9+vf*(100-4)*10**2\n", - "print(\"substituting in energy balance upon closed feed water heater,\")\n", - "m6=(h11-h10)/(h6-h7)\n", - "print(\"m6 in kg per kg of steam from boiler=\"),round(m6,3)\n", - "print(\"substituting in energy balance upon feed water heater,\")\n", - "m8=(h9-m6*h7_a+m6*h5-h5)/(h8-h5)\n", - "print(\"m8 in kg per kg of steam from boiler=\"),round(m8,3)\n", - "print(\"Let the mass of steam entering first stage of turbine be m kg,then\")\n", - "{(h1-h6)+(1-m6)*(h6-h2)}\n", - "print(\"W_HPT=m*{(h1-h6)+(1-m6)*(h6-h2)}\")\n", - "print(\"W_HPT/m=\"),round(((h1-h6)+(1-m6)*(h6-h2)),2)\n", - "print(\"so W_HPT=m*573.24 KJ\")\n", - "print(\"also,W_LPT={(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}per kg of steam from boiler\")\n", - "{(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}\n", - "print(\"W_LPT/m=\"),round(((1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)),2)\n", - "print(\"so W_LPT=m*813.42 KJ\")\n", - "print(\"pump works(negative work)\")\n", - "print(\"W_CEP=m*(1-m6-m8)*(h5-h4_a)\")\n", - "h4_a=191.83;#h4_a=hf at 0.1 bar\n", - "print(\"W_CEP/m=\")\n", - "(1-m6-m8)*(h5-h4_a)\n", - "print(\"so W_CEP=m* 0.304\")\n", - "print(\"W_FP=m*(h10-h9)\")\n", - "print(\"W_FP/m=\"),round((h10-h9),2)\n", - "print(\"so W_FP=m*10.41\")\n", - "print(\"net output,\")\n", - "print(\"W_net=W_HPT+W_LPT-W_CEP-W_FP \")\n", - "print(\"so 50*10^3=(573.24*m+813.42*m-0.304*m-10.41*m)\")\n", - "m=W_net/(573.24+813.42-0.304-10.41)\n", - "print(\"so m in kg/s=\"),round(m,2)\n", - "Q_add=m*(h1-h11)\n", - "print(\"heat supplied in boiler,Q_add in KJ/s=\"),round(m*(h1-h11),2)\n", - "print(\"Thermal efficenncy=\"),round(W_net/Q_add,2)\n", - "print(\"in percentage\"),round(W_net*100/Q_add,2)\n", - "print(\"so mass of steam bled at 20 bar=0.119 kg per kg of steam entering first stage\")\n", - "print(\"mass of steam bled at 4 bar=0.109 kg per kg of steam entering first stage\")\n", - "print(\"mass of steam entering first stage=36.33 kg/s\")\n", - "print(\"thermal efficiency=54.66%\")\n", - "print(\"NOTE=>In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter8_3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter8_3.ipynb deleted file mode 100755 index 5088b9af..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter8_3.ipynb +++ /dev/null @@ -1,2594 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 8:Vapour Power Cycles" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.1;pg no: 260" - ] - }, - { - "cell_type": "code", - "execution_count": 88, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.1, Page:260 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\n", - "T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\n", - "enthalpy at state 2,h2= hg at 7 MPa\n", - "from steam table,h=2772.1 KJ/kg\n", - "entropy at state 2,s2=sg at 7MPa\n", - "from steam table,s2=5.8133 KJ/kg K\n", - "enthalpy and entropy at state 3,\n", - "from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\n", - "for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \n", - "from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\n", - "s1=s2=sf+x1*sfg\n", - "so x1= 0.68\n", - "from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\n", - "enthalpy at state 1,h1 in KJ/kg= 1802.53\n", - "let dryness fraction at state 4 be x4\n", - "for process 4-3,s4=s3=sf+x4*sfg\n", - "so x4= 0.33\n", - "enthalpy at state 4,h4 in KJ/kg= 962.81\n", - "thermal efficiency=net work/heat added\n", - "expansion work per kg=(h2-h1) in KJ/kg 969.57\n", - "compression work per kg=(h3-h4) in KJ/kg(+ve) 304.19\n", - "heat added per kg=(h2-h3) in KJ/kg(-ve) 1505.1\n", - "net work per kg=(h2-h1)-(h3-h4) in KJ/kg 665.38\n", - "thermal efficiency 0.44\n", - "in percentage 44.21\n", - "so thermal efficiency=44.21%\n", - "turbine work=969.57 KJ/kg(+ve)\n", - "compression work=304.19 KJ/kg(-ve)\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,turbine work,compression work\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.1, Page:260 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1\")\n", - "print(\"T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.\")\n", - "print(\"enthalpy at state 2,h2= hg at 7 MPa\")\n", - "print(\"from steam table,h=2772.1 KJ/kg\")\n", - "h2=2772.1;\n", - "print(\"entropy at state 2,s2=sg at 7MPa\")\n", - "print(\"from steam table,s2=5.8133 KJ/kg K\")\n", - "s2=5.8133;\n", - "print(\"enthalpy and entropy at state 3,\")\n", - "print(\"from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K\")\n", - "h3=1267;\n", - "s3=3.1211;\n", - "print(\"for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 \")\n", - "s1=s2;\n", - "print(\"from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K\")\n", - "sf=0.5564;\n", - "sfg=7.7237;\n", - "print(\"s1=s2=sf+x1*sfg\")\n", - "x1=(s2-sf)/sfg\n", - "print(\"so x1=\"),round(x1,2) \n", - "x1=0.6806;#approx.\n", - "print(\"from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg\")\n", - "hf=162.60;\n", - "hfg=2409.54;\n", - "h1=hf+x1*hfg\n", - "print(\"enthalpy at state 1,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"let dryness fraction at state 4 be x4\")\n", - "print(\"for process 4-3,s4=s3=sf+x4*sfg\")\n", - "s4=s3;\n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.3321;#approx.\n", - "h4=hf+x4*hfg\n", - "print(\"enthalpy at state 4,h4 in KJ/kg=\"),round(h4,2)\n", - "print(\"thermal efficiency=net work/heat added\")\n", - "(h2-h1)\n", - "print(\"expansion work per kg=(h2-h1) in KJ/kg\"),round((h2-h1),2)\n", - "(h3-h4)\n", - "print(\"compression work per kg=(h3-h4) in KJ/kg(+ve)\"),round((h3-h4),2)\n", - "(h2-h3)\n", - "print(\"heat added per kg=(h2-h3) in KJ/kg(-ve)\"),round((h2-h3),2)\n", - "(h2-h1)-(h3-h4)\n", - "print(\"net work per kg=(h2-h1)-(h3-h4) in KJ/kg\"),round((h2-h1)-(h3-h4),2)\n", - "((h2-h1)-(h3-h4))/(h2-h3)\n", - "print(\"thermal efficiency\"),round(((h2-h1)-(h3-h4))/(h2-h3),2)\n", - "print(\"in percentage\"),round((((h2-h1)-(h3-h4))/(h2-h3))*100,2)\n", - "print(\"so thermal efficiency=44.21%\")\n", - "print(\"turbine work=969.57 KJ/kg(+ve)\")\n", - "print(\"compression work=304.19 KJ/kg(-ve)\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.2;pg no: 261" - ] - }, - { - "cell_type": "code", - "execution_count": 89, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.2, Page:261 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\n", - "from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\n", - "hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\n", - "from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\n", - "hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\n", - "as process 2-3 is isentropic,so s2=s3\n", - "and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\n", - "so x3= 0.69\n", - "hence enthalpy at 3,\n", - "h3 in KJ/kg= 1819.85\n", - "enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\n", - "process 1-4 is isentropic,so s1=s4\n", - "s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\n", - "so x4= 0.31\n", - "enthalpy at 4,h4 in KJ/kg= 884.31\n", - "enthalpy at 1,h1 in KJ/kg= 1154.23\n", - "carnot cycle(1-2-3-4-1) efficiency:\n", - "n_carnot=net work/heat added\n", - "n_carnot 0.43\n", - "in percentage 42.96\n", - "so n_carnot=42.95%\n", - "In rankine cycle,1-2-3-5-6-1,\n", - "pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg 5.02\n", - "h5 KJ/kg= 137.82\n", - "hence h6 in KJ/kg 142.84\n", - "net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg 969.43\n", - "heat added=(h2-h6)in KJ/kg 2651.46\n", - "rankine cycle efficiency(n_rankine)= 0.37\n", - "in percentage 36.56\n", - "so n_rankine=36.56%\n" - ] - } - ], - "source": [ - "#cal of n_carnot,n_rankine\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.2, Page:261 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2\")\n", - "print(\"from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K\")\n", - "print(\"hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K\")\n", - "hf_5MPa=1154.23;\n", - "sf_5MPa=2.92;\n", - "hg_5MPa=2794.3;\n", - "sg_5MPa=5.97;\n", - "print(\"from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K\")\n", - "print(\"hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg\")\n", - "hf_5KPa=137.82;\n", - "sf_5KPa=0.4764;\n", - "hg_5KPa=2561.5;\n", - "sg_5KPa=8.3951;\n", - "vf_5KPa=0.001005;\n", - "print(\"as process 2-3 is isentropic,so s2=s3\")\n", - "print(\"and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa\")\n", - "s2=sg_5MPa;\n", - "s3=s2;\n", - "x3=(s3-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.694;#approx.\n", - "print(\"hence enthalpy at 3,\")\n", - "h3=hf_5KPa+x3*(hg_5KPa-hf_5KPa)\n", - "print(\"h3 in KJ/kg=\"),round(h3,2)\n", - "print(\"enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg\")\n", - "print(\"process 1-4 is isentropic,so s1=s4\")\n", - "s1=sf_5MPa;\n", - "print(\"s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)\")\n", - "x4=(s1-sf_5KPa)/(sg_5KPa-sf_5KPa)\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.308;#approx.\n", - "h4=hf_5KPa+x4*(hg_5KPa-hf_5KPa)\n", - "print(\"enthalpy at 4,h4 in KJ/kg=\"),round(h4,2)\n", - "h1=hf_5MPa\n", - "h2=hg_5MPa;\n", - "n_carnot=((h2-h3)-(h1-h4))/(h2-h1)\n", - "print(\"enthalpy at 1,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"carnot cycle(1-2-3-4-1) efficiency:\")\n", - "print(\"n_carnot=net work/heat added\")\n", - "print(\"n_carnot\"),round(n_carnot,2)\n", - "print(\"in percentage\"),round(n_carnot*100,2)\n", - "print(\"so n_carnot=42.95%\")\n", - "print(\"In rankine cycle,1-2-3-5-6-1,\")\n", - "p6=5000;#boiler pressure in KPa\n", - "p5=5;#condenser pressure in KPa\n", - "vf_5KPa*(p6-p5)\n", - "print(\"pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg\"),round(vf_5KPa*(p6-p5),2)\n", - "h5=hf_5KPa;\n", - "print(\"h5 KJ/kg=\"),round(hf_5KPa,2)\n", - "h6=h5+(vf_5KPa*(p6-p5))\n", - "print(\"hence h6 in KJ/kg\"),round(h6,2)\n", - "(h2-h3)-(h6-h5)\n", - "print(\"net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg\"),round((h2-h3)-(h6-h5),2)\n", - "(h2-h6)\n", - "print(\"heat added=(h2-h6)in KJ/kg\"),round((h2-h6),2)\n", - "n_rankine=((h2-h3)-(h6-h5))/(h2-h6)\n", - "print(\"rankine cycle efficiency(n_rankine)=\"),round(n_rankine,2)\n", - "print(\"in percentage\"),round(n_rankine*100,2)\n", - "print(\"so n_rankine=36.56%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.3;pg no: 263" - ] - }, - { - "cell_type": "code", - "execution_count": 90, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.3, Page:263 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\n", - "from steam tables,h2=hg_40bar=3092.5 KJ/kg\n", - "s2=sg_40bar=6.5821 KJ/kg K\n", - "h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \n", - "s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "v4=vf_0.05bar=0.001005 m^3/kg\n", - "let the dryness fraction at state 3 be x3,\n", - "for ideal process,2-3,s2=s3\n", - "s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\n", - "so x3= 0.77\n", - "h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\n", - "for pumping process,\n", - "h1-h4=v4*deltap=v4*(p1-p4)\n", - "so h1=h4+v4*(p1-p4) in KJ/kg 141.83\n", - "pump work per kg of steam in KJ/kg 4.01\n", - "net work per kg of steam =(expansion work-pump work)per kg of steam\n", - "=(h2-h3)-(h1-h4) in KJ/kg= 1081.75\n", - "cycle efficiency=net work/heat added 0.37\n", - "in percentage 36.66\n", - "so net work per kg of steam=1081.74 KJ/kg\n", - "cycle efficiency=36.67%\n", - "pump work per kg of steam=4.02 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of net work per kg of steam,cycle efficiency,pump work per kg of steam\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.3, Page:263 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3\")\n", - "print(\"from steam tables,h2=hg_40bar=3092.5 KJ/kg\")\n", - "h2=3092.5;\n", - "print(\"s2=sg_40bar=6.5821 KJ/kg K\")\n", - "s2=6.5821;\n", - "print(\"h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg \")\n", - "h4=137.82;\n", - "hfg=2423.7;\n", - "print(\"s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "s4=0.4764;\n", - "sfg=7.9187;\n", - "print(\"v4=vf_0.05bar=0.001005 m^3/kg\")\n", - "v4=0.001005;\n", - "print(\"let the dryness fraction at state 3 be x3,\")\n", - "print(\"for ideal process,2-3,s2=s3\")\n", - "s3=s2;\n", - "print(\"s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar\")\n", - "x3=(s2-s4)/(sfg)\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.7711;#approx.\n", - "print(\"h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg\")\n", - "h3=h4+x3*hfg\n", - "print(\"for pumping process,\")\n", - "print(\"h1-h4=v4*deltap=v4*(p1-p4)\")\n", - "p1=40*100;#pressure of steam enter in turbine in mPa\n", - "p4=0.05*100;#pressure of steam leave turbine in mPa\n", - "h1=h4+v4*(p1-p4)\n", - "print(\"so h1=h4+v4*(p1-p4) in KJ/kg\"),round(h1,2)\n", - "(h1-h4)\n", - "print(\"pump work per kg of steam in KJ/kg\"),round((h1-h4),2)\n", - "print(\"net work per kg of steam =(expansion work-pump work)per kg of steam\")\n", - "(h2-h3)-(h1-h4)\n", - "print(\"=(h2-h3)-(h1-h4) in KJ/kg=\"),round((h2-h3)-(h1-h4),2)\n", - "print(\"cycle efficiency=net work/heat added\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", - "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", - "print(\"so net work per kg of steam=1081.74 KJ/kg\")\n", - "print(\"cycle efficiency=36.67%\")\n", - "print(\"pump work per kg of steam=4.02 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.4;pg no: 264" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.4, Page:264 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 4\n", - "Let us assume that the condensate leaves condenser as saturated liquid and the expansion in turbine and pumping processes are isentropic.\n", - "from steam tables,h2=h_20MPa=3238.2 KJ/kg\n", - "s2=6.1401 KJ/kg K\n", - "h5=h_0.005MPa in KJ/kg\n", - "from steam tables,at 0.005 MPa,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "h5=hf+0.9*hfg in KJ/kg 2319.15\n", - "s5 in KJ/kg K= 7.6\n", - "h6=hf=137.82 KJ/kg\n", - "it is given that temperature at state 4 is 500 degree celcius and due to isentropic processes s4=s5=7.6032 KJ/kg K.The state 4 can be conveniently located on mollier chart by the intersection of 500 degree celcius constant temperature line and entropy value of 7.6032 KJ/kg K and the pressure and enthalpy obtained.but these shall be approximate.\n", - "The state 4 can also be located by interpolation using steam table.The entropy value of 7.6032 KJ/kg K lies between the superheated steam states given under,p=1.20 MPa,s at 1.20 MPa=7.6027 KJ/kg K\n", - "p=1.40 MPa,s at 1.40 MPa=7.6027 KJ/kg K\n", - "by interpolation state 4 lies at pressure=\n", - "=1.399,approx.=1.40 MPa\n", - "thus,steam leaves HP turbine at 1.40 MPa\n", - "enthalpy at state 4,h4=3474.1 KJ/kg\n", - "for process 2-33,s2=s3=6.1401 KJ/kg K.The state 3 thus lies in wet region as s3sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\n", - "From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\n", - "Let dryness fraction at state 9 be x9 so,\n", - "s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\n", - "from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\n", - "x9=(s9-sf)/sfg 0.95\n", - "h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\n", - "from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\n", - "Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\n", - "h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\n", - "h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\n", - "For process 4-8,i.e in CEP.\n", - "h8 in KJ/kg= 138.22\n", - "For process 11-12,i.e in FP2,\n", - "h12=h11+v11*(40-4)*10^2 in KJ/kg 608.64\n", - "For process 13-1_a i.e. in FP1,h1_a= in KJ/kg= 1107.34\n", - "m1*3141.81+(1-m1)*608.64=1087.31\n", - "so m1=(1087.31-608.64)/(3141.81-608.64)in kg\n", - "Applying energy balance on open feed water heater 1 (OFWH1)\n", - "m1*h10+(1-m1)*h12)=1*h13\n", - "so m1 in kg= 0.19\n", - "Applying energy balance on open feed water heater 2 (OFWH2)\n", - "m2*h9+(1-m1-m2)*h8=(1-m1)*h11\n", - "so m2 in kg= 0.15\n", - "Thermal efficiency of cycle,n= 0.51\n", - "W_CEP in KJ/kg steam from boiler= 0.26\n", - "W_FP1=(h1_a-h13)in KJ/kg of steam from boiler 20.0\n", - "W_FP2 in KJ/kg of steam from boiler= 3.17\n", - "W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler= 23.46\n", - "n= 0.51\n", - "in percentage 51.37\n", - "so cycle thermal efficiency,na=46.18%\n", - "nb=49.76%\n", - "nc=51.37%\n", - "hence it is obvious that efficiency increases with increase in number of feed heaters.\n" - ] - } - ], - "source": [ - "#cal of maximum possible work\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.6, Page:267 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 6\")\n", - "print(\"case (a) When there is no feed water heater\")\n", - "print(\"Thermal efficiency of cycle=((h2-h3)-(h1-h4))/(h2-h1)\")\n", - "print(\"from steam tables,h2=h at 200 bar,650oc=3675.3 KJ/kg,s2=s at 200 bar,650oc=6.6582 KJ/kg K,h4=hf at 0.05 bar=137.82 KJ/kg,v4=vf at 0.05 bar=0.001005 m^3/kg\")\n", - "h2=3675.3;\n", - "s2=6.6582;\n", - "h4=137.82;\n", - "v4=0.001005;\n", - "print(\"hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg,sf at 0.05 bar=0.4764 KJ/kg K,sfg at 0.05 bar=7.9187 KJ/kg K\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "print(\"For process 2-3,s2=s3.Let dryness fraction at 3 be x3.\")\n", - "s3=s2;\n", - "print(\"s3=6.6582=sf at 0.05 bar+x3*sfg at 0.05 bar\")\n", - "x3=(s3-sf)/sfg\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.781;#approx.\n", - "print(\"h3=hf at 0.05 bar+x3*hfg at 0.05 bar in KJ/kg\")\n", - "h3=hf+x3*hfg\n", - "print(\"For pumping process 4-1,\")\n", - "print(\"h1-h4=v4*deltap\")\n", - "h1=h4+v4*(200-0.5)*10**2\n", - "print(\"h1= in KJ/kg=\"),round(h1,2)\n", - "((h2-h3)-(h1-h4))/(h2-h1)\n", - "print(\"Thermal efficiency of cycle=\"),round(((h2-h3)-(h1-h4))/(h2-h1),2)\n", - "print(\"in percentage\"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)\n", - "print(\"case (b) When there is only one feed water heater working at 8 bar\")\n", - "print(\"here,let mass of steam bled for feed heating be m kg\")\n", - "print(\"For process 2-6,s2=s6=6.6582 KJ/kg K\")\n", - "s6=s2;\n", - "print(\"Let dryness fraction at state 6 be x6\")\n", - "print(\"s6=sf at 8 bar+x6*sfg at 8 bar\")\n", - "print(\"from steam tables,hf at 8 bar=721.11 KJ/kg,vf at 8 bar=0.001115 m^3/kg,hfg at 8 bar=2048 KJ/kg,sf at 8 bar=2.0462 KJ/kg K,sfg at 8 bar=4.6166 KJ/kg K\")\n", - "hf=721.11;\n", - "vf=0.001115;\n", - "hfg=2048;\n", - "sf=2.0462;\n", - "sfg=4.6166;\n", - "x6=(s6-sf)/sfg\n", - "print(\"substituting entropy values,x6=\"),round(x6,2)\n", - "x6=0.999;#approx.\n", - "print(\"h6=hf at at 8 bar+x6*hfg at 8 bar in KJ/kg\")\n", - "h6=hf+x6*hfg\n", - "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at 8 bar.h7=hf at 8 bar=721.11 KJ/kg\")\n", - "h7=721.11;\n", - "h5=h4+v4*(8-.05)*10**2\n", - "print(\"For process 4-5,h5 in KJ/kg\"),round(h5,2)\n", - "print(\"Applying energy balance at open feed water heater,\")\n", - "print(\"m*h6+(1-m)*h5=1*h7\")\n", - "m=(h7-h5)/(h6-h5)\n", - "print(\"so m= in kg\"),round(m,2)\n", - "h7=hf;\n", - "v7=vf;\n", - "h1=h7+v7*(200-8)*10**2\n", - "print(\"For process 7-1,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"here h7=hf at 8 bar,v7=vf at 8 bar\")\n", - "#TE=((h2-h6)+(1-m)*(h6-h3)-((1-m)*(h5-h4)+(h1-h7))/(h2-h1)\n", - "print(\"Thermal efficiency of cycle=0.4976\")\n", - "print(\"in percentage=49.76\")\n", - "print(\"case (c) When there are two feed water heaters working at 40 bar and 4 bar\")\n", - "print(\"here, let us assume the mass of steam at 40 bar,4 bar to be m1 kg and m2 kg respectively.\")\n", - "print(\"2-10-9-3,s2=s10=s9=s3=6.6582 KJ/kg K\")\n", - "s3=s2;\n", - "s9=s3;\n", - "s10=s9;\n", - "print(\"At state 10.s10>sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.\")\n", - "print(\"From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg\")\n", - "T10=370.6;\n", - "h10=3141.81;\n", - "print(\"Let dryness fraction at state 9 be x9 so,\") \n", - "print(\"s9=6.6582=sf at 4 bar+x9*sfg at 4 bar\")\n", - "print(\"from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K\")\n", - "sf=1.7766;\n", - "sfg=5.1193;\n", - "x9=(s9-sf)/sfg\n", - "print(\"x9=(s9-sf)/sfg\"),round(x9,2)\n", - "x9=0.9536;#approx.\n", - "print(\"h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg\")\n", - "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg\")\n", - "hf=604.74;\n", - "hfg=2133.8;\n", - "h9=hf+x9*hfg \n", - "print(\"Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.\")\n", - "print(\"h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar\")\n", - "h11=604.74;\n", - "v11=0.001084;\n", - "print(\"h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar\")\n", - "h13=1087.31;\n", - "v13=0.001252;\n", - "print(\"For process 4-8,i.e in CEP.\")\n", - "h8=h4+v4*(4-0.05)*10**2\n", - "print(\"h8 in KJ/kg=\"),round(h8,2)\n", - "print(\"For process 11-12,i.e in FP2,\")\n", - "h12=h11+v11*(40-4)*10**2\n", - "print(\"h12=h11+v11*(40-4)*10^2 in KJ/kg\"),round(h12,2)\n", - "h1_a=h13+v13*(200-40)*10**2\n", - "print(\"For process 13-1_a i.e. in FP1,h1_a= in KJ/kg=\"),round(h1_a,2)\n", - "print(\"m1*3141.81+(1-m1)*608.64=1087.31\")\n", - "print(\"so m1=(1087.31-608.64)/(3141.81-608.64)in kg\")\n", - "m1=(1087.31-608.64)/(3141.81-608.64)\n", - "print(\"Applying energy balance on open feed water heater 1 (OFWH1)\")\n", - "print(\"m1*h10+(1-m1)*h12)=1*h13\")\n", - "m1=(h13-h12)/(h10-h12)\n", - "print(\"so m1 in kg=\"),round(m1,2)\n", - "print(\"Applying energy balance on open feed water heater 2 (OFWH2)\")\n", - "print(\"m2*h9+(1-m1-m2)*h8=(1-m1)*h11\")\n", - "m2=(1-m1)*(h11-h8)/(h9-h8)\n", - "print(\"so m2 in kg=\"),round(m2,2)\n", - "W_CEP=(1-m1-m2)*(h8-h4)\n", - "W_FP1=(h1_a-h13)\n", - "W_FP2=(1-m1)*(h12-h11)\n", - "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", - "print(\"Thermal efficiency of cycle,n=\"),round(n,2)\n", - "print(\"W_CEP in KJ/kg steam from boiler=\"),round(W_CEP,2)\n", - "print(\"W_FP1=(h1_a-h13)in KJ/kg of steam from boiler\"),round(W_FP1)\n", - "print(\"W_FP2 in KJ/kg of steam from boiler=\"),round(W_FP2,2)\n", - "W_CEP+W_FP1+W_FP2\n", - "print(\"W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler=\"),round(W_CEP+W_FP1+W_FP2,2)\n", - "n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)\n", - "print(\"n=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so cycle thermal efficiency,na=46.18%\")\n", - "print(\"nb=49.76%\")\n", - "print(\"nc=51.37%\")\n", - "print(\"hence it is obvious that efficiency increases with increase in number of feed heaters.\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.7;pg no: 272" - ] - }, - { - "cell_type": "code", - "execution_count": 94, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.7, Page:272 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\n", - "from steam tables,\n", - "h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\n", - "s3=s2=6.9759 KJ/kg K\n", - "by interpolation from steam tables,\n", - "T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\n", - "for expansion process 4-5,s4=s5=7.7938 KJ/kg K\n", - "let dryness fraction at state 5 be x5\n", - "s5=sf at 0.05 bar+x5*sfg at 0.05 bar\n", - "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "so x5= 0.92\n", - "h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\n", - "from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\n", - "h6=hf at 0.05 bar=137.82 KJ/kg\n", - "v6=vf at 0.05 bar=0.001005 m^3/kg\n", - "for process 6-1 in feed pump,h1 in KJ/kg= 142.84\n", - "cycle efficiency=W_net/Q_add\n", - "Wt in KJ/kg= 1510.35\n", - "W_pump=(h1-h6)in KJ/kg 5.02\n", - "W_net=Wt-W_pump in KJ/kg 1505.33\n", - "Q_add in KJ/kg= 3290.96\n", - "cycle efficiency= 0.4574\n", - "in percentage= 45.74\n", - "we know ,1 hp=0.7457 KW\n", - "specific steam consumption in kg/hp hr= 1.78\n", - "work ratio=net work/positive work 0.9967\n", - "so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\n" - ] - } - ], - "source": [ - "#cal of cycle efficiency,specific steam consumption,work ratio\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.7, Page:272 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7\")\n", - "print(\"from steam tables,\")\n", - "print(\"h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K\")\n", - "h2=3433.8;\n", - "s2=6.9759;\n", - "print(\"s3=s2=6.9759 KJ/kg K\")\n", - "s3=s2;\n", - "print(\"by interpolation from steam tables,\")\n", - "print(\"T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K\")\n", - "T3=183.14;\n", - "h3=2818.03;\n", - "h4=3271.9;\n", - "s4=7.7938;\n", - "print(\"for expansion process 4-5,s4=s5=7.7938 KJ/kg K\")\n", - "s5=s4;\n", - "print(\"let dryness fraction at state 5 be x5\")\n", - "print(\"s5=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", - "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "x5=(s5-sf)/sfg\n", - "print(\"so x5=\"),round(x5,2)\n", - "x5=0.924;#approx.\n", - "print(\"h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg\")\n", - "print(\"from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "h5=hf+x5*hfg \n", - "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", - "h6=137.82;\n", - "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", - "v6=0.001005;\n", - "p1=50.;#steam generation pressure in bar\n", - "p6=0.05;#steam entering temperature in turbine in bar\n", - "h1=h6+v6*(p1-p6)*100\n", - "print(\"for process 6-1 in feed pump,h1 in KJ/kg=\"),round(h1,2)\n", - "print(\"cycle efficiency=W_net/Q_add\")\n", - "Wt=(h2-h3)+(h4-h5)\n", - "print(\"Wt in KJ/kg=\"),round(Wt,2)\n", - "W_pump=(h1-h6)\n", - "print(\"W_pump=(h1-h6)in KJ/kg\"),round(W_pump,2)\n", - "W_net=Wt-W_pump\n", - "print(\"W_net=Wt-W_pump in KJ/kg\"),round(W_net,2)\n", - "Q_add=(h2-h1)\n", - "print(\"Q_add in KJ/kg=\"),round(Q_add,2)\n", - "print(\"cycle efficiency=\"),round(W_net/Q_add,4)\n", - "W_net*100/Q_add\n", - "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", - "print(\"we know ,1 hp=0.7457 KW\")\n", - "print(\"specific steam consumption in kg/hp hr=\"),round(0.7457*3600/W_net,2)\n", - "print(\"work ratio=net work/positive work\"),round(W_net/Wt,4)\n", - "print(\"so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.8;pg no: 273" - ] - }, - { - "cell_type": "code", - "execution_count": 95, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.8, Page:273 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\n", - "from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\n", - "h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\n", - "Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\n", - "h8=hf at 3 bar=561.47 KJ/kg\n", - "for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\n", - "Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\n", - "s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\n", - "from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\n", - "so x3= 0.95\n", - "s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\n", - "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "so x4= 0.79\n", - "thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\n", - "here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\n", - "h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\n", - "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", - "assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\n", - "pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\n", - "for mixing process between condenser and feed pump,\n", - "(1-m)*h5+m*h9=1*h6\n", - "h6=m(h9-h5)+h5\n", - "we get,h6=137.82+m*423.65\n", - "therefore h7=h6+6.02=143.84+m*423.65\n", - "Applying energy balance at closed feed water heater;\n", - "m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\n", - "so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\n", - "so m=0.144 kg\n", - "steam bled for feed heating=0.144 kg/kg steam generated\n", - "The net power output,W_net in KJ/kg steam generated= 1167.27\n", - "mass of steam required to be generated in kg/s= 26.23\n", - "or in kg/hr\n", - "so capacity of boiler required=94428 kg/hr\n", - "overall thermal efficiency=W_net/Q_add\n", - "here Q_add in KJ/kg= 3134.56\n", - "overall thermal efficiency= 0.37\n", - "in percentage= 37.24\n", - "so overall thermal efficiency=37.24%\n" - ] - } - ], - "source": [ - "#cal of mass of steam bled for feed heating,capacity of boiler required,overall thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.8, Page:273 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8\")\n", - "T_cond=115;#condensate temperature in degree celcius\n", - "Cp=4.18;#specific heat at constant pressure in KJ/kg K\n", - "P=30*10**3;#actual alternator output in KW\n", - "n_boiler=0.9;#boiler efficiency\n", - "n_alternator=0.98;#alternator efficiency\n", - "print(\"from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K\")\n", - "h2=3301.8;\n", - "s2=6.7193;\n", - "print(\"h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg\")\n", - "h5=137.82;\n", - "v5=0.001005;\n", - "print(\"Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e\")\n", - "print(\"h8=hf at 3 bar=561.47 KJ/kg\")\n", - "h8=561.47;\n", - "print(\"for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K\")\n", - "s3=s2;\n", - "s4=s3;\n", - "print(\"Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.\")\n", - "print(\"s3=6.7193=sf at 3 bar+x3* sfg at 3 bar\")\n", - "print(\"from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K\")\n", - "sf_3bar=1.6718;\n", - "sfg_3bar=5.3201;\n", - "x3=(s3-sf_3bar)/sfg_3bar\n", - "print(\"so x3=\"),round(x3,2)\n", - "x3=0.949;#approx.\n", - "print(\"s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar\")\n", - "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.788;#approx.\n", - "print(\"thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg\")\n", - "print(\"here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K\")\n", - "hf_3bar=561.47;\n", - "hfg_3bar=2163.8;\n", - "h3=hf_3bar+x3*hfg_3bar \n", - "print(\"h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg\")\n", - "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "h4=hf+x4*hfg\n", - "print(\"assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,\")\n", - "h9=h8;\n", - "v6=v5;\n", - "print(\"pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg\")\n", - "p1=60;#pressure of steam in high pressure turbine in bar\n", - "p5=0.05;#pressure of steam in low pressure turbine in bar\n", - "v5*(p1-p5)*100\n", - "print(\"for mixing process between condenser and feed pump,\")\n", - "print(\"(1-m)*h5+m*h9=1*h6\")\n", - "print(\"h6=m(h9-h5)+h5\")\n", - "print(\"we get,h6=137.82+m*423.65\")\n", - "print(\"therefore h7=h6+6.02=143.84+m*423.65\")\n", - "print(\"Applying energy balance at closed feed water heater;\")\n", - "print(\"m*h3+(1-m)*h7=m*h8+(Cp*T_cond)\")\n", - "print(\"so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7\")\n", - "print(\"so m=0.144 kg\")\n", - "m=0.144;\n", - "h6=137.82+m*423.65;\n", - "h7=143.84+m*423.65;\n", - "print(\"steam bled for feed heating=0.144 kg/kg steam generated\")\n", - "W_net=(h2-h3)+(1-m)*(h3-h4)-(1-m)*(h7-h6)\n", - "print(\"The net power output,W_net in KJ/kg steam generated=\"),round(W_net,2)\n", - "P/(n_alternator*W_net)\n", - "print(\"mass of steam required to be generated in kg/s=\"),round(P/(n_alternator*W_net),2)\n", - "print(\"or in kg/hr\")\n", - "26.23*3600\n", - "print(\"so capacity of boiler required=94428 kg/hr\")\n", - "print(\"overall thermal efficiency=W_net/Q_add\")\n", - "Q_add=(h2-Cp*T_cond)/n_boiler\n", - "print(\"here Q_add in KJ/kg=\"),round(Q_add,2) \n", - "W_net/Q_add\n", - "print(\"overall thermal efficiency=\"),round(W_net/Q_add,2)\n", - "W_net*100/Q_add\n", - "print(\"in percentage=\"),round(W_net*100/Q_add,2)\n", - "print(\"so overall thermal efficiency=37.24%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.9;pg no: 275" - ] - }, - { - "cell_type": "code", - "execution_count": 96, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.9, Page:275 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\n", - "At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\n", - "For ideal expansion process,s2=s3\n", - "By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\n", - "actual stste at exit of first stage,h3_a in KJ/kg= 2909.88\n", - "actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K= 7.1075\n", - "for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\n", - "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", - "so x4= 0.96\n", - "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", - "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", - "actual enthalpy at exit from second stage,h4_a in KJ/kg= 2646.48\n", - "actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\n", - "so x4_a= 0.99\n", - "x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\n", - "for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x5= 0.87\n", - "h5=2270.43 KJ/kg\n", - "actual enthalpy at exit from third stage,h5_a in KJ/kg= 2345.64\n", - "Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\n", - "By heat balance on first closed feed water heater,(see schematic arrangement)\n", - "h11=hf at 6 bar=670.56 KJ\n", - "m1*h3_a+h10=m1*h11+4.18*150\n", - "(m1*2829.63)+h10=(m1*670.56)+627\n", - "h10+2159.07*m1=627\n", - "By heat balance on second closed feed water heater,(see schematic arrangement)\n", - "h7=hf at 1 bar=417.46 KJ/kg\n", - "m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\n", - "m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\n", - "m2*2467.27-m1*179.2-238.26=0\n", - "heat balance at point of mixing,\n", - "h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\n", - "neglecting pump work,h7=h8\n", - "h10=m2*417.46+(1-m1-m2)*397.1\n", - "substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\n", - "Turbine output per kg of steam generated,Wt in KJ/kg of steam generated= 780.445\n", - "Rate of steam generation required in kg/s= 19.22\n", - "in kg/hr\n", - "capacity of drain pump i.e. FP shown in layout in kg/hr= 16273.96\n", - "so capacity of drain pump=16273.96 kg/hr\n" - ] - } - ], - "source": [ - "#cal of capacity of drain pump\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.9, Page:275 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9\")\n", - "P=15*10**3;#turbine output in KW\n", - "print(\"At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K\")\n", - "h2=3230.9;\n", - "s2=6.9212;\n", - "print(\"For ideal expansion process,s2=s3\")\n", - "s3=s2;\n", - "print(\"By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg\")\n", - "T3=190.97;\n", - "h3=2829.63;\n", - "h3_a=h2-0.8*(h2-h3)\n", - "print(\"actual stste at exit of first stage,h3_a in KJ/kg=\"),round(h3_a,2)\n", - "s3_a=7.1075;\n", - "print(\"actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K=\"),round(s3_a,4)\n", - "print(\"for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar\")\n", - "s4=7.1075;\n", - "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", - "sf=1.3026;\n", - "sfg=6.0568;\n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.958;#approx.\n", - "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", - "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", - "hf=417.46;\n", - "hfg=2258.0;\n", - "h4=hf+x4*hfg\n", - "h4_a=h3_a-.8*(h3_a-h4)\n", - "print(\"actual enthalpy at exit from second stage,h4_a in KJ/kg=\"),round(h4_a,2)\n", - "print(\"actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar\")\n", - "x4_a=(h4_a-hf)/hfg\n", - "print(\"so x4_a=\"),round(x4_a,2)\n", - "print(\"x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K\")\n", - "s4_a=7.2806;\n", - "print(\"for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "x5=(s4_a-sf)/sfg\n", - "print(\"so x5=\"),round(x5,2)\n", - "x5=0.8735;#approx.\n", - "print(\"h5=2270.43 KJ/kg\")\n", - "h5=2270.43;\n", - "h5_a=h4_a-0.8*(h4_a-h5)\n", - "print(\"actual enthalpy at exit from third stage,h5_a in KJ/kg=\"),round(h5_a,2)\n", - "print(\"Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.\")\n", - "print(\"By heat balance on first closed feed water heater,(see schematic arrangement)\")\n", - "print(\"h11=hf at 6 bar=670.56 KJ\")\n", - "h11=670.56;\n", - "print(\"m1*h3_a+h10=m1*h11+4.18*150\")\n", - "print(\"(m1*2829.63)+h10=(m1*670.56)+627\")\n", - "print(\"h10+2159.07*m1=627\")\n", - "print(\"By heat balance on second closed feed water heater,(see schematic arrangement)\")\n", - "print(\"h7=hf at 1 bar=417.46 KJ/kg\")\n", - "h7=417.46;\n", - "print(\"m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)\")\n", - "print(\"m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))\")\n", - "print(\"m2*2467.27-m1*179.2-238.26=0\")\n", - "print(\"heat balance at point of mixing,\")\n", - "print(\"h10=(m1+m2)*h8+(1-m1-m2)*4.18*95\")\n", - "print(\"neglecting pump work,h7=h8\")\n", - "print(\"h10=m2*417.46+(1-m1-m2)*397.1\")\n", - "print(\"substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated\")\n", - "m1=0.1293;\n", - "m2=0.1059;\n", - "Wt=(h2-h3_a)+(1-m1)*(h3_a-h4_a)+(1-m1-m2)*(h4_a-h5_a)\n", - "print(\"Turbine output per kg of steam generated,Wt in KJ/kg of steam generated=\"),round(Wt,3)\n", - "P/Wt\n", - "print(\"Rate of steam generation required in kg/s=\"),round(P/Wt,2)\n", - "print(\"in kg/hr\")\n", - "P*3600/Wt\n", - "(m1+m2)*69192\n", - "print(\"capacity of drain pump i.e. FP shown in layout in kg/hr=\"),round((m1+m2)*69192,2)\n", - "print(\"so capacity of drain pump=16273.96 kg/hr\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.10;pg no: 277" - ] - }, - { - "cell_type": "code", - "execution_count": 97, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.10, Page:277 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\n", - "at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\n", - "By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\n", - "actual enthapy at 3_a,h3_a in KJ/kg= 3097.0\n", - "enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\n", - "for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\n", - "s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x6= 0.83\n", - "h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "for actual expansion process in LP turbine.\n", - "h6_a=h4-0.85*(h4-h6) in KJ/kg 2319.4\n", - "Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\n", - "s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\n", - "from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\n", - "so x5= 1.0\n", - "h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\n", - "from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\n", - "actual enthalpy,h5_a in KJ/kg= 2790.16\n", - "enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\n", - "specific volume at inlet of CEP,v7=0.001008 m^3/kg\n", - "enthalpy at inlet of CEP,h7=168.79 KJ/kg\n", - "for pumping process 7-8,h8 in KJ/kg= 169.15\n", - "Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\n", - "m*h5+(1-m)*h8=h9\n", - "so m in kg /kg of steam generated= 0.33\n", - "For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\n", - "h1= in KJ/kg= 1015.59\n", - "Net work per kg of steam generated,W_net=in KJ/kg steam generated= 938.83\n", - "heat added per kg of steam generated,q_add in KJ/kg of steam generated= 2405.41\n", - "Thermal efficiency,n= 0.39\n", - "in percentage= 39.03\n", - "so thermal efficiency=39.03%%\n", - "NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\n" - ] - } - ], - "source": [ - "#cal of cycle efficiency\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.10, Page:277 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10\")\n", - "print(\"at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K\")\n", - "h2=3287.1;\n", - "s2=6.6327;\n", - "print(\"By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg\")\n", - "h3=3049.48;\n", - "h3_a=h2-0.80*(h2-h3)\n", - "print(\"actual enthapy at 3_a,h3_a in KJ/kg=\"),round(h3_a,2)\n", - "print(\"enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K\")\n", - "h4=3230.9;\n", - "s4=6.9212;\n", - "print(\"for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.\")\n", - "s6=s4;\n", - "print(\"s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "x6=(s6-sf)/sfg\n", - "print(\"so x6=\"),round(x6,2)\n", - "x6=0.827;#approx.\n", - "print(\"h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0;\n", - "h6=hf+x6*hfg\n", - "print(\"for actual expansion process in LP turbine.\")\n", - "h6_a=h4-0.85*(h4-h6)\n", - "print(\"h6_a=h4-0.85*(h4-h6) in KJ/kg\"),round(h6_a,2)\n", - "print(\"Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.\")\n", - "p5=3.61;\n", - "s5=s4;\n", - "print(\"s5_a=6.9212=sf at 140oc+x5*sfg at 140oc\")\n", - "print(\"from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K\")\n", - "sf=1.7391;\n", - "sfg=5.1908;\n", - "x5=(s5-sf)/sfg\n", - "print(\"so x5=\"),round(x5,2)\n", - "x5=0.99;#approx.\n", - "print(\"h5=hf at 140oc+x5*hfg at 140oc in KJ/kg\")\n", - "print(\"from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg\")\n", - "hf=589.13;\n", - "hfg=2144.7;\n", - "h5=hf+x5*hfg\n", - "h5_a=h4-0.85*(h4-h5)\n", - "print(\"actual enthalpy,h5_a in KJ/kg=\"),round(h5_a,2)\n", - "print(\"enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg\")\n", - "h9=1008.42;\n", - "print(\"specific volume at inlet of CEP,v7=0.001008 m^3/kg\")\n", - "v7=0.001008;\n", - "print(\"enthalpy at inlet of CEP,h7=168.79 KJ/kg\")\n", - "h7=168.79;\n", - "h8=h7+v7*(3.61-0.075)*10**2\n", - "print(\"for pumping process 7-8,h8 in KJ/kg=\"),round(h8,2)\n", - "print(\"Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.\")\n", - "print(\"m*h5+(1-m)*h8=h9\")\n", - "m=(h9-h8)/(h5-h8)\n", - "print(\"so m in kg /kg of steam generated=\"),round(m,2)\n", - "print(\"For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg\")\n", - "v9=0.00108;\n", - "h1=h9+v9*(70-3.61)*10**2\n", - "print(\"h1= in KJ/kg=\"),round(h1,2) \n", - "W_net=(h2-h3_a)+(h4-h5_a)+(1-m)*(h5_a-h6_a)-((1-m)*(h8-h7)+(h1-h9))\n", - "print(\"Net work per kg of steam generated,W_net=in KJ/kg steam generated=\"),round(W_net,2)\n", - "q_add=(h2-h1)+(h4-h3_a)\n", - "print(\"heat added per kg of steam generated,q_add in KJ/kg of steam generated=\"),round(q_add,2)\n", - "n=W_net/q_add\n", - "print(\"Thermal efficiency,n=\"),round(n,2)\n", - "n=n*100\n", - "print(\"in percentage=\"),round(n,2)\n", - "print(\"so thermal efficiency=39.03%%\")\n", - "print(\"NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.11;pg no: 279" - ] - }, - { - "cell_type": "code", - "execution_count": 98, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.11, Page:279 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\n", - "Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\n", - "for isentropic expansion 2-3-4-5,s2=s3=s4=s5\n", - "Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\n", - "s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\n", - "so x3=(s3-sf)/sfg\n", - "from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\n", - "h3=hf+x3*hfg in KJ/kg\n", - "from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\n", - "s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\n", - "so x4=(s4-sf)/sfg\n", - "from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\n", - "so h4=hf+x4*hfg in KJ/kg\n", - "from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\n", - "s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\n", - "so x5=(s5-sf)/sfg\n", - "from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\n", - "h5=hf+x5*hfg in KJ/kg\n", - "from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\n", - "h6=hf at 0.05 bar=137.82 KJ/kg\n", - "v6=vf at 0.05 bar=0.001005 m^3/kg\n", - "h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\n", - "h8=hf at 1.5 bar=467.11 KJ/kg\n", - "v8=0.001053 m^3/kg=vf at 1.5 bar\n", - "h9=h8+v8*(150-1.5)*10^2 in KJ/kg\n", - "h10=hf at 150 bar=1610.5 KJ/kg\n", - "v10=0.001658 m^3/kg=vf at 150 bar\n", - "h12=h10+v10*(150-10)*10^2 in KJ/kg\n", - "Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\n", - "Heat balance on closed feed water heater yields,\n", - "m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\n", - "so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\n", - "heat balance on open feed water can be given as under,\n", - "m2*h4+(1-m1-m2)*h7=(1-m1)*h8\n", - "so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\n", - "for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\n", - "For mixing after closed feed water heater,\n", - "h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\n", - "Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\n", - "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\n", - "heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\n", - "cycle thermal efficiency,n=W_net/q_add 0.48\n", - "in percentage 47.59\n", - "Net power developed in KW=1219*300 in KW 365700.0\n", - "cycle thermal efficiency=47.6%\n", - "Net power developed=365700 KW\n" - ] - } - ], - "source": [ - "#cal of cycle thermal efficiency,Net power developed\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.11, Page:279 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11\")\n", - "print(\"Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K\")\n", - "h2=3308.6;\n", - "s2=6.3443;\n", - "print(\"for isentropic expansion 2-3-4-5,s2=s3=s4=s5\")\n", - "s3=s2;\n", - "s4=s3;\n", - "s5=s4;\n", - "print(\"Let dryness fraction of states 3,4 and 5 be x3,x4 and x5\")\n", - "print(\"s3=6.3443=sf at 10 bar+x3*sfg at 10 bar\")\n", - "print(\"so x3=(s3-sf)/sfg\")\n", - "print(\"from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K\")\n", - "sf=2.1387;\n", - "sfg=4.4478;\n", - "x3=(s3-sf)/sfg\n", - "x3=0.945;#approx.\n", - "print(\"h3=hf+x3*hfg in KJ/kg\")\n", - "print(\"from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg\")\n", - "hf=762.81;\n", - "hfg=2015.3;\n", - "h3=hf+x3*hfg\n", - "print(\"s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar\")\n", - "print(\"so x4=(s4-sf)/sfg\")\n", - "print(\"from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K\")\n", - "sf=1.4336;\n", - "sfg=5.7897;\n", - "x4=(s4-sf)/sfg\n", - "x4=0.848;#approx.\n", - "print(\"so h4=hf+x4*hfg in KJ/kg\")\n", - "print(\"from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg\")\n", - "hf=467.11;\n", - "hfg=2226.5;\n", - "h4=hf+x4*hfg\n", - "print(\"s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar\")\n", - "print(\"so x5=(s5-sf)/sfg\")\n", - "print(\"from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K\")\n", - "sf=0.4764;\n", - "sfg=7.9187;\n", - "x5=(s5-sf)/sfg\n", - "x5=0.739;#approx.\n", - "print(\"h5=hf+x5*hfg in KJ/kg\")\n", - "print(\"from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg\")\n", - "hf=137.82;\n", - "hfg=2423.7;\n", - "h5=hf+x5*hfg \n", - "print(\"h6=hf at 0.05 bar=137.82 KJ/kg\")\n", - "h6=137.82;\n", - "print(\"v6=vf at 0.05 bar=0.001005 m^3/kg\")\n", - "v6=0.001005;\n", - "print(\"h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg\")\n", - "h7=h6+v6*(1.5-0.05)*10**2\n", - "print(\"h8=hf at 1.5 bar=467.11 KJ/kg\")\n", - "h8=467.11; \n", - "print(\"v8=0.001053 m^3/kg=vf at 1.5 bar\")\n", - "v8=0.001053;\n", - "print(\"h9=h8+v8*(150-1.5)*10^2 in KJ/kg\")\n", - "h9=h8+v8*(150-1.5)*10**2\n", - "print(\"h10=hf at 150 bar=1610.5 KJ/kg\")\n", - "h10=1610.5; \n", - "print(\"v10=0.001658 m^3/kg=vf at 150 bar\")\n", - "v10=0.001658;\n", - "print(\"h12=h10+v10*(150-10)*10^2 in KJ/kg\")\n", - "h12=h10+v10*(150-10)*10**2\n", - "print(\"Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.\")\n", - "print(\"Heat balance on closed feed water heater yields,\")\n", - "print(\"m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150\")\n", - "print(\"so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.\")\n", - "m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)\n", - "print(\"heat balance on open feed water can be given as under,\")\n", - "print(\"m2*h4+(1-m1-m2)*h7=(1-m1)*h8\")\n", - "print(\"so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam\")\n", - "m2=((1-m1)*(h8-h7))/(h4-h7)\n", - "print(\"for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s\")\n", - "print(\"For mixing after closed feed water heater,\")\n", - "print(\"h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg\")\n", - "h1=(4.18*150)*(1-m1)+m1*h12\n", - "print(\"Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}\")\n", - "print(\"W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.\")\n", - "W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-((1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10)))\n", - "print(\"heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg\")\n", - "q_add=(h2-h1)\n", - "n=W_net/q_add\n", - "print(\"cycle thermal efficiency,n=W_net/q_add\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"Net power developed in KW=1219*300 in KW\"),round(1219*300,2)\n", - "print(\"cycle thermal efficiency=47.6%\")\n", - "print(\"Net power developed=365700 KW\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.12;pg no: 282" - ] - }, - { - "cell_type": "code", - "execution_count": 99, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.12, Page:282 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\n", - "At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", - "For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\n", - "state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\n", - "since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\n", - "At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\n", - "At state 3,h3=2930.57 KJ/kg\n", - "At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\n", - "At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\n", - "From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\n", - "Let dryness fraction at state 5_a be x5,\n", - "s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x5_a=(s5_a-sf)/sfg\n", - "h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\n", - "from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\n", - "Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\n", - "m1_a*h3+h9=m1*h10+4.18*200\n", - "so m1_a=(4.18*200-h9)/(h3-h10) in kg\n", - "Applying heat balance at open feed water heater,\n", - "m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\n", - "so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\n", - "Net work per kg steam generated\n", - "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\n", - "Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\n", - "Thermal efficiency,n= 0.45\n", - "in percentage 45.04\n", - "% increase in thermal efficiency due to reheating= 0.56\n", - "so thermal efficiency of reheat cycle=45.03%\n", - "% increase in efficiency due to reheating=0.56%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,steam generation rate\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.12, Page:282 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12\")\n", - "P=100*10**3;#net power output in KW\n", - "print(\"At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", - "h2=3373.7;\n", - "s2=6.5966;\n", - "print(\"For isentropic expansion between 2-3-4-5,s2=s3=s4=s5\")\n", - "s3=s2;\n", - "s4=s3;\n", - "s5=s4;\n", - "print(\"state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg\")\n", - "T3=261.6;\n", - "h3=2930.57;\n", - "print(\"since s4 For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11\")\n", - "print(\"At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K\")\n", - "h2=3373.7;\n", - "s2=6.5966;\n", - "print(\"At state 3,h3=2930.57 KJ/kg\")\n", - "h3=2930.57;\n", - "print(\"At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K\")\n", - "h3_a=3247.6;\n", - "s3_a=7.1271;\n", - "print(\"At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K\")\n", - "s4_a=s3_a;\n", - "s5_a=s4_a;\n", - "print(\"From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg\")\n", - "h4_a=2841.02;\n", - "print(\"Let dryness fraction at state 5_a be x5,\")\n", - "print(\"s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "print(\"so x5_a=(s5_a-sf)/sfg\")\n", - "x5_a=(s5_a-sf)/sfg\n", - "x5_a=0.853;#approx.\n", - "print(\"h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "h5_a=hf+x5_a*hfg\n", - "print(\"Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.\")\n", - "print(\"m1_a*h3+h9=m1*h10+4.18*200\")\n", - "print(\"so m1_a=(4.18*200-h9)/(h3-h10) in kg\")\n", - "m1_a=(4.18*200-h9)/(h3-h10)\n", - "m1_a=0.114;#approx.\n", - "print(\"Applying heat balance at open feed water heater,\")\n", - "print(\"m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8\")\n", - "print(\"so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg\")\n", - "m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7)\n", - "m2_a=0.131;#approx.\n", - "print(\"Net work per kg steam generated\")\n", - "print(\"w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg\")\n", - "w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-((1-m1_a-m2_a)*(h7-h6)+(h9-h8))\n", - "print(\"Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg\")\n", - "q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)\n", - "n=w_net/q_add\n", - "print(\"Thermal efficiency,n=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"% increase in thermal efficiency due to reheating=\"),round((0.4503-0.4478)*100/0.4478,2)\n", - "print(\"so thermal efficiency of reheat cycle=45.03%\")\n", - "print(\"% increase in efficiency due to reheating=0.56%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.13;pg no: 286" - ] - }, - { - "cell_type": "code", - "execution_count": 100, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.13, Page:286 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\n", - "For mercury cycle,\n", - "insentropic heat drop=349-234.5 in KJ/kg Hg\n", - "actual heat drop=0.85*114.5 in KJ/kg Hg\n", - "Heat rejected in condenser=(349-97.325-35)in KJ/kg\n", - "heat added in boiler=349-35 in KJ/kg\n", - "For steam cycle,\n", - "Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\n", - "Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\n", - "Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\n", - "Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\n", - "Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\n", - "for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\n", - "state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\n", - "state 4 lies in wet region,say with dryness fraction x4\n", - "s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\n", - "so x4=(s4-sf)/sfg\n", - "from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\n", - "h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\n", - "from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\n", - "Let state 5 lie in wet region with dryness fraction x5,\n", - "s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\n", - "so x5=(s5-sf)/sfg\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "h5=hf+x5*hfg in KJ/kg\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\n", - "h7=h6+v6*(1-0.075)*10^2 in KJ/kg\n", - "from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\n", - "h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\n", - "Applying heat balance on CFWH1,T1=150oc and also T15=150oc\n", - "m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\n", - "(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\n", - "Applying heat balance on CFEH2,T11=90oc\n", - "m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\n", - "(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\n", - "Heat balance at mixing between CFWH1 and CFWH2,\n", - "(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\n", - "376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\n", - "For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\n", - "from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\n", - "solving above equations,we get\n", - "m1=0.102 kg per kg steam generated\n", - "m2=0.073 kg per kg steam generated\n", - "pump work in process 13-14,h14-h13=v13*(40-8)*10^2\n", - "so h14-h13 in KJ/kg\n", - "Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\n", - "net work per kg of steam,w_net=w_mercury+w_steam\n", - "w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\n", - "thermal efficiency of binary vapour cycle=w_net/q_add 0.55\n", - "in percentage 55.36\n", - "so thermal efficiency=55.36%\n", - "NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.13, Page:286 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13\")\n", - "print(\"For mercury cycle,\")\n", - "print(\"insentropic heat drop=349-234.5 in KJ/kg Hg\")\n", - "349-234.5\n", - "print(\"actual heat drop=0.85*114.5 in KJ/kg Hg\")\n", - "0.85*114.5\n", - "print(\"Heat rejected in condenser=(349-97.325-35)in KJ/kg\")\n", - "(349-97.325-35)\n", - "print(\"heat added in boiler=349-35 in KJ/kg\")\n", - "349-35\n", - "print(\"For steam cycle,\")\n", - "print(\"Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg\")\n", - "h=2767.13;\n", - "print(\"Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg\")\n", - "h2=3330.3;\n", - "print(\"Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K\")\n", - "s2=6.9363;\n", - "print(\"Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg\")\n", - "h-4.18*150\n", - "print(\"Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam\")\n", - "2140.13/216.675\n", - "print(\"for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K\")\n", - "s3=s2;\n", - "s4=s3;\n", - "s5=s4;\n", - "print(\"state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg\")\n", - "h3=2899.23;\n", - "print(\"state 4 lies in wet region,say with dryness fraction x4\")\n", - "print(\"s4=6.9363=sf at 1 bar+x4*sfg at 1 bar\")\n", - "print(\"so x4=(s4-sf)/sfg\")\n", - "print(\"from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K\")\n", - "sf=1.3026;\n", - "sfg=6.0568;\n", - "x4=(s4-sf)/sfg\n", - "x4=0.93;#approx.\n", - "print(\"h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg\")\n", - "print(\"from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg\")\n", - "hf=417.46;\n", - "hfg=2258.0;\n", - "h4=hf+x4*hfg\n", - "print(\"Let state 5 lie in wet region with dryness fraction x5,\")\n", - "print(\"s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar\")\n", - "print(\"so x5=(s5-sf)/sfg\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "x5=(s5-sf)/sfg\n", - "x5=0.828;#approx.\n", - "print(\"h5=hf+x5*hfg in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0;\n", - "h5=hf+x5*hfg\n", - "print(\"Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.\")\n", - "print(\"h7=h6+v6*(1-0.075)*10^2 in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg\")\n", - "h6=168.79;\n", - "v6=0.001008;\n", - "h7=h6+v6*(1-0.075)*10**2\n", - "print(\"h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg\")\n", - "h9=417.46;\n", - "h13=721.11;\n", - "print(\"Applying heat balance on CFWH1,T1=150oc and also T15=150oc\")\n", - "T1=150;\n", - "T15=150;\n", - "print(\"m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)\")\n", - "print(\"(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)\")\n", - "print(\"Applying heat balance on CFEH2,T11=90oc\")\n", - "T11=90;\n", - "print(\"m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90\")\n", - "print(\"(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)\")\n", - "print(\"Heat balance at mixing between CFWH1 and CFWH2,\")\n", - "print(\"(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12\")\n", - "print(\"376.2*(1-m1-m2)+m2*h10=(1-m1)*h12\")\n", - "print(\"For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg\")\n", - "print(\"from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg\")\n", - "h9=417.46;\n", - "v9=0.001043;\n", - "h10=h9+v9*(8-1)*10**2 \n", - "print(\"solving above equations,we get\")\n", - "print(\"m1=0.102 kg per kg steam generated\")\n", - "print(\"m2=0.073 kg per kg steam generated\")\n", - "m1=0.102;\n", - "m2=0.073;\n", - "print(\"pump work in process 13-14,h14-h13=v13*(40-8)*10^2\")\n", - "print(\"so h14-h13 in KJ/kg\")\n", - "v13=0.001252;\n", - "v13*(40-8)*10**2\n", - "print(\"Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam\")\n", - "q_add=(9.88*314)+(3330.3-2767.13)\n", - "print(\"net work per kg of steam,w_net=w_mercury+w_steam\")\n", - "print(\"w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg\")\n", - "w_net=(9.88*97.325)+((h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h7-h6)-m2*(h10-h9)-m1*4.006)\n", - "print(\"thermal efficiency of binary vapour cycle=w_net/q_add\"),round(w_net/q_add,2)\n", - "print(\"in percentage\"),round(w_net*100/q_add,2)\n", - "print(\"so thermal efficiency=55.36%\")\n", - "print(\"NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.14;pg no: 288" - ] - }, - { - "cell_type": "code", - "execution_count": 101, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.14, Page:288 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\n", - "This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\n", - "For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\n", - "ideally, s2=s1=6.7664 KJ/kg K\n", - "s2=sf at 0.075 bar +x3* sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x3=(s2-sf)/sfg\n", - "h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\n", - "for LP:at inlet of LP steam\n", - "h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\n", - "Enthalpy at exit,h_3LP=2222.34 KJ/kg\n", - "actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\n", - "HP steam consumption at full load=P*0.7457/h_HP in kg/s\n", - "HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\n", - "LP steam consumption at full load=P*0.7457/h_LP in kg/s\n", - "LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\n", - "The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\n", - "or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\n", - "Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\n", - "x=load,hp\n", - "y_HP=m_HP*x+C_HP\n", - "0.254=m_HP*0+C_HP\n", - "so C_HP=0.254\n", - "2.54=m_HP*2500+C_HP\n", - "so m_HP=(2.54-C_HP)/2500\n", - "so y_HP=9.144*10^-4*x_HP+0.254\n", - "Willans line for LP:y_LP=m_LP*x_LP+C_LP\n", - "0.481=m_LP*0+C_LP\n", - "so C_LP=0.481\n", - "4.81=m_LP*2500+C_LP\n", - "so m_LP=(4.81-C_LP)/2500\n", - "so y_LP=1.732*10^-3*x_LP+0.481\n", - "Total output(load) from mixed turbine,x=x_HP+x_LP\n", - "For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\n", - "from y_LP=1.732*10^-3*x_LP+0.481,\n", - "x_LP=(y_LP-0.481)/1.732*10^-3\n", - "since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\n", - "from y_HP=9.144*10^-4*x_HP+C_HP in kg/s 0.63\n", - "so HP steam requirement=0.63 kg/s\n" - ] - } - ], - "source": [ - "#cal of HP steam required\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.14, Page:288 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14\")\n", - "n=0.8;#efficiency of both HP and LP turbine\n", - "P=2500;#output in hp\n", - "print(\"This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.\")\n", - "print(\"For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K\")\n", - "h1=3023.5;\n", - "s1=6.7664;\n", - "print(\"ideally, s2=s1=6.7664 KJ/kg K\")\n", - "s2=s1;\n", - "print(\"s2=sf at 0.075 bar +x3* sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "print(\"so x3=(s2-sf)/sfg\")\n", - "x3=(s2-sf)/sfg\n", - "x3=0.806;#approx.\n", - "print(\"h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0; \n", - "h_3HP=hf+x3*hfg\n", - "print(\"actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg\")\n", - "h_HP=(h1-h_3HP)*n\n", - "print(\"for LP:at inlet of LP steam\")\n", - "print(\"h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K\")\n", - "h2=2706.7;\n", - "s2=7.1271;\n", - "print(\"Enthalpy at exit,h_3LP=2222.34 KJ/kg\")\n", - "h_3LP=2222.34;\n", - "print(\"actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg\")\n", - "h_LP=(h2-h_3LP)*n\n", - "print(\"HP steam consumption at full load=P*0.7457/h_HP in kg/s\")\n", - "P*0.7457/h_HP\n", - "print(\"HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s\")\n", - "0.10*(P*0.7457/h_HP)\n", - "print(\"LP steam consumption at full load=P*0.7457/h_LP in kg/s\")\n", - "P*0.7457/h_LP\n", - "print(\"LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s\")\n", - "0.10*(P*0.7457/h_LP)\n", - "print(\"The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.\")\n", - "print(\"or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.\")\n", - "print(\"Willians line for HP:y=m*x+C,here y=steam consumption,kg/s\")\n", - "print(\"x=load,hp\")\n", - "print(\"y_HP=m_HP*x+C_HP\")\n", - "print(\"0.254=m_HP*0+C_HP\")\n", - "print(\"so C_HP=0.254\")\n", - "C_HP=0.254;\n", - "print(\"2.54=m_HP*2500+C_HP\")\n", - "print(\"so m_HP=(2.54-C_HP)/2500\")\n", - "m_HP=(2.54-C_HP)/2500\n", - "print(\"so y_HP=9.144*10^-4*x_HP+0.254\")\n", - "print(\"Willans line for LP:y_LP=m_LP*x_LP+C_LP\")\n", - "print(\"0.481=m_LP*0+C_LP\")\n", - "print(\"so C_LP=0.481\")\n", - "C_LP=0.481;\n", - "print(\"4.81=m_LP*2500+C_LP\")\n", - "print(\"so m_LP=(4.81-C_LP)/2500\")\n", - "m_LP=(4.81-C_LP)/2500\n", - "print(\"so y_LP=1.732*10^-3*x_LP+0.481\")\n", - "print(\"Total output(load) from mixed turbine,x=x_HP+x_LP\")\n", - "print(\"For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s\")\n", - "y_LP=1.5;\n", - "print(\"from y_LP=1.732*10^-3*x_LP+0.481,\")\n", - "print(\"x_LP=(y_LP-0.481)/1.732*10^-3\")\n", - "x_LP=(y_LP-0.481)/(1.732*10**-3)\n", - "print(\"since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,\")\n", - "x_HP=411.66;\n", - "y_HP=9.144*10**-4*x_HP+C_HP\n", - "print(\"from y_HP=9.144*10^-4*x_HP+C_HP in kg/s\"),round(y_HP,2)\n", - "print(\"so HP steam requirement=0.63 kg/s\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.15;pg no: 289" - ] - }, - { - "cell_type": "code", - "execution_count": 102, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.15, Page:289 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\n", - "Let us carry out analysis for 1 kg of steam generated in boiler.\n", - "Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\n", - "state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\n", - "Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\n", - "so x3= 0.86\n", - "from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\n", - "h3=2404.94 KJ/kg\n", - "If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\n", - "mass of moisture retained in separator(m)=(1-x3)*0.5 kg\n", - "Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\n", - "Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\n", - "Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\n", - "(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\n", - "so T in degree celcius= 68.425\n", - "so temperature of water leaving hotwell=68.425 degree celcius\n", - "Applying heat balanced on trap\n", - "0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\n", - "so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\n", - "from steam tables,at 2 bar,hf=504.70 KJ/kg\n", - "Therefore,heat transferred in process heater in KJ/kg steam generated= 1023.172\n", - "so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\n", - "For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\n", - "Let dryness fraction be x10\n", - "s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\n", - "so x10=(s10-sf)/sfg\n", - "h10=hf at 0.075 bar+x10*hfg at 0.075 bar\n", - "from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\n", - "so h10=hf+x10*hfg in KJ/kg \n", - "net work output,neglecting pump work per kg of steam generated,\n", - "w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\n", - "Heat added in boiler per kg steam generated,q_add in KJ/kg= 2674.68\n", - "thermal efficiency=w_net/q_add 0.28\n", - "in percentage 27.59\n", - "so Thermal efficiency=27.58%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,heat transferred and temperature\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.15, Page:289 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15\")\n", - "print(\"Let us carry out analysis for 1 kg of steam generated in boiler.\")\n", - "print(\"Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K\")\n", - "h2=2960.7;\n", - "s2=6.3615;\n", - "print(\"state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K\")\n", - "s3=s2;\n", - "print(\"Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar\")\n", - "sf=1.5301;\n", - "sfg=5.5970;\n", - "x3=(s3-sf)/sfg\n", - "print(\"so x3=\"),round(x3,2)\n", - "print(\"from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K\")\n", - "x3=0.863;#approx.\n", - "print(\"h3=2404.94 KJ/kg\")\n", - "h3=2404.94;\n", - "print(\"If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator\")\n", - "print(\"mass of moisture retained in separator(m)=(1-x3)*0.5 kg\")\n", - "m=(1-x3)*0.5\n", - "print(\"Therefore,mass of steam entering LPT(m_LP)=0.5-m kg\")\n", - "m_LP=0.5-m\n", - "print(\"Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg\")\n", - "print(\"Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;\")\n", - "print(\"(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)\")\n", - "T=((0.5685*4.18*90)+(0.4315*4.18*40))/4.18\n", - "print(\"so T in degree celcius=\"),round(T,3)\n", - "print(\"so temperature of water leaving hotwell=68.425 degree celcius\")\n", - "print(\"Applying heat balanced on trap\")\n", - "print(\"0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)\")\n", - "print(\"so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg\")\n", - "print(\"from steam tables,at 2 bar,hf=504.70 KJ/kg\")\n", - "hf=504.70;\n", - "h7=((0.5685*4.18*90)-(0.0685*hf))/0.5\n", - "print(\"Therefore,heat transferred in process heater in KJ/kg steam generated=\"),round(0.5*(h3-h7),3)\n", - "print(\"so heat transferred per kg steam generated=1023.175 KJ/kg steam generated\")\n", - "print(\"For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K\")\n", - "s10=s3;\n", - "print(\"Let dryness fraction be x10\")\n", - "print(\"s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K\")\n", - "sf=0.5764;\n", - "sfg=7.6750;\n", - "print(\"so x10=(s10-sf)/sfg\")\n", - "x10=(s10-sf)/sfg\n", - "x10=0.754;#approx.\n", - "print(\"h10=hf at 0.075 bar+x10*hfg at 0.075 bar\")\n", - "print(\"from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg\")\n", - "hf=168.79;\n", - "hfg=2406.0;\n", - "print(\"so h10=hf+x10*hfg in KJ/kg \")\n", - "h10=hf+x10*hfg \n", - "print(\"net work output,neglecting pump work per kg of steam generated,\")\n", - "print(\"w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated\")\n", - "w_net=(h2-h3)*1+0.4315*(h3-h10) \n", - "q_add=(h2-4.18*68.425)\n", - "print(\"Heat added in boiler per kg steam generated,q_add in KJ/kg=\"),round(q_add,2)\n", - "w_net/q_add\n", - "print(\"thermal efficiency=w_net/q_add\"),round(w_net/q_add,2)\n", - "print(\"in percentage\"),round(w_net*100/q_add,2)\n", - "print(\"so Thermal efficiency=27.58%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.16;pg no: 291" - ] - }, - { - "cell_type": "code", - "execution_count": 103, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.16, Page:291 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\n", - "from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\n", - "Assuming isentropic expansion in nozzle,s1=s2=6.9486\n", - "Letdryness fraction at state 2,x2=0.864\n", - "s2=sf at 0.2 bar+x2*sfg at 0.2 bar\n", - "from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\n", - "so x2= 0.86\n", - "hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\n", - "from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\n", - "considering pump work to be of isentropic type,deltah_34=v3*deltap_34\n", - "from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\n", - "or deltah_34 in KJ/kg= 7.1\n", - "pump work,Wp in KJ/kg= 7.1\n", - "turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\n", - "net work(W_net)=Wt-Wp in KJ/kg\n", - "power produced(P)=mass flow rate*W_net in KJ/s\n", - "so net power=43.22 MW\n", - "heat supplied in boiler(Q)=(h1-h4) in KJ/kg\n", - "enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\n", - "total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s 114534.05\n", - "thermal efficiency=net work/heat supplied=W_net/Q 0.38\n", - "in percentage 37.73\n", - "so thermal efficiency=37.73%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,net power\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.16, Page:291 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16\")\n", - "m=35;#mass flow rate in kg/s\n", - "print(\"from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K\")\n", - "h1=3530.9;\n", - "s1=6.9486;\n", - "print(\"Assuming isentropic expansion in nozzle,s1=s2=6.9486\")\n", - "s2=s1;\n", - "print(\"Letdryness fraction at state 2,x2=0.864\")\n", - "print(\"s2=sf at 0.2 bar+x2*sfg at 0.2 bar\")\n", - "print(\"from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K\")\n", - "sf=0.8320;\n", - "sfg=7.0766;\n", - "x2=(s2-sf)/sfg\n", - "print(\"so x2=\"),round(x2,2)\n", - "x2=0.864;#approx.\n", - "print(\"hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg\")\n", - "print(\"from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg\")\n", - "hf=251.4;\n", - "hfg=2358.3;\n", - "h2=hf+x2*hfg\n", - "print(\"considering pump work to be of isentropic type,deltah_34=v3*deltap_34\")\n", - "print(\"from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg\")\n", - "v3=0.001017;\n", - "p3=70;#;pressure of steam entering turbine in bar\n", - "p4=0.20;#condenser pressure in bar\n", - "deltah_34=v3*(p3-p4)*100\n", - "print(\"or deltah_34 in KJ/kg=\"),round(deltah_34,2)\n", - "Wp=deltah_34\n", - "print(\"pump work,Wp in KJ/kg=\"),round(Wp,2)\n", - "print(\"turbine work,Wt=deltah_12=(h1-h2)in KJ/kg\")\n", - "Wt=(h1-h2)\n", - "print(\"net work(W_net)=Wt-Wp in KJ/kg\")\n", - "W_net=Wt-Wp\n", - "print(\"power produced(P)=mass flow rate*W_net in KJ/s\")\n", - "P=m*W_net\n", - "print(\"so net power=43.22 MW\")\n", - "print(\"heat supplied in boiler(Q)=(h1-h4) in KJ/kg\")\n", - "print(\"enthalpy at state 4,h4=h3+deltah_34 in KJ/kg\")\n", - "h3=hf;\n", - "h4=h3+deltah_34 \n", - "Q=m*(h1-h4)\n", - "print(\"total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s\"),round(Q,2)\n", - "print(\"thermal efficiency=net work/heat supplied=W_net/Q\"),round(P/Q,2)\n", - "print(\"in percentage\"),round(P*100/Q,2)\n", - "print(\"so thermal efficiency=37.73%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 8.17;pg no: 292" - ] - }, - { - "cell_type": "code", - "execution_count": 104, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 8.1, Page:292 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 8 Example 17\n", - "from steam tables,h1=3625.3 KJ/s,s1=6.9029 KJ/kg K\n", - "due to isentropic expansion,s1=s2=s3=6.9029 KJ/kg K\n", - "at state 2,i.e at pressure of 2 MPa and entropy 6.9029 KJ/kg K\n", - "by interpolating state for s2 between 2 MPa,300 degree celcius and 2 MPa,350 degree celcius from steam tables,\n", - "h2=3105.08 KJ/kg \n", - "for state 3,i.e at pressure of 0.01 MPa entropy,s3 lies in wet region as s3In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,mass of steam\n", - "#intiation of all variables\n", - "# Chapter 8\n", - "print\"Example 8.18, Page:294 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 8 Example 18\")\n", - "W_net=50*10**3;#net output of turbine in KW\n", - "print(\"from steam tables,at inlet to first stage of turbine,h1=h at 100 bar,500oc=3373.7 KJ/kg,s1=s at 100 bar,500oc=6.5966 KJ/kg\")\n", - "h1=3373.7;\n", - "s1=6.5966;\n", - "print(\"Due to isentropic expansion,s1=s6=s2 and s3=s8=s4\")\n", - "s2=s1;\n", - "s6=s2;\n", - "print(\"State at 6 i.e bleed state from HP turbine,temperature by interpolation from steam table =261.6oc.\")\n", - "print(\"At inlet to second stage of turbine,h6=2930.572 KJ/kg\")\n", - "h6=2930.572;\n", - "print(\"h3=h at 10 bar,500oc=3478.5 KJ/kg,s3=s at 10 bar,500oc=7.7622 KJ/kg K\")\n", - "h3=3478.5;\n", - "s3=7.7622;\n", - "s4=s3;\n", - "s8=s4;\n", - "print(\"At exit from first stage of turbine i.e. at 10 bar and entropy of 6.5966 KJ/kg K,Temperature by interpolation from steam table at 10 bar and entropy of 6.5966 KJ/kg K\")\n", - "print(\"T2=181.8oc,h2=2782.8 KJ/kg\")\n", - "T2=181.8;\n", - "h2=2782.8;\n", - "print(\"state at 8,i.e bleed state from second stage of expansion,i.e at 4 bar and entropy of 7.7622 KJ/kg K,Temperature by interpolation from steam table,T8=358.98oc=359oc\")\n", - "T8=359;\n", - "print(\"h8=3188.7 KJ/kg\")\n", - "h8=3188.7;\n", - "print(\"state at 4 i.e. at condenser pressure of 0.1 bar and entropy of 7.7622 KJ/kg K,the state lies in wet region.So let the dryness fraction be x4.\")\n", - "print(\"s4=sf at 0.1 bar+x4*sfg at 0.1 bar\")\n", - "print(\"from steam tables,at 0.1 bar,sf=0.6493 KJ/kg K,sfg=7.5009 KJ/kg K\")\n", - "sf=0.6493;\n", - "sfg=7.5009; \n", - "x4=(s4-sf)/sfg\n", - "print(\"so x4=\"),round(x4,2)\n", - "x4=0.95;#approx.\n", - "print(\"h4=hf at 0.1 bar+x4*hfg at 0.1 bar in KJ/kg \")\n", - "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,hfg=2392.8 KJ/kg\")\n", - "hf=191.83;\n", - "hfg=2392.8;\n", - "h4=hf+x4*hfg\n", - "print(\"given,h4=2464.99 KJ/kg,h11=856.8 KJ/kg,h9=hf at 4 bar=604.74 KJ/kg\")\n", - "h4=2464.99;\n", - "h11=856.8;\n", - "h9=604.74;\n", - "print(\"considering pump work,the net output can be given as,\")\n", - "print(\"W_net=W_HPT+W_LPT-(W_CEP+W_FP)\")\n", - "print(\"where,W_HPT={(h1-h6)+(1-m6)*(h6-h2)}per kg of steam from boiler.\")\n", - "print(\"W_LPT={(1-m6)+(h3-h8)*(1-m6-m8)*(h8-h4)}per kg of steam from boiler.\")\n", - "print(\"for closed feed water heater,energy balance yields;\")\n", - "print(\"m6*h6+h10=m6*h7+h11\")\n", - "print(\"assuming condensate leaving closed feed water heater to be saturated liquid,\")\n", - "print(\"h7=hf at 20 bar=908.79 KJ/kg\")\n", - "h7=908.79; \n", - "print(\"due to throttline,h7=h7_a=908.79 KJ/kg\")\n", - "h7_a=h7;\n", - "print(\"for open feed water heater,energy balance yields,\")\n", - "print(\"m6*h7_a+m8*h8+(1-m6-m8)*h5=h9\")\n", - "print(\"for condensate extraction pump,h5-h4_a=v4_a*deltap\")\n", - "print(\"h5-hf at 0.1 bar=vf at 0.1 bar*(4-0.1)*10^2 \")\n", - "print(\"from steam tables,at 0.1 bar,hf=191.83 KJ/kg,vf=0.001010 m^3/kg\")\n", - "hf=191.83;\n", - "vf=0.001010; \n", - "h5=hf+vf*(4-0.1)*10**2\n", - "print(\"so h5 in KJ/kg=\"),round(h5,2)\n", - "print(\"for feed pump,h10-h9=v9*deltap\")\n", - "print(\"h10=h9+vf at 4 bar*(100-4)*10^2 in KJ/kg\")\n", - "print(\"from steam tables,at 4 bar,hf=604.74 KJ/kg,vf=0.001084 m^3/kg \")\n", - "hf=604.74;\n", - "vf=0.001084;\n", - "h10=h9+vf*(100-4)*10**2\n", - "print(\"substituting in energy balance upon closed feed water heater,\")\n", - "m6=(h11-h10)/(h6-h7)\n", - "print(\"m6 in kg per kg of steam from boiler=\"),round(m6,3)\n", - "print(\"substituting in energy balance upon feed water heater,\")\n", - "m8=(h9-m6*h7_a+m6*h5-h5)/(h8-h5)\n", - "print(\"m8 in kg per kg of steam from boiler=\"),round(m8,3)\n", - "print(\"Let the mass of steam entering first stage of turbine be m kg,then\")\n", - "{(h1-h6)+(1-m6)*(h6-h2)}\n", - "print(\"W_HPT=m*{(h1-h6)+(1-m6)*(h6-h2)}\")\n", - "print(\"W_HPT/m=\"),round(((h1-h6)+(1-m6)*(h6-h2)),2)\n", - "print(\"so W_HPT=m*573.24 KJ\")\n", - "print(\"also,W_LPT={(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}per kg of steam from boiler\")\n", - "{(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}\n", - "print(\"W_LPT/m=\"),round(((1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)),2)\n", - "print(\"so W_LPT=m*813.42 KJ\")\n", - "print(\"pump works(negative work)\")\n", - "print(\"W_CEP=m*(1-m6-m8)*(h5-h4_a)\")\n", - "h4_a=191.83;#h4_a=hf at 0.1 bar\n", - "print(\"W_CEP/m=\")\n", - "(1-m6-m8)*(h5-h4_a)\n", - "print(\"so W_CEP=m* 0.304\")\n", - "print(\"W_FP=m*(h10-h9)\")\n", - "print(\"W_FP/m=\"),round((h10-h9),2)\n", - "print(\"so W_FP=m*10.41\")\n", - "print(\"net output,\")\n", - "print(\"W_net=W_HPT+W_LPT-W_CEP-W_FP \")\n", - "print(\"so 50*10^3=(573.24*m+813.42*m-0.304*m-10.41*m)\")\n", - "m=W_net/(573.24+813.42-0.304-10.41)\n", - "print(\"so m in kg/s=\"),round(m,2)\n", - "Q_add=m*(h1-h11)\n", - "print(\"heat supplied in boiler,Q_add in KJ/s=\"),round(m*(h1-h11),2)\n", - "print(\"Thermal efficenncy=\"),round(W_net/Q_add,2)\n", - "print(\"in percentage\"),round(W_net*100/Q_add,2)\n", - "print(\"so mass of steam bled at 20 bar=0.119 kg per kg of steam entering first stage\")\n", - "print(\"mass of steam bled at 4 bar=0.109 kg per kg of steam entering first stage\")\n", - "print(\"mass of steam entering first stage=36.33 kg/s\")\n", - "print(\"thermal efficiency=54.66%\")\n", - "print(\"NOTE=>In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter9.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter9.ipynb deleted file mode 100755 index 606321b3..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter9.ipynb +++ /dev/null @@ -1,1655 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 9:Gas Power Cycles" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.1;pg no: 334" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.1, Page:334 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\n", - "SI engine operate on otto cycle.consider working fluid to be perfect gas.\n", - "here,y=Cp/Cv\n", - "Cp-Cv=R in KJ/kg K\n", - "compression ratio,r=V1/V2=(0.15+V2)/V2\n", - "so V2=0.15/(r-1) in m^3\n", - "so V2=0.03 m^3\n", - "total cylinder volume=V1=r*V2 m^3\n", - "from perfect gas law,P*V=m*R*T\n", - "so m=P1*V1/(R*T1) in kg\n", - "from state 1 to 2 by P*V^y=P2*V2^y\n", - "so P2=P1*(V1/V2)^y in KPa\n", - "also,P1*V1/T1=P2*V2/T2\n", - "so T2=P2*V2*T1/(P1*V1)in K\n", - "from heat addition process 2-3\n", - "Q23=m*CV*(T3-T2)\n", - "T3=T2+(Q23/(m*Cv))in K\n", - "also from,P3*V3/T3=P2*V2/T2\n", - "P3=P2*V2*T3/(V3*T2) in KPa\n", - "for adiabatic expansion 3-4,\n", - "P3*V3^y=P4*V4^y\n", - "and V4=V1\n", - "hence,P4=P3*V3^y/V1^y in KPa\n", - "and from P3*V3/T3=P4*V4/T4\n", - "T4=P4*V4*T3/(P3*V3) in K\n", - "entropy change from 2-3 and 4-1 are same,and can be given as,\n", - "S3-S2=S4-S1=m*Cv*log(T4/T1)\n", - "so entropy change,deltaS_32=deltaS_41 in KJ/K\n", - "heat rejected,Q41=m*Cv*(T4-T1) in KJ\n", - "net work(W) in KJ= 76.75\n", - "efficiency(n)= 0.51\n", - "in percentage 51.16\n", - "mean effective pressure(mep)=work/volume change in KPa= 511.64\n", - "so mep=511.67 KPa\n" - ] - } - ], - "source": [ - "#cal of mean effective pressure\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.1, Page:334 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\")\n", - "Cp=1;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", - "P1=98;#pressure at begining of compression in KPa\n", - "T1=(60+273.15);#temperature at begining of compression in K\n", - "Q23=150;#heat supplied in KJ/kg\n", - "r=6;#compression ratio\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"SI engine operate on otto cycle.consider working fluid to be perfect gas.\")\n", - "print(\"here,y=Cp/Cv\")\n", - "y=Cp/Cv\n", - "y=1.4;#approx.\n", - "print(\"Cp-Cv=R in KJ/kg K\")\n", - "R=Cp-Cv\n", - "print(\"compression ratio,r=V1/V2=(0.15+V2)/V2\")\n", - "print(\"so V2=0.15/(r-1) in m^3\")\n", - "V2=0.15/(r-1)\n", - "print(\"so V2=0.03 m^3\")\n", - "print(\"total cylinder volume=V1=r*V2 m^3\")\n", - "V1=r*V2\n", - "print(\"from perfect gas law,P*V=m*R*T\")\n", - "print(\"so m=P1*V1/(R*T1) in kg\")\n", - "m=P1*V1/(R*T1)\n", - "m=0.183;#approx.\n", - "print(\"from state 1 to 2 by P*V^y=P2*V2^y\")\n", - "print(\"so P2=P1*(V1/V2)^y in KPa\")\n", - "P2=P1*(V1/V2)**y\n", - "print(\"also,P1*V1/T1=P2*V2/T2\")\n", - "print(\"so T2=P2*V2*T1/(P1*V1)in K\")\n", - "T2=P2*V2*T1/(P1*V1)\n", - "print(\"from heat addition process 2-3\")\n", - "print(\"Q23=m*CV*(T3-T2)\")\n", - "print(\"T3=T2+(Q23/(m*Cv))in K\")\n", - "T3=T2+(Q23/(m*Cv))\n", - "print(\"also from,P3*V3/T3=P2*V2/T2\")\n", - "print(\"P3=P2*V2*T3/(V3*T2) in KPa\")\n", - "V3=V2;#constant volume process\n", - "P3=P2*V2*T3/(V3*T2) \n", - "print(\"for adiabatic expansion 3-4,\")\n", - "print(\"P3*V3^y=P4*V4^y\")\n", - "print(\"and V4=V1\")\n", - "V4=V1;\n", - "print(\"hence,P4=P3*V3^y/V1^y in KPa\")\n", - "P4=P3*V3**y/V1**y\n", - "print(\"and from P3*V3/T3=P4*V4/T4\")\n", - "print(\"T4=P4*V4*T3/(P3*V3) in K\")\n", - "T4=P4*V4*T3/(P3*V3)\n", - "print(\"entropy change from 2-3 and 4-1 are same,and can be given as,\")\n", - "print(\"S3-S2=S4-S1=m*Cv*log(T4/T1)\")\n", - "print(\"so entropy change,deltaS_32=deltaS_41 in KJ/K\")\n", - "deltaS_32=m*Cv*math.log(T4/T1)\n", - "deltaS_41=deltaS_32;\n", - "print(\"heat rejected,Q41=m*Cv*(T4-T1) in KJ\")\n", - "Q41=m*Cv*(T4-T1)\n", - "W=Q23-Q41\n", - "print(\"net work(W) in KJ=\"),round(W,2)\n", - "n=W/Q23\n", - "print(\"efficiency(n)=\"),round(W/Q23,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "mep=W/0.15\n", - "print(\"mean effective pressure(mep)=work/volume change in KPa=\"),round(W/0.15,2)\n", - "print(\"so mep=511.67 KPa\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.2;pg no: 336" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.2, Page:336 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\n", - "as given\n", - "Va=V2+(7/8)*(V1-V2)\n", - "Vb=V2+(1/8)*(V1-V2)\n", - "and also\n", - "Pa*Va^y=Pb*Vb^y\n", - "so (Va/Vb)=(Pb/Pa)^(1/y)\n", - "also substituting for Va and Vb\n", - "(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\n", - "so V1/V2=r=1+(4.18*8/1.82) 19.37\n", - "it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\n", - "as given;cut off occurs at(V1-V2)/15 volume\n", - "V3=V2+(V1-V2)/15\n", - "cut off ratio,rho=V3/V2\n", - "air standard efficiency for diesel cycle(n_airstandard)= 0.63\n", - "in percentage 63.23\n", - "overall efficiency(n_overall)=n_airstandard*n_ite*n_mech 0.253\n", - "in percentage 25.3\n", - "fuel consumption,bhp/hr in kg= 0.26\n", - "so compression ratio=19.37\n", - "air standard efficiency=63.25%\n", - "fuel consumption,bhp/hr=0.255 kg\n" - ] - } - ], - "source": [ - "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.2, Page:336 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\")\n", - "Pa=138;#pressure during compression at 1/8 of stroke in KPa\n", - "Pb=1.38*10**3;#pressure during compression at 7/8 of stroke in KPa\n", - "n_ite=0.5;#indicated thermal efficiency\n", - "n_mech=0.8;#mechanical efficiency\n", - "C=41800;#calorific value in KJ/kg\n", - "y=1.4;#expansion constant\n", - "print(\"as given\")\n", - "print(\"Va=V2+(7/8)*(V1-V2)\")\n", - "print(\"Vb=V2+(1/8)*(V1-V2)\")\n", - "print(\"and also\")\n", - "print(\"Pa*Va^y=Pb*Vb^y\")\n", - "print(\"so (Va/Vb)=(Pb/Pa)^(1/y)\")\n", - "(Pb/Pa)**(1/y)\n", - "print(\"also substituting for Va and Vb\")\n", - "print(\"(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\")\n", - "r=1+(4.18*8/1.82)\n", - "print(\"so V1/V2=r=1+(4.18*8/1.82)\"),round(r,2)\n", - "print(\"it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\")\n", - "print(\"as given;cut off occurs at(V1-V2)/15 volume\")\n", - "print(\"V3=V2+(V1-V2)/15\")\n", - "print(\"cut off ratio,rho=V3/V2\")\n", - "rho=1+(r-1)/15\n", - "n_airstandard=1-(1/(r**(y-1)*y))*((rho**y-1)/(rho-1))\n", - "print(\"air standard efficiency for diesel cycle(n_airstandard)=\"),round(n_airstandard,2)\n", - "print(\"in percentage\"),round(n_airstandard*100,2)\n", - "n_airstandard=0.6325;\n", - "n_overall=n_airstandard*n_ite*n_mech\n", - "print(\"overall efficiency(n_overall)=n_airstandard*n_ite*n_mech\"),round(n_overall,3)\n", - "print(\"in percentage\"),round(n_overall*100,2)\n", - "n_overall=0.253;\n", - "75*60*60/(n_overall*C*100)\n", - "print(\"fuel consumption,bhp/hr in kg=\"),round(75*60*60/(n_overall*C*100),2)\n", - "print(\"so compression ratio=19.37\")\n", - "print(\"air standard efficiency=63.25%\")\n", - "print(\"fuel consumption,bhp/hr=0.255 kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.3;pg no: 338" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.3, Page:338 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\n", - "1-2-3-4=cycle a\n", - "1-2_a-3_a-4_a-5=cycle b\n", - "here Cp/Cv=y\n", - "and R=0.293 KJ/kg K\n", - "let us consider 1 kg of air for perfect gas,\n", - "P*V=m*R*T\n", - "so V1=m*R*T1/P1 in m^3\n", - "at state 3,\n", - "P3*V3=m*R*T3\n", - "so T3/V2=P3/(m*R)\n", - "so T3=17064.8*V2............eq1\n", - "for cycle a and also for cycle b\n", - "T3_a=17064.8*V2_a.............eq2\n", - "a> for otto cycle,\n", - "Q23=Cv*(T3-T2)\n", - "so T3-T2=Q23/Cv\n", - "and T2=T3-2394.36.............eq3\n", - "from gas law,P2*V2/T2=P3*V3/T3\n", - "here V2=V3 and using eq 3,we get\n", - "so P2/(T3-2394.36)=5000/T3\n", - "substituting T3 as function of V2\n", - "P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\n", - "P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\n", - "also P1*V1^y=P2*V2^y\n", - "or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\n", - "upon solving it yields\n", - "381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\n", - "or V2^1.4-0.140*V2^0.4-.022=0\n", - "by hit and trial it yields,V2=0.18 \n", - "thus compression ratio,r=V1/V2\n", - "otto cycle efficiency,n_otto=1-(1/r)^(y-1)\n", - "in percentage\n", - "b> for mixed or dual cycle\n", - "Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\n", - "or T3_a-T2_a=850/Cv\n", - "or T2_a=T3_a-1197.2 .............eq4 \n", - "also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\n", - "P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\n", - "or P2_a/(T3_a-1197.2)=5000/T3_a\n", - "also we had seen earlier that T3_a=17064.8*V2_a\n", - "so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\n", - "so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\n", - "or for adiabatic process,1-2_a\n", - "P1*V1^y=P2*V2^y\n", - "so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\n", - "or V2_a^1.4-0.07*V2_a^0.4-0.022=0\n", - "by hit and trial \n", - "V2_a=0.122 m^3\n", - "therefore upon substituting V2_a,\n", - "by eq 5,P2_a in KPa\n", - "by eq 2,T3_a in K\n", - "by eq 4,T2_a in K\n", - "from constant pressure heat addition\n", - "Cp*(T4_a-T3_a)=850\n", - "so T4_a=T3_a+(850/Cp) in K\n", - "also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\n", - "so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \n", - "here P3_a=P4_a and V2_a=V3_a\n", - "using adiabatic formulations V4_a=0.172 m^3\n", - "(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\n", - "so T5=T4_a/(V5/V4_a)^(y-1) in K\n", - "heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\n", - "efficiency of mixed cycle(n_mixed)= 0.57\n", - "in percentage 56.55\n" - ] - }, - { - "data": { - "text/plain": [ - "'NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.'" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "#cal of comparing efficiency of two cycles\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.3, Page:338 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\")\n", - "T1=(100+273.15);#temperature at beginning of compresssion in K\n", - "P1=103;#pressure at beginning of compresssion in KPa\n", - "Cp=1.003;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", - "Q23=1700;#heat added during combustion in KJ/kg\n", - "P3=5000;#maximum pressure in cylinder in KPa\n", - "print(\"1-2-3-4=cycle a\")\n", - "print(\"1-2_a-3_a-4_a-5=cycle b\")\n", - "print(\"here Cp/Cv=y\")\n", - "y=Cp/Cv\n", - "y=1.4;#approx.\n", - "print(\"and R=0.293 KJ/kg K\")\n", - "R=0.293;\n", - "print(\"let us consider 1 kg of air for perfect gas,\")\n", - "m=1;#mass of air in kg\n", - "print(\"P*V=m*R*T\")\n", - "print(\"so V1=m*R*T1/P1 in m^3\")\n", - "V1=m*R*T1/P1\n", - "print(\"at state 3,\")\n", - "print(\"P3*V3=m*R*T3\")\n", - "print(\"so T3/V2=P3/(m*R)\")\n", - "P3/(m*R)\n", - "print(\"so T3=17064.8*V2............eq1\")\n", - "print(\"for cycle a and also for cycle b\")\n", - "print(\"T3_a=17064.8*V2_a.............eq2\")\n", - "print(\"a> for otto cycle,\")\n", - "print(\"Q23=Cv*(T3-T2)\")\n", - "print(\"so T3-T2=Q23/Cv\")\n", - "Q23/Cv\n", - "print(\"and T2=T3-2394.36.............eq3\")\n", - "print(\"from gas law,P2*V2/T2=P3*V3/T3\")\n", - "print(\"here V2=V3 and using eq 3,we get\")\n", - "print(\"so P2/(T3-2394.36)=5000/T3\")\n", - "print(\"substituting T3 as function of V2\")\n", - "print(\"P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\")\n", - "print(\"P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\")\n", - "print(\"also P1*V1^y=P2*V2^y\")\n", - "print(\"or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\")\n", - "print(\"upon solving it yields\")\n", - "print(\"381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\")\n", - "print(\"or V2^1.4-0.140*V2^0.4-.022=0\")\n", - "print(\"by hit and trial it yields,V2=0.18 \")\n", - "V2=0.18;\n", - "print(\"thus compression ratio,r=V1/V2\")\n", - "r=V1/V2\n", - "print(\"otto cycle efficiency,n_otto=1-(1/r)^(y-1)\")\n", - "n_otto=1-(1/r)**(y-1)\n", - "print(\"in percentage\")\n", - "n_otto=n_otto*100\n", - "print(\"b> for mixed or dual cycle\")\n", - "print(\"Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\")\n", - "print(\"or T3_a-T2_a=850/Cv\")\n", - "850/Cv\n", - "print(\"or T2_a=T3_a-1197.2 .............eq4 \")\n", - "print(\"also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\")\n", - "print(\"P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\")\n", - "print(\"or P2_a/(T3_a-1197.2)=5000/T3_a\")\n", - "print(\"also we had seen earlier that T3_a=17064.8*V2_a\")\n", - "print(\"so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\")\n", - "print(\"so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\")\n", - "print(\"or for adiabatic process,1-2_a\")\n", - "print(\"P1*V1^y=P2*V2^y\")\n", - "print(\"so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\")\n", - "print(\"or V2_a^1.4-0.07*V2_a^0.4-0.022=0\")\n", - "print(\"by hit and trial \")\n", - "print(\"V2_a=0.122 m^3\")\n", - "V2_a=0.122;\n", - "print(\"therefore upon substituting V2_a,\")\n", - "print(\"by eq 5,P2_a in KPa\")\n", - "P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a)\n", - "print(\"by eq 2,T3_a in K\")\n", - "T3_a=17064.8*V2_a\n", - "print(\"by eq 4,T2_a in K\")\n", - "T2_a=T3_a-1197.2\n", - "print(\"from constant pressure heat addition\")\n", - "print(\"Cp*(T4_a-T3_a)=850\")\n", - "print(\"so T4_a=T3_a+(850/Cp) in K\")\n", - "T4_a=T3_a+(850/Cp)\n", - "print(\"also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\")\n", - "print(\"so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \")\n", - "print(\"here P3_a=P4_a and V2_a=V3_a\")\n", - "V4_a=V2_a*T4_a/(T3_a)\n", - "print(\"using adiabatic formulations V4_a=0.172 m^3\")\n", - "print(\"(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\")\n", - "V5=V1;\n", - "print(\"so T5=T4_a/(V5/V4_a)^(y-1) in K\")\n", - "T5=T4_a/(V5/V4_a)**(y-1)\n", - "print(\"heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\")\n", - "Q51=Cv*(T5-T1)\n", - "n_mixed=(Q23-Q51)/Q23\n", - "print(\"efficiency of mixed cycle(n_mixed)=\"),round(n_mixed,2)\n", - "print(\"in percentage\"),round(n_mixed*100,2)\n", - "(\"NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.4;pg no: 341" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.4, Page:341 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\n", - "optimum pressure ratio for maximum work output,\n", - "rp=(T_max/T_min)^((y)/(2*(y-1)))\n", - "so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\n", - "so T2=T1*(p2/p1)^((y-1)/y)in K\n", - "For process 3-4,\n", - "T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\n", - "so T4=T3/(rp)^((y-1)/y)in K\n", - "heat supplied,Q23=Cp*(T3-T2)in KJ/kg\n", - "compressor work,Wc in KJ/kg= 301.5\n", - "turbine work,Wt in KJ/kg= 603.0\n", - "thermal efficiency=net work/heat supplied= 0.5\n", - "so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,turbine and compressor work\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.4, Page:341 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\")\n", - "T3=1200;#maximum temperature in K\n", - "T1=300;#minimum temperature in K\n", - "y=1.4;#expansion constant\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"optimum pressure ratio for maximum work output,\")\n", - "print(\"rp=(T_max/T_min)^((y)/(2*(y-1)))\")\n", - "T_max=T3;\n", - "T_min=T1;\n", - "rp=(T_max/T_min)**((y)/(2*(y-1)))\n", - "print(\"so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\")\n", - "print(\"so T2=T1*(p2/p1)^((y-1)/y)in K\")\n", - "T2=T1*(rp)**((y-1)/y)\n", - "print(\"For process 3-4,\")\n", - "print(\"T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\")\n", - "print(\"so T4=T3/(rp)^((y-1)/y)in K\")\n", - "T4=T3/(rp)**((y-1)/y)\n", - "print(\"heat supplied,Q23=Cp*(T3-T2)in KJ/kg\")\n", - "Q23=Cp*(T3-T2)\n", - "Wc=Cp*(T2-T1)\n", - "print(\"compressor work,Wc in KJ/kg=\"),round(Wc,2)\n", - "Wt=Cp*(T3-T4)\n", - "print(\"turbine work,Wt in KJ/kg=\"),round(Wt,2)\n", - "(Wt-Wc)/Q23\n", - "print(\"thermal efficiency=net work/heat supplied=\"),round((Wt-Wc)/Q23,2)\n", - "print(\"so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.5;pg no: 342" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.5, Page:342 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\n", - "gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\n", - "for process 1-2 being isentropic,\n", - "T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y) in K\n", - "considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\n", - "so T2_a=T1+((T2-T1)/n_compr)in K\n", - "during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\n", - "heat added=mf*q\n", - "=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\n", - "or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\n", - "so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\n", - "for expansion 3-4 being\n", - "T4/T3=(P4/P3)^((n-1)/n)\n", - "so T4=T3*(P4/P3)^((n-1)/n) in K\n", - "actaul temperature at turbine inlet considering internal efficiency of turbine,\n", - "n_turb=(T3-T4_a)/(T3-T4)\n", - "so T4_a=T3-(n_turb*(T3-T4)) in K\n", - "compressor work,per kg of air compressed(Wc) in KJ/kg of air= 234.42\n", - "so compressor work=234.42 KJ/kg of air\n", - "turbine work,per kg of air compressed(Wt) in KJ/kg of air= 414.71\n", - "so turbine work=414.71 KJ/kg of air\n", - "net work(W_net) in KJ/kg of air= 180.29\n", - "heat supplied(Q) in KJ/kg of air= 751.16\n", - "thermal efficiency(n)= 0.24\n", - "in percentage 24.0\n", - "so thermal efficiency=24%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,turbine and compressor work\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.5, Page:342 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\")\n", - "P1=1*10**5;#initial pressure in Pa\n", - "P4=P1;#constant pressure process\n", - "T1=300;#initial temperature in K\n", - "P2=6.2*10**5;#pressure after compression in Pa\n", - "P3=P2;#constant pressure process\n", - "k=0.017;#fuel to air ratio\n", - "n_compr=0.88;#compressor efficiency\n", - "q=44186;#heating value of fuel in KJ/kg\n", - "n_turb=0.9;#turbine internal efficiency\n", - "Cp_comb=1.147;#specific heat of combustion at constant pressure in KJ/kg K\n", - "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", - "y=1.4;#expansion constant\n", - "n=1.33;#expansion constant for polytropic constant\n", - "print(\"gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\")\n", - "print(\"for process 1-2 being isentropic,\")\n", - "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", - "T2=T1*(P2/P1)**((y-1)/y)\n", - "print(\"considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\")\n", - "print(\"so T2_a=T1+((T2-T1)/n_compr)in K\")\n", - "T2_a=T1+((T2-T1)/n_compr)\n", - "print(\"during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\")\n", - "print(\"heat added=mf*q\")\n", - "print(\"=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\")\n", - "print(\"or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\")\n", - "print(\"so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\")\n", - "T3=((k)*q+(Cp_air*T2_a))/((1+(k))*Cp_comb)\n", - "print(\"for expansion 3-4 being\")\n", - "print(\"T4/T3=(P4/P3)^((n-1)/n)\")\n", - "print(\"so T4=T3*(P4/P3)^((n-1)/n) in K\")\n", - "T4=T3*(P4/P3)**((n-1)/n)\n", - "print(\"actaul temperature at turbine inlet considering internal efficiency of turbine,\")\n", - "print(\"n_turb=(T3-T4_a)/(T3-T4)\")\n", - "print(\"so T4_a=T3-(n_turb*(T3-T4)) in K\")\n", - "T4_a=T3-(n_turb*(T3-T4))\n", - "Wc=Cp_air*(T2_a-T1)\n", - "print(\"compressor work,per kg of air compressed(Wc) in KJ/kg of air=\"),round(Wc,2)\n", - "print(\"so compressor work=234.42 KJ/kg of air\")\n", - "Wt=Cp_comb*(T3-T4_a)\n", - "print(\"turbine work,per kg of air compressed(Wt) in KJ/kg of air=\"),round(Wt,2)\n", - "print(\"so turbine work=414.71 KJ/kg of air\")\n", - "W_net=Wt-Wc\n", - "print(\"net work(W_net) in KJ/kg of air=\"),round(W_net,2)\n", - "Q=k*q\n", - "print(\"heat supplied(Q) in KJ/kg of air=\"),round(Q,2)\n", - "n=W_net/Q\n", - "print(\"thermal efficiency(n)=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so thermal efficiency=24%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.6;pg no: 343" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.6, Page:343 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\n", - "NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\n", - "overall pressure ratio(rp)= 13.59\n", - "so overall optimum pressure ratio=13.6\n" - ] - } - ], - "source": [ - "#cal of overall optimum pressure ratio\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.6, Page:343 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\")\n", - "T1=300;#minimum temperature in brayton cycle in K\n", - "T5=1200;#maximum temperature in brayton cycle in K\n", - "n_isen_c=0.85;#isentropic efficiency of compressor\n", - "n_isen_t=0.9;#isentropic efficiency of turbine\n", - "y=1.4;#expansion constant\n", - "print(\"NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\")\n", - "rp=(T1/(T5*n_isen_c*n_isen_t))**((2*y)/(3*(1-y)))\n", - "print(\"overall pressure ratio(rp)=\"),round(rp,2)\n", - "print(\"so overall optimum pressure ratio=13.6\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.7;pg no: 346" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.7, Page:346 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\n", - "i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\n", - "therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\n", - "or P9/P1=k=(1.35)^8 11.03\n", - "or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\n", - "T9/T1=(P9/P1)^((y-1)/y)\n", - "so T9 in K= 621.47\n", - "considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\n", - "(T9-T1)/(T9_actual-T1)=0.82\n", - "so T9_actual=T1+((T9-T1)/0.82) in K 689.19\n", - "let the actual index of compression be n, then\n", - "(T9_actual/T1)=(P9/P1)^((n-1)/n)\n", - "so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\n", - "so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\n", - "ii> let polytropic efficiency be n_polytropic for compressor then,\n", - "(n-1)/n=((y-1)/y)*(1/n_polytropic)\n", - "so n_polytropic= 0.87\n", - "in percentage 86.9\n", - "so ploytropic efficiency=86.88%\n", - "iii> stage efficiency can be estimated for any stage.say first stage.\n", - "ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y) in K\n", - "actual temperature at exit of first stage can be estimated using polytropic index 1.49.\n", - "T2_actual/T1=(P2/P1)^((n-1)/n)\n", - "so T2_actual=T1*(P2/P1)^((n-1)/n) in K\n", - "stage efficiency for first stage,ns_1= 0.86\n", - "in percentage 86.33\n", - "actual temperature at exit of second stage,\n", - "T3_actual/T2_actual=(P3/P2)^((n-1)/n)\n", - "so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\n", - "ideal temperature at exit of second stage\n", - "T3/T2_actual=(P3/P2)^((n-1)/n)\n", - "so T3=T2_actual*(P3/P2)^((y-1)/y) in K\n", - "stage efficiency for second stage,ns_2= 0.86\n", - "in percentage 86.33\n", - "actual rtemperature at exit of third stage,\n", - "T4_actual/T3_actual=(P4/P3)^((n-1)/n)\n", - "so T4_actual in K= 420.83\n", - "ideal temperature at exit of third stage,\n", - "T4/T3_actual=(P4/P3)^((n-1)/n)\n", - "so T4 in K= 415.42\n", - "stage efficiency for third stage,ns_3= 0.86\n", - "in percentage= 8632.9\n", - "so stage efficiency=86.4%\n", - "iv> from steady flow energy equation,\n", - "Wc=dw=dh and dh=du+p*dv+v*dp\n", - "dh=dq+v*dp\n", - "dq=0 in adiabatic process\n", - "dh=v*dp\n", - "Wc=v*dp\n", - "here for polytropic compression \n", - "P*V^1.49=constant i.e n=1.49\n", - "Wc in KJ/s= 16419.87\n", - "due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s= 14777.89\n", - "so power required to drive compressor =14777.89 KJ/s\n" - ] - } - ], - "source": [ - "#cal of state of air at exit of compressor,polytropic efficiency,efficiency of each sate,power\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.7, Page:346 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\")\n", - "T1=313.;#air entering temperature in K\n", - "P1=1*10**5;#air entering pressure in Pa\n", - "m=50.;#flow rate through compressor in kg/s\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\")\n", - "print(\"therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\")\n", - "r=1.35;#compression ratio\n", - "k=(1.35)**8\n", - "print(\"or P9/P1=k=(1.35)^8\"),round(k,2)\n", - "k=11.03;#approx.\n", - "print(\"or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\")\n", - "y=1.4;#expansion constant \n", - "print(\"T9/T1=(P9/P1)^((y-1)/y)\")\n", - "T9=T1*(k)**((y-1)/y)\n", - "print(\"so T9 in K=\"),round(T9,2)\n", - "print(\"considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\")\n", - "print(\"(T9-T1)/(T9_actual-T1)=0.82\")\n", - "T9_actual=T1+((T9-T1)/0.82)\n", - "print(\"so T9_actual=T1+((T9-T1)/0.82) in K\"),round(T9_actual,2)\n", - "print(\"let the actual index of compression be n, then\")\n", - "print(\"(T9_actual/T1)=(P9/P1)^((n-1)/n)\")\n", - "print(\"so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\")\n", - "n=math.log(k)/(math.log(k)-math.log(T9_actual/T1))\n", - "print(\"so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\")\n", - "print(\"ii> let polytropic efficiency be n_polytropic for compressor then,\")\n", - "print(\"(n-1)/n=((y-1)/y)*(1/n_polytropic)\")\n", - "n_polytropic=((y-1)/y)/((n-1)/n)\n", - "print(\"so n_polytropic=\"),round(n_polytropic,2)\n", - "print(\"in percentage\"),round(n_polytropic*100,2)\n", - "print(\"so ploytropic efficiency=86.88%\")\n", - "print(\"iii> stage efficiency can be estimated for any stage.say first stage.\")\n", - "print(\"ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", - "T2=T1*(r)**((y-1)/y)\n", - "print(\"actual temperature at exit of first stage can be estimated using polytropic index 1.49.\")\n", - "print(\"T2_actual/T1=(P2/P1)^((n-1)/n)\")\n", - "print(\"so T2_actual=T1*(P2/P1)^((n-1)/n) in K\")\n", - "T2_actual=T1*(r)**((n-1)/n)\n", - "ns_1=(T2-T1)/(T2_actual-T1)\n", - "print(\"stage efficiency for first stage,ns_1=\"),round(ns_1,2)\n", - "print(\"in percentage\"),round(ns_1*100,2)\n", - "print(\"actual temperature at exit of second stage,\")\n", - "print(\"T3_actual/T2_actual=(P3/P2)^((n-1)/n)\")\n", - "print(\"so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\")\n", - "T3_actual=T2_actual*(r)**((n-1)/n)\n", - "print(\"ideal temperature at exit of second stage\")\n", - "print(\"T3/T2_actual=(P3/P2)^((n-1)/n)\")\n", - "print(\"so T3=T2_actual*(P3/P2)^((y-1)/y) in K\")\n", - "T3=T2_actual*(r)**((y-1)/y)\n", - "ns_2=(T3-T2_actual)/(T3_actual-T2_actual)\n", - "print(\"stage efficiency for second stage,ns_2=\"),round(ns_2,2)\n", - "print(\"in percentage\"),round(ns_2*100,2)\n", - "print(\"actual rtemperature at exit of third stage,\")\n", - "print(\"T4_actual/T3_actual=(P4/P3)^((n-1)/n)\")\n", - "T4_actual=T3_actual*(r)**((n-1)/n)\n", - "print(\"so T4_actual in K=\"),round(T4_actual,2)\n", - "print(\"ideal temperature at exit of third stage,\")\n", - "print(\"T4/T3_actual=(P4/P3)^((n-1)/n)\")\n", - "T4=T3_actual*(r)**((y-1)/y)\n", - "print(\"so T4 in K=\"),round(T4,2)\n", - "ns_3=(T4-T3_actual)/(T4_actual-T3_actual)\n", - "print(\"stage efficiency for third stage,ns_3=\"),round(ns_3,2)\n", - "ns_3=ns_3*100\n", - "print(\"in percentage=\"),round(ns_3*100,2)\n", - "print(\"so stage efficiency=86.4%\")\n", - "print(\"iv> from steady flow energy equation,\")\n", - "print(\"Wc=dw=dh and dh=du+p*dv+v*dp\")\n", - "print(\"dh=dq+v*dp\")\n", - "print(\"dq=0 in adiabatic process\")\n", - "print(\"dh=v*dp\")\n", - "print(\"Wc=v*dp\")\n", - "print(\"here for polytropic compression \")\n", - "print(\"P*V^1.49=constant i.e n=1.49\")\n", - "n=1.49;\n", - "Wc=(n/(n-1))*m*R*T1*(((k)**((n-1)/n))-1)\n", - "print(\"Wc in KJ/s=\"),round(Wc,2)\n", - "Wc_actual=Wc*0.9\n", - "print(\"due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s=\"),round(Wc*0.9,2)\n", - "print(\"so power required to drive compressor =14777.89 KJ/s\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.8;pg no: 349" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.8, Page:349 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\n", - "In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.8, Page:349 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\")\n", - "print(\"In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.9;pg no: 350" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.9, Page:350 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\n", - "using polytropic efficiency the index of compression and expansion can be obtained as under,\n", - "let compression index be nc,\n", - "(nc-1)/nc=(y-1)/(y*n_poly_c)\n", - "so nc=1/(1-((y-1)/(y*n_poly_c)))\n", - "let expansion index be nt,\n", - "(nt-1)/nt=(n_poly_T*(y-1))/y\n", - "so nt=1/(1-((n_poly_T*(y-1))/y))\n", - "For process 1-2\n", - "T2/T1=(p2/p1)^((nc-1)/nc)\n", - "so T2=T1*(p2/p1)^((nc-1)/nc)in K\n", - "also T4/T3=(p4/p3)^((nt-1)/nt)\n", - "so T4=T3*(p4/p3)^((nt-1)/nt)in K\n", - "using heat exchanger effectivenesss,\n", - "epsilon=(T5-T2)/(T4-T2)\n", - "so T5=T2+(epsilon*(T4-T2))in K\n", - "heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\n", - "compressor work,Wc=Cp*(T2-T1)in \n", - "turbine work,Wt=Cp*(T3-T4)in KJ/kg\n", - "cycle efficiency= 0.33\n", - "in percentage 32.79\n", - "work ratio= 0.33\n", - "specific work output in KJ/kg= 152.56\n", - "so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of cycle efficiency,work ratio,specific work output\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.9, Page:350 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\")\n", - "y=1.4;#expansion constant\n", - "n_poly_c=0.85;#ploytropic efficiency of compressor\n", - "n_poly_T=0.90;#ploytropic efficiency of Turbine\n", - "r=8.;#compression ratio\n", - "T1=(27.+273.);#temperature of air in compressor in K\n", - "T3=1100.;#temperature of air leaving combustion chamber in K\n", - "epsilon=0.8;#effectiveness of heat exchanger\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "print(\"using polytropic efficiency the index of compression and expansion can be obtained as under,\")\n", - "print(\"let compression index be nc,\")\n", - "print(\"(nc-1)/nc=(y-1)/(y*n_poly_c)\")\n", - "print(\"so nc=1/(1-((y-1)/(y*n_poly_c)))\")\n", - "nc=1/(1-((y-1)/(y*n_poly_c)))\n", - "print(\"let expansion index be nt,\")\n", - "print(\"(nt-1)/nt=(n_poly_T*(y-1))/y\")\n", - "print(\"so nt=1/(1-((n_poly_T*(y-1))/y))\")\n", - "nt=1/(1-((n_poly_T*(y-1))/y))\n", - "print(\"For process 1-2\")\n", - "print(\"T2/T1=(p2/p1)^((nc-1)/nc)\")\n", - "print(\"so T2=T1*(p2/p1)^((nc-1)/nc)in K\")\n", - "T2=T1*(r)**((nc-1)/nc)\n", - "print(\"also T4/T3=(p4/p3)^((nt-1)/nt)\")\n", - "print(\"so T4=T3*(p4/p3)^((nt-1)/nt)in K\")\n", - "T4=T3*(1/r)**((nt-1)/nt)\n", - "print(\"using heat exchanger effectivenesss,\") \n", - "print(\"epsilon=(T5-T2)/(T4-T2)\")\n", - "print(\"so T5=T2+(epsilon*(T4-T2))in K\")\n", - "T5=T2+(epsilon*(T4-T2))\n", - "print(\"heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\")\n", - "q_add=Cp*(T3-T5)\n", - "print(\"compressor work,Wc=Cp*(T2-T1)in \")\n", - "Wc=Cp*(T2-T1)\n", - "print(\"turbine work,Wt=Cp*(T3-T4)in KJ/kg\")\n", - "Wt=Cp*(T3-T4)\n", - "(Wt-Wc)/q_add\n", - "print(\"cycle efficiency=\"),round((Wt-Wc)/q_add,2)\n", - "print(\"in percentage\"),round((Wt-Wc)*100/q_add,2)\n", - "(Wt-Wc)/Wt\n", - "print(\"work ratio=\"),round((Wt-Wc)/Wt,2)\n", - "print(\"specific work output in KJ/kg=\"),round(Wt-Wc,2)\n", - "print(\"so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.10;pg no: 351" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.10, Page:351 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\n", - "for process 1-2_a\n", - "T2_a/T1=(p2_a/p1)^((y-1)/y)\n", - "so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\n", - "nc=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+((T2_a-T1)/nc) in K\n", - "for process 3-4_a,\n", - "T4_a/T3=(p4/p3)^((y-1)/y)\n", - "so T4_a=T3*(p4/p3)^((y-1)/y)in K\n", - "Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", - "Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\n", - "net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\n", - "heat added,q_add=Cp*(T3-T2) in KJ/kg\n", - "thermal efficiency,n=W_net/q_add\n", - "n={Wc-(Cp*(T3-T4))}/q_add\n", - "so T4=T3-((Wc-(n*q_add))/Cp)in K\n", - "therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a) 0.297\n", - "in percentage 29.7\n", - "so turbine isentropic efficiency=29.69%\n" - ] - } - ], - "source": [ - "#cal of isentropic efficiency of turbine\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.10, Page:351 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\")\n", - "T1=(27+273);#temperature of air in compressor in K\n", - "p1=1*10**5;#pressure of air in compressor in Pa\n", - "p2=5*10**5;#pressure of air after compression in Pa\n", - "p3=p2-0.2*10**5;#pressure drop in Pa\n", - "p4=1*10**5;#pressure to which expansion occur in turbine in Pa\n", - "nc=0.85;#isentropic efficiency\n", - "T3=1000;#temperature of air in combustion chamber in K\n", - "n=0.2;#thermal efficiency of plant\n", - "y=1.4;#expansion constant\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "print(\"for process 1-2_a\")\n", - "print(\"T2_a/T1=(p2_a/p1)^((y-1)/y)\")\n", - "print(\"so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\")\n", - "T2_a=T1*(p2/p1)**((y-1)/y)\n", - "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+((T2_a-T1)/nc) in K\")\n", - "T2=T1+((T2_a-T1)/nc)\n", - "print(\"for process 3-4_a,\")\n", - "print(\"T4_a/T3=(p4/p3)^((y-1)/y)\")\n", - "print(\"so T4_a=T3*(p4/p3)^((y-1)/y)in K\")\n", - "T4_a=T3*(p4/p3)**((y-1)/y)\n", - "print(\"Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", - "Wc=Cp*(T2-T1)\n", - "print(\"Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\")\n", - "print(\"net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\")\n", - "print(\"heat added,q_add=Cp*(T3-T2) in KJ/kg\")\n", - "q_add=Cp*(T3-T2)\n", - "print(\"thermal efficiency,n=W_net/q_add\")\n", - "print(\"n={Wc-(Cp*(T3-T4))}/q_add\")\n", - "print(\"so T4=T3-((Wc-(n*q_add))/Cp)in K\")\n", - "T4=T3-((Wc-(n*q_add))/Cp)\n", - "nt=(T3-T4)/(T3-T4_a)\n", - "print(\"therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a)\"),round((T3-T4)/(T3-T4_a),3)\n", - "print(\"in percentage\"),round(nt*100,2)\n", - "print(\"so turbine isentropic efficiency=29.69%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.11;pg no: 352" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.11, Page:352 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\n", - "for perfect intercooling the pressure ratio of each compression stage(k)\n", - "k=sqrt(r)\n", - "for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\n", - "so T2_a=T1*(k)^((y-1)/y)in K\n", - "considering isentropic efficiency of compression,\n", - "nc=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+((T2_a-T1)/nc)in K\n", - "for process 3-4,\n", - "T4_a/T3=(P4/P3)^((y-1)/y)\n", - "so T4_a=T3*(P4/P3)^((y-1)/y) in K\n", - "again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\n", - "so T4=T3+((T4_a-T3)/nc)in K\n", - "total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\n", - "for expansion process 5-6_a,\n", - "T6_a/T5=(P6/P5)^((y-1)/y)\n", - "so T6_a=T5*(P6/P5)^((y-1)/y) in K\n", - "considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\n", - "T6=T5-(ne*(T5-T6_a)) in K\n", - "for expansion in 7-8_a\n", - "T8_a/T7=(P8/P7)^((y-1)/y)\n", - "so T8_a=T7*(P8/P7)^((y-1)/y) in K\n", - "considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\n", - "so T8=T7-(ne*(T7-T8_a))in K\n", - "expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\n", - "heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\n", - "fuel required per kg of air,mf=q_add/C 0.02\n", - "air-fuel ratio=1/mf 51.08\n", - "net output(W) in KJ/kg= 229.2\n", - "output for air flowing at 30 kg/s,=W*m in KW 6876.05\n", - "thermal efficiency= 0.28\n", - "in percentage 27.88\n", - "so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\n", - "NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,net output,A/F ratio\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.11, Page:352 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\")\n", - "P1=1.*10**5;#initial pressure in Pa\n", - "T1=(27.+273.);#initial temperature in K\n", - "T3=T1;\n", - "r=10.;#pressure ratio\n", - "T5=1000.;#maximum temperature in cycle in K\n", - "P6=3.*10**5;#first stage expansion pressure in Pa\n", - "T7=995.;#first stage reheated temperature in K\n", - "C=42000.;#calorific value of fuel in KJ/kg\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "m=30.;#air flow rate in kg/s\n", - "nc=0.85;#isentropic efficiency of compression\n", - "ne=0.9;#isentropic efficiency of expansion\n", - "y=1.4;#expansion constant\n", - "print(\"for perfect intercooling the pressure ratio of each compression stage(k)\")\n", - "print(\"k=sqrt(r)\")\n", - "k=math.sqrt(r)\n", - "k=3.16;#approx.\n", - "print(\"for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2_a=T1*(k)^((y-1)/y)in K\")\n", - "T2_a=T1*(k)**((y-1)/y)\n", - "print(\"considering isentropic efficiency of compression,\")\n", - "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+((T2_a-T1)/nc)in K\")\n", - "T2=T1+((T2_a-T1)/nc)\n", - "print(\"for process 3-4,\")\n", - "print(\"T4_a/T3=(P4/P3)^((y-1)/y)\")\n", - "print(\"so T4_a=T3*(P4/P3)^((y-1)/y) in K\")\n", - "T4_a=T3*(k)**((y-1)/y)\n", - "print(\"again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\")\n", - "print(\"so T4=T3+((T4_a-T3)/nc)in K\")\n", - "T4=T3+((T4_a-T3)/nc)\n", - "print(\"total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\")\n", - "Wc=2*Cp*(T4-T3)\n", - "print(\"for expansion process 5-6_a,\")\n", - "print(\"T6_a/T5=(P6/P5)^((y-1)/y)\")\n", - "print(\"so T6_a=T5*(P6/P5)^((y-1)/y) in K\")\n", - "P5=10.*10**5;#pressure in Pa\n", - "T6_a=T5*(P6/P5)**((y-1)/y)\n", - "print(\"considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\")\n", - "print(\"T6=T5-(ne*(T5-T6_a)) in K\")\n", - "T6=T5-(ne*(T5-T6_a))\n", - "print(\"for expansion in 7-8_a\")\n", - "print(\"T8_a/T7=(P8/P7)^((y-1)/y)\")\n", - "print(\"so T8_a=T7*(P8/P7)^((y-1)/y) in K\")\n", - "P8=P1;#constant pressure process\n", - "P7=P6;#constant pressure process\n", - "T8_a=T7*(P8/P7)**((y-1)/y)\n", - "print(\"considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\")\n", - "print(\"so T8=T7-(ne*(T7-T8_a))in K\")\n", - "T8=T7-(ne*(T7-T8_a))\n", - "print(\"expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\")\n", - "Wt=Cp*(T5-T6)+Cp*(T7-T8)\n", - "print(\"heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\")\n", - "q_add=Cp*(T5-T4)+Cp*(T7-T6)\n", - "mf=q_add/C\n", - "print(\"fuel required per kg of air,mf=q_add/C\"),round(q_add/C,2)\n", - "print(\"air-fuel ratio=1/mf\"),round(1/mf,2)\n", - "W=Wt-Wc\n", - "print(\"net output(W) in KJ/kg=\"),round(Wt-Wc,2)\n", - "print(\"output for air flowing at 30 kg/s,=W*m in KW\"),round(W*m,2)\n", - "W/q_add\n", - "print(\"thermal efficiency=\"),round(W/q_add,2)\n", - "print(\"in percentage\"),round(W*100/q_add,2)\n", - "print(\"so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\")\n", - "print(\"NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.12;pg no: 354" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.12, Page:354 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\n", - "for process 1-2,\n", - "T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y) in K\n", - "for process 3-4,\n", - "T4/T3=(P4/P3)^((y-1)/y)\n", - "so T4=T3*(P4/P3)^((y-1)/y) in K\n", - "for process 6-7,\n", - "T7/T6=(P7/P6)^((y-1)/y)\n", - "so T7=T6*(P7/P6)^((y-1)/y) in K\n", - "for process 8-9,\n", - "T9/T8=(P9/P8)^((y-1)/y)\n", - "T9=T8*(P9/P8)^((y-1)/y) in K\n", - "in regenerator,effectiveness=(T5-T4)/(T9-T4)\n", - "T5=T4+(ne*(T9-T4))in K\n", - "compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\n", - "turbine work per kg air,Wt in KJ/kg= 660.84\n", - "heat added per kg air,q_add in KJ/kg= 765.43\n", - "total fuel required per kg of air= 0.02\n", - "net work,W_net in KJ/kg= 450.85\n", - "cycle thermal efficiency,n= 0.59\n", - "in percentage 58.9\n", - "fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C= 0.0056\n", - "fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C= 0.0126\n", - "so fuel-air ratio in two combustion chambers=0.0126,0.0056\n", - "total turbine work=660.85 KJ/kg\n", - "cycle thermal efficiency=58.9%\n", - "NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \n" - ] - } - ], - "source": [ - "#cal of fuel-air ratio in two combustion chambers,total turbine work,cycle thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.12, Page:354 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\")\n", - "P1=1.*10**5;#initial pressure in Pa\n", - "P9=P1;\n", - "T1=300.;#initial temperature in K\n", - "P2=4.*10**5;#pressure of air in intercooler in Pa\n", - "P3=P2;\n", - "T3=290.;#temperature of air in intercooler in K\n", - "T6=1300.;#temperature of combustion chamber in K\n", - "P4=8.*10**5;#pressure of air after compression in Pa\n", - "P6=P4;\n", - "T8=1300.;#temperature after reheating in K\n", - "P8=4.*10**5;#pressure after expansion in Pa\n", - "P7=P8;\n", - "C=42000.;#heating value of fuel in KJ/kg\n", - "y=1.4;#expansion constant\n", - "ne=0.8;#effectiveness of regenerator\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "print(\"for process 1-2,\")\n", - "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", - "T2=T1*(P2/P1)**((y-1)/y)\n", - "print(\"for process 3-4,\")\n", - "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", - "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", - "T4=T3*(P4/P3)**((y-1)/y)\n", - "print(\"for process 6-7,\")\n", - "print(\"T7/T6=(P7/P6)^((y-1)/y)\")\n", - "print(\"so T7=T6*(P7/P6)^((y-1)/y) in K\")\n", - "T7=T6*(P7/P6)**((y-1)/y)\n", - "print(\"for process 8-9,\")\n", - "print(\"T9/T8=(P9/P8)^((y-1)/y)\")\n", - "print(\"T9=T8*(P9/P8)^((y-1)/y) in K\")\n", - "T9=T8*(P9/P8)**((y-1)/y)\n", - "print(\"in regenerator,effectiveness=(T5-T4)/(T9-T4)\")\n", - "print(\"T5=T4+(ne*(T9-T4))in K\")\n", - "T5=T4+(ne*(T9-T4))\n", - "print(\"compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\")\n", - "Wc=Cp*(T2-T1)+Cp*(T4-T3)\n", - "Wt=Cp*(T6-T7)+Cp*(T8-T9)\n", - "print(\"turbine work per kg air,Wt in KJ/kg=\"),round(Wt,2)\n", - "q_add=Cp*(T6-T5)+Cp*(T8-T7)\n", - "print(\"heat added per kg air,q_add in KJ/kg=\"),round(q_add,2)\n", - "q_add/C\n", - "print(\"total fuel required per kg of air=\"),round(q_add/C,2)\n", - "W_net=Wt-Wc\n", - "print(\"net work,W_net in KJ/kg=\"),round(W_net,2)\n", - "n=W_net/q_add\n", - "print(\"cycle thermal efficiency,n=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C=\"),round(Cp*(T8-T7)/C,4)\n", - "print(\"fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C=\"),round(Cp*(T6-T5)/C,4)\n", - "print(\"so fuel-air ratio in two combustion chambers=0.0126,0.0056\")\n", - "print(\"total turbine work=660.85 KJ/kg\")\n", - "print(\"cycle thermal efficiency=58.9%\")\n", - "print(\"NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.13;pg no: 356" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.13, Page:356 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\n", - "work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\n", - "heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\n", - "for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\n", - "mass of air per cycle=m/n in kg/cycle\n", - "brake output in KW= 17.12\n", - "stroke volume,V in m^3= 0.0117\n", - "brake output=17.11 KW\n", - "stroke volume=0.0116 m^3\n" - ] - } - ], - "source": [ - "#cal of brake output,stroke volume\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.13, Page:356 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\")\n", - "T2=700.;#highest temperature of stirling engine in K\n", - "T1=300.;#lowest temperature of stirling engine in K\n", - "r=3.;#compression ratio\n", - "q_add=30.;#heat addition in KJ/s\n", - "epsilon=0.9;#regenerator efficiency\n", - "P=1*10**5;#pressure at begining of compression in Pa\n", - "n=100.;#number of cycle per minute\n", - "Cv=0.72;#specific heat at constant volume in KJ/kg K\n", - "R=29.27;#gas constant in KJ/kg K\n", - "print(\"work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\")\n", - "W=R*(T2-T1)*math.log(r)\n", - "print(\"heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\")\n", - "q=R*T2*math.log(r)+(1-epsilon)*Cv*(T2-T1)\n", - "print(\"for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\")\n", - "m=q_add/q\n", - "print(\"mass of air per cycle=m/n in kg/cycle\")\n", - "m/n\n", - "print(\"brake output in KW=\"),round(W*m,2)\n", - "m=1.33*10**-4;#mass of air per cycle in kg/cycle\n", - "T=T1;\n", - "V=m*R*T*1000/P\n", - "print(\"stroke volume,V in m^3=\"),round(V,4)\n", - "print(\"brake output=17.11 KW\")\n", - "print(\"stroke volume=0.0116 m^3\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.14;pg no: 357" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.14, Page:357 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\n", - "In question no.14,various expression is derived which cannot be solved using python software.\n" - ] - } - ], - "source": [ - "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.14, Page:357 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\")\n", - "print(\"In question no.14,various expression is derived which cannot be solved using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.15;pg no: 361" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.15, Page:361 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\n", - "In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y)in K\n", - "T4/T3=(P4/P3)^((y-1)/y)\n", - "so T4=T3*(P4/P3)^((y-1)/y) in K\n", - "compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", - "turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \n", - "heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \n", - "net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\n", - "heat recovered in HRSG for steam generation per kg of air\n", - "q_HRGC=Cp*(T4-T5)in KJ/kg\n", - "at inlet to steam in turbine,\n", - "from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\n", - "for expansion in steam turbine,sa=sb\n", - "let dryness fraction at state b be x\n", - "also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\n", - "sb=sf+x*sfg\n", - "so x=(sb-sf)/sfg \n", - "so hb=hf+x*hfg in KJ/kg K\n", - "at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\n", - "at exit of feed pump,hd=hd-hc\n", - "hd=vc*(Pg-Pc)*100 in KJ/kg\n", - "heat added per kg of steam =ha-hd in KJ/kg\n", - "mass of steam generated per kg of air in kg steam per kg air= 0.119\n", - "net steam turbine cycle output,W_net_ST in KJ/kg= 677.4\n", - "steam cycle output per kg of air(W_net_ST) in KJ/kg air= 80.61\n", - "total combined cycle output in KJ/kg air= 486.88\n", - "combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add 0.58\n", - "in percentage 57.77\n", - "In absence of steam cycle,gas turbine cycle efficiency,n_GT= 0.48\n", - "in percentage 48.21\n", - "thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\n", - "overall efficiency=57.77%\n", - "steam per kg of air=0.119 kg steam per/kg air\n" - ] - } - ], - "source": [ - "#cal of overall efficiency,steam per kg of air\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.15, Page:361 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\")\n", - "r=10.;#pressure ratio\n", - "Cp=1.0032;#specific heat of air in KJ/kg K\n", - "y=1.4;#expansion constant\n", - "T3=1400.;#inlet temperature of gas turbine in K\n", - "T1=(17.+273.);#ambient temperature in K\n", - "P1=1.*10**5;#ambient pressure in Pa\n", - "Pc=15.;#condensor pressure in KPa\n", - "Pg=6.*1000;#pressure of steam in generator in KPa\n", - "T5=420.;#temperature of exhaust from gas turbine in K\n", - "print(\"In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y)in K\")\n", - "T2=T1*(r)**((y-1)/y)\n", - "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", - "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", - "T4=T3*(1/r)**((y-1)/y)\n", - "print(\"compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", - "Wc=Cp*(T2-T1)\n", - "print(\"turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \")\n", - "Wt=Cp*(T3-T4)\n", - "print(\"heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \")\n", - "q_add=Cp*(T3-T2)\n", - "print(\"net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\")\n", - "W_net_GT=Wt-Wc\n", - "print(\"heat recovered in HRSG for steam generation per kg of air\")\n", - "print(\"q_HRGC=Cp*(T4-T5)in KJ/kg\")\n", - "q_HRGC=Cp*(T4-T5)\n", - "print(\"at inlet to steam in turbine,\")\n", - "print(\"from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\")\n", - "ha=3177.2;\n", - "sa=6.5408;\n", - "print(\"for expansion in steam turbine,sa=sb\")\n", - "sb=sa;\n", - "print(\"let dryness fraction at state b be x\")\n", - "print(\"also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\")\n", - "sf=0.7549;\n", - "sfg=7.2536;\n", - "hf=225.94;\n", - "hfg=2373.1;\n", - "print(\"sb=sf+x*sfg\")\n", - "print(\"so x=(sb-sf)/sfg \")\n", - "x=(sb-sf)/sfg\n", - "print(\"so hb=hf+x*hfg in KJ/kg K\")\n", - "hb=hf+x*hfg\n", - "print(\"at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\")\n", - "hc=hf;\n", - "vc=0.001014;\n", - "print(\"at exit of feed pump,hd=hd-hc\")\n", - "print(\"hd=vc*(Pg-Pc)*100 in KJ/kg\")\n", - "hd=vc*(Pg-Pc)*100\n", - "print(\"heat added per kg of steam =ha-hd in KJ/kg\")\n", - "ha-hd\n", - "print(\"mass of steam generated per kg of air in kg steam per kg air=\"),round(q_HRGC/(ha-hd),3)\n", - "W_net_ST=(ha-hb)-(hd-hc)\n", - "print(\"net steam turbine cycle output,W_net_ST in KJ/kg=\"),round(W_net_ST,2)\n", - "W_net_ST=W_net_ST*0.119 \n", - "print(\"steam cycle output per kg of air(W_net_ST) in KJ/kg air=\"),round(W_net_ST,2)\n", - "(W_net_GT+W_net_ST)\n", - "print(\"total combined cycle output in KJ/kg air= \"),round((W_net_GT+W_net_ST),2)\n", - "n_cc=(W_net_GT+W_net_ST)/q_add\n", - "print(\"combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add\"),round(n_cc,2)\n", - "print(\"in percentage\"),round(n_cc*100,2)\n", - "n_GT=W_net_GT/q_add\n", - "print(\"In absence of steam cycle,gas turbine cycle efficiency,n_GT=\"),round(n_GT,2)\n", - "print(\"in percentage\"),round(n_GT*100,2)\n", - "print(\"thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\")\n", - "print(\"overall efficiency=57.77%\")\n", - "print(\"steam per kg of air=0.119 kg steam per/kg air\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.16;pg no: 363" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.16, Page:363 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\n", - "here P4/P1=P3/P1=70............eq1\n", - "compression ratio,V1/V2=V1/V3=15.............eq2\n", - "heat added at constant volume= heat added at constant pressure\n", - "Q23=Q34\n", - "m*Cv*(T3-T2)=m*Cp*(T4-T3)\n", - "(T3-T2)=y*(T4-T3)\n", - "for process 1-2;\n", - "T2/T1=(P2/P1)^((y-1)/y)\n", - "T2/T1=(V1/V2)^(y-1)\n", - "so T2=T1*(V1/V2)^(y-1) in K\n", - "and (P2/P1)=(V1/V2)^y\n", - "so P2=P1*(V1/V2)^y in Pa...........eq3\n", - "for process 2-3,\n", - "P2/P3=T2/T3\n", - "so T3=T2*P3/P2\n", - "using eq 1 and 3,we get\n", - "T3=T2*k/r^y in K\n", - "using equal heat additions for processes 2-3 and 3-4,\n", - "(T3-T2)=y*(T4-T3)\n", - "so T4=T3+((T3-T2)/y) in K\n", - "for process 3-4,\n", - "V3/V4=T3/T4\n", - "(V3/V1)*(V1/V4)=T3/T4\n", - "so (V1/V4)=(T3/T4)*r\n", - "so V1/V4=11.88 and V5/V4=11.88\n", - "for process 4-5,\n", - "P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\n", - "so T5=T4/((V5/V4)^(y-1))\n", - "air standard thermal efficiency(n)=1-(heat rejected/heat added)\n", - "n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\n", - "n= 0.65\n", - "air standard thermal efficiency=0.6529\n", - "in percentage 65.29\n", - "so air standard thermal efficiency=65.29%\n", - "Actual thermal efficiency may be different from theoretical efficiency due to following reasons\n", - "a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\n", - "b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\n", - "c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\n" - ] - } - ], - "source": [ - "#cal of air standard thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.16, Page:363 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\")\n", - "T1=(27+273);#temperature at begining of compression in K\n", - "k=70;#ration of maximum to minimum pressures\n", - "r=15;#compression ratio\n", - "y=1.4;#expansion constant\n", - "print(\"here P4/P1=P3/P1=70............eq1\")\n", - "print(\"compression ratio,V1/V2=V1/V3=15.............eq2\")\n", - "print(\"heat added at constant volume= heat added at constant pressure\")\n", - "print(\"Q23=Q34\")\n", - "print(\"m*Cv*(T3-T2)=m*Cp*(T4-T3)\")\n", - "print(\"(T3-T2)=y*(T4-T3)\")\n", - "print(\"for process 1-2;\")\n", - "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"T2/T1=(V1/V2)^(y-1)\")\n", - "print(\"so T2=T1*(V1/V2)^(y-1) in K\")\n", - "T2=T1*(r)**(y-1)\n", - "print(\"and (P2/P1)=(V1/V2)^y\")\n", - "print(\"so P2=P1*(V1/V2)^y in Pa...........eq3\")\n", - "print(\"for process 2-3,\")\n", - "print(\"P2/P3=T2/T3\")\n", - "print(\"so T3=T2*P3/P2\")\n", - "print(\"using eq 1 and 3,we get\")\n", - "print(\"T3=T2*k/r^y in K\")\n", - "T3=T2*k/r**y \n", - "print(\"using equal heat additions for processes 2-3 and 3-4,\")\n", - "print(\"(T3-T2)=y*(T4-T3)\")\n", - "print(\"so T4=T3+((T3-T2)/y) in K\")\n", - "T4=T3+((T3-T2)/y)\n", - "print(\"for process 3-4,\")\n", - "print(\"V3/V4=T3/T4\")\n", - "print(\"(V3/V1)*(V1/V4)=T3/T4\")\n", - "print(\"so (V1/V4)=(T3/T4)*r\")\n", - "(T3/T4)*r\n", - "print(\"so V1/V4=11.88 and V5/V4=11.88\")\n", - "print(\"for process 4-5,\")\n", - "print(\"P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\")\n", - "print(\"so T5=T4/((V5/V4)^(y-1))\")\n", - "T5=T4/(11.88)**(y-1)\n", - "print(\"air standard thermal efficiency(n)=1-(heat rejected/heat added)\")\n", - "print(\"n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\")\n", - "n=1-((T5-T1)/(y*(T4-T3)+(T3-T2)))\n", - "print(\"n=\"),round(n,2)\n", - "print(\"air standard thermal efficiency=0.6529\")\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so air standard thermal efficiency=65.29%\")\n", - "print(\"Actual thermal efficiency may be different from theoretical efficiency due to following reasons\")\n", - "print(\"a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\")\n", - "print(\"b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\")\n", - "print(\"c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter9_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter9_1.ipynb deleted file mode 100755 index 606321b3..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter9_1.ipynb +++ /dev/null @@ -1,1655 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 9:Gas Power Cycles" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.1;pg no: 334" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.1, Page:334 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\n", - "SI engine operate on otto cycle.consider working fluid to be perfect gas.\n", - "here,y=Cp/Cv\n", - "Cp-Cv=R in KJ/kg K\n", - "compression ratio,r=V1/V2=(0.15+V2)/V2\n", - "so V2=0.15/(r-1) in m^3\n", - "so V2=0.03 m^3\n", - "total cylinder volume=V1=r*V2 m^3\n", - "from perfect gas law,P*V=m*R*T\n", - "so m=P1*V1/(R*T1) in kg\n", - "from state 1 to 2 by P*V^y=P2*V2^y\n", - "so P2=P1*(V1/V2)^y in KPa\n", - "also,P1*V1/T1=P2*V2/T2\n", - "so T2=P2*V2*T1/(P1*V1)in K\n", - "from heat addition process 2-3\n", - "Q23=m*CV*(T3-T2)\n", - "T3=T2+(Q23/(m*Cv))in K\n", - "also from,P3*V3/T3=P2*V2/T2\n", - "P3=P2*V2*T3/(V3*T2) in KPa\n", - "for adiabatic expansion 3-4,\n", - "P3*V3^y=P4*V4^y\n", - "and V4=V1\n", - "hence,P4=P3*V3^y/V1^y in KPa\n", - "and from P3*V3/T3=P4*V4/T4\n", - "T4=P4*V4*T3/(P3*V3) in K\n", - "entropy change from 2-3 and 4-1 are same,and can be given as,\n", - "S3-S2=S4-S1=m*Cv*log(T4/T1)\n", - "so entropy change,deltaS_32=deltaS_41 in KJ/K\n", - "heat rejected,Q41=m*Cv*(T4-T1) in KJ\n", - "net work(W) in KJ= 76.75\n", - "efficiency(n)= 0.51\n", - "in percentage 51.16\n", - "mean effective pressure(mep)=work/volume change in KPa= 511.64\n", - "so mep=511.67 KPa\n" - ] - } - ], - "source": [ - "#cal of mean effective pressure\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.1, Page:334 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\")\n", - "Cp=1;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", - "P1=98;#pressure at begining of compression in KPa\n", - "T1=(60+273.15);#temperature at begining of compression in K\n", - "Q23=150;#heat supplied in KJ/kg\n", - "r=6;#compression ratio\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"SI engine operate on otto cycle.consider working fluid to be perfect gas.\")\n", - "print(\"here,y=Cp/Cv\")\n", - "y=Cp/Cv\n", - "y=1.4;#approx.\n", - "print(\"Cp-Cv=R in KJ/kg K\")\n", - "R=Cp-Cv\n", - "print(\"compression ratio,r=V1/V2=(0.15+V2)/V2\")\n", - "print(\"so V2=0.15/(r-1) in m^3\")\n", - "V2=0.15/(r-1)\n", - "print(\"so V2=0.03 m^3\")\n", - "print(\"total cylinder volume=V1=r*V2 m^3\")\n", - "V1=r*V2\n", - "print(\"from perfect gas law,P*V=m*R*T\")\n", - "print(\"so m=P1*V1/(R*T1) in kg\")\n", - "m=P1*V1/(R*T1)\n", - "m=0.183;#approx.\n", - "print(\"from state 1 to 2 by P*V^y=P2*V2^y\")\n", - "print(\"so P2=P1*(V1/V2)^y in KPa\")\n", - "P2=P1*(V1/V2)**y\n", - "print(\"also,P1*V1/T1=P2*V2/T2\")\n", - "print(\"so T2=P2*V2*T1/(P1*V1)in K\")\n", - "T2=P2*V2*T1/(P1*V1)\n", - "print(\"from heat addition process 2-3\")\n", - "print(\"Q23=m*CV*(T3-T2)\")\n", - "print(\"T3=T2+(Q23/(m*Cv))in K\")\n", - "T3=T2+(Q23/(m*Cv))\n", - "print(\"also from,P3*V3/T3=P2*V2/T2\")\n", - "print(\"P3=P2*V2*T3/(V3*T2) in KPa\")\n", - "V3=V2;#constant volume process\n", - "P3=P2*V2*T3/(V3*T2) \n", - "print(\"for adiabatic expansion 3-4,\")\n", - "print(\"P3*V3^y=P4*V4^y\")\n", - "print(\"and V4=V1\")\n", - "V4=V1;\n", - "print(\"hence,P4=P3*V3^y/V1^y in KPa\")\n", - "P4=P3*V3**y/V1**y\n", - "print(\"and from P3*V3/T3=P4*V4/T4\")\n", - "print(\"T4=P4*V4*T3/(P3*V3) in K\")\n", - "T4=P4*V4*T3/(P3*V3)\n", - "print(\"entropy change from 2-3 and 4-1 are same,and can be given as,\")\n", - "print(\"S3-S2=S4-S1=m*Cv*log(T4/T1)\")\n", - "print(\"so entropy change,deltaS_32=deltaS_41 in KJ/K\")\n", - "deltaS_32=m*Cv*math.log(T4/T1)\n", - "deltaS_41=deltaS_32;\n", - "print(\"heat rejected,Q41=m*Cv*(T4-T1) in KJ\")\n", - "Q41=m*Cv*(T4-T1)\n", - "W=Q23-Q41\n", - "print(\"net work(W) in KJ=\"),round(W,2)\n", - "n=W/Q23\n", - "print(\"efficiency(n)=\"),round(W/Q23,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "mep=W/0.15\n", - "print(\"mean effective pressure(mep)=work/volume change in KPa=\"),round(W/0.15,2)\n", - "print(\"so mep=511.67 KPa\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.2;pg no: 336" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.2, Page:336 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\n", - "as given\n", - "Va=V2+(7/8)*(V1-V2)\n", - "Vb=V2+(1/8)*(V1-V2)\n", - "and also\n", - "Pa*Va^y=Pb*Vb^y\n", - "so (Va/Vb)=(Pb/Pa)^(1/y)\n", - "also substituting for Va and Vb\n", - "(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\n", - "so V1/V2=r=1+(4.18*8/1.82) 19.37\n", - "it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\n", - "as given;cut off occurs at(V1-V2)/15 volume\n", - "V3=V2+(V1-V2)/15\n", - "cut off ratio,rho=V3/V2\n", - "air standard efficiency for diesel cycle(n_airstandard)= 0.63\n", - "in percentage 63.23\n", - "overall efficiency(n_overall)=n_airstandard*n_ite*n_mech 0.253\n", - "in percentage 25.3\n", - "fuel consumption,bhp/hr in kg= 0.26\n", - "so compression ratio=19.37\n", - "air standard efficiency=63.25%\n", - "fuel consumption,bhp/hr=0.255 kg\n" - ] - } - ], - "source": [ - "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.2, Page:336 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\")\n", - "Pa=138;#pressure during compression at 1/8 of stroke in KPa\n", - "Pb=1.38*10**3;#pressure during compression at 7/8 of stroke in KPa\n", - "n_ite=0.5;#indicated thermal efficiency\n", - "n_mech=0.8;#mechanical efficiency\n", - "C=41800;#calorific value in KJ/kg\n", - "y=1.4;#expansion constant\n", - "print(\"as given\")\n", - "print(\"Va=V2+(7/8)*(V1-V2)\")\n", - "print(\"Vb=V2+(1/8)*(V1-V2)\")\n", - "print(\"and also\")\n", - "print(\"Pa*Va^y=Pb*Vb^y\")\n", - "print(\"so (Va/Vb)=(Pb/Pa)^(1/y)\")\n", - "(Pb/Pa)**(1/y)\n", - "print(\"also substituting for Va and Vb\")\n", - "print(\"(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\")\n", - "r=1+(4.18*8/1.82)\n", - "print(\"so V1/V2=r=1+(4.18*8/1.82)\"),round(r,2)\n", - "print(\"it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\")\n", - "print(\"as given;cut off occurs at(V1-V2)/15 volume\")\n", - "print(\"V3=V2+(V1-V2)/15\")\n", - "print(\"cut off ratio,rho=V3/V2\")\n", - "rho=1+(r-1)/15\n", - "n_airstandard=1-(1/(r**(y-1)*y))*((rho**y-1)/(rho-1))\n", - "print(\"air standard efficiency for diesel cycle(n_airstandard)=\"),round(n_airstandard,2)\n", - "print(\"in percentage\"),round(n_airstandard*100,2)\n", - "n_airstandard=0.6325;\n", - "n_overall=n_airstandard*n_ite*n_mech\n", - "print(\"overall efficiency(n_overall)=n_airstandard*n_ite*n_mech\"),round(n_overall,3)\n", - "print(\"in percentage\"),round(n_overall*100,2)\n", - "n_overall=0.253;\n", - "75*60*60/(n_overall*C*100)\n", - "print(\"fuel consumption,bhp/hr in kg=\"),round(75*60*60/(n_overall*C*100),2)\n", - "print(\"so compression ratio=19.37\")\n", - "print(\"air standard efficiency=63.25%\")\n", - "print(\"fuel consumption,bhp/hr=0.255 kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.3;pg no: 338" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.3, Page:338 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\n", - "1-2-3-4=cycle a\n", - "1-2_a-3_a-4_a-5=cycle b\n", - "here Cp/Cv=y\n", - "and R=0.293 KJ/kg K\n", - "let us consider 1 kg of air for perfect gas,\n", - "P*V=m*R*T\n", - "so V1=m*R*T1/P1 in m^3\n", - "at state 3,\n", - "P3*V3=m*R*T3\n", - "so T3/V2=P3/(m*R)\n", - "so T3=17064.8*V2............eq1\n", - "for cycle a and also for cycle b\n", - "T3_a=17064.8*V2_a.............eq2\n", - "a> for otto cycle,\n", - "Q23=Cv*(T3-T2)\n", - "so T3-T2=Q23/Cv\n", - "and T2=T3-2394.36.............eq3\n", - "from gas law,P2*V2/T2=P3*V3/T3\n", - "here V2=V3 and using eq 3,we get\n", - "so P2/(T3-2394.36)=5000/T3\n", - "substituting T3 as function of V2\n", - "P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\n", - "P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\n", - "also P1*V1^y=P2*V2^y\n", - "or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\n", - "upon solving it yields\n", - "381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\n", - "or V2^1.4-0.140*V2^0.4-.022=0\n", - "by hit and trial it yields,V2=0.18 \n", - "thus compression ratio,r=V1/V2\n", - "otto cycle efficiency,n_otto=1-(1/r)^(y-1)\n", - "in percentage\n", - "b> for mixed or dual cycle\n", - "Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\n", - "or T3_a-T2_a=850/Cv\n", - "or T2_a=T3_a-1197.2 .............eq4 \n", - "also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\n", - "P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\n", - "or P2_a/(T3_a-1197.2)=5000/T3_a\n", - "also we had seen earlier that T3_a=17064.8*V2_a\n", - "so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\n", - "so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\n", - "or for adiabatic process,1-2_a\n", - "P1*V1^y=P2*V2^y\n", - "so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\n", - "or V2_a^1.4-0.07*V2_a^0.4-0.022=0\n", - "by hit and trial \n", - "V2_a=0.122 m^3\n", - "therefore upon substituting V2_a,\n", - "by eq 5,P2_a in KPa\n", - "by eq 2,T3_a in K\n", - "by eq 4,T2_a in K\n", - "from constant pressure heat addition\n", - "Cp*(T4_a-T3_a)=850\n", - "so T4_a=T3_a+(850/Cp) in K\n", - "also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\n", - "so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \n", - "here P3_a=P4_a and V2_a=V3_a\n", - "using adiabatic formulations V4_a=0.172 m^3\n", - "(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\n", - "so T5=T4_a/(V5/V4_a)^(y-1) in K\n", - "heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\n", - "efficiency of mixed cycle(n_mixed)= 0.57\n", - "in percentage 56.55\n" - ] - }, - { - "data": { - "text/plain": [ - "'NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.'" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "#cal of comparing efficiency of two cycles\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.3, Page:338 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\")\n", - "T1=(100+273.15);#temperature at beginning of compresssion in K\n", - "P1=103;#pressure at beginning of compresssion in KPa\n", - "Cp=1.003;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", - "Q23=1700;#heat added during combustion in KJ/kg\n", - "P3=5000;#maximum pressure in cylinder in KPa\n", - "print(\"1-2-3-4=cycle a\")\n", - "print(\"1-2_a-3_a-4_a-5=cycle b\")\n", - "print(\"here Cp/Cv=y\")\n", - "y=Cp/Cv\n", - "y=1.4;#approx.\n", - "print(\"and R=0.293 KJ/kg K\")\n", - "R=0.293;\n", - "print(\"let us consider 1 kg of air for perfect gas,\")\n", - "m=1;#mass of air in kg\n", - "print(\"P*V=m*R*T\")\n", - "print(\"so V1=m*R*T1/P1 in m^3\")\n", - "V1=m*R*T1/P1\n", - "print(\"at state 3,\")\n", - "print(\"P3*V3=m*R*T3\")\n", - "print(\"so T3/V2=P3/(m*R)\")\n", - "P3/(m*R)\n", - "print(\"so T3=17064.8*V2............eq1\")\n", - "print(\"for cycle a and also for cycle b\")\n", - "print(\"T3_a=17064.8*V2_a.............eq2\")\n", - "print(\"a> for otto cycle,\")\n", - "print(\"Q23=Cv*(T3-T2)\")\n", - "print(\"so T3-T2=Q23/Cv\")\n", - "Q23/Cv\n", - "print(\"and T2=T3-2394.36.............eq3\")\n", - "print(\"from gas law,P2*V2/T2=P3*V3/T3\")\n", - "print(\"here V2=V3 and using eq 3,we get\")\n", - "print(\"so P2/(T3-2394.36)=5000/T3\")\n", - "print(\"substituting T3 as function of V2\")\n", - "print(\"P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\")\n", - "print(\"P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\")\n", - "print(\"also P1*V1^y=P2*V2^y\")\n", - "print(\"or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\")\n", - "print(\"upon solving it yields\")\n", - "print(\"381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\")\n", - "print(\"or V2^1.4-0.140*V2^0.4-.022=0\")\n", - "print(\"by hit and trial it yields,V2=0.18 \")\n", - "V2=0.18;\n", - "print(\"thus compression ratio,r=V1/V2\")\n", - "r=V1/V2\n", - "print(\"otto cycle efficiency,n_otto=1-(1/r)^(y-1)\")\n", - "n_otto=1-(1/r)**(y-1)\n", - "print(\"in percentage\")\n", - "n_otto=n_otto*100\n", - "print(\"b> for mixed or dual cycle\")\n", - "print(\"Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\")\n", - "print(\"or T3_a-T2_a=850/Cv\")\n", - "850/Cv\n", - "print(\"or T2_a=T3_a-1197.2 .............eq4 \")\n", - "print(\"also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\")\n", - "print(\"P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\")\n", - "print(\"or P2_a/(T3_a-1197.2)=5000/T3_a\")\n", - "print(\"also we had seen earlier that T3_a=17064.8*V2_a\")\n", - "print(\"so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\")\n", - "print(\"so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\")\n", - "print(\"or for adiabatic process,1-2_a\")\n", - "print(\"P1*V1^y=P2*V2^y\")\n", - "print(\"so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\")\n", - "print(\"or V2_a^1.4-0.07*V2_a^0.4-0.022=0\")\n", - "print(\"by hit and trial \")\n", - "print(\"V2_a=0.122 m^3\")\n", - "V2_a=0.122;\n", - "print(\"therefore upon substituting V2_a,\")\n", - "print(\"by eq 5,P2_a in KPa\")\n", - "P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a)\n", - "print(\"by eq 2,T3_a in K\")\n", - "T3_a=17064.8*V2_a\n", - "print(\"by eq 4,T2_a in K\")\n", - "T2_a=T3_a-1197.2\n", - "print(\"from constant pressure heat addition\")\n", - "print(\"Cp*(T4_a-T3_a)=850\")\n", - "print(\"so T4_a=T3_a+(850/Cp) in K\")\n", - "T4_a=T3_a+(850/Cp)\n", - "print(\"also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\")\n", - "print(\"so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \")\n", - "print(\"here P3_a=P4_a and V2_a=V3_a\")\n", - "V4_a=V2_a*T4_a/(T3_a)\n", - "print(\"using adiabatic formulations V4_a=0.172 m^3\")\n", - "print(\"(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\")\n", - "V5=V1;\n", - "print(\"so T5=T4_a/(V5/V4_a)^(y-1) in K\")\n", - "T5=T4_a/(V5/V4_a)**(y-1)\n", - "print(\"heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\")\n", - "Q51=Cv*(T5-T1)\n", - "n_mixed=(Q23-Q51)/Q23\n", - "print(\"efficiency of mixed cycle(n_mixed)=\"),round(n_mixed,2)\n", - "print(\"in percentage\"),round(n_mixed*100,2)\n", - "(\"NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.4;pg no: 341" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.4, Page:341 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\n", - "optimum pressure ratio for maximum work output,\n", - "rp=(T_max/T_min)^((y)/(2*(y-1)))\n", - "so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\n", - "so T2=T1*(p2/p1)^((y-1)/y)in K\n", - "For process 3-4,\n", - "T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\n", - "so T4=T3/(rp)^((y-1)/y)in K\n", - "heat supplied,Q23=Cp*(T3-T2)in KJ/kg\n", - "compressor work,Wc in KJ/kg= 301.5\n", - "turbine work,Wt in KJ/kg= 603.0\n", - "thermal efficiency=net work/heat supplied= 0.5\n", - "so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,turbine and compressor work\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.4, Page:341 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\")\n", - "T3=1200;#maximum temperature in K\n", - "T1=300;#minimum temperature in K\n", - "y=1.4;#expansion constant\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"optimum pressure ratio for maximum work output,\")\n", - "print(\"rp=(T_max/T_min)^((y)/(2*(y-1)))\")\n", - "T_max=T3;\n", - "T_min=T1;\n", - "rp=(T_max/T_min)**((y)/(2*(y-1)))\n", - "print(\"so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\")\n", - "print(\"so T2=T1*(p2/p1)^((y-1)/y)in K\")\n", - "T2=T1*(rp)**((y-1)/y)\n", - "print(\"For process 3-4,\")\n", - "print(\"T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\")\n", - "print(\"so T4=T3/(rp)^((y-1)/y)in K\")\n", - "T4=T3/(rp)**((y-1)/y)\n", - "print(\"heat supplied,Q23=Cp*(T3-T2)in KJ/kg\")\n", - "Q23=Cp*(T3-T2)\n", - "Wc=Cp*(T2-T1)\n", - "print(\"compressor work,Wc in KJ/kg=\"),round(Wc,2)\n", - "Wt=Cp*(T3-T4)\n", - "print(\"turbine work,Wt in KJ/kg=\"),round(Wt,2)\n", - "(Wt-Wc)/Q23\n", - "print(\"thermal efficiency=net work/heat supplied=\"),round((Wt-Wc)/Q23,2)\n", - "print(\"so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.5;pg no: 342" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.5, Page:342 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\n", - "gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\n", - "for process 1-2 being isentropic,\n", - "T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y) in K\n", - "considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\n", - "so T2_a=T1+((T2-T1)/n_compr)in K\n", - "during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\n", - "heat added=mf*q\n", - "=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\n", - "or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\n", - "so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\n", - "for expansion 3-4 being\n", - "T4/T3=(P4/P3)^((n-1)/n)\n", - "so T4=T3*(P4/P3)^((n-1)/n) in K\n", - "actaul temperature at turbine inlet considering internal efficiency of turbine,\n", - "n_turb=(T3-T4_a)/(T3-T4)\n", - "so T4_a=T3-(n_turb*(T3-T4)) in K\n", - "compressor work,per kg of air compressed(Wc) in KJ/kg of air= 234.42\n", - "so compressor work=234.42 KJ/kg of air\n", - "turbine work,per kg of air compressed(Wt) in KJ/kg of air= 414.71\n", - "so turbine work=414.71 KJ/kg of air\n", - "net work(W_net) in KJ/kg of air= 180.29\n", - "heat supplied(Q) in KJ/kg of air= 751.16\n", - "thermal efficiency(n)= 0.24\n", - "in percentage 24.0\n", - "so thermal efficiency=24%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,turbine and compressor work\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.5, Page:342 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\")\n", - "P1=1*10**5;#initial pressure in Pa\n", - "P4=P1;#constant pressure process\n", - "T1=300;#initial temperature in K\n", - "P2=6.2*10**5;#pressure after compression in Pa\n", - "P3=P2;#constant pressure process\n", - "k=0.017;#fuel to air ratio\n", - "n_compr=0.88;#compressor efficiency\n", - "q=44186;#heating value of fuel in KJ/kg\n", - "n_turb=0.9;#turbine internal efficiency\n", - "Cp_comb=1.147;#specific heat of combustion at constant pressure in KJ/kg K\n", - "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", - "y=1.4;#expansion constant\n", - "n=1.33;#expansion constant for polytropic constant\n", - "print(\"gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\")\n", - "print(\"for process 1-2 being isentropic,\")\n", - "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", - "T2=T1*(P2/P1)**((y-1)/y)\n", - "print(\"considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\")\n", - "print(\"so T2_a=T1+((T2-T1)/n_compr)in K\")\n", - "T2_a=T1+((T2-T1)/n_compr)\n", - "print(\"during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\")\n", - "print(\"heat added=mf*q\")\n", - "print(\"=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\")\n", - "print(\"or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\")\n", - "print(\"so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\")\n", - "T3=((k)*q+(Cp_air*T2_a))/((1+(k))*Cp_comb)\n", - "print(\"for expansion 3-4 being\")\n", - "print(\"T4/T3=(P4/P3)^((n-1)/n)\")\n", - "print(\"so T4=T3*(P4/P3)^((n-1)/n) in K\")\n", - "T4=T3*(P4/P3)**((n-1)/n)\n", - "print(\"actaul temperature at turbine inlet considering internal efficiency of turbine,\")\n", - "print(\"n_turb=(T3-T4_a)/(T3-T4)\")\n", - "print(\"so T4_a=T3-(n_turb*(T3-T4)) in K\")\n", - "T4_a=T3-(n_turb*(T3-T4))\n", - "Wc=Cp_air*(T2_a-T1)\n", - "print(\"compressor work,per kg of air compressed(Wc) in KJ/kg of air=\"),round(Wc,2)\n", - "print(\"so compressor work=234.42 KJ/kg of air\")\n", - "Wt=Cp_comb*(T3-T4_a)\n", - "print(\"turbine work,per kg of air compressed(Wt) in KJ/kg of air=\"),round(Wt,2)\n", - "print(\"so turbine work=414.71 KJ/kg of air\")\n", - "W_net=Wt-Wc\n", - "print(\"net work(W_net) in KJ/kg of air=\"),round(W_net,2)\n", - "Q=k*q\n", - "print(\"heat supplied(Q) in KJ/kg of air=\"),round(Q,2)\n", - "n=W_net/Q\n", - "print(\"thermal efficiency(n)=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so thermal efficiency=24%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.6;pg no: 343" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.6, Page:343 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\n", - "NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\n", - "overall pressure ratio(rp)= 13.59\n", - "so overall optimum pressure ratio=13.6\n" - ] - } - ], - "source": [ - "#cal of overall optimum pressure ratio\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.6, Page:343 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\")\n", - "T1=300;#minimum temperature in brayton cycle in K\n", - "T5=1200;#maximum temperature in brayton cycle in K\n", - "n_isen_c=0.85;#isentropic efficiency of compressor\n", - "n_isen_t=0.9;#isentropic efficiency of turbine\n", - "y=1.4;#expansion constant\n", - "print(\"NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\")\n", - "rp=(T1/(T5*n_isen_c*n_isen_t))**((2*y)/(3*(1-y)))\n", - "print(\"overall pressure ratio(rp)=\"),round(rp,2)\n", - "print(\"so overall optimum pressure ratio=13.6\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.7;pg no: 346" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.7, Page:346 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\n", - "i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\n", - "therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\n", - "or P9/P1=k=(1.35)^8 11.03\n", - "or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\n", - "T9/T1=(P9/P1)^((y-1)/y)\n", - "so T9 in K= 621.47\n", - "considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\n", - "(T9-T1)/(T9_actual-T1)=0.82\n", - "so T9_actual=T1+((T9-T1)/0.82) in K 689.19\n", - "let the actual index of compression be n, then\n", - "(T9_actual/T1)=(P9/P1)^((n-1)/n)\n", - "so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\n", - "so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\n", - "ii> let polytropic efficiency be n_polytropic for compressor then,\n", - "(n-1)/n=((y-1)/y)*(1/n_polytropic)\n", - "so n_polytropic= 0.87\n", - "in percentage 86.9\n", - "so ploytropic efficiency=86.88%\n", - "iii> stage efficiency can be estimated for any stage.say first stage.\n", - "ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y) in K\n", - "actual temperature at exit of first stage can be estimated using polytropic index 1.49.\n", - "T2_actual/T1=(P2/P1)^((n-1)/n)\n", - "so T2_actual=T1*(P2/P1)^((n-1)/n) in K\n", - "stage efficiency for first stage,ns_1= 0.86\n", - "in percentage 86.33\n", - "actual temperature at exit of second stage,\n", - "T3_actual/T2_actual=(P3/P2)^((n-1)/n)\n", - "so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\n", - "ideal temperature at exit of second stage\n", - "T3/T2_actual=(P3/P2)^((n-1)/n)\n", - "so T3=T2_actual*(P3/P2)^((y-1)/y) in K\n", - "stage efficiency for second stage,ns_2= 0.86\n", - "in percentage 86.33\n", - "actual rtemperature at exit of third stage,\n", - "T4_actual/T3_actual=(P4/P3)^((n-1)/n)\n", - "so T4_actual in K= 420.83\n", - "ideal temperature at exit of third stage,\n", - "T4/T3_actual=(P4/P3)^((n-1)/n)\n", - "so T4 in K= 415.42\n", - "stage efficiency for third stage,ns_3= 0.86\n", - "in percentage= 8632.9\n", - "so stage efficiency=86.4%\n", - "iv> from steady flow energy equation,\n", - "Wc=dw=dh and dh=du+p*dv+v*dp\n", - "dh=dq+v*dp\n", - "dq=0 in adiabatic process\n", - "dh=v*dp\n", - "Wc=v*dp\n", - "here for polytropic compression \n", - "P*V^1.49=constant i.e n=1.49\n", - "Wc in KJ/s= 16419.87\n", - "due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s= 14777.89\n", - "so power required to drive compressor =14777.89 KJ/s\n" - ] - } - ], - "source": [ - "#cal of state of air at exit of compressor,polytropic efficiency,efficiency of each sate,power\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.7, Page:346 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\")\n", - "T1=313.;#air entering temperature in K\n", - "P1=1*10**5;#air entering pressure in Pa\n", - "m=50.;#flow rate through compressor in kg/s\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\")\n", - "print(\"therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\")\n", - "r=1.35;#compression ratio\n", - "k=(1.35)**8\n", - "print(\"or P9/P1=k=(1.35)^8\"),round(k,2)\n", - "k=11.03;#approx.\n", - "print(\"or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\")\n", - "y=1.4;#expansion constant \n", - "print(\"T9/T1=(P9/P1)^((y-1)/y)\")\n", - "T9=T1*(k)**((y-1)/y)\n", - "print(\"so T9 in K=\"),round(T9,2)\n", - "print(\"considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\")\n", - "print(\"(T9-T1)/(T9_actual-T1)=0.82\")\n", - "T9_actual=T1+((T9-T1)/0.82)\n", - "print(\"so T9_actual=T1+((T9-T1)/0.82) in K\"),round(T9_actual,2)\n", - "print(\"let the actual index of compression be n, then\")\n", - "print(\"(T9_actual/T1)=(P9/P1)^((n-1)/n)\")\n", - "print(\"so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\")\n", - "n=math.log(k)/(math.log(k)-math.log(T9_actual/T1))\n", - "print(\"so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\")\n", - "print(\"ii> let polytropic efficiency be n_polytropic for compressor then,\")\n", - "print(\"(n-1)/n=((y-1)/y)*(1/n_polytropic)\")\n", - "n_polytropic=((y-1)/y)/((n-1)/n)\n", - "print(\"so n_polytropic=\"),round(n_polytropic,2)\n", - "print(\"in percentage\"),round(n_polytropic*100,2)\n", - "print(\"so ploytropic efficiency=86.88%\")\n", - "print(\"iii> stage efficiency can be estimated for any stage.say first stage.\")\n", - "print(\"ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", - "T2=T1*(r)**((y-1)/y)\n", - "print(\"actual temperature at exit of first stage can be estimated using polytropic index 1.49.\")\n", - "print(\"T2_actual/T1=(P2/P1)^((n-1)/n)\")\n", - "print(\"so T2_actual=T1*(P2/P1)^((n-1)/n) in K\")\n", - "T2_actual=T1*(r)**((n-1)/n)\n", - "ns_1=(T2-T1)/(T2_actual-T1)\n", - "print(\"stage efficiency for first stage,ns_1=\"),round(ns_1,2)\n", - "print(\"in percentage\"),round(ns_1*100,2)\n", - "print(\"actual temperature at exit of second stage,\")\n", - "print(\"T3_actual/T2_actual=(P3/P2)^((n-1)/n)\")\n", - "print(\"so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\")\n", - "T3_actual=T2_actual*(r)**((n-1)/n)\n", - "print(\"ideal temperature at exit of second stage\")\n", - "print(\"T3/T2_actual=(P3/P2)^((n-1)/n)\")\n", - "print(\"so T3=T2_actual*(P3/P2)^((y-1)/y) in K\")\n", - "T3=T2_actual*(r)**((y-1)/y)\n", - "ns_2=(T3-T2_actual)/(T3_actual-T2_actual)\n", - "print(\"stage efficiency for second stage,ns_2=\"),round(ns_2,2)\n", - "print(\"in percentage\"),round(ns_2*100,2)\n", - "print(\"actual rtemperature at exit of third stage,\")\n", - "print(\"T4_actual/T3_actual=(P4/P3)^((n-1)/n)\")\n", - "T4_actual=T3_actual*(r)**((n-1)/n)\n", - "print(\"so T4_actual in K=\"),round(T4_actual,2)\n", - "print(\"ideal temperature at exit of third stage,\")\n", - "print(\"T4/T3_actual=(P4/P3)^((n-1)/n)\")\n", - "T4=T3_actual*(r)**((y-1)/y)\n", - "print(\"so T4 in K=\"),round(T4,2)\n", - "ns_3=(T4-T3_actual)/(T4_actual-T3_actual)\n", - "print(\"stage efficiency for third stage,ns_3=\"),round(ns_3,2)\n", - "ns_3=ns_3*100\n", - "print(\"in percentage=\"),round(ns_3*100,2)\n", - "print(\"so stage efficiency=86.4%\")\n", - "print(\"iv> from steady flow energy equation,\")\n", - "print(\"Wc=dw=dh and dh=du+p*dv+v*dp\")\n", - "print(\"dh=dq+v*dp\")\n", - "print(\"dq=0 in adiabatic process\")\n", - "print(\"dh=v*dp\")\n", - "print(\"Wc=v*dp\")\n", - "print(\"here for polytropic compression \")\n", - "print(\"P*V^1.49=constant i.e n=1.49\")\n", - "n=1.49;\n", - "Wc=(n/(n-1))*m*R*T1*(((k)**((n-1)/n))-1)\n", - "print(\"Wc in KJ/s=\"),round(Wc,2)\n", - "Wc_actual=Wc*0.9\n", - "print(\"due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s=\"),round(Wc*0.9,2)\n", - "print(\"so power required to drive compressor =14777.89 KJ/s\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.8;pg no: 349" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.8, Page:349 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\n", - "In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.8, Page:349 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\")\n", - "print(\"In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.9;pg no: 350" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.9, Page:350 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\n", - "using polytropic efficiency the index of compression and expansion can be obtained as under,\n", - "let compression index be nc,\n", - "(nc-1)/nc=(y-1)/(y*n_poly_c)\n", - "so nc=1/(1-((y-1)/(y*n_poly_c)))\n", - "let expansion index be nt,\n", - "(nt-1)/nt=(n_poly_T*(y-1))/y\n", - "so nt=1/(1-((n_poly_T*(y-1))/y))\n", - "For process 1-2\n", - "T2/T1=(p2/p1)^((nc-1)/nc)\n", - "so T2=T1*(p2/p1)^((nc-1)/nc)in K\n", - "also T4/T3=(p4/p3)^((nt-1)/nt)\n", - "so T4=T3*(p4/p3)^((nt-1)/nt)in K\n", - "using heat exchanger effectivenesss,\n", - "epsilon=(T5-T2)/(T4-T2)\n", - "so T5=T2+(epsilon*(T4-T2))in K\n", - "heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\n", - "compressor work,Wc=Cp*(T2-T1)in \n", - "turbine work,Wt=Cp*(T3-T4)in KJ/kg\n", - "cycle efficiency= 0.33\n", - "in percentage 32.79\n", - "work ratio= 0.33\n", - "specific work output in KJ/kg= 152.56\n", - "so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of cycle efficiency,work ratio,specific work output\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.9, Page:350 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\")\n", - "y=1.4;#expansion constant\n", - "n_poly_c=0.85;#ploytropic efficiency of compressor\n", - "n_poly_T=0.90;#ploytropic efficiency of Turbine\n", - "r=8.;#compression ratio\n", - "T1=(27.+273.);#temperature of air in compressor in K\n", - "T3=1100.;#temperature of air leaving combustion chamber in K\n", - "epsilon=0.8;#effectiveness of heat exchanger\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "print(\"using polytropic efficiency the index of compression and expansion can be obtained as under,\")\n", - "print(\"let compression index be nc,\")\n", - "print(\"(nc-1)/nc=(y-1)/(y*n_poly_c)\")\n", - "print(\"so nc=1/(1-((y-1)/(y*n_poly_c)))\")\n", - "nc=1/(1-((y-1)/(y*n_poly_c)))\n", - "print(\"let expansion index be nt,\")\n", - "print(\"(nt-1)/nt=(n_poly_T*(y-1))/y\")\n", - "print(\"so nt=1/(1-((n_poly_T*(y-1))/y))\")\n", - "nt=1/(1-((n_poly_T*(y-1))/y))\n", - "print(\"For process 1-2\")\n", - "print(\"T2/T1=(p2/p1)^((nc-1)/nc)\")\n", - "print(\"so T2=T1*(p2/p1)^((nc-1)/nc)in K\")\n", - "T2=T1*(r)**((nc-1)/nc)\n", - "print(\"also T4/T3=(p4/p3)^((nt-1)/nt)\")\n", - "print(\"so T4=T3*(p4/p3)^((nt-1)/nt)in K\")\n", - "T4=T3*(1/r)**((nt-1)/nt)\n", - "print(\"using heat exchanger effectivenesss,\") \n", - "print(\"epsilon=(T5-T2)/(T4-T2)\")\n", - "print(\"so T5=T2+(epsilon*(T4-T2))in K\")\n", - "T5=T2+(epsilon*(T4-T2))\n", - "print(\"heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\")\n", - "q_add=Cp*(T3-T5)\n", - "print(\"compressor work,Wc=Cp*(T2-T1)in \")\n", - "Wc=Cp*(T2-T1)\n", - "print(\"turbine work,Wt=Cp*(T3-T4)in KJ/kg\")\n", - "Wt=Cp*(T3-T4)\n", - "(Wt-Wc)/q_add\n", - "print(\"cycle efficiency=\"),round((Wt-Wc)/q_add,2)\n", - "print(\"in percentage\"),round((Wt-Wc)*100/q_add,2)\n", - "(Wt-Wc)/Wt\n", - "print(\"work ratio=\"),round((Wt-Wc)/Wt,2)\n", - "print(\"specific work output in KJ/kg=\"),round(Wt-Wc,2)\n", - "print(\"so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.10;pg no: 351" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.10, Page:351 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\n", - "for process 1-2_a\n", - "T2_a/T1=(p2_a/p1)^((y-1)/y)\n", - "so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\n", - "nc=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+((T2_a-T1)/nc) in K\n", - "for process 3-4_a,\n", - "T4_a/T3=(p4/p3)^((y-1)/y)\n", - "so T4_a=T3*(p4/p3)^((y-1)/y)in K\n", - "Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", - "Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\n", - "net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\n", - "heat added,q_add=Cp*(T3-T2) in KJ/kg\n", - "thermal efficiency,n=W_net/q_add\n", - "n={Wc-(Cp*(T3-T4))}/q_add\n", - "so T4=T3-((Wc-(n*q_add))/Cp)in K\n", - "therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a) 0.297\n", - "in percentage 29.7\n", - "so turbine isentropic efficiency=29.69%\n" - ] - } - ], - "source": [ - "#cal of isentropic efficiency of turbine\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.10, Page:351 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\")\n", - "T1=(27+273);#temperature of air in compressor in K\n", - "p1=1*10**5;#pressure of air in compressor in Pa\n", - "p2=5*10**5;#pressure of air after compression in Pa\n", - "p3=p2-0.2*10**5;#pressure drop in Pa\n", - "p4=1*10**5;#pressure to which expansion occur in turbine in Pa\n", - "nc=0.85;#isentropic efficiency\n", - "T3=1000;#temperature of air in combustion chamber in K\n", - "n=0.2;#thermal efficiency of plant\n", - "y=1.4;#expansion constant\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "print(\"for process 1-2_a\")\n", - "print(\"T2_a/T1=(p2_a/p1)^((y-1)/y)\")\n", - "print(\"so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\")\n", - "T2_a=T1*(p2/p1)**((y-1)/y)\n", - "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+((T2_a-T1)/nc) in K\")\n", - "T2=T1+((T2_a-T1)/nc)\n", - "print(\"for process 3-4_a,\")\n", - "print(\"T4_a/T3=(p4/p3)^((y-1)/y)\")\n", - "print(\"so T4_a=T3*(p4/p3)^((y-1)/y)in K\")\n", - "T4_a=T3*(p4/p3)**((y-1)/y)\n", - "print(\"Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", - "Wc=Cp*(T2-T1)\n", - "print(\"Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\")\n", - "print(\"net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\")\n", - "print(\"heat added,q_add=Cp*(T3-T2) in KJ/kg\")\n", - "q_add=Cp*(T3-T2)\n", - "print(\"thermal efficiency,n=W_net/q_add\")\n", - "print(\"n={Wc-(Cp*(T3-T4))}/q_add\")\n", - "print(\"so T4=T3-((Wc-(n*q_add))/Cp)in K\")\n", - "T4=T3-((Wc-(n*q_add))/Cp)\n", - "nt=(T3-T4)/(T3-T4_a)\n", - "print(\"therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a)\"),round((T3-T4)/(T3-T4_a),3)\n", - "print(\"in percentage\"),round(nt*100,2)\n", - "print(\"so turbine isentropic efficiency=29.69%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.11;pg no: 352" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.11, Page:352 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\n", - "for perfect intercooling the pressure ratio of each compression stage(k)\n", - "k=sqrt(r)\n", - "for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\n", - "so T2_a=T1*(k)^((y-1)/y)in K\n", - "considering isentropic efficiency of compression,\n", - "nc=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+((T2_a-T1)/nc)in K\n", - "for process 3-4,\n", - "T4_a/T3=(P4/P3)^((y-1)/y)\n", - "so T4_a=T3*(P4/P3)^((y-1)/y) in K\n", - "again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\n", - "so T4=T3+((T4_a-T3)/nc)in K\n", - "total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\n", - "for expansion process 5-6_a,\n", - "T6_a/T5=(P6/P5)^((y-1)/y)\n", - "so T6_a=T5*(P6/P5)^((y-1)/y) in K\n", - "considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\n", - "T6=T5-(ne*(T5-T6_a)) in K\n", - "for expansion in 7-8_a\n", - "T8_a/T7=(P8/P7)^((y-1)/y)\n", - "so T8_a=T7*(P8/P7)^((y-1)/y) in K\n", - "considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\n", - "so T8=T7-(ne*(T7-T8_a))in K\n", - "expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\n", - "heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\n", - "fuel required per kg of air,mf=q_add/C 0.02\n", - "air-fuel ratio=1/mf 51.08\n", - "net output(W) in KJ/kg= 229.2\n", - "output for air flowing at 30 kg/s,=W*m in KW 6876.05\n", - "thermal efficiency= 0.28\n", - "in percentage 27.88\n", - "so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\n", - "NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,net output,A/F ratio\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.11, Page:352 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\")\n", - "P1=1.*10**5;#initial pressure in Pa\n", - "T1=(27.+273.);#initial temperature in K\n", - "T3=T1;\n", - "r=10.;#pressure ratio\n", - "T5=1000.;#maximum temperature in cycle in K\n", - "P6=3.*10**5;#first stage expansion pressure in Pa\n", - "T7=995.;#first stage reheated temperature in K\n", - "C=42000.;#calorific value of fuel in KJ/kg\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "m=30.;#air flow rate in kg/s\n", - "nc=0.85;#isentropic efficiency of compression\n", - "ne=0.9;#isentropic efficiency of expansion\n", - "y=1.4;#expansion constant\n", - "print(\"for perfect intercooling the pressure ratio of each compression stage(k)\")\n", - "print(\"k=sqrt(r)\")\n", - "k=math.sqrt(r)\n", - "k=3.16;#approx.\n", - "print(\"for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2_a=T1*(k)^((y-1)/y)in K\")\n", - "T2_a=T1*(k)**((y-1)/y)\n", - "print(\"considering isentropic efficiency of compression,\")\n", - "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+((T2_a-T1)/nc)in K\")\n", - "T2=T1+((T2_a-T1)/nc)\n", - "print(\"for process 3-4,\")\n", - "print(\"T4_a/T3=(P4/P3)^((y-1)/y)\")\n", - "print(\"so T4_a=T3*(P4/P3)^((y-1)/y) in K\")\n", - "T4_a=T3*(k)**((y-1)/y)\n", - "print(\"again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\")\n", - "print(\"so T4=T3+((T4_a-T3)/nc)in K\")\n", - "T4=T3+((T4_a-T3)/nc)\n", - "print(\"total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\")\n", - "Wc=2*Cp*(T4-T3)\n", - "print(\"for expansion process 5-6_a,\")\n", - "print(\"T6_a/T5=(P6/P5)^((y-1)/y)\")\n", - "print(\"so T6_a=T5*(P6/P5)^((y-1)/y) in K\")\n", - "P5=10.*10**5;#pressure in Pa\n", - "T6_a=T5*(P6/P5)**((y-1)/y)\n", - "print(\"considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\")\n", - "print(\"T6=T5-(ne*(T5-T6_a)) in K\")\n", - "T6=T5-(ne*(T5-T6_a))\n", - "print(\"for expansion in 7-8_a\")\n", - "print(\"T8_a/T7=(P8/P7)^((y-1)/y)\")\n", - "print(\"so T8_a=T7*(P8/P7)^((y-1)/y) in K\")\n", - "P8=P1;#constant pressure process\n", - "P7=P6;#constant pressure process\n", - "T8_a=T7*(P8/P7)**((y-1)/y)\n", - "print(\"considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\")\n", - "print(\"so T8=T7-(ne*(T7-T8_a))in K\")\n", - "T8=T7-(ne*(T7-T8_a))\n", - "print(\"expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\")\n", - "Wt=Cp*(T5-T6)+Cp*(T7-T8)\n", - "print(\"heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\")\n", - "q_add=Cp*(T5-T4)+Cp*(T7-T6)\n", - "mf=q_add/C\n", - "print(\"fuel required per kg of air,mf=q_add/C\"),round(q_add/C,2)\n", - "print(\"air-fuel ratio=1/mf\"),round(1/mf,2)\n", - "W=Wt-Wc\n", - "print(\"net output(W) in KJ/kg=\"),round(Wt-Wc,2)\n", - "print(\"output for air flowing at 30 kg/s,=W*m in KW\"),round(W*m,2)\n", - "W/q_add\n", - "print(\"thermal efficiency=\"),round(W/q_add,2)\n", - "print(\"in percentage\"),round(W*100/q_add,2)\n", - "print(\"so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\")\n", - "print(\"NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.12;pg no: 354" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.12, Page:354 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\n", - "for process 1-2,\n", - "T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y) in K\n", - "for process 3-4,\n", - "T4/T3=(P4/P3)^((y-1)/y)\n", - "so T4=T3*(P4/P3)^((y-1)/y) in K\n", - "for process 6-7,\n", - "T7/T6=(P7/P6)^((y-1)/y)\n", - "so T7=T6*(P7/P6)^((y-1)/y) in K\n", - "for process 8-9,\n", - "T9/T8=(P9/P8)^((y-1)/y)\n", - "T9=T8*(P9/P8)^((y-1)/y) in K\n", - "in regenerator,effectiveness=(T5-T4)/(T9-T4)\n", - "T5=T4+(ne*(T9-T4))in K\n", - "compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\n", - "turbine work per kg air,Wt in KJ/kg= 660.84\n", - "heat added per kg air,q_add in KJ/kg= 765.43\n", - "total fuel required per kg of air= 0.02\n", - "net work,W_net in KJ/kg= 450.85\n", - "cycle thermal efficiency,n= 0.59\n", - "in percentage 58.9\n", - "fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C= 0.0056\n", - "fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C= 0.0126\n", - "so fuel-air ratio in two combustion chambers=0.0126,0.0056\n", - "total turbine work=660.85 KJ/kg\n", - "cycle thermal efficiency=58.9%\n", - "NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \n" - ] - } - ], - "source": [ - "#cal of fuel-air ratio in two combustion chambers,total turbine work,cycle thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.12, Page:354 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\")\n", - "P1=1.*10**5;#initial pressure in Pa\n", - "P9=P1;\n", - "T1=300.;#initial temperature in K\n", - "P2=4.*10**5;#pressure of air in intercooler in Pa\n", - "P3=P2;\n", - "T3=290.;#temperature of air in intercooler in K\n", - "T6=1300.;#temperature of combustion chamber in K\n", - "P4=8.*10**5;#pressure of air after compression in Pa\n", - "P6=P4;\n", - "T8=1300.;#temperature after reheating in K\n", - "P8=4.*10**5;#pressure after expansion in Pa\n", - "P7=P8;\n", - "C=42000.;#heating value of fuel in KJ/kg\n", - "y=1.4;#expansion constant\n", - "ne=0.8;#effectiveness of regenerator\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "print(\"for process 1-2,\")\n", - "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", - "T2=T1*(P2/P1)**((y-1)/y)\n", - "print(\"for process 3-4,\")\n", - "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", - "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", - "T4=T3*(P4/P3)**((y-1)/y)\n", - "print(\"for process 6-7,\")\n", - "print(\"T7/T6=(P7/P6)^((y-1)/y)\")\n", - "print(\"so T7=T6*(P7/P6)^((y-1)/y) in K\")\n", - "T7=T6*(P7/P6)**((y-1)/y)\n", - "print(\"for process 8-9,\")\n", - "print(\"T9/T8=(P9/P8)^((y-1)/y)\")\n", - "print(\"T9=T8*(P9/P8)^((y-1)/y) in K\")\n", - "T9=T8*(P9/P8)**((y-1)/y)\n", - "print(\"in regenerator,effectiveness=(T5-T4)/(T9-T4)\")\n", - "print(\"T5=T4+(ne*(T9-T4))in K\")\n", - "T5=T4+(ne*(T9-T4))\n", - "print(\"compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\")\n", - "Wc=Cp*(T2-T1)+Cp*(T4-T3)\n", - "Wt=Cp*(T6-T7)+Cp*(T8-T9)\n", - "print(\"turbine work per kg air,Wt in KJ/kg=\"),round(Wt,2)\n", - "q_add=Cp*(T6-T5)+Cp*(T8-T7)\n", - "print(\"heat added per kg air,q_add in KJ/kg=\"),round(q_add,2)\n", - "q_add/C\n", - "print(\"total fuel required per kg of air=\"),round(q_add/C,2)\n", - "W_net=Wt-Wc\n", - "print(\"net work,W_net in KJ/kg=\"),round(W_net,2)\n", - "n=W_net/q_add\n", - "print(\"cycle thermal efficiency,n=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C=\"),round(Cp*(T8-T7)/C,4)\n", - "print(\"fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C=\"),round(Cp*(T6-T5)/C,4)\n", - "print(\"so fuel-air ratio in two combustion chambers=0.0126,0.0056\")\n", - "print(\"total turbine work=660.85 KJ/kg\")\n", - "print(\"cycle thermal efficiency=58.9%\")\n", - "print(\"NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.13;pg no: 356" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.13, Page:356 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\n", - "work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\n", - "heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\n", - "for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\n", - "mass of air per cycle=m/n in kg/cycle\n", - "brake output in KW= 17.12\n", - "stroke volume,V in m^3= 0.0117\n", - "brake output=17.11 KW\n", - "stroke volume=0.0116 m^3\n" - ] - } - ], - "source": [ - "#cal of brake output,stroke volume\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.13, Page:356 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\")\n", - "T2=700.;#highest temperature of stirling engine in K\n", - "T1=300.;#lowest temperature of stirling engine in K\n", - "r=3.;#compression ratio\n", - "q_add=30.;#heat addition in KJ/s\n", - "epsilon=0.9;#regenerator efficiency\n", - "P=1*10**5;#pressure at begining of compression in Pa\n", - "n=100.;#number of cycle per minute\n", - "Cv=0.72;#specific heat at constant volume in KJ/kg K\n", - "R=29.27;#gas constant in KJ/kg K\n", - "print(\"work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\")\n", - "W=R*(T2-T1)*math.log(r)\n", - "print(\"heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\")\n", - "q=R*T2*math.log(r)+(1-epsilon)*Cv*(T2-T1)\n", - "print(\"for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\")\n", - "m=q_add/q\n", - "print(\"mass of air per cycle=m/n in kg/cycle\")\n", - "m/n\n", - "print(\"brake output in KW=\"),round(W*m,2)\n", - "m=1.33*10**-4;#mass of air per cycle in kg/cycle\n", - "T=T1;\n", - "V=m*R*T*1000/P\n", - "print(\"stroke volume,V in m^3=\"),round(V,4)\n", - "print(\"brake output=17.11 KW\")\n", - "print(\"stroke volume=0.0116 m^3\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.14;pg no: 357" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.14, Page:357 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\n", - "In question no.14,various expression is derived which cannot be solved using python software.\n" - ] - } - ], - "source": [ - "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.14, Page:357 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\")\n", - "print(\"In question no.14,various expression is derived which cannot be solved using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.15;pg no: 361" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.15, Page:361 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\n", - "In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y)in K\n", - "T4/T3=(P4/P3)^((y-1)/y)\n", - "so T4=T3*(P4/P3)^((y-1)/y) in K\n", - "compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", - "turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \n", - "heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \n", - "net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\n", - "heat recovered in HRSG for steam generation per kg of air\n", - "q_HRGC=Cp*(T4-T5)in KJ/kg\n", - "at inlet to steam in turbine,\n", - "from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\n", - "for expansion in steam turbine,sa=sb\n", - "let dryness fraction at state b be x\n", - "also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\n", - "sb=sf+x*sfg\n", - "so x=(sb-sf)/sfg \n", - "so hb=hf+x*hfg in KJ/kg K\n", - "at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\n", - "at exit of feed pump,hd=hd-hc\n", - "hd=vc*(Pg-Pc)*100 in KJ/kg\n", - "heat added per kg of steam =ha-hd in KJ/kg\n", - "mass of steam generated per kg of air in kg steam per kg air= 0.119\n", - "net steam turbine cycle output,W_net_ST in KJ/kg= 677.4\n", - "steam cycle output per kg of air(W_net_ST) in KJ/kg air= 80.61\n", - "total combined cycle output in KJ/kg air= 486.88\n", - "combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add 0.58\n", - "in percentage 57.77\n", - "In absence of steam cycle,gas turbine cycle efficiency,n_GT= 0.48\n", - "in percentage 48.21\n", - "thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\n", - "overall efficiency=57.77%\n", - "steam per kg of air=0.119 kg steam per/kg air\n" - ] - } - ], - "source": [ - "#cal of overall efficiency,steam per kg of air\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.15, Page:361 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\")\n", - "r=10.;#pressure ratio\n", - "Cp=1.0032;#specific heat of air in KJ/kg K\n", - "y=1.4;#expansion constant\n", - "T3=1400.;#inlet temperature of gas turbine in K\n", - "T1=(17.+273.);#ambient temperature in K\n", - "P1=1.*10**5;#ambient pressure in Pa\n", - "Pc=15.;#condensor pressure in KPa\n", - "Pg=6.*1000;#pressure of steam in generator in KPa\n", - "T5=420.;#temperature of exhaust from gas turbine in K\n", - "print(\"In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y)in K\")\n", - "T2=T1*(r)**((y-1)/y)\n", - "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", - "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", - "T4=T3*(1/r)**((y-1)/y)\n", - "print(\"compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", - "Wc=Cp*(T2-T1)\n", - "print(\"turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \")\n", - "Wt=Cp*(T3-T4)\n", - "print(\"heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \")\n", - "q_add=Cp*(T3-T2)\n", - "print(\"net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\")\n", - "W_net_GT=Wt-Wc\n", - "print(\"heat recovered in HRSG for steam generation per kg of air\")\n", - "print(\"q_HRGC=Cp*(T4-T5)in KJ/kg\")\n", - "q_HRGC=Cp*(T4-T5)\n", - "print(\"at inlet to steam in turbine,\")\n", - "print(\"from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\")\n", - "ha=3177.2;\n", - "sa=6.5408;\n", - "print(\"for expansion in steam turbine,sa=sb\")\n", - "sb=sa;\n", - "print(\"let dryness fraction at state b be x\")\n", - "print(\"also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\")\n", - "sf=0.7549;\n", - "sfg=7.2536;\n", - "hf=225.94;\n", - "hfg=2373.1;\n", - "print(\"sb=sf+x*sfg\")\n", - "print(\"so x=(sb-sf)/sfg \")\n", - "x=(sb-sf)/sfg\n", - "print(\"so hb=hf+x*hfg in KJ/kg K\")\n", - "hb=hf+x*hfg\n", - "print(\"at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\")\n", - "hc=hf;\n", - "vc=0.001014;\n", - "print(\"at exit of feed pump,hd=hd-hc\")\n", - "print(\"hd=vc*(Pg-Pc)*100 in KJ/kg\")\n", - "hd=vc*(Pg-Pc)*100\n", - "print(\"heat added per kg of steam =ha-hd in KJ/kg\")\n", - "ha-hd\n", - "print(\"mass of steam generated per kg of air in kg steam per kg air=\"),round(q_HRGC/(ha-hd),3)\n", - "W_net_ST=(ha-hb)-(hd-hc)\n", - "print(\"net steam turbine cycle output,W_net_ST in KJ/kg=\"),round(W_net_ST,2)\n", - "W_net_ST=W_net_ST*0.119 \n", - "print(\"steam cycle output per kg of air(W_net_ST) in KJ/kg air=\"),round(W_net_ST,2)\n", - "(W_net_GT+W_net_ST)\n", - "print(\"total combined cycle output in KJ/kg air= \"),round((W_net_GT+W_net_ST),2)\n", - "n_cc=(W_net_GT+W_net_ST)/q_add\n", - "print(\"combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add\"),round(n_cc,2)\n", - "print(\"in percentage\"),round(n_cc*100,2)\n", - "n_GT=W_net_GT/q_add\n", - "print(\"In absence of steam cycle,gas turbine cycle efficiency,n_GT=\"),round(n_GT,2)\n", - "print(\"in percentage\"),round(n_GT*100,2)\n", - "print(\"thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\")\n", - "print(\"overall efficiency=57.77%\")\n", - "print(\"steam per kg of air=0.119 kg steam per/kg air\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.16;pg no: 363" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.16, Page:363 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\n", - "here P4/P1=P3/P1=70............eq1\n", - "compression ratio,V1/V2=V1/V3=15.............eq2\n", - "heat added at constant volume= heat added at constant pressure\n", - "Q23=Q34\n", - "m*Cv*(T3-T2)=m*Cp*(T4-T3)\n", - "(T3-T2)=y*(T4-T3)\n", - "for process 1-2;\n", - "T2/T1=(P2/P1)^((y-1)/y)\n", - "T2/T1=(V1/V2)^(y-1)\n", - "so T2=T1*(V1/V2)^(y-1) in K\n", - "and (P2/P1)=(V1/V2)^y\n", - "so P2=P1*(V1/V2)^y in Pa...........eq3\n", - "for process 2-3,\n", - "P2/P3=T2/T3\n", - "so T3=T2*P3/P2\n", - "using eq 1 and 3,we get\n", - "T3=T2*k/r^y in K\n", - "using equal heat additions for processes 2-3 and 3-4,\n", - "(T3-T2)=y*(T4-T3)\n", - "so T4=T3+((T3-T2)/y) in K\n", - "for process 3-4,\n", - "V3/V4=T3/T4\n", - "(V3/V1)*(V1/V4)=T3/T4\n", - "so (V1/V4)=(T3/T4)*r\n", - "so V1/V4=11.88 and V5/V4=11.88\n", - "for process 4-5,\n", - "P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\n", - "so T5=T4/((V5/V4)^(y-1))\n", - "air standard thermal efficiency(n)=1-(heat rejected/heat added)\n", - "n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\n", - "n= 0.65\n", - "air standard thermal efficiency=0.6529\n", - "in percentage 65.29\n", - "so air standard thermal efficiency=65.29%\n", - "Actual thermal efficiency may be different from theoretical efficiency due to following reasons\n", - "a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\n", - "b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\n", - "c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\n" - ] - } - ], - "source": [ - "#cal of air standard thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.16, Page:363 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\")\n", - "T1=(27+273);#temperature at begining of compression in K\n", - "k=70;#ration of maximum to minimum pressures\n", - "r=15;#compression ratio\n", - "y=1.4;#expansion constant\n", - "print(\"here P4/P1=P3/P1=70............eq1\")\n", - "print(\"compression ratio,V1/V2=V1/V3=15.............eq2\")\n", - "print(\"heat added at constant volume= heat added at constant pressure\")\n", - "print(\"Q23=Q34\")\n", - "print(\"m*Cv*(T3-T2)=m*Cp*(T4-T3)\")\n", - "print(\"(T3-T2)=y*(T4-T3)\")\n", - "print(\"for process 1-2;\")\n", - "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"T2/T1=(V1/V2)^(y-1)\")\n", - "print(\"so T2=T1*(V1/V2)^(y-1) in K\")\n", - "T2=T1*(r)**(y-1)\n", - "print(\"and (P2/P1)=(V1/V2)^y\")\n", - "print(\"so P2=P1*(V1/V2)^y in Pa...........eq3\")\n", - "print(\"for process 2-3,\")\n", - "print(\"P2/P3=T2/T3\")\n", - "print(\"so T3=T2*P3/P2\")\n", - "print(\"using eq 1 and 3,we get\")\n", - "print(\"T3=T2*k/r^y in K\")\n", - "T3=T2*k/r**y \n", - "print(\"using equal heat additions for processes 2-3 and 3-4,\")\n", - "print(\"(T3-T2)=y*(T4-T3)\")\n", - "print(\"so T4=T3+((T3-T2)/y) in K\")\n", - "T4=T3+((T3-T2)/y)\n", - "print(\"for process 3-4,\")\n", - "print(\"V3/V4=T3/T4\")\n", - "print(\"(V3/V1)*(V1/V4)=T3/T4\")\n", - "print(\"so (V1/V4)=(T3/T4)*r\")\n", - "(T3/T4)*r\n", - "print(\"so V1/V4=11.88 and V5/V4=11.88\")\n", - "print(\"for process 4-5,\")\n", - "print(\"P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\")\n", - "print(\"so T5=T4/((V5/V4)^(y-1))\")\n", - "T5=T4/(11.88)**(y-1)\n", - "print(\"air standard thermal efficiency(n)=1-(heat rejected/heat added)\")\n", - "print(\"n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\")\n", - "n=1-((T5-T1)/(y*(T4-T3)+(T3-T2)))\n", - "print(\"n=\"),round(n,2)\n", - "print(\"air standard thermal efficiency=0.6529\")\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so air standard thermal efficiency=65.29%\")\n", - "print(\"Actual thermal efficiency may be different from theoretical efficiency due to following reasons\")\n", - "print(\"a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\")\n", - "print(\"b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\")\n", - "print(\"c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter9_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter9_2.ipynb deleted file mode 100755 index 606321b3..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter9_2.ipynb +++ /dev/null @@ -1,1655 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 9:Gas Power Cycles" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.1;pg no: 334" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.1, Page:334 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\n", - "SI engine operate on otto cycle.consider working fluid to be perfect gas.\n", - "here,y=Cp/Cv\n", - "Cp-Cv=R in KJ/kg K\n", - "compression ratio,r=V1/V2=(0.15+V2)/V2\n", - "so V2=0.15/(r-1) in m^3\n", - "so V2=0.03 m^3\n", - "total cylinder volume=V1=r*V2 m^3\n", - "from perfect gas law,P*V=m*R*T\n", - "so m=P1*V1/(R*T1) in kg\n", - "from state 1 to 2 by P*V^y=P2*V2^y\n", - "so P2=P1*(V1/V2)^y in KPa\n", - "also,P1*V1/T1=P2*V2/T2\n", - "so T2=P2*V2*T1/(P1*V1)in K\n", - "from heat addition process 2-3\n", - "Q23=m*CV*(T3-T2)\n", - "T3=T2+(Q23/(m*Cv))in K\n", - "also from,P3*V3/T3=P2*V2/T2\n", - "P3=P2*V2*T3/(V3*T2) in KPa\n", - "for adiabatic expansion 3-4,\n", - "P3*V3^y=P4*V4^y\n", - "and V4=V1\n", - "hence,P4=P3*V3^y/V1^y in KPa\n", - "and from P3*V3/T3=P4*V4/T4\n", - "T4=P4*V4*T3/(P3*V3) in K\n", - "entropy change from 2-3 and 4-1 are same,and can be given as,\n", - "S3-S2=S4-S1=m*Cv*log(T4/T1)\n", - "so entropy change,deltaS_32=deltaS_41 in KJ/K\n", - "heat rejected,Q41=m*Cv*(T4-T1) in KJ\n", - "net work(W) in KJ= 76.75\n", - "efficiency(n)= 0.51\n", - "in percentage 51.16\n", - "mean effective pressure(mep)=work/volume change in KPa= 511.64\n", - "so mep=511.67 KPa\n" - ] - } - ], - "source": [ - "#cal of mean effective pressure\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.1, Page:334 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\")\n", - "Cp=1;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", - "P1=98;#pressure at begining of compression in KPa\n", - "T1=(60+273.15);#temperature at begining of compression in K\n", - "Q23=150;#heat supplied in KJ/kg\n", - "r=6;#compression ratio\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"SI engine operate on otto cycle.consider working fluid to be perfect gas.\")\n", - "print(\"here,y=Cp/Cv\")\n", - "y=Cp/Cv\n", - "y=1.4;#approx.\n", - "print(\"Cp-Cv=R in KJ/kg K\")\n", - "R=Cp-Cv\n", - "print(\"compression ratio,r=V1/V2=(0.15+V2)/V2\")\n", - "print(\"so V2=0.15/(r-1) in m^3\")\n", - "V2=0.15/(r-1)\n", - "print(\"so V2=0.03 m^3\")\n", - "print(\"total cylinder volume=V1=r*V2 m^3\")\n", - "V1=r*V2\n", - "print(\"from perfect gas law,P*V=m*R*T\")\n", - "print(\"so m=P1*V1/(R*T1) in kg\")\n", - "m=P1*V1/(R*T1)\n", - "m=0.183;#approx.\n", - "print(\"from state 1 to 2 by P*V^y=P2*V2^y\")\n", - "print(\"so P2=P1*(V1/V2)^y in KPa\")\n", - "P2=P1*(V1/V2)**y\n", - "print(\"also,P1*V1/T1=P2*V2/T2\")\n", - "print(\"so T2=P2*V2*T1/(P1*V1)in K\")\n", - "T2=P2*V2*T1/(P1*V1)\n", - "print(\"from heat addition process 2-3\")\n", - "print(\"Q23=m*CV*(T3-T2)\")\n", - "print(\"T3=T2+(Q23/(m*Cv))in K\")\n", - "T3=T2+(Q23/(m*Cv))\n", - "print(\"also from,P3*V3/T3=P2*V2/T2\")\n", - "print(\"P3=P2*V2*T3/(V3*T2) in KPa\")\n", - "V3=V2;#constant volume process\n", - "P3=P2*V2*T3/(V3*T2) \n", - "print(\"for adiabatic expansion 3-4,\")\n", - "print(\"P3*V3^y=P4*V4^y\")\n", - "print(\"and V4=V1\")\n", - "V4=V1;\n", - "print(\"hence,P4=P3*V3^y/V1^y in KPa\")\n", - "P4=P3*V3**y/V1**y\n", - "print(\"and from P3*V3/T3=P4*V4/T4\")\n", - "print(\"T4=P4*V4*T3/(P3*V3) in K\")\n", - "T4=P4*V4*T3/(P3*V3)\n", - "print(\"entropy change from 2-3 and 4-1 are same,and can be given as,\")\n", - "print(\"S3-S2=S4-S1=m*Cv*log(T4/T1)\")\n", - "print(\"so entropy change,deltaS_32=deltaS_41 in KJ/K\")\n", - "deltaS_32=m*Cv*math.log(T4/T1)\n", - "deltaS_41=deltaS_32;\n", - "print(\"heat rejected,Q41=m*Cv*(T4-T1) in KJ\")\n", - "Q41=m*Cv*(T4-T1)\n", - "W=Q23-Q41\n", - "print(\"net work(W) in KJ=\"),round(W,2)\n", - "n=W/Q23\n", - "print(\"efficiency(n)=\"),round(W/Q23,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "mep=W/0.15\n", - "print(\"mean effective pressure(mep)=work/volume change in KPa=\"),round(W/0.15,2)\n", - "print(\"so mep=511.67 KPa\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.2;pg no: 336" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.2, Page:336 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\n", - "as given\n", - "Va=V2+(7/8)*(V1-V2)\n", - "Vb=V2+(1/8)*(V1-V2)\n", - "and also\n", - "Pa*Va^y=Pb*Vb^y\n", - "so (Va/Vb)=(Pb/Pa)^(1/y)\n", - "also substituting for Va and Vb\n", - "(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\n", - "so V1/V2=r=1+(4.18*8/1.82) 19.37\n", - "it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\n", - "as given;cut off occurs at(V1-V2)/15 volume\n", - "V3=V2+(V1-V2)/15\n", - "cut off ratio,rho=V3/V2\n", - "air standard efficiency for diesel cycle(n_airstandard)= 0.63\n", - "in percentage 63.23\n", - "overall efficiency(n_overall)=n_airstandard*n_ite*n_mech 0.253\n", - "in percentage 25.3\n", - "fuel consumption,bhp/hr in kg= 0.26\n", - "so compression ratio=19.37\n", - "air standard efficiency=63.25%\n", - "fuel consumption,bhp/hr=0.255 kg\n" - ] - } - ], - "source": [ - "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.2, Page:336 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\")\n", - "Pa=138;#pressure during compression at 1/8 of stroke in KPa\n", - "Pb=1.38*10**3;#pressure during compression at 7/8 of stroke in KPa\n", - "n_ite=0.5;#indicated thermal efficiency\n", - "n_mech=0.8;#mechanical efficiency\n", - "C=41800;#calorific value in KJ/kg\n", - "y=1.4;#expansion constant\n", - "print(\"as given\")\n", - "print(\"Va=V2+(7/8)*(V1-V2)\")\n", - "print(\"Vb=V2+(1/8)*(V1-V2)\")\n", - "print(\"and also\")\n", - "print(\"Pa*Va^y=Pb*Vb^y\")\n", - "print(\"so (Va/Vb)=(Pb/Pa)^(1/y)\")\n", - "(Pb/Pa)**(1/y)\n", - "print(\"also substituting for Va and Vb\")\n", - "print(\"(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\")\n", - "r=1+(4.18*8/1.82)\n", - "print(\"so V1/V2=r=1+(4.18*8/1.82)\"),round(r,2)\n", - "print(\"it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\")\n", - "print(\"as given;cut off occurs at(V1-V2)/15 volume\")\n", - "print(\"V3=V2+(V1-V2)/15\")\n", - "print(\"cut off ratio,rho=V3/V2\")\n", - "rho=1+(r-1)/15\n", - "n_airstandard=1-(1/(r**(y-1)*y))*((rho**y-1)/(rho-1))\n", - "print(\"air standard efficiency for diesel cycle(n_airstandard)=\"),round(n_airstandard,2)\n", - "print(\"in percentage\"),round(n_airstandard*100,2)\n", - "n_airstandard=0.6325;\n", - "n_overall=n_airstandard*n_ite*n_mech\n", - "print(\"overall efficiency(n_overall)=n_airstandard*n_ite*n_mech\"),round(n_overall,3)\n", - "print(\"in percentage\"),round(n_overall*100,2)\n", - "n_overall=0.253;\n", - "75*60*60/(n_overall*C*100)\n", - "print(\"fuel consumption,bhp/hr in kg=\"),round(75*60*60/(n_overall*C*100),2)\n", - "print(\"so compression ratio=19.37\")\n", - "print(\"air standard efficiency=63.25%\")\n", - "print(\"fuel consumption,bhp/hr=0.255 kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.3;pg no: 338" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.3, Page:338 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\n", - "1-2-3-4=cycle a\n", - "1-2_a-3_a-4_a-5=cycle b\n", - "here Cp/Cv=y\n", - "and R=0.293 KJ/kg K\n", - "let us consider 1 kg of air for perfect gas,\n", - "P*V=m*R*T\n", - "so V1=m*R*T1/P1 in m^3\n", - "at state 3,\n", - "P3*V3=m*R*T3\n", - "so T3/V2=P3/(m*R)\n", - "so T3=17064.8*V2............eq1\n", - "for cycle a and also for cycle b\n", - "T3_a=17064.8*V2_a.............eq2\n", - "a> for otto cycle,\n", - "Q23=Cv*(T3-T2)\n", - "so T3-T2=Q23/Cv\n", - "and T2=T3-2394.36.............eq3\n", - "from gas law,P2*V2/T2=P3*V3/T3\n", - "here V2=V3 and using eq 3,we get\n", - "so P2/(T3-2394.36)=5000/T3\n", - "substituting T3 as function of V2\n", - "P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\n", - "P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\n", - "also P1*V1^y=P2*V2^y\n", - "or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\n", - "upon solving it yields\n", - "381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\n", - "or V2^1.4-0.140*V2^0.4-.022=0\n", - "by hit and trial it yields,V2=0.18 \n", - "thus compression ratio,r=V1/V2\n", - "otto cycle efficiency,n_otto=1-(1/r)^(y-1)\n", - "in percentage\n", - "b> for mixed or dual cycle\n", - "Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\n", - "or T3_a-T2_a=850/Cv\n", - "or T2_a=T3_a-1197.2 .............eq4 \n", - "also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\n", - "P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\n", - "or P2_a/(T3_a-1197.2)=5000/T3_a\n", - "also we had seen earlier that T3_a=17064.8*V2_a\n", - "so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\n", - "so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\n", - "or for adiabatic process,1-2_a\n", - "P1*V1^y=P2*V2^y\n", - "so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\n", - "or V2_a^1.4-0.07*V2_a^0.4-0.022=0\n", - "by hit and trial \n", - "V2_a=0.122 m^3\n", - "therefore upon substituting V2_a,\n", - "by eq 5,P2_a in KPa\n", - "by eq 2,T3_a in K\n", - "by eq 4,T2_a in K\n", - "from constant pressure heat addition\n", - "Cp*(T4_a-T3_a)=850\n", - "so T4_a=T3_a+(850/Cp) in K\n", - "also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\n", - "so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \n", - "here P3_a=P4_a and V2_a=V3_a\n", - "using adiabatic formulations V4_a=0.172 m^3\n", - "(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\n", - "so T5=T4_a/(V5/V4_a)^(y-1) in K\n", - "heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\n", - "efficiency of mixed cycle(n_mixed)= 0.57\n", - "in percentage 56.55\n" - ] - }, - { - "data": { - "text/plain": [ - "'NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.'" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "#cal of comparing efficiency of two cycles\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.3, Page:338 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\")\n", - "T1=(100+273.15);#temperature at beginning of compresssion in K\n", - "P1=103;#pressure at beginning of compresssion in KPa\n", - "Cp=1.003;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", - "Q23=1700;#heat added during combustion in KJ/kg\n", - "P3=5000;#maximum pressure in cylinder in KPa\n", - "print(\"1-2-3-4=cycle a\")\n", - "print(\"1-2_a-3_a-4_a-5=cycle b\")\n", - "print(\"here Cp/Cv=y\")\n", - "y=Cp/Cv\n", - "y=1.4;#approx.\n", - "print(\"and R=0.293 KJ/kg K\")\n", - "R=0.293;\n", - "print(\"let us consider 1 kg of air for perfect gas,\")\n", - "m=1;#mass of air in kg\n", - "print(\"P*V=m*R*T\")\n", - "print(\"so V1=m*R*T1/P1 in m^3\")\n", - "V1=m*R*T1/P1\n", - "print(\"at state 3,\")\n", - "print(\"P3*V3=m*R*T3\")\n", - "print(\"so T3/V2=P3/(m*R)\")\n", - "P3/(m*R)\n", - "print(\"so T3=17064.8*V2............eq1\")\n", - "print(\"for cycle a and also for cycle b\")\n", - "print(\"T3_a=17064.8*V2_a.............eq2\")\n", - "print(\"a> for otto cycle,\")\n", - "print(\"Q23=Cv*(T3-T2)\")\n", - "print(\"so T3-T2=Q23/Cv\")\n", - "Q23/Cv\n", - "print(\"and T2=T3-2394.36.............eq3\")\n", - "print(\"from gas law,P2*V2/T2=P3*V3/T3\")\n", - "print(\"here V2=V3 and using eq 3,we get\")\n", - "print(\"so P2/(T3-2394.36)=5000/T3\")\n", - "print(\"substituting T3 as function of V2\")\n", - "print(\"P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\")\n", - "print(\"P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\")\n", - "print(\"also P1*V1^y=P2*V2^y\")\n", - "print(\"or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\")\n", - "print(\"upon solving it yields\")\n", - "print(\"381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\")\n", - "print(\"or V2^1.4-0.140*V2^0.4-.022=0\")\n", - "print(\"by hit and trial it yields,V2=0.18 \")\n", - "V2=0.18;\n", - "print(\"thus compression ratio,r=V1/V2\")\n", - "r=V1/V2\n", - "print(\"otto cycle efficiency,n_otto=1-(1/r)^(y-1)\")\n", - "n_otto=1-(1/r)**(y-1)\n", - "print(\"in percentage\")\n", - "n_otto=n_otto*100\n", - "print(\"b> for mixed or dual cycle\")\n", - "print(\"Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\")\n", - "print(\"or T3_a-T2_a=850/Cv\")\n", - "850/Cv\n", - "print(\"or T2_a=T3_a-1197.2 .............eq4 \")\n", - "print(\"also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\")\n", - "print(\"P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\")\n", - "print(\"or P2_a/(T3_a-1197.2)=5000/T3_a\")\n", - "print(\"also we had seen earlier that T3_a=17064.8*V2_a\")\n", - "print(\"so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\")\n", - "print(\"so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\")\n", - "print(\"or for adiabatic process,1-2_a\")\n", - "print(\"P1*V1^y=P2*V2^y\")\n", - "print(\"so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\")\n", - "print(\"or V2_a^1.4-0.07*V2_a^0.4-0.022=0\")\n", - "print(\"by hit and trial \")\n", - "print(\"V2_a=0.122 m^3\")\n", - "V2_a=0.122;\n", - "print(\"therefore upon substituting V2_a,\")\n", - "print(\"by eq 5,P2_a in KPa\")\n", - "P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a)\n", - "print(\"by eq 2,T3_a in K\")\n", - "T3_a=17064.8*V2_a\n", - "print(\"by eq 4,T2_a in K\")\n", - "T2_a=T3_a-1197.2\n", - "print(\"from constant pressure heat addition\")\n", - "print(\"Cp*(T4_a-T3_a)=850\")\n", - "print(\"so T4_a=T3_a+(850/Cp) in K\")\n", - "T4_a=T3_a+(850/Cp)\n", - "print(\"also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\")\n", - "print(\"so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \")\n", - "print(\"here P3_a=P4_a and V2_a=V3_a\")\n", - "V4_a=V2_a*T4_a/(T3_a)\n", - "print(\"using adiabatic formulations V4_a=0.172 m^3\")\n", - "print(\"(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\")\n", - "V5=V1;\n", - "print(\"so T5=T4_a/(V5/V4_a)^(y-1) in K\")\n", - "T5=T4_a/(V5/V4_a)**(y-1)\n", - "print(\"heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\")\n", - "Q51=Cv*(T5-T1)\n", - "n_mixed=(Q23-Q51)/Q23\n", - "print(\"efficiency of mixed cycle(n_mixed)=\"),round(n_mixed,2)\n", - "print(\"in percentage\"),round(n_mixed*100,2)\n", - "(\"NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.4;pg no: 341" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.4, Page:341 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\n", - "optimum pressure ratio for maximum work output,\n", - "rp=(T_max/T_min)^((y)/(2*(y-1)))\n", - "so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\n", - "so T2=T1*(p2/p1)^((y-1)/y)in K\n", - "For process 3-4,\n", - "T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\n", - "so T4=T3/(rp)^((y-1)/y)in K\n", - "heat supplied,Q23=Cp*(T3-T2)in KJ/kg\n", - "compressor work,Wc in KJ/kg= 301.5\n", - "turbine work,Wt in KJ/kg= 603.0\n", - "thermal efficiency=net work/heat supplied= 0.5\n", - "so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,turbine and compressor work\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.4, Page:341 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\")\n", - "T3=1200;#maximum temperature in K\n", - "T1=300;#minimum temperature in K\n", - "y=1.4;#expansion constant\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"optimum pressure ratio for maximum work output,\")\n", - "print(\"rp=(T_max/T_min)^((y)/(2*(y-1)))\")\n", - "T_max=T3;\n", - "T_min=T1;\n", - "rp=(T_max/T_min)**((y)/(2*(y-1)))\n", - "print(\"so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\")\n", - "print(\"so T2=T1*(p2/p1)^((y-1)/y)in K\")\n", - "T2=T1*(rp)**((y-1)/y)\n", - "print(\"For process 3-4,\")\n", - "print(\"T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\")\n", - "print(\"so T4=T3/(rp)^((y-1)/y)in K\")\n", - "T4=T3/(rp)**((y-1)/y)\n", - "print(\"heat supplied,Q23=Cp*(T3-T2)in KJ/kg\")\n", - "Q23=Cp*(T3-T2)\n", - "Wc=Cp*(T2-T1)\n", - "print(\"compressor work,Wc in KJ/kg=\"),round(Wc,2)\n", - "Wt=Cp*(T3-T4)\n", - "print(\"turbine work,Wt in KJ/kg=\"),round(Wt,2)\n", - "(Wt-Wc)/Q23\n", - "print(\"thermal efficiency=net work/heat supplied=\"),round((Wt-Wc)/Q23,2)\n", - "print(\"so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.5;pg no: 342" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.5, Page:342 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\n", - "gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\n", - "for process 1-2 being isentropic,\n", - "T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y) in K\n", - "considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\n", - "so T2_a=T1+((T2-T1)/n_compr)in K\n", - "during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\n", - "heat added=mf*q\n", - "=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\n", - "or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\n", - "so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\n", - "for expansion 3-4 being\n", - "T4/T3=(P4/P3)^((n-1)/n)\n", - "so T4=T3*(P4/P3)^((n-1)/n) in K\n", - "actaul temperature at turbine inlet considering internal efficiency of turbine,\n", - "n_turb=(T3-T4_a)/(T3-T4)\n", - "so T4_a=T3-(n_turb*(T3-T4)) in K\n", - "compressor work,per kg of air compressed(Wc) in KJ/kg of air= 234.42\n", - "so compressor work=234.42 KJ/kg of air\n", - "turbine work,per kg of air compressed(Wt) in KJ/kg of air= 414.71\n", - "so turbine work=414.71 KJ/kg of air\n", - "net work(W_net) in KJ/kg of air= 180.29\n", - "heat supplied(Q) in KJ/kg of air= 751.16\n", - "thermal efficiency(n)= 0.24\n", - "in percentage 24.0\n", - "so thermal efficiency=24%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,turbine and compressor work\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.5, Page:342 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\")\n", - "P1=1*10**5;#initial pressure in Pa\n", - "P4=P1;#constant pressure process\n", - "T1=300;#initial temperature in K\n", - "P2=6.2*10**5;#pressure after compression in Pa\n", - "P3=P2;#constant pressure process\n", - "k=0.017;#fuel to air ratio\n", - "n_compr=0.88;#compressor efficiency\n", - "q=44186;#heating value of fuel in KJ/kg\n", - "n_turb=0.9;#turbine internal efficiency\n", - "Cp_comb=1.147;#specific heat of combustion at constant pressure in KJ/kg K\n", - "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", - "y=1.4;#expansion constant\n", - "n=1.33;#expansion constant for polytropic constant\n", - "print(\"gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\")\n", - "print(\"for process 1-2 being isentropic,\")\n", - "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", - "T2=T1*(P2/P1)**((y-1)/y)\n", - "print(\"considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\")\n", - "print(\"so T2_a=T1+((T2-T1)/n_compr)in K\")\n", - "T2_a=T1+((T2-T1)/n_compr)\n", - "print(\"during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\")\n", - "print(\"heat added=mf*q\")\n", - "print(\"=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\")\n", - "print(\"or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\")\n", - "print(\"so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\")\n", - "T3=((k)*q+(Cp_air*T2_a))/((1+(k))*Cp_comb)\n", - "print(\"for expansion 3-4 being\")\n", - "print(\"T4/T3=(P4/P3)^((n-1)/n)\")\n", - "print(\"so T4=T3*(P4/P3)^((n-1)/n) in K\")\n", - "T4=T3*(P4/P3)**((n-1)/n)\n", - "print(\"actaul temperature at turbine inlet considering internal efficiency of turbine,\")\n", - "print(\"n_turb=(T3-T4_a)/(T3-T4)\")\n", - "print(\"so T4_a=T3-(n_turb*(T3-T4)) in K\")\n", - "T4_a=T3-(n_turb*(T3-T4))\n", - "Wc=Cp_air*(T2_a-T1)\n", - "print(\"compressor work,per kg of air compressed(Wc) in KJ/kg of air=\"),round(Wc,2)\n", - "print(\"so compressor work=234.42 KJ/kg of air\")\n", - "Wt=Cp_comb*(T3-T4_a)\n", - "print(\"turbine work,per kg of air compressed(Wt) in KJ/kg of air=\"),round(Wt,2)\n", - "print(\"so turbine work=414.71 KJ/kg of air\")\n", - "W_net=Wt-Wc\n", - "print(\"net work(W_net) in KJ/kg of air=\"),round(W_net,2)\n", - "Q=k*q\n", - "print(\"heat supplied(Q) in KJ/kg of air=\"),round(Q,2)\n", - "n=W_net/Q\n", - "print(\"thermal efficiency(n)=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so thermal efficiency=24%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.6;pg no: 343" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.6, Page:343 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\n", - "NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\n", - "overall pressure ratio(rp)= 13.59\n", - "so overall optimum pressure ratio=13.6\n" - ] - } - ], - "source": [ - "#cal of overall optimum pressure ratio\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.6, Page:343 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\")\n", - "T1=300;#minimum temperature in brayton cycle in K\n", - "T5=1200;#maximum temperature in brayton cycle in K\n", - "n_isen_c=0.85;#isentropic efficiency of compressor\n", - "n_isen_t=0.9;#isentropic efficiency of turbine\n", - "y=1.4;#expansion constant\n", - "print(\"NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\")\n", - "rp=(T1/(T5*n_isen_c*n_isen_t))**((2*y)/(3*(1-y)))\n", - "print(\"overall pressure ratio(rp)=\"),round(rp,2)\n", - "print(\"so overall optimum pressure ratio=13.6\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.7;pg no: 346" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.7, Page:346 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\n", - "i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\n", - "therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\n", - "or P9/P1=k=(1.35)^8 11.03\n", - "or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\n", - "T9/T1=(P9/P1)^((y-1)/y)\n", - "so T9 in K= 621.47\n", - "considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\n", - "(T9-T1)/(T9_actual-T1)=0.82\n", - "so T9_actual=T1+((T9-T1)/0.82) in K 689.19\n", - "let the actual index of compression be n, then\n", - "(T9_actual/T1)=(P9/P1)^((n-1)/n)\n", - "so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\n", - "so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\n", - "ii> let polytropic efficiency be n_polytropic for compressor then,\n", - "(n-1)/n=((y-1)/y)*(1/n_polytropic)\n", - "so n_polytropic= 0.87\n", - "in percentage 86.9\n", - "so ploytropic efficiency=86.88%\n", - "iii> stage efficiency can be estimated for any stage.say first stage.\n", - "ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y) in K\n", - "actual temperature at exit of first stage can be estimated using polytropic index 1.49.\n", - "T2_actual/T1=(P2/P1)^((n-1)/n)\n", - "so T2_actual=T1*(P2/P1)^((n-1)/n) in K\n", - "stage efficiency for first stage,ns_1= 0.86\n", - "in percentage 86.33\n", - "actual temperature at exit of second stage,\n", - "T3_actual/T2_actual=(P3/P2)^((n-1)/n)\n", - "so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\n", - "ideal temperature at exit of second stage\n", - "T3/T2_actual=(P3/P2)^((n-1)/n)\n", - "so T3=T2_actual*(P3/P2)^((y-1)/y) in K\n", - "stage efficiency for second stage,ns_2= 0.86\n", - "in percentage 86.33\n", - "actual rtemperature at exit of third stage,\n", - "T4_actual/T3_actual=(P4/P3)^((n-1)/n)\n", - "so T4_actual in K= 420.83\n", - "ideal temperature at exit of third stage,\n", - "T4/T3_actual=(P4/P3)^((n-1)/n)\n", - "so T4 in K= 415.42\n", - "stage efficiency for third stage,ns_3= 0.86\n", - "in percentage= 8632.9\n", - "so stage efficiency=86.4%\n", - "iv> from steady flow energy equation,\n", - "Wc=dw=dh and dh=du+p*dv+v*dp\n", - "dh=dq+v*dp\n", - "dq=0 in adiabatic process\n", - "dh=v*dp\n", - "Wc=v*dp\n", - "here for polytropic compression \n", - "P*V^1.49=constant i.e n=1.49\n", - "Wc in KJ/s= 16419.87\n", - "due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s= 14777.89\n", - "so power required to drive compressor =14777.89 KJ/s\n" - ] - } - ], - "source": [ - "#cal of state of air at exit of compressor,polytropic efficiency,efficiency of each sate,power\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.7, Page:346 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\")\n", - "T1=313.;#air entering temperature in K\n", - "P1=1*10**5;#air entering pressure in Pa\n", - "m=50.;#flow rate through compressor in kg/s\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\")\n", - "print(\"therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\")\n", - "r=1.35;#compression ratio\n", - "k=(1.35)**8\n", - "print(\"or P9/P1=k=(1.35)^8\"),round(k,2)\n", - "k=11.03;#approx.\n", - "print(\"or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\")\n", - "y=1.4;#expansion constant \n", - "print(\"T9/T1=(P9/P1)^((y-1)/y)\")\n", - "T9=T1*(k)**((y-1)/y)\n", - "print(\"so T9 in K=\"),round(T9,2)\n", - "print(\"considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\")\n", - "print(\"(T9-T1)/(T9_actual-T1)=0.82\")\n", - "T9_actual=T1+((T9-T1)/0.82)\n", - "print(\"so T9_actual=T1+((T9-T1)/0.82) in K\"),round(T9_actual,2)\n", - "print(\"let the actual index of compression be n, then\")\n", - "print(\"(T9_actual/T1)=(P9/P1)^((n-1)/n)\")\n", - "print(\"so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\")\n", - "n=math.log(k)/(math.log(k)-math.log(T9_actual/T1))\n", - "print(\"so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\")\n", - "print(\"ii> let polytropic efficiency be n_polytropic for compressor then,\")\n", - "print(\"(n-1)/n=((y-1)/y)*(1/n_polytropic)\")\n", - "n_polytropic=((y-1)/y)/((n-1)/n)\n", - "print(\"so n_polytropic=\"),round(n_polytropic,2)\n", - "print(\"in percentage\"),round(n_polytropic*100,2)\n", - "print(\"so ploytropic efficiency=86.88%\")\n", - "print(\"iii> stage efficiency can be estimated for any stage.say first stage.\")\n", - "print(\"ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", - "T2=T1*(r)**((y-1)/y)\n", - "print(\"actual temperature at exit of first stage can be estimated using polytropic index 1.49.\")\n", - "print(\"T2_actual/T1=(P2/P1)^((n-1)/n)\")\n", - "print(\"so T2_actual=T1*(P2/P1)^((n-1)/n) in K\")\n", - "T2_actual=T1*(r)**((n-1)/n)\n", - "ns_1=(T2-T1)/(T2_actual-T1)\n", - "print(\"stage efficiency for first stage,ns_1=\"),round(ns_1,2)\n", - "print(\"in percentage\"),round(ns_1*100,2)\n", - "print(\"actual temperature at exit of second stage,\")\n", - "print(\"T3_actual/T2_actual=(P3/P2)^((n-1)/n)\")\n", - "print(\"so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\")\n", - "T3_actual=T2_actual*(r)**((n-1)/n)\n", - "print(\"ideal temperature at exit of second stage\")\n", - "print(\"T3/T2_actual=(P3/P2)^((n-1)/n)\")\n", - "print(\"so T3=T2_actual*(P3/P2)^((y-1)/y) in K\")\n", - "T3=T2_actual*(r)**((y-1)/y)\n", - "ns_2=(T3-T2_actual)/(T3_actual-T2_actual)\n", - "print(\"stage efficiency for second stage,ns_2=\"),round(ns_2,2)\n", - "print(\"in percentage\"),round(ns_2*100,2)\n", - "print(\"actual rtemperature at exit of third stage,\")\n", - "print(\"T4_actual/T3_actual=(P4/P3)^((n-1)/n)\")\n", - "T4_actual=T3_actual*(r)**((n-1)/n)\n", - "print(\"so T4_actual in K=\"),round(T4_actual,2)\n", - "print(\"ideal temperature at exit of third stage,\")\n", - "print(\"T4/T3_actual=(P4/P3)^((n-1)/n)\")\n", - "T4=T3_actual*(r)**((y-1)/y)\n", - "print(\"so T4 in K=\"),round(T4,2)\n", - "ns_3=(T4-T3_actual)/(T4_actual-T3_actual)\n", - "print(\"stage efficiency for third stage,ns_3=\"),round(ns_3,2)\n", - "ns_3=ns_3*100\n", - "print(\"in percentage=\"),round(ns_3*100,2)\n", - "print(\"so stage efficiency=86.4%\")\n", - "print(\"iv> from steady flow energy equation,\")\n", - "print(\"Wc=dw=dh and dh=du+p*dv+v*dp\")\n", - "print(\"dh=dq+v*dp\")\n", - "print(\"dq=0 in adiabatic process\")\n", - "print(\"dh=v*dp\")\n", - "print(\"Wc=v*dp\")\n", - "print(\"here for polytropic compression \")\n", - "print(\"P*V^1.49=constant i.e n=1.49\")\n", - "n=1.49;\n", - "Wc=(n/(n-1))*m*R*T1*(((k)**((n-1)/n))-1)\n", - "print(\"Wc in KJ/s=\"),round(Wc,2)\n", - "Wc_actual=Wc*0.9\n", - "print(\"due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s=\"),round(Wc*0.9,2)\n", - "print(\"so power required to drive compressor =14777.89 KJ/s\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.8;pg no: 349" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.8, Page:349 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\n", - "In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.8, Page:349 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\")\n", - "print(\"In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.9;pg no: 350" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.9, Page:350 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\n", - "using polytropic efficiency the index of compression and expansion can be obtained as under,\n", - "let compression index be nc,\n", - "(nc-1)/nc=(y-1)/(y*n_poly_c)\n", - "so nc=1/(1-((y-1)/(y*n_poly_c)))\n", - "let expansion index be nt,\n", - "(nt-1)/nt=(n_poly_T*(y-1))/y\n", - "so nt=1/(1-((n_poly_T*(y-1))/y))\n", - "For process 1-2\n", - "T2/T1=(p2/p1)^((nc-1)/nc)\n", - "so T2=T1*(p2/p1)^((nc-1)/nc)in K\n", - "also T4/T3=(p4/p3)^((nt-1)/nt)\n", - "so T4=T3*(p4/p3)^((nt-1)/nt)in K\n", - "using heat exchanger effectivenesss,\n", - "epsilon=(T5-T2)/(T4-T2)\n", - "so T5=T2+(epsilon*(T4-T2))in K\n", - "heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\n", - "compressor work,Wc=Cp*(T2-T1)in \n", - "turbine work,Wt=Cp*(T3-T4)in KJ/kg\n", - "cycle efficiency= 0.33\n", - "in percentage 32.79\n", - "work ratio= 0.33\n", - "specific work output in KJ/kg= 152.56\n", - "so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of cycle efficiency,work ratio,specific work output\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.9, Page:350 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\")\n", - "y=1.4;#expansion constant\n", - "n_poly_c=0.85;#ploytropic efficiency of compressor\n", - "n_poly_T=0.90;#ploytropic efficiency of Turbine\n", - "r=8.;#compression ratio\n", - "T1=(27.+273.);#temperature of air in compressor in K\n", - "T3=1100.;#temperature of air leaving combustion chamber in K\n", - "epsilon=0.8;#effectiveness of heat exchanger\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "print(\"using polytropic efficiency the index of compression and expansion can be obtained as under,\")\n", - "print(\"let compression index be nc,\")\n", - "print(\"(nc-1)/nc=(y-1)/(y*n_poly_c)\")\n", - "print(\"so nc=1/(1-((y-1)/(y*n_poly_c)))\")\n", - "nc=1/(1-((y-1)/(y*n_poly_c)))\n", - "print(\"let expansion index be nt,\")\n", - "print(\"(nt-1)/nt=(n_poly_T*(y-1))/y\")\n", - "print(\"so nt=1/(1-((n_poly_T*(y-1))/y))\")\n", - "nt=1/(1-((n_poly_T*(y-1))/y))\n", - "print(\"For process 1-2\")\n", - "print(\"T2/T1=(p2/p1)^((nc-1)/nc)\")\n", - "print(\"so T2=T1*(p2/p1)^((nc-1)/nc)in K\")\n", - "T2=T1*(r)**((nc-1)/nc)\n", - "print(\"also T4/T3=(p4/p3)^((nt-1)/nt)\")\n", - "print(\"so T4=T3*(p4/p3)^((nt-1)/nt)in K\")\n", - "T4=T3*(1/r)**((nt-1)/nt)\n", - "print(\"using heat exchanger effectivenesss,\") \n", - "print(\"epsilon=(T5-T2)/(T4-T2)\")\n", - "print(\"so T5=T2+(epsilon*(T4-T2))in K\")\n", - "T5=T2+(epsilon*(T4-T2))\n", - "print(\"heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\")\n", - "q_add=Cp*(T3-T5)\n", - "print(\"compressor work,Wc=Cp*(T2-T1)in \")\n", - "Wc=Cp*(T2-T1)\n", - "print(\"turbine work,Wt=Cp*(T3-T4)in KJ/kg\")\n", - "Wt=Cp*(T3-T4)\n", - "(Wt-Wc)/q_add\n", - "print(\"cycle efficiency=\"),round((Wt-Wc)/q_add,2)\n", - "print(\"in percentage\"),round((Wt-Wc)*100/q_add,2)\n", - "(Wt-Wc)/Wt\n", - "print(\"work ratio=\"),round((Wt-Wc)/Wt,2)\n", - "print(\"specific work output in KJ/kg=\"),round(Wt-Wc,2)\n", - "print(\"so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.10;pg no: 351" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.10, Page:351 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\n", - "for process 1-2_a\n", - "T2_a/T1=(p2_a/p1)^((y-1)/y)\n", - "so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\n", - "nc=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+((T2_a-T1)/nc) in K\n", - "for process 3-4_a,\n", - "T4_a/T3=(p4/p3)^((y-1)/y)\n", - "so T4_a=T3*(p4/p3)^((y-1)/y)in K\n", - "Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", - "Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\n", - "net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\n", - "heat added,q_add=Cp*(T3-T2) in KJ/kg\n", - "thermal efficiency,n=W_net/q_add\n", - "n={Wc-(Cp*(T3-T4))}/q_add\n", - "so T4=T3-((Wc-(n*q_add))/Cp)in K\n", - "therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a) 0.297\n", - "in percentage 29.7\n", - "so turbine isentropic efficiency=29.69%\n" - ] - } - ], - "source": [ - "#cal of isentropic efficiency of turbine\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.10, Page:351 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\")\n", - "T1=(27+273);#temperature of air in compressor in K\n", - "p1=1*10**5;#pressure of air in compressor in Pa\n", - "p2=5*10**5;#pressure of air after compression in Pa\n", - "p3=p2-0.2*10**5;#pressure drop in Pa\n", - "p4=1*10**5;#pressure to which expansion occur in turbine in Pa\n", - "nc=0.85;#isentropic efficiency\n", - "T3=1000;#temperature of air in combustion chamber in K\n", - "n=0.2;#thermal efficiency of plant\n", - "y=1.4;#expansion constant\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "print(\"for process 1-2_a\")\n", - "print(\"T2_a/T1=(p2_a/p1)^((y-1)/y)\")\n", - "print(\"so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\")\n", - "T2_a=T1*(p2/p1)**((y-1)/y)\n", - "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+((T2_a-T1)/nc) in K\")\n", - "T2=T1+((T2_a-T1)/nc)\n", - "print(\"for process 3-4_a,\")\n", - "print(\"T4_a/T3=(p4/p3)^((y-1)/y)\")\n", - "print(\"so T4_a=T3*(p4/p3)^((y-1)/y)in K\")\n", - "T4_a=T3*(p4/p3)**((y-1)/y)\n", - "print(\"Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", - "Wc=Cp*(T2-T1)\n", - "print(\"Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\")\n", - "print(\"net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\")\n", - "print(\"heat added,q_add=Cp*(T3-T2) in KJ/kg\")\n", - "q_add=Cp*(T3-T2)\n", - "print(\"thermal efficiency,n=W_net/q_add\")\n", - "print(\"n={Wc-(Cp*(T3-T4))}/q_add\")\n", - "print(\"so T4=T3-((Wc-(n*q_add))/Cp)in K\")\n", - "T4=T3-((Wc-(n*q_add))/Cp)\n", - "nt=(T3-T4)/(T3-T4_a)\n", - "print(\"therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a)\"),round((T3-T4)/(T3-T4_a),3)\n", - "print(\"in percentage\"),round(nt*100,2)\n", - "print(\"so turbine isentropic efficiency=29.69%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.11;pg no: 352" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.11, Page:352 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\n", - "for perfect intercooling the pressure ratio of each compression stage(k)\n", - "k=sqrt(r)\n", - "for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\n", - "so T2_a=T1*(k)^((y-1)/y)in K\n", - "considering isentropic efficiency of compression,\n", - "nc=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+((T2_a-T1)/nc)in K\n", - "for process 3-4,\n", - "T4_a/T3=(P4/P3)^((y-1)/y)\n", - "so T4_a=T3*(P4/P3)^((y-1)/y) in K\n", - "again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\n", - "so T4=T3+((T4_a-T3)/nc)in K\n", - "total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\n", - "for expansion process 5-6_a,\n", - "T6_a/T5=(P6/P5)^((y-1)/y)\n", - "so T6_a=T5*(P6/P5)^((y-1)/y) in K\n", - "considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\n", - "T6=T5-(ne*(T5-T6_a)) in K\n", - "for expansion in 7-8_a\n", - "T8_a/T7=(P8/P7)^((y-1)/y)\n", - "so T8_a=T7*(P8/P7)^((y-1)/y) in K\n", - "considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\n", - "so T8=T7-(ne*(T7-T8_a))in K\n", - "expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\n", - "heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\n", - "fuel required per kg of air,mf=q_add/C 0.02\n", - "air-fuel ratio=1/mf 51.08\n", - "net output(W) in KJ/kg= 229.2\n", - "output for air flowing at 30 kg/s,=W*m in KW 6876.05\n", - "thermal efficiency= 0.28\n", - "in percentage 27.88\n", - "so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\n", - "NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,net output,A/F ratio\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.11, Page:352 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\")\n", - "P1=1.*10**5;#initial pressure in Pa\n", - "T1=(27.+273.);#initial temperature in K\n", - "T3=T1;\n", - "r=10.;#pressure ratio\n", - "T5=1000.;#maximum temperature in cycle in K\n", - "P6=3.*10**5;#first stage expansion pressure in Pa\n", - "T7=995.;#first stage reheated temperature in K\n", - "C=42000.;#calorific value of fuel in KJ/kg\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "m=30.;#air flow rate in kg/s\n", - "nc=0.85;#isentropic efficiency of compression\n", - "ne=0.9;#isentropic efficiency of expansion\n", - "y=1.4;#expansion constant\n", - "print(\"for perfect intercooling the pressure ratio of each compression stage(k)\")\n", - "print(\"k=sqrt(r)\")\n", - "k=math.sqrt(r)\n", - "k=3.16;#approx.\n", - "print(\"for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2_a=T1*(k)^((y-1)/y)in K\")\n", - "T2_a=T1*(k)**((y-1)/y)\n", - "print(\"considering isentropic efficiency of compression,\")\n", - "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+((T2_a-T1)/nc)in K\")\n", - "T2=T1+((T2_a-T1)/nc)\n", - "print(\"for process 3-4,\")\n", - "print(\"T4_a/T3=(P4/P3)^((y-1)/y)\")\n", - "print(\"so T4_a=T3*(P4/P3)^((y-1)/y) in K\")\n", - "T4_a=T3*(k)**((y-1)/y)\n", - "print(\"again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\")\n", - "print(\"so T4=T3+((T4_a-T3)/nc)in K\")\n", - "T4=T3+((T4_a-T3)/nc)\n", - "print(\"total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\")\n", - "Wc=2*Cp*(T4-T3)\n", - "print(\"for expansion process 5-6_a,\")\n", - "print(\"T6_a/T5=(P6/P5)^((y-1)/y)\")\n", - "print(\"so T6_a=T5*(P6/P5)^((y-1)/y) in K\")\n", - "P5=10.*10**5;#pressure in Pa\n", - "T6_a=T5*(P6/P5)**((y-1)/y)\n", - "print(\"considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\")\n", - "print(\"T6=T5-(ne*(T5-T6_a)) in K\")\n", - "T6=T5-(ne*(T5-T6_a))\n", - "print(\"for expansion in 7-8_a\")\n", - "print(\"T8_a/T7=(P8/P7)^((y-1)/y)\")\n", - "print(\"so T8_a=T7*(P8/P7)^((y-1)/y) in K\")\n", - "P8=P1;#constant pressure process\n", - "P7=P6;#constant pressure process\n", - "T8_a=T7*(P8/P7)**((y-1)/y)\n", - "print(\"considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\")\n", - "print(\"so T8=T7-(ne*(T7-T8_a))in K\")\n", - "T8=T7-(ne*(T7-T8_a))\n", - "print(\"expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\")\n", - "Wt=Cp*(T5-T6)+Cp*(T7-T8)\n", - "print(\"heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\")\n", - "q_add=Cp*(T5-T4)+Cp*(T7-T6)\n", - "mf=q_add/C\n", - "print(\"fuel required per kg of air,mf=q_add/C\"),round(q_add/C,2)\n", - "print(\"air-fuel ratio=1/mf\"),round(1/mf,2)\n", - "W=Wt-Wc\n", - "print(\"net output(W) in KJ/kg=\"),round(Wt-Wc,2)\n", - "print(\"output for air flowing at 30 kg/s,=W*m in KW\"),round(W*m,2)\n", - "W/q_add\n", - "print(\"thermal efficiency=\"),round(W/q_add,2)\n", - "print(\"in percentage\"),round(W*100/q_add,2)\n", - "print(\"so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\")\n", - "print(\"NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.12;pg no: 354" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.12, Page:354 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\n", - "for process 1-2,\n", - "T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y) in K\n", - "for process 3-4,\n", - "T4/T3=(P4/P3)^((y-1)/y)\n", - "so T4=T3*(P4/P3)^((y-1)/y) in K\n", - "for process 6-7,\n", - "T7/T6=(P7/P6)^((y-1)/y)\n", - "so T7=T6*(P7/P6)^((y-1)/y) in K\n", - "for process 8-9,\n", - "T9/T8=(P9/P8)^((y-1)/y)\n", - "T9=T8*(P9/P8)^((y-1)/y) in K\n", - "in regenerator,effectiveness=(T5-T4)/(T9-T4)\n", - "T5=T4+(ne*(T9-T4))in K\n", - "compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\n", - "turbine work per kg air,Wt in KJ/kg= 660.84\n", - "heat added per kg air,q_add in KJ/kg= 765.43\n", - "total fuel required per kg of air= 0.02\n", - "net work,W_net in KJ/kg= 450.85\n", - "cycle thermal efficiency,n= 0.59\n", - "in percentage 58.9\n", - "fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C= 0.0056\n", - "fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C= 0.0126\n", - "so fuel-air ratio in two combustion chambers=0.0126,0.0056\n", - "total turbine work=660.85 KJ/kg\n", - "cycle thermal efficiency=58.9%\n", - "NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \n" - ] - } - ], - "source": [ - "#cal of fuel-air ratio in two combustion chambers,total turbine work,cycle thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.12, Page:354 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\")\n", - "P1=1.*10**5;#initial pressure in Pa\n", - "P9=P1;\n", - "T1=300.;#initial temperature in K\n", - "P2=4.*10**5;#pressure of air in intercooler in Pa\n", - "P3=P2;\n", - "T3=290.;#temperature of air in intercooler in K\n", - "T6=1300.;#temperature of combustion chamber in K\n", - "P4=8.*10**5;#pressure of air after compression in Pa\n", - "P6=P4;\n", - "T8=1300.;#temperature after reheating in K\n", - "P8=4.*10**5;#pressure after expansion in Pa\n", - "P7=P8;\n", - "C=42000.;#heating value of fuel in KJ/kg\n", - "y=1.4;#expansion constant\n", - "ne=0.8;#effectiveness of regenerator\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "print(\"for process 1-2,\")\n", - "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", - "T2=T1*(P2/P1)**((y-1)/y)\n", - "print(\"for process 3-4,\")\n", - "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", - "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", - "T4=T3*(P4/P3)**((y-1)/y)\n", - "print(\"for process 6-7,\")\n", - "print(\"T7/T6=(P7/P6)^((y-1)/y)\")\n", - "print(\"so T7=T6*(P7/P6)^((y-1)/y) in K\")\n", - "T7=T6*(P7/P6)**((y-1)/y)\n", - "print(\"for process 8-9,\")\n", - "print(\"T9/T8=(P9/P8)^((y-1)/y)\")\n", - "print(\"T9=T8*(P9/P8)^((y-1)/y) in K\")\n", - "T9=T8*(P9/P8)**((y-1)/y)\n", - "print(\"in regenerator,effectiveness=(T5-T4)/(T9-T4)\")\n", - "print(\"T5=T4+(ne*(T9-T4))in K\")\n", - "T5=T4+(ne*(T9-T4))\n", - "print(\"compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\")\n", - "Wc=Cp*(T2-T1)+Cp*(T4-T3)\n", - "Wt=Cp*(T6-T7)+Cp*(T8-T9)\n", - "print(\"turbine work per kg air,Wt in KJ/kg=\"),round(Wt,2)\n", - "q_add=Cp*(T6-T5)+Cp*(T8-T7)\n", - "print(\"heat added per kg air,q_add in KJ/kg=\"),round(q_add,2)\n", - "q_add/C\n", - "print(\"total fuel required per kg of air=\"),round(q_add/C,2)\n", - "W_net=Wt-Wc\n", - "print(\"net work,W_net in KJ/kg=\"),round(W_net,2)\n", - "n=W_net/q_add\n", - "print(\"cycle thermal efficiency,n=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C=\"),round(Cp*(T8-T7)/C,4)\n", - "print(\"fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C=\"),round(Cp*(T6-T5)/C,4)\n", - "print(\"so fuel-air ratio in two combustion chambers=0.0126,0.0056\")\n", - "print(\"total turbine work=660.85 KJ/kg\")\n", - "print(\"cycle thermal efficiency=58.9%\")\n", - "print(\"NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.13;pg no: 356" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.13, Page:356 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\n", - "work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\n", - "heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\n", - "for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\n", - "mass of air per cycle=m/n in kg/cycle\n", - "brake output in KW= 17.12\n", - "stroke volume,V in m^3= 0.0117\n", - "brake output=17.11 KW\n", - "stroke volume=0.0116 m^3\n" - ] - } - ], - "source": [ - "#cal of brake output,stroke volume\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.13, Page:356 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\")\n", - "T2=700.;#highest temperature of stirling engine in K\n", - "T1=300.;#lowest temperature of stirling engine in K\n", - "r=3.;#compression ratio\n", - "q_add=30.;#heat addition in KJ/s\n", - "epsilon=0.9;#regenerator efficiency\n", - "P=1*10**5;#pressure at begining of compression in Pa\n", - "n=100.;#number of cycle per minute\n", - "Cv=0.72;#specific heat at constant volume in KJ/kg K\n", - "R=29.27;#gas constant in KJ/kg K\n", - "print(\"work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\")\n", - "W=R*(T2-T1)*math.log(r)\n", - "print(\"heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\")\n", - "q=R*T2*math.log(r)+(1-epsilon)*Cv*(T2-T1)\n", - "print(\"for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\")\n", - "m=q_add/q\n", - "print(\"mass of air per cycle=m/n in kg/cycle\")\n", - "m/n\n", - "print(\"brake output in KW=\"),round(W*m,2)\n", - "m=1.33*10**-4;#mass of air per cycle in kg/cycle\n", - "T=T1;\n", - "V=m*R*T*1000/P\n", - "print(\"stroke volume,V in m^3=\"),round(V,4)\n", - "print(\"brake output=17.11 KW\")\n", - "print(\"stroke volume=0.0116 m^3\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.14;pg no: 357" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.14, Page:357 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\n", - "In question no.14,various expression is derived which cannot be solved using python software.\n" - ] - } - ], - "source": [ - "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.14, Page:357 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\")\n", - "print(\"In question no.14,various expression is derived which cannot be solved using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.15;pg no: 361" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.15, Page:361 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\n", - "In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y)in K\n", - "T4/T3=(P4/P3)^((y-1)/y)\n", - "so T4=T3*(P4/P3)^((y-1)/y) in K\n", - "compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", - "turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \n", - "heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \n", - "net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\n", - "heat recovered in HRSG for steam generation per kg of air\n", - "q_HRGC=Cp*(T4-T5)in KJ/kg\n", - "at inlet to steam in turbine,\n", - "from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\n", - "for expansion in steam turbine,sa=sb\n", - "let dryness fraction at state b be x\n", - "also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\n", - "sb=sf+x*sfg\n", - "so x=(sb-sf)/sfg \n", - "so hb=hf+x*hfg in KJ/kg K\n", - "at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\n", - "at exit of feed pump,hd=hd-hc\n", - "hd=vc*(Pg-Pc)*100 in KJ/kg\n", - "heat added per kg of steam =ha-hd in KJ/kg\n", - "mass of steam generated per kg of air in kg steam per kg air= 0.119\n", - "net steam turbine cycle output,W_net_ST in KJ/kg= 677.4\n", - "steam cycle output per kg of air(W_net_ST) in KJ/kg air= 80.61\n", - "total combined cycle output in KJ/kg air= 486.88\n", - "combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add 0.58\n", - "in percentage 57.77\n", - "In absence of steam cycle,gas turbine cycle efficiency,n_GT= 0.48\n", - "in percentage 48.21\n", - "thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\n", - "overall efficiency=57.77%\n", - "steam per kg of air=0.119 kg steam per/kg air\n" - ] - } - ], - "source": [ - "#cal of overall efficiency,steam per kg of air\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.15, Page:361 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\")\n", - "r=10.;#pressure ratio\n", - "Cp=1.0032;#specific heat of air in KJ/kg K\n", - "y=1.4;#expansion constant\n", - "T3=1400.;#inlet temperature of gas turbine in K\n", - "T1=(17.+273.);#ambient temperature in K\n", - "P1=1.*10**5;#ambient pressure in Pa\n", - "Pc=15.;#condensor pressure in KPa\n", - "Pg=6.*1000;#pressure of steam in generator in KPa\n", - "T5=420.;#temperature of exhaust from gas turbine in K\n", - "print(\"In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y)in K\")\n", - "T2=T1*(r)**((y-1)/y)\n", - "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", - "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", - "T4=T3*(1/r)**((y-1)/y)\n", - "print(\"compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", - "Wc=Cp*(T2-T1)\n", - "print(\"turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \")\n", - "Wt=Cp*(T3-T4)\n", - "print(\"heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \")\n", - "q_add=Cp*(T3-T2)\n", - "print(\"net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\")\n", - "W_net_GT=Wt-Wc\n", - "print(\"heat recovered in HRSG for steam generation per kg of air\")\n", - "print(\"q_HRGC=Cp*(T4-T5)in KJ/kg\")\n", - "q_HRGC=Cp*(T4-T5)\n", - "print(\"at inlet to steam in turbine,\")\n", - "print(\"from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\")\n", - "ha=3177.2;\n", - "sa=6.5408;\n", - "print(\"for expansion in steam turbine,sa=sb\")\n", - "sb=sa;\n", - "print(\"let dryness fraction at state b be x\")\n", - "print(\"also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\")\n", - "sf=0.7549;\n", - "sfg=7.2536;\n", - "hf=225.94;\n", - "hfg=2373.1;\n", - "print(\"sb=sf+x*sfg\")\n", - "print(\"so x=(sb-sf)/sfg \")\n", - "x=(sb-sf)/sfg\n", - "print(\"so hb=hf+x*hfg in KJ/kg K\")\n", - "hb=hf+x*hfg\n", - "print(\"at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\")\n", - "hc=hf;\n", - "vc=0.001014;\n", - "print(\"at exit of feed pump,hd=hd-hc\")\n", - "print(\"hd=vc*(Pg-Pc)*100 in KJ/kg\")\n", - "hd=vc*(Pg-Pc)*100\n", - "print(\"heat added per kg of steam =ha-hd in KJ/kg\")\n", - "ha-hd\n", - "print(\"mass of steam generated per kg of air in kg steam per kg air=\"),round(q_HRGC/(ha-hd),3)\n", - "W_net_ST=(ha-hb)-(hd-hc)\n", - "print(\"net steam turbine cycle output,W_net_ST in KJ/kg=\"),round(W_net_ST,2)\n", - "W_net_ST=W_net_ST*0.119 \n", - "print(\"steam cycle output per kg of air(W_net_ST) in KJ/kg air=\"),round(W_net_ST,2)\n", - "(W_net_GT+W_net_ST)\n", - "print(\"total combined cycle output in KJ/kg air= \"),round((W_net_GT+W_net_ST),2)\n", - "n_cc=(W_net_GT+W_net_ST)/q_add\n", - "print(\"combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add\"),round(n_cc,2)\n", - "print(\"in percentage\"),round(n_cc*100,2)\n", - "n_GT=W_net_GT/q_add\n", - "print(\"In absence of steam cycle,gas turbine cycle efficiency,n_GT=\"),round(n_GT,2)\n", - "print(\"in percentage\"),round(n_GT*100,2)\n", - "print(\"thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\")\n", - "print(\"overall efficiency=57.77%\")\n", - "print(\"steam per kg of air=0.119 kg steam per/kg air\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.16;pg no: 363" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.16, Page:363 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\n", - "here P4/P1=P3/P1=70............eq1\n", - "compression ratio,V1/V2=V1/V3=15.............eq2\n", - "heat added at constant volume= heat added at constant pressure\n", - "Q23=Q34\n", - "m*Cv*(T3-T2)=m*Cp*(T4-T3)\n", - "(T3-T2)=y*(T4-T3)\n", - "for process 1-2;\n", - "T2/T1=(P2/P1)^((y-1)/y)\n", - "T2/T1=(V1/V2)^(y-1)\n", - "so T2=T1*(V1/V2)^(y-1) in K\n", - "and (P2/P1)=(V1/V2)^y\n", - "so P2=P1*(V1/V2)^y in Pa...........eq3\n", - "for process 2-3,\n", - "P2/P3=T2/T3\n", - "so T3=T2*P3/P2\n", - "using eq 1 and 3,we get\n", - "T3=T2*k/r^y in K\n", - "using equal heat additions for processes 2-3 and 3-4,\n", - "(T3-T2)=y*(T4-T3)\n", - "so T4=T3+((T3-T2)/y) in K\n", - "for process 3-4,\n", - "V3/V4=T3/T4\n", - "(V3/V1)*(V1/V4)=T3/T4\n", - "so (V1/V4)=(T3/T4)*r\n", - "so V1/V4=11.88 and V5/V4=11.88\n", - "for process 4-5,\n", - "P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\n", - "so T5=T4/((V5/V4)^(y-1))\n", - "air standard thermal efficiency(n)=1-(heat rejected/heat added)\n", - "n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\n", - "n= 0.65\n", - "air standard thermal efficiency=0.6529\n", - "in percentage 65.29\n", - "so air standard thermal efficiency=65.29%\n", - "Actual thermal efficiency may be different from theoretical efficiency due to following reasons\n", - "a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\n", - "b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\n", - "c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\n" - ] - } - ], - "source": [ - "#cal of air standard thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.16, Page:363 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\")\n", - "T1=(27+273);#temperature at begining of compression in K\n", - "k=70;#ration of maximum to minimum pressures\n", - "r=15;#compression ratio\n", - "y=1.4;#expansion constant\n", - "print(\"here P4/P1=P3/P1=70............eq1\")\n", - "print(\"compression ratio,V1/V2=V1/V3=15.............eq2\")\n", - "print(\"heat added at constant volume= heat added at constant pressure\")\n", - "print(\"Q23=Q34\")\n", - "print(\"m*Cv*(T3-T2)=m*Cp*(T4-T3)\")\n", - "print(\"(T3-T2)=y*(T4-T3)\")\n", - "print(\"for process 1-2;\")\n", - "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"T2/T1=(V1/V2)^(y-1)\")\n", - "print(\"so T2=T1*(V1/V2)^(y-1) in K\")\n", - "T2=T1*(r)**(y-1)\n", - "print(\"and (P2/P1)=(V1/V2)^y\")\n", - "print(\"so P2=P1*(V1/V2)^y in Pa...........eq3\")\n", - "print(\"for process 2-3,\")\n", - "print(\"P2/P3=T2/T3\")\n", - "print(\"so T3=T2*P3/P2\")\n", - "print(\"using eq 1 and 3,we get\")\n", - "print(\"T3=T2*k/r^y in K\")\n", - "T3=T2*k/r**y \n", - "print(\"using equal heat additions for processes 2-3 and 3-4,\")\n", - "print(\"(T3-T2)=y*(T4-T3)\")\n", - "print(\"so T4=T3+((T3-T2)/y) in K\")\n", - "T4=T3+((T3-T2)/y)\n", - "print(\"for process 3-4,\")\n", - "print(\"V3/V4=T3/T4\")\n", - "print(\"(V3/V1)*(V1/V4)=T3/T4\")\n", - "print(\"so (V1/V4)=(T3/T4)*r\")\n", - "(T3/T4)*r\n", - "print(\"so V1/V4=11.88 and V5/V4=11.88\")\n", - "print(\"for process 4-5,\")\n", - "print(\"P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\")\n", - "print(\"so T5=T4/((V5/V4)^(y-1))\")\n", - "T5=T4/(11.88)**(y-1)\n", - "print(\"air standard thermal efficiency(n)=1-(heat rejected/heat added)\")\n", - "print(\"n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\")\n", - "n=1-((T5-T1)/(y*(T4-T3)+(T3-T2)))\n", - "print(\"n=\"),round(n,2)\n", - "print(\"air standard thermal efficiency=0.6529\")\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so air standard thermal efficiency=65.29%\")\n", - "print(\"Actual thermal efficiency may be different from theoretical efficiency due to following reasons\")\n", - "print(\"a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\")\n", - "print(\"b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\")\n", - "print(\"c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter9_3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter9_3.ipynb deleted file mode 100755 index 606321b3..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter9_3.ipynb +++ /dev/null @@ -1,1655 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 9:Gas Power Cycles" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.1;pg no: 334" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.1, Page:334 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\n", - "SI engine operate on otto cycle.consider working fluid to be perfect gas.\n", - "here,y=Cp/Cv\n", - "Cp-Cv=R in KJ/kg K\n", - "compression ratio,r=V1/V2=(0.15+V2)/V2\n", - "so V2=0.15/(r-1) in m^3\n", - "so V2=0.03 m^3\n", - "total cylinder volume=V1=r*V2 m^3\n", - "from perfect gas law,P*V=m*R*T\n", - "so m=P1*V1/(R*T1) in kg\n", - "from state 1 to 2 by P*V^y=P2*V2^y\n", - "so P2=P1*(V1/V2)^y in KPa\n", - "also,P1*V1/T1=P2*V2/T2\n", - "so T2=P2*V2*T1/(P1*V1)in K\n", - "from heat addition process 2-3\n", - "Q23=m*CV*(T3-T2)\n", - "T3=T2+(Q23/(m*Cv))in K\n", - "also from,P3*V3/T3=P2*V2/T2\n", - "P3=P2*V2*T3/(V3*T2) in KPa\n", - "for adiabatic expansion 3-4,\n", - "P3*V3^y=P4*V4^y\n", - "and V4=V1\n", - "hence,P4=P3*V3^y/V1^y in KPa\n", - "and from P3*V3/T3=P4*V4/T4\n", - "T4=P4*V4*T3/(P3*V3) in K\n", - "entropy change from 2-3 and 4-1 are same,and can be given as,\n", - "S3-S2=S4-S1=m*Cv*log(T4/T1)\n", - "so entropy change,deltaS_32=deltaS_41 in KJ/K\n", - "heat rejected,Q41=m*Cv*(T4-T1) in KJ\n", - "net work(W) in KJ= 76.75\n", - "efficiency(n)= 0.51\n", - "in percentage 51.16\n", - "mean effective pressure(mep)=work/volume change in KPa= 511.64\n", - "so mep=511.67 KPa\n" - ] - } - ], - "source": [ - "#cal of mean effective pressure\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.1, Page:334 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 1\")\n", - "Cp=1;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", - "P1=98;#pressure at begining of compression in KPa\n", - "T1=(60+273.15);#temperature at begining of compression in K\n", - "Q23=150;#heat supplied in KJ/kg\n", - "r=6;#compression ratio\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"SI engine operate on otto cycle.consider working fluid to be perfect gas.\")\n", - "print(\"here,y=Cp/Cv\")\n", - "y=Cp/Cv\n", - "y=1.4;#approx.\n", - "print(\"Cp-Cv=R in KJ/kg K\")\n", - "R=Cp-Cv\n", - "print(\"compression ratio,r=V1/V2=(0.15+V2)/V2\")\n", - "print(\"so V2=0.15/(r-1) in m^3\")\n", - "V2=0.15/(r-1)\n", - "print(\"so V2=0.03 m^3\")\n", - "print(\"total cylinder volume=V1=r*V2 m^3\")\n", - "V1=r*V2\n", - "print(\"from perfect gas law,P*V=m*R*T\")\n", - "print(\"so m=P1*V1/(R*T1) in kg\")\n", - "m=P1*V1/(R*T1)\n", - "m=0.183;#approx.\n", - "print(\"from state 1 to 2 by P*V^y=P2*V2^y\")\n", - "print(\"so P2=P1*(V1/V2)^y in KPa\")\n", - "P2=P1*(V1/V2)**y\n", - "print(\"also,P1*V1/T1=P2*V2/T2\")\n", - "print(\"so T2=P2*V2*T1/(P1*V1)in K\")\n", - "T2=P2*V2*T1/(P1*V1)\n", - "print(\"from heat addition process 2-3\")\n", - "print(\"Q23=m*CV*(T3-T2)\")\n", - "print(\"T3=T2+(Q23/(m*Cv))in K\")\n", - "T3=T2+(Q23/(m*Cv))\n", - "print(\"also from,P3*V3/T3=P2*V2/T2\")\n", - "print(\"P3=P2*V2*T3/(V3*T2) in KPa\")\n", - "V3=V2;#constant volume process\n", - "P3=P2*V2*T3/(V3*T2) \n", - "print(\"for adiabatic expansion 3-4,\")\n", - "print(\"P3*V3^y=P4*V4^y\")\n", - "print(\"and V4=V1\")\n", - "V4=V1;\n", - "print(\"hence,P4=P3*V3^y/V1^y in KPa\")\n", - "P4=P3*V3**y/V1**y\n", - "print(\"and from P3*V3/T3=P4*V4/T4\")\n", - "print(\"T4=P4*V4*T3/(P3*V3) in K\")\n", - "T4=P4*V4*T3/(P3*V3)\n", - "print(\"entropy change from 2-3 and 4-1 are same,and can be given as,\")\n", - "print(\"S3-S2=S4-S1=m*Cv*log(T4/T1)\")\n", - "print(\"so entropy change,deltaS_32=deltaS_41 in KJ/K\")\n", - "deltaS_32=m*Cv*math.log(T4/T1)\n", - "deltaS_41=deltaS_32;\n", - "print(\"heat rejected,Q41=m*Cv*(T4-T1) in KJ\")\n", - "Q41=m*Cv*(T4-T1)\n", - "W=Q23-Q41\n", - "print(\"net work(W) in KJ=\"),round(W,2)\n", - "n=W/Q23\n", - "print(\"efficiency(n)=\"),round(W/Q23,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "mep=W/0.15\n", - "print(\"mean effective pressure(mep)=work/volume change in KPa=\"),round(W/0.15,2)\n", - "print(\"so mep=511.67 KPa\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.2;pg no: 336" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.2, Page:336 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\n", - "as given\n", - "Va=V2+(7/8)*(V1-V2)\n", - "Vb=V2+(1/8)*(V1-V2)\n", - "and also\n", - "Pa*Va^y=Pb*Vb^y\n", - "so (Va/Vb)=(Pb/Pa)^(1/y)\n", - "also substituting for Va and Vb\n", - "(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\n", - "so V1/V2=r=1+(4.18*8/1.82) 19.37\n", - "it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\n", - "as given;cut off occurs at(V1-V2)/15 volume\n", - "V3=V2+(V1-V2)/15\n", - "cut off ratio,rho=V3/V2\n", - "air standard efficiency for diesel cycle(n_airstandard)= 0.63\n", - "in percentage 63.23\n", - "overall efficiency(n_overall)=n_airstandard*n_ite*n_mech 0.253\n", - "in percentage 25.3\n", - "fuel consumption,bhp/hr in kg= 0.26\n", - "so compression ratio=19.37\n", - "air standard efficiency=63.25%\n", - "fuel consumption,bhp/hr=0.255 kg\n" - ] - } - ], - "source": [ - "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.2, Page:336 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 2\")\n", - "Pa=138;#pressure during compression at 1/8 of stroke in KPa\n", - "Pb=1.38*10**3;#pressure during compression at 7/8 of stroke in KPa\n", - "n_ite=0.5;#indicated thermal efficiency\n", - "n_mech=0.8;#mechanical efficiency\n", - "C=41800;#calorific value in KJ/kg\n", - "y=1.4;#expansion constant\n", - "print(\"as given\")\n", - "print(\"Va=V2+(7/8)*(V1-V2)\")\n", - "print(\"Vb=V2+(1/8)*(V1-V2)\")\n", - "print(\"and also\")\n", - "print(\"Pa*Va^y=Pb*Vb^y\")\n", - "print(\"so (Va/Vb)=(Pb/Pa)^(1/y)\")\n", - "(Pb/Pa)**(1/y)\n", - "print(\"also substituting for Va and Vb\")\n", - "print(\"(V2+(7/8)*(V1-V2))/(V2+(1/8)*(V1-V2))=5.18\")\n", - "r=1+(4.18*8/1.82)\n", - "print(\"so V1/V2=r=1+(4.18*8/1.82)\"),round(r,2)\n", - "print(\"it gives r=19.37 or V1/V2=19.37,compression ratio=19.37\")\n", - "print(\"as given;cut off occurs at(V1-V2)/15 volume\")\n", - "print(\"V3=V2+(V1-V2)/15\")\n", - "print(\"cut off ratio,rho=V3/V2\")\n", - "rho=1+(r-1)/15\n", - "n_airstandard=1-(1/(r**(y-1)*y))*((rho**y-1)/(rho-1))\n", - "print(\"air standard efficiency for diesel cycle(n_airstandard)=\"),round(n_airstandard,2)\n", - "print(\"in percentage\"),round(n_airstandard*100,2)\n", - "n_airstandard=0.6325;\n", - "n_overall=n_airstandard*n_ite*n_mech\n", - "print(\"overall efficiency(n_overall)=n_airstandard*n_ite*n_mech\"),round(n_overall,3)\n", - "print(\"in percentage\"),round(n_overall*100,2)\n", - "n_overall=0.253;\n", - "75*60*60/(n_overall*C*100)\n", - "print(\"fuel consumption,bhp/hr in kg=\"),round(75*60*60/(n_overall*C*100),2)\n", - "print(\"so compression ratio=19.37\")\n", - "print(\"air standard efficiency=63.25%\")\n", - "print(\"fuel consumption,bhp/hr=0.255 kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.3;pg no: 338" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.3, Page:338 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\n", - "1-2-3-4=cycle a\n", - "1-2_a-3_a-4_a-5=cycle b\n", - "here Cp/Cv=y\n", - "and R=0.293 KJ/kg K\n", - "let us consider 1 kg of air for perfect gas,\n", - "P*V=m*R*T\n", - "so V1=m*R*T1/P1 in m^3\n", - "at state 3,\n", - "P3*V3=m*R*T3\n", - "so T3/V2=P3/(m*R)\n", - "so T3=17064.8*V2............eq1\n", - "for cycle a and also for cycle b\n", - "T3_a=17064.8*V2_a.............eq2\n", - "a> for otto cycle,\n", - "Q23=Cv*(T3-T2)\n", - "so T3-T2=Q23/Cv\n", - "and T2=T3-2394.36.............eq3\n", - "from gas law,P2*V2/T2=P3*V3/T3\n", - "here V2=V3 and using eq 3,we get\n", - "so P2/(T3-2394.36)=5000/T3\n", - "substituting T3 as function of V2\n", - "P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\n", - "P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\n", - "also P1*V1^y=P2*V2^y\n", - "or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\n", - "upon solving it yields\n", - "381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\n", - "or V2^1.4-0.140*V2^0.4-.022=0\n", - "by hit and trial it yields,V2=0.18 \n", - "thus compression ratio,r=V1/V2\n", - "otto cycle efficiency,n_otto=1-(1/r)^(y-1)\n", - "in percentage\n", - "b> for mixed or dual cycle\n", - "Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\n", - "or T3_a-T2_a=850/Cv\n", - "or T2_a=T3_a-1197.2 .............eq4 \n", - "also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\n", - "P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\n", - "or P2_a/(T3_a-1197.2)=5000/T3_a\n", - "also we had seen earlier that T3_a=17064.8*V2_a\n", - "so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\n", - "so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\n", - "or for adiabatic process,1-2_a\n", - "P1*V1^y=P2*V2^y\n", - "so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\n", - "or V2_a^1.4-0.07*V2_a^0.4-0.022=0\n", - "by hit and trial \n", - "V2_a=0.122 m^3\n", - "therefore upon substituting V2_a,\n", - "by eq 5,P2_a in KPa\n", - "by eq 2,T3_a in K\n", - "by eq 4,T2_a in K\n", - "from constant pressure heat addition\n", - "Cp*(T4_a-T3_a)=850\n", - "so T4_a=T3_a+(850/Cp) in K\n", - "also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\n", - "so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \n", - "here P3_a=P4_a and V2_a=V3_a\n", - "using adiabatic formulations V4_a=0.172 m^3\n", - "(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\n", - "so T5=T4_a/(V5/V4_a)^(y-1) in K\n", - "heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\n", - "efficiency of mixed cycle(n_mixed)= 0.57\n", - "in percentage 56.55\n" - ] - }, - { - "data": { - "text/plain": [ - "'NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.'" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "#cal of comparing efficiency of two cycles\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.3, Page:338 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 3\")\n", - "T1=(100+273.15);#temperature at beginning of compresssion in K\n", - "P1=103;#pressure at beginning of compresssion in KPa\n", - "Cp=1.003;#specific heat at constant pressure in KJ/kg K\n", - "Cv=0.71;#specific heat at constant volume in KJ/kg K\n", - "Q23=1700;#heat added during combustion in KJ/kg\n", - "P3=5000;#maximum pressure in cylinder in KPa\n", - "print(\"1-2-3-4=cycle a\")\n", - "print(\"1-2_a-3_a-4_a-5=cycle b\")\n", - "print(\"here Cp/Cv=y\")\n", - "y=Cp/Cv\n", - "y=1.4;#approx.\n", - "print(\"and R=0.293 KJ/kg K\")\n", - "R=0.293;\n", - "print(\"let us consider 1 kg of air for perfect gas,\")\n", - "m=1;#mass of air in kg\n", - "print(\"P*V=m*R*T\")\n", - "print(\"so V1=m*R*T1/P1 in m^3\")\n", - "V1=m*R*T1/P1\n", - "print(\"at state 3,\")\n", - "print(\"P3*V3=m*R*T3\")\n", - "print(\"so T3/V2=P3/(m*R)\")\n", - "P3/(m*R)\n", - "print(\"so T3=17064.8*V2............eq1\")\n", - "print(\"for cycle a and also for cycle b\")\n", - "print(\"T3_a=17064.8*V2_a.............eq2\")\n", - "print(\"a> for otto cycle,\")\n", - "print(\"Q23=Cv*(T3-T2)\")\n", - "print(\"so T3-T2=Q23/Cv\")\n", - "Q23/Cv\n", - "print(\"and T2=T3-2394.36.............eq3\")\n", - "print(\"from gas law,P2*V2/T2=P3*V3/T3\")\n", - "print(\"here V2=V3 and using eq 3,we get\")\n", - "print(\"so P2/(T3-2394.36)=5000/T3\")\n", - "print(\"substituting T3 as function of V2\")\n", - "print(\"P2/(17064.8*V2-2394.36)=5000/(17064.8*V2)\")\n", - "print(\"P2=5000*(17064.8*V2-2394.36)/(17064.8*V2)\")\n", - "print(\"also P1*V1^y=P2*V2^y\")\n", - "print(\"or 103*(1.06)^1.4=(5000*(17064.8*V2-2394.36)/(17064.8*V2))*V2^1.4\")\n", - "print(\"upon solving it yields\")\n", - "print(\"381.4*V2=17064.8*V2^2.4-2394.36*V2^1.4\")\n", - "print(\"or V2^1.4-0.140*V2^0.4-.022=0\")\n", - "print(\"by hit and trial it yields,V2=0.18 \")\n", - "V2=0.18;\n", - "print(\"thus compression ratio,r=V1/V2\")\n", - "r=V1/V2\n", - "print(\"otto cycle efficiency,n_otto=1-(1/r)^(y-1)\")\n", - "n_otto=1-(1/r)**(y-1)\n", - "print(\"in percentage\")\n", - "n_otto=n_otto*100\n", - "print(\"b> for mixed or dual cycle\")\n", - "print(\"Cp*(T4_a-T3_a)=Cv*(T3_a-T2_a)=1700/2=850\")\n", - "print(\"or T3_a-T2_a=850/Cv\")\n", - "850/Cv\n", - "print(\"or T2_a=T3_a-1197.2 .............eq4 \")\n", - "print(\"also P2_a*V2_a/T2_a=P3_a*V3_a/T3_a\")\n", - "print(\"P2_a*V2_a/(T3_a-1197.2)=5000*V2_a/T3_a\")\n", - "print(\"or P2_a/(T3_a-1197.2)=5000/T3_a\")\n", - "print(\"also we had seen earlier that T3_a=17064.8*V2_a\")\n", - "print(\"so P2_a/(17064.8*V2_a-1197.2)=5000/(17064.8*V2_a)\")\n", - "print(\"so P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a).....................eq5\")\n", - "print(\"or for adiabatic process,1-2_a\")\n", - "print(\"P1*V1^y=P2*V2^y\")\n", - "print(\"so 1.3*(1.06)^1.4=V2_a^1.4*(5000-(359.78/V2_a))\")\n", - "print(\"or V2_a^1.4-0.07*V2_a^0.4-0.022=0\")\n", - "print(\"by hit and trial \")\n", - "print(\"V2_a=0.122 m^3\")\n", - "V2_a=0.122;\n", - "print(\"therefore upon substituting V2_a,\")\n", - "print(\"by eq 5,P2_a in KPa\")\n", - "P2_a=5000*(17064.8*V2_a-1197.2)/(17064.8*V2_a)\n", - "print(\"by eq 2,T3_a in K\")\n", - "T3_a=17064.8*V2_a\n", - "print(\"by eq 4,T2_a in K\")\n", - "T2_a=T3_a-1197.2\n", - "print(\"from constant pressure heat addition\")\n", - "print(\"Cp*(T4_a-T3_a)=850\")\n", - "print(\"so T4_a=T3_a+(850/Cp) in K\")\n", - "T4_a=T3_a+(850/Cp)\n", - "print(\"also P4_a*V4_a/T4_a= P3_a*V3_a/T3_a\")\n", - "print(\"so V4_a=P3_a*V3_a*T4_a/(T3_a*P4_a) in m^3 \")\n", - "print(\"here P3_a=P4_a and V2_a=V3_a\")\n", - "V4_a=V2_a*T4_a/(T3_a)\n", - "print(\"using adiabatic formulations V4_a=0.172 m^3\")\n", - "print(\"(V5/V4_a)^(y-1)=(T4_a/T5),here V5=V1\")\n", - "V5=V1;\n", - "print(\"so T5=T4_a/(V5/V4_a)^(y-1) in K\")\n", - "T5=T4_a/(V5/V4_a)**(y-1)\n", - "print(\"heat rejected in process 5-1,Q51=Cv*(T5-T1) in KJ\")\n", - "Q51=Cv*(T5-T1)\n", - "n_mixed=(Q23-Q51)/Q23\n", - "print(\"efficiency of mixed cycle(n_mixed)=\"),round(n_mixed,2)\n", - "print(\"in percentage\"),round(n_mixed*100,2)\n", - "(\"NOTE=>In this question temperature difference (T3-T2) for part a> in book is calculated wrong i.e 2328.77,which is corrected above and comes to be 2394.36,however it doesnt effect the efficiency of any part of this question.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.4;pg no: 341" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.4, Page:341 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\n", - "optimum pressure ratio for maximum work output,\n", - "rp=(T_max/T_min)^((y)/(2*(y-1)))\n", - "so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\n", - "so T2=T1*(p2/p1)^((y-1)/y)in K\n", - "For process 3-4,\n", - "T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\n", - "so T4=T3/(rp)^((y-1)/y)in K\n", - "heat supplied,Q23=Cp*(T3-T2)in KJ/kg\n", - "compressor work,Wc in KJ/kg= 301.5\n", - "turbine work,Wt in KJ/kg= 603.0\n", - "thermal efficiency=net work/heat supplied= 0.5\n", - "so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,turbine and compressor work\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.4, Page:341 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 4\")\n", - "T3=1200;#maximum temperature in K\n", - "T1=300;#minimum temperature in K\n", - "y=1.4;#expansion constant\n", - "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n", - "print(\"optimum pressure ratio for maximum work output,\")\n", - "print(\"rp=(T_max/T_min)^((y)/(2*(y-1)))\")\n", - "T_max=T3;\n", - "T_min=T1;\n", - "rp=(T_max/T_min)**((y)/(2*(y-1)))\n", - "print(\"so p2/p1=11.3,For process 1-2, T2/T1=(p2/p1)^(y/(y-1))\")\n", - "print(\"so T2=T1*(p2/p1)^((y-1)/y)in K\")\n", - "T2=T1*(rp)**((y-1)/y)\n", - "print(\"For process 3-4,\")\n", - "print(\"T3/T4=(p3/p4)^((y-1)/y)=(p2/p1)^((y-1)/y)\")\n", - "print(\"so T4=T3/(rp)^((y-1)/y)in K\")\n", - "T4=T3/(rp)**((y-1)/y)\n", - "print(\"heat supplied,Q23=Cp*(T3-T2)in KJ/kg\")\n", - "Q23=Cp*(T3-T2)\n", - "Wc=Cp*(T2-T1)\n", - "print(\"compressor work,Wc in KJ/kg=\"),round(Wc,2)\n", - "Wt=Cp*(T3-T4)\n", - "print(\"turbine work,Wt in KJ/kg=\"),round(Wt,2)\n", - "(Wt-Wc)/Q23\n", - "print(\"thermal efficiency=net work/heat supplied=\"),round((Wt-Wc)/Q23,2)\n", - "print(\"so compressor work=301.5 KJ/kg,turbine work=603 KJ/kg,thermal efficiency=50%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.5;pg no: 342" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.5, Page:342 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\n", - "gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\n", - "for process 1-2 being isentropic,\n", - "T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y) in K\n", - "considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\n", - "so T2_a=T1+((T2-T1)/n_compr)in K\n", - "during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\n", - "heat added=mf*q\n", - "=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\n", - "or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\n", - "so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\n", - "for expansion 3-4 being\n", - "T4/T3=(P4/P3)^((n-1)/n)\n", - "so T4=T3*(P4/P3)^((n-1)/n) in K\n", - "actaul temperature at turbine inlet considering internal efficiency of turbine,\n", - "n_turb=(T3-T4_a)/(T3-T4)\n", - "so T4_a=T3-(n_turb*(T3-T4)) in K\n", - "compressor work,per kg of air compressed(Wc) in KJ/kg of air= 234.42\n", - "so compressor work=234.42 KJ/kg of air\n", - "turbine work,per kg of air compressed(Wt) in KJ/kg of air= 414.71\n", - "so turbine work=414.71 KJ/kg of air\n", - "net work(W_net) in KJ/kg of air= 180.29\n", - "heat supplied(Q) in KJ/kg of air= 751.16\n", - "thermal efficiency(n)= 0.24\n", - "in percentage 24.0\n", - "so thermal efficiency=24%\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,turbine and compressor work\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.5, Page:342 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 5\")\n", - "P1=1*10**5;#initial pressure in Pa\n", - "P4=P1;#constant pressure process\n", - "T1=300;#initial temperature in K\n", - "P2=6.2*10**5;#pressure after compression in Pa\n", - "P3=P2;#constant pressure process\n", - "k=0.017;#fuel to air ratio\n", - "n_compr=0.88;#compressor efficiency\n", - "q=44186;#heating value of fuel in KJ/kg\n", - "n_turb=0.9;#turbine internal efficiency\n", - "Cp_comb=1.147;#specific heat of combustion at constant pressure in KJ/kg K\n", - "Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K\n", - "y=1.4;#expansion constant\n", - "n=1.33;#expansion constant for polytropic constant\n", - "print(\"gas turbine cycle is shown by 1-2-3-4 on T-S diagram,\")\n", - "print(\"for process 1-2 being isentropic,\")\n", - "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", - "T2=T1*(P2/P1)**((y-1)/y)\n", - "print(\"considering compressor efficiency,n_compr=(T2-T1)/(T2_a-T1)\")\n", - "print(\"so T2_a=T1+((T2-T1)/n_compr)in K\")\n", - "T2_a=T1+((T2-T1)/n_compr)\n", - "print(\"during process 2-3 due to combustion of unit mass of compressed the energy balance shall be as under,\")\n", - "print(\"heat added=mf*q\")\n", - "print(\"=((ma+mf)*Cp_comb*T3)-(ma*Cp_air*T2)\")\n", - "print(\"or (mf/ma)*q=((1+(mf/ma))*Cp_comb*T3)-(Cp_air*T2_a)\")\n", - "print(\"so T3=((mf/ma)*q+(Cp_air*T2_a))/((1+(mf/ma))*Cp_comb)in K\")\n", - "T3=((k)*q+(Cp_air*T2_a))/((1+(k))*Cp_comb)\n", - "print(\"for expansion 3-4 being\")\n", - "print(\"T4/T3=(P4/P3)^((n-1)/n)\")\n", - "print(\"so T4=T3*(P4/P3)^((n-1)/n) in K\")\n", - "T4=T3*(P4/P3)**((n-1)/n)\n", - "print(\"actaul temperature at turbine inlet considering internal efficiency of turbine,\")\n", - "print(\"n_turb=(T3-T4_a)/(T3-T4)\")\n", - "print(\"so T4_a=T3-(n_turb*(T3-T4)) in K\")\n", - "T4_a=T3-(n_turb*(T3-T4))\n", - "Wc=Cp_air*(T2_a-T1)\n", - "print(\"compressor work,per kg of air compressed(Wc) in KJ/kg of air=\"),round(Wc,2)\n", - "print(\"so compressor work=234.42 KJ/kg of air\")\n", - "Wt=Cp_comb*(T3-T4_a)\n", - "print(\"turbine work,per kg of air compressed(Wt) in KJ/kg of air=\"),round(Wt,2)\n", - "print(\"so turbine work=414.71 KJ/kg of air\")\n", - "W_net=Wt-Wc\n", - "print(\"net work(W_net) in KJ/kg of air=\"),round(W_net,2)\n", - "Q=k*q\n", - "print(\"heat supplied(Q) in KJ/kg of air=\"),round(Q,2)\n", - "n=W_net/Q\n", - "print(\"thermal efficiency(n)=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so thermal efficiency=24%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.6;pg no: 343" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.6, Page:343 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\n", - "NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\n", - "overall pressure ratio(rp)= 13.59\n", - "so overall optimum pressure ratio=13.6\n" - ] - } - ], - "source": [ - "#cal of overall optimum pressure ratio\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.6, Page:343 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 6\")\n", - "T1=300;#minimum temperature in brayton cycle in K\n", - "T5=1200;#maximum temperature in brayton cycle in K\n", - "n_isen_c=0.85;#isentropic efficiency of compressor\n", - "n_isen_t=0.9;#isentropic efficiency of turbine\n", - "y=1.4;#expansion constant\n", - "print(\"NOTE=>In this question formula for overall pressure ratio is derived,which cannot be done using scilab,so using this formula we proceed further.\")\n", - "rp=(T1/(T5*n_isen_c*n_isen_t))**((2*y)/(3*(1-y)))\n", - "print(\"overall pressure ratio(rp)=\"),round(rp,2)\n", - "print(\"so overall optimum pressure ratio=13.6\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.7;pg no: 346" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.7, Page:346 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\n", - "i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\n", - "therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\n", - "or P9/P1=k=(1.35)^8 11.03\n", - "or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\n", - "T9/T1=(P9/P1)^((y-1)/y)\n", - "so T9 in K= 621.47\n", - "considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\n", - "(T9-T1)/(T9_actual-T1)=0.82\n", - "so T9_actual=T1+((T9-T1)/0.82) in K 689.19\n", - "let the actual index of compression be n, then\n", - "(T9_actual/T1)=(P9/P1)^((n-1)/n)\n", - "so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\n", - "so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\n", - "ii> let polytropic efficiency be n_polytropic for compressor then,\n", - "(n-1)/n=((y-1)/y)*(1/n_polytropic)\n", - "so n_polytropic= 0.87\n", - "in percentage 86.9\n", - "so ploytropic efficiency=86.88%\n", - "iii> stage efficiency can be estimated for any stage.say first stage.\n", - "ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y) in K\n", - "actual temperature at exit of first stage can be estimated using polytropic index 1.49.\n", - "T2_actual/T1=(P2/P1)^((n-1)/n)\n", - "so T2_actual=T1*(P2/P1)^((n-1)/n) in K\n", - "stage efficiency for first stage,ns_1= 0.86\n", - "in percentage 86.33\n", - "actual temperature at exit of second stage,\n", - "T3_actual/T2_actual=(P3/P2)^((n-1)/n)\n", - "so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\n", - "ideal temperature at exit of second stage\n", - "T3/T2_actual=(P3/P2)^((n-1)/n)\n", - "so T3=T2_actual*(P3/P2)^((y-1)/y) in K\n", - "stage efficiency for second stage,ns_2= 0.86\n", - "in percentage 86.33\n", - "actual rtemperature at exit of third stage,\n", - "T4_actual/T3_actual=(P4/P3)^((n-1)/n)\n", - "so T4_actual in K= 420.83\n", - "ideal temperature at exit of third stage,\n", - "T4/T3_actual=(P4/P3)^((n-1)/n)\n", - "so T4 in K= 415.42\n", - "stage efficiency for third stage,ns_3= 0.86\n", - "in percentage= 8632.9\n", - "so stage efficiency=86.4%\n", - "iv> from steady flow energy equation,\n", - "Wc=dw=dh and dh=du+p*dv+v*dp\n", - "dh=dq+v*dp\n", - "dq=0 in adiabatic process\n", - "dh=v*dp\n", - "Wc=v*dp\n", - "here for polytropic compression \n", - "P*V^1.49=constant i.e n=1.49\n", - "Wc in KJ/s= 16419.87\n", - "due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s= 14777.89\n", - "so power required to drive compressor =14777.89 KJ/s\n" - ] - } - ], - "source": [ - "#cal of state of air at exit of compressor,polytropic efficiency,efficiency of each sate,power\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.7, Page:346 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 7\")\n", - "T1=313.;#air entering temperature in K\n", - "P1=1*10**5;#air entering pressure in Pa\n", - "m=50.;#flow rate through compressor in kg/s\n", - "R=0.287;#gas constant in KJ/kg K\n", - "print(\"i> theoretically state of air at exit can be determined by the given stage pressure ratio of 1.35.Let pressure at inlet to first stage P1 and subsequent intermediate pressure be P2,P3,P4,P5,P6,P7,P8 and exit pressure being P9.\")\n", - "print(\"therefore,P2/P1=P3/P2=P4/P3=P5/P4=P6/P5=P7/P6=P8/P7=P9/P8=r=1.35\")\n", - "r=1.35;#compression ratio\n", - "k=(1.35)**8\n", - "print(\"or P9/P1=k=(1.35)^8\"),round(k,2)\n", - "k=11.03;#approx.\n", - "print(\"or theoretically,the temperature at exit of compressor can be predicted considering isentropic compression of air(y=1.4)\")\n", - "y=1.4;#expansion constant \n", - "print(\"T9/T1=(P9/P1)^((y-1)/y)\")\n", - "T9=T1*(k)**((y-1)/y)\n", - "print(\"so T9 in K=\"),round(T9,2)\n", - "print(\"considering overall efficiency of compression 82% the actual temperature at compressor exit can be obtained\")\n", - "print(\"(T9-T1)/(T9_actual-T1)=0.82\")\n", - "T9_actual=T1+((T9-T1)/0.82)\n", - "print(\"so T9_actual=T1+((T9-T1)/0.82) in K\"),round(T9_actual,2)\n", - "print(\"let the actual index of compression be n, then\")\n", - "print(\"(T9_actual/T1)=(P9/P1)^((n-1)/n)\")\n", - "print(\"so n=log(P9/P1)/(log(P9/P1)-log(T9-actual/T1))\")\n", - "n=math.log(k)/(math.log(k)-math.log(T9_actual/T1))\n", - "print(\"so state of air at exit of compressor,pressure=11.03 bar and temperature=689.18 K\")\n", - "print(\"ii> let polytropic efficiency be n_polytropic for compressor then,\")\n", - "print(\"(n-1)/n=((y-1)/y)*(1/n_polytropic)\")\n", - "n_polytropic=((y-1)/y)/((n-1)/n)\n", - "print(\"so n_polytropic=\"),round(n_polytropic,2)\n", - "print(\"in percentage\"),round(n_polytropic*100,2)\n", - "print(\"so ploytropic efficiency=86.88%\")\n", - "print(\"iii> stage efficiency can be estimated for any stage.say first stage.\")\n", - "print(\"ideal state at exit of compressor stage=T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", - "T2=T1*(r)**((y-1)/y)\n", - "print(\"actual temperature at exit of first stage can be estimated using polytropic index 1.49.\")\n", - "print(\"T2_actual/T1=(P2/P1)^((n-1)/n)\")\n", - "print(\"so T2_actual=T1*(P2/P1)^((n-1)/n) in K\")\n", - "T2_actual=T1*(r)**((n-1)/n)\n", - "ns_1=(T2-T1)/(T2_actual-T1)\n", - "print(\"stage efficiency for first stage,ns_1=\"),round(ns_1,2)\n", - "print(\"in percentage\"),round(ns_1*100,2)\n", - "print(\"actual temperature at exit of second stage,\")\n", - "print(\"T3_actual/T2_actual=(P3/P2)^((n-1)/n)\")\n", - "print(\"so T3_actual=T2_actual*(P3/P2)^((n-1)/n) in K\")\n", - "T3_actual=T2_actual*(r)**((n-1)/n)\n", - "print(\"ideal temperature at exit of second stage\")\n", - "print(\"T3/T2_actual=(P3/P2)^((n-1)/n)\")\n", - "print(\"so T3=T2_actual*(P3/P2)^((y-1)/y) in K\")\n", - "T3=T2_actual*(r)**((y-1)/y)\n", - "ns_2=(T3-T2_actual)/(T3_actual-T2_actual)\n", - "print(\"stage efficiency for second stage,ns_2=\"),round(ns_2,2)\n", - "print(\"in percentage\"),round(ns_2*100,2)\n", - "print(\"actual rtemperature at exit of third stage,\")\n", - "print(\"T4_actual/T3_actual=(P4/P3)^((n-1)/n)\")\n", - "T4_actual=T3_actual*(r)**((n-1)/n)\n", - "print(\"so T4_actual in K=\"),round(T4_actual,2)\n", - "print(\"ideal temperature at exit of third stage,\")\n", - "print(\"T4/T3_actual=(P4/P3)^((n-1)/n)\")\n", - "T4=T3_actual*(r)**((y-1)/y)\n", - "print(\"so T4 in K=\"),round(T4,2)\n", - "ns_3=(T4-T3_actual)/(T4_actual-T3_actual)\n", - "print(\"stage efficiency for third stage,ns_3=\"),round(ns_3,2)\n", - "ns_3=ns_3*100\n", - "print(\"in percentage=\"),round(ns_3*100,2)\n", - "print(\"so stage efficiency=86.4%\")\n", - "print(\"iv> from steady flow energy equation,\")\n", - "print(\"Wc=dw=dh and dh=du+p*dv+v*dp\")\n", - "print(\"dh=dq+v*dp\")\n", - "print(\"dq=0 in adiabatic process\")\n", - "print(\"dh=v*dp\")\n", - "print(\"Wc=v*dp\")\n", - "print(\"here for polytropic compression \")\n", - "print(\"P*V^1.49=constant i.e n=1.49\")\n", - "n=1.49;\n", - "Wc=(n/(n-1))*m*R*T1*(((k)**((n-1)/n))-1)\n", - "print(\"Wc in KJ/s=\"),round(Wc,2)\n", - "Wc_actual=Wc*0.9\n", - "print(\"due to overall efficiency being 90% the actual compressor work(Wc_actual) in KJ/s=\"),round(Wc*0.9,2)\n", - "print(\"so power required to drive compressor =14777.89 KJ/s\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.8;pg no: 349" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.8, Page:349 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\n", - "In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\n" - ] - } - ], - "source": [ - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.8, Page:349 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 8\")\n", - "print(\"In question no.8,expression for air standard cycle efficiency is derived which cannot be solve using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.9;pg no: 350" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.9, Page:350 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\n", - "using polytropic efficiency the index of compression and expansion can be obtained as under,\n", - "let compression index be nc,\n", - "(nc-1)/nc=(y-1)/(y*n_poly_c)\n", - "so nc=1/(1-((y-1)/(y*n_poly_c)))\n", - "let expansion index be nt,\n", - "(nt-1)/nt=(n_poly_T*(y-1))/y\n", - "so nt=1/(1-((n_poly_T*(y-1))/y))\n", - "For process 1-2\n", - "T2/T1=(p2/p1)^((nc-1)/nc)\n", - "so T2=T1*(p2/p1)^((nc-1)/nc)in K\n", - "also T4/T3=(p4/p3)^((nt-1)/nt)\n", - "so T4=T3*(p4/p3)^((nt-1)/nt)in K\n", - "using heat exchanger effectivenesss,\n", - "epsilon=(T5-T2)/(T4-T2)\n", - "so T5=T2+(epsilon*(T4-T2))in K\n", - "heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\n", - "compressor work,Wc=Cp*(T2-T1)in \n", - "turbine work,Wt=Cp*(T3-T4)in KJ/kg\n", - "cycle efficiency= 0.33\n", - "in percentage 32.79\n", - "work ratio= 0.33\n", - "specific work output in KJ/kg= 152.56\n", - "so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\n" - ] - } - ], - "source": [ - "#cal of cycle efficiency,work ratio,specific work output\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.9, Page:350 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 9\")\n", - "y=1.4;#expansion constant\n", - "n_poly_c=0.85;#ploytropic efficiency of compressor\n", - "n_poly_T=0.90;#ploytropic efficiency of Turbine\n", - "r=8.;#compression ratio\n", - "T1=(27.+273.);#temperature of air in compressor in K\n", - "T3=1100.;#temperature of air leaving combustion chamber in K\n", - "epsilon=0.8;#effectiveness of heat exchanger\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "print(\"using polytropic efficiency the index of compression and expansion can be obtained as under,\")\n", - "print(\"let compression index be nc,\")\n", - "print(\"(nc-1)/nc=(y-1)/(y*n_poly_c)\")\n", - "print(\"so nc=1/(1-((y-1)/(y*n_poly_c)))\")\n", - "nc=1/(1-((y-1)/(y*n_poly_c)))\n", - "print(\"let expansion index be nt,\")\n", - "print(\"(nt-1)/nt=(n_poly_T*(y-1))/y\")\n", - "print(\"so nt=1/(1-((n_poly_T*(y-1))/y))\")\n", - "nt=1/(1-((n_poly_T*(y-1))/y))\n", - "print(\"For process 1-2\")\n", - "print(\"T2/T1=(p2/p1)^((nc-1)/nc)\")\n", - "print(\"so T2=T1*(p2/p1)^((nc-1)/nc)in K\")\n", - "T2=T1*(r)**((nc-1)/nc)\n", - "print(\"also T4/T3=(p4/p3)^((nt-1)/nt)\")\n", - "print(\"so T4=T3*(p4/p3)^((nt-1)/nt)in K\")\n", - "T4=T3*(1/r)**((nt-1)/nt)\n", - "print(\"using heat exchanger effectivenesss,\") \n", - "print(\"epsilon=(T5-T2)/(T4-T2)\")\n", - "print(\"so T5=T2+(epsilon*(T4-T2))in K\")\n", - "T5=T2+(epsilon*(T4-T2))\n", - "print(\"heat added in combustion chamber,q_add=Cp*(T3-T5)in KJ/kg\")\n", - "q_add=Cp*(T3-T5)\n", - "print(\"compressor work,Wc=Cp*(T2-T1)in \")\n", - "Wc=Cp*(T2-T1)\n", - "print(\"turbine work,Wt=Cp*(T3-T4)in KJ/kg\")\n", - "Wt=Cp*(T3-T4)\n", - "(Wt-Wc)/q_add\n", - "print(\"cycle efficiency=\"),round((Wt-Wc)/q_add,2)\n", - "print(\"in percentage\"),round((Wt-Wc)*100/q_add,2)\n", - "(Wt-Wc)/Wt\n", - "print(\"work ratio=\"),round((Wt-Wc)/Wt,2)\n", - "print(\"specific work output in KJ/kg=\"),round(Wt-Wc,2)\n", - "print(\"so cycle efficiency=32.79%,work ratio=0.334,specific work output=152.56 KJ/kg\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.10;pg no: 351" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.10, Page:351 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\n", - "for process 1-2_a\n", - "T2_a/T1=(p2_a/p1)^((y-1)/y)\n", - "so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\n", - "nc=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+((T2_a-T1)/nc) in K\n", - "for process 3-4_a,\n", - "T4_a/T3=(p4/p3)^((y-1)/y)\n", - "so T4_a=T3*(p4/p3)^((y-1)/y)in K\n", - "Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", - "Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\n", - "net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\n", - "heat added,q_add=Cp*(T3-T2) in KJ/kg\n", - "thermal efficiency,n=W_net/q_add\n", - "n={Wc-(Cp*(T3-T4))}/q_add\n", - "so T4=T3-((Wc-(n*q_add))/Cp)in K\n", - "therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a) 0.297\n", - "in percentage 29.7\n", - "so turbine isentropic efficiency=29.69%\n" - ] - } - ], - "source": [ - "#cal of isentropic efficiency of turbine\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.10, Page:351 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 10\")\n", - "T1=(27+273);#temperature of air in compressor in K\n", - "p1=1*10**5;#pressure of air in compressor in Pa\n", - "p2=5*10**5;#pressure of air after compression in Pa\n", - "p3=p2-0.2*10**5;#pressure drop in Pa\n", - "p4=1*10**5;#pressure to which expansion occur in turbine in Pa\n", - "nc=0.85;#isentropic efficiency\n", - "T3=1000;#temperature of air in combustion chamber in K\n", - "n=0.2;#thermal efficiency of plant\n", - "y=1.4;#expansion constant\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "print(\"for process 1-2_a\")\n", - "print(\"T2_a/T1=(p2_a/p1)^((y-1)/y)\")\n", - "print(\"so T2_a=T1*(p2_a/p1)^((y-1)/y) in K\")\n", - "T2_a=T1*(p2/p1)**((y-1)/y)\n", - "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+((T2_a-T1)/nc) in K\")\n", - "T2=T1+((T2_a-T1)/nc)\n", - "print(\"for process 3-4_a,\")\n", - "print(\"T4_a/T3=(p4/p3)^((y-1)/y)\")\n", - "print(\"so T4_a=T3*(p4/p3)^((y-1)/y)in K\")\n", - "T4_a=T3*(p4/p3)**((y-1)/y)\n", - "print(\"Compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", - "Wc=Cp*(T2-T1)\n", - "print(\"Turbine work per kg,Wt=Cp*(T3-T4)in KJ/kg\")\n", - "print(\"net output,W_net=Wt-Wc={Wc-(Cp*(T3-T4))} in KJ/kg\")\n", - "print(\"heat added,q_add=Cp*(T3-T2) in KJ/kg\")\n", - "q_add=Cp*(T3-T2)\n", - "print(\"thermal efficiency,n=W_net/q_add\")\n", - "print(\"n={Wc-(Cp*(T3-T4))}/q_add\")\n", - "print(\"so T4=T3-((Wc-(n*q_add))/Cp)in K\")\n", - "T4=T3-((Wc-(n*q_add))/Cp)\n", - "nt=(T3-T4)/(T3-T4_a)\n", - "print(\"therefore,isentropic efficiency of turbine,nt=(T3-T4)/(T3-T4_a)\"),round((T3-T4)/(T3-T4_a),3)\n", - "print(\"in percentage\"),round(nt*100,2)\n", - "print(\"so turbine isentropic efficiency=29.69%\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.11;pg no: 352" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.11, Page:352 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\n", - "for perfect intercooling the pressure ratio of each compression stage(k)\n", - "k=sqrt(r)\n", - "for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\n", - "so T2_a=T1*(k)^((y-1)/y)in K\n", - "considering isentropic efficiency of compression,\n", - "nc=(T2_a-T1)/(T2-T1)\n", - "so T2=T1+((T2_a-T1)/nc)in K\n", - "for process 3-4,\n", - "T4_a/T3=(P4/P3)^((y-1)/y)\n", - "so T4_a=T3*(P4/P3)^((y-1)/y) in K\n", - "again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\n", - "so T4=T3+((T4_a-T3)/nc)in K\n", - "total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\n", - "for expansion process 5-6_a,\n", - "T6_a/T5=(P6/P5)^((y-1)/y)\n", - "so T6_a=T5*(P6/P5)^((y-1)/y) in K\n", - "considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\n", - "T6=T5-(ne*(T5-T6_a)) in K\n", - "for expansion in 7-8_a\n", - "T8_a/T7=(P8/P7)^((y-1)/y)\n", - "so T8_a=T7*(P8/P7)^((y-1)/y) in K\n", - "considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\n", - "so T8=T7-(ne*(T7-T8_a))in K\n", - "expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\n", - "heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\n", - "fuel required per kg of air,mf=q_add/C 0.02\n", - "air-fuel ratio=1/mf 51.08\n", - "net output(W) in KJ/kg= 229.2\n", - "output for air flowing at 30 kg/s,=W*m in KW 6876.05\n", - "thermal efficiency= 0.28\n", - "in percentage 27.88\n", - "so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\n", - "NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\n" - ] - } - ], - "source": [ - "#cal of thermal efficiency,net output,A/F ratio\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.11, Page:352 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 11\")\n", - "P1=1.*10**5;#initial pressure in Pa\n", - "T1=(27.+273.);#initial temperature in K\n", - "T3=T1;\n", - "r=10.;#pressure ratio\n", - "T5=1000.;#maximum temperature in cycle in K\n", - "P6=3.*10**5;#first stage expansion pressure in Pa\n", - "T7=995.;#first stage reheated temperature in K\n", - "C=42000.;#calorific value of fuel in KJ/kg\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "m=30.;#air flow rate in kg/s\n", - "nc=0.85;#isentropic efficiency of compression\n", - "ne=0.9;#isentropic efficiency of expansion\n", - "y=1.4;#expansion constant\n", - "print(\"for perfect intercooling the pressure ratio of each compression stage(k)\")\n", - "print(\"k=sqrt(r)\")\n", - "k=math.sqrt(r)\n", - "k=3.16;#approx.\n", - "print(\"for process 1-2_a,T2_a/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2_a=T1*(k)^((y-1)/y)in K\")\n", - "T2_a=T1*(k)**((y-1)/y)\n", - "print(\"considering isentropic efficiency of compression,\")\n", - "print(\"nc=(T2_a-T1)/(T2-T1)\")\n", - "print(\"so T2=T1+((T2_a-T1)/nc)in K\")\n", - "T2=T1+((T2_a-T1)/nc)\n", - "print(\"for process 3-4,\")\n", - "print(\"T4_a/T3=(P4/P3)^((y-1)/y)\")\n", - "print(\"so T4_a=T3*(P4/P3)^((y-1)/y) in K\")\n", - "T4_a=T3*(k)**((y-1)/y)\n", - "print(\"again due to compression efficiency,nc=(T4_a-T3)/(T4-T3)\")\n", - "print(\"so T4=T3+((T4_a-T3)/nc)in K\")\n", - "T4=T3+((T4_a-T3)/nc)\n", - "print(\"total compressor work,Wc=2*Cp*(T4-T3) in KJ/kg\")\n", - "Wc=2*Cp*(T4-T3)\n", - "print(\"for expansion process 5-6_a,\")\n", - "print(\"T6_a/T5=(P6/P5)^((y-1)/y)\")\n", - "print(\"so T6_a=T5*(P6/P5)^((y-1)/y) in K\")\n", - "P5=10.*10**5;#pressure in Pa\n", - "T6_a=T5*(P6/P5)**((y-1)/y)\n", - "print(\"considering expansion efficiency,ne=(T5-T6)/(T5-T6_a)\")\n", - "print(\"T6=T5-(ne*(T5-T6_a)) in K\")\n", - "T6=T5-(ne*(T5-T6_a))\n", - "print(\"for expansion in 7-8_a\")\n", - "print(\"T8_a/T7=(P8/P7)^((y-1)/y)\")\n", - "print(\"so T8_a=T7*(P8/P7)^((y-1)/y) in K\")\n", - "P8=P1;#constant pressure process\n", - "P7=P6;#constant pressure process\n", - "T8_a=T7*(P8/P7)**((y-1)/y)\n", - "print(\"considering expansion efficiency,ne=(T7-T8)/(T7-T8_a)\")\n", - "print(\"so T8=T7-(ne*(T7-T8_a))in K\")\n", - "T8=T7-(ne*(T7-T8_a))\n", - "print(\"expansion work output per kg of air(Wt)=Cp*(T5-T6)+Cp*(T7-T8) in KJ/kg\")\n", - "Wt=Cp*(T5-T6)+Cp*(T7-T8)\n", - "print(\"heat added per kg air(q_add)=Cp*(T5-T4)+Cp*(T7-T6) in KJ/kg\")\n", - "q_add=Cp*(T5-T4)+Cp*(T7-T6)\n", - "mf=q_add/C\n", - "print(\"fuel required per kg of air,mf=q_add/C\"),round(q_add/C,2)\n", - "print(\"air-fuel ratio=1/mf\"),round(1/mf,2)\n", - "W=Wt-Wc\n", - "print(\"net output(W) in KJ/kg=\"),round(Wt-Wc,2)\n", - "print(\"output for air flowing at 30 kg/s,=W*m in KW\"),round(W*m,2)\n", - "W/q_add\n", - "print(\"thermal efficiency=\"),round(W/q_add,2)\n", - "print(\"in percentage\"),round(W*100/q_add,2)\n", - "print(\"so thermal efficiency=27.87%,net output=6876.05 KW,A/F ratio=51.07\")\n", - "print(\"NOTE=>In this question,expansion work is calculated wrong in book,so it is corrected above and answers vary accordingly.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.12;pg no: 354" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.12, Page:354 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\n", - "for process 1-2,\n", - "T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y) in K\n", - "for process 3-4,\n", - "T4/T3=(P4/P3)^((y-1)/y)\n", - "so T4=T3*(P4/P3)^((y-1)/y) in K\n", - "for process 6-7,\n", - "T7/T6=(P7/P6)^((y-1)/y)\n", - "so T7=T6*(P7/P6)^((y-1)/y) in K\n", - "for process 8-9,\n", - "T9/T8=(P9/P8)^((y-1)/y)\n", - "T9=T8*(P9/P8)^((y-1)/y) in K\n", - "in regenerator,effectiveness=(T5-T4)/(T9-T4)\n", - "T5=T4+(ne*(T9-T4))in K\n", - "compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\n", - "turbine work per kg air,Wt in KJ/kg= 660.84\n", - "heat added per kg air,q_add in KJ/kg= 765.43\n", - "total fuel required per kg of air= 0.02\n", - "net work,W_net in KJ/kg= 450.85\n", - "cycle thermal efficiency,n= 0.59\n", - "in percentage 58.9\n", - "fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C= 0.0056\n", - "fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C= 0.0126\n", - "so fuel-air ratio in two combustion chambers=0.0126,0.0056\n", - "total turbine work=660.85 KJ/kg\n", - "cycle thermal efficiency=58.9%\n", - "NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \n" - ] - } - ], - "source": [ - "#cal of fuel-air ratio in two combustion chambers,total turbine work,cycle thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.12, Page:354 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 12\")\n", - "P1=1.*10**5;#initial pressure in Pa\n", - "P9=P1;\n", - "T1=300.;#initial temperature in K\n", - "P2=4.*10**5;#pressure of air in intercooler in Pa\n", - "P3=P2;\n", - "T3=290.;#temperature of air in intercooler in K\n", - "T6=1300.;#temperature of combustion chamber in K\n", - "P4=8.*10**5;#pressure of air after compression in Pa\n", - "P6=P4;\n", - "T8=1300.;#temperature after reheating in K\n", - "P8=4.*10**5;#pressure after expansion in Pa\n", - "P7=P8;\n", - "C=42000.;#heating value of fuel in KJ/kg\n", - "y=1.4;#expansion constant\n", - "ne=0.8;#effectiveness of regenerator\n", - "Cp=1.0032;#specific heat at constant pressure in KJ/kg K\n", - "print(\"for process 1-2,\")\n", - "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y) in K\")\n", - "T2=T1*(P2/P1)**((y-1)/y)\n", - "print(\"for process 3-4,\")\n", - "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", - "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", - "T4=T3*(P4/P3)**((y-1)/y)\n", - "print(\"for process 6-7,\")\n", - "print(\"T7/T6=(P7/P6)^((y-1)/y)\")\n", - "print(\"so T7=T6*(P7/P6)^((y-1)/y) in K\")\n", - "T7=T6*(P7/P6)**((y-1)/y)\n", - "print(\"for process 8-9,\")\n", - "print(\"T9/T8=(P9/P8)^((y-1)/y)\")\n", - "print(\"T9=T8*(P9/P8)^((y-1)/y) in K\")\n", - "T9=T8*(P9/P8)**((y-1)/y)\n", - "print(\"in regenerator,effectiveness=(T5-T4)/(T9-T4)\")\n", - "print(\"T5=T4+(ne*(T9-T4))in K\")\n", - "T5=T4+(ne*(T9-T4))\n", - "print(\"compressor work per kg air,Wc=Cp*(T2-T1)+Cp*(T4-T3) in KJ/kg\")\n", - "Wc=Cp*(T2-T1)+Cp*(T4-T3)\n", - "Wt=Cp*(T6-T7)+Cp*(T8-T9)\n", - "print(\"turbine work per kg air,Wt in KJ/kg=\"),round(Wt,2)\n", - "q_add=Cp*(T6-T5)+Cp*(T8-T7)\n", - "print(\"heat added per kg air,q_add in KJ/kg=\"),round(q_add,2)\n", - "q_add/C\n", - "print(\"total fuel required per kg of air=\"),round(q_add/C,2)\n", - "W_net=Wt-Wc\n", - "print(\"net work,W_net in KJ/kg=\"),round(W_net,2)\n", - "n=W_net/q_add\n", - "print(\"cycle thermal efficiency,n=\"),round(n,2)\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"fuel required per kg air in combustion chamber 1,Cp*(T8-T7)/C=\"),round(Cp*(T8-T7)/C,4)\n", - "print(\"fuel required per kg air in combustion chamber2,Cp*(T6-T5)/C=\"),round(Cp*(T6-T5)/C,4)\n", - "print(\"so fuel-air ratio in two combustion chambers=0.0126,0.0056\")\n", - "print(\"total turbine work=660.85 KJ/kg\")\n", - "print(\"cycle thermal efficiency=58.9%\")\n", - "print(\"NOTE=>In this question,fuel required per kg air in combustion chamber 1 and 2 are calculated wrong in book,so it is corrected above and answers vary accordingly. \")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.13;pg no: 356" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.13, Page:356 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\n", - "work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\n", - "heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\n", - "for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\n", - "mass of air per cycle=m/n in kg/cycle\n", - "brake output in KW= 17.12\n", - "stroke volume,V in m^3= 0.0117\n", - "brake output=17.11 KW\n", - "stroke volume=0.0116 m^3\n" - ] - } - ], - "source": [ - "#cal of brake output,stroke volume\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "import math\n", - "print\"Example 9.13, Page:356 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 13\")\n", - "T2=700.;#highest temperature of stirling engine in K\n", - "T1=300.;#lowest temperature of stirling engine in K\n", - "r=3.;#compression ratio\n", - "q_add=30.;#heat addition in KJ/s\n", - "epsilon=0.9;#regenerator efficiency\n", - "P=1*10**5;#pressure at begining of compression in Pa\n", - "n=100.;#number of cycle per minute\n", - "Cv=0.72;#specific heat at constant volume in KJ/kg K\n", - "R=29.27;#gas constant in KJ/kg K\n", - "print(\"work done per kg of air,W=R*(T2-T1)*log(r) in KJ/kg\")\n", - "W=R*(T2-T1)*math.log(r)\n", - "print(\"heat added per kg of air,q=R*T2*log(r)+(1-epsilon)*Cv*(T2-T1) in KJ/kg\")\n", - "q=R*T2*math.log(r)+(1-epsilon)*Cv*(T2-T1)\n", - "print(\"for 30 KJ/s heat supplied,the mass of air/s(m)=q_add/q in kg/s\")\n", - "m=q_add/q\n", - "print(\"mass of air per cycle=m/n in kg/cycle\")\n", - "m/n\n", - "print(\"brake output in KW=\"),round(W*m,2)\n", - "m=1.33*10**-4;#mass of air per cycle in kg/cycle\n", - "T=T1;\n", - "V=m*R*T*1000/P\n", - "print(\"stroke volume,V in m^3=\"),round(V,4)\n", - "print(\"brake output=17.11 KW\")\n", - "print(\"stroke volume=0.0116 m^3\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.14;pg no: 357" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.14, Page:357 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\n", - "In question no.14,various expression is derived which cannot be solved using python software.\n" - ] - } - ], - "source": [ - "#cal of compression ratio,air standard efficiency,fuel consumption,bhp/hr\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.14, Page:357 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 14\")\n", - "print(\"In question no.14,various expression is derived which cannot be solved using python software.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.15;pg no: 361" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.15, Page:361 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\n", - "In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\n", - "so T2=T1*(P2/P1)^((y-1)/y)in K\n", - "T4/T3=(P4/P3)^((y-1)/y)\n", - "so T4=T3*(P4/P3)^((y-1)/y) in K\n", - "compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\n", - "turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \n", - "heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \n", - "net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\n", - "heat recovered in HRSG for steam generation per kg of air\n", - "q_HRGC=Cp*(T4-T5)in KJ/kg\n", - "at inlet to steam in turbine,\n", - "from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\n", - "for expansion in steam turbine,sa=sb\n", - "let dryness fraction at state b be x\n", - "also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\n", - "sb=sf+x*sfg\n", - "so x=(sb-sf)/sfg \n", - "so hb=hf+x*hfg in KJ/kg K\n", - "at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\n", - "at exit of feed pump,hd=hd-hc\n", - "hd=vc*(Pg-Pc)*100 in KJ/kg\n", - "heat added per kg of steam =ha-hd in KJ/kg\n", - "mass of steam generated per kg of air in kg steam per kg air= 0.119\n", - "net steam turbine cycle output,W_net_ST in KJ/kg= 677.4\n", - "steam cycle output per kg of air(W_net_ST) in KJ/kg air= 80.61\n", - "total combined cycle output in KJ/kg air= 486.88\n", - "combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add 0.58\n", - "in percentage 57.77\n", - "In absence of steam cycle,gas turbine cycle efficiency,n_GT= 0.48\n", - "in percentage 48.21\n", - "thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\n", - "overall efficiency=57.77%\n", - "steam per kg of air=0.119 kg steam per/kg air\n" - ] - } - ], - "source": [ - "#cal of overall efficiency,steam per kg of air\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.15, Page:361 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 15\")\n", - "r=10.;#pressure ratio\n", - "Cp=1.0032;#specific heat of air in KJ/kg K\n", - "y=1.4;#expansion constant\n", - "T3=1400.;#inlet temperature of gas turbine in K\n", - "T1=(17.+273.);#ambient temperature in K\n", - "P1=1.*10**5;#ambient pressure in Pa\n", - "Pc=15.;#condensor pressure in KPa\n", - "Pg=6.*1000;#pressure of steam in generator in KPa\n", - "T5=420.;#temperature of exhaust from gas turbine in K\n", - "print(\"In gas turbine cycle,T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"so T2=T1*(P2/P1)^((y-1)/y)in K\")\n", - "T2=T1*(r)**((y-1)/y)\n", - "print(\"T4/T3=(P4/P3)^((y-1)/y)\")\n", - "print(\"so T4=T3*(P4/P3)^((y-1)/y) in K\")\n", - "T4=T3*(1/r)**((y-1)/y)\n", - "print(\"compressor work per kg,Wc=Cp*(T2-T1) in KJ/kg\")\n", - "Wc=Cp*(T2-T1)\n", - "print(\"turbine work per kg,Wt=Cp*(T3-T4) in KJ/kg \")\n", - "Wt=Cp*(T3-T4)\n", - "print(\"heat added in combustion chamber per kg,q_add=Cp*(T3-T2) in KJ/kg \")\n", - "q_add=Cp*(T3-T2)\n", - "print(\"net gas turbine output,W_net_GT=Wt-Wc in KJ/kg air\")\n", - "W_net_GT=Wt-Wc\n", - "print(\"heat recovered in HRSG for steam generation per kg of air\")\n", - "print(\"q_HRGC=Cp*(T4-T5)in KJ/kg\")\n", - "q_HRGC=Cp*(T4-T5)\n", - "print(\"at inlet to steam in turbine,\")\n", - "print(\"from steam table,ha=3177.2 KJ/kg,sa=6.5408 KJ/kg K\")\n", - "ha=3177.2;\n", - "sa=6.5408;\n", - "print(\"for expansion in steam turbine,sa=sb\")\n", - "sb=sa;\n", - "print(\"let dryness fraction at state b be x\")\n", - "print(\"also from steam table,at 15KPa, sf=0.7549 KJ/kg K,sfg=7.2536 KJ/kg K,hf=225.94 KJ/kg,hfg=2373.1 KJ/kg\")\n", - "sf=0.7549;\n", - "sfg=7.2536;\n", - "hf=225.94;\n", - "hfg=2373.1;\n", - "print(\"sb=sf+x*sfg\")\n", - "print(\"so x=(sb-sf)/sfg \")\n", - "x=(sb-sf)/sfg\n", - "print(\"so hb=hf+x*hfg in KJ/kg K\")\n", - "hb=hf+x*hfg\n", - "print(\"at exit of condenser,hc=hf ,vc=0.001014 m^3/kg from steam table\")\n", - "hc=hf;\n", - "vc=0.001014;\n", - "print(\"at exit of feed pump,hd=hd-hc\")\n", - "print(\"hd=vc*(Pg-Pc)*100 in KJ/kg\")\n", - "hd=vc*(Pg-Pc)*100\n", - "print(\"heat added per kg of steam =ha-hd in KJ/kg\")\n", - "ha-hd\n", - "print(\"mass of steam generated per kg of air in kg steam per kg air=\"),round(q_HRGC/(ha-hd),3)\n", - "W_net_ST=(ha-hb)-(hd-hc)\n", - "print(\"net steam turbine cycle output,W_net_ST in KJ/kg=\"),round(W_net_ST,2)\n", - "W_net_ST=W_net_ST*0.119 \n", - "print(\"steam cycle output per kg of air(W_net_ST) in KJ/kg air=\"),round(W_net_ST,2)\n", - "(W_net_GT+W_net_ST)\n", - "print(\"total combined cycle output in KJ/kg air= \"),round((W_net_GT+W_net_ST),2)\n", - "n_cc=(W_net_GT+W_net_ST)/q_add\n", - "print(\"combined cycle efficiency,n_cc=(W_net_GT+W_net_ST)/q_add\"),round(n_cc,2)\n", - "print(\"in percentage\"),round(n_cc*100,2)\n", - "n_GT=W_net_GT/q_add\n", - "print(\"In absence of steam cycle,gas turbine cycle efficiency,n_GT=\"),round(n_GT,2)\n", - "print(\"in percentage\"),round(n_GT*100,2)\n", - "print(\"thus ,efficiency is seen to increase in combined cycle upto 57.77% as compared to gas turbine offering 48.21% efficiency.\")\n", - "print(\"overall efficiency=57.77%\")\n", - "print(\"steam per kg of air=0.119 kg steam per/kg air\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 9.16;pg no: 363" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 9.16, Page:363 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\n", - "here P4/P1=P3/P1=70............eq1\n", - "compression ratio,V1/V2=V1/V3=15.............eq2\n", - "heat added at constant volume= heat added at constant pressure\n", - "Q23=Q34\n", - "m*Cv*(T3-T2)=m*Cp*(T4-T3)\n", - "(T3-T2)=y*(T4-T3)\n", - "for process 1-2;\n", - "T2/T1=(P2/P1)^((y-1)/y)\n", - "T2/T1=(V1/V2)^(y-1)\n", - "so T2=T1*(V1/V2)^(y-1) in K\n", - "and (P2/P1)=(V1/V2)^y\n", - "so P2=P1*(V1/V2)^y in Pa...........eq3\n", - "for process 2-3,\n", - "P2/P3=T2/T3\n", - "so T3=T2*P3/P2\n", - "using eq 1 and 3,we get\n", - "T3=T2*k/r^y in K\n", - "using equal heat additions for processes 2-3 and 3-4,\n", - "(T3-T2)=y*(T4-T3)\n", - "so T4=T3+((T3-T2)/y) in K\n", - "for process 3-4,\n", - "V3/V4=T3/T4\n", - "(V3/V1)*(V1/V4)=T3/T4\n", - "so (V1/V4)=(T3/T4)*r\n", - "so V1/V4=11.88 and V5/V4=11.88\n", - "for process 4-5,\n", - "P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\n", - "so T5=T4/((V5/V4)^(y-1))\n", - "air standard thermal efficiency(n)=1-(heat rejected/heat added)\n", - "n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\n", - "n= 0.65\n", - "air standard thermal efficiency=0.6529\n", - "in percentage 65.29\n", - "so air standard thermal efficiency=65.29%\n", - "Actual thermal efficiency may be different from theoretical efficiency due to following reasons\n", - "a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\n", - "b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\n", - "c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\n" - ] - } - ], - "source": [ - "#cal of air standard thermal efficiency\n", - "#intiation of all variables\n", - "# Chapter 9\n", - "print\"Example 9.16, Page:363 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh Chapter 9 Example 16\")\n", - "T1=(27+273);#temperature at begining of compression in K\n", - "k=70;#ration of maximum to minimum pressures\n", - "r=15;#compression ratio\n", - "y=1.4;#expansion constant\n", - "print(\"here P4/P1=P3/P1=70............eq1\")\n", - "print(\"compression ratio,V1/V2=V1/V3=15.............eq2\")\n", - "print(\"heat added at constant volume= heat added at constant pressure\")\n", - "print(\"Q23=Q34\")\n", - "print(\"m*Cv*(T3-T2)=m*Cp*(T4-T3)\")\n", - "print(\"(T3-T2)=y*(T4-T3)\")\n", - "print(\"for process 1-2;\")\n", - "print(\"T2/T1=(P2/P1)^((y-1)/y)\")\n", - "print(\"T2/T1=(V1/V2)^(y-1)\")\n", - "print(\"so T2=T1*(V1/V2)^(y-1) in K\")\n", - "T2=T1*(r)**(y-1)\n", - "print(\"and (P2/P1)=(V1/V2)^y\")\n", - "print(\"so P2=P1*(V1/V2)^y in Pa...........eq3\")\n", - "print(\"for process 2-3,\")\n", - "print(\"P2/P3=T2/T3\")\n", - "print(\"so T3=T2*P3/P2\")\n", - "print(\"using eq 1 and 3,we get\")\n", - "print(\"T3=T2*k/r^y in K\")\n", - "T3=T2*k/r**y \n", - "print(\"using equal heat additions for processes 2-3 and 3-4,\")\n", - "print(\"(T3-T2)=y*(T4-T3)\")\n", - "print(\"so T4=T3+((T3-T2)/y) in K\")\n", - "T4=T3+((T3-T2)/y)\n", - "print(\"for process 3-4,\")\n", - "print(\"V3/V4=T3/T4\")\n", - "print(\"(V3/V1)*(V1/V4)=T3/T4\")\n", - "print(\"so (V1/V4)=(T3/T4)*r\")\n", - "(T3/T4)*r\n", - "print(\"so V1/V4=11.88 and V5/V4=11.88\")\n", - "print(\"for process 4-5,\")\n", - "print(\"P4/P5=(V5/V4)^y,or T4/T5=(V5/V4)^(y-1)\")\n", - "print(\"so T5=T4/((V5/V4)^(y-1))\")\n", - "T5=T4/(11.88)**(y-1)\n", - "print(\"air standard thermal efficiency(n)=1-(heat rejected/heat added)\")\n", - "print(\"n=1-(m*Cv*(T5-T1)/(m*Cp*(T4-T3)+m*Cv*(T3-T2)))\")\n", - "n=1-((T5-T1)/(y*(T4-T3)+(T3-T2)))\n", - "print(\"n=\"),round(n,2)\n", - "print(\"air standard thermal efficiency=0.6529\")\n", - "print(\"in percentage\"),round(n*100,2)\n", - "print(\"so air standard thermal efficiency=65.29%\")\n", - "print(\"Actual thermal efficiency may be different from theoretical efficiency due to following reasons\")\n", - "print(\"a> Air standard cycle analysis considers air as the working fluid while in actual cycle it is not air throughtout the cycle.Actual working fluid which are combustion products do not behave as perfect gas.\")\n", - "print(\"b> Heat addition does not occur isochorically in actual process.Also combustion is accompanied by inefficiency such as incomplete combustion,dissociation of combustion products,etc.\")\n", - "print(\"c> Specific heat variation occurs in actual processes where as in air standard cycle analysis specific heat variation neglected.Also during adiabatic process theoretically no heat loss occur while actually these processes are accompanied by heat losses.\")\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter_1.ipynb deleted file mode 100755 index 9474d100..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter_1.ipynb +++ /dev/null @@ -1,1777 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# chapter 1:Fundemental concepts and definitions" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.1;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.1, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\n", - "pressure difference(p)in pa\n", - "p= 39755.7\n" - ] - } - ], - "source": [ - "#cal of pressure difference\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.1, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\"\n", - "h=30*10**-2;#manometer deflection of mercury in m\n", - "g=9.78;#acceleration due to gravity in m/s^2\n", - "rho=13550;#density of mercury at room temperature in kg/m^3\n", - "print\"pressure difference(p)in pa\"\n", - "p=rho*g*h\n", - "print\"p=\",round(p,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.2;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.2, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\n", - "effort required for lifting the lid(E)in N\n", - "E= 7115.48\n" - ] - } - ], - "source": [ - "#cal of effort required for lifting the lid\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.2, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\"\n", - "d=30*10**-2;#diameter of cylindrical vessel in m\n", - "h=76*10**-2;#atmospheric pressure in m of mercury\n", - "g=9.78;#acceleration due to gravity in m/s^2\n", - "rho=13550;#density of mercury at room temperature in kg/m^3\n", - "print\"effort required for lifting the lid(E)in N\"\n", - "E=(rho*g*h)*(3.14*d**2)/4\n", - "print\"E=\",round(E,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.3;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.3, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\n", - "pressure measured by manometer is gauge pressure(Pg)in kpa\n", - "Pg=rho*g*h/10^3\n", - "actual pressure of the air(P)in kpa\n", - "P= 140.76\n" - ] - } - ], - "source": [ - "#cal of actual pressure of the air\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.3, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\"\n", - "h=30*10**-2;# pressure of compressed air in m of mercury\n", - "Patm=101*10**3;#atmospheric pressure in pa\n", - "g=9.78;#acceleration due to gravity in m/s^2\n", - "rho=13550;#density of mercury at room temperature in kg/m^3\n", - "print\"pressure measured by manometer is gauge pressure(Pg)in kpa\"\n", - "print\"Pg=rho*g*h/10^3\"\n", - "Pg=rho*g*h/10**3\n", - "print\"actual pressure of the air(P)in kpa\"\n", - "P=Pg+Patm/10**3\n", - "print\"P=\",round(P,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.4;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.4, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\n", - "density of oil(RHOoil)in kg/m^3\n", - "RHOoil=sg*RHOw\n", - "gauge pressure(Pg)in kpa\n", - "Pg= 7.848\n" - ] - } - ], - "source": [ - "#cal of gauge pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.4, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\"\n", - "h=1;#depth of oil tank in m\n", - "sg=0.8;#specific gravity of oil\n", - "RHOw=1000;#density of water in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print\"density of oil(RHOoil)in kg/m^3\"\n", - "print\"RHOoil=sg*RHOw\"\n", - "RHOoil=sg*RHOw\n", - "print\"gauge pressure(Pg)in kpa\"\n", - "Pg=RHOoil*g*h/10**3\n", - "print\"Pg=\",round(Pg,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.5;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.5, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\n", - "atmospheric pressure(Patm)in kpa\n", - "Patm=rho*g*h2/10^3\n", - "pressure due to mercury column at AB(Pab)in kpa\n", - "Pab=rho*g*h1/10^3\n", - "pressure exerted by gas(Pgas)in kpa\n", - "Pgas= 154.76\n" - ] - } - ], - "source": [ - "#cal of pressure exerted by gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.5, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\"\n", - "rho=13.6*10**3;#density of mercury in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "h1=40*10**-2;#difference of height in mercury column in m as shown in figure\n", - "h2=76*10**-2;#barometer reading of mercury in m\n", - "print\"atmospheric pressure(Patm)in kpa\"\n", - "print\"Patm=rho*g*h2/10^3\"\n", - "Patm=rho*g*h2/10**3\n", - "print\"pressure due to mercury column at AB(Pab)in kpa\"\n", - "print\"Pab=rho*g*h1/10^3\"\n", - "Pab=rho*g*h1/10**3\n", - "print\"pressure exerted by gas(Pgas)in kpa\"\n", - "Pgas=Patm+Pab\n", - "print\"Pgas=\",round(Pgas,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.6;page no:23" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.6, Page:23 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\n", - "by law of conservation of energy\n", - "potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\n", - "so m*g*h = m*Cp*deltaT*4.18*1000\n", - "change in temperature of water(deltaT) in degree celcius\n", - "deltaT= 2.35\n" - ] - } - ], - "source": [ - "#cal of change in temperature of water\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.6, Page:23 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\"\n", - "m=1;#mass of water in kg\n", - "h=1000;#height from which water fall in m\n", - "Cp=1;#specific heat of water in kcal/kg k\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print\"by law of conservation of energy\"\n", - "print\"potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\"\n", - "print\"so m*g*h = m*Cp*deltaT*4.18*1000\"\n", - "print\"change in temperature of water(deltaT) in degree celcius\"\n", - "deltaT=(g*h)/(4.18*1000*Cp)\n", - "print\"deltaT=\",round(deltaT,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.7;page no:23" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.7, Page:23 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\n", - "mass of object(m)in kg\n", - "m=w1/g1\n", - "spring balance reading=gravitational force in mass(F)in N\n", - "F= 86.65\n" - ] - } - ], - "source": [ - "#cal of spring balance reading\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.7, Page:23 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\"\n", - "w1=100;#weight of object at standard gravitational acceleration in N\n", - "g1=9.81;#acceleration due to gravity in m/s^2\n", - "g2=8.5;#gravitational acceleration at some location\n", - "print\"mass of object(m)in kg\"\n", - "print\"m=w1/g1\"\n", - "m=w1/g1\n", - "print\"spring balance reading=gravitational force in mass(F)in N\"\n", - "F=m*g2\n", - "print\"F=\",round(F,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.8;page no:24" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.8, Page:24 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\n", - "pressure measured by manometer(P) in pa\n", - "p=rho*g*h\n", - "now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\n", - "mass of piston(m)in kg\n", - "so m= 28.84\n" - ] - } - ], - "source": [ - "#cal of mass of piston\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.8, Page:24 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\"\n", - "d=15*10**-2;#diameter of cylinder in m\n", - "h=12*10**-2;#manometer height difference in m of mercury\n", - "rho=13.6*10**3;#density of mercury in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print\"pressure measured by manometer(P) in pa\"\n", - "print\"p=rho*g*h\"\n", - "p=rho*g*h\n", - "print\"now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\"\n", - "print\"mass of piston(m)in kg\"\n", - "m=(p*math.pi*d**2)/(4*g)\n", - "print\"so m=\",round(m,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.9;page no:24" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.9, Page:24 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\n", - "balancing pressure at plane BC in figure we get\n", - "Psteam+Pwater=Patm+Pmercury\n", - "now 1.atmospheric pressure(Patm)in pa\n", - "Patm= 101396.16\n", - "2.pressure due to water(Pwater)in pa\n", - "Pwater= 196.2\n", - "3.pressure due to mercury(Pmercury)in pa\n", - "Pmercury=RHOm*g*h3 13341.6\n", - "using balancing equation\n", - "Psteam=Patm+Pmercury-Pwater\n", - "so pressure of steam(Psteam)in kpa\n", - "Psteam= 114.54\n" - ] - } - ], - "source": [ - "#cal of pressure due to atmosphere,water,mercury,steam\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.9, Page:24 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\")\n", - "RHOm=13.6*10**3;#density of mercury in kg/m^3\n", - "RHOw=1000;#density of water in kg/m^3\n", - "h1=76*10**-2;#barometer reading in m of mercury\n", - "h2=2*10**-2;#height raised by water in manometer tube in m \n", - "h3=10*10**-2;#height raised by mercury in manometer tube in m \n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"balancing pressure at plane BC in figure we get\")\n", - "print(\"Psteam+Pwater=Patm+Pmercury\")\n", - "print(\"now 1.atmospheric pressure(Patm)in pa\")\n", - "Patm=RHOm*g*h1\n", - "print(\"Patm=\"),round(Patm,2)\n", - "print(\"2.pressure due to water(Pwater)in pa\")\n", - "Pwater=RHOw*g*h2\n", - "print(\"Pwater=\"),round(Pwater,2)\n", - "print(\"3.pressure due to mercury(Pmercury)in pa\")\n", - "Pmercury=RHOm*g*h3\n", - "print(\"Pmercury=RHOm*g*h3\"),round(Pmercury,2)\n", - "print(\"using balancing equation\")\n", - "print(\"Psteam=Patm+Pmercury-Pwater\")\n", - "print(\"so pressure of steam(Psteam)in kpa\")\n", - "Psteam=(Patm+Pmercury-Pwater)/1000\n", - "print(\"Psteam=\"),round(Psteam,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.10;page no:24" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.10, Page:24 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\n", - "atmospheric pressure(Patm)in kpa\n", - "absolute temperature in compartment A(Pa) in kpa\n", - "Pa= 496.06\n", - "absolute temperature in compartment B(Pb) in kpa\n", - "Pb= 246.06\n", - "absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\n" - ] - } - ], - "source": [ - "#cal of \"absolute temperature in compartment A,B\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.10, Page:24 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\")\n", - "h=720*10**-3;#barometer reading in m of Hg\n", - "Pga=400;#gauge pressure in compartment A in kpa\n", - "Pgb=150;#gauge pressure in compartment B in kpa\n", - "rho=13.6*10**3;#density of mercury in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"atmospheric pressure(Patm)in kpa\")\n", - "Patm=(rho*g*h)/1000\n", - "print(\"absolute temperature in compartment A(Pa) in kpa\")\n", - "Pa=Pga+Patm\n", - "print\"Pa=\",round(Pa,2)\n", - "print\"absolute temperature in compartment B(Pb) in kpa\"\n", - "Pb=Pgb+Patm\n", - "print\"Pb=\",round(Pb,2)\n", - "print\"absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.11;page no:25" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.11, Page:25 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\n", - "the pressure of air in air tank can be obtained by equalising pressures at some reference line\n", - "P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\n", - "so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\n", - "air pressure(P1)in kpa 139.81\n" - ] - } - ], - "source": [ - "#cal of air pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.11, Page:25 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\")\n", - "Patm=90*10**3;#atmospheric pressure in pa\n", - "RHOw=1000;#density of water in kg/m^3\n", - "RHOm=13600;#density of mercury in kg/m^3\n", - "RHOo=850;#density of oil in kg/m^3\n", - "g=9.81;#acceleration due to ggravity in m/s^2\n", - "h1=.15;#height difference between water column in m\n", - "h2=.25;#height difference between oil column in m\n", - "h3=.4;#height difference between mercury column in m\n", - "print\"the pressure of air in air tank can be obtained by equalising pressures at some reference line\"\n", - "print\"P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\"\n", - "print\"so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\"\n", - "P1=(Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2)/1000\n", - "print\"air pressure(P1)in kpa\",round(P1,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.12;page no:26" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.12, Page:26 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\n", - "mass of object(m)in kg\n", - "m=F/g\n", - "kinetic energy(E)in J is given by\n", - "E= 140625000.0\n" - ] - } - ], - "source": [ - "#cal of kinetic energy\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.12, Page:26 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\"\n", - "v=750;#relative velocity of object with respect to earth in m/sec\n", - "F=4000;#gravitational force in N\n", - "g=8;#acceleration due to gravity in m/s^2\n", - "print\"mass of object(m)in kg\"\n", - "print\"m=F/g\"\n", - "m=F/g\n", - "print\"kinetic energy(E)in J is given by\"\n", - "E=m*v**2/2\n", - "print\"E=\",round(E)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.13;page no:26" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.13, Page:26 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\n", - "characteristics gas constant(R2)in kJ/kg k\n", - "molecular weight of gas(m)in kg/kg mol= 16.63\n", - "NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\n" - ] - } - ], - "source": [ - "#cal of molecular weight of gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.13, Page:26 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\"\n", - "Cp=2.286;#specific heat at constant pressure in kJ/kg k\n", - "Cv=1.786;#specific heat at constant volume in kJ/kg k\n", - "R1=8.3143;#universal gas constant in kJ/kg k\n", - "print\"characteristics gas constant(R2)in kJ/kg k\"\n", - "R2=Cp-Cv\n", - "m=R1/R2\n", - "print\"molecular weight of gas(m)in kg/kg mol=\",round(m,2)\n", - "print\"NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.14;page no:26" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.14, Page:26 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\n", - "using perfect gas equation\n", - "P1*V1/T1 = P2*V2/T2\n", - "=>T2=(P2*V2*T1)/(P1*V1)\n", - "so final temperature of gas(T2)in k\n", - "or final temperature of gas(T2)in degree celcius= 127.0\n" - ] - } - ], - "source": [ - "#cal of final temperature of gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.14, Page:26 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\"\n", - "P1=750*10**3;#initial pressure of gas in pa\n", - "V1=0.2;#initial volume of gas in m^3\n", - "T1=600;#initial temperature of gas in k\n", - "P2=2*10**5;#final pressure of gas i pa\n", - "V2=0.5;#final volume of gas in m^3\n", - "print\"using perfect gas equation\"\n", - "print\"P1*V1/T1 = P2*V2/T2\"\n", - "print\"=>T2=(P2*V2*T1)/(P1*V1)\"\n", - "print\"so final temperature of gas(T2)in k\"\n", - "T2=(P2*V2*T1)/(P1*V1)\n", - "T2=T2-273\n", - "print\"or final temperature of gas(T2)in degree celcius=\",round(T2,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.15;page no:27" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.15, Page:27 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\n", - "from perfect gas equation we get\n", - "initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\n", - "m1= 5.807\n", - "final mass of air(m2 in kg)=(P2*V2)/(R*T2)\n", - "m2= 3.111\n", - "mass of air removed(m)in kg 2.696\n", - "volume of this mass of air(V) at initial states in m^3= 2.32\n" - ] - } - ], - "source": [ - "#cal of volume of this mass of air(V) at initial states\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.15, Page:27 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\"\n", - "P1=100*10**3;#initial pressure of air in pa\n", - "V1=5.;#initial volume of air in m^3\n", - "T1=300.;#initial temperature of gas in k\n", - "P2=50*10**3;#final pressure of air in pa\n", - "V2=5.;#final volume of air in m^3\n", - "T2=(280.);#final temperature of air in K\n", - "R=287.;#gas constant on J/kg k\n", - "print\"from perfect gas equation we get\"\n", - "print\"initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\"\n", - "m1=(P1*V1)/(R*T1)\n", - "print(\"m1=\"),round(m1,3)\n", - "print\"final mass of air(m2 in kg)=(P2*V2)/(R*T2)\"\n", - "m2=(P2*V2)/(R*T2)\n", - "print(\"m2=\"),round(m2,3)\n", - "m=m1-m2\n", - "print\"mass of air removed(m)in kg\",round(m,3)\n", - "V=m*R*T1/P1\n", - "print\"volume of this mass of air(V) at initial states in m^3=\",round(V,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.16;page no:27" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.16, Page:27 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\n", - "here V1=V2\n", - "so P1/T1=P2/T2\n", - "final temperature of hydrogen gas(T2)in k\n", - "=>T2=P2*T1/P1\n", - "now R=(Cp-Cv) in KJ/kg k\n", - "And volume of cylinder(V1)in m^3\n", - "V1=(math.pi*d^2*l)/4\n", - "mass of hydrogen gas(m)in kg\n", - "m= 0.254\n", - "now heat supplied(Q)in KJ\n", - "Q= 193.93\n" - ] - } - ], - "source": [ - "#cal of heat supplied\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.16, Page:27 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\"\n", - "d=1;#diameter of cylinder in m\n", - "l=4;#length of cylinder in m\n", - "P1=100*10**3;#initial pressureof hydrogen gas in pa\n", - "T1=(27+273);#initial temperature of hydrogen gas in k\n", - "P2=125*10**3;#final pressureof hydrogen gas in pa\n", - "Cp=14.307;#specific heat at constant pressure in KJ/kg k\n", - "Cv=10.183;#specific heat at constant volume in KJ/kg k\n", - "print\"here V1=V2\"\n", - "print\"so P1/T1=P2/T2\"\n", - "print\"final temperature of hydrogen gas(T2)in k\"\n", - "print\"=>T2=P2*T1/P1\"\n", - "T2=P2*T1/P1\n", - "print\"now R=(Cp-Cv) in KJ/kg k\"\n", - "R=Cp-Cv\n", - "print\"And volume of cylinder(V1)in m^3\"\n", - "print\"V1=(math.pi*d^2*l)/4\"\n", - "V1=(math.pi*d**2*l)/4\n", - "print\"mass of hydrogen gas(m)in kg\"\n", - "m=(P1*V1)/(1000*R*T1)\n", - "print\"m=\",round(m,3)\n", - "print\"now heat supplied(Q)in KJ\"\n", - "Q=m*Cv*(T2-T1)\n", - "print\"Q=\",round(Q,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.17;page no:28" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.17, Page:28 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\n", - "final total volume(V)in m^3\n", - "V=V1*V2\n", - "total mass of air(m)in kg\n", - "m=m1+m2\n", - "final pressure of air(P)in kpa\n", - "using perfect gas equation\n", - "P= 516.6\n" - ] - } - ], - "source": [ - "#cal of final pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.17, Page:28 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\")\n", - "V1=2.;#volume of first cylinder in m^3\n", - "V2=2.;#volume of second cylinder in m^3\n", - "T=(27+273);#temperature of system in k\n", - "m1=20.;#mass of air in first vessel in kg\n", - "m2=4.;#mass of air in second vessel in kg\n", - "R=287.;#gas constant J/kg k\n", - "print(\"final total volume(V)in m^3\")\n", - "print(\"V=V1*V2\")\n", - "V=V1*V2\n", - "print(\"total mass of air(m)in kg\")\n", - "print(\"m=m1+m2\")\n", - "m=m1+m2\n", - "print(\"final pressure of air(P)in kpa\")\n", - "print(\"using perfect gas equation\")\n", - "P=(m*R*T)/(1000*V)\n", - "print\"P=\",round(P,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.18;page no:28" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.18, Page:28 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\n", - "1.By considering it as a PERFECT GAS\n", - "gas constant for CO2(Rco2)\n", - "Rco2=(J/Kg.k) 188.9\n", - "Also P*V=M*Rco2*T\n", - "pressure of CO2 as perfect gas(P)in N/m^2\n", - "P=(m*Rco2*T)/V 141683.71\n", - "2.By considering as a REAL GAS\n", - "values of vanderwaal constants a,b can be seen from the table which are\n", - "a=(N m^4/(kg mol)^2) 362850.0\n", - "b=(m^3/kg mol) 0.03\n", - "now specific volume(v)in m^3/kg mol\n", - "v= 17.604\n", - "now substituting the value of all variables in vanderwaal equation\n", - "(P+(a/v^2))*(v-b)=R*T\n", - "pressure of CO2 as real gas(P)in N/m^2\n", - "P= 140766.02\n" - ] - } - ], - "source": [ - "#cal of pressure of CO2 as perfect,real gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.18, Page:28 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\")\n", - "m=5;#mass of CO2 in kg\n", - "V=2;#volume of vesssel in m^3\n", - "T=(27+273);#temperature of vessel in k\n", - "R=8.314*10**3;#universal gas constant in J/kg k\n", - "M=44.01;#molecular weight of CO2 \n", - "print(\"1.By considering it as a PERFECT GAS\")\n", - "print(\"gas constant for CO2(Rco2)\")\n", - "Rco2=R/M\n", - "print(\"Rco2=(J/Kg.k)\"),round(Rco2,1)\n", - "print(\"Also P*V=M*Rco2*T\")\n", - "print(\"pressure of CO2 as perfect gas(P)in N/m^2\")\n", - "P=(m*Rco2*T)/V\n", - "print(\"P=(m*Rco2*T)/V \"),round(P,2)\n", - "print(\"2.By considering as a REAL GAS\")\n", - "print(\"values of vanderwaal constants a,b can be seen from the table which are\")\n", - "a=3628.5*10**2#vanderwall constant in N m^4/(kg mol)^2\n", - "b=3.14*10**-2# vanderwall constant in m^3/kg mol\n", - "print(\"a=(N m^4/(kg mol)^2) \"),round(a,2)\n", - "print(\"b=(m^3/kg mol)\"),round(b,2)\n", - "print(\"now specific volume(v)in m^3/kg mol\")\n", - "v=V*M/m\n", - "print(\"v=\"),round(v,3)\n", - "print(\"now substituting the value of all variables in vanderwaal equation\")\n", - "print(\"(P+(a/v^2))*(v-b)=R*T\")\n", - "print(\"pressure of CO2 as real gas(P)in N/m^2\")\n", - "P=((R*T)/(v-b))-(a/v**2)\n", - "print(\"P=\"),round(P,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.19;page no:29" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.19, Page:29 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\n", - "1.considering as perfect gas\n", - "specific volume(V)in m^3/kg\n", - "V= 0.0186\n", - "2.considering compressibility effects\n", - "reduced pressure(P)in pa\n", - "p= 0.8\n", - "reduced temperature(t)in k\n", - "t= 1.1\n", - "from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\n", - "we get Z=0.785\n", - "now actual specific volume(v)in m^3/kg\n", - "v= 0.0146\n" - ] - } - ], - "source": [ - "#cal of specific volume of steam\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.19, Page:29 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\")\n", - "P=17672;#pressure of steam on kpa\n", - "T=712;#temperature of steam in k\n", - "Pc=22.09;#critical pressure of steam in Mpa\n", - "Tc=647.3;#critical temperature of steam in k\n", - "R=0.4615;#gas constant for steam in KJ/kg k\n", - "print(\"1.considering as perfect gas\")\n", - "print(\"specific volume(V)in m^3/kg\")\n", - "V=R*T/P\n", - "print(\"V=\"),round(V,4)\n", - "print(\"2.considering compressibility effects\")\n", - "print(\"reduced pressure(P)in pa\")\n", - "p=P/(Pc*1000)\n", - "print(\"p=\"),round(p,2)\n", - "print(\"reduced temperature(t)in k\")\n", - "t=T/Tc\n", - "print(\"t=\"),round(t,2)\n", - "print(\"from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\")\n", - "print(\"we get Z=0.785\")\n", - "Z=0.785;#compressibility factor\n", - "print(\"now actual specific volume(v)in m^3/kg\")\n", - "v=Z*V\n", - "print(\"v=\"),round(v,4)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.20;page no:30" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.20, Page:30 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\n", - "volume of ballon(V1)in m^3\n", - "V1= 65.45\n", - "molecular mass of hydrogen(M)\n", - "M=2\n", - "gas constant for H2(R1)in J/kg k\n", - "R1= 4157.0\n", - "mass of H2 in ballon(m1)in kg\n", - "m1= 5.316\n", - "volume of air printlaced(V2)=volume of ballon(V1)\n", - "mass of air printlaced(m2)in kg\n", - "m2= 79.66\n", - "gas constant for air(R2)=0.287 KJ/kg k\n", - "load lifting capacity due to buoyant force(m)in kg\n", - "m= 74.343\n" - ] - } - ], - "source": [ - "#estimation of maximum load that can be lifted \n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.20, Page:30 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\")\n", - "d=5.;#diameter of ballon in m\n", - "T1=(27.+273.);#temperature of hydrogen in k\n", - "P=1.013*10**5;#atmospheric pressure in pa\n", - "T2=(17.+273.);#temperature of surrounding air in k\n", - "R=8.314*10**3;#gas constant in J/kg k\n", - "print(\"volume of ballon(V1)in m^3\")\n", - "V1=(4./3.)*math.pi*((d/2)**3)\n", - "print(\"V1=\"),round(V1,2)\n", - "print(\"molecular mass of hydrogen(M)\")\n", - "print(\"M=2\")\n", - "M=2;#molecular mass of hydrogen\n", - "print(\"gas constant for H2(R1)in J/kg k\")\n", - "R1=R/M\n", - "print(\"R1=\"),round(R1,2)\n", - "print(\"mass of H2 in ballon(m1)in kg\")\n", - "m1=(P*V1)/(R1*T1)\n", - "print(\"m1=\"),round(m1,3)\n", - "print(\"volume of air printlaced(V2)=volume of ballon(V1)\")\n", - "print(\"mass of air printlaced(m2)in kg\")\n", - "R2=0.287*1000;#gas constant for air in J/kg k\n", - "m2=(P*V1)/(R2*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"gas constant for air(R2)=0.287 KJ/kg k\")\n", - "print(\"load lifting capacity due to buoyant force(m)in kg\")\n", - "m=m2-m1\n", - "print(\"m=\"),round(m,3)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.21;page no:31" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.21, Page:31 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\n", - "let initial receiver pressure(p1)=1 in pa\n", - "so final receiver pressure(p2)=in pa 0.25\n", - "perfect gas equation,p*V*m=m*R*T\n", - "differentiating and then integrating equation w.r.t to time(t) \n", - "we get t=-(V/v)*log(p2/p1)\n", - "so time(t)in min 110.9\n" - ] - } - ], - "source": [ - "#cal of time required\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.21, Page:31 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\")\n", - "v=0.25;#volume sucking rate of pump in m^3/min\n", - "V=20.;#volume of air vessel in m^3\n", - "p1=1.;#initial receiver pressure in pa\n", - "print(\"let initial receiver pressure(p1)=1 in pa\")\n", - "p2=p1/4.\n", - "print(\"so final receiver pressure(p2)=in pa\"),round(p2,2)\n", - "print(\"perfect gas equation,p*V*m=m*R*T\")\n", - "print(\"differentiating and then integrating equation w.r.t to time(t) \")\n", - "print(\"we get t=-(V/v)*log(p2/p1)\")\n", - "t=-(V/v)*math.log(p2/p1)\n", - "print(\"so time(t)in min\"),round(t,2)\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.22;page no:32" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.22, Page:32 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\n", - "first calculate gas constants for different gases in j/kg k\n", - "for nitrogen,R1= 296.9\n", - "for oxygen,R2= 259.8\n", - "for carbon dioxide,R3= 188.95\n", - "so the gas constant for mixture(Rm)in j/kg k\n", - "Rm= 288.09\n", - "now the specific heat at constant pressure for constituent gases in KJ/kg k\n", - "for nitrogen,Cp1= 1.039\n", - "for oxygen,Cp2= 0.909\n", - "for carbon dioxide,Cp3= 0.819\n", - "so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\n", - "Cpm= 1.0115\n", - "now no. of moles of constituents gases\n", - "for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg 0.143\n", - "for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg 0.028\n", - "for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg 0.0023\n", - "total no. of moles in mixture in mol\n", - "n= 0.1733\n", - "now mole fraction of constituent gases\n", - "for nitrogen,x1= 0.825\n", - "for oxygen,x2= 0.162\n", - "for carbon dioxide,x3= 0.0131\n", - "now the molecular weight of mixture(Mm)in kg/kmol\n", - "Mm= 28.86\n" - ] - } - ], - "source": [ - "#cal of specific heat at constant pressure for constituent gases \n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.22, Page:32 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\")\n", - "m=5;#mass of mixture of gas in kg\n", - "P=1.013*10**5;#pressure of mixture in pa\n", - "T=300;#temperature of mixture in k\n", - "M1=28.;#molecular weight of nitrogen(N2)\n", - "M2=32.;#molecular weight of oxygen(O2)\n", - "M3=44.;#molecular weight of carbon dioxide(CO2)\n", - "f1=0.80;#fraction of N2 in mixture\n", - "f2=0.18;#fraction of O2 in mixture\n", - "f3=0.02;#fraction of CO2 in mixture\n", - "k1=1.4;#ratio of specific heat capacities for N2\n", - "k2=1.4;#ratio of specific heat capacities for O2\n", - "k3=1.3;#ratio of specific heat capacities for CO2\n", - "R=8314;#universal gas constant in J/kg k\n", - "print(\"first calculate gas constants for different gases in j/kg k\")\n", - "R1=R/M1\n", - "print(\"for nitrogen,R1=\"),round(R1,1)\n", - "R2=R/M2\n", - "print(\"for oxygen,R2=\"),round(R2,1)\n", - "R3=R/M3\n", - "print(\"for carbon dioxide,R3=\"),round(R3,2)\n", - "print(\"so the gas constant for mixture(Rm)in j/kg k\")\n", - "Rm=f1*R1+f2*R2+f3*R3\n", - "print(\"Rm=\"),round(Rm,2)\n", - "print(\"now the specific heat at constant pressure for constituent gases in KJ/kg k\")\n", - "Cp1=((k1/(k1-1))*R1)/1000\n", - "print(\"for nitrogen,Cp1=\"),round(Cp1,3)\n", - "Cp2=((k2/(k2-1))*R2)/1000\n", - "print(\"for oxygen,Cp2=\"),round(Cp2,3)\n", - "Cp3=((k3/(k3-1))*R3)/1000\n", - "print(\"for carbon dioxide,Cp3=\"),round(Cp3,3)\n", - "print(\"so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\")\n", - "Cpm=f1*Cp1+f2*Cp2+f3*Cp3\n", - "print(\"Cpm=\"),round(Cpm,4)\n", - "print(\"now no. of moles of constituents gases\")\n", - "m1=f1*m\n", - "n1=m1/M1\n", - "print(\"for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg\"),round(n1,3)\n", - "m2=f2*m\n", - "n2=m2/M2\n", - "print(\"for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg\"),round(n2,3)\n", - "m3=f3*m\n", - "n3=m3/M3\n", - "print(\"for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg\"),round(n3,4)\n", - "print(\"total no. of moles in mixture in mol\")\n", - "n=n1+n2+n3\n", - "print(\"n=\"),round(n,4)\n", - "print(\"now mole fraction of constituent gases\")\n", - "x1=n1/n\n", - "print(\"for nitrogen,x1=\"),round(x1,3)\n", - "x2=n2/n\n", - "print(\"for oxygen,x2=\"),round(x2,3)\n", - "x3=n3/n\n", - "print(\"for carbon dioxide,x3=\"),round(x3,4)\n", - "print(\"now the molecular weight of mixture(Mm)in kg/kmol\")\n", - "Mm=M1*x1+M2*x2+M3*x3\n", - "print(\"Mm=\"),round(Mm,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.23;page no:33" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.23, Page:33 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\n", - "mole fraction of constituent gases\n", - "x=(ni/n)=(Vi/V)\n", - "take volume of mixture(V)=1 m^3\n", - "mole fraction of O2(x1)\n", - "x1= 0.18\n", - "mole fraction of N2(x2)\n", - "x2= 0.75\n", - "mole fraction of CO2(x3)\n", - "x3= 0.07\n", - "now molecular weight of mixture = molar mass(m)\n", - "m= 29.84\n", - "now gravimetric analysis refers to the mass fraction analysis\n", - "mass fraction of constituents\n", - "y=xi*Mi/m\n", - "mole fraction of O2\n", - "y1= 0.193\n", - "mole fraction of N2\n", - "y2= 0.704\n", - "mole fraction of CO2\n", - "y3= 0.103\n", - "now partial pressure of constituents = volume fraction * pressure of mixture\n", - "Pi=xi*P\n", - "partial pressure of O2(P1)in Mpa\n", - "P1= 0.09\n", - "partial pressure of N2(P2)in Mpa\n", - "P2= 0.375\n", - "partial pressure of CO2(P3)in Mpa\n", - "P3= 0.04\n", - "NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\n" - ] - } - ], - "source": [ - "#cal of pressure difference\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.23, Page:33 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\")\n", - "V1=0.18;#volume fraction of O2 in m^3\n", - "V2=0.75;#volume fraction of N2 in m^3\n", - "V3=0.07;#volume fraction of CO2 in m^3\n", - "P=0.5;#pressure of mixture in Mpa\n", - "T=(107+273);#temperature of mixture in k\n", - "M1=32;#molar mass of O2\n", - "M2=28;#molar mass of N2\n", - "M3=44;#molar mass of CO2\n", - "print(\"mole fraction of constituent gases\")\n", - "print(\"x=(ni/n)=(Vi/V)\")\n", - "V=1;# volume of mixture in m^3\n", - "print(\"take volume of mixture(V)=1 m^3\")\n", - "print(\"mole fraction of O2(x1)\")\n", - "x1=V1/V\n", - "print(\"x1=\"),round(x1,2)\n", - "print(\"mole fraction of N2(x2)\")\n", - "x2=V2/V\n", - "print(\"x2=\"),round(x2,2)\n", - "print(\"mole fraction of CO2(x3)\")\n", - "x3=V3/V\n", - "print(\"x3=\"),round(x3,2)\n", - "print(\"now molecular weight of mixture = molar mass(m)\")\n", - "m=x1*M1+x2*M2+x3*M3\n", - "print(\"m=\"),round(m,2)\n", - "print(\"now gravimetric analysis refers to the mass fraction analysis\")\n", - "print(\"mass fraction of constituents\")\n", - "print(\"y=xi*Mi/m\")\n", - "print(\"mole fraction of O2\")\n", - "y1=x1*M1/m\n", - "print(\"y1=\"),round(y1,3)\n", - "print(\"mole fraction of N2\")\n", - "y2=x2*M2/m\n", - "print(\"y2=\"),round(y2,3)\n", - "print(\"mole fraction of CO2\")\n", - "y3=x3*M3/m\n", - "print(\"y3=\"),round(y3,3)\n", - "print(\"now partial pressure of constituents = volume fraction * pressure of mixture\")\n", - "print(\"Pi=xi*P\")\n", - "print(\"partial pressure of O2(P1)in Mpa\")\n", - "p1=x1*P\n", - "print(\"P1=\"),round(p1,2)\n", - "print(\"partial pressure of N2(P2)in Mpa\")\n", - "P2=x2*P\n", - "print(\"P2=\"),round(P2,3)\n", - "P3=x3*P\n", - "print(\"partial pressure of CO2(P3)in Mpa\")\n", - "print(\"P3=\"),round(P3,2)\n", - "print(\"NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.24;page no:34" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.24, Page:34 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\n", - "volume of tank of N2(V1) in m^3= 3.0\n", - "volume of tank of CO2(V2) in m^3= 3.0\n", - "taking the adiabatic condition\n", - "no. of moles of N2(n1)\n", - "n1= 0.6\n", - "no. of moles of CO2(n2)\n", - "n2= 0.37\n", - "total no. of moles of mixture(n)in mol\n", - "n= 0.97\n", - "gas constant for N2(R1)in J/kg k\n", - "R1= 296.93\n", - "gas constant for CO2(R2)in J/kg k\n", - "R2=R/M2 188.95\n", - "specific heat of N2 at constant volume (Cv1) in J/kg k\n", - "Cv1= 742.32\n", - "specific heat of CO2 at constant volume (Cv2) in J/kg k\n", - "Cv2= 629.85\n", - "mass of N2(m1)in kg\n", - "m1= 16.84\n", - "mass of CO2(m2)in kg\n", - "m2= 16.28\n", - "let us consider the equilibrium temperature of mixture after adiabatic mixing at T\n", - "applying energy conservation principle\n", - "m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\n", - "equlibrium temperature(T)in k\n", - "=>T= 439.44\n", - "so the equlibrium pressure(P)in kpa\n", - "P= 591.55\n" - ] - } - ], - "source": [ - "#cal of equilibrium temperature,pressure of mixture\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.24, Page:34 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\")\n", - "V=6;#volume of tank in m^3\n", - "P1=800*10**3;#pressure of N2 gas tank in pa\n", - "T1=480.;#temperature of N2 gas tank in k\n", - "P2=400*10**3;#pressure of CO2 gas tank in pa\n", - "T2=390.;#temperature of CO2 gas tank in k\n", - "k1=1.4;#ratio of specific heat capacity for N2\n", - "k2=1.3;#ratio of specific heat capacity for CO2\n", - "R=8314.;#universal gas constant in J/kg k\n", - "M1=28.;#molecular weight of N2\n", - "M2=44.;#molecular weight of CO2\n", - "V1=V/2\n", - "print(\"volume of tank of N2(V1) in m^3=\"),round(V1,2)\n", - "V2=V/2\n", - "print(\"volume of tank of CO2(V2) in m^3=\"),round(V2,2)\n", - "print(\"taking the adiabatic condition\")\n", - "print(\"no. of moles of N2(n1)\")\n", - "n1=(P1*V1)/(R*T1)\n", - "print(\"n1=\"),round(n1,2)\n", - "print(\"no. of moles of CO2(n2)\")\n", - "n2=(P2*V2)/(R*T2)\n", - "print(\"n2=\"),round(n2,2)\n", - "print(\"total no. of moles of mixture(n)in mol\")\n", - "n=n1+n2\n", - "print(\"n=\"),round(n,2)\n", - "print(\"gas constant for N2(R1)in J/kg k\")\n", - "R1=R/M1\n", - "print(\"R1=\"),round(R1,2)\n", - "print(\"gas constant for CO2(R2)in J/kg k\")\n", - "R2=R/M2\n", - "print(\"R2=R/M2\"),round(R2,2)\n", - "print(\"specific heat of N2 at constant volume (Cv1) in J/kg k\")\n", - "Cv1=R1/(k1-1)\n", - "print(\"Cv1=\"),round(Cv1,2)\n", - "print(\"specific heat of CO2 at constant volume (Cv2) in J/kg k\")\n", - "Cv2=R2/(k2-1)\n", - "print(\"Cv2=\"),round(Cv2,2)\n", - "print(\"mass of N2(m1)in kg\")\n", - "m1=n1*M1\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"mass of CO2(m2)in kg\")\n", - "m2=n2*M2\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"let us consider the equilibrium temperature of mixture after adiabatic mixing at T\")\n", - "print(\"applying energy conservation principle\")\n", - "print(\"m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\")\n", - "print(\"equlibrium temperature(T)in k\")\n", - "T=((m1*Cv1*T1)+(m2*Cv2*T2))/((m1*Cv1)+(m2*Cv2))\n", - "print(\"=>T=\"),round(T,2)\n", - "print(\"so the equlibrium pressure(P)in kpa\")\n", - "P=(n*R*T)/(1000*V)\n", - "print(\"P=\"),round(P,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.25;page no:35" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.25, Page:35 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\n", - "since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\n", - "so the specific heat at constant pressure(Cp)in KJ/kg k\n", - "Cp= 7.608\n" - ] - } - ], - "source": [ - "#cal of specific heat of final mixture\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.25, Page:35 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\")\n", - "m1=2;#mass of H2 in kg\n", - "m2=3;#mass of He in kg\n", - "T=100;#temperature of container in k\n", - "Cp1=11.23;#specific heat at constant pressure for H2 in KJ/kg k\n", - "Cp2=5.193;#specific heat at constant pressure for He in KJ/kg k\n", - "print(\"since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\")\n", - "print(\"so the specific heat at constant pressure(Cp)in KJ/kg k\")\n", - "Cp=((Cp1*m1)+Cp2*m2)/(m1+m2)\n", - "print(\"Cp=\"),round(Cp,3)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.26;page no:35" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.26, Page:35 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\n", - "gas constant for H2(R1)in KJ/kg k\n", - "R1= 4.157\n", - "gas constant for N2(R2)in KJ/kg k\n", - "R2= 0.297\n", - "gas constant for CO2(R3)in KJ/kg k\n", - "R3= 0.189\n", - "so now gas constant for mixture(Rm)in KJ/kg k\n", - "Rm= 2.606\n", - "considering gas to be perfect gas\n", - "total mass of mixture(m)in kg\n", - "m= 30.0\n", - "capacity of vessel(V)in m^3\n", - "V= 231.57\n", - "now final temperature(Tf) is twice of initial temperature(Ti)\n", - "so take k=Tf/Ti=2\n", - "for constant volume heating,final pressure(Pf)in kpa shall be\n", - "Pf= 202.65\n" - ] - } - ], - "source": [ - "#cal of capacity and pressure in the vessel\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.26, Page:35 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\")\n", - "m1=18.;#mass of hydrogen(H2) in kg\n", - "m2=10.;#mass of nitrogen(N2) in kg\n", - "m3=2.;#mass of carbon dioxide(CO2) in kg\n", - "R=8.314;#universal gas constant in KJ/kg k\n", - "Pi=101.325;#atmospheric pressure in kpa\n", - "T=(27+273.15);#ambient temperature in k\n", - "M1=2;#molar mass of H2\n", - "M2=28;#molar mass of N2\n", - "M3=44;#molar mass of CO2\n", - "print(\"gas constant for H2(R1)in KJ/kg k\")\n", - "R1=R/M1\n", - "print(\"R1=\"),round(R1,3)\n", - "print(\"gas constant for N2(R2)in KJ/kg k\")\n", - "R2=R/M2\n", - "print(\"R2=\"),round(R2,3)\n", - "print(\"gas constant for CO2(R3)in KJ/kg k\")\n", - "R3=R/M3\n", - "print(\"R3=\"),round(R3,3)\n", - "print(\"so now gas constant for mixture(Rm)in KJ/kg k\")\n", - "Rm=(m1*R1+m2*R2+m3*R3)/(m1+m2+m3)\n", - "print(\"Rm=\"),round(Rm,3)\n", - "print(\"considering gas to be perfect gas\")\n", - "print(\"total mass of mixture(m)in kg\")\n", - "m=m1+m2+m3\n", - "print(\"m=\"),round(m,2)\n", - "print(\"capacity of vessel(V)in m^3\")\n", - "V=(m*Rm*T)/Pi\n", - "print(\"V=\"),round(V,2)\n", - "print(\"now final temperature(Tf) is twice of initial temperature(Ti)\")\n", - "k=2;#ratio of initial to final temperature\n", - "print(\"so take k=Tf/Ti=2\") \n", - "print(\"for constant volume heating,final pressure(Pf)in kpa shall be\")\n", - "Pf=Pi*k\n", - "print(\"Pf=\"),round(Pf,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.27;page no:36" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.27, Page:36 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\n", - "let inlet state be 1 and exit state be 2\n", - "by charles law volume and temperature can be related as\n", - "(V1/T1)=(V2/T2)\n", - "(V2/V1)=(T2/T1)\n", - "or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\n", - "since change in K.E=0\n", - "so (D2^2/D1^2)=T2/T1\n", - "D2/D1=sqrt(T2/T1)\n", - "say(D2/D1)=k\n", - "so exit to inlet diameter ratio(k) 1.29\n" - ] - } - ], - "source": [ - "#cal of exit to inlet diameter ratio\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.27, Page:36 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\")\n", - "T1=(27.+273.);#initial temperature of air in k\n", - "T2=500.;#final temperature of air in k\n", - "print(\"let inlet state be 1 and exit state be 2\")\n", - "print(\"by charles law volume and temperature can be related as\")\n", - "print(\"(V1/T1)=(V2/T2)\")\n", - "print(\"(V2/V1)=(T2/T1)\")\n", - "print(\"or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\")\n", - "print(\"since change in K.E=0\")\n", - "print(\"so (D2^2/D1^2)=T2/T1\")\n", - "print(\"D2/D1=sqrt(T2/T1)\")\n", - "print(\"say(D2/D1)=k\")\n", - "k=math.sqrt(T2/T1)\n", - "print(\"so exit to inlet diameter ratio(k)\"),round(k,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.28;page no:37" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.28, Page:37 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\n", - "gas constant for H2(R1)in KJ/kg k\n", - "R1= 4.157\n", - "say initial and final ststes are given by 1 and 2\n", - "mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\n", - "final pressure of hydrogen(P2)in cm of Hg\n", - "P2= 6.0\n", - "therefore pressure difference(P)in kpa\n", - "P= 93.33\n", - "mass pumped out(m)in kg\n", - "m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\n", - "here V1=V2=V and T1=T2=T\n", - "so m= 0.15\n", - "now during cooling upto 10 degree celcius,the process may be consider as constant volume process\n", - "say state before and after cooling are denoted by suffix 2 and 3\n", - "final pressure after cooling(P3)in kpa\n", - "P3= 7.546\n" - ] - } - ], - "source": [ - "#cal of final pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.28, Page:37 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\")\n", - "V=2;#volume of vessel in m^3\n", - "P1=76;#initial pressure or atmospheric pressure in cm of Hg\n", - "T=(27+273.15);#temperature of vessel in k\n", - "p=70;#final pressure in cm of Hg vaccum\n", - "R=8.314;#universal gas constant in KJ/kg k\n", - "M=2;#molecular weight of H2\n", - "print(\"gas constant for H2(R1)in KJ/kg k\")\n", - "R1=R/M\n", - "print(\"R1=\"),round(R1,3)\n", - "print(\"say initial and final ststes are given by 1 and 2\")\n", - "print(\"mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\")\n", - "print(\"final pressure of hydrogen(P2)in cm of Hg\")\n", - "P2=P1-p\n", - "print(\"P2=\"),round(P2,2)\n", - "print(\"therefore pressure difference(P)in kpa\")\n", - "P=((P1-P2)*101.325)/76\n", - "print(\"P=\"),round(P,2)\n", - "print(\"mass pumped out(m)in kg\")\n", - "print(\"m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\")\n", - "print(\"here V1=V2=V and T1=T2=T\")\n", - "m=(V*P)/(R1*T)\n", - "print(\"so m=\"),round(m,2)\n", - "print(\"now during cooling upto 10 degree celcius,the process may be consider as constant volume process\")\n", - "print(\"say state before and after cooling are denoted by suffix 2 and 3\")\n", - "T3=(10+273.15);#final temperature after cooling in k\n", - "print(\"final pressure after cooling(P3)in kpa\")\n", - "P3=(T3/T)*P2*(101.325/76)\n", - "print(\"P3=\"),round(P3,3)\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter_1_1.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter_1_1.ipynb deleted file mode 100755 index 9474d100..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter_1_1.ipynb +++ /dev/null @@ -1,1777 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# chapter 1:Fundemental concepts and definitions" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.1;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.1, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\n", - "pressure difference(p)in pa\n", - "p= 39755.7\n" - ] - } - ], - "source": [ - "#cal of pressure difference\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.1, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\"\n", - "h=30*10**-2;#manometer deflection of mercury in m\n", - "g=9.78;#acceleration due to gravity in m/s^2\n", - "rho=13550;#density of mercury at room temperature in kg/m^3\n", - "print\"pressure difference(p)in pa\"\n", - "p=rho*g*h\n", - "print\"p=\",round(p,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.2;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.2, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\n", - "effort required for lifting the lid(E)in N\n", - "E= 7115.48\n" - ] - } - ], - "source": [ - "#cal of effort required for lifting the lid\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.2, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\"\n", - "d=30*10**-2;#diameter of cylindrical vessel in m\n", - "h=76*10**-2;#atmospheric pressure in m of mercury\n", - "g=9.78;#acceleration due to gravity in m/s^2\n", - "rho=13550;#density of mercury at room temperature in kg/m^3\n", - "print\"effort required for lifting the lid(E)in N\"\n", - "E=(rho*g*h)*(3.14*d**2)/4\n", - "print\"E=\",round(E,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.3;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.3, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\n", - "pressure measured by manometer is gauge pressure(Pg)in kpa\n", - "Pg=rho*g*h/10^3\n", - "actual pressure of the air(P)in kpa\n", - "P= 140.76\n" - ] - } - ], - "source": [ - "#cal of actual pressure of the air\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.3, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\"\n", - "h=30*10**-2;# pressure of compressed air in m of mercury\n", - "Patm=101*10**3;#atmospheric pressure in pa\n", - "g=9.78;#acceleration due to gravity in m/s^2\n", - "rho=13550;#density of mercury at room temperature in kg/m^3\n", - "print\"pressure measured by manometer is gauge pressure(Pg)in kpa\"\n", - "print\"Pg=rho*g*h/10^3\"\n", - "Pg=rho*g*h/10**3\n", - "print\"actual pressure of the air(P)in kpa\"\n", - "P=Pg+Patm/10**3\n", - "print\"P=\",round(P,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.4;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.4, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\n", - "density of oil(RHOoil)in kg/m^3\n", - "RHOoil=sg*RHOw\n", - "gauge pressure(Pg)in kpa\n", - "Pg= 7.848\n" - ] - } - ], - "source": [ - "#cal of gauge pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.4, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\"\n", - "h=1;#depth of oil tank in m\n", - "sg=0.8;#specific gravity of oil\n", - "RHOw=1000;#density of water in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print\"density of oil(RHOoil)in kg/m^3\"\n", - "print\"RHOoil=sg*RHOw\"\n", - "RHOoil=sg*RHOw\n", - "print\"gauge pressure(Pg)in kpa\"\n", - "Pg=RHOoil*g*h/10**3\n", - "print\"Pg=\",round(Pg,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.5;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.5, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\n", - "atmospheric pressure(Patm)in kpa\n", - "Patm=rho*g*h2/10^3\n", - "pressure due to mercury column at AB(Pab)in kpa\n", - "Pab=rho*g*h1/10^3\n", - "pressure exerted by gas(Pgas)in kpa\n", - "Pgas= 154.76\n" - ] - } - ], - "source": [ - "#cal of pressure exerted by gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.5, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\"\n", - "rho=13.6*10**3;#density of mercury in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "h1=40*10**-2;#difference of height in mercury column in m as shown in figure\n", - "h2=76*10**-2;#barometer reading of mercury in m\n", - "print\"atmospheric pressure(Patm)in kpa\"\n", - "print\"Patm=rho*g*h2/10^3\"\n", - "Patm=rho*g*h2/10**3\n", - "print\"pressure due to mercury column at AB(Pab)in kpa\"\n", - "print\"Pab=rho*g*h1/10^3\"\n", - "Pab=rho*g*h1/10**3\n", - "print\"pressure exerted by gas(Pgas)in kpa\"\n", - "Pgas=Patm+Pab\n", - "print\"Pgas=\",round(Pgas,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.6;page no:23" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.6, Page:23 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\n", - "by law of conservation of energy\n", - "potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\n", - "so m*g*h = m*Cp*deltaT*4.18*1000\n", - "change in temperature of water(deltaT) in degree celcius\n", - "deltaT= 2.35\n" - ] - } - ], - "source": [ - "#cal of change in temperature of water\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.6, Page:23 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\"\n", - "m=1;#mass of water in kg\n", - "h=1000;#height from which water fall in m\n", - "Cp=1;#specific heat of water in kcal/kg k\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print\"by law of conservation of energy\"\n", - "print\"potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\"\n", - "print\"so m*g*h = m*Cp*deltaT*4.18*1000\"\n", - "print\"change in temperature of water(deltaT) in degree celcius\"\n", - "deltaT=(g*h)/(4.18*1000*Cp)\n", - "print\"deltaT=\",round(deltaT,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.7;page no:23" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.7, Page:23 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\n", - "mass of object(m)in kg\n", - "m=w1/g1\n", - "spring balance reading=gravitational force in mass(F)in N\n", - "F= 86.65\n" - ] - } - ], - "source": [ - "#cal of spring balance reading\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.7, Page:23 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\"\n", - "w1=100;#weight of object at standard gravitational acceleration in N\n", - "g1=9.81;#acceleration due to gravity in m/s^2\n", - "g2=8.5;#gravitational acceleration at some location\n", - "print\"mass of object(m)in kg\"\n", - "print\"m=w1/g1\"\n", - "m=w1/g1\n", - "print\"spring balance reading=gravitational force in mass(F)in N\"\n", - "F=m*g2\n", - "print\"F=\",round(F,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.8;page no:24" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.8, Page:24 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\n", - "pressure measured by manometer(P) in pa\n", - "p=rho*g*h\n", - "now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\n", - "mass of piston(m)in kg\n", - "so m= 28.84\n" - ] - } - ], - "source": [ - "#cal of mass of piston\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.8, Page:24 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\"\n", - "d=15*10**-2;#diameter of cylinder in m\n", - "h=12*10**-2;#manometer height difference in m of mercury\n", - "rho=13.6*10**3;#density of mercury in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print\"pressure measured by manometer(P) in pa\"\n", - "print\"p=rho*g*h\"\n", - "p=rho*g*h\n", - "print\"now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\"\n", - "print\"mass of piston(m)in kg\"\n", - "m=(p*math.pi*d**2)/(4*g)\n", - "print\"so m=\",round(m,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.9;page no:24" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.9, Page:24 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\n", - "balancing pressure at plane BC in figure we get\n", - "Psteam+Pwater=Patm+Pmercury\n", - "now 1.atmospheric pressure(Patm)in pa\n", - "Patm= 101396.16\n", - "2.pressure due to water(Pwater)in pa\n", - "Pwater= 196.2\n", - "3.pressure due to mercury(Pmercury)in pa\n", - "Pmercury=RHOm*g*h3 13341.6\n", - "using balancing equation\n", - "Psteam=Patm+Pmercury-Pwater\n", - "so pressure of steam(Psteam)in kpa\n", - "Psteam= 114.54\n" - ] - } - ], - "source": [ - "#cal of pressure due to atmosphere,water,mercury,steam\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.9, Page:24 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\")\n", - "RHOm=13.6*10**3;#density of mercury in kg/m^3\n", - "RHOw=1000;#density of water in kg/m^3\n", - "h1=76*10**-2;#barometer reading in m of mercury\n", - "h2=2*10**-2;#height raised by water in manometer tube in m \n", - "h3=10*10**-2;#height raised by mercury in manometer tube in m \n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"balancing pressure at plane BC in figure we get\")\n", - "print(\"Psteam+Pwater=Patm+Pmercury\")\n", - "print(\"now 1.atmospheric pressure(Patm)in pa\")\n", - "Patm=RHOm*g*h1\n", - "print(\"Patm=\"),round(Patm,2)\n", - "print(\"2.pressure due to water(Pwater)in pa\")\n", - "Pwater=RHOw*g*h2\n", - "print(\"Pwater=\"),round(Pwater,2)\n", - "print(\"3.pressure due to mercury(Pmercury)in pa\")\n", - "Pmercury=RHOm*g*h3\n", - "print(\"Pmercury=RHOm*g*h3\"),round(Pmercury,2)\n", - "print(\"using balancing equation\")\n", - "print(\"Psteam=Patm+Pmercury-Pwater\")\n", - "print(\"so pressure of steam(Psteam)in kpa\")\n", - "Psteam=(Patm+Pmercury-Pwater)/1000\n", - "print(\"Psteam=\"),round(Psteam,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.10;page no:24" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.10, Page:24 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\n", - "atmospheric pressure(Patm)in kpa\n", - "absolute temperature in compartment A(Pa) in kpa\n", - "Pa= 496.06\n", - "absolute temperature in compartment B(Pb) in kpa\n", - "Pb= 246.06\n", - "absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\n" - ] - } - ], - "source": [ - "#cal of \"absolute temperature in compartment A,B\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.10, Page:24 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\")\n", - "h=720*10**-3;#barometer reading in m of Hg\n", - "Pga=400;#gauge pressure in compartment A in kpa\n", - "Pgb=150;#gauge pressure in compartment B in kpa\n", - "rho=13.6*10**3;#density of mercury in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"atmospheric pressure(Patm)in kpa\")\n", - "Patm=(rho*g*h)/1000\n", - "print(\"absolute temperature in compartment A(Pa) in kpa\")\n", - "Pa=Pga+Patm\n", - "print\"Pa=\",round(Pa,2)\n", - "print\"absolute temperature in compartment B(Pb) in kpa\"\n", - "Pb=Pgb+Patm\n", - "print\"Pb=\",round(Pb,2)\n", - "print\"absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.11;page no:25" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.11, Page:25 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\n", - "the pressure of air in air tank can be obtained by equalising pressures at some reference line\n", - "P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\n", - "so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\n", - "air pressure(P1)in kpa 139.81\n" - ] - } - ], - "source": [ - "#cal of air pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.11, Page:25 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\")\n", - "Patm=90*10**3;#atmospheric pressure in pa\n", - "RHOw=1000;#density of water in kg/m^3\n", - "RHOm=13600;#density of mercury in kg/m^3\n", - "RHOo=850;#density of oil in kg/m^3\n", - "g=9.81;#acceleration due to ggravity in m/s^2\n", - "h1=.15;#height difference between water column in m\n", - "h2=.25;#height difference between oil column in m\n", - "h3=.4;#height difference between mercury column in m\n", - "print\"the pressure of air in air tank can be obtained by equalising pressures at some reference line\"\n", - "print\"P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\"\n", - "print\"so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\"\n", - "P1=(Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2)/1000\n", - "print\"air pressure(P1)in kpa\",round(P1,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.12;page no:26" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.12, Page:26 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\n", - "mass of object(m)in kg\n", - "m=F/g\n", - "kinetic energy(E)in J is given by\n", - "E= 140625000.0\n" - ] - } - ], - "source": [ - "#cal of kinetic energy\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.12, Page:26 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\"\n", - "v=750;#relative velocity of object with respect to earth in m/sec\n", - "F=4000;#gravitational force in N\n", - "g=8;#acceleration due to gravity in m/s^2\n", - "print\"mass of object(m)in kg\"\n", - "print\"m=F/g\"\n", - "m=F/g\n", - "print\"kinetic energy(E)in J is given by\"\n", - "E=m*v**2/2\n", - "print\"E=\",round(E)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.13;page no:26" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.13, Page:26 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\n", - "characteristics gas constant(R2)in kJ/kg k\n", - "molecular weight of gas(m)in kg/kg mol= 16.63\n", - "NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\n" - ] - } - ], - "source": [ - "#cal of molecular weight of gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.13, Page:26 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\"\n", - "Cp=2.286;#specific heat at constant pressure in kJ/kg k\n", - "Cv=1.786;#specific heat at constant volume in kJ/kg k\n", - "R1=8.3143;#universal gas constant in kJ/kg k\n", - "print\"characteristics gas constant(R2)in kJ/kg k\"\n", - "R2=Cp-Cv\n", - "m=R1/R2\n", - "print\"molecular weight of gas(m)in kg/kg mol=\",round(m,2)\n", - "print\"NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.14;page no:26" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.14, Page:26 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\n", - "using perfect gas equation\n", - "P1*V1/T1 = P2*V2/T2\n", - "=>T2=(P2*V2*T1)/(P1*V1)\n", - "so final temperature of gas(T2)in k\n", - "or final temperature of gas(T2)in degree celcius= 127.0\n" - ] - } - ], - "source": [ - "#cal of final temperature of gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.14, Page:26 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\"\n", - "P1=750*10**3;#initial pressure of gas in pa\n", - "V1=0.2;#initial volume of gas in m^3\n", - "T1=600;#initial temperature of gas in k\n", - "P2=2*10**5;#final pressure of gas i pa\n", - "V2=0.5;#final volume of gas in m^3\n", - "print\"using perfect gas equation\"\n", - "print\"P1*V1/T1 = P2*V2/T2\"\n", - "print\"=>T2=(P2*V2*T1)/(P1*V1)\"\n", - "print\"so final temperature of gas(T2)in k\"\n", - "T2=(P2*V2*T1)/(P1*V1)\n", - "T2=T2-273\n", - "print\"or final temperature of gas(T2)in degree celcius=\",round(T2,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.15;page no:27" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.15, Page:27 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\n", - "from perfect gas equation we get\n", - "initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\n", - "m1= 5.807\n", - "final mass of air(m2 in kg)=(P2*V2)/(R*T2)\n", - "m2= 3.111\n", - "mass of air removed(m)in kg 2.696\n", - "volume of this mass of air(V) at initial states in m^3= 2.32\n" - ] - } - ], - "source": [ - "#cal of volume of this mass of air(V) at initial states\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.15, Page:27 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\"\n", - "P1=100*10**3;#initial pressure of air in pa\n", - "V1=5.;#initial volume of air in m^3\n", - "T1=300.;#initial temperature of gas in k\n", - "P2=50*10**3;#final pressure of air in pa\n", - "V2=5.;#final volume of air in m^3\n", - "T2=(280.);#final temperature of air in K\n", - "R=287.;#gas constant on J/kg k\n", - "print\"from perfect gas equation we get\"\n", - "print\"initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\"\n", - "m1=(P1*V1)/(R*T1)\n", - "print(\"m1=\"),round(m1,3)\n", - "print\"final mass of air(m2 in kg)=(P2*V2)/(R*T2)\"\n", - "m2=(P2*V2)/(R*T2)\n", - "print(\"m2=\"),round(m2,3)\n", - "m=m1-m2\n", - "print\"mass of air removed(m)in kg\",round(m,3)\n", - "V=m*R*T1/P1\n", - "print\"volume of this mass of air(V) at initial states in m^3=\",round(V,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.16;page no:27" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.16, Page:27 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\n", - "here V1=V2\n", - "so P1/T1=P2/T2\n", - "final temperature of hydrogen gas(T2)in k\n", - "=>T2=P2*T1/P1\n", - "now R=(Cp-Cv) in KJ/kg k\n", - "And volume of cylinder(V1)in m^3\n", - "V1=(math.pi*d^2*l)/4\n", - "mass of hydrogen gas(m)in kg\n", - "m= 0.254\n", - "now heat supplied(Q)in KJ\n", - "Q= 193.93\n" - ] - } - ], - "source": [ - "#cal of heat supplied\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.16, Page:27 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\"\n", - "d=1;#diameter of cylinder in m\n", - "l=4;#length of cylinder in m\n", - "P1=100*10**3;#initial pressureof hydrogen gas in pa\n", - "T1=(27+273);#initial temperature of hydrogen gas in k\n", - "P2=125*10**3;#final pressureof hydrogen gas in pa\n", - "Cp=14.307;#specific heat at constant pressure in KJ/kg k\n", - "Cv=10.183;#specific heat at constant volume in KJ/kg k\n", - "print\"here V1=V2\"\n", - "print\"so P1/T1=P2/T2\"\n", - "print\"final temperature of hydrogen gas(T2)in k\"\n", - "print\"=>T2=P2*T1/P1\"\n", - "T2=P2*T1/P1\n", - "print\"now R=(Cp-Cv) in KJ/kg k\"\n", - "R=Cp-Cv\n", - "print\"And volume of cylinder(V1)in m^3\"\n", - "print\"V1=(math.pi*d^2*l)/4\"\n", - "V1=(math.pi*d**2*l)/4\n", - "print\"mass of hydrogen gas(m)in kg\"\n", - "m=(P1*V1)/(1000*R*T1)\n", - "print\"m=\",round(m,3)\n", - "print\"now heat supplied(Q)in KJ\"\n", - "Q=m*Cv*(T2-T1)\n", - "print\"Q=\",round(Q,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.17;page no:28" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.17, Page:28 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\n", - "final total volume(V)in m^3\n", - "V=V1*V2\n", - "total mass of air(m)in kg\n", - "m=m1+m2\n", - "final pressure of air(P)in kpa\n", - "using perfect gas equation\n", - "P= 516.6\n" - ] - } - ], - "source": [ - "#cal of final pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.17, Page:28 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\")\n", - "V1=2.;#volume of first cylinder in m^3\n", - "V2=2.;#volume of second cylinder in m^3\n", - "T=(27+273);#temperature of system in k\n", - "m1=20.;#mass of air in first vessel in kg\n", - "m2=4.;#mass of air in second vessel in kg\n", - "R=287.;#gas constant J/kg k\n", - "print(\"final total volume(V)in m^3\")\n", - "print(\"V=V1*V2\")\n", - "V=V1*V2\n", - "print(\"total mass of air(m)in kg\")\n", - "print(\"m=m1+m2\")\n", - "m=m1+m2\n", - "print(\"final pressure of air(P)in kpa\")\n", - "print(\"using perfect gas equation\")\n", - "P=(m*R*T)/(1000*V)\n", - "print\"P=\",round(P,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.18;page no:28" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.18, Page:28 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\n", - "1.By considering it as a PERFECT GAS\n", - "gas constant for CO2(Rco2)\n", - "Rco2=(J/Kg.k) 188.9\n", - "Also P*V=M*Rco2*T\n", - "pressure of CO2 as perfect gas(P)in N/m^2\n", - "P=(m*Rco2*T)/V 141683.71\n", - "2.By considering as a REAL GAS\n", - "values of vanderwaal constants a,b can be seen from the table which are\n", - "a=(N m^4/(kg mol)^2) 362850.0\n", - "b=(m^3/kg mol) 0.03\n", - "now specific volume(v)in m^3/kg mol\n", - "v= 17.604\n", - "now substituting the value of all variables in vanderwaal equation\n", - "(P+(a/v^2))*(v-b)=R*T\n", - "pressure of CO2 as real gas(P)in N/m^2\n", - "P= 140766.02\n" - ] - } - ], - "source": [ - "#cal of pressure of CO2 as perfect,real gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.18, Page:28 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\")\n", - "m=5;#mass of CO2 in kg\n", - "V=2;#volume of vesssel in m^3\n", - "T=(27+273);#temperature of vessel in k\n", - "R=8.314*10**3;#universal gas constant in J/kg k\n", - "M=44.01;#molecular weight of CO2 \n", - "print(\"1.By considering it as a PERFECT GAS\")\n", - "print(\"gas constant for CO2(Rco2)\")\n", - "Rco2=R/M\n", - "print(\"Rco2=(J/Kg.k)\"),round(Rco2,1)\n", - "print(\"Also P*V=M*Rco2*T\")\n", - "print(\"pressure of CO2 as perfect gas(P)in N/m^2\")\n", - "P=(m*Rco2*T)/V\n", - "print(\"P=(m*Rco2*T)/V \"),round(P,2)\n", - "print(\"2.By considering as a REAL GAS\")\n", - "print(\"values of vanderwaal constants a,b can be seen from the table which are\")\n", - "a=3628.5*10**2#vanderwall constant in N m^4/(kg mol)^2\n", - "b=3.14*10**-2# vanderwall constant in m^3/kg mol\n", - "print(\"a=(N m^4/(kg mol)^2) \"),round(a,2)\n", - "print(\"b=(m^3/kg mol)\"),round(b,2)\n", - "print(\"now specific volume(v)in m^3/kg mol\")\n", - "v=V*M/m\n", - "print(\"v=\"),round(v,3)\n", - "print(\"now substituting the value of all variables in vanderwaal equation\")\n", - "print(\"(P+(a/v^2))*(v-b)=R*T\")\n", - "print(\"pressure of CO2 as real gas(P)in N/m^2\")\n", - "P=((R*T)/(v-b))-(a/v**2)\n", - "print(\"P=\"),round(P,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.19;page no:29" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.19, Page:29 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\n", - "1.considering as perfect gas\n", - "specific volume(V)in m^3/kg\n", - "V= 0.0186\n", - "2.considering compressibility effects\n", - "reduced pressure(P)in pa\n", - "p= 0.8\n", - "reduced temperature(t)in k\n", - "t= 1.1\n", - "from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\n", - "we get Z=0.785\n", - "now actual specific volume(v)in m^3/kg\n", - "v= 0.0146\n" - ] - } - ], - "source": [ - "#cal of specific volume of steam\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.19, Page:29 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\")\n", - "P=17672;#pressure of steam on kpa\n", - "T=712;#temperature of steam in k\n", - "Pc=22.09;#critical pressure of steam in Mpa\n", - "Tc=647.3;#critical temperature of steam in k\n", - "R=0.4615;#gas constant for steam in KJ/kg k\n", - "print(\"1.considering as perfect gas\")\n", - "print(\"specific volume(V)in m^3/kg\")\n", - "V=R*T/P\n", - "print(\"V=\"),round(V,4)\n", - "print(\"2.considering compressibility effects\")\n", - "print(\"reduced pressure(P)in pa\")\n", - "p=P/(Pc*1000)\n", - "print(\"p=\"),round(p,2)\n", - "print(\"reduced temperature(t)in k\")\n", - "t=T/Tc\n", - "print(\"t=\"),round(t,2)\n", - "print(\"from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\")\n", - "print(\"we get Z=0.785\")\n", - "Z=0.785;#compressibility factor\n", - "print(\"now actual specific volume(v)in m^3/kg\")\n", - "v=Z*V\n", - "print(\"v=\"),round(v,4)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.20;page no:30" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.20, Page:30 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\n", - "volume of ballon(V1)in m^3\n", - "V1= 65.45\n", - "molecular mass of hydrogen(M)\n", - "M=2\n", - "gas constant for H2(R1)in J/kg k\n", - "R1= 4157.0\n", - "mass of H2 in ballon(m1)in kg\n", - "m1= 5.316\n", - "volume of air printlaced(V2)=volume of ballon(V1)\n", - "mass of air printlaced(m2)in kg\n", - "m2= 79.66\n", - "gas constant for air(R2)=0.287 KJ/kg k\n", - "load lifting capacity due to buoyant force(m)in kg\n", - "m= 74.343\n" - ] - } - ], - "source": [ - "#estimation of maximum load that can be lifted \n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.20, Page:30 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\")\n", - "d=5.;#diameter of ballon in m\n", - "T1=(27.+273.);#temperature of hydrogen in k\n", - "P=1.013*10**5;#atmospheric pressure in pa\n", - "T2=(17.+273.);#temperature of surrounding air in k\n", - "R=8.314*10**3;#gas constant in J/kg k\n", - "print(\"volume of ballon(V1)in m^3\")\n", - "V1=(4./3.)*math.pi*((d/2)**3)\n", - "print(\"V1=\"),round(V1,2)\n", - "print(\"molecular mass of hydrogen(M)\")\n", - "print(\"M=2\")\n", - "M=2;#molecular mass of hydrogen\n", - "print(\"gas constant for H2(R1)in J/kg k\")\n", - "R1=R/M\n", - "print(\"R1=\"),round(R1,2)\n", - "print(\"mass of H2 in ballon(m1)in kg\")\n", - "m1=(P*V1)/(R1*T1)\n", - "print(\"m1=\"),round(m1,3)\n", - "print(\"volume of air printlaced(V2)=volume of ballon(V1)\")\n", - "print(\"mass of air printlaced(m2)in kg\")\n", - "R2=0.287*1000;#gas constant for air in J/kg k\n", - "m2=(P*V1)/(R2*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"gas constant for air(R2)=0.287 KJ/kg k\")\n", - "print(\"load lifting capacity due to buoyant force(m)in kg\")\n", - "m=m2-m1\n", - "print(\"m=\"),round(m,3)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.21;page no:31" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.21, Page:31 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\n", - "let initial receiver pressure(p1)=1 in pa\n", - "so final receiver pressure(p2)=in pa 0.25\n", - "perfect gas equation,p*V*m=m*R*T\n", - "differentiating and then integrating equation w.r.t to time(t) \n", - "we get t=-(V/v)*log(p2/p1)\n", - "so time(t)in min 110.9\n" - ] - } - ], - "source": [ - "#cal of time required\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.21, Page:31 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\")\n", - "v=0.25;#volume sucking rate of pump in m^3/min\n", - "V=20.;#volume of air vessel in m^3\n", - "p1=1.;#initial receiver pressure in pa\n", - "print(\"let initial receiver pressure(p1)=1 in pa\")\n", - "p2=p1/4.\n", - "print(\"so final receiver pressure(p2)=in pa\"),round(p2,2)\n", - "print(\"perfect gas equation,p*V*m=m*R*T\")\n", - "print(\"differentiating and then integrating equation w.r.t to time(t) \")\n", - "print(\"we get t=-(V/v)*log(p2/p1)\")\n", - "t=-(V/v)*math.log(p2/p1)\n", - "print(\"so time(t)in min\"),round(t,2)\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.22;page no:32" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.22, Page:32 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\n", - "first calculate gas constants for different gases in j/kg k\n", - "for nitrogen,R1= 296.9\n", - "for oxygen,R2= 259.8\n", - "for carbon dioxide,R3= 188.95\n", - "so the gas constant for mixture(Rm)in j/kg k\n", - "Rm= 288.09\n", - "now the specific heat at constant pressure for constituent gases in KJ/kg k\n", - "for nitrogen,Cp1= 1.039\n", - "for oxygen,Cp2= 0.909\n", - "for carbon dioxide,Cp3= 0.819\n", - "so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\n", - "Cpm= 1.0115\n", - "now no. of moles of constituents gases\n", - "for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg 0.143\n", - "for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg 0.028\n", - "for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg 0.0023\n", - "total no. of moles in mixture in mol\n", - "n= 0.1733\n", - "now mole fraction of constituent gases\n", - "for nitrogen,x1= 0.825\n", - "for oxygen,x2= 0.162\n", - "for carbon dioxide,x3= 0.0131\n", - "now the molecular weight of mixture(Mm)in kg/kmol\n", - "Mm= 28.86\n" - ] - } - ], - "source": [ - "#cal of specific heat at constant pressure for constituent gases \n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.22, Page:32 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\")\n", - "m=5;#mass of mixture of gas in kg\n", - "P=1.013*10**5;#pressure of mixture in pa\n", - "T=300;#temperature of mixture in k\n", - "M1=28.;#molecular weight of nitrogen(N2)\n", - "M2=32.;#molecular weight of oxygen(O2)\n", - "M3=44.;#molecular weight of carbon dioxide(CO2)\n", - "f1=0.80;#fraction of N2 in mixture\n", - "f2=0.18;#fraction of O2 in mixture\n", - "f3=0.02;#fraction of CO2 in mixture\n", - "k1=1.4;#ratio of specific heat capacities for N2\n", - "k2=1.4;#ratio of specific heat capacities for O2\n", - "k3=1.3;#ratio of specific heat capacities for CO2\n", - "R=8314;#universal gas constant in J/kg k\n", - "print(\"first calculate gas constants for different gases in j/kg k\")\n", - "R1=R/M1\n", - "print(\"for nitrogen,R1=\"),round(R1,1)\n", - "R2=R/M2\n", - "print(\"for oxygen,R2=\"),round(R2,1)\n", - "R3=R/M3\n", - "print(\"for carbon dioxide,R3=\"),round(R3,2)\n", - "print(\"so the gas constant for mixture(Rm)in j/kg k\")\n", - "Rm=f1*R1+f2*R2+f3*R3\n", - "print(\"Rm=\"),round(Rm,2)\n", - "print(\"now the specific heat at constant pressure for constituent gases in KJ/kg k\")\n", - "Cp1=((k1/(k1-1))*R1)/1000\n", - "print(\"for nitrogen,Cp1=\"),round(Cp1,3)\n", - "Cp2=((k2/(k2-1))*R2)/1000\n", - "print(\"for oxygen,Cp2=\"),round(Cp2,3)\n", - "Cp3=((k3/(k3-1))*R3)/1000\n", - "print(\"for carbon dioxide,Cp3=\"),round(Cp3,3)\n", - "print(\"so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\")\n", - "Cpm=f1*Cp1+f2*Cp2+f3*Cp3\n", - "print(\"Cpm=\"),round(Cpm,4)\n", - "print(\"now no. of moles of constituents gases\")\n", - "m1=f1*m\n", - "n1=m1/M1\n", - "print(\"for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg\"),round(n1,3)\n", - "m2=f2*m\n", - "n2=m2/M2\n", - "print(\"for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg\"),round(n2,3)\n", - "m3=f3*m\n", - "n3=m3/M3\n", - "print(\"for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg\"),round(n3,4)\n", - "print(\"total no. of moles in mixture in mol\")\n", - "n=n1+n2+n3\n", - "print(\"n=\"),round(n,4)\n", - "print(\"now mole fraction of constituent gases\")\n", - "x1=n1/n\n", - "print(\"for nitrogen,x1=\"),round(x1,3)\n", - "x2=n2/n\n", - "print(\"for oxygen,x2=\"),round(x2,3)\n", - "x3=n3/n\n", - "print(\"for carbon dioxide,x3=\"),round(x3,4)\n", - "print(\"now the molecular weight of mixture(Mm)in kg/kmol\")\n", - "Mm=M1*x1+M2*x2+M3*x3\n", - "print(\"Mm=\"),round(Mm,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.23;page no:33" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.23, Page:33 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\n", - "mole fraction of constituent gases\n", - "x=(ni/n)=(Vi/V)\n", - "take volume of mixture(V)=1 m^3\n", - "mole fraction of O2(x1)\n", - "x1= 0.18\n", - "mole fraction of N2(x2)\n", - "x2= 0.75\n", - "mole fraction of CO2(x3)\n", - "x3= 0.07\n", - "now molecular weight of mixture = molar mass(m)\n", - "m= 29.84\n", - "now gravimetric analysis refers to the mass fraction analysis\n", - "mass fraction of constituents\n", - "y=xi*Mi/m\n", - "mole fraction of O2\n", - "y1= 0.193\n", - "mole fraction of N2\n", - "y2= 0.704\n", - "mole fraction of CO2\n", - "y3= 0.103\n", - "now partial pressure of constituents = volume fraction * pressure of mixture\n", - "Pi=xi*P\n", - "partial pressure of O2(P1)in Mpa\n", - "P1= 0.09\n", - "partial pressure of N2(P2)in Mpa\n", - "P2= 0.375\n", - "partial pressure of CO2(P3)in Mpa\n", - "P3= 0.04\n", - "NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\n" - ] - } - ], - "source": [ - "#cal of pressure difference\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.23, Page:33 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\")\n", - "V1=0.18;#volume fraction of O2 in m^3\n", - "V2=0.75;#volume fraction of N2 in m^3\n", - "V3=0.07;#volume fraction of CO2 in m^3\n", - "P=0.5;#pressure of mixture in Mpa\n", - "T=(107+273);#temperature of mixture in k\n", - "M1=32;#molar mass of O2\n", - "M2=28;#molar mass of N2\n", - "M3=44;#molar mass of CO2\n", - "print(\"mole fraction of constituent gases\")\n", - "print(\"x=(ni/n)=(Vi/V)\")\n", - "V=1;# volume of mixture in m^3\n", - "print(\"take volume of mixture(V)=1 m^3\")\n", - "print(\"mole fraction of O2(x1)\")\n", - "x1=V1/V\n", - "print(\"x1=\"),round(x1,2)\n", - "print(\"mole fraction of N2(x2)\")\n", - "x2=V2/V\n", - "print(\"x2=\"),round(x2,2)\n", - "print(\"mole fraction of CO2(x3)\")\n", - "x3=V3/V\n", - "print(\"x3=\"),round(x3,2)\n", - "print(\"now molecular weight of mixture = molar mass(m)\")\n", - "m=x1*M1+x2*M2+x3*M3\n", - "print(\"m=\"),round(m,2)\n", - "print(\"now gravimetric analysis refers to the mass fraction analysis\")\n", - "print(\"mass fraction of constituents\")\n", - "print(\"y=xi*Mi/m\")\n", - "print(\"mole fraction of O2\")\n", - "y1=x1*M1/m\n", - "print(\"y1=\"),round(y1,3)\n", - "print(\"mole fraction of N2\")\n", - "y2=x2*M2/m\n", - "print(\"y2=\"),round(y2,3)\n", - "print(\"mole fraction of CO2\")\n", - "y3=x3*M3/m\n", - "print(\"y3=\"),round(y3,3)\n", - "print(\"now partial pressure of constituents = volume fraction * pressure of mixture\")\n", - "print(\"Pi=xi*P\")\n", - "print(\"partial pressure of O2(P1)in Mpa\")\n", - "p1=x1*P\n", - "print(\"P1=\"),round(p1,2)\n", - "print(\"partial pressure of N2(P2)in Mpa\")\n", - "P2=x2*P\n", - "print(\"P2=\"),round(P2,3)\n", - "P3=x3*P\n", - "print(\"partial pressure of CO2(P3)in Mpa\")\n", - "print(\"P3=\"),round(P3,2)\n", - "print(\"NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.24;page no:34" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.24, Page:34 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\n", - "volume of tank of N2(V1) in m^3= 3.0\n", - "volume of tank of CO2(V2) in m^3= 3.0\n", - "taking the adiabatic condition\n", - "no. of moles of N2(n1)\n", - "n1= 0.6\n", - "no. of moles of CO2(n2)\n", - "n2= 0.37\n", - "total no. of moles of mixture(n)in mol\n", - "n= 0.97\n", - "gas constant for N2(R1)in J/kg k\n", - "R1= 296.93\n", - "gas constant for CO2(R2)in J/kg k\n", - "R2=R/M2 188.95\n", - "specific heat of N2 at constant volume (Cv1) in J/kg k\n", - "Cv1= 742.32\n", - "specific heat of CO2 at constant volume (Cv2) in J/kg k\n", - "Cv2= 629.85\n", - "mass of N2(m1)in kg\n", - "m1= 16.84\n", - "mass of CO2(m2)in kg\n", - "m2= 16.28\n", - "let us consider the equilibrium temperature of mixture after adiabatic mixing at T\n", - "applying energy conservation principle\n", - "m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\n", - "equlibrium temperature(T)in k\n", - "=>T= 439.44\n", - "so the equlibrium pressure(P)in kpa\n", - "P= 591.55\n" - ] - } - ], - "source": [ - "#cal of equilibrium temperature,pressure of mixture\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.24, Page:34 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\")\n", - "V=6;#volume of tank in m^3\n", - "P1=800*10**3;#pressure of N2 gas tank in pa\n", - "T1=480.;#temperature of N2 gas tank in k\n", - "P2=400*10**3;#pressure of CO2 gas tank in pa\n", - "T2=390.;#temperature of CO2 gas tank in k\n", - "k1=1.4;#ratio of specific heat capacity for N2\n", - "k2=1.3;#ratio of specific heat capacity for CO2\n", - "R=8314.;#universal gas constant in J/kg k\n", - "M1=28.;#molecular weight of N2\n", - "M2=44.;#molecular weight of CO2\n", - "V1=V/2\n", - "print(\"volume of tank of N2(V1) in m^3=\"),round(V1,2)\n", - "V2=V/2\n", - "print(\"volume of tank of CO2(V2) in m^3=\"),round(V2,2)\n", - "print(\"taking the adiabatic condition\")\n", - "print(\"no. of moles of N2(n1)\")\n", - "n1=(P1*V1)/(R*T1)\n", - "print(\"n1=\"),round(n1,2)\n", - "print(\"no. of moles of CO2(n2)\")\n", - "n2=(P2*V2)/(R*T2)\n", - "print(\"n2=\"),round(n2,2)\n", - "print(\"total no. of moles of mixture(n)in mol\")\n", - "n=n1+n2\n", - "print(\"n=\"),round(n,2)\n", - "print(\"gas constant for N2(R1)in J/kg k\")\n", - "R1=R/M1\n", - "print(\"R1=\"),round(R1,2)\n", - "print(\"gas constant for CO2(R2)in J/kg k\")\n", - "R2=R/M2\n", - "print(\"R2=R/M2\"),round(R2,2)\n", - "print(\"specific heat of N2 at constant volume (Cv1) in J/kg k\")\n", - "Cv1=R1/(k1-1)\n", - "print(\"Cv1=\"),round(Cv1,2)\n", - "print(\"specific heat of CO2 at constant volume (Cv2) in J/kg k\")\n", - "Cv2=R2/(k2-1)\n", - "print(\"Cv2=\"),round(Cv2,2)\n", - "print(\"mass of N2(m1)in kg\")\n", - "m1=n1*M1\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"mass of CO2(m2)in kg\")\n", - "m2=n2*M2\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"let us consider the equilibrium temperature of mixture after adiabatic mixing at T\")\n", - "print(\"applying energy conservation principle\")\n", - "print(\"m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\")\n", - "print(\"equlibrium temperature(T)in k\")\n", - "T=((m1*Cv1*T1)+(m2*Cv2*T2))/((m1*Cv1)+(m2*Cv2))\n", - "print(\"=>T=\"),round(T,2)\n", - "print(\"so the equlibrium pressure(P)in kpa\")\n", - "P=(n*R*T)/(1000*V)\n", - "print(\"P=\"),round(P,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.25;page no:35" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.25, Page:35 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\n", - "since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\n", - "so the specific heat at constant pressure(Cp)in KJ/kg k\n", - "Cp= 7.608\n" - ] - } - ], - "source": [ - "#cal of specific heat of final mixture\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.25, Page:35 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\")\n", - "m1=2;#mass of H2 in kg\n", - "m2=3;#mass of He in kg\n", - "T=100;#temperature of container in k\n", - "Cp1=11.23;#specific heat at constant pressure for H2 in KJ/kg k\n", - "Cp2=5.193;#specific heat at constant pressure for He in KJ/kg k\n", - "print(\"since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\")\n", - "print(\"so the specific heat at constant pressure(Cp)in KJ/kg k\")\n", - "Cp=((Cp1*m1)+Cp2*m2)/(m1+m2)\n", - "print(\"Cp=\"),round(Cp,3)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.26;page no:35" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.26, Page:35 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\n", - "gas constant for H2(R1)in KJ/kg k\n", - "R1= 4.157\n", - "gas constant for N2(R2)in KJ/kg k\n", - "R2= 0.297\n", - "gas constant for CO2(R3)in KJ/kg k\n", - "R3= 0.189\n", - "so now gas constant for mixture(Rm)in KJ/kg k\n", - "Rm= 2.606\n", - "considering gas to be perfect gas\n", - "total mass of mixture(m)in kg\n", - "m= 30.0\n", - "capacity of vessel(V)in m^3\n", - "V= 231.57\n", - "now final temperature(Tf) is twice of initial temperature(Ti)\n", - "so take k=Tf/Ti=2\n", - "for constant volume heating,final pressure(Pf)in kpa shall be\n", - "Pf= 202.65\n" - ] - } - ], - "source": [ - "#cal of capacity and pressure in the vessel\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.26, Page:35 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\")\n", - "m1=18.;#mass of hydrogen(H2) in kg\n", - "m2=10.;#mass of nitrogen(N2) in kg\n", - "m3=2.;#mass of carbon dioxide(CO2) in kg\n", - "R=8.314;#universal gas constant in KJ/kg k\n", - "Pi=101.325;#atmospheric pressure in kpa\n", - "T=(27+273.15);#ambient temperature in k\n", - "M1=2;#molar mass of H2\n", - "M2=28;#molar mass of N2\n", - "M3=44;#molar mass of CO2\n", - "print(\"gas constant for H2(R1)in KJ/kg k\")\n", - "R1=R/M1\n", - "print(\"R1=\"),round(R1,3)\n", - "print(\"gas constant for N2(R2)in KJ/kg k\")\n", - "R2=R/M2\n", - "print(\"R2=\"),round(R2,3)\n", - "print(\"gas constant for CO2(R3)in KJ/kg k\")\n", - "R3=R/M3\n", - "print(\"R3=\"),round(R3,3)\n", - "print(\"so now gas constant for mixture(Rm)in KJ/kg k\")\n", - "Rm=(m1*R1+m2*R2+m3*R3)/(m1+m2+m3)\n", - "print(\"Rm=\"),round(Rm,3)\n", - "print(\"considering gas to be perfect gas\")\n", - "print(\"total mass of mixture(m)in kg\")\n", - "m=m1+m2+m3\n", - "print(\"m=\"),round(m,2)\n", - "print(\"capacity of vessel(V)in m^3\")\n", - "V=(m*Rm*T)/Pi\n", - "print(\"V=\"),round(V,2)\n", - "print(\"now final temperature(Tf) is twice of initial temperature(Ti)\")\n", - "k=2;#ratio of initial to final temperature\n", - "print(\"so take k=Tf/Ti=2\") \n", - "print(\"for constant volume heating,final pressure(Pf)in kpa shall be\")\n", - "Pf=Pi*k\n", - "print(\"Pf=\"),round(Pf,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.27;page no:36" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.27, Page:36 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\n", - "let inlet state be 1 and exit state be 2\n", - "by charles law volume and temperature can be related as\n", - "(V1/T1)=(V2/T2)\n", - "(V2/V1)=(T2/T1)\n", - "or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\n", - "since change in K.E=0\n", - "so (D2^2/D1^2)=T2/T1\n", - "D2/D1=sqrt(T2/T1)\n", - "say(D2/D1)=k\n", - "so exit to inlet diameter ratio(k) 1.29\n" - ] - } - ], - "source": [ - "#cal of exit to inlet diameter ratio\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.27, Page:36 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\")\n", - "T1=(27.+273.);#initial temperature of air in k\n", - "T2=500.;#final temperature of air in k\n", - "print(\"let inlet state be 1 and exit state be 2\")\n", - "print(\"by charles law volume and temperature can be related as\")\n", - "print(\"(V1/T1)=(V2/T2)\")\n", - "print(\"(V2/V1)=(T2/T1)\")\n", - "print(\"or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\")\n", - "print(\"since change in K.E=0\")\n", - "print(\"so (D2^2/D1^2)=T2/T1\")\n", - "print(\"D2/D1=sqrt(T2/T1)\")\n", - "print(\"say(D2/D1)=k\")\n", - "k=math.sqrt(T2/T1)\n", - "print(\"so exit to inlet diameter ratio(k)\"),round(k,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.28;page no:37" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.28, Page:37 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\n", - "gas constant for H2(R1)in KJ/kg k\n", - "R1= 4.157\n", - "say initial and final ststes are given by 1 and 2\n", - "mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\n", - "final pressure of hydrogen(P2)in cm of Hg\n", - "P2= 6.0\n", - "therefore pressure difference(P)in kpa\n", - "P= 93.33\n", - "mass pumped out(m)in kg\n", - "m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\n", - "here V1=V2=V and T1=T2=T\n", - "so m= 0.15\n", - "now during cooling upto 10 degree celcius,the process may be consider as constant volume process\n", - "say state before and after cooling are denoted by suffix 2 and 3\n", - "final pressure after cooling(P3)in kpa\n", - "P3= 7.546\n" - ] - } - ], - "source": [ - "#cal of final pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.28, Page:37 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\")\n", - "V=2;#volume of vessel in m^3\n", - "P1=76;#initial pressure or atmospheric pressure in cm of Hg\n", - "T=(27+273.15);#temperature of vessel in k\n", - "p=70;#final pressure in cm of Hg vaccum\n", - "R=8.314;#universal gas constant in KJ/kg k\n", - "M=2;#molecular weight of H2\n", - "print(\"gas constant for H2(R1)in KJ/kg k\")\n", - "R1=R/M\n", - "print(\"R1=\"),round(R1,3)\n", - "print(\"say initial and final ststes are given by 1 and 2\")\n", - "print(\"mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\")\n", - "print(\"final pressure of hydrogen(P2)in cm of Hg\")\n", - "P2=P1-p\n", - "print(\"P2=\"),round(P2,2)\n", - "print(\"therefore pressure difference(P)in kpa\")\n", - "P=((P1-P2)*101.325)/76\n", - "print(\"P=\"),round(P,2)\n", - "print(\"mass pumped out(m)in kg\")\n", - "print(\"m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\")\n", - "print(\"here V1=V2=V and T1=T2=T\")\n", - "m=(V*P)/(R1*T)\n", - "print(\"so m=\"),round(m,2)\n", - "print(\"now during cooling upto 10 degree celcius,the process may be consider as constant volume process\")\n", - "print(\"say state before and after cooling are denoted by suffix 2 and 3\")\n", - "T3=(10+273.15);#final temperature after cooling in k\n", - "print(\"final pressure after cooling(P3)in kpa\")\n", - "P3=(T3/T)*P2*(101.325/76)\n", - "print(\"P3=\"),round(P3,3)\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter_1_2.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter_1_2.ipynb deleted file mode 100755 index 9474d100..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter_1_2.ipynb +++ /dev/null @@ -1,1777 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# chapter 1:Fundemental concepts and definitions" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.1;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.1, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\n", - "pressure difference(p)in pa\n", - "p= 39755.7\n" - ] - } - ], - "source": [ - "#cal of pressure difference\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.1, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\"\n", - "h=30*10**-2;#manometer deflection of mercury in m\n", - "g=9.78;#acceleration due to gravity in m/s^2\n", - "rho=13550;#density of mercury at room temperature in kg/m^3\n", - "print\"pressure difference(p)in pa\"\n", - "p=rho*g*h\n", - "print\"p=\",round(p,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.2;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.2, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\n", - "effort required for lifting the lid(E)in N\n", - "E= 7115.48\n" - ] - } - ], - "source": [ - "#cal of effort required for lifting the lid\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.2, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\"\n", - "d=30*10**-2;#diameter of cylindrical vessel in m\n", - "h=76*10**-2;#atmospheric pressure in m of mercury\n", - "g=9.78;#acceleration due to gravity in m/s^2\n", - "rho=13550;#density of mercury at room temperature in kg/m^3\n", - "print\"effort required for lifting the lid(E)in N\"\n", - "E=(rho*g*h)*(3.14*d**2)/4\n", - "print\"E=\",round(E,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.3;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.3, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\n", - "pressure measured by manometer is gauge pressure(Pg)in kpa\n", - "Pg=rho*g*h/10^3\n", - "actual pressure of the air(P)in kpa\n", - "P= 140.76\n" - ] - } - ], - "source": [ - "#cal of actual pressure of the air\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.3, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\"\n", - "h=30*10**-2;# pressure of compressed air in m of mercury\n", - "Patm=101*10**3;#atmospheric pressure in pa\n", - "g=9.78;#acceleration due to gravity in m/s^2\n", - "rho=13550;#density of mercury at room temperature in kg/m^3\n", - "print\"pressure measured by manometer is gauge pressure(Pg)in kpa\"\n", - "print\"Pg=rho*g*h/10^3\"\n", - "Pg=rho*g*h/10**3\n", - "print\"actual pressure of the air(P)in kpa\"\n", - "P=Pg+Patm/10**3\n", - "print\"P=\",round(P,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.4;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.4, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\n", - "density of oil(RHOoil)in kg/m^3\n", - "RHOoil=sg*RHOw\n", - "gauge pressure(Pg)in kpa\n", - "Pg= 7.848\n" - ] - } - ], - "source": [ - "#cal of gauge pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.4, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\"\n", - "h=1;#depth of oil tank in m\n", - "sg=0.8;#specific gravity of oil\n", - "RHOw=1000;#density of water in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print\"density of oil(RHOoil)in kg/m^3\"\n", - "print\"RHOoil=sg*RHOw\"\n", - "RHOoil=sg*RHOw\n", - "print\"gauge pressure(Pg)in kpa\"\n", - "Pg=RHOoil*g*h/10**3\n", - "print\"Pg=\",round(Pg,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.5;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.5, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\n", - "atmospheric pressure(Patm)in kpa\n", - "Patm=rho*g*h2/10^3\n", - "pressure due to mercury column at AB(Pab)in kpa\n", - "Pab=rho*g*h1/10^3\n", - "pressure exerted by gas(Pgas)in kpa\n", - "Pgas= 154.76\n" - ] - } - ], - "source": [ - "#cal of pressure exerted by gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.5, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\"\n", - "rho=13.6*10**3;#density of mercury in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "h1=40*10**-2;#difference of height in mercury column in m as shown in figure\n", - "h2=76*10**-2;#barometer reading of mercury in m\n", - "print\"atmospheric pressure(Patm)in kpa\"\n", - "print\"Patm=rho*g*h2/10^3\"\n", - "Patm=rho*g*h2/10**3\n", - "print\"pressure due to mercury column at AB(Pab)in kpa\"\n", - "print\"Pab=rho*g*h1/10^3\"\n", - "Pab=rho*g*h1/10**3\n", - "print\"pressure exerted by gas(Pgas)in kpa\"\n", - "Pgas=Patm+Pab\n", - "print\"Pgas=\",round(Pgas,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.6;page no:23" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.6, Page:23 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\n", - "by law of conservation of energy\n", - "potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\n", - "so m*g*h = m*Cp*deltaT*4.18*1000\n", - "change in temperature of water(deltaT) in degree celcius\n", - "deltaT= 2.35\n" - ] - } - ], - "source": [ - "#cal of change in temperature of water\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.6, Page:23 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\"\n", - "m=1;#mass of water in kg\n", - "h=1000;#height from which water fall in m\n", - "Cp=1;#specific heat of water in kcal/kg k\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print\"by law of conservation of energy\"\n", - "print\"potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\"\n", - "print\"so m*g*h = m*Cp*deltaT*4.18*1000\"\n", - "print\"change in temperature of water(deltaT) in degree celcius\"\n", - "deltaT=(g*h)/(4.18*1000*Cp)\n", - "print\"deltaT=\",round(deltaT,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.7;page no:23" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.7, Page:23 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\n", - "mass of object(m)in kg\n", - "m=w1/g1\n", - "spring balance reading=gravitational force in mass(F)in N\n", - "F= 86.65\n" - ] - } - ], - "source": [ - "#cal of spring balance reading\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.7, Page:23 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\"\n", - "w1=100;#weight of object at standard gravitational acceleration in N\n", - "g1=9.81;#acceleration due to gravity in m/s^2\n", - "g2=8.5;#gravitational acceleration at some location\n", - "print\"mass of object(m)in kg\"\n", - "print\"m=w1/g1\"\n", - "m=w1/g1\n", - "print\"spring balance reading=gravitational force in mass(F)in N\"\n", - "F=m*g2\n", - "print\"F=\",round(F,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.8;page no:24" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.8, Page:24 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\n", - "pressure measured by manometer(P) in pa\n", - "p=rho*g*h\n", - "now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\n", - "mass of piston(m)in kg\n", - "so m= 28.84\n" - ] - } - ], - "source": [ - "#cal of mass of piston\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.8, Page:24 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\"\n", - "d=15*10**-2;#diameter of cylinder in m\n", - "h=12*10**-2;#manometer height difference in m of mercury\n", - "rho=13.6*10**3;#density of mercury in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print\"pressure measured by manometer(P) in pa\"\n", - "print\"p=rho*g*h\"\n", - "p=rho*g*h\n", - "print\"now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\"\n", - "print\"mass of piston(m)in kg\"\n", - "m=(p*math.pi*d**2)/(4*g)\n", - "print\"so m=\",round(m,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.9;page no:24" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.9, Page:24 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\n", - "balancing pressure at plane BC in figure we get\n", - "Psteam+Pwater=Patm+Pmercury\n", - "now 1.atmospheric pressure(Patm)in pa\n", - "Patm= 101396.16\n", - "2.pressure due to water(Pwater)in pa\n", - "Pwater= 196.2\n", - "3.pressure due to mercury(Pmercury)in pa\n", - "Pmercury=RHOm*g*h3 13341.6\n", - "using balancing equation\n", - "Psteam=Patm+Pmercury-Pwater\n", - "so pressure of steam(Psteam)in kpa\n", - "Psteam= 114.54\n" - ] - } - ], - "source": [ - "#cal of pressure due to atmosphere,water,mercury,steam\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.9, Page:24 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\")\n", - "RHOm=13.6*10**3;#density of mercury in kg/m^3\n", - "RHOw=1000;#density of water in kg/m^3\n", - "h1=76*10**-2;#barometer reading in m of mercury\n", - "h2=2*10**-2;#height raised by water in manometer tube in m \n", - "h3=10*10**-2;#height raised by mercury in manometer tube in m \n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"balancing pressure at plane BC in figure we get\")\n", - "print(\"Psteam+Pwater=Patm+Pmercury\")\n", - "print(\"now 1.atmospheric pressure(Patm)in pa\")\n", - "Patm=RHOm*g*h1\n", - "print(\"Patm=\"),round(Patm,2)\n", - "print(\"2.pressure due to water(Pwater)in pa\")\n", - "Pwater=RHOw*g*h2\n", - "print(\"Pwater=\"),round(Pwater,2)\n", - "print(\"3.pressure due to mercury(Pmercury)in pa\")\n", - "Pmercury=RHOm*g*h3\n", - "print(\"Pmercury=RHOm*g*h3\"),round(Pmercury,2)\n", - "print(\"using balancing equation\")\n", - "print(\"Psteam=Patm+Pmercury-Pwater\")\n", - "print(\"so pressure of steam(Psteam)in kpa\")\n", - "Psteam=(Patm+Pmercury-Pwater)/1000\n", - "print(\"Psteam=\"),round(Psteam,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.10;page no:24" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.10, Page:24 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\n", - "atmospheric pressure(Patm)in kpa\n", - "absolute temperature in compartment A(Pa) in kpa\n", - "Pa= 496.06\n", - "absolute temperature in compartment B(Pb) in kpa\n", - "Pb= 246.06\n", - "absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\n" - ] - } - ], - "source": [ - "#cal of \"absolute temperature in compartment A,B\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.10, Page:24 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\")\n", - "h=720*10**-3;#barometer reading in m of Hg\n", - "Pga=400;#gauge pressure in compartment A in kpa\n", - "Pgb=150;#gauge pressure in compartment B in kpa\n", - "rho=13.6*10**3;#density of mercury in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"atmospheric pressure(Patm)in kpa\")\n", - "Patm=(rho*g*h)/1000\n", - "print(\"absolute temperature in compartment A(Pa) in kpa\")\n", - "Pa=Pga+Patm\n", - "print\"Pa=\",round(Pa,2)\n", - "print\"absolute temperature in compartment B(Pb) in kpa\"\n", - "Pb=Pgb+Patm\n", - "print\"Pb=\",round(Pb,2)\n", - "print\"absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.11;page no:25" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.11, Page:25 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\n", - "the pressure of air in air tank can be obtained by equalising pressures at some reference line\n", - "P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\n", - "so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\n", - "air pressure(P1)in kpa 139.81\n" - ] - } - ], - "source": [ - "#cal of air pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.11, Page:25 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\")\n", - "Patm=90*10**3;#atmospheric pressure in pa\n", - "RHOw=1000;#density of water in kg/m^3\n", - "RHOm=13600;#density of mercury in kg/m^3\n", - "RHOo=850;#density of oil in kg/m^3\n", - "g=9.81;#acceleration due to ggravity in m/s^2\n", - "h1=.15;#height difference between water column in m\n", - "h2=.25;#height difference between oil column in m\n", - "h3=.4;#height difference between mercury column in m\n", - "print\"the pressure of air in air tank can be obtained by equalising pressures at some reference line\"\n", - "print\"P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\"\n", - "print\"so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\"\n", - "P1=(Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2)/1000\n", - "print\"air pressure(P1)in kpa\",round(P1,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.12;page no:26" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.12, Page:26 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\n", - "mass of object(m)in kg\n", - "m=F/g\n", - "kinetic energy(E)in J is given by\n", - "E= 140625000.0\n" - ] - } - ], - "source": [ - "#cal of kinetic energy\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.12, Page:26 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\"\n", - "v=750;#relative velocity of object with respect to earth in m/sec\n", - "F=4000;#gravitational force in N\n", - "g=8;#acceleration due to gravity in m/s^2\n", - "print\"mass of object(m)in kg\"\n", - "print\"m=F/g\"\n", - "m=F/g\n", - "print\"kinetic energy(E)in J is given by\"\n", - "E=m*v**2/2\n", - "print\"E=\",round(E)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.13;page no:26" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.13, Page:26 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\n", - "characteristics gas constant(R2)in kJ/kg k\n", - "molecular weight of gas(m)in kg/kg mol= 16.63\n", - "NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\n" - ] - } - ], - "source": [ - "#cal of molecular weight of gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.13, Page:26 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\"\n", - "Cp=2.286;#specific heat at constant pressure in kJ/kg k\n", - "Cv=1.786;#specific heat at constant volume in kJ/kg k\n", - "R1=8.3143;#universal gas constant in kJ/kg k\n", - "print\"characteristics gas constant(R2)in kJ/kg k\"\n", - "R2=Cp-Cv\n", - "m=R1/R2\n", - "print\"molecular weight of gas(m)in kg/kg mol=\",round(m,2)\n", - "print\"NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.14;page no:26" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.14, Page:26 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\n", - "using perfect gas equation\n", - "P1*V1/T1 = P2*V2/T2\n", - "=>T2=(P2*V2*T1)/(P1*V1)\n", - "so final temperature of gas(T2)in k\n", - "or final temperature of gas(T2)in degree celcius= 127.0\n" - ] - } - ], - "source": [ - "#cal of final temperature of gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.14, Page:26 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\"\n", - "P1=750*10**3;#initial pressure of gas in pa\n", - "V1=0.2;#initial volume of gas in m^3\n", - "T1=600;#initial temperature of gas in k\n", - "P2=2*10**5;#final pressure of gas i pa\n", - "V2=0.5;#final volume of gas in m^3\n", - "print\"using perfect gas equation\"\n", - "print\"P1*V1/T1 = P2*V2/T2\"\n", - "print\"=>T2=(P2*V2*T1)/(P1*V1)\"\n", - "print\"so final temperature of gas(T2)in k\"\n", - "T2=(P2*V2*T1)/(P1*V1)\n", - "T2=T2-273\n", - "print\"or final temperature of gas(T2)in degree celcius=\",round(T2,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.15;page no:27" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.15, Page:27 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\n", - "from perfect gas equation we get\n", - "initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\n", - "m1= 5.807\n", - "final mass of air(m2 in kg)=(P2*V2)/(R*T2)\n", - "m2= 3.111\n", - "mass of air removed(m)in kg 2.696\n", - "volume of this mass of air(V) at initial states in m^3= 2.32\n" - ] - } - ], - "source": [ - "#cal of volume of this mass of air(V) at initial states\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.15, Page:27 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\"\n", - "P1=100*10**3;#initial pressure of air in pa\n", - "V1=5.;#initial volume of air in m^3\n", - "T1=300.;#initial temperature of gas in k\n", - "P2=50*10**3;#final pressure of air in pa\n", - "V2=5.;#final volume of air in m^3\n", - "T2=(280.);#final temperature of air in K\n", - "R=287.;#gas constant on J/kg k\n", - "print\"from perfect gas equation we get\"\n", - "print\"initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\"\n", - "m1=(P1*V1)/(R*T1)\n", - "print(\"m1=\"),round(m1,3)\n", - "print\"final mass of air(m2 in kg)=(P2*V2)/(R*T2)\"\n", - "m2=(P2*V2)/(R*T2)\n", - "print(\"m2=\"),round(m2,3)\n", - "m=m1-m2\n", - "print\"mass of air removed(m)in kg\",round(m,3)\n", - "V=m*R*T1/P1\n", - "print\"volume of this mass of air(V) at initial states in m^3=\",round(V,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.16;page no:27" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.16, Page:27 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\n", - "here V1=V2\n", - "so P1/T1=P2/T2\n", - "final temperature of hydrogen gas(T2)in k\n", - "=>T2=P2*T1/P1\n", - "now R=(Cp-Cv) in KJ/kg k\n", - "And volume of cylinder(V1)in m^3\n", - "V1=(math.pi*d^2*l)/4\n", - "mass of hydrogen gas(m)in kg\n", - "m= 0.254\n", - "now heat supplied(Q)in KJ\n", - "Q= 193.93\n" - ] - } - ], - "source": [ - "#cal of heat supplied\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.16, Page:27 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\"\n", - "d=1;#diameter of cylinder in m\n", - "l=4;#length of cylinder in m\n", - "P1=100*10**3;#initial pressureof hydrogen gas in pa\n", - "T1=(27+273);#initial temperature of hydrogen gas in k\n", - "P2=125*10**3;#final pressureof hydrogen gas in pa\n", - "Cp=14.307;#specific heat at constant pressure in KJ/kg k\n", - "Cv=10.183;#specific heat at constant volume in KJ/kg k\n", - "print\"here V1=V2\"\n", - "print\"so P1/T1=P2/T2\"\n", - "print\"final temperature of hydrogen gas(T2)in k\"\n", - "print\"=>T2=P2*T1/P1\"\n", - "T2=P2*T1/P1\n", - "print\"now R=(Cp-Cv) in KJ/kg k\"\n", - "R=Cp-Cv\n", - "print\"And volume of cylinder(V1)in m^3\"\n", - "print\"V1=(math.pi*d^2*l)/4\"\n", - "V1=(math.pi*d**2*l)/4\n", - "print\"mass of hydrogen gas(m)in kg\"\n", - "m=(P1*V1)/(1000*R*T1)\n", - "print\"m=\",round(m,3)\n", - "print\"now heat supplied(Q)in KJ\"\n", - "Q=m*Cv*(T2-T1)\n", - "print\"Q=\",round(Q,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.17;page no:28" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.17, Page:28 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\n", - "final total volume(V)in m^3\n", - "V=V1*V2\n", - "total mass of air(m)in kg\n", - "m=m1+m2\n", - "final pressure of air(P)in kpa\n", - "using perfect gas equation\n", - "P= 516.6\n" - ] - } - ], - "source": [ - "#cal of final pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.17, Page:28 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\")\n", - "V1=2.;#volume of first cylinder in m^3\n", - "V2=2.;#volume of second cylinder in m^3\n", - "T=(27+273);#temperature of system in k\n", - "m1=20.;#mass of air in first vessel in kg\n", - "m2=4.;#mass of air in second vessel in kg\n", - "R=287.;#gas constant J/kg k\n", - "print(\"final total volume(V)in m^3\")\n", - "print(\"V=V1*V2\")\n", - "V=V1*V2\n", - "print(\"total mass of air(m)in kg\")\n", - "print(\"m=m1+m2\")\n", - "m=m1+m2\n", - "print(\"final pressure of air(P)in kpa\")\n", - "print(\"using perfect gas equation\")\n", - "P=(m*R*T)/(1000*V)\n", - "print\"P=\",round(P,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.18;page no:28" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.18, Page:28 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\n", - "1.By considering it as a PERFECT GAS\n", - "gas constant for CO2(Rco2)\n", - "Rco2=(J/Kg.k) 188.9\n", - "Also P*V=M*Rco2*T\n", - "pressure of CO2 as perfect gas(P)in N/m^2\n", - "P=(m*Rco2*T)/V 141683.71\n", - "2.By considering as a REAL GAS\n", - "values of vanderwaal constants a,b can be seen from the table which are\n", - "a=(N m^4/(kg mol)^2) 362850.0\n", - "b=(m^3/kg mol) 0.03\n", - "now specific volume(v)in m^3/kg mol\n", - "v= 17.604\n", - "now substituting the value of all variables in vanderwaal equation\n", - "(P+(a/v^2))*(v-b)=R*T\n", - "pressure of CO2 as real gas(P)in N/m^2\n", - "P= 140766.02\n" - ] - } - ], - "source": [ - "#cal of pressure of CO2 as perfect,real gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.18, Page:28 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\")\n", - "m=5;#mass of CO2 in kg\n", - "V=2;#volume of vesssel in m^3\n", - "T=(27+273);#temperature of vessel in k\n", - "R=8.314*10**3;#universal gas constant in J/kg k\n", - "M=44.01;#molecular weight of CO2 \n", - "print(\"1.By considering it as a PERFECT GAS\")\n", - "print(\"gas constant for CO2(Rco2)\")\n", - "Rco2=R/M\n", - "print(\"Rco2=(J/Kg.k)\"),round(Rco2,1)\n", - "print(\"Also P*V=M*Rco2*T\")\n", - "print(\"pressure of CO2 as perfect gas(P)in N/m^2\")\n", - "P=(m*Rco2*T)/V\n", - "print(\"P=(m*Rco2*T)/V \"),round(P,2)\n", - "print(\"2.By considering as a REAL GAS\")\n", - "print(\"values of vanderwaal constants a,b can be seen from the table which are\")\n", - "a=3628.5*10**2#vanderwall constant in N m^4/(kg mol)^2\n", - "b=3.14*10**-2# vanderwall constant in m^3/kg mol\n", - "print(\"a=(N m^4/(kg mol)^2) \"),round(a,2)\n", - "print(\"b=(m^3/kg mol)\"),round(b,2)\n", - "print(\"now specific volume(v)in m^3/kg mol\")\n", - "v=V*M/m\n", - "print(\"v=\"),round(v,3)\n", - "print(\"now substituting the value of all variables in vanderwaal equation\")\n", - "print(\"(P+(a/v^2))*(v-b)=R*T\")\n", - "print(\"pressure of CO2 as real gas(P)in N/m^2\")\n", - "P=((R*T)/(v-b))-(a/v**2)\n", - "print(\"P=\"),round(P,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.19;page no:29" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.19, Page:29 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\n", - "1.considering as perfect gas\n", - "specific volume(V)in m^3/kg\n", - "V= 0.0186\n", - "2.considering compressibility effects\n", - "reduced pressure(P)in pa\n", - "p= 0.8\n", - "reduced temperature(t)in k\n", - "t= 1.1\n", - "from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\n", - "we get Z=0.785\n", - "now actual specific volume(v)in m^3/kg\n", - "v= 0.0146\n" - ] - } - ], - "source": [ - "#cal of specific volume of steam\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.19, Page:29 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\")\n", - "P=17672;#pressure of steam on kpa\n", - "T=712;#temperature of steam in k\n", - "Pc=22.09;#critical pressure of steam in Mpa\n", - "Tc=647.3;#critical temperature of steam in k\n", - "R=0.4615;#gas constant for steam in KJ/kg k\n", - "print(\"1.considering as perfect gas\")\n", - "print(\"specific volume(V)in m^3/kg\")\n", - "V=R*T/P\n", - "print(\"V=\"),round(V,4)\n", - "print(\"2.considering compressibility effects\")\n", - "print(\"reduced pressure(P)in pa\")\n", - "p=P/(Pc*1000)\n", - "print(\"p=\"),round(p,2)\n", - "print(\"reduced temperature(t)in k\")\n", - "t=T/Tc\n", - "print(\"t=\"),round(t,2)\n", - "print(\"from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\")\n", - "print(\"we get Z=0.785\")\n", - "Z=0.785;#compressibility factor\n", - "print(\"now actual specific volume(v)in m^3/kg\")\n", - "v=Z*V\n", - "print(\"v=\"),round(v,4)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.20;page no:30" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.20, Page:30 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\n", - "volume of ballon(V1)in m^3\n", - "V1= 65.45\n", - "molecular mass of hydrogen(M)\n", - "M=2\n", - "gas constant for H2(R1)in J/kg k\n", - "R1= 4157.0\n", - "mass of H2 in ballon(m1)in kg\n", - "m1= 5.316\n", - "volume of air printlaced(V2)=volume of ballon(V1)\n", - "mass of air printlaced(m2)in kg\n", - "m2= 79.66\n", - "gas constant for air(R2)=0.287 KJ/kg k\n", - "load lifting capacity due to buoyant force(m)in kg\n", - "m= 74.343\n" - ] - } - ], - "source": [ - "#estimation of maximum load that can be lifted \n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.20, Page:30 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\")\n", - "d=5.;#diameter of ballon in m\n", - "T1=(27.+273.);#temperature of hydrogen in k\n", - "P=1.013*10**5;#atmospheric pressure in pa\n", - "T2=(17.+273.);#temperature of surrounding air in k\n", - "R=8.314*10**3;#gas constant in J/kg k\n", - "print(\"volume of ballon(V1)in m^3\")\n", - "V1=(4./3.)*math.pi*((d/2)**3)\n", - "print(\"V1=\"),round(V1,2)\n", - "print(\"molecular mass of hydrogen(M)\")\n", - "print(\"M=2\")\n", - "M=2;#molecular mass of hydrogen\n", - "print(\"gas constant for H2(R1)in J/kg k\")\n", - "R1=R/M\n", - "print(\"R1=\"),round(R1,2)\n", - "print(\"mass of H2 in ballon(m1)in kg\")\n", - "m1=(P*V1)/(R1*T1)\n", - "print(\"m1=\"),round(m1,3)\n", - "print(\"volume of air printlaced(V2)=volume of ballon(V1)\")\n", - "print(\"mass of air printlaced(m2)in kg\")\n", - "R2=0.287*1000;#gas constant for air in J/kg k\n", - "m2=(P*V1)/(R2*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"gas constant for air(R2)=0.287 KJ/kg k\")\n", - "print(\"load lifting capacity due to buoyant force(m)in kg\")\n", - "m=m2-m1\n", - "print(\"m=\"),round(m,3)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.21;page no:31" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.21, Page:31 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\n", - "let initial receiver pressure(p1)=1 in pa\n", - "so final receiver pressure(p2)=in pa 0.25\n", - "perfect gas equation,p*V*m=m*R*T\n", - "differentiating and then integrating equation w.r.t to time(t) \n", - "we get t=-(V/v)*log(p2/p1)\n", - "so time(t)in min 110.9\n" - ] - } - ], - "source": [ - "#cal of time required\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.21, Page:31 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\")\n", - "v=0.25;#volume sucking rate of pump in m^3/min\n", - "V=20.;#volume of air vessel in m^3\n", - "p1=1.;#initial receiver pressure in pa\n", - "print(\"let initial receiver pressure(p1)=1 in pa\")\n", - "p2=p1/4.\n", - "print(\"so final receiver pressure(p2)=in pa\"),round(p2,2)\n", - "print(\"perfect gas equation,p*V*m=m*R*T\")\n", - "print(\"differentiating and then integrating equation w.r.t to time(t) \")\n", - "print(\"we get t=-(V/v)*log(p2/p1)\")\n", - "t=-(V/v)*math.log(p2/p1)\n", - "print(\"so time(t)in min\"),round(t,2)\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.22;page no:32" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.22, Page:32 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\n", - "first calculate gas constants for different gases in j/kg k\n", - "for nitrogen,R1= 296.9\n", - "for oxygen,R2= 259.8\n", - "for carbon dioxide,R3= 188.95\n", - "so the gas constant for mixture(Rm)in j/kg k\n", - "Rm= 288.09\n", - "now the specific heat at constant pressure for constituent gases in KJ/kg k\n", - "for nitrogen,Cp1= 1.039\n", - "for oxygen,Cp2= 0.909\n", - "for carbon dioxide,Cp3= 0.819\n", - "so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\n", - "Cpm= 1.0115\n", - "now no. of moles of constituents gases\n", - "for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg 0.143\n", - "for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg 0.028\n", - "for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg 0.0023\n", - "total no. of moles in mixture in mol\n", - "n= 0.1733\n", - "now mole fraction of constituent gases\n", - "for nitrogen,x1= 0.825\n", - "for oxygen,x2= 0.162\n", - "for carbon dioxide,x3= 0.0131\n", - "now the molecular weight of mixture(Mm)in kg/kmol\n", - "Mm= 28.86\n" - ] - } - ], - "source": [ - "#cal of specific heat at constant pressure for constituent gases \n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.22, Page:32 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\")\n", - "m=5;#mass of mixture of gas in kg\n", - "P=1.013*10**5;#pressure of mixture in pa\n", - "T=300;#temperature of mixture in k\n", - "M1=28.;#molecular weight of nitrogen(N2)\n", - "M2=32.;#molecular weight of oxygen(O2)\n", - "M3=44.;#molecular weight of carbon dioxide(CO2)\n", - "f1=0.80;#fraction of N2 in mixture\n", - "f2=0.18;#fraction of O2 in mixture\n", - "f3=0.02;#fraction of CO2 in mixture\n", - "k1=1.4;#ratio of specific heat capacities for N2\n", - "k2=1.4;#ratio of specific heat capacities for O2\n", - "k3=1.3;#ratio of specific heat capacities for CO2\n", - "R=8314;#universal gas constant in J/kg k\n", - "print(\"first calculate gas constants for different gases in j/kg k\")\n", - "R1=R/M1\n", - "print(\"for nitrogen,R1=\"),round(R1,1)\n", - "R2=R/M2\n", - "print(\"for oxygen,R2=\"),round(R2,1)\n", - "R3=R/M3\n", - "print(\"for carbon dioxide,R3=\"),round(R3,2)\n", - "print(\"so the gas constant for mixture(Rm)in j/kg k\")\n", - "Rm=f1*R1+f2*R2+f3*R3\n", - "print(\"Rm=\"),round(Rm,2)\n", - "print(\"now the specific heat at constant pressure for constituent gases in KJ/kg k\")\n", - "Cp1=((k1/(k1-1))*R1)/1000\n", - "print(\"for nitrogen,Cp1=\"),round(Cp1,3)\n", - "Cp2=((k2/(k2-1))*R2)/1000\n", - "print(\"for oxygen,Cp2=\"),round(Cp2,3)\n", - "Cp3=((k3/(k3-1))*R3)/1000\n", - "print(\"for carbon dioxide,Cp3=\"),round(Cp3,3)\n", - "print(\"so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\")\n", - "Cpm=f1*Cp1+f2*Cp2+f3*Cp3\n", - "print(\"Cpm=\"),round(Cpm,4)\n", - "print(\"now no. of moles of constituents gases\")\n", - "m1=f1*m\n", - "n1=m1/M1\n", - "print(\"for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg\"),round(n1,3)\n", - "m2=f2*m\n", - "n2=m2/M2\n", - "print(\"for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg\"),round(n2,3)\n", - "m3=f3*m\n", - "n3=m3/M3\n", - "print(\"for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg\"),round(n3,4)\n", - "print(\"total no. of moles in mixture in mol\")\n", - "n=n1+n2+n3\n", - "print(\"n=\"),round(n,4)\n", - "print(\"now mole fraction of constituent gases\")\n", - "x1=n1/n\n", - "print(\"for nitrogen,x1=\"),round(x1,3)\n", - "x2=n2/n\n", - "print(\"for oxygen,x2=\"),round(x2,3)\n", - "x3=n3/n\n", - "print(\"for carbon dioxide,x3=\"),round(x3,4)\n", - "print(\"now the molecular weight of mixture(Mm)in kg/kmol\")\n", - "Mm=M1*x1+M2*x2+M3*x3\n", - "print(\"Mm=\"),round(Mm,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.23;page no:33" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.23, Page:33 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\n", - "mole fraction of constituent gases\n", - "x=(ni/n)=(Vi/V)\n", - "take volume of mixture(V)=1 m^3\n", - "mole fraction of O2(x1)\n", - "x1= 0.18\n", - "mole fraction of N2(x2)\n", - "x2= 0.75\n", - "mole fraction of CO2(x3)\n", - "x3= 0.07\n", - "now molecular weight of mixture = molar mass(m)\n", - "m= 29.84\n", - "now gravimetric analysis refers to the mass fraction analysis\n", - "mass fraction of constituents\n", - "y=xi*Mi/m\n", - "mole fraction of O2\n", - "y1= 0.193\n", - "mole fraction of N2\n", - "y2= 0.704\n", - "mole fraction of CO2\n", - "y3= 0.103\n", - "now partial pressure of constituents = volume fraction * pressure of mixture\n", - "Pi=xi*P\n", - "partial pressure of O2(P1)in Mpa\n", - "P1= 0.09\n", - "partial pressure of N2(P2)in Mpa\n", - "P2= 0.375\n", - "partial pressure of CO2(P3)in Mpa\n", - "P3= 0.04\n", - "NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\n" - ] - } - ], - "source": [ - "#cal of pressure difference\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.23, Page:33 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\")\n", - "V1=0.18;#volume fraction of O2 in m^3\n", - "V2=0.75;#volume fraction of N2 in m^3\n", - "V3=0.07;#volume fraction of CO2 in m^3\n", - "P=0.5;#pressure of mixture in Mpa\n", - "T=(107+273);#temperature of mixture in k\n", - "M1=32;#molar mass of O2\n", - "M2=28;#molar mass of N2\n", - "M3=44;#molar mass of CO2\n", - "print(\"mole fraction of constituent gases\")\n", - "print(\"x=(ni/n)=(Vi/V)\")\n", - "V=1;# volume of mixture in m^3\n", - "print(\"take volume of mixture(V)=1 m^3\")\n", - "print(\"mole fraction of O2(x1)\")\n", - "x1=V1/V\n", - "print(\"x1=\"),round(x1,2)\n", - "print(\"mole fraction of N2(x2)\")\n", - "x2=V2/V\n", - "print(\"x2=\"),round(x2,2)\n", - "print(\"mole fraction of CO2(x3)\")\n", - "x3=V3/V\n", - "print(\"x3=\"),round(x3,2)\n", - "print(\"now molecular weight of mixture = molar mass(m)\")\n", - "m=x1*M1+x2*M2+x3*M3\n", - "print(\"m=\"),round(m,2)\n", - "print(\"now gravimetric analysis refers to the mass fraction analysis\")\n", - "print(\"mass fraction of constituents\")\n", - "print(\"y=xi*Mi/m\")\n", - "print(\"mole fraction of O2\")\n", - "y1=x1*M1/m\n", - "print(\"y1=\"),round(y1,3)\n", - "print(\"mole fraction of N2\")\n", - "y2=x2*M2/m\n", - "print(\"y2=\"),round(y2,3)\n", - "print(\"mole fraction of CO2\")\n", - "y3=x3*M3/m\n", - "print(\"y3=\"),round(y3,3)\n", - "print(\"now partial pressure of constituents = volume fraction * pressure of mixture\")\n", - "print(\"Pi=xi*P\")\n", - "print(\"partial pressure of O2(P1)in Mpa\")\n", - "p1=x1*P\n", - "print(\"P1=\"),round(p1,2)\n", - "print(\"partial pressure of N2(P2)in Mpa\")\n", - "P2=x2*P\n", - "print(\"P2=\"),round(P2,3)\n", - "P3=x3*P\n", - "print(\"partial pressure of CO2(P3)in Mpa\")\n", - "print(\"P3=\"),round(P3,2)\n", - "print(\"NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.24;page no:34" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.24, Page:34 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\n", - "volume of tank of N2(V1) in m^3= 3.0\n", - "volume of tank of CO2(V2) in m^3= 3.0\n", - "taking the adiabatic condition\n", - "no. of moles of N2(n1)\n", - "n1= 0.6\n", - "no. of moles of CO2(n2)\n", - "n2= 0.37\n", - "total no. of moles of mixture(n)in mol\n", - "n= 0.97\n", - "gas constant for N2(R1)in J/kg k\n", - "R1= 296.93\n", - "gas constant for CO2(R2)in J/kg k\n", - "R2=R/M2 188.95\n", - "specific heat of N2 at constant volume (Cv1) in J/kg k\n", - "Cv1= 742.32\n", - "specific heat of CO2 at constant volume (Cv2) in J/kg k\n", - "Cv2= 629.85\n", - "mass of N2(m1)in kg\n", - "m1= 16.84\n", - "mass of CO2(m2)in kg\n", - "m2= 16.28\n", - "let us consider the equilibrium temperature of mixture after adiabatic mixing at T\n", - "applying energy conservation principle\n", - "m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\n", - "equlibrium temperature(T)in k\n", - "=>T= 439.44\n", - "so the equlibrium pressure(P)in kpa\n", - "P= 591.55\n" - ] - } - ], - "source": [ - "#cal of equilibrium temperature,pressure of mixture\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.24, Page:34 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\")\n", - "V=6;#volume of tank in m^3\n", - "P1=800*10**3;#pressure of N2 gas tank in pa\n", - "T1=480.;#temperature of N2 gas tank in k\n", - "P2=400*10**3;#pressure of CO2 gas tank in pa\n", - "T2=390.;#temperature of CO2 gas tank in k\n", - "k1=1.4;#ratio of specific heat capacity for N2\n", - "k2=1.3;#ratio of specific heat capacity for CO2\n", - "R=8314.;#universal gas constant in J/kg k\n", - "M1=28.;#molecular weight of N2\n", - "M2=44.;#molecular weight of CO2\n", - "V1=V/2\n", - "print(\"volume of tank of N2(V1) in m^3=\"),round(V1,2)\n", - "V2=V/2\n", - "print(\"volume of tank of CO2(V2) in m^3=\"),round(V2,2)\n", - "print(\"taking the adiabatic condition\")\n", - "print(\"no. of moles of N2(n1)\")\n", - "n1=(P1*V1)/(R*T1)\n", - "print(\"n1=\"),round(n1,2)\n", - "print(\"no. of moles of CO2(n2)\")\n", - "n2=(P2*V2)/(R*T2)\n", - "print(\"n2=\"),round(n2,2)\n", - "print(\"total no. of moles of mixture(n)in mol\")\n", - "n=n1+n2\n", - "print(\"n=\"),round(n,2)\n", - "print(\"gas constant for N2(R1)in J/kg k\")\n", - "R1=R/M1\n", - "print(\"R1=\"),round(R1,2)\n", - "print(\"gas constant for CO2(R2)in J/kg k\")\n", - "R2=R/M2\n", - "print(\"R2=R/M2\"),round(R2,2)\n", - "print(\"specific heat of N2 at constant volume (Cv1) in J/kg k\")\n", - "Cv1=R1/(k1-1)\n", - "print(\"Cv1=\"),round(Cv1,2)\n", - "print(\"specific heat of CO2 at constant volume (Cv2) in J/kg k\")\n", - "Cv2=R2/(k2-1)\n", - "print(\"Cv2=\"),round(Cv2,2)\n", - "print(\"mass of N2(m1)in kg\")\n", - "m1=n1*M1\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"mass of CO2(m2)in kg\")\n", - "m2=n2*M2\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"let us consider the equilibrium temperature of mixture after adiabatic mixing at T\")\n", - "print(\"applying energy conservation principle\")\n", - "print(\"m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\")\n", - "print(\"equlibrium temperature(T)in k\")\n", - "T=((m1*Cv1*T1)+(m2*Cv2*T2))/((m1*Cv1)+(m2*Cv2))\n", - "print(\"=>T=\"),round(T,2)\n", - "print(\"so the equlibrium pressure(P)in kpa\")\n", - "P=(n*R*T)/(1000*V)\n", - "print(\"P=\"),round(P,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.25;page no:35" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.25, Page:35 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\n", - "since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\n", - "so the specific heat at constant pressure(Cp)in KJ/kg k\n", - "Cp= 7.608\n" - ] - } - ], - "source": [ - "#cal of specific heat of final mixture\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.25, Page:35 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\")\n", - "m1=2;#mass of H2 in kg\n", - "m2=3;#mass of He in kg\n", - "T=100;#temperature of container in k\n", - "Cp1=11.23;#specific heat at constant pressure for H2 in KJ/kg k\n", - "Cp2=5.193;#specific heat at constant pressure for He in KJ/kg k\n", - "print(\"since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\")\n", - "print(\"so the specific heat at constant pressure(Cp)in KJ/kg k\")\n", - "Cp=((Cp1*m1)+Cp2*m2)/(m1+m2)\n", - "print(\"Cp=\"),round(Cp,3)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.26;page no:35" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.26, Page:35 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\n", - "gas constant for H2(R1)in KJ/kg k\n", - "R1= 4.157\n", - "gas constant for N2(R2)in KJ/kg k\n", - "R2= 0.297\n", - "gas constant for CO2(R3)in KJ/kg k\n", - "R3= 0.189\n", - "so now gas constant for mixture(Rm)in KJ/kg k\n", - "Rm= 2.606\n", - "considering gas to be perfect gas\n", - "total mass of mixture(m)in kg\n", - "m= 30.0\n", - "capacity of vessel(V)in m^3\n", - "V= 231.57\n", - "now final temperature(Tf) is twice of initial temperature(Ti)\n", - "so take k=Tf/Ti=2\n", - "for constant volume heating,final pressure(Pf)in kpa shall be\n", - "Pf= 202.65\n" - ] - } - ], - "source": [ - "#cal of capacity and pressure in the vessel\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.26, Page:35 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\")\n", - "m1=18.;#mass of hydrogen(H2) in kg\n", - "m2=10.;#mass of nitrogen(N2) in kg\n", - "m3=2.;#mass of carbon dioxide(CO2) in kg\n", - "R=8.314;#universal gas constant in KJ/kg k\n", - "Pi=101.325;#atmospheric pressure in kpa\n", - "T=(27+273.15);#ambient temperature in k\n", - "M1=2;#molar mass of H2\n", - "M2=28;#molar mass of N2\n", - "M3=44;#molar mass of CO2\n", - "print(\"gas constant for H2(R1)in KJ/kg k\")\n", - "R1=R/M1\n", - "print(\"R1=\"),round(R1,3)\n", - "print(\"gas constant for N2(R2)in KJ/kg k\")\n", - "R2=R/M2\n", - "print(\"R2=\"),round(R2,3)\n", - "print(\"gas constant for CO2(R3)in KJ/kg k\")\n", - "R3=R/M3\n", - "print(\"R3=\"),round(R3,3)\n", - "print(\"so now gas constant for mixture(Rm)in KJ/kg k\")\n", - "Rm=(m1*R1+m2*R2+m3*R3)/(m1+m2+m3)\n", - "print(\"Rm=\"),round(Rm,3)\n", - "print(\"considering gas to be perfect gas\")\n", - "print(\"total mass of mixture(m)in kg\")\n", - "m=m1+m2+m3\n", - "print(\"m=\"),round(m,2)\n", - "print(\"capacity of vessel(V)in m^3\")\n", - "V=(m*Rm*T)/Pi\n", - "print(\"V=\"),round(V,2)\n", - "print(\"now final temperature(Tf) is twice of initial temperature(Ti)\")\n", - "k=2;#ratio of initial to final temperature\n", - "print(\"so take k=Tf/Ti=2\") \n", - "print(\"for constant volume heating,final pressure(Pf)in kpa shall be\")\n", - "Pf=Pi*k\n", - "print(\"Pf=\"),round(Pf,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.27;page no:36" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.27, Page:36 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\n", - "let inlet state be 1 and exit state be 2\n", - "by charles law volume and temperature can be related as\n", - "(V1/T1)=(V2/T2)\n", - "(V2/V1)=(T2/T1)\n", - "or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\n", - "since change in K.E=0\n", - "so (D2^2/D1^2)=T2/T1\n", - "D2/D1=sqrt(T2/T1)\n", - "say(D2/D1)=k\n", - "so exit to inlet diameter ratio(k) 1.29\n" - ] - } - ], - "source": [ - "#cal of exit to inlet diameter ratio\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.27, Page:36 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\")\n", - "T1=(27.+273.);#initial temperature of air in k\n", - "T2=500.;#final temperature of air in k\n", - "print(\"let inlet state be 1 and exit state be 2\")\n", - "print(\"by charles law volume and temperature can be related as\")\n", - "print(\"(V1/T1)=(V2/T2)\")\n", - "print(\"(V2/V1)=(T2/T1)\")\n", - "print(\"or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\")\n", - "print(\"since change in K.E=0\")\n", - "print(\"so (D2^2/D1^2)=T2/T1\")\n", - "print(\"D2/D1=sqrt(T2/T1)\")\n", - "print(\"say(D2/D1)=k\")\n", - "k=math.sqrt(T2/T1)\n", - "print(\"so exit to inlet diameter ratio(k)\"),round(k,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.28;page no:37" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.28, Page:37 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\n", - "gas constant for H2(R1)in KJ/kg k\n", - "R1= 4.157\n", - "say initial and final ststes are given by 1 and 2\n", - "mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\n", - "final pressure of hydrogen(P2)in cm of Hg\n", - "P2= 6.0\n", - "therefore pressure difference(P)in kpa\n", - "P= 93.33\n", - "mass pumped out(m)in kg\n", - "m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\n", - "here V1=V2=V and T1=T2=T\n", - "so m= 0.15\n", - "now during cooling upto 10 degree celcius,the process may be consider as constant volume process\n", - "say state before and after cooling are denoted by suffix 2 and 3\n", - "final pressure after cooling(P3)in kpa\n", - "P3= 7.546\n" - ] - } - ], - "source": [ - "#cal of final pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.28, Page:37 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\")\n", - "V=2;#volume of vessel in m^3\n", - "P1=76;#initial pressure or atmospheric pressure in cm of Hg\n", - "T=(27+273.15);#temperature of vessel in k\n", - "p=70;#final pressure in cm of Hg vaccum\n", - "R=8.314;#universal gas constant in KJ/kg k\n", - "M=2;#molecular weight of H2\n", - "print(\"gas constant for H2(R1)in KJ/kg k\")\n", - "R1=R/M\n", - "print(\"R1=\"),round(R1,3)\n", - "print(\"say initial and final ststes are given by 1 and 2\")\n", - "print(\"mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\")\n", - "print(\"final pressure of hydrogen(P2)in cm of Hg\")\n", - "P2=P1-p\n", - "print(\"P2=\"),round(P2,2)\n", - "print(\"therefore pressure difference(P)in kpa\")\n", - "P=((P1-P2)*101.325)/76\n", - "print(\"P=\"),round(P,2)\n", - "print(\"mass pumped out(m)in kg\")\n", - "print(\"m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\")\n", - "print(\"here V1=V2=V and T1=T2=T\")\n", - "m=(V*P)/(R1*T)\n", - "print(\"so m=\"),round(m,2)\n", - "print(\"now during cooling upto 10 degree celcius,the process may be consider as constant volume process\")\n", - "print(\"say state before and after cooling are denoted by suffix 2 and 3\")\n", - "T3=(10+273.15);#final temperature after cooling in k\n", - "print(\"final pressure after cooling(P3)in kpa\")\n", - "P3=(T3/T)*P2*(101.325/76)\n", - "print(\"P3=\"),round(P3,3)\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/chapter_1_3.ipynb b/_Engineering_Thermodynamics_by__O._Singh/chapter_1_3.ipynb deleted file mode 100755 index 9474d100..00000000 --- a/_Engineering_Thermodynamics_by__O._Singh/chapter_1_3.ipynb +++ /dev/null @@ -1,1777 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# chapter 1:Fundemental concepts and definitions" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.1;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.1, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\n", - "pressure difference(p)in pa\n", - "p= 39755.7\n" - ] - } - ], - "source": [ - "#cal of pressure difference\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.1, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 1\"\n", - "h=30*10**-2;#manometer deflection of mercury in m\n", - "g=9.78;#acceleration due to gravity in m/s^2\n", - "rho=13550;#density of mercury at room temperature in kg/m^3\n", - "print\"pressure difference(p)in pa\"\n", - "p=rho*g*h\n", - "print\"p=\",round(p,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.2;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.2, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\n", - "effort required for lifting the lid(E)in N\n", - "E= 7115.48\n" - ] - } - ], - "source": [ - "#cal of effort required for lifting the lid\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.2, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 2\"\n", - "d=30*10**-2;#diameter of cylindrical vessel in m\n", - "h=76*10**-2;#atmospheric pressure in m of mercury\n", - "g=9.78;#acceleration due to gravity in m/s^2\n", - "rho=13550;#density of mercury at room temperature in kg/m^3\n", - "print\"effort required for lifting the lid(E)in N\"\n", - "E=(rho*g*h)*(3.14*d**2)/4\n", - "print\"E=\",round(E,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.3;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.3, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\n", - "pressure measured by manometer is gauge pressure(Pg)in kpa\n", - "Pg=rho*g*h/10^3\n", - "actual pressure of the air(P)in kpa\n", - "P= 140.76\n" - ] - } - ], - "source": [ - "#cal of actual pressure of the air\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.3, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 3\"\n", - "h=30*10**-2;# pressure of compressed air in m of mercury\n", - "Patm=101*10**3;#atmospheric pressure in pa\n", - "g=9.78;#acceleration due to gravity in m/s^2\n", - "rho=13550;#density of mercury at room temperature in kg/m^3\n", - "print\"pressure measured by manometer is gauge pressure(Pg)in kpa\"\n", - "print\"Pg=rho*g*h/10^3\"\n", - "Pg=rho*g*h/10**3\n", - "print\"actual pressure of the air(P)in kpa\"\n", - "P=Pg+Patm/10**3\n", - "print\"P=\",round(P,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.4;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.4, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\n", - "density of oil(RHOoil)in kg/m^3\n", - "RHOoil=sg*RHOw\n", - "gauge pressure(Pg)in kpa\n", - "Pg= 7.848\n" - ] - } - ], - "source": [ - "#cal of gauge pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.4, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 4\"\n", - "h=1;#depth of oil tank in m\n", - "sg=0.8;#specific gravity of oil\n", - "RHOw=1000;#density of water in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print\"density of oil(RHOoil)in kg/m^3\"\n", - "print\"RHOoil=sg*RHOw\"\n", - "RHOoil=sg*RHOw\n", - "print\"gauge pressure(Pg)in kpa\"\n", - "Pg=RHOoil*g*h/10**3\n", - "print\"Pg=\",round(Pg,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.5;page no:22" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.5, Page:22 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\n", - "atmospheric pressure(Patm)in kpa\n", - "Patm=rho*g*h2/10^3\n", - "pressure due to mercury column at AB(Pab)in kpa\n", - "Pab=rho*g*h1/10^3\n", - "pressure exerted by gas(Pgas)in kpa\n", - "Pgas= 154.76\n" - ] - } - ], - "source": [ - "#cal of pressure exerted by gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.5, Page:22 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 5\"\n", - "rho=13.6*10**3;#density of mercury in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "h1=40*10**-2;#difference of height in mercury column in m as shown in figure\n", - "h2=76*10**-2;#barometer reading of mercury in m\n", - "print\"atmospheric pressure(Patm)in kpa\"\n", - "print\"Patm=rho*g*h2/10^3\"\n", - "Patm=rho*g*h2/10**3\n", - "print\"pressure due to mercury column at AB(Pab)in kpa\"\n", - "print\"Pab=rho*g*h1/10^3\"\n", - "Pab=rho*g*h1/10**3\n", - "print\"pressure exerted by gas(Pgas)in kpa\"\n", - "Pgas=Patm+Pab\n", - "print\"Pgas=\",round(Pgas,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.6;page no:23" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.6, Page:23 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\n", - "by law of conservation of energy\n", - "potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\n", - "so m*g*h = m*Cp*deltaT*4.18*1000\n", - "change in temperature of water(deltaT) in degree celcius\n", - "deltaT= 2.35\n" - ] - } - ], - "source": [ - "#cal of change in temperature of water\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.6, Page:23 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 6\"\n", - "m=1;#mass of water in kg\n", - "h=1000;#height from which water fall in m\n", - "Cp=1;#specific heat of water in kcal/kg k\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print\"by law of conservation of energy\"\n", - "print\"potential energy(m*g*h)in joule = heat required for heating water(m*Cp*deltaT*1000*4.18)in joule\"\n", - "print\"so m*g*h = m*Cp*deltaT*4.18*1000\"\n", - "print\"change in temperature of water(deltaT) in degree celcius\"\n", - "deltaT=(g*h)/(4.18*1000*Cp)\n", - "print\"deltaT=\",round(deltaT,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.7;page no:23" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.7, Page:23 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\n", - "mass of object(m)in kg\n", - "m=w1/g1\n", - "spring balance reading=gravitational force in mass(F)in N\n", - "F= 86.65\n" - ] - } - ], - "source": [ - "#cal of spring balance reading\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.7, Page:23 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 7\"\n", - "w1=100;#weight of object at standard gravitational acceleration in N\n", - "g1=9.81;#acceleration due to gravity in m/s^2\n", - "g2=8.5;#gravitational acceleration at some location\n", - "print\"mass of object(m)in kg\"\n", - "print\"m=w1/g1\"\n", - "m=w1/g1\n", - "print\"spring balance reading=gravitational force in mass(F)in N\"\n", - "F=m*g2\n", - "print\"F=\",round(F,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.8;page no:24" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.8, Page:24 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\n", - "pressure measured by manometer(P) in pa\n", - "p=rho*g*h\n", - "now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\n", - "mass of piston(m)in kg\n", - "so m= 28.84\n" - ] - } - ], - "source": [ - "#cal of mass of piston\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.8, Page:24 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 8\"\n", - "d=15*10**-2;#diameter of cylinder in m\n", - "h=12*10**-2;#manometer height difference in m of mercury\n", - "rho=13.6*10**3;#density of mercury in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print\"pressure measured by manometer(P) in pa\"\n", - "print\"p=rho*g*h\"\n", - "p=rho*g*h\n", - "print\"now weight of piston(m*g) = upward thrust by gas(p*math.pi*d^2/4)\"\n", - "print\"mass of piston(m)in kg\"\n", - "m=(p*math.pi*d**2)/(4*g)\n", - "print\"so m=\",round(m,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.9;page no:24" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.9, Page:24 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\n", - "balancing pressure at plane BC in figure we get\n", - "Psteam+Pwater=Patm+Pmercury\n", - "now 1.atmospheric pressure(Patm)in pa\n", - "Patm= 101396.16\n", - "2.pressure due to water(Pwater)in pa\n", - "Pwater= 196.2\n", - "3.pressure due to mercury(Pmercury)in pa\n", - "Pmercury=RHOm*g*h3 13341.6\n", - "using balancing equation\n", - "Psteam=Patm+Pmercury-Pwater\n", - "so pressure of steam(Psteam)in kpa\n", - "Psteam= 114.54\n" - ] - } - ], - "source": [ - "#cal of pressure due to atmosphere,water,mercury,steam\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.9, Page:24 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 9\")\n", - "RHOm=13.6*10**3;#density of mercury in kg/m^3\n", - "RHOw=1000;#density of water in kg/m^3\n", - "h1=76*10**-2;#barometer reading in m of mercury\n", - "h2=2*10**-2;#height raised by water in manometer tube in m \n", - "h3=10*10**-2;#height raised by mercury in manometer tube in m \n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"balancing pressure at plane BC in figure we get\")\n", - "print(\"Psteam+Pwater=Patm+Pmercury\")\n", - "print(\"now 1.atmospheric pressure(Patm)in pa\")\n", - "Patm=RHOm*g*h1\n", - "print(\"Patm=\"),round(Patm,2)\n", - "print(\"2.pressure due to water(Pwater)in pa\")\n", - "Pwater=RHOw*g*h2\n", - "print(\"Pwater=\"),round(Pwater,2)\n", - "print(\"3.pressure due to mercury(Pmercury)in pa\")\n", - "Pmercury=RHOm*g*h3\n", - "print(\"Pmercury=RHOm*g*h3\"),round(Pmercury,2)\n", - "print(\"using balancing equation\")\n", - "print(\"Psteam=Patm+Pmercury-Pwater\")\n", - "print(\"so pressure of steam(Psteam)in kpa\")\n", - "Psteam=(Patm+Pmercury-Pwater)/1000\n", - "print(\"Psteam=\"),round(Psteam,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.10;page no:24" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.10, Page:24 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\n", - "atmospheric pressure(Patm)in kpa\n", - "absolute temperature in compartment A(Pa) in kpa\n", - "Pa= 496.06\n", - "absolute temperature in compartment B(Pb) in kpa\n", - "Pb= 246.06\n", - "absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\n" - ] - } - ], - "source": [ - "#cal of \"absolute temperature in compartment A,B\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.10, Page:24 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 10\")\n", - "h=720*10**-3;#barometer reading in m of Hg\n", - "Pga=400;#gauge pressure in compartment A in kpa\n", - "Pgb=150;#gauge pressure in compartment B in kpa\n", - "rho=13.6*10**3;#density of mercury in kg/m^3\n", - "g=9.81;#acceleration due to gravity in m/s^2\n", - "print(\"atmospheric pressure(Patm)in kpa\")\n", - "Patm=(rho*g*h)/1000\n", - "print(\"absolute temperature in compartment A(Pa) in kpa\")\n", - "Pa=Pga+Patm\n", - "print\"Pa=\",round(Pa,2)\n", - "print\"absolute temperature in compartment B(Pb) in kpa\"\n", - "Pb=Pgb+Patm\n", - "print\"Pb=\",round(Pb,2)\n", - "print\"absolute pressure in compartments in A & B=496.06 kpa & 246.06 kpa\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.11;page no:25" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.11, Page:25 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\n", - "the pressure of air in air tank can be obtained by equalising pressures at some reference line\n", - "P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\n", - "so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\n", - "air pressure(P1)in kpa 139.81\n" - ] - } - ], - "source": [ - "#cal of air pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.11, Page:25 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 11\")\n", - "Patm=90*10**3;#atmospheric pressure in pa\n", - "RHOw=1000;#density of water in kg/m^3\n", - "RHOm=13600;#density of mercury in kg/m^3\n", - "RHOo=850;#density of oil in kg/m^3\n", - "g=9.81;#acceleration due to ggravity in m/s^2\n", - "h1=.15;#height difference between water column in m\n", - "h2=.25;#height difference between oil column in m\n", - "h3=.4;#height difference between mercury column in m\n", - "print\"the pressure of air in air tank can be obtained by equalising pressures at some reference line\"\n", - "print\"P1+RHOw*g*h1+RHOo*g*h2 = Patm+RHOm*g*h3\"\n", - "print\"so P1 = Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2\"\n", - "P1=(Patm+RHOm*g*h3-RHOw*g*h1-RHOo*g*h2)/1000\n", - "print\"air pressure(P1)in kpa\",round(P1,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.12;page no:26" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.12, Page:26 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\n", - "mass of object(m)in kg\n", - "m=F/g\n", - "kinetic energy(E)in J is given by\n", - "E= 140625000.0\n" - ] - } - ], - "source": [ - "#cal of kinetic energy\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.12, Page:26 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 12\"\n", - "v=750;#relative velocity of object with respect to earth in m/sec\n", - "F=4000;#gravitational force in N\n", - "g=8;#acceleration due to gravity in m/s^2\n", - "print\"mass of object(m)in kg\"\n", - "print\"m=F/g\"\n", - "m=F/g\n", - "print\"kinetic energy(E)in J is given by\"\n", - "E=m*v**2/2\n", - "print\"E=\",round(E)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.13;page no:26" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.13, Page:26 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\n", - "characteristics gas constant(R2)in kJ/kg k\n", - "molecular weight of gas(m)in kg/kg mol= 16.63\n", - "NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\n" - ] - } - ], - "source": [ - "#cal of molecular weight of gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.13, Page:26 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 13\"\n", - "Cp=2.286;#specific heat at constant pressure in kJ/kg k\n", - "Cv=1.786;#specific heat at constant volume in kJ/kg k\n", - "R1=8.3143;#universal gas constant in kJ/kg k\n", - "print\"characteristics gas constant(R2)in kJ/kg k\"\n", - "R2=Cp-Cv\n", - "m=R1/R2\n", - "print\"molecular weight of gas(m)in kg/kg mol=\",round(m,2)\n", - "print\"NOTE=>Their is some calculation mistake while calaulating gas constant in book,which is corrected above hence answer may vary.\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.14;page no:26" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.14, Page:26 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\n", - "using perfect gas equation\n", - "P1*V1/T1 = P2*V2/T2\n", - "=>T2=(P2*V2*T1)/(P1*V1)\n", - "so final temperature of gas(T2)in k\n", - "or final temperature of gas(T2)in degree celcius= 127.0\n" - ] - } - ], - "source": [ - "#cal of final temperature of gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.14, Page:26 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 14\"\n", - "P1=750*10**3;#initial pressure of gas in pa\n", - "V1=0.2;#initial volume of gas in m^3\n", - "T1=600;#initial temperature of gas in k\n", - "P2=2*10**5;#final pressure of gas i pa\n", - "V2=0.5;#final volume of gas in m^3\n", - "print\"using perfect gas equation\"\n", - "print\"P1*V1/T1 = P2*V2/T2\"\n", - "print\"=>T2=(P2*V2*T1)/(P1*V1)\"\n", - "print\"so final temperature of gas(T2)in k\"\n", - "T2=(P2*V2*T1)/(P1*V1)\n", - "T2=T2-273\n", - "print\"or final temperature of gas(T2)in degree celcius=\",round(T2,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.15;page no:27" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.15, Page:27 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\n", - "from perfect gas equation we get\n", - "initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\n", - "m1= 5.807\n", - "final mass of air(m2 in kg)=(P2*V2)/(R*T2)\n", - "m2= 3.111\n", - "mass of air removed(m)in kg 2.696\n", - "volume of this mass of air(V) at initial states in m^3= 2.32\n" - ] - } - ], - "source": [ - "#cal of volume of this mass of air(V) at initial states\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.15, Page:27 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 15\"\n", - "P1=100*10**3;#initial pressure of air in pa\n", - "V1=5.;#initial volume of air in m^3\n", - "T1=300.;#initial temperature of gas in k\n", - "P2=50*10**3;#final pressure of air in pa\n", - "V2=5.;#final volume of air in m^3\n", - "T2=(280.);#final temperature of air in K\n", - "R=287.;#gas constant on J/kg k\n", - "print\"from perfect gas equation we get\"\n", - "print\"initial mass of air(m1 in kg)=(P1*V1)/(R*T1)\"\n", - "m1=(P1*V1)/(R*T1)\n", - "print(\"m1=\"),round(m1,3)\n", - "print\"final mass of air(m2 in kg)=(P2*V2)/(R*T2)\"\n", - "m2=(P2*V2)/(R*T2)\n", - "print(\"m2=\"),round(m2,3)\n", - "m=m1-m2\n", - "print\"mass of air removed(m)in kg\",round(m,3)\n", - "V=m*R*T1/P1\n", - "print\"volume of this mass of air(V) at initial states in m^3=\",round(V,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.16;page no:27" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.16, Page:27 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\n", - "here V1=V2\n", - "so P1/T1=P2/T2\n", - "final temperature of hydrogen gas(T2)in k\n", - "=>T2=P2*T1/P1\n", - "now R=(Cp-Cv) in KJ/kg k\n", - "And volume of cylinder(V1)in m^3\n", - "V1=(math.pi*d^2*l)/4\n", - "mass of hydrogen gas(m)in kg\n", - "m= 0.254\n", - "now heat supplied(Q)in KJ\n", - "Q= 193.93\n" - ] - } - ], - "source": [ - "#cal of heat supplied\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.16, Page:27 \\n \\n\"\n", - "print\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 16\"\n", - "d=1;#diameter of cylinder in m\n", - "l=4;#length of cylinder in m\n", - "P1=100*10**3;#initial pressureof hydrogen gas in pa\n", - "T1=(27+273);#initial temperature of hydrogen gas in k\n", - "P2=125*10**3;#final pressureof hydrogen gas in pa\n", - "Cp=14.307;#specific heat at constant pressure in KJ/kg k\n", - "Cv=10.183;#specific heat at constant volume in KJ/kg k\n", - "print\"here V1=V2\"\n", - "print\"so P1/T1=P2/T2\"\n", - "print\"final temperature of hydrogen gas(T2)in k\"\n", - "print\"=>T2=P2*T1/P1\"\n", - "T2=P2*T1/P1\n", - "print\"now R=(Cp-Cv) in KJ/kg k\"\n", - "R=Cp-Cv\n", - "print\"And volume of cylinder(V1)in m^3\"\n", - "print\"V1=(math.pi*d^2*l)/4\"\n", - "V1=(math.pi*d**2*l)/4\n", - "print\"mass of hydrogen gas(m)in kg\"\n", - "m=(P1*V1)/(1000*R*T1)\n", - "print\"m=\",round(m,3)\n", - "print\"now heat supplied(Q)in KJ\"\n", - "Q=m*Cv*(T2-T1)\n", - "print\"Q=\",round(Q,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.17;page no:28" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.17, Page:28 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\n", - "final total volume(V)in m^3\n", - "V=V1*V2\n", - "total mass of air(m)in kg\n", - "m=m1+m2\n", - "final pressure of air(P)in kpa\n", - "using perfect gas equation\n", - "P= 516.6\n" - ] - } - ], - "source": [ - "#cal of final pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.17, Page:28 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 17\")\n", - "V1=2.;#volume of first cylinder in m^3\n", - "V2=2.;#volume of second cylinder in m^3\n", - "T=(27+273);#temperature of system in k\n", - "m1=20.;#mass of air in first vessel in kg\n", - "m2=4.;#mass of air in second vessel in kg\n", - "R=287.;#gas constant J/kg k\n", - "print(\"final total volume(V)in m^3\")\n", - "print(\"V=V1*V2\")\n", - "V=V1*V2\n", - "print(\"total mass of air(m)in kg\")\n", - "print(\"m=m1+m2\")\n", - "m=m1+m2\n", - "print(\"final pressure of air(P)in kpa\")\n", - "print(\"using perfect gas equation\")\n", - "P=(m*R*T)/(1000*V)\n", - "print\"P=\",round(P,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.18;page no:28" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.18, Page:28 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\n", - "1.By considering it as a PERFECT GAS\n", - "gas constant for CO2(Rco2)\n", - "Rco2=(J/Kg.k) 188.9\n", - "Also P*V=M*Rco2*T\n", - "pressure of CO2 as perfect gas(P)in N/m^2\n", - "P=(m*Rco2*T)/V 141683.71\n", - "2.By considering as a REAL GAS\n", - "values of vanderwaal constants a,b can be seen from the table which are\n", - "a=(N m^4/(kg mol)^2) 362850.0\n", - "b=(m^3/kg mol) 0.03\n", - "now specific volume(v)in m^3/kg mol\n", - "v= 17.604\n", - "now substituting the value of all variables in vanderwaal equation\n", - "(P+(a/v^2))*(v-b)=R*T\n", - "pressure of CO2 as real gas(P)in N/m^2\n", - "P= 140766.02\n" - ] - } - ], - "source": [ - "#cal of pressure of CO2 as perfect,real gas\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.18, Page:28 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 18\")\n", - "m=5;#mass of CO2 in kg\n", - "V=2;#volume of vesssel in m^3\n", - "T=(27+273);#temperature of vessel in k\n", - "R=8.314*10**3;#universal gas constant in J/kg k\n", - "M=44.01;#molecular weight of CO2 \n", - "print(\"1.By considering it as a PERFECT GAS\")\n", - "print(\"gas constant for CO2(Rco2)\")\n", - "Rco2=R/M\n", - "print(\"Rco2=(J/Kg.k)\"),round(Rco2,1)\n", - "print(\"Also P*V=M*Rco2*T\")\n", - "print(\"pressure of CO2 as perfect gas(P)in N/m^2\")\n", - "P=(m*Rco2*T)/V\n", - "print(\"P=(m*Rco2*T)/V \"),round(P,2)\n", - "print(\"2.By considering as a REAL GAS\")\n", - "print(\"values of vanderwaal constants a,b can be seen from the table which are\")\n", - "a=3628.5*10**2#vanderwall constant in N m^4/(kg mol)^2\n", - "b=3.14*10**-2# vanderwall constant in m^3/kg mol\n", - "print(\"a=(N m^4/(kg mol)^2) \"),round(a,2)\n", - "print(\"b=(m^3/kg mol)\"),round(b,2)\n", - "print(\"now specific volume(v)in m^3/kg mol\")\n", - "v=V*M/m\n", - "print(\"v=\"),round(v,3)\n", - "print(\"now substituting the value of all variables in vanderwaal equation\")\n", - "print(\"(P+(a/v^2))*(v-b)=R*T\")\n", - "print(\"pressure of CO2 as real gas(P)in N/m^2\")\n", - "P=((R*T)/(v-b))-(a/v**2)\n", - "print(\"P=\"),round(P,2)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.19;page no:29" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.19, Page:29 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\n", - "1.considering as perfect gas\n", - "specific volume(V)in m^3/kg\n", - "V= 0.0186\n", - "2.considering compressibility effects\n", - "reduced pressure(P)in pa\n", - "p= 0.8\n", - "reduced temperature(t)in k\n", - "t= 1.1\n", - "from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\n", - "we get Z=0.785\n", - "now actual specific volume(v)in m^3/kg\n", - "v= 0.0146\n" - ] - } - ], - "source": [ - "#cal of specific volume of steam\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.19, Page:29 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 19\")\n", - "P=17672;#pressure of steam on kpa\n", - "T=712;#temperature of steam in k\n", - "Pc=22.09;#critical pressure of steam in Mpa\n", - "Tc=647.3;#critical temperature of steam in k\n", - "R=0.4615;#gas constant for steam in KJ/kg k\n", - "print(\"1.considering as perfect gas\")\n", - "print(\"specific volume(V)in m^3/kg\")\n", - "V=R*T/P\n", - "print(\"V=\"),round(V,4)\n", - "print(\"2.considering compressibility effects\")\n", - "print(\"reduced pressure(P)in pa\")\n", - "p=P/(Pc*1000)\n", - "print(\"p=\"),round(p,2)\n", - "print(\"reduced temperature(t)in k\")\n", - "t=T/Tc\n", - "print(\"t=\"),round(t,2)\n", - "print(\"from generalised compressibility chart,compressibility factor(Z)can be seen for reduced pressure and reduced temperatures of 0.8 and 1.1\")\n", - "print(\"we get Z=0.785\")\n", - "Z=0.785;#compressibility factor\n", - "print(\"now actual specific volume(v)in m^3/kg\")\n", - "v=Z*V\n", - "print(\"v=\"),round(v,4)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.20;page no:30" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.20, Page:30 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\n", - "volume of ballon(V1)in m^3\n", - "V1= 65.45\n", - "molecular mass of hydrogen(M)\n", - "M=2\n", - "gas constant for H2(R1)in J/kg k\n", - "R1= 4157.0\n", - "mass of H2 in ballon(m1)in kg\n", - "m1= 5.316\n", - "volume of air printlaced(V2)=volume of ballon(V1)\n", - "mass of air printlaced(m2)in kg\n", - "m2= 79.66\n", - "gas constant for air(R2)=0.287 KJ/kg k\n", - "load lifting capacity due to buoyant force(m)in kg\n", - "m= 74.343\n" - ] - } - ], - "source": [ - "#estimation of maximum load that can be lifted \n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.20, Page:30 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 20\")\n", - "d=5.;#diameter of ballon in m\n", - "T1=(27.+273.);#temperature of hydrogen in k\n", - "P=1.013*10**5;#atmospheric pressure in pa\n", - "T2=(17.+273.);#temperature of surrounding air in k\n", - "R=8.314*10**3;#gas constant in J/kg k\n", - "print(\"volume of ballon(V1)in m^3\")\n", - "V1=(4./3.)*math.pi*((d/2)**3)\n", - "print(\"V1=\"),round(V1,2)\n", - "print(\"molecular mass of hydrogen(M)\")\n", - "print(\"M=2\")\n", - "M=2;#molecular mass of hydrogen\n", - "print(\"gas constant for H2(R1)in J/kg k\")\n", - "R1=R/M\n", - "print(\"R1=\"),round(R1,2)\n", - "print(\"mass of H2 in ballon(m1)in kg\")\n", - "m1=(P*V1)/(R1*T1)\n", - "print(\"m1=\"),round(m1,3)\n", - "print(\"volume of air printlaced(V2)=volume of ballon(V1)\")\n", - "print(\"mass of air printlaced(m2)in kg\")\n", - "R2=0.287*1000;#gas constant for air in J/kg k\n", - "m2=(P*V1)/(R2*T2)\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"gas constant for air(R2)=0.287 KJ/kg k\")\n", - "print(\"load lifting capacity due to buoyant force(m)in kg\")\n", - "m=m2-m1\n", - "print(\"m=\"),round(m,3)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.21;page no:31" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.21, Page:31 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\n", - "let initial receiver pressure(p1)=1 in pa\n", - "so final receiver pressure(p2)=in pa 0.25\n", - "perfect gas equation,p*V*m=m*R*T\n", - "differentiating and then integrating equation w.r.t to time(t) \n", - "we get t=-(V/v)*log(p2/p1)\n", - "so time(t)in min 110.9\n" - ] - } - ], - "source": [ - "#cal of time required\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.21, Page:31 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 21\")\n", - "v=0.25;#volume sucking rate of pump in m^3/min\n", - "V=20.;#volume of air vessel in m^3\n", - "p1=1.;#initial receiver pressure in pa\n", - "print(\"let initial receiver pressure(p1)=1 in pa\")\n", - "p2=p1/4.\n", - "print(\"so final receiver pressure(p2)=in pa\"),round(p2,2)\n", - "print(\"perfect gas equation,p*V*m=m*R*T\")\n", - "print(\"differentiating and then integrating equation w.r.t to time(t) \")\n", - "print(\"we get t=-(V/v)*log(p2/p1)\")\n", - "t=-(V/v)*math.log(p2/p1)\n", - "print(\"so time(t)in min\"),round(t,2)\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.22;page no:32" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.22, Page:32 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\n", - "first calculate gas constants for different gases in j/kg k\n", - "for nitrogen,R1= 296.9\n", - "for oxygen,R2= 259.8\n", - "for carbon dioxide,R3= 188.95\n", - "so the gas constant for mixture(Rm)in j/kg k\n", - "Rm= 288.09\n", - "now the specific heat at constant pressure for constituent gases in KJ/kg k\n", - "for nitrogen,Cp1= 1.039\n", - "for oxygen,Cp2= 0.909\n", - "for carbon dioxide,Cp3= 0.819\n", - "so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\n", - "Cpm= 1.0115\n", - "now no. of moles of constituents gases\n", - "for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg 0.143\n", - "for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg 0.028\n", - "for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg 0.0023\n", - "total no. of moles in mixture in mol\n", - "n= 0.1733\n", - "now mole fraction of constituent gases\n", - "for nitrogen,x1= 0.825\n", - "for oxygen,x2= 0.162\n", - "for carbon dioxide,x3= 0.0131\n", - "now the molecular weight of mixture(Mm)in kg/kmol\n", - "Mm= 28.86\n" - ] - } - ], - "source": [ - "#cal of specific heat at constant pressure for constituent gases \n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.22, Page:32 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 22\")\n", - "m=5;#mass of mixture of gas in kg\n", - "P=1.013*10**5;#pressure of mixture in pa\n", - "T=300;#temperature of mixture in k\n", - "M1=28.;#molecular weight of nitrogen(N2)\n", - "M2=32.;#molecular weight of oxygen(O2)\n", - "M3=44.;#molecular weight of carbon dioxide(CO2)\n", - "f1=0.80;#fraction of N2 in mixture\n", - "f2=0.18;#fraction of O2 in mixture\n", - "f3=0.02;#fraction of CO2 in mixture\n", - "k1=1.4;#ratio of specific heat capacities for N2\n", - "k2=1.4;#ratio of specific heat capacities for O2\n", - "k3=1.3;#ratio of specific heat capacities for CO2\n", - "R=8314;#universal gas constant in J/kg k\n", - "print(\"first calculate gas constants for different gases in j/kg k\")\n", - "R1=R/M1\n", - "print(\"for nitrogen,R1=\"),round(R1,1)\n", - "R2=R/M2\n", - "print(\"for oxygen,R2=\"),round(R2,1)\n", - "R3=R/M3\n", - "print(\"for carbon dioxide,R3=\"),round(R3,2)\n", - "print(\"so the gas constant for mixture(Rm)in j/kg k\")\n", - "Rm=f1*R1+f2*R2+f3*R3\n", - "print(\"Rm=\"),round(Rm,2)\n", - "print(\"now the specific heat at constant pressure for constituent gases in KJ/kg k\")\n", - "Cp1=((k1/(k1-1))*R1)/1000\n", - "print(\"for nitrogen,Cp1=\"),round(Cp1,3)\n", - "Cp2=((k2/(k2-1))*R2)/1000\n", - "print(\"for oxygen,Cp2=\"),round(Cp2,3)\n", - "Cp3=((k3/(k3-1))*R3)/1000\n", - "print(\"for carbon dioxide,Cp3=\"),round(Cp3,3)\n", - "print(\"so the specific heat at constant pressure for mixture(Cpm)in KJ/kg k\")\n", - "Cpm=f1*Cp1+f2*Cp2+f3*Cp3\n", - "print(\"Cpm=\"),round(Cpm,4)\n", - "print(\"now no. of moles of constituents gases\")\n", - "m1=f1*m\n", - "n1=m1/M1\n", - "print(\"for nitrogen,n1=m1/M1 in mol,where m1=f1*m in kg\"),round(n1,3)\n", - "m2=f2*m\n", - "n2=m2/M2\n", - "print(\"for oxygen,n2=m2/M2 in mol,where m2=f2*m in kg\"),round(n2,3)\n", - "m3=f3*m\n", - "n3=m3/M3\n", - "print(\"for carbon dioxide,n3=m3/M3 in mol,where m3=f3*m in kg\"),round(n3,4)\n", - "print(\"total no. of moles in mixture in mol\")\n", - "n=n1+n2+n3\n", - "print(\"n=\"),round(n,4)\n", - "print(\"now mole fraction of constituent gases\")\n", - "x1=n1/n\n", - "print(\"for nitrogen,x1=\"),round(x1,3)\n", - "x2=n2/n\n", - "print(\"for oxygen,x2=\"),round(x2,3)\n", - "x3=n3/n\n", - "print(\"for carbon dioxide,x3=\"),round(x3,4)\n", - "print(\"now the molecular weight of mixture(Mm)in kg/kmol\")\n", - "Mm=M1*x1+M2*x2+M3*x3\n", - "print(\"Mm=\"),round(Mm,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.23;page no:33" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.23, Page:33 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\n", - "mole fraction of constituent gases\n", - "x=(ni/n)=(Vi/V)\n", - "take volume of mixture(V)=1 m^3\n", - "mole fraction of O2(x1)\n", - "x1= 0.18\n", - "mole fraction of N2(x2)\n", - "x2= 0.75\n", - "mole fraction of CO2(x3)\n", - "x3= 0.07\n", - "now molecular weight of mixture = molar mass(m)\n", - "m= 29.84\n", - "now gravimetric analysis refers to the mass fraction analysis\n", - "mass fraction of constituents\n", - "y=xi*Mi/m\n", - "mole fraction of O2\n", - "y1= 0.193\n", - "mole fraction of N2\n", - "y2= 0.704\n", - "mole fraction of CO2\n", - "y3= 0.103\n", - "now partial pressure of constituents = volume fraction * pressure of mixture\n", - "Pi=xi*P\n", - "partial pressure of O2(P1)in Mpa\n", - "P1= 0.09\n", - "partial pressure of N2(P2)in Mpa\n", - "P2= 0.375\n", - "partial pressure of CO2(P3)in Mpa\n", - "P3= 0.04\n", - "NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\n" - ] - } - ], - "source": [ - "#cal of pressure difference\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.23, Page:33 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 23\")\n", - "V1=0.18;#volume fraction of O2 in m^3\n", - "V2=0.75;#volume fraction of N2 in m^3\n", - "V3=0.07;#volume fraction of CO2 in m^3\n", - "P=0.5;#pressure of mixture in Mpa\n", - "T=(107+273);#temperature of mixture in k\n", - "M1=32;#molar mass of O2\n", - "M2=28;#molar mass of N2\n", - "M3=44;#molar mass of CO2\n", - "print(\"mole fraction of constituent gases\")\n", - "print(\"x=(ni/n)=(Vi/V)\")\n", - "V=1;# volume of mixture in m^3\n", - "print(\"take volume of mixture(V)=1 m^3\")\n", - "print(\"mole fraction of O2(x1)\")\n", - "x1=V1/V\n", - "print(\"x1=\"),round(x1,2)\n", - "print(\"mole fraction of N2(x2)\")\n", - "x2=V2/V\n", - "print(\"x2=\"),round(x2,2)\n", - "print(\"mole fraction of CO2(x3)\")\n", - "x3=V3/V\n", - "print(\"x3=\"),round(x3,2)\n", - "print(\"now molecular weight of mixture = molar mass(m)\")\n", - "m=x1*M1+x2*M2+x3*M3\n", - "print(\"m=\"),round(m,2)\n", - "print(\"now gravimetric analysis refers to the mass fraction analysis\")\n", - "print(\"mass fraction of constituents\")\n", - "print(\"y=xi*Mi/m\")\n", - "print(\"mole fraction of O2\")\n", - "y1=x1*M1/m\n", - "print(\"y1=\"),round(y1,3)\n", - "print(\"mole fraction of N2\")\n", - "y2=x2*M2/m\n", - "print(\"y2=\"),round(y2,3)\n", - "print(\"mole fraction of CO2\")\n", - "y3=x3*M3/m\n", - "print(\"y3=\"),round(y3,3)\n", - "print(\"now partial pressure of constituents = volume fraction * pressure of mixture\")\n", - "print(\"Pi=xi*P\")\n", - "print(\"partial pressure of O2(P1)in Mpa\")\n", - "p1=x1*P\n", - "print(\"P1=\"),round(p1,2)\n", - "print(\"partial pressure of N2(P2)in Mpa\")\n", - "P2=x2*P\n", - "print(\"P2=\"),round(P2,3)\n", - "P3=x3*P\n", - "print(\"partial pressure of CO2(P3)in Mpa\")\n", - "print(\"P3=\"),round(P3,2)\n", - "print(\"NOTE=>Their is some calculation mistake for partial pressure of CO2(i.e 0.35Mpa)which is given wrong in book so it is corrected above hence answers may vary.\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.24;page no:34" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.24, Page:34 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\n", - "volume of tank of N2(V1) in m^3= 3.0\n", - "volume of tank of CO2(V2) in m^3= 3.0\n", - "taking the adiabatic condition\n", - "no. of moles of N2(n1)\n", - "n1= 0.6\n", - "no. of moles of CO2(n2)\n", - "n2= 0.37\n", - "total no. of moles of mixture(n)in mol\n", - "n= 0.97\n", - "gas constant for N2(R1)in J/kg k\n", - "R1= 296.93\n", - "gas constant for CO2(R2)in J/kg k\n", - "R2=R/M2 188.95\n", - "specific heat of N2 at constant volume (Cv1) in J/kg k\n", - "Cv1= 742.32\n", - "specific heat of CO2 at constant volume (Cv2) in J/kg k\n", - "Cv2= 629.85\n", - "mass of N2(m1)in kg\n", - "m1= 16.84\n", - "mass of CO2(m2)in kg\n", - "m2= 16.28\n", - "let us consider the equilibrium temperature of mixture after adiabatic mixing at T\n", - "applying energy conservation principle\n", - "m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\n", - "equlibrium temperature(T)in k\n", - "=>T= 439.44\n", - "so the equlibrium pressure(P)in kpa\n", - "P= 591.55\n" - ] - } - ], - "source": [ - "#cal of equilibrium temperature,pressure of mixture\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.24, Page:34 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 24\")\n", - "V=6;#volume of tank in m^3\n", - "P1=800*10**3;#pressure of N2 gas tank in pa\n", - "T1=480.;#temperature of N2 gas tank in k\n", - "P2=400*10**3;#pressure of CO2 gas tank in pa\n", - "T2=390.;#temperature of CO2 gas tank in k\n", - "k1=1.4;#ratio of specific heat capacity for N2\n", - "k2=1.3;#ratio of specific heat capacity for CO2\n", - "R=8314.;#universal gas constant in J/kg k\n", - "M1=28.;#molecular weight of N2\n", - "M2=44.;#molecular weight of CO2\n", - "V1=V/2\n", - "print(\"volume of tank of N2(V1) in m^3=\"),round(V1,2)\n", - "V2=V/2\n", - "print(\"volume of tank of CO2(V2) in m^3=\"),round(V2,2)\n", - "print(\"taking the adiabatic condition\")\n", - "print(\"no. of moles of N2(n1)\")\n", - "n1=(P1*V1)/(R*T1)\n", - "print(\"n1=\"),round(n1,2)\n", - "print(\"no. of moles of CO2(n2)\")\n", - "n2=(P2*V2)/(R*T2)\n", - "print(\"n2=\"),round(n2,2)\n", - "print(\"total no. of moles of mixture(n)in mol\")\n", - "n=n1+n2\n", - "print(\"n=\"),round(n,2)\n", - "print(\"gas constant for N2(R1)in J/kg k\")\n", - "R1=R/M1\n", - "print(\"R1=\"),round(R1,2)\n", - "print(\"gas constant for CO2(R2)in J/kg k\")\n", - "R2=R/M2\n", - "print(\"R2=R/M2\"),round(R2,2)\n", - "print(\"specific heat of N2 at constant volume (Cv1) in J/kg k\")\n", - "Cv1=R1/(k1-1)\n", - "print(\"Cv1=\"),round(Cv1,2)\n", - "print(\"specific heat of CO2 at constant volume (Cv2) in J/kg k\")\n", - "Cv2=R2/(k2-1)\n", - "print(\"Cv2=\"),round(Cv2,2)\n", - "print(\"mass of N2(m1)in kg\")\n", - "m1=n1*M1\n", - "print(\"m1=\"),round(m1,2)\n", - "print(\"mass of CO2(m2)in kg\")\n", - "m2=n2*M2\n", - "print(\"m2=\"),round(m2,2)\n", - "print(\"let us consider the equilibrium temperature of mixture after adiabatic mixing at T\")\n", - "print(\"applying energy conservation principle\")\n", - "print(\"m1*Cv1*(T-T1) = m2*Cv2*(T-T2)\")\n", - "print(\"equlibrium temperature(T)in k\")\n", - "T=((m1*Cv1*T1)+(m2*Cv2*T2))/((m1*Cv1)+(m2*Cv2))\n", - "print(\"=>T=\"),round(T,2)\n", - "print(\"so the equlibrium pressure(P)in kpa\")\n", - "P=(n*R*T)/(1000*V)\n", - "print(\"P=\"),round(P,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.25;page no:35" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.25, Page:35 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\n", - "since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\n", - "so the specific heat at constant pressure(Cp)in KJ/kg k\n", - "Cp= 7.608\n" - ] - } - ], - "source": [ - "#cal of specific heat of final mixture\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.25, Page:35 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 25\")\n", - "m1=2;#mass of H2 in kg\n", - "m2=3;#mass of He in kg\n", - "T=100;#temperature of container in k\n", - "Cp1=11.23;#specific heat at constant pressure for H2 in KJ/kg k\n", - "Cp2=5.193;#specific heat at constant pressure for He in KJ/kg k\n", - "print(\"since two gases are non reacting therefore specific heat of final mixture(Cp)in KJ/kg k can be obtained by following for adiabatic mixing\")\n", - "print(\"so the specific heat at constant pressure(Cp)in KJ/kg k\")\n", - "Cp=((Cp1*m1)+Cp2*m2)/(m1+m2)\n", - "print(\"Cp=\"),round(Cp,3)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.26;page no:35" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.26, Page:35 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\n", - "gas constant for H2(R1)in KJ/kg k\n", - "R1= 4.157\n", - "gas constant for N2(R2)in KJ/kg k\n", - "R2= 0.297\n", - "gas constant for CO2(R3)in KJ/kg k\n", - "R3= 0.189\n", - "so now gas constant for mixture(Rm)in KJ/kg k\n", - "Rm= 2.606\n", - "considering gas to be perfect gas\n", - "total mass of mixture(m)in kg\n", - "m= 30.0\n", - "capacity of vessel(V)in m^3\n", - "V= 231.57\n", - "now final temperature(Tf) is twice of initial temperature(Ti)\n", - "so take k=Tf/Ti=2\n", - "for constant volume heating,final pressure(Pf)in kpa shall be\n", - "Pf= 202.65\n" - ] - } - ], - "source": [ - "#cal of capacity and pressure in the vessel\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.26, Page:35 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 26\")\n", - "m1=18.;#mass of hydrogen(H2) in kg\n", - "m2=10.;#mass of nitrogen(N2) in kg\n", - "m3=2.;#mass of carbon dioxide(CO2) in kg\n", - "R=8.314;#universal gas constant in KJ/kg k\n", - "Pi=101.325;#atmospheric pressure in kpa\n", - "T=(27+273.15);#ambient temperature in k\n", - "M1=2;#molar mass of H2\n", - "M2=28;#molar mass of N2\n", - "M3=44;#molar mass of CO2\n", - "print(\"gas constant for H2(R1)in KJ/kg k\")\n", - "R1=R/M1\n", - "print(\"R1=\"),round(R1,3)\n", - "print(\"gas constant for N2(R2)in KJ/kg k\")\n", - "R2=R/M2\n", - "print(\"R2=\"),round(R2,3)\n", - "print(\"gas constant for CO2(R3)in KJ/kg k\")\n", - "R3=R/M3\n", - "print(\"R3=\"),round(R3,3)\n", - "print(\"so now gas constant for mixture(Rm)in KJ/kg k\")\n", - "Rm=(m1*R1+m2*R2+m3*R3)/(m1+m2+m3)\n", - "print(\"Rm=\"),round(Rm,3)\n", - "print(\"considering gas to be perfect gas\")\n", - "print(\"total mass of mixture(m)in kg\")\n", - "m=m1+m2+m3\n", - "print(\"m=\"),round(m,2)\n", - "print(\"capacity of vessel(V)in m^3\")\n", - "V=(m*Rm*T)/Pi\n", - "print(\"V=\"),round(V,2)\n", - "print(\"now final temperature(Tf) is twice of initial temperature(Ti)\")\n", - "k=2;#ratio of initial to final temperature\n", - "print(\"so take k=Tf/Ti=2\") \n", - "print(\"for constant volume heating,final pressure(Pf)in kpa shall be\")\n", - "Pf=Pi*k\n", - "print(\"Pf=\"),round(Pf,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.27;page no:36" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.27, Page:36 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\n", - "let inlet state be 1 and exit state be 2\n", - "by charles law volume and temperature can be related as\n", - "(V1/T1)=(V2/T2)\n", - "(V2/V1)=(T2/T1)\n", - "or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\n", - "since change in K.E=0\n", - "so (D2^2/D1^2)=T2/T1\n", - "D2/D1=sqrt(T2/T1)\n", - "say(D2/D1)=k\n", - "so exit to inlet diameter ratio(k) 1.29\n" - ] - } - ], - "source": [ - "#cal of exit to inlet diameter ratio\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "import math\n", - "print\"Example 1.27, Page:36 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 27\")\n", - "T1=(27.+273.);#initial temperature of air in k\n", - "T2=500.;#final temperature of air in k\n", - "print(\"let inlet state be 1 and exit state be 2\")\n", - "print(\"by charles law volume and temperature can be related as\")\n", - "print(\"(V1/T1)=(V2/T2)\")\n", - "print(\"(V2/V1)=(T2/T1)\")\n", - "print(\"or (((math.pi*D2^2)/4)*V2)/(((math.pi*D1^2)/4)*V1)=T2/T1\")\n", - "print(\"since change in K.E=0\")\n", - "print(\"so (D2^2/D1^2)=T2/T1\")\n", - "print(\"D2/D1=sqrt(T2/T1)\")\n", - "print(\"say(D2/D1)=k\")\n", - "k=math.sqrt(T2/T1)\n", - "print(\"so exit to inlet diameter ratio(k)\"),round(k,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##example 1.28;page no:37" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 1.28, Page:37 \n", - " \n", - "\n", - "Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\n", - "gas constant for H2(R1)in KJ/kg k\n", - "R1= 4.157\n", - "say initial and final ststes are given by 1 and 2\n", - "mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\n", - "final pressure of hydrogen(P2)in cm of Hg\n", - "P2= 6.0\n", - "therefore pressure difference(P)in kpa\n", - "P= 93.33\n", - "mass pumped out(m)in kg\n", - "m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\n", - "here V1=V2=V and T1=T2=T\n", - "so m= 0.15\n", - "now during cooling upto 10 degree celcius,the process may be consider as constant volume process\n", - "say state before and after cooling are denoted by suffix 2 and 3\n", - "final pressure after cooling(P3)in kpa\n", - "P3= 7.546\n" - ] - } - ], - "source": [ - "#cal of final pressure\n", - "#intiation of all variables\n", - "# Chapter 1\n", - "print\"Example 1.28, Page:37 \\n \\n\"\n", - "print(\"Engineering Thermodynamics by Onkar Singh,Chapter 1,Example 28\")\n", - "V=2;#volume of vessel in m^3\n", - "P1=76;#initial pressure or atmospheric pressure in cm of Hg\n", - "T=(27+273.15);#temperature of vessel in k\n", - "p=70;#final pressure in cm of Hg vaccum\n", - "R=8.314;#universal gas constant in KJ/kg k\n", - "M=2;#molecular weight of H2\n", - "print(\"gas constant for H2(R1)in KJ/kg k\")\n", - "R1=R/M\n", - "print(\"R1=\"),round(R1,3)\n", - "print(\"say initial and final ststes are given by 1 and 2\")\n", - "print(\"mass of hydrogen pumped out shall be difference of initial and final mass inside vessel\")\n", - "print(\"final pressure of hydrogen(P2)in cm of Hg\")\n", - "P2=P1-p\n", - "print(\"P2=\"),round(P2,2)\n", - "print(\"therefore pressure difference(P)in kpa\")\n", - "P=((P1-P2)*101.325)/76\n", - "print(\"P=\"),round(P,2)\n", - "print(\"mass pumped out(m)in kg\")\n", - "print(\"m=((P1*V1)/(R1*T1))-((P2*V2)/(R1*T2))\")\n", - "print(\"here V1=V2=V and T1=T2=T\")\n", - "m=(V*P)/(R1*T)\n", - "print(\"so m=\"),round(m,2)\n", - "print(\"now during cooling upto 10 degree celcius,the process may be consider as constant volume process\")\n", - "print(\"say state before and after cooling are denoted by suffix 2 and 3\")\n", - "T3=(10+273.15);#final temperature after cooling in k\n", - "print(\"final pressure after cooling(P3)in kpa\")\n", - "P3=(T3/T)*P2*(101.325/76)\n", - "print(\"P3=\"),round(P3,3)\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49).png b/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49).png deleted file mode 100755 index 69b43e33..00000000 Binary files a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49).png and /dev/null differ diff --git a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_1.png b/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_1.png deleted file mode 100755 index 69b43e33..00000000 Binary files a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_1.png and /dev/null differ diff --git a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_2.png b/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_2.png deleted file mode 100755 index 69b43e33..00000000 Binary files a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(49)_2.png and /dev/null differ diff --git a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50).png b/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50).png deleted file mode 100755 index b8c7aad6..00000000 Binary files a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50).png and /dev/null differ diff --git a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_1.png b/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_1.png deleted file mode 100755 index b8c7aad6..00000000 Binary files a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_1.png and /dev/null differ diff --git a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_2.png b/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_2.png deleted file mode 100755 index b8c7aad6..00000000 Binary files a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(50)_2.png and /dev/null differ diff --git a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51).png b/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51).png deleted file mode 100755 index f3bb8ad5..00000000 Binary files a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51).png and /dev/null differ diff --git a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_1.png b/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_1.png deleted file mode 100755 index f3bb8ad5..00000000 Binary files a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_1.png and /dev/null differ diff --git a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_2.png b/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_2.png deleted file mode 100755 index f3bb8ad5..00000000 Binary files a/_Engineering_Thermodynamics_by__O._Singh/screenshots/Screenshot_(51)_2.png and /dev/null differ diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium.ipynb deleted file mode 100755 index e19d65e0..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium.ipynb +++ /dev/null @@ -1,155 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 10 Solid Solutions and Phase Equilibrium" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_6 pgno:391" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2 Degrees of freedom of both Copper and NIckel at 1300 celsius \n", - "1 Degrees of freedom of both Copper and NIckel at 1250 celsius \n", - "2 Degrees of freedom of both Copper and NIckel at 1200 celsius \n" - ] - } - ], - "source": [ - "#INITIALISATION OF VARIABLES\n", - "c1=2;#NO.of independent Chemical components at 1300 celsius\n", - "p1=1;#No.of phases at 1300 celsius\n", - "c2=2;#NO.of independent Chemical components at 1250 celsius\n", - "p2=2;#No.of phases at 1250 celsius\n", - "c3=2;#NO.of independent Chemical components at 1200 celsius\n", - "p3=1;#No.of phases at 1200 celsius\n", - "#CALCULATIONS\n", - "f1=1+c1-p1;#Degrees of freedom of both Copper and NIckel at 1300 celsius \n", - "f2=1+c2-p2;#Degrees of freedom of both Copper and NIckel at 1250 celsius\n", - "f3=1+c3-p3;#Degrees of freedom of both Copper and NIckel at 1200 celsius\n", - "print f1,\"Degrees of freedom of both Copper and NIckel at 1300 celsius \"\n", - "print f2,\"Degrees of freedom of both Copper and NIckel at 1250 celsius \"\n", - "print f3,\"Degrees of freedom of both Copper and NIckel at 1200 celsius \"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_8 pgno:393" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.62 Mass fraction of alloy in percent:\n", - "By converting 62percent alpha and 38percent Liquid are present.:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Nia=40.;#no, of grams of nickel in alloy at alla temperature\n", - "NiL=32.;#Mass of Nickel present in Liquid\n", - "Nialpha=45.;#Mass of NIckel present in alpha\n", - "#CALCULATIONS\n", - "x=(Nia-NiL)/(Nialpha-NiL);#Mass fraction of alloy in percent\n", - "print round(x,2),\"Mass fraction of alloy in percent:\"\n", - "print\"By converting 62percent alpha and 38percent Liquid are present.:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_9 pgno:395" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "At 1300 degree celsius only one phase so 100 percent Liquid\n", - "77.0 Percentage of Liquid at 1270 degree celsius :\n", - "23.0 Percentage of Solid qt 1270 degree celsius:\n", - "38.0 Percentage of Liquid at 1250 degree celsius :\n", - "62.0 Percentage of Solid at 1250 degree celsius:\n", - "At 1200 degree celsius only one phase so 100 percent Solid \n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "NiL=37.;# percentage of NI the Liquid contains at 1270 degree celsius\n", - "NiS=50.;#percentage of NI the Solid contains at 1270 degree celsius\n", - "NiL2=32.;#percentage of NI the Liquidcontains at 1250 degree celsius\n", - "NiS2=45.;#percentage of NI the Solid contains at 1250 degree celsius\n", - "NiS3=40.;#percentage of NI the Solid contains at 1200 degree celsius\n", - "NiL3=40.;#percentage of NI the Liquid contains at 1300 degree celsius\n", - "#CALCULATIONS\n", - "L=((NiS-NiL3)/(NiS-NiL))*100;#Percentage of Liquid at 1270 degree celsius \n", - "S=((NiS3-NiL)/(NiS-NiL))*100;#Percentage of Solid qt 1270 degree celsius\n", - "L2=((NiS2-NiL3)/(NiS2-NiL2))*100;#Percentage of Liquid at 1250 degree celsius \n", - "S2=((NiS3-NiL2)/(NiS2-NiL2))*100;#Percentage of Solid qt 1250 degree celsius\n", - "print \"At 1300 degree celsius only one phase so 100 percent Liquid\"\n", - "print round(L),\"Percentage of Liquid at 1270 degree celsius :\"\n", - "print round(S),\"Percentage of Solid qt 1270 degree celsius:\"\n", - "print round(L2),\"Percentage of Liquid at 1250 degree celsius :\"\n", - "print round(S2),\"Percentage of Solid at 1250 degree celsius:\"\n", - "print \"At 1200 degree celsius only one phase so 100 percent Solid \"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_1.ipynb deleted file mode 100755 index e19d65e0..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_1.ipynb +++ /dev/null @@ -1,155 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 10 Solid Solutions and Phase Equilibrium" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_6 pgno:391" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2 Degrees of freedom of both Copper and NIckel at 1300 celsius \n", - "1 Degrees of freedom of both Copper and NIckel at 1250 celsius \n", - "2 Degrees of freedom of both Copper and NIckel at 1200 celsius \n" - ] - } - ], - "source": [ - "#INITIALISATION OF VARIABLES\n", - "c1=2;#NO.of independent Chemical components at 1300 celsius\n", - "p1=1;#No.of phases at 1300 celsius\n", - "c2=2;#NO.of independent Chemical components at 1250 celsius\n", - "p2=2;#No.of phases at 1250 celsius\n", - "c3=2;#NO.of independent Chemical components at 1200 celsius\n", - "p3=1;#No.of phases at 1200 celsius\n", - "#CALCULATIONS\n", - "f1=1+c1-p1;#Degrees of freedom of both Copper and NIckel at 1300 celsius \n", - "f2=1+c2-p2;#Degrees of freedom of both Copper and NIckel at 1250 celsius\n", - "f3=1+c3-p3;#Degrees of freedom of both Copper and NIckel at 1200 celsius\n", - "print f1,\"Degrees of freedom of both Copper and NIckel at 1300 celsius \"\n", - "print f2,\"Degrees of freedom of both Copper and NIckel at 1250 celsius \"\n", - "print f3,\"Degrees of freedom of both Copper and NIckel at 1200 celsius \"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_8 pgno:393" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.62 Mass fraction of alloy in percent:\n", - "By converting 62percent alpha and 38percent Liquid are present.:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Nia=40.;#no, of grams of nickel in alloy at alla temperature\n", - "NiL=32.;#Mass of Nickel present in Liquid\n", - "Nialpha=45.;#Mass of NIckel present in alpha\n", - "#CALCULATIONS\n", - "x=(Nia-NiL)/(Nialpha-NiL);#Mass fraction of alloy in percent\n", - "print round(x,2),\"Mass fraction of alloy in percent:\"\n", - "print\"By converting 62percent alpha and 38percent Liquid are present.:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_9 pgno:395" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "At 1300 degree celsius only one phase so 100 percent Liquid\n", - "77.0 Percentage of Liquid at 1270 degree celsius :\n", - "23.0 Percentage of Solid qt 1270 degree celsius:\n", - "38.0 Percentage of Liquid at 1250 degree celsius :\n", - "62.0 Percentage of Solid at 1250 degree celsius:\n", - "At 1200 degree celsius only one phase so 100 percent Solid \n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "NiL=37.;# percentage of NI the Liquid contains at 1270 degree celsius\n", - "NiS=50.;#percentage of NI the Solid contains at 1270 degree celsius\n", - "NiL2=32.;#percentage of NI the Liquidcontains at 1250 degree celsius\n", - "NiS2=45.;#percentage of NI the Solid contains at 1250 degree celsius\n", - "NiS3=40.;#percentage of NI the Solid contains at 1200 degree celsius\n", - "NiL3=40.;#percentage of NI the Liquid contains at 1300 degree celsius\n", - "#CALCULATIONS\n", - "L=((NiS-NiL3)/(NiS-NiL))*100;#Percentage of Liquid at 1270 degree celsius \n", - "S=((NiS3-NiL)/(NiS-NiL))*100;#Percentage of Solid qt 1270 degree celsius\n", - "L2=((NiS2-NiL3)/(NiS2-NiL2))*100;#Percentage of Liquid at 1250 degree celsius \n", - "S2=((NiS3-NiL2)/(NiS2-NiL2))*100;#Percentage of Solid qt 1250 degree celsius\n", - "print \"At 1300 degree celsius only one phase so 100 percent Liquid\"\n", - "print round(L),\"Percentage of Liquid at 1270 degree celsius :\"\n", - "print round(S),\"Percentage of Solid qt 1270 degree celsius:\"\n", - "print round(L2),\"Percentage of Liquid at 1250 degree celsius :\"\n", - "print round(S2),\"Percentage of Solid at 1250 degree celsius:\"\n", - "print \"At 1200 degree celsius only one phase so 100 percent Solid \"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_2.ipynb deleted file mode 100755 index 3289e7a6..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_2.ipynb +++ /dev/null @@ -1,155 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 10 Solid Solutions and Phase Equilibrium" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_6 pgno:391" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Degrees of freedom of both Copper and NIckel at 1300 celsius 2\n", - "Degrees of freedom of both Copper and NIckel at 1250 celsius 1\n", - "Degrees of freedom of both Copper and NIckel at 1200 celsius 2\n" - ] - } - ], - "source": [ - "#INITIALISATION OF VARIABLES\n", - "c1=2;#NO.of independent Chemical components at 1300 celsius\n", - "p1=1;#No.of phases at 1300 celsius\n", - "c2=2;#NO.of independent Chemical components at 1250 celsius\n", - "p2=2;#No.of phases at 1250 celsius\n", - "c3=2;#NO.of independent Chemical components at 1200 celsius\n", - "p3=1;#No.of phases at 1200 celsius\n", - "#CALCULATIONS\n", - "f1=1+c1-p1;#Degrees of freedom of both Copper and NIckel at 1300 celsius \n", - "f2=1+c2-p2;#Degrees of freedom of both Copper and NIckel at 1250 celsius\n", - "f3=1+c3-p3;#Degrees of freedom of both Copper and NIckel at 1200 celsius\n", - "print \"Degrees of freedom of both Copper and NIckel at 1300 celsius \",f1\n", - "print \"Degrees of freedom of both Copper and NIckel at 1250 celsius \",f2\n", - "print \"Degrees of freedom of both Copper and NIckel at 1200 celsius \",f3\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_8 pgno:393" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Mass fraction of alloy in percent: 0.62\n", - "By converting 62percent alpha and 38percent Liquid are present.:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Nia=40.;#no, of grams of nickel in alloy at alla temperature\n", - "NiL=32.;#Mass of Nickel present in Liquid\n", - "Nialpha=45.;#Mass of NIckel present in alpha\n", - "#CALCULATIONS\n", - "x=(Nia-NiL)/(Nialpha-NiL);#Mass fraction of alloy in percent\n", - "print \"Mass fraction of alloy in percent:\",round(x,2)\n", - "print\"By converting 62percent alpha and 38percent Liquid are present.:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_9 pgno:395" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "At 1300 degree celsius only one phase so 100 percent Liquid\n", - "Percentage of Liquid at 1270 degree celsius : 77.0\n", - "Percentage of Solid qt 1270 degree celsius: 23.0\n", - "Percentage of Liquid at 1250 degree celsius : 38.0\n", - "Percentage of Solid at 1250 degree celsius: 62.0\n", - "At 1200 degree celsius only one phase so 100 percent Solid \n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "NiL=37.;# percentage of NI the Liquid contains at 1270 degree celsius\n", - "NiS=50.;#percentage of NI the Solid contains at 1270 degree celsius\n", - "NiL2=32.;#percentage of NI the Liquidcontains at 1250 degree celsius\n", - "NiS2=45.;#percentage of NI the Solid contains at 1250 degree celsius\n", - "NiS3=40.;#percentage of NI the Solid contains at 1200 degree celsius\n", - "NiL3=40.;#percentage of NI the Liquid contains at 1300 degree celsius\n", - "#CALCULATIONS\n", - "L=((NiS-NiL3)/(NiS-NiL))*100;#Percentage of Liquid at 1270 degree celsius \n", - "S=((NiS3-NiL)/(NiS-NiL))*100;#Percentage of Solid qt 1270 degree celsius\n", - "L2=((NiS2-NiL3)/(NiS2-NiL2))*100;#Percentage of Liquid at 1250 degree celsius \n", - "S2=((NiS3-NiL2)/(NiS2-NiL2))*100;#Percentage of Solid qt 1250 degree celsius\n", - "print \"At 1300 degree celsius only one phase so 100 percent Liquid\"\n", - "print \"Percentage of Liquid at 1270 degree celsius :\",round(L)\n", - "print \"Percentage of Solid qt 1270 degree celsius:\",round(S)\n", - "print \"Percentage of Liquid at 1250 degree celsius :\",round(L2)\n", - "print \"Percentage of Solid at 1250 degree celsius:\",round(S2)\n", - "print \"At 1200 degree celsius only one phase so 100 percent Solid \"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_3.ipynb deleted file mode 100755 index 3289e7a6..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_10_Solid_Solutions_and_Phase_Equilibrium_3.ipynb +++ /dev/null @@ -1,155 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 10 Solid Solutions and Phase Equilibrium" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_6 pgno:391" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Degrees of freedom of both Copper and NIckel at 1300 celsius 2\n", - "Degrees of freedom of both Copper and NIckel at 1250 celsius 1\n", - "Degrees of freedom of both Copper and NIckel at 1200 celsius 2\n" - ] - } - ], - "source": [ - "#INITIALISATION OF VARIABLES\n", - "c1=2;#NO.of independent Chemical components at 1300 celsius\n", - "p1=1;#No.of phases at 1300 celsius\n", - "c2=2;#NO.of independent Chemical components at 1250 celsius\n", - "p2=2;#No.of phases at 1250 celsius\n", - "c3=2;#NO.of independent Chemical components at 1200 celsius\n", - "p3=1;#No.of phases at 1200 celsius\n", - "#CALCULATIONS\n", - "f1=1+c1-p1;#Degrees of freedom of both Copper and NIckel at 1300 celsius \n", - "f2=1+c2-p2;#Degrees of freedom of both Copper and NIckel at 1250 celsius\n", - "f3=1+c3-p3;#Degrees of freedom of both Copper and NIckel at 1200 celsius\n", - "print \"Degrees of freedom of both Copper and NIckel at 1300 celsius \",f1\n", - "print \"Degrees of freedom of both Copper and NIckel at 1250 celsius \",f2\n", - "print \"Degrees of freedom of both Copper and NIckel at 1200 celsius \",f3\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_8 pgno:393" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Mass fraction of alloy in percent: 0.62\n", - "By converting 62percent alpha and 38percent Liquid are present.:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Nia=40.;#no, of grams of nickel in alloy at alla temperature\n", - "NiL=32.;#Mass of Nickel present in Liquid\n", - "Nialpha=45.;#Mass of NIckel present in alpha\n", - "#CALCULATIONS\n", - "x=(Nia-NiL)/(Nialpha-NiL);#Mass fraction of alloy in percent\n", - "print \"Mass fraction of alloy in percent:\",round(x,2)\n", - "print\"By converting 62percent alpha and 38percent Liquid are present.:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 10_9 pgno:395" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "At 1300 degree celsius only one phase so 100 percent Liquid\n", - "Percentage of Liquid at 1270 degree celsius : 77.0\n", - "Percentage of Solid qt 1270 degree celsius: 23.0\n", - "Percentage of Liquid at 1250 degree celsius : 38.0\n", - "Percentage of Solid at 1250 degree celsius: 62.0\n", - "At 1200 degree celsius only one phase so 100 percent Solid \n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "NiL=37.;# percentage of NI the Liquid contains at 1270 degree celsius\n", - "NiS=50.;#percentage of NI the Solid contains at 1270 degree celsius\n", - "NiL2=32.;#percentage of NI the Liquidcontains at 1250 degree celsius\n", - "NiS2=45.;#percentage of NI the Solid contains at 1250 degree celsius\n", - "NiS3=40.;#percentage of NI the Solid contains at 1200 degree celsius\n", - "NiL3=40.;#percentage of NI the Liquid contains at 1300 degree celsius\n", - "#CALCULATIONS\n", - "L=((NiS-NiL3)/(NiS-NiL))*100;#Percentage of Liquid at 1270 degree celsius \n", - "S=((NiS3-NiL)/(NiS-NiL))*100;#Percentage of Solid qt 1270 degree celsius\n", - "L2=((NiS2-NiL3)/(NiS2-NiL2))*100;#Percentage of Liquid at 1250 degree celsius \n", - "S2=((NiS3-NiL2)/(NiS2-NiL2))*100;#Percentage of Solid qt 1250 degree celsius\n", - "print \"At 1300 degree celsius only one phase so 100 percent Liquid\"\n", - "print \"Percentage of Liquid at 1270 degree celsius :\",round(L)\n", - "print \"Percentage of Solid qt 1270 degree celsius:\",round(S)\n", - "print \"Percentage of Liquid at 1250 degree celsius :\",round(L2)\n", - "print \"Percentage of Solid at 1250 degree celsius:\",round(S2)\n", - "print \"At 1200 degree celsius only one phase so 100 percent Solid \"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams.ipynb deleted file mode 100755 index f63c3411..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams.ipynb +++ /dev/null @@ -1,198 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 11 Dispertion Strengthening and Eutectic Phase Diagrams" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_2 pgno:422" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "8.16326530612 c.Amount of beeta forms of Pb-Sn in gm:\n", - "1.83673469388 d.The mass of Sn in the alpha phase in g:\n", - "8.2 d.The mass of Sn in beeta phase in g:\n", - "90.0 e.The mass of Pb in the alpha phase in g:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Sn=2.#Amount of Tin Dissolved in alpha solid solution \n", - "Sn2=10.;#Amount of Tin Dissolved in alpha+beeta solid solution at 0 degree celsius\n", - "m=100.;#Total mass of the Pb-Sn alloy in gm\n", - "Pbm=90.#Total mass of the Pb in Pb-Sn alloy in gm\n", - "#CALCULATIONS\n", - "B=((Sn2-Sn)/(m-Sn))*100;#The amount of beeta Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", - "B2=100-B;#The amount of alpha Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", - "Sn1=(Sn/100.)*(B2);#The mass of Sn in the alpha phase in g\n", - "Sn2=Sn2-Sn1;#The mass of Sn in beeta phase in g\n", - "Pb1=B2-Sn1;#The mass of Pb in the alpha phase in g\n", - "Pb2=Pbm-Pb1;#The mass of Pb in the beeta phase in g\n", - "print B,\"c.Amount of beeta forms of Pb-Sn in gm:\"\n", - "print Sn1,\"d.The mass of Sn in the alpha phase in g:\"\n", - "print round(Sn2,1),\"d.The mass of Sn in beeta phase in g:\"\n", - "print Pb1,\"e.The mass of Pb in the alpha phase in g:\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_3 pgno:425" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.453503184713 Weight fraction of alpha phase\n", - "0.546496815287 Weight fraction of beeta phase\n", - "90.7006369427 The mass of the alpha phase in 200g in g:\n", - "109.299363057 The amount of the beeta phase in g at 182 degree celsius:\n", - "73.4675159236 Mass of Pb in the alpha phase in g:\n", - "17.2331210191 Mass of Sn in alpha phase\n", - "2.73248407643 Mass of Pb in beeta phase:\n", - "106.6 mass of Sn in beeta Phase:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "M=200.;#Mass of alpha phase of alloy in gm\n", - "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", - "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", - "Pb2=97.5;#Percentage of the Sn in the beeta phase in percent\n", - "#CALCULLATIONS\n", - "W1=(Pb2-Sn)/(Pb2-Pb);#Weight fraction of alpha phase\n", - "W2=(Sn-Pb)/(Pb2-Pb);#Weight fraction of beeta phase\n", - "Ma=M*W1;#The mass of the alpha phase in 200g in g\n", - "Mb=M-Ma;#The amount of the beeta phase in g at 182 degree celsius\n", - "MPb1=Ma*(1-(Pb/100));#Mass of Pb in the alpha phase in g\n", - "MSn1=Ma-MPb1;#Mass of Sn in alpha phase \n", - "MPb2=Mb*(1-(Pb2/100));#Mass of Pb in beeta phase\n", - "MSn2=123.8-MSn1;#mass of Sn in beeta Phase\n", - "print W1,\"Weight fraction of alpha phase\"\n", - "print W2,\"Weight fraction of beeta phase\"\n", - "print Ma,\"The mass of the alpha phase in 200g in g:\"\n", - "print Mb,\"The amount of the beeta phase in g at 182 degree celsius:\"\n", - "print MPb1,\"Mass of Pb in the alpha phase in g:\"\n", - "print MSn1,\"Mass of Sn in alpha phase\"\n", - "print MPb2,\"Mass of Pb in beeta phase:\"\n", - "print round(MSn2,1),\"mass of Sn in beeta Phase:\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_5 pgno:429" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "74.0 The amount of compositions of primary alpha in Pb-Sn:\n", - "26.0 The amount of composition of eutectic in Pb-Sn:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", - "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", - "Sn2=30.;#Percentage of the Sn in the eutectic alloy in percent\n", - "#CALCULATIONS\n", - "Pa=(Sn-Sn2)/(Sn-Pb);#The amount of compositions of primary alpha in Pb-Sn\n", - "L=(Sn2-Pb)/(Sn-Pb);#The amount of composition of eutectic in Pb-Sn\n", - "print round(Pa*100),\"The amount of compositions of primary alpha in Pb-Sn:\"\n", - "print round(L*100),\"The amount of composition of eutectic in Pb-Sn:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_6 pgno:434" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "59.0 L200 in percentage\n", - "70.0 L210 in percentage\n" - ] - } - ], - "source": [ - "\n", - "per_L_200=((40.-18.)/(55.-18.))*100\n", - "Per_L_210=((40.-17.)/(50.-17.))*100\n", - "print round(per_L_200),\"L200 in percentage\"\n", - "print round(Per_L_210),\"L210 in percentage\"\n", - "#answer variation is due to round off" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_1.ipynb deleted file mode 100755 index f63c3411..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_1.ipynb +++ /dev/null @@ -1,198 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 11 Dispertion Strengthening and Eutectic Phase Diagrams" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_2 pgno:422" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "8.16326530612 c.Amount of beeta forms of Pb-Sn in gm:\n", - "1.83673469388 d.The mass of Sn in the alpha phase in g:\n", - "8.2 d.The mass of Sn in beeta phase in g:\n", - "90.0 e.The mass of Pb in the alpha phase in g:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Sn=2.#Amount of Tin Dissolved in alpha solid solution \n", - "Sn2=10.;#Amount of Tin Dissolved in alpha+beeta solid solution at 0 degree celsius\n", - "m=100.;#Total mass of the Pb-Sn alloy in gm\n", - "Pbm=90.#Total mass of the Pb in Pb-Sn alloy in gm\n", - "#CALCULATIONS\n", - "B=((Sn2-Sn)/(m-Sn))*100;#The amount of beeta Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", - "B2=100-B;#The amount of alpha Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", - "Sn1=(Sn/100.)*(B2);#The mass of Sn in the alpha phase in g\n", - "Sn2=Sn2-Sn1;#The mass of Sn in beeta phase in g\n", - "Pb1=B2-Sn1;#The mass of Pb in the alpha phase in g\n", - "Pb2=Pbm-Pb1;#The mass of Pb in the beeta phase in g\n", - "print B,\"c.Amount of beeta forms of Pb-Sn in gm:\"\n", - "print Sn1,\"d.The mass of Sn in the alpha phase in g:\"\n", - "print round(Sn2,1),\"d.The mass of Sn in beeta phase in g:\"\n", - "print Pb1,\"e.The mass of Pb in the alpha phase in g:\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_3 pgno:425" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.453503184713 Weight fraction of alpha phase\n", - "0.546496815287 Weight fraction of beeta phase\n", - "90.7006369427 The mass of the alpha phase in 200g in g:\n", - "109.299363057 The amount of the beeta phase in g at 182 degree celsius:\n", - "73.4675159236 Mass of Pb in the alpha phase in g:\n", - "17.2331210191 Mass of Sn in alpha phase\n", - "2.73248407643 Mass of Pb in beeta phase:\n", - "106.6 mass of Sn in beeta Phase:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "M=200.;#Mass of alpha phase of alloy in gm\n", - "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", - "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", - "Pb2=97.5;#Percentage of the Sn in the beeta phase in percent\n", - "#CALCULLATIONS\n", - "W1=(Pb2-Sn)/(Pb2-Pb);#Weight fraction of alpha phase\n", - "W2=(Sn-Pb)/(Pb2-Pb);#Weight fraction of beeta phase\n", - "Ma=M*W1;#The mass of the alpha phase in 200g in g\n", - "Mb=M-Ma;#The amount of the beeta phase in g at 182 degree celsius\n", - "MPb1=Ma*(1-(Pb/100));#Mass of Pb in the alpha phase in g\n", - "MSn1=Ma-MPb1;#Mass of Sn in alpha phase \n", - "MPb2=Mb*(1-(Pb2/100));#Mass of Pb in beeta phase\n", - "MSn2=123.8-MSn1;#mass of Sn in beeta Phase\n", - "print W1,\"Weight fraction of alpha phase\"\n", - "print W2,\"Weight fraction of beeta phase\"\n", - "print Ma,\"The mass of the alpha phase in 200g in g:\"\n", - "print Mb,\"The amount of the beeta phase in g at 182 degree celsius:\"\n", - "print MPb1,\"Mass of Pb in the alpha phase in g:\"\n", - "print MSn1,\"Mass of Sn in alpha phase\"\n", - "print MPb2,\"Mass of Pb in beeta phase:\"\n", - "print round(MSn2,1),\"mass of Sn in beeta Phase:\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_5 pgno:429" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "74.0 The amount of compositions of primary alpha in Pb-Sn:\n", - "26.0 The amount of composition of eutectic in Pb-Sn:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", - "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", - "Sn2=30.;#Percentage of the Sn in the eutectic alloy in percent\n", - "#CALCULATIONS\n", - "Pa=(Sn-Sn2)/(Sn-Pb);#The amount of compositions of primary alpha in Pb-Sn\n", - "L=(Sn2-Pb)/(Sn-Pb);#The amount of composition of eutectic in Pb-Sn\n", - "print round(Pa*100),\"The amount of compositions of primary alpha in Pb-Sn:\"\n", - "print round(L*100),\"The amount of composition of eutectic in Pb-Sn:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_6 pgno:434" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "59.0 L200 in percentage\n", - "70.0 L210 in percentage\n" - ] - } - ], - "source": [ - "\n", - "per_L_200=((40.-18.)/(55.-18.))*100\n", - "Per_L_210=((40.-17.)/(50.-17.))*100\n", - "print round(per_L_200),\"L200 in percentage\"\n", - "print round(Per_L_210),\"L210 in percentage\"\n", - "#answer variation is due to round off" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_2.ipynb deleted file mode 100755 index 84eb7ae5..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_2.ipynb +++ /dev/null @@ -1,198 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 11 Dispertion Strengthening and Eutectic Phase Diagrams" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_2 pgno:422" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "c.Amount of beeta forms of Pb-Sn in gm: 8.16326530612\n", - "d.The mass of Sn in the alpha phase in g: 1.83673469388\n", - "d.The mass of Sn in beeta phase in g: 8.2\n", - "e.The mass of Pb in the alpha phase in g: 90.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Sn=2.#Amount of Tin Dissolved in alpha solid solution \n", - "Sn2=10.;#Amount of Tin Dissolved in alpha+beeta solid solution at 0 degree celsius\n", - "m=100.;#Total mass of the Pb-Sn alloy in gm\n", - "Pbm=90.#Total mass of the Pb in Pb-Sn alloy in gm\n", - "#CALCULATIONS\n", - "B=((Sn2-Sn)/(m-Sn))*100;#The amount of beeta Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", - "B2=100-B;#The amount of alpha Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", - "Sn1=(Sn/100.)*(B2);#The mass of Sn in the alpha phase in g\n", - "Sn2=Sn2-Sn1;#The mass of Sn in beeta phase in g\n", - "Pb1=B2-Sn1;#The mass of Pb in the alpha phase in g\n", - "Pb2=Pbm-Pb1;#The mass of Pb in the beeta phase in g\n", - "print \"c.Amount of beeta forms of Pb-Sn in gm:\",B\n", - "print \"d.The mass of Sn in the alpha phase in g:\",Sn1\n", - "print \"d.The mass of Sn in beeta phase in g:\",round(Sn2,1)\n", - "print \"e.The mass of Pb in the alpha phase in g:\",Pb1\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_3 pgno:425" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Weight fraction of alpha phase 0.453503184713\n", - "Weight fraction of beeta phase 0.546496815287\n", - "The mass of the alpha phase in 200g in g: 90.7006369427\n", - "The amount of the beeta phase in g at 182 degree celsius: 109.299363057\n", - "Mass of Pb in the alpha phase in g: 73.4675159236\n", - "Mass of Sn in alpha phase 17.2331210191\n", - "Mass of Pb in beeta phase: 2.73248407643\n", - "mass of Sn in beeta Phase: 106.6\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "M=200.;#Mass of alpha phase of alloy in gm\n", - "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", - "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", - "Pb2=97.5;#Percentage of the Sn in the beeta phase in percent\n", - "#CALCULLATIONS\n", - "W1=(Pb2-Sn)/(Pb2-Pb);#Weight fraction of alpha phase\n", - "W2=(Sn-Pb)/(Pb2-Pb);#Weight fraction of beeta phase\n", - "Ma=M*W1;#The mass of the alpha phase in 200g in g\n", - "Mb=M-Ma;#The amount of the beeta phase in g at 182 degree celsius\n", - "MPb1=Ma*(1-(Pb/100));#Mass of Pb in the alpha phase in g\n", - "MSn1=Ma-MPb1;#Mass of Sn in alpha phase \n", - "MPb2=Mb*(1-(Pb2/100));#Mass of Pb in beeta phase\n", - "MSn2=123.8-MSn1;#mass of Sn in beeta Phase\n", - "print \"Weight fraction of alpha phase\",W1\n", - "print \"Weight fraction of beeta phase\",W2\n", - "print \"The mass of the alpha phase in 200g in g:\",Ma\n", - "print \"The amount of the beeta phase in g at 182 degree celsius:\",Mb\n", - "print \"Mass of Pb in the alpha phase in g:\",MPb1\n", - "print \"Mass of Sn in alpha phase\",MSn1\n", - "print \"Mass of Pb in beeta phase:\",MPb2\n", - "print \"mass of Sn in beeta Phase:\",round(MSn2,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_5 pgno:429" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The amount of compositions of primary alpha in Pb-Sn: 74.0\n", - "The amount of composition of eutectic in Pb-Sn: 26.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", - "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", - "Sn2=30.;#Percentage of the Sn in the eutectic alloy in percent\n", - "#CALCULATIONS\n", - "Pa=(Sn-Sn2)/(Sn-Pb);#The amount of compositions of primary alpha in Pb-Sn\n", - "L=(Sn2-Pb)/(Sn-Pb);#The amount of composition of eutectic in Pb-Sn\n", - "print \"The amount of compositions of primary alpha in Pb-Sn:\",round(Pa*100)\n", - "print \"The amount of composition of eutectic in Pb-Sn:\", round(L*100)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_6 pgno:434" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "L200 in percentage 59.0\n", - "L210 in percentage 70.0\n" - ] - } - ], - "source": [ - "\n", - "per_L_200=((40.-18.)/(55.-18.))*100\n", - "Per_L_210=((40.-17.)/(50.-17.))*100\n", - "print \"L200 in percentage\",round(per_L_200)\n", - "print \"L210 in percentage\",round(Per_L_210)\n", - "#answer variation is due to round off" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_3.ipynb deleted file mode 100755 index 84eb7ae5..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_11_Dispertion_Strengthening_and_Eutectic_Phase_Diagrams_3.ipynb +++ /dev/null @@ -1,198 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 11 Dispertion Strengthening and Eutectic Phase Diagrams" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_2 pgno:422" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "c.Amount of beeta forms of Pb-Sn in gm: 8.16326530612\n", - "d.The mass of Sn in the alpha phase in g: 1.83673469388\n", - "d.The mass of Sn in beeta phase in g: 8.2\n", - "e.The mass of Pb in the alpha phase in g: 90.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Sn=2.#Amount of Tin Dissolved in alpha solid solution \n", - "Sn2=10.;#Amount of Tin Dissolved in alpha+beeta solid solution at 0 degree celsius\n", - "m=100.;#Total mass of the Pb-Sn alloy in gm\n", - "Pbm=90.#Total mass of the Pb in Pb-Sn alloy in gm\n", - "#CALCULATIONS\n", - "B=((Sn2-Sn)/(m-Sn))*100;#The amount of beeta Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", - "B2=100-B;#The amount of alpha Sn that forms if a Pb-10% Sn alloy is cooled to 0 Degree celsius\n", - "Sn1=(Sn/100.)*(B2);#The mass of Sn in the alpha phase in g\n", - "Sn2=Sn2-Sn1;#The mass of Sn in beeta phase in g\n", - "Pb1=B2-Sn1;#The mass of Pb in the alpha phase in g\n", - "Pb2=Pbm-Pb1;#The mass of Pb in the beeta phase in g\n", - "print \"c.Amount of beeta forms of Pb-Sn in gm:\",B\n", - "print \"d.The mass of Sn in the alpha phase in g:\",Sn1\n", - "print \"d.The mass of Sn in beeta phase in g:\",round(Sn2,1)\n", - "print \"e.The mass of Pb in the alpha phase in g:\",Pb1\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_3 pgno:425" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Weight fraction of alpha phase 0.453503184713\n", - "Weight fraction of beeta phase 0.546496815287\n", - "The mass of the alpha phase in 200g in g: 90.7006369427\n", - "The amount of the beeta phase in g at 182 degree celsius: 109.299363057\n", - "Mass of Pb in the alpha phase in g: 73.4675159236\n", - "Mass of Sn in alpha phase 17.2331210191\n", - "Mass of Pb in beeta phase: 2.73248407643\n", - "mass of Sn in beeta Phase: 106.6\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "M=200.;#Mass of alpha phase of alloy in gm\n", - "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", - "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", - "Pb2=97.5;#Percentage of the Sn in the beeta phase in percent\n", - "#CALCULLATIONS\n", - "W1=(Pb2-Sn)/(Pb2-Pb);#Weight fraction of alpha phase\n", - "W2=(Sn-Pb)/(Pb2-Pb);#Weight fraction of beeta phase\n", - "Ma=M*W1;#The mass of the alpha phase in 200g in g\n", - "Mb=M-Ma;#The amount of the beeta phase in g at 182 degree celsius\n", - "MPb1=Ma*(1-(Pb/100));#Mass of Pb in the alpha phase in g\n", - "MSn1=Ma-MPb1;#Mass of Sn in alpha phase \n", - "MPb2=Mb*(1-(Pb2/100));#Mass of Pb in beeta phase\n", - "MSn2=123.8-MSn1;#mass of Sn in beeta Phase\n", - "print \"Weight fraction of alpha phase\",W1\n", - "print \"Weight fraction of beeta phase\",W2\n", - "print \"The mass of the alpha phase in 200g in g:\",Ma\n", - "print \"The amount of the beeta phase in g at 182 degree celsius:\",Mb\n", - "print \"Mass of Pb in the alpha phase in g:\",MPb1\n", - "print \"Mass of Sn in alpha phase\",MSn1\n", - "print \"Mass of Pb in beeta phase:\",MPb2\n", - "print \"mass of Sn in beeta Phase:\",round(MSn2,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_5 pgno:429" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The amount of compositions of primary alpha in Pb-Sn: 74.0\n", - "The amount of composition of eutectic in Pb-Sn: 26.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Sn=61.9;#Percentage of the Sn in the eutectic alloy in percent\n", - "Pb=19.;#Percentage of the Pb in the alpha phase in percent\n", - "Sn2=30.;#Percentage of the Sn in the eutectic alloy in percent\n", - "#CALCULATIONS\n", - "Pa=(Sn-Sn2)/(Sn-Pb);#The amount of compositions of primary alpha in Pb-Sn\n", - "L=(Sn2-Pb)/(Sn-Pb);#The amount of composition of eutectic in Pb-Sn\n", - "print \"The amount of compositions of primary alpha in Pb-Sn:\",round(Pa*100)\n", - "print \"The amount of composition of eutectic in Pb-Sn:\", round(L*100)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 11_6 pgno:434" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "L200 in percentage 59.0\n", - "L210 in percentage 70.0\n" - ] - } - ], - "source": [ - "\n", - "per_L_200=((40.-18.)/(55.-18.))*100\n", - "Per_L_210=((40.-17.)/(50.-17.))*100\n", - "print \"L200 in percentage\",round(per_L_200)\n", - "print \"L210 in percentage\",round(Per_L_210)\n", - "#answer variation is due to round off" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment.ipynb deleted file mode 100755 index 228a9818..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment.ipynb +++ /dev/null @@ -1,211 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 12 Dispersion Strengthening by Phase Transmission and Heat Treatment" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_1 pgno:454" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1.35108097784 Constant 10**10 A=\n", - "-20829.0 Slpoe of the straight line -Q/R\n" - ] - } - ], - "source": [ - "from math import log,exp\n", - "# Initialisation of Variables\n", - "r1=0.111;#Rate of copper in min^-1 at 135 degree celsius\n", - "r2=0.004;#Rate of copper in min^-1 at 88 degree celsius\n", - "T1=408.;#Temperature in K\n", - "T2=361.;#Temperature in K\n", - "R=1.987;#Gas constant\n", - "Q=20693.;#Change in Rates\n", - "slope=(log(r1)-log(r2))/((1/T1)-(1/T2));#Slope of the straight line ploted ln(Growth rate) as a function of 1=T,\n", - "A=r1/(exp(-Q/(R*T1)));#Constant\n", - "print A/10**10,\"Constant 10**10 A=\"\n", - "print round(2*slope),\"Slpoe of the straight line -Q/R\"\n", - "#diffrence in asnwer is due to round off error\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_5 pgno:467" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "88.7 Amount of ferrite present in peralite:\n", - "11.3 Amount of Cementite present in peralite:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Fe=6.67;#Carbon percentage in Cementite\n", - "G=0.77;#Carbon percentage in peralite in composition\n", - "A=0.0218;#Carbon percentage in Ferrite\n", - "#CALCULATIONS\n", - "ferrite=((Fe-G)/(Fe-A))*100#Amount of ferrite present in peralite\n", - "C=((G-A)/(Fe-A))*100;#Amount of Cementite present in peralite\n", - "print round(ferrite,1),\"Amount of ferrite present in peralite:\"\n", - "print round(C,1),\"Amount of Cementite present in peralite:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_6 pgno:469" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "91.3 Composition of Phase Ferrite in alloy :\n", - "8.7 Composition of Cementite in percent in alloy:\n", - "22.7 Percentage of microconstituents Primary Ferrite in alloy:\n", - "77.3 Percentage of microconstituents Pearlite in alloy:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "A=0.0218;#Carbon percentage in primary alpha in percent\n", - "Fe=6.67;#Carbon percentage in Cementite in percent\n", - "G=0.77;#Carbon percentage in eutectoid composition at 727 degree celsius\n", - "C=0.60;#Carbon percentage in Pearlite in percent\n", - "#CALCULATIONS\n", - "alpha=((Fe-C)/(Fe-A))*100;# Composition of Phase Ferrite in alloy \n", - "Ce=((C-A)/(Fe-A))*100;#Composition of Cementite in percent in alloy\n", - "PF=((G-C)/(G-A))*100;#Percentage of microconstituents Primary Ferrite in alloy\n", - "P=((C-A)/(G-A))*100;#Percentage of microconstituents Pearlite in alloy\n", - "print round(alpha,1),\"Composition of Phase Ferrite in alloy :\"\n", - "print round(Ce,1),\"Composition of Cementite in percent in alloy:\"\n", - "print round(PF,1),\"Percentage of microconstituents Primary Ferrite in alloy:\"\n", - "print round(P,1),\"Percentage of microconstituents Pearlite in alloy:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_7 pgno:474" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "7.14285714286e-05 The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "d=0.001;#Actual distence between one alpha plate to next alpha plate \n", - "S=14;#Spacings between between one alpha plate to next alpha plate \n", - "#CALCULATIONS\n", - "lamida=d/S;#The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure\n", - "print lamida,\"The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_9 pgno:476" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.31 The carbon content of hypoeutectoid Steel in percentage:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "M=0.60;#Percentage of Carbon in Martensite at 750 degree celsius\n", - "a=50.;#Percentage of Carbon in Austenite at 750 degree celsius\n", - "c=0.02;#Percentage of Carbon atoms in Steel \n", - "X=(a/100)*(M-c)+c;#The carbon content of Steel in percentage\n", - "print X,\"The carbon content of hypoeutectoid Steel in percentage:\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_1.ipynb deleted file mode 100755 index 228a9818..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_1.ipynb +++ /dev/null @@ -1,211 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 12 Dispersion Strengthening by Phase Transmission and Heat Treatment" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_1 pgno:454" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1.35108097784 Constant 10**10 A=\n", - "-20829.0 Slpoe of the straight line -Q/R\n" - ] - } - ], - "source": [ - "from math import log,exp\n", - "# Initialisation of Variables\n", - "r1=0.111;#Rate of copper in min^-1 at 135 degree celsius\n", - "r2=0.004;#Rate of copper in min^-1 at 88 degree celsius\n", - "T1=408.;#Temperature in K\n", - "T2=361.;#Temperature in K\n", - "R=1.987;#Gas constant\n", - "Q=20693.;#Change in Rates\n", - "slope=(log(r1)-log(r2))/((1/T1)-(1/T2));#Slope of the straight line ploted ln(Growth rate) as a function of 1=T,\n", - "A=r1/(exp(-Q/(R*T1)));#Constant\n", - "print A/10**10,\"Constant 10**10 A=\"\n", - "print round(2*slope),\"Slpoe of the straight line -Q/R\"\n", - "#diffrence in asnwer is due to round off error\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_5 pgno:467" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "88.7 Amount of ferrite present in peralite:\n", - "11.3 Amount of Cementite present in peralite:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Fe=6.67;#Carbon percentage in Cementite\n", - "G=0.77;#Carbon percentage in peralite in composition\n", - "A=0.0218;#Carbon percentage in Ferrite\n", - "#CALCULATIONS\n", - "ferrite=((Fe-G)/(Fe-A))*100#Amount of ferrite present in peralite\n", - "C=((G-A)/(Fe-A))*100;#Amount of Cementite present in peralite\n", - "print round(ferrite,1),\"Amount of ferrite present in peralite:\"\n", - "print round(C,1),\"Amount of Cementite present in peralite:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_6 pgno:469" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "91.3 Composition of Phase Ferrite in alloy :\n", - "8.7 Composition of Cementite in percent in alloy:\n", - "22.7 Percentage of microconstituents Primary Ferrite in alloy:\n", - "77.3 Percentage of microconstituents Pearlite in alloy:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "A=0.0218;#Carbon percentage in primary alpha in percent\n", - "Fe=6.67;#Carbon percentage in Cementite in percent\n", - "G=0.77;#Carbon percentage in eutectoid composition at 727 degree celsius\n", - "C=0.60;#Carbon percentage in Pearlite in percent\n", - "#CALCULATIONS\n", - "alpha=((Fe-C)/(Fe-A))*100;# Composition of Phase Ferrite in alloy \n", - "Ce=((C-A)/(Fe-A))*100;#Composition of Cementite in percent in alloy\n", - "PF=((G-C)/(G-A))*100;#Percentage of microconstituents Primary Ferrite in alloy\n", - "P=((C-A)/(G-A))*100;#Percentage of microconstituents Pearlite in alloy\n", - "print round(alpha,1),\"Composition of Phase Ferrite in alloy :\"\n", - "print round(Ce,1),\"Composition of Cementite in percent in alloy:\"\n", - "print round(PF,1),\"Percentage of microconstituents Primary Ferrite in alloy:\"\n", - "print round(P,1),\"Percentage of microconstituents Pearlite in alloy:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_7 pgno:474" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "7.14285714286e-05 The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "d=0.001;#Actual distence between one alpha plate to next alpha plate \n", - "S=14;#Spacings between between one alpha plate to next alpha plate \n", - "#CALCULATIONS\n", - "lamida=d/S;#The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure\n", - "print lamida,\"The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_9 pgno:476" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.31 The carbon content of hypoeutectoid Steel in percentage:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "M=0.60;#Percentage of Carbon in Martensite at 750 degree celsius\n", - "a=50.;#Percentage of Carbon in Austenite at 750 degree celsius\n", - "c=0.02;#Percentage of Carbon atoms in Steel \n", - "X=(a/100)*(M-c)+c;#The carbon content of Steel in percentage\n", - "print X,\"The carbon content of hypoeutectoid Steel in percentage:\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_2.ipynb deleted file mode 100755 index a7fd04dc..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_2.ipynb +++ /dev/null @@ -1,211 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 12 Dispersion Strengthening by Phase Transmission and Heat Treatment" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_1 pgno:454" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Constant 10**10 A= 1.35108097784\n", - "Slpoe of the straight line -Q/R -20829.0\n" - ] - } - ], - "source": [ - "from math import log,exp\n", - "# Initialisation of Variables\n", - "r1=0.111;#Rate of copper in min^-1 at 135 degree celsius\n", - "r2=0.004;#Rate of copper in min^-1 at 88 degree celsius\n", - "T1=408.;#Temperature in K\n", - "T2=361.;#Temperature in K\n", - "R=1.987;#Gas constant\n", - "Q=20693.;#Change in Rates\n", - "slope=(log(r1)-log(r2))/((1/T1)-(1/T2));#Slope of the straight line ploted ln(Growth rate) as a function of 1=T,\n", - "A=r1/(exp(-Q/(R*T1)));#Constant\n", - "print \"Constant 10**10 A=\",A/10**10\n", - "print \"Slpoe of the straight line -Q/R\",round(2*slope)\n", - "#diffrence in asnwer is due to round off error\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_5 pgno:467" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Amount of ferrite present in peralite: 88.7\n", - "Amount of Cementite present in peralite: 11.3\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Fe=6.67;#Carbon percentage in Cementite\n", - "G=0.77;#Carbon percentage in peralite in composition\n", - "A=0.0218;#Carbon percentage in Ferrite\n", - "#CALCULATIONS\n", - "ferrite=((Fe-G)/(Fe-A))*100#Amount of ferrite present in peralite\n", - "C=((G-A)/(Fe-A))*100;#Amount of Cementite present in peralite\n", - "print \"Amount of ferrite present in peralite:\",round(ferrite,1)\n", - "print \"Amount of Cementite present in peralite:\",round(C,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_6 pgno:469" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Composition of Phase Ferrite in alloy : 91.3\n", - "Composition of Cementite in percent in alloy: 8.7\n", - "Percentage of microconstituents Primary Ferrite in alloy: 22.7\n", - "Percentage of microconstituents Pearlite in alloy: 77.3\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "A=0.0218;#Carbon percentage in primary alpha in percent\n", - "Fe=6.67;#Carbon percentage in Cementite in percent\n", - "G=0.77;#Carbon percentage in eutectoid composition at 727 degree celsius\n", - "C=0.60;#Carbon percentage in Pearlite in percent\n", - "#CALCULATIONS\n", - "alpha=((Fe-C)/(Fe-A))*100;# Composition of Phase Ferrite in alloy \n", - "Ce=((C-A)/(Fe-A))*100;#Composition of Cementite in percent in alloy\n", - "PF=((G-C)/(G-A))*100;#Percentage of microconstituents Primary Ferrite in alloy\n", - "P=((C-A)/(G-A))*100;#Percentage of microconstituents Pearlite in alloy\n", - "print \"Composition of Phase Ferrite in alloy :\",round(alpha,1)\n", - "print \"Composition of Cementite in percent in alloy:\",round(Ce,1)\n", - "print \"Percentage of microconstituents Primary Ferrite in alloy:\",round(PF,1)\n", - "print \"Percentage of microconstituents Pearlite in alloy:\", round(P,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_7 pgno:474" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure: 7.14285714286e-05\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "d=0.001;#Actual distence between one alpha plate to next alpha plate \n", - "S=14;#Spacings between between one alpha plate to next alpha plate \n", - "#CALCULATIONS\n", - "lamida=d/S;#The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure\n", - "print \"The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure:\",lamida\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_9 pgno:476" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The carbon content of hypoeutectoid Steel in percentage: 0.31\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "M=0.60;#Percentage of Carbon in Martensite at 750 degree celsius\n", - "a=50.;#Percentage of Carbon in Austenite at 750 degree celsius\n", - "c=0.02;#Percentage of Carbon atoms in Steel \n", - "X=(a/100)*(M-c)+c;#The carbon content of Steel in percentage\n", - "print \"The carbon content of hypoeutectoid Steel in percentage:\",X\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_3.ipynb deleted file mode 100755 index a7fd04dc..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_12_Dispersion_Strengthening__by_Phase_Transmission_and_Heat_Treatment_3.ipynb +++ /dev/null @@ -1,211 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 12 Dispersion Strengthening by Phase Transmission and Heat Treatment" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_1 pgno:454" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Constant 10**10 A= 1.35108097784\n", - "Slpoe of the straight line -Q/R -20829.0\n" - ] - } - ], - "source": [ - "from math import log,exp\n", - "# Initialisation of Variables\n", - "r1=0.111;#Rate of copper in min^-1 at 135 degree celsius\n", - "r2=0.004;#Rate of copper in min^-1 at 88 degree celsius\n", - "T1=408.;#Temperature in K\n", - "T2=361.;#Temperature in K\n", - "R=1.987;#Gas constant\n", - "Q=20693.;#Change in Rates\n", - "slope=(log(r1)-log(r2))/((1/T1)-(1/T2));#Slope of the straight line ploted ln(Growth rate) as a function of 1=T,\n", - "A=r1/(exp(-Q/(R*T1)));#Constant\n", - "print \"Constant 10**10 A=\",A/10**10\n", - "print \"Slpoe of the straight line -Q/R\",round(2*slope)\n", - "#diffrence in asnwer is due to round off error\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_5 pgno:467" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Amount of ferrite present in peralite: 88.7\n", - "Amount of Cementite present in peralite: 11.3\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Fe=6.67;#Carbon percentage in Cementite\n", - "G=0.77;#Carbon percentage in peralite in composition\n", - "A=0.0218;#Carbon percentage in Ferrite\n", - "#CALCULATIONS\n", - "ferrite=((Fe-G)/(Fe-A))*100#Amount of ferrite present in peralite\n", - "C=((G-A)/(Fe-A))*100;#Amount of Cementite present in peralite\n", - "print \"Amount of ferrite present in peralite:\",round(ferrite,1)\n", - "print \"Amount of Cementite present in peralite:\",round(C,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_6 pgno:469" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Composition of Phase Ferrite in alloy : 91.3\n", - "Composition of Cementite in percent in alloy: 8.7\n", - "Percentage of microconstituents Primary Ferrite in alloy: 22.7\n", - "Percentage of microconstituents Pearlite in alloy: 77.3\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "A=0.0218;#Carbon percentage in primary alpha in percent\n", - "Fe=6.67;#Carbon percentage in Cementite in percent\n", - "G=0.77;#Carbon percentage in eutectoid composition at 727 degree celsius\n", - "C=0.60;#Carbon percentage in Pearlite in percent\n", - "#CALCULATIONS\n", - "alpha=((Fe-C)/(Fe-A))*100;# Composition of Phase Ferrite in alloy \n", - "Ce=((C-A)/(Fe-A))*100;#Composition of Cementite in percent in alloy\n", - "PF=((G-C)/(G-A))*100;#Percentage of microconstituents Primary Ferrite in alloy\n", - "P=((C-A)/(G-A))*100;#Percentage of microconstituents Pearlite in alloy\n", - "print \"Composition of Phase Ferrite in alloy :\",round(alpha,1)\n", - "print \"Composition of Cementite in percent in alloy:\",round(Ce,1)\n", - "print \"Percentage of microconstituents Primary Ferrite in alloy:\",round(PF,1)\n", - "print \"Percentage of microconstituents Pearlite in alloy:\", round(P,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_7 pgno:474" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure: 7.14285714286e-05\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "d=0.001;#Actual distence between one alpha plate to next alpha plate \n", - "S=14;#Spacings between between one alpha plate to next alpha plate \n", - "#CALCULATIONS\n", - "lamida=d/S;#The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure\n", - "print \"The interlamellar spacing between one alpha plate to next alpha plate in Pearlite Microstructure:\",lamida\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 12_9 pgno:476" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The carbon content of hypoeutectoid Steel in percentage: 0.31\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "M=0.60;#Percentage of Carbon in Martensite at 750 degree celsius\n", - "a=50.;#Percentage of Carbon in Austenite at 750 degree celsius\n", - "c=0.02;#Percentage of Carbon atoms in Steel \n", - "X=(a/100)*(M-c)+c;#The carbon content of Steel in percentage\n", - "print \"The carbon content of hypoeutectoid Steel in percentage:\",X\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron.ipynb deleted file mode 100755 index ca546fd3..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron.ipynb +++ /dev/null @@ -1,103 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 13 Heat treatment of Steels and Cast Iron" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_1 pgno:496" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1.085512 Carbon content present in Steel:\n", - "1.065 Carbon content present in Steel:\n", - "The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Fe=6.67;#Carbon percentage in Cementite by weight\n", - "G=0.77;#Carbon percentage in eutectoid composition in steel by weight\n", - "A=0.0218;#Carbon percentage in Ferrite\n", - "Fe3C=16.;#Percentage of alpha ferrite in steel\n", - "P=95.;#Percentage of Pearlite in Steel\n", - "#CALCULATIONS\n", - "X1=((Fe3C/100)*(Fe-A))+A;#Carbon content present in Steel\n", - "X2=Fe-((P/100)*(Fe-G));#Carbon content present in Steel\n", - "print X1,\"Carbon content present in Steel:\"\n", - "print X2,\"Carbon content present in Steel:\"\n", - "print \"The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 13_3 pgno:502" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "36.0 primary alpha in percentage =\n", - "64.0 pearlite in percentage =\n" - ] - } - ], - "source": [ - "\n", - "primary_alpha=((0.77-.5)/(0.77-0.0218))*100\n", - "pearlite=((0.5-0.0218)/(0.77-0.0218))*100\n", - "print round(primary_alpha),\"primary alpha in percentage =\"\n", - "print round(pearlite),\"pearlite in percentage =\"\n", - "#Answer difference is due to roundoff" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_1.ipynb deleted file mode 100755 index ca546fd3..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_1.ipynb +++ /dev/null @@ -1,103 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 13 Heat treatment of Steels and Cast Iron" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_1 pgno:496" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1.085512 Carbon content present in Steel:\n", - "1.065 Carbon content present in Steel:\n", - "The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Fe=6.67;#Carbon percentage in Cementite by weight\n", - "G=0.77;#Carbon percentage in eutectoid composition in steel by weight\n", - "A=0.0218;#Carbon percentage in Ferrite\n", - "Fe3C=16.;#Percentage of alpha ferrite in steel\n", - "P=95.;#Percentage of Pearlite in Steel\n", - "#CALCULATIONS\n", - "X1=((Fe3C/100)*(Fe-A))+A;#Carbon content present in Steel\n", - "X2=Fe-((P/100)*(Fe-G));#Carbon content present in Steel\n", - "print X1,\"Carbon content present in Steel:\"\n", - "print X2,\"Carbon content present in Steel:\"\n", - "print \"The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 13_3 pgno:502" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "36.0 primary alpha in percentage =\n", - "64.0 pearlite in percentage =\n" - ] - } - ], - "source": [ - "\n", - "primary_alpha=((0.77-.5)/(0.77-0.0218))*100\n", - "pearlite=((0.5-0.0218)/(0.77-0.0218))*100\n", - "print round(primary_alpha),\"primary alpha in percentage =\"\n", - "print round(pearlite),\"pearlite in percentage =\"\n", - "#Answer difference is due to roundoff" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_2.ipynb deleted file mode 100755 index d8b06316..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_2.ipynb +++ /dev/null @@ -1,103 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 13 Heat treatment of Steels and Cast Iron" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_1 pgno:496" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Carbon content present in Steel: 1.085512\n", - "Carbon content present in Steel: 1.065\n", - "The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Fe=6.67;#Carbon percentage in Cementite by weight\n", - "G=0.77;#Carbon percentage in eutectoid composition in steel by weight\n", - "A=0.0218;#Carbon percentage in Ferrite\n", - "Fe3C=16.;#Percentage of alpha ferrite in steel\n", - "P=95.;#Percentage of Pearlite in Steel\n", - "#CALCULATIONS\n", - "X1=((Fe3C/100)*(Fe-A))+A;#Carbon content present in Steel\n", - "X2=Fe-((P/100)*(Fe-G));#Carbon content present in Steel\n", - "print \"Carbon content present in Steel:\",X1\n", - "print \"Carbon content present in Steel:\",X2\n", - "print \"The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 13_3 pgno:502" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "primary alpha in percentage = 36.0\n", - "pearlite in percentage = 64.0\n" - ] - } - ], - "source": [ - "\n", - "primary_alpha=((0.77-.5)/(0.77-0.0218))*100\n", - "pearlite=((0.5-0.0218)/(0.77-0.0218))*100\n", - "print \"primary alpha in percentage =\",round(primary_alpha)\n", - "print \"pearlite in percentage =\",round(pearlite)\n", - "#Answer difference is due to roundoff" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_3.ipynb deleted file mode 100755 index d8b06316..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_13_Heat_treatment_of_Steels_and_Cast_Iron_3.ipynb +++ /dev/null @@ -1,103 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 13 Heat treatment of Steels and Cast Iron" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 13_1 pgno:496" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Carbon content present in Steel: 1.085512\n", - "Carbon content present in Steel: 1.065\n", - "The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Fe=6.67;#Carbon percentage in Cementite by weight\n", - "G=0.77;#Carbon percentage in eutectoid composition in steel by weight\n", - "A=0.0218;#Carbon percentage in Ferrite\n", - "Fe3C=16.;#Percentage of alpha ferrite in steel\n", - "P=95.;#Percentage of Pearlite in Steel\n", - "#CALCULATIONS\n", - "X1=((Fe3C/100)*(Fe-A))+A;#Carbon content present in Steel\n", - "X2=Fe-((P/100)*(Fe-G));#Carbon content present in Steel\n", - "print \"Carbon content present in Steel:\",X1\n", - "print \"Carbon content present in Steel:\",X2\n", - "print \"The carbon content is on the order of 1.065 to 1.086 percent, consistent with a 10110 steel\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 13_3 pgno:502" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "primary alpha in percentage = 36.0\n", - "pearlite in percentage = 64.0\n" - ] - } - ], - "source": [ - "\n", - "primary_alpha=((0.77-.5)/(0.77-0.0218))*100\n", - "pearlite=((0.5-0.0218)/(0.77-0.0218))*100\n", - "print \"primary alpha in percentage =\",round(primary_alpha)\n", - "print \"pearlite in percentage =\",round(pearlite)\n", - "#Answer difference is due to roundoff" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy.ipynb deleted file mode 100755 index b25dd603..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy.ipynb +++ /dev/null @@ -1,76 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 14 Nonferrous Alloy" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exaple 14_1 pgno:545" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "13744.4678595 a. Load applied on Aluminum in lb:\n", - "0.669159235215 c. Weight of Steel in lb/ft:\n", - "0.444404460789 Weight of Aluminum in lb/ft:\n", - "0.697 b. Diameter of Aluminum in in.: \n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "# Initialisation of Variables\n", - "d1=0.5;#Diameter of a steel Cable in in.\n", - "rhoy=70000.;#Yield Strength of Steel Cable in psi\n", - "rhoa1=36000.;#Yield Strength of Aluminum in psi\n", - "rhos=0.284;#Density of Steel in lb/in**3\n", - "rhoa2=0.097;#Density of Aluminum in lb/in**3\n", - "#CALCULATIONS\n", - "F=rhoy*((pi/4)*(d1**2));#Load applied on Aluminum in lb\n", - "d2=sqrt((F/rhoa1)*(4/(pi)));#Diameter of Aluminum in in.\n", - "Ws=(pi/4)*(d1**2)*12*rhos;#Weight of Steel in lb/ft\n", - "Wa=(pi/4)*(d2**2)*12*rhoa2;#Weight of Aluminum in lb/ft\n", - "print F,\"a. Load applied on Aluminum in lb:\"\n", - "print Ws,\"c. Weight of Steel in lb/ft:\"\n", - "print round(Wa,3),\"Weight of Aluminum in lb/ft:\"\n", - "print round(d2,3),\"b. Diameter of Aluminum in in.: \"" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_1.ipynb deleted file mode 100755 index b25dd603..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_1.ipynb +++ /dev/null @@ -1,76 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 14 Nonferrous Alloy" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exaple 14_1 pgno:545" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "13744.4678595 a. Load applied on Aluminum in lb:\n", - "0.669159235215 c. Weight of Steel in lb/ft:\n", - "0.444404460789 Weight of Aluminum in lb/ft:\n", - "0.697 b. Diameter of Aluminum in in.: \n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "# Initialisation of Variables\n", - "d1=0.5;#Diameter of a steel Cable in in.\n", - "rhoy=70000.;#Yield Strength of Steel Cable in psi\n", - "rhoa1=36000.;#Yield Strength of Aluminum in psi\n", - "rhos=0.284;#Density of Steel in lb/in**3\n", - "rhoa2=0.097;#Density of Aluminum in lb/in**3\n", - "#CALCULATIONS\n", - "F=rhoy*((pi/4)*(d1**2));#Load applied on Aluminum in lb\n", - "d2=sqrt((F/rhoa1)*(4/(pi)));#Diameter of Aluminum in in.\n", - "Ws=(pi/4)*(d1**2)*12*rhos;#Weight of Steel in lb/ft\n", - "Wa=(pi/4)*(d2**2)*12*rhoa2;#Weight of Aluminum in lb/ft\n", - "print F,\"a. Load applied on Aluminum in lb:\"\n", - "print Ws,\"c. Weight of Steel in lb/ft:\"\n", - "print round(Wa,3),\"Weight of Aluminum in lb/ft:\"\n", - "print round(d2,3),\"b. Diameter of Aluminum in in.: \"" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_2.ipynb deleted file mode 100755 index 2fda7c51..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_2.ipynb +++ /dev/null @@ -1,76 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 14 Nonferrous Alloy" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exaple 14_1 pgno:545" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a. Load applied on Aluminum in lb: 13744.4678595\n", - "c. Weight of Steel in lb/ft: 0.669159235215\n", - "Weight of Aluminum in lb/ft: 0.444\n", - "b. Diameter of Aluminum in in.: 0.697\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "# Initialisation of Variables\n", - "d1=0.5;#Diameter of a steel Cable in in.\n", - "rhoy=70000.;#Yield Strength of Steel Cable in psi\n", - "rhoa1=36000.;#Yield Strength of Aluminum in psi\n", - "rhos=0.284;#Density of Steel in lb/in**3\n", - "rhoa2=0.097;#Density of Aluminum in lb/in**3\n", - "#CALCULATIONS\n", - "F=rhoy*((pi/4)*(d1**2));#Load applied on Aluminum in lb\n", - "d2=sqrt((F/rhoa1)*(4/(pi)));#Diameter of Aluminum in in.\n", - "Ws=(pi/4)*(d1**2)*12*rhos;#Weight of Steel in lb/ft\n", - "Wa=(pi/4)*(d2**2)*12*rhoa2;#Weight of Aluminum in lb/ft\n", - "print \"a. Load applied on Aluminum in lb:\",F\n", - "print \"c. Weight of Steel in lb/ft:\",Ws\n", - "print \"Weight of Aluminum in lb/ft:\",round(Wa,3)\n", - "print \"b. Diameter of Aluminum in in.: \",round(d2,3)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_3.ipynb deleted file mode 100755 index 2fda7c51..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_14_Nonferrous_Alloy_3.ipynb +++ /dev/null @@ -1,76 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 14 Nonferrous Alloy" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exaple 14_1 pgno:545" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a. Load applied on Aluminum in lb: 13744.4678595\n", - "c. Weight of Steel in lb/ft: 0.669159235215\n", - "Weight of Aluminum in lb/ft: 0.444\n", - "b. Diameter of Aluminum in in.: 0.697\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "# Initialisation of Variables\n", - "d1=0.5;#Diameter of a steel Cable in in.\n", - "rhoy=70000.;#Yield Strength of Steel Cable in psi\n", - "rhoa1=36000.;#Yield Strength of Aluminum in psi\n", - "rhos=0.284;#Density of Steel in lb/in**3\n", - "rhoa2=0.097;#Density of Aluminum in lb/in**3\n", - "#CALCULATIONS\n", - "F=rhoy*((pi/4)*(d1**2));#Load applied on Aluminum in lb\n", - "d2=sqrt((F/rhoa1)*(4/(pi)));#Diameter of Aluminum in in.\n", - "Ws=(pi/4)*(d1**2)*12*rhos;#Weight of Steel in lb/ft\n", - "Wa=(pi/4)*(d2**2)*12*rhoa2;#Weight of Aluminum in lb/ft\n", - "print \"a. Load applied on Aluminum in lb:\",F\n", - "print \"c. Weight of Steel in lb/ft:\",Ws\n", - "print \"Weight of Aluminum in lb/ft:\",round(Wa,3)\n", - "print \"b. Diameter of Aluminum in in.: \",round(d2,3)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials.ipynb deleted file mode 100755 index 7f24b9ba..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials.ipynb +++ /dev/null @@ -1,111 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 15 Ceramic Materials" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_1 pgno:581" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "15.5279503106 Apparent Porosity in percent:\n", - "2.23602484472 Bulk Density of Ceramic:\n", - "30.1242236025 True Porosity of Ceramic in Percent:\n", - "0.485 Fraction Closed Pores of Ceramic:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rho=3.2;#Specific Gravity of SiC in g/cm**2\n", - "Ww=385.;#Weight of Ceramic when dry in g\n", - "Wd=360.;#Weight of Ceramic after Soaking in water in g\n", - "Ws=224.;#Weight of Ceramic Suspended in water in g\n", - "#CALCULATIONS\n", - "A=((Ww-Wd)/(Ww-Ws))*100;#Apparent Porosity in percent\n", - "B=(Wd)/(Ww-Ws);#Bulk Density of Ceramic\n", - "T=((rho-B)/rho)*100;#True Porosity of Ceramic in Percent\n", - "C=T-A;#Closed pore percent of ceramic\n", - "F=C/T;#Fraction Closed Pores of Ceramic\n", - "print A,\"Apparent Porosity in percent:\"\n", - "print B,\"Bulk Density of Ceramic:\"\n", - "print T,\"True Porosity of Ceramic in Percent:\"\n", - "print round(F,3),\"Fraction Closed Pores of Ceramic:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_2 pgno:584" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.142857142857 Mole Fraction of B2O3:\n", - "16.2 Weight Percent of B2O3:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "R=2.5;#Ratio of O to Si in SiO2\n", - "W1=69.62;#Weight of B2O3 in g/ml\n", - "W2=60.08;##Weight of SiO2 in g/ml\n", - "#CALCULATIONS\n", - "Fb1=(R-2)/3.5;#Mole Fraction of B2O3\n", - "Fb2=1-Fb1;#Mole fraction of SiO2\n", - "Wp=((Fb1*W1)/((Fb1*W1)+(Fb2*W2)))*100;#Weight Percent of B2O3\n", - "print Fb1,\"Mole Fraction of B2O3:\"\n", - "print round(Wp,1),\"Weight Percent of B2O3:\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_1.ipynb deleted file mode 100755 index 7f24b9ba..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_1.ipynb +++ /dev/null @@ -1,111 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 15 Ceramic Materials" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_1 pgno:581" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "15.5279503106 Apparent Porosity in percent:\n", - "2.23602484472 Bulk Density of Ceramic:\n", - "30.1242236025 True Porosity of Ceramic in Percent:\n", - "0.485 Fraction Closed Pores of Ceramic:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rho=3.2;#Specific Gravity of SiC in g/cm**2\n", - "Ww=385.;#Weight of Ceramic when dry in g\n", - "Wd=360.;#Weight of Ceramic after Soaking in water in g\n", - "Ws=224.;#Weight of Ceramic Suspended in water in g\n", - "#CALCULATIONS\n", - "A=((Ww-Wd)/(Ww-Ws))*100;#Apparent Porosity in percent\n", - "B=(Wd)/(Ww-Ws);#Bulk Density of Ceramic\n", - "T=((rho-B)/rho)*100;#True Porosity of Ceramic in Percent\n", - "C=T-A;#Closed pore percent of ceramic\n", - "F=C/T;#Fraction Closed Pores of Ceramic\n", - "print A,\"Apparent Porosity in percent:\"\n", - "print B,\"Bulk Density of Ceramic:\"\n", - "print T,\"True Porosity of Ceramic in Percent:\"\n", - "print round(F,3),\"Fraction Closed Pores of Ceramic:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_2 pgno:584" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.142857142857 Mole Fraction of B2O3:\n", - "16.2 Weight Percent of B2O3:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "R=2.5;#Ratio of O to Si in SiO2\n", - "W1=69.62;#Weight of B2O3 in g/ml\n", - "W2=60.08;##Weight of SiO2 in g/ml\n", - "#CALCULATIONS\n", - "Fb1=(R-2)/3.5;#Mole Fraction of B2O3\n", - "Fb2=1-Fb1;#Mole fraction of SiO2\n", - "Wp=((Fb1*W1)/((Fb1*W1)+(Fb2*W2)))*100;#Weight Percent of B2O3\n", - "print Fb1,\"Mole Fraction of B2O3:\"\n", - "print round(Wp,1),\"Weight Percent of B2O3:\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_2.ipynb deleted file mode 100755 index 9fe28829..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_2.ipynb +++ /dev/null @@ -1,111 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 15 Ceramic Materials" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_1 pgno:581" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Apparent Porosity in percent: 15.5279503106\n", - "Bulk Density of Ceramic: 2.23602484472\n", - "True Porosity of Ceramic in Percent: 30.1242236025\n", - "Fraction Closed Pores of Ceramic: 0.485\n" - ] - } - ], - "source": [ - "# Initialisation of Variables,\n", - "rho=3.2;#Specific Gravity of SiC in g/cm**2\n", - "Ww=385.;#Weight of Ceramic when dry in g\n", - "Wd=360.;#Weight of Ceramic after Soaking in water in g\n", - "Ws=224.;#Weight of Ceramic Suspended in water in g\n", - "#CALCULATIONS\n", - "A=((Ww-Wd)/(Ww-Ws))*100;#Apparent Porosity in percent\n", - "B=(Wd)/(Ww-Ws);#Bulk Density of Ceramic\n", - "T=((rho-B)/rho)*100;#True Porosity of Ceramic in Percent\n", - "C=T-A;#Closed pore percent of ceramic\n", - "F=C/T;#Fraction Closed Pores of Ceramic\n", - "print \"Apparent Porosity in percent:\",A\n", - "print \"Bulk Density of Ceramic:\",B\n", - "print \"True Porosity of Ceramic in Percent:\",T\n", - "print \"Fraction Closed Pores of Ceramic:\",round(F,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_2 pgno:584" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Mole Fraction of B2O3: 0.142857142857\n", - "Weight Percent of B2O3: 16.2\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "R=2.5;#Ratio of O to Si in SiO2\n", - "W1=69.62;#Weight of B2O3 in g/ml\n", - "W2=60.08;##Weight of SiO2 in g/ml\n", - "#CALCULATIONS\n", - "Fb1=(R-2)/3.5;#Mole Fraction of B2O3\n", - "Fb2=1-Fb1;#Mole fraction of SiO2\n", - "Wp=((Fb1*W1)/((Fb1*W1)+(Fb2*W2)))*100;#Weight Percent of B2O3\n", - "print \"Mole Fraction of B2O3:\",Fb1\n", - "print \"Weight Percent of B2O3:\",round(Wp,1)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_3.ipynb deleted file mode 100755 index 9fe28829..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_15_Ceramic_Materials_3.ipynb +++ /dev/null @@ -1,111 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 15 Ceramic Materials" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_1 pgno:581" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Apparent Porosity in percent: 15.5279503106\n", - "Bulk Density of Ceramic: 2.23602484472\n", - "True Porosity of Ceramic in Percent: 30.1242236025\n", - "Fraction Closed Pores of Ceramic: 0.485\n" - ] - } - ], - "source": [ - "# Initialisation of Variables,\n", - "rho=3.2;#Specific Gravity of SiC in g/cm**2\n", - "Ww=385.;#Weight of Ceramic when dry in g\n", - "Wd=360.;#Weight of Ceramic after Soaking in water in g\n", - "Ws=224.;#Weight of Ceramic Suspended in water in g\n", - "#CALCULATIONS\n", - "A=((Ww-Wd)/(Ww-Ws))*100;#Apparent Porosity in percent\n", - "B=(Wd)/(Ww-Ws);#Bulk Density of Ceramic\n", - "T=((rho-B)/rho)*100;#True Porosity of Ceramic in Percent\n", - "C=T-A;#Closed pore percent of ceramic\n", - "F=C/T;#Fraction Closed Pores of Ceramic\n", - "print \"Apparent Porosity in percent:\",A\n", - "print \"Bulk Density of Ceramic:\",B\n", - "print \"True Porosity of Ceramic in Percent:\",T\n", - "print \"Fraction Closed Pores of Ceramic:\",round(F,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 15_2 pgno:584" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Mole Fraction of B2O3: 0.142857142857\n", - "Weight Percent of B2O3: 16.2\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "R=2.5;#Ratio of O to Si in SiO2\n", - "W1=69.62;#Weight of B2O3 in g/ml\n", - "W2=60.08;##Weight of SiO2 in g/ml\n", - "#CALCULATIONS\n", - "Fb1=(R-2)/3.5;#Mole Fraction of B2O3\n", - "Fb2=1-Fb1;#Mole fraction of SiO2\n", - "Wp=((Fb1*W1)/((Fb1*W1)+(Fb2*W2)))*100;#Weight Percent of B2O3\n", - "print \"Mole Fraction of B2O3:\",Fb1\n", - "print \"Weight Percent of B2O3:\",round(Wp,1)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers.ipynb deleted file mode 100755 index 699eac73..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers.ipynb +++ /dev/null @@ -1,221 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 16 Polymers" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_2 pgno:607" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "7142.85714286 Degree of Polymerization :\n", - "2.15e+25 No. of Monomers present :\n", - "3.01e+21 NO. of Benzoyl Peroxide Molecules to be present:\n", - "6 Amount of Initiator needed in gm:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "W=28.;#Molecular weight of Ethylene in g/mol\n", - "W1=200000.;#Molecular weight of Benzoyl Peroxide in g/mol\n", - "W2=1000.;#Weight of Polyethylene in gm\n", - "W3=242.;#Molecular Weight of Benzoyl Peroxide in g/mol\n", - "#Calculations\n", - "DP=W1/W;# Degree of Polymerization \n", - "n=(W2*6.02*10**23)/W;#No. of Monomers present \n", - "M=n/DP;#NO. of Benzoyl Peroxide Molecules to be present\n", - "Ai=6#(M*W3)/6.02*10**23;#Amount of Initiator needed in gm\n", - "print DP,\"Degree of Polymerization :\"\n", - "print n,\"No. of Monomers present :\"\n", - "print M,\"NO. of Benzoyl Peroxide Molecules to be present:\"\n", - "print Ai,\"Amount of Initiator needed in gm:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_3 pgno:609" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1948.0 Amount of Nylon Produced:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "W1=116.;#Molecular Weight of Hexamethylene Diamine in g/mol\n", - "W2=146.;#Molecular Weight of Adipic Acid in g/mol\n", - "W3=18.;#Molecular Weight of Water in g/mol\n", - "W=1000.;#Weight of Hexamethylene Diamine in gm\n", - "#Calculations\n", - "N=W/W1;#No. of Moles of Hexamethylene Diamine \n", - "X=N*W2;#Weight of Adipic Acid required\n", - "Y=N*W3;#Weight of Water in gm\n", - "N2=W+X-2*Y;#Amount of Nylon Produced\n", - "print round(N2),\"Amount of Nylon Produced:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_4 pgno:611" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "530 Degree of Polymerization of 6,6-nylon:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "W1=116;#Molecular Weight of Hexamethylene Diamine in g/mol\n", - "W2=146;#Molecular Weight of Adipic Acid in g/mol\n", - "W3=18;#Molecular Weight of Water in g/mol\n", - "W4=120000;#Molecular Weight of 6,6-nylon in g/mol\n", - "#alculations\n", - "M=W1+W2-2*W3;#Molecular Weight of the repeated unit\n", - "DOP=W4/M;#Degree of Polymerization of 6,6-nylon\n", - "print DOP,\"Degree of Polymerization of 6,6-nylon:\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_7 pgno:624" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.993212670161 Density of Crystalline polymer:\n", - "9.16018425762 Crystall. of Polyethylene initial:\n", - "39.6 Crystall. of Polyethylene final:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "M=56.;#Molecular Weight of Polyethylene \n", - "P=0.88;#Measured density of PolyethyleneInitial\n", - "P1=0.915;#Measured density of Polyethylene Final\n", - "Pa=0.87;#Density of Amorphous Polyethylene \n", - "#Caluculations\n", - "Pc=M/(7.42*4.95*(2.55*10**-24)*6.02*10**23);#Density of complete Crystalline polymer\n", - "Cp1= ((Pc/P)*((P-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene initial\n", - "Cp2= ((Pc/P1)*((P1-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene final\n", - "print Pc,\"Density of Crystalline polymer:\"\n", - "print Cp1,\"Crystall. of Polyethylene initial:\"\n", - "print round(Cp2,1),\"Crystall. of Polyethylene final:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_9 pgno:628" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "297.0 Relaxation time in weeks:\n", - "1787.0 Initial Stress to be placed in psi:\n" - ] - } - ], - "source": [ - "from math import log,e\n", - "#INITIALISATION OF VAREIABLES\n", - "sig1=980.;#Initial Stress of POlyisoprene in psi\n", - "sig2=1000.;#Fnal Stress of POlyisoprene in psi\n", - "sig3=1500.;# Stress of POlyisoprene after one year in psi\n", - "t1=6.;#time in weeks\n", - "t2=52.;#time in weeks\n", - "#CALCULATIONS\n", - "Rt=-t1/(log(sig1/sig2));#Relaxation time in weeks\n", - "sig=sig3/(e**(-t2/Rt));#Initial Stress to be placed in psi\n", - "print round(Rt),\"Relaxation time in weeks:\"\n", - "print round (sig),\"Initial Stress to be placed in psi:\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_1.ipynb deleted file mode 100755 index 699eac73..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_1.ipynb +++ /dev/null @@ -1,221 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 16 Polymers" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_2 pgno:607" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "7142.85714286 Degree of Polymerization :\n", - "2.15e+25 No. of Monomers present :\n", - "3.01e+21 NO. of Benzoyl Peroxide Molecules to be present:\n", - "6 Amount of Initiator needed in gm:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "W=28.;#Molecular weight of Ethylene in g/mol\n", - "W1=200000.;#Molecular weight of Benzoyl Peroxide in g/mol\n", - "W2=1000.;#Weight of Polyethylene in gm\n", - "W3=242.;#Molecular Weight of Benzoyl Peroxide in g/mol\n", - "#Calculations\n", - "DP=W1/W;# Degree of Polymerization \n", - "n=(W2*6.02*10**23)/W;#No. of Monomers present \n", - "M=n/DP;#NO. of Benzoyl Peroxide Molecules to be present\n", - "Ai=6#(M*W3)/6.02*10**23;#Amount of Initiator needed in gm\n", - "print DP,\"Degree of Polymerization :\"\n", - "print n,\"No. of Monomers present :\"\n", - "print M,\"NO. of Benzoyl Peroxide Molecules to be present:\"\n", - "print Ai,\"Amount of Initiator needed in gm:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_3 pgno:609" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1948.0 Amount of Nylon Produced:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "W1=116.;#Molecular Weight of Hexamethylene Diamine in g/mol\n", - "W2=146.;#Molecular Weight of Adipic Acid in g/mol\n", - "W3=18.;#Molecular Weight of Water in g/mol\n", - "W=1000.;#Weight of Hexamethylene Diamine in gm\n", - "#Calculations\n", - "N=W/W1;#No. of Moles of Hexamethylene Diamine \n", - "X=N*W2;#Weight of Adipic Acid required\n", - "Y=N*W3;#Weight of Water in gm\n", - "N2=W+X-2*Y;#Amount of Nylon Produced\n", - "print round(N2),\"Amount of Nylon Produced:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_4 pgno:611" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "530 Degree of Polymerization of 6,6-nylon:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "W1=116;#Molecular Weight of Hexamethylene Diamine in g/mol\n", - "W2=146;#Molecular Weight of Adipic Acid in g/mol\n", - "W3=18;#Molecular Weight of Water in g/mol\n", - "W4=120000;#Molecular Weight of 6,6-nylon in g/mol\n", - "#alculations\n", - "M=W1+W2-2*W3;#Molecular Weight of the repeated unit\n", - "DOP=W4/M;#Degree of Polymerization of 6,6-nylon\n", - "print DOP,\"Degree of Polymerization of 6,6-nylon:\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_7 pgno:624" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.993212670161 Density of Crystalline polymer:\n", - "9.16018425762 Crystall. of Polyethylene initial:\n", - "39.6 Crystall. of Polyethylene final:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "M=56.;#Molecular Weight of Polyethylene \n", - "P=0.88;#Measured density of PolyethyleneInitial\n", - "P1=0.915;#Measured density of Polyethylene Final\n", - "Pa=0.87;#Density of Amorphous Polyethylene \n", - "#Caluculations\n", - "Pc=M/(7.42*4.95*(2.55*10**-24)*6.02*10**23);#Density of complete Crystalline polymer\n", - "Cp1= ((Pc/P)*((P-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene initial\n", - "Cp2= ((Pc/P1)*((P1-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene final\n", - "print Pc,\"Density of Crystalline polymer:\"\n", - "print Cp1,\"Crystall. of Polyethylene initial:\"\n", - "print round(Cp2,1),\"Crystall. of Polyethylene final:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_9 pgno:628" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "297.0 Relaxation time in weeks:\n", - "1787.0 Initial Stress to be placed in psi:\n" - ] - } - ], - "source": [ - "from math import log,e\n", - "#INITIALISATION OF VAREIABLES\n", - "sig1=980.;#Initial Stress of POlyisoprene in psi\n", - "sig2=1000.;#Fnal Stress of POlyisoprene in psi\n", - "sig3=1500.;# Stress of POlyisoprene after one year in psi\n", - "t1=6.;#time in weeks\n", - "t2=52.;#time in weeks\n", - "#CALCULATIONS\n", - "Rt=-t1/(log(sig1/sig2));#Relaxation time in weeks\n", - "sig=sig3/(e**(-t2/Rt));#Initial Stress to be placed in psi\n", - "print round(Rt),\"Relaxation time in weeks:\"\n", - "print round (sig),\"Initial Stress to be placed in psi:\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_2.ipynb deleted file mode 100755 index be45c561..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_2.ipynb +++ /dev/null @@ -1,221 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 16 Polymers" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_2 pgno:607" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Degree of Polymerization : 7142.85714286\n", - "No. of Monomers present : 2.15e+25\n", - "NO. of Benzoyl Peroxide Molecules to be present: 3.01e+21\n", - "Amount of Initiator needed in gm: 6\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "W=28.;#Molecular weight of Ethylene in g/mol\n", - "W1=200000.;#Molecular weight of Benzoyl Peroxide in g/mol\n", - "W2=1000.;#Weight of Polyethylene in gm\n", - "W3=242.;#Molecular Weight of Benzoyl Peroxide in g/mol\n", - "#Calculations\n", - "DP=W1/W;# Degree of Polymerization \n", - "n=(W2*6.02*10**23)/W;#No. of Monomers present \n", - "M=n/DP;#NO. of Benzoyl Peroxide Molecules to be present\n", - "Ai=6#(M*W3)/6.02*10**23;#Amount of Initiator needed in gm\n", - "print \"Degree of Polymerization :\",DP\n", - "print \"No. of Monomers present :\",n\n", - "print \"NO. of Benzoyl Peroxide Molecules to be present:\",M\n", - "print \"Amount of Initiator needed in gm:\",Ai\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_3 pgno:609" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Amount of Nylon Produced: 1948.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "W1=116.;#Molecular Weight of Hexamethylene Diamine in g/mol\n", - "W2=146.;#Molecular Weight of Adipic Acid in g/mol\n", - "W3=18.;#Molecular Weight of Water in g/mol\n", - "W=1000.;#Weight of Hexamethylene Diamine in gm\n", - "#Calculations\n", - "N=W/W1;#No. of Moles of Hexamethylene Diamine \n", - "X=N*W2;#Weight of Adipic Acid required\n", - "Y=N*W3;#Weight of Water in gm\n", - "N2=W+X-2*Y;#Amount of Nylon Produced\n", - "print \"Amount of Nylon Produced:\",round(N2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_4 pgno:611" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "530 Degree of Polymerization of 6,6-nylon:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "W1=116;#Molecular Weight of Hexamethylene Diamine in g/mol\n", - "W2=146;#Molecular Weight of Adipic Acid in g/mol\n", - "W3=18;#Molecular Weight of Water in g/mol\n", - "W4=120000;#Molecular Weight of 6,6-nylon in g/mol\n", - "#alculations\n", - "M=W1+W2-2*W3;#Molecular Weight of the repeated unit\n", - "DOP=W4/M;#Degree of Polymerization of 6,6-nylon\n", - "print \"Degree of Polymerization of 6,6-nylon:\",DOP" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_7 pgno:624" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Density of Crystalline polymer: 0.993212670161\n", - "Crystall. of Polyethylene initial: 9.16018425762\n", - "Crystall. of Polyethylene final: 39.6\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "M=56.;#Molecular Weight of Polyethylene \n", - "P=0.88;#Measured density of PolyethyleneInitial\n", - "P1=0.915;#Measured density of Polyethylene Final\n", - "Pa=0.87;#Density of Amorphous Polyethylene \n", - "#Caluculations\n", - "Pc=M/(7.42*4.95*(2.55*10**-24)*6.02*10**23);#Density of complete Crystalline polymer\n", - "Cp1= ((Pc/P)*((P-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene initial\n", - "Cp2= ((Pc/P1)*((P1-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene final\n", - "print \"Density of Crystalline polymer:\",Pc\n", - "print \"Crystall. of Polyethylene initial:\",Cp1\n", - "print \"Crystall. of Polyethylene final:\",round(Cp2,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_9 pgno:628" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Relaxation time in weeks: 297.0\n", - "Initial Stress to be placed in psi: 1787.0\n" - ] - } - ], - "source": [ - "from math import log,e\n", - "#INITIALISATION OF VAREIABLES\n", - "sig1=980.;#Initial Stress of POlyisoprene in psi\n", - "sig2=1000.;#Fnal Stress of POlyisoprene in psi\n", - "sig3=1500.;# Stress of POlyisoprene after one year in psi\n", - "t1=6.;#time in weeks\n", - "t2=52.;#time in weeks\n", - "#CALCULATIONS\n", - "Rt=-t1/(log(sig1/sig2));#Relaxation time in weeks\n", - "sig=sig3/(e**(-t2/Rt));#Initial Stress to be placed in psi\n", - "print\"Relaxation time in weeks:\", round(Rt)\n", - "print\"Initial Stress to be placed in psi:\",round(sig)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_3.ipynb deleted file mode 100755 index be45c561..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_16_Polymers_3.ipynb +++ /dev/null @@ -1,221 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 16 Polymers" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_2 pgno:607" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Degree of Polymerization : 7142.85714286\n", - "No. of Monomers present : 2.15e+25\n", - "NO. of Benzoyl Peroxide Molecules to be present: 3.01e+21\n", - "Amount of Initiator needed in gm: 6\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "W=28.;#Molecular weight of Ethylene in g/mol\n", - "W1=200000.;#Molecular weight of Benzoyl Peroxide in g/mol\n", - "W2=1000.;#Weight of Polyethylene in gm\n", - "W3=242.;#Molecular Weight of Benzoyl Peroxide in g/mol\n", - "#Calculations\n", - "DP=W1/W;# Degree of Polymerization \n", - "n=(W2*6.02*10**23)/W;#No. of Monomers present \n", - "M=n/DP;#NO. of Benzoyl Peroxide Molecules to be present\n", - "Ai=6#(M*W3)/6.02*10**23;#Amount of Initiator needed in gm\n", - "print \"Degree of Polymerization :\",DP\n", - "print \"No. of Monomers present :\",n\n", - "print \"NO. of Benzoyl Peroxide Molecules to be present:\",M\n", - "print \"Amount of Initiator needed in gm:\",Ai\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_3 pgno:609" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Amount of Nylon Produced: 1948.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "W1=116.;#Molecular Weight of Hexamethylene Diamine in g/mol\n", - "W2=146.;#Molecular Weight of Adipic Acid in g/mol\n", - "W3=18.;#Molecular Weight of Water in g/mol\n", - "W=1000.;#Weight of Hexamethylene Diamine in gm\n", - "#Calculations\n", - "N=W/W1;#No. of Moles of Hexamethylene Diamine \n", - "X=N*W2;#Weight of Adipic Acid required\n", - "Y=N*W3;#Weight of Water in gm\n", - "N2=W+X-2*Y;#Amount of Nylon Produced\n", - "print \"Amount of Nylon Produced:\",round(N2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_4 pgno:611" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "530 Degree of Polymerization of 6,6-nylon:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "W1=116;#Molecular Weight of Hexamethylene Diamine in g/mol\n", - "W2=146;#Molecular Weight of Adipic Acid in g/mol\n", - "W3=18;#Molecular Weight of Water in g/mol\n", - "W4=120000;#Molecular Weight of 6,6-nylon in g/mol\n", - "#alculations\n", - "M=W1+W2-2*W3;#Molecular Weight of the repeated unit\n", - "DOP=W4/M;#Degree of Polymerization of 6,6-nylon\n", - "print \"Degree of Polymerization of 6,6-nylon:\",DOP" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_7 pgno:624" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Density of Crystalline polymer: 0.993212670161\n", - "Crystall. of Polyethylene initial: 9.16018425762\n", - "Crystall. of Polyethylene final: 39.6\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "M=56.;#Molecular Weight of Polyethylene \n", - "P=0.88;#Measured density of PolyethyleneInitial\n", - "P1=0.915;#Measured density of Polyethylene Final\n", - "Pa=0.87;#Density of Amorphous Polyethylene \n", - "#Caluculations\n", - "Pc=M/(7.42*4.95*(2.55*10**-24)*6.02*10**23);#Density of complete Crystalline polymer\n", - "Cp1= ((Pc/P)*((P-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene initial\n", - "Cp2= ((Pc/P1)*((P1-Pa)/(Pc-Pa)))*100;#Crystallinity of Polyethylene final\n", - "print \"Density of Crystalline polymer:\",Pc\n", - "print \"Crystall. of Polyethylene initial:\",Cp1\n", - "print \"Crystall. of Polyethylene final:\",round(Cp2,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 16_9 pgno:628" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Relaxation time in weeks: 297.0\n", - "Initial Stress to be placed in psi: 1787.0\n" - ] - } - ], - "source": [ - "from math import log,e\n", - "#INITIALISATION OF VAREIABLES\n", - "sig1=980.;#Initial Stress of POlyisoprene in psi\n", - "sig2=1000.;#Fnal Stress of POlyisoprene in psi\n", - "sig3=1500.;# Stress of POlyisoprene after one year in psi\n", - "t1=6.;#time in weeks\n", - "t2=52.;#time in weeks\n", - "#CALCULATIONS\n", - "Rt=-t1/(log(sig1/sig2));#Relaxation time in weeks\n", - "sig=sig3/(e**(-t2/Rt));#Initial Stress to be placed in psi\n", - "print\"Relaxation time in weeks:\", round(Rt)\n", - "print\"Initial Stress to be placed in psi:\",round(sig)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials.ipynb deleted file mode 100755 index ced00220..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials.ipynb +++ /dev/null @@ -1,374 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 17 Composites :Teamwork and Synergy in Materials" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_1 pgno:655" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "4.68538254249e+13 Concentration of ThO2 in particles/cm**3:\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "per1=2.;#Percent weight of ThO2\n", - "per2=98.;#Percentage weight of Nickle\n", - "rho1=9.69;#Density of ThO2 in g/cm**3\n", - "rho2=8.9;#Density of Nickel in g/cm**3\n", - "r=0.5*10**-5;#Radius of ThO2 particle in cm\n", - "#calculations\n", - "f=(2/rho1)/((per1/rho1)+(per2/rho2));#Volume fraction of ThO2 per cm**3 of composite\n", - "v=(4/3)*(pi)*r**3;#Volume of ech ThO2 sphere in cm**3\n", - "c=f/v;#Concentration of ThO2 particles in particles/cm**3\n", - "print c,\"Concentration of ThO2 in particles/cm**3:\"\n", - "\n", - "#the difference in answer is due to round off error\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_2 pgno:656" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "11.5 Density of composite in g/cm**3:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "per1=75.;#Percent Weight of WC \n", - "per2=15.;#Percent Weight of TiC\n", - "per3=5.;#Percent Weight of TaC\n", - "per4=5.;#Percent Weight of Co\n", - "rho1=15.77;#Density of WC in g/cm**3\n", - "rho2=4.94;#Density of TiC in g/cm**3\n", - "rho3=14.5;#Density of TaC in g/cm**3\n", - "rho4=8.90;#Density of Co in g/cm**3\n", - "#Calculations\n", - "f1=(per1/rho1)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of WC \n", - "f2=(per2/rho2)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tic\n", - "f3=(per3/rho3)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tac\n", - "f4=(per4/rho4)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Co\n", - "rho=(f1*rho1)+(f2*rho2)+(f3*rho3)+(f4*rho4);#Density of composite in g/cm**3\n", - "print round(rho,1),\"Density of composite in g/cm**3:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_3 pgno:658" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "15.0 Percentage Weight of Silver:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rho1=19.3;#Density of pure Tungsten in g/cm^3\n", - "rho2=10.49;#Density of pure Silver in g/cm^3\n", - "f1=0.75;#Volume fraction of Tungsten \n", - "f2=0.25;#Volume fraction of Silver and pores\n", - "#Calculations\n", - "per=((f2*rho2)/((f2*rho2)+(f1*rho1)))*100;#Percentage weight of silver \n", - "print round(per),\"Percentage Weight of Silver:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_4 pgno:659" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1.46 Composite density in g/cm^3:\n", - "1.24 Composite densityafter saving in g/cm^3:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rho1=0.95;#Density of polyethylene in g/cm^3\n", - "rho2=2.4;#Density of clay in g/cm^3\n", - "f1=0.65;#Volume fraction of Polyethylene \n", - "f2=0.35;#Volume fraction of Clay \n", - "f3=1.67;#Volume fraction of polyethylene after sacrifice\n", - "f4=1.06;#Volume fraction of Clay after sacrifice\n", - "pa1=650;# No. of parts of polyethylene in 1000cm^3 composite in cm^3\n", - "pa2=350;# No. of parts of clay in 1000cm^3 composite in cm^3\n", - "#Calculations\n", - "pa3=(pa1*rho1)/454;#No. of parts of Polyethylene in 1000cm^3 composite in lb\n", - "pa4=(pa2*rho2)/454;#No. of parts of clay in 1000cm^3 composite in lb\n", - "co1=pa3* 0.05;#Cost of material Polyethylenein Dollars\n", - "co2=pa4* 0.05;#Cost of materials clay in Dollars\n", - "c0=co1+co2;#Cost of materials in Dollars\n", - "rho3=(f1*rho1)+(f2*rho2);#Composite density in g/cm^3\n", - "co3=f3* 0.05;#Cost of material polyethylene after savings in Dollars\n", - "co4=f4* 0.05;#Cost of material clay after savings in Dollars\n", - "c1=co3+co4;#Cost of materials after savings in Dollars\n", - "rho4=(0.8*rho1)+(0.2*rho2);#Density of composite after saving in g/cm^3\n", - "print round(rho3,2),\"Composite density in g/cm^3:\"\n", - "print rho4,\"Composite densityafter saving in g/cm^3:\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_7 pgno:664" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2.564 Density of mixture in g/cm**3:\n", - "28000000.0 Modulus of elasticity of mixture in psi:\n", - "163000.0 Tensile Strength of mixture in psi:\n", - "14864864.8649 Modulus of elasticity perpendicular to fibers in psi:\n" - ] - } - ], - "source": [ - "f1=0.4;#Volume fraction of Fiber \n", - "f2=0.6;#Volume fraction of Aluminium \n", - "rho1=2.36;#Density of Fibers in g/cm**3\n", - "rho2=2.70;#Density of Aluminium in g/cm**3\n", - "psi1=55*10**6;#Modulus of elasticity of Fiber in psi\n", - "psi2=10*10**6;#Modulus of elasticity of Aluminium in psi\n", - "ts1=400000;#Tensile strength of fiber in psi\n", - "ts2=5000;#Tensile strength of Aluminium in psi\n", - "#Calculations\n", - "rho=(f1*rho1)+(f2*rho2);#Density of mixture in g/cm**3\n", - "Ec1=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", - "TSc=(f1*ts1)+(f2*ts2);#Tensile Strength of mixture in psi\n", - "Ec2=1/((f1/psi1)+(f2/psi2));#Modulus of elasticity perpendicular to fibers in psi\n", - "print rho,\"Density of mixture in g/cm**3:\"\n", - "print Ec1,\"Modulus of elasticity of mixture in psi:\"\n", - "print TSc,\"Tensile Strength of mixture in psi:\"\n", - "print Ec2,\"Modulus of elasticity perpendicular to fibers in psi:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_8 pgno:665" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.92 Fraction of applied force carried by Glass fiber :\n", - "Almost all of the load is carried by the glass fibers.\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "psi1=10.5*10**6;#Modulus of elasticity of Glass in psi\n", - "psi2=0.4*10**6;#Modulus of elasticity of Nylon in psi\n", - "a1=0.3;#area of glass in cm**3\n", - "a2=0.7;#area of Nylon in cm**3\n", - "#Calculations\n", - "psi=psi1/psi2;#Fraction of elasticity\n", - "fo=a1/(a1+(a2*(1/psi)));#Fraction of applied force carried by Glass fiber \n", - "print round(fo,2),\"Fraction of applied force carried by Glass fiber :\"\n", - "print\"Almost all of the load is carried by the glass fibers.\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_9 pgno:670" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "102610295.626 Specific Modulus of current alloy in in.:\n", - "0.087 Density of composite in lb/in**3:\n", - "37400000.0 Modulus of elasticity of mixture in psi:\n", - "4.3 Specific Modulus of composite in 10**8 in.:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "psi=10*10**6;#Modulus of elasticity of 7075-T6 in psi\n", - "psi1=55*10**6;#Modulus of elasticity of Boron fiber in psi\n", - "psi2=11*10**6;#Modulus of elasticity of Typical AL-LI in psi\n", - "f1=0.6;#Volume fraction of Boron Fiber\n", - "f2=0.4;#Volume fraction of typical AL-LI\n", - "rho1=0.085;#Density of Boron Fibers in lb/in*3\n", - "rho2=0.09;#Density of typical AL-LI in lb/in**3\n", - "#Calculations\n", - "sm1=psi/(((2.7*(2.54)**3))/454);#Specific Modulus of current alloy in in.\n", - "rho=(f1*rho1)+(f2*rho2);#Density of composite in lb/in**3\n", - "Ec=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", - "sm2=Ec/rho;#Specific Modulus of composite in in.\n", - "print sm1,\"Specific Modulus of current alloy in in.:\"\n", - "print rho,\"Density of composite in lb/in**3:\"\n", - "print Ec,\"Modulus of elasticity of mixture in psi:\"\n", - "print round(sm2/10**8,1),\"Specific Modulus of composite in 10**8 in.:\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_10 pgno:683" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2.48 Cost of Each Struct.:\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "psi=500000.;#Modulus Elasticity of Epoxyin psi\n", - "f=500.;#Force applied on Epoxy in pounds\n", - "q=0.10;#Stretchable distence in in.\n", - "rho=0.0451;#Density of Epoxy in lb/in**3\n", - "d=1.24;#Diameter of Epoxy in in\n", - "e=12000;#Yeild Strngth of Epoxy in psi\n", - "E2=77*10**6;#Modulus of high Carbon Fiber in psi\n", - "Fc=0.817;#Volume fraction of Epoxy remaining\n", - "Fc2=0.183;#Min volume Faction of Epoxy \n", - "rho2=0.0686;#Density of high Carbon Fiber in lb/in**3\n", - "emax=q/120;#MAX. Strain of Epoxy\n", - "E=psi*emax;#Max Modulus of elasticity in psi\n", - "A=f/E;#Area of Structure in in**2\n", - "W=rho*pi*((d/2)**2)*120;#Weight of Structure in ib\n", - "c=W*0.80;#Cost of Structure in Dollars\n", - "Ec=e/emax;#Minimum Elasticity of composite in psi\n", - "A2=f/e;#Area of Epoxy in in**2\n", - "At=A2/Fc;#Total Volume of Epoxy\n", - "V=At*120;#Volume of Structure in in**3\n", - "W2=((rho2*Fc2)+(rho*Fc))*V;#Weight of Structure in lb\n", - "Wf=(Fc2*1.9)/((Fc2*1.9)+(Fc*1.25));#Weight Fraction of Carbon \n", - "Wc=Wf*W2;#Weight of Carbon\n", - "We=0.746*W2;#Weight of Epoxy\n", - "c2=(Wc*30)+(We*0.80);#Cost of Each Struct.\n", - "print round(c2,2),\"Cost of Each Struct.:\"\n", - "#the diffrence in answer is due to erronous calculations\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_1.ipynb deleted file mode 100755 index ced00220..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_1.ipynb +++ /dev/null @@ -1,374 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 17 Composites :Teamwork and Synergy in Materials" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_1 pgno:655" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "4.68538254249e+13 Concentration of ThO2 in particles/cm**3:\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "per1=2.;#Percent weight of ThO2\n", - "per2=98.;#Percentage weight of Nickle\n", - "rho1=9.69;#Density of ThO2 in g/cm**3\n", - "rho2=8.9;#Density of Nickel in g/cm**3\n", - "r=0.5*10**-5;#Radius of ThO2 particle in cm\n", - "#calculations\n", - "f=(2/rho1)/((per1/rho1)+(per2/rho2));#Volume fraction of ThO2 per cm**3 of composite\n", - "v=(4/3)*(pi)*r**3;#Volume of ech ThO2 sphere in cm**3\n", - "c=f/v;#Concentration of ThO2 particles in particles/cm**3\n", - "print c,\"Concentration of ThO2 in particles/cm**3:\"\n", - "\n", - "#the difference in answer is due to round off error\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_2 pgno:656" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "11.5 Density of composite in g/cm**3:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "per1=75.;#Percent Weight of WC \n", - "per2=15.;#Percent Weight of TiC\n", - "per3=5.;#Percent Weight of TaC\n", - "per4=5.;#Percent Weight of Co\n", - "rho1=15.77;#Density of WC in g/cm**3\n", - "rho2=4.94;#Density of TiC in g/cm**3\n", - "rho3=14.5;#Density of TaC in g/cm**3\n", - "rho4=8.90;#Density of Co in g/cm**3\n", - "#Calculations\n", - "f1=(per1/rho1)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of WC \n", - "f2=(per2/rho2)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tic\n", - "f3=(per3/rho3)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tac\n", - "f4=(per4/rho4)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Co\n", - "rho=(f1*rho1)+(f2*rho2)+(f3*rho3)+(f4*rho4);#Density of composite in g/cm**3\n", - "print round(rho,1),\"Density of composite in g/cm**3:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_3 pgno:658" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "15.0 Percentage Weight of Silver:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rho1=19.3;#Density of pure Tungsten in g/cm^3\n", - "rho2=10.49;#Density of pure Silver in g/cm^3\n", - "f1=0.75;#Volume fraction of Tungsten \n", - "f2=0.25;#Volume fraction of Silver and pores\n", - "#Calculations\n", - "per=((f2*rho2)/((f2*rho2)+(f1*rho1)))*100;#Percentage weight of silver \n", - "print round(per),\"Percentage Weight of Silver:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_4 pgno:659" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1.46 Composite density in g/cm^3:\n", - "1.24 Composite densityafter saving in g/cm^3:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rho1=0.95;#Density of polyethylene in g/cm^3\n", - "rho2=2.4;#Density of clay in g/cm^3\n", - "f1=0.65;#Volume fraction of Polyethylene \n", - "f2=0.35;#Volume fraction of Clay \n", - "f3=1.67;#Volume fraction of polyethylene after sacrifice\n", - "f4=1.06;#Volume fraction of Clay after sacrifice\n", - "pa1=650;# No. of parts of polyethylene in 1000cm^3 composite in cm^3\n", - "pa2=350;# No. of parts of clay in 1000cm^3 composite in cm^3\n", - "#Calculations\n", - "pa3=(pa1*rho1)/454;#No. of parts of Polyethylene in 1000cm^3 composite in lb\n", - "pa4=(pa2*rho2)/454;#No. of parts of clay in 1000cm^3 composite in lb\n", - "co1=pa3* 0.05;#Cost of material Polyethylenein Dollars\n", - "co2=pa4* 0.05;#Cost of materials clay in Dollars\n", - "c0=co1+co2;#Cost of materials in Dollars\n", - "rho3=(f1*rho1)+(f2*rho2);#Composite density in g/cm^3\n", - "co3=f3* 0.05;#Cost of material polyethylene after savings in Dollars\n", - "co4=f4* 0.05;#Cost of material clay after savings in Dollars\n", - "c1=co3+co4;#Cost of materials after savings in Dollars\n", - "rho4=(0.8*rho1)+(0.2*rho2);#Density of composite after saving in g/cm^3\n", - "print round(rho3,2),\"Composite density in g/cm^3:\"\n", - "print rho4,\"Composite densityafter saving in g/cm^3:\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_7 pgno:664" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2.564 Density of mixture in g/cm**3:\n", - "28000000.0 Modulus of elasticity of mixture in psi:\n", - "163000.0 Tensile Strength of mixture in psi:\n", - "14864864.8649 Modulus of elasticity perpendicular to fibers in psi:\n" - ] - } - ], - "source": [ - "f1=0.4;#Volume fraction of Fiber \n", - "f2=0.6;#Volume fraction of Aluminium \n", - "rho1=2.36;#Density of Fibers in g/cm**3\n", - "rho2=2.70;#Density of Aluminium in g/cm**3\n", - "psi1=55*10**6;#Modulus of elasticity of Fiber in psi\n", - "psi2=10*10**6;#Modulus of elasticity of Aluminium in psi\n", - "ts1=400000;#Tensile strength of fiber in psi\n", - "ts2=5000;#Tensile strength of Aluminium in psi\n", - "#Calculations\n", - "rho=(f1*rho1)+(f2*rho2);#Density of mixture in g/cm**3\n", - "Ec1=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", - "TSc=(f1*ts1)+(f2*ts2);#Tensile Strength of mixture in psi\n", - "Ec2=1/((f1/psi1)+(f2/psi2));#Modulus of elasticity perpendicular to fibers in psi\n", - "print rho,\"Density of mixture in g/cm**3:\"\n", - "print Ec1,\"Modulus of elasticity of mixture in psi:\"\n", - "print TSc,\"Tensile Strength of mixture in psi:\"\n", - "print Ec2,\"Modulus of elasticity perpendicular to fibers in psi:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_8 pgno:665" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.92 Fraction of applied force carried by Glass fiber :\n", - "Almost all of the load is carried by the glass fibers.\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "psi1=10.5*10**6;#Modulus of elasticity of Glass in psi\n", - "psi2=0.4*10**6;#Modulus of elasticity of Nylon in psi\n", - "a1=0.3;#area of glass in cm**3\n", - "a2=0.7;#area of Nylon in cm**3\n", - "#Calculations\n", - "psi=psi1/psi2;#Fraction of elasticity\n", - "fo=a1/(a1+(a2*(1/psi)));#Fraction of applied force carried by Glass fiber \n", - "print round(fo,2),\"Fraction of applied force carried by Glass fiber :\"\n", - "print\"Almost all of the load is carried by the glass fibers.\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_9 pgno:670" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "102610295.626 Specific Modulus of current alloy in in.:\n", - "0.087 Density of composite in lb/in**3:\n", - "37400000.0 Modulus of elasticity of mixture in psi:\n", - "4.3 Specific Modulus of composite in 10**8 in.:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "psi=10*10**6;#Modulus of elasticity of 7075-T6 in psi\n", - "psi1=55*10**6;#Modulus of elasticity of Boron fiber in psi\n", - "psi2=11*10**6;#Modulus of elasticity of Typical AL-LI in psi\n", - "f1=0.6;#Volume fraction of Boron Fiber\n", - "f2=0.4;#Volume fraction of typical AL-LI\n", - "rho1=0.085;#Density of Boron Fibers in lb/in*3\n", - "rho2=0.09;#Density of typical AL-LI in lb/in**3\n", - "#Calculations\n", - "sm1=psi/(((2.7*(2.54)**3))/454);#Specific Modulus of current alloy in in.\n", - "rho=(f1*rho1)+(f2*rho2);#Density of composite in lb/in**3\n", - "Ec=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", - "sm2=Ec/rho;#Specific Modulus of composite in in.\n", - "print sm1,\"Specific Modulus of current alloy in in.:\"\n", - "print rho,\"Density of composite in lb/in**3:\"\n", - "print Ec,\"Modulus of elasticity of mixture in psi:\"\n", - "print round(sm2/10**8,1),\"Specific Modulus of composite in 10**8 in.:\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_10 pgno:683" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2.48 Cost of Each Struct.:\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "psi=500000.;#Modulus Elasticity of Epoxyin psi\n", - "f=500.;#Force applied on Epoxy in pounds\n", - "q=0.10;#Stretchable distence in in.\n", - "rho=0.0451;#Density of Epoxy in lb/in**3\n", - "d=1.24;#Diameter of Epoxy in in\n", - "e=12000;#Yeild Strngth of Epoxy in psi\n", - "E2=77*10**6;#Modulus of high Carbon Fiber in psi\n", - "Fc=0.817;#Volume fraction of Epoxy remaining\n", - "Fc2=0.183;#Min volume Faction of Epoxy \n", - "rho2=0.0686;#Density of high Carbon Fiber in lb/in**3\n", - "emax=q/120;#MAX. Strain of Epoxy\n", - "E=psi*emax;#Max Modulus of elasticity in psi\n", - "A=f/E;#Area of Structure in in**2\n", - "W=rho*pi*((d/2)**2)*120;#Weight of Structure in ib\n", - "c=W*0.80;#Cost of Structure in Dollars\n", - "Ec=e/emax;#Minimum Elasticity of composite in psi\n", - "A2=f/e;#Area of Epoxy in in**2\n", - "At=A2/Fc;#Total Volume of Epoxy\n", - "V=At*120;#Volume of Structure in in**3\n", - "W2=((rho2*Fc2)+(rho*Fc))*V;#Weight of Structure in lb\n", - "Wf=(Fc2*1.9)/((Fc2*1.9)+(Fc*1.25));#Weight Fraction of Carbon \n", - "Wc=Wf*W2;#Weight of Carbon\n", - "We=0.746*W2;#Weight of Epoxy\n", - "c2=(Wc*30)+(We*0.80);#Cost of Each Struct.\n", - "print round(c2,2),\"Cost of Each Struct.:\"\n", - "#the diffrence in answer is due to erronous calculations\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_2.ipynb deleted file mode 100755 index 90486f14..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_2.ipynb +++ /dev/null @@ -1,374 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 17 Composites :Teamwork and Synergy in Materials" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_1 pgno:655" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Concentration of ThO2 in particles/cm**3: 4.68538254249e+13\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "per1=2.;#Percent weight of ThO2\n", - "per2=98.;#Percentage weight of Nickle\n", - "rho1=9.69;#Density of ThO2 in g/cm**3\n", - "rho2=8.9;#Density of Nickel in g/cm**3\n", - "r=0.5*10**-5;#Radius of ThO2 particle in cm\n", - "#calculations\n", - "f=(2/rho1)/((per1/rho1)+(per2/rho2));#Volume fraction of ThO2 per cm**3 of composite\n", - "v=(4/3)*(pi)*r**3;#Volume of ech ThO2 sphere in cm**3\n", - "c=f/v;#Concentration of ThO2 particles in particles/cm**3\n", - "print \"Concentration of ThO2 in particles/cm**3:\",c\n", - "\n", - "#the difference in answer is due to round off error\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_2 pgno:656" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Density of composite in g/cm**3: 11.5\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "per1=75.;#Percent Weight of WC \n", - "per2=15.;#Percent Weight of TiC\n", - "per3=5.;#Percent Weight of TaC\n", - "per4=5.;#Percent Weight of Co\n", - "rho1=15.77;#Density of WC in g/cm**3\n", - "rho2=4.94;#Density of TiC in g/cm**3\n", - "rho3=14.5;#Density of TaC in g/cm**3\n", - "rho4=8.90;#Density of Co in g/cm**3\n", - "#Calculations\n", - "f1=(per1/rho1)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of WC \n", - "f2=(per2/rho2)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tic\n", - "f3=(per3/rho3)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tac\n", - "f4=(per4/rho4)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Co\n", - "rho=(f1*rho1)+(f2*rho2)+(f3*rho3)+(f4*rho4);#Density of composite in g/cm**3\n", - "print \"Density of composite in g/cm**3:\",round(rho,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_3 pgno:658" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "15.0 Percentage Weight of Silver:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rho1=19.3;#Density of pure Tungsten in g/cm^3\n", - "rho2=10.49;#Density of pure Silver in g/cm^3\n", - "f1=0.75;#Volume fraction of Tungsten \n", - "f2=0.25;#Volume fraction of Silver and pores\n", - "#Calculations\n", - "per=((f2*rho2)/((f2*rho2)+(f1*rho1)))*100;#Percentage weight of silver \n", - "print \"Percentage Weight of Silver:\",round(per)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_4 pgno:659" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Composite density in g/cm^3: 1.46\n", - "Composite densityafter saving in g/cm^3: 1.24\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rho1=0.95;#Density of polyethylene in g/cm^3\n", - "rho2=2.4;#Density of clay in g/cm^3\n", - "f1=0.65;#Volume fraction of Polyethylene \n", - "f2=0.35;#Volume fraction of Clay \n", - "f3=1.67;#Volume fraction of polyethylene after sacrifice\n", - "f4=1.06;#Volume fraction of Clay after sacrifice\n", - "pa1=650;# No. of parts of polyethylene in 1000cm^3 composite in cm^3\n", - "pa2=350;# No. of parts of clay in 1000cm^3 composite in cm^3\n", - "#Calculations\n", - "pa3=(pa1*rho1)/454;#No. of parts of Polyethylene in 1000cm^3 composite in lb\n", - "pa4=(pa2*rho2)/454;#No. of parts of clay in 1000cm^3 composite in lb\n", - "co1=pa3* 0.05;#Cost of material Polyethylenein Dollars\n", - "co2=pa4* 0.05;#Cost of materials clay in Dollars\n", - "c0=co1+co2;#Cost of materials in Dollars\n", - "rho3=(f1*rho1)+(f2*rho2);#Composite density in g/cm^3\n", - "co3=f3* 0.05;#Cost of material polyethylene after savings in Dollars\n", - "co4=f4* 0.05;#Cost of material clay after savings in Dollars\n", - "c1=co3+co4;#Cost of materials after savings in Dollars\n", - "rho4=(0.8*rho1)+(0.2*rho2);#Density of composite after saving in g/cm^3\n", - "print \"Composite density in g/cm^3:\",round(rho3,2)\n", - "print \"Composite densityafter saving in g/cm^3:\",rho4\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_7 pgno:664" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Density of mixture in g/cm**3: 2.564\n", - "Modulus of elasticity of mixture in psi: 28000000.0\n", - "Tensile Strength of mixture in psi: 163000.0\n", - "Modulus of elasticity perpendicular to fibers in psi: 14864864.8649\n" - ] - } - ], - "source": [ - "f1=0.4;#Volume fraction of Fiber \n", - "f2=0.6;#Volume fraction of Aluminium \n", - "rho1=2.36;#Density of Fibers in g/cm**3\n", - "rho2=2.70;#Density of Aluminium in g/cm**3\n", - "psi1=55*10**6;#Modulus of elasticity of Fiber in psi\n", - "psi2=10*10**6;#Modulus of elasticity of Aluminium in psi\n", - "ts1=400000;#Tensile strength of fiber in psi\n", - "ts2=5000;#Tensile strength of Aluminium in psi\n", - "#Calculations\n", - "rho=(f1*rho1)+(f2*rho2);#Density of mixture in g/cm**3\n", - "Ec1=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", - "TSc=(f1*ts1)+(f2*ts2);#Tensile Strength of mixture in psi\n", - "Ec2=1/((f1/psi1)+(f2/psi2));#Modulus of elasticity perpendicular to fibers in psi\n", - "print \"Density of mixture in g/cm**3:\",rho\n", - "print \"Modulus of elasticity of mixture in psi:\",Ec1\n", - "print \"Tensile Strength of mixture in psi:\",TSc\n", - "print \"Modulus of elasticity perpendicular to fibers in psi:\",Ec2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_8 pgno:665" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Fraction of applied force carried by Glass fiber : 0.92\n", - "Almost all of the load is carried by the glass fibers.\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "psi1=10.5*10**6;#Modulus of elasticity of Glass in psi\n", - "psi2=0.4*10**6;#Modulus of elasticity of Nylon in psi\n", - "a1=0.3;#area of glass in cm**3\n", - "a2=0.7;#area of Nylon in cm**3\n", - "#Calculations\n", - "psi=psi1/psi2;#Fraction of elasticity\n", - "fo=a1/(a1+(a2*(1/psi)));#Fraction of applied force carried by Glass fiber \n", - "print\"Fraction of applied force carried by Glass fiber :\",round(fo,2)\n", - "print\"Almost all of the load is carried by the glass fibers.\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_9 pgno:670" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Specific Modulus of current alloy in in.: 102610295.626\n", - "Density of composite in lb/in**3: 0.087\n", - "Modulus of elasticity of mixture in psi: 37400000.0\n", - "Specific Modulus of composite in 10**8 in.: 4.3\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "psi=10*10**6;#Modulus of elasticity of 7075-T6 in psi\n", - "psi1=55*10**6;#Modulus of elasticity of Boron fiber in psi\n", - "psi2=11*10**6;#Modulus of elasticity of Typical AL-LI in psi\n", - "f1=0.6;#Volume fraction of Boron Fiber\n", - "f2=0.4;#Volume fraction of typical AL-LI\n", - "rho1=0.085;#Density of Boron Fibers in lb/in*3\n", - "rho2=0.09;#Density of typical AL-LI in lb/in**3\n", - "#Calculations\n", - "sm1=psi/(((2.7*(2.54)**3))/454);#Specific Modulus of current alloy in in.\n", - "rho=(f1*rho1)+(f2*rho2);#Density of composite in lb/in**3\n", - "Ec=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", - "sm2=Ec/rho;#Specific Modulus of composite in in.\n", - "print \"Specific Modulus of current alloy in in.:\",sm1\n", - "print \"Density of composite in lb/in**3:\",rho\n", - "print \"Modulus of elasticity of mixture in psi:\",Ec\n", - "print \"Specific Modulus of composite in 10**8 in.:\",round(sm2/10**8,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_10 pgno:683" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Cost of Each Struct.: 2.48\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "psi=500000.;#Modulus Elasticity of Epoxyin psi\n", - "f=500.;#Force applied on Epoxy in pounds\n", - "q=0.10;#Stretchable distence in in.\n", - "rho=0.0451;#Density of Epoxy in lb/in**3\n", - "d=1.24;#Diameter of Epoxy in in\n", - "e=12000;#Yeild Strngth of Epoxy in psi\n", - "E2=77*10**6;#Modulus of high Carbon Fiber in psi\n", - "Fc=0.817;#Volume fraction of Epoxy remaining\n", - "Fc2=0.183;#Min volume Faction of Epoxy \n", - "rho2=0.0686;#Density of high Carbon Fiber in lb/in**3\n", - "emax=q/120;#MAX. Strain of Epoxy\n", - "E=psi*emax;#Max Modulus of elasticity in psi\n", - "A=f/E;#Area of Structure in in**2\n", - "W=rho*pi*((d/2)**2)*120;#Weight of Structure in ib\n", - "c=W*0.80;#Cost of Structure in Dollars\n", - "Ec=e/emax;#Minimum Elasticity of composite in psi\n", - "A2=f/e;#Area of Epoxy in in**2\n", - "At=A2/Fc;#Total Volume of Epoxy\n", - "V=At*120;#Volume of Structure in in**3\n", - "W2=((rho2*Fc2)+(rho*Fc))*V;#Weight of Structure in lb\n", - "Wf=(Fc2*1.9)/((Fc2*1.9)+(Fc*1.25));#Weight Fraction of Carbon \n", - "Wc=Wf*W2;#Weight of Carbon\n", - "We=0.746*W2;#Weight of Epoxy\n", - "c2=(Wc*30)+(We*0.80);#Cost of Each Struct.\n", - "print \"Cost of Each Struct.:\",round(c2,2)\n", - "#the diffrence in answer is due to erronous calculations\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_3.ipynb deleted file mode 100755 index 90486f14..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_17_Composites_Teamwork_and_Synergy_in_Materials_3.ipynb +++ /dev/null @@ -1,374 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 17 Composites :Teamwork and Synergy in Materials" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_1 pgno:655" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Concentration of ThO2 in particles/cm**3: 4.68538254249e+13\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "per1=2.;#Percent weight of ThO2\n", - "per2=98.;#Percentage weight of Nickle\n", - "rho1=9.69;#Density of ThO2 in g/cm**3\n", - "rho2=8.9;#Density of Nickel in g/cm**3\n", - "r=0.5*10**-5;#Radius of ThO2 particle in cm\n", - "#calculations\n", - "f=(2/rho1)/((per1/rho1)+(per2/rho2));#Volume fraction of ThO2 per cm**3 of composite\n", - "v=(4/3)*(pi)*r**3;#Volume of ech ThO2 sphere in cm**3\n", - "c=f/v;#Concentration of ThO2 particles in particles/cm**3\n", - "print \"Concentration of ThO2 in particles/cm**3:\",c\n", - "\n", - "#the difference in answer is due to round off error\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_2 pgno:656" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Density of composite in g/cm**3: 11.5\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "per1=75.;#Percent Weight of WC \n", - "per2=15.;#Percent Weight of TiC\n", - "per3=5.;#Percent Weight of TaC\n", - "per4=5.;#Percent Weight of Co\n", - "rho1=15.77;#Density of WC in g/cm**3\n", - "rho2=4.94;#Density of TiC in g/cm**3\n", - "rho3=14.5;#Density of TaC in g/cm**3\n", - "rho4=8.90;#Density of Co in g/cm**3\n", - "#Calculations\n", - "f1=(per1/rho1)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of WC \n", - "f2=(per2/rho2)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tic\n", - "f3=(per3/rho3)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Tac\n", - "f4=(per4/rho4)/((per1/rho1)+(per2/rho2)+(per3/rho3)+(per4/rho4));#Volume fraction of Co\n", - "rho=(f1*rho1)+(f2*rho2)+(f3*rho3)+(f4*rho4);#Density of composite in g/cm**3\n", - "print \"Density of composite in g/cm**3:\",round(rho,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_3 pgno:658" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "15.0 Percentage Weight of Silver:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rho1=19.3;#Density of pure Tungsten in g/cm^3\n", - "rho2=10.49;#Density of pure Silver in g/cm^3\n", - "f1=0.75;#Volume fraction of Tungsten \n", - "f2=0.25;#Volume fraction of Silver and pores\n", - "#Calculations\n", - "per=((f2*rho2)/((f2*rho2)+(f1*rho1)))*100;#Percentage weight of silver \n", - "print \"Percentage Weight of Silver:\",round(per)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_4 pgno:659" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Composite density in g/cm^3: 1.46\n", - "Composite densityafter saving in g/cm^3: 1.24\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rho1=0.95;#Density of polyethylene in g/cm^3\n", - "rho2=2.4;#Density of clay in g/cm^3\n", - "f1=0.65;#Volume fraction of Polyethylene \n", - "f2=0.35;#Volume fraction of Clay \n", - "f3=1.67;#Volume fraction of polyethylene after sacrifice\n", - "f4=1.06;#Volume fraction of Clay after sacrifice\n", - "pa1=650;# No. of parts of polyethylene in 1000cm^3 composite in cm^3\n", - "pa2=350;# No. of parts of clay in 1000cm^3 composite in cm^3\n", - "#Calculations\n", - "pa3=(pa1*rho1)/454;#No. of parts of Polyethylene in 1000cm^3 composite in lb\n", - "pa4=(pa2*rho2)/454;#No. of parts of clay in 1000cm^3 composite in lb\n", - "co1=pa3* 0.05;#Cost of material Polyethylenein Dollars\n", - "co2=pa4* 0.05;#Cost of materials clay in Dollars\n", - "c0=co1+co2;#Cost of materials in Dollars\n", - "rho3=(f1*rho1)+(f2*rho2);#Composite density in g/cm^3\n", - "co3=f3* 0.05;#Cost of material polyethylene after savings in Dollars\n", - "co4=f4* 0.05;#Cost of material clay after savings in Dollars\n", - "c1=co3+co4;#Cost of materials after savings in Dollars\n", - "rho4=(0.8*rho1)+(0.2*rho2);#Density of composite after saving in g/cm^3\n", - "print \"Composite density in g/cm^3:\",round(rho3,2)\n", - "print \"Composite densityafter saving in g/cm^3:\",rho4\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_7 pgno:664" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Density of mixture in g/cm**3: 2.564\n", - "Modulus of elasticity of mixture in psi: 28000000.0\n", - "Tensile Strength of mixture in psi: 163000.0\n", - "Modulus of elasticity perpendicular to fibers in psi: 14864864.8649\n" - ] - } - ], - "source": [ - "f1=0.4;#Volume fraction of Fiber \n", - "f2=0.6;#Volume fraction of Aluminium \n", - "rho1=2.36;#Density of Fibers in g/cm**3\n", - "rho2=2.70;#Density of Aluminium in g/cm**3\n", - "psi1=55*10**6;#Modulus of elasticity of Fiber in psi\n", - "psi2=10*10**6;#Modulus of elasticity of Aluminium in psi\n", - "ts1=400000;#Tensile strength of fiber in psi\n", - "ts2=5000;#Tensile strength of Aluminium in psi\n", - "#Calculations\n", - "rho=(f1*rho1)+(f2*rho2);#Density of mixture in g/cm**3\n", - "Ec1=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", - "TSc=(f1*ts1)+(f2*ts2);#Tensile Strength of mixture in psi\n", - "Ec2=1/((f1/psi1)+(f2/psi2));#Modulus of elasticity perpendicular to fibers in psi\n", - "print \"Density of mixture in g/cm**3:\",rho\n", - "print \"Modulus of elasticity of mixture in psi:\",Ec1\n", - "print \"Tensile Strength of mixture in psi:\",TSc\n", - "print \"Modulus of elasticity perpendicular to fibers in psi:\",Ec2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_8 pgno:665" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Fraction of applied force carried by Glass fiber : 0.92\n", - "Almost all of the load is carried by the glass fibers.\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "psi1=10.5*10**6;#Modulus of elasticity of Glass in psi\n", - "psi2=0.4*10**6;#Modulus of elasticity of Nylon in psi\n", - "a1=0.3;#area of glass in cm**3\n", - "a2=0.7;#area of Nylon in cm**3\n", - "#Calculations\n", - "psi=psi1/psi2;#Fraction of elasticity\n", - "fo=a1/(a1+(a2*(1/psi)));#Fraction of applied force carried by Glass fiber \n", - "print\"Fraction of applied force carried by Glass fiber :\",round(fo,2)\n", - "print\"Almost all of the load is carried by the glass fibers.\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_9 pgno:670" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Specific Modulus of current alloy in in.: 102610295.626\n", - "Density of composite in lb/in**3: 0.087\n", - "Modulus of elasticity of mixture in psi: 37400000.0\n", - "Specific Modulus of composite in 10**8 in.: 4.3\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "psi=10*10**6;#Modulus of elasticity of 7075-T6 in psi\n", - "psi1=55*10**6;#Modulus of elasticity of Boron fiber in psi\n", - "psi2=11*10**6;#Modulus of elasticity of Typical AL-LI in psi\n", - "f1=0.6;#Volume fraction of Boron Fiber\n", - "f2=0.4;#Volume fraction of typical AL-LI\n", - "rho1=0.085;#Density of Boron Fibers in lb/in*3\n", - "rho2=0.09;#Density of typical AL-LI in lb/in**3\n", - "#Calculations\n", - "sm1=psi/(((2.7*(2.54)**3))/454);#Specific Modulus of current alloy in in.\n", - "rho=(f1*rho1)+(f2*rho2);#Density of composite in lb/in**3\n", - "Ec=(f1*psi1)+(f2*psi2);#Modulus of elasticity of mixture in psi\n", - "sm2=Ec/rho;#Specific Modulus of composite in in.\n", - "print \"Specific Modulus of current alloy in in.:\",sm1\n", - "print \"Density of composite in lb/in**3:\",rho\n", - "print \"Modulus of elasticity of mixture in psi:\",Ec\n", - "print \"Specific Modulus of composite in 10**8 in.:\",round(sm2/10**8,1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 17_10 pgno:683" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Cost of Each Struct.: 2.48\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "psi=500000.;#Modulus Elasticity of Epoxyin psi\n", - "f=500.;#Force applied on Epoxy in pounds\n", - "q=0.10;#Stretchable distence in in.\n", - "rho=0.0451;#Density of Epoxy in lb/in**3\n", - "d=1.24;#Diameter of Epoxy in in\n", - "e=12000;#Yeild Strngth of Epoxy in psi\n", - "E2=77*10**6;#Modulus of high Carbon Fiber in psi\n", - "Fc=0.817;#Volume fraction of Epoxy remaining\n", - "Fc2=0.183;#Min volume Faction of Epoxy \n", - "rho2=0.0686;#Density of high Carbon Fiber in lb/in**3\n", - "emax=q/120;#MAX. Strain of Epoxy\n", - "E=psi*emax;#Max Modulus of elasticity in psi\n", - "A=f/E;#Area of Structure in in**2\n", - "W=rho*pi*((d/2)**2)*120;#Weight of Structure in ib\n", - "c=W*0.80;#Cost of Structure in Dollars\n", - "Ec=e/emax;#Minimum Elasticity of composite in psi\n", - "A2=f/e;#Area of Epoxy in in**2\n", - "At=A2/Fc;#Total Volume of Epoxy\n", - "V=At*120;#Volume of Structure in in**3\n", - "W2=((rho2*Fc2)+(rho*Fc))*V;#Weight of Structure in lb\n", - "Wf=(Fc2*1.9)/((Fc2*1.9)+(Fc*1.25));#Weight Fraction of Carbon \n", - "Wc=Wf*W2;#Weight of Carbon\n", - "We=0.746*W2;#Weight of Epoxy\n", - "c2=(Wc*30)+(We*0.80);#Cost of Each Struct.\n", - "print \"Cost of Each Struct.:\",round(c2,2)\n", - "#the diffrence in answer is due to erronous calculations\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure_.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure_.ipynb deleted file mode 100755 index 2aa41b7b..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure_.ipynb +++ /dev/null @@ -1,131 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 2 Atomic Structure " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_1 pgno:28" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the number of atoms in the given amount of silver is 5.58274928616e+23\n" - ] - } - ], - "source": [ - "#given \n", - "w=100#gms\n", - "A=(w*6.022*10**23)/107.868\n", - "print \"the number of atoms in the given amount of silver is\" ,A" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_2 pgno:28" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1.41371669412e-20 Volume of each Iron magnetic nano -particle in cm**3:\n", - "1.10269902141e-19 Mass of each iron nano-particle in g:\n" - ] - } - ], - "source": [ - "\n", - "from math import pi\n", - "# Initialisation of Variables\n", - "r=1.5*10**-7;#Radius of a particle in cm\n", - "rho=7.8;#Density of iron magnetic nano- particle in cm**3\n", - "#CALCULATIONS\n", - "v=(4./3.)*pi*(r)**3;#Volume of each Iron magnetic nano -particle in cm**3\n", - "m=rho*v;#Mass of each iron nano-particle in g\n", - "print v,\"Volume of each Iron magnetic nano -particle in cm**3:\"\n", - "print m,\"Mass of each iron nano-particle in g:\"\n", - " " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_4 pgno:41" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.486 Fraction covalent of SiO2 :\n" - ] - } - ], - "source": [ - "\n", - "from math import exp\n", - "# Initialisation of Variables\n", - "Es=1.8;#Electro negativity of Silicon from fig.2-8\n", - "Eo=3.5;#Electro negativity of Oxygen from fig.2-8\n", - "#CALCULATION\n", - "F=exp(-0.25*(Eo-Es)**2);#Fraction covalent of SiO2 \n", - "print round(F,3),\"Fraction covalent of SiO2 :\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__1.ipynb deleted file mode 100755 index 2aa41b7b..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__1.ipynb +++ /dev/null @@ -1,131 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 2 Atomic Structure " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_1 pgno:28" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the number of atoms in the given amount of silver is 5.58274928616e+23\n" - ] - } - ], - "source": [ - "#given \n", - "w=100#gms\n", - "A=(w*6.022*10**23)/107.868\n", - "print \"the number of atoms in the given amount of silver is\" ,A" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_2 pgno:28" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1.41371669412e-20 Volume of each Iron magnetic nano -particle in cm**3:\n", - "1.10269902141e-19 Mass of each iron nano-particle in g:\n" - ] - } - ], - "source": [ - "\n", - "from math import pi\n", - "# Initialisation of Variables\n", - "r=1.5*10**-7;#Radius of a particle in cm\n", - "rho=7.8;#Density of iron magnetic nano- particle in cm**3\n", - "#CALCULATIONS\n", - "v=(4./3.)*pi*(r)**3;#Volume of each Iron magnetic nano -particle in cm**3\n", - "m=rho*v;#Mass of each iron nano-particle in g\n", - "print v,\"Volume of each Iron magnetic nano -particle in cm**3:\"\n", - "print m,\"Mass of each iron nano-particle in g:\"\n", - " " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_4 pgno:41" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.486 Fraction covalent of SiO2 :\n" - ] - } - ], - "source": [ - "\n", - "from math import exp\n", - "# Initialisation of Variables\n", - "Es=1.8;#Electro negativity of Silicon from fig.2-8\n", - "Eo=3.5;#Electro negativity of Oxygen from fig.2-8\n", - "#CALCULATION\n", - "F=exp(-0.25*(Eo-Es)**2);#Fraction covalent of SiO2 \n", - "print round(F,3),\"Fraction covalent of SiO2 :\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__2.ipynb deleted file mode 100755 index 0b6ced02..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__2.ipynb +++ /dev/null @@ -1,131 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 2 Atomic Structure " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_1 pgno:28" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the number of atoms in the given amount of silver is 5.58274928616e+23\n" - ] - } - ], - "source": [ - "#given \n", - "w=100#gms\n", - "A=(w*6.022*10**23)/107.868\n", - "print \"the number of atoms in the given amount of silver is\" ,A" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_2 pgno:28" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Volume of each Iron magnetic nano -particle in cm**3: 1.41371669412e-20\n", - "Mass of each iron nano-particle in g: 1.10269902141e-19\n" - ] - } - ], - "source": [ - "\n", - "from math import pi\n", - "# Initialisation of Variables\n", - "r=1.5*10**-7;#Radius of a particle in cm\n", - "rho=7.8;#Density of iron magnetic nano- particle in cm**3\n", - "#CALCULATIONS\n", - "v=(4./3.)*pi*(r)**3;#Volume of each Iron magnetic nano -particle in cm**3\n", - "m=rho*v;#Mass of each iron nano-particle in g\n", - "print \"Volume of each Iron magnetic nano -particle in cm**3:\",v\n", - "print \"Mass of each iron nano-particle in g:\",m\n", - " " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_4 pgno:41" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Fraction covalent of SiO2 : 0.486\n" - ] - } - ], - "source": [ - "\n", - "from math import exp\n", - "# Initialisation of Variables\n", - "Es=1.8;#Electro negativity of Silicon from fig.2-8\n", - "Eo=3.5;#Electro negativity of Oxygen from fig.2-8\n", - "#CALCULATION\n", - "F=exp(-0.25*(Eo-Es)**2);#Fraction covalent of SiO2 \n", - "print \"Fraction covalent of SiO2 :\",round(F,3)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__3.ipynb deleted file mode 100755 index 0b6ced02..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_2_Atomic_Structure__3.ipynb +++ /dev/null @@ -1,131 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 2 Atomic Structure " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_1 pgno:28" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the number of atoms in the given amount of silver is 5.58274928616e+23\n" - ] - } - ], - "source": [ - "#given \n", - "w=100#gms\n", - "A=(w*6.022*10**23)/107.868\n", - "print \"the number of atoms in the given amount of silver is\" ,A" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_2 pgno:28" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Volume of each Iron magnetic nano -particle in cm**3: 1.41371669412e-20\n", - "Mass of each iron nano-particle in g: 1.10269902141e-19\n" - ] - } - ], - "source": [ - "\n", - "from math import pi\n", - "# Initialisation of Variables\n", - "r=1.5*10**-7;#Radius of a particle in cm\n", - "rho=7.8;#Density of iron magnetic nano- particle in cm**3\n", - "#CALCULATIONS\n", - "v=(4./3.)*pi*(r)**3;#Volume of each Iron magnetic nano -particle in cm**3\n", - "m=rho*v;#Mass of each iron nano-particle in g\n", - "print \"Volume of each Iron magnetic nano -particle in cm**3:\",v\n", - "print \"Mass of each iron nano-particle in g:\",m\n", - " " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_4 pgno:41" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Fraction covalent of SiO2 : 0.486\n" - ] - } - ], - "source": [ - "\n", - "from math import exp\n", - "# Initialisation of Variables\n", - "Es=1.8;#Electro negativity of Silicon from fig.2-8\n", - "Eo=3.5;#Electro negativity of Oxygen from fig.2-8\n", - "#CALCULATION\n", - "F=exp(-0.25*(Eo-Es)**2);#Fraction covalent of SiO2 \n", - "print \"Fraction covalent of SiO2 :\",round(F,3)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements.ipynb deleted file mode 100755 index 274d34f1..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements.ipynb +++ /dev/null @@ -1,419 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 3 Atomic and Ionic Arrangements" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_1 pgno:66" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1 No. of latice points per unit cell in SC unit cell:\n", - "2 No. of latice points per unit cell in BCC unit cells:\n", - "4.0 No. of latice points per unit cell in FCC unit cells:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Cn=8;#No. of Corners of the Cubic Crystal Systems\n", - "c=1;#No. of centers of the Cubic Crystal Systems in BCC unit cell\n", - "F=6;#No. of Faces of the Cubic Crystal Systems in FCC unit cell\n", - "#CALCULATIONS \n", - "N1=Cn/8;#No. of latice points per unit cell in SC unit cell\n", - "N2=(Cn/8)+c*1;#No. of latice points per unit cell in BCC unit cells\n", - "N3=(Cn/8)+F*(1./2.);#No. of latice points per unit cell in FCC unit cells\n", - "print N1,\"No. of latice points per unit cell in SC unit cell:\"\n", - "print N2,\"No. of latice points per unit cell in BCC unit cells:\"\n", - "print N3,\"No. of latice points per unit cell in FCC unit cells:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_4 pgno:70" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.74 Packing factor in FCC cell\n" - ] - } - ], - "source": [ - "\n", - "from math import sqrt,pi\n", - "# Initialisation of Variables\n", - "r=1;# one unit of radius of each atom of FCC cell\n", - "a0=(4*r)/sqrt(2);#Lattice constant for FCC cell\n", - "v=(4*pi*r**3)/3;#volume of one atom in FCC cell\n", - "Pf=(4*v)/(a0)**3#Packing factor in FCC cell\n", - "print round(Pf,2),\"Packing factor in FCC cell\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_5 pgno:71" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2.3541197896e-23 Volume of unit cell for BCC iron in cm**3/cell:\n", - "7.881 Density of BCC iron in g/cm**3:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "a0=2.866*10**-8;#Lattice constant for BCC iron cells in cm\n", - "m=55.847;#Atomic mass of iron in g/mol\n", - "Na=6.02*10**23#Avogadro's number in atoms/mol\n", - "n=2;#number of atoms per cell in BCC iron\n", - "#CALCULATIONS\n", - "v=a0**3;#Volume of unit cell for BCC iron in cm**3/cell\n", - "rho=(n*m)/(v*Na);#Density of BCC iron\n", - "print v,\"Volume of unit cell for BCC iron in cm**3/cell:\"\n", - "print round(rho,3),\"Density of BCC iron in g/cm**3:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_6 pgno:73" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "137.63 volume of a tetragonal cell in A**3:\n", - "140.25 volume of a monoclinic unit cell in A**3:\n", - "1.9 The percent change in volume in percent:\n" - ] - } - ], - "source": [ - "from math import sin,pi\n", - "# Initialisation of Variables\n", - "a=5.156;#The lattice constants for the monoclinic unit cells in Angstroms\n", - "b=5.191;#The lattice constants for the monoclinic unit cells in Angstroms\n", - "c=5.304;#The lattice constants for the monoclinic unit cells in Angstroms\n", - "beeta=98.9#The angle fro the monoclinic unit cell \n", - "a2=5.094;#The lattice constants for the tetragonal unit cells in Angstroms\n", - "c2=5.304;#The lattice constants for the tetragonal unit cells in Angstroms\n", - "#CALCULATIONS\n", - "v2=(a2**2)*c2;#volume of a tetragonal unit cell\n", - "v1=a*b*c*sin(beeta*pi/180);#volume of a monoclinic unit cell\n", - "Pv=(v1-v2)/(v1)*100;#The percent change in volume in percent\n", - "print round(v2,2),\"volume of a tetragonal cell in A**3:\"\n", - "print round(v1,2),\"volume of a monoclinic unit cell in A**3:\"\n", - "print round(Pv,1),\"The percent change in volume in percent:\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_9 pgno:79" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "8.96410771272e+14 Planar density of (010) in atoms/cm**2:\n", - "0.79 Packing fraction of (010):\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "r=1;#Radius of each atom in units\n", - "l=0.334;#Lattice parameter of (010) in nm\n", - "#CALCULATIONS\n", - "a1=2*r;#Area of face for (010)\n", - "a2=l**2;#Area of face of (010) in cm**2\n", - "pd=1/a2;#Planar density of (010) in atoms/nm**2\n", - "pf=pi*r**2/(a1)**2;#Packing fraction of (010)\n", - "print pd*10**14,\"Planar density of (010) in atoms/cm**2:\"\n", - "print round(pf,2),\"Packing fraction of (010):\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_12 pgno:85" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "4.0 No.of octahedral site belongs uniquely to each unit cell:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "E=12;#No. of Edges in the octahedral sites of the unit cell\n", - "S=1./4.;#so only 1/4 of each site belongs uniquelyto each unit cell\n", - "N=E*S+1;#No.of site belongs uniquely to each unit cell\n", - "print N,\"No.of octahedral site belongs uniquely to each unit cell:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_13 pgno:87" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the co oridinate number of each type of ion is 8 and cscl structure\n", - "the packing fraction is 0.73\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rk=0.133;#nano meters\n", - "rcl=0.181;#nano meters\n", - "s=rk/rcl;\n", - "print \"the co oridinate number of each type of ion is 8 and cscl structure\"\n", - "print \"the packing fraction is \",round(s,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_14 pgno:88" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "3.96e-09 Lattice constant for MgO in cm:\n", - "6.76398536864e-14 Density of MgO in g/cm**3:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "r1=0.066;#Radius of Mg+2 from Appendix B in nm\n", - "r2=0.132;#Radius of O-2 from Appendix B in nm\n", - "Am1=24.312;#Atomic masses of Mg+2 in g/mol\n", - "Am2=16;#Atomic masses of O-2 in g/mol\n", - "Na=6.02*10**23;#Avogadro's number\n", - "#CALCULATIONS\n", - "a0=2*r1+2*r2;#Lattice constant for MgO in nm\n", - "rho=((4*Am1)+(4*16))/((a0*10**-8)*Na);#Density of MgO in g/cm**3\n", - "print a0*10**-8,\"Lattice constant for MgO in cm:\"\n", - "print rho,\"Density of MgO in g/cm**3:\"\n", - "#Answer given in the book is wrong" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_15 pgno:89" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the density of the silicon is 5.33\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "#given \n", - "a0=5.43;#Armstrong\n", - "r= a0*sqrt(3)/8\n", - "m=4*(69.72+74.91)/(6.022*10**23)\n", - "v=(5.65*10**-8)**3;\n", - "d=m/v;\n", - "print \"the density of the silicon is \",round(d,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_17 pgno:93" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.35 Packing factor of Diamond cubic Silicon:\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "# Initialisation of Variables\n", - "r=1.;#Radius of each atom in units\n", - "n=8.;#No. of atoms present in Diamond cubic Silicon per cell\n", - "#CALCULATIONS\n", - "v=(4/3)*pi*r**3;# Volume of each atom in Diamond cubic Silicon\n", - "a0=(8*r)/sqrt(3);#Volume of unit cell in Diamond cubic Silicon\n", - "Pf=(n*v)/a0**3+.09;#Packing factor of Diamond cubic Silicon\n", - "print round(Pf,2),\"Packing factor of Diamond cubic Silicon:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_19 pgno:" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the density of the silicon is 2.31939610012e-15\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "#given \n", - "a0=5.43;#Armstrong\n", - "r= a0*sqrt(3)/8\n", - "m=(2.7*(28.09))/(6.022*10**23)\n", - "v=5.43*10**-8;\n", - "d=m/v;\n", - "print \"the density of the silicon is \",d" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_1.ipynb deleted file mode 100755 index 274d34f1..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_1.ipynb +++ /dev/null @@ -1,419 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 3 Atomic and Ionic Arrangements" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_1 pgno:66" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1 No. of latice points per unit cell in SC unit cell:\n", - "2 No. of latice points per unit cell in BCC unit cells:\n", - "4.0 No. of latice points per unit cell in FCC unit cells:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Cn=8;#No. of Corners of the Cubic Crystal Systems\n", - "c=1;#No. of centers of the Cubic Crystal Systems in BCC unit cell\n", - "F=6;#No. of Faces of the Cubic Crystal Systems in FCC unit cell\n", - "#CALCULATIONS \n", - "N1=Cn/8;#No. of latice points per unit cell in SC unit cell\n", - "N2=(Cn/8)+c*1;#No. of latice points per unit cell in BCC unit cells\n", - "N3=(Cn/8)+F*(1./2.);#No. of latice points per unit cell in FCC unit cells\n", - "print N1,\"No. of latice points per unit cell in SC unit cell:\"\n", - "print N2,\"No. of latice points per unit cell in BCC unit cells:\"\n", - "print N3,\"No. of latice points per unit cell in FCC unit cells:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_4 pgno:70" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.74 Packing factor in FCC cell\n" - ] - } - ], - "source": [ - "\n", - "from math import sqrt,pi\n", - "# Initialisation of Variables\n", - "r=1;# one unit of radius of each atom of FCC cell\n", - "a0=(4*r)/sqrt(2);#Lattice constant for FCC cell\n", - "v=(4*pi*r**3)/3;#volume of one atom in FCC cell\n", - "Pf=(4*v)/(a0)**3#Packing factor in FCC cell\n", - "print round(Pf,2),\"Packing factor in FCC cell\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_5 pgno:71" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2.3541197896e-23 Volume of unit cell for BCC iron in cm**3/cell:\n", - "7.881 Density of BCC iron in g/cm**3:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "a0=2.866*10**-8;#Lattice constant for BCC iron cells in cm\n", - "m=55.847;#Atomic mass of iron in g/mol\n", - "Na=6.02*10**23#Avogadro's number in atoms/mol\n", - "n=2;#number of atoms per cell in BCC iron\n", - "#CALCULATIONS\n", - "v=a0**3;#Volume of unit cell for BCC iron in cm**3/cell\n", - "rho=(n*m)/(v*Na);#Density of BCC iron\n", - "print v,\"Volume of unit cell for BCC iron in cm**3/cell:\"\n", - "print round(rho,3),\"Density of BCC iron in g/cm**3:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_6 pgno:73" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "137.63 volume of a tetragonal cell in A**3:\n", - "140.25 volume of a monoclinic unit cell in A**3:\n", - "1.9 The percent change in volume in percent:\n" - ] - } - ], - "source": [ - "from math import sin,pi\n", - "# Initialisation of Variables\n", - "a=5.156;#The lattice constants for the monoclinic unit cells in Angstroms\n", - "b=5.191;#The lattice constants for the monoclinic unit cells in Angstroms\n", - "c=5.304;#The lattice constants for the monoclinic unit cells in Angstroms\n", - "beeta=98.9#The angle fro the monoclinic unit cell \n", - "a2=5.094;#The lattice constants for the tetragonal unit cells in Angstroms\n", - "c2=5.304;#The lattice constants for the tetragonal unit cells in Angstroms\n", - "#CALCULATIONS\n", - "v2=(a2**2)*c2;#volume of a tetragonal unit cell\n", - "v1=a*b*c*sin(beeta*pi/180);#volume of a monoclinic unit cell\n", - "Pv=(v1-v2)/(v1)*100;#The percent change in volume in percent\n", - "print round(v2,2),\"volume of a tetragonal cell in A**3:\"\n", - "print round(v1,2),\"volume of a monoclinic unit cell in A**3:\"\n", - "print round(Pv,1),\"The percent change in volume in percent:\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_9 pgno:79" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "8.96410771272e+14 Planar density of (010) in atoms/cm**2:\n", - "0.79 Packing fraction of (010):\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "r=1;#Radius of each atom in units\n", - "l=0.334;#Lattice parameter of (010) in nm\n", - "#CALCULATIONS\n", - "a1=2*r;#Area of face for (010)\n", - "a2=l**2;#Area of face of (010) in cm**2\n", - "pd=1/a2;#Planar density of (010) in atoms/nm**2\n", - "pf=pi*r**2/(a1)**2;#Packing fraction of (010)\n", - "print pd*10**14,\"Planar density of (010) in atoms/cm**2:\"\n", - "print round(pf,2),\"Packing fraction of (010):\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_12 pgno:85" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "4.0 No.of octahedral site belongs uniquely to each unit cell:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "E=12;#No. of Edges in the octahedral sites of the unit cell\n", - "S=1./4.;#so only 1/4 of each site belongs uniquelyto each unit cell\n", - "N=E*S+1;#No.of site belongs uniquely to each unit cell\n", - "print N,\"No.of octahedral site belongs uniquely to each unit cell:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_13 pgno:87" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the co oridinate number of each type of ion is 8 and cscl structure\n", - "the packing fraction is 0.73\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rk=0.133;#nano meters\n", - "rcl=0.181;#nano meters\n", - "s=rk/rcl;\n", - "print \"the co oridinate number of each type of ion is 8 and cscl structure\"\n", - "print \"the packing fraction is \",round(s,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_14 pgno:88" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "3.96e-09 Lattice constant for MgO in cm:\n", - "6.76398536864e-14 Density of MgO in g/cm**3:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "r1=0.066;#Radius of Mg+2 from Appendix B in nm\n", - "r2=0.132;#Radius of O-2 from Appendix B in nm\n", - "Am1=24.312;#Atomic masses of Mg+2 in g/mol\n", - "Am2=16;#Atomic masses of O-2 in g/mol\n", - "Na=6.02*10**23;#Avogadro's number\n", - "#CALCULATIONS\n", - "a0=2*r1+2*r2;#Lattice constant for MgO in nm\n", - "rho=((4*Am1)+(4*16))/((a0*10**-8)*Na);#Density of MgO in g/cm**3\n", - "print a0*10**-8,\"Lattice constant for MgO in cm:\"\n", - "print rho,\"Density of MgO in g/cm**3:\"\n", - "#Answer given in the book is wrong" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_15 pgno:89" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the density of the silicon is 5.33\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "#given \n", - "a0=5.43;#Armstrong\n", - "r= a0*sqrt(3)/8\n", - "m=4*(69.72+74.91)/(6.022*10**23)\n", - "v=(5.65*10**-8)**3;\n", - "d=m/v;\n", - "print \"the density of the silicon is \",round(d,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_17 pgno:93" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.35 Packing factor of Diamond cubic Silicon:\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "# Initialisation of Variables\n", - "r=1.;#Radius of each atom in units\n", - "n=8.;#No. of atoms present in Diamond cubic Silicon per cell\n", - "#CALCULATIONS\n", - "v=(4/3)*pi*r**3;# Volume of each atom in Diamond cubic Silicon\n", - "a0=(8*r)/sqrt(3);#Volume of unit cell in Diamond cubic Silicon\n", - "Pf=(n*v)/a0**3+.09;#Packing factor of Diamond cubic Silicon\n", - "print round(Pf,2),\"Packing factor of Diamond cubic Silicon:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_19 pgno:" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the density of the silicon is 2.31939610012e-15\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "#given \n", - "a0=5.43;#Armstrong\n", - "r= a0*sqrt(3)/8\n", - "m=(2.7*(28.09))/(6.022*10**23)\n", - "v=5.43*10**-8;\n", - "d=m/v;\n", - "print \"the density of the silicon is \",d" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_2.ipynb deleted file mode 100755 index abd0fb55..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_2.ipynb +++ /dev/null @@ -1,419 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 3 Atomic and Ionic Arrangements" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_1 pgno:66" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "No. of latice points per unit cell in SC unit cell: 1\n", - "No. of latice points per unit cell in BCC unit cells: 2\n", - "No. of latice points per unit cell in FCC unit cells: 4.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Cn=8;#No. of Corners of the Cubic Crystal Systems\n", - "c=1;#No. of centers of the Cubic Crystal Systems in BCC unit cell\n", - "F=6;#No. of Faces of the Cubic Crystal Systems in FCC unit cell\n", - "#CALCULATIONS \n", - "N1=Cn/8;#No. of latice points per unit cell in SC unit cell\n", - "N2=(Cn/8)+c*1;#No. of latice points per unit cell in BCC unit cells\n", - "N3=(Cn/8)+F*(1./2.);#No. of latice points per unit cell in FCC unit cells\n", - "print \"No. of latice points per unit cell in SC unit cell:\",N1\n", - "print \"No. of latice points per unit cell in BCC unit cells:\",N2\n", - "print \"No. of latice points per unit cell in FCC unit cells:\",N3\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_4 pgno:70" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Packing factor in FCC cell 0.74\n" - ] - } - ], - "source": [ - "\n", - "from math import sqrt,pi\n", - "# Initialisation of Variables\n", - "r=1;# one unit of radius of each atom of FCC cell\n", - "a0=(4*r)/sqrt(2);#Lattice constant for FCC cell\n", - "v=(4*pi*r**3)/3;#volume of one atom in FCC cell\n", - "Pf=(4*v)/(a0)**3#Packing factor in FCC cell\n", - "print \"Packing factor in FCC cell\",round(Pf,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_5 pgno:71" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Volume of unit cell for BCC iron in cm**3/cell: 2.3541197896e-23\n", - "Density of BCC iron in g/cm**3: 7.881\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "a0=2.866*10**-8;#Lattice constant for BCC iron cells in cm\n", - "m=55.847;#Atomic mass of iron in g/mol\n", - "Na=6.02*10**23#Avogadro's number in atoms/mol\n", - "n=2;#number of atoms per cell in BCC iron\n", - "#CALCULATIONS\n", - "v=a0**3;#Volume of unit cell for BCC iron in cm**3/cell\n", - "rho=(n*m)/(v*Na);#Density of BCC iron\n", - "print \"Volume of unit cell for BCC iron in cm**3/cell:\",v\n", - "print \"Density of BCC iron in g/cm**3:\",round(rho,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_6 pgno:73" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "volume of a tetragonal cell in A**3: 137.63\n", - "volume of a monoclinic unit cell in A**3: 140.25\n", - "The percent change in volume in percent: 1.9\n" - ] - } - ], - "source": [ - "from math import sin,pi\n", - "# Initialisation of Variables\n", - "a=5.156;#The lattice constants for the monoclinic unit cells in Angstroms\n", - "b=5.191;#The lattice constants for the monoclinic unit cells in Angstroms\n", - "c=5.304;#The lattice constants for the monoclinic unit cells in Angstroms\n", - "beeta=98.9#The angle fro the monoclinic unit cell \n", - "a2=5.094;#The lattice constants for the tetragonal unit cells in Angstroms\n", - "c2=5.304;#The lattice constants for the tetragonal unit cells in Angstroms\n", - "#CALCULATIONS\n", - "v2=(a2**2)*c2;#volume of a tetragonal unit cell\n", - "v1=a*b*c*sin(beeta*pi/180);#volume of a monoclinic unit cell\n", - "Pv=(v1-v2)/(v1)*100;#The percent change in volume in percent\n", - "print \"volume of a tetragonal cell in A**3:\",round(v2,2)\n", - "print \"volume of a monoclinic unit cell in A**3:\",round(v1,2)\n", - "print \"The percent change in volume in percent:\",round(Pv,1)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_9 pgno:79" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Planar density of (010) in atoms/cm**2: 8.96410771272e+14\n", - "Packing fraction of (010): 0.79\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "r=1;#Radius of each atom in units\n", - "l=0.334;#Lattice parameter of (010) in nm\n", - "#CALCULATIONS\n", - "a1=2*r;#Area of face for (010)\n", - "a2=l**2;#Area of face of (010) in cm**2\n", - "pd=1/a2;#Planar density of (010) in atoms/nm**2\n", - "pf=pi*r**2/(a1)**2;#Packing fraction of (010)\n", - "print \"Planar density of (010) in atoms/cm**2:\",pd*10**14\n", - "print \"Packing fraction of (010):\",round(pf,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_12 pgno:85" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "No.of octahedral site belongs uniquely to each unit cell: 4.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "E=12;#No. of Edges in the octahedral sites of the unit cell\n", - "S=1./4.;#so only 1/4 of each site belongs uniquelyto each unit cell\n", - "N=E*S+1;#No.of site belongs uniquely to each unit cell\n", - "print \"No.of octahedral site belongs uniquely to each unit cell:\",N\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_13 pgno:87" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the co oridinate number of each type of ion is 8 and cscl structure\n", - "the packing fraction is 0.73\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rk=0.133;#nano meters\n", - "rcl=0.181;#nano meters\n", - "s=rk/rcl;\n", - "print \"the co oridinate number of each type of ion is 8 and cscl structure\"\n", - "print \"the packing fraction is \",round(s,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_14 pgno:88" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "3.96e-09 Lattice constant for MgO in cm:\n", - "6.76398536864e-14 Density of MgO in g/cm**3:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "r1=0.066;#Radius of Mg+2 from Appendix B in nm\n", - "r2=0.132;#Radius of O-2 from Appendix B in nm\n", - "Am1=24.312;#Atomic masses of Mg+2 in g/mol\n", - "Am2=16;#Atomic masses of O-2 in g/mol\n", - "Na=6.02*10**23;#Avogadro's number\n", - "#CALCULATIONS\n", - "a0=2*r1+2*r2;#Lattice constant for MgO in nm\n", - "rho=((4*Am1)+(4*16))/((a0*10**-8)*Na);#Density of MgO in g/cm**3\n", - "print \"Lattice constant for MgO in cm:\",a0*10**-8\n", - "print \"Density of MgO in g/cm**3:\",rho\n", - "#Answer given in the book is wrong" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_15 pgno:89" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the density of the silicon is 5.33\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "#given \n", - "a0=5.43;#Armstrong\n", - "r= a0*sqrt(3)/8\n", - "m=4*(69.72+74.91)/(6.022*10**23)\n", - "v=(5.65*10**-8)**3;\n", - "d=m/v;\n", - "print \"the density of the silicon is \",round(d,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_17 pgno:93" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Packing factor of Diamond cubic Silicon: 0.35\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "# Initialisation of Variables\n", - "r=1.;#Radius of each atom in units\n", - "n=8.;#No. of atoms present in Diamond cubic Silicon per cell\n", - "#CALCULATIONS\n", - "v=(4/3)*pi*r**3;# Volume of each atom in Diamond cubic Silicon\n", - "a0=(8*r)/sqrt(3);#Volume of unit cell in Diamond cubic Silicon\n", - "Pf=(n*v)/a0**3+.09;#Packing factor of Diamond cubic Silicon\n", - "print \"Packing factor of Diamond cubic Silicon:\",round(Pf,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_19 pgno:" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the density of the silicon is 2.31939610012e-15\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "#given \n", - "a0=5.43;#Armstrong\n", - "r= a0*sqrt(3)/8\n", - "m=(2.7*(28.09))/(6.022*10**23)\n", - "v=5.43*10**-8;\n", - "d=m/v;\n", - "print \"the density of the silicon is \",d" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_3.ipynb deleted file mode 100755 index efb78d3d..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_3_Atomic_and_Ionic_Arrangements_3.ipynb +++ /dev/null @@ -1,419 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 3 Atomic and Ionic Arrangements" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_1 pgno:66" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "No. of latice points per unit cell in SC unit cell: 1\n", - "No. of latice points per unit cell in BCC unit cells: 2\n", - "No. of latice points per unit cell in FCC unit cells: 4.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Cn=8;#No. of Corners of the Cubic Crystal Systems\n", - "c=1;#No. of centers of the Cubic Crystal Systems in BCC unit cell\n", - "F=6;#No. of Faces of the Cubic Crystal Systems in FCC unit cell\n", - "#CALCULATIONS \n", - "N1=Cn/8;#No. of latice points per unit cell in SC unit cell\n", - "N2=(Cn/8)+c*1;#No. of latice points per unit cell in BCC unit cells\n", - "N3=(Cn/8)+F*(1./2.);#No. of latice points per unit cell in FCC unit cells\n", - "print \"No. of latice points per unit cell in SC unit cell:\",N1\n", - "print \"No. of latice points per unit cell in BCC unit cells:\",N2\n", - "print \"No. of latice points per unit cell in FCC unit cells:\",N3\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_4 pgno:70" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Packing factor in FCC cell 0.74\n" - ] - } - ], - "source": [ - "\n", - "from math import sqrt,pi\n", - "# Initialisation of Variables\n", - "r=1;# one unit of radius of each atom of FCC cell\n", - "a0=(4*r)/sqrt(2);#Lattice constant for FCC cell\n", - "v=(4*pi*r**3)/3;#volume of one atom in FCC cell\n", - "Pf=(4*v)/(a0)**3#Packing factor in FCC cell\n", - "print \"Packing factor in FCC cell\",round(Pf,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_5 pgno:71" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Volume of unit cell for BCC iron in cm**3/cell: 2.3541197896e-23\n", - "Density of BCC iron in g/cm**3: 7.881\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "a0=2.866*10**-8;#Lattice constant for BCC iron cells in cm\n", - "m=55.847;#Atomic mass of iron in g/mol\n", - "Na=6.02*10**23#Avogadro's number in atoms/mol\n", - "n=2;#number of atoms per cell in BCC iron\n", - "#CALCULATIONS\n", - "v=a0**3;#Volume of unit cell for BCC iron in cm**3/cell\n", - "rho=(n*m)/(v*Na);#Density of BCC iron\n", - "print \"Volume of unit cell for BCC iron in cm**3/cell:\",v\n", - "print \"Density of BCC iron in g/cm**3:\",round(rho,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_6 pgno:73" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "volume of a tetragonal cell in A**3: 137.63\n", - "volume of a monoclinic unit cell in A**3: 140.25\n", - "The percent change in volume in percent: 1.9\n" - ] - } - ], - "source": [ - "from math import sin,pi\n", - "# Initialisation of Variables\n", - "a=5.156;#The lattice constants for the monoclinic unit cells in Angstroms\n", - "b=5.191;#The lattice constants for the monoclinic unit cells in Angstroms\n", - "c=5.304;#The lattice constants for the monoclinic unit cells in Angstroms\n", - "beeta=98.9#The angle fro the monoclinic unit cell \n", - "a2=5.094;#The lattice constants for the tetragonal unit cells in Angstroms\n", - "c2=5.304;#The lattice constants for the tetragonal unit cells in Angstroms\n", - "#CALCULATIONS\n", - "v2=(a2**2)*c2;#volume of a tetragonal unit cell\n", - "v1=a*b*c*sin(beeta*pi/180);#volume of a monoclinic unit cell\n", - "Pv=(v1-v2)/(v1)*100;#The percent change in volume in percent\n", - "print \"volume of a tetragonal cell in A**3:\",round(v2,2)\n", - "print \"volume of a monoclinic unit cell in A**3:\",round(v1,2)\n", - "print \"The percent change in volume in percent:\",round(Pv,1)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_9 pgno:79" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Planar density of (010) in atoms/cm**2: 8.96410771272e+14\n", - "Packing fraction of (010): 0.79\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "r=1;#Radius of each atom in units\n", - "l=0.334;#Lattice parameter of (010) in nm\n", - "#CALCULATIONS\n", - "a1=2*r;#Area of face for (010)\n", - "a2=l**2;#Area of face of (010) in cm**2\n", - "pd=1/a2;#Planar density of (010) in atoms/nm**2\n", - "pf=pi*r**2/(a1)**2;#Packing fraction of (010)\n", - "print \"Planar density of (010) in atoms/cm**2:\",pd*10**14\n", - "print \"Packing fraction of (010):\",round(pf,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_12 pgno:85" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "No.of octahedral site belongs uniquely to each unit cell: 4.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "E=12;#No. of Edges in the octahedral sites of the unit cell\n", - "S=1./4.;#so only 1/4 of each site belongs uniquelyto each unit cell\n", - "N=E*S+1;#No.of site belongs uniquely to each unit cell\n", - "print \"No.of octahedral site belongs uniquely to each unit cell:\",N\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_13 pgno:87" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the co oridinate number of each type of ion is 8 and cscl structure\n", - "the packing fraction is 0.73\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "rk=0.133;#nano meters\n", - "rcl=0.181;#nano meters\n", - "s=rk/rcl;\n", - "print \"the co oridinate number of each type of ion is 8 and cscl structure\"\n", - "print \"the packing fraction is \",round(s,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_14 pgno:88" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "3.96e-09 Lattice constant for MgO in cm:\n", - "6.76398536864e-14 Density of MgO in g/cm**3:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "r1=0.066;#Radius of Mg+2 from Appendix B in nm\n", - "r2=0.132;#Radius of O-2 from Appendix B in nm\n", - "Am1=24.312;#Atomic masses of Mg+2 in g/mol\n", - "Am2=16;#Atomic masses of O-2 in g/mol\n", - "Na=6.02*10**23;#Avogadro's number\n", - "#CALCULATIONS\n", - "a0=2*r1+2*r2;#Lattice constant for MgO in nm\n", - "rho=((4*Am1)+(4*16))/((a0*10**-8)*Na);#Density of MgO in g/cm**3\n", - "print \"Lattice constant for MgO in cm:\",a0*10**-8\n", - "print \"Density of MgO in g/cm**3:\",rho\n", - "#Answer given in the book is wrong" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_15 pgno:89" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the density of the silicon is 5.33\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "#given \n", - "a0=5.43;#Armstrong\n", - "r= a0*sqrt(3)/8\n", - "m=4*(69.72+74.91)/(6.022*10**23)\n", - "v=(5.65*10**-8)**3;\n", - "d=m/v;\n", - "print \"the density of the silicon is \",round(d,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_17 pgno:93" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Packing factor of Diamond cubic Silicon: 0.35\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "# Initialisation of Variables\n", - "r=1.;#Radius of each atom in units\n", - "n=8.;#No. of atoms present in Diamond cubic Silicon per cell\n", - "#CALCULATIONS\n", - "v=(4/3)*pi*r**3;# Volume of each atom in Diamond cubic Silicon\n", - "a0=(8*r)/sqrt(3);#Volume of unit cell in Diamond cubic Silicon\n", - "Pf=(n*v)/a0**3+.09;#Packing factor of Diamond cubic Silicon\n", - "print \"Packing factor of Diamond cubic Silicon:\",round(Pf,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_19 pgno:94" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the density of the silicon is 2.31939610012e-15\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "#given \n", - "a0=5.43;#Armstrong\n", - "r= a0*sqrt(3)/8\n", - "m=(2.7*(28.09))/(6.022*10**23)\n", - "v=5.43*10**-8;\n", - "d=m/v;\n", - "print \"the density of the silicon is \",d" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements.ipynb deleted file mode 100755 index 14b3eaf6..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements.ipynb +++ /dev/null @@ -1,301 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4 Imperfections in Atomic and Ionic Arrangements" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_1 pgno:115" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "102.0 Temperature at which this number of vacancies forms in copper in Degree celsius:\n" - ] - } - ], - "source": [ - "from math import log,exp\n", - "# Initialisation of Variables\n", - "Lp=0.3615#The lattice parameter of FCC copper in nm\n", - "T1=298;#Temperature of copper in K\n", - "Qv=20000;#Heat required to produce a mole of vacancies in copper in cal\n", - "R=1.987;#The gas constant in cal/mol-K\n", - "#CALCULATIONS\n", - "n=4/(Lp*10**-8)**3;#The number of copper atoms or lattice points per cm**3 in atoms/cm**3\n", - "nv1=n*exp(-Qv/(T1*R));#concentration of vacancies in copper at 25 degree celsius in vacancies /cm**3\n", - "nv2=nv1*1000;#concentration of vacancies in copper atoms at T2 temperature\n", - "T2=-Qv/(R*log(nv2/n));#temperature at which this number of vacancies forms in copper in K\n", - "print round(T2-273),\"Temperature at which this number of vacancies forms in copper in Degree celsius:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_2 pgno:116" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "7.88142586455 The expected theoretical density of iron BCC \n", - "1.99710055902 Number of iron atoms that would be present in each unit cell for the required density:\n", - "5.18240407897e+19 The number of vacancies per cm**3 :\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "n1=2;#No. of Atoms in BCC iron Crystal\n", - "m=55.847;#Atomic mass of BCC iron crystal\n", - "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", - "Na=6.02*10**23;#Avogadro's number in atoms/mol\n", - "rho1=7.87;#Required density of iron BCC in g/cm**3\n", - "#CALCULATIONS\n", - "rho2=(n1*m)/(a0**3*Na);#The expected theoretical density of iron BCC \n", - "X=(rho1*a0**3*Na)/m;#Number of iron atoms and vacancies that would be present in each unit cell for the required density\n", - "n2=n1-X;# no. of vacacies per unit cell\n", - "V=0.00122/a0**3;#The number of vacancies per cm**3 \n", - "print rho2,\"The expected theoretical density of iron BCC \"\n", - "print X,\"Number of iron atoms that would be present in each unit cell for the required density:\"\n", - "print V,\"The number of vacancies per cm**3 :\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_3 pgno:117" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.1241 Radius of iron atom in nm\n", - "0.03611 Interstitial Radius of iron atom in nm:\n", - "0.12625 the radius of the iron atom in nm:\n", - "0.0523 the radius of the interstitial site in nm:\n", - "86.0 The atomic percentage of carbon contained in BCC iron in percent:\n", - "50.0 The atomic percentage of carbon contained in FCC iron in percent:\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "# Initialisation of Variables\n", - "a01=0.2866;#The Lattice parameter of BCC in nm\n", - "a02=0.3571;#The Lattice parameter of FCC in nm\n", - "r=0.071;#Radius of carbon atom in nm\n", - "ni1=12.;#No. of interstitial sites per unit cell for BCC\n", - "ni2=4.;#No. of interstitial sites per unit cell for FCC\n", - "#CALCULATIONS\n", - "Rb=(sqrt(3)*a01)/4.;#Radius of iron atom in nm\n", - "Ri1=sqrt(0.3125*a01**2)-Rb;# Interstitial Radius of iron atom in nm\n", - "Rf=(sqrt(2)*a02)/4.;#the radius of the iron atom in nm\n", - "Ri2=(a02-(2*Rf))/2.;#the radius of the interstitial site in nm\n", - "C1=(ni1/(ni1+2))*100;#The atomic percentage of carbon contained in the BCC iron in percent\n", - "C2=(ni2/(ni2+4))*100;#The atomic percentage of carbon contained in the FCC iron in percent\n", - "print round(Rb,5),\"Radius of iron atom in nm\"\n", - "print round(Ri1,5),\"Interstitial Radius of iron atom in nm:\"\n", - "print round(Rf,5),\"the radius of the iron atom in nm:\"\n", - "print round(Ri2,5),\"the radius of the interstitial site in nm:\"\n", - "print round(C1),\"The atomic percentage of carbon contained in BCC iron in percent:\"\n", - "print C2,\"The atomic percentage of carbon contained in FCC iron in percent:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_6 pgno:127" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.28 The length of Burgers vector in nm:\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "# Initialisation of Variable\n", - "a0=0.396;#Lattice parameter of magnesium oxide\n", - "h=1;#Because b is a [110] direction\n", - "k=1;#Because b is a [110] direction\n", - "l=0;#Because b is a [110] direction\n", - "#CALCULATIONS\n", - "b=a0/sqrt(2);#The length of Burgers vector in nm\n", - "print round(b,3),\"The length of Burgers vector in nm:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_7 pgno:128" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.51125 Face Diagonal of copperin nm:\n", - "0.25563 The length of the Burgers vector in nm:\n" - ] - } - ], - "source": [ - "\n", - "from math import sqrt\n", - "# Initialisation of Variables\n", - "a01=0.36151;#The lattice parameter of copper in nm\n", - "#CALCULATIONS\n", - "F=sqrt(2)*a01;#Face Diagonal of copperin nm\n", - "b=(1./2.)*(F);#The length of the Burgers vector, or the repeat distance in nm\n", - "print round(F,5),\"Face Diagonal of copperin nm:\"\n", - "print round(b,5),\"The length of the Burgers vector in nm:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_8 pgno:129" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1.72172040168e+15 Planar density of (110)BCC in atoms/cm**2:\n", - "2.02656803488e-17 3 The interplanar spacings for (110)BCC in cm:\n", - "1.17003960047e-17 2 The interplanar spacings for (112)BCC in cm:\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "# Initialisation of Variables\n", - "n=2;#No. of Atoms present per cell in BCC\n", - "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", - "rho1=0.994*10**15;#Planar density of (112)BCC in atoms/cm**2\n", - "#CALCULATIONS\n", - "a=sqrt(2)*a0**2;#Area of BCC iron in cm**2\n", - "rho2=n/a;#Planar density of (110)BCC in atoms/cm**2\n", - "d1=a0*10**-9/(sqrt(1**2+1**2+0));#The interplanar spacings for (110)BCC in cm\n", - "d2=a0*10**-9/(sqrt(1**2+1**2+2**2));#The interplanar spacings for (112)BCC in cm\n", - "print round(rho2,2),\"Planar density of (110)BCC in atoms/cm**2:\"\n", - "print d1,3,\"The interplanar spacings for (110)BCC in cm:\"\n", - "print d2,2,\"The interplanar spacings for (112)BCC in cm:\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_13 pgno:139" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "7.64 the ASTM grain size number:\n" - ] - } - ], - "source": [ - "from math import log10\n", - "# Initialisation of Variables\n", - "g=16# No. of grains per square inch in a photomicrograph\n", - "M=250;#Magnification in a photomicrograph\n", - "N=(M/g)*100;#The number of grains per square inch\n", - "n=(log10(100)/log10(2))+1;#the ASTM grain size number\n", - "print round(n,2),\"the ASTM grain size number:\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_1.ipynb deleted file mode 100755 index 14b3eaf6..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_1.ipynb +++ /dev/null @@ -1,301 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4 Imperfections in Atomic and Ionic Arrangements" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_1 pgno:115" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "102.0 Temperature at which this number of vacancies forms in copper in Degree celsius:\n" - ] - } - ], - "source": [ - "from math import log,exp\n", - "# Initialisation of Variables\n", - "Lp=0.3615#The lattice parameter of FCC copper in nm\n", - "T1=298;#Temperature of copper in K\n", - "Qv=20000;#Heat required to produce a mole of vacancies in copper in cal\n", - "R=1.987;#The gas constant in cal/mol-K\n", - "#CALCULATIONS\n", - "n=4/(Lp*10**-8)**3;#The number of copper atoms or lattice points per cm**3 in atoms/cm**3\n", - "nv1=n*exp(-Qv/(T1*R));#concentration of vacancies in copper at 25 degree celsius in vacancies /cm**3\n", - "nv2=nv1*1000;#concentration of vacancies in copper atoms at T2 temperature\n", - "T2=-Qv/(R*log(nv2/n));#temperature at which this number of vacancies forms in copper in K\n", - "print round(T2-273),\"Temperature at which this number of vacancies forms in copper in Degree celsius:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_2 pgno:116" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "7.88142586455 The expected theoretical density of iron BCC \n", - "1.99710055902 Number of iron atoms that would be present in each unit cell for the required density:\n", - "5.18240407897e+19 The number of vacancies per cm**3 :\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "n1=2;#No. of Atoms in BCC iron Crystal\n", - "m=55.847;#Atomic mass of BCC iron crystal\n", - "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", - "Na=6.02*10**23;#Avogadro's number in atoms/mol\n", - "rho1=7.87;#Required density of iron BCC in g/cm**3\n", - "#CALCULATIONS\n", - "rho2=(n1*m)/(a0**3*Na);#The expected theoretical density of iron BCC \n", - "X=(rho1*a0**3*Na)/m;#Number of iron atoms and vacancies that would be present in each unit cell for the required density\n", - "n2=n1-X;# no. of vacacies per unit cell\n", - "V=0.00122/a0**3;#The number of vacancies per cm**3 \n", - "print rho2,\"The expected theoretical density of iron BCC \"\n", - "print X,\"Number of iron atoms that would be present in each unit cell for the required density:\"\n", - "print V,\"The number of vacancies per cm**3 :\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_3 pgno:117" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.1241 Radius of iron atom in nm\n", - "0.03611 Interstitial Radius of iron atom in nm:\n", - "0.12625 the radius of the iron atom in nm:\n", - "0.0523 the radius of the interstitial site in nm:\n", - "86.0 The atomic percentage of carbon contained in BCC iron in percent:\n", - "50.0 The atomic percentage of carbon contained in FCC iron in percent:\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "# Initialisation of Variables\n", - "a01=0.2866;#The Lattice parameter of BCC in nm\n", - "a02=0.3571;#The Lattice parameter of FCC in nm\n", - "r=0.071;#Radius of carbon atom in nm\n", - "ni1=12.;#No. of interstitial sites per unit cell for BCC\n", - "ni2=4.;#No. of interstitial sites per unit cell for FCC\n", - "#CALCULATIONS\n", - "Rb=(sqrt(3)*a01)/4.;#Radius of iron atom in nm\n", - "Ri1=sqrt(0.3125*a01**2)-Rb;# Interstitial Radius of iron atom in nm\n", - "Rf=(sqrt(2)*a02)/4.;#the radius of the iron atom in nm\n", - "Ri2=(a02-(2*Rf))/2.;#the radius of the interstitial site in nm\n", - "C1=(ni1/(ni1+2))*100;#The atomic percentage of carbon contained in the BCC iron in percent\n", - "C2=(ni2/(ni2+4))*100;#The atomic percentage of carbon contained in the FCC iron in percent\n", - "print round(Rb,5),\"Radius of iron atom in nm\"\n", - "print round(Ri1,5),\"Interstitial Radius of iron atom in nm:\"\n", - "print round(Rf,5),\"the radius of the iron atom in nm:\"\n", - "print round(Ri2,5),\"the radius of the interstitial site in nm:\"\n", - "print round(C1),\"The atomic percentage of carbon contained in BCC iron in percent:\"\n", - "print C2,\"The atomic percentage of carbon contained in FCC iron in percent:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_6 pgno:127" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.28 The length of Burgers vector in nm:\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "# Initialisation of Variable\n", - "a0=0.396;#Lattice parameter of magnesium oxide\n", - "h=1;#Because b is a [110] direction\n", - "k=1;#Because b is a [110] direction\n", - "l=0;#Because b is a [110] direction\n", - "#CALCULATIONS\n", - "b=a0/sqrt(2);#The length of Burgers vector in nm\n", - "print round(b,3),\"The length of Burgers vector in nm:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_7 pgno:128" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.51125 Face Diagonal of copperin nm:\n", - "0.25563 The length of the Burgers vector in nm:\n" - ] - } - ], - "source": [ - "\n", - "from math import sqrt\n", - "# Initialisation of Variables\n", - "a01=0.36151;#The lattice parameter of copper in nm\n", - "#CALCULATIONS\n", - "F=sqrt(2)*a01;#Face Diagonal of copperin nm\n", - "b=(1./2.)*(F);#The length of the Burgers vector, or the repeat distance in nm\n", - "print round(F,5),\"Face Diagonal of copperin nm:\"\n", - "print round(b,5),\"The length of the Burgers vector in nm:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_8 pgno:129" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1.72172040168e+15 Planar density of (110)BCC in atoms/cm**2:\n", - "2.02656803488e-17 3 The interplanar spacings for (110)BCC in cm:\n", - "1.17003960047e-17 2 The interplanar spacings for (112)BCC in cm:\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "# Initialisation of Variables\n", - "n=2;#No. of Atoms present per cell in BCC\n", - "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", - "rho1=0.994*10**15;#Planar density of (112)BCC in atoms/cm**2\n", - "#CALCULATIONS\n", - "a=sqrt(2)*a0**2;#Area of BCC iron in cm**2\n", - "rho2=n/a;#Planar density of (110)BCC in atoms/cm**2\n", - "d1=a0*10**-9/(sqrt(1**2+1**2+0));#The interplanar spacings for (110)BCC in cm\n", - "d2=a0*10**-9/(sqrt(1**2+1**2+2**2));#The interplanar spacings for (112)BCC in cm\n", - "print round(rho2,2),\"Planar density of (110)BCC in atoms/cm**2:\"\n", - "print d1,3,\"The interplanar spacings for (110)BCC in cm:\"\n", - "print d2,2,\"The interplanar spacings for (112)BCC in cm:\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_13 pgno:139" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "7.64 the ASTM grain size number:\n" - ] - } - ], - "source": [ - "from math import log10\n", - "# Initialisation of Variables\n", - "g=16# No. of grains per square inch in a photomicrograph\n", - "M=250;#Magnification in a photomicrograph\n", - "N=(M/g)*100;#The number of grains per square inch\n", - "n=(log10(100)/log10(2))+1;#the ASTM grain size number\n", - "print round(n,2),\"the ASTM grain size number:\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_2.ipynb deleted file mode 100755 index def0cffe..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_2.ipynb +++ /dev/null @@ -1,301 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4 Imperfections in Atomic and Ionic Arrangements" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_1 pgno:115" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Temperature at which this number of vacancies forms in copper in Degree celsius: 102.0\n" - ] - } - ], - "source": [ - "from math import log,exp\n", - "# Initialisation of Variables\n", - "Lp=0.3615#The lattice parameter of FCC copper in nm\n", - "T1=298;#Temperature of copper in K\n", - "Qv=20000;#Heat required to produce a mole of vacancies in copper in cal\n", - "R=1.987;#The gas constant in cal/mol-K\n", - "#CALCULATIONS\n", - "n=4/(Lp*10**-8)**3;#The number of copper atoms or lattice points per cm**3 in atoms/cm**3\n", - "nv1=n*exp(-Qv/(T1*R));#concentration of vacancies in copper at 25 degree celsius in vacancies /cm**3\n", - "nv2=nv1*1000;#concentration of vacancies in copper atoms at T2 temperature\n", - "T2=-Qv/(R*log(nv2/n));#temperature at which this number of vacancies forms in copper in K\n", - "print \"Temperature at which this number of vacancies forms in copper in Degree celsius:\",round(T2-273)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_2 pgno:116" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The expected theoretical density of iron BCC 7.88142586455\n", - "Number of iron atoms that would be present in each unit cell for the required density: 1.99710055902\n", - "The number of vacancies per cm**3 : 5.18240407897e+19\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "n1=2;#No. of Atoms in BCC iron Crystal\n", - "m=55.847;#Atomic mass of BCC iron crystal\n", - "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", - "Na=6.02*10**23;#Avogadro's number in atoms/mol\n", - "rho1=7.87;#Required density of iron BCC in g/cm**3\n", - "#CALCULATIONS\n", - "rho2=(n1*m)/(a0**3*Na);#The expected theoretical density of iron BCC \n", - "X=(rho1*a0**3*Na)/m;#Number of iron atoms and vacancies that would be present in each unit cell for the required density\n", - "n2=n1-X;# no. of vacacies per unit cell\n", - "V=0.00122/a0**3;#The number of vacancies per cm**3 \n", - "print \"The expected theoretical density of iron BCC \",rho2\n", - "print \"Number of iron atoms that would be present in each unit cell for the required density:\",X\n", - "print \"The number of vacancies per cm**3 :\",V\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_3 pgno:117" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Radius of iron atom in nm 0.1241\n", - "Interstitial Radius of iron atom in nm: 0.03611\n", - "the radius of the iron atom in nm: 0.12625\n", - "the radius of the interstitial site in nm: 0.0523\n", - "The atomic percentage of carbon contained in BCC iron in percent: 86.0\n", - "The atomic percentage of carbon contained in FCC iron in percent: 50.0\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "# Initialisation of Variables\n", - "a01=0.2866;#The Lattice parameter of BCC in nm\n", - "a02=0.3571;#The Lattice parameter of FCC in nm\n", - "r=0.071;#Radius of carbon atom in nm\n", - "ni1=12.;#No. of interstitial sites per unit cell for BCC\n", - "ni2=4.;#No. of interstitial sites per unit cell for FCC\n", - "#CALCULATIONS\n", - "Rb=(sqrt(3)*a01)/4.;#Radius of iron atom in nm\n", - "Ri1=sqrt(0.3125*a01**2)-Rb;# Interstitial Radius of iron atom in nm\n", - "Rf=(sqrt(2)*a02)/4.;#the radius of the iron atom in nm\n", - "Ri2=(a02-(2*Rf))/2.;#the radius of the interstitial site in nm\n", - "C1=(ni1/(ni1+2))*100;#The atomic percentage of carbon contained in the BCC iron in percent\n", - "C2=(ni2/(ni2+4))*100;#The atomic percentage of carbon contained in the FCC iron in percent\n", - "print \"Radius of iron atom in nm\",round(Rb,5)\n", - "print \"Interstitial Radius of iron atom in nm:\",round(Ri1,5)\n", - "print \"the radius of the iron atom in nm:\",round(Rf,5)\n", - "print \"the radius of the interstitial site in nm:\",round(Ri2,5)\n", - "print \"The atomic percentage of carbon contained in BCC iron in percent:\",round(C1)\n", - "print \"The atomic percentage of carbon contained in FCC iron in percent:\",C2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_6 pgno:127" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The length of Burgers vector in nm: 0.28\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "# Initialisation of Variable\n", - "a0=0.396;#Lattice parameter of magnesium oxide\n", - "h=1;#Because b is a [110] direction\n", - "k=1;#Because b is a [110] direction\n", - "l=0;#Because b is a [110] direction\n", - "#CALCULATIONS\n", - "b=a0/sqrt(2);#The length of Burgers vector in nm\n", - "print \"The length of Burgers vector in nm:\",round(b,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_7 pgno:128" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Face Diagonal of copperin nm: 0.51125\n", - "The length of the Burgers vector in nm: 0.25563\n" - ] - } - ], - "source": [ - "\n", - "from math import sqrt\n", - "# Initialisation of Variables\n", - "a01=0.36151;#The lattice parameter of copper in nm\n", - "#CALCULATIONS\n", - "F=sqrt(2)*a01;#Face Diagonal of copperin nm\n", - "b=(1./2.)*(F);#The length of the Burgers vector, or the repeat distance in nm\n", - "print \"Face Diagonal of copperin nm:\",round(F,5)\n", - "print \"The length of the Burgers vector in nm:\",round(b,5)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_8 pgno:129" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Planar density of (110)BCC in atoms/cm**2: 1.72172040168e+15\n", - "The interplanar spacings for (110)BCC in cm: 2.02656803488e-17 3\n", - "The interplanar spacings for (112)BCC in cm: 1.17003960047e-17 2\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "# Initialisation of Variables\n", - "n=2;#No. of Atoms present per cell in BCC\n", - "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", - "rho1=0.994*10**15;#Planar density of (112)BCC in atoms/cm**2\n", - "#CALCULATIONS\n", - "a=sqrt(2)*a0**2;#Area of BCC iron in cm**2\n", - "rho2=n/a;#Planar density of (110)BCC in atoms/cm**2\n", - "d1=a0*10**-9/(sqrt(1**2+1**2+0));#The interplanar spacings for (110)BCC in cm\n", - "d2=a0*10**-9/(sqrt(1**2+1**2+2**2));#The interplanar spacings for (112)BCC in cm\n", - "print \"Planar density of (110)BCC in atoms/cm**2:\",round(rho2,2)\n", - "print \"The interplanar spacings for (110)BCC in cm:\",d1,3\n", - "print \"The interplanar spacings for (112)BCC in cm:\",d2,2" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_13 pgno:139" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the ASTM grain size number: 7.64\n" - ] - } - ], - "source": [ - "from math import log10\n", - "# Initialisation of Variables\n", - "g=16# No. of grains per square inch in a photomicrograph\n", - "M=250;#Magnification in a photomicrograph\n", - "N=(M/g)*100;#The number of grains per square inch\n", - "n=(log10(100)/log10(2))+1;#the ASTM grain size number\n", - "print \"the ASTM grain size number:\",round(n,2)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_3.ipynb deleted file mode 100755 index def0cffe..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_4_Imperfections_in_Atomic_and_Ionic_Arrangements_3.ipynb +++ /dev/null @@ -1,301 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4 Imperfections in Atomic and Ionic Arrangements" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_1 pgno:115" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Temperature at which this number of vacancies forms in copper in Degree celsius: 102.0\n" - ] - } - ], - "source": [ - "from math import log,exp\n", - "# Initialisation of Variables\n", - "Lp=0.3615#The lattice parameter of FCC copper in nm\n", - "T1=298;#Temperature of copper in K\n", - "Qv=20000;#Heat required to produce a mole of vacancies in copper in cal\n", - "R=1.987;#The gas constant in cal/mol-K\n", - "#CALCULATIONS\n", - "n=4/(Lp*10**-8)**3;#The number of copper atoms or lattice points per cm**3 in atoms/cm**3\n", - "nv1=n*exp(-Qv/(T1*R));#concentration of vacancies in copper at 25 degree celsius in vacancies /cm**3\n", - "nv2=nv1*1000;#concentration of vacancies in copper atoms at T2 temperature\n", - "T2=-Qv/(R*log(nv2/n));#temperature at which this number of vacancies forms in copper in K\n", - "print \"Temperature at which this number of vacancies forms in copper in Degree celsius:\",round(T2-273)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_2 pgno:116" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The expected theoretical density of iron BCC 7.88142586455\n", - "Number of iron atoms that would be present in each unit cell for the required density: 1.99710055902\n", - "The number of vacancies per cm**3 : 5.18240407897e+19\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "n1=2;#No. of Atoms in BCC iron Crystal\n", - "m=55.847;#Atomic mass of BCC iron crystal\n", - "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", - "Na=6.02*10**23;#Avogadro's number in atoms/mol\n", - "rho1=7.87;#Required density of iron BCC in g/cm**3\n", - "#CALCULATIONS\n", - "rho2=(n1*m)/(a0**3*Na);#The expected theoretical density of iron BCC \n", - "X=(rho1*a0**3*Na)/m;#Number of iron atoms and vacancies that would be present in each unit cell for the required density\n", - "n2=n1-X;# no. of vacacies per unit cell\n", - "V=0.00122/a0**3;#The number of vacancies per cm**3 \n", - "print \"The expected theoretical density of iron BCC \",rho2\n", - "print \"Number of iron atoms that would be present in each unit cell for the required density:\",X\n", - "print \"The number of vacancies per cm**3 :\",V\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_3 pgno:117" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Radius of iron atom in nm 0.1241\n", - "Interstitial Radius of iron atom in nm: 0.03611\n", - "the radius of the iron atom in nm: 0.12625\n", - "the radius of the interstitial site in nm: 0.0523\n", - "The atomic percentage of carbon contained in BCC iron in percent: 86.0\n", - "The atomic percentage of carbon contained in FCC iron in percent: 50.0\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "# Initialisation of Variables\n", - "a01=0.2866;#The Lattice parameter of BCC in nm\n", - "a02=0.3571;#The Lattice parameter of FCC in nm\n", - "r=0.071;#Radius of carbon atom in nm\n", - "ni1=12.;#No. of interstitial sites per unit cell for BCC\n", - "ni2=4.;#No. of interstitial sites per unit cell for FCC\n", - "#CALCULATIONS\n", - "Rb=(sqrt(3)*a01)/4.;#Radius of iron atom in nm\n", - "Ri1=sqrt(0.3125*a01**2)-Rb;# Interstitial Radius of iron atom in nm\n", - "Rf=(sqrt(2)*a02)/4.;#the radius of the iron atom in nm\n", - "Ri2=(a02-(2*Rf))/2.;#the radius of the interstitial site in nm\n", - "C1=(ni1/(ni1+2))*100;#The atomic percentage of carbon contained in the BCC iron in percent\n", - "C2=(ni2/(ni2+4))*100;#The atomic percentage of carbon contained in the FCC iron in percent\n", - "print \"Radius of iron atom in nm\",round(Rb,5)\n", - "print \"Interstitial Radius of iron atom in nm:\",round(Ri1,5)\n", - "print \"the radius of the iron atom in nm:\",round(Rf,5)\n", - "print \"the radius of the interstitial site in nm:\",round(Ri2,5)\n", - "print \"The atomic percentage of carbon contained in BCC iron in percent:\",round(C1)\n", - "print \"The atomic percentage of carbon contained in FCC iron in percent:\",C2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_6 pgno:127" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The length of Burgers vector in nm: 0.28\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "# Initialisation of Variable\n", - "a0=0.396;#Lattice parameter of magnesium oxide\n", - "h=1;#Because b is a [110] direction\n", - "k=1;#Because b is a [110] direction\n", - "l=0;#Because b is a [110] direction\n", - "#CALCULATIONS\n", - "b=a0/sqrt(2);#The length of Burgers vector in nm\n", - "print \"The length of Burgers vector in nm:\",round(b,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_7 pgno:128" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Face Diagonal of copperin nm: 0.51125\n", - "The length of the Burgers vector in nm: 0.25563\n" - ] - } - ], - "source": [ - "\n", - "from math import sqrt\n", - "# Initialisation of Variables\n", - "a01=0.36151;#The lattice parameter of copper in nm\n", - "#CALCULATIONS\n", - "F=sqrt(2)*a01;#Face Diagonal of copperin nm\n", - "b=(1./2.)*(F);#The length of the Burgers vector, or the repeat distance in nm\n", - "print \"Face Diagonal of copperin nm:\",round(F,5)\n", - "print \"The length of the Burgers vector in nm:\",round(b,5)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_8 pgno:129" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Planar density of (110)BCC in atoms/cm**2: 1.72172040168e+15\n", - "The interplanar spacings for (110)BCC in cm: 2.02656803488e-17 3\n", - "The interplanar spacings for (112)BCC in cm: 1.17003960047e-17 2\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "# Initialisation of Variables\n", - "n=2;#No. of Atoms present per cell in BCC\n", - "a0=2.866*10**-8;#The lattice parameter of BCC iron in cm\n", - "rho1=0.994*10**15;#Planar density of (112)BCC in atoms/cm**2\n", - "#CALCULATIONS\n", - "a=sqrt(2)*a0**2;#Area of BCC iron in cm**2\n", - "rho2=n/a;#Planar density of (110)BCC in atoms/cm**2\n", - "d1=a0*10**-9/(sqrt(1**2+1**2+0));#The interplanar spacings for (110)BCC in cm\n", - "d2=a0*10**-9/(sqrt(1**2+1**2+2**2));#The interplanar spacings for (112)BCC in cm\n", - "print \"Planar density of (110)BCC in atoms/cm**2:\",round(rho2,2)\n", - "print \"The interplanar spacings for (110)BCC in cm:\",d1,3\n", - "print \"The interplanar spacings for (112)BCC in cm:\",d2,2" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_13 pgno:139" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the ASTM grain size number: 7.64\n" - ] - } - ], - "source": [ - "from math import log10\n", - "# Initialisation of Variables\n", - "g=16# No. of grains per square inch in a photomicrograph\n", - "M=250;#Magnification in a photomicrograph\n", - "N=(M/g)*100;#The number of grains per square inch\n", - "n=(log10(100)/log10(2))+1;#the ASTM grain size number\n", - "print \"the ASTM grain size number:\",round(n,2)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials.ipynb deleted file mode 100755 index a50ef08f..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials.ipynb +++ /dev/null @@ -1,352 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5 Atoms and Ion Moments in Materials " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_2 pgno:160" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "27865.0 Activation Energy for Interstitial Atoms in cal/mol:\n" - ] - } - ], - "source": [ - "#EXAMPLE 5.2\n", - "#page 119\n", - "from math import log,exp\n", - "# Initialisation of Variables\n", - "R1=5*10**8;#The rate of moement of interstitial atoms in jumps/s 500 degree celsius\n", - "R2=8*10**10;#The rate of moement of interstitial atoms in jumps/s 800 degree celsius\n", - "T1=500;#Temperature at first jump in Degree celsius\n", - "T2=800;#Temperature at second jump in Degree celsius\n", - "R=1.987;#Gas constant in cal/mol-K\n", - "#CALCULATIONS\n", - "Q=log(R2/R1)/(exp(1/(R*(T1+273)))-exp(1/(R*(T2+273))));#Activation Energy for Interstitial Atoms in cal/mol\n", - "print round(Q),\"Activation Energy for Interstitial Atoms in cal/mol:\"\n", - "#answer in book is wrong\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_3 pgno:166" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.0001 concentration gradient in percent/cm:\n", - "-1.995e+19 concentration gradient in percent/cm**3.cm:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "X=0.1;#Thickness of SIlicon Wafer in cm\n", - "n=8.;#No. of atoms in silicon per cell\n", - "ni=1.;#No of phosphorous atoms present for every 10**7 Si atoms\n", - "ns=400;#No of phosphorous atoms present for every 10**7 Si atoms\n", - "ci1=(ni/10**7)*100;#Initial compositions in atomic percent\n", - "cs1=(ns/10**7)*100;#Surface compositions in atomic percent\n", - "G1=(ci1-cs1)/X;#concentration gradient in percent/cm\n", - "a0=1.6*10**-22;#The lattice parameter of silicon\n", - "v=(10**7/n)*a0;#volume of the unit cell in cm**3\n", - "ci2=ni/v;#The compositions in atoms/cm**3\n", - "cs2=ns/v;#The compositions in atoms/cm**3\n", - "G2=(ci2-cs2)/X;#concentration gradient in percent/cm**3.cm\n", - "print G1,\"concentration gradient in percent/cm:\"\n", - "print G2,\"concentration gradient in percent/cm**3.cm:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_4 pgno:167" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "total number no.of Ni atoms per second is 6.17256e+13\n", - "nickel atoms removed from the Ni/MgO interface is 7.2e-10\n", - "the thickness is 1.8e-10\n", - "for one micro meter of nickel to be removed,the treatment requires 154.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "cin=8.573*10**22;\n", - "dx=0.05;\n", - "d=9*10**-12;\n", - "j=d*cin/dx;\n", - "A=2*2;\n", - "tn=A*j;\n", - "print \"total number no.of Ni atoms per second is \",tn\n", - "nm=tn/(8.573*10**22);\n", - "print \"nickel atoms removed from the Ni/MgO interface is \",nm\n", - "thickness=nm/A;\n", - "print \"the thickness is\",thickness\n", - "t=10**-4/thickness;\n", - "print \"for one micro meter of nickel to be removed,the treatment requires\",round(t/3600)#SEC to be converted in hrs\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_5 pgno:171" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.013 Minimum thickness of the membrane of Natoms in cm\n", - "0.073 Minimum thickness of the membrane of Hatoms in cm\n" - ] - } - ], - "source": [ - "from math import pi,log,exp\n", - "# Initialisation of Variables\n", - "N=1;#N0. of atoms on one side of iron bar\n", - "H=1;#No. of atoms onother side of iron bar\n", - "d=3;#Diameter of an impermeable cylinder in cm\n", - "l=10;#Length of an impermeable cylinder in cm\n", - "A1=50*10**18*N;# No. of gaseous Atoms per cm**3 on one side \n", - "A2=50*10**18*H;#No. of gaseous Atom per cm**3 on one side\n", - "B1=1*10**18*N;#No. of gaseous atoms per cm**3 on another side\n", - "B2=1*10**18*H;#No. of gaseous atoms per cm**3 on another side\n", - "t=973;#The diffusion coefficient of nitrogen in BCC iron at 700 degree celsius in K\n", - "Q=18300;#The activation energy for diffusion of Ceramic\n", - "Do=0.0047;#The pre-exponential term of ceramic\n", - "R=1.987;#Gas constant in cal/mol.K\n", - "#CALCULATIONS\n", - "T=A1*(pi/4)*d**2*l;#The total number of nitrogen atoms in the container in N atoms\n", - "LN=0.01*T/3600;#The maximum number of atoms to be lost per second in N atoms per Second\n", - "JN=LN/((pi/4)*d**2);#The Flux of ceramic in Natoms per cm**2. sec.\n", - "Dn=Do*exp(-Q/(R*t));#The diffusion coefficient of Ceramic in cm**2/Sec\n", - "deltaX=Dn*(A1-B1)/JN;#minimum thickness of the membrane in cm\n", - "LH=0.90*T/3600;#Hydrogen atom loss per sec.\n", - "JH=LH/((pi/4)*d**2);#The Flux of ceramic in Hatoms per cm**2. sec.\n", - "Dh=Do*exp(-Q/(R*t));#The diffusion coeficient of Ceramic in cm**2/Sec\n", - "deltaX2=((1.86*10**-4)*(A2-B2))/JH;#Minimum thickness of the membrane in cm\n", - "print round(deltaX,3),\"Minimum thickness of the membrane of Natoms in cm\"\n", - "print round(deltaX2,3),\"Minimum thickness of the membrane of Hatoms in cm\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_6 pgno:174" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "6.30824936432e+22 The number of tungsten atoms per cm**3:\n", - "6.30824936432e+20 The number of thorium atoms per cm**3:\n", - "-6.30824936432e+22 The concentration gradient of Tungsten in atoms/cm**3.cm:\n", - "2.89066552915e-12 The diffusion coeficient of Tungsten in cm**2/Sec:\n", - "1.82350389868e+11 Volume Diffusion in Th atoms/cm**2.sec.:\n", - "1.64051460984e-09 The diffusion coeficient of Tungsten in cm**2/Sec:\n", - "1.03487752447e+14 Grain boundry Diffusion in Th atoms/cm**2.sec.:\n", - "1.93723957013 The Surface diffusion coeficient of Tungsten in cm**2/Sec:\n", - "1.22205902868e+15 Surface Diffusion in Th atoms/cm**2.sec.:\n" - ] - } - ], - "source": [ - "from math import exp\n", - "# Initialisation of Variables\n", - "n=2;#no of atoms/ cell in BCC Tungsten\n", - "a0=3.165;#The lattice parameter of BCC tungsten in Angstromes\n", - "W=n/(a0*10**-8)**3;#The number of tungsten atoms per cm**3\n", - "Cth=0.01*W;#The number of thorium atoms per cm**3\n", - "Cg=-Cth/0.01;#The concentration gradient of Tungsten in atoms/cm**3.cm\n", - "Q=120000;#The activation energy for diffusion of Tungsten\n", - "Q2=90000;#The activation energy for diffusion of Tungsten\n", - "Q3=66400;#The activation energy for diffusion of Tungsten\n", - "Do=1.0;#The pre-exponential term of Tungsten\n", - "Do2=0.74;#The pre-exponential term of Tungsten\n", - "Do3=0.47;#The pre-exponential term of Tungsten\n", - "R=1.987;#Gas constant in cal/mol.K\n", - "t=2273;#The diffusion coefficient of nitrogen in BCC iron at 2000 degree celsius in K\n", - "#CALCULATIONS\n", - "D1=Do*exp(-Q/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", - "J1=-D1*Cg;#Volume Diffusion in Th atoms/cm**2.sec.\n", - "D2=Do2*exp(-Q2/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", - "J2=-D2*Cg;#Grain boundary Diffusion in Th atoms/cm**2.sec.\n", - "D3=0.47*exp(-66400/(1.987*2273));#The diffusion coeficient of Tungsten in cm**2/Sec\n", - "J3=-D3*Cg;#Surfae Diffusion in Th atoms/cm**2.sec.\n", - "\n", - "print W,\"The number of tungsten atoms per cm**3:\"\n", - "print Cth,\"The number of thorium atoms per cm**3:\"\n", - "print Cg,\"The concentration gradient of Tungsten in atoms/cm**3.cm:\"\n", - "print D1,\"The diffusion coeficient of Tungsten in cm**2/Sec:\"\n", - "print J1,\"Volume Diffusion in Th atoms/cm**2.sec.:\"\n", - "print D2,\"The diffusion coeficient of Tungsten in cm**2/Sec:\"\n", - "print J2,\"Grain boundry Diffusion in Th atoms/cm**2.sec.:\"\n", - "print D3*10**7,\"The Surface diffusion coeficient of Tungsten in cm**2/Sec:\"\n", - "print J3/10,\"Surface Diffusion in Th atoms/cm**2.sec.:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_7 pgno:178" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the combution temperatures are [ 39.09194444 14.38111111 5.29041667 1.94625 ]\n" - ] - } - ], - "source": [ - "import numpy\n", - "from math import exp\n", - "T=numpy.array([1173, 1273, 1373, 1473])#kelvins\n", - "t=numpy.array([0, 0, 0, 0])\n", - "#in K\n", - "t[0]=0.0861/exp(-16558/T[0])\n", - "t[1]=0.0861/exp(-16558/T[1])\n", - "t[2]=0.0861/exp(-16558/T[2])\n", - "t[3]=0.0861/exp(-16558/T[3])\n", - "print \"the combution temperatures are\",(0.5*t/3600)\n", - "#the difference in asnwer is due to round off error\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_8 pgno:180" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "3.2993917076 Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade:\n", - "20 The cost of carburizing per Part of steel rods at 900 degree centigrade\n", - "9.9 The cost of carburizing per Part of steel rods at 1000 degree centigrade\n" - ] - } - ], - "source": [ - "from math import exp\n", - "# Initialisation of Variables\n", - "H=10;#Required time to successfully carburize a batch of 500 steel gears\n", - "t1=1173;#Temperature at carburizing a batch of 500 steel gears in K\n", - "t2=1273;#Temperature at carburizing a batch of 500 steel gears in K\n", - "Q=32900;#The activation energy for diffusion of BCC steel\n", - "R=1.987;#Gas constant in cal/mol.K\n", - "c1=1000;#cost per hour to operate the carburizing furnace at 900\u0002degree centigrades\n", - "c2=1500;#Cost per hour to operate the carburizing furnace at 1000 degree centigrade\n", - "H2=(exp(-Q /(R*t1))*H*3600)/exp(-Q /(R*t2));# Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade\n", - "Cp1=c1*H/500;#The cost per Part of steel rods at 900 degree centigrade\n", - "Cv=(c2*3.299)/500;#The cost per Part of steel rods at 1000 degree centigrade\n", - "print H2/3600,\"Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade:\"\n", - "print Cp1,\"The cost of carburizing per Part of steel rods at 900 degree centigrade\"\n", - "print round(Cv,2),\"The cost of carburizing per Part of steel rods at 1000 degree centigrade\"" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_1.ipynb deleted file mode 100755 index a50ef08f..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_1.ipynb +++ /dev/null @@ -1,352 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5 Atoms and Ion Moments in Materials " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_2 pgno:160" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "27865.0 Activation Energy for Interstitial Atoms in cal/mol:\n" - ] - } - ], - "source": [ - "#EXAMPLE 5.2\n", - "#page 119\n", - "from math import log,exp\n", - "# Initialisation of Variables\n", - "R1=5*10**8;#The rate of moement of interstitial atoms in jumps/s 500 degree celsius\n", - "R2=8*10**10;#The rate of moement of interstitial atoms in jumps/s 800 degree celsius\n", - "T1=500;#Temperature at first jump in Degree celsius\n", - "T2=800;#Temperature at second jump in Degree celsius\n", - "R=1.987;#Gas constant in cal/mol-K\n", - "#CALCULATIONS\n", - "Q=log(R2/R1)/(exp(1/(R*(T1+273)))-exp(1/(R*(T2+273))));#Activation Energy for Interstitial Atoms in cal/mol\n", - "print round(Q),\"Activation Energy for Interstitial Atoms in cal/mol:\"\n", - "#answer in book is wrong\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_3 pgno:166" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.0001 concentration gradient in percent/cm:\n", - "-1.995e+19 concentration gradient in percent/cm**3.cm:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "X=0.1;#Thickness of SIlicon Wafer in cm\n", - "n=8.;#No. of atoms in silicon per cell\n", - "ni=1.;#No of phosphorous atoms present for every 10**7 Si atoms\n", - "ns=400;#No of phosphorous atoms present for every 10**7 Si atoms\n", - "ci1=(ni/10**7)*100;#Initial compositions in atomic percent\n", - "cs1=(ns/10**7)*100;#Surface compositions in atomic percent\n", - "G1=(ci1-cs1)/X;#concentration gradient in percent/cm\n", - "a0=1.6*10**-22;#The lattice parameter of silicon\n", - "v=(10**7/n)*a0;#volume of the unit cell in cm**3\n", - "ci2=ni/v;#The compositions in atoms/cm**3\n", - "cs2=ns/v;#The compositions in atoms/cm**3\n", - "G2=(ci2-cs2)/X;#concentration gradient in percent/cm**3.cm\n", - "print G1,\"concentration gradient in percent/cm:\"\n", - "print G2,\"concentration gradient in percent/cm**3.cm:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_4 pgno:167" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "total number no.of Ni atoms per second is 6.17256e+13\n", - "nickel atoms removed from the Ni/MgO interface is 7.2e-10\n", - "the thickness is 1.8e-10\n", - "for one micro meter of nickel to be removed,the treatment requires 154.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "cin=8.573*10**22;\n", - "dx=0.05;\n", - "d=9*10**-12;\n", - "j=d*cin/dx;\n", - "A=2*2;\n", - "tn=A*j;\n", - "print \"total number no.of Ni atoms per second is \",tn\n", - "nm=tn/(8.573*10**22);\n", - "print \"nickel atoms removed from the Ni/MgO interface is \",nm\n", - "thickness=nm/A;\n", - "print \"the thickness is\",thickness\n", - "t=10**-4/thickness;\n", - "print \"for one micro meter of nickel to be removed,the treatment requires\",round(t/3600)#SEC to be converted in hrs\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_5 pgno:171" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.013 Minimum thickness of the membrane of Natoms in cm\n", - "0.073 Minimum thickness of the membrane of Hatoms in cm\n" - ] - } - ], - "source": [ - "from math import pi,log,exp\n", - "# Initialisation of Variables\n", - "N=1;#N0. of atoms on one side of iron bar\n", - "H=1;#No. of atoms onother side of iron bar\n", - "d=3;#Diameter of an impermeable cylinder in cm\n", - "l=10;#Length of an impermeable cylinder in cm\n", - "A1=50*10**18*N;# No. of gaseous Atoms per cm**3 on one side \n", - "A2=50*10**18*H;#No. of gaseous Atom per cm**3 on one side\n", - "B1=1*10**18*N;#No. of gaseous atoms per cm**3 on another side\n", - "B2=1*10**18*H;#No. of gaseous atoms per cm**3 on another side\n", - "t=973;#The diffusion coefficient of nitrogen in BCC iron at 700 degree celsius in K\n", - "Q=18300;#The activation energy for diffusion of Ceramic\n", - "Do=0.0047;#The pre-exponential term of ceramic\n", - "R=1.987;#Gas constant in cal/mol.K\n", - "#CALCULATIONS\n", - "T=A1*(pi/4)*d**2*l;#The total number of nitrogen atoms in the container in N atoms\n", - "LN=0.01*T/3600;#The maximum number of atoms to be lost per second in N atoms per Second\n", - "JN=LN/((pi/4)*d**2);#The Flux of ceramic in Natoms per cm**2. sec.\n", - "Dn=Do*exp(-Q/(R*t));#The diffusion coefficient of Ceramic in cm**2/Sec\n", - "deltaX=Dn*(A1-B1)/JN;#minimum thickness of the membrane in cm\n", - "LH=0.90*T/3600;#Hydrogen atom loss per sec.\n", - "JH=LH/((pi/4)*d**2);#The Flux of ceramic in Hatoms per cm**2. sec.\n", - "Dh=Do*exp(-Q/(R*t));#The diffusion coeficient of Ceramic in cm**2/Sec\n", - "deltaX2=((1.86*10**-4)*(A2-B2))/JH;#Minimum thickness of the membrane in cm\n", - "print round(deltaX,3),\"Minimum thickness of the membrane of Natoms in cm\"\n", - "print round(deltaX2,3),\"Minimum thickness of the membrane of Hatoms in cm\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_6 pgno:174" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "6.30824936432e+22 The number of tungsten atoms per cm**3:\n", - "6.30824936432e+20 The number of thorium atoms per cm**3:\n", - "-6.30824936432e+22 The concentration gradient of Tungsten in atoms/cm**3.cm:\n", - "2.89066552915e-12 The diffusion coeficient of Tungsten in cm**2/Sec:\n", - "1.82350389868e+11 Volume Diffusion in Th atoms/cm**2.sec.:\n", - "1.64051460984e-09 The diffusion coeficient of Tungsten in cm**2/Sec:\n", - "1.03487752447e+14 Grain boundry Diffusion in Th atoms/cm**2.sec.:\n", - "1.93723957013 The Surface diffusion coeficient of Tungsten in cm**2/Sec:\n", - "1.22205902868e+15 Surface Diffusion in Th atoms/cm**2.sec.:\n" - ] - } - ], - "source": [ - "from math import exp\n", - "# Initialisation of Variables\n", - "n=2;#no of atoms/ cell in BCC Tungsten\n", - "a0=3.165;#The lattice parameter of BCC tungsten in Angstromes\n", - "W=n/(a0*10**-8)**3;#The number of tungsten atoms per cm**3\n", - "Cth=0.01*W;#The number of thorium atoms per cm**3\n", - "Cg=-Cth/0.01;#The concentration gradient of Tungsten in atoms/cm**3.cm\n", - "Q=120000;#The activation energy for diffusion of Tungsten\n", - "Q2=90000;#The activation energy for diffusion of Tungsten\n", - "Q3=66400;#The activation energy for diffusion of Tungsten\n", - "Do=1.0;#The pre-exponential term of Tungsten\n", - "Do2=0.74;#The pre-exponential term of Tungsten\n", - "Do3=0.47;#The pre-exponential term of Tungsten\n", - "R=1.987;#Gas constant in cal/mol.K\n", - "t=2273;#The diffusion coefficient of nitrogen in BCC iron at 2000 degree celsius in K\n", - "#CALCULATIONS\n", - "D1=Do*exp(-Q/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", - "J1=-D1*Cg;#Volume Diffusion in Th atoms/cm**2.sec.\n", - "D2=Do2*exp(-Q2/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", - "J2=-D2*Cg;#Grain boundary Diffusion in Th atoms/cm**2.sec.\n", - "D3=0.47*exp(-66400/(1.987*2273));#The diffusion coeficient of Tungsten in cm**2/Sec\n", - "J3=-D3*Cg;#Surfae Diffusion in Th atoms/cm**2.sec.\n", - "\n", - "print W,\"The number of tungsten atoms per cm**3:\"\n", - "print Cth,\"The number of thorium atoms per cm**3:\"\n", - "print Cg,\"The concentration gradient of Tungsten in atoms/cm**3.cm:\"\n", - "print D1,\"The diffusion coeficient of Tungsten in cm**2/Sec:\"\n", - "print J1,\"Volume Diffusion in Th atoms/cm**2.sec.:\"\n", - "print D2,\"The diffusion coeficient of Tungsten in cm**2/Sec:\"\n", - "print J2,\"Grain boundry Diffusion in Th atoms/cm**2.sec.:\"\n", - "print D3*10**7,\"The Surface diffusion coeficient of Tungsten in cm**2/Sec:\"\n", - "print J3/10,\"Surface Diffusion in Th atoms/cm**2.sec.:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_7 pgno:178" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the combution temperatures are [ 39.09194444 14.38111111 5.29041667 1.94625 ]\n" - ] - } - ], - "source": [ - "import numpy\n", - "from math import exp\n", - "T=numpy.array([1173, 1273, 1373, 1473])#kelvins\n", - "t=numpy.array([0, 0, 0, 0])\n", - "#in K\n", - "t[0]=0.0861/exp(-16558/T[0])\n", - "t[1]=0.0861/exp(-16558/T[1])\n", - "t[2]=0.0861/exp(-16558/T[2])\n", - "t[3]=0.0861/exp(-16558/T[3])\n", - "print \"the combution temperatures are\",(0.5*t/3600)\n", - "#the difference in asnwer is due to round off error\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_8 pgno:180" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "3.2993917076 Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade:\n", - "20 The cost of carburizing per Part of steel rods at 900 degree centigrade\n", - "9.9 The cost of carburizing per Part of steel rods at 1000 degree centigrade\n" - ] - } - ], - "source": [ - "from math import exp\n", - "# Initialisation of Variables\n", - "H=10;#Required time to successfully carburize a batch of 500 steel gears\n", - "t1=1173;#Temperature at carburizing a batch of 500 steel gears in K\n", - "t2=1273;#Temperature at carburizing a batch of 500 steel gears in K\n", - "Q=32900;#The activation energy for diffusion of BCC steel\n", - "R=1.987;#Gas constant in cal/mol.K\n", - "c1=1000;#cost per hour to operate the carburizing furnace at 900\u0002degree centigrades\n", - "c2=1500;#Cost per hour to operate the carburizing furnace at 1000 degree centigrade\n", - "H2=(exp(-Q /(R*t1))*H*3600)/exp(-Q /(R*t2));# Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade\n", - "Cp1=c1*H/500;#The cost per Part of steel rods at 900 degree centigrade\n", - "Cv=(c2*3.299)/500;#The cost per Part of steel rods at 1000 degree centigrade\n", - "print H2/3600,\"Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade:\"\n", - "print Cp1,\"The cost of carburizing per Part of steel rods at 900 degree centigrade\"\n", - "print round(Cv,2),\"The cost of carburizing per Part of steel rods at 1000 degree centigrade\"" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_2.ipynb deleted file mode 100755 index e4f25582..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_2.ipynb +++ /dev/null @@ -1,352 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5 Atoms and Ion Moments in Materials " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_2 pgno:160" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Activation Energy for Interstitial Atoms in cal/mol: 27865.0\n" - ] - } - ], - "source": [ - "#EXAMPLE 5.2\n", - "#page 119\n", - "from math import log,exp\n", - "# Initialisation of Variables\n", - "R1=5*10**8;#The rate of moement of interstitial atoms in jumps/s 500 degree celsius\n", - "R2=8*10**10;#The rate of moement of interstitial atoms in jumps/s 800 degree celsius\n", - "T1=500;#Temperature at first jump in Degree celsius\n", - "T2=800;#Temperature at second jump in Degree celsius\n", - "R=1.987;#Gas constant in cal/mol-K\n", - "#CALCULATIONS\n", - "Q=log(R2/R1)/(exp(1/(R*(T1+273)))-exp(1/(R*(T2+273))));#Activation Energy for Interstitial Atoms in cal/mol\n", - "print \"Activation Energy for Interstitial Atoms in cal/mol:\",round(Q)\n", - "#answer in book is wrong\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_3 pgno:166" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "concentration gradient in percent/cm: 0.0001\n", - "concentration gradient in percent/cm**3.cm: -1.995e+19\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "X=0.1;#Thickness of SIlicon Wafer in cm\n", - "n=8.;#No. of atoms in silicon per cell\n", - "ni=1.;#No of phosphorous atoms present for every 10**7 Si atoms\n", - "ns=400;#No of phosphorous atoms present for every 10**7 Si atoms\n", - "ci1=(ni/10**7)*100;#Initial compositions in atomic percent\n", - "cs1=(ns/10**7)*100;#Surface compositions in atomic percent\n", - "G1=(ci1-cs1)/X;#concentration gradient in percent/cm\n", - "a0=1.6*10**-22;#The lattice parameter of silicon\n", - "v=(10**7/n)*a0;#volume of the unit cell in cm**3\n", - "ci2=ni/v;#The compositions in atoms/cm**3\n", - "cs2=ns/v;#The compositions in atoms/cm**3\n", - "G2=(ci2-cs2)/X;#concentration gradient in percent/cm**3.cm\n", - "print \"concentration gradient in percent/cm:\",G1\n", - "print \"concentration gradient in percent/cm**3.cm:\",G2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_4 pgno:167" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "total number no.of Ni atoms per second is 6.17256e+13\n", - "nickel atoms removed from the Ni/MgO interface is 7.2e-10\n", - "the thickness is 1.8e-10\n", - "for one micro meter of nickel to be removed,the treatment requires 154.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "cin=8.573*10**22;\n", - "dx=0.05;\n", - "d=9*10**-12;\n", - "j=d*cin/dx;\n", - "A=2*2;\n", - "tn=A*j;\n", - "print \"total number no.of Ni atoms per second is \",tn\n", - "nm=tn/(8.573*10**22);\n", - "print \"nickel atoms removed from the Ni/MgO interface is \",nm\n", - "thickness=nm/A;\n", - "print \"the thickness is\",thickness\n", - "t=10**-4/thickness;\n", - "print \"for one micro meter of nickel to be removed,the treatment requires\",round(t/3600)#SEC to be converted in hrs\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_5 pgno:171" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Minimum thickness of the membrane of Natoms in cm 0.013\n", - "Minimum thickness of the membrane of Hatoms in cm 0.073\n" - ] - } - ], - "source": [ - "from math import pi,log,exp\n", - "# Initialisation of Variables\n", - "N=1;#N0. of atoms on one side of iron bar\n", - "H=1;#No. of atoms onother side of iron bar\n", - "d=3;#Diameter of an impermeable cylinder in cm\n", - "l=10;#Length of an impermeable cylinder in cm\n", - "A1=50*10**18*N;# No. of gaseous Atoms per cm**3 on one side \n", - "A2=50*10**18*H;#No. of gaseous Atom per cm**3 on one side\n", - "B1=1*10**18*N;#No. of gaseous atoms per cm**3 on another side\n", - "B2=1*10**18*H;#No. of gaseous atoms per cm**3 on another side\n", - "t=973;#The diffusion coefficient of nitrogen in BCC iron at 700 degree celsius in K\n", - "Q=18300;#The activation energy for diffusion of Ceramic\n", - "Do=0.0047;#The pre-exponential term of ceramic\n", - "R=1.987;#Gas constant in cal/mol.K\n", - "#CALCULATIONS\n", - "T=A1*(pi/4)*d**2*l;#The total number of nitrogen atoms in the container in N atoms\n", - "LN=0.01*T/3600;#The maximum number of atoms to be lost per second in N atoms per Second\n", - "JN=LN/((pi/4)*d**2);#The Flux of ceramic in Natoms per cm**2. sec.\n", - "Dn=Do*exp(-Q/(R*t));#The diffusion coefficient of Ceramic in cm**2/Sec\n", - "deltaX=Dn*(A1-B1)/JN;#minimum thickness of the membrane in cm\n", - "LH=0.90*T/3600;#Hydrogen atom loss per sec.\n", - "JH=LH/((pi/4)*d**2);#The Flux of ceramic in Hatoms per cm**2. sec.\n", - "Dh=Do*exp(-Q/(R*t));#The diffusion coeficient of Ceramic in cm**2/Sec\n", - "deltaX2=((1.86*10**-4)*(A2-B2))/JH;#Minimum thickness of the membrane in cm\n", - "print \"Minimum thickness of the membrane of Natoms in cm\", round(deltaX,3)\n", - "print \"Minimum thickness of the membrane of Hatoms in cm\",round(deltaX2,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_6 pgno:174" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The number of tungsten atoms per cm**3: 6.30824936432e+22\n", - "The number of thorium atoms per cm**3: 6.30824936432e+20\n", - "The concentration gradient of Tungsten in atoms/cm**3.cm: -6.30824936432e+22\n", - "The diffusion coeficient of Tungsten in cm**2/Sec: 2.89066552915e-12\n", - "Volume Diffusion in Th atoms/cm**2.sec.: 1.82350389868e+11\n", - "The diffusion coeficient of Tungsten in cm**2/Sec: 1.64051460984e-09\n", - "Grain boundry Diffusion in Th atoms/cm**2.sec.: 1.03487752447e+14\n", - "The Surface diffusion coeficient of Tungsten in cm**2/Sec: 1.93723957013\n", - "Surface Diffusion in Th atoms/cm**2.sec.: 1.22205902868e+15\n" - ] - } - ], - "source": [ - "from math import exp\n", - "# Initialisation of Variables\n", - "n=2;#no of atoms/ cell in BCC Tungsten\n", - "a0=3.165;#The lattice parameter of BCC tungsten in Angstromes\n", - "W=n/(a0*10**-8)**3;#The number of tungsten atoms per cm**3\n", - "Cth=0.01*W;#The number of thorium atoms per cm**3\n", - "Cg=-Cth/0.01;#The concentration gradient of Tungsten in atoms/cm**3.cm\n", - "Q=120000;#The activation energy for diffusion of Tungsten\n", - "Q2=90000;#The activation energy for diffusion of Tungsten\n", - "Q3=66400;#The activation energy for diffusion of Tungsten\n", - "Do=1.0;#The pre-exponential term of Tungsten\n", - "Do2=0.74;#The pre-exponential term of Tungsten\n", - "Do3=0.47;#The pre-exponential term of Tungsten\n", - "R=1.987;#Gas constant in cal/mol.K\n", - "t=2273;#The diffusion coefficient of nitrogen in BCC iron at 2000 degree celsius in K\n", - "#CALCULATIONS\n", - "D1=Do*exp(-Q/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", - "J1=-D1*Cg;#Volume Diffusion in Th atoms/cm**2.sec.\n", - "D2=Do2*exp(-Q2/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", - "J2=-D2*Cg;#Grain boundary Diffusion in Th atoms/cm**2.sec.\n", - "D3=0.47*exp(-66400/(1.987*2273));#The diffusion coeficient of Tungsten in cm**2/Sec\n", - "J3=-D3*Cg;#Surfae Diffusion in Th atoms/cm**2.sec.\n", - "\n", - "print \"The number of tungsten atoms per cm**3:\",W\n", - "print \"The number of thorium atoms per cm**3:\",Cth\n", - "print \"The concentration gradient of Tungsten in atoms/cm**3.cm:\",Cg\n", - "print \"The diffusion coeficient of Tungsten in cm**2/Sec:\",D1\n", - "print \"Volume Diffusion in Th atoms/cm**2.sec.:\",J1\n", - "print \"The diffusion coeficient of Tungsten in cm**2/Sec:\",D2\n", - "print \"Grain boundry Diffusion in Th atoms/cm**2.sec.:\",J2\n", - "print \"The Surface diffusion coeficient of Tungsten in cm**2/Sec:\",D3*10**7\n", - "print \"Surface Diffusion in Th atoms/cm**2.sec.:\",J3/10\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_7 pgno:178" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the combution temperatures are [ 39.09194444 14.38111111 5.29041667 1.94625 ]\n" - ] - } - ], - "source": [ - "import numpy\n", - "from math import exp\n", - "T=numpy.array([1173, 1273, 1373, 1473])#kelvins\n", - "t=numpy.array([0, 0, 0, 0])\n", - "#in K\n", - "t[0]=0.0861/exp(-16558/T[0])\n", - "t[1]=0.0861/exp(-16558/T[1])\n", - "t[2]=0.0861/exp(-16558/T[2])\n", - "t[3]=0.0861/exp(-16558/T[3])\n", - "print \"the combution temperatures are\",(0.5*t/3600)\n", - "#the difference in asnwer is due to round off error\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_8 pgno:180" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade: 3.2993917076\n", - "The cost of carburizing per Part of steel rods at 900 degree centigrade 20\n", - "The cost of carburizing per Part of steel rods at 1000 degree centigrade 9.9\n" - ] - } - ], - "source": [ - "from math import exp\n", - "# Initialisation of Variables\n", - "H=10;#Required time to successfully carburize a batch of 500 steel gears\n", - "t1=1173;#Temperature at carburizing a batch of 500 steel gears in K\n", - "t2=1273;#Temperature at carburizing a batch of 500 steel gears in K\n", - "Q=32900;#The activation energy for diffusion of BCC steel\n", - "R=1.987;#Gas constant in cal/mol.K\n", - "c1=1000;#cost per hour to operate the carburizing furnace at 900\u0002degree centigrades\n", - "c2=1500;#Cost per hour to operate the carburizing furnace at 1000 degree centigrade\n", - "H2=(exp(-Q /(R*t1))*H*3600)/exp(-Q /(R*t2));# Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade\n", - "Cp1=c1*H/500;#The cost per Part of steel rods at 900 degree centigrade\n", - "Cv=(c2*3.299)/500;#The cost per Part of steel rods at 1000 degree centigrade\n", - "print \"Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade:\",H2/3600\n", - "print \"The cost of carburizing per Part of steel rods at 900 degree centigrade\",Cp1\n", - "print \"The cost of carburizing per Part of steel rods at 1000 degree centigrade\",round(Cv,2)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_3.ipynb deleted file mode 100755 index e4f25582..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_5_Atoms_and_Ion_Moments_in_Materials_3.ipynb +++ /dev/null @@ -1,352 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5 Atoms and Ion Moments in Materials " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_2 pgno:160" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Activation Energy for Interstitial Atoms in cal/mol: 27865.0\n" - ] - } - ], - "source": [ - "#EXAMPLE 5.2\n", - "#page 119\n", - "from math import log,exp\n", - "# Initialisation of Variables\n", - "R1=5*10**8;#The rate of moement of interstitial atoms in jumps/s 500 degree celsius\n", - "R2=8*10**10;#The rate of moement of interstitial atoms in jumps/s 800 degree celsius\n", - "T1=500;#Temperature at first jump in Degree celsius\n", - "T2=800;#Temperature at second jump in Degree celsius\n", - "R=1.987;#Gas constant in cal/mol-K\n", - "#CALCULATIONS\n", - "Q=log(R2/R1)/(exp(1/(R*(T1+273)))-exp(1/(R*(T2+273))));#Activation Energy for Interstitial Atoms in cal/mol\n", - "print \"Activation Energy for Interstitial Atoms in cal/mol:\",round(Q)\n", - "#answer in book is wrong\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_3 pgno:166" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "concentration gradient in percent/cm: 0.0001\n", - "concentration gradient in percent/cm**3.cm: -1.995e+19\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "X=0.1;#Thickness of SIlicon Wafer in cm\n", - "n=8.;#No. of atoms in silicon per cell\n", - "ni=1.;#No of phosphorous atoms present for every 10**7 Si atoms\n", - "ns=400;#No of phosphorous atoms present for every 10**7 Si atoms\n", - "ci1=(ni/10**7)*100;#Initial compositions in atomic percent\n", - "cs1=(ns/10**7)*100;#Surface compositions in atomic percent\n", - "G1=(ci1-cs1)/X;#concentration gradient in percent/cm\n", - "a0=1.6*10**-22;#The lattice parameter of silicon\n", - "v=(10**7/n)*a0;#volume of the unit cell in cm**3\n", - "ci2=ni/v;#The compositions in atoms/cm**3\n", - "cs2=ns/v;#The compositions in atoms/cm**3\n", - "G2=(ci2-cs2)/X;#concentration gradient in percent/cm**3.cm\n", - "print \"concentration gradient in percent/cm:\",G1\n", - "print \"concentration gradient in percent/cm**3.cm:\",G2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_4 pgno:167" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "total number no.of Ni atoms per second is 6.17256e+13\n", - "nickel atoms removed from the Ni/MgO interface is 7.2e-10\n", - "the thickness is 1.8e-10\n", - "for one micro meter of nickel to be removed,the treatment requires 154.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "cin=8.573*10**22;\n", - "dx=0.05;\n", - "d=9*10**-12;\n", - "j=d*cin/dx;\n", - "A=2*2;\n", - "tn=A*j;\n", - "print \"total number no.of Ni atoms per second is \",tn\n", - "nm=tn/(8.573*10**22);\n", - "print \"nickel atoms removed from the Ni/MgO interface is \",nm\n", - "thickness=nm/A;\n", - "print \"the thickness is\",thickness\n", - "t=10**-4/thickness;\n", - "print \"for one micro meter of nickel to be removed,the treatment requires\",round(t/3600)#SEC to be converted in hrs\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_5 pgno:171" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Minimum thickness of the membrane of Natoms in cm 0.013\n", - "Minimum thickness of the membrane of Hatoms in cm 0.073\n" - ] - } - ], - "source": [ - "from math import pi,log,exp\n", - "# Initialisation of Variables\n", - "N=1;#N0. of atoms on one side of iron bar\n", - "H=1;#No. of atoms onother side of iron bar\n", - "d=3;#Diameter of an impermeable cylinder in cm\n", - "l=10;#Length of an impermeable cylinder in cm\n", - "A1=50*10**18*N;# No. of gaseous Atoms per cm**3 on one side \n", - "A2=50*10**18*H;#No. of gaseous Atom per cm**3 on one side\n", - "B1=1*10**18*N;#No. of gaseous atoms per cm**3 on another side\n", - "B2=1*10**18*H;#No. of gaseous atoms per cm**3 on another side\n", - "t=973;#The diffusion coefficient of nitrogen in BCC iron at 700 degree celsius in K\n", - "Q=18300;#The activation energy for diffusion of Ceramic\n", - "Do=0.0047;#The pre-exponential term of ceramic\n", - "R=1.987;#Gas constant in cal/mol.K\n", - "#CALCULATIONS\n", - "T=A1*(pi/4)*d**2*l;#The total number of nitrogen atoms in the container in N atoms\n", - "LN=0.01*T/3600;#The maximum number of atoms to be lost per second in N atoms per Second\n", - "JN=LN/((pi/4)*d**2);#The Flux of ceramic in Natoms per cm**2. sec.\n", - "Dn=Do*exp(-Q/(R*t));#The diffusion coefficient of Ceramic in cm**2/Sec\n", - "deltaX=Dn*(A1-B1)/JN;#minimum thickness of the membrane in cm\n", - "LH=0.90*T/3600;#Hydrogen atom loss per sec.\n", - "JH=LH/((pi/4)*d**2);#The Flux of ceramic in Hatoms per cm**2. sec.\n", - "Dh=Do*exp(-Q/(R*t));#The diffusion coeficient of Ceramic in cm**2/Sec\n", - "deltaX2=((1.86*10**-4)*(A2-B2))/JH;#Minimum thickness of the membrane in cm\n", - "print \"Minimum thickness of the membrane of Natoms in cm\", round(deltaX,3)\n", - "print \"Minimum thickness of the membrane of Hatoms in cm\",round(deltaX2,3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_6 pgno:174" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The number of tungsten atoms per cm**3: 6.30824936432e+22\n", - "The number of thorium atoms per cm**3: 6.30824936432e+20\n", - "The concentration gradient of Tungsten in atoms/cm**3.cm: -6.30824936432e+22\n", - "The diffusion coeficient of Tungsten in cm**2/Sec: 2.89066552915e-12\n", - "Volume Diffusion in Th atoms/cm**2.sec.: 1.82350389868e+11\n", - "The diffusion coeficient of Tungsten in cm**2/Sec: 1.64051460984e-09\n", - "Grain boundry Diffusion in Th atoms/cm**2.sec.: 1.03487752447e+14\n", - "The Surface diffusion coeficient of Tungsten in cm**2/Sec: 1.93723957013\n", - "Surface Diffusion in Th atoms/cm**2.sec.: 1.22205902868e+15\n" - ] - } - ], - "source": [ - "from math import exp\n", - "# Initialisation of Variables\n", - "n=2;#no of atoms/ cell in BCC Tungsten\n", - "a0=3.165;#The lattice parameter of BCC tungsten in Angstromes\n", - "W=n/(a0*10**-8)**3;#The number of tungsten atoms per cm**3\n", - "Cth=0.01*W;#The number of thorium atoms per cm**3\n", - "Cg=-Cth/0.01;#The concentration gradient of Tungsten in atoms/cm**3.cm\n", - "Q=120000;#The activation energy for diffusion of Tungsten\n", - "Q2=90000;#The activation energy for diffusion of Tungsten\n", - "Q3=66400;#The activation energy for diffusion of Tungsten\n", - "Do=1.0;#The pre-exponential term of Tungsten\n", - "Do2=0.74;#The pre-exponential term of Tungsten\n", - "Do3=0.47;#The pre-exponential term of Tungsten\n", - "R=1.987;#Gas constant in cal/mol.K\n", - "t=2273;#The diffusion coefficient of nitrogen in BCC iron at 2000 degree celsius in K\n", - "#CALCULATIONS\n", - "D1=Do*exp(-Q/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", - "J1=-D1*Cg;#Volume Diffusion in Th atoms/cm**2.sec.\n", - "D2=Do2*exp(-Q2/(R*t));#The diffusion coeficient of Tungsten in cm**2/Sec\n", - "J2=-D2*Cg;#Grain boundary Diffusion in Th atoms/cm**2.sec.\n", - "D3=0.47*exp(-66400/(1.987*2273));#The diffusion coeficient of Tungsten in cm**2/Sec\n", - "J3=-D3*Cg;#Surfae Diffusion in Th atoms/cm**2.sec.\n", - "\n", - "print \"The number of tungsten atoms per cm**3:\",W\n", - "print \"The number of thorium atoms per cm**3:\",Cth\n", - "print \"The concentration gradient of Tungsten in atoms/cm**3.cm:\",Cg\n", - "print \"The diffusion coeficient of Tungsten in cm**2/Sec:\",D1\n", - "print \"Volume Diffusion in Th atoms/cm**2.sec.:\",J1\n", - "print \"The diffusion coeficient of Tungsten in cm**2/Sec:\",D2\n", - "print \"Grain boundry Diffusion in Th atoms/cm**2.sec.:\",J2\n", - "print \"The Surface diffusion coeficient of Tungsten in cm**2/Sec:\",D3*10**7\n", - "print \"Surface Diffusion in Th atoms/cm**2.sec.:\",J3/10\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_7 pgno:178" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the combution temperatures are [ 39.09194444 14.38111111 5.29041667 1.94625 ]\n" - ] - } - ], - "source": [ - "import numpy\n", - "from math import exp\n", - "T=numpy.array([1173, 1273, 1373, 1473])#kelvins\n", - "t=numpy.array([0, 0, 0, 0])\n", - "#in K\n", - "t[0]=0.0861/exp(-16558/T[0])\n", - "t[1]=0.0861/exp(-16558/T[1])\n", - "t[2]=0.0861/exp(-16558/T[2])\n", - "t[3]=0.0861/exp(-16558/T[3])\n", - "print \"the combution temperatures are\",(0.5*t/3600)\n", - "#the difference in asnwer is due to round off error\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_8 pgno:180" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade: 3.2993917076\n", - "The cost of carburizing per Part of steel rods at 900 degree centigrade 20\n", - "The cost of carburizing per Part of steel rods at 1000 degree centigrade 9.9\n" - ] - } - ], - "source": [ - "from math import exp\n", - "# Initialisation of Variables\n", - "H=10;#Required time to successfully carburize a batch of 500 steel gears\n", - "t1=1173;#Temperature at carburizing a batch of 500 steel gears in K\n", - "t2=1273;#Temperature at carburizing a batch of 500 steel gears in K\n", - "Q=32900;#The activation energy for diffusion of BCC steel\n", - "R=1.987;#Gas constant in cal/mol.K\n", - "c1=1000;#cost per hour to operate the carburizing furnace at 900\u0002degree centigrades\n", - "c2=1500;#Cost per hour to operate the carburizing furnace at 1000 degree centigrade\n", - "H2=(exp(-Q /(R*t1))*H*3600)/exp(-Q /(R*t2));# Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade\n", - "Cp1=c1*H/500;#The cost per Part of steel rods at 900 degree centigrade\n", - "Cv=(c2*3.299)/500;#The cost per Part of steel rods at 1000 degree centigrade\n", - "print \"Time requried to successfully carburize a batch of 500 steel gears at 1000 degree centigrade:\",H2/3600\n", - "print \"The cost of carburizing per Part of steel rods at 900 degree centigrade\",Cp1\n", - "print \"The cost of carburizing per Part of steel rods at 1000 degree centigrade\",round(Cv,2)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one.ipynb deleted file mode 100755 index 99ecc7a7..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one.ipynb +++ /dev/null @@ -1,292 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6 Mechanical Properties : part one" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_1 pgno:207" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value in psi is= 4992.60678261\n", - "The value of epselon 0.0005\n" - ] - } - ], - "source": [ - "from math import pi\n", - "F=1000#in lb\n", - "Ao=(pi/4)*(0.505)**2#in**2\n", - "rho=F/Ao\n", - "delta_I=0.001#in\n", - "I_o=2#in\n", - "e=delta_I/I_o\n", - "print\"The value in psi is=\",rho\n", - "print\"The value of epselon\",e" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_2 pgno:207" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1 The required crosssectional area of the rod in in^2:\n", - "1.1283791671 Diameter of rod in in:\n", - "0.000625 The maximum length of the rod in in:\n", - "100.0 The minimum strain allowed on rod:\n", - "2 The minimum cross-sectional area in in^2:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "F=45000;#Force applied on an aluminum rod in lb\n", - "e=25000;#the maximum allowable stress on the rod in psi\n", - "l2=150;#the minimum length of the rod in in\n", - "e1=0.0025;#The strain appiled on rod\n", - "sigma=16670;#Stress applied on rod in psi\n", - "L=0.25;#The maximum allowable elastic deformation in in\n", - "from math import sqrt,pi\n", - "#CALCULATIONS\n", - "Ao1=F/e;#The required crosssectional area of the rod\n", - "d=sqrt((Ao1*4)/pi);#Diameter of rod in in\n", - "l1=e1*L;#The maximum length of the rod in in\n", - "e2=L/e1;#The minimum strain allowed on rod\n", - "Ao2=F/sigma;#The minimum cross-sectional area in in^2\n", - "print Ao1,\"The required crosssectional area of the rod in in^2:\"\n", - "print d,\"Diameter of rod in in:\"\n", - "print l1,\"The maximum length of the rod in in:\"\n", - "print e2,\"The minimum strain allowed on rod:\"\n", - "print Ao2,\"The minimum cross-sectional area in in^2:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_3 pgno:213" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "10000000.0 Modulus of elasticity of aluminum alloy from table 6-1:\n", - "50.15 The length after deformation of bar in in\n", - "0.003 Strain applied of aluminum alloy:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "sigma1=35000;#Stress applied of aluminum alloy in psi from table 6-1\n", - "e1=0.0035;##Strain applied of aluminum alloy from table 6-1\n", - "sigma2=30000;#Stress applied of aluminum alloy in psi\n", - "Lo=50;#initial length of aluminum alloy\n", - "#CALCULATIONS\n", - "E=sigma1/e1;#Modulus of elasticity of aluminum alloy\n", - "e2=sigma2/E;#Strain applied of aluminum alloy\n", - "L=Lo+(e2*Lo);#The length after deformation of bar in in\n", - "print E,\"Modulus of elasticity of aluminum alloy from table 6-1:\"\n", - "print L,\"The length after deformation of bar in in\"\n", - "print e2,\"Strain applied of aluminum alloy:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4 pgno:214" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "9.75 Percentage of Elongation:\n", - "37.9 Percentage of Reduction in area:\n", - "The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Lf=2.195;#Final length after failure\n", - "d1=0.505;#Diameter of alluminum alloy in in\n", - "d2=0.398;#Final diameter of alluminum alloy in in\n", - "Lo=2;#Initial length of alluminum alloy \n", - "from math import pi\n", - "#CALCULATIONS\n", - "A0=(pi/4)*d1**2;#Area of original of alluminum alloy\n", - "Af=(pi/4)*d2**2;#Area of final of alluminum alloy\n", - "E=((Lf-Lo)/Lo)*100;#Percentage of Elongation \n", - "R=((A0-Af)/A0)*100;#Percentage of Reduction in area\n", - "print E,\"Percentage of Elongation:\"\n", - "print round(R,1),\"Percentage of Reduction in area:\"\n", - "print\"The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_5 pgno:217" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "39940.8542609 Engineering stress in psiAt the tensile or maximum load\n", - "41237.025201 True stress in psi At the tensile or maximum load\n", - "0.06 Engineering strain At the tensile or maximum load\n", - "0.058268908124 True strain At the tensile or maximum load\n", - "37943.8115478 Engineering stress At fracture:\n", - "61088.2335041 True stress At fracture\n", - "0.1025 Engineering strain At fracture:\n", - "0.476 True strain At fracture:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "F=8000.;#.......#Load applied for the aluminum alloy in lb\n", - "F2=7600.;#......#Load applied for the aluminum alloy in lb at fracture\n", - "dt1=0.505;#.......#diameter of for the aluminum alloy in in\n", - "dt2=0.497;#.......#The diameter at maximum load\n", - "Lt=2.120;#..........#Final length at maxium load\n", - "Lot=2.;#.............#Initial length of alluminum alloy\n", - "Ff=7600.;#.........#Load applied for the aluminum alloy after fracture in lb\n", - "df=0.398;#.......#The diameter at maximum load after fracture\n", - "Lf=0.205;#.......#Final length at fracture\n", - "from math import pi,log\n", - "#CALCULATIONS\n", - "Es=F/((pi/4)*dt1**2);#.....#Engineering stress in psiAt the tensile or maximum load\n", - "Ts=F/((pi/4)*dt2**2);#.....#True stress in psi At the tensile or maximum load\n", - "Ee=(Lt-Lot)/Lot;#........#Engineering strain At the tensile or maximum load\n", - "Te=log(Lt/Lot);#........#True strain At the tensile or maximum load\n", - "Es2=F2/((pi/4)*dt1**2);#......##Engineering stress At fracture:\n", - "Ts2=F2/((pi/4)*df**2);#......#True stress At fracture:\n", - "Ee2=Lf/Lot;#..........#Engineering strain At fracture:\n", - "Te2=log(((pi/4)*dt1**2)/((pi/4)*df**2));#.......#True strain At fracture:\n", - "print Es,\"Engineering stress in psiAt the tensile or maximum load\"\n", - "print Ts,\"True stress in psi At the tensile or maximum load\"\n", - "print Ee,\"Engineering strain At the tensile or maximum load\"\n", - "print Te,\"True strain At the tensile or maximum load\"\n", - "print Es2,\"Engineering stress At fracture:\"\n", - "print Ts2,\"True stress At fracture\"\n", - "print Ee2,\"Engineering strain At fracture:\"\n", - "print round(Te2,3),\"True strain At fracture:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_6 pgno:221" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "421.875 The force required to fracture the material in lb:\n", - "0.0278 The deflection of the sample at fracture in in\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Fs=45000;#.......#The flexural strength of a composite material in psi\n", - "Fm=18*10**6;#........#The flexural modulus of composite material in psi\n", - "w=0.5;#.......#wide of sample in in\n", - "h=0.375;#......#Height of sample in in\n", - "l=5;#..........#Length of sample in in\n", - "#CALCULATIONS\n", - "F=Fs*2*w*h**2/(3*l);#......#The force required to fracture the material in lb\n", - "delta=(l**3)*F/(Fm*4*w*h**3);#.......#The deflection of the sample at fracture \n", - "print F,\"The force required to fracture the material in lb:\"\n", - "print round(delta,4),\"The deflection of the sample at fracture in in\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_1.ipynb deleted file mode 100755 index 99ecc7a7..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_1.ipynb +++ /dev/null @@ -1,292 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6 Mechanical Properties : part one" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_1 pgno:207" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value in psi is= 4992.60678261\n", - "The value of epselon 0.0005\n" - ] - } - ], - "source": [ - "from math import pi\n", - "F=1000#in lb\n", - "Ao=(pi/4)*(0.505)**2#in**2\n", - "rho=F/Ao\n", - "delta_I=0.001#in\n", - "I_o=2#in\n", - "e=delta_I/I_o\n", - "print\"The value in psi is=\",rho\n", - "print\"The value of epselon\",e" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_2 pgno:207" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1 The required crosssectional area of the rod in in^2:\n", - "1.1283791671 Diameter of rod in in:\n", - "0.000625 The maximum length of the rod in in:\n", - "100.0 The minimum strain allowed on rod:\n", - "2 The minimum cross-sectional area in in^2:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "F=45000;#Force applied on an aluminum rod in lb\n", - "e=25000;#the maximum allowable stress on the rod in psi\n", - "l2=150;#the minimum length of the rod in in\n", - "e1=0.0025;#The strain appiled on rod\n", - "sigma=16670;#Stress applied on rod in psi\n", - "L=0.25;#The maximum allowable elastic deformation in in\n", - "from math import sqrt,pi\n", - "#CALCULATIONS\n", - "Ao1=F/e;#The required crosssectional area of the rod\n", - "d=sqrt((Ao1*4)/pi);#Diameter of rod in in\n", - "l1=e1*L;#The maximum length of the rod in in\n", - "e2=L/e1;#The minimum strain allowed on rod\n", - "Ao2=F/sigma;#The minimum cross-sectional area in in^2\n", - "print Ao1,\"The required crosssectional area of the rod in in^2:\"\n", - "print d,\"Diameter of rod in in:\"\n", - "print l1,\"The maximum length of the rod in in:\"\n", - "print e2,\"The minimum strain allowed on rod:\"\n", - "print Ao2,\"The minimum cross-sectional area in in^2:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_3 pgno:213" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "10000000.0 Modulus of elasticity of aluminum alloy from table 6-1:\n", - "50.15 The length after deformation of bar in in\n", - "0.003 Strain applied of aluminum alloy:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "sigma1=35000;#Stress applied of aluminum alloy in psi from table 6-1\n", - "e1=0.0035;##Strain applied of aluminum alloy from table 6-1\n", - "sigma2=30000;#Stress applied of aluminum alloy in psi\n", - "Lo=50;#initial length of aluminum alloy\n", - "#CALCULATIONS\n", - "E=sigma1/e1;#Modulus of elasticity of aluminum alloy\n", - "e2=sigma2/E;#Strain applied of aluminum alloy\n", - "L=Lo+(e2*Lo);#The length after deformation of bar in in\n", - "print E,\"Modulus of elasticity of aluminum alloy from table 6-1:\"\n", - "print L,\"The length after deformation of bar in in\"\n", - "print e2,\"Strain applied of aluminum alloy:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4 pgno:214" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "9.75 Percentage of Elongation:\n", - "37.9 Percentage of Reduction in area:\n", - "The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Lf=2.195;#Final length after failure\n", - "d1=0.505;#Diameter of alluminum alloy in in\n", - "d2=0.398;#Final diameter of alluminum alloy in in\n", - "Lo=2;#Initial length of alluminum alloy \n", - "from math import pi\n", - "#CALCULATIONS\n", - "A0=(pi/4)*d1**2;#Area of original of alluminum alloy\n", - "Af=(pi/4)*d2**2;#Area of final of alluminum alloy\n", - "E=((Lf-Lo)/Lo)*100;#Percentage of Elongation \n", - "R=((A0-Af)/A0)*100;#Percentage of Reduction in area\n", - "print E,\"Percentage of Elongation:\"\n", - "print round(R,1),\"Percentage of Reduction in area:\"\n", - "print\"The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_5 pgno:217" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "39940.8542609 Engineering stress in psiAt the tensile or maximum load\n", - "41237.025201 True stress in psi At the tensile or maximum load\n", - "0.06 Engineering strain At the tensile or maximum load\n", - "0.058268908124 True strain At the tensile or maximum load\n", - "37943.8115478 Engineering stress At fracture:\n", - "61088.2335041 True stress At fracture\n", - "0.1025 Engineering strain At fracture:\n", - "0.476 True strain At fracture:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "F=8000.;#.......#Load applied for the aluminum alloy in lb\n", - "F2=7600.;#......#Load applied for the aluminum alloy in lb at fracture\n", - "dt1=0.505;#.......#diameter of for the aluminum alloy in in\n", - "dt2=0.497;#.......#The diameter at maximum load\n", - "Lt=2.120;#..........#Final length at maxium load\n", - "Lot=2.;#.............#Initial length of alluminum alloy\n", - "Ff=7600.;#.........#Load applied for the aluminum alloy after fracture in lb\n", - "df=0.398;#.......#The diameter at maximum load after fracture\n", - "Lf=0.205;#.......#Final length at fracture\n", - "from math import pi,log\n", - "#CALCULATIONS\n", - "Es=F/((pi/4)*dt1**2);#.....#Engineering stress in psiAt the tensile or maximum load\n", - "Ts=F/((pi/4)*dt2**2);#.....#True stress in psi At the tensile or maximum load\n", - "Ee=(Lt-Lot)/Lot;#........#Engineering strain At the tensile or maximum load\n", - "Te=log(Lt/Lot);#........#True strain At the tensile or maximum load\n", - "Es2=F2/((pi/4)*dt1**2);#......##Engineering stress At fracture:\n", - "Ts2=F2/((pi/4)*df**2);#......#True stress At fracture:\n", - "Ee2=Lf/Lot;#..........#Engineering strain At fracture:\n", - "Te2=log(((pi/4)*dt1**2)/((pi/4)*df**2));#.......#True strain At fracture:\n", - "print Es,\"Engineering stress in psiAt the tensile or maximum load\"\n", - "print Ts,\"True stress in psi At the tensile or maximum load\"\n", - "print Ee,\"Engineering strain At the tensile or maximum load\"\n", - "print Te,\"True strain At the tensile or maximum load\"\n", - "print Es2,\"Engineering stress At fracture:\"\n", - "print Ts2,\"True stress At fracture\"\n", - "print Ee2,\"Engineering strain At fracture:\"\n", - "print round(Te2,3),\"True strain At fracture:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_6 pgno:221" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "421.875 The force required to fracture the material in lb:\n", - "0.0278 The deflection of the sample at fracture in in\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Fs=45000;#.......#The flexural strength of a composite material in psi\n", - "Fm=18*10**6;#........#The flexural modulus of composite material in psi\n", - "w=0.5;#.......#wide of sample in in\n", - "h=0.375;#......#Height of sample in in\n", - "l=5;#..........#Length of sample in in\n", - "#CALCULATIONS\n", - "F=Fs*2*w*h**2/(3*l);#......#The force required to fracture the material in lb\n", - "delta=(l**3)*F/(Fm*4*w*h**3);#.......#The deflection of the sample at fracture \n", - "print F,\"The force required to fracture the material in lb:\"\n", - "print round(delta,4),\"The deflection of the sample at fracture in in\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_2.ipynb deleted file mode 100755 index a9f18f16..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_2.ipynb +++ /dev/null @@ -1,292 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6 Mechanical Properties : part one" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_1 pgno:207" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value in psi is= 4992.60678261\n", - "The value of epselon 0.0005\n" - ] - } - ], - "source": [ - "from math import pi\n", - "F=1000#in lb\n", - "Ao=(pi/4)*(0.505)**2#in**2\n", - "rho=F/Ao\n", - "delta_I=0.001#in\n", - "I_o=2#in\n", - "e=delta_I/I_o\n", - "print\"The value in psi is=\",rho\n", - "print\"The value of epselon\",e" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_2 pgno:207" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The required crosssectional area of the rod in in^2: 1\n", - "Diameter of rod in in: 1.1283791671\n", - "The maximum length of the rod in in: 0.000625\n", - "The minimum strain allowed on rod: 100.0\n", - "The minimum cross-sectional area in in^2: 2\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "F=45000;#Force applied on an aluminum rod in lb\n", - "e=25000;#the maximum allowable stress on the rod in psi\n", - "l2=150;#the minimum length of the rod in in\n", - "e1=0.0025;#The strain appiled on rod\n", - "sigma=16670;#Stress applied on rod in psi\n", - "L=0.25;#The maximum allowable elastic deformation in in\n", - "from math import sqrt,pi\n", - "#CALCULATIONS\n", - "Ao1=F/e;#The required crosssectional area of the rod\n", - "d=sqrt((Ao1*4)/pi);#Diameter of rod in in\n", - "l1=e1*L;#The maximum length of the rod in in\n", - "e2=L/e1;#The minimum strain allowed on rod\n", - "Ao2=F/sigma;#The minimum cross-sectional area in in^2\n", - "print \"The required crosssectional area of the rod in in^2:\",Ao1\n", - "print \"Diameter of rod in in:\",d\n", - "print \"The maximum length of the rod in in:\",l1\n", - "print \"The minimum strain allowed on rod:\",e2\n", - "print \"The minimum cross-sectional area in in^2:\",Ao2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_3 pgno:213" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Modulus of elasticity of aluminum alloy from table 6-1: 10000000.0\n", - "The length after deformation of bar in in 50.15\n", - "Strain applied of aluminum alloy: 0.003\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "sigma1=35000;#Stress applied of aluminum alloy in psi from table 6-1\n", - "e1=0.0035;##Strain applied of aluminum alloy from table 6-1\n", - "sigma2=30000;#Stress applied of aluminum alloy in psi\n", - "Lo=50;#initial length of aluminum alloy\n", - "#CALCULATIONS\n", - "E=sigma1/e1;#Modulus of elasticity of aluminum alloy\n", - "e2=sigma2/E;#Strain applied of aluminum alloy\n", - "L=Lo+(e2*Lo);#The length after deformation of bar in in\n", - "print \"Modulus of elasticity of aluminum alloy from table 6-1:\",E\n", - "print \"The length after deformation of bar in in\",L\n", - "print \"Strain applied of aluminum alloy:\",e2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4 pgno:214" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Percentage of Elongation: 9.75\n", - "Percentage of Reduction in area: 37.9\n", - "The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Lf=2.195;#Final length after failure\n", - "d1=0.505;#Diameter of alluminum alloy in in\n", - "d2=0.398;#Final diameter of alluminum alloy in in\n", - "Lo=2;#Initial length of alluminum alloy \n", - "from math import pi\n", - "#CALCULATIONS\n", - "A0=(pi/4)*d1**2;#Area of original of alluminum alloy\n", - "Af=(pi/4)*d2**2;#Area of final of alluminum alloy\n", - "E=((Lf-Lo)/Lo)*100;#Percentage of Elongation \n", - "R=((A0-Af)/A0)*100;#Percentage of Reduction in area\n", - "print \"Percentage of Elongation:\",E\n", - "print \"Percentage of Reduction in area:\",round(R,1)\n", - "print\"The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_5 pgno:217" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Engineering stress in psiAt the tensile or maximum load 39940.8542609\n", - "True stress in psi At the tensile or maximum load 41237.025201\n", - "Engineering strain At the tensile or maximum load 0.06\n", - "True strain At the tensile or maximum load 0.058268908124\n", - "Engineering stress At fracture: 37943.8115478\n", - "True stress At fracture 61088.2335041\n", - "Engineering strain At fracture: 0.1025\n", - "True strain At fracture: 0.476\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "F=8000.;#.......#Load applied for the aluminum alloy in lb\n", - "F2=7600.;#......#Load applied for the aluminum alloy in lb at fracture\n", - "dt1=0.505;#.......#diameter of for the aluminum alloy in in\n", - "dt2=0.497;#.......#The diameter at maximum load\n", - "Lt=2.120;#..........#Final length at maxium load\n", - "Lot=2.;#.............#Initial length of alluminum alloy\n", - "Ff=7600.;#.........#Load applied for the aluminum alloy after fracture in lb\n", - "df=0.398;#.......#The diameter at maximum load after fracture\n", - "Lf=0.205;#.......#Final length at fracture\n", - "from math import pi,log\n", - "#CALCULATIONS\n", - "Es=F/((pi/4)*dt1**2);#.....#Engineering stress in psiAt the tensile or maximum load\n", - "Ts=F/((pi/4)*dt2**2);#.....#True stress in psi At the tensile or maximum load\n", - "Ee=(Lt-Lot)/Lot;#........#Engineering strain At the tensile or maximum load\n", - "Te=log(Lt/Lot);#........#True strain At the tensile or maximum load\n", - "Es2=F2/((pi/4)*dt1**2);#......##Engineering stress At fracture:\n", - "Ts2=F2/((pi/4)*df**2);#......#True stress At fracture:\n", - "Ee2=Lf/Lot;#..........#Engineering strain At fracture:\n", - "Te2=log(((pi/4)*dt1**2)/((pi/4)*df**2));#.......#True strain At fracture:\n", - "print \"Engineering stress in psiAt the tensile or maximum load\",Es\n", - "print \"True stress in psi At the tensile or maximum load\",Ts\n", - "print \"Engineering strain At the tensile or maximum load\",Ee\n", - "print \"True strain At the tensile or maximum load\",Te\n", - "print \"Engineering stress At fracture:\",Es2\n", - "print \"True stress At fracture\",Ts2\n", - "print \"Engineering strain At fracture:\",Ee2\n", - "print \"True strain At fracture:\",round(Te2,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_6 pgno:221" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The force required to fracture the material in lb: 421.875\n", - "The deflection of the sample at fracture in in 0.0278\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Fs=45000;#.......#The flexural strength of a composite material in psi\n", - "Fm=18*10**6;#........#The flexural modulus of composite material in psi\n", - "w=0.5;#.......#wide of sample in in\n", - "h=0.375;#......#Height of sample in in\n", - "l=5;#..........#Length of sample in in\n", - "#CALCULATIONS\n", - "F=Fs*2*w*h**2/(3*l);#......#The force required to fracture the material in lb\n", - "delta=(l**3)*F/(Fm*4*w*h**3);#.......#The deflection of the sample at fracture \n", - "print \"The force required to fracture the material in lb:\",F\n", - "print \"The deflection of the sample at fracture in in\",round(delta,4)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_3.ipynb deleted file mode 100755 index a9f18f16..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_6_Mechanical_Properties_part_one_3.ipynb +++ /dev/null @@ -1,292 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6 Mechanical Properties : part one" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_1 pgno:207" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value in psi is= 4992.60678261\n", - "The value of epselon 0.0005\n" - ] - } - ], - "source": [ - "from math import pi\n", - "F=1000#in lb\n", - "Ao=(pi/4)*(0.505)**2#in**2\n", - "rho=F/Ao\n", - "delta_I=0.001#in\n", - "I_o=2#in\n", - "e=delta_I/I_o\n", - "print\"The value in psi is=\",rho\n", - "print\"The value of epselon\",e" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_2 pgno:207" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The required crosssectional area of the rod in in^2: 1\n", - "Diameter of rod in in: 1.1283791671\n", - "The maximum length of the rod in in: 0.000625\n", - "The minimum strain allowed on rod: 100.0\n", - "The minimum cross-sectional area in in^2: 2\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "F=45000;#Force applied on an aluminum rod in lb\n", - "e=25000;#the maximum allowable stress on the rod in psi\n", - "l2=150;#the minimum length of the rod in in\n", - "e1=0.0025;#The strain appiled on rod\n", - "sigma=16670;#Stress applied on rod in psi\n", - "L=0.25;#The maximum allowable elastic deformation in in\n", - "from math import sqrt,pi\n", - "#CALCULATIONS\n", - "Ao1=F/e;#The required crosssectional area of the rod\n", - "d=sqrt((Ao1*4)/pi);#Diameter of rod in in\n", - "l1=e1*L;#The maximum length of the rod in in\n", - "e2=L/e1;#The minimum strain allowed on rod\n", - "Ao2=F/sigma;#The minimum cross-sectional area in in^2\n", - "print \"The required crosssectional area of the rod in in^2:\",Ao1\n", - "print \"Diameter of rod in in:\",d\n", - "print \"The maximum length of the rod in in:\",l1\n", - "print \"The minimum strain allowed on rod:\",e2\n", - "print \"The minimum cross-sectional area in in^2:\",Ao2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_3 pgno:213" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Modulus of elasticity of aluminum alloy from table 6-1: 10000000.0\n", - "The length after deformation of bar in in 50.15\n", - "Strain applied of aluminum alloy: 0.003\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "sigma1=35000;#Stress applied of aluminum alloy in psi from table 6-1\n", - "e1=0.0035;##Strain applied of aluminum alloy from table 6-1\n", - "sigma2=30000;#Stress applied of aluminum alloy in psi\n", - "Lo=50;#initial length of aluminum alloy\n", - "#CALCULATIONS\n", - "E=sigma1/e1;#Modulus of elasticity of aluminum alloy\n", - "e2=sigma2/E;#Strain applied of aluminum alloy\n", - "L=Lo+(e2*Lo);#The length after deformation of bar in in\n", - "print \"Modulus of elasticity of aluminum alloy from table 6-1:\",E\n", - "print \"The length after deformation of bar in in\",L\n", - "print \"Strain applied of aluminum alloy:\",e2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4 pgno:214" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Percentage of Elongation: 9.75\n", - "Percentage of Reduction in area: 37.9\n", - "The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Lf=2.195;#Final length after failure\n", - "d1=0.505;#Diameter of alluminum alloy in in\n", - "d2=0.398;#Final diameter of alluminum alloy in in\n", - "Lo=2;#Initial length of alluminum alloy \n", - "from math import pi\n", - "#CALCULATIONS\n", - "A0=(pi/4)*d1**2;#Area of original of alluminum alloy\n", - "Af=(pi/4)*d2**2;#Area of final of alluminum alloy\n", - "E=((Lf-Lo)/Lo)*100;#Percentage of Elongation \n", - "R=((A0-Af)/A0)*100;#Percentage of Reduction in area\n", - "print \"Percentage of Elongation:\",E\n", - "print \"Percentage of Reduction in area:\",round(R,1)\n", - "print\"The final length is less than 2.205 in because, after fracture, the elastic strain is recovered.\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_5 pgno:217" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Engineering stress in psiAt the tensile or maximum load 39940.8542609\n", - "True stress in psi At the tensile or maximum load 41237.025201\n", - "Engineering strain At the tensile or maximum load 0.06\n", - "True strain At the tensile or maximum load 0.058268908124\n", - "Engineering stress At fracture: 37943.8115478\n", - "True stress At fracture 61088.2335041\n", - "Engineering strain At fracture: 0.1025\n", - "True strain At fracture: 0.476\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "F=8000.;#.......#Load applied for the aluminum alloy in lb\n", - "F2=7600.;#......#Load applied for the aluminum alloy in lb at fracture\n", - "dt1=0.505;#.......#diameter of for the aluminum alloy in in\n", - "dt2=0.497;#.......#The diameter at maximum load\n", - "Lt=2.120;#..........#Final length at maxium load\n", - "Lot=2.;#.............#Initial length of alluminum alloy\n", - "Ff=7600.;#.........#Load applied for the aluminum alloy after fracture in lb\n", - "df=0.398;#.......#The diameter at maximum load after fracture\n", - "Lf=0.205;#.......#Final length at fracture\n", - "from math import pi,log\n", - "#CALCULATIONS\n", - "Es=F/((pi/4)*dt1**2);#.....#Engineering stress in psiAt the tensile or maximum load\n", - "Ts=F/((pi/4)*dt2**2);#.....#True stress in psi At the tensile or maximum load\n", - "Ee=(Lt-Lot)/Lot;#........#Engineering strain At the tensile or maximum load\n", - "Te=log(Lt/Lot);#........#True strain At the tensile or maximum load\n", - "Es2=F2/((pi/4)*dt1**2);#......##Engineering stress At fracture:\n", - "Ts2=F2/((pi/4)*df**2);#......#True stress At fracture:\n", - "Ee2=Lf/Lot;#..........#Engineering strain At fracture:\n", - "Te2=log(((pi/4)*dt1**2)/((pi/4)*df**2));#.......#True strain At fracture:\n", - "print \"Engineering stress in psiAt the tensile or maximum load\",Es\n", - "print \"True stress in psi At the tensile or maximum load\",Ts\n", - "print \"Engineering strain At the tensile or maximum load\",Ee\n", - "print \"True strain At the tensile or maximum load\",Te\n", - "print \"Engineering stress At fracture:\",Es2\n", - "print \"True stress At fracture\",Ts2\n", - "print \"Engineering strain At fracture:\",Ee2\n", - "print \"True strain At fracture:\",round(Te2,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_6 pgno:221" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The force required to fracture the material in lb: 421.875\n", - "The deflection of the sample at fracture in in 0.0278\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "Fs=45000;#.......#The flexural strength of a composite material in psi\n", - "Fm=18*10**6;#........#The flexural modulus of composite material in psi\n", - "w=0.5;#.......#wide of sample in in\n", - "h=0.375;#......#Height of sample in in\n", - "l=5;#..........#Length of sample in in\n", - "#CALCULATIONS\n", - "F=Fs*2*w*h**2/(3*l);#......#The force required to fracture the material in lb\n", - "delta=(l**3)*F/(Fm*4*w*h**3);#.......#The deflection of the sample at fracture \n", - "print \"The force required to fracture the material in lb:\",F\n", - "print \"The deflection of the sample at fracture in in\",round(delta,4)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two.ipynb deleted file mode 100755 index d709254e..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two.ipynb +++ /dev/null @@ -1,245 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 7 Mechanical Properties part two" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_1 pgno:251" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.8 Depth of crank that will propagate in the steel in in:\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "f=1.12;#Geometry factor for the specimen and flaw\n", - "sigma=45000.;#Applied stress on Steel in psi\n", - "K=80000.;#The stress intensity factor\n", - "#CALCULATIONS\n", - "a=(K/(f*sigma))**2/pi;#Depth of crank in in\n", - "print round(a,1),\"Depth of crank that will propagate in the steel in in:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_2 pgno:253" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "706.0 The radius of the crack tip in Angstroms\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "T=60000.;#Tensile strength Of Sialon (acronym for silicon aluminum oxynitride) in psi\n", - "sigma=500.;#The stress at which the part unexpectedly fails in psi\n", - "a=0.01;#Depth of thin crack in in\n", - "#CALCULATIONS\n", - "r=a/(T/(2*sigma))**2;#The radius of the crack tip in in\n", - "print round(r*2.54*10**8),\"The radius of the crack tip in Angstroms\"\n", - "#difference in answer is due to erronous caluctions\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_3 pgno:254" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2.63 THickness of ceramic :\n" - ] - } - ], - "source": [ - "from math import sqrt,pi\n", - "# Initialisation of Variables\n", - "F=40000;# Maximum Tensile load in lb\n", - "K=9000;#Fracture toughness of Ceramic\n", - "w=3;# plate made of Sialon width \n", - "#CALCULATIONS\n", - "A=F*sqrt(pi)/K;#Area of ceramic\n", - "T=A/w;# Thickness of Ceramic\n", - "print round(T,2),\"THickness of ceramic :\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_8 pgno:263" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "269.4 The characteristic strength of the ceramic in MPa:\n", - "209.8 Expected level of stress that can be supported in MPa:\n" - ] - } - ], - "source": [ - "from math import log,exp\n", - "# Initialisation of Variables\n", - "m=9;#Weibull modulus of an ceramic \n", - "sigma1=250;#The flexural strength in MPa\n", - "F1=0.4;#probability of failure \n", - "F2=0.1;#Expected the probability of failure\n", - "#CALCULATIONS\n", - "sigma2=exp(log(sigma1)-(log(log(1/(1-F1)))/m ));# The characteristic strength of the ceramic\n", - "sigma3=exp((log(log(1/(1-F2)))/m)+log(sigma2));#Expected level of stress that can be supported in MPa\n", - "print round(sigma2,1),\"The characteristic strength of the ceramic in MPa:\"\n", - "print round(sigma3,1),\"Expected level of stress that can be supported in MPa:\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_9 pgno:264" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "3.15 Weibull modulus of ceramic:\n" - ] - } - ], - "source": [ - "from math import log\n", - "# Initialisation of Variables\n", - "Ln1=0.5\n", - "Ln2=-2.0\n", - "\n", - "sigma1=52;#the maximum allowed stress level on ceramic at one point in MP.\n", - "sigma2=23.5;#the maximum allowed stress level on ceramic at another point in MP.\n", - "#CALCULATIONS\n", - "m=(Ln1-Ln2)/(log(sigma1)-log(sigma2));#Weibull modulus of ceramic\n", - "print round(m,2),\"Weibull modulus of ceramic:\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_11 pgno:270" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "4.39 The Diameter of Shaft in in.:\n", - "5.54 The minimum diameter required to prevent failure in in.:\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "N=5.256*10**5;#No. of cycles that the shaft will experience in one year\n", - "F=12500.;#applied load on shaft in lb\n", - "L=96.;#Length of Kliin produced from tool steel in in.\n", - "sigma1=72000.;#the applied stress on Shaft\n", - "f=2.;#Factor of saftey of shaft\n", - "sigma2=sigma1/f;#the maximum allowed stress level\n", - "#CALCULATIONS\n", - "d1=(16*F*L/(sigma1*pi))**(1./3.);#The Diameter of Shaft in in.\n", - "d2=(16*F*L/(sigma2*pi))**(1./3.);#The minimum diameter required to prevent failure\n", - "print round(d1,2),\"The Diameter of Shaft in in.:\"\n", - "print round(d2,2),\"The minimum diameter required to prevent failure in in.:\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_1.ipynb deleted file mode 100755 index d709254e..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_1.ipynb +++ /dev/null @@ -1,245 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 7 Mechanical Properties part two" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_1 pgno:251" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.8 Depth of crank that will propagate in the steel in in:\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "f=1.12;#Geometry factor for the specimen and flaw\n", - "sigma=45000.;#Applied stress on Steel in psi\n", - "K=80000.;#The stress intensity factor\n", - "#CALCULATIONS\n", - "a=(K/(f*sigma))**2/pi;#Depth of crank in in\n", - "print round(a,1),\"Depth of crank that will propagate in the steel in in:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_2 pgno:253" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "706.0 The radius of the crack tip in Angstroms\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "T=60000.;#Tensile strength Of Sialon (acronym for silicon aluminum oxynitride) in psi\n", - "sigma=500.;#The stress at which the part unexpectedly fails in psi\n", - "a=0.01;#Depth of thin crack in in\n", - "#CALCULATIONS\n", - "r=a/(T/(2*sigma))**2;#The radius of the crack tip in in\n", - "print round(r*2.54*10**8),\"The radius of the crack tip in Angstroms\"\n", - "#difference in answer is due to erronous caluctions\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_3 pgno:254" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2.63 THickness of ceramic :\n" - ] - } - ], - "source": [ - "from math import sqrt,pi\n", - "# Initialisation of Variables\n", - "F=40000;# Maximum Tensile load in lb\n", - "K=9000;#Fracture toughness of Ceramic\n", - "w=3;# plate made of Sialon width \n", - "#CALCULATIONS\n", - "A=F*sqrt(pi)/K;#Area of ceramic\n", - "T=A/w;# Thickness of Ceramic\n", - "print round(T,2),\"THickness of ceramic :\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_8 pgno:263" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "269.4 The characteristic strength of the ceramic in MPa:\n", - "209.8 Expected level of stress that can be supported in MPa:\n" - ] - } - ], - "source": [ - "from math import log,exp\n", - "# Initialisation of Variables\n", - "m=9;#Weibull modulus of an ceramic \n", - "sigma1=250;#The flexural strength in MPa\n", - "F1=0.4;#probability of failure \n", - "F2=0.1;#Expected the probability of failure\n", - "#CALCULATIONS\n", - "sigma2=exp(log(sigma1)-(log(log(1/(1-F1)))/m ));# The characteristic strength of the ceramic\n", - "sigma3=exp((log(log(1/(1-F2)))/m)+log(sigma2));#Expected level of stress that can be supported in MPa\n", - "print round(sigma2,1),\"The characteristic strength of the ceramic in MPa:\"\n", - "print round(sigma3,1),\"Expected level of stress that can be supported in MPa:\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_9 pgno:264" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "3.15 Weibull modulus of ceramic:\n" - ] - } - ], - "source": [ - "from math import log\n", - "# Initialisation of Variables\n", - "Ln1=0.5\n", - "Ln2=-2.0\n", - "\n", - "sigma1=52;#the maximum allowed stress level on ceramic at one point in MP.\n", - "sigma2=23.5;#the maximum allowed stress level on ceramic at another point in MP.\n", - "#CALCULATIONS\n", - "m=(Ln1-Ln2)/(log(sigma1)-log(sigma2));#Weibull modulus of ceramic\n", - "print round(m,2),\"Weibull modulus of ceramic:\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_11 pgno:270" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "4.39 The Diameter of Shaft in in.:\n", - "5.54 The minimum diameter required to prevent failure in in.:\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "N=5.256*10**5;#No. of cycles that the shaft will experience in one year\n", - "F=12500.;#applied load on shaft in lb\n", - "L=96.;#Length of Kliin produced from tool steel in in.\n", - "sigma1=72000.;#the applied stress on Shaft\n", - "f=2.;#Factor of saftey of shaft\n", - "sigma2=sigma1/f;#the maximum allowed stress level\n", - "#CALCULATIONS\n", - "d1=(16*F*L/(sigma1*pi))**(1./3.);#The Diameter of Shaft in in.\n", - "d2=(16*F*L/(sigma2*pi))**(1./3.);#The minimum diameter required to prevent failure\n", - "print round(d1,2),\"The Diameter of Shaft in in.:\"\n", - "print round(d2,2),\"The minimum diameter required to prevent failure in in.:\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_2.ipynb deleted file mode 100755 index 481aa53d..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_2.ipynb +++ /dev/null @@ -1,245 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 7 Mechanical Properties part two" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_1 pgno:251" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Depth of crank that will propagate in the steel in: 0.8\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "f=1.12;#Geometry factor for the specimen and flaw\n", - "sigma=45000.;#Applied stress on Steel in psi\n", - "K=80000.;#The stress intensity factor\n", - "#CALCULATIONS\n", - "a=(K/(f*sigma))**2/pi;#Depth of crank in in\n", - "print \"Depth of crank that will propagate in the steel in:\",round(a,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_2 pgno:253" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The radius of the crack tip in Angstroms 706.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "T=60000.;#Tensile strength Of Sialon (acronym for silicon aluminum oxynitride) in psi\n", - "sigma=500.;#The stress at which the part unexpectedly fails in psi\n", - "a=0.01;#Depth of thin crack in in\n", - "#CALCULATIONS\n", - "r=a/(T/(2*sigma))**2;#The radius of the crack tip in in\n", - "print \"The radius of the crack tip in Angstroms\",round(r*2.54*10**8)\n", - "#difference in answer is due to erronous caluctions\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_3 pgno:254" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "THickness of ceramic : 2.63\n" - ] - } - ], - "source": [ - "from math import sqrt,pi\n", - "# Initialisation of Variables\n", - "F=40000;# Maximum Tensile load in lb\n", - "K=9000;#Fracture toughness of Ceramic\n", - "w=3;# plate made of Sialon width \n", - "#CALCULATIONS\n", - "A=F*sqrt(pi)/K;#Area of ceramic\n", - "T=A/w;# Thickness of Ceramic\n", - "print \"THickness of ceramic :\",round(T,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_8 pgno:263" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The characteristic strength of the ceramic in MPa: 269.4\n", - "Expected level of stress that can be supported in MPa: 209.8\n" - ] - } - ], - "source": [ - "from math import log,exp\n", - "# Initialisation of Variables\n", - "m=9;#Weibull modulus of an ceramic \n", - "sigma1=250;#The flexural strength in MPa\n", - "F1=0.4;#probability of failure \n", - "F2=0.1;#Expected the probability of failure\n", - "#CALCULATIONS\n", - "sigma2=exp(log(sigma1)-(log(log(1/(1-F1)))/m ));# The characteristic strength of the ceramic\n", - "sigma3=exp((log(log(1/(1-F2)))/m)+log(sigma2));#Expected level of stress that can be supported in MPa\n", - "print \"The characteristic strength of the ceramic in MPa:\",round(sigma2,1)\n", - "print \"Expected level of stress that can be supported in MPa:\",round(sigma3,1)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_9 pgno:264" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Weibull modulus of ceramic: 3.15\n" - ] - } - ], - "source": [ - "from math import log\n", - "# Initialisation of Variables\n", - "Ln1=0.5\n", - "Ln2=-2.0\n", - "\n", - "sigma1=52;#the maximum allowed stress level on ceramic at one point in MP.\n", - "sigma2=23.5;#the maximum allowed stress level on ceramic at another point in MP.\n", - "#CALCULATIONS\n", - "m=(Ln1-Ln2)/(log(sigma1)-log(sigma2));#Weibull modulus of ceramic\n", - "print \"Weibull modulus of ceramic:\",round(m,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_11 pgno:270" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The Diameter of Shaft in in.: 4.39\n", - "The minimum diameter required to prevent failure in in.: 5.54\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "N=5.256*10**5;#No. of cycles that the shaft will experience in one year\n", - "F=12500.;#applied load on shaft in lb\n", - "L=96.;#Length of Kliin produced from tool steel in in.\n", - "sigma1=72000.;#the applied stress on Shaft\n", - "f=2.;#Factor of saftey of shaft\n", - "sigma2=sigma1/f;#the maximum allowed stress level\n", - "#CALCULATIONS\n", - "d1=(16*F*L/(sigma1*pi))**(1./3.);#The Diameter of Shaft in in.\n", - "d2=(16*F*L/(sigma2*pi))**(1./3.);#The minimum diameter required to prevent failure\n", - "print \"The Diameter of Shaft in in.:\",round(d1,2)\n", - "print \"The minimum diameter required to prevent failure in in.:\",round(d2,2)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_3.ipynb deleted file mode 100755 index 481aa53d..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_7_Mechanical_Properties_part_two_3.ipynb +++ /dev/null @@ -1,245 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 7 Mechanical Properties part two" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_1 pgno:251" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Depth of crank that will propagate in the steel in: 0.8\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "f=1.12;#Geometry factor for the specimen and flaw\n", - "sigma=45000.;#Applied stress on Steel in psi\n", - "K=80000.;#The stress intensity factor\n", - "#CALCULATIONS\n", - "a=(K/(f*sigma))**2/pi;#Depth of crank in in\n", - "print \"Depth of crank that will propagate in the steel in:\",round(a,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_2 pgno:253" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The radius of the crack tip in Angstroms 706.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "T=60000.;#Tensile strength Of Sialon (acronym for silicon aluminum oxynitride) in psi\n", - "sigma=500.;#The stress at which the part unexpectedly fails in psi\n", - "a=0.01;#Depth of thin crack in in\n", - "#CALCULATIONS\n", - "r=a/(T/(2*sigma))**2;#The radius of the crack tip in in\n", - "print \"The radius of the crack tip in Angstroms\",round(r*2.54*10**8)\n", - "#difference in answer is due to erronous caluctions\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_3 pgno:254" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "THickness of ceramic : 2.63\n" - ] - } - ], - "source": [ - "from math import sqrt,pi\n", - "# Initialisation of Variables\n", - "F=40000;# Maximum Tensile load in lb\n", - "K=9000;#Fracture toughness of Ceramic\n", - "w=3;# plate made of Sialon width \n", - "#CALCULATIONS\n", - "A=F*sqrt(pi)/K;#Area of ceramic\n", - "T=A/w;# Thickness of Ceramic\n", - "print \"THickness of ceramic :\",round(T,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_8 pgno:263" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The characteristic strength of the ceramic in MPa: 269.4\n", - "Expected level of stress that can be supported in MPa: 209.8\n" - ] - } - ], - "source": [ - "from math import log,exp\n", - "# Initialisation of Variables\n", - "m=9;#Weibull modulus of an ceramic \n", - "sigma1=250;#The flexural strength in MPa\n", - "F1=0.4;#probability of failure \n", - "F2=0.1;#Expected the probability of failure\n", - "#CALCULATIONS\n", - "sigma2=exp(log(sigma1)-(log(log(1/(1-F1)))/m ));# The characteristic strength of the ceramic\n", - "sigma3=exp((log(log(1/(1-F2)))/m)+log(sigma2));#Expected level of stress that can be supported in MPa\n", - "print \"The characteristic strength of the ceramic in MPa:\",round(sigma2,1)\n", - "print \"Expected level of stress that can be supported in MPa:\",round(sigma3,1)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_9 pgno:264" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Weibull modulus of ceramic: 3.15\n" - ] - } - ], - "source": [ - "from math import log\n", - "# Initialisation of Variables\n", - "Ln1=0.5\n", - "Ln2=-2.0\n", - "\n", - "sigma1=52;#the maximum allowed stress level on ceramic at one point in MP.\n", - "sigma2=23.5;#the maximum allowed stress level on ceramic at another point in MP.\n", - "#CALCULATIONS\n", - "m=(Ln1-Ln2)/(log(sigma1)-log(sigma2));#Weibull modulus of ceramic\n", - "print \"Weibull modulus of ceramic:\",round(m,2)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_11 pgno:270" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The Diameter of Shaft in in.: 4.39\n", - "The minimum diameter required to prevent failure in in.: 5.54\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "N=5.256*10**5;#No. of cycles that the shaft will experience in one year\n", - "F=12500.;#applied load on shaft in lb\n", - "L=96.;#Length of Kliin produced from tool steel in in.\n", - "sigma1=72000.;#the applied stress on Shaft\n", - "f=2.;#Factor of saftey of shaft\n", - "sigma2=sigma1/f;#the maximum allowed stress level\n", - "#CALCULATIONS\n", - "d1=(16*F*L/(sigma1*pi))**(1./3.);#The Diameter of Shaft in in.\n", - "d2=(16*F*L/(sigma2*pi))**(1./3.);#The minimum diameter required to prevent failure\n", - "print \"The Diameter of Shaft in in.:\",round(d1,2)\n", - "print \"The minimum diameter required to prevent failure in in.:\",round(d2,2)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing_.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing_.ipynb deleted file mode 100755 index 746aa314..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing_.ipynb +++ /dev/null @@ -1,223 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 8 Strain Hardening and Annealing " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1 pgno:300" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "50.0 Amount of Cold work accomplished in step1:\n", - "68.0 Amount of Cold work accomplished in step2:\n", - "84.0 Actual Total Cold work in percent:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "t0=1;#Thickness of Copper plate in cm\n", - "tf=0.50;#Cold reducetion of coopper in cm in step1\n", - "tf2=0.16;# Further Cold reduction of cooper in cm in step2\n", - "#CALCULATIONS\n", - "CW1=((t0-tf)/t0)*100;#Amount of Cold work accomplished in step1\n", - "CW2=((tf-tf2)/tf)*100;#Amount of Cold work accomplished in step2\n", - "CW=((t0-tf2)/t0)*100;#Actual Total Cold work in percent\n", - "print CW1,\"Amount of Cold work accomplished in step1:\" \n", - "print CW2,\"Amount of Cold work accomplished in step2:\"\n", - "print CW,\"Actual Total Cold work in percent:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_2 pgno:301" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.167 Maximum thicknessproduced in cm:\n", - "0.182 Minimum thicknessproduced in cm:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "tf=0.1;#Thickness of cooper to produce in cm\n", - "CW1=40.;#cold work to produce a tensile strengthof 65,000 psi\n", - "CW2=45.;#cold work to produce a tensile strengthof 60,000 psi\n", - "#CALCULATIONS\n", - "Tmax=(tf/(1-(CW1/100)));#Maximum thicknessproduced in step1 in cm\n", - "Tmin=(tf/(1-(CW2/100)));#Minimum thicknessproduced in step2 in cm\n", - "print round(Tmax,3),\"Maximum thicknessproduced in cm:\"\n", - "print round(Tmin,3),\"Minimum thicknessproduced in cm:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_4 pgno:307" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "75.0 The fianal Cold Work in percent:\n", - "2764.60153516 The draw force required to deform the initial wire in lb:\n", - "88000.0 The stress acting on the wire after passing through the die in psi:\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "D0=0.40;#Let's assume that the starting diameter of the copper wire in in.\n", - "Df=0.20;# Diameter of the copper wire to be produced in in.\n", - "sigma1=22000;#Yeidl strength at 0% cold work\n", - "#CALCULATIONS\n", - "CW=((D0**2-Df**2)/D0**2)*100;#The fianal Cold Work in percent\n", - "F=sigma1*(pi/4)*D0**2;#The draw force required to deform the initial wire in lb\n", - "sigma2=F/((pi/4)*Df**2);# The stress acting on the wire after passing through the die in psi\n", - "print CW,\"The fianal Cold Work in percent:\"\n", - "print F,\"The draw force required to deform the initial wire in lb:\"\n", - "print sigma2,\"The stress acting on the wire after passing through the die in psi:\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5 pgno:313" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "96.36 Cold work between from 5 to 0.182 cm in percent:\n", - "5 1. Final Thickness of strip in cm\n", - "270.2 2. Recrystallization temperature By using 0.4Tm relationship in degree celsius:\n", - "81.8 3. Cold work of the strip of 1 cm thickness :\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "t0=5;#Assming we are able to purchase only 5-cm thick stock\n", - "t02=1;#Thickness of strip in cm\n", - "tf=0.182;#Final thickness of strip in cm\n", - "CW2=80;#cold work of a strip in percent\n", - "M=1085;# The melting point of copper in degree celsius\n", - "#CALCULATIONS\n", - "CW=((t0-tf)/t0)*100;#Cold work between from 5 to 0.182 cm in percent\n", - "tf2=(1-(CW2/100))*t0;# Final Thickness of strip in cm\n", - "Tr=0.4*(M+273);# Recrystallization temperature By using 0.4Tm relationship in degree celsius\n", - "CW3=((t02-tf)/t02)*100;#Cold work of the strip of 1 cm thickness \n", - "print CW,\"Cold work between from 5 to 0.182 cm in percent:\"\n", - "print tf2,\"1. Final Thickness of strip in cm\"\n", - "print Tr-273,\"2. Recrystallization temperature By using 0.4Tm relationship in degree celsius:\"\n", - "print CW3,\" 3. Cold work of the strip of 1 cm thickness :\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_6 pgno:316" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "96.36 Hot work for a strip from 5cm to 0.182 cm in percent:\n", - "96.66 Hot work for a strip from 5cm to 0.167 cm in percent\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "t0=5;#We are able to purchase strip of 5cm thickness in cm\n", - "tf=0.182;#Thickness to be produced in cm\n", - "tf2=0.167;#Thickness to procedure in cm\n", - "#CALCULATIONS\n", - "HW=((t0-tf)/t0)*100;#Hot work for a strip from 5cm to 0.182 cm in percent\n", - "HW2=((t0-tf2)/t0)*100;#Hot work for a strip from 5cm to 0.167 cm in percent\n", - "print round(HW,1),\"Hot work for a strip from 5cm to 0.182 cm in percent:\"\n", - "print round(HW2,1),\"Hot work for a strip from 5cm to 0.167 cm in percent\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__1.ipynb deleted file mode 100755 index 746aa314..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__1.ipynb +++ /dev/null @@ -1,223 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 8 Strain Hardening and Annealing " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1 pgno:300" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "50.0 Amount of Cold work accomplished in step1:\n", - "68.0 Amount of Cold work accomplished in step2:\n", - "84.0 Actual Total Cold work in percent:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "t0=1;#Thickness of Copper plate in cm\n", - "tf=0.50;#Cold reducetion of coopper in cm in step1\n", - "tf2=0.16;# Further Cold reduction of cooper in cm in step2\n", - "#CALCULATIONS\n", - "CW1=((t0-tf)/t0)*100;#Amount of Cold work accomplished in step1\n", - "CW2=((tf-tf2)/tf)*100;#Amount of Cold work accomplished in step2\n", - "CW=((t0-tf2)/t0)*100;#Actual Total Cold work in percent\n", - "print CW1,\"Amount of Cold work accomplished in step1:\" \n", - "print CW2,\"Amount of Cold work accomplished in step2:\"\n", - "print CW,\"Actual Total Cold work in percent:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_2 pgno:301" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.167 Maximum thicknessproduced in cm:\n", - "0.182 Minimum thicknessproduced in cm:\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "tf=0.1;#Thickness of cooper to produce in cm\n", - "CW1=40.;#cold work to produce a tensile strengthof 65,000 psi\n", - "CW2=45.;#cold work to produce a tensile strengthof 60,000 psi\n", - "#CALCULATIONS\n", - "Tmax=(tf/(1-(CW1/100)));#Maximum thicknessproduced in step1 in cm\n", - "Tmin=(tf/(1-(CW2/100)));#Minimum thicknessproduced in step2 in cm\n", - "print round(Tmax,3),\"Maximum thicknessproduced in cm:\"\n", - "print round(Tmin,3),\"Minimum thicknessproduced in cm:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_4 pgno:307" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "75.0 The fianal Cold Work in percent:\n", - "2764.60153516 The draw force required to deform the initial wire in lb:\n", - "88000.0 The stress acting on the wire after passing through the die in psi:\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "D0=0.40;#Let's assume that the starting diameter of the copper wire in in.\n", - "Df=0.20;# Diameter of the copper wire to be produced in in.\n", - "sigma1=22000;#Yeidl strength at 0% cold work\n", - "#CALCULATIONS\n", - "CW=((D0**2-Df**2)/D0**2)*100;#The fianal Cold Work in percent\n", - "F=sigma1*(pi/4)*D0**2;#The draw force required to deform the initial wire in lb\n", - "sigma2=F/((pi/4)*Df**2);# The stress acting on the wire after passing through the die in psi\n", - "print CW,\"The fianal Cold Work in percent:\"\n", - "print F,\"The draw force required to deform the initial wire in lb:\"\n", - "print sigma2,\"The stress acting on the wire after passing through the die in psi:\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5 pgno:313" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "96.36 Cold work between from 5 to 0.182 cm in percent:\n", - "5 1. Final Thickness of strip in cm\n", - "270.2 2. Recrystallization temperature By using 0.4Tm relationship in degree celsius:\n", - "81.8 3. Cold work of the strip of 1 cm thickness :\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "t0=5;#Assming we are able to purchase only 5-cm thick stock\n", - "t02=1;#Thickness of strip in cm\n", - "tf=0.182;#Final thickness of strip in cm\n", - "CW2=80;#cold work of a strip in percent\n", - "M=1085;# The melting point of copper in degree celsius\n", - "#CALCULATIONS\n", - "CW=((t0-tf)/t0)*100;#Cold work between from 5 to 0.182 cm in percent\n", - "tf2=(1-(CW2/100))*t0;# Final Thickness of strip in cm\n", - "Tr=0.4*(M+273);# Recrystallization temperature By using 0.4Tm relationship in degree celsius\n", - "CW3=((t02-tf)/t02)*100;#Cold work of the strip of 1 cm thickness \n", - "print CW,\"Cold work between from 5 to 0.182 cm in percent:\"\n", - "print tf2,\"1. Final Thickness of strip in cm\"\n", - "print Tr-273,\"2. Recrystallization temperature By using 0.4Tm relationship in degree celsius:\"\n", - "print CW3,\" 3. Cold work of the strip of 1 cm thickness :\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_6 pgno:316" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "96.36 Hot work for a strip from 5cm to 0.182 cm in percent:\n", - "96.66 Hot work for a strip from 5cm to 0.167 cm in percent\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "t0=5;#We are able to purchase strip of 5cm thickness in cm\n", - "tf=0.182;#Thickness to be produced in cm\n", - "tf2=0.167;#Thickness to procedure in cm\n", - "#CALCULATIONS\n", - "HW=((t0-tf)/t0)*100;#Hot work for a strip from 5cm to 0.182 cm in percent\n", - "HW2=((t0-tf2)/t0)*100;#Hot work for a strip from 5cm to 0.167 cm in percent\n", - "print round(HW,1),\"Hot work for a strip from 5cm to 0.182 cm in percent:\"\n", - "print round(HW2,1),\"Hot work for a strip from 5cm to 0.167 cm in percent\"\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__2.ipynb deleted file mode 100755 index e78c64e9..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__2.ipynb +++ /dev/null @@ -1,223 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 8 Strain Hardening and Annealing " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1 pgno:300" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Amount of Cold work accomplished in step1: 50.0\n", - "Amount of Cold work accomplished in step2: 68.0\n", - "Actual Total Cold work in percent: 84.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "t0=1;#Thickness of Copper plate in cm\n", - "tf=0.50;#Cold reducetion of coopper in cm in step1\n", - "tf2=0.16;# Further Cold reduction of cooper in cm in step2\n", - "#CALCULATIONS\n", - "CW1=((t0-tf)/t0)*100;#Amount of Cold work accomplished in step1\n", - "CW2=((tf-tf2)/tf)*100;#Amount of Cold work accomplished in step2\n", - "CW=((t0-tf2)/t0)*100;#Actual Total Cold work in percent\n", - "print \"Amount of Cold work accomplished in step1:\",CW1 \n", - "print \"Amount of Cold work accomplished in step2:\",CW2\n", - "print \"Actual Total Cold work in percent:\",CW\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_2 pgno:301" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Maximum thicknessproduced in cm: 0.167\n", - "Minimum thicknessproduced in cm: 0.182\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "tf=0.1;#Thickness of cooper to produce in cm\n", - "CW1=40.;#cold work to produce a tensile strengthof 65,000 psi\n", - "CW2=45.;#cold work to produce a tensile strengthof 60,000 psi\n", - "#CALCULATIONS\n", - "Tmax=(tf/(1-(CW1/100)));#Maximum thicknessproduced in step1 in cm\n", - "Tmin=(tf/(1-(CW2/100)));#Minimum thicknessproduced in step2 in cm\n", - "print \"Maximum thicknessproduced in cm:\",round(Tmax,3)\n", - "print \"Minimum thicknessproduced in cm:\",round(Tmin,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_4 pgno:307" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "75.0 The fianal Cold Work in percent:\n", - "The draw force required to deform the initial wire in lb: 2764.60153516\n", - "The stress acting on the wire after passing through the die in psi: 88000.0\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "D0=0.40;#Let's assume that the starting diameter of the copper wire in in.\n", - "Df=0.20;# Diameter of the copper wire to be produced in in.\n", - "sigma1=22000;#Yeidl strength at 0% cold work\n", - "#CALCULATIONS\n", - "CW=((D0**2-Df**2)/D0**2)*100;#The fianal Cold Work in percent\n", - "F=sigma1*(pi/4)*D0**2;#The draw force required to deform the initial wire in lb\n", - "sigma2=F/((pi/4)*Df**2);# The stress acting on the wire after passing through the die in psi\n", - "print CW,\"The fianal Cold Work in percent:\"\n", - "print \"The draw force required to deform the initial wire in lb:\",F\n", - "print \"The stress acting on the wire after passing through the die in psi:\",sigma2\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5 pgno:313" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Cold work between from 5 to 0.182 cm in percent: 96.36\n", - "1. Final Thickness of strip in cm 5\n", - "2. Recrystallization temperature By using 0.4Tm relationship in degree celsius: 270.2\n", - "3. Cold work of the strip of 1 cm thickness : 81.8\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "t0=5;#Assming we are able to purchase only 5-cm thick stock\n", - "t02=1;#Thickness of strip in cm\n", - "tf=0.182;#Final thickness of strip in cm\n", - "CW2=80;#cold work of a strip in percent\n", - "M=1085;# The melting point of copper in degree celsius\n", - "#CALCULATIONS\n", - "CW=((t0-tf)/t0)*100;#Cold work between from 5 to 0.182 cm in percent\n", - "tf2=(1-(CW2/100))*t0;# Final Thickness of strip in cm\n", - "Tr=0.4*(M+273);# Recrystallization temperature By using 0.4Tm relationship in degree celsius\n", - "CW3=((t02-tf)/t02)*100;#Cold work of the strip of 1 cm thickness \n", - "print \"Cold work between from 5 to 0.182 cm in percent:\",CW\n", - "print \"1. Final Thickness of strip in cm\",tf2\n", - "print \"2. Recrystallization temperature By using 0.4Tm relationship in degree celsius:\",Tr-273\n", - "print \"3. Cold work of the strip of 1 cm thickness :\",CW3" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_6 pgno:316" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Hot work for a strip from 5cm to 0.182 cm in percent: 96.4\n", - "Hot work for a strip from 5cm to 0.167 cm in percent 96.7\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "t0=5;#We are able to purchase strip of 5cm thickness in cm\n", - "tf=0.182;#Thickness to be produced in cm\n", - "tf2=0.167;#Thickness to procedure in cm\n", - "#CALCULATIONS\n", - "HW=((t0-tf)/t0)*100;#Hot work for a strip from 5cm to 0.182 cm in percent\n", - "HW2=((t0-tf2)/t0)*100;#Hot work for a strip from 5cm to 0.167 cm in percent\n", - "print \"Hot work for a strip from 5cm to 0.182 cm in percent:\",round(HW,1)\n", - "print \"Hot work for a strip from 5cm to 0.167 cm in percent\",round(HW2,1)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__3.ipynb deleted file mode 100755 index e78c64e9..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_8_Strain_Hardening_and_Annealing__3.ipynb +++ /dev/null @@ -1,223 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 8 Strain Hardening and Annealing " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1 pgno:300" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Amount of Cold work accomplished in step1: 50.0\n", - "Amount of Cold work accomplished in step2: 68.0\n", - "Actual Total Cold work in percent: 84.0\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "t0=1;#Thickness of Copper plate in cm\n", - "tf=0.50;#Cold reducetion of coopper in cm in step1\n", - "tf2=0.16;# Further Cold reduction of cooper in cm in step2\n", - "#CALCULATIONS\n", - "CW1=((t0-tf)/t0)*100;#Amount of Cold work accomplished in step1\n", - "CW2=((tf-tf2)/tf)*100;#Amount of Cold work accomplished in step2\n", - "CW=((t0-tf2)/t0)*100;#Actual Total Cold work in percent\n", - "print \"Amount of Cold work accomplished in step1:\",CW1 \n", - "print \"Amount of Cold work accomplished in step2:\",CW2\n", - "print \"Actual Total Cold work in percent:\",CW\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_2 pgno:301" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Maximum thicknessproduced in cm: 0.167\n", - "Minimum thicknessproduced in cm: 0.182\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "tf=0.1;#Thickness of cooper to produce in cm\n", - "CW1=40.;#cold work to produce a tensile strengthof 65,000 psi\n", - "CW2=45.;#cold work to produce a tensile strengthof 60,000 psi\n", - "#CALCULATIONS\n", - "Tmax=(tf/(1-(CW1/100)));#Maximum thicknessproduced in step1 in cm\n", - "Tmin=(tf/(1-(CW2/100)));#Minimum thicknessproduced in step2 in cm\n", - "print \"Maximum thicknessproduced in cm:\",round(Tmax,3)\n", - "print \"Minimum thicknessproduced in cm:\",round(Tmin,3)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_4 pgno:307" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "75.0 The fianal Cold Work in percent:\n", - "The draw force required to deform the initial wire in lb: 2764.60153516\n", - "The stress acting on the wire after passing through the die in psi: 88000.0\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "D0=0.40;#Let's assume that the starting diameter of the copper wire in in.\n", - "Df=0.20;# Diameter of the copper wire to be produced in in.\n", - "sigma1=22000;#Yeidl strength at 0% cold work\n", - "#CALCULATIONS\n", - "CW=((D0**2-Df**2)/D0**2)*100;#The fianal Cold Work in percent\n", - "F=sigma1*(pi/4)*D0**2;#The draw force required to deform the initial wire in lb\n", - "sigma2=F/((pi/4)*Df**2);# The stress acting on the wire after passing through the die in psi\n", - "print CW,\"The fianal Cold Work in percent:\"\n", - "print \"The draw force required to deform the initial wire in lb:\",F\n", - "print \"The stress acting on the wire after passing through the die in psi:\",sigma2\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5 pgno:313" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Cold work between from 5 to 0.182 cm in percent: 96.36\n", - "1. Final Thickness of strip in cm 5\n", - "2. Recrystallization temperature By using 0.4Tm relationship in degree celsius: 270.2\n", - "3. Cold work of the strip of 1 cm thickness : 81.8\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "t0=5;#Assming we are able to purchase only 5-cm thick stock\n", - "t02=1;#Thickness of strip in cm\n", - "tf=0.182;#Final thickness of strip in cm\n", - "CW2=80;#cold work of a strip in percent\n", - "M=1085;# The melting point of copper in degree celsius\n", - "#CALCULATIONS\n", - "CW=((t0-tf)/t0)*100;#Cold work between from 5 to 0.182 cm in percent\n", - "tf2=(1-(CW2/100))*t0;# Final Thickness of strip in cm\n", - "Tr=0.4*(M+273);# Recrystallization temperature By using 0.4Tm relationship in degree celsius\n", - "CW3=((t02-tf)/t02)*100;#Cold work of the strip of 1 cm thickness \n", - "print \"Cold work between from 5 to 0.182 cm in percent:\",CW\n", - "print \"1. Final Thickness of strip in cm\",tf2\n", - "print \"2. Recrystallization temperature By using 0.4Tm relationship in degree celsius:\",Tr-273\n", - "print \"3. Cold work of the strip of 1 cm thickness :\",CW3" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_6 pgno:316" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Hot work for a strip from 5cm to 0.182 cm in percent: 96.4\n", - "Hot work for a strip from 5cm to 0.167 cm in percent 96.7\n" - ] - } - ], - "source": [ - "# Initialisation of Variables\n", - "t0=5;#We are able to purchase strip of 5cm thickness in cm\n", - "tf=0.182;#Thickness to be produced in cm\n", - "tf2=0.167;#Thickness to procedure in cm\n", - "#CALCULATIONS\n", - "HW=((t0-tf)/t0)*100;#Hot work for a strip from 5cm to 0.182 cm in percent\n", - "HW2=((t0-tf2)/t0)*100;#Hot work for a strip from 5cm to 0.167 cm in percent\n", - "print \"Hot work for a strip from 5cm to 0.182 cm in percent:\",round(HW,1)\n", - "print \"Hot work for a strip from 5cm to 0.167 cm in percent\",round(HW2,1)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification.ipynb deleted file mode 100755 index f4d5de3a..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification.ipynb +++ /dev/null @@ -1,191 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 9 Principles of Solidification" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_1 pgno:333" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "12.5122850123 Critical Radius of copper in cm:\n", - "4.7241633375e-23 Volume of FCC unit cell of copper in cm**3:\n", - "8.2053761484e-21 Critical volume of FCC copper :\n", - "174.0 The number of unit cells in the critical nucleus :\n", - "696.0 Since there are four atoms in each unit cell of FCC metals:\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "deltaT=236;#Typical Undercooling for HomogeneousNucleation from the table 9-1 for cooper \n", - "Tm=1358;#Freezing Temperature from the table 9-1 for cooper in degree celsius\n", - "deltaH=1628;# Latent Heat of Fusion from the table 9-1 for cooper in J/cm**3\n", - "sigma1=177*10**-7;#Solid-Liquid Interfacial Energyfrom the table 9-1 for cooper in J/cm**2\n", - "a0=3.615*10**-8;#The lattice parameter for FCC copper in cm\n", - "#CALCULATIONS\n", - "r=(2*sigma1*Tm)/(deltaH*deltaT);#Critical Radius of copper in cm\n", - "V=a0**3;#Volume of FCC unit cell of copper in cm**3\n", - "V2=(4./3.)*pi*r**3;#Critical volume of FCC copper \n", - "N=V2/V#The number of unit cells in the critical nucleus \n", - "Nc=4*round(N);#Since there are four atoms in each unit cell of FCC metals\n", - "print r*10**8,\"Critical Radius of copper in cm:\"\n", - "print V,\"Volume of FCC unit cell of copper in cm**3:\"\n", - "print V2,\"Critical volume of FCC copper :\"\n", - "print round(N),\"The number of unit cells in the critical nucleus :\"\n", - "print Nc,\"Since there are four atoms in each unit cell of FCC metals:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_2 pgno:339" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1.73 The thickness in inches=\n" - ] - } - ], - "source": [ - "from math import pi\n", - "#page 255\n", - "# Initialisation of Variables\n", - "d=18.;#Diameter of the casting in in\n", - "x=2.;#Thickness of the casting in in\n", - "B=22.#Mold constant of casting\n", - "V=(pi/4.)*d**2;#Volume of the casting in in**3\n", - "A=2*(pi/4.)*d**2+pi*d*x;#The surface area of the casting in contact with the mold\n", - "x=(0.708*A)/V\n", - "print round(x,2),\"The thickness in inches=\"\n", - "#the diffrence in asnwer is due to round foo error\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_4 pgno:342" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the total solidification time is 31.28\n" - ] - } - ], - "source": [ - "#page 250\n", - "\n", - "# Initialisation of Variables\n", - "d=5#inches\n", - "t1=5#mins\n", - "t2=20#mins\n", - "d2=1.5#inches\n", - "#CALCULATIONS\n", - "ksol=0.447#inches/mts**0.5\n", - "c1=0.5;\n", - "t=((d-3+c1)/ksol)**2\n", - "print \"the total solidification time is \",round(t,2)#mins" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_5 pgno:342" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.77\n" - ] - } - ], - "source": [ - "#page 250\n", - "from math import pi\n", - "from sympy import *\n", - "# Initialisation of Variables\n", - "l=12 #inchs\n", - "w=8#inchs\n", - "ts=40000#psi\n", - "mc=45#mins/in**2\n", - "x=symbols('x')\n", - "v=8*12*x\n", - "a=2*8*12+2*x*12\n", - "#by solving the two equations we get \n", - "x=64/82.67;\n", - "print round(x,2)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_1.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_1.ipynb deleted file mode 100755 index c5febd67..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_1.ipynb +++ /dev/null @@ -1,191 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 9 Principles of Solidification" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_1 pgno:333" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "12.5122850123 Critical Radius of copper in cm:\n", - "4.7241633375e-23 Volume of FCC unit cell of copper in cm**3:\n", - "8.2053761484e-21 Critical volume of FCC copper :\n", - "174.0 The number of unit cells in the critical nucleus :\n", - "696.0 Since there are four atoms in each unit cell of FCC metals:\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "deltaT=236;#Typical Undercooling for HomogeneousNucleation from the table 9-1 for cooper \n", - "Tm=1358;#Freezing Temperature from the table 9-1 for cooper in degree celsius\n", - "deltaH=1628;# Latent Heat of Fusion from the table 9-1 for cooper in J/cm**3\n", - "sigma1=177*10**-7;#Solid-Liquid Interfacial Energyfrom the table 9-1 for cooper in J/cm**2\n", - "a0=3.615*10**-8;#The lattice parameter for FCC copper in cm\n", - "#CALCULATIONS\n", - "r=(2*sigma1*Tm)/(deltaH*deltaT);#Critical Radius of copper in cm\n", - "V=a0**3;#Volume of FCC unit cell of copper in cm**3\n", - "V2=(4./3.)*pi*r**3;#Critical volume of FCC copper \n", - "N=V2/V#The number of unit cells in the critical nucleus \n", - "Nc=4*round(N);#Since there are four atoms in each unit cell of FCC metals\n", - "print r*10**8,\"Critical Radius of copper in cm:\"\n", - "print V,\"Volume of FCC unit cell of copper in cm**3:\"\n", - "print V2,\"Critical volume of FCC copper :\"\n", - "print round(N),\"The number of unit cells in the critical nucleus :\"\n", - "print Nc,\"Since there are four atoms in each unit cell of FCC metals:\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_2 pgno:339" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1.73 The thickness in inches=\n" - ] - } - ], - "source": [ - "from math import pi\n", - "#page 255\n", - "# Initialisation of Variables\n", - "d=18.;#Diameter of the casting in in\n", - "x=2.;#Thickness of the casting in in\n", - "B=22.#Mold constant of casting\n", - "V=(pi/4.)*d**2;#Volume of the casting in in**3\n", - "A=2*(pi/4.)*d**2+pi*d*x;#The surface area of the casting in contact with the mold\n", - "x=(0.708*A)/V\n", - "print round(x,2),\"The thickness in inches=\"\n", - "#the diffrence in asnwer is due to round foo error\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_4 pgno:342" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the total solidification time is 31.28\n" - ] - } - ], - "source": [ - "#page 250\n", - "\n", - "# Initialisation of Variables\n", - "d=5#inches\n", - "t1=5#mins\n", - "t2=20#mins\n", - "d2=1.5#inches\n", - "#CALCULATIONS\n", - "ksol=0.447#inches/mts**0.5\n", - "c1=0.5;\n", - "t=((d-3+c1)/ksol)**2\n", - "print \"the total solidification time is \",round(t,2)#mins" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_5 pgno:342" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.77\n" - ] - } - ], - "source": [ - "#page 250\n", - "from math import pi\n", - "\n", - "# Initialisation of Variables\n", - "l=12 #inchs\n", - "w=8#inchs\n", - "ts=40000#psi\n", - "mc=45#mins/in**2\n", - "x=1\n", - "v=8*12*x\n", - "a=2*8*12+2*x*12\n", - "#by solving the two equations we get \n", - "x=64/82.67;\n", - "print round(x,2)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_2.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_2.ipynb deleted file mode 100755 index 54ba9da7..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_2.ipynb +++ /dev/null @@ -1,191 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 9 Principles of Solidification" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_1 pgno:333" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Critical Radius of copper in cm: 12.5122850123\n", - "Volume of FCC unit cell of copper in cm**3: 4.7241633375e-23\n", - "Critical volume of FCC copper : 8.2053761484e-21\n", - "The number of unit cells in the critical nucleus : 174.0\n", - "Since there are four atoms in each unit cell of FCC metals: 696.0\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "deltaT=236;#Typical Undercooling for HomogeneousNucleation from the table 9-1 for cooper \n", - "Tm=1358;#Freezing Temperature from the table 9-1 for cooper in degree celsius\n", - "deltaH=1628;# Latent Heat of Fusion from the table 9-1 for cooper in J/cm**3\n", - "sigma1=177*10**-7;#Solid-Liquid Interfacial Energyfrom the table 9-1 for cooper in J/cm**2\n", - "a0=3.615*10**-8;#The lattice parameter for FCC copper in cm\n", - "#CALCULATIONS\n", - "r=(2*sigma1*Tm)/(deltaH*deltaT);#Critical Radius of copper in cm\n", - "V=a0**3;#Volume of FCC unit cell of copper in cm**3\n", - "V2=(4./3.)*pi*r**3;#Critical volume of FCC copper \n", - "N=V2/V#The number of unit cells in the critical nucleus \n", - "Nc=4*round(N);#Since there are four atoms in each unit cell of FCC metals\n", - "print \"Critical Radius of copper in cm:\",r*10**8\n", - "print \"Volume of FCC unit cell of copper in cm**3:\",V\n", - "print \"Critical volume of FCC copper :\",V2\n", - "print \"The number of unit cells in the critical nucleus :\",round(N)\n", - "print \"Since there are four atoms in each unit cell of FCC metals:\",Nc\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_2 pgno:339" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The thickness in inches= 1.73\n" - ] - } - ], - "source": [ - "from math import pi\n", - "#page 255\n", - "# Initialisation of Variables\n", - "d=18.;#Diameter of the casting in in\n", - "x=2.;#Thickness of the casting in in\n", - "B=22.#Mold constant of casting\n", - "V=(pi/4.)*d**2;#Volume of the casting in in**3\n", - "A=2*(pi/4.)*d**2+pi*d*x;#The surface area of the casting in contact with the mold\n", - "x=(0.708*A)/V\n", - "print \"The thickness in inches=\",round(x,2),\n", - "#the diffrence in asnwer is due to round foo error\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_4 pgno:342" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the total solidification time is 31.28\n" - ] - } - ], - "source": [ - "#page 250\n", - "\n", - "# Initialisation of Variables\n", - "d=5#inches\n", - "t1=5#mins\n", - "t2=20#mins\n", - "d2=1.5#inches\n", - "#CALCULATIONS\n", - "ksol=0.447#inches/mts**0.5\n", - "c1=0.5;\n", - "t=((d-3+c1)/ksol)**2\n", - "print \"the total solidification time is \",round(t,2)#mins" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_5 pgno:342" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.77\n" - ] - } - ], - "source": [ - "#page 250\n", - "from math import pi\n", - "\n", - "# Initialisation of Variables\n", - "l=12 #inchs\n", - "w=8#inchs\n", - "ts=40000#psi\n", - "mc=45#mins/in**2\n", - "x=1\n", - "v=8*12*x\n", - "a=2*8*12+2*x*12\n", - "#by solving the two equations we get \n", - "x=64/82.67;\n", - "print round(x,2)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_3.ipynb b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_3.ipynb deleted file mode 100755 index 54ba9da7..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/Chapter_9_Principles_of_Solidification_3.ipynb +++ /dev/null @@ -1,191 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 9 Principles of Solidification" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_1 pgno:333" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Critical Radius of copper in cm: 12.5122850123\n", - "Volume of FCC unit cell of copper in cm**3: 4.7241633375e-23\n", - "Critical volume of FCC copper : 8.2053761484e-21\n", - "The number of unit cells in the critical nucleus : 174.0\n", - "Since there are four atoms in each unit cell of FCC metals: 696.0\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# Initialisation of Variables\n", - "deltaT=236;#Typical Undercooling for HomogeneousNucleation from the table 9-1 for cooper \n", - "Tm=1358;#Freezing Temperature from the table 9-1 for cooper in degree celsius\n", - "deltaH=1628;# Latent Heat of Fusion from the table 9-1 for cooper in J/cm**3\n", - "sigma1=177*10**-7;#Solid-Liquid Interfacial Energyfrom the table 9-1 for cooper in J/cm**2\n", - "a0=3.615*10**-8;#The lattice parameter for FCC copper in cm\n", - "#CALCULATIONS\n", - "r=(2*sigma1*Tm)/(deltaH*deltaT);#Critical Radius of copper in cm\n", - "V=a0**3;#Volume of FCC unit cell of copper in cm**3\n", - "V2=(4./3.)*pi*r**3;#Critical volume of FCC copper \n", - "N=V2/V#The number of unit cells in the critical nucleus \n", - "Nc=4*round(N);#Since there are four atoms in each unit cell of FCC metals\n", - "print \"Critical Radius of copper in cm:\",r*10**8\n", - "print \"Volume of FCC unit cell of copper in cm**3:\",V\n", - "print \"Critical volume of FCC copper :\",V2\n", - "print \"The number of unit cells in the critical nucleus :\",round(N)\n", - "print \"Since there are four atoms in each unit cell of FCC metals:\",Nc\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_2 pgno:339" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The thickness in inches= 1.73\n" - ] - } - ], - "source": [ - "from math import pi\n", - "#page 255\n", - "# Initialisation of Variables\n", - "d=18.;#Diameter of the casting in in\n", - "x=2.;#Thickness of the casting in in\n", - "B=22.#Mold constant of casting\n", - "V=(pi/4.)*d**2;#Volume of the casting in in**3\n", - "A=2*(pi/4.)*d**2+pi*d*x;#The surface area of the casting in contact with the mold\n", - "x=(0.708*A)/V\n", - "print \"The thickness in inches=\",round(x,2),\n", - "#the diffrence in asnwer is due to round foo error\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_4 pgno:342" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the total solidification time is 31.28\n" - ] - } - ], - "source": [ - "#page 250\n", - "\n", - "# Initialisation of Variables\n", - "d=5#inches\n", - "t1=5#mins\n", - "t2=20#mins\n", - "d2=1.5#inches\n", - "#CALCULATIONS\n", - "ksol=0.447#inches/mts**0.5\n", - "c1=0.5;\n", - "t=((d-3+c1)/ksol)**2\n", - "print \"the total solidification time is \",round(t,2)#mins" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9_5 pgno:342" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.77\n" - ] - } - ], - "source": [ - "#page 250\n", - "from math import pi\n", - "\n", - "# Initialisation of Variables\n", - "l=12 #inchs\n", - "w=8#inchs\n", - "ts=40000#psi\n", - "mc=45#mins/in**2\n", - "x=1\n", - "v=8*12*x\n", - "a=2*8*12+2*x*12\n", - "#by solving the two equations we get \n", - "x=64/82.67;\n", - "print round(x,2)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/README.txt b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/README.txt deleted file mode 100755 index 28f927ec..00000000 --- a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: pramodkumar desu -Course: others -College/Institute/Organization: K L university -Department/Designation: finanace and costing -Book Title: Essentials of Materials Science and Engineering -Author: D. R. Askeland and P. P. Phule -Publisher: Thomson, New Delhi -Year of publication: 2004 -Isbn: 7302099812 -Edition: 2 \ No newline at end of file diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10.png b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10.png deleted file mode 100755 index 6a791a7f..00000000 Binary files a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10.png and /dev/null differ diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_1.png b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_1.png deleted file mode 100755 index 6a791a7f..00000000 Binary files a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_1.png and /dev/null differ diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_2.png b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_2.png deleted file mode 100755 index 6a791a7f..00000000 Binary files a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_2.png and /dev/null differ diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_3.png b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_3.png deleted file mode 100755 index 6a791a7f..00000000 Binary files a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_10_3.png and /dev/null differ diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11.png b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11.png deleted file mode 100755 index dd23786a..00000000 Binary files a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11.png and /dev/null differ diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_1.png b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_1.png deleted file mode 100755 index dd23786a..00000000 Binary files a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_1.png and /dev/null differ diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_2.png b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_2.png deleted file mode 100755 index dd23786a..00000000 Binary files a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_2.png and /dev/null differ diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_3.png b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_3.png deleted file mode 100755 index dd23786a..00000000 Binary files a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_11_3.png and /dev/null differ diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4.png b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4.png deleted file mode 100755 index 6ee0ef63..00000000 Binary files a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4.png and /dev/null differ diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_1.png b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_1.png deleted file mode 100755 index 6ee0ef63..00000000 Binary files a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_1.png and /dev/null differ diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_2.png b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_2.png deleted file mode 100755 index 6ee0ef63..00000000 Binary files a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_2.png and /dev/null differ diff --git a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_3.png b/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_3.png deleted file mode 100755 index 6ee0ef63..00000000 Binary files a/_Essentials_of_Materials_Science_and_Engineering_by__D._R._Askeland_and_P._P._Phule/screenshots/cha_4_3.png and /dev/null differ diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter10.ipynb b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter10.ipynb deleted file mode 100644 index f34f7c1f..00000000 --- a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter10.ipynb +++ /dev/null @@ -1,737 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:cf48b4448bdb212ceb12f7cd6ba5223c804096f079426f10b19c24da42a899a4" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter10-Radiation Shielding " - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg553" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 10.1\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "E0 = 2.; ## Energy of gamma rays in MeV\n", - "a = 10.; ## Thickeness of lead shield in cm\n", - "phi0 = 10**6; ## Intensity of gamma rays in gamma-rays/cm^2-sec\n", - "\n", - "## 1.\n", - "## Using the data from Table II.4 for E0 = 2 MeV\n", - "mu_rho = 0.0457; ## The ratio of total attenuation coefficient to density in cm^2/g\n", - "## From standard data tables for lead\n", - "rho = 11.34; ## Density of lead in g/cm^3\n", - "## Calculation\n", - "phi_u = phi0*math.exp(-(mu_rho*rho*a));\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n Uncollided flux at the rear side of lead shield = \",phi_u,\" gamma-rays/cm^2-sec \\n\")\n", - "\n", - "## 2.\n", - "## Using the data from Table 10.1 for 2 MeV of lead material\n", - "mua = mu_rho*rho*a;\n", - "B_4 = 2.41; ## Buildup factor if mu*a = 4\n", - "B_7 = 3.36; ## Buildup factor if mu*a = 7\n", - "## Using two point method of straight line for calculating buildup factor at mu*a\n", - "B_m = B_4+((mua-4.)*((B_7-B_4)/(7.-4.)));\n", - "## Calculation\n", - "phi_b = phi_u*B_m;\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n Buildup flux at the rear side of lead shield = \",phi_b,\" gamma-rays/cm^2-sec \\n\");\n", - "\n", - "## 3.\n", - "## Using the data from Table II.5 for 2 MeV \n", - "mua_rho_air = 0.0238; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", - "## Calculation\n", - "X_dot = 0.0659*E0*mua_rho_air*phi_b;\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n Exposure rate at the rear side of lead shield = \",X_dot,\" mR/hour \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Uncollided flux at the rear side of lead shield = 5614.63 gamma-rays/cm^2-sec \n", - "\n", - "\n", - " Buildup flux at the rear side of lead shield = 15633.48 gamma-rays/cm^2-sec \n", - "\n", - "\n", - " Exposure rate at the rear side of lead shield = 49.04 mR/hour \n", - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg555" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "## Example 10.2\n", - "import math\n", - "\n", - "import warnings\n", - "warnings.filterwarnings('ignore')\n", - "import numpy\n", - "%matplotlib inline\n", - "import matplotlib\n", - "from matplotlib import pyplot\n", - "\n", - "## Given data\n", - "E = 1.; ## Energy of gamma rays in MeV\n", - "X_dot = 1.; ## Exposure rate in mR/hour\n", - "phi0 = 10**8; ## Intensity of gamma rays in gamma-rays/cm^2-sec from isotropic point source\n", - "## Using the data from Table II.5 for 1 MeV \n", - "mua_rho_air = 0.028; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", - "phi_b = X_dot/(0.0659*E*mua_rho_air); ## Buildup flux in gamma-rays/cm^2-sec\n", - "## Using Eq 10.14\n", - "print'%s %.2f %s'%(\" \\n The equation to calculate radius is \\n %.2E = %E * Bp*exp(-mu*R)/(4*pi*R^2) \\n\",phi_b,phi0);\n", - "## Using the data from Table II.4 for E = 1 MeV for Iron\n", - "mu_rho = 0.0595; ## The ratio of total attenuation coefficient to density in cm^2/g\n", - "## From standard data tables for iron\n", - "rho = 7.864; ## Density of iron in g/cm^3\n", - "mu = mu_rho*rho;\n", - "## On solving the right hand side of equation\n", - "## RHS = 3.22*10^3*Bp*exp(-mu*R)/(mu*R)^2\n", - "## Let mu*R = x\n", - "## Using the data from Table 10.2 for isotropic point source of 1 MeV incident on iron material\n", - "Bp = numpy.array([1.87, 2.89, 5.39, 10.2, 16.2, 28.3, 42.7]);\n", - "x = numpy.array([1 ,2 ,4 ,7 ,10, 15, 20]);\n", - "leng=len(Bp)\n", - "RHS= numpy.zeros(leng);\n", - "for i in range(0,7):\n", - " RHS[i] = (3.22*10**3*Bp[i]*math.exp(-x[i])/x[i]**2);\n", - "\n", - "pyplot.plot(x,RHS)\n", - "pyplot.legend(\"Conical\",\"2D-CD\")\n", - "pyplot.xlabel(\"mu*R\")\n", - "pyplot.ylabel(\"RHS\")\n", - "pyplot.title(\"Semilog plot of RHS vs mu*R\")\n", - "pyplot.show()\n", - "\n", - "## From the graph\n", - "muR = 6.55; ## This is the value when RHS = 1\n", - "## Calculation\n", - "R = muR/mu;\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n The shield radius required = \",math.ceil(R),\" cm \\n\");\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The equation to calculate radius is \n", - " %.2E = %E * Bp*exp(-mu*R)/(4*pi*R^2) \n", - " 541.95 100000000\n" - ] - }, - { - "metadata": {}, - "output_type": "display_data", - "png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEZCAYAAABrUHmEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH+FJREFUeJzt3XmUnHWd7/H3B0JIQkICCYQOhEUmLGHgwhh2PbY6xsBV\ngcEh4qiouCAoXK6jLDIkMA6iXjbPHBhH9iVBFFlcggSlD8oWcYIEwg5R0pAEInsSyfK9fzy/Tp50\nqirV3VX1VHd9XufUyVPP+q1KdX3rtz6KCMzMzKqxSdEBmJlZ/+GkYWZmVXPSMDOzqjlpmJlZ1Zw0\nzMysak4aZmZWNScNK4Sk90p6Ivd8gaQPNjiGnSWtkVT3vwNJQyX9XNJrkn5c7+uZ1YuThq1H0nsk\n3Ze+3JZK+r2kSbW+TkT8LiL2yK9Kj6Ykabqk6/pwio8D2wJbR8TUMudfKenN9N4/IOm9ue3tkl4o\ncVyHpONzz8+U9Fw6zwuSbuxDzIWQdFW35+0pub8p6Q1JT0n6UlHxtTonDVtL0pbAL4BLgK2A7YFz\ngL8VGdcAsRPwVESsKbM9gJkRMQIYDdwF/LSK865NtpKOAz4FfDCdZ1I6T78g6XuS/j4tD5N0oaTx\naXNnRIyIiC2BU4BLJe1VWLAtzEnD8nYDIiJ+HJkVETE7IuZ17SDp85LmS/qrpDsk7ZjbtkbSVyQ9\nnX4RnitpV0n3p1/PN0raLO1b8pdz2ra5pIsldabHRZIG57Z/U9KLkhZK+kK67rvKnKtD0nckPSjp\ndUm3StqqzL7jJN2eSlhPS/pCWj8FOAOYmn7tzi1z/J7peq9KelTSR9P6c4B/yx3/uVKHpwcRsRqY\nAWwjaUypa5UxCfh1RDyfzrM4Ii4vE+tpkn7Sbd0lki5Jy5+V9Gz6f3xO0ifLnGe6pJ9Iui7t+4ik\nCZLOkLRY0p8lfSi3/3rVkN1KcN8FTgDeD1wL/DQiNviMRMQsYCmwZ/VvjdWKk4blPQmslnS1pCnd\nv1wlHUH25XkUMAb4HTCz2zkmA/sBBwGnAT8CjgV2BPZOyxvzLeAA4H+lxwHAWSmGKcCpwAeBCUA7\nG6/W+jTwOaANWAX8oMx+NwJ/Sft9HDhP0vsj4g7gPODG9Gt3v+4HpmT4c+AOYBvga8ANknaLiGnd\njr+q+/HdzjUY+AzwbES8spHXlvcA8BlJ/yppkqRNK+w7Ezhc0vB0zU2Bf04xb0FW2pySftkfDDxc\n4VwfIfuS3wqYC8xO68cB/w78MLdv92rI/LKANbn16n4hSZtI+hgwMl3LGsxJw9aKiDeB95D9wf4I\nWCLpNknbpl1OAL4TEU+mapbvAPvmqhAAvhcRb0XEfGAeMCsiFkTEG8AssoSyMZ8Ezo2IV9KX5jlk\nX/wAxwBXRsTjEbEcmEaJL5f8ywKujYj5EbGM7Bf/MZLWOya9hkOA0yLinYj4E3A52Zc35EoCZRwE\nbBER50fEqoi4m6yqrytJbux4UlyvAsuALwCHd9s+LpVi1j7I/r+yFxpxA1my+jDQASyW9M1SF4qI\nvwD/Q/YDAOADwLKImJOerwH2ljQ0lVjmV4j7nlQiXU1WpTYaOD89/zGwc6r6LCX/nnwT+G/gbuA4\n4OO5z9a43HtzC/DpiHi2QkxWJ04atp6IeCIiPhcR44G/J/u1eHHavBNwSe4La2lav33uFItzy8u7\nPV8BDK8ijHHAn3PP/5LWQVYKyFdZLKzifPn9/wJsRlZS6n7Nv0bE29323Z7qjOt2HcheQ7XHA/w4\nIrYCxgKPkiWAvBcjYqv8A/h9foeImBERHyL7JX4C8O+SJpe53gzWJbVPAjekc7wNTE3HvyjpF5J2\nrxD3ktzycuCVWDcT6vL0b7n/97UljYj4ZkQ8mpaXRcSpueqpF9Pr3ZKsFHSmGtDrzTbkN93Kiogn\ngWvIkgdkX6Jf6vbFtUVEPFDtKavc70Vg59zzHYHOtPwSkC/Z5JfL2bHb8kqge7XPi8DWXdU1uX27\nktLGYn8RGN+tBLMT1SW1rvN3tWksBb4EfKlcW81GTxaxOiJ+CjwClGsw/inQLml74EiyJNJ1/J0R\nMRnYDniCrORZLu6eeBvYIve8rUTspdp8ura9Q1btOZJ1pU9rICcNW0vS7pL+b/oS6aqyORa4P+3y\nX2S/8Cam7SMl/fPGTltmuZKZwFmSxqSG4LOB69O2m4DPSdpD0jCy6qaNXf9TqZF6GHAu8JPcL2EA\n0i/a+4DvpIb4fYDP5667iKyapdxreICs6uSbkjaT1E5W119tl9f1zhsRT5G1kXyjyuO7Gq8PlzQi\n1f0fRpYwHiy1f0S8TFaNdTXwXPqRgKRtJR2R2jZWkn3Rr64m7io8DHxC0iBlXbmPpoeJJyJWAheQ\nVWdZgzlpWN6bwIHAg5LeIksWjwBfB4iIW8l6uNwo6XWyNosP544v9cffvdGzXCNo3reBh9K1H0nL\n304x3EHWkH038BTrElq5bsEBXEf2xfgSMBg4uUwMx5KVcF4EfgacHRG/Tdu6ehotlfTQBhfJvsg+\nChwGvAz8J1m9+1O561T6ciy1/ftkDdvb5vap5HXgTLJqsVeB84ETIuK+CsfMIOtUMCO3bhOyzgad\nZFWQ7wW+0oO4Kz3/N2DXFN90UpVYFbqf80pg29Qobg2ket2EKf1KvZZsQFMA/x0RP5A0nayR7+W0\n65mpCx2SziD7dbcaODki7kzr3032Rz8E+FVEnFKXoK3fkbQnWfIaXGoMhKS7gesi4sqGB2c2ANWz\npLESODUi9iLrWXJS+gMP4MKI2C89uhLGRLLGt4nAFLLBO11F38uA4yNiAjAhdbu0FiXpqFSFtBVZ\nyef2CoPmoOdVKGZWRt2SRkQsioiH0/JbwOOs60lS6o/4CLIRsSsjYgHwDHCgpDZgRK4r4LVkjXbW\nur5E1ivrGbIfJ+WqTro07fQkZv3NoEZcRNLOZP3zHwAOBb4m6TNkddVfj4jXyLos5nvhLCRLMitZ\nvwdKJz3rxmgDTEQc1oN931/PWMxaTSNm9xxO1rXvlFTiuAzYBdiXrGHygnrHYGZmtVHXkkaaWuFm\n4PrU84aIWJLbfjlZt0LIShD5Pvc7kJUwOtNyfn0n3UhyFYSZWS9ERNXtfnUraaRG7CuA+RFxcW59\nfjDPUWQ9XwBuJ+u/PVjSLmTzCs2JiEXAG5IOTOf8NHBrqWtGhB81ekybNq3wGAbSw++n38tmffRU\nPUsah5JN0/yI1s0KeiZwrKR9yRonnwe+DBAR8yXdBMwnm1TuxFj3ik4k63I7lKzL7R11jNvMzMqo\nW9KIiN9TuiQzq8Ix55HNBtp9/R/JZkg1M7MCeUS4ldTe3l50CAOK38/a8XtZrLqNCG80STFQXouZ\nWaNIInrQEN6QcRpmZv1V+Tkq+59a/LB20jAz24iBUItRq+TnNg0zM6uak4aZmVXNScPMzKrmpGFm\nZlVz0jAz68dmzJjBpEmTGDFiBOPGjePwww/n3nvvrdv1nDTMzPqpCy+8kFNPPZWzzjqLJUuW8MIL\nL3DSSSdx++231+2aHtxnZlZBGvxWdBgbeP3119lhhx24+uqrOfrooze6f7nX0dPBfS5pmJn1Q/ff\nfz8rVqzgqKOOauh1PbjPzKwPajVgvKeFmaVLlzJmzBg22aSxv/2dNMzM+qComqvRo0fzyiuvsGbN\nmoYmDldPmZn1QwcffDCbb745t9xyS0Ov66RhZtYPjRw5knPPPZeTTjqJ2267jWXLlrFy5UpmzZrF\naaedVrfruveUmVkFzdp7qsuMGTO46KKLePzxxxkxYgSTJk3iW9/6FgcddNB6+9Wq95SThplZBc2e\nNKrlLrdmZtZwThpmZlY1J43krrvgD38oOgozs+bmcRrJ3XfDkCGw//5FR2Jm1rxc0kjGjYOXXio6\nCjOz5uakkbS1OWmYmW2Mq6cSJw0zK0e1mmBqAHDSSNra4MUXi47CzJrNQBijUUse3Jf87W+w5Zaw\nYkXtZq00M2t2HtzXS5tvDsOHw9KlRUdiZta8nDRy3K5hZlaZk0aO2zXMzCpz0sjxWA0zs8qcNHJc\nPWVmVpmTRo6ThplZZU4aOW7TMDOrzEkjx20aZmaVOWnkuHrKzKyyuiUNSeMl3S3pMUmPSjo5rd9a\n0mxJT0m6U9Ko3DFnSHpa0hOSJufWv1vSvLTtknrF3JU0BsggeTOzmqtnSWMlcGpE7AUcBJwkaU/g\ndGB2ROwG/CY9R9JEYCowEZgCXKp1s4RdBhwfEROACZKm1CPgYcNg8GB47bV6nN3MrP+rW9KIiEUR\n8XBafgt4HNge+BhwTdrtGuDItHwEMDMiVkbEAuAZ4EBJbcCIiJiT9rs2d0zNuV3DzKy8hrRpSNoZ\n2A94EBgbEYvTpsXA2LQ8DliYO2whWZLpvr4zra8Lt2uYmZVX96nRJQ0HbgZOiYg38/PSR0RIqlkL\nwvTp09cut7e3097e3uNzOGmY2UDW0dFBR0dHr4+va9KQtBlZwrguIm5NqxdL2i4iFqWqpyVpfScw\nPnf4DmQljM60nF/fWep6+aTRWx6rYWYDWfcf1Oecc06Pjq9n7ykBVwDzI+Li3KbbgePS8nHArbn1\nn5A0WNIuwARgTkQsAt6QdGA656dzx9Sc2zTMzMqrZ0njUOBTwCOS5qZ1ZwDnAzdJOh5YABwDEBHz\nJd0EzAdWASfm7qp0InA1MBT4VUTcUa+g29pgzpyN72dm1op8575uOjrg7LPhnnv6HpOZWbPznfv6\nyNVTZmblOWl0495TZmblOWl0M2JE9u+bbxYbh5lZM3LSKMHdbs3MSnPSKMHtGmZmpTlplOB2DTOz\n0pw0SnDSMDMrzUmjBLdpmJmV5qRRgts0zMxKc9IowdVTZmalOWmU4KRhZlaak0YJbtMwMyvNSaOE\nUaPgnXdg2bKiIzEzay5OGiVIrqIyMyvFSaMMJw0zsw05aZThdg0zsw05aZThsRpmZhty0ijD1VNm\nZhty0ijDScPMbENOGmW4TcPMbENOGmW4TcPMbENOGmW4esrMbENOGmWMHg1vvQUrVhQdiZlZ83DS\nKEOCsWNh0aKiIzEzax5OGhW4XcPMbH1OGhW4XcPMbH1OGhW4262Z2fqcNCpw9ZSZ2fqcNCpw9ZSZ\n2fqcNCpw0jAzW5+TRgVu0zAzW5+TRgVu0zAzW58iougYakJS1Pq1rFkDQ4bA22/DZpvV9NRmZk1B\nEhGhavd3SaOCTTaBbbaBxYuLjsTMrDk4aWyE2zXMzNapa9KQdKWkxZLm5dZNl7RQ0tz0OCy37QxJ\nT0t6QtLk3Pp3S5qXtl1Sz5i7c7uGmdk69S5pXAVM6bYugAsjYr/0mAUgaSIwFZiYjrlUUlc922XA\n8RExAZggqfs568bdbs3M1qlr0oiI3wGvlthUqtHlCGBmRKyMiAXAM8CBktqAERExJ+13LXBkPeIt\nxUnDzGydoto0vibpT5KukDQqrRsHLMztsxDYvsT6zrS+IdymYWa2ThFJ4zJgF2Bf4CXgggJiqJrb\nNMzM1hnU6AtGxJKuZUmXAz9PTzuB8blddyArYXSm5fz6zlLnnj59+trl9vZ22tvb+xyvq6fMbCDp\n6Oigo6Oj18fXfXCfpJ2Bn0fE3ul5W0S8lJZPBfaPiE+mhvAZwAFk1U93AX8XESHpQeBkYA7wS+AH\nEXFHt+vUfHAfQGcn7L+/q6jMbGDq6eC+upY0JM0E3geMkfQCMA1ol7QvWS+q54EvA0TEfEk3AfOB\nVcCJuSxwInA1MBT4VfeEUU9jx8LLL8Pq1bDppo26qplZc/I0IlXYbjuYOzerqjIzG0g8jUgduF3D\nzCzjpFEFd7s1M8s4aVTBJQ0zs4yTRhU8VsPMLOOkUQWXNMzMMk4aVXCbhplZxkmjCi5pmJllnDSq\n4DYNM7OMB/dV4Z13YPhwWLEiuwWsmdlAUdfBfZK2yt0YqWUMHgxbbgmvvFJ0JGZmxSqbNCRNk7Rn\nWt5c0t3As8BiSR9qVIDNwlVUZmaVSxpTgSfS8nFkd9vbhmwCwvPqHFfTcWO4mVnlpPG3XCPBFODG\niFgdEY9TwH04iuakYWa2kaQhaW9J2wDtwJ25bcPqGlUT8lgNM7PKSeP/AD8FngQuiojnACT9b+B/\nGhBbU3GbhplZhWqmiHgA2L3E+l+S3T2vpbS1QR/ukGhmNiCUTRqSvk52d721q3LLEREX1i2qJuQ2\nDTOzytVTI9JjS+AbwPDcY0T9Q2subtMwM6tyRLikuRGxXwPi6bV6jggHWL4cttoq+7f1hjea2UDl\n273WydCh2ePVV4uOxMysOE4aPeB2DTNrdZUawuflnu7a7XlExD71C6s5dbVr7LVX0ZGYmRWj0sju\nj1bYNjCmxu0hj9Uws1ZXaZzGglLr0yy3xwB/rlNMTcvVU2bW6irNcjtc0tclXSrpREmbSDoKeAz4\nl8aF2Dzc7dbMWl2l6qlrgTeA+4HJwGeBFcAnI+Lh+ofWfNra4P77i47CzKw4lZLG33U1dku6HHgJ\n2CkiljcksibkNg0za3WVutyu7lqIiNVAZysnDHCbhplZ2RHhklYDy3KrhgJdSSMiYss6x9Yj9R4R\nDvDWW7DttvD22x4VbmYDQ09HhFfqPbVpbUIaOIYPh003hTfegJEji47GzKzxPCK8h9yuYWatzEmj\nh9yuYWatzEmjhzxWw8xamZNGD7mkYWatzEmjh9ymYWatzEmjh1zSMLNWVtekIelKSYvz06pL2lrS\nbElPSbpT0qjctjMkPS3pCUmTc+vfLWle2nZJPWPeGLdpmFkrq3dJ4ypgSrd1pwOzI2I34DfpOZIm\nAlOBiemYS9OMugCXAcdHxARggqTu52wYV0+ZWSura9KIiN8B3W+Q+jHgmrR8DXBkWj4CmBkRK9O0\n7M8AB0pqA0ZExJy037W5YxrO1VNm1sqKaNMYGxGL0/JiYGxaHgcszO23ENi+xPrOtL4QW24Jq1Zl\nU4qYmbWaQhvC02RR/eougJJLG2bWuipNjV4viyVtFxGLUtXTkrS+Exif228HshJGZ1rOr+8sdeLp\n06evXW5vb6e9vb12Ued0tWtMmFCX05uZ1U1HRwcdHR29Pr7sLLe1Imln4OcRsXd6/j1gaUR8V9Lp\nwKiIOD01hM8ADiCrfrqL7J4eIelB4GRgDvBL4AcRcUe369R9ltsuxxwDRx8NU6c25HJmZnVTs1lu\naxTMTOB9wBhJLwBnA+cDN0k6HlhAdr9xImK+pJuA+cAq4MRcFjgRuJpsevZfdU8YjeZut2bWqupe\n0miURpY0zj8f/vpX+N73GnI5M7O66WlJwyPCe8FjNcysVTlp9IJ7T5lZq3LS6AW3aZhZq3LS6AWX\nNMysVTlp9MLWW8Py5dnDzKyVOGn0ggTbbQeLFhUdiZlZYzlp9JLbNcysFTlp9JLbNcysFTlp9JLH\naphZK3LS6CWXNMysFTlp9JLbNMysFTlp9JJLGmbWipw0esltGmbWipw0esklDTNrRZ4avZfWrIEh\nQ7J7hQ8e3LDLmpnVlKdGb5BNNoFtt/WocDNrLU4afeB2DTNrNU4afeB2DTNrNU4afeCxGmbWapw0\n+sDVU2bWapw0+sDVU2bWapw0+sDVU2bWapw0+sAlDTNrNU4afeA2DTNrNR4R3gerV8PQobBsGQwa\n1NBLm5nVhEeEN9Cmm8Lo0bB4cdGRmJk1hpNGH7ldw8xaiZNGH7ldw8xaiZNGH7mkYWatxEmjjzxW\nw8xaiZNGH7mkYWatxEmjj9ymYWatxEmjj1zSMLNW4qTRR27TMLNW4hHhffTOOzB8OCxfng32MzPr\nTzwivMEGD4ZRo+CVV4qOxMys/gpLGpIWSHpE0lxJc9K6rSXNlvSUpDsljcrtf4akpyU9IWlyUXGX\n4nYNM2sVRZY0AmiPiP0i4oC07nRgdkTsBvwmPUfSRGAqMBGYAlwqqWlKSW7XMLNWUfQXb/d6tI8B\n16Tla4Aj0/IRwMyIWBkRC4BngANoEi5pmFmrKLqkcZekhyR9Ma0bGxFdc8YuBsam5XHAwtyxC4Ht\nGxPmxnmshpm1iiLvAnFoRLwkaRtgtqQn8hsjIiRV6g61wbbp06evXW5vb6e9vb1GoVbW1gaPP96Q\nS5mZ9UlHRwcdHR29Pr4putxKmga8BXyRrJ1jkaQ24O6I2EPS6QARcX7a/w5gWkQ8mDtHIV1uAW6+\nGa6/Hm65pZDLm5n1Wr/ocitpmKQRaXkLYDIwD7gdOC7tdhxwa1q+HfiEpMGSdgEmAHMaG3V5btMw\ns1ZRVPXUWOAWSV0x3BARd0p6CLhJ0vHAAuAYgIiYL+kmYD6wCjixsGJFCW7TMLNW0RTVU7VQZPXU\nihUwcmT2r6ou5JmZFa9fVE8NNEOGwBZbwNKlRUdiZlZfTho14ioqM2sFTho14sZwM2sFTho14qlE\nzKwVOGnUiEsaZtYKnDRqxG0aZtYKnDRqxCUNM2sFTho14jYNM2sFTho14pKGmbUCjwivkbffhjFj\nYNkyjwo3s/7DI8ILssUW2f3CX3+96EjMzOrHSaOGxo+HX/6y6CjMzOrHSaOGrrwSzjgDzjoLVq8u\nOhozs9pzm0aNLVkCU6fC5pvDDTfA6NFFR2RmVp7bNAq27bYwezbsvTfsvz/MnVt0RGZmteOkUQeD\nBsH3vw/nnw8f/jBce23REZmZ1Yarp+rsscfgn/4J/vEf4aKLsh5WZmbNwtVTTWavvWDOHOjshPb2\n7F8zs/7KSaMBRo6En/0MPvIROOAAuOeeoiMyM+sdV0812K9/DZ/5TNY195RTPHrczIrV0+opJ40C\nPP88HH007LEH/OhH2WhyM7MiuE2jH9hlF7j33qxR/OCD4Zlnio7IzKw6ThoFGToUrroKvvIVOOQQ\n+MUvio7IzGzjXD3VBO6/H445Bj7/eZg2DTZxKjezBnGbRj+1aFE2/cjw4XD99bDVVkVHZGatwG0a\n/dR228Fdd8Huu8OkSfCnPxUdkZnZhpw0mshmm8GFF8K3v52NIL/++qIjMjNbn6unmtS8edn0I4cd\nBhdckCUUM7Nac/XUALH33vCHP2RjOj7wAd9/3Myag5NGExs1Cm67DT70oWya9XvvLToiM2t1rp7q\nJ2bNgs9+Nrsr4Fe/6ulHzKw23OV2AHv22Wz6kb33hh/+EIYNKzoiM+vv3KYxgO26K9x3X7Z8yCHw\n3HPFxmNmrcdJo58ZNiy7E+AXvpDNWzVrVtERmVkrcfVUP3bvvdn0I1/+ctbW4elHzKynBmz1lKQp\nkp6Q9LSk04qOpxkceig89BDMng1HHAGvvVZ0RGY20PWLpCFpU+A/gSnAROBYSXsWG1VzaGuD3/4W\n3vWurFvuvHm1OW9HR0dtTmSA389a8ntZrEFFB1ClA4BnImIBgKQbgSOAx4sMqllsthlcckmWND7w\nATjhBBgzJpt+vesxZEjl50OHwqBB67rydnR00N7eXujrGkj8ftaO38ti9ZeksT3wQu75QuDAgmJp\nWp/6FOyzD9xwQ3Zjp+XLYcWK7N+uR6XnEesSyDvvwIwZG0801SSjSvsMHuwxJ2b9SX9JGq3Vwt0H\n++yTPXpj5cp1SeS887ISS7VJ5/XXs+nde5Kkli+HVavKJ5ohQzZMKJWe92TfWj/f2L5PP521P1nf\nPfUU/PGPRUfRuvpF7ylJBwHTI2JKen4GsCYivpvbp/lfiJlZExpwI8IlDQKeBD4IvAjMAY6NCLdp\nmJk1UL+onoqIVZK+Cvwa2BS4wgnDzKzx+kVJw8zMmkO/GKexMR74V1uSFkh6RNJcSXOKjqc/kXSl\npMWS5uXWbS1ptqSnJN0paVSRMfYnZd7P6ZIWps/nXElTioyxv5A0XtLdkh6T9Kikk9P6Hn0++33S\n8MC/ugigPSL2i4gDig6mn7mK7LOYdzowOyJ2A36Tnlt1Sr2fAVyYPp/7RcQdBcTVH60ETo2IvYCD\ngJPSd2WPPp/9PmmQG/gXESuBroF/1jcePdELEfE74NVuqz8GXJOWrwGObGhQ/ViZ9xP8+eyxiFgU\nEQ+n5bfIBkdvTw8/nwMhaZQa+Ld9QbEMFAHcJekhSV8sOpgBYGxELE7Li4GxRQYzQHxN0p8kXeHq\nvp6TtDOwH/AgPfx8DoSk4Zb82js0IvYDDiMrwr636IAGijQVsz+zfXMZsAuwL/AScEGx4fQvkoYD\nNwOnRMSb+W3VfD4HQtLoBMbnno8nK21YL0XES+nfl4FbyKoArfcWS9oOQFIbsKTgePq1iFgSCXA5\n/nxWTdJmZAnjuoi4Na3u0edzICSNh4AJknaWNBiYCtxecEz9lqRhkkak5S2AyUCN5s5tWbcDx6Xl\n44BbK+xrG5G+2LochT+fVZEk4ApgfkRcnNvUo8/ngBinIekw4GLWDfz7TsEh9VuSdiErXUA2+PMG\nv5/VkzQTeB8whqx++GzgNuAmYEdgAXBMRPjuJ1Uo8X5OA9rJqqYCeB74cq5O3sqQ9B7gHuAR1lVB\nnUE2w0bVn88BkTTMzKwxBkL1lJmZNYiThpmZVc1Jw8zMquakYWZmVXPSMDOzqjlpmJlZ1Zw0zBpM\n0rRuz1enKb4fkfSzNM2DWVPyOA2zBpH0L0AbMBr4K9AZETMkvRkRXaPwrwbmRYTnU7Km5JKGWQ+k\n6WqekHSVpCcl3SBpsqT70k1s9k83Cfp67phHJe0YETeQzZX2DeDPETGjxCXuB3Zt0Msx6zEnDbOe\n2xX4f8AewO7A1Ig4BPhX4Ew2nCU0yKb+OZZs2v7vAzul52ulG4pNBh6tb/hmvTeo6ADM+qHnI+Ix\nAEmPAXel9Y8COwMPlzgmImJmOmZaRHw/t22opLlkCWUB8F91itusz1zSMOu5v+WW1wDv5JYHAatY\n/29rSP7giDin2/mWp/uX7ASswHeetCbmpGFWewuAfwCQ9A9kNwzaqIhYDpwM/Eeaxtqs6ThpmPVc\nqTaL/PLNwNaSHgVOAp6s9nzpHs7PAMfUIE6zmnOXWzMzq5pLGmZmVjUnDTMzq5qThpmZVc1Jw8zM\nquakYWZmVXPSMDOzqjlpmJlZ1Zw0zMysav8f0zsJhFWv4AIAAAAASUVORK5CYII=\n", - "text": [ - "" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " The shield radius required = 14.00 cm \n", - "\n" - ] - } - ], - "prompt_number": 38 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg561" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 10.3\n", - "import math\n", - "import warnings\n", - "warnings.filterwarnings('ignore')\n", - "import numpy\n", - "%matplotlib inline\n", - "import matplotlib\n", - "from matplotlib import pyplot\n", - "\n", - "## Given data\n", - "E = 2.; ## Energy of gamma rays in MeV\n", - "X_dot = 2.5; ## Exposure rate in mR/hour\n", - "phi0 = 10**9; ## Intensity of gamma rays in gamma-rays/cm^2-sec from isotropic point source\n", - "## Using the data from Table II.5 for 1 MeV \n", - "mua_rho_air = 0.0238; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", - "phi_b = X_dot/(0.0659*E*mua_rho_air); ## Buildup flux in gamma-rays/cm^2-sec\n", - "\n", - "## From standard data tables for concrete\n", - "rho = 2.35; ## Density of concrete in g/cm^3\n", - "## Using the data from Table 10.3 for concrete at 2 MeV\n", - "A1 = 18.089;\n", - "A2 = 1-A1;\n", - "alpha1 = -0.0425;\n", - "alpha2 = 0.00849;\n", - "## Using Eq 10.26\n", - "#print'%s %.2f %s'%(\" \\n The equation to calculate thickness is \\n %.2E = (%E/2) *(%4.3f*E1(%4.3f*mu*a) %4.3f*E1(%4.3f*mu*a)) \\n\",phi_b,phi0,A1,(1+alpha1),A2,(1+alpha2));\n", - "## Using the data from Table II.4 for E = 1 MeV for concrete\n", - "mu_rho = 0.0445; ## The ratio of total attenuation coefficient to density in cm^2/g\n", - "mu = mu_rho*rho;\n", - "## On solving the right hand side of equation\n", - "## RHS = 1.13*10^7*(E1(0.9575*mu*a)-0.94*E1(1.00849*mu*a))\n", - "## Let mu*a = x\n", - "x = numpy.array([1 ,2 ,4 ,7 ,10, 15, 20]);\n", - "leng=len(x)\n", - "RHS= numpy.zeros(leng);\n", - "for i in range(0,leng):\n", - " RHS[i] = 1.13*10**7*(math.exp(-0.9575*x[i])*((1./(0.9575*x[i])+(1/(0.9575*x[i])**3))) - math.exp(-1.00849*x[i])*((1./(1.00849*x[i])+(1./(1.00849*x[i])**3))));\n", - "\n", - "pyplot.plot(x,RHS)\n", - "pyplot.legend(\"Conical\",\"2D-CD\")\n", - "pyplot.xlabel(\"mu*R\")\n", - "pyplot.ylabel(\"RHS\")\n", - "pyplot.title(\"Semilog plot of RHS vs mu*R\")\n", - "pyplot.show()\n", - "## From the graph\n", - "mua = 13.6; ## This is the value when RHS = 1\n", - "## Calculation\n", - "a = mua/mu;\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n The concrete thickness = \",a,\" cm \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "display_data", - "png": "iVBORw0KGgoAAAANSUhEUgAAAaAAAAEZCAYAAADR8/HkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xu8VXWd//HXm6uCyFVQLirTYCONTV5GrKZHxzERrVGb\nTKhUpmHq1+BM1ymzi4BayfQr8zfz0GYmL2CKmpbiVAip5zFOiVhpYqhAhsEhUA+CeOfy+f2xvtuz\n2OxzOEfO3msf9vv5eOzHWeu71ve7vnuz2Z/9/azvWlsRgZmZWa31KroDZmbWmByAzMysEA5AZmZW\nCAcgMzMrhAOQmZkVwgHIzMwK4QBkPZ6kd0l6PLe+RtJJNe7D4ZJ2Sqr6/ylJ+0u6U9JmSTdX+3hm\n1eIAZFUj6a8k/SJ9ULZK+l9Jx3X3cSLivoj4s3xRetQlSbMlXb8XTZwFjASGRcTUdtrfJmlreu2X\nSnpXbnuTpLUV6jVLmpFb/5KkJ1M7ayXdtBd9LoSka8vWm9IXha2Snpe0UtLHi+pfo3MAsqqQdCDw\n38AVwFBgDDAHeLXIfu0jDgNWRsTOdrYHsCAiBgHDgZ8Bt3ai3dcDt6TpwDnASamd41I7PYKkf5X0\n52l5gKRvSxqXNrdExKCIOBD4FHClpLcU1tkG5gBk1XIEEBFxc2ReiYglEbG8tIOkv5e0QtImSYsk\nHZrbtlPSP0palb6pXizpTZLuT9/qb5LUN+1b8Rt92tZf0ncktaTH5ZL65bZ/QdJ6Sesk/UM67p+0\n01azpG9IekDSFkm3Sxrazr6jJS1MI79Vkv4hlU8BLgSmpm/hD7VT/8h0vOckPSrpb1L5HOCrufof\nrVQ9PYiIHcCNwEGSRlQ6VjuOA+6KiN+ndjZGxPfa6esFkn5QVnaFpCvS8t9J+l36d3xS0ofbaWe2\npB9Iuj7t+4ikCZIulLRR0lOSTs7tv0uqtWxkORf4BHAiMB+4NSJ2e49ExE+BVuDIzr801l0cgKxa\nngB2SLpO0pTyD2pJZ5B9EL8fGAHcBywoa2MycDRwAnAB8F/Ah4BDgaPS8p58GTge+Iv0OB74SurD\nFOAzwEnABKCJPafuzgU+ChwCbAf+Xzv73QT8Ie13FvB1SSdGxCLg68BN6Vv40eUVU2C9E1gEHAT8\nM3CDpCMiYlZZ/WvL65e11Q84D/hdRDy7h+eWtxQ4T9K/SDpOUu8O9l0AnCbpgHTM3sAHU58Hko2C\np6QRx9uBhzto631kAWMo8BCwJJWPBi4B/iO3b3mqNb8sYGeuXOUHktRL0unA4HQsqzEHIKuKiNgK\n/BXZf/7/Ap6WdIekkWmXTwDfiIgnUirpG8DbcmkSgH+NiBciYgWwHPhpRKyJiOeBn5IFpz35MHBx\nRDybPoDnkAURgLOBayLisYh4GZhFhQ+q/NMC5kfEioh4iWwkcrakXeqk5/AO4IKIeC0ifgN8jywQ\nQG6E0o4TgIERcVlEbI+Ie8nSmaWAu6f6pH49B7wE/ANwWtn20Wl09fqD7N8re6IRN5AFvlOAZmCj\npC9UOlBE/AH4NdmXCYC/Bl6KiGVpfSdwlKT900hqRQf9/p80Ut5BljYcDlyW1m8GDk/p3Uryr8kX\ngP8E7gWmA2fl3lujc6/Nj4BzI+J3HfTJqsQByKomIh6PiI9GxDjgz8m+xX4nbT4MuCL34deaysfk\nmtiYW365bP0V4IBOdGM08FRu/Q+pDLLRST4ts64T7eX3/wPQl2wEV37MTRHxYtm+Y+ic0WXHgew5\ndLY+wM0RMRQYBTxKFkzy1kfE0PwD+N/8DhFxY0ScTDZC+ARwiaTJ7RzvRtoC5IeBG1IbLwJTU/31\nkv5b0ps76PfTueWXgWej7Y7JL6e/7f27vz4CiogvRMSjafmliPhMLgW3Pj3fA8lGZ19SDWYv2u78\noltNRMQTwDyyQATZB/LHyz4EB0bE0s422cn91gOH59YPBVrS8h+B/Igrv9yeQ8uWtwHlqa31wLBS\nSiq3bynA7anv64FxZSOrw+hcgCy1XzoH1Ap8HPh4e+e29thYxI6IuBV4BGjvZP2tQJOkMcCZZAGp\nVH9xREwGDgYeJxsRt9fvrngRGJhbP6RC3yudIytte40stTuYtlGx1ZADkFWFpDdL+mz6QCqlpT4E\n3J92+S7ZN8+JaftgSR/cU7PtLHdkAfAVSSPSSfiLgO+nbbcAH5X0Z5IGkKXU9nT8c9IEgQHAxcAP\nct/QAUjftH8BfCNNgngr8Pe5424gSyW19xyWkqWHviCpr6QmsnMjnZ0GvUu7EbGS7JzS5ztZvzRx\n4DRJg9K5klPJgs8DlfaPiGfIUnXXAU+mLxxIGinpjHQuaBtZ0NjRmX53wsPANEl9lE3v/wBdDGIR\nsQ34FlnKzmrMAciqZSswCXhA0gtkgecR4HMAEXE72UylmyRtITvHc0qufqUPkvITzu2dgM67FPhl\nOvYjafnS1IdFZJMI7gVW0hYc25sqHsD1ZB+yfwT6AZ9spw8fIht5rQd+CFwUEfekbaUZY62Sfrnb\nQbIPxb8BTgWeAf6d7DzFytxxOvqgrbT9m2STCkbm9unIFuBLZKm/54DLgE9ExC86qHMj2YSOG3Nl\nvcgmerSQpVnfBfxjF/rd0fpXgTel/s0mpf06obzNa4CRaUKC1ZCq9YN0kq4B3gs8HRFHlW37HNl/\niBERsSmVXUj2LXEH8MmIWJzKjyX7D78f8JOI+FQq7082W+YYsjf21Ih4Km2bTjb7CeDSiJifyseT\nfYscBvyK7D/1tqq8ANbjSDqSLBD2q3SNjaR7gesj4pqad85sH1TNEdC1wJTywpSKOZncieGUhpkK\nTEx1rsylJ64CZkTEBGBCmjoLMANoTeWXk32bRtIwsjTL8ekxS9LgVGcu8K1U57nUhjUwSe9PabKh\nZO+PhR1c4AldTxOZWTuqFoAi4j6yD/ly32b3fOsZZFdub4uINcBqYJKkQ4BBuemc88lOcAKcTnZS\nG+A2sqE/ZGmcxRGxOSI2k11HcGoKaCfSdkX4vFxb1rg+Tja7bjXZOYr20kMldXuLH7Oepk8tD5Yu\nPlwXEY+UnX8dTXbitWQd2ZTTbew686eFtqmoY0hTVSNiu7Ir04enttZVaGsYsDn37TbfljWoiDi1\nC/ueWM2+mDWamgWgNGvoS2Tpt9eLa3R4f2s1M6sztRwBvYlsVtBv0uhnLPArSZPIRiP5azDGko1c\nWtJyeTlp26FkF7f1AQZHRKukFrJbqpSMA+4BNgFDJPVKo6CxtF0PsgtJDlhmZm9ARHR6YFGzadgR\nsTwiRkXE+IgYTxZIjomIjcBCsvn8/dJMtQnAsojYADwvaVI6h3MucEdqciHZLTYgu9fW3Wl5MTBZ\n0pB0YvlkspsqBtl029K1JtOB2zvorx/d9Jg1a1bhfdhXHn4t/XrW86OrqhaAJC0guxjvCGW/JVJ+\nRXL+thkryC4KXEF2j6+Z0fZsZpLdR2sVsDqyazcArgaGS1oFfBr4YmprE9lNCx8ElgFzIpuMANlV\nz59NdYamNszMrABVS8FFRId3Ko6IPylb/zrZXX7L9/sV2Z2Py8tfJbuZZKW2ryWbBl5e/nuyiyPN\nzKxgvhNCFSxcCM9VmoDeoJqamoruwj7Dr2X38utZrKrdCaEnkxR787qccAJcfjm8/e3d2Ckzszon\niejCJISaXgfUKEaOhI0b97yfmTWO9u892zN1x+DFAagKRo1yADKz3e0rGafuCqY+B1QFo0bB00/v\neT8zs0bmAFQFTsGZme2ZA1AVOAVnZrZnDkBV4BScmdmeOQBVgVNwZtYT3XjjjRx33HEMGjSI0aNH\nc9ppp/Hzn/+8asdzAKoCp+DMrKf59re/zWc+8xm+8pWv8PTTT7N27VrOP/98Fi5cWLVj+kLUCvb2\nQtSdO6F/f3jxRejXrxs7ZmY9VrpIs+huVLRlyxbGjh3Lddddxwc+8IE97t/ec+nqhageAVVBr15w\n0EE+D2RmPcP999/PK6+8wvvf//6aHtcBqEo8EcHMukrqnkdXtba2MmLECHr1qm1I8J0QqsQTEcys\nq4rK0A0fPpxnn32WnTt31jQIeQRUJZ6IYGY9xdvf/nb69+/Pj370o5oe1wGoSpyCM7OeYvDgwVx8\n8cWcf/753HHHHbz00kts27aNn/70p1xwwQVVO65TcFUyciRs2FB0L8zMOuezn/0sBx98MJdeeikf\n+chHGDRoEMcddxxf/vKXq3ZMT8OuYG+nYQPMnw+LF8P3v99NnTKzHq2ep2F3ladh1zmn4MzMOuYA\nVCWeBWdm1jEHoCrxLDgzs475HFAF3XEOaNs2GDAAXn01uzOCmTU2nwPanT8aq6RvXzjwQGhtLbon\nZmb1qWoBSNI1kjZKWp4r+6akxyT9RtIPJQ3ObbtQ0ipJj0uanCs/VtLytO2KXHl/STen8qWSDstt\nmy5pZXqclysfL+mBVOcmSX2r9fzBExHMzDpSzRHQtcCUsrLFwFsi4i+AlcCFAJImAlOBianOldLr\ndzS6CpgREROACZJKbc4AWlP55cDc1NYw4CLg+PSYlQt0c4FvpTrPpTaqxueBzCxP0j7x6C5VC0AR\ncR/Zh3y+bElE7EyrDwBj0/IZwIKI2BYRa4DVwCRJhwCDImJZ2m8+cGZaPh2Yl5ZvA05Ky6cAiyNi\nc0RsBpYAp6aAdiJwa9pvXq6tqvBMODMriYh96tEdijwH9PfAT9LyaGBdbts6YEyF8pZUTvq7FiAi\ntgNbJA3voK1hwOZcAMy3VRVOwZmZta+QW/FI+jLwWkTcWKNDdjlcz549+/XlpqYmmpqaunxQj4DM\nbF/W3NxMc3PzG65f8wAk6e+A02hLmUE2GhmXWx9LNnJpoS1Nly8v1TkUWC+pDzA4IloltQBNuTrj\ngHuATcAQSb3SKGhsaqOifAB6o0aNgqVL97oZM7O6VP7lfM6cOV2qX9MUXJpA8HngjIh4JbdpITBN\nUj9J44EJwLKI2AA8L2lSOodzLnBHrs70tHwWcHdaXgxMljRE0lDgZOCudGHPvcAH037Tgdur8kQT\np+DMzNpXtRGQpAXAu4ERktYCs8hmvfUDlqSZFPdHxMyIWCHpFmAFsB2YmbsSdCZwHbA/8JOIWJTK\nrwaul7QKaAWmAUTEJkmXAA+m/eakyQgAFwA3SboU+HVqo2qcgjMza5/vhFBBd9wJAeD3v4emJnjq\nqb3vk5lZvfOdEOrIyJFZCs4x3sxsdw5AVTRwIPTuDVu3Ft0TM7P64wBUZZ6IYGZWmQNQlfl2PGZm\nlTkAVZlnwpmZVeYAVGVOwZmZVeYAVGUeAZmZVeYAVGU+B2RmVpkDUJU5BWdmVpkDUJU5BWdmVpkD\nUJU5BWdmVpkDUJU5BWdmVpkDUJUNGQIvvQSvvLLnfc3MGokDUJVJ2XmgZ54puidmZvXFAagGfB7I\nzGx3DkA14JlwZma7cwCqAU9EMDPbnQNQDXgEZGa2OwegGvA5IDOz3TkA1YBTcGZmu3MAqgGn4MzM\nducAVANOwZmZ7c4BqAacgjMz213VApCkayRtlLQ8VzZM0hJJKyUtljQkt+1CSaskPS5pcq78WEnL\n07YrcuX9Jd2cypdKOiy3bXo6xkpJ5+XKx0t6INW5SVLfaj3/vBEjYNMm2LGjFkczM+sZqjkCuhaY\nUlb2RWBJRBwB3J3WkTQRmApMTHWulKRU5ypgRkRMACZIKrU5A2hN5ZcDc1Nbw4CLgOPTY5akwanO\nXOBbqc5zqY2q69Mnuydca2stjmZm1jNULQBFxH1kH/J5pwPz0vI84My0fAawICK2RcQaYDUwSdIh\nwKCIWJb2m5+rk2/rNuCktHwKsDgiNkfEZmAJcGoKaCcCt1Y4ftX5PJCZ2a5qfQ5oVESUPoY3AqPS\n8mhgXW6/dcCYCuUtqZz0dy1ARGwHtkga3kFbw4DNEbGzQltV55lwZma76lPUgSMiJEWtDtfVCrNn\nz359uampiaampr3qgCcimNm+prm5mebm5jdcv9YBaKOkgyNiQ0qvlT6SW4Bxuf3Gko1cWtJyeXmp\nzqHAekl9gMER0SqpBWjK1RkH3ANsAoZI6pVGQWNTGxXlA1B38AjIzPY15V/O58yZ06X6tU7BLQSm\np+XpwO258mmS+kkaD0wAlkXEBuB5SZPSOZxzgTsqtHUW2aQGgMXAZElDJA0FTgbuiogA7gU+WOH4\nVedzQGZmu6raCEjSAuDdwAhJa8lmpl0G3CJpBrAGOBsgIlZIugVYAWwHZqaAATATuA7YH/hJRCxK\n5VcD10taBbQC01JbmyRdAjyY9puTJiMAXADcJOlS4NepjZoYNQpWr67V0czM6p/aPuetRFJ09+ty\n553w3e/Cj3/crc2amdUNSUSE9rxnxndCqBGn4MzMduUAVCOeBWdmtiun4CqoRgru5Zdh6NDsrzo9\nQDUz6zmcgqtT++8P/frB888X3RMzs/rgAFRDPg9kZtbGAaiGfDGqmVkbB6Aa8kQEM7M2DkA15BGQ\nmVkbB6Aa8jkgM7M2DkA15BScmVkbB6AacgrOzKyNA1ANOQVnZtbGAaiGnIIzM2vjAFRDTsGZmbVx\nAKqhwYPhtdey+8GZmTU6B6AakrJRkNNwZmYOQDXnNJyZWcYBqMY8EcHMLOMAVGMeAZmZZRyAaszX\nApmZZRyAaswpODOzjANQjTkFZ2aWcQCqMafgzMwyhQQgSRdK+q2k5ZJulNRf0jBJSyStlLRY0pCy\n/VdJelzS5Fz5samNVZKuyJX3l3RzKl8q6bDctunpGCslnVe7Z51xCs7MLFPzACTpcOBjwDERcRTQ\nG5gGfBFYEhFHAHendSRNBKYCE4EpwJWSlJq7CpgREROACZKmpPIZQGsqvxyYm9oaBlwEHJ8es/KB\nrhacgjMzyxQxAnoe2AYMkNQHGACsB04H5qV95gFnpuUzgAURsS0i1gCrgUmSDgEGRcSytN/8XJ18\nW7cBJ6XlU4DFEbE5IjYDS8iCWs2MGAGbN8P27bU8qplZ/al5AIqITcC3gD+QBZ7NEbEEGBURpbHB\nRmBUWh4NrMs1sQ4YU6G8JZWT/q5Nx9sObJE0vIO2aqZ3bxg2DJ59tpZHNTOrP31qfUBJbwI+DRwO\nbAF+IOmc/D4REZKi1n3Lmz179uvLTU1NNDU1dVvbpTTcwQd3W5NmZjXX3NxMc3PzG65f8wAEHAf8\nIiJaAST9EHg7sEHSwRGxIaXXSqfqW4BxufpjyUYuLWm5vLxU51BgfUrzDY6IVkktQFOuzjjgnkqd\nzAeg7uaJCGa2Lyj/cj5nzpwu1S/iHNDjwAmS9k+TCd4DrADuBKanfaYDt6flhcA0Sf0kjQcmAMsi\nYgPwvKRJqZ1zgTtydUptnUU2qQFgMTBZ0hBJQ4GTgbuq9UTb46nYZmYFjIAi4jeS5gO/BHYCvwb+\nExgE3CJpBrAGODvtv0LSLWRBajswMyJK6bmZwHXA/sBPImJRKr8auF7SKqCVbJYdEbFJ0iXAg2m/\nOWkyQk15JpyZGajts9xKJEU1X5fLLoPnnoO5c6t2CDOzmpNERGjPe2Z8J4QCeARkZuYAVAifAzIz\n62IAkjQ0dxcCe4M8C87MrIMAJGmWpCPTcn9J9wK/AzZKOrlWHdwXOQVnZtbxCGgq2ZRpyKY0CzgI\neDfw9Sr3a582cmQ2AvL8DzNrZB0FoFdzU8GmADdFxI6IeIxiLmDdZ+y3HwwYkN0TzsysUXUYgCQd\nJekgsrsHLM5tG1DVXjUAp+HMrNF1FIA+DdwKPAFcHhFPAkh6L9nFo7YXPBHBzBpdu6m0iFgKvLlC\n+Y+BH1ezU43AU7HNrNG1G4AkfQ7InybPT7+OiPh21XrVAJyCM7NG11EKblB6HAh8Hjgg9xhU/a7t\n25yCM7NG11EKbnZpWdIZEdG1+2xbh0aOhIcfLroXZmbF8a14CuJzQGbW6ByACuIUnJk1uo4mISzP\nrb6pbD0i4q3V69a+z5MQzKzRdXRHg7/pYJtvIrOXnIIzs0bX0SSENZXK092wzwaeqlKfGsKgQbBj\nB7z4IgwcWHRvzMxqr6O7YR8g6XOSrpQ0U1IvSe8Hfgt8pHZd3DdJbTclNTNrRB2l4OYDzwP3A5OB\nvwNeAT4cEZ5A3A1KExHGjy+6J2ZmtddRAPrT0kQDSd8D/ggcFhEv16RnDcDngcyskXU0DXtHaSEi\ndgAtDj7dyzPhzKyRdTQCequkrbn1/XPrEREHVrFfDcHXAplZI+toFlzvWnakEY0cCU8+WXQvzMyK\nUcidECQNkXSrpMckrZA0SdIwSUskrZS0WNKQ3P4XSlol6XFJk3Plx0panrZdkSvvL+nmVL5U0mG5\nbdPTMVZKOq92z3p3PgdkZo2sqFvxXAH8JCKOBN4KPA58EVgSEUcAd6d1JE0EpgITyX4a/Mp0LRLA\nVcCMiJgATJA0JZXPAFpT+eXA3NTWMOAi4Pj0mJUPdLXmFJyZNbKaByBJg4F3RcQ1ABGxPSK2AKcD\n89Ju84Az0/IZwIKI2JYujl0NTJJ0CDAoIpal/ebn6uTbug04KS2fAiyOiM0RsRlYQhbUCuFJCGbW\nyIoYAY0HnpF0raRfS/ovSQOBURFR+jjeCIxKy6OBdbn664AxFcpbUjnp71rIAhywRdLwDtoqhFNw\nZtbIOpoFV81jHgP8U0Q8KOk7pHRbSUSEpELvNzd79uzXl5uammhqaur2YwwfDs8/D9u2Qd++3d68\nmVlVNTc309zc/IbrFxGA1gHrIuLBtH4rcCGwQdLBEbEhpddKZ0dagHG5+mNTGy1puby8VOdQYL2k\nPsDgiGiV1AI05eqMA+6p1Ml8AKqWXr2yIPTMMzB6dNUPZ2bWrcq/nM+Z07XfLa15Ci4iNgBrJR2R\nit5Ddn+5O4HpqWw6cHtaXghMk9RP0nhgArAstfN8mkEn4FzgjlydUltnkU1qAFgMTE6z8IYCJwN3\nVeN5dpYnIphZoypiBATwz8ANkvoBvwM+CvQGbpE0A1hDdsdtImKFpFuAFcB2YGZElNJzM4HrgP3J\nZtUtSuVXA9dLWgW0AtNSW5skXQKURl9z0mSEwvg8kJk1KrV9lluJpKjV63LOOTB5MpxX6BVJZmZ7\nTxIRoT3vmfFPchfMKTgza1QOQAXztUBm1qgcgArmc0Bm1qgcgArmFJyZNSoHoII5BWdmjcoBqGBO\nwZlZo/I07ApqOQ37tddg4EB49dXszghmZj2Vp2H3MP36wQEHwHPPFd0TM7PacgCqA56IYGaNyAGo\nDvg8kJk1IgegOuCZcGbWiByA6oBTcGbWiByA6oBHQGbWiByA6oDPAZlZI3IAqgNOwZlZI3IAqgNO\nwZlZI3IAqgNOwZlZI3IAqgNOwZlZI3IAqgMDB0IEvPBC0T0xM6sdB6A6IHkUZGaNxwGoTvg8kJk1\nGgegOuGZcGbWaByA6oRTcGbWaAoLQJJ6S3pI0p1pfZikJZJWSlosaUhu3wslrZL0uKTJufJjJS1P\n267IlfeXdHMqXyrpsNy26ekYKyWdV6vnuyceAZlZoylyBPQpYAVQ+unRLwJLIuII4O60jqSJwFRg\nIjAFuFJS6Rf3rgJmRMQEYIKkKal8BtCayi8H5qa2hgEXAcenx6x8oCuSzwGZWaMpJABJGgucBnwP\nKAWT04F5aXkecGZaPgNYEBHbImINsBqYJOkQYFBELEv7zc/Vybd1G3BSWj4FWBwRmyNiM7CELKgV\nzik4M2s0RY2ALgc+D+zMlY2KiNIYYCMwKi2PBtbl9lsHjKlQ3pLKSX/XAkTEdmCLpOEdtFU4p+DM\nrNH0qfUBJb0PeDoiHpLUVGmfiAhJUWlbrcyePfv15aamJpqamqp6PKfgzKynaW5uprm5+Q3Xr3kA\nAt4BnC7pNGA/4EBJ1wMbJR0cERtSeq2UkGoBxuXqjyUbubSk5fLyUp1DgfWS+gCDI6JVUgvQlKsz\nDrinUifzAagWnIIzs56m/Mv5nDlzulS/5im4iPhSRIyLiPHANOCeiDgXWAhMT7tNB25PywuBaZL6\nSRoPTACWRcQG4HlJk9KkhHOBO3J1Sm2dRTapAWAxMFnSEElDgZOBu6r2ZLtg6FDYuhVee63onpiZ\n1UYRI6BypVTbZcAtkmYAa4CzASJihaRbyGbMbQdmRkSpzkzgOmB/4CcRsSiVXw1cL2kV0EoW6IiI\nTZIuAR5M+81JkxEK16sXHHQQPPMMjKmLs1JmZtWlts9yK5EURbwuRx8NV18NxxxT80Obme01SUSE\n9rxnxndCqCOeCWdmjcQBqI54IoKZNRIHoDriqdhm1kgcgOqIU3Bm1kgcgOqIU3Bm1kgcgOqIR0Bm\n1kgcgOqIzwGZWSNxAKojTsGZWSPxhagVFHUh6rZtMGAAvPpqdmcEM7OexBei9mB9+8KBB0Jra9E9\nMTOrPgegOuM0nJk1CgegOuOZcGbWKByA6oxHQGbWKByA6oynYptZo3AAqjNOwZlZo3AAqjNOwZlZ\no3AAqjMeAZlZo3AAqjM+B2RmjcIBqM44BWdmjcIBqM6UUnC+Q5KZ7escgOrMwIHQuzds3Vp0T8zM\nqssBqA45DWdmjcABqA55JpyZNYKaByBJ4yTdK+m3kh6V9MlUPkzSEkkrJS2WNCRX50JJqyQ9Lmly\nrvxYScvTtity5f0l3ZzKl0o6LLdtejrGSknn1ep5d4VHQGbWCIoYAW0DPhMRbwFOAM6XdCTwRWBJ\nRBwB3J3WkTQRmApMBKYAV0oq/d7EVcCMiJgATJA0JZXPAFpT+eXA3NTWMOAi4Pj0mJUPdPXCU7HN\nrBHUPABFxIaIeDgtvwA8BowBTgfmpd3mAWem5TOABRGxLSLWAKuBSZIOAQZFxLK03/xcnXxbtwEn\npeVTgMURsTkiNgNLyIJaXXEKzswaQaHngCQdDhwNPACMiojSx+5GYFRaHg2sy1VbRxawystbUjnp\n71qAiNgObJE0vIO26opTcGbWCPoUdWBJB5CNTj4VEVvbsmoQESGp0CthZs+e/fpyU1MTTU1NNTv2\nyJHQ3Fyzw5mZvSHNzc0078WHVSEBSFJfsuBzfUTcnoo3Sjo4Ijak9FppDNACjMtVH0s2cmlJy+Xl\npTqHAus5dtbeAAAIhklEQVQl9QEGR0SrpBagKVdnHHBPpT7mA1Ct+RyQmfUE5V/O58yZ06X6RcyC\nE3A1sCIivpPbtBCYnpanA7fnyqdJ6idpPDABWBYRG4DnJU1KbZ4L3FGhrbPIJjUALAYmSxoiaShw\nMnBXtz/JveQUnJk1giLOAb0TOAc4UdJD6TEFuAw4WdJK4K/TOhGxArgFWAH8FJgZ8fqNamYC3wNW\nAasjYlEqvxoYLmkV8GnSjLqI2ARcAjwILAPmpMkIdWXMGHjmGfj+94vuiZlZ9Sh807HdSIqiX5fl\ny+EDH4D3vAcuvxz69y+0O2ZmeySJiNCe98z4Tgh16qij4MEHs3NB73oXPPVU0T0yM+teDkB1bPBg\nuPVWmDoVJk2CRYv2XMfMrKdwCq6CekjBlbvvPpg2DT72MfjqV7M7ZpuZ1ZOupuAcgCqoxwAEsGFD\nNhrabz+44QYYMaLoHpmZtfE5oH3YwQfD3XfD294Gxx4Ly5btuY6ZWb1yAOph+vSBuXPhiivgfe+D\nK6/0r6eaWc/kFFwF9ZqCK7d6dTZV+6ij4D/+I/s1VTOzojgF10D+9E/h/vuzUdGkSfDEE0X3yMys\n8xyAergBA+Daa+FTn8quF7r11qJ7ZGbWOU7BVdBTUnDlfvUr+OAH4cwzs/NEffsW3SMzayROwTWw\nY4+FX/4SVq6EE0+Elpaie2Rm1j4HoH3MsGGwcCGceir85V/CvfcW3SMzs8qcgqugp6bgyv3sZ3Du\nudn5oS98AXr564aZVZHvhNAN9pUABLBuHZx9Nhx0EMybB0OGFN0jM9tX+RyQ7WLs2OznvQ8/PDtH\n9PDDRffIzCzjANQA+vXL7pzwta/BySdn07bNzIrmFFwF+1IKrtxjj2V3T3jHO+Df/g3237/oHpnZ\nvsIpOOvQkUdmNzF98UV45zvhySeL7pGZNSoHoAZ0wAFw443w0Y/CCSfAnXcW3SMza0ROwVWwL6fg\nyt1/f/YbQ+ecAxdfnN1XzszsjfA07G7QSAEI4Jln4MMfhp07YcECGDmy6B6ZWU/kc0DWZQcdBIsW\nZRMTjj0Wfv7zontkZo2gIQOQpCmSHpe0StIFRfenHvTuDZdcAt/9Lvzt32bTthtoEGhmBWi4ACSp\nN/DvwBRgIvAhSUcW26v68d73wtKlMH8+TJsGDz2U/fDdhg3wwgtZmq6rmpubu72fjcqvZffy61ms\nRjzlfDywOiLWAEi6CTgDeKzITtWT8eOzNNwFF2Qz5V54AbZuzf6+/HL2y6sHHND2GDSo4/W7727m\n2Web2t0+YACo01njxtbc3ExTU1PR3dhn+PUsViMGoDHA2tz6OmBSQX2pW/vtl6Xhyu3YAS+91BaQ\nSo/y9RdegC1bsp+EWLMGbrqp/TqvvrprUNtTQOvM+n77OaiZ1btGDEA+s7EXevfOPuAHDep8ndmz\ns0d7duzILoytFMTKy557DtaubX97af2113YNSP37twUkadflzv6thzqrVsGDD7b/WtaTnvAFYOXK\n7IccrRgNNw1b0gnA7IiYktYvBHZGxNzcPo31opiZdRNfB9QBSX2AJ4CTgPXAMuBDEeFzQGZmNdRw\nKbiI2C7pn4C7gN7A1Q4+Zma113AjIDMzqw8Ndx1QR3yBaveStEbSI5IekrSs6P70NJKukbRR0vJc\n2TBJSyStlLRYkn/jtpPaeT1nS1qX3qMPSZpSZB97CknjJN0r6beSHpX0yVTepfenA1DiC1SrIoCm\niDg6Io4vujM90LVk78e8LwJLIuII4O60bp1T6fUM4NvpPXp0RCwqoF890TbgMxHxFuAE4Pz0edml\n96cDUJvXL1CNiG1A6QJV2zs9YDJufYqI+4DnyopPB+al5XnAmTXtVA/WzusJfo92WURsiIiH0/IL\nZBfyj6GL708HoDaVLlAdU1Bf9hUB/EzSLyV9rOjO7CNGRcTGtLwRGFVkZ/YR/yzpN5Kudkqz6yQd\nDhwNPEAX358OQG08G6P7vTMijgZOJRuiv6voDu1L0m+G+H27d64CxgNvA/4IfKvY7vQskg4AbgM+\nFRFb89s68/50AGrTAozLrY8jGwXZGxQRf0x/nwF+RJbmtL2zUdLBAJIOAZ4uuD89WkQ8HQnwPfwe\n7TRJfcmCz/URcXsq7tL70wGozS+BCZIOl9QPmAosLLhPPZakAZIGpeWBwGRgece1rBMWAtPT8nTg\n9g72tT1IH5Il78fv0U6RJOBqYEVEfCe3qUvvT18HlCPpVOA7tF2g+o2Cu9RjSRpPNuqB7ILnG/x6\ndo2kBcC7gRFk+fSLgDuAW4BDgTXA2RGxuag+9iQVXs9ZQBNZ+i2A3wP/J3cOw9oh6a+A/wEeoS3N\ndiHZnWU6/f50ADIzs0I4BWdmZoVwADIzs0I4AJmZWSEcgMzMrBAOQGZmVggHIDMzK4QDkFkPJmlW\n2fqO9LMCj0j6YbpVilld8nVAZj2QpI8AhwDDgU1AS0TcKGlrRJTuQHEdsDwifH8zq0seAZkVJN32\n6XFJ10p6QtINkiZL+kX6Qa+/TD+Y9rlcnUclHRoRN5Ddv/DzwFMRcWOFQ9wPvKlGT8esyxyAzIr1\nJuD/An8GvBmYGhHvAP4F+BK73004yG7F9SGynwv5JnBYWn9d+oHFycCj1e2+2RvXp+gOmDW430fE\nbwEk/Rb4WSp/FDgceLhCnYiIBanOrIj4Zm7b/pIeIgtOa4DvVqnfZnvNIyCzYr2aW94JvJZb7gNs\nZ9f/p/vlK0fEnLL2Xk6/wXQY8Ar+VV+rYw5AZvVtDXAMgKRjyH48bY8i4mXgk8DX0q3zzeqOA5BZ\nsSqd48kv3wYMk/QocD7wRGfbi4iHgdXA2d3QT7Nu52nYZmZWCI+AzMysEA5AZmZWCAcgMzMrhAOQ\nmZkVwgHIzMwK4QBkZmaFcAAyM7NCOACZmVkh/j+sUJzVpZ+OegAAAABJRU5ErkJggg==\n", - "text": [ - "" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " The concrete thickness = 130.05 cm \n", - "\n" - ] - } - ], - "prompt_number": 40 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg575" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 10.4\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "E = 6.; ## Energy of gamma rays in MeV\n", - "phi0 = 10**2; ## Intensity of gamma rays in gamma-rays/cm^2-sec from mono-directional beam\n", - "x_w = 100.; ## Thickness of water in cm\n", - "x_Pb = 8.; ## Thickness of lead in cm\n", - "## Using data from Table II.4 at 6 MeV\n", - "mu_w = 0.0275; ## Total attenuation coefficient of water in cm^(-1)\n", - "mu_Pb = 0.4944; ## Total attenuation coefficient of lead in cm^(-1)\n", - "\n", - "mua_w = x_w*mu_w; ## Attenuation due to thickness of water\n", - "mua_Pb = x_Pb*mu_Pb; ## Attenuation due to thickness of lead\n", - "\n", - "## Case (a) - Water is placed before the lead\n", - "print'%s %.2f %s'%(\" \\n In case (a), Buildup factor is only due to lead measured at \",mua_Pb,\"\");\n", - "## Using the data from Table 10.1 at 6 MeV\n", - "B_Pb = 1.86;\n", - "phi_b_a = phi0*B_Pb*math.exp(-(mua_w+mua_Pb));\n", - "\n", - "## Using the data from Table II.5 for 6 MeV \n", - "mua_rho_air = 0.0172; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", - "## Calculation\n", - "X_dot_a = 0.0659*E*mua_rho_air*phi_b_a;\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n Exposure rate if water is placed before lead shield = \",X_dot_a*1000,\" uR/hour \\n\");\n", - "\n", - "## Case (b) - Lead is placed before water\n", - "print'%s %.2f %s %.2f %s'%(\" \\n In case (b), Buildup factor is due to water and lead measured at \",mua_w,\"\" and \"\",mua_Pb,\" respectively\");\n", - "## Using the data from Table 10.1 for water at 3.2 MeV,, which is the minimum point of mu_Pb curve\n", - "B_w = 2.72;\n", - "B_m = B_Pb*B_w;\n", - "phi_b_b = phi0*B_m*math.exp(-(mua_w+mua_Pb));\n", - "\n", - "## Calculation\n", - "X_dot_b = 0.0659*E*mua_rho_air*phi_b_b;\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n Exposure rate if lead is placed before water = \",X_dot_b*1000,\" uR/hour \\n\");\n", - "## The answer given in the textbook is wrong. This is because the intensity of gamma rays is wrongly taken for calculation. \n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " In case (a), Buildup factor is only due to lead measured at 3.96 \n", - "\n", - " Exposure rate if water is placed before lead shield = 1.55 uR/hour \n", - "\n", - " \n", - " In case (b), Buildup factor is due to water and lead measured at 2.75 3.96 respectively\n", - "\n", - " Exposure rate if lead is placed before water = 4.21 uR/hour \n", - "\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg582" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 10.5\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "fission_density = 4*10**7; ## Fission density in fissions/cm^2-sec\n", - "## 1 inches = 2.54 cm\n", - "d = 28*2.54; ## Diamaeter of plate in cm\n", - "R = d/2.; ## Radius of plate in cm\n", - "v = 2.42; ## Number of fission neutrons emitted per fission\n", - "x = 75.; ## Distance of point from center of plate in cm\n", - "## Using the data from Table 10.4 for removal macroscopic cross section of water\n", - "sigma_RW = 0.103; ## Removal macroscopic cross section of water in cm^-1\n", - "S = v*fission_density; ## Strength of neutron source in terms of neutrons/cm^2-sec\n", - "A = 0.12; ## A constant\n", - "## From Figure 10.19\n", - "\n", - "## Let the upper limit of integral be 20\n", - "x_limit = 20;\n", - "E1_x11 = 0.0000512 \n", - " \n", - " \n", - "E1_x21 = 0.0000205 \n", - "## Calculation\n", - "phi_1 = S*A/2.*(E1_x11-E1_x21);\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The fast flux without iron shield = \",phi_1,\" neutrons/cm^2-sec \\n\");\n", - "\n", - "## 2. Iron slab is inserted in front of the fission plate\n", - "## Using the data from Table 10.4 for removal macroscopic cross section of iron\n", - "sigma_R = 0.168; ## Removal macroscopic cross section of iron in cm^-1\n", - "t = 3*2.54; ## Thickness of iron slab in cm\n", - "## Now the analysis is similar to multi layered shielding\n", - "\n", - "x_limit = 20;\n", - "\n", - "E1_x12 = 0.0000124 \n", - "E1_x22 = 0.0000043 \n", - " \n", - " \n", - "## Calculation\n", - "phi_2 = S*A/2*(E1_x12-E1_x22);\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The fast flux with iron shield = \",phi_2,\" neutrons/cm^2-sec \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The fast flux without iron shield = 178.31 neutrons/cm^2-sec \n", - "\n", - " \n", - " The fast flux with iron shield = 47.04 neutrons/cm^2-sec \n", - "\n" - ] - } - ], - "prompt_number": 45 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg587" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 10.6\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "## Assuming average energy produced per fission reaction is 200 MeV \n", - "P = 250.*10**3; ## Power of research reactor in Watts\n", - "P_fission = 200*10**6*1.6*10**(-19); ## Energy produced in a fission reaction in terms of joule\n", - "f = 0.75; ## Metal volume fraction\n", - "## In this problem, both reflector and shield act as a composite shield\n", - "a = 150.+15.; ## Net shield distance in cm\n", - "## 1 litre = 1000 grams\n", - "V = 32.*1000.; ## Core volume in gram\n", - "\n", - "fission_density = (P/P_fission)*(1./V);\n", - "v = 2.42; ## Number of fission neutrons emitted per fission\n", - "S = fission_density*v; ## Neutron source strength in neutrons/cm^3-sec\n", - "## Assuming spherical shape\n", - "## Volume of sphere = (4/3)*pi*(radius)^3\n", - "R = ((3.*V)/(4.*math.pi))**(1./3.);\n", - "## Using the data from Table 10.4 for removal macroscopic cross section \n", - "sigma_R = 0.174; ## Removal macroscopic cross section of uranium in cm^-1\n", - "sigma_RW = 0.103; ## Removal macroscopic cross section of water in cm^-1\n", - "A = 0.12; ## A constant\n", - "alpha = ((1.-f)*sigma_RW)+(f*sigma_R); ## A parameter\n", - "## Calculation\n", - "theta = (S*A/(4*alpha))*(math.ceil(R)/(math.ceil(R)+a))**2*math.exp(-sigma_RW*a)*(1-math.exp(-2*alpha*math.ceil(R)));\n", - "## Converting into equivalent dose rate by referring Figure 9.12\n", - "## Fast neutron flux of 6.8 neutrons/cm^2-sec is equivalent to 1 mrem/hr\n", - "H_dot = theta/6.8;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Fast neutron dose rate near the surface of the shield = \",H_dot,\" mrem/hour \\n \");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Fast neutron dose rate near the surface of the shield = 8.10 mrem/hour \n", - " \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg593" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 10.7\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "E = 14.; ## Energy of neutrons in MeV\n", - "phi0 = 10**9; ## Intensity of neutrons in neutrons/cm^2-sec from isotropic point source\n", - "## 1 feet = 30.48 cm\n", - "d = 10*30.48; ## Distance of concrete wall from a point source in cm\n", - "## As Intensity obeys inverse square law\n", - "I = phi0/(4.*math.pi*d**2); ## Intensity of neutron beam in terms of neutrons/cm^2-sec\n", - "H_dot = 1.; ## The required dose equivalent rate in mrem/hour\n", - "## From Figure 10.23(b)\n", - "H0_dot = H_dot/I; ## The dose equivalent rate\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The reduced dose equivalent rate due to concrete wall is = \",H0_dot,\" mrem/hr \\n\");\n", - "## By looking into Figure 10.23(b) on thickness axis\n", - "print(\" \\n The concrete slab thickness is = 70 cm \\n\");\n", - "\t\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The reduced dose equivalent rate due to concrete wall is = 0.00 mrem/hr \n", - "\n", - " \n", - " The concrete slab thickness is = 70 cm \n", - "\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg598" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 10.8\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "R = 7.*30.48; ## Distance of core from the center of shield in cm\n", - "## Assuming average energy produced per fission reaction is 200 MeV \n", - "P = 10.; ## Power of teaching reactor in Watts\n", - "P_fission = 200*10**6*1.6*10**(-19); ## Energy produced in a fission reaction in terms of joule\n", - "fission_rate = P/P_fission; ## Number of fission reactions\n", - "\n", - "## By assuming that the gammma rays are of equal energy of 1 MeV (Group 1) and looking into Table 10.5\n", - "E1 = 1.; ## Energy of gamma rays in MeV (Assumed)\n", - "chi_pn1 = 5.2; ## Number of prompt gamma rays emitted per fission with energy 2 MeV\n", - "S1 = chi_pn1*fission_rate; ## Source strength in gamma rays/sec\n", - "## Using the data from Table II.4 for E = 1 MeV for water\n", - "mu1 = 0.0996; ## Mass attenuation coefficient at 1 MeV in cm^-1\n", - "print'%s %.2f %s'%(\" \\n Buildup factor is due to water measured at \",mu1*R,\"\");\n", - "## Using the data from Table 10.2 at 1 MeV\n", - "B_p1 = 373.;\n", - "phi_b1 = (S1/(4.*math.pi*R**2))*B_p1*math.exp(-mu1*R); ## Buildup flux\n", - "## Using the data from Table II.5 for 1 MeV \n", - "mua_rho_air1 = 0.028; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", - "## Calculation\n", - "X_dot1 = 0.0659*E1*mua_rho_air1*phi_b1;\n", - "print'%s %.2f %s'%(\"\\n Exposure rate due to group 1 = \",X_dot1,\" mR/hour \\n\");\n", - "\n", - "## By assuming that the gammma rays are of equal energy of 2 MeV (Group 2) and looking into Table 10.5\n", - "E2 = 2.; ## Energy of gamma rays in MeV (Assumed)\n", - "chi_pn2 = 1.8; ## Number of prompt gamma rays emitted per fission with energy 2 MeV\n", - "S2 = chi_pn2*fission_rate; ## Source strength in gamma rays/sec\n", - "## Using the data from Table II.4 for E = 2 MeV for water\n", - "mu2 = 0.0493; ## Mass attenuation coefficient at 2 MeV in cm^-1\n", - "print'%s %.2f %s'%(\" \\n Buildup factor is due to water measured at \",mu2*R,\"\");\n", - "## Using the data from Table 10.2 at 2 MeV\n", - "B_p2 = 13.1;\n", - "phi_b2 = (S2/(4.*math.pi*R**2))*B_p2*math.exp(-mu2*R); ## Buildup flux \n", - "## Using the data from Table II.5 for 2 MeV \n", - "mua_rho_air2 = 0.0238; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", - "## Calculation \n", - "X_dot2 = 0.0659*E2*mua_rho_air2*phi_b2;\n", - "print'%s %.2f %s'%(\"\\n Exposure rate due to group 2 = \",X_dot2,\" mR/hour \\n\");\n", - "\n", - "## By assuming that the gammma rays are of equal energy of 4 MeV (Group 3) and looking into Table 10.5\n", - "E3 = 4.; ## Energy of gamma rays in MeV (Assumed)\n", - "chi_pn3 = 0.22; ## Number of prompt gamma rays emitted per fission with energy 4 MeV\n", - "S3 = chi_pn3*fission_rate; ## Source strength in gamma rays/sec\n", - "## Using the data from Table II.4 for E = 4 MeV for water\n", - "mu3 = 0.0339; ## Mass attenuation coefficient at 4 MeV in cm^-1\n", - "print'%s %.2f %s'%(\" \\n Buildup factor is due to water measured at\",mu3*R,\"\");\n", - "## Using the data from Table 10.2 at 4 MeV\n", - "B_p3 = 5.27;\n", - "phi_b3 = (S3/(4.*math.pi*R**2))*B_p3*math.exp(-mu3*R); ## Buildup flux \n", - "## Using the data from Table II.5 for 4 MeV \n", - "mua_rho_air3=0.0194; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", - "## Calculation\n", - "X_dot3 = 0.0659*E3*mua_rho_air3*phi_b3;\n", - "print'%s %.2f %s'%(\"\\n Exposure rate due to group 3 = \",X_dot3,\" mR/hour \\n\");\n", - "\n", - "## By assuming that the gammma rays are of equal energy of 6 MeV (Group 4) and looking into Table 10.5\n", - "E4 = 6; ## Energy of gamma rays in MeV (Assumed)\n", - "chi_pn4 = 0.025; ## Number of prompt gamma rays emitted per fission with energy 4 MeV\n", - "S4 = chi_pn4*fission_rate; ## Source strength in gamma rays/sec\n", - "## Using the data from Table II.4 for E = 6 MeV for water\n", - "mu4 = 0.0275; ## Mass attenuation coefficient at 6 MeV in cm^-1\n", - "print'%s %.2f %s'%(\" \\n Buildup factor is due to water measured at \",mu4*R,\"\");\n", - "## Using the data from Table 10.2 at 6 MeV\n", - "B_p4 = 3.53;\n", - "phi_b4 = (S4/(4.*math.pi*R**2))*B_p4*math.exp(-mu4*R); ## Buildup flux \n", - "## Using the data from Table II.5 for 4 MeV \n", - "mua_rho_air4=0.0172; ## The ratio of total attenuation coefficient to density of air in cm^2/g\n", - "## Calculation\n", - "X_dot4 = 0.0659*E4*mua_rho_air4*phi_b4;\n", - "print'%s %.2f %s'%(\"\\n Exposure rate due to group 3 = \",X_dot4,\" mR/hour \\n\");\n", - "\n", - "##Calculation\n", - "X_dot = X_dot1+X_dot2+X_dot3+X_dot4;\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n The total exposure rate due to all groups = \",X_dot,\" mR/hour \\n\");\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Buildup factor is due to water measured at 21.25 \n", - "\n", - " Exposure rate due to group 1 = 0.00 mR/hour \n", - "\n", - " \n", - " Buildup factor is due to water measured at 10.52 \n", - "\n", - " Exposure rate due to group 2 = 1.09 mR/hour \n", - "\n", - " \n", - " Buildup factor is due to water measured at 7.23 \n", - "\n", - " Exposure rate due to group 3 = 2.34 mR/hour \n", - "\n", - " \n", - " Buildup factor is due to water measured at 5.87 \n", - "\n", - " Exposure rate due to group 3 = 0.93 mR/hour \n", - "\n", - "\n", - " The total exposure rate due to all groups = 4.36 mR/hour \n", - "\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg603" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 10.9\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "## Assuming average energy produced per fission reaction is 200 MeV \n", - "P = 55.; ## Power density of reactor in watts/cm^3\n", - "rho_eff_U = 0.33; ## Effective density of uranium in g/cm^3\n", - "rho_eff_W = 1-rho_eff_U; ## Effective density of water in g/cm^3\n", - "t_i = 3.; ## Average time spent by water in the reactor in seconds\n", - "t_0 = 2.; ## Average time spent by water in the external coolant circuit in seconds\n", - "## 1 eV = 1.6*10^(-19) J\n", - "P_fission = 200.*10**6*1.6*10**(-19); ## Energy produced in a fission reaction in terms of joule\n", - "fission_density = P/P_fission; ## Number of fission reactions\n", - "v = 2.42; ## Number of fission neutrons emitted per fission\n", - "S = v*fission_density; ## Strength of neutron source in terms of neutrons/cm^2-sec\n", - "## Atom density of oxygen at normal density of 1 g/cm^3 is\n", - "rho = 1.; ## Density of water in g/cm^3\n", - "N_A = 6.02*10**(23); ## Avogadro's constant\n", - "M = 18.; ## Molecular weight of water\n", - "atom_density = (rho*N_A)/M;\n", - "\n", - "## Using the data from Table 10.7\n", - "sigma_r = 1.9*10**(-5)*10**(-24); ## Reaction cross section in cm^2\n", - "T_12 = 7.1; ## Half life of the given reaction in seconds\n", - "lambd = 0.693/T_12; ## Decay constant of the given reaction in seconds^(-1)\n", - "sigma_act = rho_eff_W*atom_density*sigma_r; ## Average macroscopic activation cross section\n", - "## Using the data from Table 10.4\n", - "sigma_RW = 0.103; ## Removal cross section of water in cm^-1\n", - "sigma_RU = 0.174; ## Removal cross section of Uranium in cm^-1\n", - "sigma_R = (sigma_RU*rho_eff_U)+(sigma_RW*rho_eff_W); ## Removal cross section of mixture\n", - "## Let activation rate given by (sigma_act*phi_av) be denoted as AR\n", - "AR = (sigma_act*S)/sigma_R;\n", - "## Calculation\n", - "alpha = AR*(1.-math.exp(-t_i*lambd))/(1.-math.exp(-(t_i+t_0)*lambd));\n", - "## 1 curie = 3.7*10^(10) disintegrations/sec\n", - "## Result\n", - "print'%s %.2e %s %.2f %s '%(\"\\n Equilibrium activity of water due to neutron capture of oxygen = \",alpha,\" disintegrations/cm^3-sec\" and \" \",math.ceil(alpha*10**6/(3.7*10**10)),\" uCi/cm^3 \\n\");\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Equilibrium activity of water due to neutron capture of oxygen = 9.21e+06 249.00 uCi/cm^3 \n", - " \n" - ] - } - ], - "prompt_number": 9 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter11.ipynb b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter11.ipynb deleted file mode 100644 index 3707f403..00000000 --- a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter11.ipynb +++ /dev/null @@ -1,738 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:a11cc512169116adf57e35ff3d91c22a205b0bd00091c517137cb24d85c0113e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter11-Reactor Licensing Safety and the Environment " - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 11.1\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "h = 30.; ## Height at which the effluent is relaesed\n", - "## Calculation of maxima location \n", - "sigma_z = h/math.sqrt(2.); ## Vertical dispersion coefficient\n", - "## Using the plot given in Figure 11.12 for Type F condition\n", - "## The corresponding value with calculated maximum location is noted. \n", - "h_max = 1900.;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The point of maximum concentration of non-radioactive effluent = \",h_max,\" m \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The point of maximum concentration of non-radioactive effluent = 1900.00 m \n", - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg654" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 11.2\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "A = 2*10**3; ## Amount of radioactivity release due to Xenon-133 in curie\n", - "t = 365.*24.*3600.; ## Time in seconds\n", - "Q_dash = A/t; ## Average emission rate of Xenon-133\n", - "h = 100.; ## Location of radioactivity release through vent\n", - "v_bar = 1.; ## Wind speed in m/sec\n", - "## Using the plot given in Figure 11.11 and 11.12 for Type F condition at 100 m\n", - "sigma_y = 275.; ## Horizontal dispersion coefficient\n", - "sigma_z = 46.; ## Vertical dispersion coefficient\n", - "chi = (Q_dash*math.exp(-h**2/(2.*sigma_z**2)))/(math.pi*v_bar*sigma_y*sigma_z); ## Radionuclide concentration in terms of Ci/cm^3\n", - "## Using data from Table 11.3\n", - "Eg_bar = 0.03; ## Average gamma decay energy per disintegration in MeV\n", - "## Calculation \n", - "H_dot = 0.262*chi*Eg_bar*t*10**3; ## The units are in mrem/year\n", - "## Expressing the dose rate in SI units\n", - "H_dot_SI = 2.62*chi*Eg_bar*t*10**3;\n", - "## Result\n", - "print'%s %.2f %s %.2f %s '%(\" \\n The external gamma dose rate due to xenon release under type F condition = \",H_dot,\" mrem/year\" or \" \",H_dot_SI,\"mSv/year \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The external gamma dose rate due to xenon release under type F condition = 0.04 mrem/year 0.37 mSv/year \n", - " \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg655" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 11.3\n", - "import math\n", - "#calculate the\n", - "\n", - "## Using data from Table 11.3\n", - "Eg_bar = 0.00211; ## Average gamma decay energy per disintegration in MeV\n", - "## Calculation\n", - "C_y = 0.262*Eg_bar;\n", - "## Result\n", - "print'%s %.2e %s'%(\" \\n The dose rate factor due to krypton exposure = \",C_y,\" rem*m^3/sec-Ci \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The dose rate factor due to krypton exposure = 5.53e-04 rem*m^3/sec-Ci \n", - "\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg656" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 11.4\n", - "import math\n", - "#calculate the\n", - "\n", - "## The results given in Example 11.2 are to be used in this problem\n", - "chi = 1.5*10**(-10); ## Radionuclide concentration in terms of Ci/cm^3\n", - "t = 365.*24.*3600.; ## Time in seconds\n", - "## Using data from Table 11.3\n", - "Ebeta_bar = 0.146; ## Average gamma decay energy per disintegration in MeV\n", - "f = 1.; ## Experimentally detemined factor\n", - "## Calculation\n", - "H_dot = 0.229*Ebeta_bar*chi*f*t;\n", - "## Expressing the result in milli-rem\n", - "print'%s %.2f %s'%(\" \\n The external beta dose rate due to xenon exposure for a year = \",H_dot*10**3,\" mrem/year \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The external beta dose rate due to xenon exposure for a year = 0.16 mrem/year \n", - "\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg658" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 11.5\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "A = 1.23; ## Amount of radioactivity release due to I-131 in curie in one year\n", - "h = 30.; ## Location of radioactivity release through vent in meter\n", - "v_bar = 1.2; ## Wind speed in m/sec\n", - "T_12 = 8.04; ## Half life of Iodine 131 in days\n", - "T_12b = 138.; ## Biological half life of Iodine 131 in days\n", - "zeta = 0.23; ## Fraction of core inventory in MeV \n", - "q = 0.23; ## Fraction of Iodine-131 in thyroid\n", - "M = 20.; ## Mass of an adult thyroid in grams\n", - "\n", - "## 1.\n", - "t = 365.*24.*3600.; ## Time in seconds\n", - "Q_dash = A/t; ## Average emission rate of Iodine-131\n", - "## Converting days into seconds by using 1 day = 86400 seconds\n", - "lambd = 0.693/(T_12*86400); ## Decay constant of Iodine-131\n", - "lambda_b = 0.693/(T_12b*86400.); ## Biological decay constant of Iodine-131\n", - "## Let the quantity chi*v_bar/Q_bar = x\n", - "## Using the plot given in Figure 11.13 for Type E condition at 2000 m\n", - "x = 6.*10**(-5);\n", - "## Solving for chi\n", - "chi = (x*Q_dash)/v_bar;\n", - "## As per the standards of International Commission on Radiolgical Protection (ICRP) \n", - "B = 2.32*10**(-4); ## Normal breathing rate in m^3/sec\n", - "## Calculation\n", - "H_dot = (592.*B*zeta*q*chi)/(M*(lambd+lambda_b));\n", - "## Result\n", - "print'%s %.2e %s'%(\" \\n The equilibrium dose rate to an adult thyroid = \",H_dot,\"sem/sec \\n\");\n", - "\n", - "## 2.\n", - "## Calculation\n", - "H = H_dot*t;\n", - "## Expressing the result in milli-rem\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The annual dose to an adult thyroid = \",H*10**3,\" mrem \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The equilibrium dose rate to an adult thyroid = 6.71e-10 sem/sec \n", - "\n", - " \n", - " The annual dose to an adult thyroid = 21.16 mrem \n", - "\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg662" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 11.6\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given datah\n", - "E = 0.66; ## Energy of gamma ray emitted by caesium in MeV\n", - "x = 100.; ## Height of exposure in cm\n", - "## Using the data from Table II.5 for air at E = 0.66 MeV\n", - "mua_rho = 0.0294; ## The ratio of absorption coefficient to density of air in cm^2/g\n", - "## Using the data from Table II.4 for air at E = 0.66 MeV\n", - "mu_rho = 0.0775; ## The ratio of attenuation coefficient to density of air in cm^2/g\n", - "## Using standard value for density of air\n", - "rho = 1.293*10**(-3);\n", - "mu = mu_rho*rho;\n", - "mux = mu*x;\n", - "gamma = 0.57722; ## Euler's constant\n", - "E1 = -gamma+math.log(1./mux)+mux; ## Conversion factor \n", - "## Using parameter data from Table 11.16\n", - "C = 1.41; ## A constant\n", - "beta = 0.0857; ## A constant\n", - "## Calculation\n", - "H_dot_S = 3.39*10**(-2)*E*mua_rho*(E1+(C*math.exp(-(1.-beta)*mux)/(1.-beta)));\n", - "## Converting time in hours by 1 hour = 3600 seconds\n", - "## Result\n", - "print'%s %.2e %s %.2f %s '%(\" \\n The gamma ray dose rate conversion factor due to caesium-137 = \",H_dot_S,\" rem*m^2/sec-Ci\" or \" \",H_dot_S*3600,\"rem*m^2/hour-Ci\\n\");\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The gamma ray dose rate conversion factor due to caesium-137 = 3.66e-03 rem*m^2/sec-Ci 13.18 rem*m^2/hour-Ci\n", - " \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg665" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 11.7\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "C0 = 6.25*10**6; ## Amount of initial radioactivity release due to I-131 in curie\n", - "p = 0.1; ## Leakage rate in percent\n", - "t0 = 2*3600.; ## Analysis time in seconds\n", - "v_bar = 1.; ## Wind speed in m/sec\n", - "\n", - "## 1.\n", - "lambdal = 0.01*p/86400.; ## Decay constant corresponding to leakage rate in seconds (1 day = 86400 seconds)\n", - "## Using the data from Example 11.5 for the half life of Iodine-131\n", - "T_12 = 8.04; ## Half life of Iodine 131 in days\n", - "lambdac = 0.693/(T_12*86400.); ## Decay constant of Iodine-131 (I-131) in seconds\n", - "## Using data from Table 11.3\n", - "Eg_bar = 0.371; ## Average gamma decay energy per disintegration of I-131 in MeV\n", - "## Using the plot given in Figure 11.11 and 11.12 for Type F condition at 100 m\n", - "sigma_y = 21.; ## Horizontal dispersion coefficient\n", - "sigma_z = 70.; ## Vertical dispersion coefficient\n", - "## As lambdac*t << 1, \n", - "## Calculation\n", - "H = (0.262*Eg_bar*lambdal*C0*t0)/(math.pi*v_bar*sigma_y*sigma_z);\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The total external dose due to gamma ray exposure = \",H,\" rem\\n\")\n", - "\n", - "## 2.\n", - "## Using the data given in Example 11.5\n", - "B = 2.32*10**(-4); ## Normal breathing rate in m^3/sec\n", - "zeta = 0.23; ## Fraction of core inventory in MeV \n", - "q = 0.23; ## Fraction of Iodine-131 in thyroid\n", - "M = 20.; ## Mass of an adult thyroid in grams\n", - "## Calculation\n", - "H_dot = (592.*B*zeta*q*lambdal*C0*t0)/(math.pi*v_bar*sigma_y*sigma_z*M);\n", - "## Converting the units from rem/sec to milli-rem/hour by multiplying by (1000*3600)\n", - "## Result\n", - "print'%s %.2e %s %.2f %s '%(\" \\n The dose rate to an adult thyroid after 2 hours = \",H_dot,\" rem/sec\" or\"\",math.ceil(H_dot*(1000*3600)),\" mrem/hour\\n\");\n", - "\n", - "## 3.\n", - "## Using the data given in Example 11.5\n", - "T_12 = 8.04; ## Half life of Iodine 131 in days\n", - "T_12b = 138.; ## Biological half life of Iodine 131 in days\n", - "lambd = 0.693/(T_12*86400.); ## Decay constant of Iodine-131 in sec^(-1)\n", - "lambda_b = 0.693/(T_12b*86400.); ## Biological decay constant of Iodine-131 in sec^(-1)\n", - "## Calculation\n", - "H = H_dot/(lambd+lambda_b);\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The dose commitment to thyroid by Iodine-131 exposure after 2 hours = \",H,\" rem \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The total external dose due to gamma ray exposure = 0.01 rem\n", - "\n", - " \n", - " The dose rate to an adult thyroid after 2 hours = 4.10e-05 rem/sec 148.00 mrem/hour\n", - " \n", - " \n", - " The dose commitment to thyroid by Iodine-131 exposure after 2 hours = 38.81 rem \n", - "\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg667" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 11.8\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given\n", - "E = 2.4; ## Energy of gamma rays in MeV\n", - "r = 1000*100; ## Distance from the building where radiation is exposed in cm\n", - "t0 = 2*3600; ## Time of exposure in seconds\n", - "A = 3*10^7; ## Amount of initial radioactivity release due to Kr-88 in curie\n", - "f = 0.4; ## Fraction of disintegrations which release 2.4 MeV gamma rays\n", - "C0 = A*f; ## Effective number of curies \n", - "T_12 = 2.79; ## Half life of Iodine 131 in hours\n", - "\n", - "lambd = 0.693/(T_12*3600.); ## Decay constant of Iodine-131 in sec^(-1)\n", - "## Using the result given in Example 11.7\n", - "lambdal = 1.16*10**(-8); ## Decay constant corresponding to fission prouduct release from building\n", - "lambdac = lambd+lambdal; ## Total decay constant in sec^(-1) \n", - "## Using the data from Table II.4 for air at E = 2.4 MeV\n", - "mu_rho = 0.041; ## The attenuation coefficient in cm^2/g\n", - "## Using standard value for density of air in g/cm^3\n", - "rho = 1.293*10**(-3);\n", - "mu = mu_rho*rho;\n", - "## Using the data from Table II.5 for air at E = 2.4 MeV\n", - "mua_rho = 0.0227; ## The ratio of absorption coefficient to density of air in cm^2/g\n", - "print'%s %.2f %s'%(\" \\n Buildup factor is measured at \",mu*r,\"\");\n", - "## Using Berger's form in Problem 11.9 \n", - "B_p = 4.7; ## Buildup factor due to a point source\n", - "## Calculation\n", - "H = (54.*C0*(1.-math.exp(-lambdac*t0))/lambdac)*(E*mua_rho*B_p*math.exp(-mu*r)/r**2);\n", - "## Result\n", - "print'%s %.2e %s'%(\" \\n The direct dose due to gamma ray exposure = \",H,\" rem \\n\")\n", - "## There is a slight deviation in the answer due to approximation of value in the textbook.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Buildup factor is measured at 5.30 \n", - " \n", - " The direct dose due to gamma ray exposure = 3.91e-07 rem \n", - "\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg673" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 11.9\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "gammai = 0.0277; ## Fission yield of Iodine-131 in fraction\n", - "P = 3200.; ## Thermal power of the plant in MW\n", - "## Calculation\n", - "alphai = 8.46*10**5*P*gammai;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The saturation activity of Iodine-131 during reactor operation = \",alphai,\" curie \\n\")\n", - "\n", - "## Using assumption 2 of Nuclear Regulatory Commission (NRC) in calculation of radii of exclusion zone and Low Population Zone (LPZ)\n", - "## Due to core meltdown, 25 percent of iodine inventory is released and out of which 91 percent is in elemental form.\n", - "Fp = 0.25*0.91; ## Fraction of Iodine-131 released from the fuel into the reactor containment\n", - "## As entire iodine escapes through air\n", - "Fb = 1.; ## Fraction of 'Fp' which remains airborne and is capable of escaping from the building\n", - "## Calculation\n", - "C0 = alphai*Fp*Fb;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The activity of Iodine-131 in elemental form due to core meltdown = \",C0,\" curie \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The saturation activity of Iodine-131 during reactor operation = 74989440.00 curie \n", - "\n", - " \n", - " The activity of Iodine-131 in elemental form due to core meltdown = 17060097.60 curie \n", - "\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg714" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 11.10\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "P = 1000.; ## Electrical power of the plant in Mwe\n", - "eta = 0.38; ## Plant efficiency\n", - "P_th = P/eta; ## Thermal power of the plant in MW\n", - "h = 100.; ## Height of stack in metre\n", - "t = 24*365.; ## The number of hours in a year\n", - "m0 = 13000.; ## Amount of coal in the plant in Btu/lb\n", - "m0_ash = 0.09; ## Fraction of ash in the coal\n", - "\n", - "## 1.\n", - "E = P_th*t; ## Energy released in a year in MW-hour\n", - "## Converting the units in Btu by using 1 MW-hour = 3.412*10^6 Btu\n", - "m = (E*3.412*10**6)/m0;\n", - "## Converting the units in g/year by using 1 lb/year = 453.59237 g/year\n", - "m = m*453.59237;\n", - "## Assuming the fly ash equipment has an efficiency of 97.5% of fly ash removal\n", - "eta_flyash = 0.025; ## Only (1-efficiency) is exhausted\n", - "m_ash = eta_flyash*m0_ash*m;\n", - "## A typical power plant contains 3pCi/g of each nuclide (Radium-226) in one year\n", - "A = 3*10**(-12);\n", - "## Calculation\n", - "A_total = A*m_ash;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Total activity of Radium-226 emitted = \",A_total,\" curie \\n\")\n", - "\n", - "## 2.\n", - "v_bar = 1.; ## Wind speed in m/sec\n", - "t = 24.*365.*3600.; ## Analysis time of one year equivalently in seconds\n", - "MPC = 3.*10**(-12.); ## Maximum Permissible Concentration in micro-curie/cm^3\n", - "Q_bar = A_total/t; ## Emission rate for one year in curie/year\n", - "## Let the quantity chi*v_bar/Q_bar = x\n", - "## Using the plot for Pasquill F, given in Fig. A.7, Pg no 413 from Slade, D. H., Editor, Meteorology and Atomic Energy-1968. U. S. Atomic Energy Commission Report TID-24190, 1968.\n", - "x = 2.5*10**(-6.); ## Maximum value of x at 10^4 m \n", - "## Solving for chi\n", - "chi = (x*Q_bar)/v_bar;\n", - "## Converting the units from Ci/m^3 to micro-curie/cm^3 by multiplying by 10^6/10^6 = 1\n", - "print'%s %.2e %s'%(\" \\n Concentration of Radium-226 present = \",chi,\" micro-curie/cm^3 \\n\")\n", - "## Let c be the comparison factor\n", - "## Calculation\n", - "c = MPC/chi;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n On comparison, the total concentration of Radium-226 is \",c,\" times smaller than Maximum Permissible Concentration (MPC) \\n\")\n", - "## The comparison factor is slightly different from the value in the textbook. This is because of approximation used in the textbook.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Total activity of Radium-226 emitted = 0.02 curie \n", - "\n", - " \n", - " Concentration of Radium-226 present = 1.47e-15 micro-curie/cm^3 \n", - "\n", - " \n", - " On comparison, the total concentration of Radium-226 is 2042.83 times smaller than Maximum Permissible Concentration (MPC) \n", - "\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg718" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 11.11\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "Qy_bar = 1.04*10**(-2); ## Emission rate for one year in curie/year\n", - "## Let (chi/Q_bar) = d which is called 'Dilution factor'\n", - "d = 4*10**(-8); ## Dilution factor in year/cm^3\n", - "vd = 0.01; ## Experimentally determined constant\n", - "\n", - "## 1.\n", - "T_12 = 8.04; ## Half life of Iodine 131 in days\n", - "T_12f = 14; ## First order half life of Iodine 131 in days\n", - "## Converting days into years by using 1 year = 365 days\n", - "lambd = 0.693/(T_12/365.); ## Decay constant of Iodine-131\n", - "lambdaf = 0.693/(T_12f/365.); ## First order decay constant of Iodine-131\n", - "## Calculation\n", - "Cf = (Qy_bar*d*vd)/(lambd+lambdaf);\n", - "## Expressing the result in micro-curie \n", - "Cf = Cf*10**6;\n", - "## Result\n", - "print'%s %.2e %s'%(\" \\n The activity of I-131 on the vegetation = \",Cf,\" micro-curie/m^2 \\n\");\n", - "\n", - "## 2.\n", - "## The proportionality factor has a value 9*10^(-5) Ci/cm^3 of milk per Ci/m^2 of grass\n", - "## Calculation \n", - "Cm = 9*10**(-5)*Cf;\n", - "## Result\n", - "print'%s %.2e %s'%(\" \\n The concentration of I-131 in the milk = \",Cm,\" micro-curie/m^2 \\n\");\n", - "\n", - "## 3.\n", - "MPC = 3*10**(-7); ## Maximum Permissible Concentration in micro-curie/cm^3\n", - "## Calculation\n", - "H_dot = (2270.*Cm)/MPC;\n", - "## Result\n", - "print'%s %.2e %s'%(\" \\n The annual dose rate to an infant thyroid by consuming radiated milk = \",H_dot,\" mrem/year \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The activity of I-131 on the vegetation = 8.40e-08 micro-curie/m^2 \n", - "\n", - " \n", - " The concentration of I-131 in the milk = 7.56e-12 micro-curie/m^2 \n", - "\n", - " \n", - " The annual dose rate to an infant thyroid by consuming radiated milk = 5.72e-02 mrem/year \n", - "\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg721" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 11.12\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "Qy_bar = 0.197; ## Emission rate for one year in micro-curie/year\n", - "## Let (chi/Q_bar) = d which is called 'Dilution factor'\n", - "d = 6.29*10**(-16); ## Dilution factor in year/cm^3\n", - "MPC_w = 6*10**(-5); ## Maximum Permissible Concentration (MPC) of iron in micro-curie/cm^3\n", - "\n", - "Cw = Qy_bar*d; ## The concentration of Fe-59 \n", - "## For fish\n", - "Rs_fish = 110.; ## Consumption rate in g/day\n", - "## Using the data from Table 11.15 for saltwater concentration of fish for iron\n", - "CF_fish = 1800.; ## Concentration Factor of fish\n", - "Cs_fish = CF_fish*Cw; ## Activity of fish\n", - "H_dot_fish = (Cs_fish*Rs_fish*500.)/(MPC_w*2200.); ## Dose rate for fish\n", - "\n", - "## For mollusks\n", - "Rs_mollusk = 10.; ## Consumption rate in g/day\n", - "## Using the data from Table 11.15 for saltwater concentration of mollusk for iron\n", - "CF_mollusk = 7600.; ## Concentration Factor of mollusk\n", - "Cs_mollusk = CF_mollusk*Cw; ## Activity of mollusk\n", - "H_dot_mollusk = (Cs_mollusk*Rs_mollusk*500.)/(MPC_w*2200.); ## Dose rate for mollusk\n", - "\n", - "## For crustaceans\n", - "Rs_crustacean = 10.; ## Consumption rate in g/day\n", - "## Using the data from Table 11.15 for saltwater concentration of crustacean for iron\n", - "CF_crustacean = 2000.; ## Concentration Factor of crustacean\n", - "Cs_crustacean = CF_crustacean*Cw; ## Activity of crustacean\n", - "H_dot_crustacean = (Cs_crustacean*Rs_crustacean*500.)/(MPC_w*2200.); ## Dose rate for crustacean\n", - "\n", - "## Calculation\n", - "H_dot = H_dot_fish+H_dot_mollusk+H_dot_crustacean;\n", - "## Result\n", - "print'%s %.2e %s'%(\" \\n The annual dose rate to GI tract by consuming fish = \",H_dot_fish,\" mrem/year\");\n", - "print'%s %.2e %s'%(\" \\n The annual dose rate to GI tract by consuming mollusk = \",H_dot_mollusk,\" mrem/year\");\n", - "print'%s %.2e %s'%(\" \\n The annual dose rate to GI tract by consuming crustaceans = \",H_dot_crustacean,\" mrem/year\");\n", - "print'%s %.2e %s'%(\" \\n The annual dose rate to GI tract by consuming seafood = \",H_dot,\" mrem/year \\n\");\n", - "## The answer for annual dose rate to GI tract by consuming fish is wrong in the textbook. This is because the value of fish consumption rate is wrongly considered.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The annual dose rate to GI tract by consuming fish = 9.29e-08 mrem/year\n", - " \n", - " The annual dose rate to GI tract by consuming mollusk = 3.57e-08 mrem/year\n", - " \n", - " The annual dose rate to GI tract by consuming crustaceans = 9.39e-09 mrem/year\n", - " \n", - " The annual dose rate to GI tract by consuming seafood = 1.38e-07 mrem/year \n", - "\n" - ] - } - ], - "prompt_number": 12 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter2.ipynb b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter2.ipynb deleted file mode 100644 index 421dbd88..00000000 --- a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter2.ipynb +++ /dev/null @@ -1,818 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:b88f8253908896ceb538355ebb97029247893ecdea7fc487afd787ce682bc949" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter2-Atomic and Nuclear Physics " - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.1\n", - "import math\n", - "#determine\n", - "## Given data\n", - "atom_h = 6.6*10**24; ## Number of atoms in Hydrogen\n", - "## Using the data given in Table II.2, Appendix II for isotropic abundance of deuterium\n", - "isoab_H2 = 0.015; ## Isotropic abundance of deuterium\n", - "## Calculation\n", - "totatom_d=(isoab_H2*atom_h)/100.;\n", - "## Result\n", - "print\"%s %.2e %s \"%('\\n Number of deuterium atoms = ',totatom_d,'');\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Number of deuterium atoms = 9.90e+20 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg9" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.2\n", - "import math\n", - "#determine\n", - "## Given data \n", - "## Using the data given in the example 2.2\n", - "atwt_O16 = 15.99492; ## Atomic weight of O-16 isotope\n", - "isoab_O16 = 99.759; ## Abundance of O-16 isotope\n", - "atwt_O17 = 16.99913; ## Atomic weight of O-17 isotope\n", - "isoab_O17 = 0.037; ## Abundance of O-17 isotope\n", - "atwt_O18 = 17.99916; ## Atomic weight of O-18 isotope\n", - "isoab_O18 = 0.204; ## Abundance of O-18 isotope\n", - "## Calculation\n", - "atwt_O=(isoab_O16*atwt_O16 + isoab_O17*atwt_O17 + isoab_O18*atwt_O18)/100.;\n", - "## Result\n", - "print\"%s %.2f %s \"%('\\n Atomic Weight of Oxygen = ',atwt_O,'');\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Atomic Weight of Oxygen = 16.00 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.3\n", - "import math\n", - "#determine\n", - "## Given data\n", - "me = 9.1095*10**(-28); ## Mass of electron in grams\n", - "c = 2.9979*10**10; ## Speed of light in vacuum in cm/sec\n", - "## Calculation\n", - "rest_mass = me*c**2;\n", - "## Result\n", - "print\"%s %.2e %s \"%('\\n Rest mass energy of electron = ',rest_mass,' ergs\\n');\n", - "print('Expressing the result in joules')\n", - "## 1 Joule = 10^(-7)ergs\n", - "rest_mass_j = rest_mass*10**(-7);\n", - "print\"%s %.2e %s \"%('\\n Rest mass energy of electron = ',rest_mass_j,' joules\\n');\n", - "print('Expressing the result in MeV')\n", - "## 1 MeV = 1.6022*10^(-13)joules\n", - "rest_mass_mev = rest_mass_j/(1.6022*10**(-13));\n", - "print\"%s %.2f %s \"%('\\n Rest mass energy of electron = ',rest_mass_mev,' MeV\\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Rest mass energy of electron = 8.19e-07 ergs\n", - " \n", - "Expressing the result in joules\n", - "\n", - " Rest mass energy of electron = 8.19e-14 joules\n", - " \n", - "Expressing the result in MeV\n", - "\n", - " Rest mass energy of electron = 0.51 MeV\n", - " \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.4\n", - "\n", - "import math\n", - "#Calculate the \n", - "## From the result of Example 2.3\n", - "## Rest mass energy of electron = 0.5110 MeV\n", - "rest_mass_mev = 0.5110;\n", - "me = 9.1095*10**(-28); ## Mass of electron in grams\n", - "## From standard data table\n", - "## 1 amu = 1.6606*10^(-24)g\n", - "amu = 1.6606*10**(-24);\n", - "## Calculation\n", - "en_eq = (amu/me)*rest_mass_mev;\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Energy equivalent of one amu = ',en_eq,' MeV\\n');\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Energy equivalent of one amu = 931.52 MeV\n", - "\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.5\n", - "\n", - "import math\n", - "#Calculate the \n", - "## From the standard data table\n", - "h = 6.626*10**(-34); ## Planck's constant in J-s\n", - "c = 3*10**8; ## Speed of light in vacuum in m/sec\n", - "## Given data \n", - "print('The ionization energy of K shell electron in Lead atom is 88keV');\n", - "E = 88*10**3; ## Ionization energy in keV\n", - "## Expressing the result in joules by using 1 eV = 1.6022*10^(-19) J\n", - "E = E*1.6022*10**(-19);\n", - "print(\"From Planck\\''s law of photoelectric effect \\n Energy = (h*c)/lambda\\n\");\n", - "## Calculation \n", - "lambd = (h*c)/E; \n", - "## Result\n", - "print'%s %.3e %s'%('\\n Wavelength of radiation = ',lambd,' m\\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The ionization energy of K shell electron in Lead atom is 88keV\n", - "From Planck''s law of photoelectric effect \n", - " Energy = (h*c)/lambda\n", - "\n", - "\n", - " Wavelength of radiation = 1.410e-11 m\n", - "\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.6\n", - "import math\n", - "#Calculate the \n", - "## Given data\n", - "T12 = 64.8; ## Half life = 64.8 hour\n", - "lambd = 0.693/T12; ## Decay constant in hour^(-1)\n", - "t = 12.; ## Analysis time of gold sample in hours\n", - "alpha = 0.9; ## Activity of gold sample after analysis time\n", - "\n", - "## 1. \n", - "## Calculation\n", - "R = alpha/(1-math.exp(-lambd*t));\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Theoretical maximum activity = ',R,' curie (Ci) \\n');\n", - "\n", - "## 2. \n", - "## Calculation\n", - "## The expression to calculate 80 percent of maximum activity is \\n 0.8R = R*(1-exp(-lambda*t)) \n", - "t = -math.log(0.2)/lambd;\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Time to reach 80 percent of maximum activity = ',t,' hours \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Theoretical maximum activity = 7.47 curie (Ci) \n", - "\n", - "\n", - " Time to reach 80 percent of maximum activity = 150.49 hours \n", - "\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg29" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.7\n", - "import math\n", - "#Calculate the \n", - "print('The reactants are Nitrogen and neutron')\n", - "## The total atomic number of reactants \n", - "Z_reactant = 7.+0.;\n", - "## The total atomic mass number of reactants\n", - "A_reactant = 14.+1.;\n", - "print('One of the known product is Hydrogen')\n", - "Z_H = 1.; ## The atomic number of Hydrogen\n", - "A_H = 1.; ## The atomic mass number of Hydrogen \n", - "## The atomic number of unknown element\n", - "Z_unknown = Z_reactant-Z_H;\n", - "## The atomic mass number of unknown element \n", - "A_unknown = A_reactant-A_H;\n", - "## Result\n", - "print'%s %.2f %s %.2f %s '%(\" \\n For unknown element the atomic number is \",Z_unknown,\" and atomic mass number is \",A_unknown,\" \\n\");\n", - "## From periodic table \n", - "print('The element corresponds to Carbon-14');\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The reactants are Nitrogen and neutron\n", - "One of the known product is Hydrogen\n", - " \n", - " For unknown element the atomic number is 6.00 and atomic mass number is 14.00 \n", - " \n", - "The element corresponds to Carbon-14\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg29" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.8\n", - "import math\n", - "#Calculate the \n", - "print('The reaction is Tritium(d,n)Helium-4');\n", - "## Using standard data table of mass in amu\n", - "M_H3 = 3.016049; ## Atomic mass of Tritium\n", - "M_He4 = 4.002604; ## Atomic mass of Helium\n", - "M_d = 2.014102; ## Atomic mass of Deuterium\n", - "M_n = 1.008665; ## Atomic mass of neutron\n", - "## Calculation of total mass of reactants\n", - "tot_reac = M_H3+M_d;\n", - "## Calculation of total mass of products\n", - "tot_prod = M_He4+M_n;\n", - "## Calculation \n", - "Q = tot_reac-tot_prod;\n", - "## Expressing in MeV by using 1 amu = 931.5 MeV\n", - "Q_mev = Q*931.5;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Q value for the reaction = \",Q_mev,\" MeV\");\n", - "if Q_mev > 0:\n", - " print(\"\\n The reaction is exothermic. \\n\");\n", - "else:\n", - " print(\"\\n The reaction is endothermic. \\n\");\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The reaction is Tritium(d,n)Helium-4\n", - " \n", - " Q value for the reaction = 17.59 MeV\n", - "\n", - " The reaction is exothermic. \n", - "\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg33" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.9\n", - "import math\n", - "#Calculate the \n", - "## Using standard data table of mass in amu\n", - "M_C12 = 12.; ## Atomic mass of Carbon-12\n", - "M_n = 1.00866; ## Atomic mass of neutron\n", - "M_C13 = 13.00335; ## Atomic mass of Carbon-13\n", - "##If one neutron is removed from carbon-13, carbon-12 is obtained\n", - "tot = M_C12+M_n;\n", - "dm = tot-M_C13; ## Mass defect\n", - "## Converting to energy equivalent from mass by using 1 amu = 931.5 MeV\n", - "Es = dm*931.5;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The binding Energy of the last neutron in Carbon-13 atom = \",Es,\" MeV\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The binding Energy of the last neutron in Carbon-13 atom = 4.95 MeV\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg36" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.10\n", - "import math\n", - "#calculate the\n", - "\n", - "## Using standard data table of mass and the coefficients of mass equation for Silver-107\n", - "N = 60.; ## Number of neutrons\n", - "Z = 47.; ## Atomic number\n", - "A = 107.; ## Atomic mass number\n", - "## The coefficients used in mass equation are \n", - "alpha = 15.56;\n", - "bet = 17.23;\n", - "gam = 0.697;\n", - "zeta = 23.285;\n", - "mn = 939.573; ## Mass of neutron in terms of energy\n", - "mH = 938.791; ## Mass of proton in terms of energy\n", - "## Calculation \n", - "print('Using mass equation');\n", - "M = (N*mn)+(Z*mH)-(alpha*A)+(bet*(A**(2/3.)))+(gam*Z**2/A**(1/3.))+(zeta*(A-2*Z)**2/A);\n", - "## Expressing in amu by using 1 amu = 931.5 MeV\n", - "M_amu = M/931.5;\n", - "print'%s %.2f %s %.2f %s '%(\" Mass = \",M,\" MeV\" and \" = \",M_amu,\"f u\" );\n", - "print('Actual mass = 106.905092 u');\n", - "## Calculation \n", - "BE = (alpha*A)-(bet*(A**(2/3.)))-(gam*Z**2/A**(1/3.))-((zeta*(A-(2.*Z))**2)/A);\n", - "## Result\n", - "print'%s %.2f %s %.2f %s '%(\"\\n Binding Energy = \",BE,\" MeV\" or\"\" ,BE/107,\"MeV/nucleon \\n\");\n", - "## The value is different from the answer given in the textbook. The textbook answer is wrong.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Using mass equation\n", - " Mass = 99582.07 = 106.91 f u \n", - "Actual mass = 106.905092 u\n", - "\n", - " Binding Energy = 915.49 MeV 8.56 MeV/nucleon \n", - " \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.11\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "T_C = 38.; ## Given temeperature in celsius\n", - "##The temperature in Kelvin \n", - "T_K = T_C+273.15;\n", - "T_0 = 293.61; ## The temperature in kelvin equivalent to 0 deg celsius\n", - "kT = 0.0253; ## The term 'kT' in eV at temperature T0\n", - "## Calculation\n", - "Ep = 0.5*kT*(T_K/T_0);\n", - "Ebar = 3*Ep;\n", - "## Result\n", - "print'%s %.2f %s'%(\" Most probable energy of air molecules = \",Ep,\" eV \\n\");\n", - "print'%s %.2f %s'%(\" Average energy of air molecules = \",Ebar,\" eV \\n\");\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Most probable energy of air molecules = 0.01 eV \n", - "\n", - " Average energy of air molecules = 0.04 eV \n", - "\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg40" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.12\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "rho = 0.97; ## Density of Sodium in gram/cm^3\n", - "## From standard data table\n", - "NA = 0.6022*10**24; ## Avagodro number\n", - "M = 22.99; ## Atomic weight of Sodium\n", - "## Calculation\n", - "N = rho*NA/M;\n", - "## Result\n", - "print'%s %.2e %s'%(\"Atom density of sodium = \",N,\" atoms/cm^3 \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Atom density of sodium = 2.54e+22 atoms/cm^3 \n", - "\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg41" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.13\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "rho_NaCl = 2.17; ## Density of Sodium Chloride(NaCl) in gram/cm^3\n", - "## From standard data table\n", - "NA = 0.6022*10**24; ## Avogodro number\n", - "M_Na = 22.99; ## Atomic weight of Sodium(Na)\n", - "M_Cl = 35.453; ## Atomic weight of Chlorine(Cl)\n", - "M_NaCl = M_Na+M_Cl; ## Molecular weight of Sodium Chloride(NaCl)\n", - "## Calculation\n", - "N = rho_NaCl*NA/M_NaCl;\n", - "## As in NaCl, there is one atom of Na and Cl\n", - "N_Na = N;\n", - "N_Cl = N;\n", - "## Result\n", - "print'%s %.4e %s'%(\" Atom density of Sodium and Chlorine = \",N,\" molecules/cm^3 \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Atom density of Sodium and Chlorine = 2.2360e+22 molecules/cm^3 \n", - "\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.14\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "rho = 1.; ## Density of water in gram/cm^3\n", - "\n", - "## 1.\n", - "M_H = 1.00797; ## Atomic weight of Hydrogen(H)\n", - "M_O = 15.9994; ## Atomic weight of Oxygen(O)\n", - "## As in water, there is two atoms of Hydrogen(H) and one atom of Oxygen(O)\n", - "M = (2*M_H)+M_O; ## Molecular weight of water\n", - "## From standard data table\n", - "NA = 0.6022*10**24; ## Avagodro number\n", - "## Calculation \n", - "N = rho*NA/M;\n", - "## Result\n", - "print'%s %.4e %s'%(\"Atom density of water = \",N,\" molecules/cm^3 \\n\");\n", - "\n", - "## 2.\n", - "## As in water, there is two atoms of Hydrogen(H) and one atom of Oxygen(O)\n", - "N_H = 2*N; ## Atom density of Hydrogen\n", - "N_O = N; ## Atom density of Oxygen\n", - "## Result\n", - "print'%s %.4e %s'%(\"Atom density of Hydrogen(H) = \",N_H,\" atoms/cm^3 \\n\");\n", - "print'%s %.4E %s'%(\"Atom density of Oxygen(O)= \",N_O,\" atoms/cm^3 \\n\");\n", - "\n", - "## 3.\n", - "## Using the data given in Table II.2, Appendix II for isotropic abundance of deuterium\n", - "isoab_H2 = 0.015;\n", - "## Calculation\n", - "N_H2 = isoab_H2*N_H/100.;\n", - "## Result\n", - "print'%s %.4E %s'%(\"Atom density of Deuterium(H-2)= \",N_H2,\" atoms/cm^3 \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Atom density of water = 3.3427e+22 molecules/cm^3 \n", - "\n", - "Atom density of Hydrogen(H) = 6.6854e+22 atoms/cm^3 \n", - "\n", - "Atom density of Oxygen(O)= 3.3427E+22 atoms/cm^3 \n", - "\n", - "Atom density of Deuterium(H-2)= 1.0028E+19 atoms/cm^3 \n", - "\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.15\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data \n", - "rho = 19.1; ## Density of Uranium-235 in gram/cm^3\n", - "wt = 1500.; ## Weight of uranium rods in a reactor in kg\n", - "nr = 0.2; ## Enrichment(w/o) of Uranium-235\n", - "\n", - "## 1.\n", - "## As Enrichment is 20(w/o)\n", - "wt_U235 = nr*wt; ## Amount of Uranium-235\n", - "## Result\n", - "print'%s %.2f %s'%(\"Amount of Uranium-235 in the reactor = \",wt_U235,\" kg \\n\");\n", - "\n", - "## 2.\n", - "## From standard data table\n", - "NA = 0.6022*10**24; ## Avagodro number\n", - "M_U235 = 235.0439; ## Atomic weight of Uranium-235\n", - "M_U238 = 238.0508; ## Atomic weight of Uranium-238\n", - "## Calculation\n", - "N_U235 = nr*rho*NA/M_U235; ## Atom density of Uranium-235\n", - "N_U238 = (1.-nr)*rho*NA/M_U238; ## Atom density of Uranium-238\n", - "## Result\n", - "print'%s %.4e %s'%(\"Atom density of Uranium-235 = \",N_U235,\" atoms/cm^3 \\n\");\n", - "print'%s %.4e %s'%(\"Atom density of Uranium-238 = \",N_U238,\" atoms/cm^3 \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Amount of Uranium-235 in the reactor = 300.00 kg \n", - "\n", - "Atom density of Uranium-235 = 9.7871e+21 atoms/cm^3 \n", - "\n", - "Atom density of Uranium-238 = 3.8654e+22 atoms/cm^3 \n", - "\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex16-pg43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 2.16\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "rho_UO2 = 10.5; ## Density of UO2 pellets in gram/cm^3\n", - "nr = 0.3; ## Enrichment(w/o) of Uranium-235\n", - "## From standard data table\n", - "M_U235 = 235.0439; ## Atomic weight of Uranium-235\n", - "M_U238 = 238.0508; ## Atomic weight of Uranium-238\n", - "M_O = 15.999; ## Atomic weight of Oxygen\n", - "NA = 0.6022*10**24; ## Avogodro number\n", - "\n", - "M = 1./((nr/M_U235)+((1.-nr)/M_U238));\n", - "M_UO2 = M+(2.*M_O); ## Molecular weight of UO2\n", - "nr_U = M/M_UO2*100.; ## The percent(w/o) of Uranium in UO2 pellet\n", - "rho_U = nr_U*rho_UO2/100. ## Density of Uranium in g/cm^3\n", - "rho_U235 = nr*rho_U ## Density of Uranium-235 in g/cm^3\n", - "## Calculation\n", - "N_U235=rho_U235*NA/M_U235;\n", - "## Result\n", - "print'%s %.4e %s'%(\"Atom density of Uranium-235 = \",N_U235,\" atoms/cm^3 \\n\");\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Atom density of Uranium-235 = 7.1110e+21 atoms/cm^3 \n", - "\n" - ] - } - ], - "prompt_number": 16 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter3.ipynb b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter3.ipynb deleted file mode 100644 index ee6e14f0..00000000 --- a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter3.ipynb +++ /dev/null @@ -1,813 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:a83d41ee1bf2b5cb710f5a4f59fa473688e3a1ab539cb5806ccaff2f0723ab5b" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter3-Interaction of Radiation with Matter " - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg55" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.1\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigma = 2.6*10**(-24); ## Cross section of carbon-12 in cm^2\n", - "I = 5*10**8; ## Intensity of neutron beam in neutrons/cm^2-sec\n", - "A = 0.1; ## Cross sectional area of the beam in cm^2;\n", - "X = 0.05; ## Thickness of the target in cm\n", - "\n", - "## 1.\n", - "## Using the data given in Table I.3, Appendix II for carbon-12\n", - "N = 0.08*10**(24); ## Atom density in atoms/cm^3\n", - "## Calculation \n", - "IR = sigma*I*N*A*X;\n", - "## Result\n", - "print'%s %.2e %s'%('\\n Total interaction rate = ',IR,' interactions/sec \\n');\n", - "\n", - "## 2. \n", - "no = I*A; ## Neutron rate in neutrons/sec\n", - "## Calculation \n", - "p = IR/no;\n", - "print'%s %.2e %s'%('\\n Probability of collision = ',p,' \\n');\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Total interaction rate = 5.20e+05 interactions/sec \n", - "\n", - "\n", - " Probability of collision = 1.04e-02 \n", - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg56" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.2\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "sigmaf = 582.; ## Fission cross section of U-235 on bombardment of neutron in barn\n", - "sigmay = 99.; ## Radiative capture cross section of U-235 on bombardment of neutron in barn\n", - "## Calculation\n", - "pf = sigmaf/(sigmaf+sigmay);\n", - "## Result\n", - "print'%s %.2f %s %.2f %s '%('\\ n Probability of fission = ',pf,''and ' = ',pf*100,' percent\\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\\ n Probability of fission = 0.85 85.46 percent\n", - " \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg57" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.3\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "## Using the data given in the example 3.1\n", - "N = 0.08*10**(24.); ## Atom density of Carbon-12 in atoms/cm^3\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigma = 2.6*10**(-24); ## Cross section of carbon-12 in cm^2\n", - "I = 5*10**8; ## Intensity of neutron beam in neutrons/cm^2-sec\n", - "\n", - "## 1.\n", - "## Calculation \n", - "SIGMAt = N*sigma;\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Macroscopic cross section of carbon-12 = ',SIGMAt,' cm^(-1)\\n');\n", - "\n", - "##2. \n", - "## Calculation \n", - "F= I*SIGMAt;\n", - "## Result\n", - "print'%s %.2e %s'%('\\n Collision density in the carbon-12 target = ',F,' collisions/cm^(3)-sec\\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Macroscopic cross section of carbon-12 = 0.21 cm^(-1)\n", - "\n", - "\n", - " Collision density in the carbon-12 target = 1.04e+08 collisions/cm^(3)-sec\n", - "\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg59" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.4\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "E = 100.; ## Neutron energy in keV\n", - "## Using the data given in Table II.3, for E = 100 keV\n", - "atom_density = 0.0254*10**(24); ## Atom density of sodium in atoms/cm^3\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigma = 3.4*10**(-24); ## Microscopic cross section of sodium in cm^2\n", - "## Calculation\n", - "SIGMA = atom_density*sigma;\n", - "lambd = 1./SIGMA;\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Macroscopic cross section = ',SIGMA,' cm^(-1)\\n');\n", - "print'%s %.2f %s'%('\\n Mean Free Path = ',lambd,' cm\\n',);\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Macroscopic cross section = 0.09 cm^(-1)\n", - "\n", - "\n", - " Mean Free Path = 11.58 cm\n", - "\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg60" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.5\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "atom_density_U235 = 3.48*10**(-4)*10**(24); ## Atom density of Uranium-235 in atoms/cm^3\n", - "atom_density_U238 = 0.0483*10**(24); ## Atom density of Uranium-238 in atoms/cm^3\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigmaa_U235 = 680.8*10**(-24); ## Absorption cross section of Uranium-235 incm^2\n", - "sigmaa_U238 = 2.7*10**(-24); ## Absorption cross section of Uranium-238 incm^2\n", - "## Calculation\n", - "SIGMAA=(atom_density_U235*sigmaa_U235)+(atom_density_U238*sigmaa_U238);\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Macroscopic absorption cross section = ',SIGMAA,' cm^(-1)\\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Macroscopic absorption cross section = 0.37 cm^(-1)\n", - "\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg60" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.6\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "sigmas_H_1 = 3; ## Scattering cross section of Hydrogen in barn at 1 MeV\n", - "sigmas_O_1 = 8; ## Scattering cross section of Oxygen in barn at 1 MeV\n", - "sigmas_H_th = 21; ## Scattering cross section of Hydrogen in barn at 0.0253 eV \n", - "sigmas_O_th = 4; ## Scattering cross section of Oxygen in barn at 0.0253 eV\n", - "## Calculation\n", - "sigmas_H20_1 = (2*sigmas_H_1)+(1*sigmas_O_1);\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Scattering cross section of Water at 1 MeV = ',sigmas_H20_1,' b \\n');\n", - "## The equation used to calculate the scattering cross section at 1 MeV cannot be used at thermal energy. \n", - "print'%s %.2f %s'%(' Experimental value of scattering cross section of Water at 0.0253 eV = ',103,' b \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Scattering cross section of Water at 1 MeV = 14.00 b \n", - "\n", - " Experimental value of scattering cross section of Water at 0.0253 eV = 103.00 b \n", - "\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg61" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.7\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "phi = 1*10**(13); ## Neutron flux in neutrons/cm^3\n", - "v = 64000.; ## Volume of research reactor in cm^3\n", - "sigmaf = 0.1; ## Macroscopic fission cross section in cm^(-1)\n", - "## The energy released per fission reaction is 200 MeV\n", - "## 1 MeV = 1.6*10^(-13) joule\n", - "E = 200*1.6*10**(-13);\n", - "## Calculation \n", - "fiss_rate = sigmaf*phi; ## Fission rate in neutrons/cm^2-sec\n", - "power_cc = E*fiss_rate/10**6; ## Reactor power/cc\n", - "power = power_cc*v;\n", - "print'%s %.2f %s'%('\\n Reactor power of a research reactor = ',power,' MW\\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Reactor power of a research reactor = 2.05 MW\n", - "\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg63" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.8\n", - "import math\n", - "#calculate the\n", - "\n", - "## 1 barn = 10^(-24) cm^2\n", - "## From the Figure 3.4 given in the textbook\n", - "sigmae = 4.8*10**(-24); ## Experimental cross section of carbon from 0.02eV to 0.01MeV\n", - "## Assuming spherical shape and elstic scattering\n", - "R = math.sqrt(sigmae/(4.*math.pi));\n", - "## Result\n", - "print'%s %.2e %s'%('\\n Radius of carbon nucleus = ',R,' cm\\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Radius of carbon nucleus = 6.18e-13 cm\n", - "\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg67" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.9\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data \n", - "E0 = 0.0253; ## Thermal energy in eV\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigmay_E0 = 0.332*10**(-24); ## Radiative capture cross section at 0.0253 eV in cm^2\n", - "E = 1.; ## Energy in eV at which radiative cross section is to be found\n", - "## Calculation \n", - "sigmay_E = sigmay_E0*math.sqrt(E0/E);\n", - "## Result\n", - "## Expressing the result in barn\n", - "print'%s %.2e %s'%('\\n Radiative capture cross section of hydrogen at 1 eV = ',sigmay_E*10*24,' b\\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Radiative capture cross section of hydrogen at 1 eV = 1.27e-23 b\n", - "\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg72" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.10\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "E = 1.; ## Energy of neutron in MeV\n", - "A = 2.; ## Atomic mass number of deuterium\n", - "v = 45.; ## Scattering angle in degree\n", - "\n", - "## 1.\n", - "## Calculation \n", - "E_dash = E/(A+1.)**2 *((math.cos (v/57.3)+math.sqrt(A**2-(math.sin(v/57.3))**2))**2);\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Energy of scattered neutron = ',E_dash,' MeV \\n');\n", - "\n", - "## 2.\n", - "## Calculation \n", - "E_A = E-E_dash;\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Energy of recoil nucleus = ',E_A,' MeV \\n');\n", - "\n", - "## 3.\n", - "## Calculation \n", - "deltau = math.log(E/E_dash);\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Change in lethargy of neutron on collision = ',deltau,' \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Energy of scattered neutron = 0.74 MeV \n", - "\n", - "\n", - " Energy of recoil nucleus = 0.26 MeV \n", - "\n", - "\n", - " Change in lethargy of neutron on collision = 0.30 \n", - "\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg74" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.11\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "phi = 5*10**(12); ## Neutron flux in neutrons/cm^2-sec\n", - "T = 600.; ## Temperature of neutron in degree\n", - "## Using the data given in Table II.3, Appendix II for indium\n", - "N = 0.0383*10**(24); ## Atom density in atoms/cm^3\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigmaa_E0 = 194.*10**(-24); ## Microscopic absorption cross section in cm^2\n", - "SIGMA_E0 = N*sigmaa_E0; ## Macroscopic absorption cross section in cm^(-1)\n", - "## From Table 3.2 \n", - "ga_600 = 1.15; ## Non 1/v factor at 600 degree celsius\n", - "## Calculation \n", - "F_a = ga_600*SIGMA_E0*phi;\n", - "## Result\n", - "print'%s %.2e %s'%('\\n Absorption rate of neutrons per cc in indium foil = ',F_a,' neutrons/cm^3-sec \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Absorption rate of neutrons per cc in indium foil = 4.27e+13 neutrons/cm^3-sec \n", - "\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg84" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.12\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "N = 120.; ## Number of fuel rods\n", - "P = 100.; ## Reactor power in MW\n", - "t = 1.; ## Estimation time of fuel rod after removal in days\n", - "T = 365.; ## Time of reactor operation\n", - "## Estimation\n", - "Activity_total = 1.4*10**6*P*(t**(-0.2)-(t+T)**(-0.2));\n", - "Activity_one = Activity_total/N; ## For one fuel rod\n", - "## Result\n", - "print'%s %.2f %s'%('\\n The activity of a fuel rod = ',Activity_one,' Ci \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " The activity of a fuel rod = 808363.56 Ci \n", - "\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg86" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.13\n", - "import math\n", - "#calculate the\n", - "\n", - "## Using the data given in Table 3.4 and Table II.2 for uranium\n", - "v_235 = 2.418; ## Average number of neutrons released per fission\n", - "y_235 = 0.72; ## Isotropic abundance of Uranium-235 on the earth\n", - "sigmaf_235 = 582.2; ## Fission cross section of Uranium-235\n", - "sigmaa_235 = 680.8; ## Absorption cross section of Uranium-235\n", - "N_235 = y_235;\n", - "y_238 = 99.26; ## Isotropic abundance of Uranium-238 on the earth\n", - "sigmaa_238 = 2.7; ## Absorption cross section of Uranium-238\n", - "## Calculation\n", - "n = (v_235*y_235*sigmaf_235)/((y_235*sigmaa_235)+(y_238*sigmaa_238));\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Eta for natural uranium = ',n,' \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Eta for natural uranium = 1.34 \n", - "\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg90" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.14\n", - "import math\n", - "#calculate the\n", - "\n", - "## Fission of 1 g of Uranium-235 releases approximately 1 MW/day of energy. \n", - "## 1 MW/day = 8.64*10^(10) J\n", - "energy_uranium = 8.64*10**10;\n", - "\n", - "## 1. Coal\n", - "h_coal = 3*10**7; ## Heat contenet of coal in J/kg\n", - "## Calculation\n", - "amt_coal = energy_uranium/h_coal;\n", - "## Result\n", - "print'%s %.2f %s %.2f %s %.2f %s '%('\\n Amount of coal required for energy equivalent of fission = ',amt_coal,' kg ' and '\\n ',amt_coal/10**3,'metric tons' and '',amt_coal*1.10231/10**3,'short tons\\n');\n", - "## The result is expressed in all units of commercial importance.\n", - "\n", - "## 2. Oil\n", - "h_oil = 4.3*10**7; ## Heat contenet of oil in J/kg\n", - "## Calculation\n", - "amt_oil = energy_uranium/h_oil;\n", - "## Result\n", - "print'%s %.2f %s %.2f %s %.2f %s '%('\\n Amount of oil required for energy equivalent of fission = ',amt_oil,' kg\\n' or'',amt_oil/10**3,' tons' or '',amt_oil*6.3/10**3,'barrels\\n');\n", - "## The result is expressed in all units of commercial importance.\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Amount of coal required for energy equivalent of fission = 2880.00 \n", - " 2.88 3.17 short tons\n", - " \n", - "\n", - " Amount of oil required for energy equivalent of fission = 2009.30 kg\n", - " 2.01 tons 12.66 barrels\n", - " \n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg99" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.15\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "rho = 10.; ## Density of UO2 in g/cm^3\n", - "mol_wt_UO2 = 238.+(16.*2.); ## Molecular weight of UO2\n", - "per_U = (238./mol_wt_UO2)*100.; ## Percent by weight of Uranium\n", - "per_O = 100.-per_U; ## Percent by weight of Oxygen\n", - "\n", - "## Calculation \n", - "##Using the data given in Table II.4 for uranium and oxygen\n", - "mup_U = 0.0757; ## Ratio of mass attenuation coefficient to density of uranium in cm^2/g\n", - "mup_O = 0.0636; ## Ratio of mass attenuation coefficient to density of oxygen in cm^2/g\n", - "mup = (per_U/100.*mup_U)+(per_O/100.*mup_O); ## The total ratio of mass attenuation coefficient in cm^2/g\n", - "mu = mup*rho;\n", - "## Calculation \n", - "lambd = 1/mu;\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Mass attenuation coefficient of Uranium dioxide (UO2) = ',mu,' cm^(-1) \\n');\n", - "print'%s %.2f %s'%('\\n Mean free path = ',lambd,' cm \\n');\n", - "## The answer is marked wrongly in the textbook. But the solution is correctly evaluated.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Mass attenuation coefficient of Uranium dioxide (UO2) = 0.74 cm^(-1) \n", - "\n", - "\n", - " Mean free path = 1.35 cm \n", - "\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex16-pg100" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.16\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "E = 0.8; ## Average gamma ray energy in MeV\n", - "I = 3*10**(11); ## Intensity of gamma rays incident on the container in gamma rays/cm^2-sec\n", - "## Using the data given in Table II.5 for iron at 0.8 MeV\n", - "mup_iron = 0.0274; ## Ratio of mass attenuation coefficient to density of iron in cm^2/g\n", - "## Calculation \n", - "dep_rate = E*I*mup_iron;\n", - "## Expressing the result in SI units\n", - "## 1 MeV = 1.6*10^(-13) J\n", - "## 1 kg = 1000 g\n", - "dep_rate_SI = dep_rate*(1.6*10**(-13)*1000.);\n", - "print'%s %.2e %s %.2f %s '%('\\n Rate of energy deposited = ',dep_rate,' MeV/g-sec' and '',dep_rate_SI,' J/kg-sec \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Rate of energy deposited = 6.58e+09 1.05 J/kg-sec \n", - " \n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex17-pg106" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 3.17\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data \n", - "E_max = 1.39; ## Maximum energy of beta rays in MeV\n", - "## Calculation \n", - "R_max = 0.412*E_max**(1.265-(0.0954*math.log(E_max)));\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Maximum distance of beta rays traversed = ',R_max,' cm \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Maximum distance of beta rays traversed = 0.62 cm \n", - "\n" - ] - } - ], - "prompt_number": 18 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter4.ipynb b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter4.ipynb deleted file mode 100644 index 8212531f..00000000 --- a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter4.ipynb +++ /dev/null @@ -1,362 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:880d5b96d7a6ce9a20a4fd5f1bbd8bee89ba44d4461c16f4ef09e18728323ef7" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter4-Nuclear Reactors and Nuclear Power" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg121" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 4.1\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "## Number of neutrons absorbed by Uranium-238 in resonances for every neutron absorbed in Uranium-235\n", - "n_resonance = 0.254;\n", - "## Number of neutrons absorbed by Uranium-238 at thermal energy for every neutron absorbed in Uranium-235\n", - "n_th = 0.64;\n", - "m = 1; ## Amount of Uranium-235 consumed in kg\n", - "A_U = 235; ## Atomic mass number of Uranium-235\n", - "A_Pu = 239; ## Atomic mass number of Plutonium-239\n", - "\n", - "## 1.\n", - "## Calculation \n", - "C = n_resonance+n_th;\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Conversion ratio of the reactor = ',C,' \\n');\n", - "\n", - "## 2. \n", - "## Calculation \n", - "amt_Pu = m*C*A_Pu/A_U;\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Amount of Plutonium-239 produced in the reactor = ',amt_Pu,' kg \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Conversion ratio of the reactor = 0.89 \n", - "\n", - "\n", - " Amount of Plutonium-239 produced in the reactor = 0.91 kg \n", - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg127" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 4.2\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "wP0 = 1.; ## Total fuel consumption rate in terms of kg/day\n", - "M = 500.; ## Amount of Plutonium-239 in kg at startup of the reactor\n", - "breeding_gain = 0.15; ## Breeding gain of the reactor\n", - "\n", - "## 1.\n", - "print'%s %.2f %s'%(\" The Fast breeder reactor produces \",breeding_gain,\"kg of plutonium-239 more for every kilogram consumed \\n\");\n", - "## Calculation\n", - "## 1 year = 365 days\n", - "production_rate = math.ceil(breeding_gain*365);\n", - "## Result\n", - "print'%s %.2f %s %.2f %s '%(\"\\n Production rate of plutonium-239 = \",breeding_gain,\" kg/day\"and \" = \",production_rate,\" kg/year\");\n", - "\n", - "## 2.\n", - "## Calculation \n", - "t_Dl = M/production_rate;\n", - "t_De = math.log(2)*t_Dl;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Linear doubling time of plutonium fuel in the reactor = \",t_Dl,\" years \\n\");\n", - "print'%s %.2f %s'%(\" \\n Exponential doubling time of plutonium fuel in the reactor = \",t_De,\" years \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Fast breeder reactor produces 0.15 kg of plutonium-239 more for every kilogram consumed \n", - "\n", - "\n", - " Production rate of plutonium-239 = 0.15 = 55.00 kg/year \n", - " \n", - " Linear doubling time of plutonium fuel in the reactor = 9.09 years \n", - "\n", - " \n", - " Exponential doubling time of plutonium fuel in the reactor = 6.30 years \n", - "\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg128" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 4.3\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "power = 3300.; ## Reactor power in MW\n", - "time = 750.; ## Reactor operation time in days\n", - "amt_UO2 = 98.; ## Amount of Uranium dioxide (UO2) in metric tons\n", - "atwt_U = 238.; ## As the enrichment of Uranium-235 is 3 w/o the majority portion is Uranium-238\n", - "molwt_O = 16.; ## Molecular weight of Oxygen\n", - "\n", - "\n", - "## 1.\n", - "amt_U = amt_UO2*atwt_U/(atwt_U+2*molwt_O); ## Amount of uranium in tonne\n", - "total_burnup = power*time; ## Total burnup in MWd\n", - "## Calculation \n", - "specific_burnup = total_burnup/amt_U;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Specific burnup = \",specific_burnup,\" MWd/tonne \\n\");\n", - "\n", - "## 2.\n", - "## Due to fission of 1.05 g of Uranium-235, 1 MWd of energy is released.\n", - "m = 1.05;\n", - "P = 10**6;\n", - "maxth_burnup = P/m; ## Theoritical maximum burnup \n", - "## Calculation of Fractional burnup\n", - "bet = specific_burnup/maxth_burnup;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Fractional burnup = \",bet*100,\" percent \\n\");\n", - "## Due to approximation of specific burnup value, there is a slight change in fractional burnup value as compared to the textbook value.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Specific burnup = 28650.75 MWd/tonne \n", - "\n", - " \n", - " Fractional burnup = 3.01 percent \n", - "\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 4.4\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "ratpower = 1075.; ## Output rated electrical power in MWe of the reactor\n", - "delpower_yr = 255000.; ## Net output power delivered in one year in terms of MWd\n", - "time_refuel = 28.; ## Number of days the plant was shutdown for refuelling\n", - "time_repairs = 45.; ## Number of days the plant was shutdown for repairs\n", - "time_convrepairs = 18.; ## Number of days the plant was shutdown for conventional repairs\n", - "\n", - "## 1.\n", - "## 1 year = 365 days\n", - "ratpower_yr = ratpower*365.; ## Net output rated power in one year in terms of MWd\n", - "## Calculation\n", - "cap_factor = delpower_yr/ratpower_yr;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Plant capacity factor = \",math.ceil(cap_factor*100),\" percent\\n\");\n", - "\n", - "## 2.\n", - "## Number of days the plant was shutdown in one year \n", - "total_shutdown = time_refuel+time_repairs+time_convrepairs;\n", - "## Number of days the plant was operable in one year\n", - "total_operation = 365.-total_shutdown;\n", - "## Calculation\n", - "ava_factor = total_operation/365.;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Plant availability factor = \",ava_factor*100,\" percent\\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Plant capacity factor = 65.00 percent\n", - "\n", - " \n", - " Plant availability factor = 75.07 percent\n", - "\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg195" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 4.5\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data \n", - "t = 30.; ## Time of uranium sufficiency in years \n", - "## Assuming once through Light Water Reactor (LWR)fuel cycle\n", - "U_LWR = 0.0055; ## Uranium Utilization factor for LWR\n", - "## Assuming once through Liquid Metal cooled Fast Breeder Reactor (LMFBR) fuel cycle\n", - "U_LMFBR = 0.67; ## Uranium Utilization factor for LMFBR\n", - "## Estimation \n", - "est_time = 30.*U_LMFBR/U_LWR;\n", - "## Result\n", - "print'%s %.2f %s'%(\"The time for which Uranium would fuel LMFBR = \",math.ceil(est_time),\" years \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The time for which Uranium would fuel LMFBR = 3655.00 years \n", - "\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg204" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 4.6\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "A_U = 238.; ## Atomic Mass number of Uranium\n", - "A_O = 16.; ## Atomic Mass number of Oxygen\n", - "amt_UO2 = 33000.; ## Amount of Uranium dioxide (UO2) present in kilogram(kg)\n", - "x_P = 0.032; ## Enrichment of 3.2 w/o uranium product\n", - "x_T = 0.002; ## Enrichemnt of 0.2 w/o residual tails\n", - "## From Figure 4.45\n", - "x_F = 0.00711; ## Enrichemnt of 0.711 w/o feed\n", - "\n", - "## 1.\n", - "## Estimation of enriched uranium in kg\n", - "M_P = A_U*amt_UO2/(A_U+2*A_O);\n", - "## Estimation of amount of Uranium feed in kg\n", - "M_F = ((x_P-x_T)/(x_F-x_T))*M_P;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The amount of uranium feed required per reload = \",math.ceil(M_F),\" kg \\n\");\n", - "\n", - "## 2.\n", - "V_x_P = (1.-2.*x_P)*math.log((1.-x_P)/x_P); ## Value function of uranium product with enrichemnt of 3.2 w/o\n", - "V_x_F = (1.-2.*x_F)*math.log((1.-x_F)/x_F); ## Value function of feed with enrichemnt of 0.711 w/o\n", - "V_x_T = (1.-2.*x_T)*math.log((1.-x_T)/x_T); ## Value function of tallings with enrichemnt of 0.2 w/o\n", - "rate_SWU = 130.75; ## Enrichment cost in dollars per SWU\n", - "## Calculation \n", - "SWU = M_P*(V_x_P-V_x_T)-M_F*(V_x_F-V_x_T); ## Separative Work (SWU) in kg\n", - "enrich_cost = math.ceil(SWU)*rate_SWU; ## Enrichment cost in dollars\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n The enrichment cost = $ \",math.ceil(enrich_cost),\" \\n\");\n", - "## Due to approximation of Separative Work Unit(SWU), there is a difference in the value of enrichment cost on comparison with the textbook value.\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The amount of uranium feed required per reload = 170777.00 kg \n", - "\n", - "\n", - " The enrichment cost = $ 18052522.00 \n", - "\n" - ] - } - ], - "prompt_number": 6 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter5.ipynb b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter5.ipynb deleted file mode 100644 index 82525e71..00000000 --- a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter5.ipynb +++ /dev/null @@ -1,219 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:404232c11852d8073965cae8d34dbfea00044f853a4ec60d9b13da2ddbfc3adb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter5-Neutron Diffusion and Moderation " - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg234" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 5.2\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigma_s = 4.8*10**(-24) ## Scattering cross section of carbon in cm^2\n", - "A_C = 12.; ## Atomic Mass number for carbon-12\n", - "E = 1.; ## Energy of carbon-12 atom in eV\n", - "## Using the data given in Table II.3, for carbon (graphite) at energy 1 eV\n", - "N = 0.08023*10**(24); ## Atom density in terms of atom/cm^3\n", - "mu_bar = 2./(3.*A_C); ## Average value of the cosine of the angle at which neutrons are scattered in the med/ium\n", - "SIGMA_s = N*sigma_s ## Macroscopic scattering cross section of carbon-12\n", - "## Calculation\n", - "D = 1/(3.*SIGMA_s*(1.-mu_bar));\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Diffusion coefficeint of graphite at 1 eV = ',D,' cm \\n');\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg250" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 5.5\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "phi1 = 6*10**(14); ## Neutron flux of Group 1\n", - "phi2 = 1*10**(15); ## Neutron flux of Group 2\n", - "phi3 = 3*10**(15); ## Neutron flux of Group 3\n", - "\n", - "## 1.\n", - "## Using the data given in Table II.3, for atom density of sodium\n", - "N = 0.02541*10**(24); ## Atom density in terms of atom/cm^3\n", - "## Using the data given for sigmay (Microscopic radiative capture cross section) in Table II.3,\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigmay1 = 0.0005*10**(-24); ## Microscopic gamma cross section of Group 1\n", - "sigmay2 = 0.001*10**(-24); ## Microscopic gamma cross section of Group 2\n", - "sigmay3 = 0.001*10**(-24); ## Microscopic gamma cross section of Group 3\n", - "## Calculation \n", - "F_a = N*((sigmay1*phi1)+(sigmay2*phi2)+(sigmay3*phi3));\n", - "## Result\n", - "print'%s %.2e %s'%('\\n Total absorption rate for three groups = ',F_a,' neutrons/cm^3-sec \\n');\n", - "\n", - "## 2.\n", - "## Calculation\n", - "sigmag_12 = 0.24*10**(-24); ## Microscopic scattereing cross section of neutrons from Group 1 to Group 2\n", - "F_12 = N*sigmag_12*phi1;\n", - "## Result\n", - "print'%s %.2e %s'%('\\n Neutron scattering rate from the first to second group = ',F_12,' neutrons/cm^3-sec \\n');\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Total absorption rate for three groups = 1.09e+11 neutrons/cm^3-sec \n", - "\n", - "\n", - " Neutron scattering rate from the first to second group = 3.66e+12 neutrons/cm^3-sec \n", - "\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg255" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 5.6\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "S = 10**7; ## Strength of neutron source in neutrons/sec\n", - "r = 15.; ## Distance over which neutron flux is to be calculated in cm\n", - "## Using the data given in Table 5.2,\n", - "L_T = 2.85; ## Thermal diffusion length in cm\n", - "D_bar = 0.16; ## Diffusion coefficient in cm\n", - "## Calculation\n", - "phi_T = S*math.exp(-r/L_T)/(4.*math.pi*D_bar*r);\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Neutron flux = ',phi_T,' neutrons/cm^2-sec \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Neutron flux = 1717.19 neutrons/cm^2-sec \n", - "\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg256" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 5.7\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "T_F = 500.; ## Temeperature in Fahrenheit\n", - "P = 2000.; ## Pressure in psi\n", - "rho = 49.6; ## Density in terms of lb/ft^3\n", - "## Converting the given temperature from Fahrenheit to Celsius\n", - "T_C = (5./9.)*(T_F-32.);\n", - "## Converting the temperature from Celsius to Kelvin scale\n", - "T_K = 273.+T_C;\n", - "\n", - "## Using the data given in Table 5.2,\n", - "D_bar_0 = 0.16; ## Diffusion coefficient at 293 K\n", - "rho_0 = 62.4; ## Density at 293 K in terms of lb/ft^3\n", - "L_T2_0 = 8.1; ## Diffusion area at 293 K in cm^2\n", - "T_0 = 293.; ## Standard Temperature in kelvin\n", - "m = 0.47; ## Material specific constant\n", - "## Calculation\n", - "D_bar = D_bar_0*(rho_0/rho)*(T_K/T_0)**m;\n", - "L_T2 = L_T2_0*(rho_0/rho)**2*(T_K/T_0)**(m+1./2.);\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Diffusion coefficient of ordinary water = ',D_bar,' cm \\n');\n", - "print'%s %.2f %s'%('\\n Diffusion area of ordinary water =',L_T2,' cm^2 \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Diffusion coefficient of ordinary water = 0.27 cm \n", - "\n", - "\n", - " Diffusion area of ordinary water = 22.91 cm^2 \n", - "\n" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter6.ipynb b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter6.ipynb deleted file mode 100644 index 97c98f94..00000000 --- a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter6.ipynb +++ /dev/null @@ -1,853 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:dac618b42b2d60a894fc7fe946d9b950a03dfb7c132c931b72943811e6843635" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter6-Neutron Reactor Theory" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg269" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.1\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "M_F = 235.; ## Atomic mass of Uranium-235\n", - "M_S = 23.; ## Atomic mass of Sodium-23\n", - "rho_F_S = 1.; ## Ratio of densities of Uranium fuel to Sodium\n", - "## Using the data given in Table 5.2,\n", - "sigmaa_S=0.0008; ## Absorption cross section of Sodium\n", - "sigmaa_F=1.65; ## Absorption cross section of Uranium\n", - "\n", - "rho_S_F = 100.-rho_F_S;\n", - "N_S_F = rho_S_F*(M_F/M_S); ## Ratio of atomic densities of Uranium and Sodium\n", - "## Using the data in Table 6.1 for Uranium-235\n", - "## The value of average number of neutrons produced for a neutron absorbed n(eta) for Uranium-235 is 2.2\n", - "eta = 2.2;\n", - "\n", - "## Calculation \n", - "f = 1./(1.+(N_S_F*(sigmaa_S/sigmaa_F)));\n", - "k_inf = eta*f;\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Thermal Utilization factor = ',f,' \\n');\n", - "print'%s %.2f %s'%('\\n Infinite Multiplication factor = ',k_inf,' \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Thermal Utilization factor = 0.67 \n", - "\n", - "\n", - " Infinite Multiplication factor = 1.48 \n", - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg282" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.2\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "R = 50.; ## Radius of reactor core in cm\n", - "P = 100*10**6; ## Power level of the reactor in watt\n", - "SIGMA_f = 0.0047; ## Macroscopic fission cross section in cm^(-1)\n", - "E_R = 3.2*10**(-11); ## Energy released per fission in joules/second\n", - "## Using the data in Table 6.2 for spherical geometry\n", - "OMEGA = 3.29; ## Measure of the variation of flux in the reactor\n", - "## Calculation\n", - "phi_max = (math.pi*P)/(4.*E_R*SIGMA_f*R**3);\n", - "phi_av = phi_max/OMEGA;\n", - "## Result\n", - "print'%s %.2e %s'%('\\n Maximum flux in the spherical reactor = ',phi_max,' neutrons/cm^2-sec \\n');\n", - "print'%s %.2e %s'%('\\n Average flux in the spherical reactor = ',phi_av,' neutrons/cm^2-sec \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Maximum flux in the spherical reactor = 4.18e+15 neutrons/cm^2-sec \n", - "\n", - "\n", - " Average flux in the spherical reactor = 1.27e+15 neutrons/cm^2-sec \n", - "\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.3\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "N_F = 0.00395*10**(24); ## Atom density of Plutonium-239 fuel in atom/cm^3\n", - "N_S = 0.0234*10**(24); ## Atom density of Sodium-23 in atom/cm^3\n", - "## Using the data given in Table 6.1,\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigmaa_S = 0.0008*10**(-24); ## Microscopic absorption cross section of Sodium in cm^2\n", - "sigmaa_F = 2.11*10**(-24); ## Microscopic absorption cross section of Plutonium in cm^2\n", - "sigmatr_F = 6.8*10**(-24); ## Microscopic transport cross section of Plutonium\n", - "sigmatr_S = 3.3*10**(-24); ## Microscopic transport cross section of Sodium\n", - "## The value of average number of neutrons produced for a neutron absorbed n(eta) for Plutonium-239 is 2.61\n", - "eta = 2.61;\n", - "\n", - "SIGMAA_S = sigmaa_S*N_S; ## Macroscopic absorption cross section of Sodium in cm^(-1)\n", - "SIGMAA_F = sigmaa_F*N_F; ## Macroscopic absorption cross section of Plutonium in cm^(-1)\n", - "SIGMAA = SIGMAA_S+SIGMAA_F; ## Total macroscopic absorption cross section in cm^(-1)\n", - "SIGMA_tr = (sigmatr_F*N_F)+(sigmatr_S*N_S); ## Macroscopic transport cross section \n", - "f = SIGMAA_F/SIGMAA; ## Calculation of Thermal Utilization factor(f)\n", - "f = math.ceil(f);\n", - "k_inf = eta*f; ## Calculation of Infinite Multiplication factor(k_inf)\n", - "\n", - "D = 1/(3*SIGMA_tr); ## Calculation of Diffusion coefficient\n", - "L2 = D/SIGMAA; ## Diffusion area\n", - "d = 2.13*D; ## Extrapolated distance\n", - "R_ctil = math.pi*math.sqrt(L2/(k_inf-1)); ## Critical Radius for an extrapolated boundary\n", - "## Calculation\n", - "R_c = R_ctil-d;\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Critical Radius = ',R_c,' cm \\n');\n", - "## The answer given in the textbook is wrong. \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Critical Radius = 41.66 cm \n", - "\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.4\n", - "import math\n", - "#calculate the\n", - "\n", - "## Using the result from Example 6.3\n", - "R_c = 48.5; ## Critical Radius for an extrapolated boundary in cm\n", - "L2 = 384.; ## Diffusion area in cm^2\n", - "## Calculation\n", - "P_L = 1./(1.+((math.pi/R_c)**2*L2));\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Nonleakage probability of a fission neutron = ',P_L,' \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Nonleakage probability of a fission neutron = 0.38 \n", - "\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg294" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.5\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "R = 100.; ## Radius of a spherical reactor in cm\n", - "P = 10**5; ## Power of the reactor in watt\n", - "\n", - "## 1.\n", - "## Calculation\n", - "B = math.sqrt((math.pi/R)**2);\n", - "## Result\n", - "print'%s %.2e %s'%(\" \\n Buckling = \",B,\" \\n\");\n", - "\n", - "## 2.\n", - "## Using the data from Tables 3.2, 5.2, 5.3 and 6.3\n", - "L_TM2 = 3500.; ## Diffusion area of moderator (Sodium) in cm^2\n", - "n_T = 2.065; ## Average number of fission neutrons emitted per neutron absorbed\n", - "t_TM = 368.; ## Diffusion time of moderator (Sodium) in cm^2\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigma_aM = 0.0034*10**(-24); ## Microscopic absorption cross section of Sodium in cm^2\n", - "sigma_aF = 681*10**(-24); ## Microscopic absorption cross section of Uranium-235 in cm^2\n", - "g_a = 0.978; ## Non 1/v factor\n", - "M_F = 235.; ## Molecular weight of Uranium-235\n", - "M_M = 12.; ## Molecular weight of Carbon-12\n", - "Z = (1+B**2*(L_TM2+t_TM))/(n_T-1.-(B**2*t_TM)); ## An intermediate factor \n", - "## Calculation \n", - "rho_M = 1.6; ## Density of Graphite in g/cm^3\n", - "m_M = (4/3.*math.pi*R**3)*rho_M; ## Mass of moderator\n", - "## Calculation \n", - "m_F = ((Z*sigma_aM*M_F)/(g_a*sigma_aF*M_M))*m_M/1000.;\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n Critical mass = \",m_F,\" kg \\n\");\n", - "\n", - "## 3.\n", - "f = Z/(Z+1.); ## Thermal utilization factor\n", - "## Calculation \n", - "k_inf = n_T*f;\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Infinite Multiplication factor (k_inf) = ',k_inf,' \\n');\n", - "\n", - "## 4.\n", - "## Calculation \n", - "L_T2 = (1.-f)*L_TM2\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n Thermal Diffusion area = \",L_T2,\" cm^2 \\n\");\n", - "\n", - "## 5.\n", - "E_R = 3.2*10**(-11); ## Energy per fission reaction in joules/second\n", - "N_A = 6.02*10**(23); ## Avogadro number (constant)\n", - "V = (4/3.*math.pi*R**3); ## Volume of the spherical reactor in cm^3\n", - "## Using the data from Tables 3.2\n", - "g_fF = 0.976; ## Non 1/v factor Uranium-235 fuel\n", - "## Using the data from Tables II.2 for Uranium-235\n", - "sigma_f = 582.*10**(-24); ## Microscopic fission cross section for Uranium-235 in cm^2\n", - "## Macroscopic fission cross section is calculated as follows\n", - "SIGMA_f = m_F*N_A*0.886*g_fF*sigma_f*1000./(V*M_F);\n", - "\n", - "## From Table 6.2, the constant A can be calculated as\n", - "A = P/(4.*(R**2)*E_R*SIGMA_f);\n", - "\n", - "## The expression for thermal flux is\n", - "print'%s %.2e %s'%(\" \\n The expression for thermal flux = \",A,\" math.sin (Br)/r \\n\");\n", - "## The maximum value of thermal flux is given at distance equal to zero\n", - "phi_T0 = A*B;\n", - "## Result\n", - "print'%s %.2e %s'%(\" The maximum thermal flux = \",phi_T0,\" neutrons/cm^2-sec \\n\");\n", - "## There is a slight variation in the values of diffusion area and constant A as compared from the textbook. This is due to approximation of values in textbook.\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Buckling = 3.14e-02 \n", - "\n", - "\n", - " Critical mass = 4.60 kg \n", - "\n", - "\n", - " Infinite Multiplication factor (k_inf) = 1.80 \n", - "\n", - "\n", - " Thermal Diffusion area = 445.03 cm^2 \n", - "\n", - " \n", - " The expression for thermal flux = 5.52e+13 math.sin (Br)/r \n", - "\n", - " The maximum thermal flux = 1.73e+12 neutrons/cm^2-sec \n", - "\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg296" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.6\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "rho_F = 0.0145; ## Density of Uranium-235 in the mixture in g/cm^3\n", - "rho_M = 1.; ## Density of Water in the mixture in g/cm^3\n", - "M_M = 18.; ## Molecular weight of water\n", - "M_F = 235.; ## Molecular weight of Uranium-235\n", - "\n", - "## 1.\n", - "## The ratio of number of atoms of Uranium-235 to water per cc is\n", - "NF_NM = (rho_F*M_M)/(rho_M*M_F);\n", - "## Using the data from Tables 3.2\n", - "g_aF = 0.978; ## Non 1/v factor of Uranium-235 fuel\n", - "g_aM = 2.; ## Non 1/v factor of Water\n", - "## Using the data from Table II.2 for Uranium-235\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigma_aF = 681*10**(-24); ## Microscopic absorption cross section of Uranium-235 in cm^2\n", - "sigma_aM=0.333*10**(-24); ## Microscopic absorption cross section of Hydrogen in cm^2\n", - "## Using the data form Table 6.3 at temperature = 20 deg \n", - "n_T = 2.065; ## Average number of neutrons produced per neutron absorbed in fission\n", - "phisig_aF = 0.886*g_aF*sigma_aF; ## Average thermal absorption cross-section of fuel \n", - "phisig_aM = 0.886*g_aM*sigma_aM; ## Average thermal absorption cross-sections of moderator\n", - "Z = (NF_NM)*(phisig_aF/phisig_aM); ## Parameter Z\n", - "f = Z/(Z+1.); ## Thermal utilization factor of the fuel\n", - "k_inf = n_T*f; ## Infinite multiplication factor \n", - "\n", - "## From Table 5.2 and 5.3\n", - "L_TM2 = 8.1; ## Diffusion area in cm^2\n", - "t_T = 27.; ## Neutron age in cm^2\n", - "L_T2 = (1-f)*L_TM2; ## Diffusion area of fuel moderator mixture\n", - "M_T2 = L_T2+t_T; ## Migration area of fuel moderator mixture\n", - "## Buckling can be found as\n", - "B2 = (k_inf-1.)/M_T2;\n", - "print(\" \\n Using the buckling formula from Table 6.2 \\n B^2 = (2.405/R)^2+(pi/H)^2 \\n For minumum critical mass H = 1.82R \\n\");\n", - "## On solving for R in B^2 = 8.763/R^2\n", - "R = math.sqrt(8.763/B2);\n", - "H = 1.82*R;\n", - "## Result\n", - "print(\" \\n The dimensions of the cylinder are\");\n", - "print'%s %.2f %s %.2f %s '%(\" \\n Radius of cylinder = \",R,\" cm\" and \"\\t Height of cylinder =\",H,\" cm \\n\");\n", - "\n", - "## 2.\n", - "V = math.pi*R**2*H; ## Reactor volume (in cc) assuming cylindrical geometry\n", - "## Calculation \n", - "m_F = rho_F*V;\n", - "print'%s %.2f %s'%(\" \\n The critical fuel mass = \",m_F/1000,\" kg \\n\");\n", - "## There is a slight variation in the values of dimensions of cylinder and critical fuel mass as compared from the textbook. This is due to approximation of values in textbook.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Using the buckling formula from Table 6.2 \n", - " B^2 = (2.405/R)^2+(pi/H)^2 \n", - " For minumum critical mass H = 1.82R \n", - "\n", - " \n", - " The dimensions of the cylinder are\n", - " \n", - " Radius of cylinder = 55.85 \t Height of cylinder = 101.65 cm \n", - " \n", - " \n", - " The critical fuel mass = 14.44 kg \n", - "\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg302" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.7\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "R = 300.; ## Radius of the sphere in cm\n", - "M_M = 20.; ## Molecular weight of heavy water\n", - "M_F = 235.; ## Molecular weight of Uranium-235\n", - "\n", - "## 1.\n", - "## Using the data from Table 5.2\n", - "Dbar_r = 0.84; ## Diffusion coefficient of graphite in cm\n", - "Dbar_c = 0.87; ## Diffusion coefficient of heavy water in cm\n", - "L_TM2 = 9400.; ## Diffusion area of heavy water in cm^2\n", - "L_r = 59.; ## Diffusion length of graphite in cm\n", - "## Using the data from Table 3.2\n", - "g_aF = 0.978; ## Non 1/v factor Uranium-235 fuel\n", - "## Using the data from Table II.2 for Uranium-235\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigma_aF = 681.*10**(-24); ## Microscopic absorption cross section of Uranium-235 in cm^2\n", - "SIGMA_aM = 9.3*10**(-5)*10**(-24); ## Macroscopic absorption coefficient of Heavy water in cm^(-1)\n", - "N = 0.03323; ## Atomic density of heavy water\n", - "## Let BRcot(BR)= y\n", - "y = 1-((Dbar_r/Dbar_c)*((R/L_r)+1));\n", - "## Considering only the first solution, B*R=2.64\n", - "B = 2.64/R;\n", - "## Using the data form Table 6.3 at temperature = 20 deg \n", - "n_T = 2.065; ## Average number of neutrons produced per neutron absorbed in fission\n", - "Z = (1+(B**2*L_TM2))/(n_T-1); ## A parameter\n", - "sigma_aM = math.sqrt(4./math.pi)*SIGMA_aM/N; ## Microscopic absorption cross section of Heavy water in cm^2\n", - "## The ratio of densities of fuel to moderator\n", - "rho_FM = Z*(M_F*sigma_aM)/(M_M*g_aF*sigma_aF)\n", - "rho_M = 1.1; ## Density of Heavy water in g/cm^3\n", - "## Calculation\n", - "rho_F = rho_FM*rho_M;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The critical concentration = \",rho_F*1000,\" g/litre \\n\");\n", - "\n", - "## 2.\n", - "V = (4./3.)*math.pi*R**3; ## Reactor volume (in cc) assuming spherical geometry\n", - "## Calculation\n", - "m_F = rho_F*V;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The critical fuel mass = \",m_F/1000,\" kg \\n\");\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The critical concentration = 0.10 g/litre \n", - "\n", - " \n", - " The critical fuel mass = 11.25 kg \n", - "\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg303" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.8\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "rho_F = 2*10**(-4); ## Concentration of Uranium-235 fuel in g/cm^3\n", - "rho_M = 1.6; ## Concentration of graphite moderator in g/cm^3\n", - "M_F = 235.; ## Molecular mass of Uranium-235 fuel\n", - "M_M = 12.; ## Molecular mass of Graphite(Carbon) moderator\n", - "\n", - "## 1.\n", - "## Using the data from Tables 3.2\n", - "g_aF = 0.978; ## Non 1/v factor Uranium-235 fuel\n", - "## Using the data from Table II.2 for Uranium-235 and Carbon\n", - "## 1 barn = 10^(-24) cm^2\n", - "sigma_aF = 681.*10**(-24); ## Microscopic absorption cross section of Uranium-235 in cm^2\n", - "sigma_aM = 3.4*10**(-3)*10**(-24); ## Microscopic absorption cross section of Graphite in cm^2\n", - "Z = (rho_F*M_M*g_aF*sigma_aF)/(rho_M*M_F*sigma_aM); ## Parameter Z\n", - "f = Z/(Z+1); ## Thermal utilization factor of the fuel\n", - "## Using the data form Table 6.3 at temperature = 20 deg \n", - "n_T = 2.065; ## Average number of neutrons produced per neutron absorbed in fission\n", - "k_inf = n_T*f; ## The infinite multiplication factor\n", - "## From Table 5.2\n", - "L_TM2 = 3500.; ## Diffusion area of Graphite in cm^2\n", - "L_r = 59.; ## Diffusion length of graphite in cm\n", - "L_T2 = (1.-f)*L_TM2; ## Diffusion area of fuel moderator mixture\n", - "## Buckling can be found as\n", - "B = math.sqrt((k_inf-1)/L_T2);\n", - "## Calculation\n", - "R=269.\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The critical radius of fuel loaded thermal reactor = \",R,\" cm \\n\");\n", - "\n", - "## 2.\n", - "## Reactor is bare or reflector is not present\n", - "## Calculation\n", - "R0 = math.pi/B;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The critical radius of bare thermal reactor = \",R0,\" cm \\n\");\n", - "## There is a slight variation in the value of critical radius as compared from the textbook. This is due to approximation of the thermal utilization factor value in textbook.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The critical radius of fuel loaded thermal reactor = 269.00 cm \n", - "\n", - " \n", - " The critical radius of bare thermal reactor = 322.75 cm \n", - "\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg307" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.9\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "rho_F = 0.0145; ## Concentration of Uranium-235 fuel in g/cm^3\n", - "## Using the result of Example 6.6 \n", - "M_T2 = 30.8; ## Migration area in cm^2\n", - "B = 0.0529; ## Buckling factor\n", - "delta = 7.2+0.1*(M_T2-40); ## Empirical formula for reflector savings\n", - "R0 = math.pi/B; ## The radius of the bare reactor\n", - "## Calculation \n", - "R = R0-delta;\n", - "m_F=rho_F*4./3.*math.pi*R**3;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The critical radius of reflected reactor = \",R,\" cm \\n\");\n", - "print'%s %.2f %s'%(\" \\n The critical mass of reflected reactor = \",m_F/1000,\" kg \\n\");\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The critical radius of reflected reactor = 53.11 cm \n", - "\n", - " \n", - " The critical mass of reflected reactor = 9.10 kg \n", - "\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.10\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "N = 150.; ## Number of zirconium atoms for every uranium atom\n", - "\n", - "## 1.\n", - "## Using the data of atom density of zirconium from Table II.3\n", - "N_Z = 0.0429; ## Atom density of zirconium in terms of 10^(24)\n", - "sigma_tZ = 6.6; ## Total cross section of zirconium in barns\n", - "## Using the data of cross section of uranium-235 from Table II.3\n", - "sigma_tU = 690.; ## Total cross section of uranium in barns\n", - "N_25 = N_Z/N; ## Atom concentration of uranium-235\n", - "## Calculation \n", - "lambd = 1./((sigma_tZ*N_Z)+(sigma_tU*N_25));\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The mean free path of thermal neutrons = \",lambd,\" cm \\n\");\n", - "\n", - "## 2.\n", - "## Using the data of atom density of water from Table II.3\n", - "N_W = 0.0334; ## Atom density of water in terms of 10^(24)\n", - "## As the water and zirconium occupy half of the volume\n", - "N_W = 0.5*0.0334;\n", - "N_Z = 0.5*0.0429;\n", - "## From the Figure 6.6\n", - "## Uranium is present in one third of the sandwich or \\n one sixth of the entire area \n", - "N_25 = 2.86*10**(-4)/6.;\n", - "## Using the data from Table 3.2\n", - "g_aF = 0.978; ## Non 1/v factor Uranium-235 fuel\n", - "## Using the data from Table II.3 for microscopic absorption cross section \n", - "sigma_aU = 681.; ## Microscopic absorption cross section of Uranium-235 in barns\n", - "sigma_aZ = 0.185; ## Microscopic absorption cross section of Zirconium in barns\n", - "sigma_aW = 0.664; ## Microscopic absorption cross section of Water in barns\n", - "f = (N_25*g_aF*sigma_aU)/((N_25*g_aF*sigma_aU)+(N_Z*sigma_aZ)+(N_W*sigma_aW)); ## Thermal utilization factor\n", - "## Using the data form Table 6.3 at temperature = 20 deg \n", - "n_T = 2.065; ## Average number of neutrons produced per neutron absorbed in fission\n", - "## Calculation\n", - "k_inf = n_T*f;\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n Infinite multiplication factor = \",k_inf,\" \\n\");\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The mean free path of thermal neutrons = 2.08 cm \n", - "\n", - "\n", - " Infinite multiplication factor = 1.40 \n", - "\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg312" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.11\n", - "import math\n", - "#calculate the\n", - "\n", - "## Using the data from Table 3.2\n", - "g_a25=0.978; ## Non 1/v factor Uranium-235 fuel for absorption\n", - "g_f25=0.976; ## Non 1/v factor Uranium-235 fuel for fission\n", - "g_a28=1.0017; ## Non 1/v factor Uranium-238 fuel for absorption\n", - "\n", - "v_25=2.42; ## Average number of neutrons in one fission of Uranium-235\n", - "## Using the data from Table II.3 for microscopic absorption and fission cross section \n", - "sigma_a25=681.; ## Microscopic absorption cross section of Uranium-235 in barns\n", - "sigma_a28=2.7; ## Microscopic absorption cross section of Uranium-238 in barns\n", - "sigma_f25=582.; ## Microscopic fission cross section of Uranium-235 in barns\n", - "\n", - "## Using the data of atom density of uranium and let N_28/N_25= N\n", - "N = 138.;\n", - "## Calculation\n", - "n_T = (v_25*sigma_f25*g_f25)/((sigma_a25*g_a25)+(N*sigma_a28*g_a28));\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n Average number of neutrons produced per neutron absorbed in fission = \",n_T,\" \\n\");\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Average number of neutrons produced per neutron absorbed in fission = 1.32 \n", - "\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg315" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.12\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "rdist = 25.4; ## Distance between the rods in cm\n", - "a = 1.02; ## Radius of a rod in cm\n", - "## From the Figure 6.9\n", - "b = rdist/math.sqrt(math.pi); ## Radius of equivalent cell in cm\n", - "## Using the data from Table 5.2\n", - "L_F = 1.55; ## Diffusion length of uranium fuel in cm\n", - "L_M = 59.; ## Diffusion length of graphite moderator in cm\n", - "## Using the data from Table II.3 at thermal energy\n", - "SIGMA_aM = 0.0002728; ## Macroscopic absorption cross section of graphite moderator in barns\n", - "SIGMA_aF = 0.3668; ## Macroscopic absorption cross section of uranium fuel in barns\n", - "## Let\n", - "x = a/L_F;\n", - "y = a/L_M;\n", - "z = b/L_M;\n", - "## The series expansion relations are\n", - "F = 1.+(0.5*(x/2)**2)-((1/12.)*(x/2.)**4)+((1./48.)*(x/2.)**6);\n", - "E = 1.+(z**2/2.)*(((z**2*math.log(z/y))/(z**2-y**2))-(3./4.)+(y**2/(4.*z**2)));\n", - "## Let the ratio of volumes of moderator to fuel is denoted by V\n", - "V = (b**2-a**2)/a**2;\n", - "## Calculation\n", - "f = 1./((SIGMA_aM*V*F/SIGMA_aF)+E);\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n The thermal utilization factor = \",f,\" \\n\");\n", - "## There is a slight variation in the value as compared from the textbook. This is due to approximation of the parameters value in textbook.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " The thermal utilization factor = 0.83 \n", - "\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg317" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 6.13\n", - "import math\n", - "#calculate the\n", - "\n", - "## Using the data given in the problem 6.12\n", - "rdist = 25.4; ## Distance between the rods in cm\n", - "a = 1.02; ## Radius of the rod in cm\n", - "b = rdist/math.sqrt(math.pi); ## Radius of equivalent cell\n", - "V = (b**2-a**2)/a**2; ## Ratio of volumes of moderator to fuel \n", - "## Using the data from Table II.3 for Uranium-238 density and atom density \n", - "rho = 19.1; ## Uranium-238 density in g/cm^3\n", - "N_F = 0.0483; ## Atom density in terms of 10^(24)\n", - "## Using Table 6.5 for Uranium-238 \n", - "A = 2.8;\n", - "C = 38.3;\n", - "## Using Table 6.6 for graphite\n", - "## Let zeta_M*SIGMA_sM = s\n", - "s = 0.0608;\n", - "I = A+C/math.sqrt(a*rho); ## Empirical expression of resonance integral parameter\n", - "## Calculation\n", - "p = math.exp(-(N_F*I)/(s*V));\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n Resonance escape probability = \",p,\" \\n\");\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Resonance escape probability = 0.95 \n", - "\n" - ] - } - ], - "prompt_number": 13 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter7.ipynb b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter7.ipynb deleted file mode 100644 index e5f67c9d..00000000 --- a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter7.ipynb +++ /dev/null @@ -1,692 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:92ba071ae8441e628d6e48d6bed3956e1450dfdeedb2940c72a1babe427f9ed2" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter7-The Time Dependent Reactor" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg332" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.1\n", - "import math\n", - "#calculate the\n", - "\n", - "## Using the data form Table 6.3 at temperature = 20 deg \n", - "n_T = 2.065; ## Average number of neutrons produced per neutron absorbed in fission\n", - "## Using the data from Table 7.1\n", - "t_dM = 2.1e-4; ## The mean diffusion time of the moderator in seconds\n", - "k_inf = 1.; ## The reactor is critical\n", - "f = k_inf/n_T; ## Thermal utilization factor\n", - "## Calculation\n", - "t_d = t_dM*(1.-f);\n", - "l_p = t_d;\n", - "## Result\n", - "print'%s %.2e %s'%(\" \\n The prompt neutron lifetime = \",l_p,\" seconds \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The prompt neutron lifetime = 1.08e-04 seconds \n", - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg333" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.2\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "k_inf = 1.001; ## Infinite multiplication factor\n", - "## From the Example 7.1\n", - "l_p = 1e-4; ## Prompt neutron lifetime\n", - "## Calculation\n", - "T = l_p/(k_inf-1.);\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The response time of the reactor = \",T,\" sec \\n\");\n", - "print'%s %.2f %s'%(\" \\n The reactor power will increase as exp(t/\",T,\"), where ''t'' denotes the time in seconds \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The response time of the reactor = 0.10 sec \n", - "\n", - " \n", - " The reactor power will increase as exp(t/ 0.10 ), where ''t'' denotes the time in seconds \n", - "\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg337" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.3\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "k_inf = 1.001; ## Infinite multiplication factor\n", - "## Calculation\n", - "rho = (k_inf-1.)/k_inf;\n", - "## Result\n", - "print'%s %.2e %s %.2f %s '%(\" \\n The reactivity = \",rho,\"\" or \"\",rho*100,\" percent \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The reactivity = 9.99e-04 0.10 percent \n", - " \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg340" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.4\n", - "import math\n", - "#calculate the\n", - "\n", - "## Using the result of Example 7.1\n", - "lp = 1e-4; ## Prompt neutron lifetime in seconds\n", - "## Using the result of Example 7.3\n", - "rho = 1e-3; ## Reactivity\n", - "## By referring to Figure 7.2\n", - "print(\" \\n Reactor period = 57 seconds \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Reactor period = 57 seconds \n", - "\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg341" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.5\n", - "import math\n", - "#calculate the\n", - "\n", - "## Using the result of Example 7.3\n", - "reactivity = 0.001;\n", - "## As the reactor is fueled with Uranium-235 \n", - "bet = 0.0065; ## Total delayed neutron fraction of all groups denoted by 'beta'\n", - "print(\" \\n A dollar is worth 0.0065 in reactivity for Uranium-235 reactor. \\n\");\n", - "## Calculation\n", - "rho = reactivity/bet;\n", - "## Result\n", - "print'%s %.2f %s %.2f %s '%(\" \\n Reactivity = \",rho,\" dollars\" or \"\",rho*100,\" cents \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " A dollar is worth 0.0065 in reactivity for Uranium-235 reactor. \n", - "\n", - " \n", - " Reactivity = 0.15 dollars 15.38 cents \n", - " \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg345" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.6\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "P0 = 500.; ## Reactor power in MW\n", - "rho = -0.1; ## 10% in reactivity (Insertion of control rods correspond to negative reactivity)\n", - "## As the reactor is fueled with Uranium-235 \n", - "bet = 0.0065; ## Total delayed neutron fraction of all groups denoted by 'beta'\n", - "\n", - "P1 = (bet*(1.-rho)*P0)/(bet-rho); ## The drop in power level in terms of MW\n", - "## Assuming that negative reactivity is greater than 4%\n", - "T = 80.; ## Reactor period obtained from Figure 7.2 in seconds\n", - "t = 600.; ## Analysis time in seconds \n", - "## Calculation\n", - "P = P1*math.exp(-t/T); ## Power level drop in MW\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The power level drop after 10 minutes = \",P,\" MW \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The power level drop after 10 minutes = 0.02 MW \n", - "\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg351" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.7\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "H = 70.; ## Height of the cylinder in cm\n", - "R = H/2.; ## Diameter of the cylinder in cm\n", - "a = 1.9; ## Radius of black control rod in cm\n", - "## From Table 6.2, Buckling can be found by\n", - "B0 = math.sqrt((2.405/R)**2+(math.pi/H)**2);\n", - "## Using the data from Table 5.2 and 5.3\n", - "L_TM2 = 8.1; ## Diffusion area of water moderator in cm^2\n", - "t_TM = 27.; ## Neutron age of water moderator in cm^2\n", - "## Using the data form Table 6.3 at temperature = 20 deg \n", - "n_T = 2.065; ## Average number of neutrons produced per neutron absorbed in fission\n", - "## Using the data from Table 5.2 and Table II.3\n", - "D_bar = 0.16; ## Thermal neutron diffusion coefficient in cm\n", - "SIGMA_t = 3.443; ## Total macroscopic cross section in cm^(-1)\n", - "f = (1.+B0**2*(L_TM2+t_TM))/(n_T+B0**2*L_TM2); ## Thermal utilization factor\n", - "M_T2 = (1.-f)*L_TM2+t_TM; ## Thermal migration area in cm^2\n", - "d = 2.131*D_bar*(a*SIGMA_t+0.9354)/(a*SIGMA_t+0.5098); ## Extrapolation distance\n", - "## Calculation\n", - "rho_w = (7.43*M_T2*(0.116+math.log(R/(2.405*a))+(d/a))**(-1))/((1.+B0**2*M_T2)*R**2);\n", - "## Result\n", - "print'%s %.2f %s %.2f %s '%(\" \\n The worth of a black control rod = \",rho_w,\" \"or \"\",rho_w*100,\" percent \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The worth of a black control rod = 0.07 6.53 percent \n", - " \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg354" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.8\n", - "import math\n", - "#calculate the\n", - "\n", - "## Using the data and result from Example 7.7\n", - "f = 0.583; ## Thermal Utilization factor \n", - "L_TM2 = 8.1; ## Diffusion area of water moderator in cm^2\n", - "R = 35; ## Radius of the cylinder of the core in cm\n", - "a = 0.508; ## Radius of control rod in cm\n", - "Rc = math.sqrt(R**2/100.); ## Critical radius in cm\n", - "L_T = math.sqrt((1-f)*L_TM2); ## Thermal diffusion length in cm\n", - "## The points of estimation are chosen as follows\n", - "y = a/L_T;\n", - "z = Rc/L_T;\n", - "## Using the data given in Table V.I for modified Bessel functions\n", - "I0_275 = 1.019; ## I0 at 0.275\n", - "I1_275 = 0.1389; ## I1 at 0.275\n", - "I1_189 = 1.435; ## I1 at 1.89\n", - "K0_275 = 1.453; ## K0 at 0.275\n", - "K1_275 = 3.371; ## K1 at 0.275\n", - "K1_189 = 0.1618; ## K1 at 1.89\n", - "E = ((z**2-y**2)/(2.*y))*(((I0_275*K1_189)+(K0_275*I1_189))/((I1_189*K1_275)-(K1_189*I1_275))); ## The lattice function\n", - "## Using the data from Table 5.2 and Table II.3\n", - "D_bar = 0.16; ## Thermal neutron diffusion coefficient in cm\n", - "SIGMA_t = 3.443; ## Total macroscopic cross section in cm^(-1)\n", - "d = 2.131*D_bar*(a*SIGMA_t+0.9354)/(a*SIGMA_t+0.5098); ## Extrapolation distance\n", - "f_R = 1./((((z**2-y**2)*d)/(2.*a))+E); ## Rod utilization parameter\n", - "## Calculation\n", - "rho_w = f_R/(1.-f_R);\n", - "## Result\n", - "print'%s %.2f %s %.2f %s '%(\" \\n The total worth of the control rods = \",rho_w,\"\" or\"\",rho_w*1000,\" percent \\n\");\n", - "## There is a deviation in the value computed on comparison with the value given in the textbook. This is due to approximation of thermal diffusion area in the textbook.\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The total worth of the control rods = 0.29 292.66 percent \n", - " \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg358" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.9\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "SIGMAa_bar = 0.2; ## Average macroscopic absorption cross section in cm^(-1)\n", - "L_T = 1.2; ## Thermal diffusion length in cm\n", - "## Converting the given dimensions from inches to centimeters\n", - "## 1 inch = 2.54 cm\n", - "## From Figure 7.9\n", - "l = 9.75*(2.54/2.); ## Length of the half rod\n", - "a = 0.312*(2.54/2.); ## Thickness of the half rod\n", - "m = 44.5/math.sqrt(2.); ## Closest distance between two rods\n", - "\n", - "D_bar = SIGMAa_bar*L_T**2; ## Thermal neutron diffusion coefficient in cm\n", - "d = 2.131*D_bar; ## Extrapolation distance in cm which is obtained for bare planar surface\n", - "f_R = ((4.*(l-a)*L_T)/(m-(2.*a))**2*(1./((d/L_T)+((m-(2*a))/(2*L_T))))); ## Rod utilization parameter\n", - "## Calculation\n", - "rho_w = 0.025/(1.-0.4);\n", - "## Result\n", - "print'%s %.2f %s %.2f %s' %(\" \\n The total worth of the control rods = \",rho_w,\"\" or \"\",rho_w*100,\" percent \\n\");\n", - "## There is a slight deviation in the value computed on comparison with the value given in the textbook. This is due to approximation of rod utilization parameter in the textbook.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The total worth of the control rods = 0.04 4.17 percent \n", - "\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg360" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.10\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "d = 5.; ## Inner diameter of the tube in cm\n", - "a = d/2.; ## Inner radius of the tube in cm\n", - "l = 76.; ## Length of the tube in cm\n", - "rho = 2.; ## Density of B4C in g/cm^3\n", - "n = 5.; ## Number of rods in tbe reactor\n", - "m_B4C = 2.*(n*math.pi*(a**2)*l); ## Mass of B4C in all the rods\n", - "## Using the data from standard periodic table\n", - "molwt_B = 10.8; ## Molecular weight of Boron(B)\n", - "molwt_C = 12.; ## Molecular weight of Carbon(C)\n", - "molwt_B4C = (4*molwt_B)+molwt_C; ## Molecular weight of B4C\n", - "N_A = 0.6*10**(24.); ## Avogadro number\n", - "## From Table II.3 \n", - "sigma_a = 0.27*10**(-24); ## Microscopic absorption cross section of boron in cm^2\n", - "n_B = (4.*m_B4C*N_A)/molwt_B4C; ## Number of boron atoms\n", - "## Using the result of Example 6.3\n", - "SIGMA_aF = 0.00833; ## Macroscopic absorption cross section of plutonium fuel in cm^(-1)\n", - "SIGMA_aC = 0.000019; ## Macroscopic absorption cross section of sodium coolant in cm^(-1)\n", - "R_c = 41.7; ## Critical radius in cm\n", - "N_B = n_B/((4./3.)*math.pi*R_c**3); ## Atom density of boron over an entire reactor assuming spherical shape\n", - "SIGMA_aB = sigma_a*N_B; ## Macroscopic absorption cross section of boron\n", - "## Calculation\n", - "rho_w = SIGMA_aB/(SIGMA_aF+SIGMA_aC);\n", - "## Result\n", - "print'%s %.2f %s %.2f %s '%(\" \\n The worth of the control rods using one group theory = \",rho_w,\"\" or\"\",rho_w*100,\" percent \\n\");\n", - "## In textbook, the final answer of total worth of control rods in percentage is wrong.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The worth of the control rods using one group theory = 0.07 6.91 percent \n", - " \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg362" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.11\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "H = 70.; ## Height of square cylindrical reactor in cm\n", - "rho_wH = 0.065; ## Total worth of a control rod at full height\n", - "rho_wx = 0.01; ## Total worth of a control rod to be achieved \n", - "## Let y-sin(y) = t\n", - "t = 2*math.pi*(rho_wx/rho_wH);\n", - "## Using Newton Raphson method for solving the transcendental equation y - sin(y) -0.966 = 0\n", - "y0=0.5; ## Initial value\n", - "e = 0.00001; ## Relative error tolerance\n", - "\n", - " \n", - " ## The solution of transcendental equation\n", - "## Calculation\n", - "x = 21.3\n", - "## Result\n", - "print'%s %.2f %s'%('\\n The length of control rod to be inserted = ',x,' cm \\n');\n", - "\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " The length of control rod to be inserted = 21.30 cm \n", - "\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg364" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.12\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "f0 = 0.93; ## Thermal utilization factor \n", - "rho = 0.205; ## Total excess reactivity \n", - "rho_w = 0.085; ## Total worth of control rods\n", - "rho_sh = rho-rho_w; ## Total worth of shim control\n", - "C = (rho_sh*10**3)/(1.92*(1.-f0)); ## Concentration of boric acid in ppm\n", - "print'%s %.2f %s'%('\\n The minimum concentration of boric acid = ',math.ceil(C),'ppm \\n');\n", - "## Expressing in gram/litre\n", - "## Using the data from standard periodic table\n", - "molwt_B = 10.8; ## Molecular weight of Boron(B)\n", - "molwt_O = 16.; ## Molecular weight of Oxygen(O)\n", - "molwt_H = 1.; ## Molecular weight of Hydrogen(H)\n", - "molwt_H3BO3 = (3.*molwt_H)+molwt_B+(3*molwt_O); ## Molecular weight of Boric acid\n", - "## Calculation\n", - "amt_H3BO3 = (molwt_H3BO3/molwt_B)*C/1000.;\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n The shim system must contain \",amt_H3BO3,\" g/litre of boric acid to hold down the reactor. \\n\");\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " The minimum concentration of boric acid = 893.00 ppm \n", - "\n", - "\n", - " The shim system must contain 5.11 g/litre of boric acid to hold down the reactor. \n", - "\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg370" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.13\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "p = 0.878; ## Resonance escape probability\n", - "T = 273.+350.; ## Given temeprature converted in Kelvin\n", - "d = 2.8; ## Diameter of rod in cm\n", - "a = d/2.; ## Radius of rod in cm\n", - "rho = 19.1; ## Density of uranium in g/cm^3\n", - "## Using data from Table 7.4 for Uranium-238\n", - "A = 48*10**(-4); ## Constant value\n", - "C = 1.28*10**(-2); ## Constant value\n", - "beta_I = A+C/(a*rho); ## A parameter\n", - "\n", - "## Calculation\n", - "alpha_prompt = -(beta_I/(2.*math.sqrt(T)))*math.log(1./p);\n", - "## Result\n", - "print'%s %.2e %s'%('\\n The prompt temperature coefficient = ',alpha_prompt,' per K \\n');\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " The prompt temperature coefficient = -1.38e-05 per K \n", - "\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg388" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 7.14\n", - "import math\n", - "#calculate the\n", - "\n", - "## Assuming that the fission product poisoning results in 12 barns per original Uranium-235 atom in a time frame of one year\n", - "sigma_p = 12.; ## Microscopic poison cross section in barns\n", - "v = 2.42; ## Average number of neutrons produced in fission\n", - "## Using Table II.2 for fission cross section of Uranium-235 at thermal energy\n", - "sigma_f = 587.; ## Microscopic fission cross section in barns\n", - "## Calculation\n", - "rho = -sigma_p/(v*sigma_f);\n", - "## Result\n", - "print'%s %.2f %s %.2f %s '%(\" \\n The reactivity due to poisons = \",rho,\"\" or \"\",rho*100,\" percent \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The reactivity due to poisons = -0.01 -0.84 percent \n", - " \n" - ] - } - ], - "prompt_number": 17 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter8.ipynb b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter8.ipynb deleted file mode 100644 index 1a1ca78a..00000000 --- a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter8.ipynb +++ /dev/null @@ -1,763 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:42da60dddc9ade26e5b8b4147266d1c288065b49878d9d5fa52edab8aff97d78" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter8-Heat Removal from Nuclear Reactors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg407" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 8.1\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "P = 3025.; ## Reactor thermal power in MW\n", - "w = 136.3*10**6; ## Coolant flow rate in lb/hr\n", - "## According to Table 1.9\n", - "## 1 kW = 3412 Btu/hr\n", - "q = P*1000.*3412.; ## Converting into Btu/hr\n", - "delh = q/w; ## Rise in enthalpy\n", - "## Using the data from Table IV.1 for temperature 542.6 F\n", - "hin = 539.7; ## Enthalpy of input water in Btu/lb\n", - "## Calculation\n", - "hout = hin+delh; ## Enthalpy of released water in Btu/lb\n", - "## From Table IV.1 \n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n \",hout,\" Btu/lb corresponds to 599 F coolant water temperature. \\n\");\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " 615.42 Btu/lb corresponds to 599 F coolant water temperature. \n", - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg408" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 8.2\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "P = 6.895; ## Pressure of steam in MPa\n", - "w = 2.93*10**6; ## Steam flow rate in kg/hr\n", - "Tin = 190.6+273.; ## Inlet temperature in Kelvin\n", - "\n", - "## 1.\n", - "## Using the data from Table IV.2 \n", - "## Result\n", - "print(\" \\n At a pressure of 6.895 MPa the steam temeperature is 284.86 C \\n\");\n", - "\n", - "## 2. \n", - "## Using the data from Table IV.2 \n", - "hout = 2773.2; ## Enthalpy of spent steam in kJ/kg\n", - "## Using the data from Table IV.1 \n", - "hin = 807.8; ## Enthalpy of inlet steam at Tin in kJ/kg\n", - "## Calculation\n", - "q = w*(hout-hin);\n", - "## Result\n", - "print'%s %.2e %s %.2f %s '%(\" \\n Reactor power is \",q,\" J/hr\" or \"\",q/(3600*1000),\"MW \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " At a pressure of 6.895 MPa the steam temeperature is 284.86 C \n", - "\n", - " \n", - " Reactor power is 5.76e+09 J/hr 1599.62 MW \n", - " \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg413" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 8.3\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "n = 193.*204.; ## Total number of fuel rods in the reactor\n", - "## 1 feet = 12 inches\n", - "R = 67./12.; ## Outer radius of the cylinder in feet(ft)\n", - "H = 144./12.; ## Outer radius of the cylinder in ft\n", - "d = 0.42/12.; ## Diameter of the fuel rod in ft\n", - "a = d/2.; ## Radius of the fuel rod in ft\n", - "P = 1893.; ## Reactor thermal power in MW\n", - "Ed = 180.; ## Energy deposited locally in the fuel per fission in MW(Assumption)\n", - "ER = 200.; ## Recoverable energy per fission in MW(Assumption)\n", - "\n", - "## 1.\n", - "## Calculation\n", - "## According to Table 1.9\n", - "## 1 kW=3412 Btu/hr\n", - "q_r = (2.32*P*Ed)/(n*ER);\n", - "q_max=(q_r*3412.*1000.)/(2.*H*a**2);\n", - "## Result\n", - "print'%s %.2e %s '%(\" \\n Total energy production at the axis = \",q_r*3412*1000,\" Btu/hr\"); print'%s %.2e %s'%(\" \\n Maximum energy production at the axis =\",q_max,\"Btu/hr-ft^3 \\n\");\n", - "\n", - "## 2.\n", - "r = 20./12.; ## Distance from the axis in ft\n", - "j0 =0.825 ## Bessel function\n", - "## Calculation\n", - "## According to Table 1.9\n", - "## 1 kW=3412 Btu/hr\n", - "q_r20 = q_r*j0;\n", - "q_max20 = (q_r20*3412.*1000.)/(2*H*a**2);\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Total energy production at a distance of 20 inches = \",(q_r20*3412*1000),\" Btu/hr\");\n", - "print'%s %.2f %s'%(\" \\n Maximum energy production at a distance of 20 inches = \",q_max20,\" Btu/hr-ft^3 \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Total energy production at the axis = 3.43e+05 Btu/hr \n", - " \n", - " Maximum energy production at the axis = 4.66e+07 Btu/hr-ft^3 \n", - "\n", - " \n", - " Total energy production at a distance of 20 inches = 282589.88 Btu/hr\n", - " \n", - " Maximum energy production at a distance of 20 inches = 38447602.54 Btu/hr-ft^3 \n", - "\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg416" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 8.4\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "P0 = 825.; ## Reactor thermal power in MW\n", - "t0 = 1.5*3.16*10**7; ## Reactor operation time in seconds\n", - "ts = 0.1; ## Reactor shutdown time in seconds\n", - "\n", - "## 1.\n", - "## Let P/P0 = q\n", - "## From Figure 8.3\n", - "q_ts = 0.07; ## Fission product to decay power during shutdown time\n", - "q_t0 = 0.0007; ## Fission product to decay power after operating time\n", - "q = q_ts-q_t0; ## Net fission product to decay power\n", - "## Calculation\n", - "P = q*P0;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Decay energy at shutdown = \",P,\" MW\");\n", - "\n", - "## One hour after shutdown \n", - "ts1 = 3.6*10**3; ## Reactor shutdown time in seconds\n", - "## Let P/P0=q\n", - "## From Figure 8.3\n", - "q_ts1 = 0.014; ## Fission product to decay power at shutdown time\n", - "q_t0 = 0.0007; ## Fission product to decay power after operating time\n", - "q1 = q_ts1-q_t0;\n", - "## Calculation\n", - "P1 = q1*P0;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Decay energy one hour after shutdown = \",P1,\" MW\");\n", - "\n", - "## One year after shutdown\n", - "ts2 = 3.16*10**7; ## Reactor shutdown time in seconds\n", - "## Let P/P0=q\n", - "## From Figure 8.3\n", - "q_ts2 = 0.00079; ## Fission product to decay power at shutdown time\n", - "## Now the operating time is t0+ts2 which can be denoted by t01\n", - "q_t01 = 0.00063; ## Fission product to decay power after operating time\n", - "q2 = q_ts2-q_t01;\n", - "## Calculation \n", - "P2 = q2*P0;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Decay energy one year after shutdown = \",P2,\" MW \\n\");\n", - "\n", - "## 2.\n", - "C = 0.88; ## Conversion factor \n", - "## Using data from Table II.2\n", - "sigma_a25 = 681.; ## Microscopic absorption cross section in barns\n", - "sigma_f25 = 582.; ## Microscopic fission cross section in barns\n", - "## At shutdown time\n", - "P_29 = (2.28*10**(-3)*C*(sigma_a25/sigma_f25))*P0;\n", - "P_39 = (2.17*10**(-3)*C*(sigma_a25/sigma_f25))*P0;\n", - "print'%s %.2f %s %.2f %s '%(\" \\n Decay energy at shutdown with effect of Uranium-239 and Neptunium-239 decay =\",P_29,\" MW\" and\"\",P_39,\" MW respectively\");\n", - "\n", - "## One hour after shutdown \n", - "ts1 = 3600.; ## TIme in seconds\n", - "P_291 = P_29*math.exp(-4.9*10**(-4)*ts1);\n", - "P_391 = P_39*(math.exp(-3.41*10**(-6)*ts1)-(7*10**(-3)*math.exp(-4.9*10**(-4)*ts1)));\n", - "print'%s %.2f %s %.2f %s ' %(\" \\n Decay energy one hour after shutdown with effect of Uranium-239 and Neptunium-239 decay = \",P_291,\" MW\" and \"\",P_391,\" MW respectively\");\n", - "\n", - "## One year after shutdown \n", - "P_292 = 0.; ## Half life of Uranium-239 is 23.5 minutes\n", - "P_392 = 0.; ## Half life of Neptunium-239 is 2.35 days\n", - "print'%s %.2f %s %.2f %s '%(\" \\n Decay energy one year after shutdown with effect of Uranium-239 and Neptunium-239 decay = \",P_292,\" MW \"and \"\",P_392,\" MW respectively\");\n", - "## There is a slight deviation in the values as compared with the texbook. This is because of approximation of difference values in the textbook.\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Decay energy at shutdown = 57.17 MW\n", - " \n", - " Decay energy one hour after shutdown = 10.97 MW\n", - " \n", - " Decay energy one year after shutdown = 0.13 MW \n", - "\n", - " \n", - " Decay energy at shutdown with effect of Uranium-239 and Neptunium-239 decay = 1.94 1.84 MW respectively \n", - " \n", - " Decay energy one hour after shutdown with effect of Uranium-239 and Neptunium-239 decay = 0.33 1.82 MW respectively \n", - " \n", - " Decay energy one year after shutdown with effect of Uranium-239 and Neptunium-239 decay = 0.00 0.00 MW respectively \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg426" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 8.5\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "## 1 feet = 12 inches\n", - "d = 0.42/12.; ## Diameter of the fuel rod in feet(ft)\n", - "a = d/2.; ## Radius of the fuel rod in ft\n", - "b = 0.024/12.; ## Thickness of Zircaloy-4 clad in ft\n", - "H = 12.; ## Length of fuel rod in ft\n", - "T_m = 3970.; ## Center temperature of fuel in F\n", - "\n", - "## 1.\n", - "## Using the result of Example 8.3\n", - "q_max = 4.66*10**7; ## Maximum heat flux at the center of the rod in Btu/hr-ft^3\n", - "## Calculation\n", - "q_bar = (a**2*q_max)/(2*(a+b));\n", - "## According to Table 1.9\n", - "## 1 kW=3412 Btu/hr\n", - "## Result\n", - "print'%s %.2f %s %.2f %s ' %(\" \\n Heat flux of the fuel rod = \",q_bar,\" Btu/hr-ft^2\" or \"\",(q_bar*1000)/(3412*30.48**2),\" W/cm^2 \\n\");\n", - "\n", - "## 2.\n", - "## Using the data from Table IV.6\n", - "k_f = 1.1; ## Thermal conductivity of fuel rod in Btu/hr-ft-F\n", - "k_c = 10.; ## Thermal conductivity of cladding in Btu/hr-ft-F\n", - "R_f = 1./(4.*math.pi*H*k_f); ## Thermal resistance of fuel in F-hour/Btu\n", - "R_c = math.log(1.+(b/a))/(2.*math.pi*H*k_c); ## Thermal resistance of cladding in F-hour/Btu\n", - "## Calculation\n", - "T_c = T_m-(q_bar*2*math.pi*(a+b)*H*(R_f+R_c));\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Outer temperature of cladding = \",math.ceil(T_c),\" F \\n\");\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Heat flux of the fuel rod = 365929.49 Btu/hr-ft^2 115.44 W/cm^2 \n", - " \n", - " \n", - " Outer temperature of cladding = 650.00 F \n", - "\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg431" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 8.6\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "h = 7500.; ## Heat transfer coefficient in Btu/hr-ft^2-F\n", - "## Using the result of Example 8.5 \n", - "q_bar = 3.66*10**5; ## Heat flux of the fuel rod in Btu/hr-ft^2\n", - "T_c = 650.; ## Outer temperature of cladding in F\n", - "## Calculation\n", - "T_b = T_c-(q_bar/h);\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Temperature of water with respect to the midpoint of the hottest fuel rod = \",T_b,\" F \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Temperature of water with respect to the midpoint of the hottest fuel rod = 601.20 F \n", - "\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg435" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 8.7\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "T_b0 = 543.; ## Temperature of inlet coolant in F\n", - "w = 3148.; ## Coolant rate per channel in lb/hr\n", - "\n", - "## 1. \n", - "V_f = 1.15*10**(-2); ## Volume of fueled portion in ft^2\n", - "## Using the result of Example 8.3\n", - "q_max = 4.66*10**7; ## Maximum heat flux at the center of the rod in Btu/hr-ft^3\n", - "## From Table IV.3\n", - "c_p = 1.3; ## Specific heat at constant pressure in Btu/lb-F\n", - "## Calculation \n", - "T_bmax = T_b0+((2*q_max*V_f)/(math.pi*w*c_p));\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Exit temperature of the coolant = \",T_bmax,\" F \\n\");\n", - "\n", - "## 2.\n", - "## Using the data of Example 8.6\n", - "h = 7500.; ## Heat transfer coefficient in Btu/hr-ft^2-F\n", - "## Using the data of Example 8.5\n", - "d = 0.42/12.; ## Diameter of the fuel rod in feet(ft)\n", - "a = d/2.; ## Radius of the fuel rod in ft\n", - "b = 0.024/12.; ## Thickness of Zircaloy-4 clad in ft\n", - "H = 12.; ## Length of fuel rod in ft\n", - "A = 2*math.pi*(a+b)*H; ## Area of the assumed cylinder in ft^2\n", - "R_h = 1/(h*A); ## Convective resistance in F-hour/Btu\n", - "alpha = math.pi*w*c_p*R_h; ## A parameter\n", - "\n", - "## Using the result from Example 8.5 \n", - "R_f = 6.03*10**(-3); ## Thermal resistance of fuel \n", - "R_c = 1.43*10**(-4); ## Thermal resistance of cladding\n", - "R = R_f+R_c+R_h; ## Total resistance\n", - "bet = math.pi*w*c_p*R; ## A parameter denoted by 'beta'\n", - "## Calculation\n", - "T_cmax = T_b0+((q_max*V_f*R_h)*((1+math.sqrt(1+alpha**2))/alpha));\n", - "T_mmax = T_b0+((q_max*V_f*R)*((1+math.sqrt(1+bet**2))/bet));\n", - "## Result\n", - "print'%s %.2f %s %.2f %s '%(\" \\n Maximum temperature of cladding and fuel = \",math.ceil(T_cmax),\" F\" and \"\",T_mmax,\" F respectively. \\n\");\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Exit temperature of the coolant = 626.37 F \n", - "\n", - " \n", - " Maximum temperature of cladding and fuel = 649.00 3941.65 F respectively. \n", - " \n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg438" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 8.8\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "d = 0.42; ## Diameter of the fuel rod in inches\n", - "b = 0.024; ## Thickness of Zircaloy-4 clad in inches\n", - "v = 15.6*3600.; ## Speed of fluid in feet/hour\n", - "a = (d/2.)+b; ## Radius of fuel rods in inches\n", - "P = 2000.; ## Pressure of water in psi\n", - "T = 600.; ## Water temperature in F\n", - "## Using the data from example 8.5 \n", - "s = 0.6; ## Pitch of square array in inches\n", - "D_e = 2.*((s**2-(math.pi*a**2))/(math.pi*a)); ## Equivalent diameter in inches\n", - "## Converting the units in terms of feet \n", - "D_e = D_e/12.;\n", - "## Using tha Table IV.3 at given T and P value\n", - "rho = 42.9; ## Density of fluid in ft/hr\n", - "mu = 0.212; ## Viscosity of fluid in lb/hr-ft\n", - "## Calculation \n", - "Re = (D_e*v*rho)/mu;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Reylonds number = \",Re,\" \\n\");\n", - "if Re >= 10000:\n", - " print(\" \\n As the reylonds number is greater than 10000, the flow is turbulent. \\n\");\n", - "\n", - "## The value is different as compared to the textbook value. This is due to approximation of Reynolds number in the textbook.\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Reylonds number = 484329.34 \n", - "\n", - " \n", - " As the reylonds number is greater than 10000, the flow is turbulent. \n", - "\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg440" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 8.9\n", - "import math\n", - "#calculate the\n", - "\n", - "## Using the data from Example 8.8\n", - "s = 0.6; ## Pitch of square lattice in inches\n", - "d = 0.42; ## Diameter of the fuel rod in inches\n", - "b = 0.024; ## Thickness of Zircaloy-4 clad in inches\n", - "a = (d/2)+b; ## Radius of fuel rods in inches \n", - "D_e = 0.0427; ## Equivalent diameter in feet\n", - "Re = 484329; ## Reynolds number\n", - "PD = s/(2*a); ## The ratio of pitch to diameter of fuel rod\n", - "## For a square lattice\n", - "C = 0.042*PD-0.024; ## A constant\n", - "\n", - "## According to Table IV.3\n", - "c_p = 1.45; ## Specific heat at constant pressure in Btu/lb-F\n", - "mu = 0.212; ## Viscosity of fluid in lb/hr-ft\n", - "k = 0.296; ## Conductivity of fluid in Btu/hr-ft F\n", - "Pr=(c_p*mu)/k; ## Prandtl number\n", - "## The constants are assumed as\n", - "m = 0.8; \n", - "n = 1/3;\n", - "## Calculation\n", - "h = C*(k/D_e)*(Re)**m*Pr**n;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Heat transfer coefficient = \",h,\" Btu/hr-ft^2-F\\n\");\n", - "## The value is different as compared to the textbook value. This is due to approximation of Reynolds number in the textbook and in this problem actual value is considered.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Heat transfer coefficient = 7309.11 Btu/hr-ft^2-F\n", - "\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg448" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 8.10\n", - "import math\n", - "#calculate the\n", - "\n", - "## Using the data from Example 8.3 to 8.8\n", - "P = 2000.; ## Pressure in psi\n", - "v = 15.6; ## Coolant velocity in ft/sec\n", - "D_e = 0.0427; ## Equivalent diameter in ft\n", - "d = 0.42; ## Diameter of the fuel rod in inches\n", - "b = 0.024; ## Thickness of Zircaloy-4 clad in inches\n", - "a = (d/2.)+b; ## Radius of fuel rods in inches \n", - "T_b = 600.; ## Bulk temeperature in F \n", - "\n", - "## 1.\n", - "## Using Bernath correlation\n", - "## Calculation\n", - "T_wc = 102.6*math.log(P)-((97.2*P)/(P+15.))-(0.45*v)+32.;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Cladding temeperature = \",T_wc,\" F\\n\");\n", - "\n", - "## 2.\n", - "D_i = (2.*math.pi*a)/(math.pi*12.); ## Heated perimeter is (2*%pi*a)/12 in feet \n", - "## Calculation\n", - "h_c = 10890.*((D_e)/(D_e+D_i))+((48.*v)/D_e**0.6);\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Heat transfer coefficient = \",h_c,\" Btu/hr-ft^2-F\\n\");\n", - "\n", - "## 3.\n", - "## Calculation\n", - "q_c = h_c*(T_wc-T_b);\n", - "## Result\n", - "print'%s %.2e %s'%(\" \\n Critical heat flux = \",q_c,\" Btu/hr-ft^2\\n\");\n", - "## In the textbook, the unit of critical heat flux is wrong.\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Cladding temeperature = 708.36 F\n", - "\n", - " \n", - " Heat transfer coefficient = 10658.76 Btu/hr-ft^2-F\n", - "\n", - " \n", - " Critical heat flux = 1.15e+06 Btu/hr-ft^2\n", - "\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg454" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 8.11\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "m_lbar = 0.457; ## Average linear density of UO2 in lb/ft\n", - "sigma = 0.0122; ## Standard deviation of set of measured linear densities of UO2\n", - "## Calculation\n", - "F_Eml = 1.+(3.*sigma)/m_lbar;\n", - "print'%s %.2f %s'%(\" \\n Engineering subfactor for the amount of fissile material = \",F_Eml,\" \\n\");\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Engineering subfactor for the amount of fissile material = 1.08 \n", - "\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg457" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 8.12\n", - "import math\n", - "#calculate the\n", - "\n", - "q_max = 539000.; ## Maximum heat flux Btu/hr-ft^2\n", - "F = 2.8; ## Hot channel factor\n", - "P = 3000.; ## Reactor thermal power in MW\n", - "## Expressing in Btu/hr\n", - "## According to Table 1.9, 1 kW = 3412 Btu/hr\n", - "P = P*3.412*10**6; ## Reactor thermal power in Btu/hr\n", - "l = 12.; ## Length of fuel rod in ft\n", - "d = 0.5/12.; ## Diameter of fuel rod in ft\n", - "r = d/2.; ## Radius of fuel rod in ft\n", - "\n", - "## 1.\n", - "q_av = q_max/F;\n", - "## Calculation\n", - "A = P/q_av;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Total heat transfer area = \",A,\" ft^2\\n\");\n", - "\n", - "## 2.\n", - "A_one = 2.*math.pi*r; ## The total surface area of one fuel rod\n", - "## Calculation \n", - "n = A/A_one;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Number of fuel rods = \",n,\" \\n\"); \n", - "## The value is different as compared to the textbook value. This is due to approximation of total heat transfer area in the textbook and in this problem actual value is considered. As total heat transfer area is further used to calculate number of fuel rods, therefore the difference in value exists.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Total heat transfer area = 53174.03 ft^2\n", - "\n", - " \n", - " Number of fuel rods = 406219.64 \n", - "\n" - ] - } - ], - "prompt_number": 16 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter9.ipynb b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter9.ipynb deleted file mode 100644 index 4779f851..00000000 --- a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/Chapter9.ipynb +++ /dev/null @@ -1,795 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:f8071cbb973f7edab174c90f7449b49a3ab18584f970adf40bc2a01bc3729a4e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter9-Radiation Protection" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg470" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.1\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "e = 1.6*10**(-19); ## Electronic charge in couloumb(coul)\n", - "X = 1*10**(-3)/3600.; ## Exposure rate in terms of R/sec\n", - "## According to the definition of Roentgen, 1 R = 2.58*10^(-7) coul/g \n", - "R = 2.58*10**(-7);\n", - "## From standard table\n", - "## There is 0.001293 g of air per 1 cm^3 at 1 atmospheric pressure at 0 C \n", - "density_air = 0.001293;\n", - "## Calculation\n", - "IR = (X*R*density_air)/e;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Rate of ions produced from gamma ray interaction = \",IR,\" ions/cm^3-sec\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Rate of ions produced from gamma ray interaction = 579.16 ions/cm^3-sec\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg475" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.2\n", - "import math\n", - "#calculate the\n", - "\n", - "## According to the definition of radiation absorbed dose(rad), 1 rad/sec = 100 ergs/g-sec\n", - "## Given data\n", - "D = 5.*10**(-3)/100.; ## Absorbed dose in terms of rad/sec\n", - "## Expressing absorbed dose rate in SI units\n", - "## 1 Gray(Gy) = 100 rad \n", - "D_dot = D*3600./100.;\n", - "## Using data from Table 9.2\n", - "Q = 1.; ## Quality factor for gamma rays for tissue\n", - "## Calculation\n", - "H_dot = D_dot*Q;\n", - "print'%s %.2f %s'%(' \\n Absorbed dose rate in a tissue = ',D_dot*1000,' mGy/hr \\n');\n", - "print'%s %.2f %s'%(' \\n Dose equivalent rate in a tissue = ',H_dot*1000,' mSv/hr \\n');\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Absorbed dose rate in a tissue = 1.80 mGy/hr \n", - "\n", - " \n", - " Dose equivalent rate in a tissue = 1.80 mSv/hr \n", - "\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg495" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.3\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "H = 25; ## Equivalent dose in rem\n", - "age = 30; ## Age of worker in years\n", - "exp_age = 77; ## Average age upto which a person lives in years\n", - "## Using data from Table 9.6\n", - "## Bone cancer\n", - "rc_bone = 0.2; ## Risk coefficient per 10^6 rem/year\n", - "lp_bone = 10; ## Latent period in years\n", - "## Probability of dying from bone cancer \n", - "p_bone=(H*rc_bone*(exp_age-(lp_bone+age)))/10**6;\n", - "\n", - "## Breast cancer\n", - "rc_breast = 1.5; ## Risk coefficient per 10^6 rem/year\n", - "lp_breast = 15.; ## Latent period in years\n", - "## Probability of dying from breast cancer \n", - "p_breast = (H*rc_breast*(exp_age-(lp_breast+age)))/10**6;\n", - "\n", - "## Leukemia\n", - "rc_leukemia = 1.; ## Risk coefficient per 10^6 rem/year\n", - "lp_leukemia = 2.; ## Latent period in years\n", - "## Probability of dying from leukemia \n", - "p_leukemia = (H*rc_leukemia*(exp_age-(lp_leukemia+age)))/10**6;\n", - "\n", - "## Lung cancer\n", - "rc_lung = 1.; ## Risk coefficient per 10^6 rem/year\n", - "lp_lung = 15.; ## Latent period in years\n", - "## Probability of dying from lung cancer\n", - "p_lung = (H*rc_lung*(exp_age-(lp_lung+age)))/10**6;\n", - "\n", - "## Pancreatic cancer\n", - "rc_pancreas = 0.2; ## Risk coefficient per 10^6 rem/year\n", - "lp_pancreas = 15.; ## Latent period in years\n", - "## Probability of dying from Pancreatic cancer\n", - "p_pancreas = (H*rc_pancreas*(exp_age-(lp_pancreas+age)))/10**6;\n", - "\n", - "## Stomach cancer\n", - "rc_stomach = 0.6; ## Risk coefficient per 10^6 rem/year\n", - "lp_stomach = 15.; ## Latent period in years\n", - "## Probability of dying from stomach cancer\n", - "p_stomach = (H*rc_stomach*(exp_age-(lp_stomach+age)))/10**6;\n", - "\n", - "## Rest of alimentary cancer\n", - "rc_ali = 0.2; ## Risk coefficient per 10^6 rem/year\n", - "lp_ali = 15.; ## Latent period in years\n", - "## Probability of dying from rest of alimentary cancer\n", - "p_ali = (H*rc_ali*(exp_age-(lp_ali+age)))/10**6;\n", - "\n", - "## Thyroid cancer\n", - "rc_thy = 0.43; ## Risk coefficient per 10^6 rem/year\n", - "lp_thy = 10.; ## Latent period in years\n", - "## Probability of dying from thyroid cancer\n", - "p_thy = (H*rc_thy*(exp_age-(lp_thy+age)))/10**6;\n", - "\n", - "## All other type of cancer\n", - "rc_other = 1.; ## Risk coefficient per 10^6 rem/year\n", - "lp_other = 15.; ## Latent period in years\n", - "## Probability of dying from all other type of cancer\n", - "p_other = (H*rc_other*(exp_age-(lp_other+age)))/10**6;\n", - "\n", - "## Calculation\n", - "p = p_bone+p_breast+p_leukemia+p_lung+p_pancreas+p_stomach+p_ali+p_thy+p_other;\n", - "## Result\n", - "print'%s %.2f %s'%('\\n Probability that the worker will die from cancer = ',p,' \\n');\n", - "\n", - "## The value obtained is different from the value given in the textbook. This is because of approximation of individual probabilities in the textbook.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Probability that the worker will die from cancer = 0.01 \n", - "\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg496" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.4\n", - "import math\n", - "#calculate the\n", - "H = 1.; ## Equivalent dos in rem\n", - "n = 10**6; ## Population\n", - "## Given data\n", - "\n", - "## Using the data of number of expected deaths of leukemia per 10^6 people from Table 9.9\n", - "## In utero age group\n", - "frac_utero = 0.011; ## Fraction of population\n", - "riskyr_utero = 10.; ## Risk years\n", - "riskcoef_utero = 15.; ## Risk coefficient\n", - "## Number of deaths in utero is given by\n", - "deaths_utero = frac_utero*riskyr_utero*riskcoef_utero;\n", - "\n", - "## In 0-0.99 age group\n", - "frac_0_099 = 0.014; ## Fraction of population\n", - "riskyr_0_099 = 25.; ## Risk years\n", - "riskcoef_0_099 = 2.; ## Risk coefficient\n", - "## Number of deaths in 0-0.99 age group is given by\n", - "deaths_0_099 = frac_0_099*riskyr_0_099*riskcoef_0_099;\n", - "\n", - "## In 1-10 age group\n", - "frac_1_10 = 0.146; ## Fraction of population\n", - "riskyr_1_10 = 25.; ## Risk years\n", - "riskcoef_1_10 = 2.; ## Risk coefficient\n", - "## Number of deaths in 1-10 age group is given by\n", - "deaths_1_10=frac_1_10*riskyr_1_10*riskcoef_1_10;\n", - "\n", - "## In 11-20 age group\n", - "frac_11_20 = 0.196; ## Fraction of population\n", - "riskyr_11_20 = 25.; ## Risk years\n", - "riskcoef_11_20 = 1.; ## Risk coefficient\n", - "## Number of deaths in 11-20 age group is given by\n", - "deaths_11_20=frac_11_20*riskyr_11_20*riskcoef_11_20;\n", - "\n", - "## In 21-30 age group\n", - "frac_21_30 = 0.164; ## Fraction of population\n", - "riskyr_21_30 = 25.; ## Risk years\n", - "riskcoef_21_30 = 1.; ## Risk coefficient\n", - "## Number of deaths in 21-30 age group is given by\n", - "deaths_21_30=frac_21_30*riskyr_21_30*riskcoef_21_30;\n", - "\n", - "## In 31-40 age group\n", - "frac_31_40 = 0.118; ## Fraction of population\n", - "riskyr_31_40 = 25.; ## Risk years\n", - "riskcoef_31_40 = 1.; ## Risk coefficient\n", - "## Number of deaths in 31-40 age group is given by\n", - "deaths_31_40=frac_31_40*riskyr_31_40*riskcoef_31_40;\n", - "\n", - "## In 41-50 age group\n", - "frac_41_50 = 0.109; ## Fraction of population\n", - "riskyr_41_50 = 25.; ## Risk years\n", - "riskcoef_41_50 = 1.; ## Risk coefficient\n", - "## Number of deaths in 41-50 age group is given by\n", - "deaths_41_50 = frac_41_50*riskyr_41_50*riskcoef_41_50;\n", - "\n", - "## In 51-60 age group\n", - "frac_51_60 = 0.104; ## Fraction of population\n", - "riskyr_51_60 = 22.5; ## Risk years\n", - "riskcoef_51_60 = 1.; ## Risk coefficient\n", - "## Number of deaths in 51-50 age group is given by\n", - "deaths_51_60 = frac_51_60*riskyr_51_60*riskcoef_51_60;\n", - "\n", - "## In 61-70 age group\n", - "frac_61_70 = 0.08;\n", - "riskyr_61_70 = 15.1;\n", - "riskcoef_61_70 = 1.; ## Risk coefficient\n", - "## Number of deaths in 61-70 age group is given by\n", - "deaths_61_70=frac_61_70*riskyr_61_70*riskcoef_61_70;\n", - "\n", - "## In 71-80 age group\n", - "frac_71_80 = 0.044; ## Fraction of population\n", - "riskyr_71_80 = 9.1; ## Risk years\n", - "riskcoef_71_80 = 1.; ## Risk coefficient\n", - "## Number of deaths in 71-80 age group is given by\n", - "deaths_71_80 = frac_71_80*riskyr_71_80*riskcoef_71_80;\n", - "\n", - "## Age greater than 80\n", - "frac_80 = 0.02; ## Fraction of population\n", - "riskyr_80 = 4.5; ## Risk years\n", - "riskcoef_80 = 1.; ## Risk coefficient\n", - "## Number of deaths with age greater than 80 years is given by\n", - "deaths_80=frac_80*riskyr_80*riskcoef_80;\n", - "\n", - "## Calculation\n", - "total_deaths = deaths_utero+deaths_0_099+deaths_1_10+deaths_11_20+deaths_21_30+deaths_31_40+deaths_41_50+deaths_51_60+deaths_61_70+deaths_71_80+deaths_80;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Number of cases or deaths expected from leukemia = \",total_deaths,\" \\n\");\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Number of cases or deaths expected from leukemia = 28.36 \n", - "\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg498" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.5\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "H_year = 5.; ## Equiavelnt dose per year in rem\n", - "start_age = 18.; ## Initial age of the worker in years\n", - "ret_age = 68.; ## Retirement age of the worker in years\n", - "## Using data from Table 9.6 with respect to Bone cancer\n", - "latent_period = 10.; ## Latent period in years\n", - "plateau_period = 30.; ## Plateau period in years\n", - "rc_bone = 0.2; ## Risk coefficient per 10^6 rem/year\n", - "\n", - "n = ret_age-(start_age+latent_period); ## Number of years of accumulated dose\n", - "H = n*H_year; ## Total equivalent dose in rem\n", - "## Calculation\n", - "p_bone = (H*rc_bone*plateau_period)/10**6;\n", - "## Result\n", - "print'%s %.2e %s'%(\" \\n The probability of dying from bone cancer = \",p_bone,\" \\n\");" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The probability of dying from bone cancer = 1.20e-03 \n", - "\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg513" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.6\n", - "import math\n", - "\n", - "## Given data\n", - "E =2. ; ## Energy of gamma radiation in MeV\n", - "X_dot = 1.; ## Exposure rate in mR/hour\n", - "## Using the data from Table II.5\n", - "## Let mu_a/rho of air at 2 Mev be denoted as mu_rho\n", - "mu_rho = 0.0238; ## Ratio of absorption coefficient to sensity of air in cm^2/g\n", - "## Calculation\n", - "I = X_dot/(E*mu_rho*0.0659);\n", - "print'%s %.2f %s'%(\" \\n The beam intensity of gamma radiation required = \",math.ceil(I),\" gamma rays/cm^2-sec \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The beam intensity of gamma radiation required = 319.00 gamma rays/cm^2-sec \n", - "\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg515" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.7\n", - "import math\n", - "\n", - "## Given data\n", - "phi = 2.4*10**5; ## Flux in x-rays/cm^2-sec\n", - "## From Figure 9.9\n", - "## To receive an exposure rate of 1 mR/hr at 50 keV, the flux is 8*10^3 x-rays/cm^2-sec\n", - "phi_eq = 8*10**3; ## Equivalent flux in x-rays/cm^2-sec\n", - "X_dot_eq = 1.; ## Equivalent Exposure rate in mR/hr\n", - "X_dot = (phi*X_dot_eq)/phi_eq; ## Exposure rate of the operator in mR/hr\n", - "## From Figure 9.10 at 50 kV energy, the energy dependent function is\n", - "f_bone = 3.3;\n", - "f_muscle = 0.93;\n", - "f_fat = 0.9;\n", - "## Using data from Table 9.2\n", - "Q = 1.; ## Quality factor for x-rays\n", - "## Calculation\n", - "D_dot_bone = X_dot*f_bone*Q; ## Dose equivalent rate in bone\n", - "D_dot_muscle = X_dot*f_muscle*Q; ## Dose equivalent rate in muscle\n", - "D_dot_fat = X_dot*f_fat*Q; ## Dose equivalent rate in fat\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Dose equivalent rate in bone = \",math.ceil(D_dot_bone),\" mrem/hour \\n\");\n", - "print'%s %.2f %s'%(\" \\n Dose equivalent rate in muscle = \",math.ceil(D_dot_muscle),\" mrem/hour \\n\");\n", - "print'%s %.2f %s'%(\" \\n Dose equivalent rate in fat = \",math.ceil(D_dot_fat),\" mrem/hour \\n\");\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Dose equivalent rate in bone = 99.00 mrem/hour \n", - "\n", - " \n", - " Dose equivalent rate in muscle = 28.00 mrem/hour \n", - "\n", - " \n", - " Dose equivalent rate in fat = 27.00 mrem/hour \n", - "\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg518" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.8\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "phi_n = 20.; ## Given neutron flux in neutrons/cm^2-sec\n", - "## From Figure 9.12\n", - "## To receive an dose equivalent rate of 1 mrem/hr, the fast neutron flux is 7 neutrons/cm^2-sec\n", - "phi_n_eq = 7.;\n", - "D_dot_eq = 1.; \n", - "D_dot_n = (phi_n*D_dot_eq)/phi_n_eq; ## Dose rate due to fast neutron flux in mrem/hr\n", - "phi_th = 300.; ## Given thermal flux in neutrons/cm^2-sec\n", - "## From Figure 9.12\n", - "## To receive an dose equivalent rate of 1 mrem/hr, the thermal flux is 260 neutrons/cm^2-sec\n", - "phi_th_eq = 260.;\n", - "D_dot_th = (phi_th*D_dot_eq)/phi_th_eq; ## Dose rate due to thermal neutron flux in mrem/hr\n", - "D_dot = D_dot_n+D_dot_th; ## Total dose rate in mrem/hr\n", - "print(\"\\n The permitted weekly dose is 100 mrem \\n\");\n", - "D_dot_perm = 100.;\n", - "## Calculation\n", - "t = D_dot_perm/D_dot;\n", - "print'%s %.2f %s'%(\" \\n The time of exposure upto a safe level = \",t,\" hour \\n\");\n", - "## The answer given in the textbook is wrong. This is because of wrong computation of total dose rate\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " The permitted weekly dose is 100 mrem \n", - "\n", - " \n", - " The time of exposure upto a safe level = 24.93 hour \n", - "\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg520" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.9\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "fluence = 10**8; ## Given fluence neutrons/cm^2\n", - "## From Figure 9.12\n", - "## To receive an dose equivalent rate of 1 mrem/hr, the fast neutron flux is 7 neutrons/cm^2-sec\n", - "phi_eq = 7.; ## Equivalent flux in neutrons/cm^2-sec\n", - "D_eq = 1.; ## Equivalent dose rate in mrem/hr\n", - "## 1 hour = 3600 seconds\n", - "fluence_eq = phi_eq*3600.; ## Equivalent fluence in neutrons/cm^2\n", - "## Calculation \n", - "D = (fluence*D_eq)/fluence_eq;\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n Dose received due to exposure of accelerator source = \",D,\" mrem \\n\");\n", - "## The answer given in textbook is approximated to a nearest value.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " Dose received due to exposure of accelerator source = 3968.25 mrem \n", - "\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg525" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.10\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "M = 20.; ## Mass of organ in grams\n", - "\n", - "## a)\n", - "## Using the data from Table 9.15\n", - "T_12 = 8.04; ## Radiological half life of Iodine-131 in days\n", - "T_12_b = 138.; ## Biological half life of Iodine-131 in days\n", - "lambd = 0.693/T_12; ## Radiological decay constant of Iodine-131 in days^-1\n", - "lambda_b = 0.693/T_12_b; ## Biological decay constant of Iodine-131 in days^-1\n", - "lambda_e = lambd+lambda_b; ## Equivalent decay constant in days^-1\n", - "## Using the data from Table 9.15\n", - "zeta = 0.23; ## Effective energy equivalent in MeV\n", - "q = 0.23; ## The fraction of Iodine-131 that goes by inhalation\n", - "## Calculation\n", - "DCF = (51.1*zeta*q)/(M*lambda_e);\n", - "## Result\n", - "print'%s %.2f %s'%(\" \\n The dose commitment factor by inhalation = \",DCF,\" rem/ucurie \\n\");\n", - "\n", - "## b) \n", - "breathing_rate = 2.32*10**(-4); ## Normal breathing rate in m^3/sec\n", - "time = 2*3600.; ## Time of radiation exposure in seconds\n", - "I_conc = 2*10**(-9); ## Iodine-131 concentration\n", - "C0 = breathing_rate*time*I_conc; ## Total intake of Iodine-131 by inhalation \n", - "## Calculation\n", - "H = C0*(DCF*10**6); ## Using DCF in micro-curie\n", - "## Result\n", - "print'%s %.2f %s %.2f %s '%(\" \\n The dose commitment to thyroid = \",H,\"\" and \" rem = \",H*1000,\" mrem \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - " The dose commitment factor by inhalation = 1.48 rem/ucurie \n", - "\n", - " \n", - " The dose commitment to thyroid = 0.00 4.95 mrem \n", - " \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg529" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.11\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "V_W = 2200.; ## Volume of water inatke in terms of cm^3/day\n", - "## 1 litre = 1000 gram(g)\n", - "M = 43.*1000.; ## Mass of water present in standard man according to standards\n", - "## Using the data from Table 9.13\n", - "MPD = 0.1/7.; ## Maximum Permissible Dose (MPD) in rem/day\n", - "## Using the data from Table 9.15\n", - "zeta = 0.01; ## Effective energy equivalent in MeV\n", - "q = 1.; ## The fraction of Tritium that goes inside by ingestion\n", - "T_b = 11.9; ## Biological Half life of Tritium in years\n", - "lambda_b = 0.693/T_b; ## Biological decay constant of Tritium in years^-1 \n", - "\n", - "## As biological and radiological half lives are less than 50 year intake period, the exponential term (exp(-lambda_e*50)) is neglected\n", - "## Maximum Permissible Concentration(MPC) for a 7 day or 168 hour week tritium dose \n", - "MPC_w_168 = (lambda_b*M*MPD)/(51.1*V_W*zeta*q);\n", - "print'%s %.2f %s'%(\"\\n Maximum Permissible Concentration(MPC) for a 7 day or 168 hour week tritium dose for occupational purpose = \",MPC_w_168,\" uCi/cm^3 \\n\");\n", - "## The exposure at work is doubled for 40 hour week as compared to 168 hour week \n", - "## For 40 hour week, with work of 5 days out of 7 day week according to a study\n", - "MPC_w_40 = MPC_w_168*2.*(7/5.);\n", - "print'%s %.2f %s'%(\"\\n Maximum Permissible Concentration(MPC) for a 40 hour week tritium dose for occupational purpose = \",MPC_w_40,\" uCi/cm^3 \\n\");\n", - "\n", - "## By analyzing the data of Table 9.13\n", - "## The whole body dose of general public is one tenth of the occupational purpose.\n", - "MPC_w_168_gp = MPC_w_168*0.1;\n", - "print'%s %.2f %s'%(\"\\n Maximum Permissible Concentration(MPC) for a 7 day or 168 hour week tritium dose for general public = \",MPC_w_168_gp,\" uCi/cm^3 \\n\");\n", - "## The answer of Maximum Permissible Concentration(MPC) for a 168 hour week tritium dose for general public is given wrong in the textbook.\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Maximum Permissible Concentration(MPC) for a 7 day or 168 hour week tritium dose for occupational purpose = 0.03 uCi/cm^3 \n", - "\n", - "\n", - " Maximum Permissible Concentration(MPC) for a 40 hour week tritium dose for occupational purpose = 0.09 uCi/cm^3 \n", - "\n", - "\n", - " Maximum Permissible Concentration(MPC) for a 7 day or 168 hour week tritium dose for general public = 0.00 uCi/cm^3 \n", - "\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg534" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.12\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "no_home = 10**6; ## Number of houses\n", - "no_resident = 4.; ## Number of residents in a home\n", - "total_time = 50.; ## Number of years the analysis is carried out\n", - "radon_concn_old = 1.; ## Radon concentration in older uninsulated homes in terms of pCi/l\n", - "radon_concn_new = 6.; ## Radon concentration in modern insulated homes in terms of pCi/l\n", - "time = 3500.; ## Time spent in home by a person per year in hours\n", - "eq_concn = 0.5; ## Equilibrium concentration of 50% \n", - "## 1 year = 24*365 hours\n", - "X_increased = eq_concn*(radon_concn_new-radon_concn_old)*(time/(24.*365.)); ## The increased exposure of radon per person\n", - "\n", - "## Using the data of Radon risk assessment of United States of America\n", - "## There are nearly 100 cases of cancer per 10^6 persons at 1 pCi-year dose.\n", - "## Calculation\n", - "no_cancer = (no_home*no_resident)*total_time*(100./10**6)*X_increased;\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n Number of additional cases of cancer from insulation of home = \",no_cancer,\" \\n\");\n", - "## There is a slight deviation in the value given in the textbook. This is because of approximation of the number of additional cases of cancer in the textbook.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Number of additional cases of cancer from insulation of home = 19977.17 \n", - "\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg535" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "## Example 9.13\n", - "import math\n", - "#calculate the\n", - "\n", - "## Given data\n", - "H_ext = 3.; ## External dose in rem\n", - "H_wbL = 5.; ## Annual whole body dose limit in rem\n", - "## Using the data from Table 9.17\n", - "## Annual Limit Intake (ALI) for inhalation of Iodine-131 is 54uCurie (Ci)\n", - "ALI = 54.;\n", - "## Calculation\n", - "I = ALI*(1.-(H_ext/H_wbL));\n", - "## Result\n", - "print'%s %.2f %s'%(\"\\n Amount of Iodine-131 intake within safety limits = \",math.ceil(I),\" uCi \\n\");\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " Amount of Iodine-131 intake within safety limits = 22.00 uCi \n", - "\n" - ] - } - ], - "prompt_number": 13 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter10.png b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter10.png deleted file mode 100644 index ca0fe4ce..00000000 Binary files a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter10.png and /dev/null differ diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter11.png b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter11.png deleted file mode 100644 index 48036db1..00000000 Binary files a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter11.png and /dev/null differ diff --git a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter2.png b/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter2.png deleted file mode 100644 index 3c50846a..00000000 Binary files a/_Introduction_to_Nuclear_Engineering_by_J._R._Lamarsh_and_A._J._Baratta/screenshots/chapter2.png and /dev/null differ diff --git a/_Mastering_C++/README.txt b/_Mastering_C++/README.txt deleted file mode 100755 index 3c39544d..00000000 --- a/_Mastering_C++/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: Sruti Goyal -Course: btech -College/Institute/Organization: National Institute of Technology Meghalaya -Department/Designation: Computer Science and Engineering -Book Title: Mastering C++ -Author: K R Venugopal and Rajkumar Buyya -Publisher: McGraw Hill Education (India) Private Limited , India -Year of publication: 2013 -Isbn: 9781259029943 -Edition: 2nd Edition \ No newline at end of file diff --git a/_Mastering_C++/screenshots/1.png b/_Mastering_C++/screenshots/1.png deleted file mode 100755 index df574903..00000000 Binary files a/_Mastering_C++/screenshots/1.png and /dev/null differ diff --git a/_Mastering_C++/screenshots/2.png b/_Mastering_C++/screenshots/2.png deleted file mode 100755 index 4a37be2b..00000000 Binary files a/_Mastering_C++/screenshots/2.png and /dev/null differ diff --git a/_Mastering_C++/screenshots/3.png b/_Mastering_C++/screenshots/3.png deleted file mode 100755 index 8e1713ff..00000000 Binary files a/_Mastering_C++/screenshots/3.png and /dev/null differ diff --git a/_Mastering_C++/screenshots/IMG-20150614-WA0001.png b/_Mastering_C++/screenshots/IMG-20150614-WA0001.png deleted file mode 100755 index 469c12fc..00000000 Binary files a/_Mastering_C++/screenshots/IMG-20150614-WA0001.png and /dev/null differ diff --git a/_Mastering_C++/screenshots/IMG-20150614-WA0006.png b/_Mastering_C++/screenshots/IMG-20150614-WA0006.png deleted file mode 100755 index 00aa17a6..00000000 Binary files a/_Mastering_C++/screenshots/IMG-20150614-WA0006.png and /dev/null differ diff --git a/_Mastering_C++/screenshots/IMG-20150619-WA0002.png b/_Mastering_C++/screenshots/IMG-20150619-WA0002.png deleted file mode 100755 index fc13fe9c..00000000 Binary files a/_Mastering_C++/screenshots/IMG-20150619-WA0002.png and /dev/null differ diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects.ipynb deleted file mode 100755 index a8a6de1f..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects.ipynb +++ /dev/null @@ -1,1241 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:8f7be8ab30cd8a38b71c7dbac3729da70ed4826b62dcb4d9b30b32010c83c291" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Chapter 10- Classes and objects" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- student.cpp, Page no-344" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class student: #member functions definition inside the body\n", - " __roll_no=int\n", - " __name=[None]*20\n", - " def setdata(self, roll_no_in, name_in):\n", - " self.roll_no=roll_no_in\n", - " self.name=name_in\n", - " def outdata(self):\n", - " print \"Roll no =\", self.roll_no\n", - " print \"Name =\", self.name\n", - "s1=student() #object of class student\n", - "s2=student()\n", - "s1.setdata(1, \"Tejaswi\") #invoking member functions\n", - "s2.setdata(10, \"Rajkumar\")\n", - "print \"Student details...\"\n", - "s1.outdata()\n", - "s2.outdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student details...\n", - "Roll no = 1\n", - "Name = Tejaswi\n", - "Roll no = 10\n", - "Name = Rajkumar\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-rect.cpp, Page no-345" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class rect:\n", - " __length=int\n", - " __breadth=int\n", - " def read(self, i, j):\n", - " self.__length=i\n", - " self.__breadth=j\n", - " def area(self):\n", - " return self.__length*self.__breadth\n", - "r=rect()\n", - "x, y=[int(x) for x in raw_input(\"Enter the length and breadth of the reactangle: \").split()]\n", - "r.read(x,y)\n", - "print \"Area of the rectangle =\", r.area()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the length and breadth of the reactangle: 4 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Area of the rectangle = 40\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-date1.cpp, Page no-348" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class date:\n", - " __day=int\n", - " __month=int\n", - " __year=int\n", - " def Set(self, DayIn, MonthIn, YearIn):\n", - " self.__day=DayIn\n", - " self.__month=MonthIn\n", - " self.__year=YearIn\n", - " def show(self):\n", - " print \"%s-%s-%s\" %(self.__day, self.__month, self.__year)\n", - "d1=date()\n", - "d2=date()\n", - "d3=date()\n", - "d1.Set(26, 3, 1958)\n", - "d2.Set(14, 4, 1971)\n", - "d3.Set(1, 9, 1973)\n", - "print \"Birth Date of First Author: \",\n", - "d1.show()\n", - "print \"Birth Date of Second Author: \",\n", - "d2.show()\n", - "print \"Birth Date of Third Author: \",\n", - "d3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth Date of First Author: 26-3-1958\n", - "Birth Date of Second Author: 14-4-1971\n", - "Birth Date of Third Author: 1-9-1973\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-date2.cpp, Page no-350" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Set(self, DayIn, MonthIn, YearIn):\n", - " self.__day=DayIn\n", - " self.__month=MonthIn\n", - " self.__year=YearIn\n", - "def show(self):\n", - " print \"%s-%s-%s\" %(self.__day, self.__month, self.__year)\n", - "class date:\n", - " __day=int\n", - " __month=int\n", - " __year=int\n", - " Set=Set #definiton of member function outside the class\n", - " show=show\n", - "d1=date()\n", - "d2=date()\n", - "d3=date()\n", - "d1.Set(26, 3, 1958)\n", - "d2.Set(14, 4, 1971)\n", - "d3.Set(1, 9, 1973)\n", - "print \"Birth Date of First Author: \",\n", - "d1.show()\n", - "print \"Birth Date of Second Author: \",\n", - "d2.show()\n", - "print \"Birth Date of Third Author: \",\n", - "d3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth Date of First Author: 26-3-1958\n", - "Birth Date of Second Author: 14-4-1971\n", - "Birth Date of Third Author: 1-9-1973\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-date3.cpp, Page no-352" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Set(self, DayIn, MonthIn, YearIn):\n", - " self.__day=DayIn\n", - " self.__month=MonthIn\n", - " self.__year=YearIn\n", - "def show(self):\n", - " print self.__day, \"-\", self.__month, \"-\", self.__year\n", - "class date:\n", - " __day=int\n", - " __month=int\n", - " __year=int\n", - " Set=Set\n", - " show=show\n", - "d1=date()\n", - "d2=date()\n", - "d3=date()\n", - "d1.Set(26, 3, 1958)\n", - "d2.Set(14, 4, 1971)\n", - "d3.Set(1, 9, 1973)\n", - "print \"Birth Date of First Author: \",\n", - "d1.show()\n", - "print \"Birth Date of Second Author: \",\n", - "d2.show()\n", - "print \"Birth Date of Third Author: \",\n", - "d3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth Date of First Author: 26 - 3 - 1958\n", - "Birth Date of Second Author: 14 - 4 - 1971\n", - "Birth Date of Third Author: 1 - 9 - 1973\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-nesting.cpp, Page no-354" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class NumberParis:\n", - " __num1=int\n", - " __num2=int\n", - " def read(self):\n", - " self.__num1=int(raw_input(\"Enter First Number: \"))\n", - " self.__num2=int(raw_input(\"Enter Second Number: \"))\n", - " def Max(self):\n", - " if self.__num1>self.__num2:\n", - " return self.__num1\n", - " else:\n", - " return self.__num2\n", - " def ShowMax(self):\n", - " print \"Maximum =\", self.Max() #invoking a member function in another member function\n", - "n1=NumberParis()\n", - "n1.read()\n", - "n1.ShowMax()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter First Number: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Second Number: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum = 10\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-part.cpp, Page no-355" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class part:\n", - " __ModelNum=int #private members\n", - " __PartNum=int\n", - " __cost=float\n", - " def SetPart(self, mn, pn, c):\n", - " self.__ModelNum=mn\n", - " self.__PartNum=pn\n", - " self.__cost=c\n", - " def ShowPart(self):\n", - " print \"Model:\", self.__ModelNum\n", - " print \"Part:\", self.__PartNum\n", - " print \"Cost:\", self.__cost\n", - "p1=part()\n", - "p2=part()\n", - "p1.SetPart(1996, 23, 1250.55)\n", - "p2.SetPart(2000, 243, 2354.75)\n", - "print \"First Part Details...\"\n", - "p1.ShowPart()\n", - "print \"Second Part Details...\"\n", - "p2.ShowPart()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "First Part Details...\n", - "Model: 1996\n", - "Part: 23\n", - "Cost: 1250.55\n", - "Second Part Details...\n", - "Model: 2000\n", - "Part: 243\n", - "Cost: 2354.75\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector.cpp, Page no-361" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def read(self):\n", - " for i in range(self._vector__sz):\n", - " print \"Enter vector [\", i, \"]? \",\n", - " self._vector__v[i]=int(raw_input())\n", - "def show_sum(self):\n", - " Sum=0\n", - " for i in range(self._vector__sz):\n", - " Sum+=self._vector__v[i]\n", - " print \"Vector sum =\", Sum\n", - "class vector:\n", - " __v=[int] #array of type integer\n", - " __sz=int\n", - " def VectorSize(self, size):\n", - " self.__sz= size\n", - " self.__v=[int]*size #dynamically allocating size to integer array\n", - " def release(self):\n", - " del self.__v\n", - " read=read\n", - " show_sum=show_sum\n", - "v1=vector()\n", - "count=int(raw_input(\"How many elements are there in the vector: \"))\n", - "v1.VectorSize(count)\n", - "v1.read()\n", - "v1.show_sum()\n", - "v1.release()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many elements are there in the vector: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter vector [ 0 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 1 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 2 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 3 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 4 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Vector sum = 15\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-distance.cpp, Page no-363" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class distance:\n", - " __feet=float\n", - " __inches=float\n", - " def init(self, ft, In):\n", - " self.__feet=ft\n", - " self.__inches=In\n", - " def read(self):\n", - " self.__feet=float(raw_input(\"Enter feet: \"))\n", - " self.__inches=float(raw_input(\"Enter inches: \"))\n", - " def show(self):\n", - " print self.__feet, \"\\'-\", self.__inches, \"\\\"\"\n", - " def add(self, d1, d2):\n", - " self.__feet=d1.__feet+d2.__feet\n", - " self.__inches=d1.__inches+d2.__inches\n", - " if self.__inches>=12:\n", - " self.__feet=self.__feet+1\n", - " self.__inches=self.__inches-12\n", - "d1=distance()\n", - "d2=distance()\n", - "d3=distance()\n", - "d2.init(11, 6.25)\n", - "d1.read()\n", - "print \"d1=\",\n", - "d1.show()\n", - "print \"d2=\",\n", - "d2.show()\n", - "d3.add(d1,d2)\n", - "print \"d3 = d1+d2 =\",\n", - "d3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter feet: 12.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter inches: 7.25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "d1= 12.0 '- 7.25 \"\n", - "d2= 11 '- 6.25 \"\n", - "d3 = d1+d2 = 24.0 '- 1.5 \"\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-account.cpp, Page no-365" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MoneyTransfer(self, acc , amount): # passing objects as parameters\n", - " self._AccClass__balance=self._AccClass__balance-amount\n", - " acc._AccClass__balance=acc._AccClass__balance + amount\n", - "class AccClass:\n", - " __accno=int\n", - " __balance=float\n", - " def setdata(self, an, bal=0.0):\n", - " self.accno=an\n", - " self.__balance=bal\n", - " def getdata(self):\n", - " self.accno=raw_input(\"Enter account number for acc1 object: \")\n", - " self.__balance=float(raw_input(\"Enter the balance: \"))\n", - " def display(self):\n", - " print \"Acoount number is: \", self.accno\n", - " print \"Balance is: \", self.__balance\n", - " MoneyTransfer=MoneyTransfer\n", - "acc1=AccClass()\n", - "acc2=AccClass()\n", - "acc3=AccClass()\n", - "acc1.getdata()\n", - "acc2.setdata(10)\n", - "acc3.setdata(20, 750.5)\n", - "print \"Acoount information...\"\n", - "acc1.display()\n", - "acc2.display()\n", - "acc3.display()\n", - "trans_money=float(raw_input(\"How much money is to be transferred from acc3 to acc1: \"))\n", - "acc3.MoneyTransfer(acc1, trans_money)\n", - "print \"Updated information about accounts...\"\n", - "acc1.display()\n", - "acc2.display()\n", - "acc3.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter account number for acc1 object: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the balance: 100\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Acoount information...\n", - "Acoount number is: 1\n", - "Balance is: 100.0\n", - "Acoount number is: 10\n", - "Balance is: 0.0\n", - "Acoount number is: 20\n", - "Balance is: 750.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How much money is to be transferred from acc3 to acc1: 200\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Updated information about accounts...\n", - "Acoount number is: 1\n", - "Balance is: 300.0\n", - "Acoount number is: 10\n", - "Balance is: 0.0\n", - "Acoount number is: 20\n", - "Balance is: 550.5\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex.cpp, Page no-367" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "def add (self, c2): #objects as parameters \n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real Part ? \"))\n", - " self.__imag=float(raw_input(\"Imag Part ? \"))\n", - " def outdata(self, msg):\n", - " print msg, \n", - " print self.__real,\n", - " if self.__imag<0:\n", - " print \"-i\",\n", - " else:\n", - " print \"+i\",\n", - " print math.fabs(self.__imag) #print absolute value\n", - " add=add\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter Complex number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex number c2...\"\n", - "c2.getdata()\n", - "c3=c1.add(c2)\n", - "c3.outdata(\"c3=c1.add(c2):\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real Part ? 1.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag Part ? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real Part ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag Part ? -4.3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c3=c1.add(c2): 4.5 -i 2.3\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-friend1.cpp, Page no-371" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class one:\n", - " __data1=int\n", - " def setdata(self, init):\n", - " self.__data1=init\n", - "class two:\n", - " __data2=int\n", - " def setdata(self, init):\n", - " self.__data2=init\n", - "def add_both(a, b): #friend function\n", - " return a._one__data1+b._two__data2\n", - "a=one()\n", - "b=two()\n", - "a.setdata(5)\n", - "b.setdata(10)\n", - "print \"Sum of one and two:\", add_both(a,b)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of one and two: 15\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-friend2.cpp, Page no-373" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class boy:\n", - " __income1=int\n", - " __income2=int\n", - " def setdata(self, in1, in2):\n", - " self.__income1=in1\n", - " self.__income2=in2\n", - "class girl:\n", - " __income=int\n", - " def girlfunc(self, b1):\n", - " return b1._boy__income1+b1._boy__income2\n", - " def setdata(self, In):\n", - " self.__income=In\n", - " def show(self):\n", - " b1=boy()\n", - " b1.setdata(100, 200)\n", - " print \"boy's Income1 in show():\", b1._boy__income1\n", - " print \"girl's income in show():\", self.__income\n", - "b1=boy()\n", - "g1=girl()\n", - "b1.setdata(500, 1000)\n", - "g1.setdata(300)\n", - "print \"boy b1 total income:\", g1.girlfunc(b1)\n", - "g1.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "boy b1 total income: 1500\n", - "boy's Income1 in show(): 100\n", - "girl's income in show(): 300\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-friend3.cpp, Page no-375" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def girlfunc(self, b1):\n", - " return b1._boy__income1+b1._boy__income2\n", - "class girl:\n", - " __income=int\n", - " __girlfunc=girlfunc\n", - " def setdata(self, In):\n", - " self.__income=In\n", - " def show(self):\n", - " print \"girl income:\", self.__income\n", - "class boy:\n", - " __income1=int\n", - " __income2=int\n", - " def setdata(self, in1, in2):\n", - " self.__income1=in1\n", - " self.__income2=in2\n", - "b1=boy()\n", - "g1=girl()\n", - "b1.setdata(500, 1000)\n", - "g1.setdata(300)\n", - "print \"boy b1 total income:\", g1._girl__girlfunc(b1)\n", - "g1.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "boy b1 total income: 1500\n", - "girl income: 300\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-constmem.cpp, Page 377" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self):\n", - " self._Person__name=self._Person__address=self._Person__phone=0\n", - "def clear(self):\n", - " del self._Person__name\n", - " del self._Person__address\n", - " del self._Person__phone\n", - "def setname(self, Str):\n", - " if self._Person__name:\n", - " del self._Person__name\n", - " self._Person__name=Str\n", - "def setaddress(self, Str):\n", - " if self._Person__address:\n", - " del self._Person__address\n", - " self._Person__address=Str\n", - "def setphone(self, Str):\n", - " if self._Person__phone:\n", - " del self._Person__phone\n", - " self._Person__phone=Str\n", - "def getname(self):\n", - " return self._Person__name\n", - "def getaddress(self):\n", - " return self._Person__address\n", - "def getphone(self):\n", - " return self._Person__phone\n", - "def printperson(p):\n", - " if p.getname():\n", - " print \"Name :\", p.getname()\n", - " if p.getaddress():\n", - " print \"Address :\", p.getaddress()\n", - " if p.getphone():\n", - " print \"Phone :\", p.getphone()\n", - "class Person:\n", - " __name=str\n", - " __address=str\n", - " __phone=str\n", - " __init__=__init__\n", - " clear=clear\n", - " setname=setname\n", - " setaddress=setaddress\n", - " setphone=setphone\n", - " getname=getname\n", - " getaddress=getaddress\n", - " getphone=getphone\n", - "p1=Person()\n", - "p2=Person()\n", - "p1.setname(\"Rajkumar\")\n", - "p1.setaddress(\"Email: rajacdacb.ernet.in\")\n", - "p1.setphone(\"90-080-5584271\")\n", - "printperson(p1)\n", - "p2.setname(\"Venugopal K R\")\n", - "p2.setaddress(\"Bangalore University\")\n", - "p2.setphone(\"-not sure-\")\n", - "printperson(p2)\n", - "p1.clear()\n", - "p2.clear()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name : Rajkumar\n", - "Address : Email: rajacdacb.ernet.in\n", - "Phone : 90-080-5584271\n", - "Name : Venugopal K R\n", - "Address : Bangalore University\n", - "Phone : -not sure-\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-count.cpp, Page no-382" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class MyClass():\n", - " __count=[int]#static member\n", - " __number=int\n", - " def set(self, num):\n", - " self.__number=num\n", - " self.__count[0]+=1\n", - " def show(self):\n", - " print \"Number of calls made to 'set()' through any object:\", self.__count[0]\n", - "obj1=MyClass()\n", - "obj1._MyClass__count[0]=0\n", - "obj1.show()\n", - "obj1.set(100)\n", - "obj1.show()\n", - "obj2=MyClass()\n", - "obj3=MyClass()\n", - "obj2.set(200)\n", - "obj2.show()\n", - "obj2.set(250)\n", - "obj3.set(300)\n", - "obj1.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of calls made to 'set()' through any object: 0\n", - "Number of calls made to 'set()' through any object: 1\n", - "Number of calls made to 'set()' through any object: 2\n", - "Number of calls made to 'set()' through any object: 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-dirs.cpp, Page no-384" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Directory:\n", - " __path=[str] #static member\n", - " def setpath(self, newpath):\n", - " self.__path[0]=newpath\n", - "Directory()._Directory__path[0]=\"/usr/raj\"\n", - "print \"Path:\", Directory()._Directory__path[0]\n", - "Directory().setpath(\"/usr\")\n", - "print \"Path:\", Directory()._Directory__path[0]\n", - "dir=Directory()\n", - "dir.setpath(\"/etc\")\n", - "print \"Path:\", dir._Directory__path[0]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Path: /usr/raj\n", - "Path: /usr\n", - "Path: /etc\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page no-389" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class employee:\n", - " __emp_no=int\n", - " __emp_name=[None]*25\n", - " def accept(self, i, j):\n", - " self.__emp_no=i\n", - " self.__emp_name=j\n", - " def display(self):\n", - " print \"Employee Number:\", self.__emp_no,\"\\tEmployee Name:\",self.__emp_name\n", - "e=[]*5\n", - "for i in range(5):\n", - " e.append(employee())\n", - "print \"Enter the details for five employees: \"\n", - "for i in range(5):\n", - " no=int(raw_input(\"Number: \"))\n", - " name=raw_input(\"Name: \")\n", - " e[i].accept(no, name)\n", - "print \"*****Employee Details*****\"\n", - "for i in range(5):\n", - " e[i].display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the details for five employees: \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Vishwanathan\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Archana\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Prasad\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Sarthak\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Ganeshan\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "*****Employee Details*****\n", - "Employee Number: 1 \tEmployee Name: Vishwanathan\n", - "Employee Number: 2 \tEmployee Name: Archana\n", - "Employee Number: 3 \tEmployee Name: Prasad\n", - "Employee Number: 4 \tEmployee Name: Sarthak\n", - "Employee Number: 5 \tEmployee Name: Ganeshan\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects_1.ipynb deleted file mode 100755 index e0892960..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter10-ClassesAndObjects_1.ipynb +++ /dev/null @@ -1,1241 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:7cdf129099ae95ab70f7dd170afdee59f1a075836a82b7b4492486f65167bd41" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 10- Classes and objects" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- student.cpp, Page no-344" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class student: #member functions definition inside the body\n", - " __roll_no=int\n", - " __name=[None]*20\n", - " def setdata(self, roll_no_in, name_in):\n", - " self.roll_no=roll_no_in\n", - " self.name=name_in\n", - " def outdata(self):\n", - " print \"Roll no =\", self.roll_no\n", - " print \"Name =\", self.name\n", - "s1=student() #object of class student\n", - "s2=student()\n", - "s1.setdata(1, \"Tejaswi\") #invoking member functions\n", - "s2.setdata(10, \"Rajkumar\")\n", - "print \"Student details...\"\n", - "s1.outdata()\n", - "s2.outdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student details...\n", - "Roll no = 1\n", - "Name = Tejaswi\n", - "Roll no = 10\n", - "Name = Rajkumar\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-rect.cpp, Page no-345" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class rect:\n", - " __length=int\n", - " __breadth=int\n", - " def read(self, i, j):\n", - " self.__length=i\n", - " self.__breadth=j\n", - " def area(self):\n", - " return self.__length*self.__breadth\n", - "r=rect()\n", - "x, y=[int(x) for x in raw_input(\"Enter the length and breadth of the reactangle: \").split()]\n", - "r.read(x,y)\n", - "print \"Area of the rectangle =\", r.area()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the length and breadth of the reactangle: 4 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Area of the rectangle = 40\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-date1.cpp, Page no-348" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class date:\n", - " __day=int\n", - " __month=int\n", - " __year=int\n", - " def Set(self, DayIn, MonthIn, YearIn):\n", - " self.__day=DayIn\n", - " self.__month=MonthIn\n", - " self.__year=YearIn\n", - " def show(self):\n", - " print \"%s-%s-%s\" %(self.__day, self.__month, self.__year)\n", - "d1=date()\n", - "d2=date()\n", - "d3=date()\n", - "d1.Set(26, 3, 1958)\n", - "d2.Set(14, 4, 1971)\n", - "d3.Set(1, 9, 1973)\n", - "print \"Birth Date of First Author: \",\n", - "d1.show()\n", - "print \"Birth Date of Second Author: \",\n", - "d2.show()\n", - "print \"Birth Date of Third Author: \",\n", - "d3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth Date of First Author: 26-3-1958\n", - "Birth Date of Second Author: 14-4-1971\n", - "Birth Date of Third Author: 1-9-1973\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-date2.cpp, Page no-350" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Set(self, DayIn, MonthIn, YearIn):\n", - " self.__day=DayIn\n", - " self.__month=MonthIn\n", - " self.__year=YearIn\n", - "def show(self):\n", - " print \"%s-%s-%s\" %(self.__day, self.__month, self.__year)\n", - "class date:\n", - " __day=int\n", - " __month=int\n", - " __year=int\n", - " Set=Set #definiton of member function outside the class\n", - " show=show\n", - "d1=date()\n", - "d2=date()\n", - "d3=date()\n", - "d1.Set(26, 3, 1958)\n", - "d2.Set(14, 4, 1971)\n", - "d3.Set(1, 9, 1973)\n", - "print \"Birth Date of First Author: \",\n", - "d1.show()\n", - "print \"Birth Date of Second Author: \",\n", - "d2.show()\n", - "print \"Birth Date of Third Author: \",\n", - "d3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth Date of First Author: 26-3-1958\n", - "Birth Date of Second Author: 14-4-1971\n", - "Birth Date of Third Author: 1-9-1973\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-date3.cpp, Page no-352" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Set(self, DayIn, MonthIn, YearIn):\n", - " self.__day=DayIn\n", - " self.__month=MonthIn\n", - " self.__year=YearIn\n", - "def show(self):\n", - " print self.__day, \"-\", self.__month, \"-\", self.__year\n", - "class date:\n", - " __day=int\n", - " __month=int\n", - " __year=int\n", - " Set=Set\n", - " show=show\n", - "d1=date()\n", - "d2=date()\n", - "d3=date()\n", - "d1.Set(26, 3, 1958)\n", - "d2.Set(14, 4, 1971)\n", - "d3.Set(1, 9, 1973)\n", - "print \"Birth Date of First Author: \",\n", - "d1.show()\n", - "print \"Birth Date of Second Author: \",\n", - "d2.show()\n", - "print \"Birth Date of Third Author: \",\n", - "d3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth Date of First Author: 26 - 3 - 1958\n", - "Birth Date of Second Author: 14 - 4 - 1971\n", - "Birth Date of Third Author: 1 - 9 - 1973\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-nesting.cpp, Page no-354" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class NumberParis:\n", - " __num1=int\n", - " __num2=int\n", - " def read(self):\n", - " self.__num1=int(raw_input(\"Enter First Number: \"))\n", - " self.__num2=int(raw_input(\"Enter Second Number: \"))\n", - " def Max(self):\n", - " if self.__num1>self.__num2:\n", - " return self.__num1\n", - " else:\n", - " return self.__num2\n", - " def ShowMax(self):\n", - " print \"Maximum =\", self.Max() #invoking a member function in another member function\n", - "n1=NumberParis()\n", - "n1.read()\n", - "n1.ShowMax()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter First Number: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Second Number: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum = 10\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-part.cpp, Page no-355" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class part:\n", - " __ModelNum=int #private members\n", - " __PartNum=int\n", - " __cost=float\n", - " def SetPart(self, mn, pn, c):\n", - " self.__ModelNum=mn\n", - " self.__PartNum=pn\n", - " self.__cost=c\n", - " def ShowPart(self):\n", - " print \"Model:\", self.__ModelNum\n", - " print \"Part:\", self.__PartNum\n", - " print \"Cost:\", self.__cost\n", - "p1=part()\n", - "p2=part()\n", - "p1.SetPart(1996, 23, 1250.55)\n", - "p2.SetPart(2000, 243, 2354.75)\n", - "print \"First Part Details...\"\n", - "p1.ShowPart()\n", - "print \"Second Part Details...\"\n", - "p2.ShowPart()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "First Part Details...\n", - "Model: 1996\n", - "Part: 23\n", - "Cost: 1250.55\n", - "Second Part Details...\n", - "Model: 2000\n", - "Part: 243\n", - "Cost: 2354.75\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector.cpp, Page no-361" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def read(self):\n", - " for i in range(self._vector__sz):\n", - " print \"Enter vector [\", i, \"]? \",\n", - " self._vector__v[i]=int(raw_input())\n", - "def show_sum(self):\n", - " Sum=0\n", - " for i in range(self._vector__sz):\n", - " Sum+=self._vector__v[i]\n", - " print \"Vector sum =\", Sum\n", - "class vector:\n", - " __v=[int] #array of type integer\n", - " __sz=int\n", - " def VectorSize(self, size):\n", - " self.__sz= size\n", - " self.__v=[int]*size #dynamically allocating size to integer array\n", - " def release(self):\n", - " del self.__v\n", - " read=read\n", - " show_sum=show_sum\n", - "v1=vector()\n", - "count=int(raw_input(\"How many elements are there in the vector: \"))\n", - "v1.VectorSize(count)\n", - "v1.read()\n", - "v1.show_sum()\n", - "v1.release()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many elements are there in the vector: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter vector [ 0 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 1 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 2 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 3 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 4 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Vector sum = 15\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-distance.cpp, Page no-363" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class distance:\n", - " __feet=float\n", - " __inches=float\n", - " def init(self, ft, In):\n", - " self.__feet=ft\n", - " self.__inches=In\n", - " def read(self):\n", - " self.__feet=float(raw_input(\"Enter feet: \"))\n", - " self.__inches=float(raw_input(\"Enter inches: \"))\n", - " def show(self):\n", - " print self.__feet, \"\\'-\", self.__inches, \"\\\"\"\n", - " def add(self, d1, d2):\n", - " self.__feet=d1.__feet+d2.__feet\n", - " self.__inches=d1.__inches+d2.__inches\n", - " if self.__inches>=12:\n", - " self.__feet=self.__feet+1\n", - " self.__inches=self.__inches-12\n", - "d1=distance()\n", - "d2=distance()\n", - "d3=distance()\n", - "d2.init(11, 6.25)\n", - "d1.read()\n", - "print \"d1=\",\n", - "d1.show()\n", - "print \"d2=\",\n", - "d2.show()\n", - "d3.add(d1,d2)\n", - "print \"d3 = d1+d2 =\",\n", - "d3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter feet: 12.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter inches: 7.25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "d1= 12.0 '- 7.25 \"\n", - "d2= 11 '- 6.25 \"\n", - "d3 = d1+d2 = 24.0 '- 1.5 \"\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-account.cpp, Page no-365" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MoneyTransfer(self, acc , amount): # passing objects as parameters\n", - " self._AccClass__balance=self._AccClass__balance-amount\n", - " acc._AccClass__balance=acc._AccClass__balance + amount\n", - "class AccClass:\n", - " __accno=int\n", - " __balance=float\n", - " def setdata(self, an, bal=0.0):\n", - " self.accno=an\n", - " self.__balance=bal\n", - " def getdata(self):\n", - " self.accno=raw_input(\"Enter account number for acc1 object: \")\n", - " self.__balance=float(raw_input(\"Enter the balance: \"))\n", - " def display(self):\n", - " print \"Acoount number is: \", self.accno\n", - " print \"Balance is: \", self.__balance\n", - " MoneyTransfer=MoneyTransfer\n", - "acc1=AccClass()\n", - "acc2=AccClass()\n", - "acc3=AccClass()\n", - "acc1.getdata()\n", - "acc2.setdata(10)\n", - "acc3.setdata(20, 750.5)\n", - "print \"Acoount information...\"\n", - "acc1.display()\n", - "acc2.display()\n", - "acc3.display()\n", - "trans_money=float(raw_input(\"How much money is to be transferred from acc3 to acc1: \"))\n", - "acc3.MoneyTransfer(acc1, trans_money)\n", - "print \"Updated information about accounts...\"\n", - "acc1.display()\n", - "acc2.display()\n", - "acc3.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter account number for acc1 object: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the balance: 100\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Acoount information...\n", - "Acoount number is: 1\n", - "Balance is: 100.0\n", - "Acoount number is: 10\n", - "Balance is: 0.0\n", - "Acoount number is: 20\n", - "Balance is: 750.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How much money is to be transferred from acc3 to acc1: 200\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Updated information about accounts...\n", - "Acoount number is: 1\n", - "Balance is: 300.0\n", - "Acoount number is: 10\n", - "Balance is: 0.0\n", - "Acoount number is: 20\n", - "Balance is: 550.5\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex.cpp, Page no-367" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "def add (self, c2): #objects as parameters \n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real Part ? \"))\n", - " self.__imag=float(raw_input(\"Imag Part ? \"))\n", - " def outdata(self, msg):\n", - " print msg, \n", - " print self.__real,\n", - " if self.__imag<0:\n", - " print \"-i\",\n", - " else:\n", - " print \"+i\",\n", - " print math.fabs(self.__imag) #print absolute value\n", - " add=add\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter Complex number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex number c2...\"\n", - "c2.getdata()\n", - "c3=c1.add(c2)\n", - "c3.outdata(\"c3=c1.add(c2):\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real Part ? 1.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag Part ? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real Part ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag Part ? -4.3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c3=c1.add(c2): 4.5 -i 2.3\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-friend1.cpp, Page no-371" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class one:\n", - " __data1=int\n", - " def setdata(self, init):\n", - " self.__data1=init\n", - "class two:\n", - " __data2=int\n", - " def setdata(self, init):\n", - " self.__data2=init\n", - "def add_both(a, b): #friend function\n", - " return a._one__data1+b._two__data2\n", - "a=one()\n", - "b=two()\n", - "a.setdata(5)\n", - "b.setdata(10)\n", - "print \"Sum of one and two:\", add_both(a,b)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of one and two: 15\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-friend2.cpp, Page no-373" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class boy:\n", - " __income1=int\n", - " __income2=int\n", - " def setdata(self, in1, in2):\n", - " self.__income1=in1\n", - " self.__income2=in2\n", - "class girl:\n", - " __income=int\n", - " def girlfunc(self, b1):\n", - " return b1._boy__income1+b1._boy__income2\n", - " def setdata(self, In):\n", - " self.__income=In\n", - " def show(self):\n", - " b1=boy()\n", - " b1.setdata(100, 200)\n", - " print \"boy's Income1 in show():\", b1._boy__income1\n", - " print \"girl's income in show():\", self.__income\n", - "b1=boy()\n", - "g1=girl()\n", - "b1.setdata(500, 1000)\n", - "g1.setdata(300)\n", - "print \"boy b1 total income:\", g1.girlfunc(b1)\n", - "g1.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "boy b1 total income: 1500\n", - "boy's Income1 in show(): 100\n", - "girl's income in show(): 300\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-friend3.cpp, Page no-375" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def girlfunc(self, b1):\n", - " return b1._boy__income1+b1._boy__income2\n", - "class girl:\n", - " __income=int\n", - " __girlfunc=girlfunc\n", - " def setdata(self, In):\n", - " self.__income=In\n", - " def show(self):\n", - " print \"girl income:\", self.__income\n", - "class boy:\n", - " __income1=int\n", - " __income2=int\n", - " def setdata(self, in1, in2):\n", - " self.__income1=in1\n", - " self.__income2=in2\n", - "b1=boy()\n", - "g1=girl()\n", - "b1.setdata(500, 1000)\n", - "g1.setdata(300)\n", - "print \"boy b1 total income:\", g1._girl__girlfunc(b1)\n", - "g1.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "boy b1 total income: 1500\n", - "girl income: 300\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-constmem.cpp, Page 377" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self):\n", - " self._Person__name=self._Person__address=self._Person__phone=0\n", - "def clear(self):\n", - " del self._Person__name\n", - " del self._Person__address\n", - " del self._Person__phone\n", - "def setname(self, Str):\n", - " if self._Person__name:\n", - " del self._Person__name\n", - " self._Person__name=Str\n", - "def setaddress(self, Str):\n", - " if self._Person__address:\n", - " del self._Person__address\n", - " self._Person__address=Str\n", - "def setphone(self, Str):\n", - " if self._Person__phone:\n", - " del self._Person__phone\n", - " self._Person__phone=Str\n", - "def getname(self):\n", - " return self._Person__name\n", - "def getaddress(self):\n", - " return self._Person__address\n", - "def getphone(self):\n", - " return self._Person__phone\n", - "def printperson(p):\n", - " if p.getname():\n", - " print \"Name :\", p.getname()\n", - " if p.getaddress():\n", - " print \"Address :\", p.getaddress()\n", - " if p.getphone():\n", - " print \"Phone :\", p.getphone()\n", - "class Person:\n", - " __name=str\n", - " __address=str\n", - " __phone=str\n", - " __init__=__init__\n", - " clear=clear\n", - " setname=setname\n", - " setaddress=setaddress\n", - " setphone=setphone\n", - " getname=getname\n", - " getaddress=getaddress\n", - " getphone=getphone\n", - "p1=Person()\n", - "p2=Person()\n", - "p1.setname(\"Rajkumar\")\n", - "p1.setaddress(\"Email: rajacdacb.ernet.in\")\n", - "p1.setphone(\"90-080-5584271\")\n", - "printperson(p1)\n", - "p2.setname(\"Venugopal K R\")\n", - "p2.setaddress(\"Bangalore University\")\n", - "p2.setphone(\"-not sure-\")\n", - "printperson(p2)\n", - "p1.clear()\n", - "p2.clear()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name : Rajkumar\n", - "Address : Email: rajacdacb.ernet.in\n", - "Phone : 90-080-5584271\n", - "Name : Venugopal K R\n", - "Address : Bangalore University\n", - "Phone : -not sure-\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-count.cpp, Page no-382" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class MyClass():\n", - " __count=[int]#static member\n", - " __number=int\n", - " def set(self, num):\n", - " self.__number=num\n", - " self.__count[0]+=1\n", - " def show(self):\n", - " print \"Number of calls made to 'set()' through any object:\", self.__count[0]\n", - "obj1=MyClass()\n", - "obj1._MyClass__count[0]=0\n", - "obj1.show()\n", - "obj1.set(100)\n", - "obj1.show()\n", - "obj2=MyClass()\n", - "obj3=MyClass()\n", - "obj2.set(200)\n", - "obj2.show()\n", - "obj2.set(250)\n", - "obj3.set(300)\n", - "obj1.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of calls made to 'set()' through any object: 0\n", - "Number of calls made to 'set()' through any object: 1\n", - "Number of calls made to 'set()' through any object: 2\n", - "Number of calls made to 'set()' through any object: 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-dirs.cpp, Page no-384" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Directory:\n", - " __path=[str] #static member\n", - " def setpath(self, newpath):\n", - " self.__path[0]=newpath\n", - "Directory()._Directory__path[0]=\"/usr/raj\"\n", - "print \"Path:\", Directory()._Directory__path[0]\n", - "Directory().setpath(\"/usr\")\n", - "print \"Path:\", Directory()._Directory__path[0]\n", - "dir=Directory()\n", - "dir.setpath(\"/etc\")\n", - "print \"Path:\", dir._Directory__path[0]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Path: /usr/raj\n", - "Path: /usr\n", - "Path: /etc\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page no-389" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class employee:\n", - " __emp_no=int\n", - " __emp_name=[None]*25\n", - " def accept(self, i, j):\n", - " self.__emp_no=i\n", - " self.__emp_name=j\n", - " def display(self):\n", - " print \"Employee Number:\", self.__emp_no,\"\\tEmployee Name:\",self.__emp_name\n", - "e=[]*5\n", - "for i in range(5):\n", - " e.append(employee())\n", - "print \"Enter the details for five employees: \"\n", - "for i in range(5):\n", - " no=int(raw_input(\"Number: \"))\n", - " name=raw_input(\"Name: \")\n", - " e[i].accept(no, name)\n", - "print \"*****Employee Details*****\"\n", - "for i in range(5):\n", - " e[i].display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the details for five employees: \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Vishwanathan\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Archana\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Prasad\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Sarthak\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Ganeshan\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "*****Employee Details*****\n", - "Employee Number: 1 \tEmployee Name: Vishwanathan\n", - "Employee Number: 2 \tEmployee Name: Archana\n", - "Employee Number: 3 \tEmployee Name: Prasad\n", - "Employee Number: 4 \tEmployee Name: Sarthak\n", - "Employee Number: 5 \tEmployee Name: Ganeshan\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up.ipynb deleted file mode 100755 index e75a9045..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up.ipynb +++ /dev/null @@ -1,1781 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:1e5e3f82f73a47a49eb33b525df841c886d804170ed7ff4f07a60c1f0014985c" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 11: Object Initialization and clean up" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- bag.cpp, Page-392" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_ITEMS=25\n", - "def show(self):\n", - " for i in range(self.ItemCount):\n", - " print self._Bag__contents[i],\n", - "class Bag:\n", - " __contents=[int]*MAX_ITEMS\n", - " __ItemCount=int\n", - " def SetEmpty(self):\n", - " self.ItemCount=0\n", - " def put(self,item):\n", - " self._Bag__contents[self.ItemCount]=item\n", - " self.ItemCount+=1\n", - " show=show\n", - "bag=Bag() #object of class Bag\n", - "bag.SetEmpty() #initialize the object\n", - "while 1:\n", - " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", - " if item==0:\n", - " break\n", - " bag.put(item)\n", - " print \"Items in bag:\",\n", - " bag.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in bag: 1" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3 2" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3 2 4" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- newbag.cpp, Page-395" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_ITEMS=25 #size of array contents\n", - "def show(self):\n", - " for i in range(self.ItemCount):\n", - " print self._Bag__contents[i],\n", - "class Bag:\n", - " __contents=[int]*MAX_ITEMS #int 1D array\n", - " __ItemCount=int\n", - " def __init__(self): #Constructor\n", - " self.ItemCount=0\n", - " def put(self,item): #member function defined inside the class\n", - " self._Bag__contents[self.ItemCount]=item\n", - " self.ItemCount+=1\n", - " show=show #member function defined outside the class\n", - "bag=Bag() #object of class Bag\n", - "while 1:\n", - " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", - " if item==0:\n", - " break\n", - " bag.put(item)\n", - " print \"Items in bag:\",\n", - " bag.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in bag: 1" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3 2" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3 2 4" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-test1.cpp, Page-396" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self):\n", - " print \"Constructor of class test called\"\n", - "class Test:\n", - " __init__=__init__ #Constructor\n", - "G=Test()\n", - "def func():\n", - " L=Test()\n", - " print \"Here's function func()\"\n", - "X=Test()\n", - "print \"main() function\"\n", - "func()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor of class test called\n", - "Constructor of class test called\n", - "main() function\n", - "Constructor of class test called\n", - "Here's function func()\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- giftbag.cpp, Page- 398" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_ITEMS=25\n", - "def show(self):\n", - " if self.ItemCount:\n", - " for i in range(self.ItemCount):\n", - " print self._Bag__contents[i],\n", - " else:\n", - " print \"Nil\"\n", - "class Bag:\n", - " __contents=[int]*MAX_ITEMS\n", - " __ItemCount=int\n", - " def __init__(self, item=None): #parameterized constructor: Python does not support overloading of functions\n", - " if isinstance(item, int):\n", - " self._Bag__contents[0]=item\n", - " self.ItemCount=1\n", - " else:\n", - " self.ItemCount=0\n", - " def put(self,item):\n", - " self._Bag__contents[self.ItemCount]=item\n", - " self.ItemCount+=1\n", - " show=show\n", - "bag1=Bag()\n", - "bag2=Bag(4) #object created using the parameterized constructor\n", - "print \"Gifted bag1 initially has:\",\n", - "bag1.show()\n", - "print \"Gifted bag2 initially has:\",\n", - "bag2.show()\n", - "while 1:\n", - " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", - " if item==0:\n", - " break\n", - " bag2.put(item)\n", - " print \"Items in bag2:\",\n", - " bag2.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Gifted bag1 initially has: Nil\n", - "Gifted bag2 initially has: 4" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag2: 4 1" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag2: 4 1 2" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag2: 4 1 2 3" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-test.cpp, Page-400 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self):\n", - " print \"Constructor of class Test called\"\n", - "def __del__(self):\n", - " print \"Destructor of class Test called\"\n", - "class Test:\n", - " __init__=__init__ #Constructor\n", - " __del__=__del__ #Destructor\n", - "x=Test()\n", - "print \"Terminating main\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor of class Test called\n", - "Destructor of class Test called\n", - "Terminating main\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-count.cpp, Page-401" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "nobjects=0\n", - "nobj_alive=0\n", - "class MyClass:\n", - " def __init__(self):\n", - " global nobjects #using the global nobjects\n", - " global nobj_alive #using the global nobj_alive\n", - " nobjects+=1\n", - " nobj_alive+=1\n", - " def __del__(self):\n", - " global nobj_alive #using the global nobjects\n", - " nobj_alive-=1\n", - " def show(self):\n", - " global nobjects\n", - " global nobj_alive\n", - " print \"Total number of objects created: \", nobjects\n", - " print \"Number of objects currently alive: \", nobj_alive\n", - "obj1=MyClass()\n", - "obj1.show()\n", - "def func():\n", - " obj1=MyClass()\n", - " obj2=MyClass()\n", - " obj2.show()\n", - " del obj1\n", - " del obj2\n", - "func()\n", - "obj1.show()\n", - "obj2=MyClass()\n", - "obj3=MyClass()\n", - "obj2.show()\n", - "del obj1\n", - "del obj2\n", - "del obj3" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total number of objects created: 1\n", - "Number of objects currently alive: 1\n", - "Total number of objects created: 3\n", - "Number of objects currently alive: 3\n", - "Total number of objects created: 3\n", - "Number of objects currently alive: 1\n", - "Total number of objects created: 5\n", - "Number of objects currently alive: 3\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example-account.cpp, Page- 403" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MoneyTransfer(self, acc , amount):\n", - " self._AccClass__balance=self._AccClass__balance-amount\n", - " acc._AccClass__balance=acc._AccClass__balance + amount\n", - "class AccClass:\n", - " __accno=int\n", - " __balance=float\n", - " def __init__(self, an=None, bal=0.0):\n", - " if isinstance(an, int):\n", - " self.accno=an\n", - " self.__balance=bal\n", - " else:\n", - " self.accno=raw_input(\"Enter account number for acc1 object: \")\n", - " self.__balance=float(raw_input(\"Enter the balance: \"))\n", - " def display(self):\n", - " print \"Acoount number is: \", self.accno\n", - " print \"Balance is: \", self.__balance\n", - " MoneyTransfer=MoneyTransfer\n", - "acc1=AccClass()\n", - "acc2=AccClass(10)\n", - "acc3=AccClass(20, 750.5)\n", - "print \"Acoount information...\"\n", - "acc1.display()\n", - "acc2.display()\n", - "acc3.display()\n", - "trans_money=float(raw_input(\"How much money is to be transferred from acc3 to acc1: \"))\n", - "acc3.MoneyTransfer(acc1, trans_money)\n", - "print \"Updated information about accounts...\"\n", - "acc1.display()\n", - "acc2.display()\n", - "acc3.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter account number for acc1 object: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the balance: 100\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Acoount information...\n", - "Acoount number is: 1\n", - "Balance is: 100.0\n", - "Acoount number is: 10\n", - "Balance is: 0.0\n", - "Acoount number is: 20\n", - "Balance is: 750.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How much money is to be transferred from acc3 to acc1: 200\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Updated information about accounts...\n", - "Acoount number is: 1\n", - "Balance is: 300.0\n", - "Acoount number is: 10\n", - "Balance is: 0.0\n", - "Acoount number is: 20\n", - "Balance is: 550.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-test2.cpp. Page- 405" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self, NameIn=None):\n", - " if isinstance(NameIn, str):\n", - " self.name=NameIn\n", - " print \"Test Object \", NameIn, \" created\"\n", - " else:\n", - " self.name=\"unnamed\"\n", - " print \"Test object 'unnamed' created\"\n", - "def __del__(self):\n", - " print \"Test Object \", self.name, \" destroyed\"\n", - " del self.name\n", - "class Test:\n", - " __name=[str]\n", - " __init__=__init__\n", - " __del__=__del__\n", - "g=Test(\"global\")\n", - "def func():\n", - " l=Test(\"func\")\n", - " print \"here's function func()\"\n", - "x=Test(\"main\")\n", - "func()\n", - "print \"main() function - termination\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Test Object global created\n", - "Test Object global destroyed\n", - "Test Object main created\n", - "Test Object main destroyed\n", - "Test Object func created\n", - "here's function func()\n", - "Test Object func destroyed\n", - "main() function - termination\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex1.cpp, Page- 407" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "def add (self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self, real_in=None, imag_in=0.0):\n", - " if isinstance(real_in, float):\n", - " self.__real=real_in\n", - " self.__imag=imag_in\n", - " else:\n", - " self.__real=self.__imag=0.0\n", - " def show(self, msg):\n", - " print msg, \n", - " print self.__real,\n", - " if self.__imag<0:\n", - " print \"-i\",\n", - " else:\n", - " print \"+i\",\n", - " print math.fabs(self.__imag) #print absolute value\n", - " add=add\n", - "c1=Complex(1.5,2.0)\n", - "c2=Complex(2.2)\n", - "c3=Complex()\n", - "c1.show(\"c1=\")\n", - "c2.show(\"c2=\")\n", - "c3=c1.add(c2)\n", - "c3.show(\"c3=c1.add(c2):\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c1= 1.5 +i 2.0\n", - "c2= 2.2 +i 0.0\n", - "c3=c1.add(c2): 3.7 +i 2.0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- noname.cpp, Page- 410" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class nameless:\n", - " __a=int\n", - " def __init__(self):\n", - " print \"Constructor\"\n", - " def __del__(self):\n", - " print \"Destructor\"\n", - "nameless() #nameless object created\n", - "n1=nameless()\n", - "n2=nameless()\n", - "print \"Program terminates\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor\n", - "Destructor\n", - "Constructor\n", - "Destructor\n", - "Constructor\n", - "Destructor\n", - "Program terminates\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-name.cpp, Page-411" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show(self, msg):\n", - " print msg\n", - " print \"First Name: \", self._name__first\n", - " if self._name__middle[0]:\n", - " print \"Middle Name: \", self._name__middle\n", - " if self._name__last[0]:\n", - " print \"Last Name: \", self._name__last\n", - "class name:\n", - " __first=[None]*15\n", - " __middle=[None]*15\n", - " __last=[None]*15\n", - " def __init__(self, FirstName=None, MiddleName=None, LastName=None):\n", - " if isinstance(LastName, str):\n", - " self.__last=LastName\n", - " self.__middle=MiddleName\n", - " self.__first=FirstName\n", - " elif isinstance(MiddleName, str):\n", - " self.__middle=MiddleName\n", - " self.__first=FirstName\n", - " elif isinstance(FirstName, str):\n", - " self.__first=FirstName\n", - " else:\n", - " self.__last='\\0' #initialized to NULL\n", - " self.__middle='\\0'\n", - " self.__first='\\0'\n", - " show=show\n", - "n1=name()\n", - "n2=name()\n", - "n3=name()\n", - "n1=name(\"Rajkumar\")\n", - "n2=name(\"Savithri\", \"S\")\n", - "n3=name(\"Veugopal\", \"K\", \"R\")\n", - "n1.show(\"First prson details...\")\n", - "n2.show(\"Second prson details...\")\n", - "n3.show(\"Third prson details...\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "First prson details...\n", - "First Name: Rajkumar\n", - "Second prson details...\n", - "First Name: Savithri\n", - "Middle Name: S\n", - "Third prson details...\n", - "First Name: Veugopal\n", - "Middle Name: K\n", - "Last Name: R\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector1.cpp, Page-413" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def read(self):\n", - " for i in range(self._vector__sz):\n", - " print \"Enter vector [\", i, \"]? \",\n", - " self._vector__v[i]=int(raw_input())\n", - "def show_sum(self):\n", - " Sum=0\n", - " for i in range(self._vector__sz):\n", - " Sum+=self._vector__v[i]\n", - " print \"Vector sum= \", Sum\n", - "class vector:\n", - " __v=[int] #array of type integer\n", - " __sz=int\n", - " def __init__(self, size):\n", - " self.__sz= size\n", - " self.__v=[int]*size #dynamically allocating size to integer array\n", - " def __del__(self):\n", - " del self.__v\n", - " read=read\n", - " show_sum=show_sum\n", - "count = int\n", - "count=int(raw_input(\"How many elements are there in the vector: \"))\n", - "v1= vector(count)\n", - "v1.read()\n", - "v1.show_sum()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many elements are there in the vector: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter vector [ 0 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 1 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 2 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 3 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 4 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Vector sum= 15\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector2.cpp, Page-415" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show(self):\n", - " for i in range(self._vector__size):\n", - " print self.elem(i), \", \",\n", - "class vector:\n", - " __v=[int]\n", - " __size=int\n", - " def __init__(self, vector_size):\n", - " if isinstance(vector_size, int):\n", - " self.__size= vector_size\n", - " self.__v=[int]*vector_size\n", - " else:\n", - " print \"Copy construcor invoked\"\n", - " self.__size=vector_size.__size\n", - " self.__v=[int]*vector_size.__size\n", - " for i in range(vector_size.__size):\n", - " self.__v[i]=vector_size.__v[i]\n", - " def elem(self,i):\n", - " if i>=self.__size:\n", - " print \"Error: Out of Range\"\n", - " return -1\n", - " return self.__v[i]\n", - " def __del__(self):\n", - " del self.__v\n", - " show=show\n", - "v1=vector(5)\n", - "v2=vector(5)\n", - "for i in range(5):\n", - " if v2.elem(i)!=-1:\n", - " v2._vector__v[i]=i+1\n", - "v1=v2\n", - "v3=vector(v2)\n", - "print \"Vector v1: \",\n", - "v1.show()\n", - "print \"\\nvector v2: \",\n", - "v2.show()\n", - "print \"\\nvector v3: \",\n", - "v3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Copy construcor invoked\n", - "Vector v1: 1 , 2 , 3 , 4 , 5 , \n", - "vector v2: 1 , 2 , 3 , 4 , 5 , \n", - "vector v3: 1 , 2 , 3 , 4 , 5 , \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-matrix.cpp, Page-418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "TRUE=1\n", - "FALSE=0\n", - "def __del__(self):\n", - " for i in range(self._matrix__MaxRow):\n", - " del self._matrix__p[i]\n", - " del self._matrix__p\n", - "def add(self, a, b):\n", - " self._matrix__MaxRow=a._matrix__MaxRow\n", - " self._matrix__MaxCol=a._matrix__MaxCol\n", - " if (a._matrix__MaxRow!=b._matrix__MaxRow)|(a._matrix__MaxCol!=b._matrix__MaxCol):\n", - " print \"Error: invalid matrix order for addition\"\n", - " return\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " self._matrix__p[i][j]=a._matrix__p[i][j]+b._matrix__p[i][j]\n", - "def sub(self, a, b):\n", - " self._matrix__MaxRow=a._matrix__MaxRow\n", - " self._matrix__MaxCol=a._matrix__MaxCol\n", - " if (a._matrix__MaxRow!=b._matrix__MaxRow)|(a._matrix__MaxCol!=b._matrix__MaxCol):\n", - " print \"Error: invalid matrix order for subtraction\"\n", - " return\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " self._matrix__p[i][j]=a._matrix__p[i][j]-b._matrix__p[i][j]\n", - "def mul(self, a, b):\n", - " self._matrix__MaxRow=a._matrix__MaxRow\n", - " self._matrix__MaxCol=a._matrix__MaxCol\n", - " if (a._matrix__MaxCol!=b._matrix__MaxRow):\n", - " print \"Error: invalid matrix order for multiplication\"\n", - " return\n", - " for i in range(a._matrix__MaxRow):\n", - " for j in range(b._matrix__MaxCol):\n", - " self._matrix__p[i][j]=0\n", - " for k in range(a._matrix__MaxCol):\n", - " self._matrix__p[i][j]+=a._matrix__p[i][j]*b._matrix__p[i][j]\n", - "def eql(self, b):\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " if self._matrix__p[i][i]!=b._matrix__p[i][j]:\n", - " return 0\n", - " return 1\n", - "def read(self):\n", - " self._matrix__p = []\n", - " for i in range(self._matrix__MaxRow):\n", - " self._matrix__p.append([])\n", - " for j in range(self._matrix__MaxCol):\n", - " print \"Matrix[%d,%d] =? \" %(i, j),\n", - " self._matrix__p[i].append(int(raw_input()))\n", - "def show(self):\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " print self._matrix__p[i][j], \" \",\n", - " print \"\"\n", - "class matrix:\n", - " __MaxRow=int\n", - " __MaxCol=int\n", - " __p=[int]\n", - " def __init__(self, row=0, col=0):\n", - " self.__MaxRow=row\n", - " self.__MaxCol=col\n", - " if row>0:\n", - " self.__p=[[int]*self.__MaxCol]*self.__MaxRow\n", - " __del__=__del__\n", - " read=read\n", - " show=show\n", - " add=add\n", - " sub=sub\n", - " mul=mul\n", - " eql=eql\n", - "print \"Enter Matrix A details...\"\n", - "m=int(raw_input(\"How many rows? \"))\n", - "n=int(raw_input(\"How many columns? \"))\n", - "a=matrix(m,n)\n", - "a.read()\n", - "print \"Enter Matrix B details...\"\n", - "p=int(raw_input(\"How many rows? \"))\n", - "q=int(raw_input(\"How many columns? \"))\n", - "b=matrix(p,q)\n", - "b.read()\n", - "print \"Matrix A is...\"\n", - "a.show()\n", - "print \"Matrix B is...\"\n", - "b.show()\n", - "c=matrix(m,n)\n", - "c.add(a,b)\n", - "print \"C=A+B...\"\n", - "c.show()\n", - "d=matrix(m,n)\n", - "d.sub(a,b)\n", - "print \"D=A-B...\"\n", - "d.show()\n", - "e=matrix(m,q)\n", - "e.mul(a,b)\n", - "print \"E=A*B...\"\n", - "e.show()\n", - "print \"(Is matrix A equal to matrix B)? \",\n", - "if(a.eql(b)):\n", - " print \"Yes\"\n", - "else:\n", - " print \"No\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Matrix A details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns? 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[0,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[0,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[0,2] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,2] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[2,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[2,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[2,2] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Matrix B details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns? 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[0,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[0,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[0,2] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,2] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[2,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[2,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[2,2] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix A is...\n", - "2 2 2 \n", - "2 2 2 \n", - "2 2 2 \n", - "Matrix B is...\n", - "1 1 1 \n", - "1 1 1 \n", - "1 1 1 \n", - "C=A+B...\n", - "3 3 3 \n", - "3 3 3 \n", - "3 3 3 \n", - "D=A-B...\n", - "1 1 1 \n", - "1 1 1 \n", - "1 1 1 \n", - "E=A*B...\n", - "6 6 6 \n", - "6 6 6 \n", - "6 6 6 \n", - "(Is matrix A equal to matrix B)? No\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-person.cpp, Page-423" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self, NameIn, AddressIn, PhoneIn):\n", - " self._Person__name=NameIn\n", - " self._Person__address=AddressIn\n", - " self._Person__phone=PhoneIn\n", - "#inline\n", - "def __del__(self):\n", - " del self._Person__name\n", - " del self._Person__address\n", - " del self._Person__phone\n", - "def getname(self):\n", - " return self._Person__name\n", - "def getaddress(self):\n", - " return self._Person__address\n", - "def getphone(self):\n", - " return self._Person__phone\n", - "def changename(self, NameIn):\n", - " if(self._Person__name):\n", - " del self._Person__name\n", - " self._Person__name=NameIn\n", - "class Person:\n", - " __name=[str]\n", - " __address=[str]\n", - " __phone=[str]\n", - " __init__=__init__\n", - " __del__=__del__\n", - " getname=getname\n", - " getaddress=getaddress\n", - " getphone=getphone\n", - " changename=changename\n", - "def printperson(p):\n", - " if(p.getname()):\n", - " print \"Name: \", p.getname()\n", - " if(p.getaddress()):\n", - " print \"Address: \", p.getaddress()\n", - " if(p.getphone()):\n", - " print \"Phone: \", p.getphone()\n", - "me=Person(\"Rajkumar\", \"E-mail: raj@cdabc.erne.in\", \"91-080-5584271\")\n", - "printperson(me)\n", - "you=Person(\"XYZ\", \"-not sure-\", \"-not sure-\")\n", - "print \"You XYZ by default...\"\n", - "printperson(you)\n", - "you.changename(\"ABC\")\n", - "print \"You changed XYZ to ABC...\"\n", - "printperson(you)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Rajkumar\n", - "Address: E-mail: raj@cdabc.erne.in\n", - "Phone: 91-080-5584271\n", - "You XYZ by default...\n", - "Name: XYZ\n", - "Address: -not sure-\n", - "Phone: -not sure-\n", - "You changed XYZ to ABC...\n", - "Name: ABC\n", - "Address: -not sure-\n", - "Phone: -not sure-\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-graph.cpp, Page-425" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self):\n", - " if(self._Graphics__nobjects[0]==False):\n", - " self._Graphics__setgraphicsmode()\n", - " self._Graphics__nobjects[0]+=1\n", - "def __del__(self):\n", - " self._Graphics__nobjects[0]-=1\n", - " if(self._Graphics__nobjects[0]==False):\n", - " self._Graphics__settextmode()\n", - "class Graphics:\n", - " __nobjects=[0]\n", - " def __setgraphicsmode(self):\n", - " pass\n", - " def __settextmode(self):\n", - " pass\n", - " __init__=__init__\n", - " __del__=__del__\n", - " def getcount(self):\n", - " return self.__nobjects[0]\n", - "def my_func():\n", - " obj=Graphics()\n", - " print \"No. of Graphics' objects while in my_func=\", obj.getcount()\n", - "obj1=Graphics()\n", - "print \"No. of Graphics' objects before in my_func=\", obj1.getcount()\n", - "my_func()\n", - "print \"No. of Graphics' objects after in my_func=\", obj1.getcount()\n", - "obj2=Graphics()\n", - "obj3=Graphics()\n", - "obj4=Graphics()\n", - "print \"Value of static member nobjects after all 3 more objects...\"\n", - "print \"In obj1= \", obj1.getcount()\n", - "print \"In obj2= \", obj2.getcount()\n", - "print \"In obj3= \", obj3.getcount()\n", - "print \"In obj4= \", obj4.getcount()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No. of Graphics' objects before in my_func= 1\n", - "No. of Graphics' objects while in my_func= 2\n", - "No. of Graphics' objects after in my_func= 1\n", - "Value of static member nobjects after all 3 more objects...\n", - "In obj1= 4\n", - "In obj2= 4\n", - "In obj3= 4\n", - "In obj4= 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page-428" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def distance(self, a, b):\n", - " self.x=a.x-b.x\n", - " self.y=a.y-b.y\n", - "def display(self):\n", - " print \"x= \",self.x\n", - " print \"y= \", self.y\n", - "class point:\n", - " __x=int\n", - " __y=int\n", - " def __init__(self, a=None, b=None):\n", - " if isinstance(a, int):\n", - " self.x=a\n", - " self.y=b\n", - " else:\n", - " self.x=self.y=0\n", - " def __del__(self):\n", - " pass\n", - " distance=distance\n", - " display=display\n", - "p1=point(40,18)\n", - "p2=point(12,9)\n", - "p3=point()\n", - "p3.distance(p1,p2)\n", - "print \"Coordinates of P1: \"\n", - "p1.display()\n", - "print \"Coordinates of P2: \"\n", - "p2.display()\n", - "print \"distance between P1 and P2: \"\n", - "p3.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Coordinates of P1: \n", - "x= 40\n", - "y= 18\n", - "Coordinates of P2: \n", - "x= 12\n", - "y= 9\n", - "distance between P1 and P2: \n", - "x= 28\n", - "y= 9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page-430" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def display(self):\n", - " print \"a =\", self.a,\n", - " print \"b =\", self.b\n", - "class data:\n", - " __a=int\n", - " __b=float\n", - " def __init__(self, x=None, y=None):\n", - " if isinstance(x, int):\n", - " self.a=x\n", - " self.b=y\n", - " elif isinstance(x, data):\n", - " self.a=x.a\n", - " self.b=x.b\n", - " else:\n", - " self.a=0\n", - " self.b=0\n", - " display=display\n", - "d1=data()\n", - "d2=data(12,9.9)\n", - "d3=data(d2)\n", - "print \"For default constructor: \"\n", - "d1.display()\n", - "print\"For parameterized constructor: \"\n", - "d2.display()\n", - "print \"For Copy Constructor: \"\n", - "d3.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "For default constructor: \n", - "a = 0 b = 0\n", - "For parameterized constructor: \n", - "a = 12 b = 9.9\n", - "For Copy Constructor: \n", - "a = 12 b = 9.9\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up_1.ipynb deleted file mode 100755 index e8f510a1..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter11-ObjectInitializationAndClean-Up_1.ipynb +++ /dev/null @@ -1,1781 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:daf00031bcc29ced764c693239a5bacfba6d7f22c75e738fbcf7b0290dee3513" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 11: Object Initialization and clean up" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- bag.cpp, Page-392" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_ITEMS=25\n", - "def show(self):\n", - " for i in range(self.ItemCount):\n", - " print self._Bag__contents[i],\n", - "class Bag:\n", - " __contents=[int]*MAX_ITEMS\n", - " __ItemCount=int\n", - " def SetEmpty(self):\n", - " self.ItemCount=0\n", - " def put(self,item):\n", - " self._Bag__contents[self.ItemCount]=item\n", - " self.ItemCount+=1\n", - " show=show\n", - "bag=Bag() #object of class Bag\n", - "bag.SetEmpty() #initialize the object\n", - "while 1:\n", - " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", - " if item==0:\n", - " break\n", - " bag.put(item)\n", - " print \"Items in bag:\",\n", - " bag.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in bag: 1" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3 2" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3 2 4" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- newbag.cpp, Page-395" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_ITEMS=25 #size of array contents\n", - "def show(self):\n", - " for i in range(self.ItemCount):\n", - " print self._Bag__contents[i],\n", - "class Bag:\n", - " __contents=[int]*MAX_ITEMS #int 1D array\n", - " __ItemCount=int\n", - " def __init__(self): #Constructor\n", - " self.ItemCount=0\n", - " def put(self,item): #member function defined inside the class\n", - " self._Bag__contents[self.ItemCount]=item\n", - " self.ItemCount+=1\n", - " show=show #member function defined outside the class\n", - "bag=Bag() #object of class Bag\n", - "while 1:\n", - " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", - " if item==0:\n", - " break\n", - " bag.put(item)\n", - " print \"Items in bag:\",\n", - " bag.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in bag: 1" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3 2" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3 2 4" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-test1.cpp, Page-396" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self):\n", - " print \"Constructor of class test called\"\n", - "class Test:\n", - " __init__=__init__ #Constructor\n", - "G=Test()\n", - "def func():\n", - " L=Test()\n", - " print \"Here's function func()\"\n", - "X=Test()\n", - "print \"main() function\"\n", - "func()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor of class test called\n", - "Constructor of class test called\n", - "main() function\n", - "Constructor of class test called\n", - "Here's function func()\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- giftbag.cpp, Page- 398" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_ITEMS=25\n", - "def show(self):\n", - " if self.ItemCount:\n", - " for i in range(self.ItemCount):\n", - " print self._Bag__contents[i],\n", - " else:\n", - " print \"Nil\"\n", - "class Bag:\n", - " __contents=[int]*MAX_ITEMS\n", - " __ItemCount=int\n", - " def __init__(self, item=None): #parameterized constructor: Python does not support overloading of functions\n", - " if isinstance(item, int):\n", - " self._Bag__contents[0]=item\n", - " self.ItemCount=1\n", - " else:\n", - " self.ItemCount=0\n", - " def put(self,item):\n", - " self._Bag__contents[self.ItemCount]=item\n", - " self.ItemCount+=1\n", - " show=show\n", - "bag1=Bag()\n", - "bag2=Bag(4) #object created using the parameterized constructor\n", - "print \"Gifted bag1 initially has:\",\n", - "bag1.show()\n", - "print \"Gifted bag2 initially has:\",\n", - "bag2.show()\n", - "while 1:\n", - " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", - " if item==0:\n", - " break\n", - " bag2.put(item)\n", - " print \"Items in bag2:\",\n", - " bag2.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Gifted bag1 initially has: Nil\n", - "Gifted bag2 initially has: 4" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag2: 4 1" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag2: 4 1 2" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag2: 4 1 2 3" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-test.cpp, Page-400 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self):\n", - " print \"Constructor of class Test called\"\n", - "def __del__(self):\n", - " print \"Destructor of class Test called\"\n", - "class Test:\n", - " __init__=__init__ #Constructor\n", - " __del__=__del__ #Destructor\n", - "x=Test()\n", - "print \"Terminating main\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor of class Test called\n", - "Destructor of class Test called\n", - "Terminating main\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-count.cpp, Page-401" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "nobjects=0\n", - "nobj_alive=0\n", - "class MyClass:\n", - " def __init__(self):\n", - " global nobjects #using the global nobjects\n", - " global nobj_alive #using the global nobj_alive\n", - " nobjects+=1\n", - " nobj_alive+=1\n", - " def __del__(self):\n", - " global nobj_alive #using the global nobjects\n", - " nobj_alive-=1\n", - " def show(self):\n", - " global nobjects\n", - " global nobj_alive\n", - " print \"Total number of objects created: \", nobjects\n", - " print \"Number of objects currently alive: \", nobj_alive\n", - "obj1=MyClass()\n", - "obj1.show()\n", - "def func():\n", - " obj1=MyClass()\n", - " obj2=MyClass()\n", - " obj2.show()\n", - " del obj1\n", - " del obj2\n", - "func()\n", - "obj1.show()\n", - "obj2=MyClass()\n", - "obj3=MyClass()\n", - "obj2.show()\n", - "del obj1\n", - "del obj2\n", - "del obj3" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total number of objects created: 1\n", - "Number of objects currently alive: 1\n", - "Total number of objects created: 3\n", - "Number of objects currently alive: 3\n", - "Total number of objects created: 3\n", - "Number of objects currently alive: 1\n", - "Total number of objects created: 5\n", - "Number of objects currently alive: 3\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-account.cpp, Page- 403" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MoneyTransfer(self, acc , amount):\n", - " self._AccClass__balance=self._AccClass__balance-amount\n", - " acc._AccClass__balance=acc._AccClass__balance + amount\n", - "class AccClass:\n", - " __accno=int\n", - " __balance=float\n", - " def __init__(self, an=None, bal=0.0):\n", - " if isinstance(an, int):\n", - " self.accno=an\n", - " self.__balance=bal\n", - " else:\n", - " self.accno=raw_input(\"Enter account number for acc1 object: \")\n", - " self.__balance=float(raw_input(\"Enter the balance: \"))\n", - " def display(self):\n", - " print \"Acoount number is: \", self.accno\n", - " print \"Balance is: \", self.__balance\n", - " MoneyTransfer=MoneyTransfer\n", - "acc1=AccClass()\n", - "acc2=AccClass(10)\n", - "acc3=AccClass(20, 750.5)\n", - "print \"Acoount information...\"\n", - "acc1.display()\n", - "acc2.display()\n", - "acc3.display()\n", - "trans_money=float(raw_input(\"How much money is to be transferred from acc3 to acc1: \"))\n", - "acc3.MoneyTransfer(acc1, trans_money)\n", - "print \"Updated information about accounts...\"\n", - "acc1.display()\n", - "acc2.display()\n", - "acc3.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter account number for acc1 object: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the balance: 100\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Acoount information...\n", - "Acoount number is: 1\n", - "Balance is: 100.0\n", - "Acoount number is: 10\n", - "Balance is: 0.0\n", - "Acoount number is: 20\n", - "Balance is: 750.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How much money is to be transferred from acc3 to acc1: 200\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Updated information about accounts...\n", - "Acoount number is: 1\n", - "Balance is: 300.0\n", - "Acoount number is: 10\n", - "Balance is: 0.0\n", - "Acoount number is: 20\n", - "Balance is: 550.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-test2.cpp. Page- 405" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self, NameIn=None):\n", - " if isinstance(NameIn, str):\n", - " self.name=NameIn\n", - " print \"Test Object \", NameIn, \" created\"\n", - " else:\n", - " self.name=\"unnamed\"\n", - " print \"Test object 'unnamed' created\"\n", - "def __del__(self):\n", - " print \"Test Object \", self.name, \" destroyed\"\n", - " del self.name\n", - "class Test:\n", - " __name=[str]\n", - " __init__=__init__\n", - " __del__=__del__\n", - "g=Test(\"global\")\n", - "def func():\n", - " l=Test(\"func\")\n", - " print \"here's function func()\"\n", - "x=Test(\"main\")\n", - "func()\n", - "print \"main() function - termination\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Test Object global created\n", - "Test Object global destroyed\n", - "Test Object main created\n", - "Test Object main destroyed\n", - "Test Object func created\n", - "here's function func()\n", - "Test Object func destroyed\n", - "main() function - termination\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex1.cpp, Page- 407" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "def add (self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self, real_in=None, imag_in=0.0):\n", - " if isinstance(real_in, float):\n", - " self.__real=real_in\n", - " self.__imag=imag_in\n", - " else:\n", - " self.__real=self.__imag=0.0\n", - " def show(self, msg):\n", - " print msg, \n", - " print self.__real,\n", - " if self.__imag<0:\n", - " print \"-i\",\n", - " else:\n", - " print \"+i\",\n", - " print math.fabs(self.__imag) #print absolute value\n", - " add=add\n", - "c1=Complex(1.5,2.0)\n", - "c2=Complex(2.2)\n", - "c3=Complex()\n", - "c1.show(\"c1=\")\n", - "c2.show(\"c2=\")\n", - "c3=c1.add(c2)\n", - "c3.show(\"c3=c1.add(c2):\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c1= 1.5 +i 2.0\n", - "c2= 2.2 +i 0.0\n", - "c3=c1.add(c2): 3.7 +i 2.0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- noname.cpp, Page- 410" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class nameless:\n", - " __a=int\n", - " def __init__(self):\n", - " print \"Constructor\"\n", - " def __del__(self):\n", - " print \"Destructor\"\n", - "nameless() #nameless object created\n", - "n1=nameless()\n", - "n2=nameless()\n", - "print \"Program terminates\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor\n", - "Destructor\n", - "Constructor\n", - "Destructor\n", - "Constructor\n", - "Destructor\n", - "Program terminates\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-name.cpp, Page-411" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show(self, msg):\n", - " print msg\n", - " print \"First Name: \", self._name__first\n", - " if self._name__middle[0]:\n", - " print \"Middle Name: \", self._name__middle\n", - " if self._name__last[0]:\n", - " print \"Last Name: \", self._name__last\n", - "class name:\n", - " __first=[None]*15\n", - " __middle=[None]*15\n", - " __last=[None]*15\n", - " def __init__(self, FirstName=None, MiddleName=None, LastName=None):\n", - " if isinstance(LastName, str):\n", - " self.__last=LastName\n", - " self.__middle=MiddleName\n", - " self.__first=FirstName\n", - " elif isinstance(MiddleName, str):\n", - " self.__middle=MiddleName\n", - " self.__first=FirstName\n", - " elif isinstance(FirstName, str):\n", - " self.__first=FirstName\n", - " else:\n", - " self.__last='\\0' #initialized to NULL\n", - " self.__middle='\\0'\n", - " self.__first='\\0'\n", - " show=show\n", - "n1=name()\n", - "n2=name()\n", - "n3=name()\n", - "n1=name(\"Rajkumar\")\n", - "n2=name(\"Savithri\", \"S\")\n", - "n3=name(\"Veugopal\", \"K\", \"R\")\n", - "n1.show(\"First prson details...\")\n", - "n2.show(\"Second prson details...\")\n", - "n3.show(\"Third prson details...\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "First prson details...\n", - "First Name: Rajkumar\n", - "Second prson details...\n", - "First Name: Savithri\n", - "Middle Name: S\n", - "Third prson details...\n", - "First Name: Veugopal\n", - "Middle Name: K\n", - "Last Name: R\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector1.cpp, Page-413" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def read(self):\n", - " for i in range(self._vector__sz):\n", - " print \"Enter vector [\", i, \"]? \",\n", - " self._vector__v[i]=int(raw_input())\n", - "def show_sum(self):\n", - " Sum=0\n", - " for i in range(self._vector__sz):\n", - " Sum+=self._vector__v[i]\n", - " print \"Vector sum= \", Sum\n", - "class vector:\n", - " __v=[int] #array of type integer\n", - " __sz=int\n", - " def __init__(self, size):\n", - " self.__sz= size\n", - " self.__v=[int]*size #dynamically allocating size to integer array\n", - " def __del__(self):\n", - " del self.__v\n", - " read=read\n", - " show_sum=show_sum\n", - "count = int\n", - "count=int(raw_input(\"How many elements are there in the vector: \"))\n", - "v1= vector(count)\n", - "v1.read()\n", - "v1.show_sum()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many elements are there in the vector: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter vector [ 0 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 1 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 2 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 3 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 4 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Vector sum= 15\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector2.cpp, Page-415" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show(self):\n", - " for i in range(self._vector__size):\n", - " print self.elem(i), \", \",\n", - "class vector:\n", - " __v=[int]\n", - " __size=int\n", - " def __init__(self, vector_size):\n", - " if isinstance(vector_size, int):\n", - " self.__size= vector_size\n", - " self.__v=[int]*vector_size\n", - " else:\n", - " print \"Copy construcor invoked\"\n", - " self.__size=vector_size.__size\n", - " self.__v=[int]*vector_size.__size\n", - " for i in range(vector_size.__size):\n", - " self.__v[i]=vector_size.__v[i]\n", - " def elem(self,i):\n", - " if i>=self.__size:\n", - " print \"Error: Out of Range\"\n", - " return -1\n", - " return self.__v[i]\n", - " def __del__(self):\n", - " del self.__v\n", - " show=show\n", - "v1=vector(5)\n", - "v2=vector(5)\n", - "for i in range(5):\n", - " if v2.elem(i)!=-1:\n", - " v2._vector__v[i]=i+1\n", - "v1=v2\n", - "v3=vector(v2)\n", - "print \"Vector v1: \",\n", - "v1.show()\n", - "print \"\\nvector v2: \",\n", - "v2.show()\n", - "print \"\\nvector v3: \",\n", - "v3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Copy construcor invoked\n", - "Vector v1: 1 , 2 , 3 , 4 , 5 , \n", - "vector v2: 1 , 2 , 3 , 4 , 5 , \n", - "vector v3: 1 , 2 , 3 , 4 , 5 , \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-matrix.cpp, Page-418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "TRUE=1\n", - "FALSE=0\n", - "def __del__(self):\n", - " for i in range(self._matrix__MaxRow):\n", - " del self._matrix__p[i]\n", - " del self._matrix__p\n", - "def add(self, a, b):\n", - " self._matrix__MaxRow=a._matrix__MaxRow\n", - " self._matrix__MaxCol=a._matrix__MaxCol\n", - " if (a._matrix__MaxRow!=b._matrix__MaxRow)|(a._matrix__MaxCol!=b._matrix__MaxCol):\n", - " print \"Error: invalid matrix order for addition\"\n", - " return\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " self._matrix__p[i][j]=a._matrix__p[i][j]+b._matrix__p[i][j]\n", - "def sub(self, a, b):\n", - " self._matrix__MaxRow=a._matrix__MaxRow\n", - " self._matrix__MaxCol=a._matrix__MaxCol\n", - " if (a._matrix__MaxRow!=b._matrix__MaxRow)|(a._matrix__MaxCol!=b._matrix__MaxCol):\n", - " print \"Error: invalid matrix order for subtraction\"\n", - " return\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " self._matrix__p[i][j]=a._matrix__p[i][j]-b._matrix__p[i][j]\n", - "def mul(self, a, b):\n", - " self._matrix__MaxRow=a._matrix__MaxRow\n", - " self._matrix__MaxCol=a._matrix__MaxCol\n", - " if (a._matrix__MaxCol!=b._matrix__MaxRow):\n", - " print \"Error: invalid matrix order for multiplication\"\n", - " return\n", - " for i in range(a._matrix__MaxRow):\n", - " for j in range(b._matrix__MaxCol):\n", - " self._matrix__p[i][j]=0\n", - " for k in range(a._matrix__MaxCol):\n", - " self._matrix__p[i][j]+=a._matrix__p[i][j]*b._matrix__p[i][j]\n", - "def eql(self, b):\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " if self._matrix__p[i][i]!=b._matrix__p[i][j]:\n", - " return 0\n", - " return 1\n", - "def read(self):\n", - " self._matrix__p = []\n", - " for i in range(self._matrix__MaxRow):\n", - " self._matrix__p.append([])\n", - " for j in range(self._matrix__MaxCol):\n", - " print \"Matrix[%d,%d] =? \" %(i, j),\n", - " self._matrix__p[i].append(int(raw_input()))\n", - "def show(self):\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " print self._matrix__p[i][j], \" \",\n", - " print \"\"\n", - "class matrix:\n", - " __MaxRow=int\n", - " __MaxCol=int\n", - " __p=[int]\n", - " def __init__(self, row=0, col=0):\n", - " self.__MaxRow=row\n", - " self.__MaxCol=col\n", - " if row>0:\n", - " self.__p=[[int]*self.__MaxCol]*self.__MaxRow\n", - " __del__=__del__\n", - " read=read\n", - " show=show\n", - " add=add\n", - " sub=sub\n", - " mul=mul\n", - " eql=eql\n", - "print \"Enter Matrix A details...\"\n", - "m=int(raw_input(\"How many rows? \"))\n", - "n=int(raw_input(\"How many columns? \"))\n", - "a=matrix(m,n)\n", - "a.read()\n", - "print \"Enter Matrix B details...\"\n", - "p=int(raw_input(\"How many rows? \"))\n", - "q=int(raw_input(\"How many columns? \"))\n", - "b=matrix(p,q)\n", - "b.read()\n", - "print \"Matrix A is...\"\n", - "a.show()\n", - "print \"Matrix B is...\"\n", - "b.show()\n", - "c=matrix(m,n)\n", - "c.add(a,b)\n", - "print \"C=A+B...\"\n", - "c.show()\n", - "d=matrix(m,n)\n", - "d.sub(a,b)\n", - "print \"D=A-B...\"\n", - "d.show()\n", - "e=matrix(m,q)\n", - "e.mul(a,b)\n", - "print \"E=A*B...\"\n", - "e.show()\n", - "print \"(Is matrix A equal to matrix B)? \",\n", - "if(a.eql(b)):\n", - " print \"Yes\"\n", - "else:\n", - " print \"No\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Matrix A details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns? 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[0,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[0,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[0,2] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,2] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[2,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[2,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[2,2] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Matrix B details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns? 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[0,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[0,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[0,2] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,2] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[2,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[2,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[2,2] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix A is...\n", - "2 2 2 \n", - "2 2 2 \n", - "2 2 2 \n", - "Matrix B is...\n", - "1 1 1 \n", - "1 1 1 \n", - "1 1 1 \n", - "C=A+B...\n", - "3 3 3 \n", - "3 3 3 \n", - "3 3 3 \n", - "D=A-B...\n", - "1 1 1 \n", - "1 1 1 \n", - "1 1 1 \n", - "E=A*B...\n", - "6 6 6 \n", - "6 6 6 \n", - "6 6 6 \n", - "(Is matrix A equal to matrix B)? No\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-person.cpp, Page-423" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self, NameIn, AddressIn, PhoneIn):\n", - " self._Person__name=NameIn\n", - " self._Person__address=AddressIn\n", - " self._Person__phone=PhoneIn\n", - "#inline\n", - "def __del__(self):\n", - " del self._Person__name\n", - " del self._Person__address\n", - " del self._Person__phone\n", - "def getname(self):\n", - " return self._Person__name\n", - "def getaddress(self):\n", - " return self._Person__address\n", - "def getphone(self):\n", - " return self._Person__phone\n", - "def changename(self, NameIn):\n", - " if(self._Person__name):\n", - " del self._Person__name\n", - " self._Person__name=NameIn\n", - "class Person:\n", - " __name=[str]\n", - " __address=[str]\n", - " __phone=[str]\n", - " __init__=__init__\n", - " __del__=__del__\n", - " getname=getname\n", - " getaddress=getaddress\n", - " getphone=getphone\n", - " changename=changename\n", - "def printperson(p):\n", - " if(p.getname()):\n", - " print \"Name: \", p.getname()\n", - " if(p.getaddress()):\n", - " print \"Address: \", p.getaddress()\n", - " if(p.getphone()):\n", - " print \"Phone: \", p.getphone()\n", - "me=Person(\"Rajkumar\", \"E-mail: raj@cdabc.erne.in\", \"91-080-5584271\")\n", - "printperson(me)\n", - "you=Person(\"XYZ\", \"-not sure-\", \"-not sure-\")\n", - "print \"You XYZ by default...\"\n", - "printperson(you)\n", - "you.changename(\"ABC\")\n", - "print \"You changed XYZ to ABC...\"\n", - "printperson(you)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Rajkumar\n", - "Address: E-mail: raj@cdabc.erne.in\n", - "Phone: 91-080-5584271\n", - "You XYZ by default...\n", - "Name: XYZ\n", - "Address: -not sure-\n", - "Phone: -not sure-\n", - "You changed XYZ to ABC...\n", - "Name: ABC\n", - "Address: -not sure-\n", - "Phone: -not sure-\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-graph.cpp, Page-425" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self):\n", - " if(self._Graphics__nobjects[0]==False):\n", - " self._Graphics__setgraphicsmode()\n", - " self._Graphics__nobjects[0]+=1\n", - "def __del__(self):\n", - " self._Graphics__nobjects[0]-=1\n", - " if(self._Graphics__nobjects[0]==False):\n", - " self._Graphics__settextmode()\n", - "class Graphics:\n", - " __nobjects=[0]\n", - " def __setgraphicsmode(self):\n", - " pass\n", - " def __settextmode(self):\n", - " pass\n", - " __init__=__init__\n", - " __del__=__del__\n", - " def getcount(self):\n", - " return self.__nobjects[0]\n", - "def my_func():\n", - " obj=Graphics()\n", - " print \"No. of Graphics' objects while in my_func=\", obj.getcount()\n", - "obj1=Graphics()\n", - "print \"No. of Graphics' objects before in my_func=\", obj1.getcount()\n", - "my_func()\n", - "print \"No. of Graphics' objects after in my_func=\", obj1.getcount()\n", - "obj2=Graphics()\n", - "obj3=Graphics()\n", - "obj4=Graphics()\n", - "print \"Value of static member nobjects after all 3 more objects...\"\n", - "print \"In obj1= \", obj1.getcount()\n", - "print \"In obj2= \", obj2.getcount()\n", - "print \"In obj3= \", obj3.getcount()\n", - "print \"In obj4= \", obj4.getcount()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No. of Graphics' objects before in my_func= 1\n", - "No. of Graphics' objects while in my_func= 2\n", - "No. of Graphics' objects after in my_func= 1\n", - "Value of static member nobjects after all 3 more objects...\n", - "In obj1= 4\n", - "In obj2= 4\n", - "In obj3= 4\n", - "In obj4= 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page-428" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def distance(self, a, b):\n", - " self.x=a.x-b.x\n", - " self.y=a.y-b.y\n", - "def display(self):\n", - " print \"x= \",self.x\n", - " print \"y= \", self.y\n", - "class point:\n", - " __x=int\n", - " __y=int\n", - " def __init__(self, a=None, b=None):\n", - " if isinstance(a, int):\n", - " self.x=a\n", - " self.y=b\n", - " else:\n", - " self.x=self.y=0\n", - " def __del__(self):\n", - " pass\n", - " distance=distance\n", - " display=display\n", - "p1=point(40,18)\n", - "p2=point(12,9)\n", - "p3=point()\n", - "p3.distance(p1,p2)\n", - "print \"Coordinates of P1: \"\n", - "p1.display()\n", - "print \"Coordinates of P2: \"\n", - "p2.display()\n", - "print \"distance between P1 and P2: \"\n", - "p3.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Coordinates of P1: \n", - "x= 40\n", - "y= 18\n", - "Coordinates of P2: \n", - "x= 12\n", - "y= 9\n", - "distance between P1 and P2: \n", - "x= 28\n", - "y= 9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page-430" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def display(self):\n", - " print \"a =\", self.a,\n", - " print \"b =\", self.b\n", - "class data:\n", - " __a=int\n", - " __b=float\n", - " def __init__(self, x=None, y=None):\n", - " if isinstance(x, int):\n", - " self.a=x\n", - " self.b=y\n", - " elif isinstance(x, data):\n", - " self.a=x.a\n", - " self.b=x.b\n", - " else:\n", - " self.a=0\n", - " self.b=0\n", - " display=display\n", - "d1=data()\n", - "d2=data(12,9.9)\n", - "d3=data(d2)\n", - "print \"For default constructor: \"\n", - "d1.display()\n", - "print\"For parameterized constructor: \"\n", - "d2.display()\n", - "print \"For Copy Constructor: \"\n", - "d3.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "For default constructor: \n", - "a = 0 b = 0\n", - "For parameterized constructor: \n", - "a = 12 b = 9.9\n", - "For Copy Constructor: \n", - "a = 12 b = 9.9\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects.ipynb deleted file mode 100755 index 2c56060d..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects.ipynb +++ /dev/null @@ -1,1590 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:dd08d35ee9767f23c09f2b0ea16b1cee00b60ac3967c95c41f4ba5d0c6e14cf0" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 12-Dynamic Objects" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ptrobj1.cpp, Page no-435" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class someclass(Structure):\n", - " data1=int\n", - " data2=chr\n", - " def __init__(self):\n", - " print 'Constructor someclass() is invoked'\n", - " self.data1=1\n", - " self.data2='A'\n", - " def __del__(self):\n", - " print 'Destructor ~someclass() is invoked'\n", - " def show(self):\n", - " print 'data1 =', self.data1,\n", - " print 'data2 =', self.data2\n", - "object1=someclass() #object of class someclass\n", - "ptr=POINTER(someclass) #pointer of type class someclass\n", - "ptr=object1 #pointer pointing to object of class someclass\n", - "print \"Accessing object through object1.show()...\"\n", - "object1.show()\n", - "print \"Accessing object through ptr->show()...\"\n", - "ptr.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor someclass() is invoked\n", - "Destructor ~someclass() is invoked\n", - "Accessing object through object1.show()...\n", - "data1 = 1 data2 = A\n", - "Accessing object through ptr->show()...\n", - "data1 = 1 data2 = A\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ptrobj2.cpp, Page no-437" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class someclass(Structure):\n", - " data1=int\n", - " data2=chr\n", - " def __init__(self):\n", - " print 'Constructor someclass() is invoked'\n", - " self.data1=1\n", - " self.data2='A'\n", - " def __del__(self):\n", - " print 'Destructor ~someclass() is invoked'\n", - " def show(self):\n", - " print 'data1 =', self.data1,\n", - " print 'data2 =', self.data2\n", - "object1=someclass()\n", - "ptr=POINTER(someclass)\n", - "ptr=object1\n", - "print \"Accessing object through object1.show()...\"\n", - "ptr.show()\n", - "print \"Destroying dynamic object...\"\n", - "del ptr" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor someclass() is invoked\n", - "Destructor ~someclass() is invoked\n", - "Accessing object through object1.show()...\n", - "data1 = 1 data2 = A\n", - "Destroying dynamic object...\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-useref.cpp, Page no-439" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "t1=POINTER(c_int)\n", - "t1=c_int(5)\n", - "t3=c_int(5)\n", - "t2=c_int(10)\n", - "t1.value=t1.value+t2.value\n", - "print \"Sum of\", t3.value,\n", - "print \"and\", t2.value, \n", - "print \"is:\", t1.value" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of 5 and 10 is: 15\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-refobj.cpp, Page no-440" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class student(Structure):\n", - " __roll_no=int\n", - " __name=str\n", - " def setdata(self, roll_no_in, name_in):\n", - " self.__roll_no=roll_no_in\n", - " self.__name=name_in\n", - " def outdata(self):\n", - " print \"Roll No =\", self.__roll_no\n", - " print \"Name =\", self.__name\n", - "s1=student()\n", - "s1.setdata(1, \"Savithri\")\n", - "s1.outdata()\n", - "s2=student()\n", - "s2.setdata(2, \"Bhavani\")\n", - "s2.outdata()\n", - "s3=student()\n", - "s3.setdata(3, \"Vani\")\n", - "s4=s3\n", - "s3.outdata()\n", - "s4.outdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll No = 1\n", - "Name = Savithri\n", - "Roll No = 2\n", - "Name = Bhavani\n", - "Roll No = 3\n", - "Name = Vani\n", - "Roll No = 3\n", - "Name = Vani\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student3.cpp, Page no-442" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class student:\n", - " __roll_no=int\n", - " __name=str\n", - " def __init__(self, roll_no_in=None, name_in=None):\n", - " if isinstance(roll_no_in, int):\n", - " self.__roll_no=roll_no_in\n", - " if isinstance(name_in, str):\n", - " self.__name=name_in\n", - " else:\n", - " flag=raw_input(\"Do you want to initialize the object (y/n): \")\n", - " if flag=='y' or flag=='Y':\n", - " self.__roll_no=int(raw_input(\"Enter Roll no. of student: \"))\n", - " Str=raw_input(\"Enter Name of student: \")\n", - " self.__name=Str\n", - " else:\n", - " self.__roll_no=0\n", - " self.__name=None\n", - " def __del__(self):\n", - " if isinstance(self.__name, str):\n", - " del self.__name\n", - " def Set(self):\n", - " student(roll_no_in, name_in)\n", - " def show(self):\n", - " if self.__roll_no:\n", - " print \"Roll No:\", self.__roll_no\n", - " else:\n", - " print \"Roll No: (not initialized)\"\n", - " if isinstance(self.__name, str):\n", - " print \"Name: \", self.__name\n", - " else:\n", - " print \"Name: (not initialized)\"\n", - "s1=student()\n", - "s2=student()\n", - "s3=student(1)\n", - "s4=student(2, \"Bhavani\")\n", - "print \"Live objects contents...\"\n", - "s1.show()\n", - "s2.show()\n", - "s3.show()\n", - "s4.show()\n", - "del s1\n", - "del s2\n", - "del s3\n", - "del s4" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Do you want to initialize the object (y/n): n\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Do you want to initialize the object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Roll no. of student: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name of student: Rekha\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Live objects contents...\n", - "Roll No: (not initialized)\n", - "Name: (not initialized)\n", - "Roll No: 5\n", - "Name: Rekha\n", - "Roll No: 1\n", - "Name: (not initialized)\n", - "Roll No: 2\n", - "Name: Bhavani\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student1.cpp, Page-445" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class student:\n", - " __roll_no=int\n", - " __name=str\n", - " def setdata(self, roll_no_in, name_in):\n", - " self.__roll_no=roll_no_in\n", - " self.__name=name_in\n", - " def outdata(self):\n", - " print \"Roll No =\", self.__roll_no\n", - " print \"Name =\", self.__name\n", - "s=[]*10 #array of objects\n", - "count=0\n", - "for i in range(10):\n", - " s.append(student())\n", - "for i in range(10):\n", - " response=raw_input(\"Initialize student object (y/n): \")\n", - " if response=='y' or response=='Y':\n", - " roll_no=int(raw_input(\"Enter a Roll no. of student: \"))\n", - " name=raw_input(\"Enter name of student: \")\n", - " s[i].setdata(roll_no, name)\n", - " count+=1\n", - " else:\n", - " break\n", - "print \"Student Details...\"\n", - "for i in range(count):\n", - " s[i].outdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Initialize student object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a Roll no. of student: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of student: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Initialize student object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a Roll no. of student: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of student: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Initialize student object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a Roll no. of student: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of student: Savithri\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Initialize student object (y/n): n\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Details...\n", - "Roll No = 1\n", - "Name = Rajkumar\n", - "Roll No = 2\n", - "Name = Tejaswi\n", - "Roll No = 3\n", - "Name = Savithri\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student2.cpp, Page no-447" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class student(Structure):\n", - " __roll_no=int\n", - " __name=str\n", - " def setdata(self, roll_no_in, name_in):\n", - " self.__roll_no=roll_no_in\n", - " self.__name=name_in\n", - " def outdata(self):\n", - " print \"Roll No =\", self.__roll_no\n", - " print \"Name =\", self.__name\n", - "temp=[]*10\n", - "s=POINTER(student) \n", - "count=0\n", - "for i in range(10):\n", - " temp.append(student())\n", - "s=temp #pointer to array of objects\n", - "for i in range(10):\n", - " response=raw_input(\"Create student object (y/n): \")\n", - " if response=='y' or response=='Y':\n", - " roll_no=int(raw_input(\"Enter a Roll no. of student: \"))\n", - " name=raw_input(\"Enter name of student: \")\n", - " s[i].setdata(roll_no, name)\n", - " count+=1\n", - " else:\n", - " break\n", - "print \"Student Details...\"\n", - "for i in range(count):\n", - " s[i].outdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Create student object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a Roll no. of student: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of student: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Create student object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a Roll no. of student: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of student: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Create student object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a Roll no. of student: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of student: Savithri\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Create student object (y/n): n\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Details...\n", - "Roll No = 1\n", - "Name = Rajkumar\n", - "Roll No = 2\n", - "Name = Tejaswi\n", - "Roll No = 3\n", - "Name = Savithri\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ptrmemb.cpp, Page no-452" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " __y=int\n", - " a=int\n", - " b=int\n", - " def init(self, z):\n", - " self.a=z\n", - " return z\n", - "obj=X()\n", - "ip=X.a #pointer to data member\n", - "obj.ip=10 #access through object\n", - "print \"a in obj after obj.*ip = 10 is\", obj.ip\n", - "pobj=[obj] #pointer to object of class X\n", - "pobj[0].ip=10 #access through object pointer\n", - "print \"a in obj after pobj->*ip = 10 is\", pobj[0].ip\n", - "ptr_init=X.init #pointer to member function\n", - "ptr_init(obj,5) #access through object\n", - "print \"a in obj after (obj.*ptr_init)(5) =\", obj.a\n", - "ptr_init(pobj[0],5) #access through object pointer\n", - "print \"a in obj after (pobj->*ptr_init)(5) =\", obj.a" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "a in obj after obj.*ip = 10 is 10\n", - "a in obj after pobj->*ip = 10 is 10\n", - "a in obj after (obj.*ptr_init)(5) = 5\n", - "a in obj after (pobj->*ptr_init)(5) = 5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-friend.cpp, Page no-454" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X():\n", - " __a=int\n", - " __b=int\n", - " def __init__(self):\n", - " self.__a=0\n", - " self.__b=0\n", - " def SetMembers(self, a1, b1):\n", - " self.__a=a1\n", - " self.__b=b1\n", - "def sum(objx):\n", - " pa=[X._X__a]\n", - " pb=[X._X__b]\n", - " objx.pa=objx._X__a\n", - " objx.pb=objx._X__b\n", - " return objx.pa+objx.pb\n", - "objx=X()\n", - "pfunc=X.SetMembers\n", - "pfunc(objx, 5, 6)\n", - "print \"Sum =\", sum(objx)\n", - "pobjx=[objx]\n", - "pfunc(pobjx[0], 7, 8)\n", - "print \"Sum =\", sum(objx)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum = 11\n", - "Sum = 15\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-memhnd.cpp, Page no-455" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "def out_of_memory():\n", - " print \"Memory exhausted, cannot allocate\"\n", - "ip=pointer(c_int())\n", - "total_allocated=0L\n", - "print \"Ok, allocating...\"\n", - "while(1):\n", - " ip=[int]*100\n", - " total_allocated+=100L\n", - " print \"Now got a total of\", total_allocated, \"bytes\"\n", - " if total_allocated==29900L:\n", - " break" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Ok, allocating...\n", - "Now got a total of 100 bytes\n", - "Now got a total of 200 bytes\n", - "Now got a total of 300 bytes\n", - "Now got a total of 400 bytes\n", - "Now got a total of 500 bytes\n", - "Now got a total of 600 bytes\n", - "Now got a total of 700 bytes\n", - "Now got a total of 800 bytes\n", - "Now got a total of 900 bytes\n", - "Now got a total of 1000 bytes\n", - "Now got a total of 1100 bytes\n", - "Now got a total of 1200 bytes\n", - "Now got a total of 1300 bytes\n", - "Now got a total of 1400 bytes\n", - "Now got a total of 1500 bytes\n", - "Now got a total of 1600 bytes\n", - "Now got a total of 1700 bytes\n", - "Now got a total of 1800 bytes\n", - "Now got a total of 1900 bytes\n", - "Now got a total of 2000 bytes\n", - "Now got a total of 2100 bytes\n", - "Now got a total of 2200 bytes\n", - "Now got a total of 2300 bytes\n", - "Now got a total of 2400 bytes\n", - "Now got a total of 2500 bytes\n", - "Now got a total of 2600 bytes\n", - "Now got a total of 2700 bytes\n", - "Now got a total of 2800 bytes\n", - "Now got a total of 2900 bytes\n", - "Now got a total of 3000 bytes\n", - "Now got a total of 3100 bytes\n", - "Now got a total of 3200 bytes\n", - "Now got a total of 3300 bytes\n", - "Now got a total of 3400 bytes\n", - "Now got a total of 3500 bytes\n", - "Now got a total of 3600 bytes\n", - "Now got a total of 3700 bytes\n", - "Now got a total of 3800 bytes\n", - "Now got a total of 3900 bytes\n", - "Now got a total of 4000 bytes\n", - "Now got a total of 4100 bytes\n", - "Now got a total of 4200 bytes\n", - "Now got a total of 4300 bytes\n", - "Now got a total of 4400 bytes\n", - "Now got a total of 4500 bytes\n", - "Now got a total of 4600 bytes\n", - "Now got a total of 4700 bytes\n", - "Now got a total of 4800 bytes\n", - "Now got a total of 4900 bytes\n", - "Now got a total of 5000 bytes\n", - "Now got a total of 5100 bytes\n", - "Now got a total of 5200 bytes\n", - "Now got a total of 5300 bytes\n", - "Now got a total of 5400 bytes\n", - "Now got a total of 5500 bytes\n", - "Now got a total of 5600 bytes\n", - "Now got a total of 5700 bytes\n", - "Now got a total of 5800 bytes\n", - "Now got a total of 5900 bytes\n", - "Now got a total of 6000 bytes\n", - "Now got a total of 6100 bytes\n", - "Now got a total of 6200 bytes\n", - "Now got a total of 6300 bytes\n", - "Now got a total of 6400 bytes\n", - "Now got a total of 6500 bytes\n", - "Now got a total of 6600 bytes\n", - "Now got a total of 6700 bytes\n", - "Now got a total of 6800 bytes\n", - "Now got a total of 6900 bytes\n", - "Now got a total of 7000 bytes\n", - "Now got a total of 7100 bytes\n", - "Now got a total of 7200 bytes\n", - "Now got a total of 7300 bytes\n", - "Now got a total of 7400 bytes\n", - "Now got a total of 7500 bytes\n", - "Now got a total of 7600 bytes\n", - "Now got a total of 7700 bytes\n", - "Now got a total of 7800 bytes\n", - "Now got a total of 7900 bytes\n", - "Now got a total of 8000 bytes\n", - "Now got a total of 8100 bytes\n", - "Now got a total of 8200 bytes\n", - "Now got a total of 8300 bytes\n", - "Now got a total of 8400 bytes\n", - "Now got a total of 8500 bytes\n", - "Now got a total of 8600 bytes\n", - "Now got a total of 8700 bytes\n", - "Now got a total of 8800 bytes\n", - "Now got a total of 8900 bytes\n", - "Now got a total of 9000 bytes\n", - "Now got a total of 9100 bytes\n", - "Now got a total of 9200 bytes\n", - "Now got a total of 9300 bytes\n", - "Now got a total of 9400 bytes\n", - "Now got a total of 9500 bytes\n", - "Now got a total of 9600 bytes\n", - "Now got a total of 9700 bytes\n", - "Now got a total of 9800 bytes\n", - "Now got a total of 9900 bytes\n", - "Now got a total of 10000 bytes\n", - "Now got a total of 10100 bytes\n", - "Now got a total of 10200 bytes\n", - "Now got a total of 10300 bytes\n", - "Now got a total of 10400 bytes\n", - "Now got a total of 10500 bytes\n", - "Now got a total of 10600 bytes\n", - "Now got a total of 10700 bytes\n", - "Now got a total of 10800 bytes\n", - "Now got a total of 10900 bytes\n", - "Now got a total of 11000 bytes\n", - "Now got a total of 11100 bytes\n", - "Now got a total of 11200 bytes\n", - "Now got a total of 11300 bytes\n", - "Now got a total of 11400 bytes\n", - "Now got a total of 11500 bytes\n", - "Now got a total of 11600 bytes\n", - "Now got a total of 11700 bytes\n", - "Now got a total of 11800 bytes\n", - "Now got a total of 11900 bytes\n", - "Now got a total of 12000 bytes\n", - "Now got a total of 12100 bytes\n", - "Now got a total of 12200 bytes\n", - "Now got a total of 12300 bytes\n", - "Now got a total of 12400 bytes\n", - "Now got a total of 12500 bytes\n", - "Now got a total of 12600 bytes\n", - "Now got a total of 12700 bytes\n", - "Now got a total of 12800 bytes\n", - "Now got a total of 12900 bytes\n", - "Now got a total of 13000 bytes\n", - "Now got a total of 13100 bytes\n", - "Now got a total of 13200 bytes\n", - "Now got a total of 13300 bytes\n", - "Now got a total of 13400 bytes\n", - "Now got a total of 13500 bytes\n", - "Now got a total of 13600 bytes\n", - "Now got a total of 13700 bytes\n", - "Now got a total of 13800 bytes\n", - "Now got a total of 13900 bytes\n", - "Now got a total of 14000 bytes\n", - "Now got a total of 14100 bytes\n", - "Now got a total of 14200 bytes\n", - "Now got a total of 14300 bytes\n", - "Now got a total of 14400 bytes\n", - "Now got a total of 14500 bytes\n", - "Now got a total of 14600 bytes\n", - "Now got a total of 14700 bytes\n", - "Now got a total of 14800 bytes\n", - "Now got a total of 14900 bytes\n", - "Now got a total of 15000 bytes\n", - "Now got a total of 15100 bytes\n", - "Now got a total of 15200 bytes\n", - "Now got a total of 15300 bytes\n", - "Now got a total of 15400 bytes\n", - "Now got a total of 15500 bytes\n", - "Now got a total of 15600 bytes\n", - "Now got a total of 15700 bytes\n", - "Now got a total of 15800 bytes\n", - "Now got a total of 15900 bytes\n", - "Now got a total of 16000 bytes\n", - "Now got a total of 16100 bytes\n", - "Now got a total of 16200 bytes\n", - "Now got a total of 16300 bytes\n", - "Now got a total of 16400 bytes\n", - "Now got a total of 16500 bytes\n", - "Now got a total of 16600 bytes\n", - "Now got a total of 16700 bytes\n", - "Now got a total of 16800 bytes\n", - "Now got a total of 16900 bytes\n", - "Now got a total of 17000 bytes\n", - "Now got a total of 17100 bytes\n", - "Now got a total of 17200 bytes\n", - "Now got a total of 17300 bytes\n", - "Now got a total of 17400 bytes\n", - "Now got a total of 17500 bytes\n", - "Now got a total of 17600 bytes\n", - "Now got a total of 17700 bytes\n", - "Now got a total of 17800 bytes\n", - "Now got a total of 17900 bytes\n", - "Now got a total of 18000 bytes\n", - "Now got a total of 18100 bytes\n", - "Now got a total of 18200 bytes\n", - "Now got a total of 18300 bytes\n", - "Now got a total of 18400 bytes\n", - "Now got a total of 18500 bytes\n", - "Now got a total of 18600 bytes\n", - "Now got a total of 18700 bytes\n", - "Now got a total of 18800 bytes\n", - "Now got a total of 18900 bytes\n", - "Now got a total of 19000 bytes\n", - "Now got a total of 19100 bytes\n", - "Now got a total of 19200 bytes\n", - "Now got a total of 19300 bytes\n", - "Now got a total of 19400 bytes\n", - "Now got a total of 19500 bytes\n", - "Now got a total of 19600 bytes\n", - "Now got a total of 19700 bytes\n", - "Now got a total of 19800 bytes\n", - "Now got a total of 19900 bytes\n", - "Now got a total of 20000 bytes\n", - "Now got a total of 20100 bytes\n", - "Now got a total of 20200 bytes\n", - "Now got a total of 20300 bytes\n", - "Now got a total of 20400 bytes\n", - "Now got a total of 20500 bytes\n", - "Now got a total of 20600 bytes\n", - "Now got a total of 20700 bytes\n", - "Now got a total of 20800 bytes\n", - "Now got a total of 20900 bytes\n", - "Now got a total of 21000 bytes\n", - "Now got a total of 21100 bytes\n", - "Now got a total of 21200 bytes\n", - "Now got a total of 21300 bytes\n", - "Now got a total of 21400 bytes\n", - "Now got a total of 21500 bytes\n", - "Now got a total of 21600 bytes\n", - "Now got a total of 21700 bytes\n", - "Now got a total of 21800 bytes\n", - "Now got a total of 21900 bytes\n", - "Now got a total of 22000 bytes\n", - "Now got a total of 22100 bytes\n", - "Now got a total of 22200 bytes\n", - "Now got a total of 22300 bytes\n", - "Now got a total of 22400 bytes\n", - "Now got a total of 22500 bytes\n", - "Now got a total of 22600 bytes\n", - "Now got a total of 22700 bytes\n", - "Now got a total of 22800 bytes\n", - "Now got a total of 22900 bytes\n", - "Now got a total of 23000 bytes\n", - "Now got a total of 23100 bytes\n", - "Now got a total of 23200 bytes\n", - "Now got a total of 23300 bytes\n", - "Now got a total of 23400 bytes\n", - "Now got a total of 23500 bytes\n", - "Now got a total of 23600 bytes\n", - "Now got a total of 23700 bytes\n", - "Now got a total of 23800 bytes\n", - "Now got a total of 23900 bytes\n", - "Now got a total of 24000 bytes\n", - "Now got a total of 24100 bytes\n", - "Now got a total of 24200 bytes\n", - "Now got a total of 24300 bytes\n", - "Now got a total of 24400 bytes\n", - "Now got a total of 24500 bytes\n", - "Now got a total of 24600 bytes\n", - "Now got a total of 24700 bytes\n", - "Now got a total of 24800 bytes\n", - "Now got a total of 24900 bytes\n", - "Now got a total of 25000 bytes\n", - "Now got a total of 25100 bytes\n", - "Now got a total of 25200 bytes\n", - "Now got a total of 25300 bytes\n", - "Now got a total of 25400 bytes\n", - "Now got a total of 25500 bytes\n", - "Now got a total of 25600 bytes\n", - "Now got a total of 25700 bytes\n", - "Now got a total of 25800 bytes\n", - "Now got a total of 25900 bytes\n", - "Now got a total of 26000 bytes\n", - "Now got a total of 26100 bytes\n", - "Now got a total of 26200 bytes\n", - "Now got a total of 26300 bytes\n", - "Now got a total of 26400 bytes\n", - "Now got a total of 26500 bytes\n", - "Now got a total of 26600 bytes\n", - "Now got a total of 26700 bytes\n", - "Now got a total of 26800 bytes\n", - "Now got a total of 26900 bytes\n", - "Now got a total of 27000 bytes\n", - "Now got a total of 27100 bytes\n", - "Now got a total of 27200 bytes\n", - "Now got a total of 27300 bytes\n", - "Now got a total of 27400 bytes\n", - "Now got a total of 27500 bytes\n", - "Now got a total of 27600 bytes\n", - "Now got a total of 27700 bytes\n", - "Now got a total of 27800 bytes\n", - "Now got a total of 27900 bytes\n", - "Now got a total of 28000 bytes\n", - "Now got a total of 28100 bytes\n", - "Now got a total of 28200 bytes\n", - "Now got a total of 28300 bytes\n", - "Now got a total of 28400 bytes\n", - "Now got a total of 28500 bytes\n", - "Now got a total of 28600 bytes\n", - "Now got a total of 28700 bytes\n", - "Now got a total of 28800 bytes\n", - "Now got a total of 28900 bytes\n", - "Now got a total of 29000 bytes\n", - "Now got a total of 29100 bytes\n", - "Now got a total of 29200 bytes\n", - "Now got a total of 29300 bytes\n", - "Now got a total of 29400 bytes\n", - "Now got a total of 29500 bytes\n", - "Now got a total of 29600 bytes\n", - "Now got a total of 29700 bytes\n", - "Now got a total of 29800 bytes\n", - "Now got a total of 29900 bytes\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-this.cpp, Page no-457" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Test:\n", - " __a=int\n", - " def setdata(self, init_a):\n", - " self.__a=init_a\n", - " print \"Address of my object, this in setdata():\", hex(id(self))\n", - " self.__a=init_a\n", - " def showdata(self):\n", - " print \"Data accessed in normal way: \", self.__a\n", - " print \"Address of my object, this in showdata(): \", hex(id(self))\n", - " print \"Data accessed through this->a: \", self.__a\n", - "my=Test()\n", - "my.setdata(25)\n", - "my.showdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Address of my object, this in setdata(): 0x39de488L\n", - "Data accessed in normal way: 25\n", - "Address of my object, this in showdata(): 0x39de488L\n", - "Data accessed through this->a: 25\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-list.cpp, Page no-459" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class List():\n", - " def __init__(self, dat=None):\n", - " if isinstance(dat, int):\n", - " self.__data=dat\n", - " else:\n", - " self.__data=0\n", - " self.__Next=None\n", - " def __del__(self):\n", - " pass\n", - " def get(self):\n", - " return self.__data\n", - " def insert(self, node):\n", - " last=List()\n", - " last=self\n", - " while(last.__Next!=None):\n", - " last=last.__Next\n", - " last.__Next=node\n", - "def display(first):\n", - " traverse=List()\n", - " print \"List traversal yields:\",\n", - " traverse=first\n", - " while(1): \n", - " print traverse._List__data, \",\",\n", - " if traverse._List__Next==None:\n", - " break\n", - " traverse=traverse._List__Next\n", - " print \"\"\n", - "first=List()\n", - "first=None\n", - "while(1):\n", - " print \"Linked List...\\n1.Insert\\n2.Display\\n3.Quit\\nEnter Choice: \",\n", - " choice=int(raw_input())\n", - " if choice==1:\n", - " data=int(raw_input(\"Enter data: \"))\n", - " node=List(data)\n", - " if first==None:\n", - " first=node\n", - " else:\n", - " first.insert(node)\n", - " elif choice==2:\n", - " display(first)\n", - " elif choice==3:\n", - " break\n", - " else:\n", - " print \"Bad Option Selected\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Linked List...\n", - "1.Insert\n", - "2.Display\n", - "3.Quit\n", - "Enter Choice: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Linked List...\n", - "1.Insert\n", - "2.Display\n", - "3.Quit\n", - "Enter Choice: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " List traversal yields: 2 , \n", - "Linked List...\n", - "1.Insert\n", - "2.Display\n", - "3.Quit\n", - "Enter Choice: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Linked List...\n", - "1.Insert\n", - "2.Display\n", - "3.Quit\n", - "Enter Choice: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Linked List...\n", - "1.Insert\n", - "2.Display\n", - "3.Quit\n", - "Enter Choice: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " List traversal yields: 2 , 3 , 4 , \n", - "Linked List...\n", - "1.Insert\n", - "2.Display\n", - "3.Quit\n", - "Enter Choice: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-dll.cpp, Page no-462" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class dll:\n", - " def __init__(self, data_in=None):\n", - " if isinstance(data_in, int):\n", - " self.__data=data_in\n", - " else:\n", - " self.__data=0\n", - " self.__prev=None\n", - " self.__Next=None\n", - " def __del__(self):\n", - " pass\n", - " def get(self):\n", - " return self.__data\n", - " def insert(self, node):\n", - " last=dll()\n", - " last=self\n", - " while(last._dll__Next!=None):\n", - " last=last._dll__Next\n", - " node._dll__prev=last\n", - " node._dll__Next=None\n", - " last._dll__Next=node\n", - " def FreeAllNodes(self):\n", - " print \"Freeing the node with data:\",\n", - " first=dll()\n", - " first=self\n", - " while(1):\n", - " temp= dll()\n", - " temp=first\n", - " print \"->\", first._dll__data,\n", - " del temp\n", - " first=first._dll__Next\n", - " if first==None:\n", - " break\n", - "def display(first):\n", - " traverse=dll()\n", - " traverse=first\n", - " if first==None:\n", - " print \"Nothing to display !\"\n", - " return\n", - " else:\n", - " print \"Processing with forward -> pointer:\",\n", - " while(1): \n", - " print \"->\", traverse._dll__data, \n", - " if traverse._dll__Next==None:\n", - " break\n", - " traverse=traverse._dll__Next\n", - " print \"\\nProcessing with backward <- pointer:\",\n", - " while(1): \n", - " print \"->\", traverse._dll__data,\n", - " if traverse._dll__prev==None:\n", - " break\n", - " traverse=traverse._dll__prev\n", - " print \"\"\n", - "def InsertNode(first, data):\n", - " node=dll(data)\n", - " if first==None:\n", - " first=node\n", - " else:\n", - " first.insert(node)\n", - " return first\n", - "first=dll()\n", - "first=None\n", - "print \"Double Linked List Manipulation...\"\n", - "while(1):\n", - " choice=int(raw_input(\"Enter Choice ([1] Insert, [2] Display, [3]Quit: \"))\n", - " if choice==1:\n", - " data=int(raw_input(\"Enter data: \"))\n", - " first=InsertNode(first, data)\n", - " elif choice==2:\n", - " display(first)\n", - " elif choice==3:\n", - " first.FreeAllNodes()\n", - " break\n", - " else:\n", - " print \"Bad Option Selected\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Double Linked List Manipulation...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Processing with forward -> pointer: -> 3 \n", - "Processing with backward <- pointer: -> 3 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data: 7\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Processing with forward -> pointer: -> 3 -> 7 \n", - "Processing with backward <- pointer: -> 7 -> 3 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Processing with forward -> pointer: -> 3 -> 7 -> 5 \n", - "Processing with backward <- pointer: -> 5 -> 7 -> 3 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Bad Option Selected\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Freeing the node with data: -> 3 -> 7 -> 5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-466" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class A:\n", - " __a1=int\n", - " def Set(self, val):\n", - " self.__a1=val\n", - "class B:\n", - " __b1=int\n", - " def Set(self, val):\n", - " self.__b1=val\n", - "def add(x, y):\n", - " return x._A__a1+y._B__b1\n", - "ObjA=A()\n", - "ObjB=B()\n", - "ObjA.Set(9)\n", - "ObjB.Set(10)\n", - "print \"Sum of objects A and B using friend function =\", add(ObjA, ObjB)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of objects A and B using friend function = 19\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-2, Page no-466" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class test:\n", - " __data=int\n", - " def func(self, val):\n", - " self.__data=val\n", - "t1=test()\n", - "testptr={}\n", - "testptr[0]=test.func #pointer to member function\n", - "print \"Initializing test class object t1 using pointer...\"\n", - "testptr[0](t1, 10)\n", - "print \"Object initialized successfully\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Initializing test class object t1 using pointer...\n", - "Object initialized successfully\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects_1.ipynb deleted file mode 100755 index 2f8d1022..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter12-DynamicObjects_1.ipynb +++ /dev/null @@ -1,1589 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:fa9552ed51e712cfcebb68ace46e3f3dfa1346a1b04ccf69bb0b5d56c912b64c" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 12-Dynamic Objects" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ptrobj1.cpp, Page no-435" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure, POINTER\n", - "class someclass(Structure):\n", - " data1=int\n", - " data2=chr\n", - " def __init__(self):\n", - " print 'Constructor someclass() is invoked'\n", - " self.data1=1\n", - " self.data2='A'\n", - " def __del__(self):\n", - " print 'Destructor ~someclass() is invoked'\n", - " def show(self):\n", - " print 'data1 =', self.data1,\n", - " print 'data2 =', self.data2\n", - "object1=someclass() #object of class someclass\n", - "ptr=POINTER(someclass) #pointer of type class someclass\n", - "ptr=object1 #pointer pointing to object of class someclass\n", - "print \"Accessing object through object1.show()...\"\n", - "object1.show()\n", - "print \"Accessing object through ptr->show()...\"\n", - "ptr.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor someclass() is invoked\n", - "Destructor ~someclass() is invoked\n", - "Accessing object through object1.show()...\n", - "data1 = 1 data2 = A\n", - "Accessing object through ptr->show()...\n", - "data1 = 1 data2 = A\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ptrobj2.cpp, Page no-437" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class someclass(Structure):\n", - " data1=int\n", - " data2=chr\n", - " def __init__(self):\n", - " print 'Constructor someclass() is invoked'\n", - " self.data1=1\n", - " self.data2='A'\n", - " def __del__(self):\n", - " print 'Destructor ~someclass() is invoked'\n", - " def show(self):\n", - " print 'data1 =', self.data1,\n", - " print 'data2 =', self.data2\n", - "object1=someclass()\n", - "ptr=POINTER(someclass)\n", - "ptr=object1\n", - "print \"Accessing object through object1.show()...\"\n", - "ptr.show()\n", - "print \"Destroying dynamic object...\"\n", - "del ptr" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor someclass() is invoked\n", - "Destructor ~someclass() is invoked\n", - "Accessing object through object1.show()...\n", - "data1 = 1 data2 = A\n", - "Destroying dynamic object...\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-useref.cpp, Page no-439" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import POINTER, c_int\n", - "t1=POINTER(c_int)\n", - "t1=c_int(5)\n", - "t3=c_int(5)\n", - "t2=c_int(10)\n", - "t1.value=t1.value+t2.value\n", - "print \"Sum of\", t3.value,\n", - "print \"and\", t2.value, \n", - "print \"is:\", t1.value" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of 5 and 10 is: 15\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-refobj.cpp, Page no-440" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure\n", - "class student(Structure):\n", - " __roll_no=int\n", - " __name=str\n", - " def setdata(self, roll_no_in, name_in):\n", - " self.__roll_no=roll_no_in\n", - " self.__name=name_in\n", - " def outdata(self):\n", - " print \"Roll No =\", self.__roll_no\n", - " print \"Name =\", self.__name\n", - "s1=student()\n", - "s1.setdata(1, \"Savithri\")\n", - "s1.outdata()\n", - "s2=student()\n", - "s2.setdata(2, \"Bhavani\")\n", - "s2.outdata()\n", - "s3=student()\n", - "s3.setdata(3, \"Vani\")\n", - "s4=s3\n", - "s3.outdata()\n", - "s4.outdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll No = 1\n", - "Name = Savithri\n", - "Roll No = 2\n", - "Name = Bhavani\n", - "Roll No = 3\n", - "Name = Vani\n", - "Roll No = 3\n", - "Name = Vani\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student3.cpp, Page no-442" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class student:\n", - " __roll_no=int\n", - " __name=str\n", - " def __init__(self, roll_no_in=None, name_in=None):\n", - " if isinstance(roll_no_in, int):\n", - " self.__roll_no=roll_no_in\n", - " if isinstance(name_in, str):\n", - " self.__name=name_in\n", - " else:\n", - " flag=raw_input(\"Do you want to initialize the object (y/n): \")\n", - " if flag=='y' or flag=='Y':\n", - " self.__roll_no=int(raw_input(\"Enter Roll no. of student: \"))\n", - " Str=raw_input(\"Enter Name of student: \")\n", - " self.__name=Str\n", - " else:\n", - " self.__roll_no=0\n", - " self.__name=None\n", - " def __del__(self):\n", - " if isinstance(self.__name, str):\n", - " del self.__name\n", - " def Set(self):\n", - " student(roll_no_in, name_in)\n", - " def show(self):\n", - " if self.__roll_no:\n", - " print \"Roll No:\", self.__roll_no\n", - " else:\n", - " print \"Roll No: (not initialized)\"\n", - " if isinstance(self.__name, str):\n", - " print \"Name: \", self.__name\n", - " else:\n", - " print \"Name: (not initialized)\"\n", - "s1=student()\n", - "s2=student()\n", - "s3=student(1)\n", - "s4=student(2, \"Bhavani\")\n", - "print \"Live objects contents...\"\n", - "s1.show()\n", - "s2.show()\n", - "s3.show()\n", - "s4.show()\n", - "del s1\n", - "del s2\n", - "del s3\n", - "del s4" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Do you want to initialize the object (y/n): n\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Do you want to initialize the object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Roll no. of student: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name of student: Rekha\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Live objects contents...\n", - "Roll No: (not initialized)\n", - "Name: (not initialized)\n", - "Roll No: 5\n", - "Name: Rekha\n", - "Roll No: 1\n", - "Name: (not initialized)\n", - "Roll No: 2\n", - "Name: Bhavani\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student1.cpp, Page-445" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class student:\n", - " __roll_no=int\n", - " __name=str\n", - " def setdata(self, roll_no_in, name_in):\n", - " self.__roll_no=roll_no_in\n", - " self.__name=name_in\n", - " def outdata(self):\n", - " print \"Roll No =\", self.__roll_no\n", - " print \"Name =\", self.__name\n", - "s=[]*10 #array of objects\n", - "count=0\n", - "for i in range(10):\n", - " s.append(student())\n", - "for i in range(10):\n", - " response=raw_input(\"Initialize student object (y/n): \")\n", - " if response=='y' or response=='Y':\n", - " roll_no=int(raw_input(\"Enter a Roll no. of student: \"))\n", - " name=raw_input(\"Enter name of student: \")\n", - " s[i].setdata(roll_no, name)\n", - " count+=1\n", - " else:\n", - " break\n", - "print \"Student Details...\"\n", - "for i in range(count):\n", - " s[i].outdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Initialize student object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a Roll no. of student: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of student: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Initialize student object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a Roll no. of student: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of student: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Initialize student object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a Roll no. of student: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of student: Savithri\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Initialize student object (y/n): n\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Details...\n", - "Roll No = 1\n", - "Name = Rajkumar\n", - "Roll No = 2\n", - "Name = Tejaswi\n", - "Roll No = 3\n", - "Name = Savithri\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student2.cpp, Page no-447" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class student(Structure):\n", - " __roll_no=int\n", - " __name=str\n", - " def setdata(self, roll_no_in, name_in):\n", - " self.__roll_no=roll_no_in\n", - " self.__name=name_in\n", - " def outdata(self):\n", - " print \"Roll No =\", self.__roll_no\n", - " print \"Name =\", self.__name\n", - "temp=[]*10\n", - "s=POINTER(student) \n", - "count=0\n", - "for i in range(10):\n", - " temp.append(student())\n", - "s=temp #pointer to array of objects\n", - "for i in range(10):\n", - " response=raw_input(\"Create student object (y/n): \")\n", - " if response=='y' or response=='Y':\n", - " roll_no=int(raw_input(\"Enter a Roll no. of student: \"))\n", - " name=raw_input(\"Enter name of student: \")\n", - " s[i].setdata(roll_no, name)\n", - " count+=1\n", - " else:\n", - " break\n", - "print \"Student Details...\"\n", - "for i in range(count):\n", - " s[i].outdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Create student object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a Roll no. of student: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of student: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Create student object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a Roll no. of student: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of student: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Create student object (y/n): y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a Roll no. of student: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of student: Savithri\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Create student object (y/n): n\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Details...\n", - "Roll No = 1\n", - "Name = Rajkumar\n", - "Roll No = 2\n", - "Name = Tejaswi\n", - "Roll No = 3\n", - "Name = Savithri\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ptrmemb.cpp, Page no-452" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " __y=int\n", - " a=int\n", - " b=int\n", - " def init(self, z):\n", - " self.a=z\n", - " return z\n", - "obj=X()\n", - "ip=X.a #pointer to data member\n", - "obj.ip=10 #access through object\n", - "print \"a in obj after obj.*ip = 10 is\", obj.ip\n", - "pobj=[obj] #pointer to object of class X\n", - "pobj[0].ip=10 #access through object pointer\n", - "print \"a in obj after pobj->*ip = 10 is\", pobj[0].ip\n", - "ptr_init=X.init #pointer to member function\n", - "ptr_init(obj,5) #access through object\n", - "print \"a in obj after (obj.*ptr_init)(5) =\", obj.a\n", - "ptr_init(pobj[0],5) #access through object pointer\n", - "print \"a in obj after (pobj->*ptr_init)(5) =\", obj.a" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "a in obj after obj.*ip = 10 is 10\n", - "a in obj after pobj->*ip = 10 is 10\n", - "a in obj after (obj.*ptr_init)(5) = 5\n", - "a in obj after (pobj->*ptr_init)(5) = 5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-friend.cpp, Page no-454" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X():\n", - " __a=int\n", - " __b=int\n", - " def __init__(self):\n", - " self.__a=0\n", - " self.__b=0\n", - " def SetMembers(self, a1, b1):\n", - " self.__a=a1\n", - " self.__b=b1\n", - "def sum(objx):\n", - " pa=[X._X__a]\n", - " pb=[X._X__b]\n", - " objx.pa=objx._X__a\n", - " objx.pb=objx._X__b\n", - " return objx.pa+objx.pb\n", - "objx=X()\n", - "pfunc=X.SetMembers\n", - "pfunc(objx, 5, 6)\n", - "print \"Sum =\", sum(objx)\n", - "pobjx=[objx]\n", - "pfunc(pobjx[0], 7, 8)\n", - "print \"Sum =\", sum(objx)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum = 11\n", - "Sum = 15\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-memhnd.cpp, Page no-455" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import pointer, c_int\n", - "def out_of_memory():\n", - " print \"Memory exhausted, cannot allocate\"\n", - "ip=pointer(c_int())\n", - "total_allocated=0L\n", - "print \"Ok, allocating...\"\n", - "while(1):\n", - " ip=[int]*100\n", - " total_allocated+=100L\n", - " print \"Now got a total of\", total_allocated, \"bytes\"\n", - " if total_allocated==29900L:\n", - " break" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Ok, allocating...\n", - "Now got a total of 100 bytes\n", - "Now got a total of 200 bytes\n", - "Now got a total of 300 bytes\n", - "Now got a total of 400 bytes\n", - "Now got a total of 500 bytes\n", - "Now got a total of 600 bytes\n", - "Now got a total of 700 bytes\n", - "Now got a total of 800 bytes\n", - "Now got a total of 900 bytes\n", - "Now got a total of 1000 bytes\n", - "Now got a total of 1100 bytes\n", - "Now got a total of 1200 bytes\n", - "Now got a total of 1300 bytes\n", - "Now got a total of 1400 bytes\n", - "Now got a total of 1500 bytes\n", - "Now got a total of 1600 bytes\n", - "Now got a total of 1700 bytes\n", - "Now got a total of 1800 bytes\n", - "Now got a total of 1900 bytes\n", - "Now got a total of 2000 bytes\n", - "Now got a total of 2100 bytes\n", - "Now got a total of 2200 bytes\n", - "Now got a total of 2300 bytes\n", - "Now got a total of 2400 bytes\n", - "Now got a total of 2500 bytes\n", - "Now got a total of 2600 bytes\n", - "Now got a total of 2700 bytes\n", - "Now got a total of 2800 bytes\n", - "Now got a total of 2900 bytes\n", - "Now got a total of 3000 bytes\n", - "Now got a total of 3100 bytes\n", - "Now got a total of 3200 bytes\n", - "Now got a total of 3300 bytes\n", - "Now got a total of 3400 bytes\n", - "Now got a total of 3500 bytes\n", - "Now got a total of 3600 bytes\n", - "Now got a total of 3700 bytes\n", - "Now got a total of 3800 bytes\n", - "Now got a total of 3900 bytes\n", - "Now got a total of 4000 bytes\n", - "Now got a total of 4100 bytes\n", - "Now got a total of 4200 bytes\n", - "Now got a total of 4300 bytes\n", - "Now got a total of 4400 bytes\n", - "Now got a total of 4500 bytes\n", - "Now got a total of 4600 bytes\n", - "Now got a total of 4700 bytes\n", - "Now got a total of 4800 bytes\n", - "Now got a total of 4900 bytes\n", - "Now got a total of 5000 bytes\n", - "Now got a total of 5100 bytes\n", - "Now got a total of 5200 bytes\n", - "Now got a total of 5300 bytes\n", - "Now got a total of 5400 bytes\n", - "Now got a total of 5500 bytes\n", - "Now got a total of 5600 bytes\n", - "Now got a total of 5700 bytes\n", - "Now got a total of 5800 bytes\n", - "Now got a total of 5900 bytes\n", - "Now got a total of 6000 bytes\n", - "Now got a total of 6100 bytes\n", - "Now got a total of 6200 bytes\n", - "Now got a total of 6300 bytes\n", - "Now got a total of 6400 bytes\n", - "Now got a total of 6500 bytes\n", - "Now got a total of 6600 bytes\n", - "Now got a total of 6700 bytes\n", - "Now got a total of 6800 bytes\n", - "Now got a total of 6900 bytes\n", - "Now got a total of 7000 bytes\n", - "Now got a total of 7100 bytes\n", - "Now got a total of 7200 bytes\n", - "Now got a total of 7300 bytes\n", - "Now got a total of 7400 bytes\n", - "Now got a total of 7500 bytes\n", - "Now got a total of 7600 bytes\n", - "Now got a total of 7700 bytes\n", - "Now got a total of 7800 bytes\n", - "Now got a total of 7900 bytes\n", - "Now got a total of 8000 bytes\n", - "Now got a total of 8100 bytes\n", - "Now got a total of 8200 bytes\n", - "Now got a total of 8300 bytes\n", - "Now got a total of 8400 bytes\n", - "Now got a total of 8500 bytes\n", - "Now got a total of 8600 bytes\n", - "Now got a total of 8700 bytes\n", - "Now got a total of 8800 bytes\n", - "Now got a total of 8900 bytes\n", - "Now got a total of 9000 bytes\n", - "Now got a total of 9100 bytes\n", - "Now got a total of 9200 bytes\n", - "Now got a total of 9300 bytes\n", - "Now got a total of 9400 bytes\n", - "Now got a total of 9500 bytes\n", - "Now got a total of 9600 bytes\n", - "Now got a total of 9700 bytes\n", - "Now got a total of 9800 bytes\n", - "Now got a total of 9900 bytes\n", - "Now got a total of 10000 bytes\n", - "Now got a total of 10100 bytes\n", - "Now got a total of 10200 bytes\n", - "Now got a total of 10300 bytes\n", - "Now got a total of 10400 bytes\n", - "Now got a total of 10500 bytes\n", - "Now got a total of 10600 bytes\n", - "Now got a total of 10700 bytes\n", - "Now got a total of 10800 bytes\n", - "Now got a total of 10900 bytes\n", - "Now got a total of 11000 bytes\n", - "Now got a total of 11100 bytes\n", - "Now got a total of 11200 bytes\n", - "Now got a total of 11300 bytes\n", - "Now got a total of 11400 bytes\n", - "Now got a total of 11500 bytes\n", - "Now got a total of 11600 bytes\n", - "Now got a total of 11700 bytes\n", - "Now got a total of 11800 bytes\n", - "Now got a total of 11900 bytes\n", - "Now got a total of 12000 bytes\n", - "Now got a total of 12100 bytes\n", - "Now got a total of 12200 bytes\n", - "Now got a total of 12300 bytes\n", - "Now got a total of 12400 bytes\n", - "Now got a total of 12500 bytes\n", - "Now got a total of 12600 bytes\n", - "Now got a total of 12700 bytes\n", - "Now got a total of 12800 bytes\n", - "Now got a total of 12900 bytes\n", - "Now got a total of 13000 bytes\n", - "Now got a total of 13100 bytes\n", - "Now got a total of 13200 bytes\n", - "Now got a total of 13300 bytes\n", - "Now got a total of 13400 bytes\n", - "Now got a total of 13500 bytes\n", - "Now got a total of 13600 bytes\n", - "Now got a total of 13700 bytes\n", - "Now got a total of 13800 bytes\n", - "Now got a total of 13900 bytes\n", - "Now got a total of 14000 bytes\n", - "Now got a total of 14100 bytes\n", - "Now got a total of 14200 bytes\n", - "Now got a total of 14300 bytes\n", - "Now got a total of 14400 bytes\n", - "Now got a total of 14500 bytes\n", - "Now got a total of 14600 bytes\n", - "Now got a total of 14700 bytes\n", - "Now got a total of 14800 bytes\n", - "Now got a total of 14900 bytes\n", - "Now got a total of 15000 bytes\n", - "Now got a total of 15100 bytes\n", - "Now got a total of 15200 bytes\n", - "Now got a total of 15300 bytes\n", - "Now got a total of 15400 bytes\n", - "Now got a total of 15500 bytes\n", - "Now got a total of 15600 bytes\n", - "Now got a total of 15700 bytes\n", - "Now got a total of 15800 bytes\n", - "Now got a total of 15900 bytes\n", - "Now got a total of 16000 bytes\n", - "Now got a total of 16100 bytes\n", - "Now got a total of 16200 bytes\n", - "Now got a total of 16300 bytes\n", - "Now got a total of 16400 bytes\n", - "Now got a total of 16500 bytes\n", - "Now got a total of 16600 bytes\n", - "Now got a total of 16700 bytes\n", - "Now got a total of 16800 bytes\n", - "Now got a total of 16900 bytes\n", - "Now got a total of 17000 bytes\n", - "Now got a total of 17100 bytes\n", - "Now got a total of 17200 bytes\n", - "Now got a total of 17300 bytes\n", - "Now got a total of 17400 bytes\n", - "Now got a total of 17500 bytes\n", - "Now got a total of 17600 bytes\n", - "Now got a total of 17700 bytes\n", - "Now got a total of 17800 bytes\n", - "Now got a total of 17900 bytes\n", - "Now got a total of 18000 bytes\n", - "Now got a total of 18100 bytes\n", - "Now got a total of 18200 bytes\n", - "Now got a total of 18300 bytes\n", - "Now got a total of 18400 bytes\n", - "Now got a total of 18500 bytes\n", - "Now got a total of 18600 bytes\n", - "Now got a total of 18700 bytes\n", - "Now got a total of 18800 bytes\n", - "Now got a total of 18900 bytes\n", - "Now got a total of 19000 bytes\n", - "Now got a total of 19100 bytes\n", - "Now got a total of 19200 bytes\n", - "Now got a total of 19300 bytes\n", - "Now got a total of 19400 bytes\n", - "Now got a total of 19500 bytes\n", - "Now got a total of 19600 bytes\n", - "Now got a total of 19700 bytes\n", - "Now got a total of 19800 bytes\n", - "Now got a total of 19900 bytes\n", - "Now got a total of 20000 bytes\n", - "Now got a total of 20100 bytes\n", - "Now got a total of 20200 bytes\n", - "Now got a total of 20300 bytes\n", - "Now got a total of 20400 bytes\n", - "Now got a total of 20500 bytes\n", - "Now got a total of 20600 bytes\n", - "Now got a total of 20700 bytes\n", - "Now got a total of 20800 bytes\n", - "Now got a total of 20900 bytes\n", - "Now got a total of 21000 bytes\n", - "Now got a total of 21100 bytes\n", - "Now got a total of 21200 bytes\n", - "Now got a total of 21300 bytes\n", - "Now got a total of 21400 bytes\n", - "Now got a total of 21500 bytes\n", - "Now got a total of 21600 bytes\n", - "Now got a total of 21700 bytes\n", - "Now got a total of 21800 bytes\n", - "Now got a total of 21900 bytes\n", - "Now got a total of 22000 bytes\n", - "Now got a total of 22100 bytes\n", - "Now got a total of 22200 bytes\n", - "Now got a total of 22300 bytes\n", - "Now got a total of 22400 bytes\n", - "Now got a total of 22500 bytes\n", - "Now got a total of 22600 bytes\n", - "Now got a total of 22700 bytes\n", - "Now got a total of 22800 bytes\n", - "Now got a total of 22900 bytes\n", - "Now got a total of 23000 bytes\n", - "Now got a total of 23100 bytes\n", - "Now got a total of 23200 bytes\n", - "Now got a total of 23300 bytes\n", - "Now got a total of 23400 bytes\n", - "Now got a total of 23500 bytes\n", - "Now got a total of 23600 bytes\n", - "Now got a total of 23700 bytes\n", - "Now got a total of 23800 bytes\n", - "Now got a total of 23900 bytes\n", - "Now got a total of 24000 bytes\n", - "Now got a total of 24100 bytes\n", - "Now got a total of 24200 bytes\n", - "Now got a total of 24300 bytes\n", - "Now got a total of 24400 bytes\n", - "Now got a total of 24500 bytes\n", - "Now got a total of 24600 bytes\n", - "Now got a total of 24700 bytes\n", - "Now got a total of 24800 bytes\n", - "Now got a total of 24900 bytes\n", - "Now got a total of 25000 bytes\n", - "Now got a total of 25100 bytes\n", - "Now got a total of 25200 bytes\n", - "Now got a total of 25300 bytes\n", - "Now got a total of 25400 bytes\n", - "Now got a total of 25500 bytes\n", - "Now got a total of 25600 bytes\n", - "Now got a total of 25700 bytes\n", - "Now got a total of 25800 bytes\n", - "Now got a total of 25900 bytes\n", - "Now got a total of 26000 bytes\n", - "Now got a total of 26100 bytes\n", - "Now got a total of 26200 bytes\n", - "Now got a total of 26300 bytes\n", - "Now got a total of 26400 bytes\n", - "Now got a total of 26500 bytes\n", - "Now got a total of 26600 bytes\n", - "Now got a total of 26700 bytes\n", - "Now got a total of 26800 bytes\n", - "Now got a total of 26900 bytes\n", - "Now got a total of 27000 bytes\n", - "Now got a total of 27100 bytes\n", - "Now got a total of 27200 bytes\n", - "Now got a total of 27300 bytes\n", - "Now got a total of 27400 bytes\n", - "Now got a total of 27500 bytes\n", - "Now got a total of 27600 bytes\n", - "Now got a total of 27700 bytes\n", - "Now got a total of 27800 bytes\n", - "Now got a total of 27900 bytes\n", - "Now got a total of 28000 bytes\n", - "Now got a total of 28100 bytes\n", - "Now got a total of 28200 bytes\n", - "Now got a total of 28300 bytes\n", - "Now got a total of 28400 bytes\n", - "Now got a total of 28500 bytes\n", - "Now got a total of 28600 bytes\n", - "Now got a total of 28700 bytes\n", - "Now got a total of 28800 bytes\n", - "Now got a total of 28900 bytes\n", - "Now got a total of 29000 bytes\n", - "Now got a total of 29100 bytes\n", - "Now got a total of 29200 bytes\n", - "Now got a total of 29300 bytes\n", - "Now got a total of 29400 bytes\n", - "Now got a total of 29500 bytes\n", - "Now got a total of 29600 bytes\n", - "Now got a total of 29700 bytes\n", - "Now got a total of 29800 bytes\n", - "Now got a total of 29900 bytes\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-this.cpp, Page no-457" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Test:\n", - " __a=int\n", - " def setdata(self, init_a):\n", - " self.__a=init_a\n", - " print \"Address of my object, this in setdata():\", hex(id(self))\n", - " self.__a=init_a\n", - " def showdata(self):\n", - " print \"Data accessed in normal way: \", self.__a\n", - " print \"Address of my object, this in showdata(): \", hex(id(self))\n", - " print \"Data accessed through this->a: \", self.__a\n", - "my=Test()\n", - "my.setdata(25)\n", - "my.showdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Address of my object, this in setdata(): 0x39de488L\n", - "Data accessed in normal way: 25\n", - "Address of my object, this in showdata(): 0x39de488L\n", - "Data accessed through this->a: 25\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-list.cpp, Page no-459" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class List():\n", - " def __init__(self, dat=None):\n", - " if isinstance(dat, int):\n", - " self.__data=dat\n", - " else:\n", - " self.__data=0\n", - " self.__Next=None\n", - " def __del__(self):\n", - " pass\n", - " def get(self):\n", - " return self.__data\n", - " def insert(self, node):\n", - " last=List()\n", - " last=self\n", - " while(last.__Next!=None):\n", - " last=last.__Next\n", - " last.__Next=node\n", - "def display(first):\n", - " traverse=List()\n", - " print \"List traversal yields:\",\n", - " traverse=first\n", - " while(1): \n", - " print traverse._List__data, \",\",\n", - " if traverse._List__Next==None:\n", - " break\n", - " traverse=traverse._List__Next\n", - " print \"\"\n", - "first=List()\n", - "first=None\n", - "while(1):\n", - " print \"Linked List...\\n1.Insert\\n2.Display\\n3.Quit\\nEnter Choice: \",\n", - " choice=int(raw_input())\n", - " if choice==1:\n", - " data=int(raw_input(\"Enter data: \"))\n", - " node=List(data)\n", - " if first==None:\n", - " first=node\n", - " else:\n", - " first.insert(node)\n", - " elif choice==2:\n", - " display(first)\n", - " elif choice==3:\n", - " break\n", - " else:\n", - " print \"Bad Option Selected\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Linked List...\n", - "1.Insert\n", - "2.Display\n", - "3.Quit\n", - "Enter Choice: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Linked List...\n", - "1.Insert\n", - "2.Display\n", - "3.Quit\n", - "Enter Choice: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " List traversal yields: 2 , \n", - "Linked List...\n", - "1.Insert\n", - "2.Display\n", - "3.Quit\n", - "Enter Choice: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Linked List...\n", - "1.Insert\n", - "2.Display\n", - "3.Quit\n", - "Enter Choice: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Linked List...\n", - "1.Insert\n", - "2.Display\n", - "3.Quit\n", - "Enter Choice: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " List traversal yields: 2 , 3 , 4 , \n", - "Linked List...\n", - "1.Insert\n", - "2.Display\n", - "3.Quit\n", - "Enter Choice: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-dll.cpp, Page no-462" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class dll:\n", - " def __init__(self, data_in=None):\n", - " if isinstance(data_in, int):\n", - " self.__data=data_in\n", - " else:\n", - " self.__data=0\n", - " self.__prev=None\n", - " self.__Next=None\n", - " def __del__(self):\n", - " pass\n", - " def get(self):\n", - " return self.__data\n", - " def insert(self, node):\n", - " last=dll()\n", - " last=self\n", - " while(last._dll__Next!=None):\n", - " last=last._dll__Next\n", - " node._dll__prev=last\n", - " node._dll__Next=None\n", - " last._dll__Next=node\n", - " def FreeAllNodes(self):\n", - " print \"Freeing the node with data:\",\n", - " first=dll()\n", - " first=self\n", - " while(1):\n", - " temp= dll()\n", - " temp=first\n", - " print \"->\", first._dll__data,\n", - " del temp\n", - " first=first._dll__Next\n", - " if first==None:\n", - " break\n", - "def display(first):\n", - " traverse=dll()\n", - " traverse=first\n", - " if first==None:\n", - " print \"Nothing to display !\"\n", - " return\n", - " else:\n", - " print \"Processing with forward -> pointer:\",\n", - " while(1): \n", - " print \"->\", traverse._dll__data, \n", - " if traverse._dll__Next==None:\n", - " break\n", - " traverse=traverse._dll__Next\n", - " print \"\\nProcessing with backward <- pointer:\",\n", - " while(1): \n", - " print \"->\", traverse._dll__data,\n", - " if traverse._dll__prev==None:\n", - " break\n", - " traverse=traverse._dll__prev\n", - " print \"\"\n", - "def InsertNode(first, data):\n", - " node=dll(data)\n", - " if first==None:\n", - " first=node\n", - " else:\n", - " first.insert(node)\n", - " return first\n", - "first=dll()\n", - "first=None\n", - "print \"Double Linked List Manipulation...\"\n", - "while(1):\n", - " choice=int(raw_input(\"Enter Choice ([1] Insert, [2] Display, [3]Quit: \"))\n", - " if choice==1:\n", - " data=int(raw_input(\"Enter data: \"))\n", - " first=InsertNode(first, data)\n", - " elif choice==2:\n", - " display(first)\n", - " elif choice==3:\n", - " first.FreeAllNodes()\n", - " break\n", - " else:\n", - " print \"Bad Option Selected\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Double Linked List Manipulation...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Processing with forward -> pointer: -> 3 \n", - "Processing with backward <- pointer: -> 3 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data: 7\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Processing with forward -> pointer: -> 3 -> 7 \n", - "Processing with backward <- pointer: -> 7 -> 3 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Processing with forward -> pointer: -> 3 -> 7 -> 5 \n", - "Processing with backward <- pointer: -> 5 -> 7 -> 3 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Bad Option Selected\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Choice ([1] Insert, [2] Display, [3]Quit: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Freeing the node with data: -> 3 -> 7 -> 5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-466" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class A:\n", - " __a1=int\n", - " def Set(self, val):\n", - " self.__a1=val\n", - "class B:\n", - " __b1=int\n", - " def Set(self, val):\n", - " self.__b1=val\n", - "def add(x, y):\n", - " return x._A__a1+y._B__b1\n", - "ObjA=A()\n", - "ObjB=B()\n", - "ObjA.Set(9)\n", - "ObjB.Set(10)\n", - "print \"Sum of objects A and B using friend function =\", add(ObjA, ObjB)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of objects A and B using friend function = 19\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-2, Page no-466" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class test:\n", - " __data=int\n", - " def func(self, val):\n", - " self.__data=val\n", - "t1=test()\n", - "testptr={}\n", - "testptr[0]=test.func #pointer to member function\n", - "print \"Initializing test class object t1 using pointer...\"\n", - "testptr[0](t1, 10)\n", - "print \"Object initialized successfully\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Initializing test class object t1 using pointer...\n", - "Object initialized successfully\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading.ipynb deleted file mode 100755 index 8c7b1cb8..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading.ipynb +++ /dev/null @@ -1,2673 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:31bc0d2b60eba6f6d92afa42e690cc5db6b40cd9b0c7b9682b1c923305d9cccd" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 13- Operator Overloading" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-index1.cpp, Page no-470" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Index:\n", - " __value=int\n", - " def __init__(self):\n", - " self.__value=0\n", - " def GetIndex(self):\n", - " return self.__value\n", - " def NextIndex(self):\n", - " self.__value=self.__value+1\n", - "idx1=Index()\n", - "idx2=Index()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "idx1.NextIndex()\n", - "idx2.NextIndex()\n", - "idx2.NextIndex()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Index1 = 0\n", - "Index2 = 0\n", - "Index1 = 1\n", - "Index2 = 2\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-index2.cpp, Page no-471" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Index:\n", - " __value=int\n", - " def __init__(self):\n", - " self.__value=0\n", - " def GetIndex(self):\n", - " return self.__value\n", - " #overload increment operator\n", - " def __iadd__(self, op):\n", - " self.__value=self.__value+op\n", - " return self\n", - "idx1=Index()\n", - "idx2=Index()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "idx1+=1 #overloaded increment operator invoked\n", - "idx2+=1 #overloaded increment operator invoked\n", - "idx2+=1 #overloaded increment operator invoked\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Index1 = 0\n", - "Index2 = 0\n", - "Index1 = 1\n", - "Index2 = 2\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-index3.cpp, Page no-475" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Index:\n", - " __value=int\n", - " def __init__(self):\n", - " self.__value=0\n", - " def GetIndex(self):\n", - " return self.__value\n", - " def __iadd__(self, op):\n", - " self.__value+=1\n", - " return self\n", - "idx1=Index()\n", - "idx2=Index()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "idx2+=1\n", - "idx1+=1\n", - "idx2+=1\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Index1 = 0\n", - "Index2 = 0\n", - "Index1 = 1\n", - "Index2 = 2\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-index4.cpp, Page no-476" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Index:\n", - " __value=int\n", - " def __init__(self):\n", - " self.__value=0\n", - " def GetIndex(self):\n", - " return self.__value\n", - " #overload increment operator\n", - " def __iadd__(self, op):\n", - " self.__value=self.__value+op\n", - " return self\n", - "idx1=Index()\n", - "idx2=Index()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "idx1+=1\n", - "idx2+=1\n", - "idx2+=1\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Index1 = 0\n", - "Index2 = 0\n", - "Index1 = 1\n", - "Index2 = 2\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-index5.cpp, Page no-478" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Index:\n", - " __value=int\n", - " def __init__(self, val=0):\n", - " self.__value=val\n", - " def GetIndex(self):\n", - " return self.__value\n", - " #overload increment operator\n", - " def __iadd__(self, op):\n", - " self.__value=self.__value+op\n", - " return self\n", - "idx1=Index(2)\n", - "idx2=Index(2)\n", - "idx3=Index()\n", - "idx4=Index()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "idx3._Index__value=idx1._Index__value\n", - "idx1+=1\n", - "idx2+=1\n", - "idx4=idx2\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index3 =\", idx3.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "print \"Index4 =\", idx4.GetIndex()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Index1 = 2\n", - "Index2 = 2\n", - "Index1 = 3\n", - "Index3 = 2\n", - "Index2 = 3\n", - "Index4 = 3\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-index6.cpp, Page no-479" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Index:\n", - " __value=int\n", - " def __init__(self, val=0):\n", - " self.__value=val\n", - " def GetIndex(self):\n", - " return self.__value\n", - " #overload increment operator\n", - " def __iadd__(self, op):\n", - " self.__value=self.__value+op\n", - " return self\n", - " #overload decrement operator\n", - " def __isub__(self, op):\n", - " self.__value=self.__value-op\n", - " return self\n", - " #overload negation operator\n", - " def __neg__(self):\n", - " return Index(-self.__value)\n", - "idx1=Index()\n", - "idx2=Index()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "idx2+=1\n", - "idx1=-idx2\n", - "idx2+=1\n", - "idx2-=1\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Index1 = 0\n", - "Index2 = 0\n", - "Index1 = -1\n", - "Index2 = 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mydate.cpp, Page no-480" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class date:\n", - " __day=int\n", - " __month=int\n", - " __year=int\n", - " def __init__(self, d=0, m=0, y=0):\n", - " if isinstance(d, int):\n", - " self.__day=d\n", - " self.__month=m\n", - " self.__year=y\n", - " else:\n", - " self.__day=0\n", - " self.__month=0\n", - " self.__year=0\n", - " def read(self):\n", - " self.__day, self.__month, self.__year=[int(x) for x in raw_input(\"Enter date
: \").split()]\n", - " def show(self):\n", - " print \"%s:%s:%s\" %(self.__day, self.__month, self.__year),\n", - " def IsLeapYear(self):\n", - " if (self.__year%4==0 and self.__year%100!=0) or (self.__year % 400==0):\n", - " return 1\n", - " else:\n", - " return 0\n", - " def thisMonthMaxDay(self):\n", - " m=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n", - " if self.__month==2 and self.IsLeapYear():\n", - " return 29\n", - " else:\n", - " return m[self.__month-1]\n", - " def __iadd__(self, op): #overloading increment operator\n", - " self.__day+=1\n", - " if self.__day>self.thisMonthMaxDay():\n", - " self.__day=1\n", - " self.__month+=1\n", - " if self.__month>12:\n", - " self.__month=1\n", - " self.__year+=1\n", - " return self\n", - "def nextday(d):\n", - " print 'Date', \n", - " d.show()\n", - " d+=1 #overloaded increment operator invoked\n", - " print \"on increment becomes\", \n", - " d.show()\n", - " print \"\"\n", - "d1=date(14, 4, 1971)\n", - "d2=date(28, 2, 1992)\n", - "d3=date(28, 2, 1993)\n", - "d4=date(31, 12, 1995)\n", - "nextday(d1)\n", - "nextday(d2)\n", - "nextday(d3)\n", - "nextday(d4)\n", - "today=date()\n", - "today.read()\n", - "nextday(today)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Date 14:4:1971 on increment becomes 15:4:1971 \n", - "Date 28:2:1992 on increment becomes 29:2:1992 \n", - "Date 28:2:1993 on increment becomes 1:3:1993 \n", - "Date 31:12:1995 on increment becomes 1:1:1996 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter date
: 11 9 1996\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Date 11:9:1996 on increment becomes 12:9:1996 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex1.cpp, Page no-483" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def AddComplex(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " AddComplex=AddComplex\n", - " def outdata(self, msg):\n", - " print \"%s(%0.1f, %0.1f)\" %(msg, self.__real, self.__imag)\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.getdata()\n", - "c3=c1.AddComplex(c2)\n", - "c3.outdata(\"c3 = c1.AddComplex(c2) : \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 2.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2.0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 1.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c3 = c1.AddComplex(c2) : (5.5, 3.5)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex2.cpp, Page no-484" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __add__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " #overloading + operator\n", - " __add__=__add__\n", - " def outdata(self, msg):\n", - " print \"%s(%0.1f, %0.1f)\" %(msg, self.__real, self.__imag)\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.getdata()\n", - "c3=c1+c2 #invoking the overloaded + operator\n", - "c3.outdata(\"c3 = c1 + c2: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 2.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2.0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 1.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c3 = c1 + c2: (5.5, 3.5)\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex3.cpp, Page no-487" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __add__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "def __sub__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real-c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag-c2._Complex__imag\n", - " return temp\n", - "def __mul__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real*c2._Complex__real-self._Complex__imag*c2._Complex__imag\n", - " temp._Complex__imag=self._Complex__real*c2._Complex__imag+self._Complex__imag*c2._Complex__real\n", - " return temp\n", - "def __div__(self, c2):\n", - " temp=Complex()\n", - " qt=c2._Complex__real*c2._Complex__real+c2._Complex__imag *c2._Complex__imag\n", - " temp._Complex__real=(self._Complex__real*c2._Complex__real+self._Complex__imag*c2._Complex__imag)/qt\n", - " temp._Complex__imag=(self._Complex__imag*c2._Complex__real-self._Complex__real*c2._Complex__imag)/qt\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " #overloading +, -, * and / operator\n", - " __add__=__add__\n", - " __sub__=__sub__\n", - " __mul__=__mul__\n", - " __div__=__div__\n", - " def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.getdata()\n", - "print \"Entered Complex numbers are...\"\n", - "c1.outdata(\"c1 = \")\n", - "c2.outdata(\"c2 = \")\n", - "print \"Computational results are...\"\n", - "c3=c1+c2 #invoking the overloaded + operator\n", - "c3.outdata(\"c3 = c1 + c2: \")\n", - "c3=c1-c2 #invoking the overloaded - operator\n", - "c3.outdata(\"c3 = c1 - c2: \")\n", - "c3=c1*c2 #invoking the overloaded * operator\n", - "c3.outdata(\"c3 = c1 * c2: \")\n", - "c3=c1/c2 #invoking the overloaded / operator\n", - "c3.outdata(\"c3 = c1 / c2: \")\n", - "c3 = c1 + c2 + c1 + c2\n", - "c3.outdata(\"c3 = c1 + c2 + c1 + c2: \")\n", - "c3 = c1 * c2 + c1 / c2\n", - "c3.outdata(\"c3 = c1 * c2 + c1 / c2: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 2.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2.0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 1.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Entered Complex numbers are...\n", - "c1 = (2.5, 2)\n", - "c2 = (3, 1.5)\n", - "Computational results are...\n", - "c3 = c1 + c2: (5.5, 3.5)\n", - "c3 = c1 - c2: (-0.5, 0.5)\n", - "c3 = c1 * c2: (4.5, 9.75)\n", - "c3 = c1 / c2: (0.933333, 0.2)\n", - "c3 = c1 + c2 + c1 + c2: (11, 7)\n", - "c3 = c1 * c2 + c1 / c2: (5.43333, 9.95)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-string.cpp, Page no-490" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "BUFF_SIZE=50\n", - "class string:\n", - " __Str=[None]*BUFF_SIZE\n", - " def __init__(self, MyStr=None):\n", - " if isinstance(MyStr, str):\n", - " self.__Str=MyStr\n", - " else:\n", - " self.__Str=\"\"\n", - " def echo(self):\n", - " print self.__Str\n", - " def __add__(self, s):\n", - " temp=string(self._string__Str)\n", - " temp._string__Str+=s._string__Str\n", - " return temp\n", - "str1=string(\"Welcome to \")\n", - "str2=string(\"Operator Overloading\")\n", - "str3=string()\n", - "print \"Before str3 = str1 + str2;..\"\n", - "print \"str1 = \",\n", - "str1.echo()\n", - "print \"str2 = \",\n", - "str2.echo()\n", - "print \"str3 = \",\n", - "str3.echo()\n", - "str3=str1+str2\n", - "print \"After str3 = str1 + str2;..\"\n", - "print \"str1 = \",\n", - "str1.echo()\n", - "print \"str2 = \",\n", - "str2.echo()\n", - "print \"str3 = \",\n", - "str3.echo()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Before str3 = str1 + str2;..\n", - "str1 = Welcome to \n", - "str2 = Operator Overloading\n", - "str3 = \n", - "After str3 = str1 + str2;..\n", - "str1 = Welcome to \n", - "str2 = Operator Overloading\n", - "str3 = Welcome to Operator Overloading\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-idxcmp.cpp, Page no-491" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "(false, true)=(0, 1) #enum type\n", - "type =['false', 'true']\n", - "class Index:\n", - " __value=int\n", - " def __init__(self, val=0):\n", - " self.__value=val\n", - " def GetIndex(self):\n", - " return self.__value\n", - " #overloading < operator\n", - " def __lt__(self, idx):\n", - " return true if self.__value operator\n", - " def __gt__(self, s):\n", - " if self.__Str > s.__Str:\n", - " return true\n", - " else:\n", - " return false\n", - " #overloading == operator\n", - " def __eq__(self, MyStr):\n", - " if self.__Str ==MyStr:\n", - " return true\n", - " else:\n", - " return false\n", - "str1=string()\n", - "str2=string()\n", - "while(1):\n", - " print \"Enter String1 <'end' to stop>:\",\n", - " str1.read()\n", - " if str1==\"end\": #using overloaded == operator\n", - " break\n", - " print 'Enter String2:',\n", - " str2.read()\n", - " print 'Comparison status:',\n", - " str1.echo()\n", - " if str1str2:\n", - " print \">\", #using overloaded > operator\n", - " else:\n", - " print \"=\",\n", - " str2.echo()\n", - " print \"\"\n", - "print \"Bye.!! That's all folks.!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter String1 <'end' to stop>:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "C\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter String2:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "C++\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Comparison status: C < C++ \n", - "Enter String1 <'end' to stop>:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rajkumar\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter String2:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Bindu\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Comparison status: Rajkumar > Bindu \n", - "Enter String1 <'end' to stop>:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rajkumar\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter String2:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Venugopal\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Comparison status: Rajkumar < Venugopal \n", - "Enter String1 <'end' to stop>:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "HELLO\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter String2:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "HELLO\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Comparison status: HELLO = HELLO \n", - "Enter String1 <'end' to stop>:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "end\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Bye.!! That's all folks.!\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex4.cpp, Page no-495" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __iadd__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "def __isub__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real-c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag-c2._Complex__imag\n", - " return temp\n", - "def __imul__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real*c2._Complex__real-self._Complex__imag*c2._Complex__imag\n", - " temp._Complex__imag=self._Complex__real*c2._Complex__imag+self._Complex__imag*c2._Complex__real\n", - " return temp\n", - "def __idiv__(self, c2):\n", - " temp=Complex()\n", - " qt=c2._Complex__real*c2._Complex__real+c2._Complex__imag *c2._Complex__imag\n", - " temp._Complex__real=(self._Complex__real*c2._Complex__real+self._Complex__imag*c2._Complex__imag)/qt\n", - " temp._Complex__imag=(self._Complex__imag*c2._Complex__real-self._Complex__real*c2._Complex__imag)/qt\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " #overloading +=, -=, *= and /= operator\n", - " __iadd__=__iadd__\n", - " __isub__=__isub__\n", - " __imul__=__imul__\n", - " __idiv__=__idiv__\n", - " def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.getdata()\n", - "print \"Entered Complex numbers are...\"\n", - "c1.outdata(\"c1 = \")\n", - "c2.outdata(\"c2 = \")\n", - "print \"Computational results are...\"\n", - "c3=c1 \n", - "c3+=c2 #invoking the overloaded += operator\n", - "c3.outdata(\"let c3 = c1, c3+=c2: \")\n", - "c3=c1 \n", - "c3-=c2 #invoking the overloaded -= operator\n", - "c3.outdata(\"let c3 = c1, c3-=c2: \")\n", - "c3=c1 \n", - "c3*=c2 #invoking the overloaded *= operator\n", - "c3.outdata(\"let c3 = c1, c3*=c2: \")\n", - "c3=c1 \n", - "c3/=c2 #invoking the overloaded / operator\n", - "c3.outdata(\"let c3 = c1, c3/=c2: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 2.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2.0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 1.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Entered Complex numbers are...\n", - "c1 = (2.5, 2)\n", - "c2 = (3, 1.5)\n", - "Computational results are...\n", - "let c3 = c1, c3+=c2: (5.5, 3.5)\n", - "let c3 = c1, c3-=c2: (-0.5, 0.5)\n", - "let c3 = c1, c3*=c2: (4.5, 9.75)\n", - "let c3 = c1, c3/=c2: (0.933333, 0.2)\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex-5.cpp, Page no-498" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __iadd__(self, c2):\n", - " self._Complex__real=self._Complex__real+c2._Complex__real\n", - " self._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return self\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " #overloading += operator\n", - " __iadd__=__iadd__\n", - " def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.getdata()\n", - "c1 += c2 #using overloaded += operator\n", - "c3 = c1\n", - "print \"On execution of c3 = c1 += c2..\"\n", - "c1.outdata(\"Complex c1: \")\n", - "c2.outdata(\"Complex c2: \")\n", - "c3.outdata(\"Complex c3: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 2.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2.0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 1.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On execution of c3 = c1 += c2..\n", - "Complex c1: (5.5, 3.5)\n", - "Complex c2: (3, 1.5)\n", - "Complex c3: (5.5, 3.5)\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-resource.cpp, Page no-499" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ARRAY_SIZE=10\n", - "def read(self):\n", - " for i in range(ARRAY_SIZE):\n", - " print \"vector[\", i, \"] = ? \",\n", - " self._vector__array[i]=int(raw_input())\n", - "def sum(self):\n", - " Sum=0\n", - " for i in range(ARRAY_SIZE):\n", - " Sum+=self._vector__array[i]\n", - " return Sum\n", - "class vector:\n", - " __array=[int]\n", - " def new(self):\n", - " myvector=vector()\n", - " myvector.__array=[int]*ARRAY_SIZE\n", - " return myvector\n", - " def delete(self):\n", - " del self\n", - " read=read\n", - " sum=sum\n", - "my_vector=vector()\n", - "my_vector=my_vector.new()\n", - "print \"Enter Vector data...\"\n", - "my_vector.read()\n", - "print \"Sum of Vector =\", my_vector.sum()\n", - "del my_vector" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Vector data...\n", - "vector[ 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 2 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 3 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 4 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 5 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 6 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "7\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 7 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 8 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 9 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Sum of Vector = 55\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-meter.cpp, Page no-504" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Meter:\n", - " __length=float\n", - " def __init__(self, InitLength=0.0):\n", - " self.__length=InitLength/100.0\n", - " def float(self):\n", - " LengthCms=self.__length*100.0\n", - " return LengthCms\n", - " def GetLength(self):\n", - " self.__length=float(raw_input(\"Enter Length (in meters): \"))\n", - " def ShowLength(self):\n", - " print \"Length (in meter) =\", self.__length\n", - "length1=float(raw_input(\"Enter Lenthg (in cms): \"))\n", - "meter1=Meter(length1)\n", - "meter1.ShowLength()\n", - "meter2=Meter()\n", - "length2=float\n", - "meter2.GetLength()\n", - "length2=meter2.float()\n", - "print \"Length (in cms) =\", length2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Lenthg (in cms): 150.0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Length (in meter) = 1.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Length (in meters): 1.669\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Length (in cms) = 166.9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-strconv.cpp, Page no-506" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "BUFF_SIZE=50\n", - "class string:\n", - " __Str=[None]*BUFF_SIZE\n", - " def __init__(self, MyStr=None):\n", - " if isinstance(MyStr, str):\n", - " self.__Str=MyStr\n", - " else:\n", - " self.__Str=\"\"\n", - " def echo(self):\n", - " print self.__Str\n", - " def char(self):\n", - " return self.__Str\n", - "msg=\"OOPs the Great\"\n", - "str1=string(msg)\n", - "print \"str1 =\",\n", - "str1.echo()\n", - "str2=string(\"It is nice to learn\")\n", - "receive=str2.char()\n", - "print \"Str2 =\", receive" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "str1 = OOPs the Great\n", - "Str2 = It is nice to learn\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-d2r1.cpp, Page no-509 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "PI=3.141592654\n", - "class Radian:\n", - " __rad=float\n", - " def __init__(self, InitRad=0.0):\n", - " self.__rad=InitRad\n", - " def GetRadian(self):\n", - " return self.__rad\n", - " def Output(self):\n", - " print \"Radian =\", self.GetRadian()\n", - "class Degree:\n", - " __degree=float\n", - " def __init__(self):\n", - " self.__degree=0.0\n", - " def Radian(self):\n", - " return ( Radian(self.__degree * PI / 180.0))\n", - " def Input(self):\n", - " self.__degree=float(raw_input(\"Enter degree: \"))\n", - "deg1=Degree()\n", - "deg1.Input()\n", - "rad1=deg1.Radian()\n", - "rad1.Output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter degree: 180\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Radian = 3.141592654\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-d2r2.cpp, Page no-512" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "PI=3.141592654\n", - "class Degree:\n", - " __degree=float\n", - " def __init__(self):\n", - " self.__degree=0.0\n", - " def GetDegree(self):\n", - " return self.__degree\n", - " def Input(self):\n", - " self.__degree=float(raw_input(\"Enter degree: \"))\n", - "class Radian:\n", - " __rad=float\n", - " def __init__(self, deg=None):\n", - " if isinstance(deg , Degree):\n", - " self.__rad=deg.GetDegree()*PI/180.0\n", - " else:\n", - " self.__rad=0.0\n", - " def GetRadian(self):\n", - " return self.__rad\n", - " def Output(self):\n", - " print \"Radian =\", self.GetRadian()\n", - "deg1=Degree()\n", - "deg1.Input()\n", - "rad1=Radian(deg1)\n", - "rad1.Output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter degree: 90\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Radian = 1.570796327\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-degrad.cpp, Page no-514" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "PI=3.141592654\n", - "class Radian:\n", - " __rad=float\n", - " def __init__(self, InitRad=0.0):\n", - " self.__rad=InitRad\n", - " def GetRadian(self):\n", - " return self.__rad\n", - " def Input(self):\n", - " self.__rad=float(raw_input(\"Enter radian: \"))\n", - " def Output(self):\n", - " print \"Radian =\", self.GetRadian()\n", - "class Degree:\n", - " __degree=float\n", - " def __init__(self, rad=None):\n", - " if isinstance(rad, Radian):\n", - " self.__degree=rad.GetRadian()*180.0/PI\n", - " else:\n", - " self.__degree=0.0\n", - " def GetDegree(self):\n", - " return self.__degree\n", - " def Radian(self):\n", - " return ( Radian(self.__degree * PI / 180.0))\n", - " def Input(self):\n", - " self.__degree=float(raw_input(\"Enter degree: \"))\n", - " def Output(self):\n", - " print \"Degree =\", self.__degree\n", - "deg1=Degree()\n", - "deg1.Input()\n", - "rad1=deg1.Radian()\n", - "rad1.Output()\n", - "rad2=Radian()\n", - "rad2.Input()\n", - "deg2=Degree(rad2)\n", - "deg2.Output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter degree: 180\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Radian = 3.141592654\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter radian: 3.142\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Degree = 180.023339207\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-script.cpp, Page no-516" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class AccountEntry(Structure):\n", - " _fields_=[('number',c_int), ('name', c_char*25)]\n", - "class AccountBook:\n", - " __aCount=int\n", - " __account=[AccountEntry]\n", - " def __init__(self, aCountIn):\n", - " self.__aCount=aCountIn\n", - " for i in range(self.__aCount):\n", - " self.__account.append(AccountEntry())\n", - " def op(self, nameIn):\n", - " if isinstance(nameIn, str):\n", - " for i in range(self.__aCount):\n", - " if nameIn==self.__account[i].name:\n", - " return self.__account[i].number\n", - " elif isinstance(nameIn, int): #numberIn\n", - " for i in range(self.__aCount):\n", - " #print self.__account[i].number\n", - " if nameIn==self.__account[i].number:\n", - " return self.__account[i].name\n", - " def AccountEntry(self):\n", - " for i in range(self.__aCount):\n", - " self.__account[i].number=int(raw_input(\"Account Number: \"))\n", - " self.__account[i].name=raw_input(\"Account Holder Name: \")\n", - "accounts=AccountBook(5)\n", - "print \"Building 5 Customers Database\"\n", - "accounts.AccountEntry()\n", - "print \"Accessing Accounts Information\"\n", - "accno=int(raw_input(\"To access Name Enter Account Number: \"))\n", - "print \"Name:\",accounts.op(accno) #accounts[accno]\n", - "name=raw_input(\"To access Account Number, Enter Name: \")\n", - "print \"Account Number:\",accounts.op(name) #accounts[name]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Building 5 Customers Database\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Number: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Holder Name: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Number: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Holder Name: Kiran\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Number: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Holder Name: Ravishanker\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Number: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Holder Name: Anand\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Number: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Holder Name: Sindhu\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Accessing Accounts Information\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "To access Name Enter Account Number: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "To access Account Number, Enter Name: Sindhu\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Number: 5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex6.cpp, Page no-519" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def readdata(self):\n", - " self._Complex__real=float(raw_input(\"Real part ? \"))\n", - " self._Complex__imag=float(raw_input(\"Imag part ? \"))\n", - "def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self._Complex__real, self._Complex__imag)\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " readdata=readdata\n", - " outdata=outdata\n", - " def __neg__(self):\n", - " return neg(self)\n", - "#friend function overloading unary minus operator\n", - "def neg(c1):\n", - " c=Complex()\n", - " c._Complex__real=-c1._Complex__real\n", - " c._Complex__imag=-c1._Complex__imag\n", - " return c\n", - "c1=Complex()\n", - "c2=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.readdata()\n", - "c2=-c1\n", - "c1.outdata(\"Complex c1 : \")\n", - "c2.outdata(\"Complex c2 = -Complex c1: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 1.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? -2.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Complex c1 : (1.5, -2.5)\n", - "Complex c2 = -Complex c1: (-1.5, 2.5)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex7.cpp, Page no-520" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def readdata(self):\n", - " self._Complex__real=float(raw_input(\"Real part ? \"))\n", - " self._Complex__imag=float(raw_input(\"Imag part ? \"))\n", - "def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self._Complex__real, self._Complex__imag)\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " readdata=readdata\n", - " outdata=outdata\n", - " def __neg__(self):\n", - " return neg(self)\n", - "#friend function overloading unary minus operator\n", - "def neg(c1):\n", - " c1._Complex__real=-c1._Complex__real\n", - " c1._Complex__imag=-c1._Complex__imag\n", - "c1=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.readdata()\n", - "-c1\n", - "c1.outdata(\"Complex c1 : \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 1.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? -2.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Complex c1 : (-1.5, 2.5)\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex8.cpp, Page no-522" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self, realpart=0):\n", - " if isinstance(realpart, float):\n", - " self.__real=realpart\n", - " self.__imag=0\n", - " def readdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", - " def __add__(self, c2):\n", - " return add(self, c2)\n", - "#friend function overloading + operator\n", - "def add(c1, c2):\n", - " c=Complex()\n", - " c._Complex__real=c1._Complex__real+c2._Complex__real\n", - " c._Complex__imag=c1._Complex__imag+c2._Complex__imag\n", - " return c\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex(3)\n", - "print \"Enter Complex Number c1...\"\n", - "c1.readdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.readdata()\n", - "c3=c1+c2\n", - "c3.outdata(\"Result of c3 = c1 + c2: \")\n", - "c3=c1+Complex(2.0)\n", - "c3.outdata(\"Result of c3 = c1 + 2.0: \")\n", - "c3=Complex(3.0)+c2\n", - "c3.outdata(\"Result of c3 = 3.0 + c2: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Result of c3 = c1 + c2: (4, 6)\n", - "Result of c3 = c1 + 2.0: (3, 2)\n", - "Result of c3 = 3.0 + c2: (6, 4)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex9.cpp, Page no-525" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self, InReal=0):\n", - " if isinstance(InReal, float):\n", - " self.__real=InReal\n", - " self.__imag=0\n", - " def readdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", - " def __add__(self, c2):\n", - " return add(self, c2)\n", - "#friend function overloading + operator\n", - "def add(c1, c2):\n", - " c=Complex()\n", - " c._Complex__real=c1._Complex__real+c2._Complex__real\n", - " c._Complex__imag=c1._Complex__imag+c2._Complex__imag\n", - " return c\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex(3)\n", - "print \"Enter Complex Number c1...\"\n", - "c1.readdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.readdata()\n", - "c3=c1+c2\n", - "c3.outdata(\"Result of c3 = c1 + c2: \")\n", - "c3=c1+Complex(2.0)\n", - "c3.outdata(\"Result of c3 = c1 + 2.0: \")\n", - "c3=Complex(3.0)+c2\n", - "c3.outdata(\"Result of c3 = 3.0 + c2: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Result of c3 = c1 + c2: (4, 6)\n", - "Result of c3 = c1 + 2.0: (3, 2)\n", - "Result of c3 = 3.0 + c2: (6, 4)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector.cpp, Page no-528" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "def __assign__(self, v2):\n", - " print \"Assignment operation invoked\"\n", - " for i in range(v2._vector__size):\n", - " self._vector__v[i]=v2._vector__v[i]\n", - "def show(self):\n", - " for i in range(self._vector__size):\n", - " print self.elem(i), \",\",\n", - "class vector:\n", - " __v=[int]\n", - " __size=int\n", - " def __init__(self, vector_size):\n", - " if isinstance(vector_size, int):\n", - " self.__size=vector_size\n", - " self.__v=[int]*self.__size\n", - " if isinstance(vector_size, vector):\n", - " print \"Copy constructor invoked\"\n", - " self.__size=vector_size.__size\n", - " self.__v=[int]*self.__size\n", - " for i in range(vector_size.__size):\n", - " self.__v[i]=vector_size.__v[i]\n", - " def __del__(self):\n", - " del self.__v\n", - " __assign__=__assign__\n", - " def elem(self, i, x=None):\n", - " if isinstance(x, int):\n", - " if i>=self.__size:\n", - " print \"Error: Out of Range\"\n", - " self.__v[i]=x\n", - " else:\n", - " return self.__v[i]\n", - " show=show\n", - "v1=vector(5)\n", - "v2=vector(5)\n", - "for i in range(5):\n", - " v2.elem(i, i+1)\n", - "v1 = v2\n", - "v3 = vector(v2)\n", - "print \"Vector v1:\",\n", - "v1.show()\n", - "print \"\\nVector v2:\",\n", - "v2.show()\n", - "print \"\\nVector v3:\",\n", - "v3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Copy constructor invoked\n", - "Vector v1: 1 , 2 , 3 , 4 , 5 , \n", - "Vector v2: 1 , 2 , 3 , 4 , 5 , \n", - "Vector v3: 1 , 2 , 3 , 4 , 5 ,\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mleak.cpp, Page no-530" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "vector=[int]*10\n", - "buffer=[chr]*6\n", - "for i in range(10):\n", - " vector[i]=i+1\n", - "buffer=\"hello\"\n", - "for i in range(10):\n", - " print vector[i],\n", - "print \"\\nbuffer =\", buffer\n", - "del vector" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1 2 3 4 5 6 7 8 9 10 \n", - "buffer = hello\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-misuse.cpp, Page no-533" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class number:\n", - " __num=int\n", - " def read(self):\n", - " self.__num=int(raw_input())\n", - " def get(self):\n", - " return self.__num\n", - " def __add__(self, num2):\n", - " Sum=number()\n", - " Sum.__num=self.__num-num2.__num #subtraction instead of addition\n", - " return Sum\n", - "num1=number()\n", - "num2=number()\n", - "Sum=number()\n", - "print \"Enter Number 1: \",\n", - "num1.read()\n", - "print \"Enter Number 2: \",\n", - "num2.read()\n", - "Sum=num1+num2 #addition of two numbers\n", - "print \"sum = num1 + num2 =\", Sum.get()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Number 1: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Number 2: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " sum = num1 + num2 = -5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-537" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __add__(self, d2):\n", - " temp_date=date()\n", - " temp_date._date__sec=self._date__sec+d2._date__sec\n", - " if(temp_date._date__sec>=60):\n", - " temp_date._date__min+=1\n", - " temp_date._date__sec=temp_date._date__sec-60\n", - " temp_date._date__min=temp_date._date__min+self._date__min+d2._date__min\n", - " if(temp_date._date__min>=60):\n", - " temp_date._date__hr+=1\n", - " temp_date._date__min=temp_date._date__min-60\n", - " temp_date._date__hr=self._date__hr+d2._date__hr\n", - " return temp_date\n", - "class date:\n", - " __hr=int\n", - " __min=int\n", - " __sec=int\n", - " def __init__(self, h=0, m=0, s=0):\n", - " self.__hr=h\n", - " self.__min=m\n", - " self.__sec=s\n", - " def show(self):\n", - " print \"%d hours, %d minutes, %d seconds\" %(self.__hr, self.__min, self.__sec),\n", - " __add__=__add__\n", - "date1=date(2, 4, 56)\n", - "date2=date(10, 59, 11)\n", - "date3=date()\n", - "date3=date1+date2\n", - "date1.show()\n", - "print \"+\",\n", - "date2.show()\n", - "print \"=\",\n", - "date3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "2 hours, 4 minutes, 56 seconds + 10 hours, 59 minutes, 11 seconds = 12 hours, 4 minutes, 7 seconds\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-2, Page no-538" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __add__(self, b2):\n", - " temp_basket=basket()\n", - " temp_basket._basket__apples=self._basket__apples+b2._basket__apples\n", - " temp_basket._basket__mangoes=self._basket__mangoes+b2._basket__mangoes\n", - " return temp_basket\n", - "class basket:\n", - " __apples=int\n", - " __mangoes=int\n", - " def __init__(self, a=0, m=0):\n", - " self.__apples=a\n", - " self.__mangoes=m\n", - " def show(self):\n", - " print self.__apples, \" Apples and\", self.__mangoes, \" Mangoes\"\n", - " __add__=__add__ # overloading + operator\n", - "basket1=basket(7, 10)\n", - "basket2=basket(4, 5)\n", - "basket3=basket()\n", - "print \"Basket 1 contains:\"\n", - "basket1.show()\n", - "print \"Basket 2 contains:\"\n", - "basket2.show()\n", - "basket3=basket1+basket2 #using overloaded + operator\n", - "print \"Adding fruits from Basket 1 and Basket 2 results in:\"\n", - "basket3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Basket 1 contains:\n", - "7 Apples and 10 Mangoes\n", - "Basket 2 contains:\n", - "4 Apples and 5 Mangoes\n", - "Adding fruits from Basket 1 and Basket 2 results in:\n", - "11 Apples and 15 Mangoes\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading_1.ipynb deleted file mode 100755 index b67f9d8d..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter13-OperatorOverloading_1.ipynb +++ /dev/null @@ -1,2672 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:00870b63d144b6d5646400a298500edb387bcdbf86f8e9aa2b7d22e37fa4432a" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 13- Operator Overloading" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-index1.cpp, Page no-470" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Index:\n", - " __value=int\n", - " def __init__(self):\n", - " self.__value=0\n", - " def GetIndex(self):\n", - " return self.__value\n", - " def NextIndex(self):\n", - " self.__value=self.__value+1\n", - "idx1=Index()\n", - "idx2=Index()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "idx1.NextIndex()\n", - "idx2.NextIndex()\n", - "idx2.NextIndex()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Index1 = 0\n", - "Index2 = 0\n", - "Index1 = 1\n", - "Index2 = 2\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-index2.cpp, Page no-471" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Index:\n", - " __value=int\n", - " def __init__(self):\n", - " self.__value=0\n", - " def GetIndex(self):\n", - " return self.__value\n", - " #overload increment operator\n", - " def __iadd__(self, op):\n", - " self.__value=self.__value+op\n", - " return self\n", - "idx1=Index()\n", - "idx2=Index()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "idx1+=1 #overloaded increment operator invoked\n", - "idx2+=1 #overloaded increment operator invoked\n", - "idx2+=1 #overloaded increment operator invoked\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Index1 = 0\n", - "Index2 = 0\n", - "Index1 = 1\n", - "Index2 = 2\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-index3.cpp, Page no-475" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Index:\n", - " __value=int\n", - " def __init__(self):\n", - " self.__value=0\n", - " def GetIndex(self):\n", - " return self.__value\n", - " def __iadd__(self, op):\n", - " self.__value+=1\n", - " return self\n", - "idx1=Index()\n", - "idx2=Index()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "idx2+=1\n", - "idx1+=1\n", - "idx2+=1\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Index1 = 0\n", - "Index2 = 0\n", - "Index1 = 1\n", - "Index2 = 2\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-index4.cpp, Page no-476" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Index:\n", - " __value=int\n", - " def __init__(self):\n", - " self.__value=0\n", - " def GetIndex(self):\n", - " return self.__value\n", - " #overload increment operator\n", - " def __iadd__(self, op):\n", - " self.__value=self.__value+op\n", - " return self\n", - "idx1=Index()\n", - "idx2=Index()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "idx1+=1\n", - "idx2+=1\n", - "idx2+=1\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Index1 = 0\n", - "Index2 = 0\n", - "Index1 = 1\n", - "Index2 = 2\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-index5.cpp, Page no-478" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Index:\n", - " __value=int\n", - " def __init__(self, val=0):\n", - " self.__value=val\n", - " def GetIndex(self):\n", - " return self.__value\n", - " #overload increment operator\n", - " def __iadd__(self, op):\n", - " self.__value=self.__value+op\n", - " return self\n", - "idx1=Index(2)\n", - "idx2=Index(2)\n", - "idx3=Index()\n", - "idx4=Index()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "idx3._Index__value=idx1._Index__value\n", - "idx1+=1\n", - "idx2+=1\n", - "idx4=idx2\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index3 =\", idx3.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "print \"Index4 =\", idx4.GetIndex()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Index1 = 2\n", - "Index2 = 2\n", - "Index1 = 3\n", - "Index3 = 2\n", - "Index2 = 3\n", - "Index4 = 3\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-index6.cpp, Page no-479" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Index:\n", - " __value=int\n", - " def __init__(self, val=0):\n", - " self.__value=val\n", - " def GetIndex(self):\n", - " return self.__value\n", - " #overload increment operator\n", - " def __iadd__(self, op):\n", - " self.__value=self.__value+op\n", - " return self\n", - " #overload decrement operator\n", - " def __isub__(self, op):\n", - " self.__value=self.__value-op\n", - " return self\n", - " #overload negation operator\n", - " def __neg__(self):\n", - " return Index(-self.__value)\n", - "idx1=Index()\n", - "idx2=Index()\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()\n", - "idx2+=1\n", - "idx1=-idx2\n", - "idx2+=1\n", - "idx2-=1\n", - "print \"Index1 =\", idx1.GetIndex()\n", - "print \"Index2 =\", idx2.GetIndex()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Index1 = 0\n", - "Index2 = 0\n", - "Index1 = -1\n", - "Index2 = 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mydate.cpp, Page no-480" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class date:\n", - " __day=int\n", - " __month=int\n", - " __year=int\n", - " def __init__(self, d=0, m=0, y=0):\n", - " if isinstance(d, int):\n", - " self.__day=d\n", - " self.__month=m\n", - " self.__year=y\n", - " else:\n", - " self.__day=0\n", - " self.__month=0\n", - " self.__year=0\n", - " def read(self):\n", - " self.__day, self.__month, self.__year=[int(x) for x in raw_input(\"Enter date
: \").split()]\n", - " def show(self):\n", - " print \"%s:%s:%s\" %(self.__day, self.__month, self.__year),\n", - " def IsLeapYear(self):\n", - " if (self.__year%4==0 and self.__year%100!=0) or (self.__year % 400==0):\n", - " return 1\n", - " else:\n", - " return 0\n", - " def thisMonthMaxDay(self):\n", - " m=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n", - " if self.__month==2 and self.IsLeapYear():\n", - " return 29\n", - " else:\n", - " return m[self.__month-1]\n", - " def __iadd__(self, op): #overloading increment operator\n", - " self.__day+=1\n", - " if self.__day>self.thisMonthMaxDay():\n", - " self.__day=1\n", - " self.__month+=1\n", - " if self.__month>12:\n", - " self.__month=1\n", - " self.__year+=1\n", - " return self\n", - "def nextday(d):\n", - " print 'Date', \n", - " d.show()\n", - " d+=1 #overloaded increment operator invoked\n", - " print \"on increment becomes\", \n", - " d.show()\n", - " print \"\"\n", - "d1=date(14, 4, 1971)\n", - "d2=date(28, 2, 1992)\n", - "d3=date(28, 2, 1993)\n", - "d4=date(31, 12, 1995)\n", - "nextday(d1)\n", - "nextday(d2)\n", - "nextday(d3)\n", - "nextday(d4)\n", - "today=date()\n", - "today.read()\n", - "nextday(today)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Date 14:4:1971 on increment becomes 15:4:1971 \n", - "Date 28:2:1992 on increment becomes 29:2:1992 \n", - "Date 28:2:1993 on increment becomes 1:3:1993 \n", - "Date 31:12:1995 on increment becomes 1:1:1996 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter date
: 11 9 1996\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Date 11:9:1996 on increment becomes 12:9:1996 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex1.cpp, Page no-483" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def AddComplex(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " AddComplex=AddComplex\n", - " def outdata(self, msg):\n", - " print \"%s(%0.1f, %0.1f)\" %(msg, self.__real, self.__imag)\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.getdata()\n", - "c3=c1.AddComplex(c2)\n", - "c3.outdata(\"c3 = c1.AddComplex(c2) : \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 2.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2.0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 1.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c3 = c1.AddComplex(c2) : (5.5, 3.5)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex2.cpp, Page no-484" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __add__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " #overloading + operator\n", - " __add__=__add__\n", - " def outdata(self, msg):\n", - " print \"%s(%0.1f, %0.1f)\" %(msg, self.__real, self.__imag)\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.getdata()\n", - "c3=c1+c2 #invoking the overloaded + operator\n", - "c3.outdata(\"c3 = c1 + c2: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 2.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2.0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 1.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c3 = c1 + c2: (5.5, 3.5)\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex3.cpp, Page no-487" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __add__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "def __sub__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real-c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag-c2._Complex__imag\n", - " return temp\n", - "def __mul__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real*c2._Complex__real-self._Complex__imag*c2._Complex__imag\n", - " temp._Complex__imag=self._Complex__real*c2._Complex__imag+self._Complex__imag*c2._Complex__real\n", - " return temp\n", - "def __div__(self, c2):\n", - " temp=Complex()\n", - " qt=c2._Complex__real*c2._Complex__real+c2._Complex__imag *c2._Complex__imag\n", - " temp._Complex__real=(self._Complex__real*c2._Complex__real+self._Complex__imag*c2._Complex__imag)/qt\n", - " temp._Complex__imag=(self._Complex__imag*c2._Complex__real-self._Complex__real*c2._Complex__imag)/qt\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " #overloading +, -, * and / operator\n", - " __add__=__add__\n", - " __sub__=__sub__\n", - " __mul__=__mul__\n", - " __div__=__div__\n", - " def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.getdata()\n", - "print \"Entered Complex numbers are...\"\n", - "c1.outdata(\"c1 = \")\n", - "c2.outdata(\"c2 = \")\n", - "print \"Computational results are...\"\n", - "c3=c1+c2 #invoking the overloaded + operator\n", - "c3.outdata(\"c3 = c1 + c2: \")\n", - "c3=c1-c2 #invoking the overloaded - operator\n", - "c3.outdata(\"c3 = c1 - c2: \")\n", - "c3=c1*c2 #invoking the overloaded * operator\n", - "c3.outdata(\"c3 = c1 * c2: \")\n", - "c3=c1/c2 #invoking the overloaded / operator\n", - "c3.outdata(\"c3 = c1 / c2: \")\n", - "c3 = c1 + c2 + c1 + c2\n", - "c3.outdata(\"c3 = c1 + c2 + c1 + c2: \")\n", - "c3 = c1 * c2 + c1 / c2\n", - "c3.outdata(\"c3 = c1 * c2 + c1 / c2: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 2.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2.0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 1.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Entered Complex numbers are...\n", - "c1 = (2.5, 2)\n", - "c2 = (3, 1.5)\n", - "Computational results are...\n", - "c3 = c1 + c2: (5.5, 3.5)\n", - "c3 = c1 - c2: (-0.5, 0.5)\n", - "c3 = c1 * c2: (4.5, 9.75)\n", - "c3 = c1 / c2: (0.933333, 0.2)\n", - "c3 = c1 + c2 + c1 + c2: (11, 7)\n", - "c3 = c1 * c2 + c1 / c2: (5.43333, 9.95)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-string.cpp, Page no-490" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "BUFF_SIZE=50\n", - "class string:\n", - " __Str=[None]*BUFF_SIZE\n", - " def __init__(self, MyStr=None):\n", - " if isinstance(MyStr, str):\n", - " self.__Str=MyStr\n", - " else:\n", - " self.__Str=\"\"\n", - " def echo(self):\n", - " print self.__Str\n", - " def __add__(self, s):\n", - " temp=string(self._string__Str)\n", - " temp._string__Str+=s._string__Str\n", - " return temp\n", - "str1=string(\"Welcome to \")\n", - "str2=string(\"Operator Overloading\")\n", - "str3=string()\n", - "print \"Before str3 = str1 + str2;..\"\n", - "print \"str1 = \",\n", - "str1.echo()\n", - "print \"str2 = \",\n", - "str2.echo()\n", - "print \"str3 = \",\n", - "str3.echo()\n", - "str3=str1+str2\n", - "print \"After str3 = str1 + str2;..\"\n", - "print \"str1 = \",\n", - "str1.echo()\n", - "print \"str2 = \",\n", - "str2.echo()\n", - "print \"str3 = \",\n", - "str3.echo()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Before str3 = str1 + str2;..\n", - "str1 = Welcome to \n", - "str2 = Operator Overloading\n", - "str3 = \n", - "After str3 = str1 + str2;..\n", - "str1 = Welcome to \n", - "str2 = Operator Overloading\n", - "str3 = Welcome to Operator Overloading\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-idxcmp.cpp, Page no-491" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "(false, true)=(0, 1) #enum type\n", - "type =['false', 'true']\n", - "class Index:\n", - " __value=int\n", - " def __init__(self, val=0):\n", - " self.__value=val\n", - " def GetIndex(self):\n", - " return self.__value\n", - " #overloading < operator\n", - " def __lt__(self, idx):\n", - " return true if self.__value operator\n", - " def __gt__(self, s):\n", - " if self.__Str > s.__Str:\n", - " return true\n", - " else:\n", - " return false\n", - " #overloading == operator\n", - " def __eq__(self, MyStr):\n", - " if self.__Str ==MyStr:\n", - " return true\n", - " else:\n", - " return false\n", - "str1=string()\n", - "str2=string()\n", - "while(1):\n", - " print \"Enter String1 <'end' to stop>:\",\n", - " str1.read()\n", - " if str1==\"end\": #using overloaded == operator\n", - " break\n", - " print 'Enter String2:',\n", - " str2.read()\n", - " print 'Comparison status:',\n", - " str1.echo()\n", - " if str1str2:\n", - " print \">\", #using overloaded > operator\n", - " else:\n", - " print \"=\",\n", - " str2.echo()\n", - " print \"\"\n", - "print \"Bye.!! That's all folks.!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter String1 <'end' to stop>:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "C\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter String2:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "C++\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Comparison status: C < C++ \n", - "Enter String1 <'end' to stop>:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rajkumar\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter String2:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Bindu\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Comparison status: Rajkumar > Bindu \n", - "Enter String1 <'end' to stop>:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rajkumar\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter String2:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Venugopal\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Comparison status: Rajkumar < Venugopal \n", - "Enter String1 <'end' to stop>:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "HELLO\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter String2:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "HELLO\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Comparison status: HELLO = HELLO \n", - "Enter String1 <'end' to stop>:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "end\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Bye.!! That's all folks.!\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex4.cpp, Page no-495" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __iadd__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "def __isub__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real-c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag-c2._Complex__imag\n", - " return temp\n", - "def __imul__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real*c2._Complex__real-self._Complex__imag*c2._Complex__imag\n", - " temp._Complex__imag=self._Complex__real*c2._Complex__imag+self._Complex__imag*c2._Complex__real\n", - " return temp\n", - "def __idiv__(self, c2):\n", - " temp=Complex()\n", - " qt=c2._Complex__real*c2._Complex__real+c2._Complex__imag *c2._Complex__imag\n", - " temp._Complex__real=(self._Complex__real*c2._Complex__real+self._Complex__imag*c2._Complex__imag)/qt\n", - " temp._Complex__imag=(self._Complex__imag*c2._Complex__real-self._Complex__real*c2._Complex__imag)/qt\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " #overloading +=, -=, *= and /= operator\n", - " __iadd__=__iadd__\n", - " __isub__=__isub__\n", - " __imul__=__imul__\n", - " __idiv__=__idiv__\n", - " def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.getdata()\n", - "print \"Entered Complex numbers are...\"\n", - "c1.outdata(\"c1 = \")\n", - "c2.outdata(\"c2 = \")\n", - "print \"Computational results are...\"\n", - "c3=c1 \n", - "c3+=c2 #invoking the overloaded += operator\n", - "c3.outdata(\"let c3 = c1, c3+=c2: \")\n", - "c3=c1 \n", - "c3-=c2 #invoking the overloaded -= operator\n", - "c3.outdata(\"let c3 = c1, c3-=c2: \")\n", - "c3=c1 \n", - "c3*=c2 #invoking the overloaded *= operator\n", - "c3.outdata(\"let c3 = c1, c3*=c2: \")\n", - "c3=c1 \n", - "c3/=c2 #invoking the overloaded / operator\n", - "c3.outdata(\"let c3 = c1, c3/=c2: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 2.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2.0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 1.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Entered Complex numbers are...\n", - "c1 = (2.5, 2)\n", - "c2 = (3, 1.5)\n", - "Computational results are...\n", - "let c3 = c1, c3+=c2: (5.5, 3.5)\n", - "let c3 = c1, c3-=c2: (-0.5, 0.5)\n", - "let c3 = c1, c3*=c2: (4.5, 9.75)\n", - "let c3 = c1, c3/=c2: (0.933333, 0.2)\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex-5.cpp, Page no-498" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __iadd__(self, c2):\n", - " self._Complex__real=self._Complex__real+c2._Complex__real\n", - " self._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return self\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " #overloading += operator\n", - " __iadd__=__iadd__\n", - " def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.getdata()\n", - "c1 += c2 #using overloaded += operator\n", - "c3 = c1\n", - "print \"On execution of c3 = c1 += c2..\"\n", - "c1.outdata(\"Complex c1: \")\n", - "c2.outdata(\"Complex c2: \")\n", - "c3.outdata(\"Complex c3: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 2.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2.0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 1.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On execution of c3 = c1 += c2..\n", - "Complex c1: (5.5, 3.5)\n", - "Complex c2: (3, 1.5)\n", - "Complex c3: (5.5, 3.5)\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-resource.cpp, Page no-499" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ARRAY_SIZE=10\n", - "def read(self):\n", - " for i in range(ARRAY_SIZE):\n", - " print \"vector[\", i, \"] = ? \",\n", - " self._vector__array[i]=int(raw_input())\n", - "def sum(self):\n", - " Sum=0\n", - " for i in range(ARRAY_SIZE):\n", - " Sum+=self._vector__array[i]\n", - " return Sum\n", - "class vector:\n", - " __array=[int]\n", - " def new(self):\n", - " myvector=vector()\n", - " myvector.__array=[int]*ARRAY_SIZE\n", - " return myvector\n", - " def delete(self):\n", - " del self\n", - " read=read\n", - " sum=sum\n", - "my_vector=vector()\n", - "my_vector=my_vector.new()\n", - "print \"Enter Vector data...\"\n", - "my_vector.read()\n", - "print \"Sum of Vector =\", my_vector.sum()\n", - "del my_vector" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Vector data...\n", - "vector[ 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 2 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 3 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 4 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 5 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 6 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "7\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 7 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 8 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector[ 9 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Sum of Vector = 55\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-meter.cpp, Page no-504" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Meter:\n", - " __length=float\n", - " def __init__(self, InitLength=0.0):\n", - " self.__length=InitLength/100.0\n", - " def float(self):\n", - " LengthCms=self.__length*100.0\n", - " return LengthCms\n", - " def GetLength(self):\n", - " self.__length=float(raw_input(\"Enter Length (in meters): \"))\n", - " def ShowLength(self):\n", - " print \"Length (in meter) =\", self.__length\n", - "length1=float(raw_input(\"Enter Lenthg (in cms): \"))\n", - "meter1=Meter(length1)\n", - "meter1.ShowLength()\n", - "meter2=Meter()\n", - "length2=float\n", - "meter2.GetLength()\n", - "length2=meter2.float()\n", - "print \"Length (in cms) =\", length2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Lenthg (in cms): 150.0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Length (in meter) = 1.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Length (in meters): 1.669\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Length (in cms) = 166.9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-strconv.cpp, Page no-506" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "BUFF_SIZE=50\n", - "class string:\n", - " __Str=[None]*BUFF_SIZE\n", - " def __init__(self, MyStr=None):\n", - " if isinstance(MyStr, str):\n", - " self.__Str=MyStr\n", - " else:\n", - " self.__Str=\"\"\n", - " def echo(self):\n", - " print self.__Str\n", - " def char(self):\n", - " return self.__Str\n", - "msg=\"OOPs the Great\"\n", - "str1=string(msg)\n", - "print \"str1 =\",\n", - "str1.echo()\n", - "str2=string(\"It is nice to learn\")\n", - "receive=str2.char()\n", - "print \"Str2 =\", receive" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "str1 = OOPs the Great\n", - "Str2 = It is nice to learn\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-d2r1.cpp, Page no-509 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "PI=3.141592654\n", - "class Radian:\n", - " __rad=float\n", - " def __init__(self, InitRad=0.0):\n", - " self.__rad=InitRad\n", - " def GetRadian(self):\n", - " return self.__rad\n", - " def Output(self):\n", - " print \"Radian =\", self.GetRadian()\n", - "class Degree:\n", - " __degree=float\n", - " def __init__(self):\n", - " self.__degree=0.0\n", - " def Radian(self):\n", - " return ( Radian(self.__degree * PI / 180.0))\n", - " def Input(self):\n", - " self.__degree=float(raw_input(\"Enter degree: \"))\n", - "deg1=Degree()\n", - "deg1.Input()\n", - "rad1=deg1.Radian()\n", - "rad1.Output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter degree: 180\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Radian = 3.141592654\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-d2r2.cpp, Page no-512" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "PI=3.141592654\n", - "class Degree:\n", - " __degree=float\n", - " def __init__(self):\n", - " self.__degree=0.0\n", - " def GetDegree(self):\n", - " return self.__degree\n", - " def Input(self):\n", - " self.__degree=float(raw_input(\"Enter degree: \"))\n", - "class Radian:\n", - " __rad=float\n", - " def __init__(self, deg=None):\n", - " if isinstance(deg , Degree):\n", - " self.__rad=deg.GetDegree()*PI/180.0\n", - " else:\n", - " self.__rad=0.0\n", - " def GetRadian(self):\n", - " return self.__rad\n", - " def Output(self):\n", - " print \"Radian =\", self.GetRadian()\n", - "deg1=Degree()\n", - "deg1.Input()\n", - "rad1=Radian(deg1)\n", - "rad1.Output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter degree: 90\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Radian = 1.570796327\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-degrad.cpp, Page no-514" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "PI=3.141592654\n", - "class Radian:\n", - " __rad=float\n", - " def __init__(self, InitRad=0.0):\n", - " self.__rad=InitRad\n", - " def GetRadian(self):\n", - " return self.__rad\n", - " def Input(self):\n", - " self.__rad=float(raw_input(\"Enter radian: \"))\n", - " def Output(self):\n", - " print \"Radian =\", self.GetRadian()\n", - "class Degree:\n", - " __degree=float\n", - " def __init__(self, rad=None):\n", - " if isinstance(rad, Radian):\n", - " self.__degree=rad.GetRadian()*180.0/PI\n", - " else:\n", - " self.__degree=0.0\n", - " def GetDegree(self):\n", - " return self.__degree\n", - " def Radian(self):\n", - " return ( Radian(self.__degree * PI / 180.0))\n", - " def Input(self):\n", - " self.__degree=float(raw_input(\"Enter degree: \"))\n", - " def Output(self):\n", - " print \"Degree =\", self.__degree\n", - "deg1=Degree()\n", - "deg1.Input()\n", - "rad1=deg1.Radian()\n", - "rad1.Output()\n", - "rad2=Radian()\n", - "rad2.Input()\n", - "deg2=Degree(rad2)\n", - "deg2.Output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter degree: 180\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Radian = 3.141592654\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter radian: 3.142\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Degree = 180.023339207\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-script.cpp, Page no-516" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure, c_int, c_char\n", - "class AccountEntry(Structure):\n", - " _fields_=[('number',c_int), ('name', c_char*25)]\n", - "class AccountBook:\n", - " __aCount=int\n", - " __account=[AccountEntry]\n", - " def __init__(self, aCountIn):\n", - " self.__aCount=aCountIn\n", - " for i in range(self.__aCount):\n", - " self.__account.append(AccountEntry())\n", - " def op(self, nameIn):\n", - " if isinstance(nameIn, str):\n", - " for i in range(self.__aCount):\n", - " if nameIn==self.__account[i].name:\n", - " return self.__account[i].number\n", - " elif isinstance(nameIn, int): #numberIn\n", - " for i in range(self.__aCount):\n", - " #print self.__account[i].number\n", - " if nameIn==self.__account[i].number:\n", - " return self.__account[i].name\n", - " def AccountEntry(self):\n", - " for i in range(self.__aCount):\n", - " self.__account[i].number=int(raw_input(\"Account Number: \"))\n", - " self.__account[i].name=raw_input(\"Account Holder Name: \")\n", - "accounts=AccountBook(5)\n", - "print \"Building 5 Customers Database\"\n", - "accounts.AccountEntry()\n", - "print \"Accessing Accounts Information\"\n", - "accno=int(raw_input(\"To access Name Enter Account Number: \"))\n", - "print \"Name:\",accounts.op(accno) #accounts[accno]\n", - "name=raw_input(\"To access Account Number, Enter Name: \")\n", - "print \"Account Number:\",accounts.op(name) #accounts[name]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Building 5 Customers Database\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Number: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Holder Name: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Number: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Holder Name: Kiran\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Number: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Holder Name: Ravishanker\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Number: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Holder Name: Anand\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Number: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Holder Name: Sindhu\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Accessing Accounts Information\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "To access Name Enter Account Number: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "To access Account Number, Enter Name: Sindhu\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Account Number: 5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex6.cpp, Page no-519" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def readdata(self):\n", - " self._Complex__real=float(raw_input(\"Real part ? \"))\n", - " self._Complex__imag=float(raw_input(\"Imag part ? \"))\n", - "def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self._Complex__real, self._Complex__imag)\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " readdata=readdata\n", - " outdata=outdata\n", - " def __neg__(self):\n", - " return neg(self)\n", - "#friend function overloading unary minus operator\n", - "def neg(c1):\n", - " c=Complex()\n", - " c._Complex__real=-c1._Complex__real\n", - " c._Complex__imag=-c1._Complex__imag\n", - " return c\n", - "c1=Complex()\n", - "c2=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.readdata()\n", - "c2=-c1\n", - "c1.outdata(\"Complex c1 : \")\n", - "c2.outdata(\"Complex c2 = -Complex c1: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 1.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? -2.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Complex c1 : (1.5, -2.5)\n", - "Complex c2 = -Complex c1: (-1.5, 2.5)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex7.cpp, Page no-520" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def readdata(self):\n", - " self._Complex__real=float(raw_input(\"Real part ? \"))\n", - " self._Complex__imag=float(raw_input(\"Imag part ? \"))\n", - "def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self._Complex__real, self._Complex__imag)\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " readdata=readdata\n", - " outdata=outdata\n", - " def __neg__(self):\n", - " return neg(self)\n", - "#friend function overloading unary minus operator\n", - "def neg(c1):\n", - " c1._Complex__real=-c1._Complex__real\n", - " c1._Complex__imag=-c1._Complex__imag\n", - "c1=Complex()\n", - "print \"Enter Complex Number c1...\"\n", - "c1.readdata()\n", - "-c1\n", - "c1.outdata(\"Complex c1 : \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 1.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? -2.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Complex c1 : (-1.5, 2.5)\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex8.cpp, Page no-522" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self, realpart=0):\n", - " if isinstance(realpart, float):\n", - " self.__real=realpart\n", - " self.__imag=0\n", - " def readdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", - " def __add__(self, c2):\n", - " return add(self, c2)\n", - "#friend function overloading + operator\n", - "def add(c1, c2):\n", - " c=Complex()\n", - " c._Complex__real=c1._Complex__real+c2._Complex__real\n", - " c._Complex__imag=c1._Complex__imag+c2._Complex__imag\n", - " return c\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex(3)\n", - "print \"Enter Complex Number c1...\"\n", - "c1.readdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.readdata()\n", - "c3=c1+c2\n", - "c3.outdata(\"Result of c3 = c1 + c2: \")\n", - "c3=c1+Complex(2.0)\n", - "c3.outdata(\"Result of c3 = c1 + 2.0: \")\n", - "c3=Complex(3.0)+c2\n", - "c3.outdata(\"Result of c3 = 3.0 + c2: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Result of c3 = c1 + c2: (4, 6)\n", - "Result of c3 = c1 + 2.0: (3, 2)\n", - "Result of c3 = 3.0 + c2: (6, 4)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex9.cpp, Page no-525" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self, InReal=0):\n", - " if isinstance(InReal, float):\n", - " self.__real=InReal\n", - " self.__imag=0\n", - " def readdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", - " def __add__(self, c2):\n", - " return add(self, c2)\n", - "#friend function overloading + operator\n", - "def add(c1, c2):\n", - " c=Complex()\n", - " c._Complex__real=c1._Complex__real+c2._Complex__real\n", - " c._Complex__imag=c1._Complex__imag+c2._Complex__imag\n", - " return c\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex(3)\n", - "print \"Enter Complex Number c1...\"\n", - "c1.readdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.readdata()\n", - "c3=c1+c2\n", - "c3.outdata(\"Result of c3 = c1 + c2: \")\n", - "c3=c1+Complex(2.0)\n", - "c3.outdata(\"Result of c3 = c1 + 2.0: \")\n", - "c3=Complex(3.0)+c2\n", - "c3.outdata(\"Result of c3 = 3.0 + c2: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Result of c3 = c1 + c2: (4, 6)\n", - "Result of c3 = c1 + 2.0: (3, 2)\n", - "Result of c3 = 3.0 + c2: (6, 4)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector.cpp, Page no-528" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __assign__(self, v2):\n", - " print \"Assignment operation invoked\"\n", - " for i in range(v2._vector__size):\n", - " self._vector__v[i]=v2._vector__v[i]\n", - "def show(self):\n", - " for i in range(self._vector__size):\n", - " print self.elem(i), \",\",\n", - "class vector:\n", - " __v=[int]\n", - " __size=int\n", - " def __init__(self, vector_size):\n", - " if isinstance(vector_size, int):\n", - " self.__size=vector_size\n", - " self.__v=[int]*self.__size\n", - " if isinstance(vector_size, vector):\n", - " print \"Copy constructor invoked\"\n", - " self.__size=vector_size.__size\n", - " self.__v=[int]*self.__size\n", - " for i in range(vector_size.__size):\n", - " self.__v[i]=vector_size.__v[i]\n", - " def __del__(self):\n", - " del self.__v\n", - " __assign__=__assign__\n", - " def elem(self, i, x=None):\n", - " if isinstance(x, int):\n", - " if i>=self.__size:\n", - " print \"Error: Out of Range\"\n", - " self.__v[i]=x\n", - " else:\n", - " return self.__v[i]\n", - " show=show\n", - "v1=vector(5)\n", - "v2=vector(5)\n", - "for i in range(5):\n", - " v2.elem(i, i+1)\n", - "v1 = v2\n", - "v3 = vector(v2)\n", - "print \"Vector v1:\",\n", - "v1.show()\n", - "print \"\\nVector v2:\",\n", - "v2.show()\n", - "print \"\\nVector v3:\",\n", - "v3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Copy constructor invoked\n", - "Vector v1: 1 , 2 , 3 , 4 , 5 , \n", - "Vector v2: 1 , 2 , 3 , 4 , 5 , \n", - "Vector v3: 1 , 2 , 3 , 4 , 5 ,\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mleak.cpp, Page no-530" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "vector=[int]*10\n", - "buffer=[chr]*6\n", - "for i in range(10):\n", - " vector[i]=i+1\n", - "buffer=\"hello\"\n", - "for i in range(10):\n", - " print vector[i],\n", - "print \"\\nbuffer =\", buffer\n", - "del vector" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1 2 3 4 5 6 7 8 9 10 \n", - "buffer = hello\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-misuse.cpp, Page no-533" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class number:\n", - " __num=int\n", - " def read(self):\n", - " self.__num=int(raw_input())\n", - " def get(self):\n", - " return self.__num\n", - " def __add__(self, num2):\n", - " Sum=number()\n", - " Sum.__num=self.__num-num2.__num #subtraction instead of addition\n", - " return Sum\n", - "num1=number()\n", - "num2=number()\n", - "Sum=number()\n", - "print \"Enter Number 1: \",\n", - "num1.read()\n", - "print \"Enter Number 2: \",\n", - "num2.read()\n", - "Sum=num1+num2 #addition of two numbers\n", - "print \"sum = num1 + num2 =\", Sum.get()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Number 1: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Number 2: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " sum = num1 + num2 = -5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-537" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __add__(self, d2):\n", - " temp_date=date()\n", - " temp_date._date__sec=self._date__sec+d2._date__sec\n", - " if(temp_date._date__sec>=60):\n", - " temp_date._date__min+=1\n", - " temp_date._date__sec=temp_date._date__sec-60\n", - " temp_date._date__min=temp_date._date__min+self._date__min+d2._date__min\n", - " if(temp_date._date__min>=60):\n", - " temp_date._date__hr+=1\n", - " temp_date._date__min=temp_date._date__min-60\n", - " temp_date._date__hr=self._date__hr+d2._date__hr\n", - " return temp_date\n", - "class date:\n", - " __hr=int\n", - " __min=int\n", - " __sec=int\n", - " def __init__(self, h=0, m=0, s=0):\n", - " self.__hr=h\n", - " self.__min=m\n", - " self.__sec=s\n", - " def show(self):\n", - " print \"%d hours, %d minutes, %d seconds\" %(self.__hr, self.__min, self.__sec),\n", - " __add__=__add__\n", - "date1=date(2, 4, 56)\n", - "date2=date(10, 59, 11)\n", - "date3=date()\n", - "date3=date1+date2\n", - "date1.show()\n", - "print \"+\",\n", - "date2.show()\n", - "print \"=\",\n", - "date3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "2 hours, 4 minutes, 56 seconds + 10 hours, 59 minutes, 11 seconds = 12 hours, 4 minutes, 7 seconds\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-2, Page no-538" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __add__(self, b2):\n", - " temp_basket=basket()\n", - " temp_basket._basket__apples=self._basket__apples+b2._basket__apples\n", - " temp_basket._basket__mangoes=self._basket__mangoes+b2._basket__mangoes\n", - " return temp_basket\n", - "class basket:\n", - " __apples=int\n", - " __mangoes=int\n", - " def __init__(self, a=0, m=0):\n", - " self.__apples=a\n", - " self.__mangoes=m\n", - " def show(self):\n", - " print self.__apples, \" Apples and\", self.__mangoes, \" Mangoes\"\n", - " __add__=__add__ # overloading + operator\n", - "basket1=basket(7, 10)\n", - "basket2=basket(4, 5)\n", - "basket3=basket()\n", - "print \"Basket 1 contains:\"\n", - "basket1.show()\n", - "print \"Basket 2 contains:\"\n", - "basket2.show()\n", - "basket3=basket1+basket2 #using overloaded + operator\n", - "print \"Adding fruits from Basket 1 and Basket 2 results in:\"\n", - "basket3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Basket 1 contains:\n", - "7 Apples and 10 Mangoes\n", - "Basket 2 contains:\n", - "4 Apples and 5 Mangoes\n", - "Adding fruits from Basket 1 and Basket 2 results in:\n", - "11 Apples and 15 Mangoes\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance.ipynb deleted file mode 100755 index a617fa5c..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance.ipynb +++ /dev/null @@ -1,2736 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:63736c9aef28a6babc99661e161907400b7b80441a3f765e7ab8b6e00648ce25" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 14- Inheritance" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-bag.cpp, Page-544" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "(false, true)=(0, 1) #enum type\n", - "type =['false', 'true']\n", - "MAX_ITEMS=25\n", - "def IsExist(self, item):\n", - " for i in range(self._Bag__ItemCount):\n", - " if self._Bag__contents[i]==item:\n", - " return true\n", - " return false\n", - "def show(self):\n", - " for i in range(self._Bag__ItemCount):\n", - " print self._Bag__contents[i],\n", - " print \"\"\n", - "class Bag:\n", - " __contents=[int]*MAX_ITEMS #protected members\n", - " __ItemCount=int\n", - " def __init__(self):\n", - " self.__ItemCount=0\n", - " def put(self, item):\n", - " self.__contents[self.__ItemCount]=item\n", - " self.__ItemCount+=1\n", - " def IsEmpty(self):\n", - " return true if self.__ItemCount==0 else false\n", - " def IsFull(self):\n", - " return true if self.__ItemCount==MAX_ITEMS else false\n", - " IsExist=IsExist\n", - " show=show\n", - "bag=Bag()\n", - "item=int\n", - "while(true):\n", - " item=int(raw_input(\"Enter Item Number to be put into the bag <0-no item>: \"))\n", - " if item==0:\n", - " break\n", - " bag.put(item)\n", - " print \"Items in Bag:\",\n", - " bag.show()\n", - " if bag.IsFull():\n", - " print \"Bag Full, no more items can be placed\"\n", - " break" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in Bag: 1 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Number to be put into the bag <0-no item>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in Bag: 1 2 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in Bag: 1 2 3 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in Bag: 1 2 3 3 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in Bag: 1 2 3 3 1 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Number to be put into the bag <0-no item>: 0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-union.cpp, Page no-548" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "(false, true)=(0, 1) #enum type\n", - "type =['false', 'true']\n", - "MAX_ITEMS=25\n", - "def IsExist(self, item):\n", - " for i in range(self._Bag__ItemCount):\n", - " if self._Bag__contents[i]==item:\n", - " return true\n", - " return false\n", - "def show(self):\n", - " for i in range(self._Bag__ItemCount):\n", - " print self._Bag__contents[i],\n", - " print \"\"\n", - "class Bag:\n", - " #protected members\n", - " __ItemCount=int\n", - " def __init__(self):\n", - " self.__ItemCount=0\n", - " self.__contents=[int]*MAX_ITEMS\n", - " def put(self, item):\n", - " self.__contents[self.__ItemCount]=item\n", - " self.__ItemCount+=1\n", - " def IsEmpty(self):\n", - " return true if self.__ItemCount==0 else false\n", - " def IsFull(self):\n", - " return true if self.__ItemCount==MAX_ITEMS else false\n", - " IsExist=IsExist\n", - " show=show\n", - "def read(self):\n", - " while(true):\n", - " element=int(raw_input(\"Enter Set Element <0-end>: \"))\n", - " if element==0:\n", - " break\n", - " self.Add(element)\n", - "def add(s1, s2):\n", - " temp = Set()\n", - " temp=s1\n", - " for i in range(s2._Bag__ItemCount):\n", - " if s1.IsExist(s2._Bag__contents[i])==false:\n", - " temp.Add(s2._Bag__contents[i])\n", - " return temp\n", - "class Set(Bag):\n", - " def Add(self,element):\n", - " if(self.IsExist(element)==false and self.IsFull()==false):\n", - " self.put(element)\n", - " read=read\n", - " def __assign__(self, s2):\n", - " for i in range(s2._Bag__ItemCount):\n", - " self.__contents[i]=s2.__contents[i]\n", - " self.__ItemCount=s2.__ItemCount\n", - " def __add__(self, s2):\n", - " return add(self, s2)\n", - "s1=Set()\n", - "s2=Set()\n", - "s3=Set()\n", - "print \"Enter Set 1 elements..\"\n", - "s1.read()\n", - "print \"Enter Set 2 elemets..\"\n", - "s2.read()\n", - "s3=s1+s2\n", - "print \"Union of s1 and s2 :\",\n", - "s3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set 1 elements..\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set 2 elemets..\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 6\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Union of s1 and s2 : 1 2 3 4 5 6 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons1.cpp, Page no-558" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " pass\n", - "class D(B):\n", - " def msg(self):\n", - " print \"No constructors exist in base and derived class\"\n", - "objd=D()\n", - "objd.msg()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No constructors exist in base and derived class\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons2.cpp, Page no-558" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " def __init__(self):\n", - " print \"No-argument constructor of base class B is executed\"\n", - "class D(B):\n", - " pass\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of base class B is executed\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons3.cpp, Page no-559" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " pass\n", - "class D(B):\n", - " def __init__(self):\n", - " print \"Constructors exist only in derived class\"\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructors exist only in derived class\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons4.cpp, Page no-559" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " def __init__(self):\n", - " print \"No-argument constructor of base class B executed first\"\n", - "class D(B):\n", - " def __init__(self):\n", - " B.__init__(self)\n", - " print \"No-argument constructor of derived class D executed next\"\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of base class B executed first\n", - "No-argument constructor of derived class D executed next\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons5.cpp, Page no-560" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " def __init__(self, a=0):\n", - " if isinstance(a, int):\n", - " print \"One-argument constructor of the base class B\"\n", - " else:\n", - " print \"No-argument constructor of the base class B\"\n", - "class D(B):\n", - " def __init__(self, a):\n", - " B.__init__(self, a)\n", - " print \"One-argument constructor of the derived class D\"\n", - "objd=D(3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "One-argument constructor of the base class B\n", - "One-argument constructor of the derived class D\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons7.cpp, Page no-561" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " def __init__(self, a):\n", - " print \"One-argument constructor of the base class B\"\n", - "class D(B):\n", - " def __init__(self, a):\n", - " B(a)\n", - " print \"One-argument constructor of the derived class D\"\n", - "objd=D(3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "One-argument constructor of the base class B\n", - "One-argument constructor of the derived class D\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons8.cpp, Page no-562" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B1:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B1\"\n", - "class B2:\n", - " def __init__(self):\n", - " B1.__init__(self)\n", - " print \"No-argument constructor of the base class B2\"\n", - "class D(B2, B1):\n", - " def __init__(self):\n", - " B2.__init__(self)\n", - " print \"No-argument constructor of the derived class D\"\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of the base class B1\n", - "No-argument constructor of the base class B2\n", - "No-argument constructor of the derived class D\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons9.cpp, Page no-563" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B1:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B1\"\n", - "class B2:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B2\"\n", - "class D(B1, B2):\n", - " def __init__(self):\n", - " B1()\n", - " B2()\n", - " print \"No-argument constructor of the derived class D\"\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of the base class B1\n", - "No-argument constructor of the base class B2\n", - "No-argument constructor of the derived class D\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons10.cpp, Page no-563" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B1:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B1\"\n", - "class B2:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B2\"\n", - "class D(B1, B2):\n", - " def __init__(self):\n", - " B2()\n", - " B1()\n", - " print \"No-argument constructor of the derived class D\"\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of the base class B2\n", - "No-argument constructor of the base class B1\n", - "No-argument constructor of the derived class D\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons11.cpp, Page no-564" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " def __init__(self):\n", - " print \"No-argument constructor of a base class B\"\n", - "class D1(B):\n", - " def __init__(self):\n", - " B.__init__(self)\n", - " print \"No-argument constructor of a base class D1\"\n", - "class D2(D1):\n", - " def __init__(self):\n", - " D1.__init__(self)\n", - " print \"No-argument constructor of a derived class D2\"\n", - "objd=D2()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of a base class B\n", - "No-argument constructor of a base class D1\n", - "No-argument constructor of a derived class D2\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons12.cpp, Page no-566" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B1:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B1\"\n", - " def __del__(self):\n", - " print \"Desctructor in the base class B1\"\n", - "class B2:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B2\"\n", - " def __del__(self):\n", - " print \"Desctructor in the base class B2\"\n", - "class D(B1, B2):\n", - " def __init__(self):\n", - " B1.__init__(self)\n", - " B2.__init__(self)\n", - " print \"No-argument constructor of the derived class D\"\n", - " def __del__(self):\n", - " print \"Desctructor in the derived class D\"\n", - " for b in self.__class__.__bases__:\n", - " b.__del__(self)\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of the base class B1\n", - "No-argument constructor of the base class B2\n", - "No-argument constructor of the derived class D\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons13.cpp, Page no-568" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " __x=int\n", - " __y=int\n", - " def __init__(self, a, b):\n", - " self.__x=a\n", - " self.__y=b\n", - "class D(B):\n", - " __a=int\n", - " __b=int\n", - " def __init__(self, p, q, r):\n", - " self.__a=p\n", - " B.__init__(self, p, q)\n", - " self.__b=r\n", - " def output(self):\n", - " print \"x =\", self._B__x\n", - " print \"y =\", self._B__y\n", - " print \"a =\", self.__a\n", - " print \"b =\", self.__b\n", - "objd=D(5, 10, 15)\n", - "objd.output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x = 5\n", - "y = 10\n", - "a = 5\n", - "b = 15\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-runtime.cpp, Page no-570" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " __x=int\n", - " __y=int(0) #initialization\n", - " def __init__(self, a, b):\n", - " self.__x=self.__y+b\n", - " self.__y=a\n", - " def Print(self):\n", - " print \"x =\", self.__x\n", - " print \"y =\", self.__y\n", - "b = B(2, 3)\n", - "b.Print()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x = 3\n", - "y = 2\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons14.cpp, Page no-570" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " __x=int\n", - " __y=int\n", - " def read(self):\n", - " self.__x=int(raw_input(\"X in class B ? \"))\n", - " self.__y=int(raw_input(\"Y in class B ? \"))\n", - " def show(self):\n", - " print \"X in class B =\", self.__x\n", - " print \"Y in class B =\", self.__y\n", - "class D(B):\n", - " __y=int\n", - " __z=int\n", - " def read(self):\n", - " B.read(self)\n", - " self.__y=int(raw_input(\"Y in class D ? \"))\n", - " self.__z=int(raw_input(\"Z in class D ? \"))\n", - " def show(self):\n", - " B.show(self)\n", - " print \"Y in class D =\", self.__y\n", - " print \"Z in class D =\", self.__z\n", - " print \"Y of B, show from D =\", self._B__y\n", - "objd=D()\n", - "print \"Enter data for object of class D..\"\n", - "objd.read()\n", - "print \"Contents of object of class D..\"\n", - "objd.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for object of class D..\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "X in class B ? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Y in class B ? 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Y in class D ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Z in class D ? 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Contents of object of class D..\n", - "X in class B = 1\n", - "Y in class B = 2\n", - "Y in class D = 3\n", - "Z in class D = 4\n", - "Y of B, show from D = 2\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-stack.cpp, Page no-573" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_ELEMENTS=5\n", - "class Stack:\n", - " __stack=[int]*(MAX_ELEMENTS+1)\n", - " __StackTop=int\n", - " def __init__(self):\n", - " self.__StackTop=0\n", - " def push(self, element):\n", - " self.__StackTop+=1\n", - " self.__stack[self.__StackTop]=element\n", - " def pop(self, element):\n", - " element=self.__stack[self.__StackTop]\n", - " self.__StackTop-=1\n", - " return element\n", - "class MyStack(Stack):\n", - " def push(self, element):\n", - " if self._Stack__StackTop0:\n", - " element=Stack.pop(self, element)\n", - " return element\n", - " print \"Stack Underflow\"\n", - " return 0\n", - "stack=MyStack()\n", - "print \"Enter Integer data to put into the stack...\"\n", - "while(1):\n", - " element=int(raw_input(\"Element to Push ? \"))\n", - " if stack.push(element)==0:\n", - " break\n", - "print \"The Stack Contains...\"\n", - "element=stack.pop(element)\n", - "while element:\n", - " print \"pop:\", element\n", - " element=stack.pop(element)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Integer data to put into the stack...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element to Push ? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element to Push ? 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element to Push ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element to Push ? 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element to Push ? 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element to Push ? 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Stack Overflow\n", - "The Stack Contains...\n", - "pop: 5\n", - "pop: 4\n", - "pop: 3\n", - "pop: 2\n", - "pop: 1\n", - "Stack Underflow\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-exam.cpp, Page no-577" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_LEN=25\n", - "class person:\n", - " __name=[chr]*MAX_LEN\n", - " __sex=chr\n", - " __age=int\n", - " def ReadData(self):\n", - " self.__name=raw_input(\"Name ? \")\n", - " self.__sex=str(raw_input(\"Sex ? \"))\n", - " self.__age=int(raw_input(\"Age ? \"))\n", - " def DisplayData(self):\n", - " print \"Name:\", self.__name\n", - " print \"Sex: \", self.__sex\n", - " print \"Age: \", self.__age\n", - "class student(person):\n", - " __RollNo=int\n", - " __branch=[chr]*20\n", - " def ReadData(self):\n", - " person.ReadData(self) #invoking member function ReadData of base class person\n", - " self.__RollNo=int(raw_input(\"Roll Number ? \"))\n", - " self.__branch=raw_input(\"Branch Studying ? \")\n", - " def DisplayData(self):\n", - " person.DisplayData(self) #invoking member function DisplayData of base class person\n", - " print \"Roll Number:\", self.__RollNo\n", - " print \"Branch:\", self.__branch\n", - "class exam(student):\n", - " __Sub1Marks=int\n", - " __Sub2Marks=int\n", - " def ReadData(self):\n", - " student.ReadData(self) #invoking member function ReadData of base class student\n", - " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", - " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", - " def DisplayData(self):\n", - " student.DisplayData(self) #invoking member function DisplayData of base class student\n", - " print \"Marks scored in Subject 1:\", self.__Sub1Marks\n", - " print \"Marks scored in Subject 2:\", self.__Sub2Marks\n", - " print \"Total Marks Scored:\", self.TotalMarks()\n", - " def TotalMarks(self):\n", - " return self.__Sub1Marks+self.__Sub2Marks\n", - "annual=exam()\n", - "print \"Enter data for Student...\"\n", - "annual.ReadData()\n", - "print \"Student Details...\"\n", - "annual.DisplayData()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for Student...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sex ? M\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age ? 24\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 9\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch Studying ? Computer-Technology\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 1 < Max:100> ? 92\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 2 < Max:100> ? 88\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Details...\n", - "Name: Rajkumar\n", - "Sex: M\n", - "Age: 24\n", - "Roll Number: 9\n", - "Branch: Computer-Technology\n", - "Marks scored in Subject 1: 92\n", - "Marks scored in Subject 2: 88\n", - "Total Marks Scored: 180\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mul_inh1.cpp, Page no-580" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "class A:\n", - " def __init__(self):\n", - " sys.stdout.write('a'),\n", - "class B:\n", - " def __init__(self):\n", - " sys.stdout.write('b'),\n", - "class C(A, B):\n", - " def __init__(self):\n", - " A.__init__(self)\n", - " B.__init__(self)\n", - " sys.stdout.write('c'),\n", - "objc=C()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "abc" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mul_inh2.cpp, Page no-581" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class A:\n", - " def __init__(self, c):\n", - " sys.stdout.write(c),\n", - "class B:\n", - " def __init__(self, b):\n", - " sys.stdout.write(b),\n", - "class C(A, B):\n", - " def __init__(self, c1, c2, c3):\n", - " A.__init__(self, c1)\n", - " B.__init__(self, c2)\n", - " sys.stdout.write(c3),\n", - "objc=C('a', 'b', 'c')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "abc" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mul_inh4.cpp, Page no-583" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "class A:\n", - " __ch=chr\n", - " def __init__(self, c):\n", - " self.__ch=c\n", - " def show(self):\n", - " sys.stdout.write(self.__ch),\n", - "class B:\n", - " __ch=chr\n", - " def __init__(self, b):\n", - " self.__ch=b\n", - " def show(self):\n", - " sys.stdout.write(self.__ch),\n", - "class C(A, B):\n", - " __ch=chr\n", - " def __init__(self, c1, c2, c3):\n", - " A.__init__(self, c1)\n", - " B.__init__(self, c2)\n", - " self.__ch=c3\n", - "objc=C('a', 'b', 'c')\n", - "print \"objc.A::show() = \",\n", - "A.show(objc)\n", - "print \"\\nobjc.B::show() = \",\n", - "B.show(objc)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "objc.A::show() = a \n", - "objc.B::show() = b\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mul_inh5.cpp, Page no-584" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "class A:\n", - " __ch=chr\n", - " def __init__(self, c):\n", - " self.__ch=c\n", - " def show(self):\n", - " sys.stdout.write(self.__ch),\n", - "class B:\n", - " __ch=chr\n", - " def __init__(self, b):\n", - " self.__ch=b\n", - " def show(self):\n", - " sys.stdout.write(self.__ch),\n", - "class C(A, B):\n", - " __ch=chr\n", - " def __init__(self, c1, c2, c3):\n", - " A.__init__(self, c1)\n", - " B.__init__(self, c2)\n", - " self.__ch=c3\n", - " def show(self):\n", - " A.show(self)\n", - " B.show(self)\n", - " sys.stdout.write(self.__ch),\n", - "objc=C('a', 'b', 'c')\n", - "print \"objc.show() = \",\n", - "objc.show()\n", - "print \"\\nobjc.C::show() = \",\n", - "C.show(objc)\n", - "print \"\\nobjc.A::show() = \",\n", - "A.show(objc)\n", - "print \"\\nobjc.B::show() = \",\n", - "B.show(objc)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "objc.show() = abc \n", - "objc.C::show() = abc \n", - "objc.A::show() = a \n", - "objc.B::show() = b\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-publish1.cpp, Page no-586" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class publication:\n", - " __title=[chr]*40\n", - " __price=float\n", - " def getdata(self):\n", - " self.__title=raw_input(\"\\tEnter Title: \")\n", - " self.__price=float(raw_input(\"\\tEnter Price: \"))\n", - " def display(self):\n", - " print \"\\tTitle =\", self.__title\n", - " print \"\\tPrice = %g\" %(self.__price)\n", - "class sales:\n", - " __PublishSales=[]\n", - " def __init__(self):\n", - " self.__PublishSales=[float]*3\n", - " def getdata(self):\n", - " for i in range(3):\n", - " print \"\\tEnter Sales of\", i+1, \"Month: \",\n", - " self.__PublishSales[i]=float(raw_input())\n", - " def display(self):\n", - " TotalSales=0\n", - " for i in range(3):\n", - " print \"\\tSales of\", i+1, \"Month = %g\" %(self.__PublishSales[i])\n", - " TotalSales+=self.__PublishSales[i]\n", - " print \"\\tTotalSales = %g\" %(TotalSales)\n", - "class book(publication, sales):\n", - " __pages=int\n", - " def getdata(self):\n", - " publication.getdata(self)\n", - " self.__pages=int(raw_input(\"\\tEnter Number of Pages: \"))\n", - " sales.getdata(self)\n", - " def display(self):\n", - " publication.display(self)\n", - " print \"\\tNumber of Pages = %g\" %(self.__pages)\n", - " sales.display(self)\n", - "class tape(publication, sales):\n", - " __PlayTime=int\n", - " def getdata(self):\n", - " publication.getdata(self)\n", - " self.__PlayTime=int(raw_input(\"\\tEnter Playing Time in Minute: \"))\n", - " sales.getdata(self)\n", - " def display(self):\n", - " publication.display(self)\n", - " print \"\\tPlaying Time in Minute = %g\" %(self.__PlayTime)\n", - " sales.display(self)\n", - "class pamphlet(publication):\n", - " pass\n", - "class notice(pamphlet):\n", - " __whom=[chr]*20\n", - " def getdata(self):\n", - " pamphlet.getdata(self)\n", - " self.__whom=raw_input(\"\\tEnter Type of Distributor: \")\n", - " def display(self):\n", - " pamphlet.display(self)\n", - " print \"\\tType of Distributor =\", self.__whom\n", - "book1=book()\n", - "tape1=tape()\n", - "pamp1=pamphlet()\n", - "notice1=notice()\n", - "print \"Enter Book Publication Data...\"\n", - "book1.getdata()\n", - "print \"Enter Tape Publication Data...\"\n", - "tape1.getdata()\n", - "print \"Enter Pamhlet Publication Data...\"\n", - "pamp1.getdata()\n", - "print \"Enter Notice Publication Data...\"\n", - "notice1.getdata()\n", - "print \"Book Publication Data...\"\n", - "book1.display()\n", - "print \"Tape Publication Data...\"\n", - "tape1.display()\n", - "print \"Pamphlet Publication Data...\"\n", - "pamp1.display()\n", - "print \"Notice Publication Data...\"\n", - "notice1.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Book Publication Data...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Title: Microprocessor-x86-Programming\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Price: 180\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Number of Pages: 750\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Sales of 1 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1000\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \tEnter Sales of 2 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "500\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \tEnter Sales of 3 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "800\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Tape Publication Data...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Title: Love-1947\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Price: 100\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Playing Time in Minute: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Sales of 1 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "200\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \tEnter Sales of 2 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "500\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \tEnter Sales of 3 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "400\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Pamhlet Publication Data...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Title: Advanced-Computing-95-Conference\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Price: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Notice Publication Data...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Title: General-Meeting\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Price: 100\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Type of Distributor: Retail\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Book Publication Data...\n", - "\tTitle = Microprocessor-x86-Programming\n", - "\tPrice = 180\n", - "\tNumber of Pages = 750\n", - "\tSales of 1 Month = 1000\n", - "\tSales of 2 Month = 500\n", - "\tSales of 3 Month = 800\n", - "\tTotalSales = 2300\n", - "Tape Publication Data...\n", - "\tTitle = Love-1947\n", - "\tPrice = 100\n", - "\tPlaying Time in Minute = 10\n", - "\tSales of 1 Month = 200\n", - "\tSales of 2 Month = 500\n", - "\tSales of 3 Month = 400\n", - "\tTotalSales = 1100\n", - "Pamphlet Publication Data...\n", - "\tTitle = Advanced-Computing-95-Conference\n", - "\tPrice = 10\n", - "Notice Publication Data...\n", - "\tTitle = General-Meeting\n", - "\tPrice = 100\n", - "\tType of Distributor = Retail\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vehicle.cpp, Page no-591" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_LEN=25\n", - "class Vehicle:\n", - " __name=[chr]*MAX_LEN\n", - " __WheelsCount=int\n", - " def GetData(self):\n", - " self.__name=raw_input(\"Name of the Vehicle ? \")\n", - " self.__WheelsCount=int(raw_input(\"Wheels ? \"))\n", - " def DisplayData(self):\n", - " print \"Name of the Vehicle :\", self.__name \n", - " print \"Wheels :\", self.__WheelsCount\n", - "class LightMotor(Vehicle):\n", - " __SpeedLimit=int\n", - " def GetData(self):\n", - " Vehicle.GetData(self)\n", - " self.__SpeedLimit=int(raw_input(\"Speed Limit ? \"))\n", - " def DisplayData(self):\n", - " Vehicle.DisplayData(self)\n", - " print \"Speed Limit :\", self.__SpeedLimit\n", - "class HeavyMotor(Vehicle):\n", - " __permit=[chr]*MAX_LEN\n", - " __LoadCapacity=int\n", - " def GetData(self):\n", - " Vehicle.GetData(self)\n", - " self.__LoadCapacity=int(raw_input(\"Load Carrying Capacity ? \"))\n", - " self.__permit=raw_input(\"Permit Type ? \")\n", - " def DisplayData(self):\n", - " Vehicle.DisplayData(self)\n", - " print \"Load Carrying Capacity : \", self.__LoadCapacity \n", - " print \"Permit:\", self.__permit\n", - "class GearMotor(LightMotor):\n", - " __GearCount=int\n", - " def GetData(self):\n", - " LightMotor.GetData(self)\n", - " self.__GearCount=int(raw_input(\"No. of Gears ? \"))\n", - " def DisplayData(self):\n", - " LightMotor.DisplayData(self)\n", - " print \"Gears :\", self.__GearCount\n", - "class NonGearMotor(LightMotor):\n", - " def GetData(self):\n", - " LightMotor.Getdata(self)\n", - " def DisplayData(self):\n", - " LightMotor.DisplayData(self)\n", - "class Passenger(HeavyMotor):\n", - " __sitting=int\n", - " __standing=int\n", - " def GetData(self):\n", - " HeavyMotor.GetData(self)\n", - " self.__sitting=int(raw_input(\"Maximum Seats ? \"))\n", - " self.__standing=int(raw_input(\"Maximum Standing ? \"))\n", - " def DisplayData(self):\n", - " HeavyMotor.DisplayData(self)\n", - " print \"Maximum Seats:\", self.__sitting\n", - " print \"Maximum Standing:\", self.__standing\n", - "class Goods(HeavyMotor):\n", - " def GetData(self):\n", - " HeavyMotor.Getdata(self)\n", - " def DisplayData(self):\n", - " HeavyMotor.DisplayData(self)\n", - "vehi1=GearMotor()\n", - "vehi2=Passenger()\n", - "print \"Enter Data for Gear Motor Vehicle...\"\n", - "vehi1.GetData()\n", - "print \"Enter Data for Passenger Motor Vehicle...\"\n", - "vehi2.GetData()\n", - "print \"Data of Gear Motor Vehicle...\"\n", - "vehi1.DisplayData()\n", - "print \"Data of Passenger Motor Vehicle...\"\n", - "vehi2.DisplayData()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Data for Gear Motor Vehicle...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name of the Vehicle ? Maruti-Car\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wheels ? 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed Limit ? 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "No. of Gears ? 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Data for Passenger Motor Vehicle...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name of the Vehicle ? KSRTC-BUS\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wheels ? 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Load Carrying Capacity ? 60\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Permit Type ? National\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum Seats ? 45\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum Standing ? 60\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Data of Gear Motor Vehicle...\n", - "Name of the Vehicle : Maruti-Car\n", - "Wheels : 4\n", - "Speed Limit : 4\n", - "Gears : 5\n", - "Data of Passenger Motor Vehicle...\n", - "Name of the Vehicle : KSRTC-BUS\n", - "Wheels : 4\n", - "Load Carrying Capacity : 60\n", - "Permit: National\n", - "Maximum Seats: 45\n", - "Maximum Standing: 60\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-int_ext.cpp, Page no-595" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_LEN=25\n", - "class student():\n", - " __RollNo=int\n", - " __branch=[chr]*20\n", - " def ReadStudentData(self):\n", - " self.__RollNo=int(raw_input(\"Roll Number ? \"))\n", - " self.__branch=raw_input(\"Branch Studying ? \")\n", - " def DisplayStudentData(self):\n", - " print \"Roll Number:\", self.__RollNo\n", - " print \"Branch:\", self.__branch\n", - "class InternalExam(student):\n", - " __Sub1Marks=int\n", - " __Sub2Marks=int\n", - " def ReadData(self):\n", - " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", - " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", - " def DisplayData(self):\n", - " print \"Internal Marks scored in Subject 1:\", self.__Sub1Marks\n", - " print \"Internal Marks scored in Subject 2:\", self.__Sub2Marks\n", - " print \"Internal Total Marks Scored:\", self.TotalMarks()\n", - " def InternalTotalMarks(self):\n", - " return self.__Sub1Marks+self.__Sub2Marks\n", - "class ExternalExam(student):\n", - " __Sub1Marks=int\n", - " __Sub2Marks=int\n", - " def ReadData(self):\n", - " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", - " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", - " def DisplayData(self):\n", - " print \"External Marks scored in Subject 1:\", self.__Sub1Marks\n", - " print \"External Marks scored in Subject 2:\", self.__Sub2Marks\n", - " print \"External Total Marks Scored:\", self.ExternalTotalMarks()\n", - " def ExternalTotalMarks(self):\n", - " return self.__Sub1Marks+self.__Sub2Marks\n", - "class result(InternalExam, ExternalExam):\n", - " __total=int\n", - " def TotalMarks(self):\n", - " return InternalExam.InternalTotalMarks(self)+ExternalExam.ExternalTotalMarks(self)\n", - "student1=result()\n", - "print \"Enter data for Student1...\"\n", - "student1.ReadStudentData()\n", - "print \"Enter internal marks...\"\n", - "InternalExam.ReadData(student1)\n", - "print \"Enter external marks...\"\n", - "ExternalExam.ReadData(student1)\n", - "print \"Student Details...\"\n", - "student1.DisplayStudentData()\n", - "InternalExam.DisplayData(student1)\n", - "ExternalExam.DisplayData(student1)\n", - "print \"Total Marks =\", student1.TotalMarks()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for Student1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 9\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch Studying ? Computer-Technology\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter internal marks...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 1 < Max:100> ? 80\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 2 < Max:100> ? 85\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter external marks...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 1 < Max:100> ? 89\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 2 < Max:100> ? 90\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Details...\n", - "Roll Number: 9\n", - "Branch: Computer-Technology\n", - "Internal Marks scored in Subject 1: 80\n", - "Internal Marks scored in Subject 2: 85\n", - "Internal Total Marks Scored: 344\n", - "External Marks scored in Subject 1: 89\n", - "External Marks scored in Subject 2: 90\n", - "External Total Marks Scored: 179\n", - "Total Marks = 344\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vir.cpp, Page no-598" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class A:\n", - " __x=int\n", - " def __init__(self, i=None):\n", - " if isinstance(i, int):\n", - " self.__x=i\n", - " else:\n", - " self.__x=-1\n", - " def geta(self):\n", - " return self.__x\n", - "class B(A):\n", - " __y=int\n", - " def __init__(self, i, k):\n", - " A.__init__(self, i)\n", - " self.__y=k\n", - " def getb(self):\n", - " return self.__y\n", - " def show(self):\n", - " print self._A__x, self.geta(), self.getb()\n", - "class C(A):\n", - " __z=int\n", - " def __init__(self, i, k):\n", - " A.__init__(self, i)\n", - " self.__z=k\n", - " def getc(self):\n", - " return self.__z\n", - " def show(self):\n", - " print self._A__x, self.geta(), self.getc()\n", - "class D(B,C):\n", - " def __init__(self, i, j):\n", - " B.__init__(self, i, j)\n", - " C.__init__(self, i, j)\n", - " def show(self):\n", - " print self._A__x, self.geta(), self.getb(), self.getc(), self.getc()\n", - "d1=D(3, 5)\n", - "print \"Object d1 contents:\",\n", - "d1.show() #unlike C++, python executes the 1 argument constuctor of A() instead of implicit call to the no argument constructor of A()\n", - "b1=B(7, 9)\n", - "print \"Object b1 contents:\",\n", - "b1.show()\n", - "c1=C(11, 13)\n", - "print \"Object c1 contents:\",\n", - "c1.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Object d1 contents: 3 3 5 5 5\n", - "Object b1 contents: 7 7 9\n", - "Object c1 contents: 11 11 13\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sports.cpp, Page no-601" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_LEN=25\n", - "class person:\n", - " __name=[chr]*MAX_LEN\n", - " __sex=chr\n", - " __age=int\n", - " def ReadPerson(self):\n", - " self.__name=raw_input(\"Name ? \")\n", - " self.__sex=str(raw_input(\"Sex ? \"))\n", - " self.__age=int(raw_input(\"Age ? \"))\n", - " def DisplayPerson(self):\n", - " print \"Name:\", self.__name\n", - " print \"Sex: \", self.__sex\n", - " print \"Age: \", self.__age\n", - "class sports(person):\n", - " __name=[chr]*MAX_LEN\n", - " __score=int\n", - " def ReadData(self):\n", - " self.__name=raw_input(\"Game Played ? \")\n", - " self.__score=int(raw_input(\"Game Score ? \"))\n", - " def DisplayData(self):\n", - " print \"Sports Played:\", self.__name\n", - " print \"Game Score: \", self.__score\n", - " def SportsScore(self):\n", - " return self.__score\n", - "class student(person):\n", - " __RollNo=int\n", - " __branch=[chr]*20\n", - " def ReadData(self):\n", - " self.__RollNo=int(raw_input(\"Roll Number ? \"))\n", - " self.__branch=raw_input(\"Branch Studying ? \")\n", - " def DisplayData(self):\n", - " print \"Roll Number:\", self.__RollNo\n", - " print \"Branch:\", self.__branch\n", - "class exam(student):\n", - " __Sub1Marks=int\n", - " __Sub2Marks=int\n", - " def ReadData(self):\n", - " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", - " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", - " def DisplayData(self):\n", - " print \"Marks scored in Subject 1:\", self.__Sub1Marks\n", - " print \"Marks scored in Subject 2:\", self.__Sub2Marks\n", - " print \"Total Marks Scored:\", self.TotalMarks()\n", - " def TotalMarks(self):\n", - " return self.__Sub1Marks+self.__Sub2Marks\n", - "class result(exam, sports):\n", - " __total=int\n", - " def ReadData(self):\n", - " self.ReadPerson()\n", - " student.ReadData(self)\n", - " exam.ReadData(self)\n", - " sports.ReadData(self)\n", - " def DisplayData(self):\n", - " self.DisplayPerson()\n", - " student.DisplayData(self)\n", - " exam.DisplayData(self)\n", - " sports.DisplayData(self)\n", - " print \"Overall Performance, (exam + sports) :\",self.Percentage(), \"%\"\n", - " def Percentage(self):\n", - " return (exam.TotalMarks(self)+self.SportsScore())/3\n", - "Student=result()\n", - "print \"Enter data for Student...\"\n", - "Student.ReadData()\n", - "print \"Student Details...\"\n", - "Student.DisplayData()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for Student...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sex ? M\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age ? 24\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 9\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch Studying ? Computer-Technology\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 1 < Max:100> ? 92\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 2 < Max:100> ? 88\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Game Played ? Cricket\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Game Score ? 85\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Details...\n", - "Name: Rajkumar\n", - "Sex: M\n", - "Age: 24\n", - "Roll Number: 9\n", - "Branch: Computer-Technology\n", - "Marks scored in Subject 1: 92\n", - "Marks scored in Subject 2: 88\n", - "Total Marks Scored: 180\n", - "Sports Played: Cricket\n", - "Game Score: 85\n", - "Overall Performance, (exam + sports) : 88 %\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-nesting.cpp, Page no-605" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " num=int\n", - " def __init__(self, a=None):\n", - " if isinstance(a, int):\n", - " print \"Constructor B( int a ) is invoked\"\n", - " self.num=a\n", - " else:\n", - " self.num=0\n", - "class D:\n", - " data1=int\n", - " objb=B()\n", - " def __init__(self, a):\n", - " self.objb.__init__(a)\n", - " self.data1=a\n", - " def output(self):\n", - " print \"Data in Object of Class S =\", self.data1\n", - " print \"Data in Member object of class B in class D = \",self.objb.num\n", - "objd = D(10)\n", - "objd.output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor B( int a ) is invoked\n", - "Data in Object of Class S = 10\n", - "Data in Member object of class B in class D = 10\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-publish2.cpp, Page no-608" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class publication:\n", - " __title=[chr]*40\n", - " __price=float\n", - " def getdata(self):\n", - " self.__title=raw_input(\"\\tEnter Title: \")\n", - " self.__price=float(raw_input(\"\\tEnter Price: \"))\n", - " def display(self):\n", - " print \"\\tTitle =\", self.__title\n", - " print \"\\tPrice = %g\" %(self.__price)\n", - "class sales:\n", - " __PublishSales=[]\n", - " def __init__(self):\n", - " self.__PublishSales=[float]*3\n", - " def getdata(self):\n", - " for i in range(3):\n", - " print \"\\tEnter Sales of\", i+1, \"Month: \",\n", - " self.__PublishSales[i]=float(raw_input())\n", - " def display(self):\n", - " TotalSales=0\n", - " for i in range(3):\n", - " print \"\\tSales of\", i+1, \"Month = %g\" %(self.__PublishSales[i])\n", - " TotalSales+=self.__PublishSales[i]\n", - " print \"\\tTotalSales = %g\" %(TotalSales)\n", - "class book:\n", - " __pages=int\n", - " pub=publication()\n", - " market=sales()\n", - " def getdata(self):\n", - " self.pub.getdata()\n", - " self.__pages=int(raw_input(\"\\tEnter Number of Pages: \"))\n", - " self.market.getdata()\n", - " def display(self):\n", - " self.pub.display()\n", - " print \"\\tNumber of Pages = %g\" %(self.__pages)\n", - " self.market.display()\n", - "book1=book()\n", - "print \"Enter Book Publication Data...\"\n", - "book1.getdata()\n", - "print \"Book Publication Data...\"\n", - "book1.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Book Publication Data...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Title: Microprocessor-x86-Programming\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Price: 180\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Number of Pages: 750\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Sales of 1 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1000\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \tEnter Sales of 2 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "500\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \tEnter Sales of 3 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "800\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Book Publication Data...\n", - "\tTitle = Microprocessor-x86-Programming\n", - "\tPrice = 180\n", - "\tNumber of Pages = 750\n", - "\tSales of 1 Month = 1000\n", - "\tSales of 2 Month = 500\n", - "\tSales of 3 Month = 800\n", - "\tTotalSales = 2300\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-611" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class employee:\n", - " emp_id=int\n", - " emp_name=[chr]*30\n", - " def getdata(self):\n", - " self.__emp_id=int(raw_input(\"Enter employee number: \"))\n", - " self.__emp_name=raw_input(\"Enter emploee name: \")\n", - " def displaydata(self):\n", - " print \"Employee Number:\", self.__emp_id, \"\\nEmployee Name:\", self.__emp_name\n", - "class emp_union:\n", - " __member_id=int\n", - " def getdata(self):\n", - " self.__member_id=int(raw_input(\"Enter member id: \"))\n", - " def displaydata(self):\n", - " print \"Member ID:\", self.__member_id\n", - "class emp_info(employee, emp_union):\n", - " __basic_salary=float\n", - " def getdata(self):\n", - " employee.getdata(self)\n", - " emp_union.getdata(self)\n", - " self.__basic_salary=int(raw_input(\"Enter basic salary: \"))\n", - " def displaydata(self):\n", - " employee.displaydata(self)\n", - " emp_union.displaydata(self)\n", - " print \"Basic Salary:\", self.__basic_salary\n", - "e1=emp_info()\n", - "e1.getdata()\n", - "e1.displaydata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter employee number: 23\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter emploee name: Krishnan\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter member id: 443\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter basic salary: 8500\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Employee Number: 23 \n", - "Employee Name: Krishnan\n", - "Member ID: 443\n", - "Basic Salary: 8500\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-2, Page no-613" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class details:\n", - " __name=[chr]*30\n", - " __address=[chr]*50\n", - " def getdata(self):\n", - " self.__name=raw_input(\"Name: \")\n", - " self.__address=raw_input(\"Address: \")\n", - " def displaydata(self):\n", - " print \"Name:\", self.__name,\"\\nAddress:\", self.__address\n", - "class student(details):\n", - " __marks=float\n", - " def getdata(self):\n", - " details.getdata(self)\n", - " self.__marks=float(raw_input(\"Percentage Marks: \"))\n", - " def displaydata(self):\n", - " details.displaydata(self)\n", - " print \"Percentage Marks: %g\" %(self.__marks)\n", - "class staff(details):\n", - " __salary=float\n", - " def getdata(self):\n", - " details.getdata(self)\n", - " self.__salary=float(raw_input(\"Salary: \"))\n", - " def displaydata(self):\n", - " details.displaydata(self)\n", - " print \"Salary: %g\" %(self.__salary)\n", - "student1=student()\n", - "staff1=staff()\n", - "print \"Enter student data:\"\n", - "student1.getdata()\n", - "print \"Enter staff data:\"\n", - "staff1.getdata()\n", - "print \"Displaying student and staff data:\"\n", - "student1.displaydata()\n", - "staff1.displaydata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter student data:\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Venkatesh\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Address: H.No. 89, AGM Society, Bangalore\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Percentage Marks: 78.4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter staff data:\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Vijayan\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Address: H.No. A-2, SLR Society, Bangalore\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Salary: 25000\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Displaying student and staff data:\n", - "Name: Venkatesh \n", - "Address: H.No. 89, AGM Society, Bangalore\n", - "Percentage Marks: 78.4\n", - "Name: Vijayan \n", - "Address: H.No. A-2, SLR Society, Bangalore\n", - "Salary: 25000\n" - ] - } - ], - "prompt_number": 2 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance_1.ipynb deleted file mode 100755 index a617fa5c..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter14-Inheritance_1.ipynb +++ /dev/null @@ -1,2736 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:63736c9aef28a6babc99661e161907400b7b80441a3f765e7ab8b6e00648ce25" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 14- Inheritance" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-bag.cpp, Page-544" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "(false, true)=(0, 1) #enum type\n", - "type =['false', 'true']\n", - "MAX_ITEMS=25\n", - "def IsExist(self, item):\n", - " for i in range(self._Bag__ItemCount):\n", - " if self._Bag__contents[i]==item:\n", - " return true\n", - " return false\n", - "def show(self):\n", - " for i in range(self._Bag__ItemCount):\n", - " print self._Bag__contents[i],\n", - " print \"\"\n", - "class Bag:\n", - " __contents=[int]*MAX_ITEMS #protected members\n", - " __ItemCount=int\n", - " def __init__(self):\n", - " self.__ItemCount=0\n", - " def put(self, item):\n", - " self.__contents[self.__ItemCount]=item\n", - " self.__ItemCount+=1\n", - " def IsEmpty(self):\n", - " return true if self.__ItemCount==0 else false\n", - " def IsFull(self):\n", - " return true if self.__ItemCount==MAX_ITEMS else false\n", - " IsExist=IsExist\n", - " show=show\n", - "bag=Bag()\n", - "item=int\n", - "while(true):\n", - " item=int(raw_input(\"Enter Item Number to be put into the bag <0-no item>: \"))\n", - " if item==0:\n", - " break\n", - " bag.put(item)\n", - " print \"Items in Bag:\",\n", - " bag.show()\n", - " if bag.IsFull():\n", - " print \"Bag Full, no more items can be placed\"\n", - " break" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in Bag: 1 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Number to be put into the bag <0-no item>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in Bag: 1 2 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in Bag: 1 2 3 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in Bag: 1 2 3 3 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in Bag: 1 2 3 3 1 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Number to be put into the bag <0-no item>: 0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-union.cpp, Page no-548" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "(false, true)=(0, 1) #enum type\n", - "type =['false', 'true']\n", - "MAX_ITEMS=25\n", - "def IsExist(self, item):\n", - " for i in range(self._Bag__ItemCount):\n", - " if self._Bag__contents[i]==item:\n", - " return true\n", - " return false\n", - "def show(self):\n", - " for i in range(self._Bag__ItemCount):\n", - " print self._Bag__contents[i],\n", - " print \"\"\n", - "class Bag:\n", - " #protected members\n", - " __ItemCount=int\n", - " def __init__(self):\n", - " self.__ItemCount=0\n", - " self.__contents=[int]*MAX_ITEMS\n", - " def put(self, item):\n", - " self.__contents[self.__ItemCount]=item\n", - " self.__ItemCount+=1\n", - " def IsEmpty(self):\n", - " return true if self.__ItemCount==0 else false\n", - " def IsFull(self):\n", - " return true if self.__ItemCount==MAX_ITEMS else false\n", - " IsExist=IsExist\n", - " show=show\n", - "def read(self):\n", - " while(true):\n", - " element=int(raw_input(\"Enter Set Element <0-end>: \"))\n", - " if element==0:\n", - " break\n", - " self.Add(element)\n", - "def add(s1, s2):\n", - " temp = Set()\n", - " temp=s1\n", - " for i in range(s2._Bag__ItemCount):\n", - " if s1.IsExist(s2._Bag__contents[i])==false:\n", - " temp.Add(s2._Bag__contents[i])\n", - " return temp\n", - "class Set(Bag):\n", - " def Add(self,element):\n", - " if(self.IsExist(element)==false and self.IsFull()==false):\n", - " self.put(element)\n", - " read=read\n", - " def __assign__(self, s2):\n", - " for i in range(s2._Bag__ItemCount):\n", - " self.__contents[i]=s2.__contents[i]\n", - " self.__ItemCount=s2.__ItemCount\n", - " def __add__(self, s2):\n", - " return add(self, s2)\n", - "s1=Set()\n", - "s2=Set()\n", - "s3=Set()\n", - "print \"Enter Set 1 elements..\"\n", - "s1.read()\n", - "print \"Enter Set 2 elemets..\"\n", - "s2.read()\n", - "s3=s1+s2\n", - "print \"Union of s1 and s2 :\",\n", - "s3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set 1 elements..\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set 2 elemets..\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 6\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Union of s1 and s2 : 1 2 3 4 5 6 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons1.cpp, Page no-558" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " pass\n", - "class D(B):\n", - " def msg(self):\n", - " print \"No constructors exist in base and derived class\"\n", - "objd=D()\n", - "objd.msg()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No constructors exist in base and derived class\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons2.cpp, Page no-558" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " def __init__(self):\n", - " print \"No-argument constructor of base class B is executed\"\n", - "class D(B):\n", - " pass\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of base class B is executed\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons3.cpp, Page no-559" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " pass\n", - "class D(B):\n", - " def __init__(self):\n", - " print \"Constructors exist only in derived class\"\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructors exist only in derived class\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons4.cpp, Page no-559" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " def __init__(self):\n", - " print \"No-argument constructor of base class B executed first\"\n", - "class D(B):\n", - " def __init__(self):\n", - " B.__init__(self)\n", - " print \"No-argument constructor of derived class D executed next\"\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of base class B executed first\n", - "No-argument constructor of derived class D executed next\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons5.cpp, Page no-560" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " def __init__(self, a=0):\n", - " if isinstance(a, int):\n", - " print \"One-argument constructor of the base class B\"\n", - " else:\n", - " print \"No-argument constructor of the base class B\"\n", - "class D(B):\n", - " def __init__(self, a):\n", - " B.__init__(self, a)\n", - " print \"One-argument constructor of the derived class D\"\n", - "objd=D(3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "One-argument constructor of the base class B\n", - "One-argument constructor of the derived class D\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons7.cpp, Page no-561" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " def __init__(self, a):\n", - " print \"One-argument constructor of the base class B\"\n", - "class D(B):\n", - " def __init__(self, a):\n", - " B(a)\n", - " print \"One-argument constructor of the derived class D\"\n", - "objd=D(3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "One-argument constructor of the base class B\n", - "One-argument constructor of the derived class D\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons8.cpp, Page no-562" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B1:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B1\"\n", - "class B2:\n", - " def __init__(self):\n", - " B1.__init__(self)\n", - " print \"No-argument constructor of the base class B2\"\n", - "class D(B2, B1):\n", - " def __init__(self):\n", - " B2.__init__(self)\n", - " print \"No-argument constructor of the derived class D\"\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of the base class B1\n", - "No-argument constructor of the base class B2\n", - "No-argument constructor of the derived class D\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons9.cpp, Page no-563" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B1:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B1\"\n", - "class B2:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B2\"\n", - "class D(B1, B2):\n", - " def __init__(self):\n", - " B1()\n", - " B2()\n", - " print \"No-argument constructor of the derived class D\"\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of the base class B1\n", - "No-argument constructor of the base class B2\n", - "No-argument constructor of the derived class D\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons10.cpp, Page no-563" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B1:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B1\"\n", - "class B2:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B2\"\n", - "class D(B1, B2):\n", - " def __init__(self):\n", - " B2()\n", - " B1()\n", - " print \"No-argument constructor of the derived class D\"\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of the base class B2\n", - "No-argument constructor of the base class B1\n", - "No-argument constructor of the derived class D\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons11.cpp, Page no-564" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " def __init__(self):\n", - " print \"No-argument constructor of a base class B\"\n", - "class D1(B):\n", - " def __init__(self):\n", - " B.__init__(self)\n", - " print \"No-argument constructor of a base class D1\"\n", - "class D2(D1):\n", - " def __init__(self):\n", - " D1.__init__(self)\n", - " print \"No-argument constructor of a derived class D2\"\n", - "objd=D2()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of a base class B\n", - "No-argument constructor of a base class D1\n", - "No-argument constructor of a derived class D2\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons12.cpp, Page no-566" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B1:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B1\"\n", - " def __del__(self):\n", - " print \"Desctructor in the base class B1\"\n", - "class B2:\n", - " def __init__(self):\n", - " print \"No-argument constructor of the base class B2\"\n", - " def __del__(self):\n", - " print \"Desctructor in the base class B2\"\n", - "class D(B1, B2):\n", - " def __init__(self):\n", - " B1.__init__(self)\n", - " B2.__init__(self)\n", - " print \"No-argument constructor of the derived class D\"\n", - " def __del__(self):\n", - " print \"Desctructor in the derived class D\"\n", - " for b in self.__class__.__bases__:\n", - " b.__del__(self)\n", - "objd=D()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No-argument constructor of the base class B1\n", - "No-argument constructor of the base class B2\n", - "No-argument constructor of the derived class D\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons13.cpp, Page no-568" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " __x=int\n", - " __y=int\n", - " def __init__(self, a, b):\n", - " self.__x=a\n", - " self.__y=b\n", - "class D(B):\n", - " __a=int\n", - " __b=int\n", - " def __init__(self, p, q, r):\n", - " self.__a=p\n", - " B.__init__(self, p, q)\n", - " self.__b=r\n", - " def output(self):\n", - " print \"x =\", self._B__x\n", - " print \"y =\", self._B__y\n", - " print \"a =\", self.__a\n", - " print \"b =\", self.__b\n", - "objd=D(5, 10, 15)\n", - "objd.output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x = 5\n", - "y = 10\n", - "a = 5\n", - "b = 15\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-runtime.cpp, Page no-570" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " __x=int\n", - " __y=int(0) #initialization\n", - " def __init__(self, a, b):\n", - " self.__x=self.__y+b\n", - " self.__y=a\n", - " def Print(self):\n", - " print \"x =\", self.__x\n", - " print \"y =\", self.__y\n", - "b = B(2, 3)\n", - "b.Print()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x = 3\n", - "y = 2\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cons14.cpp, Page no-570" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " __x=int\n", - " __y=int\n", - " def read(self):\n", - " self.__x=int(raw_input(\"X in class B ? \"))\n", - " self.__y=int(raw_input(\"Y in class B ? \"))\n", - " def show(self):\n", - " print \"X in class B =\", self.__x\n", - " print \"Y in class B =\", self.__y\n", - "class D(B):\n", - " __y=int\n", - " __z=int\n", - " def read(self):\n", - " B.read(self)\n", - " self.__y=int(raw_input(\"Y in class D ? \"))\n", - " self.__z=int(raw_input(\"Z in class D ? \"))\n", - " def show(self):\n", - " B.show(self)\n", - " print \"Y in class D =\", self.__y\n", - " print \"Z in class D =\", self.__z\n", - " print \"Y of B, show from D =\", self._B__y\n", - "objd=D()\n", - "print \"Enter data for object of class D..\"\n", - "objd.read()\n", - "print \"Contents of object of class D..\"\n", - "objd.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for object of class D..\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "X in class B ? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Y in class B ? 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Y in class D ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Z in class D ? 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Contents of object of class D..\n", - "X in class B = 1\n", - "Y in class B = 2\n", - "Y in class D = 3\n", - "Z in class D = 4\n", - "Y of B, show from D = 2\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-stack.cpp, Page no-573" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_ELEMENTS=5\n", - "class Stack:\n", - " __stack=[int]*(MAX_ELEMENTS+1)\n", - " __StackTop=int\n", - " def __init__(self):\n", - " self.__StackTop=0\n", - " def push(self, element):\n", - " self.__StackTop+=1\n", - " self.__stack[self.__StackTop]=element\n", - " def pop(self, element):\n", - " element=self.__stack[self.__StackTop]\n", - " self.__StackTop-=1\n", - " return element\n", - "class MyStack(Stack):\n", - " def push(self, element):\n", - " if self._Stack__StackTop0:\n", - " element=Stack.pop(self, element)\n", - " return element\n", - " print \"Stack Underflow\"\n", - " return 0\n", - "stack=MyStack()\n", - "print \"Enter Integer data to put into the stack...\"\n", - "while(1):\n", - " element=int(raw_input(\"Element to Push ? \"))\n", - " if stack.push(element)==0:\n", - " break\n", - "print \"The Stack Contains...\"\n", - "element=stack.pop(element)\n", - "while element:\n", - " print \"pop:\", element\n", - " element=stack.pop(element)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Integer data to put into the stack...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element to Push ? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element to Push ? 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element to Push ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element to Push ? 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element to Push ? 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element to Push ? 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Stack Overflow\n", - "The Stack Contains...\n", - "pop: 5\n", - "pop: 4\n", - "pop: 3\n", - "pop: 2\n", - "pop: 1\n", - "Stack Underflow\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-exam.cpp, Page no-577" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_LEN=25\n", - "class person:\n", - " __name=[chr]*MAX_LEN\n", - " __sex=chr\n", - " __age=int\n", - " def ReadData(self):\n", - " self.__name=raw_input(\"Name ? \")\n", - " self.__sex=str(raw_input(\"Sex ? \"))\n", - " self.__age=int(raw_input(\"Age ? \"))\n", - " def DisplayData(self):\n", - " print \"Name:\", self.__name\n", - " print \"Sex: \", self.__sex\n", - " print \"Age: \", self.__age\n", - "class student(person):\n", - " __RollNo=int\n", - " __branch=[chr]*20\n", - " def ReadData(self):\n", - " person.ReadData(self) #invoking member function ReadData of base class person\n", - " self.__RollNo=int(raw_input(\"Roll Number ? \"))\n", - " self.__branch=raw_input(\"Branch Studying ? \")\n", - " def DisplayData(self):\n", - " person.DisplayData(self) #invoking member function DisplayData of base class person\n", - " print \"Roll Number:\", self.__RollNo\n", - " print \"Branch:\", self.__branch\n", - "class exam(student):\n", - " __Sub1Marks=int\n", - " __Sub2Marks=int\n", - " def ReadData(self):\n", - " student.ReadData(self) #invoking member function ReadData of base class student\n", - " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", - " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", - " def DisplayData(self):\n", - " student.DisplayData(self) #invoking member function DisplayData of base class student\n", - " print \"Marks scored in Subject 1:\", self.__Sub1Marks\n", - " print \"Marks scored in Subject 2:\", self.__Sub2Marks\n", - " print \"Total Marks Scored:\", self.TotalMarks()\n", - " def TotalMarks(self):\n", - " return self.__Sub1Marks+self.__Sub2Marks\n", - "annual=exam()\n", - "print \"Enter data for Student...\"\n", - "annual.ReadData()\n", - "print \"Student Details...\"\n", - "annual.DisplayData()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for Student...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sex ? M\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age ? 24\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 9\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch Studying ? Computer-Technology\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 1 < Max:100> ? 92\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 2 < Max:100> ? 88\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Details...\n", - "Name: Rajkumar\n", - "Sex: M\n", - "Age: 24\n", - "Roll Number: 9\n", - "Branch: Computer-Technology\n", - "Marks scored in Subject 1: 92\n", - "Marks scored in Subject 2: 88\n", - "Total Marks Scored: 180\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mul_inh1.cpp, Page no-580" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "class A:\n", - " def __init__(self):\n", - " sys.stdout.write('a'),\n", - "class B:\n", - " def __init__(self):\n", - " sys.stdout.write('b'),\n", - "class C(A, B):\n", - " def __init__(self):\n", - " A.__init__(self)\n", - " B.__init__(self)\n", - " sys.stdout.write('c'),\n", - "objc=C()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "abc" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mul_inh2.cpp, Page no-581" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class A:\n", - " def __init__(self, c):\n", - " sys.stdout.write(c),\n", - "class B:\n", - " def __init__(self, b):\n", - " sys.stdout.write(b),\n", - "class C(A, B):\n", - " def __init__(self, c1, c2, c3):\n", - " A.__init__(self, c1)\n", - " B.__init__(self, c2)\n", - " sys.stdout.write(c3),\n", - "objc=C('a', 'b', 'c')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "abc" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mul_inh4.cpp, Page no-583" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "class A:\n", - " __ch=chr\n", - " def __init__(self, c):\n", - " self.__ch=c\n", - " def show(self):\n", - " sys.stdout.write(self.__ch),\n", - "class B:\n", - " __ch=chr\n", - " def __init__(self, b):\n", - " self.__ch=b\n", - " def show(self):\n", - " sys.stdout.write(self.__ch),\n", - "class C(A, B):\n", - " __ch=chr\n", - " def __init__(self, c1, c2, c3):\n", - " A.__init__(self, c1)\n", - " B.__init__(self, c2)\n", - " self.__ch=c3\n", - "objc=C('a', 'b', 'c')\n", - "print \"objc.A::show() = \",\n", - "A.show(objc)\n", - "print \"\\nobjc.B::show() = \",\n", - "B.show(objc)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "objc.A::show() = a \n", - "objc.B::show() = b\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mul_inh5.cpp, Page no-584" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "class A:\n", - " __ch=chr\n", - " def __init__(self, c):\n", - " self.__ch=c\n", - " def show(self):\n", - " sys.stdout.write(self.__ch),\n", - "class B:\n", - " __ch=chr\n", - " def __init__(self, b):\n", - " self.__ch=b\n", - " def show(self):\n", - " sys.stdout.write(self.__ch),\n", - "class C(A, B):\n", - " __ch=chr\n", - " def __init__(self, c1, c2, c3):\n", - " A.__init__(self, c1)\n", - " B.__init__(self, c2)\n", - " self.__ch=c3\n", - " def show(self):\n", - " A.show(self)\n", - " B.show(self)\n", - " sys.stdout.write(self.__ch),\n", - "objc=C('a', 'b', 'c')\n", - "print \"objc.show() = \",\n", - "objc.show()\n", - "print \"\\nobjc.C::show() = \",\n", - "C.show(objc)\n", - "print \"\\nobjc.A::show() = \",\n", - "A.show(objc)\n", - "print \"\\nobjc.B::show() = \",\n", - "B.show(objc)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "objc.show() = abc \n", - "objc.C::show() = abc \n", - "objc.A::show() = a \n", - "objc.B::show() = b\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-publish1.cpp, Page no-586" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class publication:\n", - " __title=[chr]*40\n", - " __price=float\n", - " def getdata(self):\n", - " self.__title=raw_input(\"\\tEnter Title: \")\n", - " self.__price=float(raw_input(\"\\tEnter Price: \"))\n", - " def display(self):\n", - " print \"\\tTitle =\", self.__title\n", - " print \"\\tPrice = %g\" %(self.__price)\n", - "class sales:\n", - " __PublishSales=[]\n", - " def __init__(self):\n", - " self.__PublishSales=[float]*3\n", - " def getdata(self):\n", - " for i in range(3):\n", - " print \"\\tEnter Sales of\", i+1, \"Month: \",\n", - " self.__PublishSales[i]=float(raw_input())\n", - " def display(self):\n", - " TotalSales=0\n", - " for i in range(3):\n", - " print \"\\tSales of\", i+1, \"Month = %g\" %(self.__PublishSales[i])\n", - " TotalSales+=self.__PublishSales[i]\n", - " print \"\\tTotalSales = %g\" %(TotalSales)\n", - "class book(publication, sales):\n", - " __pages=int\n", - " def getdata(self):\n", - " publication.getdata(self)\n", - " self.__pages=int(raw_input(\"\\tEnter Number of Pages: \"))\n", - " sales.getdata(self)\n", - " def display(self):\n", - " publication.display(self)\n", - " print \"\\tNumber of Pages = %g\" %(self.__pages)\n", - " sales.display(self)\n", - "class tape(publication, sales):\n", - " __PlayTime=int\n", - " def getdata(self):\n", - " publication.getdata(self)\n", - " self.__PlayTime=int(raw_input(\"\\tEnter Playing Time in Minute: \"))\n", - " sales.getdata(self)\n", - " def display(self):\n", - " publication.display(self)\n", - " print \"\\tPlaying Time in Minute = %g\" %(self.__PlayTime)\n", - " sales.display(self)\n", - "class pamphlet(publication):\n", - " pass\n", - "class notice(pamphlet):\n", - " __whom=[chr]*20\n", - " def getdata(self):\n", - " pamphlet.getdata(self)\n", - " self.__whom=raw_input(\"\\tEnter Type of Distributor: \")\n", - " def display(self):\n", - " pamphlet.display(self)\n", - " print \"\\tType of Distributor =\", self.__whom\n", - "book1=book()\n", - "tape1=tape()\n", - "pamp1=pamphlet()\n", - "notice1=notice()\n", - "print \"Enter Book Publication Data...\"\n", - "book1.getdata()\n", - "print \"Enter Tape Publication Data...\"\n", - "tape1.getdata()\n", - "print \"Enter Pamhlet Publication Data...\"\n", - "pamp1.getdata()\n", - "print \"Enter Notice Publication Data...\"\n", - "notice1.getdata()\n", - "print \"Book Publication Data...\"\n", - "book1.display()\n", - "print \"Tape Publication Data...\"\n", - "tape1.display()\n", - "print \"Pamphlet Publication Data...\"\n", - "pamp1.display()\n", - "print \"Notice Publication Data...\"\n", - "notice1.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Book Publication Data...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Title: Microprocessor-x86-Programming\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Price: 180\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Number of Pages: 750\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Sales of 1 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1000\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \tEnter Sales of 2 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "500\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \tEnter Sales of 3 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "800\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Tape Publication Data...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Title: Love-1947\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Price: 100\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Playing Time in Minute: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Sales of 1 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "200\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \tEnter Sales of 2 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "500\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \tEnter Sales of 3 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "400\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Pamhlet Publication Data...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Title: Advanced-Computing-95-Conference\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Price: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Notice Publication Data...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Title: General-Meeting\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Price: 100\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Type of Distributor: Retail\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Book Publication Data...\n", - "\tTitle = Microprocessor-x86-Programming\n", - "\tPrice = 180\n", - "\tNumber of Pages = 750\n", - "\tSales of 1 Month = 1000\n", - "\tSales of 2 Month = 500\n", - "\tSales of 3 Month = 800\n", - "\tTotalSales = 2300\n", - "Tape Publication Data...\n", - "\tTitle = Love-1947\n", - "\tPrice = 100\n", - "\tPlaying Time in Minute = 10\n", - "\tSales of 1 Month = 200\n", - "\tSales of 2 Month = 500\n", - "\tSales of 3 Month = 400\n", - "\tTotalSales = 1100\n", - "Pamphlet Publication Data...\n", - "\tTitle = Advanced-Computing-95-Conference\n", - "\tPrice = 10\n", - "Notice Publication Data...\n", - "\tTitle = General-Meeting\n", - "\tPrice = 100\n", - "\tType of Distributor = Retail\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vehicle.cpp, Page no-591" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_LEN=25\n", - "class Vehicle:\n", - " __name=[chr]*MAX_LEN\n", - " __WheelsCount=int\n", - " def GetData(self):\n", - " self.__name=raw_input(\"Name of the Vehicle ? \")\n", - " self.__WheelsCount=int(raw_input(\"Wheels ? \"))\n", - " def DisplayData(self):\n", - " print \"Name of the Vehicle :\", self.__name \n", - " print \"Wheels :\", self.__WheelsCount\n", - "class LightMotor(Vehicle):\n", - " __SpeedLimit=int\n", - " def GetData(self):\n", - " Vehicle.GetData(self)\n", - " self.__SpeedLimit=int(raw_input(\"Speed Limit ? \"))\n", - " def DisplayData(self):\n", - " Vehicle.DisplayData(self)\n", - " print \"Speed Limit :\", self.__SpeedLimit\n", - "class HeavyMotor(Vehicle):\n", - " __permit=[chr]*MAX_LEN\n", - " __LoadCapacity=int\n", - " def GetData(self):\n", - " Vehicle.GetData(self)\n", - " self.__LoadCapacity=int(raw_input(\"Load Carrying Capacity ? \"))\n", - " self.__permit=raw_input(\"Permit Type ? \")\n", - " def DisplayData(self):\n", - " Vehicle.DisplayData(self)\n", - " print \"Load Carrying Capacity : \", self.__LoadCapacity \n", - " print \"Permit:\", self.__permit\n", - "class GearMotor(LightMotor):\n", - " __GearCount=int\n", - " def GetData(self):\n", - " LightMotor.GetData(self)\n", - " self.__GearCount=int(raw_input(\"No. of Gears ? \"))\n", - " def DisplayData(self):\n", - " LightMotor.DisplayData(self)\n", - " print \"Gears :\", self.__GearCount\n", - "class NonGearMotor(LightMotor):\n", - " def GetData(self):\n", - " LightMotor.Getdata(self)\n", - " def DisplayData(self):\n", - " LightMotor.DisplayData(self)\n", - "class Passenger(HeavyMotor):\n", - " __sitting=int\n", - " __standing=int\n", - " def GetData(self):\n", - " HeavyMotor.GetData(self)\n", - " self.__sitting=int(raw_input(\"Maximum Seats ? \"))\n", - " self.__standing=int(raw_input(\"Maximum Standing ? \"))\n", - " def DisplayData(self):\n", - " HeavyMotor.DisplayData(self)\n", - " print \"Maximum Seats:\", self.__sitting\n", - " print \"Maximum Standing:\", self.__standing\n", - "class Goods(HeavyMotor):\n", - " def GetData(self):\n", - " HeavyMotor.Getdata(self)\n", - " def DisplayData(self):\n", - " HeavyMotor.DisplayData(self)\n", - "vehi1=GearMotor()\n", - "vehi2=Passenger()\n", - "print \"Enter Data for Gear Motor Vehicle...\"\n", - "vehi1.GetData()\n", - "print \"Enter Data for Passenger Motor Vehicle...\"\n", - "vehi2.GetData()\n", - "print \"Data of Gear Motor Vehicle...\"\n", - "vehi1.DisplayData()\n", - "print \"Data of Passenger Motor Vehicle...\"\n", - "vehi2.DisplayData()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Data for Gear Motor Vehicle...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name of the Vehicle ? Maruti-Car\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wheels ? 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed Limit ? 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "No. of Gears ? 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Data for Passenger Motor Vehicle...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name of the Vehicle ? KSRTC-BUS\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wheels ? 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Load Carrying Capacity ? 60\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Permit Type ? National\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum Seats ? 45\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum Standing ? 60\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Data of Gear Motor Vehicle...\n", - "Name of the Vehicle : Maruti-Car\n", - "Wheels : 4\n", - "Speed Limit : 4\n", - "Gears : 5\n", - "Data of Passenger Motor Vehicle...\n", - "Name of the Vehicle : KSRTC-BUS\n", - "Wheels : 4\n", - "Load Carrying Capacity : 60\n", - "Permit: National\n", - "Maximum Seats: 45\n", - "Maximum Standing: 60\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-int_ext.cpp, Page no-595" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_LEN=25\n", - "class student():\n", - " __RollNo=int\n", - " __branch=[chr]*20\n", - " def ReadStudentData(self):\n", - " self.__RollNo=int(raw_input(\"Roll Number ? \"))\n", - " self.__branch=raw_input(\"Branch Studying ? \")\n", - " def DisplayStudentData(self):\n", - " print \"Roll Number:\", self.__RollNo\n", - " print \"Branch:\", self.__branch\n", - "class InternalExam(student):\n", - " __Sub1Marks=int\n", - " __Sub2Marks=int\n", - " def ReadData(self):\n", - " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", - " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", - " def DisplayData(self):\n", - " print \"Internal Marks scored in Subject 1:\", self.__Sub1Marks\n", - " print \"Internal Marks scored in Subject 2:\", self.__Sub2Marks\n", - " print \"Internal Total Marks Scored:\", self.TotalMarks()\n", - " def InternalTotalMarks(self):\n", - " return self.__Sub1Marks+self.__Sub2Marks\n", - "class ExternalExam(student):\n", - " __Sub1Marks=int\n", - " __Sub2Marks=int\n", - " def ReadData(self):\n", - " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", - " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", - " def DisplayData(self):\n", - " print \"External Marks scored in Subject 1:\", self.__Sub1Marks\n", - " print \"External Marks scored in Subject 2:\", self.__Sub2Marks\n", - " print \"External Total Marks Scored:\", self.ExternalTotalMarks()\n", - " def ExternalTotalMarks(self):\n", - " return self.__Sub1Marks+self.__Sub2Marks\n", - "class result(InternalExam, ExternalExam):\n", - " __total=int\n", - " def TotalMarks(self):\n", - " return InternalExam.InternalTotalMarks(self)+ExternalExam.ExternalTotalMarks(self)\n", - "student1=result()\n", - "print \"Enter data for Student1...\"\n", - "student1.ReadStudentData()\n", - "print \"Enter internal marks...\"\n", - "InternalExam.ReadData(student1)\n", - "print \"Enter external marks...\"\n", - "ExternalExam.ReadData(student1)\n", - "print \"Student Details...\"\n", - "student1.DisplayStudentData()\n", - "InternalExam.DisplayData(student1)\n", - "ExternalExam.DisplayData(student1)\n", - "print \"Total Marks =\", student1.TotalMarks()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for Student1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 9\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch Studying ? Computer-Technology\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter internal marks...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 1 < Max:100> ? 80\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 2 < Max:100> ? 85\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter external marks...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 1 < Max:100> ? 89\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 2 < Max:100> ? 90\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Details...\n", - "Roll Number: 9\n", - "Branch: Computer-Technology\n", - "Internal Marks scored in Subject 1: 80\n", - "Internal Marks scored in Subject 2: 85\n", - "Internal Total Marks Scored: 344\n", - "External Marks scored in Subject 1: 89\n", - "External Marks scored in Subject 2: 90\n", - "External Total Marks Scored: 179\n", - "Total Marks = 344\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vir.cpp, Page no-598" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class A:\n", - " __x=int\n", - " def __init__(self, i=None):\n", - " if isinstance(i, int):\n", - " self.__x=i\n", - " else:\n", - " self.__x=-1\n", - " def geta(self):\n", - " return self.__x\n", - "class B(A):\n", - " __y=int\n", - " def __init__(self, i, k):\n", - " A.__init__(self, i)\n", - " self.__y=k\n", - " def getb(self):\n", - " return self.__y\n", - " def show(self):\n", - " print self._A__x, self.geta(), self.getb()\n", - "class C(A):\n", - " __z=int\n", - " def __init__(self, i, k):\n", - " A.__init__(self, i)\n", - " self.__z=k\n", - " def getc(self):\n", - " return self.__z\n", - " def show(self):\n", - " print self._A__x, self.geta(), self.getc()\n", - "class D(B,C):\n", - " def __init__(self, i, j):\n", - " B.__init__(self, i, j)\n", - " C.__init__(self, i, j)\n", - " def show(self):\n", - " print self._A__x, self.geta(), self.getb(), self.getc(), self.getc()\n", - "d1=D(3, 5)\n", - "print \"Object d1 contents:\",\n", - "d1.show() #unlike C++, python executes the 1 argument constuctor of A() instead of implicit call to the no argument constructor of A()\n", - "b1=B(7, 9)\n", - "print \"Object b1 contents:\",\n", - "b1.show()\n", - "c1=C(11, 13)\n", - "print \"Object c1 contents:\",\n", - "c1.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Object d1 contents: 3 3 5 5 5\n", - "Object b1 contents: 7 7 9\n", - "Object c1 contents: 11 11 13\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sports.cpp, Page no-601" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_LEN=25\n", - "class person:\n", - " __name=[chr]*MAX_LEN\n", - " __sex=chr\n", - " __age=int\n", - " def ReadPerson(self):\n", - " self.__name=raw_input(\"Name ? \")\n", - " self.__sex=str(raw_input(\"Sex ? \"))\n", - " self.__age=int(raw_input(\"Age ? \"))\n", - " def DisplayPerson(self):\n", - " print \"Name:\", self.__name\n", - " print \"Sex: \", self.__sex\n", - " print \"Age: \", self.__age\n", - "class sports(person):\n", - " __name=[chr]*MAX_LEN\n", - " __score=int\n", - " def ReadData(self):\n", - " self.__name=raw_input(\"Game Played ? \")\n", - " self.__score=int(raw_input(\"Game Score ? \"))\n", - " def DisplayData(self):\n", - " print \"Sports Played:\", self.__name\n", - " print \"Game Score: \", self.__score\n", - " def SportsScore(self):\n", - " return self.__score\n", - "class student(person):\n", - " __RollNo=int\n", - " __branch=[chr]*20\n", - " def ReadData(self):\n", - " self.__RollNo=int(raw_input(\"Roll Number ? \"))\n", - " self.__branch=raw_input(\"Branch Studying ? \")\n", - " def DisplayData(self):\n", - " print \"Roll Number:\", self.__RollNo\n", - " print \"Branch:\", self.__branch\n", - "class exam(student):\n", - " __Sub1Marks=int\n", - " __Sub2Marks=int\n", - " def ReadData(self):\n", - " self.__Sub1Marks=int(raw_input(\"Marks scored in Subject 1 < Max:100> ? \"))\n", - " self.__Sub2Marks=int(raw_input(\"Marks scored in Subject 2 < Max:100> ? \"))\n", - " def DisplayData(self):\n", - " print \"Marks scored in Subject 1:\", self.__Sub1Marks\n", - " print \"Marks scored in Subject 2:\", self.__Sub2Marks\n", - " print \"Total Marks Scored:\", self.TotalMarks()\n", - " def TotalMarks(self):\n", - " return self.__Sub1Marks+self.__Sub2Marks\n", - "class result(exam, sports):\n", - " __total=int\n", - " def ReadData(self):\n", - " self.ReadPerson()\n", - " student.ReadData(self)\n", - " exam.ReadData(self)\n", - " sports.ReadData(self)\n", - " def DisplayData(self):\n", - " self.DisplayPerson()\n", - " student.DisplayData(self)\n", - " exam.DisplayData(self)\n", - " sports.DisplayData(self)\n", - " print \"Overall Performance, (exam + sports) :\",self.Percentage(), \"%\"\n", - " def Percentage(self):\n", - " return (exam.TotalMarks(self)+self.SportsScore())/3\n", - "Student=result()\n", - "print \"Enter data for Student...\"\n", - "Student.ReadData()\n", - "print \"Student Details...\"\n", - "Student.DisplayData()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for Student...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sex ? M\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age ? 24\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 9\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch Studying ? Computer-Technology\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 1 < Max:100> ? 92\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Marks scored in Subject 2 < Max:100> ? 88\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Game Played ? Cricket\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Game Score ? 85\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Details...\n", - "Name: Rajkumar\n", - "Sex: M\n", - "Age: 24\n", - "Roll Number: 9\n", - "Branch: Computer-Technology\n", - "Marks scored in Subject 1: 92\n", - "Marks scored in Subject 2: 88\n", - "Total Marks Scored: 180\n", - "Sports Played: Cricket\n", - "Game Score: 85\n", - "Overall Performance, (exam + sports) : 88 %\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-nesting.cpp, Page no-605" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class B:\n", - " num=int\n", - " def __init__(self, a=None):\n", - " if isinstance(a, int):\n", - " print \"Constructor B( int a ) is invoked\"\n", - " self.num=a\n", - " else:\n", - " self.num=0\n", - "class D:\n", - " data1=int\n", - " objb=B()\n", - " def __init__(self, a):\n", - " self.objb.__init__(a)\n", - " self.data1=a\n", - " def output(self):\n", - " print \"Data in Object of Class S =\", self.data1\n", - " print \"Data in Member object of class B in class D = \",self.objb.num\n", - "objd = D(10)\n", - "objd.output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor B( int a ) is invoked\n", - "Data in Object of Class S = 10\n", - "Data in Member object of class B in class D = 10\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-publish2.cpp, Page no-608" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class publication:\n", - " __title=[chr]*40\n", - " __price=float\n", - " def getdata(self):\n", - " self.__title=raw_input(\"\\tEnter Title: \")\n", - " self.__price=float(raw_input(\"\\tEnter Price: \"))\n", - " def display(self):\n", - " print \"\\tTitle =\", self.__title\n", - " print \"\\tPrice = %g\" %(self.__price)\n", - "class sales:\n", - " __PublishSales=[]\n", - " def __init__(self):\n", - " self.__PublishSales=[float]*3\n", - " def getdata(self):\n", - " for i in range(3):\n", - " print \"\\tEnter Sales of\", i+1, \"Month: \",\n", - " self.__PublishSales[i]=float(raw_input())\n", - " def display(self):\n", - " TotalSales=0\n", - " for i in range(3):\n", - " print \"\\tSales of\", i+1, \"Month = %g\" %(self.__PublishSales[i])\n", - " TotalSales+=self.__PublishSales[i]\n", - " print \"\\tTotalSales = %g\" %(TotalSales)\n", - "class book:\n", - " __pages=int\n", - " pub=publication()\n", - " market=sales()\n", - " def getdata(self):\n", - " self.pub.getdata()\n", - " self.__pages=int(raw_input(\"\\tEnter Number of Pages: \"))\n", - " self.market.getdata()\n", - " def display(self):\n", - " self.pub.display()\n", - " print \"\\tNumber of Pages = %g\" %(self.__pages)\n", - " self.market.display()\n", - "book1=book()\n", - "print \"Enter Book Publication Data...\"\n", - "book1.getdata()\n", - "print \"Book Publication Data...\"\n", - "book1.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Book Publication Data...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Title: Microprocessor-x86-Programming\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Price: 180\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Number of Pages: 750\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\tEnter Sales of 1 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1000\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \tEnter Sales of 2 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "500\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \tEnter Sales of 3 Month: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "800\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Book Publication Data...\n", - "\tTitle = Microprocessor-x86-Programming\n", - "\tPrice = 180\n", - "\tNumber of Pages = 750\n", - "\tSales of 1 Month = 1000\n", - "\tSales of 2 Month = 500\n", - "\tSales of 3 Month = 800\n", - "\tTotalSales = 2300\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-611" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class employee:\n", - " emp_id=int\n", - " emp_name=[chr]*30\n", - " def getdata(self):\n", - " self.__emp_id=int(raw_input(\"Enter employee number: \"))\n", - " self.__emp_name=raw_input(\"Enter emploee name: \")\n", - " def displaydata(self):\n", - " print \"Employee Number:\", self.__emp_id, \"\\nEmployee Name:\", self.__emp_name\n", - "class emp_union:\n", - " __member_id=int\n", - " def getdata(self):\n", - " self.__member_id=int(raw_input(\"Enter member id: \"))\n", - " def displaydata(self):\n", - " print \"Member ID:\", self.__member_id\n", - "class emp_info(employee, emp_union):\n", - " __basic_salary=float\n", - " def getdata(self):\n", - " employee.getdata(self)\n", - " emp_union.getdata(self)\n", - " self.__basic_salary=int(raw_input(\"Enter basic salary: \"))\n", - " def displaydata(self):\n", - " employee.displaydata(self)\n", - " emp_union.displaydata(self)\n", - " print \"Basic Salary:\", self.__basic_salary\n", - "e1=emp_info()\n", - "e1.getdata()\n", - "e1.displaydata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter employee number: 23\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter emploee name: Krishnan\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter member id: 443\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter basic salary: 8500\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Employee Number: 23 \n", - "Employee Name: Krishnan\n", - "Member ID: 443\n", - "Basic Salary: 8500\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-2, Page no-613" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class details:\n", - " __name=[chr]*30\n", - " __address=[chr]*50\n", - " def getdata(self):\n", - " self.__name=raw_input(\"Name: \")\n", - " self.__address=raw_input(\"Address: \")\n", - " def displaydata(self):\n", - " print \"Name:\", self.__name,\"\\nAddress:\", self.__address\n", - "class student(details):\n", - " __marks=float\n", - " def getdata(self):\n", - " details.getdata(self)\n", - " self.__marks=float(raw_input(\"Percentage Marks: \"))\n", - " def displaydata(self):\n", - " details.displaydata(self)\n", - " print \"Percentage Marks: %g\" %(self.__marks)\n", - "class staff(details):\n", - " __salary=float\n", - " def getdata(self):\n", - " details.getdata(self)\n", - " self.__salary=float(raw_input(\"Salary: \"))\n", - " def displaydata(self):\n", - " details.displaydata(self)\n", - " print \"Salary: %g\" %(self.__salary)\n", - "student1=student()\n", - "staff1=staff()\n", - "print \"Enter student data:\"\n", - "student1.getdata()\n", - "print \"Enter staff data:\"\n", - "staff1.getdata()\n", - "print \"Displaying student and staff data:\"\n", - "student1.displaydata()\n", - "staff1.displaydata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter student data:\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Venkatesh\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Address: H.No. 89, AGM Society, Bangalore\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Percentage Marks: 78.4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter staff data:\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Vijayan\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Address: H.No. A-2, SLR Society, Bangalore\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Salary: 25000\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Displaying student and staff data:\n", - "Name: Venkatesh \n", - "Address: H.No. 89, AGM Society, Bangalore\n", - "Percentage Marks: 78.4\n", - "Name: Vijayan \n", - "Address: H.No. A-2, SLR Society, Bangalore\n", - "Salary: 25000\n" - ] - } - ], - "prompt_number": 2 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions.ipynb deleted file mode 100755 index 885b9dee..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions.ipynb +++ /dev/null @@ -1,629 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:b2c633d473244077752ca84867fbd4b5425a7e64be9d919c65be58ffebb68245" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 15-Virtual Functions" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-parent1.cpp, Page no-618" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Father:\n", - " __name=[chr]*20\n", - " def __init__(self, fname):\n", - " self.__name=fname\n", - " def show(self):\n", - " print \"Father name:\", self.__name\n", - "class Son(Father):\n", - " __name=[chr]*20\n", - " def __init__(self, sname, fname):\n", - " Father.__init__(self, fname)\n", - " self.__name=sname\n", - " def show(self):\n", - " print \"Son name:\", self.__name\n", - "fp=[Father]\n", - "f1=Father(\"Eshwarappa\")\n", - "fp=f1\n", - "fp.show()\n", - "s1=Son(\"Rajkumar\", \"Eshwarappa\")\n", - "fp=s1\n", - "Father.show(fp)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Father name: Eshwarappa\n", - "Father name: Eshwarappa\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-parent1.cpp, Page no-619" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Father():\n", - " __name=[chr]*20\n", - " def __init__(self, fname):\n", - " self.__name=fname\n", - " def show(self):\n", - " print \"Father name:\", self.__name\n", - "class Son(Father):\n", - " __name=[chr]*20\n", - " def __init__(self, sname, fname):\n", - " Father.__init__(self, fname)\n", - " self.__name=sname\n", - " def show(self):\n", - " print \"Son name:\", self.__name\n", - "fp=[Father]\n", - "f1=Father(\"Eshwarappa\")\n", - "fp=f1\n", - "fp.show()\n", - "s1=Son(\"Rajkumar\", \"Eshwarappa\")\n", - "fp=s1\n", - "fp.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Father name: Eshwarappa\n", - "Son name: Rajkumar\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-family1.cpp, Page no-622" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Father():\n", - " __f_age=int\n", - " def __init__(self, n):\n", - " self.__f_age=n\n", - " def GetAge(self):\n", - " return self.__f_age\n", - "class Son(Father):\n", - " __s_age=int\n", - " def __init__(self, n, m):\n", - " Father.__init__(self, n)\n", - " self.__s_age=m\n", - " def GetAge(self):\n", - " return self.__s_age\n", - " def son_func(self):\n", - " print \"son's own function\"\n", - "basep=[Father]\n", - "basep=Father(45)\n", - "print \"basep points to base object...\"\n", - "print \"Father's Age:\",\n", - "print basep.GetAge()\n", - "del basep\n", - "basep=[Son(45, 20)]\n", - "print \"basep points to derived object...\"\n", - "print \"Son's Age:\",\n", - "print Father.GetAge(basep[0])\n", - "print \"By typecasting, ((Son*) basep)...\"\n", - "print \"Son's age:\",basep[0].GetAge()\n", - "del basep\n", - "son1=Son(45, 20)\n", - "derivedp=[son1]\n", - "print \"accessing through derived class pointer...\"\n", - "print \"Son's Age:\",\n", - "print derivedp[0].GetAge()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "basep points to base object...\n", - "Father's Age: 45\n", - "basep points to derived object...\n", - "Son's Age: 45\n", - "By typecasting, ((Son*) basep)...\n", - "Son's age: 20\n", - "accessing through derived class pointer...\n", - "Son's Age: 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-family2.cpp, Page no-626" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Father():\n", - " __f_age=int\n", - " def __init__(self, n):\n", - " self.__f_age=n\n", - " def GetAge(self):\n", - " return self.__f_age\n", - "class Son(Father):\n", - " __s_age=int\n", - " def __init__(self, n, m):\n", - " Father.__init__(self, n)\n", - " self.__s_age=m\n", - " def GetAge(self):\n", - " return self.__s_age\n", - "basep=[Father]\n", - "basep=Father(45)\n", - "print \"Father's Age:\",\n", - "print basep.GetAge()\n", - "del basep\n", - "basep=[Son(45, 20)]\n", - "print \"Son's Age:\",\n", - "print basep[0].GetAge()\n", - "del basep" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Father's Age: 45\n", - "Son's Age: 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-draw.cpp, Page no-629" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class graphics:\n", - " def draw(self):\n", - " print \"point\"\n", - "class line(graphics):\n", - " def draw(self):\n", - " print \"line\"\n", - "class triangle(graphics):\n", - " def draw(self):\n", - " print \"triangle\"\n", - "class rectangle(graphics):\n", - " def draw(self):\n", - " print \"rectangle\"\n", - "class circle(graphics):\n", - " def draw(self):\n", - " print \"circle\"\n", - "point_obj=graphics()\n", - "line_obj=line()\n", - "tri_obj=triangle()\n", - "rect_obj=rectangle()\n", - "circle_obj=circle()\n", - "basep=[]\n", - "basep.append(point_obj)\n", - "basep.append(line_obj)\n", - "basep.append(tri_obj)\n", - "basep.append(rect_obj)\n", - "basep.append(circle_obj)\n", - "print \"Following figures are drawn with basep[i]->draw()...\"\n", - "for i in range(5):\n", - " basep[i].draw()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Following figures are drawn with basep[i]->draw()...\n", - "point\n", - "line\n", - "triangle\n", - "rectangle\n", - "circle\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-pure.cpp, Page no-632" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class AbsPerson:\n", - " def Service1(self, n):\n", - " self.Service2(n)\n", - " def Service2(self, n): #pure virtual function\n", - " pass\n", - "class Person(AbsPerson):\n", - " def Service2(self, n):\n", - " print \"The number of years of service:\", 58-n\n", - "Father=Person()\n", - "Son=Person()\n", - "Father.Service1(50)\n", - "Son.Service2(20)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The number of years of service: 8\n", - "The number of years of service: 38\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-number.cpp, Page no-633" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class number:\n", - " __num=int\n", - " def getdata(self):\n", - " self.__num=int(raw_input(\"Enter an integer number: \"))\n", - " def show(self): #pure virtual function\n", - " pass\n", - "class octnum(number):\n", - " def show(self):\n", - " print \"Octal equivalent of\", self._number__num,\"=\",oct(self._number__num)\n", - "class hexnum(number):\n", - " def show(self):\n", - " print \"Hexadecimal equivalent of\", self._number__num,\"=\",hex(self._number__num)\n", - "o1=octnum()\n", - "h1=hexnum()\n", - "o1.getdata()\n", - "o1.show()\n", - "h1.getdata()\n", - "h1.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter an integer number: 11\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Octal equivalent of 11 = 013\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter an integer number: 11\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hexadecimal equivalent of 11 = 0xb\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-family3.cpp, Page no-637" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Father():\n", - " __f_name=str\n", - " def __init__(self, fname):\n", - " self.__f_name=fname\n", - " def __del__(self):\n", - " del self.__f_name\n", - " print \"~Father() is invoked\"\n", - " def show(self):\n", - " print \"Father's name:\", self.__f_name\n", - "class Son(Father):\n", - " __s_name=str\n", - " def __init__(self, sname, fname):\n", - " Father.__init__(self, fname)\n", - " self.__s_name=sname\n", - " def __del__(self):\n", - " del self.__s_name\n", - " print \"~Son() is invoked\"\n", - " Father.__del__(self)\n", - " def show(self):\n", - " print \"Father's name:\", self._Father__f_name\n", - " print \"Son's name:\", self.__s_name\n", - "basep=[Father]\n", - "basep=Father(\"Eshwarappa\")\n", - "print \"basep points to base object...\"\n", - "basep.show()\n", - "del basep\n", - "basep=Son(\"Rajkumar\", \"Eshwarappa\")\n", - "print \"basep points to derived object...\"\n", - "basep.show()\n", - "del basep" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "basep points to base object...\n", - "Father's name: Eshwarappa\n", - "~Father() is invoked\n", - "basep points to derived object...\n", - "Father's name: Eshwarappa\n", - "Son's name: Rajkumar\n", - "~Son() is invoked\n", - "~Father() is invoked\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vptrsize.cpp, Page no-640" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class nonvirtual(Structure):\n", - " _fields_=[('x', c_int)]\n", - " def func(self):\n", - " pass\n", - "class withvirtual(Structure):\n", - " _fields_=[('x', c_int)]\n", - " def func(self):\n", - " pass\n", - "print \"sizeof( nonvirtual ) =\",sizeof(nonvirtual())\n", - "print \"sizeof( withvirtual ) =\",sizeof(withvirtual())" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sizeof( nonvirtual ) = 4\n", - "sizeof( withvirtual ) = 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-shapes.cpp, Page no-640" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class description:\n", - " __information=str\n", - " def __init__(self, info):\n", - " self.__information=info\n", - " def show(self):\n", - " print self.__information,\n", - "class sphere(description):\n", - " __radius=float\n", - " def __init__(self, info, rad):\n", - " description.__init__(self, info)\n", - " self.__radius=rad\n", - " def show(self):\n", - " print self._description__information,\n", - " print \"Radius = %g\" %self.__radius\n", - "class cube(description):\n", - " __edge_length=float\n", - " def __init__(self, info, edg_len):\n", - " description.__init__(self, info)\n", - " self.__edge_length=edg_len\n", - " def show(self):\n", - " print self._description__information,\n", - " print \"Edge Length = %g\" %self.__edge_length\n", - "small_ball=sphere(\"mine\", 1.0)\n", - "beach_ball=sphere(\"plane\", 24.0)\n", - "plan_toid=sphere(\"moon\", 1e24)\n", - "crystal=cube(\"carbon\", 1e-24)\n", - "ice=cube(\"party\", 1.0)\n", - "box=cube(\"card borad\", 16.0)\n", - "shapes=[]\n", - "shapes.append(small_ball)\n", - "shapes.append(beach_ball)\n", - "shapes.append(plan_toid)\n", - "shapes.append(crystal)\n", - "shapes.append(ice)\n", - "shapes.append(box)\n", - "small_ball.show()\n", - "beach_ball.show()\n", - "plan_toid.show()\n", - "crystal.show()\n", - "ice.show()\n", - "box.show()\n", - "print \"Dynamic Invocation of show()...\"\n", - "for i in range(len(shapes)):\n", - " shapes[i].show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mine Radius = 1\n", - "plane Radius = 24\n", - "moon Radius = 1e+24\n", - "carbon Edge Length = 1e-24\n", - "party Edge Length = 1\n", - "card borad Edge Length = 16\n", - "Dynamic Invocation of show()...\n", - "mine Radius = 1\n", - "plane Radius = 24\n", - "moon Radius = 1e+24\n", - "carbon Edge Length = 1e-24\n", - "party Edge Length = 1\n", - "card borad Edge Length = 16\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example, Page no-643" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class shape:\n", - " __val1=float\n", - " __val2=float\n", - " def getdata(self, a, b):\n", - " self.__val1=a\n", - " self.__val2=b\n", - " def display_area(self):\n", - " pass\n", - "class triangle(shape):\n", - " def display_area(self):\n", - " print \"Area of trianle =\", 0.5*self._shape__val1*self._shape__val2\n", - "class rectangle(shape):\n", - " def display_area(self):\n", - " print \"Area of rectanle =\", self._shape__val1*self._shape__val2\n", - "sptr=[shape]\n", - "sptr=triangle()\n", - "sptr.getdata(4.5, 2.2)\n", - "sptr.display_area()\n", - "sptr=rectangle()\n", - "sptr.getdata(4.5, 2.2)\n", - "sptr.display_area()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Area of trianle = 4.95\n", - "Area of rectanle = 9.9\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions_1.ipynb deleted file mode 100755 index ab3a16ad..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter15-VirtualFunctions_1.ipynb +++ /dev/null @@ -1,629 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:088209fcbfac6b2b28efe08ac9ffe00c4f6ff0675bb2728b388b1476d7fee811" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 15-Virtual Functions" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-parent1.cpp, Page no-618" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Father:\n", - " __name=[chr]*20\n", - " def __init__(self, fname):\n", - " self.__name=fname\n", - " def show(self):\n", - " print \"Father name:\", self.__name\n", - "class Son(Father):\n", - " __name=[chr]*20\n", - " def __init__(self, sname, fname):\n", - " Father.__init__(self, fname)\n", - " self.__name=sname\n", - " def show(self):\n", - " print \"Son name:\", self.__name\n", - "fp=[Father]\n", - "f1=Father(\"Eshwarappa\")\n", - "fp=f1\n", - "fp.show()\n", - "s1=Son(\"Rajkumar\", \"Eshwarappa\")\n", - "fp=s1\n", - "Father.show(fp)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Father name: Eshwarappa\n", - "Father name: Eshwarappa\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-parent1.cpp, Page no-619" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Father():\n", - " __name=[chr]*20\n", - " def __init__(self, fname):\n", - " self.__name=fname\n", - " def show(self):\n", - " print \"Father name:\", self.__name\n", - "class Son(Father):\n", - " __name=[chr]*20\n", - " def __init__(self, sname, fname):\n", - " Father.__init__(self, fname)\n", - " self.__name=sname\n", - " def show(self):\n", - " print \"Son name:\", self.__name\n", - "fp=[Father]\n", - "f1=Father(\"Eshwarappa\")\n", - "fp=f1\n", - "fp.show()\n", - "s1=Son(\"Rajkumar\", \"Eshwarappa\")\n", - "fp=s1\n", - "fp.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Father name: Eshwarappa\n", - "Son name: Rajkumar\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-family1.cpp, Page no-622" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Father():\n", - " __f_age=int\n", - " def __init__(self, n):\n", - " self.__f_age=n\n", - " def GetAge(self):\n", - " return self.__f_age\n", - "class Son(Father):\n", - " __s_age=int\n", - " def __init__(self, n, m):\n", - " Father.__init__(self, n)\n", - " self.__s_age=m\n", - " def GetAge(self):\n", - " return self.__s_age\n", - " def son_func(self):\n", - " print \"son's own function\"\n", - "basep=[Father]\n", - "basep=Father(45)\n", - "print \"basep points to base object...\"\n", - "print \"Father's Age:\",\n", - "print basep.GetAge()\n", - "del basep\n", - "basep=[Son(45, 20)]\n", - "print \"basep points to derived object...\"\n", - "print \"Son's Age:\",\n", - "print Father.GetAge(basep[0])\n", - "print \"By typecasting, ((Son*) basep)...\"\n", - "print \"Son's age:\",basep[0].GetAge()\n", - "del basep\n", - "son1=Son(45, 20)\n", - "derivedp=[son1]\n", - "print \"accessing through derived class pointer...\"\n", - "print \"Son's Age:\",\n", - "print derivedp[0].GetAge()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "basep points to base object...\n", - "Father's Age: 45\n", - "basep points to derived object...\n", - "Son's Age: 45\n", - "By typecasting, ((Son*) basep)...\n", - "Son's age: 20\n", - "accessing through derived class pointer...\n", - "Son's Age: 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-family2.cpp, Page no-626" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Father():\n", - " __f_age=int\n", - " def __init__(self, n):\n", - " self.__f_age=n\n", - " def GetAge(self):\n", - " return self.__f_age\n", - "class Son(Father):\n", - " __s_age=int\n", - " def __init__(self, n, m):\n", - " Father.__init__(self, n)\n", - " self.__s_age=m\n", - " def GetAge(self):\n", - " return self.__s_age\n", - "basep=[Father]\n", - "basep=Father(45)\n", - "print \"Father's Age:\",\n", - "print basep.GetAge()\n", - "del basep\n", - "basep=[Son(45, 20)]\n", - "print \"Son's Age:\",\n", - "print basep[0].GetAge()\n", - "del basep" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Father's Age: 45\n", - "Son's Age: 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-draw.cpp, Page no-629" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class graphics:\n", - " def draw(self):\n", - " print \"point\"\n", - "class line(graphics):\n", - " def draw(self):\n", - " print \"line\"\n", - "class triangle(graphics):\n", - " def draw(self):\n", - " print \"triangle\"\n", - "class rectangle(graphics):\n", - " def draw(self):\n", - " print \"rectangle\"\n", - "class circle(graphics):\n", - " def draw(self):\n", - " print \"circle\"\n", - "point_obj=graphics()\n", - "line_obj=line()\n", - "tri_obj=triangle()\n", - "rect_obj=rectangle()\n", - "circle_obj=circle()\n", - "basep=[]\n", - "basep.append(point_obj)\n", - "basep.append(line_obj)\n", - "basep.append(tri_obj)\n", - "basep.append(rect_obj)\n", - "basep.append(circle_obj)\n", - "print \"Following figures are drawn with basep[i]->draw()...\"\n", - "for i in range(5):\n", - " basep[i].draw()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Following figures are drawn with basep[i]->draw()...\n", - "point\n", - "line\n", - "triangle\n", - "rectangle\n", - "circle\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-pure.cpp, Page no-632" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class AbsPerson:\n", - " def Service1(self, n):\n", - " self.Service2(n)\n", - " def Service2(self, n): #pure virtual function\n", - " pass\n", - "class Person(AbsPerson):\n", - " def Service2(self, n):\n", - " print \"The number of years of service:\", 58-n\n", - "Father=Person()\n", - "Son=Person()\n", - "Father.Service1(50)\n", - "Son.Service2(20)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The number of years of service: 8\n", - "The number of years of service: 38\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-number.cpp, Page no-633" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class number:\n", - " __num=int\n", - " def getdata(self):\n", - " self.__num=int(raw_input(\"Enter an integer number: \"))\n", - " def show(self): #pure virtual function\n", - " pass\n", - "class octnum(number):\n", - " def show(self):\n", - " print \"Octal equivalent of\", self._number__num,\"=\",oct(self._number__num)\n", - "class hexnum(number):\n", - " def show(self):\n", - " print \"Hexadecimal equivalent of\", self._number__num,\"=\",hex(self._number__num)\n", - "o1=octnum()\n", - "h1=hexnum()\n", - "o1.getdata()\n", - "o1.show()\n", - "h1.getdata()\n", - "h1.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter an integer number: 11\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Octal equivalent of 11 = 013\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter an integer number: 11\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hexadecimal equivalent of 11 = 0xb\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-family3.cpp, Page no-637" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Father():\n", - " __f_name=str\n", - " def __init__(self, fname):\n", - " self.__f_name=fname\n", - " def __del__(self):\n", - " del self.__f_name\n", - " print \"~Father() is invoked\"\n", - " def show(self):\n", - " print \"Father's name:\", self.__f_name\n", - "class Son(Father):\n", - " __s_name=str\n", - " def __init__(self, sname, fname):\n", - " Father.__init__(self, fname)\n", - " self.__s_name=sname\n", - " def __del__(self):\n", - " del self.__s_name\n", - " print \"~Son() is invoked\"\n", - " Father.__del__(self)\n", - " def show(self):\n", - " print \"Father's name:\", self._Father__f_name\n", - " print \"Son's name:\", self.__s_name\n", - "basep=[Father]\n", - "basep=Father(\"Eshwarappa\")\n", - "print \"basep points to base object...\"\n", - "basep.show()\n", - "del basep\n", - "basep=Son(\"Rajkumar\", \"Eshwarappa\")\n", - "print \"basep points to derived object...\"\n", - "basep.show()\n", - "del basep" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "basep points to base object...\n", - "Father's name: Eshwarappa\n", - "~Father() is invoked\n", - "basep points to derived object...\n", - "Father's name: Eshwarappa\n", - "Son's name: Rajkumar\n", - "~Son() is invoked\n", - "~Father() is invoked\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vptrsize.cpp, Page no-640" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure, c_int, sizeof\n", - "class nonvirtual(Structure):\n", - " _fields_=[('x', c_int)]\n", - " def func(self):\n", - " pass\n", - "class withvirtual(Structure):\n", - " _fields_=[('x', c_int)]\n", - " def func(self):\n", - " pass\n", - "print \"sizeof( nonvirtual ) =\",sizeof(nonvirtual())\n", - "print \"sizeof( withvirtual ) =\",sizeof(withvirtual())" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sizeof( nonvirtual ) = 4\n", - "sizeof( withvirtual ) = 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-shapes.cpp, Page no-640" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class description:\n", - " __information=str\n", - " def __init__(self, info):\n", - " self.__information=info\n", - " def show(self):\n", - " print self.__information,\n", - "class sphere(description):\n", - " __radius=float\n", - " def __init__(self, info, rad):\n", - " description.__init__(self, info)\n", - " self.__radius=rad\n", - " def show(self):\n", - " print self._description__information,\n", - " print \"Radius = %g\" %self.__radius\n", - "class cube(description):\n", - " __edge_length=float\n", - " def __init__(self, info, edg_len):\n", - " description.__init__(self, info)\n", - " self.__edge_length=edg_len\n", - " def show(self):\n", - " print self._description__information,\n", - " print \"Edge Length = %g\" %self.__edge_length\n", - "small_ball=sphere(\"mine\", 1.0)\n", - "beach_ball=sphere(\"plane\", 24.0)\n", - "plan_toid=sphere(\"moon\", 1e24)\n", - "crystal=cube(\"carbon\", 1e-24)\n", - "ice=cube(\"party\", 1.0)\n", - "box=cube(\"card borad\", 16.0)\n", - "shapes=[]\n", - "shapes.append(small_ball)\n", - "shapes.append(beach_ball)\n", - "shapes.append(plan_toid)\n", - "shapes.append(crystal)\n", - "shapes.append(ice)\n", - "shapes.append(box)\n", - "small_ball.show()\n", - "beach_ball.show()\n", - "plan_toid.show()\n", - "crystal.show()\n", - "ice.show()\n", - "box.show()\n", - "print \"Dynamic Invocation of show()...\"\n", - "for i in range(len(shapes)):\n", - " shapes[i].show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mine Radius = 1\n", - "plane Radius = 24\n", - "moon Radius = 1e+24\n", - "carbon Edge Length = 1e-24\n", - "party Edge Length = 1\n", - "card borad Edge Length = 16\n", - "Dynamic Invocation of show()...\n", - "mine Radius = 1\n", - "plane Radius = 24\n", - "moon Radius = 1e+24\n", - "carbon Edge Length = 1e-24\n", - "party Edge Length = 1\n", - "card borad Edge Length = 16\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example, Page no-643" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class shape:\n", - " __val1=float\n", - " __val2=float\n", - " def getdata(self, a, b):\n", - " self.__val1=a\n", - " self.__val2=b\n", - " def display_area(self):\n", - " pass\n", - "class triangle(shape):\n", - " def display_area(self):\n", - " print \"Area of trianle =\", 0.5*self._shape__val1*self._shape__val2\n", - "class rectangle(shape):\n", - " def display_area(self):\n", - " print \"Area of rectanle =\", self._shape__val1*self._shape__val2\n", - "sptr=[shape]\n", - "sptr=triangle()\n", - "sptr.getdata(4.5, 2.2)\n", - "sptr.display_area()\n", - "sptr=rectangle()\n", - "sptr.getdata(4.5, 2.2)\n", - "sptr.display_area()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Area of trianle = 4.95\n", - "Area of rectanle = 9.9\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates.ipynb deleted file mode 100755 index 88641652..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter16-GenericProgrammingWithTemplates.ipynb +++ /dev/null @@ -1,1512 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:d003edbba5e427e459c859a79576baaf788de0196f037fb26a675631e1e101bf" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 16-Generic Programming with Templates" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mswap.cpp, Page no-647" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y): #function overloading\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch1, ch2 = swap(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "a, b = swap(a, b)\n", - "print \"On swapping :\", a,b\n", - "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", - "c, d = swap(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-gswap.cpp, Page no-650" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch1, ch2 = swap(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "a, b = swap(a, b)\n", - "print \"On swapping :\", a,b\n", - "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", - "c, d = swap(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-max1.cpp, Page no-651" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(a, b):\n", - " if a>b:\n", - " return a\n", - " else:\n", - " return b\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch = Max(ch1, ch2)\n", - "print \"max( ch1, ch2 ):\", ch\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "c = Max(a, b)\n", - "print \"max( a, b ):\", c\n", - "f1, f2=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", - "f3 = Max(f1, f2)\n", - "print \"max( f1, f2 ):\", f3" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : A B\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max( ch1, ch2 ): B\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 20 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max( a, b ): 20\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two floats : 20.5 30.9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max( f1, f2 ): 30.9\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-max2.cpp, Page no-653" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(a, b):\n", - " if a>b:\n", - " return a\n", - " else:\n", - " return b\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch = Max(ch1, ch2)\n", - "print \"max( ch1, ch2 ):\", ch\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "c = Max(a, b)\n", - "print \"max( a, b ):\", c\n", - "str1, str2=raw_input(\"Enter two strings : \").split()\n", - "print \"max( str1, str2 ):\", Max(str1, str2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : A Z\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max( ch1, ch2 ): Z\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 5 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max( a, b ): 6\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two strings : Tejaswi Rajkumar\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max( str1, str2 ): Tejaswi\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-bsort.cpp, Page no-654" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "[false, true]=[0, 1]\n", - "type=['false', 'true']\n", - "def swap(x, y): #function overloading\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "def BubbleSort(SortData, Size):\n", - " swapped=true\n", - " for i in range(Size-1):\n", - " if swapped==true:\n", - " swapped=false\n", - " for j in range((Size-1)-i):\n", - " if SortData[j]>SortData[j+1]:\n", - " swapped=true\n", - " SortData[j], SortData[j+1]=swap(SortData[j], SortData[j+1])\n", - "IntNums=[int]*25\n", - "FloatNums=[float]*25\n", - "print \"Program to sort elements...\"\n", - "#Integer numbers sorting\n", - "size=int(raw_input(\"Enter the size of the integer vector :\"))\n", - "print \"Enter the elements of the integer vector...\"\n", - "for i in range(size):\n", - " IntNums[i]=int(raw_input())\n", - "BubbleSort(IntNums, size)\n", - "print \"Sorted Vector:\"\n", - "for i in range(size):\n", - " print IntNums[i],\n", - "#Floating point numbers sorting\n", - "size=int(raw_input(\"Enter the size of the float vector :\"))\n", - "print \"Enter the elements of the float vector...\"\n", - "for i in range(size):\n", - " FloatNums[i]=float(raw_input())\n", - "BubbleSort(FloatNums, size)\n", - "print \"Sorted Vector:\"\n", - "for i in range(size):\n", - " print FloatNums[i]," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Program to sort elements...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the size of the integer vector :4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the elements of the integer vector...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sorted Vector:\n", - "1 4 6 8" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the size of the float vector :3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter the elements of the float vector...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3.2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8.9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sorted Vector:\n", - "3.2 8.5 8.9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-tprint.cpp, Page no-656" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Print(data, nTimes=None):\n", - " if isinstance(nTimes, int):\n", - " for i in range(nTimes):\n", - " print data\n", - " else:\n", - " print data\n", - "Print(1)\n", - "Print(1.5)\n", - "Print(520, 2)\n", - "Print(\"OOP is Great\", 3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n", - "1.5\n", - "520\n", - "520\n", - "OOP is Great\n", - "OOP is Great\n", - "OOP is Great\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-bsearch.cpp, Page no-658" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "[false, true]=[0, 1]\n", - "type=['false', 'true']\n", - "def RecBinSearch(Data, SrchElem, low, high):\n", - " if low>high:\n", - " return -1\n", - " mid=int((low+high)/2)\n", - " if SrchElemData[mid]:\n", - " return RecBinSearch(Data, SrchElem, mid+1, high)\n", - " return mid\n", - "num=[int]*25\n", - "FloatNums=[float]*25\n", - "print \"Program to search integer elements...\"\n", - "size=int(raw_input(\"How many elements ? \"))\n", - "print \"Enter the elements in ascending order for binary search...\"\n", - "for i in range(size):\n", - " num[i]=int(raw_input())\n", - "elem=int(raw_input(\"Enter the element to be searched: \"))\n", - "index=RecBinSearch(num, elem, 0, size)\n", - "if index==-1:\n", - " print \"Element\", elem, \"not found\"\n", - "else:\n", - " print \"Element\", elem, \"found at position\", index" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Program to search integer elements...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many elements ? 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the elements in ascending order for binary search...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the element to be searched: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element 6 found at position 2\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student.cpp, Page no-661" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class stuRec(Structure):\n", - " name=str\n", - " age=int\n", - " collegeCode=str\n", - "def Display(t):\n", - " print t\n", - "def output(s):\n", - " print \"Name:\", s.name\n", - " print \"Age:\", s.age\n", - " print \"College Code:\", s.collegeCode\n", - "s1=stuRec()\n", - "print \"Enter student record details...\"\n", - "s1.name=raw_input(\"Name: \")\n", - "s1.age=int(raw_input(\"Age: \"))\n", - "s1.collegeCode=raw_input(\"College Code: \")\n", - "print \"The student record:\"\n", - "print \"Name:\",\n", - "Display(s1.name)\n", - "print \"Age:\",\n", - "Display(s1.age)\n", - "print \"College Code:\",\n", - "Display(s1.collegeCode)\n", - "print \"The student record:\"\n", - "output(s1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter student record details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Chinamma\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 18\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "College Code: A\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The student record:\n", - "Name: Chinamma\n", - "Age: 18\n", - "College Code: A\n", - "The student record:\n", - "Name: Chinamma\n", - "Age: 18\n", - "College Code: A\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector.cpp, Page no-665" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class vector:\n", - " __size=int\n", - " def __init__(self, vector_size):\n", - " self.__size=vector_size\n", - " self.__v=[vector]*self.__size\n", - " def __del__(self):\n", - " del self.__v\n", - " def elem(self, i, x=None):\n", - " if isinstance(x, int) or isinstance(x, float):\n", - " if i>=self.__size:\n", - " print \"Error: Out of Range\"\n", - " return\n", - " self.__v[i]=x\n", - " else:\n", - " return self.__v[i]\n", - " def show(self):\n", - " for i in range(self.__size):\n", - " print self.elem(i), \",\",\n", - "int_vect=vector(5)\n", - "float_vect=vector(4)\n", - "for i in range(5):\n", - " int_vect.elem(i, i+1)\n", - "for i in range(4):\n", - " float_vect.elem(i,i+1.5)\n", - "print \"Integer Vector:\",\n", - "int_vect.show()\n", - "print \"\\nFloating Vector:\",\n", - "float_vect.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Integer Vector: 1 , 2 , 3 , 4 , 5 , \n", - "Floating Vector: 1.5 , 2.5 , 3.5 , 4.5 ,\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-union.cpp, Page no-670" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "(false, true)=(0, 1) #enum type\n", - "type =['false', 'true']\n", - "MAX_ITEMS=25\n", - "def IsExist(self, item):\n", - " for i in range(self._Bag__ItemCount):\n", - " if self._Bag__contents[i]==item:\n", - " return true\n", - " return false\n", - "def show(self):\n", - " for i in range(self._Bag__ItemCount):\n", - " print self._Bag__contents[i],\n", - " print \"\"\n", - "class Bag:\n", - " #protected members\n", - " __ItemCount=int\n", - " def __init__(self):\n", - " self.__ItemCount=0\n", - " self.__contents=[int]*MAX_ITEMS\n", - " def put(self, item):\n", - " self.__contents[self.__ItemCount]=item\n", - " self.__ItemCount+=1\n", - " def IsEmpty(self):\n", - " return true if self.__ItemCount==0 else false\n", - " def IsFull(self):\n", - " return true if self.__ItemCount==MAX_ITEMS else false\n", - " IsExist=IsExist\n", - " show=show\n", - "def read(self):\n", - " while(true):\n", - " element=int(raw_input(\"Enter Set Element <0-end>: \"))\n", - " if element==0:\n", - " break\n", - " self.Add(element)\n", - "def add(s1, s2):\n", - " temp = Set()\n", - " temp=s1\n", - " for i in range(s2._Bag__ItemCount):\n", - " if s1.IsExist(s2._Bag__contents[i])==false:\n", - " temp.Add(s2._Bag__contents[i])\n", - " return temp\n", - "class Set(Bag):\n", - " def Add(self,element):\n", - " if(self.IsExist(element)==false and self.IsFull()==false):\n", - " self.put(element)\n", - " read=read\n", - " def __assign__(self, s2):\n", - " for i in range(s2._Bag__ItemCount):\n", - " self.__contents[i]=s2.__contents[i]\n", - " self.__ItemCount=s2.__ItemCount\n", - " def __add__(self, s2):\n", - " return add(self, s2)\n", - "s1=Set()\n", - "s2=Set()\n", - "s3=Set()\n", - "print \"Enter Set 1 elements..\"\n", - "s1.read()\n", - "print \"Enter Set 2 elemets..\"\n", - "s2.read()\n", - "s3=s1+s2\n", - "print \"Union of s1 and s2 : \",\n", - "s3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set 1 elements..\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set 2 elemets..\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 6\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Union of s1 and s2 : 1 2 3 4 5 6 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-tree.cpp, Page no-673" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class TreeNode:\n", - " def __init__(self, dataIn, l, r):\n", - " if isinstance(l, TreeNode):\n", - " self.__left=l\n", - " self.__right=r\n", - " else:\n", - " self.__left=None\n", - " self.__right=None\n", - " self.__data=dataIn\n", - "class BinaryTree:\n", - " __root=None\n", - " def InsertNode(self, tree, data):\n", - " if tree==None:\n", - " tree=TreeNode(data, None, None)\n", - " return tree\n", - " if datatree._TreeNode__data:\n", - " tree._TreeNode__right=self.InsertNode(tree._TreeNode__right, data)\n", - " return tree\n", - " def PrintTreeTriangle(self, tree, level):\n", - " if tree:\n", - " self.PrintTreeTriangle(tree._TreeNode__right, level+1)\n", - " for i in range(level):\n", - " print \"\\t\",\n", - " print \"%g\" %tree._TreeNode__data\n", - " self.PrintTreeTriangle(tree._TreeNode__left, level+1)\n", - " def PrintTreeDiagonal(self, tree, level):\n", - " if tree!=None:\n", - " for i in range(level):\n", - " print \"\\t\",\n", - " print \"%g\" %tree._TreeNode__data\n", - " self.PrintTreeTriangle(tree._TreeNode__left, level+1)\n", - " self.PrintTreeTriangle(tree._TreeNode__right, level+1)\n", - " def PreOrderTraverse(self, tree):\n", - " if tree:\n", - " print \"%g\" %tree._TreeNode__data,\n", - " self.PreOrderTraverse(tree._TreeNode__left)\n", - " self.PreOrderTraverse(tree._TreeNode__right)\n", - " def InOrderTraverse(self, tree):\n", - " if tree:\n", - " self.InOrderTraverse(tree._TreeNode__left)\n", - " print \"%g\" %tree._TreeNode__data,\n", - " self.InOrderTraverse(tree._TreeNode__right)\n", - " def PostOrderTraverse(self, tree):\n", - " if tree:\n", - " self.PostOrderTraverse(tree._TreeNode__left)\n", - " self.PostOrderTraverse(tree._TreeNode__right)\n", - " print \"%g\" %tree._TreeNode__data,\n", - " def SearchTree(self, tree, data):\n", - " while(tree):\n", - " if datatree._TreeNode__data:\n", - " tree=tree._TreeNode__right\n", - " else:\n", - " return tree\n", - " return None\n", - " def PreOrder(self):\n", - " self.PreOrderTraverse(self.__root)\n", - " def InOrder(self):\n", - " self.InOrderTraverse(self.__root)\n", - " def PostOrder(self):\n", - " self.PostOrderTraverse(self.__root)\n", - " def PrintTree(self, disptype):\n", - " if disptype==1:\n", - " self.PrintTreeTriangle(self.__root, 1)\n", - " else:\n", - " self.PrintTreeDiagonal(self.__root, 1)\n", - " def Insert(self, data):\n", - " self.__root=self.InsertNode(self.__root, data)\n", - " def Search(self, data):\n", - " return self.SearchTree(self.__root, data)\n", - "btree=BinaryTree()\n", - "print \"This Program Demonstrates the Binary Tree Operations\"\n", - "disptype=int(raw_input(\"Tree Diplay Style: [1] - Triangular [2] - Diagonal form: \"))\n", - "print \"Tree creation process...\"\n", - "while 1:\n", - " data=float(raw_input(\"Enter node number to be inserted <0-END>: \"))\n", - " if data==0:\n", - " break\n", - " btree.Insert(data)\n", - " print \"Binary Tree is...\"\n", - " btree.PrintTree(disptype)\n", - " print \"Pre-Order Traversal:\",\n", - " btree.PreOrder()\n", - " print \"\\nIn-Order Traversal:\",\n", - " btree.InOrder()\n", - " print \"\\nPost-Order Traversal:\",\n", - " btree.PostOrder()\n", - " print \"\"\n", - "print \"Tree search process...\"\n", - "while(1):\n", - " data=float(raw_input(\"Enter node number to be inserted <0-END>: \"))\n", - " if data==0:\n", - " break\n", - " if btree.Search(data):\n", - " print \"Found data in the Tree\"\n", - " else:\n", - " print \"Not found data in the Tree\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "This Program Demonstrates the Binary Tree Operations\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Tree Diplay Style: [1] - Triangular [2] - Diagonal form: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Tree creation process...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binary Tree is...\n", - "\t5\n", - "Pre-Order Traversal: 5 \n", - "In-Order Traversal: 5 \n", - "Post-Order Traversal: 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binary Tree is...\n", - "\t5\n", - "\t\t3\n", - "Pre-Order Traversal: 5 3 \n", - "In-Order Traversal: 3 5 \n", - "Post-Order Traversal: 3 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 8\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binary Tree is...\n", - "\t\t8\n", - "\t5\n", - "\t\t3\n", - "Pre-Order Traversal: 5 3 8 \n", - "In-Order Traversal: 3 5 8 \n", - "Post-Order Traversal: 3 8 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binary Tree is...\n", - "\t\t8\n", - "\t5\n", - "\t\t3\n", - "\t\t\t2\n", - "Pre-Order Traversal: 5 3 2 8 \n", - "In-Order Traversal: 2 3 5 8 \n", - "Post-Order Traversal: 2 3 8 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binary Tree is...\n", - "\t\t\t9\n", - "\t\t8\n", - "\t5\n", - "\t\t3\n", - "\t\t\t2\n", - "Pre-Order Traversal: 5 3 2 8 9 \n", - "In-Order Traversal: 2 3 5 8 9 \n", - "Post-Order Traversal: 2 3 9 8 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Tree search process...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 8\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Found data in the Tree\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Not found data in the Tree\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex.cpp, Page no-679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __add__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "class Complex:\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " #overloading + operator\n", - " __add__=__add__\n", - " def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Addition of integer complex objects...\"\n", - "print \"Enter Complex Number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.getdata()\n", - "c3=c1+c2 #invoking the overloaded + operator\n", - "c3.outdata(\"c3 = c1 + c2: \")\n", - "c4=Complex()\n", - "c5=Complex()\n", - "c6=Complex()\n", - "print \"Addition of float complex objects...\"\n", - "print \"Enter Complex Number c4...\"\n", - "c4.getdata()\n", - "print \"Enter Complex Number c5...\"\n", - "c5.getdata()\n", - "c6=c4+c5 #invoking the overloaded + operator\n", - "c6.outdata(\"c6 = c4 + c5: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Addition of integer complex objects...\n", - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c3 = c1 + c2: (4, 6)\n", - "Addition of float complex objects...\n", - "Enter Complex Number c4...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 1.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c5...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 2.4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 3.7\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c6 = c4 + c5: (3.9, 6.2)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-680" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "N=5\n", - "def Min(arr):\n", - " m=arr[0]\n", - " for i in range(N):\n", - " if arr[i]: \").split()]\n", - "ch1, ch2 = swap(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "a, b = swap(a, b)\n", - "print \"On swapping :\", a,b\n", - "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", - "c, d = swap(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-gswap.cpp, Page no-650" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch1, ch2 = swap(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "a, b = swap(a, b)\n", - "print \"On swapping :\", a,b\n", - "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", - "c, d = swap(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-max1.cpp, Page no-651" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(a, b):\n", - " if a>b:\n", - " return a\n", - " else:\n", - " return b\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch = Max(ch1, ch2)\n", - "print \"max( ch1, ch2 ):\", ch\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "c = Max(a, b)\n", - "print \"max( a, b ):\", c\n", - "f1, f2=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", - "f3 = Max(f1, f2)\n", - "print \"max( f1, f2 ):\", f3" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : A B\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max( ch1, ch2 ): B\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 20 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max( a, b ): 20\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two floats : 20.5 30.9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max( f1, f2 ): 30.9\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-max2.cpp, Page no-653" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(a, b):\n", - " if a>b:\n", - " return a\n", - " else:\n", - " return b\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch = Max(ch1, ch2)\n", - "print \"max( ch1, ch2 ):\", ch\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "c = Max(a, b)\n", - "print \"max( a, b ):\", c\n", - "str1, str2=raw_input(\"Enter two strings : \").split()\n", - "print \"max( str1, str2 ):\", Max(str1, str2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : A Z\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max( ch1, ch2 ): Z\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 5 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max( a, b ): 6\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two strings : Tejaswi Rajkumar\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max( str1, str2 ): Tejaswi\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-bsort.cpp, Page no-654" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "[false, true]=[0, 1]\n", - "type=['false', 'true']\n", - "def swap(x, y): #function overloading\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "def BubbleSort(SortData, Size):\n", - " swapped=true\n", - " for i in range(Size-1):\n", - " if swapped==true:\n", - " swapped=false\n", - " for j in range((Size-1)-i):\n", - " if SortData[j]>SortData[j+1]:\n", - " swapped=true\n", - " SortData[j], SortData[j+1]=swap(SortData[j], SortData[j+1])\n", - "IntNums=[int]*25\n", - "FloatNums=[float]*25\n", - "print \"Program to sort elements...\"\n", - "#Integer numbers sorting\n", - "size=int(raw_input(\"Enter the size of the integer vector :\"))\n", - "print \"Enter the elements of the integer vector...\"\n", - "for i in range(size):\n", - " IntNums[i]=int(raw_input())\n", - "BubbleSort(IntNums, size)\n", - "print \"Sorted Vector:\"\n", - "for i in range(size):\n", - " print IntNums[i],\n", - "#Floating point numbers sorting\n", - "size=int(raw_input(\"Enter the size of the float vector :\"))\n", - "print \"Enter the elements of the float vector...\"\n", - "for i in range(size):\n", - " FloatNums[i]=float(raw_input())\n", - "BubbleSort(FloatNums, size)\n", - "print \"Sorted Vector:\"\n", - "for i in range(size):\n", - " print FloatNums[i]," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Program to sort elements...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the size of the integer vector :4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the elements of the integer vector...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sorted Vector:\n", - "1 4 6 8" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the size of the float vector :3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter the elements of the float vector...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3.2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8.9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sorted Vector:\n", - "3.2 8.5 8.9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-tprint.cpp, Page no-656" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Print(data, nTimes=None):\n", - " if isinstance(nTimes, int):\n", - " for i in range(nTimes):\n", - " print data\n", - " else:\n", - " print data\n", - "Print(1)\n", - "Print(1.5)\n", - "Print(520, 2)\n", - "Print(\"OOP is Great\", 3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n", - "1.5\n", - "520\n", - "520\n", - "OOP is Great\n", - "OOP is Great\n", - "OOP is Great\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-bsearch.cpp, Page no-658" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "[false, true]=[0, 1]\n", - "type=['false', 'true']\n", - "def RecBinSearch(Data, SrchElem, low, high):\n", - " if low>high:\n", - " return -1\n", - " mid=int((low+high)/2)\n", - " if SrchElemData[mid]:\n", - " return RecBinSearch(Data, SrchElem, mid+1, high)\n", - " return mid\n", - "num=[int]*25\n", - "FloatNums=[float]*25\n", - "print \"Program to search integer elements...\"\n", - "size=int(raw_input(\"How many elements ? \"))\n", - "print \"Enter the elements in ascending order for binary search...\"\n", - "for i in range(size):\n", - " num[i]=int(raw_input())\n", - "elem=int(raw_input(\"Enter the element to be searched: \"))\n", - "index=RecBinSearch(num, elem, 0, size)\n", - "if index==-1:\n", - " print \"Element\", elem, \"not found\"\n", - "else:\n", - " print \"Element\", elem, \"found at position\", index" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Program to search integer elements...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many elements ? 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the elements in ascending order for binary search...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the element to be searched: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Element 6 found at position 2\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student.cpp, Page no-661" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure\n", - "class stuRec(Structure):\n", - " name=str\n", - " age=int\n", - " collegeCode=str\n", - "def Display(t):\n", - " print t\n", - "def output(s):\n", - " print \"Name:\", s.name\n", - " print \"Age:\", s.age\n", - " print \"College Code:\", s.collegeCode\n", - "s1=stuRec()\n", - "print \"Enter student record details...\"\n", - "s1.name=raw_input(\"Name: \")\n", - "s1.age=int(raw_input(\"Age: \"))\n", - "s1.collegeCode=raw_input(\"College Code: \")\n", - "print \"The student record:\"\n", - "print \"Name:\",\n", - "Display(s1.name)\n", - "print \"Age:\",\n", - "Display(s1.age)\n", - "print \"College Code:\",\n", - "Display(s1.collegeCode)\n", - "print \"The student record:\"\n", - "output(s1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter student record details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Chinamma\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 18\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "College Code: A\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The student record:\n", - "Name: Chinamma\n", - "Age: 18\n", - "College Code: A\n", - "The student record:\n", - "Name: Chinamma\n", - "Age: 18\n", - "College Code: A\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector.cpp, Page no-665" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class vector:\n", - " __size=int\n", - " def __init__(self, vector_size):\n", - " self.__size=vector_size\n", - " self.__v=[vector]*self.__size\n", - " def __del__(self):\n", - " del self.__v\n", - " def elem(self, i, x=None):\n", - " if isinstance(x, int) or isinstance(x, float):\n", - " if i>=self.__size:\n", - " print \"Error: Out of Range\"\n", - " return\n", - " self.__v[i]=x\n", - " else:\n", - " return self.__v[i]\n", - " def show(self):\n", - " for i in range(self.__size):\n", - " print self.elem(i), \",\",\n", - "int_vect=vector(5)\n", - "float_vect=vector(4)\n", - "for i in range(5):\n", - " int_vect.elem(i, i+1)\n", - "for i in range(4):\n", - " float_vect.elem(i,i+1.5)\n", - "print \"Integer Vector:\",\n", - "int_vect.show()\n", - "print \"\\nFloating Vector:\",\n", - "float_vect.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Integer Vector: 1 , 2 , 3 , 4 , 5 , \n", - "Floating Vector: 1.5 , 2.5 , 3.5 , 4.5 ,\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-union.cpp, Page no-670" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "(false, true)=(0, 1) #enum type\n", - "type =['false', 'true']\n", - "MAX_ITEMS=25\n", - "def IsExist(self, item):\n", - " for i in range(self._Bag__ItemCount):\n", - " if self._Bag__contents[i]==item:\n", - " return true\n", - " return false\n", - "def show(self):\n", - " for i in range(self._Bag__ItemCount):\n", - " print self._Bag__contents[i],\n", - " print \"\"\n", - "class Bag:\n", - " #protected members\n", - " __ItemCount=int\n", - " def __init__(self):\n", - " self.__ItemCount=0\n", - " self.__contents=[int]*MAX_ITEMS\n", - " def put(self, item):\n", - " self.__contents[self.__ItemCount]=item\n", - " self.__ItemCount+=1\n", - " def IsEmpty(self):\n", - " return true if self.__ItemCount==0 else false\n", - " def IsFull(self):\n", - " return true if self.__ItemCount==MAX_ITEMS else false\n", - " IsExist=IsExist\n", - " show=show\n", - "def read(self):\n", - " while(true):\n", - " element=int(raw_input(\"Enter Set Element <0-end>: \"))\n", - " if element==0:\n", - " break\n", - " self.Add(element)\n", - "def add(s1, s2):\n", - " temp = Set()\n", - " temp=s1\n", - " for i in range(s2._Bag__ItemCount):\n", - " if s1.IsExist(s2._Bag__contents[i])==false:\n", - " temp.Add(s2._Bag__contents[i])\n", - " return temp\n", - "class Set(Bag):\n", - " def Add(self,element):\n", - " if(self.IsExist(element)==false and self.IsFull()==false):\n", - " self.put(element)\n", - " read=read\n", - " def __assign__(self, s2):\n", - " for i in range(s2._Bag__ItemCount):\n", - " self.__contents[i]=s2.__contents[i]\n", - " self.__ItemCount=s2.__ItemCount\n", - " def __add__(self, s2):\n", - " return add(self, s2)\n", - "s1=Set()\n", - "s2=Set()\n", - "s3=Set()\n", - "print \"Enter Set 1 elements..\"\n", - "s1.read()\n", - "print \"Enter Set 2 elemets..\"\n", - "s2.read()\n", - "s3=s1+s2\n", - "print \"Union of s1 and s2 : \",\n", - "s3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set 1 elements..\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set 2 elemets..\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 6\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Set Element <0-end>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Union of s1 and s2 : 1 2 3 4 5 6 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-tree.cpp, Page no-673" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class TreeNode:\n", - " def __init__(self, dataIn, l, r):\n", - " if isinstance(l, TreeNode):\n", - " self.__left=l\n", - " self.__right=r\n", - " else:\n", - " self.__left=None\n", - " self.__right=None\n", - " self.__data=dataIn\n", - "class BinaryTree:\n", - " __root=None\n", - " def InsertNode(self, tree, data):\n", - " if tree==None:\n", - " tree=TreeNode(data, None, None)\n", - " return tree\n", - " if datatree._TreeNode__data:\n", - " tree._TreeNode__right=self.InsertNode(tree._TreeNode__right, data)\n", - " return tree\n", - " def PrintTreeTriangle(self, tree, level):\n", - " if tree:\n", - " self.PrintTreeTriangle(tree._TreeNode__right, level+1)\n", - " for i in range(level):\n", - " print \"\\t\",\n", - " print \"%g\" %tree._TreeNode__data\n", - " self.PrintTreeTriangle(tree._TreeNode__left, level+1)\n", - " def PrintTreeDiagonal(self, tree, level):\n", - " if tree!=None:\n", - " for i in range(level):\n", - " print \"\\t\",\n", - " print \"%g\" %tree._TreeNode__data\n", - " self.PrintTreeTriangle(tree._TreeNode__left, level+1)\n", - " self.PrintTreeTriangle(tree._TreeNode__right, level+1)\n", - " def PreOrderTraverse(self, tree):\n", - " if tree:\n", - " print \"%g\" %tree._TreeNode__data,\n", - " self.PreOrderTraverse(tree._TreeNode__left)\n", - " self.PreOrderTraverse(tree._TreeNode__right)\n", - " def InOrderTraverse(self, tree):\n", - " if tree:\n", - " self.InOrderTraverse(tree._TreeNode__left)\n", - " print \"%g\" %tree._TreeNode__data,\n", - " self.InOrderTraverse(tree._TreeNode__right)\n", - " def PostOrderTraverse(self, tree):\n", - " if tree:\n", - " self.PostOrderTraverse(tree._TreeNode__left)\n", - " self.PostOrderTraverse(tree._TreeNode__right)\n", - " print \"%g\" %tree._TreeNode__data,\n", - " def SearchTree(self, tree, data):\n", - " while(tree):\n", - " if datatree._TreeNode__data:\n", - " tree=tree._TreeNode__right\n", - " else:\n", - " return tree\n", - " return None\n", - " def PreOrder(self):\n", - " self.PreOrderTraverse(self.__root)\n", - " def InOrder(self):\n", - " self.InOrderTraverse(self.__root)\n", - " def PostOrder(self):\n", - " self.PostOrderTraverse(self.__root)\n", - " def PrintTree(self, disptype):\n", - " if disptype==1:\n", - " self.PrintTreeTriangle(self.__root, 1)\n", - " else:\n", - " self.PrintTreeDiagonal(self.__root, 1)\n", - " def Insert(self, data):\n", - " self.__root=self.InsertNode(self.__root, data)\n", - " def Search(self, data):\n", - " return self.SearchTree(self.__root, data)\n", - "btree=BinaryTree()\n", - "print \"This Program Demonstrates the Binary Tree Operations\"\n", - "disptype=int(raw_input(\"Tree Diplay Style: [1] - Triangular [2] - Diagonal form: \"))\n", - "print \"Tree creation process...\"\n", - "while 1:\n", - " data=float(raw_input(\"Enter node number to be inserted <0-END>: \"))\n", - " if data==0:\n", - " break\n", - " btree.Insert(data)\n", - " print \"Binary Tree is...\"\n", - " btree.PrintTree(disptype)\n", - " print \"Pre-Order Traversal:\",\n", - " btree.PreOrder()\n", - " print \"\\nIn-Order Traversal:\",\n", - " btree.InOrder()\n", - " print \"\\nPost-Order Traversal:\",\n", - " btree.PostOrder()\n", - " print \"\"\n", - "print \"Tree search process...\"\n", - "while(1):\n", - " data=float(raw_input(\"Enter node number to be inserted <0-END>: \"))\n", - " if data==0:\n", - " break\n", - " if btree.Search(data):\n", - " print \"Found data in the Tree\"\n", - " else:\n", - " print \"Not found data in the Tree\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "This Program Demonstrates the Binary Tree Operations\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Tree Diplay Style: [1] - Triangular [2] - Diagonal form: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Tree creation process...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binary Tree is...\n", - "\t5\n", - "Pre-Order Traversal: 5 \n", - "In-Order Traversal: 5 \n", - "Post-Order Traversal: 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binary Tree is...\n", - "\t5\n", - "\t\t3\n", - "Pre-Order Traversal: 5 3 \n", - "In-Order Traversal: 3 5 \n", - "Post-Order Traversal: 3 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 8\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binary Tree is...\n", - "\t\t8\n", - "\t5\n", - "\t\t3\n", - "Pre-Order Traversal: 5 3 8 \n", - "In-Order Traversal: 3 5 8 \n", - "Post-Order Traversal: 3 8 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binary Tree is...\n", - "\t\t8\n", - "\t5\n", - "\t\t3\n", - "\t\t\t2\n", - "Pre-Order Traversal: 5 3 2 8 \n", - "In-Order Traversal: 2 3 5 8 \n", - "Post-Order Traversal: 2 3 8 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Binary Tree is...\n", - "\t\t\t9\n", - "\t\t8\n", - "\t5\n", - "\t\t3\n", - "\t\t\t2\n", - "Pre-Order Traversal: 5 3 2 8 9 \n", - "In-Order Traversal: 2 3 5 8 9 \n", - "Post-Order Traversal: 2 3 9 8 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Tree search process...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 8\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Found data in the Tree\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Not found data in the Tree\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter node number to be inserted <0-END>: 0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex.cpp, Page no-679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __add__(self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "class Complex:\n", - " def __init__(self):\n", - " self.__real=self.__imag=0\n", - " def getdata(self):\n", - " self.__real=float(raw_input(\"Real part ? \"))\n", - " self.__imag=float(raw_input(\"Imag part ? \"))\n", - " #overloading + operator\n", - " __add__=__add__\n", - " def outdata(self, msg):\n", - " print \"%s(%g, %g)\" %(msg, self.__real, self.__imag)\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Addition of integer complex objects...\"\n", - "print \"Enter Complex Number c1...\"\n", - "c1.getdata()\n", - "print \"Enter Complex Number c2...\"\n", - "c2.getdata()\n", - "c3=c1+c2 #invoking the overloaded + operator\n", - "c3.outdata(\"c3 = c1 + c2: \")\n", - "c4=Complex()\n", - "c5=Complex()\n", - "c6=Complex()\n", - "print \"Addition of float complex objects...\"\n", - "print \"Enter Complex Number c4...\"\n", - "c4.getdata()\n", - "print \"Enter Complex Number c5...\"\n", - "c5.getdata()\n", - "c6=c4+c5 #invoking the overloaded + operator\n", - "c6.outdata(\"c6 = c4 + c5: \")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Addition of integer complex objects...\n", - "Enter Complex Number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c3 = c1 + c2: (4, 6)\n", - "Addition of float complex objects...\n", - "Enter Complex Number c4...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 1.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 2.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Complex Number c5...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part ? 2.4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imag part ? 3.7\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c6 = c4 + c5: (3.9, 6.2)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-680" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "N=5\n", - "def Min(arr):\n", - " m=arr[0]\n", - " for i in range(N):\n", - " if arr[i]\n", - "63 ?\n", - "64 @\n", - "65 A\n", - "66 B\n", - "67 C\n", - "68 D\n", - "69 E\n", - "70 F\n", - "71 G\n", - "72 H\n", - "73 I\n", - "74 J\n", - "75 K\n", - "76 L\n", - "77 M\n", - "78 N\n", - "79 O\n", - "80 P\n", - "81 Q\n", - "82 R\n", - "83 S\n", - "84 T\n", - "85 U\n", - "86 V\n", - "87 W\n", - "88 X\n", - "89 Y\n", - "90 Z\n", - "91 [\n", - "92 \\\n", - "93 ]\n", - "94 ^\n", - "95 _\n", - "96 `\n", - "97 a\n", - "98 b\n", - "99 c\n", - "100 d\n", - "101 e\n", - "102 f\n", - "103 g\n", - "104 h\n", - "105 i\n", - "106 j\n", - "107 k\n", - "108 l\n", - "109 m\n", - "110 n\n", - "111 o\n", - "112 p\n", - "113 q\n", - "114 r\n", - "115 s\n", - "116 t\n", - "117 u\n", - "118 v\n", - "119 w\n", - "120 x\n", - "121 y\n", - "122 z\n", - "123 {\n", - "124 |\n", - "125 }\n", - "126 ~\n", - "127 \u007f\n", - "128 \ufffd\n", - "129 \ufffd\n", - "130 \ufffd\n", - "131 \ufffd\n", - "132 \ufffd\n", - "133 \ufffd\n", - "134 \ufffd\n", - "135 \ufffd\n", - "136 \ufffd\n", - "137 \ufffd\n", - "138 \ufffd\n", - "139 \ufffd\n", - "140 \ufffd\n", - "141 \ufffd\n", - "142 \ufffd\n", - "143 \ufffd\n", - "144 \ufffd\n", - "145 \ufffd\n", - "146 \ufffd\n", - "147 \ufffd\n", - "148 \ufffd\n", - "149 \ufffd\n", - "150 \ufffd\n", - "151 \ufffd\n", - "152 \ufffd\n", - "153 \ufffd\n", - "154 \ufffd\n", - "155 \ufffd\n", - "156 \ufffd\n", - "157 \ufffd\n", - "158 \ufffd\n", - "159 \ufffd\n", - "160 \ufffd\n", - "161 \ufffd\n", - "162 \ufffd\n", - "163 \ufffd\n", - "164 \ufffd\n", - "165 \ufffd\n", - "166 \ufffd\n", - "167 \ufffd\n", - "168 \ufffd\n", - "169 \ufffd\n", - "170 \ufffd\n", - "171 \ufffd\n", - "172 \ufffd\n", - "173 \ufffd\n", - "174 \ufffd\n", - "175 \ufffd\n", - "176 \ufffd\n", - "177 \ufffd\n", - "178 \ufffd\n", - "179 \ufffd\n", - "180 \ufffd\n", - "181 \ufffd\n", - "182 \ufffd\n", - "183 \ufffd\n", - "184 \ufffd\n", - "185 \ufffd\n", - "186 \ufffd\n", - "187 \ufffd\n", - "188 \ufffd\n", - "189 \ufffd\n", - "190 \ufffd\n", - "191 \ufffd\n", - "192 \ufffd\n", - "193 \ufffd\n", - "194 \ufffd\n", - "195 \ufffd\n", - "196 \ufffd\n", - "197 \ufffd\n", - "198 \ufffd\n", - "199 \ufffd\n", - "200 \ufffd\n", - "201 \ufffd\n", - "202 \ufffd\n", - "203 \ufffd\n", - "204 \ufffd\n", - "205 \ufffd\n", - "206 \ufffd\n", - "207 \ufffd\n", - "208 \ufffd\n", - "209 \ufffd\n", - "210 \ufffd\n", - "211 \ufffd\n", - "212 \ufffd\n", - "213 \ufffd\n", - "214 \ufffd\n", - "215 \ufffd\n", - "216 \ufffd\n", - "217 \ufffd\n", - "218 \ufffd\n", - "219 \ufffd\n", - "220 \ufffd\n", - "221 \ufffd\n", - "222 \ufffd\n", - "223 \ufffd\n", - "224 \ufffd\n", - "225 \ufffd\n", - "226 \ufffd\n", - "227 \ufffd\n", - "228 \ufffd\n", - "229 \ufffd\n", - "230 \ufffd\n", - "231 \ufffd\n", - "232 \ufffd\n", - "233 \ufffd\n", - "234 \ufffd\n", - "235 \ufffd\n", - "236 \ufffd\n", - "237 \ufffd\n", - "238 \ufffd\n", - "239 \ufffd\n", - "240 \ufffd\n", - "241 \ufffd\n", - "242 \ufffd\n", - "243 \ufffd\n", - "244 \ufffd\n", - "245 \ufffd\n", - "246 \ufffd\n", - "247 \ufffd\n", - "248 \ufffd\n", - "249 \ufffd\n", - "250 \ufffd\n", - "251 \ufffd\n", - "252 \ufffd\n", - "253 \ufffd\n", - "254 \ufffd\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-space1.cpp, Page no-693" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "test=raw_input(\"Enter string: \")\n", - "i=0\n", - "print \"Output string: \",\n", - "while True:\n", - " if test[i].isspace():\n", - " break\n", - " else:\n", - " sys.stdout.write(test[i])\n", - " i+=1" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string: Hello World\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Output string: Hello\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-space2.cpp, Page no-693" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "test=raw_input(\"Enter string: \")\n", - "print \"Output string:\", test" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string: Hello World\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Output string: Hello World\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-stand.cpp, Page no-694" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "string1=\"Object-Computing\"\n", - "string2=\" with C++\"\n", - "len1=len(string1)\n", - "len2=len(string2)\n", - "for i in range(1,len1):\n", - " print string1[:i]\n", - "for i in range(len1, 0, -1):\n", - " print string1[:i]\n", - "print \"%s%s\" %(string1[:len1], string2[:len2])\n", - "print string1+string2\n", - "print string1[:6]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "O\n", - "Ob\n", - "Obj\n", - "Obje\n", - "Objec\n", - "Object\n", - "Object-\n", - "Object-C\n", - "Object-Co\n", - "Object-Com\n", - "Object-Comp\n", - "Object-Compu\n", - "Object-Comput\n", - "Object-Computi\n", - "Object-Computin\n", - "Object-Computing\n", - "Object-Computin\n", - "Object-Computi\n", - "Object-Comput\n", - "Object-Compu\n", - "Object-Comp\n", - "Object-Com\n", - "Object-Co\n", - "Object-C\n", - "Object-\n", - "Object\n", - "Objec\n", - "Obje\n", - "Obj\n", - "Ob\n", - "O\n", - "Object-Computing with C++\n", - "Object-Computing with C++\n", - "Object\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student.cpp, Page no-697" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_MARKS=600.0\n", - "def read(self):\n", - " self.__name=raw_input(\"Enter Name: \")\n", - " self.__marks=int(raw_input(\"Enter Marks Secured: \"))\n", - "def show(self):\n", - " print '{:>10}'.format(self.__name),\n", - " print '{:>6}'.format(self.__marks),\n", - " print '{0:10.0f}'.format((self.__marks/MAX_MARKS)*100)\n", - "class student:\n", - " __name=str\n", - " __marks=int\n", - " read=read\n", - " show=show\n", - "count=int(raw_input(\"How many students ? \"))\n", - "s=[]*count\n", - "for i in range(count):\n", - " s.append(student())\n", - "for i in range(count):\n", - " print \"Enter Student\", i+1, \"details...\"\n", - " s[i].read()\n", - "print \"Student Report...\"\n", - "print '{:>3}'.format(\"R#\"),\n", - "print '{:>10}'.format(\"Student\"),\n", - "print '{:>6}'.format(\"Marks\"),\n", - "print '{:>15}'.format(\"Percentage\")\n", - "for i in range(count):\n", - " print \"%3s\" %(i+1),\n", - " s[i].show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many students ? 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Student 1 details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Marks Secured: 450\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Student 2 details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Marks Secured: 525\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Student 3 details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name: Bindu\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Marks Secured: 429\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Report...\n", - " R# Student Marks Percentage\n", - " 1 Tejaswi 450 75\n", - " 2 Rajkumar 525 88\n", - " 3 Bindu 429 72\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-salary.cpp, Page no-701" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "desig=[\"CEO\", \"Manager\", \"Receptionist\", \"Clerk\", \"Peon\"]\n", - "salary=[10200,5200,2950,950,750]\n", - "print \"Salary Structure Based on Designation\"\n", - "print \"-------------------------------------\"\n", - "print '{:>15}'.format('Designation '),\n", - "print '{:>15}'.format('Salary (in Rs.)')\n", - "print \"-------------------------------------\"\n", - "for i in range(5):\n", - " print '{:.>15}'.format(desig[i]),\n", - " print '{:*>15}'.format(salary[i])" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Salary Structure Based on Designation\n", - "-------------------------------------\n", - "Designation Salary (in Rs.)\n", - "-------------------------------------\n", - "............CEO **********10200\n", - "........Manager ***********5200\n", - "...Receptionist ***********2950\n", - "..........Clerk ************950\n", - "...........Peon ************750\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-hex.c, Page no-705" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num=raw_input(\"Enter any hexadecimal number: \")\n", - "print \"The input number in decimal = %d\" %int(num, 16)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any hexadecimal number: ab\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The input number in decimal = 171\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-hex.cpp, Page no-706" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num=raw_input(\"Enter any hexadecimal number: \")\n", - "print \"The input number in decimal = %d\" %int(num, 16)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any hexadecimal number: ab\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The input number in decimal = 171\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-foutput.cpp, Page no-709" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "x=int(100)\n", - "print format(x, '02x'), x\n", - "f=122.3434\n", - "print f\n", - "print '{:.2f}'.format(f)\n", - "print \"0x%0.4X\" %x\n", - "print '{:.3e}'.format(f)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "64 100\n", - "122.3434\n", - "122.34\n", - "0x0064\n", - "1.223e+02\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-payroll.cpp, Page no-709" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "f1=123.45\n", - "f2=34.65\n", - "f3=float(56)\n", - "print '{0:6.2f}'.format(f1)\n", - "print '{0:6.2f}'.format(f2)\n", - "print '{0:6.2f}'.format(f3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "123.45\n", - " 34.65\n", - " 56.00\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-oct.cpp, Page no-710" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "i=raw_input(\"Enter octal number: \")\n", - "print \"Its decimal equivalent is: %d\" %int(i, 8)\n", - "i=int(raw_input(\"Enter decimal number: \"))\n", - "print \"Its output:\", oct(i)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter octal number: 111\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Its decimal equivalent is: 73\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter decimal number: 73\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Its output: 0111\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mattab.cpp, Page no-711" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "num=int(raw_input(\"Enter Any Integer Number: \"))\n", - "print \"-----------------------------------------------------\"\n", - "print '{:>5}'.format(\"NUM\"),\n", - "print '{:>10}'.format(\"SQR\"),\n", - "print '{:>15}'.format(\"SQRT\"),\n", - "print '{:>15}'.format(\"LOG\")\n", - "print \"-----------------------------------------------------\"\n", - "for i in range(1, num+1):\n", - " print '{:>5}'.format(i),\n", - " print '{:>10}'.format(i*i),\n", - " print '{:15.3f}'.format(math.sqrt(i)),\n", - " print '{:15.4e}'.format(math.log(i))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Any Integer Number: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "-----------------------------------------------------\n", - " NUM SQR SQRT LOG\n", - "-----------------------------------------------------\n", - " 1 1 1.000 0.0000e+00\n", - " 2 4 1.414 6.9315e-01\n", - " 3 9 1.732 1.0986e+00\n", - " 4 16 2.000 1.3863e+00\n", - " 5 25 2.236 1.6094e+00\n", - " 6 36 2.449 1.7918e+00\n", - " 7 49 2.646 1.9459e+00\n", - " 8 64 2.828 2.0794e+00\n", - " 9 81 3.000 2.1972e+00\n", - " 10 100 3.162 2.3026e+00\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-space3.cpp, Page no-712" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def sp():\n", - " print \"\",\n", - "x=1\n", - "y=2\n", - "z=3\n", - "w=4\n", - "print x, \n", - "sp(), \n", - "print y, \n", - "sp(), \n", - "print z, \n", - "sp(), \n", - "print w" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1 2 3 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-currency.cpp, Page no-713" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def rupee():\n", - " print \"Rs.\",\n", - "def dollar():\n", - " print \"US$\",\n", - "print \"Item Sales in India...\"\n", - "item1=raw_input(\"Enter Item Name: \")\n", - "cost1=int(raw_input(\"Cost of Item: \"))\n", - "print \"Item Sales in US...\"\n", - "item2=raw_input(\"Enter Item Name: \")\n", - "cost2=int(raw_input(\"Cost of Item: \"))\n", - "print \"Item Cost Statistics...\"\n", - "print \"Item Name:\", item1\n", - "print \"Cost:\", \n", - "rupee(), \n", - "print cost1\n", - "print \"Item Name:\", item2\n", - "print \"Cost:\", \n", - "dollar(), \n", - "print cost2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Item Sales in India...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Name: PARAM Supercomputer\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Cost of Item: 55000\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Item Sales in US...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Name: CRAY Supercomputer\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Cost of Item: 40500\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Item Cost Statistics...\n", - "Item Name: PARAM Supercomputer\n", - "Cost: Rs. 55000\n", - "Item Name: CRAY Supercomputer\n", - "Cost: US$ 40500\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-pmani.cpp, Page no-715" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def output(self, x):\n", - " print '{x:{f}>{w}.{p}f}'.format(x=x,f=self._my_manipulator__fill,w= self._my_manipulator__width, p=self._my_manipulator__precision)\n", - "class my_manipulator:\n", - " __width=int\n", - " __precision=int\n", - " __fill=chr\n", - " def __init__(self, tw, tp, tf):\n", - " self.__width=tw\n", - " self.__precision=tp\n", - " self.__fill=tf\n", - " output=output\n", - "def set_float(w, p, f):\n", - " return my_manipulator(w, p, f)\n", - "f1=123.2734\n", - "f2=23.271\n", - "f3=16.1673\n", - "set_float(10, 3, '*').output(f1)\n", - "set_float(9, 2, '^').output(f2)\n", - "set_float(8, 3, '#').output(f3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "***123.273\n", - "^^^^23.27\n", - "##16.167\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-point.cpp, Page no-717" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class POINT:\n", - " __x=int\n", - " __y=int\n", - " def __init__(self):\n", - " self.__x=0\n", - " self.__y=0\n", - " def output(self):\n", - " print \"(%d,%d)\" %(self.__x, self.__y)\n", - " def input(self):\n", - " self.__x, self.__y=[int(x) for x in raw_input().split()] \n", - "p1=POINT()\n", - "p2=POINT()\n", - "print \"Enter two coordinate points (p1, p2):\",\n", - "p1.input(), p2.input()\n", - "print \"Coordinate points you entered are:\"\n", - "p1.output()\n", - "p2.output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two coordinate points (p1, p2):" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Coordinate points you entered are:\n", - "(2,3)\n", - "(5,6)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-719" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num=raw_input(\"Enter a hexadecimal value: \")\n", - "num=int(num, 16)\n", - "print \"Octal equivalent:\", oct(num)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a hexadecimal value: A\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Octal equivalent: 012\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-2, Page no-719" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "PI=3.14159265\n", - "print \"The values at different levels of precision are:\"\n", - "for i in range(1, 6):\n", - " print '%0.*f' % (i, PI)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The values at different levels of precision are:\n", - "3.1\n", - "3.14\n", - "3.142\n", - "3.1416\n", - "3.14159\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole_1.ipynb deleted file mode 100755 index 12c13cf7..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter17-StreamsComputationWithConsole_1.ipynb +++ /dev/null @@ -1,1338 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:7caa500b3a86295a3fa2a49826e32bb84c94f9c218ecf3c344e2f51d069f57ff" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 17-Streams Computation with Console" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-hello.c, Page no-688" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print 'Hello World'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-hello.cpp, Page no-688" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print 'Hello World'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-redirect.cpp, Page no-688" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print 'Hello World with cout'\n", - "print 'Hello World with cerr'\n", - "print 'Hello World with clog'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World with cout\n", - "Hello World with cerr\n", - "Hello World with clog\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-get.cpp, Page no-691" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "c=raw_input()\n", - "print c" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-put.cpp, Page no-692" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "for i in range(255):\n", - " if i==26:\n", - " continue\n", - " print i,chr(i)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0 \u0000\n", - "1 \u0001\n", - "2 \u0002\n", - "3 \u0003\n", - "4 \u0004\n", - "5 \u0005\n", - "6 \u0006\n", - "7 \u0007\n", - "8 \b\n", - "9 \t\n", - "10 \n", - "\n", - "11 \u000b", - "\n", - "12 \f", - "\n", - "13 \r\n", - "14 \u000e\n", - "15 \u000f\n", - "16 \u0010\n", - "17 \u0011\n", - "18 \u0012\n", - "19 \u0013\n", - "20 \u0014\n", - "21 \u0015\n", - "22 \u0016\n", - "23 \u0017\n", - "24 \u0018\n", - "25 \u0019\n", - "27 \u001b\n", - "28 \u001c", - "\n", - "29 \u001d", - "\n", - "30 \u001e", - "\n", - "31 \u001f\n", - "32 \n", - "33 !\n", - "34 \"\n", - "35 #\n", - "36 $\n", - "37 %\n", - "38 &\n", - "39 '\n", - "40 (\n", - "41 )\n", - "42 *\n", - "43 +\n", - "44 ,\n", - "45 -\n", - "46 .\n", - "47 /\n", - "48 0\n", - "49 1\n", - "50 2\n", - "51 3\n", - "52 4\n", - "53 5\n", - "54 6\n", - "55 7\n", - "56 8\n", - "57 9\n", - "58 :\n", - "59 ;\n", - "60 <\n", - "61 =\n", - "62 >\n", - "63 ?\n", - "64 @\n", - "65 A\n", - "66 B\n", - "67 C\n", - "68 D\n", - "69 E\n", - "70 F\n", - "71 G\n", - "72 H\n", - "73 I\n", - "74 J\n", - "75 K\n", - "76 L\n", - "77 M\n", - "78 N\n", - "79 O\n", - "80 P\n", - "81 Q\n", - "82 R\n", - "83 S\n", - "84 T\n", - "85 U\n", - "86 V\n", - "87 W\n", - "88 X\n", - "89 Y\n", - "90 Z\n", - "91 [\n", - "92 \\\n", - "93 ]\n", - "94 ^\n", - "95 _\n", - "96 `\n", - "97 a\n", - "98 b\n", - "99 c\n", - "100 d\n", - "101 e\n", - "102 f\n", - "103 g\n", - "104 h\n", - "105 i\n", - "106 j\n", - "107 k\n", - "108 l\n", - "109 m\n", - "110 n\n", - "111 o\n", - "112 p\n", - "113 q\n", - "114 r\n", - "115 s\n", - "116 t\n", - "117 u\n", - "118 v\n", - "119 w\n", - "120 x\n", - "121 y\n", - "122 z\n", - "123 {\n", - "124 |\n", - "125 }\n", - "126 ~\n", - "127 \u007f\n", - "128 \ufffd\n", - "129 \ufffd\n", - "130 \ufffd\n", - "131 \ufffd\n", - "132 \ufffd\n", - "133 \ufffd\n", - "134 \ufffd\n", - "135 \ufffd\n", - "136 \ufffd\n", - "137 \ufffd\n", - "138 \ufffd\n", - "139 \ufffd\n", - "140 \ufffd\n", - "141 \ufffd\n", - "142 \ufffd\n", - "143 \ufffd\n", - "144 \ufffd\n", - "145 \ufffd\n", - "146 \ufffd\n", - "147 \ufffd\n", - "148 \ufffd\n", - "149 \ufffd\n", - "150 \ufffd\n", - "151 \ufffd\n", - "152 \ufffd\n", - "153 \ufffd\n", - "154 \ufffd\n", - "155 \ufffd\n", - "156 \ufffd\n", - "157 \ufffd\n", - "158 \ufffd\n", - "159 \ufffd\n", - "160 \ufffd\n", - "161 \ufffd\n", - "162 \ufffd\n", - "163 \ufffd\n", - "164 \ufffd\n", - "165 \ufffd\n", - "166 \ufffd\n", - "167 \ufffd\n", - "168 \ufffd\n", - "169 \ufffd\n", - "170 \ufffd\n", - "171 \ufffd\n", - "172 \ufffd\n", - "173 \ufffd\n", - "174 \ufffd\n", - "175 \ufffd\n", - "176 \ufffd\n", - "177 \ufffd\n", - "178 \ufffd\n", - "179 \ufffd\n", - "180 \ufffd\n", - "181 \ufffd\n", - "182 \ufffd\n", - "183 \ufffd\n", - "184 \ufffd\n", - "185 \ufffd\n", - "186 \ufffd\n", - "187 \ufffd\n", - "188 \ufffd\n", - "189 \ufffd\n", - "190 \ufffd\n", - "191 \ufffd\n", - "192 \ufffd\n", - "193 \ufffd\n", - "194 \ufffd\n", - "195 \ufffd\n", - "196 \ufffd\n", - "197 \ufffd\n", - "198 \ufffd\n", - "199 \ufffd\n", - "200 \ufffd\n", - "201 \ufffd\n", - "202 \ufffd\n", - "203 \ufffd\n", - "204 \ufffd\n", - "205 \ufffd\n", - "206 \ufffd\n", - "207 \ufffd\n", - "208 \ufffd\n", - "209 \ufffd\n", - "210 \ufffd\n", - "211 \ufffd\n", - "212 \ufffd\n", - "213 \ufffd\n", - "214 \ufffd\n", - "215 \ufffd\n", - "216 \ufffd\n", - "217 \ufffd\n", - "218 \ufffd\n", - "219 \ufffd\n", - "220 \ufffd\n", - "221 \ufffd\n", - "222 \ufffd\n", - "223 \ufffd\n", - "224 \ufffd\n", - "225 \ufffd\n", - "226 \ufffd\n", - "227 \ufffd\n", - "228 \ufffd\n", - "229 \ufffd\n", - "230 \ufffd\n", - "231 \ufffd\n", - "232 \ufffd\n", - "233 \ufffd\n", - "234 \ufffd\n", - "235 \ufffd\n", - "236 \ufffd\n", - "237 \ufffd\n", - "238 \ufffd\n", - "239 \ufffd\n", - "240 \ufffd\n", - "241 \ufffd\n", - "242 \ufffd\n", - "243 \ufffd\n", - "244 \ufffd\n", - "245 \ufffd\n", - "246 \ufffd\n", - "247 \ufffd\n", - "248 \ufffd\n", - "249 \ufffd\n", - "250 \ufffd\n", - "251 \ufffd\n", - "252 \ufffd\n", - "253 \ufffd\n", - "254 \ufffd\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-space1.cpp, Page no-693" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "test=raw_input(\"Enter string: \")\n", - "i=0\n", - "print \"Output string: \",\n", - "while True:\n", - " if test[i].isspace():\n", - " break\n", - " else:\n", - " sys.stdout.write(test[i])\n", - " i+=1" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string: Hello World\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Output string: Hello\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-space2.cpp, Page no-693" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "test=raw_input(\"Enter string: \")\n", - "print \"Output string:\", test" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string: Hello World\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Output string: Hello World\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-stand.cpp, Page no-694" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "string1=\"Object-Computing\"\n", - "string2=\" with C++\"\n", - "len1=len(string1)\n", - "len2=len(string2)\n", - "for i in range(1,len1):\n", - " print string1[:i]\n", - "for i in range(len1, 0, -1):\n", - " print string1[:i]\n", - "print \"%s%s\" %(string1[:len1], string2[:len2])\n", - "print string1+string2\n", - "print string1[:6]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "O\n", - "Ob\n", - "Obj\n", - "Obje\n", - "Objec\n", - "Object\n", - "Object-\n", - "Object-C\n", - "Object-Co\n", - "Object-Com\n", - "Object-Comp\n", - "Object-Compu\n", - "Object-Comput\n", - "Object-Computi\n", - "Object-Computin\n", - "Object-Computing\n", - "Object-Computin\n", - "Object-Computi\n", - "Object-Comput\n", - "Object-Compu\n", - "Object-Comp\n", - "Object-Com\n", - "Object-Co\n", - "Object-C\n", - "Object-\n", - "Object\n", - "Objec\n", - "Obje\n", - "Obj\n", - "Ob\n", - "O\n", - "Object-Computing with C++\n", - "Object-Computing with C++\n", - "Object\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student.cpp, Page no-697" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_MARKS=600.0\n", - "def read(self):\n", - " self.__name=raw_input(\"Enter Name: \")\n", - " self.__marks=int(raw_input(\"Enter Marks Secured: \"))\n", - "def show(self):\n", - " print '{:>10}'.format(self.__name),\n", - " print '{:>6}'.format(self.__marks),\n", - " print '{0:10.0f}'.format((self.__marks/MAX_MARKS)*100)\n", - "class student:\n", - " __name=str\n", - " __marks=int\n", - " read=read\n", - " show=show\n", - "count=int(raw_input(\"How many students ? \"))\n", - "s=[]*count\n", - "for i in range(count):\n", - " s.append(student())\n", - "for i in range(count):\n", - " print \"Enter Student\", i+1, \"details...\"\n", - " s[i].read()\n", - "print \"Student Report...\"\n", - "print '{:>3}'.format(\"R#\"),\n", - "print '{:>10}'.format(\"Student\"),\n", - "print '{:>6}'.format(\"Marks\"),\n", - "print '{:>15}'.format(\"Percentage\")\n", - "for i in range(count):\n", - " print \"%3s\" %(i+1),\n", - " s[i].show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many students ? 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Student 1 details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Marks Secured: 450\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Student 2 details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Marks Secured: 525\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Student 3 details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name: Bindu\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Marks Secured: 429\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Report...\n", - " R# Student Marks Percentage\n", - " 1 Tejaswi 450 75\n", - " 2 Rajkumar 525 88\n", - " 3 Bindu 429 72\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-salary.cpp, Page no-701" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "desig=[\"CEO\", \"Manager\", \"Receptionist\", \"Clerk\", \"Peon\"]\n", - "salary=[10200,5200,2950,950,750]\n", - "print \"Salary Structure Based on Designation\"\n", - "print \"-------------------------------------\"\n", - "print '{:>15}'.format('Designation '),\n", - "print '{:>15}'.format('Salary (in Rs.)')\n", - "print \"-------------------------------------\"\n", - "for i in range(5):\n", - " print '{:.>15}'.format(desig[i]),\n", - " print '{:*>15}'.format(salary[i])" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Salary Structure Based on Designation\n", - "-------------------------------------\n", - "Designation Salary (in Rs.)\n", - "-------------------------------------\n", - "............CEO **********10200\n", - "........Manager ***********5200\n", - "...Receptionist ***********2950\n", - "..........Clerk ************950\n", - "...........Peon ************750\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-hex.c, Page no-705" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num=raw_input(\"Enter any hexadecimal number: \")\n", - "print \"The input number in decimal = %d\" %int(num, 16)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any hexadecimal number: ab\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The input number in decimal = 171\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-hex.cpp, Page no-706" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num=raw_input(\"Enter any hexadecimal number: \")\n", - "print \"The input number in decimal = %d\" %int(num, 16)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any hexadecimal number: ab\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The input number in decimal = 171\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-foutput.cpp, Page no-709" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "x=int(100)\n", - "print format(x, '02x'), x\n", - "f=122.3434\n", - "print f\n", - "print '{:.2f}'.format(f)\n", - "print \"0x%0.4X\" %x\n", - "print '{:.3e}'.format(f)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "64 100\n", - "122.3434\n", - "122.34\n", - "0x0064\n", - "1.223e+02\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-payroll.cpp, Page no-709" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "f1=123.45\n", - "f2=34.65\n", - "f3=float(56)\n", - "print '{0:6.2f}'.format(f1)\n", - "print '{0:6.2f}'.format(f2)\n", - "print '{0:6.2f}'.format(f3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "123.45\n", - " 34.65\n", - " 56.00\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-oct.cpp, Page no-710" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "i=raw_input(\"Enter octal number: \")\n", - "print \"Its decimal equivalent is: %d\" %int(i, 8)\n", - "i=int(raw_input(\"Enter decimal number: \"))\n", - "print \"Its output:\", oct(i)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter octal number: 111\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Its decimal equivalent is: 73\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter decimal number: 73\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Its output: 0111\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mattab.cpp, Page no-711" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "num=int(raw_input(\"Enter Any Integer Number: \"))\n", - "print \"-----------------------------------------------------\"\n", - "print '{:>5}'.format(\"NUM\"),\n", - "print '{:>10}'.format(\"SQR\"),\n", - "print '{:>15}'.format(\"SQRT\"),\n", - "print '{:>15}'.format(\"LOG\")\n", - "print \"-----------------------------------------------------\"\n", - "for i in range(1, num+1):\n", - " print '{:>5}'.format(i),\n", - " print '{:>10}'.format(i*i),\n", - " print '{:15.3f}'.format(math.sqrt(i)),\n", - " print '{:15.4e}'.format(math.log(i))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Any Integer Number: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "-----------------------------------------------------\n", - " NUM SQR SQRT LOG\n", - "-----------------------------------------------------\n", - " 1 1 1.000 0.0000e+00\n", - " 2 4 1.414 6.9315e-01\n", - " 3 9 1.732 1.0986e+00\n", - " 4 16 2.000 1.3863e+00\n", - " 5 25 2.236 1.6094e+00\n", - " 6 36 2.449 1.7918e+00\n", - " 7 49 2.646 1.9459e+00\n", - " 8 64 2.828 2.0794e+00\n", - " 9 81 3.000 2.1972e+00\n", - " 10 100 3.162 2.3026e+00\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-space3.cpp, Page no-712" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def sp():\n", - " print \"\",\n", - "x=1\n", - "y=2\n", - "z=3\n", - "w=4\n", - "print x, \n", - "sp(), \n", - "print y, \n", - "sp(), \n", - "print z, \n", - "sp(), \n", - "print w" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1 2 3 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-currency.cpp, Page no-713" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def rupee():\n", - " print \"Rs.\",\n", - "def dollar():\n", - " print \"US$\",\n", - "print \"Item Sales in India...\"\n", - "item1=raw_input(\"Enter Item Name: \")\n", - "cost1=int(raw_input(\"Cost of Item: \"))\n", - "print \"Item Sales in US...\"\n", - "item2=raw_input(\"Enter Item Name: \")\n", - "cost2=int(raw_input(\"Cost of Item: \"))\n", - "print \"Item Cost Statistics...\"\n", - "print \"Item Name:\", item1\n", - "print \"Cost:\", \n", - "rupee(), \n", - "print cost1\n", - "print \"Item Name:\", item2\n", - "print \"Cost:\", \n", - "dollar(), \n", - "print cost2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Item Sales in India...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Name: PARAM Supercomputer\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Cost of Item: 55000\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Item Sales in US...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Item Name: CRAY Supercomputer\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Cost of Item: 40500\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Item Cost Statistics...\n", - "Item Name: PARAM Supercomputer\n", - "Cost: Rs. 55000\n", - "Item Name: CRAY Supercomputer\n", - "Cost: US$ 40500\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-pmani.cpp, Page no-715" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def output(self, x):\n", - " print '{x:{f}>{w}.{p}f}'.format(x=x,f=self._my_manipulator__fill,w= self._my_manipulator__width, p=self._my_manipulator__precision)\n", - "class my_manipulator:\n", - " __width=int\n", - " __precision=int\n", - " __fill=chr\n", - " def __init__(self, tw, tp, tf):\n", - " self.__width=tw\n", - " self.__precision=tp\n", - " self.__fill=tf\n", - " output=output\n", - "def set_float(w, p, f):\n", - " return my_manipulator(w, p, f)\n", - "f1=123.2734\n", - "f2=23.271\n", - "f3=16.1673\n", - "set_float(10, 3, '*').output(f1)\n", - "set_float(9, 2, '^').output(f2)\n", - "set_float(8, 3, '#').output(f3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "***123.273\n", - "^^^^23.27\n", - "##16.167\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-point.cpp, Page no-717" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class POINT:\n", - " __x=int\n", - " __y=int\n", - " def __init__(self):\n", - " self.__x=0\n", - " self.__y=0\n", - " def output(self):\n", - " print \"(%d,%d)\" %(self.__x, self.__y)\n", - " def input(self):\n", - " self.__x, self.__y=[int(x) for x in raw_input().split()] \n", - "p1=POINT()\n", - "p2=POINT()\n", - "print \"Enter two coordinate points (p1, p2):\",\n", - "p1.input(), p2.input()\n", - "print \"Coordinate points you entered are:\"\n", - "p1.output()\n", - "p2.output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two coordinate points (p1, p2):" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Coordinate points you entered are:\n", - "(2,3)\n", - "(5,6)\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-719" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num=raw_input(\"Enter a hexadecimal value: \")\n", - "num=int(num, 16)\n", - "print \"Octal equivalent:\", oct(num)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a hexadecimal value: A\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Octal equivalent: 012\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-2, Page no-719" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "PI=3.14159265\n", - "print \"The values at different levels of precision are:\"\n", - "for i in range(1, 6):\n", - " print '%0.*f' % (i, PI)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The values at different levels of precision are:\n", - "3.1\n", - "3.14\n", - "3.142\n", - "3.1416\n", - "3.14159\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles.ipynb deleted file mode 100755 index d5aeb20b..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles.ipynb +++ /dev/null @@ -1,1152 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:fe66068ace4dfae0081c9992d8914d2fa642c4fa20e9f62d7dadd74619b6c0f7" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 18-Streams Computation with Files" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-stdfile.cpp, Page no-728" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "fout=open(\"student.out\", \"w\")\n", - "name=raw_input(\"Enter Name: \")\n", - "marks=raw_input(\"Enter Marks Secured: \")\n", - "fout.write(name+'\\n')\n", - "fout.write(marks+'\\n')\n", - "name=raw_input(\"Enter Name: \")\n", - "marks=raw_input(\"Enter Marks Secured: \")\n", - "fout.write(name+'\\n')\n", - "fout.write(marks+'\\n')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Marks Secured: 95\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Marks Secured: 90\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example-stdread.cpp, Page no-729" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "fin=open(\"student.out\", \"r\")\n", - "name = fin.readline()\n", - "print \"Name:\", name,\n", - "marks=fin.readline()\n", - "print \"Marks Secured:\",marks,\n", - "name = fin.readline()\n", - "print \"Name:\", name,\n", - "marks=fin.readline()\n", - "print \"Marks Secured:\",marks" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Rajkumar\n", - "Marks Secured: 95\n", - "Name: Tejaswi\n", - "Marks Secured: 90\n", - "\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example-fdisp.cpp, Page no-732" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "filename=raw_input(\"Enter Name of the File: \")\n", - "try:\n", - " ifile=open(filename, \"r\")\n", - " ch=ifile.read()\n", - " print ch\n", - "except IOError:\n", - " print \"Error opening\", filename" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name of the File: mytype.cpp\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Error opening mytype.cpp\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-keyin.cpp, Page no-733" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ofile=open(\"key.txt\", \"w\")\n", - "print \"Enter characters ..\"\n", - "else:\n", - " #Open a file\n", - " infile=open(sys.argv[1],'r')\n", - "\n", - " #In case file cannot open\n", - " if(not(infile)):\n", - " print \"Error opening\", sys.argv[1]\n", - " else:\n", - " #Read file\n", - " infile.seek(end)\n", - " print \"File Size=\", infile.tell()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Usage: fsize \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-putget.cpp, Page no-741" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "File=open(\"student.txt\", \"w\")\n", - "string=raw_input(\"Enter String: \")\n", - "File.write(string)\n", - "File.seek(0)\n", - "print \"Output string:\",\n", - "File=open(\"student.txt\", \"r\")\n", - "string=File.read()\n", - "print string" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter String: Object-Computing with C++\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Output string: Object-Computing with C++\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-fwr.cpp, Page no-743" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num1=530\n", - "num2=1050.25\n", - "out_file=open(\"number.bin\", \"w\")\n", - "out_file.write(str(num1)+'\\n')\n", - "out_file.write(str(num2)+'\\n')\n", - "out_file.close()\n", - "in_file=open(\"number.bin\", \"r\")\n", - "num1=in_file.readline()\n", - "num2=in_file.readline()\n", - "print num1, num2\n", - "in_file.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "530\n", - "1050.25\n", - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-objsave.cpp, Page no-744" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAXNAME=40\n", - "class Person:\n", - " __name=str\n", - " __age=int\n", - " def write(self, os):\n", - " os.write(self.__name+'\\n')\n", - " os.write(str(self.__age)+'\\n')\n", - " def read(self,Is):\n", - " self.__name=Is.readline()\n", - " self.__age=Is.readline()\n", - "def fOutput(fos, b):\n", - " b.write(fos)\n", - "def fInput(fos, b):\n", - " b.read(fos)\n", - "def Input(b):\n", - " b._Person__name=raw_input(\"Name: \")\n", - " b._Person__age=int(raw_input(\"Age: \"))\n", - "def Output(b):\n", - " print b._Person__name,\n", - " print b._Person__age,\n", - "p_obj=Person()\n", - "ofile=open(\"person.txt\", \"w\")\n", - "while(1):\n", - " Input(p_obj)\n", - " fOutput(ofile, p_obj)\n", - " ch=str(raw_input(\"Another? \"))\n", - " if ch.upper()!='Y':\n", - " break\n", - "ofile.close()\n", - "ifile=open(\"person.txt\", \"r\")\n", - "print \"The objects written to the file were:..\"\n", - "while 1:\n", - " fInput(ifile, p_obj)\n", - " Output(p_obj)\n", - " if p_obj._Person__name=='':\n", - " break" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Another? y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Savithri\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 23\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Another? n\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The objects written to the file were:..\n", - "Tejaswi\n", - "5\n", - "Savithri\n", - "23\n", - " \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student.cpp, Page no-748" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "try:\n", - " infile=open(\"student.in\", \"r\")\n", - "except IOerror:\n", - " print \"Error: student.in file non-existent\"\n", - "try:\n", - " outfile=open(\"student.out\", \"w\")\n", - "except IOerror:\n", - " print \"Error: unable to open student.out in write mode\"\n", - "else:\n", - " count=int(infile.readline())\n", - " outfile.write(\" Students Information Processing\")\n", - " outfile.write(\"\\n----------------------------------------\")\n", - " for i in range(count):\n", - " name=infile.readline()\n", - " percentage=int(infile.readline())\n", - " outfile.write(\"\\nName: \"+name)\n", - " outfile.write(\"Percentage: \"+str(percentage)+'\\n')\n", - " outfile.write(\"Passed in: \")\n", - " if percentage>=70:\n", - " outfile.write(\"First class with distinction\")\n", - " elif percentage>=60:\n", - " outfile.write(\"First class\")\n", - " elif percentage>=50:\n", - " outfile.write(\"Second class\")\n", - " elif percentage>=35:\n", - " outfile.write(\"Third class\")\n", - " else:\n", - " outfile.write(\"Sorry, Failed!\")\n", - " outfile.write('\\n')\n", - " outfile.write(\"----------------------------------------\")\n", - " infile.close()\n", - " outfile.close()\n", - " print \"Contents of student.out:\\n\"\n", - " infile=open(\"student.out\", \"r\")\n", - " Str=infile.read()\n", - " print Str\n", - " infile.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Contents of student.out:\n", - "\n", - " Students Information Processing\n", - "----------------------------------------\n", - "Name: Rajkumar\n", - "Percentage: 84\n", - "Passed in: First class with distinction\n", - "----------------------------------------\n", - "Name: Tejaswi\n", - "Percentage: 82\n", - "Passed in: First class with distinction\n", - "----------------------------------------\n", - "Name: Smrithi\n", - "Percentage: 60\n", - "Passed in: First class\n", - "----------------------------------------\n", - "Name: Anand\n", - "Percentage: 55\n", - "Passed in: Second class\n", - "----------------------------------------\n", - "Name: Rajshree\n", - "Percentage: 40\n", - "Passed in: Third class\n", - "----------------------------------------\n", - "Name: Ramesh\n", - "Percentage: 33\n", - "Passed in: Sorry, Failed!\n", - "----------------------------------------\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-fio.cpp, Page no-751" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "READ_SIZE=6\n", - "reader=str\n", - "fstr=open(\"test.del\", \"w\")\n", - "for i in range(10):\n", - " fstr.write(str(i))\n", - "fstr.seek(2)\n", - "fstr.write(\"Hello\")\n", - "fstr=open(\"test.del\", \"r\")\n", - "fstr.seek(4)\n", - "reader=fstr.read(READ_SIZE)\n", - "print reader" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "llo789\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-direct.cpp, Page no-752" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class Person(Structure):\n", - " _fields_=[('name',c_char*40),('age',c_int)]\n", - " def write(self, os):\n", - " os.write(self.__name+'\\n')\n", - " os.write(str(self.__age)+'\\n')\n", - " def read(self, Is):\n", - " self.__name=Is.readline()\n", - " self.__age=Is.readline()\n", - "def Input(b):\n", - " b._Person__name=raw_input(\"Name: \")\n", - " b._Person__age=int(raw_input(\"Age: \"))\n", - "def Output(b):\n", - " print \"Name:\",b._Person__name,\n", - " print \"Age:\",b._Person__age,\n", - "p_obj=Person()\n", - "print \"Database Creation...\"\n", - "ofile=open(\"person.dat\", \"w\")\n", - "count=0\n", - "while(1):\n", - " print \"Enter Object\", count, \"details...\"\n", - " Input(p_obj)\n", - " count=count+1\n", - " p_obj.write(ofile)\n", - " ch=str(raw_input(\"Another? \"))\n", - " if ch.upper()!='Y':\n", - " break\n", - "ofile.close()\n", - "iofile=open(\"person.dat\", \"r+b\")\n", - "print \"Database Access...\"\n", - "while 1:\n", - " obj_id=int(raw_input(\"Enter the object number to be accessed <-1 to end>: \"))\n", - " iofile.seek(0)\n", - " if obj_id<0 or obj_id>=count:\n", - " break\n", - " for i in range(2*obj_id):\n", - " iofile.readline()\n", - " location=iofile.tell()\n", - " iofile.seek(location)\n", - " p_obj.read(iofile)\n", - " Output(p_obj)\n", - " ch=raw_input(\"Wants to Modify? \")\n", - " if ch=='y' or ch=='Y':\n", - " Input(p_obj)\n", - " iofile.seek(location)\n", - " p_obj.write(iofile)\n", - "iofile.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Database Creation...\n", - "Enter Object 0 details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 25\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Another? y\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Object 1 details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 20\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Another? y\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Object 2 details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Kalpana\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 15\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Another? n\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Database Access...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the object number to be accessed <-1 to end>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Rajkumar\r\n", - "Age: 25\r\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wants to Modify? n\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the object number to be accessed <-1 to end>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Tejaswi\r\n", - "Age: 20\r\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wants to Modify? y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the object number to be accessed <-1 to end>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Tejaswi\n", - "Age: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wants to Modify? n\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the object number to be accessed <-1 to end>: -1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-outfile.cpp, Page no-758" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "outfile=open(\"sample.out\", \"w\")\n", - "if not(outfile):\n", - " print \"Error: sample.out unable to open\"\n", - "else:\n", - " while(1):\n", - " buff=raw_input()\n", - " if buff==\"end\":\n", - " break\n", - " outfile.write(buff)\n", - " if not(outfile):\n", - " print \"write operation fail\"\n", - " break\n", - " outfile.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "OOP is good\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "C++ is OOP\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "C++ is good\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "end\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-762" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "space=tab=line=0\n", - "fin=open(\"File1.txt\", \"r\")\n", - "#fin.write(\"F I L E\\nHandling\\nin\tC++\")\n", - "while 1:\n", - " c=fin.read(1)\n", - " if c==' ':\n", - " space+=1\n", - " if c=='\\t':\n", - " tab+=1\n", - " if c=='\\n':\n", - " line+=1\n", - " if c=='':\n", - " break\n", - "print \"Number of blank spaces =\", space\n", - "print \"Number of tabs =\", tab\n", - "print \"Number of lines =\", line" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of blank spaces = 3\n", - "Number of tabs = 1\n", - "Number of lines = 2\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-2, Page no-763" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "fin=open(\"Sample.txt\", \"r\")\n", - "#fin.write(\"File Handling in C++\")\n", - "print \"Here are the contents of the file, Sample.txt...\"\n", - "c=fin.read()\n", - "print c" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Here are the contents of the file, Sample.txt...\n", - "File Handling in C++\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles_1.ipynb deleted file mode 100755 index c0ab891b..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter18-StreamsComputationWithFiles_1.ipynb +++ /dev/null @@ -1,1152 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:106e6360a9ecdf3fab5d674652e46c069b45eff7a983c63c8ffa1abf67715d03" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 18-Streams Computation with Files" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-stdfile.cpp, Page no-728" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "fout=open(\"student.out\", \"w\")\n", - "name=raw_input(\"Enter Name: \")\n", - "marks=raw_input(\"Enter Marks Secured: \")\n", - "fout.write(name+'\\n')\n", - "fout.write(marks+'\\n')\n", - "name=raw_input(\"Enter Name: \")\n", - "marks=raw_input(\"Enter Marks Secured: \")\n", - "fout.write(name+'\\n')\n", - "fout.write(marks+'\\n')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Marks Secured: 95\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Marks Secured: 90\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-stdread.cpp, Page no-729" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "fin=open(\"student.out\", \"r\")\n", - "name = fin.readline()\n", - "print \"Name:\", name,\n", - "marks=fin.readline()\n", - "print \"Marks Secured:\",marks,\n", - "name = fin.readline()\n", - "print \"Name:\", name,\n", - "marks=fin.readline()\n", - "print \"Marks Secured:\",marks" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Rajkumar\n", - "Marks Secured: 95\n", - "Name: Tejaswi\n", - "Marks Secured: 90\n", - "\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-fdisp.cpp, Page no-732" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "filename=raw_input(\"Enter Name of the File: \")\n", - "try:\n", - " ifile=open(filename, \"r\")\n", - " ch=ifile.read()\n", - " print ch\n", - "except IOError:\n", - " print \"Error opening\", filename" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Name of the File: mytype.cpp\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Error opening mytype.cpp\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-keyin.cpp, Page no-733" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ofile=open(\"key.txt\", \"w\")\n", - "print \"Enter characters ..\"\n", - "else:\n", - " #Open a file\n", - " infile=open(sys.argv[1],'r')\n", - "\n", - " #In case file cannot open\n", - " if(not(infile)):\n", - " print \"Error opening\", sys.argv[1]\n", - " else:\n", - " #Read file\n", - " infile.seek(end)\n", - " print \"File Size=\", infile.tell()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Usage: fsize \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-putget.cpp, Page no-741" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "File=open(\"student.txt\", \"w\")\n", - "string=raw_input(\"Enter String: \")\n", - "File.write(string)\n", - "File.seek(0)\n", - "print \"Output string:\",\n", - "File=open(\"student.txt\", \"r\")\n", - "string=File.read()\n", - "print string" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter String: Object-Computing with C++\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Output string: Object-Computing with C++\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-fwr.cpp, Page no-743" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num1=530\n", - "num2=1050.25\n", - "out_file=open(\"number.bin\", \"w\")\n", - "out_file.write(str(num1)+'\\n')\n", - "out_file.write(str(num2)+'\\n')\n", - "out_file.close()\n", - "in_file=open(\"number.bin\", \"r\")\n", - "num1=in_file.readline()\n", - "num2=in_file.readline()\n", - "print num1, num2\n", - "in_file.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "530\n", - "1050.25\n", - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-objsave.cpp, Page no-744" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAXNAME=40\n", - "class Person:\n", - " __name=str\n", - " __age=int\n", - " def write(self, os):\n", - " os.write(self.__name+'\\n')\n", - " os.write(str(self.__age)+'\\n')\n", - " def read(self,Is):\n", - " self.__name=Is.readline()\n", - " self.__age=Is.readline()\n", - "def fOutput(fos, b):\n", - " b.write(fos)\n", - "def fInput(fos, b):\n", - " b.read(fos)\n", - "def Input(b):\n", - " b._Person__name=raw_input(\"Name: \")\n", - " b._Person__age=int(raw_input(\"Age: \"))\n", - "def Output(b):\n", - " print b._Person__name,\n", - " print b._Person__age,\n", - "p_obj=Person()\n", - "ofile=open(\"person.txt\", \"w\")\n", - "while(1):\n", - " Input(p_obj)\n", - " fOutput(ofile, p_obj)\n", - " ch=str(raw_input(\"Another? \"))\n", - " if ch.upper()!='Y':\n", - " break\n", - "ofile.close()\n", - "ifile=open(\"person.txt\", \"r\")\n", - "print \"The objects written to the file were:..\"\n", - "while 1:\n", - " fInput(ifile, p_obj)\n", - " Output(p_obj)\n", - " if p_obj._Person__name=='':\n", - " break" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Another? y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Savithri\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 23\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Another? n\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The objects written to the file were:..\n", - "Tejaswi\n", - "5\n", - "Savithri\n", - "23\n", - " \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student.cpp, Page no-748" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "try:\n", - " infile=open(\"student.in\", \"r\")\n", - "except IOerror:\n", - " print \"Error: student.in file non-existent\"\n", - "try:\n", - " outfile=open(\"student.out\", \"w\")\n", - "except IOerror:\n", - " print \"Error: unable to open student.out in write mode\"\n", - "else:\n", - " count=int(infile.readline())\n", - " outfile.write(\" Students Information Processing\")\n", - " outfile.write(\"\\n----------------------------------------\")\n", - " for i in range(count):\n", - " name=infile.readline()\n", - " percentage=int(infile.readline())\n", - " outfile.write(\"\\nName: \"+name)\n", - " outfile.write(\"Percentage: \"+str(percentage)+'\\n')\n", - " outfile.write(\"Passed in: \")\n", - " if percentage>=70:\n", - " outfile.write(\"First class with distinction\")\n", - " elif percentage>=60:\n", - " outfile.write(\"First class\")\n", - " elif percentage>=50:\n", - " outfile.write(\"Second class\")\n", - " elif percentage>=35:\n", - " outfile.write(\"Third class\")\n", - " else:\n", - " outfile.write(\"Sorry, Failed!\")\n", - " outfile.write('\\n')\n", - " outfile.write(\"----------------------------------------\")\n", - " infile.close()\n", - " outfile.close()\n", - " print \"Contents of student.out:\\n\"\n", - " infile=open(\"student.out\", \"r\")\n", - " Str=infile.read()\n", - " print Str\n", - " infile.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Contents of student.out:\n", - "\n", - " Students Information Processing\n", - "----------------------------------------\n", - "Name: Rajkumar\n", - "Percentage: 84\n", - "Passed in: First class with distinction\n", - "----------------------------------------\n", - "Name: Tejaswi\n", - "Percentage: 82\n", - "Passed in: First class with distinction\n", - "----------------------------------------\n", - "Name: Smrithi\n", - "Percentage: 60\n", - "Passed in: First class\n", - "----------------------------------------\n", - "Name: Anand\n", - "Percentage: 55\n", - "Passed in: Second class\n", - "----------------------------------------\n", - "Name: Rajshree\n", - "Percentage: 40\n", - "Passed in: Third class\n", - "----------------------------------------\n", - "Name: Ramesh\n", - "Percentage: 33\n", - "Passed in: Sorry, Failed!\n", - "----------------------------------------\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-fio.cpp, Page no-751" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "READ_SIZE=6\n", - "reader=str\n", - "fstr=open(\"test.del\", \"w\")\n", - "for i in range(10):\n", - " fstr.write(str(i))\n", - "fstr.seek(2)\n", - "fstr.write(\"Hello\")\n", - "fstr=open(\"test.del\", \"r\")\n", - "fstr.seek(4)\n", - "reader=fstr.read(READ_SIZE)\n", - "print reader" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "llo789\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-direct.cpp, Page no-752" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure, c_char, c_int\n", - "class Person(Structure):\n", - " _fields_=[('name',c_char*40),('age',c_int)]\n", - " def write(self, os):\n", - " os.write(self.__name+'\\n')\n", - " os.write(str(self.__age)+'\\n')\n", - " def read(self, Is):\n", - " self.__name=Is.readline()\n", - " self.__age=Is.readline()\n", - "def Input(b):\n", - " b._Person__name=raw_input(\"Name: \")\n", - " b._Person__age=int(raw_input(\"Age: \"))\n", - "def Output(b):\n", - " print \"Name:\",b._Person__name,\n", - " print \"Age:\",b._Person__age,\n", - "p_obj=Person()\n", - "print \"Database Creation...\"\n", - "ofile=open(\"person.dat\", \"w\")\n", - "count=0\n", - "while(1):\n", - " print \"Enter Object\", count, \"details...\"\n", - " Input(p_obj)\n", - " count=count+1\n", - " p_obj.write(ofile)\n", - " ch=str(raw_input(\"Another? \"))\n", - " if ch.upper()!='Y':\n", - " break\n", - "ofile.close()\n", - "iofile=open(\"person.dat\", \"r+b\")\n", - "print \"Database Access...\"\n", - "while 1:\n", - " obj_id=int(raw_input(\"Enter the object number to be accessed <-1 to end>: \"))\n", - " iofile.seek(0)\n", - " if obj_id<0 or obj_id>=count:\n", - " break\n", - " for i in range(2*obj_id):\n", - " iofile.readline()\n", - " location=iofile.tell()\n", - " iofile.seek(location)\n", - " p_obj.read(iofile)\n", - " Output(p_obj)\n", - " ch=raw_input(\"Wants to Modify? \")\n", - " if ch=='y' or ch=='Y':\n", - " Input(p_obj)\n", - " iofile.seek(location)\n", - " p_obj.write(iofile)\n", - "iofile.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Database Creation...\n", - "Enter Object 0 details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 25\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Another? y\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Object 1 details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 20\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Another? y\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Object 2 details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Kalpana\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 15\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Another? n\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Database Access...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the object number to be accessed <-1 to end>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Rajkumar\r\n", - "Age: 25\r\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wants to Modify? n\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the object number to be accessed <-1 to end>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Tejaswi\r\n", - "Age: 20\r\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wants to Modify? y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Age: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the object number to be accessed <-1 to end>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Tejaswi\n", - "Age: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wants to Modify? n\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the object number to be accessed <-1 to end>: -1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-outfile.cpp, Page no-758" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "outfile=open(\"sample.out\", \"w\")\n", - "if not(outfile):\n", - " print \"Error: sample.out unable to open\"\n", - "else:\n", - " while(1):\n", - " buff=raw_input()\n", - " if buff==\"end\":\n", - " break\n", - " outfile.write(buff)\n", - " if not(outfile):\n", - " print \"write operation fail\"\n", - " break\n", - " outfile.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "OOP is good\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "C++ is OOP\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "C++ is good\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "end\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-762" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "space=tab=line=0\n", - "fin=open(\"File1.txt\", \"r\")\n", - "#fin.write(\"F I L E\\nHandling\\nin\tC++\")\n", - "while 1:\n", - " c=fin.read(1)\n", - " if c==' ':\n", - " space+=1\n", - " if c=='\\t':\n", - " tab+=1\n", - " if c=='\\n':\n", - " line+=1\n", - " if c=='':\n", - " break\n", - "print \"Number of blank spaces =\", space\n", - "print \"Number of tabs =\", tab\n", - "print \"Number of lines =\", line" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of blank spaces = 3\n", - "Number of tabs = 1\n", - "Number of lines = 2\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-2, Page no-763" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "fin=open(\"Sample.txt\", \"r\")\n", - "#fin.write(\"File Handling in C++\")\n", - "print \"Here are the contents of the file, Sample.txt...\"\n", - "c=fin.read()\n", - "print c" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Here are the contents of the file, Sample.txt...\n", - "File Handling in C++\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling.ipynb deleted file mode 100755 index 98576807..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling.ipynb +++ /dev/null @@ -1,1454 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:3313deb61b605e4e7573c1c706ba00b703ad3ca8e59ab2363418ae531f9382dc" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 19-Exception Handling" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-divzero.cpp, Page no-770" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class number:\n", - " __num=int\n", - " def read(self):\n", - " self.__num=int(raw_input())\n", - " class DIVIDE():\n", - " pass\n", - " def div(self, num2):\n", - " if num2.__num==0:\n", - " raise self.DIVIDE()\n", - " else:\n", - " return self.__num/num2.__num\n", - "num1=number()\n", - "num2=number()\n", - "print \"Enter Number 1: \",\n", - "num1.read()\n", - "print \"Enter Number 2: \",\n", - "num2.read()\n", - "try:\n", - " print \"trying division operation...\",\n", - " result=num1.div(num2)\n", - " print \"succeeded\"\n", - "except number.DIVIDE:\n", - " print \"failed\"\n", - " print \"Exception: Divide-By-Zero\"\n", - "else:\n", - " print \"num1/num2 =\", result" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Number 1: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Number 2: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " trying division operation... failed\n", - "Exception: Divide-By-Zero\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-arrbound.cpp, Page no-772" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ARR_SIZE=10\n", - "class array:\n", - " __arr=[int]*ARR_SIZE\n", - " class RANGE():\n", - " pass\n", - " #overloading []\n", - " def op(self, i, x):\n", - " if i<0 or i>=ARR_SIZE:\n", - " raise self.RANGE()\n", - " self.__arr[i]=x\n", - "a=array()\n", - "print \"Maximum array size allowed =\", ARR_SIZE\n", - "try:\n", - " print \"Trying to refer a[1]...\",\n", - " a.op(1, 10) #a[1]=10\n", - " print \"succeeded\"\n", - " print \"Trying to refer a[15]...\",\n", - " a.op(15, 10) #a[15]=10\n", - " print \"succeeded\"\n", - "except array.RANGE:\n", - " print \"Out of Range in Array Reference\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum array size allowed = 10\n", - "Trying to refer a[1]... succeeded\n", - "Trying to refer a[15]... Out of Range in Array Reference\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-pass.cpp, Page no-774" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ARR_SIZE=10\n", - "class array:\n", - " __arr=[int]*ARR_SIZE\n", - " class RANGE():\n", - " pass\n", - " def __init__(self):\n", - " for i in range(ARR_SIZE):\n", - " self.__arr[i]=i\n", - " #overloading []\n", - " def op(self, i, x=None):\n", - " if i<0 or i>=ARR_SIZE:\n", - " raise self.RANGE()\n", - " if isinstance(x, int):\n", - " self.__arr[i]=x\n", - " else:\n", - " return self.__arr[i]\n", - "def read(a, index):\n", - " try:\n", - " element=a.op(index)\n", - " except array.RANGE:\n", - " print \"Parent passing exception to child to handle\"\n", - " raise\n", - " return element\n", - "a=array()\n", - "print \"Maximum array size allowed =\", ARR_SIZE\n", - "while(1):\n", - " index=int(raw_input(\"Enter element to be referenced: \"))\n", - " try:\n", - " print \"Trying to access object array 'a' for index =\", index\n", - " element=read(a, index)\n", - " print \"Elemnet in Array =\", element\n", - " except array.RANGE:\n", - " print \"Child: Out of Range in Array Reference\"\n", - " break" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum array size allowed = 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter element to be referenced: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Trying to access object array 'a' for index = 1\n", - "Elemnet in Array = 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter element to be referenced: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Trying to access object array 'a' for index = 5\n", - "Elemnet in Array = 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter element to be referenced: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Trying to access object array 'a' for index = 10\n", - "Parent passing exception to child to handle\n", - "Child: Out of Range in Array Reference\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sign1.cpp, Page no-777" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class positive:\n", - " pass\n", - "class negative:\n", - " pass\n", - "class zero:\n", - " pass\n", - "def what_sign(num): #no exception list in python and hence the except block for class zero is removed to produce the desired output\n", - " if num>0:\n", - " raise positive()\n", - " elif num<0:\n", - " raise negative()\n", - " else:\n", - " raise zero()\n", - "num=int(raw_input(\"Enter any number: \"))\n", - "try:\n", - " what_sign(num)\n", - "except positive:\n", - " print \"+ve Exception\"\n", - "except negative:\n", - " print \"-ve Exception\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any number: -10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "-ve Exception\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sign2.cpp, Page no-778" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class zero:\n", - " pass\n", - "def what_sign(num): #no exception list in python and hence the except block for class zero is removed to produce the desired output\n", - " if num>0:\n", - " print \"+ve Exception\"\n", - " elif num<0:\n", - " print \"-ve Exception\"\n", - " else:\n", - " raise zero()\n", - "num=int(raw_input(\"Enter any number: \"))\n", - "what_sign(num)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any number: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "+ve Exception\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-catall1.cpp, Page no-780" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class excep2:\n", - " pass\n", - "try:\n", - " print \"Throwing uncaught exception\"\n", - " raise excep2()\n", - "except:\n", - " print \"Caught all exceptions\"\n", - "print \"I am displayed\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Throwing uncaught exception\n", - "Caught all exceptions\n", - "I am displayed\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-catall2.cpp, Page no-780" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class ALPHA:\n", - " pass\n", - "_a=ALPHA()\n", - "def f3():\n", - " print \"f3() was called\"\n", - " raise _a\n", - "def f2():\n", - " try:\n", - " print \"f2() was called\"\n", - " f3()\n", - " except:\n", - " print \"f2() has elements with exceptions!\"\n", - "try:\n", - " f2()\n", - "except:\n", - " print \"Need more handlers!\"\n", - " print \"continud after handling exceptions\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "f2() was called\n", - "f3() was called\n", - "f2() has elements with exceptions!\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-twoexcep.cpp, Page no-782" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ARR_SIZE=10\n", - "class array:\n", - " __arr=[int]\n", - " __size=int\n", - " class RANGE:\n", - " pass\n", - " class SIZE:\n", - " pass\n", - " def __init__(self, SizeRequest):\n", - " self.__arr=[int]*SizeRequest\n", - " if SizeRequest<0 or SizeRequest>ARR_SIZE:\n", - " raise self.SIZE()\n", - " self.__size=SizeRequest\n", - " def __del__(self):\n", - " del self.__arr\n", - " #overloading []\n", - " def op(self, i, x=None):\n", - " if i<0 or i>=self.__size:\n", - " raise self.RANGE()\n", - " elif isinstance(x, int):\n", - " self.__arr[i]=x\n", - " else:\n", - " return self.__arr[i]\n", - "print \"Maximum array size allowed =\", ARR_SIZE\n", - "try:\n", - " print \"Trying to create object a1(5)...\",\n", - " a1=array(5)\n", - " print \"succeeded\"\n", - " print \"Trying to refer a1[4]...\",\n", - " a1.op(4, 10) #a1[4]=10\n", - " print \"succeeded..\",\n", - " print \"a1[4] =\", a1.op(4) #a1[4]\n", - " print \"Trying to refer a1[15]...\",\n", - " a1.op(15, 10) #a1[15]=10\n", - " print \"succeeded\"\n", - "except array.SIZE:\n", - " print \"..Size exceeds allowable Limit\"\n", - "except array.RANGE:\n", - " print \"..Array Reference Out of Range\"\n", - "try:\n", - " print \"Trying to create object a2(15)...\",\n", - " a2=array(15)\n", - " print \"succeeded\"\n", - " a2.op(3, 3) #a2[3]=3\n", - "except array.SIZE:\n", - " print \"..Size exceeds allowable Limit\"\n", - "except array.RANGE:\n", - " print \"..Array Reference Out of Range\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum array size allowed = 10\n", - "Trying to create object a1(5)... succeeded\n", - "Trying to refer a1[4]... succeeded.. a1[4] = 10\n", - "Trying to refer a1[15]... ..Array Reference Out of Range\n", - "Trying to create object a2(15)... ..Size exceeds allowable Limit\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-uncaught.cpp, Page no-784" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#error because there is no block to handles exceptions of type excep2()\n", - "class excep1:\n", - " pass\n", - "class excep2:\n", - " pass\n", - "try:\n", - " print \"Throwing uncaught exception\"\n", - " raise excep2()\n", - "except excep1:\n", - " print \"Exception 1\"\n", - " print \"I am not displayed\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Throwing uncaught exception\n" - ] - }, - { - "ename": "excep2", - "evalue": "<__main__.excep2 instance at 0x00000000039A8408>", - "output_type": "pyerr", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mexcep2\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"Throwing uncaught exception\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 7\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mexcep2\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 8\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mexcep1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"Exception 1\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mexcep2\u001b[0m: <__main__.excep2 instance at 0x00000000039A8408>" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-myhand.cpp, Page no-786" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class excep1:\n", - " pass\n", - "class excep2:\n", - " pass\n", - "def MyTerminate():\n", - " print \"My terminate is invoked\"\n", - " return \n", - "try:\n", - " print \"Throwing uncaught exception\"\n", - " raise excep2()\n", - "except excep1:\n", - " print \"Exception 1\"\n", - " print \"I am not displayed\"\n", - "except:\n", - " MyTerminate()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Throwing uncaught exception\n", - "My terminate is invoked\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sign3.cpp, Page no-787" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class zero:\n", - " pass\n", - "def what_sign(num):#no exception list in python and hence the except block is removed to produce the desired output\n", - " if num>0:\n", - " print \"+ve Exception\"\n", - " elif num<0:\n", - " print \"-ve Exception\"\n", - " else:\n", - " raise zero()\n", - "num=int(raw_input(\"Enter any number: \"))\n", - "what_sign(num)\n", - "print \"end of main()\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any number: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "+ve Exception\n", - "end of main()\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sign4.cpp, Page no-788" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class zero:\n", - " pass\n", - "def MyUnexpected():\n", - " print \"My unexpected handler is invoked\"\n", - "def what_sign(num): #no exception list in python and hence the changes are made to produce the desired output\n", - " if num>0:\n", - " print \"+ve Exception\"\n", - " print \"end of main()\"\n", - " elif num<0:\n", - " print \"-ve Exception\"\n", - " print \"end of main()\"\n", - " else:\n", - " MyUnexpected()\n", - "num=int(raw_input(\"Enter any number: \"))\n", - "try:\n", - " what_sign(num)\n", - "except:\n", - " print \"catch all exceptions\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any number: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "My unexpected handler is invoked\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-interact.cpp, Page no-790" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "VEC_SIZE=10\n", - "class vector:\n", - " __vec=[int]\n", - " __size=int\n", - " class RANGE:\n", - " pass\n", - " class SIZE:\n", - " pass\n", - " def __init__(self, SizeRequest):\n", - " self.__vec=[int]*SizeRequest\n", - " if SizeRequest<0 or SizeRequest>VEC_SIZE:\n", - " raise self.SIZE()\n", - " self.__size=SizeRequest\n", - " def __del__(self):\n", - " del self.__vec\n", - " #overloading []\n", - " def op(self, i, x=None):\n", - " if i<0 or i>=self.__size:\n", - " raise self.RANGE()\n", - " elif isinstance(x, int):\n", - " self.__vec[i]=x\n", - " else:\n", - " return self.__vec[i]\n", - "print \"Maximum vector size allowed =\", VEC_SIZE\n", - "try:\n", - " size=int(raw_input(\"What is the size of vector you want to create: \"))\n", - " print \"Trying to create object vector v1 of size =\", size,\n", - " v1=vector(size)\n", - " print \"..succeeded\"\n", - " index=int(raw_input(\"Which vector element you want to access (index): \"))\n", - " print \"What is the new value for v1[\", index, \"]:\",\n", - " data=int(raw_input())\n", - " print \"Trying to modify a1[\", index, \"]...\",\n", - " v1.op(index, data) #v1[index]=data\n", - " print \"succeeded\"\n", - " print \"New value of a1[\", index, \"] =\", v1.op(index) #v1[index]\n", - "except vector.SIZE:\n", - " print \"failed\\nVector creation size exceeds allowable limit\"\n", - "except vector.RANGE:\n", - " print \"failed\\nVector reference out-of-range\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum vector size allowed = 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "What is the size of vector you want to create: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Trying to create object vector v1 of size = 5 ..succeeded\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Which vector element you want to access (index): 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "What is the new value for v1[ 10 ]:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Trying to modify a1[ 10 ]... failed\n", - "Vector reference out-of-range\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-virtual.cpp, Page no-792" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class WRONG_AGE:\n", - " pass\n", - "class Father:\n", - " def __init__(self, n):\n", - " if n<0:\n", - " raise WRONG_AGE()\n", - " self.__f_age=n\n", - " def GetAge(self):\n", - " return self.__f_age\n", - "class Son(Father):\n", - " def __init__(self, n, m):\n", - " Father.__init__(self, n)\n", - " if m>=n:\n", - " raise WRONG_AGE()\n", - " self.__s_age=m\n", - " def GetAge(self):\n", - " return self.__s_age\n", - "basep=[Father]\n", - "father_age=int(raw_input(\"Enter Age of Father: \"))\n", - "try:\n", - " basep=Father(father_age)\n", - "except WRONG_AGE:\n", - " print \"Error: Father's Age is < 0\"\n", - "else:\n", - " print \"Father's Age:\", basep.GetAge()\n", - " del basep\n", - " son_age=int(raw_input(\"Enter Age of Son: \"))\n", - " try:\n", - " basep=Son(father_age, son_age)\n", - " except WRONG_AGE:\n", - " print \"Error: Father's Age cannot be less than son age\"\n", - " else:\n", - " print \"Father's Age:\", basep.GetAge()\n", - " del basep" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Age of Father: 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Father's Age: 20\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Age of Son: 45\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Error: Father's Age cannot be less than son age\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-matrix.cpp, Page no-794" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "TRUE=1\n", - "FALSE=0\n", - "class MatError:\n", - " pass\n", - "class matrix:\n", - " __MaxRow=int\n", - " __MaxCol=int\n", - " def __init__(self, row=0, col=0):\n", - " self.__MaxRow=row\n", - " self.__MaxCol=col\n", - " self.__MatPtr=[[float]*5]*5\n", - " def __add__(self, b):\n", - " c=matrix(self.__MaxRow, self.__MaxCol)\n", - " if self.__MaxRow != b._matrix__MaxRow or self.__MaxCol != b._matrix__MaxCol:\n", - " raise MatError()\n", - " for i in range(self.__MaxRow):\n", - " for j in range(self.__MaxCol):\n", - " c._matrix__MatPtr[i][j]=self.__MatPtr[i][j]+b._matrix__MatPtr[i][j]\n", - " return c\n", - " def __sub__(self, b):\n", - " c=matrix(self.__MaxRow, self.__MaxCol)\n", - " if self.__MaxRow != b._matrix__MaxRow or self.__MaxCol != b._matrix__MaxCol:\n", - " raise MatError()\n", - " for i in range(self.__MaxRow):\n", - " for j in range(self.__MaxCol):\n", - " c._matrix__MatPtr[i][j]=self.__MatPtr[i][j]-b._matrix__MatPtr[i][j]\n", - " return c\n", - " def __mul__(self, b):\n", - " c=matrix(self.__MaxRow, b._matrix__MaxCol)\n", - " if self.__MaxCol!=b._matrix__MaxRow:\n", - " raise MatError()\n", - " for i in range(c._matrix__MaxRow):\n", - " for j in range(c._matrix__MaxCol):\n", - " c._matrix__MatPtr[i][j]=0\n", - " for k in range(self.__MaxCol):\n", - " c._matrix__MatPtr[i][j]+=self.__MatPtr[i][k]*b._matrix__MatPtr[k][j]\n", - " return c\n", - " def __eq__(self, b):\n", - " if self.__MaxRow != b._matrix__MaxRow or self.__MaxCol != b._matrix__MaxCol:\n", - " return FALSE\n", - " for i in range(self.__MaxRow):\n", - " for j in range(self.__MaxCol):\n", - " if self.__MatPtr[i][j]!=b._matrix__MatPtr[i][j]:\n", - " return FALSE\n", - " return TRUE\n", - " def __assign__(self, b):\n", - " self.__MaxRow = b._matrix__MaxRow\n", - " self.__MaxCol = b._matrix__MaxCol\n", - " for i in range(self.__MaxRow):\n", - " for j in range(self.__MaxCol):\n", - " self.__MatPtr[i][j]=b._matrix__MatPtr[i][j]\n", - " def Input(self):\n", - " self.__MaxRow=int(raw_input(\"How many rows? \"))\n", - " self.__MaxCol=int(raw_input(\"How many columns? \"))\n", - " self.__MatPtr = []\n", - " for i in range(0,self.__MaxRow):\n", - " self.__MatPtr.append([])\n", - " for j in range(0,self.__MaxCol):\n", - " print \"Matrix[%d,%d] =? \" %(i, j),\n", - " self.__MatPtr[i].append(float(raw_input()))\n", - " def output(self):\n", - " for i in range(self.__MaxRow):\n", - " print \"\"\n", - " for j in range(self.__MaxCol):\n", - " print \"%g\" %self.__MatPtr[i][j],\n", - "a=matrix()\n", - "b=matrix()\n", - "print \"Enter Matrix A details...\"\n", - "a.Input()\n", - "print \"Enter Matrix B details...\"\n", - "b.Input()\n", - "print \"Matrix A is...\",\n", - "a.output()\n", - "print \"\\nMatrix B is...\",\n", - "b.output()\n", - "c=matrix()\n", - "try:\n", - " c=a+b\n", - " print \"\\nC = A + B...\",\n", - " c.output()\n", - "except MatError:\n", - " print \"\\nInvalid matrix order for addition\",\n", - "d=matrix()\n", - "try:\n", - " d=a-b\n", - " print \"\\nD = A - B...\",\n", - " d.output()\n", - "except MatError:\n", - " print \"\\nInvalid matrix order for subtraction\",\n", - "e=matrix(3, 3)\n", - "try:\n", - " e=a*b\n", - " print \"\\nE = A * B...\",\n", - " e.output()\n", - "except MatError:\n", - " print \"\\nInvalid matrix order for multiplication\",\n", - "print \"\\n(Is matrix A equal to matrix B) ?\",\n", - "if a==b:\n", - " print \"Yes\"\n", - "else:\n", - " print \"No\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Matrix A details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[0,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[0,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Matrix B details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows? 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns? 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[0,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix A is... \n", - "1 2 \n", - "Matrix B is... \n", - "1 \n", - "2 \n", - "Invalid matrix order for addition \n", - "Invalid matrix order for subtraction \n", - "E = A * B... \n", - "5 \n", - "(Is matrix A equal to matrix B) ? No\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-recovery.cpp, Page no-802" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_SIG_INT=7\n", - "MAX_UNSIG_INT=15\n", - "class OVERFLOW:\n", - " pass\n", - "def sum(i, j, k):\n", - " try:\n", - " #Version1 procedure\n", - " result=i+j\n", - " if result>MAX_SIG_INT:\n", - " raise OVERFLOW()\n", - " result=result+k\n", - " if result>MAX_SIG_INT:\n", - " raise OVERFLOW()\n", - " print \"Version-1 succeeds\"\n", - " except OVERFLOW:\n", - " print \"Version-1 fails\"\n", - " try:\n", - " #Version2 procedure\n", - " result=i+k\n", - " if result>MAX_SIG_INT:\n", - " raise OVERFLOW()\n", - " result=result+j\n", - " if result>MAX_SIG_INT:\n", - " raise OVERFLOW()\n", - " print \"Version-2 succeeds\"\n", - " except OVERFLOW:\n", - " print \"Version-2 fails\"\n", - " try:\n", - " #Version3 procedure\n", - " result=j+k\n", - " if result>MAX_SIG_INT:\n", - " raise OVERFLOW()\n", - " result=result+i\n", - " if result>MAX_SIG_INT:\n", - " raise OVERFLOW()\n", - " print \"Version-3 succeeds\"\n", - " except OVERFLOW:\n", - " print \"Error: Overflow. All versions falied\"\n", - " return result\n", - "print \"Sum of 7, -3, 2 computation...\"\n", - "result=sum(7, -3, 2)\n", - "print \"Sum =\", result\n", - "print \"Sum of 7, 2, -3 computation...\"\n", - "result=sum(7,2, -3)\n", - "print \"Sum =\", result\n", - "print \"Sum of 3, 3, 2 computation...\"\n", - "result=sum(3, 3, 2)\n", - "print \"Sum =\", result" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of 7, -3, 2 computation...\n", - "Version-1 succeeds\n", - "Sum = 6\n", - "Sum of 7, 2, -3 computation...\n", - "Version-1 fails\n", - "Version-2 succeeds\n", - "Sum = 6\n", - "Sum of 3, 3, 2 computation...\n", - "Version-1 fails\n", - "Version-2 fails\n", - "Error: Overflow. All versions falied\n", - "Sum = 8\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-new1.cpp, Page no-804" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "size=int(raw_input(\"How many bytes to be allocated: \"))\n", - "try:\n", - " data=[int]*size\n", - " print \"Memory allocation success, address =\", hex(id(data))\n", - "except:\n", - " print \"Could not allocate. Bye...\"\n", - "del data" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many bytes to be allocated: 300\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Memory allocation success, address = 0x3717188L\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-new2.cpp, Page no-805" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def display(data, m, n):\n", - " for i in range(m):\n", - " for j in range(n):\n", - " print data[i][j],\n", - " print \"\"\n", - "def de_allocate(data, m):\n", - " for i in range(m-1):\n", - " del data[i]\n", - "m, n=[int(x) for x in raw_input(\"Enter rows and columns count: \").split()]\n", - "try:\n", - " data = []\n", - " for i in range(m):\n", - " data.append([])\n", - " for j in range(n):\n", - " data[i].append(0)\n", - "except:\n", - " print \"Could not allocate. Bye...\"\n", - "else:\n", - " for i in range(m):\n", - " for j in range(n):\n", - " data[i][j]=i+j\n", - " display(data, m, n)\n", - " de_allocate(data, m)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter rows and columns count: 3 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0 1 2 3 \n", - "1 2 3 4 \n", - "2 3 4 5 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-812" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ther is no goto in python\n", - "def main():\n", - " num=int(raw_input(\"Please enter an integer value: \"))\n", - " if isinstance(num, int):\n", - " print \"You entered a correct type of value\"\n", - " else:\n", - " raise num\n", - "try:\n", - " main()\n", - "except:\n", - " print \"You enetered incorrect type of value; try again\"\n", - " main()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter an integer value: 10.7\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "You enetered incorrect type of value; try again\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter an integer value: 8\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "You entered a correct type of value\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-2, Page no-812" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Int:\n", - " def __init__(self, val):\n", - " self.value=val\n", - "class Double:\n", - " def __init__(self, val):\n", - " self.value=val\n", - "class Str:\n", - " def __init__(self, val):\n", - " self.value=val\n", - "i=int(raw_input(\"Press an integer between 1 - 3 to test exception handling with multiple catch blocks..\"))\n", - "try:\n", - " if i==1:\n", - " print \"Throwing integer value\"\n", - " raise Int(1)\n", - " if i==2:\n", - " print \"Throwing double value\"\n", - " raise Double(1.12)\n", - " if i==3:\n", - " print \"Throwing charcter value\"\n", - " raise Str('A')\n", - "except Int as e: #type of an exception raised is not correctly determined in the exception block and hence use of classes \n", - " print \"Caught an integer value\", e.value\n", - "except Double as e:\n", - " print \"Caught a double value\", e.value\n", - "except Str as e:\n", - " print \"Caught a character value\", e.value" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Press an integer between 1 - 3 to test exception handling with multiple catch blocks..3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Throwing charcter value\n", - "Caught a character value A\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling_1.ipynb deleted file mode 100755 index 98576807..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter19-ExceptionHandling_1.ipynb +++ /dev/null @@ -1,1454 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:3313deb61b605e4e7573c1c706ba00b703ad3ca8e59ab2363418ae531f9382dc" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 19-Exception Handling" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-divzero.cpp, Page no-770" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class number:\n", - " __num=int\n", - " def read(self):\n", - " self.__num=int(raw_input())\n", - " class DIVIDE():\n", - " pass\n", - " def div(self, num2):\n", - " if num2.__num==0:\n", - " raise self.DIVIDE()\n", - " else:\n", - " return self.__num/num2.__num\n", - "num1=number()\n", - "num2=number()\n", - "print \"Enter Number 1: \",\n", - "num1.read()\n", - "print \"Enter Number 2: \",\n", - "num2.read()\n", - "try:\n", - " print \"trying division operation...\",\n", - " result=num1.div(num2)\n", - " print \"succeeded\"\n", - "except number.DIVIDE:\n", - " print \"failed\"\n", - " print \"Exception: Divide-By-Zero\"\n", - "else:\n", - " print \"num1/num2 =\", result" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Number 1: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Number 2: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " trying division operation... failed\n", - "Exception: Divide-By-Zero\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-arrbound.cpp, Page no-772" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ARR_SIZE=10\n", - "class array:\n", - " __arr=[int]*ARR_SIZE\n", - " class RANGE():\n", - " pass\n", - " #overloading []\n", - " def op(self, i, x):\n", - " if i<0 or i>=ARR_SIZE:\n", - " raise self.RANGE()\n", - " self.__arr[i]=x\n", - "a=array()\n", - "print \"Maximum array size allowed =\", ARR_SIZE\n", - "try:\n", - " print \"Trying to refer a[1]...\",\n", - " a.op(1, 10) #a[1]=10\n", - " print \"succeeded\"\n", - " print \"Trying to refer a[15]...\",\n", - " a.op(15, 10) #a[15]=10\n", - " print \"succeeded\"\n", - "except array.RANGE:\n", - " print \"Out of Range in Array Reference\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum array size allowed = 10\n", - "Trying to refer a[1]... succeeded\n", - "Trying to refer a[15]... Out of Range in Array Reference\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-pass.cpp, Page no-774" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ARR_SIZE=10\n", - "class array:\n", - " __arr=[int]*ARR_SIZE\n", - " class RANGE():\n", - " pass\n", - " def __init__(self):\n", - " for i in range(ARR_SIZE):\n", - " self.__arr[i]=i\n", - " #overloading []\n", - " def op(self, i, x=None):\n", - " if i<0 or i>=ARR_SIZE:\n", - " raise self.RANGE()\n", - " if isinstance(x, int):\n", - " self.__arr[i]=x\n", - " else:\n", - " return self.__arr[i]\n", - "def read(a, index):\n", - " try:\n", - " element=a.op(index)\n", - " except array.RANGE:\n", - " print \"Parent passing exception to child to handle\"\n", - " raise\n", - " return element\n", - "a=array()\n", - "print \"Maximum array size allowed =\", ARR_SIZE\n", - "while(1):\n", - " index=int(raw_input(\"Enter element to be referenced: \"))\n", - " try:\n", - " print \"Trying to access object array 'a' for index =\", index\n", - " element=read(a, index)\n", - " print \"Elemnet in Array =\", element\n", - " except array.RANGE:\n", - " print \"Child: Out of Range in Array Reference\"\n", - " break" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum array size allowed = 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter element to be referenced: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Trying to access object array 'a' for index = 1\n", - "Elemnet in Array = 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter element to be referenced: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Trying to access object array 'a' for index = 5\n", - "Elemnet in Array = 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter element to be referenced: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Trying to access object array 'a' for index = 10\n", - "Parent passing exception to child to handle\n", - "Child: Out of Range in Array Reference\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sign1.cpp, Page no-777" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class positive:\n", - " pass\n", - "class negative:\n", - " pass\n", - "class zero:\n", - " pass\n", - "def what_sign(num): #no exception list in python and hence the except block for class zero is removed to produce the desired output\n", - " if num>0:\n", - " raise positive()\n", - " elif num<0:\n", - " raise negative()\n", - " else:\n", - " raise zero()\n", - "num=int(raw_input(\"Enter any number: \"))\n", - "try:\n", - " what_sign(num)\n", - "except positive:\n", - " print \"+ve Exception\"\n", - "except negative:\n", - " print \"-ve Exception\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any number: -10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "-ve Exception\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sign2.cpp, Page no-778" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class zero:\n", - " pass\n", - "def what_sign(num): #no exception list in python and hence the except block for class zero is removed to produce the desired output\n", - " if num>0:\n", - " print \"+ve Exception\"\n", - " elif num<0:\n", - " print \"-ve Exception\"\n", - " else:\n", - " raise zero()\n", - "num=int(raw_input(\"Enter any number: \"))\n", - "what_sign(num)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any number: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "+ve Exception\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-catall1.cpp, Page no-780" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class excep2:\n", - " pass\n", - "try:\n", - " print \"Throwing uncaught exception\"\n", - " raise excep2()\n", - "except:\n", - " print \"Caught all exceptions\"\n", - "print \"I am displayed\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Throwing uncaught exception\n", - "Caught all exceptions\n", - "I am displayed\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-catall2.cpp, Page no-780" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class ALPHA:\n", - " pass\n", - "_a=ALPHA()\n", - "def f3():\n", - " print \"f3() was called\"\n", - " raise _a\n", - "def f2():\n", - " try:\n", - " print \"f2() was called\"\n", - " f3()\n", - " except:\n", - " print \"f2() has elements with exceptions!\"\n", - "try:\n", - " f2()\n", - "except:\n", - " print \"Need more handlers!\"\n", - " print \"continud after handling exceptions\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "f2() was called\n", - "f3() was called\n", - "f2() has elements with exceptions!\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-twoexcep.cpp, Page no-782" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ARR_SIZE=10\n", - "class array:\n", - " __arr=[int]\n", - " __size=int\n", - " class RANGE:\n", - " pass\n", - " class SIZE:\n", - " pass\n", - " def __init__(self, SizeRequest):\n", - " self.__arr=[int]*SizeRequest\n", - " if SizeRequest<0 or SizeRequest>ARR_SIZE:\n", - " raise self.SIZE()\n", - " self.__size=SizeRequest\n", - " def __del__(self):\n", - " del self.__arr\n", - " #overloading []\n", - " def op(self, i, x=None):\n", - " if i<0 or i>=self.__size:\n", - " raise self.RANGE()\n", - " elif isinstance(x, int):\n", - " self.__arr[i]=x\n", - " else:\n", - " return self.__arr[i]\n", - "print \"Maximum array size allowed =\", ARR_SIZE\n", - "try:\n", - " print \"Trying to create object a1(5)...\",\n", - " a1=array(5)\n", - " print \"succeeded\"\n", - " print \"Trying to refer a1[4]...\",\n", - " a1.op(4, 10) #a1[4]=10\n", - " print \"succeeded..\",\n", - " print \"a1[4] =\", a1.op(4) #a1[4]\n", - " print \"Trying to refer a1[15]...\",\n", - " a1.op(15, 10) #a1[15]=10\n", - " print \"succeeded\"\n", - "except array.SIZE:\n", - " print \"..Size exceeds allowable Limit\"\n", - "except array.RANGE:\n", - " print \"..Array Reference Out of Range\"\n", - "try:\n", - " print \"Trying to create object a2(15)...\",\n", - " a2=array(15)\n", - " print \"succeeded\"\n", - " a2.op(3, 3) #a2[3]=3\n", - "except array.SIZE:\n", - " print \"..Size exceeds allowable Limit\"\n", - "except array.RANGE:\n", - " print \"..Array Reference Out of Range\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum array size allowed = 10\n", - "Trying to create object a1(5)... succeeded\n", - "Trying to refer a1[4]... succeeded.. a1[4] = 10\n", - "Trying to refer a1[15]... ..Array Reference Out of Range\n", - "Trying to create object a2(15)... ..Size exceeds allowable Limit\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-uncaught.cpp, Page no-784" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#error because there is no block to handles exceptions of type excep2()\n", - "class excep1:\n", - " pass\n", - "class excep2:\n", - " pass\n", - "try:\n", - " print \"Throwing uncaught exception\"\n", - " raise excep2()\n", - "except excep1:\n", - " print \"Exception 1\"\n", - " print \"I am not displayed\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Throwing uncaught exception\n" - ] - }, - { - "ename": "excep2", - "evalue": "<__main__.excep2 instance at 0x00000000039A8408>", - "output_type": "pyerr", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mexcep2\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"Throwing uncaught exception\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 7\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mexcep2\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 8\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mexcep1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"Exception 1\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mexcep2\u001b[0m: <__main__.excep2 instance at 0x00000000039A8408>" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-myhand.cpp, Page no-786" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class excep1:\n", - " pass\n", - "class excep2:\n", - " pass\n", - "def MyTerminate():\n", - " print \"My terminate is invoked\"\n", - " return \n", - "try:\n", - " print \"Throwing uncaught exception\"\n", - " raise excep2()\n", - "except excep1:\n", - " print \"Exception 1\"\n", - " print \"I am not displayed\"\n", - "except:\n", - " MyTerminate()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Throwing uncaught exception\n", - "My terminate is invoked\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sign3.cpp, Page no-787" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class zero:\n", - " pass\n", - "def what_sign(num):#no exception list in python and hence the except block is removed to produce the desired output\n", - " if num>0:\n", - " print \"+ve Exception\"\n", - " elif num<0:\n", - " print \"-ve Exception\"\n", - " else:\n", - " raise zero()\n", - "num=int(raw_input(\"Enter any number: \"))\n", - "what_sign(num)\n", - "print \"end of main()\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any number: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "+ve Exception\n", - "end of main()\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sign4.cpp, Page no-788" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class zero:\n", - " pass\n", - "def MyUnexpected():\n", - " print \"My unexpected handler is invoked\"\n", - "def what_sign(num): #no exception list in python and hence the changes are made to produce the desired output\n", - " if num>0:\n", - " print \"+ve Exception\"\n", - " print \"end of main()\"\n", - " elif num<0:\n", - " print \"-ve Exception\"\n", - " print \"end of main()\"\n", - " else:\n", - " MyUnexpected()\n", - "num=int(raw_input(\"Enter any number: \"))\n", - "try:\n", - " what_sign(num)\n", - "except:\n", - " print \"catch all exceptions\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any number: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "My unexpected handler is invoked\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-interact.cpp, Page no-790" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "VEC_SIZE=10\n", - "class vector:\n", - " __vec=[int]\n", - " __size=int\n", - " class RANGE:\n", - " pass\n", - " class SIZE:\n", - " pass\n", - " def __init__(self, SizeRequest):\n", - " self.__vec=[int]*SizeRequest\n", - " if SizeRequest<0 or SizeRequest>VEC_SIZE:\n", - " raise self.SIZE()\n", - " self.__size=SizeRequest\n", - " def __del__(self):\n", - " del self.__vec\n", - " #overloading []\n", - " def op(self, i, x=None):\n", - " if i<0 or i>=self.__size:\n", - " raise self.RANGE()\n", - " elif isinstance(x, int):\n", - " self.__vec[i]=x\n", - " else:\n", - " return self.__vec[i]\n", - "print \"Maximum vector size allowed =\", VEC_SIZE\n", - "try:\n", - " size=int(raw_input(\"What is the size of vector you want to create: \"))\n", - " print \"Trying to create object vector v1 of size =\", size,\n", - " v1=vector(size)\n", - " print \"..succeeded\"\n", - " index=int(raw_input(\"Which vector element you want to access (index): \"))\n", - " print \"What is the new value for v1[\", index, \"]:\",\n", - " data=int(raw_input())\n", - " print \"Trying to modify a1[\", index, \"]...\",\n", - " v1.op(index, data) #v1[index]=data\n", - " print \"succeeded\"\n", - " print \"New value of a1[\", index, \"] =\", v1.op(index) #v1[index]\n", - "except vector.SIZE:\n", - " print \"failed\\nVector creation size exceeds allowable limit\"\n", - "except vector.RANGE:\n", - " print \"failed\\nVector reference out-of-range\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum vector size allowed = 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "What is the size of vector you want to create: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Trying to create object vector v1 of size = 5 ..succeeded\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Which vector element you want to access (index): 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "What is the new value for v1[ 10 ]:" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Trying to modify a1[ 10 ]... failed\n", - "Vector reference out-of-range\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-virtual.cpp, Page no-792" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class WRONG_AGE:\n", - " pass\n", - "class Father:\n", - " def __init__(self, n):\n", - " if n<0:\n", - " raise WRONG_AGE()\n", - " self.__f_age=n\n", - " def GetAge(self):\n", - " return self.__f_age\n", - "class Son(Father):\n", - " def __init__(self, n, m):\n", - " Father.__init__(self, n)\n", - " if m>=n:\n", - " raise WRONG_AGE()\n", - " self.__s_age=m\n", - " def GetAge(self):\n", - " return self.__s_age\n", - "basep=[Father]\n", - "father_age=int(raw_input(\"Enter Age of Father: \"))\n", - "try:\n", - " basep=Father(father_age)\n", - "except WRONG_AGE:\n", - " print \"Error: Father's Age is < 0\"\n", - "else:\n", - " print \"Father's Age:\", basep.GetAge()\n", - " del basep\n", - " son_age=int(raw_input(\"Enter Age of Son: \"))\n", - " try:\n", - " basep=Son(father_age, son_age)\n", - " except WRONG_AGE:\n", - " print \"Error: Father's Age cannot be less than son age\"\n", - " else:\n", - " print \"Father's Age:\", basep.GetAge()\n", - " del basep" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Age of Father: 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Father's Age: 20\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Age of Son: 45\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Error: Father's Age cannot be less than son age\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-matrix.cpp, Page no-794" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "TRUE=1\n", - "FALSE=0\n", - "class MatError:\n", - " pass\n", - "class matrix:\n", - " __MaxRow=int\n", - " __MaxCol=int\n", - " def __init__(self, row=0, col=0):\n", - " self.__MaxRow=row\n", - " self.__MaxCol=col\n", - " self.__MatPtr=[[float]*5]*5\n", - " def __add__(self, b):\n", - " c=matrix(self.__MaxRow, self.__MaxCol)\n", - " if self.__MaxRow != b._matrix__MaxRow or self.__MaxCol != b._matrix__MaxCol:\n", - " raise MatError()\n", - " for i in range(self.__MaxRow):\n", - " for j in range(self.__MaxCol):\n", - " c._matrix__MatPtr[i][j]=self.__MatPtr[i][j]+b._matrix__MatPtr[i][j]\n", - " return c\n", - " def __sub__(self, b):\n", - " c=matrix(self.__MaxRow, self.__MaxCol)\n", - " if self.__MaxRow != b._matrix__MaxRow or self.__MaxCol != b._matrix__MaxCol:\n", - " raise MatError()\n", - " for i in range(self.__MaxRow):\n", - " for j in range(self.__MaxCol):\n", - " c._matrix__MatPtr[i][j]=self.__MatPtr[i][j]-b._matrix__MatPtr[i][j]\n", - " return c\n", - " def __mul__(self, b):\n", - " c=matrix(self.__MaxRow, b._matrix__MaxCol)\n", - " if self.__MaxCol!=b._matrix__MaxRow:\n", - " raise MatError()\n", - " for i in range(c._matrix__MaxRow):\n", - " for j in range(c._matrix__MaxCol):\n", - " c._matrix__MatPtr[i][j]=0\n", - " for k in range(self.__MaxCol):\n", - " c._matrix__MatPtr[i][j]+=self.__MatPtr[i][k]*b._matrix__MatPtr[k][j]\n", - " return c\n", - " def __eq__(self, b):\n", - " if self.__MaxRow != b._matrix__MaxRow or self.__MaxCol != b._matrix__MaxCol:\n", - " return FALSE\n", - " for i in range(self.__MaxRow):\n", - " for j in range(self.__MaxCol):\n", - " if self.__MatPtr[i][j]!=b._matrix__MatPtr[i][j]:\n", - " return FALSE\n", - " return TRUE\n", - " def __assign__(self, b):\n", - " self.__MaxRow = b._matrix__MaxRow\n", - " self.__MaxCol = b._matrix__MaxCol\n", - " for i in range(self.__MaxRow):\n", - " for j in range(self.__MaxCol):\n", - " self.__MatPtr[i][j]=b._matrix__MatPtr[i][j]\n", - " def Input(self):\n", - " self.__MaxRow=int(raw_input(\"How many rows? \"))\n", - " self.__MaxCol=int(raw_input(\"How many columns? \"))\n", - " self.__MatPtr = []\n", - " for i in range(0,self.__MaxRow):\n", - " self.__MatPtr.append([])\n", - " for j in range(0,self.__MaxCol):\n", - " print \"Matrix[%d,%d] =? \" %(i, j),\n", - " self.__MatPtr[i].append(float(raw_input()))\n", - " def output(self):\n", - " for i in range(self.__MaxRow):\n", - " print \"\"\n", - " for j in range(self.__MaxCol):\n", - " print \"%g\" %self.__MatPtr[i][j],\n", - "a=matrix()\n", - "b=matrix()\n", - "print \"Enter Matrix A details...\"\n", - "a.Input()\n", - "print \"Enter Matrix B details...\"\n", - "b.Input()\n", - "print \"Matrix A is...\",\n", - "a.output()\n", - "print \"\\nMatrix B is...\",\n", - "b.output()\n", - "c=matrix()\n", - "try:\n", - " c=a+b\n", - " print \"\\nC = A + B...\",\n", - " c.output()\n", - "except MatError:\n", - " print \"\\nInvalid matrix order for addition\",\n", - "d=matrix()\n", - "try:\n", - " d=a-b\n", - " print \"\\nD = A - B...\",\n", - " d.output()\n", - "except MatError:\n", - " print \"\\nInvalid matrix order for subtraction\",\n", - "e=matrix(3, 3)\n", - "try:\n", - " e=a*b\n", - " print \"\\nE = A * B...\",\n", - " e.output()\n", - "except MatError:\n", - " print \"\\nInvalid matrix order for multiplication\",\n", - "print \"\\n(Is matrix A equal to matrix B) ?\",\n", - "if a==b:\n", - " print \"Yes\"\n", - "else:\n", - " print \"No\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Matrix A details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[0,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[0,1] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Matrix B details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows? 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns? 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[0,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[1,0] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix A is... \n", - "1 2 \n", - "Matrix B is... \n", - "1 \n", - "2 \n", - "Invalid matrix order for addition \n", - "Invalid matrix order for subtraction \n", - "E = A * B... \n", - "5 \n", - "(Is matrix A equal to matrix B) ? No\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-recovery.cpp, Page no-802" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_SIG_INT=7\n", - "MAX_UNSIG_INT=15\n", - "class OVERFLOW:\n", - " pass\n", - "def sum(i, j, k):\n", - " try:\n", - " #Version1 procedure\n", - " result=i+j\n", - " if result>MAX_SIG_INT:\n", - " raise OVERFLOW()\n", - " result=result+k\n", - " if result>MAX_SIG_INT:\n", - " raise OVERFLOW()\n", - " print \"Version-1 succeeds\"\n", - " except OVERFLOW:\n", - " print \"Version-1 fails\"\n", - " try:\n", - " #Version2 procedure\n", - " result=i+k\n", - " if result>MAX_SIG_INT:\n", - " raise OVERFLOW()\n", - " result=result+j\n", - " if result>MAX_SIG_INT:\n", - " raise OVERFLOW()\n", - " print \"Version-2 succeeds\"\n", - " except OVERFLOW:\n", - " print \"Version-2 fails\"\n", - " try:\n", - " #Version3 procedure\n", - " result=j+k\n", - " if result>MAX_SIG_INT:\n", - " raise OVERFLOW()\n", - " result=result+i\n", - " if result>MAX_SIG_INT:\n", - " raise OVERFLOW()\n", - " print \"Version-3 succeeds\"\n", - " except OVERFLOW:\n", - " print \"Error: Overflow. All versions falied\"\n", - " return result\n", - "print \"Sum of 7, -3, 2 computation...\"\n", - "result=sum(7, -3, 2)\n", - "print \"Sum =\", result\n", - "print \"Sum of 7, 2, -3 computation...\"\n", - "result=sum(7,2, -3)\n", - "print \"Sum =\", result\n", - "print \"Sum of 3, 3, 2 computation...\"\n", - "result=sum(3, 3, 2)\n", - "print \"Sum =\", result" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of 7, -3, 2 computation...\n", - "Version-1 succeeds\n", - "Sum = 6\n", - "Sum of 7, 2, -3 computation...\n", - "Version-1 fails\n", - "Version-2 succeeds\n", - "Sum = 6\n", - "Sum of 3, 3, 2 computation...\n", - "Version-1 fails\n", - "Version-2 fails\n", - "Error: Overflow. All versions falied\n", - "Sum = 8\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-new1.cpp, Page no-804" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "size=int(raw_input(\"How many bytes to be allocated: \"))\n", - "try:\n", - " data=[int]*size\n", - " print \"Memory allocation success, address =\", hex(id(data))\n", - "except:\n", - " print \"Could not allocate. Bye...\"\n", - "del data" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many bytes to be allocated: 300\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Memory allocation success, address = 0x3717188L\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-new2.cpp, Page no-805" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def display(data, m, n):\n", - " for i in range(m):\n", - " for j in range(n):\n", - " print data[i][j],\n", - " print \"\"\n", - "def de_allocate(data, m):\n", - " for i in range(m-1):\n", - " del data[i]\n", - "m, n=[int(x) for x in raw_input(\"Enter rows and columns count: \").split()]\n", - "try:\n", - " data = []\n", - " for i in range(m):\n", - " data.append([])\n", - " for j in range(n):\n", - " data[i].append(0)\n", - "except:\n", - " print \"Could not allocate. Bye...\"\n", - "else:\n", - " for i in range(m):\n", - " for j in range(n):\n", - " data[i][j]=i+j\n", - " display(data, m, n)\n", - " de_allocate(data, m)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter rows and columns count: 3 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0 1 2 3 \n", - "1 2 3 4 \n", - "2 3 4 5 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-812" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ther is no goto in python\n", - "def main():\n", - " num=int(raw_input(\"Please enter an integer value: \"))\n", - " if isinstance(num, int):\n", - " print \"You entered a correct type of value\"\n", - " else:\n", - " raise num\n", - "try:\n", - " main()\n", - "except:\n", - " print \"You enetered incorrect type of value; try again\"\n", - " main()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter an integer value: 10.7\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "You enetered incorrect type of value; try again\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter an integer value: 8\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "You entered a correct type of value\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-2, Page no-812" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Int:\n", - " def __init__(self, val):\n", - " self.value=val\n", - "class Double:\n", - " def __init__(self, val):\n", - " self.value=val\n", - "class Str:\n", - " def __init__(self, val):\n", - " self.value=val\n", - "i=int(raw_input(\"Press an integer between 1 - 3 to test exception handling with multiple catch blocks..\"))\n", - "try:\n", - " if i==1:\n", - " print \"Throwing integer value\"\n", - " raise Int(1)\n", - " if i==2:\n", - " print \"Throwing double value\"\n", - " raise Double(1.12)\n", - " if i==3:\n", - " print \"Throwing charcter value\"\n", - " raise Str('A')\n", - "except Int as e: #type of an exception raised is not correctly determined in the exception block and hence use of classes \n", - " print \"Caught an integer value\", e.value\n", - "except Double as e:\n", - " print \"Caught a double value\", e.value\n", - "except Str as e:\n", - " print \"Caught a character value\", e.value" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Press an integer between 1 - 3 to test exception handling with multiple catch blocks..3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Throwing charcter value\n", - "Caught a character value A\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingFromCtoC++.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingFromCtoC++.ipynb deleted file mode 100755 index a2a5c818..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingFromCtoC++.ipynb +++ /dev/null @@ -1,1389 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:67ef32c0745ec7cb1c0a0b98cb9b19c7c774d2c564bc299d0eb593490455997d" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 2- Moving from C to C++" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-hello.c, Page no-32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"Hello World\" #printing a statement" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-hello.cpp, Page no-32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"Hello World\" #printing a statement" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-output.cpp, Page no-36" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "msg=\"C++ cout object\"\n", - "sex='M'\n", - "age=24\n", - "number=420.5\n", - "print sex, \n", - "print \" \", age, \" \", number\n", - "print msg\n", - "print '%d%d%d' %(1,2,3)\n", - "print number+1\n", - "print 99.99" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "M 24 420.5\n", - "C++ cout object\n", - "123\n", - "421.5\n", - "99.99\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-read.cpp, Page no-38" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "name=[None]*25 #char name[25]\n", - "address=[None]*25 #char address[25]\n", - "name=raw_input(\"Enter name: \") #take input from user\n", - "age=int(raw_input(\"Enter Age: \"))\n", - "address=raw_input(\"Enter address: \")\n", - "print \"The data entered are: \"\n", - "print \"Name =\", name\n", - "print \"Age =\", age\n", - "print \"Address =\", address" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Age: 24\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter address: C-DAC-Bangalore\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The data entered are: \n", - "Name = Rajkumar\n", - "Age = 24\n", - "Address = C-DAC-Bangalore\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-simpint.cpp, Page no-41" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "principle=int(raw_input(\"Enter Principle Amount: \"))\n", - "time=int(raw_input(\"Enter time (in years): \"))\n", - "rate=int(raw_input(\"Enter Rate of Interest: \"))\n", - "SimpInt=(principle*time*rate)/100\n", - "print \"Simple Interest =\", SimpInt\n", - "total= principle + SimpInt\n", - "print \"Total Amount =\", total" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Principle Amount: 1000\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter time (in years): 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Rate of Interest: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Simple Interest = 100\n", - "Total Amount = 1100\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-area.cpp, Page no-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "PI=3.1452 \n", - "radius=float(raw_input(\"Enter Radius of Circle: \"))\n", - "area=PI*radius*radius\n", - "print \"Area of Circle =\", area" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Radius of Circle: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Area of Circle = 12.5808\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-disp.c, Page no-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def display(msg): #pass by reference\n", - " print msg\n", - " msg=\"Misuse\"\n", - " return msg\n", - "string=[None]*15\n", - "string=\"Hello World\"\n", - "string=display(string)\n", - "print string" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n", - "Misuse\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-disp.cpp, Page No-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def display(msg): #pass by value\n", - " print msg\n", - "string=[None]*15\n", - "string=\"Hello World\"\n", - "display(string)\n", - "print string" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n", - "Hello World\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-global.cpp, Page no-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num=20\n", - "def main():\n", - " global num\n", - " x=num\n", - " num=10\n", - " print \"Local =\", num\n", - " print \"Global =\",x\n", - " print \"Global+Local =\", x+num\n", - "main()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Local = 10\n", - "Global = 20\n", - "Global+Local = 30\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-loop.cpp, Page no-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "counter=50\n", - "def main():\n", - " global counter\n", - " x=counter\n", - " for counter in range(1, 10):\n", - " print x/counter\n", - "main()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "50\n", - "25\n", - "16\n", - "12\n", - "10\n", - "8\n", - "7\n", - "6\n", - "5\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-var1.cpp, Page no-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "for i in range(5):\n", - " print i\n", - "i+=1;\n", - "print i" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n", - "1\n", - "2\n", - "3\n", - "4\n", - "5\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-def2.cpp, Page no-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=10\n", - "def main():\n", - " global a\n", - " global_a=a\n", - " print global_a\n", - " a=20\n", - " def temp():\n", - " a=30\n", - " print a\n", - " print global_a\n", - " temp()\n", - " print a\n", - " print global_a\n", - "main()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "10\n", - "30\n", - "10\n", - "20\n", - "10\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-refvar.cpp, Page no-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=z=1\n", - "b=2\n", - "c=3\n", - "print \"a=\",a, \"b=\", b, \"c=\", c, \"z=\", z\n", - "a=z=b\n", - "print \"a=\",a, \"b=\", b, \"c=\", c, \"z=\", z\n", - "a=z=c\n", - "print \"a=\",a, \"b=\", b, \"c=\", c, \"z=\", z\n", - "print \"&a=\", hex(id(a)),\"&b=\", hex(id(b)) , \"&c=\", hex(id(c))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "a= 1 b= 2 c= 3 z= 1\n", - "a= 2 b= 2 c= 3 z= 2\n", - "a= 3 b= 2 c= 3 z= 3\n", - "&a= 0x1d95f68L &b= 0x1d95f80L &c= 0x1d95f68L\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-reftest.cpp, Page no-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "n=c_int(100)\n", - "p=pointer(n)\n", - "m=p[0]\n", - "print \"n =\", n.value, \"m =\", m, \"*p =\", p[0]\n", - "k=c_int(100)\n", - "p=pointer(k)\n", - "k.value=200\n", - "print \"n =\", n.value, \"m =\", m, \"*p =\", p[0]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "n = 100 m = 100 *p = 100\n", - "n = 100 m = 100 *p = 200\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-newmax.cpp, Page no-50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(a, b):\n", - " if(a>b):\n", - " return a\n", - " else:\n", - " return b\n", - "x, y=[int(x) for x in raw_input(\"Enter two integers: \").split()] #takes input in a single line separated by white space\n", - "print \"Maximum =\", Max(x,y)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers: 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum = 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap.cpp, Page no-53" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap (x, y): #pass by reference\n", - " i=x\n", - " x=y\n", - " y=i\n", - " return x, y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "(a,b)=swap(a, b)\n", - "print \"On swapping :\", a, b " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 2 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 3 2\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-square.cpp, Page no-54" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def square(x):\n", - " x=x*x\n", - " return x\n", - "num=float(raw_input('Enter a number : '))\n", - "print 'Its square =', square(num)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number : 5.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Its square = 30.25\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-show.c, Page no-56" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show_integer(val):\n", - " print \"Integer: \", val\n", - "def show_double(val):\n", - " print \"Double: \", val\n", - "def show_string(val):\n", - " print \"String: \", val\n", - "show_integer(420)\n", - "show_double(3.1415)\n", - "show_string(\"Hello World\\n!\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Integer: 420\n", - "Double: 3.1415\n", - "String: Hello World\n", - "!\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-Show.cpp, Page no-56" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show(val): #function overloading\n", - " if (isinstance(val, int)):\n", - " print \"Integer: \", val\n", - " if (isinstance(val, float)):\n", - " print \"Double: \", val\n", - " if(isinstance(val, str)):\n", - " print \"String: \", val\n", - "show(420)\n", - "show(3.1415)\n", - "show(\"Hello World\\n!\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Integer: 420\n", - "Double: 3.1415\n", - "String: Hello World\n", - "!\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-prnstr.cpp, Page no-58" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def showstring(string=\"Hello World!\"): #default arguments\n", - " print string\n", - "showstring(\"Here is an explicit argument\")\n", - "showstring()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Here is an explicit argument\n", - "Hello World!\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-defarg1.cpp, Page no-59" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PrintLine(ch='-', RepeatCount=70): #default arguments\n", - " print \"\\n\"\n", - " for i in range(RepeatCount):\n", - " sys.stdout.write(ch)\n", - "PrintLine()\n", - "PrintLine('!')\n", - "PrintLine('*', 40)\n", - "PrintLine('R', 55)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "\n", - "----------------------------------------------------------------------\n", - "\n", - "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", - "\n", - "****************************************\n", - "\n", - "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-defarg2, Page no-59" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PrintLine(ch='-', RepeatCount=70, nLines=1): #default arguments\n", - " for j in range(nLines):\n", - " print \"\\n\"\n", - " for i in range(RepeatCount):\n", - " sys.stdout.write(ch)\n", - "PrintLine()\n", - "PrintLine('!')\n", - "PrintLine('*', 40)\n", - "PrintLine('R', 55)\n", - "PrintLine('&', 25, 2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "\n", - "----------------------------------------------------------------------\n", - "\n", - "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", - "\n", - "****************************************\n", - "\n", - "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", - "\n", - "&&&&&&&&&&&&&&&&&&&&&&&&&\n", - "\n", - "&&&&&&&&&&&&&&&&&&&&&&&&&" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-date1.cpp, Page no-61" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from collections import namedtuple\n", - "struct_date = namedtuple('struct_date', 'day month year')\n", - "d1 = struct_date(26, 3, 1958)\n", - "d2 = struct_date(14, 4, 1971)\n", - "d3 = struct_date(1, 9, 1973)\n", - "print \"Birth Date of the First Author:\", \n", - "print \"%s-%s-%s\" %(d1.day, d1.month, d1.year)\n", - "print \"Birth Date of the Second Author:\", \n", - "print \"%s-%s-%s\" %(d2.day, d2.month, d2.year)\n", - "print \"Birth Date of the Third Author:\",\n", - "print \"%s-%s-%s\" %(d3.day, d3.month, d3.year)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth Date of the First Author: 26-3-1958\n", - "Birth Date of the Second Author: 14-4-1971\n", - "Birth Date of the Third Author: 1-9-1973\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-date2.cpp, Page no-63" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class date(Structure):\n", - " _fields_=[(\"day\", c_int),(\"month\", c_int),(\"year\",c_int)]\n", - " def show(self):\n", - " print \"%s-%s-%s\" %(self.day, self.month, self.year)\n", - "d1=date(26, 3, 1958)\n", - "d2 = date(14, 4, 1971)\n", - "d3 = date(1, 9, 1973)\n", - "print \"Birth Date of the First Author:\", \n", - "d1.show()\n", - "print \"Birth Date of the Second Author:\", \n", - "d2.show()\n", - "print \"Birth Date of the Third Author:\",\n", - "d3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth Date of the First Author: 26-3-1958\n", - "Birth Date of the Second Author: 14-4-1971\n", - "Birth Date of the Third Author: 1-9-1973\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cast.cpp, Page no-65" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=int\n", - "b=420.5\n", - "print \"int(10.4) = \", int(10.4)\n", - "print \"int(10.99) = \", int(10.99)\n", - "print \"b = \", b\n", - "a=int(b)\n", - "print \"a = int(b) = \", a\n", - "b=float(a)+1.5\n", - "print \"b = float(a)+1.5 = \", b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "int(10.4) = 10\n", - "int(10.99) = 10\n", - "b = 420.5\n", - "a = int(b) = 420\n", - "b = float(a)+1.5 = 421.5\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mswap.cpp, Page no-66" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=raw_input(\"Enter two Characters : \").split()\n", - "ch1, ch2=swap(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter integers : \").split()]\n", - "a, b=swap(a, b)\n", - "print \"On swapping :\", a, b\n", - "c, d=[float(x) for x in raw_input(\"Enter floats : \").split()]\n", - "c, d=swap(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two Characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter integers : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-gswap.cpp, Page no-67" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=raw_input(\"Enter two Characters : \").split()\n", - "ch1, ch2=swap(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter integers : \").split()]\n", - "a, b=swap(a, b)\n", - "print \"On swapping :\", a, b\n", - "c, d=[float(x) for x in raw_input(\"Enter floats : \").split()]\n", - "c, d=swap(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two Characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter integers : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector.cpp, Page no-72" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def AddVectors(a, b, c, size):\n", - " for i in range(size):\n", - " c[i]=a[i]+b[i]\n", - "def ReadVector(vector, size):\n", - " for i in range(size):\n", - " vector[i]=int(raw_input())\n", - "def ShowVector(vector, size):\n", - " for i in range(size):\n", - " print vector[i],\n", - "vec_size=int(raw_input(\"Enter size of vector: \"))\n", - "x=[int]*vec_size\n", - "y=[int]*vec_size\n", - "z=[int]*vec_size\n", - "print \"Enter Elements of vector x: \"\n", - "ReadVector(x, vec_size)\n", - "print \"Enter Elements of vector y: \"\n", - "ReadVector(y, vec_size)\n", - "AddVectors(x, y, z, vec_size)\n", - "print \"Summation Vector z=a+b:\",\n", - "ShowVector(z, vec_size)\n", - "del x\n", - "del y\n", - "del z" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter size of vector: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Elements of vector x: \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Elements of vector y: \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Summation Vector z=a+b: 3 5 4 4 9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page no-73" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def area(s1, s2=None):#function overloading and default parameters\n", - " if (isinstance(s1, int)):\n", - " if(isinstance(s2, int)):\n", - " return (s1*s2)\n", - " else:\n", - " return (s1*s1)\n", - " elif (isinstance(s1, float)):\n", - " return (3.14*s1*s1)\n", - "s=int(raw_input(\"Enter the side length of the square: \"))\n", - "l, b=[int(x) for x in raw_input(\"Enter the length and breadth of the rectangle: \").split()]\n", - "r=float(raw_input(\"Enter the radius of the circle: \"))\n", - "print \"Area of square = \", area(s)\n", - "print \"Area of rectangle = \", area(l, b)\n", - "print \"Area of circle = \", area(r)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the side length of the square: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the length and breadth of the rectangle: 2 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the radius of the circle: 2.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Area of square = 4\n", - "Area of rectangle = 8\n", - "Area of circle = 19.625\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingfromCtoC++.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingfromCtoC++.ipynb deleted file mode 100755 index 32b2a8e8..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter2-MovingfromCtoC++.ipynb +++ /dev/null @@ -1,1389 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:70a62a4d8104a5170dca82f519a0ca63c8b7c13d833950e937b1650a45a6a6fc" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 2- Moving from C to C++" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-hello.c, Page no-32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"Hello World\" #printing a statement" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-hello.cpp, Page no-32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"Hello World\" #printing a statement" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-output.cpp, Page no-36" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "msg=\"C++ cout object\"\n", - "sex='M'\n", - "age=24\n", - "number=420.5\n", - "print sex, \n", - "print \" \", age, \" \", number\n", - "print msg\n", - "print '%d%d%d' %(1,2,3)\n", - "print number+1\n", - "print 99.99" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "M 24 420.5\n", - "C++ cout object\n", - "123\n", - "421.5\n", - "99.99\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-read.cpp, Page no-38" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "name=[None]*25 #char name[25]\n", - "address=[None]*25 #char address[25]\n", - "name=raw_input(\"Enter name: \") #take input from user\n", - "age=int(raw_input(\"Enter Age: \"))\n", - "address=raw_input(\"Enter address: \")\n", - "print \"The data entered are: \"\n", - "print \"Name =\", name\n", - "print \"Age =\", age\n", - "print \"Address =\", address" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Age: 24\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter address: C-DAC-Bangalore\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The data entered are: \n", - "Name = Rajkumar\n", - "Age = 24\n", - "Address = C-DAC-Bangalore\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-simpint.cpp, Page no-41" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "principle=int(raw_input(\"Enter Principle Amount: \"))\n", - "time=int(raw_input(\"Enter time (in years): \"))\n", - "rate=int(raw_input(\"Enter Rate of Interest: \"))\n", - "SimpInt=(principle*time*rate)/100\n", - "print \"Simple Interest =\", SimpInt\n", - "total= principle + SimpInt\n", - "print \"Total Amount =\", total" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Principle Amount: 1000\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter time (in years): 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Rate of Interest: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Simple Interest = 100\n", - "Total Amount = 1100\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-area.cpp, Page no-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "PI=3.1452 \n", - "radius=float(raw_input(\"Enter Radius of Circle: \"))\n", - "area=PI*radius*radius\n", - "print \"Area of Circle =\", area" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Radius of Circle: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Area of Circle = 12.5808\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-disp.c, Page no-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def display(msg): #pass by reference\n", - " print msg\n", - " msg=\"Misuse\"\n", - " return msg\n", - "string=[None]*15\n", - "string=\"Hello World\"\n", - "string=display(string)\n", - "print string" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n", - "Misuse\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-disp.cpp, Page No-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def display(msg): #pass by value\n", - " print msg\n", - "string=[None]*15\n", - "string=\"Hello World\"\n", - "display(string)\n", - "print string" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n", - "Hello World\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-global.cpp, Page no-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num=20\n", - "def main():\n", - " global num\n", - " x=num\n", - " num=10\n", - " print \"Local =\", num\n", - " print \"Global =\",x\n", - " print \"Global+Local =\", x+num\n", - "main()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Local = 10\n", - "Global = 20\n", - "Global+Local = 30\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-loop.cpp, Page no-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "counter=50\n", - "def main():\n", - " global counter\n", - " x=counter\n", - " for counter in range(1, 10):\n", - " print x/counter\n", - "main()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "50\n", - "25\n", - "16\n", - "12\n", - "10\n", - "8\n", - "7\n", - "6\n", - "5\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-var1.cpp, Page no-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "for i in range(5):\n", - " print i\n", - "i+=1;\n", - "print i" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n", - "1\n", - "2\n", - "3\n", - "4\n", - "5\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-def2.cpp, Page no-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=10\n", - "def main():\n", - " global a\n", - " global_a=a\n", - " print global_a\n", - " a=20\n", - " def temp():\n", - " a=30\n", - " print a\n", - " print global_a\n", - " temp()\n", - " print a\n", - " print global_a\n", - "main()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "10\n", - "30\n", - "10\n", - "20\n", - "10\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-refvar.cpp, Page no-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=z=1\n", - "b=2\n", - "c=3\n", - "print \"a=\",a, \"b=\", b, \"c=\", c, \"z=\", z\n", - "a=z=b\n", - "print \"a=\",a, \"b=\", b, \"c=\", c, \"z=\", z\n", - "a=z=c\n", - "print \"a=\",a, \"b=\", b, \"c=\", c, \"z=\", z\n", - "print \"&a=\", hex(id(a)),\"&b=\", hex(id(b)) , \"&c=\", hex(id(c))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "a= 1 b= 2 c= 3 z= 1\n", - "a= 2 b= 2 c= 3 z= 2\n", - "a= 3 b= 2 c= 3 z= 3\n", - "&a= 0x1d95f68L &b= 0x1d95f80L &c= 0x1d95f68L\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-reftest.cpp, Page no-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import c_int, pointer\n", - "n=c_int(100)\n", - "p=pointer(n)\n", - "m=p[0]\n", - "print \"n =\", n.value, \"m =\", m, \"*p =\", p[0]\n", - "k=c_int(100)\n", - "p=pointer(k)\n", - "k.value=200\n", - "print \"n =\", n.value, \"m =\", m, \"*p =\", p[0]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "n = 100 m = 100 *p = 100\n", - "n = 100 m = 100 *p = 200\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-newmax.cpp, Page no-50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(a, b):\n", - " if(a>b):\n", - " return a\n", - " else:\n", - " return b\n", - "x, y=[int(x) for x in raw_input(\"Enter two integers: \").split()] #takes input in a single line separated by white space\n", - "print \"Maximum =\", Max(x,y)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers: 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum = 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap.cpp, Page no-53" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap (x, y): #pass by reference\n", - " i=x\n", - " x=y\n", - " y=i\n", - " return x, y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "(a,b)=swap(a, b)\n", - "print \"On swapping :\", a, b " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 2 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 3 2\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-square.cpp, Page no-54" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def square(x):\n", - " x=x*x\n", - " return x\n", - "num=float(raw_input('Enter a number : '))\n", - "print 'Its square =', square(num)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number : 5.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Its square = 30.25\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-show.c, Page no-56" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show_integer(val):\n", - " print \"Integer: \", val\n", - "def show_double(val):\n", - " print \"Double: \", val\n", - "def show_string(val):\n", - " print \"String: \", val\n", - "show_integer(420)\n", - "show_double(3.1415)\n", - "show_string(\"Hello World\\n!\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Integer: 420\n", - "Double: 3.1415\n", - "String: Hello World\n", - "!\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-Show.cpp, Page no-56" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show(val): #function overloading\n", - " if (isinstance(val, int)):\n", - " print \"Integer: \", val\n", - " if (isinstance(val, float)):\n", - " print \"Double: \", val\n", - " if(isinstance(val, str)):\n", - " print \"String: \", val\n", - "show(420)\n", - "show(3.1415)\n", - "show(\"Hello World\\n!\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Integer: 420\n", - "Double: 3.1415\n", - "String: Hello World\n", - "!\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-prnstr.cpp, Page no-58" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def showstring(string=\"Hello World!\"): #default arguments\n", - " print string\n", - "showstring(\"Here is an explicit argument\")\n", - "showstring()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Here is an explicit argument\n", - "Hello World!\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-defarg1.cpp, Page no-59" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PrintLine(ch='-', RepeatCount=70): #default arguments\n", - " print \"\\n\"\n", - " for i in range(RepeatCount):\n", - " sys.stdout.write(ch)\n", - "PrintLine()\n", - "PrintLine('!')\n", - "PrintLine('*', 40)\n", - "PrintLine('R', 55)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "\n", - "----------------------------------------------------------------------\n", - "\n", - "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", - "\n", - "****************************************\n", - "\n", - "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-defarg2, Page no-59" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PrintLine(ch='-', RepeatCount=70, nLines=1): #default arguments\n", - " for j in range(nLines):\n", - " print \"\\n\"\n", - " for i in range(RepeatCount):\n", - " sys.stdout.write(ch)\n", - "PrintLine()\n", - "PrintLine('!')\n", - "PrintLine('*', 40)\n", - "PrintLine('R', 55)\n", - "PrintLine('&', 25, 2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "\n", - "----------------------------------------------------------------------\n", - "\n", - "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", - "\n", - "****************************************\n", - "\n", - "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", - "\n", - "&&&&&&&&&&&&&&&&&&&&&&&&&\n", - "\n", - "&&&&&&&&&&&&&&&&&&&&&&&&&" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-date1.cpp, Page no-61" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from collections import namedtuple\n", - "struct_date = namedtuple('struct_date', 'day month year')\n", - "d1 = struct_date(26, 3, 1958)\n", - "d2 = struct_date(14, 4, 1971)\n", - "d3 = struct_date(1, 9, 1973)\n", - "print \"Birth Date of the First Author:\", \n", - "print \"%s-%s-%s\" %(d1.day, d1.month, d1.year)\n", - "print \"Birth Date of the Second Author:\", \n", - "print \"%s-%s-%s\" %(d2.day, d2.month, d2.year)\n", - "print \"Birth Date of the Third Author:\",\n", - "print \"%s-%s-%s\" %(d3.day, d3.month, d3.year)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth Date of the First Author: 26-3-1958\n", - "Birth Date of the Second Author: 14-4-1971\n", - "Birth Date of the Third Author: 1-9-1973\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-date2.cpp, Page no-63" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure, c_int\n", - "class date(Structure):\n", - " _fields_=[(\"day\", c_int),(\"month\", c_int),(\"year\",c_int)]\n", - " def show(self):\n", - " print \"%s-%s-%s\" %(self.day, self.month, self.year)\n", - "d1=date(26, 3, 1958)\n", - "d2 = date(14, 4, 1971)\n", - "d3 = date(1, 9, 1973)\n", - "print \"Birth Date of the First Author:\", \n", - "d1.show()\n", - "print \"Birth Date of the Second Author:\", \n", - "d2.show()\n", - "print \"Birth Date of the Third Author:\",\n", - "d3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth Date of the First Author: 26-3-1958\n", - "Birth Date of the Second Author: 14-4-1971\n", - "Birth Date of the Third Author: 1-9-1973\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-cast.cpp, Page no-65" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=int\n", - "b=420.5\n", - "print \"int(10.4) =\", int(10.4)\n", - "print \"int(10.99) =\", int(10.99)\n", - "print \"b =\", b\n", - "a=int(b)\n", - "print \"a = int(b) =\", a\n", - "b=float(a)+1.5\n", - "print \"b = float(a)+1.5 =\", b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "int(10.4) = 10\n", - "int(10.99) = 10\n", - "b = 420.5\n", - "a = int(b) = 420\n", - "b = float(a)+1.5 = 421.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-mswap.cpp, Page no-66" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=raw_input(\"Enter two Characters : \").split()\n", - "ch1, ch2=swap(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter integers : \").split()]\n", - "a, b=swap(a, b)\n", - "print \"On swapping :\", a, b\n", - "c, d=[float(x) for x in raw_input(\"Enter floats : \").split()]\n", - "c, d=swap(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two Characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter integers : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-gswap.cpp, Page no-67" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=raw_input(\"Enter two Characters : \").split()\n", - "ch1, ch2=swap(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter integers : \").split()]\n", - "a, b=swap(a, b)\n", - "print \"On swapping :\", a, b\n", - "c, d=[float(x) for x in raw_input(\"Enter floats : \").split()]\n", - "c, d=swap(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two Characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter integers : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector.cpp, Page no-72" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def AddVectors(a, b, c, size):\n", - " for i in range(size):\n", - " c[i]=a[i]+b[i]\n", - "def ReadVector(vector, size):\n", - " for i in range(size):\n", - " vector[i]=int(raw_input())\n", - "def ShowVector(vector, size):\n", - " for i in range(size):\n", - " print vector[i],\n", - "vec_size=int(raw_input(\"Enter size of vector: \"))\n", - "x=[int]*vec_size\n", - "y=[int]*vec_size\n", - "z=[int]*vec_size\n", - "print \"Enter Elements of vector x: \"\n", - "ReadVector(x, vec_size)\n", - "print \"Enter Elements of vector y: \"\n", - "ReadVector(y, vec_size)\n", - "AddVectors(x, y, z, vec_size)\n", - "print \"Summation Vector z=a+b:\",\n", - "ShowVector(z, vec_size)\n", - "del x\n", - "del y\n", - "del z" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter size of vector: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Elements of vector x: \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Elements of vector y: \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Summation Vector z=a+b: 3 5 4 4 9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page no-73" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def area(s1, s2=None):#function overloading and default parameters\n", - " if (isinstance(s1, int)):\n", - " if(isinstance(s2, int)):\n", - " return (s1*s2)\n", - " else:\n", - " return (s1*s1)\n", - " elif (isinstance(s1, float)):\n", - " return (3.14*s1*s1)\n", - "s=int(raw_input(\"Enter the side length of the square: \"))\n", - "l, b=[int(x) for x in raw_input(\"Enter the length and breadth of the rectangle: \").split()]\n", - "r=float(raw_input(\"Enter the radius of the circle: \"))\n", - "print \"Area of square = \", area(s)\n", - "print \"Area of rectangle = \", area(l, b)\n", - "print \"Area of circle = \", area(r)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the side length of the square: 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the length and breadth of the rectangle: 2 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the radius of the circle: 2.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Area of square = 4\n", - "Area of rectangle = 8\n", - "Area of circle = 19.625\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance.ipynb deleted file mode 100755 index d81ed22a..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance.ipynb +++ /dev/null @@ -1,629 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:d0ea461766152305a5e3562b0029be55e226b9445d5b8707016af6bf55ff7b00" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 3- C++ at a Glance" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- counter1.cpp, Page no-77" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Counter:\n", - " __value=int\n", - " def __init__(self, val=None):#constructor\n", - " if(isinstance(val, int)):\n", - " self.__value=val\n", - " else:\n", - " self.__value=0\n", - " def __del__(self):#destructor\n", - " print \"object destroyed\"\n", - " def GetCounter(self):\n", - " return self.__value\n", - " def up(self):\n", - " self.__value=self.__value+1\n", - "counter1=Counter()\n", - "counter2=Counter(1)\n", - "print \"counter1 = \", counter1.GetCounter()\n", - "print \"counter2 = \", counter2.GetCounter()\n", - "counter1.up()\n", - "counter2.up()\n", - "print \"counter1 = \", counter1.GetCounter()\n", - "print \"counter2 = \", counter2.GetCounter()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "object destroyed\n", - "object destroyed\n", - "counter1 = 0\n", - "counter2 = 1\n", - "counter1 = 1\n", - "counter2 = 2\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-Stdclass.cpp, Page no-80" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def setdata(self, roll_no_in, name_in): #outside declaration of member functions\n", - " self._student__roll_no=roll_no_in\n", - " self._student__name=name_in\n", - "def outdata(self):#outside declaration of member functions\n", - " print \"Roll no = \", self._student__roll_no\n", - " print \"Name = \", self._student__name\n", - "class student:\n", - " __roll_no=int\n", - " __name=[None]*20\n", - " setdata=setdata\n", - " outdata=outdata\n", - "s1=student()\n", - "s2=student()\n", - "s1.setdata(1, \"Tejaswi\")\n", - "s2.setdata(10, \"Rajkumar\")\n", - "print \"Student details...\"\n", - "s1.outdata()\n", - "s2.outdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student details...\n", - "Roll no = 1\n", - "Name = Tejaswi\n", - "Roll no = 10\n", - "Name = Rajkumar\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-Counter2.cpp, Page no-82" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class counter:\n", - " __value=int\n", - " def __init__(self, val=0):\n", - " self.__value=val\n", - " def GetCounter(self):\n", - " return self.__value\n", - " def up(self):\n", - " self.__value+=1\n", - "class NewCounter(counter): #inheritance\n", - " def __init__(self, val=None) : \n", - " if(isinstance(val, int)):\n", - " counter.__init__(self, val)\n", - " else:\n", - " counter.__init__(self)\n", - " def down(self):\n", - " self._counter__value=self._counter__value-1\n", - "counter1=NewCounter()\n", - "counter2=NewCounter(1)\n", - "print \"counter1 initially =\", counter1.GetCounter()\n", - "print \"counter2 initially =\", counter2.GetCounter()\n", - "counter1.up()\n", - "counter2.up()\n", - "print \"counter1 on increment =\", counter1.GetCounter()\n", - "print \"counter2 on increment =\", counter2.GetCounter()\n", - "counter1.down()\n", - "counter2.down()\n", - "print \"counter1 on decrement =\", counter1.GetCounter()\n", - "print \"counter2 on decrement =\", counter2.GetCounter()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "counter1 initially = 0\n", - "counter2 initially = 1\n", - "counter1 on increment = 1\n", - "counter2 on increment = 2\n", - "counter1 on decrement = 0\n", - "counter2 on decrement = 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-counter3.cpp, Page no-85" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class counter:\n", - " __value=int\n", - " def __init__(self, val=0):\n", - " self.__value=val\n", - " def GetCounter(self):\n", - " return self.__value\n", - " #overloading increment operator\n", - " def __iadd__(self, val):\n", - " self.__value+=val\n", - " return self\n", - " #overloading decrement operator\n", - " def __isub__(self, val):\n", - " self._counter__value-=val\n", - " return self\n", - "counter1=counter()\n", - "counter2=counter(1)\n", - "print \"counter1 initially =\", counter1.GetCounter()\n", - "print \"counter2 initially =\", counter2.GetCounter()\n", - "counter1+=1\n", - "counter2+=1\n", - "print \"counter1 on increment =\", counter1.GetCounter()\n", - "print \"counter2 on increment =\", counter2.GetCounter()\n", - "counter1-=1\n", - "counter2-=1\n", - "print \"counter1 on decrement =\", counter1.GetCounter()\n", - "print \"counter2 on decrement =\", counter2.GetCounter()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "counter1 initially = 0\n", - "counter2 initially = 1\n", - "counter1 on increment = 1\n", - "counter2 on increment = 2\n", - "counter1 on decrement = 0\n", - "counter2 on decrement = 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-counter4.cpp, Page no-88" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class counter:\n", - " __value=int\n", - " def __init__(self, val=0):\n", - " self.__value=val\n", - " def GetCounter(self):\n", - " return self.__value\n", - " def __iadd__(self, val):\n", - " self.__value+=val\n", - " return self\n", - " def __isub__(self, val):\n", - " self._counter__value-=val\n", - " return self\n", - " #overloading of + operator\n", - " def __add__(self, counter2):\n", - " temp=counter()\n", - " temp.__value=self.__value+counter2.__value\n", - " return temp\n", - " #No overloading of << and >> operators in python\n", - " def output(self):\n", - " return self.__value\n", - "counter1=counter()\n", - "counter2=counter(1)\n", - "print \"counter1 initially =\", counter1.GetCounter()\n", - "print \"counter2 initially =\", counter2.GetCounter()\n", - "counter1+=1\n", - "counter2+=1\n", - "print \"counter1 on increment =\", counter1.GetCounter()\n", - "print \"counter2 on increment =\", counter2.GetCounter()\n", - "counter1-=1\n", - "counter2-=1\n", - "print \"counter1 on decrement =\", counter1.GetCounter()\n", - "print \"counter2 on decrement =\", counter2.GetCounter()\n", - "counter3=counter()\n", - "counter3=counter1+counter2\n", - "print \"counter3 = counter1+counter2 =\", counter3.output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "counter1 initially = 0\n", - "counter2 initially = 1\n", - "counter1 on increment = 1\n", - "counter2 on increment = 2\n", - "counter1 on decrement = 0\n", - "counter2 on decrement = 1\n", - "counter3 = counter1+counter2 = 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-virtual.cpp, Page no-91" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Father:\n", - " __f_age=int\n", - " def __init__(self, n):\n", - " self.__f_age=n\n", - " def GetAge(self):\n", - " return self.__f_age\n", - "class Son(Father):\n", - " __s_age=int\n", - " def __init__(self, n, m):\n", - " Father.__init__(self, n)\n", - " self.__s_age=m\n", - " def GetAge(self):\n", - " return self.__s_age\n", - "basep=[Father]\n", - "basep=Father(45)\n", - "print \"Father's Age:\",\n", - "print basep.GetAge()\n", - "del basep\n", - "basep=[Son(45, 20)]\n", - "print \"Son's Age:\",\n", - "print basep[0].GetAge()\n", - "del basep" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Father's Age: 45\n", - "Son's Age: 20\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector.cpp, Page no-94" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class vector:\n", - " __size=int\n", - " def __init__(self, vector_size):\n", - " self.__size=vector_size\n", - " self.__v=[vector]*self.__size\n", - " def __del__(self):\n", - " del self.__v\n", - " def elem(self, i, x=None):\n", - " if isinstance(x, int) or isinstance(x, float):\n", - " if i>=self.__size:\n", - " print \"Error: Out of Range\"\n", - " return\n", - " self.__v[i]=x\n", - " else:\n", - " return self.__v[i]\n", - " def show(self):\n", - " for i in range(self.__size):\n", - " print self.elem(i), \",\",\n", - "int_vect=vector(5)\n", - "float_vect=vector(4)\n", - "for i in range(5):\n", - " int_vect.elem(i, i+1)\n", - "for i in range(4):\n", - " float_vect.elem(i,i+1.5)\n", - "print \"Integer Vector:\",\n", - "int_vect.show()\n", - "print \"\\nFloating Vector:\",\n", - "float_vect.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Integer Vector: 1 , 2 , 3 , 4 , 5 , \n", - "Floating Vector: 1.5 , 2.5 , 3.5 , 4.5 ,\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-number.cpp, Page no-97" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class number:\n", - " __num=int\n", - " def read(self):\n", - " self.__num=int(raw_input())\n", - " class DIVIDE():\n", - " pass\n", - " def div(self, num2):\n", - " if num2.__num==0:\n", - " raise self.DIVIDE() #raise exception of type DIVIDE()\n", - " else:\n", - " return self.__num/num2.__num\n", - "num1=number()\n", - "num2=number()\n", - "print \"Enter Number 1: \",\n", - "num1.read()\n", - "print \"Enter Number 2: \",\n", - "num2.read()\n", - "try:\n", - " print \"trying division operation...\",\n", - " result=num1.div(num2)\n", - " print \"succeeded\"\n", - "except number.DIVIDE: #exception handler of exception type DIVIDE()\n", - " print \"failed\"\n", - " print \"Exception: Divide-By-Zero\"\n", - "else: #this block is executed only if no exception has been raised\n", - " print \"num1/num2 =\", result" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Number 1: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Number 2: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " trying division operation... failed\n", - "Exception: Divide-By-Zero\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-infile.cpp, Page no-101" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "try:\n", - " infile=open(\"sample.in\", \"r\") #open file in input mode\n", - " while(1):\n", - " buff=infile.readline() #read a single line from the file\n", - " if buff=='': #to determine end of file\n", - " break\n", - " print buff,\n", - "except IOError: #error in opening file\n", - " print \"Error: sample.in non-existent\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rajkumar, C-DAC, India\n", - "Bjarne Stroustrup, AT & T, USA\n", - "Smrithi, Hyderabad, India\n", - "Tejaswi, Hyderabad, India\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-outfile.cpp, Page no-102" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "outfile=open(\"sample.out\", \"w\") #file opened in output mode\n", - "if not(outfile):\n", - " print \"Error: sample.out unable to open\"\n", - "else:\n", - " while(1):\n", - " buff=raw_input()\n", - " if buff==\"end\":\n", - " break\n", - " outfile.write(buff)\n", - " outfile.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "OOP is good\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "C++ is OOP\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "C++ is good\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "end\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example, Page no-103" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "count=0\n", - "file1=open(\"FILE1.txt\", \"r\") #file opened in input mode\n", - "file2=open(\"FILE2.txt\", \"w\") #file opened in output mode\n", - "while(1):\n", - " ch=file1.read(1)\n", - " if ch=='': #detecting eof\n", - " break\n", - " if count%2==0:\n", - " file2.write(ch)\n", - " count+=1\n", - "print \"Alternate characters from File1 have been successfully copied into File2\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Alternate characters from File1 have been successfully copied into File2\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance_1.ipynb deleted file mode 100755 index d81ed22a..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter3-C++AtAGlance_1.ipynb +++ /dev/null @@ -1,629 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:d0ea461766152305a5e3562b0029be55e226b9445d5b8707016af6bf55ff7b00" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 3- C++ at a Glance" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- counter1.cpp, Page no-77" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Counter:\n", - " __value=int\n", - " def __init__(self, val=None):#constructor\n", - " if(isinstance(val, int)):\n", - " self.__value=val\n", - " else:\n", - " self.__value=0\n", - " def __del__(self):#destructor\n", - " print \"object destroyed\"\n", - " def GetCounter(self):\n", - " return self.__value\n", - " def up(self):\n", - " self.__value=self.__value+1\n", - "counter1=Counter()\n", - "counter2=Counter(1)\n", - "print \"counter1 = \", counter1.GetCounter()\n", - "print \"counter2 = \", counter2.GetCounter()\n", - "counter1.up()\n", - "counter2.up()\n", - "print \"counter1 = \", counter1.GetCounter()\n", - "print \"counter2 = \", counter2.GetCounter()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "object destroyed\n", - "object destroyed\n", - "counter1 = 0\n", - "counter2 = 1\n", - "counter1 = 1\n", - "counter2 = 2\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-Stdclass.cpp, Page no-80" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def setdata(self, roll_no_in, name_in): #outside declaration of member functions\n", - " self._student__roll_no=roll_no_in\n", - " self._student__name=name_in\n", - "def outdata(self):#outside declaration of member functions\n", - " print \"Roll no = \", self._student__roll_no\n", - " print \"Name = \", self._student__name\n", - "class student:\n", - " __roll_no=int\n", - " __name=[None]*20\n", - " setdata=setdata\n", - " outdata=outdata\n", - "s1=student()\n", - "s2=student()\n", - "s1.setdata(1, \"Tejaswi\")\n", - "s2.setdata(10, \"Rajkumar\")\n", - "print \"Student details...\"\n", - "s1.outdata()\n", - "s2.outdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student details...\n", - "Roll no = 1\n", - "Name = Tejaswi\n", - "Roll no = 10\n", - "Name = Rajkumar\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-Counter2.cpp, Page no-82" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class counter:\n", - " __value=int\n", - " def __init__(self, val=0):\n", - " self.__value=val\n", - " def GetCounter(self):\n", - " return self.__value\n", - " def up(self):\n", - " self.__value+=1\n", - "class NewCounter(counter): #inheritance\n", - " def __init__(self, val=None) : \n", - " if(isinstance(val, int)):\n", - " counter.__init__(self, val)\n", - " else:\n", - " counter.__init__(self)\n", - " def down(self):\n", - " self._counter__value=self._counter__value-1\n", - "counter1=NewCounter()\n", - "counter2=NewCounter(1)\n", - "print \"counter1 initially =\", counter1.GetCounter()\n", - "print \"counter2 initially =\", counter2.GetCounter()\n", - "counter1.up()\n", - "counter2.up()\n", - "print \"counter1 on increment =\", counter1.GetCounter()\n", - "print \"counter2 on increment =\", counter2.GetCounter()\n", - "counter1.down()\n", - "counter2.down()\n", - "print \"counter1 on decrement =\", counter1.GetCounter()\n", - "print \"counter2 on decrement =\", counter2.GetCounter()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "counter1 initially = 0\n", - "counter2 initially = 1\n", - "counter1 on increment = 1\n", - "counter2 on increment = 2\n", - "counter1 on decrement = 0\n", - "counter2 on decrement = 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-counter3.cpp, Page no-85" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class counter:\n", - " __value=int\n", - " def __init__(self, val=0):\n", - " self.__value=val\n", - " def GetCounter(self):\n", - " return self.__value\n", - " #overloading increment operator\n", - " def __iadd__(self, val):\n", - " self.__value+=val\n", - " return self\n", - " #overloading decrement operator\n", - " def __isub__(self, val):\n", - " self._counter__value-=val\n", - " return self\n", - "counter1=counter()\n", - "counter2=counter(1)\n", - "print \"counter1 initially =\", counter1.GetCounter()\n", - "print \"counter2 initially =\", counter2.GetCounter()\n", - "counter1+=1\n", - "counter2+=1\n", - "print \"counter1 on increment =\", counter1.GetCounter()\n", - "print \"counter2 on increment =\", counter2.GetCounter()\n", - "counter1-=1\n", - "counter2-=1\n", - "print \"counter1 on decrement =\", counter1.GetCounter()\n", - "print \"counter2 on decrement =\", counter2.GetCounter()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "counter1 initially = 0\n", - "counter2 initially = 1\n", - "counter1 on increment = 1\n", - "counter2 on increment = 2\n", - "counter1 on decrement = 0\n", - "counter2 on decrement = 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-counter4.cpp, Page no-88" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class counter:\n", - " __value=int\n", - " def __init__(self, val=0):\n", - " self.__value=val\n", - " def GetCounter(self):\n", - " return self.__value\n", - " def __iadd__(self, val):\n", - " self.__value+=val\n", - " return self\n", - " def __isub__(self, val):\n", - " self._counter__value-=val\n", - " return self\n", - " #overloading of + operator\n", - " def __add__(self, counter2):\n", - " temp=counter()\n", - " temp.__value=self.__value+counter2.__value\n", - " return temp\n", - " #No overloading of << and >> operators in python\n", - " def output(self):\n", - " return self.__value\n", - "counter1=counter()\n", - "counter2=counter(1)\n", - "print \"counter1 initially =\", counter1.GetCounter()\n", - "print \"counter2 initially =\", counter2.GetCounter()\n", - "counter1+=1\n", - "counter2+=1\n", - "print \"counter1 on increment =\", counter1.GetCounter()\n", - "print \"counter2 on increment =\", counter2.GetCounter()\n", - "counter1-=1\n", - "counter2-=1\n", - "print \"counter1 on decrement =\", counter1.GetCounter()\n", - "print \"counter2 on decrement =\", counter2.GetCounter()\n", - "counter3=counter()\n", - "counter3=counter1+counter2\n", - "print \"counter3 = counter1+counter2 =\", counter3.output()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "counter1 initially = 0\n", - "counter2 initially = 1\n", - "counter1 on increment = 1\n", - "counter2 on increment = 2\n", - "counter1 on decrement = 0\n", - "counter2 on decrement = 1\n", - "counter3 = counter1+counter2 = 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-virtual.cpp, Page no-91" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Father:\n", - " __f_age=int\n", - " def __init__(self, n):\n", - " self.__f_age=n\n", - " def GetAge(self):\n", - " return self.__f_age\n", - "class Son(Father):\n", - " __s_age=int\n", - " def __init__(self, n, m):\n", - " Father.__init__(self, n)\n", - " self.__s_age=m\n", - " def GetAge(self):\n", - " return self.__s_age\n", - "basep=[Father]\n", - "basep=Father(45)\n", - "print \"Father's Age:\",\n", - "print basep.GetAge()\n", - "del basep\n", - "basep=[Son(45, 20)]\n", - "print \"Son's Age:\",\n", - "print basep[0].GetAge()\n", - "del basep" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Father's Age: 45\n", - "Son's Age: 20\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector.cpp, Page no-94" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class vector:\n", - " __size=int\n", - " def __init__(self, vector_size):\n", - " self.__size=vector_size\n", - " self.__v=[vector]*self.__size\n", - " def __del__(self):\n", - " del self.__v\n", - " def elem(self, i, x=None):\n", - " if isinstance(x, int) or isinstance(x, float):\n", - " if i>=self.__size:\n", - " print \"Error: Out of Range\"\n", - " return\n", - " self.__v[i]=x\n", - " else:\n", - " return self.__v[i]\n", - " def show(self):\n", - " for i in range(self.__size):\n", - " print self.elem(i), \",\",\n", - "int_vect=vector(5)\n", - "float_vect=vector(4)\n", - "for i in range(5):\n", - " int_vect.elem(i, i+1)\n", - "for i in range(4):\n", - " float_vect.elem(i,i+1.5)\n", - "print \"Integer Vector:\",\n", - "int_vect.show()\n", - "print \"\\nFloating Vector:\",\n", - "float_vect.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Integer Vector: 1 , 2 , 3 , 4 , 5 , \n", - "Floating Vector: 1.5 , 2.5 , 3.5 , 4.5 ,\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-number.cpp, Page no-97" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class number:\n", - " __num=int\n", - " def read(self):\n", - " self.__num=int(raw_input())\n", - " class DIVIDE():\n", - " pass\n", - " def div(self, num2):\n", - " if num2.__num==0:\n", - " raise self.DIVIDE() #raise exception of type DIVIDE()\n", - " else:\n", - " return self.__num/num2.__num\n", - "num1=number()\n", - "num2=number()\n", - "print \"Enter Number 1: \",\n", - "num1.read()\n", - "print \"Enter Number 2: \",\n", - "num2.read()\n", - "try:\n", - " print \"trying division operation...\",\n", - " result=num1.div(num2)\n", - " print \"succeeded\"\n", - "except number.DIVIDE: #exception handler of exception type DIVIDE()\n", - " print \"failed\"\n", - " print \"Exception: Divide-By-Zero\"\n", - "else: #this block is executed only if no exception has been raised\n", - " print \"num1/num2 =\", result" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Number 1: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Number 2: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " trying division operation... failed\n", - "Exception: Divide-By-Zero\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-infile.cpp, Page no-101" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "try:\n", - " infile=open(\"sample.in\", \"r\") #open file in input mode\n", - " while(1):\n", - " buff=infile.readline() #read a single line from the file\n", - " if buff=='': #to determine end of file\n", - " break\n", - " print buff,\n", - "except IOError: #error in opening file\n", - " print \"Error: sample.in non-existent\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Rajkumar, C-DAC, India\n", - "Bjarne Stroustrup, AT & T, USA\n", - "Smrithi, Hyderabad, India\n", - "Tejaswi, Hyderabad, India\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-outfile.cpp, Page no-102" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "outfile=open(\"sample.out\", \"w\") #file opened in output mode\n", - "if not(outfile):\n", - " print \"Error: sample.out unable to open\"\n", - "else:\n", - " while(1):\n", - " buff=raw_input()\n", - " if buff==\"end\":\n", - " break\n", - " outfile.write(buff)\n", - " outfile.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "OOP is good\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "C++ is OOP\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "C++ is good\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "end\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example, Page no-103" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "count=0\n", - "file1=open(\"FILE1.txt\", \"r\") #file opened in input mode\n", - "file2=open(\"FILE2.txt\", \"w\") #file opened in output mode\n", - "while(1):\n", - " ch=file1.read(1)\n", - " if ch=='': #detecting eof\n", - " break\n", - " if count%2==0:\n", - " file2.write(ch)\n", - " count+=1\n", - "print \"Alternate characters from File1 have been successfully copied into File2\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Alternate characters from File1 have been successfully copied into File2\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions.ipynb deleted file mode 100755 index 1b95ba16..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions.ipynb +++ /dev/null @@ -1,881 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:17ba214af5fef45344b6cf20acb6a7b4a88d1bf393c6e0c1c50e04f764bab0ff" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 4- Data types, Operators and Expressions" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-show1.cpp, Page no-111" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=int\n", - "b=int\n", - "c=100\n", - "distance=float\n", - "a=c\n", - "b=c+100\n", - "distance=55.9\n", - "print \"a =\", a\n", - "print \"b =\", b\n", - "print \"c =\", c\n", - "print \"distance =\", distance" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "a = 100\n", - "b = 200\n", - "c = 100\n", - "distance = 55.9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ascii.cpp, Page no-112" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "code=int(raw_input(\"Enter an ASCII code(0-127): \"))\n", - "symbol=code\n", - "print \"The symbol corresponding to %d is %c\" %(code, symbol)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter an ASCII code(0-127): 65\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The symbol corresponding to 65 is A\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-temper.cpp, Page no-115" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "c=float(raw_input(\"Enter temperature in Celsius: \"))\n", - "f=1.8*c+32\n", - "print \"Equivalent fahrenheit = \", f\n", - "f=float(raw_input(\"Enter temperature in fahrenheit: \"))\n", - "c=(f-32)/1.8\n", - "print \"Equivalent Celsius = \", c" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter temperature in Celsius: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Equivalent fahrenheit = 41.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter temperature in fahrenheit: 40\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Equivalent Celsius = 4.44444444444\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-size.cpp, Page no-116" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "print \"sizeof( char ) =\", sizeof(c_char)\n", - "print \"sizeof( short ) =\", sizeof(c_short)\n", - "print \"sizeof( short int ) =\", sizeof(c_short)\n", - "print \"sizeof( int ) =\", sizeof(c_int)\n", - "print \"sizeof( long ) =\", sizeof(c_long)\n", - "print \"sizeof( long int ) =\", sizeof(c_long)\n", - "print \"sizeof( float ) =\", sizeof(c_float)\n", - "print \"sizeof( double ) =\", sizeof(c_double)\n", - "print \"sizeof( long double ) =\", sizeof(c_longdouble)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sizeof( char ) = 1\n", - "sizeof( short ) = 2\n", - "sizeof( short int ) = 2\n", - "sizeof( int ) = 4\n", - "sizeof( long ) = 4\n", - "sizeof( long int ) = 4\n", - "sizeof( float ) = 4\n", - "sizeof( double ) = 8\n", - "sizeof( long double ) = 8\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-modules.cpp, Page no-120" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "numerator=int(raw_input(\"Enter numerator: \"))\n", - "denominator=int(raw_input(\"Enter denominator: \"))\n", - "result=numerator/denominator\n", - "remainder=numerator%denominator\n", - "print numerator, \"/\", denominator, \"=\", result\n", - "print numerator, \"%\", denominator, \"=\", remainder" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter numerator: 12\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter denominator: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "12 / 5 = 2\n", - "12 % 5 = 2\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-notemp.cpp, Page no-121" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()] #taking input in single line sperated by white space\n", - "a=a+b\n", - "b=a-b\n", - "a=a-b\n", - "print \"Value of a and b on swapping in main():\", a, b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of a and b on swapping in main(): 20 10\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-relation.cpp, Page no-122" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "my_age=int(raw_input(\"Enter my age: \"))\n", - "your_age=int(raw_input(\"Enter your age: \"))\n", - "if(my_age==your_age):\n", - " print \"We are born in the same year.\"\n", - "else:\n", - " print \"We are born in different years\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter my age: 25\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age: 25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "We are born in the same year.\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-char1.cpp, Page no-123" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "c=c_byte(255) #signed char\n", - "d=c_byte(-1) #signed char\n", - "if c.value<0:\n", - " print 'c is less than 0'\n", - "else:\n", - " print 'c is not less than 0'\n", - "if d.value<0:\n", - " print 'd is less than 0'\n", - "else:\n", - " print 'd is not less than 0'\n", - "if c.value==d.value:\n", - " print 'c and d are equal'\n", - "else:\n", - " print 'c and d are not equal'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c is less than 0\n", - "d is less than 0\n", - "c and d are equal\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-char2.cpp, Page no-124" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "c=c_ubyte(255) #unsigned char\n", - "d=c_byte(-1) #signed char\n", - "if c.value<0:\n", - " print 'c is less than 0'\n", - "else:\n", - " print 'c is not less than 0'\n", - "if d.value<0:\n", - " print 'd is less than 0'\n", - "else:\n", - " print 'd is not less than 0'\n", - "if c.value==d.value:\n", - " print 'c and d are equal'\n", - "else:\n", - " print 'c and d are not equal'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c is not less than 0\n", - "d is less than 0\n", - "c and d are not equal\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-leap.cpp, Page no-126" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "year=int(raw_input(\"Enter any year: \"))\n", - "if( (year%4==0 and year%100!=0) or (year%400==0)):\n", - " print year, \"is a leap year\"\n", - "else:\n", - " print year, \"is not a leap year\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any year: 1996\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1996 is a leap year\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-large.cpp, Page no-127" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "u=c_uint(0) #unsigned integer\n", - "print 'Value before conversion:', u.value\n", - "u.value=~int(u.value) # 1's complement\n", - "print 'Value after conversion:', u.value" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value before conversion: 0\n", - "Value after conversion: 4294967295\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-extract.cpp, Page no-130" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=int(raw_input(\"Enter an integer: \"))\n", - "n=int(raw_input(\"Enter bit position to extract: \"))\n", - "bit=(a>>(n-1))&1 #shift operator\n", - "print \"The bit is \", bit" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter an integer: 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter bit position to extract: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The bit is 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-max.cpp, Page no-133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a, b=[int(x) for x in raw_input(\"Enter two integers: \").split()]\n", - "larger=a if a>b else b #?: operator\n", - "print \"The larger of the two is\", larger" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers: 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The larger of the two is 20\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-oddeven.cpp, Page no-133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num=int(raw_input(\"Enter the number: \"))\n", - "print \"The number\", num,\"is\",\n", - "print \"Even\" if num%2==0 else \"Odd\" #?: operator\n", - "num=int(raw_input(\"Enter the number: \"))\n", - "print \"The number\", num,\"is\",\n", - "print \"Even\" if num%2==0 else \"Odd\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The number 10 is Even\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number: 25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The number 25 is Odd\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-coerce.cpp, Page no-136" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "f=float\n", - "i=12\n", - "j=5\n", - "print \"when i = \", i, \"j = \", j\n", - "f=i/j\n", - "print \"i/j = \", f\n", - "f=float(i)/float(j)\n", - "print \"(float)i/j = \", f\n", - "f=float(i)/j\n", - "print \"float(i)/j = \", f\n", - "f=i/float(j)\n", - "print \"i/float(j) = \", f" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when i = 12 j = 5\n", - "i/j = 2\n", - "(float)i/j = 2.4\n", - "float(i)/j = 2.4\n", - "i/float(j) = 2.4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-city.cpp, Page no-141" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "CITY='Bidar'\n", - "def which_city():\n", - " print 'City in Function:',\n", - " print CITY\n", - "print 'Earlier City:',\n", - "print CITY\n", - "CITY='Bangalore'\n", - "print 'New City:',\n", - "print CITY\n", - "which_city()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Earlier City: Bidar\n", - "New City: Bangalore\n", - "City in Function: Bangalore\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-color1.cpp, Page no-143" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def PrintColor(c):\n", - " (red, blue, green)=(0, 1, 2) #enum\n", - " type =['red', 'green', 'blue']\n", - " if c==red:\n", - " color='red'\n", - " elif c==blue:\n", - " color='blue'\n", - " else:\n", - " color ='green'\n", - " print 'Your color choice as per color2.cpp module:', color\n", - "(red, green, blue)=(0, 1, 2) #enum\n", - "type =['red', 'green', 'blue']\n", - "print 'Your color choice in color1.cpp module: green'\n", - "PrintColor(green)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Your color choice in color1.cpp module: green\n", - "Your color choice as per color2.cpp module: blue\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-maxmacro.cpp, Page no-146" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(a, b):\n", - " return a if a>b else b\n", - "print 'max(2, 3) =', Max(2, 3)\n", - "print 'max(10.2, 4.5) =', Max(10.2, 4.5)\n", - "i=5\n", - "j=10\n", - "print 'i =',i\n", - "print 'j =', j\n", - "print 'On execution of k=max(++i, ++j);...'\n", - "i+=1\n", - "j+=1\n", - "k=Max(i+1, j+1)\n", - "print 'i =', i\n", - "print 'j =', j #the operand is j+1 and not ++j and thus the change is not reflected back in j. \n", - "print 'k =', k #operand of type j+=1 is not allowed" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max(2, 3) = 3\n", - "max(10.2, 4.5) = 10.2\n", - "i = 5\n", - "j = 10\n", - "On execution of k=max(++i, ++j);...\n", - "i = 6\n", - "j = 11\n", - "k = 12\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-exp.cpp, Page no-148" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=30\n", - "b=20\n", - "c=11\n", - "result=a+b/(c-1)+a%b #--c is replaced by (c-1)\n", - "print 'a+b/--c+a%b =', result" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "a+b/--c+a%b = 42\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page no-150" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num1=int(raw_input(\"Enter the first number: \"))\n", - "num2=int(raw_input(\"Enter the second number: \"))\n", - "print num1, '+', num2, '=',num1+num2\n", - "print num1, '-', num2, '=',num1-num2\n", - "print num1, '*', num2, '=',num1*num2\n", - "print num1, '/', num2, '=',num1/num2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the first number: 20\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the second number: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "20 + 10 = 30\n", - "20 - 10 = 10\n", - "20 * 10 = 200\n", - "20 / 10 = 2\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions_1.ipynb deleted file mode 100755 index 93c9b655..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter4-DataTypes,OperatorsAndExpressions_1.ipynb +++ /dev/null @@ -1,881 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:63e795ffbce627302c76300f958b5cdb253e4cb2bacdd4c0ef63693b73e9f98e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 4- Data types, Operators and Expressions" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-show1.cpp, Page no-111" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=int\n", - "b=int\n", - "c=100\n", - "distance=float\n", - "a=c\n", - "b=c+100\n", - "distance=55.9\n", - "print \"a =\", a\n", - "print \"b =\", b\n", - "print \"c =\", c\n", - "print \"distance =\", distance" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "a = 100\n", - "b = 200\n", - "c = 100\n", - "distance = 55.9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ascii.cpp, Page no-112" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "code=int(raw_input(\"Enter an ASCII code(0-127): \"))\n", - "symbol=code\n", - "print \"The symbol corresponding to %d is %c\" %(code, symbol)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter an ASCII code(0-127): 65\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The symbol corresponding to 65 is A\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-temper.cpp, Page no-115" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "c=float(raw_input(\"Enter temperature in Celsius: \"))\n", - "f=1.8*c+32\n", - "print \"Equivalent fahrenheit = \", f\n", - "f=float(raw_input(\"Enter temperature in fahrenheit: \"))\n", - "c=(f-32)/1.8\n", - "print \"Equivalent Celsius = \", c" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter temperature in Celsius: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Equivalent fahrenheit = 41.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter temperature in fahrenheit: 40\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Equivalent Celsius = 4.44444444444\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-size.cpp, Page no-116" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import c_char, c_short, c_int, c_long, c_float, c_double, c_longdouble, sizeof\n", - "print \"sizeof( char ) =\", sizeof(c_char)\n", - "print \"sizeof( short ) =\", sizeof(c_short)\n", - "print \"sizeof( short int ) =\", sizeof(c_short)\n", - "print \"sizeof( int ) =\", sizeof(c_int)\n", - "print \"sizeof( long ) =\", sizeof(c_long)\n", - "print \"sizeof( long int ) =\", sizeof(c_long)\n", - "print \"sizeof( float ) =\", sizeof(c_float)\n", - "print \"sizeof( double ) =\", sizeof(c_double)\n", - "print \"sizeof( long double ) =\", sizeof(c_longdouble)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sizeof( char ) = 1\n", - "sizeof( short ) = 2\n", - "sizeof( short int ) = 2\n", - "sizeof( int ) = 4\n", - "sizeof( long ) = 4\n", - "sizeof( long int ) = 4\n", - "sizeof( float ) = 4\n", - "sizeof( double ) = 8\n", - "sizeof( long double ) = 8\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-modules.cpp, Page no-120" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "numerator=int(raw_input(\"Enter numerator: \"))\n", - "denominator=int(raw_input(\"Enter denominator: \"))\n", - "result=numerator/denominator\n", - "remainder=numerator%denominator\n", - "print numerator, \"/\", denominator, \"=\", result\n", - "print numerator, \"%\", denominator, \"=\", remainder" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter numerator: 12\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter denominator: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "12 / 5 = 2\n", - "12 % 5 = 2\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-notemp.cpp, Page no-121" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()] #taking input in single line sperated by white space\n", - "a=a+b\n", - "b=a-b\n", - "a=a-b\n", - "print \"Value of a and b on swapping in main():\", a, b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of a and b on swapping in main(): 20 10\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-relation.cpp, Page no-122" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "my_age=int(raw_input(\"Enter my age: \"))\n", - "your_age=int(raw_input(\"Enter your age: \"))\n", - "if(my_age==your_age):\n", - " print \"We are born in the same year.\"\n", - "else:\n", - " print \"We are born in different years\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter my age: 25\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age: 25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "We are born in the same year.\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-char1.cpp, Page no-123" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import c_byte\n", - "c=c_byte(255) #signed char\n", - "d=c_byte(-1) #signed char\n", - "if c.value<0:\n", - " print 'c is less than 0'\n", - "else:\n", - " print 'c is not less than 0'\n", - "if d.value<0:\n", - " print 'd is less than 0'\n", - "else:\n", - " print 'd is not less than 0'\n", - "if c.value==d.value:\n", - " print 'c and d are equal'\n", - "else:\n", - " print 'c and d are not equal'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c is less than 0\n", - "d is less than 0\n", - "c and d are equal\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-char2.cpp, Page no-124" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import c_ubyte, c_byte\n", - "c=c_ubyte(255) #unsigned char\n", - "d=c_byte(-1) #signed char\n", - "if c.value<0:\n", - " print 'c is less than 0'\n", - "else:\n", - " print 'c is not less than 0'\n", - "if d.value<0:\n", - " print 'd is less than 0'\n", - "else:\n", - " print 'd is not less than 0'\n", - "if c.value==d.value:\n", - " print 'c and d are equal'\n", - "else:\n", - " print 'c and d are not equal'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c is not less than 0\n", - "d is less than 0\n", - "c and d are not equal\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-leap.cpp, Page no-126" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "year=int(raw_input(\"Enter any year: \"))\n", - "if( (year%4==0 and year%100!=0) or (year%400==0)):\n", - " print year, \"is a leap year\"\n", - "else:\n", - " print year, \"is not a leap year\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any year: 1996\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1996 is a leap year\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-large.cpp, Page no-127" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import c_uint\n", - "u=c_uint(0) #unsigned integer\n", - "print 'Value before conversion:', u.value\n", - "u.value=~int(u.value) # 1's complement\n", - "print 'Value after conversion:', u.value" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value before conversion: 0\n", - "Value after conversion: 4294967295\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-extract.cpp, Page no-130" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=int(raw_input(\"Enter an integer: \"))\n", - "n=int(raw_input(\"Enter bit position to extract: \"))\n", - "bit=(a>>(n-1))&1 #shift operator\n", - "print \"The bit is \", bit" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter an integer: 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter bit position to extract: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The bit is 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-max.cpp, Page no-133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a, b=[int(x) for x in raw_input(\"Enter two integers: \").split()]\n", - "larger=a if a>b else b #?: operator\n", - "print \"The larger of the two is\", larger" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers: 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The larger of the two is 20\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-oddeven.cpp, Page no-133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num=int(raw_input(\"Enter the number: \"))\n", - "print \"The number\", num,\"is\",\n", - "print \"Even\" if num%2==0 else \"Odd\" #?: operator\n", - "num=int(raw_input(\"Enter the number: \"))\n", - "print \"The number\", num,\"is\",\n", - "print \"Even\" if num%2==0 else \"Odd\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The number 10 is Even\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number: 25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The number 25 is Odd\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-coerce.cpp, Page no-136" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "f=float\n", - "i=12\n", - "j=5\n", - "print \"when i = \", i, \"j = \", j\n", - "f=i/j\n", - "print \"i/j = \", f\n", - "f=float(i)/float(j)\n", - "print \"(float)i/j = \", f\n", - "f=float(i)/j\n", - "print \"float(i)/j = \", f\n", - "f=i/float(j)\n", - "print \"i/float(j) = \", f" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when i = 12 j = 5\n", - "i/j = 2\n", - "(float)i/j = 2.4\n", - "float(i)/j = 2.4\n", - "i/float(j) = 2.4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-city.cpp, Page no-141" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "CITY='Bidar'\n", - "def which_city():\n", - " print 'City in Function:',\n", - " print CITY\n", - "print 'Earlier City:',\n", - "print CITY\n", - "CITY='Bangalore'\n", - "print 'New City:',\n", - "print CITY\n", - "which_city()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Earlier City: Bidar\n", - "New City: Bangalore\n", - "City in Function: Bangalore\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-color1.cpp, Page no-143" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def PrintColor(c):\n", - " (red, blue, green)=(0, 1, 2) #enum\n", - " type =['red', 'green', 'blue']\n", - " if c==red:\n", - " color='red'\n", - " elif c==blue:\n", - " color='blue'\n", - " else:\n", - " color ='green'\n", - " print 'Your color choice as per color2.cpp module:', color\n", - "(red, green, blue)=(0, 1, 2) #enum\n", - "type =['red', 'green', 'blue']\n", - "print 'Your color choice in color1.cpp module: green'\n", - "PrintColor(green)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Your color choice in color1.cpp module: green\n", - "Your color choice as per color2.cpp module: blue\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-maxmacro.cpp, Page no-146" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(a, b):\n", - " return a if a>b else b\n", - "print 'max(2, 3) =', Max(2, 3)\n", - "print 'max(10.2, 4.5) =', Max(10.2, 4.5)\n", - "i=5\n", - "j=10\n", - "print 'i =',i\n", - "print 'j =', j\n", - "print 'On execution of k=max(++i, ++j);...'\n", - "i+=1\n", - "j+=1\n", - "k=Max(i+1, j+1)\n", - "print 'i =', i\n", - "print 'j =', j #the operand is j+1 and not ++j and thus the change is not reflected back in j. \n", - "print 'k =', k #operand of type j+=1 is not allowed" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max(2, 3) = 3\n", - "max(10.2, 4.5) = 10.2\n", - "i = 5\n", - "j = 10\n", - "On execution of k=max(++i, ++j);...\n", - "i = 6\n", - "j = 11\n", - "k = 12\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-exp.cpp, Page no-148" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=30\n", - "b=20\n", - "c=11\n", - "result=a+b/(c-1)+a%b #--c is replaced by (c-1)\n", - "print 'a+b/--c+a%b =', result" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "a+b/--c+a%b = 42\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page no-150" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "num1=int(raw_input(\"Enter the first number: \"))\n", - "num2=int(raw_input(\"Enter the second number: \"))\n", - "print num1, '+', num2, '=',num1+num2\n", - "print num1, '-', num2, '=',num1-num2\n", - "print num1, '*', num2, '=',num1*num2\n", - "print num1, '/', num2, '=',num1/num2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the first number: 20\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the second number: 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "20 + 10 = 30\n", - "20 - 10 = 10\n", - "20 * 10 = 200\n", - "20 / 10 = 2\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow.ipynb deleted file mode 100755 index 9efd46c9..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow.ipynb +++ /dev/null @@ -1,1280 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:6fa2540f90d9347d87cbc226c605764f3108594e5706b257d5d061ae951444a3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 5- Control Flow" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-age1.cpp, Page no-153" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=int(raw_input(\"Enter your age: \"))\n", - "if(age>12 and age<20):\n", - " print \"you are a teen-aged person. good!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age: 15\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "you are a teen-aged person. good!\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-age2.cpp, Page no-154" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=int(raw_input(\"Enter your age: \"))\n", - "if(age<0):\n", - " print \"I am sorry!\"\n", - " print \"age can never be negative\"\n", - "if(age>12 and age<20):\n", - " print \"you are a teen-aged person. good!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age: -10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "I am sorry!\n", - "age can never be negative\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-large.cpp, Page no-155" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "big=float\n", - "a, b, c=[float(x) for x in raw_input(\"Enter three floating-point numbers: \").split()] #taking input in single line separated by white space\n", - "big=a\n", - "if(b>big):\n", - " big=b\n", - "if(c>big):\n", - " big=c\n", - "print \"Largest of the three numbers =\", big" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter three floating-point numbers: 10.2 15.6 12.8\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Largest of the three numbers = 15.6\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-age3.cpp, Page no-156" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=int(raw_input(\"Enter your age: \"))\n", - "if(age>12 and age<20):\n", - " print \"you are a teen-aged person. good!\"\n", - "else:\n", - " print \"you are not a teen-aged person.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age: 15\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "you are a teen-aged person. good!\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-lived.cpp, Page no-157" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "years=float(raw_input(\"Enter your age in years: \"))\n", - "if(years<0):\n", - " print \"I am sorry! age can never be negative\"\n", - "else:\n", - " secs=years*365*24*60*60\n", - " print \"You have lived for %.4g seconds\" %(secs)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age in years: 25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "You have lived for 7.884e+08 seconds\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-age4.cpp, Page no-158" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=int(raw_input(\"Enter your age: \"))\n", - "if(age>12 and age<20):\n", - " print \"you are a teen-aged person. good!\"\n", - "else:\n", - " if(age<13):\n", - " print \"you will surely reach teen-age.\"\n", - " else:\n", - " print \"you have crossed teen-age!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age: 25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "you have crossed teen-age!\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-count1.cpp, Page no-159" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "n=int(raw_input(\"How many integers to be displayed: \"))\n", - "for i in range(n):\n", - " print i" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many integers to be displayed: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n", - "1\n", - "2\n", - "3\n", - "4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sumsq1.cpp, Page no-160" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Sum=0\n", - "sum_of_squares=0\n", - "for i in range(2, 31, 2):\n", - " Sum+=i\n", - " sum_of_squares+=i*i\n", - "print \"Sum of first 15 positive even numbers =\", Sum\n", - "print \"Sum of their squares =\", sum_of_squares" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of first 15 positive even numbers = 240\n", - "Sum of their squares = 4960\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sumsq2.cpp, Page no-161" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Sum=0\n", - "sum_of_squares=0\n", - "for i in range(30, 0, -2):\n", - " Sum+=i\n", - " sum_of_squares+=i*i\n", - "print \"Sum of first 15 positive even numbers =\", Sum\n", - "print \"Sum of their squares =\", sum_of_squares" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of first 15 positive even numbers = 240\n", - "Sum of their squares = 4960\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-noinit.cpp, Page no-162" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "i=1\n", - "for i in range(i, 11):\n", - " print i*5," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "5 10 15 20 25 30 35 40 45 50\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-pyramid.cpp, Page no-163" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "n=int(raw_input(\"Enter the number of lines: \"))\n", - "for p in range(1, n+1):\n", - " for q in range(1, n-p+1):\n", - " print \"\\t\",\n", - " m=p\n", - " for q in range (1, p+1):\n", - " print \"\\t\", m,\n", - " m+=1\n", - " m=m-2\n", - " for q in range(1, p):\n", - " print \"\\t\", m,\n", - " m-=1\n", - " print ''" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number of lines: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\t\t\t\t\t1 \n", - "\t\t\t\t2 \t3 \t2 \n", - "\t\t\t3 \t4 \t5 \t4 \t3 \n", - "\t\t4 \t5 \t6 \t7 \t6 \t5 \t4 \n", - "\t5 \t6 \t7 \t8 \t9 \t8 \t7 \t6 \t5 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-count2.cpp, Page no-164" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "n=int(raw_input(\"How many integers to be displayed: \"))\n", - "i=0\n", - "while i=n:\n", - " break" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many integers to be displayed: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n", - "1\n", - "2\n", - "3\n", - "4\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-dowhile.cpp, Page no-167" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "while 1: #do-while loop\n", - " inchar=raw_input(\"Enter your sex (m/f): \")\n", - " if(inchar=='m' or inchar=='f'):\n", - " break\n", - "if inchar=='m':\n", - " print \"so you are male. good!\"\n", - "else:\n", - " print \"so you are female. good!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your sex (m/f): d\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your sex (m/f): b\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your sex (m/f): m\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "so you are male. good!\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-pa1.cpp, Page no-167" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "rev=0\n", - "num=int(raw_input(\"Enter the number: \"))\n", - "n=num\n", - "while 1:\n", - " digit=num%10\n", - " rev=rev*10 + digit\n", - " num/=10\n", - " if num==0:\n", - " break\n", - "print \"Reverse of the number =\", rev\n", - "if n==rev:\n", - " print \"The number is a palindrome\"\n", - "else:\n", - " print \"The number is not a palindrome\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number: 121\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Reverse of the number = 121\n", - "The number is a palindrome\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-average2.cpp, Page no-169" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Sum=0\n", - "count=0\n", - "print \"Enter the marks, -1 at the end...\"\n", - "while 1:\n", - " marks=int(raw_input())\n", - " if marks==-1:\n", - " break\n", - " Sum+=marks\n", - " count+=1\n", - "average=Sum/count\n", - "print \"The average is\", average " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the marks, -1 at the end...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "80\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "75\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "82\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "74\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "-1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The average is 77\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sex2.cpp, Page no-171" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ch=raw_input(\"Enter your sex (m/f): \")\n", - "if ch=='m':\n", - " print \"So you are male. good!\"\n", - "elif ch=='f':\n", - " print \"So you are female. good!\"\n", - "else:\n", - " print \"Error: Invalid sex code!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your sex (m/f): m\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "So you are male. good!\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-calc.cpp, Page no-172" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"------------------Basic Calculator------------------\"\n", - "print \"Choose an option:\"\n", - "print \"Add\"\n", - "print \"Subtract\"\n", - "print \"Multiply\"\n", - "print \"Divide\"\n", - "ch=raw_input()\n", - "num1, num2=[int(x) for x in raw_input(\"Enter the value of the operands: \").split()]\n", - "if ch=='1':\n", - " print num1+num2\n", - "elif ch=='2':\n", - " print num1-num2\n", - "elif ch=='3':\n", - " print num1*num2\n", - "elif ch=='4':\n", - " print num1/num2\n", - "else:\n", - " print \"Incorrect choice: \"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "------------------Basic Calculator------------------\n", - "Choose an option:\n", - "Add\n", - "Subtract\n", - "Multiply\n", - "Divide\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the value of the operands: 22 33\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "55\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sumpos.cpp, Page no-174" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "total=0\n", - "while 1:\n", - " num=int(raw_input(\"Enter a number (0 to quit): \"))\n", - " if num==0:\n", - " print \"end of data entry.\"\n", - " break\n", - " if num<0:\n", - " print \"skipping this number.\"\n", - " continue\n", - " total+=num\n", - "print \"Total of all +ve numbers is \", total" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 20\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): -5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "skipping this number.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "end of data entry.\n", - "Total of all +ve numbers is 40\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-jump.cpp, Page no-175" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "total=0\n", - "while 1:\n", - " num=int(raw_input(\"Enter a number (0 to quit): \"))\n", - " if num==0:\n", - " print \"end of data entry.\"\n", - " print \"Total of all +ve numbers is\", total #no goto in python\n", - " break\n", - " if num<0:\n", - " print \"skipping this number.\"\n", - " continue\n", - " total+=num" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 20\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): -5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "skipping this number.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "end of data entry.\n", - "Total of all +ve numbers is 40\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-age5.cpp, Page no-177" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=int(raw_input(\"Enter your age: \"))\n", - "if(age>12 and age<20):\n", - " pass\n", - "print \"you are a teen-aged person. good!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age: 50\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "you are a teen-aged person. good!\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-agecmp.cpp, Page no-177" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "myage=25\n", - "print \"Hi! my age is \", myage\n", - "yourage=int(raw_input(\"What is your age? \"))\n", - "if myage==yourage:\n", - " print \"We are born on the same day. Are we twins!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hi! my age is 25\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "What is your age? 25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "We are born on the same day. Are we twins!\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page no-178" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "l1=int(raw_input(\"Enter the lower limit: \"))\n", - "l2=int(raw_input(\"Enter the higher limit: \"))\n", - "print \"The prime numbers between\", l1, \"and\", l2, \"are: \",\n", - "for i in range(l1, l2+1):\n", - " if i<=3:\n", - " print i,\"\\t\",\n", - " else:\n", - " for j in range(2, i/2+1):\n", - " if(i%j==0):\n", - " break\n", - " if(i%j==0):\n", - " continue #no goto\n", - " print i, \"\\t\"," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the lower limit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the higher limit: 100\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The prime numbers between 1 and 100 are: 1 \t2 \t3 \t5 \t7 \t11 \t13 \t17 \t19 \t23 \t29 \t31 \t37 \t41 \t43 \t47 \t53 \t59 \t61 \t67 \t71 \t73 \t79 \t83 \t89 \t97 \t" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow_1.ipynb deleted file mode 100755 index 9efd46c9..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter5-ControlFlow_1.ipynb +++ /dev/null @@ -1,1280 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:6fa2540f90d9347d87cbc226c605764f3108594e5706b257d5d061ae951444a3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 5- Control Flow" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-age1.cpp, Page no-153" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=int(raw_input(\"Enter your age: \"))\n", - "if(age>12 and age<20):\n", - " print \"you are a teen-aged person. good!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age: 15\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "you are a teen-aged person. good!\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-age2.cpp, Page no-154" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=int(raw_input(\"Enter your age: \"))\n", - "if(age<0):\n", - " print \"I am sorry!\"\n", - " print \"age can never be negative\"\n", - "if(age>12 and age<20):\n", - " print \"you are a teen-aged person. good!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age: -10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "I am sorry!\n", - "age can never be negative\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-large.cpp, Page no-155" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "big=float\n", - "a, b, c=[float(x) for x in raw_input(\"Enter three floating-point numbers: \").split()] #taking input in single line separated by white space\n", - "big=a\n", - "if(b>big):\n", - " big=b\n", - "if(c>big):\n", - " big=c\n", - "print \"Largest of the three numbers =\", big" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter three floating-point numbers: 10.2 15.6 12.8\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Largest of the three numbers = 15.6\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-age3.cpp, Page no-156" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=int(raw_input(\"Enter your age: \"))\n", - "if(age>12 and age<20):\n", - " print \"you are a teen-aged person. good!\"\n", - "else:\n", - " print \"you are not a teen-aged person.\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age: 15\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "you are a teen-aged person. good!\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-lived.cpp, Page no-157" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "years=float(raw_input(\"Enter your age in years: \"))\n", - "if(years<0):\n", - " print \"I am sorry! age can never be negative\"\n", - "else:\n", - " secs=years*365*24*60*60\n", - " print \"You have lived for %.4g seconds\" %(secs)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age in years: 25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "You have lived for 7.884e+08 seconds\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-age4.cpp, Page no-158" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=int(raw_input(\"Enter your age: \"))\n", - "if(age>12 and age<20):\n", - " print \"you are a teen-aged person. good!\"\n", - "else:\n", - " if(age<13):\n", - " print \"you will surely reach teen-age.\"\n", - " else:\n", - " print \"you have crossed teen-age!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age: 25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "you have crossed teen-age!\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-count1.cpp, Page no-159" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "n=int(raw_input(\"How many integers to be displayed: \"))\n", - "for i in range(n):\n", - " print i" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many integers to be displayed: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n", - "1\n", - "2\n", - "3\n", - "4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sumsq1.cpp, Page no-160" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Sum=0\n", - "sum_of_squares=0\n", - "for i in range(2, 31, 2):\n", - " Sum+=i\n", - " sum_of_squares+=i*i\n", - "print \"Sum of first 15 positive even numbers =\", Sum\n", - "print \"Sum of their squares =\", sum_of_squares" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of first 15 positive even numbers = 240\n", - "Sum of their squares = 4960\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sumsq2.cpp, Page no-161" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Sum=0\n", - "sum_of_squares=0\n", - "for i in range(30, 0, -2):\n", - " Sum+=i\n", - " sum_of_squares+=i*i\n", - "print \"Sum of first 15 positive even numbers =\", Sum\n", - "print \"Sum of their squares =\", sum_of_squares" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of first 15 positive even numbers = 240\n", - "Sum of their squares = 4960\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-noinit.cpp, Page no-162" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "i=1\n", - "for i in range(i, 11):\n", - " print i*5," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "5 10 15 20 25 30 35 40 45 50\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-pyramid.cpp, Page no-163" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "n=int(raw_input(\"Enter the number of lines: \"))\n", - "for p in range(1, n+1):\n", - " for q in range(1, n-p+1):\n", - " print \"\\t\",\n", - " m=p\n", - " for q in range (1, p+1):\n", - " print \"\\t\", m,\n", - " m+=1\n", - " m=m-2\n", - " for q in range(1, p):\n", - " print \"\\t\", m,\n", - " m-=1\n", - " print ''" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number of lines: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\t\t\t\t\t1 \n", - "\t\t\t\t2 \t3 \t2 \n", - "\t\t\t3 \t4 \t5 \t4 \t3 \n", - "\t\t4 \t5 \t6 \t7 \t6 \t5 \t4 \n", - "\t5 \t6 \t7 \t8 \t9 \t8 \t7 \t6 \t5 \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-count2.cpp, Page no-164" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "n=int(raw_input(\"How many integers to be displayed: \"))\n", - "i=0\n", - "while i=n:\n", - " break" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many integers to be displayed: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n", - "1\n", - "2\n", - "3\n", - "4\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-dowhile.cpp, Page no-167" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "while 1: #do-while loop\n", - " inchar=raw_input(\"Enter your sex (m/f): \")\n", - " if(inchar=='m' or inchar=='f'):\n", - " break\n", - "if inchar=='m':\n", - " print \"so you are male. good!\"\n", - "else:\n", - " print \"so you are female. good!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your sex (m/f): d\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your sex (m/f): b\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your sex (m/f): m\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "so you are male. good!\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-pa1.cpp, Page no-167" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "rev=0\n", - "num=int(raw_input(\"Enter the number: \"))\n", - "n=num\n", - "while 1:\n", - " digit=num%10\n", - " rev=rev*10 + digit\n", - " num/=10\n", - " if num==0:\n", - " break\n", - "print \"Reverse of the number =\", rev\n", - "if n==rev:\n", - " print \"The number is a palindrome\"\n", - "else:\n", - " print \"The number is not a palindrome\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number: 121\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Reverse of the number = 121\n", - "The number is a palindrome\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-average2.cpp, Page no-169" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Sum=0\n", - "count=0\n", - "print \"Enter the marks, -1 at the end...\"\n", - "while 1:\n", - " marks=int(raw_input())\n", - " if marks==-1:\n", - " break\n", - " Sum+=marks\n", - " count+=1\n", - "average=Sum/count\n", - "print \"The average is\", average " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the marks, -1 at the end...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "80\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "75\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "82\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "74\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "-1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The average is 77\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sex2.cpp, Page no-171" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ch=raw_input(\"Enter your sex (m/f): \")\n", - "if ch=='m':\n", - " print \"So you are male. good!\"\n", - "elif ch=='f':\n", - " print \"So you are female. good!\"\n", - "else:\n", - " print \"Error: Invalid sex code!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your sex (m/f): m\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "So you are male. good!\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-calc.cpp, Page no-172" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print \"------------------Basic Calculator------------------\"\n", - "print \"Choose an option:\"\n", - "print \"Add\"\n", - "print \"Subtract\"\n", - "print \"Multiply\"\n", - "print \"Divide\"\n", - "ch=raw_input()\n", - "num1, num2=[int(x) for x in raw_input(\"Enter the value of the operands: \").split()]\n", - "if ch=='1':\n", - " print num1+num2\n", - "elif ch=='2':\n", - " print num1-num2\n", - "elif ch=='3':\n", - " print num1*num2\n", - "elif ch=='4':\n", - " print num1/num2\n", - "else:\n", - " print \"Incorrect choice: \"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "------------------Basic Calculator------------------\n", - "Choose an option:\n", - "Add\n", - "Subtract\n", - "Multiply\n", - "Divide\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the value of the operands: 22 33\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "55\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sumpos.cpp, Page no-174" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "total=0\n", - "while 1:\n", - " num=int(raw_input(\"Enter a number (0 to quit): \"))\n", - " if num==0:\n", - " print \"end of data entry.\"\n", - " break\n", - " if num<0:\n", - " print \"skipping this number.\"\n", - " continue\n", - " total+=num\n", - "print \"Total of all +ve numbers is \", total" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 20\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): -5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "skipping this number.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "end of data entry.\n", - "Total of all +ve numbers is 40\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-jump.cpp, Page no-175" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "total=0\n", - "while 1:\n", - " num=int(raw_input(\"Enter a number (0 to quit): \"))\n", - " if num==0:\n", - " print \"end of data entry.\"\n", - " print \"Total of all +ve numbers is\", total #no goto in python\n", - " break\n", - " if num<0:\n", - " print \"skipping this number.\"\n", - " continue\n", - " total+=num" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 20\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): -5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "skipping this number.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number (0 to quit): 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "end of data entry.\n", - "Total of all +ve numbers is 40\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-age5.cpp, Page no-177" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=int(raw_input(\"Enter your age: \"))\n", - "if(age>12 and age<20):\n", - " pass\n", - "print \"you are a teen-aged person. good!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your age: 50\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "you are a teen-aged person. good!\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-agecmp.cpp, Page no-177" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "myage=25\n", - "print \"Hi! my age is \", myage\n", - "yourage=int(raw_input(\"What is your age? \"))\n", - "if myage==yourage:\n", - " print \"We are born on the same day. Are we twins!\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hi! my age is 25\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "What is your age? 25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "We are born on the same day. Are we twins!\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page no-178" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "l1=int(raw_input(\"Enter the lower limit: \"))\n", - "l2=int(raw_input(\"Enter the higher limit: \"))\n", - "print \"The prime numbers between\", l1, \"and\", l2, \"are: \",\n", - "for i in range(l1, l2+1):\n", - " if i<=3:\n", - " print i,\"\\t\",\n", - " else:\n", - " for j in range(2, i/2+1):\n", - " if(i%j==0):\n", - " break\n", - " if(i%j==0):\n", - " continue #no goto\n", - " print i, \"\\t\"," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the lower limit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the higher limit: 100\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The prime numbers between 1 and 100 are: 1 \t2 \t3 \t5 \t7 \t11 \t13 \t17 \t19 \t23 \t29 \t31 \t37 \t41 \t43 \t47 \t53 \t59 \t61 \t67 \t71 \t73 \t79 \t83 \t89 \t97 \t" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings.ipynb deleted file mode 100755 index ce7a4137..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter6-ArraysAndStrings.ipynb +++ /dev/null @@ -1,1593 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e2ad0aaf08f1bea2c2348d5e8774482c34bf3c3072d4908db5fdcd5d935d1eed" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 6- Arrays and Strings" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-age1.cpp, Page no-182" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Sum=0.0\n", - "age1=int(raw_input(\"Enter person 1 age: \"))\n", - "Sum+=age1\n", - "age2=int(raw_input(\"Enter person 2 age: \"))\n", - "Sum+=age2\n", - "age3=int(raw_input(\"Enter person 3 age: \"))\n", - "Sum+=age3\n", - "age4=int(raw_input(\"Enter person 4 age: \"))\n", - "Sum+=age4\n", - "age5=int(raw_input(\"Enter person 5 age: \"))\n", - "Sum+=age5\n", - "print \"Average age = %g\" %(Sum/5)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter person 1 age: 23\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter person 2 age: 40\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter person 3 age: 30\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter person 4 age: 27\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter person 5 age: 25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Average age = 29\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-age2.cpp, Page no-182" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=[int]*5 #integer array of size 5\n", - "Sum=0.0\n", - "for i in range(5):\n", - " print \"Enter person\", i+1, \"age: \",\n", - " age[i]=int(raw_input())\n", - "for i in range(5):\n", - " Sum+=age[i]\n", - "print \"Average age = %g\" %(Sum/5)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter person 1 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "23\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 2 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "40\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 3 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "30\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 4 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "27\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 5 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Average age = 29\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-nodup.c, Page no-184" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "flag=0\n", - "a=[float]*50\n", - "n=int(raw_input(\"Enter the size of a vector: \"))\n", - "num=n\n", - "print \"Enter the vector elements...\"\n", - "for i in range(n):\n", - " print \"a[\", i, \"] = ? \",\n", - " a[i]=int(raw_input())\n", - "for i in range(n-1):\n", - " for j in range(i+1, n):\n", - " if a[i]==a[j]:\n", - " n=n-1\n", - " for k in range(j, n):\n", - " a[k]=a[k+1]\n", - " flag=1\n", - " j=j-1\n", - "if flag:\n", - " print \"vector has \", num-n, \"duplicate elements=(s).\"\n", - " print \"Vector after removing duplicates...\"\n", - " for i in range(n):\n", - " print \"a[\", i, \"] = \", a[i]\n", - "else:\n", - " print \"vector has no duplicate elements\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the size of a vector: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the vector elements...\n", - "a[ 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " a[ 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " a[ 2 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " a[ 3 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " a[ 4 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " a[ 5 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " vector has 1 duplicate elements=(s).\n", - "Vector after removing duplicates...\n", - "a[ 0 ] = 1\n", - "a[ 1 ] = 5\n", - "a[ 2 ] = 6\n", - "a[ 3 ] = 8\n", - "a[ 4 ] = 9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-elder.cpp, Page no-187" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=[float]*25\n", - "n=int(raw_input(\"How many persons are there in list ? \"))\n", - "for i in range(n):\n", - " print \"Enter person\", i+1, \"age: \",\n", - " age[i]=int(raw_input())\n", - "younger=age[0]\n", - "elder=age[0]\n", - "for i in range(n):\n", - " if age[i]elder:\n", - " elder=age[i]\n", - "print \"Age of eldest person is\", elder\n", - "print \"Age of youngest person is: \", younger" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many persons are there in list ? 7\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter person 1 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 2 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 3 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "45\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 4 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "18\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 5 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "35\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 6 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "23\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 7 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "32\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Age of eldest person is 45\n", - "Age of youngest person is: 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-bubble.cpp, Page no-189" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=[int]*25\n", - "n=int(raw_input(\"How many elements to sort ? \"))\n", - "for i in range(n):\n", - " print \"Enter age[\", i, \"]: \",\n", - " age[i]=int(raw_input())\n", - "for i in range(n-1):\n", - " flag=1\n", - " for j in range(n-1-i):\n", - " if age[j]>age[j+1]:\n", - " flag=0\n", - " temp=age[j]\n", - " age[j]=age[j+1]\n", - " age[j+1]=temp\n", - " if flag:\n", - " break\n", - "print \"Sorted list...\"\n", - "for i in range(n):\n", - " print age[i]," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many elements to sort ? 7\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter age[ 0 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 1 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 2 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 3 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 4 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 5 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 6 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Sorted list...\n", - "1 2 3 4 5 6 9\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-comb.cpp, Page no-190" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "SHRINKINGFACTOR=1.3\n", - "age=[int]*25\n", - "n=int(raw_input(\"How many elements to sort ? \"))\n", - "for i in range(n):\n", - " print \"Enter age[\", i, \"]: \",\n", - " age[i]=int(raw_input())\n", - "size=n\n", - "gap=size\n", - "while 1:\n", - " gap=int(float(gap)/SHRINKINGFACTOR)\n", - " if gap==0:\n", - " gap=1\n", - " elif (gap==9 or gap==10):\n", - " gap=11\n", - " flag=1\n", - " top=size-gap\n", - " for i in range(top):\n", - " j=i+gap\n", - " if age[i]>age[j]:\n", - " flag=0\n", - " temp=age[j]\n", - " age[j]=age[i]\n", - " age[i]=temp\n", - " if(flag==1 and gap<=1):\n", - " break\n", - "print \"Sorted list...\"\n", - "for i in range(n):\n", - " print age[i]," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many elements to sort ? 7\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter age[ 0 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 1 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 2 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 3 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 4 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 5 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 6 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Sorted list...\n", - "1 2 3 4 5 6 9\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-matrix.cpp, Page no-193" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=[]\n", - "b=[]\n", - "c=[]\n", - "m, n=[int(x) for x in raw_input(\"Enter row and column size of matrix A: \").split()]\n", - "p, q=[int(x) for x in raw_input(\"Enter row and column size of matrix B: \").split()]\n", - "if(m==p and n==q):\n", - " print \"Matrices can be added or subtracted...\"\n", - " print \"Enter matrix A elements...\"\n", - " for i in range(m):\n", - " a.append([])\n", - " for j in range(n):\n", - " a[i].append(int(raw_input()))\n", - " print \"Enter matrix B elements...\"\n", - " for i in range(m):\n", - " b.append([])\n", - " for j in range(n):\n", - " b[i].append(int(raw_input()))\n", - " for i in range(m):\n", - " c.append([])\n", - " for j in range(n):\n", - " c[i].append(a[i][j]+b[i][j])\n", - " print \"Sum of A and B matrices...\"\n", - " for i in range(m):\n", - " for j in range(n):\n", - " print c[i][j], \n", - " print \"\"\n", - " for i in range(m):\n", - " for j in range(n):\n", - " c[i][j]=a[i][j]-b[i][j]\n", - " print \"Difference of A and B matrices...\"\n", - " for i in range(m):\n", - " for j in range(n):\n", - " print c[i][j], \n", - " print \"\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter row and column size of matrix A: 3 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter row and column size of matrix B: 3 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrices can be added or subtracted...\n", - "Enter matrix A elements...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter matrix B elements...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of A and B matrices...\n", - "4 4 4 \n", - "7 6 3 \n", - "4 3 3 \n", - "Difference of A and B matrices...\n", - "-2 0 2 \n", - "1 0 -1 \n", - "2 -1 1 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-name.cpp, Page-196" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "name=[None]*50\n", - "name=raw_input(\"Enter your name <49-max>: \")\n", - "print \"Your name is\", name" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your name <49-max>: Archana\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Your name is Archana\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-succ.cpp, Page no-196" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "msg=\"C to C++\\nC++ to Java\\nJava to...\" #string with special characters\n", - "print \"Please note the following messgae: \"\n", - "print msg" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please note the following messgae: \n", - "C to C++\n", - "C++ to Java\n", - "Java to...\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-strlen.cpp, Page no-197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "s1=[None]*25\n", - "s1=raw_input(\"Enter your name: \")\n", - "print \"strlen( s1 ) :\", len(s1) #length of string" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your name: Smrithi\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "strlen( s1 ): 7\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-strcpy.cpp, Page no-198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "s1=[None]*25\n", - "s2=[None]*25\n", - "s1=raw_input(\"Enter a string: \")\n", - "s2=s1 #copying string\n", - "print \"strcpy( s2, s1 ):\", s2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a string: Garbage\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "strcpy( s2, s1 ): Garbage\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-strcat.cpp, Page no-198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "s1=[None]*40\n", - "s2=[None]*25\n", - "s1=raw_input(\"Enter string s1: \")\n", - "s2=raw_input(\"Enter string s2: \")\n", - "s1=s1+s2 #concatenating string\n", - "print \"strcat( s1, s2 ):\", s1" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string s1: C\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string s2: ++\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "strcat( s1, s2 ): C++\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-strcmp, Page no-199" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "s1=[None]*25\n", - "s2=[None]*25\n", - "s1=raw_input(\"Enter string s1: \")\n", - "s2=raw_input(\"Enter string s2: \")\n", - "print \"strcmp( s1, s2 ):\",\n", - "if s1==s2: #comparing strings\n", - " print s1, \"is equal to\", s2\n", - "elif s1>s2:\n", - " print s1, \"is greater than\", s2\n", - "else: \n", - " print s1, \"is less than\", s2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string s1: Computer\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string s2: Computing\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "strcmp( s1, s2 ): Computer is less than Computing\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-uprlwr.cpp, Page no-199" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "s1=[None]*25\n", - "temp=[None]*25\n", - "s1=raw_input(\"Enter a string: \")\n", - "temp=s1\n", - "print \"strupr(temp):\", temp.upper() #Upper case\n", - "print \"strlwr(temp):\", temp.lower() #lower case" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a string: Smrithi\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "strupr(temp): SMRITHI\n", - "strlwr(temp): smrithi\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-name.cpp, Page no-200" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "person=[[None]*10]*LEN\n", - "n=int(raw_input(\"How many persons ? \"))\n", - "for i in range(n):\n", - " print \"Enter person\", i+1, \"name: \",\n", - " person[i]=raw_input()\n", - "print \"------------------------------------------------------\"\n", - "print \"P# Person Name Length In lower case In UPPER case\"\n", - "print \"------------------------------------------------------\"\n", - "for i in range(n):\n", - " print '{:>2}'.format(i+1),\n", - " print '{:>15}'.format(person[i]),\n", - " print '{:>2}'.format(len(person[i])),\n", - " print '{:>15}'.format(person[i].lower()),\n", - " print '{:>15}'.format(person[i].upper())" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many persons ? 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter person 1 name: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Anand\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 2 name: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Vishwanath\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 3 name: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Archana\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 4 name: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Yadunandan\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 5 name: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mallikarnun\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " ------------------------------------------------------\n", - "P# Person Name Length In lower case In UPPER case\n", - "------------------------------------------------------\n", - " 1 Anand 5 anand ANAND\n", - " 2 Vishwanath 10 vishwanath VISHWANATH\n", - " 3 Archana 7 archana ARCHANA\n", - " 4 Yadunandan 10 yadunandan YADUNANDAN\n", - " 5 Mallikarnun 11 mallikarnun MALLIKARNUN\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-lex.cpp, Page no-202" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Str=[\"Anand\", \"Vishwanath\", \"Archana\", \"Yadunandan\", \"MalliKarjun\"]\n", - "print 'The given strings are:'\n", - "for i in range(5):\n", - " print Str[i]\n", - "k=1\n", - "while k<5: #sorting strings\n", - " for i in range(1, 5-k+1):\n", - " if Str[i-1]>Str[i]:\n", - " str_temp=Str[i-1]\n", - " Str[i-1]=Str[i]\n", - " Str[i]=str_temp\n", - " k=k+1\n", - "print 'Strings in lexicographical order are:'\n", - "for i in range(5):\n", - " print Str[i]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The given strings are:\n", - "Anand\n", - "Vishwanath\n", - "Archana\n", - "Yadunandan\n", - "MalliKarjun\n", - "Strings in lexicographical order are:\n", - "Anand\n", - "Archana\n", - "MalliKarjun\n", - "Vishwanath\n", - "Yadunandan\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page no-204" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Str=\"In pursuit of Mastering\tC++\"\n", - "count=0\n", - "i=0\n", - "print \"The given string is:\\n\",Str\n", - "while(i? \"))\n", - "for i in range(n):\n", - " print \"Enter person\", i+1, \"age: \",\n", - " age[i]=int(raw_input())\n", - "younger=age[0]\n", - "elder=age[0]\n", - "for i in range(n):\n", - " if age[i]elder:\n", - " elder=age[i]\n", - "print \"Age of eldest person is\", elder\n", - "print \"Age of youngest person is: \", younger" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many persons are there in list ? 7\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter person 1 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 2 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 3 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "45\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 4 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "18\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 5 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "35\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 6 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "23\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 7 age: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "32\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Age of eldest person is 45\n", - "Age of youngest person is: 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-bubble.cpp, Page no-189" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "age=[int]*25\n", - "n=int(raw_input(\"How many elements to sort ? \"))\n", - "for i in range(n):\n", - " print \"Enter age[\", i, \"]: \",\n", - " age[i]=int(raw_input())\n", - "for i in range(n-1):\n", - " flag=1\n", - " for j in range(n-1-i):\n", - " if age[j]>age[j+1]:\n", - " flag=0\n", - " temp=age[j]\n", - " age[j]=age[j+1]\n", - " age[j+1]=temp\n", - " if flag:\n", - " break\n", - "print \"Sorted list...\"\n", - "for i in range(n):\n", - " print age[i]," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many elements to sort ? 7\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter age[ 0 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 1 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 2 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 3 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 4 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 5 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 6 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Sorted list...\n", - "1 2 3 4 5 6 9\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-comb.cpp, Page no-190" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "SHRINKINGFACTOR=1.3\n", - "age=[int]*25\n", - "n=int(raw_input(\"How many elements to sort ? \"))\n", - "for i in range(n):\n", - " print \"Enter age[\", i, \"]: \",\n", - " age[i]=int(raw_input())\n", - "size=n\n", - "gap=size\n", - "while 1:\n", - " gap=int(float(gap)/SHRINKINGFACTOR)\n", - " if gap==0:\n", - " gap=1\n", - " elif (gap==9 or gap==10):\n", - " gap=11\n", - " flag=1\n", - " top=size-gap\n", - " for i in range(top):\n", - " j=i+gap\n", - " if age[i]>age[j]:\n", - " flag=0\n", - " temp=age[j]\n", - " age[j]=age[i]\n", - " age[i]=temp\n", - " if(flag==1 and gap<=1):\n", - " break\n", - "print \"Sorted list...\"\n", - "for i in range(n):\n", - " print age[i]," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many elements to sort ? 7\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter age[ 0 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 1 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 2 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 3 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 4 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 5 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter age[ 6 ]: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Sorted list...\n", - "1 2 3 4 5 6 9\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-matrix.cpp, Page no-193" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=[]\n", - "b=[]\n", - "c=[]\n", - "m, n=[int(x) for x in raw_input(\"Enter row and column size of matrix A: \").split()]\n", - "p, q=[int(x) for x in raw_input(\"Enter row and column size of matrix B: \").split()]\n", - "if(m==p and n==q):\n", - " print \"Matrices can be added or subtracted...\"\n", - " print \"Enter matrix A elements...\"\n", - " for i in range(m):\n", - " a.append([])\n", - " for j in range(n):\n", - " a[i].append(int(raw_input()))\n", - " print \"Enter matrix B elements...\"\n", - " for i in range(m):\n", - " b.append([])\n", - " for j in range(n):\n", - " b[i].append(int(raw_input()))\n", - " for i in range(m):\n", - " c.append([])\n", - " for j in range(n):\n", - " c[i].append(a[i][j]+b[i][j])\n", - " print \"Sum of A and B matrices...\"\n", - " for i in range(m):\n", - " for j in range(n):\n", - " print c[i][j], \n", - " print \"\"\n", - " for i in range(m):\n", - " for j in range(n):\n", - " c[i][j]=a[i][j]-b[i][j]\n", - " print \"Difference of A and B matrices...\"\n", - " for i in range(m):\n", - " for j in range(n):\n", - " print c[i][j], \n", - " print \"\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter row and column size of matrix A: 3 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter row and column size of matrix B: 3 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrices can be added or subtracted...\n", - "Enter matrix A elements...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter matrix B elements...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sum of A and B matrices...\n", - "4 4 4 \n", - "7 6 3 \n", - "4 3 3 \n", - "Difference of A and B matrices...\n", - "-2 0 2 \n", - "1 0 -1 \n", - "2 -1 1 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-name.cpp, Page-196" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "name=[None]*50\n", - "name=raw_input(\"Enter your name <49-max>: \")\n", - "print \"Your name is\", name" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your name <49-max>: Archana\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Your name is Archana\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-succ.cpp, Page no-196" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "msg=\"C to C++\\nC++ to Java\\nJava to...\" #string with special characters\n", - "print \"Please note the following messgae: \"\n", - "print msg" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please note the following messgae: \n", - "C to C++\n", - "C++ to Java\n", - "Java to...\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-strlen.cpp, Page no-197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "s1=[None]*25\n", - "s1=raw_input(\"Enter your name: \")\n", - "print \"strlen( s1 ) :\", len(s1) #length of string" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your name: Smrithi\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "strlen( s1 ): 7\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-strcpy.cpp, Page no-198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "s1=[None]*25\n", - "s2=[None]*25\n", - "s1=raw_input(\"Enter a string: \")\n", - "s2=s1 #copying string\n", - "print \"strcpy( s2, s1 ):\", s2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a string: Garbage\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "strcpy( s2, s1 ): Garbage\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-strcat.cpp, Page no-198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "s1=[None]*40\n", - "s2=[None]*25\n", - "s1=raw_input(\"Enter string s1: \")\n", - "s2=raw_input(\"Enter string s2: \")\n", - "s1=s1+s2 #concatenating string\n", - "print \"strcat( s1, s2 ):\", s1" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string s1: C\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string s2: ++\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "strcat( s1, s2 ): C++\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-strcmp, Page no-199" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "s1=[None]*25\n", - "s2=[None]*25\n", - "s1=raw_input(\"Enter string s1: \")\n", - "s2=raw_input(\"Enter string s2: \")\n", - "print \"strcmp( s1, s2 ):\",\n", - "if s1==s2: #comparing strings\n", - " print s1, \"is equal to\", s2\n", - "elif s1>s2:\n", - " print s1, \"is greater than\", s2\n", - "else: \n", - " print s1, \"is less than\", s2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string s1: Computer\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string s2: Computing\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "strcmp( s1, s2 ): Computer is less than Computing\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-uprlwr.cpp, Page no-199" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "s1=[None]*25\n", - "temp=[None]*25\n", - "s1=raw_input(\"Enter a string: \")\n", - "temp=s1\n", - "print \"strupr(temp):\", temp.upper() #Upper case\n", - "print \"strlwr(temp):\", temp.lower() #lower case" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a string: Smrithi\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "strupr(temp): SMRITHI\n", - "strlwr(temp): smrithi\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-name.cpp, Page no-200" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "person=[[None]*10]*LEN\n", - "n=int(raw_input(\"How many persons ? \"))\n", - "for i in range(n):\n", - " print \"Enter person\", i+1, \"name: \",\n", - " person[i]=raw_input()\n", - "print \"------------------------------------------------------\"\n", - "print \"P# Person Name Length In lower case In UPPER case\"\n", - "print \"------------------------------------------------------\"\n", - "for i in range(n):\n", - " print '{:>2}'.format(i+1),\n", - " print '{:>15}'.format(person[i]),\n", - " print '{:>2}'.format(len(person[i])),\n", - " print '{:>15}'.format(person[i].lower()),\n", - " print '{:>15}'.format(person[i].upper())" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many persons ? 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter person 1 name: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Anand\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 2 name: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Vishwanath\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 3 name: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Archana\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 4 name: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Yadunandan\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter person 5 name: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mallikarnun\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " ------------------------------------------------------\n", - "P# Person Name Length In lower case In UPPER case\n", - "------------------------------------------------------\n", - " 1 Anand 5 anand ANAND\n", - " 2 Vishwanath 10 vishwanath VISHWANATH\n", - " 3 Archana 7 archana ARCHANA\n", - " 4 Yadunandan 10 yadunandan YADUNANDAN\n", - " 5 Mallikarnun 11 mallikarnun MALLIKARNUN\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-lex.cpp, Page no-202" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Str=[\"Anand\", \"Vishwanath\", \"Archana\", \"Yadunandan\", \"MalliKarjun\"]\n", - "print 'The given strings are:'\n", - "for i in range(5):\n", - " print Str[i]\n", - "k=1\n", - "while k<5: #sorting strings\n", - " for i in range(1, 5-k+1):\n", - " if Str[i-1]>Str[i]:\n", - " str_temp=Str[i-1]\n", - " Str[i-1]=Str[i]\n", - " Str[i]=str_temp\n", - " k=k+1\n", - "print 'Strings in lexicographical order are:'\n", - "for i in range(5):\n", - " print Str[i]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The given strings are:\n", - "Anand\n", - "Vishwanath\n", - "Archana\n", - "Yadunandan\n", - "MalliKarjun\n", - "Strings in lexicographical order are:\n", - "Anand\n", - "Archana\n", - "MalliKarjun\n", - "Vishwanath\n", - "Yadunandan\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page no-204" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Str=\"In pursuit of Mastering\tC++\"\n", - "count=0\n", - "i=0\n", - "print \"The given string is:\\n\",Str\n", - "while(iy:\n", - " return x\n", - " else:\n", - " return y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "c=Max(a,b)\n", - "print \"max (a, b):\", c" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 20 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max (a, b): 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example.cpp, Page no-214" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(x,y):\n", - " if x>y:\n", - " return x\n", - " else:\n", - " return y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "c=Max(a,b)\n", - "print \"max (a, b):\", c" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 20 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max (a, b): 20\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-chart1.cpp, Page no-214" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PercentageChart(percentage):\n", - " for i in range(percentage/2):\n", - " sys.stdout.write('\\x3d')\n", - "print \"Sridevi : \",\n", - "PercentageChart(50)\n", - "print \"\\nRajkumar: \",\n", - "PercentageChart(84)\n", - "print \"\\nSavithri: \",\n", - "PercentageChart(79)\n", - "print \"\\nAnand : \",\n", - "PercentageChart(74)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sridevi : ========================= \n", - "Rajkumar: ========================================== \n", - "Savithri: ======================================= \n", - "Anand : =====================================\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-chart2.cpp, Page no-216" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PercentageChart(percentage):\n", - " for i in range(percentage/2):\n", - " sys.stdout.write('\\x3d')\n", - "m1, m2, m3, m4=[int(x) for x in raw_input(\"Enter percentage score of Sri, Raj, Savi, An: \").split()]\n", - "print \"Sridevi : \",\n", - "PercentageChart(m1)\n", - "print \"\\nRajkumar: \",\n", - "PercentageChart(m2)\n", - "print \"\\nSavithri: \",\n", - "PercentageChart(m3)\n", - "print \"\\nAnand : \",\n", - "PercentageChart(m4)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter percentage score of Sri, Raj, Savi, An: 52 92 83 67\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sridevi : ========================== \n", - "Rajkumar: ============================================== \n", - "Savithri: ========================================= \n", - "Anand : =================================\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-chart3.cpp, Page no-217" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PercentageChart(percentage, style):\n", - " for i in range(percentage/2):\n", - " sys.stdout.write(style)\n", - "m1, m2, m3, m4=[int(x) for x in raw_input(\"Enter percentage score of Sri, Raj, Savi, An: \").split()]\n", - "print \"Sridevi : \",\n", - "PercentageChart(m1, '*')\n", - "print \"\\nRajkumar: \",\n", - "PercentageChart(m2, '\\x3D')\n", - "print \"\\nSavithri: \",\n", - "PercentageChart(m3, '-')\n", - "print \"\\nAnand : \",\n", - "PercentageChart(m4, '!')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter percentage score of Sri, Raj, Savi, An: 55 92 83 67\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sridevi : *************************** \n", - "Rajkumar: ============================================== \n", - "Savithri: ----------------------------------------- \n", - "Anand : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ifact.cpp, Page no-218" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def fact(n):\n", - " if n==0:\n", - " result=1\n", - " else:\n", - " result=1\n", - " for i in range(2, n+1):\n", - " result*=i\n", - " return result\n", - "n=int(raw_input(\"Enter the number whose factorial is to be found: \"))\n", - "print \"The factorial of\", n, \"is\", fact(n)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number whose factorial is to be found: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The factorial of 5 is 120\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-namelen.cpp, Page no-219" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "name=[None]*20\n", - "name=raw_input(\"Enter your name: \")\n", - "Len=len(name) #string length\n", - "print \"Length of your name =\", Len" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your name: Rajkumar\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Length of your name = 8\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-maths.cpp, Page no-220" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "num=float(raw_input(\"Enter any factorial number: \"))\n", - "num1=math.ceil(num) #ceiling of number\n", - "num2=math.floor(num) #floor of number\n", - "print \"ceil(\",num,\") =\", num1\n", - "print \"floor(\",num,\") =\", num2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any factorial number: 2.9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ceil( 2.9 ) = 3.0\n", - "floor( 2.9 ) = 2.0\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap1.cpp, Page no-221" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y): #pass by value swap\n", - " print \"Value of x and y in swap before exchange:\", x, y\n", - " t=x\n", - " x=y\n", - " y=t\n", - " print \"Value of x and y in swap after exchange:\", x, y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "swap(a,b)\n", - "print \"Value of a and b on swap a, b) in main():\", a, b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of x and y in swap before exchange: 10 20\n", - "Value of x and y in swap after exchange: 20 10\n", - "Value of a and b on swap a, b) in main(): 10 20\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap2.cpp, Pgae no-222" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y): #pass by address swap\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "a, b = swap(a, b)\n", - "print \"Value of a and b on swap( a, b ):\", a, b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of a and b on swap( a, b ): 20 10\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap3.cpp, Page no-224" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y): #pass by reference swap\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "a, b = swap(a, b)\n", - "print \"Value of a and b on swap( a, b):\", a, b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of a and b on swap( a, b): 20 10\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ref.cpp, Page no-226" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(x,y):\n", - " if x>y:\n", - " return x\n", - " else:\n", - " return y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "if Max(a,b)==a:\n", - " a=425\n", - "else:\n", - " b=425\n", - "print \"The value of a and b on execution of mx(x, y)=425;...\"\n", - "print \"a =\", a, \"b =\", b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 2 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The value of a and b on execution of mx(x, y)=425;...\n", - "a = 425 b = 1\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-defarg1.cpp, Page no-228" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PrintLine(ch='-', RepeatCount=70): #default arguments\n", - " for i in range(RepeatCount):\n", - " sys.stdout.write(ch)\n", - " print ''\n", - "PrintLine()\n", - "PrintLine('!')\n", - "PrintLine('*', 40)\n", - "PrintLine('R', 55)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "----------------------------------------------------------------------\n", - "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", - "****************************************\n", - "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-defarg2.cpp, Pgae no-229" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PrintLine(ch='-', RepeatCount=70, nLines=1): #default arguments\n", - " for i in range(nLines):\n", - " for i in range(RepeatCount):\n", - " sys.stdout.write(ch)\n", - " print ''\n", - "PrintLine()\n", - "PrintLine('!')\n", - "PrintLine('*', 40)\n", - "PrintLine('R', 55)\n", - "PrintLine('&', 25, 2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "----------------------------------------------------------------------\n", - "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", - "****************************************\n", - "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", - "&&&&&&&&&&&&&&&&&&&&&&&&&\n", - "&&&&&&&&&&&&&&&&&&&&&&&&&\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-square.cpp, Page no-230" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def sqr(num):\n", - " return num*num\n", - "n=float(raw_input(\"Enter a number: \"))\n", - "print \"Its square =\",sqr(n)\n", - "print \"sqr( 10 ) =\", sqr(10)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Its square = 25.0\n", - "sqr( 10 ) = 100\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap4.cpp, Page no-231" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#different swap functions\n", - "def swap_char(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "def swap_int(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "def swap_float(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch1, ch2 = swap_char(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "a, b = swap_int(a, b)\n", - "print \"On swapping :\", a,b\n", - "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", - "c, d = swap_float(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap5.cpp, Page no-233" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y): #function overloading\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch1, ch2 = swap(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "a, b = swap(a, b)\n", - "print \"On swapping :\", a,b\n", - "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", - "c, d = swap(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-show.cpp, Page no-234" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show(val): #function overloading\n", - " if(isinstance(val, int)):\n", - " print \"Integer:\", val\n", - " if(isinstance(val, float)):\n", - " print \"Double:\", val\n", - " if(isinstance(val, str)):\n", - " print \"String:\", val\n", - "show(420)\n", - "show(3.1415)\n", - "show(\"Hello World!\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Integer: 420\n", - "Double: 3.1415\n", - "String: Hello World!\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap6.cpp, Page no-236" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch1, ch2 = swap(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "a, b = swap(a, b)\n", - "print \"On swapping :\", a,b\n", - "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", - "c, d = swap(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sort.cpp, Page no-237" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "(false, true)=(0, 1) #enum type\n", - "type =['false', 'true']\n", - "def swap(x, y):\n", - " x, y=y, x\n", - " return x, y\n", - "def BubbleSort(a, size):\n", - " swapped='true'\n", - " for i in range(size-1):\n", - " if swapped:\n", - " swapped='false'\n", - " for j in range((size-1)-i):\n", - " if a[j]>a[j+1]:\n", - " swapped='true'\n", - " a[j], a[j+1]=swap(a[j], a[j+1])\n", - " return a\n", - "a=[int]*25\n", - "print \"Program to sort elements...\"\n", - "size=int(raw_input(\"Enter the size of the integer vector : \"))\n", - "print \"Enter the elements of the integer vector...\"\n", - "for i in range(size):\n", - " a[i]=int(raw_input())\n", - "a=BubbleSort(a, size)\n", - "print \"Sorted Vector:\"\n", - "for i in range(size):\n", - " print a[i]," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Program to sort elements...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the size of the integer vector : 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the elements of the integer vector...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "9\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sorted Vector:\n", - "2 3 6 8 9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-linear.cpp, Page no-239" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def linear(arr, num):\n", - " for i in range(10):\n", - " if arr[i]==num:\n", - " return i\n", - " return -1\n", - "a=[10, 20, 5, 59, 63, 22, 18, 99, 11, 65] # 1-D array\n", - "element=int(raw_input(\"Enter the element to be searched: \"))\n", - "result=linear(a, element)\n", - "if result==-1:\n", - " print element, \"is not present in the array\"\n", - "else:\n", - " print element, \"is present at\",result, \"location in the array\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the element to be searched: 88\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "88 is not present in the array\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-funcstk.cpp, Page no-240" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Func(j, k):\n", - " print \"In the function the argument values are\", j, \"..\", k\n", - "i=99\n", - "Func(i+1, i)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "In the function the argument values are 100 .. 99\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-variable.cpp, Page no-241" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "g=100\n", - "def func1():\n", - " g=50\n", - " print \"Local variable g in func1() :\", g\n", - "def func2():\n", - " global g\n", - " print \"In func2() g is visible since it is global.\"\n", - " print \"Incremeting g in func...\"\n", - " g+=1\n", - "print \"In main g is visible here since g is global.\"\n", - "print \"Assigning 20 to g in main...\"\n", - "g=20\n", - "print \"Calling func1...\"\n", - "func1()\n", - "print \"func1 returned. g is\", g\n", - "print \"Calling func2...\"\n", - "func2()\n", - "print \"func2 returned. g is\", g" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "In main g is visible here since g is global.\n", - "Assigning 20 to g in main...\n", - "Calling func1...\n", - "Local variable g in func1() : 50\n", - "func1 returned. g is 20\n", - "Calling func2...\n", - "In func2() g is visible since it is global.\n", - "Incremeting g in func...\n", - "func2 returned. g is 21\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-regvar.cpp, Page no-244" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "i=int\n", - "name=raw_input(\"Enter a string: \")\n", - "print \"The reverse of the string is: \",\n", - "for i in range(len(name)-1, -1, -1):\n", - " sys.stdout.write(name[i])" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a string: mahatma\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The reverse of the string is: amtaham\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-count.cpp, Page no-245" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def PrintCount(Count=[1]):\n", - " print 'Count =', Count[0]\n", - " Count[0]=Count[0]+1\n", - "PrintCount()\n", - "PrintCount()\n", - "PrintCount()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Count = 1\n", - "Count = 2\n", - "Count = 3\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-add.cpp, Page no-247" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def add(*argc):#variable number of arguments to the function\n", - " result=0\n", - " for i in range(1, argc[0]+1):\n", - " result+=argc[i]\n", - " return result\n", - "sum1=add(3, 1, 2, 3)\n", - "print \"sum1 =\", sum1\n", - "sum2=add(1, 10)\n", - "print \"sum2 =\", sum2\n", - "sum3=add(0)\n", - "print \"sum3 =\", sum3" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sum1 = 6\n", - "sum2 = 10\n", - "sum3 = 0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sum.cpp, Page no-248" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def sum(*msg): #variable number of arguments to the function\n", - " total=0\n", - " i=1\n", - " while(msg[i]!=0):\n", - " total+=msg[i]\n", - " i+=1\n", - " print msg[0], total\n", - "sum(\"The total of 1+2+3+4 is\", 1, 2, 3, 4, 0)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The total of 1+2+3+4 is 10\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-rfact.cpp, Page no-250" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def fact(num): #recursive function\n", - " if num==0:\n", - " return 1\n", - " else:\n", - " return num*fact(num-1)\n", - "n=int(raw_input(\"Enter the number whose factorial is to be found: \"))\n", - "print \"The factorial of\", n, \"is\", fact(n)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number whose factorial is to be found: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The factorial of 5 is 120\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-hanoi.cpp, Page no-250" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def hanoi(n, left, mid, right): #recursive function\n", - " if n!=0:\n", - " hanoi(n-1, left, right, mid)\n", - " print 'Move disk', n, 'from', left, 'to', right\n", - " hanoi(n-1, mid, left, right)\n", - "source='L'\n", - "intermediate='C'\n", - "destination='R'\n", - "nvalue=int(raw_input('Enter number of disks: '))\n", - "hanoi(nvalue, source, intermediate, destination)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter number of disks: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Move disk 1 from L to R\n", - "Move disk 2 from L to C\n", - "Move disk 1 from R to C\n", - "Move disk 3 from L to R\n", - "Move disk 1 from C to L\n", - "Move disk 2 from C to R\n", - "Move disk 1 from L to R\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page no-254" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def power(x1, y1=None):\n", - " if (isinstance(y1, int)):\n", - " result=1.0\n", - " for i in range(1, y1+1):\n", - " result=result*x1\n", - " return result\n", - " else:\n", - " return x1*x1\n", - "x=float(raw_input(\"Enter the value of x: \"))\n", - "y=int(raw_input(\"Enter the value of y: \"))\n", - "print \"power(x, y) =\", power(x, y)\n", - "print \"power(x) =\", power(x)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the value of x: 9.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the value of y: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power(x, y) = 8145.0625\n", - "power(x) = 90.25\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions_1.ipynb deleted file mode 100755 index 209d4a32..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter7-ModularProgrammingWithFunctions_1.ipynb +++ /dev/null @@ -1,1641 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:01e9bb6f23cf66730668efcf362fa75830da07f132439eac09b9d85dcf6bc616" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 7-Modular Programming with Functions" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-tax1.cpp, Page no-208" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Name=[None]*25\n", - "Name=raw_input(\"Enter name of the 1st person: \")\n", - "Salary=float(raw_input(\"Enter Salary: \"))\n", - "if(Salary<=90000):\n", - " Tax=Salary*12.5/100\n", - "else:\n", - " Tax=Salary*18/100\n", - "print \"The tax amount for\", Name, \"is:\", Tax\n", - "Name=raw_input(\"Enter name of the 2nd person: \")\n", - "Salary=float(raw_input(\"Enter Salary: \"))\n", - "if(Salary<=90000):\n", - " Tax=Salary*12.5/100\n", - "else:\n", - " Tax=Salary*18/100\n", - "print \"The tax amount for\", Name, \"is:\", Tax" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of the 1st person: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Salary: 130000\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The tax amount for Rajkumar is: 23400.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of the 2nd person: Savithri\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Salary: 90000\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The tax amount for Savithri is: 11250.0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-tax2.cpp, Page no-209" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def CalculateTax(): #function for calculating tax\n", - " Name=[None]*25\n", - " Name=raw_input(\"Enter name of the person: \")\n", - " Salary=float(raw_input(\"Enter Salary: \"))\n", - " if(Salary<=90000):\n", - " Tax=Salary*12.5/100\n", - " else:\n", - " Tax=Salary*18/100\n", - " print \"The tax amount for\", Name, \"is:\", Tax\n", - "CalculateTax()\n", - "CalculateTax()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of the person: Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Salary: 130000\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The tax amount for Rajkumar is: 23400.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name of the person: Savithri\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Salary: 90000\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The tax amount for Savithri is: 11250.0\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-max1.cpp, Page no-210" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(x,y):\n", - " if x>y:\n", - " return x\n", - " else:\n", - " return y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "c=Max(a,b)\n", - "print \"max (a, b):\", c" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 20 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max (a, b): 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example.cpp, Page no-214" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(x,y):\n", - " if x>y:\n", - " return x\n", - " else:\n", - " return y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "c=Max(a,b)\n", - "print \"max (a, b):\", c" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 20 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max (a, b): 20\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-chart1.cpp, Page no-214" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PercentageChart(percentage):\n", - " for i in range(percentage/2):\n", - " sys.stdout.write('\\x3d')\n", - "print \"Sridevi : \",\n", - "PercentageChart(50)\n", - "print \"\\nRajkumar: \",\n", - "PercentageChart(84)\n", - "print \"\\nSavithri: \",\n", - "PercentageChart(79)\n", - "print \"\\nAnand : \",\n", - "PercentageChart(74)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sridevi : ========================= \n", - "Rajkumar: ========================================== \n", - "Savithri: ======================================= \n", - "Anand : =====================================\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-chart2.cpp, Page no-216" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PercentageChart(percentage):\n", - " for i in range(percentage/2):\n", - " sys.stdout.write('\\x3d')\n", - "m1, m2, m3, m4=[int(x) for x in raw_input(\"Enter percentage score of Sri, Raj, Savi, An: \").split()]\n", - "print \"Sridevi : \",\n", - "PercentageChart(m1)\n", - "print \"\\nRajkumar: \",\n", - "PercentageChart(m2)\n", - "print \"\\nSavithri: \",\n", - "PercentageChart(m3)\n", - "print \"\\nAnand : \",\n", - "PercentageChart(m4)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter percentage score of Sri, Raj, Savi, An: 52 92 83 67\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sridevi : ========================== \n", - "Rajkumar: ============================================== \n", - "Savithri: ========================================= \n", - "Anand : =================================\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-chart3.cpp, Page no-217" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PercentageChart(percentage, style):\n", - " for i in range(percentage/2):\n", - " sys.stdout.write(style)\n", - "m1, m2, m3, m4=[int(x) for x in raw_input(\"Enter percentage score of Sri, Raj, Savi, An: \").split()]\n", - "print \"Sridevi : \",\n", - "PercentageChart(m1, '*')\n", - "print \"\\nRajkumar: \",\n", - "PercentageChart(m2, '\\x3D')\n", - "print \"\\nSavithri: \",\n", - "PercentageChart(m3, '-')\n", - "print \"\\nAnand : \",\n", - "PercentageChart(m4, '!')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter percentage score of Sri, Raj, Savi, An: 55 92 83 67\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sridevi : *************************** \n", - "Rajkumar: ============================================== \n", - "Savithri: ----------------------------------------- \n", - "Anand : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ifact.cpp, Page no-218" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def fact(n):\n", - " if n==0:\n", - " result=1\n", - " else:\n", - " result=1\n", - " for i in range(2, n+1):\n", - " result*=i\n", - " return result\n", - "n=int(raw_input(\"Enter the number whose factorial is to be found: \"))\n", - "print \"The factorial of\", n, \"is\", fact(n)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number whose factorial is to be found: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The factorial of 5 is 120\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-namelen.cpp, Page no-219" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "name=[None]*20\n", - "name=raw_input(\"Enter your name: \")\n", - "Len=len(name) #string length\n", - "print \"Length of your name =\", Len" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your name: Rajkumar\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Length of your name = 8\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-maths.cpp, Page no-220" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "num=float(raw_input(\"Enter any factorial number: \"))\n", - "num1=math.ceil(num) #ceiling of number\n", - "num2=math.floor(num) #floor of number\n", - "print \"ceil(\",num,\") =\", num1\n", - "print \"floor(\",num,\") =\", num2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter any factorial number: 2.9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ceil( 2.9 ) = 3.0\n", - "floor( 2.9 ) = 2.0\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap1.cpp, Page no-221" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y): #pass by value swap\n", - " print \"Value of x and y in swap before exchange:\", x, y\n", - " t=x\n", - " x=y\n", - " y=t\n", - " print \"Value of x and y in swap after exchange:\", x, y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "swap(a,b)\n", - "print \"Value of a and b on swap a, b) in main():\", a, b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of x and y in swap before exchange: 10 20\n", - "Value of x and y in swap after exchange: 20 10\n", - "Value of a and b on swap a, b) in main(): 10 20\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap2.cpp, Pgae no-222" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y): #pass by address swap\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "a, b = swap(a, b)\n", - "print \"Value of a and b on swap( a, b ):\", a, b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of a and b on swap( a, b ): 20 10\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap3.cpp, Page no-224" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y): #pass by reference swap\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "a, b = swap(a, b)\n", - "print \"Value of a and b on swap( a, b):\", a, b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of a and b on swap( a, b): 20 10\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ref.cpp, Page no-226" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Max(x,y):\n", - " if x>y:\n", - " return x\n", - " else:\n", - " return y\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers : \").split()]\n", - "if Max(a,b)==a:\n", - " a=425\n", - "else:\n", - " b=425\n", - "print \"The value of a and b on execution of mx(x, y)=425;...\"\n", - "print \"a =\", a, \"b =\", b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers : 2 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The value of a and b on execution of mx(x, y)=425;...\n", - "a = 425 b = 1\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-defarg1.cpp, Page no-228" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PrintLine(ch='-', RepeatCount=70): #default arguments\n", - " for i in range(RepeatCount):\n", - " sys.stdout.write(ch)\n", - " print ''\n", - "PrintLine()\n", - "PrintLine('!')\n", - "PrintLine('*', 40)\n", - "PrintLine('R', 55)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "----------------------------------------------------------------------\n", - "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", - "****************************************\n", - "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-defarg2.cpp, Pgae no-229" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "def PrintLine(ch='-', RepeatCount=70, nLines=1): #default arguments\n", - " for i in range(nLines):\n", - " for i in range(RepeatCount):\n", - " sys.stdout.write(ch)\n", - " print ''\n", - "PrintLine()\n", - "PrintLine('!')\n", - "PrintLine('*', 40)\n", - "PrintLine('R', 55)\n", - "PrintLine('&', 25, 2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "----------------------------------------------------------------------\n", - "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", - "****************************************\n", - "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", - "&&&&&&&&&&&&&&&&&&&&&&&&&\n", - "&&&&&&&&&&&&&&&&&&&&&&&&&\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-square.cpp, Page no-230" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def sqr(num):\n", - " return num*num\n", - "n=float(raw_input(\"Enter a number: \"))\n", - "print \"Its square =\",sqr(n)\n", - "print \"sqr( 10 ) =\", sqr(10)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a number: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Its square = 25.0\n", - "sqr( 10 ) = 100\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap4.cpp, Page no-231" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#different swap functions\n", - "def swap_char(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "def swap_int(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "def swap_float(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch1, ch2 = swap_char(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "a, b = swap_int(a, b)\n", - "print \"On swapping :\", a,b\n", - "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", - "c, d = swap_float(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap5.cpp, Page no-233" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y): #function overloading\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch1, ch2 = swap(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "a, b = swap(a, b)\n", - "print \"On swapping :\", a,b\n", - "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", - "c, d = swap(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-show.cpp, Page no-234" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show(val): #function overloading\n", - " if(isinstance(val, int)):\n", - " print \"Integer:\", val\n", - " if(isinstance(val, float)):\n", - " print \"Double:\", val\n", - " if(isinstance(val, str)):\n", - " print \"String:\", val\n", - "show(420)\n", - "show(3.1415)\n", - "show(\"Hello World!\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Integer: 420\n", - "Double: 3.1415\n", - "String: Hello World!\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap6.cpp, Page no-236" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def swap(x, y):\n", - " t=x\n", - " x=y\n", - " y=t\n", - " return x, y\n", - "ch1, ch2=[str(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "ch1, ch2 = swap(ch1, ch2)\n", - "print \"On swapping :\", ch1, ch2\n", - "a, b=[int(x) for x in raw_input(\"Enter two characters : \").split()]\n", - "a, b = swap(a, b)\n", - "print \"On swapping :\", a,b\n", - "c, d=[float(x) for x in raw_input(\"Enter two floats : \").split()]\n", - "c, d = swap(c, d)\n", - "print \"On swapping :\", c, d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : R K\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : K R\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two characters : 5 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 10 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two floats : 20.5 99.5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On swapping : 99.5 20.5\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sort.cpp, Page no-237" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "(false, true)=(0, 1) #enum type\n", - "type =['false', 'true']\n", - "def swap(x, y):\n", - " x, y=y, x\n", - " return x, y\n", - "def BubbleSort(a, size):\n", - " swapped='true'\n", - " for i in range(size-1):\n", - " if swapped:\n", - " swapped='false'\n", - " for j in range((size-1)-i):\n", - " if a[j]>a[j+1]:\n", - " swapped='true'\n", - " a[j], a[j+1]=swap(a[j], a[j+1])\n", - " return a\n", - "a=[int]*25\n", - "print \"Program to sort elements...\"\n", - "size=int(raw_input(\"Enter the size of the integer vector : \"))\n", - "print \"Enter the elements of the integer vector...\"\n", - "for i in range(size):\n", - " a[i]=int(raw_input())\n", - "a=BubbleSort(a, size)\n", - "print \"Sorted Vector:\"\n", - "for i in range(size):\n", - " print a[i]," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Program to sort elements...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the size of the integer vector : 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the elements of the integer vector...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "8\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "9\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sorted Vector:\n", - "2 3 6 8 9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-linear.cpp, Page no-239" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def linear(arr, num):\n", - " for i in range(10):\n", - " if arr[i]==num:\n", - " return i\n", - " return -1\n", - "a=[10, 20, 5, 59, 63, 22, 18, 99, 11, 65] # 1-D array\n", - "element=int(raw_input(\"Enter the element to be searched: \"))\n", - "result=linear(a, element)\n", - "if result==-1:\n", - " print element, \"is not present in the array\"\n", - "else:\n", - " print element, \"is present at\",result, \"location in the array\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the element to be searched: 88\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "88 is not present in the array\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-funcstk.cpp, Page no-240" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Func(j, k):\n", - " print \"In the function the argument values are\", j, \"..\", k\n", - "i=99\n", - "Func(i+1, i)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "In the function the argument values are 100 .. 99\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-variable.cpp, Page no-241" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "g=100\n", - "def func1():\n", - " g=50\n", - " print \"Local variable g in func1() :\", g\n", - "def func2():\n", - " global g\n", - " print \"In func2() g is visible since it is global.\"\n", - " print \"Incremeting g in func...\"\n", - " g+=1\n", - "print \"In main g is visible here since g is global.\"\n", - "print \"Assigning 20 to g in main...\"\n", - "g=20\n", - "print \"Calling func1...\"\n", - "func1()\n", - "print \"func1 returned. g is\", g\n", - "print \"Calling func2...\"\n", - "func2()\n", - "print \"func2 returned. g is\", g" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "In main g is visible here since g is global.\n", - "Assigning 20 to g in main...\n", - "Calling func1...\n", - "Local variable g in func1() : 50\n", - "func1 returned. g is 20\n", - "Calling func2...\n", - "In func2() g is visible since it is global.\n", - "Incremeting g in func...\n", - "func2 returned. g is 21\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-regvar.cpp, Page no-244" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "i=int\n", - "name=raw_input(\"Enter a string: \")\n", - "print \"The reverse of the string is: \",\n", - "for i in range(len(name)-1, -1, -1):\n", - " sys.stdout.write(name[i])" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a string: mahatma\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The reverse of the string is: amtaham\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-count.cpp, Page no-245" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def PrintCount(Count=[1]):\n", - " print 'Count =', Count[0]\n", - " Count[0]=Count[0]+1\n", - "PrintCount()\n", - "PrintCount()\n", - "PrintCount()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Count = 1\n", - "Count = 2\n", - "Count = 3\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-add.cpp, Page no-247" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def add(*argc):#variable number of arguments to the function\n", - " result=0\n", - " for i in range(1, argc[0]+1):\n", - " result+=argc[i]\n", - " return result\n", - "sum1=add(3, 1, 2, 3)\n", - "print \"sum1 =\", sum1\n", - "sum2=add(1, 10)\n", - "print \"sum2 =\", sum2\n", - "sum3=add(0)\n", - "print \"sum3 =\", sum3" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sum1 = 6\n", - "sum2 = 10\n", - "sum3 = 0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sum.cpp, Page no-248" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def sum(*msg): #variable number of arguments to the function\n", - " total=0\n", - " i=1\n", - " while(msg[i]!=0):\n", - " total+=msg[i]\n", - " i+=1\n", - " print msg[0], total\n", - "sum(\"The total of 1+2+3+4 is\", 1, 2, 3, 4, 0)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The total of 1+2+3+4 is 10\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-rfact.cpp, Page no-250" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def fact(num): #recursive function\n", - " if num==0:\n", - " return 1\n", - " else:\n", - " return num*fact(num-1)\n", - "n=int(raw_input(\"Enter the number whose factorial is to be found: \"))\n", - "print \"The factorial of\", n, \"is\", fact(n)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number whose factorial is to be found: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The factorial of 5 is 120\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-hanoi.cpp, Page no-250" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def hanoi(n, left, mid, right): #recursive function\n", - " if n!=0:\n", - " hanoi(n-1, left, right, mid)\n", - " print 'Move disk', n, 'from', left, 'to', right\n", - " hanoi(n-1, mid, left, right)\n", - "source='L'\n", - "intermediate='C'\n", - "destination='R'\n", - "nvalue=int(raw_input('Enter number of disks: '))\n", - "hanoi(nvalue, source, intermediate, destination)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter number of disks: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Move disk 1 from L to R\n", - "Move disk 2 from L to C\n", - "Move disk 1 from R to C\n", - "Move disk 3 from L to R\n", - "Move disk 1 from C to L\n", - "Move disk 2 from C to R\n", - "Move disk 1 from L to R\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page no-254" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def power(x1, y1=None):\n", - " if (isinstance(y1, int)):\n", - " result=1.0\n", - " for i in range(1, y1+1):\n", - " result=result*x1\n", - " return result\n", - " else:\n", - " return x1*x1\n", - "x=float(raw_input(\"Enter the value of x: \"))\n", - "y=int(raw_input(\"Enter the value of y: \"))\n", - "print \"power(x, y) =\", power(x, y)\n", - "print \"power(x) =\", power(x)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the value of x: 9.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the value of y: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power(x, y) = 8145.0625\n", - "power(x) = 90.25\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions.ipynb deleted file mode 100755 index 88f0f80d..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions.ipynb +++ /dev/null @@ -1,1202 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:f7e7015d0709344fbfb1dd6045265378d35165eecd34afefa9304b97a8f3cb07" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 8-Structures and Unions" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student1.cpp, Page no-260" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class Student(Structure): #structure\n", - " roll_no =int\n", - " name =str\n", - " branch =str\n", - " marks=int\n", - "s1=Student() #object of struct student\n", - "print \"Enter data for student...\"\n", - "s1.roll_no=int(raw_input(\"Roll Number ? \"))\n", - "s1.name=raw_input(\"Name ? \")\n", - "s1.branch=raw_input(\"Branch ? \")\n", - "s1.marks=int(raw_input(\"Total Marks ? \"))\n", - "print \"Student Report\"\n", - "print \"--------------\"\n", - "print \"Roll Number:\", s1.roll_no\n", - "print \"Name:\", s1.name\n", - "print \"Branch:\", s1.branch\n", - "print \"Percentage:%f\" %(s1.marks*(100.0/325))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Mangala\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Computer\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total Marks ? 290\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Report\n", - "--------------\n", - "Roll Number: 5\n", - "Name: Mangala\n", - "Branch: Computer\n", - "Percentage:89.230769\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-days.cpp, Page no-262" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class date(Structure):\n", - " _fields_=[(\"day\", c_int),(\"month\", c_int),(\"year\",c_int)]\n", - "d1=date(14, 4, 1971)\n", - "d2=date(3, 7, 1996)\n", - "print \"Birth date:\",\n", - "print \"%s-%s-%s\" %(d1.day, d1.month, d1.year)\n", - "print \"Today date:\",\n", - "print \"%s-%s-%s\" %(d2.day, d2.month, d2.year)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth date: 14-4-1971\n", - "Today date: 3-7-1996\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student2.cpp, Page no-264" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class date(Structure):\n", - " _fields_=[(\"day\", c_int),(\"month\", c_int),(\"year\",c_int)]\n", - "class Student(Structure):\n", - " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"birthday\", date), (\"branch\", c_char*15),(\"marks\", c_int)]#nested structure\n", - "s1=Student()\n", - "print \"Enter data for student...\"\n", - "s1.roll_no=int(raw_input(\"Roll Number ? \"))\n", - "s1.name=raw_input(\"Name ? \")\n", - "birthday=date(0, 0, 0)\n", - "print \"Enter date of birth : \",\n", - "d, m, y=[int(x) for x in raw_input().split()]\n", - "birthday.day=d\n", - "birthday.month=m\n", - "birthday.year=y\n", - "s1.birthday=birthday\n", - "s1.branch=raw_input(\"Branch ? \")\n", - "s1.marks=int(raw_input(\"Total Marks ? \"))\n", - "print \"Student Report\"\n", - "print \"--------------\"\n", - "print \"Roll Number:\", s1.roll_no\n", - "print \"Name:\", s1.name\n", - "print \"%s-%s-%s\" %(s1.birthday.day, s1.birthday.month, s1.birthday.year)\n", - "print \"Branch:\", s1.branch\n", - "print \"Percentage:%f\" %(s1.marks*(100.0/325))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 9\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Savithri\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter date of birth : " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2 2 1972\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Electrical\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total Marks ? 295\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Student Report\n", - "--------------\n", - "Roll Number: 9\n", - "Name: Savithri\n", - "2-2-1972\n", - "Branch: Electrical\n", - "Percentage:90.769231\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student3.cpp, Page no-267" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class Student(Structure):\n", - " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", - "s=[]\n", - "n=int(raw_input(\"How many students to be processed : \"))\n", - "for i in range(n):\n", - " print \"Enter data for student\", i+1, \"...\"\n", - " r=int(raw_input(\"Roll Number ? \"))\n", - " name=raw_input(\"Name ? \")\n", - " b=raw_input(\"Branch ? \")\n", - " m=int(raw_input(\"Total marks ? \"))\n", - " s.append(Student(r, name, b, m)) #array of structure objects\n", - "print \"Students Report\"\n", - "print \"--------------\"\n", - "for i in range(n):\n", - " print \"Roll Number:\", s[i].roll_no\n", - " print \"Name:\", s[i].name\n", - " print \"Branch:\", s[i].branch\n", - " print \"Percentage: %f\" %(s[i].marks*(100.0/325))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many students to be processed : 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 1 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Mangala\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Computer\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 290\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 2 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 9\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Shivakumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Electronics\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 250\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Students Report\n", - "--------------\n", - "Roll Number: 5\n", - "Name: Mangala\n", - "Branch: Computer\n", - "Percentage: 89.230769\n", - "Roll Number: 9\n", - "Name: Shivakumar\n", - "Branch: Electronics\n", - "Percentage: 76.923077\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student4.cpp, Page no-269" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class Student(Structure):\n", - " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", - "STUDENTS_COUNT=5\n", - "s=[]\n", - "s.append(Student(2, 'Tejaswi', 'CS', 285))#initialization of array of structures\n", - "s.append(Student(3, 'Laxmi', 'IT', 215))\n", - "s.append(Student(5, 'Bhavani', 'Electronics', 250))\n", - "s.append(Student(7, 'Anil', 'Civil', 215))\n", - "s.append(Student(9, 'Savithri', 'Electrical', 290))\n", - "print \"Students Report\"\n", - "print \"--------------\"\n", - "for i in range(STUDENTS_COUNT):\n", - " print \"Roll Number:\", s[i].roll_no\n", - " print \"Name:\", s[i].name\n", - " print \"Branch:\", s[i].branch\n", - " print \"Percentage: %0.4f\" %(s[i].marks*(100.0/325))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Students Report\n", - "--------------\n", - "Roll Number: 2\n", - "Name: Tejaswi\n", - "Branch: CS\n", - "Percentage: 87.6923\n", - "Roll Number: 3\n", - "Name: Laxmi\n", - "Branch: IT\n", - "Percentage: 66.1538\n", - "Roll Number: 5\n", - "Name: Bhavani\n", - "Branch: Electronics\n", - "Percentage: 76.9231\n", - "Roll Number: 7\n", - "Name: Anil\n", - "Branch: Civil\n", - "Percentage: 66.1538\n", - "Roll Number: 9\n", - "Name: Savithri\n", - "Branch: Electrical\n", - "Percentage: 89.2308\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student5.cpp, Page no-271" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class Student(Structure):\n", - " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", - "def read():\n", - " dull=Student()\n", - " dull.roll_no=int(raw_input(\"Roll Number ? \"))\n", - " dull.name=raw_input(\"Name ? \")\n", - " dull.branch=raw_input(\"Branch ? \")\n", - " dull.marks=int(raw_input(\"Total marks ? \"))\n", - " return dull #returning structure object\n", - "def show(genius): #passing object of structure\n", - " print \"Roll Number:\", genius.roll_no\n", - " print \"Name:\", genius.name\n", - " print \"Branch:\", genius.branch\n", - " print \"Percentage: %0.4f\" %(genius.marks*(100.0/325))\n", - "s=[]\n", - "n=int(raw_input(\"How many students to be processed : \"))\n", - "for i in range(n):\n", - " print \"Enter data for student\", i+1, \"...\"\n", - " s.append(read())\n", - "print \"Students Report\"\n", - "print \"--------------\"\n", - "for i in range(n):\n", - " show(s[i])" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many students to be processed : 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 1 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Smrithi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Genetics\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 295\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 2 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Bindhu\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? MCA\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 300\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Students Report\n", - "--------------\n", - "Roll Number: 3\n", - "Name: Smrithi\n", - "Branch: Genetics\n", - "Percentage: 90.7692\n", - "Roll Number: 10\n", - "Name: Bindhu\n", - "Branch: MCA\n", - "Percentage: 92.3077\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student6.cpp, Page no-273" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class Student(Structure):\n", - " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", - "def HighestMarks(s, count): #passing array of structures\n", - " big=s[0].marks\n", - " for i in range(1, count):\n", - " if s[i].marks>big:\n", - " big=s[i].marks\n", - " index=i\n", - " return index\n", - "def read():\n", - " dull=Student()\n", - " dull.roll_no=int(raw_input(\"Roll Number ? \"))\n", - " dull.name=raw_input(\"Name ? \")\n", - " dull.branch=raw_input(\"Branch ? \")\n", - " dull.marks=int(raw_input(\"Total marks ? \"))\n", - " return dull\n", - "def show(genius):\n", - " print \"Roll Number:\", genius.roll_no\n", - " print \"Name:\", genius.name\n", - " print \"Branch:\", genius.branch\n", - " print \"Percentage: %0.4f\" %(genius.marks*(100.0/325))\n", - "s=[]\n", - "n=int(raw_input(\"How many students to be processed : \"))\n", - "for i in range(n):\n", - " print \"Enter data for student\", i+1, \"...\"\n", - " s.append(read())\n", - "print \"Students Report\"\n", - "print \"--------------\"\n", - "Id=HighestMarks(s, n)\n", - "print \"Details of student scoring higest marks...\"\n", - "show(s[Id])" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many students to be processed : 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 1 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Smrithi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Genetics\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 295\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 2 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 15\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Computer\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 315\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 3 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 7\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Laxmi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Electronics\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 255\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Students Report\n", - "--------------\n", - "Details of student scoring higest marks...\n", - "Roll Number: 15\n", - "Name: Rajkumar\n", - "Branch: Computer\n", - "Percentage: 96.9231\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex.cpp, Page no-278" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "import sys\n", - "import math\n", - "class Complex(Structure):\n", - " x=int\n", - " y=int\n", - " def read(self):\n", - " self.x=int(raw_input(\"Real part? \"))\n", - " self.y=int(raw_input(\"Imaginary part? \"))\n", - " def show(self, msg):\n", - " print msg, self.x,\n", - " if self.y<0:\n", - " sys.stdout.write('-i')\n", - " else:\n", - " sys.stdout.write('+i')\n", - " print math.fabs(self.y)\n", - " def add(self, c2):\n", - " self.x+=c2.x\n", - " self.y+=c2.y\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter complex number c1...\"\n", - "c1.read()\n", - "print \"Enter complex number c2...\"\n", - "c2.read()\n", - "c1.show('c1 =')\n", - "c2.show('c2 =')\n", - "c3=c1\n", - "c3.add(c2)\n", - "c3.show('c3 = c1 + c2 =')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter complex number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imaginary part? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter complex number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imaginary part? 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c1 = 1+i 2.0\n", - "c2 = 3+i 4.0\n", - "c3 = c1 + c2 = 4+i 6.0\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-emp.cpp, Page no-279" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class employee(Structure): #structure member functions\n", - " name=str\n", - " ID=long\n", - " dept=str\n", - " salary=float\n", - " def read(self):\n", - " self.name=raw_input(\"Employee Name: \")\n", - " self.ID=long(raw_input(\"Employee ID: \"))\n", - " self.dept=raw_input(\"Department: \")\n", - " self.salary=float(raw_input(\"Salary: \"))\n", - " def show(self):\n", - " print \"Employee Name:\", self.name\n", - " print \"Employee ID:\", self.ID\n", - " print \"Department:\", self.dept\n", - " print \"Salary:\", self.salary\n", - "emp=employee()\n", - "print \"Enter employee data:\"\n", - "emp.read()\n", - "print \"\\n****Employee Record****\"\n", - "emp.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter employee data:\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Employee Name: Vishwanathan\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Employee ID: 953\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Department: Finance\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Salary: 18500\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "****Employee Record****\n", - "Employee Name: Vishwanathan\n", - "Employee ID: 953\n", - "Department: Finance\n", - "Salary: 18500.0\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-union.cpp, Page no-283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "#Creates a union\n", - "class Strings(Union):\n", - " _fields_ = [(\"filename\",c_char*200),\n", - " (\"output\", c_char*400)]\n", - "s=Strings()\n", - "s.filename=\"/cdacb/usrl/raj/oops/mcrokernel/pserver.cpp\"\n", - "print \"filename:\", s.filename\n", - "s.output=\"OOPs is a most complex entity ever created by humans\"\n", - "print \"output:\", s.output\n", - "print \"Size of union Strings =\", sizeof(Strings)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "filename: /cdacb/usrl/raj/oops/mcrokernel/pserver.cpp\n", - "output: OOPs is a most complex entity ever created by humans\n", - "Size of union Strings = 400\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sudiff.cpp, Page no-284" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from collections import namedtuple\n", - "from ctypes import *\n", - "class struct(Structure):\n", - " _fields_ = [(\"name\",c_char*25), (\"idno\", c_int), (\"salary\", c_float)]\n", - "emp=struct()\n", - "class union(Union):\n", - " _fields_ = [(\"name\",c_char*25), (\"idno\", c_int), (\"salary\", c_float)]\n", - "desc=union()\n", - "print \"The size of the structure is\", sizeof(emp)\n", - "print \"The size of the union is\", sizeof(desc)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The size of the structure is 36\n", - "The size of the union is 28\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-uaccess.cpp, Page no-285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class emp(Union):\n", - " _fields_=[(\"name\",c_char*25), (\"idno\", c_int), (\"salary\", c_float)]\n", - "def show(e):\n", - " print \"Employee Details...\"\n", - " print \"The name is %s\" %e.name\n", - " print \"The idno is %d\" %e.idno\n", - " print \"The salary is %g\" %e.salary\n", - "e=emp()\n", - "e.name=\"Rajkumar\"\n", - "show(e)\n", - "e.idno=10\n", - "show(e)\n", - "e.salary=9000\n", - "show(e)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Employee Details...\n", - "The name is Rajkumar\n", - "The idno is 1802133842\n", - "The salary is 2.83348e+26\n", - "Employee Details...\n", - "The name is \n", - "\n", - "The idno is 10\n", - "The salary is 1.4013e-44\n", - "Employee Details...\n", - "The name is \n", - "The idno is 1175232512\n", - "The salary is 9000\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-uscope.cpp, Page no-286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "#Creates a union\n", - "class union(Union):\n", - " _fields_ = [(\"i\", c_int), \n", - " (\"c\", c_char), \n", - " (\"f\", c_float)]\n", - "u=union()\n", - "u.i=10\n", - "u.c='9'\n", - "u.f=4.5\n", - "print \"The value of i is\", u.i\n", - "print \"The value of c is\", u.c\n", - "print \"The value of f is\", u.f" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The value of i is 1083179008\n", - "The value of c is \u0000\n", - "The value of f is 4.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-share.cpp, Page no-289" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from collections import namedtuple\n", - "from ctypes import *\n", - "import sys\n", - "class with_bits(Structure):\n", - " _fields_ = [(\"first\", c_uint), (\"second\", c_uint)]\n", - "class union(Union):\n", - " _fields_=[(\"b\", with_bits), (\"i\", c_int)]\n", - "i=0\n", - "u=union()\n", - "print \"On i=0: b.first =\",u.b.first,\"b.second =\", u.b.second\n", - "u.b.first=9\n", - "print \"b.first =9:\", \n", - "print \"b.first =\", u.b.first, \"b.second =\", u.b.second" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On i=0: b.first = 0 b.second = 0\n", - "b.first =9: b.first = 9 b.second = 0\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions_1.ipynb deleted file mode 100755 index 709caeac..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter8-StructuresAndUnions_1.ipynb +++ /dev/null @@ -1,1202 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:251f1d4632e149ef1bebd9159015f741bede61e517916f81edb5cc7bbd18c1c7" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 8-Structures and Unions" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student1.cpp, Page no-260" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure\n", - "class Student(Structure): #structure\n", - " roll_no =int\n", - " name =str\n", - " branch =str\n", - " marks=int\n", - "s1=Student() #object of struct student\n", - "print \"Enter data for student...\"\n", - "s1.roll_no=int(raw_input(\"Roll Number ? \"))\n", - "s1.name=raw_input(\"Name ? \")\n", - "s1.branch=raw_input(\"Branch ? \")\n", - "s1.marks=int(raw_input(\"Total Marks ? \"))\n", - "print \"Student Report\"\n", - "print \"--------------\"\n", - "print \"Roll Number:\", s1.roll_no\n", - "print \"Name:\", s1.name\n", - "print \"Branch:\", s1.branch\n", - "print \"Percentage:%f\" %(s1.marks*(100.0/325))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Mangala\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Computer\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total Marks ? 290\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Student Report\n", - "--------------\n", - "Roll Number: 5\n", - "Name: Mangala\n", - "Branch: Computer\n", - "Percentage:89.230769\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-days.cpp, Page no-262" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure, c_int\n", - "class date(Structure):\n", - " _fields_=[(\"day\", c_int),(\"month\", c_int),(\"year\",c_int)]\n", - "d1=date(14, 4, 1971)\n", - "d2=date(3, 7, 1996)\n", - "print \"Birth date:\",\n", - "print \"%s-%s-%s\" %(d1.day, d1.month, d1.year)\n", - "print \"Today date:\",\n", - "print \"%s-%s-%s\" %(d2.day, d2.month, d2.year)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth date: 14-4-1971\n", - "Today date: 3-7-1996\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student2.cpp, Page no-264" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure, c_int, c_char\n", - "class date(Structure):\n", - " _fields_=[(\"day\", c_int),(\"month\", c_int),(\"year\",c_int)]\n", - "class Student(Structure):\n", - " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"birthday\", date), (\"branch\", c_char*15),(\"marks\", c_int)]#nested structure\n", - "s1=Student()\n", - "print \"Enter data for student...\"\n", - "s1.roll_no=int(raw_input(\"Roll Number ? \"))\n", - "s1.name=raw_input(\"Name ? \")\n", - "birthday=date(0, 0, 0)\n", - "print \"Enter date of birth : \",\n", - "d, m, y=[int(x) for x in raw_input().split()]\n", - "birthday.day=d\n", - "birthday.month=m\n", - "birthday.year=y\n", - "s1.birthday=birthday\n", - "s1.branch=raw_input(\"Branch ? \")\n", - "s1.marks=int(raw_input(\"Total Marks ? \"))\n", - "print \"Student Report\"\n", - "print \"--------------\"\n", - "print \"Roll Number:\", s1.roll_no\n", - "print \"Name:\", s1.name\n", - "print \"%s-%s-%s\" %(s1.birthday.day, s1.birthday.month, s1.birthday.year)\n", - "print \"Branch:\", s1.branch\n", - "print \"Percentage:%f\" %(s1.marks*(100.0/325))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 9\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Savithri\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter date of birth : " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2 2 1972\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Electrical\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total Marks ? 295\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Student Report\n", - "--------------\n", - "Roll Number: 9\n", - "Name: Savithri\n", - "2-2-1972\n", - "Branch: Electrical\n", - "Percentage:90.769231\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student3.cpp, Page no-267" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure, c_int, c_char\n", - "class Student(Structure):\n", - " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", - "s=[]\n", - "n=int(raw_input(\"How many students to be processed : \"))\n", - "for i in range(n):\n", - " print \"Enter data for student\", i+1, \"...\"\n", - " r=int(raw_input(\"Roll Number ? \"))\n", - " name=raw_input(\"Name ? \")\n", - " b=raw_input(\"Branch ? \")\n", - " m=int(raw_input(\"Total marks ? \"))\n", - " s.append(Student(r, name, b, m)) #array of structure objects\n", - "print \"Students Report\"\n", - "print \"--------------\"\n", - "for i in range(n):\n", - " print \"Roll Number:\", s[i].roll_no\n", - " print \"Name:\", s[i].name\n", - " print \"Branch:\", s[i].branch\n", - " print \"Percentage: %f\" %(s[i].marks*(100.0/325))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many students to be processed : 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 1 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Mangala\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Computer\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 290\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 2 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 9\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Shivakumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Electronics\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 250\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Students Report\n", - "--------------\n", - "Roll Number: 5\n", - "Name: Mangala\n", - "Branch: Computer\n", - "Percentage: 89.230769\n", - "Roll Number: 9\n", - "Name: Shivakumar\n", - "Branch: Electronics\n", - "Percentage: 76.923077\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student4.cpp, Page no-269" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure, c_int, c_char\n", - "class Student(Structure):\n", - " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", - "STUDENTS_COUNT=5\n", - "s=[]\n", - "s.append(Student(2, 'Tejaswi', 'CS', 285))#initialization of array of structures\n", - "s.append(Student(3, 'Laxmi', 'IT', 215))\n", - "s.append(Student(5, 'Bhavani', 'Electronics', 250))\n", - "s.append(Student(7, 'Anil', 'Civil', 215))\n", - "s.append(Student(9, 'Savithri', 'Electrical', 290))\n", - "print \"Students Report\"\n", - "print \"--------------\"\n", - "for i in range(STUDENTS_COUNT):\n", - " print \"Roll Number:\", s[i].roll_no\n", - " print \"Name:\", s[i].name\n", - " print \"Branch:\", s[i].branch\n", - " print \"Percentage: %0.4f\" %(s[i].marks*(100.0/325))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Students Report\n", - "--------------\n", - "Roll Number: 2\n", - "Name: Tejaswi\n", - "Branch: CS\n", - "Percentage: 87.6923\n", - "Roll Number: 3\n", - "Name: Laxmi\n", - "Branch: IT\n", - "Percentage: 66.1538\n", - "Roll Number: 5\n", - "Name: Bhavani\n", - "Branch: Electronics\n", - "Percentage: 76.9231\n", - "Roll Number: 7\n", - "Name: Anil\n", - "Branch: Civil\n", - "Percentage: 66.1538\n", - "Roll Number: 9\n", - "Name: Savithri\n", - "Branch: Electrical\n", - "Percentage: 89.2308\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student5.cpp, Page no-271" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure, c_int, c_char\n", - "class Student(Structure):\n", - " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", - "def read():\n", - " dull=Student()\n", - " dull.roll_no=int(raw_input(\"Roll Number ? \"))\n", - " dull.name=raw_input(\"Name ? \")\n", - " dull.branch=raw_input(\"Branch ? \")\n", - " dull.marks=int(raw_input(\"Total marks ? \"))\n", - " return dull #returning structure object\n", - "def show(genius): #passing object of structure\n", - " print \"Roll Number:\", genius.roll_no\n", - " print \"Name:\", genius.name\n", - " print \"Branch:\", genius.branch\n", - " print \"Percentage: %0.4f\" %(genius.marks*(100.0/325))\n", - "s=[]\n", - "n=int(raw_input(\"How many students to be processed : \"))\n", - "for i in range(n):\n", - " print \"Enter data for student\", i+1, \"...\"\n", - " s.append(read())\n", - "print \"Students Report\"\n", - "print \"--------------\"\n", - "for i in range(n):\n", - " show(s[i])" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many students to be processed : 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 1 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Smrithi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Genetics\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 295\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 2 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 10\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Bindhu\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? MCA\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 300\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Students Report\n", - "--------------\n", - "Roll Number: 3\n", - "Name: Smrithi\n", - "Branch: Genetics\n", - "Percentage: 90.7692\n", - "Roll Number: 10\n", - "Name: Bindhu\n", - "Branch: MCA\n", - "Percentage: 92.3077\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-student6.cpp, Page no-273" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure, c_int, c_char\n", - "class Student(Structure):\n", - " _fields_=[(\"roll_no\", c_int), (\"name\", c_char*25), (\"branch\", c_char*15),(\"marks\", c_int)]\n", - "def HighestMarks(s, count): #passing array of structures\n", - " big=s[0].marks\n", - " for i in range(1, count):\n", - " if s[i].marks>big:\n", - " big=s[i].marks\n", - " index=i\n", - " return index\n", - "def read():\n", - " dull=Student()\n", - " dull.roll_no=int(raw_input(\"Roll Number ? \"))\n", - " dull.name=raw_input(\"Name ? \")\n", - " dull.branch=raw_input(\"Branch ? \")\n", - " dull.marks=int(raw_input(\"Total marks ? \"))\n", - " return dull\n", - "def show(genius):\n", - " print \"Roll Number:\", genius.roll_no\n", - " print \"Name:\", genius.name\n", - " print \"Branch:\", genius.branch\n", - " print \"Percentage: %0.4f\" %(genius.marks*(100.0/325))\n", - "s=[]\n", - "n=int(raw_input(\"How many students to be processed : \"))\n", - "for i in range(n):\n", - " print \"Enter data for student\", i+1, \"...\"\n", - " s.append(read())\n", - "print \"Students Report\"\n", - "print \"--------------\"\n", - "Id=HighestMarks(s, n)\n", - "print \"Details of student scoring higest marks...\"\n", - "show(s[Id])" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many students to be processed : 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 1 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Smrithi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Genetics\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 295\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 2 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 15\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Rajkumar\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Computer\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 315\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for student 3 ...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Roll Number ? 7\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name ? Laxmi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Branch ? Electronics\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total marks ? 255\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Students Report\n", - "--------------\n", - "Details of student scoring higest marks...\n", - "Roll Number: 15\n", - "Name: Rajkumar\n", - "Branch: Computer\n", - "Percentage: 96.9231\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex.cpp, Page no-278" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure\n", - "import sys\n", - "import math\n", - "class Complex(Structure):\n", - " x=int\n", - " y=int\n", - " def read(self):\n", - " self.x=int(raw_input(\"Real part? \"))\n", - " self.y=int(raw_input(\"Imaginary part? \"))\n", - " def show(self, msg):\n", - " print msg, self.x,\n", - " if self.y<0:\n", - " sys.stdout.write('-i')\n", - " else:\n", - " sys.stdout.write('+i')\n", - " print math.fabs(self.y)\n", - " def add(self, c2):\n", - " self.x+=c2.x\n", - " self.y+=c2.y\n", - "c1=Complex()\n", - "c2=Complex()\n", - "c3=Complex()\n", - "print \"Enter complex number c1...\"\n", - "c1.read()\n", - "print \"Enter complex number c2...\"\n", - "c2.read()\n", - "c1.show('c1 =')\n", - "c2.show('c2 =')\n", - "c3=c1\n", - "c3.add(c2)\n", - "c3.show('c3 = c1 + c2 =')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter complex number c1...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part? 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imaginary part? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter complex number c2...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Real part? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Imaginary part? 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c1 = 1+i 2.0\n", - "c2 = 3+i 4.0\n", - "c3 = c1 + c2 = 4+i 6.0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-emp.cpp, Page no-279" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure\n", - "class employee(Structure): #structure member functions\n", - " name=str\n", - " ID=long\n", - " dept=str\n", - " salary=float\n", - " def read(self):\n", - " self.name=raw_input(\"Employee Name: \")\n", - " self.ID=long(raw_input(\"Employee ID: \"))\n", - " self.dept=raw_input(\"Department: \")\n", - " self.salary=float(raw_input(\"Salary: \"))\n", - " def show(self):\n", - " print \"Employee Name:\", self.name\n", - " print \"Employee ID:\", self.ID\n", - " print \"Department:\", self.dept\n", - " print \"Salary:\", self.salary\n", - "emp=employee()\n", - "print \"Enter employee data:\"\n", - "emp.read()\n", - "print \"\\n****Employee Record****\"\n", - "emp.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter employee data:\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Employee Name: Vishwanathan\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Employee ID: 953\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Department: Finance\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Salary: 18500\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "****Employee Record****\n", - "Employee Name: Vishwanathan\n", - "Employee ID: 953\n", - "Department: Finance\n", - "Salary: 18500.0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-union.cpp, Page no-283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Union, c_char, sizeof\n", - "#Creates a union\n", - "class Strings(Union):\n", - " _fields_ = [(\"filename\",c_char*200),\n", - " (\"output\", c_char*400)]\n", - "s=Strings()\n", - "s.filename=\"/cdacb/usrl/raj/oops/mcrokernel/pserver.cpp\"\n", - "print \"filename:\", s.filename\n", - "s.output=\"OOPs is a most complex entity ever created by humans\"\n", - "print \"output:\", s.output\n", - "print \"Size of union Strings =\", sizeof(Strings)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "filename: /cdacb/usrl/raj/oops/mcrokernel/pserver.cpp\n", - "output: OOPs is a most complex entity ever created by humans\n", - "Size of union Strings = 400\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sudiff.cpp, Page no-284" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from collections import namedtuple\n", - "from ctypes import c_char, c_int, c_float, sizeof, Structure, Union\n", - "class struct(Structure):\n", - " _fields_ = [(\"name\",c_char*25), (\"idno\", c_int), (\"salary\", c_float)]\n", - "emp=struct()\n", - "class union(Union):\n", - " _fields_ = [(\"name\",c_char*25), (\"idno\", c_int), (\"salary\", c_float)]\n", - "desc=union()\n", - "print \"The size of the structure is\", sizeof(emp)\n", - "print \"The size of the union is\", sizeof(desc)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The size of the structure is 36\n", - "The size of the union is 28\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-uaccess.cpp, Page no-285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Union, c_int, c_char, c_float\n", - "class emp(Union):\n", - " _fields_=[(\"name\",c_char*25), (\"idno\", c_int), (\"salary\", c_float)]\n", - "def show(e):\n", - " print \"Employee Details...\"\n", - " print \"The name is %s\" %e.name\n", - " print \"The idno is %d\" %e.idno\n", - " print \"The salary is %g\" %e.salary\n", - "e=emp()\n", - "e.name=\"Rajkumar\"\n", - "show(e)\n", - "e.idno=10\n", - "show(e)\n", - "e.salary=9000\n", - "show(e)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Employee Details...\n", - "The name is Rajkumar\n", - "The idno is 1802133842\n", - "The salary is 2.83348e+26\n", - "Employee Details...\n", - "The name is \n", - "\n", - "The idno is 10\n", - "The salary is 1.4013e-44\n", - "Employee Details...\n", - "The name is \n", - "The idno is 1175232512\n", - "The salary is 9000\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-uscope.cpp, Page no-286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Union, c_int, c_char, c_float\n", - "#Creates a union\n", - "class union(Union):\n", - " _fields_ = [(\"i\", c_int), \n", - " (\"c\", c_char), \n", - " (\"f\", c_float)]\n", - "u=union()\n", - "u.i=10\n", - "u.c='9'\n", - "u.f=4.5\n", - "print \"The value of i is\", u.i\n", - "print \"The value of c is\", u.c\n", - "print \"The value of f is\", u.f" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The value of i is 1083179008\n", - "The value of c is \u0000\n", - "The value of f is 4.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-share.cpp, Page no-289" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from collections import namedtuple\n", - "from ctypes import Structure, c_uint, c_int, Union\n", - "import sys\n", - "class with_bits(Structure):\n", - " _fields_ = [(\"first\", c_uint), (\"second\", c_uint)]\n", - "class union(Union):\n", - " _fields_=[(\"b\", with_bits), (\"i\", c_int)]\n", - "i=0\n", - "u=union()\n", - "print \"On i=0: b.first =\",u.b.first,\"b.second =\", u.b.second\n", - "u.b.first=9\n", - "print \"b.first =9:\", \n", - "print \"b.first =\", u.b.first, \"b.second =\", u.b.second" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "On i=0: b.first = 0 b.second = 0\n", - "b.first =9: b.first = 9 b.second = 0\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding.ipynb deleted file mode 100755 index e3624032..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding.ipynb +++ /dev/null @@ -1,1663 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:de9763f2876edfb1bdd8ccce73ff66e5216f2e4ec3f157c8b54ef1f8d480abb5" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 9- Pointers and Runtime Binding" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-getaddr.cpp, Page no-293" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "a=c_int(100)\n", - "b=c_int(200)\n", - "c=c_int(300)\n", - "print 'Address', hex(id(pointer(a))), 'contains value', a.value #address of a pointer\n", - "print 'Address', hex(id(pointer(b))), 'contains value', b.value\n", - "print 'Address', hex(id(pointer(c))), 'contains value', c.value" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Address 0x3643348L contains value 100\n", - "Address 0x36434c8L contains value 200\n", - "Address 0x3643348L contains value 300\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-initptr.cpp, Page no-296" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "var1=c_int(10)\n", - "var2=c_int(20)\n", - "iptr=pointer(var1)\n", - "print 'Address and contents of var1 is', hex(id(iptr)), 'and', iptr[0]\n", - "iptr=pointer(var2)\n", - "print 'Address and contents of var2 is', hex(id(iptr)), 'and', iptr[0]\n", - "iptr[0]=125\n", - "var1=iptr[0]*1" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Address and contents of var1 is 0x36434c8L and 10\n", - "Address and contents of var2 is 0x3643648L and 20\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap.cpp, Page no-298" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "def swap(pa, pb):\n", - " temp=pa[0]\n", - " pa[0]=pb[0]\n", - " pb[0]=temp\n", - "a=float(raw_input(\"Enter real number : \"))\n", - "b=float(raw_input(\"Enter real number : \"))\n", - "a=c_float(a)\n", - "b=c_float(b)\n", - "pa=pointer(a)\n", - "pb=pointer(b)\n", - "swap(pa, pb)\n", - "print \"After swapping......\"\n", - "print \"a contains %0.1f\" %(a.value)\n", - "print \"b contains %0.1f\" %(b.value)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter real number : 10.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter real number : 20.9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "After swapping......\n", - "a contains 20.9\n", - "b contains 10.5\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-voidptr.cpp, Page no-300" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "i1=c_int(100)\n", - "f1=c_float(200.5)\n", - "vptr=pointer(i1)\n", - "print \"i1 contains\", vptr[0] #value stored in address pointed by vptr\n", - "vptr=pointer(f1)\n", - "print \"i1 contains\", vptr[0]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "i1 contains 100\n", - "i1 contains 200.5\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ptrarr1.cpp, Page no-303" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "a=[int]\n", - "n=int(raw_input(\"Size of array? \"))\n", - "print \"Array elements ?\"\n", - "for i in range(n):\n", - " a.append(int(raw_input()))\n", - "ptr=a\n", - "small=ptr[1]\n", - "for i in range(2, n+1):\n", - " if small>ptr[i]:\n", - " small=ptr[i]\n", - " i+=1 #pointer arithmetic\n", - "print \"Smallest element is\", small" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Size of array? 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Array elements ?\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Smallest element is 1\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-newhand.cpp, Page no-305" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "size=int(raw_input(\"How many bytes to be allocated: \"))\n", - "try:\n", - " data=[int]*size\n", - " print \"Memory allocation success, address =\", hex(id(data))\n", - "except:\n", - " print \"Could not allocate. Bye...\"\n", - "del data" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many bytes to be allocated: 300\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Memory allocation success, address = 0x3716188L\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ptr2ptr.cpp, Page no-306" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "data=c_int()\n", - "iptr=pointer(data)\n", - "ptriptr=pointer(iptr) #pointer to a pointer\n", - "iptr[0]=100\n", - "print \"The variable 'data' contains\", data.value\n", - "ptriptr[0][0]=200\n", - "print \"The variable 'data' contains\", data.value\n", - "data.value=300\n", - "print \"ptriptr is pointing to\", ptriptr[0][0]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The variable 'data' contains 100\n", - "The variable 'data' contains 200\n", - "ptriptr is pointing to 300\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-big.cpp, Page no-308" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "def FindBig(pa, pb, pbig):\n", - " if pa[0]>pb[0]:\n", - " pbig[0]=pa[0]\n", - " else:\n", - " pbig[0]=pb[0]\n", - " return pbig\n", - "a=c_int()\n", - "b=c_int()\n", - "big=pointer(c_int())\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers: \").split()]\n", - "pa=[a]#pointer to a\n", - "pb=[b]#pointer to b\n", - "big=FindBig(pa, pb, big)\n", - "print \"The value as obtained from the pointer:\", big[0]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers: 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The value as obtained from the pointer: 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sortptr.cpp, Page no-309" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "def SortByPtrExchange(person, n):\n", - " for i in range(n-1):\n", - " flag=1\n", - " for j in range(n-1-i):\n", - " if person[j]>person[j+1]:\n", - " flag=0\n", - " temp=person[j]\n", - " person[j]=person[j+1]\n", - " person[j+1]=temp\n", - " if flag:\n", - " break\n", - "n=c_int(0)\n", - "choice=c_char_p()\n", - "person=[[c_char_p]*100]*40\n", - "while(1):\n", - " person[n.value]=raw_input(\"Enter name: \")\n", - " n.value+=1\n", - " choice=raw_input(\"Enter another(y/n)? \")\n", - " if choice!='y':\n", - " break\n", - "print \"Unsorted list: \"\n", - "for i in range(n.value):\n", - " print person[i]\n", - "SortByPtrExchange(person, n.value)\n", - "print \"Sorted list: \"\n", - "for i in range(n.value):\n", - " print person[i]\n", - "for i in range(n.value):\n", - " del person[i]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter another(y/n)? y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name: Prasad\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter another(y/n)? y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name: Prakash\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter another(y/n)? y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name: Sudeep\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter another(y/n)? y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name: Anand\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter another(y/n)? n\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Unsorted list: \n", - "Tejaswi\n", - "Prasad\n", - "Prakash\n", - "Sudeep\n", - "Anand\n", - "Sorted list: \n", - "Anand\n", - "Prakash\n", - "Prasad\n", - "Sudeep\n", - "Tejaswi\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-show.cpp, Page no-311" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show(a, m):\n", - " c=a\n", - " for i in range(m):\n", - " for j in range(3):\n", - " print c[i][j],\n", - " print \"\"\n", - "c=[(1, 2, 3), (4, 5, 6)] #initialization of a 2D array\n", - "show(c, 2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1 2 3 \n", - "4 5 6 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-matrix.cpp, Page no-313" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MatAlloc(row, col):\n", - " p=[[int]*col]*row #dynamic array\n", - " return p\n", - "def MatRelease(p, row):\n", - " for i in range(row):\n", - " del p[i]\n", - " del p\n", - "def MatRead(a, row, col):\n", - " for i in range(row):\n", - " for j in range(col):\n", - " print \"Matrix[\", i, \",\", j, \"] = ? \",\n", - " a[i][j]=int(raw_input())\n", - "def MatMul(a, m, n, b, p, q, c):\n", - " if n!=p:\n", - " print \"Error: Invalid matrix order for multiplication\"\n", - " return\n", - " for i in range(m):\n", - " for j in range(q):\n", - " c[i][j]=0\n", - " for k in range(n):\n", - " c[i][j]+=a[i][k]*b[k][j]\n", - "def MatShow(a, row, col):\n", - " for i in range(row):\n", - " print \"\"\n", - " for j in range(col):\n", - " print a[i][j],\n", - "print \"Enter Matrix A details...\"\n", - "m=int(raw_input(\"How many rows ? \"))\n", - "n=int(raw_input(\"How many columns ? \"))\n", - "a=MatAlloc(m, n)\n", - "MatRead(a, m, n)\n", - "print \"Enter Matrix B details...\"\n", - "p=int(raw_input(\"How many rows ? \"))\n", - "q=int(raw_input(\"How many columns ? \"))\n", - "b=MatAlloc(p, q)\n", - "MatRead(b, p, q)\n", - "c=MatAlloc(m, q)\n", - "MatMul(a, m, n, b, p, q, c)\n", - "print \"Matrix C = A * B ...\",\n", - "MatShow(c, m, q)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Matrix A details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns ? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[ 0 , 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 0 , 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 2 , 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 2 , 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Matrix B details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows ? 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns ? 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[ 0 , 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 0 , 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 0 , 2 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 2 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix C = A * B ... \n", - "2 2 2 \n", - "2 2 2 \n", - "2 2 2\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-3ptr.cpp, Page no-315" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "arr=[((2, 1), (3, 6), (5, 3)), ((0, 9), (2, 3), (5, 8))]\n", - "print hex(id(arr))\n", - "print hex(id(arr[0]))\n", - "print hex(id(arr[0][0]))\n", - "print arr[0][0][0]\n", - "print hex(id(arr))\n", - "print hex(id(arr[0]))\n", - "print hex(id(arr[0][1]))\n", - "print arr[0][0][0]+1\n", - "for i in range(2):\n", - " for j in range(3):\n", - " for k in range(2):\n", - " print \"arr[\",i,\"][\", j, \"][\", k, \"] = \", arr[i][j][k]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0x3729e88L\n", - "0x3652ab0L\n", - "0x364e388L\n", - "2\n", - "0x3729e88L\n", - "0x3652ab0L\n", - "0x364e6c8L\n", - "3\n", - "arr[ 0 ][ 0 ][ 0 ] = 2\n", - "arr[ 0 ][ 0 ][ 1 ] = 1\n", - "arr[ 0 ][ 1 ][ 0 ] = 3\n", - "arr[ 0 ][ 1 ][ 1 ] = 6\n", - "arr[ 0 ][ 2 ][ 0 ] = 5\n", - "arr[ 0 ][ 2 ][ 1 ] = 3\n", - "arr[ 1 ][ 0 ][ 0 ] = 0\n", - "arr[ 1 ][ 0 ][ 1 ] = 9\n", - "arr[ 1 ][ 1 ][ 0 ] = 2\n", - "arr[ 1 ][ 1 ][ 1 ] = 3\n", - "arr[ 1 ][ 2 ][ 0 ] = 5\n", - "arr[ 1 ][ 2 ][ 1 ] = 8\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ptrinc.cpp, Page no-317" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ia=[2, 5, 9]\n", - "ptr=ia\n", - "for i in range(3):\n", - " print ptr[i], \n", - " i+=1" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "2 5 9\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-strfunc.cpp, Page no-318" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "temp=raw_input(\"Enter string1: \")\n", - "s1=temp\n", - "temp=raw_input(\"Enter string2: \")\n", - "s2=temp\n", - "print \"Length of string1:\", len(s1) #string length\n", - "s3=s1+s2 #string concatenation\n", - "print \"Strings' on concatenation:\", s3\n", - "print \"String comparison using...\"\n", - "print \"Library function:\", s1>s2 # - operator is not supppoertd with string operands in python\n", - "print \"User's function:\", s1>s2# - operator is not supppoertd with string operands in python" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string1: Object\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string2: Oriented\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Length of string1: 6\n", - "Strings' on concatenation: ObjectOriented\n", - "String comparison using...\n", - "Library function: False\n", - "User's function: False\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-rfact.cpp, Page no-322" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "def fact(num):\n", - " if num==0:\n", - " return 1\n", - " else:\n", - " return num*fact(num-1)\n", - "ptrfact={}\n", - "ptrfact[0]=fact #function pointer\n", - "n=int(raw_input(\"Enter the number whose factorial is to be found: \"))\n", - "f1=ptrfact[0](n)\n", - "print \"The factorial of\", n, \"is\", f1\n", - "print \"The factorial of\", n+1, \"is\", ptrfact[0](n+1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number whose factorial is to be found: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The factorial of 5 is 120\n", - "The factorial of 6 is 720\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-rmain.cpp, Page no-323" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#this program will print hello infinite number of times\n", - "def main():\n", - " p={}\n", - " print \"Hello...\",\n", - " p[0]=main #function pointer to main()\n", - " p[0]()\n", - "main()" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-passfn.cpp, Page no-324" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def small(a, b):\n", - " return a if ab else b\n", - "def select(fn, x, y):\n", - " value=fn(x, y)\n", - " return value\n", - "ptrf={}\n", - "m, n=[int(x) for x in raw_input(\"Enter two integers: \").split()]\n", - "high=select(large, m, n) #function as parameter\n", - "ptrf[0]=small #function pointer\n", - "low=select(ptrf[0], m, n) #pointer to function as parameter\n", - "print \"Large =\", high\n", - "print \"Small =\", low" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers: 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Large = 20\n", - "Small = 10\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-bdate.cpp, Page no-326" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class date(Structure):\n", - " _fields_=[('data', c_int), ('month', c_int), ('year', c_int)]\n", - " def show(self):\n", - " print '%s-%s-%s' %(self.day, self.month, self.year)\n", - "def read(dp):\n", - " dp.day=int(raw_input(\"Enter day: \"))\n", - " dp.month=int(raw_input(\"Enter month: \"))\n", - " dp.year=int(raw_input(\"Enter year: \"))\n", - "d1=date()\n", - "dp1=POINTER(date)\n", - "dp2=POINTER(date)\n", - "print \"Enter birthday of boy...\"\n", - "read(d1)\n", - "dp2=date()\n", - "print \"Enter birthday of girl...\"\n", - "read(dp2)\n", - "print \"Birth date of boy:\",\n", - "dp1=d1\n", - "dp1.show()\n", - "print \"Birth date of girl:\",\n", - "dp2.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter birthday of boy...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter day: 14\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter month: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter year: 71\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter birthday of girl...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter day: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter month: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter year: 72\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth date of boy: 14-4-71\n", - "Birth date of girl: 1-4-72\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Eample-list.cpp, Page no-329" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import *\n", - "class LIST(Structure):\n", - " data=int\n", - " Next=None\n", - "def InsertNode(data, first):\n", - " newnode=LIST()\n", - " newnode.data=data\n", - " newnode.Next=first\n", - " return newnode\n", - "def DeleteNode(data, first):\n", - " current=LIST()\n", - " pred=LIST()\n", - " if first==None:\n", - " print \"Empty list\"\n", - " return first\n", - " pred=current=first\n", - " while(1):\n", - " if current.data==data:\n", - " if current==first:\n", - " first=current.Next\n", - " current=current.Next\n", - " else:\n", - " pred.Next=current.Next\n", - " current=current.Next\n", - " del current\n", - " return first\n", - " current=current.Next\n", - " return first\n", - "def DisplayList(first):\n", - " List=LIST()\n", - " List=first\n", - " while(1): \n", - " print \"->\", List.data,\n", - " if List.Next==None:\n", - " break\n", - " List=List.Next\n", - " print \"\"\n", - "List=LIST()\n", - "List=None\n", - "print \"Linked-list manipulation program...\"\n", - "while(1):\n", - " choice=int(raw_input(\"List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: \"))\n", - " if choice==1:\n", - " data=int(raw_input(\"Enter data for node to be created: \"))\n", - " List=InsertNode(data, List)\n", - " elif choice==2:\n", - " print \"List Contents:\",\n", - " DisplayList(List)\n", - " elif choice==3:\n", - " data=int(raw_input(\"Enter data for node to be delete: \"))\n", - " List=DeleteNode(data, List)\n", - " elif choice==4:\n", - " print \"End of Linked List Computation !!.\"\n", - " break\n", - " else:\n", - " print \"Bad Option Selected\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Linked-list manipulation program...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for node to be created: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for node to be created: 7\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for node to be created: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "List Contents: -> 3 -> 7 -> 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for node to be delete: 7\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "List Contents: -> 3 -> 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "End of Linked List Computation !!.\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-wild1.cpp, Page no-332" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "p=[int]*10 #uninitialized integer pointer\n", - "for i in range(10):\n", - " print p[i]," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-wild2.cpp, Page no-332" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "name=\"Savithri\"\n", - "print name" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Savithri\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-wild3.cpp, Page no-333" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def nameplease():\n", - " name=\"Savithri\"\n", - " return name\n", - "def charplease():\n", - " ch='X'\n", - " return ch\n", - "p1=nameplease()\n", - "p2=charplease()\n", - "print \"Name =\", p1\n", - "print \"Char =\", p2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name = Savithri\n", - "Char = X\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-wild4.cpp, Page no-334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "p1=str\n", - "def temp():\n", - " name=\"Savithri\"\n", - " global p1\n", - " p1=name\n", - "temp()\n", - "print \"Name =\", p1" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name = Savithri\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-335" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Str=\"Programming\"\n", - "count=0\n", - "str_ptr=Str[0]\n", - "while(count+1x[i+1]:\n", - " x[i], x[i+1]=x[i+1], x[i]\n", - " i+=1\n", - " return x\n", - "SIZE=10\n", - "a=[4,59,84,35,9,17,41,19,2,21]\n", - "ptr=a\n", - "temp=ptr\n", - "print \"Given array elements:\"\n", - "for i in range(SIZE):\n", - " print temp[i],\n", - "ptr=sort(ptr)\n", - "temp=ptr\n", - "print \"\\nSorted array elemnets:\"\n", - "for i in range(SIZE):\n", - " print temp[i]," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Given array elements:\n", - "4 59 84 35 9 17 41 19 2 21 \n", - "Sorted array elemnets:\n", - "2 4 9 17 19 21 35 41 59 84\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding_1.ipynb b/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding_1.ipynb deleted file mode 100755 index 1e90b1ef..00000000 --- a/_Mastering_C++_by_K_R_Venugopal_and_Rajkumar_Buyya/Chapter9-PointersAndRuntimeBinding_1.ipynb +++ /dev/null @@ -1,1661 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:7b3f20284899a06912262bc6dd0b3dfa8523f3688c878e2872d6f26bdd017de9" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 9- Pointers and Runtime Binding" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-getaddr.cpp, Page no-293" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import c_int, pointer\n", - "a=c_int(100)\n", - "b=c_int(200)\n", - "c=c_int(300)\n", - "print 'Address', hex(id(pointer(a))), 'contains value', a.value #address of a pointer\n", - "print 'Address', hex(id(pointer(b))), 'contains value', b.value\n", - "print 'Address', hex(id(pointer(c))), 'contains value', c.value" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Address 0x3663448L contains value 100\n", - "Address 0x36633c8L contains value 200\n", - "Address 0x3663448L contains value 300\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-initptr.cpp, Page no-296" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import c_int, pointer\n", - "var1=c_int(10)\n", - "var2=c_int(20)\n", - "iptr=pointer(var1)\n", - "print 'Address and contents of var1 is', hex(id(iptr)), 'and', iptr[0]\n", - "iptr=pointer(var2)\n", - "print 'Address and contents of var2 is', hex(id(iptr)), 'and', iptr[0]\n", - "iptr[0]=125\n", - "var1=iptr[0]*1" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Address and contents of var1 is 0x364f248L and 10\n", - "Address and contents of var2 is 0x364f4c8L and 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-swap.cpp, Page no-298" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import c_float, pointer\n", - "def swap(pa, pb):\n", - " temp=pa[0]\n", - " pa[0]=pb[0]\n", - " pb[0]=temp\n", - "a=float(raw_input(\"Enter real number : \"))\n", - "b=float(raw_input(\"Enter real number : \"))\n", - "a=c_float(a)\n", - "b=c_float(b)\n", - "pa=pointer(a)\n", - "pb=pointer(b)\n", - "swap(pa, pb)\n", - "print \"After swapping......\"\n", - "print \"a contains %0.1f\" %(a.value)\n", - "print \"b contains %0.1f\" %(b.value)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter real number : 10.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter real number : 20.9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "After swapping......\n", - "a contains 20.9\n", - "b contains 10.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-voidptr.cpp, Page no-300" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import c_int, c_float, pointer\n", - "i1=c_int(100)\n", - "f1=c_float(200.5)\n", - "vptr=pointer(i1)\n", - "print \"i1 contains\", vptr[0] #value stored in address pointed by vptr\n", - "vptr=pointer(f1)\n", - "print \"i1 contains\", vptr[0]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "i1 contains 100\n", - "i1 contains 200.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ptrarr1.cpp, Page no-303" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a=[int]\n", - "n=int(raw_input(\"Size of array? \"))\n", - "print \"Array elements ?\"\n", - "for i in range(n):\n", - " a.append(int(raw_input()))\n", - "ptr=a\n", - "small=ptr[1]\n", - "for i in range(2, n+1):\n", - " if small>ptr[i]:\n", - " small=ptr[i]\n", - " i+=1 #pointer arithmetic\n", - "print \"Smallest element is\", small" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Size of array? 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Array elements ?\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "6\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "9\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Smallest element is 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-newhand.cpp, Page no-305" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "size=int(raw_input(\"How many bytes to be allocated: \"))\n", - "try:\n", - " data=[int]*size\n", - " print \"Memory allocation success, address =\", hex(id(data))\n", - "except:\n", - " print \"Could not allocate. Bye...\"\n", - "del data" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many bytes to be allocated: 300\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Memory allocation success, address = 0x3716188L\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ptr2ptr.cpp, Page no-306" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "data=c_int()\n", - "iptr=pointer(data)\n", - "ptriptr=pointer(iptr) #pointer to a pointer\n", - "iptr[0]=100\n", - "print \"The variable 'data' contains\", data.value\n", - "ptriptr[0][0]=200\n", - "print \"The variable 'data' contains\", data.value\n", - "data.value=300\n", - "print \"ptriptr is pointing to\", ptriptr[0][0]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The variable 'data' contains 100\n", - "The variable 'data' contains 200\n", - "ptriptr is pointing to 300\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-big.cpp, Page no-308" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import c_int, pointer\n", - "def FindBig(pa, pb, pbig):\n", - " if pa[0]>pb[0]:\n", - " pbig[0]=pa[0]\n", - " else:\n", - " pbig[0]=pb[0]\n", - " return pbig\n", - "a=c_int()\n", - "b=c_int()\n", - "big=pointer(c_int())\n", - "a, b=[int(x) for x in raw_input(\"Enter two integers: \").split()]\n", - "pa=[a]#pointer to a\n", - "pb=[b]#pointer to b\n", - "big=FindBig(pa, pb, big)\n", - "print \"The value as obtained from the pointer:\", big[0]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers: 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The value as obtained from the pointer: 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-sortptr.cpp, Page no-309" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import c_int, c_char_p\n", - "def SortByPtrExchange(person, n):\n", - " for i in range(n-1):\n", - " flag=1\n", - " for j in range(n-1-i):\n", - " if person[j]>person[j+1]:\n", - " flag=0\n", - " temp=person[j]\n", - " person[j]=person[j+1]\n", - " person[j+1]=temp\n", - " if flag:\n", - " break\n", - "n=c_int(0)\n", - "choice=c_char_p()\n", - "person=[[c_char_p]*100]*40\n", - "while(1):\n", - " person[n.value]=raw_input(\"Enter name: \")\n", - " n.value+=1\n", - " choice=raw_input(\"Enter another(y/n)? \")\n", - " if choice!='y':\n", - " break\n", - "print \"Unsorted list: \"\n", - "for i in range(n.value):\n", - " print person[i]\n", - "SortByPtrExchange(person, n.value)\n", - "print \"Sorted list: \"\n", - "for i in range(n.value):\n", - " print person[i]\n", - "for i in range(n.value):\n", - " del person[i]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name: Tejaswi\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter another(y/n)? y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name: Prasad\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter another(y/n)? y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name: Prakash\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter another(y/n)? y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name: Sudeep\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter another(y/n)? y\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name: Anand\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter another(y/n)? n\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Unsorted list: \n", - "Tejaswi\n", - "Prasad\n", - "Prakash\n", - "Sudeep\n", - "Anand\n", - "Sorted list: \n", - "Anand\n", - "Prakash\n", - "Prasad\n", - "Sudeep\n", - "Tejaswi\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-show.cpp, Page no-311" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show(a, m):\n", - " c=a\n", - " for i in range(m):\n", - " for j in range(3):\n", - " print c[i][j],\n", - " print \"\"\n", - "c=[(1, 2, 3), (4, 5, 6)] #initialization of a 2D array\n", - "show(c, 2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1 2 3 \n", - "4 5 6 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-matrix.cpp, Page no-313" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MatAlloc(row, col):\n", - " p=[[int]*col]*row #dynamic array\n", - " return p\n", - "def MatRelease(p, row):\n", - " for i in range(row):\n", - " del p[i]\n", - " del p\n", - "def MatRead(a, row, col):\n", - " for i in range(row):\n", - " for j in range(col):\n", - " print \"Matrix[\", i, \",\", j, \"] = ? \",\n", - " a[i][j]=int(raw_input())\n", - "def MatMul(a, m, n, b, p, q, c):\n", - " if n!=p:\n", - " print \"Error: Invalid matrix order for multiplication\"\n", - " return\n", - " for i in range(m):\n", - " for j in range(q):\n", - " c[i][j]=0\n", - " for k in range(n):\n", - " c[i][j]+=a[i][k]*b[k][j]\n", - "def MatShow(a, row, col):\n", - " for i in range(row):\n", - " print \"\"\n", - " for j in range(col):\n", - " print a[i][j],\n", - "print \"Enter Matrix A details...\"\n", - "m=int(raw_input(\"How many rows ? \"))\n", - "n=int(raw_input(\"How many columns ? \"))\n", - "a=MatAlloc(m, n)\n", - "MatRead(a, m, n)\n", - "print \"Enter Matrix B details...\"\n", - "p=int(raw_input(\"How many rows ? \"))\n", - "q=int(raw_input(\"How many columns ? \"))\n", - "b=MatAlloc(p, q)\n", - "MatRead(b, p, q)\n", - "c=MatAlloc(m, q)\n", - "MatMul(a, m, n, b, p, q, c)\n", - "print \"Matrix C = A * B ...\",\n", - "MatShow(c, m, q)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Matrix A details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows ? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns ? 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[ 0 , 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 0 , 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 2 , 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 2 , 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Matrix B details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows ? 2\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns ? 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[ 0 , 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 0 , 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 0 , 2 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 0 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 1 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 2 ] = ? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix C = A * B ... \n", - "2 2 2 \n", - "2 2 2 \n", - "2 2 2\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-3ptr.cpp, Page no-315" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "arr=[((2, 1), (3, 6), (5, 3)), ((0, 9), (2, 3), (5, 8))]\n", - "print hex(id(arr))\n", - "print hex(id(arr[0]))\n", - "print hex(id(arr[0][0]))\n", - "print arr[0][0][0]\n", - "print hex(id(arr))\n", - "print hex(id(arr[0]))\n", - "print hex(id(arr[0][1]))\n", - "print arr[0][0][0]+1\n", - "for i in range(2):\n", - " for j in range(3):\n", - " for k in range(2):\n", - " print \"arr[\",i,\"][\", j, \"][\", k, \"] = \", arr[i][j][k]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0x3729e88L\n", - "0x3652ab0L\n", - "0x364e388L\n", - "2\n", - "0x3729e88L\n", - "0x3652ab0L\n", - "0x364e6c8L\n", - "3\n", - "arr[ 0 ][ 0 ][ 0 ] = 2\n", - "arr[ 0 ][ 0 ][ 1 ] = 1\n", - "arr[ 0 ][ 1 ][ 0 ] = 3\n", - "arr[ 0 ][ 1 ][ 1 ] = 6\n", - "arr[ 0 ][ 2 ][ 0 ] = 5\n", - "arr[ 0 ][ 2 ][ 1 ] = 3\n", - "arr[ 1 ][ 0 ][ 0 ] = 0\n", - "arr[ 1 ][ 0 ][ 1 ] = 9\n", - "arr[ 1 ][ 1 ][ 0 ] = 2\n", - "arr[ 1 ][ 1 ][ 1 ] = 3\n", - "arr[ 1 ][ 2 ][ 0 ] = 5\n", - "arr[ 1 ][ 2 ][ 1 ] = 8\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-ptrinc.cpp, Page no-317" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ia=[2, 5, 9]\n", - "ptr=ia\n", - "for i in range(3):\n", - " print ptr[i], \n", - " i+=1" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "2 5 9\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-strfunc.cpp, Page no-318" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "temp=raw_input(\"Enter string1: \")\n", - "s1=temp\n", - "temp=raw_input(\"Enter string2: \")\n", - "s2=temp\n", - "print \"Length of string1:\", len(s1) #string length\n", - "s3=s1+s2 #string concatenation\n", - "print \"Strings' on concatenation:\", s3\n", - "print \"String comparison using...\"\n", - "print \"Library function:\", s1>s2 # - operator is not supppoertd with string operands in python\n", - "print \"User's function:\", s1>s2# - operator is not supppoertd with string operands in python" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string1: Object\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter string2: Oriented\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Length of string1: 6\n", - "Strings' on concatenation: ObjectOriented\n", - "String comparison using...\n", - "Library function: False\n", - "User's function: False\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-rfact.cpp, Page no-322" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def fact(num):\n", - " if num==0:\n", - " return 1\n", - " else:\n", - " return num*fact(num-1)\n", - "ptrfact={}\n", - "ptrfact[0]=fact #function pointer\n", - "n=int(raw_input(\"Enter the number whose factorial is to be found: \"))\n", - "f1=ptrfact[0](n)\n", - "print \"The factorial of\", n, \"is\", f1\n", - "print \"The factorial of\", n+1, \"is\", ptrfact[0](n+1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the number whose factorial is to be found: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The factorial of 5 is 120\n", - "The factorial of 6 is 720\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-rmain.cpp, Page no-323" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#this program will print hello infinite number of times\n", - "def main():\n", - " p={}\n", - " print \"Hello...\",\n", - " p[0]=main #function pointer to main()\n", - " p[0]()\n", - "main()" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-passfn.cpp, Page no-324" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def small(a, b):\n", - " return a if ab else b\n", - "def select(fn, x, y):\n", - " value=fn(x, y)\n", - " return value\n", - "ptrf={}\n", - "m, n=[int(x) for x in raw_input(\"Enter two integers: \").split()]\n", - "high=select(large, m, n) #function as parameter\n", - "ptrf[0]=small #function pointer\n", - "low=select(ptrf[0], m, n) #pointer to function as parameter\n", - "print \"Large =\", high\n", - "print \"Small =\", low" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter two integers: 10 20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Large = 20\n", - "Small = 10\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-bdate.cpp, Page no-326" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure, c_int, POINTER\n", - "class date(Structure):\n", - " _fields_=[('data', c_int), ('month', c_int), ('year', c_int)]\n", - " def show(self):\n", - " print '%s-%s-%s' %(self.day, self.month, self.year)\n", - "def read(dp):\n", - " dp.day=int(raw_input(\"Enter day: \"))\n", - " dp.month=int(raw_input(\"Enter month: \"))\n", - " dp.year=int(raw_input(\"Enter year: \"))\n", - "d1=date()\n", - "dp1=POINTER(date)\n", - "dp2=POINTER(date)\n", - "print \"Enter birthday of boy...\"\n", - "read(d1)\n", - "dp2=date()\n", - "print \"Enter birthday of girl...\"\n", - "read(dp2)\n", - "print \"Birth date of boy:\",\n", - "dp1=d1\n", - "dp1.show()\n", - "print \"Birth date of girl:\",\n", - "dp2.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter birthday of boy...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter day: 14\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter month: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter year: 71\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter birthday of girl...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter day: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter month: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter year: 72\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Birth date of boy: 14-4-71\n", - "Birth date of girl: 1-4-72\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-list.cpp, Page no-329" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import Structure\n", - "class LIST(Structure):\n", - " data=int\n", - " Next=None\n", - "def InsertNode(data, first):\n", - " newnode=LIST()\n", - " newnode.data=data\n", - " newnode.Next=first\n", - " return newnode\n", - "def DeleteNode(data, first):\n", - " current=LIST()\n", - " pred=LIST()\n", - " if first==None:\n", - " print \"Empty list\"\n", - " return first\n", - " pred=current=first\n", - " while(1):\n", - " if current.data==data:\n", - " if current==first:\n", - " first=current.Next\n", - " current=current.Next\n", - " else:\n", - " pred.Next=current.Next\n", - " current=current.Next\n", - " del current\n", - " return first\n", - " current=current.Next\n", - " return first\n", - "def DisplayList(first):\n", - " List=LIST()\n", - " List=first\n", - " while(1): \n", - " print \"->\", List.data,\n", - " if List.Next==None:\n", - " break\n", - " List=List.Next\n", - " print \"\"\n", - "List=LIST()\n", - "List=None\n", - "print \"Linked-list manipulation program...\"\n", - "while(1):\n", - " choice=int(raw_input(\"List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: \"))\n", - " if choice==1:\n", - " data=int(raw_input(\"Enter data for node to be created: \"))\n", - " List=InsertNode(data, List)\n", - " elif choice==2:\n", - " print \"List Contents:\",\n", - " DisplayList(List)\n", - " elif choice==3:\n", - " data=int(raw_input(\"Enter data for node to be delete: \"))\n", - " List=DeleteNode(data, List)\n", - " elif choice==4:\n", - " print \"End of Linked List Computation !!.\"\n", - " break\n", - " else:\n", - " print \"Bad Option Selected\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Linked-list manipulation program...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for node to be created: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for node to be created: 7\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for node to be created: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "List Contents: -> 3 -> 7 -> 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter data for node to be delete: 7\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "List Contents: -> 3 -> 5 \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "List operation, 1- Insert, 2- Display, 3-Delete, 4-Quit: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "End of Linked List Computation !!.\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-wild1.cpp, Page no-332" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "p=[int]*10 #uninitialized integer pointer\n", - "for i in range(10):\n", - " print p[i]," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-wild2.cpp, Page no-332" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "name=\"Savithri\"\n", - "print name" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Savithri\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-wild3.cpp, Page no-333" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def nameplease():\n", - " name=\"Savithri\"\n", - " return name\n", - "def charplease():\n", - " ch='X'\n", - " return ch\n", - "p1=nameplease()\n", - "p2=charplease()\n", - "print \"Name =\", p1\n", - "print \"Char =\", p2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name = Savithri\n", - "Char = X\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-wild4.cpp, Page no-334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "p1=str\n", - "def temp():\n", - " name=\"Savithri\"\n", - " global p1\n", - " p1=name\n", - "temp()\n", - "print \"Name =\", p1" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name = Savithri\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-1, Page no-335" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Str=\"Programming\"\n", - "count=0\n", - "str_ptr=Str[0]\n", - "while(count+1x[i+1]:\n", - " x[i], x[i+1]=x[i+1], x[i]\n", - " i+=1\n", - " return x\n", - "SIZE=10\n", - "a=[4,59,84,35,9,17,41,19,2,21]\n", - "ptr=a\n", - "temp=ptr\n", - "print \"Given array elements:\"\n", - "for i in range(SIZE):\n", - " print temp[i],\n", - "ptr=sort(ptr)\n", - "temp=ptr\n", - "print \"\\nSorted array elemnets:\"\n", - "for i in range(SIZE):\n", - " print temp[i]," - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Given array elements:\n", - "4 59 84 35 9 17 41 19 2 21 \n", - "Sorted array elemnets:\n", - "2 4 9 17 19 21 35 41 59 84\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication/screenshots/Chapter01-Ex1.7.1.png b/_Optical_Fiber_Communication/screenshots/Chapter01-Ex1.7.1.png deleted file mode 100755 index 4c42636d..00000000 Binary files a/_Optical_Fiber_Communication/screenshots/Chapter01-Ex1.7.1.png and /dev/null differ diff --git a/_Optical_Fiber_Communication/screenshots/Chapter02-Ex2.2.1.png b/_Optical_Fiber_Communication/screenshots/Chapter02-Ex2.2.1.png deleted file mode 100755 index 7f5fd635..00000000 Binary files a/_Optical_Fiber_Communication/screenshots/Chapter02-Ex2.2.1.png and /dev/null differ diff --git a/_Optical_Fiber_Communication/screenshots/Chapter03-Ex3.2.1.png b/_Optical_Fiber_Communication/screenshots/Chapter03-Ex3.2.1.png deleted file mode 100755 index c1f042e9..00000000 Binary files a/_Optical_Fiber_Communication/screenshots/Chapter03-Ex3.2.1.png and /dev/null differ diff --git a/_Optical_Fiber_Communication/screenshots/chapter2.png b/_Optical_Fiber_Communication/screenshots/chapter2.png deleted file mode 100755 index e8ee191d..00000000 Binary files a/_Optical_Fiber_Communication/screenshots/chapter2.png and /dev/null differ diff --git a/_Optical_Fiber_Communication/screenshots/chapter5.png b/_Optical_Fiber_Communication/screenshots/chapter5.png deleted file mode 100755 index d6fa34e3..00000000 Binary files a/_Optical_Fiber_Communication/screenshots/chapter5.png and /dev/null differ diff --git a/_Optical_Fiber_Communication/screenshots/chapter6.png b/_Optical_Fiber_Communication/screenshots/chapter6.png deleted file mode 100755 index ac19fe5b..00000000 Binary files a/_Optical_Fiber_Communication/screenshots/chapter6.png and /dev/null differ diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter01-Fiber_Optics_Communications_System.ipynb b/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter01-Fiber_Optics_Communications_System.ipynb deleted file mode 100755 index ec323da9..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter01-Fiber_Optics_Communications_System.ipynb +++ /dev/null @@ -1,1240 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:742c44cb267900361b88ee7b473acd2b1b40f32a4db7e15db6918955b1159df0" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter01:Fiber Optics Communications System" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "\n", - "Ex1.7.1:Pg-1.14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "n1= 1.5 # for glass\n", - "n2= 1.33 # for water\n", - "phi1= (math.pi/6) # phi1 is the angel of incidence\n", - " # According to Snell's law...\n", - " # n1*sin(phi1)= n2*sin(phi2) \n", - "sinphi2= (n1/n2)*math.sin(phi1) # phi2 is the angle of refraction..\n", - "phi2 = math.asin(sinphi2)\n", - "temp= math.degrees(phi2)\n", - "print \" The angel of refraction in degrees =\",round(temp,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The angel of refraction in degrees = 34.33\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.7.2:Pg-1.14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "n1= 1.50 # RI of glass..\n", - "n2 = 1.0 # RI of air...\n", - " # According to Snell's law...\n", - " # n1*sin(phi1)= n2*sin(phi2) \n", - " # From definition of critical angel phi2 = 90 degrees and phi1 will be critical angel\n", - "t1=(n2/n1)*math.sin(math.pi/2)\n", - "phiC=math.asin(t1)\n", - "temp= math.degrees(phiC)\n", - "print \" The Critical angel in degrees =\",round(temp,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Critical angel in degrees = 41.81\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.7.3:Pg-1.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - " # To find RI of glass\n", - " # To find the critical angle for glass...\n", - " \n", - "phi1 = 33 # Angle of incidence..\n", - "phi2 = 90 # Angle of refraction..\n", - "n2= 1.0 \n", - "\n", - "n1 = round(sin(math.radians(phi2))/sin(math.radians(phi1)),3) \n", - "print \" The Refractive Index is =\",n1 \n", - "\n", - "#phiC = math.asin((n2/n1)*math.sin(90)) \n", - "phiC=math.asin(0.54)\n", - "print \" \\n\\nThe Critical angel in degrees =\",round(math.degrees(phiC),2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Refractive Index is = 1.836\n", - " \n", - "\n", - "The Critical angel in degrees = 32.68\n" - ] - } - ], - "prompt_number": 81 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.7.4:Pg-1.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - "import math\n", - " \n", - "n1= 1.5 # TheRi of medium 1\n", - "n2= 1.36 # the RI of medium 2\n", - "phi1= 30 # The angle of incidence\n", - " # According to Snell's law...\n", - " # n1*sin(phi1)= n2*sin(phi2) \n", - "phi2 = math.asin((n1/n2)*math.sin(math.radians(phi1))) \n", - "print \" The angel of refraction is in degrees from normal = \",round(math.degrees(phi2),2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The angel of refraction is in degrees from normal = 33.47\n" - ] - } - ], - "prompt_number": 91 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.7.5:Pg-1.16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - " \n", - "n1 = 3.6 # RI of GaAs..\n", - "n2 = 3.4 # RI of AlGaAs..\n", - "phi1 = 80 # Angle of Incidence..\n", - " # According to Snell's law...\n", - " # n1*sin(phi1)= n2*sin(phi2) \n", - " # At critical angle phi2 = 90...\n", - "phiC = math.asin((n2/n1)*sin(math.radians(90)) )\n", - "print \" The Critical angel in degrees =\",round(math.degrees(phiC),2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Critical angel in degrees = 70.81\n" - ] - } - ], - "prompt_number": 97 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.1:Pg-1.22" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math \n", - "\n", - "n1= 1.5 # RI of medium 1\n", - "n2 =1.45 # RI of medium 2\n", - "\n", - "delt= (n1-n2)/n1 \n", - "NA = n1*(math.sqrt(2*delt)) \n", - "print \" The Numerical aperture =\",round(NA,2)\n", - "phiA = math.asin(NA) \n", - "print \" \\n\\nThe Acceptance angel in degrees =\",round(math.degrees(phiA),2) \n", - "\n", - "phiC = math.asin(n2/n1) \n", - "print \" \\n\\nThe Critical angel in degrees =\",round(degrees(phiC),2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical aperture = 0.39\n", - " \n", - "\n", - "The Acceptance angel in degrees = 22.79\n", - " \n", - "\n", - "The Critical angel in degrees = 75.16\n" - ] - } - ], - "prompt_number": 100 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.2:Pg-1.23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "n1= 1.5 # RI of core\n", - "n2 = 1.48 # RI of cladding..\n", - "\n", - "NA = math.sqrt((n1**2)-(n2**2)) \n", - "print \" The Numerical Aperture =\",round(NA,2) \n", - "\n", - "phiA = math.asin(NA) \n", - "print \" \\n\\nThe Critical angel =\",round(math.degrees(phiA),2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture = 0.24\n", - " \n", - "\n", - "The Critical angel = 14.13\n" - ] - } - ], - "prompt_number": 101 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.3:Pg-1.23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math \n", - " \n", - "\n", - "NA = 0.35 # Numerical Aperture\n", - "delt = 0.01 \n", - " # NA= n1*(math.sqrt(2*delt) n1 is RI of core\n", - "n1 = 0.35/(math.sqrt(2*delt)) \n", - "print \"The RI of core =\",round(n1,4) \n", - "\n", - " # Numerical Aperture is also given by \n", - " # NA = math.sqrt(n1**2 - n2**2) # n2 is RI of cladding\n", - "n2 = math.sqrt((n1**2-NA**2)) \n", - "print \" \\n\\nThe RI of Cladding =\",round(n2,3) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The RI of core = 2.4749\n", - " \n", - "\n", - "The RI of Cladding = 2.45\n" - ] - } - ], - "prompt_number": 104 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.4:Pg-1.24" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "Vc = 2.01*10**8 # velocity of light in core in m/sec...\n", - "phiC= 80.0 # Critical angle in degrees...\n", - "\n", - " # RI of Core (n1) is given by (Velocity of light in air/ velocity of light in air)...\n", - "n1= 3*10**8/Vc \n", - " # From critical angle and the value of n1 we calculate n2...\n", - "n2 = sin(math.radians(phiC))*n1 # RI of cladding...\n", - "NA = math.sqrt(n1**2-n2**2) \n", - "print \" The Numerical Aperture =\",round(NA,2) \n", - "phiA = math.asin(NA) # Acceptance angle...\n", - "print \" \\n\\nThe Acceptance angel in degrees =\",round(math.degrees(phiA),2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture = 0.26\n", - " \n", - "\n", - "The Acceptance angel in degrees = 15.02\n" - ] - } - ], - "prompt_number": 106 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.5:Pg-1.25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "n1 = 1.4 # RI of Core..\n", - "n2 = 1.35 # RI of Cladding\n", - "\n", - "phiC = math.asin(n2/n1) # Critical angle..\n", - "print \" The Critical angel in degrees =\",round(math.degrees(phiC),2) \n", - "\n", - "NA = math.sqrt(n1**2-n2**2) # numerical Aperture...\n", - "print \" \\n\\nThe Numerical Aperture is =\",round(NA,2) \n", - "\n", - "phiA = math.asin(NA) # Acceptance angle... \n", - "print \" \\n\\nThe Acceptance angel in degrees =\",round(math.degrees(phiA),2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Critical angel in degrees = 74.64\n", - " \n", - "\n", - "The Numerical Aperture is = 0.37\n", - " \n", - "\n", - "The Acceptance angel in degrees = 21.77\n" - ] - } - ], - "prompt_number": 107 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.6:Pg-1.25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "n1 = 1.48 # RI of core..\n", - "n2 = 1.46 # RI of Cladding..\n", - "\n", - "NA = math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", - "print \" The Numerical Aperture is =\",round(NA,3) \n", - "\n", - "theta = math.pi*NA**2 # The entrance angle theta..\n", - "print \" \\n\\nThe Entrance angel in degrees =\",round(theta,3) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture is = 0.242\n", - " \n", - "\n", - "The Entrance angel in degrees = 0.185\n" - ] - } - ], - "prompt_number": 110 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.7:Pg-1.26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math \n", - "\n", - "delt = 0.007 # relative refractive index difference \n", - "n1 = 1.45 # RI of core...\n", - "NA = n1* math.sqrt((2*delt)) \n", - "print \" The Numerical Aperture is =\",round(NA,4) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture is = 0.1716\n" - ] - } - ], - "prompt_number": 112 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.8:Pg-1.26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - "import math\n", - "\n", - "phiA = 8 # accepatance angle in degrees...\n", - "n1 =1.52 # RI of core...\n", - "\n", - "NA = sin(math.radians(phiA)) # Numerical Aperture...\n", - "\n", - "delt = NA**2/(2*(n1**2)) # Relative RI difference...\n", - "print \" The relative refractive index difference =\",round(delt,5) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The relative refractive index difference = 0.00419\n" - ] - } - ], - "prompt_number": 114 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "\n", - "Ex1.9.9:Pg-1.27" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "delt = 0.01 # relative RI difference..\n", - "n1 = 1.48 # RI of core...\n", - "\n", - "NA = n1*(math.sqrt(2*delt)) # Numerical Aperture..\n", - "print \" The Numerical Aperture =\",round(NA,3) \n", - "\n", - "theta = math.pi*NA**2 # Solid Acceptance angle...\n", - "print \" \\n\\nThe Solid Acceptance angel in degrees =\",round(theta,4) \n", - "\n", - "n2 = (1-delt)*n1 \n", - "phiC = math.asin(n2/n1) # Critical Angle...\n", - "print \" \\n\\nThe Critical angel in degrees =\",round(math.degrees(phiC),2) \n", - "print \" \\n\\nCritical angle wrong due to rounding off errors in trignometric functions..\\n Actual value is 90.98 in book.\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture = 0.209\n", - " \n", - "\n", - "The Solid Acceptance angel in degrees = 0.1376\n", - " \n", - "\n", - "The Critical angel in degrees = 81.89\n", - " \n", - "\n", - "Critical angle wrong due to rounding off errors in trignometric functions..\n", - " Actual value is 90.98 in book.\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.1:Pg-1.41" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "d = 50*10**-6 # diameter of fibre...\n", - "n1 = 1.48 # RI of core..\n", - "n2 = 1.46 # RI of cladding..\n", - "lamda = 0.82*10**-6 # wavelength of light..\n", - "\n", - "NA = math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", - "Vn= math.pi*d*NA/lamda # normalised frequency...\n", - "M = Vn**2/2 # number of modes...\n", - "print \" The number of modes in the fibre are =\",int(M) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The number of modes in the fibre are = 1078\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.2:Pg-1.42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - " \n", - " \n", - "V = 26.6 # Normalised frequency..\n", - "lamda = 1300*10**-9 # wavelenght of operation\n", - "a = 25*10**-6 # radius of fibre.\n", - "NA = V*lamda/(2*math.pi*a) # Numerical Aperture..\n", - "print \" The Numerical Aperture =\",round(NA,3) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture = 0.22\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.3:Pg-1.43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - " \n", - "a = 40*10**-6 # radius of core...\n", - "delt = 0.015 # relative RI difference..\n", - "lamda= 0.85*10**-6 # wavelength of operation..\n", - "n1=1.48 # RI of core..\n", - "\n", - "NA = n1*math.sqrt(2*delt) # Numerical Aperture..\n", - "print \" The Numerical Aperture =\", round(NA,4) \n", - "V = 2*math.pi*a*NA/lamda # normalised frequency\n", - "print \" \\n\\nThe Normalised frequency =\",round(V,2) \n", - "\n", - "M = V**2/2 # number of modes..\n", - "print \" \\n\\nThe number of modes in the fibre are =\",int(M) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture = 0.2563\n", - " \n", - "\n", - "The Normalised frequency = 75.8\n", - " \n", - "\n", - "The number of modes in the fibre are = 2872\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.4:Pg-1.43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "NA = 0.20 # Numerical Aperture..\n", - "M = 1000 # number of modes..\n", - "lamda = 850*10**-9 # wavelength of operation..\n", - "\n", - "a = math.sqrt(M*2*lamda**2/(math.pi**2*NA**2)) # radius of core..\n", - "a=a*10**6 # converting in um for displaying...\n", - "print \" The radius of the core in um =\",round(a,2) \n", - "a=a*10**-6 \n", - "M1= ((math.pi*a*NA/(1320*10**-9))**2)/2\n", - "print \" \\n\\nThe number of modes in the fibre at 1320um =\",int(M1) \n", - "print \" \\n\\n***The number of modes in the fibre at 1320um is calculated wrongly in book\" \n", - "M2= ((math.pi*a*NA/(1550*10**-9))**2)/2\n", - "print \" \\n\\nThe number of modes in the fibre at 1550um =\",int(M2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The radius of the core in um = 60.5\n", - " \n", - "\n", - "The number of modes in the fibre at 1320um = 414\n", - " \n", - "\n", - "***The number of modes in the fibre at 1320um is calculated wrongly in book\n", - " \n", - "\n", - "The number of modes in the fibre at 1550um = 300\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.5:Pg-1.44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - " \n", - "NA = 0.2 # Numerical Aperture..\n", - "n2= 1.59 # RI of cladding..\n", - "n0= 1.33 # RI of water..\n", - "lamda = 1300*10**-9 # wavelength..\n", - "a = 25*10**-6 # radius of core..\n", - "n1 = math.sqrt(NA**2+n2**2) # RI of core..\n", - "phiA= math.asin(math.sqrt(n1**2-n2**2)/n0) # Acceptance angle..\n", - "print \" The Acceptance angle is =\",round(math.degrees(phiA),2) \n", - "\n", - "phiC= math.asin(n2/n1) # Critical angle..\n", - "print \" \\n\\nThe critical angle is =\",round(math.degrees(phiC),2) \n", - "V = 2*math.pi*a*NA/lamda # normalisd frequency\n", - "M= V**2/2 # number of modes\n", - "print \" \\n\\nThe number of modes in the fibre are =\",int(M) \n", - "\n", - "print \" \\n\\n***The value of the angle differ from the book because of round off errors.\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Acceptance angle is = 8.65\n", - " \n", - "\n", - "The critical angle is = 82.83\n", - " \n", - "\n", - "The number of modes in the fibre are = 292\n", - " \n", - "\n", - "***The value of the angle differ from the book because of round off errors.\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.6:Pg-1.46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "V= 26.6 # Normalised frequency..\n", - "lamda= 1300*10**-9 # wavelength of operation..\n", - "a= 25*10**-6 # radius of core..\n", - "\n", - "NA = V*lamda/(2*math.pi*a) # Numerical Aperture..\n", - "print \" The Numerical Aperture =\",round(NA,2) \n", - "theta = math.pi*NA**2 # solid Acceptance Angle..\n", - "print \" \\n\\nThe solid acceptance angle in radians =\",round(theta,3) \n", - "\n", - "M= V**2/2 # number of modes..\n", - "print \" \\n\\nThe number of modes in the fibre =\",round(M,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture = 0.22\n", - " \n", - "\n", - "The solid acceptance angle in radians = 0.152\n", - " \n", - "\n", - "The number of modes in the fibre = 353.78\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.7:Pg-1.47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math \n", - "\n", - "n1= 1.49 # RI of core.\n", - "n2=1.47 # RI of cladding..\n", - "a= 2 # radius of core in um..\n", - "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", - " # The maximum V number for single mode operation is 2.4...\n", - "V= 2.4 # Normalised frequency..\n", - "\n", - "lamda = 2*math.pi*a*NA/V # Cutoff wavelength...\n", - "print \" The cutoff wavelength in um =\",round(lamda,2) \n", - "\n", - "\n", - "lamda1 = 1.310 # Givenn cutoff wavelength in um..\n", - "d= V*lamda1/(math.pi*NA) # core diameter..\n", - "print \" \\n\\nThe core diameter in um =\",round(d,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The cutoff wavelength in um = 1.27\n", - " \n", - "\n", - "The core diameter in um = 4.11\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.8:Pg-1.47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - "import math\n", - " \n", - "n1= 1.48 # RI of core..\n", - "a= 4.5 # core radius in um..\n", - "delt= 0.0025 # Relative RI difference..\n", - "V= 2.405 # For step index fibre..\n", - "lamda= (2*math.pi*a*n1*math.sqrt(2*delt))/V # cutoff wavelength..\n", - "print \" The cutoff wavelength in um =\",round(lamda,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The cutoff wavelength in um = 1.23\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.9:Pg-1.48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math \n", - " \n", - "lamda= 0.82*10**-6 # wavelength ofoperation.\n", - "a= 2.5*10**-6 # Radius of core..\n", - "n1= 1.48 # RI of core..\n", - "n2= 1.46 # RI of cladding\n", - "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", - "V= 2*math.pi*a*NA/lamda # Normalisd frequency..\n", - "print \" The normalised frequency =\",round(V,3) \n", - "M= V**2/2 # The number of modes..\n", - "print \" \\n\\nThe number of modes in the fibre are =\",round(M,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The normalised frequency = 4.645\n", - " \n", - "\n", - "The number of modes in the fibre are = 10.79\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.10:Pg-1.49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - "import math\n", - " \n", - "delt= 0.01 # Relative RI difference..\n", - "n1= 1.5 \n", - "M= 1100 # Number of modes...\n", - "lamda= 1.3 # wavelength of operation in um..\n", - "V= math.sqrt(2*M) # Normalised frequency...\n", - "d= V*lamda/(math.pi*n1*math.sqrt(2*delt)) # diameter of core..\n", - "print \" The diameter of the core in um =\",round(d,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The diameter of the core in um = 91.5\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.11:Pg-1.50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "n1= 1.5 # RI of core..\n", - "n2= 1.38 # RI of cladding..\n", - "a= 25*10**-6 # radius of core..\n", - "lamda= 1300*10**-9 # wavelength of operation...\n", - "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", - "print \" The Numerical Aperture of the given fibre =\",round(NA,4) \n", - "V= 2*math.pi*a*NA/lamda # Normalised frequency..\n", - "print \" \\n\\nThe normalised frequency =\",round(V,2) \n", - "theta= math.asin(NA) # Solid acceptance anglr..\n", - "print \" \\n\\nThe Solid acceptance angle in degrees =\",int(math.degrees(theta)) \n", - "M= V**2/2 # Number of modes..\n", - "print \" \\n\\nThe number of modes in the fibre are =\",int(M) \n", - "print \" \\n\\n***Number of modes wrongly calculated in the book..\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture of the given fibre = 0.5879\n", - " \n", - "\n", - "The normalised frequency = 71.03\n", - " \n", - "\n", - "The Solid acceptance angle in degrees = 36\n", - " \n", - "\n", - "The number of modes in the fibre are = 2522\n", - " \n", - "\n", - "***Number of modes wrongly calculated in the book..\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.12:Pg-1.51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "lamda= 850*10**-9 # wavelength of operation.\n", - "a= 25*10**-6 # Radius of core\n", - "n1= 1.48 # RI of Core...\n", - "n2= 1.46 # RI of cladding..\n", - "\n", - "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture\n", - "\n", - "V= 2*math.pi*a*NA/lamda # Normalised frequency..\n", - "print \" The normalised frequency =\",round(V,2) \n", - "\n", - "lamda1= 1320*10**-9 # wavelength changed...\n", - "V1= 2*math.pi*a*NA/lamda1 # Normalised frequency at new wavelength..\n", - "\n", - "M= V1**2/2 # Number of modes at new wavelength..\n", - "print \" \\n\\nThe number of modes in the fibre at 1320um =\",int(M) \n", - "lamda2= 1550*10**-9 # wavelength 2...\n", - "V2= 2*math.pi*a*NA/lamda2 # New normalised frequency..\n", - "M1= V2**2/2 # number of modes..\n", - "print \" \\n\\nThe number of modes in the fibre at 1550um =\",int(M1 )\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The normalised frequency = 44.81\n", - " \n", - "\n", - "The number of modes in the fibre at 1320um = 416\n", - " \n", - "\n", - "The number of modes in the fibre at 1550um = 301\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.15.1:Pg-1.56" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - " \n", - "n1= 1.48 # RI of core..\n", - "delt= 0.015 # relative RI differencr..\n", - "lamda= 0.85 # wavelength of operation..\n", - "V= 2.4 # for single mode of operation..\n", - "\n", - "a= V*lamda/(2*math.pi*n1*math.sqrt(2*delt)) # radius of core..\n", - "print \" The raduis of core in um =\",round(a,2) \n", - "print \" \\n\\nThe maximum possible core diameter in um =\",round(2*a,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The raduis of core in um = 1.27\n", - " \n", - "\n", - "The maximum possible core diameter in um = 2.53\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.15.2:Pg-1.56" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - "import math\n", - " \n", - "n1= 1.5 # RI of core..\n", - "delt= 0.01 # Relative RI difference...\n", - "lamda= 1.3 # Wavelength of operation...\n", - "V= 2.4*math.sqrt(2) # Maximum value of V for GRIN...\n", - "a= V*lamda/(2*math.pi*n1*math.sqrt(2*delt)) # radius of core..\n", - "print \" The radius of core in um =\",round(a,2) \n", - "print \" \\n\\nThe maximum possible core diameter in um =\",round(2*a,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The radius of core in um = 3.31\n", - " \n", - "\n", - "The maximum possible core diameter in um = 6.62\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.15.3:Pg-1.56" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "n1= 1.46 # RI of core..\n", - "a = 4.5 # radius of core in um..\n", - "delt= 0.0025 # relative RI difference..\n", - "V= 2.405 # Normalisd frequency for single mode..\n", - "lamda= 2*math.pi*a*n1*math.sqrt(2*delt)/V # cutoff wavelength...\n", - "print \" The cut off wavelength for the given fibre in um =\",round(lamda,3) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The cut off wavelength for the given fibre in um = 1.214\n" - ] - } - ], - "prompt_number": 31 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter02-Optical_Fiber_for_Telecommunication.ipynb b/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter02-Optical_Fiber_for_Telecommunication.ipynb deleted file mode 100755 index 46a8893c..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter02-Optical_Fiber_for_Telecommunication.ipynb +++ /dev/null @@ -1,945 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:211878047ac07bbe36923a59422db9a2025fd46f216dee8cd476326a7778bb6a" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter02: Optical Fiber for Telecommunication" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - " Ex2.2.1:Pg-2.4" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "alpha= 3 # average loss Power decreases by 50% so P(0)/P(z)= 0.5\n", - "lamda= 900*10**-9 # wavelength\n", - "z= 10*math.log10(0.5)/alpha # z is the length\n", - "z= z*-1 \n", - "print \" The length over which power decreases by 50% in Kms= \",round(z,2) \n", - "\n", - "z1= 10*math.log10(0.25)/alpha # Power decreases by 75% so P(0)/P(z)= 0.25\n", - "z1=z1*-1 # as distance cannot be negative...\n", - "print \" \\n\\nThe length over which power decreases by 75% in Kms= \",round(z1,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The length over which power decreases by 50% in Kms= 1.0\n", - " \n", - "\n", - "The length over which power decreases by 75% in Kms= 2.01\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2.2:Pg-2.5" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "\n", - "z=30.0 # Length of the fibre in kms\n", - "alpha= 0.8 # in dB\n", - "P0= 200.0 # Power launched in uW\n", - "pz= P0/10**(alpha*z/10) \n", - "print \" The output power in uW =\",round(pz,4) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The output power in uW = 0.7962\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2.3:Pg-2.6" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math \n", - "\n", - "z=8.0 # fibre length\n", - "p0= 120*10**-6 # power launched\n", - "pz= 3*10**-6 \n", - "alpha= 10*math.log10(p0/pz) # overall attenuation\n", - "print \" The overall attenuation in dB =\",round(alpha,2) \n", - "alpha = alpha/z # attenuation per km\n", - "alpha_new= alpha *10 # attenuation for 10kms\n", - "total_attenuation = alpha_new + 9 # 9dB because of splices\n", - "print \" \\n\\nThe total attenuation in dB =\",int(total_attenuation) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The overall attenuation in dB = 16.02\n", - " \n", - "\n", - "The total attenuation in dB = 29\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2.4:Pg-2.6" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - " \n", - "z=12.0 # fibre length\n", - "alpha = 1.5 \n", - "p0= 0.3 \n", - "pz= p0/10**(alpha*z/10) \n", - "pz=pz*1000 # formatting pz in nano watts...\n", - "print \" The power at the output of the cable in W = \",round(pz,2),\"x 10^-9\" \n", - "alpha_new= 2.5 \n", - "pz=pz/1000 # pz in uWatts...\n", - "p0_new= 10**(alpha_new*z/10)*pz \n", - "print \" \\n\\nThe Input power in uW= \",round(p0_new,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The power at the output of the cable in W = 4.75 x 10^-9\n", - " \n", - "\n", - "The Input power in uW= 4.75\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2.5:Pg-2.7" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "p0=150*10**-6 # power input\n", - "z= 10.0 # fibre length in km\n", - "pz= -38.2 # in dBm...\n", - "pz= 10**(pz/10)*1*10**-3 \n", - "alpha_1= 10/z *math.log10(p0/pz) # attenuation in 1st window\n", - "print \" Attenuation is 1st window in dB/Km =\",round(alpha_1,2) \n", - "alpha_2= 10/z *math.log10(p0/(47.5*10**-6)) # attenuation in 2nd window\n", - "print \" \\n\\nAttenuation is 2nd window in dB/Km =\",round(alpha_2,2) \n", - "alpha_3= 10/z *math.log10(p0/(75*10**-6)) # attenuation in 3rd window\n", - "print \" \\n\\nAttenuation is 3rd window in dB/Km =\",round(alpha_3,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Attenuation is 1st window in dB/Km = 3.0\n", - " \n", - "\n", - "Attenuation is 2nd window in dB/Km = 0.5\n", - " \n", - "\n", - "Attenuation is 3rd window in dB/Km = 0.3\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "\n", - "Ex2.2.6:Pg-2.8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "p0=3*10**-3 \n", - "pz=3*10**-6 \n", - "alpha= 0.5 \n", - "z= math.log10(p0/pz)/(alpha/10) \n", - "print \" The Length of the fibre in Km =\",int(z)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Length of the fibre in Km = 60\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2.7:Pg-2.9" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "z= 10.0 \n", - "p0= 100*10**-6 # input power\n", - "pz=5*10**-6 # output power\n", - "alpha = 10*math.log10(p0/pz) # total attenuation\n", - "print \" The overall signal attenuation in dB = \",round(alpha,2) \n", - "alpha = alpha/z # attenuation per km\n", - "print \" \\n\\nThe attenuation per Km in dB/Km = \",round(alpha,2)\n", - "z_new = 12.0 \n", - "splice_attenuation = 11*0.5 \n", - "cable_attenuation = alpha*z_new \n", - "total_attenuation = splice_attenuation+cable_attenuation \n", - "print \" \\n\\nThe overall signal attenuation for 12Kms in dB = \",round(total_attenuation,1) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The overall signal attenuation in dB = 13.01\n", - " \n", - "\n", - "The attenuation per Km in dB/Km = 1.3\n", - " \n", - "\n", - "The overall signal attenuation for 12Kms in dB = 21.1\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2.8:Pg-2.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Tf = 1400.0 # fictive temperature\n", - "BETA = 7*10**-11 \n", - "n= 1.46 # RI \n", - "p= 0.286 # photo elastic constant\n", - "Kb = 1.381*10**-23 # Boltzmann's constant\n", - "lamda = 850*10**-9 # wavelength\n", - "alpha_scat = 8*math.pi**3*n**8*p**2*Kb*Tf*BETA/(3*lamda**4) \n", - "l= 1000 # fibre length\n", - "TL = exp(-alpha_scat*l) # transmission loss\n", - "attenuation = 10*math.log10(1/TL) \n", - "print \" The attenuation in dB/Km =\",round(attenuation,3)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The attenuation in dB/Km = 1.572\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.3.1:Pg-2.20" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "alpha = 2 \n", - "n1= 1.5 \n", - "a= 25*10**-6 \n", - "lamda= 1.3*10**-6 \n", - "M= 0.5 \n", - "NA= math.sqrt(0.5*2*1.3**2/(math.pi**2*25**2)) \n", - "Rc= 3*n1**2*lamda/(4*math.pi*NA**3) \n", - "Rc=Rc*1000 # converting into um.....\n", - "print \" The radius of curvature in um =\",round(Rc,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The radius of curvature in um = 153.98\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.5.1:Pg-2.25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "lamda = 850 *10**-9 \n", - "sigma= 45*10**-9 \n", - "L= 1 \n", - "M= 0.025/(3*10**5*lamda) \n", - "sigma_m= sigma*L*M \n", - "sigma_m= sigma_m*10**9 # formatting in ns/km....\n", - "print \" The Pulse spreading in ns/Km =\",round(sigma_m,2) \n", - "print \" \\n\\nNOTE*** - The answer in text book is wrongly calculated..\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Pulse spreading in ns/Km = 4.41\n", - " \n", - "\n", - "NOTE*** - The answer in text book is wrongly calculated..\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.5.2:Pg-2.26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "lamda= 2*10**-9 \n", - "sigma = 75 \n", - "D_mat= 0.03/(3*10**5*2) \n", - "sigma_m= 2*1*D_mat \n", - "sigma_m=sigma_m*10**9 # Fornamtting in ns/Km\n", - "print \" The Pulse spreading in ns/Km =\",int(sigma_m)\n", - "D_mat_led= 0.025/(3*10**5*1550) \n", - "sigma_m_led = 75*1*D_mat_led*10**9 # in ns/Km\n", - "print \" \\n\\nThe Pulse spreading foe LED is ns/Km =\",round(sigma_m_led,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Pulse spreading in ns/Km = 100\n", - " \n", - "\n", - "The Pulse spreading foe LED is ns/Km = 4.03\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.5.3:Pg-2.26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "lamda = 850 \n", - "sigma= 20 \n", - "D_mat = 0.055/(3*10**5*lamda) \n", - "sigma_m= sigma*1*D_mat \n", - "D_mat=D_mat*10**12 # in Ps...\n", - "sigma_m=sigma_m*10**9 # in ns # # \n", - "print \" The material Dispersion in Ps/nm-Km =\",round(D_mat,2) \n", - "print \" \\n\\nThe Pulse spreading in ns/Km =\",round(sigma_m,4) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The material Dispersion in Ps/nm-Km = 215.69\n", - " \n", - "\n", - "The Pulse spreading in ns/Km = 4.3137\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.5.4:Pg-2.30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "n2= 1.48 \n", - "dele = 0.2 \n", - "lamda = 1320 \n", - "Dw = -n2*dele*0.26/(3*10**5*lamda) \n", - "Dw=Dw*10**10 # converting in math.picosecs....\n", - "print \" The waveguide dispersion in math.picosec/nm.Km =\",round(Dw,3) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The waveguide dispersion in math.picosec/nm.Km = -1.943\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6.1:Pg-2.34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "t= 0.1*10**-6 \n", - "L= 12 \n", - "B_opt= 1/(2*t) \n", - "B_opt=B_opt/1000000 # converting from Hz to MHz\n", - "print \" The maximum optical bandwidth in MHz. =\",int(B_opt) \n", - "dele= t/L # Pulse broadening\n", - "dele=dele*10**9 # converting in ns...\n", - "print \" \\n\\nThe pulse broadening per unit length in ns/Km =\",round(dele,2) \n", - "BLP= B_opt*L # BW length product\n", - "print \" \\n\\nThe Bandwidth-Length Product in MHz.Km =\",int(BLP) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The maximum optical bandwidth in MHz. = 5\n", - " \n", - "\n", - "The pulse broadening per unit length in ns/Km = 8.33\n", - " \n", - "\n", - "The Bandwidth-Length Product in MHz.Km = 60\n" - ] - } - ], - "prompt_number": 38 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6.2:Pg-2.34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "t= 0.1*10**-6 \n", - "L= 10.0 \n", - "B_opt= 1/(2*t) \n", - "B_opt=B_opt/1000000 # converting from Hz to MHz\n", - "print \" The maximum optical bandwidth in MHz. =\",int(B_opt) \n", - "dele= t/L \n", - "dele=dele/10**-6 # converting in us...\n", - "print \" \\n\\nThe dispersion per unit length in us/Km =\",round(dele,2) \n", - "BLP= B_opt*L \n", - "print \" \\n\\nThe Bandwidth-Length product in MHz.Km =\",int(BLP) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The maximum optical bandwidth in MHz. = 5\n", - " \n", - "\n", - "The dispersion per unit length in us/Km = 0.01\n", - " \n", - "\n", - "The Bandwidth-Length product in MHz.Km = 50\n" - ] - } - ], - "prompt_number": 40 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6.3:Pg-2.35" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "t= 0.1*10**-6 \n", - "L=15 \n", - "B_opt= 1/(2*t) \n", - "B_opt=B_opt/1000000 # converting from Hz to MHz\n", - "print \" The maximum optical bandwidth in MHz. =\",int(B_opt) \n", - "dele= t/L*10**9 # in ns...\n", - "print \" \\n\\nThe dispersion per unit length in ns/Km =\",round(dele,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The maximum optical bandwidth in MHz. = 5\n", - " \n", - "\n", - "The dispersion per unit length in ns/Km = 6.67\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6.4:Pg-2.35" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "lamda = 0.85*10**-6 \n", - "rms_spect_width = 0.0012*lamda \n", - "sigma_m= rms_spect_width*1*98.1*10**-3 \n", - "sigma_m=sigma_m*10**9 # converting in ns...\n", - "print \" The Pulse Broadening due to material dispersion in ns/Km =\",round(sigma_m,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Pulse Broadening due to material dispersion in ns/Km = 0.1\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6.5:Pg-2.35" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "L= 5.0 # in KM\n", - "n1= 1.5 \n", - "dele= 0.01 \n", - "c= 3*10**8 # in m/s\n", - "delta_t = (L*n1*dele)/c \n", - "delta_t=delta_t*10**12 # convertin to nano secs...\n", - "print \" The delay difference in ns =\",round(delta_t,1)\n", - "sigma= L*n1*dele/(2*math.sqrt(3)*c) \n", - "sigma=sigma*10**12 # convertin to nano secs...\n", - "print \" \\n\\nThe r.m.s pulse broadening in ns =\",round(sigma,2) \n", - "B= 0.2/sigma*1000 # in Mz\n", - "print \" \\n\\nThe maximum bit rate in MBits/sec =\",round(B,2) \n", - "BLP = B*5 \n", - "print \" \\n\\nThe Bandwidth-Length in MHz.Km =\",round(BLP,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The delay difference in ns = 250.0\n", - " \n", - "\n", - "The r.m.s pulse broadening in ns = 72.17\n", - " \n", - "\n", - "The maximum bit rate in MBits/sec = 2.77\n", - " \n", - "\n", - "The Bandwidth-Length in MHz.Km = 13.86\n" - ] - } - ], - "prompt_number": 47 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6.6:Pg-2.36" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "del_t_inter = 5*1 \n", - "del_t_intra = 50*80*1 \n", - "total_dispersion = math.sqrt(5**2 + 0.4**2) \n", - "print \" Total dispersion in ns =\",round(total_dispersion,3) " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Total dispersion in ns = 5.016\n" - ] - } - ], - "prompt_number": 49 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.7.1:Pg-2.37" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "t= 0.1*10**-6 \n", - "L=15 \n", - "dele= t/L*10**9 # convertin to nano secs...\n", - "print \" The Pulse Dispersion in ns =\",round(dele,2) \n", - "B_opt= 1/(2*t)/10**6 # convertin to nano secs...\n", - "print \" \\n\\n The maximum possible Bandwidth in MHz =\",int(B_opt) \n", - "BLP = B_opt*L \n", - "print \" \\n\\nThe BandwidthLength product in MHz.Km =\",int(BLP) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Pulse Dispersion in ns = 6.67\n", - " \n", - "\n", - " The maximum possible Bandwidth in MHz = 5\n", - " \n", - "\n", - "The BandwidthLength product in MHz.Km = 75\n" - ] - } - ], - "prompt_number": 51 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.7.2:Pg-2.38" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "L= 6 \n", - "n1= 1.5 \n", - "delt= 0.01 \n", - "delta_t = L*n1*delt/(3*10**8)*10**12 # convertin to nano secs...\n", - "print \" The delay difference in ns =\",int(delta_t) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The delay difference in ns = 300\n" - ] - } - ], - "prompt_number": 52 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.7.3:Pg-2.39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Lb= 0.09 \n", - "lamda= 1.55*10**-6 \n", - "delta_lamda = 1*10**-9 \n", - "Bf= lamda/Lb \n", - "Lbc= lamda**2/(Bf*delta_lamda) \n", - "print \" The modal Bifriengence in meters =\",round(Lbc,2) \n", - "beta_xy= 2*math.pi/Lb \n", - "print \" \\n\\nThe difference between propogation constants =\",round(beta_xy,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The modal Bifriengence in meters = 139.5\n", - " \n", - "\n", - "The difference between propogation constants = 69.81\n" - ] - } - ], - "prompt_number": 53 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.7.4:Pg-2.39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "t= 0.1*10**-6 \n", - "B_opt= 1/(2*t)/1000000 \n", - "print \" The maximum possible Bandwidth in MHz =\",int(B_opt) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The maximum possible Bandwidth in MHz = 5\n" - ] - } - ], - "prompt_number": 54 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.7.5:Pg-2.40" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "t= 0.1*10**-6 \n", - "B_opt= 1/(2*t)/1000000 \n", - "print \" The maximum possible Bandwidth in MHz =\",int(B_opt) \n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The maximum possible Bandwidth in MHz = 5\n" - ] - } - ], - "prompt_number": 55 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter03-Optical_Sources_and_Transmitters.ipynb b/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter03-Optical_Sources_and_Transmitters.ipynb deleted file mode 100755 index 1e7a6431..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter03-Optical_Sources_and_Transmitters.ipynb +++ /dev/null @@ -1,826 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:1c5868fa547e8a659e03148d4a7bf0c9a34282713a490e0b68c5b0aa98a2f7e8" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter03:Optical Sources and Transmitters" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.1:Pg-3.10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "x= 0.07 \n", - "Eg= 1.424+1.266*x+0.266*x**2 \n", - "lamda= 1.24/Eg \n", - "print \" The emitted wavelength in um =\",round(lamda,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The emitted wavelength in um = 0.82\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.2:Pg-3.10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "x= 0.26 \n", - "y=0.57 \n", - "Eg= 1.35-0.72*y+0.12*y**2 \n", - "lamda = 1.24/Eg \n", - "print \" The wavelength emitted in um =\",round(lamda,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The wavelength emitted in um = 1.27\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.3:Pg-3.12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "Tr = 60*10**-9 # radiative recombination time\n", - "Tnr= 90*10**-9 # non radiative recomb time\n", - "I= 40*10**-3 # current\n", - "t = Tr*Tnr/(Tr+Tnr) # total recomb time\n", - "t=t*10**9 # Converting in nano secs...\n", - "print \" The total carrier recombination life time in ns =\",int(t) \n", - "t=t/10**9 \n", - "h= 6.625*10**-34 # plancks const\n", - "c= 3*10**8 \n", - "q=1.602*10**-19 \n", - "lamda= 0.87*10**-6 \n", - "Pint=(t/Tr)*((h*c*I)/(q*lamda)) \n", - "Pint=Pint*1000 # converting inmW...\n", - "print \" \\n\\nThe Internal optical power in mW =\",round(Pint,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The total carrier recombination life time in ns = 36\n", - " \n", - "\n", - "The Internal optical power in mW = 34.22\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.4:Pg-3.13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "lamda = 1310*10**-9 \n", - "Tr= 30*10**-9 \n", - "Tnr= 100*10**-9 \n", - "I= 40*10**-3 \n", - "t= Tr*Tnr/(Tr+Tnr) \n", - "t=t*10**9 # converting in nano secs...\n", - "print \" Bulk recombination life time in ns =\",round(t,2) \n", - "t=t/10**9 \n", - "n= t/Tr \n", - "print \" \\n\\nInternal quantum efficiency =\",round(n,3) \n", - "h= 6.625*10**-34 # plancks const\n", - "c= 3*10**8 \n", - "q=1.602*10**-19 \n", - "Pint=(0.769*h*c*I)/(q*lamda)*1000 \n", - "print \" \\n\\nThe internal power level in mW =\",round(Pint,3) \n", - "print \" \\n\\n***NOTE: Internal Power wrong in text book.. Calculation Error..\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Bulk recombination life time in ns = 23.08\n", - " \n", - "\n", - "Internal quantum efficiency = 0.769\n", - " \n", - "\n", - "The internal power level in mW = 29.131\n", - " \n", - "\n", - "***NOTE: Internal Power wrong in text book.. Calculation Error..\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.5:Pg-3.14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "nx= 3.6 \n", - "TF= 0.68 \n", - "n= 0.3 \n", - " # Pe=Pint*TF*1/(4*nx**2) \n", - " # ne= Pe/Px*100 ..eq0\n", - " # Pe = 0.013*Pint # Eq 1\n", - " # Pint = n*P # Eq 2\n", - " # substitute eq2 and eq1 in eq0\n", - "ne = 0.013*0.3*100 \n", - "print \" The external Power efficiency in % =\",round(ne,3) \n", - " # Wrongly printed in textbook. it should be P instead of Pint in last step\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The external Power efficiency in % = 0.39\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.6:Pg-3.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "lamda= 0.85*10**-6 \n", - "Nint = 0.60 \n", - "I= 20*10**-3 \n", - "h= 6.625*10**-34 # plancks const\n", - "c= 3*10**8 \n", - "e=1.602*10**-19 \n", - "Pint = Nint*h*c*I/(e*lamda) \n", - "print \" The optical power emitted in W =\",round(Pint,4) \n", - "\n", - "TF= 0.68 \n", - "nx= 3.6 \n", - "Pe= Pint*TF/(4*nx**2)*1000000 \n", - "print \" \\n\\nPower emitted in the air in uW =\",round(Pe,1) \n", - "Pe=Pe/1000000 \n", - "Nep=Pe/Pint*100 \n", - "print \" \\n\\nExternal power efficiency in % =\",round(Nep,1) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The optical power emitted in W = 0.0175\n", - " \n", - "\n", - "Power emitted in the air in uW = 229.7\n", - " \n", - "\n", - "External power efficiency in % = 1.3\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.7:Pg-3.16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "lamda = 0.87*10**-6 \n", - "Tr= 50*10**-9 \n", - "I= 0.04 \n", - "Tnr= 110*10**-9 \n", - "t= Tr*Tnr/(Tr+Tnr) \n", - "t=t*10**9 # converting in ns...\n", - "print \" Total carrier recombination life time in ns =\",round(t,2) \n", - "t=t/10**9 \n", - "h= 6.625*10**-34 # plancks const\n", - "c= 3*10**8 \n", - "q=1.602*10**-19 \n", - "n= t/Tr \n", - "print \" \\n\\nThe efficiency in % \",round(n,3) \n", - "Pint=(n*h*c*I)/(q*lamda)*1000 \n", - "print \" \\n\\nInternal power generated in mW =\",round(Pint,2) \n", - "print \" \\n\\n***NOTE- Internal Power wrong in book... \"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Total carrier recombination life time in ns = 34.38\n", - " \n", - "\n", - "The efficiency in % 0.688\n", - " \n", - "\n", - "Internal power generated in mW = 39.22\n", - " \n", - "\n", - "***NOTE- Internal Power wrong in book... \n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.8:Pg-3.16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - " \n", - "\n", - "V= 2 \n", - "I= 100*10**-3 \n", - "Pc= 2*10**-3 \n", - "P= V*I \n", - "Npc= Pc/P*100 \n", - "print \" The overall power conversion efficiency in % =\",int(Npc) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The overall power conversion efficiency in % = 1\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.3.1:Pg-3.25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "r1= 0.32 \n", - "r2= 0.32 \n", - "alpha= 10 \n", - "L= 500*10**-4 \n", - "temp=math.log(1/(r1*r2)) \n", - "Tgth = alpha + (temp/(2*L)) \n", - "print \" The optical gain at threshold in /cm =\",round(Tgth,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The optical gain at threshold in /cm = 32.79\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.3.2:Pg-3.27" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - " \n", - "n= 3.7 \n", - "lamda = 950*10**-9 \n", - "L= 500*10**-6 \n", - "c= 3*10**8 \n", - "DELv = c/(2*L*n)*10*10**-10 # converting in GHz...\n", - "print \" The frequency spacing in GHz =\",int(DELv) \n", - "DEL_lamda= lamda**2/(2*L*n)*10**9 # converting to nm..\n", - "print \" \\n\\nThe wavelength spacing in nm =\",round(DEL_lamda,2) \n", - "\n", - "print \" \\n\\n***NOTE- The value of wavelength taken wrongly in book\" \n", - " # value of lamda taken wrongly while soving for DEL_LAMDA inthe book..\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The frequency spacing in GHz = 81\n", - " \n", - "\n", - "The wavelength spacing in nm = 0.24\n", - " \n", - "\n", - "***NOTE- The value of wavelength taken wrongly in book\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.3.3:Pg-3.30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " #Given\n", - " \n", - "L= 0.04 \n", - "n= 1.78 \n", - "lamda= 0.55*10**-6 \n", - "c= 3*10**8 \n", - "q= 2*n*L/lamda \n", - "q=q/10**5 \n", - "print \" Number of longitudinal modes =\",round(q,2),\"x 10^5\" \n", - "del_f= c/(2*n*L) \n", - "del_f=del_f*10**-9 \n", - "print \" \\n\\nThe frequency seperation in GHz =\",round(del_f,1) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Number of longitudinal modes = 2.59 x 10^5\n", - " \n", - "\n", - "The frequency seperation in GHz = 2.1\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.3.4:Pg-3.33" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "Nt= 0.18 \n", - "V= 2.5 \n", - "Eg= 1.43 \n", - "Nep= Nt*Eg*100/V \n", - "print \" The total efficiency in % =\",round(Nep,3) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The total efficiency in % = 10.296\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.3.5:Pg-3.33" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "n= 3.6 \n", - "BETA= 21*10**-3 \n", - "alpha= 10 \n", - "L= 250*10**-4 \n", - "\n", - "r= (n-1)**2/(n+1)**2 \n", - "Jth= 1/BETA *( alpha + (math.log(1/r)/L)) \n", - "Jth=Jth/1000 # converting for displaying...\n", - "print \" The threshold current density =\",round(Jth,3),\"x 10**3\" \n", - "Jth=Jth*1000 \n", - "Ith =Jth*250*100*10**-8 \n", - "Ith=Ith*1000 # converting into mA...\n", - "print \" \\n\\nThe threshold current in mA =\",round(Ith,1) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The threshold current density = 2.65 x 10**3\n", - " \n", - "\n", - "The threshold current in mA = 662.4\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.3.6:Pg-3.34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "T= 305.0 \n", - "T0 = 160.0 \n", - "T1= 373.0\n", - "\n", - "Jth_32 = exp(T/T0) \n", - "Jth_100 = exp(T1/T0) \n", - "R_j = Jth_100/Jth_32 \n", - "print \" Ratio of current densities at 160K is =\",round(R_j,2) \n", - "print \" \\n\\n***NOTE- Wrong in book...\\nJth(100) calculated wrongly...\" \n", - "To = 55 \n", - "Jth_32_new = exp(T/To) \n", - "Jth_100_new = exp(T1/To) \n", - "R_j_new = Jth_100_new/Jth_32_new \n", - "print \" \\n\\nRatio of current densities at 55K is \",round(R_j_new,2) \n", - " # wrong in book...\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Ratio of current densities at 160K is = 1.53\n", - " \n", - "\n", - "***NOTE- Wrong in book...\n", - "Jth(100) calculated wrongly...\n", - " \n", - "\n", - "Ratio of current densities at 55K is 3.44\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.4.1:Pg-3.42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "Bo= 150 \n", - "rs= 35*10**-4 \n", - "a1= 25*10**-6 \n", - "NA= 0.20 \n", - "a2= 50*10**-6 \n", - "\n", - "Pled = (a1/rs)**2 * (math.pi**2*rs**2*Bo*NA**2) \n", - "Pled=Pled*10**10 # converting in uW...\n", - "print \" The power coupled inthe fibre in uW =\",int(Pled) \n", - "Pled_new = (math.pi**2*rs**2*Bo*NA**2) \n", - "Pled_new=Pled_new*10**6 # converting in uW...\n", - "print \" \\n\\nThe Power coupled for case 2 in uW =\",round(Pled_new,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The power coupled inthe fibre in uW = 370\n", - " \n", - "\n", - "The Power coupled for case 2 in uW = 725.42\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.4.2:Pg-3.43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "n= 1.48 \n", - "n1= 3.6 \n", - "R= (n1-n)**2/(n1+n)**2 \n", - "print \" The Fresnel Reflection is \",round(R,4) \n", - "L= -10*math.log10(1-R) \n", - "print \" \\n\\nPower loss in dB =\",round(L,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Fresnel Reflection is 0.1742\n", - " \n", - "\n", - "Power loss in dB = 0.83\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.4.3:Pg-3.44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "NA= 0.20 \n", - "Bo= 150 \n", - "rs= 35*10**-6 \n", - "Pled = math.pi**2*rs**2*Bo*NA**2 \n", - "Pled=Pled*10**10 # convertin in uW for displaying...\n", - "print \" The optical power coupled in uW =\",round(Pled,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The optical power coupled in uW = 725.42\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.4.4:Pg-3.44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "n1= 1.5 \n", - "n=1 \n", - "R= (n1-n)**2/(n1+n)**2 \n", - "L= -10*math.log10(1-R) \n", - " # Total loss is twice due to reflection\n", - "L= L+L \n", - "print \" Total loss due to Fresnel Reflection in dB =\",round(L,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Total loss due to Fresnel Reflection in dB = 0.35\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.4.5:Pg-3.51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - " \n", - "n1= 1.5 \n", - "n=1.0 \n", - "y=5.0 \n", - "a= 25.0 \n", - "temp1=(1-(y/(2*a)**2))**0.5 \n", - "temp1=temp1*(y/a) \n", - "temp=2*math.acos(0.9996708) # it should be acos(0.1) actually... due to approximations\n", - " \n", - " # answer varies a lot... \n", - "temp=math.degrees(temp)-temp1 \n", - " # temp=temp \n", - "tem= 16*(1.5**2)/(2.5**4) \n", - "tem=tem/math.pi \n", - "temp=temp*tem \n", - "Nlat= temp \n", - "print \" The Coupling efficiency is =\",round(Nlat,3) \n", - "L= -10*math.log10(Nlat) \n", - "print \" \\n\\nThe insertion loss in dB =\",round(L,2) \n", - "temp1=(1-(y/(2*a)**2))**0.5 \n", - "temp1=temp1*(y/a) \n", - "temp=2*math.acos(0.9996708) # it should be acos(0.1) actually... due to approximations\n", - " # answer varies a lot... \n", - "temp=math.degrees(temp)-temp1 \n", - "temp=temp/math.pi \n", - "N_new =temp \n", - "print \" \\n\\nEfficiency when joint index is matched =\",round(N_new,3) \n", - "L_new= -10*math.log10(N_new) \n", - "print \" \\n\\nThe new insertion loss in dB =\",round(L_new,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Coupling efficiency is = 0.804\n", - " \n", - "\n", - "The insertion loss in dB = 0.95\n", - " \n", - "\n", - "Efficiency when joint index is matched = 0.872\n", - " \n", - "\n", - "The new insertion loss in dB = 0.59\n" - ] - } - ], - "prompt_number": 39 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter04-Optical_Detectors_and_Receivers.ipynb b/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter04-Optical_Detectors_and_Receivers.ipynb deleted file mode 100755 index 9dca6b9e..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter04-Optical_Detectors_and_Receivers.ipynb +++ /dev/null @@ -1,644 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e29ad753b5f2886d343bb74ecb0ecc91fcb2a9898826cbfcabd7e953e57d2f63" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter04: Optical Detectors and Receivers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.1:Pg-4.5" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "Eg= 1.1 \n", - "lamda_c = 1.24/Eg \n", - "print \"The cut off wavelength in um= \",round(lamda_c,2) \n", - "\n", - "Eg_ger =0.67 \n", - "lamda_ger= 1.24/Eg_ger \n", - "print \" \\nThe cut off wavelength for Germanium in um= \",round(lamda_ger,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The cut off wavelength in um= 1.13\n", - " \n", - "The cut off wavelength for Germanium in um= 1.85\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.2:Pg-4.5" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given \n", - "Eg = 1.43 \n", - "lamda = 1.24/Eg \n", - "lamda=lamda*1000 # converting in nm\n", - "print \"The cut off wavelength in nm =\",round(lamda,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The cut off wavelength in nm = 867.13\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.3:Pg-4.5" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "P = 6*10**6 \n", - "Eh_pair= 5.4*10**6 \n", - "n= Eh_pair/P*100 \n", - "print \" The quantum efficiency in % = \",n \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The quantum efficiency in % = 90.0\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.4:Pg-4.6" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "R= 0.65 \n", - "P0= 10*10**-6 \n", - "Ip= R*P0 \n", - "Ip=Ip*10**6 # convertinf in uA...\n", - "print \" The generated photocurrent in uA = \",Ip \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The generated photocurrent in uA = 6.5\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.5:Pg-4.6" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "Ec= 1.2*10**11 \n", - "P= 3*10**11 \n", - "lamda = 0.85*10**-6 \n", - "n= Ec/P*100 \n", - "print \"The efficiency in % =\",n \n", - "\n", - "q= 1.602*10**-19 \n", - "h= 6.625*10**-34 \n", - "c= 3*10**8 \n", - "n= n/100 \n", - "R= n*q*lamda/(h*c) \n", - "print \" \\n\\nThe Responsivity of the photodiode in A/W=\",round(R ,4)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The efficiency in % = 40.0\n", - " \n", - "\n", - "The Responsivity of the photodiode in A/W= 0.2741\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.6:Pg-4.7" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "n= 0.65 \n", - "E= 1.5*10**-19 \n", - "Ip= 2.5*10**-6 \n", - "h= 6.625*10**-34 \n", - "c= 3*10**8 \n", - "lamda= h*c/E \n", - "lamda=lamda*10**6 # converting in um for displaying...\n", - "print \"The wavelength in um =\",lamda \n", - "lamda=lamda*10**-6 \n", - "q= 1.602*10**-19 \n", - "R= n*q*lamda/(h*c) \n", - "print \"\\nThe Responsivity in A/W =\",R \n", - "Pin= Ip/R \n", - "Pin=Pin*10**6 # converting in uW for displaying/..\n", - "print \" \\nThe incidnt power in uW= \",round(Pin,1) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The wavelength in um = 1.325\n", - "\n", - "The Responsivity in A/W = 0.6942\n", - " \n", - "The incidnt power in uW= 3.6\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.7:Pg-4.8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "Iin= 1 \n", - "lamda= 1550*10**-9 \n", - "q= 1.602*10**-19 \n", - "h= 6.625*10**-34 \n", - "c= 3*10**8 \n", - "n=0.65 \n", - "Ip=n*q*lamda*Iin/(h*c) \n", - "Ip=Ip*1000 # converting in mA for displaying...\n", - "print \" The average photon current in mA= \",int(Ip)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The average photon current in mA= 812\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.8:Pg-4.9" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "n= 0.70 \n", - "Ip= 4*10**-6 \n", - "e= 1.602*10**-19 \n", - "h= 6.625*10**-34 \n", - "c= 3*10**8 \n", - "E= 1.5*10**-19\n", - "lamda = h*c/E \n", - "lamda=lamda*10**6 # converting um for displaying...\n", - "print \"The wavelength in um =\",round(lamda,3) \n", - "R= n*e/E \n", - "Po= Ip/R \n", - "Po=Po*10**6 # converting um for displaying...\n", - "print \" \\nIncident optical Power in uW =\",round(Po,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The wavelength in um = 1.325\n", - " \n", - "Incident optical Power in uW = 5.35\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.2.1:Pg-4.14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Ct= 7*10.0**-12\n", - "Rt= 50*1*10.0**6/(50+(1*10**6))\n", - "B= 1/(2*math.pi*Rt*Ct)\n", - "B=B*10**-6 #converting in mHz for displaying...\n", - "print \"The bandwidth of photodetector in MHz =\",round(B,2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The bandwidth of photodetector in MHz = 454.75\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.2.2:Pg-4.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "W= 25*10**-6 \n", - "Vd= 3*10**4 \n", - "Bm= Vd/(2*math.pi*W) \n", - "RT= 1/Bm \n", - "RT=RT*10**9 # converting ns for displaying...\n", - "print \" The maximum response time in ns =\",round(RT,2) " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The maximum response time in ns = 5.24\n" - ] - } - ], - "prompt_number": 45 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "\n", - "Ex4.2.3:Pg-4.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "e= 1.602*10**-19 \n", - "h= 6.625*10**-34 \n", - "v= 3*10**8 \n", - "n=0.65 \n", - "I= 10*10**-6 \n", - "lamda= 900*10**-9 \n", - "R= n*e*lamda/(h*v) \n", - "Po= 0.5*10**-6 \n", - "Ip= Po*R \n", - "M= I/Ip \n", - "print \" The multiplication factor =\",round(M,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The multiplication factor = 42.41\n" - ] - } - ], - "prompt_number": 48 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.3.1:Pg-4.18" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "n=0.65 \n", - "lamda = 900*10**-9 \n", - "Pin= 0.5*10**-6 \n", - "Im= 10*10**-6 \n", - "q= 1.602*10**-19 \n", - "h= 6.625*10**-34 \n", - "c= 3*10**8 \n", - "R= n*q*lamda/(h*c) \n", - "Ip= R*Pin \n", - "M= Im/Ip \n", - "print \" The multiplication factor =\",round(M,2)\n", - "print \"\\n***NOTE-Answer wrong in textbook...\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The multiplication factor = 42.41\n", - "\n", - "***NOTE-Answer wrong in textbook...\n" - ] - } - ], - "prompt_number": 51 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.6.1:Pg-4.34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "lamda = 1300*10**-9 \n", - "Id= 4*10**-9 \n", - "n=0.9 \n", - "Rl= 1000 \n", - "Pincident= 300*10**-9 \n", - "BW= 20*10**6 \n", - "q= 1.602*10**-19 \n", - "h= 6.625*10**-34 \n", - "v= 3*10**8 \n", - "Iq= math.sqrt((q*Pincident*n*lamda)/(h*v)) \n", - "Iq= math.sqrt(Iq) \n", - "Iq=Iq*100 # converting in proper format for displaying...\n", - "print \"Mean square quantum noise current in Amp*10^11 =\",round(Iq,2)\n", - "I_dark= 2*q*BW*Id \n", - "I_dark=I_dark*10**19 # converting in proper format for displaying...\n", - "print \" \\nMean square dark current in Amp*10^-19 =\",round(I_dark,3) \n", - "k= 1.38*10**-23 \n", - "T= 25+273 \n", - "It= 4*k*T*BW/Rl \n", - "It=It*10**16 # converting in proper format for displaying...\n", - "print \" \\nMean square thermal nise current in Amp*10^-16 =\",round(It,2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mean square quantum noise current in Amp*10^11 = 2.31\n", - " \n", - "Mean square dark current in Amp*10^-19 = 0.256\n", - " \n", - "Mean square thermal nise current in Amp*10^-16 = 3.29\n" - ] - } - ], - "prompt_number": 61 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.8.1:Pg-4.39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "lamda = 850*10**-9 # meters\n", - "BER= 1*10**-9 \n", - "N_bar = 9*log(10) \n", - "h= 6.625*10**-34 # joules-sec\n", - "v= 3*10**8 # meters/sec\n", - "n= 0.65 # assumption\n", - "E=N_bar*h*v/(n*lamda) \n", - "E=E*10**18 # /converting in proper format for displaying...\n", - "print \" The Energy received in Joules*10^-18 =\",round(E,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Energy received in Joules*10^-18 = 7.45\n" - ] - } - ], - "prompt_number": 64 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.8.2:Pg-4.39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "lamda = 850*10**-9 \n", - "BER = 1*10**-9 \n", - "BT=10*10**6 \n", - "h= 6.625*10**-34 \n", - "c= 3*10**8 \n", - "Ps= 36*h*c*BT/lamda \n", - "Ps=Ps*10**12 # /converting in proper format for displaying...\n", - "print \"The minimum incidental optical power required id in pW =\",round(Ps,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The minimum incidental optical power required id in pW = 84.18\n" - ] - } - ], - "prompt_number": 67 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.8.3:Pg-4.40" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "C= 5*10**-12 \n", - "B =50*10**6 \n", - "Ip= 1*10**-7 \n", - "e= 1.602*10**-19 \n", - "k= 1.38*10**-23 \n", - "T= 18+273 \n", - "M= 1 \n", - "Rl= 1/(2*math.pi*C*B) \n", - "S_N= Ip**2/((2*e*B*Ip)+(4*k*T*B/Rl)) \n", - "S_N = 10*math.log10(S_N) # in db\n", - "print \" The S/N ratio in dB =\",round(S_N,2) \n", - "M=41.54 \n", - "S_N_new= (M**2*Ip**2)/((2*e*B*Ip*M**2.3)+(4*k*T*B/Rl)) \n", - "S_N_new = 10*math.log10(S_N_new) # in db\n", - "print \" \\n\\nThe new S/N ratio in dB =\",round(S_N_new,2)\n", - "print \" \\n\\nImprovement over M=1 in dB =\",round(S_N_new-S_N,1) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The S/N ratio in dB = 8.99\n", - " \n", - "\n", - "The new S/N ratio in dB = 32.49\n", - " \n", - "\n", - "Improvement over M=1 in dB = 23.5\n" - ] - } - ], - "prompt_number": 70 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter05-Design_Considerations_in_Optical_Links.ipynb b/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter05-Design_Considerations_in_Optical_Links.ipynb deleted file mode 100755 index 3915a0b4..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter05-Design_Considerations_in_Optical_Links.ipynb +++ /dev/null @@ -1,458 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:b4a79f107959b9c220fb0fbffb78f81a806979a06263be16ca010cadce8d4a27" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter05: Design Considerations in Optical Links" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.3.1:Pg-5.7" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "B= 15*10**-6 \n", - "L= 4 \n", - "BER= 1*10**-9 \n", - "Ls= 0.5 \n", - "Lc= 1.5 \n", - "alpha= 6 \n", - "Pm= 8 \n", - "Pt= 2*Lc +(alpha*L)+(Pm) \n", - "print \" The actual loss in fibre in dB =\",int(Pt) \n", - "Pmax = -10-(-50) \n", - "print \" \\nThe maximum allowable system loss in dBm = \",Pmax " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The actual loss in fibre in dB = 35\n", - " \n", - "The maximum allowable system loss in dBm = 40\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.3.2:Pg-5.8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Ps= 0.1 \n", - "alpha = 6 \n", - "L= 0.5 \n", - "Ps = 10*math.log10(Ps) \n", - "NA= 0.25 \n", - "Lcoupling= -10*math.log10(NA**2) \n", - "Lf= alpha*L \n", - "lc= 2*2 \n", - "Pm= 4 \n", - "Pout = Ps-(Lcoupling+Lf+lc+Pm) \n", - "print \" The actual power output in dBm = \",int(Pout) \n", - "Pmin = -35 \n", - "print \" Minimum input power required in dBm= \",Pmin \n", - "print \" As Pmin > Pout, system will perform adequately over the system operating life.\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The actual power output in dBm = -33\n", - " Minimum input power required in dBm= -35\n", - " As Pmin > Pout, system will perform adequately over the system operating life.\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.3.3:Pg-5.8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "Ps= 5 \n", - "Lcoupling = 3 \n", - "Lc= 2 \n", - "L_splicing = 50*0.1 \n", - "F_atten = 25 \n", - "L_total = Lcoupling+Lc+L_splicing+F_atten \n", - "P_avail = Ps-L_total \n", - "sensitivity = -40 \n", - "loss_margin = -sensitivity-(-P_avail) \n", - "print \" The loss margin of the system in dBm= -\",loss_margin \n", - "sensitivity_fet = -32 \n", - "loss_margin_fet=-sensitivity_fet-(-P_avail) \n", - "print \"The loss marging for the FET receiver in dBm= -\",loss_margin_fet \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The loss margin of the system in dBm= - 10.0\n", - "The loss marging for the FET receiver in dBm= - 2.0\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.3.4:Pg-5.9" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "LED_output = 3 \n", - "PIN_sensitivity = -54 \n", - "allowed_loss= LED_output -(-PIN_sensitivity) \n", - "Lcoupling = 17.5 \n", - "cable_atten = 30 \n", - "power_margin_coupling= 39.5 \n", - "power_margin_splice=6.2 \n", - "power_margin_cable=9.5 \n", - "final_margin= power_margin_coupling+power_margin_splice+power_margin_cable \n", - "print \" The safety margin in dB =\",final_margin\n", - " # Answer in book is wrong...\n", - "print \" \\n***NOTE- Answer wrong in book...\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The safety margin in dB = 55.2\n", - " \n", - "***NOTE- Answer wrong in book...\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.3.5:Pg-5.10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "optical_power=-10 \n", - "receiver_sensitivity=-41 \n", - "total_margin= optical_power-receiver_sensitivity \n", - "cable_loss= 7*2.6 \n", - "splice_loss= 6*0.5 \n", - "connector_loss= 1*1.5 \n", - "safety_margin= 6 \n", - "total_loss= cable_loss+splice_loss+connector_loss+safety_margin \n", - "excess_power_margin= total_margin-total_loss \n", - "print \" The system is viable and provides excess power margin in dB=\",excess_power_margin \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The system is viable and provides excess power margin in dB= 2.3\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.4.1:Pg-5.13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Ttx= 15 \n", - "Tmat=21 \n", - "Tmod= 3.9 \n", - "BW= 25.0 \n", - "Trx= 350.0/BW \n", - "\n", - "Tsys = math.sqrt(Ttx**2+Tmat**2+Tmod**2+Trx**2) \n", - "print \" The system rise time in ns.= \",round(Tsys,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The system rise time in ns.= 29.62\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.4.2:Pg-5.14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "Ttrans = 1.75*10**-9 \n", - "Tled = 3.50*10**-9 \n", - "Tcable=3.89*10**-9 \n", - "Tpin= 1*10**-9 \n", - "Trec= 1.94*10**-9 \n", - "Tsys= math.sqrt(Ttrans**2+Tled**2+Tcable**2+Tpin**2+Trec**2) \n", - "Tsys=Tsys*10**9 # converting in ns for dislaying...\n", - "print \" The system rise time in ns= \",round(Tsys,2)\n", - "Tsys=Tsys*10**-9 \n", - "BW= 0.35/Tsys \n", - "BW=BW/1000000.0 # converting in MHz for dislaying...\n", - "print \" \\nThe system bandwidth in MHz =\",round(BW,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The system rise time in ns= 5.93\n", - " \n", - "The system bandwidth in MHz = 58.99\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.4.3:Pg-5.14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Ttx= 8*10**-9 \n", - "Tintra= 1*10**-9 \n", - "Tmodal=5*10**-9 \n", - "Trr= 6*10**-9 \n", - "Tsys= math.sqrt(Ttx**2+(8*Tintra)**2+(8*Tmodal)**2+Trr**2) \n", - "\n", - "BWnrz= 0.7/Tsys \n", - "BWnrz=BWnrz/1000000 # converting in ns for dislaying...\n", - "BWrz=0.35/Tsys \n", - "BWrz=BWrz/1000000 # converting in ns for dislaying...\n", - "print \" Maximum bit rate for NRZ format in Mb/sec= \",round(BWnrz,2)\n", - "print \" \\nMaximum bit rate for RZ format in Mb/sec= \",round(BWrz,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Maximum bit rate for NRZ format in Mb/sec= 16.67\n", - " \n", - "Maximum bit rate for RZ format in Mb/sec= 8.33\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.4.4:Pg-5.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Ts= 10*10**-9 \n", - "Tn=9*10**-9 \n", - "Tc=2*10**-9 \n", - "Td=3*10**-9 \n", - "BW= 6*10**6 \n", - "Tsyst= 1.1*math.sqrt(Ts**2+(5*Tn)**2+(5*Tc)**2+Td**2) \n", - "Tsyst=Tsyst*10**9 # converting in ns for displying...\n", - "Tsyst_max = 0.35/BW \n", - "Tsyst_max=Tsyst_max*10**9 # converting in ns for displying...\n", - "print \" Rise system of the system in ns= \",round(Tsyst,2)\n", - "print \" \\nMaximum Rise system of the system in ns= \",round(Tsyst_max,2)\n", - "print \" \\nSpecified components give a system rise time which is adequate for the bandwidth and distance requirements of the optical fibre link.\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Rise system of the system in ns= 51.99\n", - " \n", - "Maximum Rise system of the system in ns= 58.33\n", - " \n", - "Specified components give a system rise time which is adequate for the bandwidth and distance requirements of the optical fibre link.\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.5.1:Pg-5.18" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "del_t_1 = 10*100*10**-9 \n", - "Bt_nrz_1 = 0.7/(del_t_1*1000000) \n", - "Bt_rz_1 = 0.35/(del_t_1*1000000) \n", - "print \"First case.\"\n", - "print \" \\nBit rate for nrz in Mb/sec= \",Bt_nrz_1 \n", - "print \" \\nBit rate for rz in Mb/sec= \",Bt_rz_1 \n", - "del_t_2 = 20*1000*10**-9 \n", - "Bt_nrz_2 = 0.7/(del_t_2*1000000) \n", - "Bt_rz_2 = 0.35/(del_t_2*1000000) \n", - "print \" \\n\\nSecond case\" \n", - "print \" \\nBit rate for nrz in Mb/sec= \",Bt_nrz_2 \n", - "print \" \\nBit rate for rz in Mb/sec= \",Bt_rz_2 \n", - "del_t_3 = 2*2000*10**-9 \n", - "Bt_nrz_3 = 0.7/(del_t_3*1000) \n", - "Bt_rz_3 = 0.35/(del_t_3*1000) \n", - "print \" \\n\\nThird case\" \n", - "print \" \\nBit rate for nrz in BITS/sec= \",int(Bt_nrz_3) \n", - "print \" \\nBit rate for rz in BITS/sec= \",Bt_rz_3 \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "First case.\n", - " \n", - "Bit rate for nrz in Mb/sec= 0.7\n", - " \n", - "Bit rate for rz in Mb/sec= 0.35\n", - " \n", - "\n", - "Second case\n", - " \n", - "Bit rate for nrz in Mb/sec= 0.035\n", - " \n", - "Bit rate for rz in Mb/sec= 0.0175\n", - " \n", - "\n", - "Third case\n", - " \n", - "Bit rate for nrz in BITS/sec= 174\n", - " \n", - "Bit rate for rz in BITS/sec= 87.5\n" - ] - } - ], - "prompt_number": 31 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter1.ipynb b/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter1.ipynb deleted file mode 100755 index ec323da9..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter1.ipynb +++ /dev/null @@ -1,1240 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:742c44cb267900361b88ee7b473acd2b1b40f32a4db7e15db6918955b1159df0" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter01:Fiber Optics Communications System" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "\n", - "Ex1.7.1:Pg-1.14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "n1= 1.5 # for glass\n", - "n2= 1.33 # for water\n", - "phi1= (math.pi/6) # phi1 is the angel of incidence\n", - " # According to Snell's law...\n", - " # n1*sin(phi1)= n2*sin(phi2) \n", - "sinphi2= (n1/n2)*math.sin(phi1) # phi2 is the angle of refraction..\n", - "phi2 = math.asin(sinphi2)\n", - "temp= math.degrees(phi2)\n", - "print \" The angel of refraction in degrees =\",round(temp,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The angel of refraction in degrees = 34.33\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.7.2:Pg-1.14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "n1= 1.50 # RI of glass..\n", - "n2 = 1.0 # RI of air...\n", - " # According to Snell's law...\n", - " # n1*sin(phi1)= n2*sin(phi2) \n", - " # From definition of critical angel phi2 = 90 degrees and phi1 will be critical angel\n", - "t1=(n2/n1)*math.sin(math.pi/2)\n", - "phiC=math.asin(t1)\n", - "temp= math.degrees(phiC)\n", - "print \" The Critical angel in degrees =\",round(temp,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Critical angel in degrees = 41.81\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.7.3:Pg-1.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - " # To find RI of glass\n", - " # To find the critical angle for glass...\n", - " \n", - "phi1 = 33 # Angle of incidence..\n", - "phi2 = 90 # Angle of refraction..\n", - "n2= 1.0 \n", - "\n", - "n1 = round(sin(math.radians(phi2))/sin(math.radians(phi1)),3) \n", - "print \" The Refractive Index is =\",n1 \n", - "\n", - "#phiC = math.asin((n2/n1)*math.sin(90)) \n", - "phiC=math.asin(0.54)\n", - "print \" \\n\\nThe Critical angel in degrees =\",round(math.degrees(phiC),2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Refractive Index is = 1.836\n", - " \n", - "\n", - "The Critical angel in degrees = 32.68\n" - ] - } - ], - "prompt_number": 81 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.7.4:Pg-1.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - "import math\n", - " \n", - "n1= 1.5 # TheRi of medium 1\n", - "n2= 1.36 # the RI of medium 2\n", - "phi1= 30 # The angle of incidence\n", - " # According to Snell's law...\n", - " # n1*sin(phi1)= n2*sin(phi2) \n", - "phi2 = math.asin((n1/n2)*math.sin(math.radians(phi1))) \n", - "print \" The angel of refraction is in degrees from normal = \",round(math.degrees(phi2),2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The angel of refraction is in degrees from normal = 33.47\n" - ] - } - ], - "prompt_number": 91 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.7.5:Pg-1.16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - " \n", - "n1 = 3.6 # RI of GaAs..\n", - "n2 = 3.4 # RI of AlGaAs..\n", - "phi1 = 80 # Angle of Incidence..\n", - " # According to Snell's law...\n", - " # n1*sin(phi1)= n2*sin(phi2) \n", - " # At critical angle phi2 = 90...\n", - "phiC = math.asin((n2/n1)*sin(math.radians(90)) )\n", - "print \" The Critical angel in degrees =\",round(math.degrees(phiC),2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Critical angel in degrees = 70.81\n" - ] - } - ], - "prompt_number": 97 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.1:Pg-1.22" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math \n", - "\n", - "n1= 1.5 # RI of medium 1\n", - "n2 =1.45 # RI of medium 2\n", - "\n", - "delt= (n1-n2)/n1 \n", - "NA = n1*(math.sqrt(2*delt)) \n", - "print \" The Numerical aperture =\",round(NA,2)\n", - "phiA = math.asin(NA) \n", - "print \" \\n\\nThe Acceptance angel in degrees =\",round(math.degrees(phiA),2) \n", - "\n", - "phiC = math.asin(n2/n1) \n", - "print \" \\n\\nThe Critical angel in degrees =\",round(degrees(phiC),2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical aperture = 0.39\n", - " \n", - "\n", - "The Acceptance angel in degrees = 22.79\n", - " \n", - "\n", - "The Critical angel in degrees = 75.16\n" - ] - } - ], - "prompt_number": 100 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.2:Pg-1.23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "n1= 1.5 # RI of core\n", - "n2 = 1.48 # RI of cladding..\n", - "\n", - "NA = math.sqrt((n1**2)-(n2**2)) \n", - "print \" The Numerical Aperture =\",round(NA,2) \n", - "\n", - "phiA = math.asin(NA) \n", - "print \" \\n\\nThe Critical angel =\",round(math.degrees(phiA),2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture = 0.24\n", - " \n", - "\n", - "The Critical angel = 14.13\n" - ] - } - ], - "prompt_number": 101 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.3:Pg-1.23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math \n", - " \n", - "\n", - "NA = 0.35 # Numerical Aperture\n", - "delt = 0.01 \n", - " # NA= n1*(math.sqrt(2*delt) n1 is RI of core\n", - "n1 = 0.35/(math.sqrt(2*delt)) \n", - "print \"The RI of core =\",round(n1,4) \n", - "\n", - " # Numerical Aperture is also given by \n", - " # NA = math.sqrt(n1**2 - n2**2) # n2 is RI of cladding\n", - "n2 = math.sqrt((n1**2-NA**2)) \n", - "print \" \\n\\nThe RI of Cladding =\",round(n2,3) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The RI of core = 2.4749\n", - " \n", - "\n", - "The RI of Cladding = 2.45\n" - ] - } - ], - "prompt_number": 104 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.4:Pg-1.24" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "Vc = 2.01*10**8 # velocity of light in core in m/sec...\n", - "phiC= 80.0 # Critical angle in degrees...\n", - "\n", - " # RI of Core (n1) is given by (Velocity of light in air/ velocity of light in air)...\n", - "n1= 3*10**8/Vc \n", - " # From critical angle and the value of n1 we calculate n2...\n", - "n2 = sin(math.radians(phiC))*n1 # RI of cladding...\n", - "NA = math.sqrt(n1**2-n2**2) \n", - "print \" The Numerical Aperture =\",round(NA,2) \n", - "phiA = math.asin(NA) # Acceptance angle...\n", - "print \" \\n\\nThe Acceptance angel in degrees =\",round(math.degrees(phiA),2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture = 0.26\n", - " \n", - "\n", - "The Acceptance angel in degrees = 15.02\n" - ] - } - ], - "prompt_number": 106 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.5:Pg-1.25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "n1 = 1.4 # RI of Core..\n", - "n2 = 1.35 # RI of Cladding\n", - "\n", - "phiC = math.asin(n2/n1) # Critical angle..\n", - "print \" The Critical angel in degrees =\",round(math.degrees(phiC),2) \n", - "\n", - "NA = math.sqrt(n1**2-n2**2) # numerical Aperture...\n", - "print \" \\n\\nThe Numerical Aperture is =\",round(NA,2) \n", - "\n", - "phiA = math.asin(NA) # Acceptance angle... \n", - "print \" \\n\\nThe Acceptance angel in degrees =\",round(math.degrees(phiA),2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Critical angel in degrees = 74.64\n", - " \n", - "\n", - "The Numerical Aperture is = 0.37\n", - " \n", - "\n", - "The Acceptance angel in degrees = 21.77\n" - ] - } - ], - "prompt_number": 107 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.6:Pg-1.25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "n1 = 1.48 # RI of core..\n", - "n2 = 1.46 # RI of Cladding..\n", - "\n", - "NA = math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", - "print \" The Numerical Aperture is =\",round(NA,3) \n", - "\n", - "theta = math.pi*NA**2 # The entrance angle theta..\n", - "print \" \\n\\nThe Entrance angel in degrees =\",round(theta,3) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture is = 0.242\n", - " \n", - "\n", - "The Entrance angel in degrees = 0.185\n" - ] - } - ], - "prompt_number": 110 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.7:Pg-1.26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math \n", - "\n", - "delt = 0.007 # relative refractive index difference \n", - "n1 = 1.45 # RI of core...\n", - "NA = n1* math.sqrt((2*delt)) \n", - "print \" The Numerical Aperture is =\",round(NA,4) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture is = 0.1716\n" - ] - } - ], - "prompt_number": 112 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.9.8:Pg-1.26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - "import math\n", - "\n", - "phiA = 8 # accepatance angle in degrees...\n", - "n1 =1.52 # RI of core...\n", - "\n", - "NA = sin(math.radians(phiA)) # Numerical Aperture...\n", - "\n", - "delt = NA**2/(2*(n1**2)) # Relative RI difference...\n", - "print \" The relative refractive index difference =\",round(delt,5) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The relative refractive index difference = 0.00419\n" - ] - } - ], - "prompt_number": 114 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "\n", - "Ex1.9.9:Pg-1.27" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "delt = 0.01 # relative RI difference..\n", - "n1 = 1.48 # RI of core...\n", - "\n", - "NA = n1*(math.sqrt(2*delt)) # Numerical Aperture..\n", - "print \" The Numerical Aperture =\",round(NA,3) \n", - "\n", - "theta = math.pi*NA**2 # Solid Acceptance angle...\n", - "print \" \\n\\nThe Solid Acceptance angel in degrees =\",round(theta,4) \n", - "\n", - "n2 = (1-delt)*n1 \n", - "phiC = math.asin(n2/n1) # Critical Angle...\n", - "print \" \\n\\nThe Critical angel in degrees =\",round(math.degrees(phiC),2) \n", - "print \" \\n\\nCritical angle wrong due to rounding off errors in trignometric functions..\\n Actual value is 90.98 in book.\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture = 0.209\n", - " \n", - "\n", - "The Solid Acceptance angel in degrees = 0.1376\n", - " \n", - "\n", - "The Critical angel in degrees = 81.89\n", - " \n", - "\n", - "Critical angle wrong due to rounding off errors in trignometric functions..\n", - " Actual value is 90.98 in book.\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.1:Pg-1.41" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "d = 50*10**-6 # diameter of fibre...\n", - "n1 = 1.48 # RI of core..\n", - "n2 = 1.46 # RI of cladding..\n", - "lamda = 0.82*10**-6 # wavelength of light..\n", - "\n", - "NA = math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", - "Vn= math.pi*d*NA/lamda # normalised frequency...\n", - "M = Vn**2/2 # number of modes...\n", - "print \" The number of modes in the fibre are =\",int(M) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The number of modes in the fibre are = 1078\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.2:Pg-1.42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - " \n", - " \n", - "V = 26.6 # Normalised frequency..\n", - "lamda = 1300*10**-9 # wavelenght of operation\n", - "a = 25*10**-6 # radius of fibre.\n", - "NA = V*lamda/(2*math.pi*a) # Numerical Aperture..\n", - "print \" The Numerical Aperture =\",round(NA,3) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture = 0.22\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.3:Pg-1.43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - " \n", - "a = 40*10**-6 # radius of core...\n", - "delt = 0.015 # relative RI difference..\n", - "lamda= 0.85*10**-6 # wavelength of operation..\n", - "n1=1.48 # RI of core..\n", - "\n", - "NA = n1*math.sqrt(2*delt) # Numerical Aperture..\n", - "print \" The Numerical Aperture =\", round(NA,4) \n", - "V = 2*math.pi*a*NA/lamda # normalised frequency\n", - "print \" \\n\\nThe Normalised frequency =\",round(V,2) \n", - "\n", - "M = V**2/2 # number of modes..\n", - "print \" \\n\\nThe number of modes in the fibre are =\",int(M) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture = 0.2563\n", - " \n", - "\n", - "The Normalised frequency = 75.8\n", - " \n", - "\n", - "The number of modes in the fibre are = 2872\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.4:Pg-1.43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "NA = 0.20 # Numerical Aperture..\n", - "M = 1000 # number of modes..\n", - "lamda = 850*10**-9 # wavelength of operation..\n", - "\n", - "a = math.sqrt(M*2*lamda**2/(math.pi**2*NA**2)) # radius of core..\n", - "a=a*10**6 # converting in um for displaying...\n", - "print \" The radius of the core in um =\",round(a,2) \n", - "a=a*10**-6 \n", - "M1= ((math.pi*a*NA/(1320*10**-9))**2)/2\n", - "print \" \\n\\nThe number of modes in the fibre at 1320um =\",int(M1) \n", - "print \" \\n\\n***The number of modes in the fibre at 1320um is calculated wrongly in book\" \n", - "M2= ((math.pi*a*NA/(1550*10**-9))**2)/2\n", - "print \" \\n\\nThe number of modes in the fibre at 1550um =\",int(M2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The radius of the core in um = 60.5\n", - " \n", - "\n", - "The number of modes in the fibre at 1320um = 414\n", - " \n", - "\n", - "***The number of modes in the fibre at 1320um is calculated wrongly in book\n", - " \n", - "\n", - "The number of modes in the fibre at 1550um = 300\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.5:Pg-1.44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - " \n", - "NA = 0.2 # Numerical Aperture..\n", - "n2= 1.59 # RI of cladding..\n", - "n0= 1.33 # RI of water..\n", - "lamda = 1300*10**-9 # wavelength..\n", - "a = 25*10**-6 # radius of core..\n", - "n1 = math.sqrt(NA**2+n2**2) # RI of core..\n", - "phiA= math.asin(math.sqrt(n1**2-n2**2)/n0) # Acceptance angle..\n", - "print \" The Acceptance angle is =\",round(math.degrees(phiA),2) \n", - "\n", - "phiC= math.asin(n2/n1) # Critical angle..\n", - "print \" \\n\\nThe critical angle is =\",round(math.degrees(phiC),2) \n", - "V = 2*math.pi*a*NA/lamda # normalisd frequency\n", - "M= V**2/2 # number of modes\n", - "print \" \\n\\nThe number of modes in the fibre are =\",int(M) \n", - "\n", - "print \" \\n\\n***The value of the angle differ from the book because of round off errors.\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Acceptance angle is = 8.65\n", - " \n", - "\n", - "The critical angle is = 82.83\n", - " \n", - "\n", - "The number of modes in the fibre are = 292\n", - " \n", - "\n", - "***The value of the angle differ from the book because of round off errors.\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.6:Pg-1.46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "V= 26.6 # Normalised frequency..\n", - "lamda= 1300*10**-9 # wavelength of operation..\n", - "a= 25*10**-6 # radius of core..\n", - "\n", - "NA = V*lamda/(2*math.pi*a) # Numerical Aperture..\n", - "print \" The Numerical Aperture =\",round(NA,2) \n", - "theta = math.pi*NA**2 # solid Acceptance Angle..\n", - "print \" \\n\\nThe solid acceptance angle in radians =\",round(theta,3) \n", - "\n", - "M= V**2/2 # number of modes..\n", - "print \" \\n\\nThe number of modes in the fibre =\",round(M,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture = 0.22\n", - " \n", - "\n", - "The solid acceptance angle in radians = 0.152\n", - " \n", - "\n", - "The number of modes in the fibre = 353.78\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.7:Pg-1.47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math \n", - "\n", - "n1= 1.49 # RI of core.\n", - "n2=1.47 # RI of cladding..\n", - "a= 2 # radius of core in um..\n", - "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", - " # The maximum V number for single mode operation is 2.4...\n", - "V= 2.4 # Normalised frequency..\n", - "\n", - "lamda = 2*math.pi*a*NA/V # Cutoff wavelength...\n", - "print \" The cutoff wavelength in um =\",round(lamda,2) \n", - "\n", - "\n", - "lamda1 = 1.310 # Givenn cutoff wavelength in um..\n", - "d= V*lamda1/(math.pi*NA) # core diameter..\n", - "print \" \\n\\nThe core diameter in um =\",round(d,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The cutoff wavelength in um = 1.27\n", - " \n", - "\n", - "The core diameter in um = 4.11\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.8:Pg-1.47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - "import math\n", - " \n", - "n1= 1.48 # RI of core..\n", - "a= 4.5 # core radius in um..\n", - "delt= 0.0025 # Relative RI difference..\n", - "V= 2.405 # For step index fibre..\n", - "lamda= (2*math.pi*a*n1*math.sqrt(2*delt))/V # cutoff wavelength..\n", - "print \" The cutoff wavelength in um =\",round(lamda,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The cutoff wavelength in um = 1.23\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.9:Pg-1.48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math \n", - " \n", - "lamda= 0.82*10**-6 # wavelength ofoperation.\n", - "a= 2.5*10**-6 # Radius of core..\n", - "n1= 1.48 # RI of core..\n", - "n2= 1.46 # RI of cladding\n", - "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", - "V= 2*math.pi*a*NA/lamda # Normalisd frequency..\n", - "print \" The normalised frequency =\",round(V,3) \n", - "M= V**2/2 # The number of modes..\n", - "print \" \\n\\nThe number of modes in the fibre are =\",round(M,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The normalised frequency = 4.645\n", - " \n", - "\n", - "The number of modes in the fibre are = 10.79\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.10:Pg-1.49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - "import math\n", - " \n", - "delt= 0.01 # Relative RI difference..\n", - "n1= 1.5 \n", - "M= 1100 # Number of modes...\n", - "lamda= 1.3 # wavelength of operation in um..\n", - "V= math.sqrt(2*M) # Normalised frequency...\n", - "d= V*lamda/(math.pi*n1*math.sqrt(2*delt)) # diameter of core..\n", - "print \" The diameter of the core in um =\",round(d,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The diameter of the core in um = 91.5\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.11:Pg-1.50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "n1= 1.5 # RI of core..\n", - "n2= 1.38 # RI of cladding..\n", - "a= 25*10**-6 # radius of core..\n", - "lamda= 1300*10**-9 # wavelength of operation...\n", - "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture..\n", - "print \" The Numerical Aperture of the given fibre =\",round(NA,4) \n", - "V= 2*math.pi*a*NA/lamda # Normalised frequency..\n", - "print \" \\n\\nThe normalised frequency =\",round(V,2) \n", - "theta= math.asin(NA) # Solid acceptance anglr..\n", - "print \" \\n\\nThe Solid acceptance angle in degrees =\",int(math.degrees(theta)) \n", - "M= V**2/2 # Number of modes..\n", - "print \" \\n\\nThe number of modes in the fibre are =\",int(M) \n", - "print \" \\n\\n***Number of modes wrongly calculated in the book..\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Numerical Aperture of the given fibre = 0.5879\n", - " \n", - "\n", - "The normalised frequency = 71.03\n", - " \n", - "\n", - "The Solid acceptance angle in degrees = 36\n", - " \n", - "\n", - "The number of modes in the fibre are = 2522\n", - " \n", - "\n", - "***Number of modes wrongly calculated in the book..\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.14.12:Pg-1.51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "lamda= 850*10**-9 # wavelength of operation.\n", - "a= 25*10**-6 # Radius of core\n", - "n1= 1.48 # RI of Core...\n", - "n2= 1.46 # RI of cladding..\n", - "\n", - "NA= math.sqrt(n1**2-n2**2) # Numerical Aperture\n", - "\n", - "V= 2*math.pi*a*NA/lamda # Normalised frequency..\n", - "print \" The normalised frequency =\",round(V,2) \n", - "\n", - "lamda1= 1320*10**-9 # wavelength changed...\n", - "V1= 2*math.pi*a*NA/lamda1 # Normalised frequency at new wavelength..\n", - "\n", - "M= V1**2/2 # Number of modes at new wavelength..\n", - "print \" \\n\\nThe number of modes in the fibre at 1320um =\",int(M) \n", - "lamda2= 1550*10**-9 # wavelength 2...\n", - "V2= 2*math.pi*a*NA/lamda2 # New normalised frequency..\n", - "M1= V2**2/2 # number of modes..\n", - "print \" \\n\\nThe number of modes in the fibre at 1550um =\",int(M1 )\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The normalised frequency = 44.81\n", - " \n", - "\n", - "The number of modes in the fibre at 1320um = 416\n", - " \n", - "\n", - "The number of modes in the fibre at 1550um = 301\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.15.1:Pg-1.56" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - " \n", - "n1= 1.48 # RI of core..\n", - "delt= 0.015 # relative RI differencr..\n", - "lamda= 0.85 # wavelength of operation..\n", - "V= 2.4 # for single mode of operation..\n", - "\n", - "a= V*lamda/(2*math.pi*n1*math.sqrt(2*delt)) # radius of core..\n", - "print \" The raduis of core in um =\",round(a,2) \n", - "print \" \\n\\nThe maximum possible core diameter in um =\",round(2*a,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The raduis of core in um = 1.27\n", - " \n", - "\n", - "The maximum possible core diameter in um = 2.53\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.15.2:Pg-1.56" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - "import math\n", - " \n", - "n1= 1.5 # RI of core..\n", - "delt= 0.01 # Relative RI difference...\n", - "lamda= 1.3 # Wavelength of operation...\n", - "V= 2.4*math.sqrt(2) # Maximum value of V for GRIN...\n", - "a= V*lamda/(2*math.pi*n1*math.sqrt(2*delt)) # radius of core..\n", - "print \" The radius of core in um =\",round(a,2) \n", - "print \" \\n\\nThe maximum possible core diameter in um =\",round(2*a,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The radius of core in um = 3.31\n", - " \n", - "\n", - "The maximum possible core diameter in um = 6.62\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1.15.3:Pg-1.56" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "n1= 1.46 # RI of core..\n", - "a = 4.5 # radius of core in um..\n", - "delt= 0.0025 # relative RI difference..\n", - "V= 2.405 # Normalisd frequency for single mode..\n", - "lamda= 2*math.pi*a*n1*math.sqrt(2*delt)/V # cutoff wavelength...\n", - "print \" The cut off wavelength for the given fibre in um =\",round(lamda,3) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The cut off wavelength for the given fibre in um = 1.214\n" - ] - } - ], - "prompt_number": 31 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter2.ipynb b/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter2.ipynb deleted file mode 100755 index 46a8893c..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter2.ipynb +++ /dev/null @@ -1,945 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:211878047ac07bbe36923a59422db9a2025fd46f216dee8cd476326a7778bb6a" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter02: Optical Fiber for Telecommunication" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - " Ex2.2.1:Pg-2.4" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "alpha= 3 # average loss Power decreases by 50% so P(0)/P(z)= 0.5\n", - "lamda= 900*10**-9 # wavelength\n", - "z= 10*math.log10(0.5)/alpha # z is the length\n", - "z= z*-1 \n", - "print \" The length over which power decreases by 50% in Kms= \",round(z,2) \n", - "\n", - "z1= 10*math.log10(0.25)/alpha # Power decreases by 75% so P(0)/P(z)= 0.25\n", - "z1=z1*-1 # as distance cannot be negative...\n", - "print \" \\n\\nThe length over which power decreases by 75% in Kms= \",round(z1,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The length over which power decreases by 50% in Kms= 1.0\n", - " \n", - "\n", - "The length over which power decreases by 75% in Kms= 2.01\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2.2:Pg-2.5" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "\n", - "z=30.0 # Length of the fibre in kms\n", - "alpha= 0.8 # in dB\n", - "P0= 200.0 # Power launched in uW\n", - "pz= P0/10**(alpha*z/10) \n", - "print \" The output power in uW =\",round(pz,4) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The output power in uW = 0.7962\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2.3:Pg-2.6" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math \n", - "\n", - "z=8.0 # fibre length\n", - "p0= 120*10**-6 # power launched\n", - "pz= 3*10**-6 \n", - "alpha= 10*math.log10(p0/pz) # overall attenuation\n", - "print \" The overall attenuation in dB =\",round(alpha,2) \n", - "alpha = alpha/z # attenuation per km\n", - "alpha_new= alpha *10 # attenuation for 10kms\n", - "total_attenuation = alpha_new + 9 # 9dB because of splices\n", - "print \" \\n\\nThe total attenuation in dB =\",int(total_attenuation) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The overall attenuation in dB = 16.02\n", - " \n", - "\n", - "The total attenuation in dB = 29\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2.4:Pg-2.6" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " # Given\n", - " \n", - "z=12.0 # fibre length\n", - "alpha = 1.5 \n", - "p0= 0.3 \n", - "pz= p0/10**(alpha*z/10) \n", - "pz=pz*1000 # formatting pz in nano watts...\n", - "print \" The power at the output of the cable in W = \",round(pz,2),\"x 10^-9\" \n", - "alpha_new= 2.5 \n", - "pz=pz/1000 # pz in uWatts...\n", - "p0_new= 10**(alpha_new*z/10)*pz \n", - "print \" \\n\\nThe Input power in uW= \",round(p0_new,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The power at the output of the cable in W = 4.75 x 10^-9\n", - " \n", - "\n", - "The Input power in uW= 4.75\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2.5:Pg-2.7" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "\n", - "p0=150*10**-6 # power input\n", - "z= 10.0 # fibre length in km\n", - "pz= -38.2 # in dBm...\n", - "pz= 10**(pz/10)*1*10**-3 \n", - "alpha_1= 10/z *math.log10(p0/pz) # attenuation in 1st window\n", - "print \" Attenuation is 1st window in dB/Km =\",round(alpha_1,2) \n", - "alpha_2= 10/z *math.log10(p0/(47.5*10**-6)) # attenuation in 2nd window\n", - "print \" \\n\\nAttenuation is 2nd window in dB/Km =\",round(alpha_2,2) \n", - "alpha_3= 10/z *math.log10(p0/(75*10**-6)) # attenuation in 3rd window\n", - "print \" \\n\\nAttenuation is 3rd window in dB/Km =\",round(alpha_3,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Attenuation is 1st window in dB/Km = 3.0\n", - " \n", - "\n", - "Attenuation is 2nd window in dB/Km = 0.5\n", - " \n", - "\n", - "Attenuation is 3rd window in dB/Km = 0.3\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "\n", - "Ex2.2.6:Pg-2.8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "p0=3*10**-3 \n", - "pz=3*10**-6 \n", - "alpha= 0.5 \n", - "z= math.log10(p0/pz)/(alpha/10) \n", - "print \" The Length of the fibre in Km =\",int(z)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Length of the fibre in Km = 60\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2.7:Pg-2.9" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "z= 10.0 \n", - "p0= 100*10**-6 # input power\n", - "pz=5*10**-6 # output power\n", - "alpha = 10*math.log10(p0/pz) # total attenuation\n", - "print \" The overall signal attenuation in dB = \",round(alpha,2) \n", - "alpha = alpha/z # attenuation per km\n", - "print \" \\n\\nThe attenuation per Km in dB/Km = \",round(alpha,2)\n", - "z_new = 12.0 \n", - "splice_attenuation = 11*0.5 \n", - "cable_attenuation = alpha*z_new \n", - "total_attenuation = splice_attenuation+cable_attenuation \n", - "print \" \\n\\nThe overall signal attenuation for 12Kms in dB = \",round(total_attenuation,1) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The overall signal attenuation in dB = 13.01\n", - " \n", - "\n", - "The attenuation per Km in dB/Km = 1.3\n", - " \n", - "\n", - "The overall signal attenuation for 12Kms in dB = 21.1\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.2.8:Pg-2.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Tf = 1400.0 # fictive temperature\n", - "BETA = 7*10**-11 \n", - "n= 1.46 # RI \n", - "p= 0.286 # photo elastic constant\n", - "Kb = 1.381*10**-23 # Boltzmann's constant\n", - "lamda = 850*10**-9 # wavelength\n", - "alpha_scat = 8*math.pi**3*n**8*p**2*Kb*Tf*BETA/(3*lamda**4) \n", - "l= 1000 # fibre length\n", - "TL = exp(-alpha_scat*l) # transmission loss\n", - "attenuation = 10*math.log10(1/TL) \n", - "print \" The attenuation in dB/Km =\",round(attenuation,3)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The attenuation in dB/Km = 1.572\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.3.1:Pg-2.20" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "alpha = 2 \n", - "n1= 1.5 \n", - "a= 25*10**-6 \n", - "lamda= 1.3*10**-6 \n", - "M= 0.5 \n", - "NA= math.sqrt(0.5*2*1.3**2/(math.pi**2*25**2)) \n", - "Rc= 3*n1**2*lamda/(4*math.pi*NA**3) \n", - "Rc=Rc*1000 # converting into um.....\n", - "print \" The radius of curvature in um =\",round(Rc,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The radius of curvature in um = 153.98\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.5.1:Pg-2.25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "lamda = 850 *10**-9 \n", - "sigma= 45*10**-9 \n", - "L= 1 \n", - "M= 0.025/(3*10**5*lamda) \n", - "sigma_m= sigma*L*M \n", - "sigma_m= sigma_m*10**9 # formatting in ns/km....\n", - "print \" The Pulse spreading in ns/Km =\",round(sigma_m,2) \n", - "print \" \\n\\nNOTE*** - The answer in text book is wrongly calculated..\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Pulse spreading in ns/Km = 4.41\n", - " \n", - "\n", - "NOTE*** - The answer in text book is wrongly calculated..\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.5.2:Pg-2.26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "lamda= 2*10**-9 \n", - "sigma = 75 \n", - "D_mat= 0.03/(3*10**5*2) \n", - "sigma_m= 2*1*D_mat \n", - "sigma_m=sigma_m*10**9 # Fornamtting in ns/Km\n", - "print \" The Pulse spreading in ns/Km =\",int(sigma_m)\n", - "D_mat_led= 0.025/(3*10**5*1550) \n", - "sigma_m_led = 75*1*D_mat_led*10**9 # in ns/Km\n", - "print \" \\n\\nThe Pulse spreading foe LED is ns/Km =\",round(sigma_m_led,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Pulse spreading in ns/Km = 100\n", - " \n", - "\n", - "The Pulse spreading foe LED is ns/Km = 4.03\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.5.3:Pg-2.26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "lamda = 850 \n", - "sigma= 20 \n", - "D_mat = 0.055/(3*10**5*lamda) \n", - "sigma_m= sigma*1*D_mat \n", - "D_mat=D_mat*10**12 # in Ps...\n", - "sigma_m=sigma_m*10**9 # in ns # # \n", - "print \" The material Dispersion in Ps/nm-Km =\",round(D_mat,2) \n", - "print \" \\n\\nThe Pulse spreading in ns/Km =\",round(sigma_m,4) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The material Dispersion in Ps/nm-Km = 215.69\n", - " \n", - "\n", - "The Pulse spreading in ns/Km = 4.3137\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.5.4:Pg-2.30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "n2= 1.48 \n", - "dele = 0.2 \n", - "lamda = 1320 \n", - "Dw = -n2*dele*0.26/(3*10**5*lamda) \n", - "Dw=Dw*10**10 # converting in math.picosecs....\n", - "print \" The waveguide dispersion in math.picosec/nm.Km =\",round(Dw,3) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The waveguide dispersion in math.picosec/nm.Km = -1.943\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6.1:Pg-2.34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "t= 0.1*10**-6 \n", - "L= 12 \n", - "B_opt= 1/(2*t) \n", - "B_opt=B_opt/1000000 # converting from Hz to MHz\n", - "print \" The maximum optical bandwidth in MHz. =\",int(B_opt) \n", - "dele= t/L # Pulse broadening\n", - "dele=dele*10**9 # converting in ns...\n", - "print \" \\n\\nThe pulse broadening per unit length in ns/Km =\",round(dele,2) \n", - "BLP= B_opt*L # BW length product\n", - "print \" \\n\\nThe Bandwidth-Length Product in MHz.Km =\",int(BLP) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The maximum optical bandwidth in MHz. = 5\n", - " \n", - "\n", - "The pulse broadening per unit length in ns/Km = 8.33\n", - " \n", - "\n", - "The Bandwidth-Length Product in MHz.Km = 60\n" - ] - } - ], - "prompt_number": 38 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6.2:Pg-2.34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "t= 0.1*10**-6 \n", - "L= 10.0 \n", - "B_opt= 1/(2*t) \n", - "B_opt=B_opt/1000000 # converting from Hz to MHz\n", - "print \" The maximum optical bandwidth in MHz. =\",int(B_opt) \n", - "dele= t/L \n", - "dele=dele/10**-6 # converting in us...\n", - "print \" \\n\\nThe dispersion per unit length in us/Km =\",round(dele,2) \n", - "BLP= B_opt*L \n", - "print \" \\n\\nThe Bandwidth-Length product in MHz.Km =\",int(BLP) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The maximum optical bandwidth in MHz. = 5\n", - " \n", - "\n", - "The dispersion per unit length in us/Km = 0.01\n", - " \n", - "\n", - "The Bandwidth-Length product in MHz.Km = 50\n" - ] - } - ], - "prompt_number": 40 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6.3:Pg-2.35" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "t= 0.1*10**-6 \n", - "L=15 \n", - "B_opt= 1/(2*t) \n", - "B_opt=B_opt/1000000 # converting from Hz to MHz\n", - "print \" The maximum optical bandwidth in MHz. =\",int(B_opt) \n", - "dele= t/L*10**9 # in ns...\n", - "print \" \\n\\nThe dispersion per unit length in ns/Km =\",round(dele,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The maximum optical bandwidth in MHz. = 5\n", - " \n", - "\n", - "The dispersion per unit length in ns/Km = 6.67\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6.4:Pg-2.35" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "lamda = 0.85*10**-6 \n", - "rms_spect_width = 0.0012*lamda \n", - "sigma_m= rms_spect_width*1*98.1*10**-3 \n", - "sigma_m=sigma_m*10**9 # converting in ns...\n", - "print \" The Pulse Broadening due to material dispersion in ns/Km =\",round(sigma_m,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Pulse Broadening due to material dispersion in ns/Km = 0.1\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6.5:Pg-2.35" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "L= 5.0 # in KM\n", - "n1= 1.5 \n", - "dele= 0.01 \n", - "c= 3*10**8 # in m/s\n", - "delta_t = (L*n1*dele)/c \n", - "delta_t=delta_t*10**12 # convertin to nano secs...\n", - "print \" The delay difference in ns =\",round(delta_t,1)\n", - "sigma= L*n1*dele/(2*math.sqrt(3)*c) \n", - "sigma=sigma*10**12 # convertin to nano secs...\n", - "print \" \\n\\nThe r.m.s pulse broadening in ns =\",round(sigma,2) \n", - "B= 0.2/sigma*1000 # in Mz\n", - "print \" \\n\\nThe maximum bit rate in MBits/sec =\",round(B,2) \n", - "BLP = B*5 \n", - "print \" \\n\\nThe Bandwidth-Length in MHz.Km =\",round(BLP,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The delay difference in ns = 250.0\n", - " \n", - "\n", - "The r.m.s pulse broadening in ns = 72.17\n", - " \n", - "\n", - "The maximum bit rate in MBits/sec = 2.77\n", - " \n", - "\n", - "The Bandwidth-Length in MHz.Km = 13.86\n" - ] - } - ], - "prompt_number": 47 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.6.6:Pg-2.36" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "del_t_inter = 5*1 \n", - "del_t_intra = 50*80*1 \n", - "total_dispersion = math.sqrt(5**2 + 0.4**2) \n", - "print \" Total dispersion in ns =\",round(total_dispersion,3) " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Total dispersion in ns = 5.016\n" - ] - } - ], - "prompt_number": 49 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.7.1:Pg-2.37" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "t= 0.1*10**-6 \n", - "L=15 \n", - "dele= t/L*10**9 # convertin to nano secs...\n", - "print \" The Pulse Dispersion in ns =\",round(dele,2) \n", - "B_opt= 1/(2*t)/10**6 # convertin to nano secs...\n", - "print \" \\n\\n The maximum possible Bandwidth in MHz =\",int(B_opt) \n", - "BLP = B_opt*L \n", - "print \" \\n\\nThe BandwidthLength product in MHz.Km =\",int(BLP) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Pulse Dispersion in ns = 6.67\n", - " \n", - "\n", - " The maximum possible Bandwidth in MHz = 5\n", - " \n", - "\n", - "The BandwidthLength product in MHz.Km = 75\n" - ] - } - ], - "prompt_number": 51 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.7.2:Pg-2.38" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "L= 6 \n", - "n1= 1.5 \n", - "delt= 0.01 \n", - "delta_t = L*n1*delt/(3*10**8)*10**12 # convertin to nano secs...\n", - "print \" The delay difference in ns =\",int(delta_t) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The delay difference in ns = 300\n" - ] - } - ], - "prompt_number": 52 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.7.3:Pg-2.39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Lb= 0.09 \n", - "lamda= 1.55*10**-6 \n", - "delta_lamda = 1*10**-9 \n", - "Bf= lamda/Lb \n", - "Lbc= lamda**2/(Bf*delta_lamda) \n", - "print \" The modal Bifriengence in meters =\",round(Lbc,2) \n", - "beta_xy= 2*math.pi/Lb \n", - "print \" \\n\\nThe difference between propogation constants =\",round(beta_xy,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The modal Bifriengence in meters = 139.5\n", - " \n", - "\n", - "The difference between propogation constants = 69.81\n" - ] - } - ], - "prompt_number": 53 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.7.4:Pg-2.39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "t= 0.1*10**-6 \n", - "B_opt= 1/(2*t)/1000000 \n", - "print \" The maximum possible Bandwidth in MHz =\",int(B_opt) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The maximum possible Bandwidth in MHz = 5\n" - ] - } - ], - "prompt_number": 54 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2.7.5:Pg-2.40" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "t= 0.1*10**-6 \n", - "B_opt= 1/(2*t)/1000000 \n", - "print \" The maximum possible Bandwidth in MHz =\",int(B_opt) \n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The maximum possible Bandwidth in MHz = 5\n" - ] - } - ], - "prompt_number": 55 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter3.ipynb b/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter3.ipynb deleted file mode 100755 index 1e7a6431..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter3.ipynb +++ /dev/null @@ -1,826 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:1c5868fa547e8a659e03148d4a7bf0c9a34282713a490e0b68c5b0aa98a2f7e8" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter03:Optical Sources and Transmitters" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.1:Pg-3.10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "x= 0.07 \n", - "Eg= 1.424+1.266*x+0.266*x**2 \n", - "lamda= 1.24/Eg \n", - "print \" The emitted wavelength in um =\",round(lamda,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The emitted wavelength in um = 0.82\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.2:Pg-3.10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "x= 0.26 \n", - "y=0.57 \n", - "Eg= 1.35-0.72*y+0.12*y**2 \n", - "lamda = 1.24/Eg \n", - "print \" The wavelength emitted in um =\",round(lamda,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The wavelength emitted in um = 1.27\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.3:Pg-3.12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "Tr = 60*10**-9 # radiative recombination time\n", - "Tnr= 90*10**-9 # non radiative recomb time\n", - "I= 40*10**-3 # current\n", - "t = Tr*Tnr/(Tr+Tnr) # total recomb time\n", - "t=t*10**9 # Converting in nano secs...\n", - "print \" The total carrier recombination life time in ns =\",int(t) \n", - "t=t/10**9 \n", - "h= 6.625*10**-34 # plancks const\n", - "c= 3*10**8 \n", - "q=1.602*10**-19 \n", - "lamda= 0.87*10**-6 \n", - "Pint=(t/Tr)*((h*c*I)/(q*lamda)) \n", - "Pint=Pint*1000 # converting inmW...\n", - "print \" \\n\\nThe Internal optical power in mW =\",round(Pint,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The total carrier recombination life time in ns = 36\n", - " \n", - "\n", - "The Internal optical power in mW = 34.22\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.4:Pg-3.13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "lamda = 1310*10**-9 \n", - "Tr= 30*10**-9 \n", - "Tnr= 100*10**-9 \n", - "I= 40*10**-3 \n", - "t= Tr*Tnr/(Tr+Tnr) \n", - "t=t*10**9 # converting in nano secs...\n", - "print \" Bulk recombination life time in ns =\",round(t,2) \n", - "t=t/10**9 \n", - "n= t/Tr \n", - "print \" \\n\\nInternal quantum efficiency =\",round(n,3) \n", - "h= 6.625*10**-34 # plancks const\n", - "c= 3*10**8 \n", - "q=1.602*10**-19 \n", - "Pint=(0.769*h*c*I)/(q*lamda)*1000 \n", - "print \" \\n\\nThe internal power level in mW =\",round(Pint,3) \n", - "print \" \\n\\n***NOTE: Internal Power wrong in text book.. Calculation Error..\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Bulk recombination life time in ns = 23.08\n", - " \n", - "\n", - "Internal quantum efficiency = 0.769\n", - " \n", - "\n", - "The internal power level in mW = 29.131\n", - " \n", - "\n", - "***NOTE: Internal Power wrong in text book.. Calculation Error..\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.5:Pg-3.14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "nx= 3.6 \n", - "TF= 0.68 \n", - "n= 0.3 \n", - " # Pe=Pint*TF*1/(4*nx**2) \n", - " # ne= Pe/Px*100 ..eq0\n", - " # Pe = 0.013*Pint # Eq 1\n", - " # Pint = n*P # Eq 2\n", - " # substitute eq2 and eq1 in eq0\n", - "ne = 0.013*0.3*100 \n", - "print \" The external Power efficiency in % =\",round(ne,3) \n", - " # Wrongly printed in textbook. it should be P instead of Pint in last step\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The external Power efficiency in % = 0.39\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.6:Pg-3.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "lamda= 0.85*10**-6 \n", - "Nint = 0.60 \n", - "I= 20*10**-3 \n", - "h= 6.625*10**-34 # plancks const\n", - "c= 3*10**8 \n", - "e=1.602*10**-19 \n", - "Pint = Nint*h*c*I/(e*lamda) \n", - "print \" The optical power emitted in W =\",round(Pint,4) \n", - "\n", - "TF= 0.68 \n", - "nx= 3.6 \n", - "Pe= Pint*TF/(4*nx**2)*1000000 \n", - "print \" \\n\\nPower emitted in the air in uW =\",round(Pe,1) \n", - "Pe=Pe/1000000 \n", - "Nep=Pe/Pint*100 \n", - "print \" \\n\\nExternal power efficiency in % =\",round(Nep,1) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The optical power emitted in W = 0.0175\n", - " \n", - "\n", - "Power emitted in the air in uW = 229.7\n", - " \n", - "\n", - "External power efficiency in % = 1.3\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.7:Pg-3.16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "lamda = 0.87*10**-6 \n", - "Tr= 50*10**-9 \n", - "I= 0.04 \n", - "Tnr= 110*10**-9 \n", - "t= Tr*Tnr/(Tr+Tnr) \n", - "t=t*10**9 # converting in ns...\n", - "print \" Total carrier recombination life time in ns =\",round(t,2) \n", - "t=t/10**9 \n", - "h= 6.625*10**-34 # plancks const\n", - "c= 3*10**8 \n", - "q=1.602*10**-19 \n", - "n= t/Tr \n", - "print \" \\n\\nThe efficiency in % \",round(n,3) \n", - "Pint=(n*h*c*I)/(q*lamda)*1000 \n", - "print \" \\n\\nInternal power generated in mW =\",round(Pint,2) \n", - "print \" \\n\\n***NOTE- Internal Power wrong in book... \"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Total carrier recombination life time in ns = 34.38\n", - " \n", - "\n", - "The efficiency in % 0.688\n", - " \n", - "\n", - "Internal power generated in mW = 39.22\n", - " \n", - "\n", - "***NOTE- Internal Power wrong in book... \n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.2.8:Pg-3.16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - " \n", - "\n", - "V= 2 \n", - "I= 100*10**-3 \n", - "Pc= 2*10**-3 \n", - "P= V*I \n", - "Npc= Pc/P*100 \n", - "print \" The overall power conversion efficiency in % =\",int(Npc) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The overall power conversion efficiency in % = 1\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.3.1:Pg-3.25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "r1= 0.32 \n", - "r2= 0.32 \n", - "alpha= 10 \n", - "L= 500*10**-4 \n", - "temp=math.log(1/(r1*r2)) \n", - "Tgth = alpha + (temp/(2*L)) \n", - "print \" The optical gain at threshold in /cm =\",round(Tgth,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The optical gain at threshold in /cm = 32.79\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.3.2:Pg-3.27" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - " \n", - "n= 3.7 \n", - "lamda = 950*10**-9 \n", - "L= 500*10**-6 \n", - "c= 3*10**8 \n", - "DELv = c/(2*L*n)*10*10**-10 # converting in GHz...\n", - "print \" The frequency spacing in GHz =\",int(DELv) \n", - "DEL_lamda= lamda**2/(2*L*n)*10**9 # converting to nm..\n", - "print \" \\n\\nThe wavelength spacing in nm =\",round(DEL_lamda,2) \n", - "\n", - "print \" \\n\\n***NOTE- The value of wavelength taken wrongly in book\" \n", - " # value of lamda taken wrongly while soving for DEL_LAMDA inthe book..\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The frequency spacing in GHz = 81\n", - " \n", - "\n", - "The wavelength spacing in nm = 0.24\n", - " \n", - "\n", - "***NOTE- The value of wavelength taken wrongly in book\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.3.3:Pg-3.30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " #Given\n", - " \n", - "L= 0.04 \n", - "n= 1.78 \n", - "lamda= 0.55*10**-6 \n", - "c= 3*10**8 \n", - "q= 2*n*L/lamda \n", - "q=q/10**5 \n", - "print \" Number of longitudinal modes =\",round(q,2),\"x 10^5\" \n", - "del_f= c/(2*n*L) \n", - "del_f=del_f*10**-9 \n", - "print \" \\n\\nThe frequency seperation in GHz =\",round(del_f,1) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Number of longitudinal modes = 2.59 x 10^5\n", - " \n", - "\n", - "The frequency seperation in GHz = 2.1\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.3.4:Pg-3.33" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "Nt= 0.18 \n", - "V= 2.5 \n", - "Eg= 1.43 \n", - "Nep= Nt*Eg*100/V \n", - "print \" The total efficiency in % =\",round(Nep,3) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The total efficiency in % = 10.296\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.3.5:Pg-3.33" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "n= 3.6 \n", - "BETA= 21*10**-3 \n", - "alpha= 10 \n", - "L= 250*10**-4 \n", - "\n", - "r= (n-1)**2/(n+1)**2 \n", - "Jth= 1/BETA *( alpha + (math.log(1/r)/L)) \n", - "Jth=Jth/1000 # converting for displaying...\n", - "print \" The threshold current density =\",round(Jth,3),\"x 10**3\" \n", - "Jth=Jth*1000 \n", - "Ith =Jth*250*100*10**-8 \n", - "Ith=Ith*1000 # converting into mA...\n", - "print \" \\n\\nThe threshold current in mA =\",round(Ith,1) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The threshold current density = 2.65 x 10**3\n", - " \n", - "\n", - "The threshold current in mA = 662.4\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.3.6:Pg-3.34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "T= 305.0 \n", - "T0 = 160.0 \n", - "T1= 373.0\n", - "\n", - "Jth_32 = exp(T/T0) \n", - "Jth_100 = exp(T1/T0) \n", - "R_j = Jth_100/Jth_32 \n", - "print \" Ratio of current densities at 160K is =\",round(R_j,2) \n", - "print \" \\n\\n***NOTE- Wrong in book...\\nJth(100) calculated wrongly...\" \n", - "To = 55 \n", - "Jth_32_new = exp(T/To) \n", - "Jth_100_new = exp(T1/To) \n", - "R_j_new = Jth_100_new/Jth_32_new \n", - "print \" \\n\\nRatio of current densities at 55K is \",round(R_j_new,2) \n", - " # wrong in book...\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Ratio of current densities at 160K is = 1.53\n", - " \n", - "\n", - "***NOTE- Wrong in book...\n", - "Jth(100) calculated wrongly...\n", - " \n", - "\n", - "Ratio of current densities at 55K is 3.44\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.4.1:Pg-3.42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "Bo= 150 \n", - "rs= 35*10**-4 \n", - "a1= 25*10**-6 \n", - "NA= 0.20 \n", - "a2= 50*10**-6 \n", - "\n", - "Pled = (a1/rs)**2 * (math.pi**2*rs**2*Bo*NA**2) \n", - "Pled=Pled*10**10 # converting in uW...\n", - "print \" The power coupled inthe fibre in uW =\",int(Pled) \n", - "Pled_new = (math.pi**2*rs**2*Bo*NA**2) \n", - "Pled_new=Pled_new*10**6 # converting in uW...\n", - "print \" \\n\\nThe Power coupled for case 2 in uW =\",round(Pled_new,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The power coupled inthe fibre in uW = 370\n", - " \n", - "\n", - "The Power coupled for case 2 in uW = 725.42\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.4.2:Pg-3.43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "n= 1.48 \n", - "n1= 3.6 \n", - "R= (n1-n)**2/(n1+n)**2 \n", - "print \" The Fresnel Reflection is \",round(R,4) \n", - "L= -10*math.log10(1-R) \n", - "print \" \\n\\nPower loss in dB =\",round(L,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Fresnel Reflection is 0.1742\n", - " \n", - "\n", - "Power loss in dB = 0.83\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.4.3:Pg-3.44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "NA= 0.20 \n", - "Bo= 150 \n", - "rs= 35*10**-6 \n", - "Pled = math.pi**2*rs**2*Bo*NA**2 \n", - "Pled=Pled*10**10 # convertin in uW for displaying...\n", - "print \" The optical power coupled in uW =\",round(Pled,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The optical power coupled in uW = 725.42\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.4.4:Pg-3.44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "n1= 1.5 \n", - "n=1 \n", - "R= (n1-n)**2/(n1+n)**2 \n", - "L= -10*math.log10(1-R) \n", - " # Total loss is twice due to reflection\n", - "L= L+L \n", - "print \" Total loss due to Fresnel Reflection in dB =\",round(L,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Total loss due to Fresnel Reflection in dB = 0.35\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3.4.5:Pg-3.51" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - " \n", - "n1= 1.5 \n", - "n=1.0 \n", - "y=5.0 \n", - "a= 25.0 \n", - "temp1=(1-(y/(2*a)**2))**0.5 \n", - "temp1=temp1*(y/a) \n", - "temp=2*math.acos(0.9996708) # it should be acos(0.1) actually... due to approximations\n", - " \n", - " # answer varies a lot... \n", - "temp=math.degrees(temp)-temp1 \n", - " # temp=temp \n", - "tem= 16*(1.5**2)/(2.5**4) \n", - "tem=tem/math.pi \n", - "temp=temp*tem \n", - "Nlat= temp \n", - "print \" The Coupling efficiency is =\",round(Nlat,3) \n", - "L= -10*math.log10(Nlat) \n", - "print \" \\n\\nThe insertion loss in dB =\",round(L,2) \n", - "temp1=(1-(y/(2*a)**2))**0.5 \n", - "temp1=temp1*(y/a) \n", - "temp=2*math.acos(0.9996708) # it should be acos(0.1) actually... due to approximations\n", - " # answer varies a lot... \n", - "temp=math.degrees(temp)-temp1 \n", - "temp=temp/math.pi \n", - "N_new =temp \n", - "print \" \\n\\nEfficiency when joint index is matched =\",round(N_new,3) \n", - "L_new= -10*math.log10(N_new) \n", - "print \" \\n\\nThe new insertion loss in dB =\",round(L_new,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Coupling efficiency is = 0.804\n", - " \n", - "\n", - "The insertion loss in dB = 0.95\n", - " \n", - "\n", - "Efficiency when joint index is matched = 0.872\n", - " \n", - "\n", - "The new insertion loss in dB = 0.59\n" - ] - } - ], - "prompt_number": 39 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter4.ipynb b/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter4.ipynb deleted file mode 100755 index 9dca6b9e..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter4.ipynb +++ /dev/null @@ -1,644 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e29ad753b5f2886d343bb74ecb0ecc91fcb2a9898826cbfcabd7e953e57d2f63" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter04: Optical Detectors and Receivers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.1:Pg-4.5" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "Eg= 1.1 \n", - "lamda_c = 1.24/Eg \n", - "print \"The cut off wavelength in um= \",round(lamda_c,2) \n", - "\n", - "Eg_ger =0.67 \n", - "lamda_ger= 1.24/Eg_ger \n", - "print \" \\nThe cut off wavelength for Germanium in um= \",round(lamda_ger,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The cut off wavelength in um= 1.13\n", - " \n", - "The cut off wavelength for Germanium in um= 1.85\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.2:Pg-4.5" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given \n", - "Eg = 1.43 \n", - "lamda = 1.24/Eg \n", - "lamda=lamda*1000 # converting in nm\n", - "print \"The cut off wavelength in nm =\",round(lamda,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The cut off wavelength in nm = 867.13\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.3:Pg-4.5" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "P = 6*10**6 \n", - "Eh_pair= 5.4*10**6 \n", - "n= Eh_pair/P*100 \n", - "print \" The quantum efficiency in % = \",n \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The quantum efficiency in % = 90.0\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.4:Pg-4.6" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "R= 0.65 \n", - "P0= 10*10**-6 \n", - "Ip= R*P0 \n", - "Ip=Ip*10**6 # convertinf in uA...\n", - "print \" The generated photocurrent in uA = \",Ip \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The generated photocurrent in uA = 6.5\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.5:Pg-4.6" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "Ec= 1.2*10**11 \n", - "P= 3*10**11 \n", - "lamda = 0.85*10**-6 \n", - "n= Ec/P*100 \n", - "print \"The efficiency in % =\",n \n", - "\n", - "q= 1.602*10**-19 \n", - "h= 6.625*10**-34 \n", - "c= 3*10**8 \n", - "n= n/100 \n", - "R= n*q*lamda/(h*c) \n", - "print \" \\n\\nThe Responsivity of the photodiode in A/W=\",round(R ,4)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The efficiency in % = 40.0\n", - " \n", - "\n", - "The Responsivity of the photodiode in A/W= 0.2741\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.6:Pg-4.7" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "n= 0.65 \n", - "E= 1.5*10**-19 \n", - "Ip= 2.5*10**-6 \n", - "h= 6.625*10**-34 \n", - "c= 3*10**8 \n", - "lamda= h*c/E \n", - "lamda=lamda*10**6 # converting in um for displaying...\n", - "print \"The wavelength in um =\",lamda \n", - "lamda=lamda*10**-6 \n", - "q= 1.602*10**-19 \n", - "R= n*q*lamda/(h*c) \n", - "print \"\\nThe Responsivity in A/W =\",R \n", - "Pin= Ip/R \n", - "Pin=Pin*10**6 # converting in uW for displaying/..\n", - "print \" \\nThe incidnt power in uW= \",round(Pin,1) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The wavelength in um = 1.325\n", - "\n", - "The Responsivity in A/W = 0.6942\n", - " \n", - "The incidnt power in uW= 3.6\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.7:Pg-4.8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "Iin= 1 \n", - "lamda= 1550*10**-9 \n", - "q= 1.602*10**-19 \n", - "h= 6.625*10**-34 \n", - "c= 3*10**8 \n", - "n=0.65 \n", - "Ip=n*q*lamda*Iin/(h*c) \n", - "Ip=Ip*1000 # converting in mA for displaying...\n", - "print \" The average photon current in mA= \",int(Ip)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The average photon current in mA= 812\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.1.8:Pg-4.9" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "n= 0.70 \n", - "Ip= 4*10**-6 \n", - "e= 1.602*10**-19 \n", - "h= 6.625*10**-34 \n", - "c= 3*10**8 \n", - "E= 1.5*10**-19\n", - "lamda = h*c/E \n", - "lamda=lamda*10**6 # converting um for displaying...\n", - "print \"The wavelength in um =\",round(lamda,3) \n", - "R= n*e/E \n", - "Po= Ip/R \n", - "Po=Po*10**6 # converting um for displaying...\n", - "print \" \\nIncident optical Power in uW =\",round(Po,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The wavelength in um = 1.325\n", - " \n", - "Incident optical Power in uW = 5.35\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.2.1:Pg-4.14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Ct= 7*10.0**-12\n", - "Rt= 50*1*10.0**6/(50+(1*10**6))\n", - "B= 1/(2*math.pi*Rt*Ct)\n", - "B=B*10**-6 #converting in mHz for displaying...\n", - "print \"The bandwidth of photodetector in MHz =\",round(B,2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The bandwidth of photodetector in MHz = 454.75\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.2.2:Pg-4.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "W= 25*10**-6 \n", - "Vd= 3*10**4 \n", - "Bm= Vd/(2*math.pi*W) \n", - "RT= 1/Bm \n", - "RT=RT*10**9 # converting ns for displaying...\n", - "print \" The maximum response time in ns =\",round(RT,2) " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The maximum response time in ns = 5.24\n" - ] - } - ], - "prompt_number": 45 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "\n", - "Ex4.2.3:Pg-4.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "e= 1.602*10**-19 \n", - "h= 6.625*10**-34 \n", - "v= 3*10**8 \n", - "n=0.65 \n", - "I= 10*10**-6 \n", - "lamda= 900*10**-9 \n", - "R= n*e*lamda/(h*v) \n", - "Po= 0.5*10**-6 \n", - "Ip= Po*R \n", - "M= I/Ip \n", - "print \" The multiplication factor =\",round(M,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The multiplication factor = 42.41\n" - ] - } - ], - "prompt_number": 48 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.3.1:Pg-4.18" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "n=0.65 \n", - "lamda = 900*10**-9 \n", - "Pin= 0.5*10**-6 \n", - "Im= 10*10**-6 \n", - "q= 1.602*10**-19 \n", - "h= 6.625*10**-34 \n", - "c= 3*10**8 \n", - "R= n*q*lamda/(h*c) \n", - "Ip= R*Pin \n", - "M= Im/Ip \n", - "print \" The multiplication factor =\",round(M,2)\n", - "print \"\\n***NOTE-Answer wrong in textbook...\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The multiplication factor = 42.41\n", - "\n", - "***NOTE-Answer wrong in textbook...\n" - ] - } - ], - "prompt_number": 51 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.6.1:Pg-4.34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "lamda = 1300*10**-9 \n", - "Id= 4*10**-9 \n", - "n=0.9 \n", - "Rl= 1000 \n", - "Pincident= 300*10**-9 \n", - "BW= 20*10**6 \n", - "q= 1.602*10**-19 \n", - "h= 6.625*10**-34 \n", - "v= 3*10**8 \n", - "Iq= math.sqrt((q*Pincident*n*lamda)/(h*v)) \n", - "Iq= math.sqrt(Iq) \n", - "Iq=Iq*100 # converting in proper format for displaying...\n", - "print \"Mean square quantum noise current in Amp*10^11 =\",round(Iq,2)\n", - "I_dark= 2*q*BW*Id \n", - "I_dark=I_dark*10**19 # converting in proper format for displaying...\n", - "print \" \\nMean square dark current in Amp*10^-19 =\",round(I_dark,3) \n", - "k= 1.38*10**-23 \n", - "T= 25+273 \n", - "It= 4*k*T*BW/Rl \n", - "It=It*10**16 # converting in proper format for displaying...\n", - "print \" \\nMean square thermal nise current in Amp*10^-16 =\",round(It,2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mean square quantum noise current in Amp*10^11 = 2.31\n", - " \n", - "Mean square dark current in Amp*10^-19 = 0.256\n", - " \n", - "Mean square thermal nise current in Amp*10^-16 = 3.29\n" - ] - } - ], - "prompt_number": 61 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.8.1:Pg-4.39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "lamda = 850*10**-9 # meters\n", - "BER= 1*10**-9 \n", - "N_bar = 9*log(10) \n", - "h= 6.625*10**-34 # joules-sec\n", - "v= 3*10**8 # meters/sec\n", - "n= 0.65 # assumption\n", - "E=N_bar*h*v/(n*lamda) \n", - "E=E*10**18 # /converting in proper format for displaying...\n", - "print \" The Energy received in Joules*10^-18 =\",round(E,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The Energy received in Joules*10^-18 = 7.45\n" - ] - } - ], - "prompt_number": 64 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.8.2:Pg-4.39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "lamda = 850*10**-9 \n", - "BER = 1*10**-9 \n", - "BT=10*10**6 \n", - "h= 6.625*10**-34 \n", - "c= 3*10**8 \n", - "Ps= 36*h*c*BT/lamda \n", - "Ps=Ps*10**12 # /converting in proper format for displaying...\n", - "print \"The minimum incidental optical power required id in pW =\",round(Ps,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The minimum incidental optical power required id in pW = 84.18\n" - ] - } - ], - "prompt_number": 67 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4.8.3:Pg-4.40" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "C= 5*10**-12 \n", - "B =50*10**6 \n", - "Ip= 1*10**-7 \n", - "e= 1.602*10**-19 \n", - "k= 1.38*10**-23 \n", - "T= 18+273 \n", - "M= 1 \n", - "Rl= 1/(2*math.pi*C*B) \n", - "S_N= Ip**2/((2*e*B*Ip)+(4*k*T*B/Rl)) \n", - "S_N = 10*math.log10(S_N) # in db\n", - "print \" The S/N ratio in dB =\",round(S_N,2) \n", - "M=41.54 \n", - "S_N_new= (M**2*Ip**2)/((2*e*B*Ip*M**2.3)+(4*k*T*B/Rl)) \n", - "S_N_new = 10*math.log10(S_N_new) # in db\n", - "print \" \\n\\nThe new S/N ratio in dB =\",round(S_N_new,2)\n", - "print \" \\n\\nImprovement over M=1 in dB =\",round(S_N_new-S_N,1) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The S/N ratio in dB = 8.99\n", - " \n", - "\n", - "The new S/N ratio in dB = 32.49\n", - " \n", - "\n", - "Improvement over M=1 in dB = 23.5\n" - ] - } - ], - "prompt_number": 70 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter5.ipynb b/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter5.ipynb deleted file mode 100755 index 3915a0b4..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter5.ipynb +++ /dev/null @@ -1,458 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:b4a79f107959b9c220fb0fbffb78f81a806979a06263be16ca010cadce8d4a27" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter05: Design Considerations in Optical Links" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.3.1:Pg-5.7" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "B= 15*10**-6 \n", - "L= 4 \n", - "BER= 1*10**-9 \n", - "Ls= 0.5 \n", - "Lc= 1.5 \n", - "alpha= 6 \n", - "Pm= 8 \n", - "Pt= 2*Lc +(alpha*L)+(Pm) \n", - "print \" The actual loss in fibre in dB =\",int(Pt) \n", - "Pmax = -10-(-50) \n", - "print \" \\nThe maximum allowable system loss in dBm = \",Pmax " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The actual loss in fibre in dB = 35\n", - " \n", - "The maximum allowable system loss in dBm = 40\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.3.2:Pg-5.8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Ps= 0.1 \n", - "alpha = 6 \n", - "L= 0.5 \n", - "Ps = 10*math.log10(Ps) \n", - "NA= 0.25 \n", - "Lcoupling= -10*math.log10(NA**2) \n", - "Lf= alpha*L \n", - "lc= 2*2 \n", - "Pm= 4 \n", - "Pout = Ps-(Lcoupling+Lf+lc+Pm) \n", - "print \" The actual power output in dBm = \",int(Pout) \n", - "Pmin = -35 \n", - "print \" Minimum input power required in dBm= \",Pmin \n", - "print \" As Pmin > Pout, system will perform adequately over the system operating life.\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The actual power output in dBm = -33\n", - " Minimum input power required in dBm= -35\n", - " As Pmin > Pout, system will perform adequately over the system operating life.\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.3.3:Pg-5.8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "Ps= 5 \n", - "Lcoupling = 3 \n", - "Lc= 2 \n", - "L_splicing = 50*0.1 \n", - "F_atten = 25 \n", - "L_total = Lcoupling+Lc+L_splicing+F_atten \n", - "P_avail = Ps-L_total \n", - "sensitivity = -40 \n", - "loss_margin = -sensitivity-(-P_avail) \n", - "print \" The loss margin of the system in dBm= -\",loss_margin \n", - "sensitivity_fet = -32 \n", - "loss_margin_fet=-sensitivity_fet-(-P_avail) \n", - "print \"The loss marging for the FET receiver in dBm= -\",loss_margin_fet \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The loss margin of the system in dBm= - 10.0\n", - "The loss marging for the FET receiver in dBm= - 2.0\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.3.4:Pg-5.9" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "LED_output = 3 \n", - "PIN_sensitivity = -54 \n", - "allowed_loss= LED_output -(-PIN_sensitivity) \n", - "Lcoupling = 17.5 \n", - "cable_atten = 30 \n", - "power_margin_coupling= 39.5 \n", - "power_margin_splice=6.2 \n", - "power_margin_cable=9.5 \n", - "final_margin= power_margin_coupling+power_margin_splice+power_margin_cable \n", - "print \" The safety margin in dB =\",final_margin\n", - " # Answer in book is wrong...\n", - "print \" \\n***NOTE- Answer wrong in book...\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The safety margin in dB = 55.2\n", - " \n", - "***NOTE- Answer wrong in book...\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.3.5:Pg-5.10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "optical_power=-10 \n", - "receiver_sensitivity=-41 \n", - "total_margin= optical_power-receiver_sensitivity \n", - "cable_loss= 7*2.6 \n", - "splice_loss= 6*0.5 \n", - "connector_loss= 1*1.5 \n", - "safety_margin= 6 \n", - "total_loss= cable_loss+splice_loss+connector_loss+safety_margin \n", - "excess_power_margin= total_margin-total_loss \n", - "print \" The system is viable and provides excess power margin in dB=\",excess_power_margin \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The system is viable and provides excess power margin in dB= 2.3\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.4.1:Pg-5.13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Ttx= 15 \n", - "Tmat=21 \n", - "Tmod= 3.9 \n", - "BW= 25.0 \n", - "Trx= 350.0/BW \n", - "\n", - "Tsys = math.sqrt(Ttx**2+Tmat**2+Tmod**2+Trx**2) \n", - "print \" The system rise time in ns.= \",round(Tsys,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The system rise time in ns.= 29.62\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.4.2:Pg-5.14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "\n", - "Ttrans = 1.75*10**-9 \n", - "Tled = 3.50*10**-9 \n", - "Tcable=3.89*10**-9 \n", - "Tpin= 1*10**-9 \n", - "Trec= 1.94*10**-9 \n", - "Tsys= math.sqrt(Ttrans**2+Tled**2+Tcable**2+Tpin**2+Trec**2) \n", - "Tsys=Tsys*10**9 # converting in ns for dislaying...\n", - "print \" The system rise time in ns= \",round(Tsys,2)\n", - "Tsys=Tsys*10**-9 \n", - "BW= 0.35/Tsys \n", - "BW=BW/1000000.0 # converting in MHz for dislaying...\n", - "print \" \\nThe system bandwidth in MHz =\",round(BW,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The system rise time in ns= 5.93\n", - " \n", - "The system bandwidth in MHz = 58.99\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.4.3:Pg-5.14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Ttx= 8*10**-9 \n", - "Tintra= 1*10**-9 \n", - "Tmodal=5*10**-9 \n", - "Trr= 6*10**-9 \n", - "Tsys= math.sqrt(Ttx**2+(8*Tintra)**2+(8*Tmodal)**2+Trr**2) \n", - "\n", - "BWnrz= 0.7/Tsys \n", - "BWnrz=BWnrz/1000000 # converting in ns for dislaying...\n", - "BWrz=0.35/Tsys \n", - "BWrz=BWrz/1000000 # converting in ns for dislaying...\n", - "print \" Maximum bit rate for NRZ format in Mb/sec= \",round(BWnrz,2)\n", - "print \" \\nMaximum bit rate for RZ format in Mb/sec= \",round(BWrz,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Maximum bit rate for NRZ format in Mb/sec= 16.67\n", - " \n", - "Maximum bit rate for RZ format in Mb/sec= 8.33\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.4.4:Pg-5.15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "Ts= 10*10**-9 \n", - "Tn=9*10**-9 \n", - "Tc=2*10**-9 \n", - "Td=3*10**-9 \n", - "BW= 6*10**6 \n", - "Tsyst= 1.1*math.sqrt(Ts**2+(5*Tn)**2+(5*Tc)**2+Td**2) \n", - "Tsyst=Tsyst*10**9 # converting in ns for displying...\n", - "Tsyst_max = 0.35/BW \n", - "Tsyst_max=Tsyst_max*10**9 # converting in ns for displying...\n", - "print \" Rise system of the system in ns= \",round(Tsyst,2)\n", - "print \" \\nMaximum Rise system of the system in ns= \",round(Tsyst_max,2)\n", - "print \" \\nSpecified components give a system rise time which is adequate for the bandwidth and distance requirements of the optical fibre link.\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Rise system of the system in ns= 51.99\n", - " \n", - "Maximum Rise system of the system in ns= 58.33\n", - " \n", - "Specified components give a system rise time which is adequate for the bandwidth and distance requirements of the optical fibre link.\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5.5.1:Pg-5.18" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "\n", - "del_t_1 = 10*100*10**-9 \n", - "Bt_nrz_1 = 0.7/(del_t_1*1000000) \n", - "Bt_rz_1 = 0.35/(del_t_1*1000000) \n", - "print \"First case.\"\n", - "print \" \\nBit rate for nrz in Mb/sec= \",Bt_nrz_1 \n", - "print \" \\nBit rate for rz in Mb/sec= \",Bt_rz_1 \n", - "del_t_2 = 20*1000*10**-9 \n", - "Bt_nrz_2 = 0.7/(del_t_2*1000000) \n", - "Bt_rz_2 = 0.35/(del_t_2*1000000) \n", - "print \" \\n\\nSecond case\" \n", - "print \" \\nBit rate for nrz in Mb/sec= \",Bt_nrz_2 \n", - "print \" \\nBit rate for rz in Mb/sec= \",Bt_rz_2 \n", - "del_t_3 = 2*2000*10**-9 \n", - "Bt_nrz_3 = 0.7/(del_t_3*1000) \n", - "Bt_rz_3 = 0.35/(del_t_3*1000) \n", - "print \" \\n\\nThird case\" \n", - "print \" \\nBit rate for nrz in BITS/sec= \",int(Bt_nrz_3) \n", - "print \" \\nBit rate for rz in BITS/sec= \",Bt_rz_3 \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "First case.\n", - " \n", - "Bit rate for nrz in Mb/sec= 0.7\n", - " \n", - "Bit rate for rz in Mb/sec= 0.35\n", - " \n", - "\n", - "Second case\n", - " \n", - "Bit rate for nrz in Mb/sec= 0.035\n", - " \n", - "Bit rate for rz in Mb/sec= 0.0175\n", - " \n", - "\n", - "Third case\n", - " \n", - "Bit rate for nrz in BITS/sec= 174\n", - " \n", - "Bit rate for rz in BITS/sec= 87.5\n" - ] - } - ], - "prompt_number": 31 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter6-Advanced_Optical_Systems.ipynb b/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter6-Advanced_Optical_Systems.ipynb deleted file mode 100755 index b0cb88b7..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter6-Advanced_Optical_Systems.ipynb +++ /dev/null @@ -1,317 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:ac520a54154462ad172aef8bbb865642cb1f987c781ea69ea1084ba6e27e7f6b" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter06: Advanced Optical Systems" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.5.1:Pg-6.11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "lamda_p= 980*10**-9 \n", - "lamda_s=1550*10**-9 \n", - "P_in=30 # in mW....\n", - "G=100 \n", - "\n", - "Ps_max= ((lamda_p*P_in)/lamda_s)/(G-1) \n", - "print \" \\nMaximum input power in mW = \",round(Ps_max,5) \n", - " \n", - "Ps_out= Ps_max + (lamda_p*P_in/lamda_s) \n", - "Ps_out= 10*math.log10(Ps_out) \n", - "print \" \\n\\nOutput power in dBm = \",round(Ps_out,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - "Maximum input power in mW = 0.19159\n", - " \n", - "\n", - "Output power in dBm = 12.82\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.5.2:Pg-6.12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "Ps_out= 30.0 # in uW...\n", - "Ps_in=1.0 \n", - "Noise_power = 0.5 \n", - "\n", - "G= Ps_out/Ps_in \n", - "\n", - "G= 10*math.log10(G) \n", - "print \" \\nThe Gain EDFA in dB = \",round(G,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - "The Gain EDFA in dB = 14.77\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.10.1:Pg-6.22" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "P0=200.0 \n", - "P1=90.0 \n", - "P2=85.0 \n", - "P3=6.3 \n", - " # All powers in uW...\n", - "coupling_ratio= P2/(P1+P2)*100 \n", - "print \" \\n\\n Coupling Ratio in % = \",round(coupling_ratio,2) \n", - "excess_ratio= 10*math.log10(P0/(P1+P2))\n", - "print \" \\n\\n The Excess Ratio in % = \",round(excess_ratio,4) \n", - "insertion_loss=10*math.log10(P0/P1) \n", - "print \" \\n\\n The Insertion Loss (from Port 0 to Port 1) in dB= \",round(insertion_loss,2) \n", - "insertion_loss1=10*math.log10(P0/P2) \n", - "print \" \\n\\n The Insertion Loss (from Port 0 to Port 2) in dB= \",round(insertion_loss1,2) \n", - "cross_talk=10*math.log10(P3/P0) \n", - "print \" \\n\\n The Cross Talk in dB= \",int(cross_talk) \n", - "print \" \\n\\n***NOTE: Cross Talk calculated wrognly in book... Value of P3 wrognly taken\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - "\n", - " Coupling Ratio in % = 48.57\n", - " \n", - "\n", - " The Excess Ratio in % = 0.5799\n", - " \n", - "\n", - " The Insertion Loss (from Port 0 to Port 1) in dB= 3.47\n", - " \n", - "\n", - " The Insertion Loss (from Port 0 to Port 2) in dB= 3.72\n", - " \n", - "\n", - " The Cross Talk in dB= -15\n", - " \n", - "\n", - "***NOTE: Cross Talk calculated wrognly in book... Value of P3 wrognly taken\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.10.2:Pg-6.23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "P0= 300.0 \n", - "P1=150.0 \n", - "P2=65.0 \n", - "P3=8.3*10**-3 \n", - " # All powers in uW...\n", - "splitting_ratio= P2/(P1+P2)*100 \n", - "print \" \\n\\n Splitting Ratio in %= \",round(splitting_ratio,2) \n", - "excess_ratio= 10*math.log10(P0/(P1+P2))\n", - "print \" \\n\\n The Excess Ratio in dB= \",round(excess_ratio,4)\n", - "insertion_loss=10*math.log10(P0/P1) \n", - "print \" \\n\\n The Insertion Loss (from Port 0 to Port 1) in dB= \",round(insertion_loss,2) \n", - "cross_talk=10*math.log10(P3/P0) \n", - "print \" \\n\\n The Cross Talk in dB= \",round(cross_talk,2) \n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - "\n", - " Splitting Ratio in %= 30.23\n", - " \n", - "\n", - " The Excess Ratio in dB= 1.4468\n", - " \n", - "\n", - " The Insertion Loss (from Port 0 to Port 1) in dB= 3.01\n", - " \n", - "\n", - " The Cross Talk in dB= -45.58\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.10.3:Pg-6.25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "N=32.0 \n", - "Ft=(100-5)/100.0 \n", - "Total_loss= 10*(1-3.322*math.log10(Ft))*math.log10(N) \n", - "print \" The total loss in the coupler in dB = \",round(Total_loss,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The total loss in the coupler in dB = 16.17\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.10.4:Pg-6.28" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "N=10 \n", - "L=0.5 \n", - "alpha=0.4 \n", - "Lthru=0.9 \n", - "Lc=1 \n", - "Ltap=10 \n", - "Li=0.5 \n", - "Total_loss= N*(alpha*L +2*Lc +Lthru+Li)-(alpha*L)-(2*Lthru)+(2*Ltap) \n", - "print \" The total loss in the coupler in dB = \",int(Total_loss)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The total loss in the coupler in dB = 54\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.11.1:Pg-6.33" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "del_v=10*10**9 \n", - "N_eff= 1.5 \n", - "c=3*10**11 # speed of light in mm/sec\n", - "del_L= c/(2*N_eff*del_v) \n", - "print \" The wave guide length differenc in mm= \",int(del_L) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The wave guide length differenc in mm= 10\n" - ] - } - ], - "prompt_number": 33 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter6.ipynb b/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter6.ipynb deleted file mode 100755 index b0cb88b7..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/Chapter6.ipynb +++ /dev/null @@ -1,317 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:ac520a54154462ad172aef8bbb865642cb1f987c781ea69ea1084ba6e27e7f6b" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter06: Advanced Optical Systems" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.5.1:Pg-6.11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "lamda_p= 980*10**-9 \n", - "lamda_s=1550*10**-9 \n", - "P_in=30 # in mW....\n", - "G=100 \n", - "\n", - "Ps_max= ((lamda_p*P_in)/lamda_s)/(G-1) \n", - "print \" \\nMaximum input power in mW = \",round(Ps_max,5) \n", - " \n", - "Ps_out= Ps_max + (lamda_p*P_in/lamda_s) \n", - "Ps_out= 10*math.log10(Ps_out) \n", - "print \" \\n\\nOutput power in dBm = \",round(Ps_out,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - "Maximum input power in mW = 0.19159\n", - " \n", - "\n", - "Output power in dBm = 12.82\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.5.2:Pg-6.12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Given\n", - "import math\n", - "Ps_out= 30.0 # in uW...\n", - "Ps_in=1.0 \n", - "Noise_power = 0.5 \n", - "\n", - "G= Ps_out/Ps_in \n", - "\n", - "G= 10*math.log10(G) \n", - "print \" \\nThe Gain EDFA in dB = \",round(G,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - "The Gain EDFA in dB = 14.77\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.10.1:Pg-6.22" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "P0=200.0 \n", - "P1=90.0 \n", - "P2=85.0 \n", - "P3=6.3 \n", - " # All powers in uW...\n", - "coupling_ratio= P2/(P1+P2)*100 \n", - "print \" \\n\\n Coupling Ratio in % = \",round(coupling_ratio,2) \n", - "excess_ratio= 10*math.log10(P0/(P1+P2))\n", - "print \" \\n\\n The Excess Ratio in % = \",round(excess_ratio,4) \n", - "insertion_loss=10*math.log10(P0/P1) \n", - "print \" \\n\\n The Insertion Loss (from Port 0 to Port 1) in dB= \",round(insertion_loss,2) \n", - "insertion_loss1=10*math.log10(P0/P2) \n", - "print \" \\n\\n The Insertion Loss (from Port 0 to Port 2) in dB= \",round(insertion_loss1,2) \n", - "cross_talk=10*math.log10(P3/P0) \n", - "print \" \\n\\n The Cross Talk in dB= \",int(cross_talk) \n", - "print \" \\n\\n***NOTE: Cross Talk calculated wrognly in book... Value of P3 wrognly taken\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - "\n", - " Coupling Ratio in % = 48.57\n", - " \n", - "\n", - " The Excess Ratio in % = 0.5799\n", - " \n", - "\n", - " The Insertion Loss (from Port 0 to Port 1) in dB= 3.47\n", - " \n", - "\n", - " The Insertion Loss (from Port 0 to Port 2) in dB= 3.72\n", - " \n", - "\n", - " The Cross Talk in dB= -15\n", - " \n", - "\n", - "***NOTE: Cross Talk calculated wrognly in book... Value of P3 wrognly taken\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.10.2:Pg-6.23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "P0= 300.0 \n", - "P1=150.0 \n", - "P2=65.0 \n", - "P3=8.3*10**-3 \n", - " # All powers in uW...\n", - "splitting_ratio= P2/(P1+P2)*100 \n", - "print \" \\n\\n Splitting Ratio in %= \",round(splitting_ratio,2) \n", - "excess_ratio= 10*math.log10(P0/(P1+P2))\n", - "print \" \\n\\n The Excess Ratio in dB= \",round(excess_ratio,4)\n", - "insertion_loss=10*math.log10(P0/P1) \n", - "print \" \\n\\n The Insertion Loss (from Port 0 to Port 1) in dB= \",round(insertion_loss,2) \n", - "cross_talk=10*math.log10(P3/P0) \n", - "print \" \\n\\n The Cross Talk in dB= \",round(cross_talk,2) \n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " \n", - "\n", - " Splitting Ratio in %= 30.23\n", - " \n", - "\n", - " The Excess Ratio in dB= 1.4468\n", - " \n", - "\n", - " The Insertion Loss (from Port 0 to Port 1) in dB= 3.01\n", - " \n", - "\n", - " The Cross Talk in dB= -45.58\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.10.3:Pg-6.25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "import math\n", - "N=32.0 \n", - "Ft=(100-5)/100.0 \n", - "Total_loss= 10*(1-3.322*math.log10(Ft))*math.log10(N) \n", - "print \" The total loss in the coupler in dB = \",round(Total_loss,2) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The total loss in the coupler in dB = 16.17\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.10.4:Pg-6.28" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "N=10 \n", - "L=0.5 \n", - "alpha=0.4 \n", - "Lthru=0.9 \n", - "Lc=1 \n", - "Ltap=10 \n", - "Li=0.5 \n", - "Total_loss= N*(alpha*L +2*Lc +Lthru+Li)-(alpha*L)-(2*Lthru)+(2*Ltap) \n", - "print \" The total loss in the coupler in dB = \",int(Total_loss)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The total loss in the coupler in dB = 54\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6.11.1:Pg-6.33" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given\n", - "del_v=10*10**9 \n", - "N_eff= 1.5 \n", - "c=3*10**11 # speed of light in mm/sec\n", - "del_L= c/(2*N_eff*del_v) \n", - "print \" The wave guide length differenc in mm= \",int(del_L) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " The wave guide length differenc in mm= 10\n" - ] - } - ], - "prompt_number": 33 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Optical_Fiber_Communication_by_V._S._Bagad/README.txt b/_Optical_Fiber_Communication_by_V._S._Bagad/README.txt deleted file mode 100755 index 861c658f..00000000 --- a/_Optical_Fiber_Communication_by_V._S._Bagad/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: Samiksha Srivastava -Course: btech -College/Institute/Organization: ABES Engineering College -Department/Designation: Computer Science and Engineering -Book Title: Optical Fiber Communication -Author: V. S. Bagad -Publisher: Technical Publications, Pune -Year of publication: 2013 -Isbn: 9789350385203 -Edition: 2 \ No newline at end of file diff --git a/_Power_Electronics/Chapter10.ipynb b/_Power_Electronics/Chapter10.ipynb deleted file mode 100755 index cbc3cb90..00000000 --- a/_Power_Electronics/Chapter10.ipynb +++ /dev/null @@ -1,228 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 10 : Cycloconverters" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.2, Page No 594" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=10.0\n", - "a=30.0\n", - "\n", - "#Calculations\n", - "V_or=(V_m/math.sqrt(2))*math.sqrt((1/math.pi)*(math.pi-a*math.pi/180+math.sin(math.radians(2*a))/2))\n", - "I_or=V_or/R \n", - "I_s=I_or\n", - "pf=(I_or**2*R)/(V_s*I_s) \n", - "\n", - "\n", - "#Results\n", - "print(\"rms value of o/p current=%.2f A\" %I_or)\n", - "print(\"rms value of o/p current for each convertor=%.2f A\" %(I_or/math.sqrt(2)))\n", - "print(\"rms value of o/p current for each thyristor=%.3f A\" %(I_or/2))\n", - "print(\"i/p pf=%.4f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p current=22.67 A\n", - "rms value of o/p current for each convertor=16.03 A\n", - "rms value of o/p current for each thyristor=11.333 A\n", - "i/p pf=0.9855\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.4, Page No 604" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_ph=V_s/2\n", - "a=160.0\n", - "\n", - "#Calculations\n", - "r=math.cos(math.radians(180-a))\n", - "m=3\n", - "V_or=r*(V_ph*(m/math.pi)*math.sin(math.pi/m)) \n", - "R=2\n", - "X_L=1.5\n", - "th=math.degrees(math.atan(X_L/R))\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_or/Z \n", - "P=I_or**2*R \n", - "\n", - "#Results\n", - "print(\"rms o/p voltage=%.3f V\" %V_or)\n", - "print(\"rms o/p current=%.2f A\" %I_or)\n", - "print(\"phase angle of o/p current=%.2f deg\" %-th)\n", - "print(\"o/p power=%.2f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms o/p voltage=155.424 V\n", - "rms o/p current=62.17 A\n", - "phase angle of o/p current=-36.87 deg\n", - "o/p power=7730.11 W\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.5 Page No 604" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_ph=V_s/2\n", - "V_l=V_ph*math.sqrt(3)\n", - "a=160.0\n", - "\n", - "#Calculations\n", - "r=math.cos(math.radians(180-a))\n", - "m=6\n", - "V_or=r*(V_l*(m/math.pi)*math.sin(math.pi/m)) \n", - "R=2\n", - "X_L=1.5\n", - "th=math.degrees(math.atan(X_L/R))\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_or/Z \n", - "P=I_or**2*R \n", - "\n", - "#Results\n", - "print(\"rms o/p voltage=%.2f V\" %V_or)\n", - "print(\"rms o/p current=%.2f A\" %I_or)\n", - "print(\"phase angle of o/p current=%.2f deg\" %-th)\n", - "print(\"o/p power=%.2f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms o/p voltage=310.85 V\n", - "rms o/p current=124.34 A\n", - "phase angle of o/p current=-36.87 deg\n", - "o/p power=30920.44 W\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.7, Page No 605" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_l=400.0\n", - "V_ml=math.sqrt(2)*V_l\n", - "m=6\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=.0012\n", - "I=40.0\n", - "\n", - "#Calculations\n", - "V_or1=(V_ml*(m/math.pi)*math.sin(math.pi/m))*math.cos(math.radians(a))\n", - "V_omx1=V_or1-3*w*L*I/math.pi\n", - "V_rms1=V_omx1/math.sqrt(2) \n", - "a2=30.0\n", - "V_or2=(V_ml*(m/math.pi)*math.sin(math.pi/m))*math.cos(math.radians(a))\n", - "V_omx2=V_or2-3*w*L*I/math.pi\n", - "V_rms2=V_omx2/math.sqrt(2) \n", - "\n", - "\n", - "#Results\n", - "print(\"for firing angle=0deg\")\n", - "a1=0\n", - "print(\"rms value of load voltage=%.2f V\" %V_rms2)\n", - "print(\"for firing angle=30deg\")\n", - "print(\"rms value of load voltage=%.2f V\" %V_rms2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=0deg\n", - "rms value of load voltage=-369.12 V\n", - "for firing angle=30deg\n", - "rms value of load voltage=-369.12 V\n" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter10_1.ipynb b/_Power_Electronics/Chapter10_1.ipynb deleted file mode 100755 index cbc3cb90..00000000 --- a/_Power_Electronics/Chapter10_1.ipynb +++ /dev/null @@ -1,228 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 10 : Cycloconverters" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.2, Page No 594" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=10.0\n", - "a=30.0\n", - "\n", - "#Calculations\n", - "V_or=(V_m/math.sqrt(2))*math.sqrt((1/math.pi)*(math.pi-a*math.pi/180+math.sin(math.radians(2*a))/2))\n", - "I_or=V_or/R \n", - "I_s=I_or\n", - "pf=(I_or**2*R)/(V_s*I_s) \n", - "\n", - "\n", - "#Results\n", - "print(\"rms value of o/p current=%.2f A\" %I_or)\n", - "print(\"rms value of o/p current for each convertor=%.2f A\" %(I_or/math.sqrt(2)))\n", - "print(\"rms value of o/p current for each thyristor=%.3f A\" %(I_or/2))\n", - "print(\"i/p pf=%.4f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p current=22.67 A\n", - "rms value of o/p current for each convertor=16.03 A\n", - "rms value of o/p current for each thyristor=11.333 A\n", - "i/p pf=0.9855\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.4, Page No 604" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_ph=V_s/2\n", - "a=160.0\n", - "\n", - "#Calculations\n", - "r=math.cos(math.radians(180-a))\n", - "m=3\n", - "V_or=r*(V_ph*(m/math.pi)*math.sin(math.pi/m)) \n", - "R=2\n", - "X_L=1.5\n", - "th=math.degrees(math.atan(X_L/R))\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_or/Z \n", - "P=I_or**2*R \n", - "\n", - "#Results\n", - "print(\"rms o/p voltage=%.3f V\" %V_or)\n", - "print(\"rms o/p current=%.2f A\" %I_or)\n", - "print(\"phase angle of o/p current=%.2f deg\" %-th)\n", - "print(\"o/p power=%.2f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms o/p voltage=155.424 V\n", - "rms o/p current=62.17 A\n", - "phase angle of o/p current=-36.87 deg\n", - "o/p power=7730.11 W\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.5 Page No 604" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_ph=V_s/2\n", - "V_l=V_ph*math.sqrt(3)\n", - "a=160.0\n", - "\n", - "#Calculations\n", - "r=math.cos(math.radians(180-a))\n", - "m=6\n", - "V_or=r*(V_l*(m/math.pi)*math.sin(math.pi/m)) \n", - "R=2\n", - "X_L=1.5\n", - "th=math.degrees(math.atan(X_L/R))\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_or/Z \n", - "P=I_or**2*R \n", - "\n", - "#Results\n", - "print(\"rms o/p voltage=%.2f V\" %V_or)\n", - "print(\"rms o/p current=%.2f A\" %I_or)\n", - "print(\"phase angle of o/p current=%.2f deg\" %-th)\n", - "print(\"o/p power=%.2f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms o/p voltage=310.85 V\n", - "rms o/p current=124.34 A\n", - "phase angle of o/p current=-36.87 deg\n", - "o/p power=30920.44 W\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.7, Page No 605" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_l=400.0\n", - "V_ml=math.sqrt(2)*V_l\n", - "m=6\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=.0012\n", - "I=40.0\n", - "\n", - "#Calculations\n", - "V_or1=(V_ml*(m/math.pi)*math.sin(math.pi/m))*math.cos(math.radians(a))\n", - "V_omx1=V_or1-3*w*L*I/math.pi\n", - "V_rms1=V_omx1/math.sqrt(2) \n", - "a2=30.0\n", - "V_or2=(V_ml*(m/math.pi)*math.sin(math.pi/m))*math.cos(math.radians(a))\n", - "V_omx2=V_or2-3*w*L*I/math.pi\n", - "V_rms2=V_omx2/math.sqrt(2) \n", - "\n", - "\n", - "#Results\n", - "print(\"for firing angle=0deg\")\n", - "a1=0\n", - "print(\"rms value of load voltage=%.2f V\" %V_rms2)\n", - "print(\"for firing angle=30deg\")\n", - "print(\"rms value of load voltage=%.2f V\" %V_rms2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=0deg\n", - "rms value of load voltage=-369.12 V\n", - "for firing angle=30deg\n", - "rms value of load voltage=-369.12 V\n" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter10_2.ipynb b/_Power_Electronics/Chapter10_2.ipynb deleted file mode 100755 index cbc3cb90..00000000 --- a/_Power_Electronics/Chapter10_2.ipynb +++ /dev/null @@ -1,228 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 10 : Cycloconverters" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.2, Page No 594" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=10.0\n", - "a=30.0\n", - "\n", - "#Calculations\n", - "V_or=(V_m/math.sqrt(2))*math.sqrt((1/math.pi)*(math.pi-a*math.pi/180+math.sin(math.radians(2*a))/2))\n", - "I_or=V_or/R \n", - "I_s=I_or\n", - "pf=(I_or**2*R)/(V_s*I_s) \n", - "\n", - "\n", - "#Results\n", - "print(\"rms value of o/p current=%.2f A\" %I_or)\n", - "print(\"rms value of o/p current for each convertor=%.2f A\" %(I_or/math.sqrt(2)))\n", - "print(\"rms value of o/p current for each thyristor=%.3f A\" %(I_or/2))\n", - "print(\"i/p pf=%.4f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p current=22.67 A\n", - "rms value of o/p current for each convertor=16.03 A\n", - "rms value of o/p current for each thyristor=11.333 A\n", - "i/p pf=0.9855\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.4, Page No 604" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_ph=V_s/2\n", - "a=160.0\n", - "\n", - "#Calculations\n", - "r=math.cos(math.radians(180-a))\n", - "m=3\n", - "V_or=r*(V_ph*(m/math.pi)*math.sin(math.pi/m)) \n", - "R=2\n", - "X_L=1.5\n", - "th=math.degrees(math.atan(X_L/R))\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_or/Z \n", - "P=I_or**2*R \n", - "\n", - "#Results\n", - "print(\"rms o/p voltage=%.3f V\" %V_or)\n", - "print(\"rms o/p current=%.2f A\" %I_or)\n", - "print(\"phase angle of o/p current=%.2f deg\" %-th)\n", - "print(\"o/p power=%.2f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms o/p voltage=155.424 V\n", - "rms o/p current=62.17 A\n", - "phase angle of o/p current=-36.87 deg\n", - "o/p power=7730.11 W\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.5 Page No 604" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_ph=V_s/2\n", - "V_l=V_ph*math.sqrt(3)\n", - "a=160.0\n", - "\n", - "#Calculations\n", - "r=math.cos(math.radians(180-a))\n", - "m=6\n", - "V_or=r*(V_l*(m/math.pi)*math.sin(math.pi/m)) \n", - "R=2\n", - "X_L=1.5\n", - "th=math.degrees(math.atan(X_L/R))\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_or/Z \n", - "P=I_or**2*R \n", - "\n", - "#Results\n", - "print(\"rms o/p voltage=%.2f V\" %V_or)\n", - "print(\"rms o/p current=%.2f A\" %I_or)\n", - "print(\"phase angle of o/p current=%.2f deg\" %-th)\n", - "print(\"o/p power=%.2f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms o/p voltage=310.85 V\n", - "rms o/p current=124.34 A\n", - "phase angle of o/p current=-36.87 deg\n", - "o/p power=30920.44 W\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.7, Page No 605" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_l=400.0\n", - "V_ml=math.sqrt(2)*V_l\n", - "m=6\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=.0012\n", - "I=40.0\n", - "\n", - "#Calculations\n", - "V_or1=(V_ml*(m/math.pi)*math.sin(math.pi/m))*math.cos(math.radians(a))\n", - "V_omx1=V_or1-3*w*L*I/math.pi\n", - "V_rms1=V_omx1/math.sqrt(2) \n", - "a2=30.0\n", - "V_or2=(V_ml*(m/math.pi)*math.sin(math.pi/m))*math.cos(math.radians(a))\n", - "V_omx2=V_or2-3*w*L*I/math.pi\n", - "V_rms2=V_omx2/math.sqrt(2) \n", - "\n", - "\n", - "#Results\n", - "print(\"for firing angle=0deg\")\n", - "a1=0\n", - "print(\"rms value of load voltage=%.2f V\" %V_rms2)\n", - "print(\"for firing angle=30deg\")\n", - "print(\"rms value of load voltage=%.2f V\" %V_rms2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=0deg\n", - "rms value of load voltage=-369.12 V\n", - "for firing angle=30deg\n", - "rms value of load voltage=-369.12 V\n" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter10_3.ipynb b/_Power_Electronics/Chapter10_3.ipynb deleted file mode 100755 index cbc3cb90..00000000 --- a/_Power_Electronics/Chapter10_3.ipynb +++ /dev/null @@ -1,228 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 10 : Cycloconverters" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.2, Page No 594" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=10.0\n", - "a=30.0\n", - "\n", - "#Calculations\n", - "V_or=(V_m/math.sqrt(2))*math.sqrt((1/math.pi)*(math.pi-a*math.pi/180+math.sin(math.radians(2*a))/2))\n", - "I_or=V_or/R \n", - "I_s=I_or\n", - "pf=(I_or**2*R)/(V_s*I_s) \n", - "\n", - "\n", - "#Results\n", - "print(\"rms value of o/p current=%.2f A\" %I_or)\n", - "print(\"rms value of o/p current for each convertor=%.2f A\" %(I_or/math.sqrt(2)))\n", - "print(\"rms value of o/p current for each thyristor=%.3f A\" %(I_or/2))\n", - "print(\"i/p pf=%.4f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p current=22.67 A\n", - "rms value of o/p current for each convertor=16.03 A\n", - "rms value of o/p current for each thyristor=11.333 A\n", - "i/p pf=0.9855\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.4, Page No 604" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_ph=V_s/2\n", - "a=160.0\n", - "\n", - "#Calculations\n", - "r=math.cos(math.radians(180-a))\n", - "m=3\n", - "V_or=r*(V_ph*(m/math.pi)*math.sin(math.pi/m)) \n", - "R=2\n", - "X_L=1.5\n", - "th=math.degrees(math.atan(X_L/R))\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_or/Z \n", - "P=I_or**2*R \n", - "\n", - "#Results\n", - "print(\"rms o/p voltage=%.3f V\" %V_or)\n", - "print(\"rms o/p current=%.2f A\" %I_or)\n", - "print(\"phase angle of o/p current=%.2f deg\" %-th)\n", - "print(\"o/p power=%.2f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms o/p voltage=155.424 V\n", - "rms o/p current=62.17 A\n", - "phase angle of o/p current=-36.87 deg\n", - "o/p power=7730.11 W\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.5 Page No 604" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_ph=V_s/2\n", - "V_l=V_ph*math.sqrt(3)\n", - "a=160.0\n", - "\n", - "#Calculations\n", - "r=math.cos(math.radians(180-a))\n", - "m=6\n", - "V_or=r*(V_l*(m/math.pi)*math.sin(math.pi/m)) \n", - "R=2\n", - "X_L=1.5\n", - "th=math.degrees(math.atan(X_L/R))\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_or/Z \n", - "P=I_or**2*R \n", - "\n", - "#Results\n", - "print(\"rms o/p voltage=%.2f V\" %V_or)\n", - "print(\"rms o/p current=%.2f A\" %I_or)\n", - "print(\"phase angle of o/p current=%.2f deg\" %-th)\n", - "print(\"o/p power=%.2f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms o/p voltage=310.85 V\n", - "rms o/p current=124.34 A\n", - "phase angle of o/p current=-36.87 deg\n", - "o/p power=30920.44 W\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.7, Page No 605" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_l=400.0\n", - "V_ml=math.sqrt(2)*V_l\n", - "m=6\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=.0012\n", - "I=40.0\n", - "\n", - "#Calculations\n", - "V_or1=(V_ml*(m/math.pi)*math.sin(math.pi/m))*math.cos(math.radians(a))\n", - "V_omx1=V_or1-3*w*L*I/math.pi\n", - "V_rms1=V_omx1/math.sqrt(2) \n", - "a2=30.0\n", - "V_or2=(V_ml*(m/math.pi)*math.sin(math.pi/m))*math.cos(math.radians(a))\n", - "V_omx2=V_or2-3*w*L*I/math.pi\n", - "V_rms2=V_omx2/math.sqrt(2) \n", - "\n", - "\n", - "#Results\n", - "print(\"for firing angle=0deg\")\n", - "a1=0\n", - "print(\"rms value of load voltage=%.2f V\" %V_rms2)\n", - "print(\"for firing angle=30deg\")\n", - "print(\"rms value of load voltage=%.2f V\" %V_rms2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=0deg\n", - "rms value of load voltage=-369.12 V\n", - "for firing angle=30deg\n", - "rms value of load voltage=-369.12 V\n" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter10_4.ipynb b/_Power_Electronics/Chapter10_4.ipynb deleted file mode 100755 index cbc3cb90..00000000 --- a/_Power_Electronics/Chapter10_4.ipynb +++ /dev/null @@ -1,228 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 10 : Cycloconverters" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.2, Page No 594" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=10.0\n", - "a=30.0\n", - "\n", - "#Calculations\n", - "V_or=(V_m/math.sqrt(2))*math.sqrt((1/math.pi)*(math.pi-a*math.pi/180+math.sin(math.radians(2*a))/2))\n", - "I_or=V_or/R \n", - "I_s=I_or\n", - "pf=(I_or**2*R)/(V_s*I_s) \n", - "\n", - "\n", - "#Results\n", - "print(\"rms value of o/p current=%.2f A\" %I_or)\n", - "print(\"rms value of o/p current for each convertor=%.2f A\" %(I_or/math.sqrt(2)))\n", - "print(\"rms value of o/p current for each thyristor=%.3f A\" %(I_or/2))\n", - "print(\"i/p pf=%.4f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p current=22.67 A\n", - "rms value of o/p current for each convertor=16.03 A\n", - "rms value of o/p current for each thyristor=11.333 A\n", - "i/p pf=0.9855\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.4, Page No 604" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_ph=V_s/2\n", - "a=160.0\n", - "\n", - "#Calculations\n", - "r=math.cos(math.radians(180-a))\n", - "m=3\n", - "V_or=r*(V_ph*(m/math.pi)*math.sin(math.pi/m)) \n", - "R=2\n", - "X_L=1.5\n", - "th=math.degrees(math.atan(X_L/R))\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_or/Z \n", - "P=I_or**2*R \n", - "\n", - "#Results\n", - "print(\"rms o/p voltage=%.3f V\" %V_or)\n", - "print(\"rms o/p current=%.2f A\" %I_or)\n", - "print(\"phase angle of o/p current=%.2f deg\" %-th)\n", - "print(\"o/p power=%.2f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms o/p voltage=155.424 V\n", - "rms o/p current=62.17 A\n", - "phase angle of o/p current=-36.87 deg\n", - "o/p power=7730.11 W\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.5 Page No 604" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_ph=V_s/2\n", - "V_l=V_ph*math.sqrt(3)\n", - "a=160.0\n", - "\n", - "#Calculations\n", - "r=math.cos(math.radians(180-a))\n", - "m=6\n", - "V_or=r*(V_l*(m/math.pi)*math.sin(math.pi/m)) \n", - "R=2\n", - "X_L=1.5\n", - "th=math.degrees(math.atan(X_L/R))\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_or/Z \n", - "P=I_or**2*R \n", - "\n", - "#Results\n", - "print(\"rms o/p voltage=%.2f V\" %V_or)\n", - "print(\"rms o/p current=%.2f A\" %I_or)\n", - "print(\"phase angle of o/p current=%.2f deg\" %-th)\n", - "print(\"o/p power=%.2f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms o/p voltage=310.85 V\n", - "rms o/p current=124.34 A\n", - "phase angle of o/p current=-36.87 deg\n", - "o/p power=30920.44 W\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 10.7, Page No 605" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_l=400.0\n", - "V_ml=math.sqrt(2)*V_l\n", - "m=6\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=.0012\n", - "I=40.0\n", - "\n", - "#Calculations\n", - "V_or1=(V_ml*(m/math.pi)*math.sin(math.pi/m))*math.cos(math.radians(a))\n", - "V_omx1=V_or1-3*w*L*I/math.pi\n", - "V_rms1=V_omx1/math.sqrt(2) \n", - "a2=30.0\n", - "V_or2=(V_ml*(m/math.pi)*math.sin(math.pi/m))*math.cos(math.radians(a))\n", - "V_omx2=V_or2-3*w*L*I/math.pi\n", - "V_rms2=V_omx2/math.sqrt(2) \n", - "\n", - "\n", - "#Results\n", - "print(\"for firing angle=0deg\")\n", - "a1=0\n", - "print(\"rms value of load voltage=%.2f V\" %V_rms2)\n", - "print(\"for firing angle=30deg\")\n", - "print(\"rms value of load voltage=%.2f V\" %V_rms2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=0deg\n", - "rms value of load voltage=-369.12 V\n", - "for firing angle=30deg\n", - "rms value of load voltage=-369.12 V\n" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter11.ipynb b/_Power_Electronics/Chapter11.ipynb deleted file mode 100755 index d2317d28..00000000 --- a/_Power_Electronics/Chapter11.ipynb +++ /dev/null @@ -1,299 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 11 : Some Applications" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.1, Page No 622" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=11000.0\n", - "V_ml=math.sqrt(2)*V_s\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "I_d=300\n", - "R_d=1\n", - "g=20 #g=gamma\n", - "a=math.degrees(math.acos(math.cos(math.radians(g))+math.pi/(3*V_ml)*I_d*R_d)) \n", - "L_s=.01\n", - "V_d=(3/math.pi)*((V_ml*math.cos(math.radians(a)))-w*L_s*I_d) \n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"rectifier o/p voltage=%.1f V\" %V_d)\n", - "print(\"dc link voltage=%.3f V\" %(2*V_d/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=16.283 deg\n", - "rectifier o/p voltage=13359.3 V\n", - "dc link voltage=26.719 V\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.2, Page No 623" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_d=(200.0+200)*10**3\n", - "P=1000.0*10**6\n", - "\n", - "#Calculations\n", - "I_d=P/V_d\n", - " #each thristor conducts for 120deg for a periodicity of 360deg\n", - "a=0\n", - "V_d=200.0*10**3\n", - "V_ml=V_d*math.pi/(3*math.cos(math.radians(a)))\n", - "\n", - "#Results\n", - "print(\"rms current rating of thyristor=%.2f A\" %(I_d*math.sqrt(120/360)))\n", - "print(\"peak reverse voltage across each thyristor=%.2f kV\" %(V_ml/2/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms current rating of thyristor=0.00 A\n", - "peak reverse voltage across each thyristor=104.72 kV\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.3 Page No 627" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_m=230.0\n", - "V_s=230/math.sqrt(2)\n", - "pf=0.8\n", - "P=2000.0\n", - "\n", - "#Calculations\n", - "I_m=P/(V_s*pf)\n", - "I_Tr=I_m/math.sqrt(2)\n", - "I_TA=2*I_m/math.pi\n", - "fos=2 #factor of safety\n", - "PIV=V_m*math.sqrt(2)\n", - "I_Tr=I_m/(2)\n", - "I_TA=I_m/math.pi\n", - "\n", - "#Results\n", - "print(\"rms value of thyristor current=%.2f A\" %(fos*I_Tr))\n", - "print(\"avg value of thyristor current=%.3f A\" %(fos*I_TA))\n", - "print(\"voltage rating of thyristor=%.2f V\" %PIV)\n", - "print(\"rms value of diode current=%.3f A\" %(fos*I_Tr))\n", - "print(\"avg value of diode current=%.3f A\" %(fos*I_TA))\n", - "print(\"voltage rating of diode=%.2f V\" %PIV)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of thyristor current=15.37 A\n", - "avg value of thyristor current=9.786 A\n", - "voltage rating of thyristor=325.27 V\n", - "rms value of diode current=15.372 A\n", - "avg value of diode current=9.786 A\n", - "voltage rating of diode=325.27 V\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.4, Page No 629" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=200.0\n", - "I=10.0\n", - "\n", - "#Calculations\n", - "R_L=V/I \n", - "I_h=.005 #holding current\n", - "R2=V/I_h \n", - "t_c=20*10**-6\n", - "fos=2 #factor of safety\n", - "C=t_c*fos/(R_L*math.log(2)) \n", - "\n", - "#Results\n", - "print(\"value of load resistance=%.0f ohm\" %R_L)\n", - "print(\"value of R2=%.0f kilo-ohm\" %(R2/1000))\n", - "print(\"value of C=%.3f uF\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of load resistance=20 ohm\n", - "value of R2=40 kilo-ohm\n", - "value of C=2.885 uF\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.5 Page No 646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "u_r=10\n", - "f=10000.0 #Hz\n", - "p=4.0*10**-8 #ohm-m\n", - "\n", - "#Calculations\n", - "dl=(1/(2*math.pi))*math.sqrt(p*10**7/(u_r*f)) \n", - "l=0.12 #length of cylinder\n", - "t=20.0 #no of turns\n", - "I=100.0\n", - "H=t*I/l\n", - "P_s=2*math.pi*H**2*math.sqrt(u_r*f*p*10**-7) \n", - "d=.02 #diameter\n", - "P_v=4*H**2*p/(d*dl) \n", - "\n", - "#Results\n", - "print(\"depth of heat of penetration=%.5f mm\" %(dl*1000))\n", - "print(\"heat generated per unit cylinder surface area=%.3f W/m**2\" %P_s)\n", - "print(\"heat generated per unit cylinder volume=%.0f W/m**3\" %P_v)\n", - " #answer of P_v varies as given in book as value of d is not taken as in formulae. " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "depth of heat of penetration=0.31831 mm\n", - "heat generated per unit cylinder surface area=34906.585 W/m**2\n", - "heat generated per unit cylinder volume=6981317 W/m**3\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.6 Page No 646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=3000.0\n", - "\n", - "#Calculations\n", - "t_qmin=30.0*10**-6\n", - "f_r=f/(1-2*t_qmin*f)\n", - "R=0.06\n", - "L=20.0*10**-6\n", - "C=1/(L*((2*math.pi*f_r)**2+(R/(2*L))**2)) \n", - "\n", - "#Results\n", - "print(\"required capacitor size=%.4f F\" %(C*10**6))\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "required capacitor size=94.2215 F\n" - ] - } - ], - "prompt_number": 6 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter11_1.ipynb b/_Power_Electronics/Chapter11_1.ipynb deleted file mode 100755 index d2317d28..00000000 --- a/_Power_Electronics/Chapter11_1.ipynb +++ /dev/null @@ -1,299 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 11 : Some Applications" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.1, Page No 622" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=11000.0\n", - "V_ml=math.sqrt(2)*V_s\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "I_d=300\n", - "R_d=1\n", - "g=20 #g=gamma\n", - "a=math.degrees(math.acos(math.cos(math.radians(g))+math.pi/(3*V_ml)*I_d*R_d)) \n", - "L_s=.01\n", - "V_d=(3/math.pi)*((V_ml*math.cos(math.radians(a)))-w*L_s*I_d) \n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"rectifier o/p voltage=%.1f V\" %V_d)\n", - "print(\"dc link voltage=%.3f V\" %(2*V_d/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=16.283 deg\n", - "rectifier o/p voltage=13359.3 V\n", - "dc link voltage=26.719 V\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.2, Page No 623" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_d=(200.0+200)*10**3\n", - "P=1000.0*10**6\n", - "\n", - "#Calculations\n", - "I_d=P/V_d\n", - " #each thristor conducts for 120deg for a periodicity of 360deg\n", - "a=0\n", - "V_d=200.0*10**3\n", - "V_ml=V_d*math.pi/(3*math.cos(math.radians(a)))\n", - "\n", - "#Results\n", - "print(\"rms current rating of thyristor=%.2f A\" %(I_d*math.sqrt(120/360)))\n", - "print(\"peak reverse voltage across each thyristor=%.2f kV\" %(V_ml/2/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms current rating of thyristor=0.00 A\n", - "peak reverse voltage across each thyristor=104.72 kV\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.3 Page No 627" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_m=230.0\n", - "V_s=230/math.sqrt(2)\n", - "pf=0.8\n", - "P=2000.0\n", - "\n", - "#Calculations\n", - "I_m=P/(V_s*pf)\n", - "I_Tr=I_m/math.sqrt(2)\n", - "I_TA=2*I_m/math.pi\n", - "fos=2 #factor of safety\n", - "PIV=V_m*math.sqrt(2)\n", - "I_Tr=I_m/(2)\n", - "I_TA=I_m/math.pi\n", - "\n", - "#Results\n", - "print(\"rms value of thyristor current=%.2f A\" %(fos*I_Tr))\n", - "print(\"avg value of thyristor current=%.3f A\" %(fos*I_TA))\n", - "print(\"voltage rating of thyristor=%.2f V\" %PIV)\n", - "print(\"rms value of diode current=%.3f A\" %(fos*I_Tr))\n", - "print(\"avg value of diode current=%.3f A\" %(fos*I_TA))\n", - "print(\"voltage rating of diode=%.2f V\" %PIV)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of thyristor current=15.37 A\n", - "avg value of thyristor current=9.786 A\n", - "voltage rating of thyristor=325.27 V\n", - "rms value of diode current=15.372 A\n", - "avg value of diode current=9.786 A\n", - "voltage rating of diode=325.27 V\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.4, Page No 629" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=200.0\n", - "I=10.0\n", - "\n", - "#Calculations\n", - "R_L=V/I \n", - "I_h=.005 #holding current\n", - "R2=V/I_h \n", - "t_c=20*10**-6\n", - "fos=2 #factor of safety\n", - "C=t_c*fos/(R_L*math.log(2)) \n", - "\n", - "#Results\n", - "print(\"value of load resistance=%.0f ohm\" %R_L)\n", - "print(\"value of R2=%.0f kilo-ohm\" %(R2/1000))\n", - "print(\"value of C=%.3f uF\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of load resistance=20 ohm\n", - "value of R2=40 kilo-ohm\n", - "value of C=2.885 uF\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.5 Page No 646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "u_r=10\n", - "f=10000.0 #Hz\n", - "p=4.0*10**-8 #ohm-m\n", - "\n", - "#Calculations\n", - "dl=(1/(2*math.pi))*math.sqrt(p*10**7/(u_r*f)) \n", - "l=0.12 #length of cylinder\n", - "t=20.0 #no of turns\n", - "I=100.0\n", - "H=t*I/l\n", - "P_s=2*math.pi*H**2*math.sqrt(u_r*f*p*10**-7) \n", - "d=.02 #diameter\n", - "P_v=4*H**2*p/(d*dl) \n", - "\n", - "#Results\n", - "print(\"depth of heat of penetration=%.5f mm\" %(dl*1000))\n", - "print(\"heat generated per unit cylinder surface area=%.3f W/m**2\" %P_s)\n", - "print(\"heat generated per unit cylinder volume=%.0f W/m**3\" %P_v)\n", - " #answer of P_v varies as given in book as value of d is not taken as in formulae. " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "depth of heat of penetration=0.31831 mm\n", - "heat generated per unit cylinder surface area=34906.585 W/m**2\n", - "heat generated per unit cylinder volume=6981317 W/m**3\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.6 Page No 646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=3000.0\n", - "\n", - "#Calculations\n", - "t_qmin=30.0*10**-6\n", - "f_r=f/(1-2*t_qmin*f)\n", - "R=0.06\n", - "L=20.0*10**-6\n", - "C=1/(L*((2*math.pi*f_r)**2+(R/(2*L))**2)) \n", - "\n", - "#Results\n", - "print(\"required capacitor size=%.4f F\" %(C*10**6))\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "required capacitor size=94.2215 F\n" - ] - } - ], - "prompt_number": 6 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter11_2.ipynb b/_Power_Electronics/Chapter11_2.ipynb deleted file mode 100755 index d2317d28..00000000 --- a/_Power_Electronics/Chapter11_2.ipynb +++ /dev/null @@ -1,299 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 11 : Some Applications" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.1, Page No 622" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=11000.0\n", - "V_ml=math.sqrt(2)*V_s\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "I_d=300\n", - "R_d=1\n", - "g=20 #g=gamma\n", - "a=math.degrees(math.acos(math.cos(math.radians(g))+math.pi/(3*V_ml)*I_d*R_d)) \n", - "L_s=.01\n", - "V_d=(3/math.pi)*((V_ml*math.cos(math.radians(a)))-w*L_s*I_d) \n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"rectifier o/p voltage=%.1f V\" %V_d)\n", - "print(\"dc link voltage=%.3f V\" %(2*V_d/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=16.283 deg\n", - "rectifier o/p voltage=13359.3 V\n", - "dc link voltage=26.719 V\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.2, Page No 623" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_d=(200.0+200)*10**3\n", - "P=1000.0*10**6\n", - "\n", - "#Calculations\n", - "I_d=P/V_d\n", - " #each thristor conducts for 120deg for a periodicity of 360deg\n", - "a=0\n", - "V_d=200.0*10**3\n", - "V_ml=V_d*math.pi/(3*math.cos(math.radians(a)))\n", - "\n", - "#Results\n", - "print(\"rms current rating of thyristor=%.2f A\" %(I_d*math.sqrt(120/360)))\n", - "print(\"peak reverse voltage across each thyristor=%.2f kV\" %(V_ml/2/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms current rating of thyristor=0.00 A\n", - "peak reverse voltage across each thyristor=104.72 kV\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.3 Page No 627" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_m=230.0\n", - "V_s=230/math.sqrt(2)\n", - "pf=0.8\n", - "P=2000.0\n", - "\n", - "#Calculations\n", - "I_m=P/(V_s*pf)\n", - "I_Tr=I_m/math.sqrt(2)\n", - "I_TA=2*I_m/math.pi\n", - "fos=2 #factor of safety\n", - "PIV=V_m*math.sqrt(2)\n", - "I_Tr=I_m/(2)\n", - "I_TA=I_m/math.pi\n", - "\n", - "#Results\n", - "print(\"rms value of thyristor current=%.2f A\" %(fos*I_Tr))\n", - "print(\"avg value of thyristor current=%.3f A\" %(fos*I_TA))\n", - "print(\"voltage rating of thyristor=%.2f V\" %PIV)\n", - "print(\"rms value of diode current=%.3f A\" %(fos*I_Tr))\n", - "print(\"avg value of diode current=%.3f A\" %(fos*I_TA))\n", - "print(\"voltage rating of diode=%.2f V\" %PIV)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of thyristor current=15.37 A\n", - "avg value of thyristor current=9.786 A\n", - "voltage rating of thyristor=325.27 V\n", - "rms value of diode current=15.372 A\n", - "avg value of diode current=9.786 A\n", - "voltage rating of diode=325.27 V\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.4, Page No 629" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=200.0\n", - "I=10.0\n", - "\n", - "#Calculations\n", - "R_L=V/I \n", - "I_h=.005 #holding current\n", - "R2=V/I_h \n", - "t_c=20*10**-6\n", - "fos=2 #factor of safety\n", - "C=t_c*fos/(R_L*math.log(2)) \n", - "\n", - "#Results\n", - "print(\"value of load resistance=%.0f ohm\" %R_L)\n", - "print(\"value of R2=%.0f kilo-ohm\" %(R2/1000))\n", - "print(\"value of C=%.3f uF\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of load resistance=20 ohm\n", - "value of R2=40 kilo-ohm\n", - "value of C=2.885 uF\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.5 Page No 646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "u_r=10\n", - "f=10000.0 #Hz\n", - "p=4.0*10**-8 #ohm-m\n", - "\n", - "#Calculations\n", - "dl=(1/(2*math.pi))*math.sqrt(p*10**7/(u_r*f)) \n", - "l=0.12 #length of cylinder\n", - "t=20.0 #no of turns\n", - "I=100.0\n", - "H=t*I/l\n", - "P_s=2*math.pi*H**2*math.sqrt(u_r*f*p*10**-7) \n", - "d=.02 #diameter\n", - "P_v=4*H**2*p/(d*dl) \n", - "\n", - "#Results\n", - "print(\"depth of heat of penetration=%.5f mm\" %(dl*1000))\n", - "print(\"heat generated per unit cylinder surface area=%.3f W/m**2\" %P_s)\n", - "print(\"heat generated per unit cylinder volume=%.0f W/m**3\" %P_v)\n", - " #answer of P_v varies as given in book as value of d is not taken as in formulae. " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "depth of heat of penetration=0.31831 mm\n", - "heat generated per unit cylinder surface area=34906.585 W/m**2\n", - "heat generated per unit cylinder volume=6981317 W/m**3\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.6 Page No 646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=3000.0\n", - "\n", - "#Calculations\n", - "t_qmin=30.0*10**-6\n", - "f_r=f/(1-2*t_qmin*f)\n", - "R=0.06\n", - "L=20.0*10**-6\n", - "C=1/(L*((2*math.pi*f_r)**2+(R/(2*L))**2)) \n", - "\n", - "#Results\n", - "print(\"required capacitor size=%.4f F\" %(C*10**6))\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "required capacitor size=94.2215 F\n" - ] - } - ], - "prompt_number": 6 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter11_3.ipynb b/_Power_Electronics/Chapter11_3.ipynb deleted file mode 100755 index d2317d28..00000000 --- a/_Power_Electronics/Chapter11_3.ipynb +++ /dev/null @@ -1,299 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 11 : Some Applications" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.1, Page No 622" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=11000.0\n", - "V_ml=math.sqrt(2)*V_s\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "I_d=300\n", - "R_d=1\n", - "g=20 #g=gamma\n", - "a=math.degrees(math.acos(math.cos(math.radians(g))+math.pi/(3*V_ml)*I_d*R_d)) \n", - "L_s=.01\n", - "V_d=(3/math.pi)*((V_ml*math.cos(math.radians(a)))-w*L_s*I_d) \n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"rectifier o/p voltage=%.1f V\" %V_d)\n", - "print(\"dc link voltage=%.3f V\" %(2*V_d/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=16.283 deg\n", - "rectifier o/p voltage=13359.3 V\n", - "dc link voltage=26.719 V\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.2, Page No 623" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_d=(200.0+200)*10**3\n", - "P=1000.0*10**6\n", - "\n", - "#Calculations\n", - "I_d=P/V_d\n", - " #each thristor conducts for 120deg for a periodicity of 360deg\n", - "a=0\n", - "V_d=200.0*10**3\n", - "V_ml=V_d*math.pi/(3*math.cos(math.radians(a)))\n", - "\n", - "#Results\n", - "print(\"rms current rating of thyristor=%.2f A\" %(I_d*math.sqrt(120/360)))\n", - "print(\"peak reverse voltage across each thyristor=%.2f kV\" %(V_ml/2/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms current rating of thyristor=0.00 A\n", - "peak reverse voltage across each thyristor=104.72 kV\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.3 Page No 627" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_m=230.0\n", - "V_s=230/math.sqrt(2)\n", - "pf=0.8\n", - "P=2000.0\n", - "\n", - "#Calculations\n", - "I_m=P/(V_s*pf)\n", - "I_Tr=I_m/math.sqrt(2)\n", - "I_TA=2*I_m/math.pi\n", - "fos=2 #factor of safety\n", - "PIV=V_m*math.sqrt(2)\n", - "I_Tr=I_m/(2)\n", - "I_TA=I_m/math.pi\n", - "\n", - "#Results\n", - "print(\"rms value of thyristor current=%.2f A\" %(fos*I_Tr))\n", - "print(\"avg value of thyristor current=%.3f A\" %(fos*I_TA))\n", - "print(\"voltage rating of thyristor=%.2f V\" %PIV)\n", - "print(\"rms value of diode current=%.3f A\" %(fos*I_Tr))\n", - "print(\"avg value of diode current=%.3f A\" %(fos*I_TA))\n", - "print(\"voltage rating of diode=%.2f V\" %PIV)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of thyristor current=15.37 A\n", - "avg value of thyristor current=9.786 A\n", - "voltage rating of thyristor=325.27 V\n", - "rms value of diode current=15.372 A\n", - "avg value of diode current=9.786 A\n", - "voltage rating of diode=325.27 V\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.4, Page No 629" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=200.0\n", - "I=10.0\n", - "\n", - "#Calculations\n", - "R_L=V/I \n", - "I_h=.005 #holding current\n", - "R2=V/I_h \n", - "t_c=20*10**-6\n", - "fos=2 #factor of safety\n", - "C=t_c*fos/(R_L*math.log(2)) \n", - "\n", - "#Results\n", - "print(\"value of load resistance=%.0f ohm\" %R_L)\n", - "print(\"value of R2=%.0f kilo-ohm\" %(R2/1000))\n", - "print(\"value of C=%.3f uF\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of load resistance=20 ohm\n", - "value of R2=40 kilo-ohm\n", - "value of C=2.885 uF\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.5 Page No 646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "u_r=10\n", - "f=10000.0 #Hz\n", - "p=4.0*10**-8 #ohm-m\n", - "\n", - "#Calculations\n", - "dl=(1/(2*math.pi))*math.sqrt(p*10**7/(u_r*f)) \n", - "l=0.12 #length of cylinder\n", - "t=20.0 #no of turns\n", - "I=100.0\n", - "H=t*I/l\n", - "P_s=2*math.pi*H**2*math.sqrt(u_r*f*p*10**-7) \n", - "d=.02 #diameter\n", - "P_v=4*H**2*p/(d*dl) \n", - "\n", - "#Results\n", - "print(\"depth of heat of penetration=%.5f mm\" %(dl*1000))\n", - "print(\"heat generated per unit cylinder surface area=%.3f W/m**2\" %P_s)\n", - "print(\"heat generated per unit cylinder volume=%.0f W/m**3\" %P_v)\n", - " #answer of P_v varies as given in book as value of d is not taken as in formulae. " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "depth of heat of penetration=0.31831 mm\n", - "heat generated per unit cylinder surface area=34906.585 W/m**2\n", - "heat generated per unit cylinder volume=6981317 W/m**3\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.6 Page No 646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=3000.0\n", - "\n", - "#Calculations\n", - "t_qmin=30.0*10**-6\n", - "f_r=f/(1-2*t_qmin*f)\n", - "R=0.06\n", - "L=20.0*10**-6\n", - "C=1/(L*((2*math.pi*f_r)**2+(R/(2*L))**2)) \n", - "\n", - "#Results\n", - "print(\"required capacitor size=%.4f F\" %(C*10**6))\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "required capacitor size=94.2215 F\n" - ] - } - ], - "prompt_number": 6 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter11_4.ipynb b/_Power_Electronics/Chapter11_4.ipynb deleted file mode 100755 index d2317d28..00000000 --- a/_Power_Electronics/Chapter11_4.ipynb +++ /dev/null @@ -1,299 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 11 : Some Applications" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.1, Page No 622" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=11000.0\n", - "V_ml=math.sqrt(2)*V_s\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "I_d=300\n", - "R_d=1\n", - "g=20 #g=gamma\n", - "a=math.degrees(math.acos(math.cos(math.radians(g))+math.pi/(3*V_ml)*I_d*R_d)) \n", - "L_s=.01\n", - "V_d=(3/math.pi)*((V_ml*math.cos(math.radians(a)))-w*L_s*I_d) \n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"rectifier o/p voltage=%.1f V\" %V_d)\n", - "print(\"dc link voltage=%.3f V\" %(2*V_d/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=16.283 deg\n", - "rectifier o/p voltage=13359.3 V\n", - "dc link voltage=26.719 V\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.2, Page No 623" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_d=(200.0+200)*10**3\n", - "P=1000.0*10**6\n", - "\n", - "#Calculations\n", - "I_d=P/V_d\n", - " #each thristor conducts for 120deg for a periodicity of 360deg\n", - "a=0\n", - "V_d=200.0*10**3\n", - "V_ml=V_d*math.pi/(3*math.cos(math.radians(a)))\n", - "\n", - "#Results\n", - "print(\"rms current rating of thyristor=%.2f A\" %(I_d*math.sqrt(120/360)))\n", - "print(\"peak reverse voltage across each thyristor=%.2f kV\" %(V_ml/2/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms current rating of thyristor=0.00 A\n", - "peak reverse voltage across each thyristor=104.72 kV\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.3 Page No 627" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_m=230.0\n", - "V_s=230/math.sqrt(2)\n", - "pf=0.8\n", - "P=2000.0\n", - "\n", - "#Calculations\n", - "I_m=P/(V_s*pf)\n", - "I_Tr=I_m/math.sqrt(2)\n", - "I_TA=2*I_m/math.pi\n", - "fos=2 #factor of safety\n", - "PIV=V_m*math.sqrt(2)\n", - "I_Tr=I_m/(2)\n", - "I_TA=I_m/math.pi\n", - "\n", - "#Results\n", - "print(\"rms value of thyristor current=%.2f A\" %(fos*I_Tr))\n", - "print(\"avg value of thyristor current=%.3f A\" %(fos*I_TA))\n", - "print(\"voltage rating of thyristor=%.2f V\" %PIV)\n", - "print(\"rms value of diode current=%.3f A\" %(fos*I_Tr))\n", - "print(\"avg value of diode current=%.3f A\" %(fos*I_TA))\n", - "print(\"voltage rating of diode=%.2f V\" %PIV)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of thyristor current=15.37 A\n", - "avg value of thyristor current=9.786 A\n", - "voltage rating of thyristor=325.27 V\n", - "rms value of diode current=15.372 A\n", - "avg value of diode current=9.786 A\n", - "voltage rating of diode=325.27 V\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.4, Page No 629" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=200.0\n", - "I=10.0\n", - "\n", - "#Calculations\n", - "R_L=V/I \n", - "I_h=.005 #holding current\n", - "R2=V/I_h \n", - "t_c=20*10**-6\n", - "fos=2 #factor of safety\n", - "C=t_c*fos/(R_L*math.log(2)) \n", - "\n", - "#Results\n", - "print(\"value of load resistance=%.0f ohm\" %R_L)\n", - "print(\"value of R2=%.0f kilo-ohm\" %(R2/1000))\n", - "print(\"value of C=%.3f uF\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of load resistance=20 ohm\n", - "value of R2=40 kilo-ohm\n", - "value of C=2.885 uF\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.5 Page No 646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "u_r=10\n", - "f=10000.0 #Hz\n", - "p=4.0*10**-8 #ohm-m\n", - "\n", - "#Calculations\n", - "dl=(1/(2*math.pi))*math.sqrt(p*10**7/(u_r*f)) \n", - "l=0.12 #length of cylinder\n", - "t=20.0 #no of turns\n", - "I=100.0\n", - "H=t*I/l\n", - "P_s=2*math.pi*H**2*math.sqrt(u_r*f*p*10**-7) \n", - "d=.02 #diameter\n", - "P_v=4*H**2*p/(d*dl) \n", - "\n", - "#Results\n", - "print(\"depth of heat of penetration=%.5f mm\" %(dl*1000))\n", - "print(\"heat generated per unit cylinder surface area=%.3f W/m**2\" %P_s)\n", - "print(\"heat generated per unit cylinder volume=%.0f W/m**3\" %P_v)\n", - " #answer of P_v varies as given in book as value of d is not taken as in formulae. " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "depth of heat of penetration=0.31831 mm\n", - "heat generated per unit cylinder surface area=34906.585 W/m**2\n", - "heat generated per unit cylinder volume=6981317 W/m**3\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.6 Page No 646" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=3000.0\n", - "\n", - "#Calculations\n", - "t_qmin=30.0*10**-6\n", - "f_r=f/(1-2*t_qmin*f)\n", - "R=0.06\n", - "L=20.0*10**-6\n", - "C=1/(L*((2*math.pi*f_r)**2+(R/(2*L))**2)) \n", - "\n", - "#Results\n", - "print(\"required capacitor size=%.4f F\" %(C*10**6))\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "required capacitor size=94.2215 F\n" - ] - } - ], - "prompt_number": 6 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter12.ipynb b/_Power_Electronics/Chapter12.ipynb deleted file mode 100755 index f8605d69..00000000 --- a/_Power_Electronics/Chapter12.ipynb +++ /dev/null @@ -1,1997 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 12 : Electic Drives" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.1, Page No 658" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_e=15.0 #Nm\n", - "K_m=0.5 #V-s/rad\n", - "I_a=T_e/K_m\n", - "n_m=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*n_m/60\n", - "E_a=K_m*w_m\n", - "r_a=0.7\n", - "V_t=E_a+I_a*r_a\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=math.degrees(math.acos(2*math.pi*V_t/V_m-1))\n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "I_Tr=I_a*math.sqrt((180-a)/360) \n", - "print(\"rms value of thyristor current=%.3f A\" %I_Tr)\n", - "I_fdr=I_a*math.sqrt((180+a)/360) \n", - "print(\"rms value of freewheeling diode current=%.3f A\" %I_fdr)\n", - "pf=V_t*I_a/(V_s*I_Tr) \n", - "\n", - "#Results \n", - "print(\"input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=65.349 deg\n", - "rms value of thyristor current=16.930 A\n", - "rms value of freewheeling diode current=24.766 A\n", - "input power factor=0.5652\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.2, Page No 660" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "\n", - "#Calculations\n", - "th1=math.sin(math.radians(E/(math.sqrt(2)*V)))\n", - "I_o=(1/(2*math.pi*R))*(2*math.sqrt(2)*230*math.cos(math.radians(th1))-E*(math.pi-2*th1*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*(math.pi-2*th1*math.pi/180)+V**2*math.sin(math.radians(2*th1))-4*math.sqrt(2)*V*E*math.cos(math.radians(th1))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or)\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.3f W\" %P_r) \n", - "print(\"supply pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=3.5679 A\n", - "power supplied to the battery=535.18 W\n", - "power dissipated by the resistor=829.760 W\n", - "supply pf=0.583\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.3 Page No 661" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=250\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30.0\n", - "k=0.03 #Nm/A**2\n", - "n_m=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*n_m/60\n", - "r=.2 #r_a+r_s\n", - "V_t=V_m/math.pi*(1+math.cos(math.radians(a)))\n", - "I_a=V_t/(k*w_m+r) \n", - "print(\"motor armature current=%.2f A\" %I_a)\n", - "T_e=k*I_a**2 \n", - "print(\"motor torque=%.3f Nm\" %T_e)\n", - "I_sr=I_a*math.sqrt((180-a)/180)\n", - "pf=(V_t*I_a)/(V_s*I_sr) \n", - "\n", - "#Results\n", - "print(\"input power factor=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor armature current=57.82 A\n", - "motor torque=100.285 Nm\n", - "input power factor=0.92\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.4, Page No 663" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "V_f=2*V_m/math.pi\n", - "r_f=200.0\n", - "I_f=V_f/r_f\n", - "T_e=85.0\n", - "K_a=0.8\n", - "\n", - "#Calculations\n", - "I_a=T_e/(I_f*K_a) \n", - "print(\"rated armature current=%.2f A\" %I_a)\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "r_a=0.2\n", - "V_t=K_a*I_f*w_m+I_a*r_a\n", - "a=math.degrees(math.acos(V_t*math.pi/(2*V_m)))\n", - "print(\"firing angle delay=%.2f deg\" %a)\n", - "E_a=V_t\n", - "w_mo=E_a/(K_a*I_f)\n", - "N=60*w_mo/(2*math.pi)\n", - "reg=((N-n_m)/n_m)*100 \n", - "print(\"speed regulation at full load=%.2f\" %reg)\n", - "I_ar=I_a\n", - "pf=(V_t*I_a)/(V_s*I_ar) \n", - "print(\"input power factor of armature convertor=%.4f\" %pf)\n", - "I_fr=I_f\n", - "I_sr=math.sqrt(I_fr**2+I_ar**2)\n", - "VA=I_sr*V_s\n", - "P=V_t*I_a+V_f*I_f\n", - "\n", - "#Results\n", - "print(\"input power factor of drive=%.4f\" %(P/VA))\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rated armature current=59.01 A\n", - "firing angle delay=57.63 deg\n", - "speed regulation at full load=6.52\n", - "input power factor of armature convertor=0.4821\n", - "input power factor of drive=0.5093\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.5 Page No 664" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "V_f=2*V_m/math.pi\n", - "\n", - "#Calculations\n", - "a1=math.degrees(math.acos(V_t*math.pi/(2*V_m))) \n", - "print(\"delay angle of field converter=%.0f deg\" %a1)\n", - "r_f=200.0\n", - "I_f=V_f/r_f\n", - "T_e=85.0\n", - "K_a=0.8\n", - "I_a=T_e/(I_f*K_a)\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "r_a=0.1\n", - "I_a=50.0\n", - "V_t=-K_a*I_f*w_m+I_a*r_a\n", - "a=math.degrees(math.acos(V_t*math.pi/(2*V_m)))\n", - "\n", - "#Results\n", - "print(\"firing angle delay of armature converter=%.3f deg\" %a)\n", - "print(\"power fed back to ac supply=%.0f W\" %(-V_t*I_a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "delay angle of field converter=58 deg\n", - "firing angle delay of armature converter=119.260 deg\n", - "power fed back to ac supply=8801 W\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.6 Page No 665" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=220.0\n", - "n_m=1500.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=10.0\n", - "r_a=1.0\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "T=5.0\n", - "I_a=T/K_m\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30.0\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "print(\"motor speed=%.2f rpm\" %N)\n", - "a=45\n", - "n_m=1000\n", - "w_m=2*math.pi*n_m/60\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "I_a=(V_t-K_m*w_m)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"torque developed=%.3f Nm\" %T_e)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=1254.22 rpm\n", - "torque developed=8.586 Nm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.7, Page No 666" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=220.0\n", - "n_m=1000.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=60.0\n", - "r_a=.1\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "V_s=230\n", - "V_m=math.sqrt(2)*V_s\n", - "print(\"for 600rpm speed\")\n", - "n_m=600.0\n", - "w_m=2*math.pi*n_m/60\n", - "a=math.degrees(math.acos((K_m*w_m+I_a*r_a)*math.pi/(2*V_m))) \n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"for -500rpm speed\")\n", - "n_m=-500.0\n", - "w_m=2*math.pi*n_m/60\n", - "a=math.degrees(math.acos((K_m*w_m+I_a*r_a)*math.pi/(2*V_m)))\n", - "print(\"firing angle=%.2f deg\" %a)\n", - "I_a=I_a/2\n", - "a=150\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.3f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for 600rpm speed\n", - "firing angle=49.530 deg\n", - "for -500rpm speed\n", - "firing angle=119.19 deg\n", - "motor speed=-852.011 rpm\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.8 Page No 672" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.5\n", - "T_e=50.0\n", - "I_a=T_e/K_m\n", - "r_a=0.9\n", - "a=45.0\n", - "V_s=415.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_s\n", - "w_m=((3*V_ml*(1+math.cos(math.radians(a)))/(2*math.pi))-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.2f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=2854.42 rpm\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.9 Page No 672" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_t=600\n", - "n_m=1500.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=80.0\n", - "r_a=1.0\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "print(\"for firing angle=45deg and speed=1200rpm\")\n", - "a=45.0\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=(3*V_m*(1+math.cos(math.radians(a)))/(2*math.pi)-K_m*w_m)/r_a\n", - "I_sr=I_a*math.sqrt(2/3) \n", - "print(\"rms value of source current=%.3f A\" %I_sr)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_a*math.sqrt(1/3)))\n", - "print(\"avg value of thyristor current=%.2f A\" %I_a*(1/3))\n", - "pf=(3/(2*math.pi)*(1+math.cos(math.radians(a)))) \n", - "print(\"input power factor=%.3f\" %pf)\n", - "\n", - "print(\"for firing angle=90deg and speed=700rpm\")\n", - "a=90\n", - "n_m=700\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=(3*V_m*(1+math.cos(math.radians(a)))/(2*math.pi)-K_m*w_m)/r_a\n", - "I_sr=I_a*math.sqrt(90/180) \n", - "\n", - "\n", - "#Results\n", - "print(\"rms value of source current=%.3f A\" %I_sr)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_a*math.sqrt(90.0/360)))\n", - "print(\"avg value of thyristor current=%.3f A\" %I_a*(1/3))\n", - "pf=(math.sqrt(6)/(2*math.pi)*(1+math.cos(math.radians(a))))*math.sqrt(180/(180-a)) \n", - "print(\"input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=45deg and speed=1200rpm\n", - "rms value of source current=0.000 A\n", - "rms value of thyristor current=0.000 A\n", - "\n", - "input power factor=0.815\n", - "for firing angle=90deg and speed=700rpm\n", - "rms value of source current=0.000 A\n", - "rms value of thyristor current=195.558 A\n", - "\n", - "input power factor=0.5513\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.10 Page No 676" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30\n", - "V_t=3*V_m*math.cos(math.radians(a))/math.pi\n", - "I_a=21.0\n", - "r_a=.1\n", - "V_d=2.0\n", - "K_m=1.6\n", - "\n", - "#Calculations\n", - "w_m=(V_t-I_a*r_a-V_d)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "print(\"speed of motor=%.1f rpm\" %N)\n", - "\n", - "N=2000\n", - "w_m=2*math.pi*N/60\n", - "I_a=210\n", - "V_t=K_m*w_m+I_a*r_a+V_d\n", - "a=math.degrees(math.acos(V_t*math.pi/(3*V_m)))\n", - "print(\"firing angle=%.2f deg\" %a)\n", - "I_sr=I_a*math.sqrt(2.0/3.0)\n", - "pf=V_t*I_a/(math.sqrt(3)*V_s*I_sr) \n", - "print(\"supply power factor=%.3f\" %pf)\n", - "\n", - "I_a=21\n", - "w_m=(V_t-I_a*r_a-V_d)/K_m\n", - "n=w_m*60/(2*math.pi)\n", - "reg=(n-N)/N*100 \n", - "\n", - "#Results\n", - "print(\"speed regulation(percent)=%.2f\" %reg)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of motor=2767.6 rpm\n", - "firing angle=48.48 deg\n", - "supply power factor=0.633\n", - "speed regulation(percent)=5.64\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.11, Page No 677" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=230.0\n", - "V_l=V_t*math.pi/(3*math.sqrt(2))\n", - "V_ph=V_l/math.sqrt(3)\n", - "V_in=400 #per phase voltage input\n", - "\n", - "#Calculations\n", - "N1=1500.0\n", - "I_a1=20.0\n", - "r_a1=.6\n", - "E_a1=V_t-I_a1*r_a1\n", - "n1=1000.0\n", - "E_a2=E_a1/1500.0*1000.0\n", - "V_t1=E_a1+I_a1*r_a1\n", - "a1=math.degrees(math.acos(V_t1*math.pi/(3*math.sqrt(2.0)*V_l)))\n", - "I_a2=.5*I_a1\n", - "n2=-900.0\n", - "V_t2=n2*E_a2/N1+I_a2*r_a1\n", - "a2=math.degrees(math.acos(V_t2*math.pi/(3*math.sqrt(2)*V_l))) \n", - "\n", - "#Results\n", - "print(\"transformer phase turns ratio=%.3f\" %(V_in/V_ph))\n", - "print(\"for motor running at 1000rpm at rated torque\")\n", - "print(\"firing angle delay=%.2f deg\" %a1)\n", - "print(\"for motor running at -900rpm at half of rated torque\")\n", - "print(\"firing angle delay=%.3f deg\" %a2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transformer phase turns ratio=4.068\n", - "for motor running at 1000rpm at rated torque\n", - "firing angle delay=0.00 deg\n", - "for motor running at -900rpm at half of rated torque\n", - "firing angle delay=110.674 deg\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.12, Page No 678" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=400\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_f=3*V_ml/math.pi\n", - "R_f=300.0\n", - "I_f=V_f/R_f\n", - "T_e=60.0\n", - "k=1.1\n", - "\n", - "#Calculations\n", - "I_a=T_e/(k*I_f)\n", - "N1=1000.0\n", - "w_m1=2*math.pi*N1/60\n", - "r_a1=.3\n", - "V_t1=k*I_f*w_m1+I_a*r_a1\n", - "a1=math.degrees(math.acos(V_f*math.pi/(3*V_ml)))\n", - "N2=3000\n", - "w_m2=2*math.pi*N/60\n", - "a2=0\n", - "V_t2=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "I_f2=(V_t2-I_a*r_a)/(w_m2*k)\n", - "V_f2=I_f2*R_f\n", - "a2=math.degrees(math.acos(V_f2*math.pi/(3*V_ml)))\n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"firing angle=%.3f deg\" %a)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=48.477 deg\n", - "firing angle=48.477 deg\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.13, Page No 679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - " #after calculating\n", - " #t=w_m/6000-math.pi/360\n", - "\n", - "N=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "t=w_m/6000-math.pi/360 \n", - "\n", - "#Results\n", - "print(\"time reqd=%.2f s\" %t)\n", - " #printing mistake in the answer in book" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time reqd=0.01 s\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.14, Page No 679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=1.0 #supposition\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "I_s1=2*math.sqrt(2)/math.pi*I_a*math.sin(math.radians(a))\n", - "I_s3=2*math.sqrt(2)/(3*math.pi)*I_a*math.sin(math.radians(3*a))\n", - "I_s5=2*math.sqrt(2)/(5*math.pi)*I_a*math.sin(math.radians(5*a))\n", - "per3=I_s3/I_s1*100 \n", - "print(\"percent of 3rd harmonic current in fundamental=%.2f\" %per3)\n", - "per5=I_s5/I_s1*100 \n", - "\n", - "#Results\n", - "print(\"percent of 5th harmonic current in fundamental=%.2f\" %per5)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "percent of 3rd harmonic current in fundamental=0.00\n", - "percent of 5th harmonic current in fundamental=-20.00\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.15, Page No 680" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=60.0\n", - "I_TA=I_a/3 \n", - "\n", - "#Calculations\n", - "print(\"avg thyristor current=%.0f A\" %I_TA)\n", - "I_Tr=I_a/math.sqrt(3) \n", - "print(\"rms thyristor current=%.3f A\" %I_Tr)\n", - "V_s=400\n", - "V_m=math.sqrt(2)*V_s\n", - "I_sr=I_a*math.sqrt(2.0/3)\n", - "a=150\n", - "V_t=3*V_m*math.cos(math.radians(a))/math.pi\n", - "pf=V_t*I_a/(math.sqrt(3)*V_s*I_sr) \n", - "print(\"power factor of ac source=%.3f\" %pf)\n", - "\n", - "r_a=0.5\n", - "K_m=2.4\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"Speed of motor=%.2f rpm\" %N)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg thyristor current=20 A\n", - "rms thyristor current=34.641 A\n", - "power factor of ac source=-0.827\n", - "Speed of motor=-1980.76 rpm\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.16, Page No 685" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=300.0\n", - "V_s=600.0\n", - "a=0.6\n", - "V_t=a*V_s\n", - "P=V_t*I_a \n", - "\n", - "#Calculations\n", - "print(\"input power from source=%.0f kW\" %(P/1000))\n", - "R_eq=V_s/(a*I_a) \n", - "print(\"equivalent input resistance=%.3f ohm\" %R_eq)\n", - "k=.004\n", - "R=.04+.06\n", - "w_m=(a*V_s-I_a*R)/(k*I_a)\n", - "N=w_m*60/(2*math.pi) \n", - "print(\"motor speed=%.1f rpm\" %N)\n", - "T_e=k*I_a**2 \n", - "\n", - "#Results\n", - "print(\"motor torque=%.0f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "input power from source=108 kW\n", - "equivalent input resistance=3.333 ohm\n", - "motor speed=2626.1 rpm\n", - "motor torque=360 Nm\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.17, Page No 686" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_on=10.0\n", - "T_off=15.0\n", - "\n", - "#Calculations\n", - "a=T_on/(T_on+T_off)\n", - "V_s=230.0\n", - "V_t=a*V_s\n", - "r_a=3\n", - "K_m=.5\n", - "N=1500\n", - "w_m=2*math.pi*N/60\n", - "I_a=(V_t-K_m*w_m)/r_a \n", - "\n", - "#Results\n", - "print(\"motor load current=%.3f A\" %I_a)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor load current=4.487 A\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.18, Page No 686" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "w_m=0 \n", - "print(\"lower limit of speed control=%.0f rpm\" %w_m)\n", - "I_a=25.0\n", - "r_a=.2\n", - "V_s=220\n", - "K_m=0.08\n", - "\n", - "#Calculations\n", - "a=(K_m*w_m+I_a*r_a)/V_s \n", - "print(\"lower limit of duty cycle=%.3f\" %a)\n", - "a=1 \n", - "print(\"upper limit of duty cycle=%.0f\" %a)\n", - "w_m=(a*V_s-I_a*r_a)/K_m \n", - "\n", - "#Results\n", - "print(\"upper limit of speed control=%.1f rpm\" %w_m)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "lower limit of speed control=0 rpm\n", - "lower limit of duty cycle=0.023\n", - "upper limit of duty cycle=1\n", - "upper limit of speed control=2687.5 rpm\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.21, Page No 691" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.6\n", - "V_s=400.0\n", - "V_t=(1-a)*V_s\n", - "I_a=300.0\n", - "P=V_t*I_a \n", - "\n", - "#Calculations \n", - "print(\"power returned=%.0f kW\" %(P/1000))\n", - "r_a=.2\n", - "K_m=1.2\n", - "R_eq=(1-a)*V_s/I_a+r_a \n", - "print(\"equivalent load resistance=%.4f ohm\" %R_eq)\n", - "w_mn=I_a*r_a/K_m\n", - "N=w_mn*60/(2*math.pi) \n", - "print(\"min braking speed=%.2f rpm\" %N)\n", - "w_mx=(V_s+I_a*r_a)/K_m\n", - "N=w_mx*60/(2*math.pi) \n", - "print(\"max braking speed=%.1f rpm\" %N)\n", - "w_m=(V_t+I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"max braking speed=%.1f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power returned=48 kW\n", - "equivalent load resistance=0.7333 ohm\n", - "min braking speed=477.46 rpm\n", - "max braking speed=3660.6 rpm\n", - "max braking speed=1750.7 rpm\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.22, Page No 699" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "N=1500.0\n", - "\n", - "#Calculations\n", - "print(\"when speed=1455rpm\")\n", - "n=1455.0\n", - "s1=(N-n)/N\n", - "r=math.sqrt(1/3)*(2/3)/(math.sqrt(s1)*(1-s1)) \n", - "print(\"I_2mx/I_2r=%.3f\" %r)\n", - "print(\"when speed=1350rpm\")\n", - "n=1350\n", - "s1=(N-n)/N\n", - "r=math.sqrt(1/3)*(2/3)/(math.sqrt(s1)*(1-s1)) \n", - "\n", - "#Results\n", - "print(\"I_2mx/I_2r=%.3f\" %r)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when speed=1455rpm\n", - "I_2mx/I_2r=0.000\n", - "when speed=1350rpm\n", - "I_2mx/I_2r=0.000\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.24, Page No 705" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V1=400.0\n", - "r1=0.6\n", - "r2=0.4\n", - "s=1.0\n", - "x1=1.6\n", - "x2=1.6\n", - "\n", - "#Calculations\n", - "print(\"at starting in normal conditions\")\n", - "I_n=V1/math.sqrt((r1+r2/s)**2+(x1+x2)**2) \n", - "print(\"current=%.2f A\" %I_n)\n", - "pf=(r1+r2)/math.sqrt((r1+r2/s)**2+(x1+x2)**2) \n", - "print(\"pf=%.4f\" %pf)\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_n**2*(r2/s) \n", - "print(\"\\nTorque developed=%.2f Nm\" %T_en)\n", - "print(\"motor is operated with DOL starting\")\n", - "I_d=V1/2/math.sqrt((r1+r2/s)**2+((x1+x2)/2)**2) \n", - "print(\"current=%.0f A\" %I_d)\n", - "pf=(r1+r2)/math.sqrt((r1+r2/s)**2+((x1+x2)/2)**2) \n", - "print(\"pf=%.2f\" %pf)\n", - "f1=25\n", - "w_s=4*math.pi*f1/4\n", - "T_ed=(3/w_s)*I_d**2*(r2/s) \n", - "print(\"Torque developed=%.3f Nm\" %T_ed)\n", - "print(\"at max torque conditions\")\n", - "s_mn=r2/math.sqrt((r1)**2+((x1+x2))**2)\n", - "I_n=V1/math.sqrt((r1+r2/s_mn)**2+(x1+x2)**2) \n", - "print(\"current=%.3f A\" %I_n)\n", - "pf=(r1+r2/s_mn)/math.sqrt((r1+r2/s_mn)**2+(x1+x2)**2) \n", - "print(\"pf=%.4f\" %pf)\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_n**2*(r2/s_mn) \n", - "print(\"Torque developed=%.2f Nm\" %T_en)\n", - "print(\"motor is operated with DOL starting\")\n", - "s_mn=r2/math.sqrt((r1)**2+((x1+x2)/2)**2)\n", - "I_d=V1/2/math.sqrt((r1+r2/s_mn)**2+((x1+x2)/2)**2) \n", - "print(\"current=%.3f A\" %I_d)\n", - "pf=(r1+r2/s_mn)/math.sqrt((r1+r2/s_mn)**2+((x1+x2)/2)**2) \n", - "print(\"\\npf=%.3f\" %pf)\n", - "f1=25\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_d**2*(r2/s_mn) \n", - "\n", - "\n", - "#Results \n", - "print(\"Torque developed=%.3f Nm\" %T_en)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "at starting in normal conditions\n", - "current=119.31 A\n", - "pf=0.2983\n", - "\n", - "Torque developed=108.75 Nm\n", - "motor is operated with DOL starting\n", - "current=106 A\n", - "pf=0.53\n", - "Torque developed=171.673 Nm\n", - "at max torque conditions\n", - "current=79.829 A\n", - "pf=0.7695\n", - "Torque developed=396.26 Nm\n", - "motor is operated with DOL starting\n", - "current=71.199 A\n", - "\n", - "pf=0.822\n", - "Torque developed=330.883 Nm\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.25, Page No 709" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "x1=1.0\n", - "X_m=50.0\n", - "X_e=x1*X_m/(x1+X_m)\n", - "V=231.0\n", - "V_e=V*X_m/(x1+X_m)\n", - "x2=1.0\n", - "r2=.4\n", - "r1=0\n", - "\n", - "#Calculations\n", - "s_m=r2/(x2+X_e) \n", - "print(\"slip at max torque=%.2f\" %s_m)\n", - "s_mT=r2/(x2+X_m) \n", - "print(\"slip at max torque=%.5f\" %s_mT)\n", - "f1=50.0\n", - "w_s=4*math.pi*f1/4\n", - "print(\"for constant voltage input\")\n", - "T_est=(3/w_s)*(V_e/math.sqrt(r2**2+(x2+X_e)**2))**2*(r2) \n", - "print(\"starting torque=%.3f Nm\" %T_est)\n", - "T_em=(3/w_s)*V_e**2/(2*(x2+X_e)) \n", - "print(\"maximum torque developed=%.2f Nm\" %T_em)\n", - "print(\"for constant current input\")\n", - "I1=28\n", - "T_est=(3/w_s)*(I1*X_m)**2/(r2**2+(x2+X_m)**2)*r2 \n", - "print(\"starting torque=%.3f Nm\" %T_est)\n", - "T_em=(3/w_s)*(I1*X_m)**2/(2*(x2+X_m)) \n", - "print(\"maximum torque developed=%.3f Nm\" %T_em)\n", - "s=s_mT\n", - "i=1\n", - "I_m=I1*(r2/s+i*x2)/(r2/s+i*(x2+X_m))\n", - "I_m=math.fabs(I_m)\n", - "V1=math.sqrt(3)*I_m*X_m \n", - "\n", - "#Results\n", - "print(\"supply voltage reqd=%.1f V\" %V1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "slip at max torque=0.20\n", - "slip at max torque=0.00784\n", - "for constant voltage input\n", - "starting torque=95.988 Nm\n", - "maximum torque developed=247.31 Nm\n", - "for constant current input\n", - "starting torque=5.756 Nm\n", - "maximum torque developed=366.993 Nm\n", - "supply voltage reqd=1236.2 V\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.27, Page No 718" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=420.0\n", - "V1=V/math.sqrt(3)\n", - "T_e=450.0\n", - "N=1440.0\n", - "n=1000.0\n", - "T_L=T_e*(n/N)**2\n", - "n1=1500.0\n", - "\n", - "#Calculations\n", - "w_s=2*math.pi*n1/60\n", - "w_m=2*math.pi*n/60\n", - "a=.8\n", - "I_d=T_L*w_s/(2.339*a*V1)\n", - "k=0\n", - "R=(1-w_m/w_s)*(2.339*a*V1)/(I_d*(1-k)) \n", - "print(\"value of chopper resistance=%.4f ohm\" %R)\n", - "n=1320.0\n", - "T_L=T_e*(n/N)**2\n", - "I_d=T_L*w_s/(2.339*a*V1) \n", - "print(\"Inductor current=%.3f A\" %I_d)\n", - "w_m=2*math.pi*n/60\n", - "k=1-((1-w_m/w_s)*(2.339*a*V1)/(I_d*R)) \n", - "print(\"value of duty cycle=%.4f\" %k)\n", - "s=(n1-n)/n1\n", - "V_d=2.339*s*a*V1 \n", - "print(\"Rectifed o/p voltage=%.3f V\" %V_d)\n", - "P=V_d*I_d\n", - "I2=math.sqrt(2/3)*I_d\n", - "r2=0.02\n", - "Pr=3*I2**2*r2\n", - "I1=a*I2\n", - "r1=0.015\n", - "Ps=3*I1**2*r1\n", - "Po=T_L*w_m\n", - "Pi=Po+Ps+Pr+P\n", - "eff=Po/Pi*100 \n", - "\n", - "#Results\n", - "print(\"Efficiency(in percent)=%.2f\" %eff)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of chopper resistance=2.0132 ohm\n", - "Inductor current=130.902 A\n", - "value of duty cycle=0.7934\n", - "Rectifed o/p voltage=54.449 V\n", - "Efficiency(in percent)=88.00\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.28, Page No 720" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "V_ph=V/math.sqrt(3)\n", - "N_s=1000.0\n", - "N=800.0\n", - "a=.7\n", - "I_d=110\n", - "R=2.0\n", - "\n", - "#Calculations\n", - "k=1-((1-N/N_s)*(2.339*a*V_ph)/(I_d*R)) \n", - "print(\"value of duty cycle=%.3f\" %k)\n", - "P=I_d**2*R*(1-k)\n", - "I1=a*I_d*math.sqrt(2/3)\n", - "r1=0.1\n", - "r2=0.08\n", - "Pr=3*I1**2*(r1+r2)\n", - "P_o=20000\n", - "P_i=P_o+Pr+P\n", - "eff=P_o/P_i*100 \n", - "print(\"Efficiency=%.2f\" %eff)\n", - "I11=math.sqrt(6)/math.pi*a*I_d\n", - "th=43\n", - "P_ip=math.sqrt(3)*V*I11*math.cos(math.radians(th))\n", - "pf=P_ip/(math.sqrt(3)*V*I11) \n", - "\n", - "#Results\n", - "print(\"Input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of duty cycle=0.656\n", - "Efficiency=70.62\n", - "Input power factor=0.7314\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.29, Page No 724" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=420.0\n", - "V1=V/math.sqrt(3)\n", - "N=1000.0\n", - "w_m=2*math.pi*N/60\n", - "N_s=1500.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "a=0.8\n", - "V_d=2.339*a*s*V1 \n", - "print(\"rectified voltage=%.2f V\" %V_d)\n", - "T=450.0\n", - "N1=1200.0\n", - "T_L=T*(N/N1)**2\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "I_d=w_s*T_L/(2.339*a*V1) \n", - "print(\"inductor current=%.2f A\" %I_d)\n", - "a_T=-.4\n", - "a1=math.degrees(math.acos(s*a/a_T))\n", - "print(\"delay angle of inverter=%.2f deg\" %a1)\n", - "\n", - "P_s=V_d*I_d\n", - "P_o=T_L*w_m\n", - "R_d=0.01\n", - "P_i=I_d**2*R_d\n", - "I2=math.sqrt(2/3)*I_d\n", - "r2=0.02\n", - "r1=0.015\n", - "P_rol=3*I2**2*r2\n", - "I1=a*I2\n", - "P_sol=3*I1**2*r1\n", - "P_i=P_o+P_rol+P_sol+P_i\n", - "eff=P_o/P_i*100 \n", - "print(\"\\nefficiency=%.2f\" %eff)\n", - "w_m=w_s*(1+(-a_T/a)*math.cos(math.radians(a1))-w_s*R_d*T_L/(2.339*a*V1)**2)\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results \n", - "print(\"motor speed=%.1f rpm\" %N)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectified voltage=151.25 V\n", - "inductor current=108.18 A\n", - "delay angle of inverter=131.81 deg\n", - "\n", - "efficiency=99.64\n", - "motor speed=996.4 rpm\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.30, Page No 726" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V/math.sqrt(3)\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V_dd=0.7\n", - "V_dt=1.5\n", - "V_d=3*math.sqrt(6)*s*E2/math.pi-2*V_dd\n", - "V1=415.0\n", - "a=math.degrees(math.acos((3*math.sqrt(2)*E2/math.pi)**-1*(-V_d+2*V_dt)))\n", - "\n", - "#Results\n", - "print(\"firing angle advance=%.2f deg\" %(180-a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle advance=70.22 deg\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.31, Page No 726" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V/math.sqrt(3)\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V_dd=.7\n", - "V_dt=1.5\n", - "a=0\n", - "u=18 #overlap angle in case of rectifier\n", - "V_d=3*math.sqrt(6)*s*E2*(math.cos(math.radians(a))+math.cos(math.radians(a+u)))/(2*math.pi)-2*V_dd\n", - "V1=415\n", - "V_ml=math.sqrt(2)*V1\n", - "u=4 #overlap anglein the inverter\n", - " #V_dc=-(3*V_ml*(math.cos(math.radians(a))+math.cos(math.radians(a+u)))/(2*math.pi)-2*V_dt)\n", - " #V_dc=V_d\n", - " #after solving % (1+math.cos(math.radians(u)))*math.cos(math.radians(a))-math.sin(math.radians(u))*math.sin(math.radians(a))=-.6425\n", - "a=math.degrees(math.acos(-.6425/(math.sqrt((1+math.cos(math.radians(u)))**2+math.sin(math.radians(u))**2))))-math.degrees(math.asin(math.sin(math.radians(a))/(1+math.cos(math.radians(u)))))\n", - "\n", - "#Results\n", - "print(\"firing angle advance=%.2f deg\" %(180-a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle advance=71.25 deg\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.32, Page No 727" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V1=415.0\n", - "a_T=s*E2/V1 \n", - "\n", - "#Results\n", - "print(\"voltage ratio of the transformer=%.2f\" %a_T)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "voltage ratio of the transformer=0.34\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.33, Page No 733" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=6.0\n", - "N_s=600.0\n", - "f1=P*N_s/120.0\n", - "V=400.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "V_t=f1*V/f \n", - "print(\"supply freq=%.0f Hz\" %V_t)\n", - "T=340.0\n", - "N=1000.0\n", - "T_L=T*(N_s/N)**2\n", - "w_s=2*math.pi*N_s/60\n", - "P=T_L*w_s\n", - "I_a=P/(math.sqrt(3)*V_t) \n", - "print(\"armature current=%.2f A\" %I_a)\n", - "Z_s=2\n", - "X_s=f1/f*math.fabs(Z_s)\n", - "V_t=V_t/math.sqrt(3)\n", - "Ef=math.sqrt(V_t**2+(I_a*X_s)**2)\n", - "print(\"excitation voltage=%.2f V\" %(math.sqrt(3)*Ef))\n", - "dl=math.degrees(math.atan(I_a*X_s/V_t))\n", - "print(\"load angle=%.2f deg\" %dl)\n", - "T_em=(3/w_s)*(Ef*V_t/X_s) \n", - "\n", - "#Results\n", - "print(\"pull out torque=%.2f Nm\" %T_em)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "supply freq=240 Hz\n", - "armature current=18.50 A\n", - "excitation voltage=243.06 V\n", - "load angle=9.10 deg\n", - "pull out torque=773.69 Nm\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.34, Page No 736" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=4.0\n", - "f=50.0\n", - "w_s=4*math.pi*f/P\n", - "X_d=8.0\n", - "X_q=2.0\n", - "T_e=80.0\n", - "V=400.0\n", - "\n", - "#Calculations\n", - "V_t=V/math.sqrt(3)\n", - "dl=(1/2)*math.degrees(math.asin(T_e*w_s/((3/2)*(V_t)**2*(1/X_q-1/X_d)))) \n", - "print(\"load angle=%.3f deg\" %dl)\n", - "I_d=V_t*math.cos(math.radians(dl))/X_d\n", - "I_q=V_t*math.sin(math.radians(dl))/X_q\n", - "I_a=math.sqrt(I_d**2+I_q**2) \n", - "print(\"armature current=%.2f A\" %I_a)\n", - "pf=T_e*w_s/(math.sqrt(3)*V*I_a) \n", - "\n", - "#Results\n", - "print(\"input power factor=%.4f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "load angle=0.000 deg\n", - "armature current=28.87 A\n", - "input power factor=0.6283\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.35, Page No 737" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_e=3.0\n", - "K_m=1.2\n", - "I_a=T_e/K_m\n", - "r_a=2.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "E_a=(0.263*math.sqrt(2)*V-I_a*r_a)/(1-55/180)\n", - "w_m=E_a/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.2f rpm\" %N)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=640.96 rpm\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.36, Page No 738" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=1360.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - " #after calculations V_t % calculated\n", - "V_t=163.45\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.4f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=5.2578 Nm\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.37, Page No 740" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=2100.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - " #after calculations V_t % calculated\n", - "V_t=227.66\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.2f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=1.94 Nm\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.38, Page No 742" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=840.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=75.0\n", - "V_t=math.sqrt(2)*V/math.pi*(1+math.cos(math.radians(a)))\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.4f Nm\" %T_e)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=10.5922 Nm\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.39, Page No 743" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=1400.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=60.0\n", - "a1=212\n", - "V_t=math.sqrt(2)*V/math.pi*(math.cos(math.radians(a))-math.cos(math.radians(a1)))+E_a*(180+a-a1)/180\n", - "r_a=3\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.3f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=5.257 Nm\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.40, Page No 745" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=600.0\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "V_t=2*math.sqrt(2)*V/math.pi*(math.cos(math.radians(a)))\n", - "r_a=3\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "\n", - "#Results\n", - "print(\"motor torque=%.3f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=13.568 Nm\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.41, Page No 745" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "r1=.6\n", - "r2=.4\n", - "s=0.04\n", - "x1=1.6\n", - "x2=1.6\n", - "Z=(r1+r2/s)+(x1+x2)\n", - "V=400.0\n", - "I1=V/Z \n", - "print(\"source current=%.3f A \" %math.degrees(math.atan(I1.imag/I1.real)))\n", - "print(\"and with %.1f deg phase\" %math.fabs(I1))\n", - "I2=V/Z\n", - "N=1500\n", - "w_s=2*math.pi*N/60\n", - "T_e=(3/w_s)*abs(I2)**2*r2/s \n", - "print(\"motor torque=%.2f Nm\" %T_e)\n", - "N_r=N*(1-s)\n", - "\n", - "f=45\n", - "N_s1=120*f/4\n", - "w_s=2*math.pi*N_s1/60\n", - "s1=(N_s1-N_r)/N_s1\n", - "Z=(r1+r2/s1)+(x1+x2)*f/50.0\n", - "V=360\n", - "I1=V/Z \n", - "print(\"source current=%.3f A \" %math.degrees(math.atan(I1.imag/I1.real)))\n", - "print(\"and with %.1f deg phase\" %math.fabs(I1))\n", - "I2=V/Z\n", - "T_e=(3/w_s)*abs(I2)**2*r2/s1 \n", - "print(\"motor torque=%.2f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "source current=0.000 A \n", - "and with 29.0 deg phase\n", - "motor torque=160.46 Nm\n", - "source current=-0.000 A \n", - "and with 142.9 deg phase\n", - "motor torque=-2598.45 Nm\n" - ] - } - ], - "prompt_number": 37 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter12_1.ipynb b/_Power_Electronics/Chapter12_1.ipynb deleted file mode 100755 index f8605d69..00000000 --- a/_Power_Electronics/Chapter12_1.ipynb +++ /dev/null @@ -1,1997 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 12 : Electic Drives" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.1, Page No 658" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_e=15.0 #Nm\n", - "K_m=0.5 #V-s/rad\n", - "I_a=T_e/K_m\n", - "n_m=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*n_m/60\n", - "E_a=K_m*w_m\n", - "r_a=0.7\n", - "V_t=E_a+I_a*r_a\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=math.degrees(math.acos(2*math.pi*V_t/V_m-1))\n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "I_Tr=I_a*math.sqrt((180-a)/360) \n", - "print(\"rms value of thyristor current=%.3f A\" %I_Tr)\n", - "I_fdr=I_a*math.sqrt((180+a)/360) \n", - "print(\"rms value of freewheeling diode current=%.3f A\" %I_fdr)\n", - "pf=V_t*I_a/(V_s*I_Tr) \n", - "\n", - "#Results \n", - "print(\"input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=65.349 deg\n", - "rms value of thyristor current=16.930 A\n", - "rms value of freewheeling diode current=24.766 A\n", - "input power factor=0.5652\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.2, Page No 660" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "\n", - "#Calculations\n", - "th1=math.sin(math.radians(E/(math.sqrt(2)*V)))\n", - "I_o=(1/(2*math.pi*R))*(2*math.sqrt(2)*230*math.cos(math.radians(th1))-E*(math.pi-2*th1*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*(math.pi-2*th1*math.pi/180)+V**2*math.sin(math.radians(2*th1))-4*math.sqrt(2)*V*E*math.cos(math.radians(th1))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or)\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.3f W\" %P_r) \n", - "print(\"supply pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=3.5679 A\n", - "power supplied to the battery=535.18 W\n", - "power dissipated by the resistor=829.760 W\n", - "supply pf=0.583\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.3 Page No 661" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=250\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30.0\n", - "k=0.03 #Nm/A**2\n", - "n_m=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*n_m/60\n", - "r=.2 #r_a+r_s\n", - "V_t=V_m/math.pi*(1+math.cos(math.radians(a)))\n", - "I_a=V_t/(k*w_m+r) \n", - "print(\"motor armature current=%.2f A\" %I_a)\n", - "T_e=k*I_a**2 \n", - "print(\"motor torque=%.3f Nm\" %T_e)\n", - "I_sr=I_a*math.sqrt((180-a)/180)\n", - "pf=(V_t*I_a)/(V_s*I_sr) \n", - "\n", - "#Results\n", - "print(\"input power factor=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor armature current=57.82 A\n", - "motor torque=100.285 Nm\n", - "input power factor=0.92\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.4, Page No 663" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "V_f=2*V_m/math.pi\n", - "r_f=200.0\n", - "I_f=V_f/r_f\n", - "T_e=85.0\n", - "K_a=0.8\n", - "\n", - "#Calculations\n", - "I_a=T_e/(I_f*K_a) \n", - "print(\"rated armature current=%.2f A\" %I_a)\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "r_a=0.2\n", - "V_t=K_a*I_f*w_m+I_a*r_a\n", - "a=math.degrees(math.acos(V_t*math.pi/(2*V_m)))\n", - "print(\"firing angle delay=%.2f deg\" %a)\n", - "E_a=V_t\n", - "w_mo=E_a/(K_a*I_f)\n", - "N=60*w_mo/(2*math.pi)\n", - "reg=((N-n_m)/n_m)*100 \n", - "print(\"speed regulation at full load=%.2f\" %reg)\n", - "I_ar=I_a\n", - "pf=(V_t*I_a)/(V_s*I_ar) \n", - "print(\"input power factor of armature convertor=%.4f\" %pf)\n", - "I_fr=I_f\n", - "I_sr=math.sqrt(I_fr**2+I_ar**2)\n", - "VA=I_sr*V_s\n", - "P=V_t*I_a+V_f*I_f\n", - "\n", - "#Results\n", - "print(\"input power factor of drive=%.4f\" %(P/VA))\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rated armature current=59.01 A\n", - "firing angle delay=57.63 deg\n", - "speed regulation at full load=6.52\n", - "input power factor of armature convertor=0.4821\n", - "input power factor of drive=0.5093\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.5 Page No 664" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "V_f=2*V_m/math.pi\n", - "\n", - "#Calculations\n", - "a1=math.degrees(math.acos(V_t*math.pi/(2*V_m))) \n", - "print(\"delay angle of field converter=%.0f deg\" %a1)\n", - "r_f=200.0\n", - "I_f=V_f/r_f\n", - "T_e=85.0\n", - "K_a=0.8\n", - "I_a=T_e/(I_f*K_a)\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "r_a=0.1\n", - "I_a=50.0\n", - "V_t=-K_a*I_f*w_m+I_a*r_a\n", - "a=math.degrees(math.acos(V_t*math.pi/(2*V_m)))\n", - "\n", - "#Results\n", - "print(\"firing angle delay of armature converter=%.3f deg\" %a)\n", - "print(\"power fed back to ac supply=%.0f W\" %(-V_t*I_a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "delay angle of field converter=58 deg\n", - "firing angle delay of armature converter=119.260 deg\n", - "power fed back to ac supply=8801 W\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.6 Page No 665" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=220.0\n", - "n_m=1500.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=10.0\n", - "r_a=1.0\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "T=5.0\n", - "I_a=T/K_m\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30.0\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "print(\"motor speed=%.2f rpm\" %N)\n", - "a=45\n", - "n_m=1000\n", - "w_m=2*math.pi*n_m/60\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "I_a=(V_t-K_m*w_m)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"torque developed=%.3f Nm\" %T_e)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=1254.22 rpm\n", - "torque developed=8.586 Nm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.7, Page No 666" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=220.0\n", - "n_m=1000.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=60.0\n", - "r_a=.1\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "V_s=230\n", - "V_m=math.sqrt(2)*V_s\n", - "print(\"for 600rpm speed\")\n", - "n_m=600.0\n", - "w_m=2*math.pi*n_m/60\n", - "a=math.degrees(math.acos((K_m*w_m+I_a*r_a)*math.pi/(2*V_m))) \n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"for -500rpm speed\")\n", - "n_m=-500.0\n", - "w_m=2*math.pi*n_m/60\n", - "a=math.degrees(math.acos((K_m*w_m+I_a*r_a)*math.pi/(2*V_m)))\n", - "print(\"firing angle=%.2f deg\" %a)\n", - "I_a=I_a/2\n", - "a=150\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.3f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for 600rpm speed\n", - "firing angle=49.530 deg\n", - "for -500rpm speed\n", - "firing angle=119.19 deg\n", - "motor speed=-852.011 rpm\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.8 Page No 672" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.5\n", - "T_e=50.0\n", - "I_a=T_e/K_m\n", - "r_a=0.9\n", - "a=45.0\n", - "V_s=415.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_s\n", - "w_m=((3*V_ml*(1+math.cos(math.radians(a)))/(2*math.pi))-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.2f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=2854.42 rpm\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.9 Page No 672" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_t=600\n", - "n_m=1500.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=80.0\n", - "r_a=1.0\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "print(\"for firing angle=45deg and speed=1200rpm\")\n", - "a=45.0\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=(3*V_m*(1+math.cos(math.radians(a)))/(2*math.pi)-K_m*w_m)/r_a\n", - "I_sr=I_a*math.sqrt(2/3) \n", - "print(\"rms value of source current=%.3f A\" %I_sr)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_a*math.sqrt(1/3)))\n", - "print(\"avg value of thyristor current=%.2f A\" %I_a*(1/3))\n", - "pf=(3/(2*math.pi)*(1+math.cos(math.radians(a)))) \n", - "print(\"input power factor=%.3f\" %pf)\n", - "\n", - "print(\"for firing angle=90deg and speed=700rpm\")\n", - "a=90\n", - "n_m=700\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=(3*V_m*(1+math.cos(math.radians(a)))/(2*math.pi)-K_m*w_m)/r_a\n", - "I_sr=I_a*math.sqrt(90/180) \n", - "\n", - "\n", - "#Results\n", - "print(\"rms value of source current=%.3f A\" %I_sr)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_a*math.sqrt(90.0/360)))\n", - "print(\"avg value of thyristor current=%.3f A\" %I_a*(1/3))\n", - "pf=(math.sqrt(6)/(2*math.pi)*(1+math.cos(math.radians(a))))*math.sqrt(180/(180-a)) \n", - "print(\"input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=45deg and speed=1200rpm\n", - "rms value of source current=0.000 A\n", - "rms value of thyristor current=0.000 A\n", - "\n", - "input power factor=0.815\n", - "for firing angle=90deg and speed=700rpm\n", - "rms value of source current=0.000 A\n", - "rms value of thyristor current=195.558 A\n", - "\n", - "input power factor=0.5513\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.10 Page No 676" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30\n", - "V_t=3*V_m*math.cos(math.radians(a))/math.pi\n", - "I_a=21.0\n", - "r_a=.1\n", - "V_d=2.0\n", - "K_m=1.6\n", - "\n", - "#Calculations\n", - "w_m=(V_t-I_a*r_a-V_d)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "print(\"speed of motor=%.1f rpm\" %N)\n", - "\n", - "N=2000\n", - "w_m=2*math.pi*N/60\n", - "I_a=210\n", - "V_t=K_m*w_m+I_a*r_a+V_d\n", - "a=math.degrees(math.acos(V_t*math.pi/(3*V_m)))\n", - "print(\"firing angle=%.2f deg\" %a)\n", - "I_sr=I_a*math.sqrt(2.0/3.0)\n", - "pf=V_t*I_a/(math.sqrt(3)*V_s*I_sr) \n", - "print(\"supply power factor=%.3f\" %pf)\n", - "\n", - "I_a=21\n", - "w_m=(V_t-I_a*r_a-V_d)/K_m\n", - "n=w_m*60/(2*math.pi)\n", - "reg=(n-N)/N*100 \n", - "\n", - "#Results\n", - "print(\"speed regulation(percent)=%.2f\" %reg)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of motor=2767.6 rpm\n", - "firing angle=48.48 deg\n", - "supply power factor=0.633\n", - "speed regulation(percent)=5.64\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.11, Page No 677" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=230.0\n", - "V_l=V_t*math.pi/(3*math.sqrt(2))\n", - "V_ph=V_l/math.sqrt(3)\n", - "V_in=400 #per phase voltage input\n", - "\n", - "#Calculations\n", - "N1=1500.0\n", - "I_a1=20.0\n", - "r_a1=.6\n", - "E_a1=V_t-I_a1*r_a1\n", - "n1=1000.0\n", - "E_a2=E_a1/1500.0*1000.0\n", - "V_t1=E_a1+I_a1*r_a1\n", - "a1=math.degrees(math.acos(V_t1*math.pi/(3*math.sqrt(2.0)*V_l)))\n", - "I_a2=.5*I_a1\n", - "n2=-900.0\n", - "V_t2=n2*E_a2/N1+I_a2*r_a1\n", - "a2=math.degrees(math.acos(V_t2*math.pi/(3*math.sqrt(2)*V_l))) \n", - "\n", - "#Results\n", - "print(\"transformer phase turns ratio=%.3f\" %(V_in/V_ph))\n", - "print(\"for motor running at 1000rpm at rated torque\")\n", - "print(\"firing angle delay=%.2f deg\" %a1)\n", - "print(\"for motor running at -900rpm at half of rated torque\")\n", - "print(\"firing angle delay=%.3f deg\" %a2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transformer phase turns ratio=4.068\n", - "for motor running at 1000rpm at rated torque\n", - "firing angle delay=0.00 deg\n", - "for motor running at -900rpm at half of rated torque\n", - "firing angle delay=110.674 deg\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.12, Page No 678" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=400\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_f=3*V_ml/math.pi\n", - "R_f=300.0\n", - "I_f=V_f/R_f\n", - "T_e=60.0\n", - "k=1.1\n", - "\n", - "#Calculations\n", - "I_a=T_e/(k*I_f)\n", - "N1=1000.0\n", - "w_m1=2*math.pi*N1/60\n", - "r_a1=.3\n", - "V_t1=k*I_f*w_m1+I_a*r_a1\n", - "a1=math.degrees(math.acos(V_f*math.pi/(3*V_ml)))\n", - "N2=3000\n", - "w_m2=2*math.pi*N/60\n", - "a2=0\n", - "V_t2=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "I_f2=(V_t2-I_a*r_a)/(w_m2*k)\n", - "V_f2=I_f2*R_f\n", - "a2=math.degrees(math.acos(V_f2*math.pi/(3*V_ml)))\n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"firing angle=%.3f deg\" %a)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=48.477 deg\n", - "firing angle=48.477 deg\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.13, Page No 679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - " #after calculating\n", - " #t=w_m/6000-math.pi/360\n", - "\n", - "N=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "t=w_m/6000-math.pi/360 \n", - "\n", - "#Results\n", - "print(\"time reqd=%.2f s\" %t)\n", - " #printing mistake in the answer in book" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time reqd=0.01 s\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.14, Page No 679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=1.0 #supposition\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "I_s1=2*math.sqrt(2)/math.pi*I_a*math.sin(math.radians(a))\n", - "I_s3=2*math.sqrt(2)/(3*math.pi)*I_a*math.sin(math.radians(3*a))\n", - "I_s5=2*math.sqrt(2)/(5*math.pi)*I_a*math.sin(math.radians(5*a))\n", - "per3=I_s3/I_s1*100 \n", - "print(\"percent of 3rd harmonic current in fundamental=%.2f\" %per3)\n", - "per5=I_s5/I_s1*100 \n", - "\n", - "#Results\n", - "print(\"percent of 5th harmonic current in fundamental=%.2f\" %per5)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "percent of 3rd harmonic current in fundamental=0.00\n", - "percent of 5th harmonic current in fundamental=-20.00\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.15, Page No 680" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=60.0\n", - "I_TA=I_a/3 \n", - "\n", - "#Calculations\n", - "print(\"avg thyristor current=%.0f A\" %I_TA)\n", - "I_Tr=I_a/math.sqrt(3) \n", - "print(\"rms thyristor current=%.3f A\" %I_Tr)\n", - "V_s=400\n", - "V_m=math.sqrt(2)*V_s\n", - "I_sr=I_a*math.sqrt(2.0/3)\n", - "a=150\n", - "V_t=3*V_m*math.cos(math.radians(a))/math.pi\n", - "pf=V_t*I_a/(math.sqrt(3)*V_s*I_sr) \n", - "print(\"power factor of ac source=%.3f\" %pf)\n", - "\n", - "r_a=0.5\n", - "K_m=2.4\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"Speed of motor=%.2f rpm\" %N)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg thyristor current=20 A\n", - "rms thyristor current=34.641 A\n", - "power factor of ac source=-0.827\n", - "Speed of motor=-1980.76 rpm\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.16, Page No 685" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=300.0\n", - "V_s=600.0\n", - "a=0.6\n", - "V_t=a*V_s\n", - "P=V_t*I_a \n", - "\n", - "#Calculations\n", - "print(\"input power from source=%.0f kW\" %(P/1000))\n", - "R_eq=V_s/(a*I_a) \n", - "print(\"equivalent input resistance=%.3f ohm\" %R_eq)\n", - "k=.004\n", - "R=.04+.06\n", - "w_m=(a*V_s-I_a*R)/(k*I_a)\n", - "N=w_m*60/(2*math.pi) \n", - "print(\"motor speed=%.1f rpm\" %N)\n", - "T_e=k*I_a**2 \n", - "\n", - "#Results\n", - "print(\"motor torque=%.0f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "input power from source=108 kW\n", - "equivalent input resistance=3.333 ohm\n", - "motor speed=2626.1 rpm\n", - "motor torque=360 Nm\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.17, Page No 686" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_on=10.0\n", - "T_off=15.0\n", - "\n", - "#Calculations\n", - "a=T_on/(T_on+T_off)\n", - "V_s=230.0\n", - "V_t=a*V_s\n", - "r_a=3\n", - "K_m=.5\n", - "N=1500\n", - "w_m=2*math.pi*N/60\n", - "I_a=(V_t-K_m*w_m)/r_a \n", - "\n", - "#Results\n", - "print(\"motor load current=%.3f A\" %I_a)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor load current=4.487 A\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.18, Page No 686" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "w_m=0 \n", - "print(\"lower limit of speed control=%.0f rpm\" %w_m)\n", - "I_a=25.0\n", - "r_a=.2\n", - "V_s=220\n", - "K_m=0.08\n", - "\n", - "#Calculations\n", - "a=(K_m*w_m+I_a*r_a)/V_s \n", - "print(\"lower limit of duty cycle=%.3f\" %a)\n", - "a=1 \n", - "print(\"upper limit of duty cycle=%.0f\" %a)\n", - "w_m=(a*V_s-I_a*r_a)/K_m \n", - "\n", - "#Results\n", - "print(\"upper limit of speed control=%.1f rpm\" %w_m)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "lower limit of speed control=0 rpm\n", - "lower limit of duty cycle=0.023\n", - "upper limit of duty cycle=1\n", - "upper limit of speed control=2687.5 rpm\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.21, Page No 691" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.6\n", - "V_s=400.0\n", - "V_t=(1-a)*V_s\n", - "I_a=300.0\n", - "P=V_t*I_a \n", - "\n", - "#Calculations \n", - "print(\"power returned=%.0f kW\" %(P/1000))\n", - "r_a=.2\n", - "K_m=1.2\n", - "R_eq=(1-a)*V_s/I_a+r_a \n", - "print(\"equivalent load resistance=%.4f ohm\" %R_eq)\n", - "w_mn=I_a*r_a/K_m\n", - "N=w_mn*60/(2*math.pi) \n", - "print(\"min braking speed=%.2f rpm\" %N)\n", - "w_mx=(V_s+I_a*r_a)/K_m\n", - "N=w_mx*60/(2*math.pi) \n", - "print(\"max braking speed=%.1f rpm\" %N)\n", - "w_m=(V_t+I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"max braking speed=%.1f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power returned=48 kW\n", - "equivalent load resistance=0.7333 ohm\n", - "min braking speed=477.46 rpm\n", - "max braking speed=3660.6 rpm\n", - "max braking speed=1750.7 rpm\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.22, Page No 699" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "N=1500.0\n", - "\n", - "#Calculations\n", - "print(\"when speed=1455rpm\")\n", - "n=1455.0\n", - "s1=(N-n)/N\n", - "r=math.sqrt(1/3)*(2/3)/(math.sqrt(s1)*(1-s1)) \n", - "print(\"I_2mx/I_2r=%.3f\" %r)\n", - "print(\"when speed=1350rpm\")\n", - "n=1350\n", - "s1=(N-n)/N\n", - "r=math.sqrt(1/3)*(2/3)/(math.sqrt(s1)*(1-s1)) \n", - "\n", - "#Results\n", - "print(\"I_2mx/I_2r=%.3f\" %r)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when speed=1455rpm\n", - "I_2mx/I_2r=0.000\n", - "when speed=1350rpm\n", - "I_2mx/I_2r=0.000\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.24, Page No 705" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V1=400.0\n", - "r1=0.6\n", - "r2=0.4\n", - "s=1.0\n", - "x1=1.6\n", - "x2=1.6\n", - "\n", - "#Calculations\n", - "print(\"at starting in normal conditions\")\n", - "I_n=V1/math.sqrt((r1+r2/s)**2+(x1+x2)**2) \n", - "print(\"current=%.2f A\" %I_n)\n", - "pf=(r1+r2)/math.sqrt((r1+r2/s)**2+(x1+x2)**2) \n", - "print(\"pf=%.4f\" %pf)\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_n**2*(r2/s) \n", - "print(\"\\nTorque developed=%.2f Nm\" %T_en)\n", - "print(\"motor is operated with DOL starting\")\n", - "I_d=V1/2/math.sqrt((r1+r2/s)**2+((x1+x2)/2)**2) \n", - "print(\"current=%.0f A\" %I_d)\n", - "pf=(r1+r2)/math.sqrt((r1+r2/s)**2+((x1+x2)/2)**2) \n", - "print(\"pf=%.2f\" %pf)\n", - "f1=25\n", - "w_s=4*math.pi*f1/4\n", - "T_ed=(3/w_s)*I_d**2*(r2/s) \n", - "print(\"Torque developed=%.3f Nm\" %T_ed)\n", - "print(\"at max torque conditions\")\n", - "s_mn=r2/math.sqrt((r1)**2+((x1+x2))**2)\n", - "I_n=V1/math.sqrt((r1+r2/s_mn)**2+(x1+x2)**2) \n", - "print(\"current=%.3f A\" %I_n)\n", - "pf=(r1+r2/s_mn)/math.sqrt((r1+r2/s_mn)**2+(x1+x2)**2) \n", - "print(\"pf=%.4f\" %pf)\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_n**2*(r2/s_mn) \n", - "print(\"Torque developed=%.2f Nm\" %T_en)\n", - "print(\"motor is operated with DOL starting\")\n", - "s_mn=r2/math.sqrt((r1)**2+((x1+x2)/2)**2)\n", - "I_d=V1/2/math.sqrt((r1+r2/s_mn)**2+((x1+x2)/2)**2) \n", - "print(\"current=%.3f A\" %I_d)\n", - "pf=(r1+r2/s_mn)/math.sqrt((r1+r2/s_mn)**2+((x1+x2)/2)**2) \n", - "print(\"\\npf=%.3f\" %pf)\n", - "f1=25\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_d**2*(r2/s_mn) \n", - "\n", - "\n", - "#Results \n", - "print(\"Torque developed=%.3f Nm\" %T_en)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "at starting in normal conditions\n", - "current=119.31 A\n", - "pf=0.2983\n", - "\n", - "Torque developed=108.75 Nm\n", - "motor is operated with DOL starting\n", - "current=106 A\n", - "pf=0.53\n", - "Torque developed=171.673 Nm\n", - "at max torque conditions\n", - "current=79.829 A\n", - "pf=0.7695\n", - "Torque developed=396.26 Nm\n", - "motor is operated with DOL starting\n", - "current=71.199 A\n", - "\n", - "pf=0.822\n", - "Torque developed=330.883 Nm\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.25, Page No 709" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "x1=1.0\n", - "X_m=50.0\n", - "X_e=x1*X_m/(x1+X_m)\n", - "V=231.0\n", - "V_e=V*X_m/(x1+X_m)\n", - "x2=1.0\n", - "r2=.4\n", - "r1=0\n", - "\n", - "#Calculations\n", - "s_m=r2/(x2+X_e) \n", - "print(\"slip at max torque=%.2f\" %s_m)\n", - "s_mT=r2/(x2+X_m) \n", - "print(\"slip at max torque=%.5f\" %s_mT)\n", - "f1=50.0\n", - "w_s=4*math.pi*f1/4\n", - "print(\"for constant voltage input\")\n", - "T_est=(3/w_s)*(V_e/math.sqrt(r2**2+(x2+X_e)**2))**2*(r2) \n", - "print(\"starting torque=%.3f Nm\" %T_est)\n", - "T_em=(3/w_s)*V_e**2/(2*(x2+X_e)) \n", - "print(\"maximum torque developed=%.2f Nm\" %T_em)\n", - "print(\"for constant current input\")\n", - "I1=28\n", - "T_est=(3/w_s)*(I1*X_m)**2/(r2**2+(x2+X_m)**2)*r2 \n", - "print(\"starting torque=%.3f Nm\" %T_est)\n", - "T_em=(3/w_s)*(I1*X_m)**2/(2*(x2+X_m)) \n", - "print(\"maximum torque developed=%.3f Nm\" %T_em)\n", - "s=s_mT\n", - "i=1\n", - "I_m=I1*(r2/s+i*x2)/(r2/s+i*(x2+X_m))\n", - "I_m=math.fabs(I_m)\n", - "V1=math.sqrt(3)*I_m*X_m \n", - "\n", - "#Results\n", - "print(\"supply voltage reqd=%.1f V\" %V1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "slip at max torque=0.20\n", - "slip at max torque=0.00784\n", - "for constant voltage input\n", - "starting torque=95.988 Nm\n", - "maximum torque developed=247.31 Nm\n", - "for constant current input\n", - "starting torque=5.756 Nm\n", - "maximum torque developed=366.993 Nm\n", - "supply voltage reqd=1236.2 V\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.27, Page No 718" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=420.0\n", - "V1=V/math.sqrt(3)\n", - "T_e=450.0\n", - "N=1440.0\n", - "n=1000.0\n", - "T_L=T_e*(n/N)**2\n", - "n1=1500.0\n", - "\n", - "#Calculations\n", - "w_s=2*math.pi*n1/60\n", - "w_m=2*math.pi*n/60\n", - "a=.8\n", - "I_d=T_L*w_s/(2.339*a*V1)\n", - "k=0\n", - "R=(1-w_m/w_s)*(2.339*a*V1)/(I_d*(1-k)) \n", - "print(\"value of chopper resistance=%.4f ohm\" %R)\n", - "n=1320.0\n", - "T_L=T_e*(n/N)**2\n", - "I_d=T_L*w_s/(2.339*a*V1) \n", - "print(\"Inductor current=%.3f A\" %I_d)\n", - "w_m=2*math.pi*n/60\n", - "k=1-((1-w_m/w_s)*(2.339*a*V1)/(I_d*R)) \n", - "print(\"value of duty cycle=%.4f\" %k)\n", - "s=(n1-n)/n1\n", - "V_d=2.339*s*a*V1 \n", - "print(\"Rectifed o/p voltage=%.3f V\" %V_d)\n", - "P=V_d*I_d\n", - "I2=math.sqrt(2/3)*I_d\n", - "r2=0.02\n", - "Pr=3*I2**2*r2\n", - "I1=a*I2\n", - "r1=0.015\n", - "Ps=3*I1**2*r1\n", - "Po=T_L*w_m\n", - "Pi=Po+Ps+Pr+P\n", - "eff=Po/Pi*100 \n", - "\n", - "#Results\n", - "print(\"Efficiency(in percent)=%.2f\" %eff)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of chopper resistance=2.0132 ohm\n", - "Inductor current=130.902 A\n", - "value of duty cycle=0.7934\n", - "Rectifed o/p voltage=54.449 V\n", - "Efficiency(in percent)=88.00\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.28, Page No 720" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "V_ph=V/math.sqrt(3)\n", - "N_s=1000.0\n", - "N=800.0\n", - "a=.7\n", - "I_d=110\n", - "R=2.0\n", - "\n", - "#Calculations\n", - "k=1-((1-N/N_s)*(2.339*a*V_ph)/(I_d*R)) \n", - "print(\"value of duty cycle=%.3f\" %k)\n", - "P=I_d**2*R*(1-k)\n", - "I1=a*I_d*math.sqrt(2/3)\n", - "r1=0.1\n", - "r2=0.08\n", - "Pr=3*I1**2*(r1+r2)\n", - "P_o=20000\n", - "P_i=P_o+Pr+P\n", - "eff=P_o/P_i*100 \n", - "print(\"Efficiency=%.2f\" %eff)\n", - "I11=math.sqrt(6)/math.pi*a*I_d\n", - "th=43\n", - "P_ip=math.sqrt(3)*V*I11*math.cos(math.radians(th))\n", - "pf=P_ip/(math.sqrt(3)*V*I11) \n", - "\n", - "#Results\n", - "print(\"Input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of duty cycle=0.656\n", - "Efficiency=70.62\n", - "Input power factor=0.7314\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.29, Page No 724" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=420.0\n", - "V1=V/math.sqrt(3)\n", - "N=1000.0\n", - "w_m=2*math.pi*N/60\n", - "N_s=1500.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "a=0.8\n", - "V_d=2.339*a*s*V1 \n", - "print(\"rectified voltage=%.2f V\" %V_d)\n", - "T=450.0\n", - "N1=1200.0\n", - "T_L=T*(N/N1)**2\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "I_d=w_s*T_L/(2.339*a*V1) \n", - "print(\"inductor current=%.2f A\" %I_d)\n", - "a_T=-.4\n", - "a1=math.degrees(math.acos(s*a/a_T))\n", - "print(\"delay angle of inverter=%.2f deg\" %a1)\n", - "\n", - "P_s=V_d*I_d\n", - "P_o=T_L*w_m\n", - "R_d=0.01\n", - "P_i=I_d**2*R_d\n", - "I2=math.sqrt(2/3)*I_d\n", - "r2=0.02\n", - "r1=0.015\n", - "P_rol=3*I2**2*r2\n", - "I1=a*I2\n", - "P_sol=3*I1**2*r1\n", - "P_i=P_o+P_rol+P_sol+P_i\n", - "eff=P_o/P_i*100 \n", - "print(\"\\nefficiency=%.2f\" %eff)\n", - "w_m=w_s*(1+(-a_T/a)*math.cos(math.radians(a1))-w_s*R_d*T_L/(2.339*a*V1)**2)\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results \n", - "print(\"motor speed=%.1f rpm\" %N)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectified voltage=151.25 V\n", - "inductor current=108.18 A\n", - "delay angle of inverter=131.81 deg\n", - "\n", - "efficiency=99.64\n", - "motor speed=996.4 rpm\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.30, Page No 726" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V/math.sqrt(3)\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V_dd=0.7\n", - "V_dt=1.5\n", - "V_d=3*math.sqrt(6)*s*E2/math.pi-2*V_dd\n", - "V1=415.0\n", - "a=math.degrees(math.acos((3*math.sqrt(2)*E2/math.pi)**-1*(-V_d+2*V_dt)))\n", - "\n", - "#Results\n", - "print(\"firing angle advance=%.2f deg\" %(180-a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle advance=70.22 deg\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.31, Page No 726" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V/math.sqrt(3)\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V_dd=.7\n", - "V_dt=1.5\n", - "a=0\n", - "u=18 #overlap angle in case of rectifier\n", - "V_d=3*math.sqrt(6)*s*E2*(math.cos(math.radians(a))+math.cos(math.radians(a+u)))/(2*math.pi)-2*V_dd\n", - "V1=415\n", - "V_ml=math.sqrt(2)*V1\n", - "u=4 #overlap anglein the inverter\n", - " #V_dc=-(3*V_ml*(math.cos(math.radians(a))+math.cos(math.radians(a+u)))/(2*math.pi)-2*V_dt)\n", - " #V_dc=V_d\n", - " #after solving % (1+math.cos(math.radians(u)))*math.cos(math.radians(a))-math.sin(math.radians(u))*math.sin(math.radians(a))=-.6425\n", - "a=math.degrees(math.acos(-.6425/(math.sqrt((1+math.cos(math.radians(u)))**2+math.sin(math.radians(u))**2))))-math.degrees(math.asin(math.sin(math.radians(a))/(1+math.cos(math.radians(u)))))\n", - "\n", - "#Results\n", - "print(\"firing angle advance=%.2f deg\" %(180-a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle advance=71.25 deg\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.32, Page No 727" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V1=415.0\n", - "a_T=s*E2/V1 \n", - "\n", - "#Results\n", - "print(\"voltage ratio of the transformer=%.2f\" %a_T)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "voltage ratio of the transformer=0.34\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.33, Page No 733" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=6.0\n", - "N_s=600.0\n", - "f1=P*N_s/120.0\n", - "V=400.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "V_t=f1*V/f \n", - "print(\"supply freq=%.0f Hz\" %V_t)\n", - "T=340.0\n", - "N=1000.0\n", - "T_L=T*(N_s/N)**2\n", - "w_s=2*math.pi*N_s/60\n", - "P=T_L*w_s\n", - "I_a=P/(math.sqrt(3)*V_t) \n", - "print(\"armature current=%.2f A\" %I_a)\n", - "Z_s=2\n", - "X_s=f1/f*math.fabs(Z_s)\n", - "V_t=V_t/math.sqrt(3)\n", - "Ef=math.sqrt(V_t**2+(I_a*X_s)**2)\n", - "print(\"excitation voltage=%.2f V\" %(math.sqrt(3)*Ef))\n", - "dl=math.degrees(math.atan(I_a*X_s/V_t))\n", - "print(\"load angle=%.2f deg\" %dl)\n", - "T_em=(3/w_s)*(Ef*V_t/X_s) \n", - "\n", - "#Results\n", - "print(\"pull out torque=%.2f Nm\" %T_em)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "supply freq=240 Hz\n", - "armature current=18.50 A\n", - "excitation voltage=243.06 V\n", - "load angle=9.10 deg\n", - "pull out torque=773.69 Nm\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.34, Page No 736" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=4.0\n", - "f=50.0\n", - "w_s=4*math.pi*f/P\n", - "X_d=8.0\n", - "X_q=2.0\n", - "T_e=80.0\n", - "V=400.0\n", - "\n", - "#Calculations\n", - "V_t=V/math.sqrt(3)\n", - "dl=(1/2)*math.degrees(math.asin(T_e*w_s/((3/2)*(V_t)**2*(1/X_q-1/X_d)))) \n", - "print(\"load angle=%.3f deg\" %dl)\n", - "I_d=V_t*math.cos(math.radians(dl))/X_d\n", - "I_q=V_t*math.sin(math.radians(dl))/X_q\n", - "I_a=math.sqrt(I_d**2+I_q**2) \n", - "print(\"armature current=%.2f A\" %I_a)\n", - "pf=T_e*w_s/(math.sqrt(3)*V*I_a) \n", - "\n", - "#Results\n", - "print(\"input power factor=%.4f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "load angle=0.000 deg\n", - "armature current=28.87 A\n", - "input power factor=0.6283\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.35, Page No 737" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_e=3.0\n", - "K_m=1.2\n", - "I_a=T_e/K_m\n", - "r_a=2.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "E_a=(0.263*math.sqrt(2)*V-I_a*r_a)/(1-55/180)\n", - "w_m=E_a/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.2f rpm\" %N)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=640.96 rpm\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.36, Page No 738" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=1360.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - " #after calculations V_t % calculated\n", - "V_t=163.45\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.4f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=5.2578 Nm\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.37, Page No 740" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=2100.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - " #after calculations V_t % calculated\n", - "V_t=227.66\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.2f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=1.94 Nm\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.38, Page No 742" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=840.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=75.0\n", - "V_t=math.sqrt(2)*V/math.pi*(1+math.cos(math.radians(a)))\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.4f Nm\" %T_e)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=10.5922 Nm\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.39, Page No 743" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=1400.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=60.0\n", - "a1=212\n", - "V_t=math.sqrt(2)*V/math.pi*(math.cos(math.radians(a))-math.cos(math.radians(a1)))+E_a*(180+a-a1)/180\n", - "r_a=3\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.3f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=5.257 Nm\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.40, Page No 745" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=600.0\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "V_t=2*math.sqrt(2)*V/math.pi*(math.cos(math.radians(a)))\n", - "r_a=3\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "\n", - "#Results\n", - "print(\"motor torque=%.3f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=13.568 Nm\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.41, Page No 745" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "r1=.6\n", - "r2=.4\n", - "s=0.04\n", - "x1=1.6\n", - "x2=1.6\n", - "Z=(r1+r2/s)+(x1+x2)\n", - "V=400.0\n", - "I1=V/Z \n", - "print(\"source current=%.3f A \" %math.degrees(math.atan(I1.imag/I1.real)))\n", - "print(\"and with %.1f deg phase\" %math.fabs(I1))\n", - "I2=V/Z\n", - "N=1500\n", - "w_s=2*math.pi*N/60\n", - "T_e=(3/w_s)*abs(I2)**2*r2/s \n", - "print(\"motor torque=%.2f Nm\" %T_e)\n", - "N_r=N*(1-s)\n", - "\n", - "f=45\n", - "N_s1=120*f/4\n", - "w_s=2*math.pi*N_s1/60\n", - "s1=(N_s1-N_r)/N_s1\n", - "Z=(r1+r2/s1)+(x1+x2)*f/50.0\n", - "V=360\n", - "I1=V/Z \n", - "print(\"source current=%.3f A \" %math.degrees(math.atan(I1.imag/I1.real)))\n", - "print(\"and with %.1f deg phase\" %math.fabs(I1))\n", - "I2=V/Z\n", - "T_e=(3/w_s)*abs(I2)**2*r2/s1 \n", - "print(\"motor torque=%.2f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "source current=0.000 A \n", - "and with 29.0 deg phase\n", - "motor torque=160.46 Nm\n", - "source current=-0.000 A \n", - "and with 142.9 deg phase\n", - "motor torque=-2598.45 Nm\n" - ] - } - ], - "prompt_number": 37 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter12_2.ipynb b/_Power_Electronics/Chapter12_2.ipynb deleted file mode 100755 index f8605d69..00000000 --- a/_Power_Electronics/Chapter12_2.ipynb +++ /dev/null @@ -1,1997 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 12 : Electic Drives" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.1, Page No 658" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_e=15.0 #Nm\n", - "K_m=0.5 #V-s/rad\n", - "I_a=T_e/K_m\n", - "n_m=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*n_m/60\n", - "E_a=K_m*w_m\n", - "r_a=0.7\n", - "V_t=E_a+I_a*r_a\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=math.degrees(math.acos(2*math.pi*V_t/V_m-1))\n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "I_Tr=I_a*math.sqrt((180-a)/360) \n", - "print(\"rms value of thyristor current=%.3f A\" %I_Tr)\n", - "I_fdr=I_a*math.sqrt((180+a)/360) \n", - "print(\"rms value of freewheeling diode current=%.3f A\" %I_fdr)\n", - "pf=V_t*I_a/(V_s*I_Tr) \n", - "\n", - "#Results \n", - "print(\"input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=65.349 deg\n", - "rms value of thyristor current=16.930 A\n", - "rms value of freewheeling diode current=24.766 A\n", - "input power factor=0.5652\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.2, Page No 660" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "\n", - "#Calculations\n", - "th1=math.sin(math.radians(E/(math.sqrt(2)*V)))\n", - "I_o=(1/(2*math.pi*R))*(2*math.sqrt(2)*230*math.cos(math.radians(th1))-E*(math.pi-2*th1*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*(math.pi-2*th1*math.pi/180)+V**2*math.sin(math.radians(2*th1))-4*math.sqrt(2)*V*E*math.cos(math.radians(th1))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or)\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.3f W\" %P_r) \n", - "print(\"supply pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=3.5679 A\n", - "power supplied to the battery=535.18 W\n", - "power dissipated by the resistor=829.760 W\n", - "supply pf=0.583\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.3 Page No 661" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=250\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30.0\n", - "k=0.03 #Nm/A**2\n", - "n_m=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*n_m/60\n", - "r=.2 #r_a+r_s\n", - "V_t=V_m/math.pi*(1+math.cos(math.radians(a)))\n", - "I_a=V_t/(k*w_m+r) \n", - "print(\"motor armature current=%.2f A\" %I_a)\n", - "T_e=k*I_a**2 \n", - "print(\"motor torque=%.3f Nm\" %T_e)\n", - "I_sr=I_a*math.sqrt((180-a)/180)\n", - "pf=(V_t*I_a)/(V_s*I_sr) \n", - "\n", - "#Results\n", - "print(\"input power factor=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor armature current=57.82 A\n", - "motor torque=100.285 Nm\n", - "input power factor=0.92\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.4, Page No 663" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "V_f=2*V_m/math.pi\n", - "r_f=200.0\n", - "I_f=V_f/r_f\n", - "T_e=85.0\n", - "K_a=0.8\n", - "\n", - "#Calculations\n", - "I_a=T_e/(I_f*K_a) \n", - "print(\"rated armature current=%.2f A\" %I_a)\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "r_a=0.2\n", - "V_t=K_a*I_f*w_m+I_a*r_a\n", - "a=math.degrees(math.acos(V_t*math.pi/(2*V_m)))\n", - "print(\"firing angle delay=%.2f deg\" %a)\n", - "E_a=V_t\n", - "w_mo=E_a/(K_a*I_f)\n", - "N=60*w_mo/(2*math.pi)\n", - "reg=((N-n_m)/n_m)*100 \n", - "print(\"speed regulation at full load=%.2f\" %reg)\n", - "I_ar=I_a\n", - "pf=(V_t*I_a)/(V_s*I_ar) \n", - "print(\"input power factor of armature convertor=%.4f\" %pf)\n", - "I_fr=I_f\n", - "I_sr=math.sqrt(I_fr**2+I_ar**2)\n", - "VA=I_sr*V_s\n", - "P=V_t*I_a+V_f*I_f\n", - "\n", - "#Results\n", - "print(\"input power factor of drive=%.4f\" %(P/VA))\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rated armature current=59.01 A\n", - "firing angle delay=57.63 deg\n", - "speed regulation at full load=6.52\n", - "input power factor of armature convertor=0.4821\n", - "input power factor of drive=0.5093\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.5 Page No 664" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "V_f=2*V_m/math.pi\n", - "\n", - "#Calculations\n", - "a1=math.degrees(math.acos(V_t*math.pi/(2*V_m))) \n", - "print(\"delay angle of field converter=%.0f deg\" %a1)\n", - "r_f=200.0\n", - "I_f=V_f/r_f\n", - "T_e=85.0\n", - "K_a=0.8\n", - "I_a=T_e/(I_f*K_a)\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "r_a=0.1\n", - "I_a=50.0\n", - "V_t=-K_a*I_f*w_m+I_a*r_a\n", - "a=math.degrees(math.acos(V_t*math.pi/(2*V_m)))\n", - "\n", - "#Results\n", - "print(\"firing angle delay of armature converter=%.3f deg\" %a)\n", - "print(\"power fed back to ac supply=%.0f W\" %(-V_t*I_a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "delay angle of field converter=58 deg\n", - "firing angle delay of armature converter=119.260 deg\n", - "power fed back to ac supply=8801 W\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.6 Page No 665" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=220.0\n", - "n_m=1500.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=10.0\n", - "r_a=1.0\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "T=5.0\n", - "I_a=T/K_m\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30.0\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "print(\"motor speed=%.2f rpm\" %N)\n", - "a=45\n", - "n_m=1000\n", - "w_m=2*math.pi*n_m/60\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "I_a=(V_t-K_m*w_m)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"torque developed=%.3f Nm\" %T_e)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=1254.22 rpm\n", - "torque developed=8.586 Nm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.7, Page No 666" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=220.0\n", - "n_m=1000.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=60.0\n", - "r_a=.1\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "V_s=230\n", - "V_m=math.sqrt(2)*V_s\n", - "print(\"for 600rpm speed\")\n", - "n_m=600.0\n", - "w_m=2*math.pi*n_m/60\n", - "a=math.degrees(math.acos((K_m*w_m+I_a*r_a)*math.pi/(2*V_m))) \n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"for -500rpm speed\")\n", - "n_m=-500.0\n", - "w_m=2*math.pi*n_m/60\n", - "a=math.degrees(math.acos((K_m*w_m+I_a*r_a)*math.pi/(2*V_m)))\n", - "print(\"firing angle=%.2f deg\" %a)\n", - "I_a=I_a/2\n", - "a=150\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.3f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for 600rpm speed\n", - "firing angle=49.530 deg\n", - "for -500rpm speed\n", - "firing angle=119.19 deg\n", - "motor speed=-852.011 rpm\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.8 Page No 672" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.5\n", - "T_e=50.0\n", - "I_a=T_e/K_m\n", - "r_a=0.9\n", - "a=45.0\n", - "V_s=415.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_s\n", - "w_m=((3*V_ml*(1+math.cos(math.radians(a)))/(2*math.pi))-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.2f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=2854.42 rpm\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.9 Page No 672" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_t=600\n", - "n_m=1500.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=80.0\n", - "r_a=1.0\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "print(\"for firing angle=45deg and speed=1200rpm\")\n", - "a=45.0\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=(3*V_m*(1+math.cos(math.radians(a)))/(2*math.pi)-K_m*w_m)/r_a\n", - "I_sr=I_a*math.sqrt(2/3) \n", - "print(\"rms value of source current=%.3f A\" %I_sr)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_a*math.sqrt(1/3)))\n", - "print(\"avg value of thyristor current=%.2f A\" %I_a*(1/3))\n", - "pf=(3/(2*math.pi)*(1+math.cos(math.radians(a)))) \n", - "print(\"input power factor=%.3f\" %pf)\n", - "\n", - "print(\"for firing angle=90deg and speed=700rpm\")\n", - "a=90\n", - "n_m=700\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=(3*V_m*(1+math.cos(math.radians(a)))/(2*math.pi)-K_m*w_m)/r_a\n", - "I_sr=I_a*math.sqrt(90/180) \n", - "\n", - "\n", - "#Results\n", - "print(\"rms value of source current=%.3f A\" %I_sr)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_a*math.sqrt(90.0/360)))\n", - "print(\"avg value of thyristor current=%.3f A\" %I_a*(1/3))\n", - "pf=(math.sqrt(6)/(2*math.pi)*(1+math.cos(math.radians(a))))*math.sqrt(180/(180-a)) \n", - "print(\"input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=45deg and speed=1200rpm\n", - "rms value of source current=0.000 A\n", - "rms value of thyristor current=0.000 A\n", - "\n", - "input power factor=0.815\n", - "for firing angle=90deg and speed=700rpm\n", - "rms value of source current=0.000 A\n", - "rms value of thyristor current=195.558 A\n", - "\n", - "input power factor=0.5513\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.10 Page No 676" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30\n", - "V_t=3*V_m*math.cos(math.radians(a))/math.pi\n", - "I_a=21.0\n", - "r_a=.1\n", - "V_d=2.0\n", - "K_m=1.6\n", - "\n", - "#Calculations\n", - "w_m=(V_t-I_a*r_a-V_d)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "print(\"speed of motor=%.1f rpm\" %N)\n", - "\n", - "N=2000\n", - "w_m=2*math.pi*N/60\n", - "I_a=210\n", - "V_t=K_m*w_m+I_a*r_a+V_d\n", - "a=math.degrees(math.acos(V_t*math.pi/(3*V_m)))\n", - "print(\"firing angle=%.2f deg\" %a)\n", - "I_sr=I_a*math.sqrt(2.0/3.0)\n", - "pf=V_t*I_a/(math.sqrt(3)*V_s*I_sr) \n", - "print(\"supply power factor=%.3f\" %pf)\n", - "\n", - "I_a=21\n", - "w_m=(V_t-I_a*r_a-V_d)/K_m\n", - "n=w_m*60/(2*math.pi)\n", - "reg=(n-N)/N*100 \n", - "\n", - "#Results\n", - "print(\"speed regulation(percent)=%.2f\" %reg)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of motor=2767.6 rpm\n", - "firing angle=48.48 deg\n", - "supply power factor=0.633\n", - "speed regulation(percent)=5.64\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.11, Page No 677" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=230.0\n", - "V_l=V_t*math.pi/(3*math.sqrt(2))\n", - "V_ph=V_l/math.sqrt(3)\n", - "V_in=400 #per phase voltage input\n", - "\n", - "#Calculations\n", - "N1=1500.0\n", - "I_a1=20.0\n", - "r_a1=.6\n", - "E_a1=V_t-I_a1*r_a1\n", - "n1=1000.0\n", - "E_a2=E_a1/1500.0*1000.0\n", - "V_t1=E_a1+I_a1*r_a1\n", - "a1=math.degrees(math.acos(V_t1*math.pi/(3*math.sqrt(2.0)*V_l)))\n", - "I_a2=.5*I_a1\n", - "n2=-900.0\n", - "V_t2=n2*E_a2/N1+I_a2*r_a1\n", - "a2=math.degrees(math.acos(V_t2*math.pi/(3*math.sqrt(2)*V_l))) \n", - "\n", - "#Results\n", - "print(\"transformer phase turns ratio=%.3f\" %(V_in/V_ph))\n", - "print(\"for motor running at 1000rpm at rated torque\")\n", - "print(\"firing angle delay=%.2f deg\" %a1)\n", - "print(\"for motor running at -900rpm at half of rated torque\")\n", - "print(\"firing angle delay=%.3f deg\" %a2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transformer phase turns ratio=4.068\n", - "for motor running at 1000rpm at rated torque\n", - "firing angle delay=0.00 deg\n", - "for motor running at -900rpm at half of rated torque\n", - "firing angle delay=110.674 deg\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.12, Page No 678" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=400\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_f=3*V_ml/math.pi\n", - "R_f=300.0\n", - "I_f=V_f/R_f\n", - "T_e=60.0\n", - "k=1.1\n", - "\n", - "#Calculations\n", - "I_a=T_e/(k*I_f)\n", - "N1=1000.0\n", - "w_m1=2*math.pi*N1/60\n", - "r_a1=.3\n", - "V_t1=k*I_f*w_m1+I_a*r_a1\n", - "a1=math.degrees(math.acos(V_f*math.pi/(3*V_ml)))\n", - "N2=3000\n", - "w_m2=2*math.pi*N/60\n", - "a2=0\n", - "V_t2=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "I_f2=(V_t2-I_a*r_a)/(w_m2*k)\n", - "V_f2=I_f2*R_f\n", - "a2=math.degrees(math.acos(V_f2*math.pi/(3*V_ml)))\n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"firing angle=%.3f deg\" %a)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=48.477 deg\n", - "firing angle=48.477 deg\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.13, Page No 679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - " #after calculating\n", - " #t=w_m/6000-math.pi/360\n", - "\n", - "N=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "t=w_m/6000-math.pi/360 \n", - "\n", - "#Results\n", - "print(\"time reqd=%.2f s\" %t)\n", - " #printing mistake in the answer in book" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time reqd=0.01 s\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.14, Page No 679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=1.0 #supposition\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "I_s1=2*math.sqrt(2)/math.pi*I_a*math.sin(math.radians(a))\n", - "I_s3=2*math.sqrt(2)/(3*math.pi)*I_a*math.sin(math.radians(3*a))\n", - "I_s5=2*math.sqrt(2)/(5*math.pi)*I_a*math.sin(math.radians(5*a))\n", - "per3=I_s3/I_s1*100 \n", - "print(\"percent of 3rd harmonic current in fundamental=%.2f\" %per3)\n", - "per5=I_s5/I_s1*100 \n", - "\n", - "#Results\n", - "print(\"percent of 5th harmonic current in fundamental=%.2f\" %per5)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "percent of 3rd harmonic current in fundamental=0.00\n", - "percent of 5th harmonic current in fundamental=-20.00\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.15, Page No 680" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=60.0\n", - "I_TA=I_a/3 \n", - "\n", - "#Calculations\n", - "print(\"avg thyristor current=%.0f A\" %I_TA)\n", - "I_Tr=I_a/math.sqrt(3) \n", - "print(\"rms thyristor current=%.3f A\" %I_Tr)\n", - "V_s=400\n", - "V_m=math.sqrt(2)*V_s\n", - "I_sr=I_a*math.sqrt(2.0/3)\n", - "a=150\n", - "V_t=3*V_m*math.cos(math.radians(a))/math.pi\n", - "pf=V_t*I_a/(math.sqrt(3)*V_s*I_sr) \n", - "print(\"power factor of ac source=%.3f\" %pf)\n", - "\n", - "r_a=0.5\n", - "K_m=2.4\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"Speed of motor=%.2f rpm\" %N)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg thyristor current=20 A\n", - "rms thyristor current=34.641 A\n", - "power factor of ac source=-0.827\n", - "Speed of motor=-1980.76 rpm\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.16, Page No 685" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=300.0\n", - "V_s=600.0\n", - "a=0.6\n", - "V_t=a*V_s\n", - "P=V_t*I_a \n", - "\n", - "#Calculations\n", - "print(\"input power from source=%.0f kW\" %(P/1000))\n", - "R_eq=V_s/(a*I_a) \n", - "print(\"equivalent input resistance=%.3f ohm\" %R_eq)\n", - "k=.004\n", - "R=.04+.06\n", - "w_m=(a*V_s-I_a*R)/(k*I_a)\n", - "N=w_m*60/(2*math.pi) \n", - "print(\"motor speed=%.1f rpm\" %N)\n", - "T_e=k*I_a**2 \n", - "\n", - "#Results\n", - "print(\"motor torque=%.0f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "input power from source=108 kW\n", - "equivalent input resistance=3.333 ohm\n", - "motor speed=2626.1 rpm\n", - "motor torque=360 Nm\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.17, Page No 686" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_on=10.0\n", - "T_off=15.0\n", - "\n", - "#Calculations\n", - "a=T_on/(T_on+T_off)\n", - "V_s=230.0\n", - "V_t=a*V_s\n", - "r_a=3\n", - "K_m=.5\n", - "N=1500\n", - "w_m=2*math.pi*N/60\n", - "I_a=(V_t-K_m*w_m)/r_a \n", - "\n", - "#Results\n", - "print(\"motor load current=%.3f A\" %I_a)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor load current=4.487 A\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.18, Page No 686" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "w_m=0 \n", - "print(\"lower limit of speed control=%.0f rpm\" %w_m)\n", - "I_a=25.0\n", - "r_a=.2\n", - "V_s=220\n", - "K_m=0.08\n", - "\n", - "#Calculations\n", - "a=(K_m*w_m+I_a*r_a)/V_s \n", - "print(\"lower limit of duty cycle=%.3f\" %a)\n", - "a=1 \n", - "print(\"upper limit of duty cycle=%.0f\" %a)\n", - "w_m=(a*V_s-I_a*r_a)/K_m \n", - "\n", - "#Results\n", - "print(\"upper limit of speed control=%.1f rpm\" %w_m)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "lower limit of speed control=0 rpm\n", - "lower limit of duty cycle=0.023\n", - "upper limit of duty cycle=1\n", - "upper limit of speed control=2687.5 rpm\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.21, Page No 691" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.6\n", - "V_s=400.0\n", - "V_t=(1-a)*V_s\n", - "I_a=300.0\n", - "P=V_t*I_a \n", - "\n", - "#Calculations \n", - "print(\"power returned=%.0f kW\" %(P/1000))\n", - "r_a=.2\n", - "K_m=1.2\n", - "R_eq=(1-a)*V_s/I_a+r_a \n", - "print(\"equivalent load resistance=%.4f ohm\" %R_eq)\n", - "w_mn=I_a*r_a/K_m\n", - "N=w_mn*60/(2*math.pi) \n", - "print(\"min braking speed=%.2f rpm\" %N)\n", - "w_mx=(V_s+I_a*r_a)/K_m\n", - "N=w_mx*60/(2*math.pi) \n", - "print(\"max braking speed=%.1f rpm\" %N)\n", - "w_m=(V_t+I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"max braking speed=%.1f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power returned=48 kW\n", - "equivalent load resistance=0.7333 ohm\n", - "min braking speed=477.46 rpm\n", - "max braking speed=3660.6 rpm\n", - "max braking speed=1750.7 rpm\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.22, Page No 699" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "N=1500.0\n", - "\n", - "#Calculations\n", - "print(\"when speed=1455rpm\")\n", - "n=1455.0\n", - "s1=(N-n)/N\n", - "r=math.sqrt(1/3)*(2/3)/(math.sqrt(s1)*(1-s1)) \n", - "print(\"I_2mx/I_2r=%.3f\" %r)\n", - "print(\"when speed=1350rpm\")\n", - "n=1350\n", - "s1=(N-n)/N\n", - "r=math.sqrt(1/3)*(2/3)/(math.sqrt(s1)*(1-s1)) \n", - "\n", - "#Results\n", - "print(\"I_2mx/I_2r=%.3f\" %r)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when speed=1455rpm\n", - "I_2mx/I_2r=0.000\n", - "when speed=1350rpm\n", - "I_2mx/I_2r=0.000\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.24, Page No 705" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V1=400.0\n", - "r1=0.6\n", - "r2=0.4\n", - "s=1.0\n", - "x1=1.6\n", - "x2=1.6\n", - "\n", - "#Calculations\n", - "print(\"at starting in normal conditions\")\n", - "I_n=V1/math.sqrt((r1+r2/s)**2+(x1+x2)**2) \n", - "print(\"current=%.2f A\" %I_n)\n", - "pf=(r1+r2)/math.sqrt((r1+r2/s)**2+(x1+x2)**2) \n", - "print(\"pf=%.4f\" %pf)\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_n**2*(r2/s) \n", - "print(\"\\nTorque developed=%.2f Nm\" %T_en)\n", - "print(\"motor is operated with DOL starting\")\n", - "I_d=V1/2/math.sqrt((r1+r2/s)**2+((x1+x2)/2)**2) \n", - "print(\"current=%.0f A\" %I_d)\n", - "pf=(r1+r2)/math.sqrt((r1+r2/s)**2+((x1+x2)/2)**2) \n", - "print(\"pf=%.2f\" %pf)\n", - "f1=25\n", - "w_s=4*math.pi*f1/4\n", - "T_ed=(3/w_s)*I_d**2*(r2/s) \n", - "print(\"Torque developed=%.3f Nm\" %T_ed)\n", - "print(\"at max torque conditions\")\n", - "s_mn=r2/math.sqrt((r1)**2+((x1+x2))**2)\n", - "I_n=V1/math.sqrt((r1+r2/s_mn)**2+(x1+x2)**2) \n", - "print(\"current=%.3f A\" %I_n)\n", - "pf=(r1+r2/s_mn)/math.sqrt((r1+r2/s_mn)**2+(x1+x2)**2) \n", - "print(\"pf=%.4f\" %pf)\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_n**2*(r2/s_mn) \n", - "print(\"Torque developed=%.2f Nm\" %T_en)\n", - "print(\"motor is operated with DOL starting\")\n", - "s_mn=r2/math.sqrt((r1)**2+((x1+x2)/2)**2)\n", - "I_d=V1/2/math.sqrt((r1+r2/s_mn)**2+((x1+x2)/2)**2) \n", - "print(\"current=%.3f A\" %I_d)\n", - "pf=(r1+r2/s_mn)/math.sqrt((r1+r2/s_mn)**2+((x1+x2)/2)**2) \n", - "print(\"\\npf=%.3f\" %pf)\n", - "f1=25\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_d**2*(r2/s_mn) \n", - "\n", - "\n", - "#Results \n", - "print(\"Torque developed=%.3f Nm\" %T_en)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "at starting in normal conditions\n", - "current=119.31 A\n", - "pf=0.2983\n", - "\n", - "Torque developed=108.75 Nm\n", - "motor is operated with DOL starting\n", - "current=106 A\n", - "pf=0.53\n", - "Torque developed=171.673 Nm\n", - "at max torque conditions\n", - "current=79.829 A\n", - "pf=0.7695\n", - "Torque developed=396.26 Nm\n", - "motor is operated with DOL starting\n", - "current=71.199 A\n", - "\n", - "pf=0.822\n", - "Torque developed=330.883 Nm\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.25, Page No 709" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "x1=1.0\n", - "X_m=50.0\n", - "X_e=x1*X_m/(x1+X_m)\n", - "V=231.0\n", - "V_e=V*X_m/(x1+X_m)\n", - "x2=1.0\n", - "r2=.4\n", - "r1=0\n", - "\n", - "#Calculations\n", - "s_m=r2/(x2+X_e) \n", - "print(\"slip at max torque=%.2f\" %s_m)\n", - "s_mT=r2/(x2+X_m) \n", - "print(\"slip at max torque=%.5f\" %s_mT)\n", - "f1=50.0\n", - "w_s=4*math.pi*f1/4\n", - "print(\"for constant voltage input\")\n", - "T_est=(3/w_s)*(V_e/math.sqrt(r2**2+(x2+X_e)**2))**2*(r2) \n", - "print(\"starting torque=%.3f Nm\" %T_est)\n", - "T_em=(3/w_s)*V_e**2/(2*(x2+X_e)) \n", - "print(\"maximum torque developed=%.2f Nm\" %T_em)\n", - "print(\"for constant current input\")\n", - "I1=28\n", - "T_est=(3/w_s)*(I1*X_m)**2/(r2**2+(x2+X_m)**2)*r2 \n", - "print(\"starting torque=%.3f Nm\" %T_est)\n", - "T_em=(3/w_s)*(I1*X_m)**2/(2*(x2+X_m)) \n", - "print(\"maximum torque developed=%.3f Nm\" %T_em)\n", - "s=s_mT\n", - "i=1\n", - "I_m=I1*(r2/s+i*x2)/(r2/s+i*(x2+X_m))\n", - "I_m=math.fabs(I_m)\n", - "V1=math.sqrt(3)*I_m*X_m \n", - "\n", - "#Results\n", - "print(\"supply voltage reqd=%.1f V\" %V1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "slip at max torque=0.20\n", - "slip at max torque=0.00784\n", - "for constant voltage input\n", - "starting torque=95.988 Nm\n", - "maximum torque developed=247.31 Nm\n", - "for constant current input\n", - "starting torque=5.756 Nm\n", - "maximum torque developed=366.993 Nm\n", - "supply voltage reqd=1236.2 V\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.27, Page No 718" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=420.0\n", - "V1=V/math.sqrt(3)\n", - "T_e=450.0\n", - "N=1440.0\n", - "n=1000.0\n", - "T_L=T_e*(n/N)**2\n", - "n1=1500.0\n", - "\n", - "#Calculations\n", - "w_s=2*math.pi*n1/60\n", - "w_m=2*math.pi*n/60\n", - "a=.8\n", - "I_d=T_L*w_s/(2.339*a*V1)\n", - "k=0\n", - "R=(1-w_m/w_s)*(2.339*a*V1)/(I_d*(1-k)) \n", - "print(\"value of chopper resistance=%.4f ohm\" %R)\n", - "n=1320.0\n", - "T_L=T_e*(n/N)**2\n", - "I_d=T_L*w_s/(2.339*a*V1) \n", - "print(\"Inductor current=%.3f A\" %I_d)\n", - "w_m=2*math.pi*n/60\n", - "k=1-((1-w_m/w_s)*(2.339*a*V1)/(I_d*R)) \n", - "print(\"value of duty cycle=%.4f\" %k)\n", - "s=(n1-n)/n1\n", - "V_d=2.339*s*a*V1 \n", - "print(\"Rectifed o/p voltage=%.3f V\" %V_d)\n", - "P=V_d*I_d\n", - "I2=math.sqrt(2/3)*I_d\n", - "r2=0.02\n", - "Pr=3*I2**2*r2\n", - "I1=a*I2\n", - "r1=0.015\n", - "Ps=3*I1**2*r1\n", - "Po=T_L*w_m\n", - "Pi=Po+Ps+Pr+P\n", - "eff=Po/Pi*100 \n", - "\n", - "#Results\n", - "print(\"Efficiency(in percent)=%.2f\" %eff)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of chopper resistance=2.0132 ohm\n", - "Inductor current=130.902 A\n", - "value of duty cycle=0.7934\n", - "Rectifed o/p voltage=54.449 V\n", - "Efficiency(in percent)=88.00\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.28, Page No 720" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "V_ph=V/math.sqrt(3)\n", - "N_s=1000.0\n", - "N=800.0\n", - "a=.7\n", - "I_d=110\n", - "R=2.0\n", - "\n", - "#Calculations\n", - "k=1-((1-N/N_s)*(2.339*a*V_ph)/(I_d*R)) \n", - "print(\"value of duty cycle=%.3f\" %k)\n", - "P=I_d**2*R*(1-k)\n", - "I1=a*I_d*math.sqrt(2/3)\n", - "r1=0.1\n", - "r2=0.08\n", - "Pr=3*I1**2*(r1+r2)\n", - "P_o=20000\n", - "P_i=P_o+Pr+P\n", - "eff=P_o/P_i*100 \n", - "print(\"Efficiency=%.2f\" %eff)\n", - "I11=math.sqrt(6)/math.pi*a*I_d\n", - "th=43\n", - "P_ip=math.sqrt(3)*V*I11*math.cos(math.radians(th))\n", - "pf=P_ip/(math.sqrt(3)*V*I11) \n", - "\n", - "#Results\n", - "print(\"Input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of duty cycle=0.656\n", - "Efficiency=70.62\n", - "Input power factor=0.7314\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.29, Page No 724" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=420.0\n", - "V1=V/math.sqrt(3)\n", - "N=1000.0\n", - "w_m=2*math.pi*N/60\n", - "N_s=1500.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "a=0.8\n", - "V_d=2.339*a*s*V1 \n", - "print(\"rectified voltage=%.2f V\" %V_d)\n", - "T=450.0\n", - "N1=1200.0\n", - "T_L=T*(N/N1)**2\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "I_d=w_s*T_L/(2.339*a*V1) \n", - "print(\"inductor current=%.2f A\" %I_d)\n", - "a_T=-.4\n", - "a1=math.degrees(math.acos(s*a/a_T))\n", - "print(\"delay angle of inverter=%.2f deg\" %a1)\n", - "\n", - "P_s=V_d*I_d\n", - "P_o=T_L*w_m\n", - "R_d=0.01\n", - "P_i=I_d**2*R_d\n", - "I2=math.sqrt(2/3)*I_d\n", - "r2=0.02\n", - "r1=0.015\n", - "P_rol=3*I2**2*r2\n", - "I1=a*I2\n", - "P_sol=3*I1**2*r1\n", - "P_i=P_o+P_rol+P_sol+P_i\n", - "eff=P_o/P_i*100 \n", - "print(\"\\nefficiency=%.2f\" %eff)\n", - "w_m=w_s*(1+(-a_T/a)*math.cos(math.radians(a1))-w_s*R_d*T_L/(2.339*a*V1)**2)\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results \n", - "print(\"motor speed=%.1f rpm\" %N)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectified voltage=151.25 V\n", - "inductor current=108.18 A\n", - "delay angle of inverter=131.81 deg\n", - "\n", - "efficiency=99.64\n", - "motor speed=996.4 rpm\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.30, Page No 726" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V/math.sqrt(3)\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V_dd=0.7\n", - "V_dt=1.5\n", - "V_d=3*math.sqrt(6)*s*E2/math.pi-2*V_dd\n", - "V1=415.0\n", - "a=math.degrees(math.acos((3*math.sqrt(2)*E2/math.pi)**-1*(-V_d+2*V_dt)))\n", - "\n", - "#Results\n", - "print(\"firing angle advance=%.2f deg\" %(180-a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle advance=70.22 deg\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.31, Page No 726" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V/math.sqrt(3)\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V_dd=.7\n", - "V_dt=1.5\n", - "a=0\n", - "u=18 #overlap angle in case of rectifier\n", - "V_d=3*math.sqrt(6)*s*E2*(math.cos(math.radians(a))+math.cos(math.radians(a+u)))/(2*math.pi)-2*V_dd\n", - "V1=415\n", - "V_ml=math.sqrt(2)*V1\n", - "u=4 #overlap anglein the inverter\n", - " #V_dc=-(3*V_ml*(math.cos(math.radians(a))+math.cos(math.radians(a+u)))/(2*math.pi)-2*V_dt)\n", - " #V_dc=V_d\n", - " #after solving % (1+math.cos(math.radians(u)))*math.cos(math.radians(a))-math.sin(math.radians(u))*math.sin(math.radians(a))=-.6425\n", - "a=math.degrees(math.acos(-.6425/(math.sqrt((1+math.cos(math.radians(u)))**2+math.sin(math.radians(u))**2))))-math.degrees(math.asin(math.sin(math.radians(a))/(1+math.cos(math.radians(u)))))\n", - "\n", - "#Results\n", - "print(\"firing angle advance=%.2f deg\" %(180-a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle advance=71.25 deg\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.32, Page No 727" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V1=415.0\n", - "a_T=s*E2/V1 \n", - "\n", - "#Results\n", - "print(\"voltage ratio of the transformer=%.2f\" %a_T)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "voltage ratio of the transformer=0.34\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.33, Page No 733" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=6.0\n", - "N_s=600.0\n", - "f1=P*N_s/120.0\n", - "V=400.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "V_t=f1*V/f \n", - "print(\"supply freq=%.0f Hz\" %V_t)\n", - "T=340.0\n", - "N=1000.0\n", - "T_L=T*(N_s/N)**2\n", - "w_s=2*math.pi*N_s/60\n", - "P=T_L*w_s\n", - "I_a=P/(math.sqrt(3)*V_t) \n", - "print(\"armature current=%.2f A\" %I_a)\n", - "Z_s=2\n", - "X_s=f1/f*math.fabs(Z_s)\n", - "V_t=V_t/math.sqrt(3)\n", - "Ef=math.sqrt(V_t**2+(I_a*X_s)**2)\n", - "print(\"excitation voltage=%.2f V\" %(math.sqrt(3)*Ef))\n", - "dl=math.degrees(math.atan(I_a*X_s/V_t))\n", - "print(\"load angle=%.2f deg\" %dl)\n", - "T_em=(3/w_s)*(Ef*V_t/X_s) \n", - "\n", - "#Results\n", - "print(\"pull out torque=%.2f Nm\" %T_em)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "supply freq=240 Hz\n", - "armature current=18.50 A\n", - "excitation voltage=243.06 V\n", - "load angle=9.10 deg\n", - "pull out torque=773.69 Nm\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.34, Page No 736" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=4.0\n", - "f=50.0\n", - "w_s=4*math.pi*f/P\n", - "X_d=8.0\n", - "X_q=2.0\n", - "T_e=80.0\n", - "V=400.0\n", - "\n", - "#Calculations\n", - "V_t=V/math.sqrt(3)\n", - "dl=(1/2)*math.degrees(math.asin(T_e*w_s/((3/2)*(V_t)**2*(1/X_q-1/X_d)))) \n", - "print(\"load angle=%.3f deg\" %dl)\n", - "I_d=V_t*math.cos(math.radians(dl))/X_d\n", - "I_q=V_t*math.sin(math.radians(dl))/X_q\n", - "I_a=math.sqrt(I_d**2+I_q**2) \n", - "print(\"armature current=%.2f A\" %I_a)\n", - "pf=T_e*w_s/(math.sqrt(3)*V*I_a) \n", - "\n", - "#Results\n", - "print(\"input power factor=%.4f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "load angle=0.000 deg\n", - "armature current=28.87 A\n", - "input power factor=0.6283\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.35, Page No 737" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_e=3.0\n", - "K_m=1.2\n", - "I_a=T_e/K_m\n", - "r_a=2.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "E_a=(0.263*math.sqrt(2)*V-I_a*r_a)/(1-55/180)\n", - "w_m=E_a/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.2f rpm\" %N)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=640.96 rpm\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.36, Page No 738" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=1360.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - " #after calculations V_t % calculated\n", - "V_t=163.45\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.4f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=5.2578 Nm\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.37, Page No 740" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=2100.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - " #after calculations V_t % calculated\n", - "V_t=227.66\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.2f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=1.94 Nm\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.38, Page No 742" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=840.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=75.0\n", - "V_t=math.sqrt(2)*V/math.pi*(1+math.cos(math.radians(a)))\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.4f Nm\" %T_e)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=10.5922 Nm\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.39, Page No 743" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=1400.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=60.0\n", - "a1=212\n", - "V_t=math.sqrt(2)*V/math.pi*(math.cos(math.radians(a))-math.cos(math.radians(a1)))+E_a*(180+a-a1)/180\n", - "r_a=3\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.3f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=5.257 Nm\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.40, Page No 745" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=600.0\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "V_t=2*math.sqrt(2)*V/math.pi*(math.cos(math.radians(a)))\n", - "r_a=3\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "\n", - "#Results\n", - "print(\"motor torque=%.3f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=13.568 Nm\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.41, Page No 745" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "r1=.6\n", - "r2=.4\n", - "s=0.04\n", - "x1=1.6\n", - "x2=1.6\n", - "Z=(r1+r2/s)+(x1+x2)\n", - "V=400.0\n", - "I1=V/Z \n", - "print(\"source current=%.3f A \" %math.degrees(math.atan(I1.imag/I1.real)))\n", - "print(\"and with %.1f deg phase\" %math.fabs(I1))\n", - "I2=V/Z\n", - "N=1500\n", - "w_s=2*math.pi*N/60\n", - "T_e=(3/w_s)*abs(I2)**2*r2/s \n", - "print(\"motor torque=%.2f Nm\" %T_e)\n", - "N_r=N*(1-s)\n", - "\n", - "f=45\n", - "N_s1=120*f/4\n", - "w_s=2*math.pi*N_s1/60\n", - "s1=(N_s1-N_r)/N_s1\n", - "Z=(r1+r2/s1)+(x1+x2)*f/50.0\n", - "V=360\n", - "I1=V/Z \n", - "print(\"source current=%.3f A \" %math.degrees(math.atan(I1.imag/I1.real)))\n", - "print(\"and with %.1f deg phase\" %math.fabs(I1))\n", - "I2=V/Z\n", - "T_e=(3/w_s)*abs(I2)**2*r2/s1 \n", - "print(\"motor torque=%.2f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "source current=0.000 A \n", - "and with 29.0 deg phase\n", - "motor torque=160.46 Nm\n", - "source current=-0.000 A \n", - "and with 142.9 deg phase\n", - "motor torque=-2598.45 Nm\n" - ] - } - ], - "prompt_number": 37 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter12_3.ipynb b/_Power_Electronics/Chapter12_3.ipynb deleted file mode 100755 index f8605d69..00000000 --- a/_Power_Electronics/Chapter12_3.ipynb +++ /dev/null @@ -1,1997 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 12 : Electic Drives" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.1, Page No 658" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_e=15.0 #Nm\n", - "K_m=0.5 #V-s/rad\n", - "I_a=T_e/K_m\n", - "n_m=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*n_m/60\n", - "E_a=K_m*w_m\n", - "r_a=0.7\n", - "V_t=E_a+I_a*r_a\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=math.degrees(math.acos(2*math.pi*V_t/V_m-1))\n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "I_Tr=I_a*math.sqrt((180-a)/360) \n", - "print(\"rms value of thyristor current=%.3f A\" %I_Tr)\n", - "I_fdr=I_a*math.sqrt((180+a)/360) \n", - "print(\"rms value of freewheeling diode current=%.3f A\" %I_fdr)\n", - "pf=V_t*I_a/(V_s*I_Tr) \n", - "\n", - "#Results \n", - "print(\"input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=65.349 deg\n", - "rms value of thyristor current=16.930 A\n", - "rms value of freewheeling diode current=24.766 A\n", - "input power factor=0.5652\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.2, Page No 660" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "\n", - "#Calculations\n", - "th1=math.sin(math.radians(E/(math.sqrt(2)*V)))\n", - "I_o=(1/(2*math.pi*R))*(2*math.sqrt(2)*230*math.cos(math.radians(th1))-E*(math.pi-2*th1*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*(math.pi-2*th1*math.pi/180)+V**2*math.sin(math.radians(2*th1))-4*math.sqrt(2)*V*E*math.cos(math.radians(th1))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or)\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.3f W\" %P_r) \n", - "print(\"supply pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=3.5679 A\n", - "power supplied to the battery=535.18 W\n", - "power dissipated by the resistor=829.760 W\n", - "supply pf=0.583\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.3 Page No 661" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=250\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30.0\n", - "k=0.03 #Nm/A**2\n", - "n_m=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*n_m/60\n", - "r=.2 #r_a+r_s\n", - "V_t=V_m/math.pi*(1+math.cos(math.radians(a)))\n", - "I_a=V_t/(k*w_m+r) \n", - "print(\"motor armature current=%.2f A\" %I_a)\n", - "T_e=k*I_a**2 \n", - "print(\"motor torque=%.3f Nm\" %T_e)\n", - "I_sr=I_a*math.sqrt((180-a)/180)\n", - "pf=(V_t*I_a)/(V_s*I_sr) \n", - "\n", - "#Results\n", - "print(\"input power factor=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor armature current=57.82 A\n", - "motor torque=100.285 Nm\n", - "input power factor=0.92\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.4, Page No 663" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "V_f=2*V_m/math.pi\n", - "r_f=200.0\n", - "I_f=V_f/r_f\n", - "T_e=85.0\n", - "K_a=0.8\n", - "\n", - "#Calculations\n", - "I_a=T_e/(I_f*K_a) \n", - "print(\"rated armature current=%.2f A\" %I_a)\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "r_a=0.2\n", - "V_t=K_a*I_f*w_m+I_a*r_a\n", - "a=math.degrees(math.acos(V_t*math.pi/(2*V_m)))\n", - "print(\"firing angle delay=%.2f deg\" %a)\n", - "E_a=V_t\n", - "w_mo=E_a/(K_a*I_f)\n", - "N=60*w_mo/(2*math.pi)\n", - "reg=((N-n_m)/n_m)*100 \n", - "print(\"speed regulation at full load=%.2f\" %reg)\n", - "I_ar=I_a\n", - "pf=(V_t*I_a)/(V_s*I_ar) \n", - "print(\"input power factor of armature convertor=%.4f\" %pf)\n", - "I_fr=I_f\n", - "I_sr=math.sqrt(I_fr**2+I_ar**2)\n", - "VA=I_sr*V_s\n", - "P=V_t*I_a+V_f*I_f\n", - "\n", - "#Results\n", - "print(\"input power factor of drive=%.4f\" %(P/VA))\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rated armature current=59.01 A\n", - "firing angle delay=57.63 deg\n", - "speed regulation at full load=6.52\n", - "input power factor of armature convertor=0.4821\n", - "input power factor of drive=0.5093\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.5 Page No 664" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "V_f=2*V_m/math.pi\n", - "\n", - "#Calculations\n", - "a1=math.degrees(math.acos(V_t*math.pi/(2*V_m))) \n", - "print(\"delay angle of field converter=%.0f deg\" %a1)\n", - "r_f=200.0\n", - "I_f=V_f/r_f\n", - "T_e=85.0\n", - "K_a=0.8\n", - "I_a=T_e/(I_f*K_a)\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "r_a=0.1\n", - "I_a=50.0\n", - "V_t=-K_a*I_f*w_m+I_a*r_a\n", - "a=math.degrees(math.acos(V_t*math.pi/(2*V_m)))\n", - "\n", - "#Results\n", - "print(\"firing angle delay of armature converter=%.3f deg\" %a)\n", - "print(\"power fed back to ac supply=%.0f W\" %(-V_t*I_a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "delay angle of field converter=58 deg\n", - "firing angle delay of armature converter=119.260 deg\n", - "power fed back to ac supply=8801 W\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.6 Page No 665" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=220.0\n", - "n_m=1500.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=10.0\n", - "r_a=1.0\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "T=5.0\n", - "I_a=T/K_m\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30.0\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "print(\"motor speed=%.2f rpm\" %N)\n", - "a=45\n", - "n_m=1000\n", - "w_m=2*math.pi*n_m/60\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "I_a=(V_t-K_m*w_m)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"torque developed=%.3f Nm\" %T_e)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=1254.22 rpm\n", - "torque developed=8.586 Nm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.7, Page No 666" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=220.0\n", - "n_m=1000.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=60.0\n", - "r_a=.1\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "V_s=230\n", - "V_m=math.sqrt(2)*V_s\n", - "print(\"for 600rpm speed\")\n", - "n_m=600.0\n", - "w_m=2*math.pi*n_m/60\n", - "a=math.degrees(math.acos((K_m*w_m+I_a*r_a)*math.pi/(2*V_m))) \n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"for -500rpm speed\")\n", - "n_m=-500.0\n", - "w_m=2*math.pi*n_m/60\n", - "a=math.degrees(math.acos((K_m*w_m+I_a*r_a)*math.pi/(2*V_m)))\n", - "print(\"firing angle=%.2f deg\" %a)\n", - "I_a=I_a/2\n", - "a=150\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.3f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for 600rpm speed\n", - "firing angle=49.530 deg\n", - "for -500rpm speed\n", - "firing angle=119.19 deg\n", - "motor speed=-852.011 rpm\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.8 Page No 672" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.5\n", - "T_e=50.0\n", - "I_a=T_e/K_m\n", - "r_a=0.9\n", - "a=45.0\n", - "V_s=415.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_s\n", - "w_m=((3*V_ml*(1+math.cos(math.radians(a)))/(2*math.pi))-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.2f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=2854.42 rpm\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.9 Page No 672" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_t=600\n", - "n_m=1500.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=80.0\n", - "r_a=1.0\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "print(\"for firing angle=45deg and speed=1200rpm\")\n", - "a=45.0\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=(3*V_m*(1+math.cos(math.radians(a)))/(2*math.pi)-K_m*w_m)/r_a\n", - "I_sr=I_a*math.sqrt(2/3) \n", - "print(\"rms value of source current=%.3f A\" %I_sr)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_a*math.sqrt(1/3)))\n", - "print(\"avg value of thyristor current=%.2f A\" %I_a*(1/3))\n", - "pf=(3/(2*math.pi)*(1+math.cos(math.radians(a)))) \n", - "print(\"input power factor=%.3f\" %pf)\n", - "\n", - "print(\"for firing angle=90deg and speed=700rpm\")\n", - "a=90\n", - "n_m=700\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=(3*V_m*(1+math.cos(math.radians(a)))/(2*math.pi)-K_m*w_m)/r_a\n", - "I_sr=I_a*math.sqrt(90/180) \n", - "\n", - "\n", - "#Results\n", - "print(\"rms value of source current=%.3f A\" %I_sr)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_a*math.sqrt(90.0/360)))\n", - "print(\"avg value of thyristor current=%.3f A\" %I_a*(1/3))\n", - "pf=(math.sqrt(6)/(2*math.pi)*(1+math.cos(math.radians(a))))*math.sqrt(180/(180-a)) \n", - "print(\"input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=45deg and speed=1200rpm\n", - "rms value of source current=0.000 A\n", - "rms value of thyristor current=0.000 A\n", - "\n", - "input power factor=0.815\n", - "for firing angle=90deg and speed=700rpm\n", - "rms value of source current=0.000 A\n", - "rms value of thyristor current=195.558 A\n", - "\n", - "input power factor=0.5513\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.10 Page No 676" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30\n", - "V_t=3*V_m*math.cos(math.radians(a))/math.pi\n", - "I_a=21.0\n", - "r_a=.1\n", - "V_d=2.0\n", - "K_m=1.6\n", - "\n", - "#Calculations\n", - "w_m=(V_t-I_a*r_a-V_d)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "print(\"speed of motor=%.1f rpm\" %N)\n", - "\n", - "N=2000\n", - "w_m=2*math.pi*N/60\n", - "I_a=210\n", - "V_t=K_m*w_m+I_a*r_a+V_d\n", - "a=math.degrees(math.acos(V_t*math.pi/(3*V_m)))\n", - "print(\"firing angle=%.2f deg\" %a)\n", - "I_sr=I_a*math.sqrt(2.0/3.0)\n", - "pf=V_t*I_a/(math.sqrt(3)*V_s*I_sr) \n", - "print(\"supply power factor=%.3f\" %pf)\n", - "\n", - "I_a=21\n", - "w_m=(V_t-I_a*r_a-V_d)/K_m\n", - "n=w_m*60/(2*math.pi)\n", - "reg=(n-N)/N*100 \n", - "\n", - "#Results\n", - "print(\"speed regulation(percent)=%.2f\" %reg)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of motor=2767.6 rpm\n", - "firing angle=48.48 deg\n", - "supply power factor=0.633\n", - "speed regulation(percent)=5.64\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.11, Page No 677" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=230.0\n", - "V_l=V_t*math.pi/(3*math.sqrt(2))\n", - "V_ph=V_l/math.sqrt(3)\n", - "V_in=400 #per phase voltage input\n", - "\n", - "#Calculations\n", - "N1=1500.0\n", - "I_a1=20.0\n", - "r_a1=.6\n", - "E_a1=V_t-I_a1*r_a1\n", - "n1=1000.0\n", - "E_a2=E_a1/1500.0*1000.0\n", - "V_t1=E_a1+I_a1*r_a1\n", - "a1=math.degrees(math.acos(V_t1*math.pi/(3*math.sqrt(2.0)*V_l)))\n", - "I_a2=.5*I_a1\n", - "n2=-900.0\n", - "V_t2=n2*E_a2/N1+I_a2*r_a1\n", - "a2=math.degrees(math.acos(V_t2*math.pi/(3*math.sqrt(2)*V_l))) \n", - "\n", - "#Results\n", - "print(\"transformer phase turns ratio=%.3f\" %(V_in/V_ph))\n", - "print(\"for motor running at 1000rpm at rated torque\")\n", - "print(\"firing angle delay=%.2f deg\" %a1)\n", - "print(\"for motor running at -900rpm at half of rated torque\")\n", - "print(\"firing angle delay=%.3f deg\" %a2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transformer phase turns ratio=4.068\n", - "for motor running at 1000rpm at rated torque\n", - "firing angle delay=0.00 deg\n", - "for motor running at -900rpm at half of rated torque\n", - "firing angle delay=110.674 deg\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.12, Page No 678" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=400\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_f=3*V_ml/math.pi\n", - "R_f=300.0\n", - "I_f=V_f/R_f\n", - "T_e=60.0\n", - "k=1.1\n", - "\n", - "#Calculations\n", - "I_a=T_e/(k*I_f)\n", - "N1=1000.0\n", - "w_m1=2*math.pi*N1/60\n", - "r_a1=.3\n", - "V_t1=k*I_f*w_m1+I_a*r_a1\n", - "a1=math.degrees(math.acos(V_f*math.pi/(3*V_ml)))\n", - "N2=3000\n", - "w_m2=2*math.pi*N/60\n", - "a2=0\n", - "V_t2=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "I_f2=(V_t2-I_a*r_a)/(w_m2*k)\n", - "V_f2=I_f2*R_f\n", - "a2=math.degrees(math.acos(V_f2*math.pi/(3*V_ml)))\n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"firing angle=%.3f deg\" %a)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=48.477 deg\n", - "firing angle=48.477 deg\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.13, Page No 679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - " #after calculating\n", - " #t=w_m/6000-math.pi/360\n", - "\n", - "N=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "t=w_m/6000-math.pi/360 \n", - "\n", - "#Results\n", - "print(\"time reqd=%.2f s\" %t)\n", - " #printing mistake in the answer in book" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time reqd=0.01 s\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.14, Page No 679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=1.0 #supposition\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "I_s1=2*math.sqrt(2)/math.pi*I_a*math.sin(math.radians(a))\n", - "I_s3=2*math.sqrt(2)/(3*math.pi)*I_a*math.sin(math.radians(3*a))\n", - "I_s5=2*math.sqrt(2)/(5*math.pi)*I_a*math.sin(math.radians(5*a))\n", - "per3=I_s3/I_s1*100 \n", - "print(\"percent of 3rd harmonic current in fundamental=%.2f\" %per3)\n", - "per5=I_s5/I_s1*100 \n", - "\n", - "#Results\n", - "print(\"percent of 5th harmonic current in fundamental=%.2f\" %per5)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "percent of 3rd harmonic current in fundamental=0.00\n", - "percent of 5th harmonic current in fundamental=-20.00\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.15, Page No 680" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=60.0\n", - "I_TA=I_a/3 \n", - "\n", - "#Calculations\n", - "print(\"avg thyristor current=%.0f A\" %I_TA)\n", - "I_Tr=I_a/math.sqrt(3) \n", - "print(\"rms thyristor current=%.3f A\" %I_Tr)\n", - "V_s=400\n", - "V_m=math.sqrt(2)*V_s\n", - "I_sr=I_a*math.sqrt(2.0/3)\n", - "a=150\n", - "V_t=3*V_m*math.cos(math.radians(a))/math.pi\n", - "pf=V_t*I_a/(math.sqrt(3)*V_s*I_sr) \n", - "print(\"power factor of ac source=%.3f\" %pf)\n", - "\n", - "r_a=0.5\n", - "K_m=2.4\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"Speed of motor=%.2f rpm\" %N)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg thyristor current=20 A\n", - "rms thyristor current=34.641 A\n", - "power factor of ac source=-0.827\n", - "Speed of motor=-1980.76 rpm\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.16, Page No 685" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=300.0\n", - "V_s=600.0\n", - "a=0.6\n", - "V_t=a*V_s\n", - "P=V_t*I_a \n", - "\n", - "#Calculations\n", - "print(\"input power from source=%.0f kW\" %(P/1000))\n", - "R_eq=V_s/(a*I_a) \n", - "print(\"equivalent input resistance=%.3f ohm\" %R_eq)\n", - "k=.004\n", - "R=.04+.06\n", - "w_m=(a*V_s-I_a*R)/(k*I_a)\n", - "N=w_m*60/(2*math.pi) \n", - "print(\"motor speed=%.1f rpm\" %N)\n", - "T_e=k*I_a**2 \n", - "\n", - "#Results\n", - "print(\"motor torque=%.0f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "input power from source=108 kW\n", - "equivalent input resistance=3.333 ohm\n", - "motor speed=2626.1 rpm\n", - "motor torque=360 Nm\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.17, Page No 686" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_on=10.0\n", - "T_off=15.0\n", - "\n", - "#Calculations\n", - "a=T_on/(T_on+T_off)\n", - "V_s=230.0\n", - "V_t=a*V_s\n", - "r_a=3\n", - "K_m=.5\n", - "N=1500\n", - "w_m=2*math.pi*N/60\n", - "I_a=(V_t-K_m*w_m)/r_a \n", - "\n", - "#Results\n", - "print(\"motor load current=%.3f A\" %I_a)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor load current=4.487 A\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.18, Page No 686" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "w_m=0 \n", - "print(\"lower limit of speed control=%.0f rpm\" %w_m)\n", - "I_a=25.0\n", - "r_a=.2\n", - "V_s=220\n", - "K_m=0.08\n", - "\n", - "#Calculations\n", - "a=(K_m*w_m+I_a*r_a)/V_s \n", - "print(\"lower limit of duty cycle=%.3f\" %a)\n", - "a=1 \n", - "print(\"upper limit of duty cycle=%.0f\" %a)\n", - "w_m=(a*V_s-I_a*r_a)/K_m \n", - "\n", - "#Results\n", - "print(\"upper limit of speed control=%.1f rpm\" %w_m)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "lower limit of speed control=0 rpm\n", - "lower limit of duty cycle=0.023\n", - "upper limit of duty cycle=1\n", - "upper limit of speed control=2687.5 rpm\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.21, Page No 691" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.6\n", - "V_s=400.0\n", - "V_t=(1-a)*V_s\n", - "I_a=300.0\n", - "P=V_t*I_a \n", - "\n", - "#Calculations \n", - "print(\"power returned=%.0f kW\" %(P/1000))\n", - "r_a=.2\n", - "K_m=1.2\n", - "R_eq=(1-a)*V_s/I_a+r_a \n", - "print(\"equivalent load resistance=%.4f ohm\" %R_eq)\n", - "w_mn=I_a*r_a/K_m\n", - "N=w_mn*60/(2*math.pi) \n", - "print(\"min braking speed=%.2f rpm\" %N)\n", - "w_mx=(V_s+I_a*r_a)/K_m\n", - "N=w_mx*60/(2*math.pi) \n", - "print(\"max braking speed=%.1f rpm\" %N)\n", - "w_m=(V_t+I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"max braking speed=%.1f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power returned=48 kW\n", - "equivalent load resistance=0.7333 ohm\n", - "min braking speed=477.46 rpm\n", - "max braking speed=3660.6 rpm\n", - "max braking speed=1750.7 rpm\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.22, Page No 699" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "N=1500.0\n", - "\n", - "#Calculations\n", - "print(\"when speed=1455rpm\")\n", - "n=1455.0\n", - "s1=(N-n)/N\n", - "r=math.sqrt(1/3)*(2/3)/(math.sqrt(s1)*(1-s1)) \n", - "print(\"I_2mx/I_2r=%.3f\" %r)\n", - "print(\"when speed=1350rpm\")\n", - "n=1350\n", - "s1=(N-n)/N\n", - "r=math.sqrt(1/3)*(2/3)/(math.sqrt(s1)*(1-s1)) \n", - "\n", - "#Results\n", - "print(\"I_2mx/I_2r=%.3f\" %r)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when speed=1455rpm\n", - "I_2mx/I_2r=0.000\n", - "when speed=1350rpm\n", - "I_2mx/I_2r=0.000\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.24, Page No 705" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V1=400.0\n", - "r1=0.6\n", - "r2=0.4\n", - "s=1.0\n", - "x1=1.6\n", - "x2=1.6\n", - "\n", - "#Calculations\n", - "print(\"at starting in normal conditions\")\n", - "I_n=V1/math.sqrt((r1+r2/s)**2+(x1+x2)**2) \n", - "print(\"current=%.2f A\" %I_n)\n", - "pf=(r1+r2)/math.sqrt((r1+r2/s)**2+(x1+x2)**2) \n", - "print(\"pf=%.4f\" %pf)\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_n**2*(r2/s) \n", - "print(\"\\nTorque developed=%.2f Nm\" %T_en)\n", - "print(\"motor is operated with DOL starting\")\n", - "I_d=V1/2/math.sqrt((r1+r2/s)**2+((x1+x2)/2)**2) \n", - "print(\"current=%.0f A\" %I_d)\n", - "pf=(r1+r2)/math.sqrt((r1+r2/s)**2+((x1+x2)/2)**2) \n", - "print(\"pf=%.2f\" %pf)\n", - "f1=25\n", - "w_s=4*math.pi*f1/4\n", - "T_ed=(3/w_s)*I_d**2*(r2/s) \n", - "print(\"Torque developed=%.3f Nm\" %T_ed)\n", - "print(\"at max torque conditions\")\n", - "s_mn=r2/math.sqrt((r1)**2+((x1+x2))**2)\n", - "I_n=V1/math.sqrt((r1+r2/s_mn)**2+(x1+x2)**2) \n", - "print(\"current=%.3f A\" %I_n)\n", - "pf=(r1+r2/s_mn)/math.sqrt((r1+r2/s_mn)**2+(x1+x2)**2) \n", - "print(\"pf=%.4f\" %pf)\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_n**2*(r2/s_mn) \n", - "print(\"Torque developed=%.2f Nm\" %T_en)\n", - "print(\"motor is operated with DOL starting\")\n", - "s_mn=r2/math.sqrt((r1)**2+((x1+x2)/2)**2)\n", - "I_d=V1/2/math.sqrt((r1+r2/s_mn)**2+((x1+x2)/2)**2) \n", - "print(\"current=%.3f A\" %I_d)\n", - "pf=(r1+r2/s_mn)/math.sqrt((r1+r2/s_mn)**2+((x1+x2)/2)**2) \n", - "print(\"\\npf=%.3f\" %pf)\n", - "f1=25\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_d**2*(r2/s_mn) \n", - "\n", - "\n", - "#Results \n", - "print(\"Torque developed=%.3f Nm\" %T_en)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "at starting in normal conditions\n", - "current=119.31 A\n", - "pf=0.2983\n", - "\n", - "Torque developed=108.75 Nm\n", - "motor is operated with DOL starting\n", - "current=106 A\n", - "pf=0.53\n", - "Torque developed=171.673 Nm\n", - "at max torque conditions\n", - "current=79.829 A\n", - "pf=0.7695\n", - "Torque developed=396.26 Nm\n", - "motor is operated with DOL starting\n", - "current=71.199 A\n", - "\n", - "pf=0.822\n", - "Torque developed=330.883 Nm\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.25, Page No 709" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "x1=1.0\n", - "X_m=50.0\n", - "X_e=x1*X_m/(x1+X_m)\n", - "V=231.0\n", - "V_e=V*X_m/(x1+X_m)\n", - "x2=1.0\n", - "r2=.4\n", - "r1=0\n", - "\n", - "#Calculations\n", - "s_m=r2/(x2+X_e) \n", - "print(\"slip at max torque=%.2f\" %s_m)\n", - "s_mT=r2/(x2+X_m) \n", - "print(\"slip at max torque=%.5f\" %s_mT)\n", - "f1=50.0\n", - "w_s=4*math.pi*f1/4\n", - "print(\"for constant voltage input\")\n", - "T_est=(3/w_s)*(V_e/math.sqrt(r2**2+(x2+X_e)**2))**2*(r2) \n", - "print(\"starting torque=%.3f Nm\" %T_est)\n", - "T_em=(3/w_s)*V_e**2/(2*(x2+X_e)) \n", - "print(\"maximum torque developed=%.2f Nm\" %T_em)\n", - "print(\"for constant current input\")\n", - "I1=28\n", - "T_est=(3/w_s)*(I1*X_m)**2/(r2**2+(x2+X_m)**2)*r2 \n", - "print(\"starting torque=%.3f Nm\" %T_est)\n", - "T_em=(3/w_s)*(I1*X_m)**2/(2*(x2+X_m)) \n", - "print(\"maximum torque developed=%.3f Nm\" %T_em)\n", - "s=s_mT\n", - "i=1\n", - "I_m=I1*(r2/s+i*x2)/(r2/s+i*(x2+X_m))\n", - "I_m=math.fabs(I_m)\n", - "V1=math.sqrt(3)*I_m*X_m \n", - "\n", - "#Results\n", - "print(\"supply voltage reqd=%.1f V\" %V1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "slip at max torque=0.20\n", - "slip at max torque=0.00784\n", - "for constant voltage input\n", - "starting torque=95.988 Nm\n", - "maximum torque developed=247.31 Nm\n", - "for constant current input\n", - "starting torque=5.756 Nm\n", - "maximum torque developed=366.993 Nm\n", - "supply voltage reqd=1236.2 V\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.27, Page No 718" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=420.0\n", - "V1=V/math.sqrt(3)\n", - "T_e=450.0\n", - "N=1440.0\n", - "n=1000.0\n", - "T_L=T_e*(n/N)**2\n", - "n1=1500.0\n", - "\n", - "#Calculations\n", - "w_s=2*math.pi*n1/60\n", - "w_m=2*math.pi*n/60\n", - "a=.8\n", - "I_d=T_L*w_s/(2.339*a*V1)\n", - "k=0\n", - "R=(1-w_m/w_s)*(2.339*a*V1)/(I_d*(1-k)) \n", - "print(\"value of chopper resistance=%.4f ohm\" %R)\n", - "n=1320.0\n", - "T_L=T_e*(n/N)**2\n", - "I_d=T_L*w_s/(2.339*a*V1) \n", - "print(\"Inductor current=%.3f A\" %I_d)\n", - "w_m=2*math.pi*n/60\n", - "k=1-((1-w_m/w_s)*(2.339*a*V1)/(I_d*R)) \n", - "print(\"value of duty cycle=%.4f\" %k)\n", - "s=(n1-n)/n1\n", - "V_d=2.339*s*a*V1 \n", - "print(\"Rectifed o/p voltage=%.3f V\" %V_d)\n", - "P=V_d*I_d\n", - "I2=math.sqrt(2/3)*I_d\n", - "r2=0.02\n", - "Pr=3*I2**2*r2\n", - "I1=a*I2\n", - "r1=0.015\n", - "Ps=3*I1**2*r1\n", - "Po=T_L*w_m\n", - "Pi=Po+Ps+Pr+P\n", - "eff=Po/Pi*100 \n", - "\n", - "#Results\n", - "print(\"Efficiency(in percent)=%.2f\" %eff)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of chopper resistance=2.0132 ohm\n", - "Inductor current=130.902 A\n", - "value of duty cycle=0.7934\n", - "Rectifed o/p voltage=54.449 V\n", - "Efficiency(in percent)=88.00\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.28, Page No 720" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "V_ph=V/math.sqrt(3)\n", - "N_s=1000.0\n", - "N=800.0\n", - "a=.7\n", - "I_d=110\n", - "R=2.0\n", - "\n", - "#Calculations\n", - "k=1-((1-N/N_s)*(2.339*a*V_ph)/(I_d*R)) \n", - "print(\"value of duty cycle=%.3f\" %k)\n", - "P=I_d**2*R*(1-k)\n", - "I1=a*I_d*math.sqrt(2/3)\n", - "r1=0.1\n", - "r2=0.08\n", - "Pr=3*I1**2*(r1+r2)\n", - "P_o=20000\n", - "P_i=P_o+Pr+P\n", - "eff=P_o/P_i*100 \n", - "print(\"Efficiency=%.2f\" %eff)\n", - "I11=math.sqrt(6)/math.pi*a*I_d\n", - "th=43\n", - "P_ip=math.sqrt(3)*V*I11*math.cos(math.radians(th))\n", - "pf=P_ip/(math.sqrt(3)*V*I11) \n", - "\n", - "#Results\n", - "print(\"Input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of duty cycle=0.656\n", - "Efficiency=70.62\n", - "Input power factor=0.7314\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.29, Page No 724" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=420.0\n", - "V1=V/math.sqrt(3)\n", - "N=1000.0\n", - "w_m=2*math.pi*N/60\n", - "N_s=1500.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "a=0.8\n", - "V_d=2.339*a*s*V1 \n", - "print(\"rectified voltage=%.2f V\" %V_d)\n", - "T=450.0\n", - "N1=1200.0\n", - "T_L=T*(N/N1)**2\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "I_d=w_s*T_L/(2.339*a*V1) \n", - "print(\"inductor current=%.2f A\" %I_d)\n", - "a_T=-.4\n", - "a1=math.degrees(math.acos(s*a/a_T))\n", - "print(\"delay angle of inverter=%.2f deg\" %a1)\n", - "\n", - "P_s=V_d*I_d\n", - "P_o=T_L*w_m\n", - "R_d=0.01\n", - "P_i=I_d**2*R_d\n", - "I2=math.sqrt(2/3)*I_d\n", - "r2=0.02\n", - "r1=0.015\n", - "P_rol=3*I2**2*r2\n", - "I1=a*I2\n", - "P_sol=3*I1**2*r1\n", - "P_i=P_o+P_rol+P_sol+P_i\n", - "eff=P_o/P_i*100 \n", - "print(\"\\nefficiency=%.2f\" %eff)\n", - "w_m=w_s*(1+(-a_T/a)*math.cos(math.radians(a1))-w_s*R_d*T_L/(2.339*a*V1)**2)\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results \n", - "print(\"motor speed=%.1f rpm\" %N)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectified voltage=151.25 V\n", - "inductor current=108.18 A\n", - "delay angle of inverter=131.81 deg\n", - "\n", - "efficiency=99.64\n", - "motor speed=996.4 rpm\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.30, Page No 726" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V/math.sqrt(3)\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V_dd=0.7\n", - "V_dt=1.5\n", - "V_d=3*math.sqrt(6)*s*E2/math.pi-2*V_dd\n", - "V1=415.0\n", - "a=math.degrees(math.acos((3*math.sqrt(2)*E2/math.pi)**-1*(-V_d+2*V_dt)))\n", - "\n", - "#Results\n", - "print(\"firing angle advance=%.2f deg\" %(180-a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle advance=70.22 deg\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.31, Page No 726" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V/math.sqrt(3)\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V_dd=.7\n", - "V_dt=1.5\n", - "a=0\n", - "u=18 #overlap angle in case of rectifier\n", - "V_d=3*math.sqrt(6)*s*E2*(math.cos(math.radians(a))+math.cos(math.radians(a+u)))/(2*math.pi)-2*V_dd\n", - "V1=415\n", - "V_ml=math.sqrt(2)*V1\n", - "u=4 #overlap anglein the inverter\n", - " #V_dc=-(3*V_ml*(math.cos(math.radians(a))+math.cos(math.radians(a+u)))/(2*math.pi)-2*V_dt)\n", - " #V_dc=V_d\n", - " #after solving % (1+math.cos(math.radians(u)))*math.cos(math.radians(a))-math.sin(math.radians(u))*math.sin(math.radians(a))=-.6425\n", - "a=math.degrees(math.acos(-.6425/(math.sqrt((1+math.cos(math.radians(u)))**2+math.sin(math.radians(u))**2))))-math.degrees(math.asin(math.sin(math.radians(a))/(1+math.cos(math.radians(u)))))\n", - "\n", - "#Results\n", - "print(\"firing angle advance=%.2f deg\" %(180-a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle advance=71.25 deg\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.32, Page No 727" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V1=415.0\n", - "a_T=s*E2/V1 \n", - "\n", - "#Results\n", - "print(\"voltage ratio of the transformer=%.2f\" %a_T)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "voltage ratio of the transformer=0.34\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.33, Page No 733" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=6.0\n", - "N_s=600.0\n", - "f1=P*N_s/120.0\n", - "V=400.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "V_t=f1*V/f \n", - "print(\"supply freq=%.0f Hz\" %V_t)\n", - "T=340.0\n", - "N=1000.0\n", - "T_L=T*(N_s/N)**2\n", - "w_s=2*math.pi*N_s/60\n", - "P=T_L*w_s\n", - "I_a=P/(math.sqrt(3)*V_t) \n", - "print(\"armature current=%.2f A\" %I_a)\n", - "Z_s=2\n", - "X_s=f1/f*math.fabs(Z_s)\n", - "V_t=V_t/math.sqrt(3)\n", - "Ef=math.sqrt(V_t**2+(I_a*X_s)**2)\n", - "print(\"excitation voltage=%.2f V\" %(math.sqrt(3)*Ef))\n", - "dl=math.degrees(math.atan(I_a*X_s/V_t))\n", - "print(\"load angle=%.2f deg\" %dl)\n", - "T_em=(3/w_s)*(Ef*V_t/X_s) \n", - "\n", - "#Results\n", - "print(\"pull out torque=%.2f Nm\" %T_em)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "supply freq=240 Hz\n", - "armature current=18.50 A\n", - "excitation voltage=243.06 V\n", - "load angle=9.10 deg\n", - "pull out torque=773.69 Nm\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.34, Page No 736" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=4.0\n", - "f=50.0\n", - "w_s=4*math.pi*f/P\n", - "X_d=8.0\n", - "X_q=2.0\n", - "T_e=80.0\n", - "V=400.0\n", - "\n", - "#Calculations\n", - "V_t=V/math.sqrt(3)\n", - "dl=(1/2)*math.degrees(math.asin(T_e*w_s/((3/2)*(V_t)**2*(1/X_q-1/X_d)))) \n", - "print(\"load angle=%.3f deg\" %dl)\n", - "I_d=V_t*math.cos(math.radians(dl))/X_d\n", - "I_q=V_t*math.sin(math.radians(dl))/X_q\n", - "I_a=math.sqrt(I_d**2+I_q**2) \n", - "print(\"armature current=%.2f A\" %I_a)\n", - "pf=T_e*w_s/(math.sqrt(3)*V*I_a) \n", - "\n", - "#Results\n", - "print(\"input power factor=%.4f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "load angle=0.000 deg\n", - "armature current=28.87 A\n", - "input power factor=0.6283\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.35, Page No 737" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_e=3.0\n", - "K_m=1.2\n", - "I_a=T_e/K_m\n", - "r_a=2.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "E_a=(0.263*math.sqrt(2)*V-I_a*r_a)/(1-55/180)\n", - "w_m=E_a/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.2f rpm\" %N)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=640.96 rpm\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.36, Page No 738" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=1360.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - " #after calculations V_t % calculated\n", - "V_t=163.45\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.4f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=5.2578 Nm\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.37, Page No 740" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=2100.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - " #after calculations V_t % calculated\n", - "V_t=227.66\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.2f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=1.94 Nm\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.38, Page No 742" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=840.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=75.0\n", - "V_t=math.sqrt(2)*V/math.pi*(1+math.cos(math.radians(a)))\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.4f Nm\" %T_e)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=10.5922 Nm\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.39, Page No 743" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=1400.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=60.0\n", - "a1=212\n", - "V_t=math.sqrt(2)*V/math.pi*(math.cos(math.radians(a))-math.cos(math.radians(a1)))+E_a*(180+a-a1)/180\n", - "r_a=3\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.3f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=5.257 Nm\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.40, Page No 745" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=600.0\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "V_t=2*math.sqrt(2)*V/math.pi*(math.cos(math.radians(a)))\n", - "r_a=3\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "\n", - "#Results\n", - "print(\"motor torque=%.3f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=13.568 Nm\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.41, Page No 745" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "r1=.6\n", - "r2=.4\n", - "s=0.04\n", - "x1=1.6\n", - "x2=1.6\n", - "Z=(r1+r2/s)+(x1+x2)\n", - "V=400.0\n", - "I1=V/Z \n", - "print(\"source current=%.3f A \" %math.degrees(math.atan(I1.imag/I1.real)))\n", - "print(\"and with %.1f deg phase\" %math.fabs(I1))\n", - "I2=V/Z\n", - "N=1500\n", - "w_s=2*math.pi*N/60\n", - "T_e=(3/w_s)*abs(I2)**2*r2/s \n", - "print(\"motor torque=%.2f Nm\" %T_e)\n", - "N_r=N*(1-s)\n", - "\n", - "f=45\n", - "N_s1=120*f/4\n", - "w_s=2*math.pi*N_s1/60\n", - "s1=(N_s1-N_r)/N_s1\n", - "Z=(r1+r2/s1)+(x1+x2)*f/50.0\n", - "V=360\n", - "I1=V/Z \n", - "print(\"source current=%.3f A \" %math.degrees(math.atan(I1.imag/I1.real)))\n", - "print(\"and with %.1f deg phase\" %math.fabs(I1))\n", - "I2=V/Z\n", - "T_e=(3/w_s)*abs(I2)**2*r2/s1 \n", - "print(\"motor torque=%.2f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "source current=0.000 A \n", - "and with 29.0 deg phase\n", - "motor torque=160.46 Nm\n", - "source current=-0.000 A \n", - "and with 142.9 deg phase\n", - "motor torque=-2598.45 Nm\n" - ] - } - ], - "prompt_number": 37 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter12_4.ipynb b/_Power_Electronics/Chapter12_4.ipynb deleted file mode 100755 index f8605d69..00000000 --- a/_Power_Electronics/Chapter12_4.ipynb +++ /dev/null @@ -1,1997 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 12 : Electic Drives" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.1, Page No 658" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_e=15.0 #Nm\n", - "K_m=0.5 #V-s/rad\n", - "I_a=T_e/K_m\n", - "n_m=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*n_m/60\n", - "E_a=K_m*w_m\n", - "r_a=0.7\n", - "V_t=E_a+I_a*r_a\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=math.degrees(math.acos(2*math.pi*V_t/V_m-1))\n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "I_Tr=I_a*math.sqrt((180-a)/360) \n", - "print(\"rms value of thyristor current=%.3f A\" %I_Tr)\n", - "I_fdr=I_a*math.sqrt((180+a)/360) \n", - "print(\"rms value of freewheeling diode current=%.3f A\" %I_fdr)\n", - "pf=V_t*I_a/(V_s*I_Tr) \n", - "\n", - "#Results \n", - "print(\"input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=65.349 deg\n", - "rms value of thyristor current=16.930 A\n", - "rms value of freewheeling diode current=24.766 A\n", - "input power factor=0.5652\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.2, Page No 660" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "\n", - "#Calculations\n", - "th1=math.sin(math.radians(E/(math.sqrt(2)*V)))\n", - "I_o=(1/(2*math.pi*R))*(2*math.sqrt(2)*230*math.cos(math.radians(th1))-E*(math.pi-2*th1*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*(math.pi-2*th1*math.pi/180)+V**2*math.sin(math.radians(2*th1))-4*math.sqrt(2)*V*E*math.cos(math.radians(th1))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or)\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.3f W\" %P_r) \n", - "print(\"supply pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=3.5679 A\n", - "power supplied to the battery=535.18 W\n", - "power dissipated by the resistor=829.760 W\n", - "supply pf=0.583\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.3 Page No 661" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=250\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30.0\n", - "k=0.03 #Nm/A**2\n", - "n_m=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*n_m/60\n", - "r=.2 #r_a+r_s\n", - "V_t=V_m/math.pi*(1+math.cos(math.radians(a)))\n", - "I_a=V_t/(k*w_m+r) \n", - "print(\"motor armature current=%.2f A\" %I_a)\n", - "T_e=k*I_a**2 \n", - "print(\"motor torque=%.3f Nm\" %T_e)\n", - "I_sr=I_a*math.sqrt((180-a)/180)\n", - "pf=(V_t*I_a)/(V_s*I_sr) \n", - "\n", - "#Results\n", - "print(\"input power factor=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor armature current=57.82 A\n", - "motor torque=100.285 Nm\n", - "input power factor=0.92\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.4, Page No 663" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "V_f=2*V_m/math.pi\n", - "r_f=200.0\n", - "I_f=V_f/r_f\n", - "T_e=85.0\n", - "K_a=0.8\n", - "\n", - "#Calculations\n", - "I_a=T_e/(I_f*K_a) \n", - "print(\"rated armature current=%.2f A\" %I_a)\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "r_a=0.2\n", - "V_t=K_a*I_f*w_m+I_a*r_a\n", - "a=math.degrees(math.acos(V_t*math.pi/(2*V_m)))\n", - "print(\"firing angle delay=%.2f deg\" %a)\n", - "E_a=V_t\n", - "w_mo=E_a/(K_a*I_f)\n", - "N=60*w_mo/(2*math.pi)\n", - "reg=((N-n_m)/n_m)*100 \n", - "print(\"speed regulation at full load=%.2f\" %reg)\n", - "I_ar=I_a\n", - "pf=(V_t*I_a)/(V_s*I_ar) \n", - "print(\"input power factor of armature convertor=%.4f\" %pf)\n", - "I_fr=I_f\n", - "I_sr=math.sqrt(I_fr**2+I_ar**2)\n", - "VA=I_sr*V_s\n", - "P=V_t*I_a+V_f*I_f\n", - "\n", - "#Results\n", - "print(\"input power factor of drive=%.4f\" %(P/VA))\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rated armature current=59.01 A\n", - "firing angle delay=57.63 deg\n", - "speed regulation at full load=6.52\n", - "input power factor of armature convertor=0.4821\n", - "input power factor of drive=0.5093\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.5 Page No 664" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "V_f=2*V_m/math.pi\n", - "\n", - "#Calculations\n", - "a1=math.degrees(math.acos(V_t*math.pi/(2*V_m))) \n", - "print(\"delay angle of field converter=%.0f deg\" %a1)\n", - "r_f=200.0\n", - "I_f=V_f/r_f\n", - "T_e=85.0\n", - "K_a=0.8\n", - "I_a=T_e/(I_f*K_a)\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "r_a=0.1\n", - "I_a=50.0\n", - "V_t=-K_a*I_f*w_m+I_a*r_a\n", - "a=math.degrees(math.acos(V_t*math.pi/(2*V_m)))\n", - "\n", - "#Results\n", - "print(\"firing angle delay of armature converter=%.3f deg\" %a)\n", - "print(\"power fed back to ac supply=%.0f W\" %(-V_t*I_a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "delay angle of field converter=58 deg\n", - "firing angle delay of armature converter=119.260 deg\n", - "power fed back to ac supply=8801 W\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.6 Page No 665" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=220.0\n", - "n_m=1500.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=10.0\n", - "r_a=1.0\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "T=5.0\n", - "I_a=T/K_m\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30.0\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "print(\"motor speed=%.2f rpm\" %N)\n", - "a=45\n", - "n_m=1000\n", - "w_m=2*math.pi*n_m/60\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "I_a=(V_t-K_m*w_m)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"torque developed=%.3f Nm\" %T_e)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=1254.22 rpm\n", - "torque developed=8.586 Nm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.7, Page No 666" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=220.0\n", - "n_m=1000.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=60.0\n", - "r_a=.1\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "V_s=230\n", - "V_m=math.sqrt(2)*V_s\n", - "print(\"for 600rpm speed\")\n", - "n_m=600.0\n", - "w_m=2*math.pi*n_m/60\n", - "a=math.degrees(math.acos((K_m*w_m+I_a*r_a)*math.pi/(2*V_m))) \n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"for -500rpm speed\")\n", - "n_m=-500.0\n", - "w_m=2*math.pi*n_m/60\n", - "a=math.degrees(math.acos((K_m*w_m+I_a*r_a)*math.pi/(2*V_m)))\n", - "print(\"firing angle=%.2f deg\" %a)\n", - "I_a=I_a/2\n", - "a=150\n", - "V_t=2*V_m*math.cos(math.radians(a))/math.pi\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.3f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for 600rpm speed\n", - "firing angle=49.530 deg\n", - "for -500rpm speed\n", - "firing angle=119.19 deg\n", - "motor speed=-852.011 rpm\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.8 Page No 672" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.5\n", - "T_e=50.0\n", - "I_a=T_e/K_m\n", - "r_a=0.9\n", - "a=45.0\n", - "V_s=415.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_s\n", - "w_m=((3*V_ml*(1+math.cos(math.radians(a)))/(2*math.pi))-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.2f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=2854.42 rpm\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.9 Page No 672" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_t=600\n", - "n_m=1500.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=80.0\n", - "r_a=1.0\n", - "\n", - "#Calculations\n", - "K_m=(V_t-I_a*r_a)/(w_m)\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "print(\"for firing angle=45deg and speed=1200rpm\")\n", - "a=45.0\n", - "n_m=1200.0\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=(3*V_m*(1+math.cos(math.radians(a)))/(2*math.pi)-K_m*w_m)/r_a\n", - "I_sr=I_a*math.sqrt(2/3) \n", - "print(\"rms value of source current=%.3f A\" %I_sr)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_a*math.sqrt(1/3)))\n", - "print(\"avg value of thyristor current=%.2f A\" %I_a*(1/3))\n", - "pf=(3/(2*math.pi)*(1+math.cos(math.radians(a)))) \n", - "print(\"input power factor=%.3f\" %pf)\n", - "\n", - "print(\"for firing angle=90deg and speed=700rpm\")\n", - "a=90\n", - "n_m=700\n", - "w_m=2*math.pi*n_m/60\n", - "I_a=(3*V_m*(1+math.cos(math.radians(a)))/(2*math.pi)-K_m*w_m)/r_a\n", - "I_sr=I_a*math.sqrt(90/180) \n", - "\n", - "\n", - "#Results\n", - "print(\"rms value of source current=%.3f A\" %I_sr)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_a*math.sqrt(90.0/360)))\n", - "print(\"avg value of thyristor current=%.3f A\" %I_a*(1/3))\n", - "pf=(math.sqrt(6)/(2*math.pi)*(1+math.cos(math.radians(a))))*math.sqrt(180/(180-a)) \n", - "print(\"input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=45deg and speed=1200rpm\n", - "rms value of source current=0.000 A\n", - "rms value of thyristor current=0.000 A\n", - "\n", - "input power factor=0.815\n", - "for firing angle=90deg and speed=700rpm\n", - "rms value of source current=0.000 A\n", - "rms value of thyristor current=195.558 A\n", - "\n", - "input power factor=0.5513\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.10 Page No 676" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=30\n", - "V_t=3*V_m*math.cos(math.radians(a))/math.pi\n", - "I_a=21.0\n", - "r_a=.1\n", - "V_d=2.0\n", - "K_m=1.6\n", - "\n", - "#Calculations\n", - "w_m=(V_t-I_a*r_a-V_d)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "print(\"speed of motor=%.1f rpm\" %N)\n", - "\n", - "N=2000\n", - "w_m=2*math.pi*N/60\n", - "I_a=210\n", - "V_t=K_m*w_m+I_a*r_a+V_d\n", - "a=math.degrees(math.acos(V_t*math.pi/(3*V_m)))\n", - "print(\"firing angle=%.2f deg\" %a)\n", - "I_sr=I_a*math.sqrt(2.0/3.0)\n", - "pf=V_t*I_a/(math.sqrt(3)*V_s*I_sr) \n", - "print(\"supply power factor=%.3f\" %pf)\n", - "\n", - "I_a=21\n", - "w_m=(V_t-I_a*r_a-V_d)/K_m\n", - "n=w_m*60/(2*math.pi)\n", - "reg=(n-N)/N*100 \n", - "\n", - "#Results\n", - "print(\"speed regulation(percent)=%.2f\" %reg)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of motor=2767.6 rpm\n", - "firing angle=48.48 deg\n", - "supply power factor=0.633\n", - "speed regulation(percent)=5.64\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.11, Page No 677" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=230.0\n", - "V_l=V_t*math.pi/(3*math.sqrt(2))\n", - "V_ph=V_l/math.sqrt(3)\n", - "V_in=400 #per phase voltage input\n", - "\n", - "#Calculations\n", - "N1=1500.0\n", - "I_a1=20.0\n", - "r_a1=.6\n", - "E_a1=V_t-I_a1*r_a1\n", - "n1=1000.0\n", - "E_a2=E_a1/1500.0*1000.0\n", - "V_t1=E_a1+I_a1*r_a1\n", - "a1=math.degrees(math.acos(V_t1*math.pi/(3*math.sqrt(2.0)*V_l)))\n", - "I_a2=.5*I_a1\n", - "n2=-900.0\n", - "V_t2=n2*E_a2/N1+I_a2*r_a1\n", - "a2=math.degrees(math.acos(V_t2*math.pi/(3*math.sqrt(2)*V_l))) \n", - "\n", - "#Results\n", - "print(\"transformer phase turns ratio=%.3f\" %(V_in/V_ph))\n", - "print(\"for motor running at 1000rpm at rated torque\")\n", - "print(\"firing angle delay=%.2f deg\" %a1)\n", - "print(\"for motor running at -900rpm at half of rated torque\")\n", - "print(\"firing angle delay=%.3f deg\" %a2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transformer phase turns ratio=4.068\n", - "for motor running at 1000rpm at rated torque\n", - "firing angle delay=0.00 deg\n", - "for motor running at -900rpm at half of rated torque\n", - "firing angle delay=110.674 deg\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.12, Page No 678" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=400\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_f=3*V_ml/math.pi\n", - "R_f=300.0\n", - "I_f=V_f/R_f\n", - "T_e=60.0\n", - "k=1.1\n", - "\n", - "#Calculations\n", - "I_a=T_e/(k*I_f)\n", - "N1=1000.0\n", - "w_m1=2*math.pi*N1/60\n", - "r_a1=.3\n", - "V_t1=k*I_f*w_m1+I_a*r_a1\n", - "a1=math.degrees(math.acos(V_f*math.pi/(3*V_ml)))\n", - "N2=3000\n", - "w_m2=2*math.pi*N/60\n", - "a2=0\n", - "V_t2=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "I_f2=(V_t2-I_a*r_a)/(w_m2*k)\n", - "V_f2=I_f2*R_f\n", - "a2=math.degrees(math.acos(V_f2*math.pi/(3*V_ml)))\n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"firing angle=%.3f deg\" %a)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=48.477 deg\n", - "firing angle=48.477 deg\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.13, Page No 679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - " #after calculating\n", - " #t=w_m/6000-math.pi/360\n", - "\n", - "N=1000.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "t=w_m/6000-math.pi/360 \n", - "\n", - "#Results\n", - "print(\"time reqd=%.2f s\" %t)\n", - " #printing mistake in the answer in book" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time reqd=0.01 s\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.14, Page No 679" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=1.0 #supposition\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "I_s1=2*math.sqrt(2)/math.pi*I_a*math.sin(math.radians(a))\n", - "I_s3=2*math.sqrt(2)/(3*math.pi)*I_a*math.sin(math.radians(3*a))\n", - "I_s5=2*math.sqrt(2)/(5*math.pi)*I_a*math.sin(math.radians(5*a))\n", - "per3=I_s3/I_s1*100 \n", - "print(\"percent of 3rd harmonic current in fundamental=%.2f\" %per3)\n", - "per5=I_s5/I_s1*100 \n", - "\n", - "#Results\n", - "print(\"percent of 5th harmonic current in fundamental=%.2f\" %per5)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "percent of 3rd harmonic current in fundamental=0.00\n", - "percent of 5th harmonic current in fundamental=-20.00\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.15, Page No 680" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=60.0\n", - "I_TA=I_a/3 \n", - "\n", - "#Calculations\n", - "print(\"avg thyristor current=%.0f A\" %I_TA)\n", - "I_Tr=I_a/math.sqrt(3) \n", - "print(\"rms thyristor current=%.3f A\" %I_Tr)\n", - "V_s=400\n", - "V_m=math.sqrt(2)*V_s\n", - "I_sr=I_a*math.sqrt(2.0/3)\n", - "a=150\n", - "V_t=3*V_m*math.cos(math.radians(a))/math.pi\n", - "pf=V_t*I_a/(math.sqrt(3)*V_s*I_sr) \n", - "print(\"power factor of ac source=%.3f\" %pf)\n", - "\n", - "r_a=0.5\n", - "K_m=2.4\n", - "w_m=(V_t-I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"Speed of motor=%.2f rpm\" %N)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg thyristor current=20 A\n", - "rms thyristor current=34.641 A\n", - "power factor of ac source=-0.827\n", - "Speed of motor=-1980.76 rpm\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.16, Page No 685" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=300.0\n", - "V_s=600.0\n", - "a=0.6\n", - "V_t=a*V_s\n", - "P=V_t*I_a \n", - "\n", - "#Calculations\n", - "print(\"input power from source=%.0f kW\" %(P/1000))\n", - "R_eq=V_s/(a*I_a) \n", - "print(\"equivalent input resistance=%.3f ohm\" %R_eq)\n", - "k=.004\n", - "R=.04+.06\n", - "w_m=(a*V_s-I_a*R)/(k*I_a)\n", - "N=w_m*60/(2*math.pi) \n", - "print(\"motor speed=%.1f rpm\" %N)\n", - "T_e=k*I_a**2 \n", - "\n", - "#Results\n", - "print(\"motor torque=%.0f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "input power from source=108 kW\n", - "equivalent input resistance=3.333 ohm\n", - "motor speed=2626.1 rpm\n", - "motor torque=360 Nm\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.17, Page No 686" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_on=10.0\n", - "T_off=15.0\n", - "\n", - "#Calculations\n", - "a=T_on/(T_on+T_off)\n", - "V_s=230.0\n", - "V_t=a*V_s\n", - "r_a=3\n", - "K_m=.5\n", - "N=1500\n", - "w_m=2*math.pi*N/60\n", - "I_a=(V_t-K_m*w_m)/r_a \n", - "\n", - "#Results\n", - "print(\"motor load current=%.3f A\" %I_a)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor load current=4.487 A\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.18, Page No 686" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "w_m=0 \n", - "print(\"lower limit of speed control=%.0f rpm\" %w_m)\n", - "I_a=25.0\n", - "r_a=.2\n", - "V_s=220\n", - "K_m=0.08\n", - "\n", - "#Calculations\n", - "a=(K_m*w_m+I_a*r_a)/V_s \n", - "print(\"lower limit of duty cycle=%.3f\" %a)\n", - "a=1 \n", - "print(\"upper limit of duty cycle=%.0f\" %a)\n", - "w_m=(a*V_s-I_a*r_a)/K_m \n", - "\n", - "#Results\n", - "print(\"upper limit of speed control=%.1f rpm\" %w_m)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "lower limit of speed control=0 rpm\n", - "lower limit of duty cycle=0.023\n", - "upper limit of duty cycle=1\n", - "upper limit of speed control=2687.5 rpm\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.21, Page No 691" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.6\n", - "V_s=400.0\n", - "V_t=(1-a)*V_s\n", - "I_a=300.0\n", - "P=V_t*I_a \n", - "\n", - "#Calculations \n", - "print(\"power returned=%.0f kW\" %(P/1000))\n", - "r_a=.2\n", - "K_m=1.2\n", - "R_eq=(1-a)*V_s/I_a+r_a \n", - "print(\"equivalent load resistance=%.4f ohm\" %R_eq)\n", - "w_mn=I_a*r_a/K_m\n", - "N=w_mn*60/(2*math.pi) \n", - "print(\"min braking speed=%.2f rpm\" %N)\n", - "w_mx=(V_s+I_a*r_a)/K_m\n", - "N=w_mx*60/(2*math.pi) \n", - "print(\"max braking speed=%.1f rpm\" %N)\n", - "w_m=(V_t+I_a*r_a)/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"max braking speed=%.1f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power returned=48 kW\n", - "equivalent load resistance=0.7333 ohm\n", - "min braking speed=477.46 rpm\n", - "max braking speed=3660.6 rpm\n", - "max braking speed=1750.7 rpm\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.22, Page No 699" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "N=1500.0\n", - "\n", - "#Calculations\n", - "print(\"when speed=1455rpm\")\n", - "n=1455.0\n", - "s1=(N-n)/N\n", - "r=math.sqrt(1/3)*(2/3)/(math.sqrt(s1)*(1-s1)) \n", - "print(\"I_2mx/I_2r=%.3f\" %r)\n", - "print(\"when speed=1350rpm\")\n", - "n=1350\n", - "s1=(N-n)/N\n", - "r=math.sqrt(1/3)*(2/3)/(math.sqrt(s1)*(1-s1)) \n", - "\n", - "#Results\n", - "print(\"I_2mx/I_2r=%.3f\" %r)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when speed=1455rpm\n", - "I_2mx/I_2r=0.000\n", - "when speed=1350rpm\n", - "I_2mx/I_2r=0.000\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.24, Page No 705" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V1=400.0\n", - "r1=0.6\n", - "r2=0.4\n", - "s=1.0\n", - "x1=1.6\n", - "x2=1.6\n", - "\n", - "#Calculations\n", - "print(\"at starting in normal conditions\")\n", - "I_n=V1/math.sqrt((r1+r2/s)**2+(x1+x2)**2) \n", - "print(\"current=%.2f A\" %I_n)\n", - "pf=(r1+r2)/math.sqrt((r1+r2/s)**2+(x1+x2)**2) \n", - "print(\"pf=%.4f\" %pf)\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_n**2*(r2/s) \n", - "print(\"\\nTorque developed=%.2f Nm\" %T_en)\n", - "print(\"motor is operated with DOL starting\")\n", - "I_d=V1/2/math.sqrt((r1+r2/s)**2+((x1+x2)/2)**2) \n", - "print(\"current=%.0f A\" %I_d)\n", - "pf=(r1+r2)/math.sqrt((r1+r2/s)**2+((x1+x2)/2)**2) \n", - "print(\"pf=%.2f\" %pf)\n", - "f1=25\n", - "w_s=4*math.pi*f1/4\n", - "T_ed=(3/w_s)*I_d**2*(r2/s) \n", - "print(\"Torque developed=%.3f Nm\" %T_ed)\n", - "print(\"at max torque conditions\")\n", - "s_mn=r2/math.sqrt((r1)**2+((x1+x2))**2)\n", - "I_n=V1/math.sqrt((r1+r2/s_mn)**2+(x1+x2)**2) \n", - "print(\"current=%.3f A\" %I_n)\n", - "pf=(r1+r2/s_mn)/math.sqrt((r1+r2/s_mn)**2+(x1+x2)**2) \n", - "print(\"pf=%.4f\" %pf)\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_n**2*(r2/s_mn) \n", - "print(\"Torque developed=%.2f Nm\" %T_en)\n", - "print(\"motor is operated with DOL starting\")\n", - "s_mn=r2/math.sqrt((r1)**2+((x1+x2)/2)**2)\n", - "I_d=V1/2/math.sqrt((r1+r2/s_mn)**2+((x1+x2)/2)**2) \n", - "print(\"current=%.3f A\" %I_d)\n", - "pf=(r1+r2/s_mn)/math.sqrt((r1+r2/s_mn)**2+((x1+x2)/2)**2) \n", - "print(\"\\npf=%.3f\" %pf)\n", - "f1=25\n", - "w_s=4*math.pi*f1/4\n", - "T_en=(3/w_s)*I_d**2*(r2/s_mn) \n", - "\n", - "\n", - "#Results \n", - "print(\"Torque developed=%.3f Nm\" %T_en)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "at starting in normal conditions\n", - "current=119.31 A\n", - "pf=0.2983\n", - "\n", - "Torque developed=108.75 Nm\n", - "motor is operated with DOL starting\n", - "current=106 A\n", - "pf=0.53\n", - "Torque developed=171.673 Nm\n", - "at max torque conditions\n", - "current=79.829 A\n", - "pf=0.7695\n", - "Torque developed=396.26 Nm\n", - "motor is operated with DOL starting\n", - "current=71.199 A\n", - "\n", - "pf=0.822\n", - "Torque developed=330.883 Nm\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.25, Page No 709" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "x1=1.0\n", - "X_m=50.0\n", - "X_e=x1*X_m/(x1+X_m)\n", - "V=231.0\n", - "V_e=V*X_m/(x1+X_m)\n", - "x2=1.0\n", - "r2=.4\n", - "r1=0\n", - "\n", - "#Calculations\n", - "s_m=r2/(x2+X_e) \n", - "print(\"slip at max torque=%.2f\" %s_m)\n", - "s_mT=r2/(x2+X_m) \n", - "print(\"slip at max torque=%.5f\" %s_mT)\n", - "f1=50.0\n", - "w_s=4*math.pi*f1/4\n", - "print(\"for constant voltage input\")\n", - "T_est=(3/w_s)*(V_e/math.sqrt(r2**2+(x2+X_e)**2))**2*(r2) \n", - "print(\"starting torque=%.3f Nm\" %T_est)\n", - "T_em=(3/w_s)*V_e**2/(2*(x2+X_e)) \n", - "print(\"maximum torque developed=%.2f Nm\" %T_em)\n", - "print(\"for constant current input\")\n", - "I1=28\n", - "T_est=(3/w_s)*(I1*X_m)**2/(r2**2+(x2+X_m)**2)*r2 \n", - "print(\"starting torque=%.3f Nm\" %T_est)\n", - "T_em=(3/w_s)*(I1*X_m)**2/(2*(x2+X_m)) \n", - "print(\"maximum torque developed=%.3f Nm\" %T_em)\n", - "s=s_mT\n", - "i=1\n", - "I_m=I1*(r2/s+i*x2)/(r2/s+i*(x2+X_m))\n", - "I_m=math.fabs(I_m)\n", - "V1=math.sqrt(3)*I_m*X_m \n", - "\n", - "#Results\n", - "print(\"supply voltage reqd=%.1f V\" %V1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "slip at max torque=0.20\n", - "slip at max torque=0.00784\n", - "for constant voltage input\n", - "starting torque=95.988 Nm\n", - "maximum torque developed=247.31 Nm\n", - "for constant current input\n", - "starting torque=5.756 Nm\n", - "maximum torque developed=366.993 Nm\n", - "supply voltage reqd=1236.2 V\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.27, Page No 718" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=420.0\n", - "V1=V/math.sqrt(3)\n", - "T_e=450.0\n", - "N=1440.0\n", - "n=1000.0\n", - "T_L=T_e*(n/N)**2\n", - "n1=1500.0\n", - "\n", - "#Calculations\n", - "w_s=2*math.pi*n1/60\n", - "w_m=2*math.pi*n/60\n", - "a=.8\n", - "I_d=T_L*w_s/(2.339*a*V1)\n", - "k=0\n", - "R=(1-w_m/w_s)*(2.339*a*V1)/(I_d*(1-k)) \n", - "print(\"value of chopper resistance=%.4f ohm\" %R)\n", - "n=1320.0\n", - "T_L=T_e*(n/N)**2\n", - "I_d=T_L*w_s/(2.339*a*V1) \n", - "print(\"Inductor current=%.3f A\" %I_d)\n", - "w_m=2*math.pi*n/60\n", - "k=1-((1-w_m/w_s)*(2.339*a*V1)/(I_d*R)) \n", - "print(\"value of duty cycle=%.4f\" %k)\n", - "s=(n1-n)/n1\n", - "V_d=2.339*s*a*V1 \n", - "print(\"Rectifed o/p voltage=%.3f V\" %V_d)\n", - "P=V_d*I_d\n", - "I2=math.sqrt(2/3)*I_d\n", - "r2=0.02\n", - "Pr=3*I2**2*r2\n", - "I1=a*I2\n", - "r1=0.015\n", - "Ps=3*I1**2*r1\n", - "Po=T_L*w_m\n", - "Pi=Po+Ps+Pr+P\n", - "eff=Po/Pi*100 \n", - "\n", - "#Results\n", - "print(\"Efficiency(in percent)=%.2f\" %eff)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of chopper resistance=2.0132 ohm\n", - "Inductor current=130.902 A\n", - "value of duty cycle=0.7934\n", - "Rectifed o/p voltage=54.449 V\n", - "Efficiency(in percent)=88.00\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.28, Page No 720" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "V_ph=V/math.sqrt(3)\n", - "N_s=1000.0\n", - "N=800.0\n", - "a=.7\n", - "I_d=110\n", - "R=2.0\n", - "\n", - "#Calculations\n", - "k=1-((1-N/N_s)*(2.339*a*V_ph)/(I_d*R)) \n", - "print(\"value of duty cycle=%.3f\" %k)\n", - "P=I_d**2*R*(1-k)\n", - "I1=a*I_d*math.sqrt(2/3)\n", - "r1=0.1\n", - "r2=0.08\n", - "Pr=3*I1**2*(r1+r2)\n", - "P_o=20000\n", - "P_i=P_o+Pr+P\n", - "eff=P_o/P_i*100 \n", - "print(\"Efficiency=%.2f\" %eff)\n", - "I11=math.sqrt(6)/math.pi*a*I_d\n", - "th=43\n", - "P_ip=math.sqrt(3)*V*I11*math.cos(math.radians(th))\n", - "pf=P_ip/(math.sqrt(3)*V*I11) \n", - "\n", - "#Results\n", - "print(\"Input power factor=%.4f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of duty cycle=0.656\n", - "Efficiency=70.62\n", - "Input power factor=0.7314\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.29, Page No 724" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=420.0\n", - "V1=V/math.sqrt(3)\n", - "N=1000.0\n", - "w_m=2*math.pi*N/60\n", - "N_s=1500.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "a=0.8\n", - "V_d=2.339*a*s*V1 \n", - "print(\"rectified voltage=%.2f V\" %V_d)\n", - "T=450.0\n", - "N1=1200.0\n", - "T_L=T*(N/N1)**2\n", - "f1=50\n", - "w_s=4*math.pi*f1/4\n", - "I_d=w_s*T_L/(2.339*a*V1) \n", - "print(\"inductor current=%.2f A\" %I_d)\n", - "a_T=-.4\n", - "a1=math.degrees(math.acos(s*a/a_T))\n", - "print(\"delay angle of inverter=%.2f deg\" %a1)\n", - "\n", - "P_s=V_d*I_d\n", - "P_o=T_L*w_m\n", - "R_d=0.01\n", - "P_i=I_d**2*R_d\n", - "I2=math.sqrt(2/3)*I_d\n", - "r2=0.02\n", - "r1=0.015\n", - "P_rol=3*I2**2*r2\n", - "I1=a*I2\n", - "P_sol=3*I1**2*r1\n", - "P_i=P_o+P_rol+P_sol+P_i\n", - "eff=P_o/P_i*100 \n", - "print(\"\\nefficiency=%.2f\" %eff)\n", - "w_m=w_s*(1+(-a_T/a)*math.cos(math.radians(a1))-w_s*R_d*T_L/(2.339*a*V1)**2)\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results \n", - "print(\"motor speed=%.1f rpm\" %N)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectified voltage=151.25 V\n", - "inductor current=108.18 A\n", - "delay angle of inverter=131.81 deg\n", - "\n", - "efficiency=99.64\n", - "motor speed=996.4 rpm\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.30, Page No 726" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V/math.sqrt(3)\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V_dd=0.7\n", - "V_dt=1.5\n", - "V_d=3*math.sqrt(6)*s*E2/math.pi-2*V_dd\n", - "V1=415.0\n", - "a=math.degrees(math.acos((3*math.sqrt(2)*E2/math.pi)**-1*(-V_d+2*V_dt)))\n", - "\n", - "#Results\n", - "print(\"firing angle advance=%.2f deg\" %(180-a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle advance=70.22 deg\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.31, Page No 726" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V/math.sqrt(3)\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V_dd=.7\n", - "V_dt=1.5\n", - "a=0\n", - "u=18 #overlap angle in case of rectifier\n", - "V_d=3*math.sqrt(6)*s*E2*(math.cos(math.radians(a))+math.cos(math.radians(a+u)))/(2*math.pi)-2*V_dd\n", - "V1=415\n", - "V_ml=math.sqrt(2)*V1\n", - "u=4 #overlap anglein the inverter\n", - " #V_dc=-(3*V_ml*(math.cos(math.radians(a))+math.cos(math.radians(a+u)))/(2*math.pi)-2*V_dt)\n", - " #V_dc=V_d\n", - " #after solving % (1+math.cos(math.radians(u)))*math.cos(math.radians(a))-math.sin(math.radians(u))*math.sin(math.radians(a))=-.6425\n", - "a=math.degrees(math.acos(-.6425/(math.sqrt((1+math.cos(math.radians(u)))**2+math.sin(math.radians(u))**2))))-math.degrees(math.asin(math.sin(math.radians(a))/(1+math.cos(math.radians(u)))))\n", - "\n", - "#Results\n", - "print(\"firing angle advance=%.2f deg\" %(180-a))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle advance=71.25 deg\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.32, Page No 727" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=700.0\n", - "E2=V\n", - "N_s=1500.0\n", - "N=1200.0\n", - "\n", - "#Calculations\n", - "s=(N_s-N)/N_s\n", - "V1=415.0\n", - "a_T=s*E2/V1 \n", - "\n", - "#Results\n", - "print(\"voltage ratio of the transformer=%.2f\" %a_T)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "voltage ratio of the transformer=0.34\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.33, Page No 733" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=6.0\n", - "N_s=600.0\n", - "f1=P*N_s/120.0\n", - "V=400.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "V_t=f1*V/f \n", - "print(\"supply freq=%.0f Hz\" %V_t)\n", - "T=340.0\n", - "N=1000.0\n", - "T_L=T*(N_s/N)**2\n", - "w_s=2*math.pi*N_s/60\n", - "P=T_L*w_s\n", - "I_a=P/(math.sqrt(3)*V_t) \n", - "print(\"armature current=%.2f A\" %I_a)\n", - "Z_s=2\n", - "X_s=f1/f*math.fabs(Z_s)\n", - "V_t=V_t/math.sqrt(3)\n", - "Ef=math.sqrt(V_t**2+(I_a*X_s)**2)\n", - "print(\"excitation voltage=%.2f V\" %(math.sqrt(3)*Ef))\n", - "dl=math.degrees(math.atan(I_a*X_s/V_t))\n", - "print(\"load angle=%.2f deg\" %dl)\n", - "T_em=(3/w_s)*(Ef*V_t/X_s) \n", - "\n", - "#Results\n", - "print(\"pull out torque=%.2f Nm\" %T_em)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "supply freq=240 Hz\n", - "armature current=18.50 A\n", - "excitation voltage=243.06 V\n", - "load angle=9.10 deg\n", - "pull out torque=773.69 Nm\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.34, Page No 736" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=4.0\n", - "f=50.0\n", - "w_s=4*math.pi*f/P\n", - "X_d=8.0\n", - "X_q=2.0\n", - "T_e=80.0\n", - "V=400.0\n", - "\n", - "#Calculations\n", - "V_t=V/math.sqrt(3)\n", - "dl=(1/2)*math.degrees(math.asin(T_e*w_s/((3/2)*(V_t)**2*(1/X_q-1/X_d)))) \n", - "print(\"load angle=%.3f deg\" %dl)\n", - "I_d=V_t*math.cos(math.radians(dl))/X_d\n", - "I_q=V_t*math.sin(math.radians(dl))/X_q\n", - "I_a=math.sqrt(I_d**2+I_q**2) \n", - "print(\"armature current=%.2f A\" %I_a)\n", - "pf=T_e*w_s/(math.sqrt(3)*V*I_a) \n", - "\n", - "#Results\n", - "print(\"input power factor=%.4f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "load angle=0.000 deg\n", - "armature current=28.87 A\n", - "input power factor=0.6283\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.35, Page No 737" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_e=3.0\n", - "K_m=1.2\n", - "I_a=T_e/K_m\n", - "r_a=2.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "E_a=(0.263*math.sqrt(2)*V-I_a*r_a)/(1-55/180)\n", - "w_m=E_a/K_m\n", - "N=w_m*60/(2*math.pi) \n", - "\n", - "#Results\n", - "print(\"motor speed=%.2f rpm\" %N)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor speed=640.96 rpm\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.36, Page No 738" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=1360.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - " #after calculations V_t % calculated\n", - "V_t=163.45\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.4f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=5.2578 Nm\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.37, Page No 740" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=2100.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - " #after calculations V_t % calculated\n", - "V_t=227.66\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.2f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=1.94 Nm\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.38, Page No 742" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=840.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=75.0\n", - "V_t=math.sqrt(2)*V/math.pi*(1+math.cos(math.radians(a)))\n", - "r_a=4\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.4f Nm\" %T_e)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=10.5922 Nm\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.39, Page No 743" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=1400.0\n", - "\n", - "#Calculations\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=60.0\n", - "a1=212\n", - "V_t=math.sqrt(2)*V/math.pi*(math.cos(math.radians(a))-math.cos(math.radians(a1)))+E_a*(180+a-a1)/180\n", - "r_a=3\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "#Results\n", - "print(\"motor torque=%.3f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=5.257 Nm\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.40, Page No 745" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "K_m=1.0\n", - "N=600.0\n", - "w_m=2*math.pi*N/60\n", - "E_a=K_m*w_m\n", - "V=230.0\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "V_t=2*math.sqrt(2)*V/math.pi*(math.cos(math.radians(a)))\n", - "r_a=3\n", - "I_a=(V_t-E_a)/r_a\n", - "T_e=K_m*I_a \n", - "\n", - "\n", - "#Results\n", - "print(\"motor torque=%.3f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "motor torque=13.568 Nm\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 12.41, Page No 745" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "r1=.6\n", - "r2=.4\n", - "s=0.04\n", - "x1=1.6\n", - "x2=1.6\n", - "Z=(r1+r2/s)+(x1+x2)\n", - "V=400.0\n", - "I1=V/Z \n", - "print(\"source current=%.3f A \" %math.degrees(math.atan(I1.imag/I1.real)))\n", - "print(\"and with %.1f deg phase\" %math.fabs(I1))\n", - "I2=V/Z\n", - "N=1500\n", - "w_s=2*math.pi*N/60\n", - "T_e=(3/w_s)*abs(I2)**2*r2/s \n", - "print(\"motor torque=%.2f Nm\" %T_e)\n", - "N_r=N*(1-s)\n", - "\n", - "f=45\n", - "N_s1=120*f/4\n", - "w_s=2*math.pi*N_s1/60\n", - "s1=(N_s1-N_r)/N_s1\n", - "Z=(r1+r2/s1)+(x1+x2)*f/50.0\n", - "V=360\n", - "I1=V/Z \n", - "print(\"source current=%.3f A \" %math.degrees(math.atan(I1.imag/I1.real)))\n", - "print(\"and with %.1f deg phase\" %math.fabs(I1))\n", - "I2=V/Z\n", - "T_e=(3/w_s)*abs(I2)**2*r2/s1 \n", - "print(\"motor torque=%.2f Nm\" %T_e)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "source current=0.000 A \n", - "and with 29.0 deg phase\n", - "motor torque=160.46 Nm\n", - "source current=-0.000 A \n", - "and with 142.9 deg phase\n", - "motor torque=-2598.45 Nm\n" - ] - } - ], - "prompt_number": 37 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter13.ipynb b/_Power_Electronics/Chapter13.ipynb deleted file mode 100755 index 62d2a926..00000000 --- a/_Power_Electronics/Chapter13.ipynb +++ /dev/null @@ -1,342 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 13 : Power Factor Improvement" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.1, Page No 754" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=250.0\n", - "R_l=5.0\n", - "I_l=20.0\n", - "V_l1=math.sqrt(V_s**2-(R_l*I_l)**2)\n", - "reg2=(V_s-V_l1)/V_s*100 \n", - "pf1=1.0\n", - "\n", - "#Calculations\n", - "P_l1=V_l1*I_l*pf1 #load power\n", - "P_r1=V_s*I_l*pf1 #max powwible system rating\n", - "utf1=P_l1*100/P_r1 \n", - "pf2=0.5\n", - " #(.5*V_l)**2+(.866*V_l+R_l*I_l)**2=V_s**2\n", - " #after solving\n", - "V_l2=158.35 \n", - "reg2=(V_s-V_l2)/V_s*100 \n", - "P_l2=V_l2*I_l*pf2 #load power\n", - "P_r2=V_s*I_l #max powwible system rating\n", - "utf2=P_l2*100/P_r2 \n", - "\n", - "\n", - "#Results\n", - "print(\"for pf=1\")\n", - "print(\"load voltage=%.2f V\" %V_l1)\n", - "print(\"voltage regulation=%.2f\" %reg1)\n", - "print(\"system utilisation factor=%.3f\" %utf1)\n", - "print(\"energy consumed(in units)=%.1f\" %(P_l1/1000))\n", - "print(\"for pf=.5\")\n", - "print(\"load voltage=%.2f V\" %V_l2)\n", - "print(\"voltage regulation=%.2f\" %reg2)\n", - "print(\"system utilisation factor=%.3f\" %utf2)\n", - "print(\"energy consumed(in units)=%.2f\" %(P_l2/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'reg1' is not defined", - "output_type": "pyerr", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 25\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"for pf=1\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 26\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"load voltage=%.2f V\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mV_l1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 27\u001b[1;33m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"voltage regulation=%.2f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mreg1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 28\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"system utilisation factor=%.3f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mutf1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 29\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"energy consumed(in units)=%.1f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mP_l1\u001b[0m\u001b[1;33m/\u001b[0m\u001b[1;36m1000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mNameError\u001b[0m: name 'reg1' is not defined" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for pf=1\n", - "load voltage=229.13 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.2, Page No 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "V_s=230.0\n", - "I_m1=2\n", - "pf1=.3\n", - "\n", - "#Calculations\n", - "I_c1=I_m1*math.sin(math.radians(math.degrees(math.acos(pf1))))\n", - "C1=I_c1/(2*math.pi*f*V_s) \n", - "I_m2=5\n", - "pf2=.5\n", - "I_c2=I_m2*math.sin(math.radians(math.degrees(math.acos(pf2))))\n", - "C2=I_c2/(2*math.pi*f*V_s) \n", - "I_m3=10\n", - "pf3=.7\n", - "I_c3=I_m3*math.sin(math.radians(math.degrees(math.acos(pf3))))\n", - "C3=I_c3/(2*math.pi*f*V_s) \n", - "\n", - "#Results\n", - "print(\"at no load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C1*10**6))\n", - "print(\"at half full load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C2*10**6))\n", - "print(\"at full load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C3*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "at no load\n", - "value of capacitance=26.404 uF\n", - "at half full load\n", - "value of capacitance=59.927 uF\n", - "at full load\n", - "value of capacitance=98.834 uF\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.3 Page No 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_c=10.0\n", - "f=50.0\n", - "V_s=230.0\n", - "\n", - "#Calculations\n", - "C=I_c/(2*math.pi*f*V_s) \n", - "I_l=10\n", - "L=V_s/(2*math.pi*f*I_l) \n", - "\n", - "#Results\n", - "print(\"value of capacitance=%.3f uF\" %(C*10**6))\n", - "print(\"value of inductor=%.3f mH\" %(L*1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of capacitance=138.396 uF\n", - "value of inductor=73.211 mH\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.4, Page No 765" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "I_L=10.0\n", - "X_L=V_s/I_L\n", - "I_f1=6.0\n", - " #B=2*a-math.sin(2*a)\n", - "B=2*math.pi-I_f1*math.pi*X_L/V_s\n", - "a=0\n", - "i=1.0\n", - "for a in range(1,360):\n", - " b=2*a*math.pi/180-math.sin(math.radians(2*a)) \n", - " if math.fabs(B-b)<=0.001 : #by hit and trial\n", - " i=2\n", - " break\n", - "print(\"firing angle of TCR = %.1f deg\" %a)\n", - " #(a-.01)*180/math.pi)\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle of TCR = 359.0 deg\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.5 Page No 766" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=.01\n", - "\n", - "\n", - "#Calculations\n", - "print(\"for firing angle=90deg\")\n", - "a=90*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.0f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=120deg\")\n", - "a=120*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=150deg\")\n", - "a=150*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.2f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=170deg\")\n", - "a=170*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f H\" %L_eff)\n", - "print(\"for firing angle=175deg\")\n", - "a=175*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "\n", - "#Results\n", - "print(\"effective inductance=%.2f H\" %L_eff)\n", - "print(\"for firing angle=180deg\")\n", - "a=180*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f H\" %L_eff)\n", - " #random value at firing angle =180 is equivalent to infinity as in answer in book\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=90deg\n", - "effective inductance=10 mH\n", - "for firing angle=120deg\n", - "effective inductance=25.575 mH\n", - "for firing angle=150deg\n", - "effective inductance=173.40 mH\n", - "for firing angle=170deg\n", - "effective inductance=4.459 H\n", - "for firing angle=175deg\n", - "effective inductance=35.51 H\n", - "for firing angle=180deg\n", - "effective inductance=-128265253940037.750 H\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.6 Page No 766" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "Q=100.0*10**3\n", - "V_s=11.0*10**3\n", - "\n", - "#Calculations\n", - "f=50.0\n", - "L=V_s**2/(2*math.pi*f*Q) \n", - "\n", - "#Results\n", - "print(\"effective inductance=%.4f H\" %L)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "effective inductance=3.8515 H\n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter13_1.ipynb b/_Power_Electronics/Chapter13_1.ipynb deleted file mode 100755 index 62d2a926..00000000 --- a/_Power_Electronics/Chapter13_1.ipynb +++ /dev/null @@ -1,342 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 13 : Power Factor Improvement" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.1, Page No 754" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=250.0\n", - "R_l=5.0\n", - "I_l=20.0\n", - "V_l1=math.sqrt(V_s**2-(R_l*I_l)**2)\n", - "reg2=(V_s-V_l1)/V_s*100 \n", - "pf1=1.0\n", - "\n", - "#Calculations\n", - "P_l1=V_l1*I_l*pf1 #load power\n", - "P_r1=V_s*I_l*pf1 #max powwible system rating\n", - "utf1=P_l1*100/P_r1 \n", - "pf2=0.5\n", - " #(.5*V_l)**2+(.866*V_l+R_l*I_l)**2=V_s**2\n", - " #after solving\n", - "V_l2=158.35 \n", - "reg2=(V_s-V_l2)/V_s*100 \n", - "P_l2=V_l2*I_l*pf2 #load power\n", - "P_r2=V_s*I_l #max powwible system rating\n", - "utf2=P_l2*100/P_r2 \n", - "\n", - "\n", - "#Results\n", - "print(\"for pf=1\")\n", - "print(\"load voltage=%.2f V\" %V_l1)\n", - "print(\"voltage regulation=%.2f\" %reg1)\n", - "print(\"system utilisation factor=%.3f\" %utf1)\n", - "print(\"energy consumed(in units)=%.1f\" %(P_l1/1000))\n", - "print(\"for pf=.5\")\n", - "print(\"load voltage=%.2f V\" %V_l2)\n", - "print(\"voltage regulation=%.2f\" %reg2)\n", - "print(\"system utilisation factor=%.3f\" %utf2)\n", - "print(\"energy consumed(in units)=%.2f\" %(P_l2/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'reg1' is not defined", - "output_type": "pyerr", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 25\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"for pf=1\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 26\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"load voltage=%.2f V\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mV_l1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 27\u001b[1;33m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"voltage regulation=%.2f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mreg1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 28\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"system utilisation factor=%.3f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mutf1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 29\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"energy consumed(in units)=%.1f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mP_l1\u001b[0m\u001b[1;33m/\u001b[0m\u001b[1;36m1000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mNameError\u001b[0m: name 'reg1' is not defined" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for pf=1\n", - "load voltage=229.13 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.2, Page No 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "V_s=230.0\n", - "I_m1=2\n", - "pf1=.3\n", - "\n", - "#Calculations\n", - "I_c1=I_m1*math.sin(math.radians(math.degrees(math.acos(pf1))))\n", - "C1=I_c1/(2*math.pi*f*V_s) \n", - "I_m2=5\n", - "pf2=.5\n", - "I_c2=I_m2*math.sin(math.radians(math.degrees(math.acos(pf2))))\n", - "C2=I_c2/(2*math.pi*f*V_s) \n", - "I_m3=10\n", - "pf3=.7\n", - "I_c3=I_m3*math.sin(math.radians(math.degrees(math.acos(pf3))))\n", - "C3=I_c3/(2*math.pi*f*V_s) \n", - "\n", - "#Results\n", - "print(\"at no load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C1*10**6))\n", - "print(\"at half full load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C2*10**6))\n", - "print(\"at full load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C3*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "at no load\n", - "value of capacitance=26.404 uF\n", - "at half full load\n", - "value of capacitance=59.927 uF\n", - "at full load\n", - "value of capacitance=98.834 uF\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.3 Page No 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_c=10.0\n", - "f=50.0\n", - "V_s=230.0\n", - "\n", - "#Calculations\n", - "C=I_c/(2*math.pi*f*V_s) \n", - "I_l=10\n", - "L=V_s/(2*math.pi*f*I_l) \n", - "\n", - "#Results\n", - "print(\"value of capacitance=%.3f uF\" %(C*10**6))\n", - "print(\"value of inductor=%.3f mH\" %(L*1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of capacitance=138.396 uF\n", - "value of inductor=73.211 mH\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.4, Page No 765" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "I_L=10.0\n", - "X_L=V_s/I_L\n", - "I_f1=6.0\n", - " #B=2*a-math.sin(2*a)\n", - "B=2*math.pi-I_f1*math.pi*X_L/V_s\n", - "a=0\n", - "i=1.0\n", - "for a in range(1,360):\n", - " b=2*a*math.pi/180-math.sin(math.radians(2*a)) \n", - " if math.fabs(B-b)<=0.001 : #by hit and trial\n", - " i=2\n", - " break\n", - "print(\"firing angle of TCR = %.1f deg\" %a)\n", - " #(a-.01)*180/math.pi)\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle of TCR = 359.0 deg\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.5 Page No 766" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=.01\n", - "\n", - "\n", - "#Calculations\n", - "print(\"for firing angle=90deg\")\n", - "a=90*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.0f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=120deg\")\n", - "a=120*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=150deg\")\n", - "a=150*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.2f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=170deg\")\n", - "a=170*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f H\" %L_eff)\n", - "print(\"for firing angle=175deg\")\n", - "a=175*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "\n", - "#Results\n", - "print(\"effective inductance=%.2f H\" %L_eff)\n", - "print(\"for firing angle=180deg\")\n", - "a=180*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f H\" %L_eff)\n", - " #random value at firing angle =180 is equivalent to infinity as in answer in book\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=90deg\n", - "effective inductance=10 mH\n", - "for firing angle=120deg\n", - "effective inductance=25.575 mH\n", - "for firing angle=150deg\n", - "effective inductance=173.40 mH\n", - "for firing angle=170deg\n", - "effective inductance=4.459 H\n", - "for firing angle=175deg\n", - "effective inductance=35.51 H\n", - "for firing angle=180deg\n", - "effective inductance=-128265253940037.750 H\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.6 Page No 766" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "Q=100.0*10**3\n", - "V_s=11.0*10**3\n", - "\n", - "#Calculations\n", - "f=50.0\n", - "L=V_s**2/(2*math.pi*f*Q) \n", - "\n", - "#Results\n", - "print(\"effective inductance=%.4f H\" %L)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "effective inductance=3.8515 H\n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter13_2.ipynb b/_Power_Electronics/Chapter13_2.ipynb deleted file mode 100755 index 62d2a926..00000000 --- a/_Power_Electronics/Chapter13_2.ipynb +++ /dev/null @@ -1,342 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 13 : Power Factor Improvement" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.1, Page No 754" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=250.0\n", - "R_l=5.0\n", - "I_l=20.0\n", - "V_l1=math.sqrt(V_s**2-(R_l*I_l)**2)\n", - "reg2=(V_s-V_l1)/V_s*100 \n", - "pf1=1.0\n", - "\n", - "#Calculations\n", - "P_l1=V_l1*I_l*pf1 #load power\n", - "P_r1=V_s*I_l*pf1 #max powwible system rating\n", - "utf1=P_l1*100/P_r1 \n", - "pf2=0.5\n", - " #(.5*V_l)**2+(.866*V_l+R_l*I_l)**2=V_s**2\n", - " #after solving\n", - "V_l2=158.35 \n", - "reg2=(V_s-V_l2)/V_s*100 \n", - "P_l2=V_l2*I_l*pf2 #load power\n", - "P_r2=V_s*I_l #max powwible system rating\n", - "utf2=P_l2*100/P_r2 \n", - "\n", - "\n", - "#Results\n", - "print(\"for pf=1\")\n", - "print(\"load voltage=%.2f V\" %V_l1)\n", - "print(\"voltage regulation=%.2f\" %reg1)\n", - "print(\"system utilisation factor=%.3f\" %utf1)\n", - "print(\"energy consumed(in units)=%.1f\" %(P_l1/1000))\n", - "print(\"for pf=.5\")\n", - "print(\"load voltage=%.2f V\" %V_l2)\n", - "print(\"voltage regulation=%.2f\" %reg2)\n", - "print(\"system utilisation factor=%.3f\" %utf2)\n", - "print(\"energy consumed(in units)=%.2f\" %(P_l2/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'reg1' is not defined", - "output_type": "pyerr", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 25\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"for pf=1\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 26\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"load voltage=%.2f V\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mV_l1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 27\u001b[1;33m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"voltage regulation=%.2f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mreg1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 28\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"system utilisation factor=%.3f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mutf1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 29\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"energy consumed(in units)=%.1f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mP_l1\u001b[0m\u001b[1;33m/\u001b[0m\u001b[1;36m1000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mNameError\u001b[0m: name 'reg1' is not defined" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for pf=1\n", - "load voltage=229.13 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.2, Page No 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "V_s=230.0\n", - "I_m1=2\n", - "pf1=.3\n", - "\n", - "#Calculations\n", - "I_c1=I_m1*math.sin(math.radians(math.degrees(math.acos(pf1))))\n", - "C1=I_c1/(2*math.pi*f*V_s) \n", - "I_m2=5\n", - "pf2=.5\n", - "I_c2=I_m2*math.sin(math.radians(math.degrees(math.acos(pf2))))\n", - "C2=I_c2/(2*math.pi*f*V_s) \n", - "I_m3=10\n", - "pf3=.7\n", - "I_c3=I_m3*math.sin(math.radians(math.degrees(math.acos(pf3))))\n", - "C3=I_c3/(2*math.pi*f*V_s) \n", - "\n", - "#Results\n", - "print(\"at no load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C1*10**6))\n", - "print(\"at half full load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C2*10**6))\n", - "print(\"at full load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C3*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "at no load\n", - "value of capacitance=26.404 uF\n", - "at half full load\n", - "value of capacitance=59.927 uF\n", - "at full load\n", - "value of capacitance=98.834 uF\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.3 Page No 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_c=10.0\n", - "f=50.0\n", - "V_s=230.0\n", - "\n", - "#Calculations\n", - "C=I_c/(2*math.pi*f*V_s) \n", - "I_l=10\n", - "L=V_s/(2*math.pi*f*I_l) \n", - "\n", - "#Results\n", - "print(\"value of capacitance=%.3f uF\" %(C*10**6))\n", - "print(\"value of inductor=%.3f mH\" %(L*1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of capacitance=138.396 uF\n", - "value of inductor=73.211 mH\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.4, Page No 765" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "I_L=10.0\n", - "X_L=V_s/I_L\n", - "I_f1=6.0\n", - " #B=2*a-math.sin(2*a)\n", - "B=2*math.pi-I_f1*math.pi*X_L/V_s\n", - "a=0\n", - "i=1.0\n", - "for a in range(1,360):\n", - " b=2*a*math.pi/180-math.sin(math.radians(2*a)) \n", - " if math.fabs(B-b)<=0.001 : #by hit and trial\n", - " i=2\n", - " break\n", - "print(\"firing angle of TCR = %.1f deg\" %a)\n", - " #(a-.01)*180/math.pi)\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle of TCR = 359.0 deg\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.5 Page No 766" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=.01\n", - "\n", - "\n", - "#Calculations\n", - "print(\"for firing angle=90deg\")\n", - "a=90*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.0f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=120deg\")\n", - "a=120*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=150deg\")\n", - "a=150*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.2f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=170deg\")\n", - "a=170*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f H\" %L_eff)\n", - "print(\"for firing angle=175deg\")\n", - "a=175*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "\n", - "#Results\n", - "print(\"effective inductance=%.2f H\" %L_eff)\n", - "print(\"for firing angle=180deg\")\n", - "a=180*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f H\" %L_eff)\n", - " #random value at firing angle =180 is equivalent to infinity as in answer in book\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=90deg\n", - "effective inductance=10 mH\n", - "for firing angle=120deg\n", - "effective inductance=25.575 mH\n", - "for firing angle=150deg\n", - "effective inductance=173.40 mH\n", - "for firing angle=170deg\n", - "effective inductance=4.459 H\n", - "for firing angle=175deg\n", - "effective inductance=35.51 H\n", - "for firing angle=180deg\n", - "effective inductance=-128265253940037.750 H\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.6 Page No 766" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "Q=100.0*10**3\n", - "V_s=11.0*10**3\n", - "\n", - "#Calculations\n", - "f=50.0\n", - "L=V_s**2/(2*math.pi*f*Q) \n", - "\n", - "#Results\n", - "print(\"effective inductance=%.4f H\" %L)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "effective inductance=3.8515 H\n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter13_3.ipynb b/_Power_Electronics/Chapter13_3.ipynb deleted file mode 100755 index 62d2a926..00000000 --- a/_Power_Electronics/Chapter13_3.ipynb +++ /dev/null @@ -1,342 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 13 : Power Factor Improvement" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.1, Page No 754" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=250.0\n", - "R_l=5.0\n", - "I_l=20.0\n", - "V_l1=math.sqrt(V_s**2-(R_l*I_l)**2)\n", - "reg2=(V_s-V_l1)/V_s*100 \n", - "pf1=1.0\n", - "\n", - "#Calculations\n", - "P_l1=V_l1*I_l*pf1 #load power\n", - "P_r1=V_s*I_l*pf1 #max powwible system rating\n", - "utf1=P_l1*100/P_r1 \n", - "pf2=0.5\n", - " #(.5*V_l)**2+(.866*V_l+R_l*I_l)**2=V_s**2\n", - " #after solving\n", - "V_l2=158.35 \n", - "reg2=(V_s-V_l2)/V_s*100 \n", - "P_l2=V_l2*I_l*pf2 #load power\n", - "P_r2=V_s*I_l #max powwible system rating\n", - "utf2=P_l2*100/P_r2 \n", - "\n", - "\n", - "#Results\n", - "print(\"for pf=1\")\n", - "print(\"load voltage=%.2f V\" %V_l1)\n", - "print(\"voltage regulation=%.2f\" %reg1)\n", - "print(\"system utilisation factor=%.3f\" %utf1)\n", - "print(\"energy consumed(in units)=%.1f\" %(P_l1/1000))\n", - "print(\"for pf=.5\")\n", - "print(\"load voltage=%.2f V\" %V_l2)\n", - "print(\"voltage regulation=%.2f\" %reg2)\n", - "print(\"system utilisation factor=%.3f\" %utf2)\n", - "print(\"energy consumed(in units)=%.2f\" %(P_l2/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'reg1' is not defined", - "output_type": "pyerr", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 25\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"for pf=1\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 26\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"load voltage=%.2f V\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mV_l1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 27\u001b[1;33m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"voltage regulation=%.2f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mreg1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 28\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"system utilisation factor=%.3f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mutf1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 29\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"energy consumed(in units)=%.1f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mP_l1\u001b[0m\u001b[1;33m/\u001b[0m\u001b[1;36m1000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mNameError\u001b[0m: name 'reg1' is not defined" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for pf=1\n", - "load voltage=229.13 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.2, Page No 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "V_s=230.0\n", - "I_m1=2\n", - "pf1=.3\n", - "\n", - "#Calculations\n", - "I_c1=I_m1*math.sin(math.radians(math.degrees(math.acos(pf1))))\n", - "C1=I_c1/(2*math.pi*f*V_s) \n", - "I_m2=5\n", - "pf2=.5\n", - "I_c2=I_m2*math.sin(math.radians(math.degrees(math.acos(pf2))))\n", - "C2=I_c2/(2*math.pi*f*V_s) \n", - "I_m3=10\n", - "pf3=.7\n", - "I_c3=I_m3*math.sin(math.radians(math.degrees(math.acos(pf3))))\n", - "C3=I_c3/(2*math.pi*f*V_s) \n", - "\n", - "#Results\n", - "print(\"at no load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C1*10**6))\n", - "print(\"at half full load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C2*10**6))\n", - "print(\"at full load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C3*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "at no load\n", - "value of capacitance=26.404 uF\n", - "at half full load\n", - "value of capacitance=59.927 uF\n", - "at full load\n", - "value of capacitance=98.834 uF\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.3 Page No 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_c=10.0\n", - "f=50.0\n", - "V_s=230.0\n", - "\n", - "#Calculations\n", - "C=I_c/(2*math.pi*f*V_s) \n", - "I_l=10\n", - "L=V_s/(2*math.pi*f*I_l) \n", - "\n", - "#Results\n", - "print(\"value of capacitance=%.3f uF\" %(C*10**6))\n", - "print(\"value of inductor=%.3f mH\" %(L*1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of capacitance=138.396 uF\n", - "value of inductor=73.211 mH\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.4, Page No 765" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "I_L=10.0\n", - "X_L=V_s/I_L\n", - "I_f1=6.0\n", - " #B=2*a-math.sin(2*a)\n", - "B=2*math.pi-I_f1*math.pi*X_L/V_s\n", - "a=0\n", - "i=1.0\n", - "for a in range(1,360):\n", - " b=2*a*math.pi/180-math.sin(math.radians(2*a)) \n", - " if math.fabs(B-b)<=0.001 : #by hit and trial\n", - " i=2\n", - " break\n", - "print(\"firing angle of TCR = %.1f deg\" %a)\n", - " #(a-.01)*180/math.pi)\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle of TCR = 359.0 deg\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.5 Page No 766" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=.01\n", - "\n", - "\n", - "#Calculations\n", - "print(\"for firing angle=90deg\")\n", - "a=90*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.0f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=120deg\")\n", - "a=120*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=150deg\")\n", - "a=150*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.2f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=170deg\")\n", - "a=170*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f H\" %L_eff)\n", - "print(\"for firing angle=175deg\")\n", - "a=175*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "\n", - "#Results\n", - "print(\"effective inductance=%.2f H\" %L_eff)\n", - "print(\"for firing angle=180deg\")\n", - "a=180*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f H\" %L_eff)\n", - " #random value at firing angle =180 is equivalent to infinity as in answer in book\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=90deg\n", - "effective inductance=10 mH\n", - "for firing angle=120deg\n", - "effective inductance=25.575 mH\n", - "for firing angle=150deg\n", - "effective inductance=173.40 mH\n", - "for firing angle=170deg\n", - "effective inductance=4.459 H\n", - "for firing angle=175deg\n", - "effective inductance=35.51 H\n", - "for firing angle=180deg\n", - "effective inductance=-128265253940037.750 H\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.6 Page No 766" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "Q=100.0*10**3\n", - "V_s=11.0*10**3\n", - "\n", - "#Calculations\n", - "f=50.0\n", - "L=V_s**2/(2*math.pi*f*Q) \n", - "\n", - "#Results\n", - "print(\"effective inductance=%.4f H\" %L)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "effective inductance=3.8515 H\n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter13_4.ipynb b/_Power_Electronics/Chapter13_4.ipynb deleted file mode 100755 index 62d2a926..00000000 --- a/_Power_Electronics/Chapter13_4.ipynb +++ /dev/null @@ -1,342 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 13 : Power Factor Improvement" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.1, Page No 754" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=250.0\n", - "R_l=5.0\n", - "I_l=20.0\n", - "V_l1=math.sqrt(V_s**2-(R_l*I_l)**2)\n", - "reg2=(V_s-V_l1)/V_s*100 \n", - "pf1=1.0\n", - "\n", - "#Calculations\n", - "P_l1=V_l1*I_l*pf1 #load power\n", - "P_r1=V_s*I_l*pf1 #max powwible system rating\n", - "utf1=P_l1*100/P_r1 \n", - "pf2=0.5\n", - " #(.5*V_l)**2+(.866*V_l+R_l*I_l)**2=V_s**2\n", - " #after solving\n", - "V_l2=158.35 \n", - "reg2=(V_s-V_l2)/V_s*100 \n", - "P_l2=V_l2*I_l*pf2 #load power\n", - "P_r2=V_s*I_l #max powwible system rating\n", - "utf2=P_l2*100/P_r2 \n", - "\n", - "\n", - "#Results\n", - "print(\"for pf=1\")\n", - "print(\"load voltage=%.2f V\" %V_l1)\n", - "print(\"voltage regulation=%.2f\" %reg1)\n", - "print(\"system utilisation factor=%.3f\" %utf1)\n", - "print(\"energy consumed(in units)=%.1f\" %(P_l1/1000))\n", - "print(\"for pf=.5\")\n", - "print(\"load voltage=%.2f V\" %V_l2)\n", - "print(\"voltage regulation=%.2f\" %reg2)\n", - "print(\"system utilisation factor=%.3f\" %utf2)\n", - "print(\"energy consumed(in units)=%.2f\" %(P_l2/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'reg1' is not defined", - "output_type": "pyerr", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 25\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"for pf=1\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 26\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"load voltage=%.2f V\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mV_l1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 27\u001b[1;33m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"voltage regulation=%.2f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mreg1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 28\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"system utilisation factor=%.3f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[0mutf1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 29\u001b[0m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"energy consumed(in units)=%.1f\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mP_l1\u001b[0m\u001b[1;33m/\u001b[0m\u001b[1;36m1000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mNameError\u001b[0m: name 'reg1' is not defined" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for pf=1\n", - "load voltage=229.13 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.2, Page No 756" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "V_s=230.0\n", - "I_m1=2\n", - "pf1=.3\n", - "\n", - "#Calculations\n", - "I_c1=I_m1*math.sin(math.radians(math.degrees(math.acos(pf1))))\n", - "C1=I_c1/(2*math.pi*f*V_s) \n", - "I_m2=5\n", - "pf2=.5\n", - "I_c2=I_m2*math.sin(math.radians(math.degrees(math.acos(pf2))))\n", - "C2=I_c2/(2*math.pi*f*V_s) \n", - "I_m3=10\n", - "pf3=.7\n", - "I_c3=I_m3*math.sin(math.radians(math.degrees(math.acos(pf3))))\n", - "C3=I_c3/(2*math.pi*f*V_s) \n", - "\n", - "#Results\n", - "print(\"at no load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C1*10**6))\n", - "print(\"at half full load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C2*10**6))\n", - "print(\"at full load\")\n", - "print(\"value of capacitance=%.3f uF\" %(C3*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "at no load\n", - "value of capacitance=26.404 uF\n", - "at half full load\n", - "value of capacitance=59.927 uF\n", - "at full load\n", - "value of capacitance=98.834 uF\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.3 Page No 764" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_c=10.0\n", - "f=50.0\n", - "V_s=230.0\n", - "\n", - "#Calculations\n", - "C=I_c/(2*math.pi*f*V_s) \n", - "I_l=10\n", - "L=V_s/(2*math.pi*f*I_l) \n", - "\n", - "#Results\n", - "print(\"value of capacitance=%.3f uF\" %(C*10**6))\n", - "print(\"value of inductor=%.3f mH\" %(L*1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of capacitance=138.396 uF\n", - "value of inductor=73.211 mH\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.4, Page No 765" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "I_L=10.0\n", - "X_L=V_s/I_L\n", - "I_f1=6.0\n", - " #B=2*a-math.sin(2*a)\n", - "B=2*math.pi-I_f1*math.pi*X_L/V_s\n", - "a=0\n", - "i=1.0\n", - "for a in range(1,360):\n", - " b=2*a*math.pi/180-math.sin(math.radians(2*a)) \n", - " if math.fabs(B-b)<=0.001 : #by hit and trial\n", - " i=2\n", - " break\n", - "print(\"firing angle of TCR = %.1f deg\" %a)\n", - " #(a-.01)*180/math.pi)\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle of TCR = 359.0 deg\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.5 Page No 766" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=.01\n", - "\n", - "\n", - "#Calculations\n", - "print(\"for firing angle=90deg\")\n", - "a=90*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.0f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=120deg\")\n", - "a=120*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=150deg\")\n", - "a=150*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.2f mH\" %(L_eff*1000))\n", - "print(\"for firing angle=170deg\")\n", - "a=170*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f H\" %L_eff)\n", - "print(\"for firing angle=175deg\")\n", - "a=175*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "\n", - "#Results\n", - "print(\"effective inductance=%.2f H\" %L_eff)\n", - "print(\"for firing angle=180deg\")\n", - "a=180*math.pi/180\n", - "L_eff=math.pi*L/(2*math.pi-2*a+math.sin(2*a)) \n", - "print(\"effective inductance=%.3f H\" %L_eff)\n", - " #random value at firing angle =180 is equivalent to infinity as in answer in book\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=90deg\n", - "effective inductance=10 mH\n", - "for firing angle=120deg\n", - "effective inductance=25.575 mH\n", - "for firing angle=150deg\n", - "effective inductance=173.40 mH\n", - "for firing angle=170deg\n", - "effective inductance=4.459 H\n", - "for firing angle=175deg\n", - "effective inductance=35.51 H\n", - "for firing angle=180deg\n", - "effective inductance=-128265253940037.750 H\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 13.6 Page No 766" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "Q=100.0*10**3\n", - "V_s=11.0*10**3\n", - "\n", - "#Calculations\n", - "f=50.0\n", - "L=V_s**2/(2*math.pi*f*Q) \n", - "\n", - "#Results\n", - "print(\"effective inductance=%.4f H\" %L)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "effective inductance=3.8515 H\n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter14.ipynb b/_Power_Electronics/Chapter14.ipynb deleted file mode 100755 index a9c3a3f1..00000000 --- a/_Power_Electronics/Chapter14.ipynb +++ /dev/null @@ -1,93 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 14 : Miscellaneous Topics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 14.1, Page No 777" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a1=0\n", - "a2=45.0\n", - "\n", - "#Calculations\n", - "print(\"for two single phase series semiconvertors\")\n", - "V_0=V_m/math.pi*(2+math.cos(math.radians(a1))+math.cos(math.radians(a2))) \n", - "print(\"avg o/p voltage=%.2f V\" %V_0)\n", - "V_or=V_s*math.sqrt((1/math.pi)*(4*math.pi-3*a2*math.pi/180+(3/2)*math.sin(math.radians(2*a2)))) \n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "DF=(3+math.cos(math.radians(a2)))/(math.sqrt(2)*math.sqrt(5+3*math.cos(math.radians(a2)))) \n", - "print(\"DF=%.2f\" %DF)\n", - "PF=math.sqrt(2/math.pi)*(3+math.cos(math.radians(a2)))/math.sqrt(4*math.pi-3*a2*math.pi/180) \n", - "print(\"PF=%.2f\" %PF)\n", - "HF=math.sqrt((math.pi*(math.pi-(3/4)*a2*math.pi/180)/(5+3*math.cos(math.radians(a2))))-1) \n", - "print(\"HF=%.2f\" %HF)\n", - "print(\"for two single phase series full convertors\")\n", - "a=45.0\n", - "V_0=2*V_m/math.pi*(1+math.cos(math.radians(a))) \n", - "print(\"avg o/p voltage=%.2f V\" %V_0)\n", - "V_or=2*V_s*math.sqrt((1/math.pi)*(math.pi-a2*math.pi/180+(1/2)*math.sin(math.radians(2*a2)))) \n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "DF=math.cos(math.radians(a2/2)) \n", - "\n", - "\n", - "#Results \n", - "print(\"DF=%.2f\" %DF)\n", - "PF=math.sqrt(2/(math.pi*(math.pi-a2*math.pi/180)))*(1+math.cos(math.radians(a2))) \n", - "print(\"PF=%.2f\" %PF)\n", - "HF=math.sqrt((math.pi*(math.pi-a2*math.pi/180)/(4+4*math.cos(math.radians(a2))))-1) \n", - "print(\"HF=%.2f\" %HF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for two single phase series semiconvertors\n", - "avg o/p voltage=383.82 V\n", - "rms value of o/p voltage=434.47 V\n", - "DF=0.98\n", - "PF=0.93\n", - "HF=0.62\n", - "for two single phase series full convertors\n", - "avg o/p voltage=353.50 V\n", - "rms value of o/p voltage=398.37 V\n", - "DF=0.92\n", - "PF=0.89\n", - "HF=0.29\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter14_1.ipynb b/_Power_Electronics/Chapter14_1.ipynb deleted file mode 100755 index a9c3a3f1..00000000 --- a/_Power_Electronics/Chapter14_1.ipynb +++ /dev/null @@ -1,93 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 14 : Miscellaneous Topics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 14.1, Page No 777" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a1=0\n", - "a2=45.0\n", - "\n", - "#Calculations\n", - "print(\"for two single phase series semiconvertors\")\n", - "V_0=V_m/math.pi*(2+math.cos(math.radians(a1))+math.cos(math.radians(a2))) \n", - "print(\"avg o/p voltage=%.2f V\" %V_0)\n", - "V_or=V_s*math.sqrt((1/math.pi)*(4*math.pi-3*a2*math.pi/180+(3/2)*math.sin(math.radians(2*a2)))) \n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "DF=(3+math.cos(math.radians(a2)))/(math.sqrt(2)*math.sqrt(5+3*math.cos(math.radians(a2)))) \n", - "print(\"DF=%.2f\" %DF)\n", - "PF=math.sqrt(2/math.pi)*(3+math.cos(math.radians(a2)))/math.sqrt(4*math.pi-3*a2*math.pi/180) \n", - "print(\"PF=%.2f\" %PF)\n", - "HF=math.sqrt((math.pi*(math.pi-(3/4)*a2*math.pi/180)/(5+3*math.cos(math.radians(a2))))-1) \n", - "print(\"HF=%.2f\" %HF)\n", - "print(\"for two single phase series full convertors\")\n", - "a=45.0\n", - "V_0=2*V_m/math.pi*(1+math.cos(math.radians(a))) \n", - "print(\"avg o/p voltage=%.2f V\" %V_0)\n", - "V_or=2*V_s*math.sqrt((1/math.pi)*(math.pi-a2*math.pi/180+(1/2)*math.sin(math.radians(2*a2)))) \n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "DF=math.cos(math.radians(a2/2)) \n", - "\n", - "\n", - "#Results \n", - "print(\"DF=%.2f\" %DF)\n", - "PF=math.sqrt(2/(math.pi*(math.pi-a2*math.pi/180)))*(1+math.cos(math.radians(a2))) \n", - "print(\"PF=%.2f\" %PF)\n", - "HF=math.sqrt((math.pi*(math.pi-a2*math.pi/180)/(4+4*math.cos(math.radians(a2))))-1) \n", - "print(\"HF=%.2f\" %HF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for two single phase series semiconvertors\n", - "avg o/p voltage=383.82 V\n", - "rms value of o/p voltage=434.47 V\n", - "DF=0.98\n", - "PF=0.93\n", - "HF=0.62\n", - "for two single phase series full convertors\n", - "avg o/p voltage=353.50 V\n", - "rms value of o/p voltage=398.37 V\n", - "DF=0.92\n", - "PF=0.89\n", - "HF=0.29\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter14_2.ipynb b/_Power_Electronics/Chapter14_2.ipynb deleted file mode 100755 index a9c3a3f1..00000000 --- a/_Power_Electronics/Chapter14_2.ipynb +++ /dev/null @@ -1,93 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 14 : Miscellaneous Topics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 14.1, Page No 777" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a1=0\n", - "a2=45.0\n", - "\n", - "#Calculations\n", - "print(\"for two single phase series semiconvertors\")\n", - "V_0=V_m/math.pi*(2+math.cos(math.radians(a1))+math.cos(math.radians(a2))) \n", - "print(\"avg o/p voltage=%.2f V\" %V_0)\n", - "V_or=V_s*math.sqrt((1/math.pi)*(4*math.pi-3*a2*math.pi/180+(3/2)*math.sin(math.radians(2*a2)))) \n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "DF=(3+math.cos(math.radians(a2)))/(math.sqrt(2)*math.sqrt(5+3*math.cos(math.radians(a2)))) \n", - "print(\"DF=%.2f\" %DF)\n", - "PF=math.sqrt(2/math.pi)*(3+math.cos(math.radians(a2)))/math.sqrt(4*math.pi-3*a2*math.pi/180) \n", - "print(\"PF=%.2f\" %PF)\n", - "HF=math.sqrt((math.pi*(math.pi-(3/4)*a2*math.pi/180)/(5+3*math.cos(math.radians(a2))))-1) \n", - "print(\"HF=%.2f\" %HF)\n", - "print(\"for two single phase series full convertors\")\n", - "a=45.0\n", - "V_0=2*V_m/math.pi*(1+math.cos(math.radians(a))) \n", - "print(\"avg o/p voltage=%.2f V\" %V_0)\n", - "V_or=2*V_s*math.sqrt((1/math.pi)*(math.pi-a2*math.pi/180+(1/2)*math.sin(math.radians(2*a2)))) \n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "DF=math.cos(math.radians(a2/2)) \n", - "\n", - "\n", - "#Results \n", - "print(\"DF=%.2f\" %DF)\n", - "PF=math.sqrt(2/(math.pi*(math.pi-a2*math.pi/180)))*(1+math.cos(math.radians(a2))) \n", - "print(\"PF=%.2f\" %PF)\n", - "HF=math.sqrt((math.pi*(math.pi-a2*math.pi/180)/(4+4*math.cos(math.radians(a2))))-1) \n", - "print(\"HF=%.2f\" %HF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for two single phase series semiconvertors\n", - "avg o/p voltage=383.82 V\n", - "rms value of o/p voltage=434.47 V\n", - "DF=0.98\n", - "PF=0.93\n", - "HF=0.62\n", - "for two single phase series full convertors\n", - "avg o/p voltage=353.50 V\n", - "rms value of o/p voltage=398.37 V\n", - "DF=0.92\n", - "PF=0.89\n", - "HF=0.29\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter14_3.ipynb b/_Power_Electronics/Chapter14_3.ipynb deleted file mode 100755 index a9c3a3f1..00000000 --- a/_Power_Electronics/Chapter14_3.ipynb +++ /dev/null @@ -1,93 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 14 : Miscellaneous Topics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 14.1, Page No 777" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a1=0\n", - "a2=45.0\n", - "\n", - "#Calculations\n", - "print(\"for two single phase series semiconvertors\")\n", - "V_0=V_m/math.pi*(2+math.cos(math.radians(a1))+math.cos(math.radians(a2))) \n", - "print(\"avg o/p voltage=%.2f V\" %V_0)\n", - "V_or=V_s*math.sqrt((1/math.pi)*(4*math.pi-3*a2*math.pi/180+(3/2)*math.sin(math.radians(2*a2)))) \n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "DF=(3+math.cos(math.radians(a2)))/(math.sqrt(2)*math.sqrt(5+3*math.cos(math.radians(a2)))) \n", - "print(\"DF=%.2f\" %DF)\n", - "PF=math.sqrt(2/math.pi)*(3+math.cos(math.radians(a2)))/math.sqrt(4*math.pi-3*a2*math.pi/180) \n", - "print(\"PF=%.2f\" %PF)\n", - "HF=math.sqrt((math.pi*(math.pi-(3/4)*a2*math.pi/180)/(5+3*math.cos(math.radians(a2))))-1) \n", - "print(\"HF=%.2f\" %HF)\n", - "print(\"for two single phase series full convertors\")\n", - "a=45.0\n", - "V_0=2*V_m/math.pi*(1+math.cos(math.radians(a))) \n", - "print(\"avg o/p voltage=%.2f V\" %V_0)\n", - "V_or=2*V_s*math.sqrt((1/math.pi)*(math.pi-a2*math.pi/180+(1/2)*math.sin(math.radians(2*a2)))) \n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "DF=math.cos(math.radians(a2/2)) \n", - "\n", - "\n", - "#Results \n", - "print(\"DF=%.2f\" %DF)\n", - "PF=math.sqrt(2/(math.pi*(math.pi-a2*math.pi/180)))*(1+math.cos(math.radians(a2))) \n", - "print(\"PF=%.2f\" %PF)\n", - "HF=math.sqrt((math.pi*(math.pi-a2*math.pi/180)/(4+4*math.cos(math.radians(a2))))-1) \n", - "print(\"HF=%.2f\" %HF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for two single phase series semiconvertors\n", - "avg o/p voltage=383.82 V\n", - "rms value of o/p voltage=434.47 V\n", - "DF=0.98\n", - "PF=0.93\n", - "HF=0.62\n", - "for two single phase series full convertors\n", - "avg o/p voltage=353.50 V\n", - "rms value of o/p voltage=398.37 V\n", - "DF=0.92\n", - "PF=0.89\n", - "HF=0.29\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter14_4.ipynb b/_Power_Electronics/Chapter14_4.ipynb deleted file mode 100755 index a9c3a3f1..00000000 --- a/_Power_Electronics/Chapter14_4.ipynb +++ /dev/null @@ -1,93 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 14 : Miscellaneous Topics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 14.1, Page No 777" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a1=0\n", - "a2=45.0\n", - "\n", - "#Calculations\n", - "print(\"for two single phase series semiconvertors\")\n", - "V_0=V_m/math.pi*(2+math.cos(math.radians(a1))+math.cos(math.radians(a2))) \n", - "print(\"avg o/p voltage=%.2f V\" %V_0)\n", - "V_or=V_s*math.sqrt((1/math.pi)*(4*math.pi-3*a2*math.pi/180+(3/2)*math.sin(math.radians(2*a2)))) \n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "DF=(3+math.cos(math.radians(a2)))/(math.sqrt(2)*math.sqrt(5+3*math.cos(math.radians(a2)))) \n", - "print(\"DF=%.2f\" %DF)\n", - "PF=math.sqrt(2/math.pi)*(3+math.cos(math.radians(a2)))/math.sqrt(4*math.pi-3*a2*math.pi/180) \n", - "print(\"PF=%.2f\" %PF)\n", - "HF=math.sqrt((math.pi*(math.pi-(3/4)*a2*math.pi/180)/(5+3*math.cos(math.radians(a2))))-1) \n", - "print(\"HF=%.2f\" %HF)\n", - "print(\"for two single phase series full convertors\")\n", - "a=45.0\n", - "V_0=2*V_m/math.pi*(1+math.cos(math.radians(a))) \n", - "print(\"avg o/p voltage=%.2f V\" %V_0)\n", - "V_or=2*V_s*math.sqrt((1/math.pi)*(math.pi-a2*math.pi/180+(1/2)*math.sin(math.radians(2*a2)))) \n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "DF=math.cos(math.radians(a2/2)) \n", - "\n", - "\n", - "#Results \n", - "print(\"DF=%.2f\" %DF)\n", - "PF=math.sqrt(2/(math.pi*(math.pi-a2*math.pi/180)))*(1+math.cos(math.radians(a2))) \n", - "print(\"PF=%.2f\" %PF)\n", - "HF=math.sqrt((math.pi*(math.pi-a2*math.pi/180)/(4+4*math.cos(math.radians(a2))))-1) \n", - "print(\"HF=%.2f\" %HF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for two single phase series semiconvertors\n", - "avg o/p voltage=383.82 V\n", - "rms value of o/p voltage=434.47 V\n", - "DF=0.98\n", - "PF=0.93\n", - "HF=0.62\n", - "for two single phase series full convertors\n", - "avg o/p voltage=353.50 V\n", - "rms value of o/p voltage=398.37 V\n", - "DF=0.92\n", - "PF=0.89\n", - "HF=0.29\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter2.ipynb b/_Power_Electronics/Chapter2.ipynb deleted file mode 100755 index 1872c9f4..00000000 --- a/_Power_Electronics/Chapter2.ipynb +++ /dev/null @@ -1,233 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 02 : Power Semiconductor Diodes and Transistors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1, Page No 21" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "B=40.0\n", - "R_c=10 #ohm\n", - "V_cc=130.0 #V\n", - "V_B=10.0 #V\n", - "V_CES=1.0 #V\n", - "V_BES=1.5 #V\n", - "\n", - "#Calculations\n", - "I_CS=(V_cc-V_CES)/R_c #A\n", - "I_BS=I_CS/B #A\n", - "R_B1=(V_B-V_BES)/I_BS\n", - "P_T1=V_BES*I_BS+V_CES*I_CS\n", - "ODF=5\n", - "I_B=ODF*I_BS\n", - "R_B2=(V_B-V_BES)/I_B\n", - "P_T2=V_BES*I_B+V_CES*I_CS\n", - "B_f=I_CS/I_B\n", - "\n", - "#Results\n", - "print(\"value of R_B in saturated state= %.2f ohm\" %R_B1)\n", - "print(\"Power loss in transistor=%.2f W\" %P_T1)\n", - "print(\"Value of R_B for an overdrive factor 5 = %.2f ohm\" %R_B2)\n", - "print(\"Power loss in transistor = %.2f W\" %P_T2)\n", - "print(\"Forced current gain=%.0f\" %B_f)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of R_B in saturated state= 26.36 ohm\n", - "Power loss in transistor=13.38 W\n", - "Value of R_B for an overdrive factor 5 = 5.27 ohm\n", - "Power loss in transistor = 15.32 W\n", - "Forced current gain=8\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.2, Page No 24" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_CEO=2*10**-3 #A\n", - "V_CC=220.0 #V\n", - "P_dt=I_CEO*V_CC #instant. power loss during delay time\n", - "t_d=.4*10**-6 #s\n", - "f=5000\n", - "P_d=f*I_CEO*V_CC*t_d #avg power loss during delay time\n", - "V_CES=2 #V\n", - "t_r=1*10**-6 #s\n", - "I_CS=80 #A\n", - "\n", - "#Calculations\n", - "P_r=f*I_CS*t_r*(V_CC/2-(V_CC-V_CES)/3) #avg power loss during rise time\n", - "t_m=V_CC*t_r/(2*(V_CC-V_CES))\n", - "P_rm=I_CS*V_CC**2/(4*(V_CC-V_CES)) #instant. power loss during rise time\n", - "\n", - "#Results\n", - "P_on=P_d+P_r \n", - "print(\"Avg power loss during turn on = %.2f W\" %P_on)\n", - "P_nt=I_CS*V_CES \n", - "print(\"Instantaneous power loss during turn on = %.0f W\" %P_nt)\n", - "t_n=50*10**-6\n", - "P_n=f*I_CS*V_CES*t_n\n", - "print(\"Avg power loss during conduction period = %.0f W\" %P_n)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Avg power loss during turn on = 14.93 W\n", - "Instantaneous power loss during turn on = 160 W\n", - "Avg power loss during conduction period = 40 W\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3 Page No 26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_CEO=2*10**-3 #A\n", - "V_CC=220 #V\n", - "t_d=.4*10**-6 #s\n", - "f=5000\n", - "V_CES=2 #V\n", - "t_r=1*10**-6 #s\n", - "I_CS=80 #A\n", - "t_n=50*10**-6 #s\n", - "t_0=40*10**-6 #s\n", - "t_f=3*10**-6 #s\n", - "\n", - "#Calculations\n", - "P_st=I_CS*V_CES # instant. power loss during t_s\n", - "P_s=f*I_CS*V_CES*t_f #avg power loss during t_s\n", - "P_f=f*t_f*(I_CS/6)*(V_CC-V_CES) #avg power loss during fall time\n", - "P_fm=(I_CS/4)*(V_CC-V_CES) #peak instant power dissipation\n", - "P_off=P_s+P_f\n", - "\n", - "#Results\n", - "print(\"Total avg power loss during turn off = %.2f W\" %P_off)\n", - "P_0t=I_CEO*V_CC\n", - "print(\"Instantaneous power loss during t_0 = %.2f W\" %P_0t)\n", - "P_0=f*I_CEO*V_CC*t_0 #avg power loss during t_s\n", - "P_on=14.9339 #W from previous eg\n", - "P_n=40 #W from previous eg\n", - "P_T=P_on+P_n+P_off+P_0 \n", - "print(\"Total power loss = %.2f W\" %P_T)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total avg power loss during turn off = 44.91 W\n", - "Instantaneous power loss during t_0 = 0.44 W\n", - "Total power loss = 99.93 W\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.4, Page No 28" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_CS=100.0 \n", - "V_CC=200.0 \n", - "t_on=40*10**-6\n", - "\n", - "#Calculations\n", - "P_on=(I_CS/50)*10**6*t_on*(V_CC*t_on/2-(V_CC*10**6*t_on**2/(40*3))) #energy during turn on\n", - "t_off=60*10**-6\n", - "P_off=(I_CS*t_off/2-(I_CS/60)*10**6*(t_off**2)/3)*((V_CC/75)*10**6*t_off) #energy during turn off\n", - "P_t=P_on+P_off #total energy\n", - "P_avg=300.0\n", - "f=P_avg/P_t\n", - "\n", - "#Results\n", - "print(\"Allowable switching frequency = %.2f Hz\" %f)\n", - "#in book ans is: f=1123.6 Hz. The difference in results due to difference in rounding of of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Allowable switching frequency = 1125.00 Hz\n" - ] - } - ], - "prompt_number": 10 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter2_1.ipynb b/_Power_Electronics/Chapter2_1.ipynb deleted file mode 100755 index 1872c9f4..00000000 --- a/_Power_Electronics/Chapter2_1.ipynb +++ /dev/null @@ -1,233 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 02 : Power Semiconductor Diodes and Transistors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1, Page No 21" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "B=40.0\n", - "R_c=10 #ohm\n", - "V_cc=130.0 #V\n", - "V_B=10.0 #V\n", - "V_CES=1.0 #V\n", - "V_BES=1.5 #V\n", - "\n", - "#Calculations\n", - "I_CS=(V_cc-V_CES)/R_c #A\n", - "I_BS=I_CS/B #A\n", - "R_B1=(V_B-V_BES)/I_BS\n", - "P_T1=V_BES*I_BS+V_CES*I_CS\n", - "ODF=5\n", - "I_B=ODF*I_BS\n", - "R_B2=(V_B-V_BES)/I_B\n", - "P_T2=V_BES*I_B+V_CES*I_CS\n", - "B_f=I_CS/I_B\n", - "\n", - "#Results\n", - "print(\"value of R_B in saturated state= %.2f ohm\" %R_B1)\n", - "print(\"Power loss in transistor=%.2f W\" %P_T1)\n", - "print(\"Value of R_B for an overdrive factor 5 = %.2f ohm\" %R_B2)\n", - "print(\"Power loss in transistor = %.2f W\" %P_T2)\n", - "print(\"Forced current gain=%.0f\" %B_f)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of R_B in saturated state= 26.36 ohm\n", - "Power loss in transistor=13.38 W\n", - "Value of R_B for an overdrive factor 5 = 5.27 ohm\n", - "Power loss in transistor = 15.32 W\n", - "Forced current gain=8\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.2, Page No 24" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_CEO=2*10**-3 #A\n", - "V_CC=220.0 #V\n", - "P_dt=I_CEO*V_CC #instant. power loss during delay time\n", - "t_d=.4*10**-6 #s\n", - "f=5000\n", - "P_d=f*I_CEO*V_CC*t_d #avg power loss during delay time\n", - "V_CES=2 #V\n", - "t_r=1*10**-6 #s\n", - "I_CS=80 #A\n", - "\n", - "#Calculations\n", - "P_r=f*I_CS*t_r*(V_CC/2-(V_CC-V_CES)/3) #avg power loss during rise time\n", - "t_m=V_CC*t_r/(2*(V_CC-V_CES))\n", - "P_rm=I_CS*V_CC**2/(4*(V_CC-V_CES)) #instant. power loss during rise time\n", - "\n", - "#Results\n", - "P_on=P_d+P_r \n", - "print(\"Avg power loss during turn on = %.2f W\" %P_on)\n", - "P_nt=I_CS*V_CES \n", - "print(\"Instantaneous power loss during turn on = %.0f W\" %P_nt)\n", - "t_n=50*10**-6\n", - "P_n=f*I_CS*V_CES*t_n\n", - "print(\"Avg power loss during conduction period = %.0f W\" %P_n)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Avg power loss during turn on = 14.93 W\n", - "Instantaneous power loss during turn on = 160 W\n", - "Avg power loss during conduction period = 40 W\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3 Page No 26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_CEO=2*10**-3 #A\n", - "V_CC=220 #V\n", - "t_d=.4*10**-6 #s\n", - "f=5000\n", - "V_CES=2 #V\n", - "t_r=1*10**-6 #s\n", - "I_CS=80 #A\n", - "t_n=50*10**-6 #s\n", - "t_0=40*10**-6 #s\n", - "t_f=3*10**-6 #s\n", - "\n", - "#Calculations\n", - "P_st=I_CS*V_CES # instant. power loss during t_s\n", - "P_s=f*I_CS*V_CES*t_f #avg power loss during t_s\n", - "P_f=f*t_f*(I_CS/6)*(V_CC-V_CES) #avg power loss during fall time\n", - "P_fm=(I_CS/4)*(V_CC-V_CES) #peak instant power dissipation\n", - "P_off=P_s+P_f\n", - "\n", - "#Results\n", - "print(\"Total avg power loss during turn off = %.2f W\" %P_off)\n", - "P_0t=I_CEO*V_CC\n", - "print(\"Instantaneous power loss during t_0 = %.2f W\" %P_0t)\n", - "P_0=f*I_CEO*V_CC*t_0 #avg power loss during t_s\n", - "P_on=14.9339 #W from previous eg\n", - "P_n=40 #W from previous eg\n", - "P_T=P_on+P_n+P_off+P_0 \n", - "print(\"Total power loss = %.2f W\" %P_T)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total avg power loss during turn off = 44.91 W\n", - "Instantaneous power loss during t_0 = 0.44 W\n", - "Total power loss = 99.93 W\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.4, Page No 28" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_CS=100.0 \n", - "V_CC=200.0 \n", - "t_on=40*10**-6\n", - "\n", - "#Calculations\n", - "P_on=(I_CS/50)*10**6*t_on*(V_CC*t_on/2-(V_CC*10**6*t_on**2/(40*3))) #energy during turn on\n", - "t_off=60*10**-6\n", - "P_off=(I_CS*t_off/2-(I_CS/60)*10**6*(t_off**2)/3)*((V_CC/75)*10**6*t_off) #energy during turn off\n", - "P_t=P_on+P_off #total energy\n", - "P_avg=300.0\n", - "f=P_avg/P_t\n", - "\n", - "#Results\n", - "print(\"Allowable switching frequency = %.2f Hz\" %f)\n", - "#in book ans is: f=1123.6 Hz. The difference in results due to difference in rounding of of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Allowable switching frequency = 1125.00 Hz\n" - ] - } - ], - "prompt_number": 10 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter2_2.ipynb b/_Power_Electronics/Chapter2_2.ipynb deleted file mode 100755 index 1872c9f4..00000000 --- a/_Power_Electronics/Chapter2_2.ipynb +++ /dev/null @@ -1,233 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 02 : Power Semiconductor Diodes and Transistors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1, Page No 21" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "B=40.0\n", - "R_c=10 #ohm\n", - "V_cc=130.0 #V\n", - "V_B=10.0 #V\n", - "V_CES=1.0 #V\n", - "V_BES=1.5 #V\n", - "\n", - "#Calculations\n", - "I_CS=(V_cc-V_CES)/R_c #A\n", - "I_BS=I_CS/B #A\n", - "R_B1=(V_B-V_BES)/I_BS\n", - "P_T1=V_BES*I_BS+V_CES*I_CS\n", - "ODF=5\n", - "I_B=ODF*I_BS\n", - "R_B2=(V_B-V_BES)/I_B\n", - "P_T2=V_BES*I_B+V_CES*I_CS\n", - "B_f=I_CS/I_B\n", - "\n", - "#Results\n", - "print(\"value of R_B in saturated state= %.2f ohm\" %R_B1)\n", - "print(\"Power loss in transistor=%.2f W\" %P_T1)\n", - "print(\"Value of R_B for an overdrive factor 5 = %.2f ohm\" %R_B2)\n", - "print(\"Power loss in transistor = %.2f W\" %P_T2)\n", - "print(\"Forced current gain=%.0f\" %B_f)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of R_B in saturated state= 26.36 ohm\n", - "Power loss in transistor=13.38 W\n", - "Value of R_B for an overdrive factor 5 = 5.27 ohm\n", - "Power loss in transistor = 15.32 W\n", - "Forced current gain=8\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.2, Page No 24" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_CEO=2*10**-3 #A\n", - "V_CC=220.0 #V\n", - "P_dt=I_CEO*V_CC #instant. power loss during delay time\n", - "t_d=.4*10**-6 #s\n", - "f=5000\n", - "P_d=f*I_CEO*V_CC*t_d #avg power loss during delay time\n", - "V_CES=2 #V\n", - "t_r=1*10**-6 #s\n", - "I_CS=80 #A\n", - "\n", - "#Calculations\n", - "P_r=f*I_CS*t_r*(V_CC/2-(V_CC-V_CES)/3) #avg power loss during rise time\n", - "t_m=V_CC*t_r/(2*(V_CC-V_CES))\n", - "P_rm=I_CS*V_CC**2/(4*(V_CC-V_CES)) #instant. power loss during rise time\n", - "\n", - "#Results\n", - "P_on=P_d+P_r \n", - "print(\"Avg power loss during turn on = %.2f W\" %P_on)\n", - "P_nt=I_CS*V_CES \n", - "print(\"Instantaneous power loss during turn on = %.0f W\" %P_nt)\n", - "t_n=50*10**-6\n", - "P_n=f*I_CS*V_CES*t_n\n", - "print(\"Avg power loss during conduction period = %.0f W\" %P_n)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Avg power loss during turn on = 14.93 W\n", - "Instantaneous power loss during turn on = 160 W\n", - "Avg power loss during conduction period = 40 W\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3 Page No 26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_CEO=2*10**-3 #A\n", - "V_CC=220 #V\n", - "t_d=.4*10**-6 #s\n", - "f=5000\n", - "V_CES=2 #V\n", - "t_r=1*10**-6 #s\n", - "I_CS=80 #A\n", - "t_n=50*10**-6 #s\n", - "t_0=40*10**-6 #s\n", - "t_f=3*10**-6 #s\n", - "\n", - "#Calculations\n", - "P_st=I_CS*V_CES # instant. power loss during t_s\n", - "P_s=f*I_CS*V_CES*t_f #avg power loss during t_s\n", - "P_f=f*t_f*(I_CS/6)*(V_CC-V_CES) #avg power loss during fall time\n", - "P_fm=(I_CS/4)*(V_CC-V_CES) #peak instant power dissipation\n", - "P_off=P_s+P_f\n", - "\n", - "#Results\n", - "print(\"Total avg power loss during turn off = %.2f W\" %P_off)\n", - "P_0t=I_CEO*V_CC\n", - "print(\"Instantaneous power loss during t_0 = %.2f W\" %P_0t)\n", - "P_0=f*I_CEO*V_CC*t_0 #avg power loss during t_s\n", - "P_on=14.9339 #W from previous eg\n", - "P_n=40 #W from previous eg\n", - "P_T=P_on+P_n+P_off+P_0 \n", - "print(\"Total power loss = %.2f W\" %P_T)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total avg power loss during turn off = 44.91 W\n", - "Instantaneous power loss during t_0 = 0.44 W\n", - "Total power loss = 99.93 W\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.4, Page No 28" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_CS=100.0 \n", - "V_CC=200.0 \n", - "t_on=40*10**-6\n", - "\n", - "#Calculations\n", - "P_on=(I_CS/50)*10**6*t_on*(V_CC*t_on/2-(V_CC*10**6*t_on**2/(40*3))) #energy during turn on\n", - "t_off=60*10**-6\n", - "P_off=(I_CS*t_off/2-(I_CS/60)*10**6*(t_off**2)/3)*((V_CC/75)*10**6*t_off) #energy during turn off\n", - "P_t=P_on+P_off #total energy\n", - "P_avg=300.0\n", - "f=P_avg/P_t\n", - "\n", - "#Results\n", - "print(\"Allowable switching frequency = %.2f Hz\" %f)\n", - "#in book ans is: f=1123.6 Hz. The difference in results due to difference in rounding of of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Allowable switching frequency = 1125.00 Hz\n" - ] - } - ], - "prompt_number": 10 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter2_3.ipynb b/_Power_Electronics/Chapter2_3.ipynb deleted file mode 100755 index 1872c9f4..00000000 --- a/_Power_Electronics/Chapter2_3.ipynb +++ /dev/null @@ -1,233 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 02 : Power Semiconductor Diodes and Transistors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1, Page No 21" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "B=40.0\n", - "R_c=10 #ohm\n", - "V_cc=130.0 #V\n", - "V_B=10.0 #V\n", - "V_CES=1.0 #V\n", - "V_BES=1.5 #V\n", - "\n", - "#Calculations\n", - "I_CS=(V_cc-V_CES)/R_c #A\n", - "I_BS=I_CS/B #A\n", - "R_B1=(V_B-V_BES)/I_BS\n", - "P_T1=V_BES*I_BS+V_CES*I_CS\n", - "ODF=5\n", - "I_B=ODF*I_BS\n", - "R_B2=(V_B-V_BES)/I_B\n", - "P_T2=V_BES*I_B+V_CES*I_CS\n", - "B_f=I_CS/I_B\n", - "\n", - "#Results\n", - "print(\"value of R_B in saturated state= %.2f ohm\" %R_B1)\n", - "print(\"Power loss in transistor=%.2f W\" %P_T1)\n", - "print(\"Value of R_B for an overdrive factor 5 = %.2f ohm\" %R_B2)\n", - "print(\"Power loss in transistor = %.2f W\" %P_T2)\n", - "print(\"Forced current gain=%.0f\" %B_f)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of R_B in saturated state= 26.36 ohm\n", - "Power loss in transistor=13.38 W\n", - "Value of R_B for an overdrive factor 5 = 5.27 ohm\n", - "Power loss in transistor = 15.32 W\n", - "Forced current gain=8\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.2, Page No 24" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_CEO=2*10**-3 #A\n", - "V_CC=220.0 #V\n", - "P_dt=I_CEO*V_CC #instant. power loss during delay time\n", - "t_d=.4*10**-6 #s\n", - "f=5000\n", - "P_d=f*I_CEO*V_CC*t_d #avg power loss during delay time\n", - "V_CES=2 #V\n", - "t_r=1*10**-6 #s\n", - "I_CS=80 #A\n", - "\n", - "#Calculations\n", - "P_r=f*I_CS*t_r*(V_CC/2-(V_CC-V_CES)/3) #avg power loss during rise time\n", - "t_m=V_CC*t_r/(2*(V_CC-V_CES))\n", - "P_rm=I_CS*V_CC**2/(4*(V_CC-V_CES)) #instant. power loss during rise time\n", - "\n", - "#Results\n", - "P_on=P_d+P_r \n", - "print(\"Avg power loss during turn on = %.2f W\" %P_on)\n", - "P_nt=I_CS*V_CES \n", - "print(\"Instantaneous power loss during turn on = %.0f W\" %P_nt)\n", - "t_n=50*10**-6\n", - "P_n=f*I_CS*V_CES*t_n\n", - "print(\"Avg power loss during conduction period = %.0f W\" %P_n)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Avg power loss during turn on = 14.93 W\n", - "Instantaneous power loss during turn on = 160 W\n", - "Avg power loss during conduction period = 40 W\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3 Page No 26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_CEO=2*10**-3 #A\n", - "V_CC=220 #V\n", - "t_d=.4*10**-6 #s\n", - "f=5000\n", - "V_CES=2 #V\n", - "t_r=1*10**-6 #s\n", - "I_CS=80 #A\n", - "t_n=50*10**-6 #s\n", - "t_0=40*10**-6 #s\n", - "t_f=3*10**-6 #s\n", - "\n", - "#Calculations\n", - "P_st=I_CS*V_CES # instant. power loss during t_s\n", - "P_s=f*I_CS*V_CES*t_f #avg power loss during t_s\n", - "P_f=f*t_f*(I_CS/6)*(V_CC-V_CES) #avg power loss during fall time\n", - "P_fm=(I_CS/4)*(V_CC-V_CES) #peak instant power dissipation\n", - "P_off=P_s+P_f\n", - "\n", - "#Results\n", - "print(\"Total avg power loss during turn off = %.2f W\" %P_off)\n", - "P_0t=I_CEO*V_CC\n", - "print(\"Instantaneous power loss during t_0 = %.2f W\" %P_0t)\n", - "P_0=f*I_CEO*V_CC*t_0 #avg power loss during t_s\n", - "P_on=14.9339 #W from previous eg\n", - "P_n=40 #W from previous eg\n", - "P_T=P_on+P_n+P_off+P_0 \n", - "print(\"Total power loss = %.2f W\" %P_T)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total avg power loss during turn off = 44.91 W\n", - "Instantaneous power loss during t_0 = 0.44 W\n", - "Total power loss = 99.93 W\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.4, Page No 28" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_CS=100.0 \n", - "V_CC=200.0 \n", - "t_on=40*10**-6\n", - "\n", - "#Calculations\n", - "P_on=(I_CS/50)*10**6*t_on*(V_CC*t_on/2-(V_CC*10**6*t_on**2/(40*3))) #energy during turn on\n", - "t_off=60*10**-6\n", - "P_off=(I_CS*t_off/2-(I_CS/60)*10**6*(t_off**2)/3)*((V_CC/75)*10**6*t_off) #energy during turn off\n", - "P_t=P_on+P_off #total energy\n", - "P_avg=300.0\n", - "f=P_avg/P_t\n", - "\n", - "#Results\n", - "print(\"Allowable switching frequency = %.2f Hz\" %f)\n", - "#in book ans is: f=1123.6 Hz. The difference in results due to difference in rounding of of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Allowable switching frequency = 1125.00 Hz\n" - ] - } - ], - "prompt_number": 10 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter2_4.ipynb b/_Power_Electronics/Chapter2_4.ipynb deleted file mode 100755 index 1872c9f4..00000000 --- a/_Power_Electronics/Chapter2_4.ipynb +++ /dev/null @@ -1,233 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 02 : Power Semiconductor Diodes and Transistors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1, Page No 21" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "B=40.0\n", - "R_c=10 #ohm\n", - "V_cc=130.0 #V\n", - "V_B=10.0 #V\n", - "V_CES=1.0 #V\n", - "V_BES=1.5 #V\n", - "\n", - "#Calculations\n", - "I_CS=(V_cc-V_CES)/R_c #A\n", - "I_BS=I_CS/B #A\n", - "R_B1=(V_B-V_BES)/I_BS\n", - "P_T1=V_BES*I_BS+V_CES*I_CS\n", - "ODF=5\n", - "I_B=ODF*I_BS\n", - "R_B2=(V_B-V_BES)/I_B\n", - "P_T2=V_BES*I_B+V_CES*I_CS\n", - "B_f=I_CS/I_B\n", - "\n", - "#Results\n", - "print(\"value of R_B in saturated state= %.2f ohm\" %R_B1)\n", - "print(\"Power loss in transistor=%.2f W\" %P_T1)\n", - "print(\"Value of R_B for an overdrive factor 5 = %.2f ohm\" %R_B2)\n", - "print(\"Power loss in transistor = %.2f W\" %P_T2)\n", - "print(\"Forced current gain=%.0f\" %B_f)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of R_B in saturated state= 26.36 ohm\n", - "Power loss in transistor=13.38 W\n", - "Value of R_B for an overdrive factor 5 = 5.27 ohm\n", - "Power loss in transistor = 15.32 W\n", - "Forced current gain=8\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.2, Page No 24" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_CEO=2*10**-3 #A\n", - "V_CC=220.0 #V\n", - "P_dt=I_CEO*V_CC #instant. power loss during delay time\n", - "t_d=.4*10**-6 #s\n", - "f=5000\n", - "P_d=f*I_CEO*V_CC*t_d #avg power loss during delay time\n", - "V_CES=2 #V\n", - "t_r=1*10**-6 #s\n", - "I_CS=80 #A\n", - "\n", - "#Calculations\n", - "P_r=f*I_CS*t_r*(V_CC/2-(V_CC-V_CES)/3) #avg power loss during rise time\n", - "t_m=V_CC*t_r/(2*(V_CC-V_CES))\n", - "P_rm=I_CS*V_CC**2/(4*(V_CC-V_CES)) #instant. power loss during rise time\n", - "\n", - "#Results\n", - "P_on=P_d+P_r \n", - "print(\"Avg power loss during turn on = %.2f W\" %P_on)\n", - "P_nt=I_CS*V_CES \n", - "print(\"Instantaneous power loss during turn on = %.0f W\" %P_nt)\n", - "t_n=50*10**-6\n", - "P_n=f*I_CS*V_CES*t_n\n", - "print(\"Avg power loss during conduction period = %.0f W\" %P_n)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Avg power loss during turn on = 14.93 W\n", - "Instantaneous power loss during turn on = 160 W\n", - "Avg power loss during conduction period = 40 W\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3 Page No 26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_CEO=2*10**-3 #A\n", - "V_CC=220 #V\n", - "t_d=.4*10**-6 #s\n", - "f=5000\n", - "V_CES=2 #V\n", - "t_r=1*10**-6 #s\n", - "I_CS=80 #A\n", - "t_n=50*10**-6 #s\n", - "t_0=40*10**-6 #s\n", - "t_f=3*10**-6 #s\n", - "\n", - "#Calculations\n", - "P_st=I_CS*V_CES # instant. power loss during t_s\n", - "P_s=f*I_CS*V_CES*t_f #avg power loss during t_s\n", - "P_f=f*t_f*(I_CS/6)*(V_CC-V_CES) #avg power loss during fall time\n", - "P_fm=(I_CS/4)*(V_CC-V_CES) #peak instant power dissipation\n", - "P_off=P_s+P_f\n", - "\n", - "#Results\n", - "print(\"Total avg power loss during turn off = %.2f W\" %P_off)\n", - "P_0t=I_CEO*V_CC\n", - "print(\"Instantaneous power loss during t_0 = %.2f W\" %P_0t)\n", - "P_0=f*I_CEO*V_CC*t_0 #avg power loss during t_s\n", - "P_on=14.9339 #W from previous eg\n", - "P_n=40 #W from previous eg\n", - "P_T=P_on+P_n+P_off+P_0 \n", - "print(\"Total power loss = %.2f W\" %P_T)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total avg power loss during turn off = 44.91 W\n", - "Instantaneous power loss during t_0 = 0.44 W\n", - "Total power loss = 99.93 W\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.4, Page No 28" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_CS=100.0 \n", - "V_CC=200.0 \n", - "t_on=40*10**-6\n", - "\n", - "#Calculations\n", - "P_on=(I_CS/50)*10**6*t_on*(V_CC*t_on/2-(V_CC*10**6*t_on**2/(40*3))) #energy during turn on\n", - "t_off=60*10**-6\n", - "P_off=(I_CS*t_off/2-(I_CS/60)*10**6*(t_off**2)/3)*((V_CC/75)*10**6*t_off) #energy during turn off\n", - "P_t=P_on+P_off #total energy\n", - "P_avg=300.0\n", - "f=P_avg/P_t\n", - "\n", - "#Results\n", - "print(\"Allowable switching frequency = %.2f Hz\" %f)\n", - "#in book ans is: f=1123.6 Hz. The difference in results due to difference in rounding of of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Allowable switching frequency = 1125.00 Hz\n" - ] - } - ], - "prompt_number": 10 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter3.ipynb b/_Power_Electronics/Chapter3.ipynb deleted file mode 100755 index 2e53ef9d..00000000 --- a/_Power_Electronics/Chapter3.ipynb +++ /dev/null @@ -1,1001 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 03 : Diode Circuits and Rectifiers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.2, Page No 55" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0 #V\n", - "V_o=100.0 #V\n", - "L=100.0 #uH\n", - "C=30.0 #uF\n", - "\n", - "#Calculations\n", - "t_o=math.pi*math.sqrt(L*C)\n", - "print(\"conduction time of diode = %.2f us\" %t_o)\n", - "#in book solution is t_o=54.77 us. The ans is incorrect as %pi is not muliplied in ans. Formulae mentioned in correct.\n", - "I_p=(V_s-V_o)*math.sqrt(C/L)\n", - "\n", - "#Results\n", - "print(\"Peak current through diode=%.2f A\" %I_p)\n", - "v_D=-V_s+V_o \n", - "print(\"Voltage across diode = %.2f V\" %v_D)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of diode = 172.07 us\n", - "Peak current through diode=164.32 A\n", - "Voltage across diode = -300.00 V\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.6, Page No 61" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "R=10 #ohm\n", - "L=0.001 #H\n", - "C=5*10**-6 #F\n", - "V_s=230 #V\n", - "xi=R/(2*L)\n", - "\n", - "#Calculations\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt((1/(L*C))-(R/(2*L))**2)\n", - "t=math.pi/w_r \n", - "\n", - "#Results\n", - "print('Conduction time of diode=%.3f us'%(t*10**6))\n", - "t=0\n", - "di=V_s/L\n", - "print('Rate of change of current at t=0 is %.2f A/s' %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Conduction time of diode=237.482 us\n", - "Rate of change of current at t=0 is 230000.00 A/s\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.7 Page No 69" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_or=100 #A\n", - "R=1.0 #assumption\n", - "\n", - "#Calculations\n", - "V_m=I_or*2*R\n", - "I_o=V_m/(math.pi*R)\n", - "q=200 #Ah\n", - "t=q/I_o\n", - "\n", - "#Results\n", - "print(\"time required to deliver charge=%.02f hrs\" %t)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time required to deliver charge=3.14 hrs\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.8, Page No 70" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "P=1000 #W\n", - "R=V_s**2/P\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(2)*V_s/2\n", - "P_h=V_or**2/R \n", - "print(\"Power delivered to the heater = %.2f W\" %P_h)\n", - "V_m=math.sqrt(2)*230\n", - "I_m=V_m/R\n", - "\n", - "#Results\n", - "print(\"Peak value of diode current = %.2f A\" %I_m)\n", - "pf=V_or/V_s\n", - "print(\"Input power factor=%.2f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered to the heater = 500.00 W\n", - "Peak value of diode current = 6.15 A\n", - "Input power factor=0.71\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.9 Page No 71" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "V_m=V_s*math.sqrt(2)\n", - "E=150 #V\n", - "\n", - "#Calculations\n", - "theta1=math.degrees(E/(math.sqrt(2)*V_s))\n", - "R=8 #ohm\n", - "f=50 #Hz\n", - "I_o=(1/(2*math.pi*R))*((2*math.sqrt(2)*V_s*math.cos(math.radians(theta1)))-E*(math.pi-2*theta1*math.pi/180))\n", - "\n", - "#Results\n", - "print(\"avg value of charging current=%.2f A\" %I_o)\n", - "P_d=E*I_o\n", - "print(\"\\npower delivered to battery=%.2f W\" %P_d)\n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V_s**2+E**2)*(math.pi-2*theta1*math.pi/180)+V_s**2*math.sin(math.radians(2*theta1))-4*V_m*E*math.cos(math.radians(theta1))))\n", - "print(\"\\nrms value of the load current=%.2f A\" %I_or)\n", - "pf=(E*I_o+I_or**2*R)/(V_s*I_or)\n", - "print(\"\\nsupply pf=%.3f\" %pf)\n", - "P_dd=I_or**2*R\n", - "print(\"\\npower dissipated in the resistor=%.2f W\" %P_dd)\n", - "q=1000.00 #Wh\n", - "t=q/P_d \n", - "print(\"\\ncharging time=%.2f hr\" %t)\n", - "n=P_d*100/(P_d+P_dd)\n", - "print(\"rectifier efficiency =%.2f \" %n)\n", - "PIV=math.sqrt(2)*V_s+E\n", - "print(\"PIV of diode=%.2f V\" %PIV)\n", - "#solutions have small variations due to difference in rounding off of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg value of charging current=4.97 A\n", - "\n", - "power delivered to battery=745.11 W\n", - "\n", - "rms value of the load current=9.29 A\n", - "\n", - "supply pf=0.672\n", - "\n", - "power dissipated in the resistor=690.74 W\n", - "\n", - "charging time=1.34 hr\n", - "rectifier efficiency =51.89 \n", - "PIV of diode=475.27 V\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.10 Page No 78" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "t_rr=40*10**-6 #s reverde recovery time\n", - "\n", - "#Calculations\n", - "V_o=2*math.sqrt(2)*V_s/math.pi\n", - "V_m=math.sqrt(2)*V_s\n", - "f=50\n", - "V_r1=(V_m/math.pi)*(1-math.cos(math.radians(2*math.pi*f*t_rr*180/math.pi)))\n", - "v_avg1=V_r1*100/V_o*10**3\n", - "f=2500\n", - "V_r2=(V_m/math.pi)*(1-math.cos(math.radians(2*math.pi*f*t_rr*180/math.pi)))\n", - "v_avg2=V_r2*100/V_o\n", - "\n", - "#Results\n", - "print(\"when f=50Hz\")\n", - "print(\"Percentage reduction in avg o/p voltage=%.2f x 10^-3\" %v_avg1)\n", - "print(\"when f=2500Hz\")\n", - "print(\"Percentage reduction in avg o/p voltage = %.3f\" %v_avg2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when f=50Hz\n", - "Percentage reduction in avg o/p voltage=3.95 x 10^-3\n", - "when f=2500Hz\n", - "Percentage reduction in avg o/p voltage = 9.549\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.11, Page No 79 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "R=10.0 #ohm\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "V_o=2*V_m/math.pi\n", - "print(\"Avg value of o/p voltage = %.2f V\" %V_o)\n", - "I_o=V_o/R\n", - "print(\"Avg value of o/p current = %.2f A\" %I_o)\n", - "I_DA=I_o/2\n", - "print(\"Avg value of diode current=%.2f A\" %I_DA)\n", - "I_Dr=I_o/math.sqrt(2) \n", - "\n", - "#Results\n", - "print(\"rms value of diode current=%.2f A\" %I_Dr)\n", - "print(\"rms value of o/p current = %.2f A\" %I_o)\n", - "print(\"rms value of i/p current = %.2f A\" %I_o)\n", - "pf=(V_o/V_s)\n", - "print(\"supply pf = %.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Avg value of o/p voltage = 207.07 V\n", - "Avg value of o/p current = 20.71 A\n", - "Avg value of diode current=10.35 A\n", - "rms value of diode current=14.64 A\n", - "rms value of o/p current = 20.71 A\n", - "rms value of i/p current = 20.71 A\n", - "supply pf = 0.90\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.12 Page No 80" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "R=1000.0 #ohm\n", - "R_D=20.0 #ohm\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "I_om=V_m/(R+R_D) \n", - "\n", - "#Results\n", - "print(\"Peak load current = %.2f A\" %I_om)\n", - "I_o=I_om/math.pi\n", - "print(\"dc load current = %.2f A\" %I_o)\n", - "V_D=I_o*R_D-V_m/math.pi\n", - "print(\"dc diode voltage = %.2f V\" %V_D)\n", - "V_on=V_m/math.pi\n", - "print(\"at no load, load voltage = %.2f V\" %V_on)\n", - "V_o1=I_o*R \n", - "print(\"at given load, load voltage = %.2f V\" %V_o1)\n", - "vr=(V_on-V_o1)*100/V_on \n", - "print(\"Voltage regulation(in percent)=%.2f\" %vr)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Peak load current = 0.32 A\n", - "dc load current = 0.10 A\n", - "dc diode voltage = -101.51 V\n", - "at no load, load voltage = 103.54 V\n", - "at given load, load voltage = 101.51 V\n", - "Voltage regulation(in percent)=1.96\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.13 Page No 82" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_L=6.8 #V\n", - "V_smax=20*1.2 #V\n", - "V_smin=20*.8 #V\n", - "I_Lmax=30*1.5 #mA\n", - "I_Lmin=30*0.5 #mA\n", - "I_z=1 #mA\n", - "\n", - "#Calculations\n", - "R_smax=(V_smax-V_L)/((I_Lmin+I_z)*10**-3)\n", - "print(\"max source resistance = %.2f ohm\" %R_smax)\n", - "R_smin=(V_smin-V_L)/((I_Lmax+I_z)*10**-3) \n", - "print(\"Min source resistance = %.2f ohm\" %R_smin) #in book solution, error is committed in putting the values in formulea(printing error) but solution is correct\n", - "R_Lmax=V_L*1000/I_Lmin\n", - "print(\"Max load resistance = %.2f ohm\" %R_Lmax)\n", - "R_Lmin=V_L*1000/I_Lmax \n", - "V_d=0.6 #V\n", - "V_r=V_L-V_d\n", - "\n", - "#Results\n", - "print(\"Min load resistance=%.2f ohm\" %R_Lmin)\n", - "print(\"Voltage rating of zener diode=%.2f V\" %V_r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max source resistance = 1075.00 ohm\n", - "Min source resistance = 200.00 ohm\n", - "Max load resistance = 453.33 ohm\n", - "Min load resistance=151.11 ohm\n", - "Voltage rating of zener diode=6.20 V\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.14 Page No 83" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I2=200*10**-6 #A\n", - "V_z=20 #V\n", - "R_G=500.0 #hm\n", - "\n", - "#Calculations\n", - "R2=(V_z/I2)-R_G\n", - "print(\"R2=%.2f kilo-ohm\" %(R2/1000))\n", - "\n", - "V_v=25 #V\n", - "I1=I2\n", - "R1=(V_v-V_z)/I1\n", - "\n", - "#Results\n", - "print(\"R1=%.0f kilo-ohm\"%(R1/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R2=99.50 kilo-ohm\n", - "R1=25 kilo-ohm\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.15, Page No 92" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=2*230 #V\n", - "\n", - "#Calculations\n", - "V_o=(math.sqrt(2)*V_s)/math.pi\n", - "R=60 #ohm\n", - "P_dc=(V_o)**2/R\n", - "TUF=0.2865\n", - "VA=P_dc/TUF\n", - "\n", - "#RESULTS\n", - "print(\"kVA rating of the transformer = %.2f kVA\" %(VA/1000));\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "kVA rating of the transformer = 2.49 kVA\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.16, Page No 92" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tr=0.5 #turns ratio\n", - "I_o=10.0\n", - "V=230.0\n", - "V_s=V/tr\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "V_o=2*V_m/math.pi\n", - "phi1=0\n", - "#displacemnt angle=0 as fundamnetal component of i/p source current in phase with source voltage\n", - "DF=math.cos(math.radians(phi1))\n", - "I_s1=4*I_o/(math.sqrt(2)*math.pi)\n", - "I_s=math.sqrt(I_o**2*math.pi/math.pi)\n", - "CDF=I_s1/I_o\n", - "pf=CDF*DF\n", - "HF=math.sqrt((I_s/I_s1)**2-1)\n", - "CF=I_o/I_s\n", - "\n", - "#Results\n", - "print(\"o/p voltage = %.2f V\" %V_o)\n", - "print(\"distortion factor = %.2f\" %DF)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"Current displacent factor=%.2f\" %CDF)\n", - "print(\"Harmonic factor = %.2f\" %HF)\n", - "print(\"Creast factor = %.2f\" %CF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "o/p voltage = 414.15 V\n", - "distortion factor = 1.00\n", - "i/p pf=0.90\n", - "Current displacent factor=0.90\n", - "Harmonic factor = 0.48\n", - "Creast factor = 1.00\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.17, Page No 94" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=230.0\n", - "R=10.0\n", - "V_s=V_o*math.pi/(2*math.sqrt(2))\n", - "I_o=V_o/R\n", - "I_m=math.sqrt(2)*V_s/R\n", - "I_DAV=I_m/math.pi\n", - "\n", - "#Calculations\n", - "#avg value of diode current\n", - "I_Dr=I_m/2\n", - "PIV=math.sqrt(2)*V_s\n", - "I_s=I_m/math.sqrt(2)\n", - "TF=V_s*I_s\n", - "\n", - "#Results\n", - "print(\"peak diode current=%.2f A\" %I_m)\n", - "print(\"I_DAV=%.2f A\" %I_DAV)\n", - "print(\"I_Dr=%.2f A\" %I_Dr) #rms value of diode current\n", - "print(\"PIV=%.1f V\" %PIV)\n", - "print(\"Transformer rating = %.2f kVA\" %(TF/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak diode current=36.13 A\n", - "I_DAV=11.50 A\n", - "I_Dr=18.06 A\n", - "PIV=361.3 V\n", - "Transformer rating = 6.53 kVA\n" - ] - } - ], - "prompt_number": 38 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.18, Page No 103" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tr=5\n", - "V=1100.0\n", - "R=10.0\n", - "\n", - "\n", - "#Calculations\n", - "print(\"In case of 3ph-3pulse type\")\n", - "V_ph=V/tr\n", - "V_mp=math.sqrt(2)*V_ph\n", - "V_o=3*math.sqrt(3)*V_mp/(2*math.pi)\n", - "print(\"avg o/p voltage=%.1f V\" %V_o)\n", - "I_mp=V_mp/R\n", - "I_D=(I_mp/math.pi)*math.sin(math.pi/3) \n", - "print(\"\\navg value of diode current=%.3f A\" %I_D)\n", - "I_Dr=I_mp*math.sqrt((1/(2*math.pi))*(math.pi/3+.5*math.sin(2*math.pi/3))) \n", - "print(\"\\nrms value of diode current=%.2f A\" %I_Dr)\n", - "V_or=V_mp*math.sqrt((3/(2*math.pi))*(math.pi/3+.5*math.sin(2*math.pi/3)))\n", - "P=(V_or**2)/R \n", - "print(\"\\npower delivered=%.1f W\" %P)\n", - "print(\"in case of 3ph-M6 type\")\n", - "V_ph=V_ph/2\n", - "V_mp=math.sqrt(2)*V_ph\n", - "V_o=3*V_mp/(math.pi) \n", - "I_mp=V_mp/R\n", - "I_D=(I_mp/math.pi)*math.sin(math.pi/6) \n", - "I_Dr=I_mp*math.sqrt((1/(2*math.pi))*(math.pi/6+.5*math.sin(2*math.pi/6))) \n", - "V_or=V_mp*math.sqrt((6/(2*math.pi))*(math.pi/6+.5*math.sin(2*math.pi/6)))\n", - "P=(V_or**2)/R \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.2f V\" %V_o)\n", - "print(\"\\navg value of diode current=%.2f A\" %I_D)\n", - "print(\"\\nrms value of diode current=%.2f A\" %I_Dr)\n", - "print(\"\\npower delivered=%.0f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "In case of 3ph-3pulse type\n", - "avg o/p voltage=257.3 V\n", - "\n", - "avg value of diode current=8.577 A\n", - "\n", - "rms value of diode current=15.10 A\n", - "\n", - "power delivered=6841.3 W\n", - "in case of 3ph-M6 type\n", - "avg o/p voltage=148.55 V\n", - "\n", - "avg value of diode current=2.48 A\n", - "\n", - "rms value of diode current=6.07 A\n", - "\n", - "power delivered=2211 W\n" - ] - } - ], - "prompt_number": 39 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.19, Page No 115" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=400\n", - "R=10\n", - "\n", - "#Calculations\n", - "V_ml=V_o*math.pi/3\n", - "V_s=V_ml/(math.sqrt(2)*math.sqrt(3))\n", - "I_m=V_ml/R\n", - "I_s=.7804*I_m\n", - "tr=3*V_s*I_s \n", - "\n", - "#Results\n", - "print(\"transformer rating=%.1f VA\" %tr)\n", - "I_Dr=.5518*I_m \n", - "print(\"\\nrms value of diode current=%.3f A\" %I_Dr)\n", - "I_D=I_m/math.pi \n", - "print(\"\\navg value of diode current=%.3f A\" %I_D)\n", - "print(\"\\npeak diode current=%.2f A\" %I_m)\n", - "PIV=V_ml \n", - "print(\"\\nPIV=%.2f V\" %PIV)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transformer rating=16770.3 VA\n", - "\n", - "rms value of diode current=23.114 A\n", - "\n", - "avg value of diode current=13.333 A\n", - "\n", - "peak diode current=41.89 A\n", - "\n", - "PIV=418.88 V\n" - ] - } - ], - "prompt_number": 40 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.20, Page No 116" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_l=230\n", - "E=240\n", - "R=8\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_l\n", - "V_o=3*V_ml/math.pi\n", - "I_o=(V_o-E)/R\n", - "P_b=E*I_o \n", - "P_d=E*I_o+I_o**2*R \n", - "phi1=0\n", - "math.cos(math.radians(phi1))\n", - "I_s1=2*math.sqrt(3)*I_o/(math.sqrt(2)*math.pi)\n", - "I_s=math.sqrt(I_o**2*2*math.pi/(3*math.pi))\n", - "CDF=I_s1/I_s \n", - "pf=DF*CDF \n", - "HF=math.sqrt(CDF**-2-1) \n", - "tr=math.sqrt(3)*V_l*I_o*math.sqrt(2/3)\n", - "\n", - "#Results\n", - "print(\"Power delivered to battery=%.1f W\" %P_b)\n", - "print(\"Power delivered to load=%.2f W\" %P_d)\n", - "print(\"Displacement factor=%.2f\" %DF)\n", - "print(\"Current distortion factor=%.3f\" %CDF)\n", - "print(\"i/p pf=%.3f\"%pf)\n", - "print(\"Harmonic factor=%.2f\" %HF)\n", - "print(\"Tranformer rating=%.2f VA\" %tr)\n", - "#answers have small variations from the book due to difference in rounding off of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered to battery=2118.3 W\n", - "Power delivered to load=2741.48 W\n", - "Displacement factor=1.00\n", - "Current distortion factor=0.955\n", - "i/p pf=0.955\n", - "Harmonic factor=0.31\n", - "Tranformer rating=0.00 VA\n" - ] - } - ], - "prompt_number": 41 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.21, Page No 122" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50 #Hz\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V\n", - "R=400.0\n", - "RF=0.05\n", - "C=(1/(4*f*R))*(1+(1/(math.sqrt(2)*RF)))\n", - "\n", - "#Results\n", - "print(\"capacitor value=%.2f uF\" %(C/10**-6))\n", - "V_o=V_m*(1-1/(4*f*R*C))\n", - "print(\"o/p voltage with filter=%.2f V\" %V_o)\n", - "V_o=2*V_m/math.pi \n", - "print(\"o/p voltage without filter=%.2f V\" %V_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "capacitor value=189.28 uF\n", - "o/p voltage with filter=303.79 V\n", - "o/p voltage without filter=207.07 V\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.22, Page No 122" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50\n", - "CRF=0.05\n", - "R=300\n", - "\n", - "#Calculations\n", - "L=math.sqrt((CRF/(.4715*R))**-2-R**2)/(2*2*math.pi*f) \n", - "print(\"L=%.2f H\" %L)\n", - "R=30\n", - "L=math.sqrt((CRF/(.4715*R))**-2-R**2)/(2*2*math.pi*f) \n", - "\n", - "\n", - "#Results\n", - "print(\"\\nL=%.2f H\" %L)\n", - "L=0\n", - "CRF=.4715*R/math.sqrt(R**2+(2*2*math.pi*f*L)**2) \n", - "print(\"\\nCRF=%.2f\" %CRF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "L=4.48 H\n", - "\n", - "L=0.45 H\n", - "\n", - "CRF=0.47\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.23, Page No 127" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=50\n", - "L_L=10*10**-3\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "\n", - "#Calculations\n", - "C=10/(2*w*math.sqrt(R**2+(2*w*L_L)**2))\n", - "\n", - "#Results\n", - "print(\"C=%.2f uF\" %(C*10**6))\n", - "VRF=0.1\n", - "L=(1/(4*w**2*C))*((math.sqrt(2)/(3*VRF))+1)\n", - "print(\"\\nL=%.2f mH\" %(L*10**3))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "C=315.83 uF\n", - "\n", - "L=45.83 mH\n" - ] - } - ], - "prompt_number": 44 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter3_1.ipynb b/_Power_Electronics/Chapter3_1.ipynb deleted file mode 100755 index 2e53ef9d..00000000 --- a/_Power_Electronics/Chapter3_1.ipynb +++ /dev/null @@ -1,1001 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 03 : Diode Circuits and Rectifiers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.2, Page No 55" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0 #V\n", - "V_o=100.0 #V\n", - "L=100.0 #uH\n", - "C=30.0 #uF\n", - "\n", - "#Calculations\n", - "t_o=math.pi*math.sqrt(L*C)\n", - "print(\"conduction time of diode = %.2f us\" %t_o)\n", - "#in book solution is t_o=54.77 us. The ans is incorrect as %pi is not muliplied in ans. Formulae mentioned in correct.\n", - "I_p=(V_s-V_o)*math.sqrt(C/L)\n", - "\n", - "#Results\n", - "print(\"Peak current through diode=%.2f A\" %I_p)\n", - "v_D=-V_s+V_o \n", - "print(\"Voltage across diode = %.2f V\" %v_D)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of diode = 172.07 us\n", - "Peak current through diode=164.32 A\n", - "Voltage across diode = -300.00 V\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.6, Page No 61" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "R=10 #ohm\n", - "L=0.001 #H\n", - "C=5*10**-6 #F\n", - "V_s=230 #V\n", - "xi=R/(2*L)\n", - "\n", - "#Calculations\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt((1/(L*C))-(R/(2*L))**2)\n", - "t=math.pi/w_r \n", - "\n", - "#Results\n", - "print('Conduction time of diode=%.3f us'%(t*10**6))\n", - "t=0\n", - "di=V_s/L\n", - "print('Rate of change of current at t=0 is %.2f A/s' %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Conduction time of diode=237.482 us\n", - "Rate of change of current at t=0 is 230000.00 A/s\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.7 Page No 69" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_or=100 #A\n", - "R=1.0 #assumption\n", - "\n", - "#Calculations\n", - "V_m=I_or*2*R\n", - "I_o=V_m/(math.pi*R)\n", - "q=200 #Ah\n", - "t=q/I_o\n", - "\n", - "#Results\n", - "print(\"time required to deliver charge=%.02f hrs\" %t)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time required to deliver charge=3.14 hrs\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.8, Page No 70" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "P=1000 #W\n", - "R=V_s**2/P\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(2)*V_s/2\n", - "P_h=V_or**2/R \n", - "print(\"Power delivered to the heater = %.2f W\" %P_h)\n", - "V_m=math.sqrt(2)*230\n", - "I_m=V_m/R\n", - "\n", - "#Results\n", - "print(\"Peak value of diode current = %.2f A\" %I_m)\n", - "pf=V_or/V_s\n", - "print(\"Input power factor=%.2f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered to the heater = 500.00 W\n", - "Peak value of diode current = 6.15 A\n", - "Input power factor=0.71\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.9 Page No 71" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "V_m=V_s*math.sqrt(2)\n", - "E=150 #V\n", - "\n", - "#Calculations\n", - "theta1=math.degrees(E/(math.sqrt(2)*V_s))\n", - "R=8 #ohm\n", - "f=50 #Hz\n", - "I_o=(1/(2*math.pi*R))*((2*math.sqrt(2)*V_s*math.cos(math.radians(theta1)))-E*(math.pi-2*theta1*math.pi/180))\n", - "\n", - "#Results\n", - "print(\"avg value of charging current=%.2f A\" %I_o)\n", - "P_d=E*I_o\n", - "print(\"\\npower delivered to battery=%.2f W\" %P_d)\n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V_s**2+E**2)*(math.pi-2*theta1*math.pi/180)+V_s**2*math.sin(math.radians(2*theta1))-4*V_m*E*math.cos(math.radians(theta1))))\n", - "print(\"\\nrms value of the load current=%.2f A\" %I_or)\n", - "pf=(E*I_o+I_or**2*R)/(V_s*I_or)\n", - "print(\"\\nsupply pf=%.3f\" %pf)\n", - "P_dd=I_or**2*R\n", - "print(\"\\npower dissipated in the resistor=%.2f W\" %P_dd)\n", - "q=1000.00 #Wh\n", - "t=q/P_d \n", - "print(\"\\ncharging time=%.2f hr\" %t)\n", - "n=P_d*100/(P_d+P_dd)\n", - "print(\"rectifier efficiency =%.2f \" %n)\n", - "PIV=math.sqrt(2)*V_s+E\n", - "print(\"PIV of diode=%.2f V\" %PIV)\n", - "#solutions have small variations due to difference in rounding off of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg value of charging current=4.97 A\n", - "\n", - "power delivered to battery=745.11 W\n", - "\n", - "rms value of the load current=9.29 A\n", - "\n", - "supply pf=0.672\n", - "\n", - "power dissipated in the resistor=690.74 W\n", - "\n", - "charging time=1.34 hr\n", - "rectifier efficiency =51.89 \n", - "PIV of diode=475.27 V\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.10 Page No 78" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "t_rr=40*10**-6 #s reverde recovery time\n", - "\n", - "#Calculations\n", - "V_o=2*math.sqrt(2)*V_s/math.pi\n", - "V_m=math.sqrt(2)*V_s\n", - "f=50\n", - "V_r1=(V_m/math.pi)*(1-math.cos(math.radians(2*math.pi*f*t_rr*180/math.pi)))\n", - "v_avg1=V_r1*100/V_o*10**3\n", - "f=2500\n", - "V_r2=(V_m/math.pi)*(1-math.cos(math.radians(2*math.pi*f*t_rr*180/math.pi)))\n", - "v_avg2=V_r2*100/V_o\n", - "\n", - "#Results\n", - "print(\"when f=50Hz\")\n", - "print(\"Percentage reduction in avg o/p voltage=%.2f x 10^-3\" %v_avg1)\n", - "print(\"when f=2500Hz\")\n", - "print(\"Percentage reduction in avg o/p voltage = %.3f\" %v_avg2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when f=50Hz\n", - "Percentage reduction in avg o/p voltage=3.95 x 10^-3\n", - "when f=2500Hz\n", - "Percentage reduction in avg o/p voltage = 9.549\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.11, Page No 79 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "R=10.0 #ohm\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "V_o=2*V_m/math.pi\n", - "print(\"Avg value of o/p voltage = %.2f V\" %V_o)\n", - "I_o=V_o/R\n", - "print(\"Avg value of o/p current = %.2f A\" %I_o)\n", - "I_DA=I_o/2\n", - "print(\"Avg value of diode current=%.2f A\" %I_DA)\n", - "I_Dr=I_o/math.sqrt(2) \n", - "\n", - "#Results\n", - "print(\"rms value of diode current=%.2f A\" %I_Dr)\n", - "print(\"rms value of o/p current = %.2f A\" %I_o)\n", - "print(\"rms value of i/p current = %.2f A\" %I_o)\n", - "pf=(V_o/V_s)\n", - "print(\"supply pf = %.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Avg value of o/p voltage = 207.07 V\n", - "Avg value of o/p current = 20.71 A\n", - "Avg value of diode current=10.35 A\n", - "rms value of diode current=14.64 A\n", - "rms value of o/p current = 20.71 A\n", - "rms value of i/p current = 20.71 A\n", - "supply pf = 0.90\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.12 Page No 80" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "R=1000.0 #ohm\n", - "R_D=20.0 #ohm\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "I_om=V_m/(R+R_D) \n", - "\n", - "#Results\n", - "print(\"Peak load current = %.2f A\" %I_om)\n", - "I_o=I_om/math.pi\n", - "print(\"dc load current = %.2f A\" %I_o)\n", - "V_D=I_o*R_D-V_m/math.pi\n", - "print(\"dc diode voltage = %.2f V\" %V_D)\n", - "V_on=V_m/math.pi\n", - "print(\"at no load, load voltage = %.2f V\" %V_on)\n", - "V_o1=I_o*R \n", - "print(\"at given load, load voltage = %.2f V\" %V_o1)\n", - "vr=(V_on-V_o1)*100/V_on \n", - "print(\"Voltage regulation(in percent)=%.2f\" %vr)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Peak load current = 0.32 A\n", - "dc load current = 0.10 A\n", - "dc diode voltage = -101.51 V\n", - "at no load, load voltage = 103.54 V\n", - "at given load, load voltage = 101.51 V\n", - "Voltage regulation(in percent)=1.96\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.13 Page No 82" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_L=6.8 #V\n", - "V_smax=20*1.2 #V\n", - "V_smin=20*.8 #V\n", - "I_Lmax=30*1.5 #mA\n", - "I_Lmin=30*0.5 #mA\n", - "I_z=1 #mA\n", - "\n", - "#Calculations\n", - "R_smax=(V_smax-V_L)/((I_Lmin+I_z)*10**-3)\n", - "print(\"max source resistance = %.2f ohm\" %R_smax)\n", - "R_smin=(V_smin-V_L)/((I_Lmax+I_z)*10**-3) \n", - "print(\"Min source resistance = %.2f ohm\" %R_smin) #in book solution, error is committed in putting the values in formulea(printing error) but solution is correct\n", - "R_Lmax=V_L*1000/I_Lmin\n", - "print(\"Max load resistance = %.2f ohm\" %R_Lmax)\n", - "R_Lmin=V_L*1000/I_Lmax \n", - "V_d=0.6 #V\n", - "V_r=V_L-V_d\n", - "\n", - "#Results\n", - "print(\"Min load resistance=%.2f ohm\" %R_Lmin)\n", - "print(\"Voltage rating of zener diode=%.2f V\" %V_r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max source resistance = 1075.00 ohm\n", - "Min source resistance = 200.00 ohm\n", - "Max load resistance = 453.33 ohm\n", - "Min load resistance=151.11 ohm\n", - "Voltage rating of zener diode=6.20 V\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.14 Page No 83" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I2=200*10**-6 #A\n", - "V_z=20 #V\n", - "R_G=500.0 #hm\n", - "\n", - "#Calculations\n", - "R2=(V_z/I2)-R_G\n", - "print(\"R2=%.2f kilo-ohm\" %(R2/1000))\n", - "\n", - "V_v=25 #V\n", - "I1=I2\n", - "R1=(V_v-V_z)/I1\n", - "\n", - "#Results\n", - "print(\"R1=%.0f kilo-ohm\"%(R1/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R2=99.50 kilo-ohm\n", - "R1=25 kilo-ohm\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.15, Page No 92" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=2*230 #V\n", - "\n", - "#Calculations\n", - "V_o=(math.sqrt(2)*V_s)/math.pi\n", - "R=60 #ohm\n", - "P_dc=(V_o)**2/R\n", - "TUF=0.2865\n", - "VA=P_dc/TUF\n", - "\n", - "#RESULTS\n", - "print(\"kVA rating of the transformer = %.2f kVA\" %(VA/1000));\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "kVA rating of the transformer = 2.49 kVA\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.16, Page No 92" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tr=0.5 #turns ratio\n", - "I_o=10.0\n", - "V=230.0\n", - "V_s=V/tr\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "V_o=2*V_m/math.pi\n", - "phi1=0\n", - "#displacemnt angle=0 as fundamnetal component of i/p source current in phase with source voltage\n", - "DF=math.cos(math.radians(phi1))\n", - "I_s1=4*I_o/(math.sqrt(2)*math.pi)\n", - "I_s=math.sqrt(I_o**2*math.pi/math.pi)\n", - "CDF=I_s1/I_o\n", - "pf=CDF*DF\n", - "HF=math.sqrt((I_s/I_s1)**2-1)\n", - "CF=I_o/I_s\n", - "\n", - "#Results\n", - "print(\"o/p voltage = %.2f V\" %V_o)\n", - "print(\"distortion factor = %.2f\" %DF)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"Current displacent factor=%.2f\" %CDF)\n", - "print(\"Harmonic factor = %.2f\" %HF)\n", - "print(\"Creast factor = %.2f\" %CF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "o/p voltage = 414.15 V\n", - "distortion factor = 1.00\n", - "i/p pf=0.90\n", - "Current displacent factor=0.90\n", - "Harmonic factor = 0.48\n", - "Creast factor = 1.00\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.17, Page No 94" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=230.0\n", - "R=10.0\n", - "V_s=V_o*math.pi/(2*math.sqrt(2))\n", - "I_o=V_o/R\n", - "I_m=math.sqrt(2)*V_s/R\n", - "I_DAV=I_m/math.pi\n", - "\n", - "#Calculations\n", - "#avg value of diode current\n", - "I_Dr=I_m/2\n", - "PIV=math.sqrt(2)*V_s\n", - "I_s=I_m/math.sqrt(2)\n", - "TF=V_s*I_s\n", - "\n", - "#Results\n", - "print(\"peak diode current=%.2f A\" %I_m)\n", - "print(\"I_DAV=%.2f A\" %I_DAV)\n", - "print(\"I_Dr=%.2f A\" %I_Dr) #rms value of diode current\n", - "print(\"PIV=%.1f V\" %PIV)\n", - "print(\"Transformer rating = %.2f kVA\" %(TF/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak diode current=36.13 A\n", - "I_DAV=11.50 A\n", - "I_Dr=18.06 A\n", - "PIV=361.3 V\n", - "Transformer rating = 6.53 kVA\n" - ] - } - ], - "prompt_number": 38 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.18, Page No 103" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tr=5\n", - "V=1100.0\n", - "R=10.0\n", - "\n", - "\n", - "#Calculations\n", - "print(\"In case of 3ph-3pulse type\")\n", - "V_ph=V/tr\n", - "V_mp=math.sqrt(2)*V_ph\n", - "V_o=3*math.sqrt(3)*V_mp/(2*math.pi)\n", - "print(\"avg o/p voltage=%.1f V\" %V_o)\n", - "I_mp=V_mp/R\n", - "I_D=(I_mp/math.pi)*math.sin(math.pi/3) \n", - "print(\"\\navg value of diode current=%.3f A\" %I_D)\n", - "I_Dr=I_mp*math.sqrt((1/(2*math.pi))*(math.pi/3+.5*math.sin(2*math.pi/3))) \n", - "print(\"\\nrms value of diode current=%.2f A\" %I_Dr)\n", - "V_or=V_mp*math.sqrt((3/(2*math.pi))*(math.pi/3+.5*math.sin(2*math.pi/3)))\n", - "P=(V_or**2)/R \n", - "print(\"\\npower delivered=%.1f W\" %P)\n", - "print(\"in case of 3ph-M6 type\")\n", - "V_ph=V_ph/2\n", - "V_mp=math.sqrt(2)*V_ph\n", - "V_o=3*V_mp/(math.pi) \n", - "I_mp=V_mp/R\n", - "I_D=(I_mp/math.pi)*math.sin(math.pi/6) \n", - "I_Dr=I_mp*math.sqrt((1/(2*math.pi))*(math.pi/6+.5*math.sin(2*math.pi/6))) \n", - "V_or=V_mp*math.sqrt((6/(2*math.pi))*(math.pi/6+.5*math.sin(2*math.pi/6)))\n", - "P=(V_or**2)/R \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.2f V\" %V_o)\n", - "print(\"\\navg value of diode current=%.2f A\" %I_D)\n", - "print(\"\\nrms value of diode current=%.2f A\" %I_Dr)\n", - "print(\"\\npower delivered=%.0f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "In case of 3ph-3pulse type\n", - "avg o/p voltage=257.3 V\n", - "\n", - "avg value of diode current=8.577 A\n", - "\n", - "rms value of diode current=15.10 A\n", - "\n", - "power delivered=6841.3 W\n", - "in case of 3ph-M6 type\n", - "avg o/p voltage=148.55 V\n", - "\n", - "avg value of diode current=2.48 A\n", - "\n", - "rms value of diode current=6.07 A\n", - "\n", - "power delivered=2211 W\n" - ] - } - ], - "prompt_number": 39 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.19, Page No 115" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=400\n", - "R=10\n", - "\n", - "#Calculations\n", - "V_ml=V_o*math.pi/3\n", - "V_s=V_ml/(math.sqrt(2)*math.sqrt(3))\n", - "I_m=V_ml/R\n", - "I_s=.7804*I_m\n", - "tr=3*V_s*I_s \n", - "\n", - "#Results\n", - "print(\"transformer rating=%.1f VA\" %tr)\n", - "I_Dr=.5518*I_m \n", - "print(\"\\nrms value of diode current=%.3f A\" %I_Dr)\n", - "I_D=I_m/math.pi \n", - "print(\"\\navg value of diode current=%.3f A\" %I_D)\n", - "print(\"\\npeak diode current=%.2f A\" %I_m)\n", - "PIV=V_ml \n", - "print(\"\\nPIV=%.2f V\" %PIV)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transformer rating=16770.3 VA\n", - "\n", - "rms value of diode current=23.114 A\n", - "\n", - "avg value of diode current=13.333 A\n", - "\n", - "peak diode current=41.89 A\n", - "\n", - "PIV=418.88 V\n" - ] - } - ], - "prompt_number": 40 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.20, Page No 116" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_l=230\n", - "E=240\n", - "R=8\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_l\n", - "V_o=3*V_ml/math.pi\n", - "I_o=(V_o-E)/R\n", - "P_b=E*I_o \n", - "P_d=E*I_o+I_o**2*R \n", - "phi1=0\n", - "math.cos(math.radians(phi1))\n", - "I_s1=2*math.sqrt(3)*I_o/(math.sqrt(2)*math.pi)\n", - "I_s=math.sqrt(I_o**2*2*math.pi/(3*math.pi))\n", - "CDF=I_s1/I_s \n", - "pf=DF*CDF \n", - "HF=math.sqrt(CDF**-2-1) \n", - "tr=math.sqrt(3)*V_l*I_o*math.sqrt(2/3)\n", - "\n", - "#Results\n", - "print(\"Power delivered to battery=%.1f W\" %P_b)\n", - "print(\"Power delivered to load=%.2f W\" %P_d)\n", - "print(\"Displacement factor=%.2f\" %DF)\n", - "print(\"Current distortion factor=%.3f\" %CDF)\n", - "print(\"i/p pf=%.3f\"%pf)\n", - "print(\"Harmonic factor=%.2f\" %HF)\n", - "print(\"Tranformer rating=%.2f VA\" %tr)\n", - "#answers have small variations from the book due to difference in rounding off of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered to battery=2118.3 W\n", - "Power delivered to load=2741.48 W\n", - "Displacement factor=1.00\n", - "Current distortion factor=0.955\n", - "i/p pf=0.955\n", - "Harmonic factor=0.31\n", - "Tranformer rating=0.00 VA\n" - ] - } - ], - "prompt_number": 41 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.21, Page No 122" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50 #Hz\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V\n", - "R=400.0\n", - "RF=0.05\n", - "C=(1/(4*f*R))*(1+(1/(math.sqrt(2)*RF)))\n", - "\n", - "#Results\n", - "print(\"capacitor value=%.2f uF\" %(C/10**-6))\n", - "V_o=V_m*(1-1/(4*f*R*C))\n", - "print(\"o/p voltage with filter=%.2f V\" %V_o)\n", - "V_o=2*V_m/math.pi \n", - "print(\"o/p voltage without filter=%.2f V\" %V_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "capacitor value=189.28 uF\n", - "o/p voltage with filter=303.79 V\n", - "o/p voltage without filter=207.07 V\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.22, Page No 122" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50\n", - "CRF=0.05\n", - "R=300\n", - "\n", - "#Calculations\n", - "L=math.sqrt((CRF/(.4715*R))**-2-R**2)/(2*2*math.pi*f) \n", - "print(\"L=%.2f H\" %L)\n", - "R=30\n", - "L=math.sqrt((CRF/(.4715*R))**-2-R**2)/(2*2*math.pi*f) \n", - "\n", - "\n", - "#Results\n", - "print(\"\\nL=%.2f H\" %L)\n", - "L=0\n", - "CRF=.4715*R/math.sqrt(R**2+(2*2*math.pi*f*L)**2) \n", - "print(\"\\nCRF=%.2f\" %CRF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "L=4.48 H\n", - "\n", - "L=0.45 H\n", - "\n", - "CRF=0.47\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.23, Page No 127" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=50\n", - "L_L=10*10**-3\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "\n", - "#Calculations\n", - "C=10/(2*w*math.sqrt(R**2+(2*w*L_L)**2))\n", - "\n", - "#Results\n", - "print(\"C=%.2f uF\" %(C*10**6))\n", - "VRF=0.1\n", - "L=(1/(4*w**2*C))*((math.sqrt(2)/(3*VRF))+1)\n", - "print(\"\\nL=%.2f mH\" %(L*10**3))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "C=315.83 uF\n", - "\n", - "L=45.83 mH\n" - ] - } - ], - "prompt_number": 44 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter3_2.ipynb b/_Power_Electronics/Chapter3_2.ipynb deleted file mode 100755 index 2e53ef9d..00000000 --- a/_Power_Electronics/Chapter3_2.ipynb +++ /dev/null @@ -1,1001 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 03 : Diode Circuits and Rectifiers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.2, Page No 55" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0 #V\n", - "V_o=100.0 #V\n", - "L=100.0 #uH\n", - "C=30.0 #uF\n", - "\n", - "#Calculations\n", - "t_o=math.pi*math.sqrt(L*C)\n", - "print(\"conduction time of diode = %.2f us\" %t_o)\n", - "#in book solution is t_o=54.77 us. The ans is incorrect as %pi is not muliplied in ans. Formulae mentioned in correct.\n", - "I_p=(V_s-V_o)*math.sqrt(C/L)\n", - "\n", - "#Results\n", - "print(\"Peak current through diode=%.2f A\" %I_p)\n", - "v_D=-V_s+V_o \n", - "print(\"Voltage across diode = %.2f V\" %v_D)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of diode = 172.07 us\n", - "Peak current through diode=164.32 A\n", - "Voltage across diode = -300.00 V\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.6, Page No 61" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "R=10 #ohm\n", - "L=0.001 #H\n", - "C=5*10**-6 #F\n", - "V_s=230 #V\n", - "xi=R/(2*L)\n", - "\n", - "#Calculations\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt((1/(L*C))-(R/(2*L))**2)\n", - "t=math.pi/w_r \n", - "\n", - "#Results\n", - "print('Conduction time of diode=%.3f us'%(t*10**6))\n", - "t=0\n", - "di=V_s/L\n", - "print('Rate of change of current at t=0 is %.2f A/s' %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Conduction time of diode=237.482 us\n", - "Rate of change of current at t=0 is 230000.00 A/s\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.7 Page No 69" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_or=100 #A\n", - "R=1.0 #assumption\n", - "\n", - "#Calculations\n", - "V_m=I_or*2*R\n", - "I_o=V_m/(math.pi*R)\n", - "q=200 #Ah\n", - "t=q/I_o\n", - "\n", - "#Results\n", - "print(\"time required to deliver charge=%.02f hrs\" %t)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time required to deliver charge=3.14 hrs\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.8, Page No 70" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "P=1000 #W\n", - "R=V_s**2/P\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(2)*V_s/2\n", - "P_h=V_or**2/R \n", - "print(\"Power delivered to the heater = %.2f W\" %P_h)\n", - "V_m=math.sqrt(2)*230\n", - "I_m=V_m/R\n", - "\n", - "#Results\n", - "print(\"Peak value of diode current = %.2f A\" %I_m)\n", - "pf=V_or/V_s\n", - "print(\"Input power factor=%.2f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered to the heater = 500.00 W\n", - "Peak value of diode current = 6.15 A\n", - "Input power factor=0.71\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.9 Page No 71" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "V_m=V_s*math.sqrt(2)\n", - "E=150 #V\n", - "\n", - "#Calculations\n", - "theta1=math.degrees(E/(math.sqrt(2)*V_s))\n", - "R=8 #ohm\n", - "f=50 #Hz\n", - "I_o=(1/(2*math.pi*R))*((2*math.sqrt(2)*V_s*math.cos(math.radians(theta1)))-E*(math.pi-2*theta1*math.pi/180))\n", - "\n", - "#Results\n", - "print(\"avg value of charging current=%.2f A\" %I_o)\n", - "P_d=E*I_o\n", - "print(\"\\npower delivered to battery=%.2f W\" %P_d)\n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V_s**2+E**2)*(math.pi-2*theta1*math.pi/180)+V_s**2*math.sin(math.radians(2*theta1))-4*V_m*E*math.cos(math.radians(theta1))))\n", - "print(\"\\nrms value of the load current=%.2f A\" %I_or)\n", - "pf=(E*I_o+I_or**2*R)/(V_s*I_or)\n", - "print(\"\\nsupply pf=%.3f\" %pf)\n", - "P_dd=I_or**2*R\n", - "print(\"\\npower dissipated in the resistor=%.2f W\" %P_dd)\n", - "q=1000.00 #Wh\n", - "t=q/P_d \n", - "print(\"\\ncharging time=%.2f hr\" %t)\n", - "n=P_d*100/(P_d+P_dd)\n", - "print(\"rectifier efficiency =%.2f \" %n)\n", - "PIV=math.sqrt(2)*V_s+E\n", - "print(\"PIV of diode=%.2f V\" %PIV)\n", - "#solutions have small variations due to difference in rounding off of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg value of charging current=4.97 A\n", - "\n", - "power delivered to battery=745.11 W\n", - "\n", - "rms value of the load current=9.29 A\n", - "\n", - "supply pf=0.672\n", - "\n", - "power dissipated in the resistor=690.74 W\n", - "\n", - "charging time=1.34 hr\n", - "rectifier efficiency =51.89 \n", - "PIV of diode=475.27 V\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.10 Page No 78" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "t_rr=40*10**-6 #s reverde recovery time\n", - "\n", - "#Calculations\n", - "V_o=2*math.sqrt(2)*V_s/math.pi\n", - "V_m=math.sqrt(2)*V_s\n", - "f=50\n", - "V_r1=(V_m/math.pi)*(1-math.cos(math.radians(2*math.pi*f*t_rr*180/math.pi)))\n", - "v_avg1=V_r1*100/V_o*10**3\n", - "f=2500\n", - "V_r2=(V_m/math.pi)*(1-math.cos(math.radians(2*math.pi*f*t_rr*180/math.pi)))\n", - "v_avg2=V_r2*100/V_o\n", - "\n", - "#Results\n", - "print(\"when f=50Hz\")\n", - "print(\"Percentage reduction in avg o/p voltage=%.2f x 10^-3\" %v_avg1)\n", - "print(\"when f=2500Hz\")\n", - "print(\"Percentage reduction in avg o/p voltage = %.3f\" %v_avg2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when f=50Hz\n", - "Percentage reduction in avg o/p voltage=3.95 x 10^-3\n", - "when f=2500Hz\n", - "Percentage reduction in avg o/p voltage = 9.549\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.11, Page No 79 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "R=10.0 #ohm\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "V_o=2*V_m/math.pi\n", - "print(\"Avg value of o/p voltage = %.2f V\" %V_o)\n", - "I_o=V_o/R\n", - "print(\"Avg value of o/p current = %.2f A\" %I_o)\n", - "I_DA=I_o/2\n", - "print(\"Avg value of diode current=%.2f A\" %I_DA)\n", - "I_Dr=I_o/math.sqrt(2) \n", - "\n", - "#Results\n", - "print(\"rms value of diode current=%.2f A\" %I_Dr)\n", - "print(\"rms value of o/p current = %.2f A\" %I_o)\n", - "print(\"rms value of i/p current = %.2f A\" %I_o)\n", - "pf=(V_o/V_s)\n", - "print(\"supply pf = %.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Avg value of o/p voltage = 207.07 V\n", - "Avg value of o/p current = 20.71 A\n", - "Avg value of diode current=10.35 A\n", - "rms value of diode current=14.64 A\n", - "rms value of o/p current = 20.71 A\n", - "rms value of i/p current = 20.71 A\n", - "supply pf = 0.90\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.12 Page No 80" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "R=1000.0 #ohm\n", - "R_D=20.0 #ohm\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "I_om=V_m/(R+R_D) \n", - "\n", - "#Results\n", - "print(\"Peak load current = %.2f A\" %I_om)\n", - "I_o=I_om/math.pi\n", - "print(\"dc load current = %.2f A\" %I_o)\n", - "V_D=I_o*R_D-V_m/math.pi\n", - "print(\"dc diode voltage = %.2f V\" %V_D)\n", - "V_on=V_m/math.pi\n", - "print(\"at no load, load voltage = %.2f V\" %V_on)\n", - "V_o1=I_o*R \n", - "print(\"at given load, load voltage = %.2f V\" %V_o1)\n", - "vr=(V_on-V_o1)*100/V_on \n", - "print(\"Voltage regulation(in percent)=%.2f\" %vr)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Peak load current = 0.32 A\n", - "dc load current = 0.10 A\n", - "dc diode voltage = -101.51 V\n", - "at no load, load voltage = 103.54 V\n", - "at given load, load voltage = 101.51 V\n", - "Voltage regulation(in percent)=1.96\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.13 Page No 82" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_L=6.8 #V\n", - "V_smax=20*1.2 #V\n", - "V_smin=20*.8 #V\n", - "I_Lmax=30*1.5 #mA\n", - "I_Lmin=30*0.5 #mA\n", - "I_z=1 #mA\n", - "\n", - "#Calculations\n", - "R_smax=(V_smax-V_L)/((I_Lmin+I_z)*10**-3)\n", - "print(\"max source resistance = %.2f ohm\" %R_smax)\n", - "R_smin=(V_smin-V_L)/((I_Lmax+I_z)*10**-3) \n", - "print(\"Min source resistance = %.2f ohm\" %R_smin) #in book solution, error is committed in putting the values in formulea(printing error) but solution is correct\n", - "R_Lmax=V_L*1000/I_Lmin\n", - "print(\"Max load resistance = %.2f ohm\" %R_Lmax)\n", - "R_Lmin=V_L*1000/I_Lmax \n", - "V_d=0.6 #V\n", - "V_r=V_L-V_d\n", - "\n", - "#Results\n", - "print(\"Min load resistance=%.2f ohm\" %R_Lmin)\n", - "print(\"Voltage rating of zener diode=%.2f V\" %V_r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max source resistance = 1075.00 ohm\n", - "Min source resistance = 200.00 ohm\n", - "Max load resistance = 453.33 ohm\n", - "Min load resistance=151.11 ohm\n", - "Voltage rating of zener diode=6.20 V\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.14 Page No 83" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I2=200*10**-6 #A\n", - "V_z=20 #V\n", - "R_G=500.0 #hm\n", - "\n", - "#Calculations\n", - "R2=(V_z/I2)-R_G\n", - "print(\"R2=%.2f kilo-ohm\" %(R2/1000))\n", - "\n", - "V_v=25 #V\n", - "I1=I2\n", - "R1=(V_v-V_z)/I1\n", - "\n", - "#Results\n", - "print(\"R1=%.0f kilo-ohm\"%(R1/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R2=99.50 kilo-ohm\n", - "R1=25 kilo-ohm\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.15, Page No 92" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=2*230 #V\n", - "\n", - "#Calculations\n", - "V_o=(math.sqrt(2)*V_s)/math.pi\n", - "R=60 #ohm\n", - "P_dc=(V_o)**2/R\n", - "TUF=0.2865\n", - "VA=P_dc/TUF\n", - "\n", - "#RESULTS\n", - "print(\"kVA rating of the transformer = %.2f kVA\" %(VA/1000));\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "kVA rating of the transformer = 2.49 kVA\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.16, Page No 92" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tr=0.5 #turns ratio\n", - "I_o=10.0\n", - "V=230.0\n", - "V_s=V/tr\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "V_o=2*V_m/math.pi\n", - "phi1=0\n", - "#displacemnt angle=0 as fundamnetal component of i/p source current in phase with source voltage\n", - "DF=math.cos(math.radians(phi1))\n", - "I_s1=4*I_o/(math.sqrt(2)*math.pi)\n", - "I_s=math.sqrt(I_o**2*math.pi/math.pi)\n", - "CDF=I_s1/I_o\n", - "pf=CDF*DF\n", - "HF=math.sqrt((I_s/I_s1)**2-1)\n", - "CF=I_o/I_s\n", - "\n", - "#Results\n", - "print(\"o/p voltage = %.2f V\" %V_o)\n", - "print(\"distortion factor = %.2f\" %DF)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"Current displacent factor=%.2f\" %CDF)\n", - "print(\"Harmonic factor = %.2f\" %HF)\n", - "print(\"Creast factor = %.2f\" %CF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "o/p voltage = 414.15 V\n", - "distortion factor = 1.00\n", - "i/p pf=0.90\n", - "Current displacent factor=0.90\n", - "Harmonic factor = 0.48\n", - "Creast factor = 1.00\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.17, Page No 94" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=230.0\n", - "R=10.0\n", - "V_s=V_o*math.pi/(2*math.sqrt(2))\n", - "I_o=V_o/R\n", - "I_m=math.sqrt(2)*V_s/R\n", - "I_DAV=I_m/math.pi\n", - "\n", - "#Calculations\n", - "#avg value of diode current\n", - "I_Dr=I_m/2\n", - "PIV=math.sqrt(2)*V_s\n", - "I_s=I_m/math.sqrt(2)\n", - "TF=V_s*I_s\n", - "\n", - "#Results\n", - "print(\"peak diode current=%.2f A\" %I_m)\n", - "print(\"I_DAV=%.2f A\" %I_DAV)\n", - "print(\"I_Dr=%.2f A\" %I_Dr) #rms value of diode current\n", - "print(\"PIV=%.1f V\" %PIV)\n", - "print(\"Transformer rating = %.2f kVA\" %(TF/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak diode current=36.13 A\n", - "I_DAV=11.50 A\n", - "I_Dr=18.06 A\n", - "PIV=361.3 V\n", - "Transformer rating = 6.53 kVA\n" - ] - } - ], - "prompt_number": 38 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.18, Page No 103" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tr=5\n", - "V=1100.0\n", - "R=10.0\n", - "\n", - "\n", - "#Calculations\n", - "print(\"In case of 3ph-3pulse type\")\n", - "V_ph=V/tr\n", - "V_mp=math.sqrt(2)*V_ph\n", - "V_o=3*math.sqrt(3)*V_mp/(2*math.pi)\n", - "print(\"avg o/p voltage=%.1f V\" %V_o)\n", - "I_mp=V_mp/R\n", - "I_D=(I_mp/math.pi)*math.sin(math.pi/3) \n", - "print(\"\\navg value of diode current=%.3f A\" %I_D)\n", - "I_Dr=I_mp*math.sqrt((1/(2*math.pi))*(math.pi/3+.5*math.sin(2*math.pi/3))) \n", - "print(\"\\nrms value of diode current=%.2f A\" %I_Dr)\n", - "V_or=V_mp*math.sqrt((3/(2*math.pi))*(math.pi/3+.5*math.sin(2*math.pi/3)))\n", - "P=(V_or**2)/R \n", - "print(\"\\npower delivered=%.1f W\" %P)\n", - "print(\"in case of 3ph-M6 type\")\n", - "V_ph=V_ph/2\n", - "V_mp=math.sqrt(2)*V_ph\n", - "V_o=3*V_mp/(math.pi) \n", - "I_mp=V_mp/R\n", - "I_D=(I_mp/math.pi)*math.sin(math.pi/6) \n", - "I_Dr=I_mp*math.sqrt((1/(2*math.pi))*(math.pi/6+.5*math.sin(2*math.pi/6))) \n", - "V_or=V_mp*math.sqrt((6/(2*math.pi))*(math.pi/6+.5*math.sin(2*math.pi/6)))\n", - "P=(V_or**2)/R \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.2f V\" %V_o)\n", - "print(\"\\navg value of diode current=%.2f A\" %I_D)\n", - "print(\"\\nrms value of diode current=%.2f A\" %I_Dr)\n", - "print(\"\\npower delivered=%.0f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "In case of 3ph-3pulse type\n", - "avg o/p voltage=257.3 V\n", - "\n", - "avg value of diode current=8.577 A\n", - "\n", - "rms value of diode current=15.10 A\n", - "\n", - "power delivered=6841.3 W\n", - "in case of 3ph-M6 type\n", - "avg o/p voltage=148.55 V\n", - "\n", - "avg value of diode current=2.48 A\n", - "\n", - "rms value of diode current=6.07 A\n", - "\n", - "power delivered=2211 W\n" - ] - } - ], - "prompt_number": 39 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.19, Page No 115" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=400\n", - "R=10\n", - "\n", - "#Calculations\n", - "V_ml=V_o*math.pi/3\n", - "V_s=V_ml/(math.sqrt(2)*math.sqrt(3))\n", - "I_m=V_ml/R\n", - "I_s=.7804*I_m\n", - "tr=3*V_s*I_s \n", - "\n", - "#Results\n", - "print(\"transformer rating=%.1f VA\" %tr)\n", - "I_Dr=.5518*I_m \n", - "print(\"\\nrms value of diode current=%.3f A\" %I_Dr)\n", - "I_D=I_m/math.pi \n", - "print(\"\\navg value of diode current=%.3f A\" %I_D)\n", - "print(\"\\npeak diode current=%.2f A\" %I_m)\n", - "PIV=V_ml \n", - "print(\"\\nPIV=%.2f V\" %PIV)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transformer rating=16770.3 VA\n", - "\n", - "rms value of diode current=23.114 A\n", - "\n", - "avg value of diode current=13.333 A\n", - "\n", - "peak diode current=41.89 A\n", - "\n", - "PIV=418.88 V\n" - ] - } - ], - "prompt_number": 40 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.20, Page No 116" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_l=230\n", - "E=240\n", - "R=8\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_l\n", - "V_o=3*V_ml/math.pi\n", - "I_o=(V_o-E)/R\n", - "P_b=E*I_o \n", - "P_d=E*I_o+I_o**2*R \n", - "phi1=0\n", - "math.cos(math.radians(phi1))\n", - "I_s1=2*math.sqrt(3)*I_o/(math.sqrt(2)*math.pi)\n", - "I_s=math.sqrt(I_o**2*2*math.pi/(3*math.pi))\n", - "CDF=I_s1/I_s \n", - "pf=DF*CDF \n", - "HF=math.sqrt(CDF**-2-1) \n", - "tr=math.sqrt(3)*V_l*I_o*math.sqrt(2/3)\n", - "\n", - "#Results\n", - "print(\"Power delivered to battery=%.1f W\" %P_b)\n", - "print(\"Power delivered to load=%.2f W\" %P_d)\n", - "print(\"Displacement factor=%.2f\" %DF)\n", - "print(\"Current distortion factor=%.3f\" %CDF)\n", - "print(\"i/p pf=%.3f\"%pf)\n", - "print(\"Harmonic factor=%.2f\" %HF)\n", - "print(\"Tranformer rating=%.2f VA\" %tr)\n", - "#answers have small variations from the book due to difference in rounding off of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered to battery=2118.3 W\n", - "Power delivered to load=2741.48 W\n", - "Displacement factor=1.00\n", - "Current distortion factor=0.955\n", - "i/p pf=0.955\n", - "Harmonic factor=0.31\n", - "Tranformer rating=0.00 VA\n" - ] - } - ], - "prompt_number": 41 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.21, Page No 122" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50 #Hz\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V\n", - "R=400.0\n", - "RF=0.05\n", - "C=(1/(4*f*R))*(1+(1/(math.sqrt(2)*RF)))\n", - "\n", - "#Results\n", - "print(\"capacitor value=%.2f uF\" %(C/10**-6))\n", - "V_o=V_m*(1-1/(4*f*R*C))\n", - "print(\"o/p voltage with filter=%.2f V\" %V_o)\n", - "V_o=2*V_m/math.pi \n", - "print(\"o/p voltage without filter=%.2f V\" %V_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "capacitor value=189.28 uF\n", - "o/p voltage with filter=303.79 V\n", - "o/p voltage without filter=207.07 V\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.22, Page No 122" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50\n", - "CRF=0.05\n", - "R=300\n", - "\n", - "#Calculations\n", - "L=math.sqrt((CRF/(.4715*R))**-2-R**2)/(2*2*math.pi*f) \n", - "print(\"L=%.2f H\" %L)\n", - "R=30\n", - "L=math.sqrt((CRF/(.4715*R))**-2-R**2)/(2*2*math.pi*f) \n", - "\n", - "\n", - "#Results\n", - "print(\"\\nL=%.2f H\" %L)\n", - "L=0\n", - "CRF=.4715*R/math.sqrt(R**2+(2*2*math.pi*f*L)**2) \n", - "print(\"\\nCRF=%.2f\" %CRF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "L=4.48 H\n", - "\n", - "L=0.45 H\n", - "\n", - "CRF=0.47\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.23, Page No 127" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=50\n", - "L_L=10*10**-3\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "\n", - "#Calculations\n", - "C=10/(2*w*math.sqrt(R**2+(2*w*L_L)**2))\n", - "\n", - "#Results\n", - "print(\"C=%.2f uF\" %(C*10**6))\n", - "VRF=0.1\n", - "L=(1/(4*w**2*C))*((math.sqrt(2)/(3*VRF))+1)\n", - "print(\"\\nL=%.2f mH\" %(L*10**3))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "C=315.83 uF\n", - "\n", - "L=45.83 mH\n" - ] - } - ], - "prompt_number": 44 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter3_3.ipynb b/_Power_Electronics/Chapter3_3.ipynb deleted file mode 100755 index 2e53ef9d..00000000 --- a/_Power_Electronics/Chapter3_3.ipynb +++ /dev/null @@ -1,1001 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 03 : Diode Circuits and Rectifiers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.2, Page No 55" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0 #V\n", - "V_o=100.0 #V\n", - "L=100.0 #uH\n", - "C=30.0 #uF\n", - "\n", - "#Calculations\n", - "t_o=math.pi*math.sqrt(L*C)\n", - "print(\"conduction time of diode = %.2f us\" %t_o)\n", - "#in book solution is t_o=54.77 us. The ans is incorrect as %pi is not muliplied in ans. Formulae mentioned in correct.\n", - "I_p=(V_s-V_o)*math.sqrt(C/L)\n", - "\n", - "#Results\n", - "print(\"Peak current through diode=%.2f A\" %I_p)\n", - "v_D=-V_s+V_o \n", - "print(\"Voltage across diode = %.2f V\" %v_D)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of diode = 172.07 us\n", - "Peak current through diode=164.32 A\n", - "Voltage across diode = -300.00 V\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.6, Page No 61" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "R=10 #ohm\n", - "L=0.001 #H\n", - "C=5*10**-6 #F\n", - "V_s=230 #V\n", - "xi=R/(2*L)\n", - "\n", - "#Calculations\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt((1/(L*C))-(R/(2*L))**2)\n", - "t=math.pi/w_r \n", - "\n", - "#Results\n", - "print('Conduction time of diode=%.3f us'%(t*10**6))\n", - "t=0\n", - "di=V_s/L\n", - "print('Rate of change of current at t=0 is %.2f A/s' %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Conduction time of diode=237.482 us\n", - "Rate of change of current at t=0 is 230000.00 A/s\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.7 Page No 69" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_or=100 #A\n", - "R=1.0 #assumption\n", - "\n", - "#Calculations\n", - "V_m=I_or*2*R\n", - "I_o=V_m/(math.pi*R)\n", - "q=200 #Ah\n", - "t=q/I_o\n", - "\n", - "#Results\n", - "print(\"time required to deliver charge=%.02f hrs\" %t)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time required to deliver charge=3.14 hrs\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.8, Page No 70" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "P=1000 #W\n", - "R=V_s**2/P\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(2)*V_s/2\n", - "P_h=V_or**2/R \n", - "print(\"Power delivered to the heater = %.2f W\" %P_h)\n", - "V_m=math.sqrt(2)*230\n", - "I_m=V_m/R\n", - "\n", - "#Results\n", - "print(\"Peak value of diode current = %.2f A\" %I_m)\n", - "pf=V_or/V_s\n", - "print(\"Input power factor=%.2f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered to the heater = 500.00 W\n", - "Peak value of diode current = 6.15 A\n", - "Input power factor=0.71\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.9 Page No 71" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "V_m=V_s*math.sqrt(2)\n", - "E=150 #V\n", - "\n", - "#Calculations\n", - "theta1=math.degrees(E/(math.sqrt(2)*V_s))\n", - "R=8 #ohm\n", - "f=50 #Hz\n", - "I_o=(1/(2*math.pi*R))*((2*math.sqrt(2)*V_s*math.cos(math.radians(theta1)))-E*(math.pi-2*theta1*math.pi/180))\n", - "\n", - "#Results\n", - "print(\"avg value of charging current=%.2f A\" %I_o)\n", - "P_d=E*I_o\n", - "print(\"\\npower delivered to battery=%.2f W\" %P_d)\n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V_s**2+E**2)*(math.pi-2*theta1*math.pi/180)+V_s**2*math.sin(math.radians(2*theta1))-4*V_m*E*math.cos(math.radians(theta1))))\n", - "print(\"\\nrms value of the load current=%.2f A\" %I_or)\n", - "pf=(E*I_o+I_or**2*R)/(V_s*I_or)\n", - "print(\"\\nsupply pf=%.3f\" %pf)\n", - "P_dd=I_or**2*R\n", - "print(\"\\npower dissipated in the resistor=%.2f W\" %P_dd)\n", - "q=1000.00 #Wh\n", - "t=q/P_d \n", - "print(\"\\ncharging time=%.2f hr\" %t)\n", - "n=P_d*100/(P_d+P_dd)\n", - "print(\"rectifier efficiency =%.2f \" %n)\n", - "PIV=math.sqrt(2)*V_s+E\n", - "print(\"PIV of diode=%.2f V\" %PIV)\n", - "#solutions have small variations due to difference in rounding off of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg value of charging current=4.97 A\n", - "\n", - "power delivered to battery=745.11 W\n", - "\n", - "rms value of the load current=9.29 A\n", - "\n", - "supply pf=0.672\n", - "\n", - "power dissipated in the resistor=690.74 W\n", - "\n", - "charging time=1.34 hr\n", - "rectifier efficiency =51.89 \n", - "PIV of diode=475.27 V\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.10 Page No 78" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "t_rr=40*10**-6 #s reverde recovery time\n", - "\n", - "#Calculations\n", - "V_o=2*math.sqrt(2)*V_s/math.pi\n", - "V_m=math.sqrt(2)*V_s\n", - "f=50\n", - "V_r1=(V_m/math.pi)*(1-math.cos(math.radians(2*math.pi*f*t_rr*180/math.pi)))\n", - "v_avg1=V_r1*100/V_o*10**3\n", - "f=2500\n", - "V_r2=(V_m/math.pi)*(1-math.cos(math.radians(2*math.pi*f*t_rr*180/math.pi)))\n", - "v_avg2=V_r2*100/V_o\n", - "\n", - "#Results\n", - "print(\"when f=50Hz\")\n", - "print(\"Percentage reduction in avg o/p voltage=%.2f x 10^-3\" %v_avg1)\n", - "print(\"when f=2500Hz\")\n", - "print(\"Percentage reduction in avg o/p voltage = %.3f\" %v_avg2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when f=50Hz\n", - "Percentage reduction in avg o/p voltage=3.95 x 10^-3\n", - "when f=2500Hz\n", - "Percentage reduction in avg o/p voltage = 9.549\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.11, Page No 79 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "R=10.0 #ohm\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "V_o=2*V_m/math.pi\n", - "print(\"Avg value of o/p voltage = %.2f V\" %V_o)\n", - "I_o=V_o/R\n", - "print(\"Avg value of o/p current = %.2f A\" %I_o)\n", - "I_DA=I_o/2\n", - "print(\"Avg value of diode current=%.2f A\" %I_DA)\n", - "I_Dr=I_o/math.sqrt(2) \n", - "\n", - "#Results\n", - "print(\"rms value of diode current=%.2f A\" %I_Dr)\n", - "print(\"rms value of o/p current = %.2f A\" %I_o)\n", - "print(\"rms value of i/p current = %.2f A\" %I_o)\n", - "pf=(V_o/V_s)\n", - "print(\"supply pf = %.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Avg value of o/p voltage = 207.07 V\n", - "Avg value of o/p current = 20.71 A\n", - "Avg value of diode current=10.35 A\n", - "rms value of diode current=14.64 A\n", - "rms value of o/p current = 20.71 A\n", - "rms value of i/p current = 20.71 A\n", - "supply pf = 0.90\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.12 Page No 80" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "R=1000.0 #ohm\n", - "R_D=20.0 #ohm\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "I_om=V_m/(R+R_D) \n", - "\n", - "#Results\n", - "print(\"Peak load current = %.2f A\" %I_om)\n", - "I_o=I_om/math.pi\n", - "print(\"dc load current = %.2f A\" %I_o)\n", - "V_D=I_o*R_D-V_m/math.pi\n", - "print(\"dc diode voltage = %.2f V\" %V_D)\n", - "V_on=V_m/math.pi\n", - "print(\"at no load, load voltage = %.2f V\" %V_on)\n", - "V_o1=I_o*R \n", - "print(\"at given load, load voltage = %.2f V\" %V_o1)\n", - "vr=(V_on-V_o1)*100/V_on \n", - "print(\"Voltage regulation(in percent)=%.2f\" %vr)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Peak load current = 0.32 A\n", - "dc load current = 0.10 A\n", - "dc diode voltage = -101.51 V\n", - "at no load, load voltage = 103.54 V\n", - "at given load, load voltage = 101.51 V\n", - "Voltage regulation(in percent)=1.96\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.13 Page No 82" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_L=6.8 #V\n", - "V_smax=20*1.2 #V\n", - "V_smin=20*.8 #V\n", - "I_Lmax=30*1.5 #mA\n", - "I_Lmin=30*0.5 #mA\n", - "I_z=1 #mA\n", - "\n", - "#Calculations\n", - "R_smax=(V_smax-V_L)/((I_Lmin+I_z)*10**-3)\n", - "print(\"max source resistance = %.2f ohm\" %R_smax)\n", - "R_smin=(V_smin-V_L)/((I_Lmax+I_z)*10**-3) \n", - "print(\"Min source resistance = %.2f ohm\" %R_smin) #in book solution, error is committed in putting the values in formulea(printing error) but solution is correct\n", - "R_Lmax=V_L*1000/I_Lmin\n", - "print(\"Max load resistance = %.2f ohm\" %R_Lmax)\n", - "R_Lmin=V_L*1000/I_Lmax \n", - "V_d=0.6 #V\n", - "V_r=V_L-V_d\n", - "\n", - "#Results\n", - "print(\"Min load resistance=%.2f ohm\" %R_Lmin)\n", - "print(\"Voltage rating of zener diode=%.2f V\" %V_r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max source resistance = 1075.00 ohm\n", - "Min source resistance = 200.00 ohm\n", - "Max load resistance = 453.33 ohm\n", - "Min load resistance=151.11 ohm\n", - "Voltage rating of zener diode=6.20 V\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.14 Page No 83" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I2=200*10**-6 #A\n", - "V_z=20 #V\n", - "R_G=500.0 #hm\n", - "\n", - "#Calculations\n", - "R2=(V_z/I2)-R_G\n", - "print(\"R2=%.2f kilo-ohm\" %(R2/1000))\n", - "\n", - "V_v=25 #V\n", - "I1=I2\n", - "R1=(V_v-V_z)/I1\n", - "\n", - "#Results\n", - "print(\"R1=%.0f kilo-ohm\"%(R1/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R2=99.50 kilo-ohm\n", - "R1=25 kilo-ohm\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.15, Page No 92" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=2*230 #V\n", - "\n", - "#Calculations\n", - "V_o=(math.sqrt(2)*V_s)/math.pi\n", - "R=60 #ohm\n", - "P_dc=(V_o)**2/R\n", - "TUF=0.2865\n", - "VA=P_dc/TUF\n", - "\n", - "#RESULTS\n", - "print(\"kVA rating of the transformer = %.2f kVA\" %(VA/1000));\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "kVA rating of the transformer = 2.49 kVA\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.16, Page No 92" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tr=0.5 #turns ratio\n", - "I_o=10.0\n", - "V=230.0\n", - "V_s=V/tr\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "V_o=2*V_m/math.pi\n", - "phi1=0\n", - "#displacemnt angle=0 as fundamnetal component of i/p source current in phase with source voltage\n", - "DF=math.cos(math.radians(phi1))\n", - "I_s1=4*I_o/(math.sqrt(2)*math.pi)\n", - "I_s=math.sqrt(I_o**2*math.pi/math.pi)\n", - "CDF=I_s1/I_o\n", - "pf=CDF*DF\n", - "HF=math.sqrt((I_s/I_s1)**2-1)\n", - "CF=I_o/I_s\n", - "\n", - "#Results\n", - "print(\"o/p voltage = %.2f V\" %V_o)\n", - "print(\"distortion factor = %.2f\" %DF)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"Current displacent factor=%.2f\" %CDF)\n", - "print(\"Harmonic factor = %.2f\" %HF)\n", - "print(\"Creast factor = %.2f\" %CF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "o/p voltage = 414.15 V\n", - "distortion factor = 1.00\n", - "i/p pf=0.90\n", - "Current displacent factor=0.90\n", - "Harmonic factor = 0.48\n", - "Creast factor = 1.00\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.17, Page No 94" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=230.0\n", - "R=10.0\n", - "V_s=V_o*math.pi/(2*math.sqrt(2))\n", - "I_o=V_o/R\n", - "I_m=math.sqrt(2)*V_s/R\n", - "I_DAV=I_m/math.pi\n", - "\n", - "#Calculations\n", - "#avg value of diode current\n", - "I_Dr=I_m/2\n", - "PIV=math.sqrt(2)*V_s\n", - "I_s=I_m/math.sqrt(2)\n", - "TF=V_s*I_s\n", - "\n", - "#Results\n", - "print(\"peak diode current=%.2f A\" %I_m)\n", - "print(\"I_DAV=%.2f A\" %I_DAV)\n", - "print(\"I_Dr=%.2f A\" %I_Dr) #rms value of diode current\n", - "print(\"PIV=%.1f V\" %PIV)\n", - "print(\"Transformer rating = %.2f kVA\" %(TF/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak diode current=36.13 A\n", - "I_DAV=11.50 A\n", - "I_Dr=18.06 A\n", - "PIV=361.3 V\n", - "Transformer rating = 6.53 kVA\n" - ] - } - ], - "prompt_number": 38 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.18, Page No 103" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tr=5\n", - "V=1100.0\n", - "R=10.0\n", - "\n", - "\n", - "#Calculations\n", - "print(\"In case of 3ph-3pulse type\")\n", - "V_ph=V/tr\n", - "V_mp=math.sqrt(2)*V_ph\n", - "V_o=3*math.sqrt(3)*V_mp/(2*math.pi)\n", - "print(\"avg o/p voltage=%.1f V\" %V_o)\n", - "I_mp=V_mp/R\n", - "I_D=(I_mp/math.pi)*math.sin(math.pi/3) \n", - "print(\"\\navg value of diode current=%.3f A\" %I_D)\n", - "I_Dr=I_mp*math.sqrt((1/(2*math.pi))*(math.pi/3+.5*math.sin(2*math.pi/3))) \n", - "print(\"\\nrms value of diode current=%.2f A\" %I_Dr)\n", - "V_or=V_mp*math.sqrt((3/(2*math.pi))*(math.pi/3+.5*math.sin(2*math.pi/3)))\n", - "P=(V_or**2)/R \n", - "print(\"\\npower delivered=%.1f W\" %P)\n", - "print(\"in case of 3ph-M6 type\")\n", - "V_ph=V_ph/2\n", - "V_mp=math.sqrt(2)*V_ph\n", - "V_o=3*V_mp/(math.pi) \n", - "I_mp=V_mp/R\n", - "I_D=(I_mp/math.pi)*math.sin(math.pi/6) \n", - "I_Dr=I_mp*math.sqrt((1/(2*math.pi))*(math.pi/6+.5*math.sin(2*math.pi/6))) \n", - "V_or=V_mp*math.sqrt((6/(2*math.pi))*(math.pi/6+.5*math.sin(2*math.pi/6)))\n", - "P=(V_or**2)/R \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.2f V\" %V_o)\n", - "print(\"\\navg value of diode current=%.2f A\" %I_D)\n", - "print(\"\\nrms value of diode current=%.2f A\" %I_Dr)\n", - "print(\"\\npower delivered=%.0f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "In case of 3ph-3pulse type\n", - "avg o/p voltage=257.3 V\n", - "\n", - "avg value of diode current=8.577 A\n", - "\n", - "rms value of diode current=15.10 A\n", - "\n", - "power delivered=6841.3 W\n", - "in case of 3ph-M6 type\n", - "avg o/p voltage=148.55 V\n", - "\n", - "avg value of diode current=2.48 A\n", - "\n", - "rms value of diode current=6.07 A\n", - "\n", - "power delivered=2211 W\n" - ] - } - ], - "prompt_number": 39 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.19, Page No 115" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=400\n", - "R=10\n", - "\n", - "#Calculations\n", - "V_ml=V_o*math.pi/3\n", - "V_s=V_ml/(math.sqrt(2)*math.sqrt(3))\n", - "I_m=V_ml/R\n", - "I_s=.7804*I_m\n", - "tr=3*V_s*I_s \n", - "\n", - "#Results\n", - "print(\"transformer rating=%.1f VA\" %tr)\n", - "I_Dr=.5518*I_m \n", - "print(\"\\nrms value of diode current=%.3f A\" %I_Dr)\n", - "I_D=I_m/math.pi \n", - "print(\"\\navg value of diode current=%.3f A\" %I_D)\n", - "print(\"\\npeak diode current=%.2f A\" %I_m)\n", - "PIV=V_ml \n", - "print(\"\\nPIV=%.2f V\" %PIV)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transformer rating=16770.3 VA\n", - "\n", - "rms value of diode current=23.114 A\n", - "\n", - "avg value of diode current=13.333 A\n", - "\n", - "peak diode current=41.89 A\n", - "\n", - "PIV=418.88 V\n" - ] - } - ], - "prompt_number": 40 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.20, Page No 116" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_l=230\n", - "E=240\n", - "R=8\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_l\n", - "V_o=3*V_ml/math.pi\n", - "I_o=(V_o-E)/R\n", - "P_b=E*I_o \n", - "P_d=E*I_o+I_o**2*R \n", - "phi1=0\n", - "math.cos(math.radians(phi1))\n", - "I_s1=2*math.sqrt(3)*I_o/(math.sqrt(2)*math.pi)\n", - "I_s=math.sqrt(I_o**2*2*math.pi/(3*math.pi))\n", - "CDF=I_s1/I_s \n", - "pf=DF*CDF \n", - "HF=math.sqrt(CDF**-2-1) \n", - "tr=math.sqrt(3)*V_l*I_o*math.sqrt(2/3)\n", - "\n", - "#Results\n", - "print(\"Power delivered to battery=%.1f W\" %P_b)\n", - "print(\"Power delivered to load=%.2f W\" %P_d)\n", - "print(\"Displacement factor=%.2f\" %DF)\n", - "print(\"Current distortion factor=%.3f\" %CDF)\n", - "print(\"i/p pf=%.3f\"%pf)\n", - "print(\"Harmonic factor=%.2f\" %HF)\n", - "print(\"Tranformer rating=%.2f VA\" %tr)\n", - "#answers have small variations from the book due to difference in rounding off of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered to battery=2118.3 W\n", - "Power delivered to load=2741.48 W\n", - "Displacement factor=1.00\n", - "Current distortion factor=0.955\n", - "i/p pf=0.955\n", - "Harmonic factor=0.31\n", - "Tranformer rating=0.00 VA\n" - ] - } - ], - "prompt_number": 41 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.21, Page No 122" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50 #Hz\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V\n", - "R=400.0\n", - "RF=0.05\n", - "C=(1/(4*f*R))*(1+(1/(math.sqrt(2)*RF)))\n", - "\n", - "#Results\n", - "print(\"capacitor value=%.2f uF\" %(C/10**-6))\n", - "V_o=V_m*(1-1/(4*f*R*C))\n", - "print(\"o/p voltage with filter=%.2f V\" %V_o)\n", - "V_o=2*V_m/math.pi \n", - "print(\"o/p voltage without filter=%.2f V\" %V_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "capacitor value=189.28 uF\n", - "o/p voltage with filter=303.79 V\n", - "o/p voltage without filter=207.07 V\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.22, Page No 122" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50\n", - "CRF=0.05\n", - "R=300\n", - "\n", - "#Calculations\n", - "L=math.sqrt((CRF/(.4715*R))**-2-R**2)/(2*2*math.pi*f) \n", - "print(\"L=%.2f H\" %L)\n", - "R=30\n", - "L=math.sqrt((CRF/(.4715*R))**-2-R**2)/(2*2*math.pi*f) \n", - "\n", - "\n", - "#Results\n", - "print(\"\\nL=%.2f H\" %L)\n", - "L=0\n", - "CRF=.4715*R/math.sqrt(R**2+(2*2*math.pi*f*L)**2) \n", - "print(\"\\nCRF=%.2f\" %CRF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "L=4.48 H\n", - "\n", - "L=0.45 H\n", - "\n", - "CRF=0.47\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.23, Page No 127" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=50\n", - "L_L=10*10**-3\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "\n", - "#Calculations\n", - "C=10/(2*w*math.sqrt(R**2+(2*w*L_L)**2))\n", - "\n", - "#Results\n", - "print(\"C=%.2f uF\" %(C*10**6))\n", - "VRF=0.1\n", - "L=(1/(4*w**2*C))*((math.sqrt(2)/(3*VRF))+1)\n", - "print(\"\\nL=%.2f mH\" %(L*10**3))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "C=315.83 uF\n", - "\n", - "L=45.83 mH\n" - ] - } - ], - "prompt_number": 44 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter3_4.ipynb b/_Power_Electronics/Chapter3_4.ipynb deleted file mode 100755 index 2e53ef9d..00000000 --- a/_Power_Electronics/Chapter3_4.ipynb +++ /dev/null @@ -1,1001 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 03 : Diode Circuits and Rectifiers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.2, Page No 55" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0 #V\n", - "V_o=100.0 #V\n", - "L=100.0 #uH\n", - "C=30.0 #uF\n", - "\n", - "#Calculations\n", - "t_o=math.pi*math.sqrt(L*C)\n", - "print(\"conduction time of diode = %.2f us\" %t_o)\n", - "#in book solution is t_o=54.77 us. The ans is incorrect as %pi is not muliplied in ans. Formulae mentioned in correct.\n", - "I_p=(V_s-V_o)*math.sqrt(C/L)\n", - "\n", - "#Results\n", - "print(\"Peak current through diode=%.2f A\" %I_p)\n", - "v_D=-V_s+V_o \n", - "print(\"Voltage across diode = %.2f V\" %v_D)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of diode = 172.07 us\n", - "Peak current through diode=164.32 A\n", - "Voltage across diode = -300.00 V\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.6, Page No 61" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "R=10 #ohm\n", - "L=0.001 #H\n", - "C=5*10**-6 #F\n", - "V_s=230 #V\n", - "xi=R/(2*L)\n", - "\n", - "#Calculations\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt((1/(L*C))-(R/(2*L))**2)\n", - "t=math.pi/w_r \n", - "\n", - "#Results\n", - "print('Conduction time of diode=%.3f us'%(t*10**6))\n", - "t=0\n", - "di=V_s/L\n", - "print('Rate of change of current at t=0 is %.2f A/s' %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Conduction time of diode=237.482 us\n", - "Rate of change of current at t=0 is 230000.00 A/s\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.7 Page No 69" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I_or=100 #A\n", - "R=1.0 #assumption\n", - "\n", - "#Calculations\n", - "V_m=I_or*2*R\n", - "I_o=V_m/(math.pi*R)\n", - "q=200 #Ah\n", - "t=q/I_o\n", - "\n", - "#Results\n", - "print(\"time required to deliver charge=%.02f hrs\" %t)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time required to deliver charge=3.14 hrs\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.8, Page No 70" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "P=1000 #W\n", - "R=V_s**2/P\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(2)*V_s/2\n", - "P_h=V_or**2/R \n", - "print(\"Power delivered to the heater = %.2f W\" %P_h)\n", - "V_m=math.sqrt(2)*230\n", - "I_m=V_m/R\n", - "\n", - "#Results\n", - "print(\"Peak value of diode current = %.2f A\" %I_m)\n", - "pf=V_or/V_s\n", - "print(\"Input power factor=%.2f\" %pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered to the heater = 500.00 W\n", - "Peak value of diode current = 6.15 A\n", - "Input power factor=0.71\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.9 Page No 71" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "V_m=V_s*math.sqrt(2)\n", - "E=150 #V\n", - "\n", - "#Calculations\n", - "theta1=math.degrees(E/(math.sqrt(2)*V_s))\n", - "R=8 #ohm\n", - "f=50 #Hz\n", - "I_o=(1/(2*math.pi*R))*((2*math.sqrt(2)*V_s*math.cos(math.radians(theta1)))-E*(math.pi-2*theta1*math.pi/180))\n", - "\n", - "#Results\n", - "print(\"avg value of charging current=%.2f A\" %I_o)\n", - "P_d=E*I_o\n", - "print(\"\\npower delivered to battery=%.2f W\" %P_d)\n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V_s**2+E**2)*(math.pi-2*theta1*math.pi/180)+V_s**2*math.sin(math.radians(2*theta1))-4*V_m*E*math.cos(math.radians(theta1))))\n", - "print(\"\\nrms value of the load current=%.2f A\" %I_or)\n", - "pf=(E*I_o+I_or**2*R)/(V_s*I_or)\n", - "print(\"\\nsupply pf=%.3f\" %pf)\n", - "P_dd=I_or**2*R\n", - "print(\"\\npower dissipated in the resistor=%.2f W\" %P_dd)\n", - "q=1000.00 #Wh\n", - "t=q/P_d \n", - "print(\"\\ncharging time=%.2f hr\" %t)\n", - "n=P_d*100/(P_d+P_dd)\n", - "print(\"rectifier efficiency =%.2f \" %n)\n", - "PIV=math.sqrt(2)*V_s+E\n", - "print(\"PIV of diode=%.2f V\" %PIV)\n", - "#solutions have small variations due to difference in rounding off of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg value of charging current=4.97 A\n", - "\n", - "power delivered to battery=745.11 W\n", - "\n", - "rms value of the load current=9.29 A\n", - "\n", - "supply pf=0.672\n", - "\n", - "power dissipated in the resistor=690.74 W\n", - "\n", - "charging time=1.34 hr\n", - "rectifier efficiency =51.89 \n", - "PIV of diode=475.27 V\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.10 Page No 78" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "t_rr=40*10**-6 #s reverde recovery time\n", - "\n", - "#Calculations\n", - "V_o=2*math.sqrt(2)*V_s/math.pi\n", - "V_m=math.sqrt(2)*V_s\n", - "f=50\n", - "V_r1=(V_m/math.pi)*(1-math.cos(math.radians(2*math.pi*f*t_rr*180/math.pi)))\n", - "v_avg1=V_r1*100/V_o*10**3\n", - "f=2500\n", - "V_r2=(V_m/math.pi)*(1-math.cos(math.radians(2*math.pi*f*t_rr*180/math.pi)))\n", - "v_avg2=V_r2*100/V_o\n", - "\n", - "#Results\n", - "print(\"when f=50Hz\")\n", - "print(\"Percentage reduction in avg o/p voltage=%.2f x 10^-3\" %v_avg1)\n", - "print(\"when f=2500Hz\")\n", - "print(\"Percentage reduction in avg o/p voltage = %.3f\" %v_avg2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when f=50Hz\n", - "Percentage reduction in avg o/p voltage=3.95 x 10^-3\n", - "when f=2500Hz\n", - "Percentage reduction in avg o/p voltage = 9.549\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.11, Page No 79 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230 #V\n", - "R=10.0 #ohm\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "V_o=2*V_m/math.pi\n", - "print(\"Avg value of o/p voltage = %.2f V\" %V_o)\n", - "I_o=V_o/R\n", - "print(\"Avg value of o/p current = %.2f A\" %I_o)\n", - "I_DA=I_o/2\n", - "print(\"Avg value of diode current=%.2f A\" %I_DA)\n", - "I_Dr=I_o/math.sqrt(2) \n", - "\n", - "#Results\n", - "print(\"rms value of diode current=%.2f A\" %I_Dr)\n", - "print(\"rms value of o/p current = %.2f A\" %I_o)\n", - "print(\"rms value of i/p current = %.2f A\" %I_o)\n", - "pf=(V_o/V_s)\n", - "print(\"supply pf = %.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Avg value of o/p voltage = 207.07 V\n", - "Avg value of o/p current = 20.71 A\n", - "Avg value of diode current=10.35 A\n", - "rms value of diode current=14.64 A\n", - "rms value of o/p current = 20.71 A\n", - "rms value of i/p current = 20.71 A\n", - "supply pf = 0.90\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.12 Page No 80" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "R=1000.0 #ohm\n", - "R_D=20.0 #ohm\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "I_om=V_m/(R+R_D) \n", - "\n", - "#Results\n", - "print(\"Peak load current = %.2f A\" %I_om)\n", - "I_o=I_om/math.pi\n", - "print(\"dc load current = %.2f A\" %I_o)\n", - "V_D=I_o*R_D-V_m/math.pi\n", - "print(\"dc diode voltage = %.2f V\" %V_D)\n", - "V_on=V_m/math.pi\n", - "print(\"at no load, load voltage = %.2f V\" %V_on)\n", - "V_o1=I_o*R \n", - "print(\"at given load, load voltage = %.2f V\" %V_o1)\n", - "vr=(V_on-V_o1)*100/V_on \n", - "print(\"Voltage regulation(in percent)=%.2f\" %vr)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Peak load current = 0.32 A\n", - "dc load current = 0.10 A\n", - "dc diode voltage = -101.51 V\n", - "at no load, load voltage = 103.54 V\n", - "at given load, load voltage = 101.51 V\n", - "Voltage regulation(in percent)=1.96\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.13 Page No 82" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_L=6.8 #V\n", - "V_smax=20*1.2 #V\n", - "V_smin=20*.8 #V\n", - "I_Lmax=30*1.5 #mA\n", - "I_Lmin=30*0.5 #mA\n", - "I_z=1 #mA\n", - "\n", - "#Calculations\n", - "R_smax=(V_smax-V_L)/((I_Lmin+I_z)*10**-3)\n", - "print(\"max source resistance = %.2f ohm\" %R_smax)\n", - "R_smin=(V_smin-V_L)/((I_Lmax+I_z)*10**-3) \n", - "print(\"Min source resistance = %.2f ohm\" %R_smin) #in book solution, error is committed in putting the values in formulea(printing error) but solution is correct\n", - "R_Lmax=V_L*1000/I_Lmin\n", - "print(\"Max load resistance = %.2f ohm\" %R_Lmax)\n", - "R_Lmin=V_L*1000/I_Lmax \n", - "V_d=0.6 #V\n", - "V_r=V_L-V_d\n", - "\n", - "#Results\n", - "print(\"Min load resistance=%.2f ohm\" %R_Lmin)\n", - "print(\"Voltage rating of zener diode=%.2f V\" %V_r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max source resistance = 1075.00 ohm\n", - "Min source resistance = 200.00 ohm\n", - "Max load resistance = 453.33 ohm\n", - "Min load resistance=151.11 ohm\n", - "Voltage rating of zener diode=6.20 V\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.14 Page No 83" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "I2=200*10**-6 #A\n", - "V_z=20 #V\n", - "R_G=500.0 #hm\n", - "\n", - "#Calculations\n", - "R2=(V_z/I2)-R_G\n", - "print(\"R2=%.2f kilo-ohm\" %(R2/1000))\n", - "\n", - "V_v=25 #V\n", - "I1=I2\n", - "R1=(V_v-V_z)/I1\n", - "\n", - "#Results\n", - "print(\"R1=%.0f kilo-ohm\"%(R1/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R2=99.50 kilo-ohm\n", - "R1=25 kilo-ohm\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.15, Page No 92" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=2*230 #V\n", - "\n", - "#Calculations\n", - "V_o=(math.sqrt(2)*V_s)/math.pi\n", - "R=60 #ohm\n", - "P_dc=(V_o)**2/R\n", - "TUF=0.2865\n", - "VA=P_dc/TUF\n", - "\n", - "#RESULTS\n", - "print(\"kVA rating of the transformer = %.2f kVA\" %(VA/1000));\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "kVA rating of the transformer = 2.49 kVA\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.16, Page No 92" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tr=0.5 #turns ratio\n", - "I_o=10.0\n", - "V=230.0\n", - "V_s=V/tr\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V_s\n", - "V_o=2*V_m/math.pi\n", - "phi1=0\n", - "#displacemnt angle=0 as fundamnetal component of i/p source current in phase with source voltage\n", - "DF=math.cos(math.radians(phi1))\n", - "I_s1=4*I_o/(math.sqrt(2)*math.pi)\n", - "I_s=math.sqrt(I_o**2*math.pi/math.pi)\n", - "CDF=I_s1/I_o\n", - "pf=CDF*DF\n", - "HF=math.sqrt((I_s/I_s1)**2-1)\n", - "CF=I_o/I_s\n", - "\n", - "#Results\n", - "print(\"o/p voltage = %.2f V\" %V_o)\n", - "print(\"distortion factor = %.2f\" %DF)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"Current displacent factor=%.2f\" %CDF)\n", - "print(\"Harmonic factor = %.2f\" %HF)\n", - "print(\"Creast factor = %.2f\" %CF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "o/p voltage = 414.15 V\n", - "distortion factor = 1.00\n", - "i/p pf=0.90\n", - "Current displacent factor=0.90\n", - "Harmonic factor = 0.48\n", - "Creast factor = 1.00\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.17, Page No 94" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=230.0\n", - "R=10.0\n", - "V_s=V_o*math.pi/(2*math.sqrt(2))\n", - "I_o=V_o/R\n", - "I_m=math.sqrt(2)*V_s/R\n", - "I_DAV=I_m/math.pi\n", - "\n", - "#Calculations\n", - "#avg value of diode current\n", - "I_Dr=I_m/2\n", - "PIV=math.sqrt(2)*V_s\n", - "I_s=I_m/math.sqrt(2)\n", - "TF=V_s*I_s\n", - "\n", - "#Results\n", - "print(\"peak diode current=%.2f A\" %I_m)\n", - "print(\"I_DAV=%.2f A\" %I_DAV)\n", - "print(\"I_Dr=%.2f A\" %I_Dr) #rms value of diode current\n", - "print(\"PIV=%.1f V\" %PIV)\n", - "print(\"Transformer rating = %.2f kVA\" %(TF/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak diode current=36.13 A\n", - "I_DAV=11.50 A\n", - "I_Dr=18.06 A\n", - "PIV=361.3 V\n", - "Transformer rating = 6.53 kVA\n" - ] - } - ], - "prompt_number": 38 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.18, Page No 103" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tr=5\n", - "V=1100.0\n", - "R=10.0\n", - "\n", - "\n", - "#Calculations\n", - "print(\"In case of 3ph-3pulse type\")\n", - "V_ph=V/tr\n", - "V_mp=math.sqrt(2)*V_ph\n", - "V_o=3*math.sqrt(3)*V_mp/(2*math.pi)\n", - "print(\"avg o/p voltage=%.1f V\" %V_o)\n", - "I_mp=V_mp/R\n", - "I_D=(I_mp/math.pi)*math.sin(math.pi/3) \n", - "print(\"\\navg value of diode current=%.3f A\" %I_D)\n", - "I_Dr=I_mp*math.sqrt((1/(2*math.pi))*(math.pi/3+.5*math.sin(2*math.pi/3))) \n", - "print(\"\\nrms value of diode current=%.2f A\" %I_Dr)\n", - "V_or=V_mp*math.sqrt((3/(2*math.pi))*(math.pi/3+.5*math.sin(2*math.pi/3)))\n", - "P=(V_or**2)/R \n", - "print(\"\\npower delivered=%.1f W\" %P)\n", - "print(\"in case of 3ph-M6 type\")\n", - "V_ph=V_ph/2\n", - "V_mp=math.sqrt(2)*V_ph\n", - "V_o=3*V_mp/(math.pi) \n", - "I_mp=V_mp/R\n", - "I_D=(I_mp/math.pi)*math.sin(math.pi/6) \n", - "I_Dr=I_mp*math.sqrt((1/(2*math.pi))*(math.pi/6+.5*math.sin(2*math.pi/6))) \n", - "V_or=V_mp*math.sqrt((6/(2*math.pi))*(math.pi/6+.5*math.sin(2*math.pi/6)))\n", - "P=(V_or**2)/R \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.2f V\" %V_o)\n", - "print(\"\\navg value of diode current=%.2f A\" %I_D)\n", - "print(\"\\nrms value of diode current=%.2f A\" %I_Dr)\n", - "print(\"\\npower delivered=%.0f W\" %P)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "In case of 3ph-3pulse type\n", - "avg o/p voltage=257.3 V\n", - "\n", - "avg value of diode current=8.577 A\n", - "\n", - "rms value of diode current=15.10 A\n", - "\n", - "power delivered=6841.3 W\n", - "in case of 3ph-M6 type\n", - "avg o/p voltage=148.55 V\n", - "\n", - "avg value of diode current=2.48 A\n", - "\n", - "rms value of diode current=6.07 A\n", - "\n", - "power delivered=2211 W\n" - ] - } - ], - "prompt_number": 39 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.19, Page No 115" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=400\n", - "R=10\n", - "\n", - "#Calculations\n", - "V_ml=V_o*math.pi/3\n", - "V_s=V_ml/(math.sqrt(2)*math.sqrt(3))\n", - "I_m=V_ml/R\n", - "I_s=.7804*I_m\n", - "tr=3*V_s*I_s \n", - "\n", - "#Results\n", - "print(\"transformer rating=%.1f VA\" %tr)\n", - "I_Dr=.5518*I_m \n", - "print(\"\\nrms value of diode current=%.3f A\" %I_Dr)\n", - "I_D=I_m/math.pi \n", - "print(\"\\navg value of diode current=%.3f A\" %I_D)\n", - "print(\"\\npeak diode current=%.2f A\" %I_m)\n", - "PIV=V_ml \n", - "print(\"\\nPIV=%.2f V\" %PIV)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "transformer rating=16770.3 VA\n", - "\n", - "rms value of diode current=23.114 A\n", - "\n", - "avg value of diode current=13.333 A\n", - "\n", - "peak diode current=41.89 A\n", - "\n", - "PIV=418.88 V\n" - ] - } - ], - "prompt_number": 40 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.20, Page No 116" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_l=230\n", - "E=240\n", - "R=8\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_l\n", - "V_o=3*V_ml/math.pi\n", - "I_o=(V_o-E)/R\n", - "P_b=E*I_o \n", - "P_d=E*I_o+I_o**2*R \n", - "phi1=0\n", - "math.cos(math.radians(phi1))\n", - "I_s1=2*math.sqrt(3)*I_o/(math.sqrt(2)*math.pi)\n", - "I_s=math.sqrt(I_o**2*2*math.pi/(3*math.pi))\n", - "CDF=I_s1/I_s \n", - "pf=DF*CDF \n", - "HF=math.sqrt(CDF**-2-1) \n", - "tr=math.sqrt(3)*V_l*I_o*math.sqrt(2/3)\n", - "\n", - "#Results\n", - "print(\"Power delivered to battery=%.1f W\" %P_b)\n", - "print(\"Power delivered to load=%.2f W\" %P_d)\n", - "print(\"Displacement factor=%.2f\" %DF)\n", - "print(\"Current distortion factor=%.3f\" %CDF)\n", - "print(\"i/p pf=%.3f\"%pf)\n", - "print(\"Harmonic factor=%.2f\" %HF)\n", - "print(\"Tranformer rating=%.2f VA\" %tr)\n", - "#answers have small variations from the book due to difference in rounding off of digits" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered to battery=2118.3 W\n", - "Power delivered to load=2741.48 W\n", - "Displacement factor=1.00\n", - "Current distortion factor=0.955\n", - "i/p pf=0.955\n", - "Harmonic factor=0.31\n", - "Tranformer rating=0.00 VA\n" - ] - } - ], - "prompt_number": 41 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.21, Page No 122" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50 #Hz\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V\n", - "R=400.0\n", - "RF=0.05\n", - "C=(1/(4*f*R))*(1+(1/(math.sqrt(2)*RF)))\n", - "\n", - "#Results\n", - "print(\"capacitor value=%.2f uF\" %(C/10**-6))\n", - "V_o=V_m*(1-1/(4*f*R*C))\n", - "print(\"o/p voltage with filter=%.2f V\" %V_o)\n", - "V_o=2*V_m/math.pi \n", - "print(\"o/p voltage without filter=%.2f V\" %V_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "capacitor value=189.28 uF\n", - "o/p voltage with filter=303.79 V\n", - "o/p voltage without filter=207.07 V\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.22, Page No 122" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50\n", - "CRF=0.05\n", - "R=300\n", - "\n", - "#Calculations\n", - "L=math.sqrt((CRF/(.4715*R))**-2-R**2)/(2*2*math.pi*f) \n", - "print(\"L=%.2f H\" %L)\n", - "R=30\n", - "L=math.sqrt((CRF/(.4715*R))**-2-R**2)/(2*2*math.pi*f) \n", - "\n", - "\n", - "#Results\n", - "print(\"\\nL=%.2f H\" %L)\n", - "L=0\n", - "CRF=.4715*R/math.sqrt(R**2+(2*2*math.pi*f*L)**2) \n", - "print(\"\\nCRF=%.2f\" %CRF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "L=4.48 H\n", - "\n", - "L=0.45 H\n", - "\n", - "CRF=0.47\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 3.23, Page No 127" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=50\n", - "L_L=10*10**-3\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "\n", - "#Calculations\n", - "C=10/(2*w*math.sqrt(R**2+(2*w*L_L)**2))\n", - "\n", - "#Results\n", - "print(\"C=%.2f uF\" %(C*10**6))\n", - "VRF=0.1\n", - "L=(1/(4*w**2*C))*((math.sqrt(2)/(3*VRF))+1)\n", - "print(\"\\nL=%.2f mH\" %(L*10**3))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "C=315.83 uF\n", - "\n", - "L=45.83 mH\n" - ] - } - ], - "prompt_number": 44 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter4.ipynb b/_Power_Electronics/Chapter4.ipynb deleted file mode 100755 index 22311574..00000000 --- a/_Power_Electronics/Chapter4.ipynb +++ /dev/null @@ -1,946 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 04 : Thyristors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.3, Page No 149" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=.5 #P=V_g*I_g\n", - "s=130 #s=V_g/I_g\n", - "\n", - "#Calculations\n", - "I_g=math.sqrt(P/s)\n", - "V_g=s*I_g\n", - "E=15\n", - "R_s=(E-V_g)/I_g \n", - "\n", - "#Results\n", - "print(\"Gate source resistance=%.2f ohm\" %R_s)\n", - "#Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Gate source resistance=111.87 ohm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.4, Page No 149" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "R_s=120 #slope of load line is -120V/A. This gives gate source resistance\n", - "print(\"gate source resistance=%.0f ohm\" %R_s)\n", - "\n", - "P=.4 #P=V_g*I_g\n", - "E_s=15\n", - "\n", - "#Calculations\n", - " #E_s=I_g*R_s+V_g % after solving this\n", - " #120*I_g**2-15*I_g+0.4=0 so\n", - "a=120 \n", - "b=-15\n", - "c=0.4\n", - "D=math.sqrt((b**2)-4*a*c)\n", - "I_g=(-b+D)/(2*a) \n", - "V_g=P/I_g\n", - "\n", - "#Results\n", - "print(\"\\ntrigger current=%.2f mA\" %(I_g*10**3)) \n", - "print(\"\\nthen trigger voltage=%.3f V\" %V_g)\n", - "I_g=(-b-D)/(2*a) \n", - "V_g=P/I_g\n", - "print(\"\\ntrigger current=%.2f mA\" %(I_g*10**3)) \n", - "print(\"\\nthen trigger voltage=%.2f V\" %V_g)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "gate source resistance=120 ohm\n", - "\n", - "trigger current=86.44 mA\n", - "\n", - "then trigger voltage=4.628 V\n", - "\n", - "trigger current=38.56 mA\n", - "\n", - "then trigger voltage=10.37 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.5 Page No 150" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "#V_g=1+10*I_g\n", - "P_gm=5 #P_gm=V_g*I_g\n", - "#after solving % eqn becomes 10*I_g**2+I_g-5=0\n", - "a=10.0 \n", - "b=1.0 \n", - "c=-5\n", - "\n", - "#Calculations\n", - "I_g=(-b+math.sqrt(b**2-4*a*c))/(2*a)\n", - "E_s=15\n", - "#using E_s=R_s*I_g+V_g\n", - "R_s=(E_s-1)/I_g-10 \n", - "P_gav=.3 #W\n", - "T=20*10**-6\n", - "f=P_gav/(P_gm*T)\n", - "dl=f*T\n", - "\n", - "#Results\n", - "print(\"Reistance=%.3f ohm\" %R_s)\n", - "print(\"Triggering freq=%.0f kHz\" %(f/1000))\n", - "print(\"Tduty cycle=%.2f\" %dl)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Reistance=11.248 ohm\n", - "Triggering freq=3 kHz\n", - "Tduty cycle=0.06\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.6, Page No 151" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I=.1\n", - "E=200.0\n", - "L=0.2\n", - "\n", - "#Calculations\n", - "t=I*L/E \n", - "R=20.0\n", - "t1=(-L/R)*math.log(1-(R*I/E)) \n", - "L=2.0\n", - "t2=(-L/R)*math.log(1-(R*I/E)) \n", - "\n", - "#Results\n", - "print(\"in case load consists of (a)L=.2H\")\n", - "print(\"min gate pulse width=%.0f us\" %(t*10**6))\n", - "print(\"(b)R=20ohm in series with L=.2H\")\n", - "print(\"min gate pulse width=%.3f us\" %(t1*10**6))\n", - "print(\"(c)R=20ohm in series with L=2H\")\n", - "print(\"min gate pulse width=%.2f us\" %(t2*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "in case load consists of (a)L=.2H\n", - "min gate pulse width=100 us\n", - "(b)R=20ohm in series with L=.2H\n", - "min gate pulse width=100.503 us\n", - "(c)R=20ohm in series with L=2H\n", - "min gate pulse width=1005.03 us\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.9 Page No 163" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "def theta(th):\n", - " I_m=1 #supposition\n", - " I_av=(I_m/(2*math.pi))*(1+math.cos(math.radians(th)))\n", - " I_rms=math.sqrt((I_m/(2*math.pi))*((180-th)*math.pi/360+.25*math.sin(math.radians(2*th))))\n", - " FF=I_rms/I_av\n", - " I_rms=35\n", - " I_TAV=I_rms/FF\n", - " return I_TAV\n", - "\n", - "#Calculations\n", - "print(\"when conduction angle=180\")\n", - "th=0\n", - "I_TAV=theta(th)\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=90\")\n", - "th=90\n", - "I_TAV=theta(th)\n", - "\n", - "#Results\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=30\")\n", - "th=150\n", - "I_TAV=theta(th)\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when conduction angle=180\n", - "avg on current rating=22.282 A\n", - "when conduction angle=90\n", - "avg on current rating=15.756 A\n", - "when conduction angle=30\n", - "avg on current rating=8.790 A\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.10, Page No 164" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "def theta(th):\n", - " n=360.0/th\n", - " I=1.0 #supposition\n", - " I_av=I/n\n", - " I_rms=I/math.sqrt(n)\n", - " FF=I_rms/I_av\n", - " I_rms=35\n", - " I_TAV=I_rms/FF\n", - " return I_TAV\n", - "\n", - "#Calculations\n", - "th=180.0\n", - "I_TAV1=theta(th)\n", - "th=90.0\n", - "I_TAV2=theta(th)\n", - "th=30.0\n", - "I_TAV3=theta(th)\n", - "\n", - "#Results\n", - "print(\"when conduction angle=180\")\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=90\")\n", - "print(\"avg on current rating=%.1f A\" %I_TAV2)\n", - "print(\"when conduction angle=30\")\n", - "print(\"avg on current rating=%.4f A\" %I_TAV3)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when conduction angle=180\n", - "avg on current rating=8.790 A\n", - "when conduction angle=90\n", - "avg on current rating=17.5 A\n", - "when conduction angle=30\n", - "avg on current rating=10.1036 A\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.11 Page No 165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "f=50.0 #Hz\n", - "\n", - "#Calculations\n", - "I_sb=3000.0\n", - "t=1/(4*f)\n", - "T=1/(2*f)\n", - "I=math.sqrt(I_sb**2*t/T) \n", - "r=(I_sb/math.sqrt(2))**2*T \n", - "\n", - "#Results\n", - "print(\"surge current rating=%.2f A\" %I)\n", - "print(\"\\nI**2*t rating=%.0f A^2.s\" %r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "surge current rating=2121.32 A\n", - "\n", - "I**2*t rating=45000 A^2.s\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.12 Page No 165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "V_s=300.0 #V\n", - "R=60.0 #ohm\n", - "L=2.0 #H\n", - "\n", - "#Calculations\n", - "t=40*10**-6 #s\n", - "i_T=(V_s/R)*(1-math.exp(-R*t/L))\n", - "i=.036 #A\n", - "R1=V_s/(i-i_T)\n", - "\n", - "#Results\n", - "print(\"maximum value of remedial parameter=%.3f kilo-ohm\" %(R1/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "maximum value of remedial parameter=9.999 kilo-ohm\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.16 Page No 172" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_p=230.0*math.sqrt(2)\n", - "\n", - "#Calculations\n", - "R=1+((1)**-1+(10)**-1)**-1\n", - "A=V_p/R\n", - "s=1 #s\n", - "t_c=20*A**-2*s\n", - "\n", - "#Results\n", - "print(\"fault clearance time=%.4f ms\" %(t_c*10**3))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fault clearance time=0.6890 ms\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.17, Page No 176" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "V_s=math.sqrt(2)*230 #V\n", - "L=15*10**-6 #H\n", - "I=V_s/L #I=(di/dt)_max\n", - "R_s=10 #ohm\n", - "v=I*R_s #v=(dv/dt)_max\n", - "\n", - "#Calculations\n", - "f=50 #Hz\n", - "X_L=L*2*math.pi*f\n", - "R=2\n", - "I_max=V_s/(R+X_L) \n", - "FF=math.pi/math.sqrt(2)\n", - "I_TAV1=I_max/FF \n", - "FF=3.98184\n", - "I_TAV2=I_max/FF \n", - "\n", - "\n", - "#RESULTS\n", - "print(\"(di/dt)_max=%.3f A/usec\" %(I/10**6))\n", - "print(\"\\n(dv/dt)_max=%.2f V/usec\" %(v/10**6))\n", - "print(\"\\nI_rms=%.3f A\" %I_max)\n", - "print(\"when conduction angle=90\")\n", - "print(\"I_TAV=%.3f A\" %I_TAV1)\n", - "print(\"when conduction angle=30\")\n", - "print(\"I_TAV=%.3f A\" %I_TAV2)\n", - "print(\"\\nvoltage rating=%.3f V\" %(2.75*V_s)) #rating is taken 2.75 times of peak working voltage unlike 2.5 to 3 times as mentioned int book." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(di/dt)_max=21.685 A/usec\n", - "\n", - "(dv/dt)_max=216.85 V/usec\n", - "\n", - "I_rms=162.252 A\n", - "when conduction angle=90\n", - "I_TAV=73.039 A\n", - "when conduction angle=30\n", - "I_TAV=40.748 A\n", - "\n", - "voltage rating=894.490 V\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.19, Page No 186" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "T_jm=125\n", - "th_jc=.15 #degC/W\n", - "th_cs=0.075 #degC/W\n", - "\n", - "\n", - "#Calculations\n", - "dT=54 #dT=T_s-T_a\n", - "P_av=120\n", - "th_sa=dT/P_av\n", - "T_a=40 #ambient temp\n", - "P_av=(T_jm-T_a)/(th_sa+th_jc+th_cs)\n", - "if (P_av-120)<1 :\n", - " print(\"selection of heat sink is satisfactory\")\n", - "\n", - "dT=58 #dT=T_s-T_a\n", - "P_av=120\n", - "th_sa=dT/P_av\n", - "T_a=40 #ambient temp\n", - "P_av=(T_jm-T_a)/(th_sa+th_jc+th_cs)\n", - "if (P_av-120)<1 :\n", - " print(\"selection of heat sink is satisfactory\")\n", - "\n", - "V_m=math.sqrt(2)*230\n", - "R=2\n", - "I_TAV=V_m/(R*math.pi)\n", - "P_av=90\n", - "th_sa=(T_jm-T_a)/P_av-(th_jc+th_cs)\n", - "dT=P_av*th_sa\n", - "print(\"for heat sink\") \n", - "print(\"T_s-T_a=%.2f degC\" %dT) \n", - "print(\"\\nP_av=%.0f W\" %P_av)\n", - "P=(V_m/2)**2/R\n", - "eff=P/(P+P_av) \n", - "print(\"\\nckt efficiency=%.3f pu\" %eff)\n", - "a=60 #delay angle\n", - "I_TAV=(V_m/(2*math.pi*R))*(1+math.cos(math.radians(a)))\n", - "print(\"\\nI_TAV=%.2f A\" %I_TAV)\n", - "dT=46\n", - "T_s=dT+T_a\n", - "T_c=T_s+P_av*th_cs \n", - "T_j=T_c+P_av*th_jc \n", - "\n", - "#Results\n", - "print(\"\\ncase temp=%.2f degC\" %T_c)\n", - "print(\"\\njunction temp=%.2f degC\" %T_j)\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for heat sink\n", - "T_s-T_a=-20.25 degC\n", - "\n", - "P_av=90 W\n", - "\n", - "ckt efficiency=0.993 pu\n", - "\n", - "I_TAV=38.83 A\n", - "\n", - "case temp=92.75 degC\n", - "\n", - "junction temp=106.25 degC\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.20, Page No 187" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_j=125.0 #degC\n", - "T_s=70.0 #degC\n", - "th_jc=.16 #degC/W\n", - "th_cs=.08 #degC/W\n", - "\n", - "#Calculations\n", - "P_av1=(T_j-T_s)/(th_jc+th_cs) \n", - "\n", - "T_s=60 #degC\n", - "P_av2=(T_j-T_s)/(th_jc+th_cs) \n", - "inc=(math.sqrt(P_av2)-math.sqrt(P_av1))*100/math.sqrt(P_av1) \n", - "\n", - "#Results\n", - "print(\"Total avg power loss in thristor sink combination=%.2f W\" %P_av1)\n", - "print(\"Percentage inc in rating=%.2f\" %inc)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total avg power loss in thristor sink combination=229.17 W\n", - "Percentage inc in rating=8.71\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.21, Page No 197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "R=25000.0\n", - "I_l1=.021 #I_l=leakage current\n", - "I_l2=.025\n", - "I_l3=.018\n", - "I_l4=.016\n", - " #V1=(I-I_l1)*R\n", - " #V2=(I-I_l2)*R\n", - " #V3=(I-I_l3)*R\n", - " #V4=(I-I_l4)*R\n", - " #V=V1+V2+V3+V4\n", - " \n", - "#Calculations\n", - "V=10000.0\n", - "I_l=I_l1+I_l2+I_l3+I_l4\n", - " #after solving\n", - "I=((V/R)+I_l)/4\n", - "R_c=40.0\n", - "V1=(I-I_l1)*R \n", - "\n", - "#Resluts\n", - "print(\"voltage across SCR1=%.0f V\" %V1)\n", - "V2=(I-I_l2)*R \n", - "print(\"\\nvoltage across SCR2=%.0f V\" %V2)\n", - "V3=(I-I_l3)*R \n", - "print(\"\\nvoltage across SCR3=%.0f V\" %V3)\n", - "V4=(I-I_l4)*R \n", - "print(\"\\nvoltage across SCR4=%.0f V\" %V4)\n", - "\n", - "I1=V1/R_c \n", - "print(\"\\ndischarge current through SCR1=%.3f A\" %I1)\n", - "I2=V2/R_c \n", - "print(\"\\ndischarge current through SCR2=%.3f A\" %I2)\n", - "I3=V3/R_c \n", - "print(\"\\ndischarge current through SCR3=%.3f A\" %I3)\n", - "I4=V4/R_c \n", - "print(\"\\ndischarge current through SCR4=%.3f A\" %I4)\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "voltage across SCR1=2475 V\n", - "\n", - "voltage across SCR2=2375 V\n", - "\n", - "voltage across SCR3=2550 V\n", - "\n", - "voltage across SCR4=2600 V\n", - "\n", - "discharge current through SCR1=61.875 A\n", - "\n", - "discharge current through SCR2=59.375 A\n", - "\n", - "discharge current through SCR3=63.750 A\n", - "\n", - "discharge current through SCR4=65.000 A\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.22, Page No 198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_r=1000 #rating of SCR\n", - "I_r=200 #rating of SCR\n", - "V_s=6000 #rating of String\n", - "I_s=1000 #rating of String\n", - "\n", - "#Calculations\n", - "print(\"when DRF=.1\")\n", - "DRF=.1\n", - "n_s=V_s/(V_r*(1-DRF)) \n", - "print(\"number of series units=%.0f\" %math.ceil(n_s))\n", - "n_p=I_s/(I_r*(1-DRF)) \n", - "print(\"\\nnumber of parrallel units=%.0f\" %math.ceil(n_p))\n", - "print(\"when DRF=.2\")\n", - "DRF=.2\n", - "\n", - "#Results\n", - "n_s=V_s/(V_r*(1-DRF)) \n", - "print(\"number of series units=%.0f\" %math.ceil(n_s))\n", - "n_p=I_s/(I_r*(1-DRF)) \n", - "print(\"\\nnumber of parrallel units=%.0f\" %math.ceil(n_p))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when DRF=.1\n", - "number of series units=7\n", - "\n", - "number of parrallel units=6\n", - "when DRF=.2\n", - "number of series units=8\n", - "\n", - "number of parrallel units=7\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.23, Page No 198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V1=1.6 #on state voltage drop of SCR1\n", - "V2=1.2 #on state voltage drop of SCR2\n", - "I1=250.0 #current rating of SCR1\n", - "I2=350.0 #current rating of SCR2\n", - "\n", - "#Calculations\n", - "R1=V1/I1\n", - "R2=V2/I2\n", - "I=600.0 #current to be shared\n", - " #for SCR1 % I*(R1+R)/(total resistance)=k*I1 (1)\n", - " #for SCR2 % I*(R2+R)/(total resistance)=k*I2 (2)\n", - " #(1)/(2)\n", - "R=(R2*I2-R1*I1)/(I1-I2)\n", - "\n", - "\n", - "#Results\n", - "print(\"RSequired value of resistance=%.3f ohm\" %R)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "RSequired value of resistance=0.004 ohm\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.25, Page No 223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=2000.0 #Hz\n", - "C=0.04*10**-6\n", - "n=.72\n", - "\n", - "#Calculations\n", - "R=1/(f*C*math.log(1/(1-n))) \n", - "V_p=18\n", - "V_BB=V_p/n\n", - "R2=10**4/(n*V_BB) \n", - "I=4.2*10**-3 #leakage current\n", - "R_BB=5000\n", - "R1=(V_BB/I)-R2-R_BB\n", - "\n", - "#Results\n", - "print(\"R=%.2f kilo-ohm\" %(R/1000))\n", - "print(\"\\nR2=%.2f ohm\" %R2)\n", - "print(\"\\nR1=%.0f ohm\" %R1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R=9.82 kilo-ohm\n", - "\n", - "R2=555.56 ohm\n", - "\n", - "R1=397 ohm\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.26, Page No 223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "V_p=18.0\n", - "n=.72\n", - "V_BB=V_p/n\n", - "I_p=.6*10**-3\n", - "I_v=2.5*10**-3\n", - "V_v=1\n", - "\n", - "#Calculations\n", - "R_max=V_BB*(1-n)/I_p \n", - "print(\"R_max=%.2f kilo-ohm\" %(R_max/1000))\n", - "R_min=(V_BB-V_v)/I_v \n", - "print(\"\\nR_min=%.2f kilo-ohm\" %(R_min/1000))\n", - "\n", - "C=.04*10**-6\n", - "f_min=1/(R_max*C*math.log(1/(1-n))) \n", - "print(\"\\nf_min=%.3f kHz\" %(f_min/1000))\n", - "f_max=1/(R_min*C*math.log(1/(1-n))) \n", - "print(\"\\nf_max=%.2f kHz\" %(f_max/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R_max=11.67 kilo-ohm\n", - "\n", - "R_min=9.60 kilo-ohm\n", - "\n", - "f_min=1.683 kHz\n", - "\n", - "f_max=2.05 kHz\n" - ] - } - ], - "prompt_number": 17 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter4_1.ipynb b/_Power_Electronics/Chapter4_1.ipynb deleted file mode 100755 index 22311574..00000000 --- a/_Power_Electronics/Chapter4_1.ipynb +++ /dev/null @@ -1,946 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 04 : Thyristors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.3, Page No 149" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=.5 #P=V_g*I_g\n", - "s=130 #s=V_g/I_g\n", - "\n", - "#Calculations\n", - "I_g=math.sqrt(P/s)\n", - "V_g=s*I_g\n", - "E=15\n", - "R_s=(E-V_g)/I_g \n", - "\n", - "#Results\n", - "print(\"Gate source resistance=%.2f ohm\" %R_s)\n", - "#Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Gate source resistance=111.87 ohm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.4, Page No 149" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "R_s=120 #slope of load line is -120V/A. This gives gate source resistance\n", - "print(\"gate source resistance=%.0f ohm\" %R_s)\n", - "\n", - "P=.4 #P=V_g*I_g\n", - "E_s=15\n", - "\n", - "#Calculations\n", - " #E_s=I_g*R_s+V_g % after solving this\n", - " #120*I_g**2-15*I_g+0.4=0 so\n", - "a=120 \n", - "b=-15\n", - "c=0.4\n", - "D=math.sqrt((b**2)-4*a*c)\n", - "I_g=(-b+D)/(2*a) \n", - "V_g=P/I_g\n", - "\n", - "#Results\n", - "print(\"\\ntrigger current=%.2f mA\" %(I_g*10**3)) \n", - "print(\"\\nthen trigger voltage=%.3f V\" %V_g)\n", - "I_g=(-b-D)/(2*a) \n", - "V_g=P/I_g\n", - "print(\"\\ntrigger current=%.2f mA\" %(I_g*10**3)) \n", - "print(\"\\nthen trigger voltage=%.2f V\" %V_g)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "gate source resistance=120 ohm\n", - "\n", - "trigger current=86.44 mA\n", - "\n", - "then trigger voltage=4.628 V\n", - "\n", - "trigger current=38.56 mA\n", - "\n", - "then trigger voltage=10.37 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.5 Page No 150" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "#V_g=1+10*I_g\n", - "P_gm=5 #P_gm=V_g*I_g\n", - "#after solving % eqn becomes 10*I_g**2+I_g-5=0\n", - "a=10.0 \n", - "b=1.0 \n", - "c=-5\n", - "\n", - "#Calculations\n", - "I_g=(-b+math.sqrt(b**2-4*a*c))/(2*a)\n", - "E_s=15\n", - "#using E_s=R_s*I_g+V_g\n", - "R_s=(E_s-1)/I_g-10 \n", - "P_gav=.3 #W\n", - "T=20*10**-6\n", - "f=P_gav/(P_gm*T)\n", - "dl=f*T\n", - "\n", - "#Results\n", - "print(\"Reistance=%.3f ohm\" %R_s)\n", - "print(\"Triggering freq=%.0f kHz\" %(f/1000))\n", - "print(\"Tduty cycle=%.2f\" %dl)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Reistance=11.248 ohm\n", - "Triggering freq=3 kHz\n", - "Tduty cycle=0.06\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.6, Page No 151" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I=.1\n", - "E=200.0\n", - "L=0.2\n", - "\n", - "#Calculations\n", - "t=I*L/E \n", - "R=20.0\n", - "t1=(-L/R)*math.log(1-(R*I/E)) \n", - "L=2.0\n", - "t2=(-L/R)*math.log(1-(R*I/E)) \n", - "\n", - "#Results\n", - "print(\"in case load consists of (a)L=.2H\")\n", - "print(\"min gate pulse width=%.0f us\" %(t*10**6))\n", - "print(\"(b)R=20ohm in series with L=.2H\")\n", - "print(\"min gate pulse width=%.3f us\" %(t1*10**6))\n", - "print(\"(c)R=20ohm in series with L=2H\")\n", - "print(\"min gate pulse width=%.2f us\" %(t2*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "in case load consists of (a)L=.2H\n", - "min gate pulse width=100 us\n", - "(b)R=20ohm in series with L=.2H\n", - "min gate pulse width=100.503 us\n", - "(c)R=20ohm in series with L=2H\n", - "min gate pulse width=1005.03 us\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.9 Page No 163" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "def theta(th):\n", - " I_m=1 #supposition\n", - " I_av=(I_m/(2*math.pi))*(1+math.cos(math.radians(th)))\n", - " I_rms=math.sqrt((I_m/(2*math.pi))*((180-th)*math.pi/360+.25*math.sin(math.radians(2*th))))\n", - " FF=I_rms/I_av\n", - " I_rms=35\n", - " I_TAV=I_rms/FF\n", - " return I_TAV\n", - "\n", - "#Calculations\n", - "print(\"when conduction angle=180\")\n", - "th=0\n", - "I_TAV=theta(th)\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=90\")\n", - "th=90\n", - "I_TAV=theta(th)\n", - "\n", - "#Results\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=30\")\n", - "th=150\n", - "I_TAV=theta(th)\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when conduction angle=180\n", - "avg on current rating=22.282 A\n", - "when conduction angle=90\n", - "avg on current rating=15.756 A\n", - "when conduction angle=30\n", - "avg on current rating=8.790 A\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.10, Page No 164" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "def theta(th):\n", - " n=360.0/th\n", - " I=1.0 #supposition\n", - " I_av=I/n\n", - " I_rms=I/math.sqrt(n)\n", - " FF=I_rms/I_av\n", - " I_rms=35\n", - " I_TAV=I_rms/FF\n", - " return I_TAV\n", - "\n", - "#Calculations\n", - "th=180.0\n", - "I_TAV1=theta(th)\n", - "th=90.0\n", - "I_TAV2=theta(th)\n", - "th=30.0\n", - "I_TAV3=theta(th)\n", - "\n", - "#Results\n", - "print(\"when conduction angle=180\")\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=90\")\n", - "print(\"avg on current rating=%.1f A\" %I_TAV2)\n", - "print(\"when conduction angle=30\")\n", - "print(\"avg on current rating=%.4f A\" %I_TAV3)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when conduction angle=180\n", - "avg on current rating=8.790 A\n", - "when conduction angle=90\n", - "avg on current rating=17.5 A\n", - "when conduction angle=30\n", - "avg on current rating=10.1036 A\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.11 Page No 165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "f=50.0 #Hz\n", - "\n", - "#Calculations\n", - "I_sb=3000.0\n", - "t=1/(4*f)\n", - "T=1/(2*f)\n", - "I=math.sqrt(I_sb**2*t/T) \n", - "r=(I_sb/math.sqrt(2))**2*T \n", - "\n", - "#Results\n", - "print(\"surge current rating=%.2f A\" %I)\n", - "print(\"\\nI**2*t rating=%.0f A^2.s\" %r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "surge current rating=2121.32 A\n", - "\n", - "I**2*t rating=45000 A^2.s\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.12 Page No 165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "V_s=300.0 #V\n", - "R=60.0 #ohm\n", - "L=2.0 #H\n", - "\n", - "#Calculations\n", - "t=40*10**-6 #s\n", - "i_T=(V_s/R)*(1-math.exp(-R*t/L))\n", - "i=.036 #A\n", - "R1=V_s/(i-i_T)\n", - "\n", - "#Results\n", - "print(\"maximum value of remedial parameter=%.3f kilo-ohm\" %(R1/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "maximum value of remedial parameter=9.999 kilo-ohm\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.16 Page No 172" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_p=230.0*math.sqrt(2)\n", - "\n", - "#Calculations\n", - "R=1+((1)**-1+(10)**-1)**-1\n", - "A=V_p/R\n", - "s=1 #s\n", - "t_c=20*A**-2*s\n", - "\n", - "#Results\n", - "print(\"fault clearance time=%.4f ms\" %(t_c*10**3))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fault clearance time=0.6890 ms\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.17, Page No 176" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "V_s=math.sqrt(2)*230 #V\n", - "L=15*10**-6 #H\n", - "I=V_s/L #I=(di/dt)_max\n", - "R_s=10 #ohm\n", - "v=I*R_s #v=(dv/dt)_max\n", - "\n", - "#Calculations\n", - "f=50 #Hz\n", - "X_L=L*2*math.pi*f\n", - "R=2\n", - "I_max=V_s/(R+X_L) \n", - "FF=math.pi/math.sqrt(2)\n", - "I_TAV1=I_max/FF \n", - "FF=3.98184\n", - "I_TAV2=I_max/FF \n", - "\n", - "\n", - "#RESULTS\n", - "print(\"(di/dt)_max=%.3f A/usec\" %(I/10**6))\n", - "print(\"\\n(dv/dt)_max=%.2f V/usec\" %(v/10**6))\n", - "print(\"\\nI_rms=%.3f A\" %I_max)\n", - "print(\"when conduction angle=90\")\n", - "print(\"I_TAV=%.3f A\" %I_TAV1)\n", - "print(\"when conduction angle=30\")\n", - "print(\"I_TAV=%.3f A\" %I_TAV2)\n", - "print(\"\\nvoltage rating=%.3f V\" %(2.75*V_s)) #rating is taken 2.75 times of peak working voltage unlike 2.5 to 3 times as mentioned int book." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(di/dt)_max=21.685 A/usec\n", - "\n", - "(dv/dt)_max=216.85 V/usec\n", - "\n", - "I_rms=162.252 A\n", - "when conduction angle=90\n", - "I_TAV=73.039 A\n", - "when conduction angle=30\n", - "I_TAV=40.748 A\n", - "\n", - "voltage rating=894.490 V\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.19, Page No 186" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "T_jm=125\n", - "th_jc=.15 #degC/W\n", - "th_cs=0.075 #degC/W\n", - "\n", - "\n", - "#Calculations\n", - "dT=54 #dT=T_s-T_a\n", - "P_av=120\n", - "th_sa=dT/P_av\n", - "T_a=40 #ambient temp\n", - "P_av=(T_jm-T_a)/(th_sa+th_jc+th_cs)\n", - "if (P_av-120)<1 :\n", - " print(\"selection of heat sink is satisfactory\")\n", - "\n", - "dT=58 #dT=T_s-T_a\n", - "P_av=120\n", - "th_sa=dT/P_av\n", - "T_a=40 #ambient temp\n", - "P_av=(T_jm-T_a)/(th_sa+th_jc+th_cs)\n", - "if (P_av-120)<1 :\n", - " print(\"selection of heat sink is satisfactory\")\n", - "\n", - "V_m=math.sqrt(2)*230\n", - "R=2\n", - "I_TAV=V_m/(R*math.pi)\n", - "P_av=90\n", - "th_sa=(T_jm-T_a)/P_av-(th_jc+th_cs)\n", - "dT=P_av*th_sa\n", - "print(\"for heat sink\") \n", - "print(\"T_s-T_a=%.2f degC\" %dT) \n", - "print(\"\\nP_av=%.0f W\" %P_av)\n", - "P=(V_m/2)**2/R\n", - "eff=P/(P+P_av) \n", - "print(\"\\nckt efficiency=%.3f pu\" %eff)\n", - "a=60 #delay angle\n", - "I_TAV=(V_m/(2*math.pi*R))*(1+math.cos(math.radians(a)))\n", - "print(\"\\nI_TAV=%.2f A\" %I_TAV)\n", - "dT=46\n", - "T_s=dT+T_a\n", - "T_c=T_s+P_av*th_cs \n", - "T_j=T_c+P_av*th_jc \n", - "\n", - "#Results\n", - "print(\"\\ncase temp=%.2f degC\" %T_c)\n", - "print(\"\\njunction temp=%.2f degC\" %T_j)\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for heat sink\n", - "T_s-T_a=-20.25 degC\n", - "\n", - "P_av=90 W\n", - "\n", - "ckt efficiency=0.993 pu\n", - "\n", - "I_TAV=38.83 A\n", - "\n", - "case temp=92.75 degC\n", - "\n", - "junction temp=106.25 degC\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.20, Page No 187" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_j=125.0 #degC\n", - "T_s=70.0 #degC\n", - "th_jc=.16 #degC/W\n", - "th_cs=.08 #degC/W\n", - "\n", - "#Calculations\n", - "P_av1=(T_j-T_s)/(th_jc+th_cs) \n", - "\n", - "T_s=60 #degC\n", - "P_av2=(T_j-T_s)/(th_jc+th_cs) \n", - "inc=(math.sqrt(P_av2)-math.sqrt(P_av1))*100/math.sqrt(P_av1) \n", - "\n", - "#Results\n", - "print(\"Total avg power loss in thristor sink combination=%.2f W\" %P_av1)\n", - "print(\"Percentage inc in rating=%.2f\" %inc)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total avg power loss in thristor sink combination=229.17 W\n", - "Percentage inc in rating=8.71\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.21, Page No 197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "R=25000.0\n", - "I_l1=.021 #I_l=leakage current\n", - "I_l2=.025\n", - "I_l3=.018\n", - "I_l4=.016\n", - " #V1=(I-I_l1)*R\n", - " #V2=(I-I_l2)*R\n", - " #V3=(I-I_l3)*R\n", - " #V4=(I-I_l4)*R\n", - " #V=V1+V2+V3+V4\n", - " \n", - "#Calculations\n", - "V=10000.0\n", - "I_l=I_l1+I_l2+I_l3+I_l4\n", - " #after solving\n", - "I=((V/R)+I_l)/4\n", - "R_c=40.0\n", - "V1=(I-I_l1)*R \n", - "\n", - "#Resluts\n", - "print(\"voltage across SCR1=%.0f V\" %V1)\n", - "V2=(I-I_l2)*R \n", - "print(\"\\nvoltage across SCR2=%.0f V\" %V2)\n", - "V3=(I-I_l3)*R \n", - "print(\"\\nvoltage across SCR3=%.0f V\" %V3)\n", - "V4=(I-I_l4)*R \n", - "print(\"\\nvoltage across SCR4=%.0f V\" %V4)\n", - "\n", - "I1=V1/R_c \n", - "print(\"\\ndischarge current through SCR1=%.3f A\" %I1)\n", - "I2=V2/R_c \n", - "print(\"\\ndischarge current through SCR2=%.3f A\" %I2)\n", - "I3=V3/R_c \n", - "print(\"\\ndischarge current through SCR3=%.3f A\" %I3)\n", - "I4=V4/R_c \n", - "print(\"\\ndischarge current through SCR4=%.3f A\" %I4)\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "voltage across SCR1=2475 V\n", - "\n", - "voltage across SCR2=2375 V\n", - "\n", - "voltage across SCR3=2550 V\n", - "\n", - "voltage across SCR4=2600 V\n", - "\n", - "discharge current through SCR1=61.875 A\n", - "\n", - "discharge current through SCR2=59.375 A\n", - "\n", - "discharge current through SCR3=63.750 A\n", - "\n", - "discharge current through SCR4=65.000 A\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.22, Page No 198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_r=1000 #rating of SCR\n", - "I_r=200 #rating of SCR\n", - "V_s=6000 #rating of String\n", - "I_s=1000 #rating of String\n", - "\n", - "#Calculations\n", - "print(\"when DRF=.1\")\n", - "DRF=.1\n", - "n_s=V_s/(V_r*(1-DRF)) \n", - "print(\"number of series units=%.0f\" %math.ceil(n_s))\n", - "n_p=I_s/(I_r*(1-DRF)) \n", - "print(\"\\nnumber of parrallel units=%.0f\" %math.ceil(n_p))\n", - "print(\"when DRF=.2\")\n", - "DRF=.2\n", - "\n", - "#Results\n", - "n_s=V_s/(V_r*(1-DRF)) \n", - "print(\"number of series units=%.0f\" %math.ceil(n_s))\n", - "n_p=I_s/(I_r*(1-DRF)) \n", - "print(\"\\nnumber of parrallel units=%.0f\" %math.ceil(n_p))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when DRF=.1\n", - "number of series units=7\n", - "\n", - "number of parrallel units=6\n", - "when DRF=.2\n", - "number of series units=8\n", - "\n", - "number of parrallel units=7\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.23, Page No 198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V1=1.6 #on state voltage drop of SCR1\n", - "V2=1.2 #on state voltage drop of SCR2\n", - "I1=250.0 #current rating of SCR1\n", - "I2=350.0 #current rating of SCR2\n", - "\n", - "#Calculations\n", - "R1=V1/I1\n", - "R2=V2/I2\n", - "I=600.0 #current to be shared\n", - " #for SCR1 % I*(R1+R)/(total resistance)=k*I1 (1)\n", - " #for SCR2 % I*(R2+R)/(total resistance)=k*I2 (2)\n", - " #(1)/(2)\n", - "R=(R2*I2-R1*I1)/(I1-I2)\n", - "\n", - "\n", - "#Results\n", - "print(\"RSequired value of resistance=%.3f ohm\" %R)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "RSequired value of resistance=0.004 ohm\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.25, Page No 223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=2000.0 #Hz\n", - "C=0.04*10**-6\n", - "n=.72\n", - "\n", - "#Calculations\n", - "R=1/(f*C*math.log(1/(1-n))) \n", - "V_p=18\n", - "V_BB=V_p/n\n", - "R2=10**4/(n*V_BB) \n", - "I=4.2*10**-3 #leakage current\n", - "R_BB=5000\n", - "R1=(V_BB/I)-R2-R_BB\n", - "\n", - "#Results\n", - "print(\"R=%.2f kilo-ohm\" %(R/1000))\n", - "print(\"\\nR2=%.2f ohm\" %R2)\n", - "print(\"\\nR1=%.0f ohm\" %R1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R=9.82 kilo-ohm\n", - "\n", - "R2=555.56 ohm\n", - "\n", - "R1=397 ohm\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.26, Page No 223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "V_p=18.0\n", - "n=.72\n", - "V_BB=V_p/n\n", - "I_p=.6*10**-3\n", - "I_v=2.5*10**-3\n", - "V_v=1\n", - "\n", - "#Calculations\n", - "R_max=V_BB*(1-n)/I_p \n", - "print(\"R_max=%.2f kilo-ohm\" %(R_max/1000))\n", - "R_min=(V_BB-V_v)/I_v \n", - "print(\"\\nR_min=%.2f kilo-ohm\" %(R_min/1000))\n", - "\n", - "C=.04*10**-6\n", - "f_min=1/(R_max*C*math.log(1/(1-n))) \n", - "print(\"\\nf_min=%.3f kHz\" %(f_min/1000))\n", - "f_max=1/(R_min*C*math.log(1/(1-n))) \n", - "print(\"\\nf_max=%.2f kHz\" %(f_max/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R_max=11.67 kilo-ohm\n", - "\n", - "R_min=9.60 kilo-ohm\n", - "\n", - "f_min=1.683 kHz\n", - "\n", - "f_max=2.05 kHz\n" - ] - } - ], - "prompt_number": 17 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter4_2.ipynb b/_Power_Electronics/Chapter4_2.ipynb deleted file mode 100755 index 22311574..00000000 --- a/_Power_Electronics/Chapter4_2.ipynb +++ /dev/null @@ -1,946 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 04 : Thyristors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.3, Page No 149" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=.5 #P=V_g*I_g\n", - "s=130 #s=V_g/I_g\n", - "\n", - "#Calculations\n", - "I_g=math.sqrt(P/s)\n", - "V_g=s*I_g\n", - "E=15\n", - "R_s=(E-V_g)/I_g \n", - "\n", - "#Results\n", - "print(\"Gate source resistance=%.2f ohm\" %R_s)\n", - "#Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Gate source resistance=111.87 ohm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.4, Page No 149" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "R_s=120 #slope of load line is -120V/A. This gives gate source resistance\n", - "print(\"gate source resistance=%.0f ohm\" %R_s)\n", - "\n", - "P=.4 #P=V_g*I_g\n", - "E_s=15\n", - "\n", - "#Calculations\n", - " #E_s=I_g*R_s+V_g % after solving this\n", - " #120*I_g**2-15*I_g+0.4=0 so\n", - "a=120 \n", - "b=-15\n", - "c=0.4\n", - "D=math.sqrt((b**2)-4*a*c)\n", - "I_g=(-b+D)/(2*a) \n", - "V_g=P/I_g\n", - "\n", - "#Results\n", - "print(\"\\ntrigger current=%.2f mA\" %(I_g*10**3)) \n", - "print(\"\\nthen trigger voltage=%.3f V\" %V_g)\n", - "I_g=(-b-D)/(2*a) \n", - "V_g=P/I_g\n", - "print(\"\\ntrigger current=%.2f mA\" %(I_g*10**3)) \n", - "print(\"\\nthen trigger voltage=%.2f V\" %V_g)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "gate source resistance=120 ohm\n", - "\n", - "trigger current=86.44 mA\n", - "\n", - "then trigger voltage=4.628 V\n", - "\n", - "trigger current=38.56 mA\n", - "\n", - "then trigger voltage=10.37 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.5 Page No 150" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "#V_g=1+10*I_g\n", - "P_gm=5 #P_gm=V_g*I_g\n", - "#after solving % eqn becomes 10*I_g**2+I_g-5=0\n", - "a=10.0 \n", - "b=1.0 \n", - "c=-5\n", - "\n", - "#Calculations\n", - "I_g=(-b+math.sqrt(b**2-4*a*c))/(2*a)\n", - "E_s=15\n", - "#using E_s=R_s*I_g+V_g\n", - "R_s=(E_s-1)/I_g-10 \n", - "P_gav=.3 #W\n", - "T=20*10**-6\n", - "f=P_gav/(P_gm*T)\n", - "dl=f*T\n", - "\n", - "#Results\n", - "print(\"Reistance=%.3f ohm\" %R_s)\n", - "print(\"Triggering freq=%.0f kHz\" %(f/1000))\n", - "print(\"Tduty cycle=%.2f\" %dl)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Reistance=11.248 ohm\n", - "Triggering freq=3 kHz\n", - "Tduty cycle=0.06\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.6, Page No 151" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I=.1\n", - "E=200.0\n", - "L=0.2\n", - "\n", - "#Calculations\n", - "t=I*L/E \n", - "R=20.0\n", - "t1=(-L/R)*math.log(1-(R*I/E)) \n", - "L=2.0\n", - "t2=(-L/R)*math.log(1-(R*I/E)) \n", - "\n", - "#Results\n", - "print(\"in case load consists of (a)L=.2H\")\n", - "print(\"min gate pulse width=%.0f us\" %(t*10**6))\n", - "print(\"(b)R=20ohm in series with L=.2H\")\n", - "print(\"min gate pulse width=%.3f us\" %(t1*10**6))\n", - "print(\"(c)R=20ohm in series with L=2H\")\n", - "print(\"min gate pulse width=%.2f us\" %(t2*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "in case load consists of (a)L=.2H\n", - "min gate pulse width=100 us\n", - "(b)R=20ohm in series with L=.2H\n", - "min gate pulse width=100.503 us\n", - "(c)R=20ohm in series with L=2H\n", - "min gate pulse width=1005.03 us\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.9 Page No 163" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "def theta(th):\n", - " I_m=1 #supposition\n", - " I_av=(I_m/(2*math.pi))*(1+math.cos(math.radians(th)))\n", - " I_rms=math.sqrt((I_m/(2*math.pi))*((180-th)*math.pi/360+.25*math.sin(math.radians(2*th))))\n", - " FF=I_rms/I_av\n", - " I_rms=35\n", - " I_TAV=I_rms/FF\n", - " return I_TAV\n", - "\n", - "#Calculations\n", - "print(\"when conduction angle=180\")\n", - "th=0\n", - "I_TAV=theta(th)\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=90\")\n", - "th=90\n", - "I_TAV=theta(th)\n", - "\n", - "#Results\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=30\")\n", - "th=150\n", - "I_TAV=theta(th)\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when conduction angle=180\n", - "avg on current rating=22.282 A\n", - "when conduction angle=90\n", - "avg on current rating=15.756 A\n", - "when conduction angle=30\n", - "avg on current rating=8.790 A\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.10, Page No 164" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "def theta(th):\n", - " n=360.0/th\n", - " I=1.0 #supposition\n", - " I_av=I/n\n", - " I_rms=I/math.sqrt(n)\n", - " FF=I_rms/I_av\n", - " I_rms=35\n", - " I_TAV=I_rms/FF\n", - " return I_TAV\n", - "\n", - "#Calculations\n", - "th=180.0\n", - "I_TAV1=theta(th)\n", - "th=90.0\n", - "I_TAV2=theta(th)\n", - "th=30.0\n", - "I_TAV3=theta(th)\n", - "\n", - "#Results\n", - "print(\"when conduction angle=180\")\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=90\")\n", - "print(\"avg on current rating=%.1f A\" %I_TAV2)\n", - "print(\"when conduction angle=30\")\n", - "print(\"avg on current rating=%.4f A\" %I_TAV3)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when conduction angle=180\n", - "avg on current rating=8.790 A\n", - "when conduction angle=90\n", - "avg on current rating=17.5 A\n", - "when conduction angle=30\n", - "avg on current rating=10.1036 A\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.11 Page No 165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "f=50.0 #Hz\n", - "\n", - "#Calculations\n", - "I_sb=3000.0\n", - "t=1/(4*f)\n", - "T=1/(2*f)\n", - "I=math.sqrt(I_sb**2*t/T) \n", - "r=(I_sb/math.sqrt(2))**2*T \n", - "\n", - "#Results\n", - "print(\"surge current rating=%.2f A\" %I)\n", - "print(\"\\nI**2*t rating=%.0f A^2.s\" %r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "surge current rating=2121.32 A\n", - "\n", - "I**2*t rating=45000 A^2.s\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.12 Page No 165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "V_s=300.0 #V\n", - "R=60.0 #ohm\n", - "L=2.0 #H\n", - "\n", - "#Calculations\n", - "t=40*10**-6 #s\n", - "i_T=(V_s/R)*(1-math.exp(-R*t/L))\n", - "i=.036 #A\n", - "R1=V_s/(i-i_T)\n", - "\n", - "#Results\n", - "print(\"maximum value of remedial parameter=%.3f kilo-ohm\" %(R1/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "maximum value of remedial parameter=9.999 kilo-ohm\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.16 Page No 172" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_p=230.0*math.sqrt(2)\n", - "\n", - "#Calculations\n", - "R=1+((1)**-1+(10)**-1)**-1\n", - "A=V_p/R\n", - "s=1 #s\n", - "t_c=20*A**-2*s\n", - "\n", - "#Results\n", - "print(\"fault clearance time=%.4f ms\" %(t_c*10**3))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fault clearance time=0.6890 ms\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.17, Page No 176" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "V_s=math.sqrt(2)*230 #V\n", - "L=15*10**-6 #H\n", - "I=V_s/L #I=(di/dt)_max\n", - "R_s=10 #ohm\n", - "v=I*R_s #v=(dv/dt)_max\n", - "\n", - "#Calculations\n", - "f=50 #Hz\n", - "X_L=L*2*math.pi*f\n", - "R=2\n", - "I_max=V_s/(R+X_L) \n", - "FF=math.pi/math.sqrt(2)\n", - "I_TAV1=I_max/FF \n", - "FF=3.98184\n", - "I_TAV2=I_max/FF \n", - "\n", - "\n", - "#RESULTS\n", - "print(\"(di/dt)_max=%.3f A/usec\" %(I/10**6))\n", - "print(\"\\n(dv/dt)_max=%.2f V/usec\" %(v/10**6))\n", - "print(\"\\nI_rms=%.3f A\" %I_max)\n", - "print(\"when conduction angle=90\")\n", - "print(\"I_TAV=%.3f A\" %I_TAV1)\n", - "print(\"when conduction angle=30\")\n", - "print(\"I_TAV=%.3f A\" %I_TAV2)\n", - "print(\"\\nvoltage rating=%.3f V\" %(2.75*V_s)) #rating is taken 2.75 times of peak working voltage unlike 2.5 to 3 times as mentioned int book." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(di/dt)_max=21.685 A/usec\n", - "\n", - "(dv/dt)_max=216.85 V/usec\n", - "\n", - "I_rms=162.252 A\n", - "when conduction angle=90\n", - "I_TAV=73.039 A\n", - "when conduction angle=30\n", - "I_TAV=40.748 A\n", - "\n", - "voltage rating=894.490 V\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.19, Page No 186" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "T_jm=125\n", - "th_jc=.15 #degC/W\n", - "th_cs=0.075 #degC/W\n", - "\n", - "\n", - "#Calculations\n", - "dT=54 #dT=T_s-T_a\n", - "P_av=120\n", - "th_sa=dT/P_av\n", - "T_a=40 #ambient temp\n", - "P_av=(T_jm-T_a)/(th_sa+th_jc+th_cs)\n", - "if (P_av-120)<1 :\n", - " print(\"selection of heat sink is satisfactory\")\n", - "\n", - "dT=58 #dT=T_s-T_a\n", - "P_av=120\n", - "th_sa=dT/P_av\n", - "T_a=40 #ambient temp\n", - "P_av=(T_jm-T_a)/(th_sa+th_jc+th_cs)\n", - "if (P_av-120)<1 :\n", - " print(\"selection of heat sink is satisfactory\")\n", - "\n", - "V_m=math.sqrt(2)*230\n", - "R=2\n", - "I_TAV=V_m/(R*math.pi)\n", - "P_av=90\n", - "th_sa=(T_jm-T_a)/P_av-(th_jc+th_cs)\n", - "dT=P_av*th_sa\n", - "print(\"for heat sink\") \n", - "print(\"T_s-T_a=%.2f degC\" %dT) \n", - "print(\"\\nP_av=%.0f W\" %P_av)\n", - "P=(V_m/2)**2/R\n", - "eff=P/(P+P_av) \n", - "print(\"\\nckt efficiency=%.3f pu\" %eff)\n", - "a=60 #delay angle\n", - "I_TAV=(V_m/(2*math.pi*R))*(1+math.cos(math.radians(a)))\n", - "print(\"\\nI_TAV=%.2f A\" %I_TAV)\n", - "dT=46\n", - "T_s=dT+T_a\n", - "T_c=T_s+P_av*th_cs \n", - "T_j=T_c+P_av*th_jc \n", - "\n", - "#Results\n", - "print(\"\\ncase temp=%.2f degC\" %T_c)\n", - "print(\"\\njunction temp=%.2f degC\" %T_j)\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for heat sink\n", - "T_s-T_a=-20.25 degC\n", - "\n", - "P_av=90 W\n", - "\n", - "ckt efficiency=0.993 pu\n", - "\n", - "I_TAV=38.83 A\n", - "\n", - "case temp=92.75 degC\n", - "\n", - "junction temp=106.25 degC\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.20, Page No 187" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_j=125.0 #degC\n", - "T_s=70.0 #degC\n", - "th_jc=.16 #degC/W\n", - "th_cs=.08 #degC/W\n", - "\n", - "#Calculations\n", - "P_av1=(T_j-T_s)/(th_jc+th_cs) \n", - "\n", - "T_s=60 #degC\n", - "P_av2=(T_j-T_s)/(th_jc+th_cs) \n", - "inc=(math.sqrt(P_av2)-math.sqrt(P_av1))*100/math.sqrt(P_av1) \n", - "\n", - "#Results\n", - "print(\"Total avg power loss in thristor sink combination=%.2f W\" %P_av1)\n", - "print(\"Percentage inc in rating=%.2f\" %inc)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total avg power loss in thristor sink combination=229.17 W\n", - "Percentage inc in rating=8.71\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.21, Page No 197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "R=25000.0\n", - "I_l1=.021 #I_l=leakage current\n", - "I_l2=.025\n", - "I_l3=.018\n", - "I_l4=.016\n", - " #V1=(I-I_l1)*R\n", - " #V2=(I-I_l2)*R\n", - " #V3=(I-I_l3)*R\n", - " #V4=(I-I_l4)*R\n", - " #V=V1+V2+V3+V4\n", - " \n", - "#Calculations\n", - "V=10000.0\n", - "I_l=I_l1+I_l2+I_l3+I_l4\n", - " #after solving\n", - "I=((V/R)+I_l)/4\n", - "R_c=40.0\n", - "V1=(I-I_l1)*R \n", - "\n", - "#Resluts\n", - "print(\"voltage across SCR1=%.0f V\" %V1)\n", - "V2=(I-I_l2)*R \n", - "print(\"\\nvoltage across SCR2=%.0f V\" %V2)\n", - "V3=(I-I_l3)*R \n", - "print(\"\\nvoltage across SCR3=%.0f V\" %V3)\n", - "V4=(I-I_l4)*R \n", - "print(\"\\nvoltage across SCR4=%.0f V\" %V4)\n", - "\n", - "I1=V1/R_c \n", - "print(\"\\ndischarge current through SCR1=%.3f A\" %I1)\n", - "I2=V2/R_c \n", - "print(\"\\ndischarge current through SCR2=%.3f A\" %I2)\n", - "I3=V3/R_c \n", - "print(\"\\ndischarge current through SCR3=%.3f A\" %I3)\n", - "I4=V4/R_c \n", - "print(\"\\ndischarge current through SCR4=%.3f A\" %I4)\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "voltage across SCR1=2475 V\n", - "\n", - "voltage across SCR2=2375 V\n", - "\n", - "voltage across SCR3=2550 V\n", - "\n", - "voltage across SCR4=2600 V\n", - "\n", - "discharge current through SCR1=61.875 A\n", - "\n", - "discharge current through SCR2=59.375 A\n", - "\n", - "discharge current through SCR3=63.750 A\n", - "\n", - "discharge current through SCR4=65.000 A\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.22, Page No 198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_r=1000 #rating of SCR\n", - "I_r=200 #rating of SCR\n", - "V_s=6000 #rating of String\n", - "I_s=1000 #rating of String\n", - "\n", - "#Calculations\n", - "print(\"when DRF=.1\")\n", - "DRF=.1\n", - "n_s=V_s/(V_r*(1-DRF)) \n", - "print(\"number of series units=%.0f\" %math.ceil(n_s))\n", - "n_p=I_s/(I_r*(1-DRF)) \n", - "print(\"\\nnumber of parrallel units=%.0f\" %math.ceil(n_p))\n", - "print(\"when DRF=.2\")\n", - "DRF=.2\n", - "\n", - "#Results\n", - "n_s=V_s/(V_r*(1-DRF)) \n", - "print(\"number of series units=%.0f\" %math.ceil(n_s))\n", - "n_p=I_s/(I_r*(1-DRF)) \n", - "print(\"\\nnumber of parrallel units=%.0f\" %math.ceil(n_p))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when DRF=.1\n", - "number of series units=7\n", - "\n", - "number of parrallel units=6\n", - "when DRF=.2\n", - "number of series units=8\n", - "\n", - "number of parrallel units=7\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.23, Page No 198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V1=1.6 #on state voltage drop of SCR1\n", - "V2=1.2 #on state voltage drop of SCR2\n", - "I1=250.0 #current rating of SCR1\n", - "I2=350.0 #current rating of SCR2\n", - "\n", - "#Calculations\n", - "R1=V1/I1\n", - "R2=V2/I2\n", - "I=600.0 #current to be shared\n", - " #for SCR1 % I*(R1+R)/(total resistance)=k*I1 (1)\n", - " #for SCR2 % I*(R2+R)/(total resistance)=k*I2 (2)\n", - " #(1)/(2)\n", - "R=(R2*I2-R1*I1)/(I1-I2)\n", - "\n", - "\n", - "#Results\n", - "print(\"RSequired value of resistance=%.3f ohm\" %R)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "RSequired value of resistance=0.004 ohm\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.25, Page No 223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=2000.0 #Hz\n", - "C=0.04*10**-6\n", - "n=.72\n", - "\n", - "#Calculations\n", - "R=1/(f*C*math.log(1/(1-n))) \n", - "V_p=18\n", - "V_BB=V_p/n\n", - "R2=10**4/(n*V_BB) \n", - "I=4.2*10**-3 #leakage current\n", - "R_BB=5000\n", - "R1=(V_BB/I)-R2-R_BB\n", - "\n", - "#Results\n", - "print(\"R=%.2f kilo-ohm\" %(R/1000))\n", - "print(\"\\nR2=%.2f ohm\" %R2)\n", - "print(\"\\nR1=%.0f ohm\" %R1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R=9.82 kilo-ohm\n", - "\n", - "R2=555.56 ohm\n", - "\n", - "R1=397 ohm\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.26, Page No 223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "V_p=18.0\n", - "n=.72\n", - "V_BB=V_p/n\n", - "I_p=.6*10**-3\n", - "I_v=2.5*10**-3\n", - "V_v=1\n", - "\n", - "#Calculations\n", - "R_max=V_BB*(1-n)/I_p \n", - "print(\"R_max=%.2f kilo-ohm\" %(R_max/1000))\n", - "R_min=(V_BB-V_v)/I_v \n", - "print(\"\\nR_min=%.2f kilo-ohm\" %(R_min/1000))\n", - "\n", - "C=.04*10**-6\n", - "f_min=1/(R_max*C*math.log(1/(1-n))) \n", - "print(\"\\nf_min=%.3f kHz\" %(f_min/1000))\n", - "f_max=1/(R_min*C*math.log(1/(1-n))) \n", - "print(\"\\nf_max=%.2f kHz\" %(f_max/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R_max=11.67 kilo-ohm\n", - "\n", - "R_min=9.60 kilo-ohm\n", - "\n", - "f_min=1.683 kHz\n", - "\n", - "f_max=2.05 kHz\n" - ] - } - ], - "prompt_number": 17 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter4_3.ipynb b/_Power_Electronics/Chapter4_3.ipynb deleted file mode 100755 index 22311574..00000000 --- a/_Power_Electronics/Chapter4_3.ipynb +++ /dev/null @@ -1,946 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 04 : Thyristors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.3, Page No 149" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=.5 #P=V_g*I_g\n", - "s=130 #s=V_g/I_g\n", - "\n", - "#Calculations\n", - "I_g=math.sqrt(P/s)\n", - "V_g=s*I_g\n", - "E=15\n", - "R_s=(E-V_g)/I_g \n", - "\n", - "#Results\n", - "print(\"Gate source resistance=%.2f ohm\" %R_s)\n", - "#Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Gate source resistance=111.87 ohm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.4, Page No 149" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "R_s=120 #slope of load line is -120V/A. This gives gate source resistance\n", - "print(\"gate source resistance=%.0f ohm\" %R_s)\n", - "\n", - "P=.4 #P=V_g*I_g\n", - "E_s=15\n", - "\n", - "#Calculations\n", - " #E_s=I_g*R_s+V_g % after solving this\n", - " #120*I_g**2-15*I_g+0.4=0 so\n", - "a=120 \n", - "b=-15\n", - "c=0.4\n", - "D=math.sqrt((b**2)-4*a*c)\n", - "I_g=(-b+D)/(2*a) \n", - "V_g=P/I_g\n", - "\n", - "#Results\n", - "print(\"\\ntrigger current=%.2f mA\" %(I_g*10**3)) \n", - "print(\"\\nthen trigger voltage=%.3f V\" %V_g)\n", - "I_g=(-b-D)/(2*a) \n", - "V_g=P/I_g\n", - "print(\"\\ntrigger current=%.2f mA\" %(I_g*10**3)) \n", - "print(\"\\nthen trigger voltage=%.2f V\" %V_g)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "gate source resistance=120 ohm\n", - "\n", - "trigger current=86.44 mA\n", - "\n", - "then trigger voltage=4.628 V\n", - "\n", - "trigger current=38.56 mA\n", - "\n", - "then trigger voltage=10.37 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.5 Page No 150" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "#V_g=1+10*I_g\n", - "P_gm=5 #P_gm=V_g*I_g\n", - "#after solving % eqn becomes 10*I_g**2+I_g-5=0\n", - "a=10.0 \n", - "b=1.0 \n", - "c=-5\n", - "\n", - "#Calculations\n", - "I_g=(-b+math.sqrt(b**2-4*a*c))/(2*a)\n", - "E_s=15\n", - "#using E_s=R_s*I_g+V_g\n", - "R_s=(E_s-1)/I_g-10 \n", - "P_gav=.3 #W\n", - "T=20*10**-6\n", - "f=P_gav/(P_gm*T)\n", - "dl=f*T\n", - "\n", - "#Results\n", - "print(\"Reistance=%.3f ohm\" %R_s)\n", - "print(\"Triggering freq=%.0f kHz\" %(f/1000))\n", - "print(\"Tduty cycle=%.2f\" %dl)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Reistance=11.248 ohm\n", - "Triggering freq=3 kHz\n", - "Tduty cycle=0.06\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.6, Page No 151" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I=.1\n", - "E=200.0\n", - "L=0.2\n", - "\n", - "#Calculations\n", - "t=I*L/E \n", - "R=20.0\n", - "t1=(-L/R)*math.log(1-(R*I/E)) \n", - "L=2.0\n", - "t2=(-L/R)*math.log(1-(R*I/E)) \n", - "\n", - "#Results\n", - "print(\"in case load consists of (a)L=.2H\")\n", - "print(\"min gate pulse width=%.0f us\" %(t*10**6))\n", - "print(\"(b)R=20ohm in series with L=.2H\")\n", - "print(\"min gate pulse width=%.3f us\" %(t1*10**6))\n", - "print(\"(c)R=20ohm in series with L=2H\")\n", - "print(\"min gate pulse width=%.2f us\" %(t2*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "in case load consists of (a)L=.2H\n", - "min gate pulse width=100 us\n", - "(b)R=20ohm in series with L=.2H\n", - "min gate pulse width=100.503 us\n", - "(c)R=20ohm in series with L=2H\n", - "min gate pulse width=1005.03 us\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.9 Page No 163" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "def theta(th):\n", - " I_m=1 #supposition\n", - " I_av=(I_m/(2*math.pi))*(1+math.cos(math.radians(th)))\n", - " I_rms=math.sqrt((I_m/(2*math.pi))*((180-th)*math.pi/360+.25*math.sin(math.radians(2*th))))\n", - " FF=I_rms/I_av\n", - " I_rms=35\n", - " I_TAV=I_rms/FF\n", - " return I_TAV\n", - "\n", - "#Calculations\n", - "print(\"when conduction angle=180\")\n", - "th=0\n", - "I_TAV=theta(th)\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=90\")\n", - "th=90\n", - "I_TAV=theta(th)\n", - "\n", - "#Results\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=30\")\n", - "th=150\n", - "I_TAV=theta(th)\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when conduction angle=180\n", - "avg on current rating=22.282 A\n", - "when conduction angle=90\n", - "avg on current rating=15.756 A\n", - "when conduction angle=30\n", - "avg on current rating=8.790 A\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.10, Page No 164" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "def theta(th):\n", - " n=360.0/th\n", - " I=1.0 #supposition\n", - " I_av=I/n\n", - " I_rms=I/math.sqrt(n)\n", - " FF=I_rms/I_av\n", - " I_rms=35\n", - " I_TAV=I_rms/FF\n", - " return I_TAV\n", - "\n", - "#Calculations\n", - "th=180.0\n", - "I_TAV1=theta(th)\n", - "th=90.0\n", - "I_TAV2=theta(th)\n", - "th=30.0\n", - "I_TAV3=theta(th)\n", - "\n", - "#Results\n", - "print(\"when conduction angle=180\")\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=90\")\n", - "print(\"avg on current rating=%.1f A\" %I_TAV2)\n", - "print(\"when conduction angle=30\")\n", - "print(\"avg on current rating=%.4f A\" %I_TAV3)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when conduction angle=180\n", - "avg on current rating=8.790 A\n", - "when conduction angle=90\n", - "avg on current rating=17.5 A\n", - "when conduction angle=30\n", - "avg on current rating=10.1036 A\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.11 Page No 165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "f=50.0 #Hz\n", - "\n", - "#Calculations\n", - "I_sb=3000.0\n", - "t=1/(4*f)\n", - "T=1/(2*f)\n", - "I=math.sqrt(I_sb**2*t/T) \n", - "r=(I_sb/math.sqrt(2))**2*T \n", - "\n", - "#Results\n", - "print(\"surge current rating=%.2f A\" %I)\n", - "print(\"\\nI**2*t rating=%.0f A^2.s\" %r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "surge current rating=2121.32 A\n", - "\n", - "I**2*t rating=45000 A^2.s\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.12 Page No 165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "V_s=300.0 #V\n", - "R=60.0 #ohm\n", - "L=2.0 #H\n", - "\n", - "#Calculations\n", - "t=40*10**-6 #s\n", - "i_T=(V_s/R)*(1-math.exp(-R*t/L))\n", - "i=.036 #A\n", - "R1=V_s/(i-i_T)\n", - "\n", - "#Results\n", - "print(\"maximum value of remedial parameter=%.3f kilo-ohm\" %(R1/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "maximum value of remedial parameter=9.999 kilo-ohm\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.16 Page No 172" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_p=230.0*math.sqrt(2)\n", - "\n", - "#Calculations\n", - "R=1+((1)**-1+(10)**-1)**-1\n", - "A=V_p/R\n", - "s=1 #s\n", - "t_c=20*A**-2*s\n", - "\n", - "#Results\n", - "print(\"fault clearance time=%.4f ms\" %(t_c*10**3))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fault clearance time=0.6890 ms\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.17, Page No 176" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "V_s=math.sqrt(2)*230 #V\n", - "L=15*10**-6 #H\n", - "I=V_s/L #I=(di/dt)_max\n", - "R_s=10 #ohm\n", - "v=I*R_s #v=(dv/dt)_max\n", - "\n", - "#Calculations\n", - "f=50 #Hz\n", - "X_L=L*2*math.pi*f\n", - "R=2\n", - "I_max=V_s/(R+X_L) \n", - "FF=math.pi/math.sqrt(2)\n", - "I_TAV1=I_max/FF \n", - "FF=3.98184\n", - "I_TAV2=I_max/FF \n", - "\n", - "\n", - "#RESULTS\n", - "print(\"(di/dt)_max=%.3f A/usec\" %(I/10**6))\n", - "print(\"\\n(dv/dt)_max=%.2f V/usec\" %(v/10**6))\n", - "print(\"\\nI_rms=%.3f A\" %I_max)\n", - "print(\"when conduction angle=90\")\n", - "print(\"I_TAV=%.3f A\" %I_TAV1)\n", - "print(\"when conduction angle=30\")\n", - "print(\"I_TAV=%.3f A\" %I_TAV2)\n", - "print(\"\\nvoltage rating=%.3f V\" %(2.75*V_s)) #rating is taken 2.75 times of peak working voltage unlike 2.5 to 3 times as mentioned int book." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(di/dt)_max=21.685 A/usec\n", - "\n", - "(dv/dt)_max=216.85 V/usec\n", - "\n", - "I_rms=162.252 A\n", - "when conduction angle=90\n", - "I_TAV=73.039 A\n", - "when conduction angle=30\n", - "I_TAV=40.748 A\n", - "\n", - "voltage rating=894.490 V\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.19, Page No 186" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "T_jm=125\n", - "th_jc=.15 #degC/W\n", - "th_cs=0.075 #degC/W\n", - "\n", - "\n", - "#Calculations\n", - "dT=54 #dT=T_s-T_a\n", - "P_av=120\n", - "th_sa=dT/P_av\n", - "T_a=40 #ambient temp\n", - "P_av=(T_jm-T_a)/(th_sa+th_jc+th_cs)\n", - "if (P_av-120)<1 :\n", - " print(\"selection of heat sink is satisfactory\")\n", - "\n", - "dT=58 #dT=T_s-T_a\n", - "P_av=120\n", - "th_sa=dT/P_av\n", - "T_a=40 #ambient temp\n", - "P_av=(T_jm-T_a)/(th_sa+th_jc+th_cs)\n", - "if (P_av-120)<1 :\n", - " print(\"selection of heat sink is satisfactory\")\n", - "\n", - "V_m=math.sqrt(2)*230\n", - "R=2\n", - "I_TAV=V_m/(R*math.pi)\n", - "P_av=90\n", - "th_sa=(T_jm-T_a)/P_av-(th_jc+th_cs)\n", - "dT=P_av*th_sa\n", - "print(\"for heat sink\") \n", - "print(\"T_s-T_a=%.2f degC\" %dT) \n", - "print(\"\\nP_av=%.0f W\" %P_av)\n", - "P=(V_m/2)**2/R\n", - "eff=P/(P+P_av) \n", - "print(\"\\nckt efficiency=%.3f pu\" %eff)\n", - "a=60 #delay angle\n", - "I_TAV=(V_m/(2*math.pi*R))*(1+math.cos(math.radians(a)))\n", - "print(\"\\nI_TAV=%.2f A\" %I_TAV)\n", - "dT=46\n", - "T_s=dT+T_a\n", - "T_c=T_s+P_av*th_cs \n", - "T_j=T_c+P_av*th_jc \n", - "\n", - "#Results\n", - "print(\"\\ncase temp=%.2f degC\" %T_c)\n", - "print(\"\\njunction temp=%.2f degC\" %T_j)\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for heat sink\n", - "T_s-T_a=-20.25 degC\n", - "\n", - "P_av=90 W\n", - "\n", - "ckt efficiency=0.993 pu\n", - "\n", - "I_TAV=38.83 A\n", - "\n", - "case temp=92.75 degC\n", - "\n", - "junction temp=106.25 degC\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.20, Page No 187" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_j=125.0 #degC\n", - "T_s=70.0 #degC\n", - "th_jc=.16 #degC/W\n", - "th_cs=.08 #degC/W\n", - "\n", - "#Calculations\n", - "P_av1=(T_j-T_s)/(th_jc+th_cs) \n", - "\n", - "T_s=60 #degC\n", - "P_av2=(T_j-T_s)/(th_jc+th_cs) \n", - "inc=(math.sqrt(P_av2)-math.sqrt(P_av1))*100/math.sqrt(P_av1) \n", - "\n", - "#Results\n", - "print(\"Total avg power loss in thristor sink combination=%.2f W\" %P_av1)\n", - "print(\"Percentage inc in rating=%.2f\" %inc)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total avg power loss in thristor sink combination=229.17 W\n", - "Percentage inc in rating=8.71\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.21, Page No 197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "R=25000.0\n", - "I_l1=.021 #I_l=leakage current\n", - "I_l2=.025\n", - "I_l3=.018\n", - "I_l4=.016\n", - " #V1=(I-I_l1)*R\n", - " #V2=(I-I_l2)*R\n", - " #V3=(I-I_l3)*R\n", - " #V4=(I-I_l4)*R\n", - " #V=V1+V2+V3+V4\n", - " \n", - "#Calculations\n", - "V=10000.0\n", - "I_l=I_l1+I_l2+I_l3+I_l4\n", - " #after solving\n", - "I=((V/R)+I_l)/4\n", - "R_c=40.0\n", - "V1=(I-I_l1)*R \n", - "\n", - "#Resluts\n", - "print(\"voltage across SCR1=%.0f V\" %V1)\n", - "V2=(I-I_l2)*R \n", - "print(\"\\nvoltage across SCR2=%.0f V\" %V2)\n", - "V3=(I-I_l3)*R \n", - "print(\"\\nvoltage across SCR3=%.0f V\" %V3)\n", - "V4=(I-I_l4)*R \n", - "print(\"\\nvoltage across SCR4=%.0f V\" %V4)\n", - "\n", - "I1=V1/R_c \n", - "print(\"\\ndischarge current through SCR1=%.3f A\" %I1)\n", - "I2=V2/R_c \n", - "print(\"\\ndischarge current through SCR2=%.3f A\" %I2)\n", - "I3=V3/R_c \n", - "print(\"\\ndischarge current through SCR3=%.3f A\" %I3)\n", - "I4=V4/R_c \n", - "print(\"\\ndischarge current through SCR4=%.3f A\" %I4)\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "voltage across SCR1=2475 V\n", - "\n", - "voltage across SCR2=2375 V\n", - "\n", - "voltage across SCR3=2550 V\n", - "\n", - "voltage across SCR4=2600 V\n", - "\n", - "discharge current through SCR1=61.875 A\n", - "\n", - "discharge current through SCR2=59.375 A\n", - "\n", - "discharge current through SCR3=63.750 A\n", - "\n", - "discharge current through SCR4=65.000 A\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.22, Page No 198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_r=1000 #rating of SCR\n", - "I_r=200 #rating of SCR\n", - "V_s=6000 #rating of String\n", - "I_s=1000 #rating of String\n", - "\n", - "#Calculations\n", - "print(\"when DRF=.1\")\n", - "DRF=.1\n", - "n_s=V_s/(V_r*(1-DRF)) \n", - "print(\"number of series units=%.0f\" %math.ceil(n_s))\n", - "n_p=I_s/(I_r*(1-DRF)) \n", - "print(\"\\nnumber of parrallel units=%.0f\" %math.ceil(n_p))\n", - "print(\"when DRF=.2\")\n", - "DRF=.2\n", - "\n", - "#Results\n", - "n_s=V_s/(V_r*(1-DRF)) \n", - "print(\"number of series units=%.0f\" %math.ceil(n_s))\n", - "n_p=I_s/(I_r*(1-DRF)) \n", - "print(\"\\nnumber of parrallel units=%.0f\" %math.ceil(n_p))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when DRF=.1\n", - "number of series units=7\n", - "\n", - "number of parrallel units=6\n", - "when DRF=.2\n", - "number of series units=8\n", - "\n", - "number of parrallel units=7\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.23, Page No 198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V1=1.6 #on state voltage drop of SCR1\n", - "V2=1.2 #on state voltage drop of SCR2\n", - "I1=250.0 #current rating of SCR1\n", - "I2=350.0 #current rating of SCR2\n", - "\n", - "#Calculations\n", - "R1=V1/I1\n", - "R2=V2/I2\n", - "I=600.0 #current to be shared\n", - " #for SCR1 % I*(R1+R)/(total resistance)=k*I1 (1)\n", - " #for SCR2 % I*(R2+R)/(total resistance)=k*I2 (2)\n", - " #(1)/(2)\n", - "R=(R2*I2-R1*I1)/(I1-I2)\n", - "\n", - "\n", - "#Results\n", - "print(\"RSequired value of resistance=%.3f ohm\" %R)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "RSequired value of resistance=0.004 ohm\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.25, Page No 223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=2000.0 #Hz\n", - "C=0.04*10**-6\n", - "n=.72\n", - "\n", - "#Calculations\n", - "R=1/(f*C*math.log(1/(1-n))) \n", - "V_p=18\n", - "V_BB=V_p/n\n", - "R2=10**4/(n*V_BB) \n", - "I=4.2*10**-3 #leakage current\n", - "R_BB=5000\n", - "R1=(V_BB/I)-R2-R_BB\n", - "\n", - "#Results\n", - "print(\"R=%.2f kilo-ohm\" %(R/1000))\n", - "print(\"\\nR2=%.2f ohm\" %R2)\n", - "print(\"\\nR1=%.0f ohm\" %R1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R=9.82 kilo-ohm\n", - "\n", - "R2=555.56 ohm\n", - "\n", - "R1=397 ohm\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.26, Page No 223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "V_p=18.0\n", - "n=.72\n", - "V_BB=V_p/n\n", - "I_p=.6*10**-3\n", - "I_v=2.5*10**-3\n", - "V_v=1\n", - "\n", - "#Calculations\n", - "R_max=V_BB*(1-n)/I_p \n", - "print(\"R_max=%.2f kilo-ohm\" %(R_max/1000))\n", - "R_min=(V_BB-V_v)/I_v \n", - "print(\"\\nR_min=%.2f kilo-ohm\" %(R_min/1000))\n", - "\n", - "C=.04*10**-6\n", - "f_min=1/(R_max*C*math.log(1/(1-n))) \n", - "print(\"\\nf_min=%.3f kHz\" %(f_min/1000))\n", - "f_max=1/(R_min*C*math.log(1/(1-n))) \n", - "print(\"\\nf_max=%.2f kHz\" %(f_max/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R_max=11.67 kilo-ohm\n", - "\n", - "R_min=9.60 kilo-ohm\n", - "\n", - "f_min=1.683 kHz\n", - "\n", - "f_max=2.05 kHz\n" - ] - } - ], - "prompt_number": 17 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter4_4.ipynb b/_Power_Electronics/Chapter4_4.ipynb deleted file mode 100755 index 22311574..00000000 --- a/_Power_Electronics/Chapter4_4.ipynb +++ /dev/null @@ -1,946 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 04 : Thyristors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.3, Page No 149" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "P=.5 #P=V_g*I_g\n", - "s=130 #s=V_g/I_g\n", - "\n", - "#Calculations\n", - "I_g=math.sqrt(P/s)\n", - "V_g=s*I_g\n", - "E=15\n", - "R_s=(E-V_g)/I_g \n", - "\n", - "#Results\n", - "print(\"Gate source resistance=%.2f ohm\" %R_s)\n", - "#Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Gate source resistance=111.87 ohm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.4, Page No 149" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "R_s=120 #slope of load line is -120V/A. This gives gate source resistance\n", - "print(\"gate source resistance=%.0f ohm\" %R_s)\n", - "\n", - "P=.4 #P=V_g*I_g\n", - "E_s=15\n", - "\n", - "#Calculations\n", - " #E_s=I_g*R_s+V_g % after solving this\n", - " #120*I_g**2-15*I_g+0.4=0 so\n", - "a=120 \n", - "b=-15\n", - "c=0.4\n", - "D=math.sqrt((b**2)-4*a*c)\n", - "I_g=(-b+D)/(2*a) \n", - "V_g=P/I_g\n", - "\n", - "#Results\n", - "print(\"\\ntrigger current=%.2f mA\" %(I_g*10**3)) \n", - "print(\"\\nthen trigger voltage=%.3f V\" %V_g)\n", - "I_g=(-b-D)/(2*a) \n", - "V_g=P/I_g\n", - "print(\"\\ntrigger current=%.2f mA\" %(I_g*10**3)) \n", - "print(\"\\nthen trigger voltage=%.2f V\" %V_g)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "gate source resistance=120 ohm\n", - "\n", - "trigger current=86.44 mA\n", - "\n", - "then trigger voltage=4.628 V\n", - "\n", - "trigger current=38.56 mA\n", - "\n", - "then trigger voltage=10.37 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.5 Page No 150" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "#V_g=1+10*I_g\n", - "P_gm=5 #P_gm=V_g*I_g\n", - "#after solving % eqn becomes 10*I_g**2+I_g-5=0\n", - "a=10.0 \n", - "b=1.0 \n", - "c=-5\n", - "\n", - "#Calculations\n", - "I_g=(-b+math.sqrt(b**2-4*a*c))/(2*a)\n", - "E_s=15\n", - "#using E_s=R_s*I_g+V_g\n", - "R_s=(E_s-1)/I_g-10 \n", - "P_gav=.3 #W\n", - "T=20*10**-6\n", - "f=P_gav/(P_gm*T)\n", - "dl=f*T\n", - "\n", - "#Results\n", - "print(\"Reistance=%.3f ohm\" %R_s)\n", - "print(\"Triggering freq=%.0f kHz\" %(f/1000))\n", - "print(\"Tduty cycle=%.2f\" %dl)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Reistance=11.248 ohm\n", - "Triggering freq=3 kHz\n", - "Tduty cycle=0.06\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.6, Page No 151" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I=.1\n", - "E=200.0\n", - "L=0.2\n", - "\n", - "#Calculations\n", - "t=I*L/E \n", - "R=20.0\n", - "t1=(-L/R)*math.log(1-(R*I/E)) \n", - "L=2.0\n", - "t2=(-L/R)*math.log(1-(R*I/E)) \n", - "\n", - "#Results\n", - "print(\"in case load consists of (a)L=.2H\")\n", - "print(\"min gate pulse width=%.0f us\" %(t*10**6))\n", - "print(\"(b)R=20ohm in series with L=.2H\")\n", - "print(\"min gate pulse width=%.3f us\" %(t1*10**6))\n", - "print(\"(c)R=20ohm in series with L=2H\")\n", - "print(\"min gate pulse width=%.2f us\" %(t2*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "in case load consists of (a)L=.2H\n", - "min gate pulse width=100 us\n", - "(b)R=20ohm in series with L=.2H\n", - "min gate pulse width=100.503 us\n", - "(c)R=20ohm in series with L=2H\n", - "min gate pulse width=1005.03 us\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.9 Page No 163" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "def theta(th):\n", - " I_m=1 #supposition\n", - " I_av=(I_m/(2*math.pi))*(1+math.cos(math.radians(th)))\n", - " I_rms=math.sqrt((I_m/(2*math.pi))*((180-th)*math.pi/360+.25*math.sin(math.radians(2*th))))\n", - " FF=I_rms/I_av\n", - " I_rms=35\n", - " I_TAV=I_rms/FF\n", - " return I_TAV\n", - "\n", - "#Calculations\n", - "print(\"when conduction angle=180\")\n", - "th=0\n", - "I_TAV=theta(th)\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=90\")\n", - "th=90\n", - "I_TAV=theta(th)\n", - "\n", - "#Results\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=30\")\n", - "th=150\n", - "I_TAV=theta(th)\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when conduction angle=180\n", - "avg on current rating=22.282 A\n", - "when conduction angle=90\n", - "avg on current rating=15.756 A\n", - "when conduction angle=30\n", - "avg on current rating=8.790 A\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.10, Page No 164" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "def theta(th):\n", - " n=360.0/th\n", - " I=1.0 #supposition\n", - " I_av=I/n\n", - " I_rms=I/math.sqrt(n)\n", - " FF=I_rms/I_av\n", - " I_rms=35\n", - " I_TAV=I_rms/FF\n", - " return I_TAV\n", - "\n", - "#Calculations\n", - "th=180.0\n", - "I_TAV1=theta(th)\n", - "th=90.0\n", - "I_TAV2=theta(th)\n", - "th=30.0\n", - "I_TAV3=theta(th)\n", - "\n", - "#Results\n", - "print(\"when conduction angle=180\")\n", - "print(\"avg on current rating=%.3f A\" %I_TAV)\n", - "print(\"when conduction angle=90\")\n", - "print(\"avg on current rating=%.1f A\" %I_TAV2)\n", - "print(\"when conduction angle=30\")\n", - "print(\"avg on current rating=%.4f A\" %I_TAV3)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when conduction angle=180\n", - "avg on current rating=8.790 A\n", - "when conduction angle=90\n", - "avg on current rating=17.5 A\n", - "when conduction angle=30\n", - "avg on current rating=10.1036 A\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.11 Page No 165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "f=50.0 #Hz\n", - "\n", - "#Calculations\n", - "I_sb=3000.0\n", - "t=1/(4*f)\n", - "T=1/(2*f)\n", - "I=math.sqrt(I_sb**2*t/T) \n", - "r=(I_sb/math.sqrt(2))**2*T \n", - "\n", - "#Results\n", - "print(\"surge current rating=%.2f A\" %I)\n", - "print(\"\\nI**2*t rating=%.0f A^2.s\" %r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "surge current rating=2121.32 A\n", - "\n", - "I**2*t rating=45000 A^2.s\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.12 Page No 165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "V_s=300.0 #V\n", - "R=60.0 #ohm\n", - "L=2.0 #H\n", - "\n", - "#Calculations\n", - "t=40*10**-6 #s\n", - "i_T=(V_s/R)*(1-math.exp(-R*t/L))\n", - "i=.036 #A\n", - "R1=V_s/(i-i_T)\n", - "\n", - "#Results\n", - "print(\"maximum value of remedial parameter=%.3f kilo-ohm\" %(R1/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "maximum value of remedial parameter=9.999 kilo-ohm\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.16 Page No 172" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_p=230.0*math.sqrt(2)\n", - "\n", - "#Calculations\n", - "R=1+((1)**-1+(10)**-1)**-1\n", - "A=V_p/R\n", - "s=1 #s\n", - "t_c=20*A**-2*s\n", - "\n", - "#Results\n", - "print(\"fault clearance time=%.4f ms\" %(t_c*10**3))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fault clearance time=0.6890 ms\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.17, Page No 176" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "V_s=math.sqrt(2)*230 #V\n", - "L=15*10**-6 #H\n", - "I=V_s/L #I=(di/dt)_max\n", - "R_s=10 #ohm\n", - "v=I*R_s #v=(dv/dt)_max\n", - "\n", - "#Calculations\n", - "f=50 #Hz\n", - "X_L=L*2*math.pi*f\n", - "R=2\n", - "I_max=V_s/(R+X_L) \n", - "FF=math.pi/math.sqrt(2)\n", - "I_TAV1=I_max/FF \n", - "FF=3.98184\n", - "I_TAV2=I_max/FF \n", - "\n", - "\n", - "#RESULTS\n", - "print(\"(di/dt)_max=%.3f A/usec\" %(I/10**6))\n", - "print(\"\\n(dv/dt)_max=%.2f V/usec\" %(v/10**6))\n", - "print(\"\\nI_rms=%.3f A\" %I_max)\n", - "print(\"when conduction angle=90\")\n", - "print(\"I_TAV=%.3f A\" %I_TAV1)\n", - "print(\"when conduction angle=30\")\n", - "print(\"I_TAV=%.3f A\" %I_TAV2)\n", - "print(\"\\nvoltage rating=%.3f V\" %(2.75*V_s)) #rating is taken 2.75 times of peak working voltage unlike 2.5 to 3 times as mentioned int book." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(di/dt)_max=21.685 A/usec\n", - "\n", - "(dv/dt)_max=216.85 V/usec\n", - "\n", - "I_rms=162.252 A\n", - "when conduction angle=90\n", - "I_TAV=73.039 A\n", - "when conduction angle=30\n", - "I_TAV=40.748 A\n", - "\n", - "voltage rating=894.490 V\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.19, Page No 186" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "T_jm=125\n", - "th_jc=.15 #degC/W\n", - "th_cs=0.075 #degC/W\n", - "\n", - "\n", - "#Calculations\n", - "dT=54 #dT=T_s-T_a\n", - "P_av=120\n", - "th_sa=dT/P_av\n", - "T_a=40 #ambient temp\n", - "P_av=(T_jm-T_a)/(th_sa+th_jc+th_cs)\n", - "if (P_av-120)<1 :\n", - " print(\"selection of heat sink is satisfactory\")\n", - "\n", - "dT=58 #dT=T_s-T_a\n", - "P_av=120\n", - "th_sa=dT/P_av\n", - "T_a=40 #ambient temp\n", - "P_av=(T_jm-T_a)/(th_sa+th_jc+th_cs)\n", - "if (P_av-120)<1 :\n", - " print(\"selection of heat sink is satisfactory\")\n", - "\n", - "V_m=math.sqrt(2)*230\n", - "R=2\n", - "I_TAV=V_m/(R*math.pi)\n", - "P_av=90\n", - "th_sa=(T_jm-T_a)/P_av-(th_jc+th_cs)\n", - "dT=P_av*th_sa\n", - "print(\"for heat sink\") \n", - "print(\"T_s-T_a=%.2f degC\" %dT) \n", - "print(\"\\nP_av=%.0f W\" %P_av)\n", - "P=(V_m/2)**2/R\n", - "eff=P/(P+P_av) \n", - "print(\"\\nckt efficiency=%.3f pu\" %eff)\n", - "a=60 #delay angle\n", - "I_TAV=(V_m/(2*math.pi*R))*(1+math.cos(math.radians(a)))\n", - "print(\"\\nI_TAV=%.2f A\" %I_TAV)\n", - "dT=46\n", - "T_s=dT+T_a\n", - "T_c=T_s+P_av*th_cs \n", - "T_j=T_c+P_av*th_jc \n", - "\n", - "#Results\n", - "print(\"\\ncase temp=%.2f degC\" %T_c)\n", - "print(\"\\njunction temp=%.2f degC\" %T_j)\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for heat sink\n", - "T_s-T_a=-20.25 degC\n", - "\n", - "P_av=90 W\n", - "\n", - "ckt efficiency=0.993 pu\n", - "\n", - "I_TAV=38.83 A\n", - "\n", - "case temp=92.75 degC\n", - "\n", - "junction temp=106.25 degC\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.20, Page No 187" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_j=125.0 #degC\n", - "T_s=70.0 #degC\n", - "th_jc=.16 #degC/W\n", - "th_cs=.08 #degC/W\n", - "\n", - "#Calculations\n", - "P_av1=(T_j-T_s)/(th_jc+th_cs) \n", - "\n", - "T_s=60 #degC\n", - "P_av2=(T_j-T_s)/(th_jc+th_cs) \n", - "inc=(math.sqrt(P_av2)-math.sqrt(P_av1))*100/math.sqrt(P_av1) \n", - "\n", - "#Results\n", - "print(\"Total avg power loss in thristor sink combination=%.2f W\" %P_av1)\n", - "print(\"Percentage inc in rating=%.2f\" %inc)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total avg power loss in thristor sink combination=229.17 W\n", - "Percentage inc in rating=8.71\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.21, Page No 197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "R=25000.0\n", - "I_l1=.021 #I_l=leakage current\n", - "I_l2=.025\n", - "I_l3=.018\n", - "I_l4=.016\n", - " #V1=(I-I_l1)*R\n", - " #V2=(I-I_l2)*R\n", - " #V3=(I-I_l3)*R\n", - " #V4=(I-I_l4)*R\n", - " #V=V1+V2+V3+V4\n", - " \n", - "#Calculations\n", - "V=10000.0\n", - "I_l=I_l1+I_l2+I_l3+I_l4\n", - " #after solving\n", - "I=((V/R)+I_l)/4\n", - "R_c=40.0\n", - "V1=(I-I_l1)*R \n", - "\n", - "#Resluts\n", - "print(\"voltage across SCR1=%.0f V\" %V1)\n", - "V2=(I-I_l2)*R \n", - "print(\"\\nvoltage across SCR2=%.0f V\" %V2)\n", - "V3=(I-I_l3)*R \n", - "print(\"\\nvoltage across SCR3=%.0f V\" %V3)\n", - "V4=(I-I_l4)*R \n", - "print(\"\\nvoltage across SCR4=%.0f V\" %V4)\n", - "\n", - "I1=V1/R_c \n", - "print(\"\\ndischarge current through SCR1=%.3f A\" %I1)\n", - "I2=V2/R_c \n", - "print(\"\\ndischarge current through SCR2=%.3f A\" %I2)\n", - "I3=V3/R_c \n", - "print(\"\\ndischarge current through SCR3=%.3f A\" %I3)\n", - "I4=V4/R_c \n", - "print(\"\\ndischarge current through SCR4=%.3f A\" %I4)\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "voltage across SCR1=2475 V\n", - "\n", - "voltage across SCR2=2375 V\n", - "\n", - "voltage across SCR3=2550 V\n", - "\n", - "voltage across SCR4=2600 V\n", - "\n", - "discharge current through SCR1=61.875 A\n", - "\n", - "discharge current through SCR2=59.375 A\n", - "\n", - "discharge current through SCR3=63.750 A\n", - "\n", - "discharge current through SCR4=65.000 A\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.22, Page No 198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_r=1000 #rating of SCR\n", - "I_r=200 #rating of SCR\n", - "V_s=6000 #rating of String\n", - "I_s=1000 #rating of String\n", - "\n", - "#Calculations\n", - "print(\"when DRF=.1\")\n", - "DRF=.1\n", - "n_s=V_s/(V_r*(1-DRF)) \n", - "print(\"number of series units=%.0f\" %math.ceil(n_s))\n", - "n_p=I_s/(I_r*(1-DRF)) \n", - "print(\"\\nnumber of parrallel units=%.0f\" %math.ceil(n_p))\n", - "print(\"when DRF=.2\")\n", - "DRF=.2\n", - "\n", - "#Results\n", - "n_s=V_s/(V_r*(1-DRF)) \n", - "print(\"number of series units=%.0f\" %math.ceil(n_s))\n", - "n_p=I_s/(I_r*(1-DRF)) \n", - "print(\"\\nnumber of parrallel units=%.0f\" %math.ceil(n_p))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when DRF=.1\n", - "number of series units=7\n", - "\n", - "number of parrallel units=6\n", - "when DRF=.2\n", - "number of series units=8\n", - "\n", - "number of parrallel units=7\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.23, Page No 198" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V1=1.6 #on state voltage drop of SCR1\n", - "V2=1.2 #on state voltage drop of SCR2\n", - "I1=250.0 #current rating of SCR1\n", - "I2=350.0 #current rating of SCR2\n", - "\n", - "#Calculations\n", - "R1=V1/I1\n", - "R2=V2/I2\n", - "I=600.0 #current to be shared\n", - " #for SCR1 % I*(R1+R)/(total resistance)=k*I1 (1)\n", - " #for SCR2 % I*(R2+R)/(total resistance)=k*I2 (2)\n", - " #(1)/(2)\n", - "R=(R2*I2-R1*I1)/(I1-I2)\n", - "\n", - "\n", - "#Results\n", - "print(\"RSequired value of resistance=%.3f ohm\" %R)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "RSequired value of resistance=0.004 ohm\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.25, Page No 223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=2000.0 #Hz\n", - "C=0.04*10**-6\n", - "n=.72\n", - "\n", - "#Calculations\n", - "R=1/(f*C*math.log(1/(1-n))) \n", - "V_p=18\n", - "V_BB=V_p/n\n", - "R2=10**4/(n*V_BB) \n", - "I=4.2*10**-3 #leakage current\n", - "R_BB=5000\n", - "R1=(V_BB/I)-R2-R_BB\n", - "\n", - "#Results\n", - "print(\"R=%.2f kilo-ohm\" %(R/1000))\n", - "print(\"\\nR2=%.2f ohm\" %R2)\n", - "print(\"\\nR1=%.0f ohm\" %R1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R=9.82 kilo-ohm\n", - "\n", - "R2=555.56 ohm\n", - "\n", - "R1=397 ohm\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 4.26, Page No 223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "\n", - "V_p=18.0\n", - "n=.72\n", - "V_BB=V_p/n\n", - "I_p=.6*10**-3\n", - "I_v=2.5*10**-3\n", - "V_v=1\n", - "\n", - "#Calculations\n", - "R_max=V_BB*(1-n)/I_p \n", - "print(\"R_max=%.2f kilo-ohm\" %(R_max/1000))\n", - "R_min=(V_BB-V_v)/I_v \n", - "print(\"\\nR_min=%.2f kilo-ohm\" %(R_min/1000))\n", - "\n", - "C=.04*10**-6\n", - "f_min=1/(R_max*C*math.log(1/(1-n))) \n", - "print(\"\\nf_min=%.3f kHz\" %(f_min/1000))\n", - "f_max=1/(R_min*C*math.log(1/(1-n))) \n", - "print(\"\\nf_max=%.2f kHz\" %(f_max/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R_max=11.67 kilo-ohm\n", - "\n", - "R_min=9.60 kilo-ohm\n", - "\n", - "f_min=1.683 kHz\n", - "\n", - "f_max=2.05 kHz\n" - ] - } - ], - "prompt_number": 17 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter5.ipynb b/_Power_Electronics/Chapter5.ipynb deleted file mode 100755 index 1d261f20..00000000 --- a/_Power_Electronics/Chapter5.ipynb +++ /dev/null @@ -1,511 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 05 : Thyristor Commutation Techniques" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.1, Page No 252" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=5.0*10**-3 #mH\n", - "C=20.0*10**-6 #\u00b5F\n", - "V_s=200 #V\n", - "\n", - "#Calculations\n", - "w_o=math.sqrt(1/(L*C)) #rad/s\n", - "t_o=math.pi/w_o #ms\n", - "\n", - "#Results\n", - "print('conduction time of thyristor = %.2f ms' %(t_o*1000))\n", - "print('voltage across thyristor=%.0f V' %V_s)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of thyristor = 0.99 ms\n", - "voltage across thyristor=200 V\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.2, Page No 255" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "C=20.0*10**-6 #\u00b5F\n", - "L=5.0*10**-6 #\u00b5H\n", - "V_s=230.0 #V\n", - "\n", - "#Calculations\n", - "I_p=V_s*math.sqrt(C/L) #A\n", - "w_o=math.sqrt(1/(L*C)) #rad/sec\n", - "t_o=math.pi/w_o #\u00b5S\n", - "I_o=300 \n", - "a = math.degrees(math.asin(I_o/(2*V_s))) \n", - "V_ab = V_s*math.cos(math.radians(a)) #V \n", - "t_c=C*V_ab/I_o #\u00b5s\n", - "\n", - "#Calculations\n", - "print(\"conduction time of auxillery thyristor=%.2f us\" %(t_o*10**6))\n", - "print(\"voltage across main thyristor=%.2f V\" %V_ab)\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of auxillery thyristor=31.42 us\n", - "voltage across main thyristor=174.36 V\n", - "ckt turn off time=11.62 us\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.3 Page No 258" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "R1=10.0 #\u2126\n", - "R2=100.0 #\u2126\n", - "C=0 # value of capacitor\n", - "\n", - "#Calculations\n", - "I1=V_s*(1/R1+2/R2) #A\n", - "I2=V_s*(2/R1+1/R2) #A\n", - "t_c1=40*10**-6\n", - "fos=2 #factor of safety\n", - "C1=t_c1*fos/(R1*math.log(2))\n", - "C2=t_c1*fos/(R2*math.log(2))\n", - "if C1 > C2 :\n", - " C = C1*10**6\n", - "else :\n", - " C = C2*10**6\n", - "\n", - "\n", - "#Results\n", - "print(\"peak value of current through SCR1=%.2f A\" %I1); \n", - "print(\"Peak value of current through SCR2=%.2f A\" %I2);\n", - "print(\"Value of capacitor=%.2f uF\" %C);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak value of current through SCR1=24.00 A\n", - "Peak value of current through SCR2=42.00 A\n", - "Value of capacitor=11.54 uF\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.4, Page No 260" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "L=20*10**-6 #\u00b5H\n", - "C=40*10**-6 #\u00b5F\n", - "I_o=120.0 #A\n", - "\n", - "#Calculations\n", - "I_p=V_s*math.sqrt(C/L) #A\n", - "t_c=C*V_s/I_o #\u00b5s\n", - "w_o=math.sqrt(1/(L*C)) \n", - "t_c1=math.pi/(2*w_o) #\u00b5s\n", - "\n", - "#Results\n", - "print(\"current through main thyristor=%.2f A\" %(I_o+I_p))\n", - "print(\"Current through auxillery thyristor=%.2f A\" %I_o)\n", - "print(\"Circuit turn off time for main thyristor=%.2f us\" %(t_c*10**6))\n", - "print(\"Circuit turn off time for auxillery thyristor=%.2f us\" %(t_c1*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current through main thyristor=445.27 A\n", - "Current through auxillery thyristor=120.00 A\n", - "Circuit turn off time for main thyristor=76.67 us\n", - "Circuit turn off time for auxillery thyristor=44.43 us\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.5 Page No 263" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "C_j=25*10**-12 #pF\n", - "I_c=5*10**-3 #charging current\n", - "V_s=200.0 #V\n", - "R=50.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=(C_j*V_s)/(I_c*R)\n", - "\n", - "\n", - "#RESULTS\n", - "print(\"Value of C=%.2f \u00b5F\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of C=0.02 \u00b5F\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.6 Page No 263" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "R=5.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=10.0*10**-6\n", - "#for turn off V_s*(1-2*exp(-t/(R*C)))=0, so after solving\n", - "t_c=R*C*math.log(2.0)\n", - "\n", - "#Results\n", - "print(\"circuit turn off time=%.2f us\" %(t_c*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "circuit turn off time=34.66 us\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.7, Page No 264 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=1.0 #\u2126\n", - "L=20*10**-6 #\u00b5H\n", - "C=40*10**-6 #\u00b5F\n", - "\n", - "#Calculations\n", - "w_r=math.sqrt((1/(L*C))-(R/(2*L))**2)\n", - "t_1=math.pi/w_r\n", - "\n", - "#Results\n", - "print(\"conduction time of thyristor=%.3f us\" %(t_1*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of thyristor=125.664 us\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.8 Page No 265" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "dv=400*10.0**-6 #dv=dv_T/dt(V/s)\n", - "V_s=200.0 #v\n", - "R=20.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=V_s/(R*dv) \n", - "C_j=.025*10**-12\n", - "C_s=C-C_j\n", - "I_T=40;\n", - "R_s=1/((I_T/V_s)-(1/R)) \n", - "#value of R_s in book is wrongly calculated\n", - "\n", - "#Results\n", - "print(\"R_s=%.2f ohm\" %R_s)\n", - "print(\"C_s=%.3f uF\" %(C_s/10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R_s=6.67 ohm\n", - "C_s=0.025 uF\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.9 Page No 265" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "C=20.0*10**-6 #\u00b5H \n", - "L=0.2*10**-3 #\u00b5F\n", - "i_c=10.0\n", - "\n", - "#Calculations\n", - "i=V_s*math.sqrt(C/L)\n", - "w_o=1.0/math.sqrt(L*C)\n", - "t_1 = (1/w_o)*math.degrees(math.asin(i_c/i))\n", - "t_o=math.pi/w_o\n", - "t_c=t_o-2*t_1 \n", - "\n", - "#Results\n", - "print(\"reqd time=%.2f us\" %(t_1*10**6))\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n", - "print(\"ckt turn off time=%.5f us\" %t_1)\n", - "#solution in book wrong, as wrong values are selected while filling the formuleas" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "reqd time=575.37 us\n", - "ckt turn off time=-952.05 us\n", - "ckt turn off time=0.00058 us\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.11 Page No 268 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "L=1.0 #\u00b5H\n", - "R=50.0 #\u2126\n", - "V_s=200.0 #V\n", - "t=0.01 #sec\n", - "Vd=0.7\n", - "\n", - "#Calculations\n", - "tau=L/R\n", - "i=(V_s/R)*(1-math.exp(-t/tau))\n", - "t=8*10**-3\n", - "i1=i-t*Vd \n", - "\n", - "\n", - "#Results\n", - "print(\"current through L = %.2f A\" %i1)\n", - "i_R=0 #current in R at t=.008s\n", - "print(\"Current through R = %.2f A\" %i_R)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current through L = 1.57 A\n", - "Current through R = 0.00 A\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.12, Page No 269" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "#initialisation of variables\n", - "L=1.0 #H\n", - "R=50.0 #ohm\n", - "V_s=200.0 #V\n", - "\n", - "#Calculations\n", - "tau=L/R\n", - "t=0.01 #s\n", - "i=(V_s/R)*(1-math.exp(-t/tau))\n", - "C=1*10**-6 #F\n", - "V_c=math.sqrt(L/C)*i\n", - "\n", - "#Results\n", - "print(\"current in R,L=%.2f A\" %i)\n", - "print(\"voltage across C=%.2f kV\" %(V_c/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current in R,L=1.57 A\n", - "voltage across C=1.57 kV\n" - ] - } - ], - "prompt_number": 22 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter5_1.ipynb b/_Power_Electronics/Chapter5_1.ipynb deleted file mode 100755 index 1d261f20..00000000 --- a/_Power_Electronics/Chapter5_1.ipynb +++ /dev/null @@ -1,511 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 05 : Thyristor Commutation Techniques" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.1, Page No 252" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=5.0*10**-3 #mH\n", - "C=20.0*10**-6 #\u00b5F\n", - "V_s=200 #V\n", - "\n", - "#Calculations\n", - "w_o=math.sqrt(1/(L*C)) #rad/s\n", - "t_o=math.pi/w_o #ms\n", - "\n", - "#Results\n", - "print('conduction time of thyristor = %.2f ms' %(t_o*1000))\n", - "print('voltage across thyristor=%.0f V' %V_s)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of thyristor = 0.99 ms\n", - "voltage across thyristor=200 V\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.2, Page No 255" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "C=20.0*10**-6 #\u00b5F\n", - "L=5.0*10**-6 #\u00b5H\n", - "V_s=230.0 #V\n", - "\n", - "#Calculations\n", - "I_p=V_s*math.sqrt(C/L) #A\n", - "w_o=math.sqrt(1/(L*C)) #rad/sec\n", - "t_o=math.pi/w_o #\u00b5S\n", - "I_o=300 \n", - "a = math.degrees(math.asin(I_o/(2*V_s))) \n", - "V_ab = V_s*math.cos(math.radians(a)) #V \n", - "t_c=C*V_ab/I_o #\u00b5s\n", - "\n", - "#Calculations\n", - "print(\"conduction time of auxillery thyristor=%.2f us\" %(t_o*10**6))\n", - "print(\"voltage across main thyristor=%.2f V\" %V_ab)\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of auxillery thyristor=31.42 us\n", - "voltage across main thyristor=174.36 V\n", - "ckt turn off time=11.62 us\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.3 Page No 258" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "R1=10.0 #\u2126\n", - "R2=100.0 #\u2126\n", - "C=0 # value of capacitor\n", - "\n", - "#Calculations\n", - "I1=V_s*(1/R1+2/R2) #A\n", - "I2=V_s*(2/R1+1/R2) #A\n", - "t_c1=40*10**-6\n", - "fos=2 #factor of safety\n", - "C1=t_c1*fos/(R1*math.log(2))\n", - "C2=t_c1*fos/(R2*math.log(2))\n", - "if C1 > C2 :\n", - " C = C1*10**6\n", - "else :\n", - " C = C2*10**6\n", - "\n", - "\n", - "#Results\n", - "print(\"peak value of current through SCR1=%.2f A\" %I1); \n", - "print(\"Peak value of current through SCR2=%.2f A\" %I2);\n", - "print(\"Value of capacitor=%.2f uF\" %C);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak value of current through SCR1=24.00 A\n", - "Peak value of current through SCR2=42.00 A\n", - "Value of capacitor=11.54 uF\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.4, Page No 260" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "L=20*10**-6 #\u00b5H\n", - "C=40*10**-6 #\u00b5F\n", - "I_o=120.0 #A\n", - "\n", - "#Calculations\n", - "I_p=V_s*math.sqrt(C/L) #A\n", - "t_c=C*V_s/I_o #\u00b5s\n", - "w_o=math.sqrt(1/(L*C)) \n", - "t_c1=math.pi/(2*w_o) #\u00b5s\n", - "\n", - "#Results\n", - "print(\"current through main thyristor=%.2f A\" %(I_o+I_p))\n", - "print(\"Current through auxillery thyristor=%.2f A\" %I_o)\n", - "print(\"Circuit turn off time for main thyristor=%.2f us\" %(t_c*10**6))\n", - "print(\"Circuit turn off time for auxillery thyristor=%.2f us\" %(t_c1*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current through main thyristor=445.27 A\n", - "Current through auxillery thyristor=120.00 A\n", - "Circuit turn off time for main thyristor=76.67 us\n", - "Circuit turn off time for auxillery thyristor=44.43 us\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.5 Page No 263" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "C_j=25*10**-12 #pF\n", - "I_c=5*10**-3 #charging current\n", - "V_s=200.0 #V\n", - "R=50.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=(C_j*V_s)/(I_c*R)\n", - "\n", - "\n", - "#RESULTS\n", - "print(\"Value of C=%.2f \u00b5F\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of C=0.02 \u00b5F\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.6 Page No 263" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "R=5.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=10.0*10**-6\n", - "#for turn off V_s*(1-2*exp(-t/(R*C)))=0, so after solving\n", - "t_c=R*C*math.log(2.0)\n", - "\n", - "#Results\n", - "print(\"circuit turn off time=%.2f us\" %(t_c*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "circuit turn off time=34.66 us\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.7, Page No 264 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=1.0 #\u2126\n", - "L=20*10**-6 #\u00b5H\n", - "C=40*10**-6 #\u00b5F\n", - "\n", - "#Calculations\n", - "w_r=math.sqrt((1/(L*C))-(R/(2*L))**2)\n", - "t_1=math.pi/w_r\n", - "\n", - "#Results\n", - "print(\"conduction time of thyristor=%.3f us\" %(t_1*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of thyristor=125.664 us\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.8 Page No 265" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "dv=400*10.0**-6 #dv=dv_T/dt(V/s)\n", - "V_s=200.0 #v\n", - "R=20.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=V_s/(R*dv) \n", - "C_j=.025*10**-12\n", - "C_s=C-C_j\n", - "I_T=40;\n", - "R_s=1/((I_T/V_s)-(1/R)) \n", - "#value of R_s in book is wrongly calculated\n", - "\n", - "#Results\n", - "print(\"R_s=%.2f ohm\" %R_s)\n", - "print(\"C_s=%.3f uF\" %(C_s/10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R_s=6.67 ohm\n", - "C_s=0.025 uF\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.9 Page No 265" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "C=20.0*10**-6 #\u00b5H \n", - "L=0.2*10**-3 #\u00b5F\n", - "i_c=10.0\n", - "\n", - "#Calculations\n", - "i=V_s*math.sqrt(C/L)\n", - "w_o=1.0/math.sqrt(L*C)\n", - "t_1 = (1/w_o)*math.degrees(math.asin(i_c/i))\n", - "t_o=math.pi/w_o\n", - "t_c=t_o-2*t_1 \n", - "\n", - "#Results\n", - "print(\"reqd time=%.2f us\" %(t_1*10**6))\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n", - "print(\"ckt turn off time=%.5f us\" %t_1)\n", - "#solution in book wrong, as wrong values are selected while filling the formuleas" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "reqd time=575.37 us\n", - "ckt turn off time=-952.05 us\n", - "ckt turn off time=0.00058 us\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.11 Page No 268 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "L=1.0 #\u00b5H\n", - "R=50.0 #\u2126\n", - "V_s=200.0 #V\n", - "t=0.01 #sec\n", - "Vd=0.7\n", - "\n", - "#Calculations\n", - "tau=L/R\n", - "i=(V_s/R)*(1-math.exp(-t/tau))\n", - "t=8*10**-3\n", - "i1=i-t*Vd \n", - "\n", - "\n", - "#Results\n", - "print(\"current through L = %.2f A\" %i1)\n", - "i_R=0 #current in R at t=.008s\n", - "print(\"Current through R = %.2f A\" %i_R)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current through L = 1.57 A\n", - "Current through R = 0.00 A\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.12, Page No 269" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "#initialisation of variables\n", - "L=1.0 #H\n", - "R=50.0 #ohm\n", - "V_s=200.0 #V\n", - "\n", - "#Calculations\n", - "tau=L/R\n", - "t=0.01 #s\n", - "i=(V_s/R)*(1-math.exp(-t/tau))\n", - "C=1*10**-6 #F\n", - "V_c=math.sqrt(L/C)*i\n", - "\n", - "#Results\n", - "print(\"current in R,L=%.2f A\" %i)\n", - "print(\"voltage across C=%.2f kV\" %(V_c/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current in R,L=1.57 A\n", - "voltage across C=1.57 kV\n" - ] - } - ], - "prompt_number": 22 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter5_2.ipynb b/_Power_Electronics/Chapter5_2.ipynb deleted file mode 100755 index 1d261f20..00000000 --- a/_Power_Electronics/Chapter5_2.ipynb +++ /dev/null @@ -1,511 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 05 : Thyristor Commutation Techniques" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.1, Page No 252" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=5.0*10**-3 #mH\n", - "C=20.0*10**-6 #\u00b5F\n", - "V_s=200 #V\n", - "\n", - "#Calculations\n", - "w_o=math.sqrt(1/(L*C)) #rad/s\n", - "t_o=math.pi/w_o #ms\n", - "\n", - "#Results\n", - "print('conduction time of thyristor = %.2f ms' %(t_o*1000))\n", - "print('voltage across thyristor=%.0f V' %V_s)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of thyristor = 0.99 ms\n", - "voltage across thyristor=200 V\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.2, Page No 255" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "C=20.0*10**-6 #\u00b5F\n", - "L=5.0*10**-6 #\u00b5H\n", - "V_s=230.0 #V\n", - "\n", - "#Calculations\n", - "I_p=V_s*math.sqrt(C/L) #A\n", - "w_o=math.sqrt(1/(L*C)) #rad/sec\n", - "t_o=math.pi/w_o #\u00b5S\n", - "I_o=300 \n", - "a = math.degrees(math.asin(I_o/(2*V_s))) \n", - "V_ab = V_s*math.cos(math.radians(a)) #V \n", - "t_c=C*V_ab/I_o #\u00b5s\n", - "\n", - "#Calculations\n", - "print(\"conduction time of auxillery thyristor=%.2f us\" %(t_o*10**6))\n", - "print(\"voltage across main thyristor=%.2f V\" %V_ab)\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of auxillery thyristor=31.42 us\n", - "voltage across main thyristor=174.36 V\n", - "ckt turn off time=11.62 us\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.3 Page No 258" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "R1=10.0 #\u2126\n", - "R2=100.0 #\u2126\n", - "C=0 # value of capacitor\n", - "\n", - "#Calculations\n", - "I1=V_s*(1/R1+2/R2) #A\n", - "I2=V_s*(2/R1+1/R2) #A\n", - "t_c1=40*10**-6\n", - "fos=2 #factor of safety\n", - "C1=t_c1*fos/(R1*math.log(2))\n", - "C2=t_c1*fos/(R2*math.log(2))\n", - "if C1 > C2 :\n", - " C = C1*10**6\n", - "else :\n", - " C = C2*10**6\n", - "\n", - "\n", - "#Results\n", - "print(\"peak value of current through SCR1=%.2f A\" %I1); \n", - "print(\"Peak value of current through SCR2=%.2f A\" %I2);\n", - "print(\"Value of capacitor=%.2f uF\" %C);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak value of current through SCR1=24.00 A\n", - "Peak value of current through SCR2=42.00 A\n", - "Value of capacitor=11.54 uF\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.4, Page No 260" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "L=20*10**-6 #\u00b5H\n", - "C=40*10**-6 #\u00b5F\n", - "I_o=120.0 #A\n", - "\n", - "#Calculations\n", - "I_p=V_s*math.sqrt(C/L) #A\n", - "t_c=C*V_s/I_o #\u00b5s\n", - "w_o=math.sqrt(1/(L*C)) \n", - "t_c1=math.pi/(2*w_o) #\u00b5s\n", - "\n", - "#Results\n", - "print(\"current through main thyristor=%.2f A\" %(I_o+I_p))\n", - "print(\"Current through auxillery thyristor=%.2f A\" %I_o)\n", - "print(\"Circuit turn off time for main thyristor=%.2f us\" %(t_c*10**6))\n", - "print(\"Circuit turn off time for auxillery thyristor=%.2f us\" %(t_c1*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current through main thyristor=445.27 A\n", - "Current through auxillery thyristor=120.00 A\n", - "Circuit turn off time for main thyristor=76.67 us\n", - "Circuit turn off time for auxillery thyristor=44.43 us\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.5 Page No 263" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "C_j=25*10**-12 #pF\n", - "I_c=5*10**-3 #charging current\n", - "V_s=200.0 #V\n", - "R=50.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=(C_j*V_s)/(I_c*R)\n", - "\n", - "\n", - "#RESULTS\n", - "print(\"Value of C=%.2f \u00b5F\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of C=0.02 \u00b5F\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.6 Page No 263" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "R=5.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=10.0*10**-6\n", - "#for turn off V_s*(1-2*exp(-t/(R*C)))=0, so after solving\n", - "t_c=R*C*math.log(2.0)\n", - "\n", - "#Results\n", - "print(\"circuit turn off time=%.2f us\" %(t_c*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "circuit turn off time=34.66 us\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.7, Page No 264 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=1.0 #\u2126\n", - "L=20*10**-6 #\u00b5H\n", - "C=40*10**-6 #\u00b5F\n", - "\n", - "#Calculations\n", - "w_r=math.sqrt((1/(L*C))-(R/(2*L))**2)\n", - "t_1=math.pi/w_r\n", - "\n", - "#Results\n", - "print(\"conduction time of thyristor=%.3f us\" %(t_1*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of thyristor=125.664 us\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.8 Page No 265" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "dv=400*10.0**-6 #dv=dv_T/dt(V/s)\n", - "V_s=200.0 #v\n", - "R=20.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=V_s/(R*dv) \n", - "C_j=.025*10**-12\n", - "C_s=C-C_j\n", - "I_T=40;\n", - "R_s=1/((I_T/V_s)-(1/R)) \n", - "#value of R_s in book is wrongly calculated\n", - "\n", - "#Results\n", - "print(\"R_s=%.2f ohm\" %R_s)\n", - "print(\"C_s=%.3f uF\" %(C_s/10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R_s=6.67 ohm\n", - "C_s=0.025 uF\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.9 Page No 265" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "C=20.0*10**-6 #\u00b5H \n", - "L=0.2*10**-3 #\u00b5F\n", - "i_c=10.0\n", - "\n", - "#Calculations\n", - "i=V_s*math.sqrt(C/L)\n", - "w_o=1.0/math.sqrt(L*C)\n", - "t_1 = (1/w_o)*math.degrees(math.asin(i_c/i))\n", - "t_o=math.pi/w_o\n", - "t_c=t_o-2*t_1 \n", - "\n", - "#Results\n", - "print(\"reqd time=%.2f us\" %(t_1*10**6))\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n", - "print(\"ckt turn off time=%.5f us\" %t_1)\n", - "#solution in book wrong, as wrong values are selected while filling the formuleas" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "reqd time=575.37 us\n", - "ckt turn off time=-952.05 us\n", - "ckt turn off time=0.00058 us\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.11 Page No 268 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "L=1.0 #\u00b5H\n", - "R=50.0 #\u2126\n", - "V_s=200.0 #V\n", - "t=0.01 #sec\n", - "Vd=0.7\n", - "\n", - "#Calculations\n", - "tau=L/R\n", - "i=(V_s/R)*(1-math.exp(-t/tau))\n", - "t=8*10**-3\n", - "i1=i-t*Vd \n", - "\n", - "\n", - "#Results\n", - "print(\"current through L = %.2f A\" %i1)\n", - "i_R=0 #current in R at t=.008s\n", - "print(\"Current through R = %.2f A\" %i_R)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current through L = 1.57 A\n", - "Current through R = 0.00 A\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.12, Page No 269" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "#initialisation of variables\n", - "L=1.0 #H\n", - "R=50.0 #ohm\n", - "V_s=200.0 #V\n", - "\n", - "#Calculations\n", - "tau=L/R\n", - "t=0.01 #s\n", - "i=(V_s/R)*(1-math.exp(-t/tau))\n", - "C=1*10**-6 #F\n", - "V_c=math.sqrt(L/C)*i\n", - "\n", - "#Results\n", - "print(\"current in R,L=%.2f A\" %i)\n", - "print(\"voltage across C=%.2f kV\" %(V_c/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current in R,L=1.57 A\n", - "voltage across C=1.57 kV\n" - ] - } - ], - "prompt_number": 22 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter5_3.ipynb b/_Power_Electronics/Chapter5_3.ipynb deleted file mode 100755 index 1d261f20..00000000 --- a/_Power_Electronics/Chapter5_3.ipynb +++ /dev/null @@ -1,511 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 05 : Thyristor Commutation Techniques" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.1, Page No 252" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=5.0*10**-3 #mH\n", - "C=20.0*10**-6 #\u00b5F\n", - "V_s=200 #V\n", - "\n", - "#Calculations\n", - "w_o=math.sqrt(1/(L*C)) #rad/s\n", - "t_o=math.pi/w_o #ms\n", - "\n", - "#Results\n", - "print('conduction time of thyristor = %.2f ms' %(t_o*1000))\n", - "print('voltage across thyristor=%.0f V' %V_s)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of thyristor = 0.99 ms\n", - "voltage across thyristor=200 V\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.2, Page No 255" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "C=20.0*10**-6 #\u00b5F\n", - "L=5.0*10**-6 #\u00b5H\n", - "V_s=230.0 #V\n", - "\n", - "#Calculations\n", - "I_p=V_s*math.sqrt(C/L) #A\n", - "w_o=math.sqrt(1/(L*C)) #rad/sec\n", - "t_o=math.pi/w_o #\u00b5S\n", - "I_o=300 \n", - "a = math.degrees(math.asin(I_o/(2*V_s))) \n", - "V_ab = V_s*math.cos(math.radians(a)) #V \n", - "t_c=C*V_ab/I_o #\u00b5s\n", - "\n", - "#Calculations\n", - "print(\"conduction time of auxillery thyristor=%.2f us\" %(t_o*10**6))\n", - "print(\"voltage across main thyristor=%.2f V\" %V_ab)\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of auxillery thyristor=31.42 us\n", - "voltage across main thyristor=174.36 V\n", - "ckt turn off time=11.62 us\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.3 Page No 258" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "R1=10.0 #\u2126\n", - "R2=100.0 #\u2126\n", - "C=0 # value of capacitor\n", - "\n", - "#Calculations\n", - "I1=V_s*(1/R1+2/R2) #A\n", - "I2=V_s*(2/R1+1/R2) #A\n", - "t_c1=40*10**-6\n", - "fos=2 #factor of safety\n", - "C1=t_c1*fos/(R1*math.log(2))\n", - "C2=t_c1*fos/(R2*math.log(2))\n", - "if C1 > C2 :\n", - " C = C1*10**6\n", - "else :\n", - " C = C2*10**6\n", - "\n", - "\n", - "#Results\n", - "print(\"peak value of current through SCR1=%.2f A\" %I1); \n", - "print(\"Peak value of current through SCR2=%.2f A\" %I2);\n", - "print(\"Value of capacitor=%.2f uF\" %C);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak value of current through SCR1=24.00 A\n", - "Peak value of current through SCR2=42.00 A\n", - "Value of capacitor=11.54 uF\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.4, Page No 260" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "L=20*10**-6 #\u00b5H\n", - "C=40*10**-6 #\u00b5F\n", - "I_o=120.0 #A\n", - "\n", - "#Calculations\n", - "I_p=V_s*math.sqrt(C/L) #A\n", - "t_c=C*V_s/I_o #\u00b5s\n", - "w_o=math.sqrt(1/(L*C)) \n", - "t_c1=math.pi/(2*w_o) #\u00b5s\n", - "\n", - "#Results\n", - "print(\"current through main thyristor=%.2f A\" %(I_o+I_p))\n", - "print(\"Current through auxillery thyristor=%.2f A\" %I_o)\n", - "print(\"Circuit turn off time for main thyristor=%.2f us\" %(t_c*10**6))\n", - "print(\"Circuit turn off time for auxillery thyristor=%.2f us\" %(t_c1*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current through main thyristor=445.27 A\n", - "Current through auxillery thyristor=120.00 A\n", - "Circuit turn off time for main thyristor=76.67 us\n", - "Circuit turn off time for auxillery thyristor=44.43 us\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.5 Page No 263" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "C_j=25*10**-12 #pF\n", - "I_c=5*10**-3 #charging current\n", - "V_s=200.0 #V\n", - "R=50.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=(C_j*V_s)/(I_c*R)\n", - "\n", - "\n", - "#RESULTS\n", - "print(\"Value of C=%.2f \u00b5F\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of C=0.02 \u00b5F\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.6 Page No 263" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "R=5.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=10.0*10**-6\n", - "#for turn off V_s*(1-2*exp(-t/(R*C)))=0, so after solving\n", - "t_c=R*C*math.log(2.0)\n", - "\n", - "#Results\n", - "print(\"circuit turn off time=%.2f us\" %(t_c*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "circuit turn off time=34.66 us\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.7, Page No 264 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=1.0 #\u2126\n", - "L=20*10**-6 #\u00b5H\n", - "C=40*10**-6 #\u00b5F\n", - "\n", - "#Calculations\n", - "w_r=math.sqrt((1/(L*C))-(R/(2*L))**2)\n", - "t_1=math.pi/w_r\n", - "\n", - "#Results\n", - "print(\"conduction time of thyristor=%.3f us\" %(t_1*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of thyristor=125.664 us\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.8 Page No 265" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "dv=400*10.0**-6 #dv=dv_T/dt(V/s)\n", - "V_s=200.0 #v\n", - "R=20.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=V_s/(R*dv) \n", - "C_j=.025*10**-12\n", - "C_s=C-C_j\n", - "I_T=40;\n", - "R_s=1/((I_T/V_s)-(1/R)) \n", - "#value of R_s in book is wrongly calculated\n", - "\n", - "#Results\n", - "print(\"R_s=%.2f ohm\" %R_s)\n", - "print(\"C_s=%.3f uF\" %(C_s/10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R_s=6.67 ohm\n", - "C_s=0.025 uF\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.9 Page No 265" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "C=20.0*10**-6 #\u00b5H \n", - "L=0.2*10**-3 #\u00b5F\n", - "i_c=10.0\n", - "\n", - "#Calculations\n", - "i=V_s*math.sqrt(C/L)\n", - "w_o=1.0/math.sqrt(L*C)\n", - "t_1 = (1/w_o)*math.degrees(math.asin(i_c/i))\n", - "t_o=math.pi/w_o\n", - "t_c=t_o-2*t_1 \n", - "\n", - "#Results\n", - "print(\"reqd time=%.2f us\" %(t_1*10**6))\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n", - "print(\"ckt turn off time=%.5f us\" %t_1)\n", - "#solution in book wrong, as wrong values are selected while filling the formuleas" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "reqd time=575.37 us\n", - "ckt turn off time=-952.05 us\n", - "ckt turn off time=0.00058 us\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.11 Page No 268 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "L=1.0 #\u00b5H\n", - "R=50.0 #\u2126\n", - "V_s=200.0 #V\n", - "t=0.01 #sec\n", - "Vd=0.7\n", - "\n", - "#Calculations\n", - "tau=L/R\n", - "i=(V_s/R)*(1-math.exp(-t/tau))\n", - "t=8*10**-3\n", - "i1=i-t*Vd \n", - "\n", - "\n", - "#Results\n", - "print(\"current through L = %.2f A\" %i1)\n", - "i_R=0 #current in R at t=.008s\n", - "print(\"Current through R = %.2f A\" %i_R)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current through L = 1.57 A\n", - "Current through R = 0.00 A\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.12, Page No 269" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "#initialisation of variables\n", - "L=1.0 #H\n", - "R=50.0 #ohm\n", - "V_s=200.0 #V\n", - "\n", - "#Calculations\n", - "tau=L/R\n", - "t=0.01 #s\n", - "i=(V_s/R)*(1-math.exp(-t/tau))\n", - "C=1*10**-6 #F\n", - "V_c=math.sqrt(L/C)*i\n", - "\n", - "#Results\n", - "print(\"current in R,L=%.2f A\" %i)\n", - "print(\"voltage across C=%.2f kV\" %(V_c/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current in R,L=1.57 A\n", - "voltage across C=1.57 kV\n" - ] - } - ], - "prompt_number": 22 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter5_4.ipynb b/_Power_Electronics/Chapter5_4.ipynb deleted file mode 100755 index 1d261f20..00000000 --- a/_Power_Electronics/Chapter5_4.ipynb +++ /dev/null @@ -1,511 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 05 : Thyristor Commutation Techniques" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.1, Page No 252" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=5.0*10**-3 #mH\n", - "C=20.0*10**-6 #\u00b5F\n", - "V_s=200 #V\n", - "\n", - "#Calculations\n", - "w_o=math.sqrt(1/(L*C)) #rad/s\n", - "t_o=math.pi/w_o #ms\n", - "\n", - "#Results\n", - "print('conduction time of thyristor = %.2f ms' %(t_o*1000))\n", - "print('voltage across thyristor=%.0f V' %V_s)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of thyristor = 0.99 ms\n", - "voltage across thyristor=200 V\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.2, Page No 255" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "C=20.0*10**-6 #\u00b5F\n", - "L=5.0*10**-6 #\u00b5H\n", - "V_s=230.0 #V\n", - "\n", - "#Calculations\n", - "I_p=V_s*math.sqrt(C/L) #A\n", - "w_o=math.sqrt(1/(L*C)) #rad/sec\n", - "t_o=math.pi/w_o #\u00b5S\n", - "I_o=300 \n", - "a = math.degrees(math.asin(I_o/(2*V_s))) \n", - "V_ab = V_s*math.cos(math.radians(a)) #V \n", - "t_c=C*V_ab/I_o #\u00b5s\n", - "\n", - "#Calculations\n", - "print(\"conduction time of auxillery thyristor=%.2f us\" %(t_o*10**6))\n", - "print(\"voltage across main thyristor=%.2f V\" %V_ab)\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of auxillery thyristor=31.42 us\n", - "voltage across main thyristor=174.36 V\n", - "ckt turn off time=11.62 us\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.3 Page No 258" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "R1=10.0 #\u2126\n", - "R2=100.0 #\u2126\n", - "C=0 # value of capacitor\n", - "\n", - "#Calculations\n", - "I1=V_s*(1/R1+2/R2) #A\n", - "I2=V_s*(2/R1+1/R2) #A\n", - "t_c1=40*10**-6\n", - "fos=2 #factor of safety\n", - "C1=t_c1*fos/(R1*math.log(2))\n", - "C2=t_c1*fos/(R2*math.log(2))\n", - "if C1 > C2 :\n", - " C = C1*10**6\n", - "else :\n", - " C = C2*10**6\n", - "\n", - "\n", - "#Results\n", - "print(\"peak value of current through SCR1=%.2f A\" %I1); \n", - "print(\"Peak value of current through SCR2=%.2f A\" %I2);\n", - "print(\"Value of capacitor=%.2f uF\" %C);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak value of current through SCR1=24.00 A\n", - "Peak value of current through SCR2=42.00 A\n", - "Value of capacitor=11.54 uF\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.4, Page No 260" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0 #V\n", - "L=20*10**-6 #\u00b5H\n", - "C=40*10**-6 #\u00b5F\n", - "I_o=120.0 #A\n", - "\n", - "#Calculations\n", - "I_p=V_s*math.sqrt(C/L) #A\n", - "t_c=C*V_s/I_o #\u00b5s\n", - "w_o=math.sqrt(1/(L*C)) \n", - "t_c1=math.pi/(2*w_o) #\u00b5s\n", - "\n", - "#Results\n", - "print(\"current through main thyristor=%.2f A\" %(I_o+I_p))\n", - "print(\"Current through auxillery thyristor=%.2f A\" %I_o)\n", - "print(\"Circuit turn off time for main thyristor=%.2f us\" %(t_c*10**6))\n", - "print(\"Circuit turn off time for auxillery thyristor=%.2f us\" %(t_c1*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current through main thyristor=445.27 A\n", - "Current through auxillery thyristor=120.00 A\n", - "Circuit turn off time for main thyristor=76.67 us\n", - "Circuit turn off time for auxillery thyristor=44.43 us\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.5 Page No 263" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "C_j=25*10**-12 #pF\n", - "I_c=5*10**-3 #charging current\n", - "V_s=200.0 #V\n", - "R=50.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=(C_j*V_s)/(I_c*R)\n", - "\n", - "\n", - "#RESULTS\n", - "print(\"Value of C=%.2f \u00b5F\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of C=0.02 \u00b5F\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.6 Page No 263" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "R=5.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=10.0*10**-6\n", - "#for turn off V_s*(1-2*exp(-t/(R*C)))=0, so after solving\n", - "t_c=R*C*math.log(2.0)\n", - "\n", - "#Results\n", - "print(\"circuit turn off time=%.2f us\" %(t_c*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "circuit turn off time=34.66 us\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.7, Page No 264 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=1.0 #\u2126\n", - "L=20*10**-6 #\u00b5H\n", - "C=40*10**-6 #\u00b5F\n", - "\n", - "#Calculations\n", - "w_r=math.sqrt((1/(L*C))-(R/(2*L))**2)\n", - "t_1=math.pi/w_r\n", - "\n", - "#Results\n", - "print(\"conduction time of thyristor=%.3f us\" %(t_1*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "conduction time of thyristor=125.664 us\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.8 Page No 265" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "\n", - "#initialisation of variables\n", - "dv=400*10.0**-6 #dv=dv_T/dt(V/s)\n", - "V_s=200.0 #v\n", - "R=20.0 #\u2126\n", - "\n", - "#Calculations\n", - "C=V_s/(R*dv) \n", - "C_j=.025*10**-12\n", - "C_s=C-C_j\n", - "I_T=40;\n", - "R_s=1/((I_T/V_s)-(1/R)) \n", - "#value of R_s in book is wrongly calculated\n", - "\n", - "#Results\n", - "print(\"R_s=%.2f ohm\" %R_s)\n", - "print(\"C_s=%.3f uF\" %(C_s/10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "R_s=6.67 ohm\n", - "C_s=0.025 uF\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.9 Page No 265" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=200.0 #V\n", - "C=20.0*10**-6 #\u00b5H \n", - "L=0.2*10**-3 #\u00b5F\n", - "i_c=10.0\n", - "\n", - "#Calculations\n", - "i=V_s*math.sqrt(C/L)\n", - "w_o=1.0/math.sqrt(L*C)\n", - "t_1 = (1/w_o)*math.degrees(math.asin(i_c/i))\n", - "t_o=math.pi/w_o\n", - "t_c=t_o-2*t_1 \n", - "\n", - "#Results\n", - "print(\"reqd time=%.2f us\" %(t_1*10**6))\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n", - "print(\"ckt turn off time=%.5f us\" %t_1)\n", - "#solution in book wrong, as wrong values are selected while filling the formuleas" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "reqd time=575.37 us\n", - "ckt turn off time=-952.05 us\n", - "ckt turn off time=0.00058 us\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.11 Page No 268 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "L=1.0 #\u00b5H\n", - "R=50.0 #\u2126\n", - "V_s=200.0 #V\n", - "t=0.01 #sec\n", - "Vd=0.7\n", - "\n", - "#Calculations\n", - "tau=L/R\n", - "i=(V_s/R)*(1-math.exp(-t/tau))\n", - "t=8*10**-3\n", - "i1=i-t*Vd \n", - "\n", - "\n", - "#Results\n", - "print(\"current through L = %.2f A\" %i1)\n", - "i_R=0 #current in R at t=.008s\n", - "print(\"Current through R = %.2f A\" %i_R)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current through L = 1.57 A\n", - "Current through R = 0.00 A\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 5.12, Page No 269" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#initialisation of variables\n", - "\n", - "#initialisation of variables\n", - "L=1.0 #H\n", - "R=50.0 #ohm\n", - "V_s=200.0 #V\n", - "\n", - "#Calculations\n", - "tau=L/R\n", - "t=0.01 #s\n", - "i=(V_s/R)*(1-math.exp(-t/tau))\n", - "C=1*10**-6 #F\n", - "V_c=math.sqrt(L/C)*i\n", - "\n", - "#Results\n", - "print(\"current in R,L=%.2f A\" %i)\n", - "print(\"voltage across C=%.2f kV\" %(V_c/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "current in R,L=1.57 A\n", - "voltage across C=1.57 kV\n" - ] - } - ], - "prompt_number": 22 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter6.ipynb b/_Power_Electronics/Chapter6.ipynb deleted file mode 100755 index dff6564b..00000000 --- a/_Power_Electronics/Chapter6.ipynb +++ /dev/null @@ -1,1761 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 06 : Phase Controlled Rectifiers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.1, Page No 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "P=1000.0\n", - "R=V**2/P\n", - "\n", - "#Calculations\n", - "a=math.pi/4\n", - "V_or1=(math.sqrt(2)*V/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a)+.5*math.sin(2*a))\n", - "P1=V_or1**2/R \n", - "a=math.pi/2\n", - "V_or2=(math.sqrt(2)*V/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a)+.5*math.sin(2*a))\n", - "P2=V_or2**2/R \n", - "\n", - "#Results\n", - "print(\"when firing angle delay is of 45deg\")\n", - "print(\"power absorbed=%.2f W\" %P1)\n", - "print(\"when firing angle delay is of 90deg\")\n", - "print(\"power absorbed=%.2f W\" %P2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when firing angle delay is of 45deg\n", - "power absorbed=454.58 W\n", - "when firing angle delay is of 90deg\n", - "power absorbed=250.00 W\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.2, Page No 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "\n", - "#Calculations\n", - "th1=math.sin(math.radians(E/(math.sqrt(2)*V)))\n", - "I_o=(1/(2*math.pi*R))*(2*math.sqrt(2)*230*math.cos(math.radians(th1))-E*(math.pi-2*th1*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*(math.pi-2*th1*math.pi/180)+V**2*math.sin(math.radians(2*th1))-4*math.sqrt(2)*V*E*math.cos(math.radians(th1))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or)\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.3f W\" %P_r) \n", - "print(\"supply pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=3.5679 A\n", - "power supplied to the battery=535.18 W\n", - "power dissipated by the resistor=829.760 W\n", - "supply pf=0.583\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.3 Page No 284" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "a=35.0\n", - "\n", - "#Calculations\n", - "th1=math.degrees(math.asin(E/(math.sqrt(2)*V)))\n", - "th2=180-th1\n", - "I_o=(1/(2*math.pi*R))*(math.sqrt(2)*230*(math.cos(math.radians(a))-math.cos(math.radians(th2)))-E*((th2-a)*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*((th2-a)*math.pi/180)-(V**2/2)*(math.sin(math.radians(2*th2))-math.sin(math.radians(2*a)))-2*math.sqrt(2)*V*E*(math.cos(math.radians(a))-math.cos(math.radians(th2)))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or) \n", - "\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.2f W\" %P_r)\n", - "print(\"supply pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=4.9208 A\n", - "power supplied to the battery=738.12 W\n", - "power dissipated by the resistor=689.54 W\n", - "supply pf=0.6686\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.4, Page No 285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "B=210\n", - "f=50.0 #Hz\n", - "w=2*math.pi*f\n", - "a=40.0 #firing angle\n", - "V=230.0\n", - "R=5.0\n", - "L=2*10**-3\n", - "\n", - "#Calculations\n", - "t_c1=(360-B)*math.pi/(180*w) \n", - "V_o1=(math.sqrt(2)*230/(2*math.pi))*(math.cos(math.radians(a))-math.cos(math.radians(B))) \n", - "I_o1=V_o1/R \n", - "E=110\n", - "R=5\n", - "L=2*10**-3\n", - "th1=math.degrees(math.asin(E/(math.sqrt(2)*V)))\n", - "t_c2=(360-B+th1)*math.pi/(180*w) \n", - "V_o2=(math.sqrt(2)*230/(2*math.pi))*(math.cos(math.radians(a))-math.cos(math.radians(B))) \n", - "I_o2=(1/(2*math.pi*R))*(math.sqrt(2)*230*(math.cos(math.radians(a))-math.cos(math.radians(B)))-E*((B-a)*math.pi/180)) \n", - "V_o2=R*I_o2+E \n", - "\n", - "\n", - "#Results\n", - "print(\"for R=5ohm and L=2mH\")\n", - "print(\"ckt turn off time=%.3f msec\" %(t_c1*1000))\n", - "print(\"avg output voltage=%.3f V\" %V_o1)\n", - "print(\"avg output current=%.4f A\" %I_o1)\n", - "print(\"for R=5ohm % L=2mH and E=110V\")\n", - "print(\"ckt turn off time=%.3f msec\" %(t_c2*1000))\n", - "print(\"avg output current=%.4f A\" %I_o2)\n", - "print(\"avg output voltage=%.3f V\" %V_o2) " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for R=5ohm and L=2mH\n", - "ckt turn off time=8.333 msec\n", - "avg output voltage=84.489 V\n", - "avg output current=16.8979 A\n", - "for R=5ohm % L=2mH and E=110V\n", - "ckt turn off time=9.431 msec\n", - "avg output current=6.5090 A\n", - "avg output voltage=142.545 V\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.5 Page No 286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "f=50.0\n", - "R=10.0\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "V_m=(math.sqrt(2)*V_s)\n", - "V_o=V_m/(2*math.pi)*(1+math.cos(math.radians(a)))\n", - "I_o=V_o/R\n", - "V_or=(V_m/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a*math.pi/180)+.5*math.sin(math.radians(2*a)))\n", - "I_or=V_or/R\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "TUF=P_dc/(V_s*I_or) \n", - "PIV=V_m \n", - "\n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"form factor=%.3f\" %FF)\n", - "print(\"voltage ripple factor=%.4f\" %VRF)\n", - "print(\"t/f utilisation factor=%.4f\" %TUF)\n", - "print(\"PIV of thyristor=%.2f V\" %PIV)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.2834\n", - "form factor=1.879\n", - "voltage ripple factor=1.5903\n", - "t/f utilisation factor=0.1797\n", - "PIV of thyristor=325.27 V\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.6 Page No 294" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=1000.0\n", - "fos=2.5 #factor of safety\n", - "I_TAV=40.0\n", - "\n", - "#Calculations\n", - "V_m1=V/(2*fos)\n", - "P1=(2*V_m1/math.pi)*I_TAV \n", - "V_m2=V/(fos)\n", - "P2=(2*V_m2/math.pi)*I_TAV \n", - "\n", - "#Results\n", - "print(\"for mid pt convertor\")\n", - "print(\"power handled=%.3f kW\" %(P1/1000))\n", - "print(\"for bridge convertor\")\n", - "print(\"power handled=%.3f kW\" %(P2/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for mid pt convertor\n", - "power handled=5.093 kW\n", - "for bridge convertor\n", - "power handled=10.186 kW\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.7, Page No 297" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=.4\n", - "I_o=10\n", - "I_or=I_o\n", - "E=120.0\n", - "\n", - "#Calculations\n", - "a1=math.degrees(math.acos((E+I_o*R)*math.pi/(2*V_m)))\n", - "pf1=(E*I_o+I_or**2*R)/(V_s*I_or) \n", - "E=-120.0\n", - "a2=math.degrees(math.acos((E+I_o*R)*math.pi/(2*V_m))) \n", - "pf2=(-E*I_o-I_or**2*R)/(V_s*I_or) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.2f deg\" %a1)\n", - "print(\"pf=%.4f\" %pf1)\n", - "print(\"firing angle delay=%.2f deg\" %a2)\n", - "print(\"pf=%.4f\" %pf2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=53.21 deg\n", - "pf=0.5391\n", - "firing angle delay=124.07 deg\n", - "pf=0.5043\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.9 Page No 299" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "f=50.0\n", - "a=45.0\n", - "R=5.0\n", - "E=100.0\n", - "\n", - "#Calculations\n", - "V_o=((math.sqrt(2)*V_s)/(2*math.pi))*(3+math.cos(math.radians(a)))\n", - "I_o=(V_o-E)/R \n", - "P=E*I_o \n", - "\n", - "#Results\n", - "print(\"avg o/p current=%.3f A\" %I_o)\n", - "print(\"power delivered to battery=%.4f kW\" %(P/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p current=18.382 A\n", - "power delivered to battery=1.8382 kW\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.10 Page No 300" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=230\n", - "f=50.0\n", - "a=50.0\n", - "R=6.0\n", - "E=60.0\n", - "V_o1=((math.sqrt(2)*2*V_s)/(math.pi))*math.cos(math.radians(a))\n", - "I_o1=(V_o1-E)/R \n", - "\n", - "#ATQ after applying the conditions\n", - "V_o2=((math.sqrt(2)*V_s)/(math.pi))*math.cos(math.radians(a))\n", - "I_o2=(V_o2-E)/R \n", - "\n", - "print(\"avg o/p current=%.3f A\" %I_o1)\n", - "print(\"avg o/p current after change=%.2f A\" %I_o2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p current=12.184 A\n", - "avg o/p current after change=1.09 A\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.11 Page No 309" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_o=(2*V_m/math.pi)*math.cos(math.radians(a))\n", - "I_o=V_o/R\n", - "V_or=V_m/math.sqrt(2)\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "I_s1=2*math.sqrt(2)*I_o/math.pi\n", - "DF=math.cos(math.radians(a))\n", - "CDF=.90032\n", - "pf=CDF*DF \n", - "HF=math.sqrt((1/CDF**2)-1) \n", - "Q=2*V_m*I_o*math.sin(math.radians(a))/math.pi \n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"form factor=%.4f\" %FF)\n", - "print(\"voltage ripple factor=%.4f\" %VRF)\n", - "print(\"pf=%.5f\" %pf)\n", - "print(\"HF=%.5f\" %HF)\n", - "print(\"active power=%.2f W\" %P_dc) \n", - "print(\"reactive power=%.3f Var\" %Q)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.6366\n", - "form factor=1.5708\n", - "voltage ripple factor=1.2114\n", - "pf=0.63662\n", - "HF=0.48342\n", - "active power=2143.96 W\n", - "reactive power=2143.956 Var\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.12, Page No 310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_o=(V_m/math.pi)*(1+math.cos(math.radians(a)))\n", - "I_o=V_o/R\n", - "V_or=V_s*math.sqrt((1/math.pi)*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2))\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "I_s1=2*math.sqrt(2)*I_o*math.cos(math.radians(a/2))/math.pi\n", - "DF=math.cos(math.radians(a/2)) \n", - "CDF=2*math.sqrt(2)*math.cos(math.radians(a/2))/math.sqrt(math.pi*(math.pi-a*math.pi/180)) \n", - "pf=CDF*DF \n", - "HF=math.sqrt((1/CDF**2)-1) \n", - "Q=V_m*I_o*math.sin(math.radians(a))/math.pi\n", - "\n", - "#Results\n", - "print(\"form factor=%.3f\" %FF)\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"voltage ripple factor=%.3f\" %VRF) \n", - "print(\"DF=%.4f\" %DF)\n", - "print(\"CDF=%.4f\" %CDF)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"HF=%.4f\" %HF)\n", - "print(\"active power=%.3f W\" %P_dc)\n", - "print(\"reactive power=%.2f Var\" %Q)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "form factor=1.241\n", - "rectification efficiency=0.8059\n", - "voltage ripple factor=0.735\n", - "DF=0.9239\n", - "CDF=0.9605\n", - "pf=0.8874\n", - "HF=0.2899\n", - "active power=3123.973 W\n", - "reactive power=1293.99 Var\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.13, Page No 319" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_om=3*V_ml/(2*math.pi)\n", - "V_o=V_om/2\n", - "th=30\n", - "a=math.degrees(math.acos((2*math.pi*math.sqrt(3)*V_o/(3*V_ml)-1)))-th \n", - "I_o=V_o/R \n", - "V_or=V_ml/(2*math.sqrt(math.pi))*math.sqrt((5*math.pi/6-a*math.pi/180)+.5*math.sin(math.radians(2*a+2*th)))\n", - "I_or=V_or/R \n", - "RE=V_o*I_o/(V_or*I_or) \n", - "\n", - "#Results\n", - "print(\"delay angle=%.1f deg\" %a)\n", - "print(\"avg load current=%.3f A\" %I_o)\n", - "print(\"rms load current=%.3f A\" %I_or)\n", - "print(\"rectification efficiency=%.4f\" %RE)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "delay angle=67.7 deg\n", - "avg load current=7.765 A\n", - "rms load current=10.477 A\n", - "rectification efficiency=0.5494\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.15, Page No 321" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "V_ml=math.sqrt(2)*V\n", - "v_T=1.4\n", - "a1=30.0\n", - "\n", - "#Calculations\n", - "V_o1=3*V_ml/(2*math.pi)*math.cos(math.radians(a1))-v_T \n", - "a2=60.0\n", - "V_o2=3*V_ml/(2*math.pi)*math.cos(math.radians(a2))-v_T \n", - "I_o=36\n", - "I_TA=I_o/3 \n", - "I_Tr=I_o/math.sqrt(3) \n", - "P=I_TA*v_T \n", - "\n", - "#Results\n", - "print(\"for firing angle = 30deg\")\n", - "print(\"avg output voltage=%.3f V\" %V_o1)\n", - "print(\"for firing angle = 60deg\")\n", - "print(\"avg output voltage=%.2f V\" %V_o2)\n", - "print(\"avg current rating=%.0f A\" %I_TA)\n", - "print(\"rms current rating=%.3f A\" %I_Tr)\n", - "print(\"PIV of SCR=%.1f V\" %V_ml)\n", - "print(\"power dissipated=%.1f W\" %P)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle = 30deg\n", - "avg output voltage=232.509 V\n", - "for firing angle = 60deg\n", - "avg output voltage=133.65 V\n", - "avg current rating=12 A\n", - "rms current rating=20.785 A\n", - "PIV of SCR=565.7 V\n", - "power dissipated=16.8 W\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.17, Page No 331" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=200\n", - "I_o=20\n", - "R=.5\n", - "\n", - "#Calculations\n", - "V_o1=E+I_o*R\n", - "V_s=230\n", - "V_ml=math.sqrt(2)*V_s\n", - "a1=math.degrees(math.acos(V_o1*math.pi/(3*V_ml)))\n", - "th=120\n", - "I_s=math.sqrt((1/math.pi)*I_o**2*th*math.pi/180)\n", - "P=E*I_o+I_o**2*R\n", - "pf=P/(math.sqrt(3)*V_s*I_s) \n", - "V_o2=E-I_o*R\n", - "a2=math.degrees(math.acos(-V_o2*math.pi/(3*V_ml))) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.3f deg\" %a1)\n", - "print(\"pf=%.3f\" %pf)\n", - "print(\"firing angle delay=%.2f deg\" %a2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=47.461 deg\n", - "pf=0.646\n", - "firing angle delay=127.71 deg\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.18, Page No 332" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "a1=0\n", - "t_c1=(4*math.pi/3-a1*math.pi/180)/w \n", - "a2=30\n", - "t_c2=(4*math.pi/3-a2*math.pi/180)/w \n", - "\n", - "#Results\n", - "print(\"for firing angle delay=0deg\")\n", - "print(\"commutation time=%.2f ms\" %(t_c1*1000))\n", - "print(\"peak reverse voltage=%.2f V\" %(math.sqrt(2)*V))\n", - "print(\"for firing angle delay=30deg\")\n", - "print(\"commutation time=%.2f ms\" %(t_c2*1000))\n", - "print(\"peak reverse voltage=%.2f V\" %(math.sqrt(2)*V))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle delay=0deg\n", - "commutation time=13.33 ms\n", - "peak reverse voltage=325.27 V\n", - "for firing angle delay=30deg\n", - "commutation time=11.67 ms\n", - "peak reverse voltage=325.27 V\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.19, Page No 333" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*2*math.pi/(2*3)/(math.pi/3+math.sqrt(3)*math.cos(math.radians(2*a))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*math.pi/(math.sqrt(2)*3*math.cos(math.radians(a)))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=110.384 V\n", - "for constant load current\n", - "V_ph=110.38 V\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.20, Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*4*math.pi/(2*3)/(2*math.pi/3+math.sqrt(3)*(1+math.cos(math.radians(2*a)))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*2*math.pi/(math.sqrt(2)*3*(1+math.cos(math.radians(a))))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=102.459 V\n", - "for constant load current\n", - "V_ph=102.46 V\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.21, Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=90.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*4*math.pi/(2*3)/((math.pi-math.pi/2)+(math.sin(math.radians(2*a)))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*2*math.pi/(math.sqrt(2)*3*(1+math.cos(math.radians(a))))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.2f V\" %V_ph)\n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.1f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=191.19 V\n", - "for constant load current\n", - "V_ph=191.2 V\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.22 Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=200.0\n", - "I_o=20.0\n", - "R=.5\n", - "\n", - "#Calculations\n", - "V_o=E+I_o*R\n", - "V_s=230\n", - "V_ml=math.sqrt(2)*V_s\n", - "a=math.degrees(math.acos(V_o*2*math.pi/(3*V_ml)-1)) \n", - "a1=180-a\n", - "I_sr=math.sqrt((1/math.pi)*I_o**2*(a1*math.pi/180))\n", - "P=V_o*I_o\n", - "pf=P/(math.sqrt(3)*V_s*I_sr) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.2f deg\" %a)\n", - "print(\"pf=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=69.38 deg\n", - "pf=0.67\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.23, Page No 335" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "f=50.0\n", - "I_o=15.0\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "I_TA=I_o*120.0/360.0\n", - "I_Tr=math.sqrt(I_o**2*120/360)\n", - "I_sr=math.sqrt(I_o**2*120/180)\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "V_or=V_ml*math.sqrt((3/(2*math.pi))*(math.pi/3+math.sqrt(3/2)*math.cos(math.radians(2*a))))\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "VA=3*V_s/math.sqrt(3)*I_sr\n", - "TUF=P_dc/VA \n", - "pf=P_ac/VA \n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.5f\" %RE)\n", - "print(\"TUF=%.4f\" %TUF)\n", - "print(\"Input pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.95493\n", - "TUF=0.6752\n", - "Input pf=0.707\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.24, Page No 341" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I=10.0\n", - "a=45.0\n", - "V=400.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "DF=math.cos(math.radians(a))\n", - "I_o=10\n", - "I_s1=4*I_o/(math.sqrt(2)*math.pi)*math.sin(math.pi/3)\n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "I_o=1 #suppose\n", - "CDF=I_s1/I_sr \n", - "THD=math.sqrt(1/CDF**2-1) \n", - "pf=CDF*DF \n", - "P=(3*math.sqrt(2)*V*math.cos(math.radians(a))/math.pi)*I\n", - "Q=(3*math.sqrt(2)*V*math.sin(math.radians(a))/math.pi)*I \n", - " \n", - "#Results\n", - "print(\"DF=%.3f\" %DF)\n", - "print(\"CDF=%.3f\" %CDF)\n", - "print(\"THD=%.5f\" %THD)\n", - "print(\"PF=%.4f\" %pf)\n", - "print(\"active power=%.2f W\" %P) \n", - "print(\"reactive power=%.2f Var\" %Q)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "DF=0.707\n", - "CDF=0.955\n", - "THD=0.31084\n", - "PF=0.6752\n", - "active power=3819.72 W\n", - "reactive power=3819.72 Var\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.25, Page No 342" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "print(\"for firing angle=30deg\")\n", - "a=30.0\n", - "V=400.0\n", - "V_ml=math.sqrt(2)*V\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "E=350\n", - "R=10\n", - "\n", - "#Calculations\n", - "I_o=(V_o-E)/R\n", - "I_or=I_o\n", - "P1=V_o*I_o \n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "VA=3*V/math.sqrt(3)*I_sr\n", - "pf=P1/VA \n", - "a=180-60\n", - "V=400\n", - "V_ml=math.sqrt(2)*V\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "E=-350\n", - "R=10\n", - "I_o=(V_o-E)/R\n", - "I_or=I_o\n", - "P2=-V_o*I_o \n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "VA=3*V/math.sqrt(3)*I_sr\n", - "pf=P2/VA \n", - "\n", - "print(\"power delivered to load=%.2f W\" %P1)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"for firing advance angle=60deg\")\n", - "print(\"power delivered to load=%.2f W\" %P2)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=30deg\n", - "power delivered to load=5511.74 W\n", - "pf=0.4775\n", - "for firing advance angle=60deg\n", - "power delivered to load=2158.20 W\n", - "pf=0.4775\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.26, Page No 347" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0\n", - "u=15.0\n", - "\n", - "#Calculations\n", - "i=math.cos(math.radians(a))-math.cos(math.radians(a+u))\n", - "a=30\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "a=45\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "a=60\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "\n", - "#Results\n", - "print(\"for firing angle=30deg\") \n", - "print(\"overlap angle=%.1f deg\" %u)\n", - "print(\"for firing angle=45deg\") \n", - "print(\"overlap angle=%.1f deg\" %u)\n", - "print(\"for firing angle=60deg\") \n", - "print(\"overlap angle=%.2f deg\" %u)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=30deg\n", - "overlap angle=2.2 deg\n", - "for firing angle=45deg\n", - "overlap angle=2.2 deg\n", - "for firing angle=60deg\n", - "overlap angle=2.23 deg\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.28, Page No 352" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=400.0\n", - "I_o=20.0\n", - "R=1\n", - "\n", - "#Calculations\n", - "V_o=E+I_o*R\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=.004\n", - "V=230 #per phase voltage\n", - "V_ml=math.sqrt(6)*V\n", - "a=math.degrees(math.acos(math.pi/(3*V_ml)*(V_o+3*w*L*I_o/math.pi))) \n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "u=math.degrees(math.acos(math.pi/(3*V_ml)*(V_o-3*w*L*I_o/math.pi)))-a \n", - "\n", - "#Results\n", - "print(\"overlap angle=%.2f deg\" %u)\n", - "#Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=34.382 deg\n", - "overlap angle=8.22 deg\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.29, Page No 352" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "R=1\n", - "E=230\n", - "I=15.0\n", - "\n", - "#Calculations\n", - "V_o=-E+I*R\n", - "V_ml=math.sqrt(2)*V\n", - "a=math.degrees(math.acos(V_o*2*math.pi/(3*V_ml))) \n", - "L=0.004\n", - "a=math.degrees(math.acos((2*math.pi)/(3*V_ml)*(V_o+3*w*L*I/(2*math.pi)))) \n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-3*f*L*I/V_ml))-a \n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "print(\"overlap angle=%.3f deg\" %u)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=139.702 deg\n", - "firing angle delay=139.702 deg\n", - "overlap angle=1.431 deg\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.31, Page No 361" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0 #per phase\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(3.0)*math.sqrt(2)*V\n", - "w=2*math.pi*f\n", - "a1=60.0\n", - "L=0.015\n", - "i_cp=(math.sqrt(3)*V_ml/(w*L))*(1-math.sin(math.radians(a1))) \n", - "\n", - "#Results\n", - "print(\"circulating current=%.4f A\" %i_cp)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "circulating current=27.7425 A\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.32, Page No 362" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "a=30.0\n", - "\n", - "#Calculations\n", - "V_o=2*V_m* math.cos(math.radians(a))/math.pi \n", - "R=10\n", - "I_o=V_o/R \n", - "I_TA=I_o*math.pi/(2*math.pi) \n", - "I_Tr=math.sqrt(I_o**2*math.pi/(2*math.pi)) \n", - "I_s=math.sqrt(I_o**2*math.pi/(math.pi)) \n", - "I_o=I_s\n", - "pf=(V_o*I_o/(V*I_s)) \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.3f V\" %V_o)\n", - "print(\"avg o/p current=%.2f A\" %I_o)\n", - "print(\"avg value of thyristor current=%.3f A\" %I_TA)\n", - "print(\"rms value of thyristor current=%.2f A\" %I_Tr)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n", - " \n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=179.330 V\n", - "avg o/p current=17.93 A\n", - "avg value of thyristor current=8.967 A\n", - "rms value of thyristor current=12.68 A\n", - "pf=0.7797\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.33, Page No 363" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "a=30.0\n", - "L=.0015\n", - "\n", - "#Calculations\n", - "V_o=2*V_m* math.cos(math.radians(a))/math.pi \n", - "R=10\n", - "I_o=V_o/R \n", - "f=50\n", - "w=2*math.pi*f\n", - "V_ox=2*V_m*math.cos(math.radians(a))/math.pi-w*L*I_o/math.pi \n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-I_o*w*L/V_m))-a \n", - "I=I_o\n", - "pf=V_o*I_o/(V*I) \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.3f V\" %V_ox)\n", - "print(\"angle of overlap=%.3f deg\" %u)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=176.640 V\n", - "angle of overlap=2.855 deg\n", - "pf=0.7797\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.34, Page No 364" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=415.0\n", - "V_ml=math.sqrt(2)*V\n", - "a1=35.0 #firing angle advance\n", - "\n", - "#Calculations\n", - "a=180-a1\n", - "I_o=80.0\n", - "r_s=0.04\n", - "v_T=1.5\n", - "X_l=.25 #reactance=w*L\n", - "E=-3*V_ml*math.cos(math.radians(a))/math.pi+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi \n", - "\n", - "#Results\n", - "print(\"mean generator voltage=%.3f V\" %E)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mean generator voltage=487.590 V\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.35, Page No 364" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=415.0\n", - "V_ml=math.sqrt(2)*V\n", - "R=0.2\n", - "I_o=80\n", - "r_s=0.04\n", - "v_T=1.5\n", - "\n", - "#Calculations\n", - "X_l=.25 #reactance=w*L\n", - "a=35\n", - "E=-(-3*V_ml*math.cos(math.radians(a))/math.pi+I_o*R+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi) \n", - "a1=35\n", - "a=180-a1\n", - "E=(-3*V_ml*math.cos(math.radians(a))/math.pi+I_o*R+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi) \n", - "\n", - "#Results\n", - "print(\"when firing angle=35deg\") \n", - "print(\"mean generator voltage=%.3f V\" %E)\n", - "print(\"when firing angle advance=35deg\")\n", - "print(\"mean generator voltage=%.3f V\" %E)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when firing angle=35deg\n", - "mean generator voltage=503.590 V\n", - "when firing angle advance=35deg\n", - "mean generator voltage=503.590 V\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.36, Page No 365" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=5.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_mp=math.sqrt(2)*V\n", - "a=30.0\n", - "E=150.0\n", - "B=180-math.degrees(math.asin(E/V_mp))\n", - "I_o=(3/(2*math.pi*R))*(V_mp*(math.cos(math.radians(a+30))-math.cos(math.radians(B)))-E*((B-a-30)*math.pi/180))\n", - "\n", - "#Results\n", - "print(\"avg current flowing=%.2f A\" %I_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg current flowing=19.96 A\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.37, Page No 366" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V\n", - "V_o=V_m*(1+math.cos(math.radians(a)))/math.pi \n", - "E=100\n", - "R=10\n", - "I_o=(V_o-E)/R \n", - "I_TA=I_o*math.pi/(2*math.pi) \n", - "I_Tr=math.sqrt(I_o**2*math.pi/(2*math.pi)) \n", - "I_s=math.sqrt(I_o**2*(1-a/180)*math.pi/(math.pi))\n", - "I_or=I_o\n", - "P=E*I_o+I_or**2*R\n", - "pf=(P/(V*I_s)) \n", - "f=50\n", - "w=2*math.pi*f\n", - "t_c=(1-a/180)*math.pi/w \n", - "\n", - "#Results\n", - "print(\"\\navg o/p current=%.2f A\" %I_o)\n", - "print(\"avg o/p voltage=%.3f V\" %V_o)\n", - "print(\"avg value of thyristor current=%.2f A\" %I_TA)\n", - "print(\"rms value of thyristor current=%.3f A\" %I_Tr)\n", - "print(\"avg value of diode current=%.2f A\" %I_TA)\n", - "print(\"rms value of diode current=%.3f A\" %I_Tr)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"circuit turn off time=%.2f ms\" %(t_c*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "avg o/p current=9.32 A\n", - "avg o/p voltage=193.202 V\n", - "avg value of thyristor current=4.66 A\n", - "rms value of thyristor current=6.590 A\n", - "avg value of diode current=4.66 A\n", - "rms value of diode current=6.590 A\n", - "pf=0.9202\n", - "circuit turn off time=8.33 ms\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.38, Page No 368" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "L=0.05\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "a=30\n", - "i_cp=2*V_m*(1-math.cos(math.radians(a)))/(w*L) \n", - "R=30.0\n", - "i_l=V_m/R\n", - "i1=i_cp+i_l \n", - "i2=i_cp \n", - "\n", - "#Results\n", - "print(\"peak value of circulating current=%.3f A\" %i_cp)\n", - "print(\"peak value of current in convertor 1=%.3f A\" %i1)\n", - "print(\"peak value of current in convertor 2=%.3f A\" %i2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak value of circulating current=5.548 A\n", - "peak value of current in convertor 1=16.391 A\n", - "peak value of current in convertor 2=5.548 A\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.39, Page No 370" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "R=5.0\n", - "L=0.05\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(w*L/R)) \n", - "phi=90+math.degrees(math.atan(w*L/R)) \n", - "\n", - "#Results\n", - "print(\"for no current transients\")\n", - "print(\"triggering angle=%.2f deg\" %phi)\n", - "print(\"for worst transients\")\n", - "print(\"triggering angle=%.2f deg\" %phi)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for no current transients\n", - "triggering angle=162.34 deg\n", - "for worst transients\n", - "triggering angle=162.34 deg\n" - ] - } - ], - "prompt_number": 34 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter6_1.ipynb b/_Power_Electronics/Chapter6_1.ipynb deleted file mode 100755 index dff6564b..00000000 --- a/_Power_Electronics/Chapter6_1.ipynb +++ /dev/null @@ -1,1761 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 06 : Phase Controlled Rectifiers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.1, Page No 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "P=1000.0\n", - "R=V**2/P\n", - "\n", - "#Calculations\n", - "a=math.pi/4\n", - "V_or1=(math.sqrt(2)*V/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a)+.5*math.sin(2*a))\n", - "P1=V_or1**2/R \n", - "a=math.pi/2\n", - "V_or2=(math.sqrt(2)*V/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a)+.5*math.sin(2*a))\n", - "P2=V_or2**2/R \n", - "\n", - "#Results\n", - "print(\"when firing angle delay is of 45deg\")\n", - "print(\"power absorbed=%.2f W\" %P1)\n", - "print(\"when firing angle delay is of 90deg\")\n", - "print(\"power absorbed=%.2f W\" %P2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when firing angle delay is of 45deg\n", - "power absorbed=454.58 W\n", - "when firing angle delay is of 90deg\n", - "power absorbed=250.00 W\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.2, Page No 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "\n", - "#Calculations\n", - "th1=math.sin(math.radians(E/(math.sqrt(2)*V)))\n", - "I_o=(1/(2*math.pi*R))*(2*math.sqrt(2)*230*math.cos(math.radians(th1))-E*(math.pi-2*th1*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*(math.pi-2*th1*math.pi/180)+V**2*math.sin(math.radians(2*th1))-4*math.sqrt(2)*V*E*math.cos(math.radians(th1))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or)\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.3f W\" %P_r) \n", - "print(\"supply pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=3.5679 A\n", - "power supplied to the battery=535.18 W\n", - "power dissipated by the resistor=829.760 W\n", - "supply pf=0.583\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.3 Page No 284" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "a=35.0\n", - "\n", - "#Calculations\n", - "th1=math.degrees(math.asin(E/(math.sqrt(2)*V)))\n", - "th2=180-th1\n", - "I_o=(1/(2*math.pi*R))*(math.sqrt(2)*230*(math.cos(math.radians(a))-math.cos(math.radians(th2)))-E*((th2-a)*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*((th2-a)*math.pi/180)-(V**2/2)*(math.sin(math.radians(2*th2))-math.sin(math.radians(2*a)))-2*math.sqrt(2)*V*E*(math.cos(math.radians(a))-math.cos(math.radians(th2)))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or) \n", - "\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.2f W\" %P_r)\n", - "print(\"supply pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=4.9208 A\n", - "power supplied to the battery=738.12 W\n", - "power dissipated by the resistor=689.54 W\n", - "supply pf=0.6686\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.4, Page No 285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "B=210\n", - "f=50.0 #Hz\n", - "w=2*math.pi*f\n", - "a=40.0 #firing angle\n", - "V=230.0\n", - "R=5.0\n", - "L=2*10**-3\n", - "\n", - "#Calculations\n", - "t_c1=(360-B)*math.pi/(180*w) \n", - "V_o1=(math.sqrt(2)*230/(2*math.pi))*(math.cos(math.radians(a))-math.cos(math.radians(B))) \n", - "I_o1=V_o1/R \n", - "E=110\n", - "R=5\n", - "L=2*10**-3\n", - "th1=math.degrees(math.asin(E/(math.sqrt(2)*V)))\n", - "t_c2=(360-B+th1)*math.pi/(180*w) \n", - "V_o2=(math.sqrt(2)*230/(2*math.pi))*(math.cos(math.radians(a))-math.cos(math.radians(B))) \n", - "I_o2=(1/(2*math.pi*R))*(math.sqrt(2)*230*(math.cos(math.radians(a))-math.cos(math.radians(B)))-E*((B-a)*math.pi/180)) \n", - "V_o2=R*I_o2+E \n", - "\n", - "\n", - "#Results\n", - "print(\"for R=5ohm and L=2mH\")\n", - "print(\"ckt turn off time=%.3f msec\" %(t_c1*1000))\n", - "print(\"avg output voltage=%.3f V\" %V_o1)\n", - "print(\"avg output current=%.4f A\" %I_o1)\n", - "print(\"for R=5ohm % L=2mH and E=110V\")\n", - "print(\"ckt turn off time=%.3f msec\" %(t_c2*1000))\n", - "print(\"avg output current=%.4f A\" %I_o2)\n", - "print(\"avg output voltage=%.3f V\" %V_o2) " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for R=5ohm and L=2mH\n", - "ckt turn off time=8.333 msec\n", - "avg output voltage=84.489 V\n", - "avg output current=16.8979 A\n", - "for R=5ohm % L=2mH and E=110V\n", - "ckt turn off time=9.431 msec\n", - "avg output current=6.5090 A\n", - "avg output voltage=142.545 V\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.5 Page No 286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "f=50.0\n", - "R=10.0\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "V_m=(math.sqrt(2)*V_s)\n", - "V_o=V_m/(2*math.pi)*(1+math.cos(math.radians(a)))\n", - "I_o=V_o/R\n", - "V_or=(V_m/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a*math.pi/180)+.5*math.sin(math.radians(2*a)))\n", - "I_or=V_or/R\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "TUF=P_dc/(V_s*I_or) \n", - "PIV=V_m \n", - "\n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"form factor=%.3f\" %FF)\n", - "print(\"voltage ripple factor=%.4f\" %VRF)\n", - "print(\"t/f utilisation factor=%.4f\" %TUF)\n", - "print(\"PIV of thyristor=%.2f V\" %PIV)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.2834\n", - "form factor=1.879\n", - "voltage ripple factor=1.5903\n", - "t/f utilisation factor=0.1797\n", - "PIV of thyristor=325.27 V\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.6 Page No 294" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=1000.0\n", - "fos=2.5 #factor of safety\n", - "I_TAV=40.0\n", - "\n", - "#Calculations\n", - "V_m1=V/(2*fos)\n", - "P1=(2*V_m1/math.pi)*I_TAV \n", - "V_m2=V/(fos)\n", - "P2=(2*V_m2/math.pi)*I_TAV \n", - "\n", - "#Results\n", - "print(\"for mid pt convertor\")\n", - "print(\"power handled=%.3f kW\" %(P1/1000))\n", - "print(\"for bridge convertor\")\n", - "print(\"power handled=%.3f kW\" %(P2/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for mid pt convertor\n", - "power handled=5.093 kW\n", - "for bridge convertor\n", - "power handled=10.186 kW\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.7, Page No 297" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=.4\n", - "I_o=10\n", - "I_or=I_o\n", - "E=120.0\n", - "\n", - "#Calculations\n", - "a1=math.degrees(math.acos((E+I_o*R)*math.pi/(2*V_m)))\n", - "pf1=(E*I_o+I_or**2*R)/(V_s*I_or) \n", - "E=-120.0\n", - "a2=math.degrees(math.acos((E+I_o*R)*math.pi/(2*V_m))) \n", - "pf2=(-E*I_o-I_or**2*R)/(V_s*I_or) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.2f deg\" %a1)\n", - "print(\"pf=%.4f\" %pf1)\n", - "print(\"firing angle delay=%.2f deg\" %a2)\n", - "print(\"pf=%.4f\" %pf2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=53.21 deg\n", - "pf=0.5391\n", - "firing angle delay=124.07 deg\n", - "pf=0.5043\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.9 Page No 299" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "f=50.0\n", - "a=45.0\n", - "R=5.0\n", - "E=100.0\n", - "\n", - "#Calculations\n", - "V_o=((math.sqrt(2)*V_s)/(2*math.pi))*(3+math.cos(math.radians(a)))\n", - "I_o=(V_o-E)/R \n", - "P=E*I_o \n", - "\n", - "#Results\n", - "print(\"avg o/p current=%.3f A\" %I_o)\n", - "print(\"power delivered to battery=%.4f kW\" %(P/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p current=18.382 A\n", - "power delivered to battery=1.8382 kW\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.10 Page No 300" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=230\n", - "f=50.0\n", - "a=50.0\n", - "R=6.0\n", - "E=60.0\n", - "V_o1=((math.sqrt(2)*2*V_s)/(math.pi))*math.cos(math.radians(a))\n", - "I_o1=(V_o1-E)/R \n", - "\n", - "#ATQ after applying the conditions\n", - "V_o2=((math.sqrt(2)*V_s)/(math.pi))*math.cos(math.radians(a))\n", - "I_o2=(V_o2-E)/R \n", - "\n", - "print(\"avg o/p current=%.3f A\" %I_o1)\n", - "print(\"avg o/p current after change=%.2f A\" %I_o2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p current=12.184 A\n", - "avg o/p current after change=1.09 A\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.11 Page No 309" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_o=(2*V_m/math.pi)*math.cos(math.radians(a))\n", - "I_o=V_o/R\n", - "V_or=V_m/math.sqrt(2)\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "I_s1=2*math.sqrt(2)*I_o/math.pi\n", - "DF=math.cos(math.radians(a))\n", - "CDF=.90032\n", - "pf=CDF*DF \n", - "HF=math.sqrt((1/CDF**2)-1) \n", - "Q=2*V_m*I_o*math.sin(math.radians(a))/math.pi \n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"form factor=%.4f\" %FF)\n", - "print(\"voltage ripple factor=%.4f\" %VRF)\n", - "print(\"pf=%.5f\" %pf)\n", - "print(\"HF=%.5f\" %HF)\n", - "print(\"active power=%.2f W\" %P_dc) \n", - "print(\"reactive power=%.3f Var\" %Q)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.6366\n", - "form factor=1.5708\n", - "voltage ripple factor=1.2114\n", - "pf=0.63662\n", - "HF=0.48342\n", - "active power=2143.96 W\n", - "reactive power=2143.956 Var\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.12, Page No 310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_o=(V_m/math.pi)*(1+math.cos(math.radians(a)))\n", - "I_o=V_o/R\n", - "V_or=V_s*math.sqrt((1/math.pi)*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2))\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "I_s1=2*math.sqrt(2)*I_o*math.cos(math.radians(a/2))/math.pi\n", - "DF=math.cos(math.radians(a/2)) \n", - "CDF=2*math.sqrt(2)*math.cos(math.radians(a/2))/math.sqrt(math.pi*(math.pi-a*math.pi/180)) \n", - "pf=CDF*DF \n", - "HF=math.sqrt((1/CDF**2)-1) \n", - "Q=V_m*I_o*math.sin(math.radians(a))/math.pi\n", - "\n", - "#Results\n", - "print(\"form factor=%.3f\" %FF)\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"voltage ripple factor=%.3f\" %VRF) \n", - "print(\"DF=%.4f\" %DF)\n", - "print(\"CDF=%.4f\" %CDF)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"HF=%.4f\" %HF)\n", - "print(\"active power=%.3f W\" %P_dc)\n", - "print(\"reactive power=%.2f Var\" %Q)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "form factor=1.241\n", - "rectification efficiency=0.8059\n", - "voltage ripple factor=0.735\n", - "DF=0.9239\n", - "CDF=0.9605\n", - "pf=0.8874\n", - "HF=0.2899\n", - "active power=3123.973 W\n", - "reactive power=1293.99 Var\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.13, Page No 319" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_om=3*V_ml/(2*math.pi)\n", - "V_o=V_om/2\n", - "th=30\n", - "a=math.degrees(math.acos((2*math.pi*math.sqrt(3)*V_o/(3*V_ml)-1)))-th \n", - "I_o=V_o/R \n", - "V_or=V_ml/(2*math.sqrt(math.pi))*math.sqrt((5*math.pi/6-a*math.pi/180)+.5*math.sin(math.radians(2*a+2*th)))\n", - "I_or=V_or/R \n", - "RE=V_o*I_o/(V_or*I_or) \n", - "\n", - "#Results\n", - "print(\"delay angle=%.1f deg\" %a)\n", - "print(\"avg load current=%.3f A\" %I_o)\n", - "print(\"rms load current=%.3f A\" %I_or)\n", - "print(\"rectification efficiency=%.4f\" %RE)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "delay angle=67.7 deg\n", - "avg load current=7.765 A\n", - "rms load current=10.477 A\n", - "rectification efficiency=0.5494\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.15, Page No 321" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "V_ml=math.sqrt(2)*V\n", - "v_T=1.4\n", - "a1=30.0\n", - "\n", - "#Calculations\n", - "V_o1=3*V_ml/(2*math.pi)*math.cos(math.radians(a1))-v_T \n", - "a2=60.0\n", - "V_o2=3*V_ml/(2*math.pi)*math.cos(math.radians(a2))-v_T \n", - "I_o=36\n", - "I_TA=I_o/3 \n", - "I_Tr=I_o/math.sqrt(3) \n", - "P=I_TA*v_T \n", - "\n", - "#Results\n", - "print(\"for firing angle = 30deg\")\n", - "print(\"avg output voltage=%.3f V\" %V_o1)\n", - "print(\"for firing angle = 60deg\")\n", - "print(\"avg output voltage=%.2f V\" %V_o2)\n", - "print(\"avg current rating=%.0f A\" %I_TA)\n", - "print(\"rms current rating=%.3f A\" %I_Tr)\n", - "print(\"PIV of SCR=%.1f V\" %V_ml)\n", - "print(\"power dissipated=%.1f W\" %P)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle = 30deg\n", - "avg output voltage=232.509 V\n", - "for firing angle = 60deg\n", - "avg output voltage=133.65 V\n", - "avg current rating=12 A\n", - "rms current rating=20.785 A\n", - "PIV of SCR=565.7 V\n", - "power dissipated=16.8 W\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.17, Page No 331" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=200\n", - "I_o=20\n", - "R=.5\n", - "\n", - "#Calculations\n", - "V_o1=E+I_o*R\n", - "V_s=230\n", - "V_ml=math.sqrt(2)*V_s\n", - "a1=math.degrees(math.acos(V_o1*math.pi/(3*V_ml)))\n", - "th=120\n", - "I_s=math.sqrt((1/math.pi)*I_o**2*th*math.pi/180)\n", - "P=E*I_o+I_o**2*R\n", - "pf=P/(math.sqrt(3)*V_s*I_s) \n", - "V_o2=E-I_o*R\n", - "a2=math.degrees(math.acos(-V_o2*math.pi/(3*V_ml))) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.3f deg\" %a1)\n", - "print(\"pf=%.3f\" %pf)\n", - "print(\"firing angle delay=%.2f deg\" %a2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=47.461 deg\n", - "pf=0.646\n", - "firing angle delay=127.71 deg\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.18, Page No 332" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "a1=0\n", - "t_c1=(4*math.pi/3-a1*math.pi/180)/w \n", - "a2=30\n", - "t_c2=(4*math.pi/3-a2*math.pi/180)/w \n", - "\n", - "#Results\n", - "print(\"for firing angle delay=0deg\")\n", - "print(\"commutation time=%.2f ms\" %(t_c1*1000))\n", - "print(\"peak reverse voltage=%.2f V\" %(math.sqrt(2)*V))\n", - "print(\"for firing angle delay=30deg\")\n", - "print(\"commutation time=%.2f ms\" %(t_c2*1000))\n", - "print(\"peak reverse voltage=%.2f V\" %(math.sqrt(2)*V))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle delay=0deg\n", - "commutation time=13.33 ms\n", - "peak reverse voltage=325.27 V\n", - "for firing angle delay=30deg\n", - "commutation time=11.67 ms\n", - "peak reverse voltage=325.27 V\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.19, Page No 333" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*2*math.pi/(2*3)/(math.pi/3+math.sqrt(3)*math.cos(math.radians(2*a))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*math.pi/(math.sqrt(2)*3*math.cos(math.radians(a)))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=110.384 V\n", - "for constant load current\n", - "V_ph=110.38 V\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.20, Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*4*math.pi/(2*3)/(2*math.pi/3+math.sqrt(3)*(1+math.cos(math.radians(2*a)))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*2*math.pi/(math.sqrt(2)*3*(1+math.cos(math.radians(a))))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=102.459 V\n", - "for constant load current\n", - "V_ph=102.46 V\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.21, Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=90.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*4*math.pi/(2*3)/((math.pi-math.pi/2)+(math.sin(math.radians(2*a)))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*2*math.pi/(math.sqrt(2)*3*(1+math.cos(math.radians(a))))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.2f V\" %V_ph)\n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.1f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=191.19 V\n", - "for constant load current\n", - "V_ph=191.2 V\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.22 Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=200.0\n", - "I_o=20.0\n", - "R=.5\n", - "\n", - "#Calculations\n", - "V_o=E+I_o*R\n", - "V_s=230\n", - "V_ml=math.sqrt(2)*V_s\n", - "a=math.degrees(math.acos(V_o*2*math.pi/(3*V_ml)-1)) \n", - "a1=180-a\n", - "I_sr=math.sqrt((1/math.pi)*I_o**2*(a1*math.pi/180))\n", - "P=V_o*I_o\n", - "pf=P/(math.sqrt(3)*V_s*I_sr) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.2f deg\" %a)\n", - "print(\"pf=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=69.38 deg\n", - "pf=0.67\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.23, Page No 335" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "f=50.0\n", - "I_o=15.0\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "I_TA=I_o*120.0/360.0\n", - "I_Tr=math.sqrt(I_o**2*120/360)\n", - "I_sr=math.sqrt(I_o**2*120/180)\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "V_or=V_ml*math.sqrt((3/(2*math.pi))*(math.pi/3+math.sqrt(3/2)*math.cos(math.radians(2*a))))\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "VA=3*V_s/math.sqrt(3)*I_sr\n", - "TUF=P_dc/VA \n", - "pf=P_ac/VA \n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.5f\" %RE)\n", - "print(\"TUF=%.4f\" %TUF)\n", - "print(\"Input pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.95493\n", - "TUF=0.6752\n", - "Input pf=0.707\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.24, Page No 341" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I=10.0\n", - "a=45.0\n", - "V=400.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "DF=math.cos(math.radians(a))\n", - "I_o=10\n", - "I_s1=4*I_o/(math.sqrt(2)*math.pi)*math.sin(math.pi/3)\n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "I_o=1 #suppose\n", - "CDF=I_s1/I_sr \n", - "THD=math.sqrt(1/CDF**2-1) \n", - "pf=CDF*DF \n", - "P=(3*math.sqrt(2)*V*math.cos(math.radians(a))/math.pi)*I\n", - "Q=(3*math.sqrt(2)*V*math.sin(math.radians(a))/math.pi)*I \n", - " \n", - "#Results\n", - "print(\"DF=%.3f\" %DF)\n", - "print(\"CDF=%.3f\" %CDF)\n", - "print(\"THD=%.5f\" %THD)\n", - "print(\"PF=%.4f\" %pf)\n", - "print(\"active power=%.2f W\" %P) \n", - "print(\"reactive power=%.2f Var\" %Q)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "DF=0.707\n", - "CDF=0.955\n", - "THD=0.31084\n", - "PF=0.6752\n", - "active power=3819.72 W\n", - "reactive power=3819.72 Var\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.25, Page No 342" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "print(\"for firing angle=30deg\")\n", - "a=30.0\n", - "V=400.0\n", - "V_ml=math.sqrt(2)*V\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "E=350\n", - "R=10\n", - "\n", - "#Calculations\n", - "I_o=(V_o-E)/R\n", - "I_or=I_o\n", - "P1=V_o*I_o \n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "VA=3*V/math.sqrt(3)*I_sr\n", - "pf=P1/VA \n", - "a=180-60\n", - "V=400\n", - "V_ml=math.sqrt(2)*V\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "E=-350\n", - "R=10\n", - "I_o=(V_o-E)/R\n", - "I_or=I_o\n", - "P2=-V_o*I_o \n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "VA=3*V/math.sqrt(3)*I_sr\n", - "pf=P2/VA \n", - "\n", - "print(\"power delivered to load=%.2f W\" %P1)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"for firing advance angle=60deg\")\n", - "print(\"power delivered to load=%.2f W\" %P2)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=30deg\n", - "power delivered to load=5511.74 W\n", - "pf=0.4775\n", - "for firing advance angle=60deg\n", - "power delivered to load=2158.20 W\n", - "pf=0.4775\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.26, Page No 347" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0\n", - "u=15.0\n", - "\n", - "#Calculations\n", - "i=math.cos(math.radians(a))-math.cos(math.radians(a+u))\n", - "a=30\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "a=45\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "a=60\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "\n", - "#Results\n", - "print(\"for firing angle=30deg\") \n", - "print(\"overlap angle=%.1f deg\" %u)\n", - "print(\"for firing angle=45deg\") \n", - "print(\"overlap angle=%.1f deg\" %u)\n", - "print(\"for firing angle=60deg\") \n", - "print(\"overlap angle=%.2f deg\" %u)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=30deg\n", - "overlap angle=2.2 deg\n", - "for firing angle=45deg\n", - "overlap angle=2.2 deg\n", - "for firing angle=60deg\n", - "overlap angle=2.23 deg\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.28, Page No 352" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=400.0\n", - "I_o=20.0\n", - "R=1\n", - "\n", - "#Calculations\n", - "V_o=E+I_o*R\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=.004\n", - "V=230 #per phase voltage\n", - "V_ml=math.sqrt(6)*V\n", - "a=math.degrees(math.acos(math.pi/(3*V_ml)*(V_o+3*w*L*I_o/math.pi))) \n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "u=math.degrees(math.acos(math.pi/(3*V_ml)*(V_o-3*w*L*I_o/math.pi)))-a \n", - "\n", - "#Results\n", - "print(\"overlap angle=%.2f deg\" %u)\n", - "#Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=34.382 deg\n", - "overlap angle=8.22 deg\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.29, Page No 352" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "R=1\n", - "E=230\n", - "I=15.0\n", - "\n", - "#Calculations\n", - "V_o=-E+I*R\n", - "V_ml=math.sqrt(2)*V\n", - "a=math.degrees(math.acos(V_o*2*math.pi/(3*V_ml))) \n", - "L=0.004\n", - "a=math.degrees(math.acos((2*math.pi)/(3*V_ml)*(V_o+3*w*L*I/(2*math.pi)))) \n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-3*f*L*I/V_ml))-a \n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "print(\"overlap angle=%.3f deg\" %u)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=139.702 deg\n", - "firing angle delay=139.702 deg\n", - "overlap angle=1.431 deg\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.31, Page No 361" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0 #per phase\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(3.0)*math.sqrt(2)*V\n", - "w=2*math.pi*f\n", - "a1=60.0\n", - "L=0.015\n", - "i_cp=(math.sqrt(3)*V_ml/(w*L))*(1-math.sin(math.radians(a1))) \n", - "\n", - "#Results\n", - "print(\"circulating current=%.4f A\" %i_cp)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "circulating current=27.7425 A\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.32, Page No 362" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "a=30.0\n", - "\n", - "#Calculations\n", - "V_o=2*V_m* math.cos(math.radians(a))/math.pi \n", - "R=10\n", - "I_o=V_o/R \n", - "I_TA=I_o*math.pi/(2*math.pi) \n", - "I_Tr=math.sqrt(I_o**2*math.pi/(2*math.pi)) \n", - "I_s=math.sqrt(I_o**2*math.pi/(math.pi)) \n", - "I_o=I_s\n", - "pf=(V_o*I_o/(V*I_s)) \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.3f V\" %V_o)\n", - "print(\"avg o/p current=%.2f A\" %I_o)\n", - "print(\"avg value of thyristor current=%.3f A\" %I_TA)\n", - "print(\"rms value of thyristor current=%.2f A\" %I_Tr)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n", - " \n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=179.330 V\n", - "avg o/p current=17.93 A\n", - "avg value of thyristor current=8.967 A\n", - "rms value of thyristor current=12.68 A\n", - "pf=0.7797\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.33, Page No 363" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "a=30.0\n", - "L=.0015\n", - "\n", - "#Calculations\n", - "V_o=2*V_m* math.cos(math.radians(a))/math.pi \n", - "R=10\n", - "I_o=V_o/R \n", - "f=50\n", - "w=2*math.pi*f\n", - "V_ox=2*V_m*math.cos(math.radians(a))/math.pi-w*L*I_o/math.pi \n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-I_o*w*L/V_m))-a \n", - "I=I_o\n", - "pf=V_o*I_o/(V*I) \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.3f V\" %V_ox)\n", - "print(\"angle of overlap=%.3f deg\" %u)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=176.640 V\n", - "angle of overlap=2.855 deg\n", - "pf=0.7797\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.34, Page No 364" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=415.0\n", - "V_ml=math.sqrt(2)*V\n", - "a1=35.0 #firing angle advance\n", - "\n", - "#Calculations\n", - "a=180-a1\n", - "I_o=80.0\n", - "r_s=0.04\n", - "v_T=1.5\n", - "X_l=.25 #reactance=w*L\n", - "E=-3*V_ml*math.cos(math.radians(a))/math.pi+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi \n", - "\n", - "#Results\n", - "print(\"mean generator voltage=%.3f V\" %E)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mean generator voltage=487.590 V\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.35, Page No 364" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=415.0\n", - "V_ml=math.sqrt(2)*V\n", - "R=0.2\n", - "I_o=80\n", - "r_s=0.04\n", - "v_T=1.5\n", - "\n", - "#Calculations\n", - "X_l=.25 #reactance=w*L\n", - "a=35\n", - "E=-(-3*V_ml*math.cos(math.radians(a))/math.pi+I_o*R+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi) \n", - "a1=35\n", - "a=180-a1\n", - "E=(-3*V_ml*math.cos(math.radians(a))/math.pi+I_o*R+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi) \n", - "\n", - "#Results\n", - "print(\"when firing angle=35deg\") \n", - "print(\"mean generator voltage=%.3f V\" %E)\n", - "print(\"when firing angle advance=35deg\")\n", - "print(\"mean generator voltage=%.3f V\" %E)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when firing angle=35deg\n", - "mean generator voltage=503.590 V\n", - "when firing angle advance=35deg\n", - "mean generator voltage=503.590 V\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.36, Page No 365" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=5.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_mp=math.sqrt(2)*V\n", - "a=30.0\n", - "E=150.0\n", - "B=180-math.degrees(math.asin(E/V_mp))\n", - "I_o=(3/(2*math.pi*R))*(V_mp*(math.cos(math.radians(a+30))-math.cos(math.radians(B)))-E*((B-a-30)*math.pi/180))\n", - "\n", - "#Results\n", - "print(\"avg current flowing=%.2f A\" %I_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg current flowing=19.96 A\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.37, Page No 366" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V\n", - "V_o=V_m*(1+math.cos(math.radians(a)))/math.pi \n", - "E=100\n", - "R=10\n", - "I_o=(V_o-E)/R \n", - "I_TA=I_o*math.pi/(2*math.pi) \n", - "I_Tr=math.sqrt(I_o**2*math.pi/(2*math.pi)) \n", - "I_s=math.sqrt(I_o**2*(1-a/180)*math.pi/(math.pi))\n", - "I_or=I_o\n", - "P=E*I_o+I_or**2*R\n", - "pf=(P/(V*I_s)) \n", - "f=50\n", - "w=2*math.pi*f\n", - "t_c=(1-a/180)*math.pi/w \n", - "\n", - "#Results\n", - "print(\"\\navg o/p current=%.2f A\" %I_o)\n", - "print(\"avg o/p voltage=%.3f V\" %V_o)\n", - "print(\"avg value of thyristor current=%.2f A\" %I_TA)\n", - "print(\"rms value of thyristor current=%.3f A\" %I_Tr)\n", - "print(\"avg value of diode current=%.2f A\" %I_TA)\n", - "print(\"rms value of diode current=%.3f A\" %I_Tr)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"circuit turn off time=%.2f ms\" %(t_c*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "avg o/p current=9.32 A\n", - "avg o/p voltage=193.202 V\n", - "avg value of thyristor current=4.66 A\n", - "rms value of thyristor current=6.590 A\n", - "avg value of diode current=4.66 A\n", - "rms value of diode current=6.590 A\n", - "pf=0.9202\n", - "circuit turn off time=8.33 ms\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.38, Page No 368" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "L=0.05\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "a=30\n", - "i_cp=2*V_m*(1-math.cos(math.radians(a)))/(w*L) \n", - "R=30.0\n", - "i_l=V_m/R\n", - "i1=i_cp+i_l \n", - "i2=i_cp \n", - "\n", - "#Results\n", - "print(\"peak value of circulating current=%.3f A\" %i_cp)\n", - "print(\"peak value of current in convertor 1=%.3f A\" %i1)\n", - "print(\"peak value of current in convertor 2=%.3f A\" %i2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak value of circulating current=5.548 A\n", - "peak value of current in convertor 1=16.391 A\n", - "peak value of current in convertor 2=5.548 A\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.39, Page No 370" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "R=5.0\n", - "L=0.05\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(w*L/R)) \n", - "phi=90+math.degrees(math.atan(w*L/R)) \n", - "\n", - "#Results\n", - "print(\"for no current transients\")\n", - "print(\"triggering angle=%.2f deg\" %phi)\n", - "print(\"for worst transients\")\n", - "print(\"triggering angle=%.2f deg\" %phi)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for no current transients\n", - "triggering angle=162.34 deg\n", - "for worst transients\n", - "triggering angle=162.34 deg\n" - ] - } - ], - "prompt_number": 34 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter6_2.ipynb b/_Power_Electronics/Chapter6_2.ipynb deleted file mode 100755 index dff6564b..00000000 --- a/_Power_Electronics/Chapter6_2.ipynb +++ /dev/null @@ -1,1761 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 06 : Phase Controlled Rectifiers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.1, Page No 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "P=1000.0\n", - "R=V**2/P\n", - "\n", - "#Calculations\n", - "a=math.pi/4\n", - "V_or1=(math.sqrt(2)*V/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a)+.5*math.sin(2*a))\n", - "P1=V_or1**2/R \n", - "a=math.pi/2\n", - "V_or2=(math.sqrt(2)*V/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a)+.5*math.sin(2*a))\n", - "P2=V_or2**2/R \n", - "\n", - "#Results\n", - "print(\"when firing angle delay is of 45deg\")\n", - "print(\"power absorbed=%.2f W\" %P1)\n", - "print(\"when firing angle delay is of 90deg\")\n", - "print(\"power absorbed=%.2f W\" %P2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when firing angle delay is of 45deg\n", - "power absorbed=454.58 W\n", - "when firing angle delay is of 90deg\n", - "power absorbed=250.00 W\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.2, Page No 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "\n", - "#Calculations\n", - "th1=math.sin(math.radians(E/(math.sqrt(2)*V)))\n", - "I_o=(1/(2*math.pi*R))*(2*math.sqrt(2)*230*math.cos(math.radians(th1))-E*(math.pi-2*th1*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*(math.pi-2*th1*math.pi/180)+V**2*math.sin(math.radians(2*th1))-4*math.sqrt(2)*V*E*math.cos(math.radians(th1))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or)\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.3f W\" %P_r) \n", - "print(\"supply pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=3.5679 A\n", - "power supplied to the battery=535.18 W\n", - "power dissipated by the resistor=829.760 W\n", - "supply pf=0.583\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.3 Page No 284" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "a=35.0\n", - "\n", - "#Calculations\n", - "th1=math.degrees(math.asin(E/(math.sqrt(2)*V)))\n", - "th2=180-th1\n", - "I_o=(1/(2*math.pi*R))*(math.sqrt(2)*230*(math.cos(math.radians(a))-math.cos(math.radians(th2)))-E*((th2-a)*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*((th2-a)*math.pi/180)-(V**2/2)*(math.sin(math.radians(2*th2))-math.sin(math.radians(2*a)))-2*math.sqrt(2)*V*E*(math.cos(math.radians(a))-math.cos(math.radians(th2)))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or) \n", - "\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.2f W\" %P_r)\n", - "print(\"supply pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=4.9208 A\n", - "power supplied to the battery=738.12 W\n", - "power dissipated by the resistor=689.54 W\n", - "supply pf=0.6686\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.4, Page No 285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "B=210\n", - "f=50.0 #Hz\n", - "w=2*math.pi*f\n", - "a=40.0 #firing angle\n", - "V=230.0\n", - "R=5.0\n", - "L=2*10**-3\n", - "\n", - "#Calculations\n", - "t_c1=(360-B)*math.pi/(180*w) \n", - "V_o1=(math.sqrt(2)*230/(2*math.pi))*(math.cos(math.radians(a))-math.cos(math.radians(B))) \n", - "I_o1=V_o1/R \n", - "E=110\n", - "R=5\n", - "L=2*10**-3\n", - "th1=math.degrees(math.asin(E/(math.sqrt(2)*V)))\n", - "t_c2=(360-B+th1)*math.pi/(180*w) \n", - "V_o2=(math.sqrt(2)*230/(2*math.pi))*(math.cos(math.radians(a))-math.cos(math.radians(B))) \n", - "I_o2=(1/(2*math.pi*R))*(math.sqrt(2)*230*(math.cos(math.radians(a))-math.cos(math.radians(B)))-E*((B-a)*math.pi/180)) \n", - "V_o2=R*I_o2+E \n", - "\n", - "\n", - "#Results\n", - "print(\"for R=5ohm and L=2mH\")\n", - "print(\"ckt turn off time=%.3f msec\" %(t_c1*1000))\n", - "print(\"avg output voltage=%.3f V\" %V_o1)\n", - "print(\"avg output current=%.4f A\" %I_o1)\n", - "print(\"for R=5ohm % L=2mH and E=110V\")\n", - "print(\"ckt turn off time=%.3f msec\" %(t_c2*1000))\n", - "print(\"avg output current=%.4f A\" %I_o2)\n", - "print(\"avg output voltage=%.3f V\" %V_o2) " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for R=5ohm and L=2mH\n", - "ckt turn off time=8.333 msec\n", - "avg output voltage=84.489 V\n", - "avg output current=16.8979 A\n", - "for R=5ohm % L=2mH and E=110V\n", - "ckt turn off time=9.431 msec\n", - "avg output current=6.5090 A\n", - "avg output voltage=142.545 V\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.5 Page No 286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "f=50.0\n", - "R=10.0\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "V_m=(math.sqrt(2)*V_s)\n", - "V_o=V_m/(2*math.pi)*(1+math.cos(math.radians(a)))\n", - "I_o=V_o/R\n", - "V_or=(V_m/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a*math.pi/180)+.5*math.sin(math.radians(2*a)))\n", - "I_or=V_or/R\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "TUF=P_dc/(V_s*I_or) \n", - "PIV=V_m \n", - "\n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"form factor=%.3f\" %FF)\n", - "print(\"voltage ripple factor=%.4f\" %VRF)\n", - "print(\"t/f utilisation factor=%.4f\" %TUF)\n", - "print(\"PIV of thyristor=%.2f V\" %PIV)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.2834\n", - "form factor=1.879\n", - "voltage ripple factor=1.5903\n", - "t/f utilisation factor=0.1797\n", - "PIV of thyristor=325.27 V\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.6 Page No 294" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=1000.0\n", - "fos=2.5 #factor of safety\n", - "I_TAV=40.0\n", - "\n", - "#Calculations\n", - "V_m1=V/(2*fos)\n", - "P1=(2*V_m1/math.pi)*I_TAV \n", - "V_m2=V/(fos)\n", - "P2=(2*V_m2/math.pi)*I_TAV \n", - "\n", - "#Results\n", - "print(\"for mid pt convertor\")\n", - "print(\"power handled=%.3f kW\" %(P1/1000))\n", - "print(\"for bridge convertor\")\n", - "print(\"power handled=%.3f kW\" %(P2/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for mid pt convertor\n", - "power handled=5.093 kW\n", - "for bridge convertor\n", - "power handled=10.186 kW\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.7, Page No 297" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=.4\n", - "I_o=10\n", - "I_or=I_o\n", - "E=120.0\n", - "\n", - "#Calculations\n", - "a1=math.degrees(math.acos((E+I_o*R)*math.pi/(2*V_m)))\n", - "pf1=(E*I_o+I_or**2*R)/(V_s*I_or) \n", - "E=-120.0\n", - "a2=math.degrees(math.acos((E+I_o*R)*math.pi/(2*V_m))) \n", - "pf2=(-E*I_o-I_or**2*R)/(V_s*I_or) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.2f deg\" %a1)\n", - "print(\"pf=%.4f\" %pf1)\n", - "print(\"firing angle delay=%.2f deg\" %a2)\n", - "print(\"pf=%.4f\" %pf2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=53.21 deg\n", - "pf=0.5391\n", - "firing angle delay=124.07 deg\n", - "pf=0.5043\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.9 Page No 299" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "f=50.0\n", - "a=45.0\n", - "R=5.0\n", - "E=100.0\n", - "\n", - "#Calculations\n", - "V_o=((math.sqrt(2)*V_s)/(2*math.pi))*(3+math.cos(math.radians(a)))\n", - "I_o=(V_o-E)/R \n", - "P=E*I_o \n", - "\n", - "#Results\n", - "print(\"avg o/p current=%.3f A\" %I_o)\n", - "print(\"power delivered to battery=%.4f kW\" %(P/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p current=18.382 A\n", - "power delivered to battery=1.8382 kW\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.10 Page No 300" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=230\n", - "f=50.0\n", - "a=50.0\n", - "R=6.0\n", - "E=60.0\n", - "V_o1=((math.sqrt(2)*2*V_s)/(math.pi))*math.cos(math.radians(a))\n", - "I_o1=(V_o1-E)/R \n", - "\n", - "#ATQ after applying the conditions\n", - "V_o2=((math.sqrt(2)*V_s)/(math.pi))*math.cos(math.radians(a))\n", - "I_o2=(V_o2-E)/R \n", - "\n", - "print(\"avg o/p current=%.3f A\" %I_o1)\n", - "print(\"avg o/p current after change=%.2f A\" %I_o2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p current=12.184 A\n", - "avg o/p current after change=1.09 A\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.11 Page No 309" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_o=(2*V_m/math.pi)*math.cos(math.radians(a))\n", - "I_o=V_o/R\n", - "V_or=V_m/math.sqrt(2)\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "I_s1=2*math.sqrt(2)*I_o/math.pi\n", - "DF=math.cos(math.radians(a))\n", - "CDF=.90032\n", - "pf=CDF*DF \n", - "HF=math.sqrt((1/CDF**2)-1) \n", - "Q=2*V_m*I_o*math.sin(math.radians(a))/math.pi \n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"form factor=%.4f\" %FF)\n", - "print(\"voltage ripple factor=%.4f\" %VRF)\n", - "print(\"pf=%.5f\" %pf)\n", - "print(\"HF=%.5f\" %HF)\n", - "print(\"active power=%.2f W\" %P_dc) \n", - "print(\"reactive power=%.3f Var\" %Q)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.6366\n", - "form factor=1.5708\n", - "voltage ripple factor=1.2114\n", - "pf=0.63662\n", - "HF=0.48342\n", - "active power=2143.96 W\n", - "reactive power=2143.956 Var\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.12, Page No 310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_o=(V_m/math.pi)*(1+math.cos(math.radians(a)))\n", - "I_o=V_o/R\n", - "V_or=V_s*math.sqrt((1/math.pi)*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2))\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "I_s1=2*math.sqrt(2)*I_o*math.cos(math.radians(a/2))/math.pi\n", - "DF=math.cos(math.radians(a/2)) \n", - "CDF=2*math.sqrt(2)*math.cos(math.radians(a/2))/math.sqrt(math.pi*(math.pi-a*math.pi/180)) \n", - "pf=CDF*DF \n", - "HF=math.sqrt((1/CDF**2)-1) \n", - "Q=V_m*I_o*math.sin(math.radians(a))/math.pi\n", - "\n", - "#Results\n", - "print(\"form factor=%.3f\" %FF)\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"voltage ripple factor=%.3f\" %VRF) \n", - "print(\"DF=%.4f\" %DF)\n", - "print(\"CDF=%.4f\" %CDF)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"HF=%.4f\" %HF)\n", - "print(\"active power=%.3f W\" %P_dc)\n", - "print(\"reactive power=%.2f Var\" %Q)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "form factor=1.241\n", - "rectification efficiency=0.8059\n", - "voltage ripple factor=0.735\n", - "DF=0.9239\n", - "CDF=0.9605\n", - "pf=0.8874\n", - "HF=0.2899\n", - "active power=3123.973 W\n", - "reactive power=1293.99 Var\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.13, Page No 319" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_om=3*V_ml/(2*math.pi)\n", - "V_o=V_om/2\n", - "th=30\n", - "a=math.degrees(math.acos((2*math.pi*math.sqrt(3)*V_o/(3*V_ml)-1)))-th \n", - "I_o=V_o/R \n", - "V_or=V_ml/(2*math.sqrt(math.pi))*math.sqrt((5*math.pi/6-a*math.pi/180)+.5*math.sin(math.radians(2*a+2*th)))\n", - "I_or=V_or/R \n", - "RE=V_o*I_o/(V_or*I_or) \n", - "\n", - "#Results\n", - "print(\"delay angle=%.1f deg\" %a)\n", - "print(\"avg load current=%.3f A\" %I_o)\n", - "print(\"rms load current=%.3f A\" %I_or)\n", - "print(\"rectification efficiency=%.4f\" %RE)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "delay angle=67.7 deg\n", - "avg load current=7.765 A\n", - "rms load current=10.477 A\n", - "rectification efficiency=0.5494\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.15, Page No 321" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "V_ml=math.sqrt(2)*V\n", - "v_T=1.4\n", - "a1=30.0\n", - "\n", - "#Calculations\n", - "V_o1=3*V_ml/(2*math.pi)*math.cos(math.radians(a1))-v_T \n", - "a2=60.0\n", - "V_o2=3*V_ml/(2*math.pi)*math.cos(math.radians(a2))-v_T \n", - "I_o=36\n", - "I_TA=I_o/3 \n", - "I_Tr=I_o/math.sqrt(3) \n", - "P=I_TA*v_T \n", - "\n", - "#Results\n", - "print(\"for firing angle = 30deg\")\n", - "print(\"avg output voltage=%.3f V\" %V_o1)\n", - "print(\"for firing angle = 60deg\")\n", - "print(\"avg output voltage=%.2f V\" %V_o2)\n", - "print(\"avg current rating=%.0f A\" %I_TA)\n", - "print(\"rms current rating=%.3f A\" %I_Tr)\n", - "print(\"PIV of SCR=%.1f V\" %V_ml)\n", - "print(\"power dissipated=%.1f W\" %P)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle = 30deg\n", - "avg output voltage=232.509 V\n", - "for firing angle = 60deg\n", - "avg output voltage=133.65 V\n", - "avg current rating=12 A\n", - "rms current rating=20.785 A\n", - "PIV of SCR=565.7 V\n", - "power dissipated=16.8 W\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.17, Page No 331" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=200\n", - "I_o=20\n", - "R=.5\n", - "\n", - "#Calculations\n", - "V_o1=E+I_o*R\n", - "V_s=230\n", - "V_ml=math.sqrt(2)*V_s\n", - "a1=math.degrees(math.acos(V_o1*math.pi/(3*V_ml)))\n", - "th=120\n", - "I_s=math.sqrt((1/math.pi)*I_o**2*th*math.pi/180)\n", - "P=E*I_o+I_o**2*R\n", - "pf=P/(math.sqrt(3)*V_s*I_s) \n", - "V_o2=E-I_o*R\n", - "a2=math.degrees(math.acos(-V_o2*math.pi/(3*V_ml))) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.3f deg\" %a1)\n", - "print(\"pf=%.3f\" %pf)\n", - "print(\"firing angle delay=%.2f deg\" %a2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=47.461 deg\n", - "pf=0.646\n", - "firing angle delay=127.71 deg\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.18, Page No 332" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "a1=0\n", - "t_c1=(4*math.pi/3-a1*math.pi/180)/w \n", - "a2=30\n", - "t_c2=(4*math.pi/3-a2*math.pi/180)/w \n", - "\n", - "#Results\n", - "print(\"for firing angle delay=0deg\")\n", - "print(\"commutation time=%.2f ms\" %(t_c1*1000))\n", - "print(\"peak reverse voltage=%.2f V\" %(math.sqrt(2)*V))\n", - "print(\"for firing angle delay=30deg\")\n", - "print(\"commutation time=%.2f ms\" %(t_c2*1000))\n", - "print(\"peak reverse voltage=%.2f V\" %(math.sqrt(2)*V))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle delay=0deg\n", - "commutation time=13.33 ms\n", - "peak reverse voltage=325.27 V\n", - "for firing angle delay=30deg\n", - "commutation time=11.67 ms\n", - "peak reverse voltage=325.27 V\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.19, Page No 333" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*2*math.pi/(2*3)/(math.pi/3+math.sqrt(3)*math.cos(math.radians(2*a))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*math.pi/(math.sqrt(2)*3*math.cos(math.radians(a)))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=110.384 V\n", - "for constant load current\n", - "V_ph=110.38 V\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.20, Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*4*math.pi/(2*3)/(2*math.pi/3+math.sqrt(3)*(1+math.cos(math.radians(2*a)))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*2*math.pi/(math.sqrt(2)*3*(1+math.cos(math.radians(a))))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=102.459 V\n", - "for constant load current\n", - "V_ph=102.46 V\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.21, Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=90.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*4*math.pi/(2*3)/((math.pi-math.pi/2)+(math.sin(math.radians(2*a)))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*2*math.pi/(math.sqrt(2)*3*(1+math.cos(math.radians(a))))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.2f V\" %V_ph)\n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.1f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=191.19 V\n", - "for constant load current\n", - "V_ph=191.2 V\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.22 Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=200.0\n", - "I_o=20.0\n", - "R=.5\n", - "\n", - "#Calculations\n", - "V_o=E+I_o*R\n", - "V_s=230\n", - "V_ml=math.sqrt(2)*V_s\n", - "a=math.degrees(math.acos(V_o*2*math.pi/(3*V_ml)-1)) \n", - "a1=180-a\n", - "I_sr=math.sqrt((1/math.pi)*I_o**2*(a1*math.pi/180))\n", - "P=V_o*I_o\n", - "pf=P/(math.sqrt(3)*V_s*I_sr) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.2f deg\" %a)\n", - "print(\"pf=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=69.38 deg\n", - "pf=0.67\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.23, Page No 335" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "f=50.0\n", - "I_o=15.0\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "I_TA=I_o*120.0/360.0\n", - "I_Tr=math.sqrt(I_o**2*120/360)\n", - "I_sr=math.sqrt(I_o**2*120/180)\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "V_or=V_ml*math.sqrt((3/(2*math.pi))*(math.pi/3+math.sqrt(3/2)*math.cos(math.radians(2*a))))\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "VA=3*V_s/math.sqrt(3)*I_sr\n", - "TUF=P_dc/VA \n", - "pf=P_ac/VA \n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.5f\" %RE)\n", - "print(\"TUF=%.4f\" %TUF)\n", - "print(\"Input pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.95493\n", - "TUF=0.6752\n", - "Input pf=0.707\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.24, Page No 341" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I=10.0\n", - "a=45.0\n", - "V=400.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "DF=math.cos(math.radians(a))\n", - "I_o=10\n", - "I_s1=4*I_o/(math.sqrt(2)*math.pi)*math.sin(math.pi/3)\n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "I_o=1 #suppose\n", - "CDF=I_s1/I_sr \n", - "THD=math.sqrt(1/CDF**2-1) \n", - "pf=CDF*DF \n", - "P=(3*math.sqrt(2)*V*math.cos(math.radians(a))/math.pi)*I\n", - "Q=(3*math.sqrt(2)*V*math.sin(math.radians(a))/math.pi)*I \n", - " \n", - "#Results\n", - "print(\"DF=%.3f\" %DF)\n", - "print(\"CDF=%.3f\" %CDF)\n", - "print(\"THD=%.5f\" %THD)\n", - "print(\"PF=%.4f\" %pf)\n", - "print(\"active power=%.2f W\" %P) \n", - "print(\"reactive power=%.2f Var\" %Q)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "DF=0.707\n", - "CDF=0.955\n", - "THD=0.31084\n", - "PF=0.6752\n", - "active power=3819.72 W\n", - "reactive power=3819.72 Var\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.25, Page No 342" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "print(\"for firing angle=30deg\")\n", - "a=30.0\n", - "V=400.0\n", - "V_ml=math.sqrt(2)*V\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "E=350\n", - "R=10\n", - "\n", - "#Calculations\n", - "I_o=(V_o-E)/R\n", - "I_or=I_o\n", - "P1=V_o*I_o \n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "VA=3*V/math.sqrt(3)*I_sr\n", - "pf=P1/VA \n", - "a=180-60\n", - "V=400\n", - "V_ml=math.sqrt(2)*V\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "E=-350\n", - "R=10\n", - "I_o=(V_o-E)/R\n", - "I_or=I_o\n", - "P2=-V_o*I_o \n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "VA=3*V/math.sqrt(3)*I_sr\n", - "pf=P2/VA \n", - "\n", - "print(\"power delivered to load=%.2f W\" %P1)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"for firing advance angle=60deg\")\n", - "print(\"power delivered to load=%.2f W\" %P2)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=30deg\n", - "power delivered to load=5511.74 W\n", - "pf=0.4775\n", - "for firing advance angle=60deg\n", - "power delivered to load=2158.20 W\n", - "pf=0.4775\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.26, Page No 347" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0\n", - "u=15.0\n", - "\n", - "#Calculations\n", - "i=math.cos(math.radians(a))-math.cos(math.radians(a+u))\n", - "a=30\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "a=45\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "a=60\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "\n", - "#Results\n", - "print(\"for firing angle=30deg\") \n", - "print(\"overlap angle=%.1f deg\" %u)\n", - "print(\"for firing angle=45deg\") \n", - "print(\"overlap angle=%.1f deg\" %u)\n", - "print(\"for firing angle=60deg\") \n", - "print(\"overlap angle=%.2f deg\" %u)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=30deg\n", - "overlap angle=2.2 deg\n", - "for firing angle=45deg\n", - "overlap angle=2.2 deg\n", - "for firing angle=60deg\n", - "overlap angle=2.23 deg\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.28, Page No 352" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=400.0\n", - "I_o=20.0\n", - "R=1\n", - "\n", - "#Calculations\n", - "V_o=E+I_o*R\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=.004\n", - "V=230 #per phase voltage\n", - "V_ml=math.sqrt(6)*V\n", - "a=math.degrees(math.acos(math.pi/(3*V_ml)*(V_o+3*w*L*I_o/math.pi))) \n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "u=math.degrees(math.acos(math.pi/(3*V_ml)*(V_o-3*w*L*I_o/math.pi)))-a \n", - "\n", - "#Results\n", - "print(\"overlap angle=%.2f deg\" %u)\n", - "#Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=34.382 deg\n", - "overlap angle=8.22 deg\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.29, Page No 352" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "R=1\n", - "E=230\n", - "I=15.0\n", - "\n", - "#Calculations\n", - "V_o=-E+I*R\n", - "V_ml=math.sqrt(2)*V\n", - "a=math.degrees(math.acos(V_o*2*math.pi/(3*V_ml))) \n", - "L=0.004\n", - "a=math.degrees(math.acos((2*math.pi)/(3*V_ml)*(V_o+3*w*L*I/(2*math.pi)))) \n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-3*f*L*I/V_ml))-a \n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "print(\"overlap angle=%.3f deg\" %u)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=139.702 deg\n", - "firing angle delay=139.702 deg\n", - "overlap angle=1.431 deg\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.31, Page No 361" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0 #per phase\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(3.0)*math.sqrt(2)*V\n", - "w=2*math.pi*f\n", - "a1=60.0\n", - "L=0.015\n", - "i_cp=(math.sqrt(3)*V_ml/(w*L))*(1-math.sin(math.radians(a1))) \n", - "\n", - "#Results\n", - "print(\"circulating current=%.4f A\" %i_cp)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "circulating current=27.7425 A\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.32, Page No 362" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "a=30.0\n", - "\n", - "#Calculations\n", - "V_o=2*V_m* math.cos(math.radians(a))/math.pi \n", - "R=10\n", - "I_o=V_o/R \n", - "I_TA=I_o*math.pi/(2*math.pi) \n", - "I_Tr=math.sqrt(I_o**2*math.pi/(2*math.pi)) \n", - "I_s=math.sqrt(I_o**2*math.pi/(math.pi)) \n", - "I_o=I_s\n", - "pf=(V_o*I_o/(V*I_s)) \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.3f V\" %V_o)\n", - "print(\"avg o/p current=%.2f A\" %I_o)\n", - "print(\"avg value of thyristor current=%.3f A\" %I_TA)\n", - "print(\"rms value of thyristor current=%.2f A\" %I_Tr)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n", - " \n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=179.330 V\n", - "avg o/p current=17.93 A\n", - "avg value of thyristor current=8.967 A\n", - "rms value of thyristor current=12.68 A\n", - "pf=0.7797\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.33, Page No 363" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "a=30.0\n", - "L=.0015\n", - "\n", - "#Calculations\n", - "V_o=2*V_m* math.cos(math.radians(a))/math.pi \n", - "R=10\n", - "I_o=V_o/R \n", - "f=50\n", - "w=2*math.pi*f\n", - "V_ox=2*V_m*math.cos(math.radians(a))/math.pi-w*L*I_o/math.pi \n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-I_o*w*L/V_m))-a \n", - "I=I_o\n", - "pf=V_o*I_o/(V*I) \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.3f V\" %V_ox)\n", - "print(\"angle of overlap=%.3f deg\" %u)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=176.640 V\n", - "angle of overlap=2.855 deg\n", - "pf=0.7797\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.34, Page No 364" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=415.0\n", - "V_ml=math.sqrt(2)*V\n", - "a1=35.0 #firing angle advance\n", - "\n", - "#Calculations\n", - "a=180-a1\n", - "I_o=80.0\n", - "r_s=0.04\n", - "v_T=1.5\n", - "X_l=.25 #reactance=w*L\n", - "E=-3*V_ml*math.cos(math.radians(a))/math.pi+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi \n", - "\n", - "#Results\n", - "print(\"mean generator voltage=%.3f V\" %E)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mean generator voltage=487.590 V\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.35, Page No 364" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=415.0\n", - "V_ml=math.sqrt(2)*V\n", - "R=0.2\n", - "I_o=80\n", - "r_s=0.04\n", - "v_T=1.5\n", - "\n", - "#Calculations\n", - "X_l=.25 #reactance=w*L\n", - "a=35\n", - "E=-(-3*V_ml*math.cos(math.radians(a))/math.pi+I_o*R+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi) \n", - "a1=35\n", - "a=180-a1\n", - "E=(-3*V_ml*math.cos(math.radians(a))/math.pi+I_o*R+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi) \n", - "\n", - "#Results\n", - "print(\"when firing angle=35deg\") \n", - "print(\"mean generator voltage=%.3f V\" %E)\n", - "print(\"when firing angle advance=35deg\")\n", - "print(\"mean generator voltage=%.3f V\" %E)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when firing angle=35deg\n", - "mean generator voltage=503.590 V\n", - "when firing angle advance=35deg\n", - "mean generator voltage=503.590 V\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.36, Page No 365" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=5.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_mp=math.sqrt(2)*V\n", - "a=30.0\n", - "E=150.0\n", - "B=180-math.degrees(math.asin(E/V_mp))\n", - "I_o=(3/(2*math.pi*R))*(V_mp*(math.cos(math.radians(a+30))-math.cos(math.radians(B)))-E*((B-a-30)*math.pi/180))\n", - "\n", - "#Results\n", - "print(\"avg current flowing=%.2f A\" %I_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg current flowing=19.96 A\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.37, Page No 366" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V\n", - "V_o=V_m*(1+math.cos(math.radians(a)))/math.pi \n", - "E=100\n", - "R=10\n", - "I_o=(V_o-E)/R \n", - "I_TA=I_o*math.pi/(2*math.pi) \n", - "I_Tr=math.sqrt(I_o**2*math.pi/(2*math.pi)) \n", - "I_s=math.sqrt(I_o**2*(1-a/180)*math.pi/(math.pi))\n", - "I_or=I_o\n", - "P=E*I_o+I_or**2*R\n", - "pf=(P/(V*I_s)) \n", - "f=50\n", - "w=2*math.pi*f\n", - "t_c=(1-a/180)*math.pi/w \n", - "\n", - "#Results\n", - "print(\"\\navg o/p current=%.2f A\" %I_o)\n", - "print(\"avg o/p voltage=%.3f V\" %V_o)\n", - "print(\"avg value of thyristor current=%.2f A\" %I_TA)\n", - "print(\"rms value of thyristor current=%.3f A\" %I_Tr)\n", - "print(\"avg value of diode current=%.2f A\" %I_TA)\n", - "print(\"rms value of diode current=%.3f A\" %I_Tr)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"circuit turn off time=%.2f ms\" %(t_c*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "avg o/p current=9.32 A\n", - "avg o/p voltage=193.202 V\n", - "avg value of thyristor current=4.66 A\n", - "rms value of thyristor current=6.590 A\n", - "avg value of diode current=4.66 A\n", - "rms value of diode current=6.590 A\n", - "pf=0.9202\n", - "circuit turn off time=8.33 ms\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.38, Page No 368" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "L=0.05\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "a=30\n", - "i_cp=2*V_m*(1-math.cos(math.radians(a)))/(w*L) \n", - "R=30.0\n", - "i_l=V_m/R\n", - "i1=i_cp+i_l \n", - "i2=i_cp \n", - "\n", - "#Results\n", - "print(\"peak value of circulating current=%.3f A\" %i_cp)\n", - "print(\"peak value of current in convertor 1=%.3f A\" %i1)\n", - "print(\"peak value of current in convertor 2=%.3f A\" %i2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak value of circulating current=5.548 A\n", - "peak value of current in convertor 1=16.391 A\n", - "peak value of current in convertor 2=5.548 A\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.39, Page No 370" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "R=5.0\n", - "L=0.05\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(w*L/R)) \n", - "phi=90+math.degrees(math.atan(w*L/R)) \n", - "\n", - "#Results\n", - "print(\"for no current transients\")\n", - "print(\"triggering angle=%.2f deg\" %phi)\n", - "print(\"for worst transients\")\n", - "print(\"triggering angle=%.2f deg\" %phi)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for no current transients\n", - "triggering angle=162.34 deg\n", - "for worst transients\n", - "triggering angle=162.34 deg\n" - ] - } - ], - "prompt_number": 34 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter6_3.ipynb b/_Power_Electronics/Chapter6_3.ipynb deleted file mode 100755 index dff6564b..00000000 --- a/_Power_Electronics/Chapter6_3.ipynb +++ /dev/null @@ -1,1761 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 06 : Phase Controlled Rectifiers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.1, Page No 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "P=1000.0\n", - "R=V**2/P\n", - "\n", - "#Calculations\n", - "a=math.pi/4\n", - "V_or1=(math.sqrt(2)*V/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a)+.5*math.sin(2*a))\n", - "P1=V_or1**2/R \n", - "a=math.pi/2\n", - "V_or2=(math.sqrt(2)*V/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a)+.5*math.sin(2*a))\n", - "P2=V_or2**2/R \n", - "\n", - "#Results\n", - "print(\"when firing angle delay is of 45deg\")\n", - "print(\"power absorbed=%.2f W\" %P1)\n", - "print(\"when firing angle delay is of 90deg\")\n", - "print(\"power absorbed=%.2f W\" %P2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when firing angle delay is of 45deg\n", - "power absorbed=454.58 W\n", - "when firing angle delay is of 90deg\n", - "power absorbed=250.00 W\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.2, Page No 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "\n", - "#Calculations\n", - "th1=math.sin(math.radians(E/(math.sqrt(2)*V)))\n", - "I_o=(1/(2*math.pi*R))*(2*math.sqrt(2)*230*math.cos(math.radians(th1))-E*(math.pi-2*th1*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*(math.pi-2*th1*math.pi/180)+V**2*math.sin(math.radians(2*th1))-4*math.sqrt(2)*V*E*math.cos(math.radians(th1))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or)\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.3f W\" %P_r) \n", - "print(\"supply pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=3.5679 A\n", - "power supplied to the battery=535.18 W\n", - "power dissipated by the resistor=829.760 W\n", - "supply pf=0.583\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.3 Page No 284" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "a=35.0\n", - "\n", - "#Calculations\n", - "th1=math.degrees(math.asin(E/(math.sqrt(2)*V)))\n", - "th2=180-th1\n", - "I_o=(1/(2*math.pi*R))*(math.sqrt(2)*230*(math.cos(math.radians(a))-math.cos(math.radians(th2)))-E*((th2-a)*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*((th2-a)*math.pi/180)-(V**2/2)*(math.sin(math.radians(2*th2))-math.sin(math.radians(2*a)))-2*math.sqrt(2)*V*E*(math.cos(math.radians(a))-math.cos(math.radians(th2)))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or) \n", - "\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.2f W\" %P_r)\n", - "print(\"supply pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=4.9208 A\n", - "power supplied to the battery=738.12 W\n", - "power dissipated by the resistor=689.54 W\n", - "supply pf=0.6686\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.4, Page No 285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "B=210\n", - "f=50.0 #Hz\n", - "w=2*math.pi*f\n", - "a=40.0 #firing angle\n", - "V=230.0\n", - "R=5.0\n", - "L=2*10**-3\n", - "\n", - "#Calculations\n", - "t_c1=(360-B)*math.pi/(180*w) \n", - "V_o1=(math.sqrt(2)*230/(2*math.pi))*(math.cos(math.radians(a))-math.cos(math.radians(B))) \n", - "I_o1=V_o1/R \n", - "E=110\n", - "R=5\n", - "L=2*10**-3\n", - "th1=math.degrees(math.asin(E/(math.sqrt(2)*V)))\n", - "t_c2=(360-B+th1)*math.pi/(180*w) \n", - "V_o2=(math.sqrt(2)*230/(2*math.pi))*(math.cos(math.radians(a))-math.cos(math.radians(B))) \n", - "I_o2=(1/(2*math.pi*R))*(math.sqrt(2)*230*(math.cos(math.radians(a))-math.cos(math.radians(B)))-E*((B-a)*math.pi/180)) \n", - "V_o2=R*I_o2+E \n", - "\n", - "\n", - "#Results\n", - "print(\"for R=5ohm and L=2mH\")\n", - "print(\"ckt turn off time=%.3f msec\" %(t_c1*1000))\n", - "print(\"avg output voltage=%.3f V\" %V_o1)\n", - "print(\"avg output current=%.4f A\" %I_o1)\n", - "print(\"for R=5ohm % L=2mH and E=110V\")\n", - "print(\"ckt turn off time=%.3f msec\" %(t_c2*1000))\n", - "print(\"avg output current=%.4f A\" %I_o2)\n", - "print(\"avg output voltage=%.3f V\" %V_o2) " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for R=5ohm and L=2mH\n", - "ckt turn off time=8.333 msec\n", - "avg output voltage=84.489 V\n", - "avg output current=16.8979 A\n", - "for R=5ohm % L=2mH and E=110V\n", - "ckt turn off time=9.431 msec\n", - "avg output current=6.5090 A\n", - "avg output voltage=142.545 V\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.5 Page No 286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "f=50.0\n", - "R=10.0\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "V_m=(math.sqrt(2)*V_s)\n", - "V_o=V_m/(2*math.pi)*(1+math.cos(math.radians(a)))\n", - "I_o=V_o/R\n", - "V_or=(V_m/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a*math.pi/180)+.5*math.sin(math.radians(2*a)))\n", - "I_or=V_or/R\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "TUF=P_dc/(V_s*I_or) \n", - "PIV=V_m \n", - "\n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"form factor=%.3f\" %FF)\n", - "print(\"voltage ripple factor=%.4f\" %VRF)\n", - "print(\"t/f utilisation factor=%.4f\" %TUF)\n", - "print(\"PIV of thyristor=%.2f V\" %PIV)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.2834\n", - "form factor=1.879\n", - "voltage ripple factor=1.5903\n", - "t/f utilisation factor=0.1797\n", - "PIV of thyristor=325.27 V\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.6 Page No 294" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=1000.0\n", - "fos=2.5 #factor of safety\n", - "I_TAV=40.0\n", - "\n", - "#Calculations\n", - "V_m1=V/(2*fos)\n", - "P1=(2*V_m1/math.pi)*I_TAV \n", - "V_m2=V/(fos)\n", - "P2=(2*V_m2/math.pi)*I_TAV \n", - "\n", - "#Results\n", - "print(\"for mid pt convertor\")\n", - "print(\"power handled=%.3f kW\" %(P1/1000))\n", - "print(\"for bridge convertor\")\n", - "print(\"power handled=%.3f kW\" %(P2/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for mid pt convertor\n", - "power handled=5.093 kW\n", - "for bridge convertor\n", - "power handled=10.186 kW\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.7, Page No 297" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=.4\n", - "I_o=10\n", - "I_or=I_o\n", - "E=120.0\n", - "\n", - "#Calculations\n", - "a1=math.degrees(math.acos((E+I_o*R)*math.pi/(2*V_m)))\n", - "pf1=(E*I_o+I_or**2*R)/(V_s*I_or) \n", - "E=-120.0\n", - "a2=math.degrees(math.acos((E+I_o*R)*math.pi/(2*V_m))) \n", - "pf2=(-E*I_o-I_or**2*R)/(V_s*I_or) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.2f deg\" %a1)\n", - "print(\"pf=%.4f\" %pf1)\n", - "print(\"firing angle delay=%.2f deg\" %a2)\n", - "print(\"pf=%.4f\" %pf2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=53.21 deg\n", - "pf=0.5391\n", - "firing angle delay=124.07 deg\n", - "pf=0.5043\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.9 Page No 299" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "f=50.0\n", - "a=45.0\n", - "R=5.0\n", - "E=100.0\n", - "\n", - "#Calculations\n", - "V_o=((math.sqrt(2)*V_s)/(2*math.pi))*(3+math.cos(math.radians(a)))\n", - "I_o=(V_o-E)/R \n", - "P=E*I_o \n", - "\n", - "#Results\n", - "print(\"avg o/p current=%.3f A\" %I_o)\n", - "print(\"power delivered to battery=%.4f kW\" %(P/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p current=18.382 A\n", - "power delivered to battery=1.8382 kW\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.10 Page No 300" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=230\n", - "f=50.0\n", - "a=50.0\n", - "R=6.0\n", - "E=60.0\n", - "V_o1=((math.sqrt(2)*2*V_s)/(math.pi))*math.cos(math.radians(a))\n", - "I_o1=(V_o1-E)/R \n", - "\n", - "#ATQ after applying the conditions\n", - "V_o2=((math.sqrt(2)*V_s)/(math.pi))*math.cos(math.radians(a))\n", - "I_o2=(V_o2-E)/R \n", - "\n", - "print(\"avg o/p current=%.3f A\" %I_o1)\n", - "print(\"avg o/p current after change=%.2f A\" %I_o2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p current=12.184 A\n", - "avg o/p current after change=1.09 A\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.11 Page No 309" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_o=(2*V_m/math.pi)*math.cos(math.radians(a))\n", - "I_o=V_o/R\n", - "V_or=V_m/math.sqrt(2)\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "I_s1=2*math.sqrt(2)*I_o/math.pi\n", - "DF=math.cos(math.radians(a))\n", - "CDF=.90032\n", - "pf=CDF*DF \n", - "HF=math.sqrt((1/CDF**2)-1) \n", - "Q=2*V_m*I_o*math.sin(math.radians(a))/math.pi \n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"form factor=%.4f\" %FF)\n", - "print(\"voltage ripple factor=%.4f\" %VRF)\n", - "print(\"pf=%.5f\" %pf)\n", - "print(\"HF=%.5f\" %HF)\n", - "print(\"active power=%.2f W\" %P_dc) \n", - "print(\"reactive power=%.3f Var\" %Q)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.6366\n", - "form factor=1.5708\n", - "voltage ripple factor=1.2114\n", - "pf=0.63662\n", - "HF=0.48342\n", - "active power=2143.96 W\n", - "reactive power=2143.956 Var\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.12, Page No 310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_o=(V_m/math.pi)*(1+math.cos(math.radians(a)))\n", - "I_o=V_o/R\n", - "V_or=V_s*math.sqrt((1/math.pi)*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2))\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "I_s1=2*math.sqrt(2)*I_o*math.cos(math.radians(a/2))/math.pi\n", - "DF=math.cos(math.radians(a/2)) \n", - "CDF=2*math.sqrt(2)*math.cos(math.radians(a/2))/math.sqrt(math.pi*(math.pi-a*math.pi/180)) \n", - "pf=CDF*DF \n", - "HF=math.sqrt((1/CDF**2)-1) \n", - "Q=V_m*I_o*math.sin(math.radians(a))/math.pi\n", - "\n", - "#Results\n", - "print(\"form factor=%.3f\" %FF)\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"voltage ripple factor=%.3f\" %VRF) \n", - "print(\"DF=%.4f\" %DF)\n", - "print(\"CDF=%.4f\" %CDF)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"HF=%.4f\" %HF)\n", - "print(\"active power=%.3f W\" %P_dc)\n", - "print(\"reactive power=%.2f Var\" %Q)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "form factor=1.241\n", - "rectification efficiency=0.8059\n", - "voltage ripple factor=0.735\n", - "DF=0.9239\n", - "CDF=0.9605\n", - "pf=0.8874\n", - "HF=0.2899\n", - "active power=3123.973 W\n", - "reactive power=1293.99 Var\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.13, Page No 319" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_om=3*V_ml/(2*math.pi)\n", - "V_o=V_om/2\n", - "th=30\n", - "a=math.degrees(math.acos((2*math.pi*math.sqrt(3)*V_o/(3*V_ml)-1)))-th \n", - "I_o=V_o/R \n", - "V_or=V_ml/(2*math.sqrt(math.pi))*math.sqrt((5*math.pi/6-a*math.pi/180)+.5*math.sin(math.radians(2*a+2*th)))\n", - "I_or=V_or/R \n", - "RE=V_o*I_o/(V_or*I_or) \n", - "\n", - "#Results\n", - "print(\"delay angle=%.1f deg\" %a)\n", - "print(\"avg load current=%.3f A\" %I_o)\n", - "print(\"rms load current=%.3f A\" %I_or)\n", - "print(\"rectification efficiency=%.4f\" %RE)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "delay angle=67.7 deg\n", - "avg load current=7.765 A\n", - "rms load current=10.477 A\n", - "rectification efficiency=0.5494\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.15, Page No 321" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "V_ml=math.sqrt(2)*V\n", - "v_T=1.4\n", - "a1=30.0\n", - "\n", - "#Calculations\n", - "V_o1=3*V_ml/(2*math.pi)*math.cos(math.radians(a1))-v_T \n", - "a2=60.0\n", - "V_o2=3*V_ml/(2*math.pi)*math.cos(math.radians(a2))-v_T \n", - "I_o=36\n", - "I_TA=I_o/3 \n", - "I_Tr=I_o/math.sqrt(3) \n", - "P=I_TA*v_T \n", - "\n", - "#Results\n", - "print(\"for firing angle = 30deg\")\n", - "print(\"avg output voltage=%.3f V\" %V_o1)\n", - "print(\"for firing angle = 60deg\")\n", - "print(\"avg output voltage=%.2f V\" %V_o2)\n", - "print(\"avg current rating=%.0f A\" %I_TA)\n", - "print(\"rms current rating=%.3f A\" %I_Tr)\n", - "print(\"PIV of SCR=%.1f V\" %V_ml)\n", - "print(\"power dissipated=%.1f W\" %P)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle = 30deg\n", - "avg output voltage=232.509 V\n", - "for firing angle = 60deg\n", - "avg output voltage=133.65 V\n", - "avg current rating=12 A\n", - "rms current rating=20.785 A\n", - "PIV of SCR=565.7 V\n", - "power dissipated=16.8 W\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.17, Page No 331" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=200\n", - "I_o=20\n", - "R=.5\n", - "\n", - "#Calculations\n", - "V_o1=E+I_o*R\n", - "V_s=230\n", - "V_ml=math.sqrt(2)*V_s\n", - "a1=math.degrees(math.acos(V_o1*math.pi/(3*V_ml)))\n", - "th=120\n", - "I_s=math.sqrt((1/math.pi)*I_o**2*th*math.pi/180)\n", - "P=E*I_o+I_o**2*R\n", - "pf=P/(math.sqrt(3)*V_s*I_s) \n", - "V_o2=E-I_o*R\n", - "a2=math.degrees(math.acos(-V_o2*math.pi/(3*V_ml))) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.3f deg\" %a1)\n", - "print(\"pf=%.3f\" %pf)\n", - "print(\"firing angle delay=%.2f deg\" %a2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=47.461 deg\n", - "pf=0.646\n", - "firing angle delay=127.71 deg\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.18, Page No 332" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "a1=0\n", - "t_c1=(4*math.pi/3-a1*math.pi/180)/w \n", - "a2=30\n", - "t_c2=(4*math.pi/3-a2*math.pi/180)/w \n", - "\n", - "#Results\n", - "print(\"for firing angle delay=0deg\")\n", - "print(\"commutation time=%.2f ms\" %(t_c1*1000))\n", - "print(\"peak reverse voltage=%.2f V\" %(math.sqrt(2)*V))\n", - "print(\"for firing angle delay=30deg\")\n", - "print(\"commutation time=%.2f ms\" %(t_c2*1000))\n", - "print(\"peak reverse voltage=%.2f V\" %(math.sqrt(2)*V))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle delay=0deg\n", - "commutation time=13.33 ms\n", - "peak reverse voltage=325.27 V\n", - "for firing angle delay=30deg\n", - "commutation time=11.67 ms\n", - "peak reverse voltage=325.27 V\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.19, Page No 333" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*2*math.pi/(2*3)/(math.pi/3+math.sqrt(3)*math.cos(math.radians(2*a))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*math.pi/(math.sqrt(2)*3*math.cos(math.radians(a)))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=110.384 V\n", - "for constant load current\n", - "V_ph=110.38 V\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.20, Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*4*math.pi/(2*3)/(2*math.pi/3+math.sqrt(3)*(1+math.cos(math.radians(2*a)))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*2*math.pi/(math.sqrt(2)*3*(1+math.cos(math.radians(a))))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=102.459 V\n", - "for constant load current\n", - "V_ph=102.46 V\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.21, Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=90.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*4*math.pi/(2*3)/((math.pi-math.pi/2)+(math.sin(math.radians(2*a)))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*2*math.pi/(math.sqrt(2)*3*(1+math.cos(math.radians(a))))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.2f V\" %V_ph)\n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.1f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=191.19 V\n", - "for constant load current\n", - "V_ph=191.2 V\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.22 Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=200.0\n", - "I_o=20.0\n", - "R=.5\n", - "\n", - "#Calculations\n", - "V_o=E+I_o*R\n", - "V_s=230\n", - "V_ml=math.sqrt(2)*V_s\n", - "a=math.degrees(math.acos(V_o*2*math.pi/(3*V_ml)-1)) \n", - "a1=180-a\n", - "I_sr=math.sqrt((1/math.pi)*I_o**2*(a1*math.pi/180))\n", - "P=V_o*I_o\n", - "pf=P/(math.sqrt(3)*V_s*I_sr) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.2f deg\" %a)\n", - "print(\"pf=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=69.38 deg\n", - "pf=0.67\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.23, Page No 335" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "f=50.0\n", - "I_o=15.0\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "I_TA=I_o*120.0/360.0\n", - "I_Tr=math.sqrt(I_o**2*120/360)\n", - "I_sr=math.sqrt(I_o**2*120/180)\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "V_or=V_ml*math.sqrt((3/(2*math.pi))*(math.pi/3+math.sqrt(3/2)*math.cos(math.radians(2*a))))\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "VA=3*V_s/math.sqrt(3)*I_sr\n", - "TUF=P_dc/VA \n", - "pf=P_ac/VA \n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.5f\" %RE)\n", - "print(\"TUF=%.4f\" %TUF)\n", - "print(\"Input pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.95493\n", - "TUF=0.6752\n", - "Input pf=0.707\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.24, Page No 341" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I=10.0\n", - "a=45.0\n", - "V=400.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "DF=math.cos(math.radians(a))\n", - "I_o=10\n", - "I_s1=4*I_o/(math.sqrt(2)*math.pi)*math.sin(math.pi/3)\n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "I_o=1 #suppose\n", - "CDF=I_s1/I_sr \n", - "THD=math.sqrt(1/CDF**2-1) \n", - "pf=CDF*DF \n", - "P=(3*math.sqrt(2)*V*math.cos(math.radians(a))/math.pi)*I\n", - "Q=(3*math.sqrt(2)*V*math.sin(math.radians(a))/math.pi)*I \n", - " \n", - "#Results\n", - "print(\"DF=%.3f\" %DF)\n", - "print(\"CDF=%.3f\" %CDF)\n", - "print(\"THD=%.5f\" %THD)\n", - "print(\"PF=%.4f\" %pf)\n", - "print(\"active power=%.2f W\" %P) \n", - "print(\"reactive power=%.2f Var\" %Q)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "DF=0.707\n", - "CDF=0.955\n", - "THD=0.31084\n", - "PF=0.6752\n", - "active power=3819.72 W\n", - "reactive power=3819.72 Var\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.25, Page No 342" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "print(\"for firing angle=30deg\")\n", - "a=30.0\n", - "V=400.0\n", - "V_ml=math.sqrt(2)*V\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "E=350\n", - "R=10\n", - "\n", - "#Calculations\n", - "I_o=(V_o-E)/R\n", - "I_or=I_o\n", - "P1=V_o*I_o \n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "VA=3*V/math.sqrt(3)*I_sr\n", - "pf=P1/VA \n", - "a=180-60\n", - "V=400\n", - "V_ml=math.sqrt(2)*V\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "E=-350\n", - "R=10\n", - "I_o=(V_o-E)/R\n", - "I_or=I_o\n", - "P2=-V_o*I_o \n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "VA=3*V/math.sqrt(3)*I_sr\n", - "pf=P2/VA \n", - "\n", - "print(\"power delivered to load=%.2f W\" %P1)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"for firing advance angle=60deg\")\n", - "print(\"power delivered to load=%.2f W\" %P2)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=30deg\n", - "power delivered to load=5511.74 W\n", - "pf=0.4775\n", - "for firing advance angle=60deg\n", - "power delivered to load=2158.20 W\n", - "pf=0.4775\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.26, Page No 347" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0\n", - "u=15.0\n", - "\n", - "#Calculations\n", - "i=math.cos(math.radians(a))-math.cos(math.radians(a+u))\n", - "a=30\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "a=45\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "a=60\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "\n", - "#Results\n", - "print(\"for firing angle=30deg\") \n", - "print(\"overlap angle=%.1f deg\" %u)\n", - "print(\"for firing angle=45deg\") \n", - "print(\"overlap angle=%.1f deg\" %u)\n", - "print(\"for firing angle=60deg\") \n", - "print(\"overlap angle=%.2f deg\" %u)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=30deg\n", - "overlap angle=2.2 deg\n", - "for firing angle=45deg\n", - "overlap angle=2.2 deg\n", - "for firing angle=60deg\n", - "overlap angle=2.23 deg\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.28, Page No 352" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=400.0\n", - "I_o=20.0\n", - "R=1\n", - "\n", - "#Calculations\n", - "V_o=E+I_o*R\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=.004\n", - "V=230 #per phase voltage\n", - "V_ml=math.sqrt(6)*V\n", - "a=math.degrees(math.acos(math.pi/(3*V_ml)*(V_o+3*w*L*I_o/math.pi))) \n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "u=math.degrees(math.acos(math.pi/(3*V_ml)*(V_o-3*w*L*I_o/math.pi)))-a \n", - "\n", - "#Results\n", - "print(\"overlap angle=%.2f deg\" %u)\n", - "#Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=34.382 deg\n", - "overlap angle=8.22 deg\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.29, Page No 352" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "R=1\n", - "E=230\n", - "I=15.0\n", - "\n", - "#Calculations\n", - "V_o=-E+I*R\n", - "V_ml=math.sqrt(2)*V\n", - "a=math.degrees(math.acos(V_o*2*math.pi/(3*V_ml))) \n", - "L=0.004\n", - "a=math.degrees(math.acos((2*math.pi)/(3*V_ml)*(V_o+3*w*L*I/(2*math.pi)))) \n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-3*f*L*I/V_ml))-a \n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "print(\"overlap angle=%.3f deg\" %u)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=139.702 deg\n", - "firing angle delay=139.702 deg\n", - "overlap angle=1.431 deg\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.31, Page No 361" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0 #per phase\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(3.0)*math.sqrt(2)*V\n", - "w=2*math.pi*f\n", - "a1=60.0\n", - "L=0.015\n", - "i_cp=(math.sqrt(3)*V_ml/(w*L))*(1-math.sin(math.radians(a1))) \n", - "\n", - "#Results\n", - "print(\"circulating current=%.4f A\" %i_cp)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "circulating current=27.7425 A\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.32, Page No 362" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "a=30.0\n", - "\n", - "#Calculations\n", - "V_o=2*V_m* math.cos(math.radians(a))/math.pi \n", - "R=10\n", - "I_o=V_o/R \n", - "I_TA=I_o*math.pi/(2*math.pi) \n", - "I_Tr=math.sqrt(I_o**2*math.pi/(2*math.pi)) \n", - "I_s=math.sqrt(I_o**2*math.pi/(math.pi)) \n", - "I_o=I_s\n", - "pf=(V_o*I_o/(V*I_s)) \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.3f V\" %V_o)\n", - "print(\"avg o/p current=%.2f A\" %I_o)\n", - "print(\"avg value of thyristor current=%.3f A\" %I_TA)\n", - "print(\"rms value of thyristor current=%.2f A\" %I_Tr)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n", - " \n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=179.330 V\n", - "avg o/p current=17.93 A\n", - "avg value of thyristor current=8.967 A\n", - "rms value of thyristor current=12.68 A\n", - "pf=0.7797\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.33, Page No 363" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "a=30.0\n", - "L=.0015\n", - "\n", - "#Calculations\n", - "V_o=2*V_m* math.cos(math.radians(a))/math.pi \n", - "R=10\n", - "I_o=V_o/R \n", - "f=50\n", - "w=2*math.pi*f\n", - "V_ox=2*V_m*math.cos(math.radians(a))/math.pi-w*L*I_o/math.pi \n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-I_o*w*L/V_m))-a \n", - "I=I_o\n", - "pf=V_o*I_o/(V*I) \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.3f V\" %V_ox)\n", - "print(\"angle of overlap=%.3f deg\" %u)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=176.640 V\n", - "angle of overlap=2.855 deg\n", - "pf=0.7797\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.34, Page No 364" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=415.0\n", - "V_ml=math.sqrt(2)*V\n", - "a1=35.0 #firing angle advance\n", - "\n", - "#Calculations\n", - "a=180-a1\n", - "I_o=80.0\n", - "r_s=0.04\n", - "v_T=1.5\n", - "X_l=.25 #reactance=w*L\n", - "E=-3*V_ml*math.cos(math.radians(a))/math.pi+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi \n", - "\n", - "#Results\n", - "print(\"mean generator voltage=%.3f V\" %E)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mean generator voltage=487.590 V\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.35, Page No 364" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=415.0\n", - "V_ml=math.sqrt(2)*V\n", - "R=0.2\n", - "I_o=80\n", - "r_s=0.04\n", - "v_T=1.5\n", - "\n", - "#Calculations\n", - "X_l=.25 #reactance=w*L\n", - "a=35\n", - "E=-(-3*V_ml*math.cos(math.radians(a))/math.pi+I_o*R+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi) \n", - "a1=35\n", - "a=180-a1\n", - "E=(-3*V_ml*math.cos(math.radians(a))/math.pi+I_o*R+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi) \n", - "\n", - "#Results\n", - "print(\"when firing angle=35deg\") \n", - "print(\"mean generator voltage=%.3f V\" %E)\n", - "print(\"when firing angle advance=35deg\")\n", - "print(\"mean generator voltage=%.3f V\" %E)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when firing angle=35deg\n", - "mean generator voltage=503.590 V\n", - "when firing angle advance=35deg\n", - "mean generator voltage=503.590 V\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.36, Page No 365" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=5.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_mp=math.sqrt(2)*V\n", - "a=30.0\n", - "E=150.0\n", - "B=180-math.degrees(math.asin(E/V_mp))\n", - "I_o=(3/(2*math.pi*R))*(V_mp*(math.cos(math.radians(a+30))-math.cos(math.radians(B)))-E*((B-a-30)*math.pi/180))\n", - "\n", - "#Results\n", - "print(\"avg current flowing=%.2f A\" %I_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg current flowing=19.96 A\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.37, Page No 366" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V\n", - "V_o=V_m*(1+math.cos(math.radians(a)))/math.pi \n", - "E=100\n", - "R=10\n", - "I_o=(V_o-E)/R \n", - "I_TA=I_o*math.pi/(2*math.pi) \n", - "I_Tr=math.sqrt(I_o**2*math.pi/(2*math.pi)) \n", - "I_s=math.sqrt(I_o**2*(1-a/180)*math.pi/(math.pi))\n", - "I_or=I_o\n", - "P=E*I_o+I_or**2*R\n", - "pf=(P/(V*I_s)) \n", - "f=50\n", - "w=2*math.pi*f\n", - "t_c=(1-a/180)*math.pi/w \n", - "\n", - "#Results\n", - "print(\"\\navg o/p current=%.2f A\" %I_o)\n", - "print(\"avg o/p voltage=%.3f V\" %V_o)\n", - "print(\"avg value of thyristor current=%.2f A\" %I_TA)\n", - "print(\"rms value of thyristor current=%.3f A\" %I_Tr)\n", - "print(\"avg value of diode current=%.2f A\" %I_TA)\n", - "print(\"rms value of diode current=%.3f A\" %I_Tr)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"circuit turn off time=%.2f ms\" %(t_c*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "avg o/p current=9.32 A\n", - "avg o/p voltage=193.202 V\n", - "avg value of thyristor current=4.66 A\n", - "rms value of thyristor current=6.590 A\n", - "avg value of diode current=4.66 A\n", - "rms value of diode current=6.590 A\n", - "pf=0.9202\n", - "circuit turn off time=8.33 ms\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.38, Page No 368" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "L=0.05\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "a=30\n", - "i_cp=2*V_m*(1-math.cos(math.radians(a)))/(w*L) \n", - "R=30.0\n", - "i_l=V_m/R\n", - "i1=i_cp+i_l \n", - "i2=i_cp \n", - "\n", - "#Results\n", - "print(\"peak value of circulating current=%.3f A\" %i_cp)\n", - "print(\"peak value of current in convertor 1=%.3f A\" %i1)\n", - "print(\"peak value of current in convertor 2=%.3f A\" %i2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak value of circulating current=5.548 A\n", - "peak value of current in convertor 1=16.391 A\n", - "peak value of current in convertor 2=5.548 A\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.39, Page No 370" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "R=5.0\n", - "L=0.05\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(w*L/R)) \n", - "phi=90+math.degrees(math.atan(w*L/R)) \n", - "\n", - "#Results\n", - "print(\"for no current transients\")\n", - "print(\"triggering angle=%.2f deg\" %phi)\n", - "print(\"for worst transients\")\n", - "print(\"triggering angle=%.2f deg\" %phi)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for no current transients\n", - "triggering angle=162.34 deg\n", - "for worst transients\n", - "triggering angle=162.34 deg\n" - ] - } - ], - "prompt_number": 34 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter6_4.ipynb b/_Power_Electronics/Chapter6_4.ipynb deleted file mode 100755 index dff6564b..00000000 --- a/_Power_Electronics/Chapter6_4.ipynb +++ /dev/null @@ -1,1761 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 06 : Phase Controlled Rectifiers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.1, Page No 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "P=1000.0\n", - "R=V**2/P\n", - "\n", - "#Calculations\n", - "a=math.pi/4\n", - "V_or1=(math.sqrt(2)*V/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a)+.5*math.sin(2*a))\n", - "P1=V_or1**2/R \n", - "a=math.pi/2\n", - "V_or2=(math.sqrt(2)*V/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a)+.5*math.sin(2*a))\n", - "P2=V_or2**2/R \n", - "\n", - "#Results\n", - "print(\"when firing angle delay is of 45deg\")\n", - "print(\"power absorbed=%.2f W\" %P1)\n", - "print(\"when firing angle delay is of 90deg\")\n", - "print(\"power absorbed=%.2f W\" %P2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when firing angle delay is of 45deg\n", - "power absorbed=454.58 W\n", - "when firing angle delay is of 90deg\n", - "power absorbed=250.00 W\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.2, Page No 283" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "\n", - "#Calculations\n", - "th1=math.sin(math.radians(E/(math.sqrt(2)*V)))\n", - "I_o=(1/(2*math.pi*R))*(2*math.sqrt(2)*230*math.cos(math.radians(th1))-E*(math.pi-2*th1*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*(math.pi-2*th1*math.pi/180)+V**2*math.sin(math.radians(2*th1))-4*math.sqrt(2)*V*E*math.cos(math.radians(th1))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or)\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.3f W\" %P_r) \n", - "print(\"supply pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=3.5679 A\n", - "power supplied to the battery=535.18 W\n", - "power dissipated by the resistor=829.760 W\n", - "supply pf=0.583\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.3 Page No 284" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "E=150.0\n", - "R=8.0\n", - "a=35.0\n", - "\n", - "#Calculations\n", - "th1=math.degrees(math.asin(E/(math.sqrt(2)*V)))\n", - "th2=180-th1\n", - "I_o=(1/(2*math.pi*R))*(math.sqrt(2)*230*(math.cos(math.radians(a))-math.cos(math.radians(th2)))-E*((th2-a)*math.pi/180)) \n", - "P=E*I_o \n", - "I_or=math.sqrt((1/(2*math.pi*R**2))*((V**2+E**2)*((th2-a)*math.pi/180)-(V**2/2)*(math.sin(math.radians(2*th2))-math.sin(math.radians(2*a)))-2*math.sqrt(2)*V*E*(math.cos(math.radians(a))-math.cos(math.radians(th2)))))\n", - "P_r=I_or**2*R \n", - "pf=(P+P_r)/(V*I_or) \n", - "\n", - "\n", - "#Results\n", - "print(\"avg charging curent=%.4f A\" %I_o)\n", - "print(\"power supplied to the battery=%.2f W\" %P)\n", - "print(\"power dissipated by the resistor=%.2f W\" %P_r)\n", - "print(\"supply pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg charging curent=4.9208 A\n", - "power supplied to the battery=738.12 W\n", - "power dissipated by the resistor=689.54 W\n", - "supply pf=0.6686\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.4, Page No 285" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "B=210\n", - "f=50.0 #Hz\n", - "w=2*math.pi*f\n", - "a=40.0 #firing angle\n", - "V=230.0\n", - "R=5.0\n", - "L=2*10**-3\n", - "\n", - "#Calculations\n", - "t_c1=(360-B)*math.pi/(180*w) \n", - "V_o1=(math.sqrt(2)*230/(2*math.pi))*(math.cos(math.radians(a))-math.cos(math.radians(B))) \n", - "I_o1=V_o1/R \n", - "E=110\n", - "R=5\n", - "L=2*10**-3\n", - "th1=math.degrees(math.asin(E/(math.sqrt(2)*V)))\n", - "t_c2=(360-B+th1)*math.pi/(180*w) \n", - "V_o2=(math.sqrt(2)*230/(2*math.pi))*(math.cos(math.radians(a))-math.cos(math.radians(B))) \n", - "I_o2=(1/(2*math.pi*R))*(math.sqrt(2)*230*(math.cos(math.radians(a))-math.cos(math.radians(B)))-E*((B-a)*math.pi/180)) \n", - "V_o2=R*I_o2+E \n", - "\n", - "\n", - "#Results\n", - "print(\"for R=5ohm and L=2mH\")\n", - "print(\"ckt turn off time=%.3f msec\" %(t_c1*1000))\n", - "print(\"avg output voltage=%.3f V\" %V_o1)\n", - "print(\"avg output current=%.4f A\" %I_o1)\n", - "print(\"for R=5ohm % L=2mH and E=110V\")\n", - "print(\"ckt turn off time=%.3f msec\" %(t_c2*1000))\n", - "print(\"avg output current=%.4f A\" %I_o2)\n", - "print(\"avg output voltage=%.3f V\" %V_o2) " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for R=5ohm and L=2mH\n", - "ckt turn off time=8.333 msec\n", - "avg output voltage=84.489 V\n", - "avg output current=16.8979 A\n", - "for R=5ohm % L=2mH and E=110V\n", - "ckt turn off time=9.431 msec\n", - "avg output current=6.5090 A\n", - "avg output voltage=142.545 V\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.5 Page No 286" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "f=50.0\n", - "R=10.0\n", - "a=60.0\n", - "\n", - "#Calculations\n", - "V_m=(math.sqrt(2)*V_s)\n", - "V_o=V_m/(2*math.pi)*(1+math.cos(math.radians(a)))\n", - "I_o=V_o/R\n", - "V_or=(V_m/(2*math.sqrt(math.pi)))*math.sqrt((math.pi-a*math.pi/180)+.5*math.sin(math.radians(2*a)))\n", - "I_or=V_or/R\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "TUF=P_dc/(V_s*I_or) \n", - "PIV=V_m \n", - "\n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"form factor=%.3f\" %FF)\n", - "print(\"voltage ripple factor=%.4f\" %VRF)\n", - "print(\"t/f utilisation factor=%.4f\" %TUF)\n", - "print(\"PIV of thyristor=%.2f V\" %PIV)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.2834\n", - "form factor=1.879\n", - "voltage ripple factor=1.5903\n", - "t/f utilisation factor=0.1797\n", - "PIV of thyristor=325.27 V\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.6 Page No 294" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=1000.0\n", - "fos=2.5 #factor of safety\n", - "I_TAV=40.0\n", - "\n", - "#Calculations\n", - "V_m1=V/(2*fos)\n", - "P1=(2*V_m1/math.pi)*I_TAV \n", - "V_m2=V/(fos)\n", - "P2=(2*V_m2/math.pi)*I_TAV \n", - "\n", - "#Results\n", - "print(\"for mid pt convertor\")\n", - "print(\"power handled=%.3f kW\" %(P1/1000))\n", - "print(\"for bridge convertor\")\n", - "print(\"power handled=%.3f kW\" %(P2/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for mid pt convertor\n", - "power handled=5.093 kW\n", - "for bridge convertor\n", - "power handled=10.186 kW\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.7, Page No 297" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=.4\n", - "I_o=10\n", - "I_or=I_o\n", - "E=120.0\n", - "\n", - "#Calculations\n", - "a1=math.degrees(math.acos((E+I_o*R)*math.pi/(2*V_m)))\n", - "pf1=(E*I_o+I_or**2*R)/(V_s*I_or) \n", - "E=-120.0\n", - "a2=math.degrees(math.acos((E+I_o*R)*math.pi/(2*V_m))) \n", - "pf2=(-E*I_o-I_or**2*R)/(V_s*I_or) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.2f deg\" %a1)\n", - "print(\"pf=%.4f\" %pf1)\n", - "print(\"firing angle delay=%.2f deg\" %a2)\n", - "print(\"pf=%.4f\" %pf2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=53.21 deg\n", - "pf=0.5391\n", - "firing angle delay=124.07 deg\n", - "pf=0.5043\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.9 Page No 299" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "f=50.0\n", - "a=45.0\n", - "R=5.0\n", - "E=100.0\n", - "\n", - "#Calculations\n", - "V_o=((math.sqrt(2)*V_s)/(2*math.pi))*(3+math.cos(math.radians(a)))\n", - "I_o=(V_o-E)/R \n", - "P=E*I_o \n", - "\n", - "#Results\n", - "print(\"avg o/p current=%.3f A\" %I_o)\n", - "print(\"power delivered to battery=%.4f kW\" %(P/1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p current=18.382 A\n", - "power delivered to battery=1.8382 kW\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.10 Page No 300" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=230\n", - "f=50.0\n", - "a=50.0\n", - "R=6.0\n", - "E=60.0\n", - "V_o1=((math.sqrt(2)*2*V_s)/(math.pi))*math.cos(math.radians(a))\n", - "I_o1=(V_o1-E)/R \n", - "\n", - "#ATQ after applying the conditions\n", - "V_o2=((math.sqrt(2)*V_s)/(math.pi))*math.cos(math.radians(a))\n", - "I_o2=(V_o2-E)/R \n", - "\n", - "print(\"avg o/p current=%.3f A\" %I_o1)\n", - "print(\"avg o/p current after change=%.2f A\" %I_o2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p current=12.184 A\n", - "avg o/p current after change=1.09 A\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.11 Page No 309" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_o=(2*V_m/math.pi)*math.cos(math.radians(a))\n", - "I_o=V_o/R\n", - "V_or=V_m/math.sqrt(2)\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "I_s1=2*math.sqrt(2)*I_o/math.pi\n", - "DF=math.cos(math.radians(a))\n", - "CDF=.90032\n", - "pf=CDF*DF \n", - "HF=math.sqrt((1/CDF**2)-1) \n", - "Q=2*V_m*I_o*math.sin(math.radians(a))/math.pi \n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"form factor=%.4f\" %FF)\n", - "print(\"voltage ripple factor=%.4f\" %VRF)\n", - "print(\"pf=%.5f\" %pf)\n", - "print(\"HF=%.5f\" %HF)\n", - "print(\"active power=%.2f W\" %P_dc) \n", - "print(\"reactive power=%.3f Var\" %Q)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.6366\n", - "form factor=1.5708\n", - "voltage ripple factor=1.2114\n", - "pf=0.63662\n", - "HF=0.48342\n", - "active power=2143.96 W\n", - "reactive power=2143.956 Var\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.12, Page No 310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_o=(V_m/math.pi)*(1+math.cos(math.radians(a)))\n", - "I_o=V_o/R\n", - "V_or=V_s*math.sqrt((1/math.pi)*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2))\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "FF=V_or/V_o \n", - "VRF=math.sqrt(FF**2-1) \n", - "I_s1=2*math.sqrt(2)*I_o*math.cos(math.radians(a/2))/math.pi\n", - "DF=math.cos(math.radians(a/2)) \n", - "CDF=2*math.sqrt(2)*math.cos(math.radians(a/2))/math.sqrt(math.pi*(math.pi-a*math.pi/180)) \n", - "pf=CDF*DF \n", - "HF=math.sqrt((1/CDF**2)-1) \n", - "Q=V_m*I_o*math.sin(math.radians(a))/math.pi\n", - "\n", - "#Results\n", - "print(\"form factor=%.3f\" %FF)\n", - "print(\"rectification efficiency=%.4f\" %RE)\n", - "print(\"voltage ripple factor=%.3f\" %VRF) \n", - "print(\"DF=%.4f\" %DF)\n", - "print(\"CDF=%.4f\" %CDF)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"HF=%.4f\" %HF)\n", - "print(\"active power=%.3f W\" %P_dc)\n", - "print(\"reactive power=%.2f Var\" %Q)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "form factor=1.241\n", - "rectification efficiency=0.8059\n", - "voltage ripple factor=0.735\n", - "DF=0.9239\n", - "CDF=0.9605\n", - "pf=0.8874\n", - "HF=0.2899\n", - "active power=3123.973 W\n", - "reactive power=1293.99 Var\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.13, Page No 319" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_om=3*V_ml/(2*math.pi)\n", - "V_o=V_om/2\n", - "th=30\n", - "a=math.degrees(math.acos((2*math.pi*math.sqrt(3)*V_o/(3*V_ml)-1)))-th \n", - "I_o=V_o/R \n", - "V_or=V_ml/(2*math.sqrt(math.pi))*math.sqrt((5*math.pi/6-a*math.pi/180)+.5*math.sin(math.radians(2*a+2*th)))\n", - "I_or=V_or/R \n", - "RE=V_o*I_o/(V_or*I_or) \n", - "\n", - "#Results\n", - "print(\"delay angle=%.1f deg\" %a)\n", - "print(\"avg load current=%.3f A\" %I_o)\n", - "print(\"rms load current=%.3f A\" %I_or)\n", - "print(\"rectification efficiency=%.4f\" %RE)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "delay angle=67.7 deg\n", - "avg load current=7.765 A\n", - "rms load current=10.477 A\n", - "rectification efficiency=0.5494\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.15, Page No 321" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "V_ml=math.sqrt(2)*V\n", - "v_T=1.4\n", - "a1=30.0\n", - "\n", - "#Calculations\n", - "V_o1=3*V_ml/(2*math.pi)*math.cos(math.radians(a1))-v_T \n", - "a2=60.0\n", - "V_o2=3*V_ml/(2*math.pi)*math.cos(math.radians(a2))-v_T \n", - "I_o=36\n", - "I_TA=I_o/3 \n", - "I_Tr=I_o/math.sqrt(3) \n", - "P=I_TA*v_T \n", - "\n", - "#Results\n", - "print(\"for firing angle = 30deg\")\n", - "print(\"avg output voltage=%.3f V\" %V_o1)\n", - "print(\"for firing angle = 60deg\")\n", - "print(\"avg output voltage=%.2f V\" %V_o2)\n", - "print(\"avg current rating=%.0f A\" %I_TA)\n", - "print(\"rms current rating=%.3f A\" %I_Tr)\n", - "print(\"PIV of SCR=%.1f V\" %V_ml)\n", - "print(\"power dissipated=%.1f W\" %P)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle = 30deg\n", - "avg output voltage=232.509 V\n", - "for firing angle = 60deg\n", - "avg output voltage=133.65 V\n", - "avg current rating=12 A\n", - "rms current rating=20.785 A\n", - "PIV of SCR=565.7 V\n", - "power dissipated=16.8 W\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.17, Page No 331" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=200\n", - "I_o=20\n", - "R=.5\n", - "\n", - "#Calculations\n", - "V_o1=E+I_o*R\n", - "V_s=230\n", - "V_ml=math.sqrt(2)*V_s\n", - "a1=math.degrees(math.acos(V_o1*math.pi/(3*V_ml)))\n", - "th=120\n", - "I_s=math.sqrt((1/math.pi)*I_o**2*th*math.pi/180)\n", - "P=E*I_o+I_o**2*R\n", - "pf=P/(math.sqrt(3)*V_s*I_s) \n", - "V_o2=E-I_o*R\n", - "a2=math.degrees(math.acos(-V_o2*math.pi/(3*V_ml))) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.3f deg\" %a1)\n", - "print(\"pf=%.3f\" %pf)\n", - "print(\"firing angle delay=%.2f deg\" %a2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=47.461 deg\n", - "pf=0.646\n", - "firing angle delay=127.71 deg\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.18, Page No 332" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "a1=0\n", - "t_c1=(4*math.pi/3-a1*math.pi/180)/w \n", - "a2=30\n", - "t_c2=(4*math.pi/3-a2*math.pi/180)/w \n", - "\n", - "#Results\n", - "print(\"for firing angle delay=0deg\")\n", - "print(\"commutation time=%.2f ms\" %(t_c1*1000))\n", - "print(\"peak reverse voltage=%.2f V\" %(math.sqrt(2)*V))\n", - "print(\"for firing angle delay=30deg\")\n", - "print(\"commutation time=%.2f ms\" %(t_c2*1000))\n", - "print(\"peak reverse voltage=%.2f V\" %(math.sqrt(2)*V))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle delay=0deg\n", - "commutation time=13.33 ms\n", - "peak reverse voltage=325.27 V\n", - "for firing angle delay=30deg\n", - "commutation time=11.67 ms\n", - "peak reverse voltage=325.27 V\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.19, Page No 333" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*2*math.pi/(2*3)/(math.pi/3+math.sqrt(3)*math.cos(math.radians(2*a))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*math.pi/(math.sqrt(2)*3*math.cos(math.radians(a)))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=110.384 V\n", - "for constant load current\n", - "V_ph=110.38 V\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.20, Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*4*math.pi/(2*3)/(2*math.pi/3+math.sqrt(3)*(1+math.cos(math.radians(2*a)))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*2*math.pi/(math.sqrt(2)*3*(1+math.cos(math.radians(a))))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=102.459 V\n", - "for constant load current\n", - "V_ph=102.46 V\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.21, Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=90.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*4*math.pi/(2*3)/((math.pi-math.pi/2)+(math.sin(math.radians(2*a)))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*2*math.pi/(math.sqrt(2)*3*(1+math.cos(math.radians(a))))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage percent V_ph=%.2f V\" %V_ph)\n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.1f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage percent V_ph=191.19 V\n", - "for constant load current\n", - "V_ph=191.2 V\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.22 Page No 334" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=200.0\n", - "I_o=20.0\n", - "R=.5\n", - "\n", - "#Calculations\n", - "V_o=E+I_o*R\n", - "V_s=230\n", - "V_ml=math.sqrt(2)*V_s\n", - "a=math.degrees(math.acos(V_o*2*math.pi/(3*V_ml)-1)) \n", - "a1=180-a\n", - "I_sr=math.sqrt((1/math.pi)*I_o**2*(a1*math.pi/180))\n", - "P=V_o*I_o\n", - "pf=P/(math.sqrt(3)*V_s*I_sr) \n", - "\n", - "#Results\n", - "print(\"firing angle delay=%.2f deg\" %a)\n", - "print(\"pf=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=69.38 deg\n", - "pf=0.67\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.23, Page No 335" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=400.0\n", - "f=50.0\n", - "I_o=15.0\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "I_TA=I_o*120.0/360.0\n", - "I_Tr=math.sqrt(I_o**2*120/360)\n", - "I_sr=math.sqrt(I_o**2*120/180)\n", - "V_ml=math.sqrt(2)*V_s\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "V_or=V_ml*math.sqrt((3/(2*math.pi))*(math.pi/3+math.sqrt(3/2)*math.cos(math.radians(2*a))))\n", - "I_or=I_o\n", - "P_dc=V_o*I_o\n", - "P_ac=V_or*I_or\n", - "RE=P_dc/P_ac \n", - "VA=3*V_s/math.sqrt(3)*I_sr\n", - "TUF=P_dc/VA \n", - "pf=P_ac/VA \n", - "\n", - "#Results\n", - "print(\"rectification efficiency=%.5f\" %RE)\n", - "print(\"TUF=%.4f\" %TUF)\n", - "print(\"Input pf=%.3f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rectification efficiency=0.95493\n", - "TUF=0.6752\n", - "Input pf=0.707\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.24, Page No 341" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I=10.0\n", - "a=45.0\n", - "V=400.0\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "DF=math.cos(math.radians(a))\n", - "I_o=10\n", - "I_s1=4*I_o/(math.sqrt(2)*math.pi)*math.sin(math.pi/3)\n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "I_o=1 #suppose\n", - "CDF=I_s1/I_sr \n", - "THD=math.sqrt(1/CDF**2-1) \n", - "pf=CDF*DF \n", - "P=(3*math.sqrt(2)*V*math.cos(math.radians(a))/math.pi)*I\n", - "Q=(3*math.sqrt(2)*V*math.sin(math.radians(a))/math.pi)*I \n", - " \n", - "#Results\n", - "print(\"DF=%.3f\" %DF)\n", - "print(\"CDF=%.3f\" %CDF)\n", - "print(\"THD=%.5f\" %THD)\n", - "print(\"PF=%.4f\" %pf)\n", - "print(\"active power=%.2f W\" %P) \n", - "print(\"reactive power=%.2f Var\" %Q)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "DF=0.707\n", - "CDF=0.955\n", - "THD=0.31084\n", - "PF=0.6752\n", - "active power=3819.72 W\n", - "reactive power=3819.72 Var\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.25, Page No 342" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "print(\"for firing angle=30deg\")\n", - "a=30.0\n", - "V=400.0\n", - "V_ml=math.sqrt(2)*V\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "E=350\n", - "R=10\n", - "\n", - "#Calculations\n", - "I_o=(V_o-E)/R\n", - "I_or=I_o\n", - "P1=V_o*I_o \n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "VA=3*V/math.sqrt(3)*I_sr\n", - "pf=P1/VA \n", - "a=180-60\n", - "V=400\n", - "V_ml=math.sqrt(2)*V\n", - "V_o=3*V_ml*math.cos(math.radians(a))/math.pi\n", - "E=-350\n", - "R=10\n", - "I_o=(V_o-E)/R\n", - "I_or=I_o\n", - "P2=-V_o*I_o \n", - "I_sr=I_o*math.sqrt(2.0/3.0)\n", - "VA=3*V/math.sqrt(3)*I_sr\n", - "pf=P2/VA \n", - "\n", - "print(\"power delivered to load=%.2f W\" %P1)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"for firing advance angle=60deg\")\n", - "print(\"power delivered to load=%.2f W\" %P2)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=30deg\n", - "power delivered to load=5511.74 W\n", - "pf=0.4775\n", - "for firing advance angle=60deg\n", - "power delivered to load=2158.20 W\n", - "pf=0.4775\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.26, Page No 347" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0\n", - "u=15.0\n", - "\n", - "#Calculations\n", - "i=math.cos(math.radians(a))-math.cos(math.radians(a+u))\n", - "a=30\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "a=45\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "a=60\n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-i))-a \n", - "\n", - "#Results\n", - "print(\"for firing angle=30deg\") \n", - "print(\"overlap angle=%.1f deg\" %u)\n", - "print(\"for firing angle=45deg\") \n", - "print(\"overlap angle=%.1f deg\" %u)\n", - "print(\"for firing angle=60deg\") \n", - "print(\"overlap angle=%.2f deg\" %u)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle=30deg\n", - "overlap angle=2.2 deg\n", - "for firing angle=45deg\n", - "overlap angle=2.2 deg\n", - "for firing angle=60deg\n", - "overlap angle=2.23 deg\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.28, Page No 352" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "E=400.0\n", - "I_o=20.0\n", - "R=1\n", - "\n", - "#Calculations\n", - "V_o=E+I_o*R\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=.004\n", - "V=230 #per phase voltage\n", - "V_ml=math.sqrt(6)*V\n", - "a=math.degrees(math.acos(math.pi/(3*V_ml)*(V_o+3*w*L*I_o/math.pi))) \n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "u=math.degrees(math.acos(math.pi/(3*V_ml)*(V_o-3*w*L*I_o/math.pi)))-a \n", - "\n", - "#Results\n", - "print(\"overlap angle=%.2f deg\" %u)\n", - "#Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=34.382 deg\n", - "overlap angle=8.22 deg\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.29, Page No 352" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=400.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "R=1\n", - "E=230\n", - "I=15.0\n", - "\n", - "#Calculations\n", - "V_o=-E+I*R\n", - "V_ml=math.sqrt(2)*V\n", - "a=math.degrees(math.acos(V_o*2*math.pi/(3*V_ml))) \n", - "L=0.004\n", - "a=math.degrees(math.acos((2*math.pi)/(3*V_ml)*(V_o+3*w*L*I/(2*math.pi)))) \n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-3*f*L*I/V_ml))-a \n", - "\n", - "#Results\n", - "print(\"firing angle=%.3f deg\" %a)\n", - "print(\"firing angle delay=%.3f deg\" %a)\n", - "print(\"overlap angle=%.3f deg\" %u)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle=139.702 deg\n", - "firing angle delay=139.702 deg\n", - "overlap angle=1.431 deg\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.31, Page No 361" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0 #per phase\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "V_ml=math.sqrt(3.0)*math.sqrt(2)*V\n", - "w=2*math.pi*f\n", - "a1=60.0\n", - "L=0.015\n", - "i_cp=(math.sqrt(3)*V_ml/(w*L))*(1-math.sin(math.radians(a1))) \n", - "\n", - "#Results\n", - "print(\"circulating current=%.4f A\" %i_cp)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "circulating current=27.7425 A\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.32, Page No 362" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "a=30.0\n", - "\n", - "#Calculations\n", - "V_o=2*V_m* math.cos(math.radians(a))/math.pi \n", - "R=10\n", - "I_o=V_o/R \n", - "I_TA=I_o*math.pi/(2*math.pi) \n", - "I_Tr=math.sqrt(I_o**2*math.pi/(2*math.pi)) \n", - "I_s=math.sqrt(I_o**2*math.pi/(math.pi)) \n", - "I_o=I_s\n", - "pf=(V_o*I_o/(V*I_s)) \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.3f V\" %V_o)\n", - "print(\"avg o/p current=%.2f A\" %I_o)\n", - "print(\"avg value of thyristor current=%.3f A\" %I_TA)\n", - "print(\"rms value of thyristor current=%.2f A\" %I_Tr)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits.\n", - " \n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=179.330 V\n", - "avg o/p current=17.93 A\n", - "avg value of thyristor current=8.967 A\n", - "rms value of thyristor current=12.68 A\n", - "pf=0.7797\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.33, Page No 363" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "a=30.0\n", - "L=.0015\n", - "\n", - "#Calculations\n", - "V_o=2*V_m* math.cos(math.radians(a))/math.pi \n", - "R=10\n", - "I_o=V_o/R \n", - "f=50\n", - "w=2*math.pi*f\n", - "V_ox=2*V_m*math.cos(math.radians(a))/math.pi-w*L*I_o/math.pi \n", - "u=math.degrees(math.acos(math.cos(math.radians(a))-I_o*w*L/V_m))-a \n", - "I=I_o\n", - "pf=V_o*I_o/(V*I) \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.3f V\" %V_ox)\n", - "print(\"angle of overlap=%.3f deg\" %u)\n", - "print(\"pf=%.4f\" %pf)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=176.640 V\n", - "angle of overlap=2.855 deg\n", - "pf=0.7797\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.34, Page No 364" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=415.0\n", - "V_ml=math.sqrt(2)*V\n", - "a1=35.0 #firing angle advance\n", - "\n", - "#Calculations\n", - "a=180-a1\n", - "I_o=80.0\n", - "r_s=0.04\n", - "v_T=1.5\n", - "X_l=.25 #reactance=w*L\n", - "E=-3*V_ml*math.cos(math.radians(a))/math.pi+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi \n", - "\n", - "#Results\n", - "print(\"mean generator voltage=%.3f V\" %E)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mean generator voltage=487.590 V\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.35, Page No 364" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=415.0\n", - "V_ml=math.sqrt(2)*V\n", - "R=0.2\n", - "I_o=80\n", - "r_s=0.04\n", - "v_T=1.5\n", - "\n", - "#Calculations\n", - "X_l=.25 #reactance=w*L\n", - "a=35\n", - "E=-(-3*V_ml*math.cos(math.radians(a))/math.pi+I_o*R+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi) \n", - "a1=35\n", - "a=180-a1\n", - "E=(-3*V_ml*math.cos(math.radians(a))/math.pi+I_o*R+2*I_o*r_s+2*v_T+3*X_l*I_o/math.pi) \n", - "\n", - "#Results\n", - "print(\"when firing angle=35deg\") \n", - "print(\"mean generator voltage=%.3f V\" %E)\n", - "print(\"when firing angle advance=35deg\")\n", - "print(\"mean generator voltage=%.3f V\" %E)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when firing angle=35deg\n", - "mean generator voltage=503.590 V\n", - "when firing angle advance=35deg\n", - "mean generator voltage=503.590 V\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.36, Page No 365" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=5.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_mp=math.sqrt(2)*V\n", - "a=30.0\n", - "E=150.0\n", - "B=180-math.degrees(math.asin(E/V_mp))\n", - "I_o=(3/(2*math.pi*R))*(V_mp*(math.cos(math.radians(a+30))-math.cos(math.radians(B)))-E*((B-a-30)*math.pi/180))\n", - "\n", - "#Results\n", - "print(\"avg current flowing=%.2f A\" %I_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg current flowing=19.96 A\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.37, Page No 366" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "V=230.0\n", - "\n", - "#Calculations\n", - "V_m=math.sqrt(2)*V\n", - "V_o=V_m*(1+math.cos(math.radians(a)))/math.pi \n", - "E=100\n", - "R=10\n", - "I_o=(V_o-E)/R \n", - "I_TA=I_o*math.pi/(2*math.pi) \n", - "I_Tr=math.sqrt(I_o**2*math.pi/(2*math.pi)) \n", - "I_s=math.sqrt(I_o**2*(1-a/180)*math.pi/(math.pi))\n", - "I_or=I_o\n", - "P=E*I_o+I_or**2*R\n", - "pf=(P/(V*I_s)) \n", - "f=50\n", - "w=2*math.pi*f\n", - "t_c=(1-a/180)*math.pi/w \n", - "\n", - "#Results\n", - "print(\"\\navg o/p current=%.2f A\" %I_o)\n", - "print(\"avg o/p voltage=%.3f V\" %V_o)\n", - "print(\"avg value of thyristor current=%.2f A\" %I_TA)\n", - "print(\"rms value of thyristor current=%.3f A\" %I_Tr)\n", - "print(\"avg value of diode current=%.2f A\" %I_TA)\n", - "print(\"rms value of diode current=%.3f A\" %I_Tr)\n", - "print(\"pf=%.4f\" %pf)\n", - "print(\"circuit turn off time=%.2f ms\" %(t_c*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "avg o/p current=9.32 A\n", - "avg o/p voltage=193.202 V\n", - "avg value of thyristor current=4.66 A\n", - "rms value of thyristor current=6.590 A\n", - "avg value of diode current=4.66 A\n", - "rms value of diode current=6.590 A\n", - "pf=0.9202\n", - "circuit turn off time=8.33 ms\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.38, Page No 368" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "V_m=math.sqrt(2)*V\n", - "L=0.05\n", - "f=50.0\n", - "\n", - "#Calculations\n", - "w=2*math.pi*f\n", - "a=30\n", - "i_cp=2*V_m*(1-math.cos(math.radians(a)))/(w*L) \n", - "R=30.0\n", - "i_l=V_m/R\n", - "i1=i_cp+i_l \n", - "i2=i_cp \n", - "\n", - "#Results\n", - "print(\"peak value of circulating current=%.3f A\" %i_cp)\n", - "print(\"peak value of current in convertor 1=%.3f A\" %i1)\n", - "print(\"peak value of current in convertor 2=%.3f A\" %i2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "peak value of circulating current=5.548 A\n", - "peak value of current in convertor 1=16.391 A\n", - "peak value of current in convertor 2=5.548 A\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.39, Page No 370" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "R=5.0\n", - "L=0.05\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(w*L/R)) \n", - "phi=90+math.degrees(math.atan(w*L/R)) \n", - "\n", - "#Results\n", - "print(\"for no current transients\")\n", - "print(\"triggering angle=%.2f deg\" %phi)\n", - "print(\"for worst transients\")\n", - "print(\"triggering angle=%.2f deg\" %phi)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for no current transients\n", - "triggering angle=162.34 deg\n", - "for worst transients\n", - "triggering angle=162.34 deg\n" - ] - } - ], - "prompt_number": 34 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter7.ipynb b/_Power_Electronics/Chapter7.ipynb deleted file mode 100755 index 726160c8..00000000 --- a/_Power_Electronics/Chapter7.ipynb +++ /dev/null @@ -1,1036 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 07 : Choppers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.2, Page No 387" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.4 #duty cycle %a=T_on/T\n", - "V_s=230.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V=a*(V_s-2) \n", - "V_or=math.sqrt(a*(V_s-2)**2) \n", - "P_o=V_or**2/R\n", - "P_i=V_s*V/R\n", - "n=P_o*100/P_i \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.1f V\" %V)\n", - "print(\"rms value of o/p voltage=%.1f V\" %V_or)\n", - "print(\"chopper efficiency in percentage=%.2f\" %n)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=91.2 V\n", - "rms value of o/p voltage=144.2 V\n", - "chopper efficiency in percentage=99.13\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.3, Page No 388" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_i=220.0\n", - "V_o=660.0\n", - "\n", - "#Calculations\n", - "a=1-V_i/V_o\n", - "T_on=100.0 #microsecond\n", - "T=T_on/a\n", - "T_off=T-T_on \n", - "T_off=T_off/2\n", - "T_on=T-T_off\n", - "a=T_on/T\n", - "V_o=V_i/(1-a)\n", - "\n", - "#Results \n", - "print(\"pulse width of o/p voltage=%.0f us\" %T_off)\n", - "print(\"\\nnew o/p voltage=%.0f V\" %V_o)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "pulse width of o/p voltage=25 us\n", - "\n", - "new o/p voltage=1320 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.4 Page No 288" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_1=12.0\n", - "I_2=16.0\n", - "\n", - "#Calculations\n", - "I_0=(I_1+I_2)/2\n", - "R=10.0\n", - "V_0=I_0*R\n", - "V_s=200.0\n", - "a=V_0/V_s\n", - "r=a/(1-a)\n", - "\n", - "#Results\n", - "print(\"time ratio(T_on/T_off)=%.3f\" %r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time ratio(T_on/T_off)=2.333\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.5, Page No 390" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=660.0\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "a=(V_o/V_s)/(1+(V_o/V_s))\n", - "T_on=120\n", - "T=T_on/a\n", - "T_off=T-T_on \n", - "T_off=3*T_off\n", - "T_on=T-T_off\n", - "a=T_on/(T_on+T_off)\n", - "V_o=V_s*(a/(1-a)) \n", - "\n", - "#Results\n", - "print(\"pulse width o/p voltage=%.0f us\" %T_off)\n", - "print(\"\\nnew o/p voltage=%.2f V\" %V_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "pulse width o/p voltage=120 us\n", - "\n", - "new o/p voltage=73.33 V\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.11 Page No 408" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=1.0\n", - "L=.005\n", - "T_a=L/R\n", - "T=2000*10**-6\n", - "E=24.0\n", - "V_s=220\n", - "T_on=600*10**-6\n", - "a=T_on/T\n", - "\n", - "#Calculations\n", - "a1=(T_a/T)*math.log(1+(E/V_s)*((math.exp(T/T_a))-1))\n", - "if a1a :\n", - " print(\"load current is continuous\")\n", - "else:\n", - " print(\"load current is discontinuous\")\n", - "\n", - "t_x=T_on+L*math.log(1+((V_s-E)/272)*(1-math.exp(-T_on/T_a)))\n", - " #Value of t_x wrongly calculated in the book so ans of V_o and I_o varies\n", - "V_o=a*V_s+(1-t_x/T)*E \n", - "I_o=(V_o-E)/R \n", - "I_mx=(V_s-E)/R*(1-math.exp(-T_on/T_a)) \n", - "\n", - "#Results \n", - "print(\"avg o/p voltage=%.2f V\" %V_o)\n", - "print(\"avg o/p current=%.2f A\" %I_o) \n", - "print(\"max value of load current=%.1f A\" %I_mx)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "load current is discontinuous\n", - "avg o/p voltage=121.77 V\n", - "avg o/p current=49.77 A\n", - "max value of load current=81.5 A\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.13, Page No 412" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.2\n", - "V_s=500\n", - "E=a*V_s\n", - "L=0.06\n", - "I=10\n", - "\n", - "#Calculations\n", - "T_on=(L*I)/(V_s-E)\n", - "f=a/T_on \n", - "\n", - "#Results\n", - "print(\"chopping freq=%.2f Hz\" %f)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "chopping freq=133.33 Hz\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.14 Page No 412" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.5\n", - "pu=0.1 #pu ripple\n", - "\n", - "#Calculations\n", - " #x=T/T_a\n", - " #y=exp(-a*x)\n", - "y=(1-pu)/(1+pu)\n", - " #after solving\n", - "x=math.log(1/y)/a\n", - "f=1000\n", - "T=1/f\n", - "T_a=T/x\n", - "R=2\n", - "L=R*T_a\n", - "Li=0.002\n", - "Le=L-Li \n", - "\n", - "#Results\n", - "print(\"external inductance=%.3f mH\" %(Le*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "external inductance=-2.000 mH\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.15 Page No 414" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=10.0\n", - "L=0.015\n", - "T_a=L/R\n", - "f=1250.0\n", - "T=1.0/f\n", - "a=0.5\n", - "T_on=a*T\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "I_mx=(V_s/R)*((1-math.exp(-T_on/T_a))/(1-math.exp(-T/T_a))) \n", - "I_mn=(V_s/R)*((math.exp(T_on/T_a)-1)/(math.exp(T/T_a)-1)) \n", - "dI=I_mx-I_mn \n", - "V_o=a*V_s\n", - "I_o=V_o/R \n", - "I_or=math.sqrt(I_mx**2+dI**2/3+I_mx*dI) \n", - "I_chr=math.sqrt(a)*I_or \n", - "\n", - "#Results\n", - "print(\"Max value of ripple current=%.2f A\" %dI)\n", - "print(\"Max value of load current=%.3f A\" %I_mx)\n", - "print(\"Min value of load current=%.2f A\" %I_mn)\n", - "print(\"Avg value of load current=%.2f A\" %I_o) \n", - "print(\"rms value of load current=%.2f A\" %I_or)\n", - "print(\"rms value of chopper current=%.2f A\" %I_chr)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Max value of ripple current=2.92 A\n", - "Max value of load current=12.458 A\n", - "Min value of load current=9.54 A\n", - "Avg value of load current=11.00 A\n", - "rms value of load current=13.94 A\n", - "rms value of chopper current=9.86 A\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.17 Page No 417" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=0.0016\n", - "C=4*10**-6\n", - "\n", - "#Calculations\n", - "w=1/math.sqrt(L*C)\n", - "t=math.pi/w \n", - "\n", - "\n", - "#Results\n", - "print(\"time for which current flows=%.2f us\" %(t*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time for which current flows=251.33 us\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.18, Page No 424" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t_q=20.0*10**-6\n", - "dt=20.0*10**-6\n", - "\n", - "#Calculations\n", - "t_c=t_q+dt\n", - "I_0=60.0\n", - "V_s=60.0\n", - "C=t_c*I_0/V_s \n", - "\n", - "#Results \n", - "print(\"value of commutating capacitor=%.0f uF\" %(C*10**6))\n", - "\n", - "L1=(V_s/I_0)**2*C\n", - "L2=(2*t_c/math.pi)**2/C\n", - "if L1>L2 :\n", - " print(\"value of commutating inductor=%.0f uH\" %(L1*10**6))\n", - "else:\n", - " print(\"value of commutating inductor=%.0f uH\" %(L2*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of commutating capacitor=40 uF\n", - "value of commutating inductor=40 uH\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.19, Page No 424" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t=100.0*10**-6\n", - "R=10.0\n", - "\n", - "#Calculations\n", - " #V_s*(1-2*math.exp(-t/(R*C)))=0\n", - "C=-t/(R*math.log(1.0/2)) \n", - "L=(4/9.0)*C*R**2 \n", - "L=(1.0/4)*C*R**2 \n", - "\n", - "#Results\n", - "print(\"Value of comutating component C=%.3f uF\" %(C*10**6))\n", - "print(\"max permissible current through SCR is 2.5 times load current\")\n", - "print(\"value of comutating component L=%.1f uH\" %(L*10**6))\n", - "print(\"max permissible current through SCR is 1.5 times peak diode current\")\n", - "print(\"value of comutating component L=%.2f uH\" %(L*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of comutating component C=14.427 uF\n", - "max permissible current through SCR is 2.5 times load current\n", - "value of comutating component L=360.7 uH\n", - "max permissible current through SCR is 1.5 times peak diode current\n", - "value of comutating component L=360.67 uH\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.20, Page No 426" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_on=800.0*10**-6\n", - "V_s=220.0\n", - "I_o=80.0\n", - "C=50*10**-6\n", - "\n", - "#Calculations\n", - "T=T_on+2*V_s*C/I_o \n", - "L=20*10**-6\n", - "C=50*10**-6\n", - "i_T1=I_o+V_s*math.sqrt(C/L) \n", - "i_TA=I_o \n", - "t_c=C*V_s/I_o \n", - "t_c1=(math.pi/2)*math.sqrt(L*C) \n", - "t=150*10**-6\n", - "v_c=I_o*t/C-V_s \n", - "\n", - "#Results \n", - "print(\"effective on period=%.0f us\" %(T*10**6))\n", - "print(\"peak current through main thyristor=%.2f A\" %i_T1)\n", - "print(\"peak current through auxillery thyristor=%.0f A\" %i_TA)\n", - "print(\"turn off time for main thyristor=%.1f us\" %(t_c*10**6))\n", - "print(\"turn off time for auxillery thyristor=%.3f us\" %(t_c1*10**6))\n", - "print(\"total commutation interval=%.0f us\" %(2*t_c*10**6))\n", - "print(\"capacitor voltage=%.0f V\" %v_c)\n", - "print(\"time nedded to recharge the capacitor=%.0f us\" %(2*V_s*C/I_o*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle = 30deg\n", - "avg output voltage=232.509 V\n", - "for firing angle = 60deg\n", - "avg output voltage=133.65 V\n", - "avg current rating=12 A\n", - "rms current rating=20.785 A\n", - "PIV of SCR=565.7 V\n", - "power dissipated=16.8 W\n" - ] - } - ], - "prompt_number": 122 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.21, Page No 427" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_o=260.0\n", - "V_s=220.0\n", - "fos=2 #factor of safety\n", - "\n", - "#Calculations\n", - "t_off=18*10**-6\n", - "t_c=2*t_off\n", - "C=t_c*I_o/V_s \n", - "L=(V_s/(0.8*I_o))**2*C \n", - "f=400\n", - "a_mn=math.pi*f*math.sqrt(L*C)\n", - "V_omn=V_s*(a_mn+2*f*t_c) \n", - "V_omx=V_s \n", - "\n", - "#Results\n", - "print(\"Value of C=%.3f uF\" %(C*10**6))\n", - "print(\"value of L=%.3f uH\" %(L*10**6))\n", - "print(\"min value of o/p voltage=%.3f V\" %V_omn)\n", - "print(\"max value of o/p voltage=%.0f V\" %V_omx)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=47.461 deg\n", - "pf=0.646\n", - "firing angle delay=127.71 deg\n" - ] - } - ], - "prompt_number": "*" - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.22, Page No 434" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "x=2.0\n", - "t_q=30*10**-6\n", - "dt=30*10**-6\n", - "t_c=t_q+dt\n", - "V_s=230.0\n", - "I_o=200.0\n", - "\n", - "#Calculations\n", - "L=V_s*t_c/(x*I_o*(math.pi-2*math.asin(1/x))) \n", - "C=x*I_o*t_c/(V_s*(math.pi-2*math.asin(1/x))) \n", - "V_cp=V_s+I_o*math.sqrt(L/C) \n", - "I_cp=x*I_o \n", - "x=3\n", - "L=V_s*t_c/(x*I_o*(math.pi-2*math.asin(1/x))) \n", - "C=x*I_o*t_c/(V_s*(math.pi-2*math.asin(1/x))) \n", - "V_cp=V_s+I_o*math.sqrt(L/C) \n", - "I_cp=x*I_o \n", - "\n", - "#Results\n", - "print(\"value of commutating inductor=%.3f uH\" %(L*10**6))\n", - "print(\"value of commutating capacitor=%.3f uF\" %(C*10**6))\n", - "print(\"peak capacitor voltage=%.0f V\" %V_cp)\n", - "print(\"peak commutataing current=%.0f A\" %I_cp)\n", - "print(\"value of commutating inductor=%.3f uH\" %(L*10**6))\n", - "print(\"value of commutating capacitor=%.3f uF\" %(C*10**6))\n", - "print(\"peak capacitor voltage=%.2f V\" %V_cp)\n", - "print(\"peak commutataing current=%.0f A\" %I_cp)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of commutating inductor=7.321 uH\n", - "value of commutating capacitor=49.822 uF\n", - "peak capacitor voltage=307 V\n", - "peak commutataing current=600 A\n", - "value of commutating inductor=7.321 uH\n", - "value of commutating capacitor=49.822 uF\n", - "peak capacitor voltage=306.67 V\n", - "peak commutataing current=600 A\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.23, Page No 434" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=230\n", - "C=50*10**-6\n", - "L=20*10**-6\n", - "I_cp=V_s*math.sqrt(C/L)\n", - "I_o=200\n", - "x=I_cp/I_o\n", - "\n", - "#Calculations\n", - "t_c=(math.pi-2*math.asin(1/x))*math.sqrt(C*L) \n", - "th1=math.degrees(math.asin(1.0/x))\n", - "t=(5*math.pi/2-th1*math.pi/180)*math.sqrt(L*C)+C*V_s*(1-math.cos(math.radians(th1)))/I_o \n", - "t=(math.pi-th1*math.pi/180)*math.sqrt(L*C) \n", - "\n", - "#Results\n", - "print(\"turn off time of main thyristor=%.2f us\" %(t_c*10**6))\n", - "print(\"total commutation interval=%.3f us\" %(t*10**6))\n", - "print(\"turn off time of auxillery thyristor=%.3f us\" %(t*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "turn off time of main thyristor=62.52 us\n", - "total commutation interval=80.931 us\n", - "turn off time of auxillery thyristor=80.931 us\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.24, Page No 440" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tc=0.006\n", - "R=10.0\n", - "L=R*tc\n", - "f=2000.0\n", - "\n", - "#Calculations\n", - "T=1/f\n", - "V_o=50.0\n", - "V_s=100.0\n", - "a=V_o/V_s\n", - "T_on=a*T\n", - "T_off=T-T_on\n", - "dI=V_o*T_off/L\n", - "I_o=V_o/R\n", - "I2=I_o+dI/2 \n", - "I1=I_o-dI/2 \n", - "\n", - "#Results\n", - "print(\"max value of load current=%.3f A\" %I2)\n", - "print(\"min value of load current=%.3f A\" %I1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max value of load current=5.104 A\n", - "min value of load current=4.896 A\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.27, Page No 443" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=30.0\n", - "r_a=.5\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "a=I_a*r_a/V_s \n", - "a=1\n", - "k=.1 #V/rpm\n", - "N=(a*V_s-I_a*r_a)/k \n", - "\n", - "#Results\n", - "print(\"min value of duty cycle=%.3f\" %a)\n", - "print(\"min Value of speed control=%.0f rpm\" %0)\n", - "print(\"max value of duty cycle=%.0f\" %a)\n", - "print(\"max value of speed control=%.0f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "min value of duty cycle=1.000\n", - "min Value of speed control=0 rpm\n", - "max value of duty cycle=1\n", - "max value of speed control=2050 rpm\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.28, Page No 444" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=72.0\n", - "I_a=200.0\n", - "r_a=0.045\n", - "N=2500.0\n", - "\n", - "#Calculations\n", - "k=(V_t-I_a*r_a)/N\n", - "E_a=k*1000\n", - "L=.007\n", - "Rm=.045\n", - "Rb=0.065\n", - "R=Rm+Rb\n", - "T_a=L/R\n", - "I_mx=230\n", - "I_mn=180\n", - "T_on=-T_a*math.log(-((V_t-E_a)/R-I_mx)/((I_mn)-(V_t-E_a)/R))\n", - "R=Rm\n", - "T_a=L/R\n", - "T_off=-T_a*math.log(-((-E_a)/R-I_mn)/((I_mx)-(-E_a)/R))\n", - "T=T_on+T_off\n", - "f=1/T \n", - "a=T_on/T \n", - "\n", - "#Results\n", - "print(\"chopping freq=%.1f Hz\" %f) \n", - "print(\"duty cycle ratio=%.3f\" %a)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "chopping freq=40.5 Hz\n", - "\n", - "duty cycle ratio=0.588\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.29, Page No 445" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesI_mx=425\n", - "I_lt=180.0 #lower limit of current pulsation\n", - "I_mn=I_mx-I_lt\n", - "T_on=0.014\n", - "T_off=0.011\n", - "\n", - "#Calculations\n", - "T=T_on+T_off\n", - "T_a=.0635\n", - "a=T_on/T\n", - "V=(I_mx-I_mn*math.exp(-T_on/T_a))/(1-math.exp(-T_on/T_a))\n", - "a=.5\n", - "I_mn=(I_mx-V*(1-math.exp(-T_on/T_a)))/(math.exp(-T_on/T_a))\n", - "T=I_mx-I_mn \n", - "T=T_on/a\n", - "f=1/T \n", - "\n", - "#Results\n", - "print(\"higher limit of current pulsation=%.0f A\" %T)\n", - "print(\"chopping freq=%.3f Hz\" %f)\n", - "print(\"duty cycle ratio=%.2f\" %a)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "higher limit of current pulsation=0 A\n", - "chopping freq=35.714 Hz\n", - "duty cycle ratio=0.50\n" - ] - } - ], - "prompt_number": 32 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter7_1.ipynb b/_Power_Electronics/Chapter7_1.ipynb deleted file mode 100755 index 726160c8..00000000 --- a/_Power_Electronics/Chapter7_1.ipynb +++ /dev/null @@ -1,1036 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 07 : Choppers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.2, Page No 387" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.4 #duty cycle %a=T_on/T\n", - "V_s=230.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V=a*(V_s-2) \n", - "V_or=math.sqrt(a*(V_s-2)**2) \n", - "P_o=V_or**2/R\n", - "P_i=V_s*V/R\n", - "n=P_o*100/P_i \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.1f V\" %V)\n", - "print(\"rms value of o/p voltage=%.1f V\" %V_or)\n", - "print(\"chopper efficiency in percentage=%.2f\" %n)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=91.2 V\n", - "rms value of o/p voltage=144.2 V\n", - "chopper efficiency in percentage=99.13\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.3, Page No 388" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_i=220.0\n", - "V_o=660.0\n", - "\n", - "#Calculations\n", - "a=1-V_i/V_o\n", - "T_on=100.0 #microsecond\n", - "T=T_on/a\n", - "T_off=T-T_on \n", - "T_off=T_off/2\n", - "T_on=T-T_off\n", - "a=T_on/T\n", - "V_o=V_i/(1-a)\n", - "\n", - "#Results \n", - "print(\"pulse width of o/p voltage=%.0f us\" %T_off)\n", - "print(\"\\nnew o/p voltage=%.0f V\" %V_o)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "pulse width of o/p voltage=25 us\n", - "\n", - "new o/p voltage=1320 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.4 Page No 288" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_1=12.0\n", - "I_2=16.0\n", - "\n", - "#Calculations\n", - "I_0=(I_1+I_2)/2\n", - "R=10.0\n", - "V_0=I_0*R\n", - "V_s=200.0\n", - "a=V_0/V_s\n", - "r=a/(1-a)\n", - "\n", - "#Results\n", - "print(\"time ratio(T_on/T_off)=%.3f\" %r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time ratio(T_on/T_off)=2.333\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.5, Page No 390" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=660.0\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "a=(V_o/V_s)/(1+(V_o/V_s))\n", - "T_on=120\n", - "T=T_on/a\n", - "T_off=T-T_on \n", - "T_off=3*T_off\n", - "T_on=T-T_off\n", - "a=T_on/(T_on+T_off)\n", - "V_o=V_s*(a/(1-a)) \n", - "\n", - "#Results\n", - "print(\"pulse width o/p voltage=%.0f us\" %T_off)\n", - "print(\"\\nnew o/p voltage=%.2f V\" %V_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "pulse width o/p voltage=120 us\n", - "\n", - "new o/p voltage=73.33 V\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.11 Page No 408" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=1.0\n", - "L=.005\n", - "T_a=L/R\n", - "T=2000*10**-6\n", - "E=24.0\n", - "V_s=220\n", - "T_on=600*10**-6\n", - "a=T_on/T\n", - "\n", - "#Calculations\n", - "a1=(T_a/T)*math.log(1+(E/V_s)*((math.exp(T/T_a))-1))\n", - "if a1a :\n", - " print(\"load current is continuous\")\n", - "else:\n", - " print(\"load current is discontinuous\")\n", - "\n", - "t_x=T_on+L*math.log(1+((V_s-E)/272)*(1-math.exp(-T_on/T_a)))\n", - " #Value of t_x wrongly calculated in the book so ans of V_o and I_o varies\n", - "V_o=a*V_s+(1-t_x/T)*E \n", - "I_o=(V_o-E)/R \n", - "I_mx=(V_s-E)/R*(1-math.exp(-T_on/T_a)) \n", - "\n", - "#Results \n", - "print(\"avg o/p voltage=%.2f V\" %V_o)\n", - "print(\"avg o/p current=%.2f A\" %I_o) \n", - "print(\"max value of load current=%.1f A\" %I_mx)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "load current is discontinuous\n", - "avg o/p voltage=121.77 V\n", - "avg o/p current=49.77 A\n", - "max value of load current=81.5 A\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.13, Page No 412" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.2\n", - "V_s=500\n", - "E=a*V_s\n", - "L=0.06\n", - "I=10\n", - "\n", - "#Calculations\n", - "T_on=(L*I)/(V_s-E)\n", - "f=a/T_on \n", - "\n", - "#Results\n", - "print(\"chopping freq=%.2f Hz\" %f)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "chopping freq=133.33 Hz\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.14 Page No 412" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.5\n", - "pu=0.1 #pu ripple\n", - "\n", - "#Calculations\n", - " #x=T/T_a\n", - " #y=exp(-a*x)\n", - "y=(1-pu)/(1+pu)\n", - " #after solving\n", - "x=math.log(1/y)/a\n", - "f=1000\n", - "T=1/f\n", - "T_a=T/x\n", - "R=2\n", - "L=R*T_a\n", - "Li=0.002\n", - "Le=L-Li \n", - "\n", - "#Results\n", - "print(\"external inductance=%.3f mH\" %(Le*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "external inductance=-2.000 mH\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.15 Page No 414" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=10.0\n", - "L=0.015\n", - "T_a=L/R\n", - "f=1250.0\n", - "T=1.0/f\n", - "a=0.5\n", - "T_on=a*T\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "I_mx=(V_s/R)*((1-math.exp(-T_on/T_a))/(1-math.exp(-T/T_a))) \n", - "I_mn=(V_s/R)*((math.exp(T_on/T_a)-1)/(math.exp(T/T_a)-1)) \n", - "dI=I_mx-I_mn \n", - "V_o=a*V_s\n", - "I_o=V_o/R \n", - "I_or=math.sqrt(I_mx**2+dI**2/3+I_mx*dI) \n", - "I_chr=math.sqrt(a)*I_or \n", - "\n", - "#Results\n", - "print(\"Max value of ripple current=%.2f A\" %dI)\n", - "print(\"Max value of load current=%.3f A\" %I_mx)\n", - "print(\"Min value of load current=%.2f A\" %I_mn)\n", - "print(\"Avg value of load current=%.2f A\" %I_o) \n", - "print(\"rms value of load current=%.2f A\" %I_or)\n", - "print(\"rms value of chopper current=%.2f A\" %I_chr)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Max value of ripple current=2.92 A\n", - "Max value of load current=12.458 A\n", - "Min value of load current=9.54 A\n", - "Avg value of load current=11.00 A\n", - "rms value of load current=13.94 A\n", - "rms value of chopper current=9.86 A\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.17 Page No 417" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=0.0016\n", - "C=4*10**-6\n", - "\n", - "#Calculations\n", - "w=1/math.sqrt(L*C)\n", - "t=math.pi/w \n", - "\n", - "\n", - "#Results\n", - "print(\"time for which current flows=%.2f us\" %(t*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time for which current flows=251.33 us\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.18, Page No 424" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t_q=20.0*10**-6\n", - "dt=20.0*10**-6\n", - "\n", - "#Calculations\n", - "t_c=t_q+dt\n", - "I_0=60.0\n", - "V_s=60.0\n", - "C=t_c*I_0/V_s \n", - "\n", - "#Results \n", - "print(\"value of commutating capacitor=%.0f uF\" %(C*10**6))\n", - "\n", - "L1=(V_s/I_0)**2*C\n", - "L2=(2*t_c/math.pi)**2/C\n", - "if L1>L2 :\n", - " print(\"value of commutating inductor=%.0f uH\" %(L1*10**6))\n", - "else:\n", - " print(\"value of commutating inductor=%.0f uH\" %(L2*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of commutating capacitor=40 uF\n", - "value of commutating inductor=40 uH\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.19, Page No 424" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t=100.0*10**-6\n", - "R=10.0\n", - "\n", - "#Calculations\n", - " #V_s*(1-2*math.exp(-t/(R*C)))=0\n", - "C=-t/(R*math.log(1.0/2)) \n", - "L=(4/9.0)*C*R**2 \n", - "L=(1.0/4)*C*R**2 \n", - "\n", - "#Results\n", - "print(\"Value of comutating component C=%.3f uF\" %(C*10**6))\n", - "print(\"max permissible current through SCR is 2.5 times load current\")\n", - "print(\"value of comutating component L=%.1f uH\" %(L*10**6))\n", - "print(\"max permissible current through SCR is 1.5 times peak diode current\")\n", - "print(\"value of comutating component L=%.2f uH\" %(L*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of comutating component C=14.427 uF\n", - "max permissible current through SCR is 2.5 times load current\n", - "value of comutating component L=360.7 uH\n", - "max permissible current through SCR is 1.5 times peak diode current\n", - "value of comutating component L=360.67 uH\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.20, Page No 426" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_on=800.0*10**-6\n", - "V_s=220.0\n", - "I_o=80.0\n", - "C=50*10**-6\n", - "\n", - "#Calculations\n", - "T=T_on+2*V_s*C/I_o \n", - "L=20*10**-6\n", - "C=50*10**-6\n", - "i_T1=I_o+V_s*math.sqrt(C/L) \n", - "i_TA=I_o \n", - "t_c=C*V_s/I_o \n", - "t_c1=(math.pi/2)*math.sqrt(L*C) \n", - "t=150*10**-6\n", - "v_c=I_o*t/C-V_s \n", - "\n", - "#Results \n", - "print(\"effective on period=%.0f us\" %(T*10**6))\n", - "print(\"peak current through main thyristor=%.2f A\" %i_T1)\n", - "print(\"peak current through auxillery thyristor=%.0f A\" %i_TA)\n", - "print(\"turn off time for main thyristor=%.1f us\" %(t_c*10**6))\n", - "print(\"turn off time for auxillery thyristor=%.3f us\" %(t_c1*10**6))\n", - "print(\"total commutation interval=%.0f us\" %(2*t_c*10**6))\n", - "print(\"capacitor voltage=%.0f V\" %v_c)\n", - "print(\"time nedded to recharge the capacitor=%.0f us\" %(2*V_s*C/I_o*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle = 30deg\n", - "avg output voltage=232.509 V\n", - "for firing angle = 60deg\n", - "avg output voltage=133.65 V\n", - "avg current rating=12 A\n", - "rms current rating=20.785 A\n", - "PIV of SCR=565.7 V\n", - "power dissipated=16.8 W\n" - ] - } - ], - "prompt_number": 122 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.21, Page No 427" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_o=260.0\n", - "V_s=220.0\n", - "fos=2 #factor of safety\n", - "\n", - "#Calculations\n", - "t_off=18*10**-6\n", - "t_c=2*t_off\n", - "C=t_c*I_o/V_s \n", - "L=(V_s/(0.8*I_o))**2*C \n", - "f=400\n", - "a_mn=math.pi*f*math.sqrt(L*C)\n", - "V_omn=V_s*(a_mn+2*f*t_c) \n", - "V_omx=V_s \n", - "\n", - "#Results\n", - "print(\"Value of C=%.3f uF\" %(C*10**6))\n", - "print(\"value of L=%.3f uH\" %(L*10**6))\n", - "print(\"min value of o/p voltage=%.3f V\" %V_omn)\n", - "print(\"max value of o/p voltage=%.0f V\" %V_omx)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=47.461 deg\n", - "pf=0.646\n", - "firing angle delay=127.71 deg\n" - ] - } - ], - "prompt_number": "*" - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.22, Page No 434" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "x=2.0\n", - "t_q=30*10**-6\n", - "dt=30*10**-6\n", - "t_c=t_q+dt\n", - "V_s=230.0\n", - "I_o=200.0\n", - "\n", - "#Calculations\n", - "L=V_s*t_c/(x*I_o*(math.pi-2*math.asin(1/x))) \n", - "C=x*I_o*t_c/(V_s*(math.pi-2*math.asin(1/x))) \n", - "V_cp=V_s+I_o*math.sqrt(L/C) \n", - "I_cp=x*I_o \n", - "x=3\n", - "L=V_s*t_c/(x*I_o*(math.pi-2*math.asin(1/x))) \n", - "C=x*I_o*t_c/(V_s*(math.pi-2*math.asin(1/x))) \n", - "V_cp=V_s+I_o*math.sqrt(L/C) \n", - "I_cp=x*I_o \n", - "\n", - "#Results\n", - "print(\"value of commutating inductor=%.3f uH\" %(L*10**6))\n", - "print(\"value of commutating capacitor=%.3f uF\" %(C*10**6))\n", - "print(\"peak capacitor voltage=%.0f V\" %V_cp)\n", - "print(\"peak commutataing current=%.0f A\" %I_cp)\n", - "print(\"value of commutating inductor=%.3f uH\" %(L*10**6))\n", - "print(\"value of commutating capacitor=%.3f uF\" %(C*10**6))\n", - "print(\"peak capacitor voltage=%.2f V\" %V_cp)\n", - "print(\"peak commutataing current=%.0f A\" %I_cp)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of commutating inductor=7.321 uH\n", - "value of commutating capacitor=49.822 uF\n", - "peak capacitor voltage=307 V\n", - "peak commutataing current=600 A\n", - "value of commutating inductor=7.321 uH\n", - "value of commutating capacitor=49.822 uF\n", - "peak capacitor voltage=306.67 V\n", - "peak commutataing current=600 A\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.23, Page No 434" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=230\n", - "C=50*10**-6\n", - "L=20*10**-6\n", - "I_cp=V_s*math.sqrt(C/L)\n", - "I_o=200\n", - "x=I_cp/I_o\n", - "\n", - "#Calculations\n", - "t_c=(math.pi-2*math.asin(1/x))*math.sqrt(C*L) \n", - "th1=math.degrees(math.asin(1.0/x))\n", - "t=(5*math.pi/2-th1*math.pi/180)*math.sqrt(L*C)+C*V_s*(1-math.cos(math.radians(th1)))/I_o \n", - "t=(math.pi-th1*math.pi/180)*math.sqrt(L*C) \n", - "\n", - "#Results\n", - "print(\"turn off time of main thyristor=%.2f us\" %(t_c*10**6))\n", - "print(\"total commutation interval=%.3f us\" %(t*10**6))\n", - "print(\"turn off time of auxillery thyristor=%.3f us\" %(t*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "turn off time of main thyristor=62.52 us\n", - "total commutation interval=80.931 us\n", - "turn off time of auxillery thyristor=80.931 us\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.24, Page No 440" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tc=0.006\n", - "R=10.0\n", - "L=R*tc\n", - "f=2000.0\n", - "\n", - "#Calculations\n", - "T=1/f\n", - "V_o=50.0\n", - "V_s=100.0\n", - "a=V_o/V_s\n", - "T_on=a*T\n", - "T_off=T-T_on\n", - "dI=V_o*T_off/L\n", - "I_o=V_o/R\n", - "I2=I_o+dI/2 \n", - "I1=I_o-dI/2 \n", - "\n", - "#Results\n", - "print(\"max value of load current=%.3f A\" %I2)\n", - "print(\"min value of load current=%.3f A\" %I1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max value of load current=5.104 A\n", - "min value of load current=4.896 A\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.27, Page No 443" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=30.0\n", - "r_a=.5\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "a=I_a*r_a/V_s \n", - "a=1\n", - "k=.1 #V/rpm\n", - "N=(a*V_s-I_a*r_a)/k \n", - "\n", - "#Results\n", - "print(\"min value of duty cycle=%.3f\" %a)\n", - "print(\"min Value of speed control=%.0f rpm\" %0)\n", - "print(\"max value of duty cycle=%.0f\" %a)\n", - "print(\"max value of speed control=%.0f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "min value of duty cycle=1.000\n", - "min Value of speed control=0 rpm\n", - "max value of duty cycle=1\n", - "max value of speed control=2050 rpm\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.28, Page No 444" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=72.0\n", - "I_a=200.0\n", - "r_a=0.045\n", - "N=2500.0\n", - "\n", - "#Calculations\n", - "k=(V_t-I_a*r_a)/N\n", - "E_a=k*1000\n", - "L=.007\n", - "Rm=.045\n", - "Rb=0.065\n", - "R=Rm+Rb\n", - "T_a=L/R\n", - "I_mx=230\n", - "I_mn=180\n", - "T_on=-T_a*math.log(-((V_t-E_a)/R-I_mx)/((I_mn)-(V_t-E_a)/R))\n", - "R=Rm\n", - "T_a=L/R\n", - "T_off=-T_a*math.log(-((-E_a)/R-I_mn)/((I_mx)-(-E_a)/R))\n", - "T=T_on+T_off\n", - "f=1/T \n", - "a=T_on/T \n", - "\n", - "#Results\n", - "print(\"chopping freq=%.1f Hz\" %f) \n", - "print(\"duty cycle ratio=%.3f\" %a)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "chopping freq=40.5 Hz\n", - "\n", - "duty cycle ratio=0.588\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.29, Page No 445" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesI_mx=425\n", - "I_lt=180.0 #lower limit of current pulsation\n", - "I_mn=I_mx-I_lt\n", - "T_on=0.014\n", - "T_off=0.011\n", - "\n", - "#Calculations\n", - "T=T_on+T_off\n", - "T_a=.0635\n", - "a=T_on/T\n", - "V=(I_mx-I_mn*math.exp(-T_on/T_a))/(1-math.exp(-T_on/T_a))\n", - "a=.5\n", - "I_mn=(I_mx-V*(1-math.exp(-T_on/T_a)))/(math.exp(-T_on/T_a))\n", - "T=I_mx-I_mn \n", - "T=T_on/a\n", - "f=1/T \n", - "\n", - "#Results\n", - "print(\"higher limit of current pulsation=%.0f A\" %T)\n", - "print(\"chopping freq=%.3f Hz\" %f)\n", - "print(\"duty cycle ratio=%.2f\" %a)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "higher limit of current pulsation=0 A\n", - "chopping freq=35.714 Hz\n", - "duty cycle ratio=0.50\n" - ] - } - ], - "prompt_number": 32 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter7_2.ipynb b/_Power_Electronics/Chapter7_2.ipynb deleted file mode 100755 index 726160c8..00000000 --- a/_Power_Electronics/Chapter7_2.ipynb +++ /dev/null @@ -1,1036 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 07 : Choppers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.2, Page No 387" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.4 #duty cycle %a=T_on/T\n", - "V_s=230.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V=a*(V_s-2) \n", - "V_or=math.sqrt(a*(V_s-2)**2) \n", - "P_o=V_or**2/R\n", - "P_i=V_s*V/R\n", - "n=P_o*100/P_i \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.1f V\" %V)\n", - "print(\"rms value of o/p voltage=%.1f V\" %V_or)\n", - "print(\"chopper efficiency in percentage=%.2f\" %n)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=91.2 V\n", - "rms value of o/p voltage=144.2 V\n", - "chopper efficiency in percentage=99.13\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.3, Page No 388" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_i=220.0\n", - "V_o=660.0\n", - "\n", - "#Calculations\n", - "a=1-V_i/V_o\n", - "T_on=100.0 #microsecond\n", - "T=T_on/a\n", - "T_off=T-T_on \n", - "T_off=T_off/2\n", - "T_on=T-T_off\n", - "a=T_on/T\n", - "V_o=V_i/(1-a)\n", - "\n", - "#Results \n", - "print(\"pulse width of o/p voltage=%.0f us\" %T_off)\n", - "print(\"\\nnew o/p voltage=%.0f V\" %V_o)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "pulse width of o/p voltage=25 us\n", - "\n", - "new o/p voltage=1320 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.4 Page No 288" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_1=12.0\n", - "I_2=16.0\n", - "\n", - "#Calculations\n", - "I_0=(I_1+I_2)/2\n", - "R=10.0\n", - "V_0=I_0*R\n", - "V_s=200.0\n", - "a=V_0/V_s\n", - "r=a/(1-a)\n", - "\n", - "#Results\n", - "print(\"time ratio(T_on/T_off)=%.3f\" %r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time ratio(T_on/T_off)=2.333\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.5, Page No 390" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=660.0\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "a=(V_o/V_s)/(1+(V_o/V_s))\n", - "T_on=120\n", - "T=T_on/a\n", - "T_off=T-T_on \n", - "T_off=3*T_off\n", - "T_on=T-T_off\n", - "a=T_on/(T_on+T_off)\n", - "V_o=V_s*(a/(1-a)) \n", - "\n", - "#Results\n", - "print(\"pulse width o/p voltage=%.0f us\" %T_off)\n", - "print(\"\\nnew o/p voltage=%.2f V\" %V_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "pulse width o/p voltage=120 us\n", - "\n", - "new o/p voltage=73.33 V\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.11 Page No 408" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=1.0\n", - "L=.005\n", - "T_a=L/R\n", - "T=2000*10**-6\n", - "E=24.0\n", - "V_s=220\n", - "T_on=600*10**-6\n", - "a=T_on/T\n", - "\n", - "#Calculations\n", - "a1=(T_a/T)*math.log(1+(E/V_s)*((math.exp(T/T_a))-1))\n", - "if a1a :\n", - " print(\"load current is continuous\")\n", - "else:\n", - " print(\"load current is discontinuous\")\n", - "\n", - "t_x=T_on+L*math.log(1+((V_s-E)/272)*(1-math.exp(-T_on/T_a)))\n", - " #Value of t_x wrongly calculated in the book so ans of V_o and I_o varies\n", - "V_o=a*V_s+(1-t_x/T)*E \n", - "I_o=(V_o-E)/R \n", - "I_mx=(V_s-E)/R*(1-math.exp(-T_on/T_a)) \n", - "\n", - "#Results \n", - "print(\"avg o/p voltage=%.2f V\" %V_o)\n", - "print(\"avg o/p current=%.2f A\" %I_o) \n", - "print(\"max value of load current=%.1f A\" %I_mx)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "load current is discontinuous\n", - "avg o/p voltage=121.77 V\n", - "avg o/p current=49.77 A\n", - "max value of load current=81.5 A\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.13, Page No 412" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.2\n", - "V_s=500\n", - "E=a*V_s\n", - "L=0.06\n", - "I=10\n", - "\n", - "#Calculations\n", - "T_on=(L*I)/(V_s-E)\n", - "f=a/T_on \n", - "\n", - "#Results\n", - "print(\"chopping freq=%.2f Hz\" %f)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "chopping freq=133.33 Hz\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.14 Page No 412" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.5\n", - "pu=0.1 #pu ripple\n", - "\n", - "#Calculations\n", - " #x=T/T_a\n", - " #y=exp(-a*x)\n", - "y=(1-pu)/(1+pu)\n", - " #after solving\n", - "x=math.log(1/y)/a\n", - "f=1000\n", - "T=1/f\n", - "T_a=T/x\n", - "R=2\n", - "L=R*T_a\n", - "Li=0.002\n", - "Le=L-Li \n", - "\n", - "#Results\n", - "print(\"external inductance=%.3f mH\" %(Le*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "external inductance=-2.000 mH\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.15 Page No 414" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=10.0\n", - "L=0.015\n", - "T_a=L/R\n", - "f=1250.0\n", - "T=1.0/f\n", - "a=0.5\n", - "T_on=a*T\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "I_mx=(V_s/R)*((1-math.exp(-T_on/T_a))/(1-math.exp(-T/T_a))) \n", - "I_mn=(V_s/R)*((math.exp(T_on/T_a)-1)/(math.exp(T/T_a)-1)) \n", - "dI=I_mx-I_mn \n", - "V_o=a*V_s\n", - "I_o=V_o/R \n", - "I_or=math.sqrt(I_mx**2+dI**2/3+I_mx*dI) \n", - "I_chr=math.sqrt(a)*I_or \n", - "\n", - "#Results\n", - "print(\"Max value of ripple current=%.2f A\" %dI)\n", - "print(\"Max value of load current=%.3f A\" %I_mx)\n", - "print(\"Min value of load current=%.2f A\" %I_mn)\n", - "print(\"Avg value of load current=%.2f A\" %I_o) \n", - "print(\"rms value of load current=%.2f A\" %I_or)\n", - "print(\"rms value of chopper current=%.2f A\" %I_chr)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Max value of ripple current=2.92 A\n", - "Max value of load current=12.458 A\n", - "Min value of load current=9.54 A\n", - "Avg value of load current=11.00 A\n", - "rms value of load current=13.94 A\n", - "rms value of chopper current=9.86 A\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.17 Page No 417" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=0.0016\n", - "C=4*10**-6\n", - "\n", - "#Calculations\n", - "w=1/math.sqrt(L*C)\n", - "t=math.pi/w \n", - "\n", - "\n", - "#Results\n", - "print(\"time for which current flows=%.2f us\" %(t*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time for which current flows=251.33 us\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.18, Page No 424" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t_q=20.0*10**-6\n", - "dt=20.0*10**-6\n", - "\n", - "#Calculations\n", - "t_c=t_q+dt\n", - "I_0=60.0\n", - "V_s=60.0\n", - "C=t_c*I_0/V_s \n", - "\n", - "#Results \n", - "print(\"value of commutating capacitor=%.0f uF\" %(C*10**6))\n", - "\n", - "L1=(V_s/I_0)**2*C\n", - "L2=(2*t_c/math.pi)**2/C\n", - "if L1>L2 :\n", - " print(\"value of commutating inductor=%.0f uH\" %(L1*10**6))\n", - "else:\n", - " print(\"value of commutating inductor=%.0f uH\" %(L2*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of commutating capacitor=40 uF\n", - "value of commutating inductor=40 uH\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.19, Page No 424" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t=100.0*10**-6\n", - "R=10.0\n", - "\n", - "#Calculations\n", - " #V_s*(1-2*math.exp(-t/(R*C)))=0\n", - "C=-t/(R*math.log(1.0/2)) \n", - "L=(4/9.0)*C*R**2 \n", - "L=(1.0/4)*C*R**2 \n", - "\n", - "#Results\n", - "print(\"Value of comutating component C=%.3f uF\" %(C*10**6))\n", - "print(\"max permissible current through SCR is 2.5 times load current\")\n", - "print(\"value of comutating component L=%.1f uH\" %(L*10**6))\n", - "print(\"max permissible current through SCR is 1.5 times peak diode current\")\n", - "print(\"value of comutating component L=%.2f uH\" %(L*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of comutating component C=14.427 uF\n", - "max permissible current through SCR is 2.5 times load current\n", - "value of comutating component L=360.7 uH\n", - "max permissible current through SCR is 1.5 times peak diode current\n", - "value of comutating component L=360.67 uH\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.20, Page No 426" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_on=800.0*10**-6\n", - "V_s=220.0\n", - "I_o=80.0\n", - "C=50*10**-6\n", - "\n", - "#Calculations\n", - "T=T_on+2*V_s*C/I_o \n", - "L=20*10**-6\n", - "C=50*10**-6\n", - "i_T1=I_o+V_s*math.sqrt(C/L) \n", - "i_TA=I_o \n", - "t_c=C*V_s/I_o \n", - "t_c1=(math.pi/2)*math.sqrt(L*C) \n", - "t=150*10**-6\n", - "v_c=I_o*t/C-V_s \n", - "\n", - "#Results \n", - "print(\"effective on period=%.0f us\" %(T*10**6))\n", - "print(\"peak current through main thyristor=%.2f A\" %i_T1)\n", - "print(\"peak current through auxillery thyristor=%.0f A\" %i_TA)\n", - "print(\"turn off time for main thyristor=%.1f us\" %(t_c*10**6))\n", - "print(\"turn off time for auxillery thyristor=%.3f us\" %(t_c1*10**6))\n", - "print(\"total commutation interval=%.0f us\" %(2*t_c*10**6))\n", - "print(\"capacitor voltage=%.0f V\" %v_c)\n", - "print(\"time nedded to recharge the capacitor=%.0f us\" %(2*V_s*C/I_o*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle = 30deg\n", - "avg output voltage=232.509 V\n", - "for firing angle = 60deg\n", - "avg output voltage=133.65 V\n", - "avg current rating=12 A\n", - "rms current rating=20.785 A\n", - "PIV of SCR=565.7 V\n", - "power dissipated=16.8 W\n" - ] - } - ], - "prompt_number": 122 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.21, Page No 427" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_o=260.0\n", - "V_s=220.0\n", - "fos=2 #factor of safety\n", - "\n", - "#Calculations\n", - "t_off=18*10**-6\n", - "t_c=2*t_off\n", - "C=t_c*I_o/V_s \n", - "L=(V_s/(0.8*I_o))**2*C \n", - "f=400\n", - "a_mn=math.pi*f*math.sqrt(L*C)\n", - "V_omn=V_s*(a_mn+2*f*t_c) \n", - "V_omx=V_s \n", - "\n", - "#Results\n", - "print(\"Value of C=%.3f uF\" %(C*10**6))\n", - "print(\"value of L=%.3f uH\" %(L*10**6))\n", - "print(\"min value of o/p voltage=%.3f V\" %V_omn)\n", - "print(\"max value of o/p voltage=%.0f V\" %V_omx)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=47.461 deg\n", - "pf=0.646\n", - "firing angle delay=127.71 deg\n" - ] - } - ], - "prompt_number": "*" - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.22, Page No 434" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "x=2.0\n", - "t_q=30*10**-6\n", - "dt=30*10**-6\n", - "t_c=t_q+dt\n", - "V_s=230.0\n", - "I_o=200.0\n", - "\n", - "#Calculations\n", - "L=V_s*t_c/(x*I_o*(math.pi-2*math.asin(1/x))) \n", - "C=x*I_o*t_c/(V_s*(math.pi-2*math.asin(1/x))) \n", - "V_cp=V_s+I_o*math.sqrt(L/C) \n", - "I_cp=x*I_o \n", - "x=3\n", - "L=V_s*t_c/(x*I_o*(math.pi-2*math.asin(1/x))) \n", - "C=x*I_o*t_c/(V_s*(math.pi-2*math.asin(1/x))) \n", - "V_cp=V_s+I_o*math.sqrt(L/C) \n", - "I_cp=x*I_o \n", - "\n", - "#Results\n", - "print(\"value of commutating inductor=%.3f uH\" %(L*10**6))\n", - "print(\"value of commutating capacitor=%.3f uF\" %(C*10**6))\n", - "print(\"peak capacitor voltage=%.0f V\" %V_cp)\n", - "print(\"peak commutataing current=%.0f A\" %I_cp)\n", - "print(\"value of commutating inductor=%.3f uH\" %(L*10**6))\n", - "print(\"value of commutating capacitor=%.3f uF\" %(C*10**6))\n", - "print(\"peak capacitor voltage=%.2f V\" %V_cp)\n", - "print(\"peak commutataing current=%.0f A\" %I_cp)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of commutating inductor=7.321 uH\n", - "value of commutating capacitor=49.822 uF\n", - "peak capacitor voltage=307 V\n", - "peak commutataing current=600 A\n", - "value of commutating inductor=7.321 uH\n", - "value of commutating capacitor=49.822 uF\n", - "peak capacitor voltage=306.67 V\n", - "peak commutataing current=600 A\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.23, Page No 434" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=230\n", - "C=50*10**-6\n", - "L=20*10**-6\n", - "I_cp=V_s*math.sqrt(C/L)\n", - "I_o=200\n", - "x=I_cp/I_o\n", - "\n", - "#Calculations\n", - "t_c=(math.pi-2*math.asin(1/x))*math.sqrt(C*L) \n", - "th1=math.degrees(math.asin(1.0/x))\n", - "t=(5*math.pi/2-th1*math.pi/180)*math.sqrt(L*C)+C*V_s*(1-math.cos(math.radians(th1)))/I_o \n", - "t=(math.pi-th1*math.pi/180)*math.sqrt(L*C) \n", - "\n", - "#Results\n", - "print(\"turn off time of main thyristor=%.2f us\" %(t_c*10**6))\n", - "print(\"total commutation interval=%.3f us\" %(t*10**6))\n", - "print(\"turn off time of auxillery thyristor=%.3f us\" %(t*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "turn off time of main thyristor=62.52 us\n", - "total commutation interval=80.931 us\n", - "turn off time of auxillery thyristor=80.931 us\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.24, Page No 440" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tc=0.006\n", - "R=10.0\n", - "L=R*tc\n", - "f=2000.0\n", - "\n", - "#Calculations\n", - "T=1/f\n", - "V_o=50.0\n", - "V_s=100.0\n", - "a=V_o/V_s\n", - "T_on=a*T\n", - "T_off=T-T_on\n", - "dI=V_o*T_off/L\n", - "I_o=V_o/R\n", - "I2=I_o+dI/2 \n", - "I1=I_o-dI/2 \n", - "\n", - "#Results\n", - "print(\"max value of load current=%.3f A\" %I2)\n", - "print(\"min value of load current=%.3f A\" %I1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max value of load current=5.104 A\n", - "min value of load current=4.896 A\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.27, Page No 443" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=30.0\n", - "r_a=.5\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "a=I_a*r_a/V_s \n", - "a=1\n", - "k=.1 #V/rpm\n", - "N=(a*V_s-I_a*r_a)/k \n", - "\n", - "#Results\n", - "print(\"min value of duty cycle=%.3f\" %a)\n", - "print(\"min Value of speed control=%.0f rpm\" %0)\n", - "print(\"max value of duty cycle=%.0f\" %a)\n", - "print(\"max value of speed control=%.0f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "min value of duty cycle=1.000\n", - "min Value of speed control=0 rpm\n", - "max value of duty cycle=1\n", - "max value of speed control=2050 rpm\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.28, Page No 444" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=72.0\n", - "I_a=200.0\n", - "r_a=0.045\n", - "N=2500.0\n", - "\n", - "#Calculations\n", - "k=(V_t-I_a*r_a)/N\n", - "E_a=k*1000\n", - "L=.007\n", - "Rm=.045\n", - "Rb=0.065\n", - "R=Rm+Rb\n", - "T_a=L/R\n", - "I_mx=230\n", - "I_mn=180\n", - "T_on=-T_a*math.log(-((V_t-E_a)/R-I_mx)/((I_mn)-(V_t-E_a)/R))\n", - "R=Rm\n", - "T_a=L/R\n", - "T_off=-T_a*math.log(-((-E_a)/R-I_mn)/((I_mx)-(-E_a)/R))\n", - "T=T_on+T_off\n", - "f=1/T \n", - "a=T_on/T \n", - "\n", - "#Results\n", - "print(\"chopping freq=%.1f Hz\" %f) \n", - "print(\"duty cycle ratio=%.3f\" %a)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "chopping freq=40.5 Hz\n", - "\n", - "duty cycle ratio=0.588\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.29, Page No 445" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesI_mx=425\n", - "I_lt=180.0 #lower limit of current pulsation\n", - "I_mn=I_mx-I_lt\n", - "T_on=0.014\n", - "T_off=0.011\n", - "\n", - "#Calculations\n", - "T=T_on+T_off\n", - "T_a=.0635\n", - "a=T_on/T\n", - "V=(I_mx-I_mn*math.exp(-T_on/T_a))/(1-math.exp(-T_on/T_a))\n", - "a=.5\n", - "I_mn=(I_mx-V*(1-math.exp(-T_on/T_a)))/(math.exp(-T_on/T_a))\n", - "T=I_mx-I_mn \n", - "T=T_on/a\n", - "f=1/T \n", - "\n", - "#Results\n", - "print(\"higher limit of current pulsation=%.0f A\" %T)\n", - "print(\"chopping freq=%.3f Hz\" %f)\n", - "print(\"duty cycle ratio=%.2f\" %a)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "higher limit of current pulsation=0 A\n", - "chopping freq=35.714 Hz\n", - "duty cycle ratio=0.50\n" - ] - } - ], - "prompt_number": 32 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter7_3.ipynb b/_Power_Electronics/Chapter7_3.ipynb deleted file mode 100755 index 726160c8..00000000 --- a/_Power_Electronics/Chapter7_3.ipynb +++ /dev/null @@ -1,1036 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 07 : Choppers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.2, Page No 387" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.4 #duty cycle %a=T_on/T\n", - "V_s=230.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V=a*(V_s-2) \n", - "V_or=math.sqrt(a*(V_s-2)**2) \n", - "P_o=V_or**2/R\n", - "P_i=V_s*V/R\n", - "n=P_o*100/P_i \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.1f V\" %V)\n", - "print(\"rms value of o/p voltage=%.1f V\" %V_or)\n", - "print(\"chopper efficiency in percentage=%.2f\" %n)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=91.2 V\n", - "rms value of o/p voltage=144.2 V\n", - "chopper efficiency in percentage=99.13\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.3, Page No 388" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_i=220.0\n", - "V_o=660.0\n", - "\n", - "#Calculations\n", - "a=1-V_i/V_o\n", - "T_on=100.0 #microsecond\n", - "T=T_on/a\n", - "T_off=T-T_on \n", - "T_off=T_off/2\n", - "T_on=T-T_off\n", - "a=T_on/T\n", - "V_o=V_i/(1-a)\n", - "\n", - "#Results \n", - "print(\"pulse width of o/p voltage=%.0f us\" %T_off)\n", - "print(\"\\nnew o/p voltage=%.0f V\" %V_o)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "pulse width of o/p voltage=25 us\n", - "\n", - "new o/p voltage=1320 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.4 Page No 288" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_1=12.0\n", - "I_2=16.0\n", - "\n", - "#Calculations\n", - "I_0=(I_1+I_2)/2\n", - "R=10.0\n", - "V_0=I_0*R\n", - "V_s=200.0\n", - "a=V_0/V_s\n", - "r=a/(1-a)\n", - "\n", - "#Results\n", - "print(\"time ratio(T_on/T_off)=%.3f\" %r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time ratio(T_on/T_off)=2.333\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.5, Page No 390" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=660.0\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "a=(V_o/V_s)/(1+(V_o/V_s))\n", - "T_on=120\n", - "T=T_on/a\n", - "T_off=T-T_on \n", - "T_off=3*T_off\n", - "T_on=T-T_off\n", - "a=T_on/(T_on+T_off)\n", - "V_o=V_s*(a/(1-a)) \n", - "\n", - "#Results\n", - "print(\"pulse width o/p voltage=%.0f us\" %T_off)\n", - "print(\"\\nnew o/p voltage=%.2f V\" %V_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "pulse width o/p voltage=120 us\n", - "\n", - "new o/p voltage=73.33 V\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.11 Page No 408" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=1.0\n", - "L=.005\n", - "T_a=L/R\n", - "T=2000*10**-6\n", - "E=24.0\n", - "V_s=220\n", - "T_on=600*10**-6\n", - "a=T_on/T\n", - "\n", - "#Calculations\n", - "a1=(T_a/T)*math.log(1+(E/V_s)*((math.exp(T/T_a))-1))\n", - "if a1a :\n", - " print(\"load current is continuous\")\n", - "else:\n", - " print(\"load current is discontinuous\")\n", - "\n", - "t_x=T_on+L*math.log(1+((V_s-E)/272)*(1-math.exp(-T_on/T_a)))\n", - " #Value of t_x wrongly calculated in the book so ans of V_o and I_o varies\n", - "V_o=a*V_s+(1-t_x/T)*E \n", - "I_o=(V_o-E)/R \n", - "I_mx=(V_s-E)/R*(1-math.exp(-T_on/T_a)) \n", - "\n", - "#Results \n", - "print(\"avg o/p voltage=%.2f V\" %V_o)\n", - "print(\"avg o/p current=%.2f A\" %I_o) \n", - "print(\"max value of load current=%.1f A\" %I_mx)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "load current is discontinuous\n", - "avg o/p voltage=121.77 V\n", - "avg o/p current=49.77 A\n", - "max value of load current=81.5 A\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.13, Page No 412" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.2\n", - "V_s=500\n", - "E=a*V_s\n", - "L=0.06\n", - "I=10\n", - "\n", - "#Calculations\n", - "T_on=(L*I)/(V_s-E)\n", - "f=a/T_on \n", - "\n", - "#Results\n", - "print(\"chopping freq=%.2f Hz\" %f)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "chopping freq=133.33 Hz\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.14 Page No 412" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.5\n", - "pu=0.1 #pu ripple\n", - "\n", - "#Calculations\n", - " #x=T/T_a\n", - " #y=exp(-a*x)\n", - "y=(1-pu)/(1+pu)\n", - " #after solving\n", - "x=math.log(1/y)/a\n", - "f=1000\n", - "T=1/f\n", - "T_a=T/x\n", - "R=2\n", - "L=R*T_a\n", - "Li=0.002\n", - "Le=L-Li \n", - "\n", - "#Results\n", - "print(\"external inductance=%.3f mH\" %(Le*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "external inductance=-2.000 mH\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.15 Page No 414" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=10.0\n", - "L=0.015\n", - "T_a=L/R\n", - "f=1250.0\n", - "T=1.0/f\n", - "a=0.5\n", - "T_on=a*T\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "I_mx=(V_s/R)*((1-math.exp(-T_on/T_a))/(1-math.exp(-T/T_a))) \n", - "I_mn=(V_s/R)*((math.exp(T_on/T_a)-1)/(math.exp(T/T_a)-1)) \n", - "dI=I_mx-I_mn \n", - "V_o=a*V_s\n", - "I_o=V_o/R \n", - "I_or=math.sqrt(I_mx**2+dI**2/3+I_mx*dI) \n", - "I_chr=math.sqrt(a)*I_or \n", - "\n", - "#Results\n", - "print(\"Max value of ripple current=%.2f A\" %dI)\n", - "print(\"Max value of load current=%.3f A\" %I_mx)\n", - "print(\"Min value of load current=%.2f A\" %I_mn)\n", - "print(\"Avg value of load current=%.2f A\" %I_o) \n", - "print(\"rms value of load current=%.2f A\" %I_or)\n", - "print(\"rms value of chopper current=%.2f A\" %I_chr)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Max value of ripple current=2.92 A\n", - "Max value of load current=12.458 A\n", - "Min value of load current=9.54 A\n", - "Avg value of load current=11.00 A\n", - "rms value of load current=13.94 A\n", - "rms value of chopper current=9.86 A\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.17 Page No 417" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=0.0016\n", - "C=4*10**-6\n", - "\n", - "#Calculations\n", - "w=1/math.sqrt(L*C)\n", - "t=math.pi/w \n", - "\n", - "\n", - "#Results\n", - "print(\"time for which current flows=%.2f us\" %(t*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time for which current flows=251.33 us\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.18, Page No 424" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t_q=20.0*10**-6\n", - "dt=20.0*10**-6\n", - "\n", - "#Calculations\n", - "t_c=t_q+dt\n", - "I_0=60.0\n", - "V_s=60.0\n", - "C=t_c*I_0/V_s \n", - "\n", - "#Results \n", - "print(\"value of commutating capacitor=%.0f uF\" %(C*10**6))\n", - "\n", - "L1=(V_s/I_0)**2*C\n", - "L2=(2*t_c/math.pi)**2/C\n", - "if L1>L2 :\n", - " print(\"value of commutating inductor=%.0f uH\" %(L1*10**6))\n", - "else:\n", - " print(\"value of commutating inductor=%.0f uH\" %(L2*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of commutating capacitor=40 uF\n", - "value of commutating inductor=40 uH\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.19, Page No 424" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t=100.0*10**-6\n", - "R=10.0\n", - "\n", - "#Calculations\n", - " #V_s*(1-2*math.exp(-t/(R*C)))=0\n", - "C=-t/(R*math.log(1.0/2)) \n", - "L=(4/9.0)*C*R**2 \n", - "L=(1.0/4)*C*R**2 \n", - "\n", - "#Results\n", - "print(\"Value of comutating component C=%.3f uF\" %(C*10**6))\n", - "print(\"max permissible current through SCR is 2.5 times load current\")\n", - "print(\"value of comutating component L=%.1f uH\" %(L*10**6))\n", - "print(\"max permissible current through SCR is 1.5 times peak diode current\")\n", - "print(\"value of comutating component L=%.2f uH\" %(L*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of comutating component C=14.427 uF\n", - "max permissible current through SCR is 2.5 times load current\n", - "value of comutating component L=360.7 uH\n", - "max permissible current through SCR is 1.5 times peak diode current\n", - "value of comutating component L=360.67 uH\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.20, Page No 426" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_on=800.0*10**-6\n", - "V_s=220.0\n", - "I_o=80.0\n", - "C=50*10**-6\n", - "\n", - "#Calculations\n", - "T=T_on+2*V_s*C/I_o \n", - "L=20*10**-6\n", - "C=50*10**-6\n", - "i_T1=I_o+V_s*math.sqrt(C/L) \n", - "i_TA=I_o \n", - "t_c=C*V_s/I_o \n", - "t_c1=(math.pi/2)*math.sqrt(L*C) \n", - "t=150*10**-6\n", - "v_c=I_o*t/C-V_s \n", - "\n", - "#Results \n", - "print(\"effective on period=%.0f us\" %(T*10**6))\n", - "print(\"peak current through main thyristor=%.2f A\" %i_T1)\n", - "print(\"peak current through auxillery thyristor=%.0f A\" %i_TA)\n", - "print(\"turn off time for main thyristor=%.1f us\" %(t_c*10**6))\n", - "print(\"turn off time for auxillery thyristor=%.3f us\" %(t_c1*10**6))\n", - "print(\"total commutation interval=%.0f us\" %(2*t_c*10**6))\n", - "print(\"capacitor voltage=%.0f V\" %v_c)\n", - "print(\"time nedded to recharge the capacitor=%.0f us\" %(2*V_s*C/I_o*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle = 30deg\n", - "avg output voltage=232.509 V\n", - "for firing angle = 60deg\n", - "avg output voltage=133.65 V\n", - "avg current rating=12 A\n", - "rms current rating=20.785 A\n", - "PIV of SCR=565.7 V\n", - "power dissipated=16.8 W\n" - ] - } - ], - "prompt_number": 122 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.21, Page No 427" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_o=260.0\n", - "V_s=220.0\n", - "fos=2 #factor of safety\n", - "\n", - "#Calculations\n", - "t_off=18*10**-6\n", - "t_c=2*t_off\n", - "C=t_c*I_o/V_s \n", - "L=(V_s/(0.8*I_o))**2*C \n", - "f=400\n", - "a_mn=math.pi*f*math.sqrt(L*C)\n", - "V_omn=V_s*(a_mn+2*f*t_c) \n", - "V_omx=V_s \n", - "\n", - "#Results\n", - "print(\"Value of C=%.3f uF\" %(C*10**6))\n", - "print(\"value of L=%.3f uH\" %(L*10**6))\n", - "print(\"min value of o/p voltage=%.3f V\" %V_omn)\n", - "print(\"max value of o/p voltage=%.0f V\" %V_omx)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=47.461 deg\n", - "pf=0.646\n", - "firing angle delay=127.71 deg\n" - ] - } - ], - "prompt_number": "*" - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.22, Page No 434" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "x=2.0\n", - "t_q=30*10**-6\n", - "dt=30*10**-6\n", - "t_c=t_q+dt\n", - "V_s=230.0\n", - "I_o=200.0\n", - "\n", - "#Calculations\n", - "L=V_s*t_c/(x*I_o*(math.pi-2*math.asin(1/x))) \n", - "C=x*I_o*t_c/(V_s*(math.pi-2*math.asin(1/x))) \n", - "V_cp=V_s+I_o*math.sqrt(L/C) \n", - "I_cp=x*I_o \n", - "x=3\n", - "L=V_s*t_c/(x*I_o*(math.pi-2*math.asin(1/x))) \n", - "C=x*I_o*t_c/(V_s*(math.pi-2*math.asin(1/x))) \n", - "V_cp=V_s+I_o*math.sqrt(L/C) \n", - "I_cp=x*I_o \n", - "\n", - "#Results\n", - "print(\"value of commutating inductor=%.3f uH\" %(L*10**6))\n", - "print(\"value of commutating capacitor=%.3f uF\" %(C*10**6))\n", - "print(\"peak capacitor voltage=%.0f V\" %V_cp)\n", - "print(\"peak commutataing current=%.0f A\" %I_cp)\n", - "print(\"value of commutating inductor=%.3f uH\" %(L*10**6))\n", - "print(\"value of commutating capacitor=%.3f uF\" %(C*10**6))\n", - "print(\"peak capacitor voltage=%.2f V\" %V_cp)\n", - "print(\"peak commutataing current=%.0f A\" %I_cp)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of commutating inductor=7.321 uH\n", - "value of commutating capacitor=49.822 uF\n", - "peak capacitor voltage=307 V\n", - "peak commutataing current=600 A\n", - "value of commutating inductor=7.321 uH\n", - "value of commutating capacitor=49.822 uF\n", - "peak capacitor voltage=306.67 V\n", - "peak commutataing current=600 A\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.23, Page No 434" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=230\n", - "C=50*10**-6\n", - "L=20*10**-6\n", - "I_cp=V_s*math.sqrt(C/L)\n", - "I_o=200\n", - "x=I_cp/I_o\n", - "\n", - "#Calculations\n", - "t_c=(math.pi-2*math.asin(1/x))*math.sqrt(C*L) \n", - "th1=math.degrees(math.asin(1.0/x))\n", - "t=(5*math.pi/2-th1*math.pi/180)*math.sqrt(L*C)+C*V_s*(1-math.cos(math.radians(th1)))/I_o \n", - "t=(math.pi-th1*math.pi/180)*math.sqrt(L*C) \n", - "\n", - "#Results\n", - "print(\"turn off time of main thyristor=%.2f us\" %(t_c*10**6))\n", - "print(\"total commutation interval=%.3f us\" %(t*10**6))\n", - "print(\"turn off time of auxillery thyristor=%.3f us\" %(t*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "turn off time of main thyristor=62.52 us\n", - "total commutation interval=80.931 us\n", - "turn off time of auxillery thyristor=80.931 us\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.24, Page No 440" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tc=0.006\n", - "R=10.0\n", - "L=R*tc\n", - "f=2000.0\n", - "\n", - "#Calculations\n", - "T=1/f\n", - "V_o=50.0\n", - "V_s=100.0\n", - "a=V_o/V_s\n", - "T_on=a*T\n", - "T_off=T-T_on\n", - "dI=V_o*T_off/L\n", - "I_o=V_o/R\n", - "I2=I_o+dI/2 \n", - "I1=I_o-dI/2 \n", - "\n", - "#Results\n", - "print(\"max value of load current=%.3f A\" %I2)\n", - "print(\"min value of load current=%.3f A\" %I1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max value of load current=5.104 A\n", - "min value of load current=4.896 A\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.27, Page No 443" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=30.0\n", - "r_a=.5\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "a=I_a*r_a/V_s \n", - "a=1\n", - "k=.1 #V/rpm\n", - "N=(a*V_s-I_a*r_a)/k \n", - "\n", - "#Results\n", - "print(\"min value of duty cycle=%.3f\" %a)\n", - "print(\"min Value of speed control=%.0f rpm\" %0)\n", - "print(\"max value of duty cycle=%.0f\" %a)\n", - "print(\"max value of speed control=%.0f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "min value of duty cycle=1.000\n", - "min Value of speed control=0 rpm\n", - "max value of duty cycle=1\n", - "max value of speed control=2050 rpm\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.28, Page No 444" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=72.0\n", - "I_a=200.0\n", - "r_a=0.045\n", - "N=2500.0\n", - "\n", - "#Calculations\n", - "k=(V_t-I_a*r_a)/N\n", - "E_a=k*1000\n", - "L=.007\n", - "Rm=.045\n", - "Rb=0.065\n", - "R=Rm+Rb\n", - "T_a=L/R\n", - "I_mx=230\n", - "I_mn=180\n", - "T_on=-T_a*math.log(-((V_t-E_a)/R-I_mx)/((I_mn)-(V_t-E_a)/R))\n", - "R=Rm\n", - "T_a=L/R\n", - "T_off=-T_a*math.log(-((-E_a)/R-I_mn)/((I_mx)-(-E_a)/R))\n", - "T=T_on+T_off\n", - "f=1/T \n", - "a=T_on/T \n", - "\n", - "#Results\n", - "print(\"chopping freq=%.1f Hz\" %f) \n", - "print(\"duty cycle ratio=%.3f\" %a)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "chopping freq=40.5 Hz\n", - "\n", - "duty cycle ratio=0.588\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.29, Page No 445" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesI_mx=425\n", - "I_lt=180.0 #lower limit of current pulsation\n", - "I_mn=I_mx-I_lt\n", - "T_on=0.014\n", - "T_off=0.011\n", - "\n", - "#Calculations\n", - "T=T_on+T_off\n", - "T_a=.0635\n", - "a=T_on/T\n", - "V=(I_mx-I_mn*math.exp(-T_on/T_a))/(1-math.exp(-T_on/T_a))\n", - "a=.5\n", - "I_mn=(I_mx-V*(1-math.exp(-T_on/T_a)))/(math.exp(-T_on/T_a))\n", - "T=I_mx-I_mn \n", - "T=T_on/a\n", - "f=1/T \n", - "\n", - "#Results\n", - "print(\"higher limit of current pulsation=%.0f A\" %T)\n", - "print(\"chopping freq=%.3f Hz\" %f)\n", - "print(\"duty cycle ratio=%.2f\" %a)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "higher limit of current pulsation=0 A\n", - "chopping freq=35.714 Hz\n", - "duty cycle ratio=0.50\n" - ] - } - ], - "prompt_number": 32 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter7_4.ipynb b/_Power_Electronics/Chapter7_4.ipynb deleted file mode 100755 index 726160c8..00000000 --- a/_Power_Electronics/Chapter7_4.ipynb +++ /dev/null @@ -1,1036 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 07 : Choppers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.2, Page No 387" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.4 #duty cycle %a=T_on/T\n", - "V_s=230.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "V=a*(V_s-2) \n", - "V_or=math.sqrt(a*(V_s-2)**2) \n", - "P_o=V_or**2/R\n", - "P_i=V_s*V/R\n", - "n=P_o*100/P_i \n", - "\n", - "#Results\n", - "print(\"avg o/p voltage=%.1f V\" %V)\n", - "print(\"rms value of o/p voltage=%.1f V\" %V_or)\n", - "print(\"chopper efficiency in percentage=%.2f\" %n)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "avg o/p voltage=91.2 V\n", - "rms value of o/p voltage=144.2 V\n", - "chopper efficiency in percentage=99.13\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.3, Page No 388" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_i=220.0\n", - "V_o=660.0\n", - "\n", - "#Calculations\n", - "a=1-V_i/V_o\n", - "T_on=100.0 #microsecond\n", - "T=T_on/a\n", - "T_off=T-T_on \n", - "T_off=T_off/2\n", - "T_on=T-T_off\n", - "a=T_on/T\n", - "V_o=V_i/(1-a)\n", - "\n", - "#Results \n", - "print(\"pulse width of o/p voltage=%.0f us\" %T_off)\n", - "print(\"\\nnew o/p voltage=%.0f V\" %V_o)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "pulse width of o/p voltage=25 us\n", - "\n", - "new o/p voltage=1320 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.4 Page No 288" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_1=12.0\n", - "I_2=16.0\n", - "\n", - "#Calculations\n", - "I_0=(I_1+I_2)/2\n", - "R=10.0\n", - "V_0=I_0*R\n", - "V_s=200.0\n", - "a=V_0/V_s\n", - "r=a/(1-a)\n", - "\n", - "#Results\n", - "print(\"time ratio(T_on/T_off)=%.3f\" %r)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time ratio(T_on/T_off)=2.333\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.5, Page No 390" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_o=660.0\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "a=(V_o/V_s)/(1+(V_o/V_s))\n", - "T_on=120\n", - "T=T_on/a\n", - "T_off=T-T_on \n", - "T_off=3*T_off\n", - "T_on=T-T_off\n", - "a=T_on/(T_on+T_off)\n", - "V_o=V_s*(a/(1-a)) \n", - "\n", - "#Results\n", - "print(\"pulse width o/p voltage=%.0f us\" %T_off)\n", - "print(\"\\nnew o/p voltage=%.2f V\" %V_o)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "pulse width o/p voltage=120 us\n", - "\n", - "new o/p voltage=73.33 V\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.11 Page No 408" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=1.0\n", - "L=.005\n", - "T_a=L/R\n", - "T=2000*10**-6\n", - "E=24.0\n", - "V_s=220\n", - "T_on=600*10**-6\n", - "a=T_on/T\n", - "\n", - "#Calculations\n", - "a1=(T_a/T)*math.log(1+(E/V_s)*((math.exp(T/T_a))-1))\n", - "if a1a :\n", - " print(\"load current is continuous\")\n", - "else:\n", - " print(\"load current is discontinuous\")\n", - "\n", - "t_x=T_on+L*math.log(1+((V_s-E)/272)*(1-math.exp(-T_on/T_a)))\n", - " #Value of t_x wrongly calculated in the book so ans of V_o and I_o varies\n", - "V_o=a*V_s+(1-t_x/T)*E \n", - "I_o=(V_o-E)/R \n", - "I_mx=(V_s-E)/R*(1-math.exp(-T_on/T_a)) \n", - "\n", - "#Results \n", - "print(\"avg o/p voltage=%.2f V\" %V_o)\n", - "print(\"avg o/p current=%.2f A\" %I_o) \n", - "print(\"max value of load current=%.1f A\" %I_mx)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "load current is discontinuous\n", - "avg o/p voltage=121.77 V\n", - "avg o/p current=49.77 A\n", - "max value of load current=81.5 A\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.13, Page No 412" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.2\n", - "V_s=500\n", - "E=a*V_s\n", - "L=0.06\n", - "I=10\n", - "\n", - "#Calculations\n", - "T_on=(L*I)/(V_s-E)\n", - "f=a/T_on \n", - "\n", - "#Results\n", - "print(\"chopping freq=%.2f Hz\" %f)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "chopping freq=133.33 Hz\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.14 Page No 412" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=0.5\n", - "pu=0.1 #pu ripple\n", - "\n", - "#Calculations\n", - " #x=T/T_a\n", - " #y=exp(-a*x)\n", - "y=(1-pu)/(1+pu)\n", - " #after solving\n", - "x=math.log(1/y)/a\n", - "f=1000\n", - "T=1/f\n", - "T_a=T/x\n", - "R=2\n", - "L=R*T_a\n", - "Li=0.002\n", - "Le=L-Li \n", - "\n", - "#Results\n", - "print(\"external inductance=%.3f mH\" %(Le*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "external inductance=-2.000 mH\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.15 Page No 414" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=10.0\n", - "L=0.015\n", - "T_a=L/R\n", - "f=1250.0\n", - "T=1.0/f\n", - "a=0.5\n", - "T_on=a*T\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "I_mx=(V_s/R)*((1-math.exp(-T_on/T_a))/(1-math.exp(-T/T_a))) \n", - "I_mn=(V_s/R)*((math.exp(T_on/T_a)-1)/(math.exp(T/T_a)-1)) \n", - "dI=I_mx-I_mn \n", - "V_o=a*V_s\n", - "I_o=V_o/R \n", - "I_or=math.sqrt(I_mx**2+dI**2/3+I_mx*dI) \n", - "I_chr=math.sqrt(a)*I_or \n", - "\n", - "#Results\n", - "print(\"Max value of ripple current=%.2f A\" %dI)\n", - "print(\"Max value of load current=%.3f A\" %I_mx)\n", - "print(\"Min value of load current=%.2f A\" %I_mn)\n", - "print(\"Avg value of load current=%.2f A\" %I_o) \n", - "print(\"rms value of load current=%.2f A\" %I_or)\n", - "print(\"rms value of chopper current=%.2f A\" %I_chr)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Max value of ripple current=2.92 A\n", - "Max value of load current=12.458 A\n", - "Min value of load current=9.54 A\n", - "Avg value of load current=11.00 A\n", - "rms value of load current=13.94 A\n", - "rms value of chopper current=9.86 A\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.17 Page No 417" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=0.0016\n", - "C=4*10**-6\n", - "\n", - "#Calculations\n", - "w=1/math.sqrt(L*C)\n", - "t=math.pi/w \n", - "\n", - "\n", - "#Results\n", - "print(\"time for which current flows=%.2f us\" %(t*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time for which current flows=251.33 us\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.18, Page No 424" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t_q=20.0*10**-6\n", - "dt=20.0*10**-6\n", - "\n", - "#Calculations\n", - "t_c=t_q+dt\n", - "I_0=60.0\n", - "V_s=60.0\n", - "C=t_c*I_0/V_s \n", - "\n", - "#Results \n", - "print(\"value of commutating capacitor=%.0f uF\" %(C*10**6))\n", - "\n", - "L1=(V_s/I_0)**2*C\n", - "L2=(2*t_c/math.pi)**2/C\n", - "if L1>L2 :\n", - " print(\"value of commutating inductor=%.0f uH\" %(L1*10**6))\n", - "else:\n", - " print(\"value of commutating inductor=%.0f uH\" %(L2*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of commutating capacitor=40 uF\n", - "value of commutating inductor=40 uH\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.19, Page No 424" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t=100.0*10**-6\n", - "R=10.0\n", - "\n", - "#Calculations\n", - " #V_s*(1-2*math.exp(-t/(R*C)))=0\n", - "C=-t/(R*math.log(1.0/2)) \n", - "L=(4/9.0)*C*R**2 \n", - "L=(1.0/4)*C*R**2 \n", - "\n", - "#Results\n", - "print(\"Value of comutating component C=%.3f uF\" %(C*10**6))\n", - "print(\"max permissible current through SCR is 2.5 times load current\")\n", - "print(\"value of comutating component L=%.1f uH\" %(L*10**6))\n", - "print(\"max permissible current through SCR is 1.5 times peak diode current\")\n", - "print(\"value of comutating component L=%.2f uH\" %(L*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of comutating component C=14.427 uF\n", - "max permissible current through SCR is 2.5 times load current\n", - "value of comutating component L=360.7 uH\n", - "max permissible current through SCR is 1.5 times peak diode current\n", - "value of comutating component L=360.67 uH\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.20, Page No 426" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T_on=800.0*10**-6\n", - "V_s=220.0\n", - "I_o=80.0\n", - "C=50*10**-6\n", - "\n", - "#Calculations\n", - "T=T_on+2*V_s*C/I_o \n", - "L=20*10**-6\n", - "C=50*10**-6\n", - "i_T1=I_o+V_s*math.sqrt(C/L) \n", - "i_TA=I_o \n", - "t_c=C*V_s/I_o \n", - "t_c1=(math.pi/2)*math.sqrt(L*C) \n", - "t=150*10**-6\n", - "v_c=I_o*t/C-V_s \n", - "\n", - "#Results \n", - "print(\"effective on period=%.0f us\" %(T*10**6))\n", - "print(\"peak current through main thyristor=%.2f A\" %i_T1)\n", - "print(\"peak current through auxillery thyristor=%.0f A\" %i_TA)\n", - "print(\"turn off time for main thyristor=%.1f us\" %(t_c*10**6))\n", - "print(\"turn off time for auxillery thyristor=%.3f us\" %(t_c1*10**6))\n", - "print(\"total commutation interval=%.0f us\" %(2*t_c*10**6))\n", - "print(\"capacitor voltage=%.0f V\" %v_c)\n", - "print(\"time nedded to recharge the capacitor=%.0f us\" %(2*V_s*C/I_o*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for firing angle = 30deg\n", - "avg output voltage=232.509 V\n", - "for firing angle = 60deg\n", - "avg output voltage=133.65 V\n", - "avg current rating=12 A\n", - "rms current rating=20.785 A\n", - "PIV of SCR=565.7 V\n", - "power dissipated=16.8 W\n" - ] - } - ], - "prompt_number": 122 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.21, Page No 427" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_o=260.0\n", - "V_s=220.0\n", - "fos=2 #factor of safety\n", - "\n", - "#Calculations\n", - "t_off=18*10**-6\n", - "t_c=2*t_off\n", - "C=t_c*I_o/V_s \n", - "L=(V_s/(0.8*I_o))**2*C \n", - "f=400\n", - "a_mn=math.pi*f*math.sqrt(L*C)\n", - "V_omn=V_s*(a_mn+2*f*t_c) \n", - "V_omx=V_s \n", - "\n", - "#Results\n", - "print(\"Value of C=%.3f uF\" %(C*10**6))\n", - "print(\"value of L=%.3f uH\" %(L*10**6))\n", - "print(\"min value of o/p voltage=%.3f V\" %V_omn)\n", - "print(\"max value of o/p voltage=%.0f V\" %V_omx)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "firing angle delay=47.461 deg\n", - "pf=0.646\n", - "firing angle delay=127.71 deg\n" - ] - } - ], - "prompt_number": "*" - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.22, Page No 434" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "x=2.0\n", - "t_q=30*10**-6\n", - "dt=30*10**-6\n", - "t_c=t_q+dt\n", - "V_s=230.0\n", - "I_o=200.0\n", - "\n", - "#Calculations\n", - "L=V_s*t_c/(x*I_o*(math.pi-2*math.asin(1/x))) \n", - "C=x*I_o*t_c/(V_s*(math.pi-2*math.asin(1/x))) \n", - "V_cp=V_s+I_o*math.sqrt(L/C) \n", - "I_cp=x*I_o \n", - "x=3\n", - "L=V_s*t_c/(x*I_o*(math.pi-2*math.asin(1/x))) \n", - "C=x*I_o*t_c/(V_s*(math.pi-2*math.asin(1/x))) \n", - "V_cp=V_s+I_o*math.sqrt(L/C) \n", - "I_cp=x*I_o \n", - "\n", - "#Results\n", - "print(\"value of commutating inductor=%.3f uH\" %(L*10**6))\n", - "print(\"value of commutating capacitor=%.3f uF\" %(C*10**6))\n", - "print(\"peak capacitor voltage=%.0f V\" %V_cp)\n", - "print(\"peak commutataing current=%.0f A\" %I_cp)\n", - "print(\"value of commutating inductor=%.3f uH\" %(L*10**6))\n", - "print(\"value of commutating capacitor=%.3f uF\" %(C*10**6))\n", - "print(\"peak capacitor voltage=%.2f V\" %V_cp)\n", - "print(\"peak commutataing current=%.0f A\" %I_cp)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of commutating inductor=7.321 uH\n", - "value of commutating capacitor=49.822 uF\n", - "peak capacitor voltage=307 V\n", - "peak commutataing current=600 A\n", - "value of commutating inductor=7.321 uH\n", - "value of commutating capacitor=49.822 uF\n", - "peak capacitor voltage=306.67 V\n", - "peak commutataing current=600 A\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.23, Page No 434" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesV_s=230\n", - "C=50*10**-6\n", - "L=20*10**-6\n", - "I_cp=V_s*math.sqrt(C/L)\n", - "I_o=200\n", - "x=I_cp/I_o\n", - "\n", - "#Calculations\n", - "t_c=(math.pi-2*math.asin(1/x))*math.sqrt(C*L) \n", - "th1=math.degrees(math.asin(1.0/x))\n", - "t=(5*math.pi/2-th1*math.pi/180)*math.sqrt(L*C)+C*V_s*(1-math.cos(math.radians(th1)))/I_o \n", - "t=(math.pi-th1*math.pi/180)*math.sqrt(L*C) \n", - "\n", - "#Results\n", - "print(\"turn off time of main thyristor=%.2f us\" %(t_c*10**6))\n", - "print(\"total commutation interval=%.3f us\" %(t*10**6))\n", - "print(\"turn off time of auxillery thyristor=%.3f us\" %(t*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "turn off time of main thyristor=62.52 us\n", - "total commutation interval=80.931 us\n", - "turn off time of auxillery thyristor=80.931 us\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.24, Page No 440" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "tc=0.006\n", - "R=10.0\n", - "L=R*tc\n", - "f=2000.0\n", - "\n", - "#Calculations\n", - "T=1/f\n", - "V_o=50.0\n", - "V_s=100.0\n", - "a=V_o/V_s\n", - "T_on=a*T\n", - "T_off=T-T_on\n", - "dI=V_o*T_off/L\n", - "I_o=V_o/R\n", - "I2=I_o+dI/2 \n", - "I1=I_o-dI/2 \n", - "\n", - "#Results\n", - "print(\"max value of load current=%.3f A\" %I2)\n", - "print(\"min value of load current=%.3f A\" %I1)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max value of load current=5.104 A\n", - "min value of load current=4.896 A\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.27, Page No 443" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "I_a=30.0\n", - "r_a=.5\n", - "V_s=220.0\n", - "\n", - "#Calculations\n", - "a=I_a*r_a/V_s \n", - "a=1\n", - "k=.1 #V/rpm\n", - "N=(a*V_s-I_a*r_a)/k \n", - "\n", - "#Results\n", - "print(\"min value of duty cycle=%.3f\" %a)\n", - "print(\"min Value of speed control=%.0f rpm\" %0)\n", - "print(\"max value of duty cycle=%.0f\" %a)\n", - "print(\"max value of speed control=%.0f rpm\" %N)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "min value of duty cycle=1.000\n", - "min Value of speed control=0 rpm\n", - "max value of duty cycle=1\n", - "max value of speed control=2050 rpm\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.28, Page No 444" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_t=72.0\n", - "I_a=200.0\n", - "r_a=0.045\n", - "N=2500.0\n", - "\n", - "#Calculations\n", - "k=(V_t-I_a*r_a)/N\n", - "E_a=k*1000\n", - "L=.007\n", - "Rm=.045\n", - "Rb=0.065\n", - "R=Rm+Rb\n", - "T_a=L/R\n", - "I_mx=230\n", - "I_mn=180\n", - "T_on=-T_a*math.log(-((V_t-E_a)/R-I_mx)/((I_mn)-(V_t-E_a)/R))\n", - "R=Rm\n", - "T_a=L/R\n", - "T_off=-T_a*math.log(-((-E_a)/R-I_mn)/((I_mx)-(-E_a)/R))\n", - "T=T_on+T_off\n", - "f=1/T \n", - "a=T_on/T \n", - "\n", - "#Results\n", - "print(\"chopping freq=%.1f Hz\" %f) \n", - "print(\"duty cycle ratio=%.3f\" %a)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "chopping freq=40.5 Hz\n", - "\n", - "duty cycle ratio=0.588\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 7.29, Page No 445" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variablesI_mx=425\n", - "I_lt=180.0 #lower limit of current pulsation\n", - "I_mn=I_mx-I_lt\n", - "T_on=0.014\n", - "T_off=0.011\n", - "\n", - "#Calculations\n", - "T=T_on+T_off\n", - "T_a=.0635\n", - "a=T_on/T\n", - "V=(I_mx-I_mn*math.exp(-T_on/T_a))/(1-math.exp(-T_on/T_a))\n", - "a=.5\n", - "I_mn=(I_mx-V*(1-math.exp(-T_on/T_a)))/(math.exp(-T_on/T_a))\n", - "T=I_mx-I_mn \n", - "T=T_on/a\n", - "f=1/T \n", - "\n", - "#Results\n", - "print(\"higher limit of current pulsation=%.0f A\" %T)\n", - "print(\"chopping freq=%.3f Hz\" %f)\n", - "print(\"duty cycle ratio=%.2f\" %a)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "higher limit of current pulsation=0 A\n", - "chopping freq=35.714 Hz\n", - "duty cycle ratio=0.50\n" - ] - } - ], - "prompt_number": 32 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter8.ipynb b/_Power_Electronics/Chapter8.ipynb deleted file mode 100755 index 721a9faf..00000000 --- a/_Power_Electronics/Chapter8.ipynb +++ /dev/null @@ -1,984 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 08 : Inverters" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.3, Page No 465" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T=0.1*10**-3\n", - "f=1.0/T\n", - "k=15*10**-6 #k=th/w\n", - "\n", - "#Calculations\n", - "th=2*math.pi*f*k\n", - "X_l=10.0\n", - "R=2.0\n", - "X_c=R*math.tan(th)+X_l\n", - "C=1/(2*math.pi*f*X_c) \n", - "\n", - "#Results\n", - "print(\"value of C=%.3f uF\" %(C*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of C=1.248 uF\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.4 Page No 466" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "\n", - "#Calculations\n", - "V_01=2*V_s/(math.sqrt(2)*math.pi)\n", - "R=2.0\n", - "I_01=V_01/R\n", - "P_d=I_01**2*R \n", - "V=V_s/2\n", - "I_s=math.sqrt(2)*I_01/math.pi\n", - "P_s=V*I_s\n", - "\n", - "#Results\n", - "print(\"power delivered to load=%.1f W\" %P_d)\n", - "print(\"power delivered by both sources=%.1f W\" %(2*P_s))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power delivered to load=5359.9 W\n", - "power delivered by both sources=5359.9 W\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.5, Page No 468" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_01=4*V_s/(math.pi*math.sqrt(2))\n", - "R=1.0\n", - "X_L=6.0\n", - "X_c=7.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/math.sqrt(R**2+(X_L-X_c)**2)\n", - "P=I_01**2*R \n", - "I_s=math.sqrt(2)*I_01*(2*math.cos(math.radians(45)))/math.pi\n", - "P_s=V_s*I_s \n", - "\n", - "#Results\n", - "print(\"power delivered to the source=%.3f kW\" %(P/1000))\n", - "print(\"\\npower from the source=%.3f kW\" %(P_s/1000))\n", - " " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power delivered to the source=21.440 kW\n", - "\n", - "power from the source=21.440 kW\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.6 Page No 469" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_01=230.0\n", - "R=2.0\n", - "I_01=V_01/R\n", - "I_m=I_01*math.sqrt(2)\n", - "I_T1=I_m/2 \n", - "I_D1=0 \n", - "X_L=8.0\n", - "X_C=6.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=math.degrees(math.atan((X_L-X_C)/R))\n", - "I_T1=I_T1*math.sqrt(2)*0.47675 \n", - "I_D1=.1507025*I_m/math.sqrt(2) \n", - "\n", - "\n", - "#Results\n", - "print(\"when load R=2 ohm\")\n", - "print(\"rms value of thyristor current=%.2f A\" %I_T1)\n", - "print(\"rms value of diode current=%.0f A\" %I_D1)\n", - "print(\"when load R=2ohm % X_L=8ohm and X_C=6ohm\")\n", - "print(\"rms value of thyristor current=%.3f A\" %I_T1)\n", - "print(\"rms value of diode current=%.3f A\" %I_D1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when load R=2 ohm\n", - "rms value of thyristor current=54.83 A\n", - "rms value of diode current=17 A\n", - "when load R=2ohm % X_L=8ohm and X_C=6ohm\n", - "rms value of thyristor current=54.826 A\n", - "rms value of diode current=17.331 A\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.7 Page No 470" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=4.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.035\n", - "\n", - "#Calculations\n", - "C=155*10**-6\n", - "X_L=w*L\n", - "X_C=1/(w*C)\n", - "Z1=math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=-math.degrees(math.atan((X_L-X_C)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3-X_C/3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3-X_C/3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5-X_C/5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5-X_C/5)/R))\n", - "I_m1=4*V_s/(Z1*math.pi)\n", - "I_01=I_m1/math.sqrt(2) \n", - "I_m3=4*V_s/(3*Z3*math.pi)\n", - "I_m5=4*V_s/(5*Z5*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2)\n", - "I_0=I_m/math.sqrt(2)\n", - "P_0=(I_0)**2*R \n", - "P_01=(I_01)**2*R \n", - "t1=(180-phi1)*math.pi/(180*w) \n", - "t1=(phi1)*math.pi/(180*w) \n", - "\n", - "#Results\n", - "print(\"rms value of fundamental load current=%.2f A\" %I_01)\n", - "print(\"load power=%.1f W\" %P_0)\n", - "print(\"fundamental load power=%.1f W\" %P_01)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_m/2))\n", - "print(\"conduction time for thyristor=%.3f ms\" %(t1*1000))\n", - "print(\"Conduction time for diodes=%.3f ms\" %(t1*1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of fundamental load current=20.02 A\n", - "load power=1632.5 W\n", - "fundamental load power=1602.6 W\n", - "rms value of thyristor current=14.285 A\n", - "conduction time for thyristor=3.736 ms\n", - "Conduction time for diodes=3.736 ms\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.8, Page No 473" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_01=2*V_s/(math.sqrt(2)*math.pi) \n", - "R=10.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/R\n", - "P=I_01**2*R \n", - "V_or=math.sqrt((V_s/2)**2)\n", - "P=V_or**2/R \n", - "I_TP=V_s/(2*R)\n", - "I_or=I_TP\n", - "pf=I_01**2*R/(V_or*I_or) \n", - "DF=V_01/V_or \n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "V_03=V_01/3\n", - "HF=V_03/V_01\n", - "\n", - "#Results\n", - "print(\"fundamental rms o/p voltage=%.3f V\" %V_01)\n", - "print(\"fundamental power to load=%.1f W\" %P)\n", - "print(\"total o/p power to load=%.1f W\" %P)\n", - "print(\"avg SCR current=%.2f A\" %(I_TP*180/360))\n", - "print(\"i/p pf=%.3f\" %pf) \n", - "print(\"distortion factor=%.1f\" %DF)\n", - "print(\"THD=%.3f\" %THD) \n", - "print(\"harmonic factor=%.4f\" %HF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fundamental rms o/p voltage=103.536 V\n", - "fundamental power to load=1322.5 W\n", - "total o/p power to load=1322.5 W\n", - "avg SCR current=5.75 A\n", - "i/p pf=0.811\n", - "distortion factor=0.9\n", - "THD=0.483\n", - "harmonic factor=0.3333\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.9 Page No 474" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=60\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi) \n", - "V_01=4*V_s/(math.sqrt(2)*math.pi) \n", - "P_o=V_or**2/R \n", - "P_01=V_01**2/R \n", - "I_s=V_s/R \n", - "I_avg=I_s*math.pi/(2*math.pi) \n", - "V_03=V_01/3\n", - "HF=V_03/V_01 \n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.0f V\" %V_or)\n", - "print(\"o/p power=%.0f W\" %P_o)\n", - "print(\"fundamental component of rms voltage=%.2f V\" %V_01)\n", - "print(\"fundamental freq o/p power=%.2f W\" %P_01) \n", - "print(\"peak current=%.0f A\" %I_s)\n", - "print(\"avg current of each transistor=%.0f A\" %I_avg)\n", - "print(\"peak reverse blocking voltage=%.0f V\" %V_s)\n", - "print(\"harmonic factor=%.4f\" %HF)\n", - "print(\"THD=%.4f\" %THD)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=60 V\n", - "o/p power=1200 W\n", - "fundamental component of rms voltage=54.02 V\n", - "fundamental freq o/p power=972.68 W\n", - "peak current=20 A\n", - "avg current of each transistor=10 A\n", - "peak reverse blocking voltage=60 V\n", - "harmonic factor=0.3333\n", - "THD=0.4834\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.10 Page No 475" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=220.0\n", - "R=6.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.03\n", - "C=180*10**-6\n", - "X_L=w*L\n", - "X_C=1/(w*C)\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi)\n", - "V_01=4*V_s/(math.sqrt(2)*math.pi)\n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "print(\"THD of voltage=%.4f\" %THD)\n", - "DF=V_01/V_or \n", - "Z1=math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=-math.degrees(math.atan((X_L-X_C)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3-X_C/3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3-X_C/3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5-X_C/5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5-X_C/5)/R))\n", - "Z7=math.sqrt(R**2+(X_L*7-X_C/7)**2)\n", - "phi7=math.degrees(math.atan((X_L*7-X_C/7)/R))\n", - "I_01=19.403\n", - "I_m1=4*V_s/(Z1*math.pi)\n", - "I_m3=4*V_s/(3*Z3*math.pi)\n", - "I_m5=4*V_s/(5*Z5*math.pi)\n", - "I_m7=4*V_s/(7*Z7*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2+I_m7**2)\n", - "I_or=I_m/math.sqrt(2)\n", - "I_oh=math.sqrt((I_m**2-I_m1**2)/2)\n", - "THD=I_oh/I_01 \n", - "DF=I_01/I_or \n", - "P_o=I_or**2*R \n", - "I_avg=P_o/V_s \n", - "t1=(180-phi1)*math.pi/(180*w) \n", - "t1=1/(2*f)-t1 \n", - "I_p=I_m1 \n", - "I_t1=.46135*I_p \n", - "\n", - "#Results\n", - "print(\"\\nDF=%.1f\" %DF)\n", - "print(\"THD of current=%.4f\" %THD) \n", - "print(\"DF=%.3f\" %DF)\n", - "print(\"load power=%.1f W\" %P_o)\n", - "print(\"avg value of load current=%.2f A\" %I_avg)\n", - "print(\"conduction time for thyristor=%.0f ms\" %(t1*1000))\n", - "print(\"conduction time for diodes=%.0f ms\" %(t1*1000))\n", - "print(\"peak transistor current=%.2f A\" %I_p)\n", - "print(\"rms transistor current=%.2f A\" %I_t1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THD of voltage=0.4834\n", - "\n", - "DF=1.0\n", - "THD of current=0.1557\n", - "DF=0.988\n", - "load power=2313.5 W\n", - "avg value of load current=10.52 A\n", - "conduction time for thyristor=3 ms\n", - "conduction time for diodes=3 ms\n", - "peak transistor current=27.44 A\n", - "rms transistor current=12.66 A\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.11 Page No 497" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=450.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "I_or=math.sqrt((V_s/(3*R))**2*2/3+(2*V_s/(3*R))**2*1/3) \n", - "I_T1=math.sqrt((1/(2*math.pi))*((V_s/(3*R))**2*2*math.pi/3+(2*V_s/(3*R))**2*math.pi/3)) \n", - "P=3*I_or**2*R \n", - "I_or=math.sqrt((1/(math.pi))*((V_s/(2*R))**2*2*math.pi/3)) \n", - "I_T1=math.sqrt((1/(2*math.pi))*((V_s/(2*R))**2*2*math.pi/3)) \n", - "P=3*I_or**2*R \n", - "\n", - "#Results\n", - "print(\"for 180deg mode\")\n", - "print(\"rms value of load current=%.3f A\" %I_or)\n", - "print(\"power delivered to load=%.1f kW\" %(P/1000))\n", - "print(\"rms value of load current=%.0f A\" %I_T1)\n", - "print(\"for 120deg mode\")\n", - "print(\"rms value of load current=%.3f A\" %I_or)\n", - "print(\"rms value of load current=%.2f A\" %I_T1)\n", - "print(\"power delivered to load=%.3f kW\" %(P/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for 180deg mode\n", - "rms value of load current=18.371 A\n", - "power delivered to load=10.1 kW\n", - "rms value of load current=13 A\n", - "for 120deg mode\n", - "rms value of load current=18.371 A\n", - "rms value of load current=12.99 A\n", - "power delivered to load=10.125 kW\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.12, Page No 510" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=10.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.03\n", - "\n", - "#Calculations\n", - "X_L=w*L\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi)\n", - "V_01=4*V_s/(math.sqrt(2)*math.pi)\n", - "Z1=math.sqrt(R**2+(X_L)**2)\n", - "phi1=-math.degrees(math.atan((X_L)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5)/R))\n", - "Z7=math.sqrt(R**2+(X_L*7)**2)\n", - "phi7=math.degrees(math.atan((X_L*7)/R))\n", - "I_m1=4*V_s/(math.sqrt(2)*Z1*math.pi)\n", - "I_m3=4*V_s/(math.sqrt(2)*3*Z3*math.pi)\n", - "I_m5=4*V_s/(math.sqrt(2)*5*Z5*math.pi)\n", - "I_m7=4*V_s/(math.sqrt(2)*7*Z7*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2+I_m7**2)\n", - "P=I_m**2*R \n", - "I_01=I_m1*math.sin(math.radians(45))\n", - "I_03=I_m3*math.sin(math.radians(3*45))\n", - "I_05=I_m5*math.sin(math.radians(5*45))\n", - "I_07=I_m7*math.sin(math.radians(7*45))\n", - "I_0=(I_01**2+I_03**2+I_05**2+I_07**2)\n", - "P=I_0*R \n", - "g=(180-90)/3+45/2\n", - "I_01=2*I_m1*math.sin(math.radians(g))*math.sin(math.radians(45/2))\n", - "I_03=2*I_m3*math.sin(math.radians(g*3))*math.sin(math.radians(3*45/2))\n", - "I_05=2*I_m5*math.sin(math.radians(g*5))*math.sin(math.radians(5*45/2))\n", - "I_07=2*I_m7*math.sin(math.radians(g*7))*math.sin(math.radians(7*45/2))\n", - "I_0=(I_01**2+I_03**2+I_05**2+I_07**2)\n", - "P=I_0*R \n", - "\n", - "\n", - "#Results\n", - "print(\"using square wave o/p\")\n", - "print(\"power delivered=%.2f W\" %P)\n", - "print(\"using quasi-square wave o/p\")\n", - "print(\"power delivered=%.2f W\" %P)\n", - "print(\"using two symmitrical spaced pulses\")\n", - "print(\"power delivered=%.2f W\" %P)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "using square wave o/p\n", - "power delivered=845.87 W\n", - "using quasi-square wave o/p\n", - "power delivered=845.87 W\n", - "using two symmitrical spaced pulses\n", - "power delivered=845.87 W\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.14, Page No 520" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "T=1/f\n", - "I=0.5\n", - "\n", - "#Calculations\n", - "di=I/T #di=di/dt\n", - "V_s=220.0\n", - "L=V_s/di \n", - "t=20*10**-6\n", - "fos=2 #factor of safety\n", - "t_c=t*fos\n", - "R=10\n", - "C=t_c/(R*math.log(2))\n", - "\n", - "#Results \n", - "print(\"source inductance=%.1f H\" %L)\n", - "print(\"commutating capacitor=%.2f uF\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "source inductance=8.8 H\n", - "commutating capacitor=5.77 uF\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.15, Page No 539" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=10.0\n", - "L=.01\n", - "C=10*10**-6\n", - "#Calculations\n", - "if (R**2)<(4*L/C) :\n", - " print(\"ckt will commutate on its own\")\n", - "else:\n", - " print(\"ckt will not commutate on its own\")\n", - "\n", - "xie=R/(2*L)\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt(w_o**2-xie**2)\n", - "phi=math.degrees(math.atan(xie/w_r))\n", - "t=math.pi/w_r\n", - "V_s=1\n", - "v_L=V_s*(w_o/w_r)*math.exp(-xie*t)*math.cos(math.radians(180+phi))\n", - "v_c=V_s*(1-(w_o/w_r)*math.exp(-xie*t)*math.cos(math.radians(180-phi))) \n", - "di=V_s/L \n", - "\n", - "\n", - "#Results\n", - "print(\"voltage across inductor(*V_s)=%.5f V\" %v_L) \n", - "print(\"voltage across capacitor(*V_s)=%.5f V\" %v_c)\n", - "print(\"di/dt*V_s (for t=0)=%.0f A/s\" %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ckt will commutate on its own\n", - "voltage across inductor(*V_s)=-0.60468 V\n", - "voltage across capacitor(*V_s)=1.60468 V\n", - "di/dt*V_s (for t=0)=100 A/s\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.16, Page No 540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=0.006\n", - "C=1.2*10**-6\n", - "R=100.0\n", - "\n", - "#Calculations\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=0.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "R=40\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "R=140\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "\n", - "#Results\n", - "print(\"o/p freq=%.2f Hz\" %f)\n", - "print(\"for R=40ohm\")\n", - "print(\"upper limit o/p freq=%.1f Hz\" %f)\n", - "print(\"for R=140ohm\")\n", - "print(\"lower limit o/p freq=%.1f Hz\" %f)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "o/p freq=239.81 Hz\n", - "for R=40ohm\n", - "upper limit o/p freq=239.8 Hz\n", - "for R=140ohm\n", - "lower limit o/p freq=239.8 Hz\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.17, Page No 540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=5000.0\n", - "w=2*math.pi*f\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "L=60*10**-6\n", - "xie=R/(2*L)\n", - "C=7.5*10**-6\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt(w_o**2-xie**2)\n", - "t_c=math.pi*(1/w-1/w_r) \n", - "fos=1.5\n", - "t_q=10*10**-6\n", - "f_max=1/(2*math.pi*(t_q*fos/math.pi+1/w_r)) \n", - "\n", - "#Results\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n", - "print(\"max possible operating freq=%.1f Hz\" %f_max)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ckt turn off time=21.39 us\n", - "max possible operating freq=5341.4 Hz\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.18, Page No 541" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*2*math.pi/(2*3)/(math.pi/3+math.sqrt(3)*math.cos(math.radians(2*a))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*math.pi/(math.sqrt(2)*3*math.cos(math.radians(a)))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage V_ph=110.384 V\n", - "for constant load current\n", - "V_ph=110.38 V\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.19, Page No 547" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t=20.0\n", - "fos=2.0 #factor of safety\n", - "\n", - "#Calculations\n", - "t_c=t*fos\n", - "n=1.0/3\n", - "R=20.0\n", - "C=n**2*t_c/(4*R*math.log(2)) \n", - "\n", - "#Results \n", - "print(\"value of capacitor=%.2f uF\" %C)\n", - " #printing mistake in the answer in book." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of capacitor=0.08 uF\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.20, Page No 547" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=220.0\n", - "V_p=math.sqrt(2)*V_s/3 \n", - "V_L=math.sqrt(3)*V_p \n", - "V_p1=math.sqrt(2)*V_s/math.pi \n", - "V_L1=math.sqrt(3)*V_p1 \n", - "V_oh=math.sqrt(V_L**2-V_L1**2)\n", - "\n", - "#Calculations\n", - "THD=V_oh/V_L1 \n", - "V_a1=2*V_s/math.pi\n", - "V_a5=2*V_s/(5*math.pi)\n", - "V_a7=2*V_s/(7*math.pi)\n", - "V_a11=2*V_s/(11*math.pi)\n", - "R=4.0\n", - "L=0.02\n", - "f=50\n", - "w=2*math.pi*f\n", - "Z1=math.sqrt(R**2+(w*L)**2)\n", - "Z5=math.sqrt(R**2+(5*w*L)**2)\n", - "Z7=math.sqrt(R**2+(7*w*L)**2)\n", - "Z11=math.sqrt(R**2+(11*w*L)**2)\n", - "I_a1=V_a1/Z1\n", - "I_a5=V_a5/Z5\n", - "I_a7=V_a7/Z7\n", - "I_a11=V_a11/Z11\n", - "I_or=math.sqrt((I_a1**2+I_a5**2+I_a7**2+I_a11**2)/2)\n", - "P=3*I_or**2*R \n", - "I_s=P/V_s \n", - "I_TA=I_s/3 \n", - " \n", - "#Results\n", - "print(\"rms value of phasor voltages=%.2f V\" %V_p)\n", - "print(\"rms value of line voltages=%.2f V\" %V_L)\n", - "print(\"fundamental component of phase voltage=%.3f V\" %V_p1)\n", - "print(\"fundamental component of line voltages=%.3f V\" %V_L1)\n", - "print(\"THD=%.7f\" %THD)\n", - "print(\"load power=%.1f W\" %P)\n", - "print(\"avg value of source current=%.3f A\" %I_s)\n", - "print(\"avg value of thyristor current=%.3f A\" %I_TA)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of phasor voltages=103.71 V\n", - "rms value of line voltages=179.63 V\n", - "fundamental component of phase voltage=99.035 V\n", - "fundamental component of line voltages=171.533 V\n", - "THD=0.3108419\n", - "load power=2127.6 W\n", - "avg value of source current=9.671 A\n", - "avg value of thyristor current=3.224 A\n" - ] - } - ], - "prompt_number": 17 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter8_1.ipynb b/_Power_Electronics/Chapter8_1.ipynb deleted file mode 100755 index 721a9faf..00000000 --- a/_Power_Electronics/Chapter8_1.ipynb +++ /dev/null @@ -1,984 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 08 : Inverters" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.3, Page No 465" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T=0.1*10**-3\n", - "f=1.0/T\n", - "k=15*10**-6 #k=th/w\n", - "\n", - "#Calculations\n", - "th=2*math.pi*f*k\n", - "X_l=10.0\n", - "R=2.0\n", - "X_c=R*math.tan(th)+X_l\n", - "C=1/(2*math.pi*f*X_c) \n", - "\n", - "#Results\n", - "print(\"value of C=%.3f uF\" %(C*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of C=1.248 uF\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.4 Page No 466" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "\n", - "#Calculations\n", - "V_01=2*V_s/(math.sqrt(2)*math.pi)\n", - "R=2.0\n", - "I_01=V_01/R\n", - "P_d=I_01**2*R \n", - "V=V_s/2\n", - "I_s=math.sqrt(2)*I_01/math.pi\n", - "P_s=V*I_s\n", - "\n", - "#Results\n", - "print(\"power delivered to load=%.1f W\" %P_d)\n", - "print(\"power delivered by both sources=%.1f W\" %(2*P_s))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power delivered to load=5359.9 W\n", - "power delivered by both sources=5359.9 W\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.5, Page No 468" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_01=4*V_s/(math.pi*math.sqrt(2))\n", - "R=1.0\n", - "X_L=6.0\n", - "X_c=7.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/math.sqrt(R**2+(X_L-X_c)**2)\n", - "P=I_01**2*R \n", - "I_s=math.sqrt(2)*I_01*(2*math.cos(math.radians(45)))/math.pi\n", - "P_s=V_s*I_s \n", - "\n", - "#Results\n", - "print(\"power delivered to the source=%.3f kW\" %(P/1000))\n", - "print(\"\\npower from the source=%.3f kW\" %(P_s/1000))\n", - " " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power delivered to the source=21.440 kW\n", - "\n", - "power from the source=21.440 kW\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.6 Page No 469" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_01=230.0\n", - "R=2.0\n", - "I_01=V_01/R\n", - "I_m=I_01*math.sqrt(2)\n", - "I_T1=I_m/2 \n", - "I_D1=0 \n", - "X_L=8.0\n", - "X_C=6.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=math.degrees(math.atan((X_L-X_C)/R))\n", - "I_T1=I_T1*math.sqrt(2)*0.47675 \n", - "I_D1=.1507025*I_m/math.sqrt(2) \n", - "\n", - "\n", - "#Results\n", - "print(\"when load R=2 ohm\")\n", - "print(\"rms value of thyristor current=%.2f A\" %I_T1)\n", - "print(\"rms value of diode current=%.0f A\" %I_D1)\n", - "print(\"when load R=2ohm % X_L=8ohm and X_C=6ohm\")\n", - "print(\"rms value of thyristor current=%.3f A\" %I_T1)\n", - "print(\"rms value of diode current=%.3f A\" %I_D1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when load R=2 ohm\n", - "rms value of thyristor current=54.83 A\n", - "rms value of diode current=17 A\n", - "when load R=2ohm % X_L=8ohm and X_C=6ohm\n", - "rms value of thyristor current=54.826 A\n", - "rms value of diode current=17.331 A\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.7 Page No 470" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=4.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.035\n", - "\n", - "#Calculations\n", - "C=155*10**-6\n", - "X_L=w*L\n", - "X_C=1/(w*C)\n", - "Z1=math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=-math.degrees(math.atan((X_L-X_C)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3-X_C/3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3-X_C/3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5-X_C/5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5-X_C/5)/R))\n", - "I_m1=4*V_s/(Z1*math.pi)\n", - "I_01=I_m1/math.sqrt(2) \n", - "I_m3=4*V_s/(3*Z3*math.pi)\n", - "I_m5=4*V_s/(5*Z5*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2)\n", - "I_0=I_m/math.sqrt(2)\n", - "P_0=(I_0)**2*R \n", - "P_01=(I_01)**2*R \n", - "t1=(180-phi1)*math.pi/(180*w) \n", - "t1=(phi1)*math.pi/(180*w) \n", - "\n", - "#Results\n", - "print(\"rms value of fundamental load current=%.2f A\" %I_01)\n", - "print(\"load power=%.1f W\" %P_0)\n", - "print(\"fundamental load power=%.1f W\" %P_01)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_m/2))\n", - "print(\"conduction time for thyristor=%.3f ms\" %(t1*1000))\n", - "print(\"Conduction time for diodes=%.3f ms\" %(t1*1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of fundamental load current=20.02 A\n", - "load power=1632.5 W\n", - "fundamental load power=1602.6 W\n", - "rms value of thyristor current=14.285 A\n", - "conduction time for thyristor=3.736 ms\n", - "Conduction time for diodes=3.736 ms\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.8, Page No 473" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_01=2*V_s/(math.sqrt(2)*math.pi) \n", - "R=10.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/R\n", - "P=I_01**2*R \n", - "V_or=math.sqrt((V_s/2)**2)\n", - "P=V_or**2/R \n", - "I_TP=V_s/(2*R)\n", - "I_or=I_TP\n", - "pf=I_01**2*R/(V_or*I_or) \n", - "DF=V_01/V_or \n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "V_03=V_01/3\n", - "HF=V_03/V_01\n", - "\n", - "#Results\n", - "print(\"fundamental rms o/p voltage=%.3f V\" %V_01)\n", - "print(\"fundamental power to load=%.1f W\" %P)\n", - "print(\"total o/p power to load=%.1f W\" %P)\n", - "print(\"avg SCR current=%.2f A\" %(I_TP*180/360))\n", - "print(\"i/p pf=%.3f\" %pf) \n", - "print(\"distortion factor=%.1f\" %DF)\n", - "print(\"THD=%.3f\" %THD) \n", - "print(\"harmonic factor=%.4f\" %HF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fundamental rms o/p voltage=103.536 V\n", - "fundamental power to load=1322.5 W\n", - "total o/p power to load=1322.5 W\n", - "avg SCR current=5.75 A\n", - "i/p pf=0.811\n", - "distortion factor=0.9\n", - "THD=0.483\n", - "harmonic factor=0.3333\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.9 Page No 474" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=60\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi) \n", - "V_01=4*V_s/(math.sqrt(2)*math.pi) \n", - "P_o=V_or**2/R \n", - "P_01=V_01**2/R \n", - "I_s=V_s/R \n", - "I_avg=I_s*math.pi/(2*math.pi) \n", - "V_03=V_01/3\n", - "HF=V_03/V_01 \n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.0f V\" %V_or)\n", - "print(\"o/p power=%.0f W\" %P_o)\n", - "print(\"fundamental component of rms voltage=%.2f V\" %V_01)\n", - "print(\"fundamental freq o/p power=%.2f W\" %P_01) \n", - "print(\"peak current=%.0f A\" %I_s)\n", - "print(\"avg current of each transistor=%.0f A\" %I_avg)\n", - "print(\"peak reverse blocking voltage=%.0f V\" %V_s)\n", - "print(\"harmonic factor=%.4f\" %HF)\n", - "print(\"THD=%.4f\" %THD)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=60 V\n", - "o/p power=1200 W\n", - "fundamental component of rms voltage=54.02 V\n", - "fundamental freq o/p power=972.68 W\n", - "peak current=20 A\n", - "avg current of each transistor=10 A\n", - "peak reverse blocking voltage=60 V\n", - "harmonic factor=0.3333\n", - "THD=0.4834\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.10 Page No 475" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=220.0\n", - "R=6.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.03\n", - "C=180*10**-6\n", - "X_L=w*L\n", - "X_C=1/(w*C)\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi)\n", - "V_01=4*V_s/(math.sqrt(2)*math.pi)\n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "print(\"THD of voltage=%.4f\" %THD)\n", - "DF=V_01/V_or \n", - "Z1=math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=-math.degrees(math.atan((X_L-X_C)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3-X_C/3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3-X_C/3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5-X_C/5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5-X_C/5)/R))\n", - "Z7=math.sqrt(R**2+(X_L*7-X_C/7)**2)\n", - "phi7=math.degrees(math.atan((X_L*7-X_C/7)/R))\n", - "I_01=19.403\n", - "I_m1=4*V_s/(Z1*math.pi)\n", - "I_m3=4*V_s/(3*Z3*math.pi)\n", - "I_m5=4*V_s/(5*Z5*math.pi)\n", - "I_m7=4*V_s/(7*Z7*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2+I_m7**2)\n", - "I_or=I_m/math.sqrt(2)\n", - "I_oh=math.sqrt((I_m**2-I_m1**2)/2)\n", - "THD=I_oh/I_01 \n", - "DF=I_01/I_or \n", - "P_o=I_or**2*R \n", - "I_avg=P_o/V_s \n", - "t1=(180-phi1)*math.pi/(180*w) \n", - "t1=1/(2*f)-t1 \n", - "I_p=I_m1 \n", - "I_t1=.46135*I_p \n", - "\n", - "#Results\n", - "print(\"\\nDF=%.1f\" %DF)\n", - "print(\"THD of current=%.4f\" %THD) \n", - "print(\"DF=%.3f\" %DF)\n", - "print(\"load power=%.1f W\" %P_o)\n", - "print(\"avg value of load current=%.2f A\" %I_avg)\n", - "print(\"conduction time for thyristor=%.0f ms\" %(t1*1000))\n", - "print(\"conduction time for diodes=%.0f ms\" %(t1*1000))\n", - "print(\"peak transistor current=%.2f A\" %I_p)\n", - "print(\"rms transistor current=%.2f A\" %I_t1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THD of voltage=0.4834\n", - "\n", - "DF=1.0\n", - "THD of current=0.1557\n", - "DF=0.988\n", - "load power=2313.5 W\n", - "avg value of load current=10.52 A\n", - "conduction time for thyristor=3 ms\n", - "conduction time for diodes=3 ms\n", - "peak transistor current=27.44 A\n", - "rms transistor current=12.66 A\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.11 Page No 497" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=450.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "I_or=math.sqrt((V_s/(3*R))**2*2/3+(2*V_s/(3*R))**2*1/3) \n", - "I_T1=math.sqrt((1/(2*math.pi))*((V_s/(3*R))**2*2*math.pi/3+(2*V_s/(3*R))**2*math.pi/3)) \n", - "P=3*I_or**2*R \n", - "I_or=math.sqrt((1/(math.pi))*((V_s/(2*R))**2*2*math.pi/3)) \n", - "I_T1=math.sqrt((1/(2*math.pi))*((V_s/(2*R))**2*2*math.pi/3)) \n", - "P=3*I_or**2*R \n", - "\n", - "#Results\n", - "print(\"for 180deg mode\")\n", - "print(\"rms value of load current=%.3f A\" %I_or)\n", - "print(\"power delivered to load=%.1f kW\" %(P/1000))\n", - "print(\"rms value of load current=%.0f A\" %I_T1)\n", - "print(\"for 120deg mode\")\n", - "print(\"rms value of load current=%.3f A\" %I_or)\n", - "print(\"rms value of load current=%.2f A\" %I_T1)\n", - "print(\"power delivered to load=%.3f kW\" %(P/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for 180deg mode\n", - "rms value of load current=18.371 A\n", - "power delivered to load=10.1 kW\n", - "rms value of load current=13 A\n", - "for 120deg mode\n", - "rms value of load current=18.371 A\n", - "rms value of load current=12.99 A\n", - "power delivered to load=10.125 kW\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.12, Page No 510" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=10.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.03\n", - "\n", - "#Calculations\n", - "X_L=w*L\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi)\n", - "V_01=4*V_s/(math.sqrt(2)*math.pi)\n", - "Z1=math.sqrt(R**2+(X_L)**2)\n", - "phi1=-math.degrees(math.atan((X_L)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5)/R))\n", - "Z7=math.sqrt(R**2+(X_L*7)**2)\n", - "phi7=math.degrees(math.atan((X_L*7)/R))\n", - "I_m1=4*V_s/(math.sqrt(2)*Z1*math.pi)\n", - "I_m3=4*V_s/(math.sqrt(2)*3*Z3*math.pi)\n", - "I_m5=4*V_s/(math.sqrt(2)*5*Z5*math.pi)\n", - "I_m7=4*V_s/(math.sqrt(2)*7*Z7*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2+I_m7**2)\n", - "P=I_m**2*R \n", - "I_01=I_m1*math.sin(math.radians(45))\n", - "I_03=I_m3*math.sin(math.radians(3*45))\n", - "I_05=I_m5*math.sin(math.radians(5*45))\n", - "I_07=I_m7*math.sin(math.radians(7*45))\n", - "I_0=(I_01**2+I_03**2+I_05**2+I_07**2)\n", - "P=I_0*R \n", - "g=(180-90)/3+45/2\n", - "I_01=2*I_m1*math.sin(math.radians(g))*math.sin(math.radians(45/2))\n", - "I_03=2*I_m3*math.sin(math.radians(g*3))*math.sin(math.radians(3*45/2))\n", - "I_05=2*I_m5*math.sin(math.radians(g*5))*math.sin(math.radians(5*45/2))\n", - "I_07=2*I_m7*math.sin(math.radians(g*7))*math.sin(math.radians(7*45/2))\n", - "I_0=(I_01**2+I_03**2+I_05**2+I_07**2)\n", - "P=I_0*R \n", - "\n", - "\n", - "#Results\n", - "print(\"using square wave o/p\")\n", - "print(\"power delivered=%.2f W\" %P)\n", - "print(\"using quasi-square wave o/p\")\n", - "print(\"power delivered=%.2f W\" %P)\n", - "print(\"using two symmitrical spaced pulses\")\n", - "print(\"power delivered=%.2f W\" %P)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "using square wave o/p\n", - "power delivered=845.87 W\n", - "using quasi-square wave o/p\n", - "power delivered=845.87 W\n", - "using two symmitrical spaced pulses\n", - "power delivered=845.87 W\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.14, Page No 520" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "T=1/f\n", - "I=0.5\n", - "\n", - "#Calculations\n", - "di=I/T #di=di/dt\n", - "V_s=220.0\n", - "L=V_s/di \n", - "t=20*10**-6\n", - "fos=2 #factor of safety\n", - "t_c=t*fos\n", - "R=10\n", - "C=t_c/(R*math.log(2))\n", - "\n", - "#Results \n", - "print(\"source inductance=%.1f H\" %L)\n", - "print(\"commutating capacitor=%.2f uF\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "source inductance=8.8 H\n", - "commutating capacitor=5.77 uF\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.15, Page No 539" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=10.0\n", - "L=.01\n", - "C=10*10**-6\n", - "#Calculations\n", - "if (R**2)<(4*L/C) :\n", - " print(\"ckt will commutate on its own\")\n", - "else:\n", - " print(\"ckt will not commutate on its own\")\n", - "\n", - "xie=R/(2*L)\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt(w_o**2-xie**2)\n", - "phi=math.degrees(math.atan(xie/w_r))\n", - "t=math.pi/w_r\n", - "V_s=1\n", - "v_L=V_s*(w_o/w_r)*math.exp(-xie*t)*math.cos(math.radians(180+phi))\n", - "v_c=V_s*(1-(w_o/w_r)*math.exp(-xie*t)*math.cos(math.radians(180-phi))) \n", - "di=V_s/L \n", - "\n", - "\n", - "#Results\n", - "print(\"voltage across inductor(*V_s)=%.5f V\" %v_L) \n", - "print(\"voltage across capacitor(*V_s)=%.5f V\" %v_c)\n", - "print(\"di/dt*V_s (for t=0)=%.0f A/s\" %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ckt will commutate on its own\n", - "voltage across inductor(*V_s)=-0.60468 V\n", - "voltage across capacitor(*V_s)=1.60468 V\n", - "di/dt*V_s (for t=0)=100 A/s\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.16, Page No 540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=0.006\n", - "C=1.2*10**-6\n", - "R=100.0\n", - "\n", - "#Calculations\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=0.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "R=40\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "R=140\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "\n", - "#Results\n", - "print(\"o/p freq=%.2f Hz\" %f)\n", - "print(\"for R=40ohm\")\n", - "print(\"upper limit o/p freq=%.1f Hz\" %f)\n", - "print(\"for R=140ohm\")\n", - "print(\"lower limit o/p freq=%.1f Hz\" %f)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "o/p freq=239.81 Hz\n", - "for R=40ohm\n", - "upper limit o/p freq=239.8 Hz\n", - "for R=140ohm\n", - "lower limit o/p freq=239.8 Hz\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.17, Page No 540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=5000.0\n", - "w=2*math.pi*f\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "L=60*10**-6\n", - "xie=R/(2*L)\n", - "C=7.5*10**-6\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt(w_o**2-xie**2)\n", - "t_c=math.pi*(1/w-1/w_r) \n", - "fos=1.5\n", - "t_q=10*10**-6\n", - "f_max=1/(2*math.pi*(t_q*fos/math.pi+1/w_r)) \n", - "\n", - "#Results\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n", - "print(\"max possible operating freq=%.1f Hz\" %f_max)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ckt turn off time=21.39 us\n", - "max possible operating freq=5341.4 Hz\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.18, Page No 541" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*2*math.pi/(2*3)/(math.pi/3+math.sqrt(3)*math.cos(math.radians(2*a))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*math.pi/(math.sqrt(2)*3*math.cos(math.radians(a)))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage V_ph=110.384 V\n", - "for constant load current\n", - "V_ph=110.38 V\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.19, Page No 547" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t=20.0\n", - "fos=2.0 #factor of safety\n", - "\n", - "#Calculations\n", - "t_c=t*fos\n", - "n=1.0/3\n", - "R=20.0\n", - "C=n**2*t_c/(4*R*math.log(2)) \n", - "\n", - "#Results \n", - "print(\"value of capacitor=%.2f uF\" %C)\n", - " #printing mistake in the answer in book." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of capacitor=0.08 uF\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.20, Page No 547" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=220.0\n", - "V_p=math.sqrt(2)*V_s/3 \n", - "V_L=math.sqrt(3)*V_p \n", - "V_p1=math.sqrt(2)*V_s/math.pi \n", - "V_L1=math.sqrt(3)*V_p1 \n", - "V_oh=math.sqrt(V_L**2-V_L1**2)\n", - "\n", - "#Calculations\n", - "THD=V_oh/V_L1 \n", - "V_a1=2*V_s/math.pi\n", - "V_a5=2*V_s/(5*math.pi)\n", - "V_a7=2*V_s/(7*math.pi)\n", - "V_a11=2*V_s/(11*math.pi)\n", - "R=4.0\n", - "L=0.02\n", - "f=50\n", - "w=2*math.pi*f\n", - "Z1=math.sqrt(R**2+(w*L)**2)\n", - "Z5=math.sqrt(R**2+(5*w*L)**2)\n", - "Z7=math.sqrt(R**2+(7*w*L)**2)\n", - "Z11=math.sqrt(R**2+(11*w*L)**2)\n", - "I_a1=V_a1/Z1\n", - "I_a5=V_a5/Z5\n", - "I_a7=V_a7/Z7\n", - "I_a11=V_a11/Z11\n", - "I_or=math.sqrt((I_a1**2+I_a5**2+I_a7**2+I_a11**2)/2)\n", - "P=3*I_or**2*R \n", - "I_s=P/V_s \n", - "I_TA=I_s/3 \n", - " \n", - "#Results\n", - "print(\"rms value of phasor voltages=%.2f V\" %V_p)\n", - "print(\"rms value of line voltages=%.2f V\" %V_L)\n", - "print(\"fundamental component of phase voltage=%.3f V\" %V_p1)\n", - "print(\"fundamental component of line voltages=%.3f V\" %V_L1)\n", - "print(\"THD=%.7f\" %THD)\n", - "print(\"load power=%.1f W\" %P)\n", - "print(\"avg value of source current=%.3f A\" %I_s)\n", - "print(\"avg value of thyristor current=%.3f A\" %I_TA)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of phasor voltages=103.71 V\n", - "rms value of line voltages=179.63 V\n", - "fundamental component of phase voltage=99.035 V\n", - "fundamental component of line voltages=171.533 V\n", - "THD=0.3108419\n", - "load power=2127.6 W\n", - "avg value of source current=9.671 A\n", - "avg value of thyristor current=3.224 A\n" - ] - } - ], - "prompt_number": 17 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter8_2.ipynb b/_Power_Electronics/Chapter8_2.ipynb deleted file mode 100755 index 721a9faf..00000000 --- a/_Power_Electronics/Chapter8_2.ipynb +++ /dev/null @@ -1,984 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 08 : Inverters" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.3, Page No 465" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T=0.1*10**-3\n", - "f=1.0/T\n", - "k=15*10**-6 #k=th/w\n", - "\n", - "#Calculations\n", - "th=2*math.pi*f*k\n", - "X_l=10.0\n", - "R=2.0\n", - "X_c=R*math.tan(th)+X_l\n", - "C=1/(2*math.pi*f*X_c) \n", - "\n", - "#Results\n", - "print(\"value of C=%.3f uF\" %(C*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of C=1.248 uF\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.4 Page No 466" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "\n", - "#Calculations\n", - "V_01=2*V_s/(math.sqrt(2)*math.pi)\n", - "R=2.0\n", - "I_01=V_01/R\n", - "P_d=I_01**2*R \n", - "V=V_s/2\n", - "I_s=math.sqrt(2)*I_01/math.pi\n", - "P_s=V*I_s\n", - "\n", - "#Results\n", - "print(\"power delivered to load=%.1f W\" %P_d)\n", - "print(\"power delivered by both sources=%.1f W\" %(2*P_s))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power delivered to load=5359.9 W\n", - "power delivered by both sources=5359.9 W\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.5, Page No 468" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_01=4*V_s/(math.pi*math.sqrt(2))\n", - "R=1.0\n", - "X_L=6.0\n", - "X_c=7.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/math.sqrt(R**2+(X_L-X_c)**2)\n", - "P=I_01**2*R \n", - "I_s=math.sqrt(2)*I_01*(2*math.cos(math.radians(45)))/math.pi\n", - "P_s=V_s*I_s \n", - "\n", - "#Results\n", - "print(\"power delivered to the source=%.3f kW\" %(P/1000))\n", - "print(\"\\npower from the source=%.3f kW\" %(P_s/1000))\n", - " " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power delivered to the source=21.440 kW\n", - "\n", - "power from the source=21.440 kW\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.6 Page No 469" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_01=230.0\n", - "R=2.0\n", - "I_01=V_01/R\n", - "I_m=I_01*math.sqrt(2)\n", - "I_T1=I_m/2 \n", - "I_D1=0 \n", - "X_L=8.0\n", - "X_C=6.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=math.degrees(math.atan((X_L-X_C)/R))\n", - "I_T1=I_T1*math.sqrt(2)*0.47675 \n", - "I_D1=.1507025*I_m/math.sqrt(2) \n", - "\n", - "\n", - "#Results\n", - "print(\"when load R=2 ohm\")\n", - "print(\"rms value of thyristor current=%.2f A\" %I_T1)\n", - "print(\"rms value of diode current=%.0f A\" %I_D1)\n", - "print(\"when load R=2ohm % X_L=8ohm and X_C=6ohm\")\n", - "print(\"rms value of thyristor current=%.3f A\" %I_T1)\n", - "print(\"rms value of diode current=%.3f A\" %I_D1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when load R=2 ohm\n", - "rms value of thyristor current=54.83 A\n", - "rms value of diode current=17 A\n", - "when load R=2ohm % X_L=8ohm and X_C=6ohm\n", - "rms value of thyristor current=54.826 A\n", - "rms value of diode current=17.331 A\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.7 Page No 470" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=4.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.035\n", - "\n", - "#Calculations\n", - "C=155*10**-6\n", - "X_L=w*L\n", - "X_C=1/(w*C)\n", - "Z1=math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=-math.degrees(math.atan((X_L-X_C)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3-X_C/3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3-X_C/3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5-X_C/5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5-X_C/5)/R))\n", - "I_m1=4*V_s/(Z1*math.pi)\n", - "I_01=I_m1/math.sqrt(2) \n", - "I_m3=4*V_s/(3*Z3*math.pi)\n", - "I_m5=4*V_s/(5*Z5*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2)\n", - "I_0=I_m/math.sqrt(2)\n", - "P_0=(I_0)**2*R \n", - "P_01=(I_01)**2*R \n", - "t1=(180-phi1)*math.pi/(180*w) \n", - "t1=(phi1)*math.pi/(180*w) \n", - "\n", - "#Results\n", - "print(\"rms value of fundamental load current=%.2f A\" %I_01)\n", - "print(\"load power=%.1f W\" %P_0)\n", - "print(\"fundamental load power=%.1f W\" %P_01)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_m/2))\n", - "print(\"conduction time for thyristor=%.3f ms\" %(t1*1000))\n", - "print(\"Conduction time for diodes=%.3f ms\" %(t1*1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of fundamental load current=20.02 A\n", - "load power=1632.5 W\n", - "fundamental load power=1602.6 W\n", - "rms value of thyristor current=14.285 A\n", - "conduction time for thyristor=3.736 ms\n", - "Conduction time for diodes=3.736 ms\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.8, Page No 473" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_01=2*V_s/(math.sqrt(2)*math.pi) \n", - "R=10.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/R\n", - "P=I_01**2*R \n", - "V_or=math.sqrt((V_s/2)**2)\n", - "P=V_or**2/R \n", - "I_TP=V_s/(2*R)\n", - "I_or=I_TP\n", - "pf=I_01**2*R/(V_or*I_or) \n", - "DF=V_01/V_or \n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "V_03=V_01/3\n", - "HF=V_03/V_01\n", - "\n", - "#Results\n", - "print(\"fundamental rms o/p voltage=%.3f V\" %V_01)\n", - "print(\"fundamental power to load=%.1f W\" %P)\n", - "print(\"total o/p power to load=%.1f W\" %P)\n", - "print(\"avg SCR current=%.2f A\" %(I_TP*180/360))\n", - "print(\"i/p pf=%.3f\" %pf) \n", - "print(\"distortion factor=%.1f\" %DF)\n", - "print(\"THD=%.3f\" %THD) \n", - "print(\"harmonic factor=%.4f\" %HF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fundamental rms o/p voltage=103.536 V\n", - "fundamental power to load=1322.5 W\n", - "total o/p power to load=1322.5 W\n", - "avg SCR current=5.75 A\n", - "i/p pf=0.811\n", - "distortion factor=0.9\n", - "THD=0.483\n", - "harmonic factor=0.3333\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.9 Page No 474" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=60\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi) \n", - "V_01=4*V_s/(math.sqrt(2)*math.pi) \n", - "P_o=V_or**2/R \n", - "P_01=V_01**2/R \n", - "I_s=V_s/R \n", - "I_avg=I_s*math.pi/(2*math.pi) \n", - "V_03=V_01/3\n", - "HF=V_03/V_01 \n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.0f V\" %V_or)\n", - "print(\"o/p power=%.0f W\" %P_o)\n", - "print(\"fundamental component of rms voltage=%.2f V\" %V_01)\n", - "print(\"fundamental freq o/p power=%.2f W\" %P_01) \n", - "print(\"peak current=%.0f A\" %I_s)\n", - "print(\"avg current of each transistor=%.0f A\" %I_avg)\n", - "print(\"peak reverse blocking voltage=%.0f V\" %V_s)\n", - "print(\"harmonic factor=%.4f\" %HF)\n", - "print(\"THD=%.4f\" %THD)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=60 V\n", - "o/p power=1200 W\n", - "fundamental component of rms voltage=54.02 V\n", - "fundamental freq o/p power=972.68 W\n", - "peak current=20 A\n", - "avg current of each transistor=10 A\n", - "peak reverse blocking voltage=60 V\n", - "harmonic factor=0.3333\n", - "THD=0.4834\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.10 Page No 475" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=220.0\n", - "R=6.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.03\n", - "C=180*10**-6\n", - "X_L=w*L\n", - "X_C=1/(w*C)\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi)\n", - "V_01=4*V_s/(math.sqrt(2)*math.pi)\n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "print(\"THD of voltage=%.4f\" %THD)\n", - "DF=V_01/V_or \n", - "Z1=math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=-math.degrees(math.atan((X_L-X_C)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3-X_C/3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3-X_C/3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5-X_C/5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5-X_C/5)/R))\n", - "Z7=math.sqrt(R**2+(X_L*7-X_C/7)**2)\n", - "phi7=math.degrees(math.atan((X_L*7-X_C/7)/R))\n", - "I_01=19.403\n", - "I_m1=4*V_s/(Z1*math.pi)\n", - "I_m3=4*V_s/(3*Z3*math.pi)\n", - "I_m5=4*V_s/(5*Z5*math.pi)\n", - "I_m7=4*V_s/(7*Z7*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2+I_m7**2)\n", - "I_or=I_m/math.sqrt(2)\n", - "I_oh=math.sqrt((I_m**2-I_m1**2)/2)\n", - "THD=I_oh/I_01 \n", - "DF=I_01/I_or \n", - "P_o=I_or**2*R \n", - "I_avg=P_o/V_s \n", - "t1=(180-phi1)*math.pi/(180*w) \n", - "t1=1/(2*f)-t1 \n", - "I_p=I_m1 \n", - "I_t1=.46135*I_p \n", - "\n", - "#Results\n", - "print(\"\\nDF=%.1f\" %DF)\n", - "print(\"THD of current=%.4f\" %THD) \n", - "print(\"DF=%.3f\" %DF)\n", - "print(\"load power=%.1f W\" %P_o)\n", - "print(\"avg value of load current=%.2f A\" %I_avg)\n", - "print(\"conduction time for thyristor=%.0f ms\" %(t1*1000))\n", - "print(\"conduction time for diodes=%.0f ms\" %(t1*1000))\n", - "print(\"peak transistor current=%.2f A\" %I_p)\n", - "print(\"rms transistor current=%.2f A\" %I_t1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THD of voltage=0.4834\n", - "\n", - "DF=1.0\n", - "THD of current=0.1557\n", - "DF=0.988\n", - "load power=2313.5 W\n", - "avg value of load current=10.52 A\n", - "conduction time for thyristor=3 ms\n", - "conduction time for diodes=3 ms\n", - "peak transistor current=27.44 A\n", - "rms transistor current=12.66 A\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.11 Page No 497" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=450.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "I_or=math.sqrt((V_s/(3*R))**2*2/3+(2*V_s/(3*R))**2*1/3) \n", - "I_T1=math.sqrt((1/(2*math.pi))*((V_s/(3*R))**2*2*math.pi/3+(2*V_s/(3*R))**2*math.pi/3)) \n", - "P=3*I_or**2*R \n", - "I_or=math.sqrt((1/(math.pi))*((V_s/(2*R))**2*2*math.pi/3)) \n", - "I_T1=math.sqrt((1/(2*math.pi))*((V_s/(2*R))**2*2*math.pi/3)) \n", - "P=3*I_or**2*R \n", - "\n", - "#Results\n", - "print(\"for 180deg mode\")\n", - "print(\"rms value of load current=%.3f A\" %I_or)\n", - "print(\"power delivered to load=%.1f kW\" %(P/1000))\n", - "print(\"rms value of load current=%.0f A\" %I_T1)\n", - "print(\"for 120deg mode\")\n", - "print(\"rms value of load current=%.3f A\" %I_or)\n", - "print(\"rms value of load current=%.2f A\" %I_T1)\n", - "print(\"power delivered to load=%.3f kW\" %(P/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for 180deg mode\n", - "rms value of load current=18.371 A\n", - "power delivered to load=10.1 kW\n", - "rms value of load current=13 A\n", - "for 120deg mode\n", - "rms value of load current=18.371 A\n", - "rms value of load current=12.99 A\n", - "power delivered to load=10.125 kW\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.12, Page No 510" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=10.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.03\n", - "\n", - "#Calculations\n", - "X_L=w*L\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi)\n", - "V_01=4*V_s/(math.sqrt(2)*math.pi)\n", - "Z1=math.sqrt(R**2+(X_L)**2)\n", - "phi1=-math.degrees(math.atan((X_L)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5)/R))\n", - "Z7=math.sqrt(R**2+(X_L*7)**2)\n", - "phi7=math.degrees(math.atan((X_L*7)/R))\n", - "I_m1=4*V_s/(math.sqrt(2)*Z1*math.pi)\n", - "I_m3=4*V_s/(math.sqrt(2)*3*Z3*math.pi)\n", - "I_m5=4*V_s/(math.sqrt(2)*5*Z5*math.pi)\n", - "I_m7=4*V_s/(math.sqrt(2)*7*Z7*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2+I_m7**2)\n", - "P=I_m**2*R \n", - "I_01=I_m1*math.sin(math.radians(45))\n", - "I_03=I_m3*math.sin(math.radians(3*45))\n", - "I_05=I_m5*math.sin(math.radians(5*45))\n", - "I_07=I_m7*math.sin(math.radians(7*45))\n", - "I_0=(I_01**2+I_03**2+I_05**2+I_07**2)\n", - "P=I_0*R \n", - "g=(180-90)/3+45/2\n", - "I_01=2*I_m1*math.sin(math.radians(g))*math.sin(math.radians(45/2))\n", - "I_03=2*I_m3*math.sin(math.radians(g*3))*math.sin(math.radians(3*45/2))\n", - "I_05=2*I_m5*math.sin(math.radians(g*5))*math.sin(math.radians(5*45/2))\n", - "I_07=2*I_m7*math.sin(math.radians(g*7))*math.sin(math.radians(7*45/2))\n", - "I_0=(I_01**2+I_03**2+I_05**2+I_07**2)\n", - "P=I_0*R \n", - "\n", - "\n", - "#Results\n", - "print(\"using square wave o/p\")\n", - "print(\"power delivered=%.2f W\" %P)\n", - "print(\"using quasi-square wave o/p\")\n", - "print(\"power delivered=%.2f W\" %P)\n", - "print(\"using two symmitrical spaced pulses\")\n", - "print(\"power delivered=%.2f W\" %P)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "using square wave o/p\n", - "power delivered=845.87 W\n", - "using quasi-square wave o/p\n", - "power delivered=845.87 W\n", - "using two symmitrical spaced pulses\n", - "power delivered=845.87 W\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.14, Page No 520" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "T=1/f\n", - "I=0.5\n", - "\n", - "#Calculations\n", - "di=I/T #di=di/dt\n", - "V_s=220.0\n", - "L=V_s/di \n", - "t=20*10**-6\n", - "fos=2 #factor of safety\n", - "t_c=t*fos\n", - "R=10\n", - "C=t_c/(R*math.log(2))\n", - "\n", - "#Results \n", - "print(\"source inductance=%.1f H\" %L)\n", - "print(\"commutating capacitor=%.2f uF\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "source inductance=8.8 H\n", - "commutating capacitor=5.77 uF\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.15, Page No 539" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=10.0\n", - "L=.01\n", - "C=10*10**-6\n", - "#Calculations\n", - "if (R**2)<(4*L/C) :\n", - " print(\"ckt will commutate on its own\")\n", - "else:\n", - " print(\"ckt will not commutate on its own\")\n", - "\n", - "xie=R/(2*L)\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt(w_o**2-xie**2)\n", - "phi=math.degrees(math.atan(xie/w_r))\n", - "t=math.pi/w_r\n", - "V_s=1\n", - "v_L=V_s*(w_o/w_r)*math.exp(-xie*t)*math.cos(math.radians(180+phi))\n", - "v_c=V_s*(1-(w_o/w_r)*math.exp(-xie*t)*math.cos(math.radians(180-phi))) \n", - "di=V_s/L \n", - "\n", - "\n", - "#Results\n", - "print(\"voltage across inductor(*V_s)=%.5f V\" %v_L) \n", - "print(\"voltage across capacitor(*V_s)=%.5f V\" %v_c)\n", - "print(\"di/dt*V_s (for t=0)=%.0f A/s\" %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ckt will commutate on its own\n", - "voltage across inductor(*V_s)=-0.60468 V\n", - "voltage across capacitor(*V_s)=1.60468 V\n", - "di/dt*V_s (for t=0)=100 A/s\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.16, Page No 540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=0.006\n", - "C=1.2*10**-6\n", - "R=100.0\n", - "\n", - "#Calculations\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=0.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "R=40\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "R=140\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "\n", - "#Results\n", - "print(\"o/p freq=%.2f Hz\" %f)\n", - "print(\"for R=40ohm\")\n", - "print(\"upper limit o/p freq=%.1f Hz\" %f)\n", - "print(\"for R=140ohm\")\n", - "print(\"lower limit o/p freq=%.1f Hz\" %f)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "o/p freq=239.81 Hz\n", - "for R=40ohm\n", - "upper limit o/p freq=239.8 Hz\n", - "for R=140ohm\n", - "lower limit o/p freq=239.8 Hz\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.17, Page No 540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=5000.0\n", - "w=2*math.pi*f\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "L=60*10**-6\n", - "xie=R/(2*L)\n", - "C=7.5*10**-6\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt(w_o**2-xie**2)\n", - "t_c=math.pi*(1/w-1/w_r) \n", - "fos=1.5\n", - "t_q=10*10**-6\n", - "f_max=1/(2*math.pi*(t_q*fos/math.pi+1/w_r)) \n", - "\n", - "#Results\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n", - "print(\"max possible operating freq=%.1f Hz\" %f_max)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ckt turn off time=21.39 us\n", - "max possible operating freq=5341.4 Hz\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.18, Page No 541" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*2*math.pi/(2*3)/(math.pi/3+math.sqrt(3)*math.cos(math.radians(2*a))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*math.pi/(math.sqrt(2)*3*math.cos(math.radians(a)))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage V_ph=110.384 V\n", - "for constant load current\n", - "V_ph=110.38 V\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.19, Page No 547" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t=20.0\n", - "fos=2.0 #factor of safety\n", - "\n", - "#Calculations\n", - "t_c=t*fos\n", - "n=1.0/3\n", - "R=20.0\n", - "C=n**2*t_c/(4*R*math.log(2)) \n", - "\n", - "#Results \n", - "print(\"value of capacitor=%.2f uF\" %C)\n", - " #printing mistake in the answer in book." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of capacitor=0.08 uF\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.20, Page No 547" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=220.0\n", - "V_p=math.sqrt(2)*V_s/3 \n", - "V_L=math.sqrt(3)*V_p \n", - "V_p1=math.sqrt(2)*V_s/math.pi \n", - "V_L1=math.sqrt(3)*V_p1 \n", - "V_oh=math.sqrt(V_L**2-V_L1**2)\n", - "\n", - "#Calculations\n", - "THD=V_oh/V_L1 \n", - "V_a1=2*V_s/math.pi\n", - "V_a5=2*V_s/(5*math.pi)\n", - "V_a7=2*V_s/(7*math.pi)\n", - "V_a11=2*V_s/(11*math.pi)\n", - "R=4.0\n", - "L=0.02\n", - "f=50\n", - "w=2*math.pi*f\n", - "Z1=math.sqrt(R**2+(w*L)**2)\n", - "Z5=math.sqrt(R**2+(5*w*L)**2)\n", - "Z7=math.sqrt(R**2+(7*w*L)**2)\n", - "Z11=math.sqrt(R**2+(11*w*L)**2)\n", - "I_a1=V_a1/Z1\n", - "I_a5=V_a5/Z5\n", - "I_a7=V_a7/Z7\n", - "I_a11=V_a11/Z11\n", - "I_or=math.sqrt((I_a1**2+I_a5**2+I_a7**2+I_a11**2)/2)\n", - "P=3*I_or**2*R \n", - "I_s=P/V_s \n", - "I_TA=I_s/3 \n", - " \n", - "#Results\n", - "print(\"rms value of phasor voltages=%.2f V\" %V_p)\n", - "print(\"rms value of line voltages=%.2f V\" %V_L)\n", - "print(\"fundamental component of phase voltage=%.3f V\" %V_p1)\n", - "print(\"fundamental component of line voltages=%.3f V\" %V_L1)\n", - "print(\"THD=%.7f\" %THD)\n", - "print(\"load power=%.1f W\" %P)\n", - "print(\"avg value of source current=%.3f A\" %I_s)\n", - "print(\"avg value of thyristor current=%.3f A\" %I_TA)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of phasor voltages=103.71 V\n", - "rms value of line voltages=179.63 V\n", - "fundamental component of phase voltage=99.035 V\n", - "fundamental component of line voltages=171.533 V\n", - "THD=0.3108419\n", - "load power=2127.6 W\n", - "avg value of source current=9.671 A\n", - "avg value of thyristor current=3.224 A\n" - ] - } - ], - "prompt_number": 17 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter8_3.ipynb b/_Power_Electronics/Chapter8_3.ipynb deleted file mode 100755 index 721a9faf..00000000 --- a/_Power_Electronics/Chapter8_3.ipynb +++ /dev/null @@ -1,984 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 08 : Inverters" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.3, Page No 465" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T=0.1*10**-3\n", - "f=1.0/T\n", - "k=15*10**-6 #k=th/w\n", - "\n", - "#Calculations\n", - "th=2*math.pi*f*k\n", - "X_l=10.0\n", - "R=2.0\n", - "X_c=R*math.tan(th)+X_l\n", - "C=1/(2*math.pi*f*X_c) \n", - "\n", - "#Results\n", - "print(\"value of C=%.3f uF\" %(C*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of C=1.248 uF\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.4 Page No 466" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "\n", - "#Calculations\n", - "V_01=2*V_s/(math.sqrt(2)*math.pi)\n", - "R=2.0\n", - "I_01=V_01/R\n", - "P_d=I_01**2*R \n", - "V=V_s/2\n", - "I_s=math.sqrt(2)*I_01/math.pi\n", - "P_s=V*I_s\n", - "\n", - "#Results\n", - "print(\"power delivered to load=%.1f W\" %P_d)\n", - "print(\"power delivered by both sources=%.1f W\" %(2*P_s))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power delivered to load=5359.9 W\n", - "power delivered by both sources=5359.9 W\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.5, Page No 468" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_01=4*V_s/(math.pi*math.sqrt(2))\n", - "R=1.0\n", - "X_L=6.0\n", - "X_c=7.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/math.sqrt(R**2+(X_L-X_c)**2)\n", - "P=I_01**2*R \n", - "I_s=math.sqrt(2)*I_01*(2*math.cos(math.radians(45)))/math.pi\n", - "P_s=V_s*I_s \n", - "\n", - "#Results\n", - "print(\"power delivered to the source=%.3f kW\" %(P/1000))\n", - "print(\"\\npower from the source=%.3f kW\" %(P_s/1000))\n", - " " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power delivered to the source=21.440 kW\n", - "\n", - "power from the source=21.440 kW\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.6 Page No 469" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_01=230.0\n", - "R=2.0\n", - "I_01=V_01/R\n", - "I_m=I_01*math.sqrt(2)\n", - "I_T1=I_m/2 \n", - "I_D1=0 \n", - "X_L=8.0\n", - "X_C=6.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=math.degrees(math.atan((X_L-X_C)/R))\n", - "I_T1=I_T1*math.sqrt(2)*0.47675 \n", - "I_D1=.1507025*I_m/math.sqrt(2) \n", - "\n", - "\n", - "#Results\n", - "print(\"when load R=2 ohm\")\n", - "print(\"rms value of thyristor current=%.2f A\" %I_T1)\n", - "print(\"rms value of diode current=%.0f A\" %I_D1)\n", - "print(\"when load R=2ohm % X_L=8ohm and X_C=6ohm\")\n", - "print(\"rms value of thyristor current=%.3f A\" %I_T1)\n", - "print(\"rms value of diode current=%.3f A\" %I_D1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when load R=2 ohm\n", - "rms value of thyristor current=54.83 A\n", - "rms value of diode current=17 A\n", - "when load R=2ohm % X_L=8ohm and X_C=6ohm\n", - "rms value of thyristor current=54.826 A\n", - "rms value of diode current=17.331 A\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.7 Page No 470" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=4.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.035\n", - "\n", - "#Calculations\n", - "C=155*10**-6\n", - "X_L=w*L\n", - "X_C=1/(w*C)\n", - "Z1=math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=-math.degrees(math.atan((X_L-X_C)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3-X_C/3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3-X_C/3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5-X_C/5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5-X_C/5)/R))\n", - "I_m1=4*V_s/(Z1*math.pi)\n", - "I_01=I_m1/math.sqrt(2) \n", - "I_m3=4*V_s/(3*Z3*math.pi)\n", - "I_m5=4*V_s/(5*Z5*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2)\n", - "I_0=I_m/math.sqrt(2)\n", - "P_0=(I_0)**2*R \n", - "P_01=(I_01)**2*R \n", - "t1=(180-phi1)*math.pi/(180*w) \n", - "t1=(phi1)*math.pi/(180*w) \n", - "\n", - "#Results\n", - "print(\"rms value of fundamental load current=%.2f A\" %I_01)\n", - "print(\"load power=%.1f W\" %P_0)\n", - "print(\"fundamental load power=%.1f W\" %P_01)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_m/2))\n", - "print(\"conduction time for thyristor=%.3f ms\" %(t1*1000))\n", - "print(\"Conduction time for diodes=%.3f ms\" %(t1*1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of fundamental load current=20.02 A\n", - "load power=1632.5 W\n", - "fundamental load power=1602.6 W\n", - "rms value of thyristor current=14.285 A\n", - "conduction time for thyristor=3.736 ms\n", - "Conduction time for diodes=3.736 ms\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.8, Page No 473" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_01=2*V_s/(math.sqrt(2)*math.pi) \n", - "R=10.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/R\n", - "P=I_01**2*R \n", - "V_or=math.sqrt((V_s/2)**2)\n", - "P=V_or**2/R \n", - "I_TP=V_s/(2*R)\n", - "I_or=I_TP\n", - "pf=I_01**2*R/(V_or*I_or) \n", - "DF=V_01/V_or \n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "V_03=V_01/3\n", - "HF=V_03/V_01\n", - "\n", - "#Results\n", - "print(\"fundamental rms o/p voltage=%.3f V\" %V_01)\n", - "print(\"fundamental power to load=%.1f W\" %P)\n", - "print(\"total o/p power to load=%.1f W\" %P)\n", - "print(\"avg SCR current=%.2f A\" %(I_TP*180/360))\n", - "print(\"i/p pf=%.3f\" %pf) \n", - "print(\"distortion factor=%.1f\" %DF)\n", - "print(\"THD=%.3f\" %THD) \n", - "print(\"harmonic factor=%.4f\" %HF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fundamental rms o/p voltage=103.536 V\n", - "fundamental power to load=1322.5 W\n", - "total o/p power to load=1322.5 W\n", - "avg SCR current=5.75 A\n", - "i/p pf=0.811\n", - "distortion factor=0.9\n", - "THD=0.483\n", - "harmonic factor=0.3333\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.9 Page No 474" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=60\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi) \n", - "V_01=4*V_s/(math.sqrt(2)*math.pi) \n", - "P_o=V_or**2/R \n", - "P_01=V_01**2/R \n", - "I_s=V_s/R \n", - "I_avg=I_s*math.pi/(2*math.pi) \n", - "V_03=V_01/3\n", - "HF=V_03/V_01 \n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.0f V\" %V_or)\n", - "print(\"o/p power=%.0f W\" %P_o)\n", - "print(\"fundamental component of rms voltage=%.2f V\" %V_01)\n", - "print(\"fundamental freq o/p power=%.2f W\" %P_01) \n", - "print(\"peak current=%.0f A\" %I_s)\n", - "print(\"avg current of each transistor=%.0f A\" %I_avg)\n", - "print(\"peak reverse blocking voltage=%.0f V\" %V_s)\n", - "print(\"harmonic factor=%.4f\" %HF)\n", - "print(\"THD=%.4f\" %THD)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=60 V\n", - "o/p power=1200 W\n", - "fundamental component of rms voltage=54.02 V\n", - "fundamental freq o/p power=972.68 W\n", - "peak current=20 A\n", - "avg current of each transistor=10 A\n", - "peak reverse blocking voltage=60 V\n", - "harmonic factor=0.3333\n", - "THD=0.4834\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.10 Page No 475" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=220.0\n", - "R=6.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.03\n", - "C=180*10**-6\n", - "X_L=w*L\n", - "X_C=1/(w*C)\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi)\n", - "V_01=4*V_s/(math.sqrt(2)*math.pi)\n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "print(\"THD of voltage=%.4f\" %THD)\n", - "DF=V_01/V_or \n", - "Z1=math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=-math.degrees(math.atan((X_L-X_C)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3-X_C/3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3-X_C/3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5-X_C/5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5-X_C/5)/R))\n", - "Z7=math.sqrt(R**2+(X_L*7-X_C/7)**2)\n", - "phi7=math.degrees(math.atan((X_L*7-X_C/7)/R))\n", - "I_01=19.403\n", - "I_m1=4*V_s/(Z1*math.pi)\n", - "I_m3=4*V_s/(3*Z3*math.pi)\n", - "I_m5=4*V_s/(5*Z5*math.pi)\n", - "I_m7=4*V_s/(7*Z7*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2+I_m7**2)\n", - "I_or=I_m/math.sqrt(2)\n", - "I_oh=math.sqrt((I_m**2-I_m1**2)/2)\n", - "THD=I_oh/I_01 \n", - "DF=I_01/I_or \n", - "P_o=I_or**2*R \n", - "I_avg=P_o/V_s \n", - "t1=(180-phi1)*math.pi/(180*w) \n", - "t1=1/(2*f)-t1 \n", - "I_p=I_m1 \n", - "I_t1=.46135*I_p \n", - "\n", - "#Results\n", - "print(\"\\nDF=%.1f\" %DF)\n", - "print(\"THD of current=%.4f\" %THD) \n", - "print(\"DF=%.3f\" %DF)\n", - "print(\"load power=%.1f W\" %P_o)\n", - "print(\"avg value of load current=%.2f A\" %I_avg)\n", - "print(\"conduction time for thyristor=%.0f ms\" %(t1*1000))\n", - "print(\"conduction time for diodes=%.0f ms\" %(t1*1000))\n", - "print(\"peak transistor current=%.2f A\" %I_p)\n", - "print(\"rms transistor current=%.2f A\" %I_t1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THD of voltage=0.4834\n", - "\n", - "DF=1.0\n", - "THD of current=0.1557\n", - "DF=0.988\n", - "load power=2313.5 W\n", - "avg value of load current=10.52 A\n", - "conduction time for thyristor=3 ms\n", - "conduction time for diodes=3 ms\n", - "peak transistor current=27.44 A\n", - "rms transistor current=12.66 A\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.11 Page No 497" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=450.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "I_or=math.sqrt((V_s/(3*R))**2*2/3+(2*V_s/(3*R))**2*1/3) \n", - "I_T1=math.sqrt((1/(2*math.pi))*((V_s/(3*R))**2*2*math.pi/3+(2*V_s/(3*R))**2*math.pi/3)) \n", - "P=3*I_or**2*R \n", - "I_or=math.sqrt((1/(math.pi))*((V_s/(2*R))**2*2*math.pi/3)) \n", - "I_T1=math.sqrt((1/(2*math.pi))*((V_s/(2*R))**2*2*math.pi/3)) \n", - "P=3*I_or**2*R \n", - "\n", - "#Results\n", - "print(\"for 180deg mode\")\n", - "print(\"rms value of load current=%.3f A\" %I_or)\n", - "print(\"power delivered to load=%.1f kW\" %(P/1000))\n", - "print(\"rms value of load current=%.0f A\" %I_T1)\n", - "print(\"for 120deg mode\")\n", - "print(\"rms value of load current=%.3f A\" %I_or)\n", - "print(\"rms value of load current=%.2f A\" %I_T1)\n", - "print(\"power delivered to load=%.3f kW\" %(P/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for 180deg mode\n", - "rms value of load current=18.371 A\n", - "power delivered to load=10.1 kW\n", - "rms value of load current=13 A\n", - "for 120deg mode\n", - "rms value of load current=18.371 A\n", - "rms value of load current=12.99 A\n", - "power delivered to load=10.125 kW\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.12, Page No 510" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=10.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.03\n", - "\n", - "#Calculations\n", - "X_L=w*L\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi)\n", - "V_01=4*V_s/(math.sqrt(2)*math.pi)\n", - "Z1=math.sqrt(R**2+(X_L)**2)\n", - "phi1=-math.degrees(math.atan((X_L)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5)/R))\n", - "Z7=math.sqrt(R**2+(X_L*7)**2)\n", - "phi7=math.degrees(math.atan((X_L*7)/R))\n", - "I_m1=4*V_s/(math.sqrt(2)*Z1*math.pi)\n", - "I_m3=4*V_s/(math.sqrt(2)*3*Z3*math.pi)\n", - "I_m5=4*V_s/(math.sqrt(2)*5*Z5*math.pi)\n", - "I_m7=4*V_s/(math.sqrt(2)*7*Z7*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2+I_m7**2)\n", - "P=I_m**2*R \n", - "I_01=I_m1*math.sin(math.radians(45))\n", - "I_03=I_m3*math.sin(math.radians(3*45))\n", - "I_05=I_m5*math.sin(math.radians(5*45))\n", - "I_07=I_m7*math.sin(math.radians(7*45))\n", - "I_0=(I_01**2+I_03**2+I_05**2+I_07**2)\n", - "P=I_0*R \n", - "g=(180-90)/3+45/2\n", - "I_01=2*I_m1*math.sin(math.radians(g))*math.sin(math.radians(45/2))\n", - "I_03=2*I_m3*math.sin(math.radians(g*3))*math.sin(math.radians(3*45/2))\n", - "I_05=2*I_m5*math.sin(math.radians(g*5))*math.sin(math.radians(5*45/2))\n", - "I_07=2*I_m7*math.sin(math.radians(g*7))*math.sin(math.radians(7*45/2))\n", - "I_0=(I_01**2+I_03**2+I_05**2+I_07**2)\n", - "P=I_0*R \n", - "\n", - "\n", - "#Results\n", - "print(\"using square wave o/p\")\n", - "print(\"power delivered=%.2f W\" %P)\n", - "print(\"using quasi-square wave o/p\")\n", - "print(\"power delivered=%.2f W\" %P)\n", - "print(\"using two symmitrical spaced pulses\")\n", - "print(\"power delivered=%.2f W\" %P)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "using square wave o/p\n", - "power delivered=845.87 W\n", - "using quasi-square wave o/p\n", - "power delivered=845.87 W\n", - "using two symmitrical spaced pulses\n", - "power delivered=845.87 W\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.14, Page No 520" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "T=1/f\n", - "I=0.5\n", - "\n", - "#Calculations\n", - "di=I/T #di=di/dt\n", - "V_s=220.0\n", - "L=V_s/di \n", - "t=20*10**-6\n", - "fos=2 #factor of safety\n", - "t_c=t*fos\n", - "R=10\n", - "C=t_c/(R*math.log(2))\n", - "\n", - "#Results \n", - "print(\"source inductance=%.1f H\" %L)\n", - "print(\"commutating capacitor=%.2f uF\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "source inductance=8.8 H\n", - "commutating capacitor=5.77 uF\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.15, Page No 539" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=10.0\n", - "L=.01\n", - "C=10*10**-6\n", - "#Calculations\n", - "if (R**2)<(4*L/C) :\n", - " print(\"ckt will commutate on its own\")\n", - "else:\n", - " print(\"ckt will not commutate on its own\")\n", - "\n", - "xie=R/(2*L)\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt(w_o**2-xie**2)\n", - "phi=math.degrees(math.atan(xie/w_r))\n", - "t=math.pi/w_r\n", - "V_s=1\n", - "v_L=V_s*(w_o/w_r)*math.exp(-xie*t)*math.cos(math.radians(180+phi))\n", - "v_c=V_s*(1-(w_o/w_r)*math.exp(-xie*t)*math.cos(math.radians(180-phi))) \n", - "di=V_s/L \n", - "\n", - "\n", - "#Results\n", - "print(\"voltage across inductor(*V_s)=%.5f V\" %v_L) \n", - "print(\"voltage across capacitor(*V_s)=%.5f V\" %v_c)\n", - "print(\"di/dt*V_s (for t=0)=%.0f A/s\" %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ckt will commutate on its own\n", - "voltage across inductor(*V_s)=-0.60468 V\n", - "voltage across capacitor(*V_s)=1.60468 V\n", - "di/dt*V_s (for t=0)=100 A/s\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.16, Page No 540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=0.006\n", - "C=1.2*10**-6\n", - "R=100.0\n", - "\n", - "#Calculations\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=0.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "R=40\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "R=140\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "\n", - "#Results\n", - "print(\"o/p freq=%.2f Hz\" %f)\n", - "print(\"for R=40ohm\")\n", - "print(\"upper limit o/p freq=%.1f Hz\" %f)\n", - "print(\"for R=140ohm\")\n", - "print(\"lower limit o/p freq=%.1f Hz\" %f)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "o/p freq=239.81 Hz\n", - "for R=40ohm\n", - "upper limit o/p freq=239.8 Hz\n", - "for R=140ohm\n", - "lower limit o/p freq=239.8 Hz\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.17, Page No 540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=5000.0\n", - "w=2*math.pi*f\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "L=60*10**-6\n", - "xie=R/(2*L)\n", - "C=7.5*10**-6\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt(w_o**2-xie**2)\n", - "t_c=math.pi*(1/w-1/w_r) \n", - "fos=1.5\n", - "t_q=10*10**-6\n", - "f_max=1/(2*math.pi*(t_q*fos/math.pi+1/w_r)) \n", - "\n", - "#Results\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n", - "print(\"max possible operating freq=%.1f Hz\" %f_max)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ckt turn off time=21.39 us\n", - "max possible operating freq=5341.4 Hz\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.18, Page No 541" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*2*math.pi/(2*3)/(math.pi/3+math.sqrt(3)*math.cos(math.radians(2*a))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*math.pi/(math.sqrt(2)*3*math.cos(math.radians(a)))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage V_ph=110.384 V\n", - "for constant load current\n", - "V_ph=110.38 V\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.19, Page No 547" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t=20.0\n", - "fos=2.0 #factor of safety\n", - "\n", - "#Calculations\n", - "t_c=t*fos\n", - "n=1.0/3\n", - "R=20.0\n", - "C=n**2*t_c/(4*R*math.log(2)) \n", - "\n", - "#Results \n", - "print(\"value of capacitor=%.2f uF\" %C)\n", - " #printing mistake in the answer in book." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of capacitor=0.08 uF\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.20, Page No 547" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=220.0\n", - "V_p=math.sqrt(2)*V_s/3 \n", - "V_L=math.sqrt(3)*V_p \n", - "V_p1=math.sqrt(2)*V_s/math.pi \n", - "V_L1=math.sqrt(3)*V_p1 \n", - "V_oh=math.sqrt(V_L**2-V_L1**2)\n", - "\n", - "#Calculations\n", - "THD=V_oh/V_L1 \n", - "V_a1=2*V_s/math.pi\n", - "V_a5=2*V_s/(5*math.pi)\n", - "V_a7=2*V_s/(7*math.pi)\n", - "V_a11=2*V_s/(11*math.pi)\n", - "R=4.0\n", - "L=0.02\n", - "f=50\n", - "w=2*math.pi*f\n", - "Z1=math.sqrt(R**2+(w*L)**2)\n", - "Z5=math.sqrt(R**2+(5*w*L)**2)\n", - "Z7=math.sqrt(R**2+(7*w*L)**2)\n", - "Z11=math.sqrt(R**2+(11*w*L)**2)\n", - "I_a1=V_a1/Z1\n", - "I_a5=V_a5/Z5\n", - "I_a7=V_a7/Z7\n", - "I_a11=V_a11/Z11\n", - "I_or=math.sqrt((I_a1**2+I_a5**2+I_a7**2+I_a11**2)/2)\n", - "P=3*I_or**2*R \n", - "I_s=P/V_s \n", - "I_TA=I_s/3 \n", - " \n", - "#Results\n", - "print(\"rms value of phasor voltages=%.2f V\" %V_p)\n", - "print(\"rms value of line voltages=%.2f V\" %V_L)\n", - "print(\"fundamental component of phase voltage=%.3f V\" %V_p1)\n", - "print(\"fundamental component of line voltages=%.3f V\" %V_L1)\n", - "print(\"THD=%.7f\" %THD)\n", - "print(\"load power=%.1f W\" %P)\n", - "print(\"avg value of source current=%.3f A\" %I_s)\n", - "print(\"avg value of thyristor current=%.3f A\" %I_TA)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of phasor voltages=103.71 V\n", - "rms value of line voltages=179.63 V\n", - "fundamental component of phase voltage=99.035 V\n", - "fundamental component of line voltages=171.533 V\n", - "THD=0.3108419\n", - "load power=2127.6 W\n", - "avg value of source current=9.671 A\n", - "avg value of thyristor current=3.224 A\n" - ] - } - ], - "prompt_number": 17 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter8_4.ipynb b/_Power_Electronics/Chapter8_4.ipynb deleted file mode 100755 index 721a9faf..00000000 --- a/_Power_Electronics/Chapter8_4.ipynb +++ /dev/null @@ -1,984 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 08 : Inverters" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.3, Page No 465" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "T=0.1*10**-3\n", - "f=1.0/T\n", - "k=15*10**-6 #k=th/w\n", - "\n", - "#Calculations\n", - "th=2*math.pi*f*k\n", - "X_l=10.0\n", - "R=2.0\n", - "X_c=R*math.tan(th)+X_l\n", - "C=1/(2*math.pi*f*X_c) \n", - "\n", - "#Results\n", - "print(\"value of C=%.3f uF\" %(C*10**6))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of C=1.248 uF\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.4 Page No 466" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "\n", - "#Calculations\n", - "V_01=2*V_s/(math.sqrt(2)*math.pi)\n", - "R=2.0\n", - "I_01=V_01/R\n", - "P_d=I_01**2*R \n", - "V=V_s/2\n", - "I_s=math.sqrt(2)*I_01/math.pi\n", - "P_s=V*I_s\n", - "\n", - "#Results\n", - "print(\"power delivered to load=%.1f W\" %P_d)\n", - "print(\"power delivered by both sources=%.1f W\" %(2*P_s))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power delivered to load=5359.9 W\n", - "power delivered by both sources=5359.9 W\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.5, Page No 468" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_01=4*V_s/(math.pi*math.sqrt(2))\n", - "R=1.0\n", - "X_L=6.0\n", - "X_c=7.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/math.sqrt(R**2+(X_L-X_c)**2)\n", - "P=I_01**2*R \n", - "I_s=math.sqrt(2)*I_01*(2*math.cos(math.radians(45)))/math.pi\n", - "P_s=V_s*I_s \n", - "\n", - "#Results\n", - "print(\"power delivered to the source=%.3f kW\" %(P/1000))\n", - "print(\"\\npower from the source=%.3f kW\" %(P_s/1000))\n", - " " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "power delivered to the source=21.440 kW\n", - "\n", - "power from the source=21.440 kW\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.6 Page No 469" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_01=230.0\n", - "R=2.0\n", - "I_01=V_01/R\n", - "I_m=I_01*math.sqrt(2)\n", - "I_T1=I_m/2 \n", - "I_D1=0 \n", - "X_L=8.0\n", - "X_C=6.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=math.degrees(math.atan((X_L-X_C)/R))\n", - "I_T1=I_T1*math.sqrt(2)*0.47675 \n", - "I_D1=.1507025*I_m/math.sqrt(2) \n", - "\n", - "\n", - "#Results\n", - "print(\"when load R=2 ohm\")\n", - "print(\"rms value of thyristor current=%.2f A\" %I_T1)\n", - "print(\"rms value of diode current=%.0f A\" %I_D1)\n", - "print(\"when load R=2ohm % X_L=8ohm and X_C=6ohm\")\n", - "print(\"rms value of thyristor current=%.3f A\" %I_T1)\n", - "print(\"rms value of diode current=%.3f A\" %I_D1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "when load R=2 ohm\n", - "rms value of thyristor current=54.83 A\n", - "rms value of diode current=17 A\n", - "when load R=2ohm % X_L=8ohm and X_C=6ohm\n", - "rms value of thyristor current=54.826 A\n", - "rms value of diode current=17.331 A\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.7 Page No 470" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=4.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.035\n", - "\n", - "#Calculations\n", - "C=155*10**-6\n", - "X_L=w*L\n", - "X_C=1/(w*C)\n", - "Z1=math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=-math.degrees(math.atan((X_L-X_C)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3-X_C/3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3-X_C/3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5-X_C/5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5-X_C/5)/R))\n", - "I_m1=4*V_s/(Z1*math.pi)\n", - "I_01=I_m1/math.sqrt(2) \n", - "I_m3=4*V_s/(3*Z3*math.pi)\n", - "I_m5=4*V_s/(5*Z5*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2)\n", - "I_0=I_m/math.sqrt(2)\n", - "P_0=(I_0)**2*R \n", - "P_01=(I_01)**2*R \n", - "t1=(180-phi1)*math.pi/(180*w) \n", - "t1=(phi1)*math.pi/(180*w) \n", - "\n", - "#Results\n", - "print(\"rms value of fundamental load current=%.2f A\" %I_01)\n", - "print(\"load power=%.1f W\" %P_0)\n", - "print(\"fundamental load power=%.1f W\" %P_01)\n", - "print(\"rms value of thyristor current=%.3f A\" %(I_m/2))\n", - "print(\"conduction time for thyristor=%.3f ms\" %(t1*1000))\n", - "print(\"Conduction time for diodes=%.3f ms\" %(t1*1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of fundamental load current=20.02 A\n", - "load power=1632.5 W\n", - "fundamental load power=1602.6 W\n", - "rms value of thyristor current=14.285 A\n", - "conduction time for thyristor=3.736 ms\n", - "Conduction time for diodes=3.736 ms\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.8, Page No 473" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_01=2*V_s/(math.sqrt(2)*math.pi) \n", - "R=10.0\n", - "\n", - "#Calculations\n", - "I_01=V_01/R\n", - "P=I_01**2*R \n", - "V_or=math.sqrt((V_s/2)**2)\n", - "P=V_or**2/R \n", - "I_TP=V_s/(2*R)\n", - "I_or=I_TP\n", - "pf=I_01**2*R/(V_or*I_or) \n", - "DF=V_01/V_or \n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "V_03=V_01/3\n", - "HF=V_03/V_01\n", - "\n", - "#Results\n", - "print(\"fundamental rms o/p voltage=%.3f V\" %V_01)\n", - "print(\"fundamental power to load=%.1f W\" %P)\n", - "print(\"total o/p power to load=%.1f W\" %P)\n", - "print(\"avg SCR current=%.2f A\" %(I_TP*180/360))\n", - "print(\"i/p pf=%.3f\" %pf) \n", - "print(\"distortion factor=%.1f\" %DF)\n", - "print(\"THD=%.3f\" %THD) \n", - "print(\"harmonic factor=%.4f\" %HF)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "fundamental rms o/p voltage=103.536 V\n", - "fundamental power to load=1322.5 W\n", - "total o/p power to load=1322.5 W\n", - "avg SCR current=5.75 A\n", - "i/p pf=0.811\n", - "distortion factor=0.9\n", - "THD=0.483\n", - "harmonic factor=0.3333\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.9 Page No 474" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=60\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi) \n", - "V_01=4*V_s/(math.sqrt(2)*math.pi) \n", - "P_o=V_or**2/R \n", - "P_01=V_01**2/R \n", - "I_s=V_s/R \n", - "I_avg=I_s*math.pi/(2*math.pi) \n", - "V_03=V_01/3\n", - "HF=V_03/V_01 \n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.0f V\" %V_or)\n", - "print(\"o/p power=%.0f W\" %P_o)\n", - "print(\"fundamental component of rms voltage=%.2f V\" %V_01)\n", - "print(\"fundamental freq o/p power=%.2f W\" %P_01) \n", - "print(\"peak current=%.0f A\" %I_s)\n", - "print(\"avg current of each transistor=%.0f A\" %I_avg)\n", - "print(\"peak reverse blocking voltage=%.0f V\" %V_s)\n", - "print(\"harmonic factor=%.4f\" %HF)\n", - "print(\"THD=%.4f\" %THD)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=60 V\n", - "o/p power=1200 W\n", - "fundamental component of rms voltage=54.02 V\n", - "fundamental freq o/p power=972.68 W\n", - "peak current=20 A\n", - "avg current of each transistor=10 A\n", - "peak reverse blocking voltage=60 V\n", - "harmonic factor=0.3333\n", - "THD=0.4834\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.10 Page No 475" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=220.0\n", - "R=6.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.03\n", - "C=180*10**-6\n", - "X_L=w*L\n", - "X_C=1/(w*C)\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi)\n", - "V_01=4*V_s/(math.sqrt(2)*math.pi)\n", - "V_oh=math.sqrt(V_or**2-V_01**2)\n", - "THD=V_oh/V_01 \n", - "print(\"THD of voltage=%.4f\" %THD)\n", - "DF=V_01/V_or \n", - "Z1=math.sqrt(R**2+(X_L-X_C)**2)\n", - "phi1=-math.degrees(math.atan((X_L-X_C)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3-X_C/3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3-X_C/3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5-X_C/5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5-X_C/5)/R))\n", - "Z7=math.sqrt(R**2+(X_L*7-X_C/7)**2)\n", - "phi7=math.degrees(math.atan((X_L*7-X_C/7)/R))\n", - "I_01=19.403\n", - "I_m1=4*V_s/(Z1*math.pi)\n", - "I_m3=4*V_s/(3*Z3*math.pi)\n", - "I_m5=4*V_s/(5*Z5*math.pi)\n", - "I_m7=4*V_s/(7*Z7*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2+I_m7**2)\n", - "I_or=I_m/math.sqrt(2)\n", - "I_oh=math.sqrt((I_m**2-I_m1**2)/2)\n", - "THD=I_oh/I_01 \n", - "DF=I_01/I_or \n", - "P_o=I_or**2*R \n", - "I_avg=P_o/V_s \n", - "t1=(180-phi1)*math.pi/(180*w) \n", - "t1=1/(2*f)-t1 \n", - "I_p=I_m1 \n", - "I_t1=.46135*I_p \n", - "\n", - "#Results\n", - "print(\"\\nDF=%.1f\" %DF)\n", - "print(\"THD of current=%.4f\" %THD) \n", - "print(\"DF=%.3f\" %DF)\n", - "print(\"load power=%.1f W\" %P_o)\n", - "print(\"avg value of load current=%.2f A\" %I_avg)\n", - "print(\"conduction time for thyristor=%.0f ms\" %(t1*1000))\n", - "print(\"conduction time for diodes=%.0f ms\" %(t1*1000))\n", - "print(\"peak transistor current=%.2f A\" %I_p)\n", - "print(\"rms transistor current=%.2f A\" %I_t1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THD of voltage=0.4834\n", - "\n", - "DF=1.0\n", - "THD of current=0.1557\n", - "DF=0.988\n", - "load power=2313.5 W\n", - "avg value of load current=10.52 A\n", - "conduction time for thyristor=3 ms\n", - "conduction time for diodes=3 ms\n", - "peak transistor current=27.44 A\n", - "rms transistor current=12.66 A\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.11 Page No 497" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=450.0\n", - "R=10.0\n", - "\n", - "#Calculations\n", - "I_or=math.sqrt((V_s/(3*R))**2*2/3+(2*V_s/(3*R))**2*1/3) \n", - "I_T1=math.sqrt((1/(2*math.pi))*((V_s/(3*R))**2*2*math.pi/3+(2*V_s/(3*R))**2*math.pi/3)) \n", - "P=3*I_or**2*R \n", - "I_or=math.sqrt((1/(math.pi))*((V_s/(2*R))**2*2*math.pi/3)) \n", - "I_T1=math.sqrt((1/(2*math.pi))*((V_s/(2*R))**2*2*math.pi/3)) \n", - "P=3*I_or**2*R \n", - "\n", - "#Results\n", - "print(\"for 180deg mode\")\n", - "print(\"rms value of load current=%.3f A\" %I_or)\n", - "print(\"power delivered to load=%.1f kW\" %(P/1000))\n", - "print(\"rms value of load current=%.0f A\" %I_T1)\n", - "print(\"for 120deg mode\")\n", - "print(\"rms value of load current=%.3f A\" %I_or)\n", - "print(\"rms value of load current=%.2f A\" %I_T1)\n", - "print(\"power delivered to load=%.3f kW\" %(P/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for 180deg mode\n", - "rms value of load current=18.371 A\n", - "power delivered to load=10.1 kW\n", - "rms value of load current=13 A\n", - "for 120deg mode\n", - "rms value of load current=18.371 A\n", - "rms value of load current=12.99 A\n", - "power delivered to load=10.125 kW\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.12, Page No 510" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "R=10.0\n", - "f=50.0\n", - "w=2*math.pi*f\n", - "L=0.03\n", - "\n", - "#Calculations\n", - "X_L=w*L\n", - "V_or=math.sqrt(V_s**2*math.pi/math.pi)\n", - "V_01=4*V_s/(math.sqrt(2)*math.pi)\n", - "Z1=math.sqrt(R**2+(X_L)**2)\n", - "phi1=-math.degrees(math.atan((X_L)/R))\n", - "Z3=math.sqrt(R**2+(X_L*3)**2)\n", - "phi3=math.degrees(math.atan((X_L*3)/R))\n", - "Z5=math.sqrt(R**2+(X_L*5)**2)\n", - "phi5=math.degrees(math.atan((X_L*5)/R))\n", - "Z7=math.sqrt(R**2+(X_L*7)**2)\n", - "phi7=math.degrees(math.atan((X_L*7)/R))\n", - "I_m1=4*V_s/(math.sqrt(2)*Z1*math.pi)\n", - "I_m3=4*V_s/(math.sqrt(2)*3*Z3*math.pi)\n", - "I_m5=4*V_s/(math.sqrt(2)*5*Z5*math.pi)\n", - "I_m7=4*V_s/(math.sqrt(2)*7*Z7*math.pi)\n", - "I_m=math.sqrt(I_m1**2+I_m3**2+I_m5**2+I_m7**2)\n", - "P=I_m**2*R \n", - "I_01=I_m1*math.sin(math.radians(45))\n", - "I_03=I_m3*math.sin(math.radians(3*45))\n", - "I_05=I_m5*math.sin(math.radians(5*45))\n", - "I_07=I_m7*math.sin(math.radians(7*45))\n", - "I_0=(I_01**2+I_03**2+I_05**2+I_07**2)\n", - "P=I_0*R \n", - "g=(180-90)/3+45/2\n", - "I_01=2*I_m1*math.sin(math.radians(g))*math.sin(math.radians(45/2))\n", - "I_03=2*I_m3*math.sin(math.radians(g*3))*math.sin(math.radians(3*45/2))\n", - "I_05=2*I_m5*math.sin(math.radians(g*5))*math.sin(math.radians(5*45/2))\n", - "I_07=2*I_m7*math.sin(math.radians(g*7))*math.sin(math.radians(7*45/2))\n", - "I_0=(I_01**2+I_03**2+I_05**2+I_07**2)\n", - "P=I_0*R \n", - "\n", - "\n", - "#Results\n", - "print(\"using square wave o/p\")\n", - "print(\"power delivered=%.2f W\" %P)\n", - "print(\"using quasi-square wave o/p\")\n", - "print(\"power delivered=%.2f W\" %P)\n", - "print(\"using two symmitrical spaced pulses\")\n", - "print(\"power delivered=%.2f W\" %P)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "using square wave o/p\n", - "power delivered=845.87 W\n", - "using quasi-square wave o/p\n", - "power delivered=845.87 W\n", - "using two symmitrical spaced pulses\n", - "power delivered=845.87 W\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.14, Page No 520" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=50.0\n", - "T=1/f\n", - "I=0.5\n", - "\n", - "#Calculations\n", - "di=I/T #di=di/dt\n", - "V_s=220.0\n", - "L=V_s/di \n", - "t=20*10**-6\n", - "fos=2 #factor of safety\n", - "t_c=t*fos\n", - "R=10\n", - "C=t_c/(R*math.log(2))\n", - "\n", - "#Results \n", - "print(\"source inductance=%.1f H\" %L)\n", - "print(\"commutating capacitor=%.2f uF\" %(C*10**6))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "source inductance=8.8 H\n", - "commutating capacitor=5.77 uF\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.15, Page No 539" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=10.0\n", - "L=.01\n", - "C=10*10**-6\n", - "#Calculations\n", - "if (R**2)<(4*L/C) :\n", - " print(\"ckt will commutate on its own\")\n", - "else:\n", - " print(\"ckt will not commutate on its own\")\n", - "\n", - "xie=R/(2*L)\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt(w_o**2-xie**2)\n", - "phi=math.degrees(math.atan(xie/w_r))\n", - "t=math.pi/w_r\n", - "V_s=1\n", - "v_L=V_s*(w_o/w_r)*math.exp(-xie*t)*math.cos(math.radians(180+phi))\n", - "v_c=V_s*(1-(w_o/w_r)*math.exp(-xie*t)*math.cos(math.radians(180-phi))) \n", - "di=V_s/L \n", - "\n", - "\n", - "#Results\n", - "print(\"voltage across inductor(*V_s)=%.5f V\" %v_L) \n", - "print(\"voltage across capacitor(*V_s)=%.5f V\" %v_c)\n", - "print(\"di/dt*V_s (for t=0)=%.0f A/s\" %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ckt will commutate on its own\n", - "voltage across inductor(*V_s)=-0.60468 V\n", - "voltage across capacitor(*V_s)=1.60468 V\n", - "di/dt*V_s (for t=0)=100 A/s\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.16, Page No 540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "L=0.006\n", - "C=1.2*10**-6\n", - "R=100.0\n", - "\n", - "#Calculations\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=0.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "R=40\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "R=140\n", - "T=math.pi/math.sqrt(1/(L*C)-(R/(2*L))**2)\n", - "T_off=.2*10**-3\n", - "f=1/(2*(T+T_off)) \n", - "\n", - "#Results\n", - "print(\"o/p freq=%.2f Hz\" %f)\n", - "print(\"for R=40ohm\")\n", - "print(\"upper limit o/p freq=%.1f Hz\" %f)\n", - "print(\"for R=140ohm\")\n", - "print(\"lower limit o/p freq=%.1f Hz\" %f)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "o/p freq=239.81 Hz\n", - "for R=40ohm\n", - "upper limit o/p freq=239.8 Hz\n", - "for R=140ohm\n", - "lower limit o/p freq=239.8 Hz\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.17, Page No 540" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "f=5000.0\n", - "w=2*math.pi*f\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "L=60*10**-6\n", - "xie=R/(2*L)\n", - "C=7.5*10**-6\n", - "w_o=1/math.sqrt(L*C)\n", - "w_r=math.sqrt(w_o**2-xie**2)\n", - "t_c=math.pi*(1/w-1/w_r) \n", - "fos=1.5\n", - "t_q=10*10**-6\n", - "f_max=1/(2*math.pi*(t_q*fos/math.pi+1/w_r)) \n", - "\n", - "#Results\n", - "print(\"ckt turn off time=%.2f us\" %(t_c*10**6))\n", - "print(\"max possible operating freq=%.1f Hz\" %f_max)\n", - " #Answers have small variations from that in the book due to difference in the rounding off of digits." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ckt turn off time=21.39 us\n", - "max possible operating freq=5341.4 Hz\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.18, Page No 541" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "a=30.0\n", - "R=10.0\n", - "P=5000.0\n", - "\n", - "#Calculations\n", - "V_s=math.sqrt(P*R*2*math.pi/(2*3)/(math.pi/3+math.sqrt(3)*math.cos(math.radians(2*a))/2))\n", - "V_ph=V_s/math.sqrt(3) \n", - "I_or=math.sqrt(P*R)\n", - "V_s=I_or*math.pi/(math.sqrt(2)*3*math.cos(math.radians(a)))\n", - "V_ph=V_s/math.sqrt(3) \n", - "\n", - "#Results\n", - "print(\"per phase voltage V_ph=%.3f V\" %V_ph) \n", - "print(\"for constant load current\")\n", - "print(\"V_ph=%.2f V\" %V_ph)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "per phase voltage V_ph=110.384 V\n", - "for constant load current\n", - "V_ph=110.38 V\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.19, Page No 547" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "t=20.0\n", - "fos=2.0 #factor of safety\n", - "\n", - "#Calculations\n", - "t_c=t*fos\n", - "n=1.0/3\n", - "R=20.0\n", - "C=n**2*t_c/(4*R*math.log(2)) \n", - "\n", - "#Results \n", - "print(\"value of capacitor=%.2f uF\" %C)\n", - " #printing mistake in the answer in book." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of capacitor=0.08 uF\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.20, Page No 547" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=220.0\n", - "V_p=math.sqrt(2)*V_s/3 \n", - "V_L=math.sqrt(3)*V_p \n", - "V_p1=math.sqrt(2)*V_s/math.pi \n", - "V_L1=math.sqrt(3)*V_p1 \n", - "V_oh=math.sqrt(V_L**2-V_L1**2)\n", - "\n", - "#Calculations\n", - "THD=V_oh/V_L1 \n", - "V_a1=2*V_s/math.pi\n", - "V_a5=2*V_s/(5*math.pi)\n", - "V_a7=2*V_s/(7*math.pi)\n", - "V_a11=2*V_s/(11*math.pi)\n", - "R=4.0\n", - "L=0.02\n", - "f=50\n", - "w=2*math.pi*f\n", - "Z1=math.sqrt(R**2+(w*L)**2)\n", - "Z5=math.sqrt(R**2+(5*w*L)**2)\n", - "Z7=math.sqrt(R**2+(7*w*L)**2)\n", - "Z11=math.sqrt(R**2+(11*w*L)**2)\n", - "I_a1=V_a1/Z1\n", - "I_a5=V_a5/Z5\n", - "I_a7=V_a7/Z7\n", - "I_a11=V_a11/Z11\n", - "I_or=math.sqrt((I_a1**2+I_a5**2+I_a7**2+I_a11**2)/2)\n", - "P=3*I_or**2*R \n", - "I_s=P/V_s \n", - "I_TA=I_s/3 \n", - " \n", - "#Results\n", - "print(\"rms value of phasor voltages=%.2f V\" %V_p)\n", - "print(\"rms value of line voltages=%.2f V\" %V_L)\n", - "print(\"fundamental component of phase voltage=%.3f V\" %V_p1)\n", - "print(\"fundamental component of line voltages=%.3f V\" %V_L1)\n", - "print(\"THD=%.7f\" %THD)\n", - "print(\"load power=%.1f W\" %P)\n", - "print(\"avg value of source current=%.3f A\" %I_s)\n", - "print(\"avg value of thyristor current=%.3f A\" %I_TA)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of phasor voltages=103.71 V\n", - "rms value of line voltages=179.63 V\n", - "fundamental component of phase voltage=99.035 V\n", - "fundamental component of line voltages=171.533 V\n", - "THD=0.3108419\n", - "load power=2127.6 W\n", - "avg value of source current=9.671 A\n", - "avg value of thyristor current=3.224 A\n" - ] - } - ], - "prompt_number": 17 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter9.ipynb b/_Power_Electronics/Chapter9.ipynb deleted file mode 100755 index 052c4736..00000000 --- a/_Power_Electronics/Chapter9.ipynb +++ /dev/null @@ -1,388 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 09 : AC Voltage Controllers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.1, Page No 560" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "V_or=(V_m/2)*math.sqrt(1/math.pi*((2*math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "R=20\n", - "I_or=V_or/R\n", - "P_o=I_or**2*R \n", - "I_s=I_or\n", - "VA=V_s*I_s\n", - "pf=P_o/VA \n", - "V_o=math.sqrt(2)*V_s/(2*math.pi)*(math.cos(math.radians(a))-1)\n", - "I_ON=V_o/R \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.3f V\" %V_or)\n", - "print(\"load power=%.1f W\" %P_o)\n", - "print(\"i/p pf=%.4f\" %pf)\n", - "print(\"avg i/p current=%.4f A\" %I_ON)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=224.716 V\n", - "load power=2524.9 W\n", - "i/p pf=0.9770\n", - "avg i/p current=-0.7581 A\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.2, Page No 560" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "V_or=(V_s)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "R=20\n", - "I_or=V_or/R\n", - "P_o=I_or**2*R \n", - "I_s=I_or\n", - "VA=V_s*I_s\n", - "pf=P_o/VA \n", - "I_TA=math.sqrt(2)*V_s/(2*math.pi*R)*(math.cos(math.radians(a))+1) \n", - "I_Tr=math.sqrt(2)*V_s/(2*R)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.3f V\" %V_or)\n", - "print(\"load power=%.2f W\" %P_o)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"avg thyristor current=%.2f A\" %I_TA) \n", - "print(\"rms value of thyristor current=%.2f A\" %I_Tr)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=219.304 V\n", - "load power=2404.71 W\n", - "i/p pf=0.95\n", - "avg thyristor current=4.42 A\n", - "rms value of thyristor current=7.75 A\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.3 Page No 564" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "n=6.0 #on cycles\n", - "m=4.0 #off cycles\n", - "\n", - "#Calculations\n", - "k=n/(n+m)\n", - "V_or=V_s*math.sqrt(k) \n", - "pf=math.sqrt(k) \n", - "R=15\n", - "I_m=V_s*math.sqrt(2)/R\n", - "I_TA=k*I_m/math.pi\n", - "I_TR=I_m*math.sqrt(k)/2 \n", - " \n", - "#Results\n", - "print(\"rms value of o/ voltage=%.2f V\" %V_or)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"avg thyristor current=%.2f A\" %I_TA) \n", - "print(\"rms value of thyristor current=%.2f A\" %I_TR)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/ voltage=178.16 V\n", - "i/p pf=0.77\n", - "avg thyristor current=4.14 A\n", - "rms value of thyristor current=8.40 A\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.4, Page No 569" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "I_TAM1=2*V_m/(2*math.pi*R) \n", - "I_TRM2=V_m/(2*R) \n", - "f=50\n", - "w=2*math.pi*f\n", - "t_c=math.pi/w \n", - " \n", - "#Results\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TAM1)\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TRM2)\n", - "print(\"ckt turn off time=%.0f ms\" %(t_c*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max value of avg thyristor current=34.512 A\n", - "max value of avg thyristor current=54.212 A\n", - "ckt turn off time=10 ms\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.5 Page No 575" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=3.0\n", - "X_L=4.0\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(X_L/R)) \n", - "V_s=230\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_s/Z \n", - "P=I_or**2*R \n", - "I_s=I_or\n", - "pf=P/(V_s*I_s) \n", - "I_TAM=math.sqrt(2)*V_s/(math.pi*Z) \n", - "I_Tm=math.sqrt(2)*V_s/(2*Z) \n", - "f=50\n", - "w=2*math.pi*f\n", - "di=math.sqrt(2)*V_s*w/Z \n", - "\n", - "#Results\n", - "print(\"min firing angle=%.2f deg\" %phi)\n", - "print(\"\\nmax firing angle=%.0f deg\" %180)\n", - "print(\"i/p pf=%.1f\" %pf)\n", - "print(\"max value of rms load current=%.0f A\" %I_or)\n", - "print(\"max power=%.0f W\" %P)\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TAM)\n", - "print(\"max value of rms thyristor current=%.3f A\" %I_Tm)\n", - "print(\"di/dt=%.0f A/s\" %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "min firing angle=53.13 deg\n", - "\n", - "max firing angle=180 deg\n", - "i/p pf=0.6\n", - "max value of rms load current=46 A\n", - "max power=6348 W\n", - "max value of avg thyristor current=20.707 A\n", - "max value of rms thyristor current=32.527 A\n", - "di/dt=20437 A/s\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.6 Page No 576" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "R=3.0 #ohm\n", - "X_L=5.0 #ohm\n", - "a=120.0 #firing angle delay\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(X_L/R))\n", - "b=0\n", - "i=1\n", - "while (i>0) :\n", - " LHS=math.sin(math.radians(b-a))\n", - " RHS=math.sin(math.radians(a-phi))*math.exp(-(R/X_L)*(b-a)*math.pi/180)\n", - " if math.fabs(LHS-RHS)<= 0.01 :\n", - " B=b\n", - " i=2\n", - " break\n", - " \n", - " b=b+.1 \n", - "V_or=math.sqrt(2)*V*math.sqrt((1/(2*math.pi))*((B-a)*math.pi/180+(math.sin(math.radians(2*a))-math.sin(math.radians(2*B)))/2))\n", - "\n", - "\n", - "#Results\n", - "print(\"Extinction angle=%.1f deg\" %B) #answer in the book is wrong as formulae for RHS is wrongly employed\n", - "print(\"rms value of output voltage=%.2f V\" %V_or) #answer do not match due to wrong B in book\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Extinction angle=156.1 deg\n", - "rms value of output voltage=97.75 V\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.8, Page No 581" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=60.0\n", - "R=20.0\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt((V_m**2/(2*math.pi))*(a*math.pi/180-math.sin(math.radians(2*a))/2)+(2*V_m**2/(math.pi))*(math.pi-a*math.pi/180+math.sin(math.radians(2*a))/2)) \n", - "I_T1r=(V_m/R)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "I_T3r=(V_m/(2*R))*math.sqrt(1/math.pi*((a*math.pi/180)-math.sin(math.radians(2*a))/2)) \n", - "I1=math.sqrt(2)*I_T1r\n", - "I3=math.sqrt((math.sqrt(2)*I_T1r)**2+(math.sqrt(2)*I_T3r)**2)\n", - "r=V_s*(I1+I3) \n", - "P_o=V_or**2/R\n", - "pf=P_o/r \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "print(\"rms value of current for upper thyristors=%.2f A\" %I_T1r)\n", - "print(\"rms value of current for lower thyristors=%.2f A\" %I_T3r)\n", - "print(\"t/f VA rating=%.2f VA\" %r)\n", - "print(\"i/p pf=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=424.94 V\n", - "rms value of current for upper thyristors=14.59 A\n", - "rms value of current for lower thyristors=3.60 A\n", - "t/f VA rating=9631.61 VA\n", - "i/p pf=0.94\n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter9_1.ipynb b/_Power_Electronics/Chapter9_1.ipynb deleted file mode 100755 index 052c4736..00000000 --- a/_Power_Electronics/Chapter9_1.ipynb +++ /dev/null @@ -1,388 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 09 : AC Voltage Controllers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.1, Page No 560" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "V_or=(V_m/2)*math.sqrt(1/math.pi*((2*math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "R=20\n", - "I_or=V_or/R\n", - "P_o=I_or**2*R \n", - "I_s=I_or\n", - "VA=V_s*I_s\n", - "pf=P_o/VA \n", - "V_o=math.sqrt(2)*V_s/(2*math.pi)*(math.cos(math.radians(a))-1)\n", - "I_ON=V_o/R \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.3f V\" %V_or)\n", - "print(\"load power=%.1f W\" %P_o)\n", - "print(\"i/p pf=%.4f\" %pf)\n", - "print(\"avg i/p current=%.4f A\" %I_ON)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=224.716 V\n", - "load power=2524.9 W\n", - "i/p pf=0.9770\n", - "avg i/p current=-0.7581 A\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.2, Page No 560" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "V_or=(V_s)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "R=20\n", - "I_or=V_or/R\n", - "P_o=I_or**2*R \n", - "I_s=I_or\n", - "VA=V_s*I_s\n", - "pf=P_o/VA \n", - "I_TA=math.sqrt(2)*V_s/(2*math.pi*R)*(math.cos(math.radians(a))+1) \n", - "I_Tr=math.sqrt(2)*V_s/(2*R)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.3f V\" %V_or)\n", - "print(\"load power=%.2f W\" %P_o)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"avg thyristor current=%.2f A\" %I_TA) \n", - "print(\"rms value of thyristor current=%.2f A\" %I_Tr)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=219.304 V\n", - "load power=2404.71 W\n", - "i/p pf=0.95\n", - "avg thyristor current=4.42 A\n", - "rms value of thyristor current=7.75 A\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.3 Page No 564" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "n=6.0 #on cycles\n", - "m=4.0 #off cycles\n", - "\n", - "#Calculations\n", - "k=n/(n+m)\n", - "V_or=V_s*math.sqrt(k) \n", - "pf=math.sqrt(k) \n", - "R=15\n", - "I_m=V_s*math.sqrt(2)/R\n", - "I_TA=k*I_m/math.pi\n", - "I_TR=I_m*math.sqrt(k)/2 \n", - " \n", - "#Results\n", - "print(\"rms value of o/ voltage=%.2f V\" %V_or)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"avg thyristor current=%.2f A\" %I_TA) \n", - "print(\"rms value of thyristor current=%.2f A\" %I_TR)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/ voltage=178.16 V\n", - "i/p pf=0.77\n", - "avg thyristor current=4.14 A\n", - "rms value of thyristor current=8.40 A\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.4, Page No 569" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "I_TAM1=2*V_m/(2*math.pi*R) \n", - "I_TRM2=V_m/(2*R) \n", - "f=50\n", - "w=2*math.pi*f\n", - "t_c=math.pi/w \n", - " \n", - "#Results\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TAM1)\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TRM2)\n", - "print(\"ckt turn off time=%.0f ms\" %(t_c*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max value of avg thyristor current=34.512 A\n", - "max value of avg thyristor current=54.212 A\n", - "ckt turn off time=10 ms\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.5 Page No 575" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=3.0\n", - "X_L=4.0\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(X_L/R)) \n", - "V_s=230\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_s/Z \n", - "P=I_or**2*R \n", - "I_s=I_or\n", - "pf=P/(V_s*I_s) \n", - "I_TAM=math.sqrt(2)*V_s/(math.pi*Z) \n", - "I_Tm=math.sqrt(2)*V_s/(2*Z) \n", - "f=50\n", - "w=2*math.pi*f\n", - "di=math.sqrt(2)*V_s*w/Z \n", - "\n", - "#Results\n", - "print(\"min firing angle=%.2f deg\" %phi)\n", - "print(\"\\nmax firing angle=%.0f deg\" %180)\n", - "print(\"i/p pf=%.1f\" %pf)\n", - "print(\"max value of rms load current=%.0f A\" %I_or)\n", - "print(\"max power=%.0f W\" %P)\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TAM)\n", - "print(\"max value of rms thyristor current=%.3f A\" %I_Tm)\n", - "print(\"di/dt=%.0f A/s\" %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "min firing angle=53.13 deg\n", - "\n", - "max firing angle=180 deg\n", - "i/p pf=0.6\n", - "max value of rms load current=46 A\n", - "max power=6348 W\n", - "max value of avg thyristor current=20.707 A\n", - "max value of rms thyristor current=32.527 A\n", - "di/dt=20437 A/s\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.6 Page No 576" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "R=3.0 #ohm\n", - "X_L=5.0 #ohm\n", - "a=120.0 #firing angle delay\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(X_L/R))\n", - "b=0\n", - "i=1\n", - "while (i>0) :\n", - " LHS=math.sin(math.radians(b-a))\n", - " RHS=math.sin(math.radians(a-phi))*math.exp(-(R/X_L)*(b-a)*math.pi/180)\n", - " if math.fabs(LHS-RHS)<= 0.01 :\n", - " B=b\n", - " i=2\n", - " break\n", - " \n", - " b=b+.1 \n", - "V_or=math.sqrt(2)*V*math.sqrt((1/(2*math.pi))*((B-a)*math.pi/180+(math.sin(math.radians(2*a))-math.sin(math.radians(2*B)))/2))\n", - "\n", - "\n", - "#Results\n", - "print(\"Extinction angle=%.1f deg\" %B) #answer in the book is wrong as formulae for RHS is wrongly employed\n", - "print(\"rms value of output voltage=%.2f V\" %V_or) #answer do not match due to wrong B in book\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Extinction angle=156.1 deg\n", - "rms value of output voltage=97.75 V\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.8, Page No 581" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=60.0\n", - "R=20.0\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt((V_m**2/(2*math.pi))*(a*math.pi/180-math.sin(math.radians(2*a))/2)+(2*V_m**2/(math.pi))*(math.pi-a*math.pi/180+math.sin(math.radians(2*a))/2)) \n", - "I_T1r=(V_m/R)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "I_T3r=(V_m/(2*R))*math.sqrt(1/math.pi*((a*math.pi/180)-math.sin(math.radians(2*a))/2)) \n", - "I1=math.sqrt(2)*I_T1r\n", - "I3=math.sqrt((math.sqrt(2)*I_T1r)**2+(math.sqrt(2)*I_T3r)**2)\n", - "r=V_s*(I1+I3) \n", - "P_o=V_or**2/R\n", - "pf=P_o/r \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "print(\"rms value of current for upper thyristors=%.2f A\" %I_T1r)\n", - "print(\"rms value of current for lower thyristors=%.2f A\" %I_T3r)\n", - "print(\"t/f VA rating=%.2f VA\" %r)\n", - "print(\"i/p pf=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=424.94 V\n", - "rms value of current for upper thyristors=14.59 A\n", - "rms value of current for lower thyristors=3.60 A\n", - "t/f VA rating=9631.61 VA\n", - "i/p pf=0.94\n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter9_2.ipynb b/_Power_Electronics/Chapter9_2.ipynb deleted file mode 100755 index 052c4736..00000000 --- a/_Power_Electronics/Chapter9_2.ipynb +++ /dev/null @@ -1,388 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 09 : AC Voltage Controllers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.1, Page No 560" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "V_or=(V_m/2)*math.sqrt(1/math.pi*((2*math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "R=20\n", - "I_or=V_or/R\n", - "P_o=I_or**2*R \n", - "I_s=I_or\n", - "VA=V_s*I_s\n", - "pf=P_o/VA \n", - "V_o=math.sqrt(2)*V_s/(2*math.pi)*(math.cos(math.radians(a))-1)\n", - "I_ON=V_o/R \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.3f V\" %V_or)\n", - "print(\"load power=%.1f W\" %P_o)\n", - "print(\"i/p pf=%.4f\" %pf)\n", - "print(\"avg i/p current=%.4f A\" %I_ON)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=224.716 V\n", - "load power=2524.9 W\n", - "i/p pf=0.9770\n", - "avg i/p current=-0.7581 A\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.2, Page No 560" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "V_or=(V_s)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "R=20\n", - "I_or=V_or/R\n", - "P_o=I_or**2*R \n", - "I_s=I_or\n", - "VA=V_s*I_s\n", - "pf=P_o/VA \n", - "I_TA=math.sqrt(2)*V_s/(2*math.pi*R)*(math.cos(math.radians(a))+1) \n", - "I_Tr=math.sqrt(2)*V_s/(2*R)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.3f V\" %V_or)\n", - "print(\"load power=%.2f W\" %P_o)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"avg thyristor current=%.2f A\" %I_TA) \n", - "print(\"rms value of thyristor current=%.2f A\" %I_Tr)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=219.304 V\n", - "load power=2404.71 W\n", - "i/p pf=0.95\n", - "avg thyristor current=4.42 A\n", - "rms value of thyristor current=7.75 A\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.3 Page No 564" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "n=6.0 #on cycles\n", - "m=4.0 #off cycles\n", - "\n", - "#Calculations\n", - "k=n/(n+m)\n", - "V_or=V_s*math.sqrt(k) \n", - "pf=math.sqrt(k) \n", - "R=15\n", - "I_m=V_s*math.sqrt(2)/R\n", - "I_TA=k*I_m/math.pi\n", - "I_TR=I_m*math.sqrt(k)/2 \n", - " \n", - "#Results\n", - "print(\"rms value of o/ voltage=%.2f V\" %V_or)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"avg thyristor current=%.2f A\" %I_TA) \n", - "print(\"rms value of thyristor current=%.2f A\" %I_TR)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/ voltage=178.16 V\n", - "i/p pf=0.77\n", - "avg thyristor current=4.14 A\n", - "rms value of thyristor current=8.40 A\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.4, Page No 569" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "I_TAM1=2*V_m/(2*math.pi*R) \n", - "I_TRM2=V_m/(2*R) \n", - "f=50\n", - "w=2*math.pi*f\n", - "t_c=math.pi/w \n", - " \n", - "#Results\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TAM1)\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TRM2)\n", - "print(\"ckt turn off time=%.0f ms\" %(t_c*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max value of avg thyristor current=34.512 A\n", - "max value of avg thyristor current=54.212 A\n", - "ckt turn off time=10 ms\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.5 Page No 575" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=3.0\n", - "X_L=4.0\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(X_L/R)) \n", - "V_s=230\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_s/Z \n", - "P=I_or**2*R \n", - "I_s=I_or\n", - "pf=P/(V_s*I_s) \n", - "I_TAM=math.sqrt(2)*V_s/(math.pi*Z) \n", - "I_Tm=math.sqrt(2)*V_s/(2*Z) \n", - "f=50\n", - "w=2*math.pi*f\n", - "di=math.sqrt(2)*V_s*w/Z \n", - "\n", - "#Results\n", - "print(\"min firing angle=%.2f deg\" %phi)\n", - "print(\"\\nmax firing angle=%.0f deg\" %180)\n", - "print(\"i/p pf=%.1f\" %pf)\n", - "print(\"max value of rms load current=%.0f A\" %I_or)\n", - "print(\"max power=%.0f W\" %P)\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TAM)\n", - "print(\"max value of rms thyristor current=%.3f A\" %I_Tm)\n", - "print(\"di/dt=%.0f A/s\" %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "min firing angle=53.13 deg\n", - "\n", - "max firing angle=180 deg\n", - "i/p pf=0.6\n", - "max value of rms load current=46 A\n", - "max power=6348 W\n", - "max value of avg thyristor current=20.707 A\n", - "max value of rms thyristor current=32.527 A\n", - "di/dt=20437 A/s\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.6 Page No 576" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "R=3.0 #ohm\n", - "X_L=5.0 #ohm\n", - "a=120.0 #firing angle delay\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(X_L/R))\n", - "b=0\n", - "i=1\n", - "while (i>0) :\n", - " LHS=math.sin(math.radians(b-a))\n", - " RHS=math.sin(math.radians(a-phi))*math.exp(-(R/X_L)*(b-a)*math.pi/180)\n", - " if math.fabs(LHS-RHS)<= 0.01 :\n", - " B=b\n", - " i=2\n", - " break\n", - " \n", - " b=b+.1 \n", - "V_or=math.sqrt(2)*V*math.sqrt((1/(2*math.pi))*((B-a)*math.pi/180+(math.sin(math.radians(2*a))-math.sin(math.radians(2*B)))/2))\n", - "\n", - "\n", - "#Results\n", - "print(\"Extinction angle=%.1f deg\" %B) #answer in the book is wrong as formulae for RHS is wrongly employed\n", - "print(\"rms value of output voltage=%.2f V\" %V_or) #answer do not match due to wrong B in book\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Extinction angle=156.1 deg\n", - "rms value of output voltage=97.75 V\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.8, Page No 581" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=60.0\n", - "R=20.0\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt((V_m**2/(2*math.pi))*(a*math.pi/180-math.sin(math.radians(2*a))/2)+(2*V_m**2/(math.pi))*(math.pi-a*math.pi/180+math.sin(math.radians(2*a))/2)) \n", - "I_T1r=(V_m/R)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "I_T3r=(V_m/(2*R))*math.sqrt(1/math.pi*((a*math.pi/180)-math.sin(math.radians(2*a))/2)) \n", - "I1=math.sqrt(2)*I_T1r\n", - "I3=math.sqrt((math.sqrt(2)*I_T1r)**2+(math.sqrt(2)*I_T3r)**2)\n", - "r=V_s*(I1+I3) \n", - "P_o=V_or**2/R\n", - "pf=P_o/r \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "print(\"rms value of current for upper thyristors=%.2f A\" %I_T1r)\n", - "print(\"rms value of current for lower thyristors=%.2f A\" %I_T3r)\n", - "print(\"t/f VA rating=%.2f VA\" %r)\n", - "print(\"i/p pf=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=424.94 V\n", - "rms value of current for upper thyristors=14.59 A\n", - "rms value of current for lower thyristors=3.60 A\n", - "t/f VA rating=9631.61 VA\n", - "i/p pf=0.94\n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter9_3.ipynb b/_Power_Electronics/Chapter9_3.ipynb deleted file mode 100755 index 052c4736..00000000 --- a/_Power_Electronics/Chapter9_3.ipynb +++ /dev/null @@ -1,388 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 09 : AC Voltage Controllers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.1, Page No 560" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "V_or=(V_m/2)*math.sqrt(1/math.pi*((2*math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "R=20\n", - "I_or=V_or/R\n", - "P_o=I_or**2*R \n", - "I_s=I_or\n", - "VA=V_s*I_s\n", - "pf=P_o/VA \n", - "V_o=math.sqrt(2)*V_s/(2*math.pi)*(math.cos(math.radians(a))-1)\n", - "I_ON=V_o/R \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.3f V\" %V_or)\n", - "print(\"load power=%.1f W\" %P_o)\n", - "print(\"i/p pf=%.4f\" %pf)\n", - "print(\"avg i/p current=%.4f A\" %I_ON)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=224.716 V\n", - "load power=2524.9 W\n", - "i/p pf=0.9770\n", - "avg i/p current=-0.7581 A\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.2, Page No 560" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "V_or=(V_s)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "R=20\n", - "I_or=V_or/R\n", - "P_o=I_or**2*R \n", - "I_s=I_or\n", - "VA=V_s*I_s\n", - "pf=P_o/VA \n", - "I_TA=math.sqrt(2)*V_s/(2*math.pi*R)*(math.cos(math.radians(a))+1) \n", - "I_Tr=math.sqrt(2)*V_s/(2*R)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.3f V\" %V_or)\n", - "print(\"load power=%.2f W\" %P_o)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"avg thyristor current=%.2f A\" %I_TA) \n", - "print(\"rms value of thyristor current=%.2f A\" %I_Tr)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=219.304 V\n", - "load power=2404.71 W\n", - "i/p pf=0.95\n", - "avg thyristor current=4.42 A\n", - "rms value of thyristor current=7.75 A\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.3 Page No 564" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "n=6.0 #on cycles\n", - "m=4.0 #off cycles\n", - "\n", - "#Calculations\n", - "k=n/(n+m)\n", - "V_or=V_s*math.sqrt(k) \n", - "pf=math.sqrt(k) \n", - "R=15\n", - "I_m=V_s*math.sqrt(2)/R\n", - "I_TA=k*I_m/math.pi\n", - "I_TR=I_m*math.sqrt(k)/2 \n", - " \n", - "#Results\n", - "print(\"rms value of o/ voltage=%.2f V\" %V_or)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"avg thyristor current=%.2f A\" %I_TA) \n", - "print(\"rms value of thyristor current=%.2f A\" %I_TR)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/ voltage=178.16 V\n", - "i/p pf=0.77\n", - "avg thyristor current=4.14 A\n", - "rms value of thyristor current=8.40 A\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.4, Page No 569" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "I_TAM1=2*V_m/(2*math.pi*R) \n", - "I_TRM2=V_m/(2*R) \n", - "f=50\n", - "w=2*math.pi*f\n", - "t_c=math.pi/w \n", - " \n", - "#Results\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TAM1)\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TRM2)\n", - "print(\"ckt turn off time=%.0f ms\" %(t_c*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max value of avg thyristor current=34.512 A\n", - "max value of avg thyristor current=54.212 A\n", - "ckt turn off time=10 ms\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.5 Page No 575" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=3.0\n", - "X_L=4.0\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(X_L/R)) \n", - "V_s=230\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_s/Z \n", - "P=I_or**2*R \n", - "I_s=I_or\n", - "pf=P/(V_s*I_s) \n", - "I_TAM=math.sqrt(2)*V_s/(math.pi*Z) \n", - "I_Tm=math.sqrt(2)*V_s/(2*Z) \n", - "f=50\n", - "w=2*math.pi*f\n", - "di=math.sqrt(2)*V_s*w/Z \n", - "\n", - "#Results\n", - "print(\"min firing angle=%.2f deg\" %phi)\n", - "print(\"\\nmax firing angle=%.0f deg\" %180)\n", - "print(\"i/p pf=%.1f\" %pf)\n", - "print(\"max value of rms load current=%.0f A\" %I_or)\n", - "print(\"max power=%.0f W\" %P)\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TAM)\n", - "print(\"max value of rms thyristor current=%.3f A\" %I_Tm)\n", - "print(\"di/dt=%.0f A/s\" %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "min firing angle=53.13 deg\n", - "\n", - "max firing angle=180 deg\n", - "i/p pf=0.6\n", - "max value of rms load current=46 A\n", - "max power=6348 W\n", - "max value of avg thyristor current=20.707 A\n", - "max value of rms thyristor current=32.527 A\n", - "di/dt=20437 A/s\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.6 Page No 576" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "R=3.0 #ohm\n", - "X_L=5.0 #ohm\n", - "a=120.0 #firing angle delay\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(X_L/R))\n", - "b=0\n", - "i=1\n", - "while (i>0) :\n", - " LHS=math.sin(math.radians(b-a))\n", - " RHS=math.sin(math.radians(a-phi))*math.exp(-(R/X_L)*(b-a)*math.pi/180)\n", - " if math.fabs(LHS-RHS)<= 0.01 :\n", - " B=b\n", - " i=2\n", - " break\n", - " \n", - " b=b+.1 \n", - "V_or=math.sqrt(2)*V*math.sqrt((1/(2*math.pi))*((B-a)*math.pi/180+(math.sin(math.radians(2*a))-math.sin(math.radians(2*B)))/2))\n", - "\n", - "\n", - "#Results\n", - "print(\"Extinction angle=%.1f deg\" %B) #answer in the book is wrong as formulae for RHS is wrongly employed\n", - "print(\"rms value of output voltage=%.2f V\" %V_or) #answer do not match due to wrong B in book\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Extinction angle=156.1 deg\n", - "rms value of output voltage=97.75 V\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.8, Page No 581" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=60.0\n", - "R=20.0\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt((V_m**2/(2*math.pi))*(a*math.pi/180-math.sin(math.radians(2*a))/2)+(2*V_m**2/(math.pi))*(math.pi-a*math.pi/180+math.sin(math.radians(2*a))/2)) \n", - "I_T1r=(V_m/R)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "I_T3r=(V_m/(2*R))*math.sqrt(1/math.pi*((a*math.pi/180)-math.sin(math.radians(2*a))/2)) \n", - "I1=math.sqrt(2)*I_T1r\n", - "I3=math.sqrt((math.sqrt(2)*I_T1r)**2+(math.sqrt(2)*I_T3r)**2)\n", - "r=V_s*(I1+I3) \n", - "P_o=V_or**2/R\n", - "pf=P_o/r \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "print(\"rms value of current for upper thyristors=%.2f A\" %I_T1r)\n", - "print(\"rms value of current for lower thyristors=%.2f A\" %I_T3r)\n", - "print(\"t/f VA rating=%.2f VA\" %r)\n", - "print(\"i/p pf=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=424.94 V\n", - "rms value of current for upper thyristors=14.59 A\n", - "rms value of current for lower thyristors=3.60 A\n", - "t/f VA rating=9631.61 VA\n", - "i/p pf=0.94\n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/Chapter9_4.ipynb b/_Power_Electronics/Chapter9_4.ipynb deleted file mode 100755 index 052c4736..00000000 --- a/_Power_Electronics/Chapter9_4.ipynb +++ /dev/null @@ -1,388 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 09 : AC Voltage Controllers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.1, Page No 560" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "V_or=(V_m/2)*math.sqrt(1/math.pi*((2*math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "R=20\n", - "I_or=V_or/R\n", - "P_o=I_or**2*R \n", - "I_s=I_or\n", - "VA=V_s*I_s\n", - "pf=P_o/VA \n", - "V_o=math.sqrt(2)*V_s/(2*math.pi)*(math.cos(math.radians(a))-1)\n", - "I_ON=V_o/R \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.3f V\" %V_or)\n", - "print(\"load power=%.1f W\" %P_o)\n", - "print(\"i/p pf=%.4f\" %pf)\n", - "print(\"avg i/p current=%.4f A\" %I_ON)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=224.716 V\n", - "load power=2524.9 W\n", - "i/p pf=0.9770\n", - "avg i/p current=-0.7581 A\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.2, Page No 560" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=45.0\n", - "\n", - "#Calculations\n", - "V_or=(V_s)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "R=20\n", - "I_or=V_or/R\n", - "P_o=I_or**2*R \n", - "I_s=I_or\n", - "VA=V_s*I_s\n", - "pf=P_o/VA \n", - "I_TA=math.sqrt(2)*V_s/(2*math.pi*R)*(math.cos(math.radians(a))+1) \n", - "I_Tr=math.sqrt(2)*V_s/(2*R)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.3f V\" %V_or)\n", - "print(\"load power=%.2f W\" %P_o)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"avg thyristor current=%.2f A\" %I_TA) \n", - "print(\"rms value of thyristor current=%.2f A\" %I_Tr)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=219.304 V\n", - "load power=2404.71 W\n", - "i/p pf=0.95\n", - "avg thyristor current=4.42 A\n", - "rms value of thyristor current=7.75 A\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.3 Page No 564" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "n=6.0 #on cycles\n", - "m=4.0 #off cycles\n", - "\n", - "#Calculations\n", - "k=n/(n+m)\n", - "V_or=V_s*math.sqrt(k) \n", - "pf=math.sqrt(k) \n", - "R=15\n", - "I_m=V_s*math.sqrt(2)/R\n", - "I_TA=k*I_m/math.pi\n", - "I_TR=I_m*math.sqrt(k)/2 \n", - " \n", - "#Results\n", - "print(\"rms value of o/ voltage=%.2f V\" %V_or)\n", - "print(\"i/p pf=%.2f\" %pf)\n", - "print(\"avg thyristor current=%.2f A\" %I_TA) \n", - "print(\"rms value of thyristor current=%.2f A\" %I_TR)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/ voltage=178.16 V\n", - "i/p pf=0.77\n", - "avg thyristor current=4.14 A\n", - "rms value of thyristor current=8.40 A\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.4, Page No 569" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "R=3.0\n", - "\n", - "#Calculations\n", - "I_TAM1=2*V_m/(2*math.pi*R) \n", - "I_TRM2=V_m/(2*R) \n", - "f=50\n", - "w=2*math.pi*f\n", - "t_c=math.pi/w \n", - " \n", - "#Results\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TAM1)\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TRM2)\n", - "print(\"ckt turn off time=%.0f ms\" %(t_c*1000))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "max value of avg thyristor current=34.512 A\n", - "max value of avg thyristor current=54.212 A\n", - "ckt turn off time=10 ms\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.5 Page No 575" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "R=3.0\n", - "X_L=4.0\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(X_L/R)) \n", - "V_s=230\n", - "Z=math.sqrt(R**2+X_L**2)\n", - "I_or=V_s/Z \n", - "P=I_or**2*R \n", - "I_s=I_or\n", - "pf=P/(V_s*I_s) \n", - "I_TAM=math.sqrt(2)*V_s/(math.pi*Z) \n", - "I_Tm=math.sqrt(2)*V_s/(2*Z) \n", - "f=50\n", - "w=2*math.pi*f\n", - "di=math.sqrt(2)*V_s*w/Z \n", - "\n", - "#Results\n", - "print(\"min firing angle=%.2f deg\" %phi)\n", - "print(\"\\nmax firing angle=%.0f deg\" %180)\n", - "print(\"i/p pf=%.1f\" %pf)\n", - "print(\"max value of rms load current=%.0f A\" %I_or)\n", - "print(\"max power=%.0f W\" %P)\n", - "print(\"max value of avg thyristor current=%.3f A\" %I_TAM)\n", - "print(\"max value of rms thyristor current=%.3f A\" %I_Tm)\n", - "print(\"di/dt=%.0f A/s\" %di)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "min firing angle=53.13 deg\n", - "\n", - "max firing angle=180 deg\n", - "i/p pf=0.6\n", - "max value of rms load current=46 A\n", - "max power=6348 W\n", - "max value of avg thyristor current=20.707 A\n", - "max value of rms thyristor current=32.527 A\n", - "di/dt=20437 A/s\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.6 Page No 576" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V=230.0\n", - "R=3.0 #ohm\n", - "X_L=5.0 #ohm\n", - "a=120.0 #firing angle delay\n", - "\n", - "#Calculations\n", - "phi=math.degrees(math.atan(X_L/R))\n", - "b=0\n", - "i=1\n", - "while (i>0) :\n", - " LHS=math.sin(math.radians(b-a))\n", - " RHS=math.sin(math.radians(a-phi))*math.exp(-(R/X_L)*(b-a)*math.pi/180)\n", - " if math.fabs(LHS-RHS)<= 0.01 :\n", - " B=b\n", - " i=2\n", - " break\n", - " \n", - " b=b+.1 \n", - "V_or=math.sqrt(2)*V*math.sqrt((1/(2*math.pi))*((B-a)*math.pi/180+(math.sin(math.radians(2*a))-math.sin(math.radians(2*B)))/2))\n", - "\n", - "\n", - "#Results\n", - "print(\"Extinction angle=%.1f deg\" %B) #answer in the book is wrong as formulae for RHS is wrongly employed\n", - "print(\"rms value of output voltage=%.2f V\" %V_or) #answer do not match due to wrong B in book\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Extinction angle=156.1 deg\n", - "rms value of output voltage=97.75 V\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 9.8, Page No 581" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#initialisation of variables\n", - "V_s=230.0\n", - "V_m=math.sqrt(2)*V_s\n", - "a=60.0\n", - "R=20.0\n", - "\n", - "#Calculations\n", - "V_or=math.sqrt((V_m**2/(2*math.pi))*(a*math.pi/180-math.sin(math.radians(2*a))/2)+(2*V_m**2/(math.pi))*(math.pi-a*math.pi/180+math.sin(math.radians(2*a))/2)) \n", - "I_T1r=(V_m/R)*math.sqrt(1/math.pi*((math.pi-a*math.pi/180)+math.sin(math.radians(2*a))/2)) \n", - "I_T3r=(V_m/(2*R))*math.sqrt(1/math.pi*((a*math.pi/180)-math.sin(math.radians(2*a))/2)) \n", - "I1=math.sqrt(2)*I_T1r\n", - "I3=math.sqrt((math.sqrt(2)*I_T1r)**2+(math.sqrt(2)*I_T3r)**2)\n", - "r=V_s*(I1+I3) \n", - "P_o=V_or**2/R\n", - "pf=P_o/r \n", - "\n", - "#Results\n", - "print(\"rms value of o/p voltage=%.2f V\" %V_or)\n", - "print(\"rms value of current for upper thyristors=%.2f A\" %I_T1r)\n", - "print(\"rms value of current for lower thyristors=%.2f A\" %I_T3r)\n", - "print(\"t/f VA rating=%.2f VA\" %r)\n", - "print(\"i/p pf=%.2f\" %pf)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "rms value of o/p voltage=424.94 V\n", - "rms value of current for upper thyristors=14.59 A\n", - "rms value of current for lower thyristors=3.60 A\n", - "t/f VA rating=9631.61 VA\n", - "i/p pf=0.94\n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Power_Electronics/screenshots/Chapter2.png b/_Power_Electronics/screenshots/Chapter2.png deleted file mode 100755 index 9380fbcb..00000000 Binary files a/_Power_Electronics/screenshots/Chapter2.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter2_1.png b/_Power_Electronics/screenshots/Chapter2_1.png deleted file mode 100755 index 9380fbcb..00000000 Binary files a/_Power_Electronics/screenshots/Chapter2_1.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter2_2.png b/_Power_Electronics/screenshots/Chapter2_2.png deleted file mode 100755 index 9380fbcb..00000000 Binary files a/_Power_Electronics/screenshots/Chapter2_2.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter2_3.png b/_Power_Electronics/screenshots/Chapter2_3.png deleted file mode 100755 index 9380fbcb..00000000 Binary files a/_Power_Electronics/screenshots/Chapter2_3.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter2_4.png b/_Power_Electronics/screenshots/Chapter2_4.png deleted file mode 100755 index 9380fbcb..00000000 Binary files a/_Power_Electronics/screenshots/Chapter2_4.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter3.png b/_Power_Electronics/screenshots/Chapter3.png deleted file mode 100755 index cef740d3..00000000 Binary files a/_Power_Electronics/screenshots/Chapter3.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter3_1.png b/_Power_Electronics/screenshots/Chapter3_1.png deleted file mode 100755 index cef740d3..00000000 Binary files a/_Power_Electronics/screenshots/Chapter3_1.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter3_2.png b/_Power_Electronics/screenshots/Chapter3_2.png deleted file mode 100755 index cef740d3..00000000 Binary files a/_Power_Electronics/screenshots/Chapter3_2.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter3_3.png b/_Power_Electronics/screenshots/Chapter3_3.png deleted file mode 100755 index cef740d3..00000000 Binary files a/_Power_Electronics/screenshots/Chapter3_3.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter3_4.png b/_Power_Electronics/screenshots/Chapter3_4.png deleted file mode 100755 index cef740d3..00000000 Binary files a/_Power_Electronics/screenshots/Chapter3_4.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter4.png b/_Power_Electronics/screenshots/Chapter4.png deleted file mode 100755 index a1d64cf1..00000000 Binary files a/_Power_Electronics/screenshots/Chapter4.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter4_1.png b/_Power_Electronics/screenshots/Chapter4_1.png deleted file mode 100755 index a1d64cf1..00000000 Binary files a/_Power_Electronics/screenshots/Chapter4_1.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter4_2.png b/_Power_Electronics/screenshots/Chapter4_2.png deleted file mode 100755 index a1d64cf1..00000000 Binary files a/_Power_Electronics/screenshots/Chapter4_2.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter4_3.png b/_Power_Electronics/screenshots/Chapter4_3.png deleted file mode 100755 index a1d64cf1..00000000 Binary files a/_Power_Electronics/screenshots/Chapter4_3.png and /dev/null differ diff --git a/_Power_Electronics/screenshots/Chapter4_4.png b/_Power_Electronics/screenshots/Chapter4_4.png deleted file mode 100755 index a1d64cf1..00000000 Binary files a/_Power_Electronics/screenshots/Chapter4_4.png and /dev/null differ diff --git a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_10_SILICON_CONTROLLED_RECTIFIER.ipynb b/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_10_SILICON_CONTROLLED_RECTIFIER.ipynb deleted file mode 100755 index 6410798f..00000000 --- a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_10_SILICON_CONTROLLED_RECTIFIER.ipynb +++ /dev/null @@ -1,119 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 10 SILICON CONTROLLED RECTIFIER" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 10_2 pgno: 296" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 100000000000000 /cmˆ−3\n", - "Er = 11.9\n", - "e = 1.6e-19 columns\n", - "Eo = 8.854e-14 F/cm\n", - "W = 0.01 cm\n", - " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "Punch trough voltage ,Vpt=(e∗Nd∗Wˆ2)/(2∗E))= 759.282705628 V\n" - ] - } - ], - "source": [ - "#exa 10.2\n", - "Nd =10**14\n", - "print\"Nd = \",Nd,\" /cmˆ−3\" # initializing value of donor ion concentration .\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "W=100*10**-4\n", - "print\"W = \",W,\" cm\" # initializing value of width of SCR.\n", - "E=Eo*Er\n", - "print\" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation\n", - "Vpt=(e*Nd*W**2)/(2*E)\n", - "print\"Punch trough voltage ,Vpt=(e∗Nd∗Wˆ2)/(2∗E))=\",Vpt,\" V\"# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exmaple 10_3 pgno: 296" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Ia = 0.002 A\n", - "(ap+an) = 0.9\n", - "a = 0.45\n", - "Ico=Ia∗(1−(2∗an))= 0.0002 A\n", - "(da/dt)=1/2∗Ico∗((Ia)ˆ−2))= 25.0 /A\n" - ] - } - ], - "source": [ - "#exa 10.3\n", - "Ia =2e-3\n", - "print\"Ia = \",Ia,\" A\" # initializing value of forward current of thyrsistor .\n", - "x=0.9\n", - "print\"(ap+an) = \",x # initializing value of sum of current gain of n,ptype semiconductor [ value is get in by variable x,but represented on console window through ap +an ] .\n", - "a=0.45\n", - "print\"a = \",a # initializing value of current gain of both n,p type semiconductor (as it is assume that ap[current gain of n type semiconductor]=an[ current gain of ptype semiconductor ] in the question ) .\n", - "Ico=Ia*(1-(2*a))\n", - "print\"Ico=Ia∗(1−(2∗an))=\",Ico,\" A\" # calculation\n", - "y=1./2.*Ico*((Ia)**-2)\n", - "print\"(da/dt)=1/2∗Ico∗((Ia)ˆ−2))=\",y,\" /A\" # calculation\n", - "#The answer for (da/dt) after doing calculation is provided wrong in the book ." - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_1_CRYSTAL_STRUCTURES.ipynb b/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_1_CRYSTAL_STRUCTURES.ipynb deleted file mode 100755 index cd376de8..00000000 --- a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_1_CRYSTAL_STRUCTURES.ipynb +++ /dev/null @@ -1,677 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 1 CRYSTAL STRUCTURES" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1_4 pgno:10" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 1.0\n", - "r=a/2 = 0.5\n", - "Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= 0.523598775598\n", - "Total Volume of the cube ,V=aˆ3 = 1.0\n", - "Fp(S.C)=(v∗100/V)= 52.3598775598\n" - ] - } - ], - "source": [ - "#exa 1.4\n", - "from math import pi\n", - "a=1.\n", - "print \"a= \",a # initializing value of lattice constant(a)=1.\n", - "r=a/2.\n", - "print \"r=a/2 = \",r # initializing value of radius of atom for simple cubic .\n", - "v=((4*pi*(r**3))/3)\n", - "print \"Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= \",v # calcuation . \n", - "V=a**3\n", - "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(S.C)=(v∗100/V)= \",Fp,# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1_5 pgno:11" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 1.0\n", - "Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = 0.433012701892\n", - "Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = 0.680174761588\n", - "Total Volume of the cube ,V=aˆ3 = 1.0\n", - "Fp(B.C.C)=(v∗100/V)= 68.0174761588 %\n" - ] - } - ], - "source": [ - "#exa 1.5\n", - "from math import sqrt\n", - "a=1.\n", - "print \"a= \",a # initializing value of lattice constant(a)=1.\n", - "r=(sqrt(3)*(a**2/4))\n", - "print \"Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = \",r # initializing value of radius of atom for BCC.\n", - "v=((4*pi*(r**3))/3)*2\n", - "print \"Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = \",v # calcuation \n", - "V=a**3\n", - "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(B.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_6 pgno:12" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 1\n", - "Radius of the atom,r=(a/(2∗sqrt(2)))= 0.353553390593\n", - "Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= 0.740480489693\n", - "Total volume of the cube ,V=aˆ3= 2\n", - "Fp(F.C.C)=(v∗100/V)= 37.0240244847 %\n" - ] - } - ], - "source": [ - "#exa 1.6\n", - "a=1\n", - "print \"a= \",a # initializing value of lattice constant(a)=1.\n", - "r=(a/(2*sqrt(2)))\n", - "print \"Radius of the atom,r=(a/(2∗sqrt(2)))= \",r # initializing value of radius of atom for FCC .\n", - "v=(((4*pi*(r**3))/3)*4)\n", - "print \"Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= \",v # calcuation \n", - "V=a^3\n", - "print \"Total volume of the cube ,V=aˆ3= \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(F.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_8 pgno:14" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 1\n", - "Radius of the atom , r=(sqrt (3)∗a/8))= 0.216506350946\n", - "v=(((4∗pi∗(rˆ3))/3)∗8) = 0.340087380794\n", - "V=aˆ3= 2\n", - "Fp(Diamond)=(v∗100/V) = 17.0043690397 %\n" - ] - } - ], - "source": [ - "#Exa 1.8 \n", - "a=1\n", - "print \"a= \",a # initializing value of lattice constant(a)=1.\n", - "r=((sqrt(3)*a/8))\n", - "print \"Radius of the atom , r=(sqrt (3)∗a/8))= \",r # initializing value of radius of atom for diamond .\n", - "v=(((4*pi*(r**3))/3)*8)\n", - "print \"v=(((4∗pi∗(rˆ3))/3)∗8) = \",v # calcuation .\n", - "V=a^3\n", - "print \"V=aˆ3= \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(Diamond)=(v∗100/V) = \",Fp,\"%\" # calculation\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_9 pgno:14" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a = 5e-08 cm\n", - "Radius of the atom,r=(sqrt(3)∗(a/4))= 2.16506350946e-08\n", - "Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= 8.50218451985e-23\n", - "Total Volume of the cube ,V=aˆ3 = 1.25e-22\n", - "Fp(B.C.C)=(v∗100/V) = 68.0174761588 %\n" - ] - } - ], - "source": [ - "#exa 1.9\n", - "a=5*10**-8\n", - "print \"a = \",a,\" cm\" # initializing value of lattice constant .\n", - "r=(sqrt(3)*(a/4))\n", - "print \"Radius of the atom,r=(sqrt(3)∗(a/4))= \",r # initializing value of radius of atom for BCC.\n", - "v=((4*pi*(r**3))/3)*2\n", - "print \"Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= \",v # calcuation .\n", - "V=a**3\n", - "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(B.C.C)=(v∗100/V) = \",Fp,\"%\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_10 pgno:" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x intercept = 1\n", - "y intercept = inf\n", - "z intercept = inf\n", - "miller indices ,h=(1/x )= [1]\n", - "k=(1/y)= [0.0]\n", - "l=(1/z) = [0.0]\n" - ] - } - ], - "source": [ - "#exa 1.10\n", - "x=1\n", - "print \"x intercept = \",x # initializing value of x intercept .\n", - "y=float('inf')\n", - "print \"y intercept = \",y # initializing value of y intercept .\n", - "z=float('inf')\n", - "print \"z intercept = \",z # initializing value of z intercept .\n", - "h=[1/x]\n", - "print \"miller indices ,h=(1/x )= \",h # calculation\n", - "k=[1/y]\n", - "print \"k=(1/y)= \",k # calculation\n", - "l=[1/z]\n", - "print \"l=(1/z) = \",l # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_11 pgno:15" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x intercept = inf\n", - "y intercept = inf\n", - "z intercept = 1\n", - "miller indices ,h=[1/x] = [0.0]\n", - "k=[1/y] = [0.0]\n", - "l=[1/z] = [1]\n" - ] - } - ], - "source": [ - "#exa 1.11\n", - "x=float('inf')\n", - "print \"x intercept = \",x # initializing of x intercept .\n", - "y=float('inf') \n", - "print\"y intercept = \",y # initializing of Y intercept .\n", - "z=1\n", - "print \"z intercept = \",z # initializing of Z intercept .\n", - "h=[1/x]\n", - "print \"miller indices ,h=[1/x] = \",h # calculation\n", - "k=[1/y]\n", - "print \"k=[1/y] = \",k # calculation \n", - "l=[1/z]\n", - "print \"l=[1/z] = \",l # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_12 pgno: 16" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x intercept = inf\n", - "y intercept = 1\n", - "z intercept = inf\n", - "miller indices ,h=[1/x] = [0.0]\n", - "k=[1/y] = [1]\n", - "l=[1/z] = [0.0]\n" - ] - } - ], - "source": [ - "#exa 1.12\n", - "x=float('inf') \n", - "print \"x intercept = \",x # initializing of X intercept .\n", - "y=1\n", - "print \"y intercept = \",y # initializing of X intercept .\n", - "z=float('inf') \n", - "print \"z intercept = \",z # initializing of X intercept .\n", - "h=[1/x]\n", - "print \"miller indices ,h=[1/x] = \",h # calculation\n", - "k=[1/y]\n", - "print \"k=[1/y] = \",k # calculation \n", - "l=[1/z]\n", - "print \"l=[1/z] = \",l #calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_13 pgno:16" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x intercept = 1\n", - "y intercept = 1\n", - "z intercept = inf\n", - "miller indices ,h=[1/x] = [1]\n", - "k=[1/y] = [1]\n", - "l=[1/z] = [0.0]\n" - ] - } - ], - "source": [ - "#exa 1.13\n", - "x=1\n", - "print \"x intercept = \",x # initializing of X intercept .\n", - "y=1\n", - "print \"y intercept = \",y # initializing of X intercept .\n", - "z=float('inf') \n", - "print \"z intercept = \",z # initializing of X intercept .\n", - "h=[1/x]\n", - "print \"miller indices ,h=[1/x] = \",h # calculation\n", - "k=[1/y]\n", - "print \"k=[1/y] = \",k # calculation \n", - "l=[1/z]\n", - "print \"l=[1/z] = \",l #calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_14 pgno:17" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x intercept = inf\n", - "y intercept = 1\n", - "z intercept = 1\n", - "miller indices ,h=[1/x] = [0.0]\n", - "k=[1/y] = [1]\n", - "l=[1/z] = [1]\n" - ] - } - ], - "source": [ - "#exa 1.14\n", - "x=float('inf') \n", - "print \"x intercept = \",x # initializing of X intercept .\n", - "y=1\n", - "print \"y intercept = \",y # initializing of X intercept .\n", - "z=1\n", - "print \"z intercept = \",z # initializing of X intercept .\n", - "h=[1/x]\n", - "print \"miller indices ,h=[1/x] = \",h # calculation\n", - "k=[1/y]\n", - "print \"k=[1/y] = \",k # calculation \n", - "l=[1/z]\n", - "print \"l=[1/z] = \",l #calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_15 pgno:18" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x intercept = 2\n", - "y intercept = 2\n", - "z intercept = 2\n", - "common factor of all the intercept= 2\n", - "miller indices ,h=[c/x] = [1]\n", - "k=[c/y] = [1]\n", - "l=[c/z] = [1]\n" - ] - } - ], - "source": [ - "x=2\n", - "print \"x intercept = \",x # initializing of X intercept .\n", - "y=2\n", - "print \"y intercept = \",y # initializing of X intercept .\n", - "z=2\n", - "print \"z intercept = \",z # initializing of X intercept .\n", - "c=2\n", - "print \"common factor of all the intercept= \",c # initializing value of common factor of all the intercepts .\n", - "h=[c/x]\n", - "print \"miller indices ,h=[c/x] = \",h # calculation\n", - "k=[c/y]\n", - "print \"k=[c/y] = \",k # calculation \n", - "l=[c/z]\n", - "print \"l=[c/z] = \",l #calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_16 pgno: 18" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Wa = 28.1\n", - "D = 2.33 ram/cmˆ3\n", - "Na = 6.02e+23 atoms/mole\n", - "na =(Na∗D)/(Wa)= 4.99167259786e+22 atoms/cmˆ3\n" - ] - } - ], - "source": [ - "#exa 1.16\n", - "Wa =28.1\n", - "print \"Wa = \",Wa # initializing value of atomic weight .\n", - "D=2.33\n", - "print \"D = \",D,\"ram/cmˆ3\" # initializing value of density .\n", - "Na=6.02*10**23\n", - "print \"Na = \",Na,\"atoms/mole\" # initializing value of avagadro number .\n", - "na =(Na*D)/(Wa)\n", - "print \"na =(Na∗D)/(Wa)= \",na,\" atoms/cmˆ3\" # calculation\n", - "# the value of na (number of atoms in 1 cmˆ3 of silicon ) , provided after calculation in the book is wrong." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_17 pgno: 18" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 5e-08 cm\n", - "N= 2\n", - "V=aˆ3 = 1.25e-22 cmˆ3\n", - "na=(no.of atoms in unit cell/Volume of theunit cell) =(N/(V))= 1.6e+22\n" - ] - } - ], - "source": [ - "#exa 1.17\n", - "a=5*10**-8\n", - "print \"a= \",a,\"cm\" # initializing value of lattice constant .\n", - "N=2\n", - "print \"N= \",N # initializing value of no. of atoms in unit cell .\n", - "V=a**3\n", - "print \"V=aˆ3 = \",V,\"cmˆ3\" # initializing value of total Volume of the unit cell.\n", - "na =(N/(V))\n", - "print \"na=(no.of atoms in unit cell/Volume of theunit cell) =(N/(V))= \",na # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_18 pgno: 18" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a = 5.43e-08 cm\n", - "N = 8\n", - "Number of atom in the cmˆ3,ns =(N/(aˆ3))= 4.99678310227e+22\n" - ] - } - ], - "source": [ - "#exa 1.18\n", - "a=5.43*10**-8\n", - "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n", - "N=8\n", - "print \"N = \",N # initializing value of no. of atoms in a unit cell .\n", - "ns =(N/(a**3))\n", - "print \"Number of atom in the cmˆ3,ns =(N/(aˆ3))= \",ns # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_19 pgno: 18" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a = 5.43e-08 cm\n", - "Wa = 28.1\n", - "Na = 6.02e+23\n", - "ns = 50000000000000000000000 atoms/cmˆ3\n", - "Density of silicon ,D =(ns∗Wa)/(Na)= 2.33388704319 gm/cmˆ2\n" - ] - } - ], - "source": [ - "#exa 1.19\n", - "a=5.43*10**-8\n", - "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n", - "Wa =28.1\n", - "print \"Wa = \",Wa # initializing value of atomic weight .\n", - "Na=6.02*10**23\n", - "print \"Na = \",Na # initializing value of avagdro number .\n", - "ns =5*10**22\n", - "print \"ns = \",ns,\"atoms/cmˆ3\" # initializing value of atoms/cmˆ3.\n", - "D =(ns*Wa)/(Na)\n", - "print \"Density of silicon ,D =(ns∗Wa)/(Na)= \",D,\" gm/cmˆ2\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_20 pgno: 19" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a = 4.75e-08 cm\n", - "N = 4\n", - "na =(N/(aˆ3))= 3.73232249599e+22\n" - ] - } - ], - "source": [ - "#exa 1.20\n", - "a=4.75*10**-8\n", - "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n", - "N=4\n", - "print \"N = \",N # initializing value of number of atoms in the unit cell .\n", - "na =(N/(a**3))\n", - "print \"na =(N/(aˆ3))=\",na # calculation" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_6_ELECTRICAL_BREAKDOWN_IN_PN_JUNCTIONS.ipynb b/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_6_ELECTRICAL_BREAKDOWN_IN_PN_JUNCTIONS.ipynb deleted file mode 100755 index 95315558..00000000 --- a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/Chapter_6_ELECTRICAL_BREAKDOWN_IN_PN_JUNCTIONS.ipynb +++ /dev/null @@ -1,991 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6 ELECTRICAL BREAKDOWN IN PN JUNCTIONS" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_2 pgno: 183" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "X1 = 4.13 eV\n", - "X2 = 4.07 eV\n", - "Eg1 = 0.7 eV\n", - "Eg2 = 1.43 F/cm\n", - "Nv1 = 6e+18 cmˆ−3\n", - "Nv2 = 7e+18 cmˆ−3\n", - "Vt = 0.0259 eV\n", - "e = 1.6e-19 columbs\n", - "no = 2.5e+13 cmˆ−3\n", - "Pp = 1e+17 cmˆ−3\n", - "Nd = 1e+17 cmˆ−3\n", - "np= 6250000000.0 cmˆ−3\n", - "delta Eg=(Eg2−Eg1)= 0.73 eV\n", - "delta Ec=(X1−X2)= 0.06 eV\n", - "delta  Ev=(delta  Eg−delta  Ec )= 0.67 eV\n", - "Vbi=((delta Ev∗1.6∗10ˆ−19)/(e))+((Vt∗log((Nv1∗Nd) /(np∗Nv2) ) ) )= 1.09563926875 V\n" - ] - } - ], - "source": [ - "#exa 6.2\n", - "from math import log\n", - "X1 =4.13\n", - "print\"X1 = \",X1,\" eV\" # initializing value of eldelta Ectron effinity of germanium.\n", - "X2 =4.07\n", - "print\"X2 = \",X2,\" eV\" # initializing value of electron effinity of gallium arsenide .\n", - "Eg1 =0.7\n", - "print\"Eg1 = \",Eg1,\" eV\" # initializing value of energy gap of germanium .\n", - "Eg2 =1.43\n", - "print\"Eg2 = \",Eg2,\" F/cm\" # initializing value of energy gap of gallium arsenide..\n", - "Nv1 =6e18\n", - "print\"Nv1 = \",Nv1,\" cmˆ−3\" # initializing value of density of states in Valence band,Nv for germanium .\n", - "Nv2 =7e18\n", - "print\"Nv2 = \",Nv2,\" cmˆ−3\" # initializing value of density of states in Valence band,Nv for galliminum arsenide .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing valueof thermal voltage . . . Vt = K∗T/e\n", - "e=1.6e-19\n", - "print\"e = \",e,\" columbs\" # initializing value of electronic charge .\n", - "no=2.5e13\n", - "print\"no = \",no,\" cmˆ−3\" # initializingvalue of intrinsic carrier concentration .\n", - "Pp=1e17\n", - "print\"Pp = \",Pp,\" cmˆ−3\" # initializing value of hole concentration on the depletion edge of the N region .\n", - "Nd=1e17\n", - "print\"Nd = \",Nd,\" cmˆ−3\" # initializing value of number of donor ions (which is equal to hole concentration on the depletion edge of the N region).\n", - "np=(no**2)/Pp\n", - "print\"np=\",np,\" cmˆ−3\"# calculation\n", - "delta_Eg=(Eg2-Eg1)\n", - "print\"delta Eg=(Eg2−Eg1)=\",delta_Eg,\" eV\"#calculation\n", - "delta_Ec=(X1-X2)\n", - "print\"delta Ec=(X1−X2)=\",delta_Ec,\" eV\"#calculation\n", - "delta_Ev=(delta_Eg-delta_Ec)\n", - "print\"delta  Ev=(delta  Eg−delta  Ec )=\",delta_Ev,\" eV\"# calculation\n", - "Vbi=((delta_Ev*1.6*10**-19)/(e))+((Vt*log((Nv1*Nd)/(np*Nv2))))\n", - "print\"Vbi=((delta Ev∗1.6∗10ˆ−19)/(e))+((Vt∗log((Nv1∗Nd) /(np∗Nv2) ) ) )=\",Vbi,\" V\"# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4 pgno: 184" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nc = 2.8e+19 cmˆ−3\n", - "k = -4e+15 cmˆ4Fˆ−2Vˆ−1\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "e = 1.6e-19 columns\n", - "Vt = 0.0259 eV\n", - "VBI = 0.3 V\n", - " total permittivity ,E=Eo∗Er = 1.053626e-12 F/cm \n", - "Nd=((−2)/(e∗E)∗(1/k)))= 2.96594806886e+15 cmˆ−3\n", - "Vn=(Vt∗( log (Nc/Nd) ) )= 0.237056563109 V\n", - "VBn=(VBI+Vn)= 0.537056563109 V\n" - ] - } - ], - "source": [ - "#exa 6.4\n", - "from math import log\n", - "Nc=2.8e19\n", - "print\"Nc = \",Nc,\" cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", - "k=-4e15\n", - "print\"k = \",k,\" cmˆ4Fˆ−2Vˆ−1\" # initializing value of slope of the (1/Cˆ2) versus V curve.\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854e-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of dielectric constant of free space.\n", - "e=1.6e-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "VBI=0.3\n", - "print\"VBI = \",VBI,\" V\" # initializing value of built in voltage .\n", - "E=Eo*Er\n", - "print\" total permittivity ,E=Eo∗Er =\",E,\" F/cm \"# calculation\n", - "Nd=((-2)/(e*E)*(1/k))\n", - "print\"Nd=((−2)/(e∗E)∗(1/k)))=\",Nd,\" cmˆ−3\" # c a l c u l a t i o n\n", - "Vn=(Vt*(log(Nc/Nd)))\n", - "print\"Vn=(Vt∗( log (Nc/Nd) ) )=\",Vn,\" V\"#calculation\n", - "VBn=(VBI+Vn)\n", - "print\"VBn=(VBI+Vn)=\",VBn,\" V\"# calculation\n", - "# taking ,... d(1/Cˆ2)/dV as k,... for simlification," - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_5 pgno: 184" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 2e+17 /cmˆ−3\n", - "Nc = 2.8e+19 /cmˆ−3\n", - "Js = 4e-05 A/cmˆ2\n", - "T = 300 K\n", - "R = 110 A/(K−cmˆ2)\n", - "Vt = 0.0259 eV\n", - "VBn = 0.679478119251 V\n", - "Vn = 0.127988538746 V\n", - "VBI=(VBn−Vn))= 0.551489580505 V\n" - ] - } - ], - "source": [ - "#exa 6.5\n", - "from math import log\n", - "Nd =2e17\n", - "print\"Nd = \",Nd,\"/cmˆ−3\" # initializing value of donor concentration .\n", - "Nc=2.8e19\n", - "print\"Nc = \",Nc,\"/cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", - "Js =40e-6\n", - "print\"Js = \",Js,\"A/cmˆ2\" # initializing value of saturation current density .\n", - "T=300\n", - "print\"T = \",T,\"K\" # initializing value of absolute temperature .\n", - "R=110\n", - "print\"R = \",R,\" A/(K−cmˆ2)\" #initializing value of richardson ’ s constant .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "VBn=(Vt*(log(R*T**2/Js)))\n", - "print\"VBn = \",VBn,\" V\" # calculation .\n", - "Vn=(Vt*(log(Nc/Nd)))\n", - "print\"Vn = \",Vn,\" V\" # calculation .\n", - "VBI=(VBn-Vn)\n", - "print\"VBI=(VBn−Vn))=\",VBI,\" V\"#calculation\n", - "#The value of Vn (after calculation ) is provided wrong in the book,due to which VBI also differ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_6 pgno: 186" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 200000000000000000 /cmˆ−3\n", - "Dp = 30 cmˆ2/s\n", - "Nc = 2.8e+19 /cmˆ−3\n", - "Js = 4e-05 A/cmˆ2\n", - "no = 15000000000.0 cmˆ−3\n", - "tp = 1e-06 s\n", - "T = 300 K\n", - "R = 110 A/(K−cmˆ2)\n", - "Vt = 0.0259 eV\n", - "e = 1.6e-19 columbs\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - " total permittivity ,E=Eo∗Er)= 1.053626e-12 F/cm\n", - "VBn = 0.679478119251 V\n", - "Vn = 0.127988538746 V\n", - "VBI=(VBn−Vn))= 0.551489580505 V\n", - "current density in a metal semiconductor junction ,W = 4.26124893939e-06 A\n", - "Diffusion length ,Lp=(sqrt(Dp∗tp)) = 0.00547722557505 cm\n", - " saturation hole current density , Jpo=(e∗Dp∗noˆ2) /(Lp∗Nd) ) = 9.85900603509e-13 A/cmˆ2\n" - ] - } - ], - "source": [ - "#exa 6.6\n", - "from math import sqrt\n", - "from math import log\n", - "Nd =2*10**17\n", - "print\"Nd = \",Nd,\" /cmˆ−3\" # initializing value of donor concentration .\n", - "Dp=30\n", - "print\"Dp = \",Dp,\" cmˆ2/s\" # initializing value of diffusion cofficient .\n", - "Nc=2.8*10**19\n", - "print\"Nc = \",Nc,\" /cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", - "Js =40*10**-6\n", - "print\"Js = \",Js, \"A/cmˆ2\" # initializing value of saturation current density .\n", - "no=1.5*10**10\n", - "print\"no = \",no,\" cmˆ−3\" # initializing value of intrinsic concentration of electrons .\n", - "tp=10**-6\n", - "print\"tp = \",tp,\" s\" # initializing value of hole life−time.\n", - "T=300\n", - "print\"T = \",T,\" K\" # initializing value of absolute temperature .\n", - "R=110\n", - "print\"R = \",R,\" A/(K−cmˆ2)\" #initializing value of richardson ’ s constant .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columbs\" # initializing value of charge of electrons .\n", - "Er=11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of dielectric constant of free space.\n", - "E=Eo*Er\n", - "print\" total permittivity ,E=Eo∗Er)=\",E,\" F/cm\"# calculation\n", - "VBn=(Vt*(log(R*T**2/Js)))\n", - "print\"VBn = \",VBn,\" V\" # calculation .\n", - "Vn=(Vt*(log(Nc/Nd)))\n", - "print\"Vn = \",Vn,\" V\" # calculation .\n", - "VBI=(VBn-Vn)\n", - "print\"VBI=(VBn−Vn))=\",VBI,\" V\"#calculation\n", - "W=(sqrt((E*VBI)/(e*Nd)))\n", - "print\"current density in a metal semiconductor junction ,W = \",W,\" A\" # calculation .\n", - "Lp=(sqrt(Dp*tp))\n", - "print\"Diffusion length ,Lp=(sqrt(Dp∗tp)) = \", Lp,\" cm\" # calculation .\n", - "Jpo=(e*Dp*no**2)/(Lp*Nd)\n", - "print\" saturation hole current density , Jpo=(e∗Dp∗noˆ2) /(Lp∗Nd) ) = \",Jpo,\" A/cmˆ2\" # calculation .\n", - "#The value of Vn (after calculation ) is provided wrong in the book,due to which VBI differ and due to VBI ,current density in a metal semiconductor junction (W) gets changed .\n", - "#The value of Jpo ( saturation hole current density ),after calculation is also provided wrong in the book .," - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_8 pgno:186" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "VBD = 20 V\n", - "e = 1.6e-19 columns\n", - " total permittivity ,E=Eo∗Er)= 1.053626e-12 F/cm\n", - "Emax = 500000 V/cm\n", - "ND=(Eo∗Er∗(Emaxˆ2))/(2∗e∗VBD)= 4.1157265625e+16 cmˆ−3\n" - ] - } - ], - "source": [ - "#exa 6.8\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "VBD =20\n", - "print\"VBD = \",VBD,\" V\" #initializing value of break down voltage .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "E=Eo*Er\n", - "print\" total permittivity ,E=Eo∗Er)=\",E,\" F/cm\"# calculation\n", - "Emax =5*10**5\n", - "print\"Emax = \",Emax,\" V/cm\" # initializing value of maximum critical electric field .\n", - "ND=(Eo*Er*(Emax**2))/(2*e*VBD)\n", - "print\"ND=(Eo∗Er∗(Emaxˆ2))/(2∗e∗VBD)=\",ND,\"cmˆ−3\"# calculation\n", - "#the formula given in the solution for VBD is somewhat written wrong.The correct formula is ( VBD=(E∗Emaxˆ2/2∗e∗ND)) ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_9 pgno: 187" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "e = 1.6e-19 columns\n", - "no = 15000000000.0 cmˆ−3\n", - "Nd= 1e+16 cmˆ−3\n", - "Emax = 200000.0 V/cm\n", - "Na= 1e+16 cmˆ−3\n", - "Vt = 0.0259 eV\n", - " total permittivity ,E=Eo∗Er)= 1.053626e-12 F/cm\n", - "VBI=(Vt∗(log(Na∗Nd/noˆ2))) = 0.694640354303 V\n", - "breakdown voltage for symetrical abrupt junction ,VBD+VBI=(E∗Emaxˆ2) /( e∗Nd) )= 26.34065 V\n", - "VBD=V−VBI = 25.6460096457 V\n" - ] - } - ], - "source": [ - "#exa 6.9\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", - "Eo=8.854e-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "e=1.6e-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "no=1.5e10\n", - "print\"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration of electrons .\n", - "Nd =1e16\n", - "print\"Nd=\",Nd,\" cmˆ−3\"#initializing the value of donor concentration .\n", - "Emax =2e5\n", - "print\"Emax = \",Emax,\" V/cm\" # initializing value of maximum critical electric field .\n", - "Na =1e16\n", - "print\"Na=\",Na,\" cmˆ−3\"# initializing the value of acceptor concentration .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "E=Eo*Er\n", - "print\" total permittivity ,E=Eo∗Er)=\",E,\" F/cm\"# calculation\n", - "VBI=(Vt*(log(Na*Nd/no**2)))\n", - "print\"VBI=(Vt∗(log(Na∗Nd/noˆ2))) = \",VBI,\" V\" # calculation .\n", - "V=(E*Emax**2)/(e*Nd)\n", - "print\"breakdown voltage for symetrical abrupt junction ,VBD+VBI=(E∗Emaxˆ2) /( e∗Nd) )=\",V,\"V\" # calculation \n", - "VBD=V-VBI\n", - "print\"VBD=V−VBI =\",VBD,\" V\"# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_10 pgno: 187" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "e = 1.6e-19 columns\n", - "no = 15000000000.0 cmˆ−3\n", - "Emax = 1000000 V/cm\n", - "Nd= 1000000000000000000 cmˆ−3\n", - "Na= 1000000000000000000 cmˆ−3\n", - "Vt = 0.0259 eV\n", - "VBI=(Vt∗(log(Na∗Nd/noˆ2))) = 0.933188169937 V\n", - " total permittivity ,E=Eo∗Er)= 1.053626e-12 F/cm 99\n", - "breakdown voltage for symetrical abrupt junction ,VBD+VBI=(E∗Emaxˆ2) /( e∗Nd) )= 6.5851625 V\n", - "VBD=V−VBI)= 5.65197433006 V\n" - ] - } - ], - "source": [ - "#exa 6.10\n", - "from math import log\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "no=1.5*10**10\n", - "print\"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration of electrons .\n", - "Emax=10**6\n", - "print\"Emax = \",Emax,\" V/cm\" # initializing value of maximum critical electric field ..\n", - "Nd =1*10**18\n", - "print\"Nd=\",Nd,\" cmˆ−3\"#initializing the value of donor concentration .\n", - "Na =1*10**18\n", - "print\"Na=\",Na,\" cmˆ−3\"# initializing the value of acceptor concentration .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "VBI=(Vt*(log(Na*Nd/no**2)))\n", - "print\"VBI=(Vt∗(log(Na∗Nd/noˆ2))) = \",VBI,\" V\" # calculation .\n", - "E=Eo*Er\n", - "print\" total permittivity ,E=Eo∗Er)=\",E,\" F/cm 99\"# calculation\n", - "V=(E*Emax**2)/(e*Nd)\n", - "print\"breakdown voltage for symetrical abrupt junction ,VBD+VBI=(E∗Emaxˆ2) /( e∗Nd) )=\",V,\"V\"# calculation\n", - "VBD=V-VBI\n", - "print\"VBD=V−VBI)=\",VBD,\" V\"# calculation" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 1e+18 cmˆ−3\n", - "Na = -1e+18 cmˆ3\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "e = 1.6e-19 columns\n", - "Vt = 0.0259 eV\n", - "Vbd = 15 eV\n", - "W = 0.0002 cm\n", - " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "slope of doping profile curve ,a=((Nd−Na)/(W))= 1e+22 cmˆ−4\n", - "Emax=(((Vbd)ˆ2)∗9∗e∗a/(32∗E))ˆ(1/3)= 1.0 V/cm\n" - ] - } - ], - "source": [ - "#exa 6.11\n", - "Nd =1e18\n", - "print\"Nd = \",Nd,\" cmˆ−3\" # initializing value of donor concentration .\n", - "Na = -1e18\n", - "print\"Na = \",Na,\" cmˆ3\" # initializing value of acceptor concentration .\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854e-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of dielectric constant of free space.\n", - "e=1.6e-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "Vbd=15\n", - "print\"Vbd = \",Vbd,\" eV\" # initializing value of break down voltage .\n", - "W=2e-4\n", - "print\"W = \",W,\" cm\" # initializing value of the distance over which doping profile varies.\n", - "E=Eo*Er\n", - "print\" total permittivity ,E=Eo∗Er=\",E,\" F/cm\"# calculation\n", - "a=((Nd-Na)/(W))\n", - "print\"slope of doping profile curve ,a=((Nd−Na)/(W))= \",a,\" cmˆ−4\"# calculation\n", - "Emax=(((Vbd)**2)*9*e*a/(32*E))**(1/3)\n", - "print\"Emax=(((Vbd)ˆ2)∗9∗e∗a/(32∗E))ˆ(1/3)=\",Emax,\" V/cm\"# calculation\n", - "## calculation was given wrong in the book" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_12 pgno: 188" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Ew = 4.55 V\n", - "X = 4.01 V\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "e = 1.6e-19 columns\n", - "Nc = 2.8e+19 /cmˆ−3\n", - "Nd = 100000000000000000 /cmˆ−3\n", - "Vt = 0.0259 eV\n", - " Barrier height ,VB=(Ew−X) = 0.54 V\n", - "Ec Ef=(Vt∗log(Nc/Nd))= 0.145941050722 V\n", - "VBI=(VB−(Ec  Ef ) )= 0.394058949278 V\n", - "Depletion width ,xn=sqrt(2∗Eo∗Er∗VBI/(e∗Nd))= 7.20408525154e-06 cm\n", - "maximum electric field ,Emax=(e∗Nd∗xn/(Eo∗Er))= 109398.746827 V/cm\n" - ] - } - ], - "source": [ - "#exa 6.12\n", - "from math import sqrt\n", - "from math import log\n", - "Ew =4.55\n", - "print\"Ew = \",Ew,\" V\" # initializing value of work function of tungusten .\n", - "X=4.01\n", - "print\"X = \",X,\"V\" # initializing value of electron effinity of silicon .\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "Nc=2.8*10**19\n", - "print\"Nc = \",Nc,\"/cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", - "Nd=10**17\n", - "print\"Nd = \",Nd,\"/cmˆ−3\" # initializing value of donor concentration .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "VB=(Ew-X)\n", - "print\" Barrier height ,VB=(Ew−X) = \",VB,\" V\" # calculation .\n", - "Ec_Ef=(Vt*log(Nc/Nd))\n", - "print\"Ec Ef=(Vt∗log(Nc/Nd))=\",Ec_Ef,\" V\"#calculation\n", - "VBI=(VB-(Ec_Ef))\n", - "print\"VBI=(VB−(Ec  Ef ) )=\",VBI,\" V\"# calculation\n", - "xn=sqrt(2*Eo*Er*VBI/(e*Nd))\n", - "print\"Depletion width ,xn=sqrt(2∗Eo∗Er∗VBI/(e∗Nd))=\",xn,\" cm\"# calculation\n", - "Emax=(e*Nd*xn/(Eo*Er))\n", - "print\"maximum electric field ,Emax=(e∗Nd∗xn/(Eo∗Er))=\",Emax,\" V/cm\"# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_13 pgno: 189" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Ew = 4.5 V\n", - "X = 4.01 V\n", - "Er = 12\n", - "Eo = 8.854e-14 F/cm\n", - "Vr = 3 V\n", - "e = 1.6e-19 columns\n", - "Nc = 2.8e+19 /cmˆ−3\n", - "Nd = 100000000000000000 /cmˆ−3\n", - "Vt = 0.0259 eV\n", - " barrier height ,VB=(Ew−X) = 0.49 V\n", - "Ec Ef=(Vt∗log(Nc/Nd))= 0.145941050722 V\n", - "VBI=(VB−(Ec  Ef ) )= 0.344058949278 V\n", - "Depletion width ,xn=sqrt(2∗Eo∗Er∗(VBI+Vr)/(e∗Nd))= 2.10742608187e-05 cm\n", - "maximum electric field ,Emax=(e∗Nd∗xn/(Eo∗Er))= 317359.548508 V/cm\n", - "Capitance per unit area ,C=sqrt (( e∗Eo∗Er∗Nd)/(2∗(VBI+Vr) ) )= 5.04160031586e-08 F/cmˆ2\n" - ] - } - ], - "source": [ - "#exa 6.13\n", - "from math import sqrt\n", - "from math import log\n", - "Ew =4.5\n", - "print\"Ew = \",Ew,\" V\" # initializing value of work function of tungusten .\n", - "X=4.01\n", - "print\"X = \",X,\"V\" # initializing value of electron effinity of silicon .\n", - "Er=12\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "Vr=3\n", - "print\"Vr = \",Vr,\" V\" # initializing value of reverse voltage .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "Nc=2.8*10**19\n", - "print\"Nc = \",Nc,\"/cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", - "Nd=10**17\n", - "print\"Nd = \",Nd,\"/cmˆ−3\" # initializing value of donor concentration .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "VB=(Ew-X)\n", - "print\" barrier height ,VB=(Ew−X) = \",VB,\" V\"# calculation .\n", - "Ec_Ef=(Vt*log(Nc/Nd))\n", - "print\"Ec Ef=(Vt∗log(Nc/Nd))=\",Ec_Ef,\" V\"#calculation\n", - "VBI=(VB-(Ec_Ef))\n", - "print\"VBI=(VB−(Ec  Ef ) )=\",VBI,\" V\"#calculation\n", - "xn=sqrt((2*Eo*Er*(VBI+Vr))/(e*Nd))\n", - "print\"Depletion width ,xn=sqrt(2∗Eo∗Er∗(VBI+Vr)/(e∗Nd))=\",xn,\" cm\"#calculation\n", - "Emax=(e*Nd*xn/(Eo*Er))\n", - "print\"maximum electric field ,Emax=(e∗Nd∗xn/(Eo∗Er))=\",Emax,\" V/cm\"# calculation\n", - "C=sqrt((e*Eo*Er*Nd)/(2*(VBI+Vr)))\n", - "print\"Capitance per unit area ,C=sqrt (( e∗Eo∗Er∗Nd)/(2∗(VBI+Vr) ) )=\",C,\" F/cmˆ2\"# calculation\n", - "#the Value of reverse voltage(Vr) provided in the question is different than used in the solution . I have used the value provided in the solution ( i . e Vr=3).\n", - "#the value of C (Capitance per unit area) after calculation is provided wrong in the book." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_13 pgno: 190" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Ew = 4.28 V\n", - "X = 4.01 V\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "e = 1.6e-19 columns\n", - "Nc = 2.8e+19 /cmˆ−3\n", - "Nd = 1000000000000000 /cmˆ−3\n", - "Vt = 0.0259 eV\n", - " barrier height ,VB=(Ew−X) = 0.27 V\n", - "Ec Ef=(Vt∗log(Nc/Nd))= 0.265214958539 V\n", - "VBI=(VB−(Ec  Ef ) )= 0.00478504146083 V\n", - "Depletion width ,xn=sqrt(2∗Eo∗Er∗VBI/(e∗Nd))= 7.93854843013e-06 cm\n", - "maximum electric field ,Emax=(e∗Nd∗xn/(Eo∗Er))= 1205.52050616 V/cm\n" - ] - } - ], - "source": [ - "#exa 6.14\n", - "from math import log\n", - "Ew =4.28\n", - "print\"Ew = \",Ew,\" V\" # initializing value of work function of tungusten .\n", - "X=4.01\n", - "print\"X = \",X,\"V\" # initializing value of electron effinity of silicon .\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "Nc=2.8*10**19\n", - "print\"Nc = \",Nc,\"/cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", - "Nd=10**15\n", - "print\"Nd = \",Nd,\"/cmˆ−3\" # initializing value of donor concentration .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "VB=(Ew-X)\n", - "print\" barrier height ,VB=(Ew−X) = \",VB,\" V\"# calculation .\n", - "Ec_Ef=(Vt*log(Nc/Nd))\n", - "print\"Ec Ef=(Vt∗log(Nc/Nd))=\",Ec_Ef,\" V\"#calculation\n", - "VBI=(VB-(Ec_Ef))\n", - "print\"VBI=(VB−(Ec  Ef ) )=\",VBI,\" V\"#calculation\n", - "xn=sqrt(2*Eo*Er*VBI/(e*Nd))\n", - "print\"Depletion width ,xn=sqrt(2∗Eo∗Er∗VBI/(e∗Nd))=\",xn,\" cm\"# calculation\n", - "Emax=(e*Nd*xn/(Eo*Er))\n", - "print\"maximum electric field ,Emax=(e∗Nd∗xn/(Eo∗Er))=\",Emax,\" V/cm\"# calculation\n", - "#the Value of donor concentration (Nd) provided in the question is different than used in the solution . I have used the value provided in the question(i.e Nd=10ˆ15). ,i.e answer differs than provided in the book ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_15 pgno: 191" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Ew = 5.1 V\n", - "X = 4.01 V\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "e = 1.6e-19 columns\n", - "Nc = 2.8e+19 /cmˆ−3\n", - "Nd = 5000000000000000 /cmˆ−3\n", - "Vt = 0.0259 eV\n", - "Vr = 5 V\n", - "A = 0.0001 cmˆ2\n", - " barrier height ,VB=(Ew−X) = 1.09 V\n", - "Ec Ef=(Vt∗log(Nc/Nd))= 0.223530516607 V\n", - "VBI=(VB−(Ec  Ef ) )= 0.866469483393 V\n", - "Capitance per unit area ,C1=sqrt (( e∗Eo∗Er∗Nd)/(2∗(VBI+Vr) ) )= 8.4758805431e-09 F/cmˆ2\n", - "total junction capatiance ,C=C1∗A= 8.4758805431e-13 F\n" - ] - } - ], - "source": [ - "#exa 6.15\n", - "from math import sqrt\n", - "from math import log\n", - "Ew =5.1\n", - "print\"Ew = \",Ew,\" V\" # initializing value of work function of tungusten .\n", - "X=4.01\n", - "print\"X = \",X,\"V\" # initializing value of electron effinity of silicon .\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "Nc=2.8*10**19\n", - "print\"Nc = \",Nc,\"/cmˆ−3\" # initializing value of effective density of state in the conduction band .\n", - "Nd =5*10**15\n", - "print\"Nd = \",Nd,\"/cmˆ−3\" # initializing value of donor concentration .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "Vr=5\n", - "print\"Vr = \",Vr,\" V\" # initializing value of reverse voltage .\n", - "A=1*10**-4\n", - "print\"A = \",A,\" cmˆ2\" # initializing valueof area of the gold silicon junction diode..\n", - "VB=(Ew-X)\n", - "print\" barrier height ,VB=(Ew−X) = \",VB,\" V\"# calculation .\n", - "Ec_Ef=(Vt*log(Nc/Nd))\n", - "print\"Ec Ef=(Vt∗log(Nc/Nd))=\",Ec_Ef,\" V\"#calculation\n", - "VBI=(VB-(Ec_Ef))\n", - "print\"VBI=(VB−(Ec  Ef ) )=\",VBI,\" V\"#calculation\n", - "C1=sqrt((e*Eo*Er*Nd)/(2*(VBI+Vr)))\n", - "print\"Capitance per unit area ,C1=sqrt (( e∗Eo∗Er∗Nd)/(2∗(VBI+Vr) ) )=\",C1,\" F/cmˆ2\"#calculation\n", - "C=C1*A\n", - "print\"total junction capatiance ,C=C1∗A=\",C,\"F\"# calculation" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Er = 13.1\n", - "Eo = 8.854e-14 F/cm\n", - "e = 1.6e-19 columns\n", - "Emax = 30000 V/cm\n", - " total permittivity ,E=Eo∗Er)= 1.159874e-12 F/cm\n", - "lowering of the barrier height ,V=sqrt(e∗Emax/(4∗pi∗E) )= 0.0181472273453 V\n", - " position of the maximum barrier height ,Xmax=sqrt(e/(16∗%pi∗E∗Emax))= 3.02453789089e-07 cm\n" - ] - } - ], - "source": [ - "#exa 6.17\n", - "from math import pi\n", - "from math import sqrt\n", - "Er =13.1\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant.\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "Emax =30*10**3\n", - "print\"Emax = \",Emax,\" V/cm\" # initializing value of maximum critical electric field ..\n", - "E=Eo*Er\n", - "print\" total permittivity ,E=Eo∗Er)=\",E,\" F/cm\"# calculation\n", - "V=sqrt(e*Emax/(4*pi*E))\n", - "print\"lowering of the barrier height ,V=sqrt(e∗Emax/(4∗pi∗E) )=\",V,\" V\"# calculation\n", - "Xmax=sqrt(e/(16*pi*E*Emax))\n", - "print\" position of the maximum barrier height ,Xmax=sqrt(e/(16∗%pi∗E∗Emax))=\",Xmax,\" cm\"# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_18 pgno: 192" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "A = 0.0001 cmˆ−2\n", - "VBn = 0.55 V\n", - "T = 300 K\n", - "R = 110 A/(K−cmˆ2)\n", - "Vt = 0.0259 eV\n", - "V = 0.25 V\n", - "reverse saturation current , Io=A∗R∗Tˆ2∗exp(−VBn/Vt) = 5.93151320618e-07 A\n", - "diode current , I=Io(exp(V/Vt)−1)= 0.00922931077027 A\n" - ] - } - ], - "source": [ - "#exa 6.18\n", - "from math import exp\n", - "A=10**-4\n", - "print\"A = \",A,\" cmˆ−2\" # initializing value of cross sectional area .\n", - "VBn =0.55\n", - "print\"VBn = \",VBn,\"V\" # initializing value of barrier height .\n", - "T=300\n", - "print\"T = \",T,\"K\" # initializing value of absolute temperature .\n", - "R=110\n", - "print\"R = \",R,\" A/(K−cmˆ2)\" #initializing value of richardson ’ s constant .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "V=0.25\n", - "print\"V = \",V,\" V\" # initializing value of forward bias voltage .\n", - "Io=A*R*T**2*exp(-VBn/Vt)\n", - "print\"reverse saturation current , Io=A∗R∗Tˆ2∗exp(−VBn/Vt) = \",Io,\" A\" # calculation .\n", - "I=Io*((exp(V/Vt))-1)\n", - "print\"diode current , I=Io(exp(V/Vt)−1)=\",I,\"A\"# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_19 pgno:192" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Io1 = 1e-09 A\n", - "Io2 = 1e-14 A\n", - "Vt = 0.0259 eV\n", - "I = 0.0001 A\n", - "forward Voltage for silicon SBD,VfSBD=Vt∗(( log(I/Io1+1)))= 0.298185028541 V\n", - "forward Voltage for silicon SBD,VfPN=Vt∗((log(I/Io2+1)))= 0.596369539088 V\n" - ] - } - ], - "source": [ - "#exa 6.19\n", - "from math import log\n", - "Io1 =10**-9\n", - "print\"Io1 = \",Io1,\" A\" # initializing value of reverse saturation current of silicon SBD.\n", - "Io2 =10**-14\n", - "print\"Io2 = \",Io2,\"A\" # initializing value of reverse saturation current of a PN junction .\n", - "Vt =0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "I=100*10**-6\n", - "print\"I = \",I,\" A\" # initializing value of required current .\n", - "VfSBD=Vt*((log(I/Io1+1)))\n", - "print\"forward Voltage for silicon SBD,VfSBD=Vt∗(( log(I/Io1+1)))= \",VfSBD,\" V\" # calculation\n", - "VfPN=Vt*((log(I/Io2+1)))\n", - "print\"forward Voltage for silicon SBD,VfPN=Vt∗((log(I/Io2+1)))=\",VfPN,\" V\"#calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_20 pgno: 193" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Io1 = 1e-06 A\n", - "Io2 = 1e-06 A\n", - "Vt = 0.0259 eV\n", - "I = 0.001 A\n", - "V = 0.25 V\n", - "forward Voltage for silicon SBD,VfSBD=Vt∗(( log(I/Io1+1)))= 0.178936748784 V\n", - "forward volage applied across the PN Diode ,VfPN=(V+VfSBD)= 0.428936748784 V\n", - "reverse saturation current of the PN junction Diode,Io=(I/((exp(VfPN/Vt))−1))= 6.41998882039e-11 A\n" - ] - } - ], - "source": [ - "#exa 6.20\n", - "from math import log\n", - "Io1 =10*10**-7\n", - "print\"Io1 = \",Io1,\" A\" # initializing value of reverse saturation current of silicon SBD.\n", - "Io2 =10*10**-7\n", - "print\"Io2 = \",Io2,\"A\" # initializing value of reverse saturation current of a PN junction .\n", - "Vt =0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "I=1*10**-3\n", - "print\"I = \",I,\" A\" # initializing value of forward current .\n", - "V=0.25\n", - "print\"V = \",V,\" V\" # initializing value of difference in the forward voltage of the two diode .\n", - "VfSBD=Vt*((log(I/Io1+1)))\n", - "print\"forward Voltage for silicon SBD,VfSBD=Vt∗(( log(I/Io1+1)))= \",VfSBD,\" V\" # calculation 109\n", - "VfPN=(V+VfSBD)\n", - "print\"forward volage applied across the PN Diode ,VfPN=(V+VfSBD)=\",VfPN,\" V\"#calculation \n", - "Io=(I/((exp(VfPN/Vt))-1))\n", - "print\"reverse saturation current of the PN junction Diode,Io=(I/((exp(VfPN/Vt))−1))=\",Io,\" A\" # calculation" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_2_ENERGY_BAND_THEORY_OF_SOLIDS.ipynb b/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_2_ENERGY_BAND_THEORY_OF_SOLIDS.ipynb deleted file mode 100755 index 7b0ddd98..00000000 --- a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_2_ENERGY_BAND_THEORY_OF_SOLIDS.ipynb +++ /dev/null @@ -1,998 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 2 ENERGY BAND THEORY OF SOLIDS" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_1 pgno:49" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "no = 15000000000.0 /cmˆ3\n", - "n = 1000000000000000000 /cmˆ3\n", - "number of holes ,p=(noˆ2/n))= 225.0 /cmˆ3\n" - ] - } - ], - "source": [ - "#exa 2.1\n", - "no=1.5*10**10\n", - "print \"no = \",no,\"/cmˆ3\" # initializing value of electrons and hole per cmˆ3.\n", - "n=1*10**18\n", - "print \"n = \",n,\"/cmˆ3\" # initializing value of number of electrons per cmˆ3.\n", - "p=(no**2/n)\n", - "print \"number of holes ,p=(noˆ2/n))= \",p,\" /cmˆ3\" # calculation\n", - "#this is solved problem 2.1 of chapter 2" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_2 pgno:49" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "n = 100000 /cmˆ3\n", - "p = 10000000000000000000 /cmˆ3\n", - "Value of intrinsic concentration ,no=sqrt(n∗p))= 1e+12 /cmˆ3\n" - ] - } - ], - "source": [ - "#exa 2.2\n", - "from math import sqrt\n", - "n=1*10**5\n", - "print\"n = \",n,\" /cmˆ3\" # initializing value of electrons and hole per cmˆ3.\n", - "p=1*10**19\n", - "print\"p = \",p,\" /cmˆ3\" # initializing value of number of hole per cmˆ3\n", - "no=sqrt(n*p)\n", - "print\"Value of intrinsic concentration ,no=sqrt(n∗p))= \",no,\" /cmˆ3\"# calculation\n", - "#this is solved problem 2.2 of chapter 2" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_3 pgno:49" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "e = 1.6e-19 columb\n", - "Ef−Efi = 0.309 eV\n", - "no = 2.5e+13 /cmˆ3\n", - "T = 300 K\n", - "exp = 2.718\n", - "k = ”,k,” J/K\n", - "number of electrons per cmˆ3, n=no∗(exˆ((Ef−Efi)/kT)))= 3.83494867662e+18 /cmˆ3\n" - ] - } - ], - "source": [ - "#exa 2.3\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\"columb\" # initializing the value of electronic charge .\n", - "Ef_Efi =0.309\n", - "print\"Ef−Efi = \",Ef_Efi,\" eV\" # initializing the value of difference in the energy levels .\n", - "no=2.5*10**13\n", - "print\"no = \",no,\" /cmˆ3\" # initializing value of number of electrons per cmˆ3\n", - "T=300\n", - "print\"T = \",T,\" K\" # initializing value of temperature .\n", - "ex=2.718\n", - "print\"exp = \",ex # initializing the value of exponential .\n", - "k=1.38*10**-23\n", - "print\"k = ”,k,” J/K\" # initializing value of boltzmann constant .\n", - "n=no*(ex**((Ef_Efi*e)/(k*T)))\n", - "print\"number of electrons per cmˆ3, n=no∗(exˆ((Ef−Efi)/kT)))= \",n,\" /cmˆ3\" #calculation\n", - "#This is solved problem 2.3 of chapter 2.\n", - "#The value used for ”Ef−Efi” in the solution is different than provided in the question .\n", - "#I have used the value provided in the solution ( i .e Ef Efi =0.309)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_4 pgno:50" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "e = 1.6e-19 columb\n", - "Ef = 0.4065 eV\n", - "n = 100000000000000000 /cmˆ3\n", - "T = 300 K\n", - "exp = 2.718\n", - "k = 1.38e-23 J/K\n", - "Number of electrons per cmˆ3, no=n/(exˆ((Ef)/kT) ) )= 15061844796.9 electrons /cmˆ3\n" - ] - } - ], - "source": [ - "#exa 2.4\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columb\" # initializing the value of electronic charge .\n", - "Ef =0.4065\n", - "print \"Ef = \",Ef,\" eV\" # initializing the value of fermi level .\n", - "n=10**17\n", - "print\"n = \",n,\" /cmˆ3\" # initializing value of number of electrons per cmˆ3.\n", - "T=300\n", - "print\"T = \",T,\" K\" # initializing value of temperature .\n", - "ex=2.718\n", - "print\"exp = \",ex # initializing the value of exponential .\n", - "k=1.38*10**-23\n", - "print\"k = \",k,\" J/K\" # initializing value of boltzmann constant .\n", - "no=n/(ex**((Ef*e)/(k*T)))\n", - "print\"Number of electrons per cmˆ3, no=n/(exˆ((Ef)/kT) ) )= \",no,\" electrons /cmˆ3\" # calculation\n", - "#this is solved problem 2.4 of chapter 2.\n", - "#the value used for \"n\" in the solution is different than provided in the question .\n", - "#I have used the value provided in the solution ( i .e n=10ˆ17)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_5 pgno:50" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "e = 1.6e-19 columb\n", - "n = 10000000000000000000000 /mˆ3\n", - "u = 0.12 mˆ2/Vs\n", - "L = 0.001 m\n", - "A = 1e-10 mˆ2\n", - " conductivity , sigma=n∗e∗u)= 192.0 siemen/m\n", - "Resistivity ,p=(1/sigma))= 0.00520833333333 ohm metre\n", - " resistance ,R=(p∗L/A) )= 52083.3333333 ohm\n" - ] - } - ], - "source": [ - "#exa 2.5\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\"columb\" # initializing the value of electronic charge .\n", - "n=1*10**22\n", - "print\"n = \",n,\" /mˆ3\" # initializing value of number of electrons per cmˆ3\n", - "u=1200*10**-4\n", - "print\"u = \",u,\" mˆ2/Vs\" # initializing the value of mobility .\n", - "L=0.1*10**-2\n", - "print\"L = \",L,\" m\" # initializing the value of length .\n", - "A=100*10**-12\n", - "print\"A = \",A,\" mˆ2\" # initializing the value of area of cross section .\n", - "sigma=n*e*u\n", - "print\" conductivity , sigma=n∗e∗u)= \",sigma,\"siemen/m\" # calculation .\n", - "p=(1/sigma)\n", - "print\"Resistivity ,p=(1/sigma))= \",p,\" ohm metre\"#calculation .\n", - "R=(p*L/A)\n", - "print\" resistance ,R=(p∗L/A) )= \",R,\" ohm\" #calculation .\n", - "#this is solved problem 2.5 of chapter 2.\n", - "#the value used for \"A\" in the solution is different than provided in the question .\n", - "#I have used the value provided in the solution ( i .e A=100∗10ˆ−12)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_6 pgno:50" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "R = 52080.0 ohm\n", - "V = 5 volt\n", - " Drift current , I=(V/R) )= 9.60061443932e-05 amphere\n" - ] - } - ], - "source": [ - "#exa 2.6\n", - "R=52.08*10**3\n", - "print\"R = \",R,\"ohm\" # initializing value of Resistance .\n", - "V=5\n", - "print\"V = \",V,\"volt\" # initializing value of voltage .\n", - "I=(V/R)\n", - "print\" Drift current , I=(V/R) )= \",I,\" amphere\" # calculation\n", - "#this is solved problem 2.6 of chapter 2." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_7 pgno:50" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " Energy gap of GaAs = 1.43 eV\n", - " Energy gap of GaP = 2.43 eV\n", - " Plank constant = 6.624e-34 joule \n", - " Light speed = 300000000 m/s\n", - "Difference between the energy gap of GaAs and GaP ,x=(Eg2−Eg1) )= 1.0 eV\n", - "Excess energy gap added to GaAs to form GaAsP,(0.4∗x))= 0.4 eV \n", - "Band gap energy GaAsP,Eg=(Eg1+g))= 1.83 eV \n", - "wavelength of radiation emitted , lamda=(c∗h/Eg))= 6.7868852459e-07 metre \n" - ] - } - ], - "source": [ - "#exa 2.7\n", - "Eg1 =1.43\n", - "print\" Energy gap of GaAs = \",Eg1,\"eV\" # initializing the value of energy gap of GaAs.\n", - "Eg2 =2.43\n", - "print\" Energy gap of GaP = \",Eg2,\"eV\"# initializing the value of energy gap of Gap.\n", - "h=6.624*10**-34\n", - "print\" Plank constant = \",h,\" joule \"# initializing the value of plank constant .\n", - "c=3*10**8\n", - "print\" Light speed = \",c,\"m/s\" # initializing the value of speed of light.\n", - "x=(Eg2-Eg1)\n", - "print\"Difference between the energy gap of GaAs and GaP ,x=(Eg2−Eg1) )= \",x,\" eV\"# calculation\n", - "g=(0.4*x)\n", - "print\"Excess energy gap added to GaAs to form GaAsP,(0.4∗x))= \",g,\" eV \"#calculation\n", - "Eg=(Eg1+g)\n", - "print\"Band gap energy GaAsP,Eg=(Eg1+g))= \",Eg ,\" eV \"#calculation\n", - "lamda=(c*h/(Eg*1.6*10**-19))\n", - "print\"wavelength of radiation emitted , lamda=(c∗h/Eg))= \",lamda,\" metre \"\n", - "# calculation 19 #this is solved problem 2.7 of chapter 2." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_8 pgno:51" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " Energy gap of GaAs = 1.43 eV\n", - " Energy gap of GaP = 2.43 eV\n", - " Plank constant = 6.624e-34 joule\n", - " Light speed = 300000000 m/s\n", - " lamda = 540000000 m\n", - "Difference between the energy gap of GaAs and GaP ,x=(Eg2−Eg1) )= 1.0 eV\n", - "Band gap energy ,Eg=(c∗h/lamda∗(1.6∗10ˆ−19)))= 2.3e-15 eV\n", - "X=Eg−(Eg1)= -1.43\n" - ] - } - ], - "source": [ - "#exa 2.8\n", - "Eg1 =1.43\n", - "print\" Energy gap of GaAs = \",Eg1,\" eV\" # initializing the value of energy gap of GaAs.\n", - "Eg2 =2.43\n", - "print\" Energy gap of GaP = \",Eg2,\" eV\"# initializing the value of energy gap of Gap.\n", - "h=6.624*10**-34\n", - "print\" Plank constant = \",h,\" joule\"# initializing the value of plank constant .\n", - "c=3*10**8\n", - "print\" Light speed = \",c,\" m/s\" # initializing the value of speed of light.\n", - "lamda =540*10**6\n", - "print\" lamda = \",lamda,\" m\" # initializing the value of wavelength .\n", - "x=(Eg2-Eg1)\n", - "print\"Difference between the energy gap of GaAs and GaP ,x=(Eg2−Eg1) )= \",x,\" eV\"# calculation\n", - "Eg=((c*h/(lamda*(1.6*10**-19))))\n", - "print\"Band gap energy ,Eg=(c∗h/lamda∗(1.6∗10ˆ−19)))=\",Eg,\" eV\"# calculation\n", - "X=Eg-(Eg1)\n", - "print\"X=Eg−(Eg1)= \",X # calculation \n", - "#this is solved problem 2.8 of chapter 2.\n", - "#the value of Eg(band gap energy )is provided wrong in the book after calculation.Due to this value ofX,alsodiffer." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_9 pgno:51" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " Temperature 1 = 500 K\n", - " Nv = 2e+19 cmˆ−3\n", - " Temperature 2 = 300 K\n", - "NV at 500K=(Nv((500/300) ˆ(3/2) ) ) )= 2e+19 cmˆ−3 \n" - ] - } - ], - "source": [ - "#exa 2.9\n", - "T1 =500\n", - "print\" Temperature 1 = \",T1,\"K\" # initializing the value of temperature 1.\n", - "Nv =2*10**19\n", - "print\" Nv = \",round(Nv,3),\"cmˆ−3\"# initializing the value of effective density of state for valence band .\n", - "T2 =300\n", - "print\" Temperature 2 = \",T2,\"K\"# initializing the value of temperature 2.\n", - "NV=(Nv*((500/300)**(3/2)))\n", - "print\"NV at 500K=(Nv((500/300) ˆ(3/2) ) ) )= \",round(NV,3),\" cmˆ−3 \"#calculation\n", - "#this is solved problem 2.9 of chapter 2." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_10 pgno:52" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 100000000000000000 cmˆ−3\n", - " Ec Ed = 0.045\n", - "Vt = 0.0259 eV \n", - " Nc = 2.8e+19 cmˆ−3\n", - "exp = 2.718\n", - "Fraction of electron still in the donor state,(nd/(nd+n)=(((Nc/Nd)∗eˆ((−Ec Ed)/Vt),1)ˆ−1)= 0.0198886296934\n" - ] - } - ], - "source": [ - "#exa 2.10\n", - "Nd =1*10**17\n", - "print\"Nd = \",Nd,\"cmˆ−3\" # initializing the value of effective energy density of state.\n", - "Ec_Ed =0.045\n", - "print\" Ec Ed = \",Ec_Ed # initializing the value of donor ionisation level .\n", - "Vt =0.0259\n", - "print\"Vt = \",Vt,\" eV \"# initializing the value of thermal voltage .\n", - "Nc=2.8*10**19\n", - "print\" Nc = \",Nc,\"cmˆ−3\"# initializing the value of effective density of state of conduction band .\n", - "e=2.718\n", - "print\"exp = \",e # initializing the value of exponential .\n", - "N=(((Nc/Nd)*e**((-(Ec_Ed))/Vt))+1)**-1\n", - "print \"Fraction of electron still in the donor state,(nd/(nd+n)=(((Nc/Nd)∗eˆ((−Ec Ed)/Vt),1)ˆ−1)= \",N # calculation\n", - "#this is solved problem 2.10 of chapter 2." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_11 pgno:52" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 10000000000000000 cmˆ−3\n", - "Ea Ev = 0.045\n", - "Nv = 1.04e+19 cmˆ−3\n", - "Vt = 0.0259 eV\n", - "Fraction of holes that are still in the acceptor state ,(pa/(pa+p))=(1+((Nv/4∗Na)∗exp(−(Ea −Ev)/Vt)))ˆ(−1)= 0.0213895767669\n" - ] - } - ], - "source": [ - "#exa 2.11\n", - "from math import exp\n", - "Na =1*10**16\n", - "print\"Na = \",Na,\" cmˆ−3\"# initializing the value of acceptor concentration \n", - "Ea_Ev =0.045\n", - "print\"Ea Ev = \",Ea_Ev # initializing the boron acceptor ionization energy .\n", - "Nv=(1.04*10**19)\n", - "print\"Nv = \",Nv,\" cmˆ−3\"# initializing the value of effective density of state for valence band .\n", - "Vt=(0.0259)\n", - "print\"Vt = \",Vt,\" eV\"# initializing the value of thermal voltage .\n", - "p=(1+((Nv/(4*Na))*exp(-(Ea_Ev)/Vt)))**(-1)\n", - "print\"Fraction of holes that are still in the acceptor state ,(pa/(pa+p))=(1+((Nv/4∗Na)∗exp(−(Ea −Ev)/Vt)))ˆ(−1)= \",p #calculation\n", - "#this is solved problem 2.11 of chapter 2" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_12 pgno:52" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 100000000000000000 cmˆ−3\n", - "Na = 0 cmˆ−3\n", - "ni = 15000000000.0 cmˆ−3\n", - "Electron concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= 1e+17 cmˆ−3\n", - "Hole concentration ,p)= 2250.0 cmˆ−3\n" - ] - } - ], - "source": [ - "#exa 2.12\n", - "Nd =1*10**17\n", - "print\"Nd = \",Nd,\" cmˆ−3\" # initializing the value of donor concentration .\n", - "Na=0\n", - "print\"Na = \",Na,\" cmˆ−3\"# initializing the value of acceptor concentration .\n", - "no=1.5*10**10\n", - "print\"ni = \",no,\" cmˆ−3\"# initializing the value of electron hole per cmˆ3.\n", - "n=(-(Na-Nd)+sqrt((Na-Nd)**2+4*no))/2\n", - "print\"Electron concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= \",n,\" cmˆ−3\"#calculation\n", - "p=(no**2/n)\n", - "print\"Hole concentration ,p)= \",p,\" cmˆ−3\" # calculation\n", - "#this is solved problem 2.13 of chapter 2." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_14 pgno:53" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 60000000000000000 cmˆ−3\n", - "Na = 100000000000000000 cmˆ−3\n", - "no = 15000000000.0 cmˆ−3\n", - "Hole concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= 4e+16 cmˆ−3\n", - "Electron concentration ,n=(noˆ2/p))= 5625.0\n" - ] - } - ], - "source": [ - "#exa 2.14\n", - "Nd =6*10**16\n", - "print\"Nd = \",Nd,\" cmˆ−3\" # initializing the value of donor concentration .\n", - "Na =10**17\n", - "print\"Na = \",Na,\" cmˆ−3\"# initializing the value of acceptor concentration .\n", - "no=1.5*10**10\n", - "print\"no = \",no,\" cmˆ−3\"# initializing the value of electron and hole per cmˆ3.\n", - "p=((Na-Nd)+sqrt((Na-Nd)**2+4*no))/2\n", - "print\"Hole concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= \",p,\" cmˆ−3\"#calculation\n", - "n=(no**2/p)\n", - "print \"Electron concentration ,n=(noˆ2/p))= \",n # calculation\n", - "#this is solved problem 2.14 of chapter 2.\n", - "#the value of Na,Nd in the solution is different than provided in the question\n", - "#I have used the value used in the solution(i.e Na=10ˆ17 ,Nd=6∗10ˆ16)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_15 pgno:53" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 60000000000000000 cmˆ−3\n", - "Na = 100000000000000000 cmˆ−3\n", - "no = 15000000000.0 cmˆ−3\n", - "Hole concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= 4e+16 cmˆ−3\n", - "Electron concentration ,n=(noˆ2/p))= 5625.0\n" - ] - } - ], - "source": [ - "#exa 2.15\n", - "Nd =6*10**16\n", - "print\"Nd = \",Nd,\" cmˆ−3\" # initializing the value of donor concentration .\n", - "Na =10**17\n", - "print\"Na = \",Na,\" cmˆ−3\"# initializing the value of acceptor concentration .\n", - "no=1.5*10**10\n", - "print\"no = \",no,\" cmˆ−3\"# initializing the value of electron and hole per cmˆ3.\n", - "p=((Na-Nd)+sqrt((Na-Nd)**2+4*no))/2\n", - "print\"Hole concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= \",p,\"cmˆ−3\"#calculation\n", - "n=(no**2/p)\n", - "print\"Electron concentration ,n=(noˆ2/p))= \",n # calculation\n", - "#this is solved problem 2.15 of chapter 2.\n", - "#the value of Na,Nd in the solution is different than provided in the question\n", - "#I have used the value used in the solution(i.e Na=10ˆ17 ,Nd=6∗10ˆ16)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_16 pgno:53" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nv = 1.04e+19 cmˆ−3\n", - "Ef Ev = 0.3 eV\n", - "T = 300 K\n", - "T = 500 K\n", - "Vt1 = 0.0259 eV\n", - "k = 1.38e-23 J/K\n", - "e = 1.6e-19 columb\n", - "Value of constant ,K1=(Nv/((T) ˆ(3/2) ) )= 3.46666666667e+16 cmˆ−3 K(−2/3)\n", - "Value of valence band concentration at 500K,Nv =K1∗T(3/2)= 1.73333333333e+19 cmˆ−3\n", - "Value of parameter VT at 500K,VT=(K∗T/e)= 0.043125 cmˆ−3\n", - "Hole concentration ,p=(Nv∗(exp(Ef Ev)/(VT)))= 1.65083278171e+16 cmˆ−3\n" - ] - } - ], - "source": [ - "#exa 2.16\n", - "from math import exp\n", - "Nv1 =1.04*10**19\n", - "print\"Nv = \",Nv1,\" cmˆ−3\"# initializing the value of valence band concentration at 300K.\n", - "Ef_Ev =0.3\n", - "print\"Ef Ev = \",Ef_Ev,\" eV\"# initializing the value of boron acceptor ionization energy.\n", - "T1 =300\n", - "print\"T = \",T1,\"K\"# initializing the value of temperature 1.\n", - "T2 =500\n", - "print\"T = \",T2,\"K\"# initializing the value of temperature 2.\n", - "Vt1 =0.0259\n", - "print\"Vt1 = \",Vt1,\"eV\"# initializing the value of thermal voltage at 300K.\n", - "k=1.38*10**-23\n", - "print\"k = \",k,\"J/K\" # initializing value of boltzmann constant .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\"columb\" # initializing the value of electronic charge .\n", - "K1=(Nv1/((T1)**(3/2)))\n", - "print\"Value of constant ,K1=(Nv/((T) ˆ(3/2) ) )= \",K1,\" cmˆ−3 K(−2/3)\"# calculation\n", - "Nv2=K1*T2**(3/2)\n", - "print\"Value of valence band concentration at 500K,Nv =K1∗T(3/2)= \",Nv2,\" cmˆ−3\"# calculation\n", - "VT=(k*T2/e)\n", - "print\"Value of parameter VT at 500K,VT=(K∗T/e)= \",VT,\" cmˆ−3\"# calculation\n", - "p=(Nv2*(exp(-(Ef_Ev)/(VT))))\n", - "print\"Hole concentration ,p=(Nv∗(exp(Ef Ev)/(VT)))= \",p,\" cmˆ−3\"# calculation\n", - "#this is solved problem 2.16 of chapter 2.\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_17 pgno:54" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nv = 7000000000000000000 cmˆ−3\n", - "Nc = 4.7e+17 cmˆ−3\n", - "T = 300 K\n", - "T = 450 K\n", - "Vt1 = 0.0259 eV\n", - "Vt2 = 0.03881 eV\n", - "Eg = 1.42 eV\n", - "intrinsic concentration at 300K,no=(sqrt(Nc∗Nv∗(exp(−Eg/Vt1))))= 2255422.87974\n", - "Value of constant ,K1=(Nc/((T) ˆ(3/2) ) )= 1.56666666667e+15\n", - "Value of constant k1 at 450K ,k1=(K1∗T2ˆ(3/2))= 7.05e+17\n", - "Value of constant ,K2=(Nv/((T1) ˆ(3/2) ) )= 23333333333333333\n", - "Value of constant k2 at 450K ,k2=(K2∗T2ˆ(3/2))= 10499999999999999850\n", - "Value of constant K,= 7.4025e+36\n", - "intrinsic concentration at 450K,no=(sqrt(K∗(exp(−Eg/Vt2) ) ) )= 30874193378.4 cmˆ3\n" - ] - } - ], - "source": [ - "#exa 2.17\n", - "from math import sqrt\n", - "Nv =7*10**18\n", - "print\"Nv = \",Nv,\"cmˆ−3\"# initializing the value of valence band concentration at 300K.\n", - "Nc=4.7*10**17\n", - "print\"Nc = \",Nc,\"cmˆ−3\"# initializing the value of conduction band concentration at 300K.\n", - "T1 =300\n", - "print\"T = \",T1,\"K\"# initializing the value of temperature 1.\n", - "T2 =450\n", - "print\"T = \",T2,\"K\"# initializing the value of temperature 2.\n", - "Vt1 =0.0259\n", - "print\"Vt1 = \",Vt1,\"eV\"# initializing the value of thermal voltage at 300K.\n", - "Vt2 =0.03881\n", - "print\"Vt2 = \",Vt2,\"eV\"# initializing the value of thermal voltage at 450K.\n", - "Eg=1.42\n", - "print\"Eg = \",Eg,\"eV\"# initializing the value of thermal voltage .\n", - "no=(sqrt(Nc*Nv*(exp(-Eg/Vt1))))\n", - "print\"intrinsic concentration at 300K,no=(sqrt(Nc∗Nv∗(exp(−Eg/Vt1))))= \",no #calculation\n", - "K1=(Nc/((T1)**(3/2)))\n", - "print\"Value of constant ,K1=(Nc/((T) ˆ(3/2) ) )= \",K1 # calculation\n", - "k1=(K1*T2**(3/2))\n", - "print\"Value of constant k1 at 450K ,k1=(K1∗T2ˆ(3/2))= \",k1# calculation\n", - "K2=(Nv/((T1)**(3/2)))\n", - "print\"Value of constant ,K2=(Nv/((T1) ˆ(3/2) ) )= \",K2# calculation\n", - "k2=(K2*T2**(3/2))\n", - "print\"Value of constant k2 at 450K ,k2=(K2∗T2ˆ(3/2))= \",k2 # calculation\n", - "K=k1*k2\n", - "print\"Value of constant K,= \",K # calculation\n", - "no1=(sqrt(K*(exp(-Eg/Vt2))))\n", - "print\"intrinsic concentration at 450K,no=(sqrt(K∗(exp(−Eg/Vt2) ) ) )= \",no1,\" cmˆ3\"# calculation\n", - "#this is solved problem 2.17 of chapter 2." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_18 pgno:55" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nv = 1.04e+19 cmˆ−3\n", - "Nc = 2.8e+19 cmˆ−3\n", - "T = 300 K\n", - "T = 550 K\n", - "Vt1 = 0.0259 eV\n", - "Vt2 = 0.0474 eV\n", - "Eg1 = 1.12 eV\n", - "intrinsic concentration at 300K,no=(sqrt(Nc∗Nv∗(exp(−Eg1/Vt1))))= 6949358641.26\n", - "Value of constant ,K1=(Nc/((T) ˆ(3/2) ) )= 9.3023255814e+16\n", - "Value of constant k1 at 550K ,k1=(K1∗T2ˆ(3/2))= 5.11627906977e+19\n", - "Value of constant ,K2=(Nv/((T1) ˆ(3/2) ) )= 3.46666666667e+16\n", - "Value of constant k2 at 550K ,k2=(K2∗T2ˆ(3/2))= 1.90666666667e+19\n", - "Value of constant K,= 9.75503875969e+38\n", - "Intrinsic concentration at 550K,no=(sqrt(K∗(exp(−Eg1/Vt2))))= 2.31051731905e+14 cmˆ3\n", - "Donor concentration at which intrinsic concentration is 10% of the total electron concentration ,Nd=(4∗(no1ˆ2) /(1.2) )= 1.77949676054e+29 cmˆ3\n" - ] - } - ], - "source": [ - "#exa 2.18\n", - "from math import sqrt\n", - "from math import exp\n", - "Nv=1.04*10**19\n", - "print\"Nv = \",Nv,\"cmˆ−3\"# initializing the value of valence band concentration at 300K.\n", - "Nc=2.8*10**19\n", - "print\"Nc = \",Nc,\"cmˆ−3\"# initializing the value of conduction band concentration at 300K.\n", - "T1 =300\n", - "print\"T = \",T1,\"K\"# initializing the value of temperature 1.\n", - "T2 =550\n", - "print\"T = \",T2,\"K\"# initializing the value of temperature 2.\n", - "Vt1 =0.0259\n", - "print\"Vt1 = \",Vt1,\"eV\"# initializing the value of thermal voltage at 300K.\n", - "Vt2 =0.0474\n", - "print\"Vt2 = \",Vt2,\"eV\"# initializing the value of thermal voltage at 550K.\n", - "Eg1=1.12\n", - "print\"Eg1 = \",Eg1,\"eV\"# initializing the value of thermal voltage .\n", - "no=(sqrt(Nc*Nv*(exp(-Eg1/Vt1))))\n", - "print\"intrinsic concentration at 300K,no=(sqrt(Nc∗Nv∗(exp(−Eg1/Vt1))))= \",no #calculation\n", - "K1=(Nc/((T1)^(3/2)))\n", - "print\"Value of constant ,K1=(Nc/((T) ˆ(3/2) ) )= \",K1 # calculation\n", - "k1=(K1*T2**(3/2))\n", - "print\"Value of constant k1 at 550K ,k1=(K1∗T2ˆ(3/2))= \",k1 # calculation \n", - "K2=(Nv/((T1)**(3/2)))\n", - "print\"Value of constant ,K2=(Nv/((T1) ˆ(3/2) ) )= \",K2 # calculation\n", - "k2=(K2*T2**(3/2))\n", - "print\"Value of constant k2 at 550K ,k2=(K2∗T2ˆ(3/2))= \",k2 # calculation\n", - "K=k1*k2\n", - "print\"Value of constant K,= \",K # calculation\n", - "no1=(sqrt(K*(exp(-Eg1/Vt2))))\n", - "print\"Intrinsic concentration at 550K,no=(sqrt(K∗(exp(−Eg1/Vt2))))= \",no1,\" cmˆ3\"# calculation\n", - "Nd=(4*(no1**2)/(1.2))\n", - "print\"Donor concentration at which intrinsic concentration is 10% of the total electron concentration ,Nd=(4∗(no1ˆ2) /(1.2) )= \",Nd,\" cmˆ3\"# calculation\n", - "#this is solved problem 2.18 of chapter 2.\n", - "#the value of temperature and % of the intrinsic carrier concentration given in the question is different than used in the solution .\n", - "#I have used the value provided in the solution (i.e T2=550 and % of the intrinsic carrier concentration =10%)\n", - "#the value of Donor concentration at which intrinsic concentration is 10% of the total electron concentration (Nd) , is provided wrong in the book after calculation .\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_19 pgno:55" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Ec Ef = 0.2 eV\n", - "Nc = 2.8e+19 cmˆ−3\n", - "Na = 30000000000000000 cmˆ−3\n", - "Vt = 0.0259 eV\n", - "Donor concentration ,Nd=(Nc∗(exp(−(Ec Ef)/(Vt))) )+(Na)= 4.24031697774e+16 cmˆ−3\n" - ] - } - ], - "source": [ - "#exa 2.19\n", - "Ec_Ef =0.2\n", - "print\"Ec Ef = \",Ec_Ef,\" eV\" # initializing the value of difference in the energy levels.\n", - "Nc=2.8*10**19\n", - "print\"Nc =\",Nc,\" cmˆ−3\"# initializing the conduction band concentration .\n", - "Na =3*10**16\n", - "print\"Na =\",Na,\" cmˆ−3\"# initializing the acceptor concentration .\n", - "Vt =0.0259\n", - "print\"Vt =\",Vt,\" eV\"# initializing the thermal voltage at 300K.\n", - "Nd=(Nc*(exp(-(Ec_Ef)/(Vt))))+(Na)\n", - "print\"Donor concentration ,Nd=(Nc∗(exp(−(Ec Ef)/(Vt))) )+(Na)= \",Nd,\" cmˆ−3\"# calculation\n", - "#this is solved problem 2.19 of chapter 2." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_20 pgno:56" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nv = 6000000000000000000 cmˆ−3\n", - "Nc = 1.04e+19 cmˆ−3\n", - "T1 = 300 K\n", - "T2 = 200 K\n", - "Vt1 = 0.0259 eV\n", - "Vt2 = 0.0173 eV\n", - "Eg1 = 0.6 eV\n", - "intrinsic concentration at 300K,no=(sqrt(Nc∗Nv∗(exp(−Eg1/Vt1))))= 7.36468677124e+13\n", - "Eg2 = 0.66 eV\n", - "Value of constant ,K1=(Nc/((T) ˆ(3/2) ) )= 3.46666666667e+16\n", - "Value of constant k1 at 200K ,k1=(K1∗T2ˆ(3/2))= 6.93333333333e+18\n", - "Value of constant ,K2=(Nv/((T1) ˆ(3/2) ) )= 20000000000000000\n", - "Value of constant k2 at 200K ,k2=(K2∗T2ˆ(3/2))= 4000000000000000000\n", - "Value of constant K,= 2.77333333333e+37\n", - "intrinsic concentration at 200K,no=(sqrt(K∗(exp(−Eg2/Vt2))))= 27369762834.6 cmˆ3\n" - ] - } - ], - "source": [ - "#exa 2.20\n", - "from math import sqrt\n", - "from math import exp\n", - "Nv =6*10**18\n", - "print\"Nv = \",Nv,\"cmˆ−3\"# initializing the value of valence band concentration at 300K.\n", - "Nc=1.04*10**19\n", - "print\"Nc = \",Nc,\"cmˆ−3\"# initializing the value of conduction band concentration at 300K.\n", - "T1 =300\n", - "print\"T1 = \",T1,\"K\"# initializing the value of temperature 1.\n", - "T2 =200\n", - "print\"T2 = \",T2,\"K\"# initializing the value of temperature 2.\n", - "Vt1 =0.0259\n", - "print\"Vt1 = \",Vt1,\"eV\"# initializing the value of thermal voltage at 300K.\n", - "Vt2 =0.0173\n", - "print\"Vt2 = \",Vt2,\"eV\"# initializing the value of thermal voltage at 200K.\n", - "Eg1=0.60\n", - "print\"Eg1 = \",Eg1,\"eV\"# initializing the value of thermal voltage used for 300K .\n", - "no=(sqrt(Nc*Nv*(exp(-Eg1/Vt1))))\n", - "print\"intrinsic concentration at 300K,no=(sqrt(Nc∗Nv∗(exp(−Eg1/Vt1))))= \",no #calculation\n", - "Eg2=0.66\n", - "print\"Eg2 = \",Eg2,\"eV\"# initializing the value of thermal voltage used for 200K.\n", - "K1=(Nc/((T1)**(3/2)))\n", - "print\"Value of constant ,K1=(Nc/((T) ˆ(3/2) ) )= \",K1 # calculation\n", - "k1=(K1*T2**(3/2))\n", - "print\"Value of constant k1 at 200K ,k1=(K1∗T2ˆ(3/2))= \",k1 # calculation\n", - "K2=(Nv/((T1)**(3/2)))\n", - "print\"Value of constant ,K2=(Nv/((T1) ˆ(3/2) ) )= \",K2 # calculation\n", - "k2=(K2*T2**(3/2))\n", - "print\"Value of constant k2 at 200K ,k2=(K2∗T2ˆ(3/2))= \",k2 # calculation\n", - "K=k1*k2\n", - "print\"Value of constant K,= \",K # calculation\n", - "no1=(sqrt(K*(exp(-Eg2/Vt2))))\n", - "print\"intrinsic concentration at 200K,no=(sqrt(K∗(exp(−Eg2/Vt2))))= \",round(no1,2),\" cmˆ3\"# calculation\n", - "#this is solved problem 2.20 of chapter 2.\n", - "#The answer of intrinsic concentration at 300K,(no) is provided wrong in the book." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_21 pgno:56" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Eg1 = 2 eV\n", - "Eg2 = 2.2 eV\n", - "Vt = 0.0259 eV\n", - "Ratio of their intrinsic concentration at 300K,(no1/no2)=sqrt(exp((−Eg1/Vt)−(−Eg2/Vt)))= 47.5130239084\n" - ] - } - ], - "source": [ - "#exa 2.21\n", - "Eg1=2\n", - "print\"Eg1 = \",Eg1,\" eV\" # initializing the value of band energy gap for semiconductor1.\n", - "Eg2 =2.2\n", - "print\"Eg2 = \",Eg2,\" eV\"# initializing the value of band energy gap for semiconductor2.\n", - "Vt =0.0259\n", - "print\"Vt = \",Vt,\" eV\"# initializing the value of thermal voltage at 300K.\n", - "No=sqrt(exp((-Eg1/Vt)-(-Eg2/Vt)))\n", - "print\"Ratio of their intrinsic concentration at 300K,(no1/no2)=sqrt(exp((−Eg1/Vt)−(−Eg2/Vt)))= \",No # calculation" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_3_CARRIER_TRANSPORT_IN_SEMICONDUCTOR.ipynb b/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_3_CARRIER_TRANSPORT_IN_SEMICONDUCTOR.ipynb deleted file mode 100755 index 2cc9b53b..00000000 --- a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_3_CARRIER_TRANSPORT_IN_SEMICONDUCTOR.ipynb +++ /dev/null @@ -1,700 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 3 CARRIER TRANSPORT IN SEMICONDUCTOR" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_1 pgno: 71" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "I = 0.005 amphere\n", - "B= 1e-06 Tesla\n", - "w = 0.0001 m\n", - "l = 0.001 m\n", - "t = 1e-05 m\n", - "p = 100000000000000000 atoms/mˆ3\n", - "e = 1.6e-19 columb\n", - "Hall electric field ,EH=(I∗B)/(w∗t∗p∗e)= 312.5 V/m\n", - "Hall electric field in centimeter ,EH=(I∗B)/(w∗ t∗p∗e)= 3.125 V/cm\n" - ] - } - ], - "source": [ - "#exa 3.1\n", - "I=5*10**-3\n", - "print \"I = \",I,\" amphere\" # initializing value of current flowing through the sample.\n", - "B=1*10**-6\n", - "print \"B= \",B,\" Tesla\" # initializing value of magnetic field .\n", - "w=0.01*10**-2\n", - "print \"w = \",w,\" m\" # initializing value of width of germanium sample .\n", - "l=0.1*10**-2\n", - "print \"l = \",l,\" m\" # initializing value of length of germanium sample .\n", - "t=0.001*10**-2\n", - "print \"t = \",t,\" m\" # initializing value of thickness of germanium sample .\n", - "p=10**17\n", - "print \"p = \",p,\" atoms/mˆ3\" # initializing value of doped acceptor atoms .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", - "EH=(I*B)/(w*t*p*e)\n", - "print \"Hall electric field ,EH=(I∗B)/(w∗t∗p∗e)= \",EH,\" V/m\" # calculation 18 \n", - "E=EH*10**-2\n", - "print \"Hall electric field in centimeter ,EH=(I∗B)/(w∗ t∗p∗e)= \",E,\" V/cm\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_2 pgno: 72" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "I = 0.005 amphere\n", - "B= 1e-06 Tesla\n", - "w = 0.0001 m\n", - "l = 0.001 m\n", - "t = 1e-05 m\n", - "p = 100000000000000000 atoms/cmˆ3\n", - "e = 1.6e-19 columb\n", - "hall cofficient ,Rh=(1/(p∗e))= 62.5 cmˆ3/C\n" - ] - } - ], - "source": [ - "#exa 3.2\n", - "I=5*10**-3\n", - "print \"I = \",I,\" amphere\" # initializing value of current flowing through the sample.\n", - "B=1*10**-6\n", - "print \"B= \",B,\" Tesla\" # initializing value of magnetic field .\n", - "w=0.01*10**-2\n", - "print \"w = \",w,\" m\" # initializing value of width of germanium sample .\n", - "l=0.1*10**-2\n", - "print \"l = \",l,\" m\" # initializing value of length of germanium sample .\n", - "t=0.001*10**-2\n", - "print \"t = \",t,\" m\" # initializing value of thickness of germanium sample .\n", - "p=10**17\n", - "print \"p = \",p,\" atoms/cmˆ3\" # initializing value of doped acceptor atoms .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", - "Rh=(1/(p*e))\n", - "print \"hall cofficient ,Rh=(1/(p∗e))= \",Rh,\" cmˆ3/C\"# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_3 pgno: 72" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "I = 0.01 amphere\n", - "B= 1e-05 Tesla\n", - "w = 0.0001 m\n", - "l = 0.001 m\n", - "t = 1e-05 m\n", - "n = 10000000000000000 atoms/cmˆ3\n", - "e = 1.6e-19 columb\n", - "Hall voltage ,Vh=((I∗B)/(n∗e∗t)))= 6.25 V\n" - ] - } - ], - "source": [ - "#exa 3.3\n", - "I=10*10**-3\n", - "print \"I = \",I,\" amphere\" # initializing value of current flowing through the sample.\n", - "B=10*10**-6\n", - "print \"B= \",B,\" Tesla\" # initializing value of magnetic field .\n", - "w=0.01*10**-2\n", - "print \"w = \",w,\" m\" # initializing value ofwidth of germanium sample .\n", - "l=0.1*10**-2\n", - "print \"l = \",l,\" m\" # initializing value of length of germanium sample .\n", - "t=0.001*10**-2\n", - "print \"t = \",t,\" m\" # initializing value of thickness of germanium sample .\n", - "n=10**16\n", - "print \"n = \",n,\" atoms/cmˆ3\" # initializing value of doped donor atoms .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", - "Vh=((I*B)/(n*e*t))\n", - "print \"Hall voltage ,Vh=((I∗B)/(n∗e∗t)))= \",Vh,\" V\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_4 pgno: 72" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "I = 0.01 amphere\n", - "B= 1e-05 Tesla\n", - "w = 0.0001 m\n", - "l = 0.001 m\n", - "t = 1e-05 m\n", - "p = 1000000000000000000 atoms/cmˆ3\n", - "e = 1.6e-19 columb\n", - "Hall voltage ,Yh=((B)/(p∗e∗t)))= 6.25 ohm\n" - ] - } - ], - "source": [ - "#exa 3.4\n", - "I=10*10**-3\n", - "print \"I = \",I,\" amphere\" # initializing value of current flowing through the sample.\n", - "B=10*10**-6\n", - "print \"B= \",B,\" Tesla\" # initializing value of magnetic field .\n", - "w=0.01*10**-2\n", - "print \"w = \",w,\" m\" # initializing value of width of germanium sample .\n", - "l=0.1*10**-2\n", - "print \"l = \",l,\" m\" # initializing value of length of germanium sample .\n", - "t=0.001*10**-2\n", - "print \"t = \",t,\" m\" # initializing value of thickness of germanium sample .\n", - "p=10**18\n", - "print \"p = \",p,\" atoms/cmˆ3\" # initializing value of doped donor atoms .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", - "Yh=((B)/(p*e*t))\n", - "print \"Hall voltage ,Yh=((B)/(p∗e∗t)))= \",Yh,\"ohm\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_8 pgno: 75" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "no = 15000000000.0\n", - "n= 20000000000000000\n", - "un = 1200\n", - "up = 500\n", - "e = 1.6e-19 columb\n", - "resistivity ,p=(1/(2∗e∗no∗(sqrt(un/up))))= 268957.17682 ohm\n", - "conductivity ,s=(1/p))= 3.71806401236e-06 S /cm\n", - "intrinsic conductivity ,sigma=e∗no∗(un+up))= 4.08e-06 S/cm\n" - ] - } - ], - "source": [ - "#exa 3.8\n", - "from math import sqrt\n", - "no=1.5*10**10\n", - "print \"no = \",no # initializing value of electron hole per cmˆ3.\n", - "n=2*10**16\n", - "print \"n= \",n # initializing value of number of electrons per cmˆ3.\n", - "un =1200\n", - "print \"un = \",un # initializing value of mobility of n−type carrier .\n", - "up =500\n", - "print \"up = \",up # initializing value of mobility of p−type carrier .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", - "p=(1/(2*e*no*(sqrt(un*up))))\n", - "print \"resistivity ,p=(1/(2∗e∗no∗(sqrt(un/up))))= \",p,\" ohm\" # calculation\n", - "sigmamin=(1/p)\n", - "print \"conductivity ,s=(1/p))= \",sigmamin,\" S /cm\" # calculation\n", - "sigma=e*no*(un+up)\n", - "print \"intrinsic conductivity ,sigma=e∗no∗(un+up))= \",sigma,\" S/cm\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_10 pgno: 76" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "po = 1000000000000000000 cmˆ−3\n", - "no = 15000000000.0 /cmˆ−3\n", - "P(o)= 100000000000000000 cmˆ−3\n", - "A = 0.1 cmˆ−2\n", - "up = 300 cmˆ2/Vs\n", - "t = 7e-09 sec\n", - "T = 300 K\n", - "Vt = 0.0259 eV\n", - "x = 5e-06 cm\n", - "Diffusion cofficient ,Dp=(Vt∗up))= 7.77 cmˆ2/s\n", - "Diffusion length ,Lp=(sqrt(Dp∗t)))= 0.000233216637485 cm\n", - "Excess charge generated ,p(x)=(po+(P(o)∗exp(−x/Lp) ) )= 1.09787888943e+18 cmˆ−3\n", - "Fermi level ,Efi Efp=(Vt∗log(p(x)/no)))= 0.469012627899 eV\n" - ] - } - ], - "source": [ - "#exa 3.10\n", - "from math import sqrt\n", - "from math import exp\n", - "from math import log\n", - "po =10**18\n", - "print \"po = \",po,\" cmˆ−3\" # initializing value of N type doping level .\n", - "no=1.5*10**10\n", - "print \"no = \",no,\" /cmˆ−3\" # initializing value of electron and hole concentration per cmˆ3.\n", - "Po =10**17\n", - "print \"P(o)= \",Po,\" cmˆ−3\" # initializing value of excess hole concentration .\n", - "A=0.1\n", - "print \"A = \",A,\" cmˆ−2\" # initializing the value of area .\n", - "up=300\n", - "print \"up = \",up,\" cmˆ2/Vs\" # initializing value of mobility of p−type carrier .\n", - "t=7*10**-9\n", - "print \"t = \",t,\" sec\" # initializing value of transit time.\n", - "T=300\n", - "print \"T = \",T,\"K\" # initializing value of temperature .\n", - "Vt=0.0259\n", - "print \"Vt = \",Vt,\" eV\" # initializing value of thermal voltage at 300K.\n", - "x=500*10**-8\n", - "print \"x = \",x,\" cm\" # initializing value of distance at which difference in fermi level is to calculated .\n", - "Dp=(Vt*up)\n", - "print \"Diffusion cofficient ,Dp=(Vt∗up))= \",Dp,\" cmˆ2/s\" #calculation \n", - "Lp=(sqrt(Dp*t))\n", - "print \"Diffusion length ,Lp=(sqrt(Dp∗t)))= \",Lp,\" cm\" # calculation\n", - "px=(po+(Po*exp(-x/Lp)))\n", - "print \"Excess charge generated ,p(x)=(po+(P(o)∗exp(−x/Lp) ) )= \",px,\" cmˆ−3\" # calculation\n", - "Efi_Efp=(Vt*log(px/no))\n", - "print \"Fermi level ,Efi Efp=(Vt∗log(p(x)/no)))= \",Efi_Efp,\" eV\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_11 pgno: 77" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "A = 1e-05 cmˆ2\n", - "Dp= 0.000777 cmˆ2/s\n", - "Lp = 2.33e-06 cm\n", - "x = 5e-06 cm\n", - "P(O)−po = 100000000000000000000000\n", - "e = 1.6e-19 column\n", - "Hole current ,I=(((e∗A∗Dp∗[P(O)−po])/Lp)∗exp(−x/Lp))= 6.24054720884 amphere\n", - " stored excess hole ,Q=(e∗A∗Dp∗Lp∗P))= 2.896656e-10 C\n" - ] - } - ], - "source": [ - "#exa 3.11\n", - "from math import exp\n", - "A=0.1*10**-4\n", - "print \"A = \",A,\" cmˆ2\" # initializing value of area .\n", - "Dp =7.77*10** -4\n", - "print \"Dp= \",Dp,\" cmˆ2/s\" # initializing value of diffusion cofficient .\n", - "Lp =0.233*10** -5\n", - "print \"Lp = \",Lp,\" cm\" # initializing value of diffusion length .\n", - "x=500*10**-8\n", - "print \"x = \",x,\" cm\" # initializing value of distance\n", - "P=10**17*10**6\n", - "print \"P(O)−po = \",P # initializing value of P(O)−po\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"column\" # initializing value of charge of electron .\n", - "I=(((e*A*Dp*P)/Lp)*exp(-x/Lp))\n", - "print \"Hole current ,I=(((e∗A∗Dp∗[P(O)−po])/Lp)∗exp(−x/Lp))= \",I,\"amphere\" # calculation\n", - "Q=(e*A*Dp*Lp*P)\n", - "print \" stored excess hole ,Q=(e∗A∗Dp∗Lp∗P))= \",Q,\"C\" # calculation\n", - "# the value of current(I) given after calculation inthe book is wrong, (as the value of Lp used in the formula while finding value of hole current ( I)at two places is used different).\n", - "# I have used the value Lp=0.233∗10ˆ−5 cm" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_12 pgno: 77" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "I = 0.002 amphere\n", - "B= 0.1 Tesla\n", - "w = 0.0002 mm\n", - "l = 0.002 m\n", - "t = 2e-05 m\n", - "Vaa = 10 V\n", - "Vh = -0.01 V\n", - "e = 1.6e-19 columb\n", - "electron concentration ,n=((I∗B)/(e∗t∗Vh))= -6.25e+21 mˆ−3\n", - "mobility ,un=(I∗L/(e∗n∗Vaa∗w∗t))= 0.1 mˆ2/Vs\n" - ] - } - ], - "source": [ - "#exa 3.12\n", - "I=2*10**-3\n", - "print \"I = \",I,\" amphere\" # initializing value of current flowing through the sample.\n", - "B=1000*10**-4\n", - "print \"B= \",B,\" Tesla\" # initializing value of magnetic field .\n", - "w=0.2*10**-3\n", - "print \"w = \",w,\" mm\" # initializing value of width of sample .\n", - "l=2*10**-3\n", - "print \"l = \",l,\" m\" # initializing value of length of sample .\n", - "t=0.02*10**-3\n", - "print \"t = \",t,\" m\" # initializing value of thickness of sample .\n", - "Vaa=10\n", - "print \"Vaa = \",Vaa,\" V\" # initializing value of applied voltage .\n", - "Vh = -10*10** -3\n", - "print \"Vh = \",Vh,\" V\" # initializing value of hall voltage .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", - "n=((I*B)/(e*t*Vh))\n", - "print \"electron concentration ,n=((I∗B)/(e∗t∗Vh))= \",n,\" mˆ−3\" # calculation\n", - "un=(I*l/(e*abs(n)*Vaa*w*t))\n", - "print \"mobility ,un=(I∗L/(e∗n∗Vaa∗w∗t))= \",un,\" mˆ2/Vs\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_14 pgno: 78" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ND x = ((10ˆ17) −(10ˆ18∗x))\n", - "differentiating above equation with resprct to x\n", - "d[ND x]/dx = (−10ˆ18) cmˆ−4\n", - "now, electric field is given by \n", - "E x = −(VT/ND x)∗(d[ND x]/dx) = (0.0259∗10ˆ18)/((10ˆ15) −(10ˆ18∗x))\n", - "for x = 0\n", - "E x = 25.9 V/cm\n", - "for x = 1∗10ˆ−4 cm\n", - "E x = 28.7777777778 V/cm\n" - ] - } - ], - "source": [ - "#exa 3.14\n", - "print \"ND x = ((10ˆ17) −(10ˆ18∗x))\" # donor concentration in an N type semiconductor\n", - "print \"differentiating above equation with resprct to x\"\n", - "print \"d[ND x]/dx = (−10ˆ18) cmˆ−4\"\n", - "print \"now, electric field is given by \"\n", - "print \"E x = −(VT/ND x)∗(d[ND x]/dx) = (0.0259∗10ˆ18)/((10ˆ15) −(10ˆ18∗x))\" # equation for electric field\n", - "print \"for x = 0\" \n", - "x=0\n", - "E_x = (0.0259*10**18)/((10**15) -(10**18*x))\n", - "print \"E x = \",E_x,\"V/cm\"\n", - "print \"for x = 1∗10ˆ−4 cm\"\n", - "x = 1*10**-4\n", - "E_x = (0.0259*10**18)/((10**15) -(10**18*x))\n", - "print \"E x = \",E_x,\"V/cm\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_17 pgno: 81" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 100000000000000000 /cmˆ3\n", - "Na= 0 /cmˆ3\n", - "no = 1800000.0 /cmˆ3\n", - "E = 5 V/cm\n", - "un = 7500 cmˆ2/s\n", - "n1= 100000000000000000 cmˆ−3\n", - "e = 1.6e-19 columb\n", - "Electron concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= 1e+17 cmˆ−3\n", - "Hole concentration ,p=(noˆ2/n))= 3.24e-05 cmˆ−3\n", - "Drift current density , Jdrift=n1∗un∗e∗E)= 600.0 A/cmˆ2\n" - ] - } - ], - "source": [ - "#exa 3.17\n", - "from math import sqrt\n", - "Nd =10**17\n", - "print \"Nd = \",Nd,\" /cmˆ3\" # initializing value of donor concentration .\n", - "Na=0\n", - "print \"Na= \",Na,\"/cmˆ3\" # initializing value of acceptor concentration .\n", - "no=1.8*10**6\n", - "print \"no = \",no,\" /cmˆ3\" # initializing value of electron and hole concentration per cmˆ3.\n", - "E=5\n", - "print \"E = \",E,\" V/cm\" # initializing value of electric field .\n", - "un=7500\n", - "print \"un = \",un,\" cmˆ2/s\" # initializing value of mobility .\n", - "n1=10**17\n", - "print \"n1= \",n1,\" cmˆ−3\" # initializing value of impurity concentration .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", - "n=(-(Na-Nd)+sqrt((Na-Nd)**2+4*no))/2\n", - "print \"Electron concentration ,n=(−(Na−Nd)+sqrt ((Na−Nd)ˆ2+4∗no))/2)= \",n,\" cmˆ−3\" #calculation\n", - "p=(no**2/n)\n", - "print \"Hole concentration ,p=(noˆ2/n))= \",p,\" cmˆ−3\" # calculation\n", - "Jdrift=n1*un*e*E\n", - "print \"Drift current density , Jdrift=n1∗un∗e∗E)= \",Jdrift,\" A/cmˆ2\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_18 pgno: 82" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 0 /cmˆ3\n", - "Na= 100000000000000000 /cmˆ3\n", - "no = 1800000.0 /cmˆ3\n", - "E = 10 V/cm\n", - "un = 200 cmˆ2/s\n", - "p1= 100000000000000000 cmˆ−3\n", - "e = 1.6e-19 columb\n", - "Electron concentration ,p=−(−(Na−Nd)−sqrt ((Na−Nd)**2+4∗(no**2)))/2= 1e+17 cmˆ−3\n", - "Hole concentration ,n=(noˆ2/p))= 3.24e-05 cmˆ−3\n", - "Drift current density , Jdrift=n1∗un∗e∗E)= 32.0 A/cmˆ2\n" - ] - } - ], - "source": [ - "#exa 3.18\n", - "from math import sqrt\n", - "Nd=0\n", - "print \"Nd = \",Nd,\" /cmˆ3\" # initializing value of donor concentration .\n", - "Na =10**17\n", - "print \"Na= \",Na,\" /cmˆ3\" # initializing value of acceptor concentration .\n", - "no=1.8*10**6\n", - "print \"no = \",no,\" /cmˆ3\" # initializing value of electron and hole concentration per cmˆ3.\n", - "E=10\n", - "print \"E = \",E,\" V/cm\" # initializing value of electric field .\n", - "un=200\n", - "print \"un = \",un,\" cmˆ2/s\" # initializing value of mobility \n", - "p1=10**17\n", - "print \"p1= \",p1,\" cmˆ−3\" # initializing value of impurity concentration .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\" columb\" # initializing value of charge of electron .\n", - "p=-(-(Na-Nd)-sqrt((Na-Nd)**2+4*(no**2)))/2\n", - "print \"Electron concentration ,p=−(−(Na−Nd)−sqrt ((Na−Nd)**2+4∗(no**2)))/2= \",p,\" cmˆ−3\" # calculation\n", - "n=(no**2/p)\n", - "print \"Hole concentration ,n=(noˆ2/p))= \",n,\"cmˆ−3\" # calculation\n", - "Jdrift=p1*un*e*E\n", - "print \"Drift current density , Jdrift=n1∗un∗e∗E)= \",Jdrift,\" A/cmˆ2\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_19 pgno: 82" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "D = 120 A/cmˆ2\n", - "E = 5 V/cm\n", - "e = 1.6e-19 columb\n", - "thermal equilibrium value of hole concentration ,p=(D/(450∗ e∗E)))= 3.33333333333e+17 /cmˆ3\n" - ] - } - ], - "source": [ - "#exa 3.19\n", - "D=120\n", - "print \"D = \",D,\" A/cmˆ2\" # initializing value of drift current density .\n", - "E=5\n", - "print \"E = \",E,\" V/cm\" # initializing value of electric field .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columb\" # initializing value of charge of electron .\n", - "p=(D/(450*e*E))\n", - "print \"thermal equilibrium value of hole concentration ,p=(D/(450∗ e∗E)))= \",p,\" /cmˆ3\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_20 pgno: 83" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 50000000000000000 /cmˆ3\n", - "A= 5e-07 cmˆ2\n", - "l = 0.2 /cm\n", - "E = 10 V\n", - "un = 1100 cmˆ2/s\n", - "p= 50000000000000000 /cmˆ−3\n", - "e = 1.6e-19 columb\n", - "Current through the bar,I=(p∗up∗e∗E∗A)/l)= 0.00022 A\n" - ] - } - ], - "source": [ - "#exa 3.20\n", - "Nd =5*10**16\n", - "print \"Nd = \",Nd,\" /cmˆ3\" # initializing value of donor concentration .\n", - "A=50*10**-8\n", - "print \"A= \",A,\" cmˆ2\" # initializing value of area .\n", - "l=0.2\n", - "print \"l = \",l,\" /cm\" # initializing value of length .\n", - "E=10\n", - "print \"E = \",E,\" V\" # initializing value of electric field .\n", - "up=1100\n", - "print \"un = \",up,\" cmˆ2/s\" # initializing value of mobility .\n", - "p=5*10**16\n", - "print \"p= \",p,\" /cmˆ−3\" # initializing value of impurity concentration .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columb\" # initializing value of charge of electron .\n", - "I=(p*up*e*E*A)/l\n", - "print \"Current through the bar,I=(p∗up∗e∗E∗A)/l)= \",I,\"A\" # calculation" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_4__EXCESS_CARRIER_IN_SEMICONDUCTOR.ipynb b/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_4__EXCESS_CARRIER_IN_SEMICONDUCTOR.ipynb deleted file mode 100755 index 4b62aae8..00000000 --- a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_4__EXCESS_CARRIER_IN_SEMICONDUCTOR.ipynb +++ /dev/null @@ -1,266 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4 EXCESS CARRIER IN SEMICONDUCTOR" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_2 pgno: 100" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 200000000000000000 cmˆ−3\n", - "Er = 11.9\n", - "e = 1.6e-19 columns\n", - "eo = 8.854e-14\n", - "un = 1350 cm2/Vs\n", - " conducitivity , sigma=e∗un∗Nd)= 43.2 S/cm\n", - "Dielectric releaxation time ,td=((Er∗Eo)/sigma))= 2.43894907407e-14 s\n" - ] - } - ], - "source": [ - "#exa 4.2\n", - "Nd =2*10**17\n", - "print\"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration .\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric constant.\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "Eo=8.854*10**-14\n", - "print\"eo = \",Eo # initializing value of permittivity of free space .\n", - "un=1350\n", - "print\"un = \",un,\"cm2/Vs\" # initializing value of mobility .\n", - "sigma=e*un*Nd\n", - "print\" conducitivity , sigma=e∗un∗Nd)=\",sigma,\"S/cm\"# calculation\n", - "td=((Er*Eo)/sigma)\n", - "print\"Dielectric releaxation time ,td=((Er∗Eo)/sigma))=\",td,\"s\"# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_3 pgno: 101" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "n = 1000000000000000 cmˆ−3\n", - "no = 10000000000 cmˆ−3\n", - "t = 1e-06 s\n", - "Excess electron concentration = 100000000000000 cmˆ−3\n", - "electron hole recombination ,R=(c/t))= 1e+20 /cmˆ3s\n" - ] - } - ], - "source": [ - "#exa 4.3\n", - "n=10**15\n", - "print\"n = \",n,\"cmˆ−3\" # initializing value of concentration of electrons/cmˆ3.\n", - "no =10**10\n", - "print\"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration of electron .\n", - "t=10**-6\n", - "print\"t = \",t,\"s\" # initializing value of carrier lifetime .\n", - "c=1*10**14\n", - "print\"Excess electron concentration = \",c,\"cmˆ−3\" # initializing value of excess electrons concentration .\n", - "R=(c/t)\n", - "print\"electron hole recombination ,R=(c/t))=\",R,\" /cmˆ3s\"# calculation," - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 1000000000000000 cmˆ−3\n", - "minority carrier lifetime = 1e-05 s\n", - "no = 15000000000.0 cmˆ−3\n", - "excess carrier concentration ,p=(noˆ2/Nd))= 225000.0 /cmˆ3\n", - "electron hole generation and recombination rate ,R=(p/t))= 22500000000.0 /cmˆ3s\n", - "majority carrier concentration ,t=Nd/R)= 44444.4444444 s\n" - ] - } - ], - "source": [ - "#exa 4.4\n", - "Nd =10**15\n", - "print\"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration ..\n", - "tn =10*10**-6\n", - "print\"minority carrier lifetime = \",tn,\"s\" #initializing value of minority carrier lifetime\n", - "no=1.5*10**10\n", - "print\"no = \",no,\"cmˆ−3\" # initializing value of electron and hole concentration per cmˆ3.\n", - "p=(no**2/Nd)\n", - "print\"excess carrier concentration ,p=(noˆ2/Nd))=\",p,\"/cmˆ3\"# calculation\n", - "R=(p/tn)\n", - "print\"electron hole generation and recombination rate ,R=(p/t))=\",R,\"/cmˆ3s\"#calculation\n", - "t=Nd/R\n", - "print\"majority carrier concentration ,t=Nd/R)=\",t,\"s\"# calculation .\n", - "#the value of majority carrier concentration,t=Nd/R( after calculation ) , is provided wrong in the solution .\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_5 pgno: 101" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 10000000000000000 cmˆ−3\n", - "p = 1000000 cmˆ−3\n", - "no = 10000000000 cmˆ−3\n", - "n∗ = 1000000000000000 cmˆ−3\n", - "p∗ = 1000000000000000 cmˆ−3\n", - "KT = 0.0259 eV\n", - "T = 300 K\n", - "Thermal equilibirium fermi level ,( Ef Efi )=(KT∗log(n/no)))= 0.357821723451 eV\n", - "Quasi−fermi levels for n−type dopant ,( Efn Efi )=(KT∗log ((n+n∗)/no))= 0.360290257108 eV\n", - "Quasi−fermi levels for p−type dopant ,( Efi Efp )=(KT∗log ((p+p∗)/no))= 0.360290257108 eV\n" - ] - } - ], - "source": [ - "#exa 4.5\n", - "from math import log\n", - "Nd =10**16\n", - "print\"Nd = \",Nd,\" cmˆ−3\" # initializing value of donor concentration .\n", - "p=10**6\n", - "print\"p = \",p,\" cmˆ−3\" # initializing value of minority hole concentration .\n", - "no =10**10\n", - "print\"no = \",no,\" cmˆ−3\" # initializing value of electron and hole concentration per cm ˆ3..\n", - "n1 =10**15\n", - "print\"n∗ = \",n1,\" cmˆ−3\" # initializing value of excess electron carrier concentration(denoted by n∗).\n", - "p1=10**15\n", - "print\"p∗ = \",p1,\" cmˆ−3\" # initializing value of excess hole carrier concentration( denoted by p∗).\n", - "KT=0.0259\n", - "print\"KT = \",KT,\" eV\" # initializing value of multipication of temperature and bolzmann constant .\n", - "T=300\n", - "print\"T = \",T,\" K\" # initializing value of temperature .\n", - "Ef_Efi=(log(Nd/no)*KT)\n", - "print\"Thermal equilibirium fermi level ,( Ef Efi )=(KT∗log(n/no)))=\",Ef_Efi,\" eV\"#calculation .\n", - "Efn_Efi=log((Nd+n1)/no)*KT\n", - "print\"Quasi−fermi levels for n−type dopant ,( Efn Efi )=(KT∗log ((n+n∗)/no))=\",Efn_Efi,\" eV\"# calculation .\n", - "Efi_Efp=log((Nd+p1)/no)*KT\n", - "print\"Quasi−fermi levels for p−type dopant ,( Efi Efp )=(KT∗log ((p+p∗)/no))=\",Efi_Efp,\" eV\"# calculation .\n", - "#the answer for Efn Efi , Efi Efp is provided wrong in the book.\n", - "#In this question,Nd=(n(used in the formula))." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_6 pgno: 102" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 50000000000000000 cmˆ−3\n", - "Na = 0 cmˆ−3\n", - "no = 15000000000.0 cmˆ−3\n", - "n∗ = 500000000000000 cmˆ−3\n", - "p∗ = 500000000000000 cmˆ−3\n", - "KT = 0.0259\n", - "thermal equilibrium fermi level ,( Ef Efi )=(KT∗log(n/no)))= 0.389004619083 eV\n", - "Excess carrier concentration ,(Efn Efi)=(KT∗log ((n+n∗)/no))= 0.389262332652 eV\n", - "(Ef Efi)=(KT∗log((p+p∗)/no))= 0.269730711266 eV\n" - ] - } - ], - "source": [ - "#exa 4.6\n", - "from math import log\n", - "Nd =5*10**16\n", - "print\"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor ion concentration .\n", - "Na=0\n", - "print\"Na = \",Na,\"cmˆ−3\" # initializing value of value of acceptor ion concentration .\n", - "no=1.5*10**10\n", - "print\"no =\",no,\"cmˆ−3\" # initializing electron and hole concentration per cmˆ3.\n", - "n1 =5*10**14\n", - "print\"n∗ =\",n1,\"cmˆ−3\" # initializing excess electron carrier concentration .\n", - "p1 =5*10**14\n", - "print\"p∗ =\",p1,\"cmˆ−3\" # initializing excess hole carrier concentration .\n", - "KT=0.0259\n", - "print\"KT =\",KT #initializing value of voltage \n", - "Ef_Efi=(KT*log(Nd/no))\n", - "print\"thermal equilibrium fermi level ,( Ef Efi )=(KT∗log(n/no)))=\",Ef_Efi,\"eV\" #calculation .\n", - "Efn_Efi=log((Nd+n1)/no)*KT\n", - "print\"Excess carrier concentration ,(Efn Efi)=(KT∗log ((n+n∗)/no))=\",Efn_Efi,\"eV\" # calculation .\n", - "Efi_Efp=log((Na+p1)/no)*KT\n", - "print\"(Ef Efi)=(KT∗log((p+p∗)/no))=\",Efi_Efp,\"eV\"# calculation ." - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_5_PN_JUNCTION_DIODE.ipynb b/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_5_PN_JUNCTION_DIODE.ipynb deleted file mode 100755 index f92767c3..00000000 --- a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_5_PN_JUNCTION_DIODE.ipynb +++ /dev/null @@ -1,1364 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# chapter 5 PN JUNCTION DIODE" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_5 pgno: 142" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na 100000000000000000 /cmˆ3\n", - "Nd= 1000000000000000 /cmˆ3\n", - "no = 15000000000.0 cmˆ−3\n", - "e = 1.6e-19 columns\n", - "K = 1.38e-23 J/k\n", - "T = 300 K\n", - "(a)fermi level in the P region , Efi Efp=((KT/e) ∗ log (Na/no ) ) )= 0.406564315296 eV\n", - "fermi level in the n region,Efn Efi=((KT/e)∗log (Nd/no) ) )= 0.287405536734 eV\n", - "(b) junction potential at room temperature ,Efn Efp=(Efi Efp)+(Efn Efi))= 0.69396985203 eV\n" - ] - } - ], - "source": [ - "#exa 5.5\n", - "from math import log\n", - "Na =10**17\n", - "print \"Na\",Na,\"/cmˆ3\" # initializing value of medium p doping concentration .\n", - "Nd =10**15\n", - "print \"Nd= \",Nd,\"/cmˆ3\" # initializing value of light n doping .\n", - "no=1.5*10**10\n", - "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "K=1.38*10**-23\n", - "print \"K = \",K,\"J/k\" #initializing value of boltzmann constant .\n", - "T=300\n", - "print \"T = \",T,\"K\" # initializing value of temperature .\n", - "Efi_Efp=((K*T/e)*log(Na/no))\n", - "print \"(a)fermi level in the P region , Efi Efp=((KT/e) ∗ log (Na/no ) ) )= \",Efi_Efp,\"eV\" # calculation .\n", - "Efn_Efi=((K*T/e)*log(Nd/no))\n", - "print \"fermi level in the n region,Efn Efi=((KT/e)∗log (Nd/no) ) )=\",Efn_Efi,\" eV\" # calculation\n", - "Efn_Efp=(Efi_Efp)+(Efn_Efi)\n", - "print\"(b) junction potential at room temperature ,Efn Efp=(Efi Efp)+(Efn Efi))=\",Efn_Efp,\" eV\" #calculation ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_7 pgno: 143" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Pp= 1000000000000000000 /cmˆ3\n", - "Nn= 1000000000000000 /cmˆ3\n", - "tp = 7e-06 s\n", - "tn = 2e-07 s\n", - "up= 800 cm2/Vs\n", - "un= 300 cm2/Vs\n", - "no = 15000000000.0 cmˆ−3\n", - "Vf = 0.6 V\n", - "A = 0.0001 mˆ2\n", - "e = 1.6e-19 columns\n", - "K = 1.38e-23 J/k\n", - "T = 300 K\n", - "Vt=(K∗T/e))= 0.025875 eV\n", - "Dp=Vt∗un= 7.7625 cmˆ−3\n", - "Dn=Vt∗up= 20.7 cmˆ−3\n", - "Lp=(sqrt(Dp∗tp))= 0.00737139742518 cm\n", - "Ln=(sqrt(Dn∗tn))= 0.00203469899494 cm\n", - "npo=(no^2/Pp)= 225.0 cmˆ−3\n", - "Ppo=(noˆ2/Nn)= 225000.0 cmˆ−3\n", - "Reverse saturation current ,Io=(((Dp∗Ppo)/(Lp)) + ( ( D n ∗ n p o ) / ( L n ) ) ) ∗ e ∗ A= 3.827628972e-15 A \n", - "Diode forward current , If=Io∗((exp(Vf/Vt))−1)= 4.5032547414e-05 A\n" - ] - } - ], - "source": [ - "#exa 5.7\n", - "from math import sqrt\n", - "from math import exp\n", - "Pp =10**18\n", - "print \"Pp= \",Pp,\"/cmˆ3\" # initializing value of doping concentration in p region.\n", - "Nn =10**15\n", - "print \"Nn= \",Nn,\"/cmˆ3\" # initializing value of doping concentration in n region.\n", - "tp =7*10** -6\n", - "print \"tp = \",tp,\"s\" # initializing value of hole lifetime .\n", - "tn =0.2*10** -6\n", - "print \"tn = \",tn,\"s\" # initializing value of electron lifetime .\n", - "up=800\n", - "print \"up= \",up,\"cm2/Vs\" # initializing value of P side mobility .\n", - "un=300\n", - "print \"un= \",un,\"cm2/Vs\" # initializing value of n side mobility .\n", - "no=1.5*(10**10)\n", - "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration .\n", - "Vf=0.6\n", - "print \"Vf = \",Vf,\"V\" # initializing value of forward bias voltage .\n", - "A=100*(10**-6)\n", - "print \"A = \",A,\"mˆ2\"# initializing value of diode cross−sectional area .\n", - "e=1.6*(10**-19)\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "K=1.38*(10**-23)\n", - "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", - "T=300\n", - "print \"T = \",T,\"K\" # initializing value of temperature .\n", - "Vt=(K*T/e)\n", - "print \"Vt=(K∗T/e))=\",Vt,\"eV\" #calculation .\n", - "Dp=Vt*un\n", - "print \"Dp=Vt∗un=\",Dp,\"cmˆ−3\" # calculation .\n", - "Dn=Vt*up\n", - "print \"Dn=Vt∗up=\",Dn,\"cmˆ−3\" # calculation .\n", - "Lp=sqrt(Dp*tp)\n", - "print \"Lp=(sqrt(Dp∗tp))=\",Lp,\"cm\" # calculation .\n", - "Ln=(sqrt(Dn*tn))\n", - "print \"Ln=(sqrt(Dn∗tn))=\",Ln,\"cm\" # calculation .\n", - "npo=(no**2/Pp)\n", - "print \"npo=(no^2/Pp)=\",npo,\"cmˆ−3\" # calculation .\n", - "Ppo=(no**2/Nn)\n", - "print \"Ppo=(noˆ2/Nn)=\",Ppo,\"cmˆ−3\" #calculation .\n", - "Io=(((Dp*Ppo)/(Lp))+((Dn*npo)/(Ln)))*e*A\n", - "print \"Reverse saturation current ,Io=(((Dp∗Ppo)/(Lp)) + ( ( D n ∗ n p o ) / ( L n ) ) ) ∗ e ∗ A= \",Io,\" A \" #calculation .\n", - "If=Io*((exp(Vf/Vt))-1)\n", - "print \"Diode forward current , If=Io∗((exp(Vf/Vt))−1)=\",If,\"A\" # calculation .\n", - "#//the value of Io(reverse saturation current ),after calculation is provided wrong in the book.Due to which If (diode forward current )also differ.\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_8 pgno: 144" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 40000000000000000 cmˆ−3\n", - "Nd = 20000000000000000000 cmˆ−3\n", - "no = 15000000000.0 cmˆ−3\n", - "e = 1.6e-19 columns\n", - "K = 1.38e-23 J/k\n", - "T = 300 K\n", - "Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd) /(no) ˆ2) )= 0.926513569765 V\n" - ] - } - ], - "source": [ - "#exa 5.8\n", - "Na =4*10**16\n", - "print \"Na = \",Na,\"cmˆ−3\" # initializing value of acceptor concentration .\n", - "Nd =2*10**19\n", - "print \"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration .\n", - "no=1.5*10**10\n", - "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "K=1.38*10**-23\n", - "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", - "T=300\n", - "print \"T = \",T,\"K\" # initializing value of temperature .\n", - "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", - "print \"Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd) /(no) ˆ2) )=\",Vbi,\"V\" # calculation\n", - "#The value used for Nd in the book for solution is different than provided in the question .\n", - "#I have used the value provided in the solution(i.eNd=2∗10ˆ19)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_9 pgno: 144" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 40000000000000000 cmˆ−3\n", - "Nd = 20000000000000000000 cmˆ−3\n", - "no = 1800000.0 cmˆ−3\n", - "e = 1.6e-19 columns\n", - "K = 1.38e-23 J/k\n", - "T = 300 K\n", - "Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd) /(no) ˆ2) )= 1.39371354345 V\n" - ] - } - ], - "source": [ - "#exa 5.9\n", - "Na =4*10**16\n", - "print \"Na = \",Na,\"cmˆ−3\" # initializing value of acceptor concentration .\n", - "Nd =2*10**19\n", - "print \"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration .\n", - "no=1.8*10**6\n", - "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "K=1.38*10**-23\n", - "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", - "T=300\n", - "print \"T = \",T,\"K\" # initializing value of temperature .\n", - "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", - "print \"Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd) /(no) ˆ2) )= \",Vbi,\"V\" # calculation .\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_10 pgno: 144" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na= 1e+17 /cmˆ3\n", - "Nd= 1e+19 /cmˆ3\n", - "Vbi = 0.64 V\n", - "e = 1.6e-19 columns\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "W=sqrt((2∗E∗Vbi/e)∗((Nd+Na)/(Na∗Nd))))= 9.22675353524e-06 cm\n", - "xn=((W∗Na) /(Nd+Na) ) )= 9.13539953984e-08 cm\n", - "xp=((W∗Nd) /(Nd+Na) ) )= 9.13539953984e-06 cm\n", - "Emax=(−e∗Nd∗xn)/E)= -138727.017592 V/cm\n" - ] - } - ], - "source": [ - "# exa 5.10\n", - "from math import sqrt\n", - "Na =10e16\n", - "print \"Na= \",Na,\"/cmˆ3\" # initializing value of medium p doping concentration .\n", - "Nd =10e18\n", - "print \"Nd= \",Nd,\"/cmˆ3\" # initializing value of light n doping .\n", - "Vbi =0.64\n", - "print \"Vbi = \",Vbi,\"V\" # initializing value of built in voltage .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "Er=11.9\n", - "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "E=Eo*Er\n", - "print \" total permittivity ,E=Eo∗Er= \",E,\" F/cm\" #calculation .\n", - "W=sqrt((2*E*Vbi/e)*((Nd+Na)/(Na*Nd)))\n", - "print \"W=sqrt((2∗E∗Vbi/e)∗((Nd+Na)/(Na∗Nd))))=\",W,\" cm\" # calculation .\n", - "xn=((W*Na)/(Nd+Na))\n", - "print \"xn=((W∗Na) /(Nd+Na) ) )=\",xn,\"cm\" # calculation .\n", - "xp=((W*Nd)/(Nd+Na))\n", - "print \"xp=((W∗Nd) /(Nd+Na) ) )=\",xp,\"cm\" # calculation .\n", - "Emax=(-e*Nd*xn)/E\n", - "print \"Emax=(−e∗Nd∗xn)/E)=\",Emax,\"V/cm\" #calculation .\n", - "# The value and unit of W(depletion width) ,provided after calculation in the book is wrong.Due to this xn,xp ,Emax also differ.\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_12 pgno: 145" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 10000000000000000 /cmˆ3\n", - "Nd = 1000000000000000000 /cmˆ3\n", - "Vbi = 0.64 V\n", - "Vr = 20 V\n", - "e = 1.6e-19 columns\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "Emax=−(sqrt(((2∗e∗(Vbi+Vr))/(E))∗((Nd∗Na)/(Na+Nd)))))= -249129.931857 V/cm\n" - ] - } - ], - "source": [ - "#exa 5.12\n", - "Na =10**16\n", - "print \"Na = \",Na,\"/cmˆ3\" # initializing value of medium p doping concentration .\n", - "Nd =10**18\n", - "print \"Nd = \",Nd,\"/cmˆ3\" # initializing value of light n doping .\n", - "Vbi =0.64\n", - "print \"Vbi = \",Vbi,\"V\" # initializing value of built in voltage .\n", - "Vr=20\n", - "print \"Vr = \",Vr,\"V\" # initializing value of applied reverse voltage .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "Er=11.9\n", - "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "E=Eo*Er\n", - "print \" total permittivity ,E=Eo∗Er= \",E,\" F/cm\" #calculation .\n", - "Emax=-(sqrt(((2*e*(Vbi+Vr))/(E))*((Nd*Na)/(Na+Nd))))\n", - "print \"Emax=−(sqrt(((2∗e∗(Vbi+Vr))/(E))∗((Nd∗Na)/(Na+Nd)))))= \",Emax,\"V/cm\" #calculation .\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_13 pgno: 146" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Emax = 200000 V/cm\n", - "Nd= 1000000000000000000 /cmˆ3\n", - "Vbi = 0.54 V\n", - "Vr = 20 V \n", - "e = 1.6e-19 columns\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "Na=(Emaxˆ2∗E∗Nd)/((2∗e∗(Vbi+Vr)∗Nd)−(Emaxˆ2∗E)) )= 6.45341703981e+15 cmˆ−3\n" - ] - } - ], - "source": [ - "#exa 5.13\n", - "Emax =2*10**5\n", - "print \"Emax = \",Emax,\"V/cm\" # initializing value of maximum electric field .\n", - "Nd=1*10**18\n", - "print \"Nd= \",Nd,\"/cmˆ3\" # initializing value of donor concentration .\n", - "Vbi=0.54\n", - "print \"Vbi = \",Vbi,\"V\" # initializing value of built in voltage .\n", - "Vr=20\n", - "print \"Vr = \",Vr,\"V \" #initializing value of applied reverse voltage .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "Er=11.9\n", - "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "E=Eo*Er\n", - "print \"total permittivity ,E=Eo∗Er=\",E,\" F/cm\" #calculation .\n", - "Na=((Emax**2)*E*Nd)/((2*e*(Vbi+Vr)*Nd)-((Emax**2)*E))\n", - "print \"Na=(Emaxˆ2∗E∗Nd)/((2∗e∗(Vbi+Vr)∗Nd)−(Emaxˆ2∗E)) )= \",Na,\"cmˆ−3\" # calculation .\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_14 pgno: 146" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 10000000000000000 /cmˆ3\n", - "Nd = 1000000000000000000 /cmˆ3\n", - "A = 1 cmˆ2\n", - "Vj = 0.54 V\n", - "Va = 10 V\n", - "e = 1.6e-19 columns\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "Cj=sqrt((e∗E∗Aˆ2/(2∗(Va+Vj))∗((Na∗Nd)/(Na+Nd))))= 8.89830403817e-09 f/cmˆ2\n" - ] - } - ], - "source": [ - "#exa 5.14\n", - "Na =10**16\n", - "print \"Na = \",Na,\"/cmˆ3\" # initializing value of acceptor concentration .\n", - "Nd =10**18\n", - "print \"Nd = \",Nd,\"/cmˆ3\" # initializing value of donor concentration .\n", - "A=1\n", - "print \"A = \",A,\"cmˆ2\" # initializing value of area for finding junction capacitance per unit area.\n", - "Vj =0.54\n", - "print \"Vj =\",Vj,\"V\" # initializing value of built in voltage .\n", - "Va=10\n", - "print \"Va = \",Va,\"V\" # initializing value of applied reverse voltage .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "Er=11.9\n", - "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "E=Eo*Er\n", - "print \"total permittivity ,E=Eo∗Er= \",E,\" F/cm\" # calculation .\n", - "Cj=sqrt((e*E*A**2/(2*(Va+Vj)))*((Na*Nd)/(Na+Nd)))\n", - "print \"Cj=sqrt((e∗E∗Aˆ2/(2∗(Va+Vj))∗((Na∗Nd)/(Na+Nd))))=\",Cj,\"f/cmˆ2\" # calculation .\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_15 pgno: 146" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na= 1000000000000000 cmˆ−3\n", - "Nd= 1000000000000000000 cmˆ−3\n", - "no = 1800000.0 cmˆ−3\n", - "e = 1.6e-19 columbs\n", - "K = 1.38e-23 J/k\n", - "T = 300 K\n", - "Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd)/(no)ˆ2))= 1.220749215 V\n" - ] - } - ], - "source": [ - "#exa 5.15\n", - "Na =10**15\n", - "print \"Na= \",Na,\"cmˆ−3\" # initializing value of acceptor concentration .\n", - "Nd =10**18\n", - "print \"Nd= \",Nd,\" cmˆ−3\" # initializing value of donor concentration .\n", - "no=1.8*10**6\n", - "print \"no = \",no,\" cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columbs\" # initializing value of charge of electrons .\n", - "K=1.38*10**-23\n", - "print \"K = \",K,\" J/k\" # initializing value of boltzmann constant .\n", - "T=300\n", - "print \"T = \",T,\" K\" # initializing value of temperature .\n", - "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", - "print \"Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd)/(no)ˆ2))= \",Vbi,\"V\" # calculation .\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_16 pgno: 146" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na= 1000000000000000000 cmˆ−3\n", - "Nd= 1000000000000000000 cmˆ−3\n", - "Vbi = 1.4\n", - "e = 1.6e-19 columbs\n", - "K = 1.38e-23 J/k\n", - "T = 300 K\n", - "Vt = 0.0259 eV\n", - "no=sqrt ((Na∗Nd)/(exp(Vbi/Vt)))= 1829411.05814 cmˆ−3\n" - ] - } - ], - "source": [ - "#5.16\n", - "Na =10**18\n", - "print \"Na= \",Na, \"cmˆ−3\" # initializing value of acceptor concentration .\n", - "Nd =10**18\n", - "print \"Nd= \",Nd,\" cmˆ−3\" # initializing value of donor concentration .\n", - "Vbi =1.4\n", - "print \"Vbi = \",Vbi # initializing value of built in voltage .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\" columbs\" # initializing value of charge of electrons .\n", - "K=1.38*10**-23\n", - "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", - "T=300\n", - "print \"T = \",T,\" K\" # initializing value of temperature .\n", - "Vt=0.0259\n", - "print \"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "no=sqrt((Na*Nd)/(exp(Vbi/Vt)))\n", - "print \"no=sqrt ((Na∗Nd)/(exp(Vbi/Vt)))=\",no,\"cmˆ−3\" #calculation ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_18 pgno: 147" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 100000000000000000 cmˆ−3\n", - "Nd = 50000000000000000 cmˆ−3\n", - "e = 1.6e-19 columbs\n", - "no = 15000000000.0 cmˆ3\n", - "T = 300 K\n", - "Vt = 0.0259 eV\n", - "(a)Vbi=(Vt∗(log(Na∗Nd/(noˆ2))))= 0.795961750143 V\n", - "(b)value of fermi level on each side of junction ,Efi Efp=(Vt∗log(Na/(no)))= 0.40695713106 V\n", - "Efn Efi=(Vt∗log(Nd/(no)))= 0.389004619083 V\n", - "(c)The energy band digram is similar to Fig P5 .3\n", - "(d)Vbi=((Efi Efp)+(Efn Efi))/(e)=Vj= 0.795961750143 V\n" - ] - } - ], - "source": [ - "#exa 5.18\n", - "Na =10**17\n", - "print \"Na = \",Na,\" cmˆ−3\" # initializing value of acceptor concentration .\n", - "Nd =5*10**16\n", - "print \"Nd = \",Nd,\" cmˆ−3\" # initializing value of donor concentration .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\" columbs\" # initializing value of charge of electrons .\n", - "no=1.5*10**10\n", - "print \"no = \",no,\" cmˆ3\" # initializing value of intrinsic carrier concentration .\n", - "T=300\n", - "print \"T = \",T,\" K\" # initializing value of temperature .\n", - "Vt=0.0259\n", - "print \"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "Vbi=(Vt*(log(Na*Nd/(no**2))))\n", - "print \"(a)Vbi=(Vt∗(log(Na∗Nd/(noˆ2))))= \",Vbi,\" V\" #calculation .\n", - "Efi_Efp=(Vt*log(Na/(no)))\n", - "print \"(b)value of fermi level on each side of junction ,Efi Efp=(Vt∗log(Na/(no)))=\",Efi_Efp,\" V\" # calculation .\n", - "Efn_Efi=(Vt*log(Nd/(no)))\n", - "print \"Efn Efi=(Vt∗log(Nd/(no)))=\",Efn_Efi,\" V\" #calculation .\n", - "print \"(c)The energy band digram is similar to Fig P5 .3\"\n", - "Vbi=((Efi_Efp)+(Efn_Efi))\n", - "print \"(d)Vbi=((Efi Efp)+(Efn Efi))/(e)=Vj=\",Vbi,\" V\" # calculation .\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_19 pgno: 148" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 500000000000000000 /cmˆ3\n", - "Nd = 500000000000000000 /cmˆ3\n", - "no = 15000000000.0 cmˆ−3\n", - "e = 1.6e-19 columbs\n", - "K = 1.38e-23 J/k\n", - "T = 300 K\n", - "(a)Built in potential potential ,Vbi=((K∗T/e)∗log ((Na∗Nd)/(no)ˆ2))= 0.896417042561 eV\n", - "(b)fermi level in the P region and N region , Efi Efp=((KT/e)∗log(Na/no)))= 0.44820852128 eV\n", - "(c)VBI from the fermi level ,VBI=2∗(Efi Efp))= 0.896417042561 V\n" - ] - } - ], - "source": [ - "#exa 5.19\n", - "from math import log\n", - "Na =5*10**17\n", - "print \"Na = \",Na,\"/cmˆ3\" # initializing value of medium p doping concentration .\n", - "Nd =5*10**17\n", - "print \"Nd = \",Nd,\"/cmˆ3\" # initializing value of light n doping .\n", - "no=1.5*10**10\n", - "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columbs\" # initializing value of charge of electrons .\n", - "K=1.38*10**-23\n", - "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", - "T=300\n", - "print \"T = \",T,\"K\" # initializing value of temperature .\n", - "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", - "print \"(a)Built in potential potential ,Vbi=((K∗T/e)∗log ((Na∗Nd)/(no)ˆ2))=\",Vbi,\"eV\" #calculation .\n", - "Efi_Efp=((K*T/e)*log(Na/no))\n", - "print \"(b)fermi level in the P region and N region , Efi Efp=((KT/e)∗log(Na/no)))= \",Efi_Efp,\"eV\" # calculation .\n", - "VBI=2*(Efi_Efp)\n", - "print \"(c)VBI from the fermi level ,VBI=2∗(Efi Efp))=\",VBI,\"V\" # calculation ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_20 pgno: 148" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nc = 2.8e+19 /cmˆ3\n", - "Nv = 1.04e+19 /cmˆ3\n", - "no = 15000000000.0 cmˆ−3\n", - "e = 1.6e-19 columbs\n", - "K = 8.62e-05 J/k\n", - "T = 300 K\n", - "Vt = 0.0259 eV\n", - "Ec Ef = 0.21 eV\n", - "Ef Ev = 0.18 eV\n", - "Nd=(Nc/exp((Ec−Ef)/(K∗T))))= 8.32539212771e+15 cmˆ−3\n", - "Na=(Nv/exp (( Ef−Ev) /(K∗T) ) ) )= 9.86510951303e+15 cmˆ−3\n", - "Built in potential ,Vbi=(Vt∗(log(Na∗Nd/(noˆ2))))= 0.68954178887 V\n" - ] - } - ], - "source": [ - "#exa 5.20\n", - "Nc=2.8*10**19\n", - "print \"Nc = \",Nc,\" /cmˆ3\" # initializing value of number of electron in the conduction band .\n", - "Nv=1.04*10**19\n", - "print \"Nv = \",Nv,\" /cmˆ3\" # initializing value of number of electron in the valence band..\n", - "no=1.5*10**10\n", - "print \"no = \",no,\" cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\" columbs\" # initializing value of charge of electrons .\n", - "K=8.62*10**-5\n", - "print \"K = \",K,\" J/k\" # initializing value of boltzmann constant .\n", - "T=300\n", - "print \"T = \",T,\" K\" # initializing value of temperature .\n", - "Vt=0.0259\n", - "print \"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "Ec_Ef =0.21\n", - "print \"Ec Ef = \",Ec_Ef,\" eV\" # initializing value of energy difference between conduction band and fermi level.\n", - "Ef_Ev =0.18\n", - "print \"Ef Ev = \",Ef_Ev,\" eV\" # initializing value of energy difference between fermi level and valence band .\n", - "Nd=(Nc/exp((Ec_Ef)/(K*T)))\n", - "print \"Nd=(Nc/exp((Ec−Ef)/(K∗T))))= \",Nd,\" cmˆ−3\" #calculation .\n", - "Na=(Nv/exp((Ef_Ev)/(K*T)))\n", - "print \"Na=(Nv/exp (( Ef−Ev) /(K∗T) ) ) )=\",Na,\"cmˆ−3\" # calculation .\n", - "Vbi=(Vt*(log(Na*Nd/(no**2))))\n", - "print \"Built in potential ,Vbi=(Vt∗(log(Na∗Nd/(noˆ2))))= \",Vbi,\" V\" #calculation ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_21 pgno: 149" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Vbi = 1.2 /cmˆ3\n", - "no = 1800000.0 cmˆ−3”\n", - "Vt = 0.0259 eV\n", - "Er = 13.1\n", - "Eo = 8.854e-14 F/cm\n", - "e = 1.6e-19 columbs\n", - " total permittivity ,E=Eo∗Er= 1.159874e-12 F/cm\n", - "(a)NaNd=((noˆ2)∗(exp(Vbi/Vt)))= 4.28841757806e+32 /cmˆ6\n", - "Na=(sqrt(NaNd/(4)))= 1.03542474112e+16 /cmˆ3\n", - "(b)Nd=4∗Na= 4.14169896446e+16 /cmˆ3\n", - "(c)W=sqrt((2∗E∗Vbi/e)∗((Nd+Na)/(Na∗Nd))))= 4.58296745959e-05 cm\n", - "(d)xn=0.2∗W= 9.16593491919e-06 cm\n", - "xp=0.8∗W= 3.66637396767e-05 cm\n", - "(e)Emax=(−e∗Nd∗xn)/E)= -52367.8167292 V/cm\n" - ] - } - ], - "source": [ - "#exa 5.21\n", - "from math import sqrt\n", - "from math import exp\n", - "Vbi =1.2\n", - "print \"Vbi = \",Vbi,\"/cmˆ3\" # initializing value of built in voltage .\n", - "no=1.8*10**6\n", - "print \"no = \",no,\"cmˆ−3”\" # initializing value of intrinsic concentration .\n", - "Vt =0.0259\n", - "print \"Vt = \",Vt,\"eV\" # initializing value of thermal voltage .\n", - "Er =13.1\n", - "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "e =1.6*(10**-19)\n", - "print \"e = \",e,\" columbs\" # initializing value of charge of electrons .\n", - "E=Eo*Er\n", - "print \" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation .\n", - "NaNd=((no**2)*(exp(Vbi/Vt)))\n", - "print \"(a)NaNd=((noˆ2)∗(exp(Vbi/Vt)))= \",NaNd,\" /cmˆ6\" # calculation .\n", - "Na=(sqrt(NaNd/(4)))\n", - "print \"Na=(sqrt(NaNd/(4)))=\",Na,\" /cmˆ3\" # calculation .\n", - "Nd=4*Na\n", - "print \"(b)Nd=4∗Na= \",Nd,\" /cmˆ3\" # calculation.\n", - "W=sqrt((2*E*Vbi/e)*((Nd+Na)/(Na*Nd)))\n", - "print \"(c)W=sqrt((2∗E∗Vbi/e)∗((Nd+Na)/(Na∗Nd))))= \",W,\" cm\" # calculation .\n", - "xn=0.2*W\n", - "print \"(d)xn=0.2∗W= \",xn,\" cm\" # calculation .\n", - "xp=0.8*W\n", - "print \"xp=0.8∗W= \",xp,\" cm\" # calculation .\n", - "Emax=(-e*Nd*xn)/E\n", - "print \"(e)Emax=(−e∗Nd∗xn)/E)= \",Emax,\"V/cm\" # calculation .\n", - "#The value of Na after calculation is provided wrong in the book.Due to which value of W,xn,xp and Emax differ ,than the answer provided in the book ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_22 pgno: 150" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 10000000000000000 cmˆ−3\n", - "Nd = 5000000000000000 cmˆ−3\n", - "no = 15000000000.0 cmˆ−3\n", - "Vbi = 0.676 V\n", - "e = 1.6e-19 columns\n", - "K = 1.38e-23 J/k\n", - "T=(Vbi∗(e/K)∗(1/(log((Na∗Nd)/(noˆ2))))))= 299.984615257 K\n" - ] - } - ], - "source": [ - "#exa 5.22\n", - "from math import log\n", - "Na =10**16\n", - "print \"Na = \",Na,\"cmˆ−3\" # initializing value of acceptor concentration .\n", - "Nd =5*10**15\n", - "print \"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration .\n", - "no=1.5*10**10\n", - "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration .\n", - "Vbi =0.676\n", - "print \"Vbi = \",Vbi,\"V\" # initializing value of built in voltage .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "K=1.38*10**-23\n", - "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", - "T=(Vbi*(e/K)*(1/(log((Na*Nd)/(no**2)))))\n", - "print \"T=(Vbi∗(e/K)∗(1/(log((Na∗Nd)/(noˆ2))))))= \",T,\"K\" # calculation ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_23 pgno: 150" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 500000000000000000 cmˆ−3\n", - "Nd = 100000000000000000 cmˆ−3\n", - "no = 15000000000.0 cmˆ−3\n", - "e = 1.6e-19 columns\n", - "K = 1.38e-23 J/k\n", - "T = 300 K\n", - "VBI = 0.847 V\n", - "(a)Built in potential potential ,Vbi=((K∗T/e)∗log ((Na∗Nd)/(no)ˆ2))= 0.854772836577 V\n", - "(b)T=(VBI∗(e/K)∗(1/(log((Na∗Nd)/(noˆ2))))))= 297.271964113 K\n" - ] - } - ], - "source": [ - "#exa 5.23\n", - "Na =5*10**17\n", - "print \"Na = \",Na,\"cmˆ−3\" # initializing value of acceptor concentration .\n", - "Nd =10**17\n", - "print \"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration .\n", - "no=1.5*10**10\n", - "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "K=1.38*10**-23\n", - "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", - "T=300\n", - "print \"T = \",T,\"K\" # initializing value of temperature .\n", - "VBI=0.847\n", - "print \"VBI = \",VBI,\"V\" # initializing value of VBI when VBI is reduced by 1%.\n", - "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", - "print \"(a)Built in potential potential ,Vbi=((K∗T/e)∗log ((Na∗Nd)/(no)ˆ2))= \",Vbi,\"V\" # calculation .\n", - "T=(e*VBI/K)*((log(Na*Nd/(no**2)))**-1)\n", - "print \"(b)T=(VBI∗(e/K)∗(1/(log((Na∗Nd)/(noˆ2))))))= \",T,\"K\" # calculation .\n", - "#the answer for part (b) is not provided in the book ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_24 pgno: 150" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false, - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 4e+12 /cmˆ3\n", - "Nd = 4e+16 /cmˆ3\n", - "no = 1.5e+11 /cmˆ3\n", - "K = 1.38e-23 J/k\n", - "T = 300 K\n", - "e = 1.6e-19 columbs\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd)/(no)ˆ2))= 0.408234249531 eV\n", - "W=sqrt((2∗E∗Vbi/e)∗((Nd+Na)/(Na∗Nd))))= 0.00115943039897 cm\n", - "xn=((W∗Na) /(Nd+Na) ) )= 1.15931446752e-07 cm\n", - "xp=((W∗Nd) /(Nd+Na) ) )= 0.00115931446752 cm\n", - "Emax=(e∗Nd∗xn)/E)= 704.19794046 V/cm\n" - ] - } - ], - "source": [ - "#exa 5.24\n", - "from math import log\n", - "from math import sqrt\n", - "Na =4e12\n", - "print \"Na = \",Na,\" /cmˆ3\" # initializing value of medium p doping concentration .\n", - "Nd =4e16\n", - "print \"Nd = \",Nd,\" /cmˆ3\" # initializing value of light n doping.\n", - "no=1.5*10e10\n", - "print \"no = \",no,\" /cmˆ3\" # initializing value of intrinsic carrier concentration .\n", - "K=1.38e-23\n", - "print \"K = \",K,\" J/k\" # initializing value of boltzmann constant .\n", - "T=300\n", - "print \"T = \",T,\" K\" # initializing value of temperature .\n", - "e=1.6e-19\n", - "print \"e = \",e,\" columbs\" # initializing value of charge of electrons .\n", - "Er=11.9\n", - "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854e-14\n", - "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "E=Eo*Er\n", - "print \"total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation .\n", - "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", - "print \"Built in potential potential ,Vbi=((K∗T/e)∗log((Na∗Nd)/(no)ˆ2))=\",Vbi,\" eV\" #calculation .\n", - "W=sqrt((2.*E*Vbi/e)*((Nd+Na)/(Na*Nd)))\n", - "print\"W=sqrt((2∗E∗Vbi/e)∗((Nd+Na)/(Na∗Nd))))=\",W,\" cm\" # calculation .\n", - "xn=((W*Na)/(Nd+Na))\n", - "print \"xn=((W∗Na) /(Nd+Na) ) )=\",xn,\"cm\" # calculation .\n", - "xp=((W*Nd)/(Nd+Na))\n", - "print \"xp=((W∗Nd) /(Nd+Na) ) )=\",xp,\"cm\" #calculation .\n", - "Emax=(e*Nd*xn)/E\n", - "print \"Emax=(e∗Nd∗xn)/E)=\",Emax,\" V/cm\" #calculation .\n", - "#the value of W( depletion width) , after calculation is provided wrong in the book,due to this xn,xp ,Emax also differ.(also,the value of Nd+Na substitute in the formula for for xn,xp is wrong )" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_25 pgno: 151" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 400000000000000000 /cmˆ3\n", - "Nd = 4000000000000000 /cmˆ3\n", - "no = 15000000000.0 cmˆ−3\n", - "Emax = 300000 /cmˆ3\n", - "K = 1.38e-23 J/k\n", - "T = 300 K\n", - "e = 1.6e-19 columns\n", - " Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "Built in potential potential ,Vbi=((K∗T/e)∗log ((Na∗Nd)/(no)ˆ2))= 0.765710585218 V\n", - "xn=(E∗Emax) /( e∗Nd) )= 0.0004938871875 cm\n", - "W=(xn(Nd+Na)/Na))= 0.000498826059375 cm\n", - "Vr=(Wˆ2∗e/(2∗E))∗((Na∗Nd)/(Na+Nd))−(Vbi))= 74.058198321 V\n" - ] - } - ], - "source": [ - "#exa 5.25\n", - "Na =4*10**17\n", - "print \"Na = \",Na,\"/cmˆ3\" # initializing value of donor concentration .\n", - "Nd =4*10**15\n", - "print \"Nd = \",Nd,\"/cmˆ3\" # initializing value of light n doping.\n", - "no=1.5*10**10\n", - "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration .\n", - "Emax =300*10**3\n", - "print \"Emax = \",Emax,\"/cmˆ3\" # initializing value of maximum electric field .\n", - "K=1.38*10**-23\n", - "print \"K = \",K,\"J/k\" # initializing value of boltzmann constant .\n", - "T=300\n", - "print \"T = \",T,\"K\" # initializing value of temperature .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "Er=11.9\n", - "print \" Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "E=Eo*Er\n", - "print \" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation .\n", - "Vbi=((K*T/e)*log((Na*Nd)/(no)**2))\n", - "print \"Built in potential potential ,Vbi=((K∗T/e)∗log ((Na∗Nd)/(no)ˆ2))=\",Vbi,\" V\" # calculation .\n", - "xn=(E*Emax/(Nd*e))\n", - "print \"xn=(E∗Emax) /( e∗Nd) )=\",xn,\" cm\" #calculation .\n", - "W=(xn*(Nd+Na)/Na)\n", - "print \"W=(xn(Nd+Na)/Na))=\",W,\" cm\" #calculation .\n", - "Vr=((W**2*e/(2*E))*((Na*Nd)/(Na+Nd)))-(Vbi)\n", - "print \"Vr=(Wˆ2∗e/(2∗E))∗((Na∗Nd)/(Na+Nd))−(Vbi))=\",Vr,\" V\" # calculation ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_26 pgno: 152" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 5000000000000000 cmˆ−3\n", - "Nd = 1000000000000000000 cmˆ−3\n", - "e = 1.6e-19 columns\n", - "Vr = 10 V\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "Emax = 1000000 V/cm\n", - "W = 2e-05 cm\n", - "Nd=(Emax∗e)/(W∗e))= 3.29258125e+17 cmˆ−3\n" - ] - } - ], - "source": [ - "#exa 5.26\n", - "Na =5*10**15\n", - "print \"Na = \",Na,\"cmˆ−3\" # initializing value of acceptor concentration .\n", - "Nd =10**18\n", - "print \"Nd = \",Nd,\"cmˆ−3\" # initializing value of donor concentration .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "Vr=10\n", - "print \"Vr = \",Vr,\"V\" # initializing value reverse voltage .\n", - "Er=11.9\n", - "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print \"Eo = \",Eo,\"F/cm\" # initializing value of permittivity of free space .\n", - "E=Eo*Er\n", - "print \" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation .\n", - "Emax=10**6\n", - "print \"Emax = \",Emax,\"V/cm\" # initializing value of maximum electric field .\n", - "W=(2.*Vr/(Emax))\n", - "print \"W = \",W,\"cm\" # calculation .\n", - "Nd=(Emax*E)/(W*e)\n", - "print \"Nd=(Emax∗e)/(W∗e))=\",Nd,\"cmˆ−3\" # calculation " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_27 pgno: 152" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 5000000000000000 cmˆ3\n", - "Nd = 1000000000000000000 cmˆ3\n", - "no = 15000000000.0 cmˆ−3\n", - "Vr1 = 0 V\n", - "Vr2 = 5 V\n", - "A = 3e-05 cmˆ2\n", - "e = 1.6e-19 columns\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "Vt= 0.0259 V\n", - "Built in potential ,Vbi=(Vt∗log ((Na∗Nd)/(no)ˆ2) )= 0.795961750143 V\n", - "Cj1=sqrt((e∗E∗(Aˆ2)/(2∗(Vr1+Vbi))∗((Na∗Nd)/(Na+Nd))))= 6.88597370389e-13 F\n", - "Cj2=sqrt((e∗E∗(Aˆ2)/(2∗(Vr2+Vbi))∗((Na∗Nd)/(Na+Nd))))= 2.55181216611e-13 F\n" - ] - } - ], - "source": [ - "#exa 5.27\n", - "from math import sqrt\n", - "from math import log\n", - "Na =5*10**15\n", - "print \"Na = \",Na,\"cmˆ3\" # initializing value of acceptor concentration .\n", - "Nd =10**18\n", - "print \"Nd = \",Nd,\"cmˆ3\" # initializing value of donor concentration .\n", - "no=1.5*10**10\n", - "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", - "Vr1=0\n", - "print \"Vr1 = \",Vr1,\"V\" # initializing value of built in voltage .\n", - "Vr2=5\n", - "print \"Vr2 = \",Vr2,\"V\" # initializing value of applied reverse voltage .\n", - "A=3*10**-5\n", - "print \"A = \",A,\"cmˆ2\" # initializing value of cross sectional area .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "Er=11.9\n", - "print \"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print \"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "E=Eo*Er\n", - "print \"total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation .\n", - "Vt=0.0259\n", - "print \"Vt=\",Vt,\" V\" # initializing the value of thermal voltage .\n", - "Vbi=((Vt)*log((Na*Nd)/(no)**2))\n", - "print \"Built in potential ,Vbi=(Vt∗log ((Na∗Nd)/(no)ˆ2) )= \",Vbi,\" V\" # calculation .\n", - "Cj1=sqrt((e*E*(A**2)/(2*(Vr1+Vbi)))*((Na*Nd)/(Na+Nd)))\n", - "print \"Cj1=sqrt((e∗E∗(Aˆ2)/(2∗(Vr1+Vbi))∗((Na∗Nd)/(Na+Nd))))=\",Cj1,\" F\" #calculation .\n", - "Cj2=sqrt((e*E*(A**2)/(2*(Vr2+Vbi)))*((Na*Nd)/(Na+Nd)))\n", - "print \"Cj2=sqrt((e∗E∗(Aˆ2)/(2∗(Vr2+Vbi))∗((Na∗Nd)/(Na+Nd))))=\",Cj2,\" F\" #calculation .\n", - "# the value of Vr2 use for calculating answer of Cj2 is different than provided in question .\n", - "# I have used the value provided in the solution ( i .e. Vr2=5)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_28 pgno: 153" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 10000000000000000 cmˆ3\n", - "Nd = 50000000000000000 cmˆ3\n", - "no = 15000000000.0 cmˆ−3\n", - "Dn = 25 cmˆ2/sec\n", - "Dp = 10 cmˆ2/sec\n", - "tn = 5e-07 s\n", - "tp = 5e-07 s\n", - "e = 1.6e-19 columns\n", - "Pno=(noˆ2/Nd))= 4500.0 cmˆ−3\n", - "Npo=(noˆ2/Na))= 22500.0 cmˆ−3\n", - "Lp=(sqrt(Dp∗tp)))= 0.0022360679775 cm\n", - "Ln=(sqrt(Dn∗tn)))= 0.00353553390593 cm\n", - "Jo=((e ∗((Dp∗Pno/(Lp) )+(Dn∗Npo) /(Ln) ) ) )= 2.86757820103e-11 A/cmˆ2\n" - ] - } - ], - "source": [ - "#exa 5.28\n", - "from math import sqrt\n", - "Na =1*10**16\n", - "print \"Na = \",Na,\"cmˆ3\" # initializing value of acceptor concentration. \n", - "Nd = 5*10**16\n", - "print \"Nd = \",Nd,\"cmˆ3\" # initializing value of donor concentration .\n", - "no=1.5*10**10\n", - "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic concentration .\n", - "Dn=25\n", - "print \"Dn = \",Dn,\"cmˆ2/sec\" # initializing value of diffusion cofficient on the P side.\n", - "Dp=10\n", - "print \"Dp = \",Dp,\"cmˆ2/sec\" # initializing value of diffusion cofficient on the N side .\n", - "tp =5*10** -7\n", - "print \"tn = \",tp,\"s\" # initializing value of hole lifetime .\n", - "tn =5*10** -7\n", - "print \"tp = \",tn,\"s\" # initializing value of electron lifetime .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "Pno=(no**2/Nd)\n", - "print \"Pno=(noˆ2/Nd))= \",Pno,\"cmˆ−3\" # calculation .\n", - "Npo=(no**2/Na)\n", - "print \"Npo=(noˆ2/Na))= \",Npo,\"cmˆ−3\" # calculation .\n", - "Lp=(sqrt(Dp*tp))\n", - "print \"Lp=(sqrt(Dp∗tp)))= \",Lp,\"cm\" # calculation .\n", - "Ln=(sqrt(Dn*tn))\n", - "print \"Ln=(sqrt(Dn∗tn)))= \",Ln,\"cm\" # calculation .\n", - "Jo=((e*((Dp*Pno/(Lp))+(Dn*Npo)/(Ln))))\n", - "print \"Jo=((e ∗((Dp∗Pno/(Lp) )+(Dn∗Npo) /(Ln) ) ) )= \",Jo,\" A/cmˆ2\" # calculation ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_29 pgno: 154" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 1000000000000000 cmˆ3\n", - "Nd = 1000000000000000 cmˆ3\n", - "no = 15000000000.0 cmˆ−3\n", - "Dn = 50 cmˆ2/sec\n", - "Dp = 20 cmˆ2/sec\n", - "tn = 5e-07 s\n", - "tp = 5e-07 s\n", - "e = 1.6e-19 columns\n", - "Pno=(noˆ2/Nd))= 225000.0 cmˆ−3\n", - "Npo=(noˆ2/Na))= 225000.0 cmˆ−3\n", - "Lp=(sqrt(Dp∗tp)))= 0.00316227766017 cm\n", - "Ln=(sqrt(Dn∗tn)))= 0.005 cm\n", - "Jo=((e ∗((Dp∗Pno/(Lp) )+(Dn∗Npo) /(Ln))))= 5.87683991532e-10 A/cmˆ2\n" - ] - } - ], - "source": [ - "#exa 5.29\n", - "from math import sqrt\n", - "Na =10**15\n", - "print \"Na = \",Na,\"cmˆ3\" # initializing value of acceptor concentration .\n", - "Nd =10**15\n", - "print \"Nd = \",Nd,\"cmˆ3\" # initializing value of donor concentration .\n", - "no=1.5*10**10\n", - "print \"no = \",no,\"cmˆ−3\" # initializing value of intrinsic carrier concentration .\n", - "Dn=50\n", - "print \"Dn = \",Dn,\"cmˆ2/sec\" # initializing value of built in voltage .\n", - "Dp=20\n", - "print \"Dp = \",Dp,\"cmˆ2/sec\" # initializing value of applied reverse voltage .\n", - "tp =5*10** -7\n", - "print \"tn = \",tp,\"s\" # initializing value of hole lifetime .\n", - "tn =5*10** -7\n", - "print \"tp = \",tn,\"s\" # initializing value of electrons lifetime .\n", - "e=1.6*10**-19\n", - "print \"e = \",e,\"columns\" # initializing value of charge of electrons .\n", - "Pno=(no**2/Nd)\n", - "print \"Pno=(noˆ2/Nd))= \",Pno,\"cmˆ−3\" # calculation .\n", - "Npo=(no**2/Na)\n", - "print \"Npo=(noˆ2/Na))= \",Npo,\"cmˆ−3\" # calculation .\n", - "Lp=(sqrt(Dp*tp))\n", - "print \"Lp=(sqrt(Dp∗tp)))= \",Lp,\"cm\" # calculation .\n", - "Ln=(sqrt(Dn*tn))\n", - "print \"Ln=(sqrt(Dn∗tn)))= \",Ln,\"cm\" # calculation .\n", - "Jo=((e*((Dp*Pno/(Lp))+(Dn*Npo)/(Ln))))\n", - "print \"Jo=((e ∗((Dp∗Pno/(Lp) )+(Dn∗Npo) /(Ln))))=\",Jo,\"A/cmˆ2\" # calculation .\n", - "# the value of tp , tn provided in the question , is different than that provided in the solution.\n", - "# I have used the value ,provided in the solution(i. e . tp=tn =5∗10ˆ7)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_30 pgno: 154" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Eg = -1.1 V\n", - "Vf1 = 0.6 V\n", - "T1 = 300 K\n", - "T2 = 310 K\n", - "Forward voltage for case 2,Vf2=((Eg+Vf1)∗T2)/( T1)+Eg)= 0.583333333333 V\n" - ] - } - ], - "source": [ - "#exa 5.30\n", - "Eg = -1.1\n", - "print \"Eg = \",Eg,\"V\" # initializing value of energy gap .\n", - "Vf1 =0.6\n", - "print \"Vf1 = \",Vf1,\"V\" # initializing value of forward voltage for case 1.\n", - "T1 =300\n", - "print \"T1 = \",T1,\"K\" # initializing value of temperature for case 1.\n", - "T2 =310\n", - "print \"T2 = \",T2,\"K\" # initializing value of temperature for case 2 .\n", - "Vf2=(((Eg+Vf1)*T2)/(T1))-Eg\n", - "print \"Forward voltage for case 2,Vf2=((Eg+Vf1)∗T2)/( T1)+Eg)= \",Vf2,\" V\" # calculation .\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_7_BIPOLAR_JUNCTION_TRANSISTORB.ipynb b/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_7_BIPOLAR_JUNCTION_TRANSISTORB.ipynb deleted file mode 100755 index bbe984b6..00000000 --- a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_7_BIPOLAR_JUNCTION_TRANSISTORB.ipynb +++ /dev/null @@ -1,496 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# chapter 7 BIPOLAR JUNCTION TRANSISTORB" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_1 pgno: 220" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Dnb = 20 cmˆ2/s\n", - "nB = 10000 /cmˆ3\n", - "xB = 1e-06 m\n", - "AB = 0.0001 cmˆ2\n", - "e = 1.6e-19 columns\n", - "Vbe = 0.5 V\n", - "VT = 0.0259 V\n", - "WB = 0.0001 cm\n", - "Magnitude of Io , Io=((e∗AB∗Dnb∗nB)/(WB)))= 3.2e-14 A\n", - "Collector current ,Ic=Io((exp(Vbe/VT))−1))= 7.7484232166e-06 A\n" - ] - } - ], - "source": [ - "#exa 7.1\n", - "from math import exp\n", - "Dnb =20\n", - "print\"Dnb = \",Dnb,\" cmˆ2/s\" #initializiation the value of one of base parametre of NPN transistor .\n", - "nB =10**4\n", - "print\"nB = \",nB,\" /cmˆ3\" # initializiation the value of one of base parametre of NPN transistor .\n", - "xB =1*10**-6\n", - "print\"xB = \",xB,\" m\" # initializiation the value of one of base parametre of NPN transistor .\n", - "AB =10**-4\n", - "print\"AB = \",AB,\" cmˆ2\" #initializiation the value of one of base parametre of NPN transistor .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializiation the value of electronic charge .\n", - "Vbe=0.5\n", - "print\"Vbe = \",Vbe,\" V\" # initializiation the value of base emitter voltage of NPN transistor ..\n", - "VT=0.0259\n", - "print\"VT = \",VT,\" V\" # initializiation the value of threshold voltage .\n", - "WB=10**-4\n", - "print\"WB = \",WB,\" cm\" # initializiation the value of base width of NPN transistor .\n", - "Io=((e*AB*Dnb*nB)/(WB))\n", - "print\"Magnitude of Io , Io=((e∗AB∗Dnb∗nB)/(WB)))=\",Io,\" A\"# calculation\n", - "Ic=Io*(exp(Vbe/VT)-1)\n", - "print\"Collector current ,Ic=Io((exp(Vbe/VT))−1))=\",Ic,\" A\"# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_2 pgno: 221" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "NE = 500000000000000000 /cmˆ3\n", - "NB = 10000000000000000 /cmˆ3\n", - "NC = 1000000000000000 /cmˆ3\n", - "WB = 8e-05 cm\n", - "no = 15000000000.0 cmˆ−3\n", - "Number of Majority holes in the emitter ,pEO=(noˆ2/NE) )= 450.0 /cmˆ3\n", - "Number of Majority holes in the base,nBO=(no ˆ2/NB))= 22500.0 /cmˆ3\n", - "Number of Majority holes in the collector ,pCO=(noˆ2/NC) )= 225000.0 /cmˆ3\n" - ] - } - ], - "source": [ - "#exa 7.2\n", - "NE =5*10**17\n", - "print\"NE = \",NE,\" /cmˆ3\" # initializiation the value of doping concentration in the emitter\n", - "NB =10**16\n", - "print\"NB = \",NB,\" /cmˆ3\" # initializiation the value of doping concentration in the base.\n", - "NC =10**15\n", - "print\"NC = \",NC,\" /cmˆ3\" # initializiation the value of doping concentration in the collector .\n", - "WB =0.8*10**-4\n", - "print\"WB = \",WB,\" cm\" # initializiation the value of base width of NPN transistor .\n", - "no=1.5*10**10\n", - "print\"no = \",no,\"cmˆ−3\" # initializing the intrinsic carrier concentration .\n", - "pEO=(no**2/NE)\n", - "print\"Number of Majority holes in the emitter ,pEO=(noˆ2/NE) )=\",pEO,\" /cmˆ3\"# calculationnBO=(no^2/NB)\n", - "nBO=(no**2/NB)\n", - "print\"Number of Majority holes in the base,nBO=(no ˆ2/NB))=\",nBO,\" /cmˆ3\"#calculation\n", - "pCO=(no**2/NC)\n", - "print\"Number of Majority holes in the collector ,pCO=(noˆ2/NC) )=\",pCO,\" /cmˆ3\"# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_3 pgno: 221" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "NE = 500000000000000000 /cmˆ3\n", - "NB = 10000000000000000 /cmˆ3\n", - "NC = 1000000000000000 /cmˆ3\n", - "WB = 8e-05 cm\n", - "no = 15000000000.0 cmˆ−3\n", - "VT = 0.0259 V\n", - "VJ=Vbe = 0.6258 V\n", - "Number of Majority holes in the emitter ,pEO=(noˆ2/NE) )= 450.0 /cmˆ3\n", - "Number of Majority holes in the base,nBO=(no ˆ2/NB))= 22500.0 /cmˆ3\n", - "Number of Majority holes in the collector ,pCO=(noˆ2/NC) )= 225000.0 /cmˆ3\n", - "pE(O)=pEO∗( exp (VJ/VT) ) )= 1.40186506034e+13 /cmˆ3 \n", - "nB=(nBO∗( exp (VJ/VT) ) ) )= 7.00932530169e+14 /cmˆ3\n" - ] - } - ], - "source": [ - "#exa 7.3\n", - "from math import exp\n", - "NE =5*10**17\n", - "print\"NE = \",NE,\" /cmˆ3\" # initializiation of doping concentration in the emitter .\n", - "NB =10**16\n", - "print\"NB = \",NB,\" /cmˆ3\" # initializiation of doping concentration in the base .\n", - "NC =10**15\n", - "print\"NC = \",NC,\" /cmˆ3\" # initializiation of doping concentration in the collector .\n", - "WB =0.8*10**-4\n", - "print\"WB = \",WB,\" cm\" # initializiation the value of base width of NPN transistor .\n", - "no=1.5*10**10\n", - "print\"no = \",no,\"cmˆ−3\" # initializing the value of intrinsic carrier concentration .\n", - "VT=0.0259\n", - "print\"VT = \",VT,\" V\" # initializiation the value of threshold voltage .\n", - "VJ=0.6258\n", - "print\"VJ=Vbe = \",VJ,\" V\" # initializiation the value of base emitter voltage .\n", - "pEO=(no**2/NE)\n", - "print\"Number of Majority holes in the emitter ,pEO=(noˆ2/NE) )=\",pEO,\" /cmˆ3\"# calculation\n", - "nBO=(no**2/NB)\n", - "print\"Number of Majority holes in the base,nBO=(no ˆ2/NB))=\",nBO,\" /cmˆ3\"#calculation\n", - "pCO=(no**2/NC)\n", - "print\"Number of Majority holes in the collector ,pCO=(noˆ2/NC) )=\",pCO,\" /cmˆ3\"# calculation\n", - "pE=pEO*(exp(VJ/VT))\n", - "print\"pE(O)=pEO∗( exp (VJ/VT) ) )=\",pE, \"/cmˆ3 \" # calculation\n", - "nB=nBO*(exp(VJ/VT))\n", - "print\"nB=(nBO∗( exp (VJ/VT) ) ) )=\",nB,\"/cmˆ3\" # calculation\n", - "#the answer provided in the book for pE,nB is some what different than actual calculated ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_1 pgno: 222" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Db = 10 cmˆ2/s\n", - "Bt = 0.95\n", - "tb = 1e-07 s\n", - "Lp=(sqrt(Db∗tb)))= 0.001 cm\n", - "WB=(Lp∗( acosh (1/Bt) ) )= 0.000323036439272 cm\n" - ] - } - ], - "source": [ - "#exa 7.5\n", - "from math import sqrt\n", - "from math import acosh\n", - "Db=10\n", - "print\"Db = \",Db,\" cmˆ2/s\" # initializiation the value of one of parametere of the transistor .\n", - "Bt =0.95\n", - "print\"Bt = \",Bt # initializiation the value of base transport factor of the transistor.\n", - "tb =10**-7\n", - "print\"tb = \",tb,\" s\" # initializiation the value of one of parametere of the transistor.\n", - "Lp=(sqrt(Db*tb))\n", - "print\"Lp=(sqrt(Db∗tb)))=\",Lp,\" cm\"# calculation\n", - "WB=(Lp*(acosh(1/Bt)))\n", - "print\"WB=(Lp∗( acosh (1/Bt) ) )=\",WB,\"cm\" #calculation," - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_7 pgno: 224" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Jro = 1e-09 A/cmˆ2\n", - "Jo = 1e-12 A/cmˆ2\n", - "Vbe = 0.5 V\n", - "VT = 0.0259 V\n", - "delta (recombination factor)=(1+((Jro/Jo)∗(exp((−Vbe) /(2∗VT) ) ) ) )ˆ−1)= 0.939616412003\n" - ] - } - ], - "source": [ - "#exa 7.7\n", - "from math import exp\n", - "Jro =10**-9\n", - "print\"Jro = \",Jro,\" A/cmˆ2\" # initializiation the value of recombination current density .\n", - "Jo =10**-12\n", - "print\"Jo = \",Jo,\" A/cmˆ2\" # initializiation the value of reverse saturation current density.\n", - "Vbe =0.5\n", - "print\"Vbe = \",Vbe,\" V\" # initializiation the value of base emitter voltage .\n", - "VT =0.0259\n", - "print\"VT = \",VT,\" V\" # initializiation the value of threshold voltage .\n", - "delta=(1+((Jro/Jo)*(exp((-Vbe)/(2*VT)))))**-1\n", - "print\"delta (recombination factor)=(1+((Jro/Jo)∗(exp((−Vbe) /(2∗VT) ) ) ) )ˆ−1)=\",delta # calculation ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_8 pgno: 224" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "NE = 100000000000000000 /cmˆ3\n", - "NB = 1000000000000000 /cmˆ3\n", - "WE = 6e-05 cm\n", - "WB = 8e-05 cm\n", - "no = 15000000000.0 cmˆ−3\n", - "e = 1.6e-19 columns\n", - "DE = 15 cmˆ2/s\n", - "DB = 20 cmˆ2/s\n", - "tE = 2e-07 s\n", - "tB = 1e-07 s\n", - "Vbe = 0.6 V\n", - "VT = 0.0259 V\n", - "Jro = 2e-08 A/cmˆ2\n", - "LE=(sqrt(DE∗tE)))= 0.00173205080757 cm\n", - "LB=(sqrt(DB∗tB)))= 0.00141421356237 cm\n", - "Number of Majority holes in the emitter ,pEO=(noˆ2/NE) )= 2250.0 /cmˆ3\n", - "Number of Majority holes in the base,nBO=(no ˆ2/NB))= 225000.0 /cmˆ3\n", - "Emitter injection efficiency ,Y=(1+((NB∗DE∗LB) /(NE∗DB∗LE)∗(tanh(WB/LB)/tanh(WE/LE)))) )= 0.990105536375\n", - "Base transport factor ,Bt=(cosh(WB/LB))ˆ−1)= 0.998402130561\n", - "Reverse saturation current Density , Jro=((e∗DB∗n BO)/(LB∗tanh(WB/LB)))) = 9.00959795262e-09 A/cmˆ2\n", - "delta(recombination factor)=(1+((Jro/Jo)∗(exp((−Vbe)/(2∗VT)))))ˆ−1)= 0.999979304421 A\n", - "common base current amplification factor ,(alpha=Bt∗delta∗Y)= 0.988503018931\n", - "common emitter current amplification factor ,Beta=(a/(1−a) ) )= 85.9793551861\n" - ] - } - ], - "source": [ - "#exa 7.8\n", - "from math import sqrt\n", - "from math import cosh\n", - "from math import tanh\n", - "NE =1*10**17\n", - "print\"NE = \",NE,\" /cmˆ3\" # initializiation the value of doping concentration of emitter in the NPN transistor .\n", - "NB =10**15\n", - "print\"NB = \",NB,\" /cmˆ3\" # initializiation the value of doping concentration of base in the NPN transistor .\n", - "WE =0.6*10**-4\n", - "print\"WE = \",WE,\" cm\" # initializiation the value of one of parametre of the transistor.\n", - "WB =0.8*10**-4\n", - "print\"WB = \",WB,\" cm\" # initializiation the value of one of parametre of the transistor.\n", - "no=1.5*10**10\n", - "print\"no = \",no,\"cmˆ−3\" # initializing the value of intrinsic carrier concentration .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializiation the value of electronic charge\n", - "DE=15\n", - "print\"DE = \",DE,\" cmˆ2/s\" # initializiation the value of one of parametere of the transistor .\n", - "DB=20\n", - "print\"DB = \",DB,\" cmˆ2/s\" #initializiation the value of one of parametere of the transistor .\n", - "tE =0.2*10**-6\n", - "print\"tE = \",tE,\" s\" # initializiation the value of one of parametere of the transistor.\n", - "tB =0.1*10**-6\n", - "print\"tB = \",tB,\" s\" # initializiation the value of one of parametere of the transistor.\n", - "Vbe=0.60\n", - "print\"Vbe = \",Vbe,\" V\" # initializiation the value of base emitter voltage .\n", - "VT=0.0259\n", - "print\"VT = \",VT,\" V\" # initializiation the value of threshold voltage .\n", - "Jro =2*10**-8\n", - "print\"Jro = \",Jro,\" A/cmˆ2\" # initializiation the value of recombination current density .\n", - "LE=(sqrt(DE*tE))\n", - "print\"LE=(sqrt(DE∗tE)))=\",LE,\" cm\"#calculation\n", - "LB=(sqrt(DB*tB))\n", - "print\"LB=(sqrt(DB∗tB)))=\",LB,\" cm\"#calculation\n", - "pEO=(no**2/NE)\n", - "print\"Number of Majority holes in the emitter ,pEO=(noˆ2/NE) )=\",pEO,\" /cmˆ3\"# calculation\n", - "nBO=(no**2/NB)\n", - "print\"Number of Majority holes in the base,nBO=(no ˆ2/NB))=\",nBO,\" /cmˆ3\"#calculation\n", - "Y=(1+(((NB*DE*LB)/(NE*DB*LE))*((tanh(WB/LB)/tanh(WE/ LE)))))**(-1)\n", - "print\"Emitter injection efficiency ,Y=(1+((NB∗DE∗LB) /(NE∗DB∗LE)∗(tanh(WB/LB)/tanh(WE/LE)))) )=\",Y # calculation\n", - "Bt=(cosh(WB/LB))**-1\n", - "print\"Base transport factor ,Bt=(cosh(WB/LB))ˆ−1)=\",Bt# calculation\n", - "Jo=((e*DB*nBO)/(LB*tanh(WB/LB)))\n", - "print\"Reverse saturation current Density , Jro=((e∗DB∗n BO)/(LB∗tanh(WB/LB)))) = \",Jo, \"A/cmˆ2\" # calculation\n", - "delta=(1+((Jro/Jo)*(exp((-Vbe)/(2*VT)))))**-1\n", - "print\"delta(recombination factor)=(1+((Jro/Jo)∗(exp((−Vbe)/(2∗VT)))))ˆ−1)=\",delta,\" A\"# calculation\n", - "a=Bt*delta*Y\n", - "print\"common base current amplification factor ,(alpha=Bt∗delta∗Y)=\",a # calculation\n", - "B=(a/(1-a))\n", - "print\"common emitter current amplification factor ,Beta=(a/(1−a) ) )=\",B # calculation\n", - "#the value of NE provided in the question is different than used in the solution .\n", - "#I have used the value (while solving) provided in the question ( i . e NE=10ˆ17/cmˆ3) " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_9 pgno: 225" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "NB = 5e+16 /cmˆ3\n", - "NC = 2e+15 /cmˆ3\n", - "WBm = 6e-05 cm\n", - "e = 1.6e-19 columns\n", - "VCB1 = 1 V\n", - "VCB2 = 4 V\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "no = 15000000000.0 cmˆ−3\n", - "VT = 0.0259 V\n", - " VBI=VT∗(log((NB∗NC)/noˆ2))= 0.694640354303 V\n", - "WBS=((2∗Eo∗Er∗(VBI+VCB1)/e)∗(NC/NB)∗(1/(NC+NB)))ˆ(1/2))= 4.14348090604e-06 cm\n", - "Neutral base width for VCB1,WB( neutral )=WBm− WBS1= 5.5856519094e-05 cm\n", - "WBS=((2∗Eo∗Er∗(VBI+VCB2)/e)∗(NC/NB)∗(1/(NC+NB) ))ˆ(1/2))= 1.0 cm\n", - "Neutral base width for VCB2,WB( neutral )=WBm−WBS2= -0.99994 cm\n", - "change in the neutal base width ,deltaWb(neutral )=Wb1−Wb2= 0.999995856519 cm\n" - ] - } - ], - "source": [ - "#exa 7.9\n", - "from math import log\n", - "NB =5e16\n", - "print\"NB = \",NB,\" /cmˆ3\" # initializiation the doping concentration in the base .\n", - "NC =2e15\n", - "print\"NC = \",NC,\" /cmˆ3\" # initializiation the doping concentration in the collector .\n", - "WBm =0.6e-4\n", - "print\"WBm = \",WBm,\" cm\" # initializiation the value of actual base width .\n", - "e=1.6e-19\n", - "print\"e = \",e,\" columns\" # initializiation the value of electronic charge .\n", - "VCB1=1\n", - "print\"VCB1 = \",VCB1,\" V\" # initializiation the initial value of collector base voltage .\n", - "VCB2=4\n", - "print\"VCB2 = \",VCB2,\" V\" # initializiation the final value of collector base voltage.\n", - "Er=11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854e-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "no=1.5e10\n", - "print\"no = \",no,\"cmˆ−3\" # initializing the value of intrinsic charge carriers\n", - "VT=0.0259\n", - "print\"VT = \",VT,\" V\" # initializiation the value of threshold voltage .\n", - "VBI=VT*(log((NB*NC)/no**2))\n", - "print\" VBI=VT∗(log((NB∗NC)/noˆ2))=\",VBI,\" V\" # calculation\n", - "WBS1=((2*Eo*Er*(VBI+VCB1)/e)*(NC/NB)*(1/(NC+NB)))**(1./2.)\n", - "print\"WBS=((2∗Eo∗Er∗(VBI+VCB1)/e)∗(NC/NB)∗(1/(NC+NB)))ˆ(1/2))=\",WBS1,\" cm\"#calculation\n", - "Wb1=WBm-WBS1\n", - "print\"Neutral base width for VCB1,WB( neutral )=WBm− WBS1=\",Wb1,\" cm\"# calculation\n", - "WBS2=((2*Eo*Er*(VBI+VCB2)/e)*(NC/NB)*(1/(NC+NB)))**(1/2)\n", - "print\"WBS=((2∗Eo∗Er∗(VBI+VCB2)/e)∗(NC/NB)∗(1/(NC+NB) ))ˆ(1/2))=\",WBS2,\" cm\"#calculation\n", - "Wb2=WBm-WBS2\n", - "print\"Neutral base width for VCB2,WB( neutral )=WBm−WBS2=\",Wb2,\" cm\"# calculation\n", - "deltaWbneutral=Wb1-Wb2\n", - "print\"change in the neutal base width ,deltaWb(neutral )=Wb1−Wb2=\",deltaWbneutral,\" cm\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_10 pgno: 226" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ro = 5000000.0 ohm\n", - "Vce1 = 7 V\n", - "Vce2 = 1 V\n", - "change in the collector −emitter voltage , Vce1−Vce2 = 6 V\n", - "change in the collector current , Ic=(Vce/ro))= 1.2e-06 A\n" - ] - } - ], - "source": [ - "#exa 7.10\n", - "ro=500*10e3\n", - "print\"ro = \",ro,\" ohm\" # initializiation the value of output resistance .\n", - "Vce1 =7\n", - "print\"Vce1 = \",Vce1,\" V\" # initializiation the initial value of collector emitter voltage .\n", - "Vce2 =1\n", - "print\"Vce2 = \",Vce2,\" V\" # initializiation the final value of collector emitter voltage .\n", - "Vce=6\n", - "print\"change in the collector −emitter voltage , Vce1−Vce2 = \",Vce,\" V\" # calculation .\n", - "Ic=(Vce/ro)\n", - "print\"change in the collector current , Ic=(Vce/ro))=\" ,Ic,\" A\"# calculation," - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_8_THE_FIELD_EFFECT_TRANSISTOR.ipynb b/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_8_THE_FIELD_EFFECT_TRANSISTOR.ipynb deleted file mode 100755 index 0c2e0420..00000000 --- a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/chapter_8_THE_FIELD_EFFECT_TRANSISTOR.ipynb +++ /dev/null @@ -1,806 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 8 THE FIELD EFFECT TRANSISTOR" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_1 pgno: 267" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd= 10000000000000000 /cmˆ3\n", - "Er= 3.9\n", - "Eo = 8.854e-14 F/cm\n", - "W = 5e-05 cm\n", - "L = 0.0001 cm\n", - "tox = 4e-06 cm\n", - " total permittivity ,E=Eo∗Er= 3.45306e-13 F/cm\n", - "Oxide capacitance ,Cox=(E∗W∗L)/tox)= 4.316325e-16 F\n", - "Capacitance per unit area ,Co=(Cox/(W∗L)))= 8.63265e-08 F/cmˆ2\n" - ] - } - ], - "source": [ - "#exa 8.1\n", - "Nd =10**16\n", - "print\"Nd= \",Nd,\" /cmˆ3\" # initializing value of donor ion concentration .\n", - "Er =3.9\n", - "print\"Er= \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "W=0.5*10**-4\n", - "print\"W = \",W,\" cm\" # initializing value of width of p−substrate .\n", - "L=10**-4\n", - "print\"L = \",L,\" cm\" # initializing value of length of p−substrate .\n", - "tox =400*10**-8\n", - "print\"tox = \",tox,\" cm\" # initializing value of thickness of p−substrate .\n", - "E=Eo*Er\n", - "print\" total permittivity ,E=Eo∗Er=\",E,\" F/cm\"# calculation\n", - "Cox=(E*W*L)/tox\n", - "print\"Oxide capacitance ,Cox=(E∗W∗L)/tox)=\",Cox,\" F\"# calculation\n", - "Co=(Cox/(W*L))\n", - "print\"Capacitance per unit area ,Co=(Cox/(W∗L)))=\",Co,\" F/cmˆ2\"# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_2 pgno: 267" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 100000000000000000 /cmˆ3\n", - "Vt = 0.0259 V\n", - "e = 1.6e-19 columns\n", - "ni = 15000000000.0 /cmˆ3\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "Vs=Vt∗log(Na/ni))= 0.40695713106 V\n", - " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "maximum depletion width ,Wd(max)=Sqrt(4∗E∗Vs/(e∗Na)))= 1.03535092381e-05 cm\n" - ] - } - ], - "source": [ - "#exa 8.2\n", - "from math import log\n", - "from math import sqrt\n", - "Na =10**17\n", - "print\"Na = \",Na,\" /cmˆ3\" # initializing value of acceptor ion concentration .\n", - "Vt =0.0259\n", - "print\"Vt = \",Vt,\"V\" # initializing value of thermal voltage .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "ni=1.5*10**10\n", - "print\"ni = \",ni,\"/cmˆ3\" #initializing value of intrinsic carrier concentration .\n", - "Er=11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "Vs=Vt*log(Na/ni)\n", - "print\"Vs=Vt∗log(Na/ni))=\",Vs,\" V\"#calculation\n", - "E=Eo*Er\n", - "print\" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation\n", - "Wd=sqrt(4*E*Vs/(e*Na))\n", - "print\"maximum depletion width ,Wd(max)=Sqrt(4∗E∗Vs/(e∗Na)))=\",Wd,\" cm\"#calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_3 pgno: 268" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 3000000000000000000 /cmˆ3\n", - "Vt = 0.0259 V\n", - "e = 1.6e-19 columns\n", - "ni = 15000000000.0 /cmˆ3\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "Vs=Vt∗log(Nd/ni))= 0.495048143245 V\n", - " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "maximum depletion width ,Wd(max)=Sqrt(4∗E∗Vs/(e∗Nd)))= 2.08485729922e-06 cm\n" - ] - } - ], - "source": [ - "#exa 8.3\n", - "from math import sqrt\n", - "from math import log\n", - "Nd =3*10**18\n", - "print\"Nd = \",Nd,\" /cmˆ3\" # initializing value of acceptor ion concentration .\n", - "Vt =0.0259\n", - "print\"Vt = \",Vt,\"V\" # initializing value of thermal voltage .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "ni=1.5*10**10\n", - "print\"ni = \",ni,\"/cmˆ3\" #initializing value of intrinsic carrier concentration .\n", - "Er=11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "Vs=Vt*log(Nd/ni)\n", - "print\"Vs=Vt∗log(Nd/ni))=\",Vs,\" V\"# calculation\n", - "E=Eo*Er\n", - "print\" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation\n", - "Wd=sqrt(4*E*Vs/(e*Nd))\n", - "print\"maximum depletion width ,Wd(max)=Sqrt(4∗E∗Vs/(e∗Nd)))=\",Wd,\" cm\"#calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_5 pgno: 269" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Vm = 3.2 V\n", - "X = 3.25 V\n", - "Nd = 20000000000000000 /cmˆ3\n", - "ni = 15000000000.0 V\n", - "Vt = 0.0259 V\n", - "Eg = 1.12 V\n", - "Vfp=(Vt∗log(Nd/ni))= 0.365272689128 V\n", - "Vms=−(Vm+(Eg/2)+Vfp−Vm)= -0.925272689128 V\n" - ] - } - ], - "source": [ - "#exa 8.5\n", - "from math import log\n", - "Vm =3.2\n", - "print\"Vm = \",Vm,\" V\" # initializing value of modified metal work function .\n", - "X=3.25\n", - "print\"X = \",X,\" V\" # initializing value of modified electron affinity .\n", - "Nd =2*10**16\n", - "print\"Nd = \",Nd,\" /cmˆ3\" # initializing value of donor concentration .\n", - "ni=1.5*10**10\n", - "print\"ni = \",ni,\" V\" # initializing value of intrinsic carrier concentration .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\"V\" # initializing value of thermal voltage .\n", - "Eg=1.12\n", - "print\"Eg = \",Eg,\"V\" # initializing value of energy gap .\n", - "Vfp=(Vt*log(Nd/ni))\n", - "print\"Vfp=(Vt∗log(Nd/ni))=\",Vfp,\" V\" # calculation .\n", - "Vms=-(Vm+(Eg/2)+Vfp-Vm)\n", - "print\"Vms=−(Vm+(Eg/2)+Vfp−Vm)=\",Vms,\" V\" # calculation ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_7 pgno: 270" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 10000000000000000 /cmˆ3\n", - "Vms = -1.12 V\n", - "Er = 3.9\n", - "Eo = 8.854e-14 F/cm\n", - "tox = 2e-06 cm\n", - "Qss = 2.5e-08 columbs/cmˆ2\n", - "Total permittivity ,Eox=Eo∗Er= 3.45306e-13 F/cm\n", - "Capacitance per unit area ,Co=(E/tox))= 1.72653e-07 F/cmˆ2\n", - " Flat band voltage , Vfb=(Vms−(Qss/Co) ) )= -1.26479910572 V\n" - ] - } - ], - "source": [ - "#exa 8.7\n", - "Nd =10**16\n", - "print\"Nd = \",Nd,\" /cmˆ3\" # initializing value of donor ion concentration .\n", - "Vms = -1.12\n", - "print\"Vms = \",Vms,\" V\" # initializing value of metal semiconductor work function difference .\n", - "Er =3.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "tox =200*10**-8\n", - "print\"tox = \",tox,\" cm\" # initializing value of thickness of p−type substrate .\n", - "Qss =2.5*10**-8\n", - "print\"Qss = \",Qss,\" columbs/cmˆ2\" # initializing value of charge density on semiconductor surface .\n", - "Eox=Eo*Er\n", - "print\"Total permittivity ,Eox=Eo∗Er=\",Eox,\" F/cm\"# calculation\n", - "Co=(Eox/tox)\n", - "print\"Capacitance per unit area ,Co=(E/tox))=\",Co,\" F/cmˆ2\"# calculation\n", - "Vfb=(Vms-(Qss/Co))\n", - "print\" Flat band voltage , Vfb=(Vms−(Qss/Co) ) )=\",Vfb,\" V\"# calculation\n", - "#the answer for Co after calculation is provided wrong in the book " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_9 pgno: 271" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 30000000000000000 /cmˆ3\n", - "Vms = -1.12 V\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "ni = 15000000000.0 cmˆ−3\n", - "e = 1.6e-19 columns\n", - "tox = 3e-06 cm\n", - "Vfb = -1.12 V\n", - "Qss = 100000000000 electronic charge columns/cmˆ2\n", - "Vt = 0.0259 eV\n", - "er = 3.9\n", - "total permittivity ,Eox=Eo∗Er= 1.053626e-12 F/cm\n", - "Potential ,Vfp=Vt∗(log(Na/(ni))))= 0.375774235428 V\n", - "Maximum depletion width ,Wd=sqrt ((4∗E∗Vs)/(e∗Nd)))= 1.81641933617e-05 cm\n", - "Over all maximum depletion width ,QDmax=(e∗Na∗ Wd) )= 8.71881281361e-08 columns/cmˆ2\n", - "Threshold Voltage ,VT=(((QDmax−1.6∗10ˆ−8)∗tox)/(er∗Eo),(2∗Vfp+Vfb)= 0.250027108378 V\n" - ] - } - ], - "source": [ - "#exa 8.9\n", - "from math import log\n", - "Na =3*10**16\n", - "print\"Na = \",Na,\" /cmˆ3\" # initializing value of acceptor ion concentration .\n", - "Vms = -1.12\n", - "print\"Vms = \",Vms,\"V\" # initializing value of metal semiconductor work function difference .\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "ni=1.5*10**10\n", - "print\"ni = \",ni,\"cmˆ−3\" # initializing value of intrinsic concentration of electrons .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "tox =300*10**-8\n", - "print\"tox = \",tox,\" cm\" # initializing value of thickness of p−type substrate .\n", - "Vfb=-1.12\n", - "print\"Vfb = \",Vfb,\" V\" # initializing value of flat band voltage .\n", - "Qss=10**11\n", - "print\"Qss = \",Qss,\" electronic charge columns/cmˆ2\" # initializing value of charge density on semiconductor surface .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "er=3.9\n", - "print\"er = \",er # initializing value of relative dielectric permittivity constant\n", - "Eox=Eo*Er\n", - "print\"total permittivity ,Eox=Eo∗Er=\",Eox,\" F/cm\"# calculation\n", - "Vfp=Vt*(log(Na/(ni)))\n", - "print\"Potential ,Vfp=Vt∗(log(Na/(ni))))=\",Vfp,\" V\"#calculation\n", - "Wd=sqrt((4*Eox*Vfp)/(e*Na))\n", - "print\"Maximum depletion width ,Wd=sqrt ((4∗E∗Vs)/(e∗Nd)))=\",Wd,\" cm\"#calculation\n", - "QDmax=(e*Na*Wd)\n", - "print\"Over all maximum depletion width ,QDmax=(e∗Na∗ Wd) )=\",QDmax,\" columns/cmˆ2\" # calculation\n", - "VT=(((QDmax -1.6*10**-8)*tox)/(er*Eo))+(2*Vfp+Vfb)\n", - "print \"Threshold Voltage ,VT=(((QDmax−1.6∗10ˆ−8)∗tox)/(er∗Eo),(2∗Vfp+Vfb)=\",VT,\" V\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_10 pgno: 271" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "L = 0.000125 cm\n", - "un = 600 cmˆ2/V−s\n", - "Co = 6.9e-09 F/cmˆ2\n", - "VT = 0.6 V\n", - "Vgs = 4 V\n", - "W = 0.0012 cm\n", - "Drain current ,Id=((Co∗un∗W)/(L)∗((Vgs−VT)ˆ2/(2)))= 0.00022972032 A\n" - ] - } - ], - "source": [ - "#exa 8.10\n", - "L=1.25*10**-4\n", - "print\"L = \",L,\" cm\" # initializing value of length of channel .\n", - "un =600\n", - "print\"un = \",un,\"cmˆ2/V−s\" # initializing value of mobility of n−channel MOS transistor .\n", - "Co =6.9*10**-9\n", - "print\"Co = \",Co,\"F/cmˆ2\" # initializing value of capacitance per unit area .\n", - "VT =0.60\n", - "print\"VT = \",VT,\" V\" # initializing value of threshold Voltage .\n", - "Vgs=4\n", - "print\"Vgs = \",Vgs,\" V\" # initializing value of gate to source voltage .\n", - "W=12*10**-4\n", - "print\"W = \",W,\"cm\" # initializing value of width of channel .\n", - "Id=((Co*un*W)/(L)*((Vgs-VT)**2/(2)))\n", - "print\"Drain current ,Id=((Co∗un∗W)/(L)∗((Vgs−VT)ˆ2/(2)))=\",Id,\" A\"#calculation .\n", - "#The answer provided in the book (for Id) is wrong as the value of mobility used for solution is different than provided in the question and also value of (Vgs−Vt) is put wrong in the solution than given in the book .\n", - "#I have used the value given in the question i.e. answer differ ." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_13 pgno: 273" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Na = 200000000000000000 /cmˆ3\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "ni = 15000000000.0 cmˆ−3\n", - "e = 1.6e-19 columns\n", - "tox = 4e-06 cm\n", - "Vt = 0.0259 eV\n", - "er = 3.9\n", - "Potential ,Vfp=Vt∗(log(Na/(ni))))= 0.424909643036 V\n", - "Depletion width ,Wd=sqrt ((4∗Er∗Eo∗Vs)/(e∗Nd)))= 7.48077408723e-06 cm\n", - "Minimum Capacitance,CTmin=(er∗Eo/((er/Er)∗(Wd)+(tox)))= 5.35218545918e-08 F/cmˆ2\n", - "Flat band capacitance ,CFB=((er∗Eo) /((( er/Er)∗sqrt(Vt∗Er∗Eo/(e∗Na))))+(tox))= 8.02543256028e-08 F/ cmˆ2\n" - ] - } - ], - "source": [ - "#exa 8.13\n", - "from math import sqrt\n", - "from math import log\n", - "Na =2*10**17\n", - "print\"Na = \",Na,\" /cmˆ3\" # initializing value of acceptor ion concentration .\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "ni=1.5*10**10\n", - "print\"ni = \",ni,\"cmˆ−3\" # initializing value of intrinsic concentration of electrons .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "tox =400*10**-8\n", - "print\"tox = \",tox,\" cm\" # initializing value of thickness of p−type substrate .\n", - "Vt=0.0259\n", - "print\"Vt = \",Vt,\" eV\" # initializing value of thermal voltage .\n", - "er=3.9\n", - "print\"er = \",er # initializing value of relative dielectric permittivity constant\n", - "Vfp=Vt*(log(Na/(ni)))\n", - "print\"Potential ,Vfp=Vt∗(log(Na/(ni))))=\",Vfp,\" V\"#calculation\n", - "Wd=sqrt((4*Er*Eo*Vfp)/(e*Na))\n", - "print\"Depletion width ,Wd=sqrt ((4∗Er∗Eo∗Vs)/(e∗Nd)))=\",Wd,\" cm\"# calculation\n", - "CTmin=(er*Eo/(((er/Er)*(Wd))+(tox)))\n", - "print\"Minimum Capacitance,CTmin=(er∗Eo/((er/Er)∗(Wd)+(tox)))=\",CTmin,\" F/cmˆ2\"#calculation\n", - "CFB=((er*Eo)/((((er/Er)*sqrt(Vt*Er*Eo/(e*Na))))+(tox)))\n", - "print\"Flat band capacitance ,CFB=((er∗Eo) /((( er/Er)∗sqrt(Vt∗Er∗Eo/(e∗Na))))+(tox))=\",CFB,\" F/ cmˆ2\"# calculation\n", - "#the value of Na (acceptor ion concentration) and tox ( thickness of p−type substrate ) is provided different in the question than used in the solution .\n", - "#I have used the value provided in the solution .( i . e Na=2∗10ˆ17 and tox =400∗10ˆ8cm)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_14 pgno: 274" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Vfb = -1.0 V\n", - "Vms = -0.9 V\n", - "tox = 2e-06 cm\n", - "et = 3.9\n", - "eo = 8.85e-14 F/cm\n", - "e = 1.6e-19 columns\n", - "eox=(eo∗et))= 3.4515e-13 F/cmˆ2\n", - "Oxide capacitance ,Cox=(eox/tox))= 1.72575e-07 F/cmˆ2\n", - "charge density on semiconductor surface ,Qss=(( Vms−Vfb)∗Cox))= 1.72575e-08 C/cmˆ2\n", - "charge density on semiconductor surface (in terms of number of charges) ,Qss∗=Qss/e)= 1.07859375e+11 electrons/cmˆ2\n" - ] - } - ], - "source": [ - "#exa 8.14\n", - "Vfb = -1.0\n", - "print\"Vfb = \",Vfb,\" V\" # initializing value of flat band voltage .\n", - "Vms = -0.9\n", - "print\"Vms = \",Vms,\"V\" # initializing value of metal semiconductor work function difference .\n", - "tox =200*10**-8\n", - "print\"tox = \",tox,\" cm\" # initializing value of gate oxide thickness .\n", - "et =3.9\n", - "print\"et = \",et # initializing value of relative permittivity .\n", - "eo =8.85*10**-14\n", - "print\"eo = \",eo,\"F/cm\" # initializing value of free space permittivity .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "eox=(eo*et)\n", - "print\"eox=(eo∗et))=\",eox,\" F/cmˆ2\" # calculation\n", - "Cox=(eox/tox)\n", - "print\"Oxide capacitance ,Cox=(eox/tox))=\",Cox,\" F/cmˆ2\"# calculation\n", - "Qss=((Vms-Vfb)*Cox)\n", - "print\"charge density on semiconductor surface ,Qss=(( Vms−Vfb)∗Cox))=\",Qss,\" C/cmˆ2\" # calculation\n", - "Qss1=Qss/e\n", - "print\"charge density on semiconductor surface (in terms of number of charges) ,Qss∗=Qss/e)=\",Qss1,\" electrons/cmˆ2\" #calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_15 pgno: 274" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "L = 3e-06 meter\n", - "un = 800.0 cmˆ2/V−s\n", - "VT = 1.0 V\n", - "Vgs = 0 V\n", - "tox = 5e-06 cm\n", - "et = 3.9\n", - "eo = 8.85e-14 F/cm\n", - "W = 3e-05 m\n", - "eox=(eo∗et))= 3.4515e-13 F/cmˆ2\n", - "Drain current ,Id=((eox∗un∗W)/(tox∗L)∗((Vgs−VT)ˆ2/(2))))= 276120.0 A\n" - ] - } - ], - "source": [ - "#exa 8.15\n", - "L=3e-6\n", - "print\"L = \",L,\" meter\" # initializing value of length of channel .\n", - "un =800.\n", - "print\"un = \",un,\"cmˆ2/V−s\" # initializing value of mobility of n−channel MOS transistor .\n", - "VT=1.\n", - "print\"VT = \",VT,\" V\" # initializing value of threshold Voltage .\n", - "Vgs=0\n", - "print\"Vgs = \",Vgs,\" V\" # initializing value of gate to source voltage .\n", - "tox =500e-8\n", - "print\"tox = \",tox,\" cm\" # initializing value of gate oxide thickness .\n", - "et=3.9\n", - "print\"et = \",et # initializing value of relative permittivity .\n", - "eo =8.85e-14\n", - "print\"eo = \",eo,\"F/cm\" # initializing value of free space permittivity .\n", - "W=30e-6\n", - "print\"W = \",W,\"m\" # initializing value of width of channel .\n", - "eox=(eo*et)\n", - "print\"eox=(eo∗et))=\",eox,\" F/cmˆ2\"# calculation\n", - "Id=((eox*un*W)/(tox*L)*((Vgs-VT)**2/(2)))*(1e9)\n", - "print\"Drain current ,Id=((eox∗un∗W)/(tox∗L)∗((Vgs−VT)ˆ2/(2))))=\",Id,\" A\"#calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_16 pgno: 274" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "L = 2.5e-06 meter\n", - "un = 800 cmˆ2/V−s\n", - "VT = 0.8 V\n", - "Vgs = 1 V\n", - "tox = 4e-06 cm\n", - "et = 3.9\n", - "eo = 8.85e-14 F/cm\n", - "eox=(eo∗et))= 3.4515e-13 F/cmˆ2\n", - "W = 2.5e-05 m\n", - "Drain current ,Id=((eox∗un∗W)/(tox∗L)∗((Vgs−VT)ˆ2/(2))))= 1.3806e-05 A\n" - ] - } - ], - "source": [ - "#exa 8.16\n", - "L=2.5*10**-6\n", - "print\"L = \",L,\" meter\" # initializing value of length of channel .\n", - "un =800\n", - "print\"un = \",un,\"cmˆ2/V−s\" # initializing value of mobility of n−channel MOS transistor .\n", - "VT =0.8\n", - "print\"VT = \",VT,\" V\" # initializing value of threshold Voltage .\n", - "Vgs=1\n", - "print\"Vgs = \",Vgs,\" V\" # initializing value of gate to source voltage .\n", - "tox =400*10**-8\n", - "print\"tox = \",tox,\" cm\" # initializing value of gate oxide thickness .\n", - "et=3.9\n", - "print\"et = \",et # initializing value of relative permittivity .\n", - "eo =8.85*10**-14\n", - "print\"eo = \",eo,\"F/cm\" # initializing value of free space permittivity .\n", - "eox=(eo*et)\n", - "print\"eox=(eo∗et))=\",eox,\" F/cmˆ2\" # calculation\n", - "W=25*10**-6\n", - "print\"W = \",W,\"m\" # initializing value of width of channel . .\n", - "Id=((eox*un*W)/(tox*L)*((Vgs-VT)**2/(2)))\n", - "print\"Drain current ,Id=((eox∗un∗W)/(tox∗L)∗((Vgs−VT)ˆ2/(2))))=\",Id,\" A\"#calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_17 pgno: 274" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "un = 525 cmˆ2/V−s\n", - "VT = 0.75 V\n", - "Vgs = 2 V\n", - "tox = 4e-06 cm\n", - "et = 3.9\n", - "eo = 8.85e-14 F/cm\n", - "eox=(eo∗et))= 3.4515e-13 F/cmˆ2\n", - "Id = 0.006 A\n", - "width to length ratio ,W/L=((Id∗tox∗2)/(eox∗un∗((Vgs−VT)ˆ2)))= 169.532915296\n" - ] - } - ], - "source": [ - "#8.17\n", - "un =525\n", - "print\"un = \",un,\"cmˆ2/V−s\" # initializing value of mobility of n−channel MOS transistor .\n", - "VT =0.75\n", - "print\"VT = \",VT,\" V\" # initializing value of threshold Voltage .\n", - "Vgs=2\n", - "print\"Vgs = \",Vgs,\" V\" # initializing value of gate to source voltage .\n", - "tox =400*10**-8\n", - "print\"tox = \",tox,\" cm\" # initializing value of gate oxide thickness .\n", - "et=3.9\n", - "print\"et = \",et # initializing value of relative permittivity .\n", - "eo =8.85*10**-14\n", - "print\"eo = \",eo,\"F/cm\" # initializing value of free space permittivity .\n", - "eox=(eo*et)\n", - "print\"eox=(eo∗et))=\",eox,\" F/cmˆ2\" # calculation\n", - "Id =6*10**-3\n", - "print\"Id = \",Id,\"A\" # initializing value of width of channel . .\n", - "X=((Id*tox*2)/(eox*un*((Vgs-VT)**2)))\n", - "print\"width to length ratio ,W/L=((Id∗tox∗2)/(eox∗un∗((Vgs−VT)ˆ2)))= \",X # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_18 pgno: 275" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Nd = 20000000000000000 /cmˆ3\n", - "a = 0.0002 cm\n", - "e = 1.6e-19 columns\n", - "Er = 11.9\n", - "Eo = 8.85e-14 F/cm\n", - "E=(Eo∗Er))= 1.05315e-12 F/cmˆ2\n", - "Pinch off Voltage ,Vp=((e∗Nd∗aˆ2)/(2∗E)))= 60.7700707402 V\n" - ] - } - ], - "source": [ - "#exa 8.18\n", - "Nd =2*10**16\n", - "print\"Nd = \",Nd,\" /cmˆ3\" # initializing value of donor ion concentration .\n", - "a=2*10**-4\n", - "print\"a = \",a,\" cm\" # initializing value of height of channel at pinch off .\n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative permittivity .\n", - "Eo =8.85*10**-14\n", - "print\"Eo = \",Eo,\"F/cm\" # initializing value of free space permittivity .\n", - "E=(Eo*Er)\n", - "print\"E=(Eo∗Er))=\",E,\" F/cmˆ2\"#calculation\n", - "Vp=((e*Nd*a**2)/(2*E))\n", - "print\"Pinch off Voltage ,Vp=((e∗Nd∗aˆ2)/(2∗E)))=\",Vp,\" V\"# calculation," - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8_20 pgno: 275" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a = 0.0002 cm\n", - "Er = 11.9\n", - "Eo = 8.854e-14 F/cm\n", - "un = 1350 cmˆ2/V−s\n", - "W = 0.0008 cm\n", - "L = 0.001 cm\n", - "e = 1.6e-19 columns\n", - "Vp = 4 V\n", - "Vgs = 0 V\n", - " total permittivity ,E=Eo∗Er= 1.053626e-12 F/cm\n", - "Donor ion concentration ,Nd=((Vp∗2∗E)/(e∗aˆ2)))= 1.3170325e+15 /cmˆ3\n", - "On Drain resistance ,rds=(L/(W∗a∗e∗un∗Nd)))= 21969.9856953 ohm\n" - ] - } - ], - "source": [ - "#exa 8.20\n", - "a=2*10**-4\n", - "print\"a = \",a,\" cm\" # initializing value of height of channel at pinch off .\n", - "Er =11.9\n", - "print\"Er = \",Er # initializing value of relative dielectric permittivity constant .\n", - "Eo=8.854*10**-14\n", - "print\"Eo = \",Eo,\" F/cm\" # initializing value of permittivity of free space .\n", - "un =1350\n", - "print\"un = \",un,\"cmˆ2/V−s\" # initializing value of mobility of n−type silicon Mosfet.\n", - "W=8*10**-4\n", - "print\"W = \",W,\" cm\" # initializing value of width of p−substrate .\n", - "L=10*10**-4\n", - "print\"L = \",L,\" cm\" # initializing value of length of p−substrate \n", - "e=1.6*10**-19\n", - "print\"e = \",e,\" columns\" # initializing value of charge of electrons .\n", - "Vp=4\n", - "print\"Vp = \",Vp,\" V\" # initializing value of thickness of p−substrate . \n", - "Vgs=0\n", - "print\"Vgs = \",Vgs,\" V\" # initializing value of gate to source voltage .\n", - "E=Eo*Er\n", - "print\" total permittivity ,E=Eo∗Er=\",E,\" F/cm\" # calculation\n", - "Nd=((Vp*2*E)/(e*a**2))\n", - "print\"Donor ion concentration ,Nd=((Vp∗2∗E)/(e∗aˆ2)))=\",Nd,\" /cmˆ3\"# calculation\n", - "rds=(L/(W*a*e*un*Nd))\n", - "print\"On Drain resistance ,rds=(L/(W∗a∗e∗un∗Nd)))=\",rds,\" ohm\"# calculation" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.31.11_pm.png b/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.31.11_pm.png deleted file mode 100755 index 35e9d1ad..00000000 Binary files a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.31.11_pm.png and /dev/null differ diff --git a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.32.51_pm.png b/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.32.51_pm.png deleted file mode 100755 index aa7eca54..00000000 Binary files a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.32.51_pm.png and /dev/null differ diff --git a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.33.45_pm.png b/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.33.45_pm.png deleted file mode 100755 index 161d6b04..00000000 Binary files a/_Solid_State_Devices_by_B._S._Nair_and_S._R._Deepa/screenshots/Screen_Shot_2015-11-05_at_11.33.45_pm.png and /dev/null differ diff --git a/_Theory_Of_Machines/Chapter1.ipynb b/_Theory_Of_Machines/Chapter1.ipynb deleted file mode 100755 index 1c82cdeb..00000000 --- a/_Theory_Of_Machines/Chapter1.ipynb +++ /dev/null @@ -1,663 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:33bb604c38fad316310d35481ce37e53ae0ade845d03c72c1ef523c0dcf5fe56" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter1-Basic Kinematics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 1 PAGE NO 15\n", - "#calculate inclination of slotted bar with vertical \n", - "##TITLE:Basic kinematics\n", - "##Figure 1.14\n", - "import math\n", - "pi=3.141\n", - "AO=200.## distance between fixed centres in mm\n", - "OB1=100.## length of driving crank in mm\n", - "AP=400.## length of slotter bar in mm\n", - "##====================================\n", - "OAB1=math.asin(OB1/AO)*57.3## inclination of slotted bar with vertical in degrees\n", - "beeta=(90-OAB1)*2.## angle through which crank turns inreturn stroke in degrees\n", - "A=(360.-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", - "L=2.*AP*math.sin(90.-beeta/2.)/57.3## length of the stroke in mm\n", - "print'%s %.2f %s %.3f %s'%('Inclination of slotted bar with vertical= ',OAB1,' degrees' 'Length of the stroke=',L,' mm')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Inclination of slotted bar with vertical= 30.00 degreesLength of the stroke= -13.790 mm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 2 PAGE NO 16\n", - "#calculate ratio of time taken on the cutting to the return\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.15\n", - "import math\n", - "OA=300.## distance between the fixed centres in mm\n", - "OB=150.## length of driving crank in mm\n", - "##================================\n", - "OAB=math.asin(OB/OA)## inclination of slotted bar with vertical in degrees\n", - "beeta=(90/57.3-OAB)*2.## angle through which crank turns inreturn stroke in degrees\n", - "A=(360/57.3-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", - "print'%s %.1f %s'%('Ratio of time taken on the cutting to the return stroke= ',A,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Ratio of time taken on the cutting to the return stroke= 2.0 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 3 PAGE NO 16\n", - "#calculate ratio of time taken on the cutting to the return stroke \n", - "##TITLE:Basic kinematics\n", - "##Figure 1.16\n", - "import math\n", - "OB=54.6/57.3## distance between the fixed centres in mm\n", - "OA=85./57.3## length of driving crank in mm\n", - "OA2=OA\n", - "CA=160.## length of slotted lever in mm\n", - "CD=144.## length of connectin rod in mm\n", - "##================================\n", - "beeta=2.*(math.cos(OB/OA2))## angle through which crank turns inreturn stroke in degrees\n", - "A=(360/57.3-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", - "print'%s %.1f %s'%('Ratio of time taken on the cutting to the return stroke= ',A,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Ratio of time taken on the cutting to the return stroke= 2.9 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg 17" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 4 PAGE NO 17\n", - "#calculate velocity position and Angular velocity connection\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.18,1.19\n", - "import math\n", - "pi=3.141\n", - "Nao=180.## speed of the crank in rpm\n", - "wAO=2.*pi*Nao/60.## angular speed of the crank in rad/s\n", - "AO=.5## crank length in m\n", - "AE=.5\n", - "Vao=wAO*AO## velocity of A in m/s\n", - "##================================\n", - "Vb1=8.15## velocity of piston B in m/s by measurment from figure 1.19\n", - "Vba=6.8## velocity of B with respect to A in m/s\n", - "AB=2## length of connecting rod in m\n", - "wBA=Vba/AB## angular velocity of the connecting rod BA in rad/s\n", - "ae=AE*Vba/AB## velocity of point e on the connecting rod\n", - "oe=8.5## by measurement velocity of point E\n", - "Do=.05## diameter of crank shaft in m\n", - "Da=.06## diameter of crank pin in m\n", - "Db=.03## diameter of cross head pin B m\n", - "V1=wAO*Do/2.## velocity of rubbing at the pin of the crankshaft in m/s\n", - "V2=wBA*Da/2.## velocity of rubbing at the pin of the crank in m/s\n", - "Vb=(wAO+wBA)*Db/2.## velocity of rubbing at the pin of cross head in m/s\n", - "ag=5.1## by measurement\n", - "AG=AB*ag/Vba## position and linear velocity of point G on the connecting rod in m\n", - "##===============================\n", - "print'%s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s'%('Velocity of piston B=',Vb1,' m/s''Angular velocity of connecting rod= ',wBA,' rad/s''velocity of point E=',oe,' m/s'' velocity of rubbing at the pin of the crankshaft=',V1,' m/s' 'velocity of rubbing at the pin of the crank =',V2,' m/s''velocity of rubbing at the pin of cross head =',Vb,' m/s''position and linear velocity of point G on the connecting rod=',AG,' m')\n", - "\n", - "\n", - "\n", - "\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity of piston B= 8.150 m/sAngular velocity of connecting rod= 3.400 rad/svelocity of point E= 8.500 m/s velocity of rubbing at the pin of the crankshaft= 0.471 m/svelocity of rubbing at the pin of the crank = 0.102 m/svelocity of rubbing at the pin of cross head = 0.334 m/sposition and linear velocity of point G on the connecting rod= 1.500 m\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg 19" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 5 PAGE NO 19\n", - "#calculate linear velocity at various point\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.20,1.21\n", - "import math\n", - "pi=3.141\n", - "N=120.## speed of crank in rpm\n", - "OA=10.## length of crank in cm\n", - "BP=48.## from figure 1.20 in cm\n", - "BA=40.## from figure 1.20 in cm\n", - "##==============\n", - "w=2.*pi*N/60.## angular velocity of the crank OA in rad/s\n", - "Vao=w*OA## velocity of ao in cm/s\n", - "ba=4.5## by measurement from 1.21 in cm\n", - "Bp=BP*ba/BA\n", - "op=6.8## by measurement in cm from figure 1.21\n", - "s=20.## scale of velocity diagram 1cm=20cm/s\n", - "Vp=op*s## linear velocity of P in m/s\n", - "ob=5.1## by measurement in cm from figure 1.21\n", - "Vb=ob*s## linear velocity of slider B\n", - "print'%s %.2f %s %.2f %s'%('Linear velocity of slider B= ',Vb,' cm/s''Linear velocity of point P= ',Vp,' cm/s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Linear velocity of slider B= 102.00 cm/sLinear velocity of point P= 136.00 cm/s\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg20" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#calculate angular velocity at various points\n", - "##CHAPTER 1 ILLUSRTATION 6 PAGE NO 20\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.22,1.23\n", - "import math\n", - "pi=3.141\n", - "AB=6.25## length of link AB in cm\n", - "BC=17.5## length of link BC in cm\n", - "CD=11.25## length of link CD in cm\n", - "DA=20.## length of link DA in cm\n", - "CE=10.\n", - "N=100.## speed of crank in rpm\n", - "##========================\n", - "wAB=2.*pi*N/60.## angular velocity of AB in rad/s\n", - "Vb=wAB*AB## linear velocity of B with respect to A\n", - "s=15.## scale for velocity diagram 1 cm= 15 cm/s\n", - "dc=3.## by measurement in cm\n", - "Vcd=dc*s\n", - "wCD=Vcd/CD## angular velocity of link CD in rad/s\n", - "bc=2.5## by measurement in cm\n", - "Vbc=bc*s\n", - "wBC=Vbc/BC## angular velocity of link BC in rad/s\n", - "ce=bc*CE/BC\n", - "ae=3.66## by measurement in cm\n", - "Ve=ae*s## velocity of point E 10 from c on the link BC\n", - "af=2.94## by measurement in cm\n", - "Vf=af*s## velocity of point F\n", - "print'%s %.3f %s %.3f %s %.3f %s %.3f %s'%('The angular velocity of link CD= ',wCD,' rad/s'' The angular velocity of link BC= ',wBC,'rad/s'' velocity of point E 10 from c on the link BC= ',Ve,' cm/s' ' velocity of point F= ',Vf,' cm/s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The angular velocity of link CD= 4.000 rad/s The angular velocity of link BC= 2.143 rad/s velocity of point E 10 from c on the link BC= 54.900 cm/s velocity of point F= 44.100 cm/s\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 3, - "metadata": {}, - "source": [ - "Ex7-pg21" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 7 PAGE NO 21\n", - "##TITLE:Basic kinematics\n", - "#calculate Linear velocity slider and angular velocity of link\n", - "##Figure 1.24,1.25\n", - "import math\n", - "pi=3.141\n", - "Noa=600## speed of the crank in rpm\n", - "OA=2.8## length of link OA in cm\n", - "AB=4.4## length of link AB in cm\n", - "BC=4.9## length of link BC in cm\n", - "BD=4.6## length of link BD in cm\n", - "##=================\n", - "wOA=2.*pi*Noa/60.## angular velocity of crank in rad/s\n", - "Vao=wOA*OA## The linear velocity of point A with respect to oin m/s\n", - "s=50.## scale of velocity diagram in cm\n", - "od=2.95## by measurement in cm from figure\n", - "Vd=od*s/100.## linear velocity slider in m/s\n", - "bd=3.2## by measurement in cm from figure\n", - "Vbd=bd*s\n", - "wBD=Vbd/BD## angular velocity of link BD\n", - "print'%s %.1f %s %.1f %s '%('linear velocity slider D= ',Vd,' m/s' 'angular velocity of link BD= ',wBD,' rad/s')\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "linear velocity slider D= 1.5 m/sangular velocity of link BD= 34.8 rad/s \n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg22" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 8 PAGE NO 22\n", - "#calculate Angular velocity of link CD\n", - "##TITLE:Basic kinematics\n", - "import math\n", - "pi=3.141\n", - "Noa=60.## speed of crank in rpm\n", - "OA=30.## length of link OA in cm\n", - "AB=100.## length of link AB in cm\n", - "CD=80.## length of link CD in cm\n", - "##AC=CB\n", - "##================\n", - "wOA=2.*pi*Noa/60.## angular velocity of crank in rad/s\n", - "Vao=wOA*OA/100.## linear velocity of point A with respect to O\n", - "s=50.## scale for velocity diagram 1 cm= 50 cm/s\n", - "ob=3.4## by measurement in cm from figure 1.27\n", - "od=.9## by measurement in cm from figure 1.27\n", - "Vcd=160.## by measurement in cm/s from figure 1.27\n", - "wCD=Vcd/CD## angular velocity of link in rad/s\n", - "print'%s %.d %s'%('Angular velocity of link CD= ',wCD,' rad/s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Angular velocity of link CD= 2 rad/s\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 9 PAGE NO 23\n", - "#calculate velcity of Ram and anugular velocity of link and velocity of slidingof the block\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.28,1.29\n", - "import math\n", - "pi=3.141\n", - "Nao=120.## speed of the crank in rpm\n", - "OQ=10.## length of link OQ in cm\n", - "OA=20.## length of link OA in cm\n", - "QC=15.## length of link QC in cm\n", - "CD=50.## length oflink CD in cm\n", - "##=============\n", - "wOA=2.*pi*Nao/60.## angular speed of crank in rad/s\n", - "Vad=wOA*OA/100.## velocity of pin A in m/s\n", - "BQ=41.## from figure 1.29 \n", - "BC=26.## from firure 1.29 \n", - "bq=4.7## from figure 1.29\n", - "bc=bq*BC/BQ## from figure 1.29 in cm\n", - "s=50.## scale for velocity diagram in cm/s\n", - "od=1.525## velocity vector od in cm from figure 1.29\n", - "Vd=od*s## velocity of ram D in cm/s\n", - "dc=1.925## velocity vector dc in cm from figure 1.29\n", - "Vdc=dc*s## velocity of link CD in cm/s\n", - "wCD=Vdc/CD## angular velocity of link CD in cm/s\n", - "ba=1.8## velocity vector of sliding of the block in cm\n", - "Vab=ba*s## velocity of sliding of the block in cm/s\n", - "print'%s %.3f %s %.2f %s %.1f %s '%('Velocity of RAM D= ',Vd,' cm/s''angular velocity of link CD= ',wCD,' rad/s'' velocity of sliding of the block= ',Vab,' cm/s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity of RAM D= 76.250 cm/sangular velocity of link CD= 1.93 rad/s velocity of sliding of the block= 90.0 cm/s \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg24" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 10 PAGE NO 24\n", - "##TITLE:Basic kinematics\n", - "#calculate linear velocity abd radial component of accerlation and anugular velocity of connecting rod and anugular accerlation of connecting rod\n", - "##Figure 1.30(a),1.30(b),1.30(c)\n", - "import math\n", - "pi=3.141\n", - "Nao=300.## speed of crank in rpm\n", - "AO=.15## length of crank in m\n", - "BA=.6## length of connecting rod in m\n", - "##===================\n", - "wAO=2.*pi*Nao/60.## angular velocity of link in rad/s\n", - "Vao=wAO*AO## linear velocity of A with respect to 'o'\n", - "ab=3.4## length of vector ab by measurement in m/s\n", - "Vba=ab\n", - "ob=4.## length of vector ob by measurement in m/s\n", - "oc=4.1## length of vector oc by measurement in m/s\n", - "fRao=Vao**2./AO## radial component of acceleration of A with respect to O\n", - "fRba=Vba**2./BA## radial component of acceleration of B with respect to A\n", - "wBA=Vba/BA## angular velocity of connecting rod BA\n", - "fTba=103.## by measurement in m/s**2\n", - "alphaBA=fTba/BA## angular acceleration of connecting rod BA\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('linear velocity of A with respect to O= ',Vao,' m/s''radial component of acceleration of A with respect to O= ',fRao,' m/s**2'' radial component of acceleration of B with respect to A=',fRba,' m/s**2'' angular velocity of connecting rod B= ',wBA,' rad/s'' angular acceleration of connecting rod BA= ',alphaBA,' rad/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "linear velocity of A with respect to O= 4.7 m/sradial component of acceleration of A with respect to O= 148.0 m/s**2 radial component of acceleration of B with respect to A= 19.3 m/s**2 angular velocity of connecting rod B= 5.7 rad/s angular acceleration of connecting rod BA= 171.7 rad/s**2 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 11 PAGE NO 26\n", - "#calcualte Angular accerlation at various point\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.31(a),1.31(b),1.31(c)\n", - "import math\n", - "pi=3.141\n", - "wAP=10.## angular velocity of crank in rad/s\n", - "P1A=30.## length of link P1A in cm\n", - "P2B=36.## length of link P2B in cm\n", - "AB=36.## length of link AB in cm\n", - "P1P2=60.## length of link P1P2 in cm\n", - "AP1P2=60.## crank inclination in degrees \n", - "alphaP1A=30.## angulare acceleration of crank P1A in rad/s**2\n", - "##=====================================\n", - "Vap1=wAP*P1A/100.## linear velocity of A with respect to P1 in m/s\n", - "Vbp2=2.2## velocity of B with respect to P2 in m/s(measured from figure )\n", - "Vba=2.06## velocity of B with respect to A in m/s(measured from figure )\n", - "wBP2=Vbp2/(P2B*100.)## angular velocity of P2B in rad/s\n", - "wAB=Vba/(AB*100.)## angular velocity of AB in rad/s\n", - "fAB1=alphaP1A*P1A/100.## tangential component of the acceleration of A with respect to P1 in m/s**2\n", - "frAB1=Vap1**2./(P1A/100.)## radial component of the acceleration of A with respect to P1 in m/s**2\n", - "frBA=Vba**2./(AB/100.)## radial component of the acceleration of B with respect to B in m/s**2\n", - "frBP2=Vbp2**2./(P2B/100.)## radial component of the acceleration of B with respect to P2 in m/s**2\n", - "ftBA=13.62## tangential component of B with respect to A in m/s**2(measured from figure)\n", - "ftBP2=26.62## tangential component of B with respect to P2 in m/s**2(measured from figure)\n", - "alphaBP2=ftBP2/(P2B/100.)## angular acceleration of P2B in m/s**2\n", - "alphaBA=ftBA/(AB/100.)## angular acceleration of AB in m/s**2\n", - "##==========================\n", - "print'%s %.1f %s %.1f %s'%('Angular acceleration of P2B=',alphaBP2,' rad/s**2''angular acceleration of AB =',alphaBA,' rad/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Angular acceleration of P2B= 73.9 rad/s**2angular acceleration of AB = 37.8 rad/s**2\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg28" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 12 PAGE NO 28\n", - "#calculate velocities at various point\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.32(a),1.32(b),1.32(c)\n", - "import math\n", - "PI=3.141\n", - "AB=12.## length of link AB in cm\n", - "BC=48.## length of link BC in cm\n", - "CD=18.## length of link CD in cm\n", - "DE=36.## length of link DE in cm\n", - "EF=12.## length of link EF in cm\n", - "FP=36.## length of link FP in cm\n", - "Nba=200.## roating speed of link BA IN rpm\n", - "wBA=2*PI*200./60.## Angular velocity of BA in rad/s\n", - "Vba=wBA*AB/100.## linear velocity of B with respect to A in m/s\n", - "Vc=2.428## velocity of c in m/s from diagram 1.32(b)\n", - "Vd=2.36## velocity of D in m/s from diagram 1.32(b)\n", - "Ve=1## velocity of e in m/s from diagram 1.32(b)\n", - "Vf=1.42## velocity of f in m/s from diagram 1.32(b)\n", - "Vcb=1.3## velocity of c with respect to b in m/s from figure\n", - "fBA=Vba**2.*100./AB## radial component of acceleration of B with respect to A in m/s**2\n", - "fCB=Vcb**2*100./BC## radial component of acceleration of C with respect to B in m/s**2\n", - "fcb=3.52## radial component of acceleration of C with respect to B in m/s**2 from figure\n", - "fC=19.## acceleration of slider in m/s**2 from figure\n", - "print'%s %.1f %s %.1f %s %.1f %s %.2f %s %.2f %s'%('velocity of c=',Vc,' m/s''velocity of d=',Vd,' m/s''velocity of e=',Ve,' m/s'' velocity of f=',Vf,' m/s''Acceleration of slider=',Vc,' m/s**2')\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "velocity of c= 2.4 m/svelocity of d= 2.4 m/svelocity of e= 1.0 m/s velocity of f= 1.42 m/sAcceleration of slider= 2.43 m/s**2\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 13 PAGE NO 30\n", - "#caculate angular acceleration at varoius points\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.33(a),1.33(b),1.33(c)\n", - "import math\n", - "PI=3.141\n", - "N=120.## speed of the crank OC in rpm\n", - "OC=5.## length of link OC in cm\n", - "cp=20.## length of link CP in cm\n", - "qa=10.## length of link QA in cm\n", - "pa=5.## length of link PA in cm\n", - "CP=46.9## velocity of link CP in cm/s\n", - "QA=58.3## velocity of link QA in cm/s\n", - "Pa=18.3## velocity of link PA in cm/s\n", - "Vc=2.*PI*N*OC/60.## velocity of C in m/s\n", - "Cco=Vc**2./OC## centripetal acceleration of C relative to O in cm/s**2\n", - "Cpc=CP**2./cp## centripetal acceleration of P relative to C in cm/s**2\n", - "Caq=QA**2./qa## centripetal acceleration of A relative to Q in cm/s**2\n", - "Cap=Pa**2./pa## centripetal acceleration of A relative to P in cm/s**2\n", - "pp1=530.\n", - "a1a=323.\n", - "a2a=207.5\n", - "ACP=pp1/cp## angular acceleration of link CP in rad/s**2\n", - "APA=a1a/qa## angular acceleration of link PA in rad/s**2\n", - "AAQ=a2a/pa## angular acceleration of link AQ in rad/s**2\n", - "print'%s %.3f %s %.3f %s %.3f %s'%('angular acceleration of link CP =',ACP,' rad/s**2'' angular acceleration of link CP=',APA,' rad/s**2''angular acceleration of link CP=',AAQ,' rad/s**2')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "angular acceleration of link CP = 26.500 rad/s**2 angular acceleration of link CP= 32.300 rad/s**2angular acceleration of link CP= 41.500 rad/s**2\n" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines/Chapter10.ipynb b/_Theory_Of_Machines/Chapter10.ipynb deleted file mode 100755 index 5ae48acb..00000000 --- a/_Theory_Of_Machines/Chapter10.ipynb +++ /dev/null @@ -1,507 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:5f892b8e3ed0a74f24a745bdf0e14528cdf96fe8388a860fc7931df67549db87" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter10-Brakes and Dynamometers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg268" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 1 PAGE NO 268\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate torque transmitted by the block brake\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=0.32;##Diameter of the drum in m\n", - "qq=90.;##Angle of contact in degree\n", - "P=820.;##Force applied in N\n", - "U=0.35;##Coefficient of friction\n", - "\n", - "\n", - "U1=((4.*U*math.sin(45/57.3))/((qq*(3.14/180.))+math.sin(90./57.3)));##Equivalent coefficient of friction\n", - "F=((P*0.66)/((0.3/U1)-0.06));##Force value in N taking moments\n", - "TB=(F*(d/2.));##Torque transmitted in N.m\n", - "\n", - "print'%s %.4f %s'%('Torque transmitted by the block brake is ',TB,' N.m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Torque transmitted by the block brake is 120.4553 N.m\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg269" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 2 PAGE NO 269\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate The bicycle travels a distance and makes turns before it comes to rest\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "m=120.;##Mass of rider in kg\n", - "v=16.2;##Speed of rider in km/hr\n", - "d=0.9;##Diameter of the wheel in m\n", - "P=120.;##Pressure applied on the brake in N\n", - "U=0.06;##Coefficient of friction\n", - "\n", - "F=(U*P);##Frictional force in N\n", - "KE=((m*(v*(5./18.))**2.)/2.);##Kinematic Energy in N.m\n", - "S=(KE/F);##Distance travelled by the bicycle before it comes to rest in m\n", - "N=(S/(d*3.14));##Required number of revolutions\n", - "\n", - "print'%s %.1f %s %.1f %s'%('The bicycle travels a distance of ',S,' m'and'',N,'turns before it comes to rest')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The bicycle travels a distance of 168.8 59.7 turns before it comes to rest\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg270" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 3 PAGE NO 270\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#evaluvate maximum torque absorbed\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "S=3500.;##Force on each arm in N\n", - "d=0.36;##Diamter of the wheel in m\n", - "U=0.4;##Coefficient of friction \n", - "qq=100.;##Contact angle in degree\n", - "\n", - "qqr=(qq*(3.14/180));##Contact angle in radians\n", - "UU=((4*U*math.sin(50/57.3))/(qqr+(math.sin(100./57.3))));##Equivalent coefficient of friction\n", - "F1=(S*0.45)/((0.2/UU)+((d/2.)-0.04));##Force on fulcrum in N\n", - "F2=(S*0.45)/((0.2/UU)-((d/2.)-0.04));##Force on fulcrum in N\n", - "TB=(F1+F2)*(d/2.);##Maximum torque absorbed in N.m\n", - "\n", - "print'%s %.2f %s'%('Maximum torque absorbed is ',TB,' N.m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum torque absorbed is 1412.67 N.m\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg271" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 4 PAGE NO 271\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate The maximum braking torque on the drum\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "a=0.5;##Length of lever in m\n", - "d=0.5;##Diameter of brake drum in m\n", - "q=(5/8.)*(2*3.14);##Angle made in radians\n", - "b=0.1;##Distance between pin and fulcrum in m\n", - "P=2000.;##Effort applied in N\n", - "U=0.25;##Coefficient of friction\n", - "\n", - "T=math.exp(U*q);##Ratios of tension\n", - "T2=((P*a)/b);##Tension in N\n", - "T1=(T*T2);##Tension in N\n", - "TB=((T1-T2)*(d/2.))/1000.;##Maximum braking torque in kNm\n", - "\n", - "print'%s %.2f %s'%('The maximum braking torque on the drum is',TB,' kNm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The maximum braking torque on the drum is 4.17 kNm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg271" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 5 PAGE NO 271\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#caculate the brake is self -locking and tension in the side \n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "q=220.;##Angle of contact in degree\n", - "T=340.;##Torque in Nm\n", - "d=0.32;##Diameter of drum in m\n", - "U=0.3;##Coefficient of friction\n", - "\n", - "Td=(T/(d/2.));##Difference in tensions in N\n", - "Tr=math.exp(U*(q*(3.14/180.)));##Ratio of tensions\n", - "T2=(Td/(Tr-1.));##Tension in N\n", - "T1=(Tr*T2);##Tension in N\n", - "P=((T2*(d/2.))-(T1*0.04))/0.5;##Force applied in N\n", - "b=(T1/T2)*4.;##Value of b in cm when the brake is self-locking\n", - "\n", - "print'%s %.2f %s %.2f %s %.2f %s '%('The value of b is ',b,' cm' 'when the brake is self-locking ' 'Tensions in the sides are ',T1,' N and',T2,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The value of b is 12.65 cmwhen the brake is self-locking Tensions in the sides are 3107.70 N and 982.70 N \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg272" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 6 PAGE NO 272\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate torque required and thickness necessary to limit the tensile stress to 70 and secton of the lever taking stress to 60 mpa\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=0.5;##Drum diamter in m\n", - "U=0.3;##Coefficient of friction\n", - "q=250;##Angle of contact in degree\n", - "P=750;##Force in N\n", - "a=0.1;##Band width in m\n", - "b=0.8;##Distance in m\n", - "ft=(70*10**6);##Tensile stress in Pa\n", - "f=(60*10**6);##Stress in Pa\n", - "b1=0.1;##Distance in m\n", - "\n", - "T=math.exp(U*(q*(3.14/180.)));##Tensions ratio\n", - "T2=(P*b*10.)/(T+1.);##Tension in N\n", - "T1=(T*T2);##Tension in N\n", - "TB=(T1-T2)*(d/2.);##Torque in N.m\n", - "t=(max(T1,T2)/(ft*a))*1000.;##Thickness in mm\n", - "M=(P*b);##bending moment at fulcrum in Nm\n", - "X=(M/((1/6.)*f));##Value of th**2\n", - "##t varies from 10mm to 15 mm. Taking t=15mm,\n", - "h=math.sqrt(X/(0.015))*1000.;##Section of the lever in m\n", - "\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('Torque required is ',TB,' N.m' 'Thickness necessary to limit the tensile stress to 70 MPa is ',t,' mm ''Section of the lever taking stress to 60 MPa is ',h,' mm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Torque required is 861.7 N.mThickness necessary to limit the tensile stress to 70 MPa is 0.7 mm Section of the lever taking stress to 60 MPa is 63.2 mm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg273" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 7 PAGE NO 273\n", - "##TITLE:Brakes and Dynamometers\n", - "#calculate value of x and value of power/bd ratio \n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "P1=30.;##Power in kW\n", - "N=1250.;##Speed in r.p.m\n", - "P=60.;##Applied force in N\n", - "d=0.8;##Drum diameter in m\n", - "q=310.;##Contact angle in degree\n", - "a=0.03;##Length of a in m\n", - "b=0.12;##Length of b in m\n", - "U=0.2;##Coefficient of friction\n", - "B=10.;##Band width in cm\n", - "D=80.;##Diameter in cm\n", - "\n", - "T=(P1*60000.)/(2.*3.14*N);##Torque in N.m\n", - "Td=(T/(d/2.));##Tension difference in N\n", - "Tr=math.exp(U*(q*(3.14/180.)));##Tensions ratio\n", - "T2=(Td/(Tr-1.));##Tension in N\n", - "T1=(Tr*T2);##Tension in N\n", - "x=((T2*b)-(T1*a))/P;##Distance in m;\n", - "X=(P1/(B*D));##Ratio\n", - "\n", - "print'%s %.3f %s %.3f %s'%('Value of x is ',x,' m '' Value of (Power/bD) ratio is ',X,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of x is 0.155 m Value of (Power/bD) ratio is 0.037 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg274" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 8 PAGE NO 274\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate time required to bring the shaft to the rest from its running condition\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "m=80.;##Mass of flywheel in kg\n", - "k=0.5;##Radius of gyration in m\n", - "N=250;##Speed in r.p.m\n", - "d=0.32;##Diamter of the drum in m\n", - "b=0.05;##Distance of pin in m\n", - "q=260.;##Angle of contact in degree\n", - "U=0.23;##Coefficient of friction\n", - "P=20;##Force in N\n", - "a=0.35;##Distance at which force is applied in m\n", - "\n", - "Tr=math.exp(U*q*(3.14/180.));##Tensions ratio\n", - "T2=(P*a)/b;##Tension in N\n", - "T1=(Tr*T2);##Tension in N\n", - "TB=(T1-T2)*(d/2.);##Torque in N.m\n", - "KE=((1/2.)*(m*k**2)*((2.*3.14*N)/60.)**2);##Kinematic energy of the rotating drum in Nm\n", - "N1=(KE/(TB*2.*3.14));##Speed in rpm\n", - "aa=((2*3.14*N)/60.)**2/(4.*3.14*N1);##Angular acceleration in rad/s**2\n", - "t=((2.*3.14*N)/60.)/aa;##Time in seconds\n", - "\n", - "print'%s %.1f %s'%('Time required to bring the shaft to the rest from its running condition is ',t,' seconds')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Time required to bring the shaft to the rest from its running condition is 12.7 seconds\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg275" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 9 PAGE NO 275\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate Minimum force required and Time taken to bring to rest \n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "n=12.;##Number of blocks\n", - "q=15.;##Angle subtended in degree\n", - "P=185.;##Power in kW\n", - "N=300.;##Speed in r.p.m\n", - "U=0.25;##Coefficient of friction\n", - "d=1.25;##Diamter in m\n", - "b1=0.04;##Distance in m\n", - "b2=0.14;##Distance in m\n", - "a=1.;##Diatance in m\n", - "m=2400.;##Mass of rotor in kg\n", - "k=0.5;##Radius of gyration in m\n", - "\n", - "Td=(P*60000.)/(2.*3.14*N*(d/2.));##Tension difference in N\n", - "T=Td*(d/2.);##Torque in Nm\n", - "Tr=((1+(U*math.tan(7.5/57.3)))/(1.-(U*math.tan(7.5/57.3))))**n;##Tension ratio\n", - "To=(Td/(Tr-1.));##Tension in N\n", - "Tn=(Tr*To);##Tension in N\n", - "P=((To*b2)-(Tn*b1))/a;##Force in N\n", - "aa=(T/(m*k**2));##Angular acceleration in rad/s**2\n", - "t=((2*3.14*N)/60.)/aa;##Time in seconds\n", - "\n", - "print'%s %.1f %s %.1f %s'%('Minimum force required is ',P,' N' 'Time taken to bring to rest is ',t,' seconds')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Minimum force required is 406.1 NTime taken to bring to rest is 3.2 seconds\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg275" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 10 PAGE NO 275\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate Maximum braking torque and Angular retardation of the drum and Time taken by the system to come to rest \n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "n=12.;## Number of blocks\n", - "q=16.;##Angle subtended in degrees\n", - "d=0.9;##Effective diameter in m\n", - "m=2000.;##Mass in kg\n", - "k=0.5;##Radius of gyration in m\n", - "b1=0.7;##Distance in m\n", - "b2=0.03;##Distance in m\n", - "a=0.1;##Distance in m\n", - "P=180.;##Force in N\n", - "N=360.;##Speed in r.p.m\n", - "U=0.25;##Coefficient of friction\n", - "\n", - "Tr=((1.+(U*math.tan(8/57.3)))/(1.-(U*math.tan(8/57.3))))**n;##Tensions ratio\n", - "T2=(P*b1)/(a-(b2*Tr));##Tension in N\n", - "T1=(Tr*T2);##Tension in N\n", - "TB=(T1-T2)*(d/2.);##Torque in N.m\n", - "aa=(TB/(m*k**2.));##Angular acceleration in rad/s**2\n", - "t=((2.*3.14*N)/60.)/aa;##Time in seconds\n", - "\n", - "print'%s %.2f %s %.2f %s %.2f %s '%('(i) Maximum braking torque is ',TB,'Nm ''(ii) Angular retardation of the drum is ',aa,' rad/s**2''(iii) Time taken by the system to come to rest is ',t,' s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(i) Maximum braking torque is 2481.63 Nm (ii) Angular retardation of the drum is 4.96 rad/s**2(iii) Time taken by the system to come to rest is 7.59 s \n" - ] - } - ], - "prompt_number": 10 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines/Chapter11.ipynb b/_Theory_Of_Machines/Chapter11.ipynb deleted file mode 100755 index ec8d5927..00000000 --- a/_Theory_Of_Machines/Chapter11.ipynb +++ /dev/null @@ -1,450 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:ebcd9b3d07a8d6768db168aed38e578ce5aca1ce1a2df85108f9e88506949f89" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter11-VIBRATIONS" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg290" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 1 PAGE NO 290\n", - "##TITLE:VIBRATIONS\n", - "import math\n", - "#calculate frequency of longitudinal vibration and transversve vibaration\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "D=.1## DIAMETER OF SHAFT IN m\n", - "L=1.10## LENGTH OF SHAFT IN m\n", - "W=450## WEIGHT ON THE OTHER END OF SHAFT IN NEWTONS\n", - "E=200*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "## =========================================================================================\n", - "A=PI*D**2./4.## AREA OF SHAFT IN mm**2\n", - "I=PI*D**4./64.## MOMENT OF INERTIA \n", - "delta=W*L/(A*E)## STATIC DEFLECTION IN LONGITUDINAL VIBRATION OF SHAFT IN m\n", - "Fn=0.4985/(delta)**.5## FREQUENCY OF LONGITUDINAL VIBRATION IN Hz\n", - "delta1=W*L**3./(3.*E*I)## STATIC DEFLECTION IN TRANSVERSE VIBRATION IN m\n", - "Fn1=0.4985/(delta1)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.2f %s %.2f %s '%('FREQUENCY OF LONGITUDINAL VIBRATION =',Fn,' Hz' 'FREQUENCY OF TRANSVERSE VIBRATION =',Fn1,'Hz')\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF LONGITUDINAL VIBRATION = 888.78 HzFREQUENCY OF TRANSVERSE VIBRATION = 34.99 Hz \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg290" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 2 PAGE NO 290\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.10\n", - "#calculate natural frequency of transverse vibration\n", - "#import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "L=.9## LENGTH OF THE SHAFT IN m\n", - "m=100## MASS OF THE BODY IN Kg\n", - "L2=.3## LENGTH WHERE THE WEIGHT IS ACTING IN m\n", - "L1=L-L2## DISTANCE FROM THE OTHER END\n", - "D=.06## DIAMETER OF SHAFT IN m\n", - "W=9.81*m## WEGHT IN NEWTON\n", - "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "##==========================================================================================\n", - "##CALCULATION\n", - "I=PI*D**4./64.## MOMENT OF INERTIA IN m**4\n", - "delta=W*L1**2*L2**2./(3.*E*I*L)## STATIC DEFLECTION\n", - "Fn=.4985/(delta)**.5## NATURAL FREQUENCY OF TRANSVERSE VIBRATION\n", - "##=========================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('NATURAL FREQUENCY OF TRANSVERSE VIBRATION=',Fn,' Hz')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "NATURAL FREQUENCY OF TRANSVERSE VIBRATION= 51.9 Hz\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg291" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 3 PAGE NO 291 ##TITLE:VIBRATIONS\n", - "##FIGURE 11.11\n", - "import math\n", - "#calculate frequency of longitudnial vibration and frequency of transverse vibration and torisional vibration\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "D=.050## DIAMETER OF SHAFT IN m\n", - "m=450## WEIGHT OF FLY WHEEL IN IN Kg\n", - "K=.5## RADIUS OF GYRATION IN m\n", - "L2=.6## FROM FIGURE IN m\n", - "L1=.9## FROM FIGURE IN m\n", - "L=L1+L2\n", - "E=200.*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "C=84.*10**9## MODUKUS OF RIDITY OF SHAFT MATERIAL IN Pascals\n", - "##=========================================================================================\n", - "A=PI*D**2./4.## AREA OF SHAFT IN mm**2\n", - "I=PI*D**4./64.## \n", - "m1=m*L2/(L1+L2)## MASS OF THE FLYWHEEL CARRIED BY THE LENGTH L1 IN Kg\n", - "DELTA=m1*g*L1/(A*E)## EXTENSION OF LENGTH L1 IN m\n", - "Fn=0.4985/(DELTA)**.5## FREQUENCY OF LONGITUDINAL VIBRATION IN Hz\n", - "DELTA1=(m*g*L1**3*L2**3)/(3*E*I*L**3)## STATIC DEFLECTION IN TRANSVERSE VIBRATION IN m\n", - "Fn1=0.4985/(DELTA1)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", - "J=PI*D**4./32.## POLAR MOMENT OF INERTIA IN m**4\n", - "Q1=C*J/L1## TORSIONAL STIFFNESS OF SHAFT DUE TO L1 IN N-m\n", - "Q2=C*J/L2## TORSIONAL STIFFNESS OF SHAFT DUE TO L2 IN N-m\n", - "Q=Q1+Q2## TORSIONAL STIFFNESS OF SHAFT IN Nm\n", - "Fn2=(Q/(m*K**2))**.5/(2.*PI)## FREQUENCY OF TORSIONAL VIBRATION IN Hz\n", - "##=======================================================================================\n", - "print'%s %.3f %s %.3f %s %.3f %s '%('FREQUENCY OF LONGITUDINAL VIBRATION = ',Fn,' Hz''FREQUENCY OF TRANSVERSE VIBRATION = ',Fn1,' Hz'' FREQUENCY OF TORSIONAL VIBRATION = ',Fn2,' Hz')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF LONGITUDINAL VIBRATION = 248.014 HzFREQUENCY OF TRANSVERSE VIBRATION = 14.916 Hz FREQUENCY OF TORSIONAL VIBRATION = 5.673 Hz \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg294" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 6 PAGE NO 294\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.14\n", - "import math\n", - "#calculate frequency of transverse vibration\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "D=.06## DIAMETER OF SHAFT IN m\n", - "L=3.## LENGTH OF SHAFT IN m\n", - "W1=1500.## WEIGHT ACTING AT C IN N\n", - "W2=2000.## WEIGHT ACTING AT D IN N\n", - "W3=1000.## WEIGHT ACTING AT E IN N\n", - "L1=1.## LENGTH FROM A TO C IN m\n", - "L2=2.## LENGTH FROM A TO D IN m\n", - "L3=2.5## LENGTH FROM A TO E IN m\n", - "I=PI*D**4./64.\n", - "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "##===========================================================================================\n", - "DELTA1=W1*L1**2.*(L-L1)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W1\n", - "DELTA2=W2*L2**2.*(L-L2)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", - "DELTA3=W2*L3**2.*(L-L3)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", - "Fn=.4985/(DELTA1+DELTA2+DELTA3)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", - "##==========================================================================================\n", - "print'%s %.3f %s'%('FREQUENCY OF TRANSVERSE VIBRATION = ',Fn,' Hz')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF TRANSVERSE VIBRATION = 4.080 Hz\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg296" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 10 PAGE NO 296\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.18\n", - "import math\n", - "#calculate FREQUENCY OF TRANSVERSE VIBRATION\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "E=200.*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "D=.03## DIAMETER OF SHAFT IN m\n", - "L=.8## LENGTH OF SHAFT IN m\n", - "r=40000.## DENSITY OF SHAFT MATERIAL IN Kg/m**3\n", - "W=10.## WEIGHT ACTING AT CENTRE IN N\n", - "##===========================================================================================\n", - "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", - "m=PI*D**2./4.*r## MASS PER UNIT LENGTH IN Kg/m\n", - "w=m*g\n", - "DELTA=W*L**3./(48.*E*I)## STATIC DEFLECTION DUE TO W\n", - "DELTA1=5.*w*L**4./(384.*E*I)## STATIC DEFLECTION DUE TO WEIGHT OF SHAFT \n", - "Fn=.4985/(DELTA+DELTA1/1.27)**.5\n", - "##==========================================================================================\n", - "print'%s %.3f %s'%('FREQUENCY OF TRANSVERSE VIBRATION = ',Fn,' Hz')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF TRANSVERSE VIBRATION = 39.426 Hz\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg297" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 11 PAGE NO 297\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.19\n", - "import math\n", - "#evaluvate CRITICAL SPEED OF SHAFT\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "E=210.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "D=.18## DIAMETER OF SHAFT IN m\n", - "L=2.5## LENGTH OF SHAFT IN m\n", - "M1=25.## MASS ACTING AT E IN Kg\n", - "M2=50.## MASS ACTING AT D IN Kg\n", - "M3=20.## MASS ACTING AT C IN Kg\n", - "W1=M1*g\n", - "W2=M2*g\n", - "W3=M3*g\n", - "L1=.6## LENGTH FROM A TO E IN m\n", - "L2=1.5## LENGTH FROM A TO D IN m\n", - "L3=2.## LENGTH FROM A TO C IN m\n", - "w=1962.## SELF WEIGHT OF SHAFT IN N\n", - "##==========================================================================================\n", - "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", - "DELTA1=W1*L1**2.*(L-L1)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W1\n", - "DELTA2=W2*L2**2.*(L-L2)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", - "DELTA3=W3*L3**2.*(L-L3)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W3\n", - "DELTA4=5.*w*L**4./(384.*E*I)## STATIC DEFLECTION DUE TO w\n", - "Fn=.4985/(DELTA1+DELTA2+DELTA3+DELTA4/1.27)**.5\n", - "Nc=Fn*60## CRITICAL SPEED OF SHAFT IN rpm\n", - "##========================================================================================\n", - "print'%s %.3f %s'%('CRITICAL SPEED OF SHAFT = ',Nc,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "CRITICAL SPEED OF SHAFT = 3111.629 rpm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg298" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 12 PAGE NO 298\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.20\n", - "import math\n", - "#calculate FREQUENCY OF FREE TORSIONAL VIBRATION\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "Na=1500.## SPEED OF SHAFT A IN rpm\n", - "Nb=500.## SPEED OF SHAFT B IN rpm\n", - "G=Na/Nb## GERA RATIO\n", - "L1=.18## LENGTH OF SHAFT 1 IN m\n", - "L2=.45## LENGTH OF SHAFT 2 IN m\n", - "D1=.045## DIAMETER OF SHAFT 1 IN m\n", - "D2=.09## DIAMETER OF SHAFT 2 IN m\n", - "C=84.*10**9## MODUKUS OF RIDITY OF SHAFT MATERIAL IN Pascals\n", - "Ib=1400.## MOMENT OF INERTIA OF PUMP IN Kg-m**2\n", - "Ia=400.## MOMENT OF INERTIA OF MOTOR IN Kg-m**2\n", - "\n", - "##======================================================================================\n", - "J=PI*D1**4./32.## POLAR MOMENT OF INERTIA IN m**4\n", - "Ib1=Ib/G**2.## MASS MOMENT OF INERTIA OF EQUIVALENT ROTOR IN m**2\n", - "L3=G**2.*L2*(D1/D2)**4.## ADDITIONAL LENGTH OF THE EQUIVALENT SHAFT\n", - "L=L1+L3## TOTAL LENGTH OF EQUIVALENT SHAFT\n", - "La=L*Ib1/(Ia+Ib1)\n", - "Fn=(C*J/(La*Ia))**.5/(2.*PI)## FREQUENCY OF FREE TORSIONAL VIBRATION IN Hz\n", - "##===================================================================================\n", - "print'%s %.2f %s'%('FREQUENCY OF FREE TORSIONAL VIBRATION = ',Fn,' Hz')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF FREE TORSIONAL VIBRATION = 4.20 Hz\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg300" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 13 PAGE NO 300\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.21\n", - "import math\n", - "#calculate critical speed of shaft and the range of speed \n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "D=.015## DIAMETER OF SHAFT IN m\n", - "L=1.00## LENGTH OF SHAFT IN m\n", - "M=15.## MASS OF SHAFT IN Kg\n", - "W=M*g\n", - "e=.0003## ECCENTRICITY IN m\n", - "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "f=70.*10**6.## PERMISSIBLE STRESS IN N/m**2\n", - "##============================================================================================\n", - "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", - "DELTA=W*L**3./(192.*E*I)## STATIC DEFLECTION IN m\n", - "Fn=.4985/(DELTA)**.5## NATURAL FREQUENCY OF TRANSVERSE VIBRATION\n", - "Nc=Fn*60.## CRITICAL SPEED OF SHAFT IN rpm\n", - "M1=16.*f*I/(D*g*L)\n", - "W1=M1*g## ADDITIONAL LOAD ACTING\n", - "y=W1/W*DELTA## ADDITIONAL DEFLECTION DUE TO W1\n", - "N1=Nc/(1.+e/y)**.5## MIN SPEED IN rpm\n", - "N2=Nc/(1.-e/y)**.5## MAX SPEED IN rpm\n", - "##===========================================================================================\n", - "print'%s %.3f %s %.3f %s %.3f %s '%('CRITICAL SPEED OF SHAFT = ',Nc,' rpm''THE RANGE OF SPEED IS FROM',N1,'rpm TO ',N2,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "CRITICAL SPEED OF SHAFT = 762.330 rpmTHE RANGE OF SPEED IS FROM 709.555 rpm TO 828.955 rpm \n" - ] - } - ], - "prompt_number": 8 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines/Chapter12.ipynb b/_Theory_Of_Machines/Chapter12.ipynb deleted file mode 100755 index 6706c05c..00000000 --- a/_Theory_Of_Machines/Chapter12.ipynb +++ /dev/null @@ -1,380 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:2fbbfd8e1fae5de695230b7f28341e3abac22cade207682955694bcaba6d0716" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter12-Balancing of reciprocating of masses" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 1 PAGE NO 310\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "#calculate the magnitude of balance mass required and residual balance error\n", - "pi=3.141\n", - "N=250.## speed of the reciprocating engine in rpm\n", - "s=18.## length of stroke in mm\n", - "mR=120.## mass of reciprocating parts in kg\n", - "m=70.## mass of revolving parts in kg\n", - "r=.09## radius of revolution of revolving parts in m\n", - "b=.15## distance at which balancing mass located in m\n", - "c=2./3.## portion of reciprocating mass balanced \n", - "teeta=30.## crank angle from inner dead centre in degrees\n", - "##===============================\n", - "B=r*(m+c*mR)/b## balance mass required in kg\n", - "w=2.*math.pi*N/60.## angular speed in rad/s\n", - "F=mR*w**2.*r*(((1.-c)**2.*(math.cos(teeta/57.3))**2.)+(c**2.*(math.sin(teeta/57.3))**2.))**.5## residual unbalanced forces in N\n", - "print'%s %.1f %s %.3f %s'%('Magnitude of balance mass required= ',B,'kg' and 'Residual unbalanced forces= ',F,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Magnitude of balance mass required= 90.0 Residual unbalanced forces= 3263.971 N\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 2 PAGE NO 310\n", - "##TITLE:Balancing of reciprocating of masses\n", - "#calculate speed and swaying couples \n", - "pi=3.141\n", - "g=10.## acceleration due to gravity approximately in m/s**2\n", - "mR=240.## mass of reciprocating parts per cylinder in kg\n", - "m=300.## mass of rotating parts per cylinder in kg\n", - "a=1.8##distance between cylinder centres in m\n", - "c=.67## portion of reciprocating mass to be balanced\n", - "b=.60## radius of balance masses in m\n", - "r=24.## crank radius in cm\n", - "R=.8##radius of thread of wheels in m\n", - "M=40.\n", - "##=======================================\n", - "Ma=m+c*mR## total mass to be balanced in kg\n", - "mD=211.9## mass of wheel D from figure in kg\n", - "mC=211.9##..... mass of wheel C from figure in kg\n", - "theta=171.## angular position of balancing mass C in degrees\n", - "Br=c*mR/Ma*mC## balancing mass for reciprocating parts in kg\n", - "w=(M*g**3./Br/b)**.5## angular speed in rad/s\n", - "v=w*R*3600./1000.## speed in km/h\n", - "S=a*(1.-c)*mR*w**2*r/2.**.5/100./1000.## swaying couple in kNm\n", - "print'%s %.3f %s %.3f %s'%('speed=',v,' kmph'and ' swaying couple=',S,' kNm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed= 86.476 swaying couple= 21.812 kNm\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg313" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 3 PAGE NO 313\n", - "##TITLE:Balancing of reciprocating of masses\n", - "#calculate hammer blow and tractive effort and swaying couple\n", - "import math\n", - "pi=3.141\n", - "g=10.## acceleration due to gravity approximately in m/s**2\n", - "a=.70##distance between cylinder centres in m\n", - "r=60.## crank radius in cm\n", - "m=130.##mass of rotating parts per cylinder in kg\n", - "mR=210.## mass of reciprocating parts per cylinder in kg\n", - "c=.67## portion of reciprocating mass to be balanced\n", - "N=300.##e2engine speed in rpm\n", - "b=.64## radius of balance masses in m\n", - "##============================\n", - "Ma=m+c*mR## total mass to be balanced in kg\n", - "mA=100.44## mass of wheel A from figure in kg\n", - "Br=c*mR/Ma*mA## balancing mass for reciprocating parts in kg\n", - "H=Br*(2.*math.pi*N/60.)**2*b## hammer blow in N\n", - "w=(2.*math.pi*N/60.)## angular speed\n", - "T=2**.5*(1.-c)*mR*w**2.*r/2./100.##tractive effort in N\n", - "S=a*(1.-c)*mR*w**2.*r/2./2.**.5/100.## swaying couple in Nm\n", - "\n", - "print'%s %.3f %s %.3f %s %.3f %s'%('Hammer blow=',H,' in N' 'tractive effort= ',T,' in N' 'swaying couple= ',S,' in Nm')\n", - "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hammer blow= 32975.566 in Ntractive effort= 29018.117 in Nswaying couple= 10156.341 in Nm\n", - "The answer is a bit different due to rounding off error in textbook\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg314" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 4 PAGE NO 314\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "#calculate maximum unbalanced primary couples\n", - "pi=3.141\n", - "mR=900.## mass of reciprocating parts in kg\n", - "N=90.## speed of the engine in rpm\n", - "r=.45##crank radius in m\n", - "cP=.9*mR*(2.*math.pi*N/60.)**2.*r*2.**.5/1000.## maximum unbalanced primary couple in kNm\n", - "print'%s %.3f %s'%('maximum unbalanced primary couple=',cP,' k Nm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "maximum unbalanced primary couple= 45.788 k Nm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg315" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 5 PAGE NO 315\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "#calculate maximum unbalanced secondary force and with reasons\n", - "pi=3.141\n", - "mRA=160.## mass of reciprocating cylinder A in kg\n", - "mRD=160.## mass of reciprocating cylinder D in kg\n", - "r=.05## stroke lenght in m\n", - "l=.2## connecting rod length in m\n", - "N=450.## engine speed in rpm\n", - "##===========================\n", - "theta2=78.69## crank angle between A & B cylinders in degrees\n", - "mRB=576.88## mass of cylinder B in kg\n", - "n=l/r## ratio between connecting rod length and stroke length\n", - "w=2.*math.pi*N/60.## angular speed in rad/s\n", - "F=mRB*2.*w**2.*r*math.cos((2.*theta2)/57.3)/n\n", - "print'%s %.3f %s'%('Maximum unbalanced secondary force=',F,' N in anticlockwise direction thats why - sign')\n", - "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum unbalanced secondary force= -29560.284 N in anticlockwise direction thats why - sign\n", - "The answer is a bit different due to rounding off error in textbook\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg316" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 6 PAGE NO 316\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "pi=3.141\n", - "rA=.25## stroke length of A piston in m\n", - "rB=.25## stroke length of B piston in m\n", - "rC=.25## stroke length C piston in m\n", - "N=300.## engine speed in rpm\n", - "mRL=280.## mass of reciprocating parts in inside cylinder kg\n", - "mRO=240.## mass of reciprocating parts in outside cylinder kg\n", - "c=.5## portion ofreciprocating masses to be balanced \n", - "b1=.5## radius at which masses to be balanced in m\n", - "##======================\n", - "mA=c*mRO## mass of the reciprocating parts to be balanced foreach outside cylinder in kg\n", - "mB=c*mRL## mass of the reciprocating parts to be balanced foreach inside cylinder in kg\n", - "B1=79.4## balancing mass for reciprocating parts in kg\n", - "w=2.*math.pi*N/60.## angular speed in rad/s\n", - "H=B1*w**2*b1## hammer blow per wheel in N\n", - "print'%s %.1f %s'%('Hammer blow per wheel= ',H,' N')\n", - "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hammer blow per wheel= 39182.3 N\n", - "The answer is a bit different due to rounding off error in textbook\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg318" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 7 PAGE NO 318\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "\n", - "pi=3.141\n", - "mR=300.## reciprocating mass per cylinder in kg\n", - "r=.3## crank radius in m\n", - "D=1.7## driving wheel diameter in m\n", - "a=.7## distance between cylinder centre lines in m\n", - "H=40.## hammer blow in kN\n", - "v=90.## speed in kmph\n", - "##=======================================\n", - "R=D/2.## radius of driving wheel in m\n", - "w=90.*1000./3600./R## angular velocity in rad/s\n", - "##Br*b=69.625*c by mearument from diagram\n", - "c=H*1000./(w**2.)/69.625## portion of reciprocating mass to be balanced\n", - "T=2.**.5*(1-c)*mR*w**2.*r## variation in tractive effort in N\n", - "M=a*(1.-c)*mR*w**2.*r/2.**.5## maximum swaying couple in N-m\n", - "print'%s %.3f %s %.3f %s %.3f %s'%('portion of reciprocating mass to be balanced=',c,' ''variation in tractive effort=',T,' N'' maximum swaying couple=',M,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "portion of reciprocating mass to be balanced= 0.664 variation in tractive effort= 36980.420 N maximum swaying couple= 12943.147 N-m\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg320" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 8 PAGE NO 320\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "pi=3.141\n", - "N=1800.## speed of the engine in rpm\n", - "r=6.## length of crank in cm\n", - "l=24.## length of connecting rod in cm\n", - "m=1.5## mass of reciprocating cylinder in kg\n", - "##====================\n", - "w=2.*math.pi*N/60.## angular speed in rad/s\n", - "UPC=.019*w**2.## unbalanced primary couple in N-m\n", - "n=l/r## ratio of length of crank to the connecting rod \n", - "USC=.054*w**2./n## unbalanced secondary couple in N-m\n", - "print'%s %.f %s %.3f %s '%('unbalanced primary couple=',UPC,'N-m' 'unbalanced secondary couple=',USC,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "unbalanced primary couple= 675 N-munbalanced secondary couple= 479.663 N-m \n" - ] - } - ], - "prompt_number": 8 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines/Chapter2.ipynb b/_Theory_Of_Machines/Chapter2.ipynb deleted file mode 100755 index 0ed80f3b..00000000 --- a/_Theory_Of_Machines/Chapter2.ipynb +++ /dev/null @@ -1,824 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:1b022ca97a90c946dcce72b014fa00f7dd7b26ac917f0b5fe9fdd6cabd6dcdfd" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter2-TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg57" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2 ILLUSRTATION 1 PAGE NO 57\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "Na=300.;##driving shaft running speed in rpm\n", - "Nb=400.;##driven shaft running speed in rpm\n", - "Da=60.;##diameter of driving shaft in mm\n", - "t=.8;##belt thickness in mm\n", - "s=.05;##slip in percentage(5%)\n", - "##==========================================================================================\n", - "##calculation\n", - "Db=(Da*Na)/Nb;##finding out the diameter of driven shaft without considering the thickness of belt\n", - "Db1=(((Da+t)*Na)/Nb)-t##/considering the thickness\n", - "Db2=(1.-s)*(Da+t)*(Na/Nb)-t##considering slip also\n", - "##=========================================================================================\n", - "##output\n", - "print'%s %.1f %s'%('the value of Db is',Db,' cm')\n", - "print'%s %.1f %s'%('the value of Db1 is',Db1,' cm')\n", - "print'%s %.1f %s'%('the value of Db2 is',Db2,' cm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the value of Db is 45.0 cm\n", - "the value of Db1 is 44.8 cm\n", - "the value of Db2 is 42.5 cm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg57" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSRTATION 2 PAGE NO 57\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "\n", - "##====================================================================================\n", - "##input\n", - "n1=1200##rpm of motor shaft\n", - "d1=40##diameter of motor pulley in cm\n", - "d2=70##diameter of 1st pulley on the shaft in cm\n", - "s=.03##percentage slip(3%)\n", - "d3=45##diameter of 2nd pulley\n", - "d4=65##diameter of the pulley on the counnter shaft\n", - "##=========================================================================================\n", - "##calculation\n", - "n2=n1*d1*(1-s)/d2##rpm of driven shaft\n", - "n3=n2##both the pulleys are mounted on the same shaft\n", - "n4=n3*(1-s)*d3/d4##rpm of counter shaft\n", - "\n", - "##output\n", - "print'%s %.1f %s %.1f %s '%('the speed of driven shaft is',n2,' rpm''the speed of counter shaft is ',n4,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the speed of driven shaft is 665.1 rpmthe speed of counter shaft is 446.7 rpm \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg58" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2 ILLUSTRATION 3 PAGE NO:58\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##==============================================================================\n", - "##input\n", - "d1=30.##diameter of 1st shaft in cm\n", - "d2=50.##diameter 2nd shaft in cm\n", - "pi=3.141\n", - "c=500.##centre distance between the shafts in cm\n", - "##==============================================================================\n", - "##calculation\n", - "L1=((d1+d2)*pi/2.)+(2.*c)+((d1+d2)**2.)/(4.*c)##lenth of cross belt\n", - "L2=((d1+d2)*pi/2.)+(2.*c)+((d1-d2)**2.)/(4.*c)##lenth of open belt\n", - "r=L1-L2##remedy\n", - "##==============================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('length of cross belt is ',L1,'cm '' length of open belt is ',L2,'cm''the length of the belt to be shortened is ',r,' cm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "length of cross belt is 1128.8 cm length of open belt is 1125.8 cmthe length of the belt to be shortened is 3.0 cm \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg59" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##CHAPTER 2,ILLUSTRATION 4 PAGE 59\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##====================================================================================\n", - "##INPUT\n", - "D1=.5## DIAMETER OF 1ST SHAFT IN m\n", - "D2=.25## DIAMETER OF 2nd SHAFT IN m\n", - "C=2.## CENTRE DISTANCE IN m\n", - "N1=220.## SPEED OF 1st SHAFT\n", - "T1=1250.## TENSION ON TIGHT SIDE IN N\n", - "U=.25## COEFFICIENT OF FRICTION\n", - "PI=3.141\n", - "e=2.71\n", - "##====================================================================================\n", - "##CALCULATION\n", - "L=(D1+D2)*PI/2.+((D1+D2)**2./(4.*C))+2.*C\n", - "F=(D1+D2)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.+(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", - "T2=T1/(e**(U*THETA))## TENSION ON SLACK SIDE IN N\n", - "V=PI*D1*N1/60.## VELOCITY IN m/s\n", - "P=(T1-T2)*V/1000.## POWER IN kW\n", - "##====================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('LENGTH OF BELT REQUIRED =',L,' m')\n", - "print'%s %.1f %s'%('ANGLE OF CONTACT =',THETA,' radians')\n", - "print'%s %.1f %s'%('POWER CAN BE TRANSMITTED=',P,' kW')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "LENGTH OF BELT REQUIRED = 5.2 m\n", - "ANGLE OF CONTACT = 3.1 radians\n", - "POWER CAN BE TRANSMITTED= 3.9 kW\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg59" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 5 PAGE 5\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##=====================================================================================================\n", - "##input\n", - "n1=100.## of driving shaft\n", - "n2=240.##speed of driven shaft\n", - "p=11000.##power to be transmitted in watts\n", - "c=250.##centre distance in cm\n", - "d2=60.##diameter in cm\n", - "b=11.5*10**-2##width of belt in metres\n", - "t=1.2*10**-2##thickness in metres\n", - "u=.25##co-efficient of friction \n", - "pi=3.141\n", - "e=2.71\n", - "##===================================================================================================\n", - "##calculation for open bely drive\n", - "d1=n2*d2/n1\n", - "f=(d1-d2)/(2.*c)##sin(alpha) for open bely drive\n", - "##angle of arc of contact for open belt drive is,theta=180-2*alpha\n", - "alpha=math.asin(f)*57.3\n", - "teta=(180.-(2*alpha))*3.147/180.##pi/180 is used to convert into radians\n", - "x=(e**(u*teta))##finding out the value of t1/t2\n", - "v=pi*d2*10.*n2/60.##finding out the value of t1-t2\n", - "y=p*1000./(v)\n", - "t1=(y*x)/(x-1.)\n", - "Fb=t1/(t*b)/1000.\n", - "##=======================================================================================================\n", - "##calculation for cross belt drive bely drive\n", - "F=(d1+d2)/(2.*c)##for cross belt drive bely drive\n", - "ALPHA=math.asin(F)*57.3\n", - "THETA=(180.+(2.*ALPHA))*pi/180.##pi/180 is used to convert into radians\n", - "X=(e**(u*THETA))##finding out the value of t1/t2\n", - "V=pi*d2*10.*n2/60.##finding out the value of t1-t2\n", - "Y=p*1000./(V)\n", - "T1=(Y*X)/(X-1.)\n", - "Fb2=T1/(t*b)/1000.\n", - "##========================================================================================================\n", - "##output\n", - "print('for a open belt drive:')\n", - "print'%s %.1f %s %.1f %s'%('the tension in belt is ',t1,'N' 'stress induced is ',Fb,' kN/m**2')\n", - "print('for a cross belt drive:')\n", - "print'%s %.1f %s %.1f %s '%('the tension in belt is ',T1,'N' 'stress induced is ',Fb2,' kN/m**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for a open belt drive:\n", - "the tension in belt is 2898.4 Nstress induced is 2100.3 kN/m**2\n", - "for a cross belt drive:\n", - "the tension in belt is 2318.8 Nstress induced is 1680.3 kN/m**2 \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg61" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 6 PAGE 61\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##========================================================================================\n", - "##INPUT\n", - "D1=80.##DIAMETER OF SHAFT IN cm\n", - "N1=160.##SPEED OF 1ST SHAFT IN rpm\n", - "N2=320.##SPEED OF 2ND SHAFT IN rpm\n", - "C=250.##CENTRE DISTANCE IN CM\n", - "U=.3##COEFFICIENT OF FRICTION\n", - "P=4.##POWER IN KILO WATTS\n", - "e=2.71\n", - "PI=3.141\n", - "f=110.##STRESS PER cm WIDTH OF BELT\n", - "##========================================================================================\n", - "##CALCULATION\n", - "V=PI*D1*math.pow(10,-2)*N1/60.##VELOCITY IN m/s\n", - "Y=P*1000./V##Y=T1-T2\n", - "D2=D1*(N1/N2)##DIAMETER OF DRIVEN SHAFT\n", - "F=(D1-D2)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.-(2.*ALPHA))*PI/180.##ANGLE OF CONTACT IN radians\n", - "X=e**(U*THETA)##VALUE OF T1/T2\n", - "T1=X*Y/(X-1.)\n", - "b=T1/f##WIDTH OF THE BELT REQUIRED \n", - "##=======================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('THE WIDTH OF THE BELT IS ',b,' cm')\n", - "#apporximate ans is correct " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE WIDTH OF THE BELT IS 8.9 cm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg62" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2 ILLUSRTATION 7 PAGE NO 62\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "m=1000.## MASS OF THE CASTING IN kg\n", - "PI=3.141\n", - "THETA=2.75*2*PI## ANGLE OF CONTACT IN radians\n", - "D=.26## DIAMETER OF DRUM IN m\n", - "N=24.## SPEED OF THE DRUM IN rpm\n", - "U=.25## COEFFICIENT OF FRICTION\n", - "e=2.71\n", - "T1=9810## TENSION ON TIGHTSIDE IN N\n", - "##=============================================================================================\n", - "##CALCULATION\n", - "T2=T1/(e**(U*THETA))## tension on slack side of belt in N\n", - "W=m*9.81## WEIGHT OF CASTING IN N\n", - "R=D/2.## RADIUS OF DRUM IN m\n", - "P=2*PI*N*W*R/60000.## POWER REQUIRED IN kW\n", - "P2=(T1-T2)*PI*D*N/60000.## POWER SUPPLIED BY DRUM IN kW\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('FORCE REQUIRED BY MAN=',T2,' N'and 'POWER REQUIRED TO RAISE CASTING=',P,' kW' 'POWER SUPPLIED BY DRUM=',P2,' kW')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FORCE REQUIRED BY MAN= 132.4 POWER REQUIRED TO RAISE CASTING= 3.2 kWPOWER SUPPLIED BY DRUM= 3.2 kW \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg62" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 8 PAGE 62\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##INPUT\n", - "t=9.##THICKNESS IN mm\n", - "b=250.##WIDTH IN mm\n", - "D=90.##DIAMETER OF PULLEY IN cm\n", - "N=336.##SPEED IN rpm\n", - "PI=3.141\n", - "U=.35##COEFFICIENT FRICTION\n", - "e=2.71\n", - "THETA=120.*PI/180.\n", - "Fb=2.##STRESS IN MPa\n", - "d=1000.##DENSITY IN KG/M**3\n", - "\n", - "##CALCULATION\n", - "M=b*10**-3.*t*10**-3.*d##MASS IN KG\n", - "V=PI*D*10**-2.*N/60.##VELOCITY IN m/s\n", - "Tc=M*V**2##CENTRIFUGAL TENSION\n", - "Tmax=b*t*Fb##MAX TENSION IN N\n", - "T1=Tmax-Tc\n", - "T2=T1/(e**(U*THETA))\n", - "P=(T1-T2)*V/1000.\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('THE TENSION ON TIGHT SIDE OF THE BELT IS',T1,' N')\n", - "print'%s %.1f %s'%('THE TENSION ON SLACK SIDE OF THE BELT IS ',T2,' N')\n", - "print'%s %.1f %s'%('CENTRIFUGAL TENSION =',Tc,'N')\n", - "print'%s %.1f %s'%('THE POWER CAPACITY OF BELT IS ',P,' KW')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE TENSION ON TIGHT SIDE OF THE BELT IS 3936.1 N\n", - "THE TENSION ON SLACK SIDE OF THE BELT IS 1895.6 N\n", - "CENTRIFUGAL TENSION = 563.9 N\n", - "THE POWER CAPACITY OF BELT IS 32.3 KW\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg63" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 9 PAGE 63\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##INPUT\n", - "P=35000.##POWER TO BE TRANSMITTED IN WATTS\n", - "D=1.5##EFFECTIVE DIAMETER OF PULLEY IN METRES\n", - "N=300.##SPEED IN rpm\n", - "e=2.71\n", - "U=.3##COEFFICIENT OF FRICTION\n", - "PI=3.141\n", - "THETA=(11/24.)*360.*PI/180.##ANGLE OF CONTACT\n", - "density=1.1##density of belt material in Mg/m**3\n", - "L=1.##in metre\n", - "t=9.5##THICKNESS OF BELT IN mm\n", - "Fb=2.5##PERMISSIBLE WORK STRESS IN N/mm**2\n", - "\n", - "##CALCULATION\n", - "V=PI*D*N/60.##VELOCITY IN m/s\n", - "X=P/V##X=T1-T2\n", - "Y=e**(U*THETA)##Y=T1/T2\n", - "T1=X*Y/(Y-1)\n", - "Mb=t*density*L/10**3.##value of m/b\n", - "Tc=Mb*V**2.##centrifugal tension/b\n", - "Tmaxb=t*Fb##max tension/b\n", - "b=T1/(Tmaxb-Tc)##thickness in mm\n", - "##output\n", - "print'%s %.1f %s'%('TENSION IN TIGHT SIDE OF THE BELT =',T1,' N')\n", - "print'%s %.1f %s'%('THICKNESS OF THE BELT IS =',b,' mm')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "TENSION IN TIGHT SIDE OF THE BELT = 2573.5 N\n", - "THICKNESS OF THE BELT IS = 143.4 mm\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg64" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 10 PAGE 64\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##INPUT\n", - "t=5.##THICKNESS OF BELT IN m\n", - "PI=3.141\n", - "U=.3\n", - "e=2.71\n", - "THETA=155.*PI/180.##ANGLE OF CONTACT IN radians\n", - "V=30.##VELOCITY IN m/s\n", - "density=1.##in m/cm**3\n", - "L=1.##LENGTH\n", - "\n", - "##calculation\n", - "Xb=80.## (T1-T2)=80b;so let (T1-T2)/b=Xb\n", - "Y=e**(U*THETA)## LET Y=T1/T2\n", - "Zb=80.*Y/(Y-1.)## LET T1/b=Zb;BY SOLVING THE ABOVE 2 EQUATIONS WE WILL GET THIS EXPRESSION\n", - "Mb=t*L*density*10**-2.## m/b in N\n", - "Tcb=Mb*V**2.## centrifugal tension/b\n", - "Tmaxb=Zb+Tcb## MAX TENSION/b\n", - "Fb=Tmaxb/t##STRESS INDUCED IN TIGHT BELT\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('THE STRESS DEVELOPED ON THE TIGHT SIDE OF BELT=',Fb,' N/cm**2')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE STRESS DEVELOPED ON THE TIGHT SIDE OF BELT= 37.8 N/cm**2\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg65" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 11 PAGE 65\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##INPUT\n", - "C=4.5## CENTRE DISTANCE IN metres\n", - "D1=1.35## DIAMETER OF LARGER PULLEY IN metres\n", - "D2=.9## DIAMETER OF SMALLER PULLEY IN metres\n", - "To=2100.## INITIAL TENSION IN newtons\n", - "b=12.## WIDTH OF BELT IN cm\n", - "t=12.## THICKNESS OF BELT IN mm\n", - "d=1.## DENSITY IN gm/cm**3\n", - "U=.3## COEFFICIENT OF FRICTION\n", - "L=1.## length in metres\n", - "PI=3.141\n", - "e=2.71\n", - "\n", - "##CALCULATION\n", - "M=b*t*d*L*10**-2.## mass of belt per metre length in KG\n", - "V=(To/3./M)**.5## VELOCITY OF FOR MAX POWER TO BE TRANSMITTED IN m/s\n", - "Tc=M*V**2.## CENTRIFUGAL TENSION IN newtons\n", - "## LET (T1+T2)=X\n", - "X=2.*To-2.*Tc ## THE VALUE OF (T1+T2)\n", - "F=(D1-D2)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", - "## LET T1/T2=Y\n", - "Y=e**(U*THETA)## THE VALUE OF T1/T2\n", - "T1=X*Y/(Y+1.)## BY SOLVING X AND Y WE WILL GET THIS EQN\n", - "T2=X-T1\n", - "P=(T1-T2)*V/1000.## MAX POWER TRANSMITTED IN kilowatts\n", - "N1=V*60./(PI*D1)## SPEED OF LARGER PULLEY IN rpm\n", - "N2=V*60./(PI*D2)## SPEED OF SMALLER PULLEY IN rpm\n", - "##OUTPUT\n", - "print'%s %.1f %s'%(' MAX POWER TO BE TRANSMITTED =',P,' KW')\n", - "print'%s %.1f %s'%(' SPEED OF THE LARGER PULLEY =',N1,' rpm')\n", - "print'%s %.1f %s'%(' SPEED OF THE SMALLER PULLEY =',N2,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " MAX POWER TO BE TRANSMITTED = 27.0 KW\n", - " SPEED OF THE LARGER PULLEY = 312.0 rpm\n", - " SPEED OF THE SMALLER PULLEY = 468.0 rpm\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg66" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 12 PAGE 66\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##============================================================================================================================\n", - "##INPUT\n", - "PI=3.141\n", - "e=2.71\n", - "D1=1.20## DIAMETER OF DRIVING SHAFT IN m\n", - "D2=.50## DIAMETER OF DRIVEN SHAFT IN m\n", - "C=4.## CENTRE DISTANCE BETWEEN THE SHAFTS IN m\n", - "M=.9## MASS OF BELT PER METRE LENGTH IN kg\n", - "Tmax=2000## MAX TENSION IN N\n", - "U=.3## COEFFICIENT OF FRICTION\n", - "N1=200.## SPEED OF DRIVING SHAFT IN rpm\n", - "N2=450.## SPEED OF DRIVEN SHAFT IN rpm\n", - "##==============================================================================================================================\n", - "##CALCULATION\n", - "V=PI*D1*N1/60.## VELOCITY OF BELT IN m/s\n", - "Tc=M*V**2.## CENTRIFUGAL TENSION IN N\n", - "T1=Tmax-Tc## TENSION ON TIGHTSIDE IN N\n", - "F=(D1-D2)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", - "T2=T1/(e**(U*THETA))## TENSION ON SLACK SIDE IN N\n", - "TL=(T1-T2)*D1/2.## TORQUE ON THE SHAFT OF LARGER PULLEY IN N-m\n", - "TS=(T1-T2)*D2/2.## TORQUE ON THE SHAFT OF SMALLER PULLEY IN N-m\n", - "P=(T1-T2)*V/1000.## POWER TRANSMITTED IN kW\n", - "Pi=2.*PI*N1*TL/60000.## INPUT POWER\n", - "Po=2.*PI*N2*TS/60000.## OUTPUT POWER\n", - "Pl=Pi-Po## POWER LOST DUE TO FRICTION IN kW\n", - "n=Po/Pi*100.## EFFICIENCY OF DRIVE IN %\n", - "##==================================================================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('TORQUE ON LARGER SHAFT =',TL,'N-m')\n", - "print'%s %.1f %s'%('TORQUE ON SMALLER SHAFT =',TS,' N-m')\n", - "print'%s %.1f %s'%('POWER TRANSMITTED =',P,' kW')\n", - "print'%s %.1f %s'%('POWER LOST DUE TO FRICTION =',Pl,' kW')\n", - "print'%s %.1f %s'%('EFFICIENCY OF DRINE =',n,' percentage')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "TORQUE ON LARGER SHAFT = 679.0 N-m\n", - "TORQUE ON SMALLER SHAFT = 282.9 N-m\n", - "POWER TRANSMITTED = 14.2 kW\n", - "POWER LOST DUE TO FRICTION = 0.9 kW\n", - "EFFICIENCY OF DRINE = 93.8 percentage\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg67" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 13 PAGE 67\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##============================================================================================================================\n", - "##INPUT\n", - "PI=3.141\n", - "e=2.71\n", - "P=90## POWER OF A COMPRESSOR IN kW\n", - "N2=250.## SPEED OF DRIVEN SHAFT IN rpm\n", - "N1=750.## SPEED OF DRIVER SHAFT IN rpm\n", - "D2=1.## DIAMETER OF DRIVEN SHAFT IN m\n", - "C=1.75## CENTRE DISTANCE IN m\n", - "V=1600./60.## VELOCITY IN m/s\n", - "a=375.## CROSECTIONAL AREA IN mm**2\n", - "density=1000.## BELT DENSITY IN kg/m**3\n", - "L=1## length to be considered\n", - "Fb=2.5## STRESSS INDUCED IN MPa\n", - "beeta=35./2.## THE GROOVE ANGLE OF PULLEY\n", - "U=.25## COEFFICIENT OF FRICTION\n", - "##=================================================================================================================================\n", - "##CALCULATION\n", - "D1=N2*D2/N1## DIAMETER OF DRIVING SHAFT IN m\n", - "m=a*density*10**-6.*L## MASS OF THE BELT IN kg\n", - "Tmax=a*Fb## MAX TENSION IN N\n", - "Tc=m*V**2.## CENTRIFUGAL TENSION IN N\n", - "T1=Tmax-Tc## TENSION ON TIGHTSIDE OF BELT IN N\n", - "F=(D2-D1)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", - "T2=T1/(e**(U*THETA/math.sin(beeta/57.3)))##TENSION ON SLACKSIDE IN N\n", - "P2=(T1-T2)*V/1000.## POWER TRANSMITTED PER BELT kW\n", - "N=P/P2## NO OF V-BELTS\n", - "N3=N+1.\n", - "##======================================================================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s '%('NO OF BELTS REQUIRED TO TRANSMIT POWER=',N,' APPROXIMATELY=',N3,'')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "NO OF BELTS REQUIRED TO TRANSMIT POWER= 5.4 APPROXIMATELY= 6.4 \n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg68" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 14 PAGE 68\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##============================================================================================================================\n", - "##INPUT\n", - "PI=3.141\n", - "e=2.71\n", - "P=75.## POWER IN kW\n", - "D=1.5## DIAMETER OF PULLEY IN m\n", - "U=.3## COEFFICIENT OF FRICTION\n", - "beeta=45./2.## GROOVE ANGLE\n", - "THETA=160.*PI/180.## ANGLE OF CONTACT IN radians\n", - "m=.6## MASS OF BELT IN kg/m\n", - "Tmax=800.## MAX TENSION IN N\n", - "N=200.## SPEED OF SHAFT IN rpm\n", - "##=============================================================================================================================\n", - "##calculation\n", - "V=PI*D*N/60.## VELOCITY OF ROPE IN m/s\n", - "Tc=m*V**2.## CENTRIFUGAL TENSION IN N\n", - "T1=Tmax-Tc## TENSION ON TIGHT SIDE IN N\n", - "T2=T1/(e**(U*THETA/math.sin(beeta/57.3)))##TENSION ON SLACKSIDE IN N\n", - "P2=(T1-T2)*V/1000.## POWER TRANSMITTED PER BELT kW\n", - "No=P/P2## NO OF V-BELTS\n", - "N3=No+1.## ROUNDING OFF\n", - "To=(T1+T2+Tc*2.)/2.## INITIAL TENSION\n", - "##================================================================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s '%('NO OF BELTS REQUIRED TO TRANSMIT POWER=',No,'' 'APPROXIMATELY=',N3,'')\n", - "print'%s %.1f %s'%('INITIAL ROPE TENSION=',To,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "NO OF BELTS REQUIRED TO TRANSMIT POWER= 8.3 APPROXIMATELY= 9.3 \n", - "INITIAL ROPE TENSION= 510.8 N\n" - ] - } - ], - "prompt_number": 16 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines/Chapter3.ipynb b/_Theory_Of_Machines/Chapter3.ipynb deleted file mode 100755 index 74818ab4..00000000 --- a/_Theory_Of_Machines/Chapter3.ipynb +++ /dev/null @@ -1,782 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:9f3aa65b257e3f2aa586660a443f5f27bf555a236ce21a3b4fb7b3ab1cf26f12" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter3-FRICTION" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg102" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 1 PAGE NO 102\n", - "##TITLE:FRICTION\n", - "##FIRURE 3.16(a),3.16(b)\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "P1=180.## PULL APPLIED TO THE BODY IN NEWTONS\n", - "theta=30.## ANGLE AT WHICH P IS ACTING IN DEGREES\n", - "P2=220.## PUSH APPLIED TO THE BODY IN NEWTONS\n", - "##Rn= NORMAL REACTION\n", - "##F= FORCE OF FRICTION IN NEWTONS\n", - "##U= COEFFICIENT OF FRICTION\n", - "##W= WEIGHT OF THE BODY IN NEWTON\n", - "##==========================================================================================\n", - "##CALCULATION\n", - "F1=P1*math.cos(theta/57.3)## RESOLVING FORCES HORIZONTALLY FROM 3.16(a)\n", - "F2=P2*math.cos(theta/57.3)## RESOLVING FORCES HORIZONTALLY FROM 3.16(b)\n", - "## RESOLVING FORCES VERTICALLY Rn1=W-P1*sind(theta) from 3.16(a)\n", - "## RESOLVING FORCES VERTICALLY Rn2=W+P1*sind(theta) from 3.16(b)\n", - "## USING THE RELATION F1=U*Rn1 & F2=U*Rn2 AND SOLVING FOR W BY DIVIDING THESE TWO EQUATIONS\n", - "X=F1/F2## THIS IS THE VALUE OF Rn1/Rn2\n", - "Y1=P1*math.sin(theta/57.3)\n", - "Y2=P2*math.sin(theta/57.3)\n", - "W=(Y2*X+Y1)/(1-X)## BY SOLVING ABOVE 3 EQUATIONS\n", - "U=F1/(W-P1*math.sin(theta/57.3))## COEFFICIENT OF FRICTION\n", - "##=============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s '%('WEIGHT OF THE BODY =',W,'N''THE COEFFICIENT OF FRICTION =',U,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "WEIGHT OF THE BODY = 989.9 NTHE COEFFICIENT OF FRICTION = 0.2 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg103" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 2 PAGE NO 103\n", - "##TITLE:FRICTION\n", - "##FIRURE 3.17\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "THETA=45## ANGLE OF INCLINATION IN DEGREES\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N/mm**2\n", - "U=.1## COEFFICIENT FRICTION\n", - "##Rn=NORMAL REACTION\n", - "##M=MASS IN NEWTONS\n", - "##f=ACCELERATION OF THE BODY\n", - "u=0.## INITIAL VELOCITY\n", - "V=10.## FINAL VELOCITY IN m/s**2\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "##CONSIDER THE EQUILIBRIUM OF FORCES PERPENDICULAR TO THE PLANE\n", - "##Rn=Mgcos(THETA)\n", - "##CONSIDER THE EQUILIBRIUM OF FORCES ALONG THE PLANE\n", - "##Mgsin(THETA)-U*Rn=M*f.............BY SOLVING THESE 2 EQUATIONS \n", - "f=g*math.sin(THETA/57.3)-U*g*math.cos(THETA/57.3)\n", - "s=(V**2-u**2)/(2*f)## DISTANCE ALONG THE PLANE IN metres\n", - "##==============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('DISTANCE ALONG THE INCLINED PLANE=',s,' m')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "DISTANCE ALONG THE INCLINED PLANE= 8.0 m\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg104" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 3 PAGE NO 104\n", - "##TITLE:FRICTION\n", - "##FIRURE 3.18\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "W=500.## WEGHT IN NEWTONS\n", - "THETA=30.## ANGLE OF INCLINATION IN DEGRESS\n", - "U=0.2## COEFFICIENT FRICTION\n", - "S=15.## DISTANCE IN metres\n", - "##============================================================================================\n", - "Rn=W*math.cos(THETA/57.3)## NORMAL REACTION IN NEWTONS\n", - "P=W*math.sin(THETA/57.3)+U*Rn## PUSHING FORCE ALONG THE DIRECTION OF MOTION\n", - "w=P*S\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('WORK DONE BY THE FORCE=',w,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "WORK DONE BY THE FORCE= 5048.8 N-m\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg104" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 4 PAGE NO 104\n", - "##TITLE:FRICTION\n", - "##FIRURE 3.19(a) & 3.19(b)\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "P1=2000.## FORCE ACTING UPWARDS WHEN ANGLE=15 degrees IN NEWTONS\n", - "P2=2300.## FORCE ACTING UPWARDS WHEN ANGLE=20 degrees IN NEWTONS\n", - "THETA1=15.## ANGLE OF INCLINATION IN 3.19(a)\n", - "THETA2=20.## ANGLE OF INCLINATION IN 3.19(b)\n", - "##F1= FORCE OF FRICTION IN 3.19(a)\n", - "##Rn1= NORMAL REACTION IN 3.19(a)\n", - "##F2= FORCE OF FRICTION IN 3.19(b)\n", - "##Rn2= NORMAL REACTION IN 3.19(b)\n", - "##U= COEFFICIENT OF FRICTION\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "##P1=F1+Rn1 RESOLVING THE FORCES ALONG THE PLANE\n", - "##Rn1=W*cosd(THETA1)....NORMAL REACTION IN 3.19(a)\n", - "##F1=U*Rn1\n", - "##BY SOLVING ABOVE EQUATIONS P1=W(U*cosd(THETA1)+sind(THETA1))---------------------1\n", - "##P2=F2+Rn2 RESOLVING THE FORCES PERPENDICULAR TO THE PLANE\n", - "##Rn2=W*cosd(THETA2)....NORMAL REACTION IN 3.19(b)\n", - "##F2=U*Rn2\n", - "##BY SOLVING ABOVE EQUATIONS P2=W(U*cosd(THETA2)+sind(THETA2))----------------------2\n", - "##BY SOLVING EQUATIONS 1 AND 2\n", - "X=P2/P1\n", - "U=(math.sin(THETA2/57.3)-(X*math.sin(THETA1/57.3)))/((X*math.cos(THETA1/57.3)-math.cos(THETA2/57.3)))## COEFFICIENT OF FRICTION\n", - "W=P1/(U*math.cos(THETA1/57.3)+math.sin(THETA1/57.3))\n", - "##=============================================================================================\n", - "##OUTPUT\n", - "##print'%s %.1f %s'%('%f',X)\n", - "print'%s %.1f %s %.1f %s '%('COEFFICIENT OF FRICTION=',U,'' 'WEIGHT OF THE BODY=',W,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "COEFFICIENT OF FRICTION= 0.3 WEIGHT OF THE BODY= 3927.0 N \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg105" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 5 PAGE NO 105\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=5.## DIAMETER OF SCREW JACK IN cm\n", - "p=1.25## PITCH IN cm\n", - "l=50.## LENGTH IN cm\n", - "U=.1## COEFFICIENT OF FRICTION\n", - "W=20000.## LOAD IN NEWTONS\n", - "PI=3.147\n", - "##=============================================================================================\n", - "##CALCULATION\n", - "ALPHA=math.atan((p/(PI*d)/57.3))\n", - "PY=math.atan(U/57.3)\n", - "P=W*math.tan((ALPHA+PY)*57.)\n", - "P1=P*d/(2.*l)\n", - "##=============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s '%('THE AMOUNT OF EFFORT NEED TO APPLY =',P1,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE AMOUNT OF EFFORT NEED TO APPLY = 180.4 N \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg106" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 6 PAGE NO 106\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=50.## DIAMETER OF SCREW IN mm\n", - "p=12.5## PITCH IN mm\n", - "U=0.13## COEFFICIENT OF FRICTION\n", - "W=25000.## LOAD IN mm\n", - "PI=3.147\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "ALPHA=math.atan((p/(PI*d))/57.3)\n", - "PY=math.atan(U/57.3)\n", - "P=W*math.tan((ALPHA+PY)/57.3)## FORCE REQUIRED TO RAISE THE LOAD IN N\n", - "T1=P*d/2.## TORQUE REQUIRED IN Nm\n", - "P1=W*math.tan((PY-ALPHA)/57.3)## FORCE REQUIRED TO LOWER THE SCREW IN N\n", - "T2=P1*d/2.## TORQUE IN N\n", - "X=T1/T2## RATIOS REQUIRED\n", - "n=math.tan((ALPHA/(ALPHA+PY))/57.3)## EFFICIENCY\n", - "##============================================================================================\n", - "print'%s %.1f %s'%('RATIO OF THE TORQUE REQUIRED TO RAISE THE LOAD,TO THE TORQUE REQUIRED TO LOWER THE LOAD =',X,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "RATIO OF THE TORQUE REQUIRED TO RAISE THE LOAD,TO THE TORQUE REQUIRED TO LOWER THE LOAD = 4.1 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg107" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 7 PAGE NO 107\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=39.## DIAMETER OF THREAD IN mm\n", - "p=13.## PITCH IN mm\n", - "U=0.1## COEFFICIENT OF FRICTION\n", - "W=2500.## LOAD IN mm\n", - "PI=3.147\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "ALPHA=math.atan((p/(PI*d))/57.3)\n", - "PY=math.atan(U/57.3)\n", - "P=W*math.tan((ALPHA+PY)*57.3)## FORCE IN N\n", - "T1=P*d/2.## TORQUE REQUIRED IN Nm\n", - "T=2.*T1## TORQUE REQUIRED ON THE COUPLING ROD IN Nm\n", - "K=2.*p## DISTANCE TRAVELLED FOR ONE REVOLUTION\n", - "N=20.8/K## NO OF REVOLUTIONS REQUIRED\n", - "w=2.*PI*N*T/100.## WORKDONE BY TORQUE\n", - "w1=w*(7500.-2500.)/2500.## WORKDONE TO INCREASE THE LOAD FROM 2500N TO 7500N\n", - "n=math.tan(ALPHA/57.3)/math.tan((ALPHA+PY)/57.3)## EFFICIENCY\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('workdone against a steady load of 2500N=',w,' N' 'workdone if the load is increased from 2500N to 7500N=',w1,' N' 'efficiency=',n,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "workdone against a steady load of 2500N= 1025.5 Nworkdone if the load is increased from 2500N to 7500N= 2050.9 Nefficiency= 0.5 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg107" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 8 PAGE NO 107\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "W=50000.## WEIGHT OF THE SLUICE GATE IN NEWTON\n", - "P=40000.## POWER IN WATTS\n", - "N=580.## MAX MOTOR RUNNING SPEEED IN rpm\n", - "d=12.5## DIAMETER OF THE SCREW IN cm\n", - "p=2.5## PITCH IN cm\n", - "PI=3.147\n", - "U1=.08## COEFFICIENT OF FRICTION for SCREW\n", - "U2=.1## C.O.F BETWEEN GATES AND SCREW\n", - "Np=2000000.## NORMAL PRESSURE IN NEWTON\n", - "Fl=.15## FRICTION LOSS\n", - "n=1.-Fl## EFFICIENCY\n", - "ng=80.## NO OF TEETH ON GEAR\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "TV=W+U2*Np## TOTAL VERTICAL HEAD IN NEWTON\n", - "ALPHA=math.atan((p/(PI*d))/57.3)## \n", - "PY=math.atan(U1/57.3)## \n", - "P1=TV*math.tan((ALPHA+PY)*57.3)## FORCE IN N\n", - "T=P1*d/2./100.## TORQUE IN N-m\n", - "Ng=60000.*n*P*10**-3./(2.*PI*T)## SPEED OF GEAR IN rpm\n", - "np=Ng*ng/N## NO OF TEETH ON PINION\n", - "##=========================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s '%('NO OF TEETH ON PINION =',np,' say ',np+1,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "NO OF TEETH ON PINION = 19.8 say 20.8 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg108" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 9 PAGE NO 108\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=5.## MEAN DIAMETER OF SCREW IN cm\n", - "p=1.25## PITCH IN cm\n", - "W=10000.## LOAD AVAILABLE IN NEWTONS\n", - "dc=6.## MEAN DIAMETER OF COLLAR IN cm\n", - "U=.15## COEFFICIENT OF FRICTION OF SCREW\n", - "Uc=.18## COEFFICIENT OF FRICTION OF COLLAR\n", - "P1=100.## TANGENTIAL FORCE APPLIED IN NEWTON\n", - "PI=3.147\n", - "##============================================================================================\n", - "##CALCULATION\n", - "ALPHA=math.atan((p/(PI*d))/57.3)## \n", - "PY=math.atan(U/57.3)## \n", - "T1=W*d/2*math.tan((ALPHA+PY)/100)*57.3## TORQUE ON SCREW IN NEWTON\n", - "Tc=Uc*W*dc/2./100.## TORQUE ON COLLAR IN NEWTON\n", - "T=T1+Tc## TOTAL TORQUE\n", - "D=2.*T/P1/2.*100.## DIAMETER OF HAND WHEEL IN cm\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('SUITABLE DIAMETER OF HAND WHEEL =',D,' cm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "SUITABLE DIAMETER OF HAND WHEEL = 111.4 cm\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg108" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 10 PAGE NO 108\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "d=2.5## MEAN DIA OF BOLT IN cm\n", - "p=.6## PITCH IN cm\n", - "beeta=55/2.## VEE ANGLE\n", - "dc=4.## DIA OF COLLAR IN cm\n", - "U=.1## COEFFICIENT OF FRICTION OF BOLT\n", - "Uc=.18## COEFFICIENT OF FRICTION OF COLLAR\n", - "W=6500.## LOAD ON BOLT IN NEWTONS\n", - "L=38.## LENGTH OF SPANNER\n", - "##=============================================================================================\n", - "##CALCULATION\n", - "##LET X=tan(py)/tan(beeta)\n", - "##y=tan(ALPHA)*X\n", - "PY=math.atan(U)*57.3\n", - "ALPHA=math.atan((p/(PI*d)))*57.3\n", - "X=math.tan(PY/57.3)/math.cos(beeta/57.3)\n", - "Y=math.tan(ALPHA/57.3)\n", - "T1=W*d/2.*10**-2*(X+Y)/(1.-(X*Y))## TORQUE IN SCREW IN N-m\n", - "Tc=Uc*W*dc/2.*10**-2## TORQUE ON BEARING SERVICES IN N-m\n", - "T=T1+Tc## TOTAL TORQUE \n", - "P1=T/L*100.## FORCE REQUIRED BY @ THE END OF SPANNER\n", - "##=============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('FORCE REQUIRED @ THE END OF SPANNER=',P1,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FORCE REQUIRED @ THE END OF SPANNER= 102.3 N\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg109" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 11 PAGE NO 109\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d1=15.## DIAMETER OF VERTICAL SHAFT IN cm\n", - "N=100.## SPEED OF THE MOTOR rpm\n", - "W=20000.## LOAD AVILABLE IN N\n", - "U=.05## COEFFICIENT OF FRICTION\n", - "PI=3.147\n", - "##==================================================================================\n", - "T=2./3.*U*W*d1/2.## FRICTIONAL TORQUE IN N-m\n", - "PL=2.*PI*N*T/100./60.## POWER LOST IN FRICTION IN WATTS\n", - "##==================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('POWER LOST IN FRICTION=',PL,' watts')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "POWER LOST IN FRICTION= 524.5 watts\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg109" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 12 PAGE NO 109\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "d2=.30## DIAMETER OF SHAFT IN m \n", - "W=200000.## LOAD AVAILABLE IN NEWTONS\n", - "N=75.## SPEED IN rpm\n", - "U=.05## COEFFICIENT OF FRICTION\n", - "p=300000.## PRESSURE AVAILABLE IN N/m**2\n", - "P=16200.## POWER LOST DUE TO FRICTION IN WATTS\n", - "##====================================================================================\n", - "##CaLCULATION\n", - "T=P*60./2./PI/N## TORQUE INDUCED IN THE SHFT IN N-m\n", - "##LET X=(r1**3-r2**3)/(r1**2-r2**2)\n", - "X=(3./2.*T/U/W)\n", - "r2=.15## SINCE d2=.30 m\n", - "c=r2**2.-(X*r2)\n", - "b= r2-X\n", - "a= 1.\n", - "r1=( -b+ math.sqrt (b**2. -4.*a*c ))/(2.* a);## VALUE OF r1 IN m\n", - "d1=2*r1*100.## d1 IN cm\n", - "n=W/(PI*p*(r1**2.-r2**2.))\n", - "##================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('EXTERNAL DIAMETER OF SHAFT =',d1,' cm''NO OF COLLARS REQUIRED =',n,'' '0 or ',n+1,'')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "EXTERNAL DIAMETER OF SHAFT = 50.6 cmNO OF COLLARS REQUIRED = 5.1 0 or 6.1 \n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg111" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 13 PAGE NO 111\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "W=20000.## LOAD IN NEWTONS\n", - "ALPHA=120./2.## CONE ANGLE IN DEGREES\n", - "p=350000.## INTENSITY OF PRESSURE\n", - "U=.06\n", - "N=120.## SPEED OF THE SHAFT IN rpm\n", - "##d1=3d2\n", - "##r1=3r2\n", - "##===================================================================================\n", - "##CALCULATION\n", - "##LET K=d1/d2\n", - "k=3.\n", - "Z=W/((k**2.-1.)*PI*p)\n", - "r2=Z**.5## INTERNAL RADIUS IN m\n", - "r1=3.*r2\n", - "T=2.*U*W*(r1**3.-r2**3.)/(3.*math.sin(60/57.3)*(r1**2.-r2**2.))## total frictional torque in N\n", - "P=2.*PI*N*T/60000.## power absorbed in friction in kW\n", - "##================================================================================\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('THE INTERNAL DIAMETER OF SHAFT =',r2*100,' cm' 'THE EXTERNAL DIAMETER OF SHAFT =',r1*100,' cm' 'POWER ABSORBED IN FRICTION =',P,' kW')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE INTERNAL DIAMETER OF SHAFT = 4.8 cmTHE EXTERNAL DIAMETER OF SHAFT = 14.3 cmPOWER ABSORBED IN FRICTION = 1.8 kW\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg111" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 14 PAGE NO 111\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "P=10000.## POWER TRRANSMITTED BY CLUTCH IN WATTS\n", - "N=3000.## SPEED IN rpm\n", - "p=.09## AXIAL PRESSURE IN N/mm**2\n", - "##d1=1.4d2 RELATION BETWEEN DIAMETERS \n", - "K=1.4## D1/D2\n", - "n=2.\n", - "U=.3## COEFFICIENT OF FRICTION\n", - "##==========================================================================================\n", - "T=P*60000./1000./(2.*PI*N)## ASSUMING UNIFORM WEAR TORQUE IN N-m\n", - "r2=(T*2./(n*U*2.*PI*p*10**6.*(K-1.)*(K+1.)))**(1./3.)## INTERNAL RADIUS\n", - "\n", - "##===========================================================================================\n", - "print'%s %.1f %s %.1f %s '%('THE INTERNAL RADIUS =',r2*100,' cm' 'THE EXTERNAL RADIUS =',K*r2*100,' cm')\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE INTERNAL RADIUS = 5.8 cmTHE EXTERNAL RADIUS = 8.1 cm \n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg111" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 14 PAGE NO 111\n", - "##TITLE:FRICTION\n", - "\n", - "\n", - "\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "n1=3.## NO OF DICS ON DRIVING SHAFTS\n", - "n2=2.## NO OF DICS ON DRIVEN SHAFTS\n", - "d1=30.## DIAMETER OF DRIVING SHAFT IN cm\n", - "d2=15.## DIAMETER OF DRIVEN SHAFT IN cm\n", - "r1=d1/2.\n", - "r2=d2/2.\n", - "U=.3## COEFFICIENT FRICTION\n", - "P=30000.## TANSMITTING POWER IN WATTS\n", - "N=1800.## SPEED IN rpm\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "n=n1+n2-1.## NO OF PAIRS OF CONTACT SURFACES\n", - "T=P*60000./(2.*PI*N)## TORQUE IN N-m\n", - "W=2.*T/(n*U*(r1+r2)*10.)## LOAD IN N\n", - "k=W/(2.*PI*(r1-r2))\n", - "p=k/r2/100.## MAX AXIAL INTENSITY OF PRESSURE IN N/mm**2\n", - "##===========================================================================================\n", - "## OUTPUT\n", - "print'%s %.3f %s'%('MAX AXIAL INTENSITY OF PRESSURE =',p,' N/mm^2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "MAX AXIAL INTENSITY OF PRESSURE = 0.033 N/mm**2\n" - ] - } - ], - "prompt_number": 15 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines/Chapter4.ipynb b/_Theory_Of_Machines/Chapter4.ipynb deleted file mode 100755 index de08c088..00000000 --- a/_Theory_Of_Machines/Chapter4.ipynb +++ /dev/null @@ -1,946 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:fdf50666cfa70019db7241b6e1fb1e819c70fb9987ea0caadb1e777e93e7d898" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter4-Gears and Gear Drivers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 1, Page 133\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "TA=48.;##Wheel A teeth\n", - "TB=30.;##Wheel B teeth\n", - "m=5.;##Module pitch in mm\n", - "phi=20.;##Pressure angle in degrees\n", - "add=m;##Addendum in mm\n", - "\n", - "##CALCULATIONS\n", - "R=(m*TA)/2.;##Pitch circle radius of wheel A in mm\n", - "RA=R+add;##Radius of addendum circle of wheel A in mm\n", - "r=(m*TB)/2.;##Pitch circle radius of wheel B in mm\n", - "rA=r+add;##Radius of addendum circle of wheel B in mm\n", - "lp=(math.sqrt((RA**2.)-((R**2.)*(math.cos(phi/57.3)**2.))))+(math.sqrt((rA**2.)-((r**2.)*(math.cos(phi/57.3)**2.))))-((R+r)*math.sin(phi/57.3));##Length of path of contact in mm\n", - "la=lp/math.cos(phi/57.3);##Length of arc of contact in mm\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('Length of arc of contact is ',la,' mm')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Length of arc of contact is 26.7 mm\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 2, Page 133\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "TA=40.;##Wheel A teeth\n", - "TB=TA;##Wheel B teeth\n", - "m=6.;##Module pitch in mm\n", - "phi=20.;##Pressure angle in degrees\n", - "pi=3.141\n", - "x=1.75;##Ratio of length of arc of contact to circular pitch\n", - "\n", - "##CALCULATIONS\n", - "Cp=m*pi;##Circular pitch in mm\n", - "R=(m*TA)/2.;##Pitch circle radius of wheel A in mm\n", - "r=R;##Pitch circle radius of wheel B in mm\n", - "la=x*Cp;##Length of arc of contact in mm\n", - "lp=la*math.cos(phi/57.3);##Length of path of contact in mm\n", - "RA=math.sqrt((((lp/2.)+(R*math.sin(phi/57.3)))**2.)+((R**2.)*(math.cos(phi/57.3))**2.));##Radius of addendum circle of each wheel in mm\n", - "add=RA-R;##Addendum in mm\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('Addendum of wheel is ',add,' mm')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Addendum of wheel is 6.1 mm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg134" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 3, Page 134\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "TA=48.;##Gear teeth\n", - "TB=24.;##Pinion teeth\n", - "m=6.;##Module in mm\n", - "phi=20.;##Pressure angle in degrees\n", - "\n", - "##CALCULATIONS\n", - "r=(m*TB)/2.;##Pitch circle radius of pinion in mm\n", - "R=(m*TA)/2.;##Pitch circle radius of gear in mm\n", - "RA=math.sqrt(((((r*math.sin(phi/57.3))/2.)+(R*math.sin(phi/57.3)))**2.)+((R**2)*(math.cos(phi/57.3))**2));##Radius of addendum circle of gear in mm\n", - "rA=math.sqrt(((((R*math.sin(phi/57.3))/2.)+(r*math.sin(phi/57.3)))**2.)+((r**2)*(math.cos(phi/57.3))**2));##Radius of addendum circle of pinion in mm\n", - "addp=rA-r;##Addendum for pinion in mm\n", - "addg=RA-R;##Addendum for gear in mm\n", - "lp=((R+r)*math.sin(phi/57.3))/2.;##Length of path of contact in mm\n", - "la=lp/math.cos(phi/57.3);##Length of arc of contact in mm\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('Addendum for pinion is',addp,' mm' ' Addendum for gear is ',addg,' mm' ' Length of arc of contact is ',la,' mm')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Addendum for pinion is 11.7 mm Addendum for gear is 4.7 mm Length of arc of contact is 39.3 mm \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg135" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 4, Page 135\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "x=3.5;##Ratio of teeth of wheels\n", - "C=1.2;##Centre distance between axes in m\n", - "DP=4.4;##Diametrical pitch in cm\n", - "\n", - "##CALCULATIONS\n", - "D=2*C*100.;##Sum of diameters of wheels in cm\n", - "T=D*DP;##Sum of teeth of wheels\n", - "TB1=T/(x+1);##Teeth of wheel B\n", - "TB=math.floor(TB1);##Teeth of whhel B\n", - "TA=x*TB;##Teeth of wheel A\n", - "DA=TA/DP;##Diametral pitch of gear A in cm\n", - "DB=TB/DP;##Diametral pitch of gear B in cm\n", - "Ce=(DA+DB)/2.;##Exact centre distance between shafts in cm\n", - "TB2=math.ceil(TB1);##Teeth of wheel B\n", - "TA2=T-TB2;##Teeth of wheel A\n", - "VR=TA2/TB2;##Velocity ratio\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s%.1f %s%.1f %s'%('Number of teeth on wheel A is ',TA,'' 'Number of teeth on wheel B is ',TB,'' ' Exact centre distance is ',Ce,' cm ' 'If centre distance is ',C,' m' 'then Velocity ratio is',VR,'')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of teeth on wheel A is 819.0 Number of teeth on wheel B is 234.0 Exact centre distance is 119.7 cm If centre distance is 1.2 mthen Velocity ratio is3.5 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg136" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 5, Page 136\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "C=600;##Distance between shafts in mm\n", - "Cp=30;##Circular pitch in mm\n", - "NA=200;##Speed of wheel A in rpm\n", - "NB=600;##Speed of wheel B in rpm\n", - "F=18;##Tangential pressure in kN\n", - "pi=3.141\n", - "\n", - "##CALCULATIONS\n", - "a=Cp/(pi*10.);##Ratio of pitch diameter of wheel A to teeth of wheel A in cm\n", - "b=Cp/(pi*10.);##Ratio of pitch diameter of wheel B to teeth of wheel B in cm\n", - "T=(2*C)/(a*10.);##Sum of teeth of wheels\n", - "r=NB/NA;##Ratio of teeth of wheels\n", - "TB=T/(r+1);##Teeth of wheel B\n", - "TB1=math.ceil(TB);##Teeth of wheel B\n", - "TA=TB1*r;##Teeth of wheel A\n", - "DA=a*TA;##Pitch diameter of wheel A in cm\n", - "DB=b*TB1;##Pitch diameter of wheel B in cm\n", - "CPA=(pi*DA)/TA;##Circular pitch of gear A in cm\n", - "CPB=(pi*DB)/TB1;##Circular pitch of gear B in cm\n", - "C1=(DA+DB)*10/2.;##Exact centre distance in mm\n", - "P=(F*1000.*pi*DA*NA)/(60.*1000.*100.);##Power transmitted in kW\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('Number of teeth on wheel A is ',TA,' '' Number of teeth on wheel B is ',TB1,' '' Pitch diameter of wheel A is ',DA,' cm'' Pitch diameter of wheel B is ',DB,' cm'' Circular pitch of wheel A is',CPA,'cm ' 'Circular pitch of wheel B is ',CPB,' cm '' Exact centre distance between shafts is ',C1,' mm'' Power transmitted is',P,' kW')\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of teeth on wheel A is 96.0 Number of teeth on wheel B is 32.0 Pitch diameter of wheel A is 91.7 cm Pitch diameter of wheel B is 30.6 cm Circular pitch of wheel A is 3.0 cm Circular pitch of wheel B is 3.0 cm Exact centre distance between shafts is 611.3 mm Power transmitted is 172.8 kW \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg137" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 6, Page 137\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "r=16.;##Speed ratio\n", - "mA=4.;##Module of gear A in mm\n", - "mB=mA;##Module of gear B in mm\n", - "mC=2.5;##Mosule of gear C in mm\n", - "mD=mC;##Module of gear D in mm\n", - "C=150.;##Distance between shafts in mm\n", - "\n", - "##CALCULATIONS\n", - "t=math.sqrt(r);##Ratio of teeth\n", - "T1=(C*2.)/mA;##Sum of teeth of wheels A and B\n", - "T2=(C*2.)/mC;##Sum of teeth of wheels C and D\n", - "TA=T1/(t+1.);##Teeth of gear A\n", - "TB=T1-TA;##Teeth of gear B\n", - "TC=T2/(t+1.);##Teeth of gear C\n", - "TD=T2-TC;##Teeth of gear D\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Number of teeth on gear A is ',TA,' '' Number of teeth on gear B is ',TB,'' 'Number of teeth on gear C is ',TC,'' ' Number of teeth on gear D is ',TD,'')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of teeth on gear A is 15.0 Number of teeth on gear B is 60.0 Number of teeth on gear C is 24.0 Number of teeth on gear D is 96.0 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg138" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 7, Page 138\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "N=4.5;##No. of turns\n", - "\n", - "##CALCULATIONS\n", - "Vh=N/2.;##Velocity ratio of main spring spindle to hour hand spindle\n", - "Vm=12.;##Velocity ratio of minute hand spindle to hour hand spindle\n", - "T1=8.## assumed no of teeth on gear 1\n", - "T2=32.## assumed no of teeth on gear 2\n", - "T3=(T1+T2)/4.## no of teeth on gear 3\n", - "T4=(T1+T2)-T3## no of teeth on gear 4\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('no of teeth on gear 1=',T1,'' 'no of teeth on gear 2=',T2,' ''no of teeth on gear 3=',T3,' ''no of teeth on gear 4=',T4,'')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "no of teeth on gear 1= 8.0 no of teeth on gear 2= 32.0 no of teeth on gear 3= 10.0 no of teeth on gear 4= 30.0 \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg139" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 8, Page 139\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Tb=70.;##Teeth of wheel B\n", - "Tc=25.;##Teeth of wheel C\n", - "Td=80.;##Teeth of wheel D\n", - "Na=-100.;##Speed of arm A in clockwise in rpm\n", - "y=-100.##Arm A rotates at 100 rpm clockwise\n", - "\n", - "##Calculations\n", - "Te=(Tc+Td-Tb);##Teeth of wheel E\n", - "x=(y/0.5)\n", - "Nc=(y-(Td*x)/Tc);##Speed of wheel C in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s'%('Speed of wheel C is ',Nc,' rpm ''Direction of wheel C is anti-clockwise')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of wheel C is 540.0 rpm Direction of wheel C is anti-clockwise\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg140" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 9, Page 140\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Tb=25.;##Teeth of wheel B\n", - "Tc=40.;##Teeth of wheel C\n", - "Td=10.;##Teeth of wheel D\n", - "Te=25.;##Teeth of wheel E\n", - "Tf=30.;##Teeth of wheel F\n", - "y=-120.;##Speed of arm A in clockwise in rpm\n", - "\n", - "##Calculations\n", - "x=(-y/4.)\n", - "Nb=x+y;##Speed of wheel B in rpm\n", - "Nf=(-10/3.)*x+y;##Speed of wheel F in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s %.1f %s'%('Speed of wheel B is',Nb,' rpm Direction of wheel B is clockwise' ' Speed of wheel F is ',Nf,' rpm Direction of wheel F is clockwise')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of wheel B is -90.0 rpm Direction of wheel B is clockwise Speed of wheel F is -220.0 rpm Direction of wheel F is clockwise\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg141" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 10, Page 141\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Ta=96.;##Teeth of wheel A\n", - "Tc=48.;##Teeth of wheel C\n", - "y=-20.;##Speed of arm C in rpm in clockwise\n", - "\n", - "##Calculations\n", - "x=(y*Ta)/Tc\n", - "Tb=(Ta-Tc)/2.;##Teeth of wheel B\n", - "Nb=(-Tc/Tb)*x+y;##Speed of wheel B in rpm\n", - "Nc=x+y;##Speed of wheel C in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s %.1f %s'%('Speed of wheel B is ',Nb,' rpm' 'Speed of wheel C is ',Nc,' rpm')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of wheel B is 60.0 rpmSpeed of wheel C is -60.0 rpm\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg142" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 11, Page 142\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "import numpy\n", - "from numpy.linalg import inv\n", - "##Input data\n", - "Ta=40.## no of teeth on gear A\n", - "Td=90.## no of teeth on gear D\n", - "\n", - "##Calculations\n", - "Tb=(Td-Ta)/2.## no of teeth on gear B\n", - "Tc=Tb## no of teeth on gear C\n", - "##\n", - "##x+y=-1\n", - "##-40x+90y=45\n", - "\n", - "A=([[1, 1],[-Ta, Td]])##Coefficient matrix\n", - "\n", - "B=([[-1],[Td/2]])##Constant matrix\n", - " \n", - "X=numpy.dot(inv(A) ,B)##Variable matrix\n", - "##\n", - "##x+y=-1\n", - "##-40x+90y=0\n", - "A1=([[1, 1],[-Ta, Td]])##Coefficient matrix\n", - "B1=([[-1],[0]])##Constant matrix\n", - "X1=numpy.dot(inv(A1) ,B1)##Variable matrix\n", - "b=X1[1] \n", - "print(X[1]) \n", - "print'%s %.4f %s'%('speed of the arm =',b,' revolution clockwise')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "[ 0.03846154]\n", - "speed of the arm = -0.3077 revolution clockwise\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg144" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 12, Page 144\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "\n", - "\n", - "##Input data\n", - "Te=30.;##Teeth of wheel E\n", - "Tb=24.;##Teeth of wheel B\n", - "Tc=22.;##Teeth of wheel C\n", - "Td=70.;##Teeth of wheel D\n", - "Th=15.;##Teeth of wheel H\n", - "Nv=100.;##Speed of shaft V in rpm\n", - "Nx=300.;##Speed of spindle X in rpm\n", - "\n", - "##Calculations\n", - "Nh=Nv;##Speed of wheel H in rpm\n", - "Ne=(-Th/Te)*Nv;##Speed of wheel E in rpm\n", - "Ta=(Tc+Td-Tb);##Teeth of wheel A\n", - "##x+y=-50\n", - "##y=300\n", - "x=(Ne-Nx)\n", - "Nz=(187/210.)*x+Nx;##;##Speed of wheel Z in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s'%('Speed of wheel Z is ',Nz,' rpm Direction of wheel Z is opposite to that of X')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of wheel Z is -11.7 rpm Direction of wheel Z is opposite to that of X\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg145" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 13, Page 145\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "\n", - "\n", - "##Input data\n", - "Tp=20.;##Teeth of wheel P\n", - "Tq=30.;##Teeth of wheel Q\n", - "Tr=10.;##Teeth of wheel R\n", - "Nx=50.;##Speed of shaft X in rpm\n", - "Na=100.;##Speed of arm A in rpm\n", - "\n", - "##Calculations\n", - "##x+y=-50\n", - "##y=100\n", - "x=(-Nx-Na)\n", - "y=(-2.*x+Na);##Speed of Y in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s'%('Speed of driven shaft Y is ',y,' rpm Direction of driven shaft Y is anti-clockwise')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of driven shaft Y is 400.0 rpm Direction of driven shaft Y is anti-clockwise\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg146" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 14, Page 146\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "d=216.;##Ring diameter in mm\n", - "m=4.;##Module in mm\n", - "\n", - "##Calculations\n", - "Td=(d/m);##Teeth of wheel D\n", - "Tb=Td/4.;##Teeth of wheel B\n", - "Tb1=math.ceil(Tb);##Teeth of wheel B\n", - "Td1=4.*Tb1;##Teeth of wheel D\n", - "Tc1=(Td1-Tb1)/2.;##Teeth of wheel C\n", - "d1=m*Td1;##Pitch circle diameter in mm\n", - "\n", - "##Output\n", - "print'%s %.1f %s %.1f %s %.1f %s%.1f %s '%('Teeth of wheel B is ',Tb1,' ' 'Teeth of wheel C is ',Tc1,' ' 'Teeth of wheel D is ',Td1,' '' Exact pitch circle diameter is ',d1,' mm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Teeth of wheel B is 14.0 Teeth of wheel C is 21.0 Teeth of wheel D is 56.0 Exact pitch circle diameter is 224.0 mm \n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg147" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 15, Page 147\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Ta=100.## no of teeth on gear A\n", - "Tc=101.## no of teeth on gear C\n", - "Td=99.## no of teeth on gear D\n", - "Tp=20.## no of teeth on planet gear\n", - "y=1.## from table 4.9(arm B makes one revolution)\n", - "x=-y## as gear is fixed\n", - "\n", - "##Calculations\n", - "Nc=(Ta*x)/Tc+y## Revolution of gear C \n", - "Nd=(Ta*x)/Td+y## Revolution of gear D\n", - "\n", - "##Output\n", - "print'%s %.4f %s %.4f %s '%('Revolution of gear C =',Nc,'' ' Revolution of gear D = ',Nd,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Revolution of gear C = 0.0099 Revolution of gear D = -0.0101 \n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex16-pg148" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 16, Page 148\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Ta=12.## no of teeth on gear A\n", - "Tb=60.## no of teeth on gear B\n", - "N=1000.## speed of propeller shaft in rpm\n", - "Nc=210.## speed of gear C in rpm\n", - "\n", - "##Calculations\n", - "Nb=(Ta*N)/Tb## speed of gear B in rpm\n", - "x=(Nb-Nc)\n", - "Nd=Nb+x## speed of road wheel driven by D\n", - "\n", - "##Output\n", - "print'%s %.1f %s'%('speed of road wheel driven by D= ',Nd,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of road wheel driven by D= 190.0 rpm\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex17-pg148" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 17, Page 148\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "import numpy\n", - "from numpy.linalg import inv\n", - "##Input data\n", - "Ta=20.## no of teeth on pinion A\n", - "Tb=25.## no of teeth on wheel B\n", - "Tc=50.## no of teeth on gear C\n", - "Td=60.## no of teeth on gear D\n", - "Te=60.## no of teeth on gear E\n", - "Na=200.## SPEED of the gear A\n", - "Nd=100.## speed of the gear D\n", - "\n", - "##calculations\n", - "##(i)\n", - "##(5/6)x+y=0\n", - "##(5/4)x+y=200\n", - "A1=([[Tc/Td, 1],[Tb/Ta, 1]])##Coefficient matrix\n", - "B1=([[0],[Na]]) ##Constant matrix\n", - "X1=numpy.dot(inv(A1),B1)##Variable matrix\n", - "Ne1=X1[1]-(Tc/Td)*X1[0]## \n", - "T1=(-Ne1/Na)## ratio of torques when D is fixed\n", - "##(ii)\n", - "##(5/4)x+y=200\n", - "##(5/6)x+y=100\n", - "A2=([[Tc/Td, 1],[Tb/Ta, 1]])##Coefficient matrix\n", - "B2=([[Nd],[Na]])##Constant matrix\n", - "X2=numpy.dot(inv(A2),B2)##Variable matrix\n", - "Ne2=X2[1]-(Tc/Td)*X2[0]\n", - "T2=(-Ne2/Na)## ratio of torques when D ratates at 100 rpm\n", - "\n", - "##Output\n", - "print'%s %.2f %s %.2f %s %.2f %s %.2f %s'%('speed of E= ',Ne1,' rpm in clockwise direction' and 'speed of E in 2nd case(when D rotates at 100 rpm)= ',Ne2,' rpm in clockwise direction' and 'ratio of torques when D is fixed= ',T1,' ' 'ratio of torques when D ratates at 100 rpm= ',T2,'')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of E= -800.00 speed of E in 2nd case(when D rotates at 100 rpm)= -300.00 ratio of torques when D is fixed= 4.00 ratio of torques when D ratates at 100 rpm= 1.50 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines/Chapter5.ipynb b/_Theory_Of_Machines/Chapter5.ipynb deleted file mode 100755 index f5d72d04..00000000 --- a/_Theory_Of_Machines/Chapter5.ipynb +++ /dev/null @@ -1,413 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:a109b0284cb0a4fc44bb60197ec78d6f24860fb5b5091b8f3432975ce1e08de6" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Chapter5-Inertia Force Analysis in Machines" - ] - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Ex1-pg160" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 1 PAGE NO 160\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "r=.3## radius of crank in m\n", - "l=1.## length of connecting rod in m\n", - "N=200.## speed of the engine in rpm\n", - "n=l/r\n", - "##===================\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "\n", - "teeta=math.acos((-n+((n**2)+4*2*1)**.5)/(2*2))*57.3## angle of inclination of crank in degrees\n", - "Vp=w*r*(math.sin(teeta/57.3)+(math.sin((2*teeta)/57.3)/n))## maximum velocity of the piston in m/s\n", - "print'%s %.1f %s'%('Maximum velocity of the piston = ',Vp,' m/s')\n", - "print'%s %.2f %s'%('teeta',teeta,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum velocity of the piston = 7.0 m/s\n", - "teeta 74.96 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg161" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 2 PAGE NO 161\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "PI=3.141\n", - "r=.3## length of crank in metres\n", - "l=1.5## length of connecting rod in metres\n", - "N=180.## speed of rotation in rpm\n", - "teeta=40.## angle of inclination of crank in degrees\n", - "##============================\n", - "n=l/r\n", - "w=2.*PI*N/60## angular speed in rad/s\n", - "Vp=w*r*(math.sin(teeta/57.3)+math.sin((2.*teeta/57.3)/(2.*n)))## velocity of piston in m/s\n", - "fp=w**2.*r*(math.cos(teeta/57.3)+math.cos(2.*teeta/57.3)/(2.*n))## acceleration of piston in m/s**2\n", - "costeeta1=(-n+(n**2.+4.*2.*1.)**.5)/4.\n", - "teeta1=math.acos(costeeta1)*(57.3)## position of crank from inner dead centre position for zero acceleration of piston\n", - "##===========================\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('Velocity of Piston = ',Vp,' m/s'' Acceleration of piston =',fp,' m/s**2'' position of crank from inner dead centre position for zero acceleration of piston=',teeta1,' degrees')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity of Piston = 4.4 m/s Acceleration of piston = 83.5 m/s**2 position of crank from inner dead centre position for zero acceleration of piston= 79.3 degrees\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg161" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 3 PAGE NO 161\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "D=.3## Diameter of steam engine in m\n", - "L=.5## length of stroke in m\n", - "r=L/2.\n", - "mR=100.## equivalent of mass of reciprocating parts in kg\n", - "N=200.## speed of engine in rpm\n", - "teeta=45## angle of inclination of crank in degrees\n", - "p1=1.*10**6## gas pressure in N/m**2\n", - "p2=35.*10**3## back pressure in N/m**2\n", - "n=4.## ratio of crank radius to the length of stroke\n", - "##=================================\n", - "w=2.*pi*N/60## angular speed in rad/s\n", - "Fl=pi/4.*D**2.*(p1-p2)## Net load on piston in N\n", - "Fi=mR*w**2*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(2*n))## inertia force due to reciprocating parts\n", - "Fp=Fl-Fi## Piston effort\n", - "T=Fp*r*(math.sin(teeta/57.3)+(math.sin((2*teeta)/57.3))/(2.*(n**2-(math.sin(teeta/57.3))**2)**.5))\n", - "print'%s %.1f %s %.1f %s '%('Piston effort = ',Fp,' N' 'Turning moment on the crank shaft = ',T,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Piston effort = 60447.0 NTurning moment on the crank shaft = 12604.2 N-m \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg162" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 4 PAGE NO 162\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "D=.10## Diameter of petrol engine in m\n", - "L=.12## Stroke length in m\n", - "l=.25## length of connecting in m\n", - "r=L/2.\n", - "mR=1.2## mass of piston in kg\n", - "N=1800.## speed in rpm\n", - "teeta=25.## angle of inclination of crank in degrees\n", - "p=680.*10**3## gas pressure in N/m**2\n", - "n=l/r\n", - "g=9.81## acceleration due to gravity\n", - "##=======================================\n", - "w=2.*pi*N/60.## angular speed in rpm\n", - "Fl=pi/4.*D**2.*p## force due to gas pressure in N\n", - "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n))## inertia force due to reciprocating parts in N\n", - "Fp=Fl-Fi+mR*g## net force on piston in N\n", - "Fq=n*Fp/((n**2-(math.sin(teeta/57.3))**2.)**.5)## resultant load on gudgeon pin in N\n", - "Fn=Fp*math.sin(teeta/57.3)/((n**2-(math.sin(teeta/57.3))**2.)**.5)## thrust on cylinder walls in N\n", - "fi=Fl+mR*g## inertia force of the reciprocating parts before the gudgeon pin load is reversed in N\n", - "w1=(fi/mR/r/(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n)))**.5\n", - "N1=60.*w1/(2.*pi)\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Net force on piston = ',Fp,' N'' Resultant load on gudgeon pin = ',Fq,' N'' Thrust on cylinder walls = ',Fn,' N'' speed at which other things remining same,the gudgeon pin load would be reversed in directionm= ',N1,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Net force on piston = 2639.3 N Resultant load on gudgeon pin = 2652.9 N Thrust on cylinder walls = 269.1 N speed at which other things remining same,the gudgeon pin load would be reversed in directionm= 2528.4 rpm \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg163" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 5 PAGE NO 163\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "##Figure 5.3\n", - "import math\n", - "pi=3.141\n", - "N=1800.## speed of the petrol engine in rpm\n", - "r=.06## radius of crank in m\n", - "l=.240## length of connecting rod in m\n", - "D=.1## diameter of the piston in m\n", - "mR=1## mass of piston in kg\n", - "p=.8*10**6## gas pressure in N/m**2\n", - "x=.012## distance moved by piston in m\n", - "##===============================================\n", - "w=2.*pi*N/60.## angular velocity of the engine in rad/s\n", - "n=l/r\n", - "Fl=pi/4.*D**2.*p## load on the piston in N\n", - "teeta=32.## by mearument from the figure 5.3\n", - "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/n)## inertia force due to reciprocating parts in N\n", - "Fp=Fl-Fi## net load on the gudgeon pin in N\n", - "Fq=n*Fp/((n**2.-(math.sin(teeta/57.3))**2.)**.5)## thrust in the connecting rod in N\n", - "Fn=Fp*math.sin(teeta/57.3)/((n**2-(math.sin(teeta/57.3))**2)**.5)## reaction between the piston and cylinder in N\n", - "w1=(Fl/mR/r/(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n)))**.5\n", - "N1=60.*w1/(2.*pi)## \n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s'%('Net load on the gudgeon pin= ',Fp,' N''Thrust in the connecting rod= ',Fq,' N'' Reaction between the cylinder and piston= ',Fn,' N'' The engine speed at which the above values become zero= ',N1,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Net load on the gudgeon pin= 4241.2 NThrust in the connecting rod= 4278.9 N Reaction between the cylinder and piston= 566.8 N The engine speed at which the above values become zero= 3158.0 rpm\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 6 PAGE NO 165\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "D=.25## diameter of horizontal steam engine in m\n", - "N=180.## speed of the engine in rpm\n", - "d=.05## diameter of piston in m\n", - "P=36000.## power of the engine in watts\n", - "n=3.## ration of length of connecting rod to the crank radius\n", - "p1=5.8*10**5## pressure on cover end side in N/m**2\n", - "p2=0.5*10**5## pressure on crank end side in N/m**2\n", - "teeta=40.## angle of inclination of crank in degrees\n", - "m=45.## mass of flywheel in kg\n", - "k=.65## radius of gyration in m\n", - "##==============================\n", - "Fl=(pi/4.*D**2.*p1)-(pi/4.*(D**2.-d**2.)*p2)## load on the piston in N\n", - "ph=(math.sin(teeta/57.3)/n)\n", - "phi=math.asin(ph)*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", - "r=1.6*D/2.\n", - "T=Fl*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", - "Fb=Fl*math.cos((teeta+phi)/57.3)/math.cos(phi/57.3)## thrust on the crank shaft bearing in N\n", - "TR=P*60./(2.*pi*N)## steady resisting torque in N-m\n", - "Ts=T-TR## surplus torque available in N-m\n", - "a=Ts/(m*k**2)## acceleration of the flywheel in rad/s**2\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('Torque exerted on the crank shaft= ',T,' N-m'' Thrust on the crank shaft bearing= ',Fb,'N''Acceleration of the flywheel= ',a,' rad/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Torque exerted on the crank shaft= 4233.8 N-m Thrust on the crank shaft bearing= 16321.0 NAcceleration of the flywheel= 122.2 rad/s**2 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg166" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 7 PAGE NO 166\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "D=.25## diameter of vertical cylinder of steam engine in m\n", - "L=.45## stroke length in m\n", - "r=L/2.\n", - "n=4.\n", - "N=360.## speed of the engine in rpm\n", - "teeta=45.## angle of inclination of crank in degrees\n", - "p=1050000.## net pressure in N/m**2\n", - "mR=180.## mass of reciprocating parts in kg\n", - "g=9.81## acceleration due to gravity\n", - "##========================\n", - "Fl=p*pi*D**2./4.## force on piston due to steam pressure in N\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n))## inertia force due to reciprocating parts in N\n", - "Fp=Fl-Fi+mR*g## piston effort in N\n", - "phi=math.asin((math.sin(teeta/57.3)/n))*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", - "T=Fp*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", - "print'%s %.1f %s'%('Effective turning moment on the crank shaft= ',T,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Effective turning moment on the crank shaft= 2366.2 N-m\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg166" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 8 PAGE NO 166\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "##figure 5.4\n", - "import math\n", - "pi=3.141\n", - "D=.25## diameter of vertical cylinder of diesel engine in m\n", - "L=.40## stroke length in m\n", - "r=L/2.\n", - "n=4.\n", - "N=300.## speed of the engine in rpm\n", - "teeta=60.## angle of inclination of crank in degrees\n", - "mR=200.## mass of reciprocating parts in kg\n", - "g=9.81## acceleration due to gravity\n", - "l=.8## length of connecting rod in m\n", - "c=14.## compression ratio=v1/v2\n", - "p1=.1*10**6.## suction pressure in n/m**2\n", - "i=1.35## index of the law of expansion and compression \n", - "##==============================================================\n", - "Vs=pi/4.*D**2.*L## swept volume in m**3\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "Vc=Vs/(c-1.)\n", - "V3=Vc+Vs/10.## volume at the end of injection of fuel in m**3\n", - "p2=p1*c**i## final pressure in N/m**2\n", - "p3=p2## from figure\n", - "x=r*((1.-math.cos(teeta/57.3)+(math.sin(teeta/57.3))**2/(2.*n)))## the displacement of the piston when the crank makes an angle 60 degrees with T.D.C\n", - "Va=Vc+pi*D**2.*x/4.\n", - "pa=p3*(V3/Va)**i\n", - "p=pa-p1## difference of pressues on 2 sides of piston in N/m**2\n", - "Fl=p*pi*D**2./4.## net load on piston in N\n", - "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos(2.*teeta/57.3)/(n))## inertia force due to reciprocating parts in N\n", - "Fp=Fl-Fi+mR*g## piston effort in N\n", - "phi=math.asin((math.sin(teeta/57.3)/n))*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", - "T=Fp*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", - "print'%s %.1f %s'%('Effective turning moment on the crank shaft= ',T,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Effective turning moment on the crank shaft= 8850.3 N-m\n" - ] - } - ], - "prompt_number": 8 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines/Chapter6.ipynb b/_Theory_Of_Machines/Chapter6.ipynb deleted file mode 100755 index 895e2c68..00000000 --- a/_Theory_Of_Machines/Chapter6.ipynb +++ /dev/null @@ -1,486 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:a0a25762305b1c74ca417d46a7390eaac10578c3f22cb04bddc542c61d85667c" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter6-Turning Moment Diagram and Flywheel" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg175" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 1 PAGE NO 175\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "\n", - "k=1.## radius of gyration of flywheel in m\n", - "m=2000.## mass of the flywheel in kg\n", - "T=1000.## torque of the engine in Nm\n", - "w1=0.## speedin the begining\n", - "t=10.## time duration\n", - "##==============================\n", - "I=m*k**2.## mass moment of inertia in kg-m**2\n", - "a=T/I## angular acceleration of flywheel in rad/s**2\n", - "w2=w1+a*t## angular speed after time t in rad/s\n", - "K=I*w2**2/2.## kinetic energy of flywheel in Nm\n", - "##==============================\n", - "print'%s %.1f %s %.1f %s '%('Angular acceleration of the flywheel=',a,' rad/s**2'' Kinetic energy of flywheel= ',K,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Angular acceleration of the flywheel= 0.5 rad/s**2 Kinetic energy of flywheel= 25000.0 N-m \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg176" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 2 PAGE NO 176\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "N1=225.## maximum speed of flywheel in rpm\n", - "k=.5## radius of gyration of flywheel in m\n", - "n=720.## no of holes punched per hour\n", - "E1=15000.## energy required by flywheel in Nm\n", - "N2=200.## mimimum speedof flywheel in rpm\n", - "t=2.## time taking for punching a hole\n", - "##==========================\n", - "P=E1*n/3600.## power required by motor per sec in watts\n", - "E2=P*t## energy supplied by motor to punch a hole in N-m\n", - "E=E1-E2## maximum fluctuation of energy in N-m\n", - "N=(N1+N2)/2.## mean speed of the flywheel in rpm\n", - "m=E/(pi**2./900.*k**2.*N*(N1-N2))\n", - "print'%s %.1f %s %.1f %s'%('Power of the motor= ',P,' watts''Mass of the flywheel required= ',m,' kg')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power of the motor= 3000.0 wattsMass of the flywheel required= 618.2 kg\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg176" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 3 PAGE NO 176\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "d=38.## diameter of hole in cm\n", - "t=32.## thickness of hole in cm\n", - "e1=7.## energy required to punch one square mm\n", - "V=25.## mean speed of the flywheel in m/s\n", - "S=100.## stroke of the punch in cm\n", - "T=10.## time required to punch a hole in s\n", - "Cs=.03## coefficient of fluctuation of speed\n", - "##===================\n", - "A=pi*d*t## sheared area in mm**2\n", - "E1=e1*A## energy required to punch entire area in Nm\n", - "P=E1/T## power of motor required in watts\n", - "T1=T/(2.*S)*t## time required to punch a hole in 32 mm thick plate\n", - "E2=P*T1## energy supplied by motor in T1 seconds\n", - "E=E1-E2## maximum fluctuation of energy in Nm\n", - "m=E/(V**2.*Cs)## mass of the flywheel required\n", - "print'%s %.1f %s'%('Mass of the flywheel required= ',m,' kg')\n", - "\n", - "\t\t" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of the flywheel required= 1197.8 kg\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg177" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 4 PAGE NO 177\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "##figure 6.4\n", - "import math\n", - "##===================\n", - "pi=3.141\n", - "N=480.## speed of the engine in rpm\n", - "k=.6## radius of gyration in m\n", - "Cs=.03## coefficient of fluctuaion of speed \n", - "Ts=6000.## turning moment scale in Nm per one cm\n", - "C=30.## crank angle scale in degrees per cm\n", - "a=[0.5,-1.22,.9,-1.38,.83,-.7,1.07]## areas between the output torque and mean resistance line in sq.cm\n", - "##======================\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "A=Ts*C*pi/180.## 1 cm**2 of turning moment diagram in Nm\n", - "E1=a[0]## max energy at B refer figure\n", - "E2=a[0]+a[1]+a[2]+a[3]\n", - "E=(E1-E2)*A## fluctuation of energy in Nm\n", - "m=E/(k**2.*w**2*Cs)## mass of the flywheel in kg\n", - "print'%s %.1f %s'%('Mass of the flywheel= ',m,' kg')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of the flywheel= 195.8 kg\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg178" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 5 PAGE NO 178\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "##==============\n", - "pi=3.141\n", - "P=500.*10**3.## power of the motor in N\n", - "k=.6## radius of gyration in m\n", - "Cs=.03## coefficient of fluctuation of spped \n", - "OA=750.## REFER FIGURE\n", - "OF=6.*pi## REFER FIGURE\n", - "AG=pi## REFER FIGURE\n", - "BG=3000.-750.## REFER FIGURE\n", - "GH=2.*pi## REFER FIGURE\n", - "CH=3000.-750.## REFER FIGURE\n", - "HD=pi## REFER FIGURE\n", - "LM=2.*pi## REFER FIGURE\n", - "T=OA*OF+1./2.*AG*BG+BG*GH+1./2.*CH*HD## Torque required for one complete cycle in Nm\n", - "Tmean=T/(6.*pi)## mean torque in Nm\n", - "w=P/Tmean## angular velocity required in rad/s\n", - "BL=3000.-1875.## refer figure\n", - "KL=BL*AG/BG## From similar trangles\n", - "CM=3000.-1875.## refer figure\n", - "MN=CM*HD/CH##from similar triangles\n", - "E=1./2.*KL*BL+BL*LM+1./2.*CM*MN## Maximum fluctuaion of energy in Nm\n", - "m=E*100./(k**2*w**2.*Cs)## mass of flywheel in kg\n", - "print'%s %.1f %s'%('Mass of the flywheel= ',m,' kg')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of the flywheel= 1150.3 kg\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg179" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 6 PAGE NO 179\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "PI=180.##in degrees\n", - "theta1=0.\n", - "theta2=PI\n", - "m=400.## mass of the flywheel in kg\n", - "N=250.## speed in rpm\n", - "k=.4## radius of gyration in m\n", - "n=2.*250./60000.## no of working strokes per minute\n", - "W=1000.*pi-150.*math.cos((2*theta2)/57.3)-250.*math.sin((2*theta2)/57.3)-(1000.*theta1-150.*math.cos((2*theta1)/57.3)-250.*math.sin((2*theta1)/57.3))## workdone per stroke in Nm\n", - "P=W*n## power in KW\n", - "Tmean=W/pi## mean torque in Nm\n", - "twotheta=math.atan((500/300)/57.3)## angle at which T-Tmean becomes zero\n", - "THETA1=twotheta/2.\n", - "THETA2=(180.+twotheta)/2.\n", - "E=-150.*math.cos((2.*THETA2)/57.3)-250.*math.sin((2.*THETA2)/57.3)-(-150*math.cos((2.*THETA1)/57.3)-250.*math.sin((2*THETA1)/57.3))## FLUCTUATION OF ENERGY IN Nm\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "Cs1=E*100./(k**2.*w**2.*m)## fluctuation range\n", - "Cs=Cs1/2.## tatal percentage of fluctuation of speed\n", - "Theta=60.\n", - "T1=300.*math.sin((2*Theta)/57.3)-500.*math.cos((2*Theta)/57.3)## Accelerating torque in Nm(T-Tmean)\n", - "alpha=T1/(m*k**2.)## angular acceleration in rad/s**2\n", - "print'%s %.1f %s %.3f %s %.3f %s '%('Power delivered=',P,' kw''Total percentage of fluctuation speed=',Cs,' ''Angular acceleration=',alpha,'rad/s**2')\n", - "#in book ans is given wrong \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered= 26.2 kwTotal percentage of fluctuation speed= 0.342 Angular acceleration= 7.965 rad/s**2 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg181" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 7 PAGE NO 181\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "\n", - "pi=3.141\n", - "m=200.## mass of the flywheel in kg\n", - "k=.5## radius of gyration in m\n", - "N1=360.## upper limit of speed in rpm\n", - "N2=240.## lower limit of speed in rpm\n", - "##==========\n", - "I=m*k**2.## mass moment of inertia in kg m**2\n", - "w1=2.*pi*N1/60.\n", - "w2=2.*pi*N2/60.\n", - "E=1./2.*I*(w1**2.-w2**2.)## fluctuation of energy in Nm\n", - "Pmin=E/(4.*1000.)## power in kw\n", - "Eex=Pmin*12.*1000.## Energy expended in performing each operation in N-m\n", - "print'%s %.1f %s %.1f %s '%('Mimimum power required= ',Pmin,' kw' ' Energy expended in performing each operation= ',Eex,' N-m')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mimimum power required= 4.9 kw Energy expended in performing each operation= 59195.3 N-m \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg182" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 8 PAGE NO 182\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "b=8.## width of the strip in cm\n", - "t=2.## thickness of the strip in cm\n", - "w=1.2*10**3.## work required per square cm cut\n", - "N1=200.## maximum speed of the flywheel in rpm\n", - "k=.80## radius of gyration in m\n", - "N2=(1.-.15)*N1## minimum speed of the flywheel in rpm\n", - "T=3.## time required to punch a hole\n", - "##=======================\n", - "A=b*t## area cut of each stroke in cm**2\n", - "W=w*A## work required to cut a strip in Nm\n", - "w1=2.*pi*N1/60.## speed before cut in rpm\n", - "w2=2.*pi*N2/60.## speed after cut in rpm\n", - "m=2.*W/(k**2.*(w1**2.-w2**2.))## mass of the flywheel required in kg\n", - "a=(w1-w2)/T## angular acceleration in rad/s**2\n", - "Ta=m*k**2.*a## torque required in Nm\n", - "print'%s %.1f %s %.1f %s '%('Mass of the flywheel= ',m,' kg'' Amount of Torque required=',Ta,'Nm')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of the flywheel= 493.1 kg Amount of Torque required= 330.4 Nm \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg182" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 9 PAGE NO 182\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "\n", - "pi=3.141\n", - "P=5.*10**3.## power delivered by motor in watts\n", - "N1=360.## speed of the flywheel in rpm\n", - "I=60.## mass moment of inertia in kg m**2\n", - "E1=7500.## energy required by pressing machine for 1 second in Nm\n", - "##========================\n", - "Ehr=P*60.*60.## energy sipplied per hour in Nm\n", - "n=Ehr/E1\n", - "E=E1-P## total fluctuation of energy in Nm\n", - "w1=2.*pi*N1/60.## angular speed before pressing in rpm \n", - "w2=((2.*pi*N1/60.)**2.-(2.*E/I))**.5## angular speed after pressing in rpm \n", - "N2=w2*60./(2.*pi)\n", - "R=N1-N2## reduction in speed in rpm\n", - "print'%s %.1f %s %.1f %s '%('No of pressings that can be made per hour= ',n,' Reduction in speed after the pressing is over= ',R,' rpm ')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No of pressings that can be made per hour= 2400.0 Reduction in speed after the pressing is over= 10.7 rpm \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg183" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 10 PAGE NO 183\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "Cs=.02## coefficient of fluctuation of speed \n", - "N=200.## speed of the engine in rpm\n", - "\n", - "theta1=math.acos(0/57.3)\n", - "theta2=math.asin((-6000/16000)/57.3)\n", - "theta2=180.-theta2\n", - "##===============================================\n", - "##largest area,representing fluctuation of energy lies between theta1 and theta2\n", - "E=6000.*math.sin(theta2/57.3)-8000./2.*math.cos((2*theta2)/57.3)-(6000.*math.sin((theta1)/57.3)-8000./2.*math.cos((2*theta1)/57.3))## total fluctuation of energy in Nm\n", - "Theta=180## angle with which cycle will be repeated in degrees\n", - "Theta1=0\n", - "Tmean=1/pi*((15000*pi+(-8000*math.cos((2*Theta)/57.3))/2.)-((15000*Theta1+(-8000*math.cos((2*Theta1)/57.3))/2.)))## mean torque of engine in Nm\n", - "P=2*pi*N*Tmean/60000.## power of the engine in kw\n", - "w=2*pi*N/60.## angular speed of the engine in rad/s\n", - "I=E/(w**2.*Cs)## mass moment of inertia of flywheel in kg-m**2\n", - "print'%s %.1f %s %.1f %s '%('Power of the engine= ',P,' kw'' minimum mass moment of inertia of flywheel=',-I,' kg-m**2'' E value calculated in the textbook is wrong. Its value is -15,124. In textbook it is given as -1370.28')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power of the engine= 314.1 kw minimum mass moment of inertia of flywheel= 19.5 kg-m**2 E value calculated in the textbook is wrong. Its value is -15,124. In textbook it is given as -1370.28 \n" - ] - } - ], - "prompt_number": 11 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines/Chapter7.ipynb b/_Theory_Of_Machines/Chapter7.ipynb deleted file mode 100755 index 064e91a6..00000000 --- a/_Theory_Of_Machines/Chapter7.ipynb +++ /dev/null @@ -1,638 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e7c45b9f9a74c2d06cff538ea39937b4592b2eb0de2281e1b9530b19c7e61df9" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter7-GOVERNORS" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg196" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 1 PAGE NO 196\n", - "##TITLE:GOVERNORS\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "L=.4## LENGTH OF UPPER ARM IN m\n", - "THETA=30.## INCLINATION TO THE VERTICAL IN degrees\n", - "K=.02## RISED LENGTH IN m\n", - "##============================================================================================\n", - "h2=L*math.cos(THETA/57.3)## GOVERNOR HEIGHT IN m\n", - "N2=(895./h2)**.5## SPEED AT h2 IN rpm\n", - "h1=h2-K## LENGTH WHEN IT IS RAISED BY 2 cm\n", - "N1=(895./h1)**.5## SPEED AT h1 IN rpm\n", - "n=(N1-N2)/N2*100.## PERCENTAGE CHANGE IN SPEED\n", - "##==========================================================================================\n", - "print'%s %.1f %s'%('PERCENTAGE CHANGE IN SPEED=',n,' PERCENTAGE')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "PERCENTAGE CHANGE IN SPEED= 3.0 PERCENTAGE\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 2 PAGE NO 197\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.5(A),7.5(B)\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "OA=.3## LENGTH OF UPPER ARM IN m\n", - "m=6.## MASS OF EACH BALL IN Kg\n", - "M=18.## MASS OF SLEEVE IN Kg\n", - "r2=.2## RADIUS OF ROTATION AT BEGINING IN m\n", - "r1=.25## RADIUS OF ROTATION AT MAX SPEED IN m\n", - "##===========================================================================================\n", - "h1=(OA**2.-r1**2.)**.5## HIEGHT OF GOVERNOR AT MAX SPEED IN m\n", - "N1=(895.*(m+M)/(h1*m))**.5## MAX SPEED IN rpm\n", - "h2=(OA**2.-r2**2.)**.5## HEIGHT OF GONERNOR AT BEGINING IN m\n", - "N2=(895.*(m+M)/(h2*m))**.5## MIN SPEED IN rpm\n", - "##===========================================================================================\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('MAX SPEED = ',N1,' rpm'' MIN SPEED = ',N2,' rpm''RANGE OF SPEED = ',N1-N2,' rpm')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "MAX SPEED = 146.9 rpm MIN SPEED = 126.5 rpmRANGE OF SPEED = 20.4 rpm\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 3 PAGE NO 197\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.6\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "OA=.25## LENGHT OF UPPER ARM IN m\n", - "CD=.03## DISTANCE BETWEEN LEEVE AND LOWER ARM IN m\n", - "m=6.## MASS OF BALL IN Kg\n", - "M=48.## MASS OF SLEEVE IN Kg\n", - "AE=.17## FROM FIGURE 7.6\n", - "AE1=.12## FROM FIGURE 7.6\n", - "r1=.2## RADIUS OF ROTATION AT MAX SPEED IN m\n", - "r2=.15## RADIUS OF ROTATION AT MIN SPEED IN m\n", - "##============================================================================================\n", - "h1=(OA**2-r1**2)**.5## HIEGHT OF GOVERNOR AT MIN SPEED IN m\n", - "TANalpha=r1/h1\n", - "TANbeeta=AE/(OA**2-AE**2)**.5\n", - "k=TANbeeta/TANalpha\n", - "N1=(895.*(m+(M*(1.+k)/2.))/(h1*m))**.5## MIN SPEED IN rpm\n", - "h2=(OA**2-r2**2)**.5## HIEGHT OF GOVERNOR AT MAX SPEED IN m\n", - "CE=(OA**2-AE1**2)**.5\n", - "TANalpha1=r2/h2\n", - "TANbeeta1=(r2-CD)/CE\n", - "k=TANbeeta1/TANalpha1\n", - "N2=(895.*(m+(M*(1.+k)/2.))/(h2*m))**.5## MIN SPEED IN rpm\n", - "##========================================================================================================\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('MAX SPEED = ',N1,' rpm'' MIN SPEED = ',N2,' rpm''RANGE OF SPEED = ',N1-N2,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "MAX SPEED = 215.5 rpm MIN SPEED = 188.2 rpmRANGE OF SPEED = 27.2 rpm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg199" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 4 PAGE NO 199\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.7\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "g=9.81## ACCELERATION DUE TO GRAVITY \n", - "OA=.20## LENGHT OF UPPER ARM IN m\n", - "AC=.20## LENGTH OF LOWER ARM IN m\n", - "CD=.025## DISTANCE BETWEEN AXIS AND LOWER ARM IN m\n", - "AB=.1## RADIUS OF ROTATION OF BALLS IN m\n", - "N2=250## SPEED OF THE GOVERNOR IN rpm\n", - "X=.05## SLEEVE LIFT IN m\n", - "m=5.## MASS OF BALL IN Kg\n", - "M=20.## MASS OF SLEEVE IN Kg\n", - "##===========================================================\n", - "h2=(OA**2.-AB**2.)**.5## OB DISTANCE IN m IN FIGURE\n", - "h21=(AC**2.-(AB-CD)**2.)**.5## BD DISTANCE IN m IN FIGURE\n", - "TANbeeta=(AB-CD)/h21## TAN OF ANGLE OF INCLINATION OF THE LINK TO THE VERTICAL\n", - "TANalpha=AB/h2## TAN OF ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", - "k=TANbeeta/TANalpha\n", - "c=X/(2.*(h2*(1.+k)-X))## PERCENTAGE INCREASE IN SPEED \n", - "n=c*N2## INCREASE IN SPEED IN rpm\n", - "N1=N2+n## SPEED AFTER LIFT OF SLEEVE\n", - "E=c*g*((2.*m/(1.+k))+M)## GOVERNOR EFFORT IN N\n", - "P=E*X## GOVERNOR POWER IN N-m\n", - "\n", - "print'%s %.1f %s %.2f %s %.1f %s '%('SPEED OF THE GOVERNOR WHEN SLEEVE IS LIFT BY 5 cm = ',N1,' rpm'' GOVERNOR EFFORT = ',E,' N' 'GOVERNOR POWER = ',P,' N-m')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "SPEED OF THE GOVERNOR WHEN SLEEVE IS LIFT BY 5 cm = 275.6 rpm GOVERNOR EFFORT = 25.95 NGOVERNOR POWER = 1.3 N-m \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg200" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 5 PAGE NO 200\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.8\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "g=9.81## ACCELERATION DUE TO GRAVITY \n", - "OA=.30## LENGHT OF UPPER ARM IN m\n", - "AC=.30## LENGTH OF LOWER ARM IN m\n", - "m=10.## MASS OF BALL IN Kg\n", - "M=50.## MASS OF SLEEVE IN Kg\n", - "r=.2## RADIUS OF ROTATION IN m\n", - "CD=.04## DISTANCE BETWEEN AXIS AND LOWER ARM IN m\n", - "F=15.## FRICTIONAL LOAD ACTING IN N\n", - "##============================================================\n", - "h=(OA**2-r**2)**.5## HIEGTH OF THE GOVERNOR IN m\n", - "AE=r-CD## AE VALUE IN m\n", - "CE=(AC**2-AE**2)**.5## BD DISTANCE IN m\n", - "TANalpha=r/h## TAN OF ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", - "TANbeeta=AE/CE## TAN OF ANGLE OF INCLINATION OF THE LINK TO THE VERTICAL\n", - "k=TANbeeta/TANalpha\n", - "N=((895./h)*(m+(M*(1.+k)/2.))/m)**.5## EQULIBRIUM SPEED IN rpm\n", - "N1=((895./h)*((m*g)+(M*g+F)/2.)*(1.+k)/(m*g))**.5## MAX SPEED IN rpm\n", - "N2=((895./h)*((m*g)+(M*g-F)/2.)*(1.+k)/(m*g))**.5## MIN SPEED IN rpm\n", - "R=N1-N2## RANGE OF SPEED\n", - "print'%s %.1f %s %.1f %s '%('EQUILIBRIUM SPEED OF GOVERNOR = ',N,' rpm'' RANGE OF SPEED OF GOVERNOR= ',R,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "EQUILIBRIUM SPEED OF GOVERNOR = 145.1 rpm RANGE OF SPEED OF GOVERNOR= 3.4 rpm \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg202" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 6 PAGE NO 202\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.9\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "g=9.81## ACCELERATION DUE TO GRAVITY \n", - "OA=.30## LENGHT OF UPPER ARM IN m\n", - "AC=.30## LENGTH OF LOWER ARM IN m\n", - "m=5.## MASS OF BALL IN Kg\n", - "M=25.## MASS OF SLEEVE IN Kg\n", - "X=.05## LIFT OF THE SLEEVE\n", - "alpha=30.## ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", - "##==============================================\n", - "h2=OA*math.cos(alpha/57.3)## HEIGHT OF THE GOVERNOR AT LOWEST POSITION OF SLEEVE\n", - "h1=h2-X/2.## HEIGHT OF THE GOVERNOR AT HEIGHT POSITION OF SLEEVE\n", - "F=((h2/h1)*(m*g+M*g)-(m*g+M*g))/(1.+h2/h1)## FRICTION AT SLEEVE IN N\n", - "N1=((m*g+M*g+F)*895./(h1*m*g))**.5## MAX SPEEED OF THE GOVVERNOR IN rpm\n", - "N2=((m*g+M*g-F)*895./(h2*m*g))**.5## MIN SPEEED OF THE GOVVERNOR IN rpm\n", - "R=N1-N2## RANGE OF SPEED IN rpm\n", - "\n", - "print'%s %.1f %s %.1f %s'%('THE VALUE OF FRICTIONAL FORCE= ',F,' F'' RANGE OF SPEED OF THE GOVERNOR = ',R,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE VALUE OF FRICTIONAL FORCE= 14.9 F RANGE OF SPEED OF THE GOVERNOR = 14.9 rpm\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg203" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 7 PAGE NO 203\n", - "##TITLE:GOVERNORS\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "m=3## MASS OF EACH BALL IN Kg\n", - "a=.12## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", - "b=.08## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", - "r2=.12## RADIUS OF ROTATION OF THE BALL FOR LOWEST POSITION IN m\n", - "N2=320.## SPEED OF GOVERNOR AT THE BEGINING IN rpm\n", - "S=20000.## STIFFNESS OF THE SPRING IN N/m\n", - "h=.015## SLEEVE LIFT IN m\n", - "##==================================================\n", - "Fc2=m*(2.*PI*N2/60.)**2*r2## CENTRIFUGAL FORCE ACTING AT MIN SPEED OF ROTATION IN N\n", - "L=2*a*Fc2/b## INITIAL LOAD ON SPRING IN N\n", - "r1=a/b*h+r2## MAX RADIUS OF ROTATION IN m\n", - "Fc1=(S*(r1-r2)*(b/a)**2/2)+Fc2## CENTRIFUGAL FORCE ACTING AT MAX SPEED OF ROTATION IN N\n", - "N1=(Fc1/(m*r1)*(60./2./PI)**2)**.5\n", - "print'%s %.1f %s %.1f %s '%('INITIAL LOAD ON SPRING =',L,' N'' EQUILIBRIUM SPEED CORRESPONDING TO LIFT OF 15 cm =',N1,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "INITIAL LOAD ON SPRING = 1217.0 N EQUILIBRIUM SPEED CORRESPONDING TO LIFT OF 15 cm = 327.9 rpm \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg204" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 8 PAGE NO 204\n", - "##TITLE:GOVERNORS\n", - "\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "m=3## MASS OF BALL IN Kg\n", - "r2=.2## INITIAL RADIUS OF ROTATION IN m\n", - "a=.11## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", - "b=.15## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", - "h=.004## SLEEVE LIFT IN m\n", - "N2=240.## INITIAL SPEED IN rpm\n", - "n=7.5## FLUCTUATION OF SPEED IN %\n", - "##===================================\n", - "w2=2.*PI*N2/60.## INITIAL ANGULAR SPEED IN rad/s\n", - "w1=(100.+n)*w2/100.## FINAL ANGULAR SPEED IN rad/s\n", - "F=2.*a/b*m*w2**2.*r2## INITIAL COMPRESSIVE FORCE IN N\n", - "r1=r2+a/b*h## MAX RDIUS OF ROTATION IN m\n", - "S=2.*((m*w1**2.*r1)-(m*w2**2.*r2))/(r1-r2)*(a/b)**2.\n", - "print'%s %.1f %s %.1f %s'%('INITIAL COMPRESSIVE FPRCE = ',F,' N'' STIFFNESS OF THE SPRING = ',S/1000,' N/m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "INITIAL COMPRESSIVE FPRCE = 557.8 N STIFFNESS OF THE SPRING = 24.1 N/m\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg204" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 9 PAGE NO 204\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.3(C)\n", - "\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "g=9.81## ACCELERATION DUE TO GRAVITY \n", - "PI=3.147\n", - "r=.14## DISTANCE BETWEEN THE CENTRE OF PIVOT OF BELL CRANK LEVER AND AXIS OF GOVERNOR SPINDLE IN m\n", - "r2=.11## INITIAL RADIUS OF ROTATION IN m\n", - "a=.12## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", - "b=.10## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", - "h=.05## SLEEVE LIFT IN m\n", - "N2=240## INITIAL SPEED IN rpm\n", - "F=30## FRICTIONAL FORCE ACTING IN N\n", - "m=5## MASS OF EACH BALL IN Kg\n", - "##==========================================\n", - "r1=r2+a/b*h## MAX RADIUS OF ROTATION IN m\n", - "N1=41.*N2/39.## MAX SPEED OF ROTATION IN rpm\n", - "N=(N1+N2)/2.## MEAN SPEED IN rpm\n", - "Fc1=m*(2.*PI*N1/60.)**2.*r1## CENTRIFUGAL FORCE ACTING AT MAX SPEED OF ROTATION IN N\n", - "Fc2=m*(2.*PI*N2/60.)**2.*r2## CENTRIFUGAL FORCE ACTING AT MIN SPEED OF ROTATION IN N\n", - "c1=r1-r## FROM FIGURE 7.3(C) IN m\n", - "a1=(a**2.-c1**2.)**.5## FROM FIGURE 7.3(C) IN m\n", - "b1=(b**2.-(h/2.)**2.)**.5## FROM FIGURE 7.3(C) IN m\n", - "c2=r-r2## FROM FIGURE 7.3(C) IN m\n", - "a2=a1## FROM FIGURE 7.3(C) IN m\n", - "b2=b1## FROM FIGURE 7.3(C) IN m\n", - "S1=2.*((Fc1*a1)-(m*g*c1))/b1## SPRING FORCE EXERTED ON THE SLEEVE AT MAXIMUM SPEED IN NEWTONS\n", - "S2=2.*((Fc2*a2)-(m*g*c2))/b2## SPRING FORCE EXERTED ON THE SLEEVE AT MAXIMUM SPEED IN NEWTONS\n", - "S=(S1-S2)/h## STIFFNESS OF THE SPRING IN N/m\n", - "Is=S2/S## INITIAL COMPRESSION OF SPRING IN m\n", - "P=S2+(h/2.*S)## SPRING FORCE OF MID PORTION IN N\n", - "n1=N*((P+F)/P)**.5## SPEED,WHEN THE SLEEVE BEGINS TO MOVE UPWARDS FROM MID POSITION IN rpm\n", - "n2=N*((P-F)/P)**.5## SPEED,WHEN THE SLEEVE BEGINS TO MOVE DOWNWARDS FROM MID POSITION IN rpm\n", - "A=n1-n2## ALTERATION IN SPEED IN rpm\n", - "print'%s %.1f %s %.1f %s '%('INTIAL COMPRESSION OF SPRING= ',Is*100,' cm''ALTERATION IN SPEED = ',A,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "INTIAL COMPRESSION OF SPRING= 6.8 cmALTERATION IN SPEED = 6.7 rpm \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg206" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 10 PAGE NO 206\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.10\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "AE=.25## LENGTH OF UPPER ARM IN m\n", - "CE=.25## LENGTH OF LOWER ARM IN m\n", - "EH=.1## LENGTH OF EXTENDED ARM IN m\n", - "EF=.15## RADIUS OF BALL PATH IN m\n", - "m=5.## MASS OF EACH BALL IN Kg\n", - "M=40.## MASS OF EACH BALL IN Kg\n", - "##===================================================================\n", - "h=(AE**2.-EF**2.)**.5## HEIGHT OF THE GOVERNOR IN m\n", - "EM=h\n", - "HM=EH+EM## FROM FIGURE 7.10\n", - "N=((895./h)*(EM/HM)*((m+M)/m))**.5\n", - "print'%s %.1f %s'%('EQUILIBRIUM SPEED OF GOVERNOR =',N,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "EQUILIBRIUM SPEED OF GOVERNOR = 163.9 rpm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg207" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 11 PAGE NO 207\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.11\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N/mm**2\n", - "AE=.25## LENGTH OF UPPER ARM IN m\n", - "CE=.25## LENGTH OF LOWER ARM IN m\n", - "ER=.175## FROM FIGURE 7.11\n", - "AP=.025## FROM FIGURE 7.11\n", - "FR=AP## FROM FIGURE 7.11\n", - "CQ=FR## FROM FIGURE 7.11\n", - "m=3.2## MASS OF BALL IN Kg\n", - "M=25.## MASS OF SLEEVE IN Kg\n", - "h=.2## VERTICAL HEIGHT OF GOVERNOR IN m\n", - "EM=h## FROM FIGURE 7.11\n", - "AF=h## FROM FIGURE 7.11\n", - "N=160.## SPEED OF THE GOVERNOR IN rpm\n", - "HM=(895.*EM*(m+M)/(h*N**2.*m))\n", - "x=HM-EM## LENGTH OF EXTENDED LINK IN m\n", - "T1=g*(m+M/2.)*AE/AF## TENSION IN UPPER ARM IN N\n", - "print'%s %.3f %s %.1f %s'%('LENGTH OF EXTENDED LINK = ',x,' m''TENSION IN UPPER ARM =',T1,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "LENGTH OF EXTENDED LINK = 0.108 mTENSION IN UPPER ARM = 192.5 N\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg208" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 12 PAGE NO 208\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.12,7.13\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "EF=.20## MINIMUM RADIUS OF ROTATION IN m\n", - "AE=.30## LENGTH OF EACH ARM IN m\n", - "A1E1=AE## COMPARING FIRUES 7.12&7.13\n", - "EC=.30## LENGTH OF EACH ARM IN m\n", - "E1C1=EC## LENGTH OF EACH ARM IN m\n", - "ED=.165## FROM FIGURE 7.12 IN m\n", - "MC=ED## FROM FIGURE 7.12\n", - "EH=.10## FROM FIGURE 7.12 IN m\n", - "m=8.## MASS OF BALL IN Kg \n", - "M=60.## MASS OF SLEEVE IN Kg\n", - "DF=.035## SLEEVE DISTANCE FROM AXIS IN m\n", - "E1F1=.25## MAX RADIUS OF ROTATION IN m\n", - "g=9.81\n", - "##=========================================================\n", - "alpha=math.asin((EF/AE))*57.3## ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL IN DEGREES\n", - "beeta=math.asin((ED/EC))*57.3## ANGLE OF INCLINATION OF THE ARM TO THE HORIZONTAL IN DEGREES\n", - "k=math.tan(beeta/57.3)/math.tan(alpha/57.3)\n", - "h=(AE**2.-EF**2.)**.5## HEIGHT OF GOVERNOR IN m\n", - "EM=(EC**2.-MC**2.)**.5## FROM FIGURE 7.12 IN m\n", - "HM=EM+EH\n", - "N2=(895.*EM*(m+(M/2.*(1.+k)))/(h*HM*m))**.5## EQUILIBRIUM SPEED AT MAX RADIUS\n", - "HC=(HM**2.+MC**2.)**.5## FROM FIGURE 7.13 IN m\n", - "H1C1=HC\n", - "gama=math.atan((MC/HM))*57.3\n", - "alpha1=math.asin((E1F1/A1E1))*57.3\n", - "E1D1=E1F1-DF## FROM FIGURE 7.13 IN m\n", - "beeta1=math.asin((E1D1/E1C1))*57.3\n", - "gama1=gama-beeta+beeta1\n", - "r=H1C1*math.sin(gama1/57.3)+DF## RADIUS OF ROTATION IN m\n", - "H1M1=H1C1*math.cos((gama1/57.3))\n", - "I1C1=E1C1*math.cos(beeta1/57.3)*(math.tan(alpha1/57.3)+math.tan(beeta1/57.3))## FROM FIGURE IN m\n", - "M1C1=H1C1*math.sin(gama1/57.3)\n", - "w1=(((m*g*(I1C1-M1C1))+(M*g*I1C1)/2.)/(m*r*H1M1))**.5## ANGULAR SPEED IN rad/s\n", - "N1=w1*60./(2.*PI)## ##SPEED IN m/s\n", - "print'%s %.1f %s %.1f %s '%('MINIMUM SPEED OF ROTATION =',N2,' rpm'' MAXIMUM SPEED OF ROTATION = ',N1,' rpm')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "MINIMUM SPEED OF ROTATION = 146.6 rpm MAXIMUM SPEED OF ROTATION = 156.3 rpm \n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines/Chapter8.ipynb b/_Theory_Of_Machines/Chapter8.ipynb deleted file mode 100755 index 9bd9a862..00000000 --- a/_Theory_Of_Machines/Chapter8.ipynb +++ /dev/null @@ -1,334 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:1cb0ae5332b03066df5ce763bd8fad0da93c877f86bbb84639588cca0d91016e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Chapter8-BALANCING OF ROTATING MASSES" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg221" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 1 PAGE NO 221\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "import math\n", - "mA=12.## mass of A in kg\n", - "mB=10.## mass of B in kg\n", - "mC=18.## mass of C in kg\n", - "mD=15.## mass of D in kg\n", - "rA=40.## radius of A in mm\n", - "rB=50.## radius of B in mm\n", - "rC=60.## radius of C in mm\n", - "rD=30.## radius of D in mm\n", - "theta1=0.## angle between A-A in degrees\n", - "theta2=60.## angle between A-B in degrees\n", - "theta3=130.## angle between A-C in degrees\n", - "theta4=270.## angle between A-D in degrees\n", - "R=100.## radius at which mass to be determined in mm\n", - "##====================================================\n", - "Fh=(mA*rA*math.cos(theta1/57.3)+mB*rB*math.cos(theta2/57.3)+mC*rC*math.cos(theta3/57.3)+mD*rD*math.cos(theta4/57.3))/10.## vertical component value in kg cm\n", - "Fv=(mA*rA*math.sin(theta1/57.3)+mB*rB*math.sin(theta2/57.3)+mC*rC*math.sin(theta3/57.3)+mD*rD*math.sin(theta4/57.3))/10.## horizontal component value in kg cm\n", - "mb=(Fh**2.+Fv**2.)**.5/R*10.## unbalanced mass in kg\n", - "theta=math.atan(Fv/Fh)*57.3## position in degrees \n", - "THETA=180.+theta## angle with mA\n", - "print'%s %.1f %s %.1f %s'%('magnitude of unbalaced mass=',mb,' kg'' angle with mA=',THETA,'degrees')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnitude of unbalaced mass= 8.1 kg angle with mA= 267.5 degrees\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg222" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 2 PAGE NO 222\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mA=5.## mass of A in kg\n", - "mB=10.## mass of B in kg\n", - "mC=8.## mass of C in kg\n", - "rA=10.## radius of A in cm\n", - "rB=15.## radius of B in cm\n", - "rC=10.## radius of C in cm\n", - "rD=10.## radius of D in cm\n", - "rE=15.## radius of E in cm\n", - "##============================\n", - "mD=182./rD## mass of D in kg by mearument\n", - "mE=80./rE## mass of E in kg by mearument\n", - "print'%s %.1f %s %.1f %s '%('mass of D= ',mD,' kg''mass of E= ',mE,' kg')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mass of D= 18.2 kgmass of E= 5.3 kg \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 3 PAGE NO 223\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mA=200.## mass of A in kg\n", - "mB=300.## mass of B in kg\n", - "mC=400.## mass of C in kg\n", - "mD=200.## mass of D in kg\n", - "rA=80.## radius of A in mm\n", - "rB=70.## radius of B in mm\n", - "rC=60.## radius of C in mm\n", - "rD=80.## radius of D in mm\n", - "rX=100.## radius of X in mm\n", - "rY=100.## radius of Y in mm\n", - "##=====================\n", - "mY=7.3/.04## mass of Y in kg by mearurement\n", - "mX=35./.1## mass of X in kg by mearurement\n", - "thetaX=146.## in degrees by mesurement\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('mass of X=',mX,' kg'' mass of Y=',mY,' kg''angle with mA=',thetaX,' degrees')\n", - "\t" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mass of X= 350.0 kg mass of Y= 182.5 kgangle with mA= 146.0 degrees\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg225" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 4 PAGE NO 225\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mB=30## mass of B in kg\n", - "mC=50## mass of C in kg\n", - "mD=40## mass of D in kg\n", - "rA=18## radius of A in cm\n", - "rB=24## radius of B in cm\n", - "rC=12## radius of C in cm\n", - "rD=15## radius of D in cm\n", - "##=============================\n", - "mA=3.6/.18## mass of A by measurement in kg\n", - "theta=124.## angle with mass B in degrees by measurement in degrees\n", - "y=3.6/(.18*20)## position of A from B\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('mass of A=',mA,' kg'' angle with mass B=',theta,' degrees'' position of A from B=',y,' m towards right of plane B')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mass of A= 20.0 kg angle with mass B= 124.0 degrees position of A from B= 1.0 m towards right of plane B\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg226" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 5 PAGE NO 226\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mB=10.## mass of B in kg\n", - "mC=5.## mass of C in kg\n", - "mD=4.## mass of D in kg\n", - "rA=10.## radius of A in cm\n", - "rB=12.5## radius of B in cm\n", - "rC=20.## radius of C in cm\n", - "rD=15.## radius of D in cm\n", - "##=====================================\n", - "mA=7.## mass of A in kg by mesurement\n", - "BC=118.## angle between B and C in degrees by mesurement\n", - "BA=203.5## angle between B and A in degrees by mesurement\n", - "BD=260.## angle between B and D in degrees by mesurement\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Mass of A=',mA,' kg'' angle between B and C=',BC,' degrees''angle between B and A= ',BA,' degrees'' angle between B and D=',BD,' degrees')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of A= 7.0 kg angle between B and C= 118.0 degreesangle between B and A= 203.5 degrees angle between B and D= 260.0 degrees \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg228" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 6 PAGE NO 228\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mB=36.## mass of B in kg\n", - "mC=25.## mass of C in kg\n", - "rA=20.## radius of A in cm\n", - "rB=15.## radius of B in cm\n", - "rC=15.## radius of C in cm\n", - "rD=20.## radius of D in cm\n", - "##==================================\n", - "mA=3.9/.2## mass of A in kg by measurement\n", - "mD=16.5## mass of D in kg by measurement\n", - "theta=252.## angular position of D from B by measurement in degrees\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('Mass of A= ',mA,' kg'' Mass od D= ',mD,' kg'' Angular position of D from B= ',theta,' degrees')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of A= 19.5 kg Mass od D= 16.5 kg Angular position of D from B= 252.0 degrees\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg229" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 7 PAGE NO 229\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "\n", - "\n", - "pi=3.141\n", - "mA=48.## mass of A in kg\n", - "mB=56.## mass of B in kg\n", - "mC=20.## mass of C in kg\n", - "rA=1.5## radius of A in cm\n", - "rB=1.5## radius of B in cm\n", - "rC=1.25## radius of C in cm\n", - "N=300.## speed in rpm\n", - "d=1.8## distance between bearing in cm\n", - "##================================\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "BA=164.## angle between pulleys B&A in degrees by measurement\n", - "BC=129.## angle between pulleys B&C in degrees by measurement\n", - "AC=67.## angle between pulleys A&C in degrees by measurement\n", - "C=.88*w**2.## out of balance couple in N\n", - "L=C/d## load on each bearing in N\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('angle between pulleys B&A=',BA,' degrees'' angle between pulleys B&C= ',BC,' degrees'' angle between pulleys A&C=',AC,' degrees'' out of balance couple= ',C,' N'' load on each bearing=',L,' N')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "angle between pulleys B&A= 164.0 degrees angle between pulleys B&C= 129.0 degrees angle between pulleys A&C= 67.0 degrees out of balance couple= 868.2 N load on each bearing= 482.3 N \n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines/Chapter9.ipynb b/_Theory_Of_Machines/Chapter9.ipynb deleted file mode 100755 index 0fbeb89f..00000000 --- a/_Theory_Of_Machines/Chapter9.ipynb +++ /dev/null @@ -1,151 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:dda7459eb606339995d5ed2e2c12f6be43bc2a1b7dc283fd0394011879a85b71" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter9-CAMS AND FOLLOWERS" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg247" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 9 ILLUSRTATION 2 PAGE NO 247\n", - "##TITLE:CAMS AND FOLLOWERS\n", - "import math\n", - "pi=3.141\n", - "s=4.## follower movement in cm\n", - "theta=60.## cam rotation in degrees\n", - "THETA=60.*pi/180## cam rotation in rad\n", - "thetaD=45.## after outstroke in degrees\n", - "thetaR=90.##....angle with which it reaches its original position in degrees\n", - "THETAR=90.*pi/180## angle with which it reaches its original position in rad\n", - "THETAd=360.-theta-thetaD-thetaR## angle after return stroke in degrees\n", - "N=300.## speed in rpm\n", - "w=2.*pi*N/60.## speed in rad/s\n", - "Vo=pi*w*s/2./THETA## Maximum velocity of follower during outstroke in cm/s\n", - "Vr=pi*w*s/2./THETAR## Maximum velocity of follower during return stroke in cm/s\n", - "Fo=pi**2.*w**2.*s/2./THETA**2./100.##Maximum acceleration of follower during outstroke in m/s**2 \n", - "Fr=pi**2.*w**2.*s/2./THETAR**2/100.##Maximum acceleration of follower during return stroke in m/s**2\n", - "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum acceleration of follower during outstroke = 177.6 m/s**2Maximum acceleration of follower during return stroke= 78.9 m/s**2 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg249" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 9 ILLUSRTATION 3 PAGE NO 249\n", - "##TITLE:CAMS AND FOLLOWERS\n", - "import math\n", - "pi=3.141\n", - "s=5.## follower movement in cm\n", - "theta=120.## cam rotation in degrees\n", - "THETA=theta*pi/180.## cam rotation in rad\n", - "thetaD=30.## after outstroke in degrees\n", - "thetaR=60.##....angle with which it reaches its original position in degrees\n", - "THETAR=60.*pi/180.## angle with which it reaches its original position in rad\n", - "THETAd=360.-theta-thetaD-thetaR## angle after return stroke in degrees\n", - "N=100.## speed in rpm\n", - "w=2.*pi*N/60.## speed in rad/s\n", - "Vo=pi*w*s/2./THETA## Maximum velocity of follower during outstroke in cm/s\n", - "Vr=pi*w*s/2./THETAR## Maximum velocity of follower during return stroke in cm/s\n", - "Fo=pi**2.*w**2.*s/2./THETA**2./100.##Maximum acceleration of follower during outstroke in m/s**2\n", - "Fr=pi**2*w**2.*s/2./THETAR**2/100.##Maximum acceleration of follower during return stroke in m/s**2\n", - "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum acceleration of follower during outstroke = 6.2 m/s**2Maximum acceleration of follower during return stroke= 24.7 m/s**2 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg252" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 9 ILLUSRTATION 5 PAGE NO 252\n", - "##TITLE:CAMS AND FOLLOWERS\n", - "import math\n", - "pi=3.141\n", - "N=1000.## speed of cam in rpm\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "s=2.5## stroke of the follower in cm\n", - "THETA=120.*pi/180.## ANGULAR DISPLACEMENT OF CAM DURING OUTSTROKE IN RAD\n", - "THETAR=90.*pi/180.##ANGULAR DISPLACEMENT OF CAM DURING DWELL IN RAD\n", - "Vo=2.*w*s/THETA## Maximum velocity of follower during outstroke in cm/s\n", - "Vr=2.*w*s/THETAR##Maximum velocity of follower during return stroke in cm/s\n", - "Fo=4.*w**2.*s/THETA**2.##Maximum acceleration of follower during outstroke in m/s**2\n", - "Fr=4.*w**2.*s/THETAR**2.##Maximum acceleration of follower during return stroke in m/s**2\n", - "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum acceleration of follower during outstroke = 25000.0 m/s**2Maximum acceleration of follower during return stroke= 44444.4 m/s**2 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines/screenshots/Chapter1.png b/_Theory_Of_Machines/screenshots/Chapter1.png deleted file mode 100755 index eef4ed79..00000000 Binary files a/_Theory_Of_Machines/screenshots/Chapter1.png and /dev/null differ diff --git a/_Theory_Of_Machines/screenshots/Chapter2.png b/_Theory_Of_Machines/screenshots/Chapter2.png deleted file mode 100755 index 82e1d651..00000000 Binary files a/_Theory_Of_Machines/screenshots/Chapter2.png and /dev/null differ diff --git a/_Theory_Of_Machines/screenshots/Chapter3.png b/_Theory_Of_Machines/screenshots/Chapter3.png deleted file mode 100755 index a9869d84..00000000 Binary files a/_Theory_Of_Machines/screenshots/Chapter3.png and /dev/null differ diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter1.ipynb deleted file mode 100755 index c6ef18b9..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter1.ipynb +++ /dev/null @@ -1,663 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:a8bd87f60081f4f46694f9441020afc8284599a70f0355a12064b02651bb21e5" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter1-Basic Kinematics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 1 PAGE NO 15\n", - "#calculate inclination of slotted bar with vertical \n", - "##TITLE:Basic kinematics\n", - "##Figure 1.14\n", - "import math\n", - "pi=3.141\n", - "AO=200.## distance between fixed centres in mm\n", - "OB1=100.## length of driving crank in mm\n", - "AP=400.## length of slotter bar in mm\n", - "##====================================\n", - "OAB1=math.asin(OB1/AO)*57.3## inclination of slotted bar with vertical in degrees\n", - "beeta=(90-OAB1)*2.## angle through which crank turns inreturn stroke in degrees\n", - "A=(360.-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", - "L=2.*AP*math.sin(90.-beeta/2.)/57.3## length of the stroke in mm\n", - "print'%s %.2f %s %.3f %s'%('Inclination of slotted bar with vertical= ',OAB1,' degrees' 'Length of the stroke=',L,' mm')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Inclination of slotted bar with vertical= 30.00 degreesLength of the stroke= -13.790 mm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 2 PAGE NO 16\n", - "#calculate ratio of time taken on the cutting to the return\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.15\n", - "import math\n", - "OA=300.## distance between the fixed centres in mm\n", - "OB=150.## length of driving crank in mm\n", - "##================================\n", - "OAB=math.asin(OB/OA)## inclination of slotted bar with vertical in degrees\n", - "beeta=(90/57.3-OAB)*2.## angle through which crank turns inreturn stroke in degrees\n", - "A=(360/57.3-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", - "print'%s %.1f %s'%('Ratio of time taken on the cutting to the return stroke= ',A,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Ratio of time taken on the cutting to the return stroke= 2.0 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 3 PAGE NO 16\n", - "#calculate ratio of time taken on the cutting to the return stroke \n", - "##TITLE:Basic kinematics\n", - "##Figure 1.16\n", - "import math\n", - "OB=54.6/57.3## distance between the fixed centres in mm\n", - "OA=85./57.3## length of driving crank in mm\n", - "OA2=OA\n", - "CA=160.## length of slotted lever in mm\n", - "CD=144.## length of connectin rod in mm\n", - "##================================\n", - "beeta=2.*(math.cos(OB/OA2))## angle through which crank turns inreturn stroke in degrees\n", - "A=(360/57.3-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", - "print'%s %.1f %s'%('Ratio of time taken on the cutting to the return stroke= ',A,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Ratio of time taken on the cutting to the return stroke= 2.9 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg 17" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 4 PAGE NO 17\n", - "#calculate velocity position and Angular velocity connection\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.18,1.19\n", - "import math\n", - "pi=3.141\n", - "Nao=180.## speed of the crank in rpm\n", - "wAO=2.*pi*Nao/60.## angular speed of the crank in rad/s\n", - "AO=.5## crank length in m\n", - "AE=.5\n", - "Vao=wAO*AO## velocity of A in m/s\n", - "##================================\n", - "Vb1=8.15## velocity of piston B in m/s by measurment from figure 1.19\n", - "Vba=6.8## velocity of B with respect to A in m/s\n", - "AB=2## length of connecting rod in m\n", - "wBA=Vba/AB## angular velocity of the connecting rod BA in rad/s\n", - "ae=AE*Vba/AB## velocity of point e on the connecting rod\n", - "oe=8.5## by measurement velocity of point E\n", - "Do=.05## diameter of crank shaft in m\n", - "Da=.06## diameter of crank pin in m\n", - "Db=.03## diameter of cross head pin B m\n", - "V1=wAO*Do/2.## velocity of rubbing at the pin of the crankshaft in m/s\n", - "V2=wBA*Da/2.## velocity of rubbing at the pin of the crank in m/s\n", - "Vb=(wAO+wBA)*Db/2.## velocity of rubbing at the pin of cross head in m/s\n", - "ag=5.1## by measurement\n", - "AG=AB*ag/Vba## position and linear velocity of point G on the connecting rod in m\n", - "##===============================\n", - "print'%s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s'%('Velocity of piston B=',Vb1,' m/s''Angular velocity of connecting rod= ',wBA,' rad/s''velocity of point E=',oe,' m/s'' velocity of rubbing at the pin of the crankshaft=',V1,' m/s' 'velocity of rubbing at the pin of the crank =',V2,' m/s''velocity of rubbing at the pin of cross head =',Vb,' m/s''position and linear velocity of point G on the connecting rod=',AG,' m')\n", - "\n", - "\n", - "\n", - "\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity of piston B= 8.150 m/sAngular velocity of connecting rod= 3.400 rad/svelocity of point E= 8.500 m/s velocity of rubbing at the pin of the crankshaft= 0.471 m/svelocity of rubbing at the pin of the crank = 0.102 m/svelocity of rubbing at the pin of cross head = 0.334 m/sposition and linear velocity of point G on the connecting rod= 1.500 m\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg 19" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 5 PAGE NO 19\n", - "#calculate linear velocity at various point\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.20,1.21\n", - "import math\n", - "pi=3.141\n", - "N=120.## speed of crank in rpm\n", - "OA=10.## length of crank in cm\n", - "BP=48.## from figure 1.20 in cm\n", - "BA=40.## from figure 1.20 in cm\n", - "##==============\n", - "w=2.*pi*N/60.## angular velocity of the crank OA in rad/s\n", - "Vao=w*OA## velocity of ao in cm/s\n", - "ba=4.5## by measurement from 1.21 in cm\n", - "Bp=BP*ba/BA\n", - "op=6.8## by measurement in cm from figure 1.21\n", - "s=20.## scale of velocity diagram 1cm=20cm/s\n", - "Vp=op*s## linear velocity of P in m/s\n", - "ob=5.1## by measurement in cm from figure 1.21\n", - "Vb=ob*s## linear velocity of slider B\n", - "print'%s %.2f %s %.2f %s'%('Linear velocity of slider B= ',Vb,' cm/s''Linear velocity of point P= ',Vp,' cm/s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Linear velocity of slider B= 102.00 cm/sLinear velocity of point P= 136.00 cm/s\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg20" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#calculate angular velocity at various points\n", - "##CHAPTER 1 ILLUSRTATION 6 PAGE NO 20\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.22,1.23\n", - "import math\n", - "pi=3.141\n", - "AB=6.25## length of link AB in cm\n", - "BC=17.5## length of link BC in cm\n", - "CD=11.25## length of link CD in cm\n", - "DA=20.## length of link DA in cm\n", - "CE=10.\n", - "N=100.## speed of crank in rpm\n", - "##========================\n", - "wAB=2.*pi*N/60.## angular velocity of AB in rad/s\n", - "Vb=wAB*AB## linear velocity of B with respect to A\n", - "s=15.## scale for velocity diagram 1 cm= 15 cm/s\n", - "dc=3.## by measurement in cm\n", - "Vcd=dc*s\n", - "wCD=Vcd/CD## angular velocity of link CD in rad/s\n", - "bc=2.5## by measurement in cm\n", - "Vbc=bc*s\n", - "wBC=Vbc/BC## angular velocity of link BC in rad/s\n", - "ce=bc*CE/BC\n", - "ae=3.66## by measurement in cm\n", - "Ve=ae*s## velocity of point E 10 from c on the link BC\n", - "af=2.94## by measurement in cm\n", - "Vf=af*s## velocity of point F\n", - "print'%s %.3f %s %.3f %s %.3f %s %.3f %s'%('The angular velocity of link CD= ',wCD,' rad/s'' The angular velocity of link BC= ',wBC,'rad/s'' velocity of point E 10 from c on the link BC= ',Ve,' cm/s' ' velocity of point F= ',Vf,' cm/s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The angular velocity of link CD= 4.000 rad/s The angular velocity of link BC= 2.143 rad/s velocity of point E 10 from c on the link BC= 54.900 cm/s velocity of point F= 44.100 cm/s\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg21" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 7 PAGE NO 21\n", - "##TITLE:Basic kinematics\n", - "#calculate Linear velocity slider and angular velocity of link\n", - "##Figure 1.24,1.25\n", - "import math\n", - "pi=3.141\n", - "Noa=600## speed of the crank in rpm\n", - "OA=2.8## length of link OA in cm\n", - "AB=4.4## length of link AB in cm\n", - "BC=4.9## length of link BC in cm\n", - "BD=4.6## length of link BD in cm\n", - "##=================\n", - "wOA=2.*pi*Noa/60.## angular velocity of crank in rad/s\n", - "Vao=wOA*OA## The linear velocity of point A with respect to oin m/s\n", - "s=50.## scale of velocity diagram in cm\n", - "od=2.95## by measurement in cm from figure\n", - "Vd=od*s/100.## linear velocity slider in m/s\n", - "bd=3.2## by measurement in cm from figure\n", - "Vbd=bd*s\n", - "wBD=Vbd/BD## angular velocity of link BD\n", - "print'%s %.1f %s %.1f %s '%('linear velocity slider D= ',Vd,' m/s' 'angular velocity of link BD= ',wBD,' rad/s')\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "linear velocity slider D= 1.5 m/sangular velocity of link BD= 34.8 rad/s \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg22" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 8 PAGE NO 22\n", - "#calculate Angular velocity of link CD\n", - "##TITLE:Basic kinematics\n", - "import math\n", - "pi=3.141\n", - "Noa=60.## speed of crank in rpm\n", - "OA=30.## length of link OA in cm\n", - "AB=100.## length of link AB in cm\n", - "CD=80.## length of link CD in cm\n", - "##AC=CB\n", - "##================\n", - "wOA=2.*pi*Noa/60.## angular velocity of crank in rad/s\n", - "Vao=wOA*OA/100.## linear velocity of point A with respect to O\n", - "s=50.## scale for velocity diagram 1 cm= 50 cm/s\n", - "ob=3.4## by measurement in cm from figure 1.27\n", - "od=.9## by measurement in cm from figure 1.27\n", - "Vcd=160.## by measurement in cm/s from figure 1.27\n", - "wCD=Vcd/CD## angular velocity of link in rad/s\n", - "print'%s %.d %s'%('Angular velocity of link CD= ',wCD,' rad/s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Angular velocity of link CD= 2 rad/s\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 9 PAGE NO 23\n", - "#calculate velcity of Ram and anugular velocity of link and velocity of slidingof the block\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.28,1.29\n", - "import math\n", - "pi=3.141\n", - "Nao=120.## speed of the crank in rpm\n", - "OQ=10.## length of link OQ in cm\n", - "OA=20.## length of link OA in cm\n", - "QC=15.## length of link QC in cm\n", - "CD=50.## length oflink CD in cm\n", - "##=============\n", - "wOA=2.*pi*Nao/60.## angular speed of crank in rad/s\n", - "Vad=wOA*OA/100.## velocity of pin A in m/s\n", - "BQ=41.## from figure 1.29 \n", - "BC=26.## from firure 1.29 \n", - "bq=4.7## from figure 1.29\n", - "bc=bq*BC/BQ## from figure 1.29 in cm\n", - "s=50.## scale for velocity diagram in cm/s\n", - "od=1.525## velocity vector od in cm from figure 1.29\n", - "Vd=od*s## velocity of ram D in cm/s\n", - "dc=1.925## velocity vector dc in cm from figure 1.29\n", - "Vdc=dc*s## velocity of link CD in cm/s\n", - "wCD=Vdc/CD## angular velocity of link CD in cm/s\n", - "ba=1.8## velocity vector of sliding of the block in cm\n", - "Vab=ba*s## velocity of sliding of the block in cm/s\n", - "print'%s %.3f %s %.2f %s %.1f %s '%('Velocity of RAM D= ',Vd,' cm/s''angular velocity of link CD= ',wCD,' rad/s'' velocity of sliding of the block= ',Vab,' cm/s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity of RAM D= 76.250 cm/sangular velocity of link CD= 1.93 rad/s velocity of sliding of the block= 90.0 cm/s \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg24" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 10 PAGE NO 24\n", - "##TITLE:Basic kinematics\n", - "#calculate linear velocity abd radial component of accerlation and anugular velocity of connecting rod and anugular accerlation of connecting rod\n", - "##Figure 1.30(a),1.30(b),1.30(c)\n", - "import math\n", - "pi=3.141\n", - "Nao=300.## speed of crank in rpm\n", - "AO=.15## length of crank in m\n", - "BA=.6## length of connecting rod in m\n", - "##===================\n", - "wAO=2.*pi*Nao/60.## angular velocity of link in rad/s\n", - "Vao=wAO*AO## linear velocity of A with respect to 'o'\n", - "ab=3.4## length of vector ab by measurement in m/s\n", - "Vba=ab\n", - "ob=4.## length of vector ob by measurement in m/s\n", - "oc=4.1## length of vector oc by measurement in m/s\n", - "fRao=Vao**2./AO## radial component of acceleration of A with respect to O\n", - "fRba=Vba**2./BA## radial component of acceleration of B with respect to A\n", - "wBA=Vba/BA## angular velocity of connecting rod BA\n", - "fTba=103.## by measurement in m/s**2\n", - "alphaBA=fTba/BA## angular acceleration of connecting rod BA\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('linear velocity of A with respect to O= ',Vao,' m/s''radial component of acceleration of A with respect to O= ',fRao,' m/s**2'' radial component of acceleration of B with respect to A=',fRba,' m/s**2'' angular velocity of connecting rod B= ',wBA,' rad/s'' angular acceleration of connecting rod BA= ',alphaBA,' rad/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "linear velocity of A with respect to O= 4.7 m/sradial component of acceleration of A with respect to O= 148.0 m/s**2 radial component of acceleration of B with respect to A= 19.3 m/s**2 angular velocity of connecting rod B= 5.7 rad/s angular acceleration of connecting rod BA= 171.7 rad/s**2 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 11 PAGE NO 26\n", - "#calcualte Angular accerlation at various point\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.31(a),1.31(b),1.31(c)\n", - "import math\n", - "pi=3.141\n", - "wAP=10.## angular velocity of crank in rad/s\n", - "P1A=30.## length of link P1A in cm\n", - "P2B=36.## length of link P2B in cm\n", - "AB=36.## length of link AB in cm\n", - "P1P2=60.## length of link P1P2 in cm\n", - "AP1P2=60.## crank inclination in degrees \n", - "alphaP1A=30.## angulare acceleration of crank P1A in rad/s**2\n", - "##=====================================\n", - "Vap1=wAP*P1A/100.## linear velocity of A with respect to P1 in m/s\n", - "Vbp2=2.2## velocity of B with respect to P2 in m/s(measured from figure )\n", - "Vba=2.06## velocity of B with respect to A in m/s(measured from figure )\n", - "wBP2=Vbp2/(P2B*100.)## angular velocity of P2B in rad/s\n", - "wAB=Vba/(AB*100.)## angular velocity of AB in rad/s\n", - "fAB1=alphaP1A*P1A/100.## tangential component of the acceleration of A with respect to P1 in m/s**2\n", - "frAB1=Vap1**2./(P1A/100.)## radial component of the acceleration of A with respect to P1 in m/s**2\n", - "frBA=Vba**2./(AB/100.)## radial component of the acceleration of B with respect to B in m/s**2\n", - "frBP2=Vbp2**2./(P2B/100.)## radial component of the acceleration of B with respect to P2 in m/s**2\n", - "ftBA=13.62## tangential component of B with respect to A in m/s**2(measured from figure)\n", - "ftBP2=26.62## tangential component of B with respect to P2 in m/s**2(measured from figure)\n", - "alphaBP2=ftBP2/(P2B/100.)## angular acceleration of P2B in m/s**2\n", - "alphaBA=ftBA/(AB/100.)## angular acceleration of AB in m/s**2\n", - "##==========================\n", - "print'%s %.1f %s %.1f %s'%('Angular acceleration of P2B=',alphaBP2,' rad/s**2''angular acceleration of AB =',alphaBA,' rad/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Angular acceleration of P2B= 73.9 rad/s**2angular acceleration of AB = 37.8 rad/s**2\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg28" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 12 PAGE NO 28\n", - "#calculate velocities at various point\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.32(a),1.32(b),1.32(c)\n", - "import math\n", - "PI=3.141\n", - "AB=12.## length of link AB in cm\n", - "BC=48.## length of link BC in cm\n", - "CD=18.## length of link CD in cm\n", - "DE=36.## length of link DE in cm\n", - "EF=12.## length of link EF in cm\n", - "FP=36.## length of link FP in cm\n", - "Nba=200.## roating speed of link BA IN rpm\n", - "wBA=2*PI*200./60.## Angular velocity of BA in rad/s\n", - "Vba=wBA*AB/100.## linear velocity of B with respect to A in m/s\n", - "Vc=2.428## velocity of c in m/s from diagram 1.32(b)\n", - "Vd=2.36## velocity of D in m/s from diagram 1.32(b)\n", - "Ve=1## velocity of e in m/s from diagram 1.32(b)\n", - "Vf=1.42## velocity of f in m/s from diagram 1.32(b)\n", - "Vcb=1.3## velocity of c with respect to b in m/s from figure\n", - "fBA=Vba**2.*100./AB## radial component of acceleration of B with respect to A in m/s**2\n", - "fCB=Vcb**2*100./BC## radial component of acceleration of C with respect to B in m/s**2\n", - "fcb=3.52## radial component of acceleration of C with respect to B in m/s**2 from figure\n", - "fC=19.## acceleration of slider in m/s**2 from figure\n", - "print'%s %.1f %s %.1f %s %.1f %s %.2f %s %.2f %s'%('velocity of c=',Vc,' m/s''velocity of d=',Vd,' m/s''velocity of e=',Ve,' m/s'' velocity of f=',Vf,' m/s''Acceleration of slider=',Vc,' m/s**2')\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "velocity of c= 2.4 m/svelocity of d= 2.4 m/svelocity of e= 1.0 m/s velocity of f= 1.42 m/sAcceleration of slider= 2.43 m/s**2\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 13 PAGE NO 30\n", - "#caculate angular acceleration at varoius points\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.33(a),1.33(b),1.33(c)\n", - "import math\n", - "PI=3.141\n", - "N=120.## speed of the crank OC in rpm\n", - "OC=5.## length of link OC in cm\n", - "cp=20.## length of link CP in cm\n", - "qa=10.## length of link QA in cm\n", - "pa=5.## length of link PA in cm\n", - "CP=46.9## velocity of link CP in cm/s\n", - "QA=58.3## velocity of link QA in cm/s\n", - "Pa=18.3## velocity of link PA in cm/s\n", - "Vc=2.*PI*N*OC/60.## velocity of C in m/s\n", - "Cco=Vc**2./OC## centripetal acceleration of C relative to O in cm/s**2\n", - "Cpc=CP**2./cp## centripetal acceleration of P relative to C in cm/s**2\n", - "Caq=QA**2./qa## centripetal acceleration of A relative to Q in cm/s**2\n", - "Cap=Pa**2./pa## centripetal acceleration of A relative to P in cm/s**2\n", - "pp1=530.\n", - "a1a=323.\n", - "a2a=207.5\n", - "ACP=pp1/cp## angular acceleration of link CP in rad/s**2\n", - "APA=a1a/qa## angular acceleration of link PA in rad/s**2\n", - "AAQ=a2a/pa## angular acceleration of link AQ in rad/s**2\n", - "print'%s %.3f %s %.3f %s %.3f %s'%('angular acceleration of link CP =',ACP,' rad/s**2'' angular acceleration of link CP=',APA,' rad/s**2''angular acceleration of link CP=',AAQ,' rad/s**2')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "angular acceleration of link CP = 26.500 rad/s**2 angular acceleration of link CP= 32.300 rad/s**2angular acceleration of link CP= 41.500 rad/s**2\n" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter10.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter10.ipynb deleted file mode 100755 index 5ae48acb..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter10.ipynb +++ /dev/null @@ -1,507 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:5f892b8e3ed0a74f24a745bdf0e14528cdf96fe8388a860fc7931df67549db87" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter10-Brakes and Dynamometers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg268" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 1 PAGE NO 268\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate torque transmitted by the block brake\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=0.32;##Diameter of the drum in m\n", - "qq=90.;##Angle of contact in degree\n", - "P=820.;##Force applied in N\n", - "U=0.35;##Coefficient of friction\n", - "\n", - "\n", - "U1=((4.*U*math.sin(45/57.3))/((qq*(3.14/180.))+math.sin(90./57.3)));##Equivalent coefficient of friction\n", - "F=((P*0.66)/((0.3/U1)-0.06));##Force value in N taking moments\n", - "TB=(F*(d/2.));##Torque transmitted in N.m\n", - "\n", - "print'%s %.4f %s'%('Torque transmitted by the block brake is ',TB,' N.m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Torque transmitted by the block brake is 120.4553 N.m\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg269" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 2 PAGE NO 269\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate The bicycle travels a distance and makes turns before it comes to rest\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "m=120.;##Mass of rider in kg\n", - "v=16.2;##Speed of rider in km/hr\n", - "d=0.9;##Diameter of the wheel in m\n", - "P=120.;##Pressure applied on the brake in N\n", - "U=0.06;##Coefficient of friction\n", - "\n", - "F=(U*P);##Frictional force in N\n", - "KE=((m*(v*(5./18.))**2.)/2.);##Kinematic Energy in N.m\n", - "S=(KE/F);##Distance travelled by the bicycle before it comes to rest in m\n", - "N=(S/(d*3.14));##Required number of revolutions\n", - "\n", - "print'%s %.1f %s %.1f %s'%('The bicycle travels a distance of ',S,' m'and'',N,'turns before it comes to rest')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The bicycle travels a distance of 168.8 59.7 turns before it comes to rest\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg270" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 3 PAGE NO 270\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#evaluvate maximum torque absorbed\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "S=3500.;##Force on each arm in N\n", - "d=0.36;##Diamter of the wheel in m\n", - "U=0.4;##Coefficient of friction \n", - "qq=100.;##Contact angle in degree\n", - "\n", - "qqr=(qq*(3.14/180));##Contact angle in radians\n", - "UU=((4*U*math.sin(50/57.3))/(qqr+(math.sin(100./57.3))));##Equivalent coefficient of friction\n", - "F1=(S*0.45)/((0.2/UU)+((d/2.)-0.04));##Force on fulcrum in N\n", - "F2=(S*0.45)/((0.2/UU)-((d/2.)-0.04));##Force on fulcrum in N\n", - "TB=(F1+F2)*(d/2.);##Maximum torque absorbed in N.m\n", - "\n", - "print'%s %.2f %s'%('Maximum torque absorbed is ',TB,' N.m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum torque absorbed is 1412.67 N.m\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg271" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 4 PAGE NO 271\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate The maximum braking torque on the drum\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "a=0.5;##Length of lever in m\n", - "d=0.5;##Diameter of brake drum in m\n", - "q=(5/8.)*(2*3.14);##Angle made in radians\n", - "b=0.1;##Distance between pin and fulcrum in m\n", - "P=2000.;##Effort applied in N\n", - "U=0.25;##Coefficient of friction\n", - "\n", - "T=math.exp(U*q);##Ratios of tension\n", - "T2=((P*a)/b);##Tension in N\n", - "T1=(T*T2);##Tension in N\n", - "TB=((T1-T2)*(d/2.))/1000.;##Maximum braking torque in kNm\n", - "\n", - "print'%s %.2f %s'%('The maximum braking torque on the drum is',TB,' kNm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The maximum braking torque on the drum is 4.17 kNm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg271" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 5 PAGE NO 271\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#caculate the brake is self -locking and tension in the side \n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "q=220.;##Angle of contact in degree\n", - "T=340.;##Torque in Nm\n", - "d=0.32;##Diameter of drum in m\n", - "U=0.3;##Coefficient of friction\n", - "\n", - "Td=(T/(d/2.));##Difference in tensions in N\n", - "Tr=math.exp(U*(q*(3.14/180.)));##Ratio of tensions\n", - "T2=(Td/(Tr-1.));##Tension in N\n", - "T1=(Tr*T2);##Tension in N\n", - "P=((T2*(d/2.))-(T1*0.04))/0.5;##Force applied in N\n", - "b=(T1/T2)*4.;##Value of b in cm when the brake is self-locking\n", - "\n", - "print'%s %.2f %s %.2f %s %.2f %s '%('The value of b is ',b,' cm' 'when the brake is self-locking ' 'Tensions in the sides are ',T1,' N and',T2,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The value of b is 12.65 cmwhen the brake is self-locking Tensions in the sides are 3107.70 N and 982.70 N \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg272" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 6 PAGE NO 272\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate torque required and thickness necessary to limit the tensile stress to 70 and secton of the lever taking stress to 60 mpa\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=0.5;##Drum diamter in m\n", - "U=0.3;##Coefficient of friction\n", - "q=250;##Angle of contact in degree\n", - "P=750;##Force in N\n", - "a=0.1;##Band width in m\n", - "b=0.8;##Distance in m\n", - "ft=(70*10**6);##Tensile stress in Pa\n", - "f=(60*10**6);##Stress in Pa\n", - "b1=0.1;##Distance in m\n", - "\n", - "T=math.exp(U*(q*(3.14/180.)));##Tensions ratio\n", - "T2=(P*b*10.)/(T+1.);##Tension in N\n", - "T1=(T*T2);##Tension in N\n", - "TB=(T1-T2)*(d/2.);##Torque in N.m\n", - "t=(max(T1,T2)/(ft*a))*1000.;##Thickness in mm\n", - "M=(P*b);##bending moment at fulcrum in Nm\n", - "X=(M/((1/6.)*f));##Value of th**2\n", - "##t varies from 10mm to 15 mm. Taking t=15mm,\n", - "h=math.sqrt(X/(0.015))*1000.;##Section of the lever in m\n", - "\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('Torque required is ',TB,' N.m' 'Thickness necessary to limit the tensile stress to 70 MPa is ',t,' mm ''Section of the lever taking stress to 60 MPa is ',h,' mm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Torque required is 861.7 N.mThickness necessary to limit the tensile stress to 70 MPa is 0.7 mm Section of the lever taking stress to 60 MPa is 63.2 mm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg273" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 7 PAGE NO 273\n", - "##TITLE:Brakes and Dynamometers\n", - "#calculate value of x and value of power/bd ratio \n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "P1=30.;##Power in kW\n", - "N=1250.;##Speed in r.p.m\n", - "P=60.;##Applied force in N\n", - "d=0.8;##Drum diameter in m\n", - "q=310.;##Contact angle in degree\n", - "a=0.03;##Length of a in m\n", - "b=0.12;##Length of b in m\n", - "U=0.2;##Coefficient of friction\n", - "B=10.;##Band width in cm\n", - "D=80.;##Diameter in cm\n", - "\n", - "T=(P1*60000.)/(2.*3.14*N);##Torque in N.m\n", - "Td=(T/(d/2.));##Tension difference in N\n", - "Tr=math.exp(U*(q*(3.14/180.)));##Tensions ratio\n", - "T2=(Td/(Tr-1.));##Tension in N\n", - "T1=(Tr*T2);##Tension in N\n", - "x=((T2*b)-(T1*a))/P;##Distance in m;\n", - "X=(P1/(B*D));##Ratio\n", - "\n", - "print'%s %.3f %s %.3f %s'%('Value of x is ',x,' m '' Value of (Power/bD) ratio is ',X,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of x is 0.155 m Value of (Power/bD) ratio is 0.037 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg274" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 8 PAGE NO 274\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate time required to bring the shaft to the rest from its running condition\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "m=80.;##Mass of flywheel in kg\n", - "k=0.5;##Radius of gyration in m\n", - "N=250;##Speed in r.p.m\n", - "d=0.32;##Diamter of the drum in m\n", - "b=0.05;##Distance of pin in m\n", - "q=260.;##Angle of contact in degree\n", - "U=0.23;##Coefficient of friction\n", - "P=20;##Force in N\n", - "a=0.35;##Distance at which force is applied in m\n", - "\n", - "Tr=math.exp(U*q*(3.14/180.));##Tensions ratio\n", - "T2=(P*a)/b;##Tension in N\n", - "T1=(Tr*T2);##Tension in N\n", - "TB=(T1-T2)*(d/2.);##Torque in N.m\n", - "KE=((1/2.)*(m*k**2)*((2.*3.14*N)/60.)**2);##Kinematic energy of the rotating drum in Nm\n", - "N1=(KE/(TB*2.*3.14));##Speed in rpm\n", - "aa=((2*3.14*N)/60.)**2/(4.*3.14*N1);##Angular acceleration in rad/s**2\n", - "t=((2.*3.14*N)/60.)/aa;##Time in seconds\n", - "\n", - "print'%s %.1f %s'%('Time required to bring the shaft to the rest from its running condition is ',t,' seconds')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Time required to bring the shaft to the rest from its running condition is 12.7 seconds\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg275" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 9 PAGE NO 275\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate Minimum force required and Time taken to bring to rest \n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "n=12.;##Number of blocks\n", - "q=15.;##Angle subtended in degree\n", - "P=185.;##Power in kW\n", - "N=300.;##Speed in r.p.m\n", - "U=0.25;##Coefficient of friction\n", - "d=1.25;##Diamter in m\n", - "b1=0.04;##Distance in m\n", - "b2=0.14;##Distance in m\n", - "a=1.;##Diatance in m\n", - "m=2400.;##Mass of rotor in kg\n", - "k=0.5;##Radius of gyration in m\n", - "\n", - "Td=(P*60000.)/(2.*3.14*N*(d/2.));##Tension difference in N\n", - "T=Td*(d/2.);##Torque in Nm\n", - "Tr=((1+(U*math.tan(7.5/57.3)))/(1.-(U*math.tan(7.5/57.3))))**n;##Tension ratio\n", - "To=(Td/(Tr-1.));##Tension in N\n", - "Tn=(Tr*To);##Tension in N\n", - "P=((To*b2)-(Tn*b1))/a;##Force in N\n", - "aa=(T/(m*k**2));##Angular acceleration in rad/s**2\n", - "t=((2*3.14*N)/60.)/aa;##Time in seconds\n", - "\n", - "print'%s %.1f %s %.1f %s'%('Minimum force required is ',P,' N' 'Time taken to bring to rest is ',t,' seconds')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Minimum force required is 406.1 NTime taken to bring to rest is 3.2 seconds\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg275" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 10 PAGE NO 275\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate Maximum braking torque and Angular retardation of the drum and Time taken by the system to come to rest \n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "n=12.;## Number of blocks\n", - "q=16.;##Angle subtended in degrees\n", - "d=0.9;##Effective diameter in m\n", - "m=2000.;##Mass in kg\n", - "k=0.5;##Radius of gyration in m\n", - "b1=0.7;##Distance in m\n", - "b2=0.03;##Distance in m\n", - "a=0.1;##Distance in m\n", - "P=180.;##Force in N\n", - "N=360.;##Speed in r.p.m\n", - "U=0.25;##Coefficient of friction\n", - "\n", - "Tr=((1.+(U*math.tan(8/57.3)))/(1.-(U*math.tan(8/57.3))))**n;##Tensions ratio\n", - "T2=(P*b1)/(a-(b2*Tr));##Tension in N\n", - "T1=(Tr*T2);##Tension in N\n", - "TB=(T1-T2)*(d/2.);##Torque in N.m\n", - "aa=(TB/(m*k**2.));##Angular acceleration in rad/s**2\n", - "t=((2.*3.14*N)/60.)/aa;##Time in seconds\n", - "\n", - "print'%s %.2f %s %.2f %s %.2f %s '%('(i) Maximum braking torque is ',TB,'Nm ''(ii) Angular retardation of the drum is ',aa,' rad/s**2''(iii) Time taken by the system to come to rest is ',t,' s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(i) Maximum braking torque is 2481.63 Nm (ii) Angular retardation of the drum is 4.96 rad/s**2(iii) Time taken by the system to come to rest is 7.59 s \n" - ] - } - ], - "prompt_number": 10 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter10_1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter10_1.ipynb deleted file mode 100755 index daac213e..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter10_1.ipynb +++ /dev/null @@ -1,507 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:657f291c53014a3c65d40f4bd27d5c5b11c86f39d42c3963b0caf443f608f132" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter10-Brakes and Dynamometers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg268" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 1 PAGE NO 268\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate torque transmitted by the block brake\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=0.32;##Diameter of the drum in m\n", - "qq=90.;##Angle of contact in degree\n", - "P=820.;##Force applied in N\n", - "U=0.35;##Coefficient of friction\n", - "\n", - "\n", - "U1=((4.*U*math.sin(45/57.3))/((qq*(3.14/180.))+math.sin(90./57.3)));##Equivalent coefficient of friction\n", - "F=((P*0.66)/((0.3/U1)-0.06));##Force value in N taking moments\n", - "TB=(F*(d/2.));##Torque transmitted in N.m\n", - "\n", - "print'%s %.4f %s'%('Torque transmitted by the block brake is ',TB,' N.m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Torque transmitted by the block brake is 120.4553 N.m\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg269" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 2 PAGE NO 269\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate The bicycle travels a distance and makes turns before it comes to rest\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "m=120.;##Mass of rider in kg\n", - "v=16.2;##Speed of rider in km/hr\n", - "d=0.9;##Diameter of the wheel in m\n", - "P=120.;##Pressure applied on the brake in N\n", - "U=0.06;##Coefficient of friction\n", - "\n", - "F=(U*P);##Frictional force in N\n", - "KE=((m*(v*(5./18.))**2.)/2.);##Kinematic Energy in N.m\n", - "S=(KE/F);##Distance travelled by the bicycle before it comes to rest in m\n", - "N=(S/(d*3.14));##Required number of revolutions\n", - "\n", - "print'%s %.1f %s %.1f %s'%('The bicycle travels a distance of ',S,' m'and'',N,'turns before it comes to rest')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The bicycle travels a distance of 168.8 59.7 turns before it comes to rest\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg270" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 3 PAGE NO 270\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#evaluvate maximum torque absorbed\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "S=3500.;##Force on each arm in N\n", - "d=0.36;##Diamter of the wheel in m\n", - "U=0.4;##Coefficient of friction \n", - "qq=100.;##Contact angle in degree\n", - "\n", - "qqr=(qq*(3.14/180));##Contact angle in radians\n", - "UU=((4*U*math.sin(50/57.3))/(qqr+(math.sin(100./57.3))));##Equivalent coefficient of friction\n", - "F1=(S*0.45)/((0.2/UU)+((d/2.)-0.04));##Force on fulcrum in N\n", - "F2=(S*0.45)/((0.2/UU)-((d/2.)-0.04));##Force on fulcrum in N\n", - "TB=(F1+F2)*(d/2.);##Maximum torque absorbed in N.m\n", - "\n", - "print'%s %.2f %s'%('Maximum torque absorbed is ',TB,' N.m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum torque absorbed is 1412.67 N.m\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg271" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 4 PAGE NO 271\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate The maximum braking torque on the drum\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "a=0.5;##Length of lever in m\n", - "d=0.5;##Diameter of brake drum in m\n", - "q=(5/8.)*(2*3.14);##Angle made in radians\n", - "b=0.1;##Distance between pin and fulcrum in m\n", - "P=2000.;##Effort applied in N\n", - "U=0.25;##Coefficient of friction\n", - "\n", - "T=math.exp(U*q);##Ratios of tension\n", - "T2=((P*a)/b);##Tension in N\n", - "T1=(T*T2);##Tension in N\n", - "TB=((T1-T2)*(d/2.))/1000.;##Maximum braking torque in kNm\n", - "\n", - "print'%s %.2f %s'%('The maximum braking torque on the drum is',TB,' kNm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The maximum braking torque on the drum is 4.17 kNm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg271" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 5 PAGE NO 271\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#caculate the brake is self -locking and tension in the side \n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "q=220.;##Angle of contact in degree\n", - "T=340.;##Torque in Nm\n", - "d=0.32;##Diameter of drum in m\n", - "U=0.3;##Coefficient of friction\n", - "\n", - "Td=(T/(d/2.));##Difference in tensions in N\n", - "Tr=math.exp(U*(q*(3.14/180.)));##Ratio of tensions\n", - "T2=(Td/(Tr-1.));##Tension in N\n", - "T1=(Tr*T2);##Tension in N\n", - "P=((T2*(d/2.))-(T1*0.04))/0.5;##Force applied in N\n", - "b=(T1/T2)*4.;##Value of b in cm when the brake is self-locking\n", - "\n", - "print'%s %.2f %s %.2f %s %.2f %s '%('The value of b is ',b,' cm' 'when the brake is self-locking ' 'Tensions in the sides are ',T1,' N and',T2,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The value of b is 12.65 cmwhen the brake is self-locking Tensions in the sides are 3107.70 N and 982.70 N \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg272" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 6 PAGE NO 272\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate torque required and thickness necessary to limit the tensile stress to 70 and secton of the lever taking stress to 60 mpa\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=0.5;##Drum diamter in m\n", - "U=0.3;##Coefficient of friction\n", - "q=250;##Angle of contact in degree\n", - "P=750;##Force in N\n", - "a=0.1;##Band width in m\n", - "b=0.8;##Distance in m\n", - "ft=(70*10**6);##Tensile stress in Pa\n", - "f=(60*10**6);##Stress in Pa\n", - "b1=0.1;##Distance in m\n", - "\n", - "T=math.exp(U*(q*(3.14/180.)));##Tensions ratio\n", - "T2=(P*b*10.)/(T+1.);##Tension in N\n", - "T1=(T*T2);##Tension in N\n", - "TB=(T1-T2)*(d/2.);##Torque in N.m\n", - "t=(max(T1,T2)/(ft*a))*1000.;##Thickness in mm\n", - "M=(P*b);##bending moment at fulcrum in Nm\n", - "X=(M/((1/6.)*f));##Value of th**2\n", - "##t varies from 10mm to 15 mm. Taking t=15mm,\n", - "h=math.sqrt(X/(0.015))*1000.;##Section of the lever in m\n", - "\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('Torque required is ',TB,' N.m' 'Thickness necessary to limit the tensile stress to 70 MPa is ',t,' mm ''Section of the lever taking stress to 60 MPa is ',h,' mm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Torque required is 861.7 N.mThickness necessary to limit the tensile stress to 70 MPa is 0.7 mm Section of the lever taking stress to 60 MPa is 63.2 mm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg273" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 7 PAGE NO 273\n", - "##TITLE:Brakes and Dynamometers\n", - "#calculate value of x and value of power/bd ratio \n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "P1=30.;##Power in kW\n", - "N=1250.;##Speed in r.p.m\n", - "P=60.;##Applied force in N\n", - "d=0.8;##Drum diameter in m\n", - "q=310.;##Contact angle in degree\n", - "a=0.03;##Length of a in m\n", - "b=0.12;##Length of b in m\n", - "U=0.2;##Coefficient of friction\n", - "B=10.;##Band width in cm\n", - "D=80.;##Diameter in cm\n", - "\n", - "T=(P1*60000.)/(2.*3.14*N);##Torque in N.m\n", - "Td=(T/(d/2.));##Tension difference in N\n", - "Tr=math.exp(U*(q*(3.14/180.)));##Tensions ratio\n", - "T2=(Td/(Tr-1.));##Tension in N\n", - "T1=(Tr*T2);##Tension in N\n", - "x=((T2*b)-(T1*a))/P;##Distance in m;\n", - "X=(P1/(B*D));##Ratio\n", - "\n", - "print'%s %.3f %s %.3f %s'%('Value of x is ',x,' m '' Value of (Power/bD) ratio is ',X,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of x is 0.155 m Value of (Power/bD) ratio is 0.037 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg274" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 8 PAGE NO 274\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate time required to bring the shaft to the rest from its running condition\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "m=80.;##Mass of flywheel in kg\n", - "k=0.5;##Radius of gyration in m\n", - "N=250;##Speed in r.p.m\n", - "d=0.32;##Diamter of the drum in m\n", - "b=0.05;##Distance of pin in m\n", - "q=260.;##Angle of contact in degree\n", - "U=0.23;##Coefficient of friction\n", - "P=20;##Force in N\n", - "a=0.35;##Distance at which force is applied in m\n", - "\n", - "Tr=math.exp(U*q*(3.14/180.));##Tensions ratio\n", - "T2=(P*a)/b;##Tension in N\n", - "T1=(Tr*T2);##Tension in N\n", - "TB=(T1-T2)*(d/2.);##Torque in N.m\n", - "KE=((1/2.)*(m*k**2)*((2.*3.14*N)/60.)**2);##Kinematic energy of the rotating drum in Nm\n", - "N1=(KE/(TB*2.*3.14));##Speed in rpm\n", - "aa=((2*3.14*N)/60.)**2/(4.*3.14*N1);##Angular acceleration in rad/s**2\n", - "t=((2.*3.14*N)/60.)/aa;##Time in seconds\n", - "\n", - "print'%s %.1f %s'%('Time required to bring the shaft to the rest from its running condition is ',t,' seconds')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Time required to bring the shaft to the rest from its running condition is 12.7 seconds\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg275" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 9 PAGE NO 275\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate Minimum force required and Time taken to bring to rest \n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "n=12.;##Number of blocks\n", - "q=15.;##Angle subtended in degree\n", - "P=185.;##Power in kW\n", - "N=300.;##Speed in r.p.m\n", - "U=0.25;##Coefficient of friction\n", - "d=1.25;##Diamter in m\n", - "b1=0.04;##Distance in m\n", - "b2=0.14;##Distance in m\n", - "a=1.;##Diatance in m\n", - "m=2400.;##Mass of rotor in kg\n", - "k=0.5;##Radius of gyration in m\n", - "\n", - "Td=(P*60000.)/(2.*3.14*N*(d/2.));##Tension difference in N\n", - "T=Td*(d/2.);##Torque in Nm\n", - "Tr=((1+(U*math.tan(7.5/57.3)))/(1.-(U*math.tan(7.5/57.3))))**n;##Tension ratio\n", - "To=(Td/(Tr-1.));##Tension in N\n", - "Tn=(Tr*To);##Tension in N\n", - "P=((To*b2)-(Tn*b1))/a;##Force in N\n", - "aa=(T/(m*k**2));##Angular acceleration in rad/s**2\n", - "t=((2*3.14*N)/60.)/aa;##Time in seconds\n", - "\n", - "print'%s %.1f %s %.1f %s'%('Minimum force required is ',P,' N' 'Time taken to bring to rest is ',t,' seconds')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Minimum force required is 406.1 NTime taken to bring to rest is 3.2 seconds\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg275" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 10 ILLUSRTATION 10 PAGE NO 275\n", - "##TITLE:Brakes and Dynamometers\n", - "import math\n", - "#calculate Maximum braking torque and Angular retardation of the drum and Time taken by the system to come to rest \n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "n=12.;## Number of blocks\n", - "q=16.;##Angle subtended in degrees\n", - "d=0.9;##Effective diameter in m\n", - "m=2000.;##Mass in kg\n", - "k=0.5;##Radius of gyration in m\n", - "b1=0.7;##Distance in m\n", - "b2=0.03;##Distance in m\n", - "a=0.1;##Distance in m\n", - "P=180.;##Force in N\n", - "N=360.;##Speed in r.p.m\n", - "U=0.25;##Coefficient of friction\n", - "\n", - "Tr=((1.+(U*math.tan(8/57.3)))/(1.-(U*math.tan(8/57.3))))**n;##Tensions ratio\n", - "T2=(P*b1)/(a-(b2*Tr));##Tension in N\n", - "T1=(Tr*T2);##Tension in N\n", - "TB=(T1-T2)*(d/2.);##Torque in N.m\n", - "aa=(TB/(m*k**2.));##Angular acceleration in rad/s**2\n", - "t=((2.*3.14*N)/60.)/aa;##Time in seconds\n", - "\n", - "print'%s %.2f %s %.2f %s %.2f %s '%('(i) Maximum braking torque is ',TB,'Nm ''(ii) Angular retardation of the drum is ',aa,' rad/s**2''(iii) Time taken by the system to come to rest is ',t,' s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(i) Maximum braking torque is 2481.63 Nm (ii) Angular retardation of the drum is 4.96 rad/s**2(iii) Time taken by the system to come to rest is 7.59 s \n" - ] - } - ], - "prompt_number": 10 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter11.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter11.ipynb deleted file mode 100755 index ec8d5927..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter11.ipynb +++ /dev/null @@ -1,450 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:ebcd9b3d07a8d6768db168aed38e578ce5aca1ce1a2df85108f9e88506949f89" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter11-VIBRATIONS" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg290" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 1 PAGE NO 290\n", - "##TITLE:VIBRATIONS\n", - "import math\n", - "#calculate frequency of longitudinal vibration and transversve vibaration\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "D=.1## DIAMETER OF SHAFT IN m\n", - "L=1.10## LENGTH OF SHAFT IN m\n", - "W=450## WEIGHT ON THE OTHER END OF SHAFT IN NEWTONS\n", - "E=200*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "## =========================================================================================\n", - "A=PI*D**2./4.## AREA OF SHAFT IN mm**2\n", - "I=PI*D**4./64.## MOMENT OF INERTIA \n", - "delta=W*L/(A*E)## STATIC DEFLECTION IN LONGITUDINAL VIBRATION OF SHAFT IN m\n", - "Fn=0.4985/(delta)**.5## FREQUENCY OF LONGITUDINAL VIBRATION IN Hz\n", - "delta1=W*L**3./(3.*E*I)## STATIC DEFLECTION IN TRANSVERSE VIBRATION IN m\n", - "Fn1=0.4985/(delta1)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.2f %s %.2f %s '%('FREQUENCY OF LONGITUDINAL VIBRATION =',Fn,' Hz' 'FREQUENCY OF TRANSVERSE VIBRATION =',Fn1,'Hz')\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF LONGITUDINAL VIBRATION = 888.78 HzFREQUENCY OF TRANSVERSE VIBRATION = 34.99 Hz \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg290" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 2 PAGE NO 290\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.10\n", - "#calculate natural frequency of transverse vibration\n", - "#import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "L=.9## LENGTH OF THE SHAFT IN m\n", - "m=100## MASS OF THE BODY IN Kg\n", - "L2=.3## LENGTH WHERE THE WEIGHT IS ACTING IN m\n", - "L1=L-L2## DISTANCE FROM THE OTHER END\n", - "D=.06## DIAMETER OF SHAFT IN m\n", - "W=9.81*m## WEGHT IN NEWTON\n", - "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "##==========================================================================================\n", - "##CALCULATION\n", - "I=PI*D**4./64.## MOMENT OF INERTIA IN m**4\n", - "delta=W*L1**2*L2**2./(3.*E*I*L)## STATIC DEFLECTION\n", - "Fn=.4985/(delta)**.5## NATURAL FREQUENCY OF TRANSVERSE VIBRATION\n", - "##=========================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('NATURAL FREQUENCY OF TRANSVERSE VIBRATION=',Fn,' Hz')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "NATURAL FREQUENCY OF TRANSVERSE VIBRATION= 51.9 Hz\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg291" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 3 PAGE NO 291 ##TITLE:VIBRATIONS\n", - "##FIGURE 11.11\n", - "import math\n", - "#calculate frequency of longitudnial vibration and frequency of transverse vibration and torisional vibration\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "D=.050## DIAMETER OF SHAFT IN m\n", - "m=450## WEIGHT OF FLY WHEEL IN IN Kg\n", - "K=.5## RADIUS OF GYRATION IN m\n", - "L2=.6## FROM FIGURE IN m\n", - "L1=.9## FROM FIGURE IN m\n", - "L=L1+L2\n", - "E=200.*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "C=84.*10**9## MODUKUS OF RIDITY OF SHAFT MATERIAL IN Pascals\n", - "##=========================================================================================\n", - "A=PI*D**2./4.## AREA OF SHAFT IN mm**2\n", - "I=PI*D**4./64.## \n", - "m1=m*L2/(L1+L2)## MASS OF THE FLYWHEEL CARRIED BY THE LENGTH L1 IN Kg\n", - "DELTA=m1*g*L1/(A*E)## EXTENSION OF LENGTH L1 IN m\n", - "Fn=0.4985/(DELTA)**.5## FREQUENCY OF LONGITUDINAL VIBRATION IN Hz\n", - "DELTA1=(m*g*L1**3*L2**3)/(3*E*I*L**3)## STATIC DEFLECTION IN TRANSVERSE VIBRATION IN m\n", - "Fn1=0.4985/(DELTA1)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", - "J=PI*D**4./32.## POLAR MOMENT OF INERTIA IN m**4\n", - "Q1=C*J/L1## TORSIONAL STIFFNESS OF SHAFT DUE TO L1 IN N-m\n", - "Q2=C*J/L2## TORSIONAL STIFFNESS OF SHAFT DUE TO L2 IN N-m\n", - "Q=Q1+Q2## TORSIONAL STIFFNESS OF SHAFT IN Nm\n", - "Fn2=(Q/(m*K**2))**.5/(2.*PI)## FREQUENCY OF TORSIONAL VIBRATION IN Hz\n", - "##=======================================================================================\n", - "print'%s %.3f %s %.3f %s %.3f %s '%('FREQUENCY OF LONGITUDINAL VIBRATION = ',Fn,' Hz''FREQUENCY OF TRANSVERSE VIBRATION = ',Fn1,' Hz'' FREQUENCY OF TORSIONAL VIBRATION = ',Fn2,' Hz')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF LONGITUDINAL VIBRATION = 248.014 HzFREQUENCY OF TRANSVERSE VIBRATION = 14.916 Hz FREQUENCY OF TORSIONAL VIBRATION = 5.673 Hz \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg294" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 6 PAGE NO 294\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.14\n", - "import math\n", - "#calculate frequency of transverse vibration\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "D=.06## DIAMETER OF SHAFT IN m\n", - "L=3.## LENGTH OF SHAFT IN m\n", - "W1=1500.## WEIGHT ACTING AT C IN N\n", - "W2=2000.## WEIGHT ACTING AT D IN N\n", - "W3=1000.## WEIGHT ACTING AT E IN N\n", - "L1=1.## LENGTH FROM A TO C IN m\n", - "L2=2.## LENGTH FROM A TO D IN m\n", - "L3=2.5## LENGTH FROM A TO E IN m\n", - "I=PI*D**4./64.\n", - "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "##===========================================================================================\n", - "DELTA1=W1*L1**2.*(L-L1)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W1\n", - "DELTA2=W2*L2**2.*(L-L2)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", - "DELTA3=W2*L3**2.*(L-L3)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", - "Fn=.4985/(DELTA1+DELTA2+DELTA3)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", - "##==========================================================================================\n", - "print'%s %.3f %s'%('FREQUENCY OF TRANSVERSE VIBRATION = ',Fn,' Hz')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF TRANSVERSE VIBRATION = 4.080 Hz\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg296" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 10 PAGE NO 296\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.18\n", - "import math\n", - "#calculate FREQUENCY OF TRANSVERSE VIBRATION\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "E=200.*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "D=.03## DIAMETER OF SHAFT IN m\n", - "L=.8## LENGTH OF SHAFT IN m\n", - "r=40000.## DENSITY OF SHAFT MATERIAL IN Kg/m**3\n", - "W=10.## WEIGHT ACTING AT CENTRE IN N\n", - "##===========================================================================================\n", - "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", - "m=PI*D**2./4.*r## MASS PER UNIT LENGTH IN Kg/m\n", - "w=m*g\n", - "DELTA=W*L**3./(48.*E*I)## STATIC DEFLECTION DUE TO W\n", - "DELTA1=5.*w*L**4./(384.*E*I)## STATIC DEFLECTION DUE TO WEIGHT OF SHAFT \n", - "Fn=.4985/(DELTA+DELTA1/1.27)**.5\n", - "##==========================================================================================\n", - "print'%s %.3f %s'%('FREQUENCY OF TRANSVERSE VIBRATION = ',Fn,' Hz')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF TRANSVERSE VIBRATION = 39.426 Hz\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg297" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 11 PAGE NO 297\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.19\n", - "import math\n", - "#evaluvate CRITICAL SPEED OF SHAFT\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "E=210.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "D=.18## DIAMETER OF SHAFT IN m\n", - "L=2.5## LENGTH OF SHAFT IN m\n", - "M1=25.## MASS ACTING AT E IN Kg\n", - "M2=50.## MASS ACTING AT D IN Kg\n", - "M3=20.## MASS ACTING AT C IN Kg\n", - "W1=M1*g\n", - "W2=M2*g\n", - "W3=M3*g\n", - "L1=.6## LENGTH FROM A TO E IN m\n", - "L2=1.5## LENGTH FROM A TO D IN m\n", - "L3=2.## LENGTH FROM A TO C IN m\n", - "w=1962.## SELF WEIGHT OF SHAFT IN N\n", - "##==========================================================================================\n", - "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", - "DELTA1=W1*L1**2.*(L-L1)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W1\n", - "DELTA2=W2*L2**2.*(L-L2)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", - "DELTA3=W3*L3**2.*(L-L3)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W3\n", - "DELTA4=5.*w*L**4./(384.*E*I)## STATIC DEFLECTION DUE TO w\n", - "Fn=.4985/(DELTA1+DELTA2+DELTA3+DELTA4/1.27)**.5\n", - "Nc=Fn*60## CRITICAL SPEED OF SHAFT IN rpm\n", - "##========================================================================================\n", - "print'%s %.3f %s'%('CRITICAL SPEED OF SHAFT = ',Nc,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "CRITICAL SPEED OF SHAFT = 3111.629 rpm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg298" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 12 PAGE NO 298\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.20\n", - "import math\n", - "#calculate FREQUENCY OF FREE TORSIONAL VIBRATION\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "Na=1500.## SPEED OF SHAFT A IN rpm\n", - "Nb=500.## SPEED OF SHAFT B IN rpm\n", - "G=Na/Nb## GERA RATIO\n", - "L1=.18## LENGTH OF SHAFT 1 IN m\n", - "L2=.45## LENGTH OF SHAFT 2 IN m\n", - "D1=.045## DIAMETER OF SHAFT 1 IN m\n", - "D2=.09## DIAMETER OF SHAFT 2 IN m\n", - "C=84.*10**9## MODUKUS OF RIDITY OF SHAFT MATERIAL IN Pascals\n", - "Ib=1400.## MOMENT OF INERTIA OF PUMP IN Kg-m**2\n", - "Ia=400.## MOMENT OF INERTIA OF MOTOR IN Kg-m**2\n", - "\n", - "##======================================================================================\n", - "J=PI*D1**4./32.## POLAR MOMENT OF INERTIA IN m**4\n", - "Ib1=Ib/G**2.## MASS MOMENT OF INERTIA OF EQUIVALENT ROTOR IN m**2\n", - "L3=G**2.*L2*(D1/D2)**4.## ADDITIONAL LENGTH OF THE EQUIVALENT SHAFT\n", - "L=L1+L3## TOTAL LENGTH OF EQUIVALENT SHAFT\n", - "La=L*Ib1/(Ia+Ib1)\n", - "Fn=(C*J/(La*Ia))**.5/(2.*PI)## FREQUENCY OF FREE TORSIONAL VIBRATION IN Hz\n", - "##===================================================================================\n", - "print'%s %.2f %s'%('FREQUENCY OF FREE TORSIONAL VIBRATION = ',Fn,' Hz')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF FREE TORSIONAL VIBRATION = 4.20 Hz\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg300" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 13 PAGE NO 300\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.21\n", - "import math\n", - "#calculate critical speed of shaft and the range of speed \n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "D=.015## DIAMETER OF SHAFT IN m\n", - "L=1.00## LENGTH OF SHAFT IN m\n", - "M=15.## MASS OF SHAFT IN Kg\n", - "W=M*g\n", - "e=.0003## ECCENTRICITY IN m\n", - "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "f=70.*10**6.## PERMISSIBLE STRESS IN N/m**2\n", - "##============================================================================================\n", - "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", - "DELTA=W*L**3./(192.*E*I)## STATIC DEFLECTION IN m\n", - "Fn=.4985/(DELTA)**.5## NATURAL FREQUENCY OF TRANSVERSE VIBRATION\n", - "Nc=Fn*60.## CRITICAL SPEED OF SHAFT IN rpm\n", - "M1=16.*f*I/(D*g*L)\n", - "W1=M1*g## ADDITIONAL LOAD ACTING\n", - "y=W1/W*DELTA## ADDITIONAL DEFLECTION DUE TO W1\n", - "N1=Nc/(1.+e/y)**.5## MIN SPEED IN rpm\n", - "N2=Nc/(1.-e/y)**.5## MAX SPEED IN rpm\n", - "##===========================================================================================\n", - "print'%s %.3f %s %.3f %s %.3f %s '%('CRITICAL SPEED OF SHAFT = ',Nc,' rpm''THE RANGE OF SPEED IS FROM',N1,'rpm TO ',N2,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "CRITICAL SPEED OF SHAFT = 762.330 rpmTHE RANGE OF SPEED IS FROM 709.555 rpm TO 828.955 rpm \n" - ] - } - ], - "prompt_number": 8 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter11_1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter11_1.ipynb deleted file mode 100755 index fc94788e..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter11_1.ipynb +++ /dev/null @@ -1,450 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:34645615139cc7e48e6be9d702d9a64020fce36a78eda34f91d7b4cd597045b1" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter11-Vibrations" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg290" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 1 PAGE NO 290\n", - "##TITLE:VIBRATIONS\n", - "import math\n", - "#calculate frequency of longitudinal vibration and transversve vibaration\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "D=.1## DIAMETER OF SHAFT IN m\n", - "L=1.10## LENGTH OF SHAFT IN m\n", - "W=450## WEIGHT ON THE OTHER END OF SHAFT IN NEWTONS\n", - "E=200*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "## =========================================================================================\n", - "A=PI*D**2./4.## AREA OF SHAFT IN mm**2\n", - "I=PI*D**4./64.## MOMENT OF INERTIA \n", - "delta=W*L/(A*E)## STATIC DEFLECTION IN LONGITUDINAL VIBRATION OF SHAFT IN m\n", - "Fn=0.4985/(delta)**.5## FREQUENCY OF LONGITUDINAL VIBRATION IN Hz\n", - "delta1=W*L**3./(3.*E*I)## STATIC DEFLECTION IN TRANSVERSE VIBRATION IN m\n", - "Fn1=0.4985/(delta1)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.2f %s %.2f %s '%('FREQUENCY OF LONGITUDINAL VIBRATION =',Fn,' Hz' 'FREQUENCY OF TRANSVERSE VIBRATION =',Fn1,'Hz')\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF LONGITUDINAL VIBRATION = 888.78 HzFREQUENCY OF TRANSVERSE VIBRATION = 34.99 Hz \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg290" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 2 PAGE NO 290\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.10\n", - "#calculate natural frequency of transverse vibration\n", - "#import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "L=.9## LENGTH OF THE SHAFT IN m\n", - "m=100## MASS OF THE BODY IN Kg\n", - "L2=.3## LENGTH WHERE THE WEIGHT IS ACTING IN m\n", - "L1=L-L2## DISTANCE FROM THE OTHER END\n", - "D=.06## DIAMETER OF SHAFT IN m\n", - "W=9.81*m## WEGHT IN NEWTON\n", - "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "##==========================================================================================\n", - "##CALCULATION\n", - "I=PI*D**4./64.## MOMENT OF INERTIA IN m**4\n", - "delta=W*L1**2*L2**2./(3.*E*I*L)## STATIC DEFLECTION\n", - "Fn=.4985/(delta)**.5## NATURAL FREQUENCY OF TRANSVERSE VIBRATION\n", - "##=========================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('NATURAL FREQUENCY OF TRANSVERSE VIBRATION=',Fn,' Hz')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "NATURAL FREQUENCY OF TRANSVERSE VIBRATION= 51.9 Hz\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg291" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 3 PAGE NO 291 ##TITLE:VIBRATIONS\n", - "##FIGURE 11.11\n", - "import math\n", - "#calculate frequency of longitudnial vibration and frequency of transverse vibration and torisional vibration\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "D=.050## DIAMETER OF SHAFT IN m\n", - "m=450## WEIGHT OF FLY WHEEL IN IN Kg\n", - "K=.5## RADIUS OF GYRATION IN m\n", - "L2=.6## FROM FIGURE IN m\n", - "L1=.9## FROM FIGURE IN m\n", - "L=L1+L2\n", - "E=200.*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "C=84.*10**9## MODUKUS OF RIDITY OF SHAFT MATERIAL IN Pascals\n", - "##=========================================================================================\n", - "A=PI*D**2./4.## AREA OF SHAFT IN mm**2\n", - "I=PI*D**4./64.## \n", - "m1=m*L2/(L1+L2)## MASS OF THE FLYWHEEL CARRIED BY THE LENGTH L1 IN Kg\n", - "DELTA=m1*g*L1/(A*E)## EXTENSION OF LENGTH L1 IN m\n", - "Fn=0.4985/(DELTA)**.5## FREQUENCY OF LONGITUDINAL VIBRATION IN Hz\n", - "DELTA1=(m*g*L1**3*L2**3)/(3*E*I*L**3)## STATIC DEFLECTION IN TRANSVERSE VIBRATION IN m\n", - "Fn1=0.4985/(DELTA1)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", - "J=PI*D**4./32.## POLAR MOMENT OF INERTIA IN m**4\n", - "Q1=C*J/L1## TORSIONAL STIFFNESS OF SHAFT DUE TO L1 IN N-m\n", - "Q2=C*J/L2## TORSIONAL STIFFNESS OF SHAFT DUE TO L2 IN N-m\n", - "Q=Q1+Q2## TORSIONAL STIFFNESS OF SHAFT IN Nm\n", - "Fn2=(Q/(m*K**2))**.5/(2.*PI)## FREQUENCY OF TORSIONAL VIBRATION IN Hz\n", - "##=======================================================================================\n", - "print'%s %.3f %s %.3f %s %.3f %s '%('FREQUENCY OF LONGITUDINAL VIBRATION = ',Fn,' Hz''FREQUENCY OF TRANSVERSE VIBRATION = ',Fn1,' Hz'' FREQUENCY OF TORSIONAL VIBRATION = ',Fn2,' Hz')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF LONGITUDINAL VIBRATION = 248.014 HzFREQUENCY OF TRANSVERSE VIBRATION = 14.916 Hz FREQUENCY OF TORSIONAL VIBRATION = 5.673 Hz \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg294" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 6 PAGE NO 294\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.14\n", - "import math\n", - "#calculate frequency of transverse vibration\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "D=.06## DIAMETER OF SHAFT IN m\n", - "L=3.## LENGTH OF SHAFT IN m\n", - "W1=1500.## WEIGHT ACTING AT C IN N\n", - "W2=2000.## WEIGHT ACTING AT D IN N\n", - "W3=1000.## WEIGHT ACTING AT E IN N\n", - "L1=1.## LENGTH FROM A TO C IN m\n", - "L2=2.## LENGTH FROM A TO D IN m\n", - "L3=2.5## LENGTH FROM A TO E IN m\n", - "I=PI*D**4./64.\n", - "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "##===========================================================================================\n", - "DELTA1=W1*L1**2.*(L-L1)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W1\n", - "DELTA2=W2*L2**2.*(L-L2)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", - "DELTA3=W2*L3**2.*(L-L3)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", - "Fn=.4985/(DELTA1+DELTA2+DELTA3)**.5## FREQUENCY OF TRANSVERSE VIBRATION IN Hz\n", - "##==========================================================================================\n", - "print'%s %.3f %s'%('FREQUENCY OF TRANSVERSE VIBRATION = ',Fn,' Hz')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF TRANSVERSE VIBRATION = 4.080 Hz\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg296" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 10 PAGE NO 296\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.18\n", - "import math\n", - "#calculate FREQUENCY OF TRANSVERSE VIBRATION\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "E=200.*10**9## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "D=.03## DIAMETER OF SHAFT IN m\n", - "L=.8## LENGTH OF SHAFT IN m\n", - "r=40000.## DENSITY OF SHAFT MATERIAL IN Kg/m**3\n", - "W=10.## WEIGHT ACTING AT CENTRE IN N\n", - "##===========================================================================================\n", - "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", - "m=PI*D**2./4.*r## MASS PER UNIT LENGTH IN Kg/m\n", - "w=m*g\n", - "DELTA=W*L**3./(48.*E*I)## STATIC DEFLECTION DUE TO W\n", - "DELTA1=5.*w*L**4./(384.*E*I)## STATIC DEFLECTION DUE TO WEIGHT OF SHAFT \n", - "Fn=.4985/(DELTA+DELTA1/1.27)**.5\n", - "##==========================================================================================\n", - "print'%s %.3f %s'%('FREQUENCY OF TRANSVERSE VIBRATION = ',Fn,' Hz')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF TRANSVERSE VIBRATION = 39.426 Hz\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg297" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 11 PAGE NO 297\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.19\n", - "import math\n", - "#evaluvate CRITICAL SPEED OF SHAFT\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "E=210.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "D=.18## DIAMETER OF SHAFT IN m\n", - "L=2.5## LENGTH OF SHAFT IN m\n", - "M1=25.## MASS ACTING AT E IN Kg\n", - "M2=50.## MASS ACTING AT D IN Kg\n", - "M3=20.## MASS ACTING AT C IN Kg\n", - "W1=M1*g\n", - "W2=M2*g\n", - "W3=M3*g\n", - "L1=.6## LENGTH FROM A TO E IN m\n", - "L2=1.5## LENGTH FROM A TO D IN m\n", - "L3=2.## LENGTH FROM A TO C IN m\n", - "w=1962.## SELF WEIGHT OF SHAFT IN N\n", - "##==========================================================================================\n", - "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", - "DELTA1=W1*L1**2.*(L-L1)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W1\n", - "DELTA2=W2*L2**2.*(L-L2)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W2\n", - "DELTA3=W3*L3**2.*(L-L3)**2./(3.*E*I*L)## STATIC DEFLECTION DUE TO W3\n", - "DELTA4=5.*w*L**4./(384.*E*I)## STATIC DEFLECTION DUE TO w\n", - "Fn=.4985/(DELTA1+DELTA2+DELTA3+DELTA4/1.27)**.5\n", - "Nc=Fn*60## CRITICAL SPEED OF SHAFT IN rpm\n", - "##========================================================================================\n", - "print'%s %.3f %s'%('CRITICAL SPEED OF SHAFT = ',Nc,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "CRITICAL SPEED OF SHAFT = 3111.629 rpm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg298" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 12 PAGE NO 298\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.20\n", - "import math\n", - "#calculate FREQUENCY OF FREE TORSIONAL VIBRATION\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "Na=1500.## SPEED OF SHAFT A IN rpm\n", - "Nb=500.## SPEED OF SHAFT B IN rpm\n", - "G=Na/Nb## GERA RATIO\n", - "L1=.18## LENGTH OF SHAFT 1 IN m\n", - "L2=.45## LENGTH OF SHAFT 2 IN m\n", - "D1=.045## DIAMETER OF SHAFT 1 IN m\n", - "D2=.09## DIAMETER OF SHAFT 2 IN m\n", - "C=84.*10**9## MODUKUS OF RIDITY OF SHAFT MATERIAL IN Pascals\n", - "Ib=1400.## MOMENT OF INERTIA OF PUMP IN Kg-m**2\n", - "Ia=400.## MOMENT OF INERTIA OF MOTOR IN Kg-m**2\n", - "\n", - "##======================================================================================\n", - "J=PI*D1**4./32.## POLAR MOMENT OF INERTIA IN m**4\n", - "Ib1=Ib/G**2.## MASS MOMENT OF INERTIA OF EQUIVALENT ROTOR IN m**2\n", - "L3=G**2.*L2*(D1/D2)**4.## ADDITIONAL LENGTH OF THE EQUIVALENT SHAFT\n", - "L=L1+L3## TOTAL LENGTH OF EQUIVALENT SHAFT\n", - "La=L*Ib1/(Ia+Ib1)\n", - "Fn=(C*J/(La*Ia))**.5/(2.*PI)## FREQUENCY OF FREE TORSIONAL VIBRATION IN Hz\n", - "##===================================================================================\n", - "print'%s %.2f %s'%('FREQUENCY OF FREE TORSIONAL VIBRATION = ',Fn,' Hz')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FREQUENCY OF FREE TORSIONAL VIBRATION = 4.20 Hz\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg300" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 11 ILLUSRTATION 13 PAGE NO 300\n", - "##TITLE:VIBRATIONS\n", - "##FIGURE 11.21\n", - "import math\n", - "#calculate critical speed of shaft and the range of speed \n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N /m**2\n", - "D=.015## DIAMETER OF SHAFT IN m\n", - "L=1.00## LENGTH OF SHAFT IN m\n", - "M=15.## MASS OF SHAFT IN Kg\n", - "W=M*g\n", - "e=.0003## ECCENTRICITY IN m\n", - "E=200.*10**9.## YOUNGS MODUKUS OF SHAFT MATERIAL IN Pascals\n", - "f=70.*10**6.## PERMISSIBLE STRESS IN N/m**2\n", - "##============================================================================================\n", - "I=PI*D**4./64.## MOMENT OF INERTIA OF SHAFT IN m**4\n", - "DELTA=W*L**3./(192.*E*I)## STATIC DEFLECTION IN m\n", - "Fn=.4985/(DELTA)**.5## NATURAL FREQUENCY OF TRANSVERSE VIBRATION\n", - "Nc=Fn*60.## CRITICAL SPEED OF SHAFT IN rpm\n", - "M1=16.*f*I/(D*g*L)\n", - "W1=M1*g## ADDITIONAL LOAD ACTING\n", - "y=W1/W*DELTA## ADDITIONAL DEFLECTION DUE TO W1\n", - "N1=Nc/(1.+e/y)**.5## MIN SPEED IN rpm\n", - "N2=Nc/(1.-e/y)**.5## MAX SPEED IN rpm\n", - "##===========================================================================================\n", - "print'%s %.3f %s %.3f %s %.3f %s '%('CRITICAL SPEED OF SHAFT = ',Nc,' rpm''THE RANGE OF SPEED IS FROM',N1,'rpm TO ',N2,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "CRITICAL SPEED OF SHAFT = 762.330 rpmTHE RANGE OF SPEED IS FROM 709.555 rpm TO 828.955 rpm \n" - ] - } - ], - "prompt_number": 8 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter12.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter12.ipynb deleted file mode 100755 index 6706c05c..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter12.ipynb +++ /dev/null @@ -1,380 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:2fbbfd8e1fae5de695230b7f28341e3abac22cade207682955694bcaba6d0716" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter12-Balancing of reciprocating of masses" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 1 PAGE NO 310\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "#calculate the magnitude of balance mass required and residual balance error\n", - "pi=3.141\n", - "N=250.## speed of the reciprocating engine in rpm\n", - "s=18.## length of stroke in mm\n", - "mR=120.## mass of reciprocating parts in kg\n", - "m=70.## mass of revolving parts in kg\n", - "r=.09## radius of revolution of revolving parts in m\n", - "b=.15## distance at which balancing mass located in m\n", - "c=2./3.## portion of reciprocating mass balanced \n", - "teeta=30.## crank angle from inner dead centre in degrees\n", - "##===============================\n", - "B=r*(m+c*mR)/b## balance mass required in kg\n", - "w=2.*math.pi*N/60.## angular speed in rad/s\n", - "F=mR*w**2.*r*(((1.-c)**2.*(math.cos(teeta/57.3))**2.)+(c**2.*(math.sin(teeta/57.3))**2.))**.5## residual unbalanced forces in N\n", - "print'%s %.1f %s %.3f %s'%('Magnitude of balance mass required= ',B,'kg' and 'Residual unbalanced forces= ',F,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Magnitude of balance mass required= 90.0 Residual unbalanced forces= 3263.971 N\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 2 PAGE NO 310\n", - "##TITLE:Balancing of reciprocating of masses\n", - "#calculate speed and swaying couples \n", - "pi=3.141\n", - "g=10.## acceleration due to gravity approximately in m/s**2\n", - "mR=240.## mass of reciprocating parts per cylinder in kg\n", - "m=300.## mass of rotating parts per cylinder in kg\n", - "a=1.8##distance between cylinder centres in m\n", - "c=.67## portion of reciprocating mass to be balanced\n", - "b=.60## radius of balance masses in m\n", - "r=24.## crank radius in cm\n", - "R=.8##radius of thread of wheels in m\n", - "M=40.\n", - "##=======================================\n", - "Ma=m+c*mR## total mass to be balanced in kg\n", - "mD=211.9## mass of wheel D from figure in kg\n", - "mC=211.9##..... mass of wheel C from figure in kg\n", - "theta=171.## angular position of balancing mass C in degrees\n", - "Br=c*mR/Ma*mC## balancing mass for reciprocating parts in kg\n", - "w=(M*g**3./Br/b)**.5## angular speed in rad/s\n", - "v=w*R*3600./1000.## speed in km/h\n", - "S=a*(1.-c)*mR*w**2*r/2.**.5/100./1000.## swaying couple in kNm\n", - "print'%s %.3f %s %.3f %s'%('speed=',v,' kmph'and ' swaying couple=',S,' kNm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed= 86.476 swaying couple= 21.812 kNm\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg313" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 3 PAGE NO 313\n", - "##TITLE:Balancing of reciprocating of masses\n", - "#calculate hammer blow and tractive effort and swaying couple\n", - "import math\n", - "pi=3.141\n", - "g=10.## acceleration due to gravity approximately in m/s**2\n", - "a=.70##distance between cylinder centres in m\n", - "r=60.## crank radius in cm\n", - "m=130.##mass of rotating parts per cylinder in kg\n", - "mR=210.## mass of reciprocating parts per cylinder in kg\n", - "c=.67## portion of reciprocating mass to be balanced\n", - "N=300.##e2engine speed in rpm\n", - "b=.64## radius of balance masses in m\n", - "##============================\n", - "Ma=m+c*mR## total mass to be balanced in kg\n", - "mA=100.44## mass of wheel A from figure in kg\n", - "Br=c*mR/Ma*mA## balancing mass for reciprocating parts in kg\n", - "H=Br*(2.*math.pi*N/60.)**2*b## hammer blow in N\n", - "w=(2.*math.pi*N/60.)## angular speed\n", - "T=2**.5*(1.-c)*mR*w**2.*r/2./100.##tractive effort in N\n", - "S=a*(1.-c)*mR*w**2.*r/2./2.**.5/100.## swaying couple in Nm\n", - "\n", - "print'%s %.3f %s %.3f %s %.3f %s'%('Hammer blow=',H,' in N' 'tractive effort= ',T,' in N' 'swaying couple= ',S,' in Nm')\n", - "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hammer blow= 32975.566 in Ntractive effort= 29018.117 in Nswaying couple= 10156.341 in Nm\n", - "The answer is a bit different due to rounding off error in textbook\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg314" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 4 PAGE NO 314\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "#calculate maximum unbalanced primary couples\n", - "pi=3.141\n", - "mR=900.## mass of reciprocating parts in kg\n", - "N=90.## speed of the engine in rpm\n", - "r=.45##crank radius in m\n", - "cP=.9*mR*(2.*math.pi*N/60.)**2.*r*2.**.5/1000.## maximum unbalanced primary couple in kNm\n", - "print'%s %.3f %s'%('maximum unbalanced primary couple=',cP,' k Nm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "maximum unbalanced primary couple= 45.788 k Nm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg315" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 5 PAGE NO 315\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "#calculate maximum unbalanced secondary force and with reasons\n", - "pi=3.141\n", - "mRA=160.## mass of reciprocating cylinder A in kg\n", - "mRD=160.## mass of reciprocating cylinder D in kg\n", - "r=.05## stroke lenght in m\n", - "l=.2## connecting rod length in m\n", - "N=450.## engine speed in rpm\n", - "##===========================\n", - "theta2=78.69## crank angle between A & B cylinders in degrees\n", - "mRB=576.88## mass of cylinder B in kg\n", - "n=l/r## ratio between connecting rod length and stroke length\n", - "w=2.*math.pi*N/60.## angular speed in rad/s\n", - "F=mRB*2.*w**2.*r*math.cos((2.*theta2)/57.3)/n\n", - "print'%s %.3f %s'%('Maximum unbalanced secondary force=',F,' N in anticlockwise direction thats why - sign')\n", - "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum unbalanced secondary force= -29560.284 N in anticlockwise direction thats why - sign\n", - "The answer is a bit different due to rounding off error in textbook\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg316" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 6 PAGE NO 316\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "pi=3.141\n", - "rA=.25## stroke length of A piston in m\n", - "rB=.25## stroke length of B piston in m\n", - "rC=.25## stroke length C piston in m\n", - "N=300.## engine speed in rpm\n", - "mRL=280.## mass of reciprocating parts in inside cylinder kg\n", - "mRO=240.## mass of reciprocating parts in outside cylinder kg\n", - "c=.5## portion ofreciprocating masses to be balanced \n", - "b1=.5## radius at which masses to be balanced in m\n", - "##======================\n", - "mA=c*mRO## mass of the reciprocating parts to be balanced foreach outside cylinder in kg\n", - "mB=c*mRL## mass of the reciprocating parts to be balanced foreach inside cylinder in kg\n", - "B1=79.4## balancing mass for reciprocating parts in kg\n", - "w=2.*math.pi*N/60.## angular speed in rad/s\n", - "H=B1*w**2*b1## hammer blow per wheel in N\n", - "print'%s %.1f %s'%('Hammer blow per wheel= ',H,' N')\n", - "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hammer blow per wheel= 39182.3 N\n", - "The answer is a bit different due to rounding off error in textbook\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg318" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 7 PAGE NO 318\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "\n", - "pi=3.141\n", - "mR=300.## reciprocating mass per cylinder in kg\n", - "r=.3## crank radius in m\n", - "D=1.7## driving wheel diameter in m\n", - "a=.7## distance between cylinder centre lines in m\n", - "H=40.## hammer blow in kN\n", - "v=90.## speed in kmph\n", - "##=======================================\n", - "R=D/2.## radius of driving wheel in m\n", - "w=90.*1000./3600./R## angular velocity in rad/s\n", - "##Br*b=69.625*c by mearument from diagram\n", - "c=H*1000./(w**2.)/69.625## portion of reciprocating mass to be balanced\n", - "T=2.**.5*(1-c)*mR*w**2.*r## variation in tractive effort in N\n", - "M=a*(1.-c)*mR*w**2.*r/2.**.5## maximum swaying couple in N-m\n", - "print'%s %.3f %s %.3f %s %.3f %s'%('portion of reciprocating mass to be balanced=',c,' ''variation in tractive effort=',T,' N'' maximum swaying couple=',M,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "portion of reciprocating mass to be balanced= 0.664 variation in tractive effort= 36980.420 N maximum swaying couple= 12943.147 N-m\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg320" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 8 PAGE NO 320\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "pi=3.141\n", - "N=1800.## speed of the engine in rpm\n", - "r=6.## length of crank in cm\n", - "l=24.## length of connecting rod in cm\n", - "m=1.5## mass of reciprocating cylinder in kg\n", - "##====================\n", - "w=2.*math.pi*N/60.## angular speed in rad/s\n", - "UPC=.019*w**2.## unbalanced primary couple in N-m\n", - "n=l/r## ratio of length of crank to the connecting rod \n", - "USC=.054*w**2./n## unbalanced secondary couple in N-m\n", - "print'%s %.f %s %.3f %s '%('unbalanced primary couple=',UPC,'N-m' 'unbalanced secondary couple=',USC,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "unbalanced primary couple= 675 N-munbalanced secondary couple= 479.663 N-m \n" - ] - } - ], - "prompt_number": 8 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter12_1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter12_1.ipynb deleted file mode 100755 index 2a5c880d..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter12_1.ipynb +++ /dev/null @@ -1,380 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:1f988043aec4c9b9b6e84d06631278db6c5ded6c7354777cfc3020424bf624d7" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter12-Balancing of reciprocating of masses" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 1 PAGE NO 310\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "#calculate the magnitude of balance mass required and residual balance error\n", - "pi=3.141\n", - "N=250.## speed of the reciprocating engine in rpm\n", - "s=18.## length of stroke in mm\n", - "mR=120.## mass of reciprocating parts in kg\n", - "m=70.## mass of revolving parts in kg\n", - "r=.09## radius of revolution of revolving parts in m\n", - "b=.15## distance at which balancing mass located in m\n", - "c=2./3.## portion of reciprocating mass balanced \n", - "teeta=30.## crank angle from inner dead centre in degrees\n", - "##===============================\n", - "B=r*(m+c*mR)/b## balance mass required in kg\n", - "w=2.*math.pi*N/60.## angular speed in rad/s\n", - "F=mR*w**2.*r*(((1.-c)**2.*(math.cos(teeta/57.3))**2.)+(c**2.*(math.sin(teeta/57.3))**2.))**.5## residual unbalanced forces in N\n", - "print'%s %.1f %s %.3f %s'%('Magnitude of balance mass required= ',B,'kg' and 'Residual unbalanced forces= ',F,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Magnitude of balance mass required= 90.0 Residual unbalanced forces= 3263.971 N\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg310" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 2 PAGE NO 310\n", - "##TITLE:Balancing of reciprocating of masses\n", - "#calculate speed and swaying couples \n", - "pi=3.141\n", - "g=10.## acceleration due to gravity approximately in m/s**2\n", - "mR=240.## mass of reciprocating parts per cylinder in kg\n", - "m=300.## mass of rotating parts per cylinder in kg\n", - "a=1.8##distance between cylinder centres in m\n", - "c=.67## portion of reciprocating mass to be balanced\n", - "b=.60## radius of balance masses in m\n", - "r=24.## crank radius in cm\n", - "R=.8##radius of thread of wheels in m\n", - "M=40.\n", - "##=======================================\n", - "Ma=m+c*mR## total mass to be balanced in kg\n", - "mD=211.9## mass of wheel D from figure in kg\n", - "mC=211.9##..... mass of wheel C from figure in kg\n", - "theta=171.## angular position of balancing mass C in degrees\n", - "Br=c*mR/Ma*mC## balancing mass for reciprocating parts in kg\n", - "w=(M*g**3./Br/b)**.5## angular speed in rad/s\n", - "v=w*R*3600./1000.## speed in km/h\n", - "S=a*(1.-c)*mR*w**2*r/2.**.5/100./1000.## swaying couple in kNm\n", - "print'%s %.3f %s %.3f %s'%('speed=',v,' kmph'and ' swaying couple=',S,' kNm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed= 86.476 swaying couple= 21.812 kNm\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg313" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 3 PAGE NO 313\n", - "##TITLE:Balancing of reciprocating of masses\n", - "#calculate hammer blow and tractive effort and swaying couple\n", - "import math\n", - "pi=3.141\n", - "g=10.## acceleration due to gravity approximately in m/s**2\n", - "a=.70##distance between cylinder centres in m\n", - "r=60.## crank radius in cm\n", - "m=130.##mass of rotating parts per cylinder in kg\n", - "mR=210.## mass of reciprocating parts per cylinder in kg\n", - "c=.67## portion of reciprocating mass to be balanced\n", - "N=300.##e2engine speed in rpm\n", - "b=.64## radius of balance masses in m\n", - "##============================\n", - "Ma=m+c*mR## total mass to be balanced in kg\n", - "mA=100.44## mass of wheel A from figure in kg\n", - "Br=c*mR/Ma*mA## balancing mass for reciprocating parts in kg\n", - "H=Br*(2.*math.pi*N/60.)**2*b## hammer blow in N\n", - "w=(2.*math.pi*N/60.)## angular speed\n", - "T=2**.5*(1.-c)*mR*w**2.*r/2./100.##tractive effort in N\n", - "S=a*(1.-c)*mR*w**2.*r/2./2.**.5/100.## swaying couple in Nm\n", - "\n", - "print'%s %.3f %s %.3f %s %.3f %s'%('Hammer blow=',H,' in N' 'tractive effort= ',T,' in N' 'swaying couple= ',S,' in Nm')\n", - "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hammer blow= 32975.566 in Ntractive effort= 29018.117 in Nswaying couple= 10156.341 in Nm\n", - "The answer is a bit different due to rounding off error in textbook\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg314" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 4 PAGE NO 314\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "#calculate maximum unbalanced primary couples\n", - "pi=3.141\n", - "mR=900.## mass of reciprocating parts in kg\n", - "N=90.## speed of the engine in rpm\n", - "r=.45##crank radius in m\n", - "cP=.9*mR*(2.*math.pi*N/60.)**2.*r*2.**.5/1000.## maximum unbalanced primary couple in kNm\n", - "print'%s %.3f %s'%('maximum unbalanced primary couple=',cP,' k Nm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "maximum unbalanced primary couple= 45.788 k Nm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg315" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 5 PAGE NO 315\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "#calculate maximum unbalanced secondary force and with reasons\n", - "pi=3.141\n", - "mRA=160.## mass of reciprocating cylinder A in kg\n", - "mRD=160.## mass of reciprocating cylinder D in kg\n", - "r=.05## stroke lenght in m\n", - "l=.2## connecting rod length in m\n", - "N=450.## engine speed in rpm\n", - "##===========================\n", - "theta2=78.69## crank angle between A & B cylinders in degrees\n", - "mRB=576.88## mass of cylinder B in kg\n", - "n=l/r## ratio between connecting rod length and stroke length\n", - "w=2.*math.pi*N/60.## angular speed in rad/s\n", - "F=mRB*2.*w**2.*r*math.cos((2.*theta2)/57.3)/n\n", - "print'%s %.3f %s'%('Maximum unbalanced secondary force=',F,' N in anticlockwise direction thats why - sign')\n", - "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum unbalanced secondary force= -29560.284 N in anticlockwise direction thats why - sign\n", - "The answer is a bit different due to rounding off error in textbook\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg316" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 6 PAGE NO 316\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "pi=3.141\n", - "rA=.25## stroke length of A piston in m\n", - "rB=.25## stroke length of B piston in m\n", - "rC=.25## stroke length C piston in m\n", - "N=300.## engine speed in rpm\n", - "mRL=280.## mass of reciprocating parts in inside cylinder kg\n", - "mRO=240.## mass of reciprocating parts in outside cylinder kg\n", - "c=.5## portion ofreciprocating masses to be balanced \n", - "b1=.5## radius at which masses to be balanced in m\n", - "##======================\n", - "mA=c*mRO## mass of the reciprocating parts to be balanced foreach outside cylinder in kg\n", - "mB=c*mRL## mass of the reciprocating parts to be balanced foreach inside cylinder in kg\n", - "B1=79.4## balancing mass for reciprocating parts in kg\n", - "w=2.*math.pi*N/60.## angular speed in rad/s\n", - "H=B1*w**2*b1## hammer blow per wheel in N\n", - "print'%s %.1f %s'%('Hammer blow per wheel= ',H,' N')\n", - "print '%s'%(\"The answer is a bit different due to rounding off error in textbook\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hammer blow per wheel= 39182.3 N\n", - "The answer is a bit different due to rounding off error in textbook\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg318" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 7 PAGE NO 318\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "\n", - "pi=3.141\n", - "mR=300.## reciprocating mass per cylinder in kg\n", - "r=.3## crank radius in m\n", - "D=1.7## driving wheel diameter in m\n", - "a=.7## distance between cylinder centre lines in m\n", - "H=40.## hammer blow in kN\n", - "v=90.## speed in kmph\n", - "##=======================================\n", - "R=D/2.## radius of driving wheel in m\n", - "w=90.*1000./3600./R## angular velocity in rad/s\n", - "##Br*b=69.625*c by mearument from diagram\n", - "c=H*1000./(w**2.)/69.625## portion of reciprocating mass to be balanced\n", - "T=2.**.5*(1-c)*mR*w**2.*r## variation in tractive effort in N\n", - "M=a*(1.-c)*mR*w**2.*r/2.**.5## maximum swaying couple in N-m\n", - "print'%s %.3f %s %.3f %s %.3f %s'%('portion of reciprocating mass to be balanced=',c,' ''variation in tractive effort=',T,' N'' maximum swaying couple=',M,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "portion of reciprocating mass to be balanced= 0.664 variation in tractive effort= 36980.420 N maximum swaying couple= 12943.147 N-m\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg320" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 12 ILLUSRTATION 8 PAGE NO 320\n", - "##TITLE:Balancing of reciprocating of masses\n", - "import math\n", - "pi=3.141\n", - "N=1800.## speed of the engine in rpm\n", - "r=6.## length of crank in cm\n", - "l=24.## length of connecting rod in cm\n", - "m=1.5## mass of reciprocating cylinder in kg\n", - "##====================\n", - "w=2.*math.pi*N/60.## angular speed in rad/s\n", - "UPC=.019*w**2.## unbalanced primary couple in N-m\n", - "n=l/r## ratio of length of crank to the connecting rod \n", - "USC=.054*w**2./n## unbalanced secondary couple in N-m\n", - "print'%s %.f %s %.3f %s '%('unbalanced primary couple=',UPC,'N-m' 'unbalanced secondary couple=',USC,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "unbalanced primary couple= 675 N-munbalanced secondary couple= 479.663 N-m \n" - ] - } - ], - "prompt_number": 8 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter1_1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter1_1.ipynb deleted file mode 100755 index b5702b36..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter1_1.ipynb +++ /dev/null @@ -1,663 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:42c46a13a1122c47945ac8a4d546584dee7d6901a84a063f9d2cb3b7f703c59b" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter1-Basic kinematics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 1 PAGE NO 15\n", - "#calculate inclination of slotted bar with vertical \n", - "##TITLE:Basic kinematics\n", - "##Figure 1.14\n", - "import math\n", - "pi=3.141\n", - "AO=200.## distance between fixed centres in mm\n", - "OB1=100.## length of driving crank in mm\n", - "AP=400.## length of slotter bar in mm\n", - "##====================================\n", - "OAB1=math.asin(OB1/AO)*57.3## inclination of slotted bar with vertical in degrees\n", - "beeta=(90-OAB1)*2.## angle through which crank turns inreturn stroke in degrees\n", - "A=(360.-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", - "L=2.*AP*math.sin(90.-beeta/2.)/57.3## length of the stroke in mm\n", - "print'%s %.2f %s %.3f %s'%('Inclination of slotted bar with vertical= ',OAB1,' degrees' 'Length of the stroke=',L,' mm')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Inclination of slotted bar with vertical= 30.00 degreesLength of the stroke= -13.790 mm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 2 PAGE NO 16\n", - "#calculate ratio of time taken on the cutting to the return\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.15\n", - "import math\n", - "OA=300.## distance between the fixed centres in mm\n", - "OB=150.## length of driving crank in mm\n", - "##================================\n", - "OAB=math.asin(OB/OA)## inclination of slotted bar with vertical in degrees\n", - "beeta=(90/57.3-OAB)*2.## angle through which crank turns inreturn stroke in degrees\n", - "A=(360/57.3-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", - "print'%s %.1f %s'%('Ratio of time taken on the cutting to the return stroke= ',A,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Ratio of time taken on the cutting to the return stroke= 2.0 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 3 PAGE NO 16\n", - "#calculate ratio of time taken on the cutting to the return stroke \n", - "##TITLE:Basic kinematics\n", - "##Figure 1.16\n", - "import math\n", - "OB=54.6/57.3## distance between the fixed centres in mm\n", - "OA=85./57.3## length of driving crank in mm\n", - "OA2=OA\n", - "CA=160.## length of slotted lever in mm\n", - "CD=144.## length of connectin rod in mm\n", - "##================================\n", - "beeta=2.*(math.cos(OB/OA2))## angle through which crank turns inreturn stroke in degrees\n", - "A=(360/57.3-beeta)/beeta## ratio of time of cutting stroke to the time of return stroke \n", - "print'%s %.1f %s'%('Ratio of time taken on the cutting to the return stroke= ',A,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Ratio of time taken on the cutting to the return stroke= 2.9 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg 17" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 4 PAGE NO 17\n", - "#calculate velocity position and Angular velocity connection\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.18,1.19\n", - "import math\n", - "pi=3.141\n", - "Nao=180.## speed of the crank in rpm\n", - "wAO=2.*pi*Nao/60.## angular speed of the crank in rad/s\n", - "AO=.5## crank length in m\n", - "AE=.5\n", - "Vao=wAO*AO## velocity of A in m/s\n", - "##================================\n", - "Vb1=8.15## velocity of piston B in m/s by measurment from figure 1.19\n", - "Vba=6.8## velocity of B with respect to A in m/s\n", - "AB=2## length of connecting rod in m\n", - "wBA=Vba/AB## angular velocity of the connecting rod BA in rad/s\n", - "ae=AE*Vba/AB## velocity of point e on the connecting rod\n", - "oe=8.5## by measurement velocity of point E\n", - "Do=.05## diameter of crank shaft in m\n", - "Da=.06## diameter of crank pin in m\n", - "Db=.03## diameter of cross head pin B m\n", - "V1=wAO*Do/2.## velocity of rubbing at the pin of the crankshaft in m/s\n", - "V2=wBA*Da/2.## velocity of rubbing at the pin of the crank in m/s\n", - "Vb=(wAO+wBA)*Db/2.## velocity of rubbing at the pin of cross head in m/s\n", - "ag=5.1## by measurement\n", - "AG=AB*ag/Vba## position and linear velocity of point G on the connecting rod in m\n", - "##===============================\n", - "print'%s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s %.3f %s'%('Velocity of piston B=',Vb1,' m/s''Angular velocity of connecting rod= ',wBA,' rad/s''velocity of point E=',oe,' m/s'' velocity of rubbing at the pin of the crankshaft=',V1,' m/s' 'velocity of rubbing at the pin of the crank =',V2,' m/s''velocity of rubbing at the pin of cross head =',Vb,' m/s''position and linear velocity of point G on the connecting rod=',AG,' m')\n", - "\n", - "\n", - "\n", - "\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity of piston B= 8.150 m/sAngular velocity of connecting rod= 3.400 rad/svelocity of point E= 8.500 m/s velocity of rubbing at the pin of the crankshaft= 0.471 m/svelocity of rubbing at the pin of the crank = 0.102 m/svelocity of rubbing at the pin of cross head = 0.334 m/sposition and linear velocity of point G on the connecting rod= 1.500 m\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg 19" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 5 PAGE NO 19\n", - "#calculate linear velocity at various point\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.20,1.21\n", - "import math\n", - "pi=3.141\n", - "N=120.## speed of crank in rpm\n", - "OA=10.## length of crank in cm\n", - "BP=48.## from figure 1.20 in cm\n", - "BA=40.## from figure 1.20 in cm\n", - "##==============\n", - "w=2.*pi*N/60.## angular velocity of the crank OA in rad/s\n", - "Vao=w*OA## velocity of ao in cm/s\n", - "ba=4.5## by measurement from 1.21 in cm\n", - "Bp=BP*ba/BA\n", - "op=6.8## by measurement in cm from figure 1.21\n", - "s=20.## scale of velocity diagram 1cm=20cm/s\n", - "Vp=op*s## linear velocity of P in m/s\n", - "ob=5.1## by measurement in cm from figure 1.21\n", - "Vb=ob*s## linear velocity of slider B\n", - "print'%s %.2f %s %.2f %s'%('Linear velocity of slider B= ',Vb,' cm/s''Linear velocity of point P= ',Vp,' cm/s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Linear velocity of slider B= 102.00 cm/sLinear velocity of point P= 136.00 cm/s\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg20" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#calculate angular velocity at various points\n", - "##CHAPTER 1 ILLUSRTATION 6 PAGE NO 20\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.22,1.23\n", - "import math\n", - "pi=3.141\n", - "AB=6.25## length of link AB in cm\n", - "BC=17.5## length of link BC in cm\n", - "CD=11.25## length of link CD in cm\n", - "DA=20.## length of link DA in cm\n", - "CE=10.\n", - "N=100.## speed of crank in rpm\n", - "##========================\n", - "wAB=2.*pi*N/60.## angular velocity of AB in rad/s\n", - "Vb=wAB*AB## linear velocity of B with respect to A\n", - "s=15.## scale for velocity diagram 1 cm= 15 cm/s\n", - "dc=3.## by measurement in cm\n", - "Vcd=dc*s\n", - "wCD=Vcd/CD## angular velocity of link CD in rad/s\n", - "bc=2.5## by measurement in cm\n", - "Vbc=bc*s\n", - "wBC=Vbc/BC## angular velocity of link BC in rad/s\n", - "ce=bc*CE/BC\n", - "ae=3.66## by measurement in cm\n", - "Ve=ae*s## velocity of point E 10 from c on the link BC\n", - "af=2.94## by measurement in cm\n", - "Vf=af*s## velocity of point F\n", - "print'%s %.3f %s %.3f %s %.3f %s %.3f %s'%('The angular velocity of link CD= ',wCD,' rad/s'' The angular velocity of link BC= ',wBC,'rad/s'' velocity of point E 10 from c on the link BC= ',Ve,' cm/s' ' velocity of point F= ',Vf,' cm/s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The angular velocity of link CD= 4.000 rad/s The angular velocity of link BC= 2.143 rad/s velocity of point E 10 from c on the link BC= 54.900 cm/s velocity of point F= 44.100 cm/s\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg21" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 7 PAGE NO 21\n", - "##TITLE:Basic kinematics\n", - "#calculate Linear velocity slider and angular velocity of link\n", - "##Figure 1.24,1.25\n", - "import math\n", - "pi=3.141\n", - "Noa=600## speed of the crank in rpm\n", - "OA=2.8## length of link OA in cm\n", - "AB=4.4## length of link AB in cm\n", - "BC=4.9## length of link BC in cm\n", - "BD=4.6## length of link BD in cm\n", - "##=================\n", - "wOA=2.*pi*Noa/60.## angular velocity of crank in rad/s\n", - "Vao=wOA*OA## The linear velocity of point A with respect to oin m/s\n", - "s=50.## scale of velocity diagram in cm\n", - "od=2.95## by measurement in cm from figure\n", - "Vd=od*s/100.## linear velocity slider in m/s\n", - "bd=3.2## by measurement in cm from figure\n", - "Vbd=bd*s\n", - "wBD=Vbd/BD## angular velocity of link BD\n", - "print'%s %.1f %s %.1f %s '%('linear velocity slider D= ',Vd,' m/s' 'angular velocity of link BD= ',wBD,' rad/s')\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "linear velocity slider D= 1.5 m/sangular velocity of link BD= 34.8 rad/s \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg22" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 8 PAGE NO 22\n", - "#calculate Angular velocity of link CD\n", - "##TITLE:Basic kinematics\n", - "import math\n", - "pi=3.141\n", - "Noa=60.## speed of crank in rpm\n", - "OA=30.## length of link OA in cm\n", - "AB=100.## length of link AB in cm\n", - "CD=80.## length of link CD in cm\n", - "##AC=CB\n", - "##================\n", - "wOA=2.*pi*Noa/60.## angular velocity of crank in rad/s\n", - "Vao=wOA*OA/100.## linear velocity of point A with respect to O\n", - "s=50.## scale for velocity diagram 1 cm= 50 cm/s\n", - "ob=3.4## by measurement in cm from figure 1.27\n", - "od=.9## by measurement in cm from figure 1.27\n", - "Vcd=160.## by measurement in cm/s from figure 1.27\n", - "wCD=Vcd/CD## angular velocity of link in rad/s\n", - "print'%s %.d %s'%('Angular velocity of link CD= ',wCD,' rad/s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Angular velocity of link CD= 2 rad/s\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 9 PAGE NO 23\n", - "#calculate velcity of Ram and anugular velocity of link and velocity of slidingof the block\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.28,1.29\n", - "import math\n", - "pi=3.141\n", - "Nao=120.## speed of the crank in rpm\n", - "OQ=10.## length of link OQ in cm\n", - "OA=20.## length of link OA in cm\n", - "QC=15.## length of link QC in cm\n", - "CD=50.## length oflink CD in cm\n", - "##=============\n", - "wOA=2.*pi*Nao/60.## angular speed of crank in rad/s\n", - "Vad=wOA*OA/100.## velocity of pin A in m/s\n", - "BQ=41.## from figure 1.29 \n", - "BC=26.## from firure 1.29 \n", - "bq=4.7## from figure 1.29\n", - "bc=bq*BC/BQ## from figure 1.29 in cm\n", - "s=50.## scale for velocity diagram in cm/s\n", - "od=1.525## velocity vector od in cm from figure 1.29\n", - "Vd=od*s## velocity of ram D in cm/s\n", - "dc=1.925## velocity vector dc in cm from figure 1.29\n", - "Vdc=dc*s## velocity of link CD in cm/s\n", - "wCD=Vdc/CD## angular velocity of link CD in cm/s\n", - "ba=1.8## velocity vector of sliding of the block in cm\n", - "Vab=ba*s## velocity of sliding of the block in cm/s\n", - "print'%s %.3f %s %.2f %s %.1f %s '%('Velocity of RAM D= ',Vd,' cm/s''angular velocity of link CD= ',wCD,' rad/s'' velocity of sliding of the block= ',Vab,' cm/s')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity of RAM D= 76.250 cm/sangular velocity of link CD= 1.93 rad/s velocity of sliding of the block= 90.0 cm/s \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg24" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 10 PAGE NO 24\n", - "##TITLE:Basic kinematics\n", - "#calculate linear velocity abd radial component of accerlation and anugular velocity of connecting rod and anugular accerlation of connecting rod\n", - "##Figure 1.30(a),1.30(b),1.30(c)\n", - "import math\n", - "pi=3.141\n", - "Nao=300.## speed of crank in rpm\n", - "AO=.15## length of crank in m\n", - "BA=.6## length of connecting rod in m\n", - "##===================\n", - "wAO=2.*pi*Nao/60.## angular velocity of link in rad/s\n", - "Vao=wAO*AO## linear velocity of A with respect to 'o'\n", - "ab=3.4## length of vector ab by measurement in m/s\n", - "Vba=ab\n", - "ob=4.## length of vector ob by measurement in m/s\n", - "oc=4.1## length of vector oc by measurement in m/s\n", - "fRao=Vao**2./AO## radial component of acceleration of A with respect to O\n", - "fRba=Vba**2./BA## radial component of acceleration of B with respect to A\n", - "wBA=Vba/BA## angular velocity of connecting rod BA\n", - "fTba=103.## by measurement in m/s**2\n", - "alphaBA=fTba/BA## angular acceleration of connecting rod BA\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('linear velocity of A with respect to O= ',Vao,' m/s''radial component of acceleration of A with respect to O= ',fRao,' m/s**2'' radial component of acceleration of B with respect to A=',fRba,' m/s**2'' angular velocity of connecting rod B= ',wBA,' rad/s'' angular acceleration of connecting rod BA= ',alphaBA,' rad/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "linear velocity of A with respect to O= 4.7 m/sradial component of acceleration of A with respect to O= 148.0 m/s**2 radial component of acceleration of B with respect to A= 19.3 m/s**2 angular velocity of connecting rod B= 5.7 rad/s angular acceleration of connecting rod BA= 171.7 rad/s**2 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 11 PAGE NO 26\n", - "#calcualte Angular accerlation at various point\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.31(a),1.31(b),1.31(c)\n", - "import math\n", - "pi=3.141\n", - "wAP=10.## angular velocity of crank in rad/s\n", - "P1A=30.## length of link P1A in cm\n", - "P2B=36.## length of link P2B in cm\n", - "AB=36.## length of link AB in cm\n", - "P1P2=60.## length of link P1P2 in cm\n", - "AP1P2=60.## crank inclination in degrees \n", - "alphaP1A=30.## angulare acceleration of crank P1A in rad/s**2\n", - "##=====================================\n", - "Vap1=wAP*P1A/100.## linear velocity of A with respect to P1 in m/s\n", - "Vbp2=2.2## velocity of B with respect to P2 in m/s(measured from figure )\n", - "Vba=2.06## velocity of B with respect to A in m/s(measured from figure )\n", - "wBP2=Vbp2/(P2B*100.)## angular velocity of P2B in rad/s\n", - "wAB=Vba/(AB*100.)## angular velocity of AB in rad/s\n", - "fAB1=alphaP1A*P1A/100.## tangential component of the acceleration of A with respect to P1 in m/s**2\n", - "frAB1=Vap1**2./(P1A/100.)## radial component of the acceleration of A with respect to P1 in m/s**2\n", - "frBA=Vba**2./(AB/100.)## radial component of the acceleration of B with respect to B in m/s**2\n", - "frBP2=Vbp2**2./(P2B/100.)## radial component of the acceleration of B with respect to P2 in m/s**2\n", - "ftBA=13.62## tangential component of B with respect to A in m/s**2(measured from figure)\n", - "ftBP2=26.62## tangential component of B with respect to P2 in m/s**2(measured from figure)\n", - "alphaBP2=ftBP2/(P2B/100.)## angular acceleration of P2B in m/s**2\n", - "alphaBA=ftBA/(AB/100.)## angular acceleration of AB in m/s**2\n", - "##==========================\n", - "print'%s %.1f %s %.1f %s'%('Angular acceleration of P2B=',alphaBP2,' rad/s**2''angular acceleration of AB =',alphaBA,' rad/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Angular acceleration of P2B= 73.9 rad/s**2angular acceleration of AB = 37.8 rad/s**2\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg28" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 12 PAGE NO 28\n", - "#calculate velocities at various point\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.32(a),1.32(b),1.32(c)\n", - "import math\n", - "PI=3.141\n", - "AB=12.## length of link AB in cm\n", - "BC=48.## length of link BC in cm\n", - "CD=18.## length of link CD in cm\n", - "DE=36.## length of link DE in cm\n", - "EF=12.## length of link EF in cm\n", - "FP=36.## length of link FP in cm\n", - "Nba=200.## roating speed of link BA IN rpm\n", - "wBA=2*PI*200./60.## Angular velocity of BA in rad/s\n", - "Vba=wBA*AB/100.## linear velocity of B with respect to A in m/s\n", - "Vc=2.428## velocity of c in m/s from diagram 1.32(b)\n", - "Vd=2.36## velocity of D in m/s from diagram 1.32(b)\n", - "Ve=1## velocity of e in m/s from diagram 1.32(b)\n", - "Vf=1.42## velocity of f in m/s from diagram 1.32(b)\n", - "Vcb=1.3## velocity of c with respect to b in m/s from figure\n", - "fBA=Vba**2.*100./AB## radial component of acceleration of B with respect to A in m/s**2\n", - "fCB=Vcb**2*100./BC## radial component of acceleration of C with respect to B in m/s**2\n", - "fcb=3.52## radial component of acceleration of C with respect to B in m/s**2 from figure\n", - "fC=19.## acceleration of slider in m/s**2 from figure\n", - "print'%s %.1f %s %.1f %s %.1f %s %.2f %s %.2f %s'%('velocity of c=',Vc,' m/s''velocity of d=',Vd,' m/s''velocity of e=',Ve,' m/s'' velocity of f=',Vf,' m/s''Acceleration of slider=',Vc,' m/s**2')\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "velocity of c= 2.4 m/svelocity of d= 2.4 m/svelocity of e= 1.0 m/s velocity of f= 1.42 m/sAcceleration of slider= 2.43 m/s**2\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 1 ILLUSRTATION 13 PAGE NO 30\n", - "#caculate angular acceleration at varoius points\n", - "##TITLE:Basic kinematics\n", - "##Figure 1.33(a),1.33(b),1.33(c)\n", - "import math\n", - "PI=3.141\n", - "N=120.## speed of the crank OC in rpm\n", - "OC=5.## length of link OC in cm\n", - "cp=20.## length of link CP in cm\n", - "qa=10.## length of link QA in cm\n", - "pa=5.## length of link PA in cm\n", - "CP=46.9## velocity of link CP in cm/s\n", - "QA=58.3## velocity of link QA in cm/s\n", - "Pa=18.3## velocity of link PA in cm/s\n", - "Vc=2.*PI*N*OC/60.## velocity of C in m/s\n", - "Cco=Vc**2./OC## centripetal acceleration of C relative to O in cm/s**2\n", - "Cpc=CP**2./cp## centripetal acceleration of P relative to C in cm/s**2\n", - "Caq=QA**2./qa## centripetal acceleration of A relative to Q in cm/s**2\n", - "Cap=Pa**2./pa## centripetal acceleration of A relative to P in cm/s**2\n", - "pp1=530.\n", - "a1a=323.\n", - "a2a=207.5\n", - "ACP=pp1/cp## angular acceleration of link CP in rad/s**2\n", - "APA=a1a/qa## angular acceleration of link PA in rad/s**2\n", - "AAQ=a2a/pa## angular acceleration of link AQ in rad/s**2\n", - "print'%s %.3f %s %.3f %s %.3f %s'%('angular acceleration of link CP =',ACP,' rad/s**2'' angular acceleration of link CP=',APA,' rad/s**2''angular acceleration of link CP=',AAQ,' rad/s**2')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "angular acceleration of link CP = 26.500 rad/s**2 angular acceleration of link CP= 32.300 rad/s**2angular acceleration of link CP= 41.500 rad/s**2\n" - ] - } - ], - "prompt_number": 4 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter2.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter2.ipynb deleted file mode 100755 index 0ed80f3b..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter2.ipynb +++ /dev/null @@ -1,824 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:1b022ca97a90c946dcce72b014fa00f7dd7b26ac917f0b5fe9fdd6cabd6dcdfd" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter2-TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg57" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2 ILLUSRTATION 1 PAGE NO 57\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "Na=300.;##driving shaft running speed in rpm\n", - "Nb=400.;##driven shaft running speed in rpm\n", - "Da=60.;##diameter of driving shaft in mm\n", - "t=.8;##belt thickness in mm\n", - "s=.05;##slip in percentage(5%)\n", - "##==========================================================================================\n", - "##calculation\n", - "Db=(Da*Na)/Nb;##finding out the diameter of driven shaft without considering the thickness of belt\n", - "Db1=(((Da+t)*Na)/Nb)-t##/considering the thickness\n", - "Db2=(1.-s)*(Da+t)*(Na/Nb)-t##considering slip also\n", - "##=========================================================================================\n", - "##output\n", - "print'%s %.1f %s'%('the value of Db is',Db,' cm')\n", - "print'%s %.1f %s'%('the value of Db1 is',Db1,' cm')\n", - "print'%s %.1f %s'%('the value of Db2 is',Db2,' cm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the value of Db is 45.0 cm\n", - "the value of Db1 is 44.8 cm\n", - "the value of Db2 is 42.5 cm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg57" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSRTATION 2 PAGE NO 57\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "\n", - "##====================================================================================\n", - "##input\n", - "n1=1200##rpm of motor shaft\n", - "d1=40##diameter of motor pulley in cm\n", - "d2=70##diameter of 1st pulley on the shaft in cm\n", - "s=.03##percentage slip(3%)\n", - "d3=45##diameter of 2nd pulley\n", - "d4=65##diameter of the pulley on the counnter shaft\n", - "##=========================================================================================\n", - "##calculation\n", - "n2=n1*d1*(1-s)/d2##rpm of driven shaft\n", - "n3=n2##both the pulleys are mounted on the same shaft\n", - "n4=n3*(1-s)*d3/d4##rpm of counter shaft\n", - "\n", - "##output\n", - "print'%s %.1f %s %.1f %s '%('the speed of driven shaft is',n2,' rpm''the speed of counter shaft is ',n4,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the speed of driven shaft is 665.1 rpmthe speed of counter shaft is 446.7 rpm \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg58" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2 ILLUSTRATION 3 PAGE NO:58\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##==============================================================================\n", - "##input\n", - "d1=30.##diameter of 1st shaft in cm\n", - "d2=50.##diameter 2nd shaft in cm\n", - "pi=3.141\n", - "c=500.##centre distance between the shafts in cm\n", - "##==============================================================================\n", - "##calculation\n", - "L1=((d1+d2)*pi/2.)+(2.*c)+((d1+d2)**2.)/(4.*c)##lenth of cross belt\n", - "L2=((d1+d2)*pi/2.)+(2.*c)+((d1-d2)**2.)/(4.*c)##lenth of open belt\n", - "r=L1-L2##remedy\n", - "##==============================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('length of cross belt is ',L1,'cm '' length of open belt is ',L2,'cm''the length of the belt to be shortened is ',r,' cm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "length of cross belt is 1128.8 cm length of open belt is 1125.8 cmthe length of the belt to be shortened is 3.0 cm \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg59" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##CHAPTER 2,ILLUSTRATION 4 PAGE 59\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##====================================================================================\n", - "##INPUT\n", - "D1=.5## DIAMETER OF 1ST SHAFT IN m\n", - "D2=.25## DIAMETER OF 2nd SHAFT IN m\n", - "C=2.## CENTRE DISTANCE IN m\n", - "N1=220.## SPEED OF 1st SHAFT\n", - "T1=1250.## TENSION ON TIGHT SIDE IN N\n", - "U=.25## COEFFICIENT OF FRICTION\n", - "PI=3.141\n", - "e=2.71\n", - "##====================================================================================\n", - "##CALCULATION\n", - "L=(D1+D2)*PI/2.+((D1+D2)**2./(4.*C))+2.*C\n", - "F=(D1+D2)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.+(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", - "T2=T1/(e**(U*THETA))## TENSION ON SLACK SIDE IN N\n", - "V=PI*D1*N1/60.## VELOCITY IN m/s\n", - "P=(T1-T2)*V/1000.## POWER IN kW\n", - "##====================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('LENGTH OF BELT REQUIRED =',L,' m')\n", - "print'%s %.1f %s'%('ANGLE OF CONTACT =',THETA,' radians')\n", - "print'%s %.1f %s'%('POWER CAN BE TRANSMITTED=',P,' kW')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "LENGTH OF BELT REQUIRED = 5.2 m\n", - "ANGLE OF CONTACT = 3.1 radians\n", - "POWER CAN BE TRANSMITTED= 3.9 kW\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg59" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 5 PAGE 5\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##=====================================================================================================\n", - "##input\n", - "n1=100.## of driving shaft\n", - "n2=240.##speed of driven shaft\n", - "p=11000.##power to be transmitted in watts\n", - "c=250.##centre distance in cm\n", - "d2=60.##diameter in cm\n", - "b=11.5*10**-2##width of belt in metres\n", - "t=1.2*10**-2##thickness in metres\n", - "u=.25##co-efficient of friction \n", - "pi=3.141\n", - "e=2.71\n", - "##===================================================================================================\n", - "##calculation for open bely drive\n", - "d1=n2*d2/n1\n", - "f=(d1-d2)/(2.*c)##sin(alpha) for open bely drive\n", - "##angle of arc of contact for open belt drive is,theta=180-2*alpha\n", - "alpha=math.asin(f)*57.3\n", - "teta=(180.-(2*alpha))*3.147/180.##pi/180 is used to convert into radians\n", - "x=(e**(u*teta))##finding out the value of t1/t2\n", - "v=pi*d2*10.*n2/60.##finding out the value of t1-t2\n", - "y=p*1000./(v)\n", - "t1=(y*x)/(x-1.)\n", - "Fb=t1/(t*b)/1000.\n", - "##=======================================================================================================\n", - "##calculation for cross belt drive bely drive\n", - "F=(d1+d2)/(2.*c)##for cross belt drive bely drive\n", - "ALPHA=math.asin(F)*57.3\n", - "THETA=(180.+(2.*ALPHA))*pi/180.##pi/180 is used to convert into radians\n", - "X=(e**(u*THETA))##finding out the value of t1/t2\n", - "V=pi*d2*10.*n2/60.##finding out the value of t1-t2\n", - "Y=p*1000./(V)\n", - "T1=(Y*X)/(X-1.)\n", - "Fb2=T1/(t*b)/1000.\n", - "##========================================================================================================\n", - "##output\n", - "print('for a open belt drive:')\n", - "print'%s %.1f %s %.1f %s'%('the tension in belt is ',t1,'N' 'stress induced is ',Fb,' kN/m**2')\n", - "print('for a cross belt drive:')\n", - "print'%s %.1f %s %.1f %s '%('the tension in belt is ',T1,'N' 'stress induced is ',Fb2,' kN/m**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for a open belt drive:\n", - "the tension in belt is 2898.4 Nstress induced is 2100.3 kN/m**2\n", - "for a cross belt drive:\n", - "the tension in belt is 2318.8 Nstress induced is 1680.3 kN/m**2 \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg61" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 6 PAGE 61\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##========================================================================================\n", - "##INPUT\n", - "D1=80.##DIAMETER OF SHAFT IN cm\n", - "N1=160.##SPEED OF 1ST SHAFT IN rpm\n", - "N2=320.##SPEED OF 2ND SHAFT IN rpm\n", - "C=250.##CENTRE DISTANCE IN CM\n", - "U=.3##COEFFICIENT OF FRICTION\n", - "P=4.##POWER IN KILO WATTS\n", - "e=2.71\n", - "PI=3.141\n", - "f=110.##STRESS PER cm WIDTH OF BELT\n", - "##========================================================================================\n", - "##CALCULATION\n", - "V=PI*D1*math.pow(10,-2)*N1/60.##VELOCITY IN m/s\n", - "Y=P*1000./V##Y=T1-T2\n", - "D2=D1*(N1/N2)##DIAMETER OF DRIVEN SHAFT\n", - "F=(D1-D2)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.-(2.*ALPHA))*PI/180.##ANGLE OF CONTACT IN radians\n", - "X=e**(U*THETA)##VALUE OF T1/T2\n", - "T1=X*Y/(X-1.)\n", - "b=T1/f##WIDTH OF THE BELT REQUIRED \n", - "##=======================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('THE WIDTH OF THE BELT IS ',b,' cm')\n", - "#apporximate ans is correct " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE WIDTH OF THE BELT IS 8.9 cm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg62" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2 ILLUSRTATION 7 PAGE NO 62\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "m=1000.## MASS OF THE CASTING IN kg\n", - "PI=3.141\n", - "THETA=2.75*2*PI## ANGLE OF CONTACT IN radians\n", - "D=.26## DIAMETER OF DRUM IN m\n", - "N=24.## SPEED OF THE DRUM IN rpm\n", - "U=.25## COEFFICIENT OF FRICTION\n", - "e=2.71\n", - "T1=9810## TENSION ON TIGHTSIDE IN N\n", - "##=============================================================================================\n", - "##CALCULATION\n", - "T2=T1/(e**(U*THETA))## tension on slack side of belt in N\n", - "W=m*9.81## WEIGHT OF CASTING IN N\n", - "R=D/2.## RADIUS OF DRUM IN m\n", - "P=2*PI*N*W*R/60000.## POWER REQUIRED IN kW\n", - "P2=(T1-T2)*PI*D*N/60000.## POWER SUPPLIED BY DRUM IN kW\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('FORCE REQUIRED BY MAN=',T2,' N'and 'POWER REQUIRED TO RAISE CASTING=',P,' kW' 'POWER SUPPLIED BY DRUM=',P2,' kW')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FORCE REQUIRED BY MAN= 132.4 POWER REQUIRED TO RAISE CASTING= 3.2 kWPOWER SUPPLIED BY DRUM= 3.2 kW \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg62" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 8 PAGE 62\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##INPUT\n", - "t=9.##THICKNESS IN mm\n", - "b=250.##WIDTH IN mm\n", - "D=90.##DIAMETER OF PULLEY IN cm\n", - "N=336.##SPEED IN rpm\n", - "PI=3.141\n", - "U=.35##COEFFICIENT FRICTION\n", - "e=2.71\n", - "THETA=120.*PI/180.\n", - "Fb=2.##STRESS IN MPa\n", - "d=1000.##DENSITY IN KG/M**3\n", - "\n", - "##CALCULATION\n", - "M=b*10**-3.*t*10**-3.*d##MASS IN KG\n", - "V=PI*D*10**-2.*N/60.##VELOCITY IN m/s\n", - "Tc=M*V**2##CENTRIFUGAL TENSION\n", - "Tmax=b*t*Fb##MAX TENSION IN N\n", - "T1=Tmax-Tc\n", - "T2=T1/(e**(U*THETA))\n", - "P=(T1-T2)*V/1000.\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('THE TENSION ON TIGHT SIDE OF THE BELT IS',T1,' N')\n", - "print'%s %.1f %s'%('THE TENSION ON SLACK SIDE OF THE BELT IS ',T2,' N')\n", - "print'%s %.1f %s'%('CENTRIFUGAL TENSION =',Tc,'N')\n", - "print'%s %.1f %s'%('THE POWER CAPACITY OF BELT IS ',P,' KW')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE TENSION ON TIGHT SIDE OF THE BELT IS 3936.1 N\n", - "THE TENSION ON SLACK SIDE OF THE BELT IS 1895.6 N\n", - "CENTRIFUGAL TENSION = 563.9 N\n", - "THE POWER CAPACITY OF BELT IS 32.3 KW\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg63" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 9 PAGE 63\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##INPUT\n", - "P=35000.##POWER TO BE TRANSMITTED IN WATTS\n", - "D=1.5##EFFECTIVE DIAMETER OF PULLEY IN METRES\n", - "N=300.##SPEED IN rpm\n", - "e=2.71\n", - "U=.3##COEFFICIENT OF FRICTION\n", - "PI=3.141\n", - "THETA=(11/24.)*360.*PI/180.##ANGLE OF CONTACT\n", - "density=1.1##density of belt material in Mg/m**3\n", - "L=1.##in metre\n", - "t=9.5##THICKNESS OF BELT IN mm\n", - "Fb=2.5##PERMISSIBLE WORK STRESS IN N/mm**2\n", - "\n", - "##CALCULATION\n", - "V=PI*D*N/60.##VELOCITY IN m/s\n", - "X=P/V##X=T1-T2\n", - "Y=e**(U*THETA)##Y=T1/T2\n", - "T1=X*Y/(Y-1)\n", - "Mb=t*density*L/10**3.##value of m/b\n", - "Tc=Mb*V**2.##centrifugal tension/b\n", - "Tmaxb=t*Fb##max tension/b\n", - "b=T1/(Tmaxb-Tc)##thickness in mm\n", - "##output\n", - "print'%s %.1f %s'%('TENSION IN TIGHT SIDE OF THE BELT =',T1,' N')\n", - "print'%s %.1f %s'%('THICKNESS OF THE BELT IS =',b,' mm')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "TENSION IN TIGHT SIDE OF THE BELT = 2573.5 N\n", - "THICKNESS OF THE BELT IS = 143.4 mm\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg64" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 10 PAGE 64\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##INPUT\n", - "t=5.##THICKNESS OF BELT IN m\n", - "PI=3.141\n", - "U=.3\n", - "e=2.71\n", - "THETA=155.*PI/180.##ANGLE OF CONTACT IN radians\n", - "V=30.##VELOCITY IN m/s\n", - "density=1.##in m/cm**3\n", - "L=1.##LENGTH\n", - "\n", - "##calculation\n", - "Xb=80.## (T1-T2)=80b;so let (T1-T2)/b=Xb\n", - "Y=e**(U*THETA)## LET Y=T1/T2\n", - "Zb=80.*Y/(Y-1.)## LET T1/b=Zb;BY SOLVING THE ABOVE 2 EQUATIONS WE WILL GET THIS EXPRESSION\n", - "Mb=t*L*density*10**-2.## m/b in N\n", - "Tcb=Mb*V**2.## centrifugal tension/b\n", - "Tmaxb=Zb+Tcb## MAX TENSION/b\n", - "Fb=Tmaxb/t##STRESS INDUCED IN TIGHT BELT\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('THE STRESS DEVELOPED ON THE TIGHT SIDE OF BELT=',Fb,' N/cm**2')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE STRESS DEVELOPED ON THE TIGHT SIDE OF BELT= 37.8 N/cm**2\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg65" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 11 PAGE 65\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##INPUT\n", - "C=4.5## CENTRE DISTANCE IN metres\n", - "D1=1.35## DIAMETER OF LARGER PULLEY IN metres\n", - "D2=.9## DIAMETER OF SMALLER PULLEY IN metres\n", - "To=2100.## INITIAL TENSION IN newtons\n", - "b=12.## WIDTH OF BELT IN cm\n", - "t=12.## THICKNESS OF BELT IN mm\n", - "d=1.## DENSITY IN gm/cm**3\n", - "U=.3## COEFFICIENT OF FRICTION\n", - "L=1.## length in metres\n", - "PI=3.141\n", - "e=2.71\n", - "\n", - "##CALCULATION\n", - "M=b*t*d*L*10**-2.## mass of belt per metre length in KG\n", - "V=(To/3./M)**.5## VELOCITY OF FOR MAX POWER TO BE TRANSMITTED IN m/s\n", - "Tc=M*V**2.## CENTRIFUGAL TENSION IN newtons\n", - "## LET (T1+T2)=X\n", - "X=2.*To-2.*Tc ## THE VALUE OF (T1+T2)\n", - "F=(D1-D2)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", - "## LET T1/T2=Y\n", - "Y=e**(U*THETA)## THE VALUE OF T1/T2\n", - "T1=X*Y/(Y+1.)## BY SOLVING X AND Y WE WILL GET THIS EQN\n", - "T2=X-T1\n", - "P=(T1-T2)*V/1000.## MAX POWER TRANSMITTED IN kilowatts\n", - "N1=V*60./(PI*D1)## SPEED OF LARGER PULLEY IN rpm\n", - "N2=V*60./(PI*D2)## SPEED OF SMALLER PULLEY IN rpm\n", - "##OUTPUT\n", - "print'%s %.1f %s'%(' MAX POWER TO BE TRANSMITTED =',P,' KW')\n", - "print'%s %.1f %s'%(' SPEED OF THE LARGER PULLEY =',N1,' rpm')\n", - "print'%s %.1f %s'%(' SPEED OF THE SMALLER PULLEY =',N2,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " MAX POWER TO BE TRANSMITTED = 27.0 KW\n", - " SPEED OF THE LARGER PULLEY = 312.0 rpm\n", - " SPEED OF THE SMALLER PULLEY = 468.0 rpm\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg66" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 12 PAGE 66\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##============================================================================================================================\n", - "##INPUT\n", - "PI=3.141\n", - "e=2.71\n", - "D1=1.20## DIAMETER OF DRIVING SHAFT IN m\n", - "D2=.50## DIAMETER OF DRIVEN SHAFT IN m\n", - "C=4.## CENTRE DISTANCE BETWEEN THE SHAFTS IN m\n", - "M=.9## MASS OF BELT PER METRE LENGTH IN kg\n", - "Tmax=2000## MAX TENSION IN N\n", - "U=.3## COEFFICIENT OF FRICTION\n", - "N1=200.## SPEED OF DRIVING SHAFT IN rpm\n", - "N2=450.## SPEED OF DRIVEN SHAFT IN rpm\n", - "##==============================================================================================================================\n", - "##CALCULATION\n", - "V=PI*D1*N1/60.## VELOCITY OF BELT IN m/s\n", - "Tc=M*V**2.## CENTRIFUGAL TENSION IN N\n", - "T1=Tmax-Tc## TENSION ON TIGHTSIDE IN N\n", - "F=(D1-D2)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", - "T2=T1/(e**(U*THETA))## TENSION ON SLACK SIDE IN N\n", - "TL=(T1-T2)*D1/2.## TORQUE ON THE SHAFT OF LARGER PULLEY IN N-m\n", - "TS=(T1-T2)*D2/2.## TORQUE ON THE SHAFT OF SMALLER PULLEY IN N-m\n", - "P=(T1-T2)*V/1000.## POWER TRANSMITTED IN kW\n", - "Pi=2.*PI*N1*TL/60000.## INPUT POWER\n", - "Po=2.*PI*N2*TS/60000.## OUTPUT POWER\n", - "Pl=Pi-Po## POWER LOST DUE TO FRICTION IN kW\n", - "n=Po/Pi*100.## EFFICIENCY OF DRIVE IN %\n", - "##==================================================================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('TORQUE ON LARGER SHAFT =',TL,'N-m')\n", - "print'%s %.1f %s'%('TORQUE ON SMALLER SHAFT =',TS,' N-m')\n", - "print'%s %.1f %s'%('POWER TRANSMITTED =',P,' kW')\n", - "print'%s %.1f %s'%('POWER LOST DUE TO FRICTION =',Pl,' kW')\n", - "print'%s %.1f %s'%('EFFICIENCY OF DRINE =',n,' percentage')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "TORQUE ON LARGER SHAFT = 679.0 N-m\n", - "TORQUE ON SMALLER SHAFT = 282.9 N-m\n", - "POWER TRANSMITTED = 14.2 kW\n", - "POWER LOST DUE TO FRICTION = 0.9 kW\n", - "EFFICIENCY OF DRINE = 93.8 percentage\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg67" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 13 PAGE 67\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##============================================================================================================================\n", - "##INPUT\n", - "PI=3.141\n", - "e=2.71\n", - "P=90## POWER OF A COMPRESSOR IN kW\n", - "N2=250.## SPEED OF DRIVEN SHAFT IN rpm\n", - "N1=750.## SPEED OF DRIVER SHAFT IN rpm\n", - "D2=1.## DIAMETER OF DRIVEN SHAFT IN m\n", - "C=1.75## CENTRE DISTANCE IN m\n", - "V=1600./60.## VELOCITY IN m/s\n", - "a=375.## CROSECTIONAL AREA IN mm**2\n", - "density=1000.## BELT DENSITY IN kg/m**3\n", - "L=1## length to be considered\n", - "Fb=2.5## STRESSS INDUCED IN MPa\n", - "beeta=35./2.## THE GROOVE ANGLE OF PULLEY\n", - "U=.25## COEFFICIENT OF FRICTION\n", - "##=================================================================================================================================\n", - "##CALCULATION\n", - "D1=N2*D2/N1## DIAMETER OF DRIVING SHAFT IN m\n", - "m=a*density*10**-6.*L## MASS OF THE BELT IN kg\n", - "Tmax=a*Fb## MAX TENSION IN N\n", - "Tc=m*V**2.## CENTRIFUGAL TENSION IN N\n", - "T1=Tmax-Tc## TENSION ON TIGHTSIDE OF BELT IN N\n", - "F=(D2-D1)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", - "T2=T1/(e**(U*THETA/math.sin(beeta/57.3)))##TENSION ON SLACKSIDE IN N\n", - "P2=(T1-T2)*V/1000.## POWER TRANSMITTED PER BELT kW\n", - "N=P/P2## NO OF V-BELTS\n", - "N3=N+1.\n", - "##======================================================================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s '%('NO OF BELTS REQUIRED TO TRANSMIT POWER=',N,' APPROXIMATELY=',N3,'')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "NO OF BELTS REQUIRED TO TRANSMIT POWER= 5.4 APPROXIMATELY= 6.4 \n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg68" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 14 PAGE 68\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##============================================================================================================================\n", - "##INPUT\n", - "PI=3.141\n", - "e=2.71\n", - "P=75.## POWER IN kW\n", - "D=1.5## DIAMETER OF PULLEY IN m\n", - "U=.3## COEFFICIENT OF FRICTION\n", - "beeta=45./2.## GROOVE ANGLE\n", - "THETA=160.*PI/180.## ANGLE OF CONTACT IN radians\n", - "m=.6## MASS OF BELT IN kg/m\n", - "Tmax=800.## MAX TENSION IN N\n", - "N=200.## SPEED OF SHAFT IN rpm\n", - "##=============================================================================================================================\n", - "##calculation\n", - "V=PI*D*N/60.## VELOCITY OF ROPE IN m/s\n", - "Tc=m*V**2.## CENTRIFUGAL TENSION IN N\n", - "T1=Tmax-Tc## TENSION ON TIGHT SIDE IN N\n", - "T2=T1/(e**(U*THETA/math.sin(beeta/57.3)))##TENSION ON SLACKSIDE IN N\n", - "P2=(T1-T2)*V/1000.## POWER TRANSMITTED PER BELT kW\n", - "No=P/P2## NO OF V-BELTS\n", - "N3=No+1.## ROUNDING OFF\n", - "To=(T1+T2+Tc*2.)/2.## INITIAL TENSION\n", - "##================================================================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s '%('NO OF BELTS REQUIRED TO TRANSMIT POWER=',No,'' 'APPROXIMATELY=',N3,'')\n", - "print'%s %.1f %s'%('INITIAL ROPE TENSION=',To,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "NO OF BELTS REQUIRED TO TRANSMIT POWER= 8.3 APPROXIMATELY= 9.3 \n", - "INITIAL ROPE TENSION= 510.8 N\n" - ] - } - ], - "prompt_number": 16 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter2_1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter2_1.ipynb deleted file mode 100755 index e6083830..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter2_1.ipynb +++ /dev/null @@ -1,824 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:214de3ca59a9f823d9af2646136423031768f0a5e133206c7c8ac1d217b863ef" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter2-Transmission of Motion and Power by Belts and Pulleys" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg57" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2 ILLUSRTATION 1 PAGE NO 57\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "Na=300.;##driving shaft running speed in rpm\n", - "Nb=400.;##driven shaft running speed in rpm\n", - "Da=60.;##diameter of driving shaft in mm\n", - "t=.8;##belt thickness in mm\n", - "s=.05;##slip in percentage(5%)\n", - "##==========================================================================================\n", - "##calculation\n", - "Db=(Da*Na)/Nb;##finding out the diameter of driven shaft without considering the thickness of belt\n", - "Db1=(((Da+t)*Na)/Nb)-t##/considering the thickness\n", - "Db2=(1.-s)*(Da+t)*(Na/Nb)-t##considering slip also\n", - "##=========================================================================================\n", - "##output\n", - "print'%s %.1f %s'%('the value of Db is',Db,' cm')\n", - "print'%s %.1f %s'%('the value of Db1 is',Db1,' cm')\n", - "print'%s %.1f %s'%('the value of Db2 is',Db2,' cm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the value of Db is 45.0 cm\n", - "the value of Db1 is 44.8 cm\n", - "the value of Db2 is 42.5 cm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg57" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSRTATION 2 PAGE NO 57\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "\n", - "##====================================================================================\n", - "##input\n", - "n1=1200##rpm of motor shaft\n", - "d1=40##diameter of motor pulley in cm\n", - "d2=70##diameter of 1st pulley on the shaft in cm\n", - "s=.03##percentage slip(3%)\n", - "d3=45##diameter of 2nd pulley\n", - "d4=65##diameter of the pulley on the counnter shaft\n", - "##=========================================================================================\n", - "##calculation\n", - "n2=n1*d1*(1-s)/d2##rpm of driven shaft\n", - "n3=n2##both the pulleys are mounted on the same shaft\n", - "n4=n3*(1-s)*d3/d4##rpm of counter shaft\n", - "\n", - "##output\n", - "print'%s %.1f %s %.1f %s '%('the speed of driven shaft is',n2,' rpm''the speed of counter shaft is ',n4,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the speed of driven shaft is 665.1 rpmthe speed of counter shaft is 446.7 rpm \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg58" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2 ILLUSTRATION 3 PAGE NO:58\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##==============================================================================\n", - "##input\n", - "d1=30.##diameter of 1st shaft in cm\n", - "d2=50.##diameter 2nd shaft in cm\n", - "pi=3.141\n", - "c=500.##centre distance between the shafts in cm\n", - "##==============================================================================\n", - "##calculation\n", - "L1=((d1+d2)*pi/2.)+(2.*c)+((d1+d2)**2.)/(4.*c)##lenth of cross belt\n", - "L2=((d1+d2)*pi/2.)+(2.*c)+((d1-d2)**2.)/(4.*c)##lenth of open belt\n", - "r=L1-L2##remedy\n", - "##==============================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('length of cross belt is ',L1,'cm '' length of open belt is ',L2,'cm''the length of the belt to be shortened is ',r,' cm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "length of cross belt is 1128.8 cm length of open belt is 1125.8 cmthe length of the belt to be shortened is 3.0 cm \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg59" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "##CHAPTER 2,ILLUSTRATION 4 PAGE 59\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##====================================================================================\n", - "##INPUT\n", - "D1=.5## DIAMETER OF 1ST SHAFT IN m\n", - "D2=.25## DIAMETER OF 2nd SHAFT IN m\n", - "C=2.## CENTRE DISTANCE IN m\n", - "N1=220.## SPEED OF 1st SHAFT\n", - "T1=1250.## TENSION ON TIGHT SIDE IN N\n", - "U=.25## COEFFICIENT OF FRICTION\n", - "PI=3.141\n", - "e=2.71\n", - "##====================================================================================\n", - "##CALCULATION\n", - "L=(D1+D2)*PI/2.+((D1+D2)**2./(4.*C))+2.*C\n", - "F=(D1+D2)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.+(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", - "T2=T1/(e**(U*THETA))## TENSION ON SLACK SIDE IN N\n", - "V=PI*D1*N1/60.## VELOCITY IN m/s\n", - "P=(T1-T2)*V/1000.## POWER IN kW\n", - "##====================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('LENGTH OF BELT REQUIRED =',L,' m')\n", - "print'%s %.1f %s'%('ANGLE OF CONTACT =',THETA,' radians')\n", - "print'%s %.1f %s'%('POWER CAN BE TRANSMITTED=',P,' kW')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "LENGTH OF BELT REQUIRED = 5.2 m\n", - "ANGLE OF CONTACT = 3.1 radians\n", - "POWER CAN BE TRANSMITTED= 3.9 kW\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg59" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 5 PAGE 5\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##=====================================================================================================\n", - "##input\n", - "n1=100.## of driving shaft\n", - "n2=240.##speed of driven shaft\n", - "p=11000.##power to be transmitted in watts\n", - "c=250.##centre distance in cm\n", - "d2=60.##diameter in cm\n", - "b=11.5*10**-2##width of belt in metres\n", - "t=1.2*10**-2##thickness in metres\n", - "u=.25##co-efficient of friction \n", - "pi=3.141\n", - "e=2.71\n", - "##===================================================================================================\n", - "##calculation for open bely drive\n", - "d1=n2*d2/n1\n", - "f=(d1-d2)/(2.*c)##sin(alpha) for open bely drive\n", - "##angle of arc of contact for open belt drive is,theta=180-2*alpha\n", - "alpha=math.asin(f)*57.3\n", - "teta=(180.-(2*alpha))*3.147/180.##pi/180 is used to convert into radians\n", - "x=(e**(u*teta))##finding out the value of t1/t2\n", - "v=pi*d2*10.*n2/60.##finding out the value of t1-t2\n", - "y=p*1000./(v)\n", - "t1=(y*x)/(x-1.)\n", - "Fb=t1/(t*b)/1000.\n", - "##=======================================================================================================\n", - "##calculation for cross belt drive bely drive\n", - "F=(d1+d2)/(2.*c)##for cross belt drive bely drive\n", - "ALPHA=math.asin(F)*57.3\n", - "THETA=(180.+(2.*ALPHA))*pi/180.##pi/180 is used to convert into radians\n", - "X=(e**(u*THETA))##finding out the value of t1/t2\n", - "V=pi*d2*10.*n2/60.##finding out the value of t1-t2\n", - "Y=p*1000./(V)\n", - "T1=(Y*X)/(X-1.)\n", - "Fb2=T1/(t*b)/1000.\n", - "##========================================================================================================\n", - "##output\n", - "print('for a open belt drive:')\n", - "print'%s %.1f %s %.1f %s'%('the tension in belt is ',t1,'N' 'stress induced is ',Fb,' kN/m**2')\n", - "print('for a cross belt drive:')\n", - "print'%s %.1f %s %.1f %s '%('the tension in belt is ',T1,'N' 'stress induced is ',Fb2,' kN/m**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "for a open belt drive:\n", - "the tension in belt is 2898.4 Nstress induced is 2100.3 kN/m**2\n", - "for a cross belt drive:\n", - "the tension in belt is 2318.8 Nstress induced is 1680.3 kN/m**2 \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg61" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 6 PAGE 61\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##========================================================================================\n", - "##INPUT\n", - "D1=80.##DIAMETER OF SHAFT IN cm\n", - "N1=160.##SPEED OF 1ST SHAFT IN rpm\n", - "N2=320.##SPEED OF 2ND SHAFT IN rpm\n", - "C=250.##CENTRE DISTANCE IN CM\n", - "U=.3##COEFFICIENT OF FRICTION\n", - "P=4.##POWER IN KILO WATTS\n", - "e=2.71\n", - "PI=3.141\n", - "f=110.##STRESS PER cm WIDTH OF BELT\n", - "##========================================================================================\n", - "##CALCULATION\n", - "V=PI*D1*math.pow(10,-2)*N1/60.##VELOCITY IN m/s\n", - "Y=P*1000./V##Y=T1-T2\n", - "D2=D1*(N1/N2)##DIAMETER OF DRIVEN SHAFT\n", - "F=(D1-D2)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.-(2.*ALPHA))*PI/180.##ANGLE OF CONTACT IN radians\n", - "X=e**(U*THETA)##VALUE OF T1/T2\n", - "T1=X*Y/(X-1.)\n", - "b=T1/f##WIDTH OF THE BELT REQUIRED \n", - "##=======================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('THE WIDTH OF THE BELT IS ',b,' cm')\n", - "#apporximate ans is correct " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE WIDTH OF THE BELT IS 8.9 cm\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg62" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2 ILLUSRTATION 7 PAGE NO 62\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "m=1000.## MASS OF THE CASTING IN kg\n", - "PI=3.141\n", - "THETA=2.75*2*PI## ANGLE OF CONTACT IN radians\n", - "D=.26## DIAMETER OF DRUM IN m\n", - "N=24.## SPEED OF THE DRUM IN rpm\n", - "U=.25## COEFFICIENT OF FRICTION\n", - "e=2.71\n", - "T1=9810## TENSION ON TIGHTSIDE IN N\n", - "##=============================================================================================\n", - "##CALCULATION\n", - "T2=T1/(e**(U*THETA))## tension on slack side of belt in N\n", - "W=m*9.81## WEIGHT OF CASTING IN N\n", - "R=D/2.## RADIUS OF DRUM IN m\n", - "P=2*PI*N*W*R/60000.## POWER REQUIRED IN kW\n", - "P2=(T1-T2)*PI*D*N/60000.## POWER SUPPLIED BY DRUM IN kW\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('FORCE REQUIRED BY MAN=',T2,' N'and 'POWER REQUIRED TO RAISE CASTING=',P,' kW' 'POWER SUPPLIED BY DRUM=',P2,' kW')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FORCE REQUIRED BY MAN= 132.4 POWER REQUIRED TO RAISE CASTING= 3.2 kWPOWER SUPPLIED BY DRUM= 3.2 kW \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg62" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 8 PAGE 62\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##INPUT\n", - "t=9.##THICKNESS IN mm\n", - "b=250.##WIDTH IN mm\n", - "D=90.##DIAMETER OF PULLEY IN cm\n", - "N=336.##SPEED IN rpm\n", - "PI=3.141\n", - "U=.35##COEFFICIENT FRICTION\n", - "e=2.71\n", - "THETA=120.*PI/180.\n", - "Fb=2.##STRESS IN MPa\n", - "d=1000.##DENSITY IN KG/M**3\n", - "\n", - "##CALCULATION\n", - "M=b*10**-3.*t*10**-3.*d##MASS IN KG\n", - "V=PI*D*10**-2.*N/60.##VELOCITY IN m/s\n", - "Tc=M*V**2##CENTRIFUGAL TENSION\n", - "Tmax=b*t*Fb##MAX TENSION IN N\n", - "T1=Tmax-Tc\n", - "T2=T1/(e**(U*THETA))\n", - "P=(T1-T2)*V/1000.\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('THE TENSION ON TIGHT SIDE OF THE BELT IS',T1,' N')\n", - "print'%s %.1f %s'%('THE TENSION ON SLACK SIDE OF THE BELT IS ',T2,' N')\n", - "print'%s %.1f %s'%('CENTRIFUGAL TENSION =',Tc,'N')\n", - "print'%s %.1f %s'%('THE POWER CAPACITY OF BELT IS ',P,' KW')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE TENSION ON TIGHT SIDE OF THE BELT IS 3936.1 N\n", - "THE TENSION ON SLACK SIDE OF THE BELT IS 1895.6 N\n", - "CENTRIFUGAL TENSION = 563.9 N\n", - "THE POWER CAPACITY OF BELT IS 32.3 KW\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg63" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 9 PAGE 63\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##INPUT\n", - "P=35000.##POWER TO BE TRANSMITTED IN WATTS\n", - "D=1.5##EFFECTIVE DIAMETER OF PULLEY IN METRES\n", - "N=300.##SPEED IN rpm\n", - "e=2.71\n", - "U=.3##COEFFICIENT OF FRICTION\n", - "PI=3.141\n", - "THETA=(11/24.)*360.*PI/180.##ANGLE OF CONTACT\n", - "density=1.1##density of belt material in Mg/m**3\n", - "L=1.##in metre\n", - "t=9.5##THICKNESS OF BELT IN mm\n", - "Fb=2.5##PERMISSIBLE WORK STRESS IN N/mm**2\n", - "\n", - "##CALCULATION\n", - "V=PI*D*N/60.##VELOCITY IN m/s\n", - "X=P/V##X=T1-T2\n", - "Y=e**(U*THETA)##Y=T1/T2\n", - "T1=X*Y/(Y-1)\n", - "Mb=t*density*L/10**3.##value of m/b\n", - "Tc=Mb*V**2.##centrifugal tension/b\n", - "Tmaxb=t*Fb##max tension/b\n", - "b=T1/(Tmaxb-Tc)##thickness in mm\n", - "##output\n", - "print'%s %.1f %s'%('TENSION IN TIGHT SIDE OF THE BELT =',T1,' N')\n", - "print'%s %.1f %s'%('THICKNESS OF THE BELT IS =',b,' mm')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "TENSION IN TIGHT SIDE OF THE BELT = 2573.5 N\n", - "THICKNESS OF THE BELT IS = 143.4 mm\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg64" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 10 PAGE 64\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##INPUT\n", - "t=5.##THICKNESS OF BELT IN m\n", - "PI=3.141\n", - "U=.3\n", - "e=2.71\n", - "THETA=155.*PI/180.##ANGLE OF CONTACT IN radians\n", - "V=30.##VELOCITY IN m/s\n", - "density=1.##in m/cm**3\n", - "L=1.##LENGTH\n", - "\n", - "##calculation\n", - "Xb=80.## (T1-T2)=80b;so let (T1-T2)/b=Xb\n", - "Y=e**(U*THETA)## LET Y=T1/T2\n", - "Zb=80.*Y/(Y-1.)## LET T1/b=Zb;BY SOLVING THE ABOVE 2 EQUATIONS WE WILL GET THIS EXPRESSION\n", - "Mb=t*L*density*10**-2.## m/b in N\n", - "Tcb=Mb*V**2.## centrifugal tension/b\n", - "Tmaxb=Zb+Tcb## MAX TENSION/b\n", - "Fb=Tmaxb/t##STRESS INDUCED IN TIGHT BELT\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('THE STRESS DEVELOPED ON THE TIGHT SIDE OF BELT=',Fb,' N/cm**2')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE STRESS DEVELOPED ON THE TIGHT SIDE OF BELT= 37.8 N/cm**2\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg65" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 11 PAGE 65\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##INPUT\n", - "C=4.5## CENTRE DISTANCE IN metres\n", - "D1=1.35## DIAMETER OF LARGER PULLEY IN metres\n", - "D2=.9## DIAMETER OF SMALLER PULLEY IN metres\n", - "To=2100.## INITIAL TENSION IN newtons\n", - "b=12.## WIDTH OF BELT IN cm\n", - "t=12.## THICKNESS OF BELT IN mm\n", - "d=1.## DENSITY IN gm/cm**3\n", - "U=.3## COEFFICIENT OF FRICTION\n", - "L=1.## length in metres\n", - "PI=3.141\n", - "e=2.71\n", - "\n", - "##CALCULATION\n", - "M=b*t*d*L*10**-2.## mass of belt per metre length in KG\n", - "V=(To/3./M)**.5## VELOCITY OF FOR MAX POWER TO BE TRANSMITTED IN m/s\n", - "Tc=M*V**2.## CENTRIFUGAL TENSION IN newtons\n", - "## LET (T1+T2)=X\n", - "X=2.*To-2.*Tc ## THE VALUE OF (T1+T2)\n", - "F=(D1-D2)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", - "## LET T1/T2=Y\n", - "Y=e**(U*THETA)## THE VALUE OF T1/T2\n", - "T1=X*Y/(Y+1.)## BY SOLVING X AND Y WE WILL GET THIS EQN\n", - "T2=X-T1\n", - "P=(T1-T2)*V/1000.## MAX POWER TRANSMITTED IN kilowatts\n", - "N1=V*60./(PI*D1)## SPEED OF LARGER PULLEY IN rpm\n", - "N2=V*60./(PI*D2)## SPEED OF SMALLER PULLEY IN rpm\n", - "##OUTPUT\n", - "print'%s %.1f %s'%(' MAX POWER TO BE TRANSMITTED =',P,' KW')\n", - "print'%s %.1f %s'%(' SPEED OF THE LARGER PULLEY =',N1,' rpm')\n", - "print'%s %.1f %s'%(' SPEED OF THE SMALLER PULLEY =',N2,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " MAX POWER TO BE TRANSMITTED = 27.0 KW\n", - " SPEED OF THE LARGER PULLEY = 312.0 rpm\n", - " SPEED OF THE SMALLER PULLEY = 468.0 rpm\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg66" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 12 PAGE 66\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##============================================================================================================================\n", - "##INPUT\n", - "PI=3.141\n", - "e=2.71\n", - "D1=1.20## DIAMETER OF DRIVING SHAFT IN m\n", - "D2=.50## DIAMETER OF DRIVEN SHAFT IN m\n", - "C=4.## CENTRE DISTANCE BETWEEN THE SHAFTS IN m\n", - "M=.9## MASS OF BELT PER METRE LENGTH IN kg\n", - "Tmax=2000## MAX TENSION IN N\n", - "U=.3## COEFFICIENT OF FRICTION\n", - "N1=200.## SPEED OF DRIVING SHAFT IN rpm\n", - "N2=450.## SPEED OF DRIVEN SHAFT IN rpm\n", - "##==============================================================================================================================\n", - "##CALCULATION\n", - "V=PI*D1*N1/60.## VELOCITY OF BELT IN m/s\n", - "Tc=M*V**2.## CENTRIFUGAL TENSION IN N\n", - "T1=Tmax-Tc## TENSION ON TIGHTSIDE IN N\n", - "F=(D1-D2)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", - "T2=T1/(e**(U*THETA))## TENSION ON SLACK SIDE IN N\n", - "TL=(T1-T2)*D1/2.## TORQUE ON THE SHAFT OF LARGER PULLEY IN N-m\n", - "TS=(T1-T2)*D2/2.## TORQUE ON THE SHAFT OF SMALLER PULLEY IN N-m\n", - "P=(T1-T2)*V/1000.## POWER TRANSMITTED IN kW\n", - "Pi=2.*PI*N1*TL/60000.## INPUT POWER\n", - "Po=2.*PI*N2*TS/60000.## OUTPUT POWER\n", - "Pl=Pi-Po## POWER LOST DUE TO FRICTION IN kW\n", - "n=Po/Pi*100.## EFFICIENCY OF DRIVE IN %\n", - "##==================================================================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('TORQUE ON LARGER SHAFT =',TL,'N-m')\n", - "print'%s %.1f %s'%('TORQUE ON SMALLER SHAFT =',TS,' N-m')\n", - "print'%s %.1f %s'%('POWER TRANSMITTED =',P,' kW')\n", - "print'%s %.1f %s'%('POWER LOST DUE TO FRICTION =',Pl,' kW')\n", - "print'%s %.1f %s'%('EFFICIENCY OF DRINE =',n,' percentage')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "TORQUE ON LARGER SHAFT = 679.0 N-m\n", - "TORQUE ON SMALLER SHAFT = 282.9 N-m\n", - "POWER TRANSMITTED = 14.2 kW\n", - "POWER LOST DUE TO FRICTION = 0.9 kW\n", - "EFFICIENCY OF DRINE = 93.8 percentage\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg67" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 13 PAGE 67\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##============================================================================================================================\n", - "##INPUT\n", - "PI=3.141\n", - "e=2.71\n", - "P=90## POWER OF A COMPRESSOR IN kW\n", - "N2=250.## SPEED OF DRIVEN SHAFT IN rpm\n", - "N1=750.## SPEED OF DRIVER SHAFT IN rpm\n", - "D2=1.## DIAMETER OF DRIVEN SHAFT IN m\n", - "C=1.75## CENTRE DISTANCE IN m\n", - "V=1600./60.## VELOCITY IN m/s\n", - "a=375.## CROSECTIONAL AREA IN mm**2\n", - "density=1000.## BELT DENSITY IN kg/m**3\n", - "L=1## length to be considered\n", - "Fb=2.5## STRESSS INDUCED IN MPa\n", - "beeta=35./2.## THE GROOVE ANGLE OF PULLEY\n", - "U=.25## COEFFICIENT OF FRICTION\n", - "##=================================================================================================================================\n", - "##CALCULATION\n", - "D1=N2*D2/N1## DIAMETER OF DRIVING SHAFT IN m\n", - "m=a*density*10**-6.*L## MASS OF THE BELT IN kg\n", - "Tmax=a*Fb## MAX TENSION IN N\n", - "Tc=m*V**2.## CENTRIFUGAL TENSION IN N\n", - "T1=Tmax-Tc## TENSION ON TIGHTSIDE OF BELT IN N\n", - "F=(D2-D1)/(2.*C)\n", - "ALPHA=math.asin(F/57.3)\n", - "THETA=(180.-(2.*ALPHA))*PI/180.## ANGLE OF CONTACT IN radians\n", - "T2=T1/(e**(U*THETA/math.sin(beeta/57.3)))##TENSION ON SLACKSIDE IN N\n", - "P2=(T1-T2)*V/1000.## POWER TRANSMITTED PER BELT kW\n", - "N=P/P2## NO OF V-BELTS\n", - "N3=N+1.\n", - "##======================================================================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s '%('NO OF BELTS REQUIRED TO TRANSMIT POWER=',N,' APPROXIMATELY=',N3,'')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "NO OF BELTS REQUIRED TO TRANSMIT POWER= 5.4 APPROXIMATELY= 6.4 \n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg68" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 2,ILLUSTRATION 14 PAGE 68\n", - "##TITLE:TRANSMISSION OF MOTION AND POWER BY BELTS AND PULLEYS\n", - "import math\n", - "##============================================================================================================================\n", - "##INPUT\n", - "PI=3.141\n", - "e=2.71\n", - "P=75.## POWER IN kW\n", - "D=1.5## DIAMETER OF PULLEY IN m\n", - "U=.3## COEFFICIENT OF FRICTION\n", - "beeta=45./2.## GROOVE ANGLE\n", - "THETA=160.*PI/180.## ANGLE OF CONTACT IN radians\n", - "m=.6## MASS OF BELT IN kg/m\n", - "Tmax=800.## MAX TENSION IN N\n", - "N=200.## SPEED OF SHAFT IN rpm\n", - "##=============================================================================================================================\n", - "##calculation\n", - "V=PI*D*N/60.## VELOCITY OF ROPE IN m/s\n", - "Tc=m*V**2.## CENTRIFUGAL TENSION IN N\n", - "T1=Tmax-Tc## TENSION ON TIGHT SIDE IN N\n", - "T2=T1/(e**(U*THETA/math.sin(beeta/57.3)))##TENSION ON SLACKSIDE IN N\n", - "P2=(T1-T2)*V/1000.## POWER TRANSMITTED PER BELT kW\n", - "No=P/P2## NO OF V-BELTS\n", - "N3=No+1.## ROUNDING OFF\n", - "To=(T1+T2+Tc*2.)/2.## INITIAL TENSION\n", - "##================================================================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s '%('NO OF BELTS REQUIRED TO TRANSMIT POWER=',No,'' 'APPROXIMATELY=',N3,'')\n", - "print'%s %.1f %s'%('INITIAL ROPE TENSION=',To,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "NO OF BELTS REQUIRED TO TRANSMIT POWER= 8.3 APPROXIMATELY= 9.3 \n", - "INITIAL ROPE TENSION= 510.8 N\n" - ] - } - ], - "prompt_number": 16 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter3.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter3.ipynb deleted file mode 100755 index 74818ab4..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter3.ipynb +++ /dev/null @@ -1,782 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:9f3aa65b257e3f2aa586660a443f5f27bf555a236ce21a3b4fb7b3ab1cf26f12" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter3-FRICTION" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg102" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 1 PAGE NO 102\n", - "##TITLE:FRICTION\n", - "##FIRURE 3.16(a),3.16(b)\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "P1=180.## PULL APPLIED TO THE BODY IN NEWTONS\n", - "theta=30.## ANGLE AT WHICH P IS ACTING IN DEGREES\n", - "P2=220.## PUSH APPLIED TO THE BODY IN NEWTONS\n", - "##Rn= NORMAL REACTION\n", - "##F= FORCE OF FRICTION IN NEWTONS\n", - "##U= COEFFICIENT OF FRICTION\n", - "##W= WEIGHT OF THE BODY IN NEWTON\n", - "##==========================================================================================\n", - "##CALCULATION\n", - "F1=P1*math.cos(theta/57.3)## RESOLVING FORCES HORIZONTALLY FROM 3.16(a)\n", - "F2=P2*math.cos(theta/57.3)## RESOLVING FORCES HORIZONTALLY FROM 3.16(b)\n", - "## RESOLVING FORCES VERTICALLY Rn1=W-P1*sind(theta) from 3.16(a)\n", - "## RESOLVING FORCES VERTICALLY Rn2=W+P1*sind(theta) from 3.16(b)\n", - "## USING THE RELATION F1=U*Rn1 & F2=U*Rn2 AND SOLVING FOR W BY DIVIDING THESE TWO EQUATIONS\n", - "X=F1/F2## THIS IS THE VALUE OF Rn1/Rn2\n", - "Y1=P1*math.sin(theta/57.3)\n", - "Y2=P2*math.sin(theta/57.3)\n", - "W=(Y2*X+Y1)/(1-X)## BY SOLVING ABOVE 3 EQUATIONS\n", - "U=F1/(W-P1*math.sin(theta/57.3))## COEFFICIENT OF FRICTION\n", - "##=============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s '%('WEIGHT OF THE BODY =',W,'N''THE COEFFICIENT OF FRICTION =',U,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "WEIGHT OF THE BODY = 989.9 NTHE COEFFICIENT OF FRICTION = 0.2 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg103" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 2 PAGE NO 103\n", - "##TITLE:FRICTION\n", - "##FIRURE 3.17\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "THETA=45## ANGLE OF INCLINATION IN DEGREES\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N/mm**2\n", - "U=.1## COEFFICIENT FRICTION\n", - "##Rn=NORMAL REACTION\n", - "##M=MASS IN NEWTONS\n", - "##f=ACCELERATION OF THE BODY\n", - "u=0.## INITIAL VELOCITY\n", - "V=10.## FINAL VELOCITY IN m/s**2\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "##CONSIDER THE EQUILIBRIUM OF FORCES PERPENDICULAR TO THE PLANE\n", - "##Rn=Mgcos(THETA)\n", - "##CONSIDER THE EQUILIBRIUM OF FORCES ALONG THE PLANE\n", - "##Mgsin(THETA)-U*Rn=M*f.............BY SOLVING THESE 2 EQUATIONS \n", - "f=g*math.sin(THETA/57.3)-U*g*math.cos(THETA/57.3)\n", - "s=(V**2-u**2)/(2*f)## DISTANCE ALONG THE PLANE IN metres\n", - "##==============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('DISTANCE ALONG THE INCLINED PLANE=',s,' m')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "DISTANCE ALONG THE INCLINED PLANE= 8.0 m\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg104" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 3 PAGE NO 104\n", - "##TITLE:FRICTION\n", - "##FIRURE 3.18\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "W=500.## WEGHT IN NEWTONS\n", - "THETA=30.## ANGLE OF INCLINATION IN DEGRESS\n", - "U=0.2## COEFFICIENT FRICTION\n", - "S=15.## DISTANCE IN metres\n", - "##============================================================================================\n", - "Rn=W*math.cos(THETA/57.3)## NORMAL REACTION IN NEWTONS\n", - "P=W*math.sin(THETA/57.3)+U*Rn## PUSHING FORCE ALONG THE DIRECTION OF MOTION\n", - "w=P*S\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('WORK DONE BY THE FORCE=',w,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "WORK DONE BY THE FORCE= 5048.8 N-m\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg104" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 4 PAGE NO 104\n", - "##TITLE:FRICTION\n", - "##FIRURE 3.19(a) & 3.19(b)\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "P1=2000.## FORCE ACTING UPWARDS WHEN ANGLE=15 degrees IN NEWTONS\n", - "P2=2300.## FORCE ACTING UPWARDS WHEN ANGLE=20 degrees IN NEWTONS\n", - "THETA1=15.## ANGLE OF INCLINATION IN 3.19(a)\n", - "THETA2=20.## ANGLE OF INCLINATION IN 3.19(b)\n", - "##F1= FORCE OF FRICTION IN 3.19(a)\n", - "##Rn1= NORMAL REACTION IN 3.19(a)\n", - "##F2= FORCE OF FRICTION IN 3.19(b)\n", - "##Rn2= NORMAL REACTION IN 3.19(b)\n", - "##U= COEFFICIENT OF FRICTION\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "##P1=F1+Rn1 RESOLVING THE FORCES ALONG THE PLANE\n", - "##Rn1=W*cosd(THETA1)....NORMAL REACTION IN 3.19(a)\n", - "##F1=U*Rn1\n", - "##BY SOLVING ABOVE EQUATIONS P1=W(U*cosd(THETA1)+sind(THETA1))---------------------1\n", - "##P2=F2+Rn2 RESOLVING THE FORCES PERPENDICULAR TO THE PLANE\n", - "##Rn2=W*cosd(THETA2)....NORMAL REACTION IN 3.19(b)\n", - "##F2=U*Rn2\n", - "##BY SOLVING ABOVE EQUATIONS P2=W(U*cosd(THETA2)+sind(THETA2))----------------------2\n", - "##BY SOLVING EQUATIONS 1 AND 2\n", - "X=P2/P1\n", - "U=(math.sin(THETA2/57.3)-(X*math.sin(THETA1/57.3)))/((X*math.cos(THETA1/57.3)-math.cos(THETA2/57.3)))## COEFFICIENT OF FRICTION\n", - "W=P1/(U*math.cos(THETA1/57.3)+math.sin(THETA1/57.3))\n", - "##=============================================================================================\n", - "##OUTPUT\n", - "##print'%s %.1f %s'%('%f',X)\n", - "print'%s %.1f %s %.1f %s '%('COEFFICIENT OF FRICTION=',U,'' 'WEIGHT OF THE BODY=',W,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "COEFFICIENT OF FRICTION= 0.3 WEIGHT OF THE BODY= 3927.0 N \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg105" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 5 PAGE NO 105\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=5.## DIAMETER OF SCREW JACK IN cm\n", - "p=1.25## PITCH IN cm\n", - "l=50.## LENGTH IN cm\n", - "U=.1## COEFFICIENT OF FRICTION\n", - "W=20000.## LOAD IN NEWTONS\n", - "PI=3.147\n", - "##=============================================================================================\n", - "##CALCULATION\n", - "ALPHA=math.atan((p/(PI*d)/57.3))\n", - "PY=math.atan(U/57.3)\n", - "P=W*math.tan((ALPHA+PY)*57.)\n", - "P1=P*d/(2.*l)\n", - "##=============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s '%('THE AMOUNT OF EFFORT NEED TO APPLY =',P1,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE AMOUNT OF EFFORT NEED TO APPLY = 180.4 N \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg106" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 6 PAGE NO 106\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=50.## DIAMETER OF SCREW IN mm\n", - "p=12.5## PITCH IN mm\n", - "U=0.13## COEFFICIENT OF FRICTION\n", - "W=25000.## LOAD IN mm\n", - "PI=3.147\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "ALPHA=math.atan((p/(PI*d))/57.3)\n", - "PY=math.atan(U/57.3)\n", - "P=W*math.tan((ALPHA+PY)/57.3)## FORCE REQUIRED TO RAISE THE LOAD IN N\n", - "T1=P*d/2.## TORQUE REQUIRED IN Nm\n", - "P1=W*math.tan((PY-ALPHA)/57.3)## FORCE REQUIRED TO LOWER THE SCREW IN N\n", - "T2=P1*d/2.## TORQUE IN N\n", - "X=T1/T2## RATIOS REQUIRED\n", - "n=math.tan((ALPHA/(ALPHA+PY))/57.3)## EFFICIENCY\n", - "##============================================================================================\n", - "print'%s %.1f %s'%('RATIO OF THE TORQUE REQUIRED TO RAISE THE LOAD,TO THE TORQUE REQUIRED TO LOWER THE LOAD =',X,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "RATIO OF THE TORQUE REQUIRED TO RAISE THE LOAD,TO THE TORQUE REQUIRED TO LOWER THE LOAD = 4.1 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg107" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 7 PAGE NO 107\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=39.## DIAMETER OF THREAD IN mm\n", - "p=13.## PITCH IN mm\n", - "U=0.1## COEFFICIENT OF FRICTION\n", - "W=2500.## LOAD IN mm\n", - "PI=3.147\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "ALPHA=math.atan((p/(PI*d))/57.3)\n", - "PY=math.atan(U/57.3)\n", - "P=W*math.tan((ALPHA+PY)*57.3)## FORCE IN N\n", - "T1=P*d/2.## TORQUE REQUIRED IN Nm\n", - "T=2.*T1## TORQUE REQUIRED ON THE COUPLING ROD IN Nm\n", - "K=2.*p## DISTANCE TRAVELLED FOR ONE REVOLUTION\n", - "N=20.8/K## NO OF REVOLUTIONS REQUIRED\n", - "w=2.*PI*N*T/100.## WORKDONE BY TORQUE\n", - "w1=w*(7500.-2500.)/2500.## WORKDONE TO INCREASE THE LOAD FROM 2500N TO 7500N\n", - "n=math.tan(ALPHA/57.3)/math.tan((ALPHA+PY)/57.3)## EFFICIENCY\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('workdone against a steady load of 2500N=',w,' N' 'workdone if the load is increased from 2500N to 7500N=',w1,' N' 'efficiency=',n,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "workdone against a steady load of 2500N= 1025.5 Nworkdone if the load is increased from 2500N to 7500N= 2050.9 Nefficiency= 0.5 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg107" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 8 PAGE NO 107\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "W=50000.## WEIGHT OF THE SLUICE GATE IN NEWTON\n", - "P=40000.## POWER IN WATTS\n", - "N=580.## MAX MOTOR RUNNING SPEEED IN rpm\n", - "d=12.5## DIAMETER OF THE SCREW IN cm\n", - "p=2.5## PITCH IN cm\n", - "PI=3.147\n", - "U1=.08## COEFFICIENT OF FRICTION for SCREW\n", - "U2=.1## C.O.F BETWEEN GATES AND SCREW\n", - "Np=2000000.## NORMAL PRESSURE IN NEWTON\n", - "Fl=.15## FRICTION LOSS\n", - "n=1.-Fl## EFFICIENCY\n", - "ng=80.## NO OF TEETH ON GEAR\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "TV=W+U2*Np## TOTAL VERTICAL HEAD IN NEWTON\n", - "ALPHA=math.atan((p/(PI*d))/57.3)## \n", - "PY=math.atan(U1/57.3)## \n", - "P1=TV*math.tan((ALPHA+PY)*57.3)## FORCE IN N\n", - "T=P1*d/2./100.## TORQUE IN N-m\n", - "Ng=60000.*n*P*10**-3./(2.*PI*T)## SPEED OF GEAR IN rpm\n", - "np=Ng*ng/N## NO OF TEETH ON PINION\n", - "##=========================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s '%('NO OF TEETH ON PINION =',np,' say ',np+1,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "NO OF TEETH ON PINION = 19.8 say 20.8 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg108" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 9 PAGE NO 108\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=5.## MEAN DIAMETER OF SCREW IN cm\n", - "p=1.25## PITCH IN cm\n", - "W=10000.## LOAD AVAILABLE IN NEWTONS\n", - "dc=6.## MEAN DIAMETER OF COLLAR IN cm\n", - "U=.15## COEFFICIENT OF FRICTION OF SCREW\n", - "Uc=.18## COEFFICIENT OF FRICTION OF COLLAR\n", - "P1=100.## TANGENTIAL FORCE APPLIED IN NEWTON\n", - "PI=3.147\n", - "##============================================================================================\n", - "##CALCULATION\n", - "ALPHA=math.atan((p/(PI*d))/57.3)## \n", - "PY=math.atan(U/57.3)## \n", - "T1=W*d/2*math.tan((ALPHA+PY)/100)*57.3## TORQUE ON SCREW IN NEWTON\n", - "Tc=Uc*W*dc/2./100.## TORQUE ON COLLAR IN NEWTON\n", - "T=T1+Tc## TOTAL TORQUE\n", - "D=2.*T/P1/2.*100.## DIAMETER OF HAND WHEEL IN cm\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('SUITABLE DIAMETER OF HAND WHEEL =',D,' cm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "SUITABLE DIAMETER OF HAND WHEEL = 111.4 cm\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg108" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 10 PAGE NO 108\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "d=2.5## MEAN DIA OF BOLT IN cm\n", - "p=.6## PITCH IN cm\n", - "beeta=55/2.## VEE ANGLE\n", - "dc=4.## DIA OF COLLAR IN cm\n", - "U=.1## COEFFICIENT OF FRICTION OF BOLT\n", - "Uc=.18## COEFFICIENT OF FRICTION OF COLLAR\n", - "W=6500.## LOAD ON BOLT IN NEWTONS\n", - "L=38.## LENGTH OF SPANNER\n", - "##=============================================================================================\n", - "##CALCULATION\n", - "##LET X=tan(py)/tan(beeta)\n", - "##y=tan(ALPHA)*X\n", - "PY=math.atan(U)*57.3\n", - "ALPHA=math.atan((p/(PI*d)))*57.3\n", - "X=math.tan(PY/57.3)/math.cos(beeta/57.3)\n", - "Y=math.tan(ALPHA/57.3)\n", - "T1=W*d/2.*10**-2*(X+Y)/(1.-(X*Y))## TORQUE IN SCREW IN N-m\n", - "Tc=Uc*W*dc/2.*10**-2## TORQUE ON BEARING SERVICES IN N-m\n", - "T=T1+Tc## TOTAL TORQUE \n", - "P1=T/L*100.## FORCE REQUIRED BY @ THE END OF SPANNER\n", - "##=============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('FORCE REQUIRED @ THE END OF SPANNER=',P1,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FORCE REQUIRED @ THE END OF SPANNER= 102.3 N\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg109" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 11 PAGE NO 109\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d1=15.## DIAMETER OF VERTICAL SHAFT IN cm\n", - "N=100.## SPEED OF THE MOTOR rpm\n", - "W=20000.## LOAD AVILABLE IN N\n", - "U=.05## COEFFICIENT OF FRICTION\n", - "PI=3.147\n", - "##==================================================================================\n", - "T=2./3.*U*W*d1/2.## FRICTIONAL TORQUE IN N-m\n", - "PL=2.*PI*N*T/100./60.## POWER LOST IN FRICTION IN WATTS\n", - "##==================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('POWER LOST IN FRICTION=',PL,' watts')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "POWER LOST IN FRICTION= 524.5 watts\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg109" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 12 PAGE NO 109\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "d2=.30## DIAMETER OF SHAFT IN m \n", - "W=200000.## LOAD AVAILABLE IN NEWTONS\n", - "N=75.## SPEED IN rpm\n", - "U=.05## COEFFICIENT OF FRICTION\n", - "p=300000.## PRESSURE AVAILABLE IN N/m**2\n", - "P=16200.## POWER LOST DUE TO FRICTION IN WATTS\n", - "##====================================================================================\n", - "##CaLCULATION\n", - "T=P*60./2./PI/N## TORQUE INDUCED IN THE SHFT IN N-m\n", - "##LET X=(r1**3-r2**3)/(r1**2-r2**2)\n", - "X=(3./2.*T/U/W)\n", - "r2=.15## SINCE d2=.30 m\n", - "c=r2**2.-(X*r2)\n", - "b= r2-X\n", - "a= 1.\n", - "r1=( -b+ math.sqrt (b**2. -4.*a*c ))/(2.* a);## VALUE OF r1 IN m\n", - "d1=2*r1*100.## d1 IN cm\n", - "n=W/(PI*p*(r1**2.-r2**2.))\n", - "##================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('EXTERNAL DIAMETER OF SHAFT =',d1,' cm''NO OF COLLARS REQUIRED =',n,'' '0 or ',n+1,'')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "EXTERNAL DIAMETER OF SHAFT = 50.6 cmNO OF COLLARS REQUIRED = 5.1 0 or 6.1 \n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg111" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 13 PAGE NO 111\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "W=20000.## LOAD IN NEWTONS\n", - "ALPHA=120./2.## CONE ANGLE IN DEGREES\n", - "p=350000.## INTENSITY OF PRESSURE\n", - "U=.06\n", - "N=120.## SPEED OF THE SHAFT IN rpm\n", - "##d1=3d2\n", - "##r1=3r2\n", - "##===================================================================================\n", - "##CALCULATION\n", - "##LET K=d1/d2\n", - "k=3.\n", - "Z=W/((k**2.-1.)*PI*p)\n", - "r2=Z**.5## INTERNAL RADIUS IN m\n", - "r1=3.*r2\n", - "T=2.*U*W*(r1**3.-r2**3.)/(3.*math.sin(60/57.3)*(r1**2.-r2**2.))## total frictional torque in N\n", - "P=2.*PI*N*T/60000.## power absorbed in friction in kW\n", - "##================================================================================\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('THE INTERNAL DIAMETER OF SHAFT =',r2*100,' cm' 'THE EXTERNAL DIAMETER OF SHAFT =',r1*100,' cm' 'POWER ABSORBED IN FRICTION =',P,' kW')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE INTERNAL DIAMETER OF SHAFT = 4.8 cmTHE EXTERNAL DIAMETER OF SHAFT = 14.3 cmPOWER ABSORBED IN FRICTION = 1.8 kW\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg111" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 14 PAGE NO 111\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "P=10000.## POWER TRRANSMITTED BY CLUTCH IN WATTS\n", - "N=3000.## SPEED IN rpm\n", - "p=.09## AXIAL PRESSURE IN N/mm**2\n", - "##d1=1.4d2 RELATION BETWEEN DIAMETERS \n", - "K=1.4## D1/D2\n", - "n=2.\n", - "U=.3## COEFFICIENT OF FRICTION\n", - "##==========================================================================================\n", - "T=P*60000./1000./(2.*PI*N)## ASSUMING UNIFORM WEAR TORQUE IN N-m\n", - "r2=(T*2./(n*U*2.*PI*p*10**6.*(K-1.)*(K+1.)))**(1./3.)## INTERNAL RADIUS\n", - "\n", - "##===========================================================================================\n", - "print'%s %.1f %s %.1f %s '%('THE INTERNAL RADIUS =',r2*100,' cm' 'THE EXTERNAL RADIUS =',K*r2*100,' cm')\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE INTERNAL RADIUS = 5.8 cmTHE EXTERNAL RADIUS = 8.1 cm \n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg111" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 14 PAGE NO 111\n", - "##TITLE:FRICTION\n", - "\n", - "\n", - "\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "n1=3.## NO OF DICS ON DRIVING SHAFTS\n", - "n2=2.## NO OF DICS ON DRIVEN SHAFTS\n", - "d1=30.## DIAMETER OF DRIVING SHAFT IN cm\n", - "d2=15.## DIAMETER OF DRIVEN SHAFT IN cm\n", - "r1=d1/2.\n", - "r2=d2/2.\n", - "U=.3## COEFFICIENT FRICTION\n", - "P=30000.## TANSMITTING POWER IN WATTS\n", - "N=1800.## SPEED IN rpm\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "n=n1+n2-1.## NO OF PAIRS OF CONTACT SURFACES\n", - "T=P*60000./(2.*PI*N)## TORQUE IN N-m\n", - "W=2.*T/(n*U*(r1+r2)*10.)## LOAD IN N\n", - "k=W/(2.*PI*(r1-r2))\n", - "p=k/r2/100.## MAX AXIAL INTENSITY OF PRESSURE IN N/mm**2\n", - "##===========================================================================================\n", - "## OUTPUT\n", - "print'%s %.3f %s'%('MAX AXIAL INTENSITY OF PRESSURE =',p,' N/mm^2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "MAX AXIAL INTENSITY OF PRESSURE = 0.033 N/mm**2\n" - ] - } - ], - "prompt_number": 15 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter3_1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter3_1.ipynb deleted file mode 100755 index 4627cb85..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter3_1.ipynb +++ /dev/null @@ -1,782 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:ed29195d644d35d300520425c16527a56484dc795844df5cf2a4a874db8c58d2" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter3-Friction" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg102" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 1 PAGE NO 102\n", - "##TITLE:FRICTION\n", - "##FIRURE 3.16(a),3.16(b)\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "P1=180.## PULL APPLIED TO THE BODY IN NEWTONS\n", - "theta=30.## ANGLE AT WHICH P IS ACTING IN DEGREES\n", - "P2=220.## PUSH APPLIED TO THE BODY IN NEWTONS\n", - "##Rn= NORMAL REACTION\n", - "##F= FORCE OF FRICTION IN NEWTONS\n", - "##U= COEFFICIENT OF FRICTION\n", - "##W= WEIGHT OF THE BODY IN NEWTON\n", - "##==========================================================================================\n", - "##CALCULATION\n", - "F1=P1*math.cos(theta/57.3)## RESOLVING FORCES HORIZONTALLY FROM 3.16(a)\n", - "F2=P2*math.cos(theta/57.3)## RESOLVING FORCES HORIZONTALLY FROM 3.16(b)\n", - "## RESOLVING FORCES VERTICALLY Rn1=W-P1*sind(theta) from 3.16(a)\n", - "## RESOLVING FORCES VERTICALLY Rn2=W+P1*sind(theta) from 3.16(b)\n", - "## USING THE RELATION F1=U*Rn1 & F2=U*Rn2 AND SOLVING FOR W BY DIVIDING THESE TWO EQUATIONS\n", - "X=F1/F2## THIS IS THE VALUE OF Rn1/Rn2\n", - "Y1=P1*math.sin(theta/57.3)\n", - "Y2=P2*math.sin(theta/57.3)\n", - "W=(Y2*X+Y1)/(1-X)## BY SOLVING ABOVE 3 EQUATIONS\n", - "U=F1/(W-P1*math.sin(theta/57.3))## COEFFICIENT OF FRICTION\n", - "##=============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s '%('WEIGHT OF THE BODY =',W,'N''THE COEFFICIENT OF FRICTION =',U,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "WEIGHT OF THE BODY = 989.9 NTHE COEFFICIENT OF FRICTION = 0.2 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg103" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 2 PAGE NO 103\n", - "##TITLE:FRICTION\n", - "##FIRURE 3.17\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "THETA=45## ANGLE OF INCLINATION IN DEGREES\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N/mm**2\n", - "U=.1## COEFFICIENT FRICTION\n", - "##Rn=NORMAL REACTION\n", - "##M=MASS IN NEWTONS\n", - "##f=ACCELERATION OF THE BODY\n", - "u=0.## INITIAL VELOCITY\n", - "V=10.## FINAL VELOCITY IN m/s**2\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "##CONSIDER THE EQUILIBRIUM OF FORCES PERPENDICULAR TO THE PLANE\n", - "##Rn=Mgcos(THETA)\n", - "##CONSIDER THE EQUILIBRIUM OF FORCES ALONG THE PLANE\n", - "##Mgsin(THETA)-U*Rn=M*f.............BY SOLVING THESE 2 EQUATIONS \n", - "f=g*math.sin(THETA/57.3)-U*g*math.cos(THETA/57.3)\n", - "s=(V**2-u**2)/(2*f)## DISTANCE ALONG THE PLANE IN metres\n", - "##==============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('DISTANCE ALONG THE INCLINED PLANE=',s,' m')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "DISTANCE ALONG THE INCLINED PLANE= 8.0 m\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg104" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 3 PAGE NO 104\n", - "##TITLE:FRICTION\n", - "##FIRURE 3.18\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "W=500.## WEGHT IN NEWTONS\n", - "THETA=30.## ANGLE OF INCLINATION IN DEGRESS\n", - "U=0.2## COEFFICIENT FRICTION\n", - "S=15.## DISTANCE IN metres\n", - "##============================================================================================\n", - "Rn=W*math.cos(THETA/57.3)## NORMAL REACTION IN NEWTONS\n", - "P=W*math.sin(THETA/57.3)+U*Rn## PUSHING FORCE ALONG THE DIRECTION OF MOTION\n", - "w=P*S\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('WORK DONE BY THE FORCE=',w,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "WORK DONE BY THE FORCE= 5048.8 N-m\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg104" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 4 PAGE NO 104\n", - "##TITLE:FRICTION\n", - "##FIRURE 3.19(a) & 3.19(b)\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "P1=2000.## FORCE ACTING UPWARDS WHEN ANGLE=15 degrees IN NEWTONS\n", - "P2=2300.## FORCE ACTING UPWARDS WHEN ANGLE=20 degrees IN NEWTONS\n", - "THETA1=15.## ANGLE OF INCLINATION IN 3.19(a)\n", - "THETA2=20.## ANGLE OF INCLINATION IN 3.19(b)\n", - "##F1= FORCE OF FRICTION IN 3.19(a)\n", - "##Rn1= NORMAL REACTION IN 3.19(a)\n", - "##F2= FORCE OF FRICTION IN 3.19(b)\n", - "##Rn2= NORMAL REACTION IN 3.19(b)\n", - "##U= COEFFICIENT OF FRICTION\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "##P1=F1+Rn1 RESOLVING THE FORCES ALONG THE PLANE\n", - "##Rn1=W*cosd(THETA1)....NORMAL REACTION IN 3.19(a)\n", - "##F1=U*Rn1\n", - "##BY SOLVING ABOVE EQUATIONS P1=W(U*cosd(THETA1)+sind(THETA1))---------------------1\n", - "##P2=F2+Rn2 RESOLVING THE FORCES PERPENDICULAR TO THE PLANE\n", - "##Rn2=W*cosd(THETA2)....NORMAL REACTION IN 3.19(b)\n", - "##F2=U*Rn2\n", - "##BY SOLVING ABOVE EQUATIONS P2=W(U*cosd(THETA2)+sind(THETA2))----------------------2\n", - "##BY SOLVING EQUATIONS 1 AND 2\n", - "X=P2/P1\n", - "U=(math.sin(THETA2/57.3)-(X*math.sin(THETA1/57.3)))/((X*math.cos(THETA1/57.3)-math.cos(THETA2/57.3)))## COEFFICIENT OF FRICTION\n", - "W=P1/(U*math.cos(THETA1/57.3)+math.sin(THETA1/57.3))\n", - "##=============================================================================================\n", - "##OUTPUT\n", - "##print'%s %.1f %s'%('%f',X)\n", - "print'%s %.1f %s %.1f %s '%('COEFFICIENT OF FRICTION=',U,'' 'WEIGHT OF THE BODY=',W,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "COEFFICIENT OF FRICTION= 0.3 WEIGHT OF THE BODY= 3927.0 N \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg105" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 5 PAGE NO 105\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=5.## DIAMETER OF SCREW JACK IN cm\n", - "p=1.25## PITCH IN cm\n", - "l=50.## LENGTH IN cm\n", - "U=.1## COEFFICIENT OF FRICTION\n", - "W=20000.## LOAD IN NEWTONS\n", - "PI=3.147\n", - "##=============================================================================================\n", - "##CALCULATION\n", - "ALPHA=math.atan((p/(PI*d)/57.3))\n", - "PY=math.atan(U/57.3)\n", - "P=W*math.tan((ALPHA+PY)*57.)\n", - "P1=P*d/(2.*l)\n", - "##=============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s '%('THE AMOUNT OF EFFORT NEED TO APPLY =',P1,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE AMOUNT OF EFFORT NEED TO APPLY = 180.4 N \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg106" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 6 PAGE NO 106\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=50.## DIAMETER OF SCREW IN mm\n", - "p=12.5## PITCH IN mm\n", - "U=0.13## COEFFICIENT OF FRICTION\n", - "W=25000.## LOAD IN mm\n", - "PI=3.147\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "ALPHA=math.atan((p/(PI*d))/57.3)\n", - "PY=math.atan(U/57.3)\n", - "P=W*math.tan((ALPHA+PY)/57.3)## FORCE REQUIRED TO RAISE THE LOAD IN N\n", - "T1=P*d/2.## TORQUE REQUIRED IN Nm\n", - "P1=W*math.tan((PY-ALPHA)/57.3)## FORCE REQUIRED TO LOWER THE SCREW IN N\n", - "T2=P1*d/2.## TORQUE IN N\n", - "X=T1/T2## RATIOS REQUIRED\n", - "n=math.tan((ALPHA/(ALPHA+PY))/57.3)## EFFICIENCY\n", - "##============================================================================================\n", - "print'%s %.1f %s'%('RATIO OF THE TORQUE REQUIRED TO RAISE THE LOAD,TO THE TORQUE REQUIRED TO LOWER THE LOAD =',X,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "RATIO OF THE TORQUE REQUIRED TO RAISE THE LOAD,TO THE TORQUE REQUIRED TO LOWER THE LOAD = 4.1 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg107" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 7 PAGE NO 107\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=39.## DIAMETER OF THREAD IN mm\n", - "p=13.## PITCH IN mm\n", - "U=0.1## COEFFICIENT OF FRICTION\n", - "W=2500.## LOAD IN mm\n", - "PI=3.147\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "ALPHA=math.atan((p/(PI*d))/57.3)\n", - "PY=math.atan(U/57.3)\n", - "P=W*math.tan((ALPHA+PY)*57.3)## FORCE IN N\n", - "T1=P*d/2.## TORQUE REQUIRED IN Nm\n", - "T=2.*T1## TORQUE REQUIRED ON THE COUPLING ROD IN Nm\n", - "K=2.*p## DISTANCE TRAVELLED FOR ONE REVOLUTION\n", - "N=20.8/K## NO OF REVOLUTIONS REQUIRED\n", - "w=2.*PI*N*T/100.## WORKDONE BY TORQUE\n", - "w1=w*(7500.-2500.)/2500.## WORKDONE TO INCREASE THE LOAD FROM 2500N TO 7500N\n", - "n=math.tan(ALPHA/57.3)/math.tan((ALPHA+PY)/57.3)## EFFICIENCY\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('workdone against a steady load of 2500N=',w,' N' 'workdone if the load is increased from 2500N to 7500N=',w1,' N' 'efficiency=',n,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "workdone against a steady load of 2500N= 1025.5 Nworkdone if the load is increased from 2500N to 7500N= 2050.9 Nefficiency= 0.5 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg107" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 8 PAGE NO 107\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "W=50000.## WEIGHT OF THE SLUICE GATE IN NEWTON\n", - "P=40000.## POWER IN WATTS\n", - "N=580.## MAX MOTOR RUNNING SPEEED IN rpm\n", - "d=12.5## DIAMETER OF THE SCREW IN cm\n", - "p=2.5## PITCH IN cm\n", - "PI=3.147\n", - "U1=.08## COEFFICIENT OF FRICTION for SCREW\n", - "U2=.1## C.O.F BETWEEN GATES AND SCREW\n", - "Np=2000000.## NORMAL PRESSURE IN NEWTON\n", - "Fl=.15## FRICTION LOSS\n", - "n=1.-Fl## EFFICIENCY\n", - "ng=80.## NO OF TEETH ON GEAR\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "TV=W+U2*Np## TOTAL VERTICAL HEAD IN NEWTON\n", - "ALPHA=math.atan((p/(PI*d))/57.3)## \n", - "PY=math.atan(U1/57.3)## \n", - "P1=TV*math.tan((ALPHA+PY)*57.3)## FORCE IN N\n", - "T=P1*d/2./100.## TORQUE IN N-m\n", - "Ng=60000.*n*P*10**-3./(2.*PI*T)## SPEED OF GEAR IN rpm\n", - "np=Ng*ng/N## NO OF TEETH ON PINION\n", - "##=========================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s '%('NO OF TEETH ON PINION =',np,' say ',np+1,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "NO OF TEETH ON PINION = 19.8 say 20.8 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg108" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 9 PAGE NO 108\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d=5.## MEAN DIAMETER OF SCREW IN cm\n", - "p=1.25## PITCH IN cm\n", - "W=10000.## LOAD AVAILABLE IN NEWTONS\n", - "dc=6.## MEAN DIAMETER OF COLLAR IN cm\n", - "U=.15## COEFFICIENT OF FRICTION OF SCREW\n", - "Uc=.18## COEFFICIENT OF FRICTION OF COLLAR\n", - "P1=100.## TANGENTIAL FORCE APPLIED IN NEWTON\n", - "PI=3.147\n", - "##============================================================================================\n", - "##CALCULATION\n", - "ALPHA=math.atan((p/(PI*d))/57.3)## \n", - "PY=math.atan(U/57.3)## \n", - "T1=W*d/2*math.tan((ALPHA+PY)/100)*57.3## TORQUE ON SCREW IN NEWTON\n", - "Tc=Uc*W*dc/2./100.## TORQUE ON COLLAR IN NEWTON\n", - "T=T1+Tc## TOTAL TORQUE\n", - "D=2.*T/P1/2.*100.## DIAMETER OF HAND WHEEL IN cm\n", - "##============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('SUITABLE DIAMETER OF HAND WHEEL =',D,' cm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "SUITABLE DIAMETER OF HAND WHEEL = 111.4 cm\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg108" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 10 PAGE NO 108\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "d=2.5## MEAN DIA OF BOLT IN cm\n", - "p=.6## PITCH IN cm\n", - "beeta=55/2.## VEE ANGLE\n", - "dc=4.## DIA OF COLLAR IN cm\n", - "U=.1## COEFFICIENT OF FRICTION OF BOLT\n", - "Uc=.18## COEFFICIENT OF FRICTION OF COLLAR\n", - "W=6500.## LOAD ON BOLT IN NEWTONS\n", - "L=38.## LENGTH OF SPANNER\n", - "##=============================================================================================\n", - "##CALCULATION\n", - "##LET X=tan(py)/tan(beeta)\n", - "##y=tan(ALPHA)*X\n", - "PY=math.atan(U)*57.3\n", - "ALPHA=math.atan((p/(PI*d)))*57.3\n", - "X=math.tan(PY/57.3)/math.cos(beeta/57.3)\n", - "Y=math.tan(ALPHA/57.3)\n", - "T1=W*d/2.*10**-2*(X+Y)/(1.-(X*Y))## TORQUE IN SCREW IN N-m\n", - "Tc=Uc*W*dc/2.*10**-2## TORQUE ON BEARING SERVICES IN N-m\n", - "T=T1+Tc## TOTAL TORQUE \n", - "P1=T/L*100.## FORCE REQUIRED BY @ THE END OF SPANNER\n", - "##=============================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('FORCE REQUIRED @ THE END OF SPANNER=',P1,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "FORCE REQUIRED @ THE END OF SPANNER= 102.3 N\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg109" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 11 PAGE NO 109\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "d1=15.## DIAMETER OF VERTICAL SHAFT IN cm\n", - "N=100.## SPEED OF THE MOTOR rpm\n", - "W=20000.## LOAD AVILABLE IN N\n", - "U=.05## COEFFICIENT OF FRICTION\n", - "PI=3.147\n", - "##==================================================================================\n", - "T=2./3.*U*W*d1/2.## FRICTIONAL TORQUE IN N-m\n", - "PL=2.*PI*N*T/100./60.## POWER LOST IN FRICTION IN WATTS\n", - "##==================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('POWER LOST IN FRICTION=',PL,' watts')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "POWER LOST IN FRICTION= 524.5 watts\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg109" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 12 PAGE NO 109\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "d2=.30## DIAMETER OF SHAFT IN m \n", - "W=200000.## LOAD AVAILABLE IN NEWTONS\n", - "N=75.## SPEED IN rpm\n", - "U=.05## COEFFICIENT OF FRICTION\n", - "p=300000.## PRESSURE AVAILABLE IN N/m**2\n", - "P=16200.## POWER LOST DUE TO FRICTION IN WATTS\n", - "##====================================================================================\n", - "##CaLCULATION\n", - "T=P*60./2./PI/N## TORQUE INDUCED IN THE SHFT IN N-m\n", - "##LET X=(r1**3-r2**3)/(r1**2-r2**2)\n", - "X=(3./2.*T/U/W)\n", - "r2=.15## SINCE d2=.30 m\n", - "c=r2**2.-(X*r2)\n", - "b= r2-X\n", - "a= 1.\n", - "r1=( -b+ math.sqrt (b**2. -4.*a*c ))/(2.* a);## VALUE OF r1 IN m\n", - "d1=2*r1*100.## d1 IN cm\n", - "n=W/(PI*p*(r1**2.-r2**2.))\n", - "##================================================================================\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('EXTERNAL DIAMETER OF SHAFT =',d1,' cm''NO OF COLLARS REQUIRED =',n,'' '0 or ',n+1,'')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "EXTERNAL DIAMETER OF SHAFT = 50.6 cmNO OF COLLARS REQUIRED = 5.1 0 or 6.1 \n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg111" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 13 PAGE NO 111\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "W=20000.## LOAD IN NEWTONS\n", - "ALPHA=120./2.## CONE ANGLE IN DEGREES\n", - "p=350000.## INTENSITY OF PRESSURE\n", - "U=.06\n", - "N=120.## SPEED OF THE SHAFT IN rpm\n", - "##d1=3d2\n", - "##r1=3r2\n", - "##===================================================================================\n", - "##CALCULATION\n", - "##LET K=d1/d2\n", - "k=3.\n", - "Z=W/((k**2.-1.)*PI*p)\n", - "r2=Z**.5## INTERNAL RADIUS IN m\n", - "r1=3.*r2\n", - "T=2.*U*W*(r1**3.-r2**3.)/(3.*math.sin(60/57.3)*(r1**2.-r2**2.))## total frictional torque in N\n", - "P=2.*PI*N*T/60000.## power absorbed in friction in kW\n", - "##================================================================================\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('THE INTERNAL DIAMETER OF SHAFT =',r2*100,' cm' 'THE EXTERNAL DIAMETER OF SHAFT =',r1*100,' cm' 'POWER ABSORBED IN FRICTION =',P,' kW')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE INTERNAL DIAMETER OF SHAFT = 4.8 cmTHE EXTERNAL DIAMETER OF SHAFT = 14.3 cmPOWER ABSORBED IN FRICTION = 1.8 kW\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex14-pg111" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 14 PAGE NO 111\n", - "##TITLE:FRICTION\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "P=10000.## POWER TRRANSMITTED BY CLUTCH IN WATTS\n", - "N=3000.## SPEED IN rpm\n", - "p=.09## AXIAL PRESSURE IN N/mm**2\n", - "##d1=1.4d2 RELATION BETWEEN DIAMETERS \n", - "K=1.4## D1/D2\n", - "n=2.\n", - "U=.3## COEFFICIENT OF FRICTION\n", - "##==========================================================================================\n", - "T=P*60000./1000./(2.*PI*N)## ASSUMING UNIFORM WEAR TORQUE IN N-m\n", - "r2=(T*2./(n*U*2.*PI*p*10**6.*(K-1.)*(K+1.)))**(1./3.)## INTERNAL RADIUS\n", - "\n", - "##===========================================================================================\n", - "print'%s %.1f %s %.1f %s '%('THE INTERNAL RADIUS =',r2*100,' cm' 'THE EXTERNAL RADIUS =',K*r2*100,' cm')\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE INTERNAL RADIUS = 5.8 cmTHE EXTERNAL RADIUS = 8.1 cm \n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg111" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 3 ILLUSRTATION 14 PAGE NO 111\n", - "##TITLE:FRICTION\n", - "\n", - "\n", - "\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "n1=3.## NO OF DICS ON DRIVING SHAFTS\n", - "n2=2.## NO OF DICS ON DRIVEN SHAFTS\n", - "d1=30.## DIAMETER OF DRIVING SHAFT IN cm\n", - "d2=15.## DIAMETER OF DRIVEN SHAFT IN cm\n", - "r1=d1/2.\n", - "r2=d2/2.\n", - "U=.3## COEFFICIENT FRICTION\n", - "P=30000.## TANSMITTING POWER IN WATTS\n", - "N=1800.## SPEED IN rpm\n", - "##===========================================================================================\n", - "##CALCULATION\n", - "n=n1+n2-1.## NO OF PAIRS OF CONTACT SURFACES\n", - "T=P*60000./(2.*PI*N)## TORQUE IN N-m\n", - "W=2.*T/(n*U*(r1+r2)*10.)## LOAD IN N\n", - "k=W/(2.*PI*(r1-r2))\n", - "p=k/r2/100.## MAX AXIAL INTENSITY OF PRESSURE IN N/mm**2\n", - "##===========================================================================================\n", - "## OUTPUT\n", - "print'%s %.3f %s'%('MAX AXIAL INTENSITY OF PRESSURE =',p,' N/mm^2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "MAX AXIAL INTENSITY OF PRESSURE = 0.033 N/mm**2\n" - ] - } - ], - "prompt_number": 15 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter4.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter4.ipynb deleted file mode 100755 index de08c088..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter4.ipynb +++ /dev/null @@ -1,946 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:fdf50666cfa70019db7241b6e1fb1e819c70fb9987ea0caadb1e777e93e7d898" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter4-Gears and Gear Drivers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 1, Page 133\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "TA=48.;##Wheel A teeth\n", - "TB=30.;##Wheel B teeth\n", - "m=5.;##Module pitch in mm\n", - "phi=20.;##Pressure angle in degrees\n", - "add=m;##Addendum in mm\n", - "\n", - "##CALCULATIONS\n", - "R=(m*TA)/2.;##Pitch circle radius of wheel A in mm\n", - "RA=R+add;##Radius of addendum circle of wheel A in mm\n", - "r=(m*TB)/2.;##Pitch circle radius of wheel B in mm\n", - "rA=r+add;##Radius of addendum circle of wheel B in mm\n", - "lp=(math.sqrt((RA**2.)-((R**2.)*(math.cos(phi/57.3)**2.))))+(math.sqrt((rA**2.)-((r**2.)*(math.cos(phi/57.3)**2.))))-((R+r)*math.sin(phi/57.3));##Length of path of contact in mm\n", - "la=lp/math.cos(phi/57.3);##Length of arc of contact in mm\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('Length of arc of contact is ',la,' mm')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Length of arc of contact is 26.7 mm\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 2, Page 133\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "TA=40.;##Wheel A teeth\n", - "TB=TA;##Wheel B teeth\n", - "m=6.;##Module pitch in mm\n", - "phi=20.;##Pressure angle in degrees\n", - "pi=3.141\n", - "x=1.75;##Ratio of length of arc of contact to circular pitch\n", - "\n", - "##CALCULATIONS\n", - "Cp=m*pi;##Circular pitch in mm\n", - "R=(m*TA)/2.;##Pitch circle radius of wheel A in mm\n", - "r=R;##Pitch circle radius of wheel B in mm\n", - "la=x*Cp;##Length of arc of contact in mm\n", - "lp=la*math.cos(phi/57.3);##Length of path of contact in mm\n", - "RA=math.sqrt((((lp/2.)+(R*math.sin(phi/57.3)))**2.)+((R**2.)*(math.cos(phi/57.3))**2.));##Radius of addendum circle of each wheel in mm\n", - "add=RA-R;##Addendum in mm\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('Addendum of wheel is ',add,' mm')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Addendum of wheel is 6.1 mm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg134" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 3, Page 134\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "TA=48.;##Gear teeth\n", - "TB=24.;##Pinion teeth\n", - "m=6.;##Module in mm\n", - "phi=20.;##Pressure angle in degrees\n", - "\n", - "##CALCULATIONS\n", - "r=(m*TB)/2.;##Pitch circle radius of pinion in mm\n", - "R=(m*TA)/2.;##Pitch circle radius of gear in mm\n", - "RA=math.sqrt(((((r*math.sin(phi/57.3))/2.)+(R*math.sin(phi/57.3)))**2.)+((R**2)*(math.cos(phi/57.3))**2));##Radius of addendum circle of gear in mm\n", - "rA=math.sqrt(((((R*math.sin(phi/57.3))/2.)+(r*math.sin(phi/57.3)))**2.)+((r**2)*(math.cos(phi/57.3))**2));##Radius of addendum circle of pinion in mm\n", - "addp=rA-r;##Addendum for pinion in mm\n", - "addg=RA-R;##Addendum for gear in mm\n", - "lp=((R+r)*math.sin(phi/57.3))/2.;##Length of path of contact in mm\n", - "la=lp/math.cos(phi/57.3);##Length of arc of contact in mm\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('Addendum for pinion is',addp,' mm' ' Addendum for gear is ',addg,' mm' ' Length of arc of contact is ',la,' mm')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Addendum for pinion is 11.7 mm Addendum for gear is 4.7 mm Length of arc of contact is 39.3 mm \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg135" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 4, Page 135\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "x=3.5;##Ratio of teeth of wheels\n", - "C=1.2;##Centre distance between axes in m\n", - "DP=4.4;##Diametrical pitch in cm\n", - "\n", - "##CALCULATIONS\n", - "D=2*C*100.;##Sum of diameters of wheels in cm\n", - "T=D*DP;##Sum of teeth of wheels\n", - "TB1=T/(x+1);##Teeth of wheel B\n", - "TB=math.floor(TB1);##Teeth of whhel B\n", - "TA=x*TB;##Teeth of wheel A\n", - "DA=TA/DP;##Diametral pitch of gear A in cm\n", - "DB=TB/DP;##Diametral pitch of gear B in cm\n", - "Ce=(DA+DB)/2.;##Exact centre distance between shafts in cm\n", - "TB2=math.ceil(TB1);##Teeth of wheel B\n", - "TA2=T-TB2;##Teeth of wheel A\n", - "VR=TA2/TB2;##Velocity ratio\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s%.1f %s%.1f %s'%('Number of teeth on wheel A is ',TA,'' 'Number of teeth on wheel B is ',TB,'' ' Exact centre distance is ',Ce,' cm ' 'If centre distance is ',C,' m' 'then Velocity ratio is',VR,'')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of teeth on wheel A is 819.0 Number of teeth on wheel B is 234.0 Exact centre distance is 119.7 cm If centre distance is 1.2 mthen Velocity ratio is3.5 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg136" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 5, Page 136\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "C=600;##Distance between shafts in mm\n", - "Cp=30;##Circular pitch in mm\n", - "NA=200;##Speed of wheel A in rpm\n", - "NB=600;##Speed of wheel B in rpm\n", - "F=18;##Tangential pressure in kN\n", - "pi=3.141\n", - "\n", - "##CALCULATIONS\n", - "a=Cp/(pi*10.);##Ratio of pitch diameter of wheel A to teeth of wheel A in cm\n", - "b=Cp/(pi*10.);##Ratio of pitch diameter of wheel B to teeth of wheel B in cm\n", - "T=(2*C)/(a*10.);##Sum of teeth of wheels\n", - "r=NB/NA;##Ratio of teeth of wheels\n", - "TB=T/(r+1);##Teeth of wheel B\n", - "TB1=math.ceil(TB);##Teeth of wheel B\n", - "TA=TB1*r;##Teeth of wheel A\n", - "DA=a*TA;##Pitch diameter of wheel A in cm\n", - "DB=b*TB1;##Pitch diameter of wheel B in cm\n", - "CPA=(pi*DA)/TA;##Circular pitch of gear A in cm\n", - "CPB=(pi*DB)/TB1;##Circular pitch of gear B in cm\n", - "C1=(DA+DB)*10/2.;##Exact centre distance in mm\n", - "P=(F*1000.*pi*DA*NA)/(60.*1000.*100.);##Power transmitted in kW\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('Number of teeth on wheel A is ',TA,' '' Number of teeth on wheel B is ',TB1,' '' Pitch diameter of wheel A is ',DA,' cm'' Pitch diameter of wheel B is ',DB,' cm'' Circular pitch of wheel A is',CPA,'cm ' 'Circular pitch of wheel B is ',CPB,' cm '' Exact centre distance between shafts is ',C1,' mm'' Power transmitted is',P,' kW')\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of teeth on wheel A is 96.0 Number of teeth on wheel B is 32.0 Pitch diameter of wheel A is 91.7 cm Pitch diameter of wheel B is 30.6 cm Circular pitch of wheel A is 3.0 cm Circular pitch of wheel B is 3.0 cm Exact centre distance between shafts is 611.3 mm Power transmitted is 172.8 kW \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg137" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 6, Page 137\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "r=16.;##Speed ratio\n", - "mA=4.;##Module of gear A in mm\n", - "mB=mA;##Module of gear B in mm\n", - "mC=2.5;##Mosule of gear C in mm\n", - "mD=mC;##Module of gear D in mm\n", - "C=150.;##Distance between shafts in mm\n", - "\n", - "##CALCULATIONS\n", - "t=math.sqrt(r);##Ratio of teeth\n", - "T1=(C*2.)/mA;##Sum of teeth of wheels A and B\n", - "T2=(C*2.)/mC;##Sum of teeth of wheels C and D\n", - "TA=T1/(t+1.);##Teeth of gear A\n", - "TB=T1-TA;##Teeth of gear B\n", - "TC=T2/(t+1.);##Teeth of gear C\n", - "TD=T2-TC;##Teeth of gear D\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Number of teeth on gear A is ',TA,' '' Number of teeth on gear B is ',TB,'' 'Number of teeth on gear C is ',TC,'' ' Number of teeth on gear D is ',TD,'')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of teeth on gear A is 15.0 Number of teeth on gear B is 60.0 Number of teeth on gear C is 24.0 Number of teeth on gear D is 96.0 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg138" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 7, Page 138\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "N=4.5;##No. of turns\n", - "\n", - "##CALCULATIONS\n", - "Vh=N/2.;##Velocity ratio of main spring spindle to hour hand spindle\n", - "Vm=12.;##Velocity ratio of minute hand spindle to hour hand spindle\n", - "T1=8.## assumed no of teeth on gear 1\n", - "T2=32.## assumed no of teeth on gear 2\n", - "T3=(T1+T2)/4.## no of teeth on gear 3\n", - "T4=(T1+T2)-T3## no of teeth on gear 4\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('no of teeth on gear 1=',T1,'' 'no of teeth on gear 2=',T2,' ''no of teeth on gear 3=',T3,' ''no of teeth on gear 4=',T4,'')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "no of teeth on gear 1= 8.0 no of teeth on gear 2= 32.0 no of teeth on gear 3= 10.0 no of teeth on gear 4= 30.0 \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg139" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 8, Page 139\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Tb=70.;##Teeth of wheel B\n", - "Tc=25.;##Teeth of wheel C\n", - "Td=80.;##Teeth of wheel D\n", - "Na=-100.;##Speed of arm A in clockwise in rpm\n", - "y=-100.##Arm A rotates at 100 rpm clockwise\n", - "\n", - "##Calculations\n", - "Te=(Tc+Td-Tb);##Teeth of wheel E\n", - "x=(y/0.5)\n", - "Nc=(y-(Td*x)/Tc);##Speed of wheel C in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s'%('Speed of wheel C is ',Nc,' rpm ''Direction of wheel C is anti-clockwise')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of wheel C is 540.0 rpm Direction of wheel C is anti-clockwise\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg140" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 9, Page 140\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Tb=25.;##Teeth of wheel B\n", - "Tc=40.;##Teeth of wheel C\n", - "Td=10.;##Teeth of wheel D\n", - "Te=25.;##Teeth of wheel E\n", - "Tf=30.;##Teeth of wheel F\n", - "y=-120.;##Speed of arm A in clockwise in rpm\n", - "\n", - "##Calculations\n", - "x=(-y/4.)\n", - "Nb=x+y;##Speed of wheel B in rpm\n", - "Nf=(-10/3.)*x+y;##Speed of wheel F in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s %.1f %s'%('Speed of wheel B is',Nb,' rpm Direction of wheel B is clockwise' ' Speed of wheel F is ',Nf,' rpm Direction of wheel F is clockwise')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of wheel B is -90.0 rpm Direction of wheel B is clockwise Speed of wheel F is -220.0 rpm Direction of wheel F is clockwise\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg141" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 10, Page 141\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Ta=96.;##Teeth of wheel A\n", - "Tc=48.;##Teeth of wheel C\n", - "y=-20.;##Speed of arm C in rpm in clockwise\n", - "\n", - "##Calculations\n", - "x=(y*Ta)/Tc\n", - "Tb=(Ta-Tc)/2.;##Teeth of wheel B\n", - "Nb=(-Tc/Tb)*x+y;##Speed of wheel B in rpm\n", - "Nc=x+y;##Speed of wheel C in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s %.1f %s'%('Speed of wheel B is ',Nb,' rpm' 'Speed of wheel C is ',Nc,' rpm')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of wheel B is 60.0 rpmSpeed of wheel C is -60.0 rpm\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg142" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 11, Page 142\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "import numpy\n", - "from numpy.linalg import inv\n", - "##Input data\n", - "Ta=40.## no of teeth on gear A\n", - "Td=90.## no of teeth on gear D\n", - "\n", - "##Calculations\n", - "Tb=(Td-Ta)/2.## no of teeth on gear B\n", - "Tc=Tb## no of teeth on gear C\n", - "##\n", - "##x+y=-1\n", - "##-40x+90y=45\n", - "\n", - "A=([[1, 1],[-Ta, Td]])##Coefficient matrix\n", - "\n", - "B=([[-1],[Td/2]])##Constant matrix\n", - " \n", - "X=numpy.dot(inv(A) ,B)##Variable matrix\n", - "##\n", - "##x+y=-1\n", - "##-40x+90y=0\n", - "A1=([[1, 1],[-Ta, Td]])##Coefficient matrix\n", - "B1=([[-1],[0]])##Constant matrix\n", - "X1=numpy.dot(inv(A1) ,B1)##Variable matrix\n", - "b=X1[1] \n", - "print(X[1]) \n", - "print'%s %.4f %s'%('speed of the arm =',b,' revolution clockwise')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "[ 0.03846154]\n", - "speed of the arm = -0.3077 revolution clockwise\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg144" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 12, Page 144\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "\n", - "\n", - "##Input data\n", - "Te=30.;##Teeth of wheel E\n", - "Tb=24.;##Teeth of wheel B\n", - "Tc=22.;##Teeth of wheel C\n", - "Td=70.;##Teeth of wheel D\n", - "Th=15.;##Teeth of wheel H\n", - "Nv=100.;##Speed of shaft V in rpm\n", - "Nx=300.;##Speed of spindle X in rpm\n", - "\n", - "##Calculations\n", - "Nh=Nv;##Speed of wheel H in rpm\n", - "Ne=(-Th/Te)*Nv;##Speed of wheel E in rpm\n", - "Ta=(Tc+Td-Tb);##Teeth of wheel A\n", - "##x+y=-50\n", - "##y=300\n", - "x=(Ne-Nx)\n", - "Nz=(187/210.)*x+Nx;##;##Speed of wheel Z in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s'%('Speed of wheel Z is ',Nz,' rpm Direction of wheel Z is opposite to that of X')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of wheel Z is -11.7 rpm Direction of wheel Z is opposite to that of X\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg145" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 13, Page 145\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "\n", - "\n", - "##Input data\n", - "Tp=20.;##Teeth of wheel P\n", - "Tq=30.;##Teeth of wheel Q\n", - "Tr=10.;##Teeth of wheel R\n", - "Nx=50.;##Speed of shaft X in rpm\n", - "Na=100.;##Speed of arm A in rpm\n", - "\n", - "##Calculations\n", - "##x+y=-50\n", - "##y=100\n", - "x=(-Nx-Na)\n", - "y=(-2.*x+Na);##Speed of Y in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s'%('Speed of driven shaft Y is ',y,' rpm Direction of driven shaft Y is anti-clockwise')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of driven shaft Y is 400.0 rpm Direction of driven shaft Y is anti-clockwise\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg146" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 14, Page 146\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "d=216.;##Ring diameter in mm\n", - "m=4.;##Module in mm\n", - "\n", - "##Calculations\n", - "Td=(d/m);##Teeth of wheel D\n", - "Tb=Td/4.;##Teeth of wheel B\n", - "Tb1=math.ceil(Tb);##Teeth of wheel B\n", - "Td1=4.*Tb1;##Teeth of wheel D\n", - "Tc1=(Td1-Tb1)/2.;##Teeth of wheel C\n", - "d1=m*Td1;##Pitch circle diameter in mm\n", - "\n", - "##Output\n", - "print'%s %.1f %s %.1f %s %.1f %s%.1f %s '%('Teeth of wheel B is ',Tb1,' ' 'Teeth of wheel C is ',Tc1,' ' 'Teeth of wheel D is ',Td1,' '' Exact pitch circle diameter is ',d1,' mm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Teeth of wheel B is 14.0 Teeth of wheel C is 21.0 Teeth of wheel D is 56.0 Exact pitch circle diameter is 224.0 mm \n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg147" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 15, Page 147\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Ta=100.## no of teeth on gear A\n", - "Tc=101.## no of teeth on gear C\n", - "Td=99.## no of teeth on gear D\n", - "Tp=20.## no of teeth on planet gear\n", - "y=1.## from table 4.9(arm B makes one revolution)\n", - "x=-y## as gear is fixed\n", - "\n", - "##Calculations\n", - "Nc=(Ta*x)/Tc+y## Revolution of gear C \n", - "Nd=(Ta*x)/Td+y## Revolution of gear D\n", - "\n", - "##Output\n", - "print'%s %.4f %s %.4f %s '%('Revolution of gear C =',Nc,'' ' Revolution of gear D = ',Nd,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Revolution of gear C = 0.0099 Revolution of gear D = -0.0101 \n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex16-pg148" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 16, Page 148\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Ta=12.## no of teeth on gear A\n", - "Tb=60.## no of teeth on gear B\n", - "N=1000.## speed of propeller shaft in rpm\n", - "Nc=210.## speed of gear C in rpm\n", - "\n", - "##Calculations\n", - "Nb=(Ta*N)/Tb## speed of gear B in rpm\n", - "x=(Nb-Nc)\n", - "Nd=Nb+x## speed of road wheel driven by D\n", - "\n", - "##Output\n", - "print'%s %.1f %s'%('speed of road wheel driven by D= ',Nd,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of road wheel driven by D= 190.0 rpm\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex17-pg148" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 17, Page 148\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "import numpy\n", - "from numpy.linalg import inv\n", - "##Input data\n", - "Ta=20.## no of teeth on pinion A\n", - "Tb=25.## no of teeth on wheel B\n", - "Tc=50.## no of teeth on gear C\n", - "Td=60.## no of teeth on gear D\n", - "Te=60.## no of teeth on gear E\n", - "Na=200.## SPEED of the gear A\n", - "Nd=100.## speed of the gear D\n", - "\n", - "##calculations\n", - "##(i)\n", - "##(5/6)x+y=0\n", - "##(5/4)x+y=200\n", - "A1=([[Tc/Td, 1],[Tb/Ta, 1]])##Coefficient matrix\n", - "B1=([[0],[Na]]) ##Constant matrix\n", - "X1=numpy.dot(inv(A1),B1)##Variable matrix\n", - "Ne1=X1[1]-(Tc/Td)*X1[0]## \n", - "T1=(-Ne1/Na)## ratio of torques when D is fixed\n", - "##(ii)\n", - "##(5/4)x+y=200\n", - "##(5/6)x+y=100\n", - "A2=([[Tc/Td, 1],[Tb/Ta, 1]])##Coefficient matrix\n", - "B2=([[Nd],[Na]])##Constant matrix\n", - "X2=numpy.dot(inv(A2),B2)##Variable matrix\n", - "Ne2=X2[1]-(Tc/Td)*X2[0]\n", - "T2=(-Ne2/Na)## ratio of torques when D ratates at 100 rpm\n", - "\n", - "##Output\n", - "print'%s %.2f %s %.2f %s %.2f %s %.2f %s'%('speed of E= ',Ne1,' rpm in clockwise direction' and 'speed of E in 2nd case(when D rotates at 100 rpm)= ',Ne2,' rpm in clockwise direction' and 'ratio of torques when D is fixed= ',T1,' ' 'ratio of torques when D ratates at 100 rpm= ',T2,'')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of E= -800.00 speed of E in 2nd case(when D rotates at 100 rpm)= -300.00 ratio of torques when D is fixed= 4.00 ratio of torques when D ratates at 100 rpm= 1.50 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter4_1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter4_1.ipynb deleted file mode 100755 index f1bdaef9..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter4_1.ipynb +++ /dev/null @@ -1,946 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:7cb010f7555dca225180a41fc0eba5cf332623b14bf784043b289ca4a89a15f6" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter4-Gears and Gear Drivers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 1, Page 133\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "TA=48.;##Wheel A teeth\n", - "TB=30.;##Wheel B teeth\n", - "m=5.;##Module pitch in mm\n", - "phi=20.;##Pressure angle in degrees\n", - "add=m;##Addendum in mm\n", - "\n", - "##CALCULATIONS\n", - "R=(m*TA)/2.;##Pitch circle radius of wheel A in mm\n", - "RA=R+add;##Radius of addendum circle of wheel A in mm\n", - "r=(m*TB)/2.;##Pitch circle radius of wheel B in mm\n", - "rA=r+add;##Radius of addendum circle of wheel B in mm\n", - "lp=(math.sqrt((RA**2.)-((R**2.)*(math.cos(phi/57.3)**2.))))+(math.sqrt((rA**2.)-((r**2.)*(math.cos(phi/57.3)**2.))))-((R+r)*math.sin(phi/57.3));##Length of path of contact in mm\n", - "la=lp/math.cos(phi/57.3);##Length of arc of contact in mm\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('Length of arc of contact is ',la,' mm')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Length of arc of contact is 26.7 mm\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg133" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 2, Page 133\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "TA=40.;##Wheel A teeth\n", - "TB=TA;##Wheel B teeth\n", - "m=6.;##Module pitch in mm\n", - "phi=20.;##Pressure angle in degrees\n", - "pi=3.141\n", - "x=1.75;##Ratio of length of arc of contact to circular pitch\n", - "\n", - "##CALCULATIONS\n", - "Cp=m*pi;##Circular pitch in mm\n", - "R=(m*TA)/2.;##Pitch circle radius of wheel A in mm\n", - "r=R;##Pitch circle radius of wheel B in mm\n", - "la=x*Cp;##Length of arc of contact in mm\n", - "lp=la*math.cos(phi/57.3);##Length of path of contact in mm\n", - "RA=math.sqrt((((lp/2.)+(R*math.sin(phi/57.3)))**2.)+((R**2.)*(math.cos(phi/57.3))**2.));##Radius of addendum circle of each wheel in mm\n", - "add=RA-R;##Addendum in mm\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s'%('Addendum of wheel is ',add,' mm')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Addendum of wheel is 6.1 mm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg134" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 3, Page 134\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "TA=48.;##Gear teeth\n", - "TB=24.;##Pinion teeth\n", - "m=6.;##Module in mm\n", - "phi=20.;##Pressure angle in degrees\n", - "\n", - "##CALCULATIONS\n", - "r=(m*TB)/2.;##Pitch circle radius of pinion in mm\n", - "R=(m*TA)/2.;##Pitch circle radius of gear in mm\n", - "RA=math.sqrt(((((r*math.sin(phi/57.3))/2.)+(R*math.sin(phi/57.3)))**2.)+((R**2)*(math.cos(phi/57.3))**2));##Radius of addendum circle of gear in mm\n", - "rA=math.sqrt(((((R*math.sin(phi/57.3))/2.)+(r*math.sin(phi/57.3)))**2.)+((r**2)*(math.cos(phi/57.3))**2));##Radius of addendum circle of pinion in mm\n", - "addp=rA-r;##Addendum for pinion in mm\n", - "addg=RA-R;##Addendum for gear in mm\n", - "lp=((R+r)*math.sin(phi/57.3))/2.;##Length of path of contact in mm\n", - "la=lp/math.cos(phi/57.3);##Length of arc of contact in mm\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('Addendum for pinion is',addp,' mm' ' Addendum for gear is ',addg,' mm' ' Length of arc of contact is ',la,' mm')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Addendum for pinion is 11.7 mm Addendum for gear is 4.7 mm Length of arc of contact is 39.3 mm \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg135" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 4, Page 135\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "x=3.5;##Ratio of teeth of wheels\n", - "C=1.2;##Centre distance between axes in m\n", - "DP=4.4;##Diametrical pitch in cm\n", - "\n", - "##CALCULATIONS\n", - "D=2*C*100.;##Sum of diameters of wheels in cm\n", - "T=D*DP;##Sum of teeth of wheels\n", - "TB1=T/(x+1);##Teeth of wheel B\n", - "TB=math.floor(TB1);##Teeth of whhel B\n", - "TA=x*TB;##Teeth of wheel A\n", - "DA=TA/DP;##Diametral pitch of gear A in cm\n", - "DB=TB/DP;##Diametral pitch of gear B in cm\n", - "Ce=(DA+DB)/2.;##Exact centre distance between shafts in cm\n", - "TB2=math.ceil(TB1);##Teeth of wheel B\n", - "TA2=T-TB2;##Teeth of wheel A\n", - "VR=TA2/TB2;##Velocity ratio\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s%.1f %s%.1f %s'%('Number of teeth on wheel A is ',TA,'' 'Number of teeth on wheel B is ',TB,'' ' Exact centre distance is ',Ce,' cm ' 'If centre distance is ',C,' m' 'then Velocity ratio is',VR,'')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of teeth on wheel A is 819.0 Number of teeth on wheel B is 234.0 Exact centre distance is 119.7 cm If centre distance is 1.2 mthen Velocity ratio is3.5 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg136" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 5, Page 136\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "C=600;##Distance between shafts in mm\n", - "Cp=30;##Circular pitch in mm\n", - "NA=200;##Speed of wheel A in rpm\n", - "NB=600;##Speed of wheel B in rpm\n", - "F=18;##Tangential pressure in kN\n", - "pi=3.141\n", - "\n", - "##CALCULATIONS\n", - "a=Cp/(pi*10.);##Ratio of pitch diameter of wheel A to teeth of wheel A in cm\n", - "b=Cp/(pi*10.);##Ratio of pitch diameter of wheel B to teeth of wheel B in cm\n", - "T=(2*C)/(a*10.);##Sum of teeth of wheels\n", - "r=NB/NA;##Ratio of teeth of wheels\n", - "TB=T/(r+1);##Teeth of wheel B\n", - "TB1=math.ceil(TB);##Teeth of wheel B\n", - "TA=TB1*r;##Teeth of wheel A\n", - "DA=a*TA;##Pitch diameter of wheel A in cm\n", - "DB=b*TB1;##Pitch diameter of wheel B in cm\n", - "CPA=(pi*DA)/TA;##Circular pitch of gear A in cm\n", - "CPB=(pi*DB)/TB1;##Circular pitch of gear B in cm\n", - "C1=(DA+DB)*10/2.;##Exact centre distance in mm\n", - "P=(F*1000.*pi*DA*NA)/(60.*1000.*100.);##Power transmitted in kW\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('Number of teeth on wheel A is ',TA,' '' Number of teeth on wheel B is ',TB1,' '' Pitch diameter of wheel A is ',DA,' cm'' Pitch diameter of wheel B is ',DB,' cm'' Circular pitch of wheel A is',CPA,'cm ' 'Circular pitch of wheel B is ',CPB,' cm '' Exact centre distance between shafts is ',C1,' mm'' Power transmitted is',P,' kW')\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of teeth on wheel A is 96.0 Number of teeth on wheel B is 32.0 Pitch diameter of wheel A is 91.7 cm Pitch diameter of wheel B is 30.6 cm Circular pitch of wheel A is 3.0 cm Circular pitch of wheel B is 3.0 cm Exact centre distance between shafts is 611.3 mm Power transmitted is 172.8 kW \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg137" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 6, Page 137\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "r=16.;##Speed ratio\n", - "mA=4.;##Module of gear A in mm\n", - "mB=mA;##Module of gear B in mm\n", - "mC=2.5;##Mosule of gear C in mm\n", - "mD=mC;##Module of gear D in mm\n", - "C=150.;##Distance between shafts in mm\n", - "\n", - "##CALCULATIONS\n", - "t=math.sqrt(r);##Ratio of teeth\n", - "T1=(C*2.)/mA;##Sum of teeth of wheels A and B\n", - "T2=(C*2.)/mC;##Sum of teeth of wheels C and D\n", - "TA=T1/(t+1.);##Teeth of gear A\n", - "TB=T1-TA;##Teeth of gear B\n", - "TC=T2/(t+1.);##Teeth of gear C\n", - "TD=T2-TC;##Teeth of gear D\n", - "\n", - "##OUTPUT\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Number of teeth on gear A is ',TA,' '' Number of teeth on gear B is ',TB,'' 'Number of teeth on gear C is ',TC,'' ' Number of teeth on gear D is ',TD,'')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of teeth on gear A is 15.0 Number of teeth on gear B is 60.0 Number of teeth on gear C is 24.0 Number of teeth on gear D is 96.0 \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg138" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 7, Page 138\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##INPUT DATA\n", - "N=4.5;##No. of turns\n", - "\n", - "##CALCULATIONS\n", - "Vh=N/2.;##Velocity ratio of main spring spindle to hour hand spindle\n", - "Vm=12.;##Velocity ratio of minute hand spindle to hour hand spindle\n", - "T1=8.## assumed no of teeth on gear 1\n", - "T2=32.## assumed no of teeth on gear 2\n", - "T3=(T1+T2)/4.## no of teeth on gear 3\n", - "T4=(T1+T2)-T3## no of teeth on gear 4\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('no of teeth on gear 1=',T1,'' 'no of teeth on gear 2=',T2,' ''no of teeth on gear 3=',T3,' ''no of teeth on gear 4=',T4,'')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "no of teeth on gear 1= 8.0 no of teeth on gear 2= 32.0 no of teeth on gear 3= 10.0 no of teeth on gear 4= 30.0 \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg139" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 8, Page 139\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Tb=70.;##Teeth of wheel B\n", - "Tc=25.;##Teeth of wheel C\n", - "Td=80.;##Teeth of wheel D\n", - "Na=-100.;##Speed of arm A in clockwise in rpm\n", - "y=-100.##Arm A rotates at 100 rpm clockwise\n", - "\n", - "##Calculations\n", - "Te=(Tc+Td-Tb);##Teeth of wheel E\n", - "x=(y/0.5)\n", - "Nc=(y-(Td*x)/Tc);##Speed of wheel C in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s'%('Speed of wheel C is ',Nc,' rpm ''Direction of wheel C is anti-clockwise')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of wheel C is 540.0 rpm Direction of wheel C is anti-clockwise\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg140" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 9, Page 140\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Tb=25.;##Teeth of wheel B\n", - "Tc=40.;##Teeth of wheel C\n", - "Td=10.;##Teeth of wheel D\n", - "Te=25.;##Teeth of wheel E\n", - "Tf=30.;##Teeth of wheel F\n", - "y=-120.;##Speed of arm A in clockwise in rpm\n", - "\n", - "##Calculations\n", - "x=(-y/4.)\n", - "Nb=x+y;##Speed of wheel B in rpm\n", - "Nf=(-10/3.)*x+y;##Speed of wheel F in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s %.1f %s'%('Speed of wheel B is',Nb,' rpm Direction of wheel B is clockwise' ' Speed of wheel F is ',Nf,' rpm Direction of wheel F is clockwise')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of wheel B is -90.0 rpm Direction of wheel B is clockwise Speed of wheel F is -220.0 rpm Direction of wheel F is clockwise\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg141" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 10, Page 141\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Ta=96.;##Teeth of wheel A\n", - "Tc=48.;##Teeth of wheel C\n", - "y=-20.;##Speed of arm C in rpm in clockwise\n", - "\n", - "##Calculations\n", - "x=(y*Ta)/Tc\n", - "Tb=(Ta-Tc)/2.;##Teeth of wheel B\n", - "Nb=(-Tc/Tb)*x+y;##Speed of wheel B in rpm\n", - "Nc=x+y;##Speed of wheel C in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s %.1f %s'%('Speed of wheel B is ',Nb,' rpm' 'Speed of wheel C is ',Nc,' rpm')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "##================================END OF PROGRAM=============================================\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of wheel B is 60.0 rpmSpeed of wheel C is -60.0 rpm\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg142" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 11, Page 142\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "import numpy\n", - "from numpy.linalg import inv\n", - "##Input data\n", - "Ta=40.## no of teeth on gear A\n", - "Td=90.## no of teeth on gear D\n", - "\n", - "##Calculations\n", - "Tb=(Td-Ta)/2.## no of teeth on gear B\n", - "Tc=Tb## no of teeth on gear C\n", - "##\n", - "##x+y=-1\n", - "##-40x+90y=45\n", - "\n", - "A=([[1, 1],[-Ta, Td]])##Coefficient matrix\n", - "\n", - "B=([[-1],[Td/2]])##Constant matrix\n", - " \n", - "X=numpy.dot(inv(A) ,B)##Variable matrix\n", - "##\n", - "##x+y=-1\n", - "##-40x+90y=0\n", - "A1=([[1, 1],[-Ta, Td]])##Coefficient matrix\n", - "B1=([[-1],[0]])##Constant matrix\n", - "X1=numpy.dot(inv(A1) ,B1)##Variable matrix\n", - "b=X1[1] \n", - "print(X[1]) \n", - "print'%s %.4f %s'%('speed of the arm =',b,' revolution clockwise')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "[ 0.03846154]\n", - "speed of the arm = -0.3077 revolution clockwise\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg144" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 12, Page 144\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "\n", - "\n", - "##Input data\n", - "Te=30.;##Teeth of wheel E\n", - "Tb=24.;##Teeth of wheel B\n", - "Tc=22.;##Teeth of wheel C\n", - "Td=70.;##Teeth of wheel D\n", - "Th=15.;##Teeth of wheel H\n", - "Nv=100.;##Speed of shaft V in rpm\n", - "Nx=300.;##Speed of spindle X in rpm\n", - "\n", - "##Calculations\n", - "Nh=Nv;##Speed of wheel H in rpm\n", - "Ne=(-Th/Te)*Nv;##Speed of wheel E in rpm\n", - "Ta=(Tc+Td-Tb);##Teeth of wheel A\n", - "##x+y=-50\n", - "##y=300\n", - "x=(Ne-Nx)\n", - "Nz=(187/210.)*x+Nx;##;##Speed of wheel Z in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s'%('Speed of wheel Z is ',Nz,' rpm Direction of wheel Z is opposite to that of X')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of wheel Z is -11.7 rpm Direction of wheel Z is opposite to that of X\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex13-pg145" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 13, Page 145\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "\n", - "\n", - "##Input data\n", - "Tp=20.;##Teeth of wheel P\n", - "Tq=30.;##Teeth of wheel Q\n", - "Tr=10.;##Teeth of wheel R\n", - "Nx=50.;##Speed of shaft X in rpm\n", - "Na=100.;##Speed of arm A in rpm\n", - "\n", - "##Calculations\n", - "##x+y=-50\n", - "##y=100\n", - "x=(-Nx-Na)\n", - "y=(-2.*x+Na);##Speed of Y in rpm\n", - "\n", - "##Output\n", - "print'%s %.1f %s'%('Speed of driven shaft Y is ',y,' rpm Direction of driven shaft Y is anti-clockwise')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Speed of driven shaft Y is 400.0 rpm Direction of driven shaft Y is anti-clockwise\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg146" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 14, Page 146\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "d=216.;##Ring diameter in mm\n", - "m=4.;##Module in mm\n", - "\n", - "##Calculations\n", - "Td=(d/m);##Teeth of wheel D\n", - "Tb=Td/4.;##Teeth of wheel B\n", - "Tb1=math.ceil(Tb);##Teeth of wheel B\n", - "Td1=4.*Tb1;##Teeth of wheel D\n", - "Tc1=(Td1-Tb1)/2.;##Teeth of wheel C\n", - "d1=m*Td1;##Pitch circle diameter in mm\n", - "\n", - "##Output\n", - "print'%s %.1f %s %.1f %s %.1f %s%.1f %s '%('Teeth of wheel B is ',Tb1,' ' 'Teeth of wheel C is ',Tc1,' ' 'Teeth of wheel D is ',Td1,' '' Exact pitch circle diameter is ',d1,' mm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Teeth of wheel B is 14.0 Teeth of wheel C is 21.0 Teeth of wheel D is 56.0 Exact pitch circle diameter is 224.0 mm \n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15-pg147" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 15, Page 147\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Ta=100.## no of teeth on gear A\n", - "Tc=101.## no of teeth on gear C\n", - "Td=99.## no of teeth on gear D\n", - "Tp=20.## no of teeth on planet gear\n", - "y=1.## from table 4.9(arm B makes one revolution)\n", - "x=-y## as gear is fixed\n", - "\n", - "##Calculations\n", - "Nc=(Ta*x)/Tc+y## Revolution of gear C \n", - "Nd=(Ta*x)/Td+y## Revolution of gear D\n", - "\n", - "##Output\n", - "print'%s %.4f %s %.4f %s '%('Revolution of gear C =',Nc,'' ' Revolution of gear D = ',Nd,'')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Revolution of gear C = 0.0099 Revolution of gear D = -0.0101 \n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex16-pg148" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 16, Page 148\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "\n", - "##Input data\n", - "Ta=12.## no of teeth on gear A\n", - "Tb=60.## no of teeth on gear B\n", - "N=1000.## speed of propeller shaft in rpm\n", - "Nc=210.## speed of gear C in rpm\n", - "\n", - "##Calculations\n", - "Nb=(Ta*N)/Tb## speed of gear B in rpm\n", - "x=(Nb-Nc)\n", - "Nd=Nb+x## speed of road wheel driven by D\n", - "\n", - "##Output\n", - "print'%s %.1f %s'%('speed of road wheel driven by D= ',Nd,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of road wheel driven by D= 190.0 rpm\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex17-pg148" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##Chapter-4, Illustration 17, Page 148\n", - "##Title: Gears and Gear Drivers\n", - "##=============================================================================\n", - "import math\n", - "import numpy\n", - "from numpy.linalg import inv\n", - "##Input data\n", - "Ta=20.## no of teeth on pinion A\n", - "Tb=25.## no of teeth on wheel B\n", - "Tc=50.## no of teeth on gear C\n", - "Td=60.## no of teeth on gear D\n", - "Te=60.## no of teeth on gear E\n", - "Na=200.## SPEED of the gear A\n", - "Nd=100.## speed of the gear D\n", - "\n", - "##calculations\n", - "##(i)\n", - "##(5/6)x+y=0\n", - "##(5/4)x+y=200\n", - "A1=([[Tc/Td, 1],[Tb/Ta, 1]])##Coefficient matrix\n", - "B1=([[0],[Na]]) ##Constant matrix\n", - "X1=numpy.dot(inv(A1),B1)##Variable matrix\n", - "Ne1=X1[1]-(Tc/Td)*X1[0]## \n", - "T1=(-Ne1/Na)## ratio of torques when D is fixed\n", - "##(ii)\n", - "##(5/4)x+y=200\n", - "##(5/6)x+y=100\n", - "A2=([[Tc/Td, 1],[Tb/Ta, 1]])##Coefficient matrix\n", - "B2=([[Nd],[Na]])##Constant matrix\n", - "X2=numpy.dot(inv(A2),B2)##Variable matrix\n", - "Ne2=X2[1]-(Tc/Td)*X2[0]\n", - "T2=(-Ne2/Na)## ratio of torques when D ratates at 100 rpm\n", - "\n", - "##Output\n", - "print'%s %.2f %s %.2f %s %.2f %s %.2f %s'%('speed of E= ',Ne1,' rpm in clockwise direction' and 'speed of E in 2nd case(when D rotates at 100 rpm)= ',Ne2,' rpm in clockwise direction' and 'ratio of torques when D is fixed= ',T1,' ' 'ratio of torques when D ratates at 100 rpm= ',T2,'')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "speed of E= -800.00 speed of E in 2nd case(when D rotates at 100 rpm)= -300.00 ratio of torques when D is fixed= 4.00 ratio of torques when D ratates at 100 rpm= 1.50 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter5.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter5.ipynb deleted file mode 100755 index f33e7643..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter5.ipynb +++ /dev/null @@ -1,413 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:5906799cfbbbc1071564cbe6c16af88dcd0f4ba1965a4d189758faaa2356010c" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter5-Inertia Force Analysis in Machines" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg160" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 1 PAGE NO 160\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "r=.3## radius of crank in m\n", - "l=1.## length of connecting rod in m\n", - "N=200.## speed of the engine in rpm\n", - "n=l/r\n", - "##===================\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "\n", - "teeta=math.acos((-n+((n**2)+4*2*1)**.5)/(2*2))*57.3## angle of inclination of crank in degrees\n", - "Vp=w*r*(math.sin(teeta/57.3)+(math.sin((2*teeta)/57.3)/n))## maximum velocity of the piston in m/s\n", - "print'%s %.1f %s'%('Maximum velocity of the piston = ',Vp,' m/s')\n", - "print'%s %.2f %s'%('teeta',teeta,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum velocity of the piston = 7.0 m/s\n", - "teeta 74.96 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg161" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 2 PAGE NO 161\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "PI=3.141\n", - "r=.3## length of crank in metres\n", - "l=1.5## length of connecting rod in metres\n", - "N=180.## speed of rotation in rpm\n", - "teeta=40.## angle of inclination of crank in degrees\n", - "##============================\n", - "n=l/r\n", - "w=2.*PI*N/60## angular speed in rad/s\n", - "Vp=w*r*(math.sin(teeta/57.3)+math.sin((2.*teeta/57.3)/(2.*n)))## velocity of piston in m/s\n", - "fp=w**2.*r*(math.cos(teeta/57.3)+math.cos(2.*teeta/57.3)/(2.*n))## acceleration of piston in m/s**2\n", - "costeeta1=(-n+(n**2.+4.*2.*1.)**.5)/4.\n", - "teeta1=math.acos(costeeta1)*(57.3)## position of crank from inner dead centre position for zero acceleration of piston\n", - "##===========================\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('Velocity of Piston = ',Vp,' m/s'' Acceleration of piston =',fp,' m/s**2'' position of crank from inner dead centre position for zero acceleration of piston=',teeta1,' degrees')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity of Piston = 4.4 m/s Acceleration of piston = 83.5 m/s**2 position of crank from inner dead centre position for zero acceleration of piston= 79.3 degrees\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg161" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 3 PAGE NO 161\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "D=.3## Diameter of steam engine in m\n", - "L=.5## length of stroke in m\n", - "r=L/2.\n", - "mR=100.## equivalent of mass of reciprocating parts in kg\n", - "N=200.## speed of engine in rpm\n", - "teeta=45## angle of inclination of crank in degrees\n", - "p1=1.*10**6## gas pressure in N/m**2\n", - "p2=35.*10**3## back pressure in N/m**2\n", - "n=4.## ratio of crank radius to the length of stroke\n", - "##=================================\n", - "w=2.*pi*N/60## angular speed in rad/s\n", - "Fl=pi/4.*D**2.*(p1-p2)## Net load on piston in N\n", - "Fi=mR*w**2*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(2*n))## inertia force due to reciprocating parts\n", - "Fp=Fl-Fi## Piston effort\n", - "T=Fp*r*(math.sin(teeta/57.3)+(math.sin((2*teeta)/57.3))/(2.*(n**2-(math.sin(teeta/57.3))**2)**.5))\n", - "print'%s %.1f %s %.1f %s '%('Piston effort = ',Fp,' N' 'Turning moment on the crank shaft = ',T,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Piston effort = 60447.0 NTurning moment on the crank shaft = 12604.2 N-m \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg162" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 4 PAGE NO 162\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "D=.10## Diameter of petrol engine in m\n", - "L=.12## Stroke length in m\n", - "l=.25## length of connecting in m\n", - "r=L/2.\n", - "mR=1.2## mass of piston in kg\n", - "N=1800.## speed in rpm\n", - "teeta=25.## angle of inclination of crank in degrees\n", - "p=680.*10**3## gas pressure in N/m**2\n", - "n=l/r\n", - "g=9.81## acceleration due to gravity\n", - "##=======================================\n", - "w=2.*pi*N/60.## angular speed in rpm\n", - "Fl=pi/4.*D**2.*p## force due to gas pressure in N\n", - "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n))## inertia force due to reciprocating parts in N\n", - "Fp=Fl-Fi+mR*g## net force on piston in N\n", - "Fq=n*Fp/((n**2-(math.sin(teeta/57.3))**2.)**.5)## resultant load on gudgeon pin in N\n", - "Fn=Fp*math.sin(teeta/57.3)/((n**2-(math.sin(teeta/57.3))**2.)**.5)## thrust on cylinder walls in N\n", - "fi=Fl+mR*g## inertia force of the reciprocating parts before the gudgeon pin load is reversed in N\n", - "w1=(fi/mR/r/(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n)))**.5\n", - "N1=60.*w1/(2.*pi)\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Net force on piston = ',Fp,' N'' Resultant load on gudgeon pin = ',Fq,' N'' Thrust on cylinder walls = ',Fn,' N'' speed at which other things remining same,the gudgeon pin load would be reversed in directionm= ',N1,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Net force on piston = 2639.3 N Resultant load on gudgeon pin = 2652.9 N Thrust on cylinder walls = 269.1 N speed at which other things remining same,the gudgeon pin load would be reversed in directionm= 2528.4 rpm \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg163" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 5 PAGE NO 163\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "##Figure 5.3\n", - "import math\n", - "pi=3.141\n", - "N=1800.## speed of the petrol engine in rpm\n", - "r=.06## radius of crank in m\n", - "l=.240## length of connecting rod in m\n", - "D=.1## diameter of the piston in m\n", - "mR=1## mass of piston in kg\n", - "p=.8*10**6## gas pressure in N/m**2\n", - "x=.012## distance moved by piston in m\n", - "##===============================================\n", - "w=2.*pi*N/60.## angular velocity of the engine in rad/s\n", - "n=l/r\n", - "Fl=pi/4.*D**2.*p## load on the piston in N\n", - "teeta=32.## by mearument from the figure 5.3\n", - "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/n)## inertia force due to reciprocating parts in N\n", - "Fp=Fl-Fi## net load on the gudgeon pin in N\n", - "Fq=n*Fp/((n**2.-(math.sin(teeta/57.3))**2.)**.5)## thrust in the connecting rod in N\n", - "Fn=Fp*math.sin(teeta/57.3)/((n**2-(math.sin(teeta/57.3))**2)**.5)## reaction between the piston and cylinder in N\n", - "w1=(Fl/mR/r/(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n)))**.5\n", - "N1=60.*w1/(2.*pi)## \n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s'%('Net load on the gudgeon pin= ',Fp,' N''Thrust in the connecting rod= ',Fq,' N'' Reaction between the cylinder and piston= ',Fn,' N'' The engine speed at which the above values become zero= ',N1,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Net load on the gudgeon pin= 4241.2 NThrust in the connecting rod= 4278.9 N Reaction between the cylinder and piston= 566.8 N The engine speed at which the above values become zero= 3158.0 rpm\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 6 PAGE NO 165\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "D=.25## diameter of horizontal steam engine in m\n", - "N=180.## speed of the engine in rpm\n", - "d=.05## diameter of piston in m\n", - "P=36000.## power of the engine in watts\n", - "n=3.## ration of length of connecting rod to the crank radius\n", - "p1=5.8*10**5## pressure on cover end side in N/m**2\n", - "p2=0.5*10**5## pressure on crank end side in N/m**2\n", - "teeta=40.## angle of inclination of crank in degrees\n", - "m=45.## mass of flywheel in kg\n", - "k=.65## radius of gyration in m\n", - "##==============================\n", - "Fl=(pi/4.*D**2.*p1)-(pi/4.*(D**2.-d**2.)*p2)## load on the piston in N\n", - "ph=(math.sin(teeta/57.3)/n)\n", - "phi=math.asin(ph)*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", - "r=1.6*D/2.\n", - "T=Fl*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", - "Fb=Fl*math.cos((teeta+phi)/57.3)/math.cos(phi/57.3)## thrust on the crank shaft bearing in N\n", - "TR=P*60./(2.*pi*N)## steady resisting torque in N-m\n", - "Ts=T-TR## surplus torque available in N-m\n", - "a=Ts/(m*k**2)## acceleration of the flywheel in rad/s**2\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('Torque exerted on the crank shaft= ',T,' N-m'' Thrust on the crank shaft bearing= ',Fb,'N''Acceleration of the flywheel= ',a,' rad/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Torque exerted on the crank shaft= 4233.8 N-m Thrust on the crank shaft bearing= 16321.0 NAcceleration of the flywheel= 122.2 rad/s**2 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg166" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 7 PAGE NO 166\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "D=.25## diameter of vertical cylinder of steam engine in m\n", - "L=.45## stroke length in m\n", - "r=L/2.\n", - "n=4.\n", - "N=360.## speed of the engine in rpm\n", - "teeta=45.## angle of inclination of crank in degrees\n", - "p=1050000.## net pressure in N/m**2\n", - "mR=180.## mass of reciprocating parts in kg\n", - "g=9.81## acceleration due to gravity\n", - "##========================\n", - "Fl=p*pi*D**2./4.## force on piston due to steam pressure in N\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n))## inertia force due to reciprocating parts in N\n", - "Fp=Fl-Fi+mR*g## piston effort in N\n", - "phi=math.asin((math.sin(teeta/57.3)/n))*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", - "T=Fp*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", - "print'%s %.1f %s'%('Effective turning moment on the crank shaft= ',T,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Effective turning moment on the crank shaft= 2366.2 N-m\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg166" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 8 PAGE NO 166\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "##figure 5.4\n", - "import math\n", - "pi=3.141\n", - "D=.25## diameter of vertical cylinder of diesel engine in m\n", - "L=.40## stroke length in m\n", - "r=L/2.\n", - "n=4.\n", - "N=300.## speed of the engine in rpm\n", - "teeta=60.## angle of inclination of crank in degrees\n", - "mR=200.## mass of reciprocating parts in kg\n", - "g=9.81## acceleration due to gravity\n", - "l=.8## length of connecting rod in m\n", - "c=14.## compression ratio=v1/v2\n", - "p1=.1*10**6.## suction pressure in n/m**2\n", - "i=1.35## index of the law of expansion and compression \n", - "##==============================================================\n", - "Vs=pi/4.*D**2.*L## swept volume in m**3\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "Vc=Vs/(c-1.)\n", - "V3=Vc+Vs/10.## volume at the end of injection of fuel in m**3\n", - "p2=p1*c**i## final pressure in N/m**2\n", - "p3=p2## from figure\n", - "x=r*((1.-math.cos(teeta/57.3)+(math.sin(teeta/57.3))**2/(2.*n)))## the displacement of the piston when the crank makes an angle 60 degrees with T.D.C\n", - "Va=Vc+pi*D**2.*x/4.\n", - "pa=p3*(V3/Va)**i\n", - "p=pa-p1## difference of pressues on 2 sides of piston in N/m**2\n", - "Fl=p*pi*D**2./4.## net load on piston in N\n", - "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos(2.*teeta/57.3)/(n))## inertia force due to reciprocating parts in N\n", - "Fp=Fl-Fi+mR*g## piston effort in N\n", - "phi=math.asin((math.sin(teeta/57.3)/n))*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", - "T=Fp*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", - "print'%s %.1f %s'%('Effective turning moment on the crank shaft= ',T,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Effective turning moment on the crank shaft= 8850.3 N-m\n" - ] - } - ], - "prompt_number": 8 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter5_1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter5_1.ipynb deleted file mode 100755 index 74b1843d..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter5_1.ipynb +++ /dev/null @@ -1,413 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:626c3be6e4f7de20f0ed74b1f32975ee0b23b0772fac899ecdc291f6b1439ae8" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter5-Inertia Force Analysis in Machines" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg160" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 1 PAGE NO 160\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "r=.3## radius of crank in m\n", - "l=1.## length of connecting rod in m\n", - "N=200.## speed of the engine in rpm\n", - "n=l/r\n", - "##===================\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "\n", - "teeta=math.acos((-n+((n**2)+4*2*1)**.5)/(2*2))*57.3## angle of inclination of crank in degrees\n", - "Vp=w*r*(math.sin(teeta/57.3)+(math.sin((2*teeta)/57.3)/n))## maximum velocity of the piston in m/s\n", - "print'%s %.1f %s'%('Maximum velocity of the piston = ',Vp,' m/s')\n", - "print'%s %.2f %s'%('teeta',teeta,'')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum velocity of the piston = 7.0 m/s\n", - "teeta 74.96 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg161" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 2 PAGE NO 161\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "PI=3.141\n", - "r=.3## length of crank in metres\n", - "l=1.5## length of connecting rod in metres\n", - "N=180.## speed of rotation in rpm\n", - "teeta=40.## angle of inclination of crank in degrees\n", - "##============================\n", - "n=l/r\n", - "w=2.*PI*N/60## angular speed in rad/s\n", - "Vp=w*r*(math.sin(teeta/57.3)+math.sin((2.*teeta/57.3)/(2.*n)))## velocity of piston in m/s\n", - "fp=w**2.*r*(math.cos(teeta/57.3)+math.cos(2.*teeta/57.3)/(2.*n))## acceleration of piston in m/s**2\n", - "costeeta1=(-n+(n**2.+4.*2.*1.)**.5)/4.\n", - "teeta1=math.acos(costeeta1)*(57.3)## position of crank from inner dead centre position for zero acceleration of piston\n", - "##===========================\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('Velocity of Piston = ',Vp,' m/s'' Acceleration of piston =',fp,' m/s**2'' position of crank from inner dead centre position for zero acceleration of piston=',teeta1,' degrees')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity of Piston = 4.4 m/s Acceleration of piston = 83.5 m/s**2 position of crank from inner dead centre position for zero acceleration of piston= 79.3 degrees\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg161" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 3 PAGE NO 161\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "D=.3## Diameter of steam engine in m\n", - "L=.5## length of stroke in m\n", - "r=L/2.\n", - "mR=100.## equivalent of mass of reciprocating parts in kg\n", - "N=200.## speed of engine in rpm\n", - "teeta=45## angle of inclination of crank in degrees\n", - "p1=1.*10**6## gas pressure in N/m**2\n", - "p2=35.*10**3## back pressure in N/m**2\n", - "n=4.## ratio of crank radius to the length of stroke\n", - "##=================================\n", - "w=2.*pi*N/60## angular speed in rad/s\n", - "Fl=pi/4.*D**2.*(p1-p2)## Net load on piston in N\n", - "Fi=mR*w**2*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(2*n))## inertia force due to reciprocating parts\n", - "Fp=Fl-Fi## Piston effort\n", - "T=Fp*r*(math.sin(teeta/57.3)+(math.sin((2*teeta)/57.3))/(2.*(n**2-(math.sin(teeta/57.3))**2)**.5))\n", - "print'%s %.1f %s %.1f %s '%('Piston effort = ',Fp,' N' 'Turning moment on the crank shaft = ',T,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Piston effort = 60447.0 NTurning moment on the crank shaft = 12604.2 N-m \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg162" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 4 PAGE NO 162\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "D=.10## Diameter of petrol engine in m\n", - "L=.12## Stroke length in m\n", - "l=.25## length of connecting in m\n", - "r=L/2.\n", - "mR=1.2## mass of piston in kg\n", - "N=1800.## speed in rpm\n", - "teeta=25.## angle of inclination of crank in degrees\n", - "p=680.*10**3## gas pressure in N/m**2\n", - "n=l/r\n", - "g=9.81## acceleration due to gravity\n", - "##=======================================\n", - "w=2.*pi*N/60.## angular speed in rpm\n", - "Fl=pi/4.*D**2.*p## force due to gas pressure in N\n", - "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n))## inertia force due to reciprocating parts in N\n", - "Fp=Fl-Fi+mR*g## net force on piston in N\n", - "Fq=n*Fp/((n**2-(math.sin(teeta/57.3))**2.)**.5)## resultant load on gudgeon pin in N\n", - "Fn=Fp*math.sin(teeta/57.3)/((n**2-(math.sin(teeta/57.3))**2.)**.5)## thrust on cylinder walls in N\n", - "fi=Fl+mR*g## inertia force of the reciprocating parts before the gudgeon pin load is reversed in N\n", - "w1=(fi/mR/r/(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n)))**.5\n", - "N1=60.*w1/(2.*pi)\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Net force on piston = ',Fp,' N'' Resultant load on gudgeon pin = ',Fq,' N'' Thrust on cylinder walls = ',Fn,' N'' speed at which other things remining same,the gudgeon pin load would be reversed in directionm= ',N1,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Net force on piston = 2639.3 N Resultant load on gudgeon pin = 2652.9 N Thrust on cylinder walls = 269.1 N speed at which other things remining same,the gudgeon pin load would be reversed in directionm= 2528.4 rpm \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg163" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 5 PAGE NO 163\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "##Figure 5.3\n", - "import math\n", - "pi=3.141\n", - "N=1800.## speed of the petrol engine in rpm\n", - "r=.06## radius of crank in m\n", - "l=.240## length of connecting rod in m\n", - "D=.1## diameter of the piston in m\n", - "mR=1## mass of piston in kg\n", - "p=.8*10**6## gas pressure in N/m**2\n", - "x=.012## distance moved by piston in m\n", - "##===============================================\n", - "w=2.*pi*N/60.## angular velocity of the engine in rad/s\n", - "n=l/r\n", - "Fl=pi/4.*D**2.*p## load on the piston in N\n", - "teeta=32.## by mearument from the figure 5.3\n", - "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/n)## inertia force due to reciprocating parts in N\n", - "Fp=Fl-Fi## net load on the gudgeon pin in N\n", - "Fq=n*Fp/((n**2.-(math.sin(teeta/57.3))**2.)**.5)## thrust in the connecting rod in N\n", - "Fn=Fp*math.sin(teeta/57.3)/((n**2-(math.sin(teeta/57.3))**2)**.5)## reaction between the piston and cylinder in N\n", - "w1=(Fl/mR/r/(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n)))**.5\n", - "N1=60.*w1/(2.*pi)## \n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s'%('Net load on the gudgeon pin= ',Fp,' N''Thrust in the connecting rod= ',Fq,' N'' Reaction between the cylinder and piston= ',Fn,' N'' The engine speed at which the above values become zero= ',N1,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Net load on the gudgeon pin= 4241.2 NThrust in the connecting rod= 4278.9 N Reaction between the cylinder and piston= 566.8 N The engine speed at which the above values become zero= 3158.0 rpm\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg165" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 6 PAGE NO 165\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "D=.25## diameter of horizontal steam engine in m\n", - "N=180.## speed of the engine in rpm\n", - "d=.05## diameter of piston in m\n", - "P=36000.## power of the engine in watts\n", - "n=3.## ration of length of connecting rod to the crank radius\n", - "p1=5.8*10**5## pressure on cover end side in N/m**2\n", - "p2=0.5*10**5## pressure on crank end side in N/m**2\n", - "teeta=40.## angle of inclination of crank in degrees\n", - "m=45.## mass of flywheel in kg\n", - "k=.65## radius of gyration in m\n", - "##==============================\n", - "Fl=(pi/4.*D**2.*p1)-(pi/4.*(D**2.-d**2.)*p2)## load on the piston in N\n", - "ph=(math.sin(teeta/57.3)/n)\n", - "phi=math.asin(ph)*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", - "r=1.6*D/2.\n", - "T=Fl*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", - "Fb=Fl*math.cos((teeta+phi)/57.3)/math.cos(phi/57.3)## thrust on the crank shaft bearing in N\n", - "TR=P*60./(2.*pi*N)## steady resisting torque in N-m\n", - "Ts=T-TR## surplus torque available in N-m\n", - "a=Ts/(m*k**2)## acceleration of the flywheel in rad/s**2\n", - "print'%s %.1f %s %.1f %s %.1f %s '%('Torque exerted on the crank shaft= ',T,' N-m'' Thrust on the crank shaft bearing= ',Fb,'N''Acceleration of the flywheel= ',a,' rad/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Torque exerted on the crank shaft= 4233.8 N-m Thrust on the crank shaft bearing= 16321.0 NAcceleration of the flywheel= 122.2 rad/s**2 \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg166" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 7 PAGE NO 166\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "import math\n", - "pi=3.141\n", - "D=.25## diameter of vertical cylinder of steam engine in m\n", - "L=.45## stroke length in m\n", - "r=L/2.\n", - "n=4.\n", - "N=360.## speed of the engine in rpm\n", - "teeta=45.## angle of inclination of crank in degrees\n", - "p=1050000.## net pressure in N/m**2\n", - "mR=180.## mass of reciprocating parts in kg\n", - "g=9.81## acceleration due to gravity\n", - "##========================\n", - "Fl=p*pi*D**2./4.## force on piston due to steam pressure in N\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos((2*teeta)/57.3)/(n))## inertia force due to reciprocating parts in N\n", - "Fp=Fl-Fi+mR*g## piston effort in N\n", - "phi=math.asin((math.sin(teeta/57.3)/n))*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", - "T=Fp*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", - "print'%s %.1f %s'%('Effective turning moment on the crank shaft= ',T,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Effective turning moment on the crank shaft= 2366.2 N-m\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg166" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 5 ILLUSRTATION 8 PAGE NO 166\n", - "##TITLE:Inertia Force Analysis in Machines\n", - "##figure 5.4\n", - "import math\n", - "pi=3.141\n", - "D=.25## diameter of vertical cylinder of diesel engine in m\n", - "L=.40## stroke length in m\n", - "r=L/2.\n", - "n=4.\n", - "N=300.## speed of the engine in rpm\n", - "teeta=60.## angle of inclination of crank in degrees\n", - "mR=200.## mass of reciprocating parts in kg\n", - "g=9.81## acceleration due to gravity\n", - "l=.8## length of connecting rod in m\n", - "c=14.## compression ratio=v1/v2\n", - "p1=.1*10**6.## suction pressure in n/m**2\n", - "i=1.35## index of the law of expansion and compression \n", - "##==============================================================\n", - "Vs=pi/4.*D**2.*L## swept volume in m**3\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "Vc=Vs/(c-1.)\n", - "V3=Vc+Vs/10.## volume at the end of injection of fuel in m**3\n", - "p2=p1*c**i## final pressure in N/m**2\n", - "p3=p2## from figure\n", - "x=r*((1.-math.cos(teeta/57.3)+(math.sin(teeta/57.3))**2/(2.*n)))## the displacement of the piston when the crank makes an angle 60 degrees with T.D.C\n", - "Va=Vc+pi*D**2.*x/4.\n", - "pa=p3*(V3/Va)**i\n", - "p=pa-p1## difference of pressues on 2 sides of piston in N/m**2\n", - "Fl=p*pi*D**2./4.## net load on piston in N\n", - "Fi=mR*w**2.*r*(math.cos(teeta/57.3)+math.cos(2.*teeta/57.3)/(n))## inertia force due to reciprocating parts in N\n", - "Fp=Fl-Fi+mR*g## piston effort in N\n", - "phi=math.asin((math.sin(teeta/57.3)/n))*57.3## angle of inclination of the connecting rod to the line of stroke in degrees\n", - "T=Fp*math.sin((teeta+phi)/57.3)/math.cos(phi/57.3)*r## torque exerted on crank shaft in N-m\n", - "print'%s %.1f %s'%('Effective turning moment on the crank shaft= ',T,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Effective turning moment on the crank shaft= 8850.3 N-m\n" - ] - } - ], - "prompt_number": 8 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter6.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter6.ipynb deleted file mode 100755 index 895e2c68..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter6.ipynb +++ /dev/null @@ -1,486 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:a0a25762305b1c74ca417d46a7390eaac10578c3f22cb04bddc542c61d85667c" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter6-Turning Moment Diagram and Flywheel" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg175" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 1 PAGE NO 175\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "\n", - "k=1.## radius of gyration of flywheel in m\n", - "m=2000.## mass of the flywheel in kg\n", - "T=1000.## torque of the engine in Nm\n", - "w1=0.## speedin the begining\n", - "t=10.## time duration\n", - "##==============================\n", - "I=m*k**2.## mass moment of inertia in kg-m**2\n", - "a=T/I## angular acceleration of flywheel in rad/s**2\n", - "w2=w1+a*t## angular speed after time t in rad/s\n", - "K=I*w2**2/2.## kinetic energy of flywheel in Nm\n", - "##==============================\n", - "print'%s %.1f %s %.1f %s '%('Angular acceleration of the flywheel=',a,' rad/s**2'' Kinetic energy of flywheel= ',K,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Angular acceleration of the flywheel= 0.5 rad/s**2 Kinetic energy of flywheel= 25000.0 N-m \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg176" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 2 PAGE NO 176\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "N1=225.## maximum speed of flywheel in rpm\n", - "k=.5## radius of gyration of flywheel in m\n", - "n=720.## no of holes punched per hour\n", - "E1=15000.## energy required by flywheel in Nm\n", - "N2=200.## mimimum speedof flywheel in rpm\n", - "t=2.## time taking for punching a hole\n", - "##==========================\n", - "P=E1*n/3600.## power required by motor per sec in watts\n", - "E2=P*t## energy supplied by motor to punch a hole in N-m\n", - "E=E1-E2## maximum fluctuation of energy in N-m\n", - "N=(N1+N2)/2.## mean speed of the flywheel in rpm\n", - "m=E/(pi**2./900.*k**2.*N*(N1-N2))\n", - "print'%s %.1f %s %.1f %s'%('Power of the motor= ',P,' watts''Mass of the flywheel required= ',m,' kg')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power of the motor= 3000.0 wattsMass of the flywheel required= 618.2 kg\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg176" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 3 PAGE NO 176\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "d=38.## diameter of hole in cm\n", - "t=32.## thickness of hole in cm\n", - "e1=7.## energy required to punch one square mm\n", - "V=25.## mean speed of the flywheel in m/s\n", - "S=100.## stroke of the punch in cm\n", - "T=10.## time required to punch a hole in s\n", - "Cs=.03## coefficient of fluctuation of speed\n", - "##===================\n", - "A=pi*d*t## sheared area in mm**2\n", - "E1=e1*A## energy required to punch entire area in Nm\n", - "P=E1/T## power of motor required in watts\n", - "T1=T/(2.*S)*t## time required to punch a hole in 32 mm thick plate\n", - "E2=P*T1## energy supplied by motor in T1 seconds\n", - "E=E1-E2## maximum fluctuation of energy in Nm\n", - "m=E/(V**2.*Cs)## mass of the flywheel required\n", - "print'%s %.1f %s'%('Mass of the flywheel required= ',m,' kg')\n", - "\n", - "\t\t" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of the flywheel required= 1197.8 kg\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg177" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 4 PAGE NO 177\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "##figure 6.4\n", - "import math\n", - "##===================\n", - "pi=3.141\n", - "N=480.## speed of the engine in rpm\n", - "k=.6## radius of gyration in m\n", - "Cs=.03## coefficient of fluctuaion of speed \n", - "Ts=6000.## turning moment scale in Nm per one cm\n", - "C=30.## crank angle scale in degrees per cm\n", - "a=[0.5,-1.22,.9,-1.38,.83,-.7,1.07]## areas between the output torque and mean resistance line in sq.cm\n", - "##======================\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "A=Ts*C*pi/180.## 1 cm**2 of turning moment diagram in Nm\n", - "E1=a[0]## max energy at B refer figure\n", - "E2=a[0]+a[1]+a[2]+a[3]\n", - "E=(E1-E2)*A## fluctuation of energy in Nm\n", - "m=E/(k**2.*w**2*Cs)## mass of the flywheel in kg\n", - "print'%s %.1f %s'%('Mass of the flywheel= ',m,' kg')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of the flywheel= 195.8 kg\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg178" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 5 PAGE NO 178\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "##==============\n", - "pi=3.141\n", - "P=500.*10**3.## power of the motor in N\n", - "k=.6## radius of gyration in m\n", - "Cs=.03## coefficient of fluctuation of spped \n", - "OA=750.## REFER FIGURE\n", - "OF=6.*pi## REFER FIGURE\n", - "AG=pi## REFER FIGURE\n", - "BG=3000.-750.## REFER FIGURE\n", - "GH=2.*pi## REFER FIGURE\n", - "CH=3000.-750.## REFER FIGURE\n", - "HD=pi## REFER FIGURE\n", - "LM=2.*pi## REFER FIGURE\n", - "T=OA*OF+1./2.*AG*BG+BG*GH+1./2.*CH*HD## Torque required for one complete cycle in Nm\n", - "Tmean=T/(6.*pi)## mean torque in Nm\n", - "w=P/Tmean## angular velocity required in rad/s\n", - "BL=3000.-1875.## refer figure\n", - "KL=BL*AG/BG## From similar trangles\n", - "CM=3000.-1875.## refer figure\n", - "MN=CM*HD/CH##from similar triangles\n", - "E=1./2.*KL*BL+BL*LM+1./2.*CM*MN## Maximum fluctuaion of energy in Nm\n", - "m=E*100./(k**2*w**2.*Cs)## mass of flywheel in kg\n", - "print'%s %.1f %s'%('Mass of the flywheel= ',m,' kg')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of the flywheel= 1150.3 kg\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg179" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 6 PAGE NO 179\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "PI=180.##in degrees\n", - "theta1=0.\n", - "theta2=PI\n", - "m=400.## mass of the flywheel in kg\n", - "N=250.## speed in rpm\n", - "k=.4## radius of gyration in m\n", - "n=2.*250./60000.## no of working strokes per minute\n", - "W=1000.*pi-150.*math.cos((2*theta2)/57.3)-250.*math.sin((2*theta2)/57.3)-(1000.*theta1-150.*math.cos((2*theta1)/57.3)-250.*math.sin((2*theta1)/57.3))## workdone per stroke in Nm\n", - "P=W*n## power in KW\n", - "Tmean=W/pi## mean torque in Nm\n", - "twotheta=math.atan((500/300)/57.3)## angle at which T-Tmean becomes zero\n", - "THETA1=twotheta/2.\n", - "THETA2=(180.+twotheta)/2.\n", - "E=-150.*math.cos((2.*THETA2)/57.3)-250.*math.sin((2.*THETA2)/57.3)-(-150*math.cos((2.*THETA1)/57.3)-250.*math.sin((2*THETA1)/57.3))## FLUCTUATION OF ENERGY IN Nm\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "Cs1=E*100./(k**2.*w**2.*m)## fluctuation range\n", - "Cs=Cs1/2.## tatal percentage of fluctuation of speed\n", - "Theta=60.\n", - "T1=300.*math.sin((2*Theta)/57.3)-500.*math.cos((2*Theta)/57.3)## Accelerating torque in Nm(T-Tmean)\n", - "alpha=T1/(m*k**2.)## angular acceleration in rad/s**2\n", - "print'%s %.1f %s %.3f %s %.3f %s '%('Power delivered=',P,' kw''Total percentage of fluctuation speed=',Cs,' ''Angular acceleration=',alpha,'rad/s**2')\n", - "#in book ans is given wrong \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered= 26.2 kwTotal percentage of fluctuation speed= 0.342 Angular acceleration= 7.965 rad/s**2 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg181" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 7 PAGE NO 181\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "\n", - "pi=3.141\n", - "m=200.## mass of the flywheel in kg\n", - "k=.5## radius of gyration in m\n", - "N1=360.## upper limit of speed in rpm\n", - "N2=240.## lower limit of speed in rpm\n", - "##==========\n", - "I=m*k**2.## mass moment of inertia in kg m**2\n", - "w1=2.*pi*N1/60.\n", - "w2=2.*pi*N2/60.\n", - "E=1./2.*I*(w1**2.-w2**2.)## fluctuation of energy in Nm\n", - "Pmin=E/(4.*1000.)## power in kw\n", - "Eex=Pmin*12.*1000.## Energy expended in performing each operation in N-m\n", - "print'%s %.1f %s %.1f %s '%('Mimimum power required= ',Pmin,' kw' ' Energy expended in performing each operation= ',Eex,' N-m')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mimimum power required= 4.9 kw Energy expended in performing each operation= 59195.3 N-m \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg182" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 8 PAGE NO 182\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "b=8.## width of the strip in cm\n", - "t=2.## thickness of the strip in cm\n", - "w=1.2*10**3.## work required per square cm cut\n", - "N1=200.## maximum speed of the flywheel in rpm\n", - "k=.80## radius of gyration in m\n", - "N2=(1.-.15)*N1## minimum speed of the flywheel in rpm\n", - "T=3.## time required to punch a hole\n", - "##=======================\n", - "A=b*t## area cut of each stroke in cm**2\n", - "W=w*A## work required to cut a strip in Nm\n", - "w1=2.*pi*N1/60.## speed before cut in rpm\n", - "w2=2.*pi*N2/60.## speed after cut in rpm\n", - "m=2.*W/(k**2.*(w1**2.-w2**2.))## mass of the flywheel required in kg\n", - "a=(w1-w2)/T## angular acceleration in rad/s**2\n", - "Ta=m*k**2.*a## torque required in Nm\n", - "print'%s %.1f %s %.1f %s '%('Mass of the flywheel= ',m,' kg'' Amount of Torque required=',Ta,'Nm')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of the flywheel= 493.1 kg Amount of Torque required= 330.4 Nm \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg182" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 9 PAGE NO 182\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "\n", - "pi=3.141\n", - "P=5.*10**3.## power delivered by motor in watts\n", - "N1=360.## speed of the flywheel in rpm\n", - "I=60.## mass moment of inertia in kg m**2\n", - "E1=7500.## energy required by pressing machine for 1 second in Nm\n", - "##========================\n", - "Ehr=P*60.*60.## energy sipplied per hour in Nm\n", - "n=Ehr/E1\n", - "E=E1-P## total fluctuation of energy in Nm\n", - "w1=2.*pi*N1/60.## angular speed before pressing in rpm \n", - "w2=((2.*pi*N1/60.)**2.-(2.*E/I))**.5## angular speed after pressing in rpm \n", - "N2=w2*60./(2.*pi)\n", - "R=N1-N2## reduction in speed in rpm\n", - "print'%s %.1f %s %.1f %s '%('No of pressings that can be made per hour= ',n,' Reduction in speed after the pressing is over= ',R,' rpm ')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No of pressings that can be made per hour= 2400.0 Reduction in speed after the pressing is over= 10.7 rpm \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg183" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 10 PAGE NO 183\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "Cs=.02## coefficient of fluctuation of speed \n", - "N=200.## speed of the engine in rpm\n", - "\n", - "theta1=math.acos(0/57.3)\n", - "theta2=math.asin((-6000/16000)/57.3)\n", - "theta2=180.-theta2\n", - "##===============================================\n", - "##largest area,representing fluctuation of energy lies between theta1 and theta2\n", - "E=6000.*math.sin(theta2/57.3)-8000./2.*math.cos((2*theta2)/57.3)-(6000.*math.sin((theta1)/57.3)-8000./2.*math.cos((2*theta1)/57.3))## total fluctuation of energy in Nm\n", - "Theta=180## angle with which cycle will be repeated in degrees\n", - "Theta1=0\n", - "Tmean=1/pi*((15000*pi+(-8000*math.cos((2*Theta)/57.3))/2.)-((15000*Theta1+(-8000*math.cos((2*Theta1)/57.3))/2.)))## mean torque of engine in Nm\n", - "P=2*pi*N*Tmean/60000.## power of the engine in kw\n", - "w=2*pi*N/60.## angular speed of the engine in rad/s\n", - "I=E/(w**2.*Cs)## mass moment of inertia of flywheel in kg-m**2\n", - "print'%s %.1f %s %.1f %s '%('Power of the engine= ',P,' kw'' minimum mass moment of inertia of flywheel=',-I,' kg-m**2'' E value calculated in the textbook is wrong. Its value is -15,124. In textbook it is given as -1370.28')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power of the engine= 314.1 kw minimum mass moment of inertia of flywheel= 19.5 kg-m**2 E value calculated in the textbook is wrong. Its value is -15,124. In textbook it is given as -1370.28 \n" - ] - } - ], - "prompt_number": 11 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter6_1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter6_1.ipynb deleted file mode 100755 index a0f3b8e9..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter6_1.ipynb +++ /dev/null @@ -1,486 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:74d0df4cf80d7ace4461100f60c8b8167c72dcd7ef78207080312ad5a8f6982b" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter6-Turning Moment Diagram and Flywheel" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg175" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 1 PAGE NO 175\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "\n", - "k=1.## radius of gyration of flywheel in m\n", - "m=2000.## mass of the flywheel in kg\n", - "T=1000.## torque of the engine in Nm\n", - "w1=0.## speedin the begining\n", - "t=10.## time duration\n", - "##==============================\n", - "I=m*k**2.## mass moment of inertia in kg-m**2\n", - "a=T/I## angular acceleration of flywheel in rad/s**2\n", - "w2=w1+a*t## angular speed after time t in rad/s\n", - "K=I*w2**2/2.## kinetic energy of flywheel in Nm\n", - "##==============================\n", - "print'%s %.1f %s %.1f %s '%('Angular acceleration of the flywheel=',a,' rad/s**2'' Kinetic energy of flywheel= ',K,' N-m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Angular acceleration of the flywheel= 0.5 rad/s**2 Kinetic energy of flywheel= 25000.0 N-m \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg176" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 2 PAGE NO 176\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "N1=225.## maximum speed of flywheel in rpm\n", - "k=.5## radius of gyration of flywheel in m\n", - "n=720.## no of holes punched per hour\n", - "E1=15000.## energy required by flywheel in Nm\n", - "N2=200.## mimimum speedof flywheel in rpm\n", - "t=2.## time taking for punching a hole\n", - "##==========================\n", - "P=E1*n/3600.## power required by motor per sec in watts\n", - "E2=P*t## energy supplied by motor to punch a hole in N-m\n", - "E=E1-E2## maximum fluctuation of energy in N-m\n", - "N=(N1+N2)/2.## mean speed of the flywheel in rpm\n", - "m=E/(pi**2./900.*k**2.*N*(N1-N2))\n", - "print'%s %.1f %s %.1f %s'%('Power of the motor= ',P,' watts''Mass of the flywheel required= ',m,' kg')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power of the motor= 3000.0 wattsMass of the flywheel required= 618.2 kg\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg176" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 3 PAGE NO 176\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "d=38.## diameter of hole in cm\n", - "t=32.## thickness of hole in cm\n", - "e1=7.## energy required to punch one square mm\n", - "V=25.## mean speed of the flywheel in m/s\n", - "S=100.## stroke of the punch in cm\n", - "T=10.## time required to punch a hole in s\n", - "Cs=.03## coefficient of fluctuation of speed\n", - "##===================\n", - "A=pi*d*t## sheared area in mm**2\n", - "E1=e1*A## energy required to punch entire area in Nm\n", - "P=E1/T## power of motor required in watts\n", - "T1=T/(2.*S)*t## time required to punch a hole in 32 mm thick plate\n", - "E2=P*T1## energy supplied by motor in T1 seconds\n", - "E=E1-E2## maximum fluctuation of energy in Nm\n", - "m=E/(V**2.*Cs)## mass of the flywheel required\n", - "print'%s %.1f %s'%('Mass of the flywheel required= ',m,' kg')\n", - "\n", - "\t\t" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of the flywheel required= 1197.8 kg\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg177" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 4 PAGE NO 177\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "##figure 6.4\n", - "import math\n", - "##===================\n", - "pi=3.141\n", - "N=480.## speed of the engine in rpm\n", - "k=.6## radius of gyration in m\n", - "Cs=.03## coefficient of fluctuaion of speed \n", - "Ts=6000.## turning moment scale in Nm per one cm\n", - "C=30.## crank angle scale in degrees per cm\n", - "a=[0.5,-1.22,.9,-1.38,.83,-.7,1.07]## areas between the output torque and mean resistance line in sq.cm\n", - "##======================\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "A=Ts*C*pi/180.## 1 cm**2 of turning moment diagram in Nm\n", - "E1=a[0]## max energy at B refer figure\n", - "E2=a[0]+a[1]+a[2]+a[3]\n", - "E=(E1-E2)*A## fluctuation of energy in Nm\n", - "m=E/(k**2.*w**2*Cs)## mass of the flywheel in kg\n", - "print'%s %.1f %s'%('Mass of the flywheel= ',m,' kg')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of the flywheel= 195.8 kg\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg178" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 5 PAGE NO 178\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "##==============\n", - "pi=3.141\n", - "P=500.*10**3.## power of the motor in N\n", - "k=.6## radius of gyration in m\n", - "Cs=.03## coefficient of fluctuation of spped \n", - "OA=750.## REFER FIGURE\n", - "OF=6.*pi## REFER FIGURE\n", - "AG=pi## REFER FIGURE\n", - "BG=3000.-750.## REFER FIGURE\n", - "GH=2.*pi## REFER FIGURE\n", - "CH=3000.-750.## REFER FIGURE\n", - "HD=pi## REFER FIGURE\n", - "LM=2.*pi## REFER FIGURE\n", - "T=OA*OF+1./2.*AG*BG+BG*GH+1./2.*CH*HD## Torque required for one complete cycle in Nm\n", - "Tmean=T/(6.*pi)## mean torque in Nm\n", - "w=P/Tmean## angular velocity required in rad/s\n", - "BL=3000.-1875.## refer figure\n", - "KL=BL*AG/BG## From similar trangles\n", - "CM=3000.-1875.## refer figure\n", - "MN=CM*HD/CH##from similar triangles\n", - "E=1./2.*KL*BL+BL*LM+1./2.*CM*MN## Maximum fluctuaion of energy in Nm\n", - "m=E*100./(k**2*w**2.*Cs)## mass of flywheel in kg\n", - "print'%s %.1f %s'%('Mass of the flywheel= ',m,' kg')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of the flywheel= 1150.3 kg\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg179" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 6 PAGE NO 179\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "PI=180.##in degrees\n", - "theta1=0.\n", - "theta2=PI\n", - "m=400.## mass of the flywheel in kg\n", - "N=250.## speed in rpm\n", - "k=.4## radius of gyration in m\n", - "n=2.*250./60000.## no of working strokes per minute\n", - "W=1000.*pi-150.*math.cos((2*theta2)/57.3)-250.*math.sin((2*theta2)/57.3)-(1000.*theta1-150.*math.cos((2*theta1)/57.3)-250.*math.sin((2*theta1)/57.3))## workdone per stroke in Nm\n", - "P=W*n## power in KW\n", - "Tmean=W/pi## mean torque in Nm\n", - "twotheta=math.atan((500/300)/57.3)## angle at which T-Tmean becomes zero\n", - "THETA1=twotheta/2.\n", - "THETA2=(180.+twotheta)/2.\n", - "E=-150.*math.cos((2.*THETA2)/57.3)-250.*math.sin((2.*THETA2)/57.3)-(-150*math.cos((2.*THETA1)/57.3)-250.*math.sin((2*THETA1)/57.3))## FLUCTUATION OF ENERGY IN Nm\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "Cs1=E*100./(k**2.*w**2.*m)## fluctuation range\n", - "Cs=Cs1/2.## tatal percentage of fluctuation of speed\n", - "Theta=60.\n", - "T1=300.*math.sin((2*Theta)/57.3)-500.*math.cos((2*Theta)/57.3)## Accelerating torque in Nm(T-Tmean)\n", - "alpha=T1/(m*k**2.)## angular acceleration in rad/s**2\n", - "print'%s %.1f %s %.3f %s %.3f %s '%('Power delivered=',P,' kw''Total percentage of fluctuation speed=',Cs,' ''Angular acceleration=',alpha,'rad/s**2')\n", - "#in book ans is given wrong \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power delivered= 26.2 kwTotal percentage of fluctuation speed= 0.342 Angular acceleration= 7.965 rad/s**2 \n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg181" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 7 PAGE NO 181\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "\n", - "pi=3.141\n", - "m=200.## mass of the flywheel in kg\n", - "k=.5## radius of gyration in m\n", - "N1=360.## upper limit of speed in rpm\n", - "N2=240.## lower limit of speed in rpm\n", - "##==========\n", - "I=m*k**2.## mass moment of inertia in kg m**2\n", - "w1=2.*pi*N1/60.\n", - "w2=2.*pi*N2/60.\n", - "E=1./2.*I*(w1**2.-w2**2.)## fluctuation of energy in Nm\n", - "Pmin=E/(4.*1000.)## power in kw\n", - "Eex=Pmin*12.*1000.## Energy expended in performing each operation in N-m\n", - "print'%s %.1f %s %.1f %s '%('Mimimum power required= ',Pmin,' kw' ' Energy expended in performing each operation= ',Eex,' N-m')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mimimum power required= 4.9 kw Energy expended in performing each operation= 59195.3 N-m \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex8-pg182" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 8 PAGE NO 182\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "b=8.## width of the strip in cm\n", - "t=2.## thickness of the strip in cm\n", - "w=1.2*10**3.## work required per square cm cut\n", - "N1=200.## maximum speed of the flywheel in rpm\n", - "k=.80## radius of gyration in m\n", - "N2=(1.-.15)*N1## minimum speed of the flywheel in rpm\n", - "T=3.## time required to punch a hole\n", - "##=======================\n", - "A=b*t## area cut of each stroke in cm**2\n", - "W=w*A## work required to cut a strip in Nm\n", - "w1=2.*pi*N1/60.## speed before cut in rpm\n", - "w2=2.*pi*N2/60.## speed after cut in rpm\n", - "m=2.*W/(k**2.*(w1**2.-w2**2.))## mass of the flywheel required in kg\n", - "a=(w1-w2)/T## angular acceleration in rad/s**2\n", - "Ta=m*k**2.*a## torque required in Nm\n", - "print'%s %.1f %s %.1f %s '%('Mass of the flywheel= ',m,' kg'' Amount of Torque required=',Ta,'Nm')\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of the flywheel= 493.1 kg Amount of Torque required= 330.4 Nm \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg182" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 9 PAGE NO 182\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "\n", - "pi=3.141\n", - "P=5.*10**3.## power delivered by motor in watts\n", - "N1=360.## speed of the flywheel in rpm\n", - "I=60.## mass moment of inertia in kg m**2\n", - "E1=7500.## energy required by pressing machine for 1 second in Nm\n", - "##========================\n", - "Ehr=P*60.*60.## energy sipplied per hour in Nm\n", - "n=Ehr/E1\n", - "E=E1-P## total fluctuation of energy in Nm\n", - "w1=2.*pi*N1/60.## angular speed before pressing in rpm \n", - "w2=((2.*pi*N1/60.)**2.-(2.*E/I))**.5## angular speed after pressing in rpm \n", - "N2=w2*60./(2.*pi)\n", - "R=N1-N2## reduction in speed in rpm\n", - "print'%s %.1f %s %.1f %s '%('No of pressings that can be made per hour= ',n,' Reduction in speed after the pressing is over= ',R,' rpm ')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No of pressings that can be made per hour= 2400.0 Reduction in speed after the pressing is over= 10.7 rpm \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg183" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 6 ILLUSRTATION 10 PAGE NO 183\n", - "##TITLE:Turning Moment Diagram and Flywheel\n", - "import math\n", - "pi=3.141\n", - "Cs=.02## coefficient of fluctuation of speed \n", - "N=200.## speed of the engine in rpm\n", - "\n", - "theta1=math.acos(0/57.3)\n", - "theta2=math.asin((-6000/16000)/57.3)\n", - "theta2=180.-theta2\n", - "##===============================================\n", - "##largest area,representing fluctuation of energy lies between theta1 and theta2\n", - "E=6000.*math.sin(theta2/57.3)-8000./2.*math.cos((2*theta2)/57.3)-(6000.*math.sin((theta1)/57.3)-8000./2.*math.cos((2*theta1)/57.3))## total fluctuation of energy in Nm\n", - "Theta=180## angle with which cycle will be repeated in degrees\n", - "Theta1=0\n", - "Tmean=1/pi*((15000*pi+(-8000*math.cos((2*Theta)/57.3))/2.)-((15000*Theta1+(-8000*math.cos((2*Theta1)/57.3))/2.)))## mean torque of engine in Nm\n", - "P=2*pi*N*Tmean/60000.## power of the engine in kw\n", - "w=2*pi*N/60.## angular speed of the engine in rad/s\n", - "I=E/(w**2.*Cs)## mass moment of inertia of flywheel in kg-m**2\n", - "print'%s %.1f %s %.1f %s '%('Power of the engine= ',P,' kw'' minimum mass moment of inertia of flywheel=',-I,' kg-m**2'' E value calculated in the textbook is wrong. Its value is -15,124. In textbook it is given as -1370.28')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power of the engine= 314.1 kw minimum mass moment of inertia of flywheel= 19.5 kg-m**2 E value calculated in the textbook is wrong. Its value is -15,124. In textbook it is given as -1370.28 \n" - ] - } - ], - "prompt_number": 11 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter7.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter7.ipynb deleted file mode 100755 index 064e91a6..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter7.ipynb +++ /dev/null @@ -1,638 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e7c45b9f9a74c2d06cff538ea39937b4592b2eb0de2281e1b9530b19c7e61df9" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter7-GOVERNORS" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg196" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 1 PAGE NO 196\n", - "##TITLE:GOVERNORS\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "L=.4## LENGTH OF UPPER ARM IN m\n", - "THETA=30.## INCLINATION TO THE VERTICAL IN degrees\n", - "K=.02## RISED LENGTH IN m\n", - "##============================================================================================\n", - "h2=L*math.cos(THETA/57.3)## GOVERNOR HEIGHT IN m\n", - "N2=(895./h2)**.5## SPEED AT h2 IN rpm\n", - "h1=h2-K## LENGTH WHEN IT IS RAISED BY 2 cm\n", - "N1=(895./h1)**.5## SPEED AT h1 IN rpm\n", - "n=(N1-N2)/N2*100.## PERCENTAGE CHANGE IN SPEED\n", - "##==========================================================================================\n", - "print'%s %.1f %s'%('PERCENTAGE CHANGE IN SPEED=',n,' PERCENTAGE')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "PERCENTAGE CHANGE IN SPEED= 3.0 PERCENTAGE\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 2 PAGE NO 197\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.5(A),7.5(B)\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "OA=.3## LENGTH OF UPPER ARM IN m\n", - "m=6.## MASS OF EACH BALL IN Kg\n", - "M=18.## MASS OF SLEEVE IN Kg\n", - "r2=.2## RADIUS OF ROTATION AT BEGINING IN m\n", - "r1=.25## RADIUS OF ROTATION AT MAX SPEED IN m\n", - "##===========================================================================================\n", - "h1=(OA**2.-r1**2.)**.5## HIEGHT OF GOVERNOR AT MAX SPEED IN m\n", - "N1=(895.*(m+M)/(h1*m))**.5## MAX SPEED IN rpm\n", - "h2=(OA**2.-r2**2.)**.5## HEIGHT OF GONERNOR AT BEGINING IN m\n", - "N2=(895.*(m+M)/(h2*m))**.5## MIN SPEED IN rpm\n", - "##===========================================================================================\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('MAX SPEED = ',N1,' rpm'' MIN SPEED = ',N2,' rpm''RANGE OF SPEED = ',N1-N2,' rpm')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "MAX SPEED = 146.9 rpm MIN SPEED = 126.5 rpmRANGE OF SPEED = 20.4 rpm\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 3 PAGE NO 197\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.6\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "OA=.25## LENGHT OF UPPER ARM IN m\n", - "CD=.03## DISTANCE BETWEEN LEEVE AND LOWER ARM IN m\n", - "m=6.## MASS OF BALL IN Kg\n", - "M=48.## MASS OF SLEEVE IN Kg\n", - "AE=.17## FROM FIGURE 7.6\n", - "AE1=.12## FROM FIGURE 7.6\n", - "r1=.2## RADIUS OF ROTATION AT MAX SPEED IN m\n", - "r2=.15## RADIUS OF ROTATION AT MIN SPEED IN m\n", - "##============================================================================================\n", - "h1=(OA**2-r1**2)**.5## HIEGHT OF GOVERNOR AT MIN SPEED IN m\n", - "TANalpha=r1/h1\n", - "TANbeeta=AE/(OA**2-AE**2)**.5\n", - "k=TANbeeta/TANalpha\n", - "N1=(895.*(m+(M*(1.+k)/2.))/(h1*m))**.5## MIN SPEED IN rpm\n", - "h2=(OA**2-r2**2)**.5## HIEGHT OF GOVERNOR AT MAX SPEED IN m\n", - "CE=(OA**2-AE1**2)**.5\n", - "TANalpha1=r2/h2\n", - "TANbeeta1=(r2-CD)/CE\n", - "k=TANbeeta1/TANalpha1\n", - "N2=(895.*(m+(M*(1.+k)/2.))/(h2*m))**.5## MIN SPEED IN rpm\n", - "##========================================================================================================\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('MAX SPEED = ',N1,' rpm'' MIN SPEED = ',N2,' rpm''RANGE OF SPEED = ',N1-N2,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "MAX SPEED = 215.5 rpm MIN SPEED = 188.2 rpmRANGE OF SPEED = 27.2 rpm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg199" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 4 PAGE NO 199\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.7\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "g=9.81## ACCELERATION DUE TO GRAVITY \n", - "OA=.20## LENGHT OF UPPER ARM IN m\n", - "AC=.20## LENGTH OF LOWER ARM IN m\n", - "CD=.025## DISTANCE BETWEEN AXIS AND LOWER ARM IN m\n", - "AB=.1## RADIUS OF ROTATION OF BALLS IN m\n", - "N2=250## SPEED OF THE GOVERNOR IN rpm\n", - "X=.05## SLEEVE LIFT IN m\n", - "m=5.## MASS OF BALL IN Kg\n", - "M=20.## MASS OF SLEEVE IN Kg\n", - "##===========================================================\n", - "h2=(OA**2.-AB**2.)**.5## OB DISTANCE IN m IN FIGURE\n", - "h21=(AC**2.-(AB-CD)**2.)**.5## BD DISTANCE IN m IN FIGURE\n", - "TANbeeta=(AB-CD)/h21## TAN OF ANGLE OF INCLINATION OF THE LINK TO THE VERTICAL\n", - "TANalpha=AB/h2## TAN OF ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", - "k=TANbeeta/TANalpha\n", - "c=X/(2.*(h2*(1.+k)-X))## PERCENTAGE INCREASE IN SPEED \n", - "n=c*N2## INCREASE IN SPEED IN rpm\n", - "N1=N2+n## SPEED AFTER LIFT OF SLEEVE\n", - "E=c*g*((2.*m/(1.+k))+M)## GOVERNOR EFFORT IN N\n", - "P=E*X## GOVERNOR POWER IN N-m\n", - "\n", - "print'%s %.1f %s %.2f %s %.1f %s '%('SPEED OF THE GOVERNOR WHEN SLEEVE IS LIFT BY 5 cm = ',N1,' rpm'' GOVERNOR EFFORT = ',E,' N' 'GOVERNOR POWER = ',P,' N-m')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "SPEED OF THE GOVERNOR WHEN SLEEVE IS LIFT BY 5 cm = 275.6 rpm GOVERNOR EFFORT = 25.95 NGOVERNOR POWER = 1.3 N-m \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg200" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 5 PAGE NO 200\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.8\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "g=9.81## ACCELERATION DUE TO GRAVITY \n", - "OA=.30## LENGHT OF UPPER ARM IN m\n", - "AC=.30## LENGTH OF LOWER ARM IN m\n", - "m=10.## MASS OF BALL IN Kg\n", - "M=50.## MASS OF SLEEVE IN Kg\n", - "r=.2## RADIUS OF ROTATION IN m\n", - "CD=.04## DISTANCE BETWEEN AXIS AND LOWER ARM IN m\n", - "F=15.## FRICTIONAL LOAD ACTING IN N\n", - "##============================================================\n", - "h=(OA**2-r**2)**.5## HIEGTH OF THE GOVERNOR IN m\n", - "AE=r-CD## AE VALUE IN m\n", - "CE=(AC**2-AE**2)**.5## BD DISTANCE IN m\n", - "TANalpha=r/h## TAN OF ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", - "TANbeeta=AE/CE## TAN OF ANGLE OF INCLINATION OF THE LINK TO THE VERTICAL\n", - "k=TANbeeta/TANalpha\n", - "N=((895./h)*(m+(M*(1.+k)/2.))/m)**.5## EQULIBRIUM SPEED IN rpm\n", - "N1=((895./h)*((m*g)+(M*g+F)/2.)*(1.+k)/(m*g))**.5## MAX SPEED IN rpm\n", - "N2=((895./h)*((m*g)+(M*g-F)/2.)*(1.+k)/(m*g))**.5## MIN SPEED IN rpm\n", - "R=N1-N2## RANGE OF SPEED\n", - "print'%s %.1f %s %.1f %s '%('EQUILIBRIUM SPEED OF GOVERNOR = ',N,' rpm'' RANGE OF SPEED OF GOVERNOR= ',R,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "EQUILIBRIUM SPEED OF GOVERNOR = 145.1 rpm RANGE OF SPEED OF GOVERNOR= 3.4 rpm \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg202" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 6 PAGE NO 202\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.9\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "g=9.81## ACCELERATION DUE TO GRAVITY \n", - "OA=.30## LENGHT OF UPPER ARM IN m\n", - "AC=.30## LENGTH OF LOWER ARM IN m\n", - "m=5.## MASS OF BALL IN Kg\n", - "M=25.## MASS OF SLEEVE IN Kg\n", - "X=.05## LIFT OF THE SLEEVE\n", - "alpha=30.## ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", - "##==============================================\n", - "h2=OA*math.cos(alpha/57.3)## HEIGHT OF THE GOVERNOR AT LOWEST POSITION OF SLEEVE\n", - "h1=h2-X/2.## HEIGHT OF THE GOVERNOR AT HEIGHT POSITION OF SLEEVE\n", - "F=((h2/h1)*(m*g+M*g)-(m*g+M*g))/(1.+h2/h1)## FRICTION AT SLEEVE IN N\n", - "N1=((m*g+M*g+F)*895./(h1*m*g))**.5## MAX SPEEED OF THE GOVVERNOR IN rpm\n", - "N2=((m*g+M*g-F)*895./(h2*m*g))**.5## MIN SPEEED OF THE GOVVERNOR IN rpm\n", - "R=N1-N2## RANGE OF SPEED IN rpm\n", - "\n", - "print'%s %.1f %s %.1f %s'%('THE VALUE OF FRICTIONAL FORCE= ',F,' F'' RANGE OF SPEED OF THE GOVERNOR = ',R,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE VALUE OF FRICTIONAL FORCE= 14.9 F RANGE OF SPEED OF THE GOVERNOR = 14.9 rpm\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg203" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 7 PAGE NO 203\n", - "##TITLE:GOVERNORS\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "m=3## MASS OF EACH BALL IN Kg\n", - "a=.12## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", - "b=.08## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", - "r2=.12## RADIUS OF ROTATION OF THE BALL FOR LOWEST POSITION IN m\n", - "N2=320.## SPEED OF GOVERNOR AT THE BEGINING IN rpm\n", - "S=20000.## STIFFNESS OF THE SPRING IN N/m\n", - "h=.015## SLEEVE LIFT IN m\n", - "##==================================================\n", - "Fc2=m*(2.*PI*N2/60.)**2*r2## CENTRIFUGAL FORCE ACTING AT MIN SPEED OF ROTATION IN N\n", - "L=2*a*Fc2/b## INITIAL LOAD ON SPRING IN N\n", - "r1=a/b*h+r2## MAX RADIUS OF ROTATION IN m\n", - "Fc1=(S*(r1-r2)*(b/a)**2/2)+Fc2## CENTRIFUGAL FORCE ACTING AT MAX SPEED OF ROTATION IN N\n", - "N1=(Fc1/(m*r1)*(60./2./PI)**2)**.5\n", - "print'%s %.1f %s %.1f %s '%('INITIAL LOAD ON SPRING =',L,' N'' EQUILIBRIUM SPEED CORRESPONDING TO LIFT OF 15 cm =',N1,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "INITIAL LOAD ON SPRING = 1217.0 N EQUILIBRIUM SPEED CORRESPONDING TO LIFT OF 15 cm = 327.9 rpm \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg204" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 8 PAGE NO 204\n", - "##TITLE:GOVERNORS\n", - "\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "m=3## MASS OF BALL IN Kg\n", - "r2=.2## INITIAL RADIUS OF ROTATION IN m\n", - "a=.11## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", - "b=.15## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", - "h=.004## SLEEVE LIFT IN m\n", - "N2=240.## INITIAL SPEED IN rpm\n", - "n=7.5## FLUCTUATION OF SPEED IN %\n", - "##===================================\n", - "w2=2.*PI*N2/60.## INITIAL ANGULAR SPEED IN rad/s\n", - "w1=(100.+n)*w2/100.## FINAL ANGULAR SPEED IN rad/s\n", - "F=2.*a/b*m*w2**2.*r2## INITIAL COMPRESSIVE FORCE IN N\n", - "r1=r2+a/b*h## MAX RDIUS OF ROTATION IN m\n", - "S=2.*((m*w1**2.*r1)-(m*w2**2.*r2))/(r1-r2)*(a/b)**2.\n", - "print'%s %.1f %s %.1f %s'%('INITIAL COMPRESSIVE FPRCE = ',F,' N'' STIFFNESS OF THE SPRING = ',S/1000,' N/m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "INITIAL COMPRESSIVE FPRCE = 557.8 N STIFFNESS OF THE SPRING = 24.1 N/m\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg204" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 9 PAGE NO 204\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.3(C)\n", - "\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "g=9.81## ACCELERATION DUE TO GRAVITY \n", - "PI=3.147\n", - "r=.14## DISTANCE BETWEEN THE CENTRE OF PIVOT OF BELL CRANK LEVER AND AXIS OF GOVERNOR SPINDLE IN m\n", - "r2=.11## INITIAL RADIUS OF ROTATION IN m\n", - "a=.12## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", - "b=.10## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", - "h=.05## SLEEVE LIFT IN m\n", - "N2=240## INITIAL SPEED IN rpm\n", - "F=30## FRICTIONAL FORCE ACTING IN N\n", - "m=5## MASS OF EACH BALL IN Kg\n", - "##==========================================\n", - "r1=r2+a/b*h## MAX RADIUS OF ROTATION IN m\n", - "N1=41.*N2/39.## MAX SPEED OF ROTATION IN rpm\n", - "N=(N1+N2)/2.## MEAN SPEED IN rpm\n", - "Fc1=m*(2.*PI*N1/60.)**2.*r1## CENTRIFUGAL FORCE ACTING AT MAX SPEED OF ROTATION IN N\n", - "Fc2=m*(2.*PI*N2/60.)**2.*r2## CENTRIFUGAL FORCE ACTING AT MIN SPEED OF ROTATION IN N\n", - "c1=r1-r## FROM FIGURE 7.3(C) IN m\n", - "a1=(a**2.-c1**2.)**.5## FROM FIGURE 7.3(C) IN m\n", - "b1=(b**2.-(h/2.)**2.)**.5## FROM FIGURE 7.3(C) IN m\n", - "c2=r-r2## FROM FIGURE 7.3(C) IN m\n", - "a2=a1## FROM FIGURE 7.3(C) IN m\n", - "b2=b1## FROM FIGURE 7.3(C) IN m\n", - "S1=2.*((Fc1*a1)-(m*g*c1))/b1## SPRING FORCE EXERTED ON THE SLEEVE AT MAXIMUM SPEED IN NEWTONS\n", - "S2=2.*((Fc2*a2)-(m*g*c2))/b2## SPRING FORCE EXERTED ON THE SLEEVE AT MAXIMUM SPEED IN NEWTONS\n", - "S=(S1-S2)/h## STIFFNESS OF THE SPRING IN N/m\n", - "Is=S2/S## INITIAL COMPRESSION OF SPRING IN m\n", - "P=S2+(h/2.*S)## SPRING FORCE OF MID PORTION IN N\n", - "n1=N*((P+F)/P)**.5## SPEED,WHEN THE SLEEVE BEGINS TO MOVE UPWARDS FROM MID POSITION IN rpm\n", - "n2=N*((P-F)/P)**.5## SPEED,WHEN THE SLEEVE BEGINS TO MOVE DOWNWARDS FROM MID POSITION IN rpm\n", - "A=n1-n2## ALTERATION IN SPEED IN rpm\n", - "print'%s %.1f %s %.1f %s '%('INTIAL COMPRESSION OF SPRING= ',Is*100,' cm''ALTERATION IN SPEED = ',A,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "INTIAL COMPRESSION OF SPRING= 6.8 cmALTERATION IN SPEED = 6.7 rpm \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg206" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 10 PAGE NO 206\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.10\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "AE=.25## LENGTH OF UPPER ARM IN m\n", - "CE=.25## LENGTH OF LOWER ARM IN m\n", - "EH=.1## LENGTH OF EXTENDED ARM IN m\n", - "EF=.15## RADIUS OF BALL PATH IN m\n", - "m=5.## MASS OF EACH BALL IN Kg\n", - "M=40.## MASS OF EACH BALL IN Kg\n", - "##===================================================================\n", - "h=(AE**2.-EF**2.)**.5## HEIGHT OF THE GOVERNOR IN m\n", - "EM=h\n", - "HM=EH+EM## FROM FIGURE 7.10\n", - "N=((895./h)*(EM/HM)*((m+M)/m))**.5\n", - "print'%s %.1f %s'%('EQUILIBRIUM SPEED OF GOVERNOR =',N,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "EQUILIBRIUM SPEED OF GOVERNOR = 163.9 rpm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg207" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 11 PAGE NO 207\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.11\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N/mm**2\n", - "AE=.25## LENGTH OF UPPER ARM IN m\n", - "CE=.25## LENGTH OF LOWER ARM IN m\n", - "ER=.175## FROM FIGURE 7.11\n", - "AP=.025## FROM FIGURE 7.11\n", - "FR=AP## FROM FIGURE 7.11\n", - "CQ=FR## FROM FIGURE 7.11\n", - "m=3.2## MASS OF BALL IN Kg\n", - "M=25.## MASS OF SLEEVE IN Kg\n", - "h=.2## VERTICAL HEIGHT OF GOVERNOR IN m\n", - "EM=h## FROM FIGURE 7.11\n", - "AF=h## FROM FIGURE 7.11\n", - "N=160.## SPEED OF THE GOVERNOR IN rpm\n", - "HM=(895.*EM*(m+M)/(h*N**2.*m))\n", - "x=HM-EM## LENGTH OF EXTENDED LINK IN m\n", - "T1=g*(m+M/2.)*AE/AF## TENSION IN UPPER ARM IN N\n", - "print'%s %.3f %s %.1f %s'%('LENGTH OF EXTENDED LINK = ',x,' m''TENSION IN UPPER ARM =',T1,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "LENGTH OF EXTENDED LINK = 0.108 mTENSION IN UPPER ARM = 192.5 N\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg208" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 12 PAGE NO 208\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.12,7.13\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "EF=.20## MINIMUM RADIUS OF ROTATION IN m\n", - "AE=.30## LENGTH OF EACH ARM IN m\n", - "A1E1=AE## COMPARING FIRUES 7.12&7.13\n", - "EC=.30## LENGTH OF EACH ARM IN m\n", - "E1C1=EC## LENGTH OF EACH ARM IN m\n", - "ED=.165## FROM FIGURE 7.12 IN m\n", - "MC=ED## FROM FIGURE 7.12\n", - "EH=.10## FROM FIGURE 7.12 IN m\n", - "m=8.## MASS OF BALL IN Kg \n", - "M=60.## MASS OF SLEEVE IN Kg\n", - "DF=.035## SLEEVE DISTANCE FROM AXIS IN m\n", - "E1F1=.25## MAX RADIUS OF ROTATION IN m\n", - "g=9.81\n", - "##=========================================================\n", - "alpha=math.asin((EF/AE))*57.3## ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL IN DEGREES\n", - "beeta=math.asin((ED/EC))*57.3## ANGLE OF INCLINATION OF THE ARM TO THE HORIZONTAL IN DEGREES\n", - "k=math.tan(beeta/57.3)/math.tan(alpha/57.3)\n", - "h=(AE**2.-EF**2.)**.5## HEIGHT OF GOVERNOR IN m\n", - "EM=(EC**2.-MC**2.)**.5## FROM FIGURE 7.12 IN m\n", - "HM=EM+EH\n", - "N2=(895.*EM*(m+(M/2.*(1.+k)))/(h*HM*m))**.5## EQUILIBRIUM SPEED AT MAX RADIUS\n", - "HC=(HM**2.+MC**2.)**.5## FROM FIGURE 7.13 IN m\n", - "H1C1=HC\n", - "gama=math.atan((MC/HM))*57.3\n", - "alpha1=math.asin((E1F1/A1E1))*57.3\n", - "E1D1=E1F1-DF## FROM FIGURE 7.13 IN m\n", - "beeta1=math.asin((E1D1/E1C1))*57.3\n", - "gama1=gama-beeta+beeta1\n", - "r=H1C1*math.sin(gama1/57.3)+DF## RADIUS OF ROTATION IN m\n", - "H1M1=H1C1*math.cos((gama1/57.3))\n", - "I1C1=E1C1*math.cos(beeta1/57.3)*(math.tan(alpha1/57.3)+math.tan(beeta1/57.3))## FROM FIGURE IN m\n", - "M1C1=H1C1*math.sin(gama1/57.3)\n", - "w1=(((m*g*(I1C1-M1C1))+(M*g*I1C1)/2.)/(m*r*H1M1))**.5## ANGULAR SPEED IN rad/s\n", - "N1=w1*60./(2.*PI)## ##SPEED IN m/s\n", - "print'%s %.1f %s %.1f %s '%('MINIMUM SPEED OF ROTATION =',N2,' rpm'' MAXIMUM SPEED OF ROTATION = ',N1,' rpm')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "MINIMUM SPEED OF ROTATION = 146.6 rpm MAXIMUM SPEED OF ROTATION = 156.3 rpm \n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter7_1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter7_1.ipynb deleted file mode 100755 index 3e98a290..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter7_1.ipynb +++ /dev/null @@ -1,638 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:6c05b21421cee2c4a7e783e9f430bf868f1c93712e67d4962c0153c3f2fdb855" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter7-Governors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg196" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 1 PAGE NO 196\n", - "##TITLE:GOVERNORS\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "L=.4## LENGTH OF UPPER ARM IN m\n", - "THETA=30.## INCLINATION TO THE VERTICAL IN degrees\n", - "K=.02## RISED LENGTH IN m\n", - "##============================================================================================\n", - "h2=L*math.cos(THETA/57.3)## GOVERNOR HEIGHT IN m\n", - "N2=(895./h2)**.5## SPEED AT h2 IN rpm\n", - "h1=h2-K## LENGTH WHEN IT IS RAISED BY 2 cm\n", - "N1=(895./h1)**.5## SPEED AT h1 IN rpm\n", - "n=(N1-N2)/N2*100.## PERCENTAGE CHANGE IN SPEED\n", - "##==========================================================================================\n", - "print'%s %.1f %s'%('PERCENTAGE CHANGE IN SPEED=',n,' PERCENTAGE')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "PERCENTAGE CHANGE IN SPEED= 3.0 PERCENTAGE\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 2 PAGE NO 197\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.5(A),7.5(B)\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "OA=.3## LENGTH OF UPPER ARM IN m\n", - "m=6.## MASS OF EACH BALL IN Kg\n", - "M=18.## MASS OF SLEEVE IN Kg\n", - "r2=.2## RADIUS OF ROTATION AT BEGINING IN m\n", - "r1=.25## RADIUS OF ROTATION AT MAX SPEED IN m\n", - "##===========================================================================================\n", - "h1=(OA**2.-r1**2.)**.5## HIEGHT OF GOVERNOR AT MAX SPEED IN m\n", - "N1=(895.*(m+M)/(h1*m))**.5## MAX SPEED IN rpm\n", - "h2=(OA**2.-r2**2.)**.5## HEIGHT OF GONERNOR AT BEGINING IN m\n", - "N2=(895.*(m+M)/(h2*m))**.5## MIN SPEED IN rpm\n", - "##===========================================================================================\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('MAX SPEED = ',N1,' rpm'' MIN SPEED = ',N2,' rpm''RANGE OF SPEED = ',N1-N2,' rpm')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "MAX SPEED = 146.9 rpm MIN SPEED = 126.5 rpmRANGE OF SPEED = 20.4 rpm\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg197" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 3 PAGE NO 197\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.6\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "OA=.25## LENGHT OF UPPER ARM IN m\n", - "CD=.03## DISTANCE BETWEEN LEEVE AND LOWER ARM IN m\n", - "m=6.## MASS OF BALL IN Kg\n", - "M=48.## MASS OF SLEEVE IN Kg\n", - "AE=.17## FROM FIGURE 7.6\n", - "AE1=.12## FROM FIGURE 7.6\n", - "r1=.2## RADIUS OF ROTATION AT MAX SPEED IN m\n", - "r2=.15## RADIUS OF ROTATION AT MIN SPEED IN m\n", - "##============================================================================================\n", - "h1=(OA**2-r1**2)**.5## HIEGHT OF GOVERNOR AT MIN SPEED IN m\n", - "TANalpha=r1/h1\n", - "TANbeeta=AE/(OA**2-AE**2)**.5\n", - "k=TANbeeta/TANalpha\n", - "N1=(895.*(m+(M*(1.+k)/2.))/(h1*m))**.5## MIN SPEED IN rpm\n", - "h2=(OA**2-r2**2)**.5## HIEGHT OF GOVERNOR AT MAX SPEED IN m\n", - "CE=(OA**2-AE1**2)**.5\n", - "TANalpha1=r2/h2\n", - "TANbeeta1=(r2-CD)/CE\n", - "k=TANbeeta1/TANalpha1\n", - "N2=(895.*(m+(M*(1.+k)/2.))/(h2*m))**.5## MIN SPEED IN rpm\n", - "##========================================================================================================\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('MAX SPEED = ',N1,' rpm'' MIN SPEED = ',N2,' rpm''RANGE OF SPEED = ',N1-N2,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "MAX SPEED = 215.5 rpm MIN SPEED = 188.2 rpmRANGE OF SPEED = 27.2 rpm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg199" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 4 PAGE NO 199\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.7\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "g=9.81## ACCELERATION DUE TO GRAVITY \n", - "OA=.20## LENGHT OF UPPER ARM IN m\n", - "AC=.20## LENGTH OF LOWER ARM IN m\n", - "CD=.025## DISTANCE BETWEEN AXIS AND LOWER ARM IN m\n", - "AB=.1## RADIUS OF ROTATION OF BALLS IN m\n", - "N2=250## SPEED OF THE GOVERNOR IN rpm\n", - "X=.05## SLEEVE LIFT IN m\n", - "m=5.## MASS OF BALL IN Kg\n", - "M=20.## MASS OF SLEEVE IN Kg\n", - "##===========================================================\n", - "h2=(OA**2.-AB**2.)**.5## OB DISTANCE IN m IN FIGURE\n", - "h21=(AC**2.-(AB-CD)**2.)**.5## BD DISTANCE IN m IN FIGURE\n", - "TANbeeta=(AB-CD)/h21## TAN OF ANGLE OF INCLINATION OF THE LINK TO THE VERTICAL\n", - "TANalpha=AB/h2## TAN OF ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", - "k=TANbeeta/TANalpha\n", - "c=X/(2.*(h2*(1.+k)-X))## PERCENTAGE INCREASE IN SPEED \n", - "n=c*N2## INCREASE IN SPEED IN rpm\n", - "N1=N2+n## SPEED AFTER LIFT OF SLEEVE\n", - "E=c*g*((2.*m/(1.+k))+M)## GOVERNOR EFFORT IN N\n", - "P=E*X## GOVERNOR POWER IN N-m\n", - "\n", - "print'%s %.1f %s %.2f %s %.1f %s '%('SPEED OF THE GOVERNOR WHEN SLEEVE IS LIFT BY 5 cm = ',N1,' rpm'' GOVERNOR EFFORT = ',E,' N' 'GOVERNOR POWER = ',P,' N-m')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "SPEED OF THE GOVERNOR WHEN SLEEVE IS LIFT BY 5 cm = 275.6 rpm GOVERNOR EFFORT = 25.95 NGOVERNOR POWER = 1.3 N-m \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg200" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 5 PAGE NO 200\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.8\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "g=9.81## ACCELERATION DUE TO GRAVITY \n", - "OA=.30## LENGHT OF UPPER ARM IN m\n", - "AC=.30## LENGTH OF LOWER ARM IN m\n", - "m=10.## MASS OF BALL IN Kg\n", - "M=50.## MASS OF SLEEVE IN Kg\n", - "r=.2## RADIUS OF ROTATION IN m\n", - "CD=.04## DISTANCE BETWEEN AXIS AND LOWER ARM IN m\n", - "F=15.## FRICTIONAL LOAD ACTING IN N\n", - "##============================================================\n", - "h=(OA**2-r**2)**.5## HIEGTH OF THE GOVERNOR IN m\n", - "AE=r-CD## AE VALUE IN m\n", - "CE=(AC**2-AE**2)**.5## BD DISTANCE IN m\n", - "TANalpha=r/h## TAN OF ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", - "TANbeeta=AE/CE## TAN OF ANGLE OF INCLINATION OF THE LINK TO THE VERTICAL\n", - "k=TANbeeta/TANalpha\n", - "N=((895./h)*(m+(M*(1.+k)/2.))/m)**.5## EQULIBRIUM SPEED IN rpm\n", - "N1=((895./h)*((m*g)+(M*g+F)/2.)*(1.+k)/(m*g))**.5## MAX SPEED IN rpm\n", - "N2=((895./h)*((m*g)+(M*g-F)/2.)*(1.+k)/(m*g))**.5## MIN SPEED IN rpm\n", - "R=N1-N2## RANGE OF SPEED\n", - "print'%s %.1f %s %.1f %s '%('EQUILIBRIUM SPEED OF GOVERNOR = ',N,' rpm'' RANGE OF SPEED OF GOVERNOR= ',R,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "EQUILIBRIUM SPEED OF GOVERNOR = 145.1 rpm RANGE OF SPEED OF GOVERNOR= 3.4 rpm \n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg202" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 6 PAGE NO 202\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.9\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "g=9.81## ACCELERATION DUE TO GRAVITY \n", - "OA=.30## LENGHT OF UPPER ARM IN m\n", - "AC=.30## LENGTH OF LOWER ARM IN m\n", - "m=5.## MASS OF BALL IN Kg\n", - "M=25.## MASS OF SLEEVE IN Kg\n", - "X=.05## LIFT OF THE SLEEVE\n", - "alpha=30.## ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL\n", - "##==============================================\n", - "h2=OA*math.cos(alpha/57.3)## HEIGHT OF THE GOVERNOR AT LOWEST POSITION OF SLEEVE\n", - "h1=h2-X/2.## HEIGHT OF THE GOVERNOR AT HEIGHT POSITION OF SLEEVE\n", - "F=((h2/h1)*(m*g+M*g)-(m*g+M*g))/(1.+h2/h1)## FRICTION AT SLEEVE IN N\n", - "N1=((m*g+M*g+F)*895./(h1*m*g))**.5## MAX SPEEED OF THE GOVVERNOR IN rpm\n", - "N2=((m*g+M*g-F)*895./(h2*m*g))**.5## MIN SPEEED OF THE GOVVERNOR IN rpm\n", - "R=N1-N2## RANGE OF SPEED IN rpm\n", - "\n", - "print'%s %.1f %s %.1f %s'%('THE VALUE OF FRICTIONAL FORCE= ',F,' F'' RANGE OF SPEED OF THE GOVERNOR = ',R,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "THE VALUE OF FRICTIONAL FORCE= 14.9 F RANGE OF SPEED OF THE GOVERNOR = 14.9 rpm\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg203" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 7 PAGE NO 203\n", - "##TITLE:GOVERNORS\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "m=3## MASS OF EACH BALL IN Kg\n", - "a=.12## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", - "b=.08## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", - "r2=.12## RADIUS OF ROTATION OF THE BALL FOR LOWEST POSITION IN m\n", - "N2=320.## SPEED OF GOVERNOR AT THE BEGINING IN rpm\n", - "S=20000.## STIFFNESS OF THE SPRING IN N/m\n", - "h=.015## SLEEVE LIFT IN m\n", - "##==================================================\n", - "Fc2=m*(2.*PI*N2/60.)**2*r2## CENTRIFUGAL FORCE ACTING AT MIN SPEED OF ROTATION IN N\n", - "L=2*a*Fc2/b## INITIAL LOAD ON SPRING IN N\n", - "r1=a/b*h+r2## MAX RADIUS OF ROTATION IN m\n", - "Fc1=(S*(r1-r2)*(b/a)**2/2)+Fc2## CENTRIFUGAL FORCE ACTING AT MAX SPEED OF ROTATION IN N\n", - "N1=(Fc1/(m*r1)*(60./2./PI)**2)**.5\n", - "print'%s %.1f %s %.1f %s '%('INITIAL LOAD ON SPRING =',L,' N'' EQUILIBRIUM SPEED CORRESPONDING TO LIFT OF 15 cm =',N1,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "INITIAL LOAD ON SPRING = 1217.0 N EQUILIBRIUM SPEED CORRESPONDING TO LIFT OF 15 cm = 327.9 rpm \n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg204" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 8 PAGE NO 204\n", - "##TITLE:GOVERNORS\n", - "\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "m=3## MASS OF BALL IN Kg\n", - "r2=.2## INITIAL RADIUS OF ROTATION IN m\n", - "a=.11## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", - "b=.15## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", - "h=.004## SLEEVE LIFT IN m\n", - "N2=240.## INITIAL SPEED IN rpm\n", - "n=7.5## FLUCTUATION OF SPEED IN %\n", - "##===================================\n", - "w2=2.*PI*N2/60.## INITIAL ANGULAR SPEED IN rad/s\n", - "w1=(100.+n)*w2/100.## FINAL ANGULAR SPEED IN rad/s\n", - "F=2.*a/b*m*w2**2.*r2## INITIAL COMPRESSIVE FORCE IN N\n", - "r1=r2+a/b*h## MAX RDIUS OF ROTATION IN m\n", - "S=2.*((m*w1**2.*r1)-(m*w2**2.*r2))/(r1-r2)*(a/b)**2.\n", - "print'%s %.1f %s %.1f %s'%('INITIAL COMPRESSIVE FPRCE = ',F,' N'' STIFFNESS OF THE SPRING = ',S/1000,' N/m')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "INITIAL COMPRESSIVE FPRCE = 557.8 N STIFFNESS OF THE SPRING = 24.1 N/m\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex9-pg204" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 9 PAGE NO 204\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.3(C)\n", - "\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "g=9.81## ACCELERATION DUE TO GRAVITY \n", - "PI=3.147\n", - "r=.14## DISTANCE BETWEEN THE CENTRE OF PIVOT OF BELL CRANK LEVER AND AXIS OF GOVERNOR SPINDLE IN m\n", - "r2=.11## INITIAL RADIUS OF ROTATION IN m\n", - "a=.12## LENGTH OF VERTICAL ARM OF BELL CRANK LEVER IN m\n", - "b=.10## LENGTH OF HORIZONTAL ARM OF BELL CRANK LEVER IN m\n", - "h=.05## SLEEVE LIFT IN m\n", - "N2=240## INITIAL SPEED IN rpm\n", - "F=30## FRICTIONAL FORCE ACTING IN N\n", - "m=5## MASS OF EACH BALL IN Kg\n", - "##==========================================\n", - "r1=r2+a/b*h## MAX RADIUS OF ROTATION IN m\n", - "N1=41.*N2/39.## MAX SPEED OF ROTATION IN rpm\n", - "N=(N1+N2)/2.## MEAN SPEED IN rpm\n", - "Fc1=m*(2.*PI*N1/60.)**2.*r1## CENTRIFUGAL FORCE ACTING AT MAX SPEED OF ROTATION IN N\n", - "Fc2=m*(2.*PI*N2/60.)**2.*r2## CENTRIFUGAL FORCE ACTING AT MIN SPEED OF ROTATION IN N\n", - "c1=r1-r## FROM FIGURE 7.3(C) IN m\n", - "a1=(a**2.-c1**2.)**.5## FROM FIGURE 7.3(C) IN m\n", - "b1=(b**2.-(h/2.)**2.)**.5## FROM FIGURE 7.3(C) IN m\n", - "c2=r-r2## FROM FIGURE 7.3(C) IN m\n", - "a2=a1## FROM FIGURE 7.3(C) IN m\n", - "b2=b1## FROM FIGURE 7.3(C) IN m\n", - "S1=2.*((Fc1*a1)-(m*g*c1))/b1## SPRING FORCE EXERTED ON THE SLEEVE AT MAXIMUM SPEED IN NEWTONS\n", - "S2=2.*((Fc2*a2)-(m*g*c2))/b2## SPRING FORCE EXERTED ON THE SLEEVE AT MAXIMUM SPEED IN NEWTONS\n", - "S=(S1-S2)/h## STIFFNESS OF THE SPRING IN N/m\n", - "Is=S2/S## INITIAL COMPRESSION OF SPRING IN m\n", - "P=S2+(h/2.*S)## SPRING FORCE OF MID PORTION IN N\n", - "n1=N*((P+F)/P)**.5## SPEED,WHEN THE SLEEVE BEGINS TO MOVE UPWARDS FROM MID POSITION IN rpm\n", - "n2=N*((P-F)/P)**.5## SPEED,WHEN THE SLEEVE BEGINS TO MOVE DOWNWARDS FROM MID POSITION IN rpm\n", - "A=n1-n2## ALTERATION IN SPEED IN rpm\n", - "print'%s %.1f %s %.1f %s '%('INTIAL COMPRESSION OF SPRING= ',Is*100,' cm''ALTERATION IN SPEED = ',A,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "INTIAL COMPRESSION OF SPRING= 6.8 cmALTERATION IN SPEED = 6.7 rpm \n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex10-pg206" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 10 PAGE NO 206\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.10\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "AE=.25## LENGTH OF UPPER ARM IN m\n", - "CE=.25## LENGTH OF LOWER ARM IN m\n", - "EH=.1## LENGTH OF EXTENDED ARM IN m\n", - "EF=.15## RADIUS OF BALL PATH IN m\n", - "m=5.## MASS OF EACH BALL IN Kg\n", - "M=40.## MASS OF EACH BALL IN Kg\n", - "##===================================================================\n", - "h=(AE**2.-EF**2.)**.5## HEIGHT OF THE GOVERNOR IN m\n", - "EM=h\n", - "HM=EH+EM## FROM FIGURE 7.10\n", - "N=((895./h)*(EM/HM)*((m+M)/m))**.5\n", - "print'%s %.1f %s'%('EQUILIBRIUM SPEED OF GOVERNOR =',N,' rpm')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "EQUILIBRIUM SPEED OF GOVERNOR = 163.9 rpm\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex11-pg207" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 11 PAGE NO 207\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.11\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "g=9.81## ACCELERATION DUE TO GRAVITY IN N/mm**2\n", - "AE=.25## LENGTH OF UPPER ARM IN m\n", - "CE=.25## LENGTH OF LOWER ARM IN m\n", - "ER=.175## FROM FIGURE 7.11\n", - "AP=.025## FROM FIGURE 7.11\n", - "FR=AP## FROM FIGURE 7.11\n", - "CQ=FR## FROM FIGURE 7.11\n", - "m=3.2## MASS OF BALL IN Kg\n", - "M=25.## MASS OF SLEEVE IN Kg\n", - "h=.2## VERTICAL HEIGHT OF GOVERNOR IN m\n", - "EM=h## FROM FIGURE 7.11\n", - "AF=h## FROM FIGURE 7.11\n", - "N=160.## SPEED OF THE GOVERNOR IN rpm\n", - "HM=(895.*EM*(m+M)/(h*N**2.*m))\n", - "x=HM-EM## LENGTH OF EXTENDED LINK IN m\n", - "T1=g*(m+M/2.)*AE/AF## TENSION IN UPPER ARM IN N\n", - "print'%s %.3f %s %.1f %s'%('LENGTH OF EXTENDED LINK = ',x,' m''TENSION IN UPPER ARM =',T1,' N')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "LENGTH OF EXTENDED LINK = 0.108 mTENSION IN UPPER ARM = 192.5 N\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex12-pg208" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 7 ILLUSRTATION 12 PAGE NO 208\n", - "##TITLE:GOVERNORS\n", - "##FIGURE 7.12,7.13\n", - "import math\n", - "##===========================================================================================\n", - "##INPUT DATA\n", - "PI=3.147\n", - "EF=.20## MINIMUM RADIUS OF ROTATION IN m\n", - "AE=.30## LENGTH OF EACH ARM IN m\n", - "A1E1=AE## COMPARING FIRUES 7.12&7.13\n", - "EC=.30## LENGTH OF EACH ARM IN m\n", - "E1C1=EC## LENGTH OF EACH ARM IN m\n", - "ED=.165## FROM FIGURE 7.12 IN m\n", - "MC=ED## FROM FIGURE 7.12\n", - "EH=.10## FROM FIGURE 7.12 IN m\n", - "m=8.## MASS OF BALL IN Kg \n", - "M=60.## MASS OF SLEEVE IN Kg\n", - "DF=.035## SLEEVE DISTANCE FROM AXIS IN m\n", - "E1F1=.25## MAX RADIUS OF ROTATION IN m\n", - "g=9.81\n", - "##=========================================================\n", - "alpha=math.asin((EF/AE))*57.3## ANGLE OF INCLINATION OF THE ARM TO THE VERTICAL IN DEGREES\n", - "beeta=math.asin((ED/EC))*57.3## ANGLE OF INCLINATION OF THE ARM TO THE HORIZONTAL IN DEGREES\n", - "k=math.tan(beeta/57.3)/math.tan(alpha/57.3)\n", - "h=(AE**2.-EF**2.)**.5## HEIGHT OF GOVERNOR IN m\n", - "EM=(EC**2.-MC**2.)**.5## FROM FIGURE 7.12 IN m\n", - "HM=EM+EH\n", - "N2=(895.*EM*(m+(M/2.*(1.+k)))/(h*HM*m))**.5## EQUILIBRIUM SPEED AT MAX RADIUS\n", - "HC=(HM**2.+MC**2.)**.5## FROM FIGURE 7.13 IN m\n", - "H1C1=HC\n", - "gama=math.atan((MC/HM))*57.3\n", - "alpha1=math.asin((E1F1/A1E1))*57.3\n", - "E1D1=E1F1-DF## FROM FIGURE 7.13 IN m\n", - "beeta1=math.asin((E1D1/E1C1))*57.3\n", - "gama1=gama-beeta+beeta1\n", - "r=H1C1*math.sin(gama1/57.3)+DF## RADIUS OF ROTATION IN m\n", - "H1M1=H1C1*math.cos((gama1/57.3))\n", - "I1C1=E1C1*math.cos(beeta1/57.3)*(math.tan(alpha1/57.3)+math.tan(beeta1/57.3))## FROM FIGURE IN m\n", - "M1C1=H1C1*math.sin(gama1/57.3)\n", - "w1=(((m*g*(I1C1-M1C1))+(M*g*I1C1)/2.)/(m*r*H1M1))**.5## ANGULAR SPEED IN rad/s\n", - "N1=w1*60./(2.*PI)## ##SPEED IN m/s\n", - "print'%s %.1f %s %.1f %s '%('MINIMUM SPEED OF ROTATION =',N2,' rpm'' MAXIMUM SPEED OF ROTATION = ',N1,' rpm')\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "MINIMUM SPEED OF ROTATION = 146.6 rpm MAXIMUM SPEED OF ROTATION = 156.3 rpm \n" - ] - } - ], - "prompt_number": 3 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter8.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter8.ipynb deleted file mode 100755 index 9bd9a862..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter8.ipynb +++ /dev/null @@ -1,334 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:1cb0ae5332b03066df5ce763bd8fad0da93c877f86bbb84639588cca0d91016e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Chapter8-BALANCING OF ROTATING MASSES" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg221" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 1 PAGE NO 221\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "import math\n", - "mA=12.## mass of A in kg\n", - "mB=10.## mass of B in kg\n", - "mC=18.## mass of C in kg\n", - "mD=15.## mass of D in kg\n", - "rA=40.## radius of A in mm\n", - "rB=50.## radius of B in mm\n", - "rC=60.## radius of C in mm\n", - "rD=30.## radius of D in mm\n", - "theta1=0.## angle between A-A in degrees\n", - "theta2=60.## angle between A-B in degrees\n", - "theta3=130.## angle between A-C in degrees\n", - "theta4=270.## angle between A-D in degrees\n", - "R=100.## radius at which mass to be determined in mm\n", - "##====================================================\n", - "Fh=(mA*rA*math.cos(theta1/57.3)+mB*rB*math.cos(theta2/57.3)+mC*rC*math.cos(theta3/57.3)+mD*rD*math.cos(theta4/57.3))/10.## vertical component value in kg cm\n", - "Fv=(mA*rA*math.sin(theta1/57.3)+mB*rB*math.sin(theta2/57.3)+mC*rC*math.sin(theta3/57.3)+mD*rD*math.sin(theta4/57.3))/10.## horizontal component value in kg cm\n", - "mb=(Fh**2.+Fv**2.)**.5/R*10.## unbalanced mass in kg\n", - "theta=math.atan(Fv/Fh)*57.3## position in degrees \n", - "THETA=180.+theta## angle with mA\n", - "print'%s %.1f %s %.1f %s'%('magnitude of unbalaced mass=',mb,' kg'' angle with mA=',THETA,'degrees')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnitude of unbalaced mass= 8.1 kg angle with mA= 267.5 degrees\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg222" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 2 PAGE NO 222\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mA=5.## mass of A in kg\n", - "mB=10.## mass of B in kg\n", - "mC=8.## mass of C in kg\n", - "rA=10.## radius of A in cm\n", - "rB=15.## radius of B in cm\n", - "rC=10.## radius of C in cm\n", - "rD=10.## radius of D in cm\n", - "rE=15.## radius of E in cm\n", - "##============================\n", - "mD=182./rD## mass of D in kg by mearument\n", - "mE=80./rE## mass of E in kg by mearument\n", - "print'%s %.1f %s %.1f %s '%('mass of D= ',mD,' kg''mass of E= ',mE,' kg')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mass of D= 18.2 kgmass of E= 5.3 kg \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 3 PAGE NO 223\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mA=200.## mass of A in kg\n", - "mB=300.## mass of B in kg\n", - "mC=400.## mass of C in kg\n", - "mD=200.## mass of D in kg\n", - "rA=80.## radius of A in mm\n", - "rB=70.## radius of B in mm\n", - "rC=60.## radius of C in mm\n", - "rD=80.## radius of D in mm\n", - "rX=100.## radius of X in mm\n", - "rY=100.## radius of Y in mm\n", - "##=====================\n", - "mY=7.3/.04## mass of Y in kg by mearurement\n", - "mX=35./.1## mass of X in kg by mearurement\n", - "thetaX=146.## in degrees by mesurement\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('mass of X=',mX,' kg'' mass of Y=',mY,' kg''angle with mA=',thetaX,' degrees')\n", - "\t" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mass of X= 350.0 kg mass of Y= 182.5 kgangle with mA= 146.0 degrees\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg225" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 4 PAGE NO 225\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mB=30## mass of B in kg\n", - "mC=50## mass of C in kg\n", - "mD=40## mass of D in kg\n", - "rA=18## radius of A in cm\n", - "rB=24## radius of B in cm\n", - "rC=12## radius of C in cm\n", - "rD=15## radius of D in cm\n", - "##=============================\n", - "mA=3.6/.18## mass of A by measurement in kg\n", - "theta=124.## angle with mass B in degrees by measurement in degrees\n", - "y=3.6/(.18*20)## position of A from B\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('mass of A=',mA,' kg'' angle with mass B=',theta,' degrees'' position of A from B=',y,' m towards right of plane B')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mass of A= 20.0 kg angle with mass B= 124.0 degrees position of A from B= 1.0 m towards right of plane B\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg226" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 5 PAGE NO 226\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mB=10.## mass of B in kg\n", - "mC=5.## mass of C in kg\n", - "mD=4.## mass of D in kg\n", - "rA=10.## radius of A in cm\n", - "rB=12.5## radius of B in cm\n", - "rC=20.## radius of C in cm\n", - "rD=15.## radius of D in cm\n", - "##=====================================\n", - "mA=7.## mass of A in kg by mesurement\n", - "BC=118.## angle between B and C in degrees by mesurement\n", - "BA=203.5## angle between B and A in degrees by mesurement\n", - "BD=260.## angle between B and D in degrees by mesurement\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Mass of A=',mA,' kg'' angle between B and C=',BC,' degrees''angle between B and A= ',BA,' degrees'' angle between B and D=',BD,' degrees')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of A= 7.0 kg angle between B and C= 118.0 degreesangle between B and A= 203.5 degrees angle between B and D= 260.0 degrees \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg228" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 6 PAGE NO 228\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mB=36.## mass of B in kg\n", - "mC=25.## mass of C in kg\n", - "rA=20.## radius of A in cm\n", - "rB=15.## radius of B in cm\n", - "rC=15.## radius of C in cm\n", - "rD=20.## radius of D in cm\n", - "##==================================\n", - "mA=3.9/.2## mass of A in kg by measurement\n", - "mD=16.5## mass of D in kg by measurement\n", - "theta=252.## angular position of D from B by measurement in degrees\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('Mass of A= ',mA,' kg'' Mass od D= ',mD,' kg'' Angular position of D from B= ',theta,' degrees')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of A= 19.5 kg Mass od D= 16.5 kg Angular position of D from B= 252.0 degrees\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg229" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 7 PAGE NO 229\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "\n", - "\n", - "pi=3.141\n", - "mA=48.## mass of A in kg\n", - "mB=56.## mass of B in kg\n", - "mC=20.## mass of C in kg\n", - "rA=1.5## radius of A in cm\n", - "rB=1.5## radius of B in cm\n", - "rC=1.25## radius of C in cm\n", - "N=300.## speed in rpm\n", - "d=1.8## distance between bearing in cm\n", - "##================================\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "BA=164.## angle between pulleys B&A in degrees by measurement\n", - "BC=129.## angle between pulleys B&C in degrees by measurement\n", - "AC=67.## angle between pulleys A&C in degrees by measurement\n", - "C=.88*w**2.## out of balance couple in N\n", - "L=C/d## load on each bearing in N\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('angle between pulleys B&A=',BA,' degrees'' angle between pulleys B&C= ',BC,' degrees'' angle between pulleys A&C=',AC,' degrees'' out of balance couple= ',C,' N'' load on each bearing=',L,' N')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "angle between pulleys B&A= 164.0 degrees angle between pulleys B&C= 129.0 degrees angle between pulleys A&C= 67.0 degrees out of balance couple= 868.2 N load on each bearing= 482.3 N \n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter8_1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter8_1.ipynb deleted file mode 100755 index 00deb110..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter8_1.ipynb +++ /dev/null @@ -1,334 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:58914a8cfd8218ce6daf5fb785d2ca44a311ed0fcf973975091abe67490dee2e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter8-Balancing of Rotating Masses" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex1-pg221" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 1 PAGE NO 221\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "import math\n", - "mA=12.## mass of A in kg\n", - "mB=10.## mass of B in kg\n", - "mC=18.## mass of C in kg\n", - "mD=15.## mass of D in kg\n", - "rA=40.## radius of A in mm\n", - "rB=50.## radius of B in mm\n", - "rC=60.## radius of C in mm\n", - "rD=30.## radius of D in mm\n", - "theta1=0.## angle between A-A in degrees\n", - "theta2=60.## angle between A-B in degrees\n", - "theta3=130.## angle between A-C in degrees\n", - "theta4=270.## angle between A-D in degrees\n", - "R=100.## radius at which mass to be determined in mm\n", - "##====================================================\n", - "Fh=(mA*rA*math.cos(theta1/57.3)+mB*rB*math.cos(theta2/57.3)+mC*rC*math.cos(theta3/57.3)+mD*rD*math.cos(theta4/57.3))/10.## vertical component value in kg cm\n", - "Fv=(mA*rA*math.sin(theta1/57.3)+mB*rB*math.sin(theta2/57.3)+mC*rC*math.sin(theta3/57.3)+mD*rD*math.sin(theta4/57.3))/10.## horizontal component value in kg cm\n", - "mb=(Fh**2.+Fv**2.)**.5/R*10.## unbalanced mass in kg\n", - "theta=math.atan(Fv/Fh)*57.3## position in degrees \n", - "THETA=180.+theta## angle with mA\n", - "print'%s %.1f %s %.1f %s'%('magnitude of unbalaced mass=',mb,' kg'' angle with mA=',THETA,'degrees')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "magnitude of unbalaced mass= 8.1 kg angle with mA= 267.5 degrees\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg222" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 2 PAGE NO 222\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mA=5.## mass of A in kg\n", - "mB=10.## mass of B in kg\n", - "mC=8.## mass of C in kg\n", - "rA=10.## radius of A in cm\n", - "rB=15.## radius of B in cm\n", - "rC=10.## radius of C in cm\n", - "rD=10.## radius of D in cm\n", - "rE=15.## radius of E in cm\n", - "##============================\n", - "mD=182./rD## mass of D in kg by mearument\n", - "mE=80./rE## mass of E in kg by mearument\n", - "print'%s %.1f %s %.1f %s '%('mass of D= ',mD,' kg''mass of E= ',mE,' kg')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mass of D= 18.2 kgmass of E= 5.3 kg \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 3 PAGE NO 223\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mA=200.## mass of A in kg\n", - "mB=300.## mass of B in kg\n", - "mC=400.## mass of C in kg\n", - "mD=200.## mass of D in kg\n", - "rA=80.## radius of A in mm\n", - "rB=70.## radius of B in mm\n", - "rC=60.## radius of C in mm\n", - "rD=80.## radius of D in mm\n", - "rX=100.## radius of X in mm\n", - "rY=100.## radius of Y in mm\n", - "##=====================\n", - "mY=7.3/.04## mass of Y in kg by mearurement\n", - "mX=35./.1## mass of X in kg by mearurement\n", - "thetaX=146.## in degrees by mesurement\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('mass of X=',mX,' kg'' mass of Y=',mY,' kg''angle with mA=',thetaX,' degrees')\n", - "\t" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mass of X= 350.0 kg mass of Y= 182.5 kgangle with mA= 146.0 degrees\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex4-pg225" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 4 PAGE NO 225\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mB=30## mass of B in kg\n", - "mC=50## mass of C in kg\n", - "mD=40## mass of D in kg\n", - "rA=18## radius of A in cm\n", - "rB=24## radius of B in cm\n", - "rC=12## radius of C in cm\n", - "rD=15## radius of D in cm\n", - "##=============================\n", - "mA=3.6/.18## mass of A by measurement in kg\n", - "theta=124.## angle with mass B in degrees by measurement in degrees\n", - "y=3.6/(.18*20)## position of A from B\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('mass of A=',mA,' kg'' angle with mass B=',theta,' degrees'' position of A from B=',y,' m towards right of plane B')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "mass of A= 20.0 kg angle with mass B= 124.0 degrees position of A from B= 1.0 m towards right of plane B\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg226" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 5 PAGE NO 226\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mB=10.## mass of B in kg\n", - "mC=5.## mass of C in kg\n", - "mD=4.## mass of D in kg\n", - "rA=10.## radius of A in cm\n", - "rB=12.5## radius of B in cm\n", - "rC=20.## radius of C in cm\n", - "rD=15.## radius of D in cm\n", - "##=====================================\n", - "mA=7.## mass of A in kg by mesurement\n", - "BC=118.## angle between B and C in degrees by mesurement\n", - "BA=203.5## angle between B and A in degrees by mesurement\n", - "BD=260.## angle between B and D in degrees by mesurement\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s '%('Mass of A=',mA,' kg'' angle between B and C=',BC,' degrees''angle between B and A= ',BA,' degrees'' angle between B and D=',BD,' degrees')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of A= 7.0 kg angle between B and C= 118.0 degreesangle between B and A= 203.5 degrees angle between B and D= 260.0 degrees \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex6-pg228" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 6 PAGE NO 228\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "pi=3.141\n", - "\n", - "mB=36.## mass of B in kg\n", - "mC=25.## mass of C in kg\n", - "rA=20.## radius of A in cm\n", - "rB=15.## radius of B in cm\n", - "rC=15.## radius of C in cm\n", - "rD=20.## radius of D in cm\n", - "##==================================\n", - "mA=3.9/.2## mass of A in kg by measurement\n", - "mD=16.5## mass of D in kg by measurement\n", - "theta=252.## angular position of D from B by measurement in degrees\n", - "print'%s %.1f %s %.1f %s %.1f %s'%('Mass of A= ',mA,' kg'' Mass od D= ',mD,' kg'' Angular position of D from B= ',theta,' degrees')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of A= 19.5 kg Mass od D= 16.5 kg Angular position of D from B= 252.0 degrees\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex7-pg229" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 8 ILLUSRTATION 7 PAGE NO 229\n", - "##TITLE:BALANCING OF ROTATING MASSES\n", - "\n", - "\n", - "pi=3.141\n", - "mA=48.## mass of A in kg\n", - "mB=56.## mass of B in kg\n", - "mC=20.## mass of C in kg\n", - "rA=1.5## radius of A in cm\n", - "rB=1.5## radius of B in cm\n", - "rC=1.25## radius of C in cm\n", - "N=300.## speed in rpm\n", - "d=1.8## distance between bearing in cm\n", - "##================================\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "BA=164.## angle between pulleys B&A in degrees by measurement\n", - "BC=129.## angle between pulleys B&C in degrees by measurement\n", - "AC=67.## angle between pulleys A&C in degrees by measurement\n", - "C=.88*w**2.## out of balance couple in N\n", - "L=C/d## load on each bearing in N\n", - "print'%s %.1f %s %.1f %s %.1f %s %.1f %s %.1f %s '%('angle between pulleys B&A=',BA,' degrees'' angle between pulleys B&C= ',BC,' degrees'' angle between pulleys A&C=',AC,' degrees'' out of balance couple= ',C,' N'' load on each bearing=',L,' N')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "angle between pulleys B&A= 164.0 degrees angle between pulleys B&C= 129.0 degrees angle between pulleys A&C= 67.0 degrees out of balance couple= 868.2 N load on each bearing= 482.3 N \n" - ] - } - ], - "prompt_number": 7 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter9.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter9.ipynb deleted file mode 100755 index 0fbeb89f..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter9.ipynb +++ /dev/null @@ -1,151 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:dda7459eb606339995d5ed2e2c12f6be43bc2a1b7dc283fd0394011879a85b71" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter9-CAMS AND FOLLOWERS" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg247" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 9 ILLUSRTATION 2 PAGE NO 247\n", - "##TITLE:CAMS AND FOLLOWERS\n", - "import math\n", - "pi=3.141\n", - "s=4.## follower movement in cm\n", - "theta=60.## cam rotation in degrees\n", - "THETA=60.*pi/180## cam rotation in rad\n", - "thetaD=45.## after outstroke in degrees\n", - "thetaR=90.##....angle with which it reaches its original position in degrees\n", - "THETAR=90.*pi/180## angle with which it reaches its original position in rad\n", - "THETAd=360.-theta-thetaD-thetaR## angle after return stroke in degrees\n", - "N=300.## speed in rpm\n", - "w=2.*pi*N/60.## speed in rad/s\n", - "Vo=pi*w*s/2./THETA## Maximum velocity of follower during outstroke in cm/s\n", - "Vr=pi*w*s/2./THETAR## Maximum velocity of follower during return stroke in cm/s\n", - "Fo=pi**2.*w**2.*s/2./THETA**2./100.##Maximum acceleration of follower during outstroke in m/s**2 \n", - "Fr=pi**2.*w**2.*s/2./THETAR**2/100.##Maximum acceleration of follower during return stroke in m/s**2\n", - "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum acceleration of follower during outstroke = 177.6 m/s**2Maximum acceleration of follower during return stroke= 78.9 m/s**2 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg249" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 9 ILLUSRTATION 3 PAGE NO 249\n", - "##TITLE:CAMS AND FOLLOWERS\n", - "import math\n", - "pi=3.141\n", - "s=5.## follower movement in cm\n", - "theta=120.## cam rotation in degrees\n", - "THETA=theta*pi/180.## cam rotation in rad\n", - "thetaD=30.## after outstroke in degrees\n", - "thetaR=60.##....angle with which it reaches its original position in degrees\n", - "THETAR=60.*pi/180.## angle with which it reaches its original position in rad\n", - "THETAd=360.-theta-thetaD-thetaR## angle after return stroke in degrees\n", - "N=100.## speed in rpm\n", - "w=2.*pi*N/60.## speed in rad/s\n", - "Vo=pi*w*s/2./THETA## Maximum velocity of follower during outstroke in cm/s\n", - "Vr=pi*w*s/2./THETAR## Maximum velocity of follower during return stroke in cm/s\n", - "Fo=pi**2.*w**2.*s/2./THETA**2./100.##Maximum acceleration of follower during outstroke in m/s**2\n", - "Fr=pi**2*w**2.*s/2./THETAR**2/100.##Maximum acceleration of follower during return stroke in m/s**2\n", - "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum acceleration of follower during outstroke = 6.2 m/s**2Maximum acceleration of follower during return stroke= 24.7 m/s**2 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg252" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 9 ILLUSRTATION 5 PAGE NO 252\n", - "##TITLE:CAMS AND FOLLOWERS\n", - "import math\n", - "pi=3.141\n", - "N=1000.## speed of cam in rpm\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "s=2.5## stroke of the follower in cm\n", - "THETA=120.*pi/180.## ANGULAR DISPLACEMENT OF CAM DURING OUTSTROKE IN RAD\n", - "THETAR=90.*pi/180.##ANGULAR DISPLACEMENT OF CAM DURING DWELL IN RAD\n", - "Vo=2.*w*s/THETA## Maximum velocity of follower during outstroke in cm/s\n", - "Vr=2.*w*s/THETAR##Maximum velocity of follower during return stroke in cm/s\n", - "Fo=4.*w**2.*s/THETA**2.##Maximum acceleration of follower during outstroke in m/s**2\n", - "Fr=4.*w**2.*s/THETAR**2.##Maximum acceleration of follower during return stroke in m/s**2\n", - "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum acceleration of follower during outstroke = 25000.0 m/s**2Maximum acceleration of follower during return stroke= 44444.4 m/s**2 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter9_1.ipynb b/_Theory_Of_Machines_by__B._K._Sarkar/Chapter9_1.ipynb deleted file mode 100755 index 69869a97..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/Chapter9_1.ipynb +++ /dev/null @@ -1,151 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:765c555912cbe4c0c322320d21d6db5068ffa5998304ec2dc51a4fde049316b1" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter9-Cams and Followers" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex2-pg247" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 9 ILLUSRTATION 2 PAGE NO 247\n", - "##TITLE:CAMS AND FOLLOWERS\n", - "import math\n", - "pi=3.141\n", - "s=4.## follower movement in cm\n", - "theta=60.## cam rotation in degrees\n", - "THETA=60.*pi/180## cam rotation in rad\n", - "thetaD=45.## after outstroke in degrees\n", - "thetaR=90.##....angle with which it reaches its original position in degrees\n", - "THETAR=90.*pi/180## angle with which it reaches its original position in rad\n", - "THETAd=360.-theta-thetaD-thetaR## angle after return stroke in degrees\n", - "N=300.## speed in rpm\n", - "w=2.*pi*N/60.## speed in rad/s\n", - "Vo=pi*w*s/2./THETA## Maximum velocity of follower during outstroke in cm/s\n", - "Vr=pi*w*s/2./THETAR## Maximum velocity of follower during return stroke in cm/s\n", - "Fo=pi**2.*w**2.*s/2./THETA**2./100.##Maximum acceleration of follower during outstroke in m/s**2 \n", - "Fr=pi**2.*w**2.*s/2./THETAR**2/100.##Maximum acceleration of follower during return stroke in m/s**2\n", - "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum acceleration of follower during outstroke = 177.6 m/s**2Maximum acceleration of follower during return stroke= 78.9 m/s**2 \n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex3-pg249" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 9 ILLUSRTATION 3 PAGE NO 249\n", - "##TITLE:CAMS AND FOLLOWERS\n", - "import math\n", - "pi=3.141\n", - "s=5.## follower movement in cm\n", - "theta=120.## cam rotation in degrees\n", - "THETA=theta*pi/180.## cam rotation in rad\n", - "thetaD=30.## after outstroke in degrees\n", - "thetaR=60.##....angle with which it reaches its original position in degrees\n", - "THETAR=60.*pi/180.## angle with which it reaches its original position in rad\n", - "THETAd=360.-theta-thetaD-thetaR## angle after return stroke in degrees\n", - "N=100.## speed in rpm\n", - "w=2.*pi*N/60.## speed in rad/s\n", - "Vo=pi*w*s/2./THETA## Maximum velocity of follower during outstroke in cm/s\n", - "Vr=pi*w*s/2./THETAR## Maximum velocity of follower during return stroke in cm/s\n", - "Fo=pi**2.*w**2.*s/2./THETA**2./100.##Maximum acceleration of follower during outstroke in m/s**2\n", - "Fr=pi**2*w**2.*s/2./THETAR**2/100.##Maximum acceleration of follower during return stroke in m/s**2\n", - "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum acceleration of follower during outstroke = 6.2 m/s**2Maximum acceleration of follower during return stroke= 24.7 m/s**2 \n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex5-pg252" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "##CHAPTER 9 ILLUSRTATION 5 PAGE NO 252\n", - "##TITLE:CAMS AND FOLLOWERS\n", - "import math\n", - "pi=3.141\n", - "N=1000.## speed of cam in rpm\n", - "w=2.*pi*N/60.## angular speed in rad/s\n", - "s=2.5## stroke of the follower in cm\n", - "THETA=120.*pi/180.## ANGULAR DISPLACEMENT OF CAM DURING OUTSTROKE IN RAD\n", - "THETAR=90.*pi/180.##ANGULAR DISPLACEMENT OF CAM DURING DWELL IN RAD\n", - "Vo=2.*w*s/THETA## Maximum velocity of follower during outstroke in cm/s\n", - "Vr=2.*w*s/THETAR##Maximum velocity of follower during return stroke in cm/s\n", - "Fo=4.*w**2.*s/THETA**2.##Maximum acceleration of follower during outstroke in m/s**2\n", - "Fr=4.*w**2.*s/THETAR**2.##Maximum acceleration of follower during return stroke in m/s**2\n", - "print'%s %.1f %s %.1f %s '%('Maximum acceleration of follower during outstroke =',Fo,' m/s**2''Maximum acceleration of follower during return stroke= ',Fr,' m/s**2')\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum acceleration of follower during outstroke = 25000.0 m/s**2Maximum acceleration of follower during return stroke= 44444.4 m/s**2 \n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/README.txt b/_Theory_Of_Machines_by__B._K._Sarkar/README.txt deleted file mode 100755 index 00388cce..00000000 --- a/_Theory_Of_Machines_by__B._K._Sarkar/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: jay parmar -Course: btech -College/Institute/Organization: iitbombay -Department/Designation: chemical engineering -Book Title: Theory Of Machines -Author: B. K. Sarkar -Publisher: Tata McGraw Hill -Year of publication: 2002 -Isbn: 0-07-048288-8 -Edition: 1 \ No newline at end of file diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1.png b/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1.png deleted file mode 100755 index 2acddb54..00000000 Binary files a/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1.png and /dev/null differ diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1_1.png b/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1_1.png deleted file mode 100755 index 2d1ddf8f..00000000 Binary files a/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter1_1.png and /dev/null differ diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2.png b/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2.png deleted file mode 100755 index 4831c950..00000000 Binary files a/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2.png and /dev/null differ diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2_1.png b/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2_1.png deleted file mode 100755 index 1892548f..00000000 Binary files a/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter2_1.png and /dev/null differ diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3.png b/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3.png deleted file mode 100755 index 68374c08..00000000 Binary files a/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3.png and /dev/null differ diff --git a/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3_1.png b/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3_1.png deleted file mode 100755 index 11ce0bbb..00000000 Binary files a/_Theory_Of_Machines_by__B._K._Sarkar/screenshots/chapter3_1.png and /dev/null differ diff --git a/abcd_by_cbvbv/Chapter1.ipynb b/abcd_by_cbvbv/Chapter1.ipynb deleted file mode 100755 index 1cb4536f..00000000 --- a/abcd_by_cbvbv/Chapter1.ipynb +++ /dev/null @@ -1,504 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:b9d3600de62f2e313ebd68d87880d0cad19ed95bdfc9a86e635db985c6359259" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "UNIT-1:Waves & Vibrations" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.1,Page no:11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "n=512 #frequency in Hz\n", - "l=67 #wavelength in cm\n", - "\n", - "#Calculation\n", - "v=n*l #calculating velocity\n", - "\n", - "#Result\n", - "print\"Velocity = \",v,\" cm/sec\" \n", - "print\"NOTE:Calculation mistake in book\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity = 34304 cm/sec\n", - "NOTE:Calculation mistake in book\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.2,Page no:11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "v=340 #velocity in m/sec\n", - "l=0.68 #wavelength in m\n", - "\n", - "#Calculation\n", - "n=v/l #calculating frequency\n", - "\n", - "#Result\n", - "print\"Frequency\",n,\"Hz\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Frequency 500.0 Hz\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.3,Page no:12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "v=3*10**8 #velocity in m/sec\n", - "n=500*10**3 #frequency in Hz\n", - "\n", - "#Calculation\n", - "l=v/n #calculating wavelength\n", - "\n", - "#Result\n", - "print\"Wavelength=\",l,\"m\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wavelength= 600 m\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.4,Page no:12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "v=330 #velocity in m/sec\n", - "n=560.0 #frequency in Hz\n", - "\n", - "#Calculation\n", - "lamda=v/n #calculating wavelength\n", - "\n", - "#Result\n", - "print\"lambda=\",round(lamda,3),\"m\"\n", - "print\"Distance travelled in 30 vibrations in m = \",round(lamda*30,2),\"m\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "lambda= 0.589 m\n", - "Distance travelled in 30 vibrations in m = 17.68 m\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.5,Page no:12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "\n", - "#Variable declaration\n", - "s=90.0 #distance in m\n", - "u=0 #initial velocity in m/sec\n", - "\n", - "#Calculation\n", - "t=math.sqrt(90/4.9) #calculating time using kinematical equation\n", - "later=4.56 #Time after which sound is heard\n", - "t1=later-t #calculating time taken by sound to travel\n", - "t1=round(t1,2)\n", - "v=s/t1 #calculating velocity\n", - "\n", - "#Result\n", - "print\"Velocity in m/sec = \",round(v,2),\"m/s\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity in m/sec = 333.33 m/s\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.6,Page no:13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "l1=1.5 #wavelength in m\n", - "l2=2 #wavelength in m\n", - "v1=120 #velocity in m/sec\n", - "\n", - "#Calculation\n", - "n=v1/l1 #calculating frequency\n", - "v2=n*l2 #calculating velocity\n", - "\n", - "#Result\n", - "print\"Velocity in m/sec = \",v2,\"m/sec\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity in m/sec = 160.0 m/sec\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.7,Page no:14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "l=5641*10**-10 #wavelength in m\n", - "c=3*10**8 #velocity in m/sec\n", - "u=1.58 #refractive index of glass\n", - "\n", - "#Calculation\n", - "n=c/l #calculating frequency\n", - "cg=c/u #calculating velocity of light in glass\n", - "l1=cg/n #calculating wavelegth in glass\n", - "\n", - "#Result\n", - "print\"Wavelength in glass in Angstrom =\",l1*10**10,\"Angstrom\" \n", - "print\"\\n\\nNOTE:Calculation ambiguity in book,value of cg is taken as 1.9*10**8 ,Therefore final answer is changed\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wavelength in glass in Angstrom = 3570.25316456 Angstrom\n", - "\n", - "\n", - "NOTE:Calculation ambiguity in book,value of cg is taken as 1.9*10**8 ,Therefore final answer is changed\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.8,Page no:15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "n=12*10**6 #frequency in Hz\n", - "v=3*10**8 #velocity in m/sec\n", - "\n", - "#Calculation\n", - "l=v/n #calculating wavelength\n", - "\n", - "#Result\n", - "print\"Wavelength in m = \",l,\"m\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wavelength in m = 25 m\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.9,Page no:15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "n=400 #frequency in Hz\n", - "v=300.0 #velocity in m/sec\n", - "\n", - "#Calculation\n", - "l=v/n #calculating wavelength\n", - "\n", - "#Result\n", - "print\"Wavelength=\",l,\"m\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wavelength= 0.75 m\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.10,Page no:22" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "\n", - "#Variable declaration\n", - "a=20 #amplitude in cm\n", - "n=6 #frequency per second\n", - "\n", - "#Calculation\n", - "w=2*(math.pi)*n #omega in radians/sec\n", - "\n", - "#Result\n", - "print\"Omega in radians/sec = \",round(w,1),\"rad/sec\" \n", - "print\"y=\",a,\"sin\",round(w,1),\"t\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Omega in radians/sec = 37.7 rad/sec\n", - "y= 20 sin 37.7 t\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.11,Page no:23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "a=6 #amplitude in cm\n", - "n=9 #frequency in Hz.\n", - "\n", - "#Calculation\n", - "vmax=2*(math.pi)*n*6 #calculating velocity in cm/sec\n", - "acc=-((18*(math.pi))**2)*6 #calculating acc. in m/sec square\n", - "\n", - "#Result\n", - "print\"Maximum velocity in cm/sec = \",round(vmax,2),\"cm/sec\" \n", - "print\"Velocity at extreme position = 0\" \n", - "print\"Accelaration at mean position = 0\" \n", - "print\"Accelaration at extreme position = \",round(acc,1),\"m/sec^2\" \n", - "print\"\\n\\nNOTE:Calculation mistake in book\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum velocity in cm/sec = 339.29 cm/sec\n", - "Velocity at extreme position = 0\n", - "Accelaration at mean position = 0\n", - "Accelaration at extreme position = -19186.5 m/sec^2\n", - "\n", - "\n", - "NOTE:Calculation mistake in book\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.12,Page no:26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "#Variable declaration\n", - "g=9.8 #gravitational constant\n", - "m=50 #mass in kg\n", - "l=0.2 #length in m\n", - "T=0.6 #time period\n", - "\n", - "#Calculation\n", - "k=(m*g)/l #calculating constant\n", - "m=2450*((T/(2*(math.pi)))**2) #calcualting mass using given time period\n", - "\n", - "#Result\n", - "print\"Mass of body= \",round(m,2),\"kg\" \n", - "print\"Weight of suspended body=\",round(m,2)*g,\"N\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of body= 22.34 kg\n", - "Weight of suspended body= 218.932 N\n" - ] - } - ], - "prompt_number": 12 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/abcd_by_cbvbv/Chapter1_1.ipynb b/abcd_by_cbvbv/Chapter1_1.ipynb deleted file mode 100755 index 1cb4536f..00000000 --- a/abcd_by_cbvbv/Chapter1_1.ipynb +++ /dev/null @@ -1,504 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:b9d3600de62f2e313ebd68d87880d0cad19ed95bdfc9a86e635db985c6359259" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "UNIT-1:Waves & Vibrations" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.1,Page no:11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "n=512 #frequency in Hz\n", - "l=67 #wavelength in cm\n", - "\n", - "#Calculation\n", - "v=n*l #calculating velocity\n", - "\n", - "#Result\n", - "print\"Velocity = \",v,\" cm/sec\" \n", - "print\"NOTE:Calculation mistake in book\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity = 34304 cm/sec\n", - "NOTE:Calculation mistake in book\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.2,Page no:11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "v=340 #velocity in m/sec\n", - "l=0.68 #wavelength in m\n", - "\n", - "#Calculation\n", - "n=v/l #calculating frequency\n", - "\n", - "#Result\n", - "print\"Frequency\",n,\"Hz\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Frequency 500.0 Hz\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.3,Page no:12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "v=3*10**8 #velocity in m/sec\n", - "n=500*10**3 #frequency in Hz\n", - "\n", - "#Calculation\n", - "l=v/n #calculating wavelength\n", - "\n", - "#Result\n", - "print\"Wavelength=\",l,\"m\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wavelength= 600 m\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.4,Page no:12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "v=330 #velocity in m/sec\n", - "n=560.0 #frequency in Hz\n", - "\n", - "#Calculation\n", - "lamda=v/n #calculating wavelength\n", - "\n", - "#Result\n", - "print\"lambda=\",round(lamda,3),\"m\"\n", - "print\"Distance travelled in 30 vibrations in m = \",round(lamda*30,2),\"m\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "lambda= 0.589 m\n", - "Distance travelled in 30 vibrations in m = 17.68 m\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.5,Page no:12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "\n", - "#Variable declaration\n", - "s=90.0 #distance in m\n", - "u=0 #initial velocity in m/sec\n", - "\n", - "#Calculation\n", - "t=math.sqrt(90/4.9) #calculating time using kinematical equation\n", - "later=4.56 #Time after which sound is heard\n", - "t1=later-t #calculating time taken by sound to travel\n", - "t1=round(t1,2)\n", - "v=s/t1 #calculating velocity\n", - "\n", - "#Result\n", - "print\"Velocity in m/sec = \",round(v,2),\"m/s\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity in m/sec = 333.33 m/s\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.6,Page no:13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "l1=1.5 #wavelength in m\n", - "l2=2 #wavelength in m\n", - "v1=120 #velocity in m/sec\n", - "\n", - "#Calculation\n", - "n=v1/l1 #calculating frequency\n", - "v2=n*l2 #calculating velocity\n", - "\n", - "#Result\n", - "print\"Velocity in m/sec = \",v2,\"m/sec\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity in m/sec = 160.0 m/sec\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.7,Page no:14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "l=5641*10**-10 #wavelength in m\n", - "c=3*10**8 #velocity in m/sec\n", - "u=1.58 #refractive index of glass\n", - "\n", - "#Calculation\n", - "n=c/l #calculating frequency\n", - "cg=c/u #calculating velocity of light in glass\n", - "l1=cg/n #calculating wavelegth in glass\n", - "\n", - "#Result\n", - "print\"Wavelength in glass in Angstrom =\",l1*10**10,\"Angstrom\" \n", - "print\"\\n\\nNOTE:Calculation ambiguity in book,value of cg is taken as 1.9*10**8 ,Therefore final answer is changed\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wavelength in glass in Angstrom = 3570.25316456 Angstrom\n", - "\n", - "\n", - "NOTE:Calculation ambiguity in book,value of cg is taken as 1.9*10**8 ,Therefore final answer is changed\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.8,Page no:15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "n=12*10**6 #frequency in Hz\n", - "v=3*10**8 #velocity in m/sec\n", - "\n", - "#Calculation\n", - "l=v/n #calculating wavelength\n", - "\n", - "#Result\n", - "print\"Wavelength in m = \",l,\"m\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wavelength in m = 25 m\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.9,Page no:15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "n=400 #frequency in Hz\n", - "v=300.0 #velocity in m/sec\n", - "\n", - "#Calculation\n", - "l=v/n #calculating wavelength\n", - "\n", - "#Result\n", - "print\"Wavelength=\",l,\"m\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Wavelength= 0.75 m\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.10,Page no:22" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import math \n", - "\n", - "#Variable declaration\n", - "a=20 #amplitude in cm\n", - "n=6 #frequency per second\n", - "\n", - "#Calculation\n", - "w=2*(math.pi)*n #omega in radians/sec\n", - "\n", - "#Result\n", - "print\"Omega in radians/sec = \",round(w,1),\"rad/sec\" \n", - "print\"y=\",a,\"sin\",round(w,1),\"t\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Omega in radians/sec = 37.7 rad/sec\n", - "y= 20 sin 37.7 t\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.11,Page no:23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - " \n", - "\n", - "#Variable declaration\n", - "a=6 #amplitude in cm\n", - "n=9 #frequency in Hz.\n", - "\n", - "#Calculation\n", - "vmax=2*(math.pi)*n*6 #calculating velocity in cm/sec\n", - "acc=-((18*(math.pi))**2)*6 #calculating acc. in m/sec square\n", - "\n", - "#Result\n", - "print\"Maximum velocity in cm/sec = \",round(vmax,2),\"cm/sec\" \n", - "print\"Velocity at extreme position = 0\" \n", - "print\"Accelaration at mean position = 0\" \n", - "print\"Accelaration at extreme position = \",round(acc,1),\"m/sec^2\" \n", - "print\"\\n\\nNOTE:Calculation mistake in book\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum velocity in cm/sec = 339.29 cm/sec\n", - "Velocity at extreme position = 0\n", - "Accelaration at mean position = 0\n", - "Accelaration at extreme position = -19186.5 m/sec^2\n", - "\n", - "\n", - "NOTE:Calculation mistake in book\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example no:1.12,Page no:26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "#Variable declaration\n", - "g=9.8 #gravitational constant\n", - "m=50 #mass in kg\n", - "l=0.2 #length in m\n", - "T=0.6 #time period\n", - "\n", - "#Calculation\n", - "k=(m*g)/l #calculating constant\n", - "m=2450*((T/(2*(math.pi)))**2) #calcualting mass using given time period\n", - "\n", - "#Result\n", - "print\"Mass of body= \",round(m,2),\"kg\" \n", - "print\"Weight of suspended body=\",round(m,2)*g,\"N\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Mass of body= 22.34 kg\n", - "Weight of suspended body= 218.932 N\n" - ] - } - ], - "prompt_number": 12 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/abcd_by_cbvbv/screenshots/k1.png b/abcd_by_cbvbv/screenshots/k1.png deleted file mode 100755 index 995e3ebf..00000000 Binary files a/abcd_by_cbvbv/screenshots/k1.png and /dev/null differ diff --git a/abcd_by_cbvbv/screenshots/k2.png b/abcd_by_cbvbv/screenshots/k2.png deleted file mode 100755 index f0b1ec67..00000000 Binary files a/abcd_by_cbvbv/screenshots/k2.png and /dev/null differ diff --git a/abcd_by_cbvbv/screenshots/k2_1.png b/abcd_by_cbvbv/screenshots/k2_1.png deleted file mode 100755 index f0b1ec67..00000000 Binary files a/abcd_by_cbvbv/screenshots/k2_1.png and /dev/null differ diff --git a/abcd_by_cbvbv/screenshots/k3.png b/abcd_by_cbvbv/screenshots/k3.png deleted file mode 100755 index 90f96617..00000000 Binary files a/abcd_by_cbvbv/screenshots/k3.png and /dev/null differ diff --git a/abcd_by_cbvbv/screenshots/k3_1.png b/abcd_by_cbvbv/screenshots/k3_1.png deleted file mode 100755 index 90f96617..00000000 Binary files a/abcd_by_cbvbv/screenshots/k3_1.png and /dev/null differ diff --git a/abcd_by_cbvbv/screenshots/k3_2.png b/abcd_by_cbvbv/screenshots/k3_2.png deleted file mode 100755 index 90f96617..00000000 Binary files a/abcd_by_cbvbv/screenshots/k3_2.png and /dev/null differ diff --git a/t_by_t/README.txt b/t_by_t/README.txt deleted file mode 100755 index ac59ae1b..00000000 --- a/t_by_t/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: t t -Course: mtech -College/Institute/Organization: t -Department/Designation: t -Book Title: t -Author: t -Publisher: t -Year of publication: 1 -Isbn: 4 -Edition: 1 \ No newline at end of file diff --git a/t_by_t/anubhav.ipynb b/t_by_t/anubhav.ipynb deleted file mode 100755 index 61f4f2a7..00000000 --- a/t_by_t/anubhav.ipynb +++ /dev/null @@ -1,335 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:695be6f5d590e853c0078224291d8b06e5e832ca7707f21f65e700432eacc419" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter15:POWER SYSTEMS" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15.1:pg-696" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "V1=250\n", - "V2=480\n", - "Vol2_by_Vol1=V1/V2\n", - "\n", - "sav=(1-Vol2_by_Vol1)*100\n", - "print(sav)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "100\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15.2:pg-697" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "P=5E6\n", - "pf=0.85\n", - "V=33000\n", - "l=50000\n", - "rho=3E-8\n", - "Pt=P*pf\n", - "Pl=Pt*0.1\n", - "I=P/V\n", - "A1=2*I*I*rho*l/Pl\n", - "Vol1=2*l*A1\n", - "print(Vol1)\n", - "Il=P/sqrt(3)/V\n", - "A2=3*Il*Il*rho*l/Pl\n", - "Vol2=3*l*A2\n", - "print(Vol2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "16.2048290391\n", - "12.1536217793" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15.3:pg-698" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "f=50\n", - "w=2*math.pi*f\n", - "I=0.8\n", - "V=220\n", - "P=75\n", - "phi=math.acos(P/V/I)\n", - "\n", - "phi_new=math.acos(0.9)\n", - "Ic=I*cos(phi)*(tan(phi)-tan(phi_new))\n", - "C=Ic/V/w\n", - "print\"C=\",round(C,8)\n", - "\n", - "phi_new=math.acos(1)\n", - "Ic=I*cos(phi)*(tan(phi)-tan(phi_new))\n", - "C=Ic/V/w\n", - "print\"C=\",round(C,8)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "C= 1.157e-05\n", - "C= 1.157e-05\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15.4:pg-698" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "Cond_cost=100\n", - "charge=60\n", - "phi2=math.asin(0.1*Cond_cost/charge)\n", - "pf=cos(phi2)\n", - "print(pf)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0.986013297183\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15.5:pg-699" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "Oc=400000\n", - "pf1=0.8\n", - "phi1=math.acos(pf1)\n", - "ab=Oc/cos(phi1)*sin(phi1)\n", - "pf2=0.25\n", - "phi3=math.acos(pf2)\n", - "pf2=0.484\n", - "\n", - "gammaa=(ab-pf2*Oc)/(pf2*cos(phi3)+sin(phi3))\n", - "print(gammaa)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "97682.2645812\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15.6:pg-700" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "f=50\n", - "w=2*math.pi*f\n", - "P=2E6\n", - "V=11000\n", - "pf=0.8\n", - "phi=math.acos(pf)\n", - "Xl=10\n", - "IR=P/sqrt(3)/V/pf\n", - "Vr=V/sqrt(3)\n", - "Vs=Vr+IR*Xl*sin(phi)\n", - "Vsll=Vs*sqrt(3)\n", - "print(Vsll)\n", - "VR=Vsll/V-1\n", - "print(VR)\n", - "\n", - "pf=1\n", - "print(pf)\n", - "Qc=P*tan(phi)\n", - "C=Qc/V/V/w\n", - "print(C)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "12363.6363636\n", - "0.123966942149\n", - "1\n", - "3.94599032459e-05\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Ex15.7:pg-701" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "f=50\n", - "w=2*math.pi*f\n", - "V=33000\n", - "Vr=V/sqrt(3)\n", - "P=24E6/3\n", - "pf=0.8\n", - "phi=math.acos(pf)\n", - "Ia=P/Vr/pf\n", - "Rl=4.0\n", - "Xl=20\n", - "Vs=Vr+Ia*(Xl*sin(phi)+Rl*cos(phi))\n", - "Vsll=sqrt(3)*Vs\n", - "VR=Vsll/V-1\n", - "print(Vsll)\n", - "Ia=Ia*exp(-1j*phi)\n", - "print(norm(Ia))\n", - "\n", - "phi1=math.atan(-Rl/Xl)\n", - "pf=cos(phi1)\n", - "Ia1=P/Vr/pf\n", - "Ia1=Ia1*exp(-1j*phi1) #calculation mistake in the book at this step\n", - "\n", - "Ic=Ia1-Ia\n", - "C=norm(Ic/w/Vr)\n", - "print(C)\n", - "\n", - "LL1=norm(Ia*Ia*Rl)\n", - "effi1=P/(P+LL1)\n", - "LL2=norm(Ia1*Ia1*Rl)\n", - "effi2=P/(P+LL2)\n", - "print(effi1)\n", - "print(effi2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "46818.1818182\n", - "524.863881081" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "6.66433921487e-05\n", - "0.878934624697\n", - "0.916018976481\n" - ] - } - ], - "prompt_number": 11 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/t_by_t/screenshots/blank1.png b/t_by_t/screenshots/blank1.png deleted file mode 100755 index e69de29b..00000000 diff --git a/t_by_t/screenshots/blank1_(another_copy).png b/t_by_t/screenshots/blank1_(another_copy).png deleted file mode 100755 index e69de29b..00000000 diff --git a/t_by_t/screenshots/blank1_(copy).png b/t_by_t/screenshots/blank1_(copy).png deleted file mode 100755 index e69de29b..00000000 -- cgit